@tencent-ai/agent-sdk 0.3.252 → 0.3.253
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/cli/CHANGELOG.md +22 -0
- package/cli/dist/codebuddy-headless.js +73 -58
- package/cli/dist/codebuddy-lite-wb.mjs +96 -81
- package/cli/dist/lazy/{427.68132a34.js → 427.74b982af.js} +4 -4
- package/cli/dist/lazy-headless/{834.391fb41e.js → 834.3b674e07.js} +9 -9
- package/cli/dist-server/3556.codebuddy.js +1 -1
- package/cli/dist-server/6037.codebuddy.js +1 -1
- package/cli/dist-server/6784.codebuddy.js +1 -1
- package/cli/dist-server/codebuddy.js +45 -30
- package/cli/dist-server/types/node/agent/openai-agents-types.d.ts +5 -5
- package/cli/dist-server/types/node/mcp/mcp-sdk-values.d.ts +1 -1
- package/cli/dist-server/types/node/model/model-provider.d.ts +3 -1
- package/cli/dist-server/types/node/tools/a2a-get-task-tool.d.ts +139 -34
- package/cli/dist-server/types/node/tools/a2a-poll-retry.d.ts +46 -0
- package/cli/package.json +1 -1
- package/cli/product.cloudhosted.json +2 -2
- package/cli/product.internal.json +2 -2
- package/cli/product.ioa.json +2 -2
- package/cli/product.json +4 -4
- package/cli/product.selfhosted.json +2 -2
- package/package.json +1 -1
- package/cli/dist-server/types/node/acp/acp-view-rewind-to.d.ts +0 -34
- package/cli/dist-server/types/node/acp/acp-web-ui-client.d.ts +0 -22
- package/cli/dist-server/types/node/acp/usage-by-category-calculator.d.ts +0 -45
- package/cli/dist-server/types/node/acp/usage-by-category-char-weight.d.ts +0 -9
- package/cli/dist-server/types/node/acp/usage-by-category-distribute.d.ts +0 -6
- package/cli/dist-server/types/node/acp/usage-by-category-tools-split.d.ts +0 -11
- package/cli/dist-server/types/node/agent-home/agent-home-envelope-body.d.ts +0 -54
- package/cli/dist-server/types/node/agent-home/agent-home-inbox-events.d.ts +0 -14
- package/cli/dist-server/types/node/agent-home/agent-home-room-contacts.d.ts +0 -30
- package/cli/dist-server/types/node/agent-team/permission-bridge-client.d.ts +0 -32
- package/cli/dist-server/types/node/agent-team/permission-bridge-protocol.d.ts +0 -47
- package/cli/dist-server/types/node/agent-view/handoff-policy.d.ts +0 -80
- package/cli/dist-server/types/node/agent-view/job-respawn-prefs.d.ts +0 -12
- package/cli/dist-server/types/node/agent-view/session-handoff.d.ts +0 -161
- package/cli/dist-server/types/node/ask/index.d.ts +0 -3
- package/cli/dist-server/types/node/bash-sandbox/bash-sandbox-manager.d.ts +0 -125
- package/cli/dist-server/types/node/bash-sandbox/legacy-sandbox-shell-service.d.ts +0 -33
- package/cli/dist-server/types/node/bash-sandbox/managed-security-policy.d.ts +0 -6
- package/cli/dist-server/types/node/bash-sandbox/workbuddy-directory-protection.d.ts +0 -12
- package/cli/dist-server/types/node/checkpoint/checkpoint-service.d.ts +0 -70
- package/cli/dist-server/types/node/checkpoint/file-changes-controller.d.ts +0 -29
- package/cli/dist-server/types/node/checkpoint/file-track-service.d.ts +0 -11
- package/cli/dist-server/types/node/checkpoint/file-version-manager.d.ts +0 -10
- package/cli/dist-server/types/node/checkpoint/file-version-store.d.ts +0 -9
- package/cli/dist-server/types/node/checkpoint/file-version-update-strategies.d.ts +0 -62
- package/cli/dist-server/types/node/command/add-dir-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/agents-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/auto-compact-command-executor.d.ts +0 -20
- package/cli/dist-server/types/node/command/background-command-executor.d.ts +0 -29
- package/cli/dist-server/types/node/command/btw-command-executor.d.ts +0 -19
- package/cli/dist-server/types/node/command/clear-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/config-command-executor.d.ts +0 -15
- package/cli/dist-server/types/node/command/context-command-executor.d.ts +0 -42
- package/cli/dist-server/types/node/command/copy-command-executor.d.ts +0 -10
- package/cli/dist-server/types/node/command/cost-command-executor.d.ts +0 -13
- package/cli/dist-server/types/node/command/debug-command-executor.d.ts +0 -15
- package/cli/dist-server/types/node/command/deep-research-command-executor.d.ts +0 -25
- package/cli/dist-server/types/node/command/doctor-command-executor.d.ts +0 -7
- package/cli/dist-server/types/node/command/effort-command-executor.d.ts +0 -46
- package/cli/dist-server/types/node/command/exit-command-executor.d.ts +0 -14
- package/cli/dist-server/types/node/command/export-command-executor.d.ts +0 -7
- package/cli/dist-server/types/node/command/feedback-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/fork-bg-command-executor.d.ts +0 -30
- package/cli/dist-server/types/node/command/fork-command-executor.d.ts +0 -28
- package/cli/dist-server/types/node/command/goal-command-executor.d.ts +0 -50
- package/cli/dist-server/types/node/command/handoff-message-adapter.d.ts +0 -9
- package/cli/dist-server/types/node/command/help-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/hooks-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/ide-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/mcp-command-executor.d.ts +0 -15
- package/cli/dist-server/types/node/command/memory-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/mode-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/model-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/model-image-to-image-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/model-image-to-video-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/model-lite-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/model-reasoning-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/model-text-to-image-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/model-text-to-video-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/multitask-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/permissions-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/plan-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/plugin-command-executor.d.ts +0 -25
- package/cli/dist-server/types/node/command/plugin-validate-command-executor.d.ts +0 -21
- package/cli/dist-server/types/node/command/release-notes-command-executor.d.ts +0 -18
- package/cli/dist-server/types/node/command/reload-plugins-command-executor.d.ts +0 -24
- package/cli/dist-server/types/node/command/remote-control-command-executor.d.ts +0 -44
- package/cli/dist-server/types/node/command/rename-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/reset-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/resume-command-executor.d.ts +0 -21
- package/cli/dist-server/types/node/command/rewind-command-executor.d.ts +0 -10
- package/cli/dist-server/types/node/command/sandbox-command-executor.d.ts +0 -20
- package/cli/dist-server/types/node/command/save-workflow-command-executor.d.ts +0 -43
- package/cli/dist-server/types/node/command/session-reset-notifier.d.ts +0 -23
- package/cli/dist-server/types/node/command/skills-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/stats-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/status-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/tasks-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/terminal-setup-command-executor.d.ts +0 -7
- package/cli/dist-server/types/node/command/theme-command-executor.d.ts +0 -7
- package/cli/dist-server/types/node/command/todos-command-executor.d.ts +0 -16
- package/cli/dist-server/types/node/command/upgrade-command-executor.d.ts +0 -13
- package/cli/dist-server/types/node/command/vim-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/workflows-command-executor.d.ts +0 -26
- package/cli/dist-server/types/node/feedback/feedback-protocol.d.ts +0 -32
- package/cli/dist-server/types/node/feedback/feedback-service.d.ts +0 -19
- package/cli/dist-server/types/node/feedback/index.d.ts +0 -2
- package/cli/dist-server/types/node/goal/goal-policy.d.ts +0 -55
- package/cli/dist-server/types/node/goal/goal-protocol.d.ts +0 -178
- package/cli/dist-server/types/node/goal/goal-service.d.ts +0 -201
- package/cli/dist-server/types/node/goal/goal-session-start-hook.d.ts +0 -24
- package/cli/dist-server/types/node/hooks/parse-frontmatter-hooks.d.ts +0 -42
- package/cli/dist-server/types/node/install/index.d.ts +0 -6
- package/cli/dist-server/types/node/install/install-controller.d.ts +0 -15
- package/cli/dist-server/types/node/install/install-env.d.ts +0 -12
- package/cli/dist-server/types/node/install/install-errors.d.ts +0 -46
- package/cli/dist-server/types/node/install/install-protocol.d.ts +0 -83
- package/cli/dist-server/types/node/install/install-service.d.ts +0 -36
- package/cli/dist-server/types/node/install/install-utils.d.ts +0 -7
- package/cli/dist-server/types/node/install/releases-service.d.ts +0 -18
- package/cli/dist-server/types/node/install/shell-setup.d.ts +0 -36
- package/cli/dist-server/types/node/mcp/mcp-cancellation.d.ts +0 -65
- package/cli/dist-server/types/node/mcp/mcp-controller.d.ts +0 -56
- package/cli/dist-server/types/node/mcp/mcp-model-id-header-helper.d.ts +0 -12
- package/cli/dist-server/types/node/mcp/mcp-oauth-callback-html.d.ts +0 -6
- package/cli/dist-server/types/node/mcp/mcp-oauth-controller.d.ts +0 -26
- package/cli/dist-server/types/node/mcp/mcp-output-storage.d.ts +0 -57
- package/cli/dist-server/types/node/mcp/mcp-server-override-impl.d.ts +0 -136
- package/cli/dist-server/types/node/mcp/mcp-server-override.d.ts +0 -29
- package/cli/dist-server/types/node/mcp/mcp-tool-result-sideband.d.ts +0 -26
- package/cli/dist-server/types/node/mcp/mcp-validate-middleware.d.ts +0 -25
- package/cli/dist-server/types/node/mcp/models/mcp-server.d.ts +0 -18
- package/cli/dist-server/types/node/mcp/node-websocket-transport.d.ts +0 -38
- package/cli/dist-server/types/node/mcp/official-mcp-egress-policy.d.ts +0 -17
- package/cli/dist-server/types/node/mcp/sdk-mcp-server.d.ts +0 -143
- package/cli/dist-server/types/node/mcp/sdk-mcp-transport.d.ts +0 -97
- package/cli/dist-server/types/node/message-queue/followup-queue.d.ts +0 -35
- package/cli/dist-server/types/node/message-queue/index.d.ts +0 -11
- package/cli/dist-server/types/node/plugins/concurrency.d.ts +0 -1
- package/cli/dist-server/types/node/plugins/dependency-resolver.d.ts +0 -43
- package/cli/dist-server/types/node/plugins/directory-plugin-cache-projection.d.ts +0 -2
- package/cli/dist-server/types/node/plugins/guards/index.d.ts +0 -2
- package/cli/dist-server/types/node/plugins/guards/weixinpay-integrity-guard.d.ts +0 -15
- package/cli/dist-server/types/node/plugins/installers/git-plugin-installer.d.ts +0 -42
- package/cli/dist-server/types/node/plugins/installers/git-subdir-plugin-installer.d.ts +0 -19
- package/cli/dist-server/types/node/plugins/installers/index.d.ts +0 -4
- package/cli/dist-server/types/node/plugins/installers/local-plugin-installer.d.ts +0 -40
- package/cli/dist-server/types/node/plugins/installers/npm-plugin-installer.d.ts +0 -23
- package/cli/dist-server/types/node/plugins/loaders/agent-loader.d.ts +0 -43
- package/cli/dist-server/types/node/plugins/loaders/command-loader.d.ts +0 -37
- package/cli/dist-server/types/node/plugins/loaders/hook-loader.d.ts +0 -55
- package/cli/dist-server/types/node/plugins/loaders/index.d.ts +0 -8
- package/cli/dist-server/types/node/plugins/loaders/lsp-loader.d.ts +0 -47
- package/cli/dist-server/types/node/plugins/loaders/mcp-loader.d.ts +0 -75
- package/cli/dist-server/types/node/plugins/loaders/output-style-loader.d.ts +0 -49
- package/cli/dist-server/types/node/plugins/loaders/plugin-loader-manager.d.ts +0 -49
- package/cli/dist-server/types/node/plugins/loaders/skill-loader.d.ts +0 -45
- package/cli/dist-server/types/node/plugins/marketplace-name-validator.d.ts +0 -50
- package/cli/dist-server/types/node/plugins/marketplace-path-safety.d.ts +0 -86
- package/cli/dist-server/types/node/plugins/marketplaces/base-marketplace.d.ts +0 -43
- package/cli/dist-server/types/node/plugins/marketplaces/builtin-marketplace-provider.d.ts +0 -22
- package/cli/dist-server/types/node/plugins/marketplaces/directory-marketplace.d.ts +0 -19
- package/cli/dist-server/types/node/plugins/marketplaces/git-availability-detector.d.ts +0 -62
- package/cli/dist-server/types/node/plugins/marketplaces/git-fallback-coordinator.d.ts +0 -42
- package/cli/dist-server/types/node/plugins/marketplaces/git-to-zip-url-converter.d.ts +0 -50
- package/cli/dist-server/types/node/plugins/marketplaces/github-marketplace.d.ts +0 -41
- package/cli/dist-server/types/node/plugins/marketplaces/http-marketplace.d.ts +0 -47
- package/cli/dist-server/types/node/plugins/marketplaces/index.d.ts +0 -13
- package/cli/dist-server/types/node/plugins/marketplaces/marketplace-config-manager.d.ts +0 -39
- package/cli/dist-server/types/node/plugins/marketplaces/marketplace-factory.d.ts +0 -11
- package/cli/dist-server/types/node/plugins/marketplaces/marketplace-storage.d.ts +0 -141
- package/cli/dist-server/types/node/plugins/marketplaces/marketplace-update-checker.d.ts +0 -38
- package/cli/dist-server/types/node/plugins/marketplaces/workspace-project-root.d.ts +0 -14
- package/cli/dist-server/types/node/plugins/marketplaces/zip-marketplace.d.ts +0 -134
- package/cli/dist-server/types/node/plugins/mcpb-handler.d.ts +0 -29
- package/cli/dist-server/types/node/plugins/plugin-controller.d.ts +0 -75
- package/cli/dist-server/types/node/plugins/plugin-error-collector.d.ts +0 -17
- package/cli/dist-server/types/node/plugins/plugin-install-stats-service.d.ts +0 -20
- package/cli/dist-server/types/node/plugins/plugin-manager.d.ts +0 -692
- package/cli/dist-server/types/node/plugins/plugin-policy-service.d.ts +0 -53
- package/cli/dist-server/types/node/plugins/plugin-validator.d.ts +0 -48
- package/cli/dist-server/types/node/plugins/zip-utils.d.ts +0 -93
- package/cli/dist-server/types/node/remote-control/clients/liveness-watchdog.d.ts +0 -56
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-activity.d.ts +0 -23
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-auth.d.ts +0 -64
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-client-factory.d.ts +0 -47
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-client.d.ts +0 -191
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-inbound.d.ts +0 -7
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-interaction.d.ts +0 -142
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-live.d.ts +0 -78
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-media.d.ts +0 -35
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-qr-bind.d.ts +0 -49
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-respond-queue.d.ts +0 -33
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-types.d.ts +0 -207
- package/cli/dist-server/types/node/remote-control/remote-control-protocol.d.ts +0 -288
- package/cli/dist-server/types/node/remote-gateway/gateway-protocol.d.ts +0 -502
- package/cli/dist-server/types/node/remote-gateway/utils/qrcode-utils.d.ts +0 -16
- package/cli/dist-server/types/node/session/session-preview-utils.d.ts +0 -30
- package/cli/dist-server/types/node/settings/model-setting-utils.d.ts +0 -2
- package/cli/dist-server/types/node/tool-control/tool-control-policy.d.ts +0 -35
- package/cli/dist-server/types/node/tools/auto-mode/auto-mode-critique-client.d.ts +0 -51
- package/cli/dist-server/types/node/tools/auto-mode/auto-mode-strategy.d.ts +0 -19
- package/cli/dist-server/types/node/utils/add-dir-utils.d.ts +0 -20
- package/cli/dist-server/types/node/utils/compress-path.source.d.ts +0 -59
- package/cli/dist-server/types/node/vim/index.d.ts +0 -2
- package/cli/dist-server/types/node/vim/vim-manager.d.ts +0 -12
- package/cli/dist-server/types/node/vim/vim-protocol.d.ts +0 -24
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* teammate-message 正文:不要把用户字直接嵌进 XML。
|
|
3
|
-
* 新包一行 JSON;旧包仍当纯文本。闭标签用 lastIndexOf,避免正文里的
|
|
4
|
-
* `</teammate-message>` 截断。
|
|
5
|
-
*/
|
|
6
|
-
/** 频道群对话信封。不是私信房 / MessageColleague。 */
|
|
7
|
-
export declare function isAgentHomeChannelEnvelope(text: string): boolean;
|
|
8
|
-
export declare function isAgentHomeColleagueEnvelope(text: string): boolean;
|
|
9
|
-
/** 看起来像 Agent Home 信封(频道或同事),解析失败时禁止当用户 1:1。 */
|
|
10
|
-
export declare function looksLikeAgentHomeEnvelope(text: string): boolean;
|
|
11
|
-
/**
|
|
12
|
-
* UI 投影:主路径信封 + 旧叫醒正文 + SpeakInChannel 入站回执。
|
|
13
|
-
* 模型收件箱只认 isAgentHomeChannelEnvelope,避免旧正文把 1:1 吃掉。
|
|
14
|
-
*/
|
|
15
|
-
export declare function isChannelEnvelopeText(text: string): boolean;
|
|
16
|
-
export declare function teammateMessageInner(text: string): string | undefined;
|
|
17
|
-
export declare function encodeEnvelopeTextPayload(payload: {
|
|
18
|
-
text: string;
|
|
19
|
-
roster?: string;
|
|
20
|
-
mentions?: string;
|
|
21
|
-
summary?: string;
|
|
22
|
-
}): string;
|
|
23
|
-
export declare function decodeEnvelopeTextPayload(inner: string): {
|
|
24
|
-
text: string;
|
|
25
|
-
roster?: string;
|
|
26
|
-
mentions?: string;
|
|
27
|
-
summary?: string;
|
|
28
|
-
} | undefined;
|
|
29
|
-
/** XML 属性 + 正文。频道/同事/Teams 共用;要不要当 Agent Home 来信由调用方过滤。 */
|
|
30
|
-
export interface ParsedTeammateMessageXml {
|
|
31
|
-
id: string;
|
|
32
|
-
name?: string;
|
|
33
|
-
messageId?: string;
|
|
34
|
-
summary?: string;
|
|
35
|
-
content: string;
|
|
36
|
-
}
|
|
37
|
-
export declare function parseTeammateMessageXml(text: string): ParsedTeammateMessageXml | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* 入站回执:头字段 + 正文 + 稳定分隔符 + 给人看的 how-to。
|
|
40
|
-
* 机器只认分隔符,不要拿 how-to 文案当解析边界。
|
|
41
|
-
* 回执必须是纯文本:`{ content }` JSON 会被 History 的 ToolResult 剥成用户原话。
|
|
42
|
-
*/
|
|
43
|
-
export declare const INCOMING_RECEIPT_SENTINEL = "-- agent-home --";
|
|
44
|
-
export declare function formatIncomingReceipt(input: {
|
|
45
|
-
preamble: readonly string[];
|
|
46
|
-
headers: Record<string, string>;
|
|
47
|
-
saidLabel: string;
|
|
48
|
-
body: string;
|
|
49
|
-
howTo: string;
|
|
50
|
-
}): string;
|
|
51
|
-
export declare function parseIncomingReceipt(text: string): {
|
|
52
|
-
headers: Record<string, string>;
|
|
53
|
-
body: string;
|
|
54
|
-
} | undefined;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 默认 Agent 收件箱:信落盘后立刻叫醒 --serve,不扫盘。
|
|
3
|
-
* 同进程走 listener;同事 job 在别的进程,再碰一下 inbox.kick 让 fs.watch 响。
|
|
4
|
-
*/
|
|
5
|
-
type InboxListener = () => void;
|
|
6
|
-
export declare function agentHomeInboxKickPath(homeDir: string): string;
|
|
7
|
-
export declare function notifyAgentHomeInboxArrived(): void;
|
|
8
|
-
export declare function onAgentHomeInboxArrived(listener: InboxListener): () => void;
|
|
9
|
-
/** 同进程立刻喊;跨进程改 kick 文件,宿主 fs.watch 接到就 drain。 */
|
|
10
|
-
export declare function signalAgentHomeInboxArrived(homeDir: string): Promise<void>;
|
|
11
|
-
export declare function watchAgentHomeInboxKick(homeDir: string, onEvent: () => void): {
|
|
12
|
-
dispose(): void;
|
|
13
|
-
};
|
|
14
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 房间联系人解析。无 fs;吃 directory 形状。
|
|
3
|
-
*/
|
|
4
|
-
import type { AgentHomeDirectoryFile, AgentHomeProfile } from './agent-home-directory';
|
|
5
|
-
export interface RoomContact {
|
|
6
|
-
id: string;
|
|
7
|
-
name: string;
|
|
8
|
-
/** 投递目标:对方的主对话。没有=还没开口,联系不上 */
|
|
9
|
-
jobId?: string;
|
|
10
|
-
}
|
|
11
|
-
export interface RoomContactScope {
|
|
12
|
-
groupId: string;
|
|
13
|
-
groupName: string;
|
|
14
|
-
contacts: RoomContact[];
|
|
15
|
-
}
|
|
16
|
-
export type RoomContactLookup = {
|
|
17
|
-
status: 'found';
|
|
18
|
-
contact: RoomContact;
|
|
19
|
-
} | {
|
|
20
|
-
status: 'missing';
|
|
21
|
-
} | {
|
|
22
|
-
status: 'ambiguous';
|
|
23
|
-
contacts: RoomContact[];
|
|
24
|
-
};
|
|
25
|
-
export declare function resolveMeAsAgent(directory: AgentHomeDirectoryFile, myJobId: string | undefined): AgentHomeProfile | undefined;
|
|
26
|
-
/** 只看我所在的可见房间。没有 job id = 默认 Agent,联系人永远为空。 */
|
|
27
|
-
export declare function resolveRoomContacts(directory: AgentHomeDirectoryFile | undefined, myJobId: string | undefined): RoomContactScope[];
|
|
28
|
-
export declare function flattenRoomContacts(scopes: readonly RoomContactScope[]): RoomContact[];
|
|
29
|
-
/** 先精确匹配 id,只有全房间唯一的显示名才映射到那个人。 */
|
|
30
|
-
export declare function lookupRoomContact(scopes: readonly RoomContactScope[], recipient: string): RoomContactLookup;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Permission Bridge Client — Teammate 子进程侧
|
|
3
|
-
*
|
|
4
|
-
* 独立进程 teammate 使用此客户端将工具审批请求发送到 leader 的 HTTP API,
|
|
5
|
-
* 等待 leader 侧用户审批后返回结果。
|
|
6
|
-
*
|
|
7
|
-
* 使用 HTTP long-poll 模式:POST 请求会阻塞直到 leader 返回审批结果。
|
|
8
|
-
*/
|
|
9
|
-
import type { PermissionDecision } from './permission-bridge-protocol';
|
|
10
|
-
export declare class PermissionBridgeClient {
|
|
11
|
-
private leaderEndpoint;
|
|
12
|
-
private teammateName;
|
|
13
|
-
private teamName;
|
|
14
|
-
constructor(leaderEndpoint: string, teammateName: string, teamName: string);
|
|
15
|
-
/**
|
|
16
|
-
* 请求权限审批。阻塞直到 leader 返回结果或超时。
|
|
17
|
-
*
|
|
18
|
-
* @param toolName 工具名称
|
|
19
|
-
* @param toolArguments 工具参数 JSON 字符串
|
|
20
|
-
* @param toolCallId 工具调用 ID
|
|
21
|
-
* @returns 审批决策
|
|
22
|
-
*/
|
|
23
|
-
requestPermission(toolName: string, toolArguments: string, toolCallId: string): Promise<{
|
|
24
|
-
decision: PermissionDecision;
|
|
25
|
-
reason?: string;
|
|
26
|
-
}>;
|
|
27
|
-
/**
|
|
28
|
-
* 检查 leader endpoint 是否可达
|
|
29
|
-
*/
|
|
30
|
-
isAvailable(): Promise<boolean>;
|
|
31
|
-
private post;
|
|
32
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Permission Bridge 协议定义
|
|
3
|
-
*
|
|
4
|
-
* 独立进程 teammate 的工具审批请求通过 HTTP API 路由回 leader 进程,
|
|
5
|
-
* 由 leader 的 InterruptionService 展示给用户审批。
|
|
6
|
-
*/
|
|
7
|
-
export declare const PermissionBridgeService: unique symbol;
|
|
8
|
-
export interface PermissionBridgeRequest {
|
|
9
|
-
/** 唯一请求 ID */
|
|
10
|
-
requestId: string;
|
|
11
|
-
/** Teammate 名称 */
|
|
12
|
-
teammateName: string;
|
|
13
|
-
/** Team 名称 */
|
|
14
|
-
teamName: string;
|
|
15
|
-
/** 工具名称 */
|
|
16
|
-
toolName: string;
|
|
17
|
-
/** 工具调用参数(序列化的 JSON 字符串) */
|
|
18
|
-
toolArguments: string;
|
|
19
|
-
/** 工具调用 ID(用于匹配 InterruptionService 中的 approval item) */
|
|
20
|
-
toolCallId: string;
|
|
21
|
-
/** 请求时间戳 */
|
|
22
|
-
timestamp: string;
|
|
23
|
-
}
|
|
24
|
-
export type PermissionDecision = 'allow' | 'allowAll' | 'deny' | 'rejectAndExitPlan';
|
|
25
|
-
export interface PermissionBridgeResponse {
|
|
26
|
-
/** 对应的请求 ID */
|
|
27
|
-
requestId: string;
|
|
28
|
-
/** 审批决策 */
|
|
29
|
-
decision: PermissionDecision;
|
|
30
|
-
/** 拒绝原因或用户反馈 */
|
|
31
|
-
reason?: string;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Leader 侧 Permission Bridge 服务。
|
|
35
|
-
* 接收 teammate 的权限请求,注入 InterruptionService,等待用户决策后返回。
|
|
36
|
-
*/
|
|
37
|
-
export interface IPermissionBridgeService {
|
|
38
|
-
/**
|
|
39
|
-
* 处理来自 teammate 的权限请求。
|
|
40
|
-
* 阻塞直到用户通过 InterruptionService 做出决策。
|
|
41
|
-
*
|
|
42
|
-
* @param request 权限请求
|
|
43
|
-
* @param signal 用于取消等待的 AbortSignal
|
|
44
|
-
* @returns 审批结果
|
|
45
|
-
*/
|
|
46
|
-
handleRequest(request: PermissionBridgeRequest, signal?: AbortSignal): Promise<PermissionBridgeResponse>;
|
|
47
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 会话转后台的策略判定 —— 纯函数,无 I/O。
|
|
3
|
-
*
|
|
4
|
-
* 对照 Claude Code v2.1.216 bundle:
|
|
5
|
-
* - `jA_` / `qA_`(策略)
|
|
6
|
-
* - `nTo` / `GA_`(betweenCalls)
|
|
7
|
-
* - `DXe` 拒绝文案
|
|
8
|
-
*/
|
|
9
|
-
/** 成功交接时选用的路径 */
|
|
10
|
-
export type HandoffVia = 'idle-fork' | 'defer-then-fork' | 'abort-then-fork' | 'detach';
|
|
11
|
-
/** 拒绝转后台的原因 */
|
|
12
|
-
export type HandoffRefusal = 'fleet-disabled' | 'remote' | 'persistence' | 'loading' | 'queued-commands' | 'ended-by-model';
|
|
13
|
-
export type HandoffDecision = {
|
|
14
|
-
ok: true;
|
|
15
|
-
via: HandoffVia;
|
|
16
|
-
} | {
|
|
17
|
-
ok: false;
|
|
18
|
-
reason: HandoffRefusal;
|
|
19
|
-
};
|
|
20
|
-
/** `resolveHandoffStrategy` 的输入快照 */
|
|
21
|
-
export interface HandoffStrategyState {
|
|
22
|
-
/** 当前已是后台会话(attach 中)→ 只 detach */
|
|
23
|
-
isBg: boolean;
|
|
24
|
-
/** agent view / fleet 是否开启 */
|
|
25
|
-
fleetEnabled: boolean;
|
|
26
|
-
/** 远端会话 */
|
|
27
|
-
isRemote: boolean;
|
|
28
|
-
/** 会话持久化关闭 */
|
|
29
|
-
persistenceDisabled: boolean;
|
|
30
|
-
/** 外部加载态(例如正在恢复)—— 不可转后台 */
|
|
31
|
-
isExternalLoading: boolean;
|
|
32
|
-
/** 当前轮次是否在跑(模型/工具活跃) */
|
|
33
|
-
isLoading: boolean;
|
|
34
|
-
/** 上一轮已收尾、只是在等工具(见 `isBetweenCalls`) */
|
|
35
|
-
betweenCalls: boolean;
|
|
36
|
-
}
|
|
37
|
-
/** 判定 betweenCalls 用的最小消息形状 */
|
|
38
|
-
export interface HandoffTranscriptMessage {
|
|
39
|
-
type: string;
|
|
40
|
-
message?: {
|
|
41
|
-
stop_reason?: string | null;
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
/** 等工具降级 / flush 超时常量(与 Claude `tengu_defer_cap_ms` / `TxS` / flush 超时对齐) */
|
|
45
|
-
export declare const DEFER_CAP_MS = 10000;
|
|
46
|
-
export declare const DEFER_PRESS_DEBOUNCE_MS = 1000;
|
|
47
|
-
export declare const FLUSH_TIMEOUT_MS = 2000;
|
|
48
|
-
/** 在跑工作条目(adopt 清单的元素,见 session-handoff 的 carryTasks) */
|
|
49
|
-
export interface InFlightTask {
|
|
50
|
-
kind: string;
|
|
51
|
-
id: string;
|
|
52
|
-
label: string;
|
|
53
|
-
/** 显式标记是否可搬走;未给时由消费侧按 kind 自行判定 */
|
|
54
|
-
canCarry?: boolean;
|
|
55
|
-
/** subagent:子会话 UUID,adopt 后可按 transcript 找回 */
|
|
56
|
-
sessionId?: string;
|
|
57
|
-
/** subagent:agent 类型 */
|
|
58
|
-
agentType?: string;
|
|
59
|
-
/** shell:stdout 落盘路径(file-fd 模式),worker 侧重挂输出用 */
|
|
60
|
-
outputFilePath?: string;
|
|
61
|
-
/** shell:stderr 落盘路径 */
|
|
62
|
-
outputStderrPath?: string;
|
|
63
|
-
}
|
|
64
|
-
export interface RefusalMessageContext {
|
|
65
|
-
/** `queued-commands` 时必填 */
|
|
66
|
-
queuedCommandCount?: number;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* 从会话状态选出转后台策略。
|
|
70
|
-
* 判定顺序与 Claude `jA_` 一致。
|
|
71
|
-
*/
|
|
72
|
-
export declare function resolveHandoffStrategy(state: HandoffStrategyState): HandoffDecision;
|
|
73
|
-
/**
|
|
74
|
-
* 「上一轮已收尾、现在只是在等工具」:
|
|
75
|
-
* 输入缓冲为空,且从末尾看,助手尚未处于 `stop_reason === null` 的未收尾态。
|
|
76
|
-
* (对照 Claude `nTo` / `GA_`)
|
|
77
|
-
*/
|
|
78
|
-
export declare function isBetweenCalls(messages: readonly HandoffTranscriptMessage[], hasPartialInput: boolean): boolean;
|
|
79
|
-
/** 每个拒绝原因产出一条用户可见文案 */
|
|
80
|
-
export declare function refusalMessage(reason: HandoffRefusal, context?: RefusalMessageContext): string;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 子智能体运行时切模型 / 权限后,写回 job.respawnArgs。
|
|
3
|
-
*
|
|
4
|
-
* 重启回放的是建号时的 flag。只改内存 override / 本进程 settings,
|
|
5
|
-
* 工人一死又变回创建时那档。设置页是主对话的全局默认,不要从这里回写。
|
|
6
|
-
*/
|
|
7
|
-
import { type IJobStore } from './agent-view-protocol';
|
|
8
|
-
export declare function replaceCliFlag(args: readonly string[], flag: string, value?: string): string[];
|
|
9
|
-
export declare function persistJobRespawnFlag(store: IJobStore, jobId: string, flag: string, value: string): Promise<boolean>;
|
|
10
|
-
/** 当前进程是子智能体工人:模型只记在 job 上,不写宿主 settings.json。 */
|
|
11
|
-
export declare function shouldSyncHostCliModel(): boolean;
|
|
12
|
-
export declare function persistJobRespawnModel(modelId: string, store?: IJobStore): Promise<boolean>;
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 前台会话 → 后台 job 的交接编排。
|
|
3
|
-
*
|
|
4
|
-
* 顺序对照 Claude `Z5f` / design.md D6:job 记录先落盘,再 adopt,再 flush,
|
|
5
|
-
* 再 spawn;spawn 失败必须回滚 job 目录,前台保持存活。
|
|
6
|
-
*/
|
|
7
|
-
import { type PermissionMode } from '../settings/settings-protocol';
|
|
8
|
-
import { type AgentViewActionDeps } from './agent-view-actions';
|
|
9
|
-
import { type HandoffVia, type InFlightTask } from './handoff-policy';
|
|
10
|
-
/** 派生 seed 时用的最小消息形状 */
|
|
11
|
-
export interface HandoffSeedMessage {
|
|
12
|
-
type: string;
|
|
13
|
-
/** 用户消息正文;assistant 的可见摘要也可放这里 */
|
|
14
|
-
text?: string;
|
|
15
|
-
isMeta?: boolean;
|
|
16
|
-
}
|
|
17
|
-
export interface HandoffSeed {
|
|
18
|
-
intent: string;
|
|
19
|
-
name?: string;
|
|
20
|
-
nameSource?: 'user' | 'auto';
|
|
21
|
-
detail?: string;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* 转后台时落盘的「在跑工作」清单。
|
|
25
|
-
*
|
|
26
|
-
* 这里**不含** abort-then-fork 的 prefill:那段没发完的输入已经作为 worker 的
|
|
27
|
-
* 首个位置参数投递了(见 {@link buildResumeArgs}),而 adopt.json 从来没有
|
|
28
|
-
* 消费方。留着它只会多出一条同文本的投递路径 —— 哪天有人接上消费侧,
|
|
29
|
-
* 用户那句话就会被执行两遍。同一段文本只允许有一个可靠承载点。
|
|
30
|
-
*/
|
|
31
|
-
export interface AdoptPayload {
|
|
32
|
-
writtenAtMs: number;
|
|
33
|
-
shells: Array<{
|
|
34
|
-
id: string;
|
|
35
|
-
label: string;
|
|
36
|
-
kind: string;
|
|
37
|
-
outputFilePath?: string;
|
|
38
|
-
outputStderrPath?: string;
|
|
39
|
-
}>;
|
|
40
|
-
cron: Array<{
|
|
41
|
-
id: string;
|
|
42
|
-
label: string;
|
|
43
|
-
}>;
|
|
44
|
-
agents: Array<{
|
|
45
|
-
id: string;
|
|
46
|
-
label: string;
|
|
47
|
-
sessionId?: string;
|
|
48
|
-
agentType?: string;
|
|
49
|
-
}>;
|
|
50
|
-
workflows: Array<{
|
|
51
|
-
id: string;
|
|
52
|
-
label: string;
|
|
53
|
-
}>;
|
|
54
|
-
}
|
|
55
|
-
export interface SessionHandoffDeps extends AgentViewActionDeps {
|
|
56
|
-
/** flush 当前 transcript;超时不阻断交接 */
|
|
57
|
-
flushTranscript: () => Promise<void>;
|
|
58
|
-
/** spawn 成功后:前台不再写 transcript */
|
|
59
|
-
releaseOwnership: () => void | Promise<void>;
|
|
60
|
-
/** abort-then-fork:中止当前轮次 */
|
|
61
|
-
abortTurn?: () => void | Promise<void>;
|
|
62
|
-
/** 可选:迁移 task-list 等附属文件 */
|
|
63
|
-
migrateSidecars?: (sessionId: string, signal: AbortSignal) => Promise<void>;
|
|
64
|
-
/**
|
|
65
|
-
* job 记录一落盘(id 已知、行已能在列表里出现)就回调。
|
|
66
|
-
*
|
|
67
|
-
* 交接的重头(flush transcript、fork worker)在这之后才发生;
|
|
68
|
-
* 调用方可以在这里就切换视图,让按键到画面切换只隔一次小文件写入,
|
|
69
|
-
* 而不是等整条流水线跑完——那是秒级的画面冻结。
|
|
70
|
-
*/
|
|
71
|
-
onJobCreated?: (id: string) => void;
|
|
72
|
-
nowMs?: () => number;
|
|
73
|
-
warn?: (message: string) => void;
|
|
74
|
-
}
|
|
75
|
-
export interface SessionHandoffInput {
|
|
76
|
-
sessionId: string;
|
|
77
|
-
cwd: string;
|
|
78
|
-
messages: readonly HandoffSeedMessage[];
|
|
79
|
-
via: Exclude<HandoffVia, 'detach'>;
|
|
80
|
-
/** `/bg <prompt>` 附加指令 */
|
|
81
|
-
extraPrompt?: string;
|
|
82
|
-
/** abort-then-fork 时带走的未发完输入 */
|
|
83
|
-
prefill?: string;
|
|
84
|
-
boundaryUuid?: string;
|
|
85
|
-
/** 要写进 adopt.json 的可搬走工作(通常已按 canCarry 过滤) */
|
|
86
|
-
carryTasks?: readonly InFlightTask[];
|
|
87
|
-
/** 透传给子进程的 flag(--model / --permission-mode 等) */
|
|
88
|
-
inheritFlags?: readonly string[];
|
|
89
|
-
/**
|
|
90
|
-
* 交接时会话的实时权限模式。
|
|
91
|
-
*
|
|
92
|
-
* worker 是一个**新进程**,而权限模式只活在内存里:Shift+Tab 切换不落盘,
|
|
93
|
-
* `--permission-mode` 也不一定出现在 argv 里。不带过去的话,转后台的瞬间
|
|
94
|
-
* 模式就会从新进程重建出的默认值重新出发 —— auto 掉回 default,下一个
|
|
95
|
-
* 需要批准的工具调用就卡在「等待输入」,表现为「auto mode 自己关了」。
|
|
96
|
-
* 该值会覆盖 inheritFlags 里从 argv 回放出来的陈旧 --permission-mode。
|
|
97
|
-
*/
|
|
98
|
-
permissionMode?: PermissionMode;
|
|
99
|
-
/** 用户显式命名 */
|
|
100
|
-
name?: string;
|
|
101
|
-
/**
|
|
102
|
-
* 左箭头允许空会话建行(seed 为 null 时用空 intent)。
|
|
103
|
-
* `/bg` 应设为 false,让「还没消息」在外层被拒绝。
|
|
104
|
-
*/
|
|
105
|
-
allowEmptySeed?: boolean;
|
|
106
|
-
/**
|
|
107
|
-
* fork 语义:这是一个副本,父会话继续存活。
|
|
108
|
-
* 设置时会把关联字段写进 job 状态(design D8)。
|
|
109
|
-
*/
|
|
110
|
-
fork?: {
|
|
111
|
-
parentSessionId: string;
|
|
112
|
-
sourceAlive: boolean;
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* 已存在的 job 记录(原地 worker 化在建行时就创建并一直维护它):
|
|
116
|
-
* 跳过 create —— 重建会把刚落盘的 done/output 整个覆盖回 starting…,
|
|
117
|
-
* 行上的完成态就丢了;spawn 后也只补 pid/logPath,不再写死状态,
|
|
118
|
-
* settle 结果由建行方(become-worker)独写。spawn 失败也不回滚删除:
|
|
119
|
-
* 记录描述的是一段真实存在的对话,不是本次交接的临时产物。
|
|
120
|
-
*/
|
|
121
|
-
existingJobId?: string;
|
|
122
|
-
}
|
|
123
|
-
export type SessionHandoffResult = {
|
|
124
|
-
ok: true;
|
|
125
|
-
id: string;
|
|
126
|
-
pid: number;
|
|
127
|
-
logPath: string;
|
|
128
|
-
seed: HandoffSeed;
|
|
129
|
-
} | {
|
|
130
|
-
ok: false;
|
|
131
|
-
reason: string;
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* 从消息派生 job 的 intent / 显示名。
|
|
135
|
-
* 对照 Claude `TKe`:没有用户消息且没有 extraPrompt → null。
|
|
136
|
-
*/
|
|
137
|
-
export declare function deriveHandoffSeed(messages: readonly HandoffSeedMessage[], extraPrompt?: string, emptyFallback?: string): HandoffSeed | null;
|
|
138
|
-
/**
|
|
139
|
-
* 交接主流程。调用方负责之后切到 agent view。
|
|
140
|
-
*/
|
|
141
|
-
export declare function handOffSessionToBackground(deps: SessionHandoffDeps, input: SessionHandoffInput): Promise<SessionHandoffResult>;
|
|
142
|
-
/**
|
|
143
|
-
* 把交接时的实时权限模式合并进 worker 启动 flag。
|
|
144
|
-
*
|
|
145
|
-
* 先剥掉 inheritFlags 里可能从 argv 回放出来的陈旧 `--permission-mode`
|
|
146
|
-
* (会话开始后用户可能用 Shift+Tab 改过,argv 里的值已经不代表现状),
|
|
147
|
-
* 再追加当前模式;spawn 与 respawnArgs 共用同一份结果,worker 重启后
|
|
148
|
-
* 模式也不会丢。未提供模式时原样返回 inheritFlags。
|
|
149
|
-
*/
|
|
150
|
-
export declare function mergePermissionModeFlag(inheritFlags?: readonly string[], permissionMode?: PermissionMode): string[];
|
|
151
|
-
/**
|
|
152
|
-
* 后台 worker 的启动参数。
|
|
153
|
-
*
|
|
154
|
-
* worker 是 broker PTY 里的一个**完整交互会话**(不是 `--print`、也不是 `--serve`),
|
|
155
|
-
* 它自己会一直活着;首个 prompt 作为位置参数交给启动流程消费,
|
|
156
|
-
* 决定它一起来是接着干活还是就地待命。
|
|
157
|
-
*
|
|
158
|
-
* respawnArgs 刻意不带 prompt:重启时该说的话由 pendingReply 承担,
|
|
159
|
-
* 带上会让同一条指令被执行两遍。
|
|
160
|
-
*/
|
|
161
|
-
export declare function buildResumeArgs(sessionId: string, inheritFlags?: readonly string[], firstPrompt?: string): string[];
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { Logger } from '@celljs/core';
|
|
2
|
-
import type { SandboxExecPolicy as ISandboxExecPolicy } from '../permission/sandbox-exec-policy-protocol';
|
|
3
|
-
import type { SensitiveCommandDetector as ISensitiveCommandDetector } from '../permission/sensitive-command-detector';
|
|
4
|
-
import { SandboxTurnConfig } from '../sandbox-cli/sandbox-turn-config';
|
|
5
|
-
import type { SettingsManager as ISettingsManager } from '../settings/settings-protocol';
|
|
6
|
-
import { BashSandboxManager as IBashSandboxManager, SandboxConfig, SandboxDependencyError } from './bash-sandbox-protocol';
|
|
7
|
-
export declare function expandWindowsNativeDirectoryGlobs(paths: readonly string[] | undefined, platform?: NodeJS.Platform): string[];
|
|
8
|
-
/**
|
|
9
|
-
* Bash 沙箱管理器实现
|
|
10
|
-
* 封装 @anthropic-ai/sandbox-runtime 并提供配置管理和自动初始化
|
|
11
|
-
*/
|
|
12
|
-
export declare class BashSandboxManagerImpl implements IBashSandboxManager {
|
|
13
|
-
protected readonly settingsManager: ISettingsManager;
|
|
14
|
-
protected readonly logger: Logger;
|
|
15
|
-
/**
|
|
16
|
-
* Optional so that environments that boot the sandbox manager without the
|
|
17
|
-
* policy module registered (e.g. legacy headless paths) keep working;
|
|
18
|
-
* when present we forward `settings.sandbox.execPolicy` updates on each
|
|
19
|
-
* config load so the policy's user rules stay in sync with settings.
|
|
20
|
-
*/
|
|
21
|
-
protected readonly execPolicy?: ISandboxExecPolicy;
|
|
22
|
-
protected readonly sensitiveCommandDetector?: ISensitiveCommandDetector;
|
|
23
|
-
protected readonly sandboxTurnConfig: SandboxTurnConfig;
|
|
24
|
-
private initialized;
|
|
25
|
-
private cachedConfig;
|
|
26
|
-
/** Last user-rules payload we pushed into the ExecPolicy; used to avoid
|
|
27
|
-
* redundant `setUserRules` calls when settings are unchanged. */
|
|
28
|
-
private lastExecPolicyUserRulesKey;
|
|
29
|
-
private lastOrderedCommandRulesKey;
|
|
30
|
-
/**
|
|
31
|
-
* 获取当前沙箱配置
|
|
32
|
-
*/
|
|
33
|
-
getConfig(): Promise<SandboxConfig | undefined>;
|
|
34
|
-
/**
|
|
35
|
-
* 使用沙箱包装命令
|
|
36
|
-
*
|
|
37
|
-
* 仅 Linux 上调用 `@anthropic-ai/sandbox-runtime` 的 `wrapWithSandbox`,
|
|
38
|
-
* 把命令包装成 `bwrap ... -- bash -c <cmd>` 形式后返回,供
|
|
39
|
-
* `LegacySandboxShellService` 交给 `LocalShellService` 执行。
|
|
40
|
-
*
|
|
41
|
-
* 其它平台(macOS/Windows)由 `sandbox-cli` 接管命令执行,不经过这条
|
|
42
|
-
* JS 侧包装路径;此处直接返回原命令,避免 `AnthropicSandboxManager`
|
|
43
|
-
* 在未初始化的前提下被调用。
|
|
44
|
-
*/
|
|
45
|
-
wrapCommand(command: string): Promise<string>;
|
|
46
|
-
/**
|
|
47
|
-
* 检查命令是否应该在沙箱中执行
|
|
48
|
-
*/
|
|
49
|
-
shouldSandbox(command: string): Promise<boolean>;
|
|
50
|
-
/**
|
|
51
|
-
* 检查命令是否属于系统级工具(如 WSL)。
|
|
52
|
-
* 复用 {@link getCommandRoots} 解析器提取命令根。
|
|
53
|
-
*/
|
|
54
|
-
isSystemLevelTool(command: string): boolean;
|
|
55
|
-
/**
|
|
56
|
-
* 确保沙箱处于正确状态(检查配置变化并初始化/重新初始化)
|
|
57
|
-
*/
|
|
58
|
-
private ensureSandboxReady;
|
|
59
|
-
/**
|
|
60
|
-
* 应用配置变化(智能初始化/重新初始化)
|
|
61
|
-
*/
|
|
62
|
-
private applyConfigChange;
|
|
63
|
-
/**
|
|
64
|
-
* 检查 Linux 平台沙箱所需的依赖
|
|
65
|
-
* @returns 缺失的依赖列表
|
|
66
|
-
*/
|
|
67
|
-
private checkLinuxDependencies;
|
|
68
|
-
/**
|
|
69
|
-
* 检查 Linux 依赖并返回错误(如果有缺失)
|
|
70
|
-
* 供外部调用(如 /sandbox 命令)显示给用户
|
|
71
|
-
*/
|
|
72
|
-
checkDependencies(): Promise<SandboxDependencyError | undefined>;
|
|
73
|
-
/**
|
|
74
|
-
* 初始化沙箱
|
|
75
|
-
*
|
|
76
|
-
* 仅 Linux 需要走 `@anthropic-ai/sandbox-runtime`(bwrap + socat)这条
|
|
77
|
-
* 老路径——对应 `LegacySandboxShellService`。macOS/Windows 已改为由
|
|
78
|
-
* `SandboxShellService` 驱动 Rust `sandbox-cli` 二进制,`AnthropicSandboxManager`
|
|
79
|
-
* 在那两个平台上不承担任何运行时职责,即便调用也只是内存里重设一份永远
|
|
80
|
-
* 不会被读到的配置,因此直接跳过以避免额外开销和潜在的兼容性问题。
|
|
81
|
-
*/
|
|
82
|
-
private initialize;
|
|
83
|
-
/**
|
|
84
|
-
* 重置沙箱
|
|
85
|
-
*
|
|
86
|
-
* 与 `initialize` 对称:只有 Linux 上才真正持有 AnthropicSandboxManager
|
|
87
|
-
* 的状态,其它平台只要翻转 `this.initialized` 即可。
|
|
88
|
-
*/
|
|
89
|
-
private reset;
|
|
90
|
-
/**
|
|
91
|
-
* 从设置中加载沙箱配置
|
|
92
|
-
*/
|
|
93
|
-
private loadConfig;
|
|
94
|
-
/**
|
|
95
|
-
* 判断两个配置是否相等(通过 deepEqual 比较)
|
|
96
|
-
*/
|
|
97
|
-
private isConfigEqual;
|
|
98
|
-
/**
|
|
99
|
-
* 将 SandboxConfig 转换为 SandboxRuntimeConfig
|
|
100
|
-
*/
|
|
101
|
-
private toRuntimeConfig;
|
|
102
|
-
/**
|
|
103
|
-
* 扩展路径中的波浪号
|
|
104
|
-
*/
|
|
105
|
-
private expandPaths;
|
|
106
|
-
/**
|
|
107
|
-
* Push user-authored ExecPolicy rules into the policy component.
|
|
108
|
-
*
|
|
109
|
-
* `undefined` fingerprint means "no execPolicy set" — we also forward
|
|
110
|
-
* `undefined` so the policy clears any previously loaded user rules
|
|
111
|
-
* (important when a user removes the settings block entirely).
|
|
112
|
-
*/
|
|
113
|
-
private syncExecPolicyUserRules;
|
|
114
|
-
private syncOrderedCommandRules;
|
|
115
|
-
/** Prefix commands that wrap the real command — skip them to find the actual executable. */
|
|
116
|
-
private static readonly SHELL_PREFIX_COMMANDS;
|
|
117
|
-
/** Standalone builtins whose arguments are NOT commands — skip the whole sub-command. */
|
|
118
|
-
private static readonly SHELL_STANDALONE_BUILTINS;
|
|
119
|
-
/**
|
|
120
|
-
* Extract command roots from ALL sub-commands in a compound command
|
|
121
|
-
* (separated by &&, ||, ;, |). Each sub-command yields at most one
|
|
122
|
-
* root — the first non-assignment, non-shell-prefix string token.
|
|
123
|
-
*/
|
|
124
|
-
private getCommandRoots;
|
|
125
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Logger } from '@celljs/core';
|
|
2
|
-
import { type ShellExecuteParams, type ShellExecutionHandle, type ShellService } from '../shell/shell-protocol';
|
|
3
|
-
import { BashSandboxManager as IBashSandboxManager } from './bash-sandbox-protocol';
|
|
4
|
-
/**
|
|
5
|
-
* Shell service backed by `@anthropic-ai/sandbox-runtime` (bwrap/socat on
|
|
6
|
-
* Linux).
|
|
7
|
-
*
|
|
8
|
-
* Implementation strategy: transform the caller's command into its sandboxed
|
|
9
|
-
* equivalent via `BashSandboxManager.wrapCommand()`, then hand the wrapped
|
|
10
|
-
* command to `LocalShellService`. Execution semantics (PTY, env propagation,
|
|
11
|
-
* cwd, timeout) therefore mirror the regular local pipeline — the sandbox
|
|
12
|
-
* layer is just a `bwrap ...` / `sandbox-exec ...` prefix injected at the
|
|
13
|
-
* command string level.
|
|
14
|
-
*
|
|
15
|
-
* Known limitations (Linux):
|
|
16
|
-
*
|
|
17
|
-
* - No structured violation reporting. Failures surface as a non-zero exit
|
|
18
|
-
* code plus free-form stderr from bwrap / the launched process. The
|
|
19
|
-
* orchestrator therefore suppresses its `[4] escalation` branch for this
|
|
20
|
-
* backend; denied commands just fail and the model sees the stderr.
|
|
21
|
-
* - `wrapCommand()` returns the original command verbatim when the sandbox
|
|
22
|
-
* is globally disabled or its native deps (bwrap / socat) are missing. In
|
|
23
|
-
* that case we still dispatch through `LocalShellService` for a graceful
|
|
24
|
-
* degradation instead of spawning a broken sandbox.
|
|
25
|
-
*/
|
|
26
|
-
export declare class LegacySandboxShellServiceImpl implements ShellService {
|
|
27
|
-
protected readonly localShellService: ShellService;
|
|
28
|
-
protected readonly bashSandboxManager: IBashSandboxManager;
|
|
29
|
-
protected readonly logger: Logger;
|
|
30
|
-
execute(params: ShellExecuteParams): Promise<ShellExecutionHandle>;
|
|
31
|
-
disposeAll(): Promise<void>;
|
|
32
|
-
getActiveHandleCount(): number;
|
|
33
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type ResolvedSecurityCenterPolicy } from '@genie/product';
|
|
2
|
-
/**
|
|
3
|
-
* 从子进程 env 读取产品配置顶层 clientSecurity 并翻译为规范化策略。
|
|
4
|
-
* 顺序:ACC_PRODUCT_CONFIG_V3 → V2 → ACC_PRODUCT_CONFIG_PATH 落盘文件。全部失败返回 managed:false。
|
|
5
|
-
*/
|
|
6
|
-
export declare function readManagedSecurityPolicyFromEnv(env?: NodeJS.ProcessEnv): ResolvedSecurityCenterPolicy;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { SecurityCenterFileRule } from './bash-sandbox-protocol';
|
|
2
|
-
/**
|
|
3
|
-
* 返回 WorkBuddy 配置根下需要保护的路径。
|
|
4
|
-
*
|
|
5
|
-
* 目录保留尾分隔符,让尚未创建的目录也按目录规则下发;项目文件规则保留
|
|
6
|
-
* `*`,单星号只匹配一层目录,Windows 与 POSIX 使用各自原生分隔符。
|
|
7
|
-
*/
|
|
8
|
-
export declare function getWorkBuddyProtectedPaths(configDir: string, platform?: NodeJS.Platform): string[];
|
|
9
|
-
/**
|
|
10
|
-
* 返回 WorkBuddy 平台数据的运行时文件规则:允许读取,修改和删除均需用户确认。
|
|
11
|
-
*/
|
|
12
|
-
export declare function getWorkBuddyProtectedFileRules(configDir: string, platform?: NodeJS.Platform): SecurityCenterFileRule[];
|