@graychennpm/codebridge 0.0.0-stage → 0.1.0
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/CHANGELOG.md +14 -0
- package/LICENSE +21 -0
- package/README.md +217 -2
- package/README.zh-CN.md +222 -0
- package/apps/web/public/brand/agent-logo-carbon.svg +1 -0
- package/apps/web/public/brand/agent-logo.svg +1 -0
- package/docs/zh-CN/npm-release.md +77 -0
- package/node_modules/@codebridge/agent-registry/dist/index.d.ts +32 -0
- package/node_modules/@codebridge/agent-registry/dist/index.js +177 -0
- package/node_modules/@codebridge/agent-registry/dist/setup.d.ts +9 -0
- package/node_modules/@codebridge/agent-registry/dist/setup.js +115 -0
- package/node_modules/@codebridge/agent-registry/package.json +17 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-active-session.d.ts +12 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-active-session.js +57 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-claude-activity.d.ts +9 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-claude-activity.js +49 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-config-options.d.ts +46 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-config-options.js +220 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-doctor.d.ts +3 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-doctor.js +18 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-event-mapper.d.ts +5 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-event-mapper.js +136 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-kill.d.ts +10 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-kill.js +24 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-race.d.ts +6 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-race.js +29 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-session-list.d.ts +32 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-session-list.js +218 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-session-pool.d.ts +85 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-session-pool.js +165 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-session-runner.d.ts +78 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-session-runner.js +550 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-spawn-profiles.d.ts +9 -0
- package/node_modules/@codebridge/backends/dist/acp/acp-spawn-profiles.js +28 -0
- package/node_modules/@codebridge/backends/dist/acp/headless-client.d.ts +19 -0
- package/node_modules/@codebridge/backends/dist/acp/headless-client.js +47 -0
- package/node_modules/@codebridge/backends/dist/acp/index.d.ts +9 -0
- package/node_modules/@codebridge/backends/dist/acp/index.js +9 -0
- package/node_modules/@codebridge/backends/dist/agent-setup.d.ts +60 -0
- package/node_modules/@codebridge/backends/dist/agent-setup.js +504 -0
- package/node_modules/@codebridge/backends/dist/attachment-prompt.d.ts +8 -0
- package/node_modules/@codebridge/backends/dist/attachment-prompt.js +28 -0
- package/node_modules/@codebridge/backends/dist/auth-error-hints.d.ts +8 -0
- package/node_modules/@codebridge/backends/dist/auth-error-hints.js +33 -0
- package/node_modules/@codebridge/backends/dist/codex-skill-commands.d.ts +3 -0
- package/node_modules/@codebridge/backends/dist/codex-skill-commands.js +88 -0
- package/node_modules/@codebridge/backends/dist/index.d.ts +18 -0
- package/node_modules/@codebridge/backends/dist/index.js +34 -0
- package/node_modules/@codebridge/backends/dist/pi-providers.d.ts +45 -0
- package/node_modules/@codebridge/backends/dist/pi-providers.js +148 -0
- package/node_modules/@codebridge/backends/dist/pi-session-runner.d.ts +85 -0
- package/node_modules/@codebridge/backends/dist/pi-session-runner.js +460 -0
- package/node_modules/@codebridge/backends/dist/provider-connection.d.ts +17 -0
- package/node_modules/@codebridge/backends/dist/provider-connection.js +99 -0
- package/node_modules/@codebridge/backends/dist/session-discovery.d.ts +23 -0
- package/node_modules/@codebridge/backends/dist/session-discovery.js +340 -0
- package/node_modules/@codebridge/backends/dist/skill-control-plane.d.ts +147 -0
- package/node_modules/@codebridge/backends/dist/skill-control-plane.js +832 -0
- package/node_modules/@codebridge/backends/package.json +22 -0
- package/node_modules/@codebridge/bridge/dist/alert-notification-rules.d.ts +14 -0
- package/node_modules/@codebridge/bridge/dist/alert-notification-rules.js +37 -0
- package/node_modules/@codebridge/bridge/dist/channel-config.d.ts +4 -0
- package/node_modules/@codebridge/bridge/dist/channel-config.js +9 -0
- package/node_modules/@codebridge/bridge/dist/channel-ingress.d.ts +5 -0
- package/node_modules/@codebridge/bridge/dist/channel-ingress.js +403 -0
- package/node_modules/@codebridge/bridge/dist/cli.d.ts +3 -0
- package/node_modules/@codebridge/bridge/dist/cli.js +581 -0
- package/node_modules/@codebridge/bridge/dist/deployment.d.ts +46 -0
- package/node_modules/@codebridge/bridge/dist/deployment.js +174 -0
- package/node_modules/@codebridge/bridge/dist/event-loop-lag.d.ts +19 -0
- package/node_modules/@codebridge/bridge/dist/event-loop-lag.js +33 -0
- package/node_modules/@codebridge/bridge/dist/feishu-alert-monitor.d.ts +70 -0
- package/node_modules/@codebridge/bridge/dist/feishu-alert-monitor.js +591 -0
- package/node_modules/@codebridge/bridge/dist/init-wizard.d.ts +52 -0
- package/node_modules/@codebridge/bridge/dist/init-wizard.js +571 -0
- package/node_modules/@codebridge/bridge/dist/mcp-api.d.ts +4 -0
- package/node_modules/@codebridge/bridge/dist/mcp-api.js +100 -0
- package/node_modules/@codebridge/bridge/dist/outbound-api.d.ts +31 -0
- package/node_modules/@codebridge/bridge/dist/outbound-api.js +184 -0
- package/node_modules/@codebridge/bridge/dist/outbound-publishers.d.ts +54 -0
- package/node_modules/@codebridge/bridge/dist/outbound-publishers.js +213 -0
- package/node_modules/@codebridge/bridge/dist/project-api.d.ts +4 -0
- package/node_modules/@codebridge/bridge/dist/project-api.js +161 -0
- package/node_modules/@codebridge/bridge/dist/secrets-command.d.ts +13 -0
- package/node_modules/@codebridge/bridge/dist/secrets-command.js +34 -0
- package/node_modules/@codebridge/bridge/dist/session-api.d.ts +26 -0
- package/node_modules/@codebridge/bridge/dist/session-api.js +1378 -0
- package/node_modules/@codebridge/bridge/dist/session-history-import.d.ts +24 -0
- package/node_modules/@codebridge/bridge/dist/session-history-import.js +82 -0
- package/node_modules/@codebridge/bridge/dist/session-runtime-api.d.ts +19 -0
- package/node_modules/@codebridge/bridge/dist/session-runtime-api.js +453 -0
- package/node_modules/@codebridge/bridge/dist/session-runtime-migration.d.ts +21 -0
- package/node_modules/@codebridge/bridge/dist/session-runtime-migration.js +43 -0
- package/node_modules/@codebridge/bridge/dist/session-runtime-types.d.ts +85 -0
- package/node_modules/@codebridge/bridge/dist/session-runtime-types.js +98 -0
- package/node_modules/@codebridge/bridge/dist/skill-api.d.ts +28 -0
- package/node_modules/@codebridge/bridge/dist/skill-api.js +129 -0
- package/node_modules/@codebridge/bridge/dist/startup-surfaces.d.ts +15 -0
- package/node_modules/@codebridge/bridge/dist/startup-surfaces.js +13 -0
- package/node_modules/@codebridge/bridge/dist/web-frontend.d.ts +8 -0
- package/node_modules/@codebridge/bridge/dist/web-frontend.js +76 -0
- package/node_modules/@codebridge/bridge/dist/work-item-api.d.ts +6 -0
- package/node_modules/@codebridge/bridge/dist/work-item-api.js +414 -0
- package/node_modules/@codebridge/bridge/package.json +28 -0
- package/node_modules/@codebridge/channel-feishu/dist/alert-reactions.d.ts +6 -0
- package/node_modules/@codebridge/channel-feishu/dist/alert-reactions.js +58 -0
- package/node_modules/@codebridge/channel-feishu/dist/alert-types.d.ts +35 -0
- package/node_modules/@codebridge/channel-feishu/dist/alert-types.js +2 -0
- package/node_modules/@codebridge/channel-feishu/dist/bridge.d.ts +130 -0
- package/node_modules/@codebridge/channel-feishu/dist/bridge.js +1231 -0
- package/node_modules/@codebridge/channel-feishu/dist/cardkit-writer.d.ts +48 -0
- package/node_modules/@codebridge/channel-feishu/dist/cardkit-writer.js +153 -0
- package/node_modules/@codebridge/channel-feishu/dist/chain-topics.d.ts +20 -0
- package/node_modules/@codebridge/channel-feishu/dist/chain-topics.js +35 -0
- package/node_modules/@codebridge/channel-feishu/dist/coalescing-card-writer.d.ts +12 -0
- package/node_modules/@codebridge/channel-feishu/dist/coalescing-card-writer.js +53 -0
- package/node_modules/@codebridge/channel-feishu/dist/delivery-reconciler.d.ts +19 -0
- package/node_modules/@codebridge/channel-feishu/dist/delivery-reconciler.js +53 -0
- package/node_modules/@codebridge/channel-feishu/dist/durable-markdown-card.d.ts +19 -0
- package/node_modules/@codebridge/channel-feishu/dist/durable-markdown-card.js +77 -0
- package/node_modules/@codebridge/channel-feishu/dist/feishu-extra-events.d.ts +27 -0
- package/node_modules/@codebridge/channel-feishu/dist/feishu-extra-events.js +24 -0
- package/node_modules/@codebridge/channel-feishu/dist/feishu-http.d.ts +4 -0
- package/node_modules/@codebridge/channel-feishu/dist/feishu-http.js +25 -0
- package/node_modules/@codebridge/channel-feishu/dist/feishu-inbound-context.d.ts +13 -0
- package/node_modules/@codebridge/channel-feishu/dist/feishu-inbound-context.js +45 -0
- package/node_modules/@codebridge/channel-feishu/dist/feishu-inbound-media.d.ts +22 -0
- package/node_modules/@codebridge/channel-feishu/dist/feishu-inbound-media.js +273 -0
- package/node_modules/@codebridge/channel-feishu/dist/feishu-mention-gate.d.ts +13 -0
- package/node_modules/@codebridge/channel-feishu/dist/feishu-mention-gate.js +22 -0
- package/node_modules/@codebridge/channel-feishu/dist/feishu-outbound-file.d.ts +12 -0
- package/node_modules/@codebridge/channel-feishu/dist/feishu-outbound-file.js +38 -0
- package/node_modules/@codebridge/channel-feishu/dist/feishu-quoted-message.d.ts +30 -0
- package/node_modules/@codebridge/channel-feishu/dist/feishu-quoted-message.js +183 -0
- package/node_modules/@codebridge/channel-feishu/dist/index.d.ts +7 -0
- package/node_modules/@codebridge/channel-feishu/dist/index.js +3 -0
- package/node_modules/@codebridge/channel-feishu/dist/redacting-logger.d.ts +17 -0
- package/node_modules/@codebridge/channel-feishu/dist/redacting-logger.js +41 -0
- package/node_modules/@codebridge/channel-feishu/dist/run-status.d.ts +39 -0
- package/node_modules/@codebridge/channel-feishu/dist/run-status.js +166 -0
- package/node_modules/@codebridge/channel-feishu/dist/session-watcher.d.ts +98 -0
- package/node_modules/@codebridge/channel-feishu/dist/session-watcher.js +655 -0
- package/node_modules/@codebridge/channel-feishu/package.json +19 -0
- package/node_modules/@codebridge/channel-telegram/dist/coalescing-message-writer.d.ts +14 -0
- package/node_modules/@codebridge/channel-telegram/dist/coalescing-message-writer.js +56 -0
- package/node_modules/@codebridge/channel-telegram/dist/index.d.ts +3 -0
- package/node_modules/@codebridge/channel-telegram/dist/index.js +3 -0
- package/node_modules/@codebridge/channel-telegram/dist/telegram-api.d.ts +62 -0
- package/node_modules/@codebridge/channel-telegram/dist/telegram-api.js +72 -0
- package/node_modules/@codebridge/channel-telegram/dist/telegram-bridge.d.ts +64 -0
- package/node_modules/@codebridge/channel-telegram/dist/telegram-bridge.js +469 -0
- package/node_modules/@codebridge/channel-telegram/dist/telegram-session-watcher.d.ts +41 -0
- package/node_modules/@codebridge/channel-telegram/dist/telegram-session-watcher.js +184 -0
- package/node_modules/@codebridge/channel-telegram/package.json +18 -0
- package/node_modules/@codebridge/core/dist/config-schema.d.ts +1195 -0
- package/node_modules/@codebridge/core/dist/config-schema.js +293 -0
- package/node_modules/@codebridge/core/dist/config-store.d.ts +48 -0
- package/node_modules/@codebridge/core/dist/config-store.js +207 -0
- package/node_modules/@codebridge/core/dist/index.d.ts +11 -0
- package/node_modules/@codebridge/core/dist/index.js +10 -0
- package/node_modules/@codebridge/core/dist/json-file-store.d.ts +16 -0
- package/node_modules/@codebridge/core/dist/json-file-store.js +46 -0
- package/node_modules/@codebridge/core/dist/mcp-types.d.ts +7 -0
- package/node_modules/@codebridge/core/dist/mcp-types.js +2 -0
- package/node_modules/@codebridge/core/dist/mentions.d.ts +36 -0
- package/node_modules/@codebridge/core/dist/mentions.js +138 -0
- package/node_modules/@codebridge/core/dist/secret-migration.d.ts +14 -0
- package/node_modules/@codebridge/core/dist/secret-migration.js +55 -0
- package/node_modules/@codebridge/core/dist/secret-refs.d.ts +34 -0
- package/node_modules/@codebridge/core/dist/secret-refs.js +142 -0
- package/node_modules/@codebridge/core/dist/session-event-wire.d.ts +17 -0
- package/node_modules/@codebridge/core/dist/session-event-wire.js +28 -0
- package/node_modules/@codebridge/core/dist/types.d.ts +363 -0
- package/node_modules/@codebridge/core/dist/types.js +22 -0
- package/node_modules/@codebridge/core/dist/workspace-key.d.ts +11 -0
- package/node_modules/@codebridge/core/dist/workspace-key.js +25 -0
- package/node_modules/@codebridge/core/package.json +22 -0
- package/node_modules/@codebridge/mcp-runtime/dist/.tsbuildinfo +1 -0
- package/node_modules/@codebridge/mcp-runtime/dist/index.d.ts +92 -0
- package/node_modules/@codebridge/mcp-runtime/dist/index.js +377 -0
- package/node_modules/@codebridge/mcp-runtime/package.json +19 -0
- package/node_modules/@codebridge/policy/dist/capability-runtime.d.ts +123 -0
- package/node_modules/@codebridge/policy/dist/capability-runtime.js +195 -0
- package/node_modules/@codebridge/policy/dist/demo-capabilities.d.ts +4 -0
- package/node_modules/@codebridge/policy/dist/demo-capabilities.js +134 -0
- package/node_modules/@codebridge/policy/dist/equity-capabilities.d.ts +8 -0
- package/node_modules/@codebridge/policy/dist/equity-capabilities.js +35 -0
- package/node_modules/@codebridge/policy/dist/index.d.ts +107 -0
- package/node_modules/@codebridge/policy/dist/index.js +317 -0
- package/node_modules/@codebridge/policy/package.json +17 -0
- package/node_modules/@codebridge/project-catalog/dist/index.d.ts +145 -0
- package/node_modules/@codebridge/project-catalog/dist/index.js +699 -0
- package/node_modules/@codebridge/project-catalog/package.json +18 -0
- package/node_modules/@codebridge/router/dist/channel-stream-projector.d.ts +19 -0
- package/node_modules/@codebridge/router/dist/channel-stream-projector.js +68 -0
- package/node_modules/@codebridge/router/dist/command-help.d.ts +14 -0
- package/node_modules/@codebridge/router/dist/command-help.js +151 -0
- package/node_modules/@codebridge/router/dist/feishu-stream-presenter.d.ts +18 -0
- package/node_modules/@codebridge/router/dist/feishu-stream-presenter.js +193 -0
- package/node_modules/@codebridge/router/dist/index.d.ts +9 -0
- package/node_modules/@codebridge/router/dist/index.js +9 -0
- package/node_modules/@codebridge/router/dist/model-effort.d.ts +5 -0
- package/node_modules/@codebridge/router/dist/model-effort.js +33 -0
- package/node_modules/@codebridge/router/dist/orchestrator.d.ts +56 -0
- package/node_modules/@codebridge/router/dist/orchestrator.js +290 -0
- package/node_modules/@codebridge/router/dist/session-list-format.d.ts +19 -0
- package/node_modules/@codebridge/router/dist/session-list-format.js +97 -0
- package/node_modules/@codebridge/router/dist/session-rotation.d.ts +9 -0
- package/node_modules/@codebridge/router/dist/session-rotation.js +31 -0
- package/node_modules/@codebridge/router/dist/session-router.d.ts +59 -0
- package/node_modules/@codebridge/router/dist/session-router.js +182 -0
- package/node_modules/@codebridge/router/dist/slash-commands.d.ts +78 -0
- package/node_modules/@codebridge/router/dist/slash-commands.js +874 -0
- package/node_modules/@codebridge/router/package.json +18 -0
- package/node_modules/@codebridge/run-executor/dist/agent-event-aggregator.d.ts +18 -0
- package/node_modules/@codebridge/run-executor/dist/agent-event-aggregator.js +88 -0
- package/node_modules/@codebridge/run-executor/dist/index.d.ts +55 -0
- package/node_modules/@codebridge/run-executor/dist/index.js +754 -0
- package/node_modules/@codebridge/run-executor/dist/run-heartbeat.d.ts +14 -0
- package/node_modules/@codebridge/run-executor/dist/run-heartbeat.js +24 -0
- package/node_modules/@codebridge/run-executor/package.json +20 -0
- package/node_modules/@codebridge/runner-client/dist/index.d.ts +142 -0
- package/node_modules/@codebridge/runner-client/dist/index.js +439 -0
- package/node_modules/@codebridge/runner-client/package.json +18 -0
- package/node_modules/@codebridge/runner-host/dist/cli.d.ts +3 -0
- package/node_modules/@codebridge/runner-host/dist/cli.js +58 -0
- package/node_modules/@codebridge/runner-host/dist/codex-session-ownership.d.ts +13 -0
- package/node_modules/@codebridge/runner-host/dist/codex-session-ownership.js +79 -0
- package/node_modules/@codebridge/runner-host/dist/deployment-mcp-server.d.ts +10 -0
- package/node_modules/@codebridge/runner-host/dist/deployment-mcp-server.js +54 -0
- package/node_modules/@codebridge/runner-host/dist/fcb-script.d.ts +3 -0
- package/node_modules/@codebridge/runner-host/dist/fcb-script.js +99 -0
- package/node_modules/@codebridge/runner-host/dist/index.d.ts +3 -0
- package/node_modules/@codebridge/runner-host/dist/index.js +2 -0
- package/node_modules/@codebridge/runner-host/dist/materialize-attachments.d.ts +4 -0
- package/node_modules/@codebridge/runner-host/dist/materialize-attachments.js +62 -0
- package/node_modules/@codebridge/runner-host/dist/server.d.ts +150 -0
- package/node_modules/@codebridge/runner-host/dist/server.js +1295 -0
- package/node_modules/@codebridge/runner-host/dist/session-lease.d.ts +12 -0
- package/node_modules/@codebridge/runner-host/dist/session-lease.js +146 -0
- package/node_modules/@codebridge/runner-host/package.json +26 -0
- package/node_modules/@codebridge/session-catalog/dist/index.d.ts +124 -0
- package/node_modules/@codebridge/session-catalog/dist/index.js +411 -0
- package/node_modules/@codebridge/session-catalog/package.json +17 -0
- package/node_modules/@codebridge/session-coordinator/dist/coordinator.d.ts +111 -0
- package/node_modules/@codebridge/session-coordinator/dist/coordinator.js +364 -0
- package/node_modules/@codebridge/session-coordinator/dist/index.d.ts +5 -0
- package/node_modules/@codebridge/session-coordinator/dist/index.js +5 -0
- package/node_modules/@codebridge/session-coordinator/dist/lease.d.ts +14 -0
- package/node_modules/@codebridge/session-coordinator/dist/lease.js +26 -0
- package/node_modules/@codebridge/session-coordinator/dist/queued-claim.d.ts +20 -0
- package/node_modules/@codebridge/session-coordinator/dist/queued-claim.js +45 -0
- package/node_modules/@codebridge/session-coordinator/dist/recovery.d.ts +31 -0
- package/node_modules/@codebridge/session-coordinator/dist/recovery.js +114 -0
- package/node_modules/@codebridge/session-coordinator/package.json +17 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/node_modules/@codebridge/web/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/node_modules/@codebridge/web/dist/assets/abnfDiagram-N423BO3Z-C-JdFv0U.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/arc-DsNROjzU.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/architecture-TIHT7OUA-ZEBHG2JZ.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/architectureDiagram-T3A2C74G-OsrxcwPM.js +36 -0
- package/node_modules/@codebridge/web/dist/assets/array-BifhSqXX.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/blockDiagram-VBNYF7ZC-DRgfNeNW.js +132 -0
- package/node_modules/@codebridge/web/dist/assets/c4Diagram-5PPSVZJV-BtOGKTh8.js +10 -0
- package/node_modules/@codebridge/web/dist/assets/channel-MhXyjxUS.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-2GRJ4B5K-Dy1gJ7sY.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-4I5QYGJK-1pOLR_SG.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-5RXB4S5H-CP43rgsO.js +231 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-6Q2QTUOP-Bi3Xrp6W.js +88 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-7BUUIJ7U-Bb538aSH.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-7Z6QIM7H-CILAW2Nk.js +10 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-GF5L2VYU-CAp09yhq.js +206 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-I66GZJ75-B_rJXmNu.js +128 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-JQJVKLGR-OVeOJFCx.js +156 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-KBJHAD2P-uaupp0k5.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-KEIR6QF5-BICK3FdT.js +161 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-NSK5VX7P-fIHF5wwn.js +2 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-QR6OTTB3-DxkJuF2b.js +62 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-RYQCIY6F-CC5j3u-X.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-UBXNYLIW-DB35O-6R.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-W5SLKNZC-bkRBsbq-.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-WRU74C26-DwvEoD-1.js +70 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-XXDRQBXY-DRyYA-HY.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/classDiagram-JCYQIIEL-B8r7z8ii.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/classDiagram-v2-OCEON4UE-B8r7z8ii.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/cose-bilkent-JH36ORCC-CLkwlrX7.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/cynefin-VYW2F7L2-C3_Llw02.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/cynefinDiagram-MW4NZA55-D5v7UnJy.js +62 -0
- package/node_modules/@codebridge/web/dist/assets/cytoscape.esm-B-NFISlW.js +321 -0
- package/node_modules/@codebridge/web/dist/assets/dagre-Buvkdvvj.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/dagre-VZM6K2ZE-Cr0IibwW.js +4 -0
- package/node_modules/@codebridge/web/dist/assets/defaultLocale-BFoDCU3G.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/diagram-7IWD3JNH-CpQXDIzA.js +30 -0
- package/node_modules/@codebridge/web/dist/assets/diagram-B4RE2ZJO-VaOkH0Ya.js +3 -0
- package/node_modules/@codebridge/web/dist/assets/diagram-LBJQPF4R-D0iXyNks.js +24 -0
- package/node_modules/@codebridge/web/dist/assets/diagram-Q27KOJAE-CtqYk01P.js +24 -0
- package/node_modules/@codebridge/web/dist/assets/diagram-UB23O5K3-CFnd3H1_.js +41 -0
- package/node_modules/@codebridge/web/dist/assets/dist-D2L7nRdk.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/ebnfDiagram-BXEA7PRR-B0GIbJYt.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/erDiagram-JOGREHBK-BApaLGVA.js +85 -0
- package/node_modules/@codebridge/web/dist/assets/eventmodeling-45OFAUF4-DqGGjcld.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/flowDiagram-UKHOOZJN-I_qlizLH.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/ganttDiagram-PKOTCBZU-B-QZ-J82.js +292 -0
- package/node_modules/@codebridge/web/dist/assets/gitGraph-TEB2WS4Q-DK2SJ2Ne.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/gitGraphDiagram-DS77QQ5N-B6Z-pu0D.js +106 -0
- package/node_modules/@codebridge/web/dist/assets/graphlib-DS17s2tU.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/index-8BzpyygS.js +559 -0
- package/node_modules/@codebridge/web/dist/assets/index-Bzaz89LE.css +1 -0
- package/node_modules/@codebridge/web/dist/assets/info-DKCQHKI2-CGWxt_Py.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/infoDiagram-6WML65LV-77XjrPZs.js +2 -0
- package/node_modules/@codebridge/web/dist/assets/init-C-OQMol4.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/ishikawaDiagram-WSZJBQD7-P1bZAz2x.js +70 -0
- package/node_modules/@codebridge/web/dist/assets/journeyDiagram-NVQOT4AX-C4rwMcBY.js +139 -0
- package/node_modules/@codebridge/web/dist/assets/kanban-definition-27J2QSJJ-mtw4a9bc.js +89 -0
- package/node_modules/@codebridge/web/dist/assets/line-DP4RkYqm.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/linear-DMg3PPio.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/map-BaFkSB1l.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/mermaid-parser.core-HY84kHw1.js +7 -0
- package/node_modules/@codebridge/web/dist/assets/mermaid.core-DdgCdsnM.js +42 -0
- package/node_modules/@codebridge/web/dist/assets/mindmap-definition-FAOFIHXS-Cw1EnbhZ.js +96 -0
- package/node_modules/@codebridge/web/dist/assets/ordinal-BDEzSJ7C.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/packet-7NZHBO7P-CEbrbJH3.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/path-fybaL0A-.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/pegDiagram-VL7TDLO6-CEc1Gedb.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/pie-RZYD4A2V-DPXVs-IW.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/pieDiagram-7S7Q4E2Y-hoQeGMFH.js +39 -0
- package/node_modules/@codebridge/web/dist/assets/quadrantDiagram-CIZ2JOQS-C-Nmxx0f.js +7 -0
- package/node_modules/@codebridge/web/dist/assets/radar-I7S5WNFK-BVd3X3Pd.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/railroad-3IZDKUUU-CxLxzr_v.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/railroad-abnf-AHOZXSZD-MA1zPI84.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/railroad-ebnf-EBAXGLYW-Bqug_umD.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/railroad-peg-LSFZ7HO6-DRcRFwpq.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/railroadDiagram-AXF67PYL-B007ZkL9.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/requirementDiagram-LRYGKXZP-LrTCcEi5.js +84 -0
- package/node_modules/@codebridge/web/dist/assets/rough.esm-Dy-Kn_BL.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/sankeyDiagram-W5VNT64P-Ch4mzHck.js +40 -0
- package/node_modules/@codebridge/web/dist/assets/sequenceDiagram-SI44F4Z6-CHg4OzLX.js +162 -0
- package/node_modules/@codebridge/web/dist/assets/sizeCapture-X5ZJPWSS-B0uUizjq.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/src-BrO6_odD.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/stateDiagram-OKZ733FA-7cVkr5nR.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/stateDiagram-v2-UEYNNEHI-CTy_mAXb.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/swimlanes-SLNWSIFB-BwSVF5qy.js +2 -0
- package/node_modules/@codebridge/web/dist/assets/swimlanesDiagram-ULZ7WXOC-BBQnfZ1j.js +8 -0
- package/node_modules/@codebridge/web/dist/assets/timeline-definition-Z64GVDOM-BaHEkVDV.js +120 -0
- package/node_modules/@codebridge/web/dist/assets/treeView-QDETBFTQ-CF0kLN62.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/treemap-6X3UGDF4-BB8A8uux.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/vennDiagram-T6HMQDX7-BFK12Iro.js +34 -0
- package/node_modules/@codebridge/web/dist/assets/wardley-OPB4EBWU-C_3y61zk.js +1 -0
- package/node_modules/@codebridge/web/dist/assets/wardleyDiagram-T6FBY63Y-W2oGu4WK.js +78 -0
- package/node_modules/@codebridge/web/dist/assets/xychartDiagram-ELKLHX3M-BiVRnbvz.js +7 -0
- package/node_modules/@codebridge/web/dist/brand/agent-logo-carbon.svg +1 -0
- package/node_modules/@codebridge/web/dist/brand/agent-logo.svg +1 -0
- package/node_modules/@codebridge/web/dist/brand/agnet-logo-carbon.svg +1 -0
- package/node_modules/@codebridge/web/dist/brand/agnet-logo.svg +1 -0
- package/node_modules/@codebridge/web/dist/brand/agnet-mark-carbon.svg +1 -0
- package/node_modules/@codebridge/web/dist/brand/agnet-mark.svg +1 -0
- package/node_modules/@codebridge/web/dist/fonts/CommitMono-400-Regular.otf +0 -0
- package/node_modules/@codebridge/web/dist/fonts/CommitMono-700-Regular.otf +0 -0
- package/node_modules/@codebridge/web/dist/fonts/CommitMono-OFL.txt +21 -0
- package/node_modules/@codebridge/web/dist/fonts/DepartureMono-OFL.txt +21 -0
- package/node_modules/@codebridge/web/dist/fonts/DepartureMono-Regular.woff2 +0 -0
- package/node_modules/@codebridge/web/dist/index.html +25 -0
- package/node_modules/@codebridge/web/package.json +7 -0
- package/node_modules/@codebridge/work-items/dist/index.d.ts +371 -0
- package/node_modules/@codebridge/work-items/dist/index.js +1784 -0
- package/node_modules/@codebridge/work-items/dist/session-projector.d.ts +4 -0
- package/node_modules/@codebridge/work-items/dist/session-projector.js +506 -0
- package/node_modules/@codebridge/work-items/dist/session-runtime.d.ts +274 -0
- package/node_modules/@codebridge/work-items/dist/session-runtime.js +1103 -0
- package/node_modules/@codebridge/work-items/dist/session-schema.d.ts +9 -0
- package/node_modules/@codebridge/work-items/dist/session-schema.js +292 -0
- package/node_modules/@codebridge/work-items/package.json +20 -0
- package/package.json +75 -4
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { Readable, Writable } from "node:stream";
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { methods, ndJsonStream, PROTOCOL_VERSION, client, } from "@agentclientprotocol/sdk";
|
|
5
|
+
import { killProcessTree } from "./acp-kill.js";
|
|
6
|
+
import { acpContinueMethod, resolveAcpSpawn } from "./acp-spawn-profiles.js";
|
|
7
|
+
import { mapSessionConfigOptions } from "./acp-config-options.js";
|
|
8
|
+
import { mapSessionUpdate } from "./acp-event-mapper.js";
|
|
9
|
+
import { ACP_CLIENT_CAPABILITIES } from "./headless-client.js";
|
|
10
|
+
import { raceWithAbort } from "./acp-race.js";
|
|
11
|
+
const ACP_SESSION_DELETE_TIMEOUT_MS = 30_000;
|
|
12
|
+
function childToStream(child) {
|
|
13
|
+
if (!child.stdin || !child.stdout) {
|
|
14
|
+
throw new Error("ACP agent stdio pipes unavailable");
|
|
15
|
+
}
|
|
16
|
+
return ndJsonStream(Writable.toWeb(child.stdin), Readable.toWeb(child.stdout));
|
|
17
|
+
}
|
|
18
|
+
async function withAcpConnection(profile, cwd, op, onSessionUpdate, timeoutMs = 60_000) {
|
|
19
|
+
const spawnProfile = resolveAcpSpawn(profile);
|
|
20
|
+
const child = spawn(spawnProfile.command, spawnProfile.args, {
|
|
21
|
+
cwd,
|
|
22
|
+
env: { ...process.env },
|
|
23
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
24
|
+
detached: true, // 自成进程组,退出时全组一起杀,避免适配器的孙进程残留
|
|
25
|
+
});
|
|
26
|
+
const spawnError = new Promise((_, reject) => {
|
|
27
|
+
child.once("error", reject);
|
|
28
|
+
});
|
|
29
|
+
const app = client({ name: "codebridge" }).onNotification(methods.client.session.update, ({ params }) => onSessionUpdate?.(params.sessionId, params.update));
|
|
30
|
+
const stream = childToStream(child);
|
|
31
|
+
const connection = app.connect(stream);
|
|
32
|
+
try {
|
|
33
|
+
const initializeResponse = await raceWithAbort(Promise.race([
|
|
34
|
+
connection.agent.request(methods.agent.initialize, {
|
|
35
|
+
protocolVersion: PROTOCOL_VERSION,
|
|
36
|
+
clientCapabilities: ACP_CLIENT_CAPABILITIES,
|
|
37
|
+
clientInfo: { name: "codebridge", version: "0.1.0" },
|
|
38
|
+
}),
|
|
39
|
+
spawnError,
|
|
40
|
+
]), () => false, timeoutMs, "ACP initialize timeout");
|
|
41
|
+
return await raceWithAbort(Promise.race([op(connection.agent, initializeResponse), spawnError]), () => false, timeoutMs, "ACP operation timeout");
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
connection.close();
|
|
45
|
+
if (!child.killed)
|
|
46
|
+
killProcessTree(child, "SIGTERM");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export function collectAcpSessionHistory(updates) {
|
|
50
|
+
const result = [];
|
|
51
|
+
let previousUserMessageId;
|
|
52
|
+
for (const { update } of updates) {
|
|
53
|
+
if (update.sessionUpdate === "user_message_chunk") {
|
|
54
|
+
const text = textFromContent(update.content);
|
|
55
|
+
if (!text)
|
|
56
|
+
continue;
|
|
57
|
+
const previous = result.at(-1);
|
|
58
|
+
if (previous?.kind === "message" && previousUserMessageId === update.messageId)
|
|
59
|
+
previous.text += text;
|
|
60
|
+
else
|
|
61
|
+
result.push({ kind: "message", text });
|
|
62
|
+
previousUserMessageId = update.messageId;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
previousUserMessageId = undefined;
|
|
66
|
+
for (const event of mapSessionUpdate(update)) {
|
|
67
|
+
result.push({ kind: "agent_event", event });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
function textFromContent(content) {
|
|
73
|
+
return content.type === "text" && typeof content.text === "string" ? content.text : undefined;
|
|
74
|
+
}
|
|
75
|
+
export async function loadAcpSessionHistory(backendId, profile, cwd, sessionId, options) {
|
|
76
|
+
const updates = [];
|
|
77
|
+
await withAcpConnection(profile, cwd, async (agent) => {
|
|
78
|
+
const params = {
|
|
79
|
+
sessionId,
|
|
80
|
+
cwd,
|
|
81
|
+
...(options?.additionalDirectories?.length
|
|
82
|
+
? { additionalDirectories: options.additionalDirectories }
|
|
83
|
+
: {}),
|
|
84
|
+
mcpServers: [],
|
|
85
|
+
};
|
|
86
|
+
const method = acpContinueMethod(profile) === "session/load"
|
|
87
|
+
? methods.agent.session.load
|
|
88
|
+
: methods.agent.session.resume;
|
|
89
|
+
await raceWithAbort(agent.request(method, params), () => false, 60_000, `ACP session history load timeout for ${backendId}`);
|
|
90
|
+
}, (notificationSessionId, update) => {
|
|
91
|
+
if (notificationSessionId === sessionId)
|
|
92
|
+
updates.push({ sessionId: notificationSessionId, update });
|
|
93
|
+
}, 15_000);
|
|
94
|
+
return collectAcpSessionHistory(updates);
|
|
95
|
+
}
|
|
96
|
+
export function hasAcpSessionCapability(response, capability) {
|
|
97
|
+
const sessionCapabilities = response?.agentCapabilities?.sessionCapabilities;
|
|
98
|
+
return sessionCapabilities?.[capability] != null;
|
|
99
|
+
}
|
|
100
|
+
export async function deleteAcpSession(profile, cwd, sessionId, timeoutMs = ACP_SESSION_DELETE_TIMEOUT_MS) {
|
|
101
|
+
return withAcpConnection(profile, cwd, async (agent, initializeResponse) => {
|
|
102
|
+
if (!hasAcpSessionCapability(initializeResponse, "delete")) {
|
|
103
|
+
throw new Error("ACP agent 未声明 session/delete 支持");
|
|
104
|
+
}
|
|
105
|
+
await raceWithAbort(agent.request(methods.agent.session.delete, { sessionId }), () => false, timeoutMs, "ACP session/delete 超时");
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
export async function listAcpSessions(backendId, profile, cwd, options) {
|
|
109
|
+
return withAcpConnection(profile, cwd, (agent) => collectAcpSessions(backendId, cwd, (params) => agent.request(methods.agent.session.list, params), options));
|
|
110
|
+
}
|
|
111
|
+
function cwdUnderScope(sessionCwd, scopeCwd) {
|
|
112
|
+
const session = path.resolve(sessionCwd);
|
|
113
|
+
const scope = path.resolve(scopeCwd);
|
|
114
|
+
return session === scope || session.startsWith(`${scope}${path.sep}`);
|
|
115
|
+
}
|
|
116
|
+
export async function collectAcpSessions(backendId, cwd, requestPage, options) {
|
|
117
|
+
const sessions = [];
|
|
118
|
+
let cursor;
|
|
119
|
+
do {
|
|
120
|
+
const page = await requestPage(cursor ? { cursor } : {});
|
|
121
|
+
sessions.push(...page.sessions);
|
|
122
|
+
cursor = page.nextCursor ?? undefined;
|
|
123
|
+
} while (cursor);
|
|
124
|
+
const scoped = options?.all
|
|
125
|
+
? sessions
|
|
126
|
+
: sessions.filter((session) => cwdUnderScope(session.cwd, cwd));
|
|
127
|
+
return scoped
|
|
128
|
+
.map((session) => ({
|
|
129
|
+
id: session.sessionId,
|
|
130
|
+
backend: backendId,
|
|
131
|
+
cwd: session.cwd,
|
|
132
|
+
...(session.additionalDirectories?.length
|
|
133
|
+
? { additionalDirectories: session.additionalDirectories }
|
|
134
|
+
: {}),
|
|
135
|
+
preview: session.title ?? "(no preview)",
|
|
136
|
+
updatedAt: session.updatedAt ?? "1970-01-01T00:00:00.000Z",
|
|
137
|
+
}))
|
|
138
|
+
.sort((a, b) => b.updatedAt.localeCompare(a.updatedAt))
|
|
139
|
+
.slice(0, options?.limit ?? 20);
|
|
140
|
+
}
|
|
141
|
+
const ACP_CONFIG_OPTIONS_TIMEOUT_MS = 15_000;
|
|
142
|
+
/**
|
|
143
|
+
* 拉取 ACP 适配器 advertise 的会话配置项(/model 动态列表用):短暂 spawn 适配器,
|
|
144
|
+
* initialize + session/new 读 configOptions 后立即销毁。不发 prompt,无推理成本;
|
|
145
|
+
* claude 适配器对未发过 prompt 的会话不持久化(实测 resume 报 Resource not found)。
|
|
146
|
+
* 超时/失败直接抛出,调用方展示 adapter 的真实错误,不回退到过期静态列表。
|
|
147
|
+
*/
|
|
148
|
+
export async function listAcpConfigOptions(profile, cwd, timeoutMs = ACP_CONFIG_OPTIONS_TIMEOUT_MS) {
|
|
149
|
+
return withAcpConnection(profile, cwd, (agent) => {
|
|
150
|
+
// 超时放在 op 内:reject 后 withAcpConnection 的 finally 负责 close + kill
|
|
151
|
+
const timeout = new Promise((_, reject) => {
|
|
152
|
+
const timer = setTimeout(() => reject(new Error("ACP config options timeout")), timeoutMs);
|
|
153
|
+
timer.unref?.();
|
|
154
|
+
});
|
|
155
|
+
const fetchOptions = (async () => {
|
|
156
|
+
const active = await agent.buildSession(cwd).start();
|
|
157
|
+
const options = active.newSessionResponse.configOptions ?? [];
|
|
158
|
+
active.dispose();
|
|
159
|
+
return mapSessionConfigOptions(options);
|
|
160
|
+
})();
|
|
161
|
+
return Promise.race([fetchOptions, timeout]);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
export async function probeAcpInitialize(profile, cwd, timeoutMs = 30_000) {
|
|
165
|
+
const spawnProfile = resolveAcpSpawn(profile);
|
|
166
|
+
return new Promise((resolve) => {
|
|
167
|
+
const child = spawn(spawnProfile.command, spawnProfile.args, {
|
|
168
|
+
cwd,
|
|
169
|
+
env: { ...process.env },
|
|
170
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
171
|
+
detached: true,
|
|
172
|
+
});
|
|
173
|
+
const spawnError = new Promise((_, reject) => {
|
|
174
|
+
child.once("error", reject);
|
|
175
|
+
});
|
|
176
|
+
const timer = setTimeout(() => {
|
|
177
|
+
killProcessTree(child, "SIGTERM");
|
|
178
|
+
resolve({ ok: false, message: "ACP initialize timeout" });
|
|
179
|
+
}, timeoutMs);
|
|
180
|
+
(async () => {
|
|
181
|
+
try {
|
|
182
|
+
const app = client({ name: "codebridge" });
|
|
183
|
+
const stream = childToStream(child);
|
|
184
|
+
const connection = app.connect(stream);
|
|
185
|
+
const init = await Promise.race([
|
|
186
|
+
connection.agent.request(methods.agent.initialize, {
|
|
187
|
+
protocolVersion: PROTOCOL_VERSION,
|
|
188
|
+
clientCapabilities: ACP_CLIENT_CAPABILITIES,
|
|
189
|
+
clientInfo: { name: "codebridge", version: "0.1.0" },
|
|
190
|
+
}),
|
|
191
|
+
spawnError,
|
|
192
|
+
]);
|
|
193
|
+
connection.close();
|
|
194
|
+
const caps = init.agentCapabilities;
|
|
195
|
+
const parts = [
|
|
196
|
+
`protocol=${init.protocolVersion}`,
|
|
197
|
+
caps?.promptCapabilities?.image ? "image" : null,
|
|
198
|
+
caps?.sessionCapabilities?.list ? "list" : null,
|
|
199
|
+
caps?.sessionCapabilities?.resume ? "resume" : null,
|
|
200
|
+
caps?.loadSession ? "load" : null,
|
|
201
|
+
].filter(Boolean);
|
|
202
|
+
resolve({ ok: true, message: parts.join(", ") });
|
|
203
|
+
}
|
|
204
|
+
catch (err) {
|
|
205
|
+
resolve({
|
|
206
|
+
ok: false,
|
|
207
|
+
message: err instanceof Error ? err.message : String(err),
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
finally {
|
|
211
|
+
clearTimeout(timer);
|
|
212
|
+
if (!child.killed)
|
|
213
|
+
killProcessTree(child, "SIGTERM");
|
|
214
|
+
}
|
|
215
|
+
})();
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=acp-session-list.js.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { ChildProcess } from "node:child_process";
|
|
2
|
+
import type { ActiveSession, ActiveSessionMessage, ClientConnection, SessionConfigOption } from "@agentclientprotocol/sdk";
|
|
3
|
+
/** 每轮由 runner 重绑的会话运行时:per-run 闭包绝不能跨轮沿用(否则第二轮权限请求会调到第一轮的死闭包) */
|
|
4
|
+
export interface AcpSessionRuntime {
|
|
5
|
+
requestDecision?: (info: {
|
|
6
|
+
title: string;
|
|
7
|
+
}) => Promise<boolean>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 一个长驻 ACP 会话的全部资源。池命中时整个对象跨轮复用——尤其 `active` 与 `carrier`:
|
|
11
|
+
* 同一连接上对同一 sessionId 再 attach 会造成双队列重复投递(SDK SessionUpdateRouter 是
|
|
12
|
+
* Set 追加),被抛弃的 nextUpdate waiter 会吞掉下一条消息(FIFO 且无注销 API),
|
|
13
|
+
* 所以 ActiveSession 对象与挂起的 waiter 都必须原样接力,绝不能重建或丢弃。
|
|
14
|
+
*/
|
|
15
|
+
export interface AcpSessionResources {
|
|
16
|
+
sessionId: string;
|
|
17
|
+
child: ChildProcess;
|
|
18
|
+
connection: ClientConnection;
|
|
19
|
+
active: ActiveSession;
|
|
20
|
+
/** 复用匹配键:cwd/spawn 命令/env 任一变了都不能复用(进程启动时已冻结) */
|
|
21
|
+
cwd: string;
|
|
22
|
+
spawnKey: string;
|
|
23
|
+
envKey: string;
|
|
24
|
+
additionalDirectoriesKey: string;
|
|
25
|
+
mcpServersKey: string;
|
|
26
|
+
supportsSteering: boolean;
|
|
27
|
+
supportsClose: boolean;
|
|
28
|
+
configOptions: SessionConfigOption[];
|
|
29
|
+
/** stderr 尾部缓冲,跨轮累积 */
|
|
30
|
+
readStderr: () => string;
|
|
31
|
+
/** 跨轮接力的 nextUpdate waiter */
|
|
32
|
+
carrier: {
|
|
33
|
+
pending: Promise<ActiveSessionMessage> | null;
|
|
34
|
+
};
|
|
35
|
+
runtime: AcpSessionRuntime;
|
|
36
|
+
}
|
|
37
|
+
export interface AcpSessionPoolOptions {
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
/** 空闲这么久后回收(ms) */
|
|
40
|
+
idleMs: number;
|
|
41
|
+
/** 池内最多保留多少个空闲会话进程 */
|
|
42
|
+
maxPooled: number;
|
|
43
|
+
}
|
|
44
|
+
export declare function resourcesAlive(r: AcpSessionResources): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* 完整拆除一个会话:dispose 路由、关连接、杀整棵进程树。默认 SIGTERM + 2s SIGKILL
|
|
47
|
+
* 兜底;shutdown 路径传 SIGKILL 直杀——runner 马上 process.exit,unref 的兜底定时器
|
|
48
|
+
* 活不到触发,等宽限毫无意义。
|
|
49
|
+
*/
|
|
50
|
+
export declare function teardownResources(r: AcpSessionResources, signal?: NodeJS.Signals): void;
|
|
51
|
+
/**
|
|
52
|
+
* 长驻 ACP 会话池(check-out/check-in 模型):
|
|
53
|
+
* - acquire 命中即把条目从池里取走(运行期不在池内)——同一 sessionId 的并发第二个
|
|
54
|
+
* 认领者(/resume 可让两个会话绑同一 id)自然 miss、走独立冷启动,无需 busy 锁;
|
|
55
|
+
* - release 在健康轮末把资源放回(池满先淘汰最久未用的);
|
|
56
|
+
* - 出错/中断/超时一律不归还(由调用方 teardown),池只保留干净收尾的会话;
|
|
57
|
+
* - idle sweep 回收长时间没人用的进程;shutdown 必须在 runner 退出前调用
|
|
58
|
+
* (子进程 detached,不会随 runner 死)。
|
|
59
|
+
*/
|
|
60
|
+
export declare class AcpSessionPool {
|
|
61
|
+
private readonly options;
|
|
62
|
+
private readonly idle;
|
|
63
|
+
private readonly sweepTimer?;
|
|
64
|
+
constructor(options: AcpSessionPoolOptions);
|
|
65
|
+
get enabled(): boolean;
|
|
66
|
+
size(): number;
|
|
67
|
+
/** detached ACP 进程是进程组组长;用于识别其 Codex 子进程是否属于本 Runner。 */
|
|
68
|
+
ownerProcessGroupId(sessionId: string): number | undefined;
|
|
69
|
+
acquire(sessionId: string, match: {
|
|
70
|
+
cwd: string;
|
|
71
|
+
spawnKey: string;
|
|
72
|
+
envKey: string;
|
|
73
|
+
additionalDirectoriesKey: string;
|
|
74
|
+
mcpServersKey: string;
|
|
75
|
+
}): AcpSessionResources | null;
|
|
76
|
+
release(r: AcpSessionResources): void;
|
|
77
|
+
remove(sessionId: string): boolean;
|
|
78
|
+
close(sessionId: string, timeoutMs?: number): Promise<{
|
|
79
|
+
ok: boolean;
|
|
80
|
+
error?: string;
|
|
81
|
+
}>;
|
|
82
|
+
sweep(now?: number): void;
|
|
83
|
+
shutdown(): void;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=acp-session-pool.d.ts.map
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { methods } from "@agentclientprotocol/sdk";
|
|
2
|
+
import { killProcessTree } from "./acp-kill.js";
|
|
3
|
+
import { raceWithAbort } from "./acp-race.js";
|
|
4
|
+
const ACP_SESSION_CLOSE_TIMEOUT_MS = 30_000;
|
|
5
|
+
const SWEEP_INTERVAL_MS = 60_000;
|
|
6
|
+
export function resourcesAlive(r) {
|
|
7
|
+
return r.child.exitCode === null && r.child.signalCode === null;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 完整拆除一个会话:dispose 路由、关连接、杀整棵进程树。默认 SIGTERM + 2s SIGKILL
|
|
11
|
+
* 兜底;shutdown 路径传 SIGKILL 直杀——runner 马上 process.exit,unref 的兜底定时器
|
|
12
|
+
* 活不到触发,等宽限毫无意义。
|
|
13
|
+
*/
|
|
14
|
+
export function teardownResources(r, signal = "SIGTERM") {
|
|
15
|
+
try {
|
|
16
|
+
r.active.dispose();
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
// 已 dispose / 连接已死
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
r.connection.close();
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
// 已关闭
|
|
26
|
+
}
|
|
27
|
+
killProcessTree(r.child, signal);
|
|
28
|
+
if (signal !== "SIGKILL") {
|
|
29
|
+
const child = r.child;
|
|
30
|
+
setTimeout(() => {
|
|
31
|
+
if (child.exitCode === null && child.signalCode === null) {
|
|
32
|
+
killProcessTree(child, "SIGKILL");
|
|
33
|
+
}
|
|
34
|
+
}, 2000).unref();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 长驻 ACP 会话池(check-out/check-in 模型):
|
|
39
|
+
* - acquire 命中即把条目从池里取走(运行期不在池内)——同一 sessionId 的并发第二个
|
|
40
|
+
* 认领者(/resume 可让两个会话绑同一 id)自然 miss、走独立冷启动,无需 busy 锁;
|
|
41
|
+
* - release 在健康轮末把资源放回(池满先淘汰最久未用的);
|
|
42
|
+
* - 出错/中断/超时一律不归还(由调用方 teardown),池只保留干净收尾的会话;
|
|
43
|
+
* - idle sweep 回收长时间没人用的进程;shutdown 必须在 runner 退出前调用
|
|
44
|
+
* (子进程 detached,不会随 runner 死)。
|
|
45
|
+
*/
|
|
46
|
+
export class AcpSessionPool {
|
|
47
|
+
options;
|
|
48
|
+
idle = new Map();
|
|
49
|
+
sweepTimer;
|
|
50
|
+
constructor(options) {
|
|
51
|
+
this.options = options;
|
|
52
|
+
if (options.enabled) {
|
|
53
|
+
this.sweepTimer = setInterval(() => this.sweep(), SWEEP_INTERVAL_MS);
|
|
54
|
+
this.sweepTimer.unref();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
get enabled() {
|
|
58
|
+
return this.options.enabled;
|
|
59
|
+
}
|
|
60
|
+
size() {
|
|
61
|
+
return this.idle.size;
|
|
62
|
+
}
|
|
63
|
+
/** detached ACP 进程是进程组组长;用于识别其 Codex 子进程是否属于本 Runner。 */
|
|
64
|
+
ownerProcessGroupId(sessionId) {
|
|
65
|
+
return this.idle.get(sessionId)?.resources.child.pid;
|
|
66
|
+
}
|
|
67
|
+
acquire(sessionId, match) {
|
|
68
|
+
if (!this.options.enabled)
|
|
69
|
+
return null;
|
|
70
|
+
const entry = this.idle.get(sessionId);
|
|
71
|
+
if (!entry)
|
|
72
|
+
return null;
|
|
73
|
+
this.idle.delete(sessionId);
|
|
74
|
+
const r = entry.resources;
|
|
75
|
+
if (!resourcesAlive(r) ||
|
|
76
|
+
r.cwd !== match.cwd ||
|
|
77
|
+
r.spawnKey !== match.spawnKey ||
|
|
78
|
+
r.envKey !== match.envKey ||
|
|
79
|
+
r.additionalDirectoriesKey !== match.additionalDirectoriesKey
|
|
80
|
+
|| r.mcpServersKey !== match.mcpServersKey) {
|
|
81
|
+
teardownResources(r);
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
return r;
|
|
85
|
+
}
|
|
86
|
+
release(r) {
|
|
87
|
+
if (!this.options.enabled || !resourcesAlive(r)) {
|
|
88
|
+
teardownResources(r);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
// 并发认领的旁路进程后到:同 id 已有空闲条目时不覆盖(否则先到者被泄漏),拆掉后来的
|
|
92
|
+
if (this.idle.has(r.sessionId)) {
|
|
93
|
+
teardownResources(r);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
while (this.idle.size >= this.options.maxPooled) {
|
|
97
|
+
let oldestId;
|
|
98
|
+
let oldestAt = Infinity;
|
|
99
|
+
for (const [id, entry] of this.idle) {
|
|
100
|
+
if (entry.lastUsedAt < oldestAt) {
|
|
101
|
+
oldestAt = entry.lastUsedAt;
|
|
102
|
+
oldestId = id;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (oldestId === undefined)
|
|
106
|
+
break;
|
|
107
|
+
const evicted = this.idle.get(oldestId);
|
|
108
|
+
this.idle.delete(oldestId);
|
|
109
|
+
teardownResources(evicted.resources);
|
|
110
|
+
}
|
|
111
|
+
this.idle.set(r.sessionId, { resources: r, lastUsedAt: Date.now() });
|
|
112
|
+
}
|
|
113
|
+
remove(sessionId) {
|
|
114
|
+
const entry = this.idle.get(sessionId);
|
|
115
|
+
if (!entry)
|
|
116
|
+
return false;
|
|
117
|
+
this.idle.delete(sessionId);
|
|
118
|
+
teardownResources(entry.resources);
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
async close(sessionId, timeoutMs = ACP_SESSION_CLOSE_TIMEOUT_MS) {
|
|
122
|
+
const entry = this.idle.get(sessionId);
|
|
123
|
+
if (!entry)
|
|
124
|
+
return { ok: false, error: "not_owned" };
|
|
125
|
+
this.idle.delete(sessionId);
|
|
126
|
+
try {
|
|
127
|
+
if (!entry.resources.supportsClose) {
|
|
128
|
+
return {
|
|
129
|
+
ok: false,
|
|
130
|
+
error: "ACP agent 未声明 session/close 支持",
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
await raceWithAbort(entry.resources.connection.agent.request(methods.agent.session.close, { sessionId }), () => false, timeoutMs, "ACP session/close 超时");
|
|
134
|
+
return { ok: true };
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
return {
|
|
138
|
+
ok: false,
|
|
139
|
+
error: err instanceof Error ? err.message : String(err),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
finally {
|
|
143
|
+
teardownResources(entry.resources);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
sweep(now = Date.now()) {
|
|
147
|
+
for (const [id, entry] of [...this.idle.entries()]) {
|
|
148
|
+
if (!resourcesAlive(entry.resources) ||
|
|
149
|
+
now - entry.lastUsedAt >= this.options.idleMs) {
|
|
150
|
+
this.idle.delete(id);
|
|
151
|
+
teardownResources(entry.resources);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
shutdown() {
|
|
156
|
+
if (this.sweepTimer)
|
|
157
|
+
clearInterval(this.sweepTimer);
|
|
158
|
+
for (const [id, entry] of [...this.idle.entries()]) {
|
|
159
|
+
this.idle.delete(id);
|
|
160
|
+
// runner 即将退出:直接 SIGKILL(空闲进程无在途工作,宽限期定时器也活不到)
|
|
161
|
+
teardownResources(entry.resources, "SIGKILL");
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=acp-session-pool.js.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { type ChildProcess } from "node:child_process";
|
|
2
|
+
import { type ActiveSession, type ActiveSessionMessage, type ContentBlock, type SessionConfigOption } from "@agentclientprotocol/sdk";
|
|
3
|
+
import type { AgentEvent, AcpPermissionPolicy, RunContext } from "@codebridge/core";
|
|
4
|
+
import { type AcpSessionPool } from "./acp-session-pool.js";
|
|
5
|
+
export interface AcpRunHandle {
|
|
6
|
+
child: ChildProcess;
|
|
7
|
+
cancel: () => void;
|
|
8
|
+
steer?: (prompt: string) => Promise<unknown>;
|
|
9
|
+
}
|
|
10
|
+
export interface AcpRunOptions {
|
|
11
|
+
permissionPolicy: AcpPermissionPolicy;
|
|
12
|
+
isAborted: () => boolean;
|
|
13
|
+
/** 子进程 stderr 快照,用于超时/失败时给出真实原因 */
|
|
14
|
+
readStderr?: () => string;
|
|
15
|
+
/** 测试用:覆盖下方三个超时常量 */
|
|
16
|
+
promptTimeoutMs?: number;
|
|
17
|
+
noOutputTimeoutMs?: number;
|
|
18
|
+
stallTimeoutMs?: number;
|
|
19
|
+
/** 主轮 stop 后,本轮起过 tool 时进入 drain;这么久内无“真实后台活动”视为无后台,返回 */
|
|
20
|
+
postStopProbeMs?: number;
|
|
21
|
+
/** drain 确认有后台后,这么久无新的真实活动视为后台真正结束 */
|
|
22
|
+
postStopQuietMs?: number;
|
|
23
|
+
/** drain 阶段独立硬上限(与主轮 20min deadline 各自计时) */
|
|
24
|
+
postStopMaxMs?: number;
|
|
25
|
+
/** drain 总开关,默认 true */
|
|
26
|
+
drainBackgroundWork?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* drain 磁盘活动标记(可选):返回单调递增的数值(如会话文件合计字节数),
|
|
29
|
+
* 变化即视为后台仍在工作、刷新静默计时。wire 静默但磁盘在写时避免误切。
|
|
30
|
+
*/
|
|
31
|
+
drainActivityMarker?: () => number | undefined;
|
|
32
|
+
/** prompt_feishu 权限模式:把权限请求交给外界决策(runner 的 broker 注入) */
|
|
33
|
+
requestDecision?: (info: {
|
|
34
|
+
title: string;
|
|
35
|
+
}) => Promise<boolean>;
|
|
36
|
+
/**
|
|
37
|
+
* 带外事件源(可选):每个轮询 tick 取一批插入事件流。权限请求这类发生在
|
|
38
|
+
* 连接回调里的事件没法直接 yield,经它汇入 SSE。
|
|
39
|
+
*/
|
|
40
|
+
pollOutOfBandEvents?: () => AgentEvent[];
|
|
41
|
+
/**
|
|
42
|
+
* 长驻会话池(可选):命中即复用适配器进程,省每轮 spawn+initialize+resume。
|
|
43
|
+
* 未传 = 每轮 spawn/杀(旧行为)。
|
|
44
|
+
*/
|
|
45
|
+
sessionPool?: AcpSessionPool;
|
|
46
|
+
/**
|
|
47
|
+
* 跨轮接力的 nextUpdate waiter(池模式必传池条目的 carrier):SDK 队列 FIFO 且
|
|
48
|
+
* waiter 无法注销,被抛弃的 waiter 会吞掉下一条消息,必须原样接力。
|
|
49
|
+
*/
|
|
50
|
+
updateCarrier?: {
|
|
51
|
+
pending: Promise<ActiveSessionMessage> | null;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* 本轮结束后资源不可入池的信号(如 drain 硬上限放弃了仍在跑的后台任务):
|
|
55
|
+
* fatal 标志驱动退出码/用户提示,不能复用它表达“别复用这个进程”。
|
|
56
|
+
*/
|
|
57
|
+
markUnpoolable?: () => void;
|
|
58
|
+
/** session/update config_option_update 的原始快照回写(池复用跨轮保留) */
|
|
59
|
+
onConfigOptionsUpdate?: (options: SessionConfigOption[]) => void;
|
|
60
|
+
/** 预排干队列后、发新 prompt 前执行的配置应用钩子 */
|
|
61
|
+
beforePrompt?: () => Promise<AgentEvent[]>;
|
|
62
|
+
}
|
|
63
|
+
export declare function supportsAcpSteering(response: unknown): boolean;
|
|
64
|
+
export declare function steerAcpSession(agent: {
|
|
65
|
+
request: (method: string, params: unknown) => Promise<unknown>;
|
|
66
|
+
}, sessionId: string, prompt: string): Promise<unknown>;
|
|
67
|
+
export declare function runActivePromptTurn(active: ActiveSession, blocks: ContentBlock[], options: AcpRunOptions): AsyncGenerator<AgentEvent>;
|
|
68
|
+
/** 复用匹配键:spawn 命令与关键 env 在进程启动时冻结,任一变化都不能复用 */
|
|
69
|
+
export declare function buildSessionMatchKeys(ctx: RunContext): {
|
|
70
|
+
spawnKey: string;
|
|
71
|
+
envKey: string;
|
|
72
|
+
additionalDirectoriesKey: string;
|
|
73
|
+
mcpServersKey: string;
|
|
74
|
+
};
|
|
75
|
+
export declare function runAcpSession(ctx: RunContext, options: AcpRunOptions, outHandle: {
|
|
76
|
+
current?: AcpRunHandle;
|
|
77
|
+
}): AsyncGenerator<AgentEvent>;
|
|
78
|
+
//# sourceMappingURL=acp-session-runner.d.ts.map
|