@capybara-hq/kernel 0.1.0-rc.3 → 0.1.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bootstrap.json +61 -5
- package/dist/admin/admin.controller.d.ts +47 -16
- package/dist/admin/admin.controller.js +44 -19
- package/dist/admin/extensions.controller.d.ts +24 -3
- package/dist/admin/extensions.controller.js +48 -8
- package/dist/admin/setup-lock.d.ts +1 -1
- package/dist/admin/setup-lock.js +1 -1
- package/dist/admin/setup.controller.d.ts +1 -1
- package/dist/admin/setup.controller.js +1 -1
- package/dist/admin/setup.service.d.ts +4 -4
- package/dist/admin/setup.service.js +8 -8
- package/dist/agents/agent-lookup.d.ts +19 -0
- package/dist/agents/agent-lookup.js +21 -0
- package/dist/agents/agent-profile.service.d.ts +29 -0
- package/dist/agents/agent-profile.service.js +117 -0
- package/dist/agents/agents.controller.d.ts +168 -3
- package/dist/agents/agents.controller.js +201 -12
- package/dist/agents/agents.module.d.ts +4 -1
- package/dist/agents/agents.module.js +36 -6
- package/dist/agents/agents.service.d.ts +64 -27
- package/dist/agents/agents.service.js +199 -74
- package/dist/agents/definition.d.ts +53 -0
- package/dist/agents/definition.js +55 -0
- package/dist/agents/from-template.d.ts +106 -0
- package/dist/agents/from-template.js +649 -0
- package/dist/agents/from-template.service.d.ts +60 -0
- package/dist/agents/from-template.service.js +161 -0
- package/dist/agents/instruction-files.d.ts +60 -0
- package/dist/agents/instruction-files.js +111 -0
- package/dist/agents/models.controller.d.ts +9 -3
- package/dist/agents/models.controller.js +19 -4
- package/dist/agents/org-templates.d.ts +176 -0
- package/dist/agents/org-templates.js +827 -0
- package/dist/agents/pending-connector-requests.d.ts +77 -0
- package/dist/agents/pending-connector-requests.js +215 -0
- package/dist/agents/pending-connectors.controller.d.ts +39 -0
- package/dist/agents/pending-connectors.controller.js +91 -0
- package/dist/agents/pending-connectors.service.d.ts +62 -0
- package/dist/agents/pending-connectors.service.js +282 -0
- package/dist/agents/profile.d.ts +96 -0
- package/dist/agents/profile.js +51 -0
- package/dist/agents/readiness.controller.d.ts +26 -0
- package/dist/agents/readiness.controller.js +56 -0
- package/dist/agents/templates.controller.d.ts +86 -5
- package/dist/agents/templates.controller.js +171 -7
- package/dist/agents/templates.d.ts +127 -23
- package/dist/agents/templates.js +476 -53
- package/dist/background/background.controller.d.ts +38 -0
- package/dist/background/background.controller.js +87 -0
- package/dist/background/background.module.d.ts +10 -0
- package/dist/background/background.module.js +39 -0
- package/dist/background/finish.d.ts +44 -0
- package/dist/background/finish.js +94 -0
- package/dist/background/launch-lock.d.ts +15 -0
- package/dist/background/launch-lock.js +40 -0
- package/dist/background/launch.d.ts +36 -0
- package/dist/background/launch.js +70 -0
- package/dist/background/poll.job.d.ts +56 -0
- package/dist/background/poll.job.js +190 -0
- package/dist/background/render.d.ts +23 -0
- package/dist/background/render.js +48 -0
- package/dist/background/session.d.ts +48 -0
- package/dist/background/session.js +79 -0
- package/dist/background/status.d.ts +35 -0
- package/dist/background/status.js +57 -0
- package/dist/background/stop.d.ts +68 -0
- package/dist/background/stop.js +243 -0
- package/dist/background/store.d.ts +162 -0
- package/dist/background/store.js +357 -0
- package/dist/background/store.module.d.ts +6 -0
- package/dist/background/store.module.js +22 -0
- package/dist/background/tasks.service.d.ts +77 -0
- package/dist/background/tasks.service.js +211 -0
- package/dist/background/wake-rules.d.ts +66 -0
- package/dist/background/wake-rules.js +113 -0
- package/dist/background/wake.d.ts +30 -0
- package/dist/background/wake.js +63 -0
- package/dist/catalog/admin-catalog.controller.d.ts +129 -30
- package/dist/catalog/admin-catalog.controller.js +213 -42
- package/dist/catalog/catalog-content.d.ts +58 -32
- package/dist/catalog/catalog-content.js +34 -8
- package/dist/catalog/catalog-import.module.d.ts +7 -0
- package/dist/catalog/catalog-import.module.js +60 -0
- package/dist/catalog/catalog-items.d.ts +111 -7
- package/dist/catalog/catalog-items.js +279 -13
- package/dist/catalog/catalog-scope.service.d.ts +260 -0
- package/dist/catalog/catalog-scope.service.js +1116 -0
- package/dist/catalog/catalog.module.d.ts +7 -9
- package/dist/catalog/catalog.module.js +41 -31
- package/dist/catalog/catalog.service.d.ts +101 -29
- package/dist/catalog/catalog.service.js +104 -106
- package/dist/catalog/claude/agents.js +2 -0
- package/dist/catalog/cli.d.ts +11 -1
- package/dist/catalog/cli.js +26 -1
- package/dist/catalog/component-promotion.d.ts +96 -0
- package/dist/catalog/component-promotion.js +395 -0
- package/dist/catalog/component-scope.controller.d.ts +152 -0
- package/dist/catalog/component-scope.controller.js +287 -0
- package/dist/catalog/component-scope.service.d.ts +303 -0
- package/dist/catalog/component-scope.service.js +936 -0
- package/dist/catalog/component-state.d.ts +174 -0
- package/dist/catalog/component-state.js +437 -0
- package/dist/catalog/job-ids.d.ts +30 -0
- package/dist/catalog/job-ids.js +25 -0
- package/dist/catalog/marketplace-fetch.d.ts +1 -1
- package/dist/catalog/marketplaces.controller.d.ts +22 -5
- package/dist/catalog/marketplaces.controller.js +56 -7
- package/dist/catalog/marketplaces.service.d.ts +54 -14
- package/dist/catalog/marketplaces.service.js +71 -22
- package/dist/catalog/org-catalog.controller.d.ts +125 -34
- package/dist/catalog/org-catalog.controller.js +181 -65
- package/dist/catalog/org-catalog.service.d.ts +65 -33
- package/dist/catalog/org-catalog.service.js +324 -157
- package/dist/catalog/org-extension-switch.d.ts +41 -0
- package/dist/catalog/org-extension-switch.js +115 -0
- package/dist/catalog/org-extension.controller.d.ts +119 -0
- package/dist/catalog/org-extension.controller.js +266 -0
- package/dist/catalog/org-plugin-uploads.controller.d.ts +98 -0
- package/dist/catalog/org-plugin-uploads.controller.js +213 -0
- package/dist/catalog/org-plugin-uploads.d.ts +63 -0
- package/dist/catalog/org-plugin-uploads.js +116 -0
- package/dist/catalog/owned-items.d.ts +184 -0
- package/dist/catalog/owned-items.js +789 -0
- package/dist/catalog/owned-plugin-cleanup.d.ts +56 -0
- package/dist/catalog/owned-plugin-cleanup.js +194 -0
- package/dist/catalog/ownership.d.ts +172 -0
- package/dist/catalog/ownership.js +326 -0
- package/dist/catalog/platform-components.d.ts +221 -0
- package/dist/catalog/platform-components.js +761 -0
- package/dist/catalog/platform-migration.d.ts +115 -0
- package/dist/catalog/platform-migration.js +582 -0
- package/dist/catalog/plugin-import.d.ts +178 -34
- package/dist/catalog/plugin-import.js +623 -83
- package/dist/catalog/plugin-install.d.ts +185 -41
- package/dist/catalog/plugin-install.js +758 -126
- package/dist/catalog/plugin-upgrade.d.ts +260 -225
- package/dist/catalog/plugin-upgrade.js +1148 -1137
- package/dist/catalog/request-rules.d.ts +65 -0
- package/dist/catalog/request-rules.js +217 -0
- package/dist/catalog/requests.service.d.ts +193 -118
- package/dist/catalog/requests.service.js +526 -343
- package/dist/catalog/reserved-names.d.ts +8 -0
- package/dist/catalog/reserved-names.js +42 -0
- package/dist/catalog/scope-orgs.d.ts +21 -0
- package/dist/catalog/scope-orgs.js +67 -0
- package/dist/catalog/scope-state.d.ts +35 -0
- package/dist/catalog/scope-state.js +87 -0
- package/dist/catalog/scope-sync-workers.d.ts +7 -0
- package/dist/catalog/scope-sync-workers.js +29 -0
- package/dist/catalog/scope-sync.d.ts +176 -0
- package/dist/catalog/scope-sync.js +576 -0
- package/dist/catalog/scope.d.ts +42 -0
- package/dist/catalog/scope.js +42 -0
- package/dist/catalog/unshare.d.ts +22 -0
- package/dist/catalog/unshare.js +118 -0
- package/dist/channels/actions.js +1 -0
- package/dist/channels/cards.js +21 -3
- package/dist/channels/channels.module.js +2 -0
- package/dist/channels/connections.service.d.ts +16 -1
- package/dist/channels/connections.service.js +38 -4
- package/dist/channels/inbound.d.ts +9 -1
- package/dist/channels/inbound.js +67 -5
- package/dist/channels/phrases.d.ts +35 -0
- package/dist/channels/phrases.js +29 -0
- package/dist/channels/threads.d.ts +5 -0
- package/dist/channels/threads.js +8 -0
- package/dist/config/docs.js +3 -1
- package/dist/config/schema.d.ts +24 -2
- package/dist/config/schema.js +145 -19
- package/dist/conversations/access.d.ts +6 -4
- package/dist/conversations/access.js +29 -5
- package/dist/conversations/agent-tree.d.ts +46 -0
- package/dist/conversations/agent-tree.js +92 -0
- package/dist/conversations/attachments.service.d.ts +30 -0
- package/dist/conversations/attachments.service.js +130 -5
- package/dist/conversations/conversations.controller.d.ts +79 -23
- package/dist/conversations/conversations.controller.js +141 -50
- package/dist/conversations/conversations.module.d.ts +1 -1
- package/dist/conversations/conversations.module.js +10 -7
- package/dist/conversations/conversations.service.d.ts +108 -9
- package/dist/conversations/conversations.service.js +237 -30
- package/dist/conversations/environment-status.d.ts +24 -0
- package/dist/conversations/environment-status.js +71 -0
- package/dist/conversations/event-log.d.ts +21 -6
- package/dist/conversations/event-log.js +70 -1
- package/dist/conversations/events.d.ts +140 -0
- package/dist/conversations/events.js +142 -13
- package/dist/conversations/queue.d.ts +3 -1
- package/dist/conversations/queue.js +13 -2
- package/dist/conversations/queue.service.d.ts +1 -1
- package/dist/conversations/queue.service.js +8 -1
- package/dist/conversations/titles.d.ts +12 -3
- package/dist/conversations/titles.js +36 -8
- package/dist/conversations/tree.d.ts +17 -0
- package/dist/conversations/tree.js +42 -0
- package/dist/ctx/create-ctx.d.ts +5 -0
- package/dist/ctx/create-ctx.js +15 -5
- package/dist/db/kernel-schema.d.ts +420 -20
- package/dist/db/pool.d.ts +5 -0
- package/dist/db/pool.js +3 -0
- package/dist/environments/access.d.ts +41 -0
- package/dist/environments/access.js +77 -0
- package/dist/environments/conversation-environments.d.ts +61 -0
- package/dist/environments/conversation-environments.js +170 -0
- package/dist/environments/dto.d.ts +25 -0
- package/dist/environments/dto.js +12 -0
- package/dist/environments/environments.controller.d.ts +33 -0
- package/dist/environments/environments.controller.js +110 -0
- package/dist/environments/environments.module.d.ts +8 -0
- package/dist/environments/environments.module.js +27 -0
- package/dist/environments/environments.service.d.ts +153 -0
- package/dist/environments/environments.service.js +541 -0
- package/dist/environments/legacy-cleanup.job.d.ts +34 -0
- package/dist/environments/legacy-cleanup.job.js +141 -0
- package/dist/errors.d.ts +90 -2
- package/dist/errors.js +90 -2
- package/dist/evals/reconstruct.d.ts +18 -9
- package/dist/evals/reconstruct.js +26 -7
- package/dist/evals/run-replay.d.ts +7 -2
- package/dist/evals/run-replay.js +42 -7
- package/dist/evals/step-replay.d.ts +2 -5
- package/dist/evals/step-replay.js +13 -7
- package/dist/evals/trajectory.js +1 -1
- package/dist/evals/trajectory.service.d.ts +8 -3
- package/dist/evals/trajectory.service.js +26 -14
- package/dist/evals/worker.d.ts +5 -5
- package/dist/evals/worker.js +9 -3
- package/dist/extensions/admin-ops.d.ts +36 -10
- package/dist/extensions/admin-ops.js +67 -42
- package/dist/extensions/admin-view.d.ts +39 -10
- package/dist/extensions/admin-view.js +111 -20
- package/dist/extensions/blobs.js +1 -0
- package/dist/extensions/bootstrap.d.ts +17 -4
- package/dist/extensions/bootstrap.js +70 -9
- package/dist/extensions/cli.d.ts +12 -0
- package/dist/extensions/cli.js +11 -2
- package/dist/extensions/config-issues.d.ts +13 -1
- package/dist/extensions/config-issues.js +22 -5
- package/dist/extensions/config-json-schema.d.ts +43 -7
- package/dist/extensions/config-json-schema.js +124 -58
- package/dist/extensions/deployment-config-store.d.ts +6 -0
- package/dist/extensions/deployment-config.d.ts +78 -8
- package/dist/extensions/deployment-config.js +172 -34
- package/dist/extensions/display-name.d.ts +22 -0
- package/dist/extensions/display-name.js +77 -0
- package/dist/extensions/effective-config.d.ts +127 -0
- package/dist/extensions/effective-config.js +368 -0
- package/dist/extensions/extensions.module.js +14 -2
- package/dist/extensions/hooks.d.ts +37 -4
- package/dist/extensions/hooks.js +82 -16
- package/dist/extensions/host.d.ts +45 -2
- package/dist/extensions/host.js +112 -16
- package/dist/extensions/installs.d.ts +20 -8
- package/dist/extensions/installs.js +37 -15
- package/dist/extensions/org-config.d.ts +81 -6
- package/dist/extensions/org-config.js +195 -44
- package/dist/extensions/org-levels.d.ts +37 -0
- package/dist/extensions/org-levels.js +71 -0
- package/dist/extensions/org-overrides.d.ts +151 -0
- package/dist/extensions/org-overrides.js +524 -0
- package/dist/extensions/package.d.ts +14 -1
- package/dist/extensions/package.js +51 -2
- package/dist/extensions/permission-view.d.ts +19 -4
- package/dist/extensions/permission-view.js +4 -4
- package/dist/extensions/plugin-items.d.ts +21 -0
- package/dist/extensions/plugin-items.js +42 -0
- package/dist/extensions/point-defaults.controller.d.ts +34 -0
- package/dist/extensions/point-defaults.controller.js +71 -0
- package/dist/extensions/point-defaults.d.ts +71 -0
- package/dist/extensions/point-defaults.js +234 -0
- package/dist/extensions/registry.d.ts +1 -1
- package/dist/extensions/registry.js +2 -0
- package/dist/extensions/resolve.d.ts +5 -1
- package/dist/extensions/resolve.js +15 -2
- package/dist/files/previewers.d.ts +8 -1
- package/dist/files/previewers.js +35 -6
- package/dist/http/api.module.js +31 -3
- package/dist/http/app.d.ts +11 -2
- package/dist/http/app.js +31 -5
- package/dist/http/nest-logger.d.ts +6 -5
- package/dist/http/nest-logger.js +24 -10
- package/dist/identity/accounts.d.ts +29 -29
- package/dist/identity/accounts.js +47 -47
- package/dist/identity/audit.d.ts +2 -1
- package/dist/identity/auth.controller.js +9 -5
- package/dist/identity/auth.guard.d.ts +13 -5
- package/dist/identity/auth.guard.js +26 -9
- package/dist/identity/cookies.d.ts +20 -5
- package/dist/identity/cookies.js +44 -6
- package/dist/identity/identity.module.d.ts +1 -1
- package/dist/identity/identity.module.js +4 -4
- package/dist/identity/me.controller.d.ts +5 -1
- package/dist/identity/me.controller.js +12 -3
- package/dist/identity/principal.d.ts +3 -3
- package/dist/identity/principal.js +3 -3
- package/dist/identity/sessions.d.ts +12 -0
- package/dist/identity/sessions.js +45 -0
- package/dist/identity/settings.d.ts +22 -11
- package/dist/identity/settings.js +53 -18
- package/dist/identity/{enterprise-admin.d.ts → super-admin.d.ts} +5 -5
- package/dist/identity/{enterprise-admin.js → super-admin.js} +24 -24
- package/dist/inbox/inbox.module.d.ts +4 -1
- package/dist/inbox/inbox.module.js +7 -3
- package/dist/inbox/inbox.service.d.ts +62 -3
- package/dist/inbox/inbox.service.js +74 -4
- package/dist/inbox/org-notices.d.ts +63 -0
- package/dist/inbox/org-notices.js +91 -0
- package/dist/inbox/platform-inbox.controller.d.ts +23 -0
- package/dist/inbox/platform-inbox.controller.js +58 -0
- package/dist/inbox/platform-inbox.service.d.ts +151 -0
- package/dist/inbox/platform-inbox.service.js +263 -0
- package/dist/inbox/platform-notices.d.ts +19 -0
- package/dist/inbox/platform-notices.js +9 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/infra/cli/kernel-cli.module.js +9 -1
- package/dist/infra/config/kernel-config.service.js +27 -1
- package/dist/infra/database/database.module.js +1 -0
- package/dist/infra/database/xact-lock.d.ts +1 -1
- package/dist/infra/database/xact-lock.js +1 -1
- package/dist/infra/events/kernel-events.d.ts +19 -2
- package/dist/infra/lifecycle/process-guards.js +4 -0
- package/dist/infra/logging/logging.module.d.ts +4 -2
- package/dist/infra/logging/logging.module.js +24 -6
- package/dist/infra/queue/add-job-once.d.ts +14 -0
- package/dist/infra/queue/add-job-once.js +16 -0
- package/dist/infra/queue/redis-connection.d.ts +6 -0
- package/dist/infra/queue/redis-connection.js +7 -0
- package/dist/infra/redis/redis.module.js +6 -2
- package/dist/infra/tokens.d.ts +6 -1
- package/dist/infra/tokens.js +6 -1
- package/dist/kernel.module.js +6 -0
- package/dist/lifecycle/kernel-lifecycle.d.ts +1 -1
- package/dist/lifecycle/kernel-lifecycle.js +4 -4
- package/dist/log.d.ts +13 -1
- package/dist/log.js +93 -17
- package/dist/models/prices.d.ts +5 -5
- package/dist/models/prices.js +4 -4
- package/dist/models/purposes.controller.d.ts +6 -4
- package/dist/models/purposes.controller.js +13 -7
- package/dist/models/purposes.d.ts +43 -9
- package/dist/models/purposes.js +48 -18
- package/dist/orgs/directory-sync.d.ts +14 -5
- package/dist/orgs/directory-sync.js +41 -17
- package/dist/orgs/offboarding.d.ts +12 -8
- package/dist/orgs/offboarding.js +54 -33
- package/dist/orgs/org-lock.d.ts +5 -0
- package/dist/orgs/org-lock.js +13 -0
- package/dist/orgs/org.guard.d.ts +10 -0
- package/dist/orgs/org.guard.js +43 -32
- package/dist/orgs/orgs.module.js +3 -0
- package/dist/orgs/orgs.service.d.ts +20 -7
- package/dist/orgs/orgs.service.js +32 -12
- package/dist/orgs/roles.d.ts +1 -1
- package/dist/orgs/roles.js +5 -1
- package/dist/orgs/settings.controller.d.ts +1 -1
- package/dist/orgs/settings.service.d.ts +20 -3
- package/dist/orgs/settings.service.js +19 -4
- package/dist/overrides.d.ts +3 -0
- package/dist/overrides.js +2 -0
- package/dist/platform/actor.d.ts +48 -0
- package/dist/platform/actor.js +100 -0
- package/dist/platform/agent-docs.d.ts +18 -0
- package/dist/platform/agent-docs.js +59 -0
- package/dist/platform/availability.d.ts +14 -0
- package/dist/platform/availability.js +43 -0
- package/dist/platform/errors.d.ts +11 -0
- package/dist/platform/errors.js +26 -0
- package/dist/platform/exclusions.d.ts +12 -0
- package/dist/platform/exclusions.js +1387 -0
- package/dist/platform/method.d.ts +6 -0
- package/dist/platform/method.js +15 -0
- package/dist/platform/operation.d.ts +92 -0
- package/dist/platform/operation.js +35 -0
- package/dist/platform/ops/agent-templates.ops.d.ts +14 -0
- package/dist/platform/ops/agent-templates.ops.js +92 -0
- package/dist/platform/ops/agents.ops.d.ts +19 -0
- package/dist/platform/ops/agents.ops.js +294 -0
- package/dist/platform/ops/connectors.ops.d.ts +15 -0
- package/dist/platform/ops/connectors.ops.js +126 -0
- package/dist/platform/ops/errors.d.ts +11 -0
- package/dist/platform/ops/errors.js +22 -0
- package/dist/platform/ops/extensions.ops.d.ts +19 -0
- package/dist/platform/ops/extensions.ops.js +116 -0
- package/dist/platform/ops/marketplaces.ops.d.ts +16 -0
- package/dist/platform/ops/marketplaces.ops.js +157 -0
- package/dist/platform/ops/paging.d.ts +14 -0
- package/dist/platform/ops/paging.js +20 -0
- package/dist/platform/ops/platform.ops.d.ts +23 -0
- package/dist/platform/ops/platform.ops.js +158 -0
- package/dist/platform/ops/plugins.ops.d.ts +33 -0
- package/dist/platform/ops/plugins.ops.js +377 -0
- package/dist/platform/ops/requests.ops.d.ts +14 -0
- package/dist/platform/ops/requests.ops.js +153 -0
- package/dist/platform/ops/role.d.ts +4 -0
- package/dist/platform/ops/role.js +10 -0
- package/dist/platform/ops/skills.ops.d.ts +13 -0
- package/dist/platform/ops/skills.ops.js +98 -0
- package/dist/platform/ops/summary.d.ts +10 -0
- package/dist/platform/ops/summary.js +18 -0
- package/dist/platform/platform-ops.module.d.ts +7 -0
- package/dist/platform/platform-ops.module.js +55 -0
- package/dist/platform/platform.module.d.ts +8 -0
- package/dist/platform/platform.module.js +25 -0
- package/dist/platform/redact-orgs.d.ts +7 -0
- package/dist/platform/redact-orgs.js +52 -0
- package/dist/platform/registry.d.ts +30 -0
- package/dist/platform/registry.js +111 -0
- package/dist/roles/worker-role.d.ts +6 -4
- package/dist/roles/worker-role.js +14 -7
- package/dist/roles/worker.module.d.ts +1 -1
- package/dist/roles/worker.module.js +15 -1
- package/dist/runtime/context/build.d.ts +11 -7
- package/dist/runtime/context/build.js +46 -19
- package/dist/runtime/context/claude-tools.d.ts +3 -1
- package/dist/runtime/context/claude-tools.js +8 -6
- package/dist/runtime/context/compaction.js +13 -0
- package/dist/runtime/context/reminders.d.ts +2 -0
- package/dist/runtime/context/reminders.js +2 -0
- package/dist/runtime/context/skills.js +9 -2
- package/dist/runtime/context/tool-changes.d.ts +27 -0
- package/dist/runtime/context/tool-changes.js +60 -0
- package/dist/runtime/hook-calls.js +2 -0
- package/dist/runtime/langgraph-loop.d.ts +3 -1
- package/dist/runtime/langgraph-loop.js +36 -17
- package/dist/runtime/loop.d.ts +34 -5
- package/dist/runtime/maintenance.d.ts +9 -4
- package/dist/runtime/maintenance.js +35 -8
- package/dist/runtime/model-call.d.ts +46 -8
- package/dist/runtime/model-call.js +72 -21
- package/dist/runtime/providers.d.ts +6 -0
- package/dist/runtime/providers.js +8 -0
- package/dist/runtime/run-control.d.ts +11 -1
- package/dist/runtime/run-control.js +12 -0
- package/dist/runtime/run-drafts.d.ts +85 -0
- package/dist/runtime/run-drafts.js +230 -0
- package/dist/runtime/run-jobs.d.ts +3 -5
- package/dist/runtime/run-jobs.js +3 -7
- package/dist/runtime/run-queue.d.ts +59 -2
- package/dist/runtime/run-queue.js +311 -38
- package/dist/runtime/run-worker.d.ts +11 -5
- package/dist/runtime/run-worker.js +69 -33
- package/dist/runtime/runtime.module.js +11 -3
- package/dist/runtime/step-log.d.ts +15 -4
- package/dist/runtime/step-log.js +24 -7
- package/dist/runtime/stream.controller.d.ts +23 -1
- package/dist/runtime/stream.controller.js +60 -3
- package/dist/runtime/stream.d.ts +4 -1
- package/dist/runtime/stream.js +27 -3
- package/dist/runtime/subagents/child.d.ts +55 -7
- package/dist/runtime/subagents/child.js +105 -7
- package/dist/runtime/subagents/definition.d.ts +12 -3
- package/dist/runtime/subagents/definition.js +44 -28
- package/dist/runtime/subagents/deliveries.d.ts +71 -0
- package/dist/runtime/subagents/deliveries.js +228 -0
- package/dist/runtime/subagents/dispatch.d.ts +115 -26
- package/dist/runtime/subagents/dispatch.js +212 -141
- package/dist/runtime/subagents/limits.d.ts +24 -5
- package/dist/runtime/subagents/limits.js +40 -6
- package/dist/runtime/subagents/messages.d.ts +95 -0
- package/dist/runtime/subagents/messages.js +328 -0
- package/dist/runtime/subagents/preamble.d.ts +4 -4
- package/dist/runtime/subagents/preamble.js +9 -7
- package/dist/runtime/subagents/progress.d.ts +8 -6
- package/dist/runtime/subagents/progress.js +11 -6
- package/dist/runtime/subagents/render.d.ts +30 -0
- package/dist/runtime/subagents/render.js +53 -0
- package/dist/runtime/subagents/roster.d.ts +24 -7
- package/dist/runtime/subagents/roster.js +47 -11
- package/dist/runtime/subagents/skill-fork.d.ts +3 -2
- package/dist/runtime/subagents/skill-fork.js +8 -4
- package/dist/runtime/subagents/status.d.ts +14 -0
- package/dist/runtime/subagents/status.js +23 -0
- package/dist/runtime/subagents/subagents.service.d.ts +7 -4
- package/dist/runtime/subagents/subagents.service.js +11 -6
- package/dist/runtime/usage-report.d.ts +2 -1
- package/dist/runtime/usage-report.js +19 -13
- package/dist/runtime/waits.d.ts +145 -36
- package/dist/runtime/waits.js +423 -109
- package/dist/sandbox/jobs.d.ts +40 -13
- package/dist/sandbox/jobs.js +57 -20
- package/dist/sandbox/leases.d.ts +37 -54
- package/dist/sandbox/leases.js +71 -115
- package/dist/sandbox/providers.d.ts +2 -2
- package/dist/sandbox/providers.js +1 -1
- package/dist/sandbox/sandbox.module.d.ts +3 -2
- package/dist/sandbox/sandbox.module.js +10 -4
- package/dist/sandbox/sandbox.service.d.ts +282 -129
- package/dist/sandbox/sandbox.service.js +736 -381
- package/dist/skills/catalog.d.ts +3 -2
- package/dist/skills/catalog.js +21 -43
- package/dist/skills/changes.controller.d.ts +7 -0
- package/dist/skills/changes.controller.js +19 -1
- package/dist/skills/invoke.js +8 -3
- package/dist/skills/package.d.ts +20 -1
- package/dist/skills/package.js +28 -1
- package/dist/skills/skills.controller.d.ts +39 -4
- package/dist/skills/skills.controller.js +88 -10
- package/dist/skills/skills.module.js +10 -1
- package/dist/skills/skills.service.d.ts +106 -26
- package/dist/skills/skills.service.js +421 -75
- package/dist/skills/usable.d.ts +81 -0
- package/dist/skills/usable.js +379 -0
- package/dist/tools/approvals.service.d.ts +20 -2
- package/dist/tools/approvals.service.js +25 -4
- package/dist/tools/builtin-names.d.ts +41 -7
- package/dist/tools/builtin-names.js +59 -7
- package/dist/tools/builtins/agent.d.ts +23 -21
- package/dist/tools/builtins/agent.js +62 -55
- package/dist/tools/builtins/builtin-tools.d.ts +19 -1
- package/dist/tools/builtins/builtin-tools.js +59 -2
- package/dist/tools/builtins/handback.d.ts +28 -0
- package/dist/tools/builtins/handback.js +53 -0
- package/dist/tools/builtins/platform.d.ts +34 -0
- package/dist/tools/builtins/platform.js +362 -0
- package/dist/tools/builtins/sandbox/bash.d.ts +1 -1
- package/dist/tools/builtins/sandbox/bash.js +241 -4
- package/dist/tools/builtins/sandbox/common.d.ts +69 -27
- package/dist/tools/builtins/sandbox/common.js +87 -48
- package/dist/tools/builtins/sandbox/deliver.js +1 -1
- package/dist/tools/builtins/sandbox/edit.js +2 -2
- package/dist/tools/builtins/sandbox/glob.js +2 -2
- package/dist/tools/builtins/sandbox/grep.js +2 -4
- package/dist/tools/builtins/sandbox/index.d.ts +3 -1
- package/dist/tools/builtins/sandbox/index.js +7 -1
- package/dist/tools/builtins/sandbox/read.js +1 -1
- package/dist/tools/builtins/sandbox/task-output.d.ts +74 -0
- package/dist/tools/builtins/sandbox/task-output.js +329 -0
- package/dist/tools/builtins/sandbox/task-stop.d.ts +10 -0
- package/dist/tools/builtins/sandbox/task-stop.js +113 -0
- package/dist/tools/builtins/sandbox/write.js +2 -2
- package/dist/tools/builtins/send-message.d.ts +56 -0
- package/dist/tools/builtins/send-message.js +100 -0
- package/dist/tools/builtins/skill-load.d.ts +22 -14
- package/dist/tools/builtins/skill-load.js +86 -57
- package/dist/tools/builtins/skill-write.js +1 -1
- package/dist/tools/builtins/web/errors.d.ts +8 -0
- package/dist/tools/builtins/web/errors.js +53 -0
- package/dist/tools/builtins/web/extract.d.ts +62 -0
- package/dist/tools/builtins/web/extract.js +271 -0
- package/dist/tools/builtins/web/fetch.d.ts +55 -0
- package/dist/tools/builtins/web/fetch.js +175 -0
- package/dist/tools/builtins/web/index.d.ts +13 -0
- package/dist/tools/builtins/web/index.js +12 -0
- package/dist/tools/builtins/web/page-cache.d.ts +25 -0
- package/dist/tools/builtins/web/page-cache.js +77 -0
- package/dist/tools/builtins/web/search.d.ts +25 -0
- package/dist/tools/builtins/web/search.js +210 -0
- package/dist/tools/builtins/web/url.d.ts +17 -0
- package/dist/tools/builtins/web/url.js +43 -0
- package/dist/tools/connectors.controller.d.ts +10 -0
- package/dist/tools/connectors.controller.js +12 -0
- package/dist/tools/connectors.service.d.ts +46 -5
- package/dist/tools/connectors.service.js +94 -15
- package/dist/tools/extension-tools.controller.d.ts +14 -0
- package/dist/tools/extension-tools.controller.js +37 -0
- package/dist/tools/info.d.ts +42 -1
- package/dist/tools/info.js +64 -1
- package/dist/tools/oauth/flow-paths.d.ts +1 -1
- package/dist/tools/oauth/flow-paths.js +1 -1
- package/dist/tools/org-tool-switches.d.ts +74 -0
- package/dist/tools/org-tool-switches.js +184 -0
- package/dist/tools/pipeline.d.ts +46 -40
- package/dist/tools/pipeline.js +202 -364
- package/dist/tools/policy.d.ts +1 -1
- package/dist/tools/policy.js +36 -16
- package/dist/tools/registry.d.ts +120 -8
- package/dist/tools/registry.js +112 -19
- package/dist/tools/tools.module.js +24 -2
- package/dist/tools/validate.js +1 -1
- package/dist/ui/views.d.ts +2 -1
- package/dist/ui/views.js +17 -3
- package/package.json +3 -3
- package/src/migrations/0064_account_last_org.sql +7 -0
- package/src/migrations/0065_conversation_archive.sql +8 -0
- package/src/migrations/0066_extension_display_name.sql +4 -0
- package/src/migrations/0067_agent_profiles.sql +20 -0
- package/src/migrations/0068_agent_avatar_uploads.sql +7 -0
- package/src/migrations/0069_attachments_agent_idx.sql +3 -0
- package/src/migrations/0070_background_tasks.sql +37 -0
- package/src/migrations/0071_background_tasks_reserve.sql +6 -0
- package/src/migrations/0072_background_tasks_stopping.sql +5 -0
- package/src/migrations/0073_org_extension_point_defaults.sql +11 -0
- package/src/migrations/0074_subagent_tree.sql +50 -0
- package/src/migrations/0075_plugin_scope.sql +61 -0
- package/src/migrations/0076_skills_created_by_nullable.sql +6 -0
- package/src/migrations/0077_scope_requests.sql +52 -0
- package/src/migrations/0078_scope_grant_switches.sql +18 -0
- package/src/migrations/0079_scope_live_install_switches.sql +19 -0
- package/src/migrations/0080_rename_enterprise_admin.sql +18 -0
- package/src/migrations/0081_platform_components.sql +129 -0
- package/src/migrations/0082_platform_migration.sql +33 -0
- package/src/migrations/0083_plugin_scope_sync_failures.sql +15 -0
- package/src/migrations/0084_org_owned_items.sql +85 -0
- package/src/migrations/0085_agent_templates_phase4.sql +45 -0
- package/src/migrations/0086_org_layering.sql +30 -0
- package/src/migrations/0087_approval_summary.sql +6 -0
- package/src/migrations/0088_environments.sql +80 -0
- package/dist/catalog/upgrade-targets.d.ts +0 -56
- package/dist/catalog/upgrade-targets.js +0 -90
- package/dist/conversations/sandbox-status.d.ts +0 -24
- package/dist/conversations/sandbox-status.js +0 -52
- package/dist/extensions/org-config.controller.d.ts +0 -24
- package/dist/extensions/org-config.controller.js +0 -62
package/dist/config/schema.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export declare const KernelConfigSchema: z.ZodObject<{
|
|
|
51
51
|
url: z.ZodString;
|
|
52
52
|
poolMax: z.ZodDefault<z.ZodNumber>;
|
|
53
53
|
connectTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
54
|
+
idleTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
54
55
|
}, z.core.$strip>>;
|
|
55
56
|
redis: z.ZodPrefault<z.ZodObject<{
|
|
56
57
|
url: z.ZodString;
|
|
@@ -119,6 +120,7 @@ export declare const KernelConfigSchema: z.ZodObject<{
|
|
|
119
120
|
}, z.core.$strip>>;
|
|
120
121
|
runtime: z.ZodDefault<z.ZodObject<{
|
|
121
122
|
maxSteps: z.ZodDefault<z.ZodNumber>;
|
|
123
|
+
wakeOnBackgroundTask: z.ZodDefault<z.ZodBoolean>;
|
|
122
124
|
maxRunSeconds: z.ZodDefault<z.ZodNumber>;
|
|
123
125
|
streamIdleMs: z.ZodDefault<z.ZodNumber>;
|
|
124
126
|
maxOutputTokens: z.ZodDefault<z.ZodNumber>;
|
|
@@ -175,15 +177,32 @@ export declare const KernelConfigSchema: z.ZodObject<{
|
|
|
175
177
|
requestMediaBytes: z.ZodDefault<z.ZodNumber>;
|
|
176
178
|
}, z.core.$strip>>;
|
|
177
179
|
subagents: z.ZodPrefault<z.ZodObject<{
|
|
178
|
-
|
|
180
|
+
maxDepth: z.ZodDefault<z.ZodNumber>;
|
|
181
|
+
maxConcurrentPerConversation: z.ZodDefault<z.ZodNumber>;
|
|
179
182
|
maxDispatchesPerRun: z.ZodDefault<z.ZodNumber>;
|
|
180
183
|
maxTokensPerRun: z.ZodDefault<z.ZodNumber>;
|
|
181
184
|
}, z.core.$strip>>;
|
|
185
|
+
web: z.ZodPrefault<z.ZodObject<{
|
|
186
|
+
search: z.ZodPrefault<z.ZodObject<{
|
|
187
|
+
maxResults: z.ZodDefault<z.ZodNumber>;
|
|
188
|
+
}, z.core.$strip>>;
|
|
189
|
+
fetch: z.ZodPrefault<z.ZodObject<{
|
|
190
|
+
maxPageChars: z.ZodDefault<z.ZodNumber>;
|
|
191
|
+
maxAnswerTokens: z.ZodDefault<z.ZodNumber>;
|
|
192
|
+
cacheSeconds: z.ZodDefault<z.ZodNumber>;
|
|
193
|
+
timeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
194
|
+
}, z.core.$strip>>;
|
|
195
|
+
}, z.core.$strip>>;
|
|
182
196
|
sandbox: z.ZodPrefault<z.ZodObject<{
|
|
183
|
-
image: z.
|
|
197
|
+
image: z.ZodOptional<z.ZodString>;
|
|
184
198
|
lockWaitSeconds: z.ZodDefault<z.ZodNumber>;
|
|
185
199
|
maxConcurrentCommands: z.ZodDefault<z.ZodNumber>;
|
|
186
200
|
deliverMaxBytes: z.ZodDefault<z.ZodNumber>;
|
|
201
|
+
background: z.ZodPrefault<z.ZodObject<{
|
|
202
|
+
maxTasks: z.ZodDefault<z.ZodNumber>;
|
|
203
|
+
maxSeconds: z.ZodDefault<z.ZodNumber>;
|
|
204
|
+
pollSeconds: z.ZodDefault<z.ZodNumber>;
|
|
205
|
+
}, z.core.$strip>>;
|
|
187
206
|
limits: z.ZodPrefault<z.ZodObject<{
|
|
188
207
|
cpu: z.ZodDefault<z.ZodNumber>;
|
|
189
208
|
memoryMb: z.ZodDefault<z.ZodNumber>;
|
|
@@ -200,6 +219,9 @@ export declare const KernelConfigSchema: z.ZodObject<{
|
|
|
200
219
|
allowHosts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
201
220
|
}, z.core.$strip>>;
|
|
202
221
|
}, z.core.$strip>>;
|
|
222
|
+
environments: z.ZodPrefault<z.ZodObject<{
|
|
223
|
+
maxPersonal: z.ZodDefault<z.ZodNumber>;
|
|
224
|
+
}, z.core.$strip>>;
|
|
203
225
|
evals: z.ZodPrefault<z.ZodObject<{
|
|
204
226
|
orgConcurrency: z.ZodDefault<z.ZodNumber>;
|
|
205
227
|
workerConcurrency: z.ZodDefault<z.ZodNumber>;
|
package/dist/config/schema.js
CHANGED
|
@@ -179,6 +179,14 @@ export const KernelConfigSchema = z.object({
|
|
|
179
179
|
.positive()
|
|
180
180
|
.default(5000)
|
|
181
181
|
.meta(meta({ description: "PostgreSQL connect timeout in milliseconds" })),
|
|
182
|
+
idleTimeoutMs: z
|
|
183
|
+
.number()
|
|
184
|
+
.int()
|
|
185
|
+
.positive()
|
|
186
|
+
.default(60_000)
|
|
187
|
+
.meta(meta({
|
|
188
|
+
description: "How long an idle PostgreSQL connection stays in the pool, in milliseconds",
|
|
189
|
+
})),
|
|
182
190
|
})
|
|
183
191
|
.prefault({}),
|
|
184
192
|
redis: z
|
|
@@ -324,7 +332,7 @@ export const KernelConfigSchema = z.object({
|
|
|
324
332
|
description: "Mirror URLs of the official marketplace's marketplace.json (https), tried in order when the main URL fails; only for a marketplace.json URL (a git marketplace has no mirrors: point url at a mirror repository instead)",
|
|
325
333
|
})),
|
|
326
334
|
})
|
|
327
|
-
// Same rule as
|
|
335
|
+
// Same rule as a custom marketplace: a git marketplace has no mirrors.
|
|
328
336
|
.refine((o) => o.mirrors.length === 0 || !isGitMarketplaceUrl(o.url), {
|
|
329
337
|
message: "a git marketplace has no mirrors (point marketplaces.official.url at a mirror repository instead)",
|
|
330
338
|
path: ["mirrors"],
|
|
@@ -568,6 +576,12 @@ export const KernelConfigSchema = z.object({
|
|
|
568
576
|
.positive()
|
|
569
577
|
.default(50)
|
|
570
578
|
.meta(meta({ description: "Maximum model steps per agent run before the final wrap-up" })),
|
|
579
|
+
wakeOnBackgroundTask: z
|
|
580
|
+
.boolean()
|
|
581
|
+
.default(true)
|
|
582
|
+
.meta(meta({
|
|
583
|
+
description: "Whether the finish of a background Bash task or a sub-agent's delivery starts a run on an idle conversation or sub-agent (the person who started the task's or the sub-agent's run is the trigger); an organization can override it in its settings. When false the event is only logged and shown, and the next message picks it up",
|
|
584
|
+
})),
|
|
571
585
|
maxRunSeconds: z
|
|
572
586
|
.number()
|
|
573
587
|
.int()
|
|
@@ -656,6 +670,7 @@ export const KernelConfigSchema = z.object({
|
|
|
656
670
|
})
|
|
657
671
|
.default({
|
|
658
672
|
maxSteps: 50,
|
|
673
|
+
wakeOnBackgroundTask: true,
|
|
659
674
|
maxRunSeconds: DEFAULT_MAX_RUN_SECONDS,
|
|
660
675
|
streamIdleMs: 60000,
|
|
661
676
|
maxOutputTokens: 16000,
|
|
@@ -915,7 +930,17 @@ export const KernelConfigSchema = z.object({
|
|
|
915
930
|
.prefault({}),
|
|
916
931
|
subagents: z
|
|
917
932
|
.object({
|
|
918
|
-
|
|
933
|
+
maxDepth: z
|
|
934
|
+
.number()
|
|
935
|
+
.int()
|
|
936
|
+
.min(1)
|
|
937
|
+
.max(5)
|
|
938
|
+
.default(3)
|
|
939
|
+
.meta(meta({
|
|
940
|
+
hot: true,
|
|
941
|
+
description: "Levels of sub-agents below the conversation's own agent; 1 means sub-agents cannot dispatch sub-agents of their own. Organizations can be given their own value in the deployment setting subagentLimitOverrides",
|
|
942
|
+
})),
|
|
943
|
+
maxConcurrentPerConversation: z
|
|
919
944
|
.number()
|
|
920
945
|
.int()
|
|
921
946
|
.min(1)
|
|
@@ -923,44 +948,103 @@ export const KernelConfigSchema = z.object({
|
|
|
923
948
|
.default(4)
|
|
924
949
|
.meta(meta({
|
|
925
950
|
hot: true,
|
|
926
|
-
description: "Sub-agents one
|
|
951
|
+
description: "Sub-agents one conversation may have running at the same time, whichever of its runs dispatched them; agent calls beyond it are refused. Organizations can be given their own value in subagentLimitOverrides",
|
|
927
952
|
})),
|
|
928
953
|
maxDispatchesPerRun: z
|
|
929
954
|
.number()
|
|
930
955
|
.int()
|
|
931
|
-
.min(
|
|
956
|
+
.min(0)
|
|
932
957
|
.max(500)
|
|
933
958
|
.default(50)
|
|
934
959
|
.meta(meta({
|
|
935
960
|
hot: true,
|
|
936
|
-
description: "Sub-agents
|
|
961
|
+
description: "Sub-agents the whole tree under a person's message may dispatch in total, counted across every level (nested dispatches and SendMessage messages that restart an idle sub-agent included); later agent calls and such messages are refused. 0 means no limit. Organizations can be given their own value in subagentLimitOverrides",
|
|
937
962
|
})),
|
|
938
963
|
maxTokensPerRun: z
|
|
939
964
|
.number()
|
|
940
965
|
.int()
|
|
941
|
-
.min(
|
|
966
|
+
.min(0)
|
|
967
|
+
.refine((n) => n === 0 || n >= 10_000, "0 (no limit) or at least 10,000")
|
|
942
968
|
.default(5_000_000)
|
|
943
969
|
.meta(meta({
|
|
944
970
|
hot: true,
|
|
945
|
-
description: "Tokens (input, output and cache)
|
|
971
|
+
description: "Tokens (input, output and cache) all sub-agents of the tree under a person's message may use together; at the cap running sub-agents stop and new dispatches are refused. 0 means no limit; otherwise at least 10,000. Organizations can be given their own value in subagentLimitOverrides",
|
|
946
972
|
})),
|
|
947
973
|
})
|
|
948
974
|
.prefault({}),
|
|
975
|
+
web: z
|
|
976
|
+
.object({
|
|
977
|
+
search: z
|
|
978
|
+
.object({
|
|
979
|
+
maxResults: z
|
|
980
|
+
.number()
|
|
981
|
+
.int()
|
|
982
|
+
.min(1)
|
|
983
|
+
.max(20)
|
|
984
|
+
.default(10)
|
|
985
|
+
.meta(meta({
|
|
986
|
+
hot: true,
|
|
987
|
+
description: "Maximum number of results one WebSearch call returns to the model, however many the search provider returns",
|
|
988
|
+
})),
|
|
989
|
+
})
|
|
990
|
+
.prefault({}),
|
|
991
|
+
fetch: z
|
|
992
|
+
.object({
|
|
993
|
+
maxPageChars: z
|
|
994
|
+
.number()
|
|
995
|
+
.int()
|
|
996
|
+
.positive()
|
|
997
|
+
.default(400_000)
|
|
998
|
+
.meta(meta({
|
|
999
|
+
hot: true,
|
|
1000
|
+
description: "Maximum characters of a fetched page kept for answering a WebFetch prompt; longer pages are truncated",
|
|
1001
|
+
})),
|
|
1002
|
+
maxAnswerTokens: z
|
|
1003
|
+
.number()
|
|
1004
|
+
.int()
|
|
1005
|
+
.positive()
|
|
1006
|
+
.default(4000)
|
|
1007
|
+
.meta(meta({
|
|
1008
|
+
hot: true,
|
|
1009
|
+
description: "Maximum output tokens of the model call that answers a WebFetch prompt from the page",
|
|
1010
|
+
})),
|
|
1011
|
+
cacheSeconds: z
|
|
1012
|
+
.number()
|
|
1013
|
+
.int()
|
|
1014
|
+
.min(0)
|
|
1015
|
+
.default(900)
|
|
1016
|
+
.meta(meta({
|
|
1017
|
+
hot: true,
|
|
1018
|
+
description: "Seconds a fetched page is cached per organization and URL; 0 turns the cache off",
|
|
1019
|
+
})),
|
|
1020
|
+
timeoutMs: z
|
|
1021
|
+
.number()
|
|
1022
|
+
.int()
|
|
1023
|
+
.positive()
|
|
1024
|
+
.default(180_000)
|
|
1025
|
+
.meta(meta({
|
|
1026
|
+
hot: true,
|
|
1027
|
+
description: "Time limit of one WebFetch call in milliseconds, the provider's fetch and the answering model call together; replaces tools.timeoutMs for WebFetch",
|
|
1028
|
+
})),
|
|
1029
|
+
})
|
|
1030
|
+
.prefault({}),
|
|
1031
|
+
})
|
|
1032
|
+
.prefault({}),
|
|
949
1033
|
sandbox: z
|
|
950
1034
|
.object({
|
|
951
1035
|
image: z
|
|
952
1036
|
.string()
|
|
953
1037
|
.min(1)
|
|
954
|
-
.
|
|
1038
|
+
.optional()
|
|
955
1039
|
.meta(meta({
|
|
956
|
-
description: "Image for
|
|
1040
|
+
description: "Image for environment instances, passed to the sandbox extension; unset (the default), each extension uses the image published with its own version (ghcr.io/capybara-hq/capybara-sandbox). Set it to a locally built or mirrored image for offline deployments; an extension that builds instances from its own template may ignore it",
|
|
957
1041
|
})),
|
|
958
1042
|
lockWaitSeconds: z
|
|
959
1043
|
.number()
|
|
960
1044
|
.positive()
|
|
961
1045
|
.default(75)
|
|
962
1046
|
.meta(meta({
|
|
963
|
-
description: "Seconds a sandbox call waits while
|
|
1047
|
+
description: "Seconds a sandbox call waits for the environment's instance (while it is being created, resumed or suspended, or all its concurrent command slots are taken) before failing with sandbox.busy; keep it above the 60-second sandbox lock TTL so a call after a replica crash waits for the dead replica's lock to expire",
|
|
964
1048
|
})),
|
|
965
1049
|
maxConcurrentCommands: z
|
|
966
1050
|
.number()
|
|
@@ -970,7 +1054,7 @@ export const KernelConfigSchema = z.object({
|
|
|
970
1054
|
.default(6)
|
|
971
1055
|
.meta(meta({
|
|
972
1056
|
hot: true,
|
|
973
|
-
description: "Sandbox commands and file operations that may run at the same time in one
|
|
1057
|
+
description: "Sandbox commands and file operations that may run at the same time in one environment, shared by all its conversations and their sub-agents; 1 runs them one at a time",
|
|
974
1058
|
})),
|
|
975
1059
|
deliverMaxBytes: z
|
|
976
1060
|
.number()
|
|
@@ -980,6 +1064,35 @@ export const KernelConfigSchema = z.object({
|
|
|
980
1064
|
.meta(meta({
|
|
981
1065
|
description: "Largest file in bytes an agent may deliver from its sandbox to the user as an artifact (Deliver)",
|
|
982
1066
|
})),
|
|
1067
|
+
background: z
|
|
1068
|
+
.object({
|
|
1069
|
+
maxTasks: z
|
|
1070
|
+
.number()
|
|
1071
|
+
.int()
|
|
1072
|
+
.min(1)
|
|
1073
|
+
.max(100)
|
|
1074
|
+
.default(4)
|
|
1075
|
+
.meta(meta({
|
|
1076
|
+
description: "Most background Bash tasks (run_in_background) that may run at once in one conversation, its sub-agents included (counted per root conversation, not per environment); a launch beyond it is refused",
|
|
1077
|
+
})),
|
|
1078
|
+
maxSeconds: z
|
|
1079
|
+
.number()
|
|
1080
|
+
.int()
|
|
1081
|
+
.positive()
|
|
1082
|
+
.default(7200)
|
|
1083
|
+
.meta(meta({
|
|
1084
|
+
description: "Longest a background Bash task may run, in seconds; the task is killed at its deadline and ends as timed_out. Clamped to sandbox.limits.maxCommandSeconds; not limited by runtime.maxRunSeconds",
|
|
1085
|
+
})),
|
|
1086
|
+
pollSeconds: z
|
|
1087
|
+
.number()
|
|
1088
|
+
.int()
|
|
1089
|
+
.min(1)
|
|
1090
|
+
.default(10)
|
|
1091
|
+
.meta(meta({
|
|
1092
|
+
description: "How often the worker checks the running background Bash tasks of every environment for a finish, in seconds; read when the worker starts",
|
|
1093
|
+
})),
|
|
1094
|
+
})
|
|
1095
|
+
.prefault({}),
|
|
983
1096
|
limits: z
|
|
984
1097
|
.object({
|
|
985
1098
|
cpu: z
|
|
@@ -987,7 +1100,7 @@ export const KernelConfigSchema = z.object({
|
|
|
987
1100
|
.positive()
|
|
988
1101
|
.default(1)
|
|
989
1102
|
.meta(meta({
|
|
990
|
-
description: "CPU cores for each
|
|
1103
|
+
description: "CPU cores for each environment instance; applies to instances created after the change (an extension that sizes instances by its own template, such as E2B, may not apply it)",
|
|
991
1104
|
})),
|
|
992
1105
|
memoryMb: z
|
|
993
1106
|
.number()
|
|
@@ -995,7 +1108,7 @@ export const KernelConfigSchema = z.object({
|
|
|
995
1108
|
.positive()
|
|
996
1109
|
.default(2048)
|
|
997
1110
|
.meta(meta({
|
|
998
|
-
description: "Memory limit of each
|
|
1111
|
+
description: "Memory limit of each environment instance in MiB; applies to instances created after the change (an extension that sizes instances by its own template, such as E2B, may not apply it)",
|
|
999
1112
|
})),
|
|
1000
1113
|
diskMb: z
|
|
1001
1114
|
.number()
|
|
@@ -1003,7 +1116,7 @@ export const KernelConfigSchema = z.object({
|
|
|
1003
1116
|
.positive()
|
|
1004
1117
|
.default(5120)
|
|
1005
1118
|
.meta(meta({
|
|
1006
|
-
description: "Disk limit of each
|
|
1119
|
+
description: "Disk limit of each environment's file system in MiB; applies to file systems created after the change (Docker: only with a volume driver that supports size; an extension whose storage cannot be sized may not apply it)",
|
|
1007
1120
|
})),
|
|
1008
1121
|
maxCommandSeconds: z
|
|
1009
1122
|
.number()
|
|
@@ -1019,7 +1132,7 @@ export const KernelConfigSchema = z.object({
|
|
|
1019
1132
|
.positive()
|
|
1020
1133
|
.default(10)
|
|
1021
1134
|
.meta(meta({
|
|
1022
|
-
description: "Minutes without
|
|
1135
|
+
description: "Minutes without a command from any conversation of the environment before its running instance is suspended (files are kept, processes end)",
|
|
1023
1136
|
})),
|
|
1024
1137
|
destroyAfterInactiveDays: z
|
|
1025
1138
|
.number()
|
|
@@ -1027,7 +1140,7 @@ export const KernelConfigSchema = z.object({
|
|
|
1027
1140
|
.positive()
|
|
1028
1141
|
.default(7)
|
|
1029
1142
|
.meta(meta({
|
|
1030
|
-
description: "Days without use before
|
|
1143
|
+
description: "Days without use before an environment's instance is destroyed; its files are kept until the environment is deleted, and the next use starts a new instance on them",
|
|
1031
1144
|
})),
|
|
1032
1145
|
maxRunningMinutes: z
|
|
1033
1146
|
.number()
|
|
@@ -1035,13 +1148,13 @@ export const KernelConfigSchema = z.object({
|
|
|
1035
1148
|
.positive()
|
|
1036
1149
|
.default(120)
|
|
1037
1150
|
.meta(meta({
|
|
1038
|
-
description: "Minutes
|
|
1151
|
+
description: "Minutes an environment's instance may run continuously before it is suspended even while in use (skipped while a command is running)",
|
|
1039
1152
|
})),
|
|
1040
1153
|
egress: z
|
|
1041
1154
|
.enum(["none", "allowlist", "open"])
|
|
1042
1155
|
.default("allowlist")
|
|
1043
1156
|
.meta(meta({
|
|
1044
|
-
description: "Outbound network from
|
|
1157
|
+
description: "Outbound network from environment instances: none, allowlist (only allowHosts) or open; applies to instances created after the change, existing ones keep theirs until destroyed",
|
|
1045
1158
|
})),
|
|
1046
1159
|
allowHosts: z
|
|
1047
1160
|
.array(z.string())
|
|
@@ -1054,12 +1167,25 @@ export const KernelConfigSchema = z.object({
|
|
|
1054
1167
|
});
|
|
1055
1168
|
})
|
|
1056
1169
|
.meta(meta({
|
|
1057
|
-
description: "Hosts
|
|
1170
|
+
description: "Hosts environment instances may reach when egress is allowlist: lowercase hostnames, optional leading '*.', no IPs, ports or internal-only names; applies to instances created after the change",
|
|
1058
1171
|
})),
|
|
1059
1172
|
})
|
|
1060
1173
|
.prefault({}),
|
|
1061
1174
|
})
|
|
1062
1175
|
.prefault({}),
|
|
1176
|
+
environments: z
|
|
1177
|
+
.object({
|
|
1178
|
+
maxPersonal: z
|
|
1179
|
+
.number()
|
|
1180
|
+
.int()
|
|
1181
|
+
.min(1)
|
|
1182
|
+
.default(10)
|
|
1183
|
+
.meta(meta({
|
|
1184
|
+
hot: true,
|
|
1185
|
+
description: "Most personal environments a member may have in one org, the default one included; creating one more fails with environment.limit_reached",
|
|
1186
|
+
})),
|
|
1187
|
+
})
|
|
1188
|
+
.prefault({}),
|
|
1063
1189
|
evals: z
|
|
1064
1190
|
.object({
|
|
1065
1191
|
orgConcurrency: z
|
|
@@ -2,10 +2,12 @@ import { type ExpressionBuilder } from "kysely";
|
|
|
2
2
|
import type { KernelDatabase } from "../db/kernel-schema.js";
|
|
3
3
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
4
4
|
/**
|
|
5
|
-
* A sub-agent's conversation is reached through its
|
|
6
|
-
* same rule as its trajectory
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* A sub-agent's conversation is reached through the root of its tree (sub-agents spec §6.1,
|
|
6
|
+
* review m6, the same rule as its trajectory; agent map spec §4.1: nested sub-agents at any
|
|
7
|
+
* depth): the root is a chat conversation of the same org and owner whose agent is not deleted
|
|
8
|
+
* and still visible to the viewer, and every conversation between is a sub-agent conversation of
|
|
9
|
+
* that org. Any other kind passes. The child's own `agent_id` (the dispatched agent for an org
|
|
10
|
+
* agent, §5.5) is checked on top by the callers.
|
|
9
11
|
*/
|
|
10
12
|
export declare const parentReachable: (viewerAccountId: string) => (eb: ExpressionBuilder<KernelDatabase, "conversations">) => import("kysely").ExpressionWrapper<KernelDatabase, "conversations", import("kysely").SqlBool>;
|
|
11
13
|
/**
|
|
@@ -12,10 +12,32 @@ import { sql } from "kysely";
|
|
|
12
12
|
import { visibleTo } from "../agents/agent-lookup.js";
|
|
13
13
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* The root of a sub-agent conversation's tree, as a correlated scalar subquery: walks
|
|
16
|
+
* `parent_conversation_id` up from the conversation's parent through sub-agent conversations of
|
|
17
|
+
* the same org (at most 16 levels, far above `subagents.maxDepth`'s bound of 5) to the first
|
|
18
|
+
* conversation without a parent. Null when the chain leaves the org, passes a conversation of
|
|
19
|
+
* another kind or does not end.
|
|
20
|
+
*/
|
|
21
|
+
const rootOfParent = () => sql `(
|
|
22
|
+
WITH RECURSIVE up(id, parent, kind, n) AS (
|
|
23
|
+
SELECT c.id, c.parent_conversation_id, c.kind, 0 FROM capybara.conversations c
|
|
24
|
+
WHERE c.id = ${sql.ref("conversations.parent_conversation_id")}
|
|
25
|
+
AND c.org_id = ${sql.ref("conversations.org_id")}
|
|
26
|
+
UNION ALL
|
|
27
|
+
SELECT c.id, c.parent_conversation_id, c.kind, up.n + 1
|
|
28
|
+
FROM capybara.conversations c JOIN up ON c.id = up.parent
|
|
29
|
+
WHERE up.kind = 'subagent' AND up.n < 16
|
|
30
|
+
AND c.org_id = ${sql.ref("conversations.org_id")}
|
|
31
|
+
)
|
|
32
|
+
SELECT id FROM up WHERE parent IS NULL LIMIT 1
|
|
33
|
+
)`;
|
|
34
|
+
/**
|
|
35
|
+
* A sub-agent's conversation is reached through the root of its tree (sub-agents spec §6.1,
|
|
36
|
+
* review m6, the same rule as its trajectory; agent map spec §4.1: nested sub-agents at any
|
|
37
|
+
* depth): the root is a chat conversation of the same org and owner whose agent is not deleted
|
|
38
|
+
* and still visible to the viewer, and every conversation between is a sub-agent conversation of
|
|
39
|
+
* that org. Any other kind passes. The child's own `agent_id` (the dispatched agent for an org
|
|
40
|
+
* agent, §5.5) is checked on top by the callers.
|
|
19
41
|
*/
|
|
20
42
|
export const parentReachable = (viewerAccountId) => (eb) => eb.or([
|
|
21
43
|
eb("conversations.kind", "<>", "subagent"),
|
|
@@ -23,10 +45,11 @@ export const parentReachable = (viewerAccountId) => (eb) => eb.or([
|
|
|
23
45
|
.selectFrom("conversations as p")
|
|
24
46
|
.innerJoin("agents", "agents.id", "p.agent_id")
|
|
25
47
|
.select(sql `1`.as("one"))
|
|
26
|
-
.
|
|
48
|
+
.where("p.id", "=", rootOfParent())
|
|
27
49
|
.whereRef("p.org_id", "=", "conversations.org_id")
|
|
28
50
|
.where("p.account_id", "=", viewerAccountId)
|
|
29
51
|
.where("p.kind", "=", "chat")
|
|
52
|
+
.where("p.deleted_at", "is", null)
|
|
30
53
|
.where("agents.deleted_at", "is", null)
|
|
31
54
|
.where(visibleTo(viewerAccountId))),
|
|
32
55
|
]);
|
|
@@ -53,6 +76,7 @@ let ConversationAccess = class ConversationAccess {
|
|
|
53
76
|
.where("conversations.id", "=", conversationId)
|
|
54
77
|
.where("conversations.org_id", "=", orgId)
|
|
55
78
|
.where("conversations.account_id", "=", viewerAccountId)
|
|
79
|
+
.where("conversations.deleted_at", "is", null)
|
|
56
80
|
.where("conversations.kind", "in", ["chat", "subagent"])
|
|
57
81
|
.where(parentReachable(viewerAccountId))
|
|
58
82
|
.where((eb) => eb.and([
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { KernelSchemaDb } from "../db/kernel-schema.js";
|
|
2
|
+
/**
|
|
3
|
+
* One agent of a conversation tree as the agent map shows it (agent map spec §8, §9.2): the root
|
|
4
|
+
* conversation or a sub-agent at any depth.
|
|
5
|
+
*/
|
|
6
|
+
export interface AgentTreeNode {
|
|
7
|
+
/** The conversation's id (a sub-agent's is its child conversation's). */
|
|
8
|
+
id: string;
|
|
9
|
+
/** A sub-agent's dispatched description; the root's title ("" before it has one). */
|
|
10
|
+
description: string;
|
|
11
|
+
/**
|
|
12
|
+
* The sub-agent type (`conversations.subagent_type`, set at the first dispatch); null for the
|
|
13
|
+
* root, and for a sub-agent row that has none (the column is nullable; no sentinel is invented).
|
|
14
|
+
*/
|
|
15
|
+
agentType: string | null;
|
|
16
|
+
/**
|
|
17
|
+
* The latest run's status; `idle` when no run is active and the latest run completed (or the
|
|
18
|
+
* conversation has no run yet).
|
|
19
|
+
*/
|
|
20
|
+
status: "queued" | "running" | "waiting" | "completed" | "failed" | "aborted" | "idle";
|
|
21
|
+
/** The model of the latest run (a queued sub-agent's: the dispatched one); null when unknown. */
|
|
22
|
+
model: {
|
|
23
|
+
provider: string;
|
|
24
|
+
model: string;
|
|
25
|
+
} | null;
|
|
26
|
+
/** The first run's start; null until a run started. */
|
|
27
|
+
startedAt: string | null;
|
|
28
|
+
/** The latest run's end; null while a run is active or before any run ended. */
|
|
29
|
+
finishedAt: string | null;
|
|
30
|
+
/** The wall time of the conversation's own runs, summed (a running run up to now). */
|
|
31
|
+
durationMs: number;
|
|
32
|
+
/** The tokens of the conversation's own runs (`usage` events with a run; never descendants'). */
|
|
33
|
+
tokens: number;
|
|
34
|
+
/** The tool calls of the conversation's own runs (its `tool_result` events). */
|
|
35
|
+
toolCalls: number;
|
|
36
|
+
/** The sub-agents it dispatched, oldest first. */
|
|
37
|
+
children: AgentTreeNode[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The agent tree of the root conversation `rootId` of org `orgId`: null when it is not a root
|
|
41
|
+
* chat conversation of that org. The tree's ids come from {@link conversationTree} (one recursive
|
|
42
|
+
* query); one more query reads every node's numbers. A deleted conversation, and a sub-agent
|
|
43
|
+
* conversation without a dispatch row, is left out with its subtree. Call only after an access
|
|
44
|
+
* check of the root.
|
|
45
|
+
*/
|
|
46
|
+
export declare function readAgentTree(db: KernelSchemaDb, orgId: string, rootId: string): Promise<AgentTreeNode | null>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { sql } from "kysely";
|
|
2
|
+
import { conversationTree } from "./tree.js";
|
|
3
|
+
const ACTIVE = new Set(["queued", "running", "waiting"]);
|
|
4
|
+
/**
|
|
5
|
+
* The agent tree of the root conversation `rootId` of org `orgId`: null when it is not a root
|
|
6
|
+
* chat conversation of that org. The tree's ids come from {@link conversationTree} (one recursive
|
|
7
|
+
* query); one more query reads every node's numbers. A deleted conversation, and a sub-agent
|
|
8
|
+
* conversation without a dispatch row, is left out with its subtree. Call only after an access
|
|
9
|
+
* check of the root.
|
|
10
|
+
*/
|
|
11
|
+
export async function readAgentTree(db, orgId, rootId) {
|
|
12
|
+
const ids = (await conversationTree(db, rootId)).map((t) => t.id);
|
|
13
|
+
if (ids.length === 0)
|
|
14
|
+
return null;
|
|
15
|
+
const { rows } = await sql `
|
|
16
|
+
SELECT c.id, c.parent_conversation_id, c.subagent_type, c.title,
|
|
17
|
+
(SELECT e.payload->>'description' FROM capybara.conversation_events e
|
|
18
|
+
WHERE e.conversation_id = c.parent_conversation_id AND e.type = 'subagent_dispatched'
|
|
19
|
+
AND e.payload->>'subagentId' = c.id
|
|
20
|
+
ORDER BY e.seq DESC LIMIT 1) AS description,
|
|
21
|
+
(SELECT e.payload->'model' FROM capybara.conversation_events e
|
|
22
|
+
WHERE e.conversation_id = c.parent_conversation_id AND e.type = 'subagent_dispatched'
|
|
23
|
+
AND e.payload->>'subagentId' = c.id
|
|
24
|
+
ORDER BY e.seq DESC LIMIT 1) AS dispatched_model,
|
|
25
|
+
(SELECT e.payload->'model' FROM capybara.conversation_events e
|
|
26
|
+
WHERE e.conversation_id = c.id AND e.type = 'run_started'
|
|
27
|
+
ORDER BY e.seq DESC LIMIT 1) AS run_model,
|
|
28
|
+
latest.status AS last_status, latest.finished_at AS last_finished_at,
|
|
29
|
+
runs.started_at, runs.duration_ms,
|
|
30
|
+
(SELECT count(*) FROM capybara.conversation_events e
|
|
31
|
+
WHERE e.conversation_id = c.id AND e.type = 'tool_result') AS tool_calls,
|
|
32
|
+
(SELECT coalesce(sum(
|
|
33
|
+
coalesce((e.payload->>'inputTokens')::bigint, 0)
|
|
34
|
+
+ coalesce((e.payload->>'outputTokens')::bigint, 0)
|
|
35
|
+
+ coalesce((e.payload->>'cacheReadTokens')::bigint, 0)
|
|
36
|
+
+ coalesce((e.payload->>'cacheWriteTokens')::bigint, 0)
|
|
37
|
+
), 0)
|
|
38
|
+
FROM capybara.conversation_events e
|
|
39
|
+
WHERE e.conversation_id = c.id AND e.type = 'usage' AND e.run_id IS NOT NULL) AS tokens
|
|
40
|
+
FROM capybara.conversations c
|
|
41
|
+
LEFT JOIN LATERAL (
|
|
42
|
+
SELECT r.status, r.finished_at FROM capybara.runs r
|
|
43
|
+
WHERE r.conversation_id = c.id
|
|
44
|
+
ORDER BY r.created_at DESC, r.id DESC
|
|
45
|
+
LIMIT 1
|
|
46
|
+
) latest ON true
|
|
47
|
+
CROSS JOIN LATERAL (
|
|
48
|
+
SELECT min(r.started_at) AS started_at,
|
|
49
|
+
coalesce(sum(floor(extract(epoch FROM coalesce(r.finished_at, now()) - r.started_at) * 1000))
|
|
50
|
+
FILTER (WHERE r.started_at IS NOT NULL), 0)::bigint AS duration_ms
|
|
51
|
+
FROM capybara.runs r WHERE r.conversation_id = c.id
|
|
52
|
+
) runs
|
|
53
|
+
WHERE c.id IN (${sql.join(ids)}) AND c.org_id = ${orgId} AND c.deleted_at IS NULL
|
|
54
|
+
AND (
|
|
55
|
+
(c.id = ${rootId} AND c.kind = 'chat' AND c.parent_conversation_id IS NULL)
|
|
56
|
+
OR (c.id <> ${rootId} AND c.kind = 'subagent' AND EXISTS (
|
|
57
|
+
SELECT 1 FROM capybara.subagent_dispatches sd WHERE sd.child_conversation_id = c.id
|
|
58
|
+
))
|
|
59
|
+
)
|
|
60
|
+
ORDER BY c.created_at, c.id
|
|
61
|
+
`.execute(db);
|
|
62
|
+
const nodes = new Map();
|
|
63
|
+
for (const r of rows)
|
|
64
|
+
nodes.set(r.id, toNode(r, r.id === rootId));
|
|
65
|
+
for (const r of rows) {
|
|
66
|
+
if (r.id === rootId || r.parent_conversation_id === null)
|
|
67
|
+
continue;
|
|
68
|
+
const node = nodes.get(r.id);
|
|
69
|
+
const parent = nodes.get(r.parent_conversation_id);
|
|
70
|
+
if (node && parent)
|
|
71
|
+
parent.children.push(node);
|
|
72
|
+
}
|
|
73
|
+
return nodes.get(rootId) ?? null;
|
|
74
|
+
}
|
|
75
|
+
function toNode(r, isRoot) {
|
|
76
|
+
const active = r.last_status !== null && ACTIVE.has(r.last_status);
|
|
77
|
+
const status = r.last_status === null || r.last_status === "completed" ? "idle" : r.last_status;
|
|
78
|
+
return {
|
|
79
|
+
id: r.id,
|
|
80
|
+
description: (isRoot ? r.title : (r.description ?? r.title)) ?? "",
|
|
81
|
+
agentType: isRoot ? null : r.subagent_type,
|
|
82
|
+
status,
|
|
83
|
+
model: modelOf(r.run_model ?? r.dispatched_model),
|
|
84
|
+
startedAt: r.started_at?.toISOString() ?? null,
|
|
85
|
+
finishedAt: active ? null : (r.last_finished_at?.toISOString() ?? null),
|
|
86
|
+
durationMs: Number(r.duration_ms),
|
|
87
|
+
tokens: Number(r.tokens),
|
|
88
|
+
toolCalls: Number(r.tool_calls),
|
|
89
|
+
children: [],
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
const modelOf = (m) => m ? { provider: m.provider, model: m.model } : null;
|
|
@@ -28,6 +28,16 @@ export declare const MAX_PENDING_SKILL_PACKAGES = 5;
|
|
|
28
28
|
* `POST /skills` 开始处理时再顺延这么久,处理期间不会被清理。
|
|
29
29
|
*/
|
|
30
30
|
export declare const SKILL_PACKAGE_TTL_HOURS = 1;
|
|
31
|
+
/** The image types an agent avatar upload may have (cropped square in the browser). */
|
|
32
|
+
export declare const AGENT_AVATAR_CONTENT_TYPES: readonly ["image/png", "image/jpeg", "image/webp"];
|
|
33
|
+
/** The size limit of an agent avatar upload (bytes). */
|
|
34
|
+
export declare const AGENT_AVATAR_MAX_BYTES: number;
|
|
35
|
+
/** Unfinished avatar uploads one account may have in an org (counted apart from other uploads). */
|
|
36
|
+
export declare const MAX_PENDING_AGENT_AVATARS = 10;
|
|
37
|
+
/** An avatar upload not saved into a profile expires (and is cleaned up) after this many hours. */
|
|
38
|
+
export declare const AGENT_AVATAR_TTL_HOURS = 24;
|
|
39
|
+
/** Download redirect lifetime of an avatar (seconds); also its `Cache-Control` max-age. */
|
|
40
|
+
export declare const AGENT_AVATAR_DOWNLOAD_TTL_SECONDS = 300;
|
|
31
41
|
/**
|
|
32
42
|
* 技能包解出的文件在 `kernel/<orgId>/` 下的前缀:按上传 id,同一上传重试写到同一批键(幂等),
|
|
33
43
|
* 并发处理同一上传也不会互相覆盖出不同内容。版本行记下这个前缀(`skill_versions.object_prefix`)。
|
|
@@ -169,6 +179,26 @@ export declare class AttachmentsService {
|
|
|
169
179
|
* 不是该账号的 ready 技能包(如已被并发的请求用掉)→ `attachment.not_found`。
|
|
170
180
|
*/
|
|
171
181
|
consumeSkillPackage(orgId: string, accountId: string, id: string): Promise<void>;
|
|
182
|
+
/**
|
|
183
|
+
* Makes an agent avatar upload ready to be saved into a profile (outside any transaction: it may
|
|
184
|
+
* read the object store): only the uploader, only the `agent-avatar` purpose, an image type, not
|
|
185
|
+
* expired and not yet used by another agent, else `attachment.not_found`. An upload still
|
|
186
|
+
* `pending` is finalized first (size, type and the image signature are checked). The expiry is
|
|
187
|
+
* extended so the cleanup job cannot delete it before {@link consumeAgentAvatar} runs.
|
|
188
|
+
*/
|
|
189
|
+
prepareAgentAvatar(orgId: string, accountId: string, id: string, agentId: string): Promise<void>;
|
|
190
|
+
/**
|
|
191
|
+
* In the caller's transaction, binds a ready avatar upload to `agentId` (row lock; the expiry is
|
|
192
|
+
* cleared, so the cleanup job keeps it while the profile uses it). An upload another agent
|
|
193
|
+
* already uses, or one that is not the account's ready avatar → `attachment.not_found`; saving
|
|
194
|
+
* the same upload to the same agent again is fine.
|
|
195
|
+
*/
|
|
196
|
+
consumeAgentAvatar(orgId: string, accountId: string, id: string, agentId: string): Promise<void>;
|
|
197
|
+
/**
|
|
198
|
+
* A short-lived presigned GET (inline, with the checked image type) of the avatar upload bound
|
|
199
|
+
* to `agentId`; `null` when there is none or its object is gone or no longer the finalized one.
|
|
200
|
+
*/
|
|
201
|
+
agentAvatarUrl(orgId: string, agentId: string, id: string): Promise<string | null>;
|
|
172
202
|
/**
|
|
173
203
|
* 删除过期(`expires_at < now()`)且从未绑定到会话的附件:先把行认领为 `deleting`(`FOR UPDATE SKIP LOCKED`,
|
|
174
204
|
* 多副本并发时互不重复),再删对象、删行。删对象失败的行保持 `deleting`,下次运行重试。
|