@capybara-hq/kernel 0.1.0-rc.4 → 0.1.0-rc.6
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 +51 -14
- package/dist/admin/admin.controller.js +60 -19
- 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 +54 -23
- package/dist/agents/agents.service.js +180 -76
- 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/models.controller.d.ts +34 -5
- package/dist/agents/models.controller.js +50 -6
- 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/readiness.controller.d.ts +5 -5
- package/dist/agents/readiness.controller.js +6 -6
- 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 +10 -2
- package/dist/config/schema.js +70 -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 +73 -15
- package/dist/conversations/conversations.service.js +115 -35
- 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 +20 -1
- package/dist/ctx/create-ctx.js +38 -7
- package/dist/db/kernel-schema.d.ts +386 -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 +85 -2
- package/dist/errors.js +85 -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 +20 -6
- package/dist/evals/runs.service.d.ts +2 -1
- package/dist/evals/runs.service.js +13 -12
- package/dist/evals/step-replay.d.ts +4 -6
- package/dist/evals/step-replay.js +4 -3
- 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/config-hash.d.ts +10 -0
- package/dist/extensions/config-hash.js +38 -0
- 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 +11 -11
- package/dist/extensions/hooks.d.ts +37 -4
- package/dist/extensions/hooks.js +82 -16
- package/dist/extensions/host.d.ts +24 -10
- package/dist/extensions/host.js +49 -54
- 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/extensions/state.module.d.ts +9 -0
- package/dist/extensions/state.module.js +38 -0
- package/dist/files/previewers.d.ts +8 -1
- package/dist/files/previewers.js +35 -6
- package/dist/http/api.module.js +25 -3
- package/dist/http/app.d.ts +11 -2
- package/dist/http/app.js +31 -5
- package/dist/http/plugin-dispatch.d.ts +4 -1
- package/dist/http/plugin-dispatch.js +14 -2
- 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 +24 -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 +19 -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/embeddings.d.ts +82 -0
- package/dist/models/embeddings.js +326 -0
- package/dist/models/enablement.controller.d.ts +40 -0
- package/dist/models/enablement.controller.js +74 -0
- package/dist/models/enablement.d.ts +99 -0
- package/dist/models/enablement.js +263 -0
- package/dist/models/models.module.d.ts +5 -1
- package/dist/models/models.module.js +16 -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 +37 -12
- package/dist/models/purposes.js +63 -17
- 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 +1405 -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.d.ts +8 -1
- package/dist/runtime/hook-calls.js +40 -7
- 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 +38 -11
- package/dist/runtime/model-call.js +97 -24
- package/dist/runtime/providers.d.ts +146 -32
- package/dist/runtime/providers.js +321 -67
- 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 +12 -6
- package/dist/runtime/run-worker.js +58 -35
- 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 +46 -32
- 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-jobs.d.ts +88 -0
- package/dist/runtime/usage-report-jobs.js +158 -0
- package/dist/runtime/usage-report.d.ts +33 -38
- package/dist/runtime/usage-report.js +169 -96
- 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 +193 -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/src/migrations/0089_model_kinds_usage.sql +38 -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
package/dist/evals/run-replay.js
CHANGED
|
@@ -263,13 +263,14 @@ function absorbedByStep(s) {
|
|
|
263
263
|
}
|
|
264
264
|
/**
|
|
265
265
|
* The replayed run's boundary (`trigger_seq`): a wake run's recorded one (`run_started.triggerSeq`,
|
|
266
|
-
* background Bash spec §3); otherwise the newest message after `consumed`, else the newest finish
|
|
266
|
+
* background Bash spec §3, agent map spec §5.3); otherwise the newest message after `consumed`, else the newest finish
|
|
267
267
|
* after it that could have woken the run (not reported, no `stoppedBy`), else the last
|
|
268
268
|
* message (old logs, as before).
|
|
269
269
|
*/
|
|
270
270
|
function replayTrigger(started, seeds, consumed) {
|
|
271
271
|
const recorded = started;
|
|
272
|
-
if (recorded.trigger === "background_task"
|
|
272
|
+
if ((recorded.trigger === "background_task" || recorded.trigger === "subagent") &&
|
|
273
|
+
recorded.triggerSeq !== undefined) {
|
|
273
274
|
return recorded.triggerSeq;
|
|
274
275
|
}
|
|
275
276
|
const lastMessage = seeds.findLast((e) => e.type === "user_message")?.seq;
|
|
@@ -330,6 +331,10 @@ export async function replayRun(d, s, candidate, evalRunId, signal) {
|
|
|
330
331
|
model: candidate.model,
|
|
331
332
|
modelParams: candidate.params,
|
|
332
333
|
};
|
|
334
|
+
const triggerEvent = s.events.find((e) => e.seq === trigger);
|
|
335
|
+
const forkRun = triggerEvent?.type === "user_message" &&
|
|
336
|
+
triggerEvent.payload.skill !== undefined &&
|
|
337
|
+
triggerEvent.payload.dispatch !== undefined;
|
|
333
338
|
const conversationId = randomUUID();
|
|
334
339
|
const runId = randomUUID();
|
|
335
340
|
await d.seeder.seed({
|
|
@@ -430,8 +435,10 @@ export async function replayRun(d, s, candidate, evalRunId, signal) {
|
|
|
430
435
|
return metered;
|
|
431
436
|
};
|
|
432
437
|
const registry = {
|
|
433
|
-
|
|
434
|
-
|
|
438
|
+
// the case's org (its effective provider config), whatever the replayed step passes
|
|
439
|
+
// (and its disabled lists: a candidate disabled there is refused, spec B §5.3)
|
|
440
|
+
resolve: async (_orgId, ref, opts) => {
|
|
441
|
+
const r = await d.registry.resolve(s.orgId, ref, opts);
|
|
435
442
|
return { ...r, provider: meter(r.provider) };
|
|
436
443
|
},
|
|
437
444
|
};
|
|
@@ -450,7 +457,8 @@ export async function replayRun(d, s, candidate, evalRunId, signal) {
|
|
|
450
457
|
return "stop";
|
|
451
458
|
},
|
|
452
459
|
});
|
|
453
|
-
// 插话:原运行开始之后到达、且被原运行某一步吸收的可吸收事件(user_message /
|
|
460
|
+
// 插话:原运行开始之后到达、且被原运行某一步吸收的可吸收事件(user_message /
|
|
461
|
+
// background_task_finished / subagent_delivery)
|
|
454
462
|
const absorbed = absorbedByStep(s);
|
|
455
463
|
const stepsInOrder = [...absorbed.keys()].sort((a, b) => a - b);
|
|
456
464
|
/** 第 k 步(含)之前原运行吸收到的最大位置;原运行没有模型调用时不设限。 */
|
|
@@ -465,7 +473,10 @@ export async function replayRun(d, s, candidate, evalRunId, signal) {
|
|
|
465
473
|
return cap;
|
|
466
474
|
};
|
|
467
475
|
const interjections = s.events
|
|
468
|
-
.filter((e) => (e.type === "user_message" ||
|
|
476
|
+
.filter((e) => (e.type === "user_message" ||
|
|
477
|
+
e.type === "background_task_finished" ||
|
|
478
|
+
e.type === "subagent_delivery") &&
|
|
479
|
+
e.seq > R)
|
|
469
480
|
.flatMap((e) => {
|
|
470
481
|
const step = stepsInOrder.find((k) => absorbed.get(k) >= e.seq);
|
|
471
482
|
return step === undefined ? [] : [{ event: e, step }];
|
|
@@ -532,6 +543,9 @@ export async function replayRun(d, s, candidate, evalRunId, signal) {
|
|
|
532
543
|
},
|
|
533
544
|
// replays never fire plugin hooks (the loop deps omit them too, P-18)
|
|
534
545
|
conversationKind: "eval",
|
|
546
|
+
// a child case offers a sub-agent's message tools, as its recorded requests did (a fork
|
|
547
|
+
// invocation's child, whose run a task with the invocation record started, has none)
|
|
548
|
+
...(subagent !== undefined && !forkRun && { subagent: true }),
|
|
535
549
|
});
|
|
536
550
|
}
|
|
537
551
|
catch (e) {
|
|
@@ -149,7 +149,8 @@ export declare class EvalRunsService {
|
|
|
149
149
|
private liveSet;
|
|
150
150
|
/**
|
|
151
151
|
* 解析模型;不存在 / 不可用 → `eval.candidate_invalid`(供应商列表暂时失败照常抛出)。
|
|
152
|
-
*
|
|
152
|
+
* Resolved for the org (its effective provider config), as the runtime does; per-org model
|
|
153
|
+
* admission must cover eval candidates the same way.
|
|
153
154
|
*/
|
|
154
155
|
private resolveModel;
|
|
155
156
|
/**
|
|
@@ -187,11 +187,12 @@ let EvalRunsService = EvalRunsService_1 = class EvalRunsService {
|
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
189
|
* 解析模型;不存在 / 不可用 → `eval.candidate_invalid`(供应商列表暂时失败照常抛出)。
|
|
190
|
-
*
|
|
190
|
+
* Resolved for the org (its effective provider config), as the runtime does; per-org model
|
|
191
|
+
* admission must cover eval candidates the same way.
|
|
191
192
|
*/
|
|
192
|
-
async resolveModel(ref) {
|
|
193
|
+
async resolveModel(orgId, ref) {
|
|
193
194
|
try {
|
|
194
|
-
return await this.d.registry.resolve(ref);
|
|
195
|
+
return await this.d.registry.resolve(orgId, ref);
|
|
195
196
|
}
|
|
196
197
|
catch (e) {
|
|
197
198
|
if (e instanceof ProviderListError)
|
|
@@ -208,7 +209,7 @@ let EvalRunsService = EvalRunsService_1 = class EvalRunsService {
|
|
|
208
209
|
* 校验候选:版本存在(该集合的 agent)、模型可解析、参数按所用模型的声明严格通过(`paramIssues`)。
|
|
209
210
|
* 所用模型 = 候选模型,否则候选版本的模型,否则 agent 当前版本的模型。返回候选版本的定义。
|
|
210
211
|
*/
|
|
211
|
-
async checkCandidate(agentId, c) {
|
|
212
|
+
async checkCandidate(orgId, agentId, c) {
|
|
212
213
|
const versionDef = await versionDefinition(this.d.db, agentId, c.agentVersion);
|
|
213
214
|
if (c.agentVersion !== undefined && versionDef === undefined) {
|
|
214
215
|
throw candidateInvalid(`Agent version ${c.agentVersion} does not exist`, [
|
|
@@ -227,7 +228,7 @@ let EvalRunsService = EvalRunsService_1 = class EvalRunsService {
|
|
|
227
228
|
}
|
|
228
229
|
if (model === undefined)
|
|
229
230
|
return versionDef;
|
|
230
|
-
const { info } = await this.resolveModel(model);
|
|
231
|
+
const { info } = await this.resolveModel(orgId, model);
|
|
231
232
|
if (c.modelParams !== undefined) {
|
|
232
233
|
const issues = paramIssues("candidate.modelParams", info.parameters, c.modelParams);
|
|
233
234
|
if (issues.length > 0)
|
|
@@ -239,7 +240,7 @@ let EvalRunsService = EvalRunsService_1 = class EvalRunsService {
|
|
|
239
240
|
* 各用例的回放计划与成本:只读写入时存好的列(`plan_step` / `plan_run`、`base_model`),不读快照。
|
|
240
241
|
* 给了候选参数时按每个用例实际所用的模型严格校验(同一模型在一次调用里只解析一次)。
|
|
241
242
|
*/
|
|
242
|
-
async plan(setId, mode, c, versionDef) {
|
|
243
|
+
async plan(orgId, setId, mode, c, versionDef) {
|
|
243
244
|
const table = await this.d.prices.table();
|
|
244
245
|
const versionOnly = c.agentVersion !== undefined && c.model === undefined;
|
|
245
246
|
const rows = await this.d.db
|
|
@@ -277,7 +278,7 @@ let EvalRunsService = EvalRunsService_1 = class EvalRunsService {
|
|
|
277
278
|
const key = priceKey(model.provider, model.model);
|
|
278
279
|
if (!infos.has(key)) {
|
|
279
280
|
try {
|
|
280
|
-
infos.set(key, (await this.d.registry.resolve(model)).info);
|
|
281
|
+
infos.set(key, (await this.d.registry.resolve(orgId, model)).info);
|
|
281
282
|
}
|
|
282
283
|
catch (e) {
|
|
283
284
|
if (e instanceof ProviderListError)
|
|
@@ -329,7 +330,7 @@ let EvalRunsService = EvalRunsService_1 = class EvalRunsService {
|
|
|
329
330
|
}
|
|
330
331
|
let maxOutputTokens = configured;
|
|
331
332
|
try {
|
|
332
|
-
const { info } = await this.d.registry.resolve(target.model);
|
|
333
|
+
const { info } = await this.d.registry.resolve(orgId, target.model);
|
|
333
334
|
maxOutputTokens = Math.min(configured, info.maxOutputTokens);
|
|
334
335
|
}
|
|
335
336
|
catch (e) {
|
|
@@ -396,8 +397,8 @@ let EvalRunsService = EvalRunsService_1 = class EvalRunsService {
|
|
|
396
397
|
const set = await this.liveSet(orgId, setId);
|
|
397
398
|
await this.assertAgentLive(set.agent_id);
|
|
398
399
|
const caps = this.tokenCaps(input.tokenCap);
|
|
399
|
-
const versionDef = await this.checkCandidate(set.agent_id, input.candidate);
|
|
400
|
-
const plans = await this.plan(setId, input.mode, input.candidate, versionDef);
|
|
400
|
+
const versionDef = await this.checkCandidate(orgId, set.agent_id, input.candidate);
|
|
401
|
+
const plans = await this.plan(orgId, setId, input.mode, input.candidate, versionDef);
|
|
401
402
|
const judge = await this.judgePricing(orgId, set.rubric, input.judge);
|
|
402
403
|
return { estimate: await this.summarize(plans, judge), ...caps };
|
|
403
404
|
}
|
|
@@ -421,11 +422,11 @@ let EvalRunsService = EvalRunsService_1 = class EvalRunsService {
|
|
|
421
422
|
const set = await this.liveSet(orgId, setId);
|
|
422
423
|
await this.assertAgentLive(set.agent_id);
|
|
423
424
|
const tokenCap = this.tokenCaps(input.tokenCap).effectiveTokenCap;
|
|
424
|
-
const versionDef = await this.checkCandidate(set.agent_id, input.candidate);
|
|
425
|
+
const versionDef = await this.checkCandidate(orgId, set.agent_id, input.candidate);
|
|
425
426
|
if (input.judge)
|
|
426
427
|
await this.d.purposes.resolve(orgId, "eval");
|
|
427
428
|
const judge = await this.judgePricing(orgId, set.rubric, input.judge);
|
|
428
|
-
const planned = await this.plan(setId, input.mode, input.candidate, versionDef);
|
|
429
|
+
const planned = await this.plan(orgId, setId, input.mode, input.candidate, versionDef);
|
|
429
430
|
if (planned.length === 0) {
|
|
430
431
|
throw new ApiError("eval.nothing_to_replay", "The eval set has nothing to replay");
|
|
431
432
|
}
|
|
@@ -4,7 +4,7 @@ import { type Selection } from "../conversations/selection.js";
|
|
|
4
4
|
import type { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
5
5
|
import { type MediaSourceDeps } from "../runtime/model-call.js";
|
|
6
6
|
import type { ProviderRegistry } from "../runtime/providers.js";
|
|
7
|
-
import { type DriftReason } from "./reconstruct.js";
|
|
7
|
+
import { type DriftReason, type SubagentTemplateRef } from "./reconstruct.js";
|
|
8
8
|
import type { CaseSnapshot } from "./snapshot.js";
|
|
9
9
|
/**
|
|
10
10
|
* 单步回放(D2 / C5):由用例快照还原某一步的模型请求,换成候选(agent 版本 / 模型 / 参数 / 指令)重发,
|
|
@@ -33,10 +33,7 @@ export interface ResolvedCandidate {
|
|
|
33
33
|
* A plugin template's child case: the template's current version (set by the worker), compared
|
|
34
34
|
* with the logged one for `subagent_changed` when the candidate changed.
|
|
35
35
|
*/
|
|
36
|
-
subagentTemplate?:
|
|
37
|
-
id: string;
|
|
38
|
-
version: number;
|
|
39
|
-
};
|
|
36
|
+
subagentTemplate?: SubagentTemplateRef;
|
|
40
37
|
/**
|
|
41
38
|
* A child case under another agent version: that version's own definition (with the candidate's
|
|
42
39
|
* instructions), compared with the logged sub-agent for `subagent_changed`. Never rendered.
|
|
@@ -95,7 +92,8 @@ export declare class ReplayAttemptError extends Error {
|
|
|
95
92
|
* 否则带候选的定义、版本与参数——参数按候选模型的声明宽松处理,与运行时一致),用 `consumeModelStream` 收完。
|
|
96
93
|
* 请求发出之前的错误原样抛出(`agent.model_unavailable`、取附件暂时失败为 `MediaUnavailableError`);请求发出之后的
|
|
97
94
|
* 错误包成 {@link ReplayAttemptError}(带估算用量,调用方计入预算后按 `cause` 分类重试)。
|
|
98
|
-
*
|
|
95
|
+
* The candidate model resolves in the snapshot's org like the runtime (its effective provider
|
|
96
|
+
* config and disabled lists: a model disabled there is `agent.model_unavailable`, spec B §5.3).
|
|
99
97
|
* 不另设单次请求的墙钟时限:与运行时一样只有流空闲看门狗(`streamIdleTimeoutMs` / `runtime.streamIdleMs`)。
|
|
100
98
|
*/
|
|
101
99
|
export declare function replayStep(d: StepReplayDeps, s: CaseSnapshot, call: {
|
|
@@ -2,7 +2,7 @@ import { sanitizeParams, } from "@capybara-hq/plugin-sdk";
|
|
|
2
2
|
import { effectiveDefinition, NO_SELECTION, sameModel, } from "../conversations/selection.js";
|
|
3
3
|
import { estimateTokens } from "../runtime/context/tokens.js";
|
|
4
4
|
import { consumeModelStream, MediaUnavailableError, } from "../runtime/model-call.js";
|
|
5
|
-
import { loadSnapshotMedia, reconstructRequest } from "./reconstruct.js";
|
|
5
|
+
import { loadSnapshotMedia, reconstructRequest, } from "./reconstruct.js";
|
|
6
6
|
/** 键排序后的 JSON(比较参数是否相同)。 */
|
|
7
7
|
const canonical = (v) => JSON.stringify(Object.keys(v)
|
|
8
8
|
.sort()
|
|
@@ -126,12 +126,13 @@ function baselineOf(s, call) {
|
|
|
126
126
|
* 否则带候选的定义、版本与参数——参数按候选模型的声明宽松处理,与运行时一致),用 `consumeModelStream` 收完。
|
|
127
127
|
* 请求发出之前的错误原样抛出(`agent.model_unavailable`、取附件暂时失败为 `MediaUnavailableError`);请求发出之后的
|
|
128
128
|
* 错误包成 {@link ReplayAttemptError}(带估算用量,调用方计入预算后按 `cause` 分类重试)。
|
|
129
|
-
*
|
|
129
|
+
* The candidate model resolves in the snapshot's org like the runtime (its effective provider
|
|
130
|
+
* config and disabled lists: a model disabled there is `agent.model_unavailable`, spec B §5.3).
|
|
130
131
|
* 不另设单次请求的墙钟时限:与运行时一样只有流空闲看门狗(`streamIdleTimeoutMs` / `runtime.streamIdleMs`)。
|
|
131
132
|
*/
|
|
132
133
|
export async function replayStep(d, s, call, candidate, signal) {
|
|
133
134
|
const baseline = baselineOf(s, call);
|
|
134
|
-
const { provider, info } = await d.registry.resolve(candidate.model);
|
|
135
|
+
const { provider, info } = await d.registry.resolve(s.orgId, candidate.model);
|
|
135
136
|
let media;
|
|
136
137
|
if (d.media) {
|
|
137
138
|
try {
|
|
@@ -58,7 +58,7 @@ export type RunStatus = (typeof RUN_STATUSES)[number];
|
|
|
58
58
|
/**
|
|
59
59
|
* 轨迹查看器(D6、C1):只给组织管理员(admin / owner)与 agent 负责人。负责人与角色每次实时读(R5);
|
|
60
60
|
* 无权查看与不存在一律 `trajectory.not_found`,不泄露对话是否存在。每次查看详情写审计 `trajectory.viewed`。
|
|
61
|
-
*
|
|
61
|
+
* 超级管理员不因身份而能看(不是组织成员时 OrgGuard 已 404)。
|
|
62
62
|
*
|
|
63
63
|
* 列表按 `conversations.kind` 过滤,不传时只列 `chat`(评测回放的隐藏对话用 `kind: "eval"` 列出)。
|
|
64
64
|
* 评测对话(`kind = 'eval'`)只给组织管理员(Ruling S1-c):里面是管理员的候选指令,非管理员的 agent 负责人
|
|
@@ -98,8 +98,13 @@ export declare class TrajectoryService {
|
|
|
98
98
|
get(orgId: string, accountId: string, conversationId: string, actorTokenId?: string, window?: RunWindow): Promise<TrajectoryDetail>;
|
|
99
99
|
/** The parent call that first dispatched a sub-agent conversation. */
|
|
100
100
|
private firstDispatch;
|
|
101
|
-
/**
|
|
102
|
-
|
|
101
|
+
/**
|
|
102
|
+
* The agent of the root conversation of a sub-agent conversation's tree, from its parent `parentId`
|
|
103
|
+
* up (the same walk as `conversations/access.ts`: at most 16 levels, every conversation between
|
|
104
|
+
* a sub-agent conversation of the org, ending at one without a parent), or null when the chain
|
|
105
|
+
* leaves the org, passes another kind or does not end.
|
|
106
|
+
*/
|
|
107
|
+
private rootAgentId;
|
|
103
108
|
/**
|
|
104
109
|
* 窗口内已开始(`started_at` 非空,与轨迹只列有 `run_started` 的运行一致)的运行,按 (created_at, id) 倒序取
|
|
105
110
|
* `limit` 次;`before` 是上一页的 `next`(运行 id)。`next`:还有更早的运行时为本页最早一次的 id。
|
|
@@ -34,7 +34,7 @@ const notFound = () => new ApiError("trajectory.not_found", "Trajectory not foun
|
|
|
34
34
|
/**
|
|
35
35
|
* 轨迹查看器(D6、C1):只给组织管理员(admin / owner)与 agent 负责人。负责人与角色每次实时读(R5);
|
|
36
36
|
* 无权查看与不存在一律 `trajectory.not_found`,不泄露对话是否存在。每次查看详情写审计 `trajectory.viewed`。
|
|
37
|
-
*
|
|
37
|
+
* 超级管理员不因身份而能看(不是组织成员时 OrgGuard 已 404)。
|
|
38
38
|
*
|
|
39
39
|
* 列表按 `conversations.kind` 过滤,不传时只列 `chat`(评测回放的隐藏对话用 `kind: "eval"` 列出)。
|
|
40
40
|
* 评测对话(`kind = 'eval'`)只给组织管理员(Ruling S1-c):里面是管理员的候选指令,非管理员的 agent 负责人
|
|
@@ -180,11 +180,13 @@ let TrajectoryService = TrajectoryService_1 = class TrajectoryService {
|
|
|
180
180
|
.where("id", "=", conversationId)
|
|
181
181
|
.where("org_id", "=", orgId)
|
|
182
182
|
.executeTakeFirst();
|
|
183
|
-
// A sub-agent's trajectory is part of its
|
|
184
|
-
// conversation
|
|
185
|
-
//
|
|
183
|
+
// A sub-agent's trajectory is part of its tree's: authorized by the ROOT conversation's agent
|
|
184
|
+
// (the rule `parentReachable` applies to the conversation itself), never by the dispatched
|
|
185
|
+
// agent nor by the direct parent's, which below an org agent's child is that org agent (an org
|
|
186
|
+
// agent's owner must not read work drawn from someone else's conversation; batch 9 review I1,
|
|
187
|
+
// agent map final review: depth 2 and below)
|
|
186
188
|
const authAgentId = conv?.kind === "subagent"
|
|
187
|
-
? await this.
|
|
189
|
+
? await this.rootAgentId(orgId, conv.parent_conversation_id)
|
|
188
190
|
: conv?.agent_id;
|
|
189
191
|
if (!conv || authAgentId === null || authAgentId === undefined)
|
|
190
192
|
throw notFound();
|
|
@@ -276,17 +278,27 @@ let TrajectoryService = TrajectoryService_1 = class TrajectoryService {
|
|
|
276
278
|
callId: row.parent_call_id,
|
|
277
279
|
};
|
|
278
280
|
}
|
|
279
|
-
/**
|
|
280
|
-
|
|
281
|
+
/**
|
|
282
|
+
* The agent of the root conversation of a sub-agent conversation's tree, from its parent `parentId`
|
|
283
|
+
* up (the same walk as `conversations/access.ts`: at most 16 levels, every conversation between
|
|
284
|
+
* a sub-agent conversation of the org, ending at one without a parent), or null when the chain
|
|
285
|
+
* leaves the org, passes another kind or does not end.
|
|
286
|
+
*/
|
|
287
|
+
async rootAgentId(orgId, parentId) {
|
|
281
288
|
if (parentId === null)
|
|
282
289
|
return null;
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
+
const row = await sql `
|
|
291
|
+
WITH RECURSIVE up(id, parent, kind, agent_id, n) AS (
|
|
292
|
+
SELECT c.id, c.parent_conversation_id, c.kind, c.agent_id, 0
|
|
293
|
+
FROM capybara.conversations c
|
|
294
|
+
WHERE c.id = ${parentId} AND c.org_id = ${orgId}
|
|
295
|
+
UNION ALL
|
|
296
|
+
SELECT c.id, c.parent_conversation_id, c.kind, c.agent_id, up.n + 1
|
|
297
|
+
FROM capybara.conversations c JOIN up ON c.id = up.parent
|
|
298
|
+
WHERE up.kind = 'subagent' AND up.n < 16 AND c.org_id = ${orgId}
|
|
299
|
+
)
|
|
300
|
+
SELECT agent_id FROM up WHERE parent IS NULL LIMIT 1`.execute(this.db.db);
|
|
301
|
+
return row.rows[0]?.agent_id ?? null;
|
|
290
302
|
}
|
|
291
303
|
/**
|
|
292
304
|
* 窗口内已开始(`started_at` 非空,与轨迹只列有 `run_started` 的运行一致)的运行,按 (created_at, id) 倒序取
|
package/dist/evals/worker.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { RunFinish } from "../runtime/run-finish.js";
|
|
|
13
13
|
import { AgentLoops, RunSteps } from "../runtime/run-steps.js";
|
|
14
14
|
import { EvalBudget } from "./budget.js";
|
|
15
15
|
import { type EvalJobData } from "./jobs.js";
|
|
16
|
+
import { type SubagentTemplateRef } from "./reconstruct.js";
|
|
16
17
|
import { type EvalReplayHooks, EvalReplaySeeder } from "./run-replay.js";
|
|
17
18
|
import { type CaseSnapshot } from "./snapshot.js";
|
|
18
19
|
/**
|
|
@@ -110,9 +111,8 @@ export declare class EvalWorker {
|
|
|
110
111
|
}
|
|
111
112
|
/**
|
|
112
113
|
* A plugin template's child case: the template's current version, which a new dispatch would use
|
|
113
|
-
* (a template removed since gets version 0, so it always differs)
|
|
114
|
+
* (a template removed since gets version 0, so it always differs), with the platform template
|
|
115
|
+
* whose content that is (absent: the org's own; a link or pin change under a copy's id changes
|
|
116
|
+
* it). Undefined for other cases.
|
|
114
117
|
*/
|
|
115
|
-
export declare function currentTemplate(db: KernelSchemaDb, s: CaseSnapshot): Promise<
|
|
116
|
-
id: string;
|
|
117
|
-
version: number;
|
|
118
|
-
} | undefined>;
|
|
118
|
+
export declare function currentTemplate(db: KernelSchemaDb, s: CaseSnapshot): Promise<SubagentTemplateRef | undefined>;
|
package/dist/evals/worker.js
CHANGED
|
@@ -34,7 +34,7 @@ import { replyParts, structuralDiff } from "./diff.js";
|
|
|
34
34
|
import { evalJobId } from "./jobs.js";
|
|
35
35
|
import { JUDGE_PROVIDER_UNAVAILABLE, judge } from "./judge.js";
|
|
36
36
|
import { userRequestOf } from "./plan.js";
|
|
37
|
-
import { subagentCaseChanged, subagentStartedOf } from "./reconstruct.js";
|
|
37
|
+
import { subagentCaseChanged, subagentStartedOf, } from "./reconstruct.js";
|
|
38
38
|
import { deleteEvalConversation, EvalReplaySeeder, ReplayClaimLost, replayRun, runBaseline, } from "./run-replay.js";
|
|
39
39
|
import { caseBase, versionDefinition } from "./runs.service.js";
|
|
40
40
|
import { readSnapshot, replayableCalls, toEvents } from "./snapshot.js";
|
|
@@ -878,12 +878,18 @@ EvalWorker = __decorate([
|
|
|
878
878
|
export { EvalWorker };
|
|
879
879
|
/**
|
|
880
880
|
* A plugin template's child case: the template's current version, which a new dispatch would use
|
|
881
|
-
* (a template removed since gets version 0, so it always differs)
|
|
881
|
+
* (a template removed since gets version 0, so it always differs), with the platform template
|
|
882
|
+
* whose content that is (absent: the org's own; a link or pin change under a copy's id changes
|
|
883
|
+
* it). Undefined for other cases.
|
|
882
884
|
*/
|
|
883
885
|
export async function currentTemplate(db, s) {
|
|
884
886
|
const t = subagentStartedOf(toEvents(s))?.template;
|
|
885
887
|
if (t?.source !== "plugin" || t.id === undefined)
|
|
886
888
|
return undefined;
|
|
887
889
|
const row = (await loadTemplates(db, s.orgId, [t.id])).get(t.id);
|
|
888
|
-
return {
|
|
890
|
+
return {
|
|
891
|
+
id: t.id,
|
|
892
|
+
version: row?.version ?? 0,
|
|
893
|
+
...(row?.platformTemplateId !== undefined && { platformTemplateId: row.platformTemplateId }),
|
|
894
|
+
};
|
|
889
895
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SuperAdminLock } from "../identity/super-admin.js";
|
|
2
2
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
3
3
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
4
4
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
5
5
|
import type { KernelLogger } from "../log.js";
|
|
6
|
+
import { OrgLock } from "../orgs/org-lock.js";
|
|
6
7
|
import { ExtensionAdmin, type PublishBus } from "./admin-view.js";
|
|
7
8
|
import { ExtensionBlobs } from "./blobs.js";
|
|
8
9
|
import { ExtensionLifecycle } from "./lifecycle.js";
|
|
@@ -15,14 +16,31 @@ import { ExtensionRegistry } from "./registry.js";
|
|
|
15
16
|
* the commit (a failure only warns; the periodic reconcile catches up); replicas converge through
|
|
16
17
|
* reconcile, no restart. It does not wait for replicas: the returned view may say `converging`.
|
|
17
18
|
* Stateless, shared by every replica; the CLI uses it too (`actor` is null).
|
|
18
|
-
* Every write runs in a transaction: first `
|
|
19
|
+
* Every write runs in a transaction: first `lockSuperAdminsAndAuthorize` (skipped by the CLI),
|
|
19
20
|
* then an advisory lock by extension name and a lock on the install record row.
|
|
20
21
|
*/
|
|
22
|
+
/**
|
|
23
|
+
* An operation an org admin runs as the owner of an org plugin (an owner update removing or putting
|
|
24
|
+
* back its extension, ruling P3-12'): the actor is re-checked as an admin of `orgId`
|
|
25
|
+
* (`catalog.upload`, under the org row lock) instead of as a super admin, and the audit records
|
|
26
|
+
* the actor with `ownerOrgId`.
|
|
27
|
+
*/
|
|
28
|
+
export interface ExtensionOpsOwner {
|
|
29
|
+
orgId: string;
|
|
30
|
+
/**
|
|
31
|
+
* Putting the extension back after a failed owner update: the actor was authorized when the
|
|
32
|
+
* update started, so no role is checked again (a demotion meanwhile must not leave the
|
|
33
|
+
* deployment without the extension it had); the audit keeps the actor, marked `rollback`.
|
|
34
|
+
*/
|
|
35
|
+
rollback?: true;
|
|
36
|
+
}
|
|
21
37
|
export declare class ExtensionAdminOps {
|
|
22
38
|
private readonly kdb;
|
|
23
39
|
readonly txHost: TransactionHost;
|
|
24
|
-
/** The
|
|
40
|
+
/** The super admin lock (identity/super-admin.ts): joins the transaction. */
|
|
25
41
|
private readonly adminLock;
|
|
42
|
+
/** The owner org's lock: an owner's operation re-checks its admin under it. */
|
|
43
|
+
private readonly orgLock;
|
|
26
44
|
private readonly installLock;
|
|
27
45
|
/**
|
|
28
46
|
* The admin view after the operation, degraded when the package cannot be read
|
|
@@ -45,8 +63,10 @@ export declare class ExtensionAdminOps {
|
|
|
45
63
|
private readonly lifecycle;
|
|
46
64
|
private readonly log;
|
|
47
65
|
constructor(kdb: KernelDb, txHost: TransactionHost,
|
|
48
|
-
/** The
|
|
49
|
-
adminLock:
|
|
66
|
+
/** The super admin lock (identity/super-admin.ts): joins the transaction. */
|
|
67
|
+
adminLock: SuperAdminLock,
|
|
68
|
+
/** The owner org's lock: an owner's operation re-checks its admin under it. */
|
|
69
|
+
orgLock: OrgLock, installLock: PluginInstallLock,
|
|
50
70
|
/**
|
|
51
71
|
* The admin view after the operation, degraded when the package cannot be read
|
|
52
72
|
* (`get(name, { allowUnreadable: true })`). If it throws, the operation has already committed:
|
|
@@ -70,7 +90,7 @@ export declare class ExtensionAdminOps {
|
|
|
70
90
|
* New install or version change (upgrade / downgrade): the install record points at package
|
|
71
91
|
* `sha256`; the desired state is unchanged (a new install is disabled). Audit `extension.installed`.
|
|
72
92
|
* - Config-declared -> `extension.config_declared`; a required bootstrap plugin may be
|
|
73
|
-
* installed at another version (
|
|
93
|
+
* installed at another version (a super admin upgrades it; `required` is kept);
|
|
74
94
|
* - package not in the package store -> `extension.package_not_found`; the extension name in the
|
|
75
95
|
* package is not `name` -> `extension.name_mismatch`;
|
|
76
96
|
* - an install record of the same name exists but comes from another npm package ->
|
|
@@ -86,7 +106,7 @@ export declare class ExtensionAdminOps {
|
|
|
86
106
|
* go back to a version whose migrations are a subset of those already run).
|
|
87
107
|
* Already pointing at the same package: nothing changes (no audit; for a changed source item only,
|
|
88
108
|
* see below).
|
|
89
|
-
* `opts.catalogItemId`: the source item when installing through the
|
|
109
|
+
* `opts.catalogItemId`: the source item when installing through the platform catalog, stored
|
|
90
110
|
* in `extension_installs.catalog_item_id` (F-AA) and registered in `extension_catalog_sources`;
|
|
91
111
|
* installing outside the catalog (upload / npm / CLI) **keeps** the existing source items (T26
|
|
92
112
|
* fix: clearing them would let org enablement bypass catalog policy, C22). The detail of the
|
|
@@ -96,17 +116,18 @@ export declare class ExtensionAdminOps {
|
|
|
96
116
|
*/
|
|
97
117
|
install(name: string, sha256: string, actor: string | null, actorTokenId?: string, opts?: {
|
|
98
118
|
catalogItemId?: string;
|
|
119
|
+
owner?: ExtensionOpsOwner;
|
|
99
120
|
}): Promise<AdminExtensionView>;
|
|
100
121
|
private writeInstall;
|
|
101
122
|
/** Enable on the deployment (audit `extension.enabled`); no change when already enabled. Org enablement is unchanged. */
|
|
102
|
-
enable(name: string, actor: string | null, actorTokenId?: string): Promise<AdminExtensionView>;
|
|
123
|
+
enable(name: string, actor: string | null, actorTokenId?: string, owner?: ExtensionOpsOwner): Promise<AdminExtensionView>;
|
|
103
124
|
/**
|
|
104
125
|
* Disables on the deployment (audit `extension.disabled`); no change when already disabled. Every
|
|
105
126
|
* replica unloads it (draining in-flight calls), and the extensions that `requires` it unload with
|
|
106
127
|
* it; the org enablement switch is unchanged and the org page shows it as unavailable. A required
|
|
107
128
|
* bootstrap plugin -> `extension.required`.
|
|
108
129
|
*/
|
|
109
|
-
disable(name: string, actor: string | null, actorTokenId?: string): Promise<AdminExtensionView>;
|
|
130
|
+
disable(name: string, actor: string | null, actorTokenId?: string, owner?: ExtensionOpsOwner): Promise<AdminExtensionView>;
|
|
110
131
|
/**
|
|
111
132
|
* Uninstall: a required bootstrap plugin -> `extension.required`; must be disabled first
|
|
112
133
|
* (otherwise `extension.not_disabled`); deletes the install record
|
|
@@ -115,7 +136,7 @@ export declare class ExtensionAdminOps {
|
|
|
115
136
|
* permission snapshot and the package in the package store are untouched (a reinstall picks them
|
|
116
137
|
* up).
|
|
117
138
|
*/
|
|
118
|
-
uninstall(name: string, actor: string | null, actorTokenId?: string): Promise<void>;
|
|
139
|
+
uninstall(name: string, actor: string | null, actorTokenId?: string, owner?: ExtensionOpsOwner): Promise<void>;
|
|
119
140
|
private writeUninstall;
|
|
120
141
|
private setState;
|
|
121
142
|
private writeState;
|
|
@@ -123,6 +144,11 @@ export declare class ExtensionAdminOps {
|
|
|
123
144
|
* 提交后的视图:拼视图失败(读包、查状态行出错)时操作已经生效,不能再报失败——记 error,返回降级视图。
|
|
124
145
|
*/
|
|
125
146
|
private viewAfterCommit;
|
|
147
|
+
/**
|
|
148
|
+
* Re-checks the actor in the operation's transaction: a super admin, or for an owner's operation
|
|
149
|
+
* an admin of the owner org; no account (the CLI, the kernel itself) is not checked.
|
|
150
|
+
*/
|
|
151
|
+
private authorize;
|
|
126
152
|
/** 配置声明的插件不经安装记录管理。 */
|
|
127
153
|
private assertInstallable;
|
|
128
154
|
/** 按插件名串行(`PluginInstallLock`,覆盖「还没有行」的新装),再锁住已有的安装记录行。 */
|