comisai 1.0.34 → 1.0.37
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/node_modules/@comis/agent/dist/background/auto-background-middleware.d.ts +11 -1
- package/node_modules/@comis/agent/dist/background/auto-background-middleware.js +30 -4
- package/node_modules/@comis/agent/dist/background/background-task-manager.d.ts +22 -2
- package/node_modules/@comis/agent/dist/background/background-task-manager.js +88 -40
- package/node_modules/@comis/agent/dist/background/background-task-persistence.js +34 -4
- package/node_modules/@comis/agent/dist/background/background-task-types.d.ts +59 -3
- package/node_modules/@comis/agent/dist/background/background-task-types.js +1 -1
- package/node_modules/@comis/agent/dist/background/completion-dispatcher.d.ts +130 -0
- package/node_modules/@comis/agent/dist/background/completion-dispatcher.js +215 -0
- package/node_modules/@comis/agent/dist/background/completion-formatter.d.ts +39 -0
- package/node_modules/@comis/agent/dist/background/completion-formatter.js +77 -0
- package/node_modules/@comis/agent/dist/background/completion-runner.d.ts +62 -0
- package/node_modules/@comis/agent/dist/background/completion-runner.js +234 -0
- package/node_modules/@comis/agent/dist/background/index.d.ts +10 -1
- package/node_modules/@comis/agent/dist/background/index.js +4 -0
- package/node_modules/@comis/agent/dist/background/session-resolver.d.ts +85 -0
- package/node_modules/@comis/agent/dist/background/session-resolver.js +78 -0
- package/node_modules/@comis/agent/dist/bootstrap/sections/messaging-sections.js +1 -0
- package/node_modules/@comis/agent/dist/bootstrap/sections/tool-descriptions.js +3 -3
- package/node_modules/@comis/agent/dist/bootstrap/sections/tooling-sections.d.ts +30 -2
- package/node_modules/@comis/agent/dist/bootstrap/sections/tooling-sections.js +51 -2
- package/node_modules/@comis/agent/dist/bootstrap/system-prompt-assembler.d.ts +22 -0
- package/node_modules/@comis/agent/dist/bootstrap/system-prompt-assembler.js +2 -2
- package/node_modules/@comis/agent/dist/bridge/bridge-event-handlers.d.ts +1 -5
- package/node_modules/@comis/agent/dist/bridge/bridge-event-handlers.js +2 -14
- package/node_modules/@comis/agent/dist/bridge/bridge-metrics.d.ts +43 -2
- package/node_modules/@comis/agent/dist/bridge/bridge-metrics.js +17 -2
- package/node_modules/@comis/agent/dist/bridge/pi-event-bridge.d.ts +32 -23
- package/node_modules/@comis/agent/dist/bridge/pi-event-bridge.js +145 -62
- package/node_modules/@comis/agent/dist/bridge/thinking-block-hash-invariant.d.ts +6 -7
- package/node_modules/@comis/agent/dist/bridge/thinking-block-hash-invariant.js +24 -25
- package/node_modules/@comis/agent/dist/budget/cost-tracker.d.ts +1 -1
- package/node_modules/@comis/agent/dist/context-engine/constants.d.ts +5 -5
- package/node_modules/@comis/agent/dist/context-engine/constants.js +12 -12
- package/node_modules/@comis/agent/dist/context-engine/context-engine.js +13 -4
- package/node_modules/@comis/agent/dist/context-engine/dag-annotator.d.ts +1 -2
- package/node_modules/@comis/agent/dist/context-engine/dag-annotator.js +1 -2
- package/node_modules/@comis/agent/dist/context-engine/llm-compaction.js +20 -16
- package/node_modules/@comis/agent/dist/context-engine/rehydration.js +6 -6
- package/node_modules/@comis/agent/dist/context-engine/signature-replay-scrubber.d.ts +12 -12
- package/node_modules/@comis/agent/dist/context-engine/signature-replay-scrubber.js +36 -22
- package/node_modules/@comis/agent/dist/context-engine/signature-surrogate-guard.d.ts +10 -10
- package/node_modules/@comis/agent/dist/context-engine/signature-surrogate-guard.js +14 -14
- package/node_modules/@comis/agent/dist/context-engine/thinking-block-cleaner.d.ts +11 -13
- package/node_modules/@comis/agent/dist/context-engine/thinking-block-cleaner.js +14 -15
- package/node_modules/@comis/agent/dist/context-engine/types-core.d.ts +15 -0
- package/node_modules/@comis/agent/dist/executor/cache-break-detection.d.ts +6 -6
- package/node_modules/@comis/agent/dist/executor/cache-break-detection.js +8 -8
- package/node_modules/@comis/agent/dist/executor/capability-index-context.d.ts +72 -0
- package/node_modules/@comis/agent/dist/executor/capability-index-context.js +329 -0
- package/node_modules/@comis/agent/dist/executor/drain-helper.d.ts +122 -0
- package/node_modules/@comis/agent/dist/executor/drain-helper.js +173 -0
- package/node_modules/@comis/agent/dist/executor/error-classifier.js +2 -2
- package/node_modules/@comis/agent/dist/executor/executor-context-engine-setup.d.ts +16 -0
- package/node_modules/@comis/agent/dist/executor/executor-context-engine-setup.js +46 -5
- package/node_modules/@comis/agent/dist/executor/executor-post-execution.d.ts +78 -4
- package/node_modules/@comis/agent/dist/executor/executor-post-execution.js +150 -31
- package/node_modules/@comis/agent/dist/executor/executor-prompt-runner.d.ts +7 -0
- package/node_modules/@comis/agent/dist/executor/executor-prompt-runner.js +26 -5
- package/node_modules/@comis/agent/dist/executor/executor-response-filter.d.ts +7 -6
- package/node_modules/@comis/agent/dist/executor/executor-response-filter.js +9 -42
- package/node_modules/@comis/agent/dist/executor/executor-tool-assembly.d.ts +18 -1
- package/node_modules/@comis/agent/dist/executor/executor-tool-assembly.js +20 -18
- package/node_modules/@comis/agent/dist/executor/gemini-cache-injector.d.ts +2 -2
- package/node_modules/@comis/agent/dist/executor/gemini-cache-injector.js +4 -4
- package/node_modules/@comis/agent/dist/executor/jit-guide-injector.d.ts +11 -2
- package/node_modules/@comis/agent/dist/executor/jit-guide-injector.js +16 -2
- package/node_modules/@comis/agent/dist/executor/phase-filter.d.ts +2 -2
- package/node_modules/@comis/agent/dist/executor/phase-filter.js +5 -7
- package/node_modules/@comis/agent/dist/executor/pi-executor.d.ts +21 -2
- package/node_modules/@comis/agent/dist/executor/pi-executor.js +96 -18
- package/node_modules/@comis/agent/dist/executor/post-batch-continuation.js +7 -7
- package/node_modules/@comis/agent/dist/executor/prompt-assembly.d.ts +9 -1
- package/node_modules/@comis/agent/dist/executor/prompt-assembly.js +15 -1
- package/node_modules/@comis/agent/dist/executor/stream-wrappers/request-body-injector.d.ts +1 -1
- package/node_modules/@comis/agent/dist/executor/stream-wrappers/request-body-injector.js +1 -1
- package/node_modules/@comis/agent/dist/executor/tool-deferral.d.ts +18 -27
- package/node_modules/@comis/agent/dist/executor/tool-deferral.js +34 -43
- package/node_modules/@comis/agent/dist/index.d.ts +17 -0
- package/node_modules/@comis/agent/dist/index.js +32 -11
- package/node_modules/@comis/agent/dist/model/auth-provider.d.ts +25 -2
- package/node_modules/@comis/agent/dist/model/auth-provider.js +6 -0
- package/node_modules/@comis/agent/dist/model/compaction-model-resolver.d.ts +3 -3
- package/node_modules/@comis/agent/dist/model/compaction-model-resolver.js +3 -3
- package/node_modules/@comis/agent/dist/model/model-registry-adapter.js +1 -1
- package/node_modules/@comis/agent/dist/model/model-scanner.js +1 -1
- package/node_modules/@comis/agent/dist/model/oauth-credential-store-file.d.ts +37 -0
- package/node_modules/@comis/agent/dist/model/oauth-credential-store-file.js +279 -0
- package/node_modules/@comis/agent/dist/model/oauth-credential-store-selector.d.ts +49 -0
- package/node_modules/@comis/agent/dist/model/oauth-credential-store-selector.js +50 -0
- package/node_modules/@comis/agent/dist/model/oauth-device-code.d.ts +57 -0
- package/node_modules/@comis/agent/dist/model/oauth-device-code.js +302 -0
- package/node_modules/@comis/agent/dist/model/oauth-env.d.ts +33 -0
- package/node_modules/@comis/agent/dist/model/oauth-env.js +38 -0
- package/node_modules/@comis/agent/dist/model/oauth-errors.d.ts +41 -0
- package/node_modules/@comis/agent/dist/model/oauth-errors.js +88 -0
- package/node_modules/@comis/agent/dist/model/oauth-identity.d.ts +53 -0
- package/node_modules/@comis/agent/dist/model/oauth-identity.js +141 -0
- package/node_modules/@comis/agent/dist/model/oauth-login-runner.d.ts +99 -0
- package/node_modules/@comis/agent/dist/model/oauth-login-runner.js +374 -0
- package/node_modules/@comis/agent/dist/model/oauth-tls-preflight.d.ts +58 -0
- package/node_modules/@comis/agent/dist/model/oauth-tls-preflight.js +82 -0
- package/node_modules/@comis/agent/dist/model/oauth-token-manager.d.ts +86 -16
- package/node_modules/@comis/agent/dist/model/oauth-token-manager.js +961 -66
- package/node_modules/@comis/agent/dist/model/operation-model-defaults.d.ts +9 -4
- package/node_modules/@comis/agent/dist/model/operation-model-defaults.js +36 -9
- package/node_modules/@comis/agent/dist/model/resolve-provider-api-key.d.ts +48 -0
- package/node_modules/@comis/agent/dist/model/resolve-provider-api-key.js +66 -0
- package/node_modules/@comis/agent/dist/provider/capabilities.d.ts +5 -5
- package/node_modules/@comis/agent/dist/provider/capabilities.js +10 -23
- package/node_modules/@comis/agent/dist/safety/tool-output-safety.js +3 -3
- package/node_modules/@comis/agent/dist/safety/tool-retry-breaker.d.ts +11 -1
- package/node_modules/@comis/agent/dist/safety/tool-retry-breaker.js +19 -22
- package/node_modules/@comis/agent/dist/session/comis-session-manager.d.ts +17 -3
- package/node_modules/@comis/agent/dist/session/comis-session-manager.js +1 -1
- package/node_modules/@comis/agent/dist/spawn/narrative-caster.d.ts +10 -0
- package/node_modules/@comis/agent/dist/spawn/narrative-caster.js +5 -1
- package/node_modules/@comis/agent/dist/spawn/pi-mono-adapters.d.ts +1 -1
- package/node_modules/@comis/agent/dist/spawn/pi-mono-adapters.js +5 -5
- package/node_modules/@comis/agent/dist/workspace/data-env.d.ts +38 -0
- package/node_modules/@comis/agent/dist/workspace/data-env.js +56 -0
- package/node_modules/@comis/agent/dist/workspace/index.d.ts +1 -0
- package/node_modules/@comis/agent/dist/workspace/index.js +1 -0
- package/node_modules/@comis/agent/dist/workspace/templates.js +5 -1
- package/node_modules/@comis/agent/package.json +1 -1
- package/node_modules/@comis/channels/dist/email/email-adapter.js +6 -6
- package/node_modules/@comis/channels/dist/email/imap-lifecycle.js +7 -7
- package/node_modules/@comis/channels/dist/index.d.ts +1 -1
- package/node_modules/@comis/channels/dist/index.js +1 -1
- package/node_modules/@comis/channels/dist/shared/channel-manager.d.ts +9 -3
- package/node_modules/@comis/channels/dist/shared/deliver-to-channel.js +12 -10
- package/node_modules/@comis/channels/dist/shared/inbound-gate.d.ts +1 -1
- package/node_modules/@comis/channels/dist/shared/inbound-gate.js +22 -7
- package/node_modules/@comis/channels/dist/shared/inbound-pipeline.d.ts +10 -3
- package/node_modules/@comis/channels/dist/shared/inbound-route.d.ts +1 -1
- package/node_modules/@comis/channels/dist/shared/inbound-route.js +13 -2
- package/node_modules/@comis/channels/dist/shared/response-filter.d.ts +11 -24
- package/node_modules/@comis/channels/dist/shared/response-filter.js +25 -53
- package/node_modules/@comis/channels/dist/telegram/telegram-adapter.js +1 -1
- package/node_modules/@comis/channels/package.json +1 -1
- package/node_modules/@comis/cli/dist/cli.js +2 -0
- package/node_modules/@comis/cli/dist/commands/agent.d.ts +3 -3
- package/node_modules/@comis/cli/dist/commands/agent.js +46 -3
- package/node_modules/@comis/cli/dist/commands/auth.d.ts +37 -0
- package/node_modules/@comis/cli/dist/commands/auth.js +433 -0
- package/node_modules/@comis/cli/dist/commands/doctor.d.ts +4 -1
- package/node_modules/@comis/cli/dist/commands/doctor.js +20 -5
- package/node_modules/@comis/cli/dist/commands/providers.d.ts +1 -2
- package/node_modules/@comis/cli/dist/commands/providers.js +5 -6
- package/node_modules/@comis/cli/dist/doctor/checks/oauth-health.d.ts +39 -0
- package/node_modules/@comis/cli/dist/doctor/checks/oauth-health.js +399 -0
- package/node_modules/@comis/cli/dist/doctor/types.d.ts +19 -0
- package/node_modules/@comis/cli/dist/index.d.ts +1 -0
- package/node_modules/@comis/cli/dist/index.js +10 -4
- package/node_modules/@comis/cli/dist/output/relative-time.d.ts +23 -0
- package/node_modules/@comis/cli/dist/output/relative-time.js +36 -0
- package/node_modules/@comis/cli/dist/wizard/non-interactive.js +17 -8
- package/node_modules/@comis/cli/dist/wizard/steps/03-provider.js +2 -1
- package/node_modules/@comis/cli/dist/wizard/steps/04-credentials.js +223 -34
- package/node_modules/@comis/cli/dist/wizard/steps/10-write-config.js +14 -0
- package/node_modules/@comis/cli/dist/wizard/steps/11-daemon-start.js +3 -3
- package/node_modules/@comis/cli/dist/wizard/types.d.ts +7 -0
- package/node_modules/@comis/cli/package.json +1 -1
- package/node_modules/@comis/core/dist/bootstrap.d.ts +1 -1
- package/node_modules/@comis/core/dist/config/env-substitution.d.ts +66 -0
- package/node_modules/@comis/core/dist/config/env-substitution.js +115 -0
- package/node_modules/@comis/core/dist/config/field-metadata.js +2 -0
- package/node_modules/@comis/core/dist/config/immutable-keys.js +4 -1
- package/node_modules/@comis/core/dist/config/index.d.ts +7 -1
- package/node_modules/@comis/core/dist/config/index.js +4 -1
- package/node_modules/@comis/core/dist/config/loader.js +61 -0
- package/node_modules/@comis/core/dist/config/managed-sections.d.ts +3 -3
- package/node_modules/@comis/core/dist/config/managed-sections.js +10 -5
- package/node_modules/@comis/core/dist/config/schema-agent.d.ts +4 -792
- package/node_modules/@comis/core/dist/config/schema-agent.js +16 -1
- package/node_modules/@comis/core/dist/config/schema-approvals.d.ts +0 -14
- package/node_modules/@comis/core/dist/config/schema-auto-reply-engine.d.ts +0 -6
- package/node_modules/@comis/core/dist/config/schema-background-tasks.d.ts +1 -6
- package/node_modules/@comis/core/dist/config/schema-background-tasks.js +7 -0
- package/node_modules/@comis/core/dist/config/schema-browser.d.ts +0 -18
- package/node_modules/@comis/core/dist/config/schema-channel.d.ts +0 -158
- package/node_modules/@comis/core/dist/config/schema-coalescer.d.ts +0 -5
- package/node_modules/@comis/core/dist/config/schema-daemon.d.ts +0 -32
- package/node_modules/@comis/core/dist/config/schema-delivery.d.ts +1 -17
- package/node_modules/@comis/core/dist/config/schema-delivery.js +2 -0
- package/node_modules/@comis/core/dist/config/schema-documentation.d.ts +0 -12
- package/node_modules/@comis/core/dist/config/schema-embedding.d.ts +0 -20
- package/node_modules/@comis/core/dist/config/schema-envelope.d.ts +0 -15
- package/node_modules/@comis/core/dist/config/schema-gateway.d.ts +0 -37
- package/node_modules/@comis/core/dist/config/schema-gemini-cache.d.ts +0 -4
- package/node_modules/@comis/core/dist/config/schema-gemini-cache.js +0 -2
- package/node_modules/@comis/core/dist/config/schema-integrations.d.ts +0 -318
- package/node_modules/@comis/core/dist/config/schema-lifecycle-reactions.d.ts +0 -18
- package/node_modules/@comis/core/dist/config/schema-memory-review.d.ts +0 -7
- package/node_modules/@comis/core/dist/config/schema-memory.d.ts +0 -16
- package/node_modules/@comis/core/dist/config/schema-messages.d.ts +0 -8
- package/node_modules/@comis/core/dist/config/schema-models.d.ts +0 -15
- package/node_modules/@comis/core/dist/config/schema-notification.d.ts +0 -5
- package/node_modules/@comis/core/dist/config/schema-oauth.d.ts +18 -0
- package/node_modules/@comis/core/dist/config/schema-oauth.js +19 -0
- package/node_modules/@comis/core/dist/config/schema-observability.d.ts +0 -38
- package/node_modules/@comis/core/dist/config/schema-output-retention.d.ts +34 -0
- package/node_modules/@comis/core/dist/config/schema-output-retention.js +48 -0
- package/node_modules/@comis/core/dist/config/schema-plugins.d.ts +0 -8
- package/node_modules/@comis/core/dist/config/schema-providers.d.ts +0 -64
- package/node_modules/@comis/core/dist/config/schema-queue.d.ts +0 -58
- package/node_modules/@comis/core/dist/config/schema-response-prefix.d.ts +0 -2
- package/node_modules/@comis/core/dist/config/schema-retry.d.ts +0 -6
- package/node_modules/@comis/core/dist/config/schema-scheduler.d.ts +0 -39
- package/node_modules/@comis/core/dist/config/schema-secrets.d.ts +0 -3
- package/node_modules/@comis/core/dist/config/schema-security.d.ts +0 -18
- package/node_modules/@comis/core/dist/config/schema-send-policy.d.ts +0 -13
- package/node_modules/@comis/core/dist/config/schema-sender-trust-display.d.ts +0 -5
- package/node_modules/@comis/core/dist/config/schema-serializer.js +2 -0
- package/node_modules/@comis/core/dist/config/schema-skills.d.ts +0 -63
- package/node_modules/@comis/core/dist/config/schema-skills.js +3 -4
- package/node_modules/@comis/core/dist/config/schema-streaming.d.ts +0 -38
- package/node_modules/@comis/core/dist/config/schema-telegram-file-guard.d.ts +0 -3
- package/node_modules/@comis/core/dist/config/schema-tooling.d.ts +87 -0
- package/node_modules/@comis/core/dist/config/schema-tooling.js +152 -0
- package/node_modules/@comis/core/dist/config/schema-verbosity.d.ts +0 -12
- package/node_modules/@comis/core/dist/config/schema-webhooks.d.ts +0 -40
- package/node_modules/@comis/core/dist/config/schema.d.ts +50 -37
- package/node_modules/@comis/core/dist/config/schema.js +9 -0
- package/node_modules/@comis/core/dist/context/context.d.ts +0 -4
- package/node_modules/@comis/core/dist/domain/approval-request.d.ts +0 -17
- package/node_modules/@comis/core/dist/domain/background-task-origin.d.ts +29 -0
- package/node_modules/@comis/core/dist/domain/background-task-origin.js +39 -0
- package/node_modules/@comis/core/dist/domain/delivery-origin.d.ts +0 -5
- package/node_modules/@comis/core/dist/domain/execution-graph.d.ts +0 -48
- package/node_modules/@comis/core/dist/domain/memory-entry.d.ts +0 -3
- package/node_modules/@comis/core/dist/domain/model-compat.d.ts +0 -4
- package/node_modules/@comis/core/dist/domain/normalized-message.d.ts +0 -15
- package/node_modules/@comis/core/dist/domain/provider-capabilities.d.ts +0 -6
- package/node_modules/@comis/core/dist/domain/rich-message.d.ts +0 -14
- package/node_modules/@comis/core/dist/domain/subagent-context-config.d.ts +0 -22
- package/node_modules/@comis/core/dist/domain/subagent-context-types.d.ts +0 -8
- package/node_modules/@comis/core/dist/event-bus/events-agent.d.ts +31 -0
- package/node_modules/@comis/core/dist/event-bus/events-infra.d.ts +76 -2
- package/node_modules/@comis/core/dist/exports/config.d.ts +2 -2
- package/node_modules/@comis/core/dist/exports/config.js +3 -1
- package/node_modules/@comis/core/dist/exports/domain.d.ts +2 -0
- package/node_modules/@comis/core/dist/exports/domain.js +1 -0
- package/node_modules/@comis/core/dist/exports/hooks.d.ts +1 -1
- package/node_modules/@comis/core/dist/exports/ports.d.ts +2 -2
- package/node_modules/@comis/core/dist/exports/ports.js +1 -1
- package/node_modules/@comis/core/dist/ports/channel-plugin.d.ts +0 -13
- package/node_modules/@comis/core/dist/ports/delivery-queue.d.ts +23 -0
- package/node_modules/@comis/core/dist/ports/delivery-queue.js +2 -0
- package/node_modules/@comis/core/dist/ports/index.d.ts +4 -0
- package/node_modules/@comis/core/dist/ports/index.js +5 -0
- package/node_modules/@comis/core/dist/ports/no-op-tool-capability.d.ts +30 -0
- package/node_modules/@comis/core/dist/ports/no-op-tool-capability.js +47 -0
- package/node_modules/@comis/core/dist/ports/oauth-credential-store.d.ts +64 -0
- package/node_modules/@comis/core/dist/ports/oauth-credential-store.js +37 -0
- package/node_modules/@comis/core/dist/ports/tool-capability.d.ts +165 -0
- package/node_modules/@comis/core/dist/ports/tool-capability.js +15 -0
- package/node_modules/@comis/core/dist/security/audit.d.ts +0 -11
- package/node_modules/@comis/core/dist/tool-metadata.d.ts +41 -1
- package/node_modules/@comis/core/dist/tool-metadata.js +1 -1
- package/node_modules/@comis/core/package.json +1 -1
- package/node_modules/@comis/daemon/bundled-skills/skill-creator/scripts/validate-skill.py +1 -1
- package/node_modules/@comis/daemon/dist/daemon-types.d.ts +23 -3
- package/node_modules/@comis/daemon/dist/daemon.js +168 -30
- package/node_modules/@comis/daemon/dist/index.d.ts +2 -0
- package/node_modules/@comis/daemon/dist/index.js +5 -0
- package/node_modules/@comis/daemon/dist/observability/channel-health-logger.js +3 -3
- package/node_modules/@comis/daemon/dist/observability/delivery-queue-logger.js +1 -1
- package/node_modules/@comis/daemon/dist/rpc/agent-handlers.d.ts +22 -1
- package/node_modules/@comis/daemon/dist/rpc/agent-handlers.js +84 -21
- package/node_modules/@comis/daemon/dist/rpc/agent-inline-workspace.d.ts +1 -1
- package/node_modules/@comis/daemon/dist/rpc/agent-inline-workspace.js +3 -3
- package/node_modules/@comis/daemon/dist/rpc/builtin-provider-guard.js +2 -2
- package/node_modules/@comis/daemon/dist/rpc/config-handlers.d.ts +9 -1
- package/node_modules/@comis/daemon/dist/rpc/config-handlers.js +104 -23
- package/node_modules/@comis/daemon/dist/rpc/credential-resolver.d.ts +30 -1
- package/node_modules/@comis/daemon/dist/rpc/credential-resolver.js +74 -11
- package/node_modules/@comis/daemon/dist/rpc/mcp-handlers.d.ts +8 -0
- package/node_modules/@comis/daemon/dist/rpc/mcp-handlers.js +22 -8
- package/node_modules/@comis/daemon/dist/rpc/model-handlers.d.ts +1 -1
- package/node_modules/@comis/daemon/dist/rpc/model-handlers.js +2 -2
- package/node_modules/@comis/daemon/dist/rpc/provider-handlers.js +9 -12
- package/node_modules/@comis/daemon/dist/rpc/rpc-dispatch.d.ts +1 -0
- package/node_modules/@comis/daemon/dist/rpc/rpc-dispatch.js +27 -2
- package/node_modules/@comis/daemon/dist/setup-docker-restart-warn.js +0 -1
- package/node_modules/@comis/daemon/dist/sub-agent-runner.d.ts +18 -0
- package/node_modules/@comis/daemon/dist/sub-agent-runner.js +41 -9
- package/node_modules/@comis/daemon/dist/wiring/index.d.ts +4 -0
- package/node_modules/@comis/daemon/dist/wiring/index.js +2 -0
- package/node_modules/@comis/daemon/dist/wiring/oauth-preflight.d.ts +21 -0
- package/node_modules/@comis/daemon/dist/wiring/oauth-preflight.js +134 -0
- package/node_modules/@comis/daemon/dist/wiring/setup-agents.d.ts +81 -2
- package/node_modules/@comis/daemon/dist/wiring/setup-agents.js +164 -3
- package/node_modules/@comis/daemon/dist/wiring/setup-background-completion-runner.d.ts +58 -0
- package/node_modules/@comis/daemon/dist/wiring/setup-background-completion-runner.js +59 -0
- package/node_modules/@comis/daemon/dist/wiring/setup-background-tasks.d.ts +10 -3
- package/node_modules/@comis/daemon/dist/wiring/setup-background-tasks.js +13 -7
- package/node_modules/@comis/daemon/dist/wiring/setup-channels.d.ts +9 -2
- package/node_modules/@comis/daemon/dist/wiring/setup-channels.js +35 -10
- package/node_modules/@comis/daemon/dist/wiring/setup-cross-session.d.ts +20 -5
- package/node_modules/@comis/daemon/dist/wiring/setup-cross-session.js +21 -16
- package/node_modules/@comis/daemon/dist/wiring/setup-delivery.d.ts +14 -5
- package/node_modules/@comis/daemon/dist/wiring/setup-delivery.js +65 -20
- package/node_modules/@comis/daemon/dist/wiring/setup-gateway.d.ts +4 -6
- package/node_modules/@comis/daemon/dist/wiring/setup-gateway.js +3 -5
- package/node_modules/@comis/daemon/dist/wiring/setup-heartbeat.d.ts +20 -5
- package/node_modules/@comis/daemon/dist/wiring/setup-heartbeat.js +11 -2
- package/node_modules/@comis/daemon/dist/wiring/setup-output-retention.d.ts +89 -0
- package/node_modules/@comis/daemon/dist/wiring/setup-output-retention.js +212 -0
- package/node_modules/@comis/daemon/dist/wiring/setup-schedulers.js +4 -0
- package/node_modules/@comis/daemon/dist/wiring/setup-tools.d.ts +18 -4
- package/node_modules/@comis/daemon/dist/wiring/setup-tools.js +29 -10
- package/node_modules/@comis/daemon/dist/wiring/tool-capability-adapter.d.ts +75 -0
- package/node_modules/@comis/daemon/dist/wiring/tool-capability-adapter.js +253 -0
- package/node_modules/@comis/daemon/package.json +1 -1
- package/node_modules/@comis/gateway/dist/index.d.ts +2 -0
- package/node_modules/@comis/gateway/dist/index.js +2 -0
- package/node_modules/@comis/gateway/dist/oauth/oauth-callback-route.d.ts +66 -0
- package/node_modules/@comis/gateway/dist/oauth/oauth-callback-route.js +212 -0
- package/node_modules/@comis/gateway/dist/server/hono-server.d.ts +14 -0
- package/node_modules/@comis/gateway/dist/server/hono-server.js +10 -0
- package/node_modules/@comis/gateway/dist/webhook/webhook-endpoint.d.ts +0 -4
- package/node_modules/@comis/gateway/package.json +1 -1
- package/node_modules/@comis/infra/dist/logging/log-fields.d.ts +23 -0
- package/node_modules/@comis/infra/package.json +1 -1
- package/node_modules/@comis/memory/dist/compaction.d.ts +3 -5
- package/node_modules/@comis/memory/dist/compaction.js +2 -3
- package/node_modules/@comis/memory/dist/delivery-queue-adapter.d.ts +2 -2
- package/node_modules/@comis/memory/dist/delivery-queue-adapter.js +49 -1
- package/node_modules/@comis/memory/dist/index.d.ts +2 -0
- package/node_modules/@comis/memory/dist/index.js +3 -0
- package/node_modules/@comis/memory/dist/memory-api.d.ts +1 -1
- package/node_modules/@comis/memory/dist/memory-api.js +1 -1
- package/node_modules/@comis/memory/dist/oauth-profile-schema.d.ts +17 -0
- package/node_modules/@comis/memory/dist/oauth-profile-schema.js +33 -0
- package/node_modules/@comis/memory/dist/oauth-profile-store-encrypted.d.ts +27 -0
- package/node_modules/@comis/memory/dist/oauth-profile-store-encrypted.js +144 -0
- package/node_modules/@comis/memory/dist/session-store.d.ts +1 -1
- package/node_modules/@comis/memory/dist/session-store.js +1 -1
- package/node_modules/@comis/memory/dist/sqlite-secret-store.d.ts +29 -3
- package/node_modules/@comis/memory/dist/sqlite-secret-store.js +11 -3
- package/node_modules/@comis/memory/package.json +1 -1
- package/node_modules/@comis/scheduler/dist/cron/cron-types.d.ts +0 -42
- package/node_modules/@comis/scheduler/dist/execution/execution-lock.d.ts +13 -0
- package/node_modules/@comis/scheduler/dist/execution/execution-lock.js +1 -1
- package/node_modules/@comis/scheduler/dist/execution/index.d.ts +2 -0
- package/node_modules/@comis/scheduler/dist/execution/index.js +2 -0
- package/node_modules/@comis/scheduler/dist/heartbeat/agent-heartbeat-source.d.ts +29 -8
- package/node_modules/@comis/scheduler/dist/heartbeat/agent-heartbeat-source.js +20 -8
- package/node_modules/@comis/scheduler/dist/index.d.ts +2 -0
- package/node_modules/@comis/scheduler/dist/index.js +2 -0
- package/node_modules/@comis/scheduler/dist/system-events/system-event-types.d.ts +0 -3
- package/node_modules/@comis/scheduler/dist/tasks/task-types.d.ts +0 -17
- package/node_modules/@comis/scheduler/package.json +1 -1
- package/node_modules/@comis/shared/dist/index.d.ts +3 -0
- package/node_modules/@comis/shared/dist/index.js +4 -0
- package/node_modules/@comis/shared/dist/mcp-tool-name.d.ts +78 -0
- package/node_modules/@comis/shared/dist/mcp-tool-name.js +92 -0
- package/node_modules/@comis/shared/dist/silent-tokens.d.ts +38 -0
- package/node_modules/@comis/shared/dist/silent-tokens.js +51 -0
- package/node_modules/@comis/shared/dist/visible-delivery.d.ts +28 -0
- package/node_modules/@comis/shared/dist/visible-delivery.js +16 -0
- package/node_modules/@comis/shared/package.json +1 -1
- package/node_modules/@comis/skills/dist/bridge/mcp-tool-bridge.d.ts +2 -13
- package/node_modules/@comis/skills/dist/bridge/mcp-tool-bridge.js +3 -21
- package/node_modules/@comis/skills/dist/bridge/schema-validator.d.ts +38 -0
- package/node_modules/@comis/skills/dist/bridge/schema-validator.js +169 -0
- package/node_modules/@comis/skills/dist/bridge/tool-metadata-enforcement.js +12 -0
- package/node_modules/@comis/skills/dist/bridge/tool-metadata-registry.js +133 -3
- package/node_modules/@comis/skills/dist/builtin/exec-diagnostics.d.ts +32 -0
- package/node_modules/@comis/skills/dist/builtin/exec-diagnostics.js +127 -0
- package/node_modules/@comis/skills/dist/builtin/exec-security.js +38 -0
- package/node_modules/@comis/skills/dist/builtin/exec-tool.d.ts +55 -9
- package/node_modules/@comis/skills/dist/builtin/exec-tool.js +392 -19
- package/node_modules/@comis/skills/dist/builtin/file-tools/grep-tool.js +6 -6
- package/node_modules/@comis/skills/dist/builtin/install-detour.d.ts +67 -0
- package/node_modules/@comis/skills/dist/builtin/install-detour.js +342 -0
- package/node_modules/@comis/skills/dist/builtin/platform/admin-manage-factory.js +5 -5
- package/node_modules/@comis/skills/dist/builtin/platform/agents-manage-tool.d.ts +7 -6
- package/node_modules/@comis/skills/dist/builtin/platform/agents-manage-tool.js +40 -29
- package/node_modules/@comis/skills/dist/builtin/platform/background-tasks-tool.d.ts +4 -1
- package/node_modules/@comis/skills/dist/builtin/platform/background-tasks-tool.js +3 -3
- package/node_modules/@comis/skills/dist/builtin/platform/cron-tool.js +1 -1
- package/node_modules/@comis/skills/dist/builtin/platform/gateway-tool.js +6 -6
- package/node_modules/@comis/skills/dist/builtin/platform/mcp-manage-tool.d.ts +1 -1
- package/node_modules/@comis/skills/dist/builtin/platform/mcp-manage-tool.js +9 -9
- package/node_modules/@comis/skills/dist/builtin/platform/message-tool.js +18 -0
- package/node_modules/@comis/skills/dist/builtin/platform/messaging-factory.d.ts +18 -1
- package/node_modules/@comis/skills/dist/builtin/platform/messaging-factory.js +18 -2
- package/node_modules/@comis/skills/dist/builtin/platform/models-manage-tool.js +3 -3
- package/node_modules/@comis/skills/dist/builtin/process-registry.d.ts +14 -0
- package/node_modules/@comis/skills/dist/builtin/process-tool.d.ts +24 -4
- package/node_modules/@comis/skills/dist/builtin/process-tool.js +25 -7
- package/node_modules/@comis/skills/dist/builtin/sandbox/bwrap-provider.d.ts +11 -0
- package/node_modules/@comis/skills/dist/builtin/sandbox/bwrap-provider.js +123 -1
- package/node_modules/@comis/skills/dist/builtin/sandbox/detect-provider.js +40 -15
- package/node_modules/@comis/skills/dist/index.d.ts +4 -1
- package/node_modules/@comis/skills/dist/index.js +3 -1
- package/node_modules/@comis/skills/dist/manifest/capability-parser.d.ts +44 -0
- package/node_modules/@comis/skills/dist/manifest/capability-parser.js +68 -0
- package/node_modules/@comis/skills/dist/manifest/schema.d.ts +44 -37
- package/node_modules/@comis/skills/dist/manifest/schema.js +35 -0
- package/node_modules/@comis/skills/dist/media/ssrf-fetcher.d.ts +7 -0
- package/node_modules/@comis/skills/dist/media/ssrf-fetcher.js +9 -2
- package/node_modules/@comis/skills/dist/registry/discovery.d.ts +8 -0
- package/node_modules/@comis/skills/dist/registry/discovery.js +10 -3
- package/node_modules/@comis/skills/dist/registry/skill-registry.d.ts +45 -1
- package/node_modules/@comis/skills/dist/registry/skill-registry.js +70 -7
- package/node_modules/@comis/skills/package.json +1 -1
- package/node_modules/@comis/web/dist/assets/{agent-detail-71BSbSfD.js → agent-detail-q8t1NB7w.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{agent-editor-CTSDZhwT.js → agent-editor-B46io5gv.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{agent-list-BEhni2ea.js → agent-list-DQ6g2Rcx.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{billing-view-DVP1IvVs.js → billing-view-IWPR8LgF.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{channel-detail-N_YK74xC.js → channel-detail-DlNNZuuC.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{channel-list-DRk6ZJaF.js → channel-list-DhGwxiMc.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{chat-console-Dm-GtSf9.js → chat-console-Nv6fM3Rc.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{config-editor-CIferYX6.js → config-editor-BYKuJF76.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{context-dag-browser-CL84rXXM.js → context-dag-browser-ClNEtzYE.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{context-engine-B1HOTEZv.js → context-engine-BZJ6HChd.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{delivery-view-Y6JKYVFw.js → delivery-view-Cb7I3vGu.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{diagnostics-view-DWV1UQjz.js → diagnostics-view-9u9Lyu5a.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{ic-chat-message-DfSERzzg.js → ic-chat-message-BFt3cVpx.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{ic-connection-dot-CXyhlJup.js → ic-connection-dot-y77LZ3Gu.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{ic-tool-call-DNmwTjek.js → ic-tool-call-qt6w1NQl.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{index-CBr0Tm9_.js → index-8Tg9oc-C.js} +2 -2
- package/node_modules/@comis/web/dist/assets/{mcp-management-BaH2-vox.js → mcp-management-69dtH_kY.js} +2 -2
- package/node_modules/@comis/web/dist/assets/{media-config-CZLshJoN.js → media-config-BdjLj5c1.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{media-test-C9NUWgo_.js → media-test-DuPqrixi.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{memory-inspector-D_fmTcRN.js → memory-inspector-B-Pepbq-.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{message-center-BBFlNCZn.js → message-center-B7l0yNYY.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{models-BytGLm99.js → models-JHFHuv5S.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{observe-view-VXtHqaqq.js → observe-view-r8mqhy4O.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{pipeline-builder-CfXczlfJ.js → pipeline-builder-XjkiZRcR.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{pipeline-history-CPmXFnbe.js → pipeline-history-CZqJv_Hj.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{pipeline-history-detail-DcueTMs9.js → pipeline-history-detail-BEFGMoDy.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{pipeline-list-B-xG5WZh.js → pipeline-list-B6q5LvO1.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{pipeline-monitor-pnIOYaSY.js → pipeline-monitor-BNomXjVL.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{scheduler-BtUIFHhA.js → scheduler-BJEjcGKA.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{security-C8mWRq2y.js → security-2G1jhBfV.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{session-detail-DgdkO5ka.js → session-detail-DmVPzFBR.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{session-list-DcylcfTn.js → session-list-CsqMQoHs.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{setup-wizard-BP5yjsuL.js → setup-wizard-CAdM-gSP.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{skills-DXt1bX8Z.js → skills-2ODqKaWr.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{subagents-C7YbUHXY.js → subagents-BFlwfTbD.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{workspace-manager-DP6pW4wa.js → workspace-manager--CbOx_dI.js} +1 -1
- package/node_modules/@comis/web/dist/index.html +1 -1
- package/node_modules/@comis/web/package.json +1 -1
- package/package.json +25 -24
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* @module
|
|
6
6
|
*/
|
|
7
7
|
import type { DeviceIdentity } from "@comis/core";
|
|
8
|
-
import type { AppContainer, ChannelPort } from "@comis/core";
|
|
8
|
+
import type { AppContainer, ChannelPort, DeliveryQueuePort } from "@comis/core";
|
|
9
9
|
import type { ApprovalGate } from "@comis/core";
|
|
10
|
-
import type { ChannelHealthMonitor } from "@comis/channels";
|
|
10
|
+
import type { ChannelHealthMonitor, DeliveryAdapter } from "@comis/channels";
|
|
11
11
|
import type { ComisLogger } from "@comis/infra";
|
|
12
|
-
import type { SessionResetScheduler } from "@comis/agent";
|
|
12
|
+
import type { SessionResetScheduler, BackgroundTaskManager } from "@comis/agent";
|
|
13
13
|
import type { GatewayServerHandle } from "@comis/gateway";
|
|
14
14
|
import type { HeartbeatRunner, CronScheduler } from "@comis/scheduler";
|
|
15
15
|
import type { BrowserService, RpcCall } from "@comis/skills";
|
|
@@ -52,6 +52,26 @@ export interface DaemonInstance {
|
|
|
52
52
|
readonly heartbeatRunner?: HeartbeatRunner;
|
|
53
53
|
readonly gatewayHandle?: GatewayServerHandle;
|
|
54
54
|
readonly adapterRegistry: Map<string, ChannelPort>;
|
|
55
|
+
/**
|
|
56
|
+
* Delivery-queue-side adapter map. Adapters registered here are
|
|
57
|
+
* used by the recurring delivery-queue drainer for crash-safe outbound
|
|
58
|
+
* delivery. Distinct from `adapterRegistry` (which serves direct dispatch
|
|
59
|
+
* via the RPC message.* path) -- daemon.ts populates this map AFTER
|
|
60
|
+
* setupChannels returns. Tests that exercise the recurring drainer must
|
|
61
|
+
* register adapters in this map so the drainer can find them.
|
|
62
|
+
*/
|
|
63
|
+
readonly deliveryAdapters: Map<string, DeliveryAdapter>;
|
|
64
|
+
/**
|
|
65
|
+
* Crash-safe delivery queue port. Exposed for tests that need
|
|
66
|
+
* to assert on queue depth (depth returns to 0 after drain).
|
|
67
|
+
*/
|
|
68
|
+
readonly deliveryQueue: DeliveryQueuePort;
|
|
69
|
+
/**
|
|
70
|
+
* Background task manager. Exposed for integration tests that
|
|
71
|
+
* need to promote synthetic tasks and call complete()/fail() to drive the
|
|
72
|
+
* completion runner pipeline without a live LLM.
|
|
73
|
+
*/
|
|
74
|
+
readonly backgroundTaskManager: BackgroundTaskManager;
|
|
55
75
|
readonly rpcCall: RpcCall;
|
|
56
76
|
readonly deviceIdentity?: DeviceIdentity;
|
|
57
77
|
readonly diagnosticCollector: DiagnosticCollector;
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
* Daemon Entry Point: thin orchestrator calling setupXxx() factories in sequence.
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { bootstrap, loadEnvFile, createApprovalGate, parseFormattedSessionKey, createConfigGitManager, envSubset, generateStrongToken, createAuditAggregator, createInjectionRateLimiter, validateMemoryWrite, checkApprovalsConfig, safePath, resolveConfigSecretRefs, formatSessionKey } from "@comis/core";
|
|
6
|
+
import { bootstrap, loadEnvFile, createApprovalGate, parseFormattedSessionKey, createConfigGitManager, envSubset, generateStrongToken, createAuditAggregator, createInjectionRateLimiter, validateMemoryWrite, checkApprovalsConfig, safePath, resolveConfigSecretRefs, formatSessionKey, BackgroundTasksConfigSchema } from "@comis/core";
|
|
7
7
|
import { setupSecrets as _setupSecretsImpl, createSqliteSecretStore, createNamedGraphStore, createContextStore, createObservabilityStore } from "@comis/memory";
|
|
8
8
|
import { ok, err, suppressError } from "@comis/shared";
|
|
9
9
|
import { createGatewayServer } from "@comis/gateway";
|
|
10
|
-
import { setupLogging, setupObservability, setupHealth, setupMemory, setupAgents, setupSchedulers, setupChannels, setupMedia, setupCrossSession, setupMcp, setupTools, setupMonitoring, setupHeartbeat, setupTaskExtraction, setupShutdown, setupGateway, setupRpcBridge, setupDeliveryQueue, setupDeliveryMirror, setupNotifications, setupBackgroundTasks, } from "./wiring/index.js";
|
|
10
|
+
import { setupLogging, setupObservability, setupHealth, setupMemory, setupAgents, setupSchedulers, setupChannels, setupMedia, setupCrossSession, setupMcp, setupTools, setupMonitoring, setupHeartbeat, setupTaskExtraction, setupShutdown, setupGateway, setupRpcBridge, setupDeliveryQueue, setupDeliveryMirror, setupNotifications, setupBackgroundTasks, setupBackgroundCompletionRunner, setupOutputRetention, } from "./wiring/index.js";
|
|
11
11
|
import { setupSingleAgent } from "./wiring/setup-agents.js";
|
|
12
|
-
import { createActiveRunRegistry, createModelCatalog, wireSessionStateCleanup, wireMcpDisconnectCleanup, createGeminiCacheManager, wireGeminiCacheCleanup, createSessionTrackerRegistry, validateProviderOverrides } from "@comis/agent";
|
|
12
|
+
import { createActiveRunRegistry, createBackgroundSessionResolver, createModelCatalog, wireSessionStateCleanup, wireMcpDisconnectCleanup, createGeminiCacheManager, wireGeminiCacheCleanup, createSessionTrackerRegistry, validateProviderOverrides, resolveWorkspaceDir } from "@comis/agent";
|
|
13
13
|
import { detectSandboxProvider, createImageGenProvider, createImageGenRateLimiter, createFileStateTracker } from "@comis/skills";
|
|
14
14
|
import { createGraphCoordinator, createNodeTypeRegistry } from "./graph/index.js";
|
|
15
15
|
import { createChannelHealthMonitor } from "@comis/channels";
|
|
@@ -27,6 +27,7 @@ import { registerGracefulShutdown } from "./process/graceful-shutdown.js";
|
|
|
27
27
|
import { createProcessMonitor } from "./process/process-monitor.js";
|
|
28
28
|
import { startWatchdog } from "./health/watchdog.js";
|
|
29
29
|
import { emitDockerRestartPolicyWarn } from "./setup-docker-restart-warn.js";
|
|
30
|
+
import { hasAnyOAuthAgent, emitOAuthTlsPreflightWarn } from "./wiring/oauth-preflight.js";
|
|
30
31
|
import { randomUUID, createHmac } from "node:crypto";
|
|
31
32
|
import { existsSync, chmodSync, statSync, mkdirSync, readFileSync, unlinkSync, cpSync } from "node:fs";
|
|
32
33
|
import { writeFile as fsWriteFile, rm } from "node:fs/promises";
|
|
@@ -184,7 +185,7 @@ export async function runPreflightDoctor(exitFn, opts = {}) {
|
|
|
184
185
|
level: 60,
|
|
185
186
|
time: new Date().toISOString(),
|
|
186
187
|
name: "comis-daemon",
|
|
187
|
-
|
|
188
|
+
submodule: "preflight",
|
|
188
189
|
errorKind: "dependency",
|
|
189
190
|
err: message,
|
|
190
191
|
hint: "Native module 'better-sqlite3' failed to load. Try: npm rebuild better-sqlite3 (or re-run install.sh). If this persists, reinstall comisai from a fresh tarball.",
|
|
@@ -243,6 +244,11 @@ export async function main(overrides = {}) {
|
|
|
243
244
|
});
|
|
244
245
|
let mergedEnv = process.env;
|
|
245
246
|
let secretStore;
|
|
247
|
+
// Captured here so setupAgents can wire the encrypted-mode OAuth profile
|
|
248
|
+
// adapter against the SAME db handle (no dual-handle to the same secrets.db
|
|
249
|
+
// file).
|
|
250
|
+
let secretsCrypto;
|
|
251
|
+
let secretsDb;
|
|
246
252
|
if (!secretsBootResult.ok) {
|
|
247
253
|
// Invalid master key -- fatal error
|
|
248
254
|
throw new Error(`Secrets bootstrap failed: ${secretsBootResult.error.message}`);
|
|
@@ -252,6 +258,9 @@ export async function main(overrides = {}) {
|
|
|
252
258
|
const { crypto, dbPath } = secretsBootResult.value;
|
|
253
259
|
const store = createSqliteSecretStore(dbPath, crypto);
|
|
254
260
|
secretStore = store;
|
|
261
|
+
// Capture for downstream OAuth wiring in setupAgents.
|
|
262
|
+
secretsCrypto = crypto;
|
|
263
|
+
secretsDb = store.db;
|
|
255
264
|
const decryptResult = store.decryptAll();
|
|
256
265
|
if (!decryptResult.ok) {
|
|
257
266
|
throw new Error(`Secret decryption failed: ${decryptResult.error.message}`);
|
|
@@ -328,7 +337,7 @@ export async function main(overrides = {}) {
|
|
|
328
337
|
if (approvalsWarning) {
|
|
329
338
|
daemonLogger.warn({ hint: "Set approvals.enabled: true or remove unused rules", errorKind: "config" }, approvalsWarning);
|
|
330
339
|
}
|
|
331
|
-
// 3.6. Validate PROVIDER_OVERRIDES vs live pi-ai catalog
|
|
340
|
+
// 3.6. Validate PROVIDER_OVERRIDES vs live pi-ai catalog.
|
|
332
341
|
// Emits one structured WARN per orphaned override key (provider listed in
|
|
333
342
|
// PROVIDER_OVERRIDES that pi-ai no longer ships). Fire-and-forget: never
|
|
334
343
|
// throws, daemon continues to boot with dead override entries.
|
|
@@ -378,6 +387,11 @@ export async function main(overrides = {}) {
|
|
|
378
387
|
// Created once and injected into both setupAgents (PiExecutor registration)
|
|
379
388
|
// and setupChannels (inbound pipeline routing).
|
|
380
389
|
const activeRunRegistry = createActiveRunRegistry();
|
|
390
|
+
// Composite-key resolver wraps the registry for production lookups.
|
|
391
|
+
// The raw registry is still threaded for register/deregister calls in
|
|
392
|
+
// pi-executor and executor-post-execution; the resolver supersedes
|
|
393
|
+
// single-arg `.has()`/`.get()` everywhere.
|
|
394
|
+
const sessionResolver = createBackgroundSessionResolver({ activeRunRegistry });
|
|
381
395
|
// Derive canary fallback secret from tenantId.
|
|
382
396
|
// Used when CANARY_SECRET env var is not configured. The per-agent derivation
|
|
383
397
|
// in setup-agents.ts uses this as a base combined with agentId for uniqueness.
|
|
@@ -405,7 +419,7 @@ export async function main(overrides = {}) {
|
|
|
405
419
|
// Deferred channel plugins ref for resolving platform character limits.
|
|
406
420
|
// Populated after setupChannels; the callback is invoked at message time (always set by then).
|
|
407
421
|
const channelPluginsRef = {};
|
|
408
|
-
// 6.5.1. Background task system
|
|
422
|
+
// 6.5.1. Background task system
|
|
409
423
|
// Created before setupAgents so BackgroundTaskManager is available for executor deps.
|
|
410
424
|
const { backgroundTaskManager } = setupBackgroundTasks({
|
|
411
425
|
dataDir,
|
|
@@ -462,7 +476,39 @@ export async function main(overrides = {}) {
|
|
|
462
476
|
}
|
|
463
477
|
// 6.6. Agents
|
|
464
478
|
const agents = container.config.agents;
|
|
465
|
-
|
|
479
|
+
// defaultWorkspaceDir hoisted upfront so setupMcp can run BEFORE
|
|
480
|
+
// setupAgents (it consumes defaultWorkspaceDir as defaultCwd; per-agent
|
|
481
|
+
// ToolCapabilityPort adapters constructed inside setupSingleAgent close
|
|
482
|
+
// over the daemon-global mcpClientManager). Mirrors the per-agent
|
|
483
|
+
// computation in setup-agents.ts (`resolveWorkspaceDir(effectiveConfig,
|
|
484
|
+
// agentId)` for the agent's own workspace).
|
|
485
|
+
const defaultAgentId = container.config.routing.defaultAgentId;
|
|
486
|
+
const defaultAgentConfig = agents[defaultAgentId] ??
|
|
487
|
+
agents.default ??
|
|
488
|
+
{};
|
|
489
|
+
const defaultWorkspaceDir = resolveWorkspaceDir(defaultAgentConfig, defaultAgentId);
|
|
490
|
+
// setupMcp runs before setupAgents so per-agent ToolCapabilityPort
|
|
491
|
+
// adapter construction inside setupSingleAgent can close over
|
|
492
|
+
// mcpClientManager. createMcpClientManager is a pure in-memory state
|
|
493
|
+
// holder (no I/O) -- the manager is constructed before any server-connect
|
|
494
|
+
// attempts, so the ordering is safe.
|
|
495
|
+
const { mcpClientManager } = await setupMcp({
|
|
496
|
+
servers: container.config.integrations.mcp.servers,
|
|
497
|
+
logger: skillsLogger,
|
|
498
|
+
callToolTimeoutMs: container.config.integrations.mcp.callToolTimeoutMs,
|
|
499
|
+
defaultCwd: defaultWorkspaceDir,
|
|
500
|
+
eventBus: container.eventBus,
|
|
501
|
+
stdioDefaultConcurrency: container.config.integrations.mcp.stdioDefaultConcurrency,
|
|
502
|
+
httpDefaultConcurrency: container.config.integrations.mcp.httpDefaultConcurrency,
|
|
503
|
+
});
|
|
504
|
+
const { sessionManager, executors, workspaceDirs, costTrackers, budgetGuards, stepCounters, getExecutor, piSessionAdapters, skillWatcherHandles, skillRegistries, lockCleanupTimer, singleAgentDeps, providerHealth,
|
|
505
|
+
// Daemon-level OAuth credential store, threaded into RpcDispatchDeps
|
|
506
|
+
// below so agents.update can validate oauthProfiles patches via has().
|
|
507
|
+
oauthCredentialStore,
|
|
508
|
+
// Per-agent live ToolCapabilityPort adapters; daemon.ts threads
|
|
509
|
+
// getCapabilityPortForAgent into setupTools and mutates this map on
|
|
510
|
+
// hot-add / hot-remove.
|
|
511
|
+
toolCapabilityPorts, } = await setupAgents({
|
|
466
512
|
container, memoryAdapter, sessionStore, agentLogger, outboundMediaEnabled: true,
|
|
467
513
|
autonomousMediaEnabled: !container.config.integrations.media.transcription.autoTranscribe
|
|
468
514
|
|| !container.config.integrations.media.vision.enabled
|
|
@@ -488,6 +534,14 @@ export async function main(overrides = {}) {
|
|
|
488
534
|
},
|
|
489
535
|
backgroundTaskManager, // Auto-background middleware in executor pipeline
|
|
490
536
|
backgroundNotifyFn: bgNotifyFn, // Completion notification via deferred notificationService ref
|
|
537
|
+
// Plumb the secrets bootstrap result through so setup-agents can wire the
|
|
538
|
+
// OAuth credential store. encrypted-mode shares the existing
|
|
539
|
+
// better-sqlite3 connection (no dual-handle).
|
|
540
|
+
secretsCrypto,
|
|
541
|
+
secretsDb,
|
|
542
|
+
// Daemon-global MCP manager threaded into setupSingleAgent for
|
|
543
|
+
// per-agent ToolCapabilityPort adapter construction.
|
|
544
|
+
mcpClientManager,
|
|
491
545
|
});
|
|
492
546
|
// Log operation model resolutions at startup (dry-run validation)
|
|
493
547
|
logOperationModelDryRun({
|
|
@@ -565,7 +619,7 @@ export async function main(overrides = {}) {
|
|
|
565
619
|
// can be threaded into channel config command handling. The deferred dispatch pattern
|
|
566
620
|
// ensures rpcCall is safe to pass now; actual dispatch wires later via wireDispatch().
|
|
567
621
|
const { rpcCall, wireDispatch } = setupRpcBridge({ gatewayLogger });
|
|
568
|
-
// 6.6.8.6. Approval gate (moved before channels for
|
|
622
|
+
// 6.6.8.6. Approval gate (moved before channels for chat command interception)
|
|
569
623
|
const approvalGate = createApprovalGate({
|
|
570
624
|
eventBus: container.eventBus,
|
|
571
625
|
getTimeoutMs: () => container.config.approvals?.defaultTimeoutMs ?? 30_000,
|
|
@@ -573,7 +627,7 @@ export async function main(overrides = {}) {
|
|
|
573
627
|
getBatchApprovalTtlMs: () => container.config.approvals?.batchApprovalTtlMs ?? 30_000,
|
|
574
628
|
logger: daemonLogger, // Approval cache hit/miss debug logging
|
|
575
629
|
});
|
|
576
|
-
// 6.6.8.6.1. Restore pending approvals from previous restart
|
|
630
|
+
// 6.6.8.6.1. Restore pending approvals from previous restart
|
|
577
631
|
const approvalRestorePath = pathJoin(container.config.dataDir || dataDir, "restart-approvals.json");
|
|
578
632
|
if (existsSync(approvalRestorePath)) {
|
|
579
633
|
try {
|
|
@@ -615,9 +669,9 @@ export async function main(overrides = {}) {
|
|
|
615
669
|
}
|
|
616
670
|
// 6.6.7.8. Delivery queue: create adapter BEFORE setupChannels.
|
|
617
671
|
// channelAdapters map is passed by reference -- populated after setupChannels.
|
|
618
|
-
//
|
|
672
|
+
// drainAndStart() is called AFTER setupChannels (two-phase lifecycle).
|
|
619
673
|
const channelAdaptersRef = new Map();
|
|
620
|
-
const { deliveryQueue,
|
|
674
|
+
const { deliveryQueue, drainAndStart: drainAndStartDeliveryPrune, shutdown: shutdownDeliveryQueue } = await setupDeliveryQueue({
|
|
621
675
|
db, config: container.config, eventBus: container.eventBus, logger: daemonLogger, channelAdapters: channelAdaptersRef,
|
|
622
676
|
});
|
|
623
677
|
// 6.6.8. Channels (moved down from 6.6.6 -- needs ssrfFetcher and transcriber from setupMedia)
|
|
@@ -665,12 +719,14 @@ export async function main(overrides = {}) {
|
|
|
665
719
|
queueConfig: container.config.queue,
|
|
666
720
|
// steer+followup inbound routing
|
|
667
721
|
activeRunRegistry,
|
|
722
|
+
// Composite-key resolver for active-session lookup
|
|
723
|
+
sessionResolver,
|
|
668
724
|
// /config chat command handling via deferred RPC dispatch
|
|
669
725
|
rpcCall,
|
|
670
726
|
// Task extraction callback (gated by config.scheduler.tasks.enabled)
|
|
671
727
|
onTaskExtraction: extractFromConversation,
|
|
672
728
|
// Restart continuation: track recently-active sessions for SIGUSR2 replay.
|
|
673
|
-
// Two-callback timing split
|
|
729
|
+
// Two-callback timing split:
|
|
674
730
|
// onMessageReceived fires BEFORE processInboundMessage so the tracker
|
|
675
731
|
// Map is populated before any tool call could trigger SIGUSR2 mid-
|
|
676
732
|
// execution. Without this, multi-restart chains saw 0 captured records
|
|
@@ -708,7 +764,7 @@ export async function main(overrides = {}) {
|
|
|
708
764
|
},
|
|
709
765
|
// /approve and /deny chat command interception
|
|
710
766
|
approvalGate: container.config.approvals?.enabled ? approvalGate : undefined,
|
|
711
|
-
//
|
|
767
|
+
// Per-agent session adapters and cost trackers for slash commands
|
|
712
768
|
piSessionAdapters,
|
|
713
769
|
costTrackers,
|
|
714
770
|
// Delivery queue for crash-safe persistence
|
|
@@ -744,7 +800,25 @@ export async function main(overrides = {}) {
|
|
|
744
800
|
container.eventBus.on("system:shutdown", () => { shutdownMirror(); });
|
|
745
801
|
// Structured logging for delivery queue lifecycle events
|
|
746
802
|
setupDeliveryQueueLogging({ eventBus: container.eventBus, logger: daemonLogger });
|
|
747
|
-
//
|
|
803
|
+
// Output retention housekeeper.
|
|
804
|
+
// Mirrors the delivery-queue/mirror prune pattern — single-tick gate +
|
|
805
|
+
// .unref() interval. Scans <defaultWorkspaceDir>/output/<className>/,
|
|
806
|
+
// deletes leaf files older than the class's retentionMs. Operators can
|
|
807
|
+
// disable via outputRetention.enabled: false. Per AGENTS §6.6
|
|
808
|
+
// (security/daemon): file deletion is destructive; the destructive
|
|
809
|
+
// path is gated on enabled + per-class retentionMs.
|
|
810
|
+
if (defaultWorkspaceDir) {
|
|
811
|
+
const outputRetentionHandle = setupOutputRetention({
|
|
812
|
+
config: container.config.outputRetention,
|
|
813
|
+
workspaceDir: defaultWorkspaceDir,
|
|
814
|
+
logger: daemonLogger,
|
|
815
|
+
});
|
|
816
|
+
container.eventBus.on("system:shutdown", () => { outputRetentionHandle.shutdown(); });
|
|
817
|
+
}
|
|
818
|
+
else {
|
|
819
|
+
daemonLogger.debug({ hint: "No defaultWorkspaceDir; output retention housekeeper skipped" }, "Output retention: skipped (no default workspace)");
|
|
820
|
+
}
|
|
821
|
+
// 6.6.8.0.1. Notification system
|
|
748
822
|
// setupNotifications creates the NotificationService and SessionTracker.
|
|
749
823
|
// The factory is already complete -- this call wires it into the daemon.
|
|
750
824
|
const notificationContext = setupNotifications({
|
|
@@ -761,6 +835,34 @@ export async function main(overrides = {}) {
|
|
|
761
835
|
sessionTrackerRef.ref = notificationContext.sessionTracker;
|
|
762
836
|
// Wire deferred notification ref for background task completion callbacks
|
|
763
837
|
bgNotifyRef.ref = notificationContext.notificationService;
|
|
838
|
+
// 6.6.8.0.2. Background-task completion runner -- re-enters the originating
|
|
839
|
+
// agent session when a backgrounded tool finishes.
|
|
840
|
+
// Runs AFTER setupNotifications so bgNotifyFn is live as fallbackNotifyFn.
|
|
841
|
+
//
|
|
842
|
+
// maxBackgroundHops is read from config.backgroundTasks.maxBackgroundHops
|
|
843
|
+
// (NOT config.workflow.*).
|
|
844
|
+
// backgroundTasks is a per-agent field; parse via BackgroundTasksConfigSchema to
|
|
845
|
+
// get the correct default (3) when not explicitly configured.
|
|
846
|
+
const bgConfigForRunner = BackgroundTasksConfigSchema.parse(agents[defaultAgentId]?.backgroundTasks ?? {});
|
|
847
|
+
const bgCompletionRunnerContext = setupBackgroundCompletionRunner({
|
|
848
|
+
eventBus: container.eventBus,
|
|
849
|
+
// setup-agents.ts:178 declares getExecutor as synchronous
|
|
850
|
+
// ((agentId: string) => AgentExecutor) -- resolved lazily per event.
|
|
851
|
+
getExecutor,
|
|
852
|
+
sessionStore,
|
|
853
|
+
taskManager: backgroundTaskManager,
|
|
854
|
+
fallbackNotifyFn: bgNotifyFn,
|
|
855
|
+
maxBackgroundHops: bgConfigForRunner.maxBackgroundHops,
|
|
856
|
+
logger: daemonLogger,
|
|
857
|
+
});
|
|
858
|
+
container.eventBus.on("system:shutdown", () => {
|
|
859
|
+
void bgCompletionRunnerContext.runner.shutdown();
|
|
860
|
+
});
|
|
861
|
+
// 6.6.8.0.3. Recover background tasks NOW (after the runner is subscribed).
|
|
862
|
+
// setup-background-tasks.ts INTENTIONALLY does not call this -- if it did,
|
|
863
|
+
// recovered failed events would fire before the runner subscribes and the
|
|
864
|
+
// user would never see the recovery announcement.
|
|
865
|
+
backgroundTaskManager.recoverOnStartup();
|
|
764
866
|
// Channel health monitor -- polls adapter getStatus() at configurable interval.
|
|
765
867
|
// Created after adapters are initialized, started immediately with the adapter map.
|
|
766
868
|
let channelHealthMonitor;
|
|
@@ -794,21 +896,17 @@ export async function main(overrides = {}) {
|
|
|
794
896
|
// Structured logging for channel health state transitions
|
|
795
897
|
setupChannelHealthLogging({ eventBus: container.eventBus, logger: daemonLogger });
|
|
796
898
|
// 6.6.8.7. MCP server connections (external tool servers)
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
eventBus: container.eventBus,
|
|
803
|
-
stdioDefaultConcurrency: container.config.integrations.mcp.stdioDefaultConcurrency,
|
|
804
|
-
httpDefaultConcurrency: container.config.integrations.mcp.httpDefaultConcurrency,
|
|
805
|
-
});
|
|
899
|
+
// setupMcp is called earlier (before setupAgents @ line ~600) so per-agent
|
|
900
|
+
// ToolCapabilityPort adapter construction inside setupSingleAgent can
|
|
901
|
+
// close over mcpClientManager. The mcpClientManager const declared at the
|
|
902
|
+
// earlier site is in lexical scope here; no additional wiring needed at
|
|
903
|
+
// this section anchor.
|
|
806
904
|
// Detect sandbox provider once at startup
|
|
807
905
|
const sandboxProvider = detectSandboxProvider(skillsLogger);
|
|
808
906
|
if (sandboxProvider) {
|
|
809
907
|
skillsLogger.info({ provider: sandboxProvider.name }, "Exec sandbox provider detected");
|
|
810
908
|
}
|
|
811
|
-
// 6.6.8.4.1. Image generation provider
|
|
909
|
+
// 6.6.8.4.1. Image generation provider
|
|
812
910
|
const imageGenConfig = container.config.integrations.media.imageGeneration;
|
|
813
911
|
const imageGenResult = createImageGenProvider(imageGenConfig, container.secretManager);
|
|
814
912
|
const imageGenProvider = imageGenResult.ok ? imageGenResult.value : undefined;
|
|
@@ -824,6 +922,21 @@ export async function main(overrides = {}) {
|
|
|
824
922
|
else {
|
|
825
923
|
skillsLogger.warn({ err: imageGenResult.error, hint: "Check image generation config provider value", errorKind: "config" }, "Image generation provider creation failed");
|
|
826
924
|
}
|
|
925
|
+
// Per-agent ToolCapabilityPort resolver. Falls back to the default
|
|
926
|
+
// agent's port for unknown agentIds (mirrors the setup-tools.ts:327
|
|
927
|
+
// `agents[agentId] ?? agents[defaultAgentId]` convention). Throws if
|
|
928
|
+
// neither exists -- this fires both for an initialization-order bug AND
|
|
929
|
+
// for runtime hot-remove paths (agent + default both removed; stale
|
|
930
|
+
// cron/graph/heartbeat caller carrying a since-removed agentId). The
|
|
931
|
+
// message stays scenario-agnostic so the operator can diagnose either
|
|
932
|
+
// cause.
|
|
933
|
+
const getCapabilityPortForAgent = (agentId) => {
|
|
934
|
+
const port = toolCapabilityPorts.get(agentId) ?? toolCapabilityPorts.get(defaultAgentId);
|
|
935
|
+
if (!port) {
|
|
936
|
+
throw new Error(`No ToolCapabilityPort registered for agent '${agentId}' and no default agent ('${defaultAgentId}') fallback available -- the agent may have been removed or the daemon failed to initialize.`);
|
|
937
|
+
}
|
|
938
|
+
return port;
|
|
939
|
+
};
|
|
827
940
|
// 6.6.8.5. Tools + message preprocessing
|
|
828
941
|
const { assembleToolsForAgent, preprocessMessageText } = setupTools({
|
|
829
942
|
rpcCall, agents, defaultAgentId, workspaceDirs, defaultWorkspaceDir,
|
|
@@ -839,6 +952,7 @@ export async function main(overrides = {}) {
|
|
|
839
952
|
imageGenProvider, // Conditional: only registered when API key is present
|
|
840
953
|
backgroundTaskManager, // Background_tasks tool registration
|
|
841
954
|
sessionTrackerRegistry,
|
|
955
|
+
getCapabilityPortForAgent,
|
|
842
956
|
});
|
|
843
957
|
// Wire deferred tool assembler ref now that setupTools has returned
|
|
844
958
|
toolAssemblerRef.ref = assembleToolsForAgent;
|
|
@@ -851,6 +965,9 @@ export async function main(overrides = {}) {
|
|
|
851
965
|
memoryAdapter,
|
|
852
966
|
gatewaySend: gatewaySendRef,
|
|
853
967
|
activeRunRegistry,
|
|
968
|
+
// Composite-key resolver supersedes activeRunRegistry.get(sessionKey)
|
|
969
|
+
// for sub-agent-runner abort paths.
|
|
970
|
+
sessionResolver,
|
|
854
971
|
deliveryQueue,
|
|
855
972
|
});
|
|
856
973
|
// Rolling prompt timeout counter (sliding 5-minute window).
|
|
@@ -935,7 +1052,8 @@ export async function main(overrides = {}) {
|
|
|
935
1052
|
executors,
|
|
936
1053
|
assembleToolsForAgent,
|
|
937
1054
|
workspaceDirs,
|
|
938
|
-
|
|
1055
|
+
// Composite-key resolver replaces single-arg .has()
|
|
1056
|
+
sessionResolver,
|
|
939
1057
|
duplicateDetector,
|
|
940
1058
|
adaptersByType,
|
|
941
1059
|
systemEventQueue,
|
|
@@ -1032,6 +1150,7 @@ export async function main(overrides = {}) {
|
|
|
1032
1150
|
skillWatcherHandles.set(agentId, result.skillWatcherHandle);
|
|
1033
1151
|
}
|
|
1034
1152
|
skillRegistries.set(agentId, result.skillRegistry);
|
|
1153
|
+
toolCapabilityPorts.set(agentId, result.toolCapabilityPort);
|
|
1035
1154
|
container.eventBus.emit("agent:hot_added", { agentId, timestamp: Date.now() });
|
|
1036
1155
|
daemonLogger.info({ agentId, durationMs: Date.now() - startMs }, "Agent hot-added to running daemon");
|
|
1037
1156
|
};
|
|
@@ -1059,11 +1178,12 @@ export async function main(overrides = {}) {
|
|
|
1059
1178
|
stepCounters.delete(agentId);
|
|
1060
1179
|
piSessionAdapters.delete(agentId);
|
|
1061
1180
|
skillRegistries.delete(agentId);
|
|
1181
|
+
toolCapabilityPorts.delete(agentId);
|
|
1062
1182
|
container.eventBus.emit("agent:hot_removed", { agentId, timestamp: Date.now() });
|
|
1063
1183
|
daemonLogger.info({ agentId, durationMs: Date.now() - startMs }, "Agent hot-removed from running daemon");
|
|
1064
1184
|
};
|
|
1065
1185
|
// 6.7.1. Wire RPC dispatch now that heartbeatRunner is available
|
|
1066
|
-
// Keep a reference so we can add wsConnections/mediaDir after gateway setup
|
|
1186
|
+
// Keep a reference so we can add wsConnections/mediaDir after gateway setup.
|
|
1067
1187
|
const rpcDispatchDeps = {
|
|
1068
1188
|
defaultAgentId, getAgentCronScheduler, cronSchedulers, executionTrackers,
|
|
1069
1189
|
wakeCoalescer, defaultWorkspaceDir, workspaceDirs, memoryApi, memoryAdapter,
|
|
@@ -1102,7 +1222,7 @@ export async function main(overrides = {}) {
|
|
|
1102
1222
|
},
|
|
1103
1223
|
memoryWriteValidator: validateMemoryWrite, // memory content validation
|
|
1104
1224
|
eventBus: container.eventBus, // security event emission for memory writes
|
|
1105
|
-
mcpClientManager, //
|
|
1225
|
+
mcpClientManager, // MCP server management
|
|
1106
1226
|
contextStore, // DAG recall RPC handlers
|
|
1107
1227
|
contextEngineConfig: {
|
|
1108
1228
|
maxRecallsPerDay: agents[defaultAgentId]?.contextEngine?.maxRecallsPerDay ?? 10,
|
|
@@ -1120,7 +1240,7 @@ export async function main(overrides = {}) {
|
|
|
1120
1240
|
embeddingCacheStats, // embedding cache stats for memory.embeddingCache RPC
|
|
1121
1241
|
embeddingCircuitBreakerState, // Embedding circuit breaker state for memory operations
|
|
1122
1242
|
skillRegistries, // skill management handlers in rpc-dispatch
|
|
1123
|
-
notificationService: notificationContext.notificationService, //
|
|
1243
|
+
notificationService: notificationContext.notificationService, // notification.send RPC handler
|
|
1124
1244
|
// Image generation RPC handler deps
|
|
1125
1245
|
imageHandlerDeps: imageGenProvider && imageGenRateLimiter ? {
|
|
1126
1246
|
provider: imageGenProvider,
|
|
@@ -1129,6 +1249,9 @@ export async function main(overrides = {}) {
|
|
|
1129
1249
|
logger: skillsLogger,
|
|
1130
1250
|
getChannelAdapter: (channelType) => adaptersByType.get(channelType),
|
|
1131
1251
|
} : undefined,
|
|
1252
|
+
// Daemon-level OAuth credential store handle for the agents.update
|
|
1253
|
+
// oauthProfiles existence check.
|
|
1254
|
+
oauthCredentialStore,
|
|
1132
1255
|
};
|
|
1133
1256
|
wireDispatch(rpcDispatchDeps);
|
|
1134
1257
|
// 7. Gateway
|
|
@@ -1147,7 +1270,7 @@ export async function main(overrides = {}) {
|
|
|
1147
1270
|
suspendedAgents,
|
|
1148
1271
|
instanceId, startupStartMs,
|
|
1149
1272
|
});
|
|
1150
|
-
// 7.0.1. Wire deferred gateway attachment deps
|
|
1273
|
+
// 7.0.1. Wire deferred gateway attachment deps
|
|
1151
1274
|
// wsConnections and mediaDir are now available after gateway setup; message.attach
|
|
1152
1275
|
// handler closures read from the mutable rpcDispatchDeps reference at call time.
|
|
1153
1276
|
rpcDispatchDeps.wsConnections = wsConnections;
|
|
@@ -1262,7 +1385,7 @@ export async function main(overrides = {}) {
|
|
|
1262
1385
|
secretStore, // close secrets.db on shutdown
|
|
1263
1386
|
auditAggregator, // clear pending dedup timers
|
|
1264
1387
|
injectionRateLimiter, // clear rate limiter timers on shutdown
|
|
1265
|
-
lockCleanupTimer, //
|
|
1388
|
+
lockCleanupTimer, // clear periodic lock cleanup timer
|
|
1266
1389
|
dataDir: container.config.dataDir || dataDir,
|
|
1267
1390
|
continuationTracker,
|
|
1268
1391
|
lifecycleReactors, // destroy lifecycle reactors on shutdown
|
|
@@ -1388,6 +1511,12 @@ export async function main(overrides = {}) {
|
|
|
1388
1511
|
// startup banner. No-op outside containers. Wired here so the WARN lands
|
|
1389
1512
|
// in `docker logs` next to the banner, where operators look first.
|
|
1390
1513
|
emitDockerRestartPolicyWarn(daemonLogger);
|
|
1514
|
+
// Boot-time TLS preflight against auth.openai.com.
|
|
1515
|
+
// Fire-and-forget — daemon is already serving by this point; the WARN
|
|
1516
|
+
// is purely advisory. Skipped when no OAuth-using agent is configured.
|
|
1517
|
+
if (hasAnyOAuthAgent(container.config.agents)) {
|
|
1518
|
+
void emitOAuthTlsPreflightWarn(daemonLogger);
|
|
1519
|
+
}
|
|
1391
1520
|
// Snapshot current config as last-known-good after successful startup
|
|
1392
1521
|
if (configPaths.length > 0) {
|
|
1393
1522
|
const activeConfigPath = configPaths[configPaths.length - 1];
|
|
@@ -1400,6 +1529,15 @@ export async function main(overrides = {}) {
|
|
|
1400
1529
|
container, logger, logLevelManager, tokenTracker, latencyRecorder,
|
|
1401
1530
|
processMonitor, shutdownHandle, watchdogHandle, cronSchedulers, resetSchedulers,
|
|
1402
1531
|
browserServices, heartbeatRunner, gatewayHandle, adapterRegistry: adaptersByType,
|
|
1532
|
+
// Expose the delivery-queue-side adapter map and the queue port
|
|
1533
|
+
// itself so integration tests can register adapters that the recurring
|
|
1534
|
+
// drainer sees and assert on queue depth.
|
|
1535
|
+
deliveryAdapters: channelAdaptersRef,
|
|
1536
|
+
deliveryQueue,
|
|
1537
|
+
// Expose the background task manager so integration tests can
|
|
1538
|
+
// promote synthetic tasks and call complete()/fail() to drive the
|
|
1539
|
+
// completion runner pipeline without requiring a live LLM call.
|
|
1540
|
+
backgroundTaskManager,
|
|
1403
1541
|
rpcCall, deviceIdentity, diagnosticCollector, billingEstimator,
|
|
1404
1542
|
channelActivityTracker, deliveryTracer, approvalGate, channelHealthMonitor, sessionStoreBridge,
|
|
1405
1543
|
};
|
|
@@ -7,3 +7,5 @@ export { createAnnouncementDeadLetterQueue } from "./announcement-dead-letter.js
|
|
|
7
7
|
export type { AnnouncementDeadLetterQueue, DeadLetterEntry } from "./announcement-dead-letter.js";
|
|
8
8
|
export { createContextHandlers } from "./rpc/context-handlers.js";
|
|
9
9
|
export type { ContextHandlerDeps } from "./rpc/context-handlers.js";
|
|
10
|
+
export { createAgentHandlers } from "./rpc/agent-handlers.js";
|
|
11
|
+
export type { AgentHandlerDeps } from "./rpc/agent-handlers.js";
|
|
@@ -10,3 +10,8 @@ export { sweepResultFiles, buildAnnouncementMessage, deliverFailureNotification
|
|
|
10
10
|
export { createAnnouncementDeadLetterQueue } from "./announcement-dead-letter.js";
|
|
11
11
|
// Context handlers: DAG context engine RPC handlers
|
|
12
12
|
export { createContextHandlers } from "./rpc/context-handlers.js";
|
|
13
|
+
// Agent management RPC handlers — re-exported so the multi-account
|
|
14
|
+
// integration test can drive the actual `agents.update` RPC handler against a
|
|
15
|
+
// shared `agents` map, mirroring the daemon-runtime container.config.agents
|
|
16
|
+
// pattern at daemon.ts:594/634.
|
|
17
|
+
export { createAgentHandlers } from "./rpc/agent-handlers.js";
|
|
@@ -56,7 +56,7 @@ export function setupChannelHealthLogging(deps) {
|
|
|
56
56
|
lastMessageAt,
|
|
57
57
|
hint,
|
|
58
58
|
errorKind: ERROR_KIND_MAP[currentState] ?? "internal",
|
|
59
|
-
|
|
59
|
+
submodule: MODULE,
|
|
60
60
|
}, "Channel health degraded: %s -> %s", previousState, currentState);
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
@@ -66,7 +66,7 @@ export function setupChannelHealthLogging(deps) {
|
|
|
66
66
|
previousState,
|
|
67
67
|
currentState,
|
|
68
68
|
connectionMode,
|
|
69
|
-
|
|
69
|
+
submodule: MODULE,
|
|
70
70
|
}, "Channel health changed: %s -> %s", previousState, currentState);
|
|
71
71
|
}
|
|
72
72
|
});
|
|
@@ -76,7 +76,7 @@ export function setupChannelHealthLogging(deps) {
|
|
|
76
76
|
channelType: event.channelType,
|
|
77
77
|
state: event.state,
|
|
78
78
|
responseTimeMs: event.responseTimeMs,
|
|
79
|
-
|
|
79
|
+
submodule: MODULE,
|
|
80
80
|
}, "Health check: %s = %s", event.channelType, event.state);
|
|
81
81
|
});
|
|
82
82
|
}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
export function setupDeliveryQueueLogging(deps) {
|
|
22
22
|
const { eventBus, logger } = deps;
|
|
23
23
|
const MODULE = "delivery-queue";
|
|
24
|
-
const log = logger.child({
|
|
24
|
+
const log = logger.child({ submodule: MODULE });
|
|
25
25
|
// 1. Enqueue: message enters queue (boundary event -> INFO)
|
|
26
26
|
eventBus.on("delivery:enqueued", (data) => {
|
|
27
27
|
log.info({
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* the runtime agents map, and returns structured results.
|
|
13
13
|
* @module
|
|
14
14
|
*/
|
|
15
|
-
import type { PerAgentConfig, ProviderEntry } from "@comis/core";
|
|
15
|
+
import type { PerAgentConfig, ProviderEntry, OAuthCredentialStorePort } from "@comis/core";
|
|
16
16
|
import { type PersistToConfigDeps } from "./persist-to-config.js";
|
|
17
17
|
import type { RpcHandler } from "./types.js";
|
|
18
18
|
/** Dependencies required by agent management RPC handlers. */
|
|
@@ -36,6 +36,27 @@ export interface AgentHandlerDeps {
|
|
|
36
36
|
};
|
|
37
37
|
/** Provider entries map for probe lookups when agents switch providers. */
|
|
38
38
|
providerEntries?: Record<string, ProviderEntry>;
|
|
39
|
+
/**
|
|
40
|
+
* Optional OAuth credential store for validating that `oauthProfiles`
|
|
41
|
+
* patches reference existing stored profile IDs. The
|
|
42
|
+
* agents.update handler iterates over each (provider, profileId) entry
|
|
43
|
+
* in the patched config and calls `has(profileId)`; on miss it throws
|
|
44
|
+
* with the documented "not found in store" wording BEFORE the
|
|
45
|
+
* `deps.agents[agentId] = parsedConfig` reference-replacement at the
|
|
46
|
+
* end of the handler — failure leaves the daemon's in-memory map AND
|
|
47
|
+
* the YAML both unchanged. When this field is absent (e.g. test
|
|
48
|
+
* contexts without OAuth wiring) the validation block is a no-op so
|
|
49
|
+
* existing behavior is preserved.
|
|
50
|
+
*/
|
|
51
|
+
oauthCredentialStore?: OAuthCredentialStorePort;
|
|
52
|
+
/**
|
|
53
|
+
* Models config — passed to the credential resolver so that
|
|
54
|
+
* `provider: "default"` is resolved to `models.defaultProvider` for the
|
|
55
|
+
* key check, mirroring runtime resolution in `resolveAgentModel`.
|
|
56
|
+
*/
|
|
57
|
+
modelsConfig?: {
|
|
58
|
+
defaultProvider?: string;
|
|
59
|
+
};
|
|
39
60
|
}
|
|
40
61
|
/**
|
|
41
62
|
* Create a record of agent management RPC handlers bound to the given deps.
|