@sema-agent/core 5.57.0 → 5.58.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 +48 -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/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.js +2 -0
- 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 +207 -0
- package/dist/core/memory-engine/consolidation-driver.js +378 -0
- package/dist/core/memory-engine/consolidation.d.ts +46 -2
- package/dist/core/memory-engine/consolidation.js +1 -0
- 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 +47 -3
- package/dist/core/memory-engine/engine.js +37 -3
- package/dist/core/memory-engine/file-backend.d.ts +1 -1
- package/dist/core/memory-engine/index.d.ts +4 -2
- package/dist/core/memory-engine/index.js +4 -2
- 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-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 +194 -31
- package/dist/core/permission-rule-model.js +93 -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 +21 -14
- package/dist/core/runner/prepare-workspace-restore.d.ts +2 -2
- package/dist/core/runner/runtask.d.ts +11 -11
- 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 +55 -28
- 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 +123 -70
- 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 +5 -4
- package/dist/index.js +3 -2
- 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 +56 -3
|
@@ -104,7 +104,7 @@ export interface StreamOptions {
|
|
|
104
104
|
*/
|
|
105
105
|
timeoutMs?: number;
|
|
106
106
|
/**
|
|
107
|
-
*
|
|
107
|
+
* P0 — true when `maxTokens` on THIS call was DYNAMICALLY SHRUNK by the wall-clock
|
|
108
108
|
* cap (design/130 P1), not statically configured. A provider hitting max_tokens with ONLY
|
|
109
109
|
* reasoning output should then finish as a RECOVERABLE `length` stop (the loop's truncated-output
|
|
110
110
|
* continue picks it up; the next call is cap-exempt via the runtime reasoning observation) instead
|
|
@@ -113,7 +113,7 @@ export interface StreamOptions {
|
|
|
113
113
|
*/
|
|
114
114
|
maxTokensDynamic?: boolean;
|
|
115
115
|
/**
|
|
116
|
-
*
|
|
116
|
+
* the STATIC leg of the dynamicCut family. True = the caller (the agent
|
|
117
117
|
* loop) is prepared to recover a `length` stop, so a provider hitting the STATIC max_tokens with
|
|
118
118
|
* ONLY reasoning output (a budget-ignoring thinking model — e.g. a Qwen gateway that ignores the
|
|
119
119
|
* thinking control plane and eats the whole static budget in one thought) may finish as a
|
|
@@ -126,7 +126,7 @@ export interface StreamOptions {
|
|
|
126
126
|
*/
|
|
127
127
|
staticReasoningCutDowngrade?: boolean;
|
|
128
128
|
/**
|
|
129
|
-
* design/131 (
|
|
129
|
+
* design/131 (拍) — per-task resilience INTENT flags, threaded per call so the
|
|
130
130
|
* resilience decorator stack (degrading / failover / circuit-breaker) can stand aside for THIS
|
|
131
131
|
* task. Intent-only: no decorator topology rides the wire; each layer reads the flag it owns and
|
|
132
132
|
* defaults to today's behavior when absent. See design/131-per-task-resilience-overrides.md.
|
|
@@ -206,7 +206,7 @@ export interface ImagesOptions {
|
|
|
206
206
|
}
|
|
207
207
|
export type ProviderImagesOptions = ImagesOptions & Record<string, unknown>;
|
|
208
208
|
export interface SimpleStreamOptions extends StreamOptions {
|
|
209
|
-
/**
|
|
209
|
+
/** widened to include the explicit "off" — an off that reaches the wire layer lets the
|
|
210
210
|
* brains emit the provider DISABLE key on binary enable formats (default-on Qwen gateways reason
|
|
211
211
|
* on absence, so absence ≠ off there). Both brains guard: off never enables thinking. */
|
|
212
212
|
reasoning?: ModelThinkingLevel;
|
|
@@ -297,7 +297,7 @@ export interface UserMessage {
|
|
|
297
297
|
content: string | (TextContent | ImageContent)[];
|
|
298
298
|
timestamp: number;
|
|
299
299
|
/**
|
|
300
|
-
* [c209-C]
|
|
300
|
+
* [c209-C] 收口 C1/C2 — EXACT character length of the ENGINE-PREPENDED prefix on this
|
|
301
301
|
* user-lane message (first-frame listing/`<skills>` reminders + a UserPromptSubmit
|
|
302
302
|
* additionalContext reminder ahead of the objective; the trusted engine-authored head of a resume
|
|
303
303
|
* continuation). Derived views that re-present user messages under a `[user]`/`[User]:` label
|
|
@@ -310,7 +310,7 @@ export interface UserMessage {
|
|
|
310
310
|
*/
|
|
311
311
|
enginePrefixChars?: number;
|
|
312
312
|
/**
|
|
313
|
-
* [c209-C] R4
|
|
313
|
+
* [c209-C] R4 终判 — the ENGINE-TRUSTED SEGMENTS of this user-lane message, as half-open
|
|
314
314
|
* `[start, end)` UTF-16 code-unit ranges into the flattened text content (ascending,
|
|
315
315
|
* non-overlapping). Generalizes {@link UserMessage.enginePrefixChars} beyond the head: the resume
|
|
316
316
|
* continuation preserves ISSUE ORDER (parked steer first, wake message second — the public
|
|
@@ -334,13 +334,13 @@ export interface UserMessage {
|
|
|
334
334
|
end: number;
|
|
335
335
|
}>;
|
|
336
336
|
/**
|
|
337
|
-
* [c209-C]
|
|
337
|
+
* [c209-C] 收口 C1/C2 — this ENTIRE message is engine-minted guidance (deadline nudges,
|
|
338
338
|
* graceful-finalize write-out steers, boundary attachment bundles, final-verification / stop-hook
|
|
339
339
|
* reminders), not user speech. Derived views must not present it under `[user]` authority
|
|
340
340
|
* (auto-mode window: neutral annotation; compaction serialization: skipped). Same additive /
|
|
341
341
|
* old-session-verbatim / never-on-the-wire posture as {@link UserMessage.enginePrefixChars}.
|
|
342
342
|
*
|
|
343
|
-
* [c209-C] R4
|
|
343
|
+
* [c209-C] R4 终判 — MUTUALLY EXCLUSIVE with {@link UserMessage.provenance}: a message is
|
|
344
344
|
* either wholly SKIPPABLE (`engineMinted`) or MUST-STAY-VISIBLE (`provenance:"engine-note"`),
|
|
345
345
|
* never both. The exclusion is enforced at runtime (mint clamp in the harness'
|
|
346
346
|
* `createUserMessage`, normalization at the session import gate) and defensively at every
|
|
@@ -349,7 +349,7 @@ export interface UserMessage {
|
|
|
349
349
|
*/
|
|
350
350
|
engineMinted?: true;
|
|
351
351
|
/**
|
|
352
|
-
* [c209-C] R3
|
|
352
|
+
* [c209-C] R3 收口 — the "visible but not the user" THIRD state. This message is an
|
|
353
353
|
* ENGINE-INJECTED note whose CONTENT the model must read (LSP `<new-diagnostics>` blocks,
|
|
354
354
|
* task-notification frames, TaskStream steering, dynamic memory re-recall, loop recovery
|
|
355
355
|
* guidance), but which is NOT user speech. Two-state contrast with {@link UserMessage.engineMinted}:
|
|
@@ -389,7 +389,7 @@ export interface AssistantMessage {
|
|
|
389
389
|
responseId?: string;
|
|
390
390
|
diagnostics?: AssistantMessageDiagnostic[];
|
|
391
391
|
usage: Usage;
|
|
392
|
-
/** TB 尸检 T1-5
|
|
392
|
+
/** TB 尸检 T1-5: the provider never delivered a usage frame for this message (e.g. a
|
|
393
393
|
* degenerate-repetition cutoff cancelled the stream first) — `usage` above is a zero-synthesized shell.
|
|
394
394
|
* Consumers must treat the numbers as UNKNOWN, not zero. Absent ⇒ usage is provider-reported. */
|
|
395
395
|
usageMissing?: true;
|
|
@@ -429,7 +429,7 @@ export interface AssistantMessage {
|
|
|
429
429
|
*/
|
|
430
430
|
partialFinalized?: true;
|
|
431
431
|
/**
|
|
432
|
-
* Degenerate-repetition telemetry for THIS call (
|
|
432
|
+
* Degenerate-repetition telemetry for THIS call (2026-07-10: counts + detected segment, not just
|
|
433
433
|
* a boolean). `cut` = the event that cancelled the stream (always paired with the DEGENERATE_MESSAGE
|
|
434
434
|
* errorMessage); `spared` = repetitions that landed in a detection window but were exempted by a
|
|
435
435
|
* 2e1c161 structural allowance (code-line shape / divider run) — deduped per stream by rule+segment.
|
|
@@ -441,7 +441,7 @@ export interface AssistantMessage {
|
|
|
441
441
|
spared?: RepetitionEvent[];
|
|
442
442
|
};
|
|
443
443
|
/**
|
|
444
|
-
*
|
|
444
|
+
* this `length` stop is a DOWNGRADED reasoning-only STATIC max_tokens hit — the
|
|
445
445
|
* model spent the entire static output budget on thinking (budget-ignoring gateway shape) and the
|
|
446
446
|
* brain, granted `StreamOptions.staticReasoningCutDowngrade`, finished the turn as a recoverable
|
|
447
447
|
* `length` instead of the fail-loud config error. The agent loop counts these per run to enforce
|
|
@@ -461,7 +461,7 @@ export interface ToolResultMessage<TDetails = unknown> {
|
|
|
461
461
|
}
|
|
462
462
|
export type Message = UserMessage | AssistantMessage | ToolResultMessage;
|
|
463
463
|
/**
|
|
464
|
-
* RB-3 (
|
|
464
|
+
* RB-3 (stage S4 carry): strip the engine-provenance metadata fields from user messages before
|
|
465
465
|
* serializing a Context to an external wire. The five fields (`enginePrefixChars`/`engineSegments`/
|
|
466
466
|
* `engineMinted`/`provenance`/`actor`, the last per design/171 §5.2) are INTERNAL coordination
|
|
467
467
|
* between the engine's minting side and its consumers (permission classifier, compaction summarizer,
|
|
@@ -502,7 +502,7 @@ export interface Tool<TParameters extends TSchema = TSchema> {
|
|
|
502
502
|
export interface Context {
|
|
503
503
|
systemPrompt?: string;
|
|
504
504
|
/**
|
|
505
|
-
*
|
|
505
|
+
* S4 (prompt-assembly §5.4, ADDITIVE): the system prompt as PHYSICAL blocks with
|
|
506
506
|
* per-block cache-span boundaries. Compatibility projection duty (plan M13): when present,
|
|
507
507
|
* `systemPrompt` is ALWAYS also populated with the equivalent joined text — a Brain that only
|
|
508
508
|
* reads `systemPrompt` gets wire-equivalent input (single merged block), never a dropped prompt.
|
|
@@ -33,7 +33,7 @@ export type LoopTerminalReason =
|
|
|
33
33
|
| "assistant_error"
|
|
34
34
|
/** `shouldStopAfterTurn` requested a clean stop at the turn boundary (mod #16 one-shot). */
|
|
35
35
|
| "stop_requested"
|
|
36
|
-
/** RB-206(
|
|
36
|
+
/** RB-206 (CC 220 counterpart @400176-400230, `Bxs` @397652-397674 buckets it
|
|
37
37
|
* with budget_exhausted/api_error/model_error/turn_setup_failed, explicitly NOT `"completed"`): every
|
|
38
38
|
* tool call in the turn was dropped as malformed AND the bounded `malformed_tool_use_retry` nudge
|
|
39
39
|
* budget is used up — the model believes it acted, nothing ran, and there is no more recovery budget
|
|
@@ -48,13 +48,13 @@ export type LoopTerminalReason =
|
|
|
48
48
|
* 区分;调用方若需要"最近是否连续失败"这类更细的语义,需要自行在更高层维护窗口计数,这个 reason 只
|
|
49
49
|
* 承诺"预算耗尽"这一件事。 */
|
|
50
50
|
| "malformed_tool_use_exhausted"
|
|
51
|
-
/** RB-258(
|
|
51
|
+
/** RB-258(RB-206 口径追查的衍生发现;RB-206 的同族对仗):the model kept ending its turn on the
|
|
52
52
|
* provider's output cap (`length`) with no tool calls, and the bounded truncated-output continue
|
|
53
53
|
* budget (`recovery.truncatedOutput.maxContinues`, default 3) is used up — every further nudge would
|
|
54
54
|
* buy another cut-off fragment. Before this reason existed, this case fell through to the generic
|
|
55
55
|
* no-more-work path and was reported as a plain `"completed"`, indistinguishable from an answer that
|
|
56
56
|
* actually finished — the same defect RB-206 fixed in the malformed lane, on the shape production
|
|
57
|
-
* hits MORE often (
|
|
57
|
+
* hits MORE often (1/89 real questions reached the precondition).
|
|
58
58
|
*
|
|
59
59
|
* Scope notes (deliberate, mirroring the malformed lane):
|
|
60
60
|
* - Only the CONFIGURED lane reports it. With `recovery.truncatedOutput` absent (the loop default
|
|
@@ -483,7 +483,7 @@ export interface CompactionSummaryMessage {
|
|
|
483
483
|
tokensBefore: number;
|
|
484
484
|
/** Timestamp may be numeric in memory or string when loaded from older persisted rows. */
|
|
485
485
|
timestamp: number | string;
|
|
486
|
-
/** RB-398-b
|
|
486
|
+
/** RB-398-b①: how many transcript messages this summary stands in for — counted at
|
|
487
487
|
* render time by `buildSessionContext` (the one place entries become context), so it covers the
|
|
488
488
|
* cumulative elision across repeated compactions. Drives the wrapper's scale disclosure
|
|
489
489
|
* (`convertToLlm`); absent (directly constructed messages, older render paths) ⇒ the wrapper is
|
|
@@ -535,7 +535,7 @@ export interface AgentToolResult<T> {
|
|
|
535
535
|
content: (TextContent | ImageContent | DocumentContent)[];
|
|
536
536
|
/** Arbitrary structured details for logs or UI rendering. */
|
|
537
537
|
details: T;
|
|
538
|
-
/**
|
|
538
|
+
/** mark a RETURNED failure receipt as an error without throwing (keeps structured
|
|
539
539
|
* `details` while the wire tool_result carries is_error:true; a non-thrown failure marked
|
|
540
540
|
* non-error walks the shell's success rendering and can vanish). Omitted = success. */
|
|
541
541
|
isError?: boolean;
|
|
@@ -560,10 +560,10 @@ export interface AgentTool<TParameters extends TSchema = TSchema, TDetails = unk
|
|
|
560
560
|
* Must return an object that matches `TParameters`.
|
|
561
561
|
*/
|
|
562
562
|
prepareArguments?: (args: unknown) => Static<TParameters>;
|
|
563
|
-
/**
|
|
563
|
+
/** OPTIONAL approval display projection: how this tool's args render for a human
|
|
564
564
|
* approval surface (live onAsk dialogs, durable approval inboxes). Pure and cheap; the gate
|
|
565
565
|
* clamps/serializes the result, strips control characters from every string leaf, and swallows
|
|
566
|
-
* throws. **UNTRUSTED + ADVISORY-ONLY
|
|
566
|
+
* throws. **UNTRUSTED + ADVISORY-ONLY**: the projection is authored by the
|
|
567
567
|
* tool over model-authored args and can misrepresent the executable action — renderers MUST
|
|
568
568
|
* contextually escape it, and approval surfaces MUST offer the bound raw args alongside
|
|
569
569
|
* (boundInputHash binds args, never the preview). NEVER adjudication input. Mechanism-neutral:
|
|
@@ -123,7 +123,7 @@ export declare function languageFor(filePath: string): string | undefined;
|
|
|
123
123
|
* enforces it model-visibly; re-exported here so engine-path importers keep working. */
|
|
124
124
|
export { MAX_LSP_FILE_BYTES } from "../../core/lsp.js";
|
|
125
125
|
/**
|
|
126
|
-
* RB-232
|
|
126
|
+
* RB-232: the local default {@link LspReadText}, hardened with a stat-first precondition (CC
|
|
127
127
|
* 2.1.220 validateInput does the same before ever reading — "Path is not a file", pretty220.js ~474700).
|
|
128
128
|
* The stat check is the LOAD-BEARING part, do not "simplify" it away: a plain `readFile` on a FIFO/socket
|
|
129
129
|
* blocks forever on the FIRST read and PINS a libuv threadpool thread (default pool = 4) for the process
|
|
@@ -133,7 +133,7 @@ export { MAX_LSP_FILE_BYTES } from "../../core/lsp.js";
|
|
|
133
133
|
* `env.fileInfo` before any read — this is defense in depth for direct/embedder callers.)
|
|
134
134
|
*/
|
|
135
135
|
export declare const defaultLspReadText: LspReadText;
|
|
136
|
-
/**
|
|
136
|
+
/** ask ②: on Windows, npm-global language servers materialize as `.cmd` shims and
|
|
137
137
|
* Node 20+ `spawn(cmd, args)` without a shell rejects them (EINVAL, CVE-2024-27980 hardening) —
|
|
138
138
|
* every DEFAULT_LSP_SERVERS entry would silently degrade to "no LSP". `shell:true` routes through
|
|
139
139
|
* cmd.exe so PATHEXT/.cmd resolution works. Injection surface: `command`/`args` come from
|
|
@@ -31,7 +31,7 @@ export declare class StreamingImportValidator {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* Validate a verbatim session-entry log for cross-backend IMPORT (2c session-sync
|
|
34
|
+
* Validate a verbatim session-entry log for cross-backend IMPORT (2c session-sync). The ARRAY
|
|
35
35
|
* form of {@link StreamingImportValidator} (ONE source of truth — this just drives step()/finish() over the
|
|
36
36
|
* array, kept for `fork`/tests that already hold the whole log). Fail-CLOSED: any violation throws
|
|
37
37
|
* `SessionError("invalid_session")` and nothing is written.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SessionTreeEntry } from "../harness/types.js";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* session-sync — the SHARED content digest for a session entry log.
|
|
4
4
|
*
|
|
5
5
|
* ## The gap this closes
|
|
6
6
|
* `classifySyncRelationshipByIds` compares only the SET of entry ids. Entry ids are uuidv7, not content
|
|
@@ -10,10 +10,10 @@ export declare class InMemorySessionRepo implements SessionRepo<SessionMetadata,
|
|
|
10
10
|
list(): Promise<SessionMetadata[]>;
|
|
11
11
|
delete(metadata: SessionMetadata): Promise<void>;
|
|
12
12
|
fork(sourceMetadata: SessionMetadata, options: SessionForkOptions): Promise<Session>;
|
|
13
|
-
/** 2c session-sync
|
|
13
|
+
/** 2c session-sync: the FULL log for export. InMemory holds everything (no F3 floor), so
|
|
14
14
|
* `getEntries()` IS the full oldest-first log with `id`/`parentId` verbatim. */
|
|
15
15
|
exportEntries(sessionId: string): Promise<SessionTreeEntry[]>;
|
|
16
|
-
/** 2c session-sync
|
|
16
|
+
/** 2c session-sync: import a verbatim log into `sessionId`. The single invariant gate runs first
|
|
17
17
|
* ({@link validateEntriesForImport}, fail-closed); `owner` is a durable multi-tenant concept that the local
|
|
18
18
|
* in-memory backend has no field for, so it is accepted but unused here. design/171: the operator's
|
|
19
19
|
* trusted-import flag is forwarded to the gate that persists — see SessionRepo.importEntries. */
|
|
@@ -29,7 +29,7 @@ export declare class StoredSession<TMetadata extends SessionMetadata = SessionMe
|
|
|
29
29
|
appendThinkingLevelChange(thinkingLevel: string): Promise<string>;
|
|
30
30
|
appendModelChange(provider: string, modelId: string): Promise<string>;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* S3 (prompt-assembly §9.2): persist the session's prompt-epoch pin as a first-class
|
|
33
33
|
* typed entry. Written at session start (BEFORE the first conversation entry — the resume path
|
|
34
34
|
* must never see user entries with no pin) and on legacy migration; compactions restate the pin
|
|
35
35
|
* in their own `details.promptEpoch` instead (same-CAS with the new baseline).
|
|
@@ -71,7 +71,7 @@ export declare class StoredSession<TMetadata extends SessionMetadata = SessionMe
|
|
|
71
71
|
entryId?: string;
|
|
72
72
|
} | undefined>;
|
|
73
73
|
/**
|
|
74
|
-
* design/155
|
|
74
|
+
* design/155: persist the settle-time workspace state (tracked cwd + active
|
|
75
75
|
* EnterWorktree session) as a first-class typed entry. Called best-effort at task settle when the
|
|
76
76
|
* state changed — an append failure degrades to "the next turn starts at the task root", exactly
|
|
77
77
|
* the pre-155 behavior, never fails the run. The same shape gate guards append, read, and the
|
|
@@ -115,7 +115,7 @@ export declare class StoredSession<TMetadata extends SessionMetadata = SessionMe
|
|
|
115
115
|
* `details.announcedListings` restatement; SNAPSHOT semantics: first hit wins). Malformed
|
|
116
116
|
* carriers are skipped (defense in depth behind the import door), never returned.
|
|
117
117
|
* Undefined ⇒ no carrier VISIBLE on this branch — callers fall back to the checkpoint mirror /
|
|
118
|
-
* transcript probe. Honest bound (
|
|
118
|
+
* transcript probe. Honest bound (RB-33): a bounded-tail backend whose load floor
|
|
119
119
|
* cut every carrier (and a rewind cut between the floor and the newest compaction) also returns
|
|
120
120
|
* undefined — the ladder degrades to the lower rungs (worst case a duplicate re-announce, never a
|
|
121
121
|
* loss). A floor-anchor seam (the getEpochAnchor analog) is deliberately deferred until a real
|
|
@@ -127,7 +127,7 @@ export declare class StoredSession<TMetadata extends SessionMetadata = SessionMe
|
|
|
127
127
|
models?: string[];
|
|
128
128
|
} | undefined>;
|
|
129
129
|
/**
|
|
130
|
-
* Recover the pinned prompt epoch for the ACTIVE branch (
|
|
130
|
+
* Recover the pinned prompt epoch for the ACTIVE branch (stage S3). Walks the branch from the
|
|
131
131
|
* leaf backwards: the nearest `compaction` entry's `details.promptEpoch` restatement wins (the
|
|
132
132
|
* bounded-tail/F3 floor may have cut everything older); else the nearest `prompt_epoch` entry
|
|
133
133
|
* (root pin / legacy migration). Undefined ⇒ pre-epoch session (upgrade-in-place migration path).
|
package/dist/fixtures/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `@sema-agent/core/fixtures` — GOLDEN SHAPE fixtures for downstream consumers (server/SDK/cli),
|
|
3
|
-
* the L2 layer of the
|
|
3
|
+
* the L2 layer of the anti-drift defense: downstream tests consume THESE shapes instead of
|
|
4
4
|
* hand-building requests/frames, so an upstream shape change breaks a test instead of shipping a
|
|
5
|
-
* silent mismatch (the
|
|
5
|
+
* silent mismatch (the "bare req = false-green pins" class).
|
|
6
6
|
*
|
|
7
7
|
* CONTRACT — shape truth, not value truth:
|
|
8
8
|
* - Every volatile value is NORMALIZED to an angle-bracket placeholder (`"<issuing-session-id>"`,
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
* the same normalization, and requires deep equality with the fixture. A shape change upstream
|
|
14
14
|
* turns THAT pin red first — the fixture can never drift from the engine.
|
|
15
15
|
* - Additions here are additive API: removing/renaming a fixture key is a downstream-visible
|
|
16
|
-
* BREAKING change and belongs in the release notes' frame-shape section
|
|
16
|
+
* BREAKING change and belongs in the release notes' frame-shape section.
|
|
17
17
|
*/
|
|
18
18
|
import type { AskRequest } from "../core/tool-policy.js";
|
|
19
19
|
/** The normalization placeholders used across all fixtures (downstream may match on the form). */
|
|
20
20
|
export declare const FIXTURE_PLACEHOLDER_RE: RegExp;
|
|
21
21
|
/**
|
|
22
22
|
* AskRequest, HOST form — the shape a live `onAsk` approver receives when the HOST task's own
|
|
23
|
-
* gate raises a permission ask. Key facts downstream must not re-derive by guessing
|
|
23
|
+
* gate raises a permission ask. Key facts downstream must not re-derive by guessing:
|
|
24
24
|
* - `sourceTaskId` is PRESENT on host asks too (always the issuing task's session id) — it is
|
|
25
25
|
* NOT a subagent discriminator;
|
|
26
26
|
* - `fromSubagent` / `sourceAgentName` are ABSENT on host asks (design/153 §1: `fromSubagent`
|
package/dist/index.d.ts
CHANGED
|
@@ -156,25 +156,26 @@ export { createPermissionRulePolicy, validatePermissionRules, parsePermissionRul
|
|
|
156
156
|
* and nothing more. Removal is exported without ceremony, because narrowing on a user's behalf is
|
|
157
157
|
* allowed and widening is not.
|
|
158
158
|
*/
|
|
159
|
-
export { parseAllowRuleText, formatAllowRuleText, ruleAdmitsCommand, findAdmittingRule, suggestRulesForCommand, scopeCoversCwd, pathWithinRoot, isRuleLive, BARE_INTERPRETER_NAMES, MAX_RULE_TEXT_CHARS, type PersistedAllowRule, type RuleTombstone, type RuleScope, type RuleDot, type RuleAdd, type RuleAddOrigin, type
|
|
159
|
+
export { parseAllowRuleText, formatAllowRuleText, ruleAdmitsCommand, findAdmittingRule, suggestRulesForCommand, scopeCoversCwd, pathWithinRoot, isRuleLive, BARE_INTERPRETER_NAMES, MAX_RULE_TEXT_CHARS, type PersistedAllowRule, type RuleTombstone, type RuleScope, type RuleDot, type RuleAdd, type RuleAddOrigin, type RuleOffer, type SegmentRuleSuggestion, type SegmentCoverage, type RuleReject, type RuleRejectCode, type ParsedAllowRule, type PersistedRuleTool, type PersistedRuleMatch, } from "./core/permission-rule-model.js";
|
|
160
160
|
export { removePersistedRule, applyTombstones, sameScope, InMemoryPermissionRuleStore, EMPTY_RULE_STORE, type PermissionRuleStore, type PermissionRuleStoreProvider, type StoredAllowRules, type RemoveResult, type PutResult, joinRuleStates, screenRuleSyncState, collectBelowFrontier, ruleSyncVector, joinFrontiers, dotAtOrBelowFrontier, sameRuleOwner, type RuleSyncState, type RuleSyncFrontier, type RuleSyncDrop, type RuleSyncLandingReport, type RuleOwner, type QuarantinedRuleAdd, PERMISSION_RULE_WRITER, writerOf, foldDelta, addDotsOf, assertDeleteDeltaCarriesNoAdd, assertRedemptionNotQuarantined, type PermissionRuleWriter, type WritablePermissionRuleStore, type RuleWriteDelta, type RuleAddDelta, type RuleDeleteDelta, type RuleSyncJoinDelta, type RawRuleSyncState, type RedemptionAuthorization, } from "./core/permission-rule-store.js";
|
|
161
161
|
export { syncPermissionRules, parseRuleSyncResponse, PERMISSION_RULE_SYNC_PATH, LOCAL_OWNER_UNSYNCABLE_CODE, type PermissionRuleSyncTransport, type PermissionRuleSyncResult, type RuleSyncRequestBody, type RuleSyncResponseBody, } from "./core/permission-rule-sync.js";
|
|
162
162
|
export { createOrgRuleOverlay, orgRuleVerdictFor, effectivePermissionRules, orgRuleStatePersistenceOf, ORG_UNAVAILABLE_DECISION_REASON, ORG_RULE_DECISION_REASON, ORG_ADJUDICATION_TIMEOUT_MS, type OrgPermissionRule, type OrgRuleSnapshot, type OrgRuleSnapshotProvider, type OrgRuleStatePersistence, type PersistedOrgRuleState, type OrgRuleOverlay, type OrgOverlayResolution, type OrgOverlayStatus, type EffectivePermissionRule, } from "./core/permission-rule-org.js";
|
|
163
163
|
export { RULE_SYNC_DROP_CODES, type RuleSyncDropReason, type RuleQuarantineReason } from "./core/governance-codes.js";
|
|
164
|
-
export { prepareCardApproval, confirmRuleApproval, type ConfirmResult, type ConfirmRefusalReason, precheckEditedRuleText, type EditedRuleTextPrecheck, redeemRuleTicket, redeemRuleBatch, prepareCcImport, prepareStarterBatch, mintRuleTicket, STARTER_RULES, InMemoryRuleApprovalRecordStore, type RuleTicket, type RuleCandidate, type RuleApprovalKind, type RuleApprovalRecord, type RuleApprovalRecordStore, type RuleConsentDeps, type RedeemResult, type
|
|
164
|
+
export { prepareCardApproval, confirmRuleApproval, type ConfirmResult, type ConfirmRefusalReason, precheckEditedRuleText, type EditedRuleTextPrecheck, redeemRuleTicket, redeemRuleBatch, prepareCcImport, prepareStarterBatch, mintRuleTicket, STARTER_RULES, InMemoryRuleApprovalRecordStore, ruleOffersOfRecord, type RuleTicket, type RuleCandidate, type RuleApprovalKind, type RuleApprovalRecord, type RuleApprovalRecordStore, type RuleOffer2, type StaleRuleApprovalRecord, type RuleConsentDeps, type RedeemResult, type RedeemedBatchMember, type CcImportLayer, type ImportedSettingsLayer, type ImportPreview, } from "./core/permission-rule-consent.js";
|
|
165
165
|
export { FilePermissionRuleStoreProvider } from "./stores/file/permission-rule-store.js";
|
|
166
166
|
export { adoptFilePermissionRuleStore, type AdoptFileRuleStoreResult } from "./stores/file/permission-rule-adopt.js";
|
|
167
167
|
export { AdoptionError, assertAdoptionBootGate, readRootAdoptionFile, writeRootAdoptionFile, ROOT_ADOPTION_FILE, type AdoptionErrorCode, type AdoptionSource, type AdoptionReport, type AdoptionReceipt, type AdoptionLegReport, type AffectedDeploymentConfig, type RootAdoptionFile, } from "./stores/file/adoption/marker.js";
|
|
168
168
|
export { adoptLocalDataRoot, ackAdoptionConfig, witnessAdoptionConfig, listAdoptionQuarantine, readAdoptionStatus, type AdoptionStatus, type AdoptLocalDataRootOptions, type AdoptLocalDataRootResult, type AdoptionCarriageLeg, type AdoptionCarriageLegContext, type AdoptionConfigWitnessReceipt, } from "./stores/file/adoption/adopt.js";
|
|
169
|
-
export { formatHookFeedback, runToolGate, createHookEnvCapabilities, createPreToolUseConstraintPolicy, type PersistedRuleHit, type PersistedRuleUnreadable, type PersistedRuleAnswer, normalizePersistedRuleHit, type Hooks, type HookToolContext, type HookInvocationIdentity, type UserPromptSubmitContext, type PostToolBatchContext, type HookEnvCapabilities, type HookToolOutput, type PreToolUseResult, type PostToolUseResult, type UserPromptSubmitResult, type HookToolFailure, type PostToolUseFailureResult, type PostToolBatchCall, type PostToolBatchResult, type PreCompactContext, type PreCompactResult, type PostCompactContext, type StopFailureContext, type PermissionDeniedPayload, type PermissionDeniedSource, } from "./core/hooks.js";
|
|
169
|
+
export { formatHookFeedback, runToolGate, createHookEnvCapabilities, createPreToolUseConstraintPolicy, type PersistedRuleHit, type PersistedRuleHitRule, type PersistedRuleUnreadable, type PersistedRuleCoverage, type PersistedRuleAnswer, normalizePersistedRuleHit, type Hooks, type HookToolContext, type HookInvocationIdentity, type UserPromptSubmitContext, type PostToolBatchContext, type HookEnvCapabilities, type HookToolOutput, type PreToolUseResult, type PostToolUseResult, type UserPromptSubmitResult, type HookToolFailure, type PostToolUseFailureResult, type PostToolBatchCall, type PostToolBatchResult, type PreCompactContext, type PreCompactResult, type PostCompactContext, type StopFailureContext, type PermissionDeniedPayload, type PermissionDeniedSource, } from "./core/hooks.js";
|
|
170
170
|
export { InMemoryMemoryStore, composeMemoryBlock, composeLayeredMemoryBlock, normalizeMemorySpec, type NormalizedMemorySpec, type MemorySpecInput, supportsConsolidation, supportsPeriodicConsolidation, firstSentence, expandLexicalTerms, lexicalSearchMatch, type Embedder, classifyPromotable, enforcePromotableWriteGate, guardedMemoryStore, MemoryGateError, detectSecret, enforceSecretWriteGate, enforceStructuredNoteSecretGate, type UtilityGate, type MemoryStore, type MemoryVectorMode, type ScoredMemory, type MemoryNoteHeader, type MemoryNoteRecord, type MemoryNoteType, type StructuredNoteInput, } from "./core/memory.js";
|
|
171
|
-
export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, type MemoryBackendContractHooks, buildMemoryInstruction, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_ORIGIN_CAUSES, committedOriginOf, originEquals, ambiguousOriginRepresentation, committedDistilledOf, distilledEquals, type MemoryEntryDistilled, type MemoryEntryDistilledInput, CONSOLIDATION_DEFAULTS, ConsolidationRefusedError, MEMORY_SEARCH_SUPERSEDED_TAG, consolidationTypeEligible, deriveSupersededSet, memorySupersededNote, readIntentCredentials, supersessionFuseCeiling, memoryConsolidationRecommendedNotice, memoryConsolidationCommittedNotice, memoryConsolidationConflictNotice, memoryConsolidationRefusedNotice, type ConsolidationGateRow, type ConsolidationIntent, type ConsolidationIntentCredentialRow, type ConsolidationLeaseSeat, type ConsolidationProductProposal, type ConsolidationProposal, type MemoryConsolidationOptions, type ConsolidationCommitReceipt, type ConsolidationReconcileReport, type ConsolidationResolveReceipt, type ConsolidationPlanSummary, isInstructionEntry, type MemoryEntryOrigin, type MemoryOriginCause, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_RECALL_DISCIPLINE, MEMORY_PREFERENCE_DISCIPLINE, MEMORY_READONLY_NOTICE, readV2HeaderHints, type V2HeaderHints, LINEAGE_FILE, CHALLENGES_FILE, CHALLENGED_HISTORY_FILE, CHALLENGE_LEDGER_MAX_EVENTS, rebuildStrictControlPlaneLedger, type ControlPlaneRebuildReceipt, type StrictControlPlaneLedger, type ChallengeAssignment, type ChallengeEvent, type ChallengedHistoryRow, type LineagePendingTxn, type LineagePromotion, MEMORY_INDEX_FILENAME, MEMORY_INDEX_MAX_LINES, MEMORY_INDEX_MAX_BYTES, MEMORY_SEARCH_TOOL_NAME, MEMORY_GET_TOOL_NAME, MEMORY_ENGINE_TOOL_NAMES, type MemorySearchDetails, type MemorySearchHit, type CleanMemorySearchHit, type ExposedMemorySearchHit, MEMORY_EXPOSURE_BANNER, MEMORY_EXPOSURE_HANDLE_TAG, memoryExposureIndexRow, type MemoryGetDetails, STUB_ARCHIVED_LINE, DEFAULT_MAX_MEMORY_FILES, DEFAULT_MAX_ENTRY_DEPTH, DEFAULT_HARVEST_DEADLINE_MS, DEFAULT_HARVEST_FILE_BUDGET, MASS_DELETION_FUSE_RATIO, scanMemoryWrite, scanMemoryFileName, scanRemediation, MEMORY_FILENAME_SEGMENT_RE, renderAnnouncements, enqueueMemoryAnnouncement, drainMemoryAnnouncements, peekMemoryAnnouncements, bumpScanFuse, scanFuseCount, clearScanFuse, ANNOUNCEMENTS_FILE, MEMORY_ANNOUNCEMENTS_MAX, SCAN_FUSE_FILE, SCAN_FUSE_THRESHOLD, type MemoryAnnouncement, type ScanFinding, type MemoryEngineOptions, type MemoryInjection, type EntryProvenanceAccount, type TransferEvidence, type CommittedBinding, type CommittedEntrySnapshot, type CommittedScopeSnapshots, type EntryCustodyReport, erasureSelectHash, type EraseMemoryEntriesInput, type ErasureSelect, type ErasedBinding, type MemoryErasureAttestation, computeMemoryBundleHash, type MemoryExportBundle, type MemoryImportReport, type MemoryExportSnapshot, type MemoryBundleImportPlan, type BundleChallengeRow, type BundleLineageRow, type BundlePollutedSession, type MemoryBackend, type MemoryEntry, type MemoryEntryFrontmatter, type MemoryEntryHeader, type ScoredMemoryEntry, type NotePatch, type PatchReport, type MaterializedFile, type MemorySessionHandle, type HarvestReport, type HarvestRejection, type HarvestRejectionCode, type ParsedEntryFile, type ScannedEntryFile, SCOPE_SEGMENT_MAX_ENCODED, PROJECT_MARKER_PATH, encodeScopeSegment, decodeScopeSegment, parseScopeKey, formatUserScope, formatOrgScope, formatProjScope, formatUserProjScope, isPersonalScope, assertScopeContractPlacement, formatProjectMarker, parseProjectMarker, resolveProjectId, PROJECT_ID_REGEX, type ParsedScopeKey, migrateScope, type MigrateScopeReport, materializeEntriesToFiles, harvestFilesToPatches, projectionsToWriteBack, screenInboundEntries, REMOTE_HARVEST_PER_FILE_BYTES, REMOTE_MASS_DELETION_FUSE_RATIO, type RemoteMemoryFile, type RemoteMemoryBaseline, type RemoteMaterialization, type RemoteHarvestResult, type InboundEntryFinding, deriveProjectMemoryDir, deriveProjectControlDir, recordProjectIdHint, lookupProjectIdHint, PROJECT_ID_HINTS_FILE, reconcileMemoryEntries, nextSyncBaseline, mergeRecallHits, type MemorySyncCursor, type MemorySyncConflict, type MemorySyncPlan, type RecallSource, syncMemoryScope, type MemorySyncTransport, type MemorySyncRequestBody, type MemorySyncResponseBody, type MemorySyncClientConflict, type SyncMemoryScopeOptions, type MemorySyncClientResult, } from "./core/memory-engine/index.js";
|
|
171
|
+
export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, type MemoryBackendContractHooks, buildMemoryInstruction, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_ORIGIN_CAUSES, committedOriginOf, originEquals, ambiguousOriginRepresentation, committedDistilledOf, distilledEquals, type MemoryEntryDistilled, type MemoryEntryDistilledInput, CONSOLIDATION_DEFAULTS, ConsolidationRefusedError, MEMORY_SEARCH_SUPERSEDED_TAG, consolidationTypeEligible, deriveSupersededSet, memorySupersededNote, readIntentCredentials, supersessionFuseCeiling, memoryConsolidationRecommendedNotice, memoryConsolidationCommittedNotice, memoryConsolidationConflictNotice, memoryConsolidationIncompleteNotice, memoryConsolidationRefusedNotice, type ConsolidationGateRow, type ConsolidationIntent, type ConsolidationIntentCredentialRow, type ConsolidationLeaseSeat, type ConsolidationProductProposal, type ConsolidationProposal, type MemoryConsolidationOptions, type ConsolidationCommitReceipt, type ConsolidationReconcileReport, type ConsolidationResolveReceipt, type ConsolidationPlanSummary, DISTILLER_DEFAULT_MAX_INPUTS_PER_PRODUCT, LLM_DISTILLER_CONTRACT, LLM_DISTILLER_CONTRACT_DL2, LLM_DISTILLER_CONTRACT_DL3, LLM_DISTILLER_CONTRACTS, MEMORY_DISTILLER_CONTRACT_V1, contractGroupingDiff, driveConsolidationToFixpoint, isAliasModelId, llmPlanDistiller, mintLlmConsolidationPlan, openAiCompatChatSeat, parseJsonAnswer, planParseRepairs, sanitizeLlmGroups, scheduleUnderFuse, type ConsolidationDistillFn, type ConsolidationDriveCycleRow, type ConsolidationDriveEngine, type ConsolidationDriveResult, type ConsolidationFoldState, type DistillerCandidate, type DistillerChatAnswer, type DistillerChatFn, type DistillerChatRequest, type FuseSchedule, type LlmConsolidationPlan, type LlmConsolidationPlanProduct, type LlmDistillerContract, type MintLlmConsolidationPlanResult, type PlanParseRepairs, type SanitizedLlmGroups, CONSOLIDATION_DRIVER_PLANS_DIR, CONSOLIDATION_DRIVER_RUNS_FILE, CONSOLIDATION_RUN_STOP_REASONS, archiveDistillerPlan, readConsolidationDriverRun, runMemoryConsolidationDriver, type ConsolidationDriverEngine, type ConsolidationDriverRunRow, type ConsolidationRunReceipt, type ConsolidationRunStopReason, type RunMemoryConsolidationOptions, isInstructionEntry, type MemoryEntryOrigin, type MemoryOriginCause, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_RECALL_DISCIPLINE, MEMORY_PREFERENCE_DISCIPLINE, MEMORY_READONLY_NOTICE, readV2HeaderHints, type V2HeaderHints, LINEAGE_FILE, CHALLENGES_FILE, CHALLENGED_HISTORY_FILE, CHALLENGE_LEDGER_MAX_EVENTS, rebuildStrictControlPlaneLedger, type ControlPlaneRebuildReceipt, type StrictControlPlaneLedger, type ChallengeAssignment, type ChallengeEvent, type ChallengedHistoryRow, type LineagePendingTxn, type LineagePromotion, MEMORY_INDEX_FILENAME, MEMORY_INDEX_MAX_LINES, MEMORY_INDEX_MAX_BYTES, MEMORY_SEARCH_TOOL_NAME, MEMORY_GET_TOOL_NAME, MEMORY_ENGINE_TOOL_NAMES, type MemorySearchDetails, type MemorySearchHit, type CleanMemorySearchHit, type ExposedMemorySearchHit, MEMORY_EXPOSURE_BANNER, MEMORY_EXPOSURE_HANDLE_TAG, memoryExposureIndexRow, type MemoryGetDetails, STUB_ARCHIVED_LINE, DEFAULT_MAX_MEMORY_FILES, DEFAULT_MAX_ENTRY_DEPTH, DEFAULT_HARVEST_DEADLINE_MS, DEFAULT_HARVEST_FILE_BUDGET, MASS_DELETION_FUSE_RATIO, scanMemoryWrite, scanMemoryFileName, scanRemediation, MEMORY_FILENAME_SEGMENT_RE, renderAnnouncements, enqueueMemoryAnnouncement, drainMemoryAnnouncements, peekMemoryAnnouncements, bumpScanFuse, scanFuseCount, clearScanFuse, ANNOUNCEMENTS_FILE, MEMORY_ANNOUNCEMENTS_MAX, SCAN_FUSE_FILE, SCAN_FUSE_THRESHOLD, type MemoryAnnouncement, type ScanFinding, type MemoryEngineOptions, type MemoryInjection, type EntryProvenanceAccount, type TransferEvidence, type CommittedBinding, type CommittedEntrySnapshot, type CommittedScopeSnapshots, type EntryCustodyReport, erasureSelectHash, type EraseMemoryEntriesInput, type ErasureSelect, type ErasedBinding, type MemoryErasureAttestation, computeMemoryBundleHash, type MemoryExportBundle, type MemoryImportReport, type MemoryExportSnapshot, type MemoryBundleImportPlan, type BundleChallengeRow, type BundleLineageRow, type BundlePollutedSession, type MemoryBackend, type MemoryEntry, type MemoryEntryFrontmatter, type MemoryEntryHeader, type ScoredMemoryEntry, type NotePatch, type PatchReport, type MaterializedFile, type MemorySessionHandle, type HarvestReport, type HarvestRejection, type HarvestRejectionCode, type ParsedEntryFile, type ScannedEntryFile, SCOPE_SEGMENT_MAX_ENCODED, PROJECT_MARKER_PATH, encodeScopeSegment, decodeScopeSegment, parseScopeKey, formatUserScope, formatOrgScope, formatProjScope, formatUserProjScope, isPersonalScope, assertScopeContractPlacement, formatProjectMarker, parseProjectMarker, resolveProjectId, PROJECT_ID_REGEX, type ParsedScopeKey, migrateScope, type MigrateScopeReport, materializeEntriesToFiles, harvestFilesToPatches, projectionsToWriteBack, screenInboundEntries, REMOTE_HARVEST_PER_FILE_BYTES, REMOTE_MASS_DELETION_FUSE_RATIO, type RemoteMemoryFile, type RemoteMemoryBaseline, type RemoteMaterialization, type RemoteHarvestResult, type InboundEntryFinding, deriveProjectMemoryDir, deriveProjectControlDir, recordProjectIdHint, lookupProjectIdHint, PROJECT_ID_HINTS_FILE, reconcileMemoryEntries, nextSyncBaseline, mergeRecallHits, type MemorySyncCursor, type MemorySyncConflict, type MemorySyncPlan, type RecallSource, syncMemoryScope, type MemorySyncTransport, type MemorySyncRequestBody, type MemorySyncResponseBody, type MemorySyncClientConflict, type SyncMemoryScopeOptions, type MemorySyncClientResult, } from "./core/memory-engine/index.js";
|
|
172
172
|
export { SHARED_MEMORY_READ_CAP_BYTES, SHARED_MEMORY_LIST_PAGE_SIZE, SharedMemoryStoreError, type SharedMemoryStoreProvider, type SharedMemoryStoreReader, type SharedMemoryPagedList, type SharedMemoryStoreInfo, type SharedMemoryDocumentEntry, type SharedMemorySnapshot, type SharedMemoryRequestContext, type MemoryListDetails, type MemoryReadDetails, } from "./core/shared-memory/types.js";
|
|
173
173
|
export { sharedMemoryStoreContract, type SharedMemoryFixture, type SharedMemoryStoreContractHooks, } from "./core/shared-memory/contract.js";
|
|
174
174
|
export { termSet, jaccardDistance, cosineDistance } from "./core/memory-vector.js";
|
|
175
175
|
export { encodeSurfacedKey, buildManifestText, validateSelectedIds, composeSelectiveBody, formatMemoryAge, resolveLinkedIds, RECALL_CAVEAT, DEFAULT_MAX_SELECTED, DEFAULT_MAX_LINKED, type MemorySelector, type MemorySelectRequest, type SelectiveRecallOptions, type SelectiveRecallResult, type LayeredRecallOptions, type LayeredRecallResult, type ScopedNoteHeader, type ScopedNoteRecord, } from "./core/memory-recall.js";
|
|
176
176
|
export { runMemoryConsolidation, CONSOLIDATION_SYSTEM_PROMPT, DEFAULT_CONSOLIDATION_BAND, DEFAULT_CONSOLIDATION_SEARCH_LIMIT, DEFAULT_CONSOLIDATION_MAX_NOTES, DEFAULT_CONSOLIDATION_TIMEOUT_SEC, normalizeForExactMatch, type ConsolidationParams, type ConsolidationStats, type ConsolidationNote, type ConsolidationLLM, } from "./core/runner/memory-consolidation.js";
|
|
177
177
|
export { consolidateScope, advanceCursorAfterInline, type ConsolidateScopeDeps, type ConsolidateScopeOptions, } from "./core/consolidate-scope.js";
|
|
178
|
+
export { resolveMemoryConsolidationDriver, type MemoryConsolidationDriverDeps, } from "./core/runner/memory-consolidation-driver.js";
|
|
178
179
|
export { DEFAULT_COMPACTION_INSTRUCTIONS } from "./core/auto-compaction.js";
|
|
179
180
|
export { DEFAULT_SYSTEM_PROMPT, CODE_AGENT_PROMPT, SUBAGENT_PROMPT, CODE_SYSTEM_PROMPT, MEMORY_GUIDANCE, MEMORY_SAFETY, MEMORY_HYGIENE, NO_PERSISTENT_MEMORY_NOTICE, OUTPUT_EFFICIENCY, CYBER_RISK, HARNESS_SECTION_ANCHOR, URL_SAFETY, SUMMARIZE_TOOL_RESULTS, EXECUTION_ENVIRONMENT, EXECUTION_ENVIRONMENT_OPEN_READS, harnessContext, buildEnvironmentContext, buildGitSnapshot, buildScratchpadSection, GIT_STATUS_MAX_CHARS, formatLocalDate, type EnvironmentFacts, defaultPromptProvider, composeSystemPrompt, composeConstitution, constitutionBlocks, type PromptBlock, analyzePromptCacheFriendliness, assertPromptCacheFriendly, type PromptProvider, type StablePromptContext, type PromptCacheReport, type PromptTextDeclaration, } from "./prompts/default.js";
|
|
180
181
|
export { SUPERVISOR_PROMPT, ORCHESTRATION_GUIDANCE, ORCHESTRATION_AWARENESS, GOAL_COMPLETION_GUIDANCE } from "./prompts/supervisor.js";
|
package/dist/index.js
CHANGED
|
@@ -123,20 +123,21 @@ export { removePersistedRule, applyTombstones, sameScope, InMemoryPermissionRule
|
|
|
123
123
|
export { syncPermissionRules, parseRuleSyncResponse, PERMISSION_RULE_SYNC_PATH, LOCAL_OWNER_UNSYNCABLE_CODE, } from "./core/permission-rule-sync.js";
|
|
124
124
|
export { createOrgRuleOverlay, orgRuleVerdictFor, effectivePermissionRules, orgRuleStatePersistenceOf, ORG_UNAVAILABLE_DECISION_REASON, ORG_RULE_DECISION_REASON, ORG_ADJUDICATION_TIMEOUT_MS, } from "./core/permission-rule-org.js";
|
|
125
125
|
export { RULE_SYNC_DROP_CODES } from "./core/governance-codes.js";
|
|
126
|
-
export { prepareCardApproval, confirmRuleApproval, precheckEditedRuleText, redeemRuleTicket, redeemRuleBatch, prepareCcImport, prepareStarterBatch, mintRuleTicket, STARTER_RULES, InMemoryRuleApprovalRecordStore, } from "./core/permission-rule-consent.js";
|
|
126
|
+
export { prepareCardApproval, confirmRuleApproval, precheckEditedRuleText, redeemRuleTicket, redeemRuleBatch, prepareCcImport, prepareStarterBatch, mintRuleTicket, STARTER_RULES, InMemoryRuleApprovalRecordStore, ruleOffersOfRecord, } from "./core/permission-rule-consent.js";
|
|
127
127
|
export { FilePermissionRuleStoreProvider } from "./stores/file/permission-rule-store.js";
|
|
128
128
|
export { adoptFilePermissionRuleStore } from "./stores/file/permission-rule-adopt.js";
|
|
129
129
|
export { AdoptionError, assertAdoptionBootGate, readRootAdoptionFile, writeRootAdoptionFile, ROOT_ADOPTION_FILE, } from "./stores/file/adoption/marker.js";
|
|
130
130
|
export { adoptLocalDataRoot, ackAdoptionConfig, witnessAdoptionConfig, listAdoptionQuarantine, readAdoptionStatus, } from "./stores/file/adoption/adopt.js";
|
|
131
131
|
export { formatHookFeedback, runToolGate, createHookEnvCapabilities, createPreToolUseConstraintPolicy, normalizePersistedRuleHit, } from "./core/hooks.js";
|
|
132
132
|
export { InMemoryMemoryStore, composeMemoryBlock, composeLayeredMemoryBlock, normalizeMemorySpec, supportsConsolidation, supportsPeriodicConsolidation, firstSentence, expandLexicalTerms, lexicalSearchMatch, classifyPromotable, enforcePromotableWriteGate, guardedMemoryStore, MemoryGateError, detectSecret, enforceSecretWriteGate, enforceStructuredNoteSecretGate, } from "./core/memory.js";
|
|
133
|
-
export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, buildMemoryInstruction, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_ORIGIN_CAUSES, committedOriginOf, originEquals, ambiguousOriginRepresentation, committedDistilledOf, distilledEquals, CONSOLIDATION_DEFAULTS, ConsolidationRefusedError, MEMORY_SEARCH_SUPERSEDED_TAG, consolidationTypeEligible, deriveSupersededSet, memorySupersededNote, readIntentCredentials, supersessionFuseCeiling, memoryConsolidationRecommendedNotice, memoryConsolidationCommittedNotice, memoryConsolidationConflictNotice, memoryConsolidationRefusedNotice, isInstructionEntry, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_RECALL_DISCIPLINE, MEMORY_PREFERENCE_DISCIPLINE, MEMORY_READONLY_NOTICE, readV2HeaderHints, LINEAGE_FILE, CHALLENGES_FILE, CHALLENGED_HISTORY_FILE, CHALLENGE_LEDGER_MAX_EVENTS, rebuildStrictControlPlaneLedger, MEMORY_INDEX_FILENAME, MEMORY_INDEX_MAX_LINES, MEMORY_INDEX_MAX_BYTES, MEMORY_SEARCH_TOOL_NAME, MEMORY_GET_TOOL_NAME, MEMORY_ENGINE_TOOL_NAMES, MEMORY_EXPOSURE_BANNER, MEMORY_EXPOSURE_HANDLE_TAG, memoryExposureIndexRow, STUB_ARCHIVED_LINE, DEFAULT_MAX_MEMORY_FILES, DEFAULT_MAX_ENTRY_DEPTH, DEFAULT_HARVEST_DEADLINE_MS, DEFAULT_HARVEST_FILE_BUDGET, MASS_DELETION_FUSE_RATIO, scanMemoryWrite, scanMemoryFileName, scanRemediation, MEMORY_FILENAME_SEGMENT_RE, renderAnnouncements, enqueueMemoryAnnouncement, drainMemoryAnnouncements, peekMemoryAnnouncements, bumpScanFuse, scanFuseCount, clearScanFuse, ANNOUNCEMENTS_FILE, MEMORY_ANNOUNCEMENTS_MAX, SCAN_FUSE_FILE, SCAN_FUSE_THRESHOLD, erasureSelectHash, computeMemoryBundleHash, SCOPE_SEGMENT_MAX_ENCODED, PROJECT_MARKER_PATH, encodeScopeSegment, decodeScopeSegment, parseScopeKey, formatUserScope, formatOrgScope, formatProjScope, formatUserProjScope, isPersonalScope, assertScopeContractPlacement, formatProjectMarker, parseProjectMarker, resolveProjectId, PROJECT_ID_REGEX, migrateScope, materializeEntriesToFiles, harvestFilesToPatches, projectionsToWriteBack, screenInboundEntries, REMOTE_HARVEST_PER_FILE_BYTES, REMOTE_MASS_DELETION_FUSE_RATIO, deriveProjectMemoryDir, deriveProjectControlDir, recordProjectIdHint, lookupProjectIdHint, PROJECT_ID_HINTS_FILE, reconcileMemoryEntries, nextSyncBaseline, mergeRecallHits, syncMemoryScope, } from "./core/memory-engine/index.js";
|
|
133
|
+
export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, buildMemoryInstruction, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_ORIGIN_CAUSES, committedOriginOf, originEquals, ambiguousOriginRepresentation, committedDistilledOf, distilledEquals, CONSOLIDATION_DEFAULTS, ConsolidationRefusedError, MEMORY_SEARCH_SUPERSEDED_TAG, consolidationTypeEligible, deriveSupersededSet, memorySupersededNote, readIntentCredentials, supersessionFuseCeiling, memoryConsolidationRecommendedNotice, memoryConsolidationCommittedNotice, memoryConsolidationConflictNotice, memoryConsolidationIncompleteNotice, memoryConsolidationRefusedNotice, DISTILLER_DEFAULT_MAX_INPUTS_PER_PRODUCT, LLM_DISTILLER_CONTRACT, LLM_DISTILLER_CONTRACT_DL2, LLM_DISTILLER_CONTRACT_DL3, LLM_DISTILLER_CONTRACTS, MEMORY_DISTILLER_CONTRACT_V1, contractGroupingDiff, driveConsolidationToFixpoint, isAliasModelId, llmPlanDistiller, mintLlmConsolidationPlan, openAiCompatChatSeat, parseJsonAnswer, planParseRepairs, sanitizeLlmGroups, scheduleUnderFuse, CONSOLIDATION_DRIVER_PLANS_DIR, CONSOLIDATION_DRIVER_RUNS_FILE, CONSOLIDATION_RUN_STOP_REASONS, archiveDistillerPlan, readConsolidationDriverRun, runMemoryConsolidationDriver, isInstructionEntry, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_RECALL_DISCIPLINE, MEMORY_PREFERENCE_DISCIPLINE, MEMORY_READONLY_NOTICE, readV2HeaderHints, LINEAGE_FILE, CHALLENGES_FILE, CHALLENGED_HISTORY_FILE, CHALLENGE_LEDGER_MAX_EVENTS, rebuildStrictControlPlaneLedger, MEMORY_INDEX_FILENAME, MEMORY_INDEX_MAX_LINES, MEMORY_INDEX_MAX_BYTES, MEMORY_SEARCH_TOOL_NAME, MEMORY_GET_TOOL_NAME, MEMORY_ENGINE_TOOL_NAMES, MEMORY_EXPOSURE_BANNER, MEMORY_EXPOSURE_HANDLE_TAG, memoryExposureIndexRow, STUB_ARCHIVED_LINE, DEFAULT_MAX_MEMORY_FILES, DEFAULT_MAX_ENTRY_DEPTH, DEFAULT_HARVEST_DEADLINE_MS, DEFAULT_HARVEST_FILE_BUDGET, MASS_DELETION_FUSE_RATIO, scanMemoryWrite, scanMemoryFileName, scanRemediation, MEMORY_FILENAME_SEGMENT_RE, renderAnnouncements, enqueueMemoryAnnouncement, drainMemoryAnnouncements, peekMemoryAnnouncements, bumpScanFuse, scanFuseCount, clearScanFuse, ANNOUNCEMENTS_FILE, MEMORY_ANNOUNCEMENTS_MAX, SCAN_FUSE_FILE, SCAN_FUSE_THRESHOLD, erasureSelectHash, computeMemoryBundleHash, SCOPE_SEGMENT_MAX_ENCODED, PROJECT_MARKER_PATH, encodeScopeSegment, decodeScopeSegment, parseScopeKey, formatUserScope, formatOrgScope, formatProjScope, formatUserProjScope, isPersonalScope, assertScopeContractPlacement, formatProjectMarker, parseProjectMarker, resolveProjectId, PROJECT_ID_REGEX, migrateScope, materializeEntriesToFiles, harvestFilesToPatches, projectionsToWriteBack, screenInboundEntries, REMOTE_HARVEST_PER_FILE_BYTES, REMOTE_MASS_DELETION_FUSE_RATIO, deriveProjectMemoryDir, deriveProjectControlDir, recordProjectIdHint, lookupProjectIdHint, PROJECT_ID_HINTS_FILE, reconcileMemoryEntries, nextSyncBaseline, mergeRecallHits, syncMemoryScope, } from "./core/memory-engine/index.js";
|
|
134
134
|
export { SHARED_MEMORY_READ_CAP_BYTES, SHARED_MEMORY_LIST_PAGE_SIZE, SharedMemoryStoreError, } from "./core/shared-memory/types.js";
|
|
135
135
|
export { sharedMemoryStoreContract, } from "./core/shared-memory/contract.js";
|
|
136
136
|
export { termSet, jaccardDistance, cosineDistance } from "./core/memory-vector.js";
|
|
137
137
|
export { encodeSurfacedKey, buildManifestText, validateSelectedIds, composeSelectiveBody, formatMemoryAge, resolveLinkedIds, RECALL_CAVEAT, DEFAULT_MAX_SELECTED, DEFAULT_MAX_LINKED, } from "./core/memory-recall.js";
|
|
138
138
|
export { runMemoryConsolidation, CONSOLIDATION_SYSTEM_PROMPT, DEFAULT_CONSOLIDATION_BAND, DEFAULT_CONSOLIDATION_SEARCH_LIMIT, DEFAULT_CONSOLIDATION_MAX_NOTES, DEFAULT_CONSOLIDATION_TIMEOUT_SEC, normalizeForExactMatch, } from "./core/runner/memory-consolidation.js";
|
|
139
139
|
export { consolidateScope, advanceCursorAfterInline, } from "./core/consolidate-scope.js";
|
|
140
|
+
export { resolveMemoryConsolidationDriver, } from "./core/runner/memory-consolidation-driver.js";
|
|
140
141
|
export { DEFAULT_COMPACTION_INSTRUCTIONS } from "./core/auto-compaction.js";
|
|
141
142
|
export { DEFAULT_SYSTEM_PROMPT, CODE_AGENT_PROMPT, SUBAGENT_PROMPT, CODE_SYSTEM_PROMPT, MEMORY_GUIDANCE, MEMORY_SAFETY, MEMORY_HYGIENE, NO_PERSISTENT_MEMORY_NOTICE, OUTPUT_EFFICIENCY, CYBER_RISK, HARNESS_SECTION_ANCHOR, URL_SAFETY, SUMMARIZE_TOOL_RESULTS, EXECUTION_ENVIRONMENT, EXECUTION_ENVIRONMENT_OPEN_READS, harnessContext, buildEnvironmentContext, buildGitSnapshot, buildScratchpadSection, GIT_STATUS_MAX_CHARS, formatLocalDate, defaultPromptProvider, composeSystemPrompt, composeConstitution, constitutionBlocks, analyzePromptCacheFriendliness, assertPromptCacheFriendly, } from "./prompts/default.js";
|
|
142
143
|
export { SUPERVISOR_PROMPT, ORCHESTRATION_GUIDANCE, ORCHESTRATION_AWARENESS, GOAL_COMPLETION_GUIDANCE } from "./prompts/supervisor.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* design/96 §C (S2) — **Goal 模式**:LLM 自报完成 + core 校验续跑(CC goal 对标:目标 + 完成判定 + 续跑)。
|
|
3
3
|
* `runGoal` 是 `runRepairLoop`/`verifyCompleted` 的 SIBLING —— thin composition over `runner.runTask`,零
|
|
4
|
-
* Runner core 改动。详 `design/96-references/GOAL-IMPLEMENTER-SPEC.md`(v3
|
|
4
|
+
* Runner core 改动。详 `design/96-references/GOAL-IMPLEMENTER-SPEC.md`(v3+r2 异源证伪式对照收敛)。
|
|
5
5
|
*
|
|
6
6
|
* 🔴 **完成判定双闸(reward-hack 红线)**:① LLM 自报完成 = 调内置 `declare_done` 工具(或 `submit_output`,有
|
|
7
7
|
* outputSchema 时)= **机器信号**,非泛化 `completed`;② core `doneCheck`(机械/oracle 校验)。**AND**:仅二者
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* 议题#1:不组合 runGoal —— doneCheck 只在模型自报后跑不适合外部强制,且 mechanical goal 终态自己发射
|
|
4
4
|
* TaskOutcome,组合 = 同 taskSignature 双发射,违反 design/73 红线③)。
|
|
5
5
|
*
|
|
6
|
-
* 装配五步(
|
|
6
|
+
* 装配五步(全部**组合而非覆盖**=fable-M4):
|
|
7
7
|
* 1. preflight:frozenPaths 校验+字节快照;亲跑三值 oracle;requireRedStart(默认 true)⇒ 必须 red
|
|
8
8
|
* (green→`spec.not_red`、error→`spec.oracle_error`,均 fail-loud);捕获 baseline 计数。
|
|
9
9
|
* 2. frozen deny policy 经 {@link combinePolicies} 合入部署基线(deny 短路不可被顶);绝不裸赋顶掉
|
|
@@ -48,11 +48,11 @@ export interface WorkflowCompletionNotifier {
|
|
|
48
48
|
summary: string;
|
|
49
49
|
result?: string;
|
|
50
50
|
usage?: unknown;
|
|
51
|
-
/**
|
|
51
|
+
/** The diagnosis route (per-agent rows / journal locator / resumeFromRunId guidance).
|
|
52
52
|
* Added 1.353 on the payload but silently dropped at this hand-written subset seam until 1.404 —
|
|
53
53
|
* keep this interface in lockstep with the payload fields the settle legs mint. */
|
|
54
54
|
diagnostics?: string;
|
|
55
|
-
/**
|
|
55
|
+
/** See {@link "../core/task-notification.js".TaskNotificationPayload.completionId}.
|
|
56
56
|
* This CROSS-REPLICA seam is exactly one of the read faces the cross-channel correlation contract
|
|
57
57
|
* promises the same value on — added here in the same car specifically so this interface does not
|
|
58
58
|
* repeat the diagnostics field's own drift history (the comment right above this one). */
|
|
@@ -133,7 +133,7 @@ export interface RunWorkflowToolDeps {
|
|
|
133
133
|
scriptRunner: WorkflowScriptRunner;
|
|
134
134
|
/** Deployment-trusted governance every spawned agent inherits (design/98 §2.5). */
|
|
135
135
|
governanceBaseline: WorkflowGovernanceBaseline;
|
|
136
|
-
/**
|
|
136
|
+
/** (tool-face round 5): the HOST task's tool-face controls (prepare-time snapshot) — a
|
|
137
137
|
* scenario roster must survive the workflow delegation path exactly like the Agent path. Merged
|
|
138
138
|
* (union — tighten-only) into the baseline base for every child spec this workflow spawns. */
|
|
139
139
|
parentExcludeTools?: readonly string[];
|
|
@@ -142,7 +142,7 @@ export interface RunWorkflowToolDeps {
|
|
|
142
142
|
* declared for the tree must survive this direct-mount lane exactly like the deferral it exempts
|
|
143
143
|
* from. Union (widen-the-exemption never tightens the child beyond the parent's own face). */
|
|
144
144
|
parentAlwaysLoadTools?: readonly string[];
|
|
145
|
-
/** design/277
|
|
145
|
+
/** design/277: the HOST task's model-gate restore selector
|
|
146
146
|
* ({@link import("../core/types.js").TaskSpec.restoreGatedTools}, prepare-time frozen snapshot) —
|
|
147
147
|
* the workflow lane is a delegation lane too, so the selector inherits here exactly like the
|
|
148
148
|
* three tool-face controls above (union with the baseline's own; `true` on either side wins).
|
|
@@ -166,7 +166,7 @@ export interface RunWorkflowToolDeps {
|
|
|
166
166
|
/** design/97 CORE-9 (Part A) — optional LOAD-BEARING resume journal: records each agent result so a
|
|
167
167
|
* `resumeFromRunId` re-run replays the unchanged prefix (durable cross-replica resume). Opt-in. */
|
|
168
168
|
journalStore?: WorkflowJournalStore;
|
|
169
|
-
/** design/149
|
|
169
|
+
/** design/149: the process-level BackgroundChildEvent sink — workflow-spawned agents
|
|
170
170
|
* mint synthetic `wa*` rows (spawn/tick/terminal) on the SAME observer bg subagents use
|
|
171
171
|
* (RunnerDeps.onBackgroundChildEvent), immune to any run-leg forwarding freeze. Opt-in. */
|
|
172
172
|
onBackgroundChildEvent?: (event: import("../core/types.js").BackgroundChildEvent) => void;
|
|
@@ -180,7 +180,7 @@ export interface RunWorkflowToolDeps {
|
|
|
180
180
|
notifier?: WorkflowCompletionNotifier;
|
|
181
181
|
/** The originating session id, threaded into every completion notify. */
|
|
182
182
|
originatingSessionId?: string;
|
|
183
|
-
/**
|
|
183
|
+
/** The ROOT host session of the delegation tree (prepare-task passes
|
|
184
184
|
* `internals?.rootSessionId ?? sessionId` per task). The AUTO-MOUNTED tool's execute ctx is the
|
|
185
185
|
* harness-native one (no internals enrichment — that wrapper covers spec.tools only), so the
|
|
186
186
|
* root MUST ride deps; `ctx.rootSessionId` stays first for a deployment-composed mount that
|
|
@@ -209,7 +209,7 @@ export interface RunWorkflowToolDeps {
|
|
|
209
209
|
/** The originating task id + principal, threaded to the notifier. */
|
|
210
210
|
sourceTaskId?: string;
|
|
211
211
|
principal?: string;
|
|
212
|
-
/**
|
|
212
|
+
/** mirrors {@link "../core/types.js".TaskSpec.oneShot}: this submission has
|
|
213
213
|
* no later turn for an async notification to land in. Branches the launch receipt's `note` guidance
|
|
214
214
|
* (see {@link createRunWorkflowTool}'s `note` composition) toward an active block-wait instead of
|
|
215
215
|
* "end your turn and wait" — the latter is actively wrong for a one-shot caller. */
|
|
@@ -246,14 +246,14 @@ export interface RunWorkflowToolDeps {
|
|
|
246
246
|
* `ToolExecuteContext.interactiveTools` seat — without it a headless-clamped host's workflow
|
|
247
247
|
* children could re-mount the interactive tool the host run disabled. */
|
|
248
248
|
parentInteractiveTools?: false;
|
|
249
|
-
/**
|
|
249
|
+
/** Call-time getter for the HOST task's RESOLVED Model object: a spawned agent whose
|
|
250
250
|
* fold chain produced no model inherits the parent's full object (baseUrl/key routing included),
|
|
251
251
|
* mirroring the subagent lane's ctx.model semantics. */
|
|
252
252
|
parentModel?: () => import("../internal/llm.js").Model | undefined;
|
|
253
|
-
/**
|
|
253
|
+
/** The HOST task's per-model auth hook: the CREDENTIAL half of model
|
|
254
254
|
* inheritance. The Model object fixed the URL routing but the child brain still authenticated
|
|
255
|
-
* with the boot env token (
|
|
256
|
-
* has inherited this hook since
|
|
255
|
+
* with the boot env token (rerun: 7/7 kimi-route 401s with the qwen key). The subagent lane
|
|
256
|
+
* has inherited this hook since; the workflow lane never did — the governance whitelist
|
|
257
257
|
* rightly blocks SCRIPTS from setting it, but host inheritance is a different lane. */
|
|
258
258
|
parentGetApiKeyAndHeaders?: import("../core/types.js").TaskSpec["getApiKeyAndHeaders"];
|
|
259
259
|
/** backlog #342 — the HOST task's frozen effective approver (`spec.onAsk ?? deps.onAsk`, the exact
|
|
@@ -323,7 +323,7 @@ export interface RunWorkflowToolDeps {
|
|
|
323
323
|
* mounts it under the same gate). Returns a structured error (not a throw) for an LLM-correctable problem
|
|
324
324
|
* (oversized / malformed-meta / nesting), so the model can fix and retry.
|
|
325
325
|
*
|
|
326
|
-
* Async since
|
|
326
|
+
* Async since: the card's named-workflow roster is derived from the SAME sources the execute path
|
|
327
327
|
* resolves against (built-ins probed through `resolveName` shadowing + awaited `list()`), so the card can
|
|
328
328
|
* never advertise a workflow the call would resolve differently.
|
|
329
329
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* design/98 §2.5 / §E.2 (S8b, security core) — the DEFAULT-DENY governance for a sub-agent an LLM-authored
|
|
3
3
|
* workflow script spawns. The child spec is BUILT (complete-by-construction) from the deployment's trusted
|
|
4
4
|
* {@link WorkflowGovernanceBaseline} + a strict WHITELIST of safe work-fields the script may set — NEVER by
|
|
5
|
-
* stripping a denylist off the untrusted spec (
|
|
5
|
+
* stripping a denylist off the untrusted spec (a missed control-plane field would leak).
|
|
6
6
|
*
|
|
7
7
|
* The script's spec is UNTRUSTED. Only {@link WHITELIST_KEYS} are ever read from it; every other field
|
|
8
8
|
* (toolPolicy / onAsk / hooks / principal / tools / mcp / skills / lspManager / checkpointStore /
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* host-ctx bindings the engine writes onto the baseline/child, never a read of anything the script wrote:
|
|
16
16
|
* a script-authored `onAsk` (or any other control-plane key) keeps being stripped + announced. The model is
|
|
17
17
|
* chosen by NAME ONLY (resolved against an allowlist to a deploy-configured `Model` — the script never sees a
|
|
18
|
-
* `Model` object, which carries `baseUrl`/`headers` = an exfil surface
|
|
18
|
+
* `Model` object, which carries `baseUrl`/`headers` = an exfil surface). Resource limits
|
|
19
19
|
* are CLAMPED to the baseline + workflow ceilings (`tightenTaskSpec` only covers the safety knobs, not
|
|
20
|
-
* cost/token caps
|
|
20
|
+
* cost/token caps).
|
|
21
21
|
*/
|
|
22
22
|
import type { Model } from "../internal/llm.js";
|
|
23
23
|
import type { EngineNotice, ImageInput, TaskSpec, ThinkingLevel, WorkflowGovernanceBaseline } from "../core/types.js";
|
|
@@ -31,7 +31,7 @@ export declare class WorkflowModelNotAllowedError extends Error {
|
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* The SAFE fields an LLM-authored workflow script may set per sub-agent — the WORK, never the control plane.
|
|
34
|
-
* `model` is a NAME (string), NOT a `ModelRef`/`Model` object (
|
|
34
|
+
* `model` is a NAME (string), NOT a `ModelRef`/`Model` object (a `Model` carries
|
|
35
35
|
* `baseUrl`/`headers`/`extraBody` = endpoint + auth-header injection). No `modelRole`/`roles` (a `roles.select`
|
|
36
36
|
* conditional selector is its own vector). The engine resolves `modelName` against the allowlist.
|
|
37
37
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { WorkflowRunStore, WorkflowRunSummary } from "../core/workflow-run-store.js";
|
|
2
2
|
import type { WorkflowEvent, WorkflowItemStatus, WorkflowRun, WorkflowRunStatus } from "./workflow.js";
|
|
3
3
|
/** design/97 S1c: mark a run RUNNING (called by `runWorkflow` before it emits `run_start`).
|
|
4
|
-
*
|
|
4
|
+
* B-3 (BREAKING): carries the run's SCOPE — {@link subscribeWorkflow} gates on it. */
|
|
5
5
|
export declare function markWorkflowActive(runId: string, scope: string): void;
|
|
6
6
|
/** T2A-9 (2026-07-05 soak): is this runId currently ACTIVE in-process? Used by `startWorkflow` to reject an
|
|
7
7
|
* explicit duplicate `opts.runId` up front — two runs sharing one observation channel let the first finisher
|
|
@@ -35,7 +35,7 @@ export declare function selfOrchestrationFailClosedReason(spec: TaskSpec, deps:
|
|
|
35
35
|
* ({@link import("./dev-vm-script-runner.js").devWorkflowScriptRunner}, S8b) that is explicitly NOT a
|
|
36
36
|
* security boundary, plus a conformance contract a hard runner must pass.
|
|
37
37
|
*
|
|
38
|
-
* 🔴 **Membrane = STRUCTURAL constraint, not a behavioral promise
|
|
38
|
+
* 🔴 **Membrane = STRUCTURAL constraint, not a behavioral promise.** The seam's
|
|
39
39
|
* `run()` accepts ONLY {@link WorkflowPrimitives} — a flat, sterile record of bound callbacks + a budget
|
|
40
40
|
* DATA snapshot. It does NOT accept a `WorkflowRunContext` (a host object whose prototype chain the script
|
|
41
41
|
* could walk via `ctx.constructor.constructor("return process")()` to escape). The engine extracts the bound
|