@capybara-hq/kernel 0.1.0-rc.3 → 0.1.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bootstrap.json +61 -5
- package/dist/admin/admin.controller.d.ts +47 -16
- package/dist/admin/admin.controller.js +44 -19
- package/dist/admin/extensions.controller.d.ts +24 -3
- package/dist/admin/extensions.controller.js +48 -8
- package/dist/admin/setup-lock.d.ts +1 -1
- package/dist/admin/setup-lock.js +1 -1
- package/dist/admin/setup.controller.d.ts +1 -1
- package/dist/admin/setup.controller.js +1 -1
- package/dist/admin/setup.service.d.ts +4 -4
- package/dist/admin/setup.service.js +8 -8
- package/dist/agents/agent-lookup.d.ts +19 -0
- package/dist/agents/agent-lookup.js +21 -0
- package/dist/agents/agent-profile.service.d.ts +29 -0
- package/dist/agents/agent-profile.service.js +117 -0
- package/dist/agents/agents.controller.d.ts +168 -3
- package/dist/agents/agents.controller.js +201 -12
- package/dist/agents/agents.module.d.ts +4 -1
- package/dist/agents/agents.module.js +36 -6
- package/dist/agents/agents.service.d.ts +64 -27
- package/dist/agents/agents.service.js +199 -74
- package/dist/agents/definition.d.ts +53 -0
- package/dist/agents/definition.js +55 -0
- package/dist/agents/from-template.d.ts +106 -0
- package/dist/agents/from-template.js +649 -0
- package/dist/agents/from-template.service.d.ts +60 -0
- package/dist/agents/from-template.service.js +161 -0
- package/dist/agents/instruction-files.d.ts +60 -0
- package/dist/agents/instruction-files.js +111 -0
- package/dist/agents/models.controller.d.ts +9 -3
- package/dist/agents/models.controller.js +19 -4
- package/dist/agents/org-templates.d.ts +176 -0
- package/dist/agents/org-templates.js +827 -0
- package/dist/agents/pending-connector-requests.d.ts +77 -0
- package/dist/agents/pending-connector-requests.js +215 -0
- package/dist/agents/pending-connectors.controller.d.ts +39 -0
- package/dist/agents/pending-connectors.controller.js +91 -0
- package/dist/agents/pending-connectors.service.d.ts +62 -0
- package/dist/agents/pending-connectors.service.js +282 -0
- package/dist/agents/profile.d.ts +96 -0
- package/dist/agents/profile.js +51 -0
- package/dist/agents/readiness.controller.d.ts +26 -0
- package/dist/agents/readiness.controller.js +56 -0
- package/dist/agents/templates.controller.d.ts +86 -5
- package/dist/agents/templates.controller.js +171 -7
- package/dist/agents/templates.d.ts +127 -23
- package/dist/agents/templates.js +476 -53
- package/dist/background/background.controller.d.ts +38 -0
- package/dist/background/background.controller.js +87 -0
- package/dist/background/background.module.d.ts +10 -0
- package/dist/background/background.module.js +39 -0
- package/dist/background/finish.d.ts +44 -0
- package/dist/background/finish.js +94 -0
- package/dist/background/launch-lock.d.ts +15 -0
- package/dist/background/launch-lock.js +40 -0
- package/dist/background/launch.d.ts +36 -0
- package/dist/background/launch.js +70 -0
- package/dist/background/poll.job.d.ts +56 -0
- package/dist/background/poll.job.js +190 -0
- package/dist/background/render.d.ts +23 -0
- package/dist/background/render.js +48 -0
- package/dist/background/session.d.ts +48 -0
- package/dist/background/session.js +79 -0
- package/dist/background/status.d.ts +35 -0
- package/dist/background/status.js +57 -0
- package/dist/background/stop.d.ts +68 -0
- package/dist/background/stop.js +243 -0
- package/dist/background/store.d.ts +162 -0
- package/dist/background/store.js +357 -0
- package/dist/background/store.module.d.ts +6 -0
- package/dist/background/store.module.js +22 -0
- package/dist/background/tasks.service.d.ts +77 -0
- package/dist/background/tasks.service.js +211 -0
- package/dist/background/wake-rules.d.ts +66 -0
- package/dist/background/wake-rules.js +113 -0
- package/dist/background/wake.d.ts +30 -0
- package/dist/background/wake.js +63 -0
- package/dist/catalog/admin-catalog.controller.d.ts +129 -30
- package/dist/catalog/admin-catalog.controller.js +213 -42
- package/dist/catalog/catalog-content.d.ts +58 -32
- package/dist/catalog/catalog-content.js +34 -8
- package/dist/catalog/catalog-import.module.d.ts +7 -0
- package/dist/catalog/catalog-import.module.js +60 -0
- package/dist/catalog/catalog-items.d.ts +111 -7
- package/dist/catalog/catalog-items.js +279 -13
- package/dist/catalog/catalog-scope.service.d.ts +260 -0
- package/dist/catalog/catalog-scope.service.js +1116 -0
- package/dist/catalog/catalog.module.d.ts +7 -9
- package/dist/catalog/catalog.module.js +41 -31
- package/dist/catalog/catalog.service.d.ts +101 -29
- package/dist/catalog/catalog.service.js +104 -106
- package/dist/catalog/claude/agents.js +2 -0
- package/dist/catalog/cli.d.ts +11 -1
- package/dist/catalog/cli.js +26 -1
- package/dist/catalog/component-promotion.d.ts +96 -0
- package/dist/catalog/component-promotion.js +395 -0
- package/dist/catalog/component-scope.controller.d.ts +152 -0
- package/dist/catalog/component-scope.controller.js +287 -0
- package/dist/catalog/component-scope.service.d.ts +303 -0
- package/dist/catalog/component-scope.service.js +936 -0
- package/dist/catalog/component-state.d.ts +174 -0
- package/dist/catalog/component-state.js +437 -0
- package/dist/catalog/job-ids.d.ts +30 -0
- package/dist/catalog/job-ids.js +25 -0
- package/dist/catalog/marketplace-fetch.d.ts +1 -1
- package/dist/catalog/marketplaces.controller.d.ts +22 -5
- package/dist/catalog/marketplaces.controller.js +56 -7
- package/dist/catalog/marketplaces.service.d.ts +54 -14
- package/dist/catalog/marketplaces.service.js +71 -22
- package/dist/catalog/org-catalog.controller.d.ts +125 -34
- package/dist/catalog/org-catalog.controller.js +181 -65
- package/dist/catalog/org-catalog.service.d.ts +65 -33
- package/dist/catalog/org-catalog.service.js +324 -157
- package/dist/catalog/org-extension-switch.d.ts +41 -0
- package/dist/catalog/org-extension-switch.js +115 -0
- package/dist/catalog/org-extension.controller.d.ts +119 -0
- package/dist/catalog/org-extension.controller.js +266 -0
- package/dist/catalog/org-plugin-uploads.controller.d.ts +98 -0
- package/dist/catalog/org-plugin-uploads.controller.js +213 -0
- package/dist/catalog/org-plugin-uploads.d.ts +63 -0
- package/dist/catalog/org-plugin-uploads.js +116 -0
- package/dist/catalog/owned-items.d.ts +184 -0
- package/dist/catalog/owned-items.js +789 -0
- package/dist/catalog/owned-plugin-cleanup.d.ts +56 -0
- package/dist/catalog/owned-plugin-cleanup.js +194 -0
- package/dist/catalog/ownership.d.ts +172 -0
- package/dist/catalog/ownership.js +326 -0
- package/dist/catalog/platform-components.d.ts +221 -0
- package/dist/catalog/platform-components.js +761 -0
- package/dist/catalog/platform-migration.d.ts +115 -0
- package/dist/catalog/platform-migration.js +582 -0
- package/dist/catalog/plugin-import.d.ts +178 -34
- package/dist/catalog/plugin-import.js +623 -83
- package/dist/catalog/plugin-install.d.ts +185 -41
- package/dist/catalog/plugin-install.js +758 -126
- package/dist/catalog/plugin-upgrade.d.ts +260 -225
- package/dist/catalog/plugin-upgrade.js +1148 -1137
- package/dist/catalog/request-rules.d.ts +65 -0
- package/dist/catalog/request-rules.js +217 -0
- package/dist/catalog/requests.service.d.ts +193 -118
- package/dist/catalog/requests.service.js +526 -343
- package/dist/catalog/reserved-names.d.ts +8 -0
- package/dist/catalog/reserved-names.js +42 -0
- package/dist/catalog/scope-orgs.d.ts +21 -0
- package/dist/catalog/scope-orgs.js +67 -0
- package/dist/catalog/scope-state.d.ts +35 -0
- package/dist/catalog/scope-state.js +87 -0
- package/dist/catalog/scope-sync-workers.d.ts +7 -0
- package/dist/catalog/scope-sync-workers.js +29 -0
- package/dist/catalog/scope-sync.d.ts +176 -0
- package/dist/catalog/scope-sync.js +576 -0
- package/dist/catalog/scope.d.ts +42 -0
- package/dist/catalog/scope.js +42 -0
- package/dist/catalog/unshare.d.ts +22 -0
- package/dist/catalog/unshare.js +118 -0
- package/dist/channels/actions.js +1 -0
- package/dist/channels/cards.js +21 -3
- package/dist/channels/channels.module.js +2 -0
- package/dist/channels/connections.service.d.ts +16 -1
- package/dist/channels/connections.service.js +38 -4
- package/dist/channels/inbound.d.ts +9 -1
- package/dist/channels/inbound.js +67 -5
- package/dist/channels/phrases.d.ts +35 -0
- package/dist/channels/phrases.js +29 -0
- package/dist/channels/threads.d.ts +5 -0
- package/dist/channels/threads.js +8 -0
- package/dist/config/docs.js +3 -1
- package/dist/config/schema.d.ts +24 -2
- package/dist/config/schema.js +145 -19
- package/dist/conversations/access.d.ts +6 -4
- package/dist/conversations/access.js +29 -5
- package/dist/conversations/agent-tree.d.ts +46 -0
- package/dist/conversations/agent-tree.js +92 -0
- package/dist/conversations/attachments.service.d.ts +30 -0
- package/dist/conversations/attachments.service.js +130 -5
- package/dist/conversations/conversations.controller.d.ts +79 -23
- package/dist/conversations/conversations.controller.js +141 -50
- package/dist/conversations/conversations.module.d.ts +1 -1
- package/dist/conversations/conversations.module.js +10 -7
- package/dist/conversations/conversations.service.d.ts +108 -9
- package/dist/conversations/conversations.service.js +237 -30
- package/dist/conversations/environment-status.d.ts +24 -0
- package/dist/conversations/environment-status.js +71 -0
- package/dist/conversations/event-log.d.ts +21 -6
- package/dist/conversations/event-log.js +70 -1
- package/dist/conversations/events.d.ts +140 -0
- package/dist/conversations/events.js +142 -13
- package/dist/conversations/queue.d.ts +3 -1
- package/dist/conversations/queue.js +13 -2
- package/dist/conversations/queue.service.d.ts +1 -1
- package/dist/conversations/queue.service.js +8 -1
- package/dist/conversations/titles.d.ts +12 -3
- package/dist/conversations/titles.js +36 -8
- package/dist/conversations/tree.d.ts +17 -0
- package/dist/conversations/tree.js +42 -0
- package/dist/ctx/create-ctx.d.ts +5 -0
- package/dist/ctx/create-ctx.js +15 -5
- package/dist/db/kernel-schema.d.ts +420 -20
- package/dist/db/pool.d.ts +5 -0
- package/dist/db/pool.js +3 -0
- package/dist/environments/access.d.ts +41 -0
- package/dist/environments/access.js +77 -0
- package/dist/environments/conversation-environments.d.ts +61 -0
- package/dist/environments/conversation-environments.js +170 -0
- package/dist/environments/dto.d.ts +25 -0
- package/dist/environments/dto.js +12 -0
- package/dist/environments/environments.controller.d.ts +33 -0
- package/dist/environments/environments.controller.js +110 -0
- package/dist/environments/environments.module.d.ts +8 -0
- package/dist/environments/environments.module.js +27 -0
- package/dist/environments/environments.service.d.ts +153 -0
- package/dist/environments/environments.service.js +541 -0
- package/dist/environments/legacy-cleanup.job.d.ts +34 -0
- package/dist/environments/legacy-cleanup.job.js +141 -0
- package/dist/errors.d.ts +90 -2
- package/dist/errors.js +90 -2
- package/dist/evals/reconstruct.d.ts +18 -9
- package/dist/evals/reconstruct.js +26 -7
- package/dist/evals/run-replay.d.ts +7 -2
- package/dist/evals/run-replay.js +42 -7
- package/dist/evals/step-replay.d.ts +2 -5
- package/dist/evals/step-replay.js +13 -7
- package/dist/evals/trajectory.js +1 -1
- package/dist/evals/trajectory.service.d.ts +8 -3
- package/dist/evals/trajectory.service.js +26 -14
- package/dist/evals/worker.d.ts +5 -5
- package/dist/evals/worker.js +9 -3
- package/dist/extensions/admin-ops.d.ts +36 -10
- package/dist/extensions/admin-ops.js +67 -42
- package/dist/extensions/admin-view.d.ts +39 -10
- package/dist/extensions/admin-view.js +111 -20
- package/dist/extensions/blobs.js +1 -0
- package/dist/extensions/bootstrap.d.ts +17 -4
- package/dist/extensions/bootstrap.js +70 -9
- package/dist/extensions/cli.d.ts +12 -0
- package/dist/extensions/cli.js +11 -2
- package/dist/extensions/config-issues.d.ts +13 -1
- package/dist/extensions/config-issues.js +22 -5
- package/dist/extensions/config-json-schema.d.ts +43 -7
- package/dist/extensions/config-json-schema.js +124 -58
- package/dist/extensions/deployment-config-store.d.ts +6 -0
- package/dist/extensions/deployment-config.d.ts +78 -8
- package/dist/extensions/deployment-config.js +172 -34
- package/dist/extensions/display-name.d.ts +22 -0
- package/dist/extensions/display-name.js +77 -0
- package/dist/extensions/effective-config.d.ts +127 -0
- package/dist/extensions/effective-config.js +368 -0
- package/dist/extensions/extensions.module.js +14 -2
- package/dist/extensions/hooks.d.ts +37 -4
- package/dist/extensions/hooks.js +82 -16
- package/dist/extensions/host.d.ts +45 -2
- package/dist/extensions/host.js +112 -16
- package/dist/extensions/installs.d.ts +20 -8
- package/dist/extensions/installs.js +37 -15
- package/dist/extensions/org-config.d.ts +81 -6
- package/dist/extensions/org-config.js +195 -44
- package/dist/extensions/org-levels.d.ts +37 -0
- package/dist/extensions/org-levels.js +71 -0
- package/dist/extensions/org-overrides.d.ts +151 -0
- package/dist/extensions/org-overrides.js +524 -0
- package/dist/extensions/package.d.ts +14 -1
- package/dist/extensions/package.js +51 -2
- package/dist/extensions/permission-view.d.ts +19 -4
- package/dist/extensions/permission-view.js +4 -4
- package/dist/extensions/plugin-items.d.ts +21 -0
- package/dist/extensions/plugin-items.js +42 -0
- package/dist/extensions/point-defaults.controller.d.ts +34 -0
- package/dist/extensions/point-defaults.controller.js +71 -0
- package/dist/extensions/point-defaults.d.ts +71 -0
- package/dist/extensions/point-defaults.js +234 -0
- package/dist/extensions/registry.d.ts +1 -1
- package/dist/extensions/registry.js +2 -0
- package/dist/extensions/resolve.d.ts +5 -1
- package/dist/extensions/resolve.js +15 -2
- package/dist/files/previewers.d.ts +8 -1
- package/dist/files/previewers.js +35 -6
- package/dist/http/api.module.js +31 -3
- package/dist/http/app.d.ts +11 -2
- package/dist/http/app.js +31 -5
- package/dist/http/nest-logger.d.ts +6 -5
- package/dist/http/nest-logger.js +24 -10
- package/dist/identity/accounts.d.ts +29 -29
- package/dist/identity/accounts.js +47 -47
- package/dist/identity/audit.d.ts +2 -1
- package/dist/identity/auth.controller.js +9 -5
- package/dist/identity/auth.guard.d.ts +13 -5
- package/dist/identity/auth.guard.js +26 -9
- package/dist/identity/cookies.d.ts +20 -5
- package/dist/identity/cookies.js +44 -6
- package/dist/identity/identity.module.d.ts +1 -1
- package/dist/identity/identity.module.js +4 -4
- package/dist/identity/me.controller.d.ts +5 -1
- package/dist/identity/me.controller.js +12 -3
- package/dist/identity/principal.d.ts +3 -3
- package/dist/identity/principal.js +3 -3
- package/dist/identity/sessions.d.ts +12 -0
- package/dist/identity/sessions.js +45 -0
- package/dist/identity/settings.d.ts +22 -11
- package/dist/identity/settings.js +53 -18
- package/dist/identity/{enterprise-admin.d.ts → super-admin.d.ts} +5 -5
- package/dist/identity/{enterprise-admin.js → super-admin.js} +24 -24
- package/dist/inbox/inbox.module.d.ts +4 -1
- package/dist/inbox/inbox.module.js +7 -3
- package/dist/inbox/inbox.service.d.ts +62 -3
- package/dist/inbox/inbox.service.js +74 -4
- package/dist/inbox/org-notices.d.ts +63 -0
- package/dist/inbox/org-notices.js +91 -0
- package/dist/inbox/platform-inbox.controller.d.ts +23 -0
- package/dist/inbox/platform-inbox.controller.js +58 -0
- package/dist/inbox/platform-inbox.service.d.ts +151 -0
- package/dist/inbox/platform-inbox.service.js +263 -0
- package/dist/inbox/platform-notices.d.ts +19 -0
- package/dist/inbox/platform-notices.js +9 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/infra/cli/kernel-cli.module.js +9 -1
- package/dist/infra/config/kernel-config.service.js +27 -1
- package/dist/infra/database/database.module.js +1 -0
- package/dist/infra/database/xact-lock.d.ts +1 -1
- package/dist/infra/database/xact-lock.js +1 -1
- package/dist/infra/events/kernel-events.d.ts +19 -2
- package/dist/infra/lifecycle/process-guards.js +4 -0
- package/dist/infra/logging/logging.module.d.ts +4 -2
- package/dist/infra/logging/logging.module.js +24 -6
- package/dist/infra/queue/add-job-once.d.ts +14 -0
- package/dist/infra/queue/add-job-once.js +16 -0
- package/dist/infra/queue/redis-connection.d.ts +6 -0
- package/dist/infra/queue/redis-connection.js +7 -0
- package/dist/infra/redis/redis.module.js +6 -2
- package/dist/infra/tokens.d.ts +6 -1
- package/dist/infra/tokens.js +6 -1
- package/dist/kernel.module.js +6 -0
- package/dist/lifecycle/kernel-lifecycle.d.ts +1 -1
- package/dist/lifecycle/kernel-lifecycle.js +4 -4
- package/dist/log.d.ts +13 -1
- package/dist/log.js +93 -17
- package/dist/models/prices.d.ts +5 -5
- package/dist/models/prices.js +4 -4
- package/dist/models/purposes.controller.d.ts +6 -4
- package/dist/models/purposes.controller.js +13 -7
- package/dist/models/purposes.d.ts +43 -9
- package/dist/models/purposes.js +48 -18
- package/dist/orgs/directory-sync.d.ts +14 -5
- package/dist/orgs/directory-sync.js +41 -17
- package/dist/orgs/offboarding.d.ts +12 -8
- package/dist/orgs/offboarding.js +54 -33
- package/dist/orgs/org-lock.d.ts +5 -0
- package/dist/orgs/org-lock.js +13 -0
- package/dist/orgs/org.guard.d.ts +10 -0
- package/dist/orgs/org.guard.js +43 -32
- package/dist/orgs/orgs.module.js +3 -0
- package/dist/orgs/orgs.service.d.ts +20 -7
- package/dist/orgs/orgs.service.js +32 -12
- package/dist/orgs/roles.d.ts +1 -1
- package/dist/orgs/roles.js +5 -1
- package/dist/orgs/settings.controller.d.ts +1 -1
- package/dist/orgs/settings.service.d.ts +20 -3
- package/dist/orgs/settings.service.js +19 -4
- package/dist/overrides.d.ts +3 -0
- package/dist/overrides.js +2 -0
- package/dist/platform/actor.d.ts +48 -0
- package/dist/platform/actor.js +100 -0
- package/dist/platform/agent-docs.d.ts +18 -0
- package/dist/platform/agent-docs.js +59 -0
- package/dist/platform/availability.d.ts +14 -0
- package/dist/platform/availability.js +43 -0
- package/dist/platform/errors.d.ts +11 -0
- package/dist/platform/errors.js +26 -0
- package/dist/platform/exclusions.d.ts +12 -0
- package/dist/platform/exclusions.js +1387 -0
- package/dist/platform/method.d.ts +6 -0
- package/dist/platform/method.js +15 -0
- package/dist/platform/operation.d.ts +92 -0
- package/dist/platform/operation.js +35 -0
- package/dist/platform/ops/agent-templates.ops.d.ts +14 -0
- package/dist/platform/ops/agent-templates.ops.js +92 -0
- package/dist/platform/ops/agents.ops.d.ts +19 -0
- package/dist/platform/ops/agents.ops.js +294 -0
- package/dist/platform/ops/connectors.ops.d.ts +15 -0
- package/dist/platform/ops/connectors.ops.js +126 -0
- package/dist/platform/ops/errors.d.ts +11 -0
- package/dist/platform/ops/errors.js +22 -0
- package/dist/platform/ops/extensions.ops.d.ts +19 -0
- package/dist/platform/ops/extensions.ops.js +116 -0
- package/dist/platform/ops/marketplaces.ops.d.ts +16 -0
- package/dist/platform/ops/marketplaces.ops.js +157 -0
- package/dist/platform/ops/paging.d.ts +14 -0
- package/dist/platform/ops/paging.js +20 -0
- package/dist/platform/ops/platform.ops.d.ts +23 -0
- package/dist/platform/ops/platform.ops.js +158 -0
- package/dist/platform/ops/plugins.ops.d.ts +33 -0
- package/dist/platform/ops/plugins.ops.js +377 -0
- package/dist/platform/ops/requests.ops.d.ts +14 -0
- package/dist/platform/ops/requests.ops.js +153 -0
- package/dist/platform/ops/role.d.ts +4 -0
- package/dist/platform/ops/role.js +10 -0
- package/dist/platform/ops/skills.ops.d.ts +13 -0
- package/dist/platform/ops/skills.ops.js +98 -0
- package/dist/platform/ops/summary.d.ts +10 -0
- package/dist/platform/ops/summary.js +18 -0
- package/dist/platform/platform-ops.module.d.ts +7 -0
- package/dist/platform/platform-ops.module.js +55 -0
- package/dist/platform/platform.module.d.ts +8 -0
- package/dist/platform/platform.module.js +25 -0
- package/dist/platform/redact-orgs.d.ts +7 -0
- package/dist/platform/redact-orgs.js +52 -0
- package/dist/platform/registry.d.ts +30 -0
- package/dist/platform/registry.js +111 -0
- package/dist/roles/worker-role.d.ts +6 -4
- package/dist/roles/worker-role.js +14 -7
- package/dist/roles/worker.module.d.ts +1 -1
- package/dist/roles/worker.module.js +15 -1
- package/dist/runtime/context/build.d.ts +11 -7
- package/dist/runtime/context/build.js +46 -19
- package/dist/runtime/context/claude-tools.d.ts +3 -1
- package/dist/runtime/context/claude-tools.js +8 -6
- package/dist/runtime/context/compaction.js +13 -0
- package/dist/runtime/context/reminders.d.ts +2 -0
- package/dist/runtime/context/reminders.js +2 -0
- package/dist/runtime/context/skills.js +9 -2
- package/dist/runtime/context/tool-changes.d.ts +27 -0
- package/dist/runtime/context/tool-changes.js +60 -0
- package/dist/runtime/hook-calls.js +2 -0
- package/dist/runtime/langgraph-loop.d.ts +3 -1
- package/dist/runtime/langgraph-loop.js +36 -17
- package/dist/runtime/loop.d.ts +34 -5
- package/dist/runtime/maintenance.d.ts +9 -4
- package/dist/runtime/maintenance.js +35 -8
- package/dist/runtime/model-call.d.ts +46 -8
- package/dist/runtime/model-call.js +72 -21
- package/dist/runtime/providers.d.ts +6 -0
- package/dist/runtime/providers.js +8 -0
- package/dist/runtime/run-control.d.ts +11 -1
- package/dist/runtime/run-control.js +12 -0
- package/dist/runtime/run-drafts.d.ts +85 -0
- package/dist/runtime/run-drafts.js +230 -0
- package/dist/runtime/run-jobs.d.ts +3 -5
- package/dist/runtime/run-jobs.js +3 -7
- package/dist/runtime/run-queue.d.ts +59 -2
- package/dist/runtime/run-queue.js +311 -38
- package/dist/runtime/run-worker.d.ts +11 -5
- package/dist/runtime/run-worker.js +69 -33
- package/dist/runtime/runtime.module.js +11 -3
- package/dist/runtime/step-log.d.ts +15 -4
- package/dist/runtime/step-log.js +24 -7
- package/dist/runtime/stream.controller.d.ts +23 -1
- package/dist/runtime/stream.controller.js +60 -3
- package/dist/runtime/stream.d.ts +4 -1
- package/dist/runtime/stream.js +27 -3
- package/dist/runtime/subagents/child.d.ts +55 -7
- package/dist/runtime/subagents/child.js +105 -7
- package/dist/runtime/subagents/definition.d.ts +12 -3
- package/dist/runtime/subagents/definition.js +44 -28
- package/dist/runtime/subagents/deliveries.d.ts +71 -0
- package/dist/runtime/subagents/deliveries.js +228 -0
- package/dist/runtime/subagents/dispatch.d.ts +115 -26
- package/dist/runtime/subagents/dispatch.js +212 -141
- package/dist/runtime/subagents/limits.d.ts +24 -5
- package/dist/runtime/subagents/limits.js +40 -6
- package/dist/runtime/subagents/messages.d.ts +95 -0
- package/dist/runtime/subagents/messages.js +328 -0
- package/dist/runtime/subagents/preamble.d.ts +4 -4
- package/dist/runtime/subagents/preamble.js +9 -7
- package/dist/runtime/subagents/progress.d.ts +8 -6
- package/dist/runtime/subagents/progress.js +11 -6
- package/dist/runtime/subagents/render.d.ts +30 -0
- package/dist/runtime/subagents/render.js +53 -0
- package/dist/runtime/subagents/roster.d.ts +24 -7
- package/dist/runtime/subagents/roster.js +47 -11
- package/dist/runtime/subagents/skill-fork.d.ts +3 -2
- package/dist/runtime/subagents/skill-fork.js +8 -4
- package/dist/runtime/subagents/status.d.ts +14 -0
- package/dist/runtime/subagents/status.js +23 -0
- package/dist/runtime/subagents/subagents.service.d.ts +7 -4
- package/dist/runtime/subagents/subagents.service.js +11 -6
- package/dist/runtime/usage-report.d.ts +2 -1
- package/dist/runtime/usage-report.js +19 -13
- package/dist/runtime/waits.d.ts +145 -36
- package/dist/runtime/waits.js +423 -109
- package/dist/sandbox/jobs.d.ts +40 -13
- package/dist/sandbox/jobs.js +57 -20
- package/dist/sandbox/leases.d.ts +37 -54
- package/dist/sandbox/leases.js +71 -115
- package/dist/sandbox/providers.d.ts +2 -2
- package/dist/sandbox/providers.js +1 -1
- package/dist/sandbox/sandbox.module.d.ts +3 -2
- package/dist/sandbox/sandbox.module.js +10 -4
- package/dist/sandbox/sandbox.service.d.ts +282 -129
- package/dist/sandbox/sandbox.service.js +736 -381
- package/dist/skills/catalog.d.ts +3 -2
- package/dist/skills/catalog.js +21 -43
- package/dist/skills/changes.controller.d.ts +7 -0
- package/dist/skills/changes.controller.js +19 -1
- package/dist/skills/invoke.js +8 -3
- package/dist/skills/package.d.ts +20 -1
- package/dist/skills/package.js +28 -1
- package/dist/skills/skills.controller.d.ts +39 -4
- package/dist/skills/skills.controller.js +88 -10
- package/dist/skills/skills.module.js +10 -1
- package/dist/skills/skills.service.d.ts +106 -26
- package/dist/skills/skills.service.js +421 -75
- package/dist/skills/usable.d.ts +81 -0
- package/dist/skills/usable.js +379 -0
- package/dist/tools/approvals.service.d.ts +20 -2
- package/dist/tools/approvals.service.js +25 -4
- package/dist/tools/builtin-names.d.ts +41 -7
- package/dist/tools/builtin-names.js +59 -7
- package/dist/tools/builtins/agent.d.ts +23 -21
- package/dist/tools/builtins/agent.js +62 -55
- package/dist/tools/builtins/builtin-tools.d.ts +19 -1
- package/dist/tools/builtins/builtin-tools.js +59 -2
- package/dist/tools/builtins/handback.d.ts +28 -0
- package/dist/tools/builtins/handback.js +53 -0
- package/dist/tools/builtins/platform.d.ts +34 -0
- package/dist/tools/builtins/platform.js +362 -0
- package/dist/tools/builtins/sandbox/bash.d.ts +1 -1
- package/dist/tools/builtins/sandbox/bash.js +241 -4
- package/dist/tools/builtins/sandbox/common.d.ts +69 -27
- package/dist/tools/builtins/sandbox/common.js +87 -48
- package/dist/tools/builtins/sandbox/deliver.js +1 -1
- package/dist/tools/builtins/sandbox/edit.js +2 -2
- package/dist/tools/builtins/sandbox/glob.js +2 -2
- package/dist/tools/builtins/sandbox/grep.js +2 -4
- package/dist/tools/builtins/sandbox/index.d.ts +3 -1
- package/dist/tools/builtins/sandbox/index.js +7 -1
- package/dist/tools/builtins/sandbox/read.js +1 -1
- package/dist/tools/builtins/sandbox/task-output.d.ts +74 -0
- package/dist/tools/builtins/sandbox/task-output.js +329 -0
- package/dist/tools/builtins/sandbox/task-stop.d.ts +10 -0
- package/dist/tools/builtins/sandbox/task-stop.js +113 -0
- package/dist/tools/builtins/sandbox/write.js +2 -2
- package/dist/tools/builtins/send-message.d.ts +56 -0
- package/dist/tools/builtins/send-message.js +100 -0
- package/dist/tools/builtins/skill-load.d.ts +22 -14
- package/dist/tools/builtins/skill-load.js +86 -57
- package/dist/tools/builtins/skill-write.js +1 -1
- package/dist/tools/builtins/web/errors.d.ts +8 -0
- package/dist/tools/builtins/web/errors.js +53 -0
- package/dist/tools/builtins/web/extract.d.ts +62 -0
- package/dist/tools/builtins/web/extract.js +271 -0
- package/dist/tools/builtins/web/fetch.d.ts +55 -0
- package/dist/tools/builtins/web/fetch.js +175 -0
- package/dist/tools/builtins/web/index.d.ts +13 -0
- package/dist/tools/builtins/web/index.js +12 -0
- package/dist/tools/builtins/web/page-cache.d.ts +25 -0
- package/dist/tools/builtins/web/page-cache.js +77 -0
- package/dist/tools/builtins/web/search.d.ts +25 -0
- package/dist/tools/builtins/web/search.js +210 -0
- package/dist/tools/builtins/web/url.d.ts +17 -0
- package/dist/tools/builtins/web/url.js +43 -0
- package/dist/tools/connectors.controller.d.ts +10 -0
- package/dist/tools/connectors.controller.js +12 -0
- package/dist/tools/connectors.service.d.ts +46 -5
- package/dist/tools/connectors.service.js +94 -15
- package/dist/tools/extension-tools.controller.d.ts +14 -0
- package/dist/tools/extension-tools.controller.js +37 -0
- package/dist/tools/info.d.ts +42 -1
- package/dist/tools/info.js +64 -1
- package/dist/tools/oauth/flow-paths.d.ts +1 -1
- package/dist/tools/oauth/flow-paths.js +1 -1
- package/dist/tools/org-tool-switches.d.ts +74 -0
- package/dist/tools/org-tool-switches.js +184 -0
- package/dist/tools/pipeline.d.ts +46 -40
- package/dist/tools/pipeline.js +202 -364
- package/dist/tools/policy.d.ts +1 -1
- package/dist/tools/policy.js +36 -16
- package/dist/tools/registry.d.ts +120 -8
- package/dist/tools/registry.js +112 -19
- package/dist/tools/tools.module.js +24 -2
- package/dist/tools/validate.js +1 -1
- package/dist/ui/views.d.ts +2 -1
- package/dist/ui/views.js +17 -3
- package/package.json +3 -3
- package/src/migrations/0064_account_last_org.sql +7 -0
- package/src/migrations/0065_conversation_archive.sql +8 -0
- package/src/migrations/0066_extension_display_name.sql +4 -0
- package/src/migrations/0067_agent_profiles.sql +20 -0
- package/src/migrations/0068_agent_avatar_uploads.sql +7 -0
- package/src/migrations/0069_attachments_agent_idx.sql +3 -0
- package/src/migrations/0070_background_tasks.sql +37 -0
- package/src/migrations/0071_background_tasks_reserve.sql +6 -0
- package/src/migrations/0072_background_tasks_stopping.sql +5 -0
- package/src/migrations/0073_org_extension_point_defaults.sql +11 -0
- package/src/migrations/0074_subagent_tree.sql +50 -0
- package/src/migrations/0075_plugin_scope.sql +61 -0
- package/src/migrations/0076_skills_created_by_nullable.sql +6 -0
- package/src/migrations/0077_scope_requests.sql +52 -0
- package/src/migrations/0078_scope_grant_switches.sql +18 -0
- package/src/migrations/0079_scope_live_install_switches.sql +19 -0
- package/src/migrations/0080_rename_enterprise_admin.sql +18 -0
- package/src/migrations/0081_platform_components.sql +129 -0
- package/src/migrations/0082_platform_migration.sql +33 -0
- package/src/migrations/0083_plugin_scope_sync_failures.sql +15 -0
- package/src/migrations/0084_org_owned_items.sql +85 -0
- package/src/migrations/0085_agent_templates_phase4.sql +45 -0
- package/src/migrations/0086_org_layering.sql +30 -0
- package/src/migrations/0087_approval_summary.sql +6 -0
- package/src/migrations/0088_environments.sql +80 -0
- package/dist/catalog/upgrade-targets.d.ts +0 -56
- package/dist/catalog/upgrade-targets.js +0 -90
- package/dist/conversations/sandbox-status.d.ts +0 -24
- package/dist/conversations/sandbox-status.js +0 -52
- package/dist/extensions/org-config.controller.d.ts +0 -24
- package/dist/extensions/org-config.controller.js +0 -62
package/dist/evals/run-replay.js
CHANGED
|
@@ -13,6 +13,7 @@ import { Inject, Injectable } from "@nestjs/common";
|
|
|
13
13
|
import { sql } from "kysely";
|
|
14
14
|
import { normalizeStoredDefinition } from "../agents/definition.js";
|
|
15
15
|
import { EventLog } from "../conversations/event-log.js";
|
|
16
|
+
import { isAbsorbable, } from "../conversations/events.js";
|
|
16
17
|
import { ApiError } from "../errors.js";
|
|
17
18
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
18
19
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
@@ -260,6 +261,29 @@ function absorbedByStep(s) {
|
|
|
260
261
|
}
|
|
261
262
|
return out;
|
|
262
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* The replayed run's boundary (`trigger_seq`): a wake run's recorded one (`run_started.triggerSeq`,
|
|
266
|
+
* background Bash spec §3, agent map spec §5.3); otherwise the newest message after `consumed`, else the newest finish
|
|
267
|
+
* after it that could have woken the run (not reported, no `stoppedBy`), else the last
|
|
268
|
+
* message (old logs, as before).
|
|
269
|
+
*/
|
|
270
|
+
function replayTrigger(started, seeds, consumed) {
|
|
271
|
+
const recorded = started;
|
|
272
|
+
if ((recorded.trigger === "background_task" || recorded.trigger === "subagent") &&
|
|
273
|
+
recorded.triggerSeq !== undefined) {
|
|
274
|
+
return recorded.triggerSeq;
|
|
275
|
+
}
|
|
276
|
+
const lastMessage = seeds.findLast((e) => e.type === "user_message")?.seq;
|
|
277
|
+
if (lastMessage !== undefined && lastMessage > consumed)
|
|
278
|
+
return lastMessage;
|
|
279
|
+
const wake = seeds.findLast((e) => {
|
|
280
|
+
if (e.type !== "background_task_finished" || e.seq <= consumed)
|
|
281
|
+
return false;
|
|
282
|
+
const p = e.payload;
|
|
283
|
+
return !p.reported && p.stoppedBy === undefined;
|
|
284
|
+
})?.seq;
|
|
285
|
+
return wake ?? lastMessage ?? 0;
|
|
286
|
+
}
|
|
263
287
|
const readAll = async (eventLog, conversationId) => {
|
|
264
288
|
const out = [];
|
|
265
289
|
let after = 0;
|
|
@@ -294,7 +318,7 @@ export async function replayRun(d, s, candidate, evalRunId, signal) {
|
|
|
294
318
|
consumed = Math.max(consumed, e.payload.consumedUpToSeq);
|
|
295
319
|
}
|
|
296
320
|
}
|
|
297
|
-
const trigger =
|
|
321
|
+
const trigger = replayTrigger(start.payload, seeds, consumed);
|
|
298
322
|
const catalog = s.events.find((e) => e.runId === s.runId && e.type === "skills_catalog" && e.seq > R);
|
|
299
323
|
// a sub-agent's case (spec §15.3) runs the effective definition frozen in its subagent_started
|
|
300
324
|
// (the request renders that event's preamble and instructions; its tools come from it too), with
|
|
@@ -307,6 +331,10 @@ export async function replayRun(d, s, candidate, evalRunId, signal) {
|
|
|
307
331
|
model: candidate.model,
|
|
308
332
|
modelParams: candidate.params,
|
|
309
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;
|
|
310
338
|
const conversationId = randomUUID();
|
|
311
339
|
const runId = randomUUID();
|
|
312
340
|
await d.seeder.seed({
|
|
@@ -427,7 +455,8 @@ export async function replayRun(d, s, candidate, evalRunId, signal) {
|
|
|
427
455
|
return "stop";
|
|
428
456
|
},
|
|
429
457
|
});
|
|
430
|
-
//
|
|
458
|
+
// 插话:原运行开始之后到达、且被原运行某一步吸收的可吸收事件(user_message /
|
|
459
|
+
// background_task_finished / subagent_delivery)
|
|
431
460
|
const absorbed = absorbedByStep(s);
|
|
432
461
|
const stepsInOrder = [...absorbed.keys()].sort((a, b) => a - b);
|
|
433
462
|
/** 第 k 步(含)之前原运行吸收到的最大位置;原运行没有模型调用时不设限。 */
|
|
@@ -442,7 +471,10 @@ export async function replayRun(d, s, candidate, evalRunId, signal) {
|
|
|
442
471
|
return cap;
|
|
443
472
|
};
|
|
444
473
|
const interjections = s.events
|
|
445
|
-
.filter((e) => e.type === "user_message"
|
|
474
|
+
.filter((e) => (e.type === "user_message" ||
|
|
475
|
+
e.type === "background_task_finished" ||
|
|
476
|
+
e.type === "subagent_delivery") &&
|
|
477
|
+
e.seq > R)
|
|
446
478
|
.flatMap((e) => {
|
|
447
479
|
const step = stepsInOrder.find((k) => absorbed.get(k) >= e.seq);
|
|
448
480
|
return step === undefined ? [] : [{ event: e, step }];
|
|
@@ -450,7 +482,7 @@ export async function replayRun(d, s, candidate, evalRunId, signal) {
|
|
|
450
482
|
/** 已追加的插话:原 seq → 评测对话里的 seq。 */
|
|
451
483
|
const fed = new Map();
|
|
452
484
|
let prepared = 0;
|
|
453
|
-
const
|
|
485
|
+
const pendingAbsorbable = async (afterSeq) => {
|
|
454
486
|
prepared++;
|
|
455
487
|
// loop 的步骤从 1 起(与运行时相同),每步的 prepare 调用一次:第 n 次调用即第 n 步
|
|
456
488
|
const k = prepared;
|
|
@@ -459,7 +491,7 @@ export async function replayRun(d, s, candidate, evalRunId, signal) {
|
|
|
459
491
|
continue;
|
|
460
492
|
const [w] = await eventLog.append(conversationId, [
|
|
461
493
|
{
|
|
462
|
-
type:
|
|
494
|
+
type: x.event.type,
|
|
463
495
|
idemKey: `replay_interjection:${runId}:${x.event.seq}`,
|
|
464
496
|
payload: x.event.payload,
|
|
465
497
|
},
|
|
@@ -471,7 +503,7 @@ export async function replayRun(d, s, candidate, evalRunId, signal) {
|
|
|
471
503
|
const fedSeqs = new Set(fed.values());
|
|
472
504
|
const out = [];
|
|
473
505
|
for (const e of await readAll(eventLog, conversationId)) {
|
|
474
|
-
if (e
|
|
506
|
+
if (!isAbsorbable(e) || e.seq <= afterSeq)
|
|
475
507
|
continue;
|
|
476
508
|
if (fedSeqs.has(e.seq) || (e.seq < R && e.seq <= cap))
|
|
477
509
|
out.push(e);
|
|
@@ -502,13 +534,16 @@ export async function replayRun(d, s, candidate, evalRunId, signal) {
|
|
|
502
534
|
signal: loopSignal,
|
|
503
535
|
shutdown: new AbortController().signal,
|
|
504
536
|
sink: () => { },
|
|
505
|
-
|
|
537
|
+
pendingAbsorbable,
|
|
506
538
|
limits: {
|
|
507
539
|
maxSteps: subagent === undefined ? runtime.maxSteps : Math.min(subagent.maxSteps, runtime.maxSteps),
|
|
508
540
|
deadline,
|
|
509
541
|
},
|
|
510
542
|
// replays never fire plugin hooks (the loop deps omit them too, P-18)
|
|
511
543
|
conversationKind: "eval",
|
|
544
|
+
// a child case offers a sub-agent's message tools, as its recorded requests did (a fork
|
|
545
|
+
// invocation's child, whose run a task with the invocation record started, has none)
|
|
546
|
+
...(subagent !== undefined && !forkRun && { subagent: true }),
|
|
512
547
|
});
|
|
513
548
|
}
|
|
514
549
|
catch (e) {
|
|
@@ -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.
|
|
@@ -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()
|
|
@@ -54,10 +54,9 @@ subagent) {
|
|
|
54
54
|
? { ...(from.modelParams ?? {}) }
|
|
55
55
|
: {});
|
|
56
56
|
const definition = {
|
|
57
|
-
...from,
|
|
57
|
+
...withInstructions(from, c.instructions),
|
|
58
58
|
model,
|
|
59
59
|
modelParams: params,
|
|
60
|
-
...(c.instructions !== undefined && { instructions: c.instructions }),
|
|
61
60
|
};
|
|
62
61
|
const changed = agentVersion !== base.agentVersion ||
|
|
63
62
|
!sameModel(model, base.definition.model) ||
|
|
@@ -73,13 +72,20 @@ subagent) {
|
|
|
73
72
|
changed,
|
|
74
73
|
overridesSwitch,
|
|
75
74
|
...(otherVersion && {
|
|
76
|
-
subagentVersion:
|
|
77
|
-
...versionDef,
|
|
78
|
-
...(c.instructions !== undefined && { instructions: c.instructions }),
|
|
79
|
-
},
|
|
75
|
+
subagentVersion: withInstructions(versionDef, c.instructions),
|
|
80
76
|
}),
|
|
81
77
|
};
|
|
82
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* A candidate's `instructions` override: the prompt files it was joined from no longer describe
|
|
81
|
+
* it, so they are dropped (never model-visible either way).
|
|
82
|
+
*/
|
|
83
|
+
function withInstructions(def, instructions) {
|
|
84
|
+
if (instructions === undefined)
|
|
85
|
+
return def;
|
|
86
|
+
const { instructionFiles: _files, ...rest } = def;
|
|
87
|
+
return { ...rest, instructions };
|
|
88
|
+
}
|
|
83
89
|
/**
|
|
84
90
|
* 候选请求已经发出、但没有正常收完(出错、超时、中止):`tokens` 是这次尝试应计入预算的估算用量,
|
|
85
91
|
* `cause` 是原始错误(调用方按它分类重试)。请求发出之前的失败(解析模型、取附件)原样抛出,不计费。
|
package/dist/evals/trajectory.js
CHANGED
|
@@ -130,7 +130,7 @@ function buildRun({ started, events }, prices, forks) {
|
|
|
130
130
|
assistants.set(e.payload.step, [...(assistants.get(e.payload.step) ?? []), e]);
|
|
131
131
|
break;
|
|
132
132
|
case "usage":
|
|
133
|
-
// a compaction or
|
|
133
|
+
// a compaction, title or web_fetch call's usage is not a step call's: counted in the totals only (I-1)
|
|
134
134
|
if (e.payload.purpose !== undefined) {
|
|
135
135
|
compactions.push(e);
|
|
136
136
|
break;
|
|
@@ -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`,覆盖「还没有行」的新装),再锁住已有的安装记录行。 */
|