@capybara-hq/kernel 0.1.0-rc.4 → 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 +39 -13
- package/dist/admin/admin.controller.js +33 -17
- package/dist/admin/extensions.controller.d.ts +16 -2
- package/dist/admin/extensions.controller.js +26 -6
- 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 +16 -0
- package/dist/agents/agent-lookup.js +11 -0
- package/dist/agents/agents.controller.d.ts +76 -1
- package/dist/agents/agents.controller.js +90 -11
- package/dist/agents/agents.module.d.ts +4 -1
- package/dist/agents/agents.module.js +32 -6
- package/dist/agents/agents.service.d.ts +51 -22
- package/dist/agents/agents.service.js +172 -70
- package/dist/agents/definition.d.ts +49 -0
- package/dist/agents/definition.js +45 -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/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/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 +475 -52
- package/dist/background/background.module.js +8 -1
- package/dist/background/finish.d.ts +3 -2
- package/dist/background/launch-lock.d.ts +4 -3
- package/dist/background/launch-lock.js +4 -3
- package/dist/background/poll.job.d.ts +9 -6
- package/dist/background/poll.job.js +30 -22
- package/dist/background/session.d.ts +13 -2
- package/dist/background/session.js +13 -0
- package/dist/background/stop.d.ts +12 -6
- package/dist/background/stop.js +57 -39
- package/dist/background/store.d.ts +18 -6
- package/dist/background/store.js +12 -6
- package/dist/background/tasks.service.d.ts +15 -5
- package/dist/background/tasks.service.js +42 -17
- package/dist/background/wake-rules.d.ts +27 -18
- package/dist/background/wake-rules.js +52 -22
- package/dist/background/wake.d.ts +13 -11
- package/dist/background/wake.js +20 -14
- 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/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 +622 -82
- 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 +1147 -1136
- 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 +20 -2
- package/dist/channels/channels.module.js +2 -0
- 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/config/docs.js +3 -1
- package/dist/config/schema.d.ts +6 -2
- package/dist/config/schema.js +46 -22
- package/dist/conversations/access.d.ts +6 -4
- package/dist/conversations/access.js +27 -5
- package/dist/conversations/agent-tree.d.ts +46 -0
- package/dist/conversations/agent-tree.js +92 -0
- package/dist/conversations/conversations.controller.d.ts +43 -18
- package/dist/conversations/conversations.controller.js +79 -38
- package/dist/conversations/conversations.module.d.ts +1 -1
- package/dist/conversations/conversations.module.js +7 -7
- package/dist/conversations/conversations.service.d.ts +69 -12
- package/dist/conversations/conversations.service.js +106 -27
- package/dist/conversations/environment-status.d.ts +24 -0
- package/dist/conversations/environment-status.js +71 -0
- package/dist/conversations/event-log.d.ts +20 -5
- package/dist/conversations/event-log.js +60 -0
- package/dist/conversations/events.d.ts +84 -2
- package/dist/conversations/events.js +91 -17
- package/dist/conversations/queue.service.d.ts +1 -1
- package/dist/conversations/queue.service.js +5 -0
- package/dist/conversations/titles.d.ts +5 -3
- package/dist/conversations/titles.js +21 -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 +362 -18
- 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 +82 -2
- package/dist/errors.js +82 -2
- package/dist/evals/reconstruct.d.ts +18 -9
- package/dist/evals/reconstruct.js +26 -7
- package/dist/evals/run-replay.d.ts +4 -2
- package/dist/evals/run-replay.js +16 -4
- package/dist/evals/step-replay.d.ts +2 -5
- package/dist/evals/step-replay.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 +65 -42
- package/dist/extensions/admin-view.d.ts +37 -10
- package/dist/extensions/admin-view.js +103 -20
- 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/deployment-config.d.ts +28 -5
- package/dist/extensions/deployment-config.js +48 -7
- package/dist/extensions/effective-config.d.ts +127 -0
- package/dist/extensions/effective-config.js +368 -0
- package/dist/extensions/extensions.module.js +8 -2
- package/dist/extensions/hooks.d.ts +37 -4
- package/dist/extensions/hooks.js +82 -16
- package/dist/extensions/host.d.ts +19 -1
- package/dist/extensions/host.js +30 -7
- package/dist/extensions/installs.d.ts +20 -8
- package/dist/extensions/installs.js +37 -15
- package/dist/extensions/org-config.d.ts +75 -6
- package/dist/extensions/org-config.js +184 -32
- 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/permission-view.d.ts +16 -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.d.ts +12 -5
- package/dist/extensions/point-defaults.js +37 -9
- 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 +23 -3
- package/dist/http/app.d.ts +11 -2
- package/dist/http/app.js +31 -5
- 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.guard.d.ts +13 -5
- package/dist/identity/auth.guard.js +26 -9
- package/dist/identity/identity.module.d.ts +1 -1
- package/dist/identity/identity.module.js +4 -4
- package/dist/identity/me.controller.js +1 -1
- package/dist/identity/principal.d.ts +3 -3
- package/dist/identity/principal.js +3 -3
- 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 +1 -1
- package/dist/index.js +1 -1
- package/dist/infra/cli/kernel-cli.module.js +9 -1
- package/dist/infra/config/kernel-config.service.js +21 -1
- 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 +11 -2
- package/dist/infra/queue/add-job-once.d.ts +14 -0
- package/dist/infra/queue/add-job-once.js +16 -0
- 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/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 +20 -9
- package/dist/models/purposes.js +17 -8
- package/dist/orgs/directory-sync.d.ts +14 -5
- package/dist/orgs/directory-sync.js +41 -17
- package/dist/orgs/offboarding.d.ts +9 -7
- package/dist/orgs/offboarding.js +28 -17
- 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 +15 -3
- package/dist/orgs/settings.service.js +6 -2
- 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 +9 -1
- package/dist/runtime/context/build.d.ts +6 -4
- package/dist/runtime/context/build.js +26 -7
- package/dist/runtime/context/claude-tools.d.ts +2 -1
- package/dist/runtime/context/claude-tools.js +5 -4
- package/dist/runtime/context/compaction.js +9 -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 +35 -17
- package/dist/runtime/loop.d.ts +32 -4
- package/dist/runtime/maintenance.d.ts +7 -4
- package/dist/runtime/maintenance.js +23 -8
- package/dist/runtime/model-call.d.ts +30 -8
- package/dist/runtime/model-call.js +69 -19
- 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 +37 -3
- package/dist/runtime/run-queue.js +188 -11
- package/dist/runtime/run-worker.d.ts +11 -5
- package/dist/runtime/run-worker.js +54 -31
- package/dist/runtime/runtime.module.js +3 -0
- package/dist/runtime/step-log.d.ts +9 -4
- package/dist/runtime/step-log.js +8 -5
- 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 +43 -29
- 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.js +17 -12
- package/dist/runtime/waits.d.ts +140 -37
- package/dist/runtime/waits.js +394 -106
- 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 +4 -3
- package/dist/sandbox/sandbox.service.d.ts +229 -134
- package/dist/sandbox/sandbox.service.js +630 -409
- 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 +23 -4
- package/dist/tools/builtin-names.d.ts +21 -5
- package/dist/tools/builtin-names.js +30 -5
- 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 +6 -2
- package/dist/tools/builtins/builtin-tools.js +37 -12
- 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.js +13 -3
- package/dist/tools/builtins/sandbox/common.d.ts +43 -24
- package/dist/tools/builtins/sandbox/common.js +80 -45
- 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 +1 -1
- package/dist/tools/builtins/sandbox/index.js +1 -1
- package/dist/tools/builtins/sandbox/read.js +1 -1
- package/dist/tools/builtins/sandbox/task-output.d.ts +14 -3
- package/dist/tools/builtins/sandbox/task-output.js +30 -5
- package/dist/tools/builtins/sandbox/task-stop.js +2 -1
- 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/extract.js +5 -1
- package/dist/tools/builtins/web/fetch.js +1 -0
- package/dist/tools/builtins/web/search.js +1 -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/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 +187 -364
- package/dist/tools/policy.d.ts +1 -1
- package/dist/tools/policy.js +36 -16
- package/dist/tools/registry.d.ts +98 -5
- package/dist/tools/registry.js +87 -9
- package/dist/tools/tools.module.js +12 -2
- package/dist/ui/views.d.ts +2 -1
- package/dist/ui/views.js +17 -3
- package/package.json +3 -3
- 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 -32
- package/dist/extensions/org-config.controller.js +0 -70
|
@@ -132,6 +132,19 @@ export declare const ToolViewSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
132
132
|
}, z.core.$strip>>;
|
|
133
133
|
}, z.core.$strip>], "kind">;
|
|
134
134
|
export type ToolView = z.infer<typeof ToolViewSchema>;
|
|
135
|
+
/**
|
|
136
|
+
* How a sub-agent's run ended (`subagent_finished`, a `subagent_delivery` finish). `timed_out`:
|
|
137
|
+
* stopped by the parent's sub-agents wait timeout (`run_aborted.detail`).
|
|
138
|
+
*/
|
|
139
|
+
export declare const SubagentFinishStatusSchema: z.ZodEnum<{
|
|
140
|
+
aborted: "aborted";
|
|
141
|
+
budget: "budget";
|
|
142
|
+
completed: "completed";
|
|
143
|
+
failed: "failed";
|
|
144
|
+
max_duration: "max_duration";
|
|
145
|
+
max_steps: "max_steps";
|
|
146
|
+
timed_out: "timed_out";
|
|
147
|
+
}>;
|
|
135
148
|
/**
|
|
136
149
|
* 会话事件(`type` + `payload`)的判别联合。事件日志只追加,写入前用它校验 payload;
|
|
137
150
|
* 读出时按写入时的形状原样返回。
|
|
@@ -223,6 +236,10 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
223
236
|
parentConversationId: z.ZodString;
|
|
224
237
|
parentRunId: z.ZodString;
|
|
225
238
|
callId: z.ZodString;
|
|
239
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
240
|
+
message: "message";
|
|
241
|
+
task: "task";
|
|
242
|
+
}>>;
|
|
226
243
|
narrowed: z.ZodOptional<z.ZodObject<{
|
|
227
244
|
tools: z.ZodArray<z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
228
245
|
kind: z.ZodLiteral<"builtin">;
|
|
@@ -275,6 +292,7 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
275
292
|
trigger: z.ZodOptional<z.ZodEnum<{
|
|
276
293
|
background_task: "background_task";
|
|
277
294
|
message: "message";
|
|
295
|
+
subagent: "subagent";
|
|
278
296
|
}>>;
|
|
279
297
|
triggerSeq: z.ZodOptional<z.ZodNumber>;
|
|
280
298
|
}, z.core.$strip>;
|
|
@@ -421,6 +439,13 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
421
439
|
step: z.ZodNumber;
|
|
422
440
|
text: z.ZodString;
|
|
423
441
|
}, z.core.$strip>;
|
|
442
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
443
|
+
type: z.ZodLiteral<"tools_changed">;
|
|
444
|
+
payload: z.ZodObject<{
|
|
445
|
+
step: z.ZodNumber;
|
|
446
|
+
added: z.ZodArray<z.ZodString>;
|
|
447
|
+
removed: z.ZodArray<z.ZodString>;
|
|
448
|
+
}, z.core.$strip>;
|
|
424
449
|
}, z.core.$strip>, z.ZodObject<{
|
|
425
450
|
type: z.ZodLiteral<"tool_call_started">;
|
|
426
451
|
payload: z.ZodObject<{
|
|
@@ -663,6 +688,7 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
663
688
|
id: z.ZodOptional<z.ZodString>;
|
|
664
689
|
version: z.ZodOptional<z.ZodNumber>;
|
|
665
690
|
plugin: z.ZodOptional<z.ZodString>;
|
|
691
|
+
platformTemplateId: z.ZodOptional<z.ZodString>;
|
|
666
692
|
invokedSkill: z.ZodOptional<z.ZodObject<{
|
|
667
693
|
id: z.ZodString;
|
|
668
694
|
version: z.ZodNumber;
|
|
@@ -747,6 +773,28 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
747
773
|
}, z.core.$strict>>>;
|
|
748
774
|
dispatchable: z.ZodOptional<z.ZodBoolean>;
|
|
749
775
|
}, z.core.$strict>>;
|
|
776
|
+
pendingConnectors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
777
|
+
key: z.ZodString;
|
|
778
|
+
label: z.ZodString;
|
|
779
|
+
source: z.ZodUnion<readonly [z.ZodObject<{
|
|
780
|
+
template: z.ZodString;
|
|
781
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
782
|
+
needs: z.ZodObject<{
|
|
783
|
+
protocol: z.ZodEnum<{
|
|
784
|
+
mcp: "mcp";
|
|
785
|
+
openapi: "openapi";
|
|
786
|
+
}>;
|
|
787
|
+
endpoint: z.ZodString;
|
|
788
|
+
tools: z.ZodArray<z.ZodString>;
|
|
789
|
+
label: z.ZodString;
|
|
790
|
+
}, z.core.$strict>;
|
|
791
|
+
}, z.core.$strict>]>;
|
|
792
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
793
|
+
policies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
794
|
+
ask: "ask";
|
|
795
|
+
deny: "deny";
|
|
796
|
+
}>>>;
|
|
797
|
+
}, z.core.$strict>>>;
|
|
750
798
|
}, z.core.$strip>;
|
|
751
799
|
preamble: z.ZodString;
|
|
752
800
|
maxSteps: z.ZodNumber;
|
|
@@ -781,6 +829,7 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
781
829
|
}>>>;
|
|
782
830
|
subagentId: z.ZodString;
|
|
783
831
|
childRunId: z.ZodString;
|
|
832
|
+
path: z.ZodArray<z.ZodString>;
|
|
784
833
|
kind: z.ZodEnum<{
|
|
785
834
|
approval: "approval";
|
|
786
835
|
connect: "connect";
|
|
@@ -816,6 +865,35 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
816
865
|
cacheWriteTokens: z.ZodNumber;
|
|
817
866
|
}, z.core.$strip>;
|
|
818
867
|
}, z.core.$strip>;
|
|
868
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
869
|
+
type: z.ZodLiteral<"subagent_delivery">;
|
|
870
|
+
payload: z.ZodObject<{
|
|
871
|
+
subagentId: z.ZodString;
|
|
872
|
+
childRunId: z.ZodString;
|
|
873
|
+
description: z.ZodString;
|
|
874
|
+
kind: z.ZodEnum<{
|
|
875
|
+
finished: "finished";
|
|
876
|
+
note: "note";
|
|
877
|
+
report: "report";
|
|
878
|
+
}>;
|
|
879
|
+
text: z.ZodString;
|
|
880
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
881
|
+
aborted: "aborted";
|
|
882
|
+
budget: "budget";
|
|
883
|
+
completed: "completed";
|
|
884
|
+
failed: "failed";
|
|
885
|
+
max_duration: "max_duration";
|
|
886
|
+
max_steps: "max_steps";
|
|
887
|
+
timed_out: "timed_out";
|
|
888
|
+
}>>;
|
|
889
|
+
handedBack: z.ZodOptional<z.ZodBoolean>;
|
|
890
|
+
errorCode: z.ZodOptional<z.ZodString>;
|
|
891
|
+
abortedBy: z.ZodOptional<z.ZodEnum<{
|
|
892
|
+
parent: "parent";
|
|
893
|
+
user: "user";
|
|
894
|
+
}>>;
|
|
895
|
+
triggerAccountId: z.ZodString;
|
|
896
|
+
}, z.core.$strip>;
|
|
819
897
|
}, z.core.$strip>, z.ZodObject<{
|
|
820
898
|
type: z.ZodLiteral<"skill_fork_result">;
|
|
821
899
|
payload: z.ZodObject<{
|
|
@@ -845,6 +923,7 @@ export declare const ConversationEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
845
923
|
stoppedBy: z.ZodOptional<z.ZodEnum<{
|
|
846
924
|
deletion: "deletion";
|
|
847
925
|
person: "person";
|
|
926
|
+
subagent_end: "subagent_end";
|
|
848
927
|
}>>;
|
|
849
928
|
}, z.core.$strip>;
|
|
850
929
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -907,9 +986,12 @@ export type ConversationEvent = ConversationEventBody & {
|
|
|
907
986
|
runId: string | null;
|
|
908
987
|
createdAt: Date;
|
|
909
988
|
};
|
|
910
|
-
/**
|
|
989
|
+
/**
|
|
990
|
+
* An event a run absorbs at a step boundary: a person's message, a finished background task or a
|
|
991
|
+
* sub-agent's delivery.
|
|
992
|
+
*/
|
|
911
993
|
export type AbsorbableEvent = Extract<ConversationEvent, {
|
|
912
|
-
type: "user_message" | "background_task_finished";
|
|
994
|
+
type: "user_message" | "background_task_finished" | "subagent_delivery";
|
|
913
995
|
}>;
|
|
914
996
|
/**
|
|
915
997
|
* Whether `e` is absorbed like an interjection (spec 2026-11-05-background-bash-design §2.4): the
|
|
@@ -144,6 +144,19 @@ const ModelUsageShape = {
|
|
|
144
144
|
cacheReadTokens: count,
|
|
145
145
|
cacheWriteTokens: count,
|
|
146
146
|
};
|
|
147
|
+
/**
|
|
148
|
+
* How a sub-agent's run ended (`subagent_finished`, a `subagent_delivery` finish). `timed_out`:
|
|
149
|
+
* stopped by the parent's sub-agents wait timeout (`run_aborted.detail`).
|
|
150
|
+
*/
|
|
151
|
+
export const SubagentFinishStatusSchema = z.enum([
|
|
152
|
+
"completed",
|
|
153
|
+
"max_steps",
|
|
154
|
+
"max_duration",
|
|
155
|
+
"budget",
|
|
156
|
+
"aborted",
|
|
157
|
+
"timed_out",
|
|
158
|
+
"failed",
|
|
159
|
+
]);
|
|
147
160
|
/** 双语或纯文本(plugin-sdk `InputForm` 的文案字段)。 */
|
|
148
161
|
const FormTextSchema = z.union([z.string(), z.object({ zh: z.string(), en: z.string() })]);
|
|
149
162
|
/** 交互表单(plugin-sdk 的 `InputForm`;字段 schema 已由 `validateInputForm` 校验过,这里只记形状)。 */
|
|
@@ -213,6 +226,11 @@ export const ConversationEventSchema = z.discriminatedUnion("type", [
|
|
|
213
226
|
parentConversationId: z.string(),
|
|
214
227
|
parentRunId: z.string(),
|
|
215
228
|
callId: z.string(),
|
|
229
|
+
/**
|
|
230
|
+
* `message`: sent by the parent agent with `SendMessage` (agent map spec §5.1); absent or
|
|
231
|
+
* `task`: the task of a dispatch or follow-up.
|
|
232
|
+
*/
|
|
233
|
+
kind: z.enum(["task", "message"]).optional(),
|
|
216
234
|
/**
|
|
217
235
|
* A follow-up (`resume`, final review I1): the frozen tools and org skills intersected
|
|
218
236
|
* with the current version (`narrowFollowUp`); the child's run uses these instead of
|
|
@@ -252,10 +270,14 @@ export const ConversationEventSchema = z.discriminatedUnion("type", [
|
|
|
252
270
|
/**
|
|
253
271
|
* What started the run (display only): absent or `message` = a person's message (or a
|
|
254
272
|
* sub-agent's task), `background_task` = a finished background task woke the conversation
|
|
255
|
-
* (spec 2026-11-05-background-bash-design §3)
|
|
273
|
+
* (spec 2026-11-05-background-bash-design §3), `subagent` = a sub-agent's delivery woke it
|
|
274
|
+
* (agent map spec §5.3).
|
|
275
|
+
*/
|
|
276
|
+
trigger: z.enum(["message", "background_task", "subagent"]).optional(),
|
|
277
|
+
/**
|
|
278
|
+
* A wake run's boundary: the seq of the finish or delivery that woke it (full-run replay
|
|
279
|
+
* seeds from it).
|
|
256
280
|
*/
|
|
257
|
-
trigger: z.enum(["message", "background_task"]).optional(),
|
|
258
|
-
/** A wake run's boundary: the seq of the finish that woke it (full-run replay seeds from it). */
|
|
259
281
|
triggerSeq: seqNo.optional(),
|
|
260
282
|
})),
|
|
261
283
|
ev("model_call", z.object({
|
|
@@ -358,6 +380,13 @@ export const ConversationEventSchema = z.discriminatedUnion("type", [
|
|
|
358
380
|
callId: z.string().optional(),
|
|
359
381
|
})),
|
|
360
382
|
ev("reminder", z.object({ step: count, text: z.string() })),
|
|
383
|
+
/**
|
|
384
|
+
* The step's resolved tool set differs from the one the conversation's previous model request
|
|
385
|
+
* offered (`toolSetChange`): tool names as the model sees them, sorted. Written before that
|
|
386
|
+
* step's request, never before a conversation's first one. **Model-visible**: rendered at its
|
|
387
|
+
* position as a system message (`toolsChangedText`); dropped once a summary covers it.
|
|
388
|
+
*/
|
|
389
|
+
ev("tools_changed", z.object({ step: count, added: z.array(z.string()), removed: z.array(z.string()) })),
|
|
361
390
|
/** 工具调用开始执行之前写入(续跑时「有开始无结果」的调用记为结果未知,不再执行)。 */
|
|
362
391
|
ev("tool_call_started", z.object({ step: count, callId: z.string(), toolKey: z.string(), specHash: z.string() })),
|
|
363
392
|
/**
|
|
@@ -553,6 +582,12 @@ export const ConversationEventSchema = z.discriminatedUnion("type", [
|
|
|
553
582
|
id: z.string().optional(),
|
|
554
583
|
version: z.number().int().positive().optional(),
|
|
555
584
|
plugin: z.string().optional(),
|
|
585
|
+
/**
|
|
586
|
+
* Plugin scope phase 2: the platform template whose content a `plugin` child ran (a
|
|
587
|
+
* platform template, or an org copy linked to one, recorded under the copy's `id`). Absent
|
|
588
|
+
* = the org's own template (and in every older event). Eval metadata, not model-visible.
|
|
589
|
+
*/
|
|
590
|
+
platformTemplateId: z.string().optional(),
|
|
556
591
|
/**
|
|
557
592
|
* Phase D: the child runs a forked skill a person invoked (display and eval metadata, not
|
|
558
593
|
* model-visible).
|
|
@@ -589,10 +624,16 @@ export const ConversationEventSchema = z.discriminatedUnion("type", [
|
|
|
589
624
|
*/
|
|
590
625
|
invokedSeq: seqNo.optional(),
|
|
591
626
|
})),
|
|
592
|
-
/**
|
|
627
|
+
/**
|
|
628
|
+
* Root log (agent map spec §7): a sub-agent `subagentId` of the tree, at any depth, waits for a
|
|
629
|
+
* person (approval, input or a connection). Not model-visible. `path`: the child conversation ids
|
|
630
|
+
* from the root's child down to `subagentId` (`[subagentId]` for a child of the root); logged under
|
|
631
|
+
* the root run that last dispatched the root's child on that path.
|
|
632
|
+
*/
|
|
593
633
|
ev("subagent_waiting", z.object({
|
|
594
634
|
subagentId: z.string(),
|
|
595
635
|
childRunId: z.string(),
|
|
636
|
+
path: z.array(z.string()).min(1).max(16),
|
|
596
637
|
kind: z.enum(["approval", "input", "connect"]),
|
|
597
638
|
approvalId: z.string().optional(),
|
|
598
639
|
questionId: z.string().optional(),
|
|
@@ -606,21 +647,51 @@ export const ConversationEventSchema = z.discriminatedUnion("type", [
|
|
|
606
647
|
subagentId: z.string(),
|
|
607
648
|
childRunId: z.string(),
|
|
608
649
|
callId: z.string(),
|
|
609
|
-
|
|
610
|
-
status: z.enum([
|
|
611
|
-
"completed",
|
|
612
|
-
"max_steps",
|
|
613
|
-
"max_duration",
|
|
614
|
-
"budget",
|
|
615
|
-
"aborted",
|
|
616
|
-
"timed_out",
|
|
617
|
-
"failed",
|
|
618
|
-
]),
|
|
650
|
+
status: SubagentFinishStatusSchema,
|
|
619
651
|
errorCode: z.string().optional(),
|
|
620
652
|
toolCalls: count,
|
|
621
653
|
durationMs: count,
|
|
622
654
|
usage: z.object(ModelUsageShape),
|
|
623
655
|
})),
|
|
656
|
+
/**
|
|
657
|
+
* Parent log (agent map spec §4.5, §5.2): a sub-agent `subagentId` (its child conversation id)
|
|
658
|
+
* handed back a report (`SubagentHandback`), sent a note (`SendMessage to: "parent"`) or its run
|
|
659
|
+
* `childRunId` finished. **Model-visible**: absorbed like an interjection and rendered as a system
|
|
660
|
+
* message (`renderSubagentDelivery`). A finish after a handback carries `text: ""` and
|
|
661
|
+
* `handedBack: true` and renders as one status line, except that a run that handed back and
|
|
662
|
+
* `completed` writes no finished delivery at all (acceptance 2026-11-07; older logs have one and
|
|
663
|
+
* keep rendering it); a finish without a handback carries the child's
|
|
664
|
+
* final reply, a failed finish its error message (`errorCode` the code), an aborted one no text
|
|
665
|
+
* (`abortedBy` who stopped it), with `subagent_finished`'s vocabulary. `status` is present exactly
|
|
666
|
+
* on `kind: "finished"`. `triggerAccountId`: the child run's trigger account, the one a wake runs
|
|
667
|
+
* as (§7).
|
|
668
|
+
*/
|
|
669
|
+
ev("subagent_delivery", z
|
|
670
|
+
.object({
|
|
671
|
+
subagentId: z.string(),
|
|
672
|
+
childRunId: z.string(),
|
|
673
|
+
description: z.string(),
|
|
674
|
+
kind: z.enum(["report", "note", "finished"]),
|
|
675
|
+
text: z.string().max(200_000),
|
|
676
|
+
/** `kind: "finished"` only (required there). */
|
|
677
|
+
status: SubagentFinishStatusSchema.optional(),
|
|
678
|
+
/** `kind: "finished"` only: a report was handed back before the run finished. */
|
|
679
|
+
handedBack: z.boolean().optional(),
|
|
680
|
+
/** `status: "failed"` only: the child run's error code. */
|
|
681
|
+
errorCode: z.string().optional(),
|
|
682
|
+
/** `status: "aborted"` only: a person stopped it, or the kernel on its parent's behalf. */
|
|
683
|
+
abortedBy: z.enum(["user", "parent"]).optional(),
|
|
684
|
+
triggerAccountId: z.string(),
|
|
685
|
+
})
|
|
686
|
+
.superRefine((p, ctx) => {
|
|
687
|
+
if ((p.kind === "finished") !== (p.status !== undefined)) {
|
|
688
|
+
ctx.addIssue({
|
|
689
|
+
code: "custom",
|
|
690
|
+
path: ["status"],
|
|
691
|
+
message: "status is required on a finished delivery and allowed only there",
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
})),
|
|
624
695
|
/**
|
|
625
696
|
* Phase D (spec §6.3): the report of the sub-agent that ran a person's fork invocation
|
|
626
697
|
* (`invokedSeq`), written once (idem `skill_fork_result:<seq>`) before the parent's next model
|
|
@@ -654,9 +725,10 @@ export const ConversationEventSchema = z.discriminatedUnion("type", [
|
|
|
654
725
|
/**
|
|
655
726
|
* The finish never wakes a run, but the next run absorbs it like any other (background
|
|
656
727
|
* Bash §3): `person`, a person stopped the task (the conversation's background section);
|
|
657
|
-
* `deletion`, the conversation was being deleted
|
|
728
|
+
* `deletion`, the conversation was being deleted; `subagent_end`, the sub-agent that owns it
|
|
729
|
+
* ended (a fork's run, or a stopped background sub-agent; agent map spec §5.3).
|
|
658
730
|
*/
|
|
659
|
-
stoppedBy: z.enum(["person", "deletion"]).optional(),
|
|
731
|
+
stoppedBy: z.enum(["person", "deletion", "subagent_end"]).optional(),
|
|
660
732
|
})),
|
|
661
733
|
ev("compaction_summary", z.object({ coversUpToSeq: seqNo, text: z.string() })),
|
|
662
734
|
ev("compaction_failed", z.object({ attempt: count, reason: z.string() })),
|
|
@@ -684,7 +756,9 @@ export const ConversationEventSchema = z.discriminatedUnion("type", [
|
|
|
684
756
|
* loop takes it at its next step boundary, `consumed_seq` moves past it, and request building
|
|
685
757
|
* places it where the model call that absorbed it was built.
|
|
686
758
|
*/
|
|
687
|
-
export const isAbsorbable = (e) => e.type === "user_message" ||
|
|
759
|
+
export const isAbsorbable = (e) => e.type === "user_message" ||
|
|
760
|
+
e.type === "background_task_finished" ||
|
|
761
|
+
e.type === "subagent_delivery";
|
|
688
762
|
/**
|
|
689
763
|
* What the person typed for a skill invocation (phase D): `/<plugin>:<name> <arguments>` (no
|
|
690
764
|
* plugin: `/<name>`). Titles and eval case titles use it instead of the rendered skill in
|
|
@@ -17,7 +17,7 @@ export declare class ConversationQueue {
|
|
|
17
17
|
readonly txHost: TransactionHost;
|
|
18
18
|
constructor(db: KernelDb, eventLog: Pick<EventLog, "appendIn" | "notify" | "publishChanged" | "findByIdem">, conversations: Pick<ConversationsService, "get" | "writable" | "resolveExtra" | "bindIn" | "checkPick" | "prepareQueuedSkill">,
|
|
19
19
|
/** Starts the conversation's next run (`ensureRun`). */
|
|
20
|
-
runs: Pick<RunControl, "ensureRun">, txHost: TransactionHost);
|
|
20
|
+
runs: Pick<RunControl, "ensureRun" | "wakeHeldTree">, txHost: TransactionHost);
|
|
21
21
|
list(orgId: string, conversationId: string, accountId: string): Promise<{
|
|
22
22
|
items: QueueItem[];
|
|
23
23
|
paused: boolean;
|
|
@@ -218,6 +218,8 @@ let ConversationQueue = class ConversationQueue {
|
|
|
218
218
|
await this.conversations.writable(orgId, conversationId, accountId);
|
|
219
219
|
await this.removeIn(conversationId, itemId);
|
|
220
220
|
await this.eventLog.publishChanged(conversationId, "queue");
|
|
221
|
+
// removing the last item unpauses the queue: the wakes it held for the tree go out
|
|
222
|
+
await this.runs.wakeHeldTree(conversationId);
|
|
221
223
|
}
|
|
222
224
|
// its own transaction: the caller notifies and publishes after the commit
|
|
223
225
|
async removeIn(conversationId, itemId) {
|
|
@@ -249,6 +251,7 @@ let ConversationQueue = class ConversationQueue {
|
|
|
249
251
|
await this.eventLog.publishChanged(conversationId, "archived");
|
|
250
252
|
await this.eventLog.publishChanged(conversationId, "queue");
|
|
251
253
|
await this.runs.ensureRun(conversationId);
|
|
254
|
+
await this.runs.wakeHeldTree(conversationId);
|
|
252
255
|
return event;
|
|
253
256
|
}
|
|
254
257
|
// its own transaction: the caller notifies and publishes after the commit
|
|
@@ -293,6 +296,8 @@ let ConversationQueue = class ConversationQueue {
|
|
|
293
296
|
.execute();
|
|
294
297
|
await this.eventLog.publishChanged(conversationId, "queue");
|
|
295
298
|
await this.runs.ensureRun(conversationId);
|
|
299
|
+
// a paused root holds the wakes of its whole tree (agent map spec §5.3)
|
|
300
|
+
await this.runs.wakeHeldTree(conversationId);
|
|
296
301
|
}
|
|
297
302
|
/** A queued item or a sent message for this client id (outside any transaction). */
|
|
298
303
|
async prior(conversationId, clientMessageId) {
|
|
@@ -29,8 +29,10 @@ export declare const titleJobId: (conversationId: string, attempt: number) => st
|
|
|
29
29
|
export declare const TITLE_MAX_ATTEMPTS = 3;
|
|
30
30
|
/** Output cap of the title call. */
|
|
31
31
|
export declare const TITLE_MAX_OUTPUT_TOKENS = 32;
|
|
32
|
-
/** The longest
|
|
32
|
+
/** The longest title a person can give by renaming (characters). */
|
|
33
33
|
export declare const TITLE_MAX_CHARS = 120;
|
|
34
|
+
/** The longest generated title by display width (CJK and emoji count 2: ~24 CJK / 48 Latin). */
|
|
35
|
+
export declare const TITLE_MAX_WIDTH = 48;
|
|
34
36
|
/** Each side of the excerpt is cut to this many characters. */
|
|
35
37
|
export declare const TITLE_EXCERPT_CHARS = 1000;
|
|
36
38
|
/**
|
|
@@ -48,8 +50,8 @@ export declare const TITLE_PROMPT: string;
|
|
|
48
50
|
export declare function titleExcerpt(firstUser: string, firstReply: string): string;
|
|
49
51
|
/**
|
|
50
52
|
* The title from a model reply: the first non-empty line, without control or format characters,
|
|
51
|
-
* wrapping quotes or trailing punctuation, at most {@link
|
|
52
|
-
* nothing is left.
|
|
53
|
+
* wrapping quotes or trailing punctuation, at most {@link TITLE_MAX_WIDTH} display width (cut on a
|
|
54
|
+
* character boundary, no ellipsis); null when nothing is left.
|
|
53
55
|
*/
|
|
54
56
|
export declare function cleanTitle(reply: string): string | null;
|
|
55
57
|
export interface TitleDeps {
|
|
@@ -47,8 +47,10 @@ export const titleJobId = (conversationId, attempt) => `title-${conversationId}-
|
|
|
47
47
|
export const TITLE_MAX_ATTEMPTS = 3;
|
|
48
48
|
/** Output cap of the title call. */
|
|
49
49
|
export const TITLE_MAX_OUTPUT_TOKENS = 32;
|
|
50
|
-
/** The longest
|
|
50
|
+
/** The longest title a person can give by renaming (characters). */
|
|
51
51
|
export const TITLE_MAX_CHARS = 120;
|
|
52
|
+
/** The longest generated title by display width (CJK and emoji count 2: ~24 CJK / 48 Latin). */
|
|
53
|
+
export const TITLE_MAX_WIDTH = 48;
|
|
52
54
|
/** Each side of the excerpt is cut to this many characters. */
|
|
53
55
|
export const TITLE_EXCERPT_CHARS = 1000;
|
|
54
56
|
/**
|
|
@@ -63,8 +65,13 @@ const EXCERPT_SCAN_EVENTS = 2000;
|
|
|
63
65
|
const PAGE = 500;
|
|
64
66
|
const JOB = "title";
|
|
65
67
|
/** The system prompt of the title call (model-facing, English). */
|
|
66
|
-
export const TITLE_PROMPT = "Write a
|
|
68
|
+
export const TITLE_PROMPT = "Write a short topic of what the user asked, not the reply, as a title for this conversation, " +
|
|
69
|
+
"in the language the user writes in. Use a noun phrase of at most 6 words or about 16 CJK " +
|
|
70
|
+
"characters: no sentence, no list. " +
|
|
67
71
|
"Reply with the title only, no quotes or punctuation at the end.";
|
|
72
|
+
const WIDE_RE = /[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]|\p{Extended_Pictographic}|[\u{20000}-\u{3FFFD}]/u;
|
|
73
|
+
/** Display width of a character: 2 for CJK, fullwidth forms and emoji, else 1. */
|
|
74
|
+
const widthOf = (ch) => (WIDE_RE.test(ch) ? 2 : 1);
|
|
68
75
|
const cut = (s) => {
|
|
69
76
|
const cps = Array.from(s);
|
|
70
77
|
return cps.length <= TITLE_EXCERPT_CHARS ? s : `${cps.slice(0, TITLE_EXCERPT_CHARS).join("")}…`;
|
|
@@ -75,8 +82,8 @@ export function titleExcerpt(firstUser, firstReply) {
|
|
|
75
82
|
}
|
|
76
83
|
/**
|
|
77
84
|
* The title from a model reply: the first non-empty line, without control or format characters,
|
|
78
|
-
* wrapping quotes or trailing punctuation, at most {@link
|
|
79
|
-
* nothing is left.
|
|
85
|
+
* wrapping quotes or trailing punctuation, at most {@link TITLE_MAX_WIDTH} display width (cut on a
|
|
86
|
+
* character boundary, no ellipsis); null when nothing is left.
|
|
80
87
|
*/
|
|
81
88
|
export function cleanTitle(reply) {
|
|
82
89
|
const line = reply
|
|
@@ -91,10 +98,16 @@ export function cleanTitle(reply) {
|
|
|
91
98
|
.replace(/^["'“”‘’「」《》`*]+|["'“”‘’「」《》`*]+$/gu, "")
|
|
92
99
|
.replace(/[.。!!??,,;;::]+$/u, "")
|
|
93
100
|
.trim();
|
|
94
|
-
//
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
101
|
+
// cut by display width over code points, so a cut never splits a surrogate pair
|
|
102
|
+
let width = 0;
|
|
103
|
+
let out = "";
|
|
104
|
+
for (const ch of t) {
|
|
105
|
+
width += widthOf(ch);
|
|
106
|
+
if (width > TITLE_MAX_WIDTH)
|
|
107
|
+
break;
|
|
108
|
+
out += ch;
|
|
109
|
+
}
|
|
110
|
+
t = out.trimEnd();
|
|
98
111
|
return t === "" ? null : t;
|
|
99
112
|
}
|
|
100
113
|
const textOf = (content) => content.flatMap((b) => (b.type === "text" ? [b.text] : [])).join("");
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { KernelSchemaDb } from "../db/kernel-schema.js";
|
|
2
|
+
/**
|
|
3
|
+
* A conversation and every sub-agent conversation below it (agent map spec §6: its children,
|
|
4
|
+
* grandchildren and so on, through `conversations.parent_conversation_id`), each with its level
|
|
5
|
+
* below `conversationId` (0 for the conversation itself), shallowest first. Deleted conversations
|
|
6
|
+
* are included (a deleted root's tree is still stopped); an unknown id yields nothing.
|
|
7
|
+
*/
|
|
8
|
+
export declare function conversationTree(db: KernelSchemaDb, conversationId: string): Promise<{
|
|
9
|
+
id: string;
|
|
10
|
+
level: number;
|
|
11
|
+
}[]>;
|
|
12
|
+
/**
|
|
13
|
+
* The ancestors of a conversation (agent map spec §8: live progress reaches every level above a
|
|
14
|
+
* sub-agent), nearest first: its parent, the parent's parent and so on up to the root, through
|
|
15
|
+
* `conversations.parent_conversation_id`. Empty for a root or an unknown id.
|
|
16
|
+
*/
|
|
17
|
+
export declare function conversationAncestors(db: KernelSchemaDb, conversationId: string): Promise<string[]>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { sql } from "kysely";
|
|
2
|
+
/**
|
|
3
|
+
* How many levels below a conversation the tree reads walk at most: far above
|
|
4
|
+
* `subagents.maxDepth`'s bound of 5, so a corrupt parent chain cannot loop forever.
|
|
5
|
+
*/
|
|
6
|
+
const TREE_MAX_LEVELS = 16;
|
|
7
|
+
/**
|
|
8
|
+
* A conversation and every sub-agent conversation below it (agent map spec §6: its children,
|
|
9
|
+
* grandchildren and so on, through `conversations.parent_conversation_id`), each with its level
|
|
10
|
+
* below `conversationId` (0 for the conversation itself), shallowest first. Deleted conversations
|
|
11
|
+
* are included (a deleted root's tree is still stopped); an unknown id yields nothing.
|
|
12
|
+
*/
|
|
13
|
+
export async function conversationTree(db, conversationId) {
|
|
14
|
+
const r = await sql `
|
|
15
|
+
WITH RECURSIVE tree(id, level) AS (
|
|
16
|
+
SELECT c.id, 0 FROM capybara.conversations c WHERE c.id = ${conversationId}
|
|
17
|
+
UNION ALL
|
|
18
|
+
SELECT c.id, t.level + 1
|
|
19
|
+
FROM capybara.conversations c JOIN tree t ON c.parent_conversation_id = t.id
|
|
20
|
+
WHERE c.kind = 'subagent' AND t.level < ${TREE_MAX_LEVELS}
|
|
21
|
+
)
|
|
22
|
+
SELECT id, level FROM tree ORDER BY level, id`.execute(db);
|
|
23
|
+
return r.rows;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The ancestors of a conversation (agent map spec §8: live progress reaches every level above a
|
|
27
|
+
* sub-agent), nearest first: its parent, the parent's parent and so on up to the root, through
|
|
28
|
+
* `conversations.parent_conversation_id`. Empty for a root or an unknown id.
|
|
29
|
+
*/
|
|
30
|
+
export async function conversationAncestors(db, conversationId) {
|
|
31
|
+
const r = await sql `
|
|
32
|
+
WITH RECURSIVE up(id, parent, level) AS (
|
|
33
|
+
SELECT c.id, c.parent_conversation_id, 0 FROM capybara.conversations c
|
|
34
|
+
WHERE c.id = ${conversationId}
|
|
35
|
+
UNION ALL
|
|
36
|
+
SELECT c.id, c.parent_conversation_id, up.level + 1
|
|
37
|
+
FROM capybara.conversations c JOIN up ON c.id = up.parent
|
|
38
|
+
WHERE up.level < ${TREE_MAX_LEVELS}
|
|
39
|
+
)
|
|
40
|
+
SELECT id FROM up WHERE level > 0 ORDER BY level`.execute(db);
|
|
41
|
+
return r.rows.map((row) => row.id);
|
|
42
|
+
}
|
package/dist/ctx/create-ctx.d.ts
CHANGED
|
@@ -48,6 +48,11 @@ export interface ExtensionPointAccess {
|
|
|
48
48
|
}[];
|
|
49
49
|
/** Names of the extensions enabled in the organization (`extension_org_configs.enabled` plus required bootstrap plugins, `enabled.ts`); queried every time, not cached. */
|
|
50
50
|
enabledPlugins(orgId: string): Promise<Set<string>>;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the extension's effective config is valid in the organization (layering spec A §6):
|
|
53
|
+
* a provider that is not is excluded from point resolution for that org.
|
|
54
|
+
*/
|
|
55
|
+
configOk(orgId: string, plugin: string): Promise<boolean>;
|
|
51
56
|
}
|
|
52
57
|
/**
|
|
53
58
|
* Queries the names of the extensions enabled in the organization (org config rows plus the
|
package/dist/ctx/create-ctx.js
CHANGED
|
@@ -146,6 +146,7 @@ function guardBuilder(builder, plugin) {
|
|
|
146
146
|
const noProviders = (deps) => ({
|
|
147
147
|
providers: () => [],
|
|
148
148
|
enabledPlugins: (orgId) => queryEnabledPlugins(deps.db, orgId),
|
|
149
|
+
configOk: async () => true,
|
|
149
150
|
});
|
|
150
151
|
/**
|
|
151
152
|
* 插件实例的部署配置(已校验):`ctx.config` 是读它的 getter。hot 字段改动时宿主替换 `value`(C10),
|
|
@@ -260,12 +261,21 @@ export function createExtensionContext(deps, manifest, deploymentConfig, extensi
|
|
|
260
261
|
throw new ExtensionPointUnavailableError(`extension point ${ref} has no provider`);
|
|
261
262
|
return { info, chosen };
|
|
262
263
|
};
|
|
263
|
-
/**
|
|
264
|
+
/**
|
|
265
|
+
* The org's view of the providers: an orgScoped point keeps only those the org enabled (queried
|
|
266
|
+
* every time, not cached), and every point drops those whose effective config is not valid in
|
|
267
|
+
* the org (layering spec A §6: a call on behalf of an org never reaches such a provider).
|
|
268
|
+
*/
|
|
264
269
|
const forOrg = async (orgScoped, orgId, entries) => {
|
|
265
|
-
if (
|
|
270
|
+
if (entries.length === 0)
|
|
266
271
|
return entries;
|
|
267
|
-
|
|
268
|
-
|
|
272
|
+
let out = entries;
|
|
273
|
+
if (orgScoped) {
|
|
274
|
+
const enabled = await extensionPointAccess.enabledPlugins(orgId);
|
|
275
|
+
out = out.filter((e) => enabled.has(e.plugin));
|
|
276
|
+
}
|
|
277
|
+
const ok = await Promise.all(out.map((e) => extensionPointAccess.configOk(orgId, e.plugin)));
|
|
278
|
+
return out.filter((_, i) => ok[i]);
|
|
269
279
|
};
|
|
270
280
|
const listAll = (ref) => {
|
|
271
281
|
const info = checkExtensionPoint(ref);
|
|
@@ -280,7 +290,7 @@ export function createExtensionContext(deps, manifest, deploymentConfig, extensi
|
|
|
280
290
|
return (async () => {
|
|
281
291
|
const { info, chosen } = pick(ref, provider);
|
|
282
292
|
if ((await forOrg(info.orgScoped, orgId, [chosen])).length === 0) {
|
|
283
|
-
throw new ExtensionPointUnavailableError(`extension point ${ref} provider ${chosen.plugin} is not
|
|
293
|
+
throw new ExtensionPointUnavailableError(`extension point ${ref} provider ${chosen.plugin} is not available in organization ${orgId} (not enabled there, or its configuration is not valid there)`);
|
|
284
294
|
}
|
|
285
295
|
return chosen.impl;
|
|
286
296
|
})();
|