@richhardry/codor 0.10.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/LICENSE +21 -0
- package/README.md +293 -0
- package/bin/codor.mjs +7 -0
- package/node_modules/@codor/adapter-antigravity/dist/adapter.d.ts +41 -0
- package/node_modules/@codor/adapter-antigravity/dist/adapter.d.ts.map +1 -0
- package/node_modules/@codor/adapter-antigravity/dist/adapter.js +275 -0
- package/node_modules/@codor/adapter-antigravity/dist/adapter.js.map +1 -0
- package/node_modules/@codor/adapter-antigravity/dist/index.d.ts +2 -0
- package/node_modules/@codor/adapter-antigravity/dist/index.d.ts.map +1 -0
- package/node_modules/@codor/adapter-antigravity/dist/index.js +2 -0
- package/node_modules/@codor/adapter-antigravity/dist/index.js.map +1 -0
- package/node_modules/@codor/adapter-antigravity/package.json +18 -0
- package/node_modules/@codor/adapter-claude-code/dist/adapter.d.ts +94 -0
- package/node_modules/@codor/adapter-claude-code/dist/adapter.d.ts.map +1 -0
- package/node_modules/@codor/adapter-claude-code/dist/adapter.js +785 -0
- package/node_modules/@codor/adapter-claude-code/dist/adapter.js.map +1 -0
- package/node_modules/@codor/adapter-claude-code/dist/index.d.ts +8 -0
- package/node_modules/@codor/adapter-claude-code/dist/index.d.ts.map +1 -0
- package/node_modules/@codor/adapter-claude-code/dist/index.js +5 -0
- package/node_modules/@codor/adapter-claude-code/dist/index.js.map +1 -0
- package/node_modules/@codor/adapter-claude-code/dist/limits-probe.d.ts +18 -0
- package/node_modules/@codor/adapter-claude-code/dist/limits-probe.d.ts.map +1 -0
- package/node_modules/@codor/adapter-claude-code/dist/limits-probe.js +67 -0
- package/node_modules/@codor/adapter-claude-code/dist/limits-probe.js.map +1 -0
- package/node_modules/@codor/adapter-claude-code/dist/peek.d.ts +3 -0
- package/node_modules/@codor/adapter-claude-code/dist/peek.d.ts.map +1 -0
- package/node_modules/@codor/adapter-claude-code/dist/peek.js +128 -0
- package/node_modules/@codor/adapter-claude-code/dist/peek.js.map +1 -0
- package/node_modules/@codor/adapter-claude-code/dist/query.d.ts +9 -0
- package/node_modules/@codor/adapter-claude-code/dist/query.d.ts.map +1 -0
- package/node_modules/@codor/adapter-claude-code/dist/query.js +7 -0
- package/node_modules/@codor/adapter-claude-code/dist/query.js.map +1 -0
- package/node_modules/@codor/adapter-claude-code/dist/translate.d.ts +40 -0
- package/node_modules/@codor/adapter-claude-code/dist/translate.d.ts.map +1 -0
- package/node_modules/@codor/adapter-claude-code/dist/translate.js +505 -0
- package/node_modules/@codor/adapter-claude-code/dist/translate.js.map +1 -0
- package/node_modules/@codor/adapter-claude-code/package.json +18 -0
- package/node_modules/@codor/adapter-codex/dist/adapter.d.ts +105 -0
- package/node_modules/@codor/adapter-codex/dist/adapter.d.ts.map +1 -0
- package/node_modules/@codor/adapter-codex/dist/adapter.js +625 -0
- package/node_modules/@codor/adapter-codex/dist/adapter.js.map +1 -0
- package/node_modules/@codor/adapter-codex/dist/app-server-transport.d.ts +39 -0
- package/node_modules/@codor/adapter-codex/dist/app-server-transport.d.ts.map +1 -0
- package/node_modules/@codor/adapter-codex/dist/app-server-transport.js +186 -0
- package/node_modules/@codor/adapter-codex/dist/app-server-transport.js.map +1 -0
- package/node_modules/@codor/adapter-codex/dist/index.d.ts +8 -0
- package/node_modules/@codor/adapter-codex/dist/index.d.ts.map +1 -0
- package/node_modules/@codor/adapter-codex/dist/index.js +5 -0
- package/node_modules/@codor/adapter-codex/dist/index.js.map +1 -0
- package/node_modules/@codor/adapter-codex/dist/limits-probe.d.ts +18 -0
- package/node_modules/@codor/adapter-codex/dist/limits-probe.d.ts.map +1 -0
- package/node_modules/@codor/adapter-codex/dist/limits-probe.js +87 -0
- package/node_modules/@codor/adapter-codex/dist/limits-probe.js.map +1 -0
- package/node_modules/@codor/adapter-codex/dist/peek.d.ts +3 -0
- package/node_modules/@codor/adapter-codex/dist/peek.d.ts.map +1 -0
- package/node_modules/@codor/adapter-codex/dist/peek.js +98 -0
- package/node_modules/@codor/adapter-codex/dist/peek.js.map +1 -0
- package/node_modules/@codor/adapter-codex/dist/translate.d.ts +17 -0
- package/node_modules/@codor/adapter-codex/dist/translate.d.ts.map +1 -0
- package/node_modules/@codor/adapter-codex/dist/translate.js +286 -0
- package/node_modules/@codor/adapter-codex/dist/translate.js.map +1 -0
- package/node_modules/@codor/adapter-codex/package.json +17 -0
- package/node_modules/@codor/adapter-copilot/dist/adapter.d.ts +40 -0
- package/node_modules/@codor/adapter-copilot/dist/adapter.d.ts.map +1 -0
- package/node_modules/@codor/adapter-copilot/dist/adapter.js +190 -0
- package/node_modules/@codor/adapter-copilot/dist/adapter.js.map +1 -0
- package/node_modules/@codor/adapter-copilot/dist/index.d.ts +4 -0
- package/node_modules/@codor/adapter-copilot/dist/index.d.ts.map +1 -0
- package/node_modules/@codor/adapter-copilot/dist/index.js +3 -0
- package/node_modules/@codor/adapter-copilot/dist/index.js.map +1 -0
- package/node_modules/@codor/adapter-copilot/dist/translate.d.ts +11 -0
- package/node_modules/@codor/adapter-copilot/dist/translate.d.ts.map +1 -0
- package/node_modules/@codor/adapter-copilot/dist/translate.js +184 -0
- package/node_modules/@codor/adapter-copilot/dist/translate.js.map +1 -0
- package/node_modules/@codor/adapter-copilot/package.json +18 -0
- package/node_modules/@codor/adapter-cursor/dist/adapter.d.ts +32 -0
- package/node_modules/@codor/adapter-cursor/dist/adapter.d.ts.map +1 -0
- package/node_modules/@codor/adapter-cursor/dist/adapter.js +179 -0
- package/node_modules/@codor/adapter-cursor/dist/adapter.js.map +1 -0
- package/node_modules/@codor/adapter-cursor/dist/index.d.ts +9 -0
- package/node_modules/@codor/adapter-cursor/dist/index.d.ts.map +1 -0
- package/node_modules/@codor/adapter-cursor/dist/index.js +8 -0
- package/node_modules/@codor/adapter-cursor/dist/index.js.map +1 -0
- package/node_modules/@codor/adapter-cursor/dist/translate.d.ts +15 -0
- package/node_modules/@codor/adapter-cursor/dist/translate.d.ts.map +1 -0
- package/node_modules/@codor/adapter-cursor/dist/translate.js +164 -0
- package/node_modules/@codor/adapter-cursor/dist/translate.js.map +1 -0
- package/node_modules/@codor/adapter-cursor/package.json +17 -0
- package/node_modules/@codor/adapter-gemini/dist/adapter.d.ts +36 -0
- package/node_modules/@codor/adapter-gemini/dist/adapter.d.ts.map +1 -0
- package/node_modules/@codor/adapter-gemini/dist/adapter.js +245 -0
- package/node_modules/@codor/adapter-gemini/dist/adapter.js.map +1 -0
- package/node_modules/@codor/adapter-gemini/dist/index.d.ts +4 -0
- package/node_modules/@codor/adapter-gemini/dist/index.d.ts.map +1 -0
- package/node_modules/@codor/adapter-gemini/dist/index.js +3 -0
- package/node_modules/@codor/adapter-gemini/dist/index.js.map +1 -0
- package/node_modules/@codor/adapter-gemini/dist/translate.d.ts +12 -0
- package/node_modules/@codor/adapter-gemini/dist/translate.d.ts.map +1 -0
- package/node_modules/@codor/adapter-gemini/dist/translate.js +123 -0
- package/node_modules/@codor/adapter-gemini/dist/translate.js.map +1 -0
- package/node_modules/@codor/adapter-gemini/package.json +18 -0
- package/node_modules/@codor/adapter-opencode/dist/adapter.d.ts +42 -0
- package/node_modules/@codor/adapter-opencode/dist/adapter.d.ts.map +1 -0
- package/node_modules/@codor/adapter-opencode/dist/adapter.js +240 -0
- package/node_modules/@codor/adapter-opencode/dist/adapter.js.map +1 -0
- package/node_modules/@codor/adapter-opencode/dist/index.d.ts +4 -0
- package/node_modules/@codor/adapter-opencode/dist/index.d.ts.map +1 -0
- package/node_modules/@codor/adapter-opencode/dist/index.js +3 -0
- package/node_modules/@codor/adapter-opencode/dist/index.js.map +1 -0
- package/node_modules/@codor/adapter-opencode/dist/translate.d.ts +12 -0
- package/node_modules/@codor/adapter-opencode/dist/translate.d.ts.map +1 -0
- package/node_modules/@codor/adapter-opencode/dist/translate.js +144 -0
- package/node_modules/@codor/adapter-opencode/dist/translate.js.map +1 -0
- package/node_modules/@codor/adapter-opencode/package.json +18 -0
- package/node_modules/@codor/cli/dist/artifact.d.ts +33 -0
- package/node_modules/@codor/cli/dist/artifact.d.ts.map +1 -0
- package/node_modules/@codor/cli/dist/artifact.js +183 -0
- package/node_modules/@codor/cli/dist/artifact.js.map +1 -0
- package/node_modules/@codor/cli/dist/attach.d.ts +25 -0
- package/node_modules/@codor/cli/dist/attach.d.ts.map +1 -0
- package/node_modules/@codor/cli/dist/attach.js +133 -0
- package/node_modules/@codor/cli/dist/attach.js.map +1 -0
- package/node_modules/@codor/cli/dist/connection.d.ts +21 -0
- package/node_modules/@codor/cli/dist/connection.d.ts.map +1 -0
- package/node_modules/@codor/cli/dist/connection.js +130 -0
- package/node_modules/@codor/cli/dist/connection.js.map +1 -0
- package/node_modules/@codor/cli/dist/detect.d.ts +14 -0
- package/node_modules/@codor/cli/dist/detect.d.ts.map +1 -0
- package/node_modules/@codor/cli/dist/detect.js +99 -0
- package/node_modules/@codor/cli/dist/detect.js.map +1 -0
- package/node_modules/@codor/cli/dist/index.d.ts +17 -0
- package/node_modules/@codor/cli/dist/index.d.ts.map +1 -0
- package/node_modules/@codor/cli/dist/index.js +24 -0
- package/node_modules/@codor/cli/dist/index.js.map +1 -0
- package/node_modules/@codor/cli/dist/mirror.d.ts +4 -0
- package/node_modules/@codor/cli/dist/mirror.d.ts.map +1 -0
- package/node_modules/@codor/cli/dist/mirror.js +93 -0
- package/node_modules/@codor/cli/dist/mirror.js.map +1 -0
- package/node_modules/@codor/cli/dist/program.d.ts +17 -0
- package/node_modules/@codor/cli/dist/program.d.ts.map +1 -0
- package/node_modules/@codor/cli/dist/program.js +1068 -0
- package/node_modules/@codor/cli/dist/program.js.map +1 -0
- package/node_modules/@codor/cli/dist/runtime-install.d.ts +61 -0
- package/node_modules/@codor/cli/dist/runtime-install.d.ts.map +1 -0
- package/node_modules/@codor/cli/dist/runtime-install.js +122 -0
- package/node_modules/@codor/cli/dist/runtime-install.js.map +1 -0
- package/node_modules/@codor/cli/dist/runtime-paths.d.ts +24 -0
- package/node_modules/@codor/cli/dist/runtime-paths.d.ts.map +1 -0
- package/node_modules/@codor/cli/dist/runtime-paths.js +69 -0
- package/node_modules/@codor/cli/dist/runtime-paths.js.map +1 -0
- package/node_modules/@codor/cli/dist/setup-flow.d.ts +69 -0
- package/node_modules/@codor/cli/dist/setup-flow.d.ts.map +1 -0
- package/node_modules/@codor/cli/dist/setup-flow.js +110 -0
- package/node_modules/@codor/cli/dist/setup-flow.js.map +1 -0
- package/node_modules/@codor/cli/dist/setup-session.d.ts +105 -0
- package/node_modules/@codor/cli/dist/setup-session.d.ts.map +1 -0
- package/node_modules/@codor/cli/dist/setup-session.js +346 -0
- package/node_modules/@codor/cli/dist/setup-session.js.map +1 -0
- package/node_modules/@codor/cli/dist/setup-ui.d.ts +93 -0
- package/node_modules/@codor/cli/dist/setup-ui.d.ts.map +1 -0
- package/node_modules/@codor/cli/dist/setup-ui.js +249 -0
- package/node_modules/@codor/cli/dist/setup-ui.js.map +1 -0
- package/node_modules/@codor/cli/dist/setup.d.ts +108 -0
- package/node_modules/@codor/cli/dist/setup.d.ts.map +1 -0
- package/node_modules/@codor/cli/dist/setup.js +878 -0
- package/node_modules/@codor/cli/dist/setup.js.map +1 -0
- package/node_modules/@codor/cli/dist/terminal-keys.d.ts +26 -0
- package/node_modules/@codor/cli/dist/terminal-keys.d.ts.map +1 -0
- package/node_modules/@codor/cli/dist/terminal-keys.js +70 -0
- package/node_modules/@codor/cli/dist/terminal-keys.js.map +1 -0
- package/node_modules/@codor/cli/dist/terminal-qr.d.ts +2 -0
- package/node_modules/@codor/cli/dist/terminal-qr.d.ts.map +1 -0
- package/node_modules/@codor/cli/dist/terminal-qr.js +30 -0
- package/node_modules/@codor/cli/dist/terminal-qr.js.map +1 -0
- package/node_modules/@codor/cli/dist/up.d.ts +52 -0
- package/node_modules/@codor/cli/dist/up.d.ts.map +1 -0
- package/node_modules/@codor/cli/dist/up.js +178 -0
- package/node_modules/@codor/cli/dist/up.js.map +1 -0
- package/node_modules/@codor/cli/package.json +24 -0
- package/node_modules/@codor/cli/packaging/systemd/codor.service +21 -0
- package/node_modules/@codor/cli/runtime/web/assets/LandingPage-BOmG5kSw.js +31 -0
- package/node_modules/@codor/cli/runtime/web/assets/LedgerPage-CecuTS8-.js +1 -0
- package/node_modules/@codor/cli/runtime/web/assets/NoChannels-CYiBXGQd.js +11 -0
- package/node_modules/@codor/cli/runtime/web/assets/PairingCodeInput-Cr6XDWx-.js +1 -0
- package/node_modules/@codor/cli/runtime/web/assets/PairingPage-CQBWNA2L.js +6 -0
- package/node_modules/@codor/cli/runtime/web/assets/SettingsPage-DGLbSXE7.js +16 -0
- package/node_modules/@codor/cli/runtime/web/assets/StartupUnavailable-DdQBHip_.js +1 -0
- package/node_modules/@codor/cli/runtime/web/assets/arrow-left-BOpjMuRi.js +6 -0
- package/node_modules/@codor/cli/runtime/web/assets/browser-BWQYNOsD.js +6 -0
- package/node_modules/@codor/cli/runtime/web/assets/graph-toBZHlC0.js +1 -0
- package/node_modules/@codor/cli/runtime/web/assets/index-Cxi54Xim.js +408 -0
- package/node_modules/@codor/cli/runtime/web/assets/index-DjwJakJC.css +1 -0
- package/node_modules/@codor/cli/runtime/web/assets/qr-DpynCwP9.js +8 -0
- package/node_modules/@codor/cli/runtime/web/assets/react-C8w-UNLI.js +32 -0
- package/node_modules/@codor/cli/runtime/web/assets/sodium-DtsvMzX9.js +1 -0
- package/node_modules/@codor/cli/runtime/web/codor-192.png +0 -0
- package/node_modules/@codor/cli/runtime/web/codor-512.png +0 -0
- package/node_modules/@codor/cli/runtime/web/codor-apple-touch-180.png +0 -0
- package/node_modules/@codor/cli/runtime/web/codor-favicon.svg +86 -0
- package/node_modules/@codor/cli/runtime/web/codor-mark.svg +86 -0
- package/node_modules/@codor/cli/runtime/web/codor-maskable-512.png +0 -0
- package/node_modules/@codor/cli/runtime/web/codor-og.png +0 -0
- package/node_modules/@codor/cli/runtime/web/fonts/BitcountPropSingle-latin.woff2 +0 -0
- package/node_modules/@codor/cli/runtime/web/fonts/Geist-Variable.woff2 +0 -0
- package/node_modules/@codor/cli/runtime/web/fonts/GeistMono-Variable.woff2 +0 -0
- package/node_modules/@codor/cli/runtime/web/fonts/OFL.txt +93 -0
- package/node_modules/@codor/cli/runtime/web/index.html +53 -0
- package/node_modules/@codor/cli/runtime/web/manifest.webmanifest +1 -0
- package/node_modules/@codor/cli/runtime/web/sw.js +2 -0
- package/node_modules/@codor/protocol/dist/adapter.d.ts +118 -0
- package/node_modules/@codor/protocol/dist/adapter.d.ts.map +1 -0
- package/node_modules/@codor/protocol/dist/adapter.js +15 -0
- package/node_modules/@codor/protocol/dist/adapter.js.map +1 -0
- package/node_modules/@codor/protocol/dist/body.d.ts +14 -0
- package/node_modules/@codor/protocol/dist/body.d.ts.map +1 -0
- package/node_modules/@codor/protocol/dist/body.js +50 -0
- package/node_modules/@codor/protocol/dist/body.js.map +1 -0
- package/node_modules/@codor/protocol/dist/changelog.d.ts +30 -0
- package/node_modules/@codor/protocol/dist/changelog.d.ts.map +1 -0
- package/node_modules/@codor/protocol/dist/changelog.js +19 -0
- package/node_modules/@codor/protocol/dist/changelog.js.map +1 -0
- package/node_modules/@codor/protocol/dist/default-recipient.d.ts +8 -0
- package/node_modules/@codor/protocol/dist/default-recipient.d.ts.map +1 -0
- package/node_modules/@codor/protocol/dist/default-recipient.js +19 -0
- package/node_modules/@codor/protocol/dist/default-recipient.js.map +1 -0
- package/node_modules/@codor/protocol/dist/delivery.d.ts +42 -0
- package/node_modules/@codor/protocol/dist/delivery.d.ts.map +1 -0
- package/node_modules/@codor/protocol/dist/delivery.js +44 -0
- package/node_modules/@codor/protocol/dist/delivery.js.map +1 -0
- package/node_modules/@codor/protocol/dist/events.d.ts +284 -0
- package/node_modules/@codor/protocol/dist/events.d.ts.map +1 -0
- package/node_modules/@codor/protocol/dist/events.js +150 -0
- package/node_modules/@codor/protocol/dist/events.js.map +1 -0
- package/node_modules/@codor/protocol/dist/ids.d.ts +19 -0
- package/node_modules/@codor/protocol/dist/ids.d.ts.map +1 -0
- package/node_modules/@codor/protocol/dist/ids.js +27 -0
- package/node_modules/@codor/protocol/dist/ids.js.map +1 -0
- package/node_modules/@codor/protocol/dist/index.d.ts +14 -0
- package/node_modules/@codor/protocol/dist/index.d.ts.map +1 -0
- package/node_modules/@codor/protocol/dist/index.js +14 -0
- package/node_modules/@codor/protocol/dist/index.js.map +1 -0
- package/node_modules/@codor/protocol/dist/interaction.d.ts +45 -0
- package/node_modules/@codor/protocol/dist/interaction.d.ts.map +1 -0
- package/node_modules/@codor/protocol/dist/interaction.js +33 -0
- package/node_modules/@codor/protocol/dist/interaction.js.map +1 -0
- package/node_modules/@codor/protocol/dist/member.d.ts +146 -0
- package/node_modules/@codor/protocol/dist/member.d.ts.map +1 -0
- package/node_modules/@codor/protocol/dist/member.js +169 -0
- package/node_modules/@codor/protocol/dist/member.js.map +1 -0
- package/node_modules/@codor/protocol/dist/message.d.ts +166 -0
- package/node_modules/@codor/protocol/dist/message.d.ts.map +1 -0
- package/node_modules/@codor/protocol/dist/message.js +95 -0
- package/node_modules/@codor/protocol/dist/message.js.map +1 -0
- package/node_modules/@codor/protocol/dist/observability.d.ts +80 -0
- package/node_modules/@codor/protocol/dist/observability.d.ts.map +1 -0
- package/node_modules/@codor/protocol/dist/observability.js +41 -0
- package/node_modules/@codor/protocol/dist/observability.js.map +1 -0
- package/node_modules/@codor/protocol/dist/room.d.ts +430 -0
- package/node_modules/@codor/protocol/dist/room.d.ts.map +1 -0
- package/node_modules/@codor/protocol/dist/room.js +142 -0
- package/node_modules/@codor/protocol/dist/room.js.map +1 -0
- package/node_modules/@codor/protocol/dist/ws.d.ts +1348 -0
- package/node_modules/@codor/protocol/dist/ws.d.ts.map +1 -0
- package/node_modules/@codor/protocol/dist/ws.js +282 -0
- package/node_modules/@codor/protocol/dist/ws.js.map +1 -0
- package/node_modules/@codor/protocol/package.json +17 -0
- package/node_modules/@codor/switchboard/dist/adapter-registry.d.ts +14 -0
- package/node_modules/@codor/switchboard/dist/adapter-registry.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/adapter-registry.js +175 -0
- package/node_modules/@codor/switchboard/dist/adapter-registry.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/authorization.d.ts +13 -0
- package/node_modules/@codor/switchboard/dist/authorization.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/authorization.js +96 -0
- package/node_modules/@codor/switchboard/dist/authorization.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/blobs.d.ts +17 -0
- package/node_modules/@codor/switchboard/dist/blobs.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/blobs.js +54 -0
- package/node_modules/@codor/switchboard/dist/blobs.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/collaboration.d.ts +115 -0
- package/node_modules/@codor/switchboard/dist/collaboration.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/collaboration.js +123 -0
- package/node_modules/@codor/switchboard/dist/collaboration.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/continuation.d.ts +33 -0
- package/node_modules/@codor/switchboard/dist/continuation.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/continuation.js +177 -0
- package/node_modules/@codor/switchboard/dist/continuation.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/crypto/browser-sessions.d.ts +22 -0
- package/node_modules/@codor/switchboard/dist/crypto/browser-sessions.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/crypto/browser-sessions.js +92 -0
- package/node_modules/@codor/switchboard/dist/crypto/browser-sessions.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/crypto/challenge.d.ts +37 -0
- package/node_modules/@codor/switchboard/dist/crypto/challenge.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/crypto/challenge.js +132 -0
- package/node_modules/@codor/switchboard/dist/crypto/challenge.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/crypto/keys.d.ts +41 -0
- package/node_modules/@codor/switchboard/dist/crypto/keys.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/crypto/keys.js +145 -0
- package/node_modules/@codor/switchboard/dist/crypto/keys.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/crypto/pairing.d.ts +53 -0
- package/node_modules/@codor/switchboard/dist/crypto/pairing.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/crypto/pairing.js +182 -0
- package/node_modules/@codor/switchboard/dist/crypto/pairing.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/crypto/roomkeys.d.ts +30 -0
- package/node_modules/@codor/switchboard/dist/crypto/roomkeys.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/crypto/roomkeys.js +101 -0
- package/node_modules/@codor/switchboard/dist/crypto/roomkeys.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/daemon.d.ts +545 -0
- package/node_modules/@codor/switchboard/dist/daemon.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/daemon.js +3907 -0
- package/node_modules/@codor/switchboard/dist/daemon.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/fake-adapter.d.ts +103 -0
- package/node_modules/@codor/switchboard/dist/fake-adapter.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/fake-adapter.js +228 -0
- package/node_modules/@codor/switchboard/dist/fake-adapter.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/index.d.ts +44 -0
- package/node_modules/@codor/switchboard/dist/index.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/index.js +24 -0
- package/node_modules/@codor/switchboard/dist/index.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/ledger/resolve.d.ts +12 -0
- package/node_modules/@codor/switchboard/dist/ledger/resolve.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/ledger/resolve.js +17 -0
- package/node_modules/@codor/switchboard/dist/ledger/resolve.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/ledger/vault.d.ts +47 -0
- package/node_modules/@codor/switchboard/dist/ledger/vault.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/ledger/vault.js +175 -0
- package/node_modules/@codor/switchboard/dist/ledger/vault.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/ledger/watch.d.ts +73 -0
- package/node_modules/@codor/switchboard/dist/ledger/watch.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/ledger/watch.js +232 -0
- package/node_modules/@codor/switchboard/dist/ledger/watch.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/local-dirs.d.ts +14 -0
- package/node_modules/@codor/switchboard/dist/local-dirs.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/local-dirs.js +40 -0
- package/node_modules/@codor/switchboard/dist/local-dirs.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/local-socket.d.ts +3 -0
- package/node_modules/@codor/switchboard/dist/local-socket.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/local-socket.js +16 -0
- package/node_modules/@codor/switchboard/dist/local-socket.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/pricing.d.ts +32 -0
- package/node_modules/@codor/switchboard/dist/pricing.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/pricing.js +64 -0
- package/node_modules/@codor/switchboard/dist/pricing.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/process-liveness.d.ts +2 -0
- package/node_modules/@codor/switchboard/dist/process-liveness.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/process-liveness.js +9 -0
- package/node_modules/@codor/switchboard/dist/process-liveness.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/push/producer.d.ts +54 -0
- package/node_modules/@codor/switchboard/dist/push/producer.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/push/producer.js +168 -0
- package/node_modules/@codor/switchboard/dist/push/producer.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/push/subscriptions.d.ts +29 -0
- package/node_modules/@codor/switchboard/dist/push/subscriptions.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/push/subscriptions.js +83 -0
- package/node_modules/@codor/switchboard/dist/push/subscriptions.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/redact.d.ts +11 -0
- package/node_modules/@codor/switchboard/dist/redact.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/redact.js +65 -0
- package/node_modules/@codor/switchboard/dist/redact.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/residency.d.ts +110 -0
- package/node_modules/@codor/switchboard/dist/residency.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/residency.js +587 -0
- package/node_modules/@codor/switchboard/dist/residency.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/router.d.ts +120 -0
- package/node_modules/@codor/switchboard/dist/router.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/router.js +198 -0
- package/node_modules/@codor/switchboard/dist/router.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/server.d.ts +50 -0
- package/node_modules/@codor/switchboard/dist/server.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/server.js +1425 -0
- package/node_modules/@codor/switchboard/dist/server.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/store.d.ts +534 -0
- package/node_modules/@codor/switchboard/dist/store.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/store.js +2625 -0
- package/node_modules/@codor/switchboard/dist/store.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/transport/hyperswarm.d.ts +59 -0
- package/node_modules/@codor/switchboard/dist/transport/hyperswarm.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/transport/hyperswarm.js +183 -0
- package/node_modules/@codor/switchboard/dist/transport/hyperswarm.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/transport/peer.d.ts +87 -0
- package/node_modules/@codor/switchboard/dist/transport/peer.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/transport/peer.js +316 -0
- package/node_modules/@codor/switchboard/dist/transport/peer.js.map +1 -0
- package/node_modules/@codor/switchboard/dist/working-directory.d.ts +2 -0
- package/node_modules/@codor/switchboard/dist/working-directory.d.ts.map +1 -0
- package/node_modules/@codor/switchboard/dist/working-directory.js +26 -0
- package/node_modules/@codor/switchboard/dist/working-directory.js.map +1 -0
- package/node_modules/@codor/switchboard/package.json +33 -0
- package/package.json +58 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
const ROLE_RANK = {
|
|
2
|
+
observer: 0,
|
|
3
|
+
member: 1,
|
|
4
|
+
admin: 2,
|
|
5
|
+
owner: 3,
|
|
6
|
+
};
|
|
7
|
+
// harn:assume roles-gate-human-acts-not-agents ref=role-matrix-source
|
|
8
|
+
export const CAPABILITY_MINIMUM_ROLE = {
|
|
9
|
+
read: 'observer',
|
|
10
|
+
mark_read: 'observer',
|
|
11
|
+
mark_room_read: 'observer',
|
|
12
|
+
consume_delivery: 'member',
|
|
13
|
+
post: 'member',
|
|
14
|
+
answer_interaction: 'member',
|
|
15
|
+
release_hold: 'member',
|
|
16
|
+
redeliver: 'admin',
|
|
17
|
+
join: 'admin',
|
|
18
|
+
adopt: 'admin',
|
|
19
|
+
attach_acquire: 'admin',
|
|
20
|
+
attach_child: 'admin',
|
|
21
|
+
attach_heartbeat: 'admin',
|
|
22
|
+
attach_complete: 'admin',
|
|
23
|
+
configure_room: 'admin',
|
|
24
|
+
spawn: 'admin',
|
|
25
|
+
// Pinning a message is an owner/admin marker (P9). Agents never gain it —
|
|
26
|
+
// AGENT_CAPABILITIES omits pin_message, so the roles gate refuses them.
|
|
27
|
+
pin_message: 'admin',
|
|
28
|
+
// Deleting a message purges its body (P9); owner/admin only, agents refused.
|
|
29
|
+
delete_message: 'admin',
|
|
30
|
+
// Retrying a failed/interrupted run re-delivers its instructions (P9);
|
|
31
|
+
// owner/admin only, agents refused (AGENT_CAPABILITIES omits it).
|
|
32
|
+
retry_run: 'admin',
|
|
33
|
+
// Compacting an agent's engine session spends the operator's context on their
|
|
34
|
+
// behalf; owner/admin only, and AGENT_CAPABILITIES omits it so an agent can
|
|
35
|
+
// never compact itself or a peer.
|
|
36
|
+
compact_member: 'admin',
|
|
37
|
+
// Changing what an agent may do to the machine is an admin act, like creating one.
|
|
38
|
+
// NOTE for codor-live-collab: when members gain credentials, `configure` must be
|
|
39
|
+
// EXCLUDED from what an agent may do — an agent must never raise its own permission.
|
|
40
|
+
configure: 'admin',
|
|
41
|
+
rename: 'admin',
|
|
42
|
+
revive: 'admin',
|
|
43
|
+
kill: 'admin',
|
|
44
|
+
// harn:assume removed-members-remain-attribution-tombstones ref=member-removal-role-matrix
|
|
45
|
+
remove: 'admin',
|
|
46
|
+
pause: 'admin',
|
|
47
|
+
unpause: 'admin',
|
|
48
|
+
interrupt: 'admin',
|
|
49
|
+
mirror_turn: 'admin',
|
|
50
|
+
mirror_session_end: 'admin',
|
|
51
|
+
manage_ledger: 'admin',
|
|
52
|
+
manage_agents: 'admin',
|
|
53
|
+
// harn:end removed-members-remain-attribution-tombstones
|
|
54
|
+
enable_bridge: 'admin',
|
|
55
|
+
set_role: 'owner',
|
|
56
|
+
manage_keys: 'owner',
|
|
57
|
+
manage_devices: 'owner',
|
|
58
|
+
manage_roles: 'owner',
|
|
59
|
+
manage_rooms: 'owner',
|
|
60
|
+
};
|
|
61
|
+
export function roleAllows(role, capability) {
|
|
62
|
+
return ROLE_RANK[role] >= ROLE_RANK[CAPABILITY_MINIMUM_ROLE[capability]];
|
|
63
|
+
}
|
|
64
|
+
export function assertHumanCapability(member, capability) {
|
|
65
|
+
if (member.kind !== 'human' || member.role === undefined) {
|
|
66
|
+
throw new Error(`authorization principal ${member.id} is not a human member`);
|
|
67
|
+
}
|
|
68
|
+
if (!roleAllows(member.role, capability)) {
|
|
69
|
+
throw new Error(`forbidden: ${member.role} cannot ${capability.replaceAll('_', ' ')}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// harn:end roles-gate-human-acts-not-agents
|
|
73
|
+
// harn:assume agent-network-authority-is-narrow ref=agent-capability-matrix
|
|
74
|
+
export const AGENT_CAPABILITIES = [
|
|
75
|
+
'read',
|
|
76
|
+
'post',
|
|
77
|
+
'search',
|
|
78
|
+
'consume_delivery',
|
|
79
|
+
'wait_begin',
|
|
80
|
+
'wait_end',
|
|
81
|
+
'member_status',
|
|
82
|
+
];
|
|
83
|
+
const AGENT_CAPABILITY_SET = new Set(AGENT_CAPABILITIES);
|
|
84
|
+
export function agentAllows(capability) {
|
|
85
|
+
return AGENT_CAPABILITY_SET.has(capability);
|
|
86
|
+
}
|
|
87
|
+
export function assertAgentCapability(member, capability) {
|
|
88
|
+
if (member.kind !== 'agent') {
|
|
89
|
+
throw new Error(`authorization principal ${member.id} is not an agent member`);
|
|
90
|
+
}
|
|
91
|
+
if (!agentAllows(capability)) {
|
|
92
|
+
throw new Error(`forbidden: agent cannot ${capability.replaceAll('_', ' ')}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// harn:end agent-network-authority-is-narrow
|
|
96
|
+
//# sourceMappingURL=authorization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization.js","sourceRoot":"","sources":["../src/authorization.ts"],"names":[],"mappings":"AAkBA,MAAM,SAAS,GAAyB;IACtC,QAAQ,EAAE,CAAC;IACX,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;CACT,CAAC;AAEF,sEAAsE;AACtE,MAAM,CAAC,MAAM,uBAAuB,GAAkC;IACpE,IAAI,EAAE,UAAU;IAChB,SAAS,EAAE,UAAU;IACrB,cAAc,EAAE,UAAU;IAC1B,gBAAgB,EAAE,QAAQ;IAC1B,IAAI,EAAE,QAAQ;IACd,kBAAkB,EAAE,QAAQ;IAC5B,YAAY,EAAE,QAAQ;IACtB,SAAS,EAAE,OAAO;IAClB,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,OAAO;IACd,cAAc,EAAE,OAAO;IACvB,YAAY,EAAE,OAAO;IACrB,gBAAgB,EAAE,OAAO;IACzB,eAAe,EAAE,OAAO;IACxB,cAAc,EAAE,OAAO;IACvB,KAAK,EAAE,OAAO;IACd,0EAA0E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AAI,WAAW,UAAU,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CACtE,CAAC;IACJ,CAAC;AACH,CAAC;AACD,4CAA4C;AAE5C,4EAA4E;AAC5E,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,MAAM;IACN,MAAM;IACN,QAAQ;IACR,kBAAkB;IAClB,YAAY;IACZ,UAAU;IACV,eAAe;CACP,CAAC;AAKX,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAS,kBAAkB,CAAC,CAAC;AAEjE,MAAM,UAAU,WAAW,CAAC,UAA0B;IACpD,OAAO,oBAAoB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAc,EAAE,UAA0B;IAC9E,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,2BAA2B,MAAM,CAAC,EAAE,yBAAyB,CAAC,CAAC;IACjF,CAAC;IACD,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,2BAA2B,UAAU,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;IAChF,CAAC;AACH,CAAC;AACD,6CAA6C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { WireEvent } from '@codor/protocol';
|
|
2
|
+
/**
|
|
3
|
+
* Run event journal: JSONL blobs on disk, one per run message
|
|
4
|
+
* (`<root>/<room>/runs/<msg-id>.jsonl`), referenced by
|
|
5
|
+
* RunSummary.events_ref — the DB never stores event payloads.
|
|
6
|
+
*/
|
|
7
|
+
export declare class BlobStore {
|
|
8
|
+
private readonly root;
|
|
9
|
+
constructor(root: string);
|
|
10
|
+
ref(msgId: number): string;
|
|
11
|
+
path(room: string, ref: string): string;
|
|
12
|
+
append(room: string, ref: string, event: WireEvent): void;
|
|
13
|
+
/** All journaled events for a run; [] when the blob never got written. */
|
|
14
|
+
read(room: string, ref: string): WireEvent[];
|
|
15
|
+
exists(room: string, ref: string): boolean;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=blobs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blobs.d.ts","sourceRoot":"","sources":["../src/blobs.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;;;GAIG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;gBAElB,IAAI,EAAE,MAAM;IAIxB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAK1B,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAcvC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI;IAMzD,0EAA0E;IAC1E,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE;IAe5C,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;CAG3C"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { appendFileSync, existsSync, mkdirSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, isAbsolute, relative, resolve, sep } from 'node:path';
|
|
3
|
+
/**
|
|
4
|
+
* Run event journal: JSONL blobs on disk, one per run message
|
|
5
|
+
* (`<root>/<room>/runs/<msg-id>.jsonl`), referenced by
|
|
6
|
+
* RunSummary.events_ref — the DB never stores event payloads.
|
|
7
|
+
*/
|
|
8
|
+
export class BlobStore {
|
|
9
|
+
root;
|
|
10
|
+
constructor(root) {
|
|
11
|
+
this.root = resolve(root);
|
|
12
|
+
}
|
|
13
|
+
ref(msgId) {
|
|
14
|
+
return `runs/${msgId}.jsonl`;
|
|
15
|
+
}
|
|
16
|
+
// harn:assume blob-path-contained ref=blob-path-containment
|
|
17
|
+
path(room, ref) {
|
|
18
|
+
const file = resolve(this.root, room, ref);
|
|
19
|
+
const fromRoot = relative(this.root, file);
|
|
20
|
+
if (fromRoot === '..' ||
|
|
21
|
+
fromRoot.startsWith(`..${sep}`) ||
|
|
22
|
+
isAbsolute(fromRoot)) {
|
|
23
|
+
throw new Error('run blob path escapes the configured root');
|
|
24
|
+
}
|
|
25
|
+
return file;
|
|
26
|
+
}
|
|
27
|
+
// harn:end blob-path-contained
|
|
28
|
+
append(room, ref, event) {
|
|
29
|
+
const file = this.path(room, ref);
|
|
30
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
31
|
+
appendFileSync(file, `${JSON.stringify(event)}\n`);
|
|
32
|
+
}
|
|
33
|
+
/** All journaled events for a run; [] when the blob never got written. */
|
|
34
|
+
read(room, ref) {
|
|
35
|
+
const file = this.path(room, ref);
|
|
36
|
+
if (!existsSync(file))
|
|
37
|
+
return [];
|
|
38
|
+
return readFileSync(file, 'utf8')
|
|
39
|
+
.split('\n')
|
|
40
|
+
.filter((line) => line.trim() !== '')
|
|
41
|
+
.flatMap((line) => {
|
|
42
|
+
try {
|
|
43
|
+
return [JSON.parse(line)];
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
exists(room, ref) {
|
|
51
|
+
return existsSync(this.path(room, ref));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=blobs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blobs.js","sourceRoot":"","sources":["../src/blobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,UA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C,IAAI,CAAC;YAAE,OAAO,EAAE,CAAC;QACjC,OAAO,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC;aAC9B,KAAK,CAAC,IAAI,CAAC;aACX,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;aACpC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAChB,IAAI,CAAC;gBACH,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAc,CAAC,CAAC;YACzC,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC,CAAC,CAAC;IACP,CAAC;IAED,MAAM,CAAC,IAAY,EAAE,GAAW;QAC9B,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;IAC1C,CAAC;CACF"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { type Delivery } from '@codor/protocol';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export declare const CollaborationGroupStateSchema: z.ZodEnum<{
|
|
4
|
+
completed: "completed";
|
|
5
|
+
open: "open";
|
|
6
|
+
cancelled: "cancelled";
|
|
7
|
+
}>;
|
|
8
|
+
export type CollaborationGroupState = z.infer<typeof CollaborationGroupStateSchema>;
|
|
9
|
+
export declare const CollaborationRoundStateSchema: z.ZodEnum<{
|
|
10
|
+
collecting: "collecting";
|
|
11
|
+
released: "released";
|
|
12
|
+
closed: "closed";
|
|
13
|
+
}>;
|
|
14
|
+
export type CollaborationRoundState = z.infer<typeof CollaborationRoundStateSchema>;
|
|
15
|
+
export declare const CollaborationTerminalStatusSchema: z.ZodEnum<{
|
|
16
|
+
completed: "completed";
|
|
17
|
+
failed: "failed";
|
|
18
|
+
interrupted: "interrupted";
|
|
19
|
+
skipped: "skipped";
|
|
20
|
+
}>;
|
|
21
|
+
export type CollaborationTerminalStatus = z.infer<typeof CollaborationTerminalStatusSchema>;
|
|
22
|
+
export declare const CollaborationGroupSchema: z.ZodObject<{
|
|
23
|
+
id: z.ZodString;
|
|
24
|
+
room: z.ZodString;
|
|
25
|
+
root_message_id: z.ZodNumber;
|
|
26
|
+
state: z.ZodEnum<{
|
|
27
|
+
completed: "completed";
|
|
28
|
+
open: "open";
|
|
29
|
+
cancelled: "cancelled";
|
|
30
|
+
}>;
|
|
31
|
+
created_ts: z.ZodISODateTime;
|
|
32
|
+
completed_ts: z.ZodOptional<z.ZodISODateTime>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export type CollaborationGroup = z.infer<typeof CollaborationGroupSchema>;
|
|
35
|
+
export declare const CollaborationRoundSchema: z.ZodObject<{
|
|
36
|
+
group_id: z.ZodString;
|
|
37
|
+
round_number: z.ZodNumber;
|
|
38
|
+
state: z.ZodEnum<{
|
|
39
|
+
collecting: "collecting";
|
|
40
|
+
released: "released";
|
|
41
|
+
closed: "closed";
|
|
42
|
+
}>;
|
|
43
|
+
created_ts: z.ZodISODateTime;
|
|
44
|
+
released_ts: z.ZodOptional<z.ZodISODateTime>;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
export type CollaborationRound = z.infer<typeof CollaborationRoundSchema>;
|
|
47
|
+
export declare const CollaborationParticipantSchema: z.ZodObject<{
|
|
48
|
+
group_id: z.ZodString;
|
|
49
|
+
round_number: z.ZodNumber;
|
|
50
|
+
ordinal: z.ZodNumber;
|
|
51
|
+
member_id: z.ZodULID;
|
|
52
|
+
delivery_id: z.ZodString;
|
|
53
|
+
terminal_status: z.ZodOptional<z.ZodEnum<{
|
|
54
|
+
completed: "completed";
|
|
55
|
+
failed: "failed";
|
|
56
|
+
interrupted: "interrupted";
|
|
57
|
+
skipped: "skipped";
|
|
58
|
+
}>>;
|
|
59
|
+
result_message_id: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
completed_ts: z.ZodOptional<z.ZodISODateTime>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
export type CollaborationParticipant = z.infer<typeof CollaborationParticipantSchema>;
|
|
63
|
+
export interface CollaborationRoundParticipantInput {
|
|
64
|
+
memberId: string;
|
|
65
|
+
payloadSnapshot: string;
|
|
66
|
+
state?: Delivery['state'];
|
|
67
|
+
hopCount?: number;
|
|
68
|
+
}
|
|
69
|
+
export interface CollaborationRoundProjection {
|
|
70
|
+
group: CollaborationGroup;
|
|
71
|
+
round: CollaborationRound;
|
|
72
|
+
participants: CollaborationParticipant[];
|
|
73
|
+
deliveries: Delivery[];
|
|
74
|
+
}
|
|
75
|
+
export type GroupResultPresentationStatus = CollaborationTerminalStatus | 'acknowledged';
|
|
76
|
+
export interface GroupRoundPayloadContext {
|
|
77
|
+
groupId: string;
|
|
78
|
+
roundNumber: number;
|
|
79
|
+
room: string;
|
|
80
|
+
root: {
|
|
81
|
+
messageId: number;
|
|
82
|
+
authorHandle: string;
|
|
83
|
+
body: string;
|
|
84
|
+
};
|
|
85
|
+
refs?: {
|
|
86
|
+
id: number;
|
|
87
|
+
authorHandle: string;
|
|
88
|
+
ts: string;
|
|
89
|
+
body: string;
|
|
90
|
+
}[];
|
|
91
|
+
ledgerRefs?: {
|
|
92
|
+
name: string;
|
|
93
|
+
body: string;
|
|
94
|
+
}[];
|
|
95
|
+
priorRoundNumber?: number;
|
|
96
|
+
results?: {
|
|
97
|
+
ordinal: number;
|
|
98
|
+
memberHandle: string;
|
|
99
|
+
status: GroupResultPresentationStatus;
|
|
100
|
+
messageId?: number;
|
|
101
|
+
body?: string;
|
|
102
|
+
}[];
|
|
103
|
+
}
|
|
104
|
+
export declare function composeGroupRoundPayload(ctx: GroupRoundPayloadContext, you: string): string;
|
|
105
|
+
export type DeliveryBatchClass = {
|
|
106
|
+
kind: 'ordinary';
|
|
107
|
+
} | {
|
|
108
|
+
kind: 'group';
|
|
109
|
+
groupId: string;
|
|
110
|
+
roundNumber: number;
|
|
111
|
+
};
|
|
112
|
+
export declare function deliveryBatchClass(delivery: Delivery): DeliveryBatchClass;
|
|
113
|
+
/** The caller supplies deliveries in durable FIFO order. */
|
|
114
|
+
export declare function selectDeliveryBatchPrefix(deliveries: Delivery[]): Delivery[];
|
|
115
|
+
//# sourceMappingURL=collaboration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collaboration.d.ts","sourceRoot":"","sources":["../src/collaboration.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EAKd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,6BAA6B;;;;EAA6C,CAAC;AACxF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,eAAO,MAAM,6BAA6B;;;;EAA+C,CAAC;AAC1F,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,eAAO,MAAM,iCAAiC;;;;;EAK5C,CAAC;AACH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAE5F,eAAO,MAAM,wBAAwB;;;;;;;;;;;iBAOnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,wBAAwB;;;;;;;;;;iBAMnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;iBASzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF,MAAM,WAAW,kCAAkC;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MA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,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAG5D,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,kBAAkB,CAIzE;AAWD,4DAA4D;AAC5D,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE,CAS5E"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { MemberIdSchema, MessageIdSchema, RoomIdSchema, TimestampSchema, } from '@codor/protocol';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export const CollaborationGroupStateSchema = z.enum(['open', 'completed', 'cancelled']);
|
|
4
|
+
export const CollaborationRoundStateSchema = z.enum(['collecting', 'released', 'closed']);
|
|
5
|
+
export const CollaborationTerminalStatusSchema = z.enum([
|
|
6
|
+
'completed',
|
|
7
|
+
'failed',
|
|
8
|
+
'interrupted',
|
|
9
|
+
'skipped',
|
|
10
|
+
]);
|
|
11
|
+
export const CollaborationGroupSchema = z.object({
|
|
12
|
+
id: z.string().min(1),
|
|
13
|
+
room: RoomIdSchema,
|
|
14
|
+
root_message_id: MessageIdSchema,
|
|
15
|
+
state: CollaborationGroupStateSchema,
|
|
16
|
+
created_ts: TimestampSchema,
|
|
17
|
+
completed_ts: TimestampSchema.optional(),
|
|
18
|
+
});
|
|
19
|
+
export const CollaborationRoundSchema = z.object({
|
|
20
|
+
group_id: z.string().min(1),
|
|
21
|
+
round_number: z.number().int().positive(),
|
|
22
|
+
state: CollaborationRoundStateSchema,
|
|
23
|
+
created_ts: TimestampSchema,
|
|
24
|
+
released_ts: TimestampSchema.optional(),
|
|
25
|
+
});
|
|
26
|
+
export const CollaborationParticipantSchema = z.object({
|
|
27
|
+
group_id: z.string().min(1),
|
|
28
|
+
round_number: z.number().int().positive(),
|
|
29
|
+
ordinal: z.number().int().nonnegative(),
|
|
30
|
+
member_id: MemberIdSchema,
|
|
31
|
+
delivery_id: z.string().min(1),
|
|
32
|
+
terminal_status: CollaborationTerminalStatusSchema.optional(),
|
|
33
|
+
result_message_id: MessageIdSchema.optional(),
|
|
34
|
+
completed_ts: TimestampSchema.optional(),
|
|
35
|
+
});
|
|
36
|
+
const minuteUtc = (ts) => `${ts.slice(0, 16)}Z`;
|
|
37
|
+
const statusBody = (handle, status, body) => {
|
|
38
|
+
if (status === 'acknowledged')
|
|
39
|
+
return `[@${handle} acknowledged; no substantive response.]`;
|
|
40
|
+
if (body !== undefined && body !== '')
|
|
41
|
+
return body;
|
|
42
|
+
if (status === 'failed')
|
|
43
|
+
return '[No final response. The run failed.]';
|
|
44
|
+
if (status === 'interrupted')
|
|
45
|
+
return '[No final response. The run was interrupted.]';
|
|
46
|
+
if (status === 'skipped')
|
|
47
|
+
return '[No turn started. The member was removed or unavailable.]';
|
|
48
|
+
return '[No final response.]';
|
|
49
|
+
};
|
|
50
|
+
// harn:assume group-round-payloads-share-one-ordered-view ref=group-round-payload-composer
|
|
51
|
+
// harn:assume group-round-routing-instruction-is-always-on ref=group-routing-instruction
|
|
52
|
+
// harn:assume group-routing-briefing-names-cost-and-wait-outcome ref=group-routing-cost-wait-guidance
|
|
53
|
+
const GROUP_ROUTING_INSTRUCTION = '[group routing: all participants in this round run independently. Your normal final reply ' +
|
|
54
|
+
'posts to the channel immediately; peer agents receive all terminal results together only as ' +
|
|
55
|
+
'the next-round context after this round ends. Use codor post only for an immediate in-round ' +
|
|
56
|
+
'update, question, or answer. An @mention in your final response starts another paid group ' +
|
|
57
|
+
"round, so use one only when you genuinely intend to invoke that member; write the member's " +
|
|
58
|
+
'plain name without @ when merely discussing them. If every peer you are waiting on finishes ' +
|
|
59
|
+
'without an interim reply, Codor ends the wait automatically. Use <ACK_OK> as your entire ' +
|
|
60
|
+
'onward response only when no action and no answer are needed; never append it after doing ' +
|
|
61
|
+
'work or as a sign-off.]';
|
|
62
|
+
// harn:end group-routing-briefing-names-cost-and-wait-outcome
|
|
63
|
+
export function composeGroupRoundPayload(ctx, you) {
|
|
64
|
+
let payload = `[codor group=${ctx.groupId} round=${ctx.roundNumber} channel=${ctx.room}\n` +
|
|
65
|
+
` root=#${ctx.root.messageId} - you=@${you}]\n\n` +
|
|
66
|
+
`--- group request #${ctx.root.messageId} - @${ctx.root.authorHandle} ---\n` +
|
|
67
|
+
`${ctx.root.body}\n` +
|
|
68
|
+
'--- end group request ---\n';
|
|
69
|
+
for (const ref of ctx.refs ?? []) {
|
|
70
|
+
payload +=
|
|
71
|
+
`\n--- referenced #${ref.id} - @${ref.authorHandle} - ${minuteUtc(ref.ts)} ---\n` +
|
|
72
|
+
`${ref.body}\n` +
|
|
73
|
+
'--- end reference ---\n';
|
|
74
|
+
}
|
|
75
|
+
for (const ref of ctx.ledgerRefs ?? []) {
|
|
76
|
+
payload +=
|
|
77
|
+
`\n--- ledger [[${ref.name}]] ---\n` +
|
|
78
|
+
`${ref.body}\n` +
|
|
79
|
+
'--- end ledger note ---\n';
|
|
80
|
+
}
|
|
81
|
+
const results = [...(ctx.results ?? [])].sort((a, b) => a.ordinal - b.ordinal);
|
|
82
|
+
if (results.length > 0 && ctx.priorRoundNumber === undefined) {
|
|
83
|
+
throw new Error('priorRoundNumber is required when group results are present');
|
|
84
|
+
}
|
|
85
|
+
for (const [index, result] of results.entries()) {
|
|
86
|
+
const message = result.messageId === undefined ? '' : ` - #${result.messageId}`;
|
|
87
|
+
payload +=
|
|
88
|
+
`\n--- completed round ${ctx.priorRoundNumber} result ${index + 1}/${results.length}` +
|
|
89
|
+
` - @${result.memberHandle} - ${result.status}${message} ---\n` +
|
|
90
|
+
`${statusBody(result.memberHandle, result.status, result.body)}\n` +
|
|
91
|
+
'--- end result ---\n';
|
|
92
|
+
}
|
|
93
|
+
payload += `\n${GROUP_ROUTING_INSTRUCTION}\n`;
|
|
94
|
+
return payload;
|
|
95
|
+
}
|
|
96
|
+
// harn:assume grouped-deliveries-have-an-isolated-batch-class ref=group-delivery-batch-classifier
|
|
97
|
+
export function deliveryBatchClass(delivery) {
|
|
98
|
+
return delivery.group_id === undefined
|
|
99
|
+
? { kind: 'ordinary' }
|
|
100
|
+
: { kind: 'group', groupId: delivery.group_id, roundNumber: delivery.group_round };
|
|
101
|
+
}
|
|
102
|
+
function sameBatchClass(left, right) {
|
|
103
|
+
if (left.kind !== right.kind)
|
|
104
|
+
return false;
|
|
105
|
+
return left.kind === 'ordinary' || (right.kind === 'group' &&
|
|
106
|
+
left.groupId === right.groupId &&
|
|
107
|
+
left.roundNumber === right.roundNumber);
|
|
108
|
+
}
|
|
109
|
+
/** The caller supplies deliveries in durable FIFO order. */
|
|
110
|
+
export function selectDeliveryBatchPrefix(deliveries) {
|
|
111
|
+
if (deliveries.length === 0)
|
|
112
|
+
return [];
|
|
113
|
+
const firstClass = deliveryBatchClass(deliveries[0]);
|
|
114
|
+
const selected = [];
|
|
115
|
+
for (const delivery of deliveries) {
|
|
116
|
+
if (!sameBatchClass(firstClass, deliveryBatchClass(delivery)))
|
|
117
|
+
break;
|
|
118
|
+
selected.push(delivery);
|
|
119
|
+
}
|
|
120
|
+
return selected;
|
|
121
|
+
}
|
|
122
|
+
// harn:end grouped-deliveries-have-an-isolated-batch-class
|
|
123
|
+
//# sourceMappingURL=collaboration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collaboration.js","sourceRoot":"","sources":["../src/collaboration.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,eAAe,EACf,YAAY,EACZ,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;AAGxF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,IAAI,CAAC,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;QACrE,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AACD,2DAA2D"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { WireEvent } from '@codor/protocol';
|
|
2
|
+
export interface ContinuationAllocation {
|
|
3
|
+
id: number;
|
|
4
|
+
created: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface ContinuationProjection {
|
|
7
|
+
resultMessageId: number;
|
|
8
|
+
bodies: Map<number, string>;
|
|
9
|
+
referencedMessageIds: Set<number>;
|
|
10
|
+
substantiveMessageIds: Set<number>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Assigns normalized run events to permanent output messages. The Store-owned
|
|
14
|
+
* allocator is called only when a visible event follows a newer durable room
|
|
15
|
+
* message. Its returned row therefore exists before the caller journals or
|
|
16
|
+
* broadcasts the id.
|
|
17
|
+
*/
|
|
18
|
+
export declare class ContinuationWriter {
|
|
19
|
+
readonly rootMessageId: number;
|
|
20
|
+
private currentOutputId;
|
|
21
|
+
private readonly toolOutputs;
|
|
22
|
+
private readonly pendingCompactions;
|
|
23
|
+
private streamedText;
|
|
24
|
+
constructor(rootMessageId: number, journal?: readonly WireEvent[]);
|
|
25
|
+
assign(event: WireEvent, latestMessageId: number, allocate: () => number): {
|
|
26
|
+
event: WireEvent;
|
|
27
|
+
allocation?: ContinuationAllocation;
|
|
28
|
+
};
|
|
29
|
+
private observe;
|
|
30
|
+
}
|
|
31
|
+
/** Rebuild the exact per-row prose and terminal identity from one root journal. */
|
|
32
|
+
export declare function projectContinuationOutputs(rootMessageId: number, events: readonly WireEvent[]): ContinuationProjection;
|
|
33
|
+
//# sourceMappingURL=continuation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"continuation.d.ts","sourceRoot":"","sources":["../src/continuation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAKjD,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,oBAAoB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,qBAAqB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACpC;AAkCD;;;;;GAKG;AACH,qBAAa,kBAAkB;IAO3B,QAAQ,CAAC,aAAa,EAAE,MAAM;IANhC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA6B;IACzD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAgB;IACnD,OAAO,CAAC,YAAY,CAAM;gBAGf,aAAa,EAAE,MAAM,EAC9B,OAAO,GAAE,SAAS,SAAS,EAAO;IAMpC,MAAM,CACJ,KAAK,EAAE,SAAS,EAChB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,MAAM,MAAM,GACrB;QAAE,KAAK,EAAE,SAAS,CAAC;QAAC,UAAU,CAAC,EAAE,sBAAsB,CAAA;KAAE;IAqD5D,OAAO,CAAC,OAAO;CAuBhB;AAED,mFAAmF;AACnF,wBAAgB,0BAA0B,CACxC,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,SAAS,SAAS,EAAE,GAC3B,sBAAsB,CAwCxB"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
function targetOf(event) {
|
|
2
|
+
return event.type === 'run.item'
|
|
3
|
+
|| event.type === 'timeline'
|
|
4
|
+
|| event.type === 'run.completed'
|
|
5
|
+
? event.output_message_id
|
|
6
|
+
: undefined;
|
|
7
|
+
}
|
|
8
|
+
function callId(event) {
|
|
9
|
+
if (event.item_type !== 'tool_call' && event.item_type !== 'tool_result')
|
|
10
|
+
return undefined;
|
|
11
|
+
const payload = event.payload;
|
|
12
|
+
return typeof payload.call_id === 'string' ? payload.call_id : undefined;
|
|
13
|
+
}
|
|
14
|
+
function textOf(event) {
|
|
15
|
+
if (event.item_type !== 'text_delta')
|
|
16
|
+
return '';
|
|
17
|
+
const payload = event.payload;
|
|
18
|
+
return typeof payload.text === 'string' ? payload.text : '';
|
|
19
|
+
}
|
|
20
|
+
function completionResidual(finalText, streamed) {
|
|
21
|
+
if (finalText === undefined || finalText.length === 0)
|
|
22
|
+
return '';
|
|
23
|
+
if (streamed.length === 0)
|
|
24
|
+
return finalText;
|
|
25
|
+
if (finalText.startsWith(streamed))
|
|
26
|
+
return finalText.slice(streamed.length);
|
|
27
|
+
// Several harnesses stream interim narration and then repeat only the final
|
|
28
|
+
// answer as `final_text`. That suffix is already durable journal prose; adding
|
|
29
|
+
// it again would create a third block and duplicate the visible reply.
|
|
30
|
+
if (streamed.endsWith(finalText))
|
|
31
|
+
return '';
|
|
32
|
+
return finalText;
|
|
33
|
+
}
|
|
34
|
+
// harn:assume continuation-writer-follows-journaled-output-ownership ref=continuation-segmentation-engine
|
|
35
|
+
/**
|
|
36
|
+
* Assigns normalized run events to permanent output messages. The Store-owned
|
|
37
|
+
* allocator is called only when a visible event follows a newer durable room
|
|
38
|
+
* message. Its returned row therefore exists before the caller journals or
|
|
39
|
+
* broadcasts the id.
|
|
40
|
+
*/
|
|
41
|
+
export class ContinuationWriter {
|
|
42
|
+
rootMessageId;
|
|
43
|
+
currentOutputId;
|
|
44
|
+
toolOutputs = new Map();
|
|
45
|
+
pendingCompactions = [];
|
|
46
|
+
streamedText = '';
|
|
47
|
+
constructor(rootMessageId, journal = []) {
|
|
48
|
+
this.rootMessageId = rootMessageId;
|
|
49
|
+
this.currentOutputId = rootMessageId;
|
|
50
|
+
for (const event of journal)
|
|
51
|
+
this.observe(event);
|
|
52
|
+
}
|
|
53
|
+
assign(event, latestMessageId, allocate) {
|
|
54
|
+
if (event.type !== 'run.item' && event.type !== 'timeline' && event.type !== 'run.completed') {
|
|
55
|
+
return { event };
|
|
56
|
+
}
|
|
57
|
+
if (event.output_message_id !== undefined) {
|
|
58
|
+
this.observe(event);
|
|
59
|
+
return { event };
|
|
60
|
+
}
|
|
61
|
+
let outputId = this.currentOutputId;
|
|
62
|
+
let created = false;
|
|
63
|
+
const allocateAfterInterleave = () => {
|
|
64
|
+
if (latestMessageId <= this.currentOutputId)
|
|
65
|
+
return;
|
|
66
|
+
outputId = allocate();
|
|
67
|
+
this.currentOutputId = outputId;
|
|
68
|
+
created = true;
|
|
69
|
+
};
|
|
70
|
+
if (event.type === 'run.item') {
|
|
71
|
+
const id = callId(event);
|
|
72
|
+
if (event.item_type === 'tool_result') {
|
|
73
|
+
outputId = id === undefined ? this.currentOutputId : (this.toolOutputs.get(id) ?? this.currentOutputId);
|
|
74
|
+
}
|
|
75
|
+
else if (event.item_type === 'reasoning_summary') {
|
|
76
|
+
outputId = this.currentOutputId;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
allocateAfterInterleave();
|
|
80
|
+
outputId = this.currentOutputId;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else if (event.type === 'timeline') {
|
|
84
|
+
if (event.item.status === 'completed') {
|
|
85
|
+
outputId = this.pendingCompactions.shift() ?? this.currentOutputId;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
allocateAfterInterleave();
|
|
89
|
+
outputId = this.currentOutputId;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
if (event.status !== 'failed'
|
|
94
|
+
&& completionResidual(event.final_text, this.streamedText).length > 0) {
|
|
95
|
+
allocateAfterInterleave();
|
|
96
|
+
}
|
|
97
|
+
outputId = this.currentOutputId;
|
|
98
|
+
}
|
|
99
|
+
const assigned = { ...event, output_message_id: outputId };
|
|
100
|
+
this.observe(assigned);
|
|
101
|
+
return {
|
|
102
|
+
event: assigned,
|
|
103
|
+
...(created ? { allocation: { id: outputId, created: true } } : {}),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
observe(event) {
|
|
107
|
+
const target = targetOf(event) ?? this.rootMessageId;
|
|
108
|
+
if (event.type === 'run.item') {
|
|
109
|
+
const id = callId(event);
|
|
110
|
+
if (event.item_type === 'tool_call' && id !== undefined)
|
|
111
|
+
this.toolOutputs.set(id, target);
|
|
112
|
+
if (event.item_type === 'text_delta')
|
|
113
|
+
this.streamedText += textOf(event);
|
|
114
|
+
if (event.item_type !== 'tool_result' && event.item_type !== 'reasoning_summary') {
|
|
115
|
+
this.currentOutputId = target;
|
|
116
|
+
}
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (event.type === 'timeline') {
|
|
120
|
+
if (event.item.status === 'loading') {
|
|
121
|
+
this.pendingCompactions.push(target);
|
|
122
|
+
this.currentOutputId = target;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
const index = this.pendingCompactions.indexOf(target);
|
|
126
|
+
if (index >= 0)
|
|
127
|
+
this.pendingCompactions.splice(index, 1);
|
|
128
|
+
}
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (event.type === 'run.completed')
|
|
132
|
+
this.currentOutputId = target;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/** Rebuild the exact per-row prose and terminal identity from one root journal. */
|
|
136
|
+
export function projectContinuationOutputs(rootMessageId, events) {
|
|
137
|
+
const bodies = new Map([[rootMessageId, '']]);
|
|
138
|
+
const referencedMessageIds = new Set([rootMessageId]);
|
|
139
|
+
const substantiveMessageIds = new Set();
|
|
140
|
+
let streamed = '';
|
|
141
|
+
let resultMessageId = rootMessageId;
|
|
142
|
+
for (const event of events) {
|
|
143
|
+
if (event.type !== 'run.item' && event.type !== 'timeline' && event.type !== 'run.completed')
|
|
144
|
+
continue;
|
|
145
|
+
const target = event.output_message_id ?? rootMessageId;
|
|
146
|
+
referencedMessageIds.add(target);
|
|
147
|
+
if (!bodies.has(target))
|
|
148
|
+
bodies.set(target, '');
|
|
149
|
+
resultMessageId = target;
|
|
150
|
+
if (event.type === 'run.item') {
|
|
151
|
+
const text = textOf(event);
|
|
152
|
+
if (text.length > 0) {
|
|
153
|
+
bodies.set(target, (bodies.get(target) ?? '') + text);
|
|
154
|
+
streamed += text;
|
|
155
|
+
substantiveMessageIds.add(target);
|
|
156
|
+
}
|
|
157
|
+
else if (event.item_type !== 'reasoning_summary') {
|
|
158
|
+
substantiveMessageIds.add(target);
|
|
159
|
+
}
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
if (event.type === 'timeline') {
|
|
163
|
+
substantiveMessageIds.add(target);
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
const residual = event.status === 'failed'
|
|
167
|
+
? ''
|
|
168
|
+
: completionResidual(event.final_text, streamed);
|
|
169
|
+
if (residual.length > 0) {
|
|
170
|
+
bodies.set(target, (bodies.get(target) ?? '') + residual);
|
|
171
|
+
substantiveMessageIds.add(target);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return { resultMessageId, bodies, referencedMessageIds, substantiveMessageIds };
|
|
175
|
+
}
|
|
176
|
+
// harn:end continuation-writer-follows-journaled-output-ownership
|
|
177
|
+
//# sourceMappingURL=continuation.js.map
|