@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,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@codebridge/backends",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@agentclientprotocol/sdk": "1.3.0",
|
|
16
|
+
"@codebridge/core": "0.1.0",
|
|
17
|
+
"@codebridge/session-catalog": "0.1.0",
|
|
18
|
+
"@earendil-works/pi-ai": "0.87.1",
|
|
19
|
+
"@earendil-works/pi-coding-agent": "0.87.1",
|
|
20
|
+
"zod": "3.25.76"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FeishuAlertMessage } from "@codebridge/channel-feishu";
|
|
2
|
+
export interface AlertNotificationRule {
|
|
3
|
+
id: string;
|
|
4
|
+
kind: "notification";
|
|
5
|
+
verified: true;
|
|
6
|
+
senderAppIds: string[];
|
|
7
|
+
title: string;
|
|
8
|
+
bodyIncludes: string[];
|
|
9
|
+
summary: string;
|
|
10
|
+
evidence: string;
|
|
11
|
+
}
|
|
12
|
+
/** Only a unique, explicitly verified notification rule may merge different business entities. */
|
|
13
|
+
export declare function matchAlertNotificationRule(runbookPath: string | undefined, message: FeishuAlertMessage): AlertNotificationRule | undefined;
|
|
14
|
+
//# sourceMappingURL=alert-notification-rules.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
/** Only a unique, explicitly verified notification rule may merge different business entities. */
|
|
4
|
+
export function matchAlertNotificationRule(runbookPath, message) {
|
|
5
|
+
if (!runbookPath)
|
|
6
|
+
return undefined;
|
|
7
|
+
const file = path.join(path.dirname(runbookPath), "references", "notification-rules.json");
|
|
8
|
+
let raw;
|
|
9
|
+
try {
|
|
10
|
+
raw = fs.readFileSync(file, "utf8");
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
if (error.code === "ENOENT")
|
|
14
|
+
return undefined;
|
|
15
|
+
throw error;
|
|
16
|
+
}
|
|
17
|
+
if (Buffer.byteLength(raw) > 64_000)
|
|
18
|
+
throw new Error("Notification rules too large");
|
|
19
|
+
const parsed = JSON.parse(raw);
|
|
20
|
+
if (!Array.isArray(parsed.rules))
|
|
21
|
+
throw new Error("Invalid notification rules");
|
|
22
|
+
const matches = parsed.rules.filter((value) => {
|
|
23
|
+
if (!value || typeof value !== "object")
|
|
24
|
+
return false;
|
|
25
|
+
const rule = value;
|
|
26
|
+
return rule.kind === "notification" && rule.verified === true
|
|
27
|
+
&& typeof rule.id === "string" && Boolean(rule.id.trim())
|
|
28
|
+
&& typeof rule.evidence === "string" && Boolean(rule.evidence.trim())
|
|
29
|
+
&& typeof rule.summary === "string" && Boolean(rule.summary.trim()) && rule.summary.length <= 2000
|
|
30
|
+
&& Array.isArray(rule.senderAppIds) && rule.senderAppIds.includes(message.senderId)
|
|
31
|
+
&& typeof rule.title === "string" && Boolean(rule.title.trim()) && message.content.split("\n")[0]?.trim() === rule.title
|
|
32
|
+
&& Array.isArray(rule.bodyIncludes) && rule.bodyIncludes.length > 0
|
|
33
|
+
&& rule.bodyIncludes.every((part) => typeof part === "string" && Boolean(part.trim()) && message.content.split("\n").some((line) => line.trim() === part.trim()));
|
|
34
|
+
});
|
|
35
|
+
return matches.length === 1 ? matches[0] : undefined;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=alert-notification-rules.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function hasFeishuCredentials(config) {
|
|
2
|
+
return (config.feishu?.appId !== undefined &&
|
|
3
|
+
config.feishu.appId !== "cli_placeholder" &&
|
|
4
|
+
config.feishu.appSecret !== "secret_placeholder");
|
|
5
|
+
}
|
|
6
|
+
export function hasTelegramCredentials(config) {
|
|
7
|
+
return Boolean(config.telegram?.botToken);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=channel-config.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ChannelSessionIngress } from "@codebridge/core";
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
export declare function createChannelIngressApi(sessionApp: Hono): Hono;
|
|
4
|
+
export declare function createChannelSessionIngress(app: Hono, token: string): ChannelSessionIngress;
|
|
5
|
+
//# sourceMappingURL=channel-ingress.d.ts.map
|
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
import { parseSessionEventWire } from "@codebridge/core/session-event-wire";
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
function toChannelSessionEvent(input) {
|
|
4
|
+
const event = parseSessionEventWire(input);
|
|
5
|
+
return {
|
|
6
|
+
type: event.type,
|
|
7
|
+
sequence: event.sequence,
|
|
8
|
+
runId: event.run_id,
|
|
9
|
+
executionKind: event.execution_kind,
|
|
10
|
+
occurredAt: event.occurred_at,
|
|
11
|
+
target: event.target,
|
|
12
|
+
resultRef: event.result_ref,
|
|
13
|
+
payload: event.payload,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function requireSessionEventContentType(response, expected) {
|
|
17
|
+
const actual = response.headers.get("content-type")?.toLowerCase() ?? "";
|
|
18
|
+
if (!actual.includes(expected)) {
|
|
19
|
+
throw new Error("session_event_transport_mismatch");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export function createChannelIngressApi(sessionApp) {
|
|
23
|
+
const app = new Hono();
|
|
24
|
+
app.route("/", sessionApp);
|
|
25
|
+
return app;
|
|
26
|
+
}
|
|
27
|
+
export function createChannelSessionIngress(app, token) {
|
|
28
|
+
const auth = { authorization: `Bearer ${token}` };
|
|
29
|
+
const readRuntimeVersion = async (sessionId) => {
|
|
30
|
+
const response = await app.request(`/v1/sessions/${encodeURIComponent(sessionId)}`, { headers: auth });
|
|
31
|
+
if (!response.ok) {
|
|
32
|
+
throw new Error(`read runtime failed (${response.status}): ${await response.text()}`);
|
|
33
|
+
}
|
|
34
|
+
const body = await response.json();
|
|
35
|
+
if (typeof body.runtime?.version !== "number") {
|
|
36
|
+
throw new Error("runtime version missing in snapshot");
|
|
37
|
+
}
|
|
38
|
+
return body.runtime.version;
|
|
39
|
+
};
|
|
40
|
+
const submit = async (message) => {
|
|
41
|
+
if ((message.replyToMessageId === undefined)
|
|
42
|
+
!== (message.showThinking === undefined)) {
|
|
43
|
+
throw new Error("channel_delivery_incomplete");
|
|
44
|
+
}
|
|
45
|
+
const accepted = await app.request(`/v1/channels/${encodeURIComponent(message.channel)}/conversations/${encodeURIComponent(message.conversationId)}/messages`, {
|
|
46
|
+
method: "POST",
|
|
47
|
+
headers: {
|
|
48
|
+
...auth,
|
|
49
|
+
"content-type": "application/json",
|
|
50
|
+
...(message.idempotencyKey
|
|
51
|
+
? { "idempotency-key": message.idempotencyKey }
|
|
52
|
+
: {}),
|
|
53
|
+
},
|
|
54
|
+
body: JSON.stringify({
|
|
55
|
+
message: message.message,
|
|
56
|
+
agent_id: message.agentId,
|
|
57
|
+
cwd: message.cwd,
|
|
58
|
+
model: message.model,
|
|
59
|
+
...(message.inputs !== undefined ? { inputs: message.inputs } : {}),
|
|
60
|
+
...(message.actorRef !== undefined ? { actor_ref: message.actorRef } : {}),
|
|
61
|
+
generation: message.generation,
|
|
62
|
+
reply_to_message_id: message.replyToMessageId,
|
|
63
|
+
show_thinking: message.showThinking,
|
|
64
|
+
attachments: message.attachments?.map((attachment) => ({
|
|
65
|
+
name: attachment.name,
|
|
66
|
+
mime_type: attachment.mimeType,
|
|
67
|
+
data_base64: attachment.dataBase64,
|
|
68
|
+
})),
|
|
69
|
+
}),
|
|
70
|
+
});
|
|
71
|
+
if (!accepted.ok) {
|
|
72
|
+
throw new Error(`Channel submit failed (${accepted.status}): ${await accepted.text()}`);
|
|
73
|
+
}
|
|
74
|
+
const result = await accepted.json();
|
|
75
|
+
return {
|
|
76
|
+
sessionId: result.session_id,
|
|
77
|
+
turnId: result.turn_id,
|
|
78
|
+
runId: result.run_id,
|
|
79
|
+
acceptance: result.acceptance,
|
|
80
|
+
queueState: result.queue_state,
|
|
81
|
+
eventSequence: result.event_sequence,
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
const listRuntimeApprovals = async (runId) => {
|
|
85
|
+
const response = await app.request(`/v1/runs/${encodeURIComponent(runId)}/approvals`, { headers: auth });
|
|
86
|
+
if (!response.ok) {
|
|
87
|
+
throw new Error(`list Runtime approvals failed (${response.status}): ${await response.text()}`);
|
|
88
|
+
}
|
|
89
|
+
const body = await response.json();
|
|
90
|
+
return body.approvals.map(toChannelRuntimeApproval);
|
|
91
|
+
};
|
|
92
|
+
const resolveRuntimeApproval = async (runId, approvalId, decision) => {
|
|
93
|
+
const response = await app.request(`/v1/runs/${encodeURIComponent(runId)}/${decision}`, {
|
|
94
|
+
method: "POST",
|
|
95
|
+
headers: { ...auth, "content-type": "application/json" },
|
|
96
|
+
body: JSON.stringify({ approval_id: approvalId }),
|
|
97
|
+
});
|
|
98
|
+
if (!response.ok) {
|
|
99
|
+
throw new Error(`resolve Runtime approval failed (${response.status}): ${await response.text()}`);
|
|
100
|
+
}
|
|
101
|
+
const body = await response.json();
|
|
102
|
+
return {
|
|
103
|
+
id: body.approval_id,
|
|
104
|
+
runId,
|
|
105
|
+
stepId: null,
|
|
106
|
+
capabilityId: null,
|
|
107
|
+
status: body.status,
|
|
108
|
+
environment: null,
|
|
109
|
+
targetResource: null,
|
|
110
|
+
expiresAt: null,
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
const events = async function* (sessionId, opts) {
|
|
114
|
+
const response = await app.request(`/v1/sessions/${encodeURIComponent(sessionId)}/events?live=true&after_sequence=${opts.afterSequence}`, { headers: auth, signal: opts.signal });
|
|
115
|
+
if (!response.ok || !response.body) {
|
|
116
|
+
throw new Error(`Channel event stream failed (${response.status})`);
|
|
117
|
+
}
|
|
118
|
+
requireSessionEventContentType(response, "text/event-stream");
|
|
119
|
+
for await (const event of readSessionEvents(response.body, opts.signal)) {
|
|
120
|
+
yield toChannelSessionEvent(event);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const replayEvents = async (sessionId, opts) => {
|
|
124
|
+
const replayed = [];
|
|
125
|
+
let cursor = opts.afterSequence;
|
|
126
|
+
while (true) {
|
|
127
|
+
const response = await app.request(`/v1/sessions/${encodeURIComponent(sessionId)}/events?after_sequence=${cursor}&limit=500`, { headers: auth });
|
|
128
|
+
if (!response.ok) {
|
|
129
|
+
throw new Error(`Channel event replay failed (${response.status})`);
|
|
130
|
+
}
|
|
131
|
+
requireSessionEventContentType(response, "application/json");
|
|
132
|
+
const page = await response.json();
|
|
133
|
+
if (!Array.isArray(page.events)
|
|
134
|
+
|| !Number.isInteger(page.next_sequence)
|
|
135
|
+
|| typeof page.has_more !== "boolean") {
|
|
136
|
+
throw new Error("session_event_schema_mismatch");
|
|
137
|
+
}
|
|
138
|
+
replayed.push(...page.events.map(toChannelSessionEvent));
|
|
139
|
+
if (!page.has_more)
|
|
140
|
+
return replayed;
|
|
141
|
+
const next = page.next_sequence;
|
|
142
|
+
if (next <= cursor)
|
|
143
|
+
throw new Error("session_event_schema_mismatch");
|
|
144
|
+
cursor = next;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const listDeliveries = async (channel, surfaceMessageId) => {
|
|
148
|
+
const response = await app.request(`/v1/deliveries?channel=${encodeURIComponent(channel)}`
|
|
149
|
+
+ (surfaceMessageId !== undefined ? `&surface_message_id=${encodeURIComponent(surfaceMessageId)}` : ""), { headers: auth });
|
|
150
|
+
if (!response.ok) {
|
|
151
|
+
throw new Error(`list deliveries failed (${response.status})`);
|
|
152
|
+
}
|
|
153
|
+
const body = await response.json();
|
|
154
|
+
return body.deliveries;
|
|
155
|
+
};
|
|
156
|
+
const claimDelivery = async (turnId, owner) => {
|
|
157
|
+
const response = await app.request(`/v1/deliveries/${encodeURIComponent(turnId)}/claim`, {
|
|
158
|
+
method: "POST",
|
|
159
|
+
headers: { ...auth, "content-type": "application/json" },
|
|
160
|
+
body: JSON.stringify({ owner }),
|
|
161
|
+
});
|
|
162
|
+
if (!response.ok) {
|
|
163
|
+
throw new Error(`claim delivery failed (${response.status}): ${await response.text()}`);
|
|
164
|
+
}
|
|
165
|
+
return (await response.json()).claimed === true;
|
|
166
|
+
};
|
|
167
|
+
const ackDelivery = async (turnId, owner, surfaceMessageId, surfaceCardId) => {
|
|
168
|
+
const response = await app.request(`/v1/deliveries/${encodeURIComponent(turnId)}/ack`, {
|
|
169
|
+
method: "POST",
|
|
170
|
+
headers: { ...auth, "content-type": "application/json" },
|
|
171
|
+
body: JSON.stringify({
|
|
172
|
+
owner,
|
|
173
|
+
surface_message_id: surfaceMessageId,
|
|
174
|
+
...(surfaceCardId ? { surface_card_id: surfaceCardId } : {}),
|
|
175
|
+
}),
|
|
176
|
+
});
|
|
177
|
+
if (!response.ok) {
|
|
178
|
+
throw new Error(`ack delivery failed (${response.status}): ${await response.text()}`);
|
|
179
|
+
}
|
|
180
|
+
return (await response.json()).acked === true;
|
|
181
|
+
};
|
|
182
|
+
const completeDelivery = async (turnId, owner) => {
|
|
183
|
+
const response = await app.request(`/v1/deliveries/${encodeURIComponent(turnId)}/complete`, {
|
|
184
|
+
method: "POST",
|
|
185
|
+
headers: { ...auth, "content-type": "application/json" },
|
|
186
|
+
body: JSON.stringify({ owner }),
|
|
187
|
+
});
|
|
188
|
+
if (!response.ok) {
|
|
189
|
+
throw new Error(`complete delivery failed (${response.status}): ${await response.text()}`);
|
|
190
|
+
}
|
|
191
|
+
return (await response.json()).completed === true;
|
|
192
|
+
};
|
|
193
|
+
const getSlotCommandContext = async (slot) => {
|
|
194
|
+
const response = await app.request("/v1/channels/command-context", {
|
|
195
|
+
method: "POST",
|
|
196
|
+
headers: { ...auth, "content-type": "application/json" },
|
|
197
|
+
body: JSON.stringify({
|
|
198
|
+
slot: {
|
|
199
|
+
channel: slot.channel,
|
|
200
|
+
conversation_id: slot.conversationId,
|
|
201
|
+
agent_id: slot.agentId,
|
|
202
|
+
workspace_key: slot.workspaceKey,
|
|
203
|
+
generation: slot.generation,
|
|
204
|
+
},
|
|
205
|
+
}),
|
|
206
|
+
});
|
|
207
|
+
if (!response.ok) {
|
|
208
|
+
throw new Error(`command context failed (${response.status}): ${await response.text()}`);
|
|
209
|
+
}
|
|
210
|
+
const body = await response.json();
|
|
211
|
+
return {
|
|
212
|
+
sessionId: body.session_id,
|
|
213
|
+
activeRunId: body.active_run_id,
|
|
214
|
+
providerSessionId: body.provider_session_id ?? null,
|
|
215
|
+
lastActivityAt: body.last_activity_at ?? null,
|
|
216
|
+
contextUsed: body.context_used ?? null,
|
|
217
|
+
contextSize: body.context_size ?? null,
|
|
218
|
+
contextFirstUsed: body.context_first_used ?? null,
|
|
219
|
+
queuedTurns: body.queued_turns ?? 0,
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
const resolvePermission = async (runId, approve) => {
|
|
223
|
+
const response = await app.request(`/v1/runs/${encodeURIComponent(runId)}/permission`, {
|
|
224
|
+
method: "POST",
|
|
225
|
+
headers: { ...auth, "content-type": "application/json" },
|
|
226
|
+
body: JSON.stringify({ approve }),
|
|
227
|
+
});
|
|
228
|
+
if (!response.ok) {
|
|
229
|
+
throw new Error(`resolve permission failed (${response.status}): ${await response.text()}`);
|
|
230
|
+
}
|
|
231
|
+
return (await response.json()).resolved === true;
|
|
232
|
+
};
|
|
233
|
+
const cancelRun = async (sessionId, runId) => {
|
|
234
|
+
const version = await readRuntimeVersion(sessionId);
|
|
235
|
+
const response = await app.request(`/v1/runs/${encodeURIComponent(runId)}/cancel`, {
|
|
236
|
+
method: "POST",
|
|
237
|
+
headers: {
|
|
238
|
+
...auth,
|
|
239
|
+
"content-type": "application/json",
|
|
240
|
+
"idempotency-key": `cancel:${runId}`,
|
|
241
|
+
"if-match": String(version),
|
|
242
|
+
},
|
|
243
|
+
body: "{}",
|
|
244
|
+
});
|
|
245
|
+
if (!response.ok) {
|
|
246
|
+
throw new Error(`cancel run failed (${response.status}): ${await response.text()}`);
|
|
247
|
+
}
|
|
248
|
+
return (await response.json()).disposition !== undefined;
|
|
249
|
+
};
|
|
250
|
+
const steerRun = async (runId, prompt) => {
|
|
251
|
+
const response = await app.request(`/v1/runs/${encodeURIComponent(runId)}/steer`, {
|
|
252
|
+
method: "POST",
|
|
253
|
+
headers: { ...auth, "content-type": "application/json" },
|
|
254
|
+
body: JSON.stringify({ prompt }),
|
|
255
|
+
});
|
|
256
|
+
if (!response.ok) {
|
|
257
|
+
let message = `steer run failed (${response.status})`;
|
|
258
|
+
try {
|
|
259
|
+
const body = await response.json();
|
|
260
|
+
if (body.error)
|
|
261
|
+
message = body.error;
|
|
262
|
+
}
|
|
263
|
+
catch {
|
|
264
|
+
// 非 JSON 错误体,保留默认消息
|
|
265
|
+
}
|
|
266
|
+
throw new Error(message);
|
|
267
|
+
}
|
|
268
|
+
return response.json();
|
|
269
|
+
};
|
|
270
|
+
const resumeQueue = async (sessionId, commandId) => {
|
|
271
|
+
const version = await readRuntimeVersion(sessionId);
|
|
272
|
+
const response = await app.request(`/v1/sessions/${encodeURIComponent(sessionId)}/queue/resume`, {
|
|
273
|
+
method: "POST",
|
|
274
|
+
headers: {
|
|
275
|
+
...auth,
|
|
276
|
+
"content-type": "application/json",
|
|
277
|
+
"idempotency-key": `resume:${commandId}`,
|
|
278
|
+
"if-match": String(version),
|
|
279
|
+
},
|
|
280
|
+
body: "{}",
|
|
281
|
+
});
|
|
282
|
+
if (!response.ok) {
|
|
283
|
+
throw new Error(`resume queue failed (${response.status}): ${await response.text()}`);
|
|
284
|
+
}
|
|
285
|
+
const body = await response.json();
|
|
286
|
+
return { queueState: body.runtime?.queue_state ?? "ready" };
|
|
287
|
+
};
|
|
288
|
+
const resetSlot = async (slot) => {
|
|
289
|
+
const response = await app.request(`/v1/channels/${encodeURIComponent(slot.channel)}/conversations/${encodeURIComponent(slot.conversationId)}/reset`, {
|
|
290
|
+
method: "POST",
|
|
291
|
+
headers: { ...auth, "content-type": "application/json" },
|
|
292
|
+
body: JSON.stringify({
|
|
293
|
+
agent_id: slot.agentId,
|
|
294
|
+
workspace_key: slot.workspaceKey,
|
|
295
|
+
generation: slot.generation,
|
|
296
|
+
}),
|
|
297
|
+
});
|
|
298
|
+
if (!response.ok)
|
|
299
|
+
return false;
|
|
300
|
+
return (await response.json()).reset === true;
|
|
301
|
+
};
|
|
302
|
+
const resumeProviderSession = async (slot, providerSessionId) => {
|
|
303
|
+
const response = await app.request(`/v1/channels/${encodeURIComponent(slot.channel)}/conversations/${encodeURIComponent(slot.conversationId)}/resume`, {
|
|
304
|
+
method: "POST",
|
|
305
|
+
headers: { ...auth, "content-type": "application/json" },
|
|
306
|
+
body: JSON.stringify({
|
|
307
|
+
agent_id: slot.agentId,
|
|
308
|
+
workspace_key: slot.workspaceKey,
|
|
309
|
+
generation: slot.generation,
|
|
310
|
+
provider_session_id: providerSessionId,
|
|
311
|
+
}),
|
|
312
|
+
});
|
|
313
|
+
if (!response.ok) {
|
|
314
|
+
let message = `resume provider session failed (${response.status})`;
|
|
315
|
+
let detail;
|
|
316
|
+
try {
|
|
317
|
+
const body = await response.json();
|
|
318
|
+
if (body.error)
|
|
319
|
+
message = body.error;
|
|
320
|
+
detail = body.detail;
|
|
321
|
+
}
|
|
322
|
+
catch {
|
|
323
|
+
// 非 JSON 错误体,保留默认消息
|
|
324
|
+
}
|
|
325
|
+
// 只 throw 错误码(detail 挂到 Error.detail),便于 bridge 按码精确匹配。
|
|
326
|
+
const error = new Error(message);
|
|
327
|
+
if (detail)
|
|
328
|
+
error.detail = detail;
|
|
329
|
+
throw error;
|
|
330
|
+
}
|
|
331
|
+
const body = await response.json();
|
|
332
|
+
return { sessionId: body.session_id };
|
|
333
|
+
};
|
|
334
|
+
return {
|
|
335
|
+
submit,
|
|
336
|
+
listRuntimeApprovals,
|
|
337
|
+
resolveRuntimeApproval,
|
|
338
|
+
events,
|
|
339
|
+
replayEvents,
|
|
340
|
+
listDeliveries,
|
|
341
|
+
claimDelivery,
|
|
342
|
+
ackDelivery,
|
|
343
|
+
completeDelivery,
|
|
344
|
+
getSlotCommandContext,
|
|
345
|
+
resumeProviderSession,
|
|
346
|
+
cancelRun,
|
|
347
|
+
steerRun,
|
|
348
|
+
resolvePermission,
|
|
349
|
+
resumeQueue,
|
|
350
|
+
resetSlot,
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
function toChannelRuntimeApproval(input) {
|
|
354
|
+
return {
|
|
355
|
+
id: input.id,
|
|
356
|
+
runId: input.run_id,
|
|
357
|
+
stepId: input.step_id ?? null,
|
|
358
|
+
capabilityId: input.capability_id ?? null,
|
|
359
|
+
status: input.status,
|
|
360
|
+
environment: input.environment ?? null,
|
|
361
|
+
targetResource: input.target_resource ?? null,
|
|
362
|
+
expiresAt: input.expires_at ?? null,
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
async function* readSessionEvents(body, signal) {
|
|
366
|
+
const reader = body.getReader();
|
|
367
|
+
const decoder = new TextDecoder();
|
|
368
|
+
let buffer = "";
|
|
369
|
+
const abort = () => {
|
|
370
|
+
void reader.cancel().catch(() => undefined);
|
|
371
|
+
};
|
|
372
|
+
if (signal?.aborted)
|
|
373
|
+
abort();
|
|
374
|
+
else
|
|
375
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
376
|
+
try {
|
|
377
|
+
while (true) {
|
|
378
|
+
const { done, value } = await reader.read();
|
|
379
|
+
buffer += decoder.decode(value, { stream: !done });
|
|
380
|
+
let boundary = buffer.indexOf("\n\n");
|
|
381
|
+
while (boundary >= 0) {
|
|
382
|
+
const frame = buffer.slice(0, boundary);
|
|
383
|
+
buffer = buffer.slice(boundary + 2);
|
|
384
|
+
const data = frame
|
|
385
|
+
.split("\n")
|
|
386
|
+
.filter((line) => line.startsWith("data:"))
|
|
387
|
+
.map((line) => line.slice("data:".length).trimStart())
|
|
388
|
+
.join("\n");
|
|
389
|
+
if (data)
|
|
390
|
+
yield JSON.parse(data);
|
|
391
|
+
boundary = buffer.indexOf("\n\n");
|
|
392
|
+
}
|
|
393
|
+
if (done)
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
finally {
|
|
398
|
+
signal?.removeEventListener("abort", abort);
|
|
399
|
+
await reader.cancel().catch(() => undefined);
|
|
400
|
+
reader.releaseLock();
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
//# sourceMappingURL=channel-ingress.js.map
|