@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,54 @@
|
|
|
1
|
+
export type SelfScheduleStatus = "pending" | "running";
|
|
2
|
+
export interface SelfSchedule {
|
|
3
|
+
id: string;
|
|
4
|
+
topicId: string;
|
|
5
|
+
userId: string;
|
|
6
|
+
message: string;
|
|
7
|
+
deliverAt: number;
|
|
8
|
+
createdAt: number;
|
|
9
|
+
updatedAt: number;
|
|
10
|
+
status: SelfScheduleStatus;
|
|
11
|
+
claimedBy?: string;
|
|
12
|
+
claimedAt?: number;
|
|
13
|
+
runningQueryId?: string;
|
|
14
|
+
}
|
|
15
|
+
export type CreatePendingSelfScheduleResult = {
|
|
16
|
+
ok: true;
|
|
17
|
+
schedule: SelfSchedule;
|
|
18
|
+
} | {
|
|
19
|
+
ok: false;
|
|
20
|
+
existing: SelfSchedule;
|
|
21
|
+
};
|
|
22
|
+
/** Create the topic's sole pending self-schedule without replacing an existing one. */
|
|
23
|
+
export declare function createPendingSelfSchedule(input: {
|
|
24
|
+
topicId: string;
|
|
25
|
+
userId: string;
|
|
26
|
+
message: string;
|
|
27
|
+
deliverAt: number;
|
|
28
|
+
now?: number;
|
|
29
|
+
}): CreatePendingSelfScheduleResult;
|
|
30
|
+
export declare function getPendingSelfSchedule(topicId: string): SelfSchedule | null;
|
|
31
|
+
export declare function updatePendingSelfSchedule(input: {
|
|
32
|
+
topicId: string;
|
|
33
|
+
scheduleId: string;
|
|
34
|
+
message?: string;
|
|
35
|
+
deliverAt?: number;
|
|
36
|
+
now?: number;
|
|
37
|
+
}): SelfSchedule | null;
|
|
38
|
+
export declare function cancelPendingSelfSchedule(topicId: string, scheduleId: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Claim one due schedule whose topic is idle. A stale running row is retryable
|
|
41
|
+
* after its process and topic lease disappear, preserving work across crashes.
|
|
42
|
+
*/
|
|
43
|
+
export declare function claimNextDueSelfSchedule(ownerId: string, now?: number): SelfSchedule | null;
|
|
44
|
+
export declare function markSelfScheduleRunning(scheduleId: string, ownerId: string, queryId: string): boolean;
|
|
45
|
+
export declare function heartbeatSelfScheduleClaim(scheduleId: string, ownerId: string, now?: number): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Put an interrupted run back into the single pending slot. If its own turn
|
|
48
|
+
* already created a newer pending schedule, the newer explicit schedule wins.
|
|
49
|
+
*/
|
|
50
|
+
export declare function releaseSelfScheduleClaim(scheduleId: string, ownerId: string): "released" | "dropped";
|
|
51
|
+
export declare function completeSelfSchedule(scheduleId: string, ownerId?: string): boolean;
|
|
52
|
+
export declare function deleteSelfSchedulesForTopic(topicId: string): number;
|
|
53
|
+
/** Test/diagnostic helper covering pending and in-flight rows. */
|
|
54
|
+
export declare function listSelfSchedulesForTopic(topicId: string): SelfSchedule[];
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export declare const PENDING_ASK_TTL_MS: number;
|
|
2
|
+
export type PendingAskState = "requested" | "reply_ready" | "queued_for_caller" | "injecting_to_caller";
|
|
3
|
+
export type PendingAskUserId = number | string;
|
|
4
|
+
export interface PendingAskRecord {
|
|
5
|
+
userId: PendingAskUserId;
|
|
6
|
+
from: string;
|
|
7
|
+
to: string;
|
|
8
|
+
requestId: string;
|
|
9
|
+
contextId?: string;
|
|
10
|
+
state: PendingAskState;
|
|
11
|
+
createdAt: string;
|
|
12
|
+
updatedAt: string;
|
|
13
|
+
}
|
|
14
|
+
export interface AskReplySource {
|
|
15
|
+
from?: string;
|
|
16
|
+
requestId?: string;
|
|
17
|
+
contextId?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface PendingAskKey {
|
|
20
|
+
userId: PendingAskUserId;
|
|
21
|
+
from: string;
|
|
22
|
+
to: string;
|
|
23
|
+
}
|
|
24
|
+
export interface PendingAskIdentity extends PendingAskKey {
|
|
25
|
+
requestId?: string;
|
|
26
|
+
}
|
|
27
|
+
type AskIdentity = PendingAskIdentity;
|
|
28
|
+
export declare function createPendingAsk(args: {
|
|
29
|
+
userId: PendingAskUserId;
|
|
30
|
+
from: string;
|
|
31
|
+
to: string;
|
|
32
|
+
requestId: string;
|
|
33
|
+
contextId?: string;
|
|
34
|
+
}): {
|
|
35
|
+
ok: true;
|
|
36
|
+
record: PendingAskRecord;
|
|
37
|
+
} | {
|
|
38
|
+
ok: false;
|
|
39
|
+
existing: PendingAskRecord | null;
|
|
40
|
+
stale: boolean;
|
|
41
|
+
};
|
|
42
|
+
export declare function markPendingAskState(args: AskIdentity & {
|
|
43
|
+
state: PendingAskState;
|
|
44
|
+
}): PendingAskRecord | null;
|
|
45
|
+
export declare function clearPendingAsk(args: AskIdentity): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Retry-safe, requestId-scoped release of one ask's pending marker: `true`
|
|
48
|
+
* once no marker of *this* ask remains (it was removed now, was already gone,
|
|
49
|
+
* or the slot now belongs to a different — newer — ask, which is never
|
|
50
|
+
* touched). `false` means our marker is still there (the unlink failed), so
|
|
51
|
+
* whoever holds the ask's durable row must keep it and try again. Idempotent.
|
|
52
|
+
* May throw on unexpected I/O errors; callers treat that as `false`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function releasePendingAsk(args: PendingAskKey & {
|
|
55
|
+
requestId: string;
|
|
56
|
+
}): boolean;
|
|
57
|
+
export declare function markPendingAskSources(args: {
|
|
58
|
+
userId: PendingAskUserId;
|
|
59
|
+
callerTopic: string;
|
|
60
|
+
sources?: AskReplySource[];
|
|
61
|
+
state: PendingAskState;
|
|
62
|
+
}): void;
|
|
63
|
+
export declare function clearPendingAskSources(args: {
|
|
64
|
+
userId: PendingAskUserId;
|
|
65
|
+
callerTopic: string;
|
|
66
|
+
sources?: AskReplySource[];
|
|
67
|
+
}): void;
|
|
68
|
+
export declare function listPendingAsksForCaller(args: {
|
|
69
|
+
userId: PendingAskUserId;
|
|
70
|
+
from: string;
|
|
71
|
+
}): PendingAskRecord[];
|
|
72
|
+
/** Remove durable ask edges to or from a topic that no longer exists. */
|
|
73
|
+
export declare function deletePendingAsksForTopic(args: {
|
|
74
|
+
userId: PendingAskUserId;
|
|
75
|
+
topicName: string;
|
|
76
|
+
}): number;
|
|
77
|
+
export declare function describePendingAskState(state: PendingAskState): string;
|
|
78
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wake signal for the session-inbox worker.
|
|
3
|
+
*
|
|
4
|
+
* `enqueueSessionInbox` writes to SQLite only. Nothing about that write is
|
|
5
|
+
* visible to the leader's `fs.watch` on the legacy JSONL directory, so before
|
|
6
|
+
* this module the *only* thing that ever noticed a new local `tell_session` /
|
|
7
|
+
* `ask_session` was the fallback poll — which made delivery latency equal to
|
|
8
|
+
* the poll interval, and made a broken poll equal to no delivery at all.
|
|
9
|
+
*
|
|
10
|
+
* Two delivery paths, both best-effort (the fallback poll stays the backstop):
|
|
11
|
+
*
|
|
12
|
+
* - In-process: the elected leader subscribes, so an enqueue in the same
|
|
13
|
+
* process (the embedded MCP endpoint, adapters, the runtime itself) reaches
|
|
14
|
+
* it with no syscall and no polling delay.
|
|
15
|
+
* - Cross-process: with no local subscriber this process is not the leader, so
|
|
16
|
+
* touch a sentinel file inside the watched inbox directory. The leader's
|
|
17
|
+
* existing `fs.watch` turns that into a trigger.
|
|
18
|
+
*
|
|
19
|
+
* Notification is deferred by one macrotask so that an enqueue wrapped in a
|
|
20
|
+
* wider synchronous SQLite transaction is committed before the leader looks.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Sentinel touched to wake a leader in another process. Safe to leave in the
|
|
24
|
+
* inbox root: both inbox scans only descend into per-user *directories* and
|
|
25
|
+
* skip entries they cannot `readdir`.
|
|
26
|
+
*/
|
|
27
|
+
export declare const SESSION_INBOX_WAKE_FILE: string;
|
|
28
|
+
/** Register a local wake listener. Returns an idempotent unsubscribe. */
|
|
29
|
+
export declare function subscribeSessionInboxWrite(listener: () => void): () => void;
|
|
30
|
+
/**
|
|
31
|
+
* Announce that a row was added to `session_inbox`. Coalesced: a notification
|
|
32
|
+
* already scheduled covers every write until it fires, and — like the runner it
|
|
33
|
+
* feeds — an existing timer is never pushed back.
|
|
34
|
+
*/
|
|
35
|
+
export declare function notifySessionInboxWrite(): void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface SessionInboxRow {
|
|
2
|
+
sequence: number;
|
|
3
|
+
id: string;
|
|
4
|
+
userId: string;
|
|
5
|
+
topicId: string;
|
|
6
|
+
payload: string;
|
|
7
|
+
createdAt: number;
|
|
8
|
+
}
|
|
9
|
+
export interface SessionInboxTopic {
|
|
10
|
+
userId: string;
|
|
11
|
+
topicId: string;
|
|
12
|
+
}
|
|
13
|
+
/** Durable enqueue. Callers may wrap this in a wider transaction. */
|
|
14
|
+
export declare function enqueueSessionInbox(args: {
|
|
15
|
+
userId: string;
|
|
16
|
+
topicId: string;
|
|
17
|
+
entry: unknown;
|
|
18
|
+
id?: string;
|
|
19
|
+
createdAt?: number;
|
|
20
|
+
}): {
|
|
21
|
+
id: string;
|
|
22
|
+
inserted: boolean;
|
|
23
|
+
};
|
|
24
|
+
export declare function listPendingSessionInboxTopics(): SessionInboxTopic[];
|
|
25
|
+
/** Atomically reserve one FIFO batch for the elected worker. */
|
|
26
|
+
export declare function claimSessionInboxBatch(args: {
|
|
27
|
+
userId: string;
|
|
28
|
+
topicId: string;
|
|
29
|
+
ownerId: string;
|
|
30
|
+
limit?: number;
|
|
31
|
+
}): SessionInboxRow[];
|
|
32
|
+
export declare function completeSessionInboxBatch(ids: string[], ownerId: string): number;
|
|
33
|
+
export declare function releaseSessionInboxBatch(ids: string[], ownerId: string): number;
|
|
34
|
+
/** The process lease guarantees no live previous owner when leadership changes. */
|
|
35
|
+
export declare function recoverSessionInboxClaims(): number;
|
|
36
|
+
export declare function deleteSessionInboxForTopic(topicId: string): number;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Database as BunDatabase } from "bun:sqlite";
|
|
2
|
+
type DatabaseCtor = typeof BunDatabase;
|
|
3
|
+
declare let Database: DatabaseCtor;
|
|
4
|
+
export { Database };
|
|
5
|
+
/**
|
|
6
|
+
* Close a database and release its underlying file handle.
|
|
7
|
+
*
|
|
8
|
+
* `bun:sqlite`'s no-argument `close()` does not finalize prepared statements
|
|
9
|
+
* that are still reachable, so the file stays open. POSIX hides this — the
|
|
10
|
+
* path can be unlinked while a handle remains — but Windows refuses to delete
|
|
11
|
+
* or rename the file at all (`EBUSY`), which is how the leak surfaces. Passing
|
|
12
|
+
* `true` finalizes eagerly and drops the handle.
|
|
13
|
+
*
|
|
14
|
+
* The node shim's `close()` ignores the argument, so one call covers both
|
|
15
|
+
* backends; the fallback only matters for a backend that rejects the extra
|
|
16
|
+
* parameter outright.
|
|
17
|
+
*/
|
|
18
|
+
export declare function closeDatabase(database: {
|
|
19
|
+
close(throwOnError?: boolean): void;
|
|
20
|
+
}): void;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface StorageStatement<Result = unknown, _Params = unknown> {
|
|
2
|
+
get(...params: any[]): Result | null | undefined;
|
|
3
|
+
all(...params: any[]): Result[];
|
|
4
|
+
run(...params: any[]): any;
|
|
5
|
+
}
|
|
6
|
+
export interface StorageTransaction<Args extends unknown[], Result> {
|
|
7
|
+
(...args: Args): Result;
|
|
8
|
+
deferred: (...args: Args) => Result;
|
|
9
|
+
immediate: (...args: Args) => Result;
|
|
10
|
+
exclusive: (...args: Args) => Result;
|
|
11
|
+
}
|
|
12
|
+
/** Structural SQLite surface supported by Bun and Negotium's Node shim. */
|
|
13
|
+
export interface StorageDatabase {
|
|
14
|
+
query<Result = unknown, Params = unknown>(sql: string): StorageStatement<Result, Params>;
|
|
15
|
+
prepare<Result = unknown, Params = unknown>(sql: string): StorageStatement<Result, Params>;
|
|
16
|
+
exec(sql: string): void;
|
|
17
|
+
run(sql: string, ...params: any[]): any;
|
|
18
|
+
transaction<Args extends unknown[], Result>(fn: (...args: Args) => Result): StorageTransaction<Args, Result>;
|
|
19
|
+
}
|
|
20
|
+
/** Broad structural input accepted from Bun, Node, or a host-provided adapter. */
|
|
21
|
+
export interface StorageDatabaseAdapter {
|
|
22
|
+
query(...args: any[]): any;
|
|
23
|
+
prepare(...args: any[]): any;
|
|
24
|
+
exec(sql: string): void;
|
|
25
|
+
run(sql: string, ...params: any[]): any;
|
|
26
|
+
transaction(...args: any[]): any;
|
|
27
|
+
}
|
|
28
|
+
export type StorageDatabaseInput = StorageDatabase | StorageDatabaseAdapter;
|
|
29
|
+
export interface StorageHostConfig {
|
|
30
|
+
/** Borrowed SQLite connection. Negotium never closes an injected database. */
|
|
31
|
+
database?: StorageDatabaseInput;
|
|
32
|
+
/** Persistent JSON/JSONL state root. */
|
|
33
|
+
dataDir?: string;
|
|
34
|
+
/** Activity and token-usage log root. */
|
|
35
|
+
logDir?: string;
|
|
36
|
+
/** Durable ask edge root. Defaults to Negotium's runtime ask directory. */
|
|
37
|
+
sessionAsksDir?: string;
|
|
38
|
+
/** Shared topic workspace root used by wiki/archive helpers. */
|
|
39
|
+
workspaceDir?: string;
|
|
40
|
+
/** Shared wiki root. Defaults to `<workspaceDir>/wiki`. */
|
|
41
|
+
sharedWikiDir?: string;
|
|
42
|
+
/** Per-user sent-file log root. Defaults to `<dataDir>/users`. */
|
|
43
|
+
usersLogDir?: string;
|
|
44
|
+
}
|
|
45
|
+
/** Compatibility name retained for 0.1.11 consumers. */
|
|
46
|
+
export type StorageHostOptions = StorageHostConfig;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Database } from "./sqlite";
|
|
2
|
+
import type { StorageDatabase, StorageHostConfig } from "./storage-contract";
|
|
3
|
+
export type { StorageDatabase, StorageDatabaseAdapter, StorageDatabaseInput, StorageHostConfig, StorageHostOptions, StorageStatement, StorageTransaction, } from "./storage-contract";
|
|
4
|
+
type InternalStorageDatabase = InstanceType<typeof Database>;
|
|
5
|
+
type StorageSchemaInitializer = (database: InternalStorageDatabase) => void;
|
|
6
|
+
export declare function initializeDatabase(database: InternalStorageDatabase): void;
|
|
7
|
+
export declare function resolveStorageDatabase(): InternalStorageDatabase;
|
|
8
|
+
/**
|
|
9
|
+
* The host-injected connection, or null when Negotium owns its own store.
|
|
10
|
+
*
|
|
11
|
+
* Unlike {@link resolveStorageDatabase} this never opens anything. Callers that
|
|
12
|
+
* manage their own short-lived connections need to know whether a host store
|
|
13
|
+
* exists *before* deciding to open one by path: opening it anyway is how an
|
|
14
|
+
* embedded Negotium ends up writing half its state into the host's database and
|
|
15
|
+
* the other half into `~/.negotium`, with nothing reporting an error.
|
|
16
|
+
*/
|
|
17
|
+
export declare function configuredStorageDatabase(): InternalStorageDatabase | null;
|
|
18
|
+
export declare function resolveStorageDataDir(): string;
|
|
19
|
+
export declare function resolveStorageLogDir(): string;
|
|
20
|
+
export declare function resolveStorageSessionAsksDir(): string;
|
|
21
|
+
export declare function resolveStorageWorkspaceDir(): string;
|
|
22
|
+
export declare function resolveStorageSharedWikiDir(): string;
|
|
23
|
+
export declare function resolveStorageUsersLogDir(): string;
|
|
24
|
+
/**
|
|
25
|
+
* Configure the process-local storage boundary for an embedding host.
|
|
26
|
+
*
|
|
27
|
+
* Resolution is lazy: importing `negotium/storage` never opens a database or
|
|
28
|
+
* touches a filesystem path. The returned disposer restores the exact prior
|
|
29
|
+
* host, which keeps tests and nested embeddings isolated.
|
|
30
|
+
*/
|
|
31
|
+
export declare function configureStorageHost(options: StorageHostConfig): () => void;
|
|
32
|
+
/** Remove every configured host layer and restore standalone fallbacks. */
|
|
33
|
+
export declare function resetStorageHost(): void;
|
|
34
|
+
/** Close only Negotium's fallback connection. Injected connections are borrowed. */
|
|
35
|
+
export declare function closeStorageDatabase(): void;
|
|
36
|
+
export declare function registerStorageSchemaInitializer(initialize: StorageSchemaInitializer, priority?: number): void;
|
|
37
|
+
export declare function ensureStorageSchemas(database?: InternalStorageDatabase): void;
|
|
38
|
+
/** Stable proxy identity used by legacy imports and embedding hosts. */
|
|
39
|
+
export declare const internalStorageDatabase: import("bun:sqlite").Database;
|
|
40
|
+
/** Structurally typed view intended for embedding hosts. */
|
|
41
|
+
export declare const storageDatabase: StorageDatabase;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { StorageDatabase, StorageHostConfig } from "./storage-contract";
|
|
2
|
+
/** Configure the lazy process-local storage boundary and return an idempotent disposer. */
|
|
3
|
+
export declare const configureStorageHost: (options: StorageHostConfig) => () => void;
|
|
4
|
+
/** Remove every configured host layer and restore standalone fallbacks. */
|
|
5
|
+
export declare const resetStorageHost: () => void;
|
|
6
|
+
/** Stable structurally typed proxy over the currently active database. */
|
|
7
|
+
export declare const db: StorageDatabase;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Stable public storage facade for embedding hosts such as Otium. */
|
|
2
|
+
export * as activityLog from "./activity-log";
|
|
3
|
+
export * from "./activity-log";
|
|
4
|
+
export * as apiMessages from "./api-messages";
|
|
5
|
+
export * from "./api-messages";
|
|
6
|
+
export * as apiTopicBrief from "./api-topic-brief";
|
|
7
|
+
export * from "./api-topic-brief";
|
|
8
|
+
export * as apiTopicConfig from "./api-topic-config";
|
|
9
|
+
export * from "./api-topic-config";
|
|
10
|
+
export * as apiTopics from "./api-topics";
|
|
11
|
+
export * from "./api-topics";
|
|
12
|
+
export * as appSettings from "./app-settings";
|
|
13
|
+
export * from "./app-settings";
|
|
14
|
+
export * as askUserGates from "./ask-user-gates";
|
|
15
|
+
export * from "./ask-user-gates";
|
|
16
|
+
export * as conversations from "./conversations";
|
|
17
|
+
export * from "./conversations";
|
|
18
|
+
export * as decisions from "./decisions";
|
|
19
|
+
export * from "./decisions";
|
|
20
|
+
/** @deprecated Pre-canonical Telegram/forum compatibility namespace. */
|
|
21
|
+
export * as forum from "./forum/index";
|
|
22
|
+
export * as runtimeProcessLeases from "./runtime-process-leases";
|
|
23
|
+
export * from "./runtime-process-leases";
|
|
24
|
+
export * as sessionAsks from "./session-asks";
|
|
25
|
+
export * from "./session-asks";
|
|
26
|
+
export type { StorageDatabase, StorageDatabaseAdapter, StorageDatabaseInput, StorageHostConfig, StorageHostOptions, StorageStatement, StorageTransaction, } from "./storage-contract";
|
|
27
|
+
export { configureStorageHost, db, resetStorageHost } from "./storage-public-host";
|
|
28
|
+
export * as tasks from "./tasks";
|
|
29
|
+
export * from "./tasks";
|
|
30
|
+
export * as tokenStats from "./token-stats";
|
|
31
|
+
export * from "./token-stats";
|
|
32
|
+
export * as topicArchive from "./topic-archive";
|
|
33
|
+
export * from "./topic-archive";
|
|
34
|
+
export * as topicArchiveState from "./topic-archive-state";
|
|
35
|
+
export * from "./topic-archive-state";
|
|
36
|
+
/** @deprecated Pre-canonical topic-name settings compatibility namespace. */
|
|
37
|
+
export * as topicSettings from "./topic-settings";
|
|
38
|
+
export * as topicTranscript from "./topic-transcript";
|
|
39
|
+
export * from "./topic-transcript";
|
|
40
|
+
export * as wiki from "./wiki";
|
|
41
|
+
export * from "./wiki";
|
|
42
|
+
export * as wikiSummaryNames from "./wiki-summary-names";
|
|
43
|
+
export * from "./wiki-summary-names";
|
|
44
|
+
export type { AgentKind, EffortLevel } from "../types";
|
|
45
|
+
export type { AiMode, MessageDto, ParticipantDto, ResponsePolicy, TopicDto, TopicKind, TopicVisibility, } from "../types/api";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { TaskSnapshot } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Otium-owned task store, shared by every agent backend.
|
|
4
|
+
*
|
|
5
|
+
* Provider-native task/todo stores are not authoritative because they live
|
|
6
|
+
* inside one SDK session. This store is keyed by Otium topic context so task
|
|
7
|
+
* state survives agent switches and feeds the same live task panel for
|
|
8
|
+
* claude/codex/maestro.
|
|
9
|
+
*/
|
|
10
|
+
export type StoredTask = TaskSnapshot;
|
|
11
|
+
export declare const TASK_STATUS_VALUES: readonly ["pending", "in_progress", "completed"];
|
|
12
|
+
export declare function taskScopeKey(opts: {
|
|
13
|
+
topicId?: string;
|
|
14
|
+
session: string;
|
|
15
|
+
}): string;
|
|
16
|
+
export declare function getTaskFilePath(userId: number | string, scopeKey: string): string;
|
|
17
|
+
export declare function readTasks(userId: number | string, scopeKey: string): StoredTask[];
|
|
18
|
+
export declare function writeTasks(userId: number | string, scopeKey: string, tasks: StoredTask[]): void;
|
|
19
|
+
export declare function taskFileMtimeNs(userId: number | string, scopeKey: string): bigint | null;
|
|
20
|
+
export interface TaskCreateInput {
|
|
21
|
+
subject: string;
|
|
22
|
+
activeForm?: string;
|
|
23
|
+
blockedBy?: string[];
|
|
24
|
+
owner?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface TaskUpdateInput {
|
|
27
|
+
id: string;
|
|
28
|
+
status?: StoredTask["status"];
|
|
29
|
+
subject?: string;
|
|
30
|
+
activeForm?: string;
|
|
31
|
+
blockedBy?: string[];
|
|
32
|
+
owner?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare function createTasks(tasks: StoredTask[], inputs: TaskCreateInput[]): {
|
|
35
|
+
tasks: StoredTask[];
|
|
36
|
+
created: StoredTask[];
|
|
37
|
+
};
|
|
38
|
+
export declare function updateTasks(tasks: StoredTask[], updates: TaskUpdateInput[]): {
|
|
39
|
+
tasks: StoredTask[];
|
|
40
|
+
missing: string[];
|
|
41
|
+
};
|
|
42
|
+
export declare function deleteTasks(tasks: StoredTask[], opts: {
|
|
43
|
+
ids?: string[];
|
|
44
|
+
all?: boolean;
|
|
45
|
+
}): {
|
|
46
|
+
tasks: StoredTask[];
|
|
47
|
+
removed: number;
|
|
48
|
+
};
|
|
49
|
+
export declare function renderTaskList(tasks: StoredTask[]): string;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { AgentKind, TokenUsage } from "../types";
|
|
2
|
+
export interface QueryRecord {
|
|
3
|
+
schemaVersion: 2;
|
|
4
|
+
timestamp: string;
|
|
5
|
+
session: string;
|
|
6
|
+
topicId: string;
|
|
7
|
+
providerSessionId?: string;
|
|
8
|
+
agent: AgentKind;
|
|
9
|
+
model: string;
|
|
10
|
+
/** Cache-miss input only. */
|
|
11
|
+
inputTokens: number;
|
|
12
|
+
outputTokens: number;
|
|
13
|
+
cacheCreationInputTokens: number;
|
|
14
|
+
cacheReadInputTokens: number;
|
|
15
|
+
contextTokens?: number;
|
|
16
|
+
contextWindow?: number;
|
|
17
|
+
estimatedCostUsd: number;
|
|
18
|
+
/**
|
|
19
|
+
* The provider's own raw cost figure for this query, when it reported one
|
|
20
|
+
* (currently only `claude`, via the Agent SDK's `total_cost_usd`). That
|
|
21
|
+
* figure is the *session's running total so far*, not this query's own
|
|
22
|
+
* cost -- `estimatedCostUsd` above is already the marginal delta derived
|
|
23
|
+
* from it (see `recordUsage`). Kept so the *next* query in the same
|
|
24
|
+
* provider session has something to diff against; never summed itself.
|
|
25
|
+
*/
|
|
26
|
+
cumulativeCostUsd?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface Bucket {
|
|
29
|
+
inputTokens: number;
|
|
30
|
+
outputTokens: number;
|
|
31
|
+
cacheCreationInputTokens: number;
|
|
32
|
+
cacheReadInputTokens: number;
|
|
33
|
+
queries: number;
|
|
34
|
+
estimatedCostUsd: number;
|
|
35
|
+
}
|
|
36
|
+
export interface CurrentSessionUsage {
|
|
37
|
+
timestamp: string;
|
|
38
|
+
topicId: string;
|
|
39
|
+
topicTitle: string;
|
|
40
|
+
providerSessionId?: string;
|
|
41
|
+
agent: AgentKind;
|
|
42
|
+
model: string;
|
|
43
|
+
contextTokens: number;
|
|
44
|
+
contextWindow: number;
|
|
45
|
+
}
|
|
46
|
+
export interface TopicUsageSummary extends Bucket {
|
|
47
|
+
topicId: string;
|
|
48
|
+
currentSession?: CurrentSessionUsage;
|
|
49
|
+
}
|
|
50
|
+
export declare function tokenStatsFileId(userId: number | string): string;
|
|
51
|
+
export declare function calcCost(b: Pick<Bucket, "inputTokens" | "outputTokens" | "cacheCreationInputTokens" | "cacheReadInputTokens" | "estimatedCostUsd">): number;
|
|
52
|
+
/** 쿼리 완료 시 호출 — JSONL에 한 줄 추가 */
|
|
53
|
+
export declare function recordUsage(userId: number | string, session: string, usage: TokenUsage, context: {
|
|
54
|
+
topicId: string;
|
|
55
|
+
providerSessionId?: string;
|
|
56
|
+
agent: AgentKind;
|
|
57
|
+
model: string;
|
|
58
|
+
}): void;
|
|
59
|
+
export declare function deleteTopicStats(userId: number | string, topicId: string): void;
|
|
60
|
+
export declare function getStats(userId: number | string, from?: string, to?: string): {
|
|
61
|
+
total: Bucket;
|
|
62
|
+
byHour: Record<string, Bucket>;
|
|
63
|
+
bySession: Record<string, Bucket>;
|
|
64
|
+
currentSessions: CurrentSessionUsage[];
|
|
65
|
+
ignoredLegacyRecords: number;
|
|
66
|
+
estimatedCostUsd: number;
|
|
67
|
+
};
|
|
68
|
+
/** Exact all-time usage for one topic, independent of transcript pagination. */
|
|
69
|
+
export declare function getTopicStats(userId: number | string, topicId: string, activeProviderSessionId?: string | undefined): TopicUsageSummary;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface TopicArchiveState {
|
|
2
|
+
topicId: string;
|
|
3
|
+
lastArchivedRowid: number;
|
|
4
|
+
lastArchivePath?: string;
|
|
5
|
+
updatedAt: string;
|
|
6
|
+
}
|
|
7
|
+
export interface TopicArchiveJob {
|
|
8
|
+
topicId: string;
|
|
9
|
+
afterRowid: number;
|
|
10
|
+
lastRowid: number;
|
|
11
|
+
archivePath: string;
|
|
12
|
+
messageCount: number;
|
|
13
|
+
status: "running" | "pending";
|
|
14
|
+
updatedAt: string;
|
|
15
|
+
}
|
|
16
|
+
export interface TopicArchiveJobCandidate {
|
|
17
|
+
lastRowid: number;
|
|
18
|
+
archivePath: string;
|
|
19
|
+
messageCount: number;
|
|
20
|
+
}
|
|
21
|
+
export declare function getTopicArchiveState(topicId: string): TopicArchiveState | null;
|
|
22
|
+
export declare function setTopicArchiveState(topicId: string, lastArchivedRowid: number, lastArchivePath?: string): void;
|
|
23
|
+
/** Atomically reserve one active-topic archive job across runtime processes. */
|
|
24
|
+
export declare function claimTopicArchiveJob(topicId: string, create: (afterRowid: number) => TopicArchiveJobCandidate | null, now?: number): {
|
|
25
|
+
kind: "claimed";
|
|
26
|
+
job: TopicArchiveJob;
|
|
27
|
+
} | {
|
|
28
|
+
kind: "busy";
|
|
29
|
+
} | null;
|
|
30
|
+
/** Advance the durable cursor only after the memory turn completes. */
|
|
31
|
+
export declare function settleTopicArchiveJob(topicId: string, archivePath: string, success: boolean): void;
|
|
32
|
+
/** Remove the idle-archive cursor for a topic that no longer exists. */
|
|
33
|
+
export declare function deleteTopicArchiveState(topicId: string): boolean;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { UnifiedEvent } from "../types";
|
|
2
|
+
export interface TopicArchiveResult {
|
|
3
|
+
path: string;
|
|
4
|
+
messageCount: number;
|
|
5
|
+
exchangeCount: number;
|
|
6
|
+
lastRowid: number;
|
|
7
|
+
}
|
|
8
|
+
export interface ConversationEventArchiveResult {
|
|
9
|
+
path: string;
|
|
10
|
+
eventCount: number;
|
|
11
|
+
}
|
|
12
|
+
export interface TopicArchiveOptions {
|
|
13
|
+
afterRowid?: number;
|
|
14
|
+
reason?: "delete" | "idle" | "reset";
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Forensic-archive a topic's SQLite-backed messages into the shared
|
|
18
|
+
* `wiki/archive/` as JSONL transcript records.
|
|
19
|
+
*
|
|
20
|
+
* Otium keeps conversations in the `api_messages` table (SQLite), not in the
|
|
21
|
+
* `PROJECT_ROOT/logs` activity-log files that Otium's `archiveSessionLogs`
|
|
22
|
+
* scans — so this is Otium's native equivalent. Each JSONL record keeps the raw
|
|
23
|
+
* DB message under `message`, plus a human-readable `line`/`role`/`speaker` for
|
|
24
|
+
* the background wiki-archiver turn.
|
|
25
|
+
*
|
|
26
|
+
* Output lands in the **shared** wiki root (see `getSharedWikiDir`) because
|
|
27
|
+
* that is the root the wiki MCP serves in topic-id mode; writing it elsewhere
|
|
28
|
+
* would make the archive invisible to later `wiki_query` calls.
|
|
29
|
+
*
|
|
30
|
+
* Returns `null` when the selected range has no messages.
|
|
31
|
+
*/
|
|
32
|
+
export declare function archiveTopicMessages(topicId: string, topicTitle: string, options?: TopicArchiveOptions): TopicArchiveResult | null;
|
|
33
|
+
/** Render one UnifiedEvent's primary text. Shared with session-history's read/search tools. */
|
|
34
|
+
export declare function eventText(event: UnifiedEvent): string;
|
|
35
|
+
/** Render one UnifiedEvent's speaker label. Shared with session-history's read/search tools. */
|
|
36
|
+
export declare function eventSpeaker(event: UnifiedEvent, agent: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Preserve the append-only provider-neutral event stream before topic teardown.
|
|
39
|
+
* Unlike the visible transcript this includes tools, reasoning, errors, and
|
|
40
|
+
* every provider session id across agent switches and compactions.
|
|
41
|
+
*/
|
|
42
|
+
export declare function archiveConversationEvents(topicId: string, topicTitle: string, userId: string, options?: Pick<TopicArchiveOptions, "reason">): ConversationEventArchiveResult | null;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Credential-bearing manager MCP grants, isolated from ordinary tool flags. */
|
|
2
|
+
import type { HostMcpServerSpec } from "../runtime-gateway";
|
|
3
|
+
export declare function getTopicHostMcpGrant(topicId: string): Record<string, HostMcpServerSpec> | null;
|
|
4
|
+
export declare function recordTopicHostMcpGrant(topicId: string, servers: Record<string, HostMcpServerSpec>): void;
|
|
5
|
+
export declare function deleteTopicHostMcpGrant(topicId: string): void;
|