@capybara-hq/kernel 0.1.0-rc.4 → 0.1.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bootstrap.json +61 -5
- package/dist/admin/admin.controller.d.ts +39 -13
- package/dist/admin/admin.controller.js +33 -17
- package/dist/admin/extensions.controller.d.ts +16 -2
- package/dist/admin/extensions.controller.js +26 -6
- package/dist/admin/setup-lock.d.ts +1 -1
- package/dist/admin/setup-lock.js +1 -1
- package/dist/admin/setup.controller.d.ts +1 -1
- package/dist/admin/setup.controller.js +1 -1
- package/dist/admin/setup.service.d.ts +4 -4
- package/dist/admin/setup.service.js +8 -8
- package/dist/agents/agent-lookup.d.ts +16 -0
- package/dist/agents/agent-lookup.js +11 -0
- package/dist/agents/agents.controller.d.ts +76 -1
- package/dist/agents/agents.controller.js +90 -11
- package/dist/agents/agents.module.d.ts +4 -1
- package/dist/agents/agents.module.js +32 -6
- package/dist/agents/agents.service.d.ts +51 -22
- package/dist/agents/agents.service.js +172 -70
- package/dist/agents/definition.d.ts +49 -0
- package/dist/agents/definition.js +45 -0
- package/dist/agents/from-template.d.ts +106 -0
- package/dist/agents/from-template.js +649 -0
- package/dist/agents/from-template.service.d.ts +60 -0
- package/dist/agents/from-template.service.js +161 -0
- package/dist/agents/org-templates.d.ts +176 -0
- package/dist/agents/org-templates.js +827 -0
- package/dist/agents/pending-connector-requests.d.ts +77 -0
- package/dist/agents/pending-connector-requests.js +215 -0
- package/dist/agents/pending-connectors.controller.d.ts +39 -0
- package/dist/agents/pending-connectors.controller.js +91 -0
- package/dist/agents/pending-connectors.service.d.ts +62 -0
- package/dist/agents/pending-connectors.service.js +282 -0
- package/dist/agents/templates.controller.d.ts +86 -5
- package/dist/agents/templates.controller.js +171 -7
- package/dist/agents/templates.d.ts +127 -23
- package/dist/agents/templates.js +475 -52
- package/dist/background/background.module.js +8 -1
- package/dist/background/finish.d.ts +3 -2
- package/dist/background/launch-lock.d.ts +4 -3
- package/dist/background/launch-lock.js +4 -3
- package/dist/background/poll.job.d.ts +9 -6
- package/dist/background/poll.job.js +30 -22
- package/dist/background/session.d.ts +13 -2
- package/dist/background/session.js +13 -0
- package/dist/background/stop.d.ts +12 -6
- package/dist/background/stop.js +57 -39
- package/dist/background/store.d.ts +18 -6
- package/dist/background/store.js +12 -6
- package/dist/background/tasks.service.d.ts +15 -5
- package/dist/background/tasks.service.js +42 -17
- package/dist/background/wake-rules.d.ts +27 -18
- package/dist/background/wake-rules.js +52 -22
- package/dist/background/wake.d.ts +13 -11
- package/dist/background/wake.js +20 -14
- package/dist/catalog/admin-catalog.controller.d.ts +129 -30
- package/dist/catalog/admin-catalog.controller.js +213 -42
- package/dist/catalog/catalog-content.d.ts +58 -32
- package/dist/catalog/catalog-content.js +34 -8
- package/dist/catalog/catalog-import.module.d.ts +7 -0
- package/dist/catalog/catalog-import.module.js +60 -0
- package/dist/catalog/catalog-items.d.ts +111 -7
- package/dist/catalog/catalog-items.js +279 -13
- package/dist/catalog/catalog-scope.service.d.ts +260 -0
- package/dist/catalog/catalog-scope.service.js +1116 -0
- package/dist/catalog/catalog.module.d.ts +7 -9
- package/dist/catalog/catalog.module.js +41 -31
- package/dist/catalog/catalog.service.d.ts +101 -29
- package/dist/catalog/catalog.service.js +104 -106
- package/dist/catalog/cli.d.ts +11 -1
- package/dist/catalog/cli.js +26 -1
- package/dist/catalog/component-promotion.d.ts +96 -0
- package/dist/catalog/component-promotion.js +395 -0
- package/dist/catalog/component-scope.controller.d.ts +152 -0
- package/dist/catalog/component-scope.controller.js +287 -0
- package/dist/catalog/component-scope.service.d.ts +303 -0
- package/dist/catalog/component-scope.service.js +936 -0
- package/dist/catalog/component-state.d.ts +174 -0
- package/dist/catalog/component-state.js +437 -0
- package/dist/catalog/job-ids.d.ts +30 -0
- package/dist/catalog/job-ids.js +25 -0
- package/dist/catalog/marketplace-fetch.d.ts +1 -1
- package/dist/catalog/marketplaces.controller.d.ts +22 -5
- package/dist/catalog/marketplaces.controller.js +56 -7
- package/dist/catalog/marketplaces.service.d.ts +54 -14
- package/dist/catalog/marketplaces.service.js +71 -22
- package/dist/catalog/org-catalog.controller.d.ts +125 -34
- package/dist/catalog/org-catalog.controller.js +181 -65
- package/dist/catalog/org-catalog.service.d.ts +65 -33
- package/dist/catalog/org-catalog.service.js +324 -157
- package/dist/catalog/org-extension-switch.d.ts +41 -0
- package/dist/catalog/org-extension-switch.js +115 -0
- package/dist/catalog/org-extension.controller.d.ts +119 -0
- package/dist/catalog/org-extension.controller.js +266 -0
- package/dist/catalog/org-plugin-uploads.controller.d.ts +98 -0
- package/dist/catalog/org-plugin-uploads.controller.js +213 -0
- package/dist/catalog/org-plugin-uploads.d.ts +63 -0
- package/dist/catalog/org-plugin-uploads.js +116 -0
- package/dist/catalog/owned-items.d.ts +184 -0
- package/dist/catalog/owned-items.js +789 -0
- package/dist/catalog/owned-plugin-cleanup.d.ts +56 -0
- package/dist/catalog/owned-plugin-cleanup.js +194 -0
- package/dist/catalog/ownership.d.ts +172 -0
- package/dist/catalog/ownership.js +326 -0
- package/dist/catalog/platform-components.d.ts +221 -0
- package/dist/catalog/platform-components.js +761 -0
- package/dist/catalog/platform-migration.d.ts +115 -0
- package/dist/catalog/platform-migration.js +582 -0
- package/dist/catalog/plugin-import.d.ts +178 -34
- package/dist/catalog/plugin-import.js +622 -82
- package/dist/catalog/plugin-install.d.ts +185 -41
- package/dist/catalog/plugin-install.js +758 -126
- package/dist/catalog/plugin-upgrade.d.ts +260 -225
- package/dist/catalog/plugin-upgrade.js +1147 -1136
- package/dist/catalog/request-rules.d.ts +65 -0
- package/dist/catalog/request-rules.js +217 -0
- package/dist/catalog/requests.service.d.ts +193 -118
- package/dist/catalog/requests.service.js +526 -343
- package/dist/catalog/reserved-names.d.ts +8 -0
- package/dist/catalog/reserved-names.js +42 -0
- package/dist/catalog/scope-orgs.d.ts +21 -0
- package/dist/catalog/scope-orgs.js +67 -0
- package/dist/catalog/scope-state.d.ts +35 -0
- package/dist/catalog/scope-state.js +87 -0
- package/dist/catalog/scope-sync-workers.d.ts +7 -0
- package/dist/catalog/scope-sync-workers.js +29 -0
- package/dist/catalog/scope-sync.d.ts +176 -0
- package/dist/catalog/scope-sync.js +576 -0
- package/dist/catalog/scope.d.ts +42 -0
- package/dist/catalog/scope.js +42 -0
- package/dist/catalog/unshare.d.ts +22 -0
- package/dist/catalog/unshare.js +118 -0
- package/dist/channels/actions.js +1 -0
- package/dist/channels/cards.js +20 -2
- package/dist/channels/channels.module.js +2 -0
- package/dist/channels/inbound.d.ts +9 -1
- package/dist/channels/inbound.js +67 -5
- package/dist/channels/phrases.d.ts +35 -0
- package/dist/channels/phrases.js +29 -0
- package/dist/config/docs.js +3 -1
- package/dist/config/schema.d.ts +6 -2
- package/dist/config/schema.js +46 -22
- package/dist/conversations/access.d.ts +6 -4
- package/dist/conversations/access.js +27 -5
- package/dist/conversations/agent-tree.d.ts +46 -0
- package/dist/conversations/agent-tree.js +92 -0
- package/dist/conversations/conversations.controller.d.ts +43 -18
- package/dist/conversations/conversations.controller.js +79 -38
- package/dist/conversations/conversations.module.d.ts +1 -1
- package/dist/conversations/conversations.module.js +7 -7
- package/dist/conversations/conversations.service.d.ts +69 -12
- package/dist/conversations/conversations.service.js +106 -27
- package/dist/conversations/environment-status.d.ts +24 -0
- package/dist/conversations/environment-status.js +71 -0
- package/dist/conversations/event-log.d.ts +20 -5
- package/dist/conversations/event-log.js +60 -0
- package/dist/conversations/events.d.ts +84 -2
- package/dist/conversations/events.js +91 -17
- package/dist/conversations/queue.service.d.ts +1 -1
- package/dist/conversations/queue.service.js +5 -0
- package/dist/conversations/titles.d.ts +5 -3
- package/dist/conversations/titles.js +21 -8
- package/dist/conversations/tree.d.ts +17 -0
- package/dist/conversations/tree.js +42 -0
- package/dist/ctx/create-ctx.d.ts +5 -0
- package/dist/ctx/create-ctx.js +15 -5
- package/dist/db/kernel-schema.d.ts +362 -18
- package/dist/environments/access.d.ts +41 -0
- package/dist/environments/access.js +77 -0
- package/dist/environments/conversation-environments.d.ts +61 -0
- package/dist/environments/conversation-environments.js +170 -0
- package/dist/environments/dto.d.ts +25 -0
- package/dist/environments/dto.js +12 -0
- package/dist/environments/environments.controller.d.ts +33 -0
- package/dist/environments/environments.controller.js +110 -0
- package/dist/environments/environments.module.d.ts +8 -0
- package/dist/environments/environments.module.js +27 -0
- package/dist/environments/environments.service.d.ts +153 -0
- package/dist/environments/environments.service.js +541 -0
- package/dist/environments/legacy-cleanup.job.d.ts +34 -0
- package/dist/environments/legacy-cleanup.job.js +141 -0
- package/dist/errors.d.ts +82 -2
- package/dist/errors.js +82 -2
- package/dist/evals/reconstruct.d.ts +18 -9
- package/dist/evals/reconstruct.js +26 -7
- package/dist/evals/run-replay.d.ts +4 -2
- package/dist/evals/run-replay.js +16 -4
- package/dist/evals/step-replay.d.ts +2 -5
- package/dist/evals/step-replay.js +1 -1
- package/dist/evals/trajectory.service.d.ts +8 -3
- package/dist/evals/trajectory.service.js +26 -14
- package/dist/evals/worker.d.ts +5 -5
- package/dist/evals/worker.js +9 -3
- package/dist/extensions/admin-ops.d.ts +36 -10
- package/dist/extensions/admin-ops.js +65 -42
- package/dist/extensions/admin-view.d.ts +37 -10
- package/dist/extensions/admin-view.js +103 -20
- package/dist/extensions/bootstrap.d.ts +17 -4
- package/dist/extensions/bootstrap.js +70 -9
- package/dist/extensions/cli.d.ts +12 -0
- package/dist/extensions/cli.js +11 -2
- package/dist/extensions/deployment-config.d.ts +28 -5
- package/dist/extensions/deployment-config.js +48 -7
- package/dist/extensions/effective-config.d.ts +127 -0
- package/dist/extensions/effective-config.js +368 -0
- package/dist/extensions/extensions.module.js +8 -2
- package/dist/extensions/hooks.d.ts +37 -4
- package/dist/extensions/hooks.js +82 -16
- package/dist/extensions/host.d.ts +19 -1
- package/dist/extensions/host.js +30 -7
- package/dist/extensions/installs.d.ts +20 -8
- package/dist/extensions/installs.js +37 -15
- package/dist/extensions/org-config.d.ts +75 -6
- package/dist/extensions/org-config.js +184 -32
- package/dist/extensions/org-levels.d.ts +37 -0
- package/dist/extensions/org-levels.js +71 -0
- package/dist/extensions/org-overrides.d.ts +151 -0
- package/dist/extensions/org-overrides.js +524 -0
- package/dist/extensions/permission-view.d.ts +16 -4
- package/dist/extensions/permission-view.js +4 -4
- package/dist/extensions/plugin-items.d.ts +21 -0
- package/dist/extensions/plugin-items.js +42 -0
- package/dist/extensions/point-defaults.d.ts +12 -5
- package/dist/extensions/point-defaults.js +37 -9
- package/dist/extensions/resolve.d.ts +5 -1
- package/dist/extensions/resolve.js +15 -2
- package/dist/files/previewers.d.ts +8 -1
- package/dist/files/previewers.js +35 -6
- package/dist/http/api.module.js +23 -3
- package/dist/http/app.d.ts +11 -2
- package/dist/http/app.js +31 -5
- package/dist/identity/accounts.d.ts +29 -29
- package/dist/identity/accounts.js +47 -47
- package/dist/identity/audit.d.ts +2 -1
- package/dist/identity/auth.guard.d.ts +13 -5
- package/dist/identity/auth.guard.js +26 -9
- package/dist/identity/identity.module.d.ts +1 -1
- package/dist/identity/identity.module.js +4 -4
- package/dist/identity/me.controller.js +1 -1
- package/dist/identity/principal.d.ts +3 -3
- package/dist/identity/principal.js +3 -3
- package/dist/identity/settings.d.ts +22 -11
- package/dist/identity/settings.js +53 -18
- package/dist/identity/{enterprise-admin.d.ts → super-admin.d.ts} +5 -5
- package/dist/identity/{enterprise-admin.js → super-admin.js} +24 -24
- package/dist/inbox/inbox.module.d.ts +4 -1
- package/dist/inbox/inbox.module.js +7 -3
- package/dist/inbox/inbox.service.d.ts +62 -3
- package/dist/inbox/inbox.service.js +74 -4
- package/dist/inbox/org-notices.d.ts +63 -0
- package/dist/inbox/org-notices.js +91 -0
- package/dist/inbox/platform-inbox.controller.d.ts +23 -0
- package/dist/inbox/platform-inbox.controller.js +58 -0
- package/dist/inbox/platform-inbox.service.d.ts +151 -0
- package/dist/inbox/platform-inbox.service.js +263 -0
- package/dist/inbox/platform-notices.d.ts +19 -0
- package/dist/inbox/platform-notices.js +9 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/infra/cli/kernel-cli.module.js +9 -1
- package/dist/infra/config/kernel-config.service.js +21 -1
- package/dist/infra/database/xact-lock.d.ts +1 -1
- package/dist/infra/database/xact-lock.js +1 -1
- package/dist/infra/events/kernel-events.d.ts +11 -2
- package/dist/infra/queue/add-job-once.d.ts +14 -0
- package/dist/infra/queue/add-job-once.js +16 -0
- package/dist/kernel.module.js +6 -0
- package/dist/lifecycle/kernel-lifecycle.d.ts +1 -1
- package/dist/lifecycle/kernel-lifecycle.js +4 -4
- package/dist/models/prices.d.ts +5 -5
- package/dist/models/prices.js +4 -4
- package/dist/models/purposes.controller.d.ts +6 -4
- package/dist/models/purposes.controller.js +13 -7
- package/dist/models/purposes.d.ts +20 -9
- package/dist/models/purposes.js +17 -8
- package/dist/orgs/directory-sync.d.ts +14 -5
- package/dist/orgs/directory-sync.js +41 -17
- package/dist/orgs/offboarding.d.ts +9 -7
- package/dist/orgs/offboarding.js +28 -17
- package/dist/orgs/org-lock.d.ts +5 -0
- package/dist/orgs/org-lock.js +13 -0
- package/dist/orgs/org.guard.d.ts +10 -0
- package/dist/orgs/org.guard.js +43 -32
- package/dist/orgs/orgs.module.js +3 -0
- package/dist/orgs/orgs.service.d.ts +20 -7
- package/dist/orgs/orgs.service.js +32 -12
- package/dist/orgs/roles.d.ts +1 -1
- package/dist/orgs/roles.js +5 -1
- package/dist/orgs/settings.controller.d.ts +1 -1
- package/dist/orgs/settings.service.d.ts +15 -3
- package/dist/orgs/settings.service.js +6 -2
- package/dist/overrides.d.ts +3 -0
- package/dist/overrides.js +2 -0
- package/dist/platform/actor.d.ts +48 -0
- package/dist/platform/actor.js +100 -0
- package/dist/platform/agent-docs.d.ts +18 -0
- package/dist/platform/agent-docs.js +59 -0
- package/dist/platform/availability.d.ts +14 -0
- package/dist/platform/availability.js +43 -0
- package/dist/platform/errors.d.ts +11 -0
- package/dist/platform/errors.js +26 -0
- package/dist/platform/exclusions.d.ts +12 -0
- package/dist/platform/exclusions.js +1387 -0
- package/dist/platform/method.d.ts +6 -0
- package/dist/platform/method.js +15 -0
- package/dist/platform/operation.d.ts +92 -0
- package/dist/platform/operation.js +35 -0
- package/dist/platform/ops/agent-templates.ops.d.ts +14 -0
- package/dist/platform/ops/agent-templates.ops.js +92 -0
- package/dist/platform/ops/agents.ops.d.ts +19 -0
- package/dist/platform/ops/agents.ops.js +294 -0
- package/dist/platform/ops/connectors.ops.d.ts +15 -0
- package/dist/platform/ops/connectors.ops.js +126 -0
- package/dist/platform/ops/errors.d.ts +11 -0
- package/dist/platform/ops/errors.js +22 -0
- package/dist/platform/ops/extensions.ops.d.ts +19 -0
- package/dist/platform/ops/extensions.ops.js +116 -0
- package/dist/platform/ops/marketplaces.ops.d.ts +16 -0
- package/dist/platform/ops/marketplaces.ops.js +157 -0
- package/dist/platform/ops/paging.d.ts +14 -0
- package/dist/platform/ops/paging.js +20 -0
- package/dist/platform/ops/platform.ops.d.ts +23 -0
- package/dist/platform/ops/platform.ops.js +158 -0
- package/dist/platform/ops/plugins.ops.d.ts +33 -0
- package/dist/platform/ops/plugins.ops.js +377 -0
- package/dist/platform/ops/requests.ops.d.ts +14 -0
- package/dist/platform/ops/requests.ops.js +153 -0
- package/dist/platform/ops/role.d.ts +4 -0
- package/dist/platform/ops/role.js +10 -0
- package/dist/platform/ops/skills.ops.d.ts +13 -0
- package/dist/platform/ops/skills.ops.js +98 -0
- package/dist/platform/ops/summary.d.ts +10 -0
- package/dist/platform/ops/summary.js +18 -0
- package/dist/platform/platform-ops.module.d.ts +7 -0
- package/dist/platform/platform-ops.module.js +55 -0
- package/dist/platform/platform.module.d.ts +8 -0
- package/dist/platform/platform.module.js +25 -0
- package/dist/platform/redact-orgs.d.ts +7 -0
- package/dist/platform/redact-orgs.js +52 -0
- package/dist/platform/registry.d.ts +30 -0
- package/dist/platform/registry.js +111 -0
- package/dist/roles/worker-role.d.ts +6 -4
- package/dist/roles/worker-role.js +14 -7
- package/dist/roles/worker.module.d.ts +1 -1
- package/dist/roles/worker.module.js +9 -1
- package/dist/runtime/context/build.d.ts +6 -4
- package/dist/runtime/context/build.js +26 -7
- package/dist/runtime/context/claude-tools.d.ts +2 -1
- package/dist/runtime/context/claude-tools.js +5 -4
- package/dist/runtime/context/compaction.js +9 -0
- package/dist/runtime/context/reminders.d.ts +2 -0
- package/dist/runtime/context/reminders.js +2 -0
- package/dist/runtime/context/skills.js +9 -2
- package/dist/runtime/context/tool-changes.d.ts +27 -0
- package/dist/runtime/context/tool-changes.js +60 -0
- package/dist/runtime/hook-calls.js +2 -0
- package/dist/runtime/langgraph-loop.d.ts +3 -1
- package/dist/runtime/langgraph-loop.js +35 -17
- package/dist/runtime/loop.d.ts +32 -4
- package/dist/runtime/maintenance.d.ts +7 -4
- package/dist/runtime/maintenance.js +23 -8
- package/dist/runtime/model-call.d.ts +30 -8
- package/dist/runtime/model-call.js +69 -19
- package/dist/runtime/run-control.d.ts +11 -1
- package/dist/runtime/run-control.js +12 -0
- package/dist/runtime/run-drafts.d.ts +85 -0
- package/dist/runtime/run-drafts.js +230 -0
- package/dist/runtime/run-jobs.d.ts +3 -5
- package/dist/runtime/run-jobs.js +3 -7
- package/dist/runtime/run-queue.d.ts +37 -3
- package/dist/runtime/run-queue.js +188 -11
- package/dist/runtime/run-worker.d.ts +11 -5
- package/dist/runtime/run-worker.js +54 -31
- package/dist/runtime/runtime.module.js +3 -0
- package/dist/runtime/step-log.d.ts +9 -4
- package/dist/runtime/step-log.js +8 -5
- package/dist/runtime/stream.controller.d.ts +23 -1
- package/dist/runtime/stream.controller.js +60 -3
- package/dist/runtime/stream.d.ts +4 -1
- package/dist/runtime/stream.js +27 -3
- package/dist/runtime/subagents/child.d.ts +55 -7
- package/dist/runtime/subagents/child.js +105 -7
- package/dist/runtime/subagents/definition.d.ts +12 -3
- package/dist/runtime/subagents/definition.js +43 -29
- package/dist/runtime/subagents/deliveries.d.ts +71 -0
- package/dist/runtime/subagents/deliveries.js +228 -0
- package/dist/runtime/subagents/dispatch.d.ts +115 -26
- package/dist/runtime/subagents/dispatch.js +212 -141
- package/dist/runtime/subagents/limits.d.ts +24 -5
- package/dist/runtime/subagents/limits.js +40 -6
- package/dist/runtime/subagents/messages.d.ts +95 -0
- package/dist/runtime/subagents/messages.js +328 -0
- package/dist/runtime/subagents/preamble.d.ts +4 -4
- package/dist/runtime/subagents/preamble.js +9 -7
- package/dist/runtime/subagents/progress.d.ts +8 -6
- package/dist/runtime/subagents/progress.js +11 -6
- package/dist/runtime/subagents/render.d.ts +30 -0
- package/dist/runtime/subagents/render.js +53 -0
- package/dist/runtime/subagents/roster.d.ts +24 -7
- package/dist/runtime/subagents/roster.js +47 -11
- package/dist/runtime/subagents/skill-fork.d.ts +3 -2
- package/dist/runtime/subagents/skill-fork.js +8 -4
- package/dist/runtime/subagents/status.d.ts +14 -0
- package/dist/runtime/subagents/status.js +23 -0
- package/dist/runtime/subagents/subagents.service.d.ts +7 -4
- package/dist/runtime/subagents/subagents.service.js +11 -6
- package/dist/runtime/usage-report.js +17 -12
- package/dist/runtime/waits.d.ts +140 -37
- package/dist/runtime/waits.js +394 -106
- package/dist/sandbox/jobs.d.ts +40 -13
- package/dist/sandbox/jobs.js +57 -20
- package/dist/sandbox/leases.d.ts +37 -54
- package/dist/sandbox/leases.js +71 -115
- package/dist/sandbox/providers.d.ts +2 -2
- package/dist/sandbox/providers.js +1 -1
- package/dist/sandbox/sandbox.module.d.ts +3 -2
- package/dist/sandbox/sandbox.module.js +4 -3
- package/dist/sandbox/sandbox.service.d.ts +229 -134
- package/dist/sandbox/sandbox.service.js +630 -409
- package/dist/skills/catalog.d.ts +3 -2
- package/dist/skills/catalog.js +21 -43
- package/dist/skills/changes.controller.d.ts +7 -0
- package/dist/skills/changes.controller.js +19 -1
- package/dist/skills/invoke.js +8 -3
- package/dist/skills/package.d.ts +20 -1
- package/dist/skills/package.js +28 -1
- package/dist/skills/skills.controller.d.ts +39 -4
- package/dist/skills/skills.controller.js +88 -10
- package/dist/skills/skills.module.js +10 -1
- package/dist/skills/skills.service.d.ts +106 -26
- package/dist/skills/skills.service.js +421 -75
- package/dist/skills/usable.d.ts +81 -0
- package/dist/skills/usable.js +379 -0
- package/dist/tools/approvals.service.d.ts +20 -2
- package/dist/tools/approvals.service.js +23 -4
- package/dist/tools/builtin-names.d.ts +21 -5
- package/dist/tools/builtin-names.js +30 -5
- package/dist/tools/builtins/agent.d.ts +23 -21
- package/dist/tools/builtins/agent.js +62 -55
- package/dist/tools/builtins/builtin-tools.d.ts +6 -2
- package/dist/tools/builtins/builtin-tools.js +37 -12
- package/dist/tools/builtins/handback.d.ts +28 -0
- package/dist/tools/builtins/handback.js +53 -0
- package/dist/tools/builtins/platform.d.ts +34 -0
- package/dist/tools/builtins/platform.js +362 -0
- package/dist/tools/builtins/sandbox/bash.js +13 -3
- package/dist/tools/builtins/sandbox/common.d.ts +43 -24
- package/dist/tools/builtins/sandbox/common.js +80 -45
- package/dist/tools/builtins/sandbox/edit.js +2 -2
- package/dist/tools/builtins/sandbox/glob.js +2 -2
- package/dist/tools/builtins/sandbox/grep.js +2 -4
- package/dist/tools/builtins/sandbox/index.d.ts +1 -1
- package/dist/tools/builtins/sandbox/index.js +1 -1
- package/dist/tools/builtins/sandbox/read.js +1 -1
- package/dist/tools/builtins/sandbox/task-output.d.ts +14 -3
- package/dist/tools/builtins/sandbox/task-output.js +30 -5
- package/dist/tools/builtins/sandbox/task-stop.js +2 -1
- package/dist/tools/builtins/sandbox/write.js +2 -2
- package/dist/tools/builtins/send-message.d.ts +56 -0
- package/dist/tools/builtins/send-message.js +100 -0
- package/dist/tools/builtins/skill-load.d.ts +22 -14
- package/dist/tools/builtins/skill-load.js +86 -57
- package/dist/tools/builtins/skill-write.js +1 -1
- package/dist/tools/builtins/web/extract.js +5 -1
- package/dist/tools/builtins/web/fetch.js +1 -0
- package/dist/tools/builtins/web/search.js +1 -0
- package/dist/tools/connectors.controller.d.ts +10 -0
- package/dist/tools/connectors.controller.js +12 -0
- package/dist/tools/connectors.service.d.ts +46 -5
- package/dist/tools/connectors.service.js +94 -15
- package/dist/tools/extension-tools.controller.d.ts +14 -0
- package/dist/tools/extension-tools.controller.js +37 -0
- package/dist/tools/info.d.ts +42 -1
- package/dist/tools/info.js +64 -1
- package/dist/tools/org-tool-switches.d.ts +74 -0
- package/dist/tools/org-tool-switches.js +184 -0
- package/dist/tools/pipeline.d.ts +46 -40
- package/dist/tools/pipeline.js +187 -364
- package/dist/tools/policy.d.ts +1 -1
- package/dist/tools/policy.js +36 -16
- package/dist/tools/registry.d.ts +98 -5
- package/dist/tools/registry.js +87 -9
- package/dist/tools/tools.module.js +12 -2
- package/dist/ui/views.d.ts +2 -1
- package/dist/ui/views.js +17 -3
- package/package.json +3 -3
- package/src/migrations/0074_subagent_tree.sql +50 -0
- package/src/migrations/0075_plugin_scope.sql +61 -0
- package/src/migrations/0076_skills_created_by_nullable.sql +6 -0
- package/src/migrations/0077_scope_requests.sql +52 -0
- package/src/migrations/0078_scope_grant_switches.sql +18 -0
- package/src/migrations/0079_scope_live_install_switches.sql +19 -0
- package/src/migrations/0080_rename_enterprise_admin.sql +18 -0
- package/src/migrations/0081_platform_components.sql +129 -0
- package/src/migrations/0082_platform_migration.sql +33 -0
- package/src/migrations/0083_plugin_scope_sync_failures.sql +15 -0
- package/src/migrations/0084_org_owned_items.sql +85 -0
- package/src/migrations/0085_agent_templates_phase4.sql +45 -0
- package/src/migrations/0086_org_layering.sql +30 -0
- package/src/migrations/0087_approval_summary.sql +6 -0
- package/src/migrations/0088_environments.sql +80 -0
- package/dist/catalog/upgrade-targets.d.ts +0 -56
- package/dist/catalog/upgrade-targets.js +0 -90
- package/dist/conversations/sandbox-status.d.ts +0 -24
- package/dist/conversations/sandbox-status.js +0 -52
- package/dist/extensions/org-config.controller.d.ts +0 -32
- package/dist/extensions/org-config.controller.js +0 -70
|
@@ -8,10 +8,11 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
8
8
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
9
|
};
|
|
10
10
|
import { Controller, Get, Inject, Param, Put } from "@nestjs/common";
|
|
11
|
+
import { ExtensionDisplayNames } from "../extensions/display-name.js";
|
|
11
12
|
import { CurrentPrincipal, patTokenId, requireUser, } from "../identity/principal.js";
|
|
12
13
|
import { ZBody } from "../infra/validation/zod-params.js";
|
|
13
14
|
import { CurrentOrg, OrgAction } from "../orgs/org.guard.js";
|
|
14
|
-
import { ModelPurposesService, PurposePutDto, } from "./purposes.js";
|
|
15
|
+
import { ModelPurposesService, PurposePutDto, withDeclaredByNames, } from "./purposes.js";
|
|
15
16
|
/** body 的目标(参数缺省为 `{}`)。 */
|
|
16
17
|
export const purposeTargetOf = (b) => b.target === null ? null : { model: b.target.model, params: b.target.params ?? {} };
|
|
17
18
|
/**
|
|
@@ -20,18 +21,22 @@ export const purposeTargetOf = (b) => b.target === null ? null : { model: b.targ
|
|
|
20
21
|
*/
|
|
21
22
|
let ModelPurposesController = class ModelPurposesController {
|
|
22
23
|
purposes;
|
|
23
|
-
|
|
24
|
+
displayNames;
|
|
25
|
+
constructor(purposes, displayNames) {
|
|
24
26
|
this.purposes = purposes;
|
|
27
|
+
this.displayNames = displayNames;
|
|
25
28
|
}
|
|
26
29
|
async list(principal, org) {
|
|
27
30
|
requireUser(principal);
|
|
28
|
-
return {
|
|
31
|
+
return {
|
|
32
|
+
purposes: await withDeclaredByNames(await this.purposes.list(org.orgId), this.displayNames),
|
|
33
|
+
};
|
|
29
34
|
}
|
|
30
35
|
async put(principal, org, purpose, body) {
|
|
31
36
|
const p = requireUser(principal);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
37
|
+
const view = await this.purposes.setOrg(org.orgId, purpose, purposeTargetOf(body), p.account.id, patTokenId(p));
|
|
38
|
+
const [listing] = await withDeclaredByNames([view], this.displayNames);
|
|
39
|
+
return { purpose: listing };
|
|
35
40
|
}
|
|
36
41
|
};
|
|
37
42
|
__decorate([
|
|
@@ -50,6 +55,7 @@ __decorate([
|
|
|
50
55
|
], ModelPurposesController.prototype, "put", null);
|
|
51
56
|
ModelPurposesController = __decorate([
|
|
52
57
|
Controller("api/v1/orgs/:orgId/model-purposes"),
|
|
53
|
-
__param(0, Inject(ModelPurposesService))
|
|
58
|
+
__param(0, Inject(ModelPurposesService)),
|
|
59
|
+
__param(1, Inject(ExtensionDisplayNames))
|
|
54
60
|
], ModelPurposesController);
|
|
55
61
|
export { ModelPurposesController };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type ContentBlock, type ModelRequest, type ModelUsage, type ParamValue, type StopReason } from "@capybara-hq/plugin-sdk";
|
|
1
|
+
import { type ContentBlock, type LocalizedName, type ModelRequest, type ModelUsage, type ParamValue, type StopReason } from "@capybara-hq/plugin-sdk";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { ModelRef } from "../agents/definition.js";
|
|
4
4
|
import { ExtensionRegistry } from "../extensions/registry.js";
|
|
5
|
-
import {
|
|
5
|
+
import { SuperAdminLock } from "../identity/super-admin.js";
|
|
6
6
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
7
7
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
8
8
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
@@ -11,7 +11,7 @@ import { ProviderRegistry } from "../runtime/providers.js";
|
|
|
11
11
|
/**
|
|
12
12
|
* 模型用途映射(C9):内核与插件按「用途」取模型,不在代码里写死模型。
|
|
13
13
|
* - 用途 = 内核用途 {@link KERNEL_PURPOSES}(目前只有评委 `eval`),或已加载插件 `permissions.models` 声明的;
|
|
14
|
-
* - 映射 = 部署默认(`org_id` 为 null
|
|
14
|
+
* - 映射 = 部署默认(`org_id` 为 null,超级管理员设)+ 组织覆盖(组织管理员设,`org.models.manage`);
|
|
15
15
|
* 生效的映射先取组织覆盖、再取部署默认,都没有 → `model.unconfigured`;
|
|
16
16
|
* - 目标模型按部署范围解析(与运行时一致),参数按目标模型自己的声明严格校验;不做模型白名单;
|
|
17
17
|
* - 每次都查 PG,不在进程内缓存(多副本下改映射立即生效)。`ctx.models` 仍预留,插件暂不能调用。
|
|
@@ -46,21 +46,21 @@ export declare const KERNEL_PURPOSES: readonly [{
|
|
|
46
46
|
readonly purpose: "subagent_fast";
|
|
47
47
|
readonly kind: "chat";
|
|
48
48
|
readonly label: {
|
|
49
|
-
readonly zh: "
|
|
49
|
+
readonly zh: "子智能体:快速";
|
|
50
50
|
readonly en: "Sub-agent: fast";
|
|
51
51
|
};
|
|
52
52
|
}, {
|
|
53
53
|
readonly purpose: "subagent_standard";
|
|
54
54
|
readonly kind: "chat";
|
|
55
55
|
readonly label: {
|
|
56
|
-
readonly zh: "
|
|
56
|
+
readonly zh: "子智能体:标准";
|
|
57
57
|
readonly en: "Sub-agent: standard";
|
|
58
58
|
};
|
|
59
59
|
}, {
|
|
60
60
|
readonly purpose: "subagent_capable";
|
|
61
61
|
readonly kind: "chat";
|
|
62
62
|
readonly label: {
|
|
63
|
-
readonly zh: "
|
|
63
|
+
readonly zh: "子智能体:最强";
|
|
64
64
|
readonly en: "Sub-agent: capable";
|
|
65
65
|
};
|
|
66
66
|
}];
|
|
@@ -82,6 +82,17 @@ export interface PurposeView {
|
|
|
82
82
|
override: PurposeTarget | null;
|
|
83
83
|
effective: PurposeTarget | null;
|
|
84
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* A purpose as the purpose APIs return it: the view plus the declaring extension's display name
|
|
87
|
+
* (`null` for a kernel purpose, or an extension without one), so a page names the extension.
|
|
88
|
+
*/
|
|
89
|
+
export interface PurposeListing extends PurposeView {
|
|
90
|
+
declaredByName: LocalizedName | null;
|
|
91
|
+
}
|
|
92
|
+
/** {@link PurposeListing}s of `views`, the display names read in one call. */
|
|
93
|
+
export declare function withDeclaredByNames(views: PurposeView[], names: {
|
|
94
|
+
many(names: string[]): Promise<Map<string, LocalizedName | null>>;
|
|
95
|
+
}): Promise<PurposeListing[]>;
|
|
85
96
|
/** `PUT …/model-purposes/:purpose` 的 body:设映射,或 `target: null` 清除。 */
|
|
86
97
|
export declare const PURPOSE_PUT: z.ZodObject<{
|
|
87
98
|
target: z.ZodNullable<z.ZodObject<{
|
|
@@ -128,7 +139,7 @@ export declare class ModelPurposesService {
|
|
|
128
139
|
readonly txHost: TransactionHost;
|
|
129
140
|
private readonly adminLock;
|
|
130
141
|
private readonly orgLock;
|
|
131
|
-
constructor(db: KernelDb, extensions: ExtensionRegistry, config: KernelConfigService, providers: Pick<ProviderRegistry, "resolve">, txHost: TransactionHost, adminLock:
|
|
142
|
+
constructor(db: KernelDb, extensions: ExtensionRegistry, config: KernelConfigService, providers: Pick<ProviderRegistry, "resolve">, txHost: TransactionHost, adminLock: SuperAdminLock, orgLock: OrgLock);
|
|
132
143
|
/** 全部已声明的用途:内核的在前,其后按插件加载顺序。 */
|
|
133
144
|
private declared;
|
|
134
145
|
private find;
|
|
@@ -139,9 +150,9 @@ export declare class ModelPurposesService {
|
|
|
139
150
|
/** 校验目标:模型可解析(部署范围)、参数按它的声明严格通过。 */
|
|
140
151
|
private check;
|
|
141
152
|
private set;
|
|
142
|
-
/** The mapping write of {@link set}, under the
|
|
153
|
+
/** The mapping write of {@link set}, under the super admin or org lock. */
|
|
143
154
|
private write;
|
|
144
|
-
/** 设置(或 `null`
|
|
155
|
+
/** 设置(或 `null` 清除)部署默认;只有超级管理员(事务内复核)。 */
|
|
145
156
|
setDefault(purpose: string, target: PurposeTarget | null, actor: string, actorTokenId?: string): Promise<PurposeView>;
|
|
146
157
|
/** 设置(或 `null` 清除)组织覆盖;事务内锁组织并复核 `org.models.manage`。 */
|
|
147
158
|
setOrg(orgId: string, purpose: string, target: PurposeTarget | null, actor: string, actorTokenId?: string): Promise<PurposeView>;
|
package/dist/models/purposes.js
CHANGED
|
@@ -14,7 +14,7 @@ import { ModelRef, paramIssues } from "../agents/definition.js";
|
|
|
14
14
|
import { ApiError } from "../errors.js";
|
|
15
15
|
import { ExtensionRegistry } from "../extensions/registry.js";
|
|
16
16
|
import { audit } from "../identity/audit.js";
|
|
17
|
-
import {
|
|
17
|
+
import { SuperAdminLock } from "../identity/super-admin.js";
|
|
18
18
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
19
19
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
20
20
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
@@ -27,7 +27,7 @@ import { ProviderListError, ProviderRegistry } from "../runtime/providers.js";
|
|
|
27
27
|
/**
|
|
28
28
|
* 模型用途映射(C9):内核与插件按「用途」取模型,不在代码里写死模型。
|
|
29
29
|
* - 用途 = 内核用途 {@link KERNEL_PURPOSES}(目前只有评委 `eval`),或已加载插件 `permissions.models` 声明的;
|
|
30
|
-
* - 映射 = 部署默认(`org_id` 为 null
|
|
30
|
+
* - 映射 = 部署默认(`org_id` 为 null,超级管理员设)+ 组织覆盖(组织管理员设,`org.models.manage`);
|
|
31
31
|
* 生效的映射先取组织覆盖、再取部署默认,都没有 → `model.unconfigured`;
|
|
32
32
|
* - 目标模型按部署范围解析(与运行时一致),参数按目标模型自己的声明严格校验;不做模型白名单;
|
|
33
33
|
* - 每次都查 PG,不在进程内缓存(多副本下改映射立即生效)。`ctx.models` 仍预留,插件暂不能调用。
|
|
@@ -49,19 +49,28 @@ export const KERNEL_PURPOSES = [
|
|
|
49
49
|
{
|
|
50
50
|
purpose: "subagent_fast",
|
|
51
51
|
kind: "chat",
|
|
52
|
-
label: { zh: "
|
|
52
|
+
label: { zh: "子智能体:快速", en: "Sub-agent: fast" },
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
purpose: "subagent_standard",
|
|
56
56
|
kind: "chat",
|
|
57
|
-
label: { zh: "
|
|
57
|
+
label: { zh: "子智能体:标准", en: "Sub-agent: standard" },
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
purpose: "subagent_capable",
|
|
61
61
|
kind: "chat",
|
|
62
|
-
label: { zh: "
|
|
62
|
+
label: { zh: "子智能体:最强", en: "Sub-agent: capable" },
|
|
63
63
|
},
|
|
64
64
|
];
|
|
65
|
+
/** {@link PurposeListing}s of `views`, the display names read in one call. */
|
|
66
|
+
export async function withDeclaredByNames(views, names) {
|
|
67
|
+
const plugins = views.map((v) => v.declaredBy).filter((d) => d !== "kernel");
|
|
68
|
+
const found = await names.many(plugins);
|
|
69
|
+
return views.map((v) => ({
|
|
70
|
+
...v,
|
|
71
|
+
declaredByName: v.declaredBy === "kernel" ? null : (found.get(v.declaredBy) ?? null),
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
65
74
|
/** `PUT …/model-purposes/:purpose` 的 body:设映射,或 `target: null` 清除。 */
|
|
66
75
|
export const PURPOSE_PUT = z
|
|
67
76
|
.object({
|
|
@@ -206,7 +215,7 @@ let ModelPurposesService = class ModelPurposesService {
|
|
|
206
215
|
const [view] = await this.views([decl], orgId ?? undefined);
|
|
207
216
|
return view;
|
|
208
217
|
}
|
|
209
|
-
/** The mapping write of {@link set}, under the
|
|
218
|
+
/** The mapping write of {@link set}, under the super admin or org lock. */
|
|
210
219
|
async write(orgId, purpose, target, actor, actorTokenId) {
|
|
211
220
|
if (orgId === null)
|
|
212
221
|
await this.adminLock.lockAndAuthorize(actor);
|
|
@@ -243,7 +252,7 @@ let ModelPurposesService = class ModelPurposesService {
|
|
|
243
252
|
detail: { scope: orgId === null ? "deployment" : "org", target },
|
|
244
253
|
});
|
|
245
254
|
}
|
|
246
|
-
/** 设置(或 `null`
|
|
255
|
+
/** 设置(或 `null` 清除)部署默认;只有超级管理员(事务内复核)。 */
|
|
247
256
|
setDefault(purpose, target, actor, actorTokenId) {
|
|
248
257
|
return this.set(null, purpose, target, actor, actorTokenId);
|
|
249
258
|
}
|
|
@@ -332,7 +341,7 @@ ModelPurposesService = __decorate([
|
|
|
332
341
|
__param(2, Inject(KernelConfigService)),
|
|
333
342
|
__param(3, Inject(ProviderRegistry)),
|
|
334
343
|
__param(4, Inject(TransactionHost)),
|
|
335
|
-
__param(5, Inject(
|
|
344
|
+
__param(5, Inject(SuperAdminLock)),
|
|
336
345
|
__param(6, Inject(OrgLock))
|
|
337
346
|
], ModelPurposesService);
|
|
338
347
|
export { ModelPurposesService };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Queue } from "bullmq";
|
|
2
2
|
import type { Redis } from "ioredis";
|
|
3
|
+
import { EffectiveConfigs } from "../extensions/effective-config.js";
|
|
3
4
|
import { OrgExtensionConfigs } from "../extensions/org-config.js";
|
|
4
5
|
import { ExtensionRegistry } from "../extensions/registry.js";
|
|
5
6
|
import { ExternalIdentities } from "../identity/external.js";
|
|
@@ -35,9 +36,11 @@ export declare const DIRECTORY_MAX_PAGES = 10000;
|
|
|
35
36
|
export type DirectorySyncTrigger = "schedule" | "changed" | "manual";
|
|
36
37
|
/**
|
|
37
38
|
* 不同步的原因(陈旧任务、插件已停用 / 配置不再有效、组织已删除、另一同步在跑;`not_configured`:插件的
|
|
38
|
-
* `Directory.configured` 说这份组织配置没配好通讯录,Ruling A28
|
|
39
|
+
* `Directory.configured` 说这份组织配置没配好通讯录,Ruling A28,静默跳过)。`needs_config`: the
|
|
40
|
+
* extension's effective deployment config for the org is not valid (layering spec A §6): skipped
|
|
41
|
+
* silently like `not_configured`; the org admin sees the extension as needing configuration.
|
|
39
42
|
*/
|
|
40
|
-
export type DirectorySkipReason = "plugin_unavailable" | "org_not_found" | "not_enabled" | "config_invalid" | "not_configured" | "locked";
|
|
43
|
+
export type DirectorySkipReason = "plugin_unavailable" | "org_not_found" | "not_enabled" | "config_invalid" | "not_configured" | "needs_config" | "locked";
|
|
41
44
|
export type DirectorySyncResult = {
|
|
42
45
|
status: "skipped";
|
|
43
46
|
reason: DirectorySkipReason;
|
|
@@ -122,18 +125,23 @@ export declare class DirectorySync {
|
|
|
122
125
|
private readonly redis;
|
|
123
126
|
private readonly registry;
|
|
124
127
|
private readonly orgConfigs;
|
|
128
|
+
private readonly effective;
|
|
125
129
|
private readonly external;
|
|
126
130
|
private readonly offboarding;
|
|
127
131
|
private readonly orgLock;
|
|
128
132
|
private readonly queue;
|
|
129
133
|
readonly lockService: LockService;
|
|
130
134
|
readonly log: KernelLogger;
|
|
131
|
-
constructor(db: KernelDb, txHost: TransactionHost, redis: Redis, registry: Pick<ExtensionRegistry, "list">, orgConfigs: Pick<OrgExtensionConfigs, "get">, external: Pick<ExternalIdentities, "resolve">, offboarding: Pick<Offboarding, "offboard" | "afterOffboard">, orgLock: OrgLock, queue: Pick<Queue, "add">, lockService: LockService, log: KernelLogger);
|
|
135
|
+
constructor(db: KernelDb, txHost: TransactionHost, redis: Redis, registry: Pick<ExtensionRegistry, "list">, orgConfigs: Pick<OrgExtensionConfigs, "get">, effective: Pick<EffectiveConfigs, "get">, external: Pick<ExternalIdentities, "resolve">, offboarding: Pick<Offboarding, "offboard" | "afterOffboard">, orgLock: OrgLock, queue: Pick<Queue, "add">, lockService: LockService, log: KernelLogger);
|
|
132
136
|
/** A `directory-sync` job (dispatched by `MaintenanceProcessor`). */
|
|
133
137
|
runSyncJob(data: SyncJobData): Promise<void>;
|
|
134
138
|
/** 插件提供的 `directory@1`;未加载或不提供时 undefined。 */
|
|
135
139
|
private provider;
|
|
136
|
-
/**
|
|
140
|
+
/**
|
|
141
|
+
* The org exists, the extension provides a directory, is enabled in the org, its org config
|
|
142
|
+
* satisfies the schema (reuses the `OrgExtensionConfigs.get` validation) and its effective
|
|
143
|
+
* deployment config for the org is valid (layering spec A §6).
|
|
144
|
+
*/
|
|
137
145
|
private eligible;
|
|
138
146
|
/**
|
|
139
147
|
* 投递一次 `directory_changed` 同步(按分钟桶去重);返回 job id。入站 `directory_changed` 经
|
|
@@ -146,7 +154,8 @@ export declare class DirectorySync {
|
|
|
146
154
|
* Manual trigger by an admin: re-checks `org.members.manage` live under the org row lock, then that
|
|
147
155
|
* the extension can sync (does not provide a directory -> `extension.not_found`, not enabled ->
|
|
148
156
|
* `extension.not_enabled`, config no longer valid -> `extension.config_invalid`, the extension says
|
|
149
|
-
* the directory is not configured -> `directory.not_configured`, Ruling A28
|
|
157
|
+
* the directory is not configured -> `directory.not_configured`, Ruling A28; the effective config
|
|
158
|
+
* is not valid in the org -> `extension.needs_config`, layering spec A §6), and enqueues a sync
|
|
150
159
|
* job with a unique id.
|
|
151
160
|
*/
|
|
152
161
|
request(orgId: string, plugin: string, actorAccountId: string, actorTokenId?: string): Promise<{
|
|
@@ -12,6 +12,7 @@ import { DIRECTORY_EXTENSION_POINT, } from "@capybara-hq/plugin-sdk";
|
|
|
12
12
|
import { getQueueToken } from "@nestjs/bullmq";
|
|
13
13
|
import { Inject, Injectable } from "@nestjs/common";
|
|
14
14
|
import { ApiError } from "../errors.js";
|
|
15
|
+
import { EffectiveConfigs } from "../extensions/effective-config.js";
|
|
15
16
|
import { enabledExtensionsByOrg } from "../extensions/enabled.js";
|
|
16
17
|
import { OrgExtensionConfigs } from "../extensions/org-config.js";
|
|
17
18
|
import { ExtensionRegistry } from "../extensions/registry.js";
|
|
@@ -80,6 +81,8 @@ export function directorySyncJobId(orgId, plugin, trigger, now = new Date()) {
|
|
|
80
81
|
return `${base}-manual-${randomUUID()}`;
|
|
81
82
|
}
|
|
82
83
|
}
|
|
84
|
+
/** Skips that log nothing and enqueue nothing: Ruling A28 and an org needing configuration. */
|
|
85
|
+
const silentSkip = (reason) => reason === "not_configured" || reason === "needs_config";
|
|
83
86
|
/** 组织已删除(同步途中):停止本轮。 */
|
|
84
87
|
class OrgGone extends Error {
|
|
85
88
|
}
|
|
@@ -122,18 +125,20 @@ let DirectorySync = class DirectorySync {
|
|
|
122
125
|
redis;
|
|
123
126
|
registry;
|
|
124
127
|
orgConfigs;
|
|
128
|
+
effective;
|
|
125
129
|
external;
|
|
126
130
|
offboarding;
|
|
127
131
|
orgLock;
|
|
128
132
|
queue;
|
|
129
133
|
lockService;
|
|
130
134
|
log;
|
|
131
|
-
constructor(db, txHost, redis, registry, orgConfigs, external, offboarding, orgLock, queue, lockService, log) {
|
|
135
|
+
constructor(db, txHost, redis, registry, orgConfigs, effective, external, offboarding, orgLock, queue, lockService, log) {
|
|
132
136
|
this.db = db;
|
|
133
137
|
this.txHost = txHost;
|
|
134
138
|
this.redis = redis;
|
|
135
139
|
this.registry = registry;
|
|
136
140
|
this.orgConfigs = orgConfigs;
|
|
141
|
+
this.effective = effective;
|
|
137
142
|
this.external = external;
|
|
138
143
|
this.offboarding = offboarding;
|
|
139
144
|
this.orgLock = orgLock;
|
|
@@ -144,8 +149,8 @@ let DirectorySync = class DirectorySync {
|
|
|
144
149
|
/** A `directory-sync` job (dispatched by `MaintenanceProcessor`). */
|
|
145
150
|
async runSyncJob(data) {
|
|
146
151
|
const r = await this.sync(data.orgId, data.plugin, data);
|
|
147
|
-
// 通讯录未配置(Ruling A28
|
|
148
|
-
if (r.status === "skipped" && r.reason
|
|
152
|
+
// 通讯录未配置(Ruling A28)and an org needing configuration (spec A §6) are skipped silently
|
|
153
|
+
if (r.status === "skipped" && !silentSkip(r.reason)) {
|
|
149
154
|
this.log.info("directory sync skipped", {
|
|
150
155
|
orgId: data.orgId,
|
|
151
156
|
plugin: data.plugin,
|
|
@@ -159,7 +164,11 @@ let DirectorySync = class DirectorySync {
|
|
|
159
164
|
.list("directory")
|
|
160
165
|
.find((e) => e.plugin === plugin && e.capability === DIRECTORY_EXTENSION_POINT)?.impl;
|
|
161
166
|
}
|
|
162
|
-
/**
|
|
167
|
+
/**
|
|
168
|
+
* The org exists, the extension provides a directory, is enabled in the org, its org config
|
|
169
|
+
* satisfies the schema (reuses the `OrgExtensionConfigs.get` validation) and its effective
|
|
170
|
+
* deployment config for the org is valid (layering spec A §6).
|
|
171
|
+
*/
|
|
163
172
|
async eligible(orgId, plugin) {
|
|
164
173
|
const directory = this.provider(plugin);
|
|
165
174
|
if (!directory)
|
|
@@ -186,11 +195,21 @@ let DirectorySync = class DirectorySync {
|
|
|
186
195
|
}
|
|
187
196
|
if (!cfg?.enabled)
|
|
188
197
|
return { ok: false, reason: "not_enabled" };
|
|
198
|
+
let effective;
|
|
199
|
+
try {
|
|
200
|
+
effective = await this.effective.get(orgId, plugin);
|
|
201
|
+
}
|
|
202
|
+
catch (err) {
|
|
203
|
+
this.log.warn("directory sync: cannot read the effective config", { orgId, plugin, err });
|
|
204
|
+
return { ok: false, reason: "config_invalid" };
|
|
205
|
+
}
|
|
206
|
+
if (!effective.ok)
|
|
207
|
+
return { ok: false, reason: "needs_config" };
|
|
189
208
|
// Ruling A28:插件说通讯录没配好(组织只用它的别的能力)→ 不同步;插件实现出错按未配置处理
|
|
190
209
|
if (directory.configured !== undefined) {
|
|
191
210
|
let configured = false;
|
|
192
211
|
try {
|
|
193
|
-
configured = directory.configured(cfg.config) === true;
|
|
212
|
+
configured = directory.configured(cfg.config, effective.config) === true;
|
|
194
213
|
}
|
|
195
214
|
catch {
|
|
196
215
|
configured = false;
|
|
@@ -198,7 +217,7 @@ let DirectorySync = class DirectorySync {
|
|
|
198
217
|
if (!configured)
|
|
199
218
|
return { ok: false, reason: "not_configured" };
|
|
200
219
|
}
|
|
201
|
-
return { ok: true, directory, orgConfig: cfg.config };
|
|
220
|
+
return { ok: true, directory, orgConfig: cfg.config, config: effective.config };
|
|
202
221
|
}
|
|
203
222
|
/**
|
|
204
223
|
* 投递一次 `directory_changed` 同步(按分钟桶去重);返回 job id。入站 `directory_changed` 经
|
|
@@ -207,7 +226,7 @@ let DirectorySync = class DirectorySync {
|
|
|
207
226
|
*/
|
|
208
227
|
async enqueue(orgId, plugin, now = new Date()) {
|
|
209
228
|
const e = await this.eligible(orgId, plugin);
|
|
210
|
-
if (!e.ok && e.reason
|
|
229
|
+
if (!e.ok && silentSkip(e.reason))
|
|
211
230
|
return undefined;
|
|
212
231
|
return this.addJob(orgId, plugin, "changed", directorySyncJobId(orgId, plugin, "changed", now));
|
|
213
232
|
}
|
|
@@ -234,7 +253,8 @@ let DirectorySync = class DirectorySync {
|
|
|
234
253
|
* Manual trigger by an admin: re-checks `org.members.manage` live under the org row lock, then that
|
|
235
254
|
* the extension can sync (does not provide a directory -> `extension.not_found`, not enabled ->
|
|
236
255
|
* `extension.not_enabled`, config no longer valid -> `extension.config_invalid`, the extension says
|
|
237
|
-
* the directory is not configured -> `directory.not_configured`, Ruling A28
|
|
256
|
+
* the directory is not configured -> `directory.not_configured`, Ruling A28; the effective config
|
|
257
|
+
* is not valid in the org -> `extension.needs_config`, layering spec A §6), and enqueues a sync
|
|
238
258
|
* job with a unique id.
|
|
239
259
|
*/
|
|
240
260
|
async request(orgId, plugin, actorAccountId, actorTokenId) {
|
|
@@ -252,6 +272,8 @@ let DirectorySync = class DirectorySync {
|
|
|
252
272
|
throw new ApiError("extension.config_invalid", `Invalid organization config for extension ${plugin}`);
|
|
253
273
|
case "not_configured":
|
|
254
274
|
throw new ApiError("directory.not_configured", `The directory of extension ${plugin} is not configured for this organization`);
|
|
275
|
+
case "needs_config":
|
|
276
|
+
throw new ApiError("extension.needs_config", `Extension ${plugin} needs configuration in this organization`);
|
|
255
277
|
}
|
|
256
278
|
}
|
|
257
279
|
const jobId = await this.addJob(orgId, plugin, "manual", directorySyncJobId(orgId, plugin, "manual"), { accountId: actorAccountId, tokenId: actorTokenId });
|
|
@@ -324,7 +346,7 @@ let DirectorySync = class DirectorySync {
|
|
|
324
346
|
// 锁丢了(续租失败、过期后被他人取得):停止本轮,不再移除任何人
|
|
325
347
|
const signal = lease.lost;
|
|
326
348
|
try {
|
|
327
|
-
return await this.run(orgId, plugin, e.directory, e.orgConfig, signal, opts);
|
|
349
|
+
return await this.run(orgId, plugin, e.directory, e.orgConfig, e.config, signal, opts);
|
|
328
350
|
}
|
|
329
351
|
finally {
|
|
330
352
|
await lease.release().catch(() => { });
|
|
@@ -346,7 +368,7 @@ let DirectorySync = class DirectorySync {
|
|
|
346
368
|
this.log.warn("directory sync: cannot enqueue follow-up sync", { orgId, plugin, err });
|
|
347
369
|
}
|
|
348
370
|
}
|
|
349
|
-
async run(orgId, plugin, directory, orgConfig, signal, opts) {
|
|
371
|
+
async run(orgId, plugin, directory, orgConfig, config, signal, opts) {
|
|
350
372
|
const source = `directory:${plugin}`;
|
|
351
373
|
const counts = { added: 0, removed: 0, skippedLastOwner: 0, failed: 0, total: 0 };
|
|
352
374
|
/** 本轮仍在职的账号(只在本次任务内使用)。 */
|
|
@@ -363,6 +385,7 @@ let DirectorySync = class DirectorySync {
|
|
|
363
385
|
signal.throwIfAborted();
|
|
364
386
|
const r = await directory.listMembers({
|
|
365
387
|
orgConfig,
|
|
388
|
+
config,
|
|
366
389
|
...(cursor !== undefined && { cursor }),
|
|
367
390
|
signal: AbortSignal.any([signal, AbortSignal.timeout(DIRECTORY_PAGE_TIMEOUT_MS)]),
|
|
368
391
|
});
|
|
@@ -409,7 +432,7 @@ let DirectorySync = class DirectorySync {
|
|
|
409
432
|
if (!still.ok) {
|
|
410
433
|
partial = true;
|
|
411
434
|
// 途中通讯录配置被清空(Ruling A28):照样不移除,但不记警告
|
|
412
|
-
if (still.reason
|
|
435
|
+
if (!silentSkip(still.reason)) {
|
|
413
436
|
this.log.warn("directory sync: plugin no longer eligible before removals", {
|
|
414
437
|
orgId,
|
|
415
438
|
plugin,
|
|
@@ -609,12 +632,13 @@ DirectorySync = __decorate([
|
|
|
609
632
|
__param(2, Inject(REDIS)),
|
|
610
633
|
__param(3, Inject(ExtensionRegistry)),
|
|
611
634
|
__param(4, Inject(OrgExtensionConfigs)),
|
|
612
|
-
__param(5, Inject(
|
|
613
|
-
__param(6, Inject(
|
|
614
|
-
__param(7, Inject(
|
|
615
|
-
__param(8, Inject(
|
|
616
|
-
__param(9, Inject(
|
|
617
|
-
__param(10, Inject(
|
|
635
|
+
__param(5, Inject(EffectiveConfigs)),
|
|
636
|
+
__param(6, Inject(ExternalIdentities)),
|
|
637
|
+
__param(7, Inject(Offboarding)),
|
|
638
|
+
__param(8, Inject(OrgLock)),
|
|
639
|
+
__param(9, Inject(getQueueToken(MAINTENANCE_QUEUE_NAME))),
|
|
640
|
+
__param(10, Inject(LockService)),
|
|
641
|
+
__param(11, Inject(KERNEL_LOGGER))
|
|
618
642
|
], DirectorySync);
|
|
619
643
|
export { DirectorySync };
|
|
620
644
|
/** The hourly directory scan ({@link DirectorySync.scan}), once per tick across replicas; a worker-role job (`WorkerModule`). */
|
|
@@ -30,8 +30,8 @@ export interface OffboardResult {
|
|
|
30
30
|
runs: InFlightRun[];
|
|
31
31
|
/** 负责的 agent 转交给的所有者;没有转交时为 null。 */
|
|
32
32
|
newOwnerId: string | null;
|
|
33
|
-
/**
|
|
34
|
-
|
|
33
|
+
/** The person's environments in the org, soft-deleted here; destroyed by a job after commit. */
|
|
34
|
+
environments: string[];
|
|
35
35
|
/** Conversations whose queued messages were deleted (`changed: queue` after commit). */
|
|
36
36
|
queueConversations: string[];
|
|
37
37
|
}
|
|
@@ -66,7 +66,7 @@ export declare class Offboarding {
|
|
|
66
66
|
private readonly redis;
|
|
67
67
|
private readonly registry;
|
|
68
68
|
private readonly eventLog;
|
|
69
|
-
/** The departed member's
|
|
69
|
+
/** The departed member's environments: one-off maintenance jobs, destroyed by a worker. */
|
|
70
70
|
private readonly sandboxJobs;
|
|
71
71
|
/** Stops the departed member's runs (`by: null`, a system action). */
|
|
72
72
|
private readonly runs;
|
|
@@ -75,7 +75,7 @@ export declare class Offboarding {
|
|
|
75
75
|
private readonly questions;
|
|
76
76
|
readonly log: KernelLogger;
|
|
77
77
|
constructor(db: KernelDb, txHost: TransactionHost, sessions: Pick<SessionService, "markRevoked">, redis: Pick<Redis, "set" | "exists">, registry: Pick<ExtensionRegistry, "list">, eventLog: Pick<EventLog, "notify" | "publishChanged">,
|
|
78
|
-
/** The departed member's
|
|
78
|
+
/** The departed member's environments: one-off maintenance jobs, destroyed by a worker. */
|
|
79
79
|
sandboxJobs: Pick<SandboxJobs, "destroy">,
|
|
80
80
|
/** Stops the departed member's runs (`by: null`, a system action). */
|
|
81
81
|
runs: OffboardingRunControl, credentials: Pick<Credentials, "clearAccount">, approvals: Pick<ApprovalsService, "cancelPendingFor">, questions: Pick<QuestionsService, "cancelPendingFor">, log: KernelLogger);
|
|
@@ -95,7 +95,9 @@ export declare class Offboarding {
|
|
|
95
95
|
* 以及成员关系自身的 `directory:<插件>` 来源,不论此人当初是不是由通讯录加入(手动重新加入后再被移出也不会被同步加回);
|
|
96
96
|
* 同步不再把此人加回,直到有人手动重新加入({@link MembersService.add} 删除排除);
|
|
97
97
|
* 8. 审计 `org.member.offboarded`;
|
|
98
|
-
* 9.
|
|
98
|
+
* 9. Soft-deletes the person's environments in the org and clears their default row (the
|
|
99
|
+
* instances and files are destroyed after the commit, best effort; the hourly sweep finishes
|
|
100
|
+
* any left).
|
|
99
101
|
*/
|
|
100
102
|
offboard(orgId: string, accountId: string, reason: OffboardReason, actor?: {
|
|
101
103
|
actorAccountId?: string;
|
|
@@ -106,8 +108,8 @@ export declare class Offboarding {
|
|
|
106
108
|
/**
|
|
107
109
|
* After the commit (callers register it with the infra `afterCommit` inside their transaction):
|
|
108
110
|
* writes the session revocation markers, publishes the cancelled events, stops the person's
|
|
109
|
-
* runs in the org and schedules destroying their
|
|
110
|
-
*
|
|
111
|
+
* runs in the org and schedules destroying their environments. A failing step only logs a
|
|
112
|
+
* warning.
|
|
111
113
|
*/
|
|
112
114
|
afterOffboard(r: OffboardResult): Promise<void>;
|
|
113
115
|
/**
|
package/dist/orgs/offboarding.js
CHANGED
|
@@ -10,6 +10,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
10
10
|
import { DIRECTORY_EXTENSION_POINT } from "@capybara-hq/plugin-sdk";
|
|
11
11
|
import { Inject, Injectable } from "@nestjs/common";
|
|
12
12
|
import { sql } from "kysely";
|
|
13
|
+
import { retargetSetupRequests } from "../agents/pending-connector-requests.js";
|
|
13
14
|
import { EventLog } from "../conversations/event-log.js";
|
|
14
15
|
import { ApiError } from "../errors.js";
|
|
15
16
|
import { enabledExtensionsQuery } from "../extensions/enabled.js";
|
|
@@ -62,7 +63,7 @@ let Offboarding = class Offboarding {
|
|
|
62
63
|
questions;
|
|
63
64
|
log;
|
|
64
65
|
constructor(db, txHost, sessions, redis, registry, eventLog,
|
|
65
|
-
/** The departed member's
|
|
66
|
+
/** The departed member's environments: one-off maintenance jobs, destroyed by a worker. */
|
|
66
67
|
sandboxJobs,
|
|
67
68
|
/** Stops the departed member's runs (`by: null`, a system action). */
|
|
68
69
|
runs, credentials, approvals, questions, log) {
|
|
@@ -95,7 +96,9 @@ let Offboarding = class Offboarding {
|
|
|
95
96
|
* 以及成员关系自身的 `directory:<插件>` 来源,不论此人当初是不是由通讯录加入(手动重新加入后再被移出也不会被同步加回);
|
|
96
97
|
* 同步不再把此人加回,直到有人手动重新加入({@link MembersService.add} 删除排除);
|
|
97
98
|
* 8. 审计 `org.member.offboarded`;
|
|
98
|
-
* 9.
|
|
99
|
+
* 9. Soft-deletes the person's environments in the org and clears their default row (the
|
|
100
|
+
* instances and files are destroyed after the commit, best effort; the hourly sweep finishes
|
|
101
|
+
* any left).
|
|
99
102
|
*/
|
|
100
103
|
async offboard(orgId, accountId, reason, actor = {}) {
|
|
101
104
|
const deleted = await this.db
|
|
@@ -210,6 +213,8 @@ let Offboarding = class Offboarding {
|
|
|
210
213
|
.where("deleted_at", "is", null)
|
|
211
214
|
.returning("id")
|
|
212
215
|
.execute();
|
|
216
|
+
// their connector setup requests follow them to the org owner (ruling P4-T6-4)
|
|
217
|
+
await retargetSetupRequests(this.db.db, agents.map((a) => a.id), owner.account_id);
|
|
213
218
|
const threads = await this.db
|
|
214
219
|
.updateTable("channel_threads")
|
|
215
220
|
.set({ archived_at: sql `now()` })
|
|
@@ -254,13 +259,19 @@ let Offboarding = class Offboarding {
|
|
|
254
259
|
.where("id", "in", queueConversations)
|
|
255
260
|
.execute();
|
|
256
261
|
}
|
|
257
|
-
const
|
|
258
|
-
.
|
|
259
|
-
.
|
|
260
|
-
.
|
|
261
|
-
.where("
|
|
262
|
-
.where("
|
|
263
|
-
.where("
|
|
262
|
+
const environments = await this.db
|
|
263
|
+
.updateTable("environments")
|
|
264
|
+
.set({ deleted_at: sql `now()`, updated_at: sql `now()` })
|
|
265
|
+
.where("org_id", "=", orgId)
|
|
266
|
+
.where("owner_kind", "=", "personal")
|
|
267
|
+
.where("owner_account_id", "=", accountId)
|
|
268
|
+
.where("deleted_at", "is", null)
|
|
269
|
+
.returning("id")
|
|
270
|
+
.execute();
|
|
271
|
+
await this.db
|
|
272
|
+
.deleteFrom("environment_defaults")
|
|
273
|
+
.where("org_id", "=", orgId)
|
|
274
|
+
.where("account_id", "=", accountId)
|
|
264
275
|
.execute();
|
|
265
276
|
await audit(this.db.db, {
|
|
266
277
|
...(actor.actorAccountId !== undefined && { actorAccountId: actor.actorAccountId }),
|
|
@@ -282,7 +293,7 @@ let Offboarding = class Offboarding {
|
|
|
282
293
|
channelThreadsArchived: Number(threads.numUpdatedRows),
|
|
283
294
|
toolGrantsDeleted: Number(grants.numDeletedRows),
|
|
284
295
|
...(excluded.length > 0 && { directoryExcluded: excluded }),
|
|
285
|
-
...(
|
|
296
|
+
...(environments.length > 0 && { environmentsDeleted: environments.length }),
|
|
286
297
|
...(queued.length > 0 && { queuedMessagesDeleted: queued.length }),
|
|
287
298
|
},
|
|
288
299
|
});
|
|
@@ -296,7 +307,7 @@ let Offboarding = class Offboarding {
|
|
|
296
307
|
status: r.status,
|
|
297
308
|
})),
|
|
298
309
|
newOwnerId: agents.length > 0 ? owner.account_id : null,
|
|
299
|
-
|
|
310
|
+
environments: environments.map((r) => r.id),
|
|
300
311
|
queueConversations,
|
|
301
312
|
};
|
|
302
313
|
}
|
|
@@ -325,8 +336,8 @@ let Offboarding = class Offboarding {
|
|
|
325
336
|
/**
|
|
326
337
|
* After the commit (callers register it with the infra `afterCommit` inside their transaction):
|
|
327
338
|
* writes the session revocation markers, publishes the cancelled events, stops the person's
|
|
328
|
-
* runs in the org and schedules destroying their
|
|
329
|
-
*
|
|
339
|
+
* runs in the org and schedules destroying their environments. A failing step only logs a
|
|
340
|
+
* warning.
|
|
330
341
|
*/
|
|
331
342
|
async afterOffboard(r) {
|
|
332
343
|
const { sessions, log, eventLog } = this;
|
|
@@ -354,13 +365,13 @@ let Offboarding = class Offboarding {
|
|
|
354
365
|
}
|
|
355
366
|
for (const run of r.runs)
|
|
356
367
|
await this.stopRun(run);
|
|
357
|
-
if (r.
|
|
368
|
+
if (r.environments.length > 0) {
|
|
358
369
|
try {
|
|
359
|
-
await this.sandboxJobs.destroy(r.
|
|
370
|
+
await this.sandboxJobs.destroy(r.environments);
|
|
360
371
|
}
|
|
361
372
|
catch (err) {
|
|
362
|
-
log.warn("offboarding: cannot schedule
|
|
363
|
-
count: r.
|
|
373
|
+
log.warn("offboarding: cannot schedule environment destruction", {
|
|
374
|
+
count: r.environments.length,
|
|
364
375
|
err,
|
|
365
376
|
});
|
|
366
377
|
}
|
package/dist/orgs/org-lock.d.ts
CHANGED
|
@@ -35,6 +35,11 @@ export declare class OrgLock {
|
|
|
35
35
|
org: LockedOrg;
|
|
36
36
|
role: OrgRole;
|
|
37
37
|
}>;
|
|
38
|
+
/**
|
|
39
|
+
* {@link lockAndAuthorize} for an account; for the kernel itself (`null`: a job acting for no
|
|
40
|
+
* person, such as the plugin scope sync) only the lock, since no role applies.
|
|
41
|
+
*/
|
|
42
|
+
lockFor(orgId: string, actor: string | null, action: OrgAction): Promise<void>;
|
|
38
43
|
}
|
|
39
44
|
/** The one {@link OrgLock}: identity (service tokens), orgs and the other domains import it. */
|
|
40
45
|
export declare class OrgLockModule {
|
package/dist/orgs/org-lock.js
CHANGED
|
@@ -67,6 +67,16 @@ let OrgLock = class OrgLock {
|
|
|
67
67
|
}
|
|
68
68
|
return { org, role: m.role };
|
|
69
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* {@link lockAndAuthorize} for an account; for the kernel itself (`null`: a job acting for no
|
|
72
|
+
* person, such as the plugin scope sync) only the lock, since no role applies.
|
|
73
|
+
*/
|
|
74
|
+
async lockFor(orgId, actor, action) {
|
|
75
|
+
if (actor === null)
|
|
76
|
+
await this.lock(orgId);
|
|
77
|
+
else
|
|
78
|
+
await this.lockAndAuthorize(orgId, actor, action);
|
|
79
|
+
}
|
|
70
80
|
};
|
|
71
81
|
__decorate([
|
|
72
82
|
Transactional({ propagation: "mandatory" })
|
|
@@ -77,6 +87,9 @@ __decorate([
|
|
|
77
87
|
__decorate([
|
|
78
88
|
Transactional({ propagation: "mandatory" })
|
|
79
89
|
], OrgLock.prototype, "lockAndAuthorize", null);
|
|
90
|
+
__decorate([
|
|
91
|
+
Transactional({ propagation: "mandatory" })
|
|
92
|
+
], OrgLock.prototype, "lockFor", null);
|
|
80
93
|
OrgLock = __decorate([
|
|
81
94
|
Injectable(),
|
|
82
95
|
__param(0, Inject(KernelDb)),
|