@capybara-hq/kernel 0.0.0-stage → 0.1.0-rc.0
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/LICENSE +202 -0
- package/NOTICE +2 -0
- package/README.md +20 -2
- package/bootstrap.json +22 -0
- package/dist/admin/admin.controller.d.ts +139 -0
- package/dist/admin/admin.controller.js +238 -0
- package/dist/admin/extensions.controller.d.ts +100 -0
- package/dist/admin/extensions.controller.js +226 -0
- package/dist/admin/setup.controller.d.ts +36 -0
- package/dist/admin/setup.controller.js +106 -0
- package/dist/admin/setup.service.d.ts +47 -0
- package/dist/admin/setup.service.js +90 -0
- package/dist/agents/agents.controller.d.ts +205 -0
- package/dist/agents/agents.controller.js +144 -0
- package/dist/agents/agents.service.d.ts +177 -0
- package/dist/agents/agents.service.js +677 -0
- package/dist/agents/definition.d.ts +198 -0
- package/dist/agents/definition.js +152 -0
- package/dist/agents/models.controller.d.ts +13 -0
- package/dist/agents/models.controller.js +31 -0
- package/dist/agents/templates.controller.d.ts +15 -0
- package/dist/agents/templates.controller.js +37 -0
- package/dist/agents/templates.d.ts +83 -0
- package/dist/agents/templates.js +173 -0
- package/dist/catalog/admin-catalog.controller.d.ts +143 -0
- package/dist/catalog/admin-catalog.controller.js +245 -0
- package/dist/catalog/catalog.service.d.ts +430 -0
- package/dist/catalog/catalog.service.js +882 -0
- package/dist/catalog/claude/agents.d.ts +27 -0
- package/dist/catalog/claude/agents.js +270 -0
- package/dist/catalog/claude/commands.d.ts +50 -0
- package/dist/catalog/claude/commands.js +179 -0
- package/dist/catalog/claude/manifest.d.ts +69 -0
- package/dist/catalog/claude/manifest.js +134 -0
- package/dist/catalog/claude/marketplace.d.ts +35 -0
- package/dist/catalog/claude/marketplace.js +194 -0
- package/dist/catalog/claude/mcp.d.ts +33 -0
- package/dist/catalog/claude/mcp.js +226 -0
- package/dist/catalog/claude/report.d.ts +86 -0
- package/dist/catalog/claude/report.js +121 -0
- package/dist/catalog/claude/translate.d.ts +56 -0
- package/dist/catalog/claude/translate.js +857 -0
- package/dist/catalog/cli.d.ts +46 -0
- package/dist/catalog/cli.js +211 -0
- package/dist/catalog/git-source.d.ts +127 -0
- package/dist/catalog/git-source.js +520 -0
- package/dist/catalog/marketplace-fetch.d.ts +99 -0
- package/dist/catalog/marketplace-fetch.js +203 -0
- package/dist/catalog/marketplaces.controller.d.ts +97 -0
- package/dist/catalog/marketplaces.controller.js +197 -0
- package/dist/catalog/marketplaces.service.d.ts +340 -0
- package/dist/catalog/marketplaces.service.js +1217 -0
- package/dist/catalog/org-catalog.controller.d.ts +128 -0
- package/dist/catalog/org-catalog.controller.js +277 -0
- package/dist/catalog/org-catalog.service.d.ts +246 -0
- package/dist/catalog/org-catalog.service.js +625 -0
- package/dist/catalog/plugin-import.d.ts +436 -0
- package/dist/catalog/plugin-import.js +1069 -0
- package/dist/catalog/plugin-install.d.ts +447 -0
- package/dist/catalog/plugin-install.js +1333 -0
- package/dist/catalog/plugin-package.d.ts +143 -0
- package/dist/catalog/plugin-package.js +382 -0
- package/dist/catalog/plugin-upgrade.d.ts +222 -0
- package/dist/catalog/plugin-upgrade.js +1219 -0
- package/dist/catalog/requests.service.d.ts +162 -0
- package/dist/catalog/requests.service.js +504 -0
- package/dist/catalog/schema-path.d.ts +7 -0
- package/dist/catalog/schema-path.js +63 -0
- package/dist/catalog/upgrade-targets.d.ts +59 -0
- package/dist/catalog/upgrade-targets.js +90 -0
- package/dist/catalog/versions.d.ts +31 -0
- package/dist/catalog/versions.js +44 -0
- package/dist/channels/actions.d.ts +37 -0
- package/dist/channels/actions.js +121 -0
- package/dist/channels/cards.d.ts +44 -0
- package/dist/channels/cards.js +156 -0
- package/dist/channels/connections.controller.d.ts +59 -0
- package/dist/channels/connections.controller.js +115 -0
- package/dist/channels/connections.service.d.ts +187 -0
- package/dist/channels/connections.service.js +534 -0
- package/dist/channels/features.d.ts +12 -0
- package/dist/channels/features.js +22 -0
- package/dist/channels/inbound.d.ts +120 -0
- package/dist/channels/inbound.js +332 -0
- package/dist/channels/outbound.d.ts +140 -0
- package/dist/channels/outbound.js +1125 -0
- package/dist/channels/phrases.d.ts +100 -0
- package/dist/channels/phrases.js +81 -0
- package/dist/channels/supervisor.d.ts +182 -0
- package/dist/channels/supervisor.js +625 -0
- package/dist/channels/threads.d.ts +29 -0
- package/dist/channels/threads.js +104 -0
- package/dist/channels/webhook-url.d.ts +16 -0
- package/dist/channels/webhook-url.js +34 -0
- package/dist/channels/webhook.controller.d.ts +19 -0
- package/dist/channels/webhook.controller.js +72 -0
- package/dist/channels/webhook.d.ts +73 -0
- package/dist/channels/webhook.js +274 -0
- package/dist/config/docs.d.ts +9 -0
- package/dist/config/docs.js +85 -0
- package/dist/config/env.d.ts +6 -0
- package/dist/config/env.js +73 -0
- package/dist/config/fields.d.ts +42 -0
- package/dist/config/fields.js +214 -0
- package/dist/config/file-source.d.ts +3 -0
- package/dist/config/file-source.js +31 -0
- package/dist/config/load.d.ts +20 -0
- package/dist/config/load.js +98 -0
- package/dist/config/nacos-source.d.ts +31 -0
- package/dist/config/nacos-source.js +229 -0
- package/dist/config/schema.d.ts +223 -0
- package/dist/config/schema.js +1151 -0
- package/dist/config/sources.d.ts +18 -0
- package/dist/config/sources.js +59 -0
- package/dist/config/types.d.ts +9 -0
- package/dist/config/types.js +7 -0
- package/dist/conversations/artifacts.d.ts +52 -0
- package/dist/conversations/artifacts.js +137 -0
- package/dist/conversations/attachments.controller.d.ts +28 -0
- package/dist/conversations/attachments.controller.js +96 -0
- package/dist/conversations/attachments.service.d.ts +180 -0
- package/dist/conversations/attachments.service.js +578 -0
- package/dist/conversations/conversations.controller.d.ts +288 -0
- package/dist/conversations/conversations.controller.js +607 -0
- package/dist/conversations/conversations.service.d.ts +321 -0
- package/dist/conversations/conversations.service.js +754 -0
- package/dist/conversations/event-log.d.ts +122 -0
- package/dist/conversations/event-log.js +259 -0
- package/dist/conversations/events.d.ts +856 -0
- package/dist/conversations/events.js +639 -0
- package/dist/conversations/files.d.ts +92 -0
- package/dist/conversations/files.js +213 -0
- package/dist/conversations/outputs-read.d.ts +34 -0
- package/dist/conversations/outputs-read.js +37 -0
- package/dist/conversations/queue.d.ts +169 -0
- package/dist/conversations/queue.js +527 -0
- package/dist/conversations/sandbox-status.d.ts +21 -0
- package/dist/conversations/sandbox-status.js +24 -0
- package/dist/conversations/selection.d.ts +46 -0
- package/dist/conversations/selection.js +75 -0
- package/dist/conversations/titles.d.ts +93 -0
- package/dist/conversations/titles.js +422 -0
- package/dist/ctx/bus.d.ts +16 -0
- package/dist/ctx/bus.js +101 -0
- package/dist/ctx/create-ctx.d.ts +109 -0
- package/dist/ctx/create-ctx.js +592 -0
- package/dist/ctx/kv.d.ts +4 -0
- package/dist/ctx/kv.js +31 -0
- package/dist/ctx/lock.d.ts +4 -0
- package/dist/ctx/lock.js +39 -0
- package/dist/ctx/namespace.d.ts +6 -0
- package/dist/ctx/namespace.js +12 -0
- package/dist/ctx/queue.d.ts +25 -0
- package/dist/ctx/queue.js +150 -0
- package/dist/ctx/secrets.d.ts +45 -0
- package/dist/ctx/secrets.js +175 -0
- package/dist/db/kernel-schema.d.ts +1122 -0
- package/dist/db/kernel-schema.js +5 -0
- package/dist/db/migrator.d.ts +28 -0
- package/dist/db/migrator.js +140 -0
- package/dist/db/pool.d.ts +21 -0
- package/dist/db/pool.js +28 -0
- package/dist/db/sql-statements.d.ts +34 -0
- package/dist/db/sql-statements.js +168 -0
- package/dist/errors.d.ts +210 -0
- package/dist/errors.js +212 -0
- package/dist/evals/budget.d.ts +61 -0
- package/dist/evals/budget.js +181 -0
- package/dist/evals/diff.d.ts +55 -0
- package/dist/evals/diff.js +133 -0
- package/dist/evals/judge.d.ts +53 -0
- package/dist/evals/judge.js +149 -0
- package/dist/evals/plan.d.ts +47 -0
- package/dist/evals/plan.js +77 -0
- package/dist/evals/reconstruct.d.ts +137 -0
- package/dist/evals/reconstruct.js +322 -0
- package/dist/evals/recorded-tools.d.ts +54 -0
- package/dist/evals/recorded-tools.js +167 -0
- package/dist/evals/run-replay.d.ts +86 -0
- package/dist/evals/run-replay.js +502 -0
- package/dist/evals/runs.controller.d.ts +100 -0
- package/dist/evals/runs.controller.js +199 -0
- package/dist/evals/runs.service.d.ts +275 -0
- package/dist/evals/runs.service.js +836 -0
- package/dist/evals/sets.controller.d.ts +61 -0
- package/dist/evals/sets.controller.js +183 -0
- package/dist/evals/sets.service.d.ts +128 -0
- package/dist/evals/sets.service.js +558 -0
- package/dist/evals/snapshot.d.ts +76 -0
- package/dist/evals/snapshot.js +207 -0
- package/dist/evals/step-replay.d.ts +113 -0
- package/dist/evals/step-replay.js +181 -0
- package/dist/evals/trajectory.controller.d.ts +41 -0
- package/dist/evals/trajectory.controller.js +88 -0
- package/dist/evals/trajectory.d.ts +144 -0
- package/dist/evals/trajectory.js +338 -0
- package/dist/evals/trajectory.service.d.ts +108 -0
- package/dist/evals/trajectory.service.js +323 -0
- package/dist/evals/worker.d.ts +101 -0
- package/dist/evals/worker.js +789 -0
- package/dist/extensions/admin-ops.d.ts +105 -0
- package/dist/extensions/admin-ops.js +353 -0
- package/dist/extensions/admin-view.d.ts +79 -0
- package/dist/extensions/admin-view.js +327 -0
- package/dist/extensions/approvals.d.ts +119 -0
- package/dist/extensions/approvals.js +205 -0
- package/dist/extensions/blobs.d.ts +45 -0
- package/dist/extensions/blobs.js +160 -0
- package/dist/extensions/bootstrap.d.ts +149 -0
- package/dist/extensions/bootstrap.js +441 -0
- package/dist/extensions/cli.d.ts +61 -0
- package/dist/extensions/cli.js +165 -0
- package/dist/extensions/config-json-schema.d.ts +9 -0
- package/dist/extensions/config-json-schema.js +73 -0
- package/dist/extensions/deployment-config.d.ts +138 -0
- package/dist/extensions/deployment-config.js +394 -0
- package/dist/extensions/enabled.d.ts +31 -0
- package/dist/extensions/enabled.js +55 -0
- package/dist/extensions/hooks.d.ts +161 -0
- package/dist/extensions/hooks.js +425 -0
- package/dist/extensions/host.d.ts +577 -0
- package/dist/extensions/host.js +2071 -0
- package/dist/extensions/inflight.d.ts +69 -0
- package/dist/extensions/inflight.js +277 -0
- package/dist/extensions/installs.d.ts +166 -0
- package/dist/extensions/installs.js +253 -0
- package/dist/extensions/instance.d.ts +167 -0
- package/dist/extensions/instance.js +329 -0
- package/dist/extensions/ledger.d.ts +30 -0
- package/dist/extensions/ledger.js +50 -0
- package/dist/extensions/lifecycle.d.ts +80 -0
- package/dist/extensions/lifecycle.js +152 -0
- package/dist/extensions/migrate-lock.d.ts +51 -0
- package/dist/extensions/migrate-lock.js +100 -0
- package/dist/extensions/org-config.controller.d.ts +24 -0
- package/dist/extensions/org-config.controller.js +59 -0
- package/dist/extensions/org-config.d.ts +169 -0
- package/dist/extensions/org-config.js +520 -0
- package/dist/extensions/package.d.ts +115 -0
- package/dist/extensions/package.js +246 -0
- package/dist/extensions/permission-set.d.ts +117 -0
- package/dist/extensions/permission-set.js +184 -0
- package/dist/extensions/permission-view.d.ts +194 -0
- package/dist/extensions/permission-view.js +284 -0
- package/dist/extensions/registry.d.ts +24 -0
- package/dist/extensions/registry.js +56 -0
- package/dist/extensions/resolve.d.ts +12 -0
- package/dist/extensions/resolve.js +71 -0
- package/dist/extensions/sources.d.ts +69 -0
- package/dist/extensions/sources.js +120 -0
- package/dist/extensions/sync.d.ts +40 -0
- package/dist/extensions/sync.js +242 -0
- package/dist/files/previewers.controller.d.ts +46 -0
- package/dist/files/previewers.controller.js +105 -0
- package/dist/files/previewers.d.ts +100 -0
- package/dist/files/previewers.js +250 -0
- package/dist/http/api.module.d.ts +114 -0
- package/dist/http/api.module.js +448 -0
- package/dist/http/app.d.ts +77 -0
- package/dist/http/app.js +170 -0
- package/dist/http/error.filter.d.ts +21 -0
- package/dist/http/error.filter.js +85 -0
- package/dist/http/gateway.module.d.ts +15 -0
- package/dist/http/gateway.module.js +13 -0
- package/dist/http/health.controller.d.ts +26 -0
- package/dist/http/health.controller.js +79 -0
- package/dist/http/nest-logger.d.ts +20 -0
- package/dist/http/nest-logger.js +28 -0
- package/dist/http/plugin-dispatch.d.ts +68 -0
- package/dist/http/plugin-dispatch.js +200 -0
- package/dist/http/tokens.d.ts +131 -0
- package/dist/http/tokens.js +131 -0
- package/dist/http/zod.pipe.d.ts +8 -0
- package/dist/http/zod.pipe.js +14 -0
- package/dist/identity/accounts.d.ts +93 -0
- package/dist/identity/accounts.js +367 -0
- package/dist/identity/api-tokens.d.ts +73 -0
- package/dist/identity/api-tokens.js +197 -0
- package/dist/identity/audit.d.ts +23 -0
- package/dist/identity/audit.js +41 -0
- package/dist/identity/auth.controller.d.ts +40 -0
- package/dist/identity/auth.controller.js +130 -0
- package/dist/identity/auth.guard.d.ts +41 -0
- package/dist/identity/auth.guard.js +162 -0
- package/dist/identity/binding.d.ts +47 -0
- package/dist/identity/binding.js +84 -0
- package/dist/identity/cookies.d.ts +16 -0
- package/dist/identity/cookies.js +32 -0
- package/dist/identity/credential-check.d.ts +17 -0
- package/dist/identity/credential-check.js +24 -0
- package/dist/identity/enterprise-admin.d.ts +14 -0
- package/dist/identity/enterprise-admin.js +27 -0
- package/dist/identity/external.d.ts +106 -0
- package/dist/identity/external.js +337 -0
- package/dist/identity/hash.d.ts +2 -0
- package/dist/identity/hash.js +3 -0
- package/dist/identity/login.d.ts +6 -0
- package/dist/identity/login.js +20 -0
- package/dist/identity/me.controller.d.ts +61 -0
- package/dist/identity/me.controller.js +159 -0
- package/dist/identity/passwords.d.ts +6 -0
- package/dist/identity/passwords.js +37 -0
- package/dist/identity/principal.d.ts +56 -0
- package/dist/identity/principal.js +38 -0
- package/dist/identity/rate-limit.d.ts +55 -0
- package/dist/identity/rate-limit.js +121 -0
- package/dist/identity/sessions.d.ts +84 -0
- package/dist/identity/sessions.js +306 -0
- package/dist/identity/settings.d.ts +121 -0
- package/dist/identity/settings.js +248 -0
- package/dist/identity/sso.controller.d.ts +59 -0
- package/dist/identity/sso.controller.js +192 -0
- package/dist/identity/sso.d.ts +83 -0
- package/dist/identity/sso.js +202 -0
- package/dist/inbox/inbox.service.d.ts +43 -0
- package/dist/inbox/inbox.service.js +57 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.js +65 -0
- package/dist/kernel.d.ts +256 -0
- package/dist/kernel.js +1326 -0
- package/dist/log.d.ts +48 -0
- package/dist/log.js +229 -0
- package/dist/models/prices.d.ts +53 -0
- package/dist/models/prices.js +121 -0
- package/dist/models/purposes.controller.d.ts +19 -0
- package/dist/models/purposes.controller.js +56 -0
- package/dist/models/purposes.d.ts +140 -0
- package/dist/models/purposes.js +267 -0
- package/dist/net/proxy.d.ts +44 -0
- package/dist/net/proxy.js +162 -0
- package/dist/net/public-address.d.ts +60 -0
- package/dist/net/public-address.js +271 -0
- package/dist/net/safe-fetch.d.ts +38 -0
- package/dist/net/safe-fetch.js +140 -0
- package/dist/orgs/directory-sync.controller.d.ts +14 -0
- package/dist/orgs/directory-sync.controller.js +40 -0
- package/dist/orgs/directory-sync.d.ts +166 -0
- package/dist/orgs/directory-sync.js +558 -0
- package/dist/orgs/invitations.controller.d.ts +58 -0
- package/dist/orgs/invitations.controller.js +137 -0
- package/dist/orgs/invitations.service.d.ts +80 -0
- package/dist/orgs/invitations.service.js +217 -0
- package/dist/orgs/members.service.d.ts +63 -0
- package/dist/orgs/members.service.js +234 -0
- package/dist/orgs/offboarding.d.ts +141 -0
- package/dist/orgs/offboarding.js +398 -0
- package/dist/orgs/org-lock.d.ts +32 -0
- package/dist/orgs/org-lock.js +46 -0
- package/dist/orgs/org.guard.d.ts +35 -0
- package/dist/orgs/org.guard.js +95 -0
- package/dist/orgs/orgs.controller.d.ts +78 -0
- package/dist/orgs/orgs.controller.js +192 -0
- package/dist/orgs/orgs.service.d.ts +61 -0
- package/dist/orgs/orgs.service.js +209 -0
- package/dist/orgs/roles.d.ts +13 -0
- package/dist/orgs/roles.js +58 -0
- package/dist/orgs/settings.controller.d.ts +20 -0
- package/dist/orgs/settings.controller.js +53 -0
- package/dist/orgs/settings.service.d.ts +120 -0
- package/dist/orgs/settings.service.js +178 -0
- package/dist/packages/npm.d.ts +50 -0
- package/dist/packages/npm.js +218 -0
- package/dist/packages/provenance.d.ts +47 -0
- package/dist/packages/provenance.js +147 -0
- package/dist/packages/tgz.d.ts +76 -0
- package/dist/packages/tgz.js +225 -0
- package/dist/runtime/abort.d.ts +32 -0
- package/dist/runtime/abort.js +71 -0
- package/dist/runtime/checkpointer.d.ts +32 -0
- package/dist/runtime/checkpointer.js +243 -0
- package/dist/runtime/context/build.d.ts +254 -0
- package/dist/runtime/context/build.js +693 -0
- package/dist/runtime/context/claude-tools.d.ts +11 -0
- package/dist/runtime/context/claude-tools.js +24 -0
- package/dist/runtime/context/compaction.d.ts +26 -0
- package/dist/runtime/context/compaction.js +195 -0
- package/dist/runtime/context/pairing.d.ts +11 -0
- package/dist/runtime/context/pairing.js +82 -0
- package/dist/runtime/context/reminders.d.ts +5 -0
- package/dist/runtime/context/reminders.js +11 -0
- package/dist/runtime/context/skills.d.ts +105 -0
- package/dist/runtime/context/skills.js +283 -0
- package/dist/runtime/context/tokens.d.ts +19 -0
- package/dist/runtime/context/tokens.js +104 -0
- package/dist/runtime/conversation-lock.d.ts +40 -0
- package/dist/runtime/conversation-lock.js +97 -0
- package/dist/runtime/hook-calls.d.ts +84 -0
- package/dist/runtime/hook-calls.js +136 -0
- package/dist/runtime/langgraph-loop.d.ts +52 -0
- package/dist/runtime/langgraph-loop.js +247 -0
- package/dist/runtime/loop.d.ts +93 -0
- package/dist/runtime/loop.js +7 -0
- package/dist/runtime/maintenance.d.ts +80 -0
- package/dist/runtime/maintenance.js +147 -0
- package/dist/runtime/media-cache.d.ts +21 -0
- package/dist/runtime/media-cache.js +51 -0
- package/dist/runtime/model-call.d.ts +176 -0
- package/dist/runtime/model-call.js +1049 -0
- package/dist/runtime/providers.d.ts +86 -0
- package/dist/runtime/providers.js +224 -0
- package/dist/runtime/quota.d.ts +29 -0
- package/dist/runtime/quota.js +70 -0
- package/dist/runtime/run-finish.d.ts +45 -0
- package/dist/runtime/run-finish.js +69 -0
- package/dist/runtime/run-queue.d.ts +121 -0
- package/dist/runtime/run-queue.js +493 -0
- package/dist/runtime/run-worker.d.ts +138 -0
- package/dist/runtime/run-worker.js +805 -0
- package/dist/runtime/stream.controller.d.ts +34 -0
- package/dist/runtime/stream.controller.js +122 -0
- package/dist/runtime/stream.d.ts +63 -0
- package/dist/runtime/stream.js +262 -0
- package/dist/runtime/subagents/child.d.ts +80 -0
- package/dist/runtime/subagents/child.js +225 -0
- package/dist/runtime/subagents/definition.d.ts +103 -0
- package/dist/runtime/subagents/definition.js +392 -0
- package/dist/runtime/subagents/dispatch.d.ts +69 -0
- package/dist/runtime/subagents/dispatch.js +502 -0
- package/dist/runtime/subagents/limits.d.ts +23 -0
- package/dist/runtime/subagents/limits.js +34 -0
- package/dist/runtime/subagents/org-agents.d.ts +50 -0
- package/dist/runtime/subagents/org-agents.js +70 -0
- package/dist/runtime/subagents/preamble.d.ts +7 -0
- package/dist/runtime/subagents/preamble.js +11 -0
- package/dist/runtime/subagents/progress.d.ts +26 -0
- package/dist/runtime/subagents/progress.js +36 -0
- package/dist/runtime/subagents/roster.d.ts +55 -0
- package/dist/runtime/subagents/roster.js +111 -0
- package/dist/runtime/subagents/skill-fork.d.ts +123 -0
- package/dist/runtime/subagents/skill-fork.js +259 -0
- package/dist/runtime/usage-report.d.ts +163 -0
- package/dist/runtime/usage-report.js +550 -0
- package/dist/runtime/waits.d.ts +233 -0
- package/dist/runtime/waits.js +883 -0
- package/dist/sandbox/leases.d.ts +169 -0
- package/dist/sandbox/leases.js +515 -0
- package/dist/sandbox/lifecycle.d.ts +21 -0
- package/dist/sandbox/lifecycle.js +68 -0
- package/dist/sandbox/sandbox.service.d.ts +249 -0
- package/dist/sandbox/sandbox.service.js +908 -0
- package/dist/skills/catalog.d.ts +149 -0
- package/dist/skills/catalog.js +405 -0
- package/dist/skills/changes.controller.d.ts +56 -0
- package/dist/skills/changes.controller.js +136 -0
- package/dist/skills/changes.service.d.ts +175 -0
- package/dist/skills/changes.service.js +805 -0
- package/dist/skills/invocable.controller.d.ts +23 -0
- package/dist/skills/invocable.controller.js +50 -0
- package/dist/skills/invocation-keys.d.ts +23 -0
- package/dist/skills/invocation-keys.js +44 -0
- package/dist/skills/invoke.d.ts +135 -0
- package/dist/skills/invoke.js +286 -0
- package/dist/skills/package.d.ts +87 -0
- package/dist/skills/package.js +227 -0
- package/dist/skills/skills.controller.d.ts +40 -0
- package/dist/skills/skills.controller.js +110 -0
- package/dist/skills/skills.service.d.ts +192 -0
- package/dist/skills/skills.service.js +567 -0
- package/dist/storage/prefix.d.ts +36 -0
- package/dist/storage/prefix.js +104 -0
- package/dist/storage/purge.d.ts +27 -0
- package/dist/storage/purge.js +75 -0
- package/dist/storage/storage.service.d.ts +44 -0
- package/dist/storage/storage.service.js +145 -0
- package/dist/text.d.ts +13 -0
- package/dist/text.js +13 -0
- package/dist/tools/approvals.controller.d.ts +53 -0
- package/dist/tools/approvals.controller.js +128 -0
- package/dist/tools/approvals.service.d.ts +172 -0
- package/dist/tools/approvals.service.js +568 -0
- package/dist/tools/breaker.d.ts +28 -0
- package/dist/tools/breaker.js +72 -0
- package/dist/tools/builtins/agent.d.ts +81 -0
- package/dist/tools/builtins/agent.js +223 -0
- package/dist/tools/builtins/ask-user.d.ts +28 -0
- package/dist/tools/builtins/ask-user.js +139 -0
- package/dist/tools/builtins/read-tool-output.d.ts +18 -0
- package/dist/tools/builtins/read-tool-output.js +108 -0
- package/dist/tools/builtins/sandbox/bash.d.ts +16 -0
- package/dist/tools/builtins/sandbox/bash.js +137 -0
- package/dist/tools/builtins/sandbox/common.d.ts +114 -0
- package/dist/tools/builtins/sandbox/common.js +304 -0
- package/dist/tools/builtins/sandbox/deliver.d.ts +5 -0
- package/dist/tools/builtins/sandbox/deliver.js +180 -0
- package/dist/tools/builtins/sandbox/edit.d.ts +4 -0
- package/dist/tools/builtins/sandbox/edit.js +98 -0
- package/dist/tools/builtins/sandbox/glob-match.d.ts +25 -0
- package/dist/tools/builtins/sandbox/glob-match.js +240 -0
- package/dist/tools/builtins/sandbox/glob.d.ts +4 -0
- package/dist/tools/builtins/sandbox/glob.js +104 -0
- package/dist/tools/builtins/sandbox/grep.d.ts +9 -0
- package/dist/tools/builtins/sandbox/grep.js +133 -0
- package/dist/tools/builtins/sandbox/index.d.ts +12 -0
- package/dist/tools/builtins/sandbox/index.js +27 -0
- package/dist/tools/builtins/sandbox/names.d.ts +7 -0
- package/dist/tools/builtins/sandbox/names.js +20 -0
- package/dist/tools/builtins/sandbox/read.d.ts +8 -0
- package/dist/tools/builtins/sandbox/read.js +121 -0
- package/dist/tools/builtins/sandbox/write.d.ts +4 -0
- package/dist/tools/builtins/sandbox/write.js +88 -0
- package/dist/tools/builtins/skill-load.d.ts +53 -0
- package/dist/tools/builtins/skill-load.js +446 -0
- package/dist/tools/builtins/skill-write.d.ts +59 -0
- package/dist/tools/builtins/skill-write.js +244 -0
- package/dist/tools/builtins/tool-search.d.ts +31 -0
- package/dist/tools/builtins/tool-search.js +171 -0
- package/dist/tools/connector-content.controller.d.ts +34 -0
- package/dist/tools/connector-content.controller.js +78 -0
- package/dist/tools/connector-content.d.ts +104 -0
- package/dist/tools/connector-content.js +267 -0
- package/dist/tools/connectors.controller.d.ts +210 -0
- package/dist/tools/connectors.controller.js +234 -0
- package/dist/tools/connectors.service.d.ts +303 -0
- package/dist/tools/connectors.service.js +1102 -0
- package/dist/tools/credentials.d.ts +139 -0
- package/dist/tools/credentials.js +351 -0
- package/dist/tools/drift.d.ts +141 -0
- package/dist/tools/drift.js +539 -0
- package/dist/tools/elicitation.d.ts +81 -0
- package/dist/tools/elicitation.js +266 -0
- package/dist/tools/endpoint.d.ts +18 -0
- package/dist/tools/endpoint.js +115 -0
- package/dist/tools/info.d.ts +67 -0
- package/dist/tools/info.js +113 -0
- package/dist/tools/naming.d.ts +27 -0
- package/dist/tools/naming.js +47 -0
- package/dist/tools/oauth/discovery.d.ts +65 -0
- package/dist/tools/oauth/discovery.js +307 -0
- package/dist/tools/oauth/flow.d.ts +63 -0
- package/dist/tools/oauth/flow.js +237 -0
- package/dist/tools/oauth/oauth.controller.d.ts +31 -0
- package/dist/tools/oauth/oauth.controller.js +95 -0
- package/dist/tools/oauth/tokens.d.ts +111 -0
- package/dist/tools/oauth/tokens.js +258 -0
- package/dist/tools/outputs.d.ts +61 -0
- package/dist/tools/outputs.js +156 -0
- package/dist/tools/pipeline.d.ts +322 -0
- package/dist/tools/pipeline.js +1236 -0
- package/dist/tools/policy.d.ts +60 -0
- package/dist/tools/policy.js +236 -0
- package/dist/tools/questions.controller.d.ts +24 -0
- package/dist/tools/questions.controller.js +58 -0
- package/dist/tools/questions.service.d.ts +103 -0
- package/dist/tools/questions.service.js +295 -0
- package/dist/tools/redact.d.ts +20 -0
- package/dist/tools/redact.js +60 -0
- package/dist/tools/registry.d.ts +246 -0
- package/dist/tools/registry.js +481 -0
- package/dist/tools/resources.d.ts +16 -0
- package/dist/tools/resources.js +76 -0
- package/dist/tools/specs.d.ts +14 -0
- package/dist/tools/specs.js +31 -0
- package/dist/tools/validate.d.ts +20 -0
- package/dist/tools/validate.js +183 -0
- package/dist/tools/view.d.ts +43 -0
- package/dist/tools/view.js +225 -0
- package/dist/ui/embed-token.d.ts +31 -0
- package/dist/ui/embed-token.js +132 -0
- package/dist/ui/registry.d.ts +58 -0
- package/dist/ui/registry.js +90 -0
- package/dist/ui/ui-stream.d.ts +37 -0
- package/dist/ui/ui-stream.js +162 -0
- package/dist/ui/views.controller.d.ts +81 -0
- package/dist/ui/views.controller.js +261 -0
- package/dist/ui/views.d.ts +155 -0
- package/dist/ui/views.js +306 -0
- package/dist/version.d.ts +5 -0
- package/dist/version.js +6 -0
- package/package.json +67 -3
- package/src/migrations/0001_init.sql +8 -0
- package/src/migrations/0002_secrets.sql +8 -0
- package/src/migrations/0003_identity.sql +117 -0
- package/src/migrations/0004_plugin_org_config_nullable.sql +3 -0
- package/src/migrations/0005_agents.sql +27 -0
- package/src/migrations/0006_conversations.sql +37 -0
- package/src/migrations/0007_checkpoints.sql +26 -0
- package/src/migrations/0008_runs_trigger_seq.sql +3 -0
- package/src/migrations/0009_runs_active_unique.sql +4 -0
- package/src/migrations/0010_tools.sql +125 -0
- package/src/migrations/0011_approvals_spec.sql +10 -0
- package/src/migrations/0012_run_waits.sql +24 -0
- package/src/migrations/0013_app_tools_source.sql +4 -0
- package/src/migrations/0014_tool_specs.sql +8 -0
- package/src/migrations/0015_tool_drift.sql +20 -0
- package/src/migrations/0016_plugin_permissions.sql +11 -0
- package/src/migrations/0017_identity_sources.sql +6 -0
- package/src/migrations/0018_channels.sql +74 -0
- package/src/migrations/0019_identity_trust.sql +17 -0
- package/src/migrations/0020_channel_card_lookup.sql +10 -0
- package/src/migrations/0021_org_storage_purge.sql +9 -0
- package/src/migrations/0022_attachments.sql +29 -0
- package/src/migrations/0023_sandboxes.sql +37 -0
- package/src/migrations/0024_skills.sql +46 -0
- package/src/migrations/0025_skills_catalog_idx.sql +6 -0
- package/src/migrations/0026_skill_changes.sql +34 -0
- package/src/migrations/0027_model_prices.sql +18 -0
- package/src/migrations/0028_evals.sql +105 -0
- package/src/migrations/0029_model_purposes.sql +18 -0
- package/src/migrations/0030_plugin_installs.sql +73 -0
- package/src/migrations/0031_plugin_snapshot_source.sql +6 -0
- package/src/migrations/0032_plugin_deployment_configs.sql +10 -0
- package/src/migrations/0033_rename_apps_to_connectors.sql +25 -0
- package/src/migrations/0034_directory.sql +49 -0
- package/src/migrations/0035_catalogs.sql +40 -0
- package/src/migrations/0036_app_import_staging.sql +17 -0
- package/src/migrations/0037_directory_installs.sql +92 -0
- package/src/migrations/0038_channel_inbound_mode.sql +6 -0
- package/src/migrations/0039_channel_card_pending.sql +8 -0
- package/src/migrations/0040_usage_report_sweep.sql +10 -0
- package/src/migrations/0041_rename_plugins_to_extensions.sql +38 -0
- package/src/migrations/0042_rename_directory_to_catalog.sql +80 -0
- package/src/migrations/0043_rename_app_installs_to_plugin_installs.sql +20 -0
- package/src/migrations/0044_catalog_one_kind.sql +90 -0
- package/src/migrations/0045_plugin_dependencies.sql +9 -0
- package/src/migrations/0046_git_sources.sql +25 -0
- package/src/migrations/0047_marketplace_entry_heads.sql +7 -0
- package/src/migrations/0048_marketplace_entry_trees.sql +8 -0
- package/src/migrations/0049_plugin_upgrades.sql +37 -0
- package/src/migrations/0050_bootstrap.sql +53 -0
- package/src/migrations/0051_claude_compat.sql +26 -0
- package/src/migrations/0052_conversations_account_agent_idx.sql +5 -0
- package/src/migrations/0053_subagents.sql +73 -0
- package/src/migrations/0054_subagent_wait_expiry.sql +7 -0
- package/src/migrations/0055_subagent_parent_indexes.sql +10 -0
- package/src/migrations/0056_approval_reason.sql +3 -0
- package/src/migrations/0057_conversation_titles.sql +11 -0
- package/src/migrations/0058_conversation_selection.sql +4 -0
- package/src/migrations/0059_conversation_queue.sql +22 -0
- package/src/migrations/0060_file_previewers.sql +10 -0
- package/src/migrations/0061_queue_selection.sql +5 -0
- package/src/migrations/0062_queued_skill.sql +8 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { FastifyReply } from "fastify";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { type Principal } from "../identity/principal.js";
|
|
4
|
+
import { type OrgContext } from "../orgs/org.guard.js";
|
|
5
|
+
import type { CatalogIcon, OrgCatalogDetail, OrgCatalogItem, OrgCatalogService, OrgInstallResult, OrgUpgradeResult } from "./org-catalog.service.js";
|
|
6
|
+
import type { PluginInstaller, PluginInstallView, UninstallReport } from "./plugin-install.js";
|
|
7
|
+
import type { UpgradePreview } from "./plugin-upgrade.js";
|
|
8
|
+
import type { CatalogRequestsService, CatalogRequestView } from "./requests.service.js";
|
|
9
|
+
declare const RequestBody: z.ZodObject<{
|
|
10
|
+
note: z.ZodOptional<z.ZodString>;
|
|
11
|
+
version: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, z.core.$strict>;
|
|
13
|
+
/** The org install body: the version (default the latest), template input, the extension's org config. */
|
|
14
|
+
declare const InstallBody: z.ZodObject<{
|
|
15
|
+
version: z.ZodOptional<z.ZodString>;
|
|
16
|
+
connectors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
17
|
+
name: z.ZodOptional<z.ZodString>;
|
|
18
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
19
|
+
endpoint: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
20
|
+
credential: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
21
|
+
client: z.ZodOptional<z.ZodObject<{
|
|
22
|
+
clientId: z.ZodString;
|
|
23
|
+
clientSecret: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strict>>;
|
|
25
|
+
}, z.core.$strict>>>;
|
|
26
|
+
extensionConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
/** The upgrade preview body: the target version. */
|
|
29
|
+
declare const UpgradePreviewBody: z.ZodObject<{
|
|
30
|
+
version: z.ZodString;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
/** The upgrade body: the target version, the preview's diffHash, the inputs it listed. */
|
|
33
|
+
declare const UpgradeBody: z.ZodObject<{
|
|
34
|
+
version: z.ZodString;
|
|
35
|
+
diffHash: z.ZodString;
|
|
36
|
+
connectors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
37
|
+
name: z.ZodOptional<z.ZodString>;
|
|
38
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
39
|
+
endpoint: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
40
|
+
credential: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
41
|
+
client: z.ZodOptional<z.ZodObject<{
|
|
42
|
+
clientId: z.ZodString;
|
|
43
|
+
clientSecret: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strict>>;
|
|
45
|
+
}, z.core.$strict>>>;
|
|
46
|
+
extensionConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
47
|
+
}, z.core.$strict>;
|
|
48
|
+
/**
|
|
49
|
+
* 条目图标的响应头:图标可能是 SVG(可含脚本),只许网页以 `<img>` 显示;直接打开时 CSP sandbox 禁止脚本与一切外部
|
|
50
|
+
* 请求,nosniff 防浏览器按内容另行判型。
|
|
51
|
+
*/
|
|
52
|
+
export declare function sendCatalogIcon(reply: FastifyReply, icon: CatalogIcon): Promise<void>;
|
|
53
|
+
declare const DecideBody: z.ZodObject<{
|
|
54
|
+
decision: z.ZodEnum<{
|
|
55
|
+
approve: "approve";
|
|
56
|
+
reject: "reject";
|
|
57
|
+
}>;
|
|
58
|
+
}, z.core.$strict>;
|
|
59
|
+
declare const AdminListQuery: z.ZodObject<{
|
|
60
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
61
|
+
approved: "approved";
|
|
62
|
+
cancelled: "cancelled";
|
|
63
|
+
pending: "pending";
|
|
64
|
+
rejected: "rejected";
|
|
65
|
+
}>>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
/**
|
|
68
|
+
* The enterprise catalog from an organization's view (`/api/v1/orgs/:orgId/...`, human users only):
|
|
69
|
+
* - `GET catalog` (`catalog.read`, member and up; members do not see disabled items);
|
|
70
|
+
* - `POST catalog/:itemId/requests` (`catalog.request`): a member request, into the org admins'
|
|
71
|
+
* inbox;
|
|
72
|
+
* - `POST catalog/:itemId/install`: the route only requires `catalog.read`; the service re-checks
|
|
73
|
+
* the plugin's component actions (`org.extensions.manage` for an extension, `connectors.manage`
|
|
74
|
+
* for templates, `skills.manage` for skills) inside the org row lock; needs_approval without a
|
|
75
|
+
* grant -> 202 `{ request }`, otherwise 201 `{ installed, install }` (the install view);
|
|
76
|
+
* - `GET / DELETE plugin-installs[/:installId]` (`org.extensions.manage`; uninstall re-checks the
|
|
77
|
+
* plugin's component actions in the service);
|
|
78
|
+
* - `POST plugin-installs/:installId/upgrade/preview` and `.../upgrade` (spec §10; the route only
|
|
79
|
+
* requires `catalog.read`, the service re-checks the component actions of both versions):
|
|
80
|
+
* preview -> 200 `{ from, to, diffHash, components, inputs, templates }`; upgrade -> 200 `{ install }`, or
|
|
81
|
+
* 202 `{ request }` for a needs_approval item without a grant;
|
|
82
|
+
* - `POST catalog-requests/:id/decide` (`catalog.decide`, org admins).
|
|
83
|
+
*/
|
|
84
|
+
export declare class OrgCatalogController {
|
|
85
|
+
private readonly catalog;
|
|
86
|
+
private readonly requests;
|
|
87
|
+
private readonly pluginInstaller;
|
|
88
|
+
constructor(catalog: OrgCatalogService, requests: CatalogRequestsService, pluginInstaller: PluginInstaller);
|
|
89
|
+
list(principal: Principal, org: OrgContext): Promise<{
|
|
90
|
+
items: OrgCatalogItem[];
|
|
91
|
+
}>;
|
|
92
|
+
/**
|
|
93
|
+
* Item detail and what the install wizard needs (members do not see disabled items -> 404
|
|
94
|
+
* `catalog.item_not_found`).
|
|
95
|
+
*/
|
|
96
|
+
detail(principal: Principal, org: OrgContext, itemId: string): Promise<OrgCatalogDetail>;
|
|
97
|
+
/**
|
|
98
|
+
* The item's icon (connector templates / plugins; svg or png), see {@link sendCatalogIcon}. No icon
|
|
99
|
+
* -> 404 `catalog.icon_not_found`; members do not see disabled items.
|
|
100
|
+
*/
|
|
101
|
+
icon(org: OrgContext, itemId: string, reply: FastifyReply): Promise<void>;
|
|
102
|
+
request(principal: Principal, org: OrgContext, itemId: string, body: z.infer<typeof RequestBody>): Promise<{
|
|
103
|
+
request: CatalogRequestView;
|
|
104
|
+
created: boolean;
|
|
105
|
+
}>;
|
|
106
|
+
install(principal: Principal, org: OrgContext, itemId: string, body: z.infer<typeof InstallBody>, reply: FastifyReply): Promise<Omit<OrgInstallResult, "status">>;
|
|
107
|
+
listInstalls(org: OrgContext): Promise<{
|
|
108
|
+
installs: PluginInstallView[];
|
|
109
|
+
}>;
|
|
110
|
+
uninstall(principal: Principal, org: OrgContext, installId: string): Promise<UninstallReport>;
|
|
111
|
+
upgradePreview(principal: Principal, org: OrgContext, installId: string, body: z.infer<typeof UpgradePreviewBody>): Promise<UpgradePreview>;
|
|
112
|
+
upgrade(principal: Principal, org: OrgContext, installId: string, body: z.infer<typeof UpgradeBody>, reply: FastifyReply): Promise<Omit<OrgUpgradeResult, "status">>;
|
|
113
|
+
decide(principal: Principal, org: OrgContext, id: string, body: z.infer<typeof DecideBody>): Promise<{
|
|
114
|
+
request: CatalogRequestView;
|
|
115
|
+
}>;
|
|
116
|
+
}
|
|
117
|
+
/** Enterprise admins decide deployment-level catalog requests (`/api/v1/admin/catalog/requests`). */
|
|
118
|
+
export declare class AdminCatalogRequestsController {
|
|
119
|
+
private readonly requests;
|
|
120
|
+
constructor(requests: CatalogRequestsService);
|
|
121
|
+
list(q: z.infer<typeof AdminListQuery>): Promise<{
|
|
122
|
+
requests: CatalogRequestView[];
|
|
123
|
+
}>;
|
|
124
|
+
decide(principal: Principal, id: string, body: z.infer<typeof DecideBody>): Promise<{
|
|
125
|
+
request: CatalogRequestView;
|
|
126
|
+
}>;
|
|
127
|
+
}
|
|
128
|
+
export {};
|
|
@@ -0,0 +1,277 @@
|
|
|
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 { Body, Controller, Delete, Get, HttpCode, Inject, Param, Post, Query, Res, } from "@nestjs/common";
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
import { CATALOG_REQUESTS, ORG_CATALOG, PLUGIN_INSTALLER } from "../http/tokens.js";
|
|
13
|
+
import { ZodPipe } from "../http/zod.pipe.js";
|
|
14
|
+
import { CurrentPrincipal, EnterpriseAdmin, patTokenId, requireUser, } from "../identity/principal.js";
|
|
15
|
+
import { CurrentOrg, OrgAction } from "../orgs/org.guard.js";
|
|
16
|
+
import { roleAtLeast } from "../orgs/roles.js";
|
|
17
|
+
import { CredentialValue } from "../tools/connectors.controller.js";
|
|
18
|
+
const RequestBody = z
|
|
19
|
+
.object({
|
|
20
|
+
note: z.string().max(1000).optional(),
|
|
21
|
+
version: z.string().min(1).max(256).optional(),
|
|
22
|
+
})
|
|
23
|
+
.strict();
|
|
24
|
+
const ConnectorInput = z
|
|
25
|
+
.object({
|
|
26
|
+
name: z.string().trim().min(1).max(80).optional(),
|
|
27
|
+
slug: z.string().max(24).optional(),
|
|
28
|
+
endpoint: z.record(z.string(), z.unknown()).optional(),
|
|
29
|
+
credential: CredentialValue.optional(),
|
|
30
|
+
client: z
|
|
31
|
+
.object({
|
|
32
|
+
clientId: z.string().min(1).max(500),
|
|
33
|
+
clientSecret: z.string().min(1).max(4000).optional(),
|
|
34
|
+
})
|
|
35
|
+
.strict()
|
|
36
|
+
.optional(),
|
|
37
|
+
})
|
|
38
|
+
.strict();
|
|
39
|
+
/** The org install body: the version (default the latest), template input, the extension's org config. */
|
|
40
|
+
const InstallBody = z
|
|
41
|
+
.object({
|
|
42
|
+
version: z.string().min(1).max(256).optional(),
|
|
43
|
+
connectors: z.record(z.string(), ConnectorInput).optional(),
|
|
44
|
+
extensionConfig: z.record(z.string(), z.unknown()).optional(),
|
|
45
|
+
})
|
|
46
|
+
.strict();
|
|
47
|
+
/** The upgrade preview body: the target version. */
|
|
48
|
+
const UpgradePreviewBody = z.object({ version: z.string().min(1).max(256) }).strict();
|
|
49
|
+
/** The upgrade body: the target version, the preview's diffHash, the inputs it listed. */
|
|
50
|
+
const UpgradeBody = z
|
|
51
|
+
.object({
|
|
52
|
+
version: z.string().min(1).max(256),
|
|
53
|
+
diffHash: z.string().regex(/^[0-9a-f]{64}$/),
|
|
54
|
+
connectors: z.record(z.string(), ConnectorInput).optional(),
|
|
55
|
+
extensionConfig: z.record(z.string(), z.unknown()).optional(),
|
|
56
|
+
})
|
|
57
|
+
.strict();
|
|
58
|
+
/**
|
|
59
|
+
* 条目图标的响应头:图标可能是 SVG(可含脚本),只许网页以 `<img>` 显示;直接打开时 CSP sandbox 禁止脚本与一切外部
|
|
60
|
+
* 请求,nosniff 防浏览器按内容另行判型。
|
|
61
|
+
*/
|
|
62
|
+
export async function sendCatalogIcon(reply, icon) {
|
|
63
|
+
await reply
|
|
64
|
+
.header("content-type", icon.contentType)
|
|
65
|
+
.header("x-content-type-options", "nosniff")
|
|
66
|
+
.header("content-security-policy", "sandbox; default-src 'none'; style-src 'unsafe-inline'")
|
|
67
|
+
.header("cache-control", "private, max-age=300")
|
|
68
|
+
.send(Buffer.from(icon.data.buffer, icon.data.byteOffset, icon.data.byteLength));
|
|
69
|
+
}
|
|
70
|
+
const DecideBody = z.object({ decision: z.enum(["approve", "reject"]) }).strict();
|
|
71
|
+
const AdminListQuery = z.object({
|
|
72
|
+
status: z.enum(["pending", "approved", "rejected", "cancelled"]).optional(),
|
|
73
|
+
});
|
|
74
|
+
/**
|
|
75
|
+
* The enterprise catalog from an organization's view (`/api/v1/orgs/:orgId/...`, human users only):
|
|
76
|
+
* - `GET catalog` (`catalog.read`, member and up; members do not see disabled items);
|
|
77
|
+
* - `POST catalog/:itemId/requests` (`catalog.request`): a member request, into the org admins'
|
|
78
|
+
* inbox;
|
|
79
|
+
* - `POST catalog/:itemId/install`: the route only requires `catalog.read`; the service re-checks
|
|
80
|
+
* the plugin's component actions (`org.extensions.manage` for an extension, `connectors.manage`
|
|
81
|
+
* for templates, `skills.manage` for skills) inside the org row lock; needs_approval without a
|
|
82
|
+
* grant -> 202 `{ request }`, otherwise 201 `{ installed, install }` (the install view);
|
|
83
|
+
* - `GET / DELETE plugin-installs[/:installId]` (`org.extensions.manage`; uninstall re-checks the
|
|
84
|
+
* plugin's component actions in the service);
|
|
85
|
+
* - `POST plugin-installs/:installId/upgrade/preview` and `.../upgrade` (spec §10; the route only
|
|
86
|
+
* requires `catalog.read`, the service re-checks the component actions of both versions):
|
|
87
|
+
* preview -> 200 `{ from, to, diffHash, components, inputs, templates }`; upgrade -> 200 `{ install }`, or
|
|
88
|
+
* 202 `{ request }` for a needs_approval item without a grant;
|
|
89
|
+
* - `POST catalog-requests/:id/decide` (`catalog.decide`, org admins).
|
|
90
|
+
*/
|
|
91
|
+
let OrgCatalogController = class OrgCatalogController {
|
|
92
|
+
catalog;
|
|
93
|
+
requests;
|
|
94
|
+
pluginInstaller;
|
|
95
|
+
constructor(catalog, requests, pluginInstaller) {
|
|
96
|
+
this.catalog = catalog;
|
|
97
|
+
this.requests = requests;
|
|
98
|
+
this.pluginInstaller = pluginInstaller;
|
|
99
|
+
}
|
|
100
|
+
async list(principal, org) {
|
|
101
|
+
const p = requireUser(principal);
|
|
102
|
+
return { items: await this.catalog.list(org.orgId, p.account.id) };
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Item detail and what the install wizard needs (members do not see disabled items -> 404
|
|
106
|
+
* `catalog.item_not_found`).
|
|
107
|
+
*/
|
|
108
|
+
detail(principal, org, itemId) {
|
|
109
|
+
const p = requireUser(principal);
|
|
110
|
+
return this.catalog.detail(org.orgId, p.account.id, itemId);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The item's icon (connector templates / plugins; svg or png), see {@link sendCatalogIcon}. No icon
|
|
114
|
+
* -> 404 `catalog.icon_not_found`; members do not see disabled items.
|
|
115
|
+
*/
|
|
116
|
+
async icon(org, itemId, reply) {
|
|
117
|
+
const icon = await this.catalog.icon(itemId, roleAtLeast(org.role, "admin"));
|
|
118
|
+
await sendCatalogIcon(reply, icon);
|
|
119
|
+
}
|
|
120
|
+
async request(principal, org, itemId, body) {
|
|
121
|
+
const p = requireUser(principal);
|
|
122
|
+
const tokenId = patTokenId(p);
|
|
123
|
+
return this.requests.request(org.orgId, p.account.id, itemId, body, tokenId !== undefined ? { actorTokenId: tokenId } : {});
|
|
124
|
+
}
|
|
125
|
+
async install(principal, org, itemId, body, reply) {
|
|
126
|
+
const p = requireUser(principal);
|
|
127
|
+
const r = await this.catalog.install(org.orgId, p.account.id, itemId, body, patTokenId(p));
|
|
128
|
+
reply.status(r.status);
|
|
129
|
+
const { status: _status, ...rest } = r;
|
|
130
|
+
return rest;
|
|
131
|
+
}
|
|
132
|
+
async listInstalls(org) {
|
|
133
|
+
return { installs: await this.pluginInstaller.list(org.orgId) };
|
|
134
|
+
}
|
|
135
|
+
async uninstall(principal, org, installId) {
|
|
136
|
+
const p = requireUser(principal);
|
|
137
|
+
const tokenId = patTokenId(p);
|
|
138
|
+
return this.pluginInstaller.uninstall(org.orgId, p.account.id, installId, tokenId !== undefined ? { actorTokenId: tokenId } : {});
|
|
139
|
+
}
|
|
140
|
+
upgradePreview(principal, org, installId, body) {
|
|
141
|
+
const p = requireUser(principal);
|
|
142
|
+
return this.catalog.upgradePreview(org.orgId, p.account.id, installId, body.version);
|
|
143
|
+
}
|
|
144
|
+
async upgrade(principal, org, installId, body, reply) {
|
|
145
|
+
const p = requireUser(principal);
|
|
146
|
+
const r = await this.catalog.upgrade(org.orgId, p.account.id, installId, body, patTokenId(p));
|
|
147
|
+
reply.status(r.status);
|
|
148
|
+
const { status: _status, ...rest } = r;
|
|
149
|
+
return rest;
|
|
150
|
+
}
|
|
151
|
+
async decide(principal, org, id, body) {
|
|
152
|
+
const p = requireUser(principal);
|
|
153
|
+
const tokenId = patTokenId(p);
|
|
154
|
+
return {
|
|
155
|
+
request: await this.requests.decideOrg(org.orgId, p.account.id, id, body.decision, tokenId !== undefined ? { actorTokenId: tokenId } : {}),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
__decorate([
|
|
160
|
+
Get("catalog"),
|
|
161
|
+
OrgAction("catalog.read"),
|
|
162
|
+
__param(0, CurrentPrincipal()),
|
|
163
|
+
__param(1, CurrentOrg())
|
|
164
|
+
], OrgCatalogController.prototype, "list", null);
|
|
165
|
+
__decorate([
|
|
166
|
+
Get("catalog/:itemId"),
|
|
167
|
+
OrgAction("catalog.read"),
|
|
168
|
+
__param(0, CurrentPrincipal()),
|
|
169
|
+
__param(1, CurrentOrg()),
|
|
170
|
+
__param(2, Param("itemId"))
|
|
171
|
+
], OrgCatalogController.prototype, "detail", null);
|
|
172
|
+
__decorate([
|
|
173
|
+
Get("catalog/:itemId/icon"),
|
|
174
|
+
OrgAction("catalog.read"),
|
|
175
|
+
__param(0, CurrentOrg()),
|
|
176
|
+
__param(1, Param("itemId")),
|
|
177
|
+
__param(2, Res())
|
|
178
|
+
], OrgCatalogController.prototype, "icon", null);
|
|
179
|
+
__decorate([
|
|
180
|
+
Post("catalog/:itemId/requests"),
|
|
181
|
+
OrgAction("catalog.request"),
|
|
182
|
+
__param(0, CurrentPrincipal()),
|
|
183
|
+
__param(1, CurrentOrg()),
|
|
184
|
+
__param(2, Param("itemId")),
|
|
185
|
+
__param(3, Body(new ZodPipe(RequestBody)))
|
|
186
|
+
], OrgCatalogController.prototype, "request", null);
|
|
187
|
+
__decorate([
|
|
188
|
+
Post("catalog/:itemId/install"),
|
|
189
|
+
OrgAction("catalog.read"),
|
|
190
|
+
__param(0, CurrentPrincipal()),
|
|
191
|
+
__param(1, CurrentOrg()),
|
|
192
|
+
__param(2, Param("itemId")),
|
|
193
|
+
__param(3, Body(new ZodPipe(InstallBody))),
|
|
194
|
+
__param(4, Res({ passthrough: true }))
|
|
195
|
+
], OrgCatalogController.prototype, "install", null);
|
|
196
|
+
__decorate([
|
|
197
|
+
Get("plugin-installs"),
|
|
198
|
+
OrgAction("org.extensions.manage"),
|
|
199
|
+
__param(0, CurrentOrg())
|
|
200
|
+
], OrgCatalogController.prototype, "listInstalls", null);
|
|
201
|
+
__decorate([
|
|
202
|
+
Delete("plugin-installs/:installId"),
|
|
203
|
+
OrgAction("org.extensions.manage"),
|
|
204
|
+
__param(0, CurrentPrincipal()),
|
|
205
|
+
__param(1, CurrentOrg()),
|
|
206
|
+
__param(2, Param("installId"))
|
|
207
|
+
], OrgCatalogController.prototype, "uninstall", null);
|
|
208
|
+
__decorate([
|
|
209
|
+
Post("plugin-installs/:installId/upgrade/preview"),
|
|
210
|
+
HttpCode(200),
|
|
211
|
+
OrgAction("catalog.read"),
|
|
212
|
+
__param(0, CurrentPrincipal()),
|
|
213
|
+
__param(1, CurrentOrg()),
|
|
214
|
+
__param(2, Param("installId")),
|
|
215
|
+
__param(3, Body(new ZodPipe(UpgradePreviewBody)))
|
|
216
|
+
], OrgCatalogController.prototype, "upgradePreview", null);
|
|
217
|
+
__decorate([
|
|
218
|
+
Post("plugin-installs/:installId/upgrade"),
|
|
219
|
+
OrgAction("catalog.read"),
|
|
220
|
+
__param(0, CurrentPrincipal()),
|
|
221
|
+
__param(1, CurrentOrg()),
|
|
222
|
+
__param(2, Param("installId")),
|
|
223
|
+
__param(3, Body(new ZodPipe(UpgradeBody))),
|
|
224
|
+
__param(4, Res({ passthrough: true }))
|
|
225
|
+
], OrgCatalogController.prototype, "upgrade", null);
|
|
226
|
+
__decorate([
|
|
227
|
+
Post("catalog-requests/:id/decide"),
|
|
228
|
+
HttpCode(200),
|
|
229
|
+
OrgAction("catalog.decide"),
|
|
230
|
+
__param(0, CurrentPrincipal()),
|
|
231
|
+
__param(1, CurrentOrg()),
|
|
232
|
+
__param(2, Param("id")),
|
|
233
|
+
__param(3, Body(new ZodPipe(DecideBody)))
|
|
234
|
+
], OrgCatalogController.prototype, "decide", null);
|
|
235
|
+
OrgCatalogController = __decorate([
|
|
236
|
+
Controller("api/v1/orgs/:orgId"),
|
|
237
|
+
__param(0, Inject(ORG_CATALOG)),
|
|
238
|
+
__param(1, Inject(CATALOG_REQUESTS)),
|
|
239
|
+
__param(2, Inject(PLUGIN_INSTALLER))
|
|
240
|
+
], OrgCatalogController);
|
|
241
|
+
export { OrgCatalogController };
|
|
242
|
+
/** Enterprise admins decide deployment-level catalog requests (`/api/v1/admin/catalog/requests`). */
|
|
243
|
+
let AdminCatalogRequestsController = class AdminCatalogRequestsController {
|
|
244
|
+
requests;
|
|
245
|
+
constructor(requests) {
|
|
246
|
+
this.requests = requests;
|
|
247
|
+
}
|
|
248
|
+
async list(q) {
|
|
249
|
+
return {
|
|
250
|
+
requests: await this.requests.listDeployment(q.status !== undefined ? { status: q.status } : {}),
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
async decide(principal, id, body) {
|
|
254
|
+
const p = requireUser(principal);
|
|
255
|
+
const tokenId = patTokenId(p);
|
|
256
|
+
return {
|
|
257
|
+
request: await this.requests.decideDeployment(p.account.id, id, body.decision, tokenId !== undefined ? { actorTokenId: tokenId } : {}),
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
__decorate([
|
|
262
|
+
Get(),
|
|
263
|
+
__param(0, Query(new ZodPipe(AdminListQuery)))
|
|
264
|
+
], AdminCatalogRequestsController.prototype, "list", null);
|
|
265
|
+
__decorate([
|
|
266
|
+
Post(":id/decide"),
|
|
267
|
+
HttpCode(200),
|
|
268
|
+
__param(0, CurrentPrincipal()),
|
|
269
|
+
__param(1, Param("id")),
|
|
270
|
+
__param(2, Body(new ZodPipe(DecideBody)))
|
|
271
|
+
], AdminCatalogRequestsController.prototype, "decide", null);
|
|
272
|
+
AdminCatalogRequestsController = __decorate([
|
|
273
|
+
Controller("api/v1/admin/catalog/requests"),
|
|
274
|
+
EnterpriseAdmin(),
|
|
275
|
+
__param(0, Inject(CATALOG_REQUESTS))
|
|
276
|
+
], AdminCatalogRequestsController);
|
|
277
|
+
export { AdminCatalogRequestsController };
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { type AgentTemplate, type Connector, type ConnectorTemplateFile, type ConnectorTemplateSpec, type LocalizedName, type Logger, type PluginManifest } from "@capybara-hq/plugin-sdk";
|
|
2
|
+
import type { Transaction } from "kysely";
|
|
3
|
+
import type { KernelDatabase, KernelDb } from "../db/kernel-schema.js";
|
|
4
|
+
import type { ExtensionHost } from "../extensions/host.js";
|
|
5
|
+
import { type OrgAction } from "../orgs/roles.js";
|
|
6
|
+
import { checkSkillFiles, type SkillPackageFile } from "../skills/package.js";
|
|
7
|
+
import type { StorageService } from "../storage/storage.service.js";
|
|
8
|
+
import type { ConnectorTemplateRef, CreateConnectorInput } from "../tools/connectors.service.js";
|
|
9
|
+
import { type CatalogItemView } from "./catalog.service.js";
|
|
10
|
+
import type { ConnectorInstallInput, PluginInstaller, PluginInstallInput, PluginInstallView } from "./plugin-install.js";
|
|
11
|
+
import type { PluginUpgradeInput, PluginUpgrader, UpgradePreview } from "./plugin-upgrade.js";
|
|
12
|
+
import type { CatalogRequestsService, CatalogRequestView } from "./requests.service.js";
|
|
13
|
+
type Trx = Transaction<KernelDatabase>;
|
|
14
|
+
/** A catalog item from an organization's view (`GET /orgs/:orgId/catalog`). */
|
|
15
|
+
export interface OrgCatalogItem extends Omit<CatalogItemView, "installs" | "marketplaceId" | "latestMarketplaceVersion" | "newerInMarketplace"> {
|
|
16
|
+
/**
|
|
17
|
+
* `yes` installable now; `needs_approval` needs enterprise admin approval (install returns 202 and
|
|
18
|
+
* creates a request); `granted` approved for this org; `disabled` disabled by the enterprise admin
|
|
19
|
+
* (members don't see it); `not_deployed` the plugin's extension is not on the deployment.
|
|
20
|
+
*/
|
|
21
|
+
installable: "yes" | "needs_approval" | "granted" | "disabled" | "not_deployed";
|
|
22
|
+
/**
|
|
23
|
+
* This org's live plugin install of the item (installing, installed or upgrading);
|
|
24
|
+
* `upgradeAvailable` is the version it can be upgraded to now (spec §10), null when none.
|
|
25
|
+
*/
|
|
26
|
+
installed: {
|
|
27
|
+
pluginInstallId: string;
|
|
28
|
+
version: string;
|
|
29
|
+
upgradeAvailable: string | null;
|
|
30
|
+
} | null;
|
|
31
|
+
/** This org's latest request for the item. */
|
|
32
|
+
request: {
|
|
33
|
+
id: string;
|
|
34
|
+
stage: "org" | "deployment";
|
|
35
|
+
status: string;
|
|
36
|
+
} | null;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* One connector template in an item's detail (for the install wizard): the endpoint preset, the
|
|
40
|
+
* paths an org may edit and the auth preset (no credentials). `id` is the template file's base name,
|
|
41
|
+
* sent as `connectors[id]` in the install body.
|
|
42
|
+
*/
|
|
43
|
+
export interface OrgCatalogTemplate {
|
|
44
|
+
id: string;
|
|
45
|
+
displayName: LocalizedName | null;
|
|
46
|
+
description: string;
|
|
47
|
+
plugin: string;
|
|
48
|
+
connector: string;
|
|
49
|
+
endpoint: Record<string, unknown>;
|
|
50
|
+
editableEndpoint: string[];
|
|
51
|
+
auth: Record<string, unknown>;
|
|
52
|
+
ownership: "org" | "personal" | null;
|
|
53
|
+
}
|
|
54
|
+
/** `GET /orgs/:orgId/catalog/:itemId`: the item and what the install wizard needs (latest version). */
|
|
55
|
+
export interface OrgCatalogDetail {
|
|
56
|
+
item: OrgCatalogItem;
|
|
57
|
+
/** The latest version has an icon (`GET .../icon`). */
|
|
58
|
+
hasIcon: boolean;
|
|
59
|
+
/** The plugin's extension (its name), null without one. */
|
|
60
|
+
extension: string | null;
|
|
61
|
+
templates: OrgCatalogTemplate[];
|
|
62
|
+
/** The plugin's dependencies (name and range). */
|
|
63
|
+
dependencies: {
|
|
64
|
+
name: string;
|
|
65
|
+
range: string;
|
|
66
|
+
}[];
|
|
67
|
+
/** The skill directories. */
|
|
68
|
+
skills: string[];
|
|
69
|
+
/** The agent template files (`agents/<name>.md`, sub-agents spec §16). */
|
|
70
|
+
agents: string[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A connector template as an org sees it (the install wizard and the upgrade preview's inputs):
|
|
74
|
+
* presets and editable paths, no credentials.
|
|
75
|
+
*/
|
|
76
|
+
export declare function orgTemplateView(id: string, file: ConnectorTemplateFile): OrgCatalogTemplate;
|
|
77
|
+
/** An item's icon (the latest version's plugin icon). */
|
|
78
|
+
export interface CatalogIcon {
|
|
79
|
+
data: Uint8Array;
|
|
80
|
+
contentType: "image/svg+xml" | "image/png";
|
|
81
|
+
policy: "allow" | "needs_approval" | "disabled";
|
|
82
|
+
}
|
|
83
|
+
/** The parts of a catalog version row an org install reads. */
|
|
84
|
+
export interface CatalogVersionFiles {
|
|
85
|
+
manifest: unknown;
|
|
86
|
+
object_prefix: string | null;
|
|
87
|
+
files: {
|
|
88
|
+
path: string;
|
|
89
|
+
size: number;
|
|
90
|
+
sha256: string;
|
|
91
|
+
}[];
|
|
92
|
+
}
|
|
93
|
+
/** Whether the item's latest version has an icon; unreadable counts as none. */
|
|
94
|
+
export declare function catalogHasIcon(db: KernelDb, itemId: string): Promise<boolean>;
|
|
95
|
+
/**
|
|
96
|
+
* Reads the icon of the item's latest version (served only through kernel routes, with nosniff and
|
|
97
|
+
* a CSP sandbox in the response headers; the web only shows it with `<img>`). Item missing, deleted
|
|
98
|
+
* or (when `includeDisabled` is false) disabled -> `catalog.item_not_found` (decided before reading
|
|
99
|
+
* storage); no icon -> `catalog.icon_not_found`; stored content that is not a valid svg / png
|
|
100
|
+
* (checked at import, this guards against tampered storage) -> `internal`.
|
|
101
|
+
*/
|
|
102
|
+
export declare function readCatalogIcon(db: KernelDb, storage: StorageService, itemId: string, includeDisabled: boolean): Promise<CatalogIcon>;
|
|
103
|
+
export type { ConnectorInstallInput };
|
|
104
|
+
/** The input of `POST /orgs/:orgId/catalog/:itemId/install` (default version: the latest). */
|
|
105
|
+
export interface OrgInstallInput extends PluginInstallInput {
|
|
106
|
+
version?: string;
|
|
107
|
+
}
|
|
108
|
+
/** Install result: 201 installed; 202 needs enterprise admin approval, a request was created (or escalated). */
|
|
109
|
+
export type OrgInstallResult = {
|
|
110
|
+
status: 201;
|
|
111
|
+
installed: {
|
|
112
|
+
itemId: string;
|
|
113
|
+
version: string;
|
|
114
|
+
pluginInstallId: string;
|
|
115
|
+
};
|
|
116
|
+
/** The install view (its components, dependency installs included). */
|
|
117
|
+
install: PluginInstallView;
|
|
118
|
+
} | {
|
|
119
|
+
status: 202;
|
|
120
|
+
request: CatalogRequestView;
|
|
121
|
+
};
|
|
122
|
+
export interface OrgCatalogDeps {
|
|
123
|
+
db: KernelDb;
|
|
124
|
+
storage: StorageService;
|
|
125
|
+
host: Pick<ExtensionHost, "manifests">;
|
|
126
|
+
/** The connector `kind` provided by extension `plugin` loaded on this replica. */
|
|
127
|
+
findConnector: TemplateDeps["findConnector"];
|
|
128
|
+
requests: CatalogRequestsService;
|
|
129
|
+
pluginInstaller: Pick<PluginInstaller, "install" | "preflight">;
|
|
130
|
+
pluginUpgrader: Pick<PluginUpgrader, "preview" | "check" | "upgrade">;
|
|
131
|
+
log?: Pick<Logger, "warn">;
|
|
132
|
+
}
|
|
133
|
+
/** Upgrade result: 200 upgraded (the install view); 202 needs enterprise admin approval, a request was created. */
|
|
134
|
+
export type OrgUpgradeResult = {
|
|
135
|
+
status: 200;
|
|
136
|
+
install: PluginInstallView;
|
|
137
|
+
} | {
|
|
138
|
+
status: 202;
|
|
139
|
+
request: CatalogRequestView;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* The org actions installing / uninstalling a plugin needs: the union over its components (an
|
|
143
|
+
* extension -> `org.extensions.manage`, skills -> `skills.manage`, connector templates ->
|
|
144
|
+
* `connectors.manage`, agent templates -> `agents.manage`), re-checked inside the org row lock.
|
|
145
|
+
*/
|
|
146
|
+
export declare function requiredActions(m: PluginManifest): OrgAction[];
|
|
147
|
+
/** Locks the org row in the caller's transaction and re-checks the actor can do every action (else `forbidden`). */
|
|
148
|
+
export declare function lockOrgForActions(t: Trx, orgId: string, actor: string, actions: OrgAction[]): Promise<void>;
|
|
149
|
+
/** The value at a dot path of `v` (own keys only), undefined when absent. */
|
|
150
|
+
export declare function getPath(v: unknown, path: string): unknown;
|
|
151
|
+
/** Sets the value at a dot path of `obj`, creating the objects on the way. */
|
|
152
|
+
export declare function setPath(obj: Record<string, unknown>, path: string, value: unknown): void;
|
|
153
|
+
/** What checking a template's connector extension needs. */
|
|
154
|
+
export interface TemplateDeps {
|
|
155
|
+
/** The connector `kind` provided by extension `plugin` loaded on this replica. */
|
|
156
|
+
findConnector: (plugin: string, kind: string) => Connector | undefined;
|
|
157
|
+
/** The version of an extension loaded on this replica (undefined when not loaded). */
|
|
158
|
+
pluginVersion: (plugin: string) => string | undefined;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* 模板的连接器插件此刻是否可用:插件加载且提供该 kind,并满足 `pluginVersion`(若写了);不可用返回原因
|
|
162
|
+
* (模型不可见,给管理员看的英文)。
|
|
163
|
+
*/
|
|
164
|
+
export declare function templatePluginProblem(d: TemplateDeps, template: ConnectorTemplateSpec): string | undefined;
|
|
165
|
+
/**
|
|
166
|
+
* Builds the connector install input from a connector template plus what the org filled in (C30):
|
|
167
|
+
* the endpoint comes from the template, only paths listed in `editableEndpoint` (or fields under
|
|
168
|
+
* them) may be changed by the org, changing another path -> `validation_failed`; the auth method
|
|
169
|
+
* comes from the template, the org only gives credentials (static credentials via `credential`,
|
|
170
|
+
* OAuth via `client`). Re-checks the template's plugin, kind and `pluginVersion` against the
|
|
171
|
+
* connectors loaded on this replica right now (unmet -> `catalog.not_deployed`); the endpoint
|
|
172
|
+
* (merged as a whole) schema check, credential pattern check and OAuth URL policy are re-checked by
|
|
173
|
+
* `ConnectorsService.create`.
|
|
174
|
+
*/
|
|
175
|
+
export declare function templateConnectorInput(deps: TemplateDeps, template: ConnectorTemplateSpec, ref: ConnectorTemplateRef, input: ConnectorInstallInput | undefined, defaultName: string, at?: string): CreateConnectorInput;
|
|
176
|
+
/** 从部署存储读目录版本里的文件(按版本行的 sha256 校验);`under` 给出时只读该目录下的文件,路径去掉该前缀。 */
|
|
177
|
+
export declare function readCatalogFiles(storage: StorageService, objectPrefix: string | null, files: {
|
|
178
|
+
path: string;
|
|
179
|
+
size: number;
|
|
180
|
+
sha256: string;
|
|
181
|
+
}[], under?: string): Promise<SkillPackageFile[]>;
|
|
182
|
+
/** 校验技能文件并取名字与描述(导入时已校验过;这里防存储被改)。 */
|
|
183
|
+
export declare function skillOf(files: SkillPackageFile[]): ReturnType<typeof checkSkillFiles>;
|
|
184
|
+
/** The connector templates of a catalog version, read from storage (id = the file's base name). */
|
|
185
|
+
export declare function readCatalogTemplates(storage: StorageService, v: CatalogVersionFiles): Promise<{
|
|
186
|
+
id: string;
|
|
187
|
+
file: ConnectorTemplateFile;
|
|
188
|
+
}[]>;
|
|
189
|
+
/**
|
|
190
|
+
* The agent templates of a catalog version (`manifest.agents`, listed explicitly since import),
|
|
191
|
+
* parsed from storage (checked at import; parsed again in case storage was changed).
|
|
192
|
+
*/
|
|
193
|
+
export declare function readCatalogAgentTemplates(storage: StorageService, v: CatalogVersionFiles): Promise<{
|
|
194
|
+
path: string;
|
|
195
|
+
template: AgentTemplate;
|
|
196
|
+
}[]>;
|
|
197
|
+
/**
|
|
198
|
+
* Organizations browse and install from the enterprise catalog (C22): members browse (without
|
|
199
|
+
* disabled items) and request, org admins install. Every item is a plugin, installed with its
|
|
200
|
+
* dependencies by {@link PluginInstaller}; installing requires the union of the component actions
|
|
201
|
+
* of the plugins it brings in ({@link requiredActions}), re-checked inside the org row lock; item
|
|
202
|
+
* disabled -> `catalog.item_disabled`; a dependency unresolved / disabled / in a cycle ->
|
|
203
|
+
* `catalog.dependency_*`; an extension or a template's connector not on the deployment ->
|
|
204
|
+
* `catalog.not_deployed`; needs_approval without a grant -> a stage deployment request (HTTP 202;
|
|
205
|
+
* dependencies are not approved separately, spec §10). No in-process state.
|
|
206
|
+
*/
|
|
207
|
+
export declare class OrgCatalogService {
|
|
208
|
+
private readonly d;
|
|
209
|
+
constructor(d: OrgCatalogDeps);
|
|
210
|
+
/** The org's view of the items; members (not admins) don't see disabled items. */
|
|
211
|
+
list(orgId: string, accountId: string, itemId?: string): Promise<OrgCatalogItem[]>;
|
|
212
|
+
/**
|
|
213
|
+
* Item detail (for the install wizard): the same view as the list (members don't see disabled
|
|
214
|
+
* items, not visible means `catalog.item_not_found`), plus the latest version's extension,
|
|
215
|
+
* connector templates (endpoint preset, editable paths, auth preset), dependencies, skills and
|
|
216
|
+
* agent templates.
|
|
217
|
+
*/
|
|
218
|
+
detail(orgId: string, accountId: string, itemId: string): Promise<OrgCatalogDetail>;
|
|
219
|
+
/**
|
|
220
|
+
* The item's icon; members don't see disabled items (-> `catalog.item_not_found`, decided before
|
|
221
|
+
* reading storage).
|
|
222
|
+
*/
|
|
223
|
+
icon(itemId: string, isAdmin: boolean): Promise<CatalogIcon>;
|
|
224
|
+
/** For the admin item detail: whether the latest version has an icon. */
|
|
225
|
+
hasIcon(itemId: string): Promise<boolean>;
|
|
226
|
+
/**
|
|
227
|
+
* The items (latest versions) this replica cannot install now: the plugin's extension is not
|
|
228
|
+
* loaded, or a connector template's connector extension is not (or not at the template's
|
|
229
|
+
* `pluginVersion`). Dependencies are judged at install. A template that cannot be read counts as
|
|
230
|
+
* deployed here (the install reads it again).
|
|
231
|
+
*/
|
|
232
|
+
private undeployed;
|
|
233
|
+
/** Installs a plugin in the org (see the class comment). */
|
|
234
|
+
install(orgId: string, actor: string, itemId: string, body: OrgInstallInput, actorTokenId?: string): Promise<OrgInstallResult>;
|
|
235
|
+
/** The upgrade preview of an org install (spec §10, see `PluginUpgrader`). */
|
|
236
|
+
upgradePreview(orgId: string, actor: string, installId: string, version: string): Promise<UpgradePreview>;
|
|
237
|
+
/**
|
|
238
|
+
* Upgrades an org install in place (spec §10, Decision 11): the preview's `diffHash` is checked
|
|
239
|
+
* first (`plugin.upgrade_stale`); the item disabled -> `catalog.item_disabled`; needs_approval
|
|
240
|
+
* without a grant -> a stage deployment request for the target version (202; after approval the
|
|
241
|
+
* org admin runs the upgrade again); otherwise the upgrade runs (200, the install view).
|
|
242
|
+
*/
|
|
243
|
+
upgrade(orgId: string, actor: string, installId: string, body: PluginUpgradeInput, actorTokenId?: string): Promise<OrgUpgradeResult>;
|
|
244
|
+
/** The actor can install something in the org (forbidden otherwise), checked before item errors. */
|
|
245
|
+
private assertCanInstall;
|
|
246
|
+
}
|