@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,293 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Single source of truth for the npm ACP adapter package versions used as spawn defaults. */
|
|
3
|
+
export const ACP_CLAUDE_AGENT_ACP_VERSION = "0.81.1";
|
|
4
|
+
export const ACP_CODEX_ACP_VERSION = "1.13.1";
|
|
5
|
+
export const PolicyScenarioSchema = z.object({
|
|
6
|
+
name: z.string(),
|
|
7
|
+
chats: z.array(z.string()),
|
|
8
|
+
requireMention: z.boolean().optional(),
|
|
9
|
+
enabled: z.boolean().optional(),
|
|
10
|
+
});
|
|
11
|
+
export const FeishuPolicySchema = z.object({
|
|
12
|
+
requireMention: z.boolean().default(true),
|
|
13
|
+
dmMode: z.enum(["open", "disabled", "allowlist", "pair"]).default("open"),
|
|
14
|
+
dmAllowlist: z.array(z.string()).optional(),
|
|
15
|
+
groupAllowlist: z.array(z.string()).optional(),
|
|
16
|
+
respondToMentionAll: z.boolean().default(false),
|
|
17
|
+
scenarios: z.array(PolicyScenarioSchema).optional(),
|
|
18
|
+
});
|
|
19
|
+
/** Web Rail / 飞书 `/backend` 共用的五家 Agent,不再扩张。 */
|
|
20
|
+
export const SUPPORTED_AGENT_IDS = [
|
|
21
|
+
"cursor",
|
|
22
|
+
"claude",
|
|
23
|
+
"codex",
|
|
24
|
+
"pi",
|
|
25
|
+
"opencode",
|
|
26
|
+
];
|
|
27
|
+
export const BackendProfileSchema = z.object({
|
|
28
|
+
type: z.enum(["cursor-cli", "claude-code", "codex", "generic-spawn", "pi-sdk"]),
|
|
29
|
+
// 兼容旧配置里的显式 `transport: acp`;CLI transport 已移除;pi-sdk 不读取该字段。
|
|
30
|
+
transport: z.literal("acp").optional(),
|
|
31
|
+
acpCommand: z.string().optional(),
|
|
32
|
+
acpArgs: z.array(z.string()).optional(),
|
|
33
|
+
model: z.string().optional(),
|
|
34
|
+
effort: z.string().optional(),
|
|
35
|
+
/** true 时,若适配器未 advertise 想要的 model,本轮直接失败而非静默用适配器默认;默认 false */
|
|
36
|
+
strictModel: z.boolean().optional(),
|
|
37
|
+
/** Claude ACP mode 的兼容默认值,默认 bypassPermissions 避免 dontAsk 拒绝 Bash */
|
|
38
|
+
claudePermissionMode: z
|
|
39
|
+
.enum([
|
|
40
|
+
"acceptEdits",
|
|
41
|
+
"auto",
|
|
42
|
+
"bypassPermissions",
|
|
43
|
+
"default",
|
|
44
|
+
"dontAsk",
|
|
45
|
+
"plan",
|
|
46
|
+
])
|
|
47
|
+
.optional(),
|
|
48
|
+
});
|
|
49
|
+
export const DEFAULT_BACKEND_PROFILES = {
|
|
50
|
+
cursor: {
|
|
51
|
+
type: "cursor-cli",
|
|
52
|
+
acpCommand: "cursor-agent",
|
|
53
|
+
acpArgs: ["acp"],
|
|
54
|
+
},
|
|
55
|
+
claude: {
|
|
56
|
+
type: "claude-code",
|
|
57
|
+
acpCommand: "npx",
|
|
58
|
+
acpArgs: ["-y", `@agentclientprotocol/claude-agent-acp@${ACP_CLAUDE_AGENT_ACP_VERSION}`],
|
|
59
|
+
claudePermissionMode: "bypassPermissions",
|
|
60
|
+
},
|
|
61
|
+
codex: {
|
|
62
|
+
type: "codex",
|
|
63
|
+
acpCommand: "npx",
|
|
64
|
+
acpArgs: ["-y", `@agentclientprotocol/codex-acp@${ACP_CODEX_ACP_VERSION}`],
|
|
65
|
+
},
|
|
66
|
+
pi: { type: "pi-sdk" },
|
|
67
|
+
opencode: {
|
|
68
|
+
type: "generic-spawn",
|
|
69
|
+
acpCommand: "opencode",
|
|
70
|
+
acpArgs: ["acp"],
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
function mergeDefaultBackends(backends) {
|
|
74
|
+
return { ...DEFAULT_BACKEND_PROFILES, ...backends };
|
|
75
|
+
}
|
|
76
|
+
export const AccessConfigSchema = z.object({
|
|
77
|
+
allowedUsers: z.array(z.string()).optional(),
|
|
78
|
+
allowedChats: z.array(z.string()).optional(),
|
|
79
|
+
admins: z.array(z.string()).optional(),
|
|
80
|
+
});
|
|
81
|
+
export const WorkspacesConfigSchema = z.object({
|
|
82
|
+
root: z.string().optional(),
|
|
83
|
+
default: z.string().optional(),
|
|
84
|
+
named: z.record(z.string()).optional(),
|
|
85
|
+
});
|
|
86
|
+
export const ProjectCatalogConfigSchema = z.object({
|
|
87
|
+
repositoryPath: z.string().min(1),
|
|
88
|
+
baseRef: z.string().min(1).default("main"),
|
|
89
|
+
catalogPath: z.string().min(1).default("catalog/projects.yaml"),
|
|
90
|
+
});
|
|
91
|
+
const McpServerCommonSchema = {
|
|
92
|
+
revision: z.string().min(1).optional(),
|
|
93
|
+
enabled: z.boolean().default(true),
|
|
94
|
+
};
|
|
95
|
+
export const McpServerConfigSchema = z.discriminatedUnion("transport", [
|
|
96
|
+
z.object({
|
|
97
|
+
transport: z.literal("stdio"),
|
|
98
|
+
command: z.string().min(1),
|
|
99
|
+
args: z.array(z.string()).optional(),
|
|
100
|
+
env: z.array(z.string().min(1)).optional(),
|
|
101
|
+
...McpServerCommonSchema,
|
|
102
|
+
}),
|
|
103
|
+
z.object({
|
|
104
|
+
transport: z.literal("http"),
|
|
105
|
+
url: z.string().url(),
|
|
106
|
+
...McpServerCommonSchema,
|
|
107
|
+
}),
|
|
108
|
+
]);
|
|
109
|
+
export const SessionAutoRotateConfigSchema = z.object({
|
|
110
|
+
/** Default on: a chat should not resume one provider session forever. */
|
|
111
|
+
enabled: z.boolean().optional(),
|
|
112
|
+
/** Start a fresh session when the last one has been idle this long; 0 disables. Default 12. */
|
|
113
|
+
idleHours: z.number().min(0).optional(),
|
|
114
|
+
/** Start a fresh session once the last reported context use reaches this share of the window. Default 0.5. */
|
|
115
|
+
maxContextRatio: z.number().gt(0).max(1).optional(),
|
|
116
|
+
});
|
|
117
|
+
export const SessionRuntimeConfigSchema = z.object({
|
|
118
|
+
maxQueuedTurns: z.number().int().min(1).max(1_000).default(100),
|
|
119
|
+
autoRotate: SessionAutoRotateConfigSchema.optional(),
|
|
120
|
+
});
|
|
121
|
+
export const OrchestrationConfigSchema = z.object({
|
|
122
|
+
projectCatalog: ProjectCatalogConfigSchema.optional(),
|
|
123
|
+
mcpServers: z.record(McpServerConfigSchema).optional(),
|
|
124
|
+
session: SessionRuntimeConfigSchema.optional(),
|
|
125
|
+
});
|
|
126
|
+
export const ConfigSchema = z.object({
|
|
127
|
+
feishu: z.object({
|
|
128
|
+
domain: z.string().url().default("https://open.feishu.cn"),
|
|
129
|
+
appId: z.string().min(1),
|
|
130
|
+
appSecret: z.string().min(1),
|
|
131
|
+
policy: FeishuPolicySchema.optional(),
|
|
132
|
+
alertMonitor: z.object({
|
|
133
|
+
enabled: z.boolean().optional(),
|
|
134
|
+
pollIntervalMs: z.number().int().min(5_000).max(300_000).default(30_000),
|
|
135
|
+
lookbackMs: z.number().int().min(1_000).max(86_400_000).default(600_000),
|
|
136
|
+
dedupWindowMs: z.number().int().min(1_000).max(86_400_000).default(1_800_000),
|
|
137
|
+
maxConcurrent: z.number().int().min(1).max(10).default(2),
|
|
138
|
+
/** Terminal incidents older than this leave the state file and stop shaping their thread. */
|
|
139
|
+
incidentRetentionMs: z.number().int().min(3_600_000).max(90 * 86_400_000).default(7 * 86_400_000),
|
|
140
|
+
statusReactions: z.object({
|
|
141
|
+
investigating: z.string().min(1), waiting: z.string().min(1), resolved: z.string().min(1),
|
|
142
|
+
no_action: z.string().min(1), blocked: z.string().min(1),
|
|
143
|
+
}).refine((mapping) => new Set(Object.values(mapping)).size === 5, "Alert statuses need distinct reactions").optional(),
|
|
144
|
+
groups: z.array(z.object({
|
|
145
|
+
chatId: z.string().regex(/^oc_/),
|
|
146
|
+
senderAppIds: z.array(z.string().min(1)).min(1),
|
|
147
|
+
/** Deprecated alias for a single approver; kept so existing configs load. */
|
|
148
|
+
ownerOpenId: z.string().regex(/^ou_/).optional(),
|
|
149
|
+
/** People who can authorize write actions. Anyone in the group can chat, close or reopen. */
|
|
150
|
+
approverOpenIds: z.array(z.string().regex(/^ou_/)).optional(),
|
|
151
|
+
runbookPath: z.string().min(1).optional(),
|
|
152
|
+
}).refine((group) => (group.approverOpenIds?.length ?? 0) > 0 || Boolean(group.ownerOpenId), "Alert group needs at least one approver")).min(1).refine((groups) => new Set(groups.map((group) => group.chatId)).size === groups.length, "Duplicate alert group"),
|
|
153
|
+
}).optional(),
|
|
154
|
+
}),
|
|
155
|
+
telegram: z
|
|
156
|
+
.object({
|
|
157
|
+
botToken: z.string().min(1),
|
|
158
|
+
allowedUsers: z.array(z.string()).optional(),
|
|
159
|
+
allowedChats: z.array(z.string()).optional(),
|
|
160
|
+
pollingTimeoutSec: z.number().int().min(1).max(50).default(25),
|
|
161
|
+
})
|
|
162
|
+
.optional(),
|
|
163
|
+
runner: z.object({
|
|
164
|
+
url: z.string().url().default("http://127.0.0.1:19789"),
|
|
165
|
+
token: z.string().min(8),
|
|
166
|
+
}),
|
|
167
|
+
web: z
|
|
168
|
+
.object({
|
|
169
|
+
/** The Web surface is opt-in; channels and Core API remain independent. */
|
|
170
|
+
enabled: z.boolean().default(false),
|
|
171
|
+
/** Optional absolute path to the built React application. */
|
|
172
|
+
staticDirectory: z.string().min(1).optional(),
|
|
173
|
+
})
|
|
174
|
+
.default({ enabled: false }),
|
|
175
|
+
defaultAgent: z.string().min(1).optional(),
|
|
176
|
+
defaultBackend: z.enum(SUPPORTED_AGENT_IDS).default("cursor"),
|
|
177
|
+
backends: z.record(BackendProfileSchema).transform(mergeDefaultBackends),
|
|
178
|
+
access: AccessConfigSchema.optional(),
|
|
179
|
+
workspaces: WorkspacesConfigSchema.optional(),
|
|
180
|
+
orchestration: OrchestrationConfigSchema.optional(),
|
|
181
|
+
runnerHost: z
|
|
182
|
+
.object({
|
|
183
|
+
listen: z.string().default("127.0.0.1:19789"),
|
|
184
|
+
maxConcurrentRuns: z.number().int().positive().default(4),
|
|
185
|
+
/** auto_allow=全放行;prompt_deny=一律拒绝;prompt_feishu=在飞书里等 /approve /deny(超时拒绝) */
|
|
186
|
+
acpPermissionPolicy: z
|
|
187
|
+
.enum(["auto_allow", "prompt_deny", "prompt_feishu"])
|
|
188
|
+
.default("auto_allow"),
|
|
189
|
+
/** 一轮无结束信号的总超时(ms);长任务可运行 6 小时,和停滞检测分开 */
|
|
190
|
+
acpPromptTimeoutMs: z
|
|
191
|
+
.number()
|
|
192
|
+
.int()
|
|
193
|
+
.positive()
|
|
194
|
+
.default(6 * 60 * 60_000),
|
|
195
|
+
/** 从发 prompt 起完全无任何输出的超时(ms) */
|
|
196
|
+
acpNoOutputTimeoutMs: z
|
|
197
|
+
.number()
|
|
198
|
+
.int()
|
|
199
|
+
.positive()
|
|
200
|
+
.default(10 * 60_000),
|
|
201
|
+
/** 已有输出后无新事件的 stall 超时(ms),到点判 fatal(疑似工具卡死) */
|
|
202
|
+
acpStallTimeoutMs: z
|
|
203
|
+
.number()
|
|
204
|
+
.int()
|
|
205
|
+
.positive()
|
|
206
|
+
.default(30 * 60_000),
|
|
207
|
+
/** 主轮 stop 后续读后台子 agent 输出(drain)总开关 */
|
|
208
|
+
acpDrainBackgroundWork: z.boolean().default(true),
|
|
209
|
+
/** drain probe 短窗:主轮 stop 后这么久无真实后台活动则判无后台(ms) */
|
|
210
|
+
acpPostStopProbeMs: z.number().int().positive().default(8_000),
|
|
211
|
+
/** drain quiet 长窗:确认有后台后这么久无新活动视为后台结束(ms) */
|
|
212
|
+
acpPostStopQuietMs: z.number().int().positive().default(75_000),
|
|
213
|
+
/** drain 独立硬上限:后台跑这么久仍未结束则停止跟踪(ms) */
|
|
214
|
+
acpPostStopMaxMs: z.number().int().positive().default(20 * 60_000),
|
|
215
|
+
/** 长驻会话池总开关:同会话消息复用适配器进程,省每轮 2-4s 冷启动 */
|
|
216
|
+
acpSessionPool: z.boolean().default(true),
|
|
217
|
+
/** 池内空闲会话进程的回收时限(ms) */
|
|
218
|
+
acpSessionIdleMs: z
|
|
219
|
+
.number()
|
|
220
|
+
.int()
|
|
221
|
+
.positive()
|
|
222
|
+
.default(10 * 60_000),
|
|
223
|
+
/** 池内最多保留多少个空闲会话进程 */
|
|
224
|
+
acpSessionPoolMax: z.number().int().positive().default(4),
|
|
225
|
+
})
|
|
226
|
+
.optional(),
|
|
227
|
+
/** Bridge 本地出站 API(供 Agent 内的 fcb 命令把文件/消息发回飞书) */
|
|
228
|
+
bridge: z
|
|
229
|
+
.object({
|
|
230
|
+
apiPort: z.number().int().positive().default(19790),
|
|
231
|
+
})
|
|
232
|
+
.optional(),
|
|
233
|
+
});
|
|
234
|
+
/** Web 设置页的 defaultAgent 优先;没有再回退到 defaultBackend。 */
|
|
235
|
+
export function resolveDefaultAgentId(config) {
|
|
236
|
+
const preferred = config.defaultAgent?.trim();
|
|
237
|
+
if (preferred && config.backends[preferred])
|
|
238
|
+
return preferred;
|
|
239
|
+
if (config.defaultBackend && config.backends[config.defaultBackend]) {
|
|
240
|
+
return config.defaultBackend;
|
|
241
|
+
}
|
|
242
|
+
for (const id of SUPPORTED_AGENT_IDS) {
|
|
243
|
+
if (config.backends[id])
|
|
244
|
+
return id;
|
|
245
|
+
}
|
|
246
|
+
return Object.keys(config.backends)[0] ?? "cursor";
|
|
247
|
+
}
|
|
248
|
+
export function isSupportedAgentId(id) {
|
|
249
|
+
return SUPPORTED_AGENT_IDS.includes(id);
|
|
250
|
+
}
|
|
251
|
+
export function defaultConfig() {
|
|
252
|
+
return ConfigSchema.parse({
|
|
253
|
+
feishu: {
|
|
254
|
+
domain: "https://open.feishu.cn",
|
|
255
|
+
appId: "cli_placeholder",
|
|
256
|
+
appSecret: "secret_placeholder",
|
|
257
|
+
policy: {
|
|
258
|
+
requireMention: true,
|
|
259
|
+
dmMode: "open",
|
|
260
|
+
respondToMentionAll: false,
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
runner: {
|
|
264
|
+
url: "http://127.0.0.1:19789",
|
|
265
|
+
token: "change-me-runner-token",
|
|
266
|
+
},
|
|
267
|
+
web: {
|
|
268
|
+
enabled: false,
|
|
269
|
+
},
|
|
270
|
+
defaultAgent: undefined,
|
|
271
|
+
defaultBackend: "cursor",
|
|
272
|
+
backends: DEFAULT_BACKEND_PROFILES,
|
|
273
|
+
workspaces: {
|
|
274
|
+
root: `${process.env.HOME ?? ""}/Projects`,
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
/** Resolve effective requireMention for a chat (scenarios override global). */
|
|
279
|
+
export function resolveRequireMention(policy, chatId) {
|
|
280
|
+
const base = policy?.requireMention ?? true;
|
|
281
|
+
if (!policy?.scenarios?.length)
|
|
282
|
+
return base;
|
|
283
|
+
for (const scenario of policy.scenarios) {
|
|
284
|
+
if (!scenario.chats.includes(chatId))
|
|
285
|
+
continue;
|
|
286
|
+
if (scenario.enabled === false)
|
|
287
|
+
return false;
|
|
288
|
+
if (scenario.requireMention !== undefined)
|
|
289
|
+
return scenario.requireMention;
|
|
290
|
+
}
|
|
291
|
+
return base;
|
|
292
|
+
}
|
|
293
|
+
//# sourceMappingURL=config-schema.js.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type AppConfig } from "./config-schema.js";
|
|
2
|
+
import { type SecretOptions, type SecretSource } from "./secret-refs.js";
|
|
3
|
+
export interface ConfigStoreOptions {
|
|
4
|
+
dataDir?: string;
|
|
5
|
+
configFileName?: string;
|
|
6
|
+
secrets?: SecretOptions;
|
|
7
|
+
/**
|
|
8
|
+
* Secret fields to resolve (e.g. ["runner.token"] for the Runner). Others keep their
|
|
9
|
+
* ref text, so a process never fails on a secret it does not use. Default: all.
|
|
10
|
+
*/
|
|
11
|
+
resolve?: readonly string[];
|
|
12
|
+
}
|
|
13
|
+
export interface SecretInspection {
|
|
14
|
+
source: SecretSource;
|
|
15
|
+
/** Whether the value (ref or env override) can be read right now. */
|
|
16
|
+
readable: boolean;
|
|
17
|
+
error?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare class ConfigStore {
|
|
20
|
+
private config;
|
|
21
|
+
private readonly configPath;
|
|
22
|
+
private readonly secretOptions;
|
|
23
|
+
private secrets;
|
|
24
|
+
private listeners;
|
|
25
|
+
constructor(options?: ConfigStoreOptions);
|
|
26
|
+
private readonly resolveFields?;
|
|
27
|
+
/**
|
|
28
|
+
* Per-field secret report that never throws, for doctor/status: a broken ref is a
|
|
29
|
+
* finding to show, not a reason to crash the diagnostic.
|
|
30
|
+
*/
|
|
31
|
+
static inspectSecrets(configPath: string, options?: SecretOptions): Record<string, SecretInspection>;
|
|
32
|
+
/** Where each secret field comes from, as written on disk (no values). */
|
|
33
|
+
secretSources(): Record<string, SecretSource>;
|
|
34
|
+
/** The on-disk value of a secret field: a ref when one is configured. */
|
|
35
|
+
diskSecret(name: string): unknown;
|
|
36
|
+
get path(): string;
|
|
37
|
+
get(): AppConfig;
|
|
38
|
+
reload(): AppConfig;
|
|
39
|
+
save(partial: Partial<AppConfig>): AppConfig;
|
|
40
|
+
update(mutator: (current: AppConfig) => AppConfig): AppConfig;
|
|
41
|
+
onChange(listener: (config: AppConfig) => void): () => void;
|
|
42
|
+
private notify;
|
|
43
|
+
private persist;
|
|
44
|
+
private loadFromDisk;
|
|
45
|
+
private recordSecrets;
|
|
46
|
+
private loadFromEnv;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=config-store.d.ts.map
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
|
|
4
|
+
import { ConfigSchema, defaultConfig, } from "./config-schema.js";
|
|
5
|
+
import { DEFAULT_DATA_DIR } from "./types.js";
|
|
6
|
+
import { SECRET_ENV_VARS, SECRET_PATHS, getPath, isSecretRef, resolveSecretRef, secretPathName, secretSourceOf, setPath, } from "./secret-refs.js";
|
|
7
|
+
export class ConfigStore {
|
|
8
|
+
config;
|
|
9
|
+
configPath;
|
|
10
|
+
secretOptions;
|
|
11
|
+
secrets = new Map();
|
|
12
|
+
listeners = [];
|
|
13
|
+
constructor(options = {}) {
|
|
14
|
+
const dataDir = options.dataDir ?? process.env.DATA_DIR ?? DEFAULT_DATA_DIR;
|
|
15
|
+
this.configPath = path.join(dataDir, options.configFileName ?? "config.yaml");
|
|
16
|
+
this.secretOptions = options.secrets ?? {};
|
|
17
|
+
this.resolveFields = options.resolve;
|
|
18
|
+
this.config = this.loadFromDisk();
|
|
19
|
+
}
|
|
20
|
+
resolveFields;
|
|
21
|
+
/**
|
|
22
|
+
* Per-field secret report that never throws, for doctor/status: a broken ref is a
|
|
23
|
+
* finding to show, not a reason to crash the diagnostic.
|
|
24
|
+
*/
|
|
25
|
+
static inspectSecrets(configPath, options = {}) {
|
|
26
|
+
const parsed = fs.existsSync(configPath)
|
|
27
|
+
? (parseYaml(fs.readFileSync(configPath, "utf8")) ?? {})
|
|
28
|
+
: {};
|
|
29
|
+
const env = options.env ?? process.env;
|
|
30
|
+
return Object.fromEntries(SECRET_PATHS.map((secretPath) => {
|
|
31
|
+
const name = secretPathName(secretPath);
|
|
32
|
+
const value = getPath(parsed, secretPath);
|
|
33
|
+
const inspection = { source: secretSourceOf(value), readable: true };
|
|
34
|
+
if (env[SECRET_ENV_VARS[name]])
|
|
35
|
+
return [name, inspection];
|
|
36
|
+
if (isSecretRef(value)) {
|
|
37
|
+
try {
|
|
38
|
+
resolveSecretRef(value, options);
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
inspection.readable = false;
|
|
42
|
+
inspection.error = error instanceof Error ? error.message : String(error);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else if (inspection.source === "missing") {
|
|
46
|
+
inspection.readable = false;
|
|
47
|
+
}
|
|
48
|
+
return [name, inspection];
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
/** Where each secret field comes from, as written on disk (no values). */
|
|
52
|
+
secretSources() {
|
|
53
|
+
return Object.fromEntries(SECRET_PATHS.map((secretPath) => {
|
|
54
|
+
const entry = this.secrets.get(secretPathName(secretPath));
|
|
55
|
+
return [secretPathName(secretPath), secretSourceOf(entry?.disk)];
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
/** The on-disk value of a secret field: a ref when one is configured. */
|
|
59
|
+
diskSecret(name) {
|
|
60
|
+
return this.secrets.get(name)?.disk;
|
|
61
|
+
}
|
|
62
|
+
get path() {
|
|
63
|
+
return this.configPath;
|
|
64
|
+
}
|
|
65
|
+
get() {
|
|
66
|
+
return this.config;
|
|
67
|
+
}
|
|
68
|
+
reload() {
|
|
69
|
+
this.config = this.loadFromDisk();
|
|
70
|
+
this.notify();
|
|
71
|
+
return this.config;
|
|
72
|
+
}
|
|
73
|
+
save(partial) {
|
|
74
|
+
this.config = ConfigSchema.parse({ ...this.config, ...partial });
|
|
75
|
+
this.persist();
|
|
76
|
+
this.notify();
|
|
77
|
+
return this.config;
|
|
78
|
+
}
|
|
79
|
+
update(mutator) {
|
|
80
|
+
this.config = ConfigSchema.parse(mutator(this.config));
|
|
81
|
+
this.persist();
|
|
82
|
+
this.notify();
|
|
83
|
+
return this.config;
|
|
84
|
+
}
|
|
85
|
+
onChange(listener) {
|
|
86
|
+
this.listeners.push(listener);
|
|
87
|
+
return () => {
|
|
88
|
+
this.listeners = this.listeners.filter((l) => l !== listener);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
notify() {
|
|
92
|
+
for (const l of this.listeners)
|
|
93
|
+
l(this.config);
|
|
94
|
+
}
|
|
95
|
+
persist() {
|
|
96
|
+
const dir = path.dirname(this.configPath);
|
|
97
|
+
if (!fs.existsSync(dir))
|
|
98
|
+
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
99
|
+
const existed = fs.existsSync(this.configPath);
|
|
100
|
+
const output = structuredClone(this.config);
|
|
101
|
+
for (const secretPath of SECRET_PATHS) {
|
|
102
|
+
const name = secretPathName(secretPath);
|
|
103
|
+
const entry = this.secrets.get(name);
|
|
104
|
+
const current = getPath(output, secretPath);
|
|
105
|
+
if (entry?.external && current === entry.loaded) {
|
|
106
|
+
// Unchanged value from a ref or env: write back what was on disk, never the secret.
|
|
107
|
+
// Env-only values become an env: ref so the file still loads where that env is set.
|
|
108
|
+
setPath(output, secretPath, entry.disk ?? (entry.envVar ? `env:${entry.envVar}` : undefined));
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
this.secrets.set(name, { disk: current, loaded: current, external: false });
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
fs.writeFileSync(this.configPath, stringifyYaml(output), {
|
|
115
|
+
encoding: "utf8",
|
|
116
|
+
mode: 0o600,
|
|
117
|
+
});
|
|
118
|
+
// writeFileSync's `mode` only applies when creating the file, so an
|
|
119
|
+
// already-existing config.yaml keeps its prior permissions unless
|
|
120
|
+
// explicitly tightened here.
|
|
121
|
+
if (existed)
|
|
122
|
+
fs.chmodSync(this.configPath, 0o600);
|
|
123
|
+
}
|
|
124
|
+
loadFromDisk() {
|
|
125
|
+
const fromEnv = this.loadFromEnv();
|
|
126
|
+
if (!fs.existsSync(this.configPath)) {
|
|
127
|
+
const config = Object.keys(fromEnv).length > 0
|
|
128
|
+
? ConfigSchema.parse(deepMerge(defaultConfig(), fromEnv))
|
|
129
|
+
: defaultConfig();
|
|
130
|
+
this.recordSecrets(new Map(), fromEnv, config);
|
|
131
|
+
return config;
|
|
132
|
+
}
|
|
133
|
+
const raw = fs.readFileSync(this.configPath, "utf8");
|
|
134
|
+
const parsed = (parseYaml(raw) ?? {});
|
|
135
|
+
const disk = new Map(SECRET_PATHS.map((secretPath) => [secretPathName(secretPath), getPath(parsed, secretPath)]));
|
|
136
|
+
const resolved = structuredClone(parsed);
|
|
137
|
+
for (const secretPath of SECRET_PATHS) {
|
|
138
|
+
const value = getPath(resolved, secretPath);
|
|
139
|
+
const wanted = !this.resolveFields || this.resolveFields.includes(secretPathName(secretPath));
|
|
140
|
+
// An env override wins anyway; do not fail on a ref it replaces.
|
|
141
|
+
if (isSecretRef(value) && wanted && getPath(fromEnv, secretPath) === undefined) {
|
|
142
|
+
setPath(resolved, secretPath, resolveSecretRef(value, this.secretOptions));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const config = ConfigSchema.parse(deepMerge(resolved, fromEnv));
|
|
146
|
+
this.recordSecrets(disk, fromEnv, config);
|
|
147
|
+
return config;
|
|
148
|
+
}
|
|
149
|
+
recordSecrets(disk, fromEnv, config) {
|
|
150
|
+
this.secrets = new Map(SECRET_PATHS.map((secretPath) => {
|
|
151
|
+
const name = secretPathName(secretPath);
|
|
152
|
+
const onDisk = disk.get(name);
|
|
153
|
+
const fromEnvValue = getPath(fromEnv, secretPath) !== undefined;
|
|
154
|
+
return [name, {
|
|
155
|
+
disk: onDisk,
|
|
156
|
+
envVar: fromEnvValue ? SECRET_ENV_VARS[name] : undefined,
|
|
157
|
+
loaded: getPath(config, secretPath),
|
|
158
|
+
external: isSecretRef(onDisk) || fromEnvValue,
|
|
159
|
+
}];
|
|
160
|
+
}));
|
|
161
|
+
}
|
|
162
|
+
loadFromEnv() {
|
|
163
|
+
const result = {};
|
|
164
|
+
if (process.env.FEISHU_APP_ID || process.env.FEISHU_APP_SECRET) {
|
|
165
|
+
result.feishu = {
|
|
166
|
+
domain: process.env.FEISHU_DOMAIN ?? "https://open.feishu.cn",
|
|
167
|
+
appId: process.env.FEISHU_APP_ID,
|
|
168
|
+
appSecret: process.env.FEISHU_APP_SECRET,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
if (process.env.RUNNER_URL || process.env.RUNNER_TOKEN) {
|
|
172
|
+
result.runner = {
|
|
173
|
+
url: process.env.RUNNER_URL ?? "http://127.0.0.1:19789",
|
|
174
|
+
token: process.env.RUNNER_TOKEN,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
if (process.env.TELEGRAM_BOT_TOKEN) {
|
|
178
|
+
result.telegram = {
|
|
179
|
+
botToken: process.env.TELEGRAM_BOT_TOKEN,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
if (process.env.DEFAULT_BACKEND) {
|
|
183
|
+
result.defaultBackend = process.env.DEFAULT_BACKEND;
|
|
184
|
+
}
|
|
185
|
+
return result;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function deepMerge(base, override) {
|
|
189
|
+
const out = { ...base };
|
|
190
|
+
for (const [key, value] of Object.entries(override)) {
|
|
191
|
+
if (value &&
|
|
192
|
+
typeof value === "object" &&
|
|
193
|
+
!Array.isArray(value) &&
|
|
194
|
+
typeof out[key] === "object" &&
|
|
195
|
+
out[key] !== null &&
|
|
196
|
+
!Array.isArray(out[key])) {
|
|
197
|
+
// Skip undefined: RUNNER_URL alone must not blank a runner.token from disk.
|
|
198
|
+
const defined = Object.fromEntries(Object.entries(value).filter(([, v]) => v !== undefined));
|
|
199
|
+
out[key] = { ...out[key], ...defined };
|
|
200
|
+
}
|
|
201
|
+
else if (value !== undefined) {
|
|
202
|
+
out[key] = value;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return out;
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=config-store.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export * from "./session-event-wire.js";
|
|
3
|
+
export * from "./workspace-key.js";
|
|
4
|
+
export * from "./config-schema.js";
|
|
5
|
+
export * from "./config-store.js";
|
|
6
|
+
export * from "./secret-refs.js";
|
|
7
|
+
export * from "./secret-migration.js";
|
|
8
|
+
export * from "./json-file-store.js";
|
|
9
|
+
export * from "./mentions.js";
|
|
10
|
+
export type { StdioMcpServerConfig } from "./mcp-types.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export * from "./session-event-wire.js";
|
|
3
|
+
export * from "./workspace-key.js";
|
|
4
|
+
export * from "./config-schema.js";
|
|
5
|
+
export * from "./config-store.js";
|
|
6
|
+
export * from "./secret-refs.js";
|
|
7
|
+
export * from "./secret-migration.js";
|
|
8
|
+
export * from "./json-file-store.js";
|
|
9
|
+
export * from "./mentions.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare class JsonFileStore<T> {
|
|
2
|
+
private readonly filePath;
|
|
3
|
+
constructor(filePath: string);
|
|
4
|
+
read(): T;
|
|
5
|
+
write(data: T): void;
|
|
6
|
+
update(mutator: (current: T) => T): T;
|
|
7
|
+
protected defaultValue(): T;
|
|
8
|
+
}
|
|
9
|
+
export declare class JsonMapStore<V> extends JsonFileStore<Record<string, V>> {
|
|
10
|
+
protected defaultValue(): Record<string, V>;
|
|
11
|
+
}
|
|
12
|
+
export declare class JsonArrayStore<V> extends JsonFileStore<V[]> {
|
|
13
|
+
protected defaultValue(): V[];
|
|
14
|
+
}
|
|
15
|
+
export declare function appendJsonl(filePath: string, record: unknown): void;
|
|
16
|
+
//# sourceMappingURL=json-file-store.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
export class JsonFileStore {
|
|
4
|
+
filePath;
|
|
5
|
+
constructor(filePath) {
|
|
6
|
+
this.filePath = filePath;
|
|
7
|
+
}
|
|
8
|
+
read() {
|
|
9
|
+
if (!fs.existsSync(this.filePath)) {
|
|
10
|
+
return this.defaultValue();
|
|
11
|
+
}
|
|
12
|
+
const raw = fs.readFileSync(this.filePath, "utf8");
|
|
13
|
+
return JSON.parse(raw);
|
|
14
|
+
}
|
|
15
|
+
write(data) {
|
|
16
|
+
const dir = path.dirname(this.filePath);
|
|
17
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
18
|
+
const tmp = `${this.filePath}.tmp`;
|
|
19
|
+
fs.writeFileSync(tmp, JSON.stringify(data, null, 2), "utf8");
|
|
20
|
+
fs.renameSync(tmp, this.filePath);
|
|
21
|
+
}
|
|
22
|
+
update(mutator) {
|
|
23
|
+
const next = mutator(this.read());
|
|
24
|
+
this.write(next);
|
|
25
|
+
return next;
|
|
26
|
+
}
|
|
27
|
+
defaultValue() {
|
|
28
|
+
throw new Error("JsonFileStore requires override of defaultValue()");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export class JsonMapStore extends JsonFileStore {
|
|
32
|
+
defaultValue() {
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export class JsonArrayStore extends JsonFileStore {
|
|
37
|
+
defaultValue() {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export function appendJsonl(filePath, record) {
|
|
42
|
+
const dir = path.dirname(filePath);
|
|
43
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
44
|
+
fs.appendFileSync(filePath, `${JSON.stringify(record)}\n`, "utf8");
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=json-file-store.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type MentionTargetKind = "user" | "bot";
|
|
2
|
+
export interface MentionScope {
|
|
3
|
+
chatId: string;
|
|
4
|
+
topicId?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface MentionTarget {
|
|
7
|
+
channel: string;
|
|
8
|
+
kind: MentionTargetKind;
|
|
9
|
+
id: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
username?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface RegisteredMentionTarget extends MentionTarget {
|
|
14
|
+
ref: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class MentionRegistry {
|
|
17
|
+
private readonly targetByKey;
|
|
18
|
+
private readonly targetByRef;
|
|
19
|
+
private readonly refsByScope;
|
|
20
|
+
private nextUserRef;
|
|
21
|
+
private nextBotRef;
|
|
22
|
+
private readonly store?;
|
|
23
|
+
constructor(filePath?: string);
|
|
24
|
+
register(scope: MentionScope, target: MentionTarget): RegisteredMentionTarget;
|
|
25
|
+
/** Drop stored names that are really labels (e.g. a role written by an older version). Returns how many were cleared. */
|
|
26
|
+
forgetNames(names: readonly string[]): number;
|
|
27
|
+
private save;
|
|
28
|
+
resolve(scope: MentionScope, ref: string): RegisteredMentionTarget | undefined;
|
|
29
|
+
list(scope: MentionScope): RegisteredMentionTarget[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* `roles` labels a target for this prompt only (e.g. an alert approver).
|
|
33
|
+
* Roles are never stored as the target's name: the registry is shared across chats.
|
|
34
|
+
*/
|
|
35
|
+
export declare function formatMentionGuidance(targets: RegisteredMentionTarget[], requesterRef?: string, roles?: Record<string, string>): string;
|
|
36
|
+
//# sourceMappingURL=mentions.d.ts.map
|