@otium-team/negotium 0.0.0-stage → 0.23.11
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 +23903 -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 +2336 -0
- package/dist/browser-runtime.js.map +35 -0
- package/dist/canonical-mcp-bridge.js +14 -0
- package/dist/canonical-mcp-bridge.js.map +9 -0
- package/dist/chunk-0fenxbe6.js +173 -0
- package/dist/chunk-0fenxbe6.js.map +12 -0
- package/dist/chunk-2mx7fq49.js +6 -0
- package/dist/chunk-2mx7fq49.js.map +9 -0
- package/dist/chunk-ad7kxsaq.js +202 -0
- package/dist/chunk-ad7kxsaq.js.map +9 -0
- package/dist/chunk-da9ad838.js +3927 -0
- package/dist/chunk-da9ad838.js.map +47 -0
- package/dist/chunk-f7p0h1gs.js +54 -0
- package/dist/chunk-f7p0h1gs.js.map +10 -0
- package/dist/chunk-jtv8yzy1.js +206 -0
- package/dist/chunk-jtv8yzy1.js.map +10 -0
- package/dist/chunk-mxxwx5mg.js +375 -0
- package/dist/chunk-mxxwx5mg.js.map +13 -0
- package/dist/cron.js +1 -0
- package/dist/hosted-agent.js +5919 -0
- package/dist/hosted-agent.js.map +62 -0
- package/dist/main.js +60536 -0
- package/dist/main.js.map +338 -0
- package/dist/mcp-catalog.js +39 -0
- package/dist/mcp-catalog.js.map +10 -0
- package/dist/mcp-factories.js +26572 -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 +1073 -0
- package/dist/query-runtime.js.map +26 -0
- package/dist/registry.js +336 -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 +866 -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 +420 -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 +186 -0
- package/dist/runtime/src/application/vault-command.ts +170 -0
- package/dist/runtime/src/bus.ts +403 -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 +200 -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 +508 -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 +2284 -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 +848 -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-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 +805 -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 +582 -0
- package/dist/runtime/src/types.ts +395 -0
- package/dist/runtime/src/version.ts +1 -0
- package/dist/runtime/tsconfig.json +13 -0
- package/dist/runtime-gateway.js +453 -0
- package/dist/runtime-gateway.js.map +10 -0
- package/dist/runtime-helpers.js +1794 -0
- package/dist/runtime-helpers.js.map +40 -0
- package/dist/sqlite.js +68 -0
- package/dist/sqlite.js.map +10 -0
- package/dist/storage.js +5194 -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 +138 -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 +234 -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 +224 -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 +138 -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 +546 -0
- package/dist/types/packages/core/src/types.d.ts +384 -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 +850 -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,50 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/mcp-servers.ts
|
|
3
|
+
import { dirname, resolve } from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
var MCP_SERVER_NAMES = [
|
|
6
|
+
"agent-health",
|
|
7
|
+
"background-bash",
|
|
8
|
+
"canonical-proxy",
|
|
9
|
+
"cron-manager",
|
|
10
|
+
"session-comm",
|
|
11
|
+
"session-history",
|
|
12
|
+
"system-health",
|
|
13
|
+
"task",
|
|
14
|
+
"decision",
|
|
15
|
+
"token-stats",
|
|
16
|
+
"vault",
|
|
17
|
+
"wiki"
|
|
18
|
+
];
|
|
19
|
+
var MCP_SERVER_FILE_NAMES = MCP_SERVER_NAMES.filter((name) => name !== "background-bash");
|
|
20
|
+
var runtimeFile = (relativePath) => fileURLToPath(new URL(`./runtime/${relativePath}`, import.meta.url));
|
|
21
|
+
var MCP_SERVER_FILES = Object.freeze({
|
|
22
|
+
"agent-health": runtimeFile("src/mcp/agent-health-server.ts"),
|
|
23
|
+
"canonical-proxy": runtimeFile("src/mcp/canonical-proxy-server.ts"),
|
|
24
|
+
"cron-manager": runtimeFile("cron/mcp-server.ts"),
|
|
25
|
+
"session-comm": runtimeFile("src/mcp/session-comm/server.ts"),
|
|
26
|
+
"session-history": runtimeFile("src/mcp/session-history-server.ts"),
|
|
27
|
+
"system-health": runtimeFile("src/mcp/system-health-server.ts"),
|
|
28
|
+
task: runtimeFile("src/mcp/task-server.ts"),
|
|
29
|
+
decision: runtimeFile("src/mcp/decision-server.ts"),
|
|
30
|
+
"token-stats": runtimeFile("src/mcp/token-stats-server.ts"),
|
|
31
|
+
vault: runtimeFile("src/mcp/vault-server.ts"),
|
|
32
|
+
wiki: runtimeFile("src/mcp/wiki-server.ts")
|
|
33
|
+
});
|
|
34
|
+
function resolveMcpServerFile(name) {
|
|
35
|
+
return MCP_SERVER_FILES[name];
|
|
36
|
+
}
|
|
37
|
+
function resolveMcpServerTsconfig(name) {
|
|
38
|
+
const file = resolveMcpServerFile(name);
|
|
39
|
+
const levels = name === "cron-manager" ? ".." : name === "session-comm" ? "../../.." : "../..";
|
|
40
|
+
return resolve(dirname(file), levels, "tsconfig.json");
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
resolveMcpServerTsconfig,
|
|
44
|
+
resolveMcpServerFile,
|
|
45
|
+
MCP_SERVER_NAMES,
|
|
46
|
+
MCP_SERVER_FILE_NAMES,
|
|
47
|
+
MCP_SERVER_FILES
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
//# debugId=4A5697EEF996F48964756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/mcp-servers.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { dirname, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nexport const MCP_SERVER_NAMES = [\n \"agent-health\",\n \"background-bash\",\n \"canonical-proxy\",\n \"cron-manager\",\n \"session-comm\",\n \"session-history\",\n \"system-health\",\n \"task\",\n \"decision\",\n \"token-stats\",\n \"vault\",\n \"wiki\",\n] as const;\n\nexport type McpServerName = (typeof MCP_SERVER_NAMES)[number];\n\n/**\n * Servers that are a TypeScript entry file a host can spawn. `background-bash`\n * is still an MCP server name, but it is served by the bash-rs binary over\n * HTTP, so asking for its file is a mistake the type system should catch.\n */\nexport type McpServerFileName = Exclude<McpServerName, \"background-bash\">;\n\n/**\n * The subset of `MCP_SERVER_NAMES` that resolves to a file. Iterate this, not\n * `MCP_SERVER_NAMES`, when you mean \"every server with an entry file\" — the\n * two diverged when background-bash moved to the bash-rs binary, and a\n * consumer walking the full list gets a name `resolveMcpServerFile` rejects.\n */\nexport const MCP_SERVER_FILE_NAMES = MCP_SERVER_NAMES.filter(\n (name): name is McpServerFileName => name !== \"background-bash\",\n);\n\nconst runtimeFile = (relativePath: string): string =>\n fileURLToPath(new URL(`./runtime/${relativePath}`, import.meta.url));\n\n/** Absolute executable TypeScript entry files for Negotium's STDIO MCP servers. */\nexport const MCP_SERVER_FILES: Readonly<Record<McpServerFileName, string>> = Object.freeze({\n \"agent-health\": runtimeFile(\"src/mcp/agent-health-server.ts\"),\n \"canonical-proxy\": runtimeFile(\"src/mcp/canonical-proxy-server.ts\"),\n \"cron-manager\": runtimeFile(\"cron/mcp-server.ts\"),\n \"session-comm\": runtimeFile(\"src/mcp/session-comm/server.ts\"),\n \"session-history\": runtimeFile(\"src/mcp/session-history-server.ts\"),\n \"system-health\": runtimeFile(\"src/mcp/system-health-server.ts\"),\n task: runtimeFile(\"src/mcp/task-server.ts\"),\n decision: runtimeFile(\"src/mcp/decision-server.ts\"),\n \"token-stats\": runtimeFile(\"src/mcp/token-stats-server.ts\"),\n vault: runtimeFile(\"src/mcp/vault-server.ts\"),\n wiki: runtimeFile(\"src/mcp/wiki-server.ts\"),\n});\n\nexport function resolveMcpServerFile(name: McpServerFileName): string {\n return MCP_SERVER_FILES[name];\n}\n\n/** tsconfig used when a host launches the TypeScript server through node + tsx. */\nexport function resolveMcpServerTsconfig(name: McpServerFileName): string {\n const file = resolveMcpServerFile(name);\n const levels = name === \"cron-manager\" ? \"..\" : name === \"session-comm\" ? \"../../..\" : \"../..\";\n return resolve(dirname(file), levels, \"tsconfig.json\");\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;AAAA;AACA;AAEO,IAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAiBO,IAAM,wBAAwB,iBAAiB,OACpD,CAAC,SAAoC,SAAS,iBAChD;AAEA,IAAM,cAAc,CAAC,iBACnB,cAAc,IAAI,IAAI,aAAa,gBAAgB,YAAY,GAAG,CAAC;AAG9D,IAAM,mBAAgE,OAAO,OAAO;AAAA,EACzF,gBAAgB,YAAY,gCAAgC;AAAA,EAC5D,mBAAmB,YAAY,mCAAmC;AAAA,EAClE,gBAAgB,YAAY,oBAAoB;AAAA,EAChD,gBAAgB,YAAY,gCAAgC;AAAA,EAC5D,mBAAmB,YAAY,mCAAmC;AAAA,EAClE,iBAAiB,YAAY,iCAAiC;AAAA,EAC9D,MAAM,YAAY,wBAAwB;AAAA,EAC1C,UAAU,YAAY,4BAA4B;AAAA,EAClD,eAAe,YAAY,+BAA+B;AAAA,EAC1D,OAAO,YAAY,yBAAyB;AAAA,EAC5C,MAAM,YAAY,wBAAwB;AAC5C,CAAC;AAEM,SAAS,oBAAoB,CAAC,MAAiC;AAAA,EACpE,OAAO,iBAAiB;AAAA;AAInB,SAAS,wBAAwB,CAAC,MAAiC;AAAA,EACxE,MAAM,OAAO,qBAAqB,IAAI;AAAA,EACtC,MAAM,SAAS,SAAS,iBAAiB,OAAO,SAAS,iBAAiB,aAAa;AAAA,EACvF,OAAO,QAAQ,QAAQ,IAAI,GAAG,QAAQ,eAAe;AAAA;",
|
|
8
|
+
"debugId": "4A5697EEF996F48964756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
package/dist/media.js
ADDED
|
@@ -0,0 +1,570 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// ../../packages/core/src/media/text-extractor.ts
|
|
3
|
+
import { execFile } from "child_process";
|
|
4
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, rmSync } from "fs";
|
|
5
|
+
import { readFile } from "fs/promises";
|
|
6
|
+
import { extname, join as join2 } from "path";
|
|
7
|
+
import { promisify } from "util";
|
|
8
|
+
|
|
9
|
+
// ../../packages/core/src/platform/config.ts
|
|
10
|
+
import { execFileSync } from "child_process";
|
|
11
|
+
import { randomBytes } from "crypto";
|
|
12
|
+
import {
|
|
13
|
+
accessSync,
|
|
14
|
+
chmodSync,
|
|
15
|
+
constants,
|
|
16
|
+
existsSync,
|
|
17
|
+
mkdirSync,
|
|
18
|
+
readFileSync,
|
|
19
|
+
writeFileSync
|
|
20
|
+
} from "fs";
|
|
21
|
+
import { createRequire } from "module";
|
|
22
|
+
import { homedir } from "os";
|
|
23
|
+
import { dirname, join, resolve } from "path";
|
|
24
|
+
import { fileURLToPath, pathToFileURL } from "url";
|
|
25
|
+
|
|
26
|
+
// ../../packages/core/src/types.ts
|
|
27
|
+
var SUPPORTED_AGENTS = ["maestro", "claude", "codex"];
|
|
28
|
+
function isAgentKind(value) {
|
|
29
|
+
return typeof value === "string" && SUPPORTED_AGENTS.includes(value);
|
|
30
|
+
}
|
|
31
|
+
var EFFORT_VALUES = [
|
|
32
|
+
"low",
|
|
33
|
+
"medium",
|
|
34
|
+
"high",
|
|
35
|
+
"xhigh",
|
|
36
|
+
"max"
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
// ../../packages/core/src/platform/config-helpers.ts
|
|
40
|
+
function readEnvText(env, key) {
|
|
41
|
+
const value = env[key]?.trim();
|
|
42
|
+
return value || undefined;
|
|
43
|
+
}
|
|
44
|
+
function resolveFallbackAgent(env = process.env) {
|
|
45
|
+
const value = readEnvText(env, "FALLBACK_AGENT") ?? readEnvText(env, "DEFAULT_AGENT");
|
|
46
|
+
return isAgentKind(value) ? value : "claude";
|
|
47
|
+
}
|
|
48
|
+
function parseRuntimePort(value, fallback) {
|
|
49
|
+
if (!value)
|
|
50
|
+
return fallback;
|
|
51
|
+
const port = Number.parseInt(value, 10);
|
|
52
|
+
return Number.isInteger(port) && port > 0 && port <= 65535 ? port : fallback;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// ../../packages/core/src/platform/logger.ts
|
|
56
|
+
import pino from "pino";
|
|
57
|
+
function createStdioLogger(options = {}) {
|
|
58
|
+
const development = options.development ?? true;
|
|
59
|
+
return pino({
|
|
60
|
+
level: options.level ?? process.env.LOG_LEVEL ?? "info",
|
|
61
|
+
transport: development ? {
|
|
62
|
+
target: "pino-pretty",
|
|
63
|
+
options: {
|
|
64
|
+
colorize: true,
|
|
65
|
+
translateTime: "SYS:yyyy-mm-dd HH:MM:ss",
|
|
66
|
+
destination: 2
|
|
67
|
+
}
|
|
68
|
+
} : undefined
|
|
69
|
+
}, pino.destination(2));
|
|
70
|
+
}
|
|
71
|
+
var logger = createStdioLogger();
|
|
72
|
+
|
|
73
|
+
// ../../packages/core/src/platform/config.ts
|
|
74
|
+
function envText(envKey) {
|
|
75
|
+
return readEnvText(process.env, envKey);
|
|
76
|
+
}
|
|
77
|
+
var HOME = homedir();
|
|
78
|
+
function resolveStateDir() {
|
|
79
|
+
const configured = envText("NEGOTIUM_STATE_DIR");
|
|
80
|
+
if (false) {}
|
|
81
|
+
return configured ? resolve(configured) : resolve(HOME, ".negotium");
|
|
82
|
+
}
|
|
83
|
+
function resolveProjectRoot() {
|
|
84
|
+
const moduleDir = dirname(fileURLToPath(import.meta.url));
|
|
85
|
+
const packagedRuntime = resolve(moduleDir, "runtime");
|
|
86
|
+
if (existsSync(resolve(packagedRuntime, "src")))
|
|
87
|
+
return packagedRuntime;
|
|
88
|
+
return resolve(moduleDir, "../..");
|
|
89
|
+
}
|
|
90
|
+
var PROJECT_ROOT = resolveProjectRoot();
|
|
91
|
+
function dependencyBinNames(name) {
|
|
92
|
+
if (process.platform !== "win32")
|
|
93
|
+
return [name];
|
|
94
|
+
return [name, `${name}.exe`, `${name}.cmd`, `${name}.bat`, `${name}.bunx`];
|
|
95
|
+
}
|
|
96
|
+
function resolveDependencyBin(name) {
|
|
97
|
+
let dir = PROJECT_ROOT;
|
|
98
|
+
while (true) {
|
|
99
|
+
const binDir = resolve(dir, "node_modules", ".bin");
|
|
100
|
+
for (const candidate of dependencyBinNames(name)) {
|
|
101
|
+
const path = resolve(binDir, candidate);
|
|
102
|
+
if (existsSync(path))
|
|
103
|
+
return path;
|
|
104
|
+
}
|
|
105
|
+
const parent = dirname(dir);
|
|
106
|
+
if (parent === dir)
|
|
107
|
+
return resolve(binDir, name);
|
|
108
|
+
dir = parent;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
var STATE_DIR = resolveStateDir();
|
|
112
|
+
function resolveLocalStateDir(envKey, stateName) {
|
|
113
|
+
const envValue = envText(envKey);
|
|
114
|
+
if (envValue)
|
|
115
|
+
return resolve(envValue);
|
|
116
|
+
return resolve(STATE_DIR, stateName);
|
|
117
|
+
}
|
|
118
|
+
function parsePortEnv(envValue, fallback) {
|
|
119
|
+
return parseRuntimePort(envValue, fallback);
|
|
120
|
+
}
|
|
121
|
+
var WORKSPACE_DIR = resolveLocalStateDir("NEGOTIUM_WORKSPACE_DIR", "workspace");
|
|
122
|
+
var TOPIC_WORKSPACE_DIR = resolve(WORKSPACE_DIR, "topics");
|
|
123
|
+
var SHARED_WIKI_DIR = resolve(WORKSPACE_DIR, "wiki");
|
|
124
|
+
var CRON_WORKSPACE_DIR = resolve(WORKSPACE_DIR, "cron");
|
|
125
|
+
var BROWSER_DIR = resolveLocalStateDir("NEGOTIUM_BROWSER_DIR", "browser");
|
|
126
|
+
var BROWSER_PROFILES_DIR = resolve(BROWSER_DIR, "profiles");
|
|
127
|
+
var BINARIES_DIR = resolve(STATE_DIR, "binaries");
|
|
128
|
+
var SECRETS_DIR = resolve(STATE_DIR, "secrets");
|
|
129
|
+
var DM_WORKSPACE_DIR = resolve(STATE_DIR, "data", "dm");
|
|
130
|
+
var SESSION_WORKSPACE_DIR = resolve(STATE_DIR, "data", "sessions");
|
|
131
|
+
var CLAUDE_EXECUTABLE_ENV = envText("NEGOTIUM_CLAUDE_EXECUTABLE");
|
|
132
|
+
var CLAUDE_EXECUTABLE = CLAUDE_EXECUTABLE_ENV ? resolve(CLAUDE_EXECUTABLE_ENV) : undefined;
|
|
133
|
+
var BINARY_EXTENSION = process.platform === "win32" ? ".exe" : "";
|
|
134
|
+
var BROWSER_RS_VERSION = "v0.7.7";
|
|
135
|
+
var BROWSER_RS_MIN_SECURE_VERSION = "0.2.1";
|
|
136
|
+
function versionAtLeast(actualVersion, minimumVersion) {
|
|
137
|
+
const actual = actualVersion.split(".").map(Number);
|
|
138
|
+
const minimum = minimumVersion.split(".").map(Number);
|
|
139
|
+
if (actual.some(Number.isNaN) || minimum.some(Number.isNaN))
|
|
140
|
+
return false;
|
|
141
|
+
for (let index = 0;index < minimum.length; index += 1) {
|
|
142
|
+
if ((actual[index] ?? 0) > (minimum[index] ?? 0))
|
|
143
|
+
return true;
|
|
144
|
+
if ((actual[index] ?? 0) < (minimum[index] ?? 0))
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
var BROWSER_RS_VERSION_PROBE_TIMEOUT_MS = 15000;
|
|
150
|
+
function browserRsMeetsMinimumVersion(candidate) {
|
|
151
|
+
try {
|
|
152
|
+
const output = execFileSync(candidate, ["--version"], {
|
|
153
|
+
encoding: "utf8",
|
|
154
|
+
timeout: BROWSER_RS_VERSION_PROBE_TIMEOUT_MS,
|
|
155
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
156
|
+
windowsHide: true
|
|
157
|
+
}).trim();
|
|
158
|
+
const match = output.match(/^browser-rs (\d+)\.(\d+)\.(\d+)$/);
|
|
159
|
+
if (!match)
|
|
160
|
+
return false;
|
|
161
|
+
return versionAtLeast(match.slice(1).join("."), BROWSER_RS_MIN_SECURE_VERSION);
|
|
162
|
+
} catch {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function resolveBrowserRsBin(envValue) {
|
|
167
|
+
const override = envValue?.trim();
|
|
168
|
+
if (!override && !versionAtLeast(BROWSER_RS_VERSION.replace(/^v/, ""), BROWSER_RS_MIN_SECURE_VERSION)) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const candidate = override ? resolve(override) : resolve(BINARIES_DIR, "browser-rs", BROWSER_RS_VERSION, `browser-rs${BINARY_EXTENSION}`);
|
|
172
|
+
try {
|
|
173
|
+
accessSync(candidate, constants.X_OK);
|
|
174
|
+
return browserRsMeetsMinimumVersion(candidate) ? candidate : undefined;
|
|
175
|
+
} catch {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
var SNIPPETS_API_URL = (envText("NEGOTIUM_SNIPPETS_API_URL") ?? envText("SNIPPETS_API_URL") ?? "").replace(/\/+$/, "");
|
|
180
|
+
var BROWSER_RS_BIN = resolveBrowserRsBin(envText("NEGOTIUM_BROWSER_RS_BIN"));
|
|
181
|
+
var BASH_RS_VERSION = "v0.1.10";
|
|
182
|
+
function resolveBashRsBin(envValue) {
|
|
183
|
+
const override = envValue?.trim();
|
|
184
|
+
const candidate = override ? resolve(override) : resolve(BINARIES_DIR, "bash-rs", BASH_RS_VERSION, `bash-rs${BINARY_EXTENSION}`);
|
|
185
|
+
try {
|
|
186
|
+
accessSync(candidate, constants.X_OK);
|
|
187
|
+
return candidate;
|
|
188
|
+
} catch {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
var BASH_RS_BIN = resolveBashRsBin(envText("NEGOTIUM_BASH_RS_BIN"));
|
|
193
|
+
function resolveBrowserMcpBin(envValue) {
|
|
194
|
+
const override = envValue?.trim();
|
|
195
|
+
if (override)
|
|
196
|
+
return resolve(override);
|
|
197
|
+
return BROWSER_RS_BIN ?? resolve(BINARIES_DIR, "browser-rs", BROWSER_RS_VERSION, `browser-rs${BINARY_EXTENSION}`);
|
|
198
|
+
}
|
|
199
|
+
var PLAYWRIGHT_MCP_BIN = resolveBrowserMcpBin(envText("NEGOTIUM_BROWSER_MCP_BIN"));
|
|
200
|
+
var TSX_BIN = resolveDependencyBin("tsx");
|
|
201
|
+
var TSX_LOADER_PATH = createRequire(import.meta.url).resolve("tsx");
|
|
202
|
+
var TSX_LOADER = process.platform === "win32" ? pathToFileURL(TSX_LOADER_PATH).href : TSX_LOADER_PATH;
|
|
203
|
+
var TSCONFIG_PATH = resolve(PROJECT_ROOT, "tsconfig.json");
|
|
204
|
+
var SESSION_COMM_SERVER = resolve(PROJECT_ROOT, "src/mcp/session-comm/server.ts");
|
|
205
|
+
var TASK_SERVER = resolve(PROJECT_ROOT, "src/mcp/task-server.ts");
|
|
206
|
+
var DECISION_SERVER = resolve(PROJECT_ROOT, "src/mcp/decision-server.ts");
|
|
207
|
+
var CANONICAL_MCP_PROXY_SERVER = resolve(PROJECT_ROOT, "src/mcp/canonical-proxy-server.ts");
|
|
208
|
+
var WIKI_SERVER = resolve(PROJECT_ROOT, "src/mcp/wiki-server.ts");
|
|
209
|
+
var TOKEN_STATS_SERVER = resolve(PROJECT_ROOT, "src/mcp/token-stats-server.ts");
|
|
210
|
+
var COMPACTION_LOG_SERVER = resolve(PROJECT_ROOT, "src/mcp/compaction-log-server.ts");
|
|
211
|
+
var SESSION_HISTORY_SERVER = resolve(PROJECT_ROOT, "src/mcp/session-history-server.ts");
|
|
212
|
+
var SYSTEM_HEALTH_SERVER = resolve(PROJECT_ROOT, "src/mcp/system-health-server.ts");
|
|
213
|
+
var AGENT_HEALTH_SERVER = resolve(PROJECT_ROOT, "src/mcp/agent-health-server.ts");
|
|
214
|
+
var VAULT_SERVER = resolve(PROJECT_ROOT, "src/mcp/vault-server.ts");
|
|
215
|
+
var BG_BASH_BASE_PORT = parsePortEnv(process.env.BG_BASH_BASE_PORT, 9700);
|
|
216
|
+
var BG_BASH_MAX_PORT = parsePortEnv(process.env.BG_BASH_MAX_PORT, 9799);
|
|
217
|
+
function loadOrCreateLocalSecret(envKey, filename, options = {}) {
|
|
218
|
+
const envValue = envText(envKey);
|
|
219
|
+
const secretFile = resolve(SECRETS_DIR, filename);
|
|
220
|
+
mkdirSync(dirname(secretFile), { recursive: true });
|
|
221
|
+
if (envValue) {
|
|
222
|
+
if (options.persistEnvValue) {
|
|
223
|
+
writeFileSync(secretFile, `${envValue}
|
|
224
|
+
`, { mode: 384 });
|
|
225
|
+
chmodSync(secretFile, 384);
|
|
226
|
+
}
|
|
227
|
+
return envValue;
|
|
228
|
+
}
|
|
229
|
+
if (existsSync(secretFile)) {
|
|
230
|
+
const stored = readFileSync(secretFile, "utf-8").trim();
|
|
231
|
+
if (stored) {
|
|
232
|
+
chmodSync(secretFile, 384);
|
|
233
|
+
return stored;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
const secret = randomBytes(32).toString("base64url");
|
|
237
|
+
try {
|
|
238
|
+
writeFileSync(secretFile, `${secret}
|
|
239
|
+
`, { mode: 384, flag: "wx" });
|
|
240
|
+
return secret;
|
|
241
|
+
} catch (error) {
|
|
242
|
+
if (error.code !== "EEXIST")
|
|
243
|
+
throw error;
|
|
244
|
+
const stored = readFileSync(secretFile, "utf-8").trim();
|
|
245
|
+
if (!stored)
|
|
246
|
+
throw new Error(`Secret file exists but is empty: ${secretFile}`);
|
|
247
|
+
chmodSync(secretFile, 384);
|
|
248
|
+
return stored;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
var RUNTIME_MCP_SECRET = loadOrCreateLocalSecret("RUNTIME_MCP_SECRET", "runtime-mcp-secret");
|
|
252
|
+
var NODE_CONTROL_TOKEN = loadOrCreateLocalSecret("NEGOTIUM_CONTROL_TOKEN", "node-control-token");
|
|
253
|
+
var NODE_ID = loadOrCreateLocalSecret("NEGOTIUM_NODE_ID", "node-id");
|
|
254
|
+
var VAULT_MASTER_KEY = loadOrCreateLocalSecret("NEGOTIUM_VAULT_MASTER_KEY", "vault-master-key", { persistEnvValue: true });
|
|
255
|
+
delete process.env.NEGOTIUM_VAULT_MASTER_KEY;
|
|
256
|
+
var NEGOTIUM_PORT = parseInt(process.env.NEGOTIUM_PORT || "7777", 10);
|
|
257
|
+
var hostname = process.env.HOSTNAME || "127.0.0.1";
|
|
258
|
+
var DATA_DIR = resolveLocalStateDir("NEGOTIUM_DATA_DIR", "data");
|
|
259
|
+
var LOG_DIR = resolveLocalStateDir("NEGOTIUM_LOG_DIR", "logs");
|
|
260
|
+
var UPLOADS_DIR = resolve(DATA_DIR, "uploads");
|
|
261
|
+
var VAULT_DIR = resolve(DATA_DIR, "vault");
|
|
262
|
+
var SESSIONS_DB = process.env.SESSIONS_DB_PATH ? resolve(process.env.SESSIONS_DB_PATH) : resolve(DATA_DIR, "sessions.db");
|
|
263
|
+
var DEBUG_FILE = resolve(DATA_DIR, "debug-users.json");
|
|
264
|
+
var USERS_LOG_DIR = resolve(DATA_DIR, "users");
|
|
265
|
+
var RUN_DIR = resolveLocalStateDir("NEGOTIUM_RUN_DIR", "runtime");
|
|
266
|
+
var PROGRESS_DIR = resolve(RUN_DIR, "progress");
|
|
267
|
+
var DM_CMD_DIR = resolve(RUN_DIR, "dm-commands");
|
|
268
|
+
var DM_RESP_DIR = resolve(RUN_DIR, "dm-responses");
|
|
269
|
+
var SESSION_INBOX_DIR = resolve(RUN_DIR, "session-inbox");
|
|
270
|
+
var SESSION_ASKS_DIR = resolve(RUN_DIR, "session-asks");
|
|
271
|
+
var BASHRS_SPILL_ROOT = resolve(RUN_DIR, "bashrs");
|
|
272
|
+
var PLAYWRIGHT_BASE_PORT = parsePortEnv(process.env.PLAYWRIGHT_BASE_PORT, 9100);
|
|
273
|
+
var PLAYWRIGHT_MAX_PORT = parsePortEnv(process.env.PLAYWRIGHT_MAX_PORT, 9499);
|
|
274
|
+
var PLAYWRIGHT_PORTS_DIR = resolve(RUN_DIR, "playwright-ports");
|
|
275
|
+
mkdirSync(STATE_DIR, { recursive: true });
|
|
276
|
+
mkdirSync(DATA_DIR, { recursive: true });
|
|
277
|
+
mkdirSync(UPLOADS_DIR, { recursive: true });
|
|
278
|
+
mkdirSync(VAULT_DIR, { recursive: true, mode: 448 });
|
|
279
|
+
mkdirSync(LOG_DIR, { recursive: true });
|
|
280
|
+
mkdirSync(PROGRESS_DIR, { recursive: true });
|
|
281
|
+
mkdirSync(DM_CMD_DIR, { recursive: true });
|
|
282
|
+
mkdirSync(DM_RESP_DIR, { recursive: true });
|
|
283
|
+
mkdirSync(SESSION_INBOX_DIR, { recursive: true });
|
|
284
|
+
mkdirSync(SESSION_ASKS_DIR, { recursive: true });
|
|
285
|
+
mkdirSync(PLAYWRIGHT_PORTS_DIR, { recursive: true });
|
|
286
|
+
mkdirSync(WORKSPACE_DIR, { recursive: true });
|
|
287
|
+
mkdirSync(TOPIC_WORKSPACE_DIR, { recursive: true });
|
|
288
|
+
mkdirSync(SHARED_WIKI_DIR, { recursive: true });
|
|
289
|
+
mkdirSync(CRON_WORKSPACE_DIR, { recursive: true });
|
|
290
|
+
mkdirSync(DM_WORKSPACE_DIR, { recursive: true });
|
|
291
|
+
mkdirSync(SESSION_WORKSPACE_DIR, { recursive: true });
|
|
292
|
+
mkdirSync(BROWSER_DIR, { recursive: true });
|
|
293
|
+
mkdirSync(BROWSER_PROFILES_DIR, { recursive: true });
|
|
294
|
+
mkdirSync(BINARIES_DIR, { recursive: true });
|
|
295
|
+
mkdirSync(SECRETS_DIR, { recursive: true, mode: 448 });
|
|
296
|
+
var ACTIVE_QUERY_STALE_MS = 10 * 60 * 1000;
|
|
297
|
+
var AGENTS_PROMPTS_DIR = resolve(PROJECT_ROOT, "src/prompts/agents");
|
|
298
|
+
var RESOURCES_DIR = resolve(PROJECT_ROOT, "src/resources");
|
|
299
|
+
var ABSOLUTE_PATH_PREFIX = String.raw`(?:[A-Za-z]:[\\/]|\\\\|\/)`;
|
|
300
|
+
var FILE_EXTENSIONS_REGEX = new RegExp(`(?:${ABSOLUTE_PATH_PREFIX}[^\\s"'<>|*?[\\]]+\\.(?:png|jpg|jpeg|gif|webp|svg|pdf|csv|xlsx|xls|json|txt|md|html|zip|py|js|ts|tsx|jsx|css|xml|yaml|yml|docx|pptx))`, "gi");
|
|
301
|
+
var FILE_TAG_REGEX = new RegExp(`\\[FILE:(${ABSOLUTE_PATH_PREFIX}[^\\]]+)\\]`, "gi");
|
|
302
|
+
var FALLBACK_AGENT = resolveFallbackAgent(process.env);
|
|
303
|
+
var FALLBACK_MODEL = envText("FALLBACK_MODEL") ?? envText("DEFAULT_MODEL");
|
|
304
|
+
var DEFAULT_TOPIC_EFFORT = (() => {
|
|
305
|
+
const raw = envText("NEGOTIUM_DEFAULT_EFFORT")?.toLowerCase();
|
|
306
|
+
return raw && EFFORT_VALUES.includes(raw) ? raw : "medium";
|
|
307
|
+
})();
|
|
308
|
+
var FFMPEG_BIN = envText("FFMPEG_BIN");
|
|
309
|
+
var FFPROBE_BIN = envText("FFPROBE_BIN");
|
|
310
|
+
var PYTHON_BIN = envText("PYTHON_BIN") ?? "python3";
|
|
311
|
+
var FASTER_WHISPER_WRAPPER = envText("FASTER_WHISPER_WRAPPER") ?? resolve(PROJECT_ROOT, "scripts/faster-whisper-wrapper.py");
|
|
312
|
+
var WHISPER_MODEL = envText("WHISPER_MODEL_FILE") ?? "turbo";
|
|
313
|
+
var TESSERACT_BIN = envText("TESSERACT_BIN") ?? "tesseract";
|
|
314
|
+
var PDFTOTEXT_BIN = envText("PDFTOTEXT_BIN") ?? "pdftotext";
|
|
315
|
+
function resolveWhisperBackend() {
|
|
316
|
+
return envText("WHISPER_BACKEND") === "mlx-whisper" ? "mlx-whisper" : "faster-whisper";
|
|
317
|
+
}
|
|
318
|
+
var WHISPER_BACKEND = resolveWhisperBackend();
|
|
319
|
+
var MLX_WHISPER_BIN = envText("MLX_WHISPER_BIN");
|
|
320
|
+
var WHISPER_MODEL_MLX = envText("WHISPER_MODEL_MLX") ?? "mlx-community/whisper-large-v3-turbo";
|
|
321
|
+
var _envMaxTellDepth = Number.parseInt(process.env.MAX_TELL_DEPTH ?? "", 10);
|
|
322
|
+
var MAX_TELL_DEPTH = Number.isInteger(_envMaxTellDepth) && _envMaxTellDepth > 0 ? _envMaxTellDepth : 20;
|
|
323
|
+
|
|
324
|
+
// ../../packages/core/src/platform/error.ts
|
|
325
|
+
function errMsg(e, fallback) {
|
|
326
|
+
if (e instanceof Error)
|
|
327
|
+
return e.message;
|
|
328
|
+
return fallback ?? String(e);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// ../../packages/core/src/media/text-extractor.ts
|
|
332
|
+
var execFileAsync = promisify(execFile);
|
|
333
|
+
var FFMPEG_BIN2 = FFMPEG_BIN;
|
|
334
|
+
var TEXT_EXTENSIONS = new Set([
|
|
335
|
+
".txt",
|
|
336
|
+
".md",
|
|
337
|
+
".csv",
|
|
338
|
+
".tsv",
|
|
339
|
+
".json",
|
|
340
|
+
".jsonl",
|
|
341
|
+
".xml",
|
|
342
|
+
".html",
|
|
343
|
+
".htm",
|
|
344
|
+
".yaml",
|
|
345
|
+
".yml",
|
|
346
|
+
".toml",
|
|
347
|
+
".ini",
|
|
348
|
+
".cfg",
|
|
349
|
+
".conf",
|
|
350
|
+
".log",
|
|
351
|
+
".env",
|
|
352
|
+
".js",
|
|
353
|
+
".ts",
|
|
354
|
+
".jsx",
|
|
355
|
+
".tsx",
|
|
356
|
+
".py",
|
|
357
|
+
".rb",
|
|
358
|
+
".go",
|
|
359
|
+
".java",
|
|
360
|
+
".c",
|
|
361
|
+
".cpp",
|
|
362
|
+
".h",
|
|
363
|
+
".hpp",
|
|
364
|
+
".rs",
|
|
365
|
+
".swift",
|
|
366
|
+
".sh",
|
|
367
|
+
".bash",
|
|
368
|
+
".zsh",
|
|
369
|
+
".fish",
|
|
370
|
+
".ps1",
|
|
371
|
+
".sql",
|
|
372
|
+
".graphql",
|
|
373
|
+
".proto",
|
|
374
|
+
".css",
|
|
375
|
+
".scss",
|
|
376
|
+
".less",
|
|
377
|
+
".sass",
|
|
378
|
+
".r",
|
|
379
|
+
".R",
|
|
380
|
+
".m",
|
|
381
|
+
".pl",
|
|
382
|
+
".lua",
|
|
383
|
+
".dart"
|
|
384
|
+
]);
|
|
385
|
+
var IMAGE_EXTENSIONS = new Set([".jpg", ".jpeg", ".png", ".bmp", ".tiff", ".tif", ".webp"]);
|
|
386
|
+
async function extractText(filePath) {
|
|
387
|
+
const ext = extname(filePath).toLowerCase();
|
|
388
|
+
if (TEXT_EXTENSIONS.has(ext)) {
|
|
389
|
+
return extractFromTextFile(filePath);
|
|
390
|
+
}
|
|
391
|
+
if (ext === ".pdf") {
|
|
392
|
+
return extractFromPdf(filePath);
|
|
393
|
+
}
|
|
394
|
+
if (IMAGE_EXTENSIONS.has(ext)) {
|
|
395
|
+
return extractFromImage(filePath);
|
|
396
|
+
}
|
|
397
|
+
if ([
|
|
398
|
+
".mp3",
|
|
399
|
+
".wav",
|
|
400
|
+
".ogg",
|
|
401
|
+
".m4a",
|
|
402
|
+
".flac",
|
|
403
|
+
".aac",
|
|
404
|
+
".wma",
|
|
405
|
+
".mp4",
|
|
406
|
+
".webm",
|
|
407
|
+
".mkv",
|
|
408
|
+
".avi",
|
|
409
|
+
".mov"
|
|
410
|
+
].includes(ext)) {
|
|
411
|
+
return extractFromAudio(filePath);
|
|
412
|
+
}
|
|
413
|
+
try {
|
|
414
|
+
const buf = await readFile(filePath);
|
|
415
|
+
if (buf.length === 0) {
|
|
416
|
+
return { text: null, method: "unsupported", error: "Empty file" };
|
|
417
|
+
}
|
|
418
|
+
const sample = buf.subarray(0, 8192);
|
|
419
|
+
let nonPrintable = 0;
|
|
420
|
+
for (let i = 0;i < sample.length; i++) {
|
|
421
|
+
const b = sample[i];
|
|
422
|
+
if (b < 32 && b !== 9 && b !== 10 && b !== 13)
|
|
423
|
+
nonPrintable++;
|
|
424
|
+
}
|
|
425
|
+
if (nonPrintable / sample.length > 0.1) {
|
|
426
|
+
return { text: null, method: "unsupported", error: "Binary file, cannot extract text" };
|
|
427
|
+
}
|
|
428
|
+
return { text: buf.toString("utf-8"), method: "text-read" };
|
|
429
|
+
} catch (e) {
|
|
430
|
+
logger.warn({ err: e, filePath, ext }, "Text extraction failed");
|
|
431
|
+
return { text: null, method: "unsupported", error: `Unsupported file type: ${ext}` };
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
function extractFromTextFile(filePath) {
|
|
435
|
+
try {
|
|
436
|
+
const content = readFileSync2(filePath, "utf-8");
|
|
437
|
+
return { text: content, method: "text-read" };
|
|
438
|
+
} catch (e) {
|
|
439
|
+
return {
|
|
440
|
+
text: null,
|
|
441
|
+
method: "text-read",
|
|
442
|
+
error: `Failed to read: ${errMsg(e)}`
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
async function extractFromPdf(filePath) {
|
|
447
|
+
try {
|
|
448
|
+
const { stdout } = await execFileAsync(PDFTOTEXT_BIN, ["-layout", filePath, "-"], {
|
|
449
|
+
timeout: 30000
|
|
450
|
+
});
|
|
451
|
+
const text = stdout.trim();
|
|
452
|
+
if (!text) {
|
|
453
|
+
return {
|
|
454
|
+
text: null,
|
|
455
|
+
method: "pdf",
|
|
456
|
+
error: "PDF contains no extractable text (may be image-based)"
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
return { text, method: "pdf" };
|
|
460
|
+
} catch (e) {
|
|
461
|
+
logger.debug({ err: e, filePath }, "pdftotext failed");
|
|
462
|
+
return {
|
|
463
|
+
text: null,
|
|
464
|
+
method: "pdf",
|
|
465
|
+
error: `pdftotext failed: ${errMsg(e)}`
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
async function extractFromImage(filePath) {
|
|
470
|
+
try {
|
|
471
|
+
const { stdout } = await execFileAsync(TESSERACT_BIN, [filePath, "stdout", "-l", "kor+eng", "--psm", "3"], { timeout: 60000 });
|
|
472
|
+
const text = stdout.trim();
|
|
473
|
+
if (!text) {
|
|
474
|
+
return { text: null, method: "ocr", error: "OCR produced no text" };
|
|
475
|
+
}
|
|
476
|
+
return { text, method: "ocr" };
|
|
477
|
+
} catch (e) {
|
|
478
|
+
logger.debug({ err: e, filePath }, "tesseract OCR failed");
|
|
479
|
+
return {
|
|
480
|
+
text: null,
|
|
481
|
+
method: "ocr",
|
|
482
|
+
error: `OCR failed: ${errMsg(e)}`
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
function isTranscriptionConfigured(opts = {}) {
|
|
487
|
+
const ffmpeg = opts.ffmpegBin ?? FFMPEG_BIN;
|
|
488
|
+
if (!ffmpeg)
|
|
489
|
+
return false;
|
|
490
|
+
const backend = opts.backend ?? WHISPER_BACKEND;
|
|
491
|
+
if (backend === "mlx-whisper") {
|
|
492
|
+
return Boolean(opts.mlxWhisperBin ?? MLX_WHISPER_BIN);
|
|
493
|
+
}
|
|
494
|
+
const wrapper = opts.wrapperPath ?? FASTER_WHISPER_WRAPPER;
|
|
495
|
+
return existsSync2(wrapper);
|
|
496
|
+
}
|
|
497
|
+
async function transcribeAudio(filePath, opts = {}) {
|
|
498
|
+
if (!isTranscriptionConfigured(opts))
|
|
499
|
+
return null;
|
|
500
|
+
const result = await extractFromAudio(filePath, opts);
|
|
501
|
+
return result.text;
|
|
502
|
+
}
|
|
503
|
+
async function extractFromAudio(filePath, opts = {}) {
|
|
504
|
+
const tmpDir = `${filePath}_whisper_tmp`;
|
|
505
|
+
const backend = opts.backend ?? WHISPER_BACKEND;
|
|
506
|
+
try {
|
|
507
|
+
mkdirSync2(tmpDir, { recursive: true });
|
|
508
|
+
const mp3Path = join2(tmpDir, "audio.mp3");
|
|
509
|
+
await execFileAsync(opts.ffmpegBin ?? FFMPEG_BIN2, [
|
|
510
|
+
"-y",
|
|
511
|
+
"-i",
|
|
512
|
+
filePath,
|
|
513
|
+
"-acodec",
|
|
514
|
+
"libmp3lame",
|
|
515
|
+
"-q:a",
|
|
516
|
+
"4",
|
|
517
|
+
"-ac",
|
|
518
|
+
"1",
|
|
519
|
+
"-ar",
|
|
520
|
+
"16000",
|
|
521
|
+
mp3Path
|
|
522
|
+
], { timeout: 60000 });
|
|
523
|
+
const whisperArgs = [
|
|
524
|
+
mp3Path,
|
|
525
|
+
"--model",
|
|
526
|
+
opts.model ?? (backend === "mlx-whisper" ? WHISPER_MODEL_MLX : WHISPER_MODEL),
|
|
527
|
+
"--language",
|
|
528
|
+
opts.language ?? "ko",
|
|
529
|
+
"--output-dir",
|
|
530
|
+
tmpDir,
|
|
531
|
+
"--output-format",
|
|
532
|
+
"txt"
|
|
533
|
+
];
|
|
534
|
+
if (backend === "mlx-whisper") {
|
|
535
|
+
const mlxWhisperBin = opts.mlxWhisperBin ?? MLX_WHISPER_BIN;
|
|
536
|
+
if (!mlxWhisperBin) {
|
|
537
|
+
return { text: null, method: "whisper", error: "MLX_WHISPER_BIN not configured" };
|
|
538
|
+
}
|
|
539
|
+
await execFileAsync(mlxWhisperBin, whisperArgs, { timeout: 300000 });
|
|
540
|
+
} else {
|
|
541
|
+
await execFileAsync(opts.pythonBin ?? PYTHON_BIN, [opts.wrapperPath ?? FASTER_WHISPER_WRAPPER, ...whisperArgs], { timeout: 120000 });
|
|
542
|
+
}
|
|
543
|
+
const txtPath = join2(tmpDir, "audio.txt");
|
|
544
|
+
const text = existsSync2(txtPath) ? readFileSync2(txtPath, "utf-8").trim() : null;
|
|
545
|
+
if (!text) {
|
|
546
|
+
return { text: null, method: "whisper", error: "Whisper produced no text" };
|
|
547
|
+
}
|
|
548
|
+
return { text, method: "whisper" };
|
|
549
|
+
} catch (e) {
|
|
550
|
+
logger.debug({ err: e, filePath, backend }, "whisper extraction failed");
|
|
551
|
+
return {
|
|
552
|
+
text: null,
|
|
553
|
+
method: "whisper",
|
|
554
|
+
error: `Whisper failed: ${errMsg(e)}`
|
|
555
|
+
};
|
|
556
|
+
} finally {
|
|
557
|
+
try {
|
|
558
|
+
rmSync(tmpDir, { recursive: true, force: true });
|
|
559
|
+
} catch (e) {
|
|
560
|
+
logger.warn({ err: e, tmpDir }, "Failed to cleanup whisper tmpDir");
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
export {
|
|
565
|
+
transcribeAudio,
|
|
566
|
+
isTranscriptionConfigured,
|
|
567
|
+
extractText
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
//# debugId=97A429A4118529D264756E2164756E21
|