@sema-agent/server 7.142.0 → 7.144.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATION.md +608 -0
- package/USAGE.md +63 -36
- package/dist/adoption/plan.js +22 -0
- package/dist/approval-ask-audit-store.d.ts +7 -5
- package/dist/approval-ask-audit-store.js +12 -6
- package/dist/approval-ask-machine.d.ts +15 -7
- package/dist/approval-ask-machine.js +10 -4
- package/dist/approval-card.d.ts +155 -39
- package/dist/approval-card.js +111 -31
- package/dist/approval-queue-kind.d.ts +27 -0
- package/dist/approval-queue-kind.js +6 -0
- package/dist/approval-reconciler.d.ts +8 -8
- package/dist/approval-reconciler.js +3 -3
- package/dist/audit.js +4 -2
- package/dist/boot/budget-tracing.d.ts +1 -1
- package/dist/boot/execution-env.js +1 -1
- package/dist/boot/governance-seams.d.ts +26 -41
- package/dist/boot/governance-seams.js +61 -28
- package/dist/boot/late-binds.d.ts +7 -4
- package/dist/boot/late-binds.js +3 -1
- package/dist/boot/leader.js +2 -4
- package/dist/boot/memory-consolidation.d.ts +0 -8
- package/dist/boot/memory-consolidation.js +3 -3
- package/dist/boot/reapers.js +5 -4
- package/dist/boot/resolve-spec.d.ts +1 -1
- package/dist/boot/resolve-spec.js +8 -8
- package/dist/boot/runner-deps.d.ts +14 -6
- package/dist/boot/runner-deps.js +6 -17
- package/dist/boot/shutdown.d.ts +9 -0
- package/dist/boot/shutdown.js +18 -2
- package/dist/boot/stage-01-config.js +2 -0
- package/dist/boot/stage-02-web-admin-pull.js +3 -0
- package/dist/boot/stage-03-store-backend.d.ts +4 -1
- package/dist/boot/stage-03-store-backend.js +1 -2
- package/dist/boot/stage-04-stores.d.ts +5 -2
- package/dist/boot/stage-04-stores.js +3 -5
- package/dist/boot/stage-05-execution-env.d.ts +5 -2
- package/dist/boot/stage-06-runners.d.ts +5 -2
- package/dist/boot/stage-06-runners.js +1 -3
- package/dist/boot/stage-07-capability-layer.d.ts +5 -2
- package/dist/boot/stage-07-capability-layer.js +6 -2
- package/dist/boot/stage-08-reapers.d.ts +5 -2
- package/dist/boot/stage-09-leader.d.ts +5 -2
- package/dist/boot/stage-10-http-server.d.ts +5 -2
- package/dist/boot/stage-10-http-server.js +4 -1
- package/dist/boot/stores.d.ts +5 -2
- package/dist/boot/stores.js +7 -7
- package/dist/boot/web-admin.d.ts +5 -1
- package/dist/boot/web-admin.js +31 -19
- package/dist/capabilities/hands-lane.d.ts +9 -39
- package/dist/capabilities/hands-lane.js +8 -13
- package/dist/capabilities/mcp-probe.d.ts +3 -2
- package/dist/capabilities/scenarios.d.ts +23 -17
- package/dist/capabilities/scenarios.js +2 -2
- package/dist/capabilities/skills.d.ts +1 -17
- package/dist/capabilities/skills.js +0 -8
- package/dist/capability-facts.d.ts +8 -8
- package/dist/capability-facts.js +4 -4
- package/dist/card-void.d.ts +6 -9
- package/dist/config-catalog.js +1 -1
- package/dist/config-d-migration.d.ts +2 -0
- package/dist/config-dir-trust.js +58 -29
- package/dist/config-invariants.d.ts +7 -1
- package/dist/config-invariants.js +7 -0
- package/dist/config-provider.d.ts +10 -0
- package/dist/config-provider.js +15 -4
- package/dist/config-root-migration.d.ts +13 -0
- package/dist/config-root-migration.js +99 -0
- package/dist/config-types.d.ts +5 -5
- package/dist/config.d.ts +4 -3
- package/dist/config.js +1 -1
- package/dist/delegated-session-owner.d.ts +35 -151
- package/dist/delegated-session-owner.js +1 -83
- package/dist/device-ws-protocol.d.ts +1 -0
- package/dist/device-ws-protocol.js +2 -1
- package/dist/entry-mode-clamp-notice.d.ts +1 -1
- package/dist/env-model-table-gate.d.ts +53 -0
- package/dist/env-model-table-gate.js +53 -0
- package/dist/execution-placement.d.ts +7 -4
- package/dist/fleet/fleet-bus.d.ts +28 -52
- package/dist/fleet/fleet-bus.js +35 -100
- package/dist/fleet/fleet-reconciler.d.ts +4 -4
- package/dist/fleet/fleet-reconciler.js +1 -1
- package/dist/fleet/subagent-tail-bus.d.ts +14 -11
- package/dist/fleet/subagent-tail-bus.js +15 -28
- package/dist/hooks/classic-stations.d.ts +3 -1
- package/dist/hooks/classic-stations.js +2 -0
- package/dist/hooks/hook-runner.js +28 -7
- package/dist/host-decision.d.ts +54 -20
- package/dist/host-decision.js +42 -14
- package/dist/http/admission.d.ts +1 -1
- package/dist/http/admission.js +7 -3
- package/dist/http/approval-sweeps.js +11 -8
- package/dist/http/caller-trust.d.ts +1 -1
- package/dist/http/durable-run-leg.js +2 -2
- package/dist/http/engine-refusal.d.ts +16 -0
- package/dist/http/engine-refusal.js +17 -0
- package/dist/http/memory-compliance-failure-reply.d.ts +1 -3
- package/dist/http/memory-compliance-failure-reply.js +4 -6
- package/dist/http/owner-access.d.ts +11 -0
- package/dist/http/owner-access.js +13 -0
- package/dist/http/principal-gate.d.ts +1 -1
- package/dist/http/refusal-body.d.ts +7 -3
- package/dist/http/refusal-body.js +1 -0
- package/dist/http/resume-legs.d.ts +21 -7
- package/dist/http/resume-legs.js +82 -53
- package/dist/http/resume-restatement.d.ts +39 -0
- package/dist/http/resume-restatement.js +25 -0
- package/dist/http/route-ctx.d.ts +35 -10
- package/dist/http/route-ctx.js +1 -1
- package/dist/http/routes/approvals-assistant.d.ts +9 -1
- package/dist/http/routes/approvals-assistant.js +143 -31
- package/dist/http/routes/capabilities.js +11 -2
- package/dist/http/routes/memory-policy.d.ts +2 -2
- package/dist/http/routes/memory-policy.js +1 -1
- package/dist/http/routes/notify-wake.js +23 -25
- package/dist/http/routes/rules.js +48 -13
- package/dist/http/routes/runs.js +9 -8
- package/dist/http/routes/session-memory-sync.d.ts +34 -6
- package/dist/http/routes/session-memory-sync.js +27 -10
- package/dist/http/routes/session-sync.js +13 -20
- package/dist/http/routes/sessions.d.ts +2 -2
- package/dist/http/routes/sessions.js +22 -23
- package/dist/http/routes/tasks.js +27 -49
- package/dist/http/server.d.ts +13 -7
- package/dist/http/server.js +2 -2
- package/dist/http/stored-body-replay.js +15 -4
- package/dist/http/wire-types.d.ts +17 -7
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lane-home-probe.d.ts +15 -0
- package/dist/lane-home-probe.js +4 -0
- package/dist/leader/leader.js +5 -2
- package/dist/leader/wire.d.ts +7 -1
- package/dist/leader/wire.js +6 -5
- package/dist/leg-facts.d.ts +37 -0
- package/dist/leg-facts.js +15 -0
- package/dist/memory-bundle-engine.d.ts +1 -4
- package/dist/memory-bundle-engine.js +2 -2
- package/dist/memory-operator-faces.d.ts +30 -66
- package/dist/memory-operator-faces.js +17 -88
- package/dist/memory-scope-stores.d.ts +38 -40
- package/dist/memory-scope-stores.js +51 -36
- package/dist/memory-scope.d.ts +0 -9
- package/dist/memory-scope.js +0 -9
- package/dist/memory-sync-client.js +14 -3
- package/dist/memory-sync.d.ts +20 -4
- package/dist/memory-sync.js +23 -4
- package/dist/model-plane-face.d.ts +13 -7
- package/dist/model-plane-face.js +2 -1
- package/dist/observability/corrupt-read-seat.d.ts +5 -9
- package/dist/observability/corrupt-read-seat.js +1 -2
- package/dist/observability/fail-open.d.ts +30 -10
- package/dist/observability/fail-open.js +27 -10
- package/dist/observability/run-terminal.d.ts +1 -1
- package/dist/observability/run-terminal.js +6 -2
- package/dist/orchestration/workflow-completion-inbox.d.ts +5 -19
- package/dist/orchestration/workflow-completion-inbox.js +0 -12
- package/dist/orchestration/workflow-notify-journal.d.ts +3 -2
- package/dist/orchestration/workflow-park-decision.d.ts +8 -3
- package/dist/orchestration/workflow-park-decision.js +5 -3
- package/dist/org-delivery-gate.d.ts +11 -0
- package/dist/org-delivery-gate.js +19 -1
- package/dist/parked-decide.d.ts +13 -9
- package/dist/parked-decide.js +7 -7
- package/dist/parked-revive-surface.d.ts +6 -7
- package/dist/parked-revive-surface.js +1 -1
- package/dist/peer-inbound-face.d.ts +122 -0
- package/dist/peer-inbound-face.js +123 -0
- package/dist/permission-rule-list.d.ts +13 -9
- package/dist/permission-rule-list.js +7 -3
- package/dist/plugins/approval-ask-store-file.js +18 -6
- package/dist/plugins/approval-ask-store-memory.js +8 -6
- package/dist/plugins/approval-ask-store-sql.d.ts +28 -13
- package/dist/plugins/approval-ask-store-sql.js +30 -11
- package/dist/plugins/caching-session-store.d.ts +0 -3
- package/dist/plugins/caching-session-store.js +0 -3
- package/dist/plugins/checkpoint-store-sql.d.ts +45 -38
- package/dist/plugins/checkpoint-store-sql.js +108 -45
- package/dist/plugins/file-history-store-sql.d.ts +24 -18
- package/dist/plugins/file-history-store-sql.js +24 -19
- package/dist/plugins/file-run-store.d.ts +29 -0
- package/dist/plugins/file-run-store.js +97 -8
- package/dist/plugins/fork-routing-session-store.d.ts +8 -1
- package/dist/plugins/fork-routing-session-store.js +6 -0
- package/dist/plugins/imported-layer-root-retirement.d.ts +82 -0
- package/dist/plugins/imported-layer-root-retirement.js +96 -0
- package/dist/plugins/local-checkpoint-store.d.ts +6 -8
- package/dist/plugins/local-checkpoint-store.js +5 -4
- package/dist/plugins/local-session-store.d.ts +69 -30
- package/dist/plugins/local-session-store.js +133 -57
- package/dist/plugins/local-session-window.d.ts +4 -2
- package/dist/plugins/mailbox-recipient-lifecycle.d.ts +9 -31
- package/dist/plugins/mailbox-recipient-lifecycle.js +4 -0
- package/dist/plugins/mailbox-store-sql.d.ts +12 -8
- package/dist/plugins/mailbox-store-sql.js +76 -7
- package/dist/plugins/memory-sync-store-pg.d.ts +15 -0
- package/dist/plugins/memory-sync-store-pg.js +21 -0
- package/dist/plugins/memory-sync-store-tidb.d.ts +2 -0
- package/dist/plugins/memory-sync-store-tidb.js +13 -1
- package/dist/plugins/one-time-migrations.d.ts +44 -14
- package/dist/plugins/one-time-migrations.js +118 -15
- package/dist/plugins/org-delivery-quota-store.d.ts +1 -1
- package/dist/plugins/org-delivery-quota-store.js +2 -12
- package/dist/plugins/park-commit-watch.d.ts +1 -1
- package/dist/plugins/permission-rule-store-file.d.ts +10 -1
- package/dist/plugins/permission-rule-store-file.js +15 -2
- package/dist/plugins/permission-rule-store-sql.d.ts +31 -1
- package/dist/plugins/permission-rule-store-sql.js +35 -2
- package/dist/plugins/pg-session-storage.d.ts +1 -9
- package/dist/plugins/pg-session-storage.js +2 -19
- package/dist/plugins/remote-env-device.d.ts +8 -11
- package/dist/plugins/remote-env-device.js +6 -3
- package/dist/plugins/remote-env-host.d.ts +8 -4
- package/dist/plugins/remote-env-host.js +7 -9
- package/dist/plugins/remote-env-k8s.d.ts +37 -24
- package/dist/plugins/remote-env-k8s.js +50 -17
- package/dist/plugins/remote-shell.js +12 -2
- package/dist/plugins/retention-store-sql.d.ts +2 -2
- package/dist/plugins/sandbox-read-floor.d.ts +5 -7
- package/dist/plugins/sandbox-read-floor.js +2 -7
- package/dist/plugins/schema-consistency.d.ts +5 -1
- package/dist/plugins/session-fork.d.ts +1 -1
- package/dist/plugins/session-ownership.d.ts +9 -0
- package/dist/plugins/session-ownership.js +6 -0
- package/dist/plugins/session-store.d.ts +13 -16
- package/dist/plugins/session-store.js +9 -10
- package/dist/plugins/sql-errors.d.ts +10 -1
- package/dist/plugins/sql-errors.js +13 -0
- package/dist/plugins/sql-json-column.d.ts +24 -2
- package/dist/plugins/sql-json-column.js +38 -3
- package/dist/plugins/store-backend.d.ts +23 -28
- package/dist/plugins/store-backend.js +12 -3
- package/dist/plugins/store-contracts.d.ts +29 -5
- package/dist/plugins/store-contracts.js +4 -1
- package/dist/plugins/task-attachment-store.d.ts +2 -2
- package/dist/plugins/task-attachment-store.js +37 -52
- package/dist/plugins/tidb-session-store.d.ts +2 -14
- package/dist/plugins/tidb-session-store.js +2 -20
- package/dist/plugins/tool-result-store-sql.d.ts +9 -8
- package/dist/plugins/tool-result-store-sql.js +23 -2
- package/dist/plugins/wiring-section-codec.d.ts +32 -0
- package/dist/plugins/wiring-section-codec.js +55 -0
- package/dist/plugins/workspace-fill.d.ts +1 -1
- package/dist/rule-entry-list.d.ts +3 -2
- package/dist/rule-entry-list.js +5 -1
- package/dist/rules-consent.d.ts +28 -5
- package/dist/rules-consent.js +40 -28
- package/dist/run-local.js +11 -6
- package/dist/runs.d.ts +12 -8
- package/dist/runs.js +10 -7
- package/dist/runtime-governance.d.ts +1 -1
- package/dist/security.d.ts +0 -4
- package/dist/server-secret-env.d.ts +4 -0
- package/dist/session-error-wire.d.ts +34 -23
- package/dist/session-error-wire.js +8 -3
- package/dist/session-incarnation.d.ts +3 -3
- package/dist/session-notify-door.d.ts +106 -0
- package/dist/session-notify-door.js +97 -0
- package/dist/session-sync.d.ts +9 -14
- package/dist/session-sync.js +5 -5
- package/dist/session-workspace.d.ts +3 -13
- package/dist/session-workspace.js +0 -9
- package/dist/standing-answer-grant.d.ts +5 -0
- package/dist/standing-answer-grant.js +10 -0
- package/dist/stores-sql/session-policy-store-sql.d.ts +4 -2
- package/dist/stores-sql/session-policy-store-sql.js +3 -13
- package/dist/task-mcp.d.ts +1 -1
- package/dist/task-settings.d.ts +11 -8
- package/dist/task-settings.js +31 -11
- package/dist/tool-approval.d.ts +55 -35
- package/dist/tool-approval.js +112 -74
- package/dist/trace/core-keyset-guard.d.ts +12 -9
- package/dist/trace/engine-notice-wire.d.ts +1 -1
- package/dist/trace/engine-notice-wire.js +4 -2
- package/dist/trace/exit-seat.d.ts +7 -1
- package/dist/trace/exit-seat.js +1 -0
- package/dist/trace/ledger-sink.d.ts +2 -2
- package/dist/trace/ledger-sink.js +12 -4
- package/dist/trace/model-segment.d.ts +74 -25
- package/dist/trace/model-segment.js +141 -32
- package/dist/trace/project.d.ts +15 -6
- package/dist/trace/project.js +12 -4
- package/dist/trace/redact.d.ts +72 -9
- package/dist/trace/redact.js +1509 -471
- package/dist/trace/self-minted-wire.d.ts +598 -47
- package/dist/trace/self-minted-wire.js +190 -20
- package/dist/trace/wire-projection-faces.d.ts +1 -1
- package/dist/trace/wire-projection-faces.js +1 -1
- package/dist/verifier-pause-card.d.ts +33 -5
- package/dist/verifier-pause-card.js +15 -10
- package/dist/web-admin-client/apply-effective.d.ts +12 -16
- package/dist/web-admin-client/apply-effective.js +90 -10
- package/dist/workspace-space.d.ts +19 -3
- package/dist/workspace-space.js +8 -4
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +3 -1
- package/package.json +3 -2
- package/wire-changes/server@7.143.0.json +1167 -0
- package/wire-changes/server@7.144.0.json +291 -0
- package/dist/session-records-skipped-notice.d.ts +0 -21
- package/dist/session-records-skipped-notice.js +0 -27
|
@@ -5,9 +5,9 @@ import { graftParkToolCallId, markChildrenStoppedByUserOnAbort, syncRefusalHttpS
|
|
|
5
5
|
import { atHostBoundary, sealResultForExit, outwardPlane } from "../../terminal.js";
|
|
6
6
|
import { voidVerifierPauseCard } from "../../verifier-pause-card.js";
|
|
7
7
|
import { withPrincipal } from "../../observability/principal-context.js";
|
|
8
|
-
import { fleetRunPublisher, fleetRunLabels, fleetRunResiduals
|
|
8
|
+
import { fleetRunPublisher, fleetRunLabels, fleetRunResiduals } from "../../fleet/fleet-bus.js";
|
|
9
9
|
import { defaultSubagentTailBus } from "../../fleet/subagent-tail-bus.js";
|
|
10
|
-
import {
|
|
10
|
+
import { createLiveModelText, modelStreamOfTask } from "../../trace/model-segment.js";
|
|
11
11
|
import { emitPendingWorkflowCompletions, taskNotificationInboxEntry, taskNotificationStreamKeyOf, NotifiedKeys } from "../../orchestration/workflow-completion-inbox.js";
|
|
12
12
|
import { createForwardAppendFailedNote, createLedgerSink, createLedgerTwinEmit } from "../../trace/ledger-sink.js";
|
|
13
13
|
import { registerEngineNoticeLeg } from "../../trace/engine-notice-wire.js";
|
|
@@ -16,7 +16,7 @@ import { buildCancelledLedgerRow, createRunAbort, mintCancelledResult } from "..
|
|
|
16
16
|
import { recordResourceWindow } from "../../resource-window.js";
|
|
17
17
|
import { redactSecrets } from "../../trace/redact.js";
|
|
18
18
|
import { writeLiveFrame, writeLiveHeartbeat } from "../live-frame.js";
|
|
19
|
-
import { contextUsageEventData, turnEndEventData, toolStartEventData, toolEndEventData, taskProgressEventData, taskStartedEventData, taskNotificationEventData, compactedEventData, diagnosticsEventData, brainStatusEventData, steeringInjectedEventData, compactionOutcomeEventData, compactionStartedEventData, workspaceChangedEventData, wiringManifestFaceEventData, toolRosterDeltaEventData, toolProgressEventData, toolDisclosureEventData, humanInputEventData, appendModelUsageDelta, attachModelUsage,
|
|
19
|
+
import { contextUsageEventData, turnEndEventData, toolStartEventData, toolEndEventData, taskProgressEventData, taskStartedEventData, taskNotificationEventData, compactedEventData, diagnosticsEventData, brainStatusEventData, steeringInjectedEventData, compactionOutcomeEventData, compactionStartedEventData, workspaceChangedEventData, wiringManifestFaceEventData, toolRosterDeltaEventData, toolProgressEventData, toolDisclosureEventData, humanInputEventData, appendModelUsageDelta, attachModelUsage, liveIdentityFields } from "../../trace/project.js";
|
|
20
20
|
import { cascadeConfig, runMeta } from "../run-meta.js";
|
|
21
21
|
import { idemCallerOf, inflightKeyOf, submissionIdemOf } from "../idempotency.js";
|
|
22
22
|
import { replayOfExistingRun } from "../submit-replay.js";
|
|
@@ -36,12 +36,11 @@ import * as facts from "../../capability-facts.js";
|
|
|
36
36
|
import { persistSubmitCtx } from "../submit-ctx.js";
|
|
37
37
|
import { serviceVersion } from "../../service-version.js";
|
|
38
38
|
import { withModelReachScope } from "../../model-reach-scope.js";
|
|
39
|
-
import { runSkillsOf } from "../../capabilities/skills.js";
|
|
40
39
|
import { createInstructionSelectionLeg } from "../../instruction-selection.js";
|
|
41
40
|
import { fieldConflictFacts } from "../../field-conflict.js";
|
|
42
41
|
import { refusalBody } from "../refusal-body.js";
|
|
43
42
|
import { heldWorkflowParkDecisions } from "../../parked-decide.js";
|
|
44
|
-
import { createSessionWorkspaceRecorder,
|
|
43
|
+
import { createSessionWorkspaceRecorder, sessionWorkspaceStoreOf } from "../../session-workspace.js";
|
|
45
44
|
const DISCONNECT_PARK_GRACE_MS = 10_000;
|
|
46
45
|
async function mintSubmitExitResult(result, checkpoints) {
|
|
47
46
|
return redactTerminalResult(sealResultForExit(await graftParkToolCallId(result, checkpoints)));
|
|
@@ -166,7 +165,7 @@ export async function handleTasks(req, res, match, ctx) {
|
|
|
166
165
|
const wiringOperatorFace = explicitOperatorOk(gatedPrincipal(req, deps.config), deps.config);
|
|
167
166
|
let wiringReceipt;
|
|
168
167
|
const instructionLeg = createInstructionSelectionLeg();
|
|
169
|
-
const legWiringSections = () => ({ instructions: instructionLeg.segment(), skills:
|
|
168
|
+
const legWiringSections = () => ({ instructions: instructionLeg.segment(), skills: prepared.legFacts?.skills });
|
|
170
169
|
const withRunReceipt = (out) => wiringReceipt !== undefined ? { ...out, wiringManifest: wiringReceipt } : out;
|
|
171
170
|
if (liveStream) {
|
|
172
171
|
if (prepared.verify || prepared.cascade) {
|
|
@@ -418,8 +417,8 @@ export async function handleTasks(req, res, match, ctx) {
|
|
|
418
417
|
const streamBody = async () => {
|
|
419
418
|
await withPrincipal(principal, async () => {
|
|
420
419
|
const tailContentMode = prepared.spec.forwardSubagentEvents === true ? "on" : "progress_only";
|
|
421
|
-
const
|
|
422
|
-
const
|
|
420
|
+
const childText = createLiveModelText();
|
|
421
|
+
const topText = createLiveModelText();
|
|
423
422
|
const heldDecisions = await heldWorkflowParkDecisions(deps, prepared.spec.sessionId);
|
|
424
423
|
const fwdInternals = {
|
|
425
424
|
...heldDecisions,
|
|
@@ -433,8 +432,8 @@ export async function handleTasks(req, res, match, ctx) {
|
|
|
433
432
|
}
|
|
434
433
|
if (res.writableEnded)
|
|
435
434
|
return;
|
|
436
|
-
for (const
|
|
437
|
-
writeLiveFrame(res,
|
|
435
|
+
for (const f of childText.onEvent(e))
|
|
436
|
+
writeLiveFrame(res, f);
|
|
438
437
|
const t = e.type;
|
|
439
438
|
if (t === "task_progress") {
|
|
440
439
|
writeLiveFrame(res, { type: "task_progress", ...taskProgressEventData(e) });
|
|
@@ -450,34 +449,20 @@ export async function handleTasks(req, res, match, ctx) {
|
|
|
450
449
|
const te = e;
|
|
451
450
|
writeLiveFrame(res, { type: "tool_end", ...toolEndEventData(te) });
|
|
452
451
|
}
|
|
453
|
-
else if (t === "text_delta") {
|
|
454
|
-
const td = e;
|
|
455
|
-
writeLiveFrame(res, { type: "text_delta", delta: td.delta, ...(td.eventId ? { eventId: td.eventId } : {}), ...(td.parentToolCallId ? { parentToolCallId: td.parentToolCallId } : {}) });
|
|
456
|
-
}
|
|
457
|
-
else if (t === "text_end") {
|
|
458
|
-
const tend = textEndEventData(e);
|
|
459
|
-
if (tend !== null)
|
|
460
|
-
writeLiveFrame(res, { type: "text_end", ...tend });
|
|
461
|
-
}
|
|
462
|
-
else if (t === "reasoning_delta") {
|
|
463
|
-
const rd = e;
|
|
464
|
-
writeLiveFrame(res, { type: "reasoning_delta", delta: redactSecrets(rd.delta), ...(rd.eventId ? { eventId: rd.eventId } : {}), ...(rd.parentToolCallId ? { parentToolCallId: rd.parentToolCallId } : {}) });
|
|
465
|
-
}
|
|
466
452
|
},
|
|
467
453
|
onTaskNotification: (n, opts) => {
|
|
468
454
|
if (n.task_type === "workflow")
|
|
469
455
|
return;
|
|
470
456
|
if (!res.writableEnded)
|
|
471
|
-
for (const
|
|
472
|
-
writeLiveFrame(res,
|
|
457
|
+
for (const f of childText.cut(modelStreamOfTask(n.task_id)))
|
|
458
|
+
writeLiveFrame(res, f);
|
|
473
459
|
defaultSubagentTailBus.forgetHandle(n.task_id);
|
|
474
460
|
if (defaultSubagentTailBus.hasSubscribers(n.task_id)) {
|
|
475
461
|
defaultSubagentTailBus.publish(n.task_id, { type: "task_settled", taskId: n.task_id, status: n.status, ...(typeof n.seq === "number" ? { seq: n.seq } : {}), ...(n.summary ? { summary: redactSecrets(n.summary) } : {}) });
|
|
476
462
|
}
|
|
477
|
-
const hadRow = isFleetAgentTerminalNotification(n) ? (fleetPub?.onChildTerminal(n.sessionId ?? n.task_id, n.status, n.task_id, n.toolUseId) ?? false) : false;
|
|
478
463
|
const deliverable = syncLegLive && !res.writableEnded && !res.destroyed;
|
|
479
464
|
const parked = !deliverable && deps.workflowCompletionInbox !== undefined;
|
|
480
|
-
deps.logger?.info?.("task_notification_observed", { route: "sync-stream", taskId: n.task_id, taskType: n.task_type, status: n.status,
|
|
465
|
+
deps.logger?.info?.("task_notification_observed", { route: "sync-stream", taskId: n.task_id, taskType: n.task_type, status: n.status, legLive: syncLegLive, parkedDurable: parked });
|
|
481
466
|
if (parked) {
|
|
482
467
|
void deps.workflowCompletionInbox.enqueue(taskNotificationInboxEntry(prepared.spec.sessionId, askOwner, n, Date.now(), durableTaskId, opts?.priority)).catch((err) => deps.logger?.warn?.("park_enqueue_failed", { route: "sync-stream", taskId: n.task_id, err: err instanceof Error ? err.message : String(err) }));
|
|
483
468
|
}
|
|
@@ -503,12 +488,12 @@ export async function handleTasks(req, res, match, ctx) {
|
|
|
503
488
|
if (durableTaskId)
|
|
504
489
|
steerableRuns.set(durableTaskId, liveStream);
|
|
505
490
|
prepared.acceptance.attachStream({ reachable: () => !closed && !res.writableEnded && !res.destroyed, write: (frame) => writeLiveFrame(res, { ...frame }) });
|
|
506
|
-
const liveWorkspace = createSessionWorkspaceRecorder(sessionWorkspaceStoreOf(deps.sessionStorage),
|
|
491
|
+
const liveWorkspace = createSessionWorkspaceRecorder(sessionWorkspaceStoreOf(deps.sessionStorage), prepared.legFacts?.sessionWitness);
|
|
507
492
|
for await (const ev of liveStream) {
|
|
508
493
|
if (closed)
|
|
509
494
|
break;
|
|
510
|
-
for (const
|
|
511
|
-
writeLiveFrame(res,
|
|
495
|
+
for (const f of ev.type === "done" ? [...childText.cut(), ...topText.cut()] : topText.onEvent(ev))
|
|
496
|
+
writeLiveFrame(res, f);
|
|
512
497
|
const promptEntryId = promptCommit(ev);
|
|
513
498
|
if (promptEntryId !== undefined)
|
|
514
499
|
userMsgEntryId = promptEntryId;
|
|
@@ -569,8 +554,7 @@ export async function handleTasks(req, res, match, ctx) {
|
|
|
569
554
|
writeLiveFrame(res, { type: "task_notification", ...taskNotificationEventData(ev) });
|
|
570
555
|
}
|
|
571
556
|
}
|
|
572
|
-
else if (ev.type === "
|
|
573
|
-
writeLiveFrame(res, { type: "reasoning_delta", delta: redactSecrets(ev.delta), ...(ev.eventId ? { eventId: ev.eventId } : {}), ...(ev.parentToolCallId ? { parentToolCallId: ev.parentToolCallId } : {}) });
|
|
557
|
+
else if (ev.type === "text_delta" || ev.type === "text_end" || ev.type === "reasoning_delta") {
|
|
574
558
|
}
|
|
575
559
|
else if (ev.type === "task_progress") {
|
|
576
560
|
writeLiveFrame(res, { type: "task_progress", ...taskProgressEventData(ev) });
|
|
@@ -619,25 +603,19 @@ export async function handleTasks(req, res, match, ctx) {
|
|
|
619
603
|
else if (ev.type === "human_input") {
|
|
620
604
|
writeLiveFrame(res, { type: "human_input", ...humanInputEventData(ev) });
|
|
621
605
|
}
|
|
622
|
-
else if (ev.type === "
|
|
606
|
+
else if (ev.type === "turn_end" || ev.type === "message_committed" || ev.type === "context_usage") {
|
|
623
607
|
const e = ev;
|
|
624
608
|
const ident = liveIdentityFields(e);
|
|
625
|
-
const
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
: ev.type === "turn_end"
|
|
632
|
-
? { type: "turn_end", ...turnEndEventData(ev), ...ident }
|
|
633
|
-
: ev.type === "message_committed"
|
|
634
|
-
? { type: "message_committed", entryId: e.entryId, role: e.role, ...(e.toolCallId !== undefined ? { toolCallId: e.toolCallId } : {}), ...ident }
|
|
635
|
-
: { type: "context_usage", ...contextUsageEventData(ev), ...ident };
|
|
636
|
-
if (arm !== null)
|
|
637
|
-
writeLiveFrame(res, arm);
|
|
609
|
+
const arm = ev.type === "turn_end"
|
|
610
|
+
? { type: "turn_end", ...turnEndEventData(ev), ...ident }
|
|
611
|
+
: ev.type === "message_committed"
|
|
612
|
+
? { type: "message_committed", entryId: e.entryId, role: e.role, ...(e.toolCallId !== undefined ? { toolCallId: e.toolCallId } : {}), ...ident }
|
|
613
|
+
: { type: "context_usage", ...contextUsageEventData(ev), ...ident };
|
|
614
|
+
writeLiveFrame(res, arm);
|
|
638
615
|
}
|
|
639
616
|
else {
|
|
640
|
-
|
|
617
|
+
const unknownArm = ev;
|
|
618
|
+
writeLiveFrame(res, { ...unknownArm });
|
|
641
619
|
}
|
|
642
620
|
}
|
|
643
621
|
});
|
|
@@ -959,7 +937,7 @@ export async function handleTasks(req, res, match, ctx) {
|
|
|
959
937
|
const cascadeLeg = () => runCascade(prepared.runner, specWithSignal, cascadeConfig(deps.config.cascadeLadder, prepared.spec.limits?.maxCostUsd), heldDecisions);
|
|
960
938
|
const plainLeg = async () => {
|
|
961
939
|
const stream = prepared.runner.runTaskStream(specWithSignal, undefined, heldDecisions);
|
|
962
|
-
const syncWorkspace = createSessionWorkspaceRecorder(sessionWorkspaceStoreOf(deps.sessionStorage),
|
|
940
|
+
const syncWorkspace = createSessionWorkspaceRecorder(sessionWorkspaceStoreOf(deps.sessionStorage), prepared.legFacts?.sessionWitness);
|
|
963
941
|
for await (const ev of stream) {
|
|
964
942
|
observeSyncLegEvent(ev);
|
|
965
943
|
prepared.acceptance.observe(ev);
|
|
@@ -977,7 +955,7 @@ export async function handleTasks(req, res, match, ctx) {
|
|
|
977
955
|
inflightRuns.delete(durableTaskId);
|
|
978
956
|
}
|
|
979
957
|
const syncAbortCause = syncCancelCtrl.cause();
|
|
980
|
-
await voidVerifierPauseCard(result,
|
|
958
|
+
await voidVerifierPauseCard(result, prepared.runner);
|
|
981
959
|
if (syncAbortCause !== undefined) {
|
|
982
960
|
result = mintCancelledResult({
|
|
983
961
|
taskId: durableTaskId ?? "",
|
package/dist/http/server.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import type { PeerDesk, PeerLease } from "../peer-seat.js";
|
|
|
12
12
|
import type { ExecutionRoot, ResolvedTaskSpec } from "./execution-context.js";
|
|
13
13
|
import type { RunStore, ImageIndex, ImageBake, CheckpointStoreFull, ResumeAnchorStore, ApprovalExemptionStore, ApprovalNonceStore, ServiceSessionPolicyStore, ServiceFileHistoryStore, ToolResultStoreFull, StoreBackend } from "../plugins/store-backend.js";
|
|
14
14
|
import type { RuleConsentLane } from "../rules-consent.js";
|
|
15
|
-
import { type
|
|
15
|
+
import { type MemorySyncAnswer, type MemorySyncRequest } from "../memory-sync.js";
|
|
16
16
|
import type { MemorySyncRunner } from "../memory-sync-client.js";
|
|
17
17
|
import type { TaskAttachmentStore } from "../plugins/task-attachment-store.js";
|
|
18
18
|
import type { LeaderEndpoint } from "../leader/endpoint.js";
|
|
@@ -38,6 +38,7 @@ import { cascadeConfig } from "./run-meta.js";
|
|
|
38
38
|
export { cascadeConfig };
|
|
39
39
|
import { coarseStatusForState, errorCodeForExit } from "./routes/images.js";
|
|
40
40
|
export { coarseStatusForState, errorCodeForExit };
|
|
41
|
+
import type { SessionNotifyDoor } from "../session-notify-door.js";
|
|
41
42
|
import { MAX_SKILL_CONTENT_CHARS, MAX_SYSTEM_PROMPT_CHARS, MAX_OUTPUT_SCHEMA_CHARS, validateUserSkills } from "./admission.js";
|
|
42
43
|
import { routeLabel, isBillableSubmitPath, isCredentialGatedRewrite, isMethodDispatchedSubmitPath } from "./route-table.js";
|
|
43
44
|
export { routeLabel, isBillableSubmitPath, isCredentialGatedRewrite, isMethodDispatchedSubmitPath, hasServiceAuth };
|
|
@@ -139,11 +140,11 @@ export interface ServiceCoreDeps {
|
|
|
139
140
|
execution: ExecutionRoot;
|
|
140
141
|
}) => ResolvedTaskSpec | Promise<ResolvedTaskSpec>;
|
|
141
142
|
/**
|
|
142
|
-
* [ref] 场景 hands lane 选路:按 `resolveSpec`
|
|
143
|
-
*
|
|
144
|
-
*
|
|
143
|
+
* [ref] 场景 hands lane 选路:按 `resolveSpec` 刚产出的那一只对象取本任务的执行 Runner —— 两只漏斗(受理 / 续跑)在盖根复制
|
|
144
|
+
* (`stampSpecRoot`)之前以装配输出调它,不交复制品。装配点(`boot/stage-10-http-server.ts`)传的是 `createHandsRunnerSelector`
|
|
145
|
+
* (读这条腿的部署事实里的车道,`leg-facts.ts`)—— 选路规则只有那一份实现,本层不解释场景,只取用。
|
|
145
146
|
* 🔴 **必填**([ref],7.105.0):修前这一席可选,缺席 ⇒ 静默落 {@link ServiceDeps.runner} —— 最宽的那只
|
|
146
|
-
* (带全量手的主 Runner)
|
|
147
|
+
* (带全量手的主 Runner)。而同一轴上「车道读不到」早已是拒(选路器抛
|
|
147
148
|
* `HandsLaneUnstampedError`),席缺席回落最宽 = 同一件事两条律。现在缺席是**编译错**;绕过类型
|
|
148
149
|
* (JS 嵌入方 / `as` 硬转)造的 deps 在 {@link createHttpServer} 入口**拒启**。单 Runner 的嵌入方显式传
|
|
149
150
|
* `runnerFor: () => runner` —— 那是一句表态,不是一个回落。
|
|
@@ -480,12 +481,12 @@ export interface ServiceSeamDeps {
|
|
|
480
481
|
routeJudgeBrain?: Pick<Brain, "adjudicateRoute">;
|
|
481
482
|
/** 142-S2.5(设计 §2.5;裁定 plan 随数据走,core 零运行时半场):one full sync round for one
|
|
482
483
|
* (scope, peer) — main.ts wires `performMemorySync` over the DB memory backend + the sync-cursor
|
|
483
|
-
* store. Enables POST /
|
|
484
|
+
* store. Enables POST /v2/memory/sync/:scope — present ONLY on a DB memory plane
|
|
484
485
|
* (MEMORY_ENGINE_BACKEND=pg|mysql); absent ⇒ 501 honestly (a single-user file plane
|
|
485
486
|
* IS the TOC side of a sync — it has no central-authority half to serve). [ref]: the face also needs the center's
|
|
486
487
|
* declared sync identity (`config.memorySyncServeIdentity`) — the gate and the capability bit `memorySyncServe` read ONE
|
|
487
488
|
* fact (`capability-facts.ts` `memorySyncServe`). */
|
|
488
|
-
memorySync?: (scope: string, syncReq: MemorySyncRequest) => Promise<
|
|
489
|
+
memorySync?: (scope: string, syncReq: MemorySyncRequest) => Promise<MemorySyncAnswer>;
|
|
489
490
|
/** [ref] v2-c(core 5.40.0 `MemoryEngine.exportMemoryScopes`):治理完备包的**携出**面。main.ts 把它接到
|
|
490
491
|
* 装配好的 memory engine 上。启用 `POST /v1/memory/export`(operator-only)。
|
|
491
492
|
* 🔴 缺席 = 这个部署**没有记忆引擎**(`MEMORY_ENGINE=off` / 多租 file 底座等暗态)⇒ 501
|
|
@@ -767,6 +768,9 @@ export interface ServiceDeploymentDeps {
|
|
|
767
768
|
* `candidateRejectionState: () => webAdmin.candidateRejectionState()`;座 = web-admin 的 `candidateRejection`,`config_candidate_rejected` 日志行的去重键读同一份)。
|
|
768
769
|
* present-iff 当前生效配置是因候选被拒而回落的那一份;缺席 / 返回 undefined = 没有被拒的候选或没有配置管道 ⇒ `GET /v1/models` 不出该键(additive)。 */
|
|
769
770
|
candidateRejectionState?: () => import("../web-admin-client/candidate-gate.js").CandidateRejection | undefined;
|
|
771
|
+
/** `GET /v1/models.modelPlane.planeRefusalCode` 与 `catalog` 模型面那一半的取值口(`boot/stage-10-http-server.ts` → `latestPlaneRefusalState: () => webAdmin.latestPlaneRefusalState()`):
|
|
772
|
+
* 最新到达的目录候选被模型面组拒的码。缺席 / 返回 undefined = 最新到达的候选没有被模型面组拒,或没有配置管道 ⇒ 读面不出该键。 */
|
|
773
|
+
latestPlaneRefusalState?: () => import("@sema-agent/settings-schema").ModelPlaneRefusalCode | undefined;
|
|
770
774
|
/** `/health.configHandoff`(只上 `/health`):在场 ⇔ 部署声明了耐久接力 ∧ 应用着的那一代没被确认(web-admin 接力账的 `configHandoffState()`;合成律
|
|
771
775
|
* `fleet/engine-signal.ts` 的 `buildConfigHandoff`)。缺席 / 返回 undefined = 有接力、没有中心或本地腿 ⇒ 键缺席。 */
|
|
772
776
|
configHandoffState?: () => import("../fleet/engine-signal.js").ConfigHandoff | undefined;
|
|
@@ -917,6 +921,8 @@ export declare function createHttpServer(rawDeps: ServiceDeps): http.Server & {
|
|
|
917
921
|
isRunLiveOnThisReplica: (taskId: string) => boolean;
|
|
918
922
|
/** [ref]:live 回决腿的 PARKED 赎回席(装配层把它接进协调器的晚绑座,见 {@link redeemParkedAsk})。 */
|
|
919
923
|
redeemParkedAsk: ParkedAskRedeem;
|
|
924
|
+
/** 会话通知门(装配层把它接进场景层后台完成 sink 的晚绑座;门与律见 `session-notify-door.ts`)。 */
|
|
925
|
+
sessionNotifyDoor: SessionNotifyDoor;
|
|
920
926
|
};
|
|
921
927
|
/** SSE: replay durable events after Last-Event-ID, then tail until the run is terminal (or stale). */
|
|
922
928
|
/**
|
package/dist/http/server.js
CHANGED
|
@@ -152,7 +152,7 @@ export function createHttpServer(rawDeps) {
|
|
|
152
152
|
}
|
|
153
153
|
const { quotaExceeded, ownerCostQuotaDenied, ownerFleetLeaseDenied, ownerLeaseDenied, ownerQuotaDenied, leaseDenied, usageWindowDenialFor, usageWindowDenied, rateLimited, safeDecode, runOwnerOk, sessionOwnerOk, runSessionAcceptOk, readJson, readRawBody } = createRequestGuards({ deps });
|
|
154
154
|
const { prepareSpec } = createAdmission({ deps, readJson, runnerFor });
|
|
155
|
-
const { routeCtxBase, resumeCheckpoint, driveResumeIntoRunLog, driveResumeLeg, mayDiscloseRowError, resumePreempted, startFreshHostTurn, resumeWake } = createResumeLegs({ deps, runnerFor, idemCache, inflightRuns, preemptableRuns, steerableRuns, wakeParkMints, counters, readJson, readRawBody, rateLimited, quotaExceeded, ownerQuotaDenied, leaseDenied, ownerLeaseDenied, usageWindowDenied, safeDecode, runOwnerOk, sessionOwnerOk, runSessionAcceptOk, prepareSpec, finalizeTaskResult, ownerCostQuotaDenied, ownerFleetLeaseDenied, usageWindowDenialFor });
|
|
155
|
+
const { routeCtxBase, resumeCheckpoint, driveResumeIntoRunLog, driveResumeLeg, mayDiscloseRowError, resumePreempted, startFreshHostTurn, resumeWake, sessionNotifyDoor } = createResumeLegs({ deps, runnerFor, idemCache, inflightRuns, preemptableRuns, steerableRuns, wakeParkMints, counters, readJson, readRawBody, rateLimited, quotaExceeded, ownerQuotaDenied, leaseDenied, ownerLeaseDenied, usageWindowDenied, safeDecode, runOwnerOk, sessionOwnerOk, runSessionAcceptOk, prepareSpec, finalizeTaskResult, ownerCostQuotaDenied, ownerFleetLeaseDenied, usageWindowDenialFor });
|
|
156
156
|
const { denyExpiredApprovals, redeemParkedAsk } = createApprovalSweeps({ deps, resumeCheckpoint, mayDiscloseRowError });
|
|
157
157
|
const { handle } = createDispatch({ deps, noteActivity, routeCtxBase, counters });
|
|
158
158
|
const server = http.createServer((req, res) => {
|
|
@@ -206,6 +206,6 @@ export function createHttpServer(rawDeps) {
|
|
|
206
206
|
deps.planCacheProbe?.record(principal, objective, result.terminal.kind === "completed");
|
|
207
207
|
}
|
|
208
208
|
const isRunLiveOnThisReplica = (taskId) => inflightRuns.has(taskId) || steerableRuns.has(taskId);
|
|
209
|
-
return Object.assign(server, { denyExpiredApprovals, isRunLiveOnThisReplica, redeemParkedAsk });
|
|
209
|
+
return Object.assign(server, { denyExpiredApprovals, isRunLiveOnThisReplica, redeemParkedAsk, sessionNotifyDoor });
|
|
210
210
|
}
|
|
211
211
|
//# sourceMappingURL=server.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { REQUEST_SETTINGS_REFUSAL_PREFIX, SETTINGS_RULE_REFUSAL_CODE, neverAutoNamesRefusal, rulePolicyBucketsRefusal, settingsPermissionBucketIssue, storedBodyPermissionMode } from "../task-settings.js";
|
|
1
|
+
import { REQUEST_SETTINGS_REFUSAL_PREFIX, SETTINGS_PERMISSION_BUCKETS, SETTINGS_RULE_REFUSAL_CODE, neverAutoNamesRefusal, rulePolicyBucketsRefusal, settingsPermissionBucketIssue, storedBodyPermissionMode } from "../task-settings.js";
|
|
2
2
|
import { readTightenOnlySeats, tightenOnlySeatField, tightenOnlySeatIssue } from "../tighten-only-seats.js";
|
|
3
3
|
import { entryProblemsFacts } from "../entry-problems.js";
|
|
4
4
|
import { autonomyModeFloor, entryPermissionMode } from "../runtime-governance.js";
|
|
@@ -15,6 +15,11 @@ export function permissionModeReadingUnstated(ctx, floor) {
|
|
|
15
15
|
}
|
|
16
16
|
const RETIRED_KEY_REWRITE_MIGRATION = { promptProfile: "M30" };
|
|
17
17
|
const BUCKET_GATE_CODE = "request.field_invalid";
|
|
18
|
+
const BUCKET_SIDE = {
|
|
19
|
+
"settings.permissions.allow": "allow",
|
|
20
|
+
"settings.permissions.deny": "deny",
|
|
21
|
+
"settings.permissions.ask": "deny",
|
|
22
|
+
};
|
|
18
23
|
function storedPermissions(body) {
|
|
19
24
|
const permissions = body?.settings?.permissions;
|
|
20
25
|
return permissions !== null && typeof permissions === "object" && !Array.isArray(permissions) ? permissions : undefined;
|
|
@@ -23,7 +28,7 @@ function storedPermissionBucketRefusal(body) {
|
|
|
23
28
|
const issue = settingsPermissionBucketIssue(storedPermissions(body));
|
|
24
29
|
if (issue === null)
|
|
25
30
|
return undefined;
|
|
26
|
-
return replayInertEntry(issue.fields.field, issue.fields.field
|
|
31
|
+
return replayInertEntry(issue.fields.field, BUCKET_SIDE[issue.fields.field], BUCKET_GATE_CODE, issue.message, { ...issue.fields });
|
|
27
32
|
}
|
|
28
33
|
function storedTightenOnlySeatRefusal(body) {
|
|
29
34
|
const issue = tightenOnlySeatIssue(body?.settings);
|
|
@@ -37,9 +42,15 @@ function storedRulePolicyRefusal(body, deployment) {
|
|
|
37
42
|
return undefined;
|
|
38
43
|
const home = executionLaneHomeDir(deployment);
|
|
39
44
|
const configRoot = executionConfigRootOf(deployment);
|
|
40
|
-
const
|
|
45
|
+
const buckets = {};
|
|
46
|
+
for (const bucket of SETTINGS_PERMISSION_BUCKETS) {
|
|
47
|
+
const entries = permissions[bucket];
|
|
48
|
+
if (Array.isArray(entries))
|
|
49
|
+
buckets[bucket] = entries;
|
|
50
|
+
}
|
|
51
|
+
const refused = rulePolicyBucketsRefusal(buckets, { ...(home !== undefined ? { home } : {}), ...(configRoot !== undefined ? { configRoot } : {}) });
|
|
41
52
|
if (refused !== undefined)
|
|
42
|
-
return replayInertEntry(`settings.permissions.${refused.bucket}`,
|
|
53
|
+
return replayInertEntry(`settings.permissions.${refused.bucket}`, BUCKET_SIDE[`settings.permissions.${refused.bucket}`], SETTINGS_RULE_REFUSAL_CODE, `${REQUEST_SETTINGS_REFUSAL_PREFIX}${refused.message}`, { ...entryProblemsFacts(refused.problems) });
|
|
43
54
|
const neverAuto = readTightenOnlySeats({ permissions }).values.neverAuto;
|
|
44
55
|
if (neverAuto === undefined)
|
|
45
56
|
return undefined;
|
|
@@ -587,18 +587,28 @@ export interface TaskRequestBody {
|
|
|
587
587
|
enableFork?: boolean;
|
|
588
588
|
[k: string]: unknown;
|
|
589
589
|
}
|
|
590
|
-
/** [ref] D-1
|
|
591
|
-
*
|
|
592
|
-
*
|
|
590
|
+
/** [ref] D-1 —— **一个答案只属于它被展示的那一个动作**:决断方在队列行上看到的那一对(`GET /v1/approvals` 行的 `boundCallId` /
|
|
591
|
+
* `boundInputHash`),原样回显、从不重算,引擎在认领前逐字比对。本服务从不拿当前停驻行替决断方补任何一位 —— 补上的是此刻停在门上的动作,
|
|
592
|
+
* 不是决断方看到的那一个。判官 = `http/resume-legs.ts` 的 `decidedActionOf`。 */
|
|
593
|
+
export type DecidedAction = {
|
|
594
|
+
/** The pendingAction.toolCallId the decider saw — echoed into ResumeOutcome.boundCallId. */
|
|
595
|
+
readonly boundCallId: string;
|
|
596
|
+
/** The engine-minted opaque boundInputHash the decider saw — echoed VERBATIM (never recomputed here). */
|
|
597
|
+
readonly boundInputHash: string;
|
|
598
|
+
};
|
|
599
|
+
/** [ref] D-1: the decision-action binding as read off POST /v1/approvals/:sessionId/decide([ref]C-4:裸 :id 臂已删).
|
|
600
|
+
* The body's value-shape gate only checks "a string when present"; the pair {@link DecidedAction} is REQUIRED and judged by the
|
|
601
|
+
* resume leg after its gate-kind guard (a wrong gate kind gets its 409 pointer first): either half missing ⇒ 400
|
|
602
|
+
* `decide_requires_binding` naming `missingKeys`. 7.142.x and earlier filled a missing half from the current pending row.
|
|
593
603
|
* [ref] A9: hoisted VERBATIM out of `createHttpServer`'s closure so the approvals/assistant route domain
|
|
594
604
|
* and the resume leg can name the SAME shape without a routes/* → server.ts value edge. */
|
|
595
605
|
export type DecideBinding = {
|
|
596
|
-
/** The capability token the
|
|
597
|
-
* ⇒ approval_stale (they decided a superseded/resolved view). */
|
|
606
|
+
/** The capability token the decider saw (never surfaced on the queue row; the server-internal seats hold it). A mismatch
|
|
607
|
+
* with the current pending ⇒ approval_stale (they decided a superseded/resolved view). Optional, and never a substitute for the pair. */
|
|
598
608
|
checkpointToken?: string;
|
|
599
|
-
/**
|
|
609
|
+
/** {@link DecidedAction.boundCallId} as echoed (required for a decision; see the type note). */
|
|
600
610
|
boundCallId?: string;
|
|
601
|
-
/**
|
|
611
|
+
/** {@link DecidedAction.boundInputHash} as echoed (required for a decision; see the type note). */
|
|
602
612
|
boundInputHash?: string;
|
|
603
613
|
/** [ref] edit: operator-corrected tool args, applied by core AFTER the binding check, on approve only. */
|
|
604
614
|
updatedInput?: unknown;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { createBrain } from "./brain.js";
|
|
|
4
4
|
export { createSessionStore } from "./plugins/session-store.js";
|
|
5
5
|
export { createStoreBackend, type StoreBackend, type SessionCaptureRecordSource } from "./plugins/store-backend.js";
|
|
6
6
|
export { RetiredSchemaPresentError } from "./plugins/schema-consistency.js";
|
|
7
|
+
export { LocalDataRootSchemaMismatchError, type LocalSidecarMismatch } from "./plugins/local-session-store.js";
|
|
7
8
|
export { CachingSessionStore, type CachingOptions } from "./plugins/caching-session-store.js";
|
|
8
9
|
export type { RunRecord, RunEvent } from "./plugins/store-contracts.js";
|
|
9
10
|
export { runInBackground } from "./runs.js";
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { createBrain } from "./brain.js";
|
|
|
4
4
|
export { createSessionStore } from "./plugins/session-store.js";
|
|
5
5
|
export { createStoreBackend } from "./plugins/store-backend.js";
|
|
6
6
|
export { RetiredSchemaPresentError } from "./plugins/schema-consistency.js";
|
|
7
|
+
export { LocalDataRootSchemaMismatchError } from "./plugins/local-session-store.js";
|
|
7
8
|
export { CachingSessionStore } from "./plugins/caching-session-store.js";
|
|
8
9
|
export { runInBackground } from "./runs.js";
|
|
9
10
|
export { createHardenedVmRunner, runInHardenedVm } from "./orchestration/hardened-vm-runner.js";
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
* · **有主张 ⇒ 证**:座 = 主张原样(下单门与引擎 prepare 在环境开起来之前就要基);开环境那一拍读一次(与命令同一条 shell、同一份 env:
|
|
16
16
|
* `printf %s "$HOME"`;host 直接读它自己组合给子进程的那份 env),两者不一致 ⇒ 这只执行环境不开(拒句点名两值与改法),环境答了的判定记在环境上
|
|
17
17
|
* (同一镜像 / 同一目标机再问也是同一个答案,不重试成风暴);读不出同样不开(证不了主张 = 不拿一个没证过的目录去守),但不记 —— 与任何一次建连失败同,下一次重问。
|
|
18
|
+
* 「不开」落在读数到手的那一刻:读数在铸环境时就到手的车道(host:读数是适配器自己组合给子进程的那份 env)⇒ 环境**不铸** —— 构造抛带码的拒
|
|
19
|
+
* ({@link laneHomeRefusal},码 `env.home_unconfirmed`),工厂原样抛出,引擎在准备期再抛、不建环境,run 的失败终局原样承运码与句:没有命令、没有读边界判,
|
|
20
|
+
* 任何形状的命令都是同一首拒;读数要环境起来才有的车道(远端五条)⇒ 开环境那一拍拒,环境的门回同一句。
|
|
18
21
|
* · **没主张 ⇒ 实测**:同一拍问同一句;答出绝对路径 ⇒ 座 = 它,之后不再问;
|
|
19
22
|
* · **实测也缺席**(问不出 / 答的不是绝对路径,含空串)⇒ 座缺席(引擎失败关闭,不猜、不补 `/`),环境照开(没主张就没有主张可拒),一行 warn(点名读到了什么与出路)。
|
|
20
23
|
* 读不了家目录的车道(device:设备协议没有读数)不持座 —— 声明就是座,起服披露「来自声明、未实测」(`execution-lane-caps.ts` `buildLaneHomeBootNote`)。
|
|
@@ -68,6 +71,18 @@ export type LanePathFlavor = "posix" | "win32";
|
|
|
68
71
|
* 次序:读不出 → 不是绝对路径 → 一致 → 不一致(「绝对」先于「一致」:主张自己是相对串时,一个同样相对的读数也不放行)。
|
|
69
72
|
*/
|
|
70
73
|
export declare function judgeLaneHome(lane: string, claim: LaneHomeClaim, probe: LaneHomeProbe, paths?: LanePathFlavor): LaneHomeVerdict;
|
|
74
|
+
/**
|
|
75
|
+
* 本仓自铸的**执行环境拒码**闭集(`env.*` 族;今天一员)—— 一只执行环境在交给引擎之前就被拒时,工厂抛出的错带的 `code`。引擎在准备期原样再抛、不建环境,
|
|
76
|
+
* run 的 `failed` 终局原样承运码与句;同步提交腿按零工作拒落档(`runs.ts` 的 `EXECUTION_ENV_REFUSAL_HTTP_STATUS`,按本闭集键控:加一员而档没跟 ⇒ tsc 红)。
|
|
77
|
+
* · `env.home_unconfirmed` —— 家目录主张证不了({@link judgeLaneHome} 的三形拒句:读不出 / 不是绝对路径 / 与实测不一致)。三形一个码:出路都在部署
|
|
78
|
+
* (声明、环境里的 `HOME`,或会话 `settings.env` 里的 `HOME`),消费端不按形分岔;是哪一形、怎么改,句子里说。
|
|
79
|
+
*/
|
|
80
|
+
export declare const EXECUTION_ENV_REFUSAL_CODES: readonly ["env.home_unconfirmed"];
|
|
81
|
+
export type ExecutionEnvRefusalCode = (typeof EXECUTION_ENV_REFUSAL_CODES)[number];
|
|
82
|
+
/** 家目录拒的带码错误:句 = 判官的拒句原文,码 = `env.home_unconfirmed`。读数在铸环境时就到手的车道(host)构造时抛它,工厂原样抛出。 */
|
|
83
|
+
export declare function laneHomeRefusal(verdict: NonNullable<LaneHomeVerdict>): Error & {
|
|
84
|
+
readonly code: Extract<ExecutionEnvRefusalCode, "env.home_unconfirmed">;
|
|
85
|
+
};
|
|
71
86
|
/** 起服与每只环境「家目录答不出」那一行 warn 的事件名 —— 一只 code,起服(车道读不了)与环境(实测缺席)共用。 */
|
|
72
87
|
export declare const LANE_HOME_UNDECLARED_EVENT = "execution_lane_home_undeclared";
|
|
73
88
|
/**
|
package/dist/lane-home-probe.js
CHANGED
|
@@ -61,6 +61,10 @@ export function judgeLaneHome(lane, claim, probe, paths = "posix") {
|
|
|
61
61
|
answered: true,
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
+
export const EXECUTION_ENV_REFUSAL_CODES = ["env.home_unconfirmed"];
|
|
65
|
+
export function laneHomeRefusal(verdict) {
|
|
66
|
+
return Object.assign(new Error(verdict.refusal), { code: "env.home_unconfirmed" });
|
|
67
|
+
}
|
|
64
68
|
export const LANE_HOME_UNDECLARED_EVENT = "execution_lane_home_undeclared";
|
|
65
69
|
const HOME_ABSENT_COST = "the engine cannot place its home-anchored read-deny rows, so every contents-disclosing recursive read (grep -r, rg, git grep, tar c, …) asks a person on the full shell — " +
|
|
66
70
|
"no allow rule, mode or bypass releases that question — and is refused on the read-only face, so unattended tasks cannot search code; \"~/\" permission rules are refused at submission.";
|
package/dist/leader/leader.js
CHANGED
|
@@ -4,6 +4,7 @@ import { pullDiff } from "./diffout.js";
|
|
|
4
4
|
import { mergeBranches } from "./merge.js";
|
|
5
5
|
import { Runner, runWithVerification, resumeWithVerification } from "@sema-agent/core";
|
|
6
6
|
import { pausedCauseOf, outwardPlane } from "../terminal.js";
|
|
7
|
+
import { voidVerifierPauseCard } from "../verifier-pause-card.js";
|
|
7
8
|
import { entryPermissionMode } from "../runtime-governance.js";
|
|
8
9
|
import { withUnattendedLeg } from "../unattended-permission-mode.js";
|
|
9
10
|
const MAX_RESUME_SLICES = 200;
|
|
@@ -93,11 +94,13 @@ export async function runLeaderTask(task, durableBaseSha, deps) {
|
|
|
93
94
|
const w = bySession.get(st.sessionId);
|
|
94
95
|
const base = { workerId: w.workerId, sessionId: w.sessionId, branch: w.branch, baseSha: w.baseSha };
|
|
95
96
|
const cfg = w.verifierTools ? { ...verify, verifierTools: w.verifierTools } : verify;
|
|
96
|
-
|
|
97
|
+
const workerRunner = w.runner;
|
|
98
|
+
let vr = await runWithVerification(workerRunner, { ...w.spec, sessionId: w.sessionId, signal }, cfg);
|
|
97
99
|
vr = await autoResumeOnResource(vr, signal, async (token, slice) => {
|
|
98
100
|
deps.logger?.info?.("worker_resource_resume", { workerId: w.workerId, slice });
|
|
99
|
-
return resumeWithVerification(
|
|
101
|
+
return resumeWithVerification(workerRunner, token, { gate: "resource_limit", decision: "continue" }, { ...w.spec, sessionId: w.sessionId, signal }, w.spec.objective ?? "", cfg);
|
|
100
102
|
});
|
|
103
|
+
await voidVerifierPauseCard(vr, workerRunner);
|
|
101
104
|
const vrPlane = outwardPlane(vr.terminal);
|
|
102
105
|
deps.logger?.info?.("verify_outcome", { workerId: w.workerId, status: vrPlane.status, verdict: vr.verification.verdict, rounds: vr.verification.rounds, finding: redactHead(vr.verification.findings[0] ?? "", 220) });
|
|
103
106
|
const pass = vr.terminal.kind === "completed" && vr.verification.verdict === "PASS";
|
package/dist/leader/wire.d.ts
CHANGED
|
@@ -138,6 +138,10 @@ export interface LeaderWireConfig {
|
|
|
138
138
|
brain: Brain;
|
|
139
139
|
models: Record<string, Model>;
|
|
140
140
|
roles: ModelRoles;
|
|
141
|
+
/** The active tier table of the served catalog (boot hands the same object as `config.tiers`, mutated in place on a hot apply).
|
|
142
|
+
* Every leader Runner gets it with `models` / `roles` (one seat, `servedTableSeat`): a role resolves in the tier-expanded view,
|
|
143
|
+
* exactly as the main runner resolves it — absent ⇒ no tiers (the env table has none). */
|
|
144
|
+
tiers?: NonNullable<RunnerDeps["tiers"]>;
|
|
141
145
|
pricing: Record<string, ModelPricing>;
|
|
142
146
|
/** Workspace root inside each E2B VM. Default /home/user. */
|
|
143
147
|
workspace?: string;
|
|
@@ -152,7 +156,9 @@ export interface LeaderWireConfig {
|
|
|
152
156
|
* classification; running it on a heavy reasoning model (deepseek-v4-pro + reasoning) returns an EMPTY
|
|
153
157
|
* completion ~2/3 of the time — the budget is spent on reasoning with no answer text → "not valid JSON" →
|
|
154
158
|
* collapse-to-single, silently defeating fan-out (search 2026-06-14, reproduced 3×). A cheap non-reasoning
|
|
155
|
-
* model (deepseek-v4-flash) routes correctly 51/51 in probes. Unset → the route
|
|
159
|
+
* model (deepseek-v4-flash) routes correctly 51/51 in probes. Unset → the route resolves the `classifier` role
|
|
160
|
+
* in the served table (the same `models` / `roles` every task of this leader resolves against; core's fallback
|
|
161
|
+
* chain classifier → summarize → default: the env cheap slot binds `summarize`, an adopted catalog binds its own). */
|
|
156
162
|
routerModel?: string;
|
|
157
163
|
/** Max bounded integration-repair rounds on a clean-merge-but-failing-build (see merge.ts IntegrationRepair).
|
|
158
164
|
* 0 / unset = OFF (a failing integration test is terminal, the pre-2026-06-14 behavior). Env override:
|
package/dist/leader/wire.js
CHANGED
|
@@ -168,6 +168,7 @@ export function createLeaderRunner(cfg) {
|
|
|
168
168
|
const deploymentPostureSeat = () => cfg.deploymentPosture?.() ?? {};
|
|
169
169
|
const tracerSeat = cfg.tracer ? { tracer: cfg.tracer } : {};
|
|
170
170
|
const modsSeat = cfg.mods ? { mods: cfg.mods } : {};
|
|
171
|
+
const servedTableSeat = { models: cfg.models, roles: cfg.roles, ...(cfg.tiers ? { tiers: cfg.tiers } : {}) };
|
|
171
172
|
const usageWindowSeat = cfg.usageWindows && cfg.usageWindowStore ? { usageWindows: cfg.usageWindows, usageWindowStore: cfg.usageWindowStore } : {};
|
|
172
173
|
const promptSourceSeat = cfg.promptSource ? { promptSource: cfg.promptSource } : {};
|
|
173
174
|
const onErrorSeat = cfg.onError ? { onError: cfg.onError } : {};
|
|
@@ -188,7 +189,7 @@ export function createLeaderRunner(cfg) {
|
|
|
188
189
|
throw new Error(`oracle still present after remove (${f.path}) — refusing repair (measurement integrity)`);
|
|
189
190
|
}
|
|
190
191
|
try {
|
|
191
|
-
const runner = new Runner({ brain: cfg.brain,
|
|
192
|
+
const runner = new Runner({ brain: cfg.brain, ...servedTableSeat, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat(), ...tracerSeat, ...usageWindowSeat, ...promptSourceSeat, ...onErrorSeat, ...modsSeat, executionEnv: rawEnv, rootPath: repoDir });
|
|
192
193
|
const objective = [
|
|
193
194
|
`The integrated project at ${repoDir} fails its build/test. Make the MINIMAL change to the working tree so this command exits 0 (cd into the repo and run it yourself to confirm):`,
|
|
194
195
|
` ${testCmd}`,
|
|
@@ -255,13 +256,13 @@ export function createLeaderRunner(cfg) {
|
|
|
255
256
|
if (Array.isArray(body.subtasks) && body.subtasks.length > 0) {
|
|
256
257
|
return validateSubtasks(body.subtasks);
|
|
257
258
|
}
|
|
258
|
-
const planRunner = new Runner({ brain: cfg.brain,
|
|
259
|
+
const planRunner = new Runner({ brain: cfg.brain, ...servedTableSeat, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat(), ...tracerSeat, ...usageWindowSeat, ...promptSourceSeat, ...onErrorSeat, ...modsSeat });
|
|
259
260
|
const runRoute = async (prompt) => {
|
|
260
261
|
const res = await planRunner.runTaskStream({
|
|
261
262
|
objective: prompt,
|
|
262
263
|
...principalSpec(),
|
|
263
264
|
sessionId: `leader-route-${Date.now()}`,
|
|
264
|
-
...(cfg.routerModel ? { model: cfg.routerModel } : {}),
|
|
265
|
+
...(cfg.routerModel ? { model: cfg.routerModel } : { modelRole: "classifier" }),
|
|
265
266
|
}).result();
|
|
266
267
|
return res.result ?? "";
|
|
267
268
|
};
|
|
@@ -349,7 +350,7 @@ export function createLeaderRunner(cfg) {
|
|
|
349
350
|
workerId: sub.workerId, sessionId, branch: sub.branch,
|
|
350
351
|
baseSha,
|
|
351
352
|
runner: keepCtxWarm(new Runner({
|
|
352
|
-
brain: cfg.brain,
|
|
353
|
+
brain: cfg.brain, ...servedTableSeat, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat(), ...tracerSeat, ...usageWindowSeat, ...promptSourceSeat, ...onErrorSeat, ...modsSeat,
|
|
353
354
|
...(cfg.toolResultStore ? { toolResultStore: cfg.toolResultStore } : {}),
|
|
354
355
|
...(cfg.sessionStore ? { sessionStore: cfg.sessionStore } : {}),
|
|
355
356
|
executionEnvFactory: async (ctx) => {
|
|
@@ -374,7 +375,7 @@ export function createLeaderRunner(cfg) {
|
|
|
374
375
|
const baseSha = await sh(env)(`cd ${repo} && git rev-parse HEAD`);
|
|
375
376
|
return {
|
|
376
377
|
workerId: sub.workerId, sessionId, branch: sub.branch, baseSha,
|
|
377
|
-
runner: keepCtxWarm(new Runner({ brain: cfg.brain,
|
|
378
|
+
runner: keepCtxWarm(new Runner({ brain: cfg.brain, ...servedTableSeat, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat(), ...tracerSeat, ...usageWindowSeat, ...promptSourceSeat, ...onErrorSeat, ...modsSeat, ...(cfg.toolResultStore ? { toolResultStore: cfg.toolResultStore } : {}), ...(cfg.sessionStore ? { sessionStore: cfg.sessionStore } : {}), executionEnv: env })),
|
|
378
379
|
diffEnv: env,
|
|
379
380
|
destroy: () => env.destroy().then(() => { }),
|
|
380
381
|
spec: withLeaderLeg({ ...workerLimits, ...sub.spec, ...durableSpec, ...resourceSpec, ...principalSpec() }, resumeBody),
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 一条腿的**部署事实**(执行车道 · run 技能名册 · 受理见证)—— server 自有的载体,**不搭引擎 spec 的车**。
|
|
3
|
+
*
|
|
4
|
+
* 规则:`TaskSpec` 是引擎的类型面,上面只放引擎读的成员。本仓装配器(`boot/resolve-spec.ts` 的 `createResolveSpec`)同时还判出三件
|
|
5
|
+
* 只有 server 自己读的事实 —— 它们以装配器**自己的输出对象**为键登记在这一张表里(单一铸点 {@link mintLegFacts}),由两只漏斗
|
|
6
|
+
* (受理 `http/admission.ts` 的 `prepareSpec` · 续跑 `http/resume-legs.ts` 的 `resolveResumeSpec`)在拿到装配输出的**同一只对象**时
|
|
7
|
+
* 读一次(唯一读口 {@link legFactsOf},读在 `stampSpecRoot` 复制之前),此后作普通值随 `PreparedTaskSubmission.legFacts` /
|
|
8
|
+
* `DriveResumeArgs.legFacts` 走到各读者。生产选路器(`capabilities/hands-lane.ts` 的 `createHandsRunnerSelector`)经公共缝
|
|
9
|
+
* `runnerFor(spec)` 被同两只漏斗以同一只装配输出调用,读同一只读口。
|
|
10
|
+
*
|
|
11
|
+
* 为什么是「以输出对象为键的表 + 漏斗处一读」而不是 spec 上的字段:引擎的 TaskSpec 一读门按 `Reflect.ownKeys` 判自有成员,
|
|
12
|
+
* 任何不是它声明的键(含 symbol 键)都拒(fresh `config.spec_unknown_key` / 续跑 `checkpoint.config_refused`)。表的键身份只需在
|
|
13
|
+
* 「装配器返回 → 漏斗读」这一步成立,两步相邻、按构造成立;复制出来的对象(`{...spec}` / rest 解构)读不到 —— 读晚了是响亮拒,不是静默放宽。
|
|
14
|
+
*
|
|
15
|
+
* 嵌入方自带的 `resolveSpec` 不铸事实 ⇒ 读口得 `undefined`:选路响亮拒(`HandsLaneUnstampedError`),名册与见证缺席(腿的
|
|
16
|
+
* `wiring_manifest` 不带技能段 / 会话行记录座不写住客)。
|
|
17
|
+
*/
|
|
18
|
+
import type { ScenarioHands } from "./capabilities/hands-lane.js";
|
|
19
|
+
import type { RunSkillEntry } from "./capabilities/skills.js";
|
|
20
|
+
import type { DelegationRootWitness } from "./delegated-session-owner.js";
|
|
21
|
+
/** 一条腿的部署事实(冻结记录)。 */
|
|
22
|
+
export interface LegFacts {
|
|
23
|
+
/** 执行车道:`none` ⇒ 无手孪生 Runner。读者 = 生产选路器。 */
|
|
24
|
+
readonly hands: ScenarioHands;
|
|
25
|
+
/** 这条 run 交给引擎的技能名册(`{ name, description, source }[]`)。读者 = 每条投 `wiring_manifest` 的腿。 */
|
|
26
|
+
readonly skills: readonly RunSkillEntry[];
|
|
27
|
+
/** 受理时读根会话行的那一读(会话 id + 住客)。读者 = 腿的会话行记录座(`session-workspace.ts`)。 */
|
|
28
|
+
readonly sessionWitness: DelegationRootWitness;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 铸事实(**单一属主**:只允许 `createResolveSpec` 的出口调用)。同一只对象被第二次铸 ⇒ 当场抛 —— 两个写者是漂移的成因,
|
|
32
|
+
* 响亮好过后到者悄悄赢。值冻结(名册条目与见证各自冻结)。
|
|
33
|
+
*/
|
|
34
|
+
export declare function mintLegFacts<T extends object>(resolved: T, facts: LegFacts): T;
|
|
35
|
+
/** 唯一读口:交装配器输出的**那一只**对象。复制品 / 嵌入方装配器的输出 ⇒ `undefined`。 */
|
|
36
|
+
export declare function legFactsOf(resolved: object): LegFacts | undefined;
|
|
37
|
+
//# sourceMappingURL=leg-facts.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const SEAT = new WeakMap();
|
|
2
|
+
export function mintLegFacts(resolved, facts) {
|
|
3
|
+
if (SEAT.has(resolved))
|
|
4
|
+
throw new TypeError("leg facts are already minted for this resolved spec — a second writer would make the two readings drift");
|
|
5
|
+
SEAT.set(resolved, Object.freeze({
|
|
6
|
+
hands: facts.hands,
|
|
7
|
+
skills: Object.freeze(facts.skills.map((e) => Object.freeze({ ...e }))),
|
|
8
|
+
sessionWitness: Object.freeze({ ...facts.sessionWitness }),
|
|
9
|
+
}));
|
|
10
|
+
return resolved;
|
|
11
|
+
}
|
|
12
|
+
export function legFactsOf(resolved) {
|
|
13
|
+
return SEAT.get(resolved);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=leg-facts.js.map
|
|
@@ -50,7 +50,6 @@
|
|
|
50
50
|
*/
|
|
51
51
|
import { type MemoryExportBundle, type MemoryImportReport } from "@sema-agent/core";
|
|
52
52
|
import { type MemoryScopeStores } from "./memory-scope-stores.js";
|
|
53
|
-
import type { SessionCaptureRecordSource } from "./plugins/store-backend.js";
|
|
54
53
|
/** 两口 HTTP 面消费的窄能力面(`ServiceDeps.memoryBundle{Export,Import}` 的实参来源)。 */
|
|
55
54
|
export interface MemoryBundleFaces {
|
|
56
55
|
exportScopes: (scopes: readonly string[]) => Promise<MemoryExportBundle>;
|
|
@@ -68,7 +67,5 @@ export interface MemoryBundleFaces {
|
|
|
68
67
|
* `test/memory-bundle-engine.test.ts`:给一个不存在的 `memoryDir` 也照样工作),传对的那一只是为了
|
|
69
68
|
* 万一 core 日后真用上时,它拿到的是本部署真正的挂载平面,而不是高一层的配置根。
|
|
70
69
|
*/
|
|
71
|
-
export declare function createMemoryBundleFaces(stores: MemoryScopeStores
|
|
72
|
-
captureRecords?: SessionCaptureRecordSource;
|
|
73
|
-
}): MemoryBundleFaces | undefined;
|
|
70
|
+
export declare function createMemoryBundleFaces(stores: MemoryScopeStores): MemoryBundleFaces | undefined;
|
|
74
71
|
//# sourceMappingURL=memory-bundle-engine.d.ts.map
|