@sema-agent/core 5.57.0 → 5.59.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/CHANGELOG.md +96 -0
- package/dist/agents/cascade.d.ts +1 -1
- package/dist/agents/cumulative-stats.d.ts +1 -1
- package/dist/agents/observer.d.ts +2 -2
- package/dist/agents/peer-admission.d.ts +1 -1
- package/dist/agents/retain-ledger.d.ts +2 -2
- package/dist/agents/roster-store.d.ts +8 -8
- package/dist/agents/send-message-tool.d.ts +2 -2
- package/dist/agents/subagent-steps.d.ts +1 -1
- package/dist/agents/subagent.d.ts +13 -13
- package/dist/agents/team.d.ts +5 -5
- package/dist/agents/tool-filter.d.ts +2 -2
- package/dist/agents/verify.d.ts +1 -1
- package/dist/bench/metrics.d.ts +35 -35
- package/dist/brain/degrading.d.ts +1 -1
- package/dist/brain/errors.d.ts +3 -3
- package/dist/brain/reasoning.d.ts +2 -2
- package/dist/brain/repetition.d.ts +1 -1
- package/dist/brain/route-adjudicator.d.ts +8 -1
- package/dist/brain/route-adjudicator.js +8 -1
- package/dist/brain/status-sink.d.ts +2 -2
- package/dist/brain/stream-shared.d.ts +1 -1
- package/dist/config/catalog.d.ts +5 -5
- package/dist/core/arg-summary.d.ts +4 -4
- package/dist/core/ask-class.d.ts +2 -2
- package/dist/core/ask-question.d.ts +1 -1
- package/dist/core/auto-compaction.d.ts +15 -15
- package/dist/core/auto-mode.d.ts +5 -5
- package/dist/core/background-agent-store.d.ts +20 -20
- package/dist/core/background-shell.d.ts +4 -4
- package/dist/core/checkpoint-store.d.ts +35 -27
- package/dist/core/context-edit.d.ts +1 -1
- package/dist/core/context-guard.d.ts +1 -1
- package/dist/core/exec-output-tail.d.ts +6 -6
- package/dist/core/file-snapshot-store.d.ts +8 -8
- package/dist/core/git-worktree-env.d.ts +3 -3
- package/dist/core/governance-codes.d.ts +37 -10
- package/dist/core/governance-codes.js +54 -1
- package/dist/core/hooks.d.ts +73 -33
- package/dist/core/hooks.js +87 -25
- package/dist/core/image-downsample.d.ts +1 -1
- package/dist/core/locked-config.d.ts +1 -1
- package/dist/core/lsp.d.ts +1 -1
- package/dist/core/mailbox-store.d.ts +1 -1
- package/dist/core/mcp.d.ts +3 -3
- package/dist/core/memory-engine/consolidation-driver.d.ts +211 -0
- package/dist/core/memory-engine/consolidation-driver.js +427 -0
- package/dist/core/memory-engine/consolidation.d.ts +119 -3
- package/dist/core/memory-engine/consolidation.js +22 -1
- package/dist/core/memory-engine/data-plane.d.ts +1 -1
- package/dist/core/memory-engine/distiller.d.ts +550 -0
- package/dist/core/memory-engine/distiller.js +598 -0
- package/dist/core/memory-engine/dual-root.d.ts +1 -1
- package/dist/core/memory-engine/engine.d.ts +143 -10
- package/dist/core/memory-engine/engine.js +149 -23
- package/dist/core/memory-engine/file-backend.d.ts +14 -2
- package/dist/core/memory-engine/file-backend.js +3 -0
- package/dist/core/memory-engine/index.d.ts +6 -3
- package/dist/core/memory-engine/index.js +4 -2
- package/dist/core/memory-engine/layout.js +20 -6
- package/dist/core/memory-engine/origin-clearance.d.ts +1 -1
- package/dist/core/memory-engine/scope-contract.d.ts +4 -4
- package/dist/core/memory-engine/sync-client.d.ts +16 -16
- package/dist/core/memory-engine/sync.d.ts +4 -4
- package/dist/core/memory-engine/types.d.ts +17 -0
- package/dist/core/memory-recall.d.ts +1 -1
- package/dist/core/memory.d.ts +2 -2
- package/dist/core/permission-rule-consent.d.ts +185 -36
- package/dist/core/permission-rule-consent.js +219 -44
- package/dist/core/permission-rule-model.d.ts +235 -31
- package/dist/core/permission-rule-model.js +105 -35
- package/dist/core/permission-rules.d.ts +9 -9
- package/dist/core/remote-env.d.ts +8 -8
- package/dist/core/roles.d.ts +3 -3
- package/dist/core/roles.js +1 -0
- package/dist/core/runner/assemble-result.d.ts +2 -2
- package/dist/core/runner/compaction-call-options.d.ts +3 -3
- package/dist/core/runner/memory-consolidation-driver.d.ts +49 -0
- package/dist/core/runner/memory-consolidation-driver.js +60 -0
- package/dist/core/runner/memory-consolidation.d.ts +1 -1
- package/dist/core/runner/prepare-config-doors.d.ts +3 -3
- package/dist/core/runner/prepare-task.d.ts +21 -21
- package/dist/core/runner/prepare-task.js +24 -17
- package/dist/core/runner/prepare-workspace-restore.d.ts +2 -2
- package/dist/core/runner/runtask.d.ts +11 -11
- package/dist/core/runner/runtask.js +4 -4
- package/dist/core/runner/session-rule-policy.d.ts +1 -1
- package/dist/core/runner/teardown-bounded.d.ts +1 -1
- package/dist/core/runner/tool-disclosure.d.ts +2 -2
- package/dist/core/runner/turn-attachments.d.ts +11 -11
- package/dist/core/scheduler.d.ts +5 -5
- package/dist/core/secret-env.d.ts +1 -1
- package/dist/core/sensitive-path-policy.d.ts +1 -1
- package/dist/core/session-policy-store.d.ts +2 -2
- package/dist/core/session-reconcile.d.ts +2 -2
- package/dist/core/session-store.d.ts +3 -3
- package/dist/core/session.d.ts +1 -1
- package/dist/core/shutdown-debug.d.ts +2 -2
- package/dist/core/side-query.d.ts +2 -2
- package/dist/core/spec-contract.d.ts +1 -1
- package/dist/core/store-contracts/contract-harness.d.ts +2 -2
- package/dist/core/store-contracts/contract-kit-version.d.ts +2 -2
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/mailbox-store-contract.js +1 -1
- package/dist/core/task-notification.d.ts +5 -5
- package/dist/core/task-registry-agent.d.ts +12 -12
- package/dist/core/task-registry-monitor.d.ts +1 -1
- package/dist/core/task-registry-shared.d.ts +41 -41
- package/dist/core/task-registry.d.ts +12 -12
- package/dist/core/tool-detach.d.ts +2 -2
- package/dist/core/tool-errors.d.ts +3 -3
- package/dist/core/tool-policy.d.ts +113 -28
- package/dist/core/tool-policy.js +80 -1
- package/dist/core/tool-result-budget.d.ts +1 -1
- package/dist/core/tool-result-store.d.ts +2 -2
- package/dist/core/tools.d.ts +1 -1
- package/dist/core/trace.d.ts +26 -23
- package/dist/core/types.d.ts +164 -86
- package/dist/core/types.js +4 -3
- package/dist/core/untrusted-egress.d.ts +1 -1
- package/dist/core/untrusted-text.d.ts +7 -7
- package/dist/core/wiring-manifest.d.ts +5 -5
- package/dist/core/workflow-journal-store.d.ts +14 -14
- package/dist/core/workflow-run-store-contract.d.ts +1 -1
- package/dist/core/workflow-run-store-contract.js +1 -1
- package/dist/core/workflow-run-store.d.ts +4 -4
- package/dist/engine/compaction/compaction.d.ts +3 -3
- package/dist/engine/compaction/utils.d.ts +2 -2
- package/dist/engine/execution-env/kill-tree.d.ts +1 -1
- package/dist/engine/execution-env/node-execution-env.d.ts +8 -8
- package/dist/engine/harness/agent-harness.d.ts +6 -6
- package/dist/engine/harness/messages.d.ts +1 -1
- package/dist/engine/harness/types.d.ts +10 -10
- package/dist/engine/llm/types.d.ts +14 -14
- package/dist/engine/loop/agent-loop.d.ts +3 -3
- package/dist/engine/loop/types.d.ts +4 -4
- package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
- package/dist/engine/session/import-validate.d.ts +1 -1
- package/dist/engine/session/log-digest.d.ts +1 -1
- package/dist/engine/session/memory-repo.d.ts +2 -2
- package/dist/engine/session/session.d.ts +4 -4
- package/dist/fixtures/index.d.ts +4 -4
- package/dist/index.d.ts +6 -5
- package/dist/index.js +5 -4
- package/dist/orchestration/goal.d.ts +1 -1
- package/dist/orchestration/run-spec.d.ts +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts +12 -12
- package/dist/orchestration/workflow-governance.d.ts +4 -4
- package/dist/orchestration/workflow-observe.d.ts +1 -1
- package/dist/orchestration/workflow-script-runner.d.ts +1 -1
- package/dist/orchestration/workflow-script-store.d.ts +9 -9
- package/dist/orchestration/workflow-size-guideline.d.ts +1 -1
- package/dist/orchestration/workflow-types.d.ts +5 -5
- package/dist/orchestration/workflow.d.ts +10 -10
- package/dist/prompt-assembly/artifact-store.d.ts +1 -1
- package/dist/prompt-assembly/artifact.d.ts +1 -1
- package/dist/prompt-assembly/assemble.d.ts +1 -1
- package/dist/prompt-assembly/composer.d.ts +2 -2
- package/dist/prompt-assembly/epoch.d.ts +2 -2
- package/dist/prompt-assembly/event-registry.d.ts +1 -1
- package/dist/prompt-assembly/explain.d.ts +3 -3
- package/dist/prompt-assembly/tool-catalog.d.ts +1 -1
- package/dist/prompt-assembly/turn-snapshot.d.ts +4 -4
- package/dist/prompt-assembly/types.d.ts +12 -12
- package/dist/prompts/coordinator.d.ts +1 -1
- package/dist/prompts/default.d.ts +8 -8
- package/dist/prompts/simple-sections.d.ts +3 -3
- package/dist/prompts/supervisor.d.ts +2 -2
- package/dist/scenarios/full-body.d.ts +3 -3
- package/dist/scenarios/scenario-registry.d.ts +1 -1
- package/dist/stores/cc/sidecar-transcript.d.ts +3 -3
- package/dist/stores/file/fs-atomic.d.ts +2 -2
- package/dist/stores/file/index.d.ts +1 -1
- package/dist/stores/file/session-store.d.ts +2 -2
- package/dist/stores/file/workflow-journal-store.d.ts +4 -4
- package/dist/tools/fs/bash-readonly-classifier.d.ts +1 -1
- package/dist/tools/fs/encoding.d.ts +4 -4
- package/dist/tools/fs/fs-bash.d.ts +3 -3
- package/dist/tools/fs/fs-pdf.d.ts +1 -1
- package/dist/tools/fs/fs-shared.d.ts +6 -6
- package/dist/tools/fs/index.d.ts +2 -2
- package/dist/tools/fs/notebook.d.ts +1 -1
- package/dist/tools/fs/pdf.d.ts +1 -1
- package/dist/tools/fs/read-deny.d.ts +1 -1
- package/dist/tools/fs/safety.d.ts +9 -9
- package/dist/tools/fs/search.d.ts +2 -2
- package/dist/tools/monitor.d.ts +3 -3
- package/dist/tools/task-list.d.ts +2 -2
- package/dist/tools/web.d.ts +4 -4
- package/dist/tools/worktree.d.ts +5 -5
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +1826 -3
package/dist/bench/metrics.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ export interface DeliveryDecision {
|
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
73
|
* design/95 §3.2 — the lifecycle status of a run, so INFRA noise never poisons the mode signal
|
|
74
|
-
* (
|
|
74
|
+
* (design/89 §3.3 Beatsep red line). The Beatsep task#2b 9% pass-rate was infra
|
|
75
75
|
* death (OOM / K8S passthrough / nested-root), NOT a mode signal — feeding such runs into the
|
|
76
76
|
* numerator turns them into spurious DELIVERED-WRONG / zero datapoints and reproduces the very noise
|
|
77
77
|
* the design claims to have isolated. `buildReport` SCORES only `scored`; `infra-failed` / `excluded`
|
|
@@ -94,7 +94,7 @@ export interface RunRecord {
|
|
|
94
94
|
/** Repeat/seed index within the cell (design/89 §3.4 N-repeat). */
|
|
95
95
|
seed?: number | string;
|
|
96
96
|
/**
|
|
97
|
-
* design/95 §3.2
|
|
97
|
+
* design/95 §3.2 — lifecycle status. Only "scored" runs reach the numerator / cost /
|
|
98
98
|
* Pareto. Absent ⇒ "scored" (back-compat). See {@link RunStatus}.
|
|
99
99
|
*/
|
|
100
100
|
runStatus?: RunStatus;
|
|
@@ -313,7 +313,7 @@ export interface ArmCell {
|
|
|
313
313
|
/** Avoided-loss rate = CORRECTLY-WITHHELD / n. The supervisor's §2.2.1 value, single-listed. */
|
|
314
314
|
correctlyWithheldRate: number;
|
|
315
315
|
/**
|
|
316
|
-
*
|
|
316
|
+
* design/95 M10 — withhold treated as a binary detector of would-be-wrong delivery
|
|
317
317
|
* (positive = withheld; ground truth = would-be-wrong, established by the §2.4 counterfactual). Reported
|
|
318
318
|
* as precision/recall — NOT just the raw correctly-withheld count — so an arm cannot look good by
|
|
319
319
|
* withholding indiscriminately (high count, low precision) or by rarely withholding (high precision,
|
|
@@ -420,10 +420,10 @@ export declare function riskTransferDisclosure(cells: ArmCell[]): {
|
|
|
420
420
|
};
|
|
421
421
|
};
|
|
422
422
|
/**
|
|
423
|
-
*
|
|
423
|
+
* a paired-binary comparison of two arms on the SAME tasks/seeds. The two arms' truly-
|
|
424
424
|
* correct flags are paired row-by-row (paired-seed, design/89 §3.4). For binary paired data the
|
|
425
425
|
* RIGHT tests are McNemar (discordant pairs) and a paired-bootstrap difference interval — NOT two
|
|
426
|
-
* independent proportions with "CI non-overlap" (that ignores the pairing and is under-powered
|
|
426
|
+
* independent proportions with "CI non-overlap" (that ignores the pairing and is under-powered).
|
|
427
427
|
*/
|
|
428
428
|
export interface PairedBinaryComparison {
|
|
429
429
|
/** Arm A (e.g. "sup") vs arm B (e.g. "solo"). pDiff = P(A) − P(B). */
|
|
@@ -440,12 +440,12 @@ export interface PairedBinaryComparison {
|
|
|
440
440
|
* b+c large). */
|
|
441
441
|
mcnemarP: number;
|
|
442
442
|
/** Bootstrap percentile 95% CI for the paired difference (lo, hi) — a percentile CI on the seeded
|
|
443
|
-
* paired-bootstrap distribution, NOT Newcombe's analytic interval
|
|
443
|
+
* paired-bootstrap distribution, NOT Newcombe's analytic interval. Crosses 0 ⇒ not significant. */
|
|
444
444
|
ci95: [number, number];
|
|
445
445
|
/** TRUE iff the difference is statistically significant at α=0.05 (CI excludes 0 AND McNemar p<0.05). */
|
|
446
446
|
significant: boolean;
|
|
447
447
|
/**
|
|
448
|
-
*
|
|
448
|
+
* pre-registered Minimum Detectable Effect at the observed nPairs (the difference this
|
|
449
449
|
* comparison COULD have detected at 80% power). When |pDiff| is below this AND not significant, the
|
|
450
450
|
* verdict is "not powered" — NOT "no difference". This is the field that stops "N≥15 is an assertion".
|
|
451
451
|
*/
|
|
@@ -456,8 +456,8 @@ export interface PairedBinaryComparison {
|
|
|
456
456
|
verdict: "A-better" | "B-better" | "no-detectable-difference" | "not-powered";
|
|
457
457
|
}
|
|
458
458
|
/**
|
|
459
|
-
*
|
|
460
|
-
* `(taskId, seed)` key (
|
|
459
|
+
* compare two arms' delivered truly-correct as PAIRED binary. Pairs runs by the COMPOSITE
|
|
460
|
+
* `(taskId, seed)` key (a bare `seed` collides across tasks — the same repeat index
|
|
461
461
|
* recurs per task — so cross-task input would overwrite pairs and contaminate the McNemar sample);
|
|
462
462
|
* only rows where BOTH arms delivered (not withheld, both scored) form a pair — a
|
|
463
463
|
* withheld run has no delivered binary to pair (it is scored in the withhold/avoided-loss axis, not
|
|
@@ -469,7 +469,7 @@ export declare function pairedBinaryCompare(scoredRuns: RunRecord[], armA: Arm,
|
|
|
469
469
|
bootstrapIters?: number;
|
|
470
470
|
}): PairedBinaryComparison;
|
|
471
471
|
/**
|
|
472
|
-
*
|
|
472
|
+
* the pre-registered C2 exchange rate(s): how many human-review SECONDS we are willing to
|
|
473
473
|
* pay to buy one unit of supervisor value. Without these, "higher P / more withholds ⇒ worth it" is
|
|
474
474
|
* unfalsifiable (the "helpful but too expensive" counter-thesis cannot be observed). Declared BEFORE
|
|
475
475
|
* the run (design/95 §9), not fit after.
|
|
@@ -482,20 +482,20 @@ export interface C2Thresholds {
|
|
|
482
482
|
}
|
|
483
483
|
export interface ParetoVerdict {
|
|
484
484
|
arm: Arm;
|
|
485
|
-
/** Non-dominated on (C1, C2.sec, P) — necessary condition to be considered at all
|
|
485
|
+
/** Non-dominated on (C1, C2.sec, P) — necessary condition to be considered at all. */
|
|
486
486
|
nonDominated: boolean;
|
|
487
487
|
/** The pre-registered exchange-rate check: does the arm's extra C2 buy enough avoided-loss / saved
|
|
488
488
|
* decisions to clear the declared threshold? Undefined when the arm has no extra C2 over baseline. */
|
|
489
489
|
clearsC2Threshold?: boolean;
|
|
490
490
|
/**
|
|
491
|
-
*
|
|
491
|
+
* the label. An arm may ONLY be "worth-it" when it is non-dominated AND clears the C2
|
|
492
492
|
* threshold. A non-dominated but threshold-failing arm is "quality-tradeoff" (higher quality, but the
|
|
493
493
|
* cost is not bought back) — NEVER "worth-it". A dominated arm is "dominated".
|
|
494
494
|
*/
|
|
495
495
|
label: "worth-it" | "quality-tradeoff" | "dominated";
|
|
496
496
|
}
|
|
497
497
|
/**
|
|
498
|
-
*
|
|
498
|
+
* classify each arm against the SUP/TEAM-vs-baseline value question with a pre-registered
|
|
499
499
|
* exchange rate. `baselineArm` is the cost floor to compare extra C2 against (default "solo").
|
|
500
500
|
* `avoidedWrong` / `savedDecisions` per arm come from the cells / campaign report.
|
|
501
501
|
*
|
|
@@ -518,31 +518,31 @@ export declare function paretoValueVerdict(cells: ArmCell[], thresholds: C2Thres
|
|
|
518
518
|
* design/95 §7.1 — V1 (免重复劳动): campaign-level human-decision delta. The ONLY authoritative V1
|
|
519
519
|
* mechanism (design/95 reconcile, MAJOR#2): cross-task reuse of a decided strategy. Semantics:
|
|
520
520
|
* - `soloHumanDecisions` is the V1 BASELINE — the operator's actual up-front decision count when
|
|
521
|
-
* running solo across the campaign (
|
|
521
|
+
* running solo across the campaign (NOT 0, NOT synthetic — measured from real operator
|
|
522
522
|
* prep across runs). `0` is only valid when the campaign genuinely needed no human decision.
|
|
523
523
|
* - `repeatedDecisionsSaved = soloHumanDecisions − supHumanDecisions` (may be negative = SUP cost
|
|
524
524
|
* MORE human decisions; reported honestly, not floored).
|
|
525
525
|
*/
|
|
526
526
|
export interface CampaignV1Saved {
|
|
527
527
|
decisionKind: string;
|
|
528
|
-
/** V1 baseline
|
|
528
|
+
/** V1 baseline: operator's measured up-front decisions when running SOLO. Provenance MUST
|
|
529
529
|
* be recorded in the stamp (real prep, not 0/synthetic). */
|
|
530
530
|
soloHumanDecisions: number;
|
|
531
531
|
/** SUP arm's actual human-review decision count for this decision kind. */
|
|
532
532
|
supHumanDecisions: number;
|
|
533
533
|
/** = soloHumanDecisions − supHumanDecisions. Positive ⇒ SUP saved repeated labour (V1 evidence). */
|
|
534
534
|
repeatedDecisionsSaved: number;
|
|
535
|
-
/** Whether the baseline is a real measurement vs absent (
|
|
535
|
+
/** Whether the baseline is a real measurement vs absent (honesty gate). */
|
|
536
536
|
baselineProvenance: "measured-operator-baseline" | "absent-not-claimable";
|
|
537
537
|
}
|
|
538
538
|
/**
|
|
539
|
-
* design/95 §7.2 — V2 (蓝图清晰度) THREE-arm ablation
|
|
539
|
+
* design/95 §7.2 — V2 (蓝图清晰度) THREE-arm ablation. All three are
|
|
540
540
|
* paired on the SAME seeds (paired===true ⇒ the three pX arrays/values are over the same n seeds).
|
|
541
541
|
* INVARIANT: `n` is the paired-seed count common to all three sub-arms; the three deltas are computed
|
|
542
542
|
* over those n pairs.
|
|
543
543
|
* - pSoloRaw — only the original brief (no blueprint baseline).
|
|
544
544
|
* - pSoloSupGenerated — the SUP-arm-GENERATED blueprint (attributable to supervisor; gen cost charged).
|
|
545
|
-
* - pSoloExperimenterIdeal — the experimenter "ideal" blueprint.
|
|
545
|
+
* - pSoloExperimenterIdeal — the experimenter "ideal" blueprint. this is a CONSTRAINED upper
|
|
546
546
|
* bound on "better-prompt help", NOT "supervisor's mechanistic ceiling", UNLESS the ideal blueprint
|
|
547
547
|
* was generated under the {@link IdealBlueprintConstraints} (run-time, visible-brief-only, no oracle
|
|
548
548
|
* access, same info budget, leak-reviewed). `idealConstraintsSatisfied` records which it is.
|
|
@@ -557,16 +557,16 @@ export interface BlueprintAblationTriple {
|
|
|
557
557
|
pSoloExperimenterIdeal: number;
|
|
558
558
|
/** = pSoloSupGenerated − pSoloRaw (supervisor blueprint's real net value). */
|
|
559
559
|
deltaSupVsRaw: number;
|
|
560
|
-
/** = pSoloExperimenterIdeal − pSoloRaw. LABELLED per `idealConstraintsSatisfied
|
|
560
|
+
/** = pSoloExperimenterIdeal − pSoloRaw. LABELLED per `idealConstraintsSatisfied`. */
|
|
561
561
|
deltaIdealVsRaw: number;
|
|
562
|
-
/**
|
|
562
|
+
/** when false, deltaIdealVsRaw is "manual-prompt upper bound", NOT "supervisor potential". */
|
|
563
563
|
idealConstraintsSatisfied: boolean;
|
|
564
|
-
/**
|
|
564
|
+
/** blueprint generation cost charged to the sup-generated arm (budget-match red line). */
|
|
565
565
|
blueprintGenC1MicroUsd: number;
|
|
566
566
|
blueprintGenC2Count: number;
|
|
567
567
|
blueprintGenC2Sec: number;
|
|
568
568
|
}
|
|
569
|
-
/**
|
|
569
|
+
/** the constraints under which an "ideal" blueprint may be read as a supervisor-mechanism
|
|
570
570
|
* upper bound rather than a generic "better prompt helps" result. Recorded per ablation. */
|
|
571
571
|
export interface IdealBlueprintConstraints {
|
|
572
572
|
generatedBeforeRun: boolean;
|
|
@@ -575,10 +575,10 @@ export interface IdealBlueprintConstraints {
|
|
|
575
575
|
sameInfoBudget: boolean;
|
|
576
576
|
solutionLeakReviewed: boolean;
|
|
577
577
|
}
|
|
578
|
-
/** True iff ALL ideal-blueprint constraints hold
|
|
578
|
+
/** True iff ALL ideal-blueprint constraints hold. */
|
|
579
579
|
export declare function idealConstraintsSatisfied(c: IdealBlueprintConstraints): boolean;
|
|
580
580
|
/**
|
|
581
|
-
* design/95 §7.3 — V3 (无关性隔离) contamination probe (canary, mechanical, zero LLM-judge).
|
|
581
|
+
* design/95 §7.3 — V3 (无关性隔离) contamination probe (canary, mechanical, zero LLM-judge).
|
|
582
582
|
* the isolated-vs-shared P delta CONFOUNDS execution order / context size / worker count / budget; the
|
|
583
583
|
* PRIMARY signal must be per-subgoal oracle failure + explicit wrong-use of a sibling artifact (the
|
|
584
584
|
* canary leak), with the P delta kept as a DIAGNOSTIC only.
|
|
@@ -590,12 +590,12 @@ export interface IsolationContamination {
|
|
|
590
590
|
isolatedSubgoalP: number[];
|
|
591
591
|
/** Per-factor P under shared context. length === factorCount. */
|
|
592
592
|
sharedSubgoalP: number[];
|
|
593
|
-
/** PRIMARY mechanical signal
|
|
593
|
+
/** PRIMARY mechanical signal: cross-factor canary leak rate (explicit token bleed). */
|
|
594
594
|
canaryLeakRate: number;
|
|
595
|
-
/** PRIMARY mechanical signal
|
|
595
|
+
/** PRIMARY mechanical signal: count of factors that failed their oracle AND demonstrably
|
|
596
596
|
* used a sibling factor's artifact (the controlled-ablation harm signal). */
|
|
597
597
|
wrongSiblingArtifactUses: number;
|
|
598
|
-
/** DIAGNOSTIC ONLY (
|
|
598
|
+
/** DIAGNOSTIC ONLY (confound): mean(isolated P) − mean(shared P). Not the primary signal. */
|
|
599
599
|
contaminationRateDiag: number;
|
|
600
600
|
/** Extra C1 the isolation cost (multi-worker / repeated context load). */
|
|
601
601
|
isolationOverheadC1: number;
|
|
@@ -614,7 +614,7 @@ export interface CampaignReport {
|
|
|
614
614
|
implementedAxes: ImplementedAxes;
|
|
615
615
|
}
|
|
616
616
|
/**
|
|
617
|
-
* design/95 §2
|
|
617
|
+
* design/95 §2 — one heterogeneity CELL: a `(suiteVersion, taskId, archetype, valueDimension,
|
|
618
618
|
* arm)` group with its folded {@link ArmCell}. The decision surface is the per-cell vector — NOT the
|
|
619
619
|
* arm mean (the Simpson's-paradox guard). `groupKey` is the stable join key.
|
|
620
620
|
*/
|
|
@@ -648,7 +648,7 @@ export interface ComparisonCell {
|
|
|
648
648
|
pareto: ParetoResult;
|
|
649
649
|
}
|
|
650
650
|
/**
|
|
651
|
-
*
|
|
651
|
+
* council Q1 — capability metadata: which of the four §7/Pareto value axes are actually
|
|
652
652
|
* IMPLEMENTED in this report. Consumers must read this before claiming a V1/V2/V3 result; an unset axis
|
|
653
653
|
* is NOT a null result, it is "not measured here". (The T1 structures above are types + pure helpers;
|
|
654
654
|
* the report-level V1/V2/V3 fields are populated by the harness, not synthesized in `buildReport`.)
|
|
@@ -660,7 +660,7 @@ export interface ImplementedAxes {
|
|
|
660
660
|
v3: boolean;
|
|
661
661
|
}
|
|
662
662
|
export interface ValueJudgmentReport {
|
|
663
|
-
/**
|
|
663
|
+
/** per-arm cells grouped by full heterogeneity key (incl. arm). Single-arm; use for cell
|
|
664
664
|
* inspection / `pairedBinaryCompare` inputs. NOT directly a cross-arm verdict surface (each is one arm). */
|
|
665
665
|
groupedCells: GroupedCell[];
|
|
666
666
|
/**
|
|
@@ -671,7 +671,7 @@ export interface ValueJudgmentReport {
|
|
|
671
671
|
*/
|
|
672
672
|
comparisons: ComparisonCell[];
|
|
673
673
|
/**
|
|
674
|
-
*
|
|
674
|
+
* suite-level rollup: per-arm cells folded over ALL scored runs. A WEIGHTED summary for
|
|
675
675
|
* dashboards ONLY — NOT a decision surface (folding heterogeneous tasks can flip a verdict, Simpson).
|
|
676
676
|
* Consumers MUST decide on `comparisons`; this is convenience aggregation.
|
|
677
677
|
*/
|
|
@@ -687,7 +687,7 @@ export interface ValueJudgmentReport {
|
|
|
687
687
|
/** design/89 §3.4: cells with n<8 are directional-only, not verdict-grade. Flagged, not dropped. */
|
|
688
688
|
directionalOnly: Arm[];
|
|
689
689
|
/**
|
|
690
|
-
*
|
|
690
|
+
* the exclusion ledger: runs dropped from scoring (infra-failed / excluded) with reasons.
|
|
691
691
|
* A regression-grade invariant: these never reach `cells` / `pareto` (no infra noise in the verdict).
|
|
692
692
|
*/
|
|
693
693
|
excluded: Array<{
|
|
@@ -696,16 +696,16 @@ export interface ValueJudgmentReport {
|
|
|
696
696
|
seed?: number | string;
|
|
697
697
|
reason: RunStatus;
|
|
698
698
|
}>;
|
|
699
|
-
/**
|
|
699
|
+
/** which value axes this report actually measured. */
|
|
700
700
|
implementedAxes: ImplementedAxes;
|
|
701
701
|
}
|
|
702
702
|
/**
|
|
703
|
-
* Top-level
|
|
703
|
+
* Top-level: SCORE only `scored` runs (B4 — drop infra-failed/excluded with reasons),
|
|
704
704
|
* group by `(suiteVersion, taskId, archetype, valueDimension, arm)` (B1 — the per-cell decision surface,
|
|
705
705
|
* Simpson's-paradox guard), fold each group, AND provide a suite-level per-arm rollup for dashboards
|
|
706
706
|
* (explicitly NOT a decision surface). Deterministic; no model.
|
|
707
707
|
*
|
|
708
|
-
* `opts.implementedAxes` lets the harness declare which §7 axes it populated
|
|
708
|
+
* `opts.implementedAxes` lets the harness declare which §7 axes it populated; default
|
|
709
709
|
* = only Pareto (the V1/V2/V3 structures are T1 net-new, not synthesized here).
|
|
710
710
|
*/
|
|
711
711
|
export declare function buildReport(runs: RunRecord[], opts?: {
|
|
@@ -75,7 +75,7 @@ export declare function readDegradation(msg: {
|
|
|
75
75
|
diagnostics?: AssistantMessageDiagnostic[];
|
|
76
76
|
} | undefined): DegradationInfo | undefined;
|
|
77
77
|
/**
|
|
78
|
-
* design/131
|
|
78
|
+
* design/131 — resilience-standdown pass-through: forward one brain's stream
|
|
79
79
|
* verbatim, but keep the decorator discipline that a REJECTING inner brain (throw instead of an
|
|
80
80
|
* error event) still leaves a terminal on the returned stream — otherwise `result()` never
|
|
81
81
|
* resolves and the harness hangs (the same class as the degradation-brain blocker).
|
package/dist/brain/errors.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const ZERO_USAGE: Usage;
|
|
|
12
12
|
/** The single source of truth for brain error codes — the type, the `[code]` parser, and the prefix
|
|
13
13
|
* stripper all derive from this one list, so adding a code can't silently diverge across call sites.
|
|
14
14
|
*
|
|
15
|
-
* The last three are IN-BAND terminal-output codes
|
|
15
|
+
* The last three are IN-BAND terminal-output codes: stamped on errored assistant MESSAGES
|
|
16
16
|
* (never thrown as BrainError) so `TaskResult.errorCode` covers the error family end-to-end and
|
|
17
17
|
* downstream consumers can bucket without string-matching. Deliberately behavior-neutral everywhere
|
|
18
18
|
* else: the circuit breaker's default countCodes excludes them (model-output problems, not provider
|
|
@@ -27,7 +27,7 @@ export type BrainErrorCode = (typeof BRAIN_ERROR_CODES)[number];
|
|
|
27
27
|
* tool-errors.ts must classify every member — a code added here but missed there folds to "unknown"). */
|
|
28
28
|
export declare const ALL_BRAIN_ERROR_CODES: readonly BrainErrorCode[];
|
|
29
29
|
/** The in-band terminal-output subset (see the list doc above). The circuit breaker collapses these
|
|
30
|
-
* to the legacy `"http"` bucket before counting
|
|
30
|
+
* to the legacy `"http"` bucket before counting: its taxonomy is TRANSPORT-level,
|
|
31
31
|
* and before these codes existed the same failures reached it as the unprefixed→"http" fallback — a
|
|
32
32
|
* custom `countCodes: ["http"]` policy must keep counting them exactly as it always did. */
|
|
33
33
|
export declare const IN_BAND_OUTPUT_CODES: ReadonlySet<BrainErrorCode>;
|
|
@@ -65,7 +65,7 @@ export declare function stripErrorCodePrefix(errorMessage: string): string;
|
|
|
65
65
|
*/
|
|
66
66
|
export type ConnectFailureClass = "deterministic" | "indeterminate";
|
|
67
67
|
export declare function classifyConnectFailure(e: unknown): ConnectFailureClass;
|
|
68
|
-
/** RB-386③
|
|
68
|
+
/** RB-386③ — render a transport-level error WITHOUT folding away its cause chain. undici's
|
|
69
69
|
* `fetch` rejects with `TypeError("fetch failed", { cause })` where the CAUSE carries the actually
|
|
70
70
|
* actionable fact (`connect ECONNREFUSED …` / `getaddrinfo ENOTFOUND …` / `SocketError: other side
|
|
71
71
|
* closed` with a `code`); `String(e)` / `e.message` alone collapsed ALL THREE network-failure shapes
|
|
@@ -92,7 +92,7 @@ export interface ReasoningResolution {
|
|
|
92
92
|
* the cap-wins predicate below and the brain's budget-window math read ONE constant. */
|
|
93
93
|
export declare const MIN_THINKING_TOKENS = 1024;
|
|
94
94
|
/**
|
|
95
|
-
* The anthropic BUDGET path's cap-wins arm (#346, single-sourced; design/119 #2 review
|
|
95
|
+
* The anthropic BUDGET path's cap-wins arm (#346, single-sourced; design/119 #2 review):
|
|
96
96
|
* a HARD per-request output cap (an engine-imposed override or the caller's explicit
|
|
97
97
|
* `options.maxTokens` — the two lanes the brain refuses to raise) too small to host a legal thinking
|
|
98
98
|
* budget (≥ {@link MIN_THINKING_TOKENS}) plus answer room means the CAP WINS and thinking is skipped
|
|
@@ -276,7 +276,7 @@ export interface ReasoningProfileFlags {
|
|
|
276
276
|
}
|
|
277
277
|
/**
|
|
278
278
|
* design/96 §D (S4) — map a named {@link ReasoningTier} to its engine {@link ReasoningProfileFlags} (default
|
|
279
|
-
* mapping). G2
|
|
279
|
+
* mapping). G2: the intensity→capability mapping is PROFILE-layer data — core gives this primitive +
|
|
280
280
|
* a sane default; a profile/scenario layer calls it (and may override the table) to set a task's `thinking` +
|
|
281
281
|
* prompt flags. Core never forces it. Returns a fresh COPY (callers may mutate).
|
|
282
282
|
*/
|
|
@@ -36,7 +36,7 @@ export declare const DEGENERATE_MESSAGE = "degenerate repetition detected \u2014
|
|
|
36
36
|
* One detector hit — either the event that CUT a stream (`degenerate`) or a repetition that landed in
|
|
37
37
|
* a detection window but was SPARED by a 2e1c161 structural allowance (code-line shape / divider run).
|
|
38
38
|
* Spared events are the RSI raw material for judging whether the allowance is too wide or too narrow
|
|
39
|
-
* (
|
|
39
|
+
* (2026-07-10: the detector must report counts AND the detected segment, not just a boolean).
|
|
40
40
|
*/
|
|
41
41
|
export interface RepetitionEvent {
|
|
42
42
|
/** Which rule's window the repetition landed in: rule 1 (`char-run`) or rule 2 (`unit-loop`). */
|
|
@@ -174,7 +174,13 @@ export declare function adjudicateDerivedRoute(args: {
|
|
|
174
174
|
*/
|
|
175
175
|
export declare function sameRouteIdentity(a: Pick<Model, "id" | "baseUrl">, b: Pick<Model, "id" | "baseUrl">): boolean;
|
|
176
176
|
/** The `route.fallback_to_primary` announcement — one shared shape for every derived-leg seat, so
|
|
177
|
-
* a consumer can rely on `detail.{seat, from, to, cause}` regardless of which seat fell back.
|
|
177
|
+
* a consumer can rely on `detail.{seat, from, to, cause}` regardless of which seat fell back.
|
|
178
|
+
*
|
|
179
|
+
* `sessionId` (#433, additive): the swap happened while resolving ONE run's seats, so the run is
|
|
180
|
+
* what an operator correlates the line against ("which task ran on the fallback model"). The
|
|
181
|
+
* AUDIENCE stays `"operator"` — the fix is a credential/catalog fix, and no end user can act on it;
|
|
182
|
+
* attribution is a routing key, not an entitlement. Omitted when a caller has no session in hand,
|
|
183
|
+
* never fabricated. */
|
|
178
184
|
export declare function fallbackToPrimaryNotice(args: {
|
|
179
185
|
seat: string;
|
|
180
186
|
from: string;
|
|
@@ -182,6 +188,7 @@ export declare function fallbackToPrimaryNotice(args: {
|
|
|
182
188
|
verdict: Extract<RouteAdjudication, {
|
|
183
189
|
ok: false;
|
|
184
190
|
}>;
|
|
191
|
+
sessionId?: string;
|
|
185
192
|
}): EngineNotice;
|
|
186
193
|
/** The auth carriers of a header bag, canonicalized (case-fold name → value, sorted) — the
|
|
187
194
|
* Model-visible credential fingerprint used by catalog-change disclosure (a same-name entry whose
|
|
@@ -173,7 +173,14 @@ export function fallbackToPrimaryNotice(args) {
|
|
|
173
173
|
code: "route.fallback_to_primary",
|
|
174
174
|
message: `derived model "${args.from}" (${args.seat}) is not routable (${args.verdict.code}) — ` +
|
|
175
175
|
`falling back to the primary model "${args.to}". ${args.verdict.detail.fixHint}`,
|
|
176
|
-
detail: {
|
|
176
|
+
detail: {
|
|
177
|
+
seat: args.seat,
|
|
178
|
+
from: args.from,
|
|
179
|
+
to: args.to,
|
|
180
|
+
cause: args.verdict.code,
|
|
181
|
+
fixHint: args.verdict.detail.fixHint,
|
|
182
|
+
...(args.sessionId !== undefined ? { sessionId: args.sessionId } : {}),
|
|
183
|
+
},
|
|
177
184
|
};
|
|
178
185
|
}
|
|
179
186
|
export function authCarrierFingerprint(headers) {
|
|
@@ -18,7 +18,7 @@ export declare function runWithStatusSink<T>(emit: (s: BrainStatus) => void, fn:
|
|
|
18
18
|
*/
|
|
19
19
|
export declare function emitBrainStatus(status: BrainStatus): void;
|
|
20
20
|
/**
|
|
21
|
-
* Silent-fallback telemetry (
|
|
21
|
+
* Silent-fallback telemetry (C1/C4/C5/C6) — the brain→runner TELEMETRY channel, a
|
|
22
22
|
* SECOND ALS sink parallel to the status one. Statuses are user-facing liveness frames (wire
|
|
23
23
|
* `status` events); telemetry is operator-facing fallback accounting the Runner bridges to trace
|
|
24
24
|
* events (`brain.failover` / `breaker.transition` / `brain.retry` / `vision.placeholder`). Kept
|
|
@@ -52,7 +52,7 @@ export type BrainTelemetry = {
|
|
|
52
52
|
}
|
|
53
53
|
/** PDF read: a `document` content block was substituted with a text placeholder because the serving
|
|
54
54
|
* API/model cannot take native document input (openai brain always; anthropic brain when the model
|
|
55
|
-
* declares no vision). Silent quality loss → frame (same
|
|
55
|
+
* declares no vision). Silent quality loss → frame (same C4 discipline as vision_placeholder). */
|
|
56
56
|
| {
|
|
57
57
|
kind: "document_placeholder";
|
|
58
58
|
count: number;
|
|
@@ -35,7 +35,7 @@ export interface RepetitionPoll {
|
|
|
35
35
|
readonly spared: RepetitionEvent[];
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
|
-
* Repetition telemetry (
|
|
38
|
+
* Repetition telemetry (2026-07-10): the cut event + allowance-spared hits for THIS stream.
|
|
39
39
|
* Polls re-inspect the same growing text every ~64 chars — dedupe spared by rule+segment so one
|
|
40
40
|
* boot block doesn't log once per poll. Attached to the final message as `repetition`.
|
|
41
41
|
*/
|
package/dist/config/catalog.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Config catalog (
|
|
2
|
+
* Config catalog (ruled 2026-07-19) — the SINGLE machine-readable source for the engineering
|
|
3
3
|
* configuration scale across every client (server / cli / TB harness / future shells).
|
|
4
4
|
*
|
|
5
5
|
* Why this exists: the same knob was found carrying FIVE different values across layers (maxTurns:
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
* nothing) or overrides it and DECLARES the override (`TaskSpec.configOverrides`, with a
|
|
13
13
|
* reason). Declared overrides ride the `config.assembled` trace, so every run self-reports its
|
|
14
14
|
* true knobs and their provenance — "who set 80" becomes a trace read, not archaeology.
|
|
15
|
-
* 3. **Announced change discipline
|
|
16
|
-
* changing one (or overriding persistently) posts the change to the shared
|
|
15
|
+
* 3. **Announced change discipline**: the recommendations are a living baseline — any repo
|
|
16
|
+
* changing one (or overriding persistently) posts the change to the shared config record so the
|
|
17
17
|
* scale evolves deliberately, together.
|
|
18
18
|
*
|
|
19
19
|
* v1 scope: the cross-client TASK-LAUNCH knobs (the chaos surface). Internal engine tuning
|
|
@@ -62,12 +62,12 @@ export interface EffectiveConfigField {
|
|
|
62
62
|
value: number | boolean | string | null;
|
|
63
63
|
provenance: ConfigProvenance;
|
|
64
64
|
}
|
|
65
|
-
/** Declaration bounds
|
|
65
|
+
/** Declaration bounds: host strings ride the trace stream — bounded and sanitized, never
|
|
66
66
|
* free-form. Beyond `MAX_OVERRIDE_DECLARATIONS` entries are dropped (count-capped, first-N kept). */
|
|
67
67
|
export declare const MAX_OVERRIDE_DECLARATIONS = 32;
|
|
68
68
|
/**
|
|
69
69
|
* Build the effective task-launch config + provenance from a spec's launch fields. Pure. The
|
|
70
|
-
* manifest must mirror ENGINE truth, not the spec's surface
|
|
70
|
+
* manifest must mirror ENGINE truth, not the spec's surface: `maxOutputTokens` falls back
|
|
71
71
|
* to the model's own cap (provenance `derived`) before "provider default".
|
|
72
72
|
*/
|
|
73
73
|
export declare function resolveEffectiveConfig(spec: {
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* display (the MF-W workflow monitor's `Read(path)` / `Bash(grep …)` activity line; the MF-24 permission-denial
|
|
4
4
|
* ledger's denied-tool input). Shared so both the activity sink and the denial record scrub identically — a
|
|
5
5
|
* single audited boundary. NOT `redactHostLeaks` (that is for untrusted-LLM egress and over-redacts the very
|
|
6
|
-
* path the trusted owner-scoped monitor wants to show).
|
|
6
|
+
* path the trusted owner-scoped monitor wants to show). Reviewed: 3 blocker + 5 major findings closed.
|
|
7
7
|
*/
|
|
8
8
|
/** Known credential SHAPES + `secretKey=value` — redacted from the FINAL abbreviated string, the single scrub
|
|
9
|
-
* point before any store/SSE fan-out
|
|
10
|
-
/**
|
|
9
|
+
* point before any store/SSE fan-out. Conservative (real credential formats). */
|
|
10
|
+
/** every prefix is LEFT-ANCHORED with \`(?<![A-Za-z0-9])\` — without it, ordinary words whose
|
|
11
11
|
* TAIL spells a prefix were silently redacted (NETWORK-attached → NETWO[redacted], RTMARK-100,
|
|
12
12
|
* task_categories, monkey=abcd1234, MonkeyJumping…) while triggering unpredictably on suffix
|
|
13
13
|
* length. \`_\` is deliberately NOT in the anchor class: \`api_key=\`, \`STRIPE=sk_live_…\`-style glued
|
|
@@ -82,7 +82,7 @@ export declare const SECRET_PASSES: readonly RedactionPass[];
|
|
|
82
82
|
export declare function scrubSecrets(s: string, report?: RedactionReport): string;
|
|
83
83
|
/** A SHORT, SECRET-SCRUBBED primary-arg summary. Abbreviation REDUCES the surface; a final {@link scrubSecrets}
|
|
84
84
|
* pass is the leak boundary (the value is PERSISTED + SSE-forwarded and may be read by a platform operator in a
|
|
85
|
-
* multi-tenant deployment
|
|
85
|
+
* multi-tenant deployment). Rules:
|
|
86
86
|
* • command → the command NAME (skip leading `VAR=val` env-prefixes; bail to `undefined` on a quoted assignment
|
|
87
87
|
* or a lone assignment; basename a path-form command; `+ …` if it had args).
|
|
88
88
|
* • file path → BASENAME only (no host directory layout).
|
package/dist/core/ask-class.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* F-012 L2 — the ENGINE-INTERNAL ask-class envelope.
|
|
3
3
|
*
|
|
4
4
|
* An `ask` verdict's SEMANTIC CLASS decides whether a deployment-declared sandbox may auto-admit it
|
|
5
|
-
* (
|
|
5
|
+
* (the ruling: a declared sandbox admits everything inside it — the boundary crossings park to a
|
|
6
6
|
* human, escape prevention belongs to the sandbox, not to engine re-policing). The class deliberately
|
|
7
7
|
* lives OUTSIDE the public `PermissionResult`: a decision object is caller-supplied data, and a
|
|
8
8
|
* self-reported "this ask is sandbox-local" field would be the same trust hole as the
|
|
@@ -27,7 +27,7 @@ export type AskClass = "sandbox_local" | "external_authority" | "hook" | "mandat
|
|
|
27
27
|
/**
|
|
28
28
|
* Brand a built-in policy instance with its ask class (engine factories only — not exported from the
|
|
29
29
|
* package). The `check` binding is LOCKED as a non-writable, non-configurable DATA property before the
|
|
30
|
-
* policy is returned (
|
|
30
|
+
* policy is returned (falsification-style round 4, HIGH): reading `policy.check` and INVOKING it must
|
|
31
31
|
* name the same callable, atomically. A plain `===` re-read was TOCTOU-able by an accessor — a getter
|
|
32
32
|
* could return the branded function to `policyAskClassOf` and a deployment ask to the gate's
|
|
33
33
|
* invocation. Locking the property makes the callable un-swappable and un-redefinable, so the class
|
|
@@ -23,7 +23,7 @@ export declare const ASK_USER_QUESTION_TOOL_NAME = "AskUserQuestion";
|
|
|
23
23
|
* injection vector. So a `selected` value is echoed as a chosen option ONLY if it is one of the offered option
|
|
24
24
|
* labels (`selected ⊆ options` — the model's own text), and the operator's free-text (`note`, plus any off-list
|
|
25
25
|
* input) is wrapped in an untrusted-DATA fence so it can never be read as instructions. Abort while waiting is
|
|
26
|
-
* handled by the §9 interrupt path (the pending call is closed). Mounting (
|
|
26
|
+
* handled by the §9 interrupt path (the pending call is closed). Mounting (CC non-interactive `isEnabled`
|
|
27
27
|
* parity): only when a delivery face exists — a live `onQuestion`, or a durable park consumer (`checkpointStore`
|
|
28
28
|
* + `durableApproval`/`forceDurableGate`), or an explicit `TaskSpec.interactiveTools: true` — see that knob.
|
|
29
29
|
*/
|
|
@@ -103,7 +103,7 @@ export interface MaybeCompactOptions {
|
|
|
103
103
|
/** The session to compact. Typed on the INTERFACE face (typecheck 车 2026-07-24): every member this
|
|
104
104
|
* module touches lives on `Session` (the optional `getPromptEpoch` degrades honestly via `?.()`). */
|
|
105
105
|
session: Session;
|
|
106
|
-
/**
|
|
106
|
+
/** This run's provider-declared prompt sections (the epoch declaration axis):
|
|
107
107
|
* the compaction-boundary epoch restatement/advance must hash the SAME artifact identity as the
|
|
108
108
|
* prepare-time pin, or every compaction under a declaration-carrying run would flap the pin. */
|
|
109
109
|
epochDeclaredSections?: import("../prompt-assembly/epoch.js").EpochDeclaredSections;
|
|
@@ -113,12 +113,12 @@ export interface MaybeCompactOptions {
|
|
|
113
113
|
* runs ONLY after that append succeeded — a failed/blocked compaction must swap nothing. */
|
|
114
114
|
centerAdoption?: {
|
|
115
115
|
/** Absent together with `clear` ⇒ never happens; adoption carries the new digest, ROLLBACK
|
|
116
|
-
* (explicit center disable
|
|
116
|
+
* (explicit center disable) carries `clear:true` and no digest. */
|
|
117
117
|
centerArtifactDigest?: string;
|
|
118
118
|
sourceRevision?: string;
|
|
119
119
|
clear?: true;
|
|
120
120
|
declaredSections: import("../prompt-assembly/epoch.js").EpochDeclaredSections;
|
|
121
|
-
/**
|
|
121
|
+
/** the post-swap prompt overhead in the trigger estimate's coordinate: used for THIS
|
|
122
122
|
* compaction's post-measurement so PTL recovery/anti-thrash see the swapped prefix size. */
|
|
123
123
|
overheadTokensAfter: number;
|
|
124
124
|
apply: (committedArtifactDigest?: string) => void;
|
|
@@ -254,7 +254,7 @@ export interface MaybeCompactOptions {
|
|
|
254
254
|
/** Per-file char cap (≈4 chars/token). Default 16_000 (~4k tokens). */
|
|
255
255
|
maxCharsPerFile?: number;
|
|
256
256
|
/**
|
|
257
|
-
*
|
|
257
|
+
* CC-parity selection set: the files the task has READ, most recent
|
|
258
258
|
* first (CC 198's post-compact restore sorts readFileState by timestamp — the read set is wider
|
|
259
259
|
* than the modified set and includes reference files the model consulted). When provided and
|
|
260
260
|
* non-empty it WINS over `modifiedFilesByRecency`; absent/empty falls back to the modified set
|
|
@@ -272,7 +272,7 @@ export interface MaybeCompactOptions {
|
|
|
272
272
|
*/
|
|
273
273
|
instructionSourcePaths?: ReadonlyArray<string>;
|
|
274
274
|
/**
|
|
275
|
-
* RB-197②(独立复审 +
|
|
275
|
+
* RB-197②(独立复审 + 命中,已修): `recentlyReadFiles` yields CANONICAL keys (resolveKey
|
|
276
276
|
* output — the same coordinate `ReadFileState` is keyed in), but `instructionSourcePaths` and the
|
|
277
277
|
* kept-tail scan inside `maybeCompact` (which reads raw tool-call arguments via
|
|
278
278
|
* `extractFileOpsFromMessage`) do NOT share that coordinate — a model-typed relative path and its
|
|
@@ -287,7 +287,7 @@ export interface MaybeCompactOptions {
|
|
|
287
287
|
*/
|
|
288
288
|
normalizePath?: (raw: string) => Promise<string>;
|
|
289
289
|
/**
|
|
290
|
-
* RB-197②(
|
|
290
|
+
* RB-197②(交叉复审命中,已修) — a kept-tail Read tool-CALL's mere presence does not prove the
|
|
291
291
|
* file's real content is visible there: its toolRESULT may be a dedup stub ("unchanged since you
|
|
292
292
|
* last read it…") whose ORIGINAL full transmission sits in the summarized prefix THIS compaction is
|
|
293
293
|
* about to cut away — preserving read-state for such a path would leave both the kept tail and the
|
|
@@ -307,7 +307,7 @@ export interface MaybeCompactOptions {
|
|
|
307
307
|
* `workingFileAttachments` deliberately — the invalidation is owed even when attachments are disabled
|
|
308
308
|
* (an empty array then). Best-effort: a throwing callback must not fail the landed compaction.
|
|
309
309
|
*
|
|
310
|
-
* RB-197②(
|
|
310
|
+
* RB-197②(命中,已修;独立复审第二轮又命中一条同族缺口,已修) `preserveReadState`:
|
|
311
311
|
* canonical-coordinate paths (same shape as `normalizePath`'s output) whose read-state entry must
|
|
312
312
|
* survive the compaction's clear even though they are NOT in `attachedComplete` — every file
|
|
313
313
|
* `maybeCompact` deliberately skipped re-attaching, for EITHER exclusion reason (kept-tail-visible,
|
|
@@ -434,7 +434,7 @@ export interface MaybeCompactOptions {
|
|
|
434
434
|
*/
|
|
435
435
|
postCompact?: Hooks["postCompact"];
|
|
436
436
|
/**
|
|
437
|
-
* MF-18 修②
|
|
437
|
+
* MF-18 修② — observe-only: fired when a summary call's serialized conversation INPUT was
|
|
438
438
|
* truncated to fit the compaction model's context window (the ~300K-session shape that previously
|
|
439
439
|
* guaranteed a provider prompt-too-long throw at every boundary). The caller bridges it to the
|
|
440
440
|
* `compaction.input_truncated` trace frame (fidelity disclosure). Fired BEFORE the summary call, so
|
|
@@ -446,7 +446,7 @@ export interface MaybeCompactOptions {
|
|
|
446
446
|
keptChars: number;
|
|
447
447
|
}) => void;
|
|
448
448
|
/**
|
|
449
|
-
* RB-402
|
|
449
|
+
* RB-402 — the design/36 ToolSearch activation set LIVE at this pass (the
|
|
450
450
|
* runner threads `[...prepared.activeTools]` on all three lanes: boundary, PTL recovery, finish).
|
|
451
451
|
* Persisted into the landed compaction entry's details (`CompactionDetails.activeTools`) so the
|
|
452
452
|
* NEXT task boundary's re-derivation — whose transcript source (ToolSearch toolCall parts) this
|
|
@@ -478,11 +478,11 @@ export declare function maybeCompact(opts: MaybeCompactOptions): Promise<{
|
|
|
478
478
|
* (auto/manual triggers only — never on "forced"). NOT a failure: the caller must not count it
|
|
479
479
|
* toward the compaction breaker; the next boundary consults the callback again. */
|
|
480
480
|
blocked?: boolean;
|
|
481
|
-
/** MF-18
|
|
481
|
+
/** MF-18 修①: set (with `compacted:false`) when compaction is DISABLED by settings
|
|
482
482
|
* (`enabled:false`) — the request can never be honored this run. Lets the caller resolve a manual
|
|
483
483
|
* /compact with the honest `"disabled"` outcome (and trace frame) instead of a structural noop. */
|
|
484
484
|
disabled?: boolean;
|
|
485
|
-
/** RB-398-b
|
|
485
|
+
/** RB-398-b: set (with `compacted:false`) when the pass PASSED the trigger gate
|
|
486
486
|
* (natural or forced) but found nothing to summarize — no valid cut point / empty history. Was
|
|
487
487
|
* previously indistinguishable from the quiet under-threshold return, so a forced pass with
|
|
488
488
|
* nothing to do looked identical to one that never wanted to run; the caller's outcome event
|
|
@@ -502,7 +502,7 @@ export declare function maybeCompact(opts: MaybeCompactOptions): Promise<{
|
|
|
502
502
|
firstKeptEntryId?: string;
|
|
503
503
|
/** design/84 Seam C: true when this compaction reused a `summaryProvider` summary (no LLM call). */
|
|
504
504
|
reused?: boolean;
|
|
505
|
-
/**
|
|
505
|
+
/** The working files re-read into the summary, in attachment order —
|
|
506
506
|
* surfaced so the `compacted` wire event carries them and a shell renders CC's post-compact
|
|
507
507
|
* `Read {path} (…)` cards. Set only when `compacted` is true and attachments were added. */
|
|
508
508
|
attachedFiles?: Array<{
|
|
@@ -517,7 +517,7 @@ export declare function maybeCompact(opts: MaybeCompactOptions): Promise<{
|
|
|
517
517
|
* sanitized auto threshold — the "couldn't compact it down" signal {@link nextTrimForceBackoff}
|
|
518
518
|
* consumes. Set only when `compacted` and the post measurement succeeded. */
|
|
519
519
|
postOverThreshold?: boolean;
|
|
520
|
-
/** TB telemetry B4
|
|
520
|
+
/** TB telemetry B4: wall time of the whole compaction pass (context build → summary
|
|
521
521
|
* call → history rewrite → post measurement). Set only when `compacted` — the `compacted` wire event
|
|
522
522
|
* carries it so a consumer sees what a boundary pause actually cost. */
|
|
523
523
|
durationMs?: number;
|
|
@@ -536,7 +536,7 @@ export declare function maybeCompact(opts: MaybeCompactOptions): Promise<{
|
|
|
536
536
|
* batch that adds an additive passthrough next to runtask's existing
|
|
537
537
|
* `...(comp.durationMs !== undefined ? { durationMs: comp.durationMs } : {})` spread. */
|
|
538
538
|
phaseDurations?: CompactionPhaseDurations;
|
|
539
|
-
/**
|
|
539
|
+
/** C3: set (with `compacted:false`) when the pass was over the auto threshold but the
|
|
540
540
|
* anti-thrash floor (`minTokens`) suppressed it — the caller bridges this to `compaction.suppressed`. */
|
|
541
541
|
suppressedByFloor?: {
|
|
542
542
|
estTokens: number;
|
|
@@ -569,7 +569,7 @@ export declare function maybeCompact(opts: MaybeCompactOptions): Promise<{
|
|
|
569
569
|
modelId?: string;
|
|
570
570
|
};
|
|
571
571
|
/**
|
|
572
|
-
* RB-126
|
|
572
|
+
* RB-126 (2026-07-25): the trigger inputs THIS pass used, reported on
|
|
573
573
|
* EVERY return path — including the ordinary "nothing to do" one. A consumer rendering "how full is the
|
|
574
574
|
* context" was otherwise forced to re-derive the numerator itself, and a re-derivation that drifts from
|
|
575
575
|
* the engine's own is the projection-antipattern this repo keeps paying for: the displayed percentage
|