@capybara-hq/kernel 0.1.0-rc.3 → 0.1.0-rc.5
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/bootstrap.json +61 -5
- package/dist/admin/admin.controller.d.ts +47 -16
- package/dist/admin/admin.controller.js +44 -19
- package/dist/admin/extensions.controller.d.ts +24 -3
- package/dist/admin/extensions.controller.js +48 -8
- package/dist/admin/setup-lock.d.ts +1 -1
- package/dist/admin/setup-lock.js +1 -1
- package/dist/admin/setup.controller.d.ts +1 -1
- package/dist/admin/setup.controller.js +1 -1
- package/dist/admin/setup.service.d.ts +4 -4
- package/dist/admin/setup.service.js +8 -8
- package/dist/agents/agent-lookup.d.ts +19 -0
- package/dist/agents/agent-lookup.js +21 -0
- package/dist/agents/agent-profile.service.d.ts +29 -0
- package/dist/agents/agent-profile.service.js +117 -0
- package/dist/agents/agents.controller.d.ts +168 -3
- package/dist/agents/agents.controller.js +201 -12
- package/dist/agents/agents.module.d.ts +4 -1
- package/dist/agents/agents.module.js +36 -6
- package/dist/agents/agents.service.d.ts +64 -27
- package/dist/agents/agents.service.js +199 -74
- package/dist/agents/definition.d.ts +53 -0
- package/dist/agents/definition.js +55 -0
- package/dist/agents/from-template.d.ts +106 -0
- package/dist/agents/from-template.js +649 -0
- package/dist/agents/from-template.service.d.ts +60 -0
- package/dist/agents/from-template.service.js +161 -0
- package/dist/agents/instruction-files.d.ts +60 -0
- package/dist/agents/instruction-files.js +111 -0
- package/dist/agents/models.controller.d.ts +9 -3
- package/dist/agents/models.controller.js +19 -4
- package/dist/agents/org-templates.d.ts +176 -0
- package/dist/agents/org-templates.js +827 -0
- package/dist/agents/pending-connector-requests.d.ts +77 -0
- package/dist/agents/pending-connector-requests.js +215 -0
- package/dist/agents/pending-connectors.controller.d.ts +39 -0
- package/dist/agents/pending-connectors.controller.js +91 -0
- package/dist/agents/pending-connectors.service.d.ts +62 -0
- package/dist/agents/pending-connectors.service.js +282 -0
- package/dist/agents/profile.d.ts +96 -0
- package/dist/agents/profile.js +51 -0
- package/dist/agents/readiness.controller.d.ts +26 -0
- package/dist/agents/readiness.controller.js +56 -0
- package/dist/agents/templates.controller.d.ts +86 -5
- package/dist/agents/templates.controller.js +171 -7
- package/dist/agents/templates.d.ts +127 -23
- package/dist/agents/templates.js +476 -53
- package/dist/background/background.controller.d.ts +38 -0
- package/dist/background/background.controller.js +87 -0
- package/dist/background/background.module.d.ts +10 -0
- package/dist/background/background.module.js +39 -0
- package/dist/background/finish.d.ts +44 -0
- package/dist/background/finish.js +94 -0
- package/dist/background/launch-lock.d.ts +15 -0
- package/dist/background/launch-lock.js +40 -0
- package/dist/background/launch.d.ts +36 -0
- package/dist/background/launch.js +70 -0
- package/dist/background/poll.job.d.ts +56 -0
- package/dist/background/poll.job.js +190 -0
- package/dist/background/render.d.ts +23 -0
- package/dist/background/render.js +48 -0
- package/dist/background/session.d.ts +48 -0
- package/dist/background/session.js +79 -0
- package/dist/background/status.d.ts +35 -0
- package/dist/background/status.js +57 -0
- package/dist/background/stop.d.ts +68 -0
- package/dist/background/stop.js +243 -0
- package/dist/background/store.d.ts +162 -0
- package/dist/background/store.js +357 -0
- package/dist/background/store.module.d.ts +6 -0
- package/dist/background/store.module.js +22 -0
- package/dist/background/tasks.service.d.ts +77 -0
- package/dist/background/tasks.service.js +211 -0
- package/dist/background/wake-rules.d.ts +66 -0
- package/dist/background/wake-rules.js +113 -0
- package/dist/background/wake.d.ts +30 -0
- package/dist/background/wake.js +63 -0
- package/dist/catalog/admin-catalog.controller.d.ts +129 -30
- package/dist/catalog/admin-catalog.controller.js +213 -42
- package/dist/catalog/catalog-content.d.ts +58 -32
- package/dist/catalog/catalog-content.js +34 -8
- package/dist/catalog/catalog-import.module.d.ts +7 -0
- package/dist/catalog/catalog-import.module.js +60 -0
- package/dist/catalog/catalog-items.d.ts +111 -7
- package/dist/catalog/catalog-items.js +279 -13
- package/dist/catalog/catalog-scope.service.d.ts +260 -0
- package/dist/catalog/catalog-scope.service.js +1116 -0
- package/dist/catalog/catalog.module.d.ts +7 -9
- package/dist/catalog/catalog.module.js +41 -31
- package/dist/catalog/catalog.service.d.ts +101 -29
- package/dist/catalog/catalog.service.js +104 -106
- package/dist/catalog/claude/agents.js +2 -0
- package/dist/catalog/cli.d.ts +11 -1
- package/dist/catalog/cli.js +26 -1
- package/dist/catalog/component-promotion.d.ts +96 -0
- package/dist/catalog/component-promotion.js +395 -0
- package/dist/catalog/component-scope.controller.d.ts +152 -0
- package/dist/catalog/component-scope.controller.js +287 -0
- package/dist/catalog/component-scope.service.d.ts +303 -0
- package/dist/catalog/component-scope.service.js +936 -0
- package/dist/catalog/component-state.d.ts +174 -0
- package/dist/catalog/component-state.js +437 -0
- package/dist/catalog/job-ids.d.ts +30 -0
- package/dist/catalog/job-ids.js +25 -0
- package/dist/catalog/marketplace-fetch.d.ts +1 -1
- package/dist/catalog/marketplaces.controller.d.ts +22 -5
- package/dist/catalog/marketplaces.controller.js +56 -7
- package/dist/catalog/marketplaces.service.d.ts +54 -14
- package/dist/catalog/marketplaces.service.js +71 -22
- package/dist/catalog/org-catalog.controller.d.ts +125 -34
- package/dist/catalog/org-catalog.controller.js +181 -65
- package/dist/catalog/org-catalog.service.d.ts +65 -33
- package/dist/catalog/org-catalog.service.js +324 -157
- package/dist/catalog/org-extension-switch.d.ts +41 -0
- package/dist/catalog/org-extension-switch.js +115 -0
- package/dist/catalog/org-extension.controller.d.ts +119 -0
- package/dist/catalog/org-extension.controller.js +266 -0
- package/dist/catalog/org-plugin-uploads.controller.d.ts +98 -0
- package/dist/catalog/org-plugin-uploads.controller.js +213 -0
- package/dist/catalog/org-plugin-uploads.d.ts +63 -0
- package/dist/catalog/org-plugin-uploads.js +116 -0
- package/dist/catalog/owned-items.d.ts +184 -0
- package/dist/catalog/owned-items.js +789 -0
- package/dist/catalog/owned-plugin-cleanup.d.ts +56 -0
- package/dist/catalog/owned-plugin-cleanup.js +194 -0
- package/dist/catalog/ownership.d.ts +172 -0
- package/dist/catalog/ownership.js +326 -0
- package/dist/catalog/platform-components.d.ts +221 -0
- package/dist/catalog/platform-components.js +761 -0
- package/dist/catalog/platform-migration.d.ts +115 -0
- package/dist/catalog/platform-migration.js +582 -0
- package/dist/catalog/plugin-import.d.ts +178 -34
- package/dist/catalog/plugin-import.js +623 -83
- package/dist/catalog/plugin-install.d.ts +185 -41
- package/dist/catalog/plugin-install.js +758 -126
- package/dist/catalog/plugin-upgrade.d.ts +260 -225
- package/dist/catalog/plugin-upgrade.js +1148 -1137
- package/dist/catalog/request-rules.d.ts +65 -0
- package/dist/catalog/request-rules.js +217 -0
- package/dist/catalog/requests.service.d.ts +193 -118
- package/dist/catalog/requests.service.js +526 -343
- package/dist/catalog/reserved-names.d.ts +8 -0
- package/dist/catalog/reserved-names.js +42 -0
- package/dist/catalog/scope-orgs.d.ts +21 -0
- package/dist/catalog/scope-orgs.js +67 -0
- package/dist/catalog/scope-state.d.ts +35 -0
- package/dist/catalog/scope-state.js +87 -0
- package/dist/catalog/scope-sync-workers.d.ts +7 -0
- package/dist/catalog/scope-sync-workers.js +29 -0
- package/dist/catalog/scope-sync.d.ts +176 -0
- package/dist/catalog/scope-sync.js +576 -0
- package/dist/catalog/scope.d.ts +42 -0
- package/dist/catalog/scope.js +42 -0
- package/dist/catalog/unshare.d.ts +22 -0
- package/dist/catalog/unshare.js +118 -0
- package/dist/channels/actions.js +1 -0
- package/dist/channels/cards.js +21 -3
- package/dist/channels/channels.module.js +2 -0
- package/dist/channels/connections.service.d.ts +16 -1
- package/dist/channels/connections.service.js +38 -4
- package/dist/channels/inbound.d.ts +9 -1
- package/dist/channels/inbound.js +67 -5
- package/dist/channels/phrases.d.ts +35 -0
- package/dist/channels/phrases.js +29 -0
- package/dist/channels/threads.d.ts +5 -0
- package/dist/channels/threads.js +8 -0
- package/dist/config/docs.js +3 -1
- package/dist/config/schema.d.ts +24 -2
- package/dist/config/schema.js +145 -19
- package/dist/conversations/access.d.ts +6 -4
- package/dist/conversations/access.js +29 -5
- package/dist/conversations/agent-tree.d.ts +46 -0
- package/dist/conversations/agent-tree.js +92 -0
- package/dist/conversations/attachments.service.d.ts +30 -0
- package/dist/conversations/attachments.service.js +130 -5
- package/dist/conversations/conversations.controller.d.ts +79 -23
- package/dist/conversations/conversations.controller.js +141 -50
- package/dist/conversations/conversations.module.d.ts +1 -1
- package/dist/conversations/conversations.module.js +10 -7
- package/dist/conversations/conversations.service.d.ts +108 -9
- package/dist/conversations/conversations.service.js +237 -30
- package/dist/conversations/environment-status.d.ts +24 -0
- package/dist/conversations/environment-status.js +71 -0
- package/dist/conversations/event-log.d.ts +21 -6
- package/dist/conversations/event-log.js +70 -1
- package/dist/conversations/events.d.ts +140 -0
- package/dist/conversations/events.js +142 -13
- package/dist/conversations/queue.d.ts +3 -1
- package/dist/conversations/queue.js +13 -2
- package/dist/conversations/queue.service.d.ts +1 -1
- package/dist/conversations/queue.service.js +8 -1
- package/dist/conversations/titles.d.ts +12 -3
- package/dist/conversations/titles.js +36 -8
- package/dist/conversations/tree.d.ts +17 -0
- package/dist/conversations/tree.js +42 -0
- package/dist/ctx/create-ctx.d.ts +5 -0
- package/dist/ctx/create-ctx.js +15 -5
- package/dist/db/kernel-schema.d.ts +420 -20
- package/dist/db/pool.d.ts +5 -0
- package/dist/db/pool.js +3 -0
- package/dist/environments/access.d.ts +41 -0
- package/dist/environments/access.js +77 -0
- package/dist/environments/conversation-environments.d.ts +61 -0
- package/dist/environments/conversation-environments.js +170 -0
- package/dist/environments/dto.d.ts +25 -0
- package/dist/environments/dto.js +12 -0
- package/dist/environments/environments.controller.d.ts +33 -0
- package/dist/environments/environments.controller.js +110 -0
- package/dist/environments/environments.module.d.ts +8 -0
- package/dist/environments/environments.module.js +27 -0
- package/dist/environments/environments.service.d.ts +153 -0
- package/dist/environments/environments.service.js +541 -0
- package/dist/environments/legacy-cleanup.job.d.ts +34 -0
- package/dist/environments/legacy-cleanup.job.js +141 -0
- package/dist/errors.d.ts +90 -2
- package/dist/errors.js +90 -2
- package/dist/evals/reconstruct.d.ts +18 -9
- package/dist/evals/reconstruct.js +26 -7
- package/dist/evals/run-replay.d.ts +7 -2
- package/dist/evals/run-replay.js +42 -7
- package/dist/evals/step-replay.d.ts +2 -5
- package/dist/evals/step-replay.js +13 -7
- package/dist/evals/trajectory.js +1 -1
- package/dist/evals/trajectory.service.d.ts +8 -3
- package/dist/evals/trajectory.service.js +26 -14
- package/dist/evals/worker.d.ts +5 -5
- package/dist/evals/worker.js +9 -3
- package/dist/extensions/admin-ops.d.ts +36 -10
- package/dist/extensions/admin-ops.js +67 -42
- package/dist/extensions/admin-view.d.ts +39 -10
- package/dist/extensions/admin-view.js +111 -20
- package/dist/extensions/blobs.js +1 -0
- package/dist/extensions/bootstrap.d.ts +17 -4
- package/dist/extensions/bootstrap.js +70 -9
- package/dist/extensions/cli.d.ts +12 -0
- package/dist/extensions/cli.js +11 -2
- package/dist/extensions/config-issues.d.ts +13 -1
- package/dist/extensions/config-issues.js +22 -5
- package/dist/extensions/config-json-schema.d.ts +43 -7
- package/dist/extensions/config-json-schema.js +124 -58
- package/dist/extensions/deployment-config-store.d.ts +6 -0
- package/dist/extensions/deployment-config.d.ts +78 -8
- package/dist/extensions/deployment-config.js +172 -34
- package/dist/extensions/display-name.d.ts +22 -0
- package/dist/extensions/display-name.js +77 -0
- package/dist/extensions/effective-config.d.ts +127 -0
- package/dist/extensions/effective-config.js +368 -0
- package/dist/extensions/extensions.module.js +14 -2
- package/dist/extensions/hooks.d.ts +37 -4
- package/dist/extensions/hooks.js +82 -16
- package/dist/extensions/host.d.ts +45 -2
- package/dist/extensions/host.js +112 -16
- package/dist/extensions/installs.d.ts +20 -8
- package/dist/extensions/installs.js +37 -15
- package/dist/extensions/org-config.d.ts +81 -6
- package/dist/extensions/org-config.js +195 -44
- package/dist/extensions/org-levels.d.ts +37 -0
- package/dist/extensions/org-levels.js +71 -0
- package/dist/extensions/org-overrides.d.ts +151 -0
- package/dist/extensions/org-overrides.js +524 -0
- package/dist/extensions/package.d.ts +14 -1
- package/dist/extensions/package.js +51 -2
- package/dist/extensions/permission-view.d.ts +19 -4
- package/dist/extensions/permission-view.js +4 -4
- package/dist/extensions/plugin-items.d.ts +21 -0
- package/dist/extensions/plugin-items.js +42 -0
- package/dist/extensions/point-defaults.controller.d.ts +34 -0
- package/dist/extensions/point-defaults.controller.js +71 -0
- package/dist/extensions/point-defaults.d.ts +71 -0
- package/dist/extensions/point-defaults.js +234 -0
- package/dist/extensions/registry.d.ts +1 -1
- package/dist/extensions/registry.js +2 -0
- package/dist/extensions/resolve.d.ts +5 -1
- package/dist/extensions/resolve.js +15 -2
- package/dist/files/previewers.d.ts +8 -1
- package/dist/files/previewers.js +35 -6
- package/dist/http/api.module.js +31 -3
- package/dist/http/app.d.ts +11 -2
- package/dist/http/app.js +31 -5
- package/dist/http/nest-logger.d.ts +6 -5
- package/dist/http/nest-logger.js +24 -10
- package/dist/identity/accounts.d.ts +29 -29
- package/dist/identity/accounts.js +47 -47
- package/dist/identity/audit.d.ts +2 -1
- package/dist/identity/auth.controller.js +9 -5
- package/dist/identity/auth.guard.d.ts +13 -5
- package/dist/identity/auth.guard.js +26 -9
- package/dist/identity/cookies.d.ts +20 -5
- package/dist/identity/cookies.js +44 -6
- package/dist/identity/identity.module.d.ts +1 -1
- package/dist/identity/identity.module.js +4 -4
- package/dist/identity/me.controller.d.ts +5 -1
- package/dist/identity/me.controller.js +12 -3
- package/dist/identity/principal.d.ts +3 -3
- package/dist/identity/principal.js +3 -3
- package/dist/identity/sessions.d.ts +12 -0
- package/dist/identity/sessions.js +45 -0
- package/dist/identity/settings.d.ts +22 -11
- package/dist/identity/settings.js +53 -18
- package/dist/identity/{enterprise-admin.d.ts → super-admin.d.ts} +5 -5
- package/dist/identity/{enterprise-admin.js → super-admin.js} +24 -24
- package/dist/inbox/inbox.module.d.ts +4 -1
- package/dist/inbox/inbox.module.js +7 -3
- package/dist/inbox/inbox.service.d.ts +62 -3
- package/dist/inbox/inbox.service.js +74 -4
- package/dist/inbox/org-notices.d.ts +63 -0
- package/dist/inbox/org-notices.js +91 -0
- package/dist/inbox/platform-inbox.controller.d.ts +23 -0
- package/dist/inbox/platform-inbox.controller.js +58 -0
- package/dist/inbox/platform-inbox.service.d.ts +151 -0
- package/dist/inbox/platform-inbox.service.js +263 -0
- package/dist/inbox/platform-notices.d.ts +19 -0
- package/dist/inbox/platform-notices.js +9 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/infra/cli/kernel-cli.module.js +9 -1
- package/dist/infra/config/kernel-config.service.js +27 -1
- package/dist/infra/database/database.module.js +1 -0
- package/dist/infra/database/xact-lock.d.ts +1 -1
- package/dist/infra/database/xact-lock.js +1 -1
- package/dist/infra/events/kernel-events.d.ts +19 -2
- package/dist/infra/lifecycle/process-guards.js +4 -0
- package/dist/infra/logging/logging.module.d.ts +4 -2
- package/dist/infra/logging/logging.module.js +24 -6
- package/dist/infra/queue/add-job-once.d.ts +14 -0
- package/dist/infra/queue/add-job-once.js +16 -0
- package/dist/infra/queue/redis-connection.d.ts +6 -0
- package/dist/infra/queue/redis-connection.js +7 -0
- package/dist/infra/redis/redis.module.js +6 -2
- package/dist/infra/tokens.d.ts +6 -1
- package/dist/infra/tokens.js +6 -1
- package/dist/kernel.module.js +6 -0
- package/dist/lifecycle/kernel-lifecycle.d.ts +1 -1
- package/dist/lifecycle/kernel-lifecycle.js +4 -4
- package/dist/log.d.ts +13 -1
- package/dist/log.js +93 -17
- package/dist/models/prices.d.ts +5 -5
- package/dist/models/prices.js +4 -4
- package/dist/models/purposes.controller.d.ts +6 -4
- package/dist/models/purposes.controller.js +13 -7
- package/dist/models/purposes.d.ts +43 -9
- package/dist/models/purposes.js +48 -18
- package/dist/orgs/directory-sync.d.ts +14 -5
- package/dist/orgs/directory-sync.js +41 -17
- package/dist/orgs/offboarding.d.ts +12 -8
- package/dist/orgs/offboarding.js +54 -33
- package/dist/orgs/org-lock.d.ts +5 -0
- package/dist/orgs/org-lock.js +13 -0
- package/dist/orgs/org.guard.d.ts +10 -0
- package/dist/orgs/org.guard.js +43 -32
- package/dist/orgs/orgs.module.js +3 -0
- package/dist/orgs/orgs.service.d.ts +20 -7
- package/dist/orgs/orgs.service.js +32 -12
- package/dist/orgs/roles.d.ts +1 -1
- package/dist/orgs/roles.js +5 -1
- package/dist/orgs/settings.controller.d.ts +1 -1
- package/dist/orgs/settings.service.d.ts +20 -3
- package/dist/orgs/settings.service.js +19 -4
- package/dist/overrides.d.ts +3 -0
- package/dist/overrides.js +2 -0
- package/dist/platform/actor.d.ts +48 -0
- package/dist/platform/actor.js +100 -0
- package/dist/platform/agent-docs.d.ts +18 -0
- package/dist/platform/agent-docs.js +59 -0
- package/dist/platform/availability.d.ts +14 -0
- package/dist/platform/availability.js +43 -0
- package/dist/platform/errors.d.ts +11 -0
- package/dist/platform/errors.js +26 -0
- package/dist/platform/exclusions.d.ts +12 -0
- package/dist/platform/exclusions.js +1387 -0
- package/dist/platform/method.d.ts +6 -0
- package/dist/platform/method.js +15 -0
- package/dist/platform/operation.d.ts +92 -0
- package/dist/platform/operation.js +35 -0
- package/dist/platform/ops/agent-templates.ops.d.ts +14 -0
- package/dist/platform/ops/agent-templates.ops.js +92 -0
- package/dist/platform/ops/agents.ops.d.ts +19 -0
- package/dist/platform/ops/agents.ops.js +294 -0
- package/dist/platform/ops/connectors.ops.d.ts +15 -0
- package/dist/platform/ops/connectors.ops.js +126 -0
- package/dist/platform/ops/errors.d.ts +11 -0
- package/dist/platform/ops/errors.js +22 -0
- package/dist/platform/ops/extensions.ops.d.ts +19 -0
- package/dist/platform/ops/extensions.ops.js +116 -0
- package/dist/platform/ops/marketplaces.ops.d.ts +16 -0
- package/dist/platform/ops/marketplaces.ops.js +157 -0
- package/dist/platform/ops/paging.d.ts +14 -0
- package/dist/platform/ops/paging.js +20 -0
- package/dist/platform/ops/platform.ops.d.ts +23 -0
- package/dist/platform/ops/platform.ops.js +158 -0
- package/dist/platform/ops/plugins.ops.d.ts +33 -0
- package/dist/platform/ops/plugins.ops.js +377 -0
- package/dist/platform/ops/requests.ops.d.ts +14 -0
- package/dist/platform/ops/requests.ops.js +153 -0
- package/dist/platform/ops/role.d.ts +4 -0
- package/dist/platform/ops/role.js +10 -0
- package/dist/platform/ops/skills.ops.d.ts +13 -0
- package/dist/platform/ops/skills.ops.js +98 -0
- package/dist/platform/ops/summary.d.ts +10 -0
- package/dist/platform/ops/summary.js +18 -0
- package/dist/platform/platform-ops.module.d.ts +7 -0
- package/dist/platform/platform-ops.module.js +55 -0
- package/dist/platform/platform.module.d.ts +8 -0
- package/dist/platform/platform.module.js +25 -0
- package/dist/platform/redact-orgs.d.ts +7 -0
- package/dist/platform/redact-orgs.js +52 -0
- package/dist/platform/registry.d.ts +30 -0
- package/dist/platform/registry.js +111 -0
- package/dist/roles/worker-role.d.ts +6 -4
- package/dist/roles/worker-role.js +14 -7
- package/dist/roles/worker.module.d.ts +1 -1
- package/dist/roles/worker.module.js +15 -1
- package/dist/runtime/context/build.d.ts +11 -7
- package/dist/runtime/context/build.js +46 -19
- package/dist/runtime/context/claude-tools.d.ts +3 -1
- package/dist/runtime/context/claude-tools.js +8 -6
- package/dist/runtime/context/compaction.js +13 -0
- package/dist/runtime/context/reminders.d.ts +2 -0
- package/dist/runtime/context/reminders.js +2 -0
- package/dist/runtime/context/skills.js +9 -2
- package/dist/runtime/context/tool-changes.d.ts +27 -0
- package/dist/runtime/context/tool-changes.js +60 -0
- package/dist/runtime/hook-calls.js +2 -0
- package/dist/runtime/langgraph-loop.d.ts +3 -1
- package/dist/runtime/langgraph-loop.js +36 -17
- package/dist/runtime/loop.d.ts +34 -5
- package/dist/runtime/maintenance.d.ts +9 -4
- package/dist/runtime/maintenance.js +35 -8
- package/dist/runtime/model-call.d.ts +46 -8
- package/dist/runtime/model-call.js +72 -21
- package/dist/runtime/providers.d.ts +6 -0
- package/dist/runtime/providers.js +8 -0
- package/dist/runtime/run-control.d.ts +11 -1
- package/dist/runtime/run-control.js +12 -0
- package/dist/runtime/run-drafts.d.ts +85 -0
- package/dist/runtime/run-drafts.js +230 -0
- package/dist/runtime/run-jobs.d.ts +3 -5
- package/dist/runtime/run-jobs.js +3 -7
- package/dist/runtime/run-queue.d.ts +59 -2
- package/dist/runtime/run-queue.js +311 -38
- package/dist/runtime/run-worker.d.ts +11 -5
- package/dist/runtime/run-worker.js +69 -33
- package/dist/runtime/runtime.module.js +11 -3
- package/dist/runtime/step-log.d.ts +15 -4
- package/dist/runtime/step-log.js +24 -7
- package/dist/runtime/stream.controller.d.ts +23 -1
- package/dist/runtime/stream.controller.js +60 -3
- package/dist/runtime/stream.d.ts +4 -1
- package/dist/runtime/stream.js +27 -3
- package/dist/runtime/subagents/child.d.ts +55 -7
- package/dist/runtime/subagents/child.js +105 -7
- package/dist/runtime/subagents/definition.d.ts +12 -3
- package/dist/runtime/subagents/definition.js +44 -28
- package/dist/runtime/subagents/deliveries.d.ts +71 -0
- package/dist/runtime/subagents/deliveries.js +228 -0
- package/dist/runtime/subagents/dispatch.d.ts +115 -26
- package/dist/runtime/subagents/dispatch.js +212 -141
- package/dist/runtime/subagents/limits.d.ts +24 -5
- package/dist/runtime/subagents/limits.js +40 -6
- package/dist/runtime/subagents/messages.d.ts +95 -0
- package/dist/runtime/subagents/messages.js +328 -0
- package/dist/runtime/subagents/preamble.d.ts +4 -4
- package/dist/runtime/subagents/preamble.js +9 -7
- package/dist/runtime/subagents/progress.d.ts +8 -6
- package/dist/runtime/subagents/progress.js +11 -6
- package/dist/runtime/subagents/render.d.ts +30 -0
- package/dist/runtime/subagents/render.js +53 -0
- package/dist/runtime/subagents/roster.d.ts +24 -7
- package/dist/runtime/subagents/roster.js +47 -11
- package/dist/runtime/subagents/skill-fork.d.ts +3 -2
- package/dist/runtime/subagents/skill-fork.js +8 -4
- package/dist/runtime/subagents/status.d.ts +14 -0
- package/dist/runtime/subagents/status.js +23 -0
- package/dist/runtime/subagents/subagents.service.d.ts +7 -4
- package/dist/runtime/subagents/subagents.service.js +11 -6
- package/dist/runtime/usage-report.d.ts +2 -1
- package/dist/runtime/usage-report.js +19 -13
- package/dist/runtime/waits.d.ts +145 -36
- package/dist/runtime/waits.js +423 -109
- package/dist/sandbox/jobs.d.ts +40 -13
- package/dist/sandbox/jobs.js +57 -20
- package/dist/sandbox/leases.d.ts +37 -54
- package/dist/sandbox/leases.js +71 -115
- package/dist/sandbox/providers.d.ts +2 -2
- package/dist/sandbox/providers.js +1 -1
- package/dist/sandbox/sandbox.module.d.ts +3 -2
- package/dist/sandbox/sandbox.module.js +10 -4
- package/dist/sandbox/sandbox.service.d.ts +282 -129
- package/dist/sandbox/sandbox.service.js +736 -381
- package/dist/skills/catalog.d.ts +3 -2
- package/dist/skills/catalog.js +21 -43
- package/dist/skills/changes.controller.d.ts +7 -0
- package/dist/skills/changes.controller.js +19 -1
- package/dist/skills/invoke.js +8 -3
- package/dist/skills/package.d.ts +20 -1
- package/dist/skills/package.js +28 -1
- package/dist/skills/skills.controller.d.ts +39 -4
- package/dist/skills/skills.controller.js +88 -10
- package/dist/skills/skills.module.js +10 -1
- package/dist/skills/skills.service.d.ts +106 -26
- package/dist/skills/skills.service.js +421 -75
- package/dist/skills/usable.d.ts +81 -0
- package/dist/skills/usable.js +379 -0
- package/dist/tools/approvals.service.d.ts +20 -2
- package/dist/tools/approvals.service.js +25 -4
- package/dist/tools/builtin-names.d.ts +41 -7
- package/dist/tools/builtin-names.js +59 -7
- package/dist/tools/builtins/agent.d.ts +23 -21
- package/dist/tools/builtins/agent.js +62 -55
- package/dist/tools/builtins/builtin-tools.d.ts +19 -1
- package/dist/tools/builtins/builtin-tools.js +59 -2
- package/dist/tools/builtins/handback.d.ts +28 -0
- package/dist/tools/builtins/handback.js +53 -0
- package/dist/tools/builtins/platform.d.ts +34 -0
- package/dist/tools/builtins/platform.js +362 -0
- package/dist/tools/builtins/sandbox/bash.d.ts +1 -1
- package/dist/tools/builtins/sandbox/bash.js +241 -4
- package/dist/tools/builtins/sandbox/common.d.ts +69 -27
- package/dist/tools/builtins/sandbox/common.js +87 -48
- package/dist/tools/builtins/sandbox/deliver.js +1 -1
- package/dist/tools/builtins/sandbox/edit.js +2 -2
- package/dist/tools/builtins/sandbox/glob.js +2 -2
- package/dist/tools/builtins/sandbox/grep.js +2 -4
- package/dist/tools/builtins/sandbox/index.d.ts +3 -1
- package/dist/tools/builtins/sandbox/index.js +7 -1
- package/dist/tools/builtins/sandbox/read.js +1 -1
- package/dist/tools/builtins/sandbox/task-output.d.ts +74 -0
- package/dist/tools/builtins/sandbox/task-output.js +329 -0
- package/dist/tools/builtins/sandbox/task-stop.d.ts +10 -0
- package/dist/tools/builtins/sandbox/task-stop.js +113 -0
- package/dist/tools/builtins/sandbox/write.js +2 -2
- package/dist/tools/builtins/send-message.d.ts +56 -0
- package/dist/tools/builtins/send-message.js +100 -0
- package/dist/tools/builtins/skill-load.d.ts +22 -14
- package/dist/tools/builtins/skill-load.js +86 -57
- package/dist/tools/builtins/skill-write.js +1 -1
- package/dist/tools/builtins/web/errors.d.ts +8 -0
- package/dist/tools/builtins/web/errors.js +53 -0
- package/dist/tools/builtins/web/extract.d.ts +62 -0
- package/dist/tools/builtins/web/extract.js +271 -0
- package/dist/tools/builtins/web/fetch.d.ts +55 -0
- package/dist/tools/builtins/web/fetch.js +175 -0
- package/dist/tools/builtins/web/index.d.ts +13 -0
- package/dist/tools/builtins/web/index.js +12 -0
- package/dist/tools/builtins/web/page-cache.d.ts +25 -0
- package/dist/tools/builtins/web/page-cache.js +77 -0
- package/dist/tools/builtins/web/search.d.ts +25 -0
- package/dist/tools/builtins/web/search.js +210 -0
- package/dist/tools/builtins/web/url.d.ts +17 -0
- package/dist/tools/builtins/web/url.js +43 -0
- package/dist/tools/connectors.controller.d.ts +10 -0
- package/dist/tools/connectors.controller.js +12 -0
- package/dist/tools/connectors.service.d.ts +46 -5
- package/dist/tools/connectors.service.js +94 -15
- package/dist/tools/extension-tools.controller.d.ts +14 -0
- package/dist/tools/extension-tools.controller.js +37 -0
- package/dist/tools/info.d.ts +42 -1
- package/dist/tools/info.js +64 -1
- package/dist/tools/oauth/flow-paths.d.ts +1 -1
- package/dist/tools/oauth/flow-paths.js +1 -1
- package/dist/tools/org-tool-switches.d.ts +74 -0
- package/dist/tools/org-tool-switches.js +184 -0
- package/dist/tools/pipeline.d.ts +46 -40
- package/dist/tools/pipeline.js +202 -364
- package/dist/tools/policy.d.ts +1 -1
- package/dist/tools/policy.js +36 -16
- package/dist/tools/registry.d.ts +120 -8
- package/dist/tools/registry.js +112 -19
- package/dist/tools/tools.module.js +24 -2
- package/dist/tools/validate.js +1 -1
- package/dist/ui/views.d.ts +2 -1
- package/dist/ui/views.js +17 -3
- package/package.json +3 -3
- package/src/migrations/0064_account_last_org.sql +7 -0
- package/src/migrations/0065_conversation_archive.sql +8 -0
- package/src/migrations/0066_extension_display_name.sql +4 -0
- package/src/migrations/0067_agent_profiles.sql +20 -0
- package/src/migrations/0068_agent_avatar_uploads.sql +7 -0
- package/src/migrations/0069_attachments_agent_idx.sql +3 -0
- package/src/migrations/0070_background_tasks.sql +37 -0
- package/src/migrations/0071_background_tasks_reserve.sql +6 -0
- package/src/migrations/0072_background_tasks_stopping.sql +5 -0
- package/src/migrations/0073_org_extension_point_defaults.sql +11 -0
- package/src/migrations/0074_subagent_tree.sql +50 -0
- package/src/migrations/0075_plugin_scope.sql +61 -0
- package/src/migrations/0076_skills_created_by_nullable.sql +6 -0
- package/src/migrations/0077_scope_requests.sql +52 -0
- package/src/migrations/0078_scope_grant_switches.sql +18 -0
- package/src/migrations/0079_scope_live_install_switches.sql +19 -0
- package/src/migrations/0080_rename_enterprise_admin.sql +18 -0
- package/src/migrations/0081_platform_components.sql +129 -0
- package/src/migrations/0082_platform_migration.sql +33 -0
- package/src/migrations/0083_plugin_scope_sync_failures.sql +15 -0
- package/src/migrations/0084_org_owned_items.sql +85 -0
- package/src/migrations/0085_agent_templates_phase4.sql +45 -0
- package/src/migrations/0086_org_layering.sql +30 -0
- package/src/migrations/0087_approval_summary.sql +6 -0
- package/src/migrations/0088_environments.sql +80 -0
- package/dist/catalog/upgrade-targets.d.ts +0 -56
- package/dist/catalog/upgrade-targets.js +0 -90
- package/dist/conversations/sandbox-status.d.ts +0 -24
- package/dist/conversations/sandbox-status.js +0 -52
- package/dist/extensions/org-config.controller.d.ts +0 -24
- package/dist/extensions/org-config.controller.js +0 -62
|
@@ -10,7 +10,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
10
10
|
import { Inject, Injectable, Optional } from "@nestjs/common";
|
|
11
11
|
import { DelayedError } from "bullmq";
|
|
12
12
|
import { sql } from "kysely";
|
|
13
|
-
import {
|
|
13
|
+
import { EventLog } from "../conversations/event-log.js";
|
|
14
|
+
import { isAbsorbable, } from "../conversations/events.js";
|
|
14
15
|
import { effectiveDefinition, NO_SELECTION, readSelection, sameModel, sameSelection, } from "../conversations/selection.js";
|
|
15
16
|
import { TitleQueue } from "../conversations/titles.js";
|
|
16
17
|
import { ApiError } from "../errors.js";
|
|
@@ -31,10 +32,11 @@ import { ConversationLock } from "./conversation-lock.js";
|
|
|
31
32
|
import { RunError } from "./model-call.js";
|
|
32
33
|
import { ProviderListError, ProviderRegistry } from "./providers.js";
|
|
33
34
|
import { ORG_QUOTA_LEASE_MS, orgRunLimit, RUN_QUOTA } from "./quota.js";
|
|
35
|
+
import { RunDrafts, streamSink } from "./run-drafts.js";
|
|
34
36
|
import { RunFinish, TERMINAL_STATUSES } from "./run-finish.js";
|
|
35
37
|
import { RunQueue } from "./run-queue.js";
|
|
36
38
|
import { AgentLoops, RunSteps } from "./run-steps.js";
|
|
37
|
-
import { dispatchOfChildRun } from "./subagents/child.js";
|
|
39
|
+
import { dispatchOfChildRun, rootConversationOf } from "./subagents/child.js";
|
|
38
40
|
import { childRunDefinition } from "./subagents/definition.js";
|
|
39
41
|
import { forkBoundary } from "./subagents/skill-fork.js";
|
|
40
42
|
import { Waits } from "./waits.js";
|
|
@@ -85,6 +87,7 @@ let RunWorker = class RunWorker {
|
|
|
85
87
|
pipeline;
|
|
86
88
|
finisher;
|
|
87
89
|
txHost;
|
|
90
|
+
drafts;
|
|
88
91
|
hooks;
|
|
89
92
|
/** The two run queues' BullMQ workers (spec §7.4), once {@link start}ed on the worker role. */
|
|
90
93
|
workers = [];
|
|
@@ -113,7 +116,9 @@ let RunWorker = class RunWorker {
|
|
|
113
116
|
* (`stopOpenAgentCalls`; a no-op without dispatches); `fire` runs their observe hooks after the
|
|
114
117
|
* commit (sub-agents spec §12, review m1: a failed or stalled parent too).
|
|
115
118
|
*/
|
|
116
|
-
pipeline, finisher, txHost,
|
|
119
|
+
pipeline, finisher, txHost,
|
|
120
|
+
/** The steps' live drafts this process writes for the runs it executes. */
|
|
121
|
+
drafts, hooks) {
|
|
117
122
|
this.kdb = kdb;
|
|
118
123
|
this.eventLog = eventLog;
|
|
119
124
|
this.lock = lock;
|
|
@@ -133,6 +138,7 @@ let RunWorker = class RunWorker {
|
|
|
133
138
|
this.pipeline = pipeline;
|
|
134
139
|
this.finisher = finisher;
|
|
135
140
|
this.txHost = txHost;
|
|
141
|
+
this.drafts = drafts;
|
|
136
142
|
this.hooks = hooks;
|
|
137
143
|
this.loop = loops.create(steps.deps);
|
|
138
144
|
}
|
|
@@ -177,35 +183,16 @@ let RunWorker = class RunWorker {
|
|
|
177
183
|
}
|
|
178
184
|
}
|
|
179
185
|
/**
|
|
180
|
-
*
|
|
181
|
-
*
|
|
186
|
+
* The run's stream sink: deltas on the conversation's topic (any replica's subscribers get them)
|
|
187
|
+
* and the steps' live drafts in Redis ({@link streamSink}, spec 2026-11-07 §3.2).
|
|
182
188
|
*/
|
|
183
189
|
sinkFor(conversationId) {
|
|
184
|
-
|
|
185
|
-
let at = { runId: "", step: -1, chars: 0 };
|
|
186
|
-
return (d) => {
|
|
187
|
-
if (at.runId !== d.runId || at.step !== d.step || d.kind === "step_reset") {
|
|
188
|
-
at = { runId: d.runId, step: d.step, chars: 0 };
|
|
189
|
-
}
|
|
190
|
-
const offset = at.chars;
|
|
191
|
-
if (d.kind === "text")
|
|
192
|
-
at.chars += d.text?.length ?? 0;
|
|
193
|
-
const msg = {
|
|
194
|
-
kind: "delta",
|
|
195
|
-
runId: d.runId,
|
|
196
|
-
step: d.step,
|
|
197
|
-
delta: d.kind,
|
|
198
|
-
...(d.text !== undefined && { text: d.text }),
|
|
199
|
-
...(d.kind === "text" && { offset }),
|
|
200
|
-
};
|
|
201
|
-
this.bus
|
|
202
|
-
.publish(conversationTopic(conversationId), msg)
|
|
203
|
-
.catch((err) => this.log.warn("stream delta publish failed", { conversationId, err }));
|
|
204
|
-
};
|
|
190
|
+
return streamSink(conversationId, { bus: this.bus, drafts: this.drafts, log: this.log });
|
|
205
191
|
}
|
|
206
192
|
/**
|
|
207
193
|
* After any terminal commit of a run that is not a sub-agent's (sub-agents spec §12): stops its
|
|
208
|
-
* active
|
|
194
|
+
* active fork invocation child on its behalf (no account); background `Agent` children keep
|
|
195
|
+
* running (agent map spec §5.4). The wait sweep is the backstop.
|
|
209
196
|
*/
|
|
210
197
|
async stopChildren(runId) {
|
|
211
198
|
try {
|
|
@@ -227,6 +214,14 @@ let RunWorker = class RunWorker {
|
|
|
227
214
|
catch (err) {
|
|
228
215
|
this.log.error("cannot report finished sub-agent run to its parent", { runId, err });
|
|
229
216
|
}
|
|
217
|
+
// a sub-agent a person stopped stops its descendants too, also one it dispatched after the
|
|
218
|
+
// tree stop read the tree (agent map spec §6); any other end leaves them running
|
|
219
|
+
try {
|
|
220
|
+
await this.waits.stopDescendantsOfStopped(runId);
|
|
221
|
+
}
|
|
222
|
+
catch (err) {
|
|
223
|
+
this.log.error("cannot stop the descendants of a stopped sub-agent", { runId, err });
|
|
224
|
+
}
|
|
230
225
|
}
|
|
231
226
|
/**
|
|
232
227
|
* 任务结束后的 ensureRun,失败按 {@link ENSURE_RETRY_DELAYS_MS} 退避重试;停机开始后不再等待间隔
|
|
@@ -368,6 +363,7 @@ let RunWorker = class RunWorker {
|
|
|
368
363
|
"trigger_seq",
|
|
369
364
|
"started_at",
|
|
370
365
|
"waited_ms",
|
|
366
|
+
"budget_run_id",
|
|
371
367
|
])
|
|
372
368
|
.where("id", "=", runId)
|
|
373
369
|
.executeTakeFirst();
|
|
@@ -385,7 +381,7 @@ let RunWorker = class RunWorker {
|
|
|
385
381
|
return;
|
|
386
382
|
const conv = await this.db
|
|
387
383
|
.selectFrom("conversations")
|
|
388
|
-
.select(["org_id", "agent_id", "kind"])
|
|
384
|
+
.select(["org_id", "agent_id", "kind", "subagent_depth"])
|
|
389
385
|
.where("id", "=", conversationId)
|
|
390
386
|
.executeTakeFirst();
|
|
391
387
|
if (!conv)
|
|
@@ -531,18 +527,36 @@ let RunWorker = class RunWorker {
|
|
|
531
527
|
maxSteps = Math.min(started.payload.maxSteps, runtime.maxSteps);
|
|
532
528
|
const row = await dispatchOfChildRun(this.db, runId);
|
|
533
529
|
const otherAgent = started.payload.template.source === "agent";
|
|
530
|
+
const parentConversationId = row?.parentConversationId ?? started.payload.parent.conversationId;
|
|
531
|
+
// a sub-agent conversation is at depth 1 at least: one written before depths were recorded
|
|
532
|
+
// (default 0) was a child of a root
|
|
533
|
+
const depth = Math.max(conv.subagent_depth, 1) - 1;
|
|
534
|
+
const rootConversationId = depth === 0
|
|
535
|
+
? parentConversationId
|
|
536
|
+
: await rootConversationOf(this.db, parentConversationId);
|
|
537
|
+
// the tree's budget window of THIS run (agent map spec §6): its own `budget_run_id`, set when
|
|
538
|
+
// it was created (a dispatch, or a wake run from the root's current window), else its
|
|
539
|
+
// dispatch's; never derived from the parent run, which for a wake run is the first dispatch's
|
|
540
|
+
const budgetRunId = run.budget_run_id ?? row?.budgetRunId;
|
|
534
541
|
parent = row
|
|
535
542
|
? {
|
|
536
543
|
conversationId: row.parentConversationId,
|
|
537
544
|
runId: row.parentRunId,
|
|
538
545
|
callId: row.parentCallId,
|
|
546
|
+
depth,
|
|
547
|
+
rootConversationId,
|
|
539
548
|
otherAgent,
|
|
549
|
+
...(budgetRunId !== undefined && { budgetRunId }),
|
|
550
|
+
...(row.forSkill === true && { forSkill: true }),
|
|
540
551
|
}
|
|
541
552
|
: {
|
|
542
553
|
conversationId: started.payload.parent.conversationId,
|
|
543
554
|
runId: started.payload.parent.runId,
|
|
544
555
|
callId: started.payload.parent.callId,
|
|
556
|
+
depth,
|
|
557
|
+
rootConversationId,
|
|
545
558
|
otherAgent,
|
|
559
|
+
...(budgetRunId !== undefined && { budgetRunId }),
|
|
546
560
|
};
|
|
547
561
|
}
|
|
548
562
|
else {
|
|
@@ -642,15 +656,16 @@ let RunWorker = class RunWorker {
|
|
|
642
656
|
.executeTakeFirstOrThrow();
|
|
643
657
|
const startConsumed = Number(consumed_seq);
|
|
644
658
|
let absorbed = startConsumed;
|
|
645
|
-
const
|
|
659
|
+
const pendingAbsorbable = async (afterSeq) => {
|
|
646
660
|
// loop 声明已吸收到 afterSeq(续跑时来自 checkpoint,可能包含之前进程吸收的消息)。
|
|
647
661
|
absorbed = Math.max(absorbed, afterSeq);
|
|
648
662
|
const out = [];
|
|
649
663
|
let after = Math.max(afterSeq, startConsumed);
|
|
650
664
|
for (;;) {
|
|
651
665
|
const page = await this.eventLog.readAfter(conversationId, after, READ_PAGE);
|
|
666
|
+
// messages and finished background tasks (spec 2026-11-05-background-bash-design §2.4)
|
|
652
667
|
for (const e of page)
|
|
653
|
-
if (e
|
|
668
|
+
if (isAbsorbable(e))
|
|
654
669
|
out.push(e);
|
|
655
670
|
const last = page.at(-1);
|
|
656
671
|
if (page.length < READ_PAGE || !last)
|
|
@@ -677,7 +692,7 @@ let RunWorker = class RunWorker {
|
|
|
677
692
|
signal: ac.signal,
|
|
678
693
|
shutdown: state.shutdown.signal,
|
|
679
694
|
sink: this.sinkFor(conversationId),
|
|
680
|
-
|
|
695
|
+
pendingAbsorbable,
|
|
681
696
|
limits: { maxSteps, deadline },
|
|
682
697
|
// a sub-agent's conversation fires hooks like a chat, with `parent` set (spec §11)
|
|
683
698
|
conversationKind: conv.kind === "eval" ? "eval" : conv.kind === "subagent" ? "subagent" : "chat",
|
|
@@ -701,6 +716,10 @@ let RunWorker = class RunWorker {
|
|
|
701
716
|
});
|
|
702
717
|
return "finished";
|
|
703
718
|
}
|
|
719
|
+
finally {
|
|
720
|
+
// the execution here ended: what this process held of the run's drafts goes
|
|
721
|
+
this.drafts.release(runId);
|
|
722
|
+
}
|
|
704
723
|
if (state.abandoned)
|
|
705
724
|
return "abandoned";
|
|
706
725
|
// 锁在运行中丢失:无论 loop 返回什么都不写终态,任务回到队列由持锁者续跑。
|
|
@@ -814,6 +833,14 @@ let RunWorker = class RunWorker {
|
|
|
814
833
|
const agent = saved !== undefined
|
|
815
834
|
? effectiveDefinition(saved, await readSelection(t, conversationId))
|
|
816
835
|
: current;
|
|
836
|
+
// a wake run's boundary is a finished background task (background Bash §3) or a sub-agent's
|
|
837
|
+
// delivery (agent map spec §5.3), not a message
|
|
838
|
+
const boundary = await t
|
|
839
|
+
.selectFrom("conversation_events")
|
|
840
|
+
.select("type")
|
|
841
|
+
.where("conversation_id", "=", conversationId)
|
|
842
|
+
.where("seq", "=", run.trigger_seq)
|
|
843
|
+
.executeTakeFirst();
|
|
817
844
|
const [ev] = await this.eventLog.appendIn(conversationId, [
|
|
818
845
|
{
|
|
819
846
|
type: "run_started",
|
|
@@ -823,6 +850,14 @@ let RunWorker = class RunWorker {
|
|
|
823
850
|
agentVersion: run.agent_version,
|
|
824
851
|
model: agent.model,
|
|
825
852
|
triggerAccountId: run.trigger_account_id,
|
|
853
|
+
...(boundary?.type === "background_task_finished" && {
|
|
854
|
+
trigger: "background_task",
|
|
855
|
+
triggerSeq: Number(run.trigger_seq),
|
|
856
|
+
}),
|
|
857
|
+
...(boundary?.type === "subagent_delivery" && {
|
|
858
|
+
trigger: "subagent",
|
|
859
|
+
triggerSeq: Number(run.trigger_seq),
|
|
860
|
+
}),
|
|
826
861
|
},
|
|
827
862
|
},
|
|
828
863
|
]);
|
|
@@ -914,7 +949,8 @@ RunWorker = __decorate([
|
|
|
914
949
|
__param(18, Inject(ToolPipeline)),
|
|
915
950
|
__param(19, Inject(RunFinish)),
|
|
916
951
|
__param(20, Inject(TransactionHost)),
|
|
917
|
-
__param(21,
|
|
918
|
-
__param(
|
|
952
|
+
__param(21, Inject(RunDrafts)),
|
|
953
|
+
__param(22, Optional()),
|
|
954
|
+
__param(22, Inject(RUN_HOOKS))
|
|
919
955
|
], RunWorker);
|
|
920
956
|
export { RunWorker };
|
|
@@ -5,6 +5,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { Module } from "@nestjs/common";
|
|
8
|
+
import { BackgroundModule } from "../background/background.module.js";
|
|
9
|
+
import { BackgroundWake } from "../background/wake.js";
|
|
8
10
|
import { ConversationAccessModule } from "../conversations/access.js";
|
|
9
11
|
import { AttachmentsModule } from "../conversations/attachments.module.js";
|
|
10
12
|
import { EventLogModule } from "../conversations/event-log.js";
|
|
@@ -23,12 +25,13 @@ import { MAINTENANCE_QUEUE_NAME } from "./maintenance-queue.js";
|
|
|
23
25
|
import { ProvidersModule } from "./providers.js";
|
|
24
26
|
import { EVAL_QUOTA, EVAL_QUOTA_PREFIX, OrgQuota, RUN_QUOTA, RUN_QUOTA_PREFIX } from "./quota.js";
|
|
25
27
|
import { RunControl } from "./run-control.js";
|
|
28
|
+
import { RunDrafts } from "./run-drafts.js";
|
|
26
29
|
import { RunFinish } from "./run-finish.js";
|
|
27
30
|
import { RunJobsModule } from "./run-jobs.js";
|
|
28
31
|
import { RunQueue } from "./run-queue.js";
|
|
29
32
|
import { AgentLoops, RunSteps } from "./run-steps.js";
|
|
30
33
|
import { RunWorker } from "./run-worker.js";
|
|
31
|
-
import {
|
|
34
|
+
import { StepLogModule } from "./step-log.js";
|
|
32
35
|
import { ConversationStreams } from "./stream.js";
|
|
33
36
|
import { SubagentsModule } from "./subagents/subagents.service.js";
|
|
34
37
|
import { UsageReportModule } from "./usage-report.js";
|
|
@@ -58,6 +61,8 @@ RuntimeModule = __decorate([
|
|
|
58
61
|
SubagentsModule,
|
|
59
62
|
UsageReportModule,
|
|
60
63
|
TitlesModule,
|
|
64
|
+
StepLogModule,
|
|
65
|
+
BackgroundModule,
|
|
61
66
|
// the producer side of `wait-timeout` jobs (`MaintenanceProcessor` consumes them)
|
|
62
67
|
QueueModule.registerQueue(MAINTENANCE_QUEUE_NAME),
|
|
63
68
|
],
|
|
@@ -67,14 +72,16 @@ RuntimeModule = __decorate([
|
|
|
67
72
|
RunAbort,
|
|
68
73
|
KyselyCheckpointSaver,
|
|
69
74
|
RunFinish,
|
|
70
|
-
StepLog,
|
|
71
75
|
RunQueue,
|
|
72
76
|
Waits,
|
|
73
77
|
DecisionResumer,
|
|
74
78
|
RunControl,
|
|
79
|
+
RunDrafts,
|
|
75
80
|
AgentLoops,
|
|
76
81
|
RunSteps,
|
|
77
82
|
RunWorker,
|
|
83
|
+
// a finished background task wakes an idle conversation (background Bash spec §3)
|
|
84
|
+
BackgroundWake,
|
|
78
85
|
// one quota per key prefix (the org run quota, the org eval quota)
|
|
79
86
|
{
|
|
80
87
|
provide: RUN_QUOTA,
|
|
@@ -93,10 +100,11 @@ RuntimeModule = __decorate([
|
|
|
93
100
|
RunAbort,
|
|
94
101
|
KyselyCheckpointSaver,
|
|
95
102
|
RunFinish,
|
|
96
|
-
|
|
103
|
+
StepLogModule,
|
|
97
104
|
RunQueue,
|
|
98
105
|
Waits,
|
|
99
106
|
RunControl,
|
|
107
|
+
RunDrafts,
|
|
100
108
|
AgentLoops,
|
|
101
109
|
RunSteps,
|
|
102
110
|
RunWorker,
|
|
@@ -19,11 +19,16 @@ export declare class StepLog {
|
|
|
19
19
|
constructor(kdb: KernelDb, eventLog: EventLog, txHost: TransactionHost);
|
|
20
20
|
/**
|
|
21
21
|
* Appends events of a sub-agent's run and adds the tokens of the usage events it newly wrote to
|
|
22
|
-
* the
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* the `subagent_tokens_used` of the tree's budget run (sub-agents spec §8.3, agent map spec §6:
|
|
23
|
+
* the whole tree counts on one run): `counter.budgetRunId`, the run's own window
|
|
24
|
+
* (`SubagentParent.budgetRunId`), else the parent run's ({@link budgetRunOf}). A usage event
|
|
25
|
+
* already in the log (an idempotent hit after a crash) adds nothing, so each call counts exactly
|
|
26
|
+
* once. Returns what was written (hits included) and the highest new seq (null: nothing new).
|
|
25
27
|
*/
|
|
26
|
-
appendCounted(conversationId: string,
|
|
28
|
+
appendCounted(conversationId: string, counter: {
|
|
29
|
+
parentRunId: string;
|
|
30
|
+
budgetRunId?: string | undefined;
|
|
31
|
+
}, events: AppendEvent[]): Promise<{
|
|
27
32
|
written: ConversationEvent[];
|
|
28
33
|
toSeq: number | null;
|
|
29
34
|
}>;
|
|
@@ -38,3 +43,9 @@ export declare class StepLog {
|
|
|
38
43
|
spec: ToolSpec;
|
|
39
44
|
}[], events: AppendEvent[]): Promise<ConversationEvent[]>;
|
|
40
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* The step writes ({@link StepLog}): a module of its own, so the tools domain (the `WebFetch`
|
|
48
|
+
* extraction's usage and denials) uses them without importing the runtime.
|
|
49
|
+
*/
|
|
50
|
+
export declare class StepLogModule {
|
|
51
|
+
}
|
package/dist/runtime/step-log.js
CHANGED
|
@@ -7,15 +7,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
8
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
9
|
};
|
|
10
|
-
import { Inject, Injectable } from "@nestjs/common";
|
|
10
|
+
import { Inject, Injectable, Module } from "@nestjs/common";
|
|
11
11
|
import { sql } from "kysely";
|
|
12
|
-
import { EventLog } from "../conversations/event-log.js";
|
|
12
|
+
import { EventLog, EventLogModule } from "../conversations/event-log.js";
|
|
13
13
|
import { usageTokens } from "../evals/budget.js";
|
|
14
14
|
import { audit } from "../identity/audit.js";
|
|
15
15
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
16
16
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
17
17
|
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
18
18
|
import { recordToolSpecs } from "../tools/specs.js";
|
|
19
|
+
import { budgetRunOf } from "./subagents/limits.js";
|
|
19
20
|
/**
|
|
20
21
|
* The writes of a run step that go to the event log together with another row, each in a
|
|
21
22
|
* transaction of its own (the caller notifies the log after the commit): a model call with the
|
|
@@ -33,11 +34,13 @@ let StepLog = class StepLog {
|
|
|
33
34
|
}
|
|
34
35
|
/**
|
|
35
36
|
* Appends events of a sub-agent's run and adds the tokens of the usage events it newly wrote to
|
|
36
|
-
* the
|
|
37
|
-
*
|
|
38
|
-
*
|
|
37
|
+
* the `subagent_tokens_used` of the tree's budget run (sub-agents spec §8.3, agent map spec §6:
|
|
38
|
+
* the whole tree counts on one run): `counter.budgetRunId`, the run's own window
|
|
39
|
+
* (`SubagentParent.budgetRunId`), else the parent run's ({@link budgetRunOf}). A usage event
|
|
40
|
+
* already in the log (an idempotent hit after a crash) adds nothing, so each call counts exactly
|
|
41
|
+
* once. Returns what was written (hits included) and the highest new seq (null: nothing new).
|
|
39
42
|
*/
|
|
40
|
-
async appendCounted(conversationId,
|
|
43
|
+
async appendCounted(conversationId, counter, events) {
|
|
41
44
|
const t = this.kdb.db;
|
|
42
45
|
// the conversation row lock the append takes anyway, taken first to read the seq before it
|
|
43
46
|
const before = await t
|
|
@@ -56,7 +59,7 @@ let StepLog = class StepLog {
|
|
|
56
59
|
await t
|
|
57
60
|
.updateTable("runs")
|
|
58
61
|
.set({ subagent_tokens_used: sql `subagent_tokens_used + ${tokens}` })
|
|
59
|
-
.where("id", "=", parentRunId)
|
|
62
|
+
.where("id", "=", counter.budgetRunId ?? (await budgetRunOf(t, counter.parentRunId)))
|
|
60
63
|
.execute();
|
|
61
64
|
}
|
|
62
65
|
return { written, toSeq: fresh.length > 0 ? Math.max(...fresh.map((e) => e.seq)) : null };
|
|
@@ -92,3 +95,17 @@ StepLog = __decorate([
|
|
|
92
95
|
__param(2, Inject(TransactionHost))
|
|
93
96
|
], StepLog);
|
|
94
97
|
export { StepLog };
|
|
98
|
+
/**
|
|
99
|
+
* The step writes ({@link StepLog}): a module of its own, so the tools domain (the `WebFetch`
|
|
100
|
+
* extraction's usage and denials) uses them without importing the runtime.
|
|
101
|
+
*/
|
|
102
|
+
let StepLogModule = class StepLogModule {
|
|
103
|
+
};
|
|
104
|
+
StepLogModule = __decorate([
|
|
105
|
+
Module({
|
|
106
|
+
imports: [EventLogModule],
|
|
107
|
+
providers: [StepLog],
|
|
108
|
+
exports: [StepLog],
|
|
109
|
+
})
|
|
110
|
+
], StepLogModule);
|
|
111
|
+
export { StepLogModule };
|
|
@@ -1,18 +1,27 @@
|
|
|
1
|
+
import type { Logger } from "@capybara-hq/plugin-sdk";
|
|
1
2
|
import type { FastifyReply, FastifyRequest } from "fastify";
|
|
2
3
|
import { z } from "zod";
|
|
4
|
+
import { ConversationAccess } from "../conversations/access.js";
|
|
3
5
|
import { ConversationsService } from "../conversations/conversations.service.js";
|
|
4
6
|
import { ApiTokenService } from "../identity/api-tokens.js";
|
|
5
7
|
import { type Principal } from "../identity/principal.js";
|
|
6
8
|
import { SessionService } from "../identity/sessions.js";
|
|
7
9
|
import { type OrgContext } from "../orgs/org.guard.js";
|
|
10
|
+
import { type RunDraft, RunDrafts } from "./run-drafts.js";
|
|
8
11
|
import { ConversationStreams } from "./stream.js";
|
|
9
12
|
declare const StreamQuery: z.ZodObject<{
|
|
10
13
|
after: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
11
14
|
}, z.core.$strip>;
|
|
15
|
+
declare const DraftParams: z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
runId: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
12
19
|
/**
|
|
13
20
|
* 会话事件流(SSE):`GET /api/v1/orgs/:orgId/conversations/:id/stream?after=<seq>`,`agents.use`,只有会话所有者可用。
|
|
14
21
|
* - 打开时不阻塞地调用一次 ensureRun(`ConversationsService.kickRun`),停在「运行中」的孤儿运行由此被清理;
|
|
15
22
|
* - 先订阅会话频道、再回放 `after`(或优先的 `Last-Event-ID`)之后的事件:`id: <seq>` / `event: event`;
|
|
23
|
+
* - after that catch-up, one `event: draft` (`data: {"runId","step","text","thinking"}`) per step of
|
|
24
|
+
* the running run whose `assistant_message` is not logged (live drafts, spec 2026-11-07 §3.2);
|
|
16
25
|
* 之后收到 `events` 通知就补读新事件(按 seq 去重),收到增量就发 `event: delta`,收到界面刷新
|
|
17
26
|
* (插件 `ctx.ui.invalidate`)就发 `event: ui`(`data: {"plugin","contribution"}`);
|
|
18
27
|
* - 每 `runtime.sseHeartbeatMs` 发 `: ping` 注释;每 `runtime.sseRecheckMs` 复核凭据(会话未吊销 / 令牌仍有效,
|
|
@@ -25,7 +34,20 @@ export declare class ConversationStreamController {
|
|
|
25
34
|
private readonly sessions;
|
|
26
35
|
private readonly tokens;
|
|
27
36
|
private readonly conversations;
|
|
28
|
-
|
|
37
|
+
private readonly access;
|
|
38
|
+
private readonly drafts;
|
|
39
|
+
private readonly log;
|
|
40
|
+
constructor(streams: ConversationStreams, sessions: SessionService, tokens: ApiTokenService, conversations: ConversationsService, access: ConversationAccess, drafts: RunDrafts, log: Pick<Logger, "warn">);
|
|
41
|
+
/**
|
|
42
|
+
* The live drafts of one run (spec 2026-11-07 §3.2): `{ drafts: { step, text, thinking }[] }`,
|
|
43
|
+
* the steps still streaming whose `assistant_message` is not logged (none once the run is no
|
|
44
|
+
* longer running). What a stream client asks for when a delta's `offset` is past its draft.
|
|
45
|
+
* The stream's access rule (the conversation is visible to the viewer, else 404
|
|
46
|
+
* `conversation.not_found`); a run not of this conversation → 404 `run.not_found`.
|
|
47
|
+
*/
|
|
48
|
+
draft(principal: Principal, org: OrgContext, params: z.infer<typeof DraftParams>): Promise<{
|
|
49
|
+
drafts: RunDraft[];
|
|
50
|
+
}>;
|
|
29
51
|
stream(principal: Principal, org: OrgContext, id: string, q: z.infer<typeof StreamQuery>, lastEventId: string | undefined, req: FastifyRequest, reply: FastifyReply): Promise<void>;
|
|
30
52
|
}
|
|
31
53
|
export {};
|
|
@@ -9,15 +9,18 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
9
9
|
};
|
|
10
10
|
import { Controller, Get, Headers, Inject, Param, Req, Res } from "@nestjs/common";
|
|
11
11
|
import { z } from "zod";
|
|
12
|
+
import { ConversationAccess } from "../conversations/access.js";
|
|
12
13
|
import { ConversationsService } from "../conversations/conversations.service.js";
|
|
13
14
|
import { ApiError } from "../errors.js";
|
|
14
15
|
import { ApiTokenService } from "../identity/api-tokens.js";
|
|
15
16
|
import { credentialCheck } from "../identity/credential-check.js";
|
|
16
17
|
import { CurrentPrincipal, requireUser } from "../identity/principal.js";
|
|
17
18
|
import { SessionService } from "../identity/sessions.js";
|
|
19
|
+
import { KERNEL_LOGGER } from "../infra/tokens.js";
|
|
18
20
|
import { createZodDto } from "../infra/validation/create-zod-dto.js";
|
|
19
|
-
import { ZQuery } from "../infra/validation/zod-params.js";
|
|
21
|
+
import { ZParam, ZQuery } from "../infra/validation/zod-params.js";
|
|
20
22
|
import { CurrentOrg, OrgAction } from "../orgs/org.guard.js";
|
|
23
|
+
import { RunDrafts } from "./run-drafts.js";
|
|
21
24
|
import { ConversationStreams } from "./stream.js";
|
|
22
25
|
const BEARER_RE = /^Bearer\s+(\S+)$/i;
|
|
23
26
|
const StreamQuery = z.object({
|
|
@@ -32,12 +35,20 @@ function parseLastEventId(v) {
|
|
|
32
35
|
}
|
|
33
36
|
return n;
|
|
34
37
|
}
|
|
38
|
+
const DraftParams = z.object({
|
|
39
|
+
id: z.string().min(1).max(100),
|
|
40
|
+
runId: z.string().min(1).max(100),
|
|
41
|
+
});
|
|
35
42
|
class ConversationStreamQueryDto extends createZodDto(StreamQuery, "ConversationStreamQuery") {
|
|
36
43
|
}
|
|
44
|
+
class RunDraftParamsDto extends createZodDto(DraftParams, "RunDraftParams") {
|
|
45
|
+
}
|
|
37
46
|
/**
|
|
38
47
|
* 会话事件流(SSE):`GET /api/v1/orgs/:orgId/conversations/:id/stream?after=<seq>`,`agents.use`,只有会话所有者可用。
|
|
39
48
|
* - 打开时不阻塞地调用一次 ensureRun(`ConversationsService.kickRun`),停在「运行中」的孤儿运行由此被清理;
|
|
40
49
|
* - 先订阅会话频道、再回放 `after`(或优先的 `Last-Event-ID`)之后的事件:`id: <seq>` / `event: event`;
|
|
50
|
+
* - after that catch-up, one `event: draft` (`data: {"runId","step","text","thinking"}`) per step of
|
|
51
|
+
* the running run whose `assistant_message` is not logged (live drafts, spec 2026-11-07 §3.2);
|
|
41
52
|
* 之后收到 `events` 通知就补读新事件(按 seq 去重),收到增量就发 `event: delta`,收到界面刷新
|
|
42
53
|
* (插件 `ctx.ui.invalidate`)就发 `event: ui`(`data: {"plugin","contribution"}`);
|
|
43
54
|
* - 每 `runtime.sseHeartbeatMs` 发 `: ping` 注释;每 `runtime.sseRecheckMs` 复核凭据(会话未吊销 / 令牌仍有效,
|
|
@@ -50,11 +61,47 @@ let ConversationStreamController = class ConversationStreamController {
|
|
|
50
61
|
sessions;
|
|
51
62
|
tokens;
|
|
52
63
|
conversations;
|
|
53
|
-
|
|
64
|
+
access;
|
|
65
|
+
drafts;
|
|
66
|
+
log;
|
|
67
|
+
constructor(streams, sessions, tokens, conversations, access, drafts, log) {
|
|
54
68
|
this.streams = streams;
|
|
55
69
|
this.sessions = sessions;
|
|
56
70
|
this.tokens = tokens;
|
|
57
71
|
this.conversations = conversations;
|
|
72
|
+
this.access = access;
|
|
73
|
+
this.drafts = drafts;
|
|
74
|
+
this.log = log;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The live drafts of one run (spec 2026-11-07 §3.2): `{ drafts: { step, text, thinking }[] }`,
|
|
78
|
+
* the steps still streaming whose `assistant_message` is not logged (none once the run is no
|
|
79
|
+
* longer running). What a stream client asks for when a delta's `offset` is past its draft.
|
|
80
|
+
* The stream's access rule (the conversation is visible to the viewer, else 404
|
|
81
|
+
* `conversation.not_found`); a run not of this conversation → 404 `run.not_found`.
|
|
82
|
+
*/
|
|
83
|
+
async draft(principal, org, params) {
|
|
84
|
+
const p = requireUser(principal);
|
|
85
|
+
if (!(await this.access.isAccessible(org.orgId, params.id, p.account.id))) {
|
|
86
|
+
throw new ApiError("conversation.not_found", "Conversation not found");
|
|
87
|
+
}
|
|
88
|
+
if (!(await this.drafts.runOf(params.id, params.runId))) {
|
|
89
|
+
throw new ApiError("run.not_found", "Run not found");
|
|
90
|
+
}
|
|
91
|
+
let live;
|
|
92
|
+
try {
|
|
93
|
+
live = await this.drafts.live(params.id, params.runId);
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
// a convenience, like the stream's: no drafts rather than an error (the log stays the truth)
|
|
97
|
+
this.log.warn("cannot read live drafts", {
|
|
98
|
+
conversationId: params.id,
|
|
99
|
+
runId: params.runId,
|
|
100
|
+
err,
|
|
101
|
+
});
|
|
102
|
+
live = [];
|
|
103
|
+
}
|
|
104
|
+
return { drafts: live.map(({ step, text, thinking }) => ({ step, text, thinking })) };
|
|
58
105
|
}
|
|
59
106
|
async stream(principal, org, id, q, lastEventId, req, reply) {
|
|
60
107
|
const p = requireUser(principal);
|
|
@@ -103,6 +150,13 @@ let ConversationStreamController = class ConversationStreamController {
|
|
|
103
150
|
handle.begin();
|
|
104
151
|
}
|
|
105
152
|
};
|
|
153
|
+
__decorate([
|
|
154
|
+
Get(":id/runs/:runId/draft"),
|
|
155
|
+
OrgAction("agents.use"),
|
|
156
|
+
__param(0, CurrentPrincipal()),
|
|
157
|
+
__param(1, CurrentOrg()),
|
|
158
|
+
__param(2, ZParam(RunDraftParamsDto))
|
|
159
|
+
], ConversationStreamController.prototype, "draft", null);
|
|
106
160
|
__decorate([
|
|
107
161
|
Get(":id/stream"),
|
|
108
162
|
OrgAction("agents.use"),
|
|
@@ -119,6 +173,9 @@ ConversationStreamController = __decorate([
|
|
|
119
173
|
__param(0, Inject(ConversationStreams)),
|
|
120
174
|
__param(1, Inject(SessionService)),
|
|
121
175
|
__param(2, Inject(ApiTokenService)),
|
|
122
|
-
__param(3, Inject(ConversationsService))
|
|
176
|
+
__param(3, Inject(ConversationsService)),
|
|
177
|
+
__param(4, Inject(ConversationAccess)),
|
|
178
|
+
__param(5, Inject(RunDrafts)),
|
|
179
|
+
__param(6, Inject(KERNEL_LOGGER))
|
|
123
180
|
], ConversationStreamController);
|
|
124
181
|
export { ConversationStreamController };
|
package/dist/runtime/stream.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { EventLog } from "../conversations/event-log.js";
|
|
|
4
4
|
import type { CredentialCheck } from "../identity/credential-check.js";
|
|
5
5
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
6
6
|
import { GracefulShutdown } from "../infra/lifecycle/graceful-shutdown.service.js";
|
|
7
|
+
import { type LiveDraft, RunDrafts } from "./run-drafts.js";
|
|
7
8
|
/** 一次 SSE 连接的输出端(由 HTTP 层包装原始响应)。 */
|
|
8
9
|
export interface SseOutput {
|
|
9
10
|
write(chunk: string): void;
|
|
@@ -25,6 +26,8 @@ export interface ConversationStreamsDeps {
|
|
|
25
26
|
access(orgId: string, conversationId: string, viewerAccountId: string): Promise<boolean>;
|
|
26
27
|
config: Pick<KernelConfigService, "get">;
|
|
27
28
|
log: Pick<Logger, "warn">;
|
|
29
|
+
/** The live drafts of the conversation's running run (sent once, after the open catch-up). */
|
|
30
|
+
drafts(conversationId: string): Promise<LiveDraft[]>;
|
|
28
31
|
}
|
|
29
32
|
export interface StreamParams {
|
|
30
33
|
orgId: string;
|
|
@@ -60,7 +63,7 @@ export declare class ConversationStreams {
|
|
|
60
63
|
* an event stream. Without `GracefulShutdown` (a standalone HTTP application, tests only) the
|
|
61
64
|
* streams end with their connections.
|
|
62
65
|
*/
|
|
63
|
-
constructor(eventLog: Pick<EventLog, "readAfter">, bus: StreamBus, access: Pick<ConversationAccess, "isAccessible">, config: Pick<KernelConfigService, "get">, log: Pick<Logger, "warn">, shutdown?: Pick<GracefulShutdown, "signal">);
|
|
66
|
+
constructor(eventLog: Pick<EventLog, "readAfter">, bus: StreamBus, access: Pick<ConversationAccess, "isAccessible">, config: Pick<KernelConfigService, "get">, log: Pick<Logger, "warn">, drafts: Pick<RunDrafts, "live">, shutdown?: Pick<GracefulShutdown, "signal">);
|
|
64
67
|
/**
|
|
65
68
|
* 复核凭据与可见性,并先订阅会话频道(之后再回放,避免遗漏两者之间提交的事件)。
|
|
66
69
|
* 凭据失效 → 对应的 `auth.*`;不可见 → `conversation.not_found`;订阅失败照常抛出。此时尚未写任何响应,调用方可以按普通错误返回。
|