@capybara-hq/kernel 0.1.0-rc.5 → 0.1.0-rc.7
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 +27 -3
- package/dist/admin/admin.controller.d.ts +21 -74
- package/dist/admin/admin.controller.js +50 -50
- package/dist/admin/admin.schemas.d.ts +57 -0
- package/dist/admin/admin.schemas.js +50 -0
- package/dist/admin/extensions.controller.d.ts +10 -0
- package/dist/admin/extensions.controller.js +18 -0
- package/dist/admin/extensions.schemas.d.ts +7 -0
- package/dist/admin/extensions.schemas.js +10 -0
- package/dist/admin/limit-defaults.d.ts +20 -0
- package/dist/admin/limit-defaults.js +10 -0
- package/dist/agents/agent-profile.service.d.ts +7 -5
- package/dist/agents/agent-profile.service.js +14 -9
- package/dist/agents/agents.controller.d.ts +7 -287
- package/dist/agents/agents.controller.js +7 -67
- package/dist/agents/agents.schemas.d.ts +389 -0
- package/dist/agents/agents.schemas.js +126 -0
- package/dist/agents/agents.service.d.ts +16 -6
- package/dist/agents/agents.service.js +75 -19
- package/dist/agents/definition.d.ts +47 -19
- package/dist/agents/definition.js +119 -38
- package/dist/agents/from-template.d.ts +2 -2
- package/dist/agents/from-template.js +76 -45
- package/dist/agents/from-template.service.d.ts +12 -0
- package/dist/agents/from-template.service.js +23 -6
- package/dist/agents/models.controller.d.ts +33 -5
- package/dist/agents/models.controller.js +50 -6
- package/dist/agents/org-templates.d.ts +13 -3
- package/dist/agents/org-templates.js +69 -28
- package/dist/agents/pending-connector-requests.d.ts +2 -0
- package/dist/agents/pending-connector-requests.js +1 -1
- package/dist/agents/pending-connectors.controller.d.ts +1 -1
- package/dist/agents/pending-connectors.controller.js +2 -2
- package/dist/agents/pending-connectors.service.d.ts +2 -2
- package/dist/agents/pending-connectors.service.js +19 -19
- package/dist/agents/profile.d.ts +18 -0
- package/dist/agents/profile.js +5 -1
- package/dist/agents/readiness.controller.d.ts +5 -5
- package/dist/agents/readiness.controller.js +6 -6
- package/dist/agents/templates.controller.d.ts +8 -17
- package/dist/agents/templates.controller.js +13 -31
- package/dist/agents/templates.schemas.d.ts +20 -0
- package/dist/agents/templates.schemas.js +45 -0
- package/dist/background/background.controller.js +3 -2
- package/dist/background/background.schemas.d.ts +10 -0
- package/dist/background/background.schemas.js +16 -0
- package/dist/background/tasks.service.d.ts +1 -1
- package/dist/background/tasks.service.js +7 -2
- package/dist/catalog/admin-catalog.controller.d.ts +4 -57
- package/dist/catalog/admin-catalog.controller.js +8 -45
- package/dist/catalog/admin-catalog.schemas.d.ts +72 -0
- package/dist/catalog/admin-catalog.schemas.js +92 -0
- package/dist/catalog/catalog-content.d.ts +12 -2
- package/dist/catalog/catalog-scope.service.js +8 -2
- package/dist/catalog/catalog.service.d.ts +2 -0
- package/dist/catalog/catalog.service.js +3 -0
- package/dist/catalog/component-scope.controller.d.ts +3 -65
- package/dist/catalog/component-scope.controller.js +3 -56
- package/dist/catalog/component-scope.schemas.d.ts +114 -0
- package/dist/catalog/component-scope.schemas.js +97 -0
- package/dist/catalog/component-scope.service.d.ts +28 -4
- package/dist/catalog/component-scope.service.js +55 -3
- package/dist/catalog/component-state.d.ts +9 -2
- package/dist/catalog/component-state.js +22 -13
- package/dist/catalog/marketplaces.controller.d.ts +5 -35
- package/dist/catalog/marketplaces.controller.js +6 -34
- package/dist/catalog/marketplaces.schemas.d.ts +48 -0
- package/dist/catalog/marketplaces.schemas.js +53 -0
- package/dist/catalog/marketplaces.service.d.ts +15 -1
- package/dist/catalog/marketplaces.service.js +22 -1
- package/dist/catalog/org-catalog.controller.d.ts +6 -62
- package/dist/catalog/org-catalog.controller.js +12 -66
- package/dist/catalog/org-catalog.schemas.d.ts +79 -0
- package/dist/catalog/org-catalog.schemas.js +82 -0
- package/dist/catalog/org-catalog.service.d.ts +9 -2
- package/dist/catalog/org-catalog.service.js +38 -5
- package/dist/catalog/org-extension.controller.d.ts +1 -12
- package/dist/catalog/org-extension.controller.js +1 -10
- package/dist/catalog/org-extension.schemas.d.ts +15 -0
- package/dist/catalog/org-extension.schemas.js +22 -0
- package/dist/catalog/org-plugin-uploads.controller.d.ts +2 -19
- package/dist/catalog/org-plugin-uploads.controller.js +15 -28
- package/dist/catalog/org-plugin-uploads.schemas.d.ts +20 -0
- package/dist/catalog/org-plugin-uploads.schemas.js +32 -0
- package/dist/catalog/owned-items.d.ts +6 -2
- package/dist/catalog/owned-items.js +16 -4
- package/dist/catalog/platform-components.d.ts +2 -0
- package/dist/catalog/platform-components.js +2 -0
- package/dist/catalog/plugin-import.js +1 -0
- package/dist/catalog/plugin-install.js +1 -1
- package/dist/catalog/requests.service.d.ts +2 -1
- package/dist/catalog/requests.service.js +6 -2
- package/dist/channels/channels.schemas.d.ts +33 -0
- package/dist/channels/channels.schemas.js +34 -0
- package/dist/channels/connections.controller.d.ts +2 -29
- package/dist/channels/connections.controller.js +1 -23
- package/dist/channels/connections.service.d.ts +8 -2
- package/dist/channels/connections.service.js +23 -5
- package/dist/channels/inbound.js +4 -0
- package/dist/config/schema.d.ts +4 -0
- package/dist/config/schema.js +24 -0
- package/dist/conversations/conversations.controller.d.ts +16 -37
- package/dist/conversations/conversations.controller.js +16 -56
- package/dist/conversations/conversations.schemas.d.ts +52 -0
- package/dist/conversations/conversations.schemas.js +79 -0
- package/dist/conversations/conversations.service.d.ts +13 -4
- package/dist/conversations/conversations.service.js +32 -26
- package/dist/conversations/events.d.ts +80 -6
- package/dist/conversations/events.js +60 -5
- package/dist/conversations/message-context.d.ts +28 -0
- package/dist/conversations/message-context.js +56 -0
- package/dist/conversations/queue.d.ts +2 -1
- package/dist/conversations/queue.js +11 -2
- package/dist/ctx/create-ctx.d.ts +15 -1
- package/dist/ctx/create-ctx.js +23 -2
- package/dist/db/kernel-schema.d.ts +44 -0
- package/dist/environments/environments.schemas.d.ts +3 -0
- package/dist/environments/environments.schemas.js +14 -0
- package/dist/environments/environments.service.d.ts +16 -4
- package/dist/environments/environments.service.js +58 -13
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +6 -0
- package/dist/evals/evals.schemas.d.ts +110 -0
- package/dist/evals/evals.schemas.js +107 -0
- package/dist/evals/reconstruct.js +18 -11
- package/dist/evals/recorded-tools.d.ts +2 -1
- package/dist/evals/recorded-tools.js +11 -3
- package/dist/evals/run-replay.d.ts +8 -1
- package/dist/evals/run-replay.js +17 -2
- package/dist/evals/runs.controller.d.ts +2 -57
- package/dist/evals/runs.controller.js +1 -42
- package/dist/evals/runs.service.d.ts +8 -7
- package/dist/evals/runs.service.js +45 -30
- package/dist/evals/sets.controller.d.ts +2 -28
- package/dist/evals/sets.controller.js +1 -31
- package/dist/evals/sets.service.d.ts +7 -7
- package/dist/evals/sets.service.js +23 -17
- package/dist/evals/snapshot.d.ts +3 -2
- package/dist/evals/snapshot.js +17 -4
- package/dist/evals/step-replay.d.ts +2 -1
- package/dist/evals/step-replay.js +3 -2
- package/dist/extensions/admin-ops.d.ts +5 -3
- package/dist/extensions/admin-ops.js +17 -12
- package/dist/extensions/config-hash.d.ts +10 -0
- package/dist/extensions/config-hash.js +38 -0
- package/dist/extensions/deployment-config.d.ts +16 -1
- package/dist/extensions/deployment-config.js +83 -0
- package/dist/extensions/extensions.module.js +9 -12
- package/dist/extensions/host.d.ts +39 -12
- package/dist/extensions/host.js +129 -51
- package/dist/extensions/installs.d.ts +5 -0
- package/dist/extensions/installs.js +12 -0
- package/dist/extensions/org-config.d.ts +17 -2
- package/dist/extensions/org-config.js +23 -4
- package/dist/extensions/point-defaults.controller.d.ts +2 -8
- package/dist/extensions/point-defaults.controller.js +1 -3
- package/dist/extensions/point-defaults.d.ts +3 -1
- package/dist/extensions/point-defaults.js +4 -2
- package/dist/extensions/point-defaults.schemas.d.ts +9 -0
- package/dist/extensions/point-defaults.schemas.js +14 -0
- package/dist/extensions/state.module.d.ts +9 -0
- package/dist/extensions/state.module.js +38 -0
- package/dist/extensions/unavailable.d.ts +49 -0
- package/dist/extensions/unavailable.js +113 -0
- package/dist/files/previewers.controller.js +2 -3
- package/dist/files/previewers.d.ts +1 -1
- package/dist/files/previewers.js +4 -4
- package/dist/files/previewers.schemas.d.ts +10 -0
- package/dist/files/previewers.schemas.js +9 -0
- package/dist/http/api.module.js +4 -0
- package/dist/http/plugin-dispatch.d.ts +4 -1
- package/dist/http/plugin-dispatch.js +14 -2
- package/dist/identity/accounts.d.ts +43 -4
- package/dist/identity/accounts.js +74 -6
- package/dist/identity/auth.guard.js +10 -1
- package/dist/identity/cookies.d.ts +6 -0
- package/dist/identity/cookies.js +14 -0
- package/dist/identity/identity.module.js +3 -0
- package/dist/identity/initial-passwords.controller.d.ts +22 -0
- package/dist/identity/initial-passwords.controller.js +49 -0
- package/dist/identity/initial-passwords.d.ts +61 -0
- package/dist/identity/initial-passwords.job.d.ts +16 -0
- package/dist/identity/initial-passwords.job.js +46 -0
- package/dist/identity/initial-passwords.js +159 -0
- package/dist/identity/me.controller.d.ts +14 -0
- package/dist/identity/me.controller.js +39 -1
- package/dist/identity/principal.d.ts +8 -0
- package/dist/identity/principal.js +8 -0
- package/dist/identity/settings.d.ts +3 -1
- package/dist/identity/settings.js +6 -4
- package/dist/inbox/inbox.schemas.d.ts +8 -0
- package/dist/inbox/inbox.schemas.js +11 -0
- package/dist/inbox/platform-inbox.controller.d.ts +1 -1
- package/dist/inbox/platform-inbox.controller.js +2 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6 -0
- package/dist/infra/config/kernel-config.service.js +3 -0
- package/dist/infra/events/kernel-events.d.ts +8 -0
- package/dist/lifecycle/kernel-lifecycle.js +4 -0
- package/dist/models/embeddings.d.ts +82 -0
- package/dist/models/embeddings.js +326 -0
- package/dist/models/enablement.controller.d.ts +40 -0
- package/dist/models/enablement.controller.js +74 -0
- package/dist/models/enablement.d.ts +101 -0
- package/dist/models/enablement.js +264 -0
- package/dist/models/models.module.d.ts +5 -1
- package/dist/models/models.module.js +16 -4
- package/dist/models/org-models.schemas.d.ts +8 -0
- package/dist/models/org-models.schemas.js +22 -0
- package/dist/models/prices.d.ts +3 -1
- package/dist/models/prices.js +7 -5
- package/dist/models/purposes.d.ts +30 -6
- package/dist/models/purposes.js +68 -17
- package/dist/orgs/orgs.controller.d.ts +2 -5
- package/dist/orgs/orgs.controller.js +3 -6
- package/dist/orgs/orgs.schemas.d.ts +8 -0
- package/dist/orgs/orgs.schemas.js +16 -0
- package/dist/orgs/orgs.service.d.ts +3 -1
- package/dist/orgs/orgs.service.js +6 -4
- package/dist/orgs/settings.service.d.ts +9 -1
- package/dist/orgs/settings.service.js +20 -5
- package/dist/overrides.d.ts +4 -0
- package/dist/overrides.js +2 -0
- package/dist/platform/errors.d.ts +21 -4
- package/dist/platform/errors.js +45 -6
- package/dist/platform/exclusions.d.ts +2 -3
- package/dist/platform/exclusions.js +68 -831
- package/dist/platform/method.js +1 -1
- package/dist/platform/operation.d.ts +82 -5
- package/dist/platform/operation.js +62 -7
- package/dist/platform/ops/accounts.ops.d.ts +32 -0
- package/dist/platform/ops/accounts.ops.js +291 -0
- package/dist/platform/ops/admin.ops.d.ts +36 -0
- package/dist/platform/ops/admin.ops.js +389 -0
- package/dist/platform/ops/agent-skills.ops.d.ts +24 -0
- package/dist/platform/ops/agent-skills.ops.js +226 -0
- package/dist/platform/ops/agent-templates.ops.d.ts +4 -1
- package/dist/platform/ops/agent-templates.ops.js +194 -14
- package/dist/platform/ops/agents.ops.d.ts +19 -1
- package/dist/platform/ops/agents.ops.js +481 -58
- package/dist/platform/ops/approvals.ops.d.ts +30 -0
- package/dist/platform/ops/approvals.ops.js +116 -0
- package/dist/platform/ops/background.ops.d.ts +14 -0
- package/dist/platform/ops/background.ops.js +134 -0
- package/dist/platform/ops/catalog-admin.ops.d.ts +74 -0
- package/dist/platform/ops/catalog-admin.ops.js +587 -0
- package/dist/platform/ops/channels.ops.d.ts +16 -0
- package/dist/platform/ops/channels.ops.js +195 -0
- package/dist/platform/ops/components.ops.d.ts +46 -0
- package/dist/platform/ops/components.ops.js +853 -0
- package/dist/platform/ops/connectors.ops.d.ts +4 -2
- package/dist/platform/ops/connectors.ops.js +68 -6
- package/dist/platform/ops/conversations.ops.d.ts +30 -0
- package/dist/platform/ops/conversations.ops.js +470 -0
- package/dist/platform/ops/environments.ops.d.ts +26 -0
- package/dist/platform/ops/environments.ops.js +289 -0
- package/dist/platform/ops/errors.d.ts +10 -5
- package/dist/platform/ops/errors.js +19 -11
- package/dist/platform/ops/evals.ops.d.ts +28 -0
- package/dist/platform/ops/evals.ops.js +783 -0
- package/dist/platform/ops/extensions-admin.ops.d.ts +25 -0
- package/dist/platform/ops/extensions-admin.ops.js +344 -0
- package/dist/platform/ops/extensions.ops.d.ts +7 -1
- package/dist/platform/ops/extensions.ops.js +248 -17
- package/dist/platform/ops/inbox.ops.d.ts +25 -0
- package/dist/platform/ops/inbox.ops.js +378 -0
- package/dist/platform/ops/marketplaces.ops.d.ts +7 -1
- package/dist/platform/ops/marketplaces.ops.js +326 -17
- package/dist/platform/ops/models.ops.d.ts +25 -0
- package/dist/platform/ops/models.ops.js +232 -0
- package/dist/platform/ops/org-plugins.ops.d.ts +29 -0
- package/dist/platform/ops/org-plugins.ops.js +329 -0
- package/dist/platform/ops/org-settings.ops.d.ts +16 -0
- package/dist/platform/ops/org-settings.ops.js +102 -0
- package/dist/platform/ops/orgs.ops.d.ts +28 -0
- package/dist/platform/ops/orgs.ops.js +295 -0
- package/dist/platform/ops/other-orgs.d.ts +20 -0
- package/dist/platform/ops/other-orgs.js +72 -0
- package/dist/platform/ops/platform.ops.d.ts +4 -4
- package/dist/platform/ops/platform.ops.js +23 -24
- package/dist/platform/ops/plugins.ops.d.ts +10 -8
- package/dist/platform/ops/plugins.ops.js +176 -77
- package/dist/platform/ops/previewers.ops.d.ts +14 -0
- package/dist/platform/ops/previewers.ops.js +109 -0
- package/dist/platform/ops/requests.ops.js +57 -19
- package/dist/platform/ops/skills.ops.d.ts +5 -1
- package/dist/platform/ops/skills.ops.js +129 -11
- package/dist/platform/ops/unavailable.d.ts +23 -0
- package/dist/platform/ops/unavailable.js +111 -0
- package/dist/platform/parity.d.ts +33 -0
- package/dist/platform/parity.js +272 -0
- package/dist/platform/platform-ops.module.d.ts +32 -0
- package/dist/platform/platform-ops.module.js +78 -11
- package/dist/platform/route-schemas.d.ts +18 -0
- package/dist/platform/route-schemas.js +60 -0
- package/dist/roles/worker.module.js +2 -0
- package/dist/runtime/context/build.d.ts +2 -0
- package/dist/runtime/context/build.js +28 -2
- package/dist/runtime/context/compaction.js +10 -1
- package/dist/runtime/context/run-context.d.ts +65 -0
- package/dist/runtime/context/run-context.js +215 -0
- package/dist/runtime/hook-calls.d.ts +8 -1
- package/dist/runtime/hook-calls.js +40 -9
- package/dist/runtime/model-call.d.ts +8 -3
- package/dist/runtime/model-call.js +30 -6
- package/dist/runtime/providers.d.ts +146 -32
- package/dist/runtime/providers.js +328 -67
- package/dist/runtime/run-context.service.d.ts +65 -0
- package/dist/runtime/run-context.service.js +220 -0
- package/dist/runtime/run-worker.d.ts +6 -1
- package/dist/runtime/run-worker.js +35 -10
- package/dist/runtime/runtime.module.js +2 -0
- package/dist/runtime/subagents/definition.d.ts +15 -15
- package/dist/runtime/subagents/definition.js +49 -118
- package/dist/runtime/usage-report-jobs.d.ts +88 -0
- package/dist/runtime/usage-report-jobs.js +158 -0
- package/dist/runtime/usage-report.d.ts +33 -38
- package/dist/runtime/usage-report.js +152 -84
- package/dist/skills/changes.controller.js +2 -1
- package/dist/skills/changes.service.d.ts +1 -1
- package/dist/skills/changes.service.js +4 -4
- package/dist/skills/invocable.controller.d.ts +1 -1
- package/dist/skills/invocable.controller.js +2 -2
- package/dist/skills/invoke.d.ts +2 -2
- package/dist/skills/invoke.js +8 -1
- package/dist/skills/skills.controller.d.ts +4 -13
- package/dist/skills/skills.controller.js +8 -24
- package/dist/skills/skills.schemas.d.ts +48 -0
- package/dist/skills/skills.schemas.js +61 -0
- package/dist/skills/skills.service.d.ts +11 -1
- package/dist/skills/skills.service.js +37 -14
- package/dist/time-zone.d.ts +5 -0
- package/dist/time-zone.js +19 -0
- package/dist/tools/approvals.controller.js +2 -3
- package/dist/tools/approvals.schemas.d.ts +21 -0
- package/dist/tools/approvals.schemas.js +15 -0
- package/dist/tools/builtin-names.d.ts +10 -8
- package/dist/tools/builtin-names.js +16 -11
- package/dist/tools/builtins/builtin-tools.d.ts +3 -1
- package/dist/tools/builtins/builtin-tools.js +15 -3
- package/dist/tools/builtins/current-time.d.ts +26 -0
- package/dist/tools/builtins/current-time.js +99 -0
- package/dist/tools/builtins/platform.d.ts +19 -2
- package/dist/tools/builtins/platform.js +105 -16
- package/dist/tools/connectors.controller.d.ts +1 -2
- package/dist/tools/connectors.controller.js +1 -4
- package/dist/tools/connectors.schemas.d.ts +12 -0
- package/dist/tools/connectors.schemas.js +19 -0
- package/dist/tools/connectors.service.d.ts +5 -2
- package/dist/tools/connectors.service.js +7 -5
- package/dist/tools/org-tool-switches.d.ts +16 -2
- package/dist/tools/org-tool-switches.js +26 -9
- package/dist/tools/pipeline.js +9 -1
- package/dist/tools/registry.d.ts +48 -51
- package/dist/tools/registry.js +222 -233
- package/package.json +3 -3
- package/src/migrations/0089_model_kinds_usage.sql +38 -0
- package/src/migrations/0090_initial_passwords.sql +27 -0
- package/src/migrations/0091_account_time_zone.sql +4 -0
- package/src/migrations/0092_tools_default_on.sql +27 -0
- package/dist/platform/redact-orgs.d.ts +0 -7
- package/dist/platform/redact-orgs.js +0 -52
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
};
|
|
10
|
+
import { Inject, Injectable, Optional } from "@nestjs/common";
|
|
11
|
+
import { sql } from "kysely";
|
|
12
|
+
import { EventLog } from "../conversations/event-log.js";
|
|
13
|
+
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
14
|
+
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
15
|
+
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
16
|
+
import { readOrgSettings } from "../orgs/settings.service.js";
|
|
17
|
+
import { isTimeZone } from "../time-zone.js";
|
|
18
|
+
import { currentRunContext, dateIn, runContextChange, sanitizeSenderName, snapshotDescription, } from "./context/run-context.js";
|
|
19
|
+
/**
|
|
20
|
+
* Optional provider: the clock run start reads the date from and the `CurrentTime` builtin reads
|
|
21
|
+
* the time from (default `Date.now`; tests).
|
|
22
|
+
*/
|
|
23
|
+
export const RUN_CONTEXT_CLOCK = Symbol("RUN_CONTEXT_CLOCK");
|
|
24
|
+
/** The idem key of a run's `run_context` (one per run at most). */
|
|
25
|
+
export const runContextIdemKey = (runId) => `run_context:${runId}`;
|
|
26
|
+
const cut = (s, max) => [...s].slice(0, max).join("");
|
|
27
|
+
/**
|
|
28
|
+
* Run start's run context (spec 2026-11-08-run-context-design §5): compares the facts the run
|
|
29
|
+
* would show the model (its agent's name and description, the org's name, today's date, the time
|
|
30
|
+
* zone and language of the person whose message started it; for a sub-agent who dispatched it)
|
|
31
|
+
* with the fold of the conversation's `run_context` events, and appends only what differs (the
|
|
32
|
+
* first time: everything). Lazy: a rename writes nothing anywhere; the next run notices.
|
|
33
|
+
*/
|
|
34
|
+
let RunContextService = class RunContextService {
|
|
35
|
+
db;
|
|
36
|
+
eventLog;
|
|
37
|
+
txHost;
|
|
38
|
+
now;
|
|
39
|
+
constructor(db, eventLog, txHost, now = Date.now) {
|
|
40
|
+
this.db = db;
|
|
41
|
+
this.eventLog = eventLog;
|
|
42
|
+
this.txHost = txHost;
|
|
43
|
+
this.now = now;
|
|
44
|
+
}
|
|
45
|
+
clock() {
|
|
46
|
+
return new Date(this.now());
|
|
47
|
+
}
|
|
48
|
+
/** Records the run's context (see the class) and notifies after the commit. */
|
|
49
|
+
async record(input) {
|
|
50
|
+
const seq = await this.append(input);
|
|
51
|
+
if (seq !== null)
|
|
52
|
+
await this.eventLog.notify(input.conversationId, seq);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* One transaction under the conversation row lock (as `lockLatestCatalog`): fold, read the
|
|
56
|
+
* current values, append when something differs, with the idem key `run_context:<runId>` (a
|
|
57
|
+
* retried run start finds its event, or finds nothing changed). Returns the seq written.
|
|
58
|
+
*/
|
|
59
|
+
async append(input) {
|
|
60
|
+
const t = this.db.db;
|
|
61
|
+
await t
|
|
62
|
+
.selectFrom("conversations")
|
|
63
|
+
.select("id")
|
|
64
|
+
.where("id", "=", input.conversationId)
|
|
65
|
+
.forUpdate()
|
|
66
|
+
.executeTakeFirst();
|
|
67
|
+
const prev = await foldOf(t, input.conversationId);
|
|
68
|
+
const next = input.subagent === undefined
|
|
69
|
+
? await this.rootContext(t, input)
|
|
70
|
+
: await this.childContext(t, input, input.subagent);
|
|
71
|
+
const change = runContextChange(prev, next);
|
|
72
|
+
if (change === null)
|
|
73
|
+
return null;
|
|
74
|
+
const written = await this.eventLog.appendIn(input.conversationId, [
|
|
75
|
+
{
|
|
76
|
+
type: "run_context",
|
|
77
|
+
runId: input.runId,
|
|
78
|
+
idemKey: runContextIdemKey(input.runId),
|
|
79
|
+
payload: change,
|
|
80
|
+
},
|
|
81
|
+
]);
|
|
82
|
+
return Math.max(...written.map((e) => e.seq));
|
|
83
|
+
}
|
|
84
|
+
/** A root run: agent, org, and the date, zone and language of the run's person (§3.4). */
|
|
85
|
+
async rootContext(t, input) {
|
|
86
|
+
const org = await t
|
|
87
|
+
.selectFrom("orgs")
|
|
88
|
+
.select("name")
|
|
89
|
+
.where("id", "=", input.orgId)
|
|
90
|
+
.executeTakeFirst();
|
|
91
|
+
const settings = await readOrgSettings(t, input.orgId);
|
|
92
|
+
// the person whose message started the run: the latest message at or before the trigger that
|
|
93
|
+
// recorded a zone (a wake run has no message of its own)
|
|
94
|
+
const person = await t
|
|
95
|
+
.selectFrom("conversation_events")
|
|
96
|
+
.select([
|
|
97
|
+
sql `payload->>'timeZone'`.as("timeZone"),
|
|
98
|
+
sql `payload->>'locale'`.as("locale"),
|
|
99
|
+
])
|
|
100
|
+
.where("conversation_id", "=", input.conversationId)
|
|
101
|
+
.where("type", "=", "user_message")
|
|
102
|
+
.where("seq", "<=", String(input.triggerSeq))
|
|
103
|
+
.where(sql `payload ? 'timeZone'`)
|
|
104
|
+
.orderBy("seq", "desc")
|
|
105
|
+
.limit(1)
|
|
106
|
+
.executeTakeFirst();
|
|
107
|
+
const zone = person?.timeZone != null && isTimeZone(person.timeZone)
|
|
108
|
+
? person.timeZone
|
|
109
|
+
: (settings.timeZone ?? "UTC");
|
|
110
|
+
const locale = person?.locale === "zh" || person?.locale === "en" ? person.locale : settings.locale;
|
|
111
|
+
const description = snapshotDescription(input.agent.description);
|
|
112
|
+
return {
|
|
113
|
+
agent: { name: input.agent.name, ...(description !== undefined && { description }) },
|
|
114
|
+
...(org !== undefined && org.name.trim() !== "" && { org: { name: cut(org.name, 200) } }),
|
|
115
|
+
date: dateIn(this.clock(), zone),
|
|
116
|
+
timeZone: zone,
|
|
117
|
+
locale,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* A sub-agent run (spec §6): its roster name, who dispatched it (the parent agent's name and
|
|
122
|
+
* the person the parent works for), and the parent's date and zone; no org, no language.
|
|
123
|
+
*/
|
|
124
|
+
async childContext(t, input, child) {
|
|
125
|
+
const parent = await foldOf(t, child.parentConversationId);
|
|
126
|
+
const parentAgent = parent.agent?.name ?? (await parentDefinitionName(t, child.parentRunId)) ?? "agent";
|
|
127
|
+
const person = parent.dispatchedBy?.person ??
|
|
128
|
+
(await latestSenderName(t, child.parentConversationId)) ??
|
|
129
|
+
(await triggerName(t, child.parentRunId)) ??
|
|
130
|
+
"a person";
|
|
131
|
+
const zone = parent.timeZone ?? (await readOrgSettings(t, input.orgId)).timeZone ?? "UTC";
|
|
132
|
+
return {
|
|
133
|
+
agent: { name: cut(child.name, 130) },
|
|
134
|
+
dispatchedBy: { agent: cut(parentAgent, 130), person },
|
|
135
|
+
date: dateIn(this.clock(), zone),
|
|
136
|
+
timeZone: zone,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
__decorate([
|
|
141
|
+
Transactional()
|
|
142
|
+
], RunContextService.prototype, "append", null);
|
|
143
|
+
RunContextService = __decorate([
|
|
144
|
+
Injectable(),
|
|
145
|
+
__param(0, Inject(KernelDb)),
|
|
146
|
+
__param(1, Inject(EventLog)),
|
|
147
|
+
__param(2, Inject(TransactionHost)),
|
|
148
|
+
__param(3, Optional()),
|
|
149
|
+
__param(3, Inject(RUN_CONTEXT_CLOCK))
|
|
150
|
+
], RunContextService);
|
|
151
|
+
export { RunContextService };
|
|
152
|
+
/**
|
|
153
|
+
* The time zone a conversation's run context holds now (the latest `run_context` with a
|
|
154
|
+
* `timeZone`, as the fold reads it), else the org default (§3.3), else UTC. The `CurrentTime`
|
|
155
|
+
* builtin's default zone.
|
|
156
|
+
*/
|
|
157
|
+
export async function conversationTimeZone(t, orgId, conversationId) {
|
|
158
|
+
const row = await t
|
|
159
|
+
.selectFrom("conversation_events")
|
|
160
|
+
.select(sql `payload->>'timeZone'`.as("timeZone"))
|
|
161
|
+
.where("conversation_id", "=", conversationId)
|
|
162
|
+
.where("type", "=", "run_context")
|
|
163
|
+
.where(sql `payload ? 'timeZone'`)
|
|
164
|
+
.orderBy("seq", "desc")
|
|
165
|
+
.limit(1)
|
|
166
|
+
.executeTakeFirst();
|
|
167
|
+
if (row?.timeZone != null && isTimeZone(row.timeZone))
|
|
168
|
+
return row.timeZone;
|
|
169
|
+
const zone = (await readOrgSettings(t, orgId)).timeZone;
|
|
170
|
+
return zone !== undefined && isTimeZone(zone) ? zone : "UTC";
|
|
171
|
+
}
|
|
172
|
+
/** The fold of a conversation's `run_context` events (read inside the caller's transaction). */
|
|
173
|
+
async function foldOf(t, conversationId) {
|
|
174
|
+
const rows = await t
|
|
175
|
+
.selectFrom("conversation_events")
|
|
176
|
+
.select(["seq", "payload"])
|
|
177
|
+
.where("conversation_id", "=", conversationId)
|
|
178
|
+
.where("type", "=", "run_context")
|
|
179
|
+
.orderBy("seq", "asc")
|
|
180
|
+
.execute();
|
|
181
|
+
return currentRunContext(rows.map((r) => ({ type: "run_context", seq: Number(r.seq), payload: r.payload })));
|
|
182
|
+
}
|
|
183
|
+
/** The name in the parent run's agent version (a parent logged before run contexts existed). */
|
|
184
|
+
async function parentDefinitionName(t, runId) {
|
|
185
|
+
const row = await t
|
|
186
|
+
.selectFrom("runs")
|
|
187
|
+
.innerJoin("conversations", "conversations.id", "runs.conversation_id")
|
|
188
|
+
.innerJoin("agent_versions as v", (j) => j
|
|
189
|
+
.onRef("v.agent_id", "=", "conversations.agent_id")
|
|
190
|
+
.onRef("v.version", "=", "runs.agent_version"))
|
|
191
|
+
.select(sql `v.definition->>'name'`.as("name"))
|
|
192
|
+
.where("runs.id", "=", runId)
|
|
193
|
+
.executeTakeFirst();
|
|
194
|
+
return row?.name ?? undefined;
|
|
195
|
+
}
|
|
196
|
+
/** The latest sender name in a conversation's log (the person the conversation works for). */
|
|
197
|
+
async function latestSenderName(t, conversationId) {
|
|
198
|
+
const row = await t
|
|
199
|
+
.selectFrom("conversation_events")
|
|
200
|
+
.select(sql `payload->'sender'->>'name'`.as("name"))
|
|
201
|
+
.where("conversation_id", "=", conversationId)
|
|
202
|
+
.where("type", "=", "user_message")
|
|
203
|
+
.where(sql `payload ? 'sender'`)
|
|
204
|
+
.orderBy("seq", "desc")
|
|
205
|
+
.limit(1)
|
|
206
|
+
.executeTakeFirst();
|
|
207
|
+
const name = row?.name == null ? "" : sanitizeSenderName(row.name);
|
|
208
|
+
return name === "" ? undefined : name;
|
|
209
|
+
}
|
|
210
|
+
/** The display name of the account that triggered a run. */
|
|
211
|
+
async function triggerName(t, runId) {
|
|
212
|
+
const row = await t
|
|
213
|
+
.selectFrom("runs")
|
|
214
|
+
.innerJoin("accounts", "accounts.id", "runs.trigger_account_id")
|
|
215
|
+
.select("accounts.display_name")
|
|
216
|
+
.where("runs.id", "=", runId)
|
|
217
|
+
.executeTakeFirst();
|
|
218
|
+
const name = row === undefined ? "" : sanitizeSenderName(row.display_name);
|
|
219
|
+
return name === "" ? undefined : name;
|
|
220
|
+
}
|
|
@@ -14,6 +14,7 @@ import { KyselyCheckpointSaver } from "./checkpointer.js";
|
|
|
14
14
|
import { ConversationLock } from "./conversation-lock.js";
|
|
15
15
|
import { ProviderRegistry } from "./providers.js";
|
|
16
16
|
import { type OrgQuota } from "./quota.js";
|
|
17
|
+
import { RunContextService } from "./run-context.service.js";
|
|
17
18
|
import { RunDrafts } from "./run-drafts.js";
|
|
18
19
|
import { RunFinish } from "./run-finish.js";
|
|
19
20
|
import type { RunJobData } from "./run-jobs.js";
|
|
@@ -63,6 +64,8 @@ export declare class RunWorker {
|
|
|
63
64
|
private readonly models;
|
|
64
65
|
/** Run start's skills catalog snapshot (reads the pinned skills' bodies, phase B). */
|
|
65
66
|
private readonly skillsCatalog;
|
|
67
|
+
/** Run start's run context (run context spec §5): who the agent is, the day, the person. */
|
|
68
|
+
private readonly runContext;
|
|
66
69
|
/**
|
|
67
70
|
* In the terminal transaction of every run: writes its open `Agent` call results
|
|
68
71
|
* (`stopOpenAgentCalls`; a no-op without dispatches); `fire` runs their observe hooks after the
|
|
@@ -96,6 +99,8 @@ export declare class RunWorker {
|
|
|
96
99
|
models: Pick<ProviderRegistry, "resolve">,
|
|
97
100
|
/** Run start's skills catalog snapshot (reads the pinned skills' bodies, phase B). */
|
|
98
101
|
skillsCatalog: Pick<SkillsCatalogService, "record">,
|
|
102
|
+
/** Run start's run context (run context spec §5): who the agent is, the day, the person. */
|
|
103
|
+
runContext: Pick<RunContextService, "record">,
|
|
99
104
|
/**
|
|
100
105
|
* In the terminal transaction of every run: writes its open `Agent` call results
|
|
101
106
|
* (`stopOpenAgentCalls`; a no-op without dispatches); `fire` runs their observe hooks after the
|
|
@@ -170,7 +175,7 @@ export declare class RunWorker {
|
|
|
170
175
|
* model removed), writes `model_switched { model: null, effort: null, reason: "unavailable" }`
|
|
171
176
|
* for this run (idempotent) and clears the cached selection: the run and the next ones use the
|
|
172
177
|
* agent's model. A provider that only failed to list its models is not "gone" (the run's ladder
|
|
173
|
-
* handles it).
|
|
178
|
+
* handles it). Resolved for the conversation's org (its effective provider config).
|
|
174
179
|
*/
|
|
175
180
|
private fallBackIfUnavailable;
|
|
176
181
|
/**
|
|
@@ -32,6 +32,7 @@ import { ConversationLock } from "./conversation-lock.js";
|
|
|
32
32
|
import { RunError } from "./model-call.js";
|
|
33
33
|
import { ProviderListError, ProviderRegistry } from "./providers.js";
|
|
34
34
|
import { ORG_QUOTA_LEASE_MS, orgRunLimit, RUN_QUOTA } from "./quota.js";
|
|
35
|
+
import { RunContextService } from "./run-context.service.js";
|
|
35
36
|
import { RunDrafts, streamSink } from "./run-drafts.js";
|
|
36
37
|
import { RunFinish, TERMINAL_STATUSES } from "./run-finish.js";
|
|
37
38
|
import { RunQueue } from "./run-queue.js";
|
|
@@ -84,6 +85,7 @@ let RunWorker = class RunWorker {
|
|
|
84
85
|
titles;
|
|
85
86
|
models;
|
|
86
87
|
skillsCatalog;
|
|
88
|
+
runContext;
|
|
87
89
|
pipeline;
|
|
88
90
|
finisher;
|
|
89
91
|
txHost;
|
|
@@ -111,6 +113,8 @@ let RunWorker = class RunWorker {
|
|
|
111
113
|
models,
|
|
112
114
|
/** Run start's skills catalog snapshot (reads the pinned skills' bodies, phase B). */
|
|
113
115
|
skillsCatalog,
|
|
116
|
+
/** Run start's run context (run context spec §5): who the agent is, the day, the person. */
|
|
117
|
+
runContext,
|
|
114
118
|
/**
|
|
115
119
|
* In the terminal transaction of every run: writes its open `Agent` call results
|
|
116
120
|
* (`stopOpenAgentCalls`; a no-op without dispatches); `fire` runs their observe hooks after the
|
|
@@ -135,6 +139,7 @@ let RunWorker = class RunWorker {
|
|
|
135
139
|
this.titles = titles;
|
|
136
140
|
this.models = models;
|
|
137
141
|
this.skillsCatalog = skillsCatalog;
|
|
142
|
+
this.runContext = runContext;
|
|
138
143
|
this.pipeline = pipeline;
|
|
139
144
|
this.finisher = finisher;
|
|
140
145
|
this.txHost = txHost;
|
|
@@ -511,6 +516,8 @@ let RunWorker = class RunWorker {
|
|
|
511
516
|
let saved;
|
|
512
517
|
let maxSteps = runtime.maxSteps;
|
|
513
518
|
let parent;
|
|
519
|
+
/** A sub-agent's name in its run context: the roster name, or the forked skill's. */
|
|
520
|
+
let childName;
|
|
514
521
|
if (conv.kind === "subagent") {
|
|
515
522
|
// a sub-agent runs its effective definition frozen at dispatch, never agent_versions
|
|
516
523
|
// (spec §6.3), and works for the parent call that dispatched this run
|
|
@@ -525,6 +532,7 @@ let RunWorker = class RunWorker {
|
|
|
525
532
|
? trigger.payload.dispatch?.narrowed
|
|
526
533
|
: undefined);
|
|
527
534
|
maxSteps = Math.min(started.payload.maxSteps, runtime.maxSteps);
|
|
535
|
+
childName = started.payload.template.invokedSkill?.name ?? started.payload.agentType;
|
|
528
536
|
const row = await dispatchOfChildRun(this.db, runId);
|
|
529
537
|
const otherAgent = started.payload.template.source === "agent";
|
|
530
538
|
const parentConversationId = row?.parentConversationId ?? started.payload.parent.conversationId;
|
|
@@ -581,7 +589,7 @@ let RunWorker = class RunWorker {
|
|
|
581
589
|
if (run.status === "queued" || startedAt === null) {
|
|
582
590
|
if (!existingStart) {
|
|
583
591
|
if (saved !== undefined)
|
|
584
|
-
await this.fallBackIfUnavailable(conversationId, runId, saved);
|
|
592
|
+
await this.fallBackIfUnavailable(conv.org_id, conversationId, runId, saved);
|
|
585
593
|
const started = await this.appendRunStarted(conversationId, run, agent, saved);
|
|
586
594
|
agent = started.agent;
|
|
587
595
|
const toSeq = started.toSeq;
|
|
@@ -620,6 +628,22 @@ let RunWorker = class RunWorker {
|
|
|
620
628
|
});
|
|
621
629
|
return "finished";
|
|
622
630
|
}
|
|
631
|
+
// run context (spec §5): after the catalog, before the run is running, so before any
|
|
632
|
+
// compaction and model call; a retried run start finds its event or no change
|
|
633
|
+
await this.runContext.record({
|
|
634
|
+
orgId: conv.org_id,
|
|
635
|
+
conversationId,
|
|
636
|
+
runId,
|
|
637
|
+
triggerSeq: Number(run.trigger_seq),
|
|
638
|
+
agent,
|
|
639
|
+
...(parent !== undefined && {
|
|
640
|
+
subagent: {
|
|
641
|
+
parentConversationId: parent.conversationId,
|
|
642
|
+
parentRunId: parent.runId,
|
|
643
|
+
name: childName ?? agent.name,
|
|
644
|
+
},
|
|
645
|
+
}),
|
|
646
|
+
});
|
|
623
647
|
const updated = await this.db
|
|
624
648
|
.updateTable("runs")
|
|
625
649
|
.set({ status: "running", started_at: sql `COALESCE(started_at, now())` })
|
|
@@ -789,14 +813,14 @@ let RunWorker = class RunWorker {
|
|
|
789
813
|
* model removed), writes `model_switched { model: null, effort: null, reason: "unavailable" }`
|
|
790
814
|
* for this run (idempotent) and clears the cached selection: the run and the next ones use the
|
|
791
815
|
* agent's model. A provider that only failed to list its models is not "gone" (the run's ladder
|
|
792
|
-
* handles it).
|
|
816
|
+
* handles it). Resolved for the conversation's org (its effective provider config).
|
|
793
817
|
*/
|
|
794
|
-
async fallBackIfUnavailable(conversationId, runId, agent) {
|
|
818
|
+
async fallBackIfUnavailable(orgId, conversationId, runId, agent) {
|
|
795
819
|
const sel = await readSelection(this.db, conversationId);
|
|
796
820
|
if (sel.model === null || sameModel(sel.model, agent.model))
|
|
797
821
|
return;
|
|
798
822
|
try {
|
|
799
|
-
await this.models.resolve(sel.model);
|
|
823
|
+
await this.models.resolve(orgId, sel.model);
|
|
800
824
|
return;
|
|
801
825
|
}
|
|
802
826
|
catch (e) {
|
|
@@ -946,11 +970,12 @@ RunWorker = __decorate([
|
|
|
946
970
|
__param(15, Inject(TitleQueue)),
|
|
947
971
|
__param(16, Inject(ProviderRegistry)),
|
|
948
972
|
__param(17, Inject(SkillsCatalogService)),
|
|
949
|
-
__param(18, Inject(
|
|
950
|
-
__param(19, Inject(
|
|
951
|
-
__param(20, Inject(
|
|
952
|
-
__param(21, Inject(
|
|
953
|
-
__param(22,
|
|
954
|
-
__param(
|
|
973
|
+
__param(18, Inject(RunContextService)),
|
|
974
|
+
__param(19, Inject(ToolPipeline)),
|
|
975
|
+
__param(20, Inject(RunFinish)),
|
|
976
|
+
__param(21, Inject(TransactionHost)),
|
|
977
|
+
__param(22, Inject(RunDrafts)),
|
|
978
|
+
__param(23, Optional()),
|
|
979
|
+
__param(23, Inject(RUN_HOOKS))
|
|
955
980
|
], RunWorker);
|
|
956
981
|
export { RunWorker };
|
|
@@ -24,6 +24,7 @@ import { ConversationLock } from "./conversation-lock.js";
|
|
|
24
24
|
import { MAINTENANCE_QUEUE_NAME } from "./maintenance-queue.js";
|
|
25
25
|
import { ProvidersModule } from "./providers.js";
|
|
26
26
|
import { EVAL_QUOTA, EVAL_QUOTA_PREFIX, OrgQuota, RUN_QUOTA, RUN_QUOTA_PREFIX } from "./quota.js";
|
|
27
|
+
import { RunContextService } from "./run-context.service.js";
|
|
27
28
|
import { RunControl } from "./run-control.js";
|
|
28
29
|
import { RunDrafts } from "./run-drafts.js";
|
|
29
30
|
import { RunFinish } from "./run-finish.js";
|
|
@@ -79,6 +80,7 @@ RuntimeModule = __decorate([
|
|
|
79
80
|
RunDrafts,
|
|
80
81
|
AgentLoops,
|
|
81
82
|
RunSteps,
|
|
83
|
+
RunContextService,
|
|
82
84
|
RunWorker,
|
|
83
85
|
// a finished background task wakes an idle conversation (background Bash spec §3)
|
|
84
86
|
BackgroundWake,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AgentTemplateTier } from "@capybara-hq/plugin-sdk";
|
|
2
|
-
import type
|
|
2
|
+
import { type AgentDefinition, type DisabledToolRef, type ModelRef } from "../../agents/definition.js";
|
|
3
3
|
import type { EventPayload } from "../../conversations/events.js";
|
|
4
4
|
import type { KernelSchemaDb } from "../../db/kernel-schema.js";
|
|
5
5
|
import type { KernelConfigService } from "../../infra/config/kernel-config.service.js";
|
|
@@ -77,31 +77,31 @@ export declare function effectiveDefinition(d: EffectiveDefinitionDeps, a: Child
|
|
|
77
77
|
tierFallback: boolean;
|
|
78
78
|
}>;
|
|
79
79
|
/**
|
|
80
|
-
* What a follow-up (`resume`) may still use (final review I1, spec §5.3): the frozen
|
|
81
|
-
*
|
|
82
|
-
*
|
|
80
|
+
* What a follow-up (`resume`) may still use (final review I1, spec §5.3): the frozen definition's
|
|
81
|
+
* turned-off tools together with the current version's (it can lose tools, never gain them), and
|
|
82
|
+
* the frozen org skills intersected with the current ones. Recorded on the follow-up's task message
|
|
83
|
+
* (`user_message.dispatch.narrowed`), so the run and its replay read it from the log.
|
|
83
84
|
*/
|
|
84
85
|
export interface FollowUpNarrowing {
|
|
85
|
-
tools
|
|
86
|
+
/** Absent in logs from before tools were on by default (no tool narrowing then). */
|
|
87
|
+
disabledTools?: DisabledToolRef[] | undefined;
|
|
86
88
|
skills?: {
|
|
87
89
|
orgSkills: string[];
|
|
88
90
|
pinned?: string[] | undefined;
|
|
89
91
|
} | undefined;
|
|
90
92
|
}
|
|
91
|
-
/**
|
|
92
|
-
* The refs of `frozen` that `current` still has: a builtin or plugin tool by name, a connector by
|
|
93
|
-
* id; a connector's `all` meets the other side's names (`all` on both stays `all`), and a
|
|
94
|
-
* connector left with no names is dropped. Pure: a connector `current` lists is not looked up.
|
|
95
|
-
*/
|
|
96
|
-
export declare function intersectTools(frozen: readonly AgentToolRef[], current: readonly AgentToolRef[]): AgentToolRef[];
|
|
97
93
|
/**
|
|
98
94
|
* The narrowing of a follow-up (final review I1): `frozen` (the child's `subagent_started`
|
|
99
95
|
* definition) against `current`, the definition a fresh dispatch would read now: the dispatching
|
|
100
96
|
* parent run's version for `general` / inline / plugin children, the dispatched org agent's
|
|
101
97
|
* current version for an org agent child (whose tools are its own at dispatch too, §5.5). Its
|
|
102
|
-
* `orgSkills` keep only those `current` still
|
|
103
|
-
* skills goes with it (the agent's own skills
|
|
98
|
+
* `disabledTools` are both lists together; its `orgSkills` keep only those `current` still
|
|
99
|
+
* selects; a pinned id that was one of the frozen org skills goes with it (the agent's own skills
|
|
100
|
+
* stay).
|
|
101
|
+
*/
|
|
102
|
+
export declare function narrowFollowUp(frozen: Pick<AgentDefinition, "disabledTools" | "skills">, current: Pick<AgentDefinition, "disabledTools" | "skills">): FollowUpNarrowing;
|
|
103
|
+
/**
|
|
104
|
+
* The definition a child run uses: the frozen one with its trigger's follow-up narrowing. A
|
|
105
|
+
* narrowing logged before tools were on by default (no `disabledTools`) narrows only skills.
|
|
104
106
|
*/
|
|
105
|
-
export declare function narrowFollowUp(frozen: Pick<AgentDefinition, "tools" | "skills">, current: Pick<AgentDefinition, "tools" | "skills">): FollowUpNarrowing;
|
|
106
|
-
/** The definition a child run uses: the frozen one with its trigger's follow-up narrowing. */
|
|
107
107
|
export declare function childRunDefinition(frozen: AgentDefinition, narrowed: FollowUpNarrowing | undefined): AgentDefinition;
|