@otium-team/negotium 0.0.0-stage → 0.23.13
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 +202 -0
- package/README.md +329 -2
- package/bin/codex-sdk-window-hide.mjs +40 -0
- package/bin/negotium.mjs +22 -0
- package/dist/agent-helpers.js +23090 -0
- package/dist/agent-helpers.js.map +171 -0
- package/dist/background-bash.js +535 -0
- package/dist/background-bash.js.map +16 -0
- package/dist/browser-runtime.js +2334 -0
- package/dist/browser-runtime.js.map +35 -0
- package/dist/canonical-mcp-bridge.js +13 -0
- package/dist/canonical-mcp-bridge.js.map +9 -0
- package/dist/chunk-22kg3fsw.js +79 -0
- package/dist/chunk-22kg3fsw.js.map +9 -0
- package/dist/chunk-d4j77adx.js +336 -0
- package/dist/chunk-d4j77adx.js.map +13 -0
- package/dist/chunk-mk9x18jn.js +172 -0
- package/dist/chunk-mk9x18jn.js.map +12 -0
- package/dist/chunk-qd0vtfm2.js +3923 -0
- package/dist/chunk-qd0vtfm2.js.map +47 -0
- package/dist/chunk-wf7ny8eq.js +206 -0
- package/dist/chunk-wf7ny8eq.js.map +10 -0
- package/dist/chunk-ww8a4ej4.js +54 -0
- package/dist/chunk-ww8a4ej4.js.map +10 -0
- package/dist/cron.js +1 -0
- package/dist/hosted-agent.js +5982 -0
- package/dist/hosted-agent.js.map +62 -0
- package/dist/main.js +60229 -0
- package/dist/main.js.map +340 -0
- package/dist/mcp-catalog.js +39 -0
- package/dist/mcp-catalog.js.map +10 -0
- package/dist/mcp-factories.js +25767 -0
- package/dist/mcp-factories.js.map +181 -0
- package/dist/mcp-servers.js +50 -0
- package/dist/mcp-servers.js.map +10 -0
- package/dist/media.js +570 -0
- package/dist/media.js.map +15 -0
- package/dist/outbox.js +354 -0
- package/dist/outbox.js.map +15 -0
- package/dist/platform-runtime.js +73 -0
- package/dist/platform-runtime.js.map +12 -0
- package/dist/prompts.js +892 -0
- package/dist/prompts.js.map +15 -0
- package/dist/query-runtime.js +1071 -0
- package/dist/query-runtime.js.map +26 -0
- package/dist/registry.js +335 -0
- package/dist/registry.js.map +14 -0
- package/dist/rollout.js +57 -0
- package/dist/rollout.js.map +10 -0
- package/dist/runtime/cron/background-sessions.ts +119 -0
- package/dist/runtime/cron/context.ts +123 -0
- package/dist/runtime/cron/host.ts +67 -0
- package/dist/runtime/cron/index.ts +95 -0
- package/dist/runtime/cron/mcp-server.ts +556 -0
- package/dist/runtime/cron/module.ts +174 -0
- package/dist/runtime/cron/package.json +6 -0
- package/dist/runtime/cron/schedule.ts +211 -0
- package/dist/runtime/cron/scheduler.ts +444 -0
- package/dist/runtime/cron/scripts.ts +203 -0
- package/dist/runtime/cron/store.ts +1163 -0
- package/dist/runtime/cron/summarize.ts +115 -0
- package/dist/runtime/package.json +6 -0
- package/dist/runtime/scripts/faster-whisper-wrapper.py +87 -0
- package/dist/runtime/src/agents/api-topic-agent-switch.ts +179 -0
- package/dist/runtime/src/agents/archiver.ts +677 -0
- package/dist/runtime/src/agents/auth-check.ts +156 -0
- package/dist/runtime/src/agents/claude-notices.ts +130 -0
- package/dist/runtime/src/agents/claude-provider.ts +941 -0
- package/dist/runtime/src/agents/claude-registry.ts +117 -0
- package/dist/runtime/src/agents/claude-runtime-inspection.ts +43 -0
- package/dist/runtime/src/agents/codex-app-server.ts +138 -0
- package/dist/runtime/src/agents/codex-native-multi-agent.ts +360 -0
- package/dist/runtime/src/agents/codex-provider.ts +1193 -0
- package/dist/runtime/src/agents/codex-registry.ts +116 -0
- package/dist/runtime/src/agents/codex-tier-resolver.ts +74 -0
- package/dist/runtime/src/agents/codex-tree-kill.ts +54 -0
- package/dist/runtime/src/agents/codex-tree-manager.ts +230 -0
- package/dist/runtime/src/agents/codex-vault-hook-bridge.ts +240 -0
- package/dist/runtime/src/agents/codex-vault-hook.mjs +50 -0
- package/dist/runtime/src/agents/codex-windows-wrapper.ts +174 -0
- package/dist/runtime/src/agents/compaction-support.ts +75 -0
- package/dist/runtime/src/agents/compaction-tool-projection.ts +125 -0
- package/dist/runtime/src/agents/contracts.ts +75 -0
- package/dist/runtime/src/agents/deep-map.ts +13 -0
- package/dist/runtime/src/agents/execution-host.ts +118 -0
- package/dist/runtime/src/agents/explicit-agent-switch.ts +106 -0
- package/dist/runtime/src/agents/fixtures/claude-attachments.jsonl +2 -0
- package/dist/runtime/src/agents/fixtures/codex-shell.jsonl +5 -0
- package/dist/runtime/src/agents/fork.ts +100 -0
- package/dist/runtime/src/agents/hosted-agent.ts +78 -0
- package/dist/runtime/src/agents/idle-archiver.ts +225 -0
- package/dist/runtime/src/agents/idle-compact.ts +225 -0
- package/dist/runtime/src/agents/index.ts +225 -0
- package/dist/runtime/src/agents/maestro-provider.ts +246 -0
- package/dist/runtime/src/agents/maestro-registry.ts +189 -0
- package/dist/runtime/src/agents/mcp-tools/ask-user.ts +653 -0
- package/dist/runtime/src/agents/mcp-tools/common.ts +23 -0
- package/dist/runtime/src/agents/mcp-tools/inline-assets.ts +203 -0
- package/dist/runtime/src/agents/mcp-tools/publish-html.ts +183 -0
- package/dist/runtime/src/agents/mcp-tools/request-vault.ts +684 -0
- package/dist/runtime/src/agents/mcp-tools/self-config.ts +353 -0
- package/dist/runtime/src/agents/mcp-tools/spawn-subagent.ts +1349 -0
- package/dist/runtime/src/agents/mcp-tools/visual-compat.ts +18 -0
- package/dist/runtime/src/agents/mcp-tools/visuals.ts +60 -0
- package/dist/runtime/src/agents/memory-archive-policy.ts +54 -0
- package/dist/runtime/src/agents/model-catalog.ts +439 -0
- package/dist/runtime/src/agents/public-helpers.ts +149 -0
- package/dist/runtime/src/agents/registry.ts +35 -0
- package/dist/runtime/src/agents/rollout/claude.ts +336 -0
- package/dist/runtime/src/agents/rollout/codex.ts +910 -0
- package/dist/runtime/src/agents/rollout/index.ts +26 -0
- package/dist/runtime/src/agents/rollout/shared.ts +293 -0
- package/dist/runtime/src/agents/self-config-core.ts +704 -0
- package/dist/runtime/src/agents/task-events.ts +59 -0
- package/dist/runtime/src/agents/tool-format.ts +613 -0
- package/dist/runtime/src/agents/topic-agent-switch.ts +189 -0
- package/dist/runtime/src/agents/topic-cleanup.ts +285 -0
- package/dist/runtime/src/agents/vault-tool-policy.ts +36 -0
- package/dist/runtime/src/application/execute-external-user-turn.ts +23 -0
- package/dist/runtime/src/application/submit-runtime-gateway-turn.ts +484 -0
- package/dist/runtime/src/application/submit-user-message.ts +60 -0
- package/dist/runtime/src/application/switch-topic-effort.ts +48 -0
- package/dist/runtime/src/application/switch-topic-model.ts +79 -0
- package/dist/runtime/src/application/topic-service.ts +190 -0
- package/dist/runtime/src/application/turn-follow-ups.ts +291 -0
- package/dist/runtime/src/application/vault-command.ts +170 -0
- package/dist/runtime/src/bus.ts +409 -0
- package/dist/runtime/src/config-public.ts +2 -0
- package/dist/runtime/src/cron-host.ts +33 -0
- package/dist/runtime/src/cron-mcp-host.ts +5 -0
- package/dist/runtime/src/identifiers.ts +49 -0
- package/dist/runtime/src/index.ts +573 -0
- package/dist/runtime/src/mcp/agent-health-server.ts +8 -0
- package/dist/runtime/src/mcp/canonical-bridge-config.ts +84 -0
- package/dist/runtime/src/mcp/canonical-proxy-server.ts +308 -0
- package/dist/runtime/src/mcp/compaction-log-server.ts +25 -0
- package/dist/runtime/src/mcp/decision-server.ts +21 -0
- package/dist/runtime/src/mcp/dm-ipc.ts +60 -0
- package/dist/runtime/src/mcp/factories/agent-health.ts +394 -0
- package/dist/runtime/src/mcp/factories/compaction-log.ts +135 -0
- package/dist/runtime/src/mcp/factories/decision.ts +186 -0
- package/dist/runtime/src/mcp/factories/index.ts +73 -0
- package/dist/runtime/src/mcp/factories/session-comm.ts +184 -0
- package/dist/runtime/src/mcp/factories/session-history.ts +103 -0
- package/dist/runtime/src/mcp/factories/stdio-protection.ts +24 -0
- package/dist/runtime/src/mcp/factories/system-health.ts +259 -0
- package/dist/runtime/src/mcp/factories/task.ts +185 -0
- package/dist/runtime/src/mcp/factories/token-stats.ts +145 -0
- package/dist/runtime/src/mcp/factories/vault.ts +32 -0
- package/dist/runtime/src/mcp/mcp-helpers.ts +40 -0
- package/dist/runtime/src/mcp/peer-bridge.ts +119 -0
- package/dist/runtime/src/mcp/runtime-spec.ts +473 -0
- package/dist/runtime/src/mcp/session-comm/actor-policy.ts +160 -0
- package/dist/runtime/src/mcp/session-comm/bridge-ipc-config.ts +27 -0
- package/dist/runtime/src/mcp/session-comm/context.ts +113 -0
- package/dist/runtime/src/mcp/session-comm/default-host.ts +723 -0
- package/dist/runtime/src/mcp/session-comm/history-target.ts +89 -0
- package/dist/runtime/src/mcp/session-comm/history-tools.ts +113 -0
- package/dist/runtime/src/mcp/session-comm/hub-remote-session.ts +553 -0
- package/dist/runtime/src/mcp/session-comm/limits.ts +8 -0
- package/dist/runtime/src/mcp/session-comm/peer-forward.ts +251 -0
- package/dist/runtime/src/mcp/session-comm/runtime.ts +128 -0
- package/dist/runtime/src/mcp/session-comm/server.ts +1036 -0
- package/dist/runtime/src/mcp/session-comm/tell-permissions.ts +79 -0
- package/dist/runtime/src/mcp/session-comm/topic-catalog.ts +155 -0
- package/dist/runtime/src/mcp/session-comm/topic-config.ts +137 -0
- package/dist/runtime/src/mcp/session-comm/topics.ts +313 -0
- package/dist/runtime/src/mcp/session-history-limits.ts +36 -0
- package/dist/runtime/src/mcp/session-history-reader.ts +359 -0
- package/dist/runtime/src/mcp/session-history-server.ts +19 -0
- package/dist/runtime/src/mcp/stdio-protect.ts +7 -0
- package/dist/runtime/src/mcp/system-health-server.ts +5 -0
- package/dist/runtime/src/mcp/task-server.ts +17 -0
- package/dist/runtime/src/mcp/token-stats-server.ts +10 -0
- package/dist/runtime/src/mcp/vault-server.ts +12 -0
- package/dist/runtime/src/mcp/wiki-search-index.ts +359 -0
- package/dist/runtime/src/mcp/wiki-server.ts +2386 -0
- package/dist/runtime/src/mcp-runtime-host.ts +81 -0
- package/dist/runtime/src/media/file-events.ts +33 -0
- package/dist/runtime/src/media/text-extractor.ts +334 -0
- package/dist/runtime/src/media/video.ts +92 -0
- package/dist/runtime/src/node-host.ts +211 -0
- package/dist/runtime/src/outbox/coalescing-runner.ts +157 -0
- package/dist/runtime/src/outbox/file-ops.ts +267 -0
- package/dist/runtime/src/outbox/index.ts +26 -0
- package/dist/runtime/src/outbox/utils.ts +74 -0
- package/dist/runtime/src/platform/background-bash/context.ts +9 -0
- package/dist/runtime/src/platform/background-bash/manager.ts +292 -0
- package/dist/runtime/src/platform/background-bash/output-buffer.ts +323 -0
- package/dist/runtime/src/platform/config-helpers.ts +47 -0
- package/dist/runtime/src/platform/config.ts +618 -0
- package/dist/runtime/src/platform/constants.ts +30 -0
- package/dist/runtime/src/platform/debug-users.ts +14 -0
- package/dist/runtime/src/platform/delay.ts +1 -0
- package/dist/runtime/src/platform/error.ts +9 -0
- package/dist/runtime/src/platform/file-utils.ts +35 -0
- package/dist/runtime/src/platform/ipc.ts +55 -0
- package/dist/runtime/src/platform/jsonl.ts +277 -0
- package/dist/runtime/src/platform/lifecycle.ts +176 -0
- package/dist/runtime/src/platform/log-rotation.ts +45 -0
- package/dist/runtime/src/platform/logger.ts +42 -0
- package/dist/runtime/src/platform/maestro-bootstrap-env.ts +3 -0
- package/dist/runtime/src/platform/mcp-catalog-policy.ts +63 -0
- package/dist/runtime/src/platform/mcp-config.ts +1329 -0
- package/dist/runtime/src/platform/memoize-import.ts +26 -0
- package/dist/runtime/src/platform/modules.ts +145 -0
- package/dist/runtime/src/platform/node-plugins.ts +46 -0
- package/dist/runtime/src/platform/paths.ts +62 -0
- package/dist/runtime/src/platform/playwright/browser-processes.ts +300 -0
- package/dist/runtime/src/platform/playwright/capability.ts +5 -0
- package/dist/runtime/src/platform/playwright/headed-launch.ts +61 -0
- package/dist/runtime/src/platform/playwright/manager-utils.ts +128 -0
- package/dist/runtime/src/platform/playwright/manager.ts +1502 -0
- package/dist/runtime/src/platform/playwright/mcp-transport.ts +35 -0
- package/dist/runtime/src/platform/playwright/profile-management.ts +33 -0
- package/dist/runtime/src/platform/playwright/public-runtime.ts +52 -0
- package/dist/runtime/src/platform/playwright/transport-probe.ts +89 -0
- package/dist/runtime/src/platform/playwright/vault-broker.ts +261 -0
- package/dist/runtime/src/platform/public-runtime.ts +18 -0
- package/dist/runtime/src/prompts/agents/wiki-archiver.md +194 -0
- package/dist/runtime/src/prompts/builders.ts +696 -0
- package/dist/runtime/src/prompts/sessions/_shared-tools.md +38 -0
- package/dist/runtime/src/prompts/sessions/channel-system.md +13 -0
- package/dist/runtime/src/prompts/sessions/manager-system.md +34 -0
- package/dist/runtime/src/prompts/sessions/surfaces/cli.md +6 -0
- package/dist/runtime/src/prompts/sessions/surfaces/otium-manager.md +18 -0
- package/dist/runtime/src/prompts/sessions/surfaces/otium.md +6 -0
- package/dist/runtime/src/prompts/sessions/surfaces/telegram.md +5 -0
- package/dist/runtime/src/prompts/sessions/surfaces/terminal.md +6 -0
- package/dist/runtime/src/prompts/sessions/topic-system.md +9 -0
- package/dist/runtime/src/prompts/sessions/visual-design.md +38 -0
- package/dist/runtime/src/query/active-rooms.ts +514 -0
- package/dist/runtime/src/query/index.ts +23 -0
- package/dist/runtime/src/query/public-runtime.ts +28 -0
- package/dist/runtime/src/query/room-query-registry.ts +217 -0
- package/dist/runtime/src/query/session-inbox-cleanup.ts +45 -0
- package/dist/runtime/src/query/session-inbox-path.ts +42 -0
- package/dist/runtime/src/query/state.ts +116 -0
- package/dist/runtime/src/query/types.ts +8 -0
- package/dist/runtime/src/runtime/actor-topic-reach.ts +123 -0
- package/dist/runtime/src/runtime/actor-topic-scope.ts +255 -0
- package/dist/runtime/src/runtime/ask-callbacks.ts +217 -0
- package/dist/runtime/src/runtime/attachments.ts +149 -0
- package/dist/runtime/src/runtime/background-session-policy.ts +1 -0
- package/dist/runtime/src/runtime/background-sessions.ts +288 -0
- package/dist/runtime/src/runtime/bashrs-completions.ts +350 -0
- package/dist/runtime/src/runtime/channel-context.ts +115 -0
- package/dist/runtime/src/runtime/context-warning.ts +131 -0
- package/dist/runtime/src/runtime/cron-sessions.ts +35 -0
- package/dist/runtime/src/runtime/delivery-ack.ts +112 -0
- package/dist/runtime/src/runtime/errors.ts +70 -0
- package/dist/runtime/src/runtime/event-heartbeat.ts +77 -0
- package/dist/runtime/src/runtime/file-hooks.ts +81 -0
- package/dist/runtime/src/runtime/footer.ts +23 -0
- package/dist/runtime/src/runtime/gateway-capabilities.ts +22 -0
- package/dist/runtime/src/runtime/inbox.ts +1307 -0
- package/dist/runtime/src/runtime/playwright-turn-abort.ts +59 -0
- package/dist/runtime/src/runtime/public-helpers.ts +78 -0
- package/dist/runtime/src/runtime/remote-session-grant.ts +221 -0
- package/dist/runtime/src/runtime/remote-session-inbox.ts +943 -0
- package/dist/runtime/src/runtime/remote-session-reply-outbox.ts +168 -0
- package/dist/runtime/src/runtime/task-format.ts +18 -0
- package/dist/runtime/src/runtime/tasks.ts +53 -0
- package/dist/runtime/src/runtime/thread-context.ts +123 -0
- package/dist/runtime/src/runtime/thread-read.ts +67 -0
- package/dist/runtime/src/runtime/topic-config.ts +29 -0
- package/dist/runtime/src/runtime/turn-event-stream.ts +1051 -0
- package/dist/runtime/src/runtime/turn-runner.ts +2311 -0
- package/dist/runtime/src/runtime/turn-session.ts +116 -0
- package/dist/runtime/src/runtime/usage-alert.ts +51 -0
- package/dist/runtime/src/runtime/user-turn-envelope.ts +94 -0
- package/dist/runtime/src/runtime/visual-html.ts +175 -0
- package/dist/runtime/src/runtime/visual-store.ts +480 -0
- package/dist/runtime/src/runtime/visuals.ts +209 -0
- package/dist/runtime/src/runtime-gateway.ts +1045 -0
- package/dist/runtime/src/security/sanitize.ts +27 -0
- package/dist/runtime/src/security/sensitive-path.ts +41 -0
- package/dist/runtime/src/storage/activity-log.ts +167 -0
- package/dist/runtime/src/storage/api-messages.ts +766 -0
- package/dist/runtime/src/storage/api-topic-brief.ts +134 -0
- package/dist/runtime/src/storage/api-topic-config.ts +197 -0
- package/dist/runtime/src/storage/api-topics.ts +1647 -0
- package/dist/runtime/src/storage/app-settings.ts +50 -0
- package/dist/runtime/src/storage/ask-user-gates.ts +359 -0
- package/dist/runtime/src/storage/browser-profiles.ts +186 -0
- package/dist/runtime/src/storage/conversation-migration.ts +180 -0
- package/dist/runtime/src/storage/conversations.ts +377 -0
- package/dist/runtime/src/storage/decisions.ts +231 -0
- package/dist/runtime/src/storage/forum/agent-settings.ts +20 -0
- package/dist/runtime/src/storage/forum/index.ts +4 -0
- package/dist/runtime/src/storage/forum/repository.ts +283 -0
- package/dist/runtime/src/storage/forum/schema.ts +314 -0
- package/dist/runtime/src/storage/forum-db.ts +4 -0
- package/dist/runtime/src/storage/remote-session.ts +1028 -0
- package/dist/runtime/src/storage/runtime-events.ts +209 -0
- package/dist/runtime/src/storage/runtime-follow-ups.ts +212 -0
- package/dist/runtime/src/storage/runtime-gateway-submissions.ts +132 -0
- package/dist/runtime/src/storage/runtime-leases.ts +190 -0
- package/dist/runtime/src/storage/runtime-process-leases.ts +288 -0
- package/dist/runtime/src/storage/runtime-topic-state.ts +181 -0
- package/dist/runtime/src/storage/runtime-turn-requests.ts +846 -0
- package/dist/runtime/src/storage/self-schedules.ts +306 -0
- package/dist/runtime/src/storage/session-asks.ts +468 -0
- package/dist/runtime/src/storage/session-inbox-signal.ts +76 -0
- package/dist/runtime/src/storage/session-inbox.ts +161 -0
- package/dist/runtime/src/storage/sqlite.ts +154 -0
- package/dist/runtime/src/storage/storage-contract.ts +54 -0
- package/dist/runtime/src/storage/storage-host.ts +336 -0
- package/dist/runtime/src/storage/storage-public-host.ts +16 -0
- package/dist/runtime/src/storage/storage-public.ts +66 -0
- package/dist/runtime/src/storage/tasks.ts +172 -0
- package/dist/runtime/src/storage/token-stats.ts +432 -0
- package/dist/runtime/src/storage/topic-archive-state.ts +226 -0
- package/dist/runtime/src/storage/topic-archive.ts +169 -0
- package/dist/runtime/src/storage/topic-host-mcp-grants.ts +54 -0
- package/dist/runtime/src/storage/topic-link-records.ts +1085 -0
- package/dist/runtime/src/storage/topic-settings.ts +67 -0
- package/dist/runtime/src/storage/topic-tool-capabilities.ts +89 -0
- package/dist/runtime/src/storage/topic-transcript.ts +98 -0
- package/dist/runtime/src/storage/vault-crypto-core.ts +65 -0
- package/dist/runtime/src/storage/vault-crypto.ts +31 -0
- package/dist/runtime/src/storage/vault-public.ts +27 -0
- package/dist/runtime/src/storage/vault-request-gates.ts +359 -0
- package/dist/runtime/src/storage/vault.ts +388 -0
- package/dist/runtime/src/storage/wiki-summary-names.ts +52 -0
- package/dist/runtime/src/storage/wiki.ts +90 -0
- package/dist/runtime/src/topics/claim-abort.ts +190 -0
- package/dist/runtime/src/topics/create.ts +192 -0
- package/dist/runtime/src/topics/derive.ts +600 -0
- package/dist/runtime/src/topics/lifecycle.ts +425 -0
- package/dist/runtime/src/topics/links.ts +7 -0
- package/dist/runtime/src/topics/personal-general.ts +91 -0
- package/dist/runtime/src/topics/session.ts +1041 -0
- package/dist/runtime/src/topics/update.ts +287 -0
- package/dist/runtime/src/types/api.ts +591 -0
- package/dist/runtime/src/types.ts +418 -0
- package/dist/runtime/src/version.ts +1 -0
- package/dist/runtime/tsconfig.json +13 -0
- package/dist/runtime-gateway.js +514 -0
- package/dist/runtime-gateway.js.map +10 -0
- package/dist/runtime-helpers.js +1792 -0
- package/dist/runtime-helpers.js.map +40 -0
- package/dist/sqlite.js +66 -0
- package/dist/sqlite.js.map +10 -0
- package/dist/storage.js +5223 -0
- package/dist/storage.js.map +47 -0
- package/dist/types/apps/negotium/src/mcp-servers.d.ts +20 -0
- package/dist/types/packages/core/src/agents/api-topic-agent-switch.d.ts +38 -0
- package/dist/types/packages/core/src/agents/archiver.d.ts +87 -0
- package/dist/types/packages/core/src/agents/auth-check.d.ts +19 -0
- package/dist/types/packages/core/src/agents/claude-notices.d.ts +15 -0
- package/dist/types/packages/core/src/agents/claude-provider.d.ts +25 -0
- package/dist/types/packages/core/src/agents/claude-registry.d.ts +3 -0
- package/dist/types/packages/core/src/agents/claude-runtime-inspection.d.ts +9 -0
- package/dist/types/packages/core/src/agents/codex-app-server.d.ts +13 -0
- package/dist/types/packages/core/src/agents/codex-native-multi-agent.d.ts +20 -0
- package/dist/types/packages/core/src/agents/codex-provider.d.ts +64 -0
- package/dist/types/packages/core/src/agents/codex-registry.d.ts +3 -0
- package/dist/types/packages/core/src/agents/codex-tier-resolver.d.ts +10 -0
- package/dist/types/packages/core/src/agents/codex-tree-kill.d.ts +13 -0
- package/dist/types/packages/core/src/agents/codex-tree-manager.d.ts +28 -0
- package/dist/types/packages/core/src/agents/codex-vault-hook-bridge.d.ts +28 -0
- package/dist/types/packages/core/src/agents/codex-windows-wrapper.d.ts +30 -0
- package/dist/types/packages/core/src/agents/compaction-support.d.ts +5 -0
- package/dist/types/packages/core/src/agents/compaction-tool-projection.d.ts +9 -0
- package/dist/types/packages/core/src/agents/contracts.d.ts +68 -0
- package/dist/types/packages/core/src/agents/deep-map.d.ts +2 -0
- package/dist/types/packages/core/src/agents/execution-host.d.ts +33 -0
- package/dist/types/packages/core/src/agents/explicit-agent-switch.d.ts +26 -0
- package/dist/types/packages/core/src/agents/fork.d.ts +50 -0
- package/dist/types/packages/core/src/agents/hosted-agent.d.ts +15 -0
- package/dist/types/packages/core/src/agents/idle-archiver.d.ts +35 -0
- package/dist/types/packages/core/src/agents/idle-compact.d.ts +37 -0
- package/dist/types/packages/core/src/agents/index.d.ts +8 -0
- package/dist/types/packages/core/src/agents/maestro-provider.d.ts +75 -0
- package/dist/types/packages/core/src/agents/maestro-registry.d.ts +3 -0
- package/dist/types/packages/core/src/agents/mcp-tools/ask-user.d.ts +147 -0
- package/dist/types/packages/core/src/agents/mcp-tools/common.d.ts +14 -0
- package/dist/types/packages/core/src/agents/mcp-tools/inline-assets.d.ts +24 -0
- package/dist/types/packages/core/src/agents/mcp-tools/publish-html.d.ts +18 -0
- package/dist/types/packages/core/src/agents/mcp-tools/request-vault.d.ts +124 -0
- package/dist/types/packages/core/src/agents/mcp-tools/self-config.d.ts +45 -0
- package/dist/types/packages/core/src/agents/mcp-tools/spawn-subagent.d.ts +148 -0
- package/dist/types/packages/core/src/agents/mcp-tools/visual-compat.d.ts +55 -0
- package/dist/types/packages/core/src/agents/mcp-tools/visuals.d.ts +70 -0
- package/dist/types/packages/core/src/agents/memory-archive-policy.d.ts +24 -0
- package/dist/types/packages/core/src/agents/model-catalog.d.ts +132 -0
- package/dist/types/packages/core/src/agents/public-helpers.d.ts +17 -0
- package/dist/types/packages/core/src/agents/registry.d.ts +5 -0
- package/dist/types/packages/core/src/agents/rollout/claude.d.ts +77 -0
- package/dist/types/packages/core/src/agents/rollout/codex.d.ts +119 -0
- package/dist/types/packages/core/src/agents/rollout/index.d.ts +6 -0
- package/dist/types/packages/core/src/agents/rollout/shared.d.ts +56 -0
- package/dist/types/packages/core/src/agents/self-config-core.d.ts +199 -0
- package/dist/types/packages/core/src/agents/task-events.d.ts +19 -0
- package/dist/types/packages/core/src/agents/tool-format.d.ts +25 -0
- package/dist/types/packages/core/src/agents/topic-cleanup.d.ts +83 -0
- package/dist/types/packages/core/src/agents/vault-tool-policy.d.ts +2 -0
- package/dist/types/packages/core/src/bus.d.ts +141 -0
- package/dist/types/packages/core/src/identifiers.d.ts +27 -0
- package/dist/types/packages/core/src/mcp/canonical-bridge-config.d.ts +21 -0
- package/dist/types/packages/core/src/mcp/factories/agent-health.d.ts +5 -0
- package/dist/types/packages/core/src/mcp/factories/compaction-log.d.ts +8 -0
- package/dist/types/packages/core/src/mcp/factories/decision.d.ts +18 -0
- package/dist/types/packages/core/src/mcp/factories/index.d.ts +13 -0
- package/dist/types/packages/core/src/mcp/factories/session-comm.d.ts +38 -0
- package/dist/types/packages/core/src/mcp/factories/session-history.d.ts +11 -0
- package/dist/types/packages/core/src/mcp/factories/stdio-protection.d.ts +10 -0
- package/dist/types/packages/core/src/mcp/factories/system-health.d.ts +37 -0
- package/dist/types/packages/core/src/mcp/factories/task.d.ts +13 -0
- package/dist/types/packages/core/src/mcp/factories/token-stats.d.ts +20 -0
- package/dist/types/packages/core/src/mcp/factories/vault.d.ts +9 -0
- package/dist/types/packages/core/src/mcp/mcp-helpers.d.ts +26 -0
- package/dist/types/packages/core/src/mcp/peer-bridge.d.ts +92 -0
- package/dist/types/packages/core/src/mcp/runtime-spec.d.ts +147 -0
- package/dist/types/packages/core/src/mcp/session-comm/actor-policy.d.ts +120 -0
- package/dist/types/packages/core/src/mcp/session-comm/bridge-ipc-config.d.ts +6 -0
- package/dist/types/packages/core/src/mcp/session-comm/context.d.ts +44 -0
- package/dist/types/packages/core/src/mcp/session-comm/history-tools.d.ts +31 -0
- package/dist/types/packages/core/src/mcp/session-comm/hub-remote-session.d.ts +149 -0
- package/dist/types/packages/core/src/mcp/session-comm/limits.d.ts +8 -0
- package/dist/types/packages/core/src/mcp/session-comm/peer-forward.d.ts +85 -0
- package/dist/types/packages/core/src/mcp/session-comm/tell-permissions.d.ts +29 -0
- package/dist/types/packages/core/src/mcp/session-comm/topic-catalog.d.ts +59 -0
- package/dist/types/packages/core/src/mcp/session-history-limits.d.ts +20 -0
- package/dist/types/packages/core/src/mcp/session-history-reader.d.ts +35 -0
- package/dist/types/packages/core/src/mcp/wiki-search-index.d.ts +59 -0
- package/dist/types/packages/core/src/mcp/wiki-server.d.ts +53 -0
- package/dist/types/packages/core/src/media/file-events.d.ts +14 -0
- package/dist/types/packages/core/src/media/text-extractor.d.ts +34 -0
- package/dist/types/packages/core/src/outbox/coalescing-runner.d.ts +68 -0
- package/dist/types/packages/core/src/outbox/file-ops.d.ts +79 -0
- package/dist/types/packages/core/src/outbox/index.d.ts +3 -0
- package/dist/types/packages/core/src/outbox/utils.d.ts +16 -0
- package/dist/types/packages/core/src/platform/background-bash/context.d.ts +1 -0
- package/dist/types/packages/core/src/platform/background-bash/manager.d.ts +34 -0
- package/dist/types/packages/core/src/platform/config-helpers.d.ts +20 -0
- package/dist/types/packages/core/src/platform/config.d.ts +178 -0
- package/dist/types/packages/core/src/platform/constants.d.ts +20 -0
- package/dist/types/packages/core/src/platform/delay.d.ts +1 -0
- package/dist/types/packages/core/src/platform/error.d.ts +6 -0
- package/dist/types/packages/core/src/platform/file-utils.d.ts +16 -0
- package/dist/types/packages/core/src/platform/ipc.d.ts +32 -0
- package/dist/types/packages/core/src/platform/jsonl.d.ts +46 -0
- package/dist/types/packages/core/src/platform/lifecycle.d.ts +40 -0
- package/dist/types/packages/core/src/platform/logger.d.ts +20 -0
- package/dist/types/packages/core/src/platform/maestro-bootstrap-env.d.ts +0 -0
- package/dist/types/packages/core/src/platform/mcp-catalog-policy.d.ts +73 -0
- package/dist/types/packages/core/src/platform/mcp-config.d.ts +286 -0
- package/dist/types/packages/core/src/platform/memoize-import.d.ts +15 -0
- package/dist/types/packages/core/src/platform/paths.d.ts +18 -0
- package/dist/types/packages/core/src/platform/playwright/browser-processes.d.ts +60 -0
- package/dist/types/packages/core/src/platform/playwright/capability.d.ts +1 -0
- package/dist/types/packages/core/src/platform/playwright/headed-launch.d.ts +13 -0
- package/dist/types/packages/core/src/platform/playwright/manager-utils.d.ts +34 -0
- package/dist/types/packages/core/src/platform/playwright/manager.d.ts +194 -0
- package/dist/types/packages/core/src/platform/playwright/mcp-transport.d.ts +4 -0
- package/dist/types/packages/core/src/platform/playwright/profile-management.d.ts +8 -0
- package/dist/types/packages/core/src/platform/playwright/public-runtime.d.ts +6 -0
- package/dist/types/packages/core/src/platform/playwright/transport-probe.d.ts +13 -0
- package/dist/types/packages/core/src/platform/playwright/vault-broker.d.ts +6 -0
- package/dist/types/packages/core/src/platform/public-runtime.d.ts +3 -0
- package/dist/types/packages/core/src/prompts/builders.d.ts +78 -0
- package/dist/types/packages/core/src/query/active-rooms.d.ts +240 -0
- package/dist/types/packages/core/src/query/public-runtime.d.ts +4 -0
- package/dist/types/packages/core/src/query/room-query-registry.d.ts +71 -0
- package/dist/types/packages/core/src/query/session-inbox-cleanup.d.ts +5 -0
- package/dist/types/packages/core/src/query/session-inbox-path.d.ts +8 -0
- package/dist/types/packages/core/src/query/state.d.ts +25 -0
- package/dist/types/packages/core/src/query/types.d.ts +6 -0
- package/dist/types/packages/core/src/runtime/actor-topic-reach.d.ts +63 -0
- package/dist/types/packages/core/src/runtime/actor-topic-scope.d.ts +127 -0
- package/dist/types/packages/core/src/runtime/ask-callbacks.d.ts +53 -0
- package/dist/types/packages/core/src/runtime/attachments.d.ts +36 -0
- package/dist/types/packages/core/src/runtime/background-session-policy.d.ts +1 -0
- package/dist/types/packages/core/src/runtime/background-sessions.d.ts +27 -0
- package/dist/types/packages/core/src/runtime/bashrs-completions.d.ts +50 -0
- package/dist/types/packages/core/src/runtime/channel-context.d.ts +13 -0
- package/dist/types/packages/core/src/runtime/context-warning.d.ts +46 -0
- package/dist/types/packages/core/src/runtime/cron-sessions.d.ts +9 -0
- package/dist/types/packages/core/src/runtime/errors.d.ts +6 -0
- package/dist/types/packages/core/src/runtime/event-heartbeat.d.ts +17 -0
- package/dist/types/packages/core/src/runtime/file-hooks.d.ts +38 -0
- package/dist/types/packages/core/src/runtime/playwright-turn-abort.d.ts +12 -0
- package/dist/types/packages/core/src/runtime/public-helpers.d.ts +17 -0
- package/dist/types/packages/core/src/runtime/remote-session-grant.d.ts +91 -0
- package/dist/types/packages/core/src/runtime/remote-session-inbox.d.ts +206 -0
- package/dist/types/packages/core/src/runtime/remote-session-reply-outbox.d.ts +37 -0
- package/dist/types/packages/core/src/runtime/task-format.d.ts +4 -0
- package/dist/types/packages/core/src/runtime/tasks.d.ts +3 -0
- package/dist/types/packages/core/src/runtime/thread-context.d.ts +62 -0
- package/dist/types/packages/core/src/runtime/topic-config.d.ts +24 -0
- package/dist/types/packages/core/src/runtime/turn-event-stream.d.ts +47 -0
- package/dist/types/packages/core/src/runtime/turn-runner.d.ts +284 -0
- package/dist/types/packages/core/src/runtime/turn-session.d.ts +49 -0
- package/dist/types/packages/core/src/runtime/usage-alert.d.ts +11 -0
- package/dist/types/packages/core/src/runtime/user-turn-envelope.d.ts +37 -0
- package/dist/types/packages/core/src/runtime/visual-html.d.ts +13 -0
- package/dist/types/packages/core/src/runtime/visual-store.d.ts +71 -0
- package/dist/types/packages/core/src/runtime/visuals.d.ts +33 -0
- package/dist/types/packages/core/src/runtime-gateway.d.ts +282 -0
- package/dist/types/packages/core/src/security/sanitize.d.ts +16 -0
- package/dist/types/packages/core/src/security/sensitive-path.d.ts +1 -0
- package/dist/types/packages/core/src/storage/activity-log.d.ts +25 -0
- package/dist/types/packages/core/src/storage/api-messages.d.ts +156 -0
- package/dist/types/packages/core/src/storage/api-topic-brief.d.ts +39 -0
- package/dist/types/packages/core/src/storage/api-topic-config.d.ts +23 -0
- package/dist/types/packages/core/src/storage/api-topics.d.ts +274 -0
- package/dist/types/packages/core/src/storage/app-settings.d.ts +4 -0
- package/dist/types/packages/core/src/storage/ask-user-gates.d.ts +65 -0
- package/dist/types/packages/core/src/storage/browser-profiles.d.ts +31 -0
- package/dist/types/packages/core/src/storage/conversations.d.ts +149 -0
- package/dist/types/packages/core/src/storage/decisions.d.ts +45 -0
- package/dist/types/packages/core/src/storage/forum/agent-settings.d.ts +3 -0
- package/dist/types/packages/core/src/storage/forum/index.d.ts +4 -0
- package/dist/types/packages/core/src/storage/forum/repository.d.ts +42 -0
- package/dist/types/packages/core/src/storage/forum/schema.d.ts +38 -0
- package/dist/types/packages/core/src/storage/forum-db.d.ts +2 -0
- package/dist/types/packages/core/src/storage/remote-session.d.ts +318 -0
- package/dist/types/packages/core/src/storage/runtime-events.d.ts +33 -0
- package/dist/types/packages/core/src/storage/runtime-leases.d.ts +27 -0
- package/dist/types/packages/core/src/storage/runtime-process-leases.d.ts +47 -0
- package/dist/types/packages/core/src/storage/runtime-topic-state.d.ts +39 -0
- package/dist/types/packages/core/src/storage/runtime-turn-requests.d.ts +163 -0
- package/dist/types/packages/core/src/storage/self-schedules.d.ts +54 -0
- package/dist/types/packages/core/src/storage/session-asks.d.ts +78 -0
- package/dist/types/packages/core/src/storage/session-inbox-signal.d.ts +35 -0
- package/dist/types/packages/core/src/storage/session-inbox.d.ts +36 -0
- package/dist/types/packages/core/src/storage/sqlite.d.ts +20 -0
- package/dist/types/packages/core/src/storage/storage-contract.d.ts +46 -0
- package/dist/types/packages/core/src/storage/storage-host.d.ts +41 -0
- package/dist/types/packages/core/src/storage/storage-public-host.d.ts +7 -0
- package/dist/types/packages/core/src/storage/storage-public.d.ts +45 -0
- package/dist/types/packages/core/src/storage/tasks.d.ts +49 -0
- package/dist/types/packages/core/src/storage/token-stats.d.ts +69 -0
- package/dist/types/packages/core/src/storage/topic-archive-state.d.ts +33 -0
- package/dist/types/packages/core/src/storage/topic-archive.d.ts +42 -0
- package/dist/types/packages/core/src/storage/topic-host-mcp-grants.d.ts +5 -0
- package/dist/types/packages/core/src/storage/topic-link-records.d.ts +281 -0
- package/dist/types/packages/core/src/storage/topic-settings.d.ts +19 -0
- package/dist/types/packages/core/src/storage/topic-tool-capabilities.d.ts +37 -0
- package/dist/types/packages/core/src/storage/topic-transcript.d.ts +38 -0
- package/dist/types/packages/core/src/storage/vault-crypto-core.d.ts +6 -0
- package/dist/types/packages/core/src/storage/vault-crypto.d.ts +12 -0
- package/dist/types/packages/core/src/storage/vault-public.d.ts +3 -0
- package/dist/types/packages/core/src/storage/vault-request-gates.d.ts +69 -0
- package/dist/types/packages/core/src/storage/vault.d.ts +49 -0
- package/dist/types/packages/core/src/storage/wiki-summary-names.d.ts +13 -0
- package/dist/types/packages/core/src/storage/wiki.d.ts +15 -0
- package/dist/types/packages/core/src/topics/derive.d.ts +83 -0
- package/dist/types/packages/core/src/topics/lifecycle.d.ts +75 -0
- package/dist/types/packages/core/src/topics/links.d.ts +2 -0
- package/dist/types/packages/core/src/topics/personal-general.d.ts +15 -0
- package/dist/types/packages/core/src/topics/session.d.ts +70 -0
- package/dist/types/packages/core/src/types/api.d.ts +551 -0
- package/dist/types/packages/core/src/types.d.ts +405 -0
- package/dist/types/packages/core/src/version.d.ts +1 -0
- package/dist/types/packages/module-cron/src/background-sessions.d.ts +2 -0
- package/dist/types/packages/module-cron/src/context.d.ts +15 -0
- package/dist/types/packages/module-cron/src/host.d.ts +23 -0
- package/dist/types/packages/module-cron/src/index.d.ts +14 -0
- package/dist/types/packages/module-cron/src/module.d.ts +13 -0
- package/dist/types/packages/module-cron/src/schedule.d.ts +23 -0
- package/dist/types/packages/module-cron/src/scheduler.d.ts +46 -0
- package/dist/types/packages/module-cron/src/scripts.d.ts +29 -0
- package/dist/types/packages/module-cron/src/store.d.ts +152 -0
- package/dist/types/packages/module-cron/src/summarize.d.ts +4 -0
- package/dist/vault.js +848 -0
- package/dist/vault.js.map +18 -0
- package/install-bash-rs.mjs +90 -0
- package/install-browser-rs.mjs +83 -0
- package/package.json +171 -4
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers shared by every agent's rollout encoder.
|
|
3
|
+
*
|
|
4
|
+
* Each rollout file under `agents/rollout/<agent>.ts` materializes a
|
|
5
|
+
* synthetic SDK-native JSONL from a provider-agnostic `ConversationEntry`
|
|
6
|
+
* stream. The cwd validation, UUID shape check, and chat-pair extraction
|
|
7
|
+
* are identical regardless of agent, so they live here.
|
|
8
|
+
*/
|
|
9
|
+
import type { ConversationEntry } from "../../storage/conversations";
|
|
10
|
+
import type { UnifiedEvent } from "../../types";
|
|
11
|
+
export interface RolloutHostOptions {
|
|
12
|
+
/** Absolute workspace roots under which synthetic provider sessions may be written. */
|
|
13
|
+
workspaceRoots?: readonly string[];
|
|
14
|
+
/** Directory containing the provider rollout fixture JSONL files. */
|
|
15
|
+
fixturesDir?: string;
|
|
16
|
+
}
|
|
17
|
+
/** Configure the embedding host's trusted workspace roots. */
|
|
18
|
+
export declare function configureRolloutHost(options: RolloutHostOptions): () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Captured fixture snapshots — `claude-attachments.jsonl`, `codex-shell.jsonl`,
|
|
21
|
+
* etc. — live one level above the per-agent rollout files (under
|
|
22
|
+
* `agents/fixtures/`) so each agent can pull from the same directory without
|
|
23
|
+
* duplicating fixtures.
|
|
24
|
+
*
|
|
25
|
+
* To refresh fixtures: run any live Codex/Claude session, copy the first few
|
|
26
|
+
* non-conversational entries from the resulting rollout file, and update
|
|
27
|
+
* `src/agents/fixtures/{codex-shell,claude-attachments}.jsonl`.
|
|
28
|
+
*/
|
|
29
|
+
export declare let FIXTURES_DIR: string;
|
|
30
|
+
/** Deep-clone to avoid mutating cached fixture objects. */
|
|
31
|
+
export declare function clone<T>(obj: T): T;
|
|
32
|
+
export declare function assertUuidLike(label: string, value: string): void;
|
|
33
|
+
/** Best-effort guarantee that the resumed cwd will exist when the SDK stats it. */
|
|
34
|
+
export declare function ensureCwdExists(cwd: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* Reduce a UnifiedEvent stream to user/assistant message pairs. Tool calls and
|
|
37
|
+
* tool results are inlined as bracketed annotations on the surrounding
|
|
38
|
+
* assistant turn so the historical narrative is preserved when synthesizing a
|
|
39
|
+
* native rollout for a different SDK. Streaming text deltas are folded into
|
|
40
|
+
* their final consolidated `text` event to avoid double-counting partial
|
|
41
|
+
* tokens.
|
|
42
|
+
*/
|
|
43
|
+
export type ChatPair = {
|
|
44
|
+
userText: string;
|
|
45
|
+
assistantText: string;
|
|
46
|
+
};
|
|
47
|
+
export interface ExtractOptions {
|
|
48
|
+
includeToolAnnotations: boolean;
|
|
49
|
+
formatToolUse?: (event: Extract<UnifiedEvent, {
|
|
50
|
+
type: "tool_use";
|
|
51
|
+
}>) => string;
|
|
52
|
+
formatToolResult?: (event: Extract<UnifiedEvent, {
|
|
53
|
+
type: "tool_result";
|
|
54
|
+
}>) => string;
|
|
55
|
+
}
|
|
56
|
+
export declare function extractChatPairs(entries: ConversationEntry[], opts?: ExtractOptions): ChatPair[];
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import type { AgentKind, EffortLevel } from "../types";
|
|
2
|
+
export declare const SELF_CONFIG_MCP_KEY = "topic-config";
|
|
3
|
+
export declare const SELF_SCHEDULE_MAX_DELAY_SECONDS = 86400;
|
|
4
|
+
export declare const SELF_SCHEDULE_MAX_MESSAGE_LENGTH = 10000;
|
|
5
|
+
export declare const SELF_CONFIG_DERIVED_TOPIC_LIMIT = 5;
|
|
6
|
+
export type SelfConfigField = "agent" | "model" | "effort";
|
|
7
|
+
export interface SelfConfigContext {
|
|
8
|
+
topicId: string;
|
|
9
|
+
userId: string;
|
|
10
|
+
/** Product-side human actor when `userId` is a shared execution principal. */
|
|
11
|
+
actorUserId?: string;
|
|
12
|
+
cwd?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Agents the current user message explicitly asked to switch to, derived
|
|
15
|
+
* server-side from the full prompt (`explicitAgentSwitchTargets`). This is
|
|
16
|
+
* what `set_agent` authorizes against; it rides the signed runtime token in
|
|
17
|
+
* place of the prompt, so its length does not depend on the message.
|
|
18
|
+
*/
|
|
19
|
+
explicitAgentSwitchTargets?: readonly AgentKind[];
|
|
20
|
+
/**
|
|
21
|
+
* Raw current user request, for in-process callers that still hold it and
|
|
22
|
+
* did not derive the field above. Ignored when `explicitAgentSwitchTargets`
|
|
23
|
+
* is present.
|
|
24
|
+
*/
|
|
25
|
+
currentUserPrompt?: string;
|
|
26
|
+
/** Called after a successful set_* so the caller can trigger a follow-up turn. */
|
|
27
|
+
onConfigChanged?: (field: SelfConfigField) => void;
|
|
28
|
+
}
|
|
29
|
+
export interface SelfConfigResult {
|
|
30
|
+
text: string;
|
|
31
|
+
isError?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface SelfConfigTopic {
|
|
34
|
+
id: string;
|
|
35
|
+
title: string;
|
|
36
|
+
agent?: AgentKind;
|
|
37
|
+
defaultModel: string;
|
|
38
|
+
defaultEffort: EffortLevel;
|
|
39
|
+
participants: readonly {
|
|
40
|
+
userId: string;
|
|
41
|
+
}[];
|
|
42
|
+
}
|
|
43
|
+
export interface SelfConfigTopicConfig {
|
|
44
|
+
model?: string;
|
|
45
|
+
effort?: EffortLevel;
|
|
46
|
+
mcp?: string[];
|
|
47
|
+
agentLocked?: boolean;
|
|
48
|
+
modelLocked?: boolean;
|
|
49
|
+
effortLocked?: boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface SelfConfigAgentPolicy {
|
|
52
|
+
defaultEffort?: EffortLevel;
|
|
53
|
+
validEfforts: readonly EffortLevel[];
|
|
54
|
+
validateModel(model: string): boolean;
|
|
55
|
+
validateEffort(effort: EffortLevel): boolean;
|
|
56
|
+
resolveModel(model: string | undefined): string;
|
|
57
|
+
}
|
|
58
|
+
export interface SelfConfigTopicStore {
|
|
59
|
+
getTopic(topicId: string): SelfConfigTopic | null;
|
|
60
|
+
getConfig(topicId: string): SelfConfigTopicConfig | undefined;
|
|
61
|
+
setConfig(topicId: string, config: SelfConfigTopicConfig): void;
|
|
62
|
+
}
|
|
63
|
+
export interface SelfConfigModelPolicy {
|
|
64
|
+
forAgent(agent: AgentKind): SelfConfigAgentPolicy;
|
|
65
|
+
owner(model: string): AgentKind | undefined;
|
|
66
|
+
checkAuth(agent: AgentKind, model: string, userId: string): {
|
|
67
|
+
ok: true;
|
|
68
|
+
} | {
|
|
69
|
+
ok: false;
|
|
70
|
+
error: string;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export interface SelfConfigRuntimeBoundary {
|
|
74
|
+
resolveWorkspaceDir(topicId: string): string;
|
|
75
|
+
switchAgent(options: SelfConfigAgentSwitchOptions): SelfConfigAgentSwitchResult;
|
|
76
|
+
configChanged(topicId: string, field: SelfConfigField): void;
|
|
77
|
+
}
|
|
78
|
+
export type SelfConfigAgentSwitchResult = {
|
|
79
|
+
ok: true;
|
|
80
|
+
outcome: {
|
|
81
|
+
kind: "fresh";
|
|
82
|
+
agent: AgentKind;
|
|
83
|
+
reason: "no-history";
|
|
84
|
+
} | {
|
|
85
|
+
kind: "bridged";
|
|
86
|
+
agent: AgentKind;
|
|
87
|
+
bridgedSessionId: string;
|
|
88
|
+
rolloutPath: string;
|
|
89
|
+
};
|
|
90
|
+
} | {
|
|
91
|
+
ok: false;
|
|
92
|
+
error: string;
|
|
93
|
+
};
|
|
94
|
+
export interface SelfConfigAgentSwitchOptions {
|
|
95
|
+
topicId: string;
|
|
96
|
+
topicTitle: string;
|
|
97
|
+
userId: string;
|
|
98
|
+
fromAgent?: AgentKind;
|
|
99
|
+
agent: AgentKind;
|
|
100
|
+
cwd: string;
|
|
101
|
+
config: SelfConfigTopicConfig;
|
|
102
|
+
defaultModel?: string;
|
|
103
|
+
defaultEffort?: EffortLevel;
|
|
104
|
+
reason: string;
|
|
105
|
+
}
|
|
106
|
+
export interface SelfConfigDerivedTopics {
|
|
107
|
+
create(sourceTopicId: string, userId: string, copyHistory: boolean, options: {
|
|
108
|
+
name?: string;
|
|
109
|
+
derivedByUserId?: string;
|
|
110
|
+
}): Promise<SelfConfigTopic | null>;
|
|
111
|
+
link(topicId: string): string;
|
|
112
|
+
isTitleConflict(error: unknown): boolean;
|
|
113
|
+
isForkCompactionError(error: unknown): boolean;
|
|
114
|
+
}
|
|
115
|
+
export interface SelfConfigSchedules {
|
|
116
|
+
create(input: {
|
|
117
|
+
topicId: string;
|
|
118
|
+
userId: string;
|
|
119
|
+
message: string;
|
|
120
|
+
deliverAt: number;
|
|
121
|
+
now?: number;
|
|
122
|
+
}): SelfConfigCreateScheduleResult;
|
|
123
|
+
getPending(topicId: string): SelfConfigSchedule | null;
|
|
124
|
+
update(input: {
|
|
125
|
+
topicId: string;
|
|
126
|
+
scheduleId: string;
|
|
127
|
+
message?: string;
|
|
128
|
+
deliverAt?: number;
|
|
129
|
+
now?: number;
|
|
130
|
+
}): SelfConfigSchedule | null;
|
|
131
|
+
cancel(topicId: string, scheduleId: string): boolean;
|
|
132
|
+
}
|
|
133
|
+
export interface SelfConfigSchedule {
|
|
134
|
+
id: string;
|
|
135
|
+
topicId: string;
|
|
136
|
+
userId: string;
|
|
137
|
+
message: string;
|
|
138
|
+
deliverAt: number;
|
|
139
|
+
}
|
|
140
|
+
export type SelfConfigCreateScheduleResult = {
|
|
141
|
+
ok: true;
|
|
142
|
+
schedule: SelfConfigSchedule;
|
|
143
|
+
} | {
|
|
144
|
+
ok: false;
|
|
145
|
+
existing: SelfConfigSchedule;
|
|
146
|
+
};
|
|
147
|
+
/** Product-level limits and copy that are shared by policy and MCP wrappers. */
|
|
148
|
+
export interface SelfConfigProductConfig {
|
|
149
|
+
readonly mcpKey: string;
|
|
150
|
+
readonly scheduleMaxDelaySeconds: number;
|
|
151
|
+
readonly scheduleMaxMessageLength: number;
|
|
152
|
+
readonly derivedTopicLimit: number;
|
|
153
|
+
readonly toolDescriptions: Readonly<Record<string, string>>;
|
|
154
|
+
}
|
|
155
|
+
export interface SelfConfigHost {
|
|
156
|
+
topics: SelfConfigTopicStore;
|
|
157
|
+
models: SelfConfigModelPolicy;
|
|
158
|
+
runtime: SelfConfigRuntimeBoundary;
|
|
159
|
+
derivedTopics?: SelfConfigDerivedTopics;
|
|
160
|
+
schedules?: SelfConfigSchedules;
|
|
161
|
+
}
|
|
162
|
+
export interface SelfConfigCore {
|
|
163
|
+
readonly host: SelfConfigHost;
|
|
164
|
+
readonly product: SelfConfigProductConfig;
|
|
165
|
+
setModel(ctx: SelfConfigContext, model: string): SelfConfigResult;
|
|
166
|
+
getModel(ctx: SelfConfigContext): SelfConfigResult;
|
|
167
|
+
setAgent(ctx: SelfConfigContext, agent: AgentKind): SelfConfigResult;
|
|
168
|
+
getAgent(ctx: SelfConfigContext): SelfConfigResult;
|
|
169
|
+
setEffort(ctx: SelfConfigContext, effort: EffortLevel): SelfConfigResult;
|
|
170
|
+
getEffort(ctx: SelfConfigContext): SelfConfigResult;
|
|
171
|
+
scheduleContinue(ctx: SelfConfigContext, delaySeconds: number, message: string, nowMs?: number): SelfConfigResult;
|
|
172
|
+
getSchedule(ctx: SelfConfigContext, nowMs?: number): SelfConfigResult;
|
|
173
|
+
updateSchedule(ctx: SelfConfigContext, scheduleId: string, updates: {
|
|
174
|
+
delaySeconds?: number;
|
|
175
|
+
message?: string;
|
|
176
|
+
}, nowMs?: number): SelfConfigResult;
|
|
177
|
+
cancelSchedule(ctx: SelfConfigContext, scheduleId: string): SelfConfigResult;
|
|
178
|
+
spawnTopic(ctx: SelfConfigContext, name?: string): Promise<SelfConfigResult>;
|
|
179
|
+
forkTopic(ctx: SelfConfigContext, name?: string): Promise<SelfConfigResult>;
|
|
180
|
+
}
|
|
181
|
+
export declare const DEFAULT_SELF_CONFIG_PRODUCT: SelfConfigProductConfig;
|
|
182
|
+
export declare function createSelfConfigCore(host: SelfConfigHost, productOverrides?: Partial<SelfConfigProductConfig>): SelfConfigCore;
|
|
183
|
+
export declare const defaultSelfConfigHost: SelfConfigHost;
|
|
184
|
+
export declare const defaultSelfConfigCore: SelfConfigCore;
|
|
185
|
+
export declare function setSelfConfigModel(ctx: SelfConfigContext, model: string): SelfConfigResult;
|
|
186
|
+
export declare function getSelfConfigModel(ctx: SelfConfigContext): SelfConfigResult;
|
|
187
|
+
export declare function setSelfConfigAgent(ctx: SelfConfigContext, agent: AgentKind): SelfConfigResult;
|
|
188
|
+
export declare function getSelfConfigAgent(ctx: SelfConfigContext): SelfConfigResult;
|
|
189
|
+
export declare function setSelfConfigEffort(ctx: SelfConfigContext, effort: EffortLevel): SelfConfigResult;
|
|
190
|
+
export declare function getSelfConfigEffort(ctx: SelfConfigContext): SelfConfigResult;
|
|
191
|
+
export declare function scheduleSelfConfigContinue(ctx: SelfConfigContext, delaySeconds: number, message: string, nowMs?: number): SelfConfigResult;
|
|
192
|
+
export declare function getSelfConfigSchedule(ctx: SelfConfigContext, nowMs?: number): SelfConfigResult;
|
|
193
|
+
export declare function updateSelfConfigSchedule(ctx: SelfConfigContext, scheduleId: string, updates: {
|
|
194
|
+
delaySeconds?: number;
|
|
195
|
+
message?: string;
|
|
196
|
+
}, nowMs?: number): SelfConfigResult;
|
|
197
|
+
export declare function cancelSelfConfigSchedule(ctx: SelfConfigContext, scheduleId: string): SelfConfigResult;
|
|
198
|
+
export declare function spawnSelfConfigTopic(ctx: SelfConfigContext, name?: string): Promise<SelfConfigResult>;
|
|
199
|
+
export declare function forkSelfConfigTopic(ctx: SelfConfigContext, name?: string): Promise<SelfConfigResult>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { readTasks, taskFileMtimeNs, taskScopeKey } from "../storage/tasks";
|
|
2
|
+
import type { AgentQueryOptions, UnifiedEvent } from "../types";
|
|
3
|
+
export interface TaskEventScope {
|
|
4
|
+
userId: string;
|
|
5
|
+
scopeKey: string;
|
|
6
|
+
}
|
|
7
|
+
export interface TaskEventHost {
|
|
8
|
+
readTasks: typeof readTasks;
|
|
9
|
+
taskFileMtimeNs: typeof taskFileMtimeNs;
|
|
10
|
+
taskScopeKey: typeof taskScopeKey;
|
|
11
|
+
}
|
|
12
|
+
export declare function resolveTaskEventScope(opts: AgentQueryOptions, host?: TaskEventHost): TaskEventScope | null;
|
|
13
|
+
/**
|
|
14
|
+
* The task MCP server runs as a child process of the agent SDK. Its writes do
|
|
15
|
+
* not appear in the provider stream, so after tool results and terminal
|
|
16
|
+
* results we stat the shared store and inject the full task snapshot when it
|
|
17
|
+
* changed.
|
|
18
|
+
*/
|
|
19
|
+
export declare function withTaskSnapshots(inner: AsyncGenerator<UnifiedEvent>, scope: TaskEventScope, host?: TaskEventHost): AsyncGenerator<UnifiedEvent>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type ToolCallSummaryValue = string | number | boolean | Array<{
|
|
2
|
+
label: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
}>;
|
|
5
|
+
export type ToolCallSummaryInput = Record<string, ToolCallSummaryValue>;
|
|
6
|
+
export declare function summarizeDisplayText(value: string): string;
|
|
7
|
+
/** Convert a raw Codex/Claude shell invocation into a bounded display label. */
|
|
8
|
+
export declare function summarizeShellCommand(value: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Give simple, demonstrably read-only shell commands a more meaningful
|
|
11
|
+
* timeline name. This is shared display metadata only; every provider still
|
|
12
|
+
* executes the original shell tool unchanged.
|
|
13
|
+
*/
|
|
14
|
+
export declare function classifyShellToolName(value: string): "Bash" | "Read" | "Search";
|
|
15
|
+
export interface NumberedDiffSummary {
|
|
16
|
+
before?: string;
|
|
17
|
+
after?: string;
|
|
18
|
+
diffPreview?: string;
|
|
19
|
+
}
|
|
20
|
+
/** Build one Git-style numbered diff used by every provider and adapter. */
|
|
21
|
+
export declare function buildNumberedDiffSummary(before: string, after: string, startLine?: number): NumberedDiffSummary;
|
|
22
|
+
export declare function summarizeToolInput(name: string, input: Record<string, unknown>, options?: {
|
|
23
|
+
cwd?: string;
|
|
24
|
+
}): ToolCallSummaryInput | undefined;
|
|
25
|
+
export declare function formatToolUse(name: string, input: Record<string, unknown>): string;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Topic-level conversation cleanup.
|
|
3
|
+
*
|
|
4
|
+
* The raw and active conversation logs are operational files. The raw stream
|
|
5
|
+
* is append-only while a topic lives and is archived to `wiki/archive/` by
|
|
6
|
+
* reset/delete lifecycle code before this module removes it. The active stream
|
|
7
|
+
* is the compactable provider projection. Every per-agent SDK rollout and both
|
|
8
|
+
* operational files disappear together so a recreated topic cannot resurrect
|
|
9
|
+
* orphan history.
|
|
10
|
+
*
|
|
11
|
+
* Permanent forensic preservation lives in `wiki/archive/` via
|
|
12
|
+
* `archiveSessionLogs`; this module is the matching teardown side.
|
|
13
|
+
*/
|
|
14
|
+
import type { AgentKind, UnifiedEvent } from "../types";
|
|
15
|
+
export interface TopicConversationEntry {
|
|
16
|
+
ts: string;
|
|
17
|
+
agent: AgentKind;
|
|
18
|
+
event: UnifiedEvent;
|
|
19
|
+
}
|
|
20
|
+
export interface PurgeSessionRef {
|
|
21
|
+
agent: AgentKind;
|
|
22
|
+
sessionId: string;
|
|
23
|
+
}
|
|
24
|
+
export interface PurgeTopicLogsOptions {
|
|
25
|
+
userId: number | string;
|
|
26
|
+
/** Topic key for the unified log path. Use `__dm__` for the DM session. */
|
|
27
|
+
topicName: string;
|
|
28
|
+
/**
|
|
29
|
+
* Working directory the topic ran with — Claude embeds an encoded copy
|
|
30
|
+
* in its rollout path, so a wrong value would silently miss the actual
|
|
31
|
+
* files. API topics should pass `resolveTopicWorkspaceDir(topicId)`.
|
|
32
|
+
*/
|
|
33
|
+
cwd: string;
|
|
34
|
+
/**
|
|
35
|
+
* Additional SDK resume keys that may not have reached the unified log yet.
|
|
36
|
+
*
|
|
37
|
+
* `set_agent` writes a synthetic rollout and stores its id in DB before the
|
|
38
|
+
* target agent's first real turn emits a `session` event. If the user resets
|
|
39
|
+
* or deletes the topic in that window, the DB session id is the only manifest
|
|
40
|
+
* entry for that synthetic file.
|
|
41
|
+
*/
|
|
42
|
+
extraSessions?: PurgeSessionRef[];
|
|
43
|
+
}
|
|
44
|
+
export interface TopicLogMaintenanceHost {
|
|
45
|
+
readonly agents: readonly AgentKind[];
|
|
46
|
+
readonly readActiveConversation: (userId: number | string, topicName: string) => TopicConversationEntry[];
|
|
47
|
+
readonly readRawConversation: (userId: number | string, topicName: string) => TopicConversationEntry[];
|
|
48
|
+
readonly activeConversationPath: (userId: number | string, topicName: string) => string;
|
|
49
|
+
readonly rawConversationPath: (userId: number | string, topicName: string) => string;
|
|
50
|
+
readonly cleanupRollouts: (agent: AgentKind, cwd: string, sessionIds: string[]) => Promise<void>;
|
|
51
|
+
readonly warn: (context: Record<string, unknown>, message: string) => void;
|
|
52
|
+
}
|
|
53
|
+
export interface TopicLogMaintenance {
|
|
54
|
+
cleanupTopicRollouts(opts: PurgeTopicLogsOptions): Promise<boolean>;
|
|
55
|
+
cleanupTopicRolloutsFromEntries(opts: PurgeTopicLogsOptions, entries: TopicConversationEntry[]): Promise<boolean>;
|
|
56
|
+
rotateTopicLogs(opts: RotateTopicLogsOptions): Promise<RotateTopicLogsResult>;
|
|
57
|
+
purgeTopicLogs(opts: PurgeTopicLogsOptions): Promise<boolean>;
|
|
58
|
+
}
|
|
59
|
+
export interface RotateTopicLogsOptions extends PurgeTopicLogsOptions {
|
|
60
|
+
/** Number of complete user turns carried into the replacement session. */
|
|
61
|
+
retainTurns: number;
|
|
62
|
+
}
|
|
63
|
+
export interface RotateTopicLogsResult {
|
|
64
|
+
rotated: boolean;
|
|
65
|
+
totalTurns: number;
|
|
66
|
+
retainedTurns: number;
|
|
67
|
+
retainedEntries: number;
|
|
68
|
+
}
|
|
69
|
+
export declare function createTopicLogMaintenance(host: TopicLogMaintenanceHost): TopicLogMaintenance;
|
|
70
|
+
/** Remove every provider rollout currently manifested by a topic log. */
|
|
71
|
+
export declare const cleanupTopicRollouts: (opts: PurgeTopicLogsOptions) => Promise<boolean>;
|
|
72
|
+
/** Remove rollout ids captured from a point-in-time conversation manifest. */
|
|
73
|
+
export declare const cleanupTopicRolloutsFromEntries: (opts: PurgeTopicLogsOptions, entries: TopicConversationEntry[]) => Promise<boolean>;
|
|
74
|
+
/**
|
|
75
|
+
* Replace a topic's native provider sessions while retaining a bounded tail
|
|
76
|
+
* of its provider-neutral conversation log.
|
|
77
|
+
*/
|
|
78
|
+
export declare const rotateTopicLogs: (opts: RotateTopicLogsOptions) => Promise<RotateTopicLogsResult>;
|
|
79
|
+
/**
|
|
80
|
+
* Best-effort teardown of every artifact associated with a topic's
|
|
81
|
+
* conversation lifecycle.
|
|
82
|
+
*/
|
|
83
|
+
export declare const purgeTopicLogs: (opts: PurgeTopicLogsOptions) => Promise<boolean>;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RuntimeBus — the outbound half of the host boundary.
|
|
3
|
+
*
|
|
4
|
+
* The runtime publishes topic-scoped events here; whatever host embeds the
|
|
5
|
+
* runtime (CLI, Telegram bot, otium worker node, web API) subscribes and
|
|
6
|
+
* renders them on its channel. This replaces otium's WsHub with a
|
|
7
|
+
* channel-agnostic seam: negotium core never knows what a "websocket" or a
|
|
8
|
+
* "chat" is.
|
|
9
|
+
*
|
|
10
|
+
* The default bus is backed by the shared SQLite store. Every process writes
|
|
11
|
+
* events to one monotonic log and tails events written by its peers, while
|
|
12
|
+
* still delivering its own events synchronously. Hosts may replace it with
|
|
13
|
+
* `setRuntimeBus` in tests or specialized embeddings.
|
|
14
|
+
*/
|
|
15
|
+
import type { ToolCallSummaryInput } from "./agents/tool-format";
|
|
16
|
+
import type { AgentKind } from "./types";
|
|
17
|
+
import type { MessageDto, TopicSurface } from "./types/api";
|
|
18
|
+
/**
|
|
19
|
+
* Scope a `topic-deleted` event carries about the room it just removed.
|
|
20
|
+
*
|
|
21
|
+
* A delete event fires after the topic row is already gone, so any consumer
|
|
22
|
+
* that filters events by re-querying `getTopic(topicId)` (the node gateway's
|
|
23
|
+
* SSE stream) would find nothing and drop the event. Carrying the scope the
|
|
24
|
+
* room had right before deletion lets that filtering happen from the event
|
|
25
|
+
* itself instead of a lookup that is guaranteed to miss.
|
|
26
|
+
*/
|
|
27
|
+
export interface TopicDeletedMeta {
|
|
28
|
+
surface?: TopicSurface;
|
|
29
|
+
surfaceScope?: string | null;
|
|
30
|
+
/**
|
|
31
|
+
* Identity (`NODE_ID`) of the node that deleted the topic, so a host can bind
|
|
32
|
+
* the tombstone to the node its mapping was recorded against (topic-link
|
|
33
|
+
* design v2 §4.5). Absent on events written by older nodes.
|
|
34
|
+
*/
|
|
35
|
+
nodeId?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface RuntimeBusEvent {
|
|
38
|
+
type: "message" | "message-updated" | "ai-status" | "topic-created" | "topic-updated" | "topic-deleted";
|
|
39
|
+
topicId: string;
|
|
40
|
+
payload: unknown;
|
|
41
|
+
/** Durable event-log ordering metadata when available. */
|
|
42
|
+
seq?: number;
|
|
43
|
+
createdAt?: string;
|
|
44
|
+
}
|
|
45
|
+
export type RuntimeBusListener = (event: RuntimeBusEvent) => void;
|
|
46
|
+
/** Cumulative preview, not a persisted transcript message. */
|
|
47
|
+
export type MessageStreamStatus = {
|
|
48
|
+
kind: "message_stream";
|
|
49
|
+
queryId: string;
|
|
50
|
+
messageId: string;
|
|
51
|
+
text: string;
|
|
52
|
+
createdAt: string;
|
|
53
|
+
threadRootId?: string;
|
|
54
|
+
};
|
|
55
|
+
export interface RuntimeBus {
|
|
56
|
+
broadcastMessage(topicId: string, message: MessageDto): void;
|
|
57
|
+
broadcastMessageUpdated(topicId: string, messageId: string, patch: Partial<MessageDto> & Record<string, unknown>): void;
|
|
58
|
+
broadcastAiStatus(topicId: string, status: Record<string, unknown>): void;
|
|
59
|
+
broadcastTopicCreated(topic: {
|
|
60
|
+
id: string;
|
|
61
|
+
}): void;
|
|
62
|
+
broadcastTopicUpdated(topicId: string): void;
|
|
63
|
+
broadcastTopicDeleted(topicId: string, meta?: TopicDeletedMeta): void;
|
|
64
|
+
/** Announce a just-started AI turn so every subscriber learns its queryId. */
|
|
65
|
+
broadcastAiActive(topicId: string, queryId: string): void;
|
|
66
|
+
broadcastDone(topicId: string, queryId: string, usage?: NonNullable<MessageDto["usage"]>, meta?: {
|
|
67
|
+
agent?: AgentKind;
|
|
68
|
+
model?: string;
|
|
69
|
+
budgetReason?: "cost" | "wall_time";
|
|
70
|
+
}): void;
|
|
71
|
+
broadcastError(topicId: string, queryId: string, error: string): void;
|
|
72
|
+
broadcastTopicNotice(topicId: string, severity: "info" | "warning" | "error", label: string): void;
|
|
73
|
+
broadcastMidTurnRead(topicId: string, queryId: string, messageIds: readonly string[]): void;
|
|
74
|
+
broadcastAborted(topicId: string, queryId: string, reason?: "superseded" | "stopped"): void;
|
|
75
|
+
broadcastToolCall(topicId: string, queryId: string, name: string, input: ToolCallSummaryInput | undefined, label: string, toolUseId: string): void;
|
|
76
|
+
broadcastToolOutput(topicId: string, queryId: string, toolUseId: string, content: string, isError?: boolean): void;
|
|
77
|
+
broadcastToolStatus(topicId: string, queryId: string, kind: "status" | "progress" | "summary", content: string, meta?: {
|
|
78
|
+
toolName?: string;
|
|
79
|
+
elapsed?: number;
|
|
80
|
+
}): void;
|
|
81
|
+
broadcastFileReady(topicId: string, queryId: string, path: string, source: string): void;
|
|
82
|
+
broadcastReasoning(topicId: string, queryId: string, content: string): void;
|
|
83
|
+
broadcastVisual(topicId: string, queryId: string, url: string, id?: number, title?: string | null, kind?: "html" | "mermaid" | "image" | "video"): void;
|
|
84
|
+
/** Typing indicator: userId is the typist ("ai") or "" to clear. */
|
|
85
|
+
broadcastTyping(topicId: string, userId: string): void;
|
|
86
|
+
subscribe(listener: RuntimeBusListener): () => void;
|
|
87
|
+
}
|
|
88
|
+
export interface SqliteRuntimeBusOptions {
|
|
89
|
+
sourceId?: string;
|
|
90
|
+
pollIntervalMs?: number;
|
|
91
|
+
}
|
|
92
|
+
export declare class SqliteRuntimeBus implements RuntimeBus {
|
|
93
|
+
private listeners;
|
|
94
|
+
private readonly sourceId;
|
|
95
|
+
private readonly pollIntervalMs;
|
|
96
|
+
private cursor;
|
|
97
|
+
private pollTimer;
|
|
98
|
+
private polling;
|
|
99
|
+
constructor(options?: SqliteRuntimeBusOptions);
|
|
100
|
+
private deliver;
|
|
101
|
+
private emit;
|
|
102
|
+
private startPolling;
|
|
103
|
+
private stopPolling;
|
|
104
|
+
private poll;
|
|
105
|
+
broadcastMessage(topicId: string, message: MessageDto): void;
|
|
106
|
+
broadcastMessageUpdated(topicId: string, messageId: string, patch: Partial<MessageDto> & Record<string, unknown>): void;
|
|
107
|
+
broadcastAiStatus(topicId: string, status: Record<string, unknown>): void;
|
|
108
|
+
broadcastTopicCreated(topic: {
|
|
109
|
+
id: string;
|
|
110
|
+
}): void;
|
|
111
|
+
broadcastTopicUpdated(topicId: string): void;
|
|
112
|
+
broadcastTopicDeleted(topicId: string, meta?: TopicDeletedMeta): void;
|
|
113
|
+
broadcastAiActive(topicId: string, queryId: string): void;
|
|
114
|
+
broadcastDone(topicId: string, queryId: string, usage?: NonNullable<MessageDto["usage"]>, meta?: {
|
|
115
|
+
agent?: AgentKind;
|
|
116
|
+
model?: string;
|
|
117
|
+
budgetReason?: "cost" | "wall_time";
|
|
118
|
+
}): void;
|
|
119
|
+
broadcastError(topicId: string, queryId: string, error: string): void;
|
|
120
|
+
broadcastTopicNotice(topicId: string, severity: "info" | "warning" | "error", label: string): void;
|
|
121
|
+
/** The running turn read these messages the person sent while it worked. */
|
|
122
|
+
broadcastMidTurnRead(topicId: string, queryId: string, messageIds: readonly string[]): void;
|
|
123
|
+
broadcastAborted(topicId: string, queryId: string, reason?: "superseded" | "stopped"): void;
|
|
124
|
+
broadcastToolCall(topicId: string, queryId: string, name: string, input: ToolCallSummaryInput | undefined, label: string, toolUseId: string): void;
|
|
125
|
+
broadcastToolOutput(topicId: string, queryId: string, toolUseId: string, content: string, isError?: boolean): void;
|
|
126
|
+
broadcastToolStatus(topicId: string, queryId: string, kind: "status" | "progress" | "summary", content: string, meta?: {
|
|
127
|
+
toolName?: string;
|
|
128
|
+
elapsed?: number;
|
|
129
|
+
}): void;
|
|
130
|
+
broadcastFileReady(topicId: string, queryId: string, path: string, source: string): void;
|
|
131
|
+
broadcastReasoning(topicId: string, queryId: string, content: string): void;
|
|
132
|
+
broadcastVisual(topicId: string, queryId: string, url: string, id?: number, title?: string | null, kind?: "html" | "mermaid" | "image" | "video"): void;
|
|
133
|
+
broadcastTyping(topicId: string, userId: string): void;
|
|
134
|
+
subscribe(listener: RuntimeBusListener): () => void;
|
|
135
|
+
}
|
|
136
|
+
export declare function runtimeBus(): RuntimeBus;
|
|
137
|
+
export declare function setRuntimeBus(bus: RuntimeBus): void;
|
|
138
|
+
/** Drop-in compat for code ported from otium's `WsHub.get()` call sites. */
|
|
139
|
+
export declare const WsHub: {
|
|
140
|
+
get(): RuntimeBus;
|
|
141
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Semantic identifier vocabulary for the canonical runtime.
|
|
2
|
+
*
|
|
3
|
+
* Wire and SQLite representations remain strings. Branding begins at
|
|
4
|
+
* construction boundaries so internal code cannot accidentally exchange ids
|
|
5
|
+
* that merely share the same representation.
|
|
6
|
+
*/
|
|
7
|
+
declare const identifierKind: unique symbol;
|
|
8
|
+
export type Identifier<Kind extends string> = string & {
|
|
9
|
+
readonly [identifierKind]: Kind;
|
|
10
|
+
};
|
|
11
|
+
export type UserId = Identifier<"UserId">;
|
|
12
|
+
export type TopicId = Identifier<"TopicId">;
|
|
13
|
+
export type MessageId = Identifier<"MessageId">;
|
|
14
|
+
export type RequestId = Identifier<"RequestId">;
|
|
15
|
+
export type ClientMessageId = Identifier<"ClientMessageId">;
|
|
16
|
+
export type TurnId = Identifier<"TurnId">;
|
|
17
|
+
export type ProviderSessionId = Identifier<"ProviderSessionId">;
|
|
18
|
+
export type TurnSlotKey = Identifier<"TurnSlotKey">;
|
|
19
|
+
export type FileId = Identifier<"FileId">;
|
|
20
|
+
export declare function asUserId(value: string): UserId;
|
|
21
|
+
export declare function asTopicId(value: string): TopicId;
|
|
22
|
+
export declare function asMessageId(value: string): MessageId;
|
|
23
|
+
export declare function asRequestId(value: string): RequestId;
|
|
24
|
+
export declare function asClientMessageId(value: string): ClientMessageId;
|
|
25
|
+
export declare function asTurnId(value: string): TurnId;
|
|
26
|
+
export declare function asTurnSlotKey(value: string): TurnSlotKey;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PeerRuntimeBridgeContext } from "../types";
|
|
2
|
+
export type CanonicalMcpSurface = "task" | "decision" | "wiki" | "session-history";
|
|
3
|
+
export interface CanonicalMcpBridgeScope {
|
|
4
|
+
surface: CanonicalMcpSurface;
|
|
5
|
+
userId: string;
|
|
6
|
+
topicId: string;
|
|
7
|
+
queryId: string;
|
|
8
|
+
peerBridge: PeerRuntimeBridgeContext;
|
|
9
|
+
}
|
|
10
|
+
export interface CanonicalMcpBridgeEnvLease {
|
|
11
|
+
env: Record<string, string>;
|
|
12
|
+
/** Revoke the capability immediately. Must be safe to call more than once. */
|
|
13
|
+
revoke(): void;
|
|
14
|
+
}
|
|
15
|
+
export type CanonicalMcpBridgeEnvProvider = (scope: CanonicalMcpBridgeScope) => CanonicalMcpBridgeEnvLease | undefined;
|
|
16
|
+
/** Placement adapters install a scoped capability issuer without exposing
|
|
17
|
+
* their hub discovery or authentication model to generic core. */
|
|
18
|
+
export declare function registerCanonicalMcpBridgeEnvProvider(provider: CanonicalMcpBridgeEnvProvider): () => void;
|
|
19
|
+
export declare function canonicalMcpBridgeEnv(scope: CanonicalMcpBridgeScope): Record<string, string> | undefined;
|
|
20
|
+
/** Revoke every canonical MCP capability issued while building one placed turn. */
|
|
21
|
+
export declare function revokeCanonicalMcpBridgeTurn(scope: Pick<CanonicalMcpBridgeScope, "userId" | "topicId" | "queryId" | "peerBridge">): number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
export interface CompactionLogMcpContext {
|
|
3
|
+
filePath: string;
|
|
4
|
+
maxCalls?: number;
|
|
5
|
+
maxTotalBytes?: number;
|
|
6
|
+
maxChunkBytes?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function createCompactionLogMcpServer(context: CompactionLogMcpContext): McpServer;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { type StoredDecision } from "../../storage/decisions";
|
|
3
|
+
import type { AgentKind } from "../../types";
|
|
4
|
+
export interface DecisionMcpContext {
|
|
5
|
+
userId: string;
|
|
6
|
+
topic: string;
|
|
7
|
+
topicId?: string;
|
|
8
|
+
agent: AgentKind;
|
|
9
|
+
model?: string;
|
|
10
|
+
/** False for product surfaces that keep provider routing private. */
|
|
11
|
+
exposeExecutionMetadata?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface DecisionMcpHost {
|
|
14
|
+
readDecisions(userId: string, scopeKey: string): StoredDecision[];
|
|
15
|
+
writeDecisions(userId: string, scopeKey: string, decisions: StoredDecision[]): void;
|
|
16
|
+
}
|
|
17
|
+
export declare const defaultDecisionMcpHost: DecisionMcpHost;
|
|
18
|
+
export declare function createDecisionMcpServer(context: DecisionMcpContext, host?: DecisionMcpHost): McpServer;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { parseSessionCommContext, type SessionCommContext, type SessionCommContextDefaults, } from "../session-comm/context";
|
|
2
|
+
export { createSessionTargetCatalog, type SessionTarget, type SessionTargetCatalog, type SessionTargetCatalogHost, type SessionTopicEntry, type SessionTopicRow, type ValidateSessionTargetResult, } from "../session-comm/topic-catalog";
|
|
3
|
+
export { createWikiMcpServer, type WikiMcpContext, type WikiMcpHost, type WikiSurface, type WikiTopicBrief, } from "../wiki-server";
|
|
4
|
+
export { type AgentHealthMcpContext, createAgentHealthMcpServer, } from "./agent-health";
|
|
5
|
+
export { type CompactionLogMcpContext, createCompactionLogMcpServer, } from "./compaction-log";
|
|
6
|
+
export { createDecisionMcpServer, type DecisionMcpContext, type DecisionMcpHost, defaultDecisionMcpHost, } from "./decision";
|
|
7
|
+
export { createSessionCommMcpServer, type SessionCommMcpHost, type SessionCommMcpOptions, type SessionCommMcpResult, } from "./session-comm";
|
|
8
|
+
export { createSessionHistoryMcpServer, type SessionHistoryMcpContext, } from "./session-history";
|
|
9
|
+
export { type McpStdioProtectionTarget, protectMcpStdio, } from "./stdio-protection";
|
|
10
|
+
export { createSystemHealthMcpServer, defaultSystemHealthMcpHost, type SystemHealthMcpHost, type SystemHealthSnapshot, } from "./system-health";
|
|
11
|
+
export { createTaskMcpServer, defaultTaskMcpHost, type TaskMcpContext, type TaskMcpHost, } from "./task";
|
|
12
|
+
export { createTokenStatsMcpServer, defaultTokenStatsMcpHost, type TokenStatsMcpContext, type TokenStatsMcpHost, type TokenStatsSnapshot, } from "./token-stats";
|
|
13
|
+
export { createVaultMcpServer, type VaultMcpContext, type VaultMcpHost, } from "./vault";
|