@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,174 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
const commands = {
|
|
5
|
+
"准备发布": { action: "prepare" },
|
|
6
|
+
"把刚才改的上线": { action: "publish" },
|
|
7
|
+
"上线": { action: "publish" },
|
|
8
|
+
"发布这次修改": { action: "publish" },
|
|
9
|
+
"上线了吗": { action: "status" },
|
|
10
|
+
"发布状态": { action: "status" },
|
|
11
|
+
"取消这次发布": { action: "cancel" },
|
|
12
|
+
"退回上一个版本": { action: "rollback" },
|
|
13
|
+
"回滚到上一版": { action: "rollback" },
|
|
14
|
+
"测好后上线": { action: "prepare", publishAfterPrepare: true },
|
|
15
|
+
};
|
|
16
|
+
export function parseDeploymentCommand(text) {
|
|
17
|
+
const normalized = text.trim().replace(/[。!!??]+$/, "").trim()
|
|
18
|
+
.replace(/^(?:请|帮我)/, "").replace(/吧$/, "").trim();
|
|
19
|
+
const value = Object.hasOwn(commands, normalized) ? commands[normalized] : undefined;
|
|
20
|
+
return value ? { ...value } : undefined;
|
|
21
|
+
}
|
|
22
|
+
export function hasPublishIntent(text) {
|
|
23
|
+
if (/[“”"「」『』`]|不要|不用|别|不必|不发布|不上线|先不|暂不/.test(text))
|
|
24
|
+
return false;
|
|
25
|
+
return /(?:测好后上线|测试通过后上线|测好后发布|改好后上线|并上线|然后上线|完成后上线)[。!!\s]*$/.test(text.trim());
|
|
26
|
+
}
|
|
27
|
+
export class DeploymentService {
|
|
28
|
+
options;
|
|
29
|
+
nativeMessages = new Map();
|
|
30
|
+
constructor(options = {}) {
|
|
31
|
+
this.options = options;
|
|
32
|
+
}
|
|
33
|
+
get configPath() {
|
|
34
|
+
return this.options.configPath ?? path.join(os.homedir(), ".codebridge", "deployer", "config.json");
|
|
35
|
+
}
|
|
36
|
+
readConfig() {
|
|
37
|
+
try {
|
|
38
|
+
return JSON.parse(fs.readFileSync(this.configPath, "utf8"));
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
isOwner(actorId) {
|
|
45
|
+
return Boolean(actorId && this.readConfig()?.ownerOpenId === actorId);
|
|
46
|
+
}
|
|
47
|
+
isMaintenance() {
|
|
48
|
+
const config = this.readConfig();
|
|
49
|
+
return Boolean(config && fs.existsSync(path.join(config.rootDir ?? path.dirname(this.configPath), "maintenance.json")));
|
|
50
|
+
}
|
|
51
|
+
readiness() {
|
|
52
|
+
return {
|
|
53
|
+
ok: true,
|
|
54
|
+
releaseId: process.env.CODEBRIDGE_RELEASE_ID ?? "bootstrap",
|
|
55
|
+
commit: process.env.CODEBRIDGE_RELEASE_COMMIT ?? "bootstrap",
|
|
56
|
+
feishuConnected: this.options.feishuConnected?.() ?? false,
|
|
57
|
+
activeRuns: this.options.activeRuns?.() ?? 0,
|
|
58
|
+
maintenance: this.isMaintenance(),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
async command(command, context) {
|
|
62
|
+
const config = this.readConfig();
|
|
63
|
+
if (!config?.token)
|
|
64
|
+
return "安全发布还没有配置,请先在主机完成安装。普通对话可以继续。";
|
|
65
|
+
if (!config.ownerOpenId || config.ownerOpenId !== context.actorId)
|
|
66
|
+
return "只有已绑定的发布负责人可以操作安全发布。";
|
|
67
|
+
try {
|
|
68
|
+
const response = await (this.options.fetch ?? fetch)("http://127.0.0.1:19791/command", {
|
|
69
|
+
method: "POST",
|
|
70
|
+
headers: { authorization: `Bearer ${config.token}`, "content-type": "application/json" },
|
|
71
|
+
body: JSON.stringify({ ...command, ...context }),
|
|
72
|
+
signal: AbortSignal.timeout(10_000),
|
|
73
|
+
});
|
|
74
|
+
const result = await response.json();
|
|
75
|
+
return typeof result.message === "string" ? result.message : "发布控制器返回异常,请稍后查询发布状态。";
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return "暂时联系不上本机发布控制器,请稍后再试。普通对话可以继续。";
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
nativeContext(messageId) {
|
|
82
|
+
return this.nativeMessages.get(messageId);
|
|
83
|
+
}
|
|
84
|
+
guidance(actorId, text) {
|
|
85
|
+
if (!this.isOwner(actorId))
|
|
86
|
+
return "";
|
|
87
|
+
const sourceRepo = this.readConfig()?.sourceRepo;
|
|
88
|
+
// Scope first: this note must never read as a verdict on other projects' push/deploy authorization.
|
|
89
|
+
return "【CodeBridge 自身修改,仅在本任务修改 CodeBridge 时适用;不涉及其他项目,其他项目的推送、合并、上线授权只以用户原话为准】"
|
|
90
|
+
+ (sourceRepo ? `CodeBridge 修改目录:${sourceRepo}。必须在此目录修改并提交候选。` : "")
|
|
91
|
+
+ (hasPublishIntent(text)
|
|
92
|
+
? "本条消息含发布指令(如“测好后上线”):仅当本任务修改的是 CodeBridge 时,测试通过后可用 codebridge_deploy(action=prepare,publishAfterPrepare=true)。"
|
|
93
|
+
: "本条消息未包含 CodeBridge 发布指令(如“测好后上线”),CodeBridge 只用 codebridge_deploy(action=prepare)准备候选并报告结果。")
|
|
94
|
+
+ "验证并提交后优先用 MCP 工具;沙箱内不要通过 shell/fcb 访问网络;禁止直接重启或覆盖运行目录。MCP 不可用时才考虑 fcb,禁止为发布关闭沙箱或放宽网络权限。";
|
|
95
|
+
}
|
|
96
|
+
guidanceForRun(runId, store) {
|
|
97
|
+
const run = store.getRun(runId);
|
|
98
|
+
const turn = run?.turnId ? store.getTurn(run.turnId) : undefined;
|
|
99
|
+
const actor = turn?.message.actorRef;
|
|
100
|
+
if (actor?.channel !== "feishu")
|
|
101
|
+
return "";
|
|
102
|
+
const delivery = store.listDeliveries("feishu").find((item) => item.turnId === turn?.turnId && item.runId === runId);
|
|
103
|
+
const native = delivery ? this.nativeContext(delivery.replyToMessageId) : undefined;
|
|
104
|
+
if (!native || native.senderId !== actor.id || native.chatId !== delivery?.conversationId.split("|")[0])
|
|
105
|
+
return "";
|
|
106
|
+
return this.guidance(actor.id, native.content);
|
|
107
|
+
}
|
|
108
|
+
async handleFeishuMessage(message) {
|
|
109
|
+
if (this.isOwner(message.senderId)) {
|
|
110
|
+
this.nativeMessages.set(message.messageId, { ...message });
|
|
111
|
+
if (this.nativeMessages.size > 1000)
|
|
112
|
+
this.nativeMessages.delete(this.nativeMessages.keys().next().value);
|
|
113
|
+
}
|
|
114
|
+
const command = parseDeploymentCommand(message.content);
|
|
115
|
+
const pairing = /^开启安全发布 ([A-Za-z0-9_-]+)$/.exec(message.content.trim());
|
|
116
|
+
if (!command && !pairing)
|
|
117
|
+
return undefined;
|
|
118
|
+
if (pairing) {
|
|
119
|
+
// All operations stay synchronous, so competing inbound events cannot bind twice.
|
|
120
|
+
const config = this.readConfig();
|
|
121
|
+
if (!config || config.ownerOpenId || !config.pairingNonce || pairing[1] !== config.pairingNonce || !message.senderId.startsWith("ou_")) {
|
|
122
|
+
return "绑定未通过,请使用主机安装时给出的有效绑定口令。";
|
|
123
|
+
}
|
|
124
|
+
const next = { ...config, ownerOpenId: message.senderId };
|
|
125
|
+
delete next.pairingNonce;
|
|
126
|
+
const temporary = `${this.configPath}.${process.pid}.tmp`;
|
|
127
|
+
fs.writeFileSync(temporary, JSON.stringify(next, null, 2) + "\n", { mode: 0o600, flag: "wx" });
|
|
128
|
+
fs.renameSync(temporary, this.configPath);
|
|
129
|
+
return "已绑定安全发布负责人。可以发送“准备发布”或“发布状态”。";
|
|
130
|
+
}
|
|
131
|
+
return this.command(command, { actorId: message.senderId, chatId: message.chatId, messageId: message.messageId });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/** Mount on the existing authenticated Bridge app; no new listening socket. */
|
|
135
|
+
export function mountDeploymentRoutes(app, service, store) {
|
|
136
|
+
app.get("/deploy/readiness", (c) => c.json(service.readiness()));
|
|
137
|
+
app.post("/deploy/command", async (c) => {
|
|
138
|
+
const body = await c.req.json().catch(() => null);
|
|
139
|
+
if (!body?.runId || !["prepare", "publish", "status", "cancel", "rollback"].includes(body.action)) {
|
|
140
|
+
return c.json({ error: "invalid_deployment_command" }, 400);
|
|
141
|
+
}
|
|
142
|
+
const run = store.getRun(body.runId);
|
|
143
|
+
const turn = run?.turnId ? store.getTurn(run.turnId) : undefined;
|
|
144
|
+
const delivery = turn ? store.listDeliveries("feishu").find((item) => item.turnId === turn.turnId && item.runId === run?.id) : undefined;
|
|
145
|
+
const actor = turn?.message.actorRef;
|
|
146
|
+
if (!run || run.status !== "running" || !delivery || actor?.channel !== "feishu" || !service.isOwner(actor.id)) {
|
|
147
|
+
return c.json({ error: "owner_feishu_run_required" }, 403);
|
|
148
|
+
}
|
|
149
|
+
const native = service.nativeContext(delivery.replyToMessageId);
|
|
150
|
+
if (!native || native.senderId !== actor.id || native.chatId !== delivery.conversationId.split("|")[0]) {
|
|
151
|
+
return c.json({ error: "native_feishu_context_required" }, 403);
|
|
152
|
+
}
|
|
153
|
+
if ((body.action === "publish" || body.publishAfterPrepare === true) && !hasPublishIntent(native.content)) {
|
|
154
|
+
return c.json({ error: "explicit_publish_intent_required" }, 403);
|
|
155
|
+
}
|
|
156
|
+
if (body.action === "rollback" && parseDeploymentCommand(native.content)?.action !== "rollback") {
|
|
157
|
+
return c.json({ error: "explicit_rollback_intent_required" }, 403);
|
|
158
|
+
}
|
|
159
|
+
const command = { action: body.action };
|
|
160
|
+
if (typeof body.ref === "string")
|
|
161
|
+
command.ref = body.ref;
|
|
162
|
+
if (typeof body.releaseId === "string")
|
|
163
|
+
command.releaseId = body.releaseId;
|
|
164
|
+
if (typeof body.publishAfterPrepare === "boolean")
|
|
165
|
+
command.publishAfterPrepare = body.publishAfterPrepare;
|
|
166
|
+
const message = await service.command(command, {
|
|
167
|
+
actorId: actor.id,
|
|
168
|
+
chatId: native.chatId,
|
|
169
|
+
messageId: delivery.replyToMessageId,
|
|
170
|
+
});
|
|
171
|
+
return c.json({ message });
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=deployment.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** 纯函数:给定两次 tick 之间的实际耗时,判断是否构成一次事件循环停顿告警。 */
|
|
2
|
+
export declare function detectEventLoopStall(actualElapsedMs: number, expectedElapsedMs?: number, thresholdMs?: number): {
|
|
3
|
+
stalled: boolean;
|
|
4
|
+
lagMs: number;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* 每秒检测一次事件循环是否被同步任务阻塞。心跳续租和 recovery 扫描都依赖
|
|
8
|
+
* 事件循环按时运转;一旦停顿超过阈值,先记录下来,方便定位「租约看似过期
|
|
9
|
+
* 但进程其实一直健康」这类假死场景的根因。
|
|
10
|
+
*/
|
|
11
|
+
export declare function startEventLoopLagMonitor(options?: {
|
|
12
|
+
now?: () => number;
|
|
13
|
+
warn?: (line: string) => void;
|
|
14
|
+
intervalMs?: number;
|
|
15
|
+
thresholdMs?: number;
|
|
16
|
+
}): {
|
|
17
|
+
stop: () => void;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=event-loop-lag.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const CHECK_INTERVAL_MS = 1_000;
|
|
2
|
+
const STALL_THRESHOLD_MS = 5_000;
|
|
3
|
+
/** 纯函数:给定两次 tick 之间的实际耗时,判断是否构成一次事件循环停顿告警。 */
|
|
4
|
+
export function detectEventLoopStall(actualElapsedMs, expectedElapsedMs = CHECK_INTERVAL_MS, thresholdMs = STALL_THRESHOLD_MS) {
|
|
5
|
+
const lagMs = actualElapsedMs - expectedElapsedMs;
|
|
6
|
+
return { stalled: lagMs >= thresholdMs, lagMs };
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 每秒检测一次事件循环是否被同步任务阻塞。心跳续租和 recovery 扫描都依赖
|
|
10
|
+
* 事件循环按时运转;一旦停顿超过阈值,先记录下来,方便定位「租约看似过期
|
|
11
|
+
* 但进程其实一直健康」这类假死场景的根因。
|
|
12
|
+
*/
|
|
13
|
+
export function startEventLoopLagMonitor(options = {}) {
|
|
14
|
+
const now = options.now ?? (() => Date.now());
|
|
15
|
+
const warn = options.warn ?? ((line) => console.warn(line));
|
|
16
|
+
const intervalMs = options.intervalMs ?? CHECK_INTERVAL_MS;
|
|
17
|
+
const thresholdMs = options.thresholdMs ?? STALL_THRESHOLD_MS;
|
|
18
|
+
let lastTick = now();
|
|
19
|
+
const timer = setInterval(() => {
|
|
20
|
+
const current = now();
|
|
21
|
+
const actualElapsedMs = current - lastTick;
|
|
22
|
+
lastTick = current;
|
|
23
|
+
const { stalled, lagMs } = detectEventLoopStall(actualElapsedMs, intervalMs, thresholdMs);
|
|
24
|
+
if (stalled) {
|
|
25
|
+
warn(`${new Date().toISOString()} event_loop_stall lagMs=${lagMs}`);
|
|
26
|
+
}
|
|
27
|
+
}, intervalMs);
|
|
28
|
+
timer.unref?.();
|
|
29
|
+
return {
|
|
30
|
+
stop: () => clearInterval(timer),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=event-loop-lag.js.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type AppConfig } from "@codebridge/core";
|
|
2
|
+
import type { FeishuAlertMessage, FeishuAlertPage, FeishuAlertReply, FeishuMessage, FeishuAlertReaction } from "@codebridge/channel-feishu";
|
|
3
|
+
type MonitorConfig = NonNullable<AppConfig["feishu"]["alertMonitor"]>;
|
|
4
|
+
export interface FeishuAlertTransport {
|
|
5
|
+
readAlertDone?(messageId: string, after?: number): Promise<FeishuAlertReaction | undefined>;
|
|
6
|
+
/** Root message of the thread a message belongs to, so reactions on any thread message map to the incident. */
|
|
7
|
+
resolveAlertThreadRoot?(messageId: string): Promise<{
|
|
8
|
+
chatId: string;
|
|
9
|
+
rootId: string;
|
|
10
|
+
} | undefined>;
|
|
11
|
+
readAlertMessages(chatId: string, startTime: number, endTime: number, pageToken?: string): Promise<FeishuAlertPage>;
|
|
12
|
+
investigateAlert(alert: FeishuAlertMessage, approverOpenIds: string[], instructions: string): Promise<void>;
|
|
13
|
+
isAlertActive(chatId: string, rootId: string): Promise<boolean>;
|
|
14
|
+
cancelAlertInvestigation?(chatId: string, rootId: string): Promise<void>;
|
|
15
|
+
setAlertMessageReaction?(messageId: string, emojiType: string, managed: string[]): Promise<string>;
|
|
16
|
+
notifyAlertOwner?(chatId: string, rootId: string, approverOpenIds: string[], text: string): Promise<void>;
|
|
17
|
+
/** Plain reply in the alert thread, no mentions. */
|
|
18
|
+
postAlertThreadNotice?(chatId: string, rootId: string, text: string): Promise<void>;
|
|
19
|
+
/** Display name of a chat member; undefined when unknown. */
|
|
20
|
+
alertMemberName?(chatId: string, openId: string): Promise<string | undefined>;
|
|
21
|
+
}
|
|
22
|
+
export declare const ALERT_INVESTIGATION_INSTRUCTIONS: string;
|
|
23
|
+
/** Owns polling checkpoints, duplicate suppression and the alert conversation approvers. */
|
|
24
|
+
export declare class FeishuAlertMonitor {
|
|
25
|
+
private readonly options;
|
|
26
|
+
private readonly store;
|
|
27
|
+
private timer?;
|
|
28
|
+
private running?;
|
|
29
|
+
private stopped;
|
|
30
|
+
private readonly statusWrites;
|
|
31
|
+
constructor(options: {
|
|
32
|
+
statePath: string;
|
|
33
|
+
config: () => MonitorConfig | undefined;
|
|
34
|
+
transport: FeishuAlertTransport;
|
|
35
|
+
isMaintenance?: () => boolean;
|
|
36
|
+
now?: () => number;
|
|
37
|
+
log: (message: string) => void;
|
|
38
|
+
});
|
|
39
|
+
start(): void;
|
|
40
|
+
stop(): Promise<void>;
|
|
41
|
+
tick(): Promise<void>;
|
|
42
|
+
private poll;
|
|
43
|
+
private readGroup;
|
|
44
|
+
private accept;
|
|
45
|
+
private updateIncident;
|
|
46
|
+
/**
|
|
47
|
+
* Called before normal slash commands or Agent dispatch. Anyone may talk in an alert thread, close it or reopen it;
|
|
48
|
+
* only approvers can authorize write actions, which the Agent learns from the tagged speaker identity.
|
|
49
|
+
*/
|
|
50
|
+
prepareReply(message: FeishuMessage, topicId: string | undefined): Promise<FeishuAlertReply | undefined>;
|
|
51
|
+
prepareReaction(reaction: FeishuAlertReaction): Promise<void>;
|
|
52
|
+
/** Cards, human replies and (via the thread root) the bot's own replies all belong to the incident. */
|
|
53
|
+
private incidentForMessage;
|
|
54
|
+
private reconcileOwnerReactions;
|
|
55
|
+
private statusEmoji;
|
|
56
|
+
private alertFingerprint;
|
|
57
|
+
private reactionInstructions;
|
|
58
|
+
private historyInstructions;
|
|
59
|
+
private dismissIncident;
|
|
60
|
+
private postDismissalReceipt;
|
|
61
|
+
private runbookInstructions;
|
|
62
|
+
setStatus(chatId: string, rootId: string, status: string, summary: string): Promise<void>;
|
|
63
|
+
private syncStatus;
|
|
64
|
+
private projectStatus;
|
|
65
|
+
/** Terminal incidents eventually stop shaping their thread, so old alert topics behave like ordinary ones again. */
|
|
66
|
+
private purgeExpiredIncidents;
|
|
67
|
+
isAlertMessage(chatId: string, messageId: string): boolean;
|
|
68
|
+
}
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=feishu-alert-monitor.d.ts.map
|