@evandu/super-pi-server 0.0.0-stage → 0.1.260
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +250 -3
- package/agents/code-auditor.md +64 -0
- package/agents/code-designer.md +64 -0
- package/agents/coder.md +24 -0
- package/agents/critic.md +24 -0
- package/agents/document-organizer.md +48 -0
- package/agents/patcher.md +27 -0
- package/agents/planner.md +30 -0
- package/agents/project-leader.md +28 -0
- package/agents/reviewer.md +27 -0
- package/agents/scout.md +27 -0
- package/agents/solution-designer.md +62 -0
- package/agents/super-pi-documents/index.ts +92 -0
- package/agents/super-pi-feishu/index.ts +88 -0
- package/agents/super-pi-knowledge/index.ts +70 -0
- package/agents/super-pi-managed-model/index.ts +9 -0
- package/agents/super-pi-memory/index.ts +75 -0
- package/agents/super-pi-native-tools/index.ts +1 -0
- package/agents/super-pi-task/core.ts +2262 -0
- package/agents/super-pi-task/index.ts +814 -0
- package/agents/super-pi-task/workflow-schema.ts +34 -0
- package/agents/super-pi-web/index.ts +32 -0
- package/agents/verifier.md +25 -0
- package/assets/fonts/LICENSE +92 -0
- package/assets/fonts/NotoSansSC-Bold.otf +0 -0
- package/assets/fonts/NotoSansSC-Regular.otf +0 -0
- package/assets/knowledge-model/README.md +37 -0
- package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/config.json +31 -0
- package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/onnx/model_quantized.onnx +0 -0
- package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/special_tokens_map.json +7 -0
- package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/tokenizer.json +21278 -0
- package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/tokenizer_config.json +15 -0
- package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/vocab.txt +21128 -0
- package/bin/npm-prefix.d.ts +1 -0
- package/bin/npm-prefix.js +10 -0
- package/bin/super-pi.js +349 -0
- package/dist/client/.super-pi-client-sources.json +82 -0
- package/dist/client/assets/CodeMirrorEditor-mi9rGUce.js +2 -0
- package/dist/client/assets/GitDiffEditor-CpoDDQrA.css +1 -0
- package/dist/client/assets/GitDiffEditor-FQBfGxOY.js +29 -0
- package/dist/client/assets/diff-ChtP43wD.js +1 -0
- package/dist/client/assets/dist-AW5lyI3I.js +1 -0
- package/dist/client/assets/dist-B3-a6uF0.js +7 -0
- package/dist/client/assets/dist-BGxkyh6e.js +1 -0
- package/dist/client/assets/dist-BJxfd7yb.js +11 -0
- package/dist/client/assets/dist-BRVQKlcp.js +1 -0
- package/dist/client/assets/dist-BV64A9Ji.js +1 -0
- package/dist/client/assets/dist-BXAOrsjq.js +1 -0
- package/dist/client/assets/dist-CKF2Jksy.js +1 -0
- package/dist/client/assets/dist-CX_Hm4GS.js +1 -0
- package/dist/client/assets/dist-Cus6_oaF.js +2 -0
- package/dist/client/assets/dist-Cx00EZKR.js +23 -0
- package/dist/client/assets/dist-D71y2EI1.js +1 -0
- package/dist/client/assets/dist-D978o95T.js +5 -0
- package/dist/client/assets/dist-Dc1MBGAG.js +1 -0
- package/dist/client/assets/dist-Dds-qLxY.js +9 -0
- package/dist/client/assets/dist-DeD9copn.js +1 -0
- package/dist/client/assets/dist-DuvGReu-.js +6 -0
- package/dist/client/assets/dist-Dvb0SqcK.js +2 -0
- package/dist/client/assets/dist-J6XWqRpB.js +3 -0
- package/dist/client/assets/dist-QzbOCAU6.js +1 -0
- package/dist/client/assets/dist-moiMRpw_.js +1 -0
- package/dist/client/assets/dist-scBkrwv-.js +2 -0
- package/dist/client/assets/dockerfile-BDePf5PZ.js +1 -0
- package/dist/client/assets/index-Cn7hdrDw.js +350 -0
- package/dist/client/assets/index-UfzqdECL.css +1 -0
- package/dist/client/assets/powershell-D8WpQPaX.js +1 -0
- package/dist/client/assets/properties-C357ku5U.js +1 -0
- package/dist/client/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/client/assets/ruby-ChfNwlCY.js +1 -0
- package/dist/client/assets/shell-DwuoZtxw.js +1 -0
- package/dist/client/assets/swift-DKB6_1j6.js +1 -0
- package/dist/client/assets/toml-BPTmHmyx.js +1 -0
- package/dist/client/favicon.ico +0 -0
- package/dist/client/favicon.png +0 -0
- package/dist/client/favicon.svg +10 -0
- package/dist/client/index.html +18 -0
- package/dist/extension.d.ts +15 -0
- package/dist/extension.js +126 -0
- package/dist/server/active-memory.d.ts +247 -0
- package/dist/server/active-memory.js +669 -0
- package/dist/server/agents.d.ts +245 -0
- package/dist/server/agents.js +701 -0
- package/dist/server/application/catalog-service.d.ts +98 -0
- package/dist/server/application/catalog-service.js +245 -0
- package/dist/server/application/conversation-service.d.ts +245 -0
- package/dist/server/application/conversation-service.js +654 -0
- package/dist/server/application/document-service.d.ts +68 -0
- package/dist/server/application/document-service.js +120 -0
- package/dist/server/application/extension-ui-service.d.ts +44 -0
- package/dist/server/application/extension-ui-service.js +135 -0
- package/dist/server/application/feishu-service.d.ts +179 -0
- package/dist/server/application/feishu-service.js +358 -0
- package/dist/server/application/group-chat-service.d.ts +75 -0
- package/dist/server/application/group-chat-service.js +953 -0
- package/dist/server/application/group-execution.d.ts +15 -0
- package/dist/server/application/group-execution.js +77 -0
- package/dist/server/application/project-service.d.ts +464 -0
- package/dist/server/application/project-service.js +2523 -0
- package/dist/server/application/provider-service.d.ts +174 -0
- package/dist/server/application/provider-service.js +510 -0
- package/dist/server/application/run-service.d.ts +547 -0
- package/dist/server/application/run-service.js +2683 -0
- package/dist/server/application/scheduled-task-service.d.ts +184 -0
- package/dist/server/application/scheduled-task-service.js +391 -0
- package/dist/server/application/session-orchestrator-service.d.ts +388 -0
- package/dist/server/application/session-orchestrator-service.js +1146 -0
- package/dist/server/application/session-reminder-service.d.ts +59 -0
- package/dist/server/application/session-reminder-service.js +141 -0
- package/dist/server/application/session-watchdog.d.ts +171 -0
- package/dist/server/application/session-watchdog.js +284 -0
- package/dist/server/application/workspace-service.d.ts +52 -0
- package/dist/server/application/workspace-service.js +186 -0
- package/dist/server/application/worktree-service.d.ts +13 -0
- package/dist/server/application/worktree-service.js +76 -0
- package/dist/server/browser-access.d.ts +34 -0
- package/dist/server/browser-access.js +89 -0
- package/dist/server/capability.d.ts +105 -0
- package/dist/server/capability.js +170 -0
- package/dist/server/command-handler.d.ts +93 -0
- package/dist/server/command-handler.js +540 -0
- package/dist/server/content-search.d.ts +16 -0
- package/dist/server/content-search.js +235 -0
- package/dist/server/conversation-usage.d.ts +22 -0
- package/dist/server/conversation-usage.js +43 -0
- package/dist/server/documents.d.ts +152 -0
- package/dist/server/documents.js +998 -0
- package/dist/server/engineering-learning.d.ts +30 -0
- package/dist/server/engineering-learning.js +106 -0
- package/dist/server/exec-service.d.ts +45 -0
- package/dist/server/exec-service.js +167 -0
- package/dist/server/explicit-file-open.d.ts +34 -0
- package/dist/server/explicit-file-open.js +105 -0
- package/dist/server/failure-text.d.ts +18 -0
- package/dist/server/failure-text.js +44 -0
- package/dist/server/feishu-cli.d.ts +223 -0
- package/dist/server/feishu-cli.js +464 -0
- package/dist/server/file-changes.d.ts +119 -0
- package/dist/server/file-changes.js +280 -0
- package/dist/server/file-diff.d.ts +41 -0
- package/dist/server/file-diff.js +97 -0
- package/dist/server/file-index.d.ts +100 -0
- package/dist/server/file-index.js +296 -0
- package/dist/server/file-name-index.d.ts +160 -0
- package/dist/server/file-name-index.js +411 -0
- package/dist/server/files.d.ts +269 -0
- package/dist/server/files.js +748 -0
- package/dist/server/git.d.ts +245 -0
- package/dist/server/git.js +903 -0
- package/dist/server/http-server.d.ts +45 -0
- package/dist/server/http-server.js +3830 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +485 -0
- package/dist/server/inline-thinking.d.ts +90 -0
- package/dist/server/inline-thinking.js +181 -0
- package/dist/server/json-comments.d.ts +14 -0
- package/dist/server/json-comments.js +71 -0
- package/dist/server/knowledge-embedding-worker.d.ts +1 -0
- package/dist/server/knowledge-embedding-worker.js +27 -0
- package/dist/server/knowledge-vectors.d.ts +150 -0
- package/dist/server/knowledge-vectors.js +385 -0
- package/dist/server/knowledge.d.ts +273 -0
- package/dist/server/knowledge.js +848 -0
- package/dist/server/length-continuation.d.ts +83 -0
- package/dist/server/length-continuation.js +118 -0
- package/dist/server/logging.d.ts +32 -0
- package/dist/server/logging.js +185 -0
- package/dist/server/managed-http-tunnel.d.ts +6 -0
- package/dist/server/managed-http-tunnel.js +85 -0
- package/dist/server/managed-http.d.ts +4 -0
- package/dist/server/managed-http.js +85 -0
- package/dist/server/managed-model-adapter.d.ts +17 -0
- package/dist/server/managed-model-adapter.js +75 -0
- package/dist/server/managed-model-gateway.d.ts +49 -0
- package/dist/server/managed-model-gateway.js +73 -0
- package/dist/server/managed-servers.d.ts +55 -0
- package/dist/server/managed-servers.js +396 -0
- package/dist/server/managed-ssh.d.ts +26 -0
- package/dist/server/managed-ssh.js +73 -0
- package/dist/server/manager-vault.d.ts +11 -0
- package/dist/server/manager-vault.js +67 -0
- package/dist/server/memory-recall.d.ts +25 -0
- package/dist/server/memory-recall.js +45 -0
- package/dist/server/memory.d.ts +67 -0
- package/dist/server/memory.js +216 -0
- package/dist/server/message-media.d.ts +7 -0
- package/dist/server/message-media.js +54 -0
- package/dist/server/model-context-window.d.ts +186 -0
- package/dist/server/model-context-window.js +444 -0
- package/dist/server/model-filter.d.ts +23 -0
- package/dist/server/model-filter.js +48 -0
- package/dist/server/models-store.d.ts +36 -0
- package/dist/server/models-store.js +132 -0
- package/dist/server/native-tool-settings.d.ts +25 -0
- package/dist/server/native-tool-settings.js +41 -0
- package/dist/server/native-tools-extension.d.ts +2 -0
- package/dist/server/native-tools-extension.js +39 -0
- package/dist/server/native-tools-service.d.ts +39 -0
- package/dist/server/native-tools-service.js +240 -0
- package/dist/server/persistence/app-state-repository.d.ts +65 -0
- package/dist/server/persistence/app-state-repository.js +1 -0
- package/dist/server/persistence/json-state-repository.d.ts +14 -0
- package/dist/server/persistence/json-state-repository.js +43 -0
- package/dist/server/persistence/open-state-store.d.ts +3 -0
- package/dist/server/persistence/open-state-store.js +35 -0
- package/dist/server/persistence/rename.d.ts +22 -0
- package/dist/server/persistence/rename.js +44 -0
- package/dist/server/persistence/sqlite-state-repository.d.ts +12 -0
- package/dist/server/persistence/sqlite-state-repository.js +264 -0
- package/dist/server/pi-command.d.ts +94 -0
- package/dist/server/pi-command.js +265 -0
- package/dist/server/pi-native.d.ts +12 -0
- package/dist/server/pi-native.js +16 -0
- package/dist/server/pi-session-events.d.ts +158 -0
- package/dist/server/pi-session-events.js +373 -0
- package/dist/server/pi-session-pool.d.ts +233 -0
- package/dist/server/pi-session-pool.js +382 -0
- package/dist/server/pi-session.d.ts +642 -0
- package/dist/server/pi-session.js +655 -0
- package/dist/server/presentations/schema.d.ts +120 -0
- package/dist/server/presentations/schema.js +128 -0
- package/dist/server/provider-network.d.ts +16 -0
- package/dist/server/provider-network.js +106 -0
- package/dist/server/provider-proxy.d.ts +18 -0
- package/dist/server/provider-proxy.js +200 -0
- package/dist/server/providers.d.ts +333 -0
- package/dist/server/providers.js +989 -0
- package/dist/server/remote-bootstrap.d.ts +17 -0
- package/dist/server/remote-bootstrap.js +119 -0
- package/dist/server/rpc-channel.d.ts +131 -0
- package/dist/server/rpc-channel.js +135 -0
- package/dist/server/runtime.d.ts +1393 -0
- package/dist/server/runtime.js +3286 -0
- package/dist/server/scheduled-tasks.d.ts +101 -0
- package/dist/server/scheduled-tasks.js +138 -0
- package/dist/server/server-context.d.ts +119 -0
- package/dist/server/server-context.js +1 -0
- package/dist/server/session-cwd.d.ts +19 -0
- package/dist/server/session-cwd.js +58 -0
- package/dist/server/session-ledger.d.ts +67 -0
- package/dist/server/session-ledger.js +76 -0
- package/dist/server/session-memory-scope.d.ts +4 -0
- package/dist/server/session-memory-scope.js +30 -0
- package/dist/server/session-repository.d.ts +100 -0
- package/dist/server/session-repository.js +246 -0
- package/dist/server/session-tree-scope.d.ts +125 -0
- package/dist/server/session-tree-scope.js +337 -0
- package/dist/server/skills.d.ts +23 -0
- package/dist/server/skills.js +190 -0
- package/dist/server/store.d.ts +1062 -0
- package/dist/server/store.js +3305 -0
- package/dist/server/subagent-runs.d.ts +185 -0
- package/dist/server/subagent-runs.js +383 -0
- package/dist/server/subagents.d.ts +200 -0
- package/dist/server/subagents.js +619 -0
- package/dist/server/task-tool.d.ts +282 -0
- package/dist/server/task-tool.js +507 -0
- package/dist/server/tavily.d.ts +32 -0
- package/dist/server/tavily.js +136 -0
- package/dist/server/team-context.d.ts +12 -0
- package/dist/server/team-context.js +180 -0
- package/dist/server/terminal.d.ts +163 -0
- package/dist/server/terminal.js +557 -0
- package/dist/server/thinking-level-discovery.d.ts +38 -0
- package/dist/server/thinking-level-discovery.js +183 -0
- package/dist/server/time-zone.d.ts +20 -0
- package/dist/server/time-zone.js +32 -0
- package/dist/server/tool-calls.d.ts +130 -0
- package/dist/server/tool-calls.js +341 -0
- package/dist/server/tool-llm.d.ts +72 -0
- package/dist/server/tool-llm.js +146 -0
- package/dist/server/tool-registry.d.ts +129 -0
- package/dist/server/tool-registry.js +249 -0
- package/dist/server/tool-runner.d.ts +112 -0
- package/dist/server/tool-runner.js +306 -0
- package/dist/server/turn-failure.d.ts +48 -0
- package/dist/server/turn-failure.js +148 -0
- package/dist/server/types.d.ts +2315 -0
- package/dist/server/types.js +11 -0
- package/dist/server/update-status.d.ts +14 -0
- package/dist/server/update-status.js +69 -0
- package/dist/server/update.d.ts +46 -0
- package/dist/server/update.js +104 -0
- package/dist/server/upload.d.ts +35 -0
- package/dist/server/upload.js +177 -0
- package/dist/server/version.d.ts +33 -0
- package/dist/server/version.js +111 -0
- package/dist/server/web.d.ts +27 -0
- package/dist/server/web.js +183 -0
- package/dist/server/workflow-engine.d.ts +47 -0
- package/dist/server/workflow-engine.js +255 -0
- package/dist/server/workflow.d.ts +329 -0
- package/dist/server/workflow.js +469 -0
- package/dist/server/workspace-file-indexes.d.ts +2 -0
- package/dist/server/workspace-file-indexes.js +61 -0
- package/dist/server/workspace-file-operations.d.ts +36 -0
- package/dist/server/workspace-file-operations.js +281 -0
- package/dist/server/workspace-file-response.d.ts +7 -0
- package/dist/server/workspace-file-response.js +79 -0
- package/dist/server/ws-server.d.ts +149 -0
- package/dist/server/ws-server.js +640 -0
- package/dist/shared/agent-order.d.ts +44 -0
- package/dist/shared/agent-order.js +50 -0
- package/dist/shared/archive-decisions.d.ts +44 -0
- package/dist/shared/archive-decisions.js +98 -0
- package/dist/shared/background-task.d.ts +25 -0
- package/dist/shared/background-task.js +183 -0
- package/dist/shared/child-session-lock.d.ts +37 -0
- package/dist/shared/child-session-lock.js +59 -0
- package/dist/shared/content-search.d.ts +22 -0
- package/dist/shared/content-search.js +1 -0
- package/dist/shared/conversation-title.d.ts +4 -0
- package/dist/shared/conversation-title.js +4 -0
- package/dist/shared/file-mentions.d.ts +17 -0
- package/dist/shared/file-mentions.js +91 -0
- package/dist/shared/git-commit.d.ts +11 -0
- package/dist/shared/git-commit.js +1 -0
- package/dist/shared/git-graph.d.ts +42 -0
- package/dist/shared/git-graph.js +30 -0
- package/dist/shared/group-chat.d.ts +132 -0
- package/dist/shared/group-chat.js +6 -0
- package/dist/shared/managed-servers.d.ts +36 -0
- package/dist/shared/managed-servers.js +1 -0
- package/dist/shared/message-media.d.ts +12 -0
- package/dist/shared/message-media.js +27 -0
- package/dist/shared/model-window-label.d.ts +39 -0
- package/dist/shared/model-window-label.js +55 -0
- package/dist/shared/native-tools.d.ts +43 -0
- package/dist/shared/native-tools.js +1 -0
- package/dist/shared/pi-cache-warming.d.ts +9 -0
- package/dist/shared/pi-cache-warming.js +4 -0
- package/dist/shared/project-overview.d.ts +107 -0
- package/dist/shared/project-overview.js +92 -0
- package/dist/shared/project-presentation.d.ts +55 -0
- package/dist/shared/project-presentation.js +111 -0
- package/dist/shared/provider-network.d.ts +30 -0
- package/dist/shared/provider-network.js +1 -0
- package/dist/shared/session-reporting.d.ts +40 -0
- package/dist/shared/session-reporting.js +97 -0
- package/dist/shared/session-search.d.ts +14 -0
- package/dist/shared/session-search.js +1 -0
- package/dist/shared/team-context-view.d.ts +33 -0
- package/dist/shared/team-context-view.js +49 -0
- package/dist/shared/team-context.d.ts +59 -0
- package/dist/shared/team-context.js +3 -0
- package/dist/shared/terminal-protocol.d.ts +71 -0
- package/dist/shared/terminal-protocol.js +1 -0
- package/dist/shared/thinking-levels.d.ts +53 -0
- package/dist/shared/thinking-levels.js +85 -0
- package/dist/shared/tool-glyph.d.ts +7 -0
- package/dist/shared/tool-glyph.js +19 -0
- package/dist/shared/transcript-order.d.ts +7 -0
- package/dist/shared/transcript-order.js +12 -0
- package/dist/shared/update-status.d.ts +28 -0
- package/dist/shared/update-status.js +1 -0
- package/dist/shared/workspace-file-preview.d.ts +4 -0
- package/dist/shared/workspace-file-preview.js +28 -0
- package/package.json +450 -4
- package/scripts/diagnose.mjs +603 -0
- package/scripts/patch-brace-expansion.mjs +260 -0
- package/scripts/restart-server.mjs +104 -0
- package/skills/presentation/SKILL.md +30 -0
- package/skills/presentation/references/data.md +10 -0
- package/skills/presentation/references/quality.md +12 -0
- package/skills/presentation/references/story.md +12 -0
- package/skills/presentation/references/templates-and-editing.md +11 -0
- package/skills/presentation/references/visual-system.md +10 -0
- package/skills/super-pi-agent-development/SKILL.md +25 -0
- package/skills/super-pi-development/SKILL.md +31 -0
- package/skills/super-pi-tool-development/SKILL.md +39 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import type { AgentDefinition } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* One agent, as declared by a markdown file with YAML frontmatter.
|
|
4
|
+
*
|
|
5
|
+
* WHY SUPER PI OWNS THIS FORMAT. Pi has no agent concept at all: its only "agents files" are the
|
|
6
|
+
* AGENTS.md / CLAUDE.md context files that get folded into one prompt (resource-loader.ts:185), which
|
|
7
|
+
* is a single shared prompt rather than a set of selectable roles. Its RPC command union
|
|
8
|
+
* (rpc-types.ts:20-74) likewise has no agent, no prompt and no tools command. So the role, its
|
|
9
|
+
* permission set and its prompt have to be modelled here, and the three ways they are APPLIED are
|
|
10
|
+
* Pi's spawn-time CLI flags rather than RPC commands.
|
|
11
|
+
*
|
|
12
|
+
* The shape is borrowed from OpenCode's `.opencode/agent/*.md` (`mode`, `model`, `tools`, `color`,
|
|
13
|
+
* `hidden`, description frontmatter, prompt in the body) because that is the format the user asked to
|
|
14
|
+
* borrow, and because markdown + frontmatter is readable, diffable and reviewable in a repository -
|
|
15
|
+
* which a JSON blob of agent configs is not.
|
|
16
|
+
*/
|
|
17
|
+
/** Frontmatter we understand. Anything else in the block is preserved as raw text but not acted on. */
|
|
18
|
+
type Frontmatter = Record<string, unknown>;
|
|
19
|
+
/**
|
|
20
|
+
* Every tool name Super Pi can know STATICALLY, read out of Pi's own source rather than from memory.
|
|
21
|
+
* Each entry carries the place it came from, because this list is the whole safety net behind
|
|
22
|
+
* `validateToolNames` and it has to be re-checked whenever Pi is upgraded.
|
|
23
|
+
*
|
|
24
|
+
* It is deliberately NOT the 8 built-ins alone. Pi's registry also holds:
|
|
25
|
+
*
|
|
26
|
+
* - `codemode` and `tool_search`, registered by the two built-in extensions
|
|
27
|
+
* (extensions/codemode/tool.ts:50, extensions/tool-search/tool.ts:20). Pi's own CLI help offers
|
|
28
|
+
* `--tools read,bash,codemode,'mcp__radius__*'` as an example (cli/args.ts:409), so treating
|
|
29
|
+
* these as unknown would reject configuration Pi documents.
|
|
30
|
+
* - the three MCP resource tools (core/mcp-servers.ts:31-37).
|
|
31
|
+
* - MCP server tools, named `mcp__<server>__<tool>` (core/mcp-servers.ts:38-41). The server list
|
|
32
|
+
* is runtime state, so those are recognised by PREFIX instead of by name - see `isKnownPiToolName`.
|
|
33
|
+
*
|
|
34
|
+
* Anything else Pi can hold - a third-party extension tool, an SDK-supplied tool
|
|
35
|
+
* (agent-session.ts:3503-3509) - has an arbitrary name that no static list can contain. Those names
|
|
36
|
+
* are indistinguishable from typos by construction, which is the limit of this check; see
|
|
37
|
+
* `validateToolNames` for what is rejected on that account and why.
|
|
38
|
+
*/
|
|
39
|
+
export declare const PI_TOOL_NAMES: readonly ["read", "bash", "powershell", "edit", "write", "grep", "find", "ls", "codemode", "tool_search", "list_mcp_resources", "list_mcp_resource_templates", "read_mcp_resource"];
|
|
40
|
+
/** Tools shipped by this package. Authors must be able to explicitly deny host extras. */
|
|
41
|
+
export declare const SUPER_PI_TOOL_NAMES: readonly ["task", "todowrite", "workflow", "run_async", "worktree", "scheduled_task", "project", "question", "tool_register", "tool_shortcut", "tool_remove", "memory", "skill_manage", "session_search", "session_spawn", "session_status", "session_dispatch", "session_stop", "session_report", "session_stop_subtree", "session_remove", "session_reminder", "knowledge_search", "knowledge_import", "document_read", "document_write", "web_search", "web_fetch", "feishu_doc_read", "feishu_doc_write"];
|
|
42
|
+
/**
|
|
43
|
+
* Whether a name can be a real Pi tool. A name is real if it is one of `PI_TOOL_NAMES`, an MCP
|
|
44
|
+
* server tool, or a PATTERN.
|
|
45
|
+
*
|
|
46
|
+
* Patterns are a real feature, not an escape hatch: Pi turns every `--tools` entry into a matcher
|
|
47
|
+
* that treats a `*` entry as a glob (core/mcp-servers.ts:21-25), and `--tools` is exactly what an
|
|
48
|
+
* agent's `tools` map becomes. Rejecting `mcp__radius__*` would reject Pi's documented syntax.
|
|
49
|
+
*/
|
|
50
|
+
export declare function isKnownPiToolName(name: string): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Splits a definition file into frontmatter and body. The body is the system prompt, exactly as in
|
|
53
|
+
* OpenCode - a file with no frontmatter is not an agent definition, and is reported rather than
|
|
54
|
+
* silently treated as an empty-prompt agent.
|
|
55
|
+
*/
|
|
56
|
+
export declare function splitDefinition(source: string): {
|
|
57
|
+
frontmatter: Frontmatter;
|
|
58
|
+
body: string;
|
|
59
|
+
} | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* A deliberately small YAML reader: scalars, nested one-level maps, inline `[a, b]` lists and `- item`
|
|
62
|
+
* lists. That is the whole grammar OpenCode agent frontmatter uses (`tools:` is a map, `model:` and
|
|
63
|
+
* `color:` are scalars), and it keeps Super Pi free of a YAML dependency for four fields.
|
|
64
|
+
*
|
|
65
|
+
* Anything it cannot represent is DROPPED rather than guessed: a malformed agent file must fail its
|
|
66
|
+
* own parse and be reported, not load with a field the author thought they set.
|
|
67
|
+
*/
|
|
68
|
+
export declare function parseYaml(text: string): Frontmatter;
|
|
69
|
+
/**
|
|
70
|
+
* Constraints applied on top of an agent's own `tools:` map when it is turned into Pi's flags.
|
|
71
|
+
*
|
|
72
|
+
* Both exist because a definition is not the last word on what a process may do. `extraAllowedTools`
|
|
73
|
+
* is how a HOST capability - a tool that exists only because Super Pi mounted an extension - is added to
|
|
74
|
+
* an agent whose map never mentions it. `denyTools` is how a parent's denies reach a child.
|
|
75
|
+
*/
|
|
76
|
+
export type ToolFlagOptions = {
|
|
77
|
+
/**
|
|
78
|
+
* Tools to add to an allowlist the map already established.
|
|
79
|
+
*
|
|
80
|
+
* This is the whole reason `task` reaches a strict agent. Pi filters its tool registry through
|
|
81
|
+
* `--tools` (agent-session.ts:3567) and only activates a named tool if the allowlist allows it
|
|
82
|
+
* (agent-session.ts:3569-3574), so a primary agent declaring `tools: {"*": false, read: true}` would
|
|
83
|
+
* otherwise get a `task` tool that is registered, loaded and never declared to the model - silently
|
|
84
|
+
* broken, and broken in a way no error message would ever explain.
|
|
85
|
+
*
|
|
86
|
+
* An EXPLICIT `false` in the map still wins. `tools: {"*": false, task: false}` is an author saying
|
|
87
|
+
* "this agent does not delegate", and an extra capability must not overrule it.
|
|
88
|
+
*/
|
|
89
|
+
extraAllowedTools?: readonly string[];
|
|
90
|
+
/**
|
|
91
|
+
* Tools removed before translation: dropped from an allowlist, or turned into an `--exclude-tools`
|
|
92
|
+
* entry when the map established none. Applied AFTER `extraAllowedTools`, so an inherited deny also
|
|
93
|
+
* wins over a host capability.
|
|
94
|
+
*/
|
|
95
|
+
denyTools?: readonly string[];
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* The Pi CLI flags an agent's `tools` map becomes. Returned flat so the caller can push them into the
|
|
99
|
+
* spawn argv in order, and so a test can assert on the exact list.
|
|
100
|
+
*
|
|
101
|
+
* THE TRANSLATION, from OpenCode's semantics (`tools` is a map whose `"*"` entry sets the default for
|
|
102
|
+
* every tool, and other keys override it) to Pi's three flags:
|
|
103
|
+
*
|
|
104
|
+
* tools: { "*": false, read: true } -> ["--tools", "read"] allowlist, everything else denied
|
|
105
|
+
* tools: { "*": false } -> ["--no-tools"] nothing at all
|
|
106
|
+
* tools: { bash: false } -> ["--exclude-tools","bash"] deny one, keep Pi's defaults
|
|
107
|
+
* tools: { "*": true, bash: false } -> ["--exclude-tools","bash"] same, stated explicitly
|
|
108
|
+
* no `tools` key -> [] Pi's own default tool set
|
|
109
|
+
*
|
|
110
|
+
* The allowlist form is a real permission boundary, not a courtesy: Pi filters the tool REGISTRY
|
|
111
|
+
* through the same allowlist (agent-session.ts:3536-3545), so a tool that is not on the list is never
|
|
112
|
+
* registered, never declared to the model, and therefore cannot be called - the model does not even
|
|
113
|
+
* see a schema for it. Naming a tool on the allowlist also activates it (agent-session.ts:3569-3574).
|
|
114
|
+
*/
|
|
115
|
+
export declare function toolFlags(tools: Frontmatter | undefined, options?: ToolFlagOptions): string[];
|
|
116
|
+
/**
|
|
117
|
+
* Whether the map denies everything, which is `{"*": false}` with nothing switched back on. Split out
|
|
118
|
+
* of `toolFlags` because the picker needs to say "no tools" rather than render an empty allowlist.
|
|
119
|
+
*/
|
|
120
|
+
export declare function deniesAllTools(tools: Frontmatter | undefined): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* The same translation `toolFlags` performs, expressed as the SDK's two lists rather than as argv.
|
|
123
|
+
*
|
|
124
|
+
* WHY A SECOND TRANSLATION AND NOT A PARSER. The argv form is `--tools a,b,c` or `--exclude-tools x,y`
|
|
125
|
+
* or `--no-tools`, and parsing it back would be reading a serialization of a decision to recover the
|
|
126
|
+
* decision. Worse, `--no-tools` has no SDK equivalent that means the same thing: Pi's `noTools: "all"`
|
|
127
|
+
* disables the built-ins while leaving extension tools on, which is NOT what an agent that declared
|
|
128
|
+
* `{"*": false}` asked for - that agent asked for NO tools at all, and an extension tool left enabled
|
|
129
|
+
* would be a tool the author explicitly refused.
|
|
130
|
+
*
|
|
131
|
+
* So the DECISION is made once, here, in the same terms `toolFlags` uses, and each consumer takes the
|
|
132
|
+
* form it needs. The two must agree, and `scripts/agent-config-regression.test.mjs` asserts that they
|
|
133
|
+
* do for every shape of `tools:` map.
|
|
134
|
+
*/
|
|
135
|
+
export declare function toolSelection(tools: Frontmatter | undefined, options?: ToolFlagOptions): {
|
|
136
|
+
tools?: string[];
|
|
137
|
+
excludeTools?: string[];
|
|
138
|
+
};
|
|
139
|
+
/** The tools an allowlist names, for display. Empty when the agent adds no allowlist of its own. */
|
|
140
|
+
export declare function allowedToolNames(tools: Frontmatter | undefined): string[];
|
|
141
|
+
/** `provider/modelId`, split into the two halves Pi's `set_model` and `--provider/--model` both need. */
|
|
142
|
+
export declare function parseAgentModel(model: unknown): {
|
|
143
|
+
provider: string;
|
|
144
|
+
modelId: string;
|
|
145
|
+
} | undefined;
|
|
146
|
+
/** One agent definition file that did not parse, kept so the picker can say WHY it is missing. */
|
|
147
|
+
export type AgentProblem = {
|
|
148
|
+
file: string;
|
|
149
|
+
message: string;
|
|
150
|
+
};
|
|
151
|
+
export type AgentScan = {
|
|
152
|
+
agents: AgentDefinition[];
|
|
153
|
+
problems: AgentProblem[];
|
|
154
|
+
};
|
|
155
|
+
/** Which half of one directory of definitions a caller wants. Defaults to the human-facing half. */
|
|
156
|
+
export type AgentModeFilter = "primary" | "subagent";
|
|
157
|
+
/**
|
|
158
|
+
* Reads every `*.md` in `directory` as an agent definition. The file's base name is the agent id,
|
|
159
|
+
* matching OpenCode, so `agents/triage.md` is the agent `triage` and renaming the file renames it.
|
|
160
|
+
*
|
|
161
|
+
* A file that fails to parse is COLLECTED as a problem instead of throwing: one typo in one agent must
|
|
162
|
+
* not take down the picker and hide every other agent with it.
|
|
163
|
+
*
|
|
164
|
+
* `mode` picks WHICH half of one directory of definitions comes back, and defaults to `primary`. Both
|
|
165
|
+
* halves live in the same `agents/*.md` files - a sub-agent is the same format with `mode: subagent` -
|
|
166
|
+
* so the split is a filter on the parsed field, never a second directory or a second parser. A caller
|
|
167
|
+
* with no argument gets exactly what it always got.
|
|
168
|
+
*/
|
|
169
|
+
/**
|
|
170
|
+
* Expands a leading tilde (`~` or `~/...` or `~\...`) to the user's home directory.
|
|
171
|
+
*/
|
|
172
|
+
export declare function expandTilde(filepath: string): string;
|
|
173
|
+
export interface ResolveAgentDirectoriesOptions {
|
|
174
|
+
customDirs?: readonly string[];
|
|
175
|
+
env?: NodeJS.ProcessEnv;
|
|
176
|
+
rootDir?: string;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* The agents directory that ships WITH the package: the definitions Super Pi itself carries.
|
|
180
|
+
*
|
|
181
|
+
* WHY IT IS A FUNCTION AND NOT A CONSTANT. The package root is not the same directory in every
|
|
182
|
+
* layout - it is the repository root in a checkout and the installed package root in an npm install
|
|
183
|
+
* - so the path is derived from the same `rootDir` the discovery uses, and both sides of the
|
|
184
|
+
* "is this built-in?" question ask THIS function. If the two ever disagreed, a user agent could be
|
|
185
|
+
* filed as built-in and a built-in one as the user's, and the picker would sort them wrongly.
|
|
186
|
+
*/
|
|
187
|
+
export declare function builtinAgentsDir(rootDir?: string): string;
|
|
188
|
+
/**
|
|
189
|
+
* Resolves the ordered list of directories to discover agents from:
|
|
190
|
+
* 1. Custom directories configured by the user in app settings (or options)
|
|
191
|
+
* 2. SUPER_PI_AGENTS_DIR environment variable if set
|
|
192
|
+
* 3. User global agent directories (~/.super_pi/agents, ~/.super-pi/agents, ~/.pi/agents)
|
|
193
|
+
* 4. Built-in repository/package agents directory (<rootDir>/agents)
|
|
194
|
+
*
|
|
195
|
+
* Duplicate paths are preserved in order of first appearance.
|
|
196
|
+
*/
|
|
197
|
+
export declare function resolveAgentDirectories(options?: ResolveAgentDirectoriesOptions): string[];
|
|
198
|
+
export declare function readAgents(directory: string | readonly string[], options?: {
|
|
199
|
+
mode?: AgentModeFilter;
|
|
200
|
+
builtinDir?: string;
|
|
201
|
+
}): Promise<AgentScan>;
|
|
202
|
+
/**
|
|
203
|
+
* WHAT KIND OF AGENT IS THIS ID?
|
|
204
|
+
*
|
|
205
|
+
* The catalogue is read in halves - the primaries and the subagents - and a question about ONE id
|
|
206
|
+
* has to be asked of both halves. The answer is the `mode:` frontmatter of the definition that
|
|
207
|
+
* WINS, which is the same override rule `readAgents` already applies: the first directory to offer
|
|
208
|
+
* an id owns it.
|
|
209
|
+
*
|
|
210
|
+
* `undefined` MEANS "NO SUCH AGENT IN THESE DIRECTORIES", and that is NOT the same as "not
|
|
211
|
+
* primary". An id nobody has heard of is a CUSTOM agent, and custom agents are legal - §3 keeps
|
|
212
|
+
* them legal on purpose, so that a project can name an agent the catalogue does not carry yet.
|
|
213
|
+
* Only an agent that EXISTS and is a subagent is a subagent.
|
|
214
|
+
*
|
|
215
|
+
* THE HIDDEN ONES COUNT. `hidden` decides whether a person is SHOWN an agent in a picker, not
|
|
216
|
+
* whether the agent exists, so a hidden subagent is still a subagent here. A guard that could be
|
|
217
|
+
* walked around by ticking one box in a frontmatter would not be a guard.
|
|
218
|
+
*/
|
|
219
|
+
export declare function agentModeOf(directories: string | readonly string[], agentId: string): Promise<"primary" | "subagent" | undefined>;
|
|
220
|
+
/** Parses one definition file, or returns the reason it is not a usable agent. */
|
|
221
|
+
export declare function parseDefinition(file: string, source: string): AgentDefinition | AgentProblem;
|
|
222
|
+
/**
|
|
223
|
+
* Writes an agent's prompt body to `path` and returns that path, so it can be handed to Pi as
|
|
224
|
+
* `--append-system-prompt <file>` / `--system-prompt <file>`.
|
|
225
|
+
*
|
|
226
|
+
* A FILE, never the prompt text on the command line, and that is not a style choice. Pi resolves an
|
|
227
|
+
* existing path to its contents and anything else to literal text (resource-loader.ts:167-182), and
|
|
228
|
+
* Super Pi spawns Pi through `shell: true` on Windows because Pi is installed as a .cmd shim - so
|
|
229
|
+
* prompt text on argv would travel through cmd.exe, where a quote or an ampersand in an agent's
|
|
230
|
+
* instructions is a metacharacter. Writing the file also means the exact text Pi was given is a
|
|
231
|
+
* file on disk that can be read back as evidence.
|
|
232
|
+
*/
|
|
233
|
+
export declare function writeAgentPrompt(promptDir: string, agent: AgentDefinition): Promise<string>;
|
|
234
|
+
/**
|
|
235
|
+
* The spawn argv an agent adds, in the order Pi must receive it. Exported so the translation can be
|
|
236
|
+
* asserted without spawning anything, and so a probe can report exactly what was asked for.
|
|
237
|
+
*
|
|
238
|
+
* `options` are the caller's constraints on top of the definition's own `tools:` map - the two that
|
|
239
|
+
* exist are described on `ToolFlagOptions`. They are applied here rather than baked into
|
|
240
|
+
* `AgentDefinition.toolFlags` because they belong to the CALL: `PiRpcRuntime` adds `task` to the primary
|
|
241
|
+
* agent it is about to spawn, and the supervisor strips the parent's denies from the child it is about
|
|
242
|
+
* to spawn, and neither fact is a property of the definition file on disk.
|
|
243
|
+
*/
|
|
244
|
+
export declare function agentSpawnArgs(promptDir: string, agent: AgentDefinition | undefined, options?: ToolFlagOptions): Promise<string[]>;
|
|
245
|
+
export {};
|