@capybara-hq/kernel 0.1.0-rc.36 → 0.1.0-rc.38
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 +5 -5
- package/dist/admin/admin.module.d.ts +3 -2
- package/dist/admin/admin.module.js +9 -5
- package/dist/admin/audit-log.service.d.ts +51 -0
- package/dist/admin/{platform-audit.service.js → audit-log.service.js} +20 -12
- package/dist/admin/audit.controller.d.ts +18 -6
- package/dist/admin/audit.controller.js +36 -6
- package/dist/admin/audit.schemas.d.ts +9 -1
- package/dist/admin/audit.schemas.js +22 -2
- package/dist/admin/org-network.controller.d.ts +30 -0
- package/dist/admin/org-network.controller.js +77 -0
- package/dist/admin/org-network.schemas.d.ts +16 -0
- package/dist/admin/org-network.schemas.js +27 -0
- package/dist/admin/org-network.service.d.ts +41 -0
- package/dist/admin/org-network.service.js +101 -0
- package/dist/admin/outbox-dead.controller.d.ts +4 -6
- package/dist/admin/outbox-dead.controller.js +9 -6
- package/dist/admin/outbox-dead.schemas.d.ts +16 -0
- package/dist/admin/outbox-dead.schemas.js +25 -1
- package/dist/admin/outbox-dead.service.d.ts +16 -7
- package/dist/admin/outbox-dead.service.js +34 -10
- package/dist/admin/overview.service.d.ts +3 -3
- package/dist/admin/overview.service.js +0 -1
- package/dist/agents/agent-lookup.js +2 -10
- package/dist/agents/agents.service.js +9 -20
- package/dist/agents/definition.d.ts +3 -51
- package/dist/agents/definition.js +4 -254
- package/dist/agents/org-templates.js +2 -6
- package/dist/agents/readiness.controller.d.ts +4 -12
- package/dist/agents/readiness.controller.js +4 -12
- package/dist/agents/readiness.service.d.ts +23 -11
- package/dist/agents/readiness.service.js +31 -14
- package/dist/agents/templates.d.ts +0 -6
- package/dist/agents/templates.js +8 -34
- package/dist/background/store.d.ts +2 -0
- package/dist/background/store.js +3 -1
- package/dist/background/wake-rules.js +2 -1
- package/dist/catalog/admin-catalog.controller.d.ts +1 -2
- package/dist/catalog/admin-catalog.controller.js +1 -2
- package/dist/catalog/appearance.service.js +1 -3
- package/dist/catalog/catalog-content.d.ts +1 -1
- package/dist/catalog/catalog-content.js +1 -4
- package/dist/catalog/catalog-items.js +3 -3
- package/dist/catalog/catalog-scope.service.d.ts +10 -28
- package/dist/catalog/catalog-scope.service.js +22 -73
- package/dist/catalog/cli.d.ts +0 -11
- package/dist/catalog/cli.js +0 -20
- package/dist/catalog/component-scope.service.js +0 -2
- package/dist/catalog/component-state.js +2 -2
- package/dist/catalog/install-status.d.ts +6 -0
- package/dist/catalog/install-status.js +6 -0
- package/dist/catalog/job-ids.d.ts +0 -4
- package/dist/catalog/job-ids.js +0 -4
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/org-catalog.service.d.ts +2 -0
- package/dist/catalog/org-catalog.service.js +8 -3
- package/dist/catalog/org-extension-switch.d.ts +7 -2
- package/dist/catalog/org-extension-switch.js +56 -9
- package/dist/catalog/org-plugin-uploads.d.ts +6 -15
- package/dist/catalog/org-plugin-uploads.js +9 -27
- package/dist/catalog/owned-items.js +1 -3
- package/dist/catalog/platform-import-update.js +1 -1
- package/dist/catalog/plugin-import.d.ts +15 -13
- package/dist/catalog/plugin-import.js +21 -30
- package/dist/catalog/plugin-install.d.ts +3 -43
- package/dist/catalog/plugin-install.js +8 -150
- package/dist/catalog/plugin-package.d.ts +5 -10
- package/dist/catalog/plugin-package.js +12 -33
- package/dist/catalog/plugin-upgrade.js +5 -4
- package/dist/catalog/scope-jobs.d.ts +34 -34
- package/dist/catalog/scope-jobs.js +50 -37
- package/dist/catalog/scope-orgs.d.ts +1 -1
- package/dist/catalog/scope-orgs.js +1 -2
- package/dist/catalog/scope-sync-workers.d.ts +4 -3
- package/dist/catalog/scope-sync-workers.js +18 -6
- package/dist/catalog/scope-sync.d.ts +56 -59
- package/dist/catalog/scope-sync.js +96 -166
- package/dist/catalog/unshare.d.ts +3 -4
- package/dist/catalog/unshare.js +5 -8
- package/dist/channels/job-ids.d.ts +2 -6
- package/dist/channels/job-ids.js +2 -6
- package/dist/channels/outbound.d.ts +1 -1
- package/dist/channels/outbound.js +1 -1
- package/dist/channels/supervisor.d.ts +2 -3
- package/dist/channels/supervisor.js +2 -3
- package/dist/client/client-access.service.js +1 -1
- package/dist/config/env.js +19 -1
- package/dist/config/load.d.ts +0 -6
- package/dist/config/load.js +8 -27
- package/dist/config/schema.d.ts +54 -47
- package/dist/config/schema.js +198 -42
- package/dist/conversations/attachments.service.d.ts +10 -3
- package/dist/conversations/attachments.service.js +49 -16
- package/dist/conversations/conversations.controller.d.ts +0 -39
- package/dist/conversations/conversations.controller.js +0 -39
- package/dist/conversations/event-log.js +4 -1
- package/dist/conversations/events.d.ts +71 -46
- package/dist/conversations/events.js +124 -112
- package/dist/conversations/media-types.d.ts +25 -0
- package/dist/conversations/media-types.js +38 -0
- package/dist/conversations/queue.d.ts +3 -1
- package/dist/conversations/queue.service.js +9 -2
- package/dist/conversations/titles.js +6 -0
- package/dist/ctx/create-ctx.d.ts +8 -1
- package/dist/ctx/create-ctx.js +13 -3
- package/dist/ctx/net.d.ts +50 -0
- package/dist/ctx/net.js +67 -0
- package/dist/ctx/secrets.d.ts +24 -7
- package/dist/ctx/secrets.js +97 -30
- package/dist/db/kernel-schema.d.ts +27 -6
- package/dist/devices/devices.service.js +2 -1
- package/dist/errors.d.ts +10 -2
- package/dist/errors.js +10 -2
- package/dist/evals/reconstruct.d.ts +4 -17
- package/dist/evals/reconstruct.js +13 -53
- package/dist/evals/recorded-tools.d.ts +0 -27
- package/dist/evals/recorded-tools.js +2 -92
- package/dist/evals/run-replay.d.ts +1 -6
- package/dist/evals/run-replay.js +10 -17
- package/dist/evals/sets.service.d.ts +17 -5
- package/dist/evals/sets.service.js +33 -12
- package/dist/evals/snapshot.d.ts +1 -2
- package/dist/evals/snapshot.js +4 -17
- package/dist/extensions/admin-ops.d.ts +6 -1
- package/dist/extensions/admin-ops.js +17 -4
- package/dist/extensions/admin-view.d.ts +7 -4
- package/dist/extensions/admin-view.js +27 -21
- package/dist/extensions/bootstrap.js +0 -1
- package/dist/extensions/cli.js +0 -1
- package/dist/extensions/extensions.module.js +3 -0
- package/dist/extensions/host.d.ts +9 -4
- package/dist/extensions/host.js +14 -8
- package/dist/extensions/installs.d.ts +1 -3
- package/dist/extensions/instance.d.ts +0 -2
- package/dist/extensions/instance.js +0 -3
- package/dist/extensions/org-config.d.ts +4 -4
- package/dist/extensions/org-config.js +13 -22
- package/dist/extensions/package.d.ts +6 -6
- package/dist/extensions/package.js +3 -7
- package/dist/extensions/permission-view.d.ts +2 -4
- package/dist/extensions/plugin-items.d.ts +21 -1
- package/dist/extensions/plugin-items.js +28 -0
- package/dist/extensions/sync.js +5 -10
- package/dist/extensions/unavailable.js +0 -1
- package/dist/http/api.module.js +4 -1
- package/dist/identity/audit.d.ts +0 -12
- package/dist/identity/audit.js +0 -27
- package/dist/identity/auth.controller.js +5 -9
- package/dist/identity/cookies.d.ts +4 -9
- package/dist/identity/cookies.js +8 -32
- package/dist/identity/initial-passwords.d.ts +1 -1
- package/dist/identity/initial-passwords.js +1 -2
- package/dist/identity/sessions.d.ts +0 -6
- package/dist/identity/sessions.js +0 -18
- package/dist/inbox/platform-inbox.service.d.ts +33 -1
- package/dist/inbox/platform-inbox.service.js +56 -6
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/infra/cli/master-key-rewrap.d.ts +15 -0
- package/dist/infra/cli/master-key-rewrap.js +24 -0
- package/dist/infra/config/kernel-config.service.js +0 -17
- package/dist/infra/database/transaction-host.d.ts +32 -1
- package/dist/infra/database/transaction-host.js +30 -4
- package/dist/infra/database/xact-lock.d.ts +16 -0
- package/dist/infra/database/xact-lock.js +28 -1
- package/dist/infra/health/health.controller.js +8 -0
- package/dist/infra/health/process-fault.d.ts +16 -0
- package/dist/infra/health/process-fault.js +49 -0
- package/dist/infra/lifecycle/process-guards.d.ts +8 -2
- package/dist/infra/lifecycle/process-guards.js +12 -3
- package/dist/infra/lifecycle/shutdown-signals.d.ts +10 -1
- package/dist/infra/lifecycle/shutdown-signals.js +28 -13
- package/dist/infra/outbox/outbox.service.d.ts +12 -9
- package/dist/infra/outbox/outbox.service.js +22 -26
- package/dist/infra/outbox/registry.d.ts +15 -7
- package/dist/infra/outbox/registry.js +39 -23
- package/dist/lifecycle/kernel-lifecycle.js +1 -7
- package/dist/models/enablement.d.ts +5 -6
- package/dist/models/enablement.js +7 -14
- package/dist/net/public-address.d.ts +21 -1
- package/dist/net/public-address.js +56 -10
- package/dist/net/safe-fetch.d.ts +4 -1
- package/dist/net/safe-fetch.js +15 -4
- package/dist/orgs/directory-sync.js +2 -0
- package/dist/orgs/members.service.js +5 -0
- package/dist/orgs/network-allowances.service.d.ts +79 -0
- package/dist/orgs/network-allowances.service.js +371 -0
- package/dist/orgs/offboarding.d.ts +3 -1
- package/dist/orgs/offboarding.js +9 -2
- package/dist/orgs/org-lock.d.ts +28 -2
- package/dist/orgs/org-lock.js +59 -4
- package/dist/orgs/orgs.controller.d.ts +11 -2
- package/dist/orgs/orgs.controller.js +19 -3
- package/dist/orgs/orgs.module.d.ts +3 -2
- package/dist/orgs/orgs.module.js +6 -2
- package/dist/orgs/orgs.schemas.d.ts +12 -0
- package/dist/orgs/orgs.schemas.js +5 -0
- package/dist/orgs/orgs.service.js +6 -1
- package/dist/orgs/settings.controller.d.ts +3 -2
- package/dist/orgs/settings.service.d.ts +59 -14
- package/dist/orgs/settings.service.js +102 -20
- package/dist/overrides.d.ts +7 -7
- package/dist/overrides.js +4 -4
- package/dist/packages/tgz.d.ts +0 -2
- package/dist/packages/tgz.js +0 -2
- package/dist/platform/exclusions.js +0 -5
- package/dist/platform/operation.js +1 -1
- package/dist/platform/ops/admin.ops.d.ts +2 -2
- package/dist/platform/ops/admin.ops.js +9 -6
- package/dist/platform/ops/agents.ops.js +1 -1
- package/dist/platform/ops/connectors.ops.js +46 -1
- package/dist/platform/ops/evals.ops.js +1 -64
- package/dist/platform/ops/extensions-admin.ops.js +1 -1
- package/dist/platform/ops/inbox.ops.js +16 -3
- package/dist/platform/ops/org-plugins.ops.js +1 -1
- package/dist/platform/ops/orgs.ops.d.ts +11 -3
- package/dist/platform/ops/orgs.ops.js +139 -5
- package/dist/platform/ops/outbox.ops.js +5 -5
- package/dist/platform/route-schemas.js +3 -0
- package/dist/roles/worker-role.d.ts +2 -3
- package/dist/roles/worker-role.js +3 -13
- package/dist/runtime/checkpointer.d.ts +3 -0
- package/dist/runtime/checkpointer.js +7 -4
- package/dist/runtime/context/build.d.ts +56 -18
- package/dist/runtime/context/build.js +143 -50
- package/dist/runtime/context/compaction.d.ts +1 -3
- package/dist/runtime/context/compaction.js +42 -8
- package/dist/runtime/context/run-context.js +1 -2
- package/dist/runtime/context/skills.d.ts +27 -56
- package/dist/runtime/context/skills.js +42 -114
- package/dist/runtime/context/tool-changes.d.ts +3 -3
- package/dist/runtime/context/tool-changes.js +6 -16
- package/dist/runtime/hook-calls.d.ts +6 -6
- package/dist/runtime/hook-calls.js +7 -7
- package/dist/runtime/langgraph-loop.js +9 -3
- package/dist/runtime/maintenance.d.ts +3 -11
- package/dist/runtime/maintenance.js +5 -20
- package/dist/runtime/model-call.d.ts +5 -0
- package/dist/runtime/model-call.js +48 -36
- package/dist/runtime/providers.d.ts +33 -35
- package/dist/runtime/providers.js +64 -109
- package/dist/runtime/run-context.service.js +7 -22
- package/dist/runtime/run-deletion.d.ts +6 -0
- package/dist/runtime/run-deletion.js +39 -16
- package/dist/runtime/run-execution.d.ts +56 -3
- package/dist/runtime/run-execution.js +81 -11
- package/dist/runtime/run-finish.js +2 -1
- package/dist/runtime/run-liveness.d.ts +11 -0
- package/dist/runtime/run-liveness.js +19 -0
- package/dist/runtime/run-orphan-check.job.js +2 -1
- package/dist/runtime/run-queue.js +8 -16
- package/dist/runtime/run-worker.d.ts +2 -2
- package/dist/runtime/run-worker.js +8 -6
- package/dist/runtime/step-log.d.ts +5 -0
- package/dist/runtime/step-log.js +9 -4
- package/dist/runtime/subagents/definition.d.ts +16 -20
- package/dist/runtime/subagents/definition.js +27 -27
- package/dist/runtime/subagents/dispatch.d.ts +6 -2
- package/dist/runtime/subagents/dispatch.js +17 -3
- package/dist/runtime/subagents/org-agents.js +1 -2
- package/dist/runtime/subagents/preamble.d.ts +3 -2
- package/dist/runtime/subagents/preamble.js +3 -2
- package/dist/runtime/subagents/render.d.ts +1 -2
- package/dist/runtime/subagents/render.js +1 -2
- package/dist/runtime/subagents/skill-fork.d.ts +2 -4
- package/dist/runtime/subagents/template-skills.d.ts +47 -0
- package/dist/runtime/subagents/template-skills.js +76 -0
- package/dist/runtime/waits.js +3 -1
- package/dist/schedules/effective-settings.d.ts +9 -3
- package/dist/schedules/effective-settings.js +5 -4
- package/dist/schedules/fire.js +11 -0
- package/dist/schedules/scheduled-tasks.service.js +5 -0
- package/dist/schedules/unattended.d.ts +2 -0
- package/dist/schedules/unattended.js +6 -1
- package/dist/skills/agent-skills.service.js +1 -2
- package/dist/skills/catalog.d.ts +1 -3
- package/dist/skills/catalog.js +1 -3
- package/dist/skills/conversation-catalog.d.ts +1 -2
- package/dist/skills/conversation-catalog.js +1 -2
- package/dist/skills/usable.js +2 -3
- package/dist/storage/storage.service.js +9 -1
- package/dist/tools/approvals.service.js +2 -4
- package/dist/tools/builtin-names.d.ts +2 -9
- package/dist/tools/builtin-names.js +4 -13
- package/dist/tools/builtins/sandbox/bash.js +3 -3
- package/dist/tools/builtins/sandbox/common.d.ts +7 -13
- package/dist/tools/builtins/sandbox/common.js +8 -115
- package/dist/tools/builtins/sandbox/fetch-attachment.d.ts +10 -0
- package/dist/tools/builtins/sandbox/fetch-attachment.js +119 -0
- package/dist/tools/builtins/sandbox/glob.js +1 -3
- package/dist/tools/builtins/sandbox/grep.js +3 -5
- package/dist/tools/builtins/sandbox/index.d.ts +8 -5
- package/dist/tools/builtins/sandbox/index.js +10 -5
- package/dist/tools/builtins/sandbox/read.js +3 -2
- package/dist/tools/builtins/tool-search.d.ts +4 -7
- package/dist/tools/builtins/tool-search.js +6 -10
- package/dist/tools/connector-account-policies.d.ts +30 -3
- package/dist/tools/connector-account-policies.js +54 -7
- package/dist/tools/connector-content.js +1 -0
- package/dist/tools/connectors.controller.d.ts +24 -11
- package/dist/tools/connectors.controller.js +35 -6
- package/dist/tools/connectors.schemas.d.ts +14 -1
- package/dist/tools/connectors.schemas.js +14 -2
- package/dist/tools/connectors.service.d.ts +22 -0
- package/dist/tools/connectors.service.js +65 -6
- package/dist/tools/drift.d.ts +6 -2
- package/dist/tools/drift.js +10 -5
- package/dist/tools/git-push-policy.d.ts +4 -1
- package/dist/tools/git-push-policy.js +3 -1
- package/dist/tools/info.d.ts +1 -7
- package/dist/tools/info.js +5 -18
- package/dist/tools/job-ids.d.ts +0 -4
- package/dist/tools/job-ids.js +1 -6
- package/dist/tools/pipeline.d.ts +4 -10
- package/dist/tools/pipeline.js +17 -62
- package/dist/tools/policy.d.ts +6 -2
- package/dist/tools/policy.js +14 -12
- package/dist/tools/registry.js +1 -5
- package/dist/ui/views.d.ts +5 -5
- package/dist/ui/views.js +10 -16
- package/package.json +3 -3
- package/src/migrations/0137_audit_org_idx.sql +5 -0
- package/src/migrations/0138_plugin_install_status_no_upgrading.sql +18 -0
- package/src/migrations/0139_retire_legacy_forms.sql +183 -0
- package/src/migrations/0140_retire_history_forms.sql +148 -0
- package/src/migrations/0141_install_ledger_promoted_rows.sql +36 -0
- package/src/migrations/0142_backfill_event_fields.sql +74 -0
- package/src/migrations/0143_backfill_model_call_fields.sql +105 -0
- package/src/migrations/0144_retire_frozen_definition_keys.sql +163 -0
- package/src/migrations/0145_org_network_allowances.sql +12 -0
- package/dist/admin/platform-audit.service.d.ts +0 -41
- package/dist/conversations/job-ids.d.ts +0 -6
- package/dist/conversations/job-ids.js +0 -6
- package/dist/extensions/job-ids.d.ts +0 -6
- package/dist/extensions/job-ids.js +0 -6
- package/dist/infra/queue/retired-schedulers.d.ts +0 -7
- package/dist/infra/queue/retired-schedulers.js +0 -9
- package/dist/orgs/job-ids.d.ts +0 -8
- package/dist/orgs/job-ids.js +0 -8
- package/dist/runtime/context/legacy-text.d.ts +0 -22
- package/dist/runtime/context/legacy-text.js +0 -37
- package/dist/runtime/job-ids.d.ts +0 -10
- package/dist/runtime/job-ids.js +0 -10
- package/dist/runtime/retired-schedulers.d.ts +0 -7
- package/dist/runtime/retired-schedulers.js +0 -31
- package/dist/storage/job-ids.d.ts +0 -6
- package/dist/storage/job-ids.js +0 -6
- package/dist/tools/legacy-data.d.ts +0 -34
- package/dist/tools/legacy-data.js +0 -76
- package/dist/tools/legacy-keys.d.ts +0 -51
- package/dist/tools/legacy-keys.js +0 -114
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Annotation, END, START, StateGraph } from "@langchain/langgraph";
|
|
2
2
|
import { MediaCache } from "./media-cache.js";
|
|
3
3
|
import { runFinalWrapUp, runModelStep, } from "./model-call.js";
|
|
4
|
+
import { withExclusiveAdmission } from "./run-execution.js";
|
|
4
5
|
import { budgetRunOf, subagentBudgetUsedUp } from "./subagents/limits.js";
|
|
5
6
|
import { isForkInvocation } from "./subagents/skill-fork.js";
|
|
6
7
|
/**
|
|
@@ -145,6 +146,7 @@ export class LangGraphLoop {
|
|
|
145
146
|
sink: ctx.sink,
|
|
146
147
|
absorbedUpToSeq,
|
|
147
148
|
...(maxSteps !== undefined && { maxSteps }),
|
|
149
|
+
...(ctx.limits.deadline !== undefined && { deadline: ctx.limits.deadline }),
|
|
148
150
|
mediaCache,
|
|
149
151
|
agentId: ctx.agentId,
|
|
150
152
|
accountId: ctx.triggerAccountId,
|
|
@@ -184,7 +186,9 @@ export class LangGraphLoop {
|
|
|
184
186
|
// carries the record too, but a child never dispatches.
|
|
185
187
|
const fork = firstStep && ctx.parent === undefined ? absorbed.find(isForkInvocation) : undefined;
|
|
186
188
|
if (fork !== undefined && deps.skillForks) {
|
|
187
|
-
const
|
|
189
|
+
const skillForks = deps.skillForks;
|
|
190
|
+
// a dispatch, like a tool step: its writes are admitted exclusively (`RunExecution`)
|
|
191
|
+
const r = await withExclusiveAdmission(() => skillForks.advance({ ctx, fork }));
|
|
188
192
|
if (r.kind === "suspend")
|
|
189
193
|
throw new LoopSuspended(r.waitingFor);
|
|
190
194
|
if (r.kind === "aborted") {
|
|
@@ -213,7 +217,9 @@ export class LangGraphLoop {
|
|
|
213
217
|
// 本步的全部工具调用都写下结果后才回到 prepare(不在「已记录调用、未记录结果」之间构建请求)。
|
|
214
218
|
// 某个调用需要等人处理时抛 LoopSuspended(该调用之后的调用留到续跑时处理)。
|
|
215
219
|
const tools = async (s) => {
|
|
216
|
-
|
|
220
|
+
// the tool step's writes are admitted exclusively, whatever they ask for (`RunExecution`):
|
|
221
|
+
// tools take org-level locks after the conversation rows
|
|
222
|
+
const r = await withExclusiveAdmission(() => deps.toolPipeline.runStep({
|
|
217
223
|
orgId: ctx.orgId,
|
|
218
224
|
conversationId: ctx.conversationId,
|
|
219
225
|
runId: ctx.runId,
|
|
@@ -229,7 +235,7 @@ export class LangGraphLoop {
|
|
|
229
235
|
...(ctx.limits.deadline !== undefined && { deadline: ctx.limits.deadline }),
|
|
230
236
|
...(ctx.conversationKind !== undefined && { conversationKind: ctx.conversationKind }),
|
|
231
237
|
...(ctx.parent !== undefined && { parent: ctx.parent }),
|
|
232
|
-
});
|
|
238
|
+
}));
|
|
233
239
|
if (r.kind === "suspended")
|
|
234
240
|
throw new LoopSuspended(r.waitingFor);
|
|
235
241
|
if (ctx.parent !== undefined) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WorkerHost } from "@nestjs/bullmq";
|
|
2
|
-
import type { Job,
|
|
2
|
+
import type { Job, Worker } from "bullmq";
|
|
3
3
|
import { OwnedPluginCleanup } from "../catalog/owned-plugin-cleanup.js";
|
|
4
4
|
import { ScheduledRuns } from "../infra/schedule/scheduled-runs.js";
|
|
5
5
|
import type { KernelLogger } from "../log.js";
|
|
@@ -42,14 +42,7 @@ export declare class MaintenanceProcessor extends WorkerHost<Worker> {
|
|
|
42
42
|
private readonly deviceOps;
|
|
43
43
|
private readonly scheduled;
|
|
44
44
|
private readonly log;
|
|
45
|
-
|
|
46
|
-
constructor(waits: Pick<Waits, "processTimeout" | "childFinished" | "stopChildren" | "stopDescendantsOfStopped" | "stopTree">, sandbox: Pick<SandboxService, "destroyDevice" | "resetFileSystem">, drift: Pick<ToolDrift, "check">, directory: Pick<DirectorySync, "runSyncJob">, deletion: Pick<RunDeletion, "stopOrg" | "stopTree">, offboarding: Pick<Offboarding, "stopRun">, runs: Pick<RunQueue, "ensureRun">, ownedCleanup: Pick<OwnedPluginCleanup, "run">, scheduledTasks: Pick<ScheduledTaskFirer, "fire" | "settle">, deviceOps: Pick<DeviceOpResolver, "resolve">, scheduled: Pick<ScheduledRuns, "runNow">, log: Pick<KernelLogger, "error" | "warn">, queue: Pick<Queue, "removeJobScheduler">);
|
|
47
|
-
/**
|
|
48
|
-
* Removes the retired job schedulers (`RETIRED_SCHEDULER_IDS`, runtime/retired-schedulers.ts): every fixed-period
|
|
49
|
-
* maintenance job is a `@LockedCron` / `@LockedInterval` now. Idempotent; called once when a
|
|
50
|
-
* worker role starts.
|
|
51
|
-
*/
|
|
52
|
-
removeRetiredSchedulers(): Promise<void>;
|
|
45
|
+
constructor(waits: Pick<Waits, "processTimeout" | "childFinished" | "stopChildren" | "stopDescendantsOfStopped" | "stopTree">, sandbox: Pick<SandboxService, "destroyDevice" | "resetFileSystem">, drift: Pick<ToolDrift, "check">, directory: Pick<DirectorySync, "runSyncJob">, deletion: Pick<RunDeletion, "stopOrg" | "stopTree">, offboarding: Pick<Offboarding, "stopRun">, runs: Pick<RunQueue, "ensureRun">, ownedCleanup: Pick<OwnedPluginCleanup, "run">, scheduledTasks: Pick<ScheduledTaskFirer, "fire" | "settle">, deviceOps: Pick<DeviceOpResolver, "resolve">, scheduled: Pick<ScheduledRuns, "runNow">, log: Pick<KernelLogger, "error" | "warn">);
|
|
53
46
|
process(job: Job, token?: string): Promise<void>;
|
|
54
47
|
/** Starts consuming (worker role, after the extensions loaded; built with `autorun: false`). */
|
|
55
48
|
start(): void;
|
|
@@ -60,8 +53,7 @@ export declare class MaintenanceProcessor extends WorkerHost<Worker> {
|
|
|
60
53
|
/**
|
|
61
54
|
* The maintenance queue's consumer: {@link MaintenanceProcessor}. Imported only by the worker role
|
|
62
55
|
* (`WorkerModule`), so other roles get no processor and no BullMQ worker. It never starts by
|
|
63
|
-
* itself: the worker role (`WorkerRole`)
|
|
64
|
-
* extensions loaded.
|
|
56
|
+
* itself: the worker role (`WorkerRole`) starts it after the extensions loaded.
|
|
65
57
|
*/
|
|
66
58
|
export declare class MaintenanceModule {
|
|
67
59
|
}
|
|
@@ -7,14 +7,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
8
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { OnWorkerEvent, WorkerHost } from "@nestjs/bullmq";
|
|
11
11
|
import { Inject, Injectable, Module } from "@nestjs/common";
|
|
12
12
|
import { BG_WAKE_JOB } from "../background/wake-rules.js";
|
|
13
13
|
import { OWNED_PLUGIN_CLEANUP_JOB } from "../catalog/job-ids.js";
|
|
14
14
|
import { OwnedPluginCleanup, OwnedPluginCleanupModule } from "../catalog/owned-plugin-cleanup.js";
|
|
15
15
|
import { configuredProcessor } from "../infra/queue/configured-processor.js";
|
|
16
16
|
import { QueueModule } from "../infra/queue/queue.module.js";
|
|
17
|
-
import { removeRetiredSchedulers } from "../infra/queue/retired-schedulers.js";
|
|
18
17
|
import { runJob } from "../infra/queue/run-job.js";
|
|
19
18
|
import { KernelScheduleModule } from "../infra/schedule/schedule.module.js";
|
|
20
19
|
import { ScheduledRuns } from "../infra/schedule/scheduled-runs.js";
|
|
@@ -33,7 +32,6 @@ import { ToolDrift } from "../tools/drift.js";
|
|
|
33
32
|
import { DRIFT_CONNECTOR_JOB } from "../tools/job-ids.js";
|
|
34
33
|
import { ToolsModule } from "../tools/tools.module.js";
|
|
35
34
|
import { MAINTENANCE_QUEUE_NAME } from "./maintenance-queue.js";
|
|
36
|
-
import { RETIRED_SCHEDULER_IDS } from "./retired-schedulers.js";
|
|
37
35
|
import { RunDeletion, STOP_DELETED_ORG_JOB } from "./run-deletion.js";
|
|
38
36
|
import { ENSURE_RUN_JOB, RunQueue } from "./run-queue.js";
|
|
39
37
|
import { RuntimeModule } from "./runtime.module.js";
|
|
@@ -69,8 +67,7 @@ let MaintenanceProcessor = class MaintenanceProcessor extends WorkerHost {
|
|
|
69
67
|
deviceOps;
|
|
70
68
|
scheduled;
|
|
71
69
|
log;
|
|
72
|
-
|
|
73
|
-
constructor(waits, sandbox, drift, directory, deletion, offboarding, runs, ownedCleanup, scheduledTasks, deviceOps, scheduled, log, queue) {
|
|
70
|
+
constructor(waits, sandbox, drift, directory, deletion, offboarding, runs, ownedCleanup, scheduledTasks, deviceOps, scheduled, log) {
|
|
74
71
|
super();
|
|
75
72
|
this.waits = waits;
|
|
76
73
|
this.sandbox = sandbox;
|
|
@@ -84,15 +81,6 @@ let MaintenanceProcessor = class MaintenanceProcessor extends WorkerHost {
|
|
|
84
81
|
this.deviceOps = deviceOps;
|
|
85
82
|
this.scheduled = scheduled;
|
|
86
83
|
this.log = log;
|
|
87
|
-
this.queue = queue;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Removes the retired job schedulers (`RETIRED_SCHEDULER_IDS`, runtime/retired-schedulers.ts): every fixed-period
|
|
91
|
-
* maintenance job is a `@LockedCron` / `@LockedInterval` now. Idempotent; called once when a
|
|
92
|
-
* worker role starts.
|
|
93
|
-
*/
|
|
94
|
-
removeRetiredSchedulers() {
|
|
95
|
-
return removeRetiredSchedulers(this.queue, RETIRED_SCHEDULER_IDS);
|
|
96
84
|
}
|
|
97
85
|
process(job, token) {
|
|
98
86
|
return runJob(MAINTENANCE_QUEUE_NAME, job, () => this.dispatch(job, token));
|
|
@@ -180,8 +168,7 @@ let MaintenanceProcessor = class MaintenanceProcessor extends WorkerHost {
|
|
|
180
168
|
return;
|
|
181
169
|
// never completed unrun: in a rolling deploy an old worker meets a job a newer replica
|
|
182
170
|
// owed (its outbox row is gone once added); failing it leaves it to BullMQ's retries, so a
|
|
183
|
-
// newer replica can take it within the job's attempts
|
|
184
|
-
// docs/deploy/upgrade.md)
|
|
171
|
+
// newer replica can take it within the job's attempts
|
|
185
172
|
throw new Error(`unknown maintenance job "${job.name}"`);
|
|
186
173
|
}
|
|
187
174
|
}
|
|
@@ -211,15 +198,13 @@ MaintenanceProcessor = __decorate([
|
|
|
211
198
|
__param(8, Inject(ScheduledTaskFirer)),
|
|
212
199
|
__param(9, Inject(DeviceOpResolver)),
|
|
213
200
|
__param(10, Inject(ScheduledRuns)),
|
|
214
|
-
__param(11, Inject(KERNEL_LOGGER))
|
|
215
|
-
__param(12, Inject(getQueueToken(MAINTENANCE_QUEUE_NAME)))
|
|
201
|
+
__param(11, Inject(KERNEL_LOGGER))
|
|
216
202
|
], MaintenanceProcessor);
|
|
217
203
|
export { MaintenanceProcessor };
|
|
218
204
|
/**
|
|
219
205
|
* The maintenance queue's consumer: {@link MaintenanceProcessor}. Imported only by the worker role
|
|
220
206
|
* (`WorkerModule`), so other roles get no processor and no BullMQ worker. It never starts by
|
|
221
|
-
* itself: the worker role (`WorkerRole`)
|
|
222
|
-
* extensions loaded.
|
|
207
|
+
* itself: the worker role (`WorkerRole`) starts it after the extensions loaded.
|
|
223
208
|
*/
|
|
224
209
|
let MaintenanceModule = class MaintenanceModule {
|
|
225
210
|
};
|
|
@@ -148,6 +148,11 @@ export interface ModelStepInput {
|
|
|
148
148
|
* reminder is sent.
|
|
149
149
|
*/
|
|
150
150
|
maxSteps?: number;
|
|
151
|
+
/**
|
|
152
|
+
* The run's deadline in epoch ms (`LoopContext.limits.deadline`); absent: no deadline. A
|
|
153
|
+
* provider's retry-after is honoured when it fits the time left.
|
|
154
|
+
*/
|
|
155
|
+
deadline?: number;
|
|
151
156
|
}
|
|
152
157
|
export interface ModelStepResult {
|
|
153
158
|
content: ContentBlock[];
|
|
@@ -51,10 +51,25 @@ export const contextTooLargeText = (model, target, estimate) => `The request is
|
|
|
51
51
|
/** 可重试错误在同一模型上重试前的默认等待(供应商未给 retryAfterMs 时)。 */
|
|
52
52
|
const DEFAULT_RETRY_DELAY_MS = 1000;
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
54
|
+
* Longest provider-suggested wait (retryAfterMs) honoured on the same model. With a run deadline
|
|
55
|
+
* the wait must also fit the time the run has left.
|
|
56
56
|
*/
|
|
57
|
-
const MAX_RETRY_AFTER_MS =
|
|
57
|
+
const MAX_RETRY_AFTER_MS = 5 * 60_000;
|
|
58
|
+
/**
|
|
59
|
+
* Whether waiting `retryAfterMs` on the same model is allowed, and which limit decided it:
|
|
60
|
+
* the ceiling, or the run's remaining deadline (absent: no deadline, only the ceiling applies).
|
|
61
|
+
*/
|
|
62
|
+
function retryAfterDecision(retryAfterMs, deadline) {
|
|
63
|
+
const wait = retryAfterMs ?? 0;
|
|
64
|
+
const remainingMs = deadline === undefined ? undefined : deadline - Date.now();
|
|
65
|
+
if (wait > MAX_RETRY_AFTER_MS)
|
|
66
|
+
return { fits: false, limit: "ceiling", remainingMs };
|
|
67
|
+
// the wait must leave time for the retry itself: a wait that ends at the deadline is no wait
|
|
68
|
+
if (remainingMs !== undefined && wait >= remainingMs) {
|
|
69
|
+
return { fits: false, limit: "deadline", remainingMs };
|
|
70
|
+
}
|
|
71
|
+
return { fits: true, limit: remainingMs === undefined ? "ceiling" : "deadline", remainingMs };
|
|
72
|
+
}
|
|
58
73
|
/** 读事件日志的分页大小。 */
|
|
59
74
|
const READ_PAGE = 1000;
|
|
60
75
|
/**
|
|
@@ -492,6 +507,9 @@ export function assembleModelRequest(input) {
|
|
|
492
507
|
tools: input.model.capabilities.tools ? [...tools] : [],
|
|
493
508
|
});
|
|
494
509
|
const { request } = built;
|
|
510
|
+
// the omission is recorded, so readers never infer it from the reminder text
|
|
511
|
+
if (tools.length > 0 && !input.model.capabilities.tools)
|
|
512
|
+
built.meta.toolsOmitted = true;
|
|
495
513
|
request.messages = guardToolPairs(request.messages);
|
|
496
514
|
const knob = request.params.maxOutputTokens;
|
|
497
515
|
request.maxOutputTokens = Math.min(input.model.maxOutputTokens, typeof knob === "number" ? knob : defaultMaxOutputTokens);
|
|
@@ -621,39 +639,25 @@ function consecutiveCompactionFailures(events) {
|
|
|
621
639
|
}
|
|
622
640
|
return n;
|
|
623
641
|
}
|
|
624
|
-
/** The step an event of a run belongs to, when its payload names one. */
|
|
625
|
-
function stepOf(e) {
|
|
626
|
-
const step = e.payload.step;
|
|
627
|
-
return typeof step === "number" ? step : undefined;
|
|
628
|
-
}
|
|
629
642
|
/**
|
|
630
643
|
* The ordinal of the next compaction of this run's `step`: 1 + the `compaction_summary` /
|
|
631
644
|
* `compaction_failed` events the step already wrote (context compaction spec §4.4, revision
|
|
632
645
|
* 2026-11-15). It keys the compaction's events (summary, failure, usage, hook denial), so every
|
|
633
646
|
* compaction of a step writes its own, while a crash-retried compaction (nothing written yet) gets
|
|
634
|
-
* the same keys again.
|
|
635
|
-
* have none: a run's step N compacts after every event of its earlier steps, so those are counted
|
|
636
|
-
* from the run's last event of an earlier step on. The backoff keeps counting consecutive failures
|
|
647
|
+
* the same keys again. The backoff keeps counting consecutive failures
|
|
637
648
|
* ({@link consecutiveCompactionFailures}).
|
|
638
649
|
*/
|
|
639
650
|
function compactionOrdinal(events, runId, step) {
|
|
640
651
|
let recorded = 0;
|
|
641
|
-
let legacy = 0;
|
|
642
652
|
for (const e of events) {
|
|
643
653
|
if (e.runId !== runId)
|
|
644
654
|
continue;
|
|
645
|
-
|
|
646
|
-
if (e.type === "compaction_summary" || e.type === "compaction_failed") {
|
|
647
|
-
if (of === undefined)
|
|
648
|
-
legacy++;
|
|
649
|
-
else if (of === step)
|
|
650
|
-
recorded++;
|
|
655
|
+
if (e.type !== "compaction_summary" && e.type !== "compaction_failed")
|
|
651
656
|
continue;
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
legacy = 0;
|
|
657
|
+
if (e.payload.step === step)
|
|
658
|
+
recorded++;
|
|
655
659
|
}
|
|
656
|
-
return recorded +
|
|
660
|
+
return recorded + 1;
|
|
657
661
|
}
|
|
658
662
|
/** Estimated input tokens of a plain text (a user message's only content). */
|
|
659
663
|
function textTokens(text) {
|
|
@@ -1069,12 +1073,15 @@ async function mergeWritten(eventLog, conversationId, events, written) {
|
|
|
1069
1073
|
return out.sort((a, b) => a.seq - b.seq);
|
|
1070
1074
|
}
|
|
1071
1075
|
/**
|
|
1072
|
-
*
|
|
1073
|
-
*
|
|
1074
|
-
*
|
|
1075
|
-
*
|
|
1076
|
-
*
|
|
1077
|
-
*
|
|
1076
|
+
* The degradation ladder: the main model -> one retry of the main model (waiting
|
|
1077
|
+
* `retryAfterMs ?? 1000`, abortable) -> `agent.fallback` (when set). The same-model retry is
|
|
1078
|
+
* skipped when the suggested wait does not fit the run's remaining time or exceeds
|
|
1079
|
+
* `MAX_RETRY_AFTER_MS`. After each attempt resolves its model and before it writes `model_call`,
|
|
1080
|
+
* the step's trailing reminders are written (each idempotent per step, written once): the model has
|
|
1081
|
+
* no tool support while the step has tools -> {@link TOOLS_UNSUPPORTED_REMINDER}; then the turn
|
|
1082
|
+
* reminder or the wrap-up reminder (which therefore ends the request). Every real attempt writes
|
|
1083
|
+
* its own `model_call` (attempt counts up from 1, skipped ones not counted); a retry first sends
|
|
1084
|
+
* `step_reset` through the sink. A non-retryable failure or an exhausted ladder -> `RunError`; except that the agent's own model failing to resolve as
|
|
1078
1085
|
* `agent.model_unavailable` (gone from the list, disabled since the agent was saved, its provider
|
|
1079
1086
|
* not configured in the org: spec B §5.3) goes straight to `agent.fallback` when there is one,
|
|
1080
1087
|
* without the same-model retry.
|
|
@@ -1109,14 +1116,19 @@ async function ladder(deps, input, events, runtime, compaction, tools, wrapUpRea
|
|
|
1109
1116
|
for (const rung of rungs) {
|
|
1110
1117
|
if ((mainUnavailable || skipToFallback) && !rung.fallback)
|
|
1111
1118
|
continue;
|
|
1112
|
-
if (last && !rung.fallback
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1119
|
+
if (last && !rung.fallback) {
|
|
1120
|
+
const d = retryAfterDecision(last.retryAfterMs, input.deadline);
|
|
1121
|
+
if (!d.fits) {
|
|
1122
|
+
deps.log.warn("model retry skipped: suggested wait exceeds the limit", {
|
|
1123
|
+
conversationId,
|
|
1124
|
+
runId,
|
|
1125
|
+
step,
|
|
1126
|
+
retryAfterMs: last.retryAfterMs,
|
|
1127
|
+
limit: d.limit,
|
|
1128
|
+
...(d.remainingMs !== undefined && { remainingMs: d.remainingMs }),
|
|
1129
|
+
});
|
|
1130
|
+
continue;
|
|
1131
|
+
}
|
|
1120
1132
|
}
|
|
1121
1133
|
// reactive `model.context_overflow` fix-ups, at most one of each per rung (context compaction
|
|
1122
1134
|
// spec §4.4): media exclusion, forced compaction, then a progressive trim
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type EmbedRequest, type EmbedResult, type ExtensionManifest, type ExtensionPointRef, type Logger, type ModelInfo, type ModelKind, type
|
|
1
|
+
import { type EmbedRequest, type EmbedResult, type ExtensionManifest, type ExtensionPointRef, type Logger, type ModelInfo, type ModelKind, type ModelRequest, type ModelStreamEvent } from "@capybara-hq/plugin-sdk";
|
|
2
2
|
import type { Redis } from "ioredis";
|
|
3
3
|
import type { ModelRef } from "../agents/definition.js";
|
|
4
4
|
import { ApiError } from "../errors.js";
|
|
@@ -91,24 +91,15 @@ export declare class ProviderListError extends ApiError {
|
|
|
91
91
|
constructor(provider: string, cause: unknown);
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* an `@1` model is always a chat model: `kind` and `embedding` are dropped (an `@1` provider has
|
|
97
|
-
* no `embed`); the per-call options are not passed (an `@1` provider reads `ctx.config`);
|
|
98
|
-
* - `stream`:`params.effort` 映射为 `req.effort`,其余参数丢弃(`@1` 没有对应字段);
|
|
99
|
-
* 没有 `params.effort` 时保留请求自带的 `effort`;only the signal is passed.
|
|
100
|
-
*/
|
|
101
|
-
export declare function adaptModelProviderV1(impl: ModelProviderV1): ModelProvider;
|
|
102
|
-
/**
|
|
103
|
-
* 模型供应商注册表:供应商即提供 `model-provider` 能力的插件(以插件名为供应商名)。
|
|
104
|
-
* 同时支持 `model-provider@1`(经 {@link adaptModelProviderV1} 适配)与 `@2`;
|
|
105
|
-
* 同一插件两者都提供时用 `@2`。
|
|
94
|
+
* The model provider registry: a provider is an extension that provides `model-provider@2` (the
|
|
95
|
+
* provider's name is the plugin's name).
|
|
106
96
|
*
|
|
107
97
|
* Org-bound (spec B §5.5, A §6): every list and call is made for an org with the provider's
|
|
108
|
-
* effective config there (`EffectiveConfigs.get`), passed as `{ orgId, config }
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
98
|
+
* effective config there (`EffectiveConfigs.get`), passed as `{ orgId, config }`. A provider is on
|
|
99
|
+
* in an org only when the org enabled it, like every other extension (`enabledExtensionsQuery`: the
|
|
100
|
+
* org's switch on, or a required bootstrap plugin); one not enabled there, or whose effective
|
|
101
|
+
* config is not valid there, offers no models there. The admin view (no org) lists with the
|
|
102
|
+
* platform config.
|
|
112
103
|
*
|
|
113
104
|
* Each list is validated per model (spec B §5.1): kinds are normalised (absent = `chat`, unknown =
|
|
114
105
|
* `other`); a chat model failing `assertValidDeclarations`, or an `embedding` model without
|
|
@@ -116,7 +107,7 @@ export declare function adaptModelProviderV1(impl: ModelProviderV1): ModelProvid
|
|
|
116
107
|
* provider stays usable. Only `chat` and `embedding` models resolve.
|
|
117
108
|
*
|
|
118
109
|
* Each list (`@2`-shaped) is cached in Redis (`@Cacheable`, key
|
|
119
|
-
* `cache:capk:models:<provider>:
|
|
110
|
+
* `cache:capk:models:<provider>:f<format>:<plugin version>:<config digest>`, 600 s), never in
|
|
120
111
|
* process memory: every replica shares it. The digest is the platform config's for every org that
|
|
121
112
|
* follows the platform (one shared list), and a per-org digest for an org's own copy.
|
|
122
113
|
*/
|
|
@@ -130,26 +121,30 @@ export declare class ProviderRegistry {
|
|
|
130
121
|
private readonly log?;
|
|
131
122
|
/** Overrides `models.listTimeoutMs` (tests). */
|
|
132
123
|
private readonly listTimeoutOverride?;
|
|
133
|
-
constructor(host: ProviderHost, effective: Pick<EffectiveConfigs, "get">, cacheService: CacheService, kv: Redis, config: Pick<KernelConfigService, "get">, enablement: Pick<ModelEnablement, "disabled" | "
|
|
124
|
+
constructor(host: ProviderHost, effective: Pick<EffectiveConfigs, "get">, cacheService: CacheService, kv: Redis, config: Pick<KernelConfigService, "get">, enablement: Pick<ModelEnablement, "disabled" | "enabledIn">, log?: Pick<Logger, "warn"> | undefined,
|
|
134
125
|
/** Overrides `models.listTimeoutMs` (tests). */
|
|
135
126
|
listTimeoutOverride?: number | undefined);
|
|
136
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* `listModels()` with a time limit: a timeout counts as a failure; the provider's call runs on in
|
|
129
|
+
* the background and its result is dropped.
|
|
130
|
+
*/
|
|
137
131
|
private listModelsWithTimeout;
|
|
138
132
|
/**
|
|
139
|
-
* Whether
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
133
|
+
* Whether a model provider is usable in `orgId` (org readiness, web-order spec §3.8,
|
|
134
|
+
* `ReadinessService`), from extension state, the org's switches and its config only: never calls
|
|
135
|
+
* a vendor, so a provider whose vendor is down still counts. True when a provider loaded on this
|
|
136
|
+
* replica is enabled in `orgId` with a valid effective config there.
|
|
143
137
|
*/
|
|
144
138
|
hasProvider(orgId: string): Promise<boolean>;
|
|
145
|
-
/**
|
|
139
|
+
/** One implementation per plugin, in the order plugins first appear; another major is ignored. */
|
|
146
140
|
private providers;
|
|
147
141
|
/**
|
|
148
142
|
* The call options and list digest of `p` for `orgId`, or for the platform when `orgId` is
|
|
149
143
|
* undefined (the admin view). An org: its effective config (not valid -> `needs_config`); the
|
|
150
144
|
* platform's digest while it follows the platform, a per-org one for its copy. The platform: its
|
|
151
|
-
* own config (a required overridable field left empty -> `org_configured`). `
|
|
152
|
-
* extensions the org
|
|
145
|
+
* own config (a required overridable field left empty -> `org_configured`). `on`: the
|
|
146
|
+
* extensions enabled in the org (`ModelEnablement.enabledIn`); a provider not in it ->
|
|
147
|
+
* `not_enabled`. Unused for the platform.
|
|
153
148
|
*/
|
|
154
149
|
private target;
|
|
155
150
|
private models;
|
|
@@ -175,18 +170,21 @@ export declare class ProviderRegistry {
|
|
|
175
170
|
*/
|
|
176
171
|
catalog(orgId: string): Promise<ProviderStatus[]>;
|
|
177
172
|
/**
|
|
178
|
-
*
|
|
179
|
-
* view when undefined (`/admin/models`: every model, `disabled`
|
|
173
|
+
* Every installed provider with its status (in plugin load order), for `orgId` (the providers it enabled, their enabled
|
|
174
|
+
* models only), or the platform view when undefined (`/admin/models`: every model, `disabled`
|
|
175
|
+
* from the platform's list only).
|
|
180
176
|
* See {@link statuses} for the statuses.
|
|
181
177
|
*/
|
|
182
178
|
listWithStatus(orgId?: string): Promise<ProviderStatus[]>;
|
|
183
179
|
/**
|
|
184
|
-
*
|
|
185
|
-
* `models.listTimeoutMs
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
180
|
+
* Every installed provider's full list and status, for `orgId` or the platform: a provider whose
|
|
181
|
+
* model listing fails (including passing `models.listTimeoutMs`) gets `error` with empty
|
|
182
|
+
* `models` without affecting the others, and is not asked again for
|
|
183
|
+
* {@link LIST_FAILURE_TTL_SECONDS} seconds. For an org only the providers it enabled are
|
|
184
|
+
* listed (one it did not enable is absent); one that needs configuration there gets `error`. The
|
|
185
|
+
* platform view of a provider whose platform config leaves a required overridable field empty
|
|
186
|
+
* gets `org_configured`. `error` is only the kernel's own English message (the upstream error
|
|
187
|
+
* text is never exposed; it goes to a warn log). No disabled list applied.
|
|
190
188
|
*/
|
|
191
189
|
private statuses;
|
|
192
190
|
/**
|