@sema-agent/core 5.58.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 +48 -0
- package/dist/brain/route-adjudicator.d.ts +8 -1
- package/dist/brain/route-adjudicator.js +8 -1
- package/dist/core/governance-codes.d.ts +37 -10
- package/dist/core/governance-codes.js +52 -1
- package/dist/core/memory-engine/consolidation-driver.d.ts +6 -2
- package/dist/core/memory-engine/consolidation-driver.js +54 -5
- package/dist/core/memory-engine/consolidation.d.ts +73 -1
- package/dist/core/memory-engine/consolidation.js +21 -1
- package/dist/core/memory-engine/engine.d.ts +97 -8
- package/dist/core/memory-engine/engine.js +112 -20
- package/dist/core/memory-engine/file-backend.d.ts +13 -1
- package/dist/core/memory-engine/file-backend.js +3 -0
- package/dist/core/memory-engine/index.d.ts +4 -3
- package/dist/core/memory-engine/layout.js +20 -6
- package/dist/core/memory-engine/types.d.ts +17 -0
- package/dist/core/permission-rule-model.d.ts +42 -1
- package/dist/core/permission-rule-model.js +12 -0
- package/dist/core/runner/prepare-task.js +3 -3
- package/dist/core/runner/runtask.js +4 -4
- package/dist/core/tool-policy.d.ts +58 -0
- package/dist/core/tool-policy.js +80 -1
- package/dist/core/types.d.ts +45 -20
- package/dist/core/types.js +4 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +1771 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { parsePermissionRule } from "./permission-rules.js";
|
|
2
2
|
import { parseLeadingCommandName, splitShellCompoundSegments } from "../tools/fs/bash-readonly-classifier.js";
|
|
3
|
+
import { inlineUntrusted } from "./untrusted-text.js";
|
|
3
4
|
export const MAX_RULE_TEXT_CHARS = 512;
|
|
4
5
|
export const BARE_INTERPRETER_NAMES = new Set([
|
|
5
6
|
"node", "deno", "bun", "python", "python2", "python3", "perl", "ruby", "php", "osascript",
|
|
@@ -162,6 +163,17 @@ export function escapeForDisclosure(value) {
|
|
|
162
163
|
});
|
|
163
164
|
return escaped.length <= DISCLOSED_RULE_TEXT_MAX_CHARS ? escaped : `${escaped.slice(0, DISCLOSED_RULE_TEXT_MAX_CHARS)}…`;
|
|
164
165
|
}
|
|
166
|
+
const DISPLAY_STRIP_FORMAT_RE = /\p{Cf}/gu;
|
|
167
|
+
export function renderUntrustedCommandText(text, maxLen = DISCLOSED_RULE_TEXT_MAX_CHARS) {
|
|
168
|
+
let raw;
|
|
169
|
+
try {
|
|
170
|
+
raw = typeof text === "string" ? text : String(text);
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
return "<unprintable>";
|
|
174
|
+
}
|
|
175
|
+
return inlineUntrusted(raw.replace(DISPLAY_STRIP_FORMAT_RE, ""), maxLen);
|
|
176
|
+
}
|
|
165
177
|
export function hasUnrenderableCharacters(text) {
|
|
166
178
|
return CONTROL_CHARS_RE.test(text);
|
|
167
179
|
}
|
|
@@ -482,7 +482,7 @@ async function derivedRouteFallsBack(args) {
|
|
|
482
482
|
const verdict = await adjudicateDerivedRoute({ brain: args.brain, model: args.derived, getApiKeyAndHeaders: args.getApiKeyAndHeaders });
|
|
483
483
|
if (verdict === undefined || verdict.ok)
|
|
484
484
|
return false;
|
|
485
|
-
deliverEngineNotice(args.onNotice, fallbackToPrimaryNotice({ seat: args.seat, from: args.derived.id, to: args.primary.id, verdict }));
|
|
485
|
+
deliverEngineNotice(args.onNotice, fallbackToPrimaryNotice({ seat: args.seat, from: args.derived.id, to: args.primary.id, verdict, ...(args.sessionId !== undefined ? { sessionId: args.sessionId } : {}) }));
|
|
486
486
|
return true;
|
|
487
487
|
}
|
|
488
488
|
catch {
|
|
@@ -509,7 +509,7 @@ export async function prepareTask(spec, deps, sessions, resume, internals, runne
|
|
|
509
509
|
let effectiveCompModel = compModel;
|
|
510
510
|
if (spec.compactionModel === undefined &&
|
|
511
511
|
compModel !== undefined &&
|
|
512
|
-
(await derivedRouteFallsBack({ seat: "compaction-summary", derived: compModel, primary: model, brain: deps.brain, getApiKeyAndHeaders: spec.getApiKeyAndHeaders, onNotice: deps.onNotice }))) {
|
|
512
|
+
(await derivedRouteFallsBack({ seat: "compaction-summary", derived: compModel, primary: model, brain: deps.brain, getApiKeyAndHeaders: spec.getApiKeyAndHeaders, onNotice: deps.onNotice, sessionId }))) {
|
|
513
513
|
effectiveCompModel = undefined;
|
|
514
514
|
}
|
|
515
515
|
warnCompactionWindowHazard(deps.tracer, spec, model, effectiveCompModel, hostTaskId);
|
|
@@ -1096,7 +1096,7 @@ export async function prepareTask(spec, deps, sessions, resume, internals, runne
|
|
|
1096
1096
|
catch {
|
|
1097
1097
|
classifierModel = model;
|
|
1098
1098
|
}
|
|
1099
|
-
if (await derivedRouteFallsBack({ seat: "auto-mode-classifier", derived: classifierModel, primary: model, brain: deps.brain, getApiKeyAndHeaders: spec.getApiKeyAndHeaders, onNotice: deps.onNotice })) {
|
|
1099
|
+
if (await derivedRouteFallsBack({ seat: "auto-mode-classifier", derived: classifierModel, primary: model, brain: deps.brain, getApiKeyAndHeaders: spec.getApiKeyAndHeaders, onNotice: deps.onNotice, sessionId })) {
|
|
1100
1100
|
classifierModel = model;
|
|
1101
1101
|
}
|
|
1102
1102
|
const classifierSystemPrompt = buildAutoModePrompt(am);
|
|
@@ -2095,7 +2095,7 @@ export class Runner {
|
|
|
2095
2095
|
message: `a notification was injected with priority "now", which this engine does not implement: all injection ` +
|
|
2096
2096
|
`priorities deliver at the NEXT turn boundary and none aborts the running turn. The notification is ` +
|
|
2097
2097
|
`delivered — only the interrupting semantics are absent.`,
|
|
2098
|
-
detail: { priority: "now", ...(spec.taskId !== undefined ? { taskId: spec.taskId } : {}) },
|
|
2098
|
+
detail: { priority: "now", ...(spec.taskId !== undefined ? { taskId: spec.taskId } : {}), sessionId: prepared.sessionId },
|
|
2099
2099
|
});
|
|
2100
2100
|
}
|
|
2101
2101
|
if (deliveredAtTurnOpen.has(taskNotificationDedupKey(notification)))
|
|
@@ -2172,7 +2172,7 @@ export class Runner {
|
|
|
2172
2172
|
undrainedUserAtEnd = counts;
|
|
2173
2173
|
return;
|
|
2174
2174
|
}
|
|
2175
|
-
for (const notice of undrainedUserInputNotices(counts, spec.taskId)) {
|
|
2175
|
+
for (const notice of undrainedUserInputNotices(counts, spec.taskId, prepared.sessionId)) {
|
|
2176
2176
|
deliverEngineNotice(this.deps.onNotice, notice);
|
|
2177
2177
|
}
|
|
2178
2178
|
};
|
|
@@ -3572,7 +3572,7 @@ export class Runner {
|
|
|
3572
3572
|
steer: Math.max(0, undrainedUserAtEnd.steer - migratedParked.steer),
|
|
3573
3573
|
followUp: Math.max(0, undrainedUserAtEnd.followUp - migratedParked.followUp),
|
|
3574
3574
|
};
|
|
3575
|
-
for (const notice of undrainedUserInputNotices(remaining, spec.taskId)) {
|
|
3575
|
+
for (const notice of undrainedUserInputNotices(remaining, spec.taskId, prepared.sessionId)) {
|
|
3576
3576
|
deliverEngineNotice(this.deps.onNotice, notice);
|
|
3577
3577
|
}
|
|
3578
3578
|
}
|
|
@@ -3933,7 +3933,7 @@ export class Runner {
|
|
|
3933
3933
|
if (!sameRouteIdentity(model, prepared.model)) {
|
|
3934
3934
|
const verdict = await adjudicateDerivedRoute({ brain: this.deps.brain, model, getApiKeyAndHeaders: spec.getApiKeyAndHeaders });
|
|
3935
3935
|
if (verdict !== undefined && !verdict.ok) {
|
|
3936
|
-
deliverEngineNotice(this.deps.onNotice, fallbackToPrimaryNotice({ seat: "prompt-suggestions", from: model.id, to: prepared.model.id, verdict }));
|
|
3936
|
+
deliverEngineNotice(this.deps.onNotice, fallbackToPrimaryNotice({ seat: "prompt-suggestions", from: model.id, to: prepared.model.id, verdict, sessionId: prepared.sessionId }));
|
|
3937
3937
|
model = prepared.model;
|
|
3938
3938
|
thinking = prepared.thinking;
|
|
3939
3939
|
}
|
|
@@ -576,6 +576,13 @@ export declare function createAllowDenyPolicy(opts: {
|
|
|
576
576
|
* Human-in-the-loop approval for selected tools. Tools in `requireApproval` call `approve(req)` and
|
|
577
577
|
* are allowed only if it resolves true; tools in `deny` are always blocked; everything else is allowed
|
|
578
578
|
* (override with `denyByDefault: true` to allow only `requireApproval` + an explicit `autoAllow`).
|
|
579
|
+
*
|
|
580
|
+
* This seat receives a bare `ToolCallRequest`, NOT the ask surface: the decision settles in-place
|
|
581
|
+
* inside the policy, no AskRequest is minted and `resolveAsk` is never entered — so none of the
|
|
582
|
+
* ask-side approval members (`hasBidiControls`, `boundInputHash`, `preview`, `riskAxes`, …) exist
|
|
583
|
+
* here. A surface rendering the command text for a human on this seat must render through
|
|
584
|
+
* {@link import("./permission-rule-model.js").renderUntrustedCommandText} (the display baseline)
|
|
585
|
+
* or run its own screen — absence of the warning bit is "not on this surface", never "clean".
|
|
579
586
|
*/
|
|
580
587
|
export declare function createApprovalPolicy(opts: {
|
|
581
588
|
/** Tools that need an approval decision. */
|
|
@@ -952,6 +959,43 @@ export interface AskRequest {
|
|
|
952
959
|
* so this — like `principal`/`sourceTaskId` — exists only on the synchronous resolution path.
|
|
953
960
|
* See {@link AskDelegationProvenance} for the trust posture of each member. */
|
|
954
961
|
readonly delegation?: AskDelegationProvenance;
|
|
962
|
+
/**
|
|
963
|
+
* PRESENCE ONLY: the command/argument text this ask is about carries at least one DIRECTIONAL
|
|
964
|
+
* format control ({@link BIDI_CONTROL_RE} — the closed set: U+061C, U+200E/U+200F, the embeddings
|
|
965
|
+
* and overrides U+202A–U+202E, the isolates U+2066–U+2069). Those characters change nothing about
|
|
966
|
+
* what EXECUTES and everything about what a terminal or a card SHOWS: bytes that run
|
|
967
|
+
* `rm -rf /` can display as a benign line, which is precisely the deception an approval surface
|
|
968
|
+
* cannot afford to render unannotated.
|
|
969
|
+
*
|
|
970
|
+
* A WARNING BIT, not a verdict and not a transform. Core does NOT strip, reorder, refuse or rewrite
|
|
971
|
+
* anything on account of it — {@link args} is delivered byte-identical either way, and the decision
|
|
972
|
+
* stays the approver's. What a surface owes the person is a visible "the text below can display
|
|
973
|
+
* differently from what it runs" and a rendering that neutralizes the controls (see
|
|
974
|
+
* {@link import("./permission-rule-model.js").renderUntrustedCommandText} for the display baseline).
|
|
975
|
+
*
|
|
976
|
+
* Read it as PRESENCE-or-nothing: the field is either `true` or ABSENT. It is never written `false`,
|
|
977
|
+
* because absence means "not detected", which honestly covers both "clean" and "the bounded scan did
|
|
978
|
+
* not reach it" (a pathologically deep or huge argument graph stops at the scan budget) — a `false`
|
|
979
|
+
* would claim a proof the scan does not offer. Judged over the EXECUTING argument snapshot and the
|
|
980
|
+
* tool's own {@link preview} projection, i.e. the payload; {@link message} is deliberately out of
|
|
981
|
+
* scope (engine/policy-composed prose, not the thing that runs).
|
|
982
|
+
*
|
|
983
|
+
* Filled at the `resolveAsk` chokepoint, beside {@link boundInputHash} — every wired `onAsk`
|
|
984
|
+
* approver call crosses it, so an ask mint site added later is covered by construction. Optional
|
|
985
|
+
* on the type because a deployment may invoke its approver function directly.
|
|
986
|
+
*
|
|
987
|
+
* SCOPE, stated so absence is not read as a clean bill on the other routes: this is the
|
|
988
|
+
* SYNCHRONOUS `onAsk` ask, like `principal`/`sourceTaskId` — the closure claim is over AskRequest
|
|
989
|
+
* mint sites, not over every approval callback. Two human-decision routes never receive it:
|
|
990
|
+
* ① a durable park/suspend never invokes `onAsk`, so a parked approval row carries no twin of
|
|
991
|
+
* this bit today — an inbox rendering `RiskDescriptor` must run its own screen (or the display
|
|
992
|
+
* baseline above) rather than infer "no bit, no problem"; ② {@link createApprovalPolicy}'s
|
|
993
|
+
* `approve` seat resolves in-place inside the policy and mints no AskRequest at all — its
|
|
994
|
+
* callback receives a bare `ToolCallRequest` (no bit, no {@link boundInputHash}, none of this
|
|
995
|
+
* surface), so a deployment doing HITL through that seat must render through
|
|
996
|
+
* {@link import("./permission-rule-model.js").renderUntrustedCommandText} or run its own screen.
|
|
997
|
+
*/
|
|
998
|
+
readonly hasBidiControls?: true;
|
|
955
999
|
}
|
|
956
1000
|
/**
|
|
957
1001
|
* How an `ask` decision is resolved when a policy/hook requests human confirmation (design/37):
|
|
@@ -1176,6 +1220,20 @@ export type ResolvedAsk = PermissionResult & {
|
|
|
1176
1220
|
* frame), so a consumer classifies a refusal by code instead of parsing its text. */
|
|
1177
1221
|
resolution?: AskDenyResolution;
|
|
1178
1222
|
};
|
|
1223
|
+
/**
|
|
1224
|
+
* Does any string reachable in `value` carry a {@link BIDI_CONTROL_RE} member? Bounded, cycle-safe,
|
|
1225
|
+
* and never throwing — the one caller is on the approval path, where a scan that failed must degrade
|
|
1226
|
+
* to "not detected" rather than turn an ask into an error (the `deliverEngineNotice` posture: a
|
|
1227
|
+
* derived disclosure must never become the failure of the thing it describes).
|
|
1228
|
+
*
|
|
1229
|
+
* OBJECT KEYS are scanned as well as values: a key is displayed text too, and an argument object
|
|
1230
|
+
* `{ "cmd<RLO>": … }` renders its own reordering in any card that prints the shape (the marker
|
|
1231
|
+
* is spelled out here on purpose — a literal one in this comment would reorder the comment).
|
|
1232
|
+
*
|
|
1233
|
+
* Not a public export: the contract is the {@link AskRequest.hasBidiControls} bit, and a second
|
|
1234
|
+
* spelling of "does this carry bidi" on the public surface would be one more thing to keep in step.
|
|
1235
|
+
*/
|
|
1236
|
+
export declare function carriesBidiControls(value: unknown): boolean;
|
|
1179
1237
|
/**
|
|
1180
1238
|
* Resolve an `ask` decision to a terminal `allow`/`deny` via {@link OnAsk}. Centralizes the headless
|
|
1181
1239
|
* auto-deny default, fail-closed error handling, and stable deny reasons so every ask site is
|
package/dist/core/tool-policy.js
CHANGED
|
@@ -900,6 +900,78 @@ export function coreMintedResolutionOf(d, call) {
|
|
|
900
900
|
return undefined;
|
|
901
901
|
return isAskDenyResolution(v.resolution) ? v.resolution : undefined;
|
|
902
902
|
}
|
|
903
|
+
const BIDI_CONTROL_RE = /[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/u;
|
|
904
|
+
const BIDI_SCAN_MAX_NODES = 5_000;
|
|
905
|
+
const BIDI_SCAN_MAX_CHARS = 1_000_000;
|
|
906
|
+
export function carriesBidiControls(value) {
|
|
907
|
+
let budget = BIDI_SCAN_MAX_NODES;
|
|
908
|
+
let charBudget = BIDI_SCAN_MAX_CHARS;
|
|
909
|
+
const seen = new WeakSet();
|
|
910
|
+
const scan = (s) => {
|
|
911
|
+
if (charBudget <= 0)
|
|
912
|
+
return false;
|
|
913
|
+
const window = s.length <= charBudget ? s : s.slice(0, charBudget);
|
|
914
|
+
charBudget -= window.length;
|
|
915
|
+
return BIDI_CONTROL_RE.test(window);
|
|
916
|
+
};
|
|
917
|
+
const walk = (v) => {
|
|
918
|
+
if (budget-- <= 0)
|
|
919
|
+
return false;
|
|
920
|
+
if (typeof v === "string")
|
|
921
|
+
return scan(v);
|
|
922
|
+
if (typeof v !== "object" || v === null)
|
|
923
|
+
return false;
|
|
924
|
+
if (seen.has(v))
|
|
925
|
+
return false;
|
|
926
|
+
seen.add(v);
|
|
927
|
+
if (Array.isArray(v)) {
|
|
928
|
+
for (const el of v) {
|
|
929
|
+
if (walk(el))
|
|
930
|
+
return true;
|
|
931
|
+
if (budget <= 0)
|
|
932
|
+
return false;
|
|
933
|
+
}
|
|
934
|
+
return false;
|
|
935
|
+
}
|
|
936
|
+
if (v instanceof Map) {
|
|
937
|
+
for (const [k, val] of v) {
|
|
938
|
+
if (walk(k) || walk(val))
|
|
939
|
+
return true;
|
|
940
|
+
if (budget <= 0)
|
|
941
|
+
return false;
|
|
942
|
+
}
|
|
943
|
+
return false;
|
|
944
|
+
}
|
|
945
|
+
if (v instanceof Set) {
|
|
946
|
+
for (const el of v) {
|
|
947
|
+
if (walk(el))
|
|
948
|
+
return true;
|
|
949
|
+
if (budget <= 0)
|
|
950
|
+
return false;
|
|
951
|
+
}
|
|
952
|
+
return false;
|
|
953
|
+
}
|
|
954
|
+
for (const k in v) {
|
|
955
|
+
if (budget-- <= 0)
|
|
956
|
+
return false;
|
|
957
|
+
if (!Object.prototype.hasOwnProperty.call(v, k))
|
|
958
|
+
continue;
|
|
959
|
+
if (scan(k))
|
|
960
|
+
return true;
|
|
961
|
+
if (walk(v[k]))
|
|
962
|
+
return true;
|
|
963
|
+
if (budget <= 0 || charBudget <= 0)
|
|
964
|
+
return false;
|
|
965
|
+
}
|
|
966
|
+
return false;
|
|
967
|
+
};
|
|
968
|
+
try {
|
|
969
|
+
return walk(value);
|
|
970
|
+
}
|
|
971
|
+
catch {
|
|
972
|
+
return false;
|
|
973
|
+
}
|
|
974
|
+
}
|
|
903
975
|
export async function resolveAsk(req, onAsk, signal) {
|
|
904
976
|
const r = await resolveAskArms(req, onAsk, signal);
|
|
905
977
|
if (r.action === "deny" && isAskDenyResolution(r.resolution))
|
|
@@ -954,7 +1026,14 @@ async function resolveAskArms(req, onAsk, signal) {
|
|
|
954
1026
|
settledBy: "aborted",
|
|
955
1027
|
};
|
|
956
1028
|
}
|
|
957
|
-
|
|
1029
|
+
const bidi = carriesBidiControls(presented.value) || carriesBidiControls(req.preview);
|
|
1030
|
+
const { hasBidiControls: _carried, ...bare } = req;
|
|
1031
|
+
ok = await onAsk({
|
|
1032
|
+
...bare,
|
|
1033
|
+
boundInputHash: boundInputHashOf(presented.value),
|
|
1034
|
+
args: approverView.value,
|
|
1035
|
+
...(bidi ? { hasBidiControls: true } : {}),
|
|
1036
|
+
}, signal);
|
|
958
1037
|
}
|
|
959
1038
|
catch (err) {
|
|
960
1039
|
return {
|
package/dist/core/types.d.ts
CHANGED
|
@@ -4850,8 +4850,9 @@ export interface EngineNotice {
|
|
|
4850
4850
|
* probe threw; MCP dispatch FAILS OPEN (revocation is a tightening face) and this announces
|
|
4851
4851
|
* once per materialization (a resume re-materializes and may announce again). `detail: { message }`
|
|
4852
4852
|
* — no sessionId (a deployment wiring fact, not session-attributed), `"operator"` audience by
|
|
4853
|
-
*
|
|
4854
|
-
*
|
|
4853
|
+
* its explicit {@link NOTICE_AUDIENCE} row (#433 made the registry total over the catalog —
|
|
4854
|
+
* no engine-minted code is audience-defaulted any more). The refusal itself
|
|
4855
|
+
* (`mcp.server_revoked`) is a tool RESULT code, not a notice.
|
|
4855
4856
|
* - `"config.models_swapped"` — `Runner.swapModels` replaced the model catalog generation
|
|
4856
4857
|
* (zero-restart model switching). `detail: { models, tiers }` — key COUNTS only, never the
|
|
4857
4858
|
* catalog itself. In-flight tasks finish on the models they resolved at prepare (natural
|
|
@@ -4860,8 +4861,11 @@ export interface EngineNotice {
|
|
|
4860
4861
|
* - `"route.fallback_to_primary"` (key↔URL pairing, `src/brain/route-adjudicator.ts`) — a
|
|
4861
4862
|
* DERIVED-leg model (role/tier/system-default resolution, never a caller-explicit one) failed
|
|
4862
4863
|
* the pairing pre-flight and the seat fell back to the primary model instead of sinking the
|
|
4863
|
-
* task; the notice is the loud half of that swap.
|
|
4864
|
-
* — `cause` is the refusal code
|
|
4864
|
+
* task; the notice is the loud half of that swap.
|
|
4865
|
+
* `detail: { seat, from, to, cause, fixHint, sessionId? }` — `cause` is the refusal code
|
|
4866
|
+
* (`route.credential_mismatch` / `route.credential_missing`); `sessionId` (#433, additive)
|
|
4867
|
+
* rides when the adjudicating seat knows its session — a correlation key only, the audience
|
|
4868
|
+
* stays `"operator"` (see the registry's entitlement-not-routability note).
|
|
4865
4869
|
* Explicitly-named models never mint this: they refuse at the brain's request gate instead.
|
|
4866
4870
|
* - `"route.base_url_changed_key_unchanged"` (key↔URL pairing) — `Runner.swapModels` moved a
|
|
4867
4871
|
* same-name entry's `baseUrl` while its Model-visible credential half (auth-bearing headers)
|
|
@@ -4906,8 +4910,10 @@ export interface EngineNotice {
|
|
|
4906
4910
|
* frame's two count keys). They are NOT redelivered (a steer aimed at a finished run must not
|
|
4907
4911
|
* fire at the next one — unlike ENGINE notes, which pend per session); the loud half of the
|
|
4908
4912
|
* #257 contract's "accepted = enqueued, not consumed" sentence;
|
|
4909
|
-
* `detail: { steer, taskId? }` / `{ followUp, taskId? }
|
|
4910
|
-
*
|
|
4913
|
+
* `detail: { steer, taskId?, sessionId? }` / `{ followUp, taskId?, sessionId? }` (`sessionId`
|
|
4914
|
+
* = #433's routing half for these two `"user"`-audience rows — see
|
|
4915
|
+
* {@link undrainedUserInputNotices}; omitted when the caller has none, never fabricated).
|
|
4916
|
+
* Per-run, at most once per family (the terminal sweep is a single site).
|
|
4911
4917
|
* **#389 (two corrections).** ① The family now fires on the INTERRUPT path too: `abort()` used
|
|
4912
4918
|
* to empty both queues before agent_end could count them, so the one loss path an operator most
|
|
4913
4919
|
* needs to hear about was the one path that stayed silent. ② On a DURABLE PARK the verdict is
|
|
@@ -4924,7 +4930,10 @@ export interface EngineNotice {
|
|
|
4924
4930
|
* notification would be the worse error); what is announced is that the knob's promise is not
|
|
4925
4931
|
* honored, so an operator can stop building on it. Once per run (the injection funnel is a
|
|
4926
4932
|
* single site, and a busy lane must not narrate the same gap once per frame);
|
|
4927
|
-
* `detail: { priority, taskId
|
|
4933
|
+
* `detail: { priority, taskId?, sessionId }` — `sessionId` (#433, ALWAYS present: the funnel
|
|
4934
|
+
* sits past prepare, which owns a session unconditionally) is a correlation key only, the
|
|
4935
|
+
* audience stays `"operator"` (the party building on the unhonored knob is whoever called
|
|
4936
|
+
* notify, not the end user). An UNKNOWN priority value is a different fact with a
|
|
4928
4937
|
* different posture — `TaskStream.notify` refuses it typed (`notify.invalid_payload`).
|
|
4929
4938
|
*
|
|
4930
4939
|
* - `"memory.session_polluted"` (design/178 §3, #324a; message mode-aware since design/336) —
|
|
@@ -4994,10 +5003,13 @@ export interface EngineNotice {
|
|
|
4994
5003
|
* `ConsolidationRunStopReason` set), cycles done, and the residue (write-failure or
|
|
4995
5004
|
* fuse-refused groups by name). Advisory: committed cycles stand (add-only, never rolled
|
|
4996
5005
|
* back); the recovery verb is re-running the host driver, which resumes the same pending run.
|
|
4997
|
-
* - `"memory.consolidation_driver_superseded"`
|
|
4998
|
-
*
|
|
4999
|
-
*
|
|
5000
|
-
*
|
|
5006
|
+
* - `"memory.consolidation_driver_superseded"` is an ERROR code, not a notice (named here only
|
|
5007
|
+
* to keep the family's spellings in one place): a concurrent driver invocation took over this
|
|
5008
|
+
* scope's run row (attempt fencing) and the losing worker's call THROWS with this `code` —
|
|
5009
|
+
* it never crosses {@link deliverEngineNotice}, is deliberately absent from
|
|
5010
|
+
* {@link ENGINE_NOTICE_CODES}/{@link NOTICE_AUDIENCE}, and sits in the non-governance
|
|
5011
|
+
* disposition table with the error dispositions. The loser MUST NOT retry into the winner's
|
|
5012
|
+
* account. A consumer diffing its own table against the catalog must not add a row for it.
|
|
5001
5013
|
*
|
|
5002
5014
|
* - `"delegation.transcript_integrity"` (subagent transcript persistence) — a durable agent row
|
|
5003
5015
|
* with a BOUND transcript sessionId met a session store that attests `not_found` for it: the
|
|
@@ -5005,8 +5017,7 @@ export interface EngineNotice {
|
|
|
5005
5017
|
* most once per (scope, handle, process) — `detail: { handle, scope? }`, scope = the resolved
|
|
5006
5018
|
* access scope of the read that found the gap — from the continuation read faces (SendMessage preflight /
|
|
5007
5019
|
* AgentTranscript's durable leg); the per-call honest refusals are unchanged, and the declared
|
|
5008
|
-
* tier is NOT auto-downgraded (declaration-制 — observation reports, it never re-adjudicates)
|
|
5009
|
-
* `detail: { handle }`.
|
|
5020
|
+
* tier is NOT auto-downgraded (declaration-制 — observation reports, it never re-adjudicates).
|
|
5010
5021
|
*
|
|
5011
5022
|
* - `"memory.consolidation_recommended"` (design/339 §2.2/§6.2) — the engine-minted per-scope
|
|
5012
5023
|
* session count crossed the consolidation thresholds (time gate open ∧ enough distinct
|
|
@@ -5039,11 +5050,15 @@ export interface EngineNotice {
|
|
|
5039
5050
|
message: string;
|
|
5040
5051
|
/** Machine-readable facts of the notice (knob names, arriving values, values in force). */
|
|
5041
5052
|
detail?: Record<string, unknown>;
|
|
5042
|
-
/** The owning session, when the notice HAS one —
|
|
5043
|
-
*
|
|
5044
|
-
*
|
|
5045
|
-
*
|
|
5046
|
-
*
|
|
5053
|
+
/** The owning session, when the notice HAS one — an ATTRIBUTION/correlation key, never a
|
|
5054
|
+
* projection permission: whether a notice may be surfaced onto that session's user-facing
|
|
5055
|
+
* stream is decided by the code's {@link NOTICE_AUDIENCE} row alone ("audience is entitlement,
|
|
5056
|
+
* not routability" — several `"operator"` rows carry a sessionId purely for correlation, and a
|
|
5057
|
+
* projector keying on presence would push deployment facts at end users). Presence only makes
|
|
5058
|
+
* routing structurally POSSIBLE; a session-less code structurally cannot be routed at all.
|
|
5059
|
+
* Mint sites do not set this: {@link deliverEngineNotice} — the ONE delivery throat — lifts a
|
|
5060
|
+
* string `detail.sessionId` here, so the typed key and the detail carriage can never disagree.
|
|
5061
|
+
* Optional and absent for process/config-scoped codes. */
|
|
5047
5062
|
sessionId?: string;
|
|
5048
5063
|
}
|
|
5049
5064
|
/** Test seam (mirrors `__resetBashTimeoutAnnouncements`): never called by production code. */
|
|
@@ -5073,11 +5088,19 @@ export declare function deliverEngineNotice(onNotice: ((notice: EngineNotice) =>
|
|
|
5073
5088
|
* a consumer routing on `code` alone must never mistake a stranded follow-up for a stranded steer, so
|
|
5074
5089
|
* the code carries exactly the semantics its name claims — the same two-key split the settled frame
|
|
5075
5090
|
* uses. Pure (the terminal sweep race window is not constructible deterministically; this seam is).
|
|
5091
|
+
*
|
|
5092
|
+
* `sessionId` (#433, additive and optional): these two codes are the `"user"` audience rows whose
|
|
5093
|
+
* subject is the END USER's own lost input, and a disclosure that cannot say WHICH session lost it
|
|
5094
|
+
* has nowhere to be delivered — the audience registry and the routing key are the two halves of one
|
|
5095
|
+
* answer. Carried in `detail` like every other session-attributed code, so {@link deliverEngineNotice}
|
|
5096
|
+
* — the one throat — lifts it to the typed top-level key and the two spellings cannot disagree.
|
|
5097
|
+
* Omitted when the caller has none (never fabricated: the message is what the run lost, and a made-up
|
|
5098
|
+
* routing key would deliver it to the wrong stream).
|
|
5076
5099
|
*/
|
|
5077
5100
|
export declare function undrainedUserInputNotices(counts: {
|
|
5078
5101
|
steer: number;
|
|
5079
5102
|
followUp: number;
|
|
5080
|
-
}, taskId?: string): EngineNotice[];
|
|
5103
|
+
}, taskId?: string, sessionId?: string): EngineNotice[];
|
|
5081
5104
|
/** Runtime dependencies shared across tasks. */
|
|
5082
5105
|
export interface RunnerDeps {
|
|
5083
5106
|
brain: Brain;
|
|
@@ -5094,7 +5117,9 @@ export interface RunnerDeps {
|
|
|
5094
5117
|
* probe must not brick every MCP call) with a once-per-MATERIALIZATION `mcp.revocation_probe_failed`
|
|
5095
5118
|
* notice (a resume re-materializes and may announce again — the standing condition is re-news at
|
|
5096
5119
|
* each fresh mount, never per-call). The notice is a deployment wiring fact: `detail: { message }`
|
|
5097
|
-
* only, no session attribution, `"operator"` audience by
|
|
5120
|
+
* only, no session attribution, `"operator"` audience by its explicit {@link NOTICE_AUDIENCE}
|
|
5121
|
+
* row (#433 made the registry total over the catalog — no engine-minted code is
|
|
5122
|
+
* audience-defaulted any more) — a
|
|
5098
5123
|
* wire projector forwards it operator-tier and needs no per-session de-duplication of its own.
|
|
5099
5124
|
*/
|
|
5100
5125
|
mcpRevocations?: {
|
package/dist/core/types.js
CHANGED
|
@@ -52,22 +52,23 @@ export function deliverEngineNotice(onNotice, notice) {
|
|
|
52
52
|
}
|
|
53
53
|
console.warn(notice.message);
|
|
54
54
|
}
|
|
55
|
-
export function undrainedUserInputNotices(counts, taskId) {
|
|
55
|
+
export function undrainedUserInputNotices(counts, taskId, sessionId) {
|
|
56
56
|
const tid = taskId !== undefined ? { taskId } : {};
|
|
57
|
+
const sid = sessionId !== undefined ? { sessionId } : {};
|
|
57
58
|
const tail = `accepted as "queued" were never consumed — the run ended first. They are NOT redelivered; re-send against a live run if still wanted.`;
|
|
58
59
|
const out = [];
|
|
59
60
|
if (counts.steer > 0) {
|
|
60
61
|
out.push({
|
|
61
62
|
code: "task.user_steer_undrained",
|
|
62
63
|
message: `${counts.steer} user steer(s) ${tail}`,
|
|
63
|
-
detail: { steer: counts.steer, ...tid },
|
|
64
|
+
detail: { steer: counts.steer, ...tid, ...sid },
|
|
64
65
|
});
|
|
65
66
|
}
|
|
66
67
|
if (counts.followUp > 0) {
|
|
67
68
|
out.push({
|
|
68
69
|
code: "task.user_followup_undrained",
|
|
69
70
|
message: `${counts.followUp} user follow-up(s) ${tail}`,
|
|
70
|
-
detail: { followUp: counts.followUp, ...tid },
|
|
71
|
+
detail: { followUp: counts.followUp, ...tid, ...sid },
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
74
|
return out;
|
package/dist/index.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ export { BUILTIN_COMPLIANCE_DENIES, COMPLIANCE_CAPABILITIES, WEB_FETCH_TOOL_NAME
|
|
|
61
61
|
export { admitMemoryScopes, foldAdmissionFreeze, type OwnOrgAdmissionVerdict, type MemoryAdmissionInput, type MemoryAdmissionOutcome, type MemoryAdmissionVerdict, type MemoryScopeAdmission, type MemoryScopeOrigin, type MemoryScopeRequest, } from "./core/memory-admission.js";
|
|
62
62
|
export { assertRetentionCapability, type ManagedRetentionCapability, type RetentionDeclaration, type RetentionDeclaring, type RetentionPolicy, type RetentionReceipt, } from "./core/retention.js";
|
|
63
63
|
export { GOVERNANCE_CODES, governanceRetryClass, type GovernanceCode, type GovernanceRetryClass } from "./core/governance-codes.js";
|
|
64
|
-
export { NOTICE_AUDIENCE, noticeAudienceOf } from "./core/governance-codes.js";
|
|
64
|
+
export { NOTICE_AUDIENCE, noticeAudienceOf, ENGINE_NOTICE_CODES, type EngineNoticeCode, type NoticeAudience } from "./core/governance-codes.js";
|
|
65
65
|
export { TtlSessionStore, type TtlSessionStoreOptions, type EvictPolicy } from "./core/session-store.js";
|
|
66
66
|
export { reconcileInterruptedSession, findOrphanToolCalls, type OrphanToolCall, type ReconcileReport, } from "./core/session-reconcile.js";
|
|
67
67
|
export { StoredSession, InMemorySessionRepo, InMemorySessionStorage, BaseSessionStorage, leafIdAfterEntry, validateEntriesForImport, StreamingImportValidator, boundedTail, SessionError, isSessionConflict, hasSessionFork, uuidv7, type Session, type SessionStore, type AcquiredSession, type SessionStoreSummary, type SessionStorage, type SessionRepo, type SessionMetadata, type SessionTreeEntry, type SessionWriteOptions, type SessionPlacement, type SessionPlacementRecord, type PlacedSessionRow, } from "./core/session.js";
|
|
@@ -156,7 +156,7 @@ 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 RuleOffer, type SegmentRuleSuggestion, type SegmentCoverage, type RuleReject, type RuleRejectCode, type ParsedAllowRule, type PersistedRuleTool, type PersistedRuleMatch, } from "./core/permission-rule-model.js";
|
|
159
|
+
export { parseAllowRuleText, formatAllowRuleText, ruleAdmitsCommand, findAdmittingRule, suggestRulesForCommand, scopeCoversCwd, pathWithinRoot, isRuleLive, renderUntrustedCommandText, 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";
|
|
@@ -168,7 +168,7 @@ export { AdoptionError, assertAdoptionBootGate, readRootAdoptionFile, writeRootA
|
|
|
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
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, 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";
|
|
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, type OriginClearanceRow, type OriginClearanceEvent, committedDistilledOf, distilledEquals, type MemoryEntryDistilled, type MemoryEntryDistilledInput, CONSOLIDATION_DEFAULTS, ConsolidationRefusedError, MEMORY_SEARCH_SUPERSEDED_TAG, consolidationTypeEligible, deriveSupersededSet, memorySupersededNote, readIntentCredentials, supersessionFuseCeiling, memoryConsolidationRecommendedNotice, memoryConsolidationCommittedNotice, memoryConsolidationConflictNotice, memoryConsolidationIncompleteNotice, memoryConsolidationRefusedNotice, type ConsolidationGateRead, type ConsolidationGateRow, type ConsolidationIntent, type ConsolidationIntentCredentialRow, type ConsolidationLeaseSeat, type ConsolidationProductProposal, type ConsolidationProposal, type MemoryConsolidationOptions, type ConsolidationCommitReceipt, type ConsolidationReconcileReport, type ConsolidationResolveReceipt, type ConsolidationPlanSummary, type ConsolidationPlanFoldEvidence, 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 MemoryScopeEnumeration, 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";
|
package/dist/index.js
CHANGED
|
@@ -49,7 +49,7 @@ export { BUILTIN_COMPLIANCE_DENIES, COMPLIANCE_CAPABILITIES, WEB_FETCH_TOOL_NAME
|
|
|
49
49
|
export { admitMemoryScopes, foldAdmissionFreeze, } from "./core/memory-admission.js";
|
|
50
50
|
export { assertRetentionCapability, } from "./core/retention.js";
|
|
51
51
|
export { GOVERNANCE_CODES, governanceRetryClass } from "./core/governance-codes.js";
|
|
52
|
-
export { NOTICE_AUDIENCE, noticeAudienceOf } from "./core/governance-codes.js";
|
|
52
|
+
export { NOTICE_AUDIENCE, noticeAudienceOf, ENGINE_NOTICE_CODES } from "./core/governance-codes.js";
|
|
53
53
|
export { TtlSessionStore } from "./core/session-store.js";
|
|
54
54
|
export { reconcileInterruptedSession, findOrphanToolCalls, } from "./core/session-reconcile.js";
|
|
55
55
|
export { StoredSession, InMemorySessionRepo, InMemorySessionStorage, BaseSessionStorage, leafIdAfterEntry, validateEntriesForImport, StreamingImportValidator, boundedTail, SessionError, isSessionConflict, hasSessionFork, uuidv7, } from "./core/session.js";
|
|
@@ -118,7 +118,7 @@ export { parseAutoModeResponse, createAutoModeDecider, } from "./core/auto-mode.
|
|
|
118
118
|
export { buildAutoModePrompt, renderAutoModeWindow, renderAutoModeAction, AUTO_MODE_DEFAULTS_SENTINEL, } from "./core/auto-mode-prompt.js";
|
|
119
119
|
export { AUTO_MODE_BASE_PROMPT, AUTO_MODE_PERMISSIONS_EXTERNAL } from "./core/auto-mode-prompt-assets.js";
|
|
120
120
|
export { createPermissionRulePolicy, validatePermissionRules, parsePermissionRule, wildcardMatch, } from "./core/permission-rules.js";
|
|
121
|
-
export { parseAllowRuleText, formatAllowRuleText, ruleAdmitsCommand, findAdmittingRule, suggestRulesForCommand, scopeCoversCwd, pathWithinRoot, isRuleLive, BARE_INTERPRETER_NAMES, MAX_RULE_TEXT_CHARS, } from "./core/permission-rule-model.js";
|
|
121
|
+
export { parseAllowRuleText, formatAllowRuleText, ruleAdmitsCommand, findAdmittingRule, suggestRulesForCommand, scopeCoversCwd, pathWithinRoot, isRuleLive, renderUntrustedCommandText, BARE_INTERPRETER_NAMES, MAX_RULE_TEXT_CHARS, } from "./core/permission-rule-model.js";
|
|
122
122
|
export { removePersistedRule, applyTombstones, sameScope, InMemoryPermissionRuleStore, EMPTY_RULE_STORE, joinRuleStates, screenRuleSyncState, collectBelowFrontier, ruleSyncVector, joinFrontiers, dotAtOrBelowFrontier, sameRuleOwner, PERMISSION_RULE_WRITER, writerOf, foldDelta, addDotsOf, assertDeleteDeltaCarriesNoAdd, assertRedemptionNotQuarantined, } from "./core/permission-rule-store.js";
|
|
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";
|