@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,282 @@
|
|
|
1
|
+
import type { ActorTopicScope, RemoteSessionGrant } from "./types";
|
|
2
|
+
import type { AttachmentDto, MessageDto } from "./types/api";
|
|
3
|
+
export declare const RUNTIME_GATEWAY_VERSION: 1;
|
|
4
|
+
export declare const RUNTIME_GATEWAY_CONTROL_PATH = "/api/v1/control/runtime/v1";
|
|
5
|
+
export type RuntimeGatewayErrorKind = "config" | "timeout" | "transport" | "protocol" | "http";
|
|
6
|
+
export declare class RuntimeGatewayError extends Error {
|
|
7
|
+
readonly kind: RuntimeGatewayErrorKind;
|
|
8
|
+
readonly status?: number | undefined;
|
|
9
|
+
constructor(message: string, kind: RuntimeGatewayErrorKind, status?: number | undefined);
|
|
10
|
+
}
|
|
11
|
+
export interface RuntimeGatewayHealth {
|
|
12
|
+
ok: true;
|
|
13
|
+
v: typeof RUNTIME_GATEWAY_VERSION;
|
|
14
|
+
nodeId?: string;
|
|
15
|
+
aiName?: string;
|
|
16
|
+
capabilities: string[];
|
|
17
|
+
cursor: number;
|
|
18
|
+
}
|
|
19
|
+
/** Remote-only MCP transport a gateway host may grant to a manager topic. */
|
|
20
|
+
export interface HostMcpServerSpec {
|
|
21
|
+
type: "sse" | "http";
|
|
22
|
+
url: string;
|
|
23
|
+
headers?: Record<string, string>;
|
|
24
|
+
timeout?: number;
|
|
25
|
+
}
|
|
26
|
+
/** Keep host grants remote-only so a gateway caller cannot spawn node processes. */
|
|
27
|
+
export declare function parseHostMcpServers(value: unknown): Record<string, HostMcpServerSpec> | undefined;
|
|
28
|
+
export interface RuntimeGatewayTurnInput {
|
|
29
|
+
topicId: string;
|
|
30
|
+
/** Canonical principal on the execution node. */
|
|
31
|
+
userId: string;
|
|
32
|
+
/** Product-side actor, when it differs from the execution principal. */
|
|
33
|
+
actorUserId?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The node topic ids `actorUserId` may reach on the receiving node, as the
|
|
36
|
+
* host's membership store sees it. Omitted by hosts that predate it; the
|
|
37
|
+
* node then confines the turn's cross-room tools to the current room.
|
|
38
|
+
*/
|
|
39
|
+
actorTopicScope?: ActorTopicScope;
|
|
40
|
+
/**
|
|
41
|
+
* Hub-issued per-turn authority for remote (`node/topic`) session-comm:
|
|
42
|
+
* `{ hubUrl, capability }`. `hubUrl` must be a loopback `http://` or any
|
|
43
|
+
* `https://` origin (≤ 512 chars); `capability` an opaque `rsc1.` bearer
|
|
44
|
+
* (≤ 2 KiB) the node presents back to the hub and cannot verify — it holds
|
|
45
|
+
* no key. It does base64-decode the payload's `e` (expiry) for one purpose,
|
|
46
|
+
* ordering grants when several requests fold into one turn
|
|
47
|
+
* (`remoteSessionGrantExpiry`); that value is untrusted and takes part in no
|
|
48
|
+
* security decision. Omitted
|
|
49
|
+
* by hosts that predate it or have the feature off; the node then keeps
|
|
50
|
+
* remote session-comm fail-closed on the `otium` surface. Malformed → 400.
|
|
51
|
+
*/
|
|
52
|
+
remoteSession?: RemoteSessionGrant;
|
|
53
|
+
actorLabel?: string;
|
|
54
|
+
vaultUserId?: string;
|
|
55
|
+
/** Adapter provenance recorded on the canonical message. */
|
|
56
|
+
sourceAdapter?: string;
|
|
57
|
+
text: string;
|
|
58
|
+
clientMessageId: string;
|
|
59
|
+
requestId?: string;
|
|
60
|
+
allowAutoContinue?: boolean;
|
|
61
|
+
threadRootId?: string;
|
|
62
|
+
/** Inline quote-reply target. Mutually exclusive with `threadRootId`. */
|
|
63
|
+
parentId?: string;
|
|
64
|
+
respond?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* While a turn from the same person runs: `true` (default) aborts it and
|
|
67
|
+
* resumes with the merged batch; `false` queues this message behind it.
|
|
68
|
+
*/
|
|
69
|
+
steer?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* While a turn from the same person runs: deliver this message into it, read
|
|
72
|
+
* after the step it is on, and the work goes on (Codex-style steer). Wins over
|
|
73
|
+
* `steer`; when the turn cannot take it, the message is queued behind it. A
|
|
74
|
+
* node too old for this ignores the field, so send `steer: false` with it.
|
|
75
|
+
*/
|
|
76
|
+
inject?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* While the room works, hold this message as a follow-up instead of queuing
|
|
79
|
+
* a turn (`turn-follow-ups` capability; use `holdOrSubmitTurn`). Held, it
|
|
80
|
+
* is not in the transcript and can be edited, moved, deleted or sent now; the
|
|
81
|
+
* node sends held follow-ups one per turn once the room is idle.
|
|
82
|
+
*/
|
|
83
|
+
hold?: boolean;
|
|
84
|
+
/** Run without adding the injected prompt or output to the visible transcript. */
|
|
85
|
+
silent?: boolean;
|
|
86
|
+
attachments?: string[];
|
|
87
|
+
visualTools?: boolean;
|
|
88
|
+
fileDeliveryTools?: boolean;
|
|
89
|
+
/** Host-owned remote MCP servers granted to this manager topic. */
|
|
90
|
+
hostMcpServers?: Record<string, HostMcpServerSpec>;
|
|
91
|
+
}
|
|
92
|
+
export interface RuntimeGatewayTurnAcknowledgement {
|
|
93
|
+
ok: true;
|
|
94
|
+
v: typeof RUNTIME_GATEWAY_VERSION;
|
|
95
|
+
accepted: true;
|
|
96
|
+
deduplicated: boolean;
|
|
97
|
+
requestId: string;
|
|
98
|
+
clientMessageId: string;
|
|
99
|
+
topicId: string;
|
|
100
|
+
messageId: string;
|
|
101
|
+
/** Canonical persisted message when the Node supports inline ACK materialization. */
|
|
102
|
+
message?: MessageDto;
|
|
103
|
+
cursor: number;
|
|
104
|
+
}
|
|
105
|
+
/** A message held while the room worked (`turn-follow-ups`). */
|
|
106
|
+
export interface RuntimeGatewayFollowUp {
|
|
107
|
+
id: string;
|
|
108
|
+
text: string;
|
|
109
|
+
actorUserId: string;
|
|
110
|
+
attachments: AttachmentDto[];
|
|
111
|
+
createdAt: string;
|
|
112
|
+
}
|
|
113
|
+
/** A room's held follow-ups, oldest first, and whether they wait after a stop. */
|
|
114
|
+
export interface RuntimeGatewayFollowUpLine {
|
|
115
|
+
topicId: string;
|
|
116
|
+
followUps: RuntimeGatewayFollowUp[];
|
|
117
|
+
paused: boolean;
|
|
118
|
+
}
|
|
119
|
+
export interface RuntimeGatewayHeldTurn {
|
|
120
|
+
ok: true;
|
|
121
|
+
v: typeof RUNTIME_GATEWAY_VERSION;
|
|
122
|
+
accepted: true;
|
|
123
|
+
held: true;
|
|
124
|
+
clientMessageId: string;
|
|
125
|
+
topicId: string;
|
|
126
|
+
followUp: RuntimeGatewayFollowUp;
|
|
127
|
+
}
|
|
128
|
+
export interface RuntimeGatewayFollowUpActor {
|
|
129
|
+
/** Canonical principal on the execution node. */
|
|
130
|
+
userId: string;
|
|
131
|
+
/** The person who sent it; only they may change it. Defaults to `userId`. */
|
|
132
|
+
actorUserId?: string;
|
|
133
|
+
}
|
|
134
|
+
export interface RuntimeGatewayTopicDeriveInput {
|
|
135
|
+
userId: string;
|
|
136
|
+
copyHistory: boolean;
|
|
137
|
+
name?: string;
|
|
138
|
+
}
|
|
139
|
+
export interface RuntimeGatewayDerivedTopic {
|
|
140
|
+
id: string;
|
|
141
|
+
title: string;
|
|
142
|
+
kind?: string;
|
|
143
|
+
agent?: string;
|
|
144
|
+
defaultModel?: string;
|
|
145
|
+
defaultEffort?: string;
|
|
146
|
+
parentTopicId?: string;
|
|
147
|
+
isFork?: boolean;
|
|
148
|
+
}
|
|
149
|
+
export interface RuntimeGatewaySseEvent {
|
|
150
|
+
id?: number;
|
|
151
|
+
event: string;
|
|
152
|
+
data: unknown;
|
|
153
|
+
}
|
|
154
|
+
export interface RuntimeGatewayTopicUsage {
|
|
155
|
+
queries: number;
|
|
156
|
+
inputTokens: number;
|
|
157
|
+
outputTokens: number;
|
|
158
|
+
cacheCreationInputTokens: number;
|
|
159
|
+
cacheReadInputTokens: number;
|
|
160
|
+
estimatedCostUsd: number;
|
|
161
|
+
}
|
|
162
|
+
export interface RuntimeGatewayManagerTopic {
|
|
163
|
+
id: string;
|
|
164
|
+
title: string;
|
|
165
|
+
kind: "manager";
|
|
166
|
+
agent?: "claude" | "codex" | "maestro";
|
|
167
|
+
participants: Array<{
|
|
168
|
+
userId: string;
|
|
169
|
+
role: "owner" | "member";
|
|
170
|
+
}>;
|
|
171
|
+
}
|
|
172
|
+
export interface RuntimeGatewayDeletedMessage {
|
|
173
|
+
id: string;
|
|
174
|
+
topicId: string;
|
|
175
|
+
authorId: string;
|
|
176
|
+
text: string;
|
|
177
|
+
deleted: true;
|
|
178
|
+
createdAt: string;
|
|
179
|
+
}
|
|
180
|
+
export interface RuntimeGatewayCronJob {
|
|
181
|
+
id: string;
|
|
182
|
+
name: string;
|
|
183
|
+
executionPrincipalUserId: string;
|
|
184
|
+
actorOwnerUserId: string;
|
|
185
|
+
topicId: string;
|
|
186
|
+
source: "prompt" | "script";
|
|
187
|
+
script: string | null;
|
|
188
|
+
scriptExists: boolean;
|
|
189
|
+
prompt: string | null;
|
|
190
|
+
promptPreview: string | null;
|
|
191
|
+
summary: string | null;
|
|
192
|
+
schedule: string;
|
|
193
|
+
timezone: string | null;
|
|
194
|
+
enabled: boolean;
|
|
195
|
+
agent: "claude" | "codex" | "maestro" | null;
|
|
196
|
+
model: string | null;
|
|
197
|
+
effort: string | null;
|
|
198
|
+
nextRunAt: string;
|
|
199
|
+
runCount: number;
|
|
200
|
+
lastRun: Record<string, unknown> | null;
|
|
201
|
+
createdAt: string;
|
|
202
|
+
updatedAt: string;
|
|
203
|
+
canMutate: boolean;
|
|
204
|
+
}
|
|
205
|
+
export interface RuntimeGatewayCronCreateInput {
|
|
206
|
+
userId: string;
|
|
207
|
+
actorUserId: string;
|
|
208
|
+
topicId: string;
|
|
209
|
+
name: string;
|
|
210
|
+
script: string;
|
|
211
|
+
schedule: string;
|
|
212
|
+
timezone?: string;
|
|
213
|
+
agent?: "claude" | "codex" | "maestro";
|
|
214
|
+
model?: string;
|
|
215
|
+
effort?: string;
|
|
216
|
+
}
|
|
217
|
+
export interface RuntimeGatewayCronPatch {
|
|
218
|
+
name?: string;
|
|
219
|
+
topicId?: string;
|
|
220
|
+
script?: string;
|
|
221
|
+
schedule?: string;
|
|
222
|
+
timezone?: string | null;
|
|
223
|
+
enabled?: boolean;
|
|
224
|
+
agent?: "claude" | "codex" | "maestro" | null;
|
|
225
|
+
model?: string | null;
|
|
226
|
+
effort?: string | null;
|
|
227
|
+
}
|
|
228
|
+
export type RuntimeGatewayToken = string | (() => string | Promise<string>);
|
|
229
|
+
export type RuntimeGatewayFetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
230
|
+
export interface RuntimeGatewayClientOptions {
|
|
231
|
+
baseUrl: string;
|
|
232
|
+
token: RuntimeGatewayToken;
|
|
233
|
+
/** Loopback control path or an authenticated relay forward prefix. */
|
|
234
|
+
pathPrefix?: string;
|
|
235
|
+
fetch?: RuntimeGatewayFetch;
|
|
236
|
+
requestTimeoutMs?: number;
|
|
237
|
+
compactTimeoutMs?: number;
|
|
238
|
+
}
|
|
239
|
+
export declare function parseRuntimeGatewaySse(body: ReadableStream<Uint8Array>): AsyncGenerator<RuntimeGatewaySseEvent>;
|
|
240
|
+
export declare class RuntimeGatewayClient {
|
|
241
|
+
private readonly options;
|
|
242
|
+
private readonly pathPrefix;
|
|
243
|
+
private readonly request;
|
|
244
|
+
private readonly requestTimeoutMs;
|
|
245
|
+
private readonly compactTimeoutMs;
|
|
246
|
+
constructor(options: RuntimeGatewayClientOptions);
|
|
247
|
+
private endpoint;
|
|
248
|
+
private authorization;
|
|
249
|
+
private send;
|
|
250
|
+
health(): Promise<RuntimeGatewayHealth>;
|
|
251
|
+
submitTurn(input: RuntimeGatewayTurnInput): Promise<RuntimeGatewayTurnAcknowledgement>;
|
|
252
|
+
/**
|
|
253
|
+
* `submitTurn` with `hold: true`: while the room works the node holds the
|
|
254
|
+
* message as a follow-up and answers with it; otherwise it is a turn as usual.
|
|
255
|
+
*/
|
|
256
|
+
holdOrSubmitTurn(input: RuntimeGatewayTurnInput): Promise<RuntimeGatewayTurnAcknowledgement | RuntimeGatewayHeldTurn>;
|
|
257
|
+
followUps(topicId: string, userId: string): Promise<RuntimeGatewayFollowUpLine>;
|
|
258
|
+
editFollowUp(topicId: string, followUpId: string, actor: RuntimeGatewayFollowUpActor, text: string): Promise<RuntimeGatewayFollowUpLine>;
|
|
259
|
+
deleteFollowUp(topicId: string, followUpId: string, actor: RuntimeGatewayFollowUpActor): Promise<RuntimeGatewayFollowUpLine>;
|
|
260
|
+
moveFollowUp(topicId: string, followUpId: string, actor: RuntimeGatewayFollowUpActor, toIndex: number): Promise<RuntimeGatewayFollowUpLine>;
|
|
261
|
+
/** 지금 보내기: into the running turn when it can take it, else as a turn of its own. */
|
|
262
|
+
sendFollowUpNow(topicId: string, followUpId: string, actor: RuntimeGatewayFollowUpActor): Promise<RuntimeGatewayFollowUpLine & {
|
|
263
|
+
sent: boolean;
|
|
264
|
+
}>;
|
|
265
|
+
private changeFollowUp;
|
|
266
|
+
private followUpLineFrom;
|
|
267
|
+
deriveTopic(topicId: string, input: RuntimeGatewayTopicDeriveInput): Promise<RuntimeGatewayDerivedTopic>;
|
|
268
|
+
ensureManagerTopic(userId: string): Promise<RuntimeGatewayManagerTopic>;
|
|
269
|
+
deleteMessage(topicId: string, messageId: string, actorUserId: string, allowAdmin?: boolean): Promise<RuntimeGatewayDeletedMessage>;
|
|
270
|
+
private cronRequest;
|
|
271
|
+
listCronScripts(): Promise<string[]>;
|
|
272
|
+
listCronJobs(userId: string, actorUserId: string, actorIsAdmin?: boolean): Promise<RuntimeGatewayCronJob[]>;
|
|
273
|
+
createCronJob(input: RuntimeGatewayCronCreateInput): Promise<RuntimeGatewayCronJob>;
|
|
274
|
+
updateCronJob(jobId: string, userId: string, actorUserId: string, patch: RuntimeGatewayCronPatch, actorIsAdmin?: boolean): Promise<RuntimeGatewayCronJob>;
|
|
275
|
+
deleteCronJob(jobId: string, userId: string, actorUserId: string, actorIsAdmin?: boolean): Promise<string>;
|
|
276
|
+
events(after: number, topicId?: string, signal?: AbortSignal): AsyncGenerator<RuntimeGatewaySseEvent>;
|
|
277
|
+
getTopicUsage(topicId: string, userId: string): Promise<RuntimeGatewayTopicUsage>;
|
|
278
|
+
abortTurn(topicId: string, userId: string): Promise<boolean>;
|
|
279
|
+
resetSession(topicId: string, userId: string, reason?: string, actorUserId?: string): Promise<string | undefined>;
|
|
280
|
+
compactSession(topicId: string, userId: string, reason?: string, actorUserId?: string): Promise<string | undefined>;
|
|
281
|
+
private sessionCommand;
|
|
282
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Sanitize a topic/session name for use in file paths.
|
|
2
|
+
* Replaces non-alphanumeric characters (excluding Korean) with underscores.
|
|
3
|
+
* Empty input (or input consisting only of disallowed chars) returns "_" so
|
|
4
|
+
* callers always get a non-empty single path component.
|
|
5
|
+
* @param name The raw topic or session name.
|
|
6
|
+
* @param lowercase Whether to lowercase the result (default: false).
|
|
7
|
+
* Use true for wiki paths; leave false for log file paths.
|
|
8
|
+
*/
|
|
9
|
+
export declare function sanitizeTopicName(name: string, lowercase?: boolean): string;
|
|
10
|
+
/** Sanitize a file name for use in file paths. Allows dots.
|
|
11
|
+
* Pure-dot results (".", "..") are replaced with "_" to block path-traversal
|
|
12
|
+
* when the sanitized value is used as a standalone path component.
|
|
13
|
+
*/
|
|
14
|
+
export declare function sanitizeFileName(name: string): string;
|
|
15
|
+
/** Sanitize an arbitrary ID (no Korean, no dots) for use in file paths. */
|
|
16
|
+
export declare function sanitizeId(id: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isSensitivePath(filePath: string): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { TokenUsage } from "../types";
|
|
2
|
+
export interface LogEntry {
|
|
3
|
+
timestamp: string;
|
|
4
|
+
userId: number;
|
|
5
|
+
sessionId: string | null;
|
|
6
|
+
session: string;
|
|
7
|
+
prompt: string;
|
|
8
|
+
response: string;
|
|
9
|
+
usage?: TokenUsage;
|
|
10
|
+
}
|
|
11
|
+
export declare function writeLog(entry: LogEntry): void;
|
|
12
|
+
/** Remove oldest log files when total size exceeds budget */
|
|
13
|
+
export declare function rotateOldLogs(): void;
|
|
14
|
+
export interface SentFileEntry {
|
|
15
|
+
timestamp: string;
|
|
16
|
+
userId: number;
|
|
17
|
+
topicName: string;
|
|
18
|
+
sessionId: string | null;
|
|
19
|
+
filePath: string;
|
|
20
|
+
fileName: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function writeSentFileLog(entry: Omit<SentFileEntry, "fileName">): void;
|
|
23
|
+
export declare function readSentFilesForTopic(userId: number, topicName: string): SentFileEntry[];
|
|
24
|
+
/** 토픽 삭제 후 JSONL에서 해당 토픽 항목 제거 */
|
|
25
|
+
export declare function removeSentFilesForTopic(userId: number, topicName: string): void;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import type { MessageDto } from "../types/api";
|
|
2
|
+
export interface ApiMessageRow {
|
|
3
|
+
id: string;
|
|
4
|
+
topic_id: string;
|
|
5
|
+
parent_id: string | null;
|
|
6
|
+
author_id: string;
|
|
7
|
+
source_adapter: string | null;
|
|
8
|
+
source_node: string | null;
|
|
9
|
+
source_message_id: string | null;
|
|
10
|
+
text: string;
|
|
11
|
+
query_id: string | null;
|
|
12
|
+
agent_type: string | null;
|
|
13
|
+
model: string | null;
|
|
14
|
+
attachments: string | null;
|
|
15
|
+
usage: string | null;
|
|
16
|
+
deleted: number;
|
|
17
|
+
edited_at: string | null;
|
|
18
|
+
reactions: string | null;
|
|
19
|
+
kind: string | null;
|
|
20
|
+
ask_user_question: string | null;
|
|
21
|
+
tell_card: string | null;
|
|
22
|
+
subagent_card: string | null;
|
|
23
|
+
vault_secret_request: string | null;
|
|
24
|
+
mentions: string | null;
|
|
25
|
+
thread_root_id: string | null;
|
|
26
|
+
created_at: string;
|
|
27
|
+
rowid?: number;
|
|
28
|
+
}
|
|
29
|
+
export type ApiMessageAppendHook = (msg: MessageDto) => void | Promise<void>;
|
|
30
|
+
export interface AppendApiMessageOptions {
|
|
31
|
+
notify?: boolean;
|
|
32
|
+
updateTopicLastMessageAt?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare function registerApiMessageAppendHook(hook: ApiMessageAppendHook): () => void;
|
|
35
|
+
/** Persist a single message. Idempotent on id: duplicate appends do not rewrite edited/reaction state. */
|
|
36
|
+
export declare function appendApiMessage(msg: MessageDto, options?: AppendApiMessageOptions): void;
|
|
37
|
+
export declare function getApiMessage(topicId: string, messageId: string): MessageDto | null;
|
|
38
|
+
export declare function topicHasAttachmentFileId(topicId: string, fileId: string): boolean;
|
|
39
|
+
export declare function updateApiMessageText(topicId: string, messageId: string, text: string, editedAt?: string): MessageDto | null;
|
|
40
|
+
/** Attach terminal turn usage to an already-persisted assistant segment. */
|
|
41
|
+
export declare function updateApiMessageUsage(topicId: string, messageId: string, usage: NonNullable<MessageDto["usage"]>): MessageDto | null;
|
|
42
|
+
export declare function updateApiMessageAskUserQuestion(topicId: string, messageId: string, askUserQuestion: NonNullable<MessageDto["askUserQuestion"]>, editedAt?: string): MessageDto | null;
|
|
43
|
+
export declare function updateApiMessageSubagentCard(topicId: string, messageId: string, subagentCard: NonNullable<MessageDto["subagentCard"]>, editedAt?: string): MessageDto | null;
|
|
44
|
+
/** All non-deleted messages of one kind, across topics (boot-time sweeps). */
|
|
45
|
+
export declare function listApiMessagesByKind(kind: NonNullable<MessageDto["kind"]>): MessageDto[];
|
|
46
|
+
/** Replace a message's full reactions array. Toggle logic lives in the route. */
|
|
47
|
+
export declare function setApiMessageReactions(topicId: string, messageId: string, reactions: NonNullable<MessageDto["reactions"]>): MessageDto | null;
|
|
48
|
+
export declare function softDeleteApiMessage(topicId: string, messageId: string): MessageDto | null;
|
|
49
|
+
/** Soft-delete every live message whose id starts with a caller-owned prefix. */
|
|
50
|
+
export declare function softDeleteApiMessagesByIdPrefix(topicId: string, prefix: string): string[];
|
|
51
|
+
export interface MessagePage {
|
|
52
|
+
page: MessageDto[];
|
|
53
|
+
cursor?: string;
|
|
54
|
+
hasMore: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface ListApiMessagesOptions {
|
|
57
|
+
cursor?: string | null;
|
|
58
|
+
limit?: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* List messages for a topic, NEWEST-FIRST by default (bug G).
|
|
62
|
+
*
|
|
63
|
+
* The chat client loads once on mount and renders whatever it gets, so the
|
|
64
|
+
* initial page must be the *latest* N messages, not the oldest. We therefore
|
|
65
|
+
* query newest→oldest (`ORDER BY rowid DESC`) and then reverse the page back to
|
|
66
|
+
* chronological (oldest→newest) order for display.
|
|
67
|
+
*
|
|
68
|
+
* Pagination is BACKWARD (toward older history): pass the returned `cursor`
|
|
69
|
+
* (the oldest id currently loaded) to fetch the page of messages *older* than
|
|
70
|
+
* it. `hasMore` therefore means "there are older messages above this page".
|
|
71
|
+
*/
|
|
72
|
+
export declare function listApiMessages(topicId: string, options?: ListApiMessagesOptions): MessagePage;
|
|
73
|
+
/**
|
|
74
|
+
* Reply count + last reply time per thread root, computed on read (no
|
|
75
|
+
* denormalized counters to drift). Only non-deleted replies are counted.
|
|
76
|
+
*/
|
|
77
|
+
export declare function getThreadSummaries(rootIds: readonly string[]): Map<string, {
|
|
78
|
+
replyCount: number;
|
|
79
|
+
lastReplyAt: string;
|
|
80
|
+
}>;
|
|
81
|
+
/** The root message plus its thread replies (chronological). */
|
|
82
|
+
export declare function listThreadMessages(topicId: string, rootId: string): {
|
|
83
|
+
root: MessageDto | null;
|
|
84
|
+
replies: MessageDto[];
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* The root message and its replies as raw rows, oldest first.
|
|
88
|
+
*
|
|
89
|
+
* Row-shaped rather than DTO-shaped because the caller renders them with
|
|
90
|
+
* `formatChannelTranscriptLine`, so a thread read to the model looks exactly
|
|
91
|
+
* like the channel transcript it may appear next to.
|
|
92
|
+
*/
|
|
93
|
+
export declare function listThreadMessageRows(topicId: string, rootId: string, limit?: number): {
|
|
94
|
+
root: ApiMessageRow | null;
|
|
95
|
+
replies: ApiMessageRow[];
|
|
96
|
+
};
|
|
97
|
+
/** Total undeleted replies in a thread, for reporting what a read left out. */
|
|
98
|
+
export declare function countThreadReplies(topicId: string, rootId: string): number;
|
|
99
|
+
/**
|
|
100
|
+
* Thread roots in a topic whose id starts with `prefix`, ignoring separators.
|
|
101
|
+
*
|
|
102
|
+
* Resolved in SQL over the whole topic rather than over a page of recent
|
|
103
|
+
* threads: the short tag a model reads in a transcript may belong to a thread
|
|
104
|
+
* that has not been touched in months, and a capped scan reports that thread as
|
|
105
|
+
* nonexistent. Returns every match so the caller can refuse an ambiguous
|
|
106
|
+
* prefix instead of guessing a room's newest thread.
|
|
107
|
+
*/
|
|
108
|
+
export declare function findThreadRootsByPrefix(topicId: string, prefix: string): string[];
|
|
109
|
+
/** Threads in a topic that have at least one reply, most recently active first. */
|
|
110
|
+
export declare function listTopicThreadRoots(topicId: string, limit?: number): {
|
|
111
|
+
rootId: string;
|
|
112
|
+
replyCount: number;
|
|
113
|
+
lastReplyAt: string;
|
|
114
|
+
}[];
|
|
115
|
+
/**
|
|
116
|
+
* Find the newest same-user/same-text message that is recent enough to be the
|
|
117
|
+
* message just posted before a follow-up `/ai` call. This is a compatibility
|
|
118
|
+
* fallback for clients that persist attachments through `/messages` but do not
|
|
119
|
+
* repeat their file ids in the `/ai` request body.
|
|
120
|
+
*/
|
|
121
|
+
export declare function findRecentUserMessage(topicId: string, authorId: string, text: string, maxAgeMs: number): MessageDto | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Latest message text per topic, keyed by topic_id. Used to render a preview
|
|
124
|
+
* subtitle in the topic list. One index-driven query (MAX(rowid) per topic)
|
|
125
|
+
* instead of N round-trips. Empty topics are simply absent from the map.
|
|
126
|
+
*/
|
|
127
|
+
export declare function getLastMessagePreviews(topicIds?: readonly string[]): Map<string, string>;
|
|
128
|
+
/** Hard-delete every message in a topic (used when a topic is deleted). */
|
|
129
|
+
export declare function deleteMessagesForTopic(topicId: string): number;
|
|
130
|
+
/** Anonymize all messages authored by a deleted user. */
|
|
131
|
+
export declare function anonymizeApiMessages(userId: string): void;
|
|
132
|
+
/** Topic ids whose persisted attachment JSON references this exact upload id.
|
|
133
|
+
* Used only as a compatibility bridge for uploads created before ACL metadata
|
|
134
|
+
* was introduced. JSON UUIDs are quoted, avoiding substring matches. */
|
|
135
|
+
export declare function listTopicIdsForAttachment(fileId: string): string[];
|
|
136
|
+
/**
|
|
137
|
+
* Copy all messages from one topic to another (used by fork).
|
|
138
|
+
* Each message gets a new UUID but retains original content, author, and timestamps.
|
|
139
|
+
* Returns the number of messages copied.
|
|
140
|
+
*/
|
|
141
|
+
export declare function copyMessagesForTopic(sourceTopicId: string, targetTopicId: string): number;
|
|
142
|
+
export interface TopicMessageSnapshot {
|
|
143
|
+
sourceTopicId: string;
|
|
144
|
+
rows: ApiMessageRow[];
|
|
145
|
+
capturedAt: string;
|
|
146
|
+
maxRowid: number;
|
|
147
|
+
}
|
|
148
|
+
/** Capture immutable message rows for point-in-time fork/compaction work. */
|
|
149
|
+
export declare function captureMessageSnapshotForTopic(topicId: string): TopicMessageSnapshot;
|
|
150
|
+
/** Copy only rows captured by captureMessageSnapshotForTopic; never re-read the source. */
|
|
151
|
+
export declare function copyMessageSnapshotToTopic(snapshot: TopicMessageSnapshot, targetTopicId: string): number;
|
|
152
|
+
/**
|
|
153
|
+
* Get all messages for a topic in chronological order (used by export).
|
|
154
|
+
*/
|
|
155
|
+
export declare function getAllMessagesForTopic(topicId: string): ApiMessageRow[];
|
|
156
|
+
export declare function getMessagesForTopicAfterRowid(topicId: string, afterRowid: number): ApiMessageRow[];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface TopicBrief {
|
|
2
|
+
topicId: string;
|
|
3
|
+
/** Lightweight topic brief (300-600 tokens, injected at session start). */
|
|
4
|
+
briefMd: string;
|
|
5
|
+
/** Latest session summary markdown (full source-summary). */
|
|
6
|
+
latestSummaryMd?: string;
|
|
7
|
+
/** Date of the latest summary (YYYY-MM-DD). */
|
|
8
|
+
summaryDate?: string;
|
|
9
|
+
/** ISO-8601 timestamp of last update. */
|
|
10
|
+
updatedAt: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Get the topic brief for a storage key. Returns null when no brief
|
|
14
|
+
* has been written yet (fresh topic, no archiver run).
|
|
15
|
+
*/
|
|
16
|
+
export declare function getTopicBrief(storageKey: string): TopicBrief | null;
|
|
17
|
+
/** Resolve title-keyed memory first, retaining id-keyed rows as a migration fallback. */
|
|
18
|
+
export declare function resolveTopicBrief(topicId: string, legacyTitle: string): {
|
|
19
|
+
brief: TopicBrief;
|
|
20
|
+
storageKey: string;
|
|
21
|
+
} | null;
|
|
22
|
+
/**
|
|
23
|
+
* Upsert the topic brief. `briefMd` and `latestSummaryMd` are
|
|
24
|
+
* independently optional — callers can update just one field without
|
|
25
|
+
* wiping the other. `summaryDate` should be the date of the summary
|
|
26
|
+
* (YYYY-MM-DD), set alongside `latestSummaryMd`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function setTopicBrief(topicId: string, fields: {
|
|
29
|
+
briefMd?: string;
|
|
30
|
+
latestSummaryMd?: string;
|
|
31
|
+
summaryDate?: string;
|
|
32
|
+
}): TopicBrief;
|
|
33
|
+
/** Remove a topic's brief row entirely (e.g. on topic hard-delete). */
|
|
34
|
+
export declare function deleteTopicBrief(topicId: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* List all topic briefs for browsing (wiki UI). Returns briefMd
|
|
37
|
+
* only (no full summary body) to keep the payload light.
|
|
38
|
+
*/
|
|
39
|
+
export declare function listTopicBriefs(): TopicBrief[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { EffortLevel } from "../types";
|
|
2
|
+
export interface TopicConfig {
|
|
3
|
+
model?: string;
|
|
4
|
+
effort?: EffortLevel;
|
|
5
|
+
mcp?: string[];
|
|
6
|
+
agentLocked?: boolean;
|
|
7
|
+
modelLocked?: boolean;
|
|
8
|
+
effortLocked?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Per-topic override set via `PATCH /config` (and, going forward, the MCP
|
|
12
|
+
* self-config tools). Returns `undefined` when the topic has no stored row,
|
|
13
|
+
* so callers can distinguish "no override" from "override with empty fields".
|
|
14
|
+
*/
|
|
15
|
+
export declare function getApiTopicConfig(topicId: string): TopicConfig | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Upsert the full override for a topic. Fields set to `undefined` are cleared
|
|
18
|
+
* (stored as SQL NULL), matching the previous Map semantics where the route
|
|
19
|
+
* built a complete `updated` object before persisting.
|
|
20
|
+
*/
|
|
21
|
+
export declare function setApiTopicConfig(topicId: string, config: TopicConfig): void;
|
|
22
|
+
/** Remove a topic's override row entirely (e.g. on topic hard-delete). */
|
|
23
|
+
export declare function deleteApiTopicConfig(topicId: string): void;
|