feat(agents-square): add source browsing and import flow#1883
Open
futuremeng wants to merge 2 commits intoagentscope-ai:mainfrom
Open
feat(agents-square): add source browsing and import flow#1883futuremeng wants to merge 2 commits intoagentscope-ai:mainfrom
futuremeng wants to merge 2 commits intoagentscope-ai:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an “Agents Square” marketplace-style flow to CoPaw, spanning new backend config + APIs for managing agent sources and importing agents, plus a Console UI to browse sources/items and trigger imports.
Changes:
- Introduces
agents_squareconfiguration models (sources, cache, install policy) in the root config. - Adds Agents Square router endpoints for listing/updating/validating sources, aggregating items, and importing agents.
- Implements Console UI (drawer) for browsing/searching/importing agents and editing/validating sources, with i18n strings and new backend unit tests.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/app/routers/test_agents_square.py | Adds unit tests covering square items listing, source validation, import success/conflict, and pinned-source deletion rejection. |
| src/copaw/config/config.py | Adds Pydantic models for Agents Square config and wires agents_square into the root Config. |
| src/copaw/app/routers/agents.py | Implements Agents Square APIs, git-based aggregation, caching, source validation, and agent import flow. |
| console/src/pages/Settings/Agents/index.tsx | Adds Agents Square drawer UI with item search/filter, import flow, and source management/editing. |
| console/src/pages/Settings/Agents/index.module.less | Styles the Agents Square item list/cards (including dark-mode adjustments). |
| console/src/locales/en.json | Adds English strings for Agents Square UI. |
| console/src/locales/zh.json | Adds Chinese strings for Agents Square UI. |
| console/src/locales/ru.json | Adds Russian strings for Agents Square UI. |
| console/src/locales/ja.json | Adds Japanese strings for Agents Square UI. |
| console/src/api/types/agents.ts | Adds TS types for Agents Square sources/items/import APIs. |
| console/src/api/modules/agents.ts | Adds client methods for Agents Square endpoints. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| status_code=400, | ||
| detail=f"SOURCE_PINNED_CANNOT_DELETE: {source_id}", | ||
| ) | ||
|
|
Comment on lines
+668
to
+682
| ttl_sec = int(payload.cache.get("ttl_sec", 600)) | ||
| overwrite_default = bool(payload.install.get("overwrite_default", False)) | ||
| preserve_workspace_files = bool( | ||
| payload.install.get("preserve_workspace_files", True), | ||
| ) | ||
|
|
||
| return AgentsSquareConfig( | ||
| version=max(1, int(payload.version)), | ||
| sources=normalized_sources, | ||
| cache=AgentsSquareCacheConfig(ttl_sec=ttl_sec), | ||
| install=AgentsSquareInstallConfig( | ||
| overwrite_default=overwrite_default, | ||
| preserve_workspace_files=preserve_workspace_files, | ||
| ), | ||
| ) |
| async def get_square_items(refresh: bool = False) -> dict: | ||
| """Get aggregated Agents Square items.""" | ||
| config = load_config() | ||
| items, source_errors, meta, _ = _aggregate_square_items( |
| source_id: str | ||
| agent_id: str | ||
| overwrite: bool = False | ||
| enable: bool = True |
Comment on lines
+965
to
+966
| (workspace_dir / "AGENTS.md").write_text(content + "\n", encoding="utf-8") | ||
|
|
Comment on lines
+442
to
+443
| source_root = (tmp_dir / (source.path or ".")).resolve() | ||
| if not str(source_root).startswith(str(tmp_dir.resolve())): |
Comment on lines
+597
to
+604
| if _OWNER_REPO_PATTERN.fullmatch(raw): | ||
| return True | ||
| if _extract_github_source_spec(raw) is not None: | ||
| return True | ||
| if raw.startswith(("https://", "http://", "git@")): | ||
| return True | ||
| if raw.endswith(".git"): | ||
| return True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scope
This PR adds Agents Square source browsing and import flow across backend APIs and Console UI.
What Is Included
What Is Not Included
Validation
Notes For Reviewers