@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,436 @@
|
|
|
1
|
+
import { type AgentTemplate, type AgentTemplateTier, type Connector, type LocalizedName, type Logger } from "@capybara-hq/plugin-sdk";
|
|
2
|
+
import type { KernelConfig } from "../config/schema.js";
|
|
3
|
+
import type { KernelDb } from "../db/kernel-schema.js";
|
|
4
|
+
import { ApiError } from "../errors.js";
|
|
5
|
+
import type { ExtensionAdminOps } from "../extensions/admin-ops.js";
|
|
6
|
+
import type { ExtensionInstalls } from "../extensions/installs.js";
|
|
7
|
+
import { ExtensionPackageError } from "../extensions/package.js";
|
|
8
|
+
import { type PackageWarning, type PermissionGroup, type PermissionItem } from "../extensions/permission-view.js";
|
|
9
|
+
import type { ExtensionSource } from "../extensions/sources.js";
|
|
10
|
+
import type { ProvenanceResult } from "../packages/provenance.js";
|
|
11
|
+
import type { StorageService } from "../storage/storage.service.js";
|
|
12
|
+
import { type ActorOpts, type CatalogItemView, type PermissionsMismatch, type SourceDetail } from "./catalog.service.js";
|
|
13
|
+
import { type ClaudeEntryOverlay } from "./claude/manifest.js";
|
|
14
|
+
import { type TranslationReport } from "./claude/report.js";
|
|
15
|
+
import { PluginPackageError } from "./plugin-package.js";
|
|
16
|
+
/**
|
|
17
|
+
* Enterprise import of a plugin (package ecosystem spec §4.3): one review for every plugin, whatever
|
|
18
|
+
* it contains (an extension, skills, connector templates, dependencies), confirmed once.
|
|
19
|
+
*
|
|
20
|
+
* prepare: the tgz is always hostile input, and **nothing is written until every check passes**
|
|
21
|
+
* (F-AD): `readPluginPackage` (plugin.json, package.json, listed / scanned skills and templates,
|
|
22
|
+
* icons; a pre-0.1.0 tgz is `catalog.legacy_format`), the extension's module graph and migrations
|
|
23
|
+
* (`readExtensionPackage`), the extension's deployment state (config-declared names are
|
|
24
|
+
* refused; name ownership; a downgrade to a version with unrun migrations is refused), each skill by
|
|
25
|
+
* the skill package rules, each connector template against the connector loaded on this replica (or
|
|
26
|
+
* statically when the connector is provided by the plugin's own extension or by a dependency), the
|
|
27
|
+
* catalog name / version conflicts and the actor still an enterprise admin. Dependencies are only
|
|
28
|
+
* resolved against the imported catalog versions for the review (an unresolved one does not block
|
|
29
|
+
* the import, spec §4.1); they are never fetched. Only then is the extension handed to
|
|
30
|
+
* `ExtensionInstalls.ingest` (source `catalog`), the skill / template / icon files written to object
|
|
31
|
+
* storage, a staging row written (24 hours) and `catalog.plugin_staged` audited.
|
|
32
|
+
*
|
|
33
|
+
* confirm: `reviewHash` must match the staging; in one transaction it deletes the staging row
|
|
34
|
+
* (confirm works once), locks the extension name and recomputes its deployment state (installed /
|
|
35
|
+
* upgraded / swapped after the review -> `plugin.review_stale`), writes the extension's permission
|
|
36
|
+
* snapshot when it is installed by this import (or upgraded with `deployExtension`; source web, audit
|
|
37
|
+
* `extension.permissions_approved` carrying the plugin), and creates the item or adds the version
|
|
38
|
+
* (`manifest` = the normalized plugin.json, `extension_sha256`, the files under the staging prefix).
|
|
39
|
+
* After the commit, with `deployExtension`, the plugin's own extension is installed on the
|
|
40
|
+
* deployment and enabled (`ExtensionAdminOps.install` + `enable`; each replica reconciles, no
|
|
41
|
+
* restart); a failure is returned, not thrown, and an upgrade that was not installed gets its old
|
|
42
|
+
* snapshot back.
|
|
43
|
+
*
|
|
44
|
+
* Expired staging is cleaned by the maintenance job `app-staging-cleanup`
|
|
45
|
+
* ({@link PluginImport.cleanupExpired}): it deletes the staging row and its object prefix; a stored
|
|
46
|
+
* extension package stays in the content-addressed `extension_packages` (the same as importing the
|
|
47
|
+
* same tgz again; without an install record referencing it it is never loaded).
|
|
48
|
+
*/
|
|
49
|
+
/** How long a staged import is kept. */
|
|
50
|
+
export declare const PLUGIN_STAGING_TTL_MS: number;
|
|
51
|
+
/** The deployment state of the plugin's extension and what confirming with `deployExtension` does. */
|
|
52
|
+
export type ExtensionReviewAction = "install" | "upgrade" | "keep";
|
|
53
|
+
/** The plugin's extension in a review. */
|
|
54
|
+
export interface PluginReviewExtension {
|
|
55
|
+
name: string;
|
|
56
|
+
version: string;
|
|
57
|
+
/** sha256 of the plugin tgz (the package store key). */
|
|
58
|
+
sha256: string;
|
|
59
|
+
/**
|
|
60
|
+
* install: not on the deployment; upgrade: installed from another package (another version), the
|
|
61
|
+
* import's package replaces it when deployed; keep: this exact package is installed.
|
|
62
|
+
*/
|
|
63
|
+
action: ExtensionReviewAction;
|
|
64
|
+
/** Installed on the deployment (any version). */
|
|
65
|
+
deployed: boolean;
|
|
66
|
+
/** The installed version (null when not installed). */
|
|
67
|
+
currentVersion: string | null;
|
|
68
|
+
/** The installed package (null when not installed). */
|
|
69
|
+
currentSha256: string | null;
|
|
70
|
+
/** Permissions from the static manifest and migration SQL (no extension code runs). */
|
|
71
|
+
permissions: PermissionGroup[];
|
|
72
|
+
/** Permission keys added / removed against the current snapshot (all added without one). */
|
|
73
|
+
added: string[];
|
|
74
|
+
addedItems: PermissionItem[];
|
|
75
|
+
removed: string[];
|
|
76
|
+
/** Review warnings of the migration SQL (sensitive). */
|
|
77
|
+
warnings: PackageWarning[];
|
|
78
|
+
/** The extension's own review digest (as when its package is uploaded alone). */
|
|
79
|
+
reviewHash: string;
|
|
80
|
+
/** Sensitive permissions or migration warnings. */
|
|
81
|
+
sensitive: boolean;
|
|
82
|
+
}
|
|
83
|
+
/** One connector template in a review. */
|
|
84
|
+
export interface PluginReviewTemplate {
|
|
85
|
+
id: string;
|
|
86
|
+
displayName: LocalizedName;
|
|
87
|
+
description: string;
|
|
88
|
+
plugin: string;
|
|
89
|
+
connector: string;
|
|
90
|
+
endpoint: Record<string, unknown>;
|
|
91
|
+
auth: Record<string, unknown>;
|
|
92
|
+
editableEndpoint: string[];
|
|
93
|
+
/** The connector is loaded on this replica and the endpoint was checked against its schema. */
|
|
94
|
+
endpointChecked: boolean;
|
|
95
|
+
}
|
|
96
|
+
/** One agent template in a review (sub-agents spec §16.2: its tool narrowing and model tier). */
|
|
97
|
+
export interface PluginReviewAgentTemplate {
|
|
98
|
+
name: string;
|
|
99
|
+
/** Relative to the plugin root. */
|
|
100
|
+
path: string;
|
|
101
|
+
description: string;
|
|
102
|
+
/** The instructions (the body). */
|
|
103
|
+
instructions: string;
|
|
104
|
+
/** Default `inherit`. */
|
|
105
|
+
model: AgentTemplateTier;
|
|
106
|
+
tools?: string[];
|
|
107
|
+
disallowedTools?: string[];
|
|
108
|
+
toolPolicies?: Record<string, "ask" | "deny">;
|
|
109
|
+
effort?: AgentTemplate["effort"];
|
|
110
|
+
maxSteps?: number;
|
|
111
|
+
skills?: string[];
|
|
112
|
+
}
|
|
113
|
+
/** The source of a staged import. */
|
|
114
|
+
export interface PluginImportSource {
|
|
115
|
+
/**
|
|
116
|
+
* `git`: read from a git commit (a git marketplace's entry, or a direct git import);
|
|
117
|
+
* `bootstrap`: a package baked into the image, imported by the bootstrap step (its extension
|
|
118
|
+
* package is kept in PG, since the object store may be one of the bootstrap plugins; the
|
|
119
|
+
* permission snapshot is written with source `bootstrap`).
|
|
120
|
+
*/
|
|
121
|
+
kind: "file" | "npm" | "marketplace" | "git" | "bootstrap";
|
|
122
|
+
ref: string;
|
|
123
|
+
integrity?: string;
|
|
124
|
+
marketplaceId?: string;
|
|
125
|
+
/** Where it came from (stored on the catalog version as `source_detail`). */
|
|
126
|
+
detail?: SourceDetail;
|
|
127
|
+
}
|
|
128
|
+
/** The format a plugin was read from: a Capybara plugin, or a translated Claude Code plugin. */
|
|
129
|
+
export type PluginSourceFormat = "capybara" | "claude-code";
|
|
130
|
+
/** The largest license text stored (bytes); a longer one is omitted (`licenseTruncated`). */
|
|
131
|
+
export declare const LICENSE_TEXT_MAX_BYTES = 65536;
|
|
132
|
+
/** The one review of a plugin (the enterprise admin sees every component before confirming). */
|
|
133
|
+
export interface PluginReview {
|
|
134
|
+
name: string;
|
|
135
|
+
/** `claude-code`: translated from a Claude Code plugin (no extension; see `translation`). */
|
|
136
|
+
format: PluginSourceFormat;
|
|
137
|
+
/** The translation report of a Claude Code plugin (spec §8.4). */
|
|
138
|
+
translation?: TranslationReport;
|
|
139
|
+
/** The tree has both manifests: `.capybara-plugin/plugin.json` was read, the Claude one ignored. */
|
|
140
|
+
claudeManifestIgnored?: true;
|
|
141
|
+
/**
|
|
142
|
+
* `repository` of a Claude Code plugin's manifest (spec §8.2): display only, never checked or
|
|
143
|
+
* fetched, not stored with the version.
|
|
144
|
+
*/
|
|
145
|
+
repository?: string;
|
|
146
|
+
/** The root LICENSE text (UTF-8, at most {@link LICENSE_TEXT_MAX_BYTES} bytes). */
|
|
147
|
+
licenseText?: string;
|
|
148
|
+
/** The root LICENSE is longer than {@link LICENSE_TEXT_MAX_BYTES} bytes (or not UTF-8) and is not stored. */
|
|
149
|
+
licenseTruncated?: true;
|
|
150
|
+
/**
|
|
151
|
+
* The version recorded: the plugin's own (plugin.json, else the entry's, else the fallback of
|
|
152
|
+
* spec §5.3), with `+git.<sha12>` / `+sha256.<12>` appended when that release is already imported
|
|
153
|
+
* with other content (Decision 6).
|
|
154
|
+
*/
|
|
155
|
+
version: string;
|
|
156
|
+
/** The plugin's own version when `version` got build metadata appended. */
|
|
157
|
+
pluginVersion?: string;
|
|
158
|
+
/** The content digest of the plugin's files (Decision 5). */
|
|
159
|
+
contentDigest: string;
|
|
160
|
+
/** package.json `name`; null for a git plugin without package.json. */
|
|
161
|
+
packageName: string | null;
|
|
162
|
+
publisher: string;
|
|
163
|
+
description: string;
|
|
164
|
+
displayName?: LocalizedName;
|
|
165
|
+
license?: string;
|
|
166
|
+
homepage?: string;
|
|
167
|
+
extension?: PluginReviewExtension;
|
|
168
|
+
skills: {
|
|
169
|
+
name: string;
|
|
170
|
+
description: string;
|
|
171
|
+
body: string;
|
|
172
|
+
path: string;
|
|
173
|
+
files: number;
|
|
174
|
+
/** The plugin suggests pinning the skill (plugin.json `pinned`; changed at confirm). */
|
|
175
|
+
suggestPinned: boolean;
|
|
176
|
+
}[];
|
|
177
|
+
connectorTemplates: PluginReviewTemplate[];
|
|
178
|
+
/**
|
|
179
|
+
* Agent templates (phase C). Absent in reviews staged before phase C (read as none); left out of
|
|
180
|
+
* {@link pluginReviewHash} when empty, so their digests are unchanged.
|
|
181
|
+
*/
|
|
182
|
+
agentTemplates?: PluginReviewAgentTemplate[];
|
|
183
|
+
/**
|
|
184
|
+
* Each dependency with the highest imported catalog version satisfying its range (null when
|
|
185
|
+
* nothing does yet: the import still completes, an org install is refused until it is imported).
|
|
186
|
+
*/
|
|
187
|
+
dependencies: {
|
|
188
|
+
name: string;
|
|
189
|
+
range: string;
|
|
190
|
+
resolved: string | null;
|
|
191
|
+
}[];
|
|
192
|
+
source: PluginImportSource;
|
|
193
|
+
/**
|
|
194
|
+
* npm provenance (spec §5.5, display only): "built from `repository`@`commit` by `workflow`" for
|
|
195
|
+
* npm and npm-backed marketplace imports when the registry has it; otherwise not checked, with
|
|
196
|
+
* the reason ("not an npm package" for every other source).
|
|
197
|
+
*/
|
|
198
|
+
provenance: ProvenanceResult;
|
|
199
|
+
/** A git marketplace's repository differs from the attested one (a warning, never a refusal). */
|
|
200
|
+
provenanceWarning?: "repository_mismatch";
|
|
201
|
+
/** The extension is sensitive. */
|
|
202
|
+
sensitive: boolean;
|
|
203
|
+
/** Digest of everything above that confirm depends on; sent back on confirm. */
|
|
204
|
+
reviewHash: string;
|
|
205
|
+
}
|
|
206
|
+
/** The deploy result of the plugin's extension with `deployExtension`. */
|
|
207
|
+
export interface ExtensionDeployResult {
|
|
208
|
+
name: string;
|
|
209
|
+
action: "install" | "upgrade";
|
|
210
|
+
version: string;
|
|
211
|
+
/** The package to install (retry through the extension admin with it after a failure). */
|
|
212
|
+
sha256: string;
|
|
213
|
+
/**
|
|
214
|
+
* enabled: installed and enabled; installed: installed, desired state left as it was (confirm
|
|
215
|
+
* with `enable: false`, the bootstrap step's upgrades); failed: see code / message.
|
|
216
|
+
*/
|
|
217
|
+
result: "enabled" | "installed" | "failed";
|
|
218
|
+
code?: string;
|
|
219
|
+
message?: string;
|
|
220
|
+
/** e.g. `snapshot_not_restored: …` when an upgrade failed and the snapshot had changed since. */
|
|
221
|
+
note?: string;
|
|
222
|
+
}
|
|
223
|
+
/** The result of {@link PluginImport.confirm}. */
|
|
224
|
+
export interface PluginConfirmResult {
|
|
225
|
+
item: CatalogItemView;
|
|
226
|
+
/** null without `deployExtension` or when there is nothing to deploy (no extension, keep). */
|
|
227
|
+
deploy: ExtensionDeployResult | null;
|
|
228
|
+
}
|
|
229
|
+
/** What prepare checks besides the package itself (npm and marketplace imports). */
|
|
230
|
+
export interface PluginPrepareExpect {
|
|
231
|
+
/** The npm package that was requested (package.json `name` must equal it). */
|
|
232
|
+
packageName?: string;
|
|
233
|
+
/**
|
|
234
|
+
* Marketplace import: the entry the package must match (`marketplace.package_mismatch`) and its
|
|
235
|
+
* permission summary (`permissions`, compared with the package's keys: a warning only).
|
|
236
|
+
*/
|
|
237
|
+
marketplace?: {
|
|
238
|
+
name: string;
|
|
239
|
+
version: string | null;
|
|
240
|
+
packageName?: string;
|
|
241
|
+
permissions?: string[];
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
/** The provenance shown with a review (fetched by the npm paths before prepare). */
|
|
245
|
+
export interface ReviewProvenance {
|
|
246
|
+
provenance: ProvenanceResult;
|
|
247
|
+
warning?: "repository_mismatch";
|
|
248
|
+
}
|
|
249
|
+
export interface PluginImportDeps {
|
|
250
|
+
db: KernelDb;
|
|
251
|
+
config: () => KernelConfig;
|
|
252
|
+
storage: StorageService;
|
|
253
|
+
installs: Pick<ExtensionInstalls, "ingest" | "fetchNpm" | "fetchProvenance">;
|
|
254
|
+
ops: Pick<ExtensionAdminOps, "install" | "enable">;
|
|
255
|
+
/** Reads a package from the package store (confirm recomputes the permission set). */
|
|
256
|
+
blobs: {
|
|
257
|
+
get(sha256: string): Promise<Uint8Array>;
|
|
258
|
+
};
|
|
259
|
+
/** Config-declared extension names -> source. */
|
|
260
|
+
declared: () => ReadonlyMap<string, ExtensionSource>;
|
|
261
|
+
/** The connector `kind` provided by extension `plugin` loaded on this replica. */
|
|
262
|
+
findConnector: (plugin: string, kind: string) => Connector | undefined;
|
|
263
|
+
/** The version of an extension loaded on this replica (templates' `pluginVersion` is checked). */
|
|
264
|
+
pluginVersion?: (plugin: string) => string | undefined;
|
|
265
|
+
/**
|
|
266
|
+
* false: this process loads no connectors (the CLI), so a template of an unknown connector gets
|
|
267
|
+
* only the static endpoint checks and `endpointChecked: false`; the org install re-checks it
|
|
268
|
+
* against the loaded connector. Default true (the HTTP path).
|
|
269
|
+
*/
|
|
270
|
+
connectorsLoaded?: boolean;
|
|
271
|
+
log: Pick<Logger, "info" | "warn" | "error">;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* The API error of a plugin package that cannot be read in a catalog path: the pre-0.1.0 format ->
|
|
275
|
+
* `catalog.legacy_format`, anything else -> `catalog.invalid_manifest` (issues as details).
|
|
276
|
+
*/
|
|
277
|
+
export declare function catalogPackageError(e: PluginPackageError | ExtensionPackageError): ApiError;
|
|
278
|
+
export declare class PluginImport {
|
|
279
|
+
private readonly d;
|
|
280
|
+
constructor(d: PluginImportDeps);
|
|
281
|
+
/**
|
|
282
|
+
* Reads, checks and stages a plugin (see the file header). Returns the staging id and review.
|
|
283
|
+
* `fallback` (a marketplace archive): a tgz without plugin.json may be skills only, named,
|
|
284
|
+
* versioned and published by it (the version defaulting to `0.0.0-sha256.h<12>`, spec §5.3).
|
|
285
|
+
*/
|
|
286
|
+
prepare(actor: string | null, bytes: Uint8Array, source: PluginImportSource, opts?: ActorOpts & {
|
|
287
|
+
expect?: PluginPrepareExpect;
|
|
288
|
+
fallback?: {
|
|
289
|
+
name: string;
|
|
290
|
+
version?: string;
|
|
291
|
+
publisher: string;
|
|
292
|
+
};
|
|
293
|
+
provenance?: ReviewProvenance;
|
|
294
|
+
claudeManifestIgnored?: true;
|
|
295
|
+
}): Promise<{
|
|
296
|
+
stagingId: string;
|
|
297
|
+
review: PluginReview;
|
|
298
|
+
permissionKeys: string[];
|
|
299
|
+
permissionsMismatch: PermissionsMismatch;
|
|
300
|
+
}>;
|
|
301
|
+
/**
|
|
302
|
+
* Checks and stages a plugin read from a git commit (`files` relative to the plugin root; see
|
|
303
|
+
* `git-source.ts`): the same checks as a tgz ({@link readPluginFiles}), with package.json
|
|
304
|
+
* optional (spec §4.1) and a skills-only tree without plugin.json named by `fallback` (Decision
|
|
305
|
+
* 3). A plugin with an extension needs package.json (its peerDependencies ranges are checked as
|
|
306
|
+
* for a tgz) and its build output; its files are packed into a deterministic tgz, which is what
|
|
307
|
+
* the package store keeps and the deployment installs. Returns what {@link prepare} returns.
|
|
308
|
+
*/
|
|
309
|
+
prepareGit(actor: string | null, files: Map<string, Uint8Array>, source: PluginImportSource, opts: ActorOpts & {
|
|
310
|
+
expect?: PluginPrepareExpect;
|
|
311
|
+
/**
|
|
312
|
+
* `version` is the entry's version, else derived from the commit (spec §5.3); `entryVersion`
|
|
313
|
+
* is the entry's own (a Claude Code plugin reports where its version came from).
|
|
314
|
+
*/
|
|
315
|
+
fallback: {
|
|
316
|
+
name: string;
|
|
317
|
+
version: string;
|
|
318
|
+
publisher: string;
|
|
319
|
+
entryVersion?: string;
|
|
320
|
+
};
|
|
321
|
+
provenance?: ReviewProvenance;
|
|
322
|
+
/** The Claude Code marketplace entry's overlay (the entry's components and `strict`). */
|
|
323
|
+
claude?: ClaudeEntryOverlay;
|
|
324
|
+
}): Promise<{
|
|
325
|
+
stagingId: string;
|
|
326
|
+
review: PluginReview;
|
|
327
|
+
permissionKeys: string[];
|
|
328
|
+
permissionsMismatch: PermissionsMismatch;
|
|
329
|
+
}>;
|
|
330
|
+
/**
|
|
331
|
+
* The checks and writes of prepare after the package was read. `tgz.bytes` is the package tgz
|
|
332
|
+
* (required with an extension: it is stored in the package store); `size` is recorded.
|
|
333
|
+
*/
|
|
334
|
+
private prepareContents;
|
|
335
|
+
/** Fetches a plugin from the configured npm registry (verified by `dist.integrity`), then prepares it. */
|
|
336
|
+
prepareNpm(actor: string | null, input: {
|
|
337
|
+
package: string;
|
|
338
|
+
version?: string;
|
|
339
|
+
}, opts?: ActorOpts): Promise<{
|
|
340
|
+
stagingId: string;
|
|
341
|
+
review: PluginReview;
|
|
342
|
+
}>;
|
|
343
|
+
/**
|
|
344
|
+
* A staged import's review, as prepare returned it, with a marketplace import's permission
|
|
345
|
+
* mismatch when there is one (the import page loads `?staging=<id>` with it). Unknown, expired or
|
|
346
|
+
* already confirmed -> 404 `plugin.staging_not_found`.
|
|
347
|
+
*/
|
|
348
|
+
staged(stagingId: string): Promise<{
|
|
349
|
+
stagingId: string;
|
|
350
|
+
review: PluginReview;
|
|
351
|
+
permissionsMismatch?: PermissionsMismatch;
|
|
352
|
+
}>;
|
|
353
|
+
/**
|
|
354
|
+
* Confirms a staged import (see the file header). Returns the committed catalog item and, with
|
|
355
|
+
* `deployExtension`, the extension's deploy result (a failed deploy is returned, not thrown).
|
|
356
|
+
*/
|
|
357
|
+
confirm(actor: string | null, stagingId: string, input: {
|
|
358
|
+
reviewHash: string;
|
|
359
|
+
deployExtension: boolean;
|
|
360
|
+
/**
|
|
361
|
+
* With `deployExtension`: enable the extension after installing it (default true). false
|
|
362
|
+
* keeps the install record's desired state (a new install stays disabled), for the bootstrap
|
|
363
|
+
* step's upgrades of a plugin an enterprise admin may have disabled.
|
|
364
|
+
*/
|
|
365
|
+
enable?: boolean;
|
|
366
|
+
/**
|
|
367
|
+
* The skills (by name, each in the review) suggested as pinned when an agent selects them
|
|
368
|
+
* (spec §9.1); replaces the plugin's `pinned` flags in the stored manifest. Omitted keeps
|
|
369
|
+
* them. An admin decision like `deployExtension`, so not part of `reviewHash`.
|
|
370
|
+
*/
|
|
371
|
+
pinnedSuggestions?: string[];
|
|
372
|
+
}, opts?: ActorOpts): Promise<PluginConfirmResult>;
|
|
373
|
+
/**
|
|
374
|
+
* Writes the extension's permission snapshot for the version being imported (source web; cli
|
|
375
|
+
* without an actor; bootstrap for the bootstrap step), after
|
|
376
|
+
* registering the name owner like ExtensionAdminOps.install (Ruling P3). Returns the snapshot it
|
|
377
|
+
* overwrote (null when there was none).
|
|
378
|
+
*/
|
|
379
|
+
private approve;
|
|
380
|
+
/**
|
|
381
|
+
* Deploys the plugin's extension after the commit: `install` (a new install is disabled, a version
|
|
382
|
+
* change keeps the desired state) then `enable`. Nothing is thrown; the result says what happened.
|
|
383
|
+
* When an upgrade was not installed, the snapshot overwritten at confirm is restored (the old
|
|
384
|
+
* version keeps running, F-O; audit `extension.permissions_restored`). Retry through the extension
|
|
385
|
+
* admin (the package is already in the package store) with the sha256 from the result.
|
|
386
|
+
*/
|
|
387
|
+
private deploy;
|
|
388
|
+
/**
|
|
389
|
+
* Restores the snapshot overwritten at confirm (deletes it when there was none before), audits
|
|
390
|
+
* `extension.permissions_restored`. Compare-and-write (row locked): restores only while the
|
|
391
|
+
* snapshot is still the one written at confirm (this version, approved by this actor); if someone
|
|
392
|
+
* approved or changed it meanwhile it is left alone and false is returned.
|
|
393
|
+
*/
|
|
394
|
+
private restoreSnapshot;
|
|
395
|
+
/**
|
|
396
|
+
* Deletes expired staging rows and their object prefixes (maintenance job `app-staging-cleanup`).
|
|
397
|
+
* Row by row: objects first, then the row (a failed object delete keeps the row for the next
|
|
398
|
+
* round); concurrent replicas skip each other's rows (`SKIP LOCKED`). Returns the rows deleted.
|
|
399
|
+
*/
|
|
400
|
+
cleanupExpired(): Promise<number>;
|
|
401
|
+
/** npm / marketplace imports: the package must be the one that was asked for. */
|
|
402
|
+
private checkExpected;
|
|
403
|
+
/** A config-declared extension's name cannot be taken by an imported plugin. */
|
|
404
|
+
private assertNotDeclared;
|
|
405
|
+
/**
|
|
406
|
+
* Skills (by the skill package rules), connector templates (against the loaded connector) and
|
|
407
|
+
* icons; returns the files to store and the review's skills and templates.
|
|
408
|
+
*/
|
|
409
|
+
private checkContent;
|
|
410
|
+
/**
|
|
411
|
+
* The highest imported, non-deleted catalog version satisfying each dependency's range (null when
|
|
412
|
+
* none does).
|
|
413
|
+
*/
|
|
414
|
+
private resolveDependencies;
|
|
415
|
+
/**
|
|
416
|
+
* The extension's state on the deployment; installed from another npm package ->
|
|
417
|
+
* `extension.name_conflict`.
|
|
418
|
+
*/
|
|
419
|
+
private extensionState;
|
|
420
|
+
/** The review of the extension: permissions, the change against the snapshot, warnings, action. */
|
|
421
|
+
private reviewExtension;
|
|
422
|
+
private readStored;
|
|
423
|
+
private itemView;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* The review digest (first 32 hex of a sha256): name, version and content digest, the extension (sha256, action,
|
|
427
|
+
* current version / package, its own review digest), every template field, each skill's name / path
|
|
428
|
+
* / file count, the dependency resolution, the sha256 of every stored file, the format, the
|
|
429
|
+
* translation report's items, the sha256 of the license text and the two review flags
|
|
430
|
+
* (`claudeManifestIgnored`, `licenseTruncated`), and the agent templates when there are any.
|
|
431
|
+
* Exported for tests. `repository` is display only.
|
|
432
|
+
*/
|
|
433
|
+
export declare function pluginReviewHash(r: Pick<PluginReview, "name" | "version" | "contentDigest" | "extension" | "connectorTemplates" | "agentTemplates" | "skills" | "dependencies" | "format" | "translation" | "licenseText" | "claudeManifestIgnored" | "licenseTruncated">, files: {
|
|
434
|
+
path: string;
|
|
435
|
+
sha256: string;
|
|
436
|
+
}[]): string;
|