@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
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
};
|
|
10
|
+
import { Inject, Injectable } from "@nestjs/common";
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
import { CatalogRequestsService } from "../../catalog/requests.service.js";
|
|
13
|
+
import { defineOperation } from "../operation.js";
|
|
14
|
+
import { PlatformOperations } from "../registry.js";
|
|
15
|
+
import { asToolError, viaAgent } from "./errors.js";
|
|
16
|
+
import { Cursor, pageOf, startOf } from "./paging.js";
|
|
17
|
+
const Note = z.string().max(1000);
|
|
18
|
+
/** A request as the requester reads it (no org name: it is this org's). */
|
|
19
|
+
const view = (r) => ({
|
|
20
|
+
id: r.id,
|
|
21
|
+
kind: r.kind,
|
|
22
|
+
status: r.status,
|
|
23
|
+
item: r.item,
|
|
24
|
+
entry: r.entry,
|
|
25
|
+
agent: r.agent,
|
|
26
|
+
note: r.note,
|
|
27
|
+
reason: r.reason,
|
|
28
|
+
decidedAt: r.decidedAt,
|
|
29
|
+
createdAt: r.createdAt,
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* Request operations of the `Platform` tool (spec §7): a member asks the org admins to switch a
|
|
33
|
+
* plugin on, an org admin asks the super admin for access to a plugin or for an import from a
|
|
34
|
+
* marketplace. Deciding a request is human-only (spec §6.4) and not offered.
|
|
35
|
+
*/
|
|
36
|
+
let RequestsOperations = class RequestsOperations {
|
|
37
|
+
registry;
|
|
38
|
+
requests;
|
|
39
|
+
constructor(registry, requests) {
|
|
40
|
+
this.registry = registry;
|
|
41
|
+
this.requests = requests;
|
|
42
|
+
}
|
|
43
|
+
onModuleInit() {
|
|
44
|
+
this.registry.register([
|
|
45
|
+
defineOperation({
|
|
46
|
+
id: "requests.list-mine",
|
|
47
|
+
description: "List the requests you made in this org, pending and decided, newest first: what was asked (a plugin, a marketplace entry, an agent's connectors), the status and a rejection's reason. Pages by 50: pass the returned next as params.cursor.",
|
|
48
|
+
input: z.object({ cursor: Cursor.optional() }).strict(),
|
|
49
|
+
example: {},
|
|
50
|
+
authz: { orgAction: "catalog.request" },
|
|
51
|
+
mirrors: [],
|
|
52
|
+
confirm: "read",
|
|
53
|
+
run: async (input, ctx) => {
|
|
54
|
+
const mine = await this.requests.listForRequester(ctx.orgId, ctx.actorAccountId);
|
|
55
|
+
return pageOf(mine.map(view), startOf(input.cursor), 50);
|
|
56
|
+
},
|
|
57
|
+
}),
|
|
58
|
+
defineOperation({
|
|
59
|
+
id: "requests.create",
|
|
60
|
+
description: 'Ask for a plugin: kind "enable" asks the org admins to switch on a plugin that is off in this org (members and up); kind "access" asks the super admin to offer this org a plugin it sees as not_offered (org admins). Take the plugin id and state from plugins.list. An optional note says why.',
|
|
61
|
+
input: z
|
|
62
|
+
.object({
|
|
63
|
+
itemId: z.string().min(1).max(100),
|
|
64
|
+
kind: z.enum(["enable", "access"]),
|
|
65
|
+
note: Note.optional(),
|
|
66
|
+
})
|
|
67
|
+
.strict(),
|
|
68
|
+
example: {
|
|
69
|
+
itemId: "3f1c2a9e-5b7d-4e21-9c0a-1d2e3f4a5b6c",
|
|
70
|
+
kind: "enable",
|
|
71
|
+
note: "Our team needs it for the weekly report.",
|
|
72
|
+
},
|
|
73
|
+
authz: { orgAction: "catalog.request" },
|
|
74
|
+
mirrors: ["POST /api/v1/orgs/:orgId/catalog/:itemId/requests"],
|
|
75
|
+
confirm: "personal",
|
|
76
|
+
errors: [
|
|
77
|
+
{
|
|
78
|
+
code: "catalog.request_pending",
|
|
79
|
+
next: "The org already has a pending request of this kind for the plugin; nothing to do but wait.",
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
code: "catalog.request_invalid",
|
|
83
|
+
next: 'The plugin\'s state does not fit the kind: "enable" needs state off, "access" needs not_offered. Check plugins.list.',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
code: "forbidden",
|
|
87
|
+
next: 'Only org admins can ask for access; ask an org admin, or use kind "enable".',
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
summary: (i) => i.kind === "enable"
|
|
91
|
+
? {
|
|
92
|
+
zh: `申请在本组织启用插件 ${i.itemId}`,
|
|
93
|
+
en: `Request that plugin ${i.itemId} be enabled in the org`,
|
|
94
|
+
}
|
|
95
|
+
: {
|
|
96
|
+
zh: `向超级管理员申请插件 ${i.itemId} 的使用权`,
|
|
97
|
+
en: `Request access to plugin ${i.itemId} from the super admin`,
|
|
98
|
+
},
|
|
99
|
+
run: async (input, ctx) => asToolError(async () => ({
|
|
100
|
+
request: view(await this.requests.requestItem(ctx.orgId, ctx.actorAccountId, input.itemId, { kind: input.kind, ...(input.note !== undefined && { note: input.note }) }, { auditDetail: viaAgent("requests.create", ctx) })),
|
|
101
|
+
})),
|
|
102
|
+
}),
|
|
103
|
+
defineOperation({
|
|
104
|
+
id: "requests.create-import",
|
|
105
|
+
description: "Ask the super admin to import a plugin from a marketplace into the platform catalog (org admins, when the platform lets orgs browse): the marketplaceId, name and version from marketplaces.entries, and an optional note.",
|
|
106
|
+
input: z
|
|
107
|
+
.object({
|
|
108
|
+
marketplaceId: z.string().min(1).max(100),
|
|
109
|
+
name: z.string().min(1).max(214),
|
|
110
|
+
version: z.string().min(1).max(100),
|
|
111
|
+
note: Note.optional(),
|
|
112
|
+
})
|
|
113
|
+
.strict(),
|
|
114
|
+
example: { marketplaceId: "official", name: "github", version: "1.4.0" },
|
|
115
|
+
authz: { orgAction: "catalog.decide" },
|
|
116
|
+
mirrors: ["POST /api/v1/orgs/:orgId/marketplace-requests"],
|
|
117
|
+
confirm: "org",
|
|
118
|
+
errors: [
|
|
119
|
+
{
|
|
120
|
+
code: "catalog.marketplace_browse_disabled",
|
|
121
|
+
next: "The platform does not let orgs request imports; ask the super admin directly.",
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
code: "catalog.request_invalid",
|
|
125
|
+
next: 'The plugin is in the catalog already: use requests.create with kind "access" or "enable".',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
code: "catalog.request_pending",
|
|
129
|
+
next: "A request for this entry is pending already; wait for the super admin.",
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
summary: (i) => ({
|
|
133
|
+
zh: `申请从市场导入插件 ${i.name} ${i.version}`,
|
|
134
|
+
en: `Request the import of plugin ${i.name} ${i.version} from a marketplace`,
|
|
135
|
+
}),
|
|
136
|
+
run: async (input, ctx) => asToolError(async () => ({
|
|
137
|
+
request: view(await this.requests.requestImport(ctx.orgId, ctx.actorAccountId, {
|
|
138
|
+
marketplaceId: input.marketplaceId,
|
|
139
|
+
name: input.name,
|
|
140
|
+
version: input.version,
|
|
141
|
+
...(input.note !== undefined && { note: input.note }),
|
|
142
|
+
}, { auditDetail: viaAgent("requests.create-import", ctx) })),
|
|
143
|
+
})),
|
|
144
|
+
}),
|
|
145
|
+
]);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
RequestsOperations = __decorate([
|
|
149
|
+
Injectable(),
|
|
150
|
+
__param(0, Inject(PlatformOperations)),
|
|
151
|
+
__param(1, Inject(CatalogRequestsService))
|
|
152
|
+
], RequestsOperations);
|
|
153
|
+
export { RequestsOperations };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { KernelSchemaDb } from "../../db/kernel-schema.js";
|
|
2
|
+
import type { OrgRole } from "../../orgs/roles.js";
|
|
3
|
+
/** The account's role in the org, read now; null when it is not a member. */
|
|
4
|
+
export declare function roleOf(db: KernelSchemaDb, orgId: string, accountId: string): Promise<OrgRole | null>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The account's role in the org, read now; null when it is not a member. */
|
|
2
|
+
export async function roleOf(db, orgId, accountId) {
|
|
3
|
+
const m = await db
|
|
4
|
+
.selectFrom("memberships")
|
|
5
|
+
.select("role")
|
|
6
|
+
.where("org_id", "=", orgId)
|
|
7
|
+
.where("account_id", "=", accountId)
|
|
8
|
+
.executeTakeFirst();
|
|
9
|
+
return m?.role ?? null;
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type OnModuleInit } from "@nestjs/common";
|
|
2
|
+
import { SkillsService } from "../../skills/skills.service.js";
|
|
3
|
+
import { PlatformOperations } from "../registry.js";
|
|
4
|
+
/**
|
|
5
|
+
* Skill library operations of the `Platform` tool (spec §7). The skill body can be long; `get`
|
|
6
|
+
* returns it whole because reading it is the point of the call.
|
|
7
|
+
*/
|
|
8
|
+
export declare class SkillsOperations implements OnModuleInit {
|
|
9
|
+
private readonly registry;
|
|
10
|
+
private readonly skills;
|
|
11
|
+
constructor(registry: PlatformOperations, skills: SkillsService);
|
|
12
|
+
onModuleInit(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
};
|
|
10
|
+
import { Inject, Injectable } from "@nestjs/common";
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
import { SkillsService } from "../../skills/skills.service.js";
|
|
13
|
+
import { defineOperation } from "../operation.js";
|
|
14
|
+
import { PlatformOperations } from "../registry.js";
|
|
15
|
+
import { asToolError, viaAgent } from "./errors.js";
|
|
16
|
+
const NoInput = z.object({}).strict();
|
|
17
|
+
const SkillId = z.object({ skillId: z.string().min(1).max(100) }).strict();
|
|
18
|
+
/**
|
|
19
|
+
* Skill library operations of the `Platform` tool (spec §7). The skill body can be long; `get`
|
|
20
|
+
* returns it whole because reading it is the point of the call.
|
|
21
|
+
*/
|
|
22
|
+
let SkillsOperations = class SkillsOperations {
|
|
23
|
+
registry;
|
|
24
|
+
skills;
|
|
25
|
+
constructor(registry, skills) {
|
|
26
|
+
this.registry = registry;
|
|
27
|
+
this.skills = skills;
|
|
28
|
+
}
|
|
29
|
+
onModuleInit() {
|
|
30
|
+
this.registry.register([
|
|
31
|
+
defineOperation({
|
|
32
|
+
id: "skills.list",
|
|
33
|
+
description: "List the skills the org can use, org skills and platform skills switched on in it. Each entry has an id, name, description, current version and where it came from.",
|
|
34
|
+
input: NoInput,
|
|
35
|
+
example: {},
|
|
36
|
+
authz: { orgAction: "skills.read" },
|
|
37
|
+
mirrors: ["GET /api/v1/orgs/:orgId/skills"],
|
|
38
|
+
confirm: "read",
|
|
39
|
+
run: async (_input, ctx) => ({ skills: await this.skills.list(ctx.orgId) }),
|
|
40
|
+
}),
|
|
41
|
+
defineOperation({
|
|
42
|
+
id: "skills.get",
|
|
43
|
+
description: "Read one skill: its description, versions, file list and the current SKILL.md body. Takes the skill id from skills.list.",
|
|
44
|
+
input: SkillId,
|
|
45
|
+
example: { skillId: "0b9f2c4e-1d3a-4c55-9e0a-7a2f6d1c8b11" },
|
|
46
|
+
authz: { orgAction: "skills.read" },
|
|
47
|
+
mirrors: ["GET /api/v1/orgs/:orgId/skills/:id"],
|
|
48
|
+
confirm: "read",
|
|
49
|
+
run: async (input, ctx) => asToolError(() => this.skills.get(ctx.orgId, input.skillId)),
|
|
50
|
+
}),
|
|
51
|
+
defineOperation({
|
|
52
|
+
id: "skills.create",
|
|
53
|
+
description: "Create an org skill from text: a name, a one-line description of when to use it, and the SKILL.md body. A skill of that name must not exist yet. Uploads of packages are done on the web.",
|
|
54
|
+
input: z
|
|
55
|
+
.object({
|
|
56
|
+
name: z.string().min(1).max(64),
|
|
57
|
+
description: z.string().min(1).max(1024),
|
|
58
|
+
body: z.string().min(1).max(100_000),
|
|
59
|
+
shareable: z.boolean().optional(),
|
|
60
|
+
})
|
|
61
|
+
.strict(),
|
|
62
|
+
example: {
|
|
63
|
+
name: "weekly-report",
|
|
64
|
+
description: "Use when asked to write the weekly status report.",
|
|
65
|
+
body: "# Steps\n\n1. Collect this week's updates.\n2. Write the report.",
|
|
66
|
+
},
|
|
67
|
+
authz: { orgAction: "skills.manage" },
|
|
68
|
+
mirrors: ["POST /api/v1/orgs/:orgId/skills"],
|
|
69
|
+
confirm: "org",
|
|
70
|
+
errors: [
|
|
71
|
+
{
|
|
72
|
+
code: "skill.name_exists",
|
|
73
|
+
next: "A skill of that name exists: pick another name, or read the existing one with skills.get.",
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
summary: (i) => i.shareable === true
|
|
77
|
+
? {
|
|
78
|
+
zh: `新建组织技能「${i.name}」(可共享给其他组织)`,
|
|
79
|
+
en: `Create org skill "${i.name}" (shared with other orgs)`,
|
|
80
|
+
}
|
|
81
|
+
: { zh: `新建组织技能「${i.name}」`, en: `Create org skill "${i.name}"` },
|
|
82
|
+
run: async (input, ctx) => asToolError(() => this.skills.createFromText(ctx.orgId, ctx.actorAccountId, {
|
|
83
|
+
name: input.name,
|
|
84
|
+
description: input.description,
|
|
85
|
+
body: input.body,
|
|
86
|
+
...(input.shareable !== undefined && { shareable: input.shareable }),
|
|
87
|
+
auditDetail: viaAgent("skills.create", ctx),
|
|
88
|
+
})),
|
|
89
|
+
}),
|
|
90
|
+
]);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
SkillsOperations = __decorate([
|
|
94
|
+
Injectable(),
|
|
95
|
+
__param(0, Inject(PlatformOperations)),
|
|
96
|
+
__param(1, Inject(SkillsService))
|
|
97
|
+
], SkillsOperations);
|
|
98
|
+
export { SkillsOperations };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LocalizedName } from "@capybara-hq/plugin-sdk";
|
|
2
|
+
/** A name as a card summary quotes it: clipped to {@link NAME_MAX}. */
|
|
3
|
+
export declare const named: (s: string) => string;
|
|
4
|
+
/** A display name in both languages, clipped; `fallback` (the plain name) for a missing one. */
|
|
5
|
+
export declare const localized: (n: LocalizedName | null | undefined, fallback: string) => {
|
|
6
|
+
zh: string;
|
|
7
|
+
en: string;
|
|
8
|
+
};
|
|
9
|
+
/** The value of `read`, or `fallback` when the read throws (a summary never fails on a name). */
|
|
10
|
+
export declare function orElse<T>(read: () => Promise<T>, fallback: T): Promise<T>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Longest name quoted in a card summary (a name is set by people, and by agents through tools). */
|
|
2
|
+
const NAME_MAX = 80;
|
|
3
|
+
/** A name as a card summary quotes it: clipped to {@link NAME_MAX}. */
|
|
4
|
+
export const named = (s) => (s.length > NAME_MAX ? `${s.slice(0, NAME_MAX)}…` : s);
|
|
5
|
+
/** A display name in both languages, clipped; `fallback` (the plain name) for a missing one. */
|
|
6
|
+
export const localized = (n, fallback) => ({
|
|
7
|
+
zh: named(n?.zh ?? fallback),
|
|
8
|
+
en: named(n?.en ?? fallback),
|
|
9
|
+
});
|
|
10
|
+
/** The value of `read`, or `fallback` when the read throws (a summary never fails on a name). */
|
|
11
|
+
export async function orElse(read, fallback) {
|
|
12
|
+
try {
|
|
13
|
+
return await read();
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return fallback;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `Platform` tool's operations (ruling P2): one provider per domain, each registering its
|
|
3
|
+
* operations into `PlatformOperations` from `onModuleInit`. It imports the domain modules, which
|
|
4
|
+
* `PlatformModule` itself must not.
|
|
5
|
+
*/
|
|
6
|
+
export declare class PlatformOpsModule {
|
|
7
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Module } from "@nestjs/common";
|
|
8
|
+
import { AgentsModule } from "../agents/agents.module.js";
|
|
9
|
+
import { CatalogModule } from "../catalog/catalog.module.js";
|
|
10
|
+
import { ExtensionsModule } from "../extensions/extensions.module.js";
|
|
11
|
+
import { OrgsModule } from "../orgs/orgs.module.js";
|
|
12
|
+
import { SkillsModule } from "../skills/skills.module.js";
|
|
13
|
+
import { ToolsModule } from "../tools/tools.module.js";
|
|
14
|
+
import { AgentTemplatesOperations } from "./ops/agent-templates.ops.js";
|
|
15
|
+
import { AgentsOperations } from "./ops/agents.ops.js";
|
|
16
|
+
import { ConnectorsOperations } from "./ops/connectors.ops.js";
|
|
17
|
+
import { ExtensionsOperations } from "./ops/extensions.ops.js";
|
|
18
|
+
import { MarketplacesOperations } from "./ops/marketplaces.ops.js";
|
|
19
|
+
import { PlatformOperationsProvider } from "./ops/platform.ops.js";
|
|
20
|
+
import { PluginsOperations } from "./ops/plugins.ops.js";
|
|
21
|
+
import { RequestsOperations } from "./ops/requests.ops.js";
|
|
22
|
+
import { SkillsOperations } from "./ops/skills.ops.js";
|
|
23
|
+
import { PlatformModule } from "./platform.module.js";
|
|
24
|
+
/**
|
|
25
|
+
* The `Platform` tool's operations (ruling P2): one provider per domain, each registering its
|
|
26
|
+
* operations into `PlatformOperations` from `onModuleInit`. It imports the domain modules, which
|
|
27
|
+
* `PlatformModule` itself must not.
|
|
28
|
+
*/
|
|
29
|
+
let PlatformOpsModule = class PlatformOpsModule {
|
|
30
|
+
};
|
|
31
|
+
PlatformOpsModule = __decorate([
|
|
32
|
+
Module({
|
|
33
|
+
imports: [
|
|
34
|
+
PlatformModule,
|
|
35
|
+
SkillsModule,
|
|
36
|
+
AgentsModule,
|
|
37
|
+
OrgsModule,
|
|
38
|
+
CatalogModule,
|
|
39
|
+
ExtensionsModule,
|
|
40
|
+
ToolsModule,
|
|
41
|
+
],
|
|
42
|
+
providers: [
|
|
43
|
+
PlatformOperationsProvider,
|
|
44
|
+
SkillsOperations,
|
|
45
|
+
AgentsOperations,
|
|
46
|
+
AgentTemplatesOperations,
|
|
47
|
+
PluginsOperations,
|
|
48
|
+
MarketplacesOperations,
|
|
49
|
+
RequestsOperations,
|
|
50
|
+
ConnectorsOperations,
|
|
51
|
+
ExtensionsOperations,
|
|
52
|
+
],
|
|
53
|
+
})
|
|
54
|
+
], PlatformOpsModule);
|
|
55
|
+
export { PlatformOpsModule };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `Platform` tool's core (Platform tool spec §3, §6, §7): the operation registry, the actor
|
|
3
|
+
* facts and the agent docs. It imports no domain module (ruling P2), so `ToolsModule` can import it without a
|
|
4
|
+
* cycle; domain providers register their operations into `PlatformOperations` from
|
|
5
|
+
* `onModuleInit`.
|
|
6
|
+
*/
|
|
7
|
+
export declare class PlatformModule {
|
|
8
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Module } from "@nestjs/common";
|
|
8
|
+
import { PlatformActor } from "./actor.js";
|
|
9
|
+
import { AgentDocs } from "./agent-docs.js";
|
|
10
|
+
import { PlatformOperations } from "./registry.js";
|
|
11
|
+
/**
|
|
12
|
+
* The `Platform` tool's core (Platform tool spec §3, §6, §7): the operation registry, the actor
|
|
13
|
+
* facts and the agent docs. It imports no domain module (ruling P2), so `ToolsModule` can import it without a
|
|
14
|
+
* cycle; domain providers register their operations into `PlatformOperations` from
|
|
15
|
+
* `onModuleInit`.
|
|
16
|
+
*/
|
|
17
|
+
let PlatformModule = class PlatformModule {
|
|
18
|
+
};
|
|
19
|
+
PlatformModule = __decorate([
|
|
20
|
+
Module({
|
|
21
|
+
providers: [PlatformOperations, PlatformActor, AgentDocs],
|
|
22
|
+
exports: [PlatformOperations, PlatformActor, AgentDocs],
|
|
23
|
+
})
|
|
24
|
+
], PlatformModule);
|
|
25
|
+
export { PlatformModule };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A super-admin result as it may enter one org's event log (Platform tool spec §6.1): every org
|
|
3
|
+
* list becomes `{ count }`, org ids and names elsewhere are dropped, and an org owner is given as
|
|
4
|
+
* `{ kind: "org" }` only. Shared agents, trajectories and eval snapshots expose the log to other
|
|
5
|
+
* people, so another org is never named or described; the admin console shows which.
|
|
6
|
+
*/
|
|
7
|
+
export declare function redactOrgs(value: unknown): unknown;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keys whose value lists orgs in the platform views (`CatalogItemView.scopeOrgs`, the update
|
|
3
|
+
* preview's `extension.orgs`, `connectorOrgs`, a component's `pinnedOrgs` and `kept`, a scope
|
|
4
|
+
* preview's `affected`, …): replaced with `{ count }`.
|
|
5
|
+
*/
|
|
6
|
+
const ORG_LISTS = new Set([
|
|
7
|
+
"orgs",
|
|
8
|
+
"scopeOrgs",
|
|
9
|
+
"pinnedOrgs",
|
|
10
|
+
"connectorOrgs",
|
|
11
|
+
"kept",
|
|
12
|
+
"usedBy",
|
|
13
|
+
"affected",
|
|
14
|
+
]);
|
|
15
|
+
/** Keys naming one org, or orgs by id: dropped. */
|
|
16
|
+
const ORG_KEYS = new Set([
|
|
17
|
+
"orgId",
|
|
18
|
+
"orgIds",
|
|
19
|
+
"orgName",
|
|
20
|
+
"orgNames",
|
|
21
|
+
"ownerOrgId",
|
|
22
|
+
]);
|
|
23
|
+
/**
|
|
24
|
+
* A super-admin result as it may enter one org's event log (Platform tool spec §6.1): every org
|
|
25
|
+
* list becomes `{ count }`, org ids and names elsewhere are dropped, and an org owner is given as
|
|
26
|
+
* `{ kind: "org" }` only. Shared agents, trajectories and eval snapshots expose the log to other
|
|
27
|
+
* people, so another org is never named or described; the admin console shows which.
|
|
28
|
+
*/
|
|
29
|
+
export function redactOrgs(value) {
|
|
30
|
+
if (Array.isArray(value))
|
|
31
|
+
return value.map(redactOrgs);
|
|
32
|
+
if (value === null || typeof value !== "object")
|
|
33
|
+
return value;
|
|
34
|
+
if (value instanceof Date)
|
|
35
|
+
return value;
|
|
36
|
+
const out = {};
|
|
37
|
+
for (const [k, v] of Object.entries(value)) {
|
|
38
|
+
if (ORG_KEYS.has(k))
|
|
39
|
+
continue;
|
|
40
|
+
if (ORG_LISTS.has(k) && Array.isArray(v)) {
|
|
41
|
+
out[k] = { count: v.length };
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (k === "owner" && isOrgOwner(v)) {
|
|
45
|
+
out[k] = { kind: "org" };
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
out[k] = redactOrgs(v);
|
|
49
|
+
}
|
|
50
|
+
return out;
|
|
51
|
+
}
|
|
52
|
+
const isOrgOwner = (v) => typeof v === "object" && v !== null && v.kind === "org";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type PlatformOperation } from "./operation.js";
|
|
2
|
+
/**
|
|
3
|
+
* The `Platform` tool's operations (spec §7). Domain providers add theirs with {@link register}
|
|
4
|
+
* from `onModuleInit` (ruling P2: this module imports no domain module); a bad batch throws and
|
|
5
|
+
* registers nothing, so a mistake fails the kernel's start.
|
|
6
|
+
*/
|
|
7
|
+
export declare class PlatformOperations {
|
|
8
|
+
private readonly ops;
|
|
9
|
+
/**
|
|
10
|
+
* Adds `ops`. Throws on an id not shaped `<domain>.<verb>`, a domain outside
|
|
11
|
+
* {@link PLATFORM_DOMAINS}, a duplicate id (in the batch or already registered), or a write
|
|
12
|
+
* (`confirm` other than `read`) without `summary`.
|
|
13
|
+
*/
|
|
14
|
+
register(ops: readonly PlatformOperation[]): void;
|
|
15
|
+
domains(): readonly {
|
|
16
|
+
id: string;
|
|
17
|
+
description: string;
|
|
18
|
+
}[];
|
|
19
|
+
/** The domain's operations, sorted by id. */
|
|
20
|
+
inDomain(domain: string): PlatformOperation[];
|
|
21
|
+
get(id: string): PlatformOperation | null;
|
|
22
|
+
/** Every operation, sorted by id. */
|
|
23
|
+
all(): PlatformOperation[];
|
|
24
|
+
/**
|
|
25
|
+
* Keyword search (deterministic, like ToolSearch's): per distinct query term,
|
|
26
|
+
* `idf × (ID_WEIGHT if in the id + 1 if in the description)`; a term also matches a word it is a
|
|
27
|
+
* prefix of. Zero scores are dropped; ties go by id.
|
|
28
|
+
*/
|
|
29
|
+
search(query: string, limit: number): PlatformOperation[];
|
|
30
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Injectable } from "@nestjs/common";
|
|
8
|
+
import { tokenize } from "../tools/builtins/tool-search.js";
|
|
9
|
+
import { OPERATION_ID, operationDomain, PLATFORM_DOMAINS, } from "./operation.js";
|
|
10
|
+
/** A word of an operation id weighs more than a word of its description (like ToolSearch). */
|
|
11
|
+
const ID_WEIGHT = 2;
|
|
12
|
+
/** The shortest query term that also matches as a word's prefix (`skill` → `skills`). */
|
|
13
|
+
const MIN_PREFIX = 3;
|
|
14
|
+
const DOMAIN_IDS = new Set(PLATFORM_DOMAINS.map((d) => d.id));
|
|
15
|
+
const byId = (a, b) => a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
|
|
16
|
+
/** A query term matches a word when equal, or as its prefix when long enough. */
|
|
17
|
+
const matches = (words, term) => {
|
|
18
|
+
if (words.has(term))
|
|
19
|
+
return true;
|
|
20
|
+
if (term.length < MIN_PREFIX)
|
|
21
|
+
return false;
|
|
22
|
+
for (const w of words)
|
|
23
|
+
if (w.startsWith(term))
|
|
24
|
+
return true;
|
|
25
|
+
return false;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The `Platform` tool's operations (spec §7). Domain providers add theirs with {@link register}
|
|
29
|
+
* from `onModuleInit` (ruling P2: this module imports no domain module); a bad batch throws and
|
|
30
|
+
* registers nothing, so a mistake fails the kernel's start.
|
|
31
|
+
*/
|
|
32
|
+
let PlatformOperations = class PlatformOperations {
|
|
33
|
+
ops = new Map();
|
|
34
|
+
/**
|
|
35
|
+
* Adds `ops`. Throws on an id not shaped `<domain>.<verb>`, a domain outside
|
|
36
|
+
* {@link PLATFORM_DOMAINS}, a duplicate id (in the batch or already registered), or a write
|
|
37
|
+
* (`confirm` other than `read`) without `summary`.
|
|
38
|
+
*/
|
|
39
|
+
register(ops) {
|
|
40
|
+
const seen = new Set();
|
|
41
|
+
for (const op of ops) {
|
|
42
|
+
if (!OPERATION_ID.test(op.id)) {
|
|
43
|
+
throw new Error(`Platform operation id "${op.id}" is not shaped <domain>.<verb>`);
|
|
44
|
+
}
|
|
45
|
+
if (!DOMAIN_IDS.has(operationDomain(op.id))) {
|
|
46
|
+
throw new Error(`Platform operation "${op.id}" names an unknown domain`);
|
|
47
|
+
}
|
|
48
|
+
if (seen.has(op.id) || this.ops.has(op.id)) {
|
|
49
|
+
throw new Error(`duplicate Platform operation "${op.id}"`);
|
|
50
|
+
}
|
|
51
|
+
if (op.confirm !== "read" && op.summary === undefined) {
|
|
52
|
+
throw new Error(`Platform operation "${op.id}" is a write without a summary`);
|
|
53
|
+
}
|
|
54
|
+
seen.add(op.id);
|
|
55
|
+
}
|
|
56
|
+
for (const op of ops)
|
|
57
|
+
this.ops.set(op.id, op);
|
|
58
|
+
}
|
|
59
|
+
domains() {
|
|
60
|
+
return PLATFORM_DOMAINS;
|
|
61
|
+
}
|
|
62
|
+
/** The domain's operations, sorted by id. */
|
|
63
|
+
inDomain(domain) {
|
|
64
|
+
return this.all().filter((op) => operationDomain(op.id) === domain);
|
|
65
|
+
}
|
|
66
|
+
get(id) {
|
|
67
|
+
return this.ops.get(id) ?? null;
|
|
68
|
+
}
|
|
69
|
+
/** Every operation, sorted by id. */
|
|
70
|
+
all() {
|
|
71
|
+
return [...this.ops.values()].sort(byId);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Keyword search (deterministic, like ToolSearch's): per distinct query term,
|
|
75
|
+
* `idf × (ID_WEIGHT if in the id + 1 if in the description)`; a term also matches a word it is a
|
|
76
|
+
* prefix of. Zero scores are dropped; ties go by id.
|
|
77
|
+
*/
|
|
78
|
+
search(query, limit) {
|
|
79
|
+
const terms = [...new Set(tokenize(query))];
|
|
80
|
+
if (terms.length === 0)
|
|
81
|
+
return [];
|
|
82
|
+
const docs = this.all().map((op) => ({
|
|
83
|
+
op,
|
|
84
|
+
id: new Set(tokenize(op.id)),
|
|
85
|
+
desc: new Set(tokenize(op.description)),
|
|
86
|
+
}));
|
|
87
|
+
const n = docs.length;
|
|
88
|
+
const idf = new Map();
|
|
89
|
+
for (const term of terms) {
|
|
90
|
+
const df = docs.filter((d) => matches(d.id, term) || matches(d.desc, term)).length;
|
|
91
|
+
idf.set(term, df === 0 ? 0 : Math.log(1 + n / df));
|
|
92
|
+
}
|
|
93
|
+
return docs
|
|
94
|
+
.map((d) => {
|
|
95
|
+
let score = 0;
|
|
96
|
+
for (const term of terms) {
|
|
97
|
+
const w = (matches(d.id, term) ? ID_WEIGHT : 0) + (matches(d.desc, term) ? 1 : 0);
|
|
98
|
+
score += w * (idf.get(term) ?? 0);
|
|
99
|
+
}
|
|
100
|
+
return { op: d.op, score };
|
|
101
|
+
})
|
|
102
|
+
.filter((x) => x.score > 0)
|
|
103
|
+
.sort((a, b) => (b.score !== a.score ? b.score - a.score : byId(a.op, b.op)))
|
|
104
|
+
.slice(0, limit)
|
|
105
|
+
.map((x) => x.op);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
PlatformOperations = __decorate([
|
|
109
|
+
Injectable()
|
|
110
|
+
], PlatformOperations);
|
|
111
|
+
export { PlatformOperations };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PluginScopeSyncProcessor } from "../catalog/scope-sync.js";
|
|
1
2
|
import { ChannelsProcessor } from "../channels/channels.module.js";
|
|
2
3
|
import { ChannelOutbound } from "../channels/outbound.js";
|
|
3
4
|
import { TitleQueue } from "../conversations/titles.js";
|
|
@@ -14,8 +15,8 @@ import { UsageReporter } from "../runtime/usage-report.js";
|
|
|
14
15
|
/**
|
|
15
16
|
* The worker role's parts, driven by `KernelLifecycle` at fixed points of its start order and stop
|
|
16
17
|
* phases (so they stay ordered after the extension load and before the extension host closes): the
|
|
17
|
-
* queue consumers (runs, sub-agent runs, evals, maintenance,
|
|
18
|
-
* titles) and the schedulers of the `@LockedCron` / `@LockedInterval` jobs. Provided only by
|
|
18
|
+
* queue consumers (runs, sub-agent runs, evals, maintenance, the plugin scope sync, channel
|
|
19
|
+
* deliveries, `usage.report`, titles) and the schedulers of the `@LockedCron` / `@LockedInterval` jobs. Provided only by
|
|
19
20
|
* `WorkerModule`, so a process without the worker role has none of them.
|
|
20
21
|
*/
|
|
21
22
|
export declare class WorkerRole {
|
|
@@ -34,13 +35,14 @@ export declare class WorkerRole {
|
|
|
34
35
|
private readonly channelsProcessor;
|
|
35
36
|
private readonly evalsProcessor;
|
|
36
37
|
private readonly maintenanceProcessor;
|
|
38
|
+
private readonly scopeProcessor;
|
|
37
39
|
/** The startup config (the roles). */
|
|
38
40
|
private readonly config;
|
|
39
41
|
/** The run worker was started: the runs phase drains it. */
|
|
40
42
|
private runsStarted;
|
|
41
43
|
/** The eval worker was started: the runs phase drains it. */
|
|
42
44
|
private evalsStarted;
|
|
43
|
-
constructor(config: KernelConfigService, log: KernelLogger, intervals: LockedIntervalScheduler, scheduledRuns: ScheduledRuns, runWorker: RunWorker, evalWorker: EvalWorker, usageReport: UsageReporter, titles: TitleQueue, channelOutbound: ChannelOutbound, runsProcessor: RunsProcessor, subagentRunsProcessor: SubagentRunsProcessor, usageProcessor: UsageReportProcessor, titleProcessor: TitleProcessor, channelsProcessor: ChannelsProcessor, evalsProcessor: EvalsProcessor, maintenanceProcessor: MaintenanceProcessor);
|
|
45
|
+
constructor(config: KernelConfigService, log: KernelLogger, intervals: LockedIntervalScheduler, scheduledRuns: ScheduledRuns, runWorker: RunWorker, evalWorker: EvalWorker, usageReport: UsageReporter, titles: TitleQueue, channelOutbound: ChannelOutbound, runsProcessor: RunsProcessor, subagentRunsProcessor: SubagentRunsProcessor, usageProcessor: UsageReportProcessor, titleProcessor: TitleProcessor, channelsProcessor: ChannelsProcessor, evalsProcessor: EvalsProcessor, maintenanceProcessor: MaintenanceProcessor, scopeProcessor: PluginScopeSyncProcessor);
|
|
44
46
|
/**
|
|
45
47
|
* Starts the queue consumers (after the extension load), then opens the schedules' start gate:
|
|
46
48
|
* the cron and interval timers were armed at application bootstrap, but every tick before this
|
|
@@ -58,6 +60,6 @@ export declare class WorkerRole {
|
|
|
58
60
|
drainRuns(budgetMs: number): Promise<void> | undefined;
|
|
59
61
|
/** The eval cases in progress stop (undefined: never started). */
|
|
60
62
|
drainEvals(budgetMs: number): Promise<void> | undefined;
|
|
61
|
-
/** Closes the maintenance queue's worker. */
|
|
63
|
+
/** Closes the maintenance queue's worker and the plugin scope sync's (it stops between pairs). */
|
|
62
64
|
closeMaintenance(): Promise<void>;
|
|
63
65
|
}
|