@sema-agent/core 7.69.0 → 7.69.1
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 +583 -0
- package/dist/agents/repair-loop.js +6 -14
- package/dist/agents/subagent.js +2 -1
- package/dist/agents/verify.d.ts +1 -1
- package/dist/agents/verify.js +7 -1
- package/dist/brain/reasoning-request.d.ts +7 -0
- package/dist/brain/reasoning-request.js +6 -0
- package/dist/core/agent-config-dir.d.ts +39 -3
- package/dist/core/agent-config-dir.js +67 -11
- package/dist/core/allow-entry.d.ts +5 -5
- package/dist/core/allow-entry.js +12 -6
- package/dist/core/ask-headline.d.ts +2 -2
- package/dist/core/ask-origin.d.ts +31 -31
- package/dist/core/ask-origin.js +20 -13
- package/dist/core/attachment-source.d.ts +1 -1
- package/dist/core/attachment-source.js +1 -0
- package/dist/core/auto-compaction.d.ts +44 -62
- package/dist/core/auto-compaction.js +44 -103
- package/dist/core/cache-break-detector.d.ts +23 -11
- package/dist/core/cache-break-detector.js +11 -5
- package/dist/core/checkpoint-features.d.ts +1 -1
- package/dist/core/checkpoint-features.js +1 -1
- package/dist/core/checkpoint-requirements.d.ts +19 -1
- package/dist/core/checkpoint-requirements.js +6 -0
- package/dist/core/checkpoint-row-verdict.js +3 -0
- package/dist/core/checkpoint-store.d.ts +13 -2
- package/dist/core/child-clamp-seats.d.ts +30 -3
- package/dist/core/child-clamp-seats.js +24 -0
- package/dist/core/compaction-retired-members.d.ts +12 -0
- package/dist/core/compaction-retired-members.js +22 -0
- package/dist/core/config-refusal-codes.d.ts +1 -1
- package/dist/core/config-refusal-codes.js +2 -0
- package/dist/core/context-edit.d.ts +32 -17
- package/dist/core/context-edit.js +28 -0
- package/dist/core/cron.d.ts +68 -0
- package/dist/core/cron.js +259 -0
- package/dist/core/engine-attestation.d.ts +16 -0
- package/dist/core/engine-attestation.js +2 -0
- package/dist/core/engine-capabilities.d.ts +14 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +18 -7
- package/dist/core/engine-version.js +1 -1
- package/dist/core/gate-outcome.d.ts +29 -2
- package/dist/core/gate-outcome.js +6 -0
- package/dist/core/git-read-only.d.ts +10 -0
- package/dist/core/git-read-only.js +1 -0
- package/dist/core/git-worktree-env.js +9 -8
- package/dist/core/governance-codes.d.ts +9 -2
- package/dist/core/governance-codes.js +9 -0
- package/dist/core/locked-config.js +7 -3
- package/dist/core/lsp.d.ts +3 -0
- package/dist/core/lsp.js +3 -2
- package/dist/core/memory-engine/engine.d.ts +48 -12
- package/dist/core/memory-engine/engine.js +108 -46
- package/dist/core/memory-engine/file-backend.d.ts +2 -1
- package/dist/core/memory-engine/index-copies.d.ts +47 -0
- package/dist/core/memory-engine/index-copies.js +88 -0
- package/dist/core/memory-engine/layout.d.ts +20 -3
- package/dist/core/memory-engine/layout.js +39 -3
- package/dist/core/memory-engine/origin-clearance.d.ts +9 -7
- package/dist/core/memory-engine/origin-clearance.js +2 -4
- package/dist/core/memory-engine/types.d.ts +16 -3
- package/dist/core/mode-policy.d.ts +7 -1
- package/dist/core/mode-policy.js +9 -0
- package/dist/core/mods/session-compact.js +3 -3
- package/dist/core/mods/stations.d.ts +2 -0
- package/dist/core/mods/stations.js +2 -1
- package/dist/core/path-guard-rows.d.ts +8 -3
- package/dist/core/path-guard-rows.js +18 -5
- package/dist/core/peer-seat.d.ts +3 -0
- package/dist/core/peer-seat.js +3 -0
- package/dist/core/permission-rule-model.js +3 -2
- package/dist/core/process-identity.d.ts +11 -3
- package/dist/core/process-identity.js +26 -16
- package/dist/core/runner/assemble-result.d.ts +5 -0
- package/dist/core/runner/assemble-result.js +1 -1
- package/dist/core/runner/cleared-results-record.d.ts +33 -0
- package/dist/core/runner/cleared-results-record.js +56 -0
- package/dist/core/runner/compact-session.js +14 -9
- package/dist/core/runner/compaction-knobs.d.ts +1 -1
- package/dist/core/runner/continuation-gate.js +2 -1
- package/dist/core/runner/continues-from.d.ts +1 -1
- package/dist/core/runner/continues-from.js +1 -1
- package/dist/core/runner/contracts.d.ts +83 -31
- package/dist/core/runner/conversation-segment.d.ts +19 -12
- package/dist/core/runner/conversation-segment.js +27 -7
- package/dist/core/runner/derived-route-fallback.d.ts +2 -12
- package/dist/core/runner/derived-route-fallback.js +0 -6
- package/dist/core/runner/gate-exit.d.ts +2 -1
- package/dist/core/runner/gate-exit.js +4 -2
- package/dist/core/runner/git-status-frame.d.ts +2 -2
- package/dist/core/runner/git-status-frame.js +2 -1
- package/dist/core/runner/initial-run-state.js +1 -1
- package/dist/core/runner/leg-caller-places.d.ts +39 -0
- package/dist/core/runner/leg-caller-places.js +23 -0
- package/dist/core/runner/leg-frame.d.ts +8 -2
- package/dist/core/runner/leg-receipt.d.ts +29 -2
- package/dist/core/runner/leg-receipt.js +37 -6
- package/dist/core/runner/media-removed-seat.d.ts +10 -6
- package/dist/core/runner/media-removed-seat.js +6 -3
- package/dist/core/runner/messages-omitted-seat.d.ts +2 -1
- package/dist/core/runner/messages-omitted-seat.js +15 -5
- package/dist/core/runner/person-path-rows.d.ts +25 -7
- package/dist/core/runner/person-path-rows.js +16 -2
- package/dist/core/runner/prefix-ledger.d.ts +120 -0
- package/dist/core/runner/prefix-ledger.js +176 -0
- package/dist/core/runner/prepare-advisor.d.ts +2 -0
- package/dist/core/runner/prepare-advisor.js +2 -1
- package/dist/core/runner/prepare-artifact.d.ts +3 -0
- package/dist/core/runner/prepare-artifact.js +2 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +2 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
- package/dist/core/runner/prepare-config-doors.d.ts +9 -8
- package/dist/core/runner/prepare-config-doors.js +15 -12
- package/dist/core/runner/prepare-context-lane.d.ts +25 -6
- package/dist/core/runner/prepare-context-lane.js +82 -27
- package/dist/core/runner/prepare-gate-stations.d.ts +1 -2
- package/dist/core/runner/prepare-gate-stations.js +2 -4
- package/dist/core/runner/prepare-hands-readface.d.ts +18 -5
- package/dist/core/runner/prepare-hands-readface.js +41 -22
- package/dist/core/runner/prepare-inherited-gate.d.ts +5 -0
- package/dist/core/runner/prepare-inherited-gate.js +2 -0
- package/dist/core/runner/prepare-memory.d.ts +10 -2
- package/dist/core/runner/prepare-memory.js +51 -5
- package/dist/core/runner/prepare-policy-chain.d.ts +3 -0
- package/dist/core/runner/prepare-policy-chain.js +13 -2
- package/dist/core/runner/prepare-prompt-assembly.d.ts +12 -4
- package/dist/core/runner/prepare-prompt-assembly.js +10 -4
- package/dist/core/runner/prepare-prompt-inputs.d.ts +3 -7
- package/dist/core/runner/prepare-prompt-inputs.js +6 -7
- package/dist/core/runner/prepare-safety-scan.js +7 -0
- package/dist/core/runner/prepare-suspend-saga.d.ts +4 -0
- package/dist/core/runner/prepare-suspend-saga.js +3 -2
- package/dist/core/runner/prepare-task.js +59 -53
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +5 -11
- package/dist/core/runner/prepare-tool-disclosure-mount.js +7 -8
- package/dist/core/runner/prepare-turn-wiring.d.ts +16 -25
- package/dist/core/runner/prepare-turn-wiring.js +8 -18
- package/dist/core/runner/prepare-wiring-manifest.d.ts +1 -0
- package/dist/core/runner/prepare-wiring-manifest.js +3 -2
- package/dist/core/runner/prompt-suggestions.d.ts +3 -1
- package/dist/core/runner/prompt-suggestions.js +1 -1
- package/dist/core/runner/read-block-judge.d.ts +47 -0
- package/dist/core/runner/read-block-judge.js +33 -0
- package/dist/core/runner/role-resolution-table.d.ts +15 -10
- package/dist/core/runner/role-resolution-table.js +4 -5
- package/dist/core/runner/rule-store-unreadable-notice.d.ts +7 -4
- package/dist/core/runner/rule-store-unreadable-notice.js +4 -3
- package/dist/core/runner/run-compaction-machinery.d.ts +0 -10
- package/dist/core/runner/run-compaction-machinery.js +3 -39
- package/dist/core/runner/run-harness-handlers.js +4 -17
- package/dist/core/runner/run-identity-wiring.js +4 -1
- package/dist/core/runner/run-leg.js +11 -1
- package/dist/core/runner/run-recovery-lanes.d.ts +0 -4
- package/dist/core/runner/run-recovery-lanes.js +34 -18
- package/dist/core/runner/run-settle-and-teardown.d.ts +1 -3
- package/dist/core/runner/run-settle-and-teardown.js +14 -22
- package/dist/core/runner/run-telemetry-and-budget-seats.js +0 -1
- package/dist/core/runner/run-terminal-adoption.d.ts +11 -30
- package/dist/core/runner/run-terminal-adoption.js +5 -88
- package/dist/core/runner/run-tool-mount-facts.js +1 -5
- package/dist/core/runner/run-turn-boundary.js +56 -26
- package/dist/core/runner/runtask.js +7 -7
- package/dist/core/runner/session-hash-salt.d.ts +18 -0
- package/dist/core/runner/session-hash-salt.js +36 -0
- package/dist/core/runner/shell-env-withheld.d.ts +8 -5
- package/dist/core/runner/shell-env-withheld.js +3 -3
- package/dist/core/runner/side-call-account.d.ts +9 -1
- package/dist/core/runner/side-call-account.js +15 -4
- package/dist/core/runner/skill-mention.d.ts +12 -0
- package/dist/core/runner/skill-mention.js +50 -0
- package/dist/core/runner/stream-settle-backstop.js +1 -0
- package/dist/core/runner/synthetic-tools.js +2 -2
- package/dist/core/runner/tool-table-view.d.ts +5 -9
- package/dist/core/runner/tool-table-view.js +23 -21
- package/dist/core/runner/write-protection-station.d.ts +5 -2
- package/dist/core/runner/write-protection-station.js +1 -1
- package/dist/core/runner-deps.d.ts +25 -27
- package/dist/core/scheduler.d.ts +13 -3
- package/dist/core/scheduler.js +0 -12
- package/dist/core/secret-env.d.ts +47 -11
- package/dist/core/secret-env.js +65 -4
- package/dist/core/sensitive-path-policy.js +4 -0
- package/dist/core/session-checkout.js +10 -9
- package/dist/core/shell-read-silence.d.ts +2 -1
- package/dist/core/shell-run-candidates.d.ts +1 -1
- package/dist/core/shell-run-candidates.js +11 -3
- package/dist/core/task-event.d.ts +32 -10
- package/dist/core/task-intake.d.ts +5 -3
- package/dist/core/task-intake.js +6 -2
- package/dist/core/task-result.d.ts +39 -0
- package/dist/core/task-spec-members.d.ts +3 -0
- package/dist/core/task-spec-members.js +2 -2
- package/dist/core/task-spec.d.ts +37 -20
- package/dist/core/tool-policy.d.ts +30 -18
- package/dist/core/tool-policy.js +44 -32
- package/dist/core/tool-roster.d.ts +21 -7
- package/dist/core/tool-roster.js +34 -6
- package/dist/core/tool-spec-members.js +1 -1
- package/dist/core/tool-spec.d.ts +27 -0
- package/dist/core/tools.js +1 -0
- package/dist/core/trace.d.ts +42 -19
- package/dist/core/unc-spelling.d.ts +31 -0
- package/dist/core/unc-spelling.js +51 -0
- package/dist/core/wiring-manifest.d.ts +30 -3
- package/dist/core/wiring-manifest.js +10 -0
- package/dist/core/workflow-run-store-contract.js +22 -0
- package/dist/core/workflow-run-store.d.ts +17 -13
- package/dist/core/workflow-run-store.js +1 -1
- package/dist/core/write-protect.d.ts +4 -0
- package/dist/core/write-protect.js +17 -15
- package/dist/engine/compaction/compaction.d.ts +48 -98
- package/dist/engine/compaction/compaction.js +136 -216
- package/dist/engine/compaction/utils.d.ts +2 -11
- package/dist/engine/compaction/utils.js +4 -13
- package/dist/engine/execution-env/node-execution-env.js +17 -6
- package/dist/engine/harness/agent-harness.d.ts +19 -5
- package/dist/engine/harness/agent-harness.js +18 -7
- package/dist/engine/harness/types.d.ts +5 -7
- package/dist/engine/loop/agent-loop.d.ts +14 -1
- package/dist/engine/loop/agent-loop.js +31 -11
- package/dist/engine/loop/types.d.ts +8 -2
- package/dist/index.d.ts +9 -6
- package/dist/index.js +8 -6
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +1 -1
- package/dist/internal/harness.js +1 -1
- package/dist/orchestration/run-spec.js +7 -2
- package/dist/orchestration/run-workflow-tool.js +5 -3
- package/dist/orchestration/workflow-park-adoption.d.ts +66 -8
- package/dist/orchestration/workflow-park-adoption.js +195 -45
- package/dist/orchestration/workflow-types.d.ts +20 -0
- package/dist/orchestration/workflow-types.js +1 -0
- package/dist/orchestration/workflow.d.ts +3 -2
- package/dist/orchestration/workflow.js +10 -4
- package/dist/prompt-assembly/catalog/core-behavior.js +6 -0
- package/dist/prompt-assembly/catalog/events.d.ts +8 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.js +6 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/mechanism.js +1 -0
- package/dist/prompt-assembly/catalog/mechanism.d.ts +8 -0
- package/dist/prompt-assembly/catalog/mechanism.js +1 -0
- package/dist/prompt-assembly/catalog/schema.d.ts +1 -1
- package/dist/prompt-assembly/catalog/schema.js +1 -0
- package/dist/prompt-assembly/catalog/sections.js +8 -0
- package/dist/prompt-assembly/event-registry.js +1 -0
- package/dist/prompt-assembly/select.js +1 -0
- package/dist/prompt-assembly/turn-snapshot.d.ts +14 -27
- package/dist/prompt-assembly/turn-snapshot.js +6 -18
- package/dist/prompt-assembly/types.d.ts +3 -0
- package/dist/prompts/default.d.ts +9 -0
- package/dist/prompts/default.js +4 -0
- package/dist/shell/lex.d.ts +75 -11
- package/dist/shell/lex.js +340 -76
- package/dist/tools/fs/bash-program-position.js +2 -6
- package/dist/tools/fs/bash-readonly-classifier.d.ts +18 -3
- package/dist/tools/fs/bash-readonly-classifier.js +19 -9
- package/dist/tools/fs/containment-face.d.ts +12 -3
- package/dist/tools/fs/containment-face.js +16 -7
- package/dist/tools/fs/file-read-check.d.ts +26 -1
- package/dist/tools/fs/file-read-check.js +20 -2
- package/dist/tools/fs/fs-bash.js +4 -4
- package/dist/tools/fs/fs-read.d.ts +3 -0
- package/dist/tools/fs/fs-read.js +2 -2
- package/dist/tools/fs/fs-search-tools.d.ts +2 -2
- package/dist/tools/fs/fs-search-tools.js +4 -4
- package/dist/tools/fs/index.js +5 -3
- package/dist/tools/fs/pdf.js +12 -4
- package/dist/tools/fs/read-deny-home.d.ts +13 -2
- package/dist/tools/fs/read-deny-home.js +26 -22
- package/dist/tools/fs/read-deny.js +15 -6
- package/dist/tools/fs/removal-targets.d.ts +33 -17
- package/dist/tools/fs/removal-targets.js +160 -61
- package/dist/tools/fs/repo-map.d.ts +1 -1
- package/dist/tools/fs/repo-map.js +2 -2
- package/dist/tools/fs/safety.d.ts +28 -5
- package/dist/tools/fs/safety.js +72 -8
- package/dist/tools/fs/shell-read-bindings.d.ts +8 -2
- package/dist/tools/fs/shell-read-bindings.js +25 -6
- package/dist/tools/fs/shell-read-check.d.ts +3 -0
- package/dist/tools/fs/shell-read-check.js +22 -4
- package/dist/tools/fs/shell-read-establish.js +73 -43
- package/dist/tools/fs/shell-read-judge.d.ts +32 -14
- package/dist/tools/fs/shell-read-judge.js +13 -5
- package/dist/tools/fs/shell-read-object-path.d.ts +5 -1
- package/dist/tools/fs/shell-read-object-path.js +17 -4
- package/dist/tools/fs/shell-read-plan.d.ts +8 -2
- package/dist/tools/fs/shell-read-plan.js +36 -22
- package/dist/tools/fs/shell-read-sourced.js +12 -4
- package/dist/tools/fs/shell-read-start.d.ts +4 -2
- package/dist/tools/fs/shell-read-start.js +3 -3
- package/dist/tools/fs/shell-read-workdir.d.ts +14 -6
- package/dist/tools/fs/shell-read-workdir.js +35 -17
- package/dist/tools/scheduler-tools.d.ts +7 -17
- package/dist/tools/scheduler-tools.js +9 -85
- package/dist/tools/worktree.js +5 -4
- package/package.json +3 -2
- package/test/export-surface.snapshot.json +47 -1
- package/wire-changes/core-stores-sql@7.68.6.json +39 -0
- package/wire-changes/core-stores-sql@7.69.1.json +39 -0
- package/wire-changes/core@7.68.6.json +125 -0
- package/wire-changes/core@7.69.1.json +2561 -0
- package/wire-changes/mods-kernel@7.68.6.json +39 -0
- package/wire-changes/mods-kernel@7.69.1.json +39 -0
- package/wire-changes/primitives@7.68.6.json +39 -0
- package/wire-changes/primitives@7.69.1.json +39 -0
- package/wire-changes/wiki-gate@7.68.6.json +39 -0
- package/wire-changes/wiki-gate@7.69.1.json +39 -0
- package/dist/core/runner/prompt-hash-salt.d.ts +0 -1
- package/dist/core/runner/prompt-hash-salt.js +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const GIT_READ_ONLY = "git -c core.hooksPath=/dev/null -c core.fsmonitor= --no-optional-locks";
|
|
@@ -2,6 +2,7 @@ import { randomUUID } from "node:crypto";
|
|
|
2
2
|
import { thrownLabel, thrownText } from "./thrown-value.js";
|
|
3
3
|
import { repositoryTopOf } from "../tools/fs/shell-read-object-path.js";
|
|
4
4
|
import { pathFamilyOf } from "../tools/fs/safety.js";
|
|
5
|
+
import { GIT_READ_ONLY as G } from "./git-read-only.js";
|
|
5
6
|
export const WORKTREE_PARENT = ".sema/worktrees";
|
|
6
7
|
const WORKTREE_BRANCH_PREFIX = "sema";
|
|
7
8
|
const NAME_SEGMENT = /^[a-zA-Z0-9._-]+$/;
|
|
@@ -88,7 +89,7 @@ function ignoredDetail(paths) {
|
|
|
88
89
|
}
|
|
89
90
|
export async function treeHoldsOf(env, path, baseSha, readFloor, opts) {
|
|
90
91
|
const rethrow = opts?.rethrow === true;
|
|
91
|
-
const status = await gitAt(env,
|
|
92
|
+
const status = await gitAt(env, `${G} status --porcelain --ignored --untracked-files=normal`, path, readFloor, rethrow);
|
|
92
93
|
if (status === undefined || status.exitCode !== 0)
|
|
93
94
|
return undefined;
|
|
94
95
|
const entries = status.stdout.split("\n").filter((line) => line !== "");
|
|
@@ -97,7 +98,7 @@ export async function treeHoldsOf(env, path, baseSha, readFloor, opts) {
|
|
|
97
98
|
const branch = managedWorktreeBranchOf(path);
|
|
98
99
|
if (baseSha !== undefined && branch !== undefined) {
|
|
99
100
|
const countOf = async (tips) => {
|
|
100
|
-
const ahead = await gitAt(env,
|
|
101
|
+
const ahead = await gitAt(env, `${G} rev-list --count ${[...tips, `^${baseSha}`].map(shq).join(" ")} --`, path, readFloor, rethrow);
|
|
101
102
|
const counted = ahead !== undefined && ahead.exitCode === 0 ? Number.parseInt(ahead.stdout.trim(), 10) : Number.NaN;
|
|
102
103
|
return Number.isFinite(counted) ? counted : undefined;
|
|
103
104
|
};
|
|
@@ -124,7 +125,7 @@ export async function judgeManagedTree(env, tree, options) {
|
|
|
124
125
|
}
|
|
125
126
|
async function branchListingOf(env, cwd, branch, readFloor, rethrow = false) {
|
|
126
127
|
const ref = `refs/heads/${branch}`;
|
|
127
|
-
const listed = await gitAt(env,
|
|
128
|
+
const listed = await gitAt(env, `${G} for-each-ref --count=1 --format=${shq("%(refname)")} ${shq(ref)}`, cwd, readFloor, rethrow);
|
|
128
129
|
if (listed === undefined || listed.exitCode !== 0 || listed.stderr.trim() !== "")
|
|
129
130
|
return "unread";
|
|
130
131
|
const names = listed.stdout.trim();
|
|
@@ -195,7 +196,7 @@ export async function removeManagedWorktree(baseEnv, repoRoot, worktreeDir, bran
|
|
|
195
196
|
const del = await baseEnv.exec(`git update-ref --no-deref -d ${shq(`refs/heads/${branch.name}`)} ${shq(branch.baseSha)}`, { cwd: repoRoot, ...readFloorNow() });
|
|
196
197
|
if (del.ok && del.value.exitCode === 0)
|
|
197
198
|
return { ok: true, branchDeleted: branch.name };
|
|
198
|
-
const tip = await baseEnv.exec(
|
|
199
|
+
const tip = await baseEnv.exec(`${G} rev-parse --verify --quiet ${shq(`refs/heads/${branch.name}`)}`, { cwd: repoRoot, ...readFloorNow() });
|
|
199
200
|
if (tip.ok && tip.value.exitCode !== 0)
|
|
200
201
|
return { ok: true };
|
|
201
202
|
if (tip.ok && tip.value.stdout.trim() !== branch.baseSha)
|
|
@@ -270,25 +271,25 @@ export async function mintManagedWorktree(baseEnv, opts) {
|
|
|
270
271
|
}
|
|
271
272
|
const excludeLine = shq(`/${WORKTREE_PARENT}/`);
|
|
272
273
|
await Promise.resolve()
|
|
273
|
-
.then(() => baseEnv.exec(`ex="$(
|
|
274
|
+
.then(() => baseEnv.exec(`ex="$(${G} rev-parse --git-path info/exclude)" && mkdir -p "$(dirname "$ex")" && ` +
|
|
274
275
|
`{ grep -qxF ${excludeLine} "$ex" 2>/dev/null || printf '%s\\n' ${excludeLine} >> "$ex"; }`, { cwd: anchor, ...readFloorNow() }))
|
|
275
276
|
.catch(() => undefined);
|
|
276
277
|
const baseSha = await Promise.resolve()
|
|
277
|
-
.then(() => baseEnv.exec(
|
|
278
|
+
.then(() => baseEnv.exec(`${G} rev-parse HEAD`, { cwd: worktreeDir, ...readFloorNow() }))
|
|
278
279
|
.then((r) => (r.ok && r.value.exitCode === 0 && r.value.stdout.trim() !== "" ? r.value.stdout.trim() : undefined))
|
|
279
280
|
.catch(() => undefined);
|
|
280
281
|
return { worktreeDir, name, branch, anchor, ...(baseSha !== undefined ? { baseSha } : {}) };
|
|
281
282
|
}
|
|
282
283
|
export async function resolveBaseCommit(env, repoRoot, baseRef, readFloor) {
|
|
283
284
|
const rev = async (ref) => {
|
|
284
|
-
const r = await env.exec(
|
|
285
|
+
const r = await env.exec(`${G} rev-parse --verify --quiet ${shq(`${ref}^{commit}`)}`, { cwd: repoRoot, ...(readFloor !== undefined ? { readFloor } : {}) });
|
|
285
286
|
return r.ok && r.value.exitCode === 0 ? r.value.stdout.trim() : undefined;
|
|
286
287
|
};
|
|
287
288
|
if (baseRef === "head") {
|
|
288
289
|
const sha = await rev("HEAD");
|
|
289
290
|
return sha ? { sha, label: "HEAD" } : { error: "cannot resolve HEAD (empty repository with no commits?)" };
|
|
290
291
|
}
|
|
291
|
-
const sym = await env.exec(
|
|
292
|
+
const sym = await env.exec(`${G} symbolic-ref --quiet refs/remotes/origin/HEAD`, { cwd: repoRoot, ...(readFloor !== undefined ? { readFloor } : {}) });
|
|
292
293
|
if (sym.ok && sym.value.exitCode === 0) {
|
|
293
294
|
const branch = sym.value.stdout.trim().replace(/^refs\/remotes\//, "");
|
|
294
295
|
if (branch) {
|
|
@@ -54,7 +54,8 @@ export declare function governanceRetryClass(code: string): GovernanceRetryClass
|
|
|
54
54
|
* fixed the roster (`config.tool_mount_denied`), a
|
|
55
55
|
* member over a roster row's wire bound (`config.tool_roster_bound` / `config.tool_name_too_long` /
|
|
56
56
|
* `config.tool_contract_too_long`), a schema over the row's key bounds (`config.tool_schema_bound`), a
|
|
57
|
-
* declared face or result card the schema / namespace cannot carry
|
|
57
|
+
* declared face or result card the schema / namespace cannot carry, a `perTurn` member other than `true`, or a per-turn tool whose
|
|
58
|
+
* name or alias another mounted tool also answers to (`config.tool_face_invalid` — also the code an MCP server entry's
|
|
58
59
|
* unreadable `toolFaces` is refused with at the task preparation door and at `materializeMcpTools`), a name or
|
|
59
60
|
* alias outside the caller tool name contract — one no rule can name, or one carrying the protocol namespace separator
|
|
60
61
|
* (`config.tool_name_invalid`), an egress tool declared other than
|
|
@@ -179,7 +180,7 @@ export type NoticeAttention = "act" | "inform" | "audit";
|
|
|
179
180
|
* the union's catalog ({@link EngineNotice.code}). The groups below say only which family a row joins,
|
|
180
181
|
* so the catalog is not written a second time here and the two cannot drift.
|
|
181
182
|
*/
|
|
182
|
-
export declare const ENGINE_NOTICE_CODES: readonly ["config.autocompact_window_clamped", "config.env_timeout_discarded", "config.materialize_env_discarded", "config.models_swapped", "config.context_settings_swapped", "config.read_face_swapped", "config.read_face_deployment_clamped", "config.write_face_swapped", "config.write_face_deployment_clamped", "config.read_deny_swapped", "config.tool_model_gate_removed", "config.tool_model_gate_unknown_class", "config.tool_model_gate_env_invalid", "config.artifact_host_invalid", "config.task_root_not_canonical", "config.write_protection_target_view_absent", "config.path_view_unresolved", "config.execution_env_capability_invalid", "config.read_deny_floor_unkept", "config.read_floor_confinement_unavailable", "config.inherit_env_declared_late", "config.command_sandbox_unavailable", "config.tool_card_undeclared", "config.tool_face_undeclared", "config.tool_face_invalid", "config.host_sink_failed", "config.seat_malformed", "config.env_knob_adjusted", "config.read_deny_home", "config.permission_rules_skipped", "config.process_start_time_unavailable", "config.durable_gate_unavailable", "config.peer_admission_out_of_range", "config.peer_lane_unmounted", "config.secret_env_scrubbed", "inherit_env.names_withheld", "config.credential_not_withheld", "config.cross_boundary_posture_undeclared", "config.cross_boundary_record_unwritten", "config.permission_mode_unavailable", "permission.rule_store_unavailable", "permission.rule_store_unreadable_relaxed", "permission.rule_row_dropped", "permission.settings_rules_skipped", "config.session_rules_earlier_grammar", "config.legacy_tool_name", "config.toolpolicy.unmatched_names", "config.agent.unknown_tool", "permission.allowed_tool_not_granted", "permission.allow_rule_not_used_in_auto", "mods.registration_refused", "mods.display_withheld", "mods.stop_ended", "peer.inbound_disposition", "peer.held_settled", "peer.idle_subscription", "classifier.denial_limit", "classifier.fallback", "classifier.seat_rate_limited", "classifier.role_defaulted", "classifier.contract_broken", "classifier.unavailable", "checkpoint.execution_outcome_unrecorded", "delegation.transcript_integrity", "delegation.ask_unresolvable", "delegation.resume_lane_missing", "delegation.delivery_discarded", "delegation.settlement_external", "delegation.settlement_write_failed", "delegation.durable_row_unpersisted", "delegation.parked_card_unreadable", "delegation.parked_card_id_untrusted", "mcp.injection_dropped", "protocol.revocation_probe_failed", "mcp.server_redialed", "mcp.authorization_required", "mcp.server_unavailable", "mcp.credential_echoed", "workflow.governance_key_stripped", "workflow.agent_option_ignored", "workflow.parked_decision_unused", "memory.session_polluted", "memory.harvest_quarantined", "memory.harvest_refused", "memory.harvest_conflict", "memory.delegation_static_mark_waived", "memory.content_class_declared", "memory.hold_opened", "memory.hold_released", "memory.hold_disposed", "memory.consolidation_recommended", "memory.consolidation_committed", "memory.consolidation_conflict", "memory.consolidation_incomplete", "memory.consolidation_refused", "memory.consolidation_withheld", "memory.restore_withheld", "memory.project_scope_absent", "memory.notice_unscoped", "route.fallback_to_primary", "route.classifier_unroutable", "route.seat_detached", "advisor.not_attached", "route.credential_origin_mismatch", "route.credential_mismatch", "route.credential_rebound", "route.response_model_mismatch", "route.tool_call_id_folded", "route.finish_reason_unknown", "route.stream_end_ignored", "route.extra_body_reserved_dropped", "model.capability_downgraded", "model.fast_mode_changed", "model.role_defaulted", "model.fallback", "context.tool_turn_repaired", "context.media_removed", "context.tool_schema_removed", "context.messages_omitted", "instructions.withheld", "instructions.family_undeclared", "task.user_steer_undrained", "task.user_followup_undrained", "task.undelivered_input_dropped", "steering.parked_input_blocked", "task.turn_interrupted", "task.halt_unconsumed", "task.late_approval", "task.interrupt_unconsumed", "task.completed_past_limit", "task.verdict_refused", "task.tool_turn_incomplete", "approval.read_root_granted", "approval.read_root_grant_rejected", "approval.approver_defect", "memory.capture_opted_out", "memory.capture_optout_unpersisted", "memory.mount_failed", "skills.listing_truncated", "agents.listing_truncated", "tool_result.offload_put_failed", "tool_result.media_refused", "tool_result.media_persisted", "tool_result.read_refused", "config.image_processor_unavailable", "fs.staging_file_left", "fs.staging_file_swept", "store.tail_segment_unjudged", "store.lock_retained", "store.lock_reclaimed_on_declaration", "engine.debug_trace", "session.lineage_rerooted", "rewind.boundary_unrecorded", "rewind.file_left_as_is", "verify.verifier_is_implementer", "memory.layer_locked_legacy", "server.model_unreachable", "permission.entry_mode_clamped", "model.context_window_assumed", "config.store_ephemeral"];
|
|
183
|
+
export declare const ENGINE_NOTICE_CODES: readonly ["config.autocompact_window_clamped", "config.compaction_member_ignored", "config.env_timeout_discarded", "config.materialize_env_discarded", "config.models_swapped", "config.context_settings_swapped", "config.read_face_swapped", "config.read_face_deployment_clamped", "config.write_face_swapped", "config.write_face_deployment_clamped", "config.read_deny_swapped", "config.tool_model_gate_removed", "config.tool_model_gate_unknown_class", "config.tool_model_gate_env_invalid", "config.artifact_host_invalid", "config.task_root_not_canonical", "config.write_protection_target_view_absent", "config.path_view_unresolved", "config.execution_env_capability_invalid", "config.read_deny_floor_unkept", "config.read_floor_confinement_unavailable", "config.inherit_env_declared_late", "config.command_sandbox_unavailable", "config.tool_card_undeclared", "config.tool_face_undeclared", "config.tool_face_invalid", "config.host_sink_failed", "config.seat_malformed", "config.env_knob_adjusted", "config.read_deny_home", "config.permission_rules_skipped", "config.process_start_time_unavailable", "config.durable_gate_unavailable", "config.peer_admission_out_of_range", "config.peer_lane_unmounted", "config.secret_env_scrubbed", "inherit_env.names_withheld", "config.credential_not_withheld", "config.cross_boundary_posture_undeclared", "config.cross_boundary_record_unwritten", "config.permission_mode_unavailable", "permission.rule_store_unavailable", "permission.rule_store_unreadable_relaxed", "permission.rule_row_dropped", "permission.settings_rules_skipped", "config.session_rules_earlier_grammar", "config.legacy_tool_name", "config.toolpolicy.unmatched_names", "config.agent.unknown_tool", "permission.allowed_tool_not_granted", "permission.allow_rule_not_used_in_auto", "mods.registration_refused", "mods.display_withheld", "mods.stop_ended", "peer.inbound_disposition", "peer.held_settled", "peer.idle_subscription", "classifier.denial_limit", "classifier.fallback", "classifier.seat_rate_limited", "classifier.role_defaulted", "classifier.contract_broken", "classifier.unavailable", "checkpoint.execution_outcome_unrecorded", "delegation.transcript_integrity", "delegation.ask_unresolvable", "delegation.resume_lane_missing", "delegation.delivery_discarded", "delegation.settlement_external", "delegation.settlement_write_failed", "delegation.durable_row_unpersisted", "delegation.parked_card_unreadable", "delegation.parked_card_id_untrusted", "mcp.injection_dropped", "protocol.revocation_probe_failed", "mcp.server_redialed", "mcp.authorization_required", "mcp.server_unavailable", "mcp.credential_echoed", "workflow.governance_key_stripped", "workflow.agent_option_ignored", "workflow.parked_decision_unused", "memory.session_polluted", "memory.harvest_quarantined", "memory.harvest_refused", "memory.harvest_conflict", "memory.delegation_static_mark_waived", "memory.content_class_declared", "memory.hold_opened", "memory.hold_released", "memory.hold_disposed", "memory.consolidation_recommended", "memory.consolidation_committed", "memory.consolidation_conflict", "memory.consolidation_incomplete", "memory.consolidation_refused", "memory.consolidation_withheld", "memory.restore_withheld", "memory.project_scope_absent", "memory.notice_unscoped", "route.fallback_to_primary", "route.classifier_unroutable", "route.seat_detached", "advisor.not_attached", "route.credential_origin_mismatch", "route.credential_mismatch", "route.credential_rebound", "route.response_model_mismatch", "route.tool_call_id_folded", "route.finish_reason_unknown", "route.stream_end_ignored", "route.extra_body_reserved_dropped", "model.capability_downgraded", "model.fast_mode_changed", "model.role_defaulted", "model.fallback", "context.tool_turn_repaired", "context.media_removed", "context.tool_schema_removed", "context.messages_omitted", "instructions.withheld", "instructions.family_undeclared", "task.user_steer_undrained", "task.user_followup_undrained", "task.undelivered_input_dropped", "steering.parked_input_blocked", "task.turn_interrupted", "task.halt_unconsumed", "task.late_approval", "task.interrupt_unconsumed", "task.completed_past_limit", "task.verdict_refused", "task.tool_turn_incomplete", "approval.read_root_granted", "approval.read_root_grant_rejected", "approval.approver_defect", "memory.capture_opted_out", "memory.capture_optout_unpersisted", "memory.mount_failed", "skills.listing_truncated", "agents.listing_truncated", "tool_result.offload_put_failed", "tool_result.media_refused", "tool_result.media_persisted", "tool_result.read_refused", "config.image_processor_unavailable", "fs.staging_file_left", "fs.staging_file_swept", "store.tail_segment_unjudged", "store.lock_retained", "store.lock_reclaimed_on_declaration", "engine.debug_trace", "session.lineage_rerooted", "rewind.boundary_unrecorded", "rewind.file_left_as_is", "verify.verifier_is_implementer", "memory.layer_locked_legacy", "server.model_unreachable", "permission.entry_mode_clamped", "model.context_window_assumed", "config.store_ephemeral", "memory.sync_layer_parked"];
|
|
183
184
|
/** A catalogued code (see {@link ENGINE_NOTICE_CODES}); {@link NOTICE_MINTER} says who mints it. NOT the type of
|
|
184
185
|
* `EngineNotice.code`, which stays `string` — a host forwarding its own notices through the same
|
|
185
186
|
* sink is a supported shape, and narrowing that field would break it. */
|
|
@@ -256,6 +257,7 @@ declare const NOTICE_AUDIENCE_TABLE: {
|
|
|
256
257
|
readonly "task.verdict_refused": "user";
|
|
257
258
|
readonly "inherit_env.names_withheld": "user";
|
|
258
259
|
readonly "config.autocompact_window_clamped": "operator";
|
|
260
|
+
readonly "config.compaction_member_ignored": "operator";
|
|
259
261
|
readonly "config.env_timeout_discarded": "operator";
|
|
260
262
|
readonly "config.materialize_env_discarded": "operator";
|
|
261
263
|
readonly "config.models_swapped": "operator";
|
|
@@ -361,6 +363,7 @@ declare const NOTICE_AUDIENCE_TABLE: {
|
|
|
361
363
|
readonly "model.context_window_assumed": "user";
|
|
362
364
|
readonly "memory.layer_locked_legacy": "operator";
|
|
363
365
|
readonly "config.store_ephemeral": "user";
|
|
366
|
+
readonly "memory.sync_layer_parked": "user";
|
|
364
367
|
};
|
|
365
368
|
/** Compile-time fence: every catalogued code has an audience row (and, via `satisfies`, only those). */
|
|
366
369
|
export type AudienceTableCoversEveryNoticeCode = AssertAllKeysHandled<Exclude<EngineNoticeCode, keyof typeof NOTICE_AUDIENCE_TABLE>>;
|
|
@@ -442,6 +445,7 @@ declare const NOTICE_ATTENTION_TABLE: {
|
|
|
442
445
|
readonly "verify.verifier_is_implementer": "act";
|
|
443
446
|
readonly "server.model_unreachable": "act";
|
|
444
447
|
readonly "permission.entry_mode_clamped": "act";
|
|
448
|
+
readonly "memory.sync_layer_parked": "act";
|
|
445
449
|
readonly "config.read_deny_floor_unkept": "inform";
|
|
446
450
|
readonly "inherit_env.names_withheld": "inform";
|
|
447
451
|
readonly "mods.display_withheld": "inform";
|
|
@@ -455,6 +459,7 @@ declare const NOTICE_ATTENTION_TABLE: {
|
|
|
455
459
|
readonly "memory.hold_released": "audit";
|
|
456
460
|
readonly "approval.read_root_granted": "audit";
|
|
457
461
|
readonly "config.autocompact_window_clamped": "act";
|
|
462
|
+
readonly "config.compaction_member_ignored": "act";
|
|
458
463
|
readonly "config.env_timeout_discarded": "act";
|
|
459
464
|
readonly "config.materialize_env_discarded": "act";
|
|
460
465
|
readonly "config.tool_model_gate_unknown_class": "act";
|
|
@@ -572,6 +577,7 @@ export declare const NOTICE_FACT_KEY: Readonly<Partial<Record<EngineNoticeCode,
|
|
|
572
577
|
export type NoticeMinter = "engine" | "server";
|
|
573
578
|
declare const NOTICE_MINTER_TABLE: {
|
|
574
579
|
readonly "config.autocompact_window_clamped": "engine";
|
|
580
|
+
readonly "config.compaction_member_ignored": "engine";
|
|
575
581
|
readonly "config.env_timeout_discarded": "engine";
|
|
576
582
|
readonly "config.materialize_env_discarded": "engine";
|
|
577
583
|
readonly "config.models_swapped": "engine";
|
|
@@ -731,6 +737,7 @@ declare const NOTICE_MINTER_TABLE: {
|
|
|
731
737
|
readonly "permission.entry_mode_clamped": "server";
|
|
732
738
|
readonly "model.context_window_assumed": "server";
|
|
733
739
|
readonly "config.store_ephemeral": "server";
|
|
740
|
+
readonly "memory.sync_layer_parked": "server";
|
|
734
741
|
};
|
|
735
742
|
/** Compile-time fence: every catalogued code has a minter row (and, via `satisfies`, only those). */
|
|
736
743
|
export type MinterTableCoversEveryNoticeCode = AssertAllKeysHandled<Exclude<EngineNoticeCode, keyof typeof NOTICE_MINTER_TABLE>>;
|
|
@@ -19,6 +19,7 @@ export const NON_GOVERNANCE_MEMORY_CODES = new Set([
|
|
|
19
19
|
"memory.partition_split",
|
|
20
20
|
"memory.layout_migrated",
|
|
21
21
|
"memory.layer_locked_legacy",
|
|
22
|
+
"memory.sync_layer_parked",
|
|
22
23
|
"memory.layout_unowned_root_content",
|
|
23
24
|
"memory.tail",
|
|
24
25
|
"memory.pollution_mark_failed",
|
|
@@ -136,6 +137,7 @@ export const RULE_SYNC_DROP_CODES = {
|
|
|
136
137
|
};
|
|
137
138
|
export const ENGINE_NOTICE_CODES = Object.freeze([
|
|
138
139
|
"config.autocompact_window_clamped",
|
|
140
|
+
"config.compaction_member_ignored",
|
|
139
141
|
"config.env_timeout_discarded",
|
|
140
142
|
"config.materialize_env_discarded",
|
|
141
143
|
"config.models_swapped",
|
|
@@ -295,6 +297,7 @@ export const ENGINE_NOTICE_CODES = Object.freeze([
|
|
|
295
297
|
"permission.entry_mode_clamped",
|
|
296
298
|
"model.context_window_assumed",
|
|
297
299
|
"config.store_ephemeral",
|
|
300
|
+
"memory.sync_layer_parked",
|
|
298
301
|
]);
|
|
299
302
|
const NOTICE_AUDIENCE_TABLE = {
|
|
300
303
|
"memory.session_polluted": "user",
|
|
@@ -352,6 +355,7 @@ const NOTICE_AUDIENCE_TABLE = {
|
|
|
352
355
|
"task.verdict_refused": "user",
|
|
353
356
|
"inherit_env.names_withheld": "user",
|
|
354
357
|
"config.autocompact_window_clamped": "operator",
|
|
358
|
+
"config.compaction_member_ignored": "operator",
|
|
355
359
|
"config.env_timeout_discarded": "operator",
|
|
356
360
|
"config.materialize_env_discarded": "operator",
|
|
357
361
|
"config.models_swapped": "operator",
|
|
@@ -457,6 +461,7 @@ const NOTICE_AUDIENCE_TABLE = {
|
|
|
457
461
|
"model.context_window_assumed": "user",
|
|
458
462
|
"memory.layer_locked_legacy": "operator",
|
|
459
463
|
"config.store_ephemeral": "user",
|
|
464
|
+
"memory.sync_layer_parked": "user",
|
|
460
465
|
};
|
|
461
466
|
export const NOTICE_AUDIENCE = NOTICE_AUDIENCE_TABLE;
|
|
462
467
|
export function noticeAudienceOf(code) {
|
|
@@ -523,6 +528,7 @@ const NOTICE_ATTENTION_TABLE = {
|
|
|
523
528
|
"verify.verifier_is_implementer": "act",
|
|
524
529
|
"server.model_unreachable": "act",
|
|
525
530
|
"permission.entry_mode_clamped": "act",
|
|
531
|
+
"memory.sync_layer_parked": "act",
|
|
526
532
|
"config.read_deny_floor_unkept": "inform",
|
|
527
533
|
"inherit_env.names_withheld": "inform",
|
|
528
534
|
"mods.display_withheld": "inform",
|
|
@@ -536,6 +542,7 @@ const NOTICE_ATTENTION_TABLE = {
|
|
|
536
542
|
"memory.hold_released": "audit",
|
|
537
543
|
"approval.read_root_granted": "audit",
|
|
538
544
|
"config.autocompact_window_clamped": "act",
|
|
545
|
+
"config.compaction_member_ignored": "act",
|
|
539
546
|
"config.env_timeout_discarded": "act",
|
|
540
547
|
"config.materialize_env_discarded": "act",
|
|
541
548
|
"config.tool_model_gate_unknown_class": "act",
|
|
@@ -635,6 +642,7 @@ export const NOTICE_FACT_KEY = Object.freeze({
|
|
|
635
642
|
});
|
|
636
643
|
const NOTICE_MINTER_TABLE = {
|
|
637
644
|
"config.autocompact_window_clamped": "engine",
|
|
645
|
+
"config.compaction_member_ignored": "engine",
|
|
638
646
|
"config.env_timeout_discarded": "engine",
|
|
639
647
|
"config.materialize_env_discarded": "engine",
|
|
640
648
|
"config.models_swapped": "engine",
|
|
@@ -794,5 +802,6 @@ const NOTICE_MINTER_TABLE = {
|
|
|
794
802
|
"permission.entry_mode_clamped": "server",
|
|
795
803
|
"model.context_window_assumed": "server",
|
|
796
804
|
"config.store_ephemeral": "server",
|
|
805
|
+
"memory.sync_layer_parked": "server",
|
|
797
806
|
};
|
|
798
807
|
export const NOTICE_MINTER = Object.freeze(NOTICE_MINTER_TABLE);
|
|
@@ -9,7 +9,8 @@ import { CONFIG_RECEIPT_MODE, optionKeys, strayMembersOf } from "./own-property-
|
|
|
9
9
|
import { isToolContentOrigin, TOOL_CONTENT_ORIGINS } from "./memory-engine/content-origin.js";
|
|
10
10
|
import { inlineUntrusted } from "./untrusted-text.js";
|
|
11
11
|
import { assertNoRetiredToolPolicyKeys } from "./retired-keys.js";
|
|
12
|
-
import { CREDENTIALS_MEMBER, RETIRED_VALUE_MEMBERS, declaredCredentials, peerSeatMissing, retiredValueMember } from "./peer-seat.js";
|
|
12
|
+
import { CREDENTIALS_MEMBER, RETIRED_VALUE_MEMBERS, declaredCredentials, peerSeatMissing, referencedVariables, retiredValueMember } from "./peer-seat.js";
|
|
13
|
+
import { holdPeerHeldNames } from "./secret-env.js";
|
|
13
14
|
export const LOCKED_KEY_REGISTRY = {
|
|
14
15
|
mcp: { specFields: ["mcp"] },
|
|
15
16
|
a2a: { specFields: ["a2a"] },
|
|
@@ -57,8 +58,9 @@ export function snapshotMcpEntries(entries) {
|
|
|
57
58
|
}
|
|
58
59
|
const LOCK_DECLARATION_WORDS = new Set(["keys"]);
|
|
59
60
|
const ENTRY_PATH_WORDS = new Set([...DECLARATION_ENTRY_WORDS, ...TOOL_AXIS_WORDS, ...TOOL_FACE_WORDS, ...Object.values(RETIRED_VALUE_MEMBERS).flat(2)]);
|
|
61
|
+
const entrySubject = (at, declarer) => `${declarerWord(at)}${declarer === undefined ? "" : ` ${declarerNameOf(declarer)}`}`;
|
|
60
62
|
function unreadableDeclaration(at, declarer, member, problem) {
|
|
61
|
-
const refusal = codedError("config.invalid_argument", `${
|
|
63
|
+
const refusal = codedError("config.invalid_argument", `${entrySubject(at, declarer)} declares ${inlineUntrusted(member, 80)} the engine cannot read: ${problem}. A declaration the engine cannot read is refused ` +
|
|
62
64
|
`rather than partly applied — what the caller wrote and what the engine runs on would otherwise differ without anyone being told.`);
|
|
63
65
|
if (declarer !== undefined)
|
|
64
66
|
Object.defineProperty(refusal, "declarer", { value: declarer, enumerable: true, writable: false, configurable: false });
|
|
@@ -94,10 +96,12 @@ export function snapshotDeclaredEntry(entry, at) {
|
|
|
94
96
|
if ("problem" in credentials) {
|
|
95
97
|
throw declarationRefusal("config.credential_ref_invalid", at, declarer, `declares ${CREDENTIALS_MEMBER[at].join(".")} that is not a credential reference (${inlineUntrusted(credentials.problem, 160)}).`);
|
|
96
98
|
}
|
|
99
|
+
if (credentials.ref !== undefined)
|
|
100
|
+
holdPeerHeldNames(referencedVariables(credentials.ref), entrySubject(at, declarer));
|
|
97
101
|
return received.value;
|
|
98
102
|
}
|
|
99
103
|
function declarationRefusal(code, at, declarer, sentence) {
|
|
100
|
-
const refusal = codedError(code, `${
|
|
104
|
+
const refusal = codedError(code, `${entrySubject(at, declarer)} ${sentence}`);
|
|
101
105
|
if (declarer !== undefined)
|
|
102
106
|
Object.defineProperty(refusal, "declarer", { value: declarer, enumerable: true, writable: false, configurable: false });
|
|
103
107
|
return refusal;
|
package/dist/core/lsp.d.ts
CHANGED
|
@@ -188,6 +188,9 @@ export interface LspReadFace {
|
|
|
188
188
|
readonly face?: ContainmentFace;
|
|
189
189
|
/** The file read station's admission: an out-of-root target the gate asked about and let through, read once. */
|
|
190
190
|
readonly admitted?: (toolCallId: string | undefined, canonicalKey: string) => boolean;
|
|
191
|
+
/** What a refusal of a target outside the roots names in place of the escape hint (the run's read face's remedy on a leg
|
|
192
|
+
* that refuses reads outside its directories). Absent ⇒ the escape hint. */
|
|
193
|
+
readonly outsideRemedy?: string;
|
|
191
194
|
/** Settles once the read-deny table and read roots a judgment takes are ready (a Runner compiles them per read of the
|
|
192
195
|
* person's rules): a call's own (`toolCallId`), or — with none — the run's newest; at `signal` too; never rejects;
|
|
193
196
|
* absent ⇒ ready. The tool waits for it before it takes its call's; the session's own reads before they judge. */
|
package/dist/core/lsp.js
CHANGED
|
@@ -10,6 +10,7 @@ import { toolFace } from "./tool-catalog-entries.js";
|
|
|
10
10
|
import { thrownText } from "./thrown-value.js";
|
|
11
11
|
import { envErrorDetail } from "../tools/fs/env-error-detail.js";
|
|
12
12
|
import { readObjectAt } from "../tools/fs/bound-open.js";
|
|
13
|
+
import { GIT_READ_ONLY } from "./git-read-only.js";
|
|
13
14
|
export const LSP_OPERATIONS = [
|
|
14
15
|
"goToDefinition", "findReferences", "hover", "documentSymbol", "workspaceSymbol",
|
|
15
16
|
"goToImplementation", "prepareCallHierarchy", "incomingCalls", "outgoingCalls",
|
|
@@ -85,7 +86,7 @@ export function lspBaseOf(readFace, env) {
|
|
|
85
86
|
return pathTargetBaseOf(LSP_PATH_TARGET, readFace !== undefined ? { root: readFace.rootCanonical, cwd: readFace.cwdRef?.current } : { cwd: env?.cwd });
|
|
86
87
|
}
|
|
87
88
|
function judgeLspRead(env, face, spelling, signal, admitted) {
|
|
88
|
-
return resolveKey(env, face.rootCanonical, spelling, signal, lspBaseOf(face), face.roots, admitted, face.readDeny, face.face);
|
|
89
|
+
return resolveKey(env, face.rootCanonical, spelling, signal, lspBaseOf(face), face.roots, admitted, face.readDeny, face.face, face.outsideRemedy);
|
|
89
90
|
}
|
|
90
91
|
function lspKeyOf(env, face, authorizedKey) {
|
|
91
92
|
const exempt = authorizedKey === undefined ? undefined : (key) => key === authorizedKey;
|
|
@@ -369,7 +370,7 @@ export function gitCheckIgnoreFilter(env, root, readFloor) {
|
|
|
369
370
|
try {
|
|
370
371
|
const q = `'${path.replace(/'/g, `'\\''`)}'`;
|
|
371
372
|
const floor = readFloor?.();
|
|
372
|
-
const res = await env.exec(
|
|
373
|
+
const res = await env.exec(`${GIT_READ_ONLY} check-ignore ${q}`, { cwd: root, timeout: 10, ...(floor !== undefined ? { readFloor: floor } : {}) });
|
|
373
374
|
ignored = res.ok && res.value.exitCode === 0;
|
|
374
375
|
}
|
|
375
376
|
catch {
|
|
@@ -212,10 +212,11 @@ export declare const DEFAULT_HOLD_SETTLE_TIMEOUT_MS: number;
|
|
|
212
212
|
/** design/138 §2.4 删除防线 — the mass-deletion fuse ratio: the ratio leg of the deletion fuse
|
|
213
213
|
* ({@link deletionFuseCeiling} — max(floor, ⌊ratio × N⌋) over the materialized writable files). A
|
|
214
214
|
* session's removal of a file it was served on its write face is its delete of that entry (the
|
|
215
|
-
* removal IS the write); more removals than the ceiling in one harvest is
|
|
216
|
-
* the whole harvest refused — NOTHING is deleted
|
|
217
|
-
*
|
|
218
|
-
*
|
|
215
|
+
* removal IS the write); more removals than the ceiling in one harvest is read as a mistake and
|
|
216
|
+
* the whole harvest refused — NOTHING is deleted, and each removed file goes back from its
|
|
217
|
+
* committed copy (`HarvestReport.restored`), so the plane agrees with the store's account; a person
|
|
218
|
+
* who meant it deletes at most the ceiling per session. Renames (same id re-appearing elsewhere)
|
|
219
|
+
* never count toward it (验收 M1). */
|
|
219
220
|
export declare const MASS_DELETION_FUSE_RATIO = 0.5;
|
|
220
221
|
export interface MemoryEngineOptions {
|
|
221
222
|
backend: MemoryBackend;
|
|
@@ -357,8 +358,9 @@ export interface MemoryInjection {
|
|
|
357
358
|
* the queue was empty. */
|
|
358
359
|
announceBlock?: string;
|
|
359
360
|
/** `instruction + index` — the memory store's STATE, what the Runner mounts in the stable-prefix
|
|
360
|
-
* memory slot. Byte-identical across runs until the state itself changes
|
|
361
|
-
*
|
|
361
|
+
* memory slot. Byte-identical across runs until the state itself changes (the Runner hands the segment's
|
|
362
|
+
* frozen index back while its process holds it and the store withheld or erased nothing since); the drained notices
|
|
363
|
+
* are {@link announceBlock} (#1123). */
|
|
362
364
|
block: string;
|
|
363
365
|
/**
|
|
364
366
|
* RB-276 — the materialized MEMORY.md whose FULL disk text rides in this injection, for prepare-task
|
|
@@ -383,11 +385,16 @@ export interface MemoryInjection {
|
|
|
383
385
|
* that got past `truncateIndex`; the only remaining transform is the fence-tag neutralization,
|
|
384
386
|
* which rewrites forged `</user_memory>` / `<system-reminder>` markers only.
|
|
385
387
|
* `content` is always the exact disk text.
|
|
388
|
+
* With a `frozenIndex` that differs from the disk text the injected index is not the file, so no seed rides.
|
|
386
389
|
*/
|
|
387
390
|
indexSeed?: {
|
|
388
391
|
path: string;
|
|
389
392
|
content: string;
|
|
390
393
|
};
|
|
394
|
+
/** The raw index text {@link index} was composed from — the live file, the materialize-time text, or the caller's
|
|
395
|
+
* `frozenIndex` — before the cut and the fence: what a caller freezes to serve the same bytes on a later
|
|
396
|
+
* injection. Empty when the store has no index. Set by `inject`; a merged injection carries none. */
|
|
397
|
+
indexText?: string;
|
|
391
398
|
}
|
|
392
399
|
/**
|
|
393
400
|
* design/178 v2-a §1.3 — one entry's ASSEMBLED provenance account: the machine-readable answer to
|
|
@@ -605,13 +612,33 @@ export declare function pollutionContainmentCounts(report: HarvestReport): {
|
|
|
605
612
|
* The outcome is said first and short: an announcement line is capped at 160 characters.
|
|
606
613
|
*/
|
|
607
614
|
export declare function harvestConflictSentence(c: PatchReport["conflicts"][number]): string;
|
|
615
|
+
/**
|
|
616
|
+
* The deletion fuse's account of the harvest it refused, said once for both readers of
|
|
617
|
+
* `incident.detail`: the person (the `memory.harvest_refused` message) and the model (the next
|
|
618
|
+
* session's announcement line, cut at 160 characters — so what happened to the removals comes first,
|
|
619
|
+
* then the fuse's ceiling and the way to delete that many on purpose). `removed` = the removals counted
|
|
620
|
+
* against the ceiling, `ceiling` = the most removals one harvest commits ({@link deletionFuseCeiling}),
|
|
621
|
+
* `putBack` = the ones restored from their committed copies, `notBack` = the ones the store may still
|
|
622
|
+
* hold that did not go back, `gone` = the ones another writer deleted since the session was served
|
|
623
|
+
* them (then "nothing was deleted" is said of this session only). Counts only: no path, no id, no
|
|
624
|
+
* store text; a sentence of counts, not a clip (nothing here is cut to a bound).
|
|
625
|
+
*/
|
|
626
|
+
export declare function massDeletionDetail(c: {
|
|
627
|
+
removed: number;
|
|
628
|
+
ceiling: number;
|
|
629
|
+
putBack: number;
|
|
630
|
+
notBack: number;
|
|
631
|
+
gone: number;
|
|
632
|
+
}): string;
|
|
608
633
|
/**
|
|
609
634
|
* `memory.harvest_refused` (audience `user`) — the boundary harvest was refused wholesale (an incident:
|
|
610
|
-
* the deletion fuse, a vanished write root, a control plane that could not be read or written)
|
|
611
|
-
*
|
|
612
|
-
*
|
|
613
|
-
*
|
|
614
|
-
*
|
|
635
|
+
* the deletion fuse, a vanished write root, a control plane that could not be read or written). The
|
|
636
|
+
* person is the one who was told "remembered" or "forgotten" during the session; this is where they
|
|
637
|
+
* learn what held. The deletion fuse says its own outcome in plain words ({@link massDeletionDetail}:
|
|
638
|
+
* nothing was deleted and the files went back from their saved copies); the other kinds say this
|
|
639
|
+
* session's memory changes did not take effect. One notice per refused harvest; `detail: { kind,
|
|
640
|
+
* committed, reportId?, sessionId? }` — `committed` is the report's applied patch count (0 for a
|
|
641
|
+
* refused single-plane harvest; a dual-root merge can carry the other plane's).
|
|
615
642
|
*/
|
|
616
643
|
export declare function memoryHarvestRefusedNotice(report: HarvestReport, sessionId?: string): EngineNotice | undefined;
|
|
617
644
|
/**
|
|
@@ -1257,6 +1284,10 @@ export declare class MemoryEngine {
|
|
|
1257
1284
|
generation?: number;
|
|
1258
1285
|
at?: number;
|
|
1259
1286
|
}>>;
|
|
1287
|
+
/** What the store withheld and erased, as a mount reads it ({@link MemorySessionHandle.storeState}): the challenged ids and
|
|
1288
|
+
* the origin-clearance account's erasure count — the one count of the erase door's runs (every erasure writes it; this read
|
|
1289
|
+
* writes nothing; it only goes up, {@link readAdmittedStoreState}). Never throws: a state that cannot be read, or a lower count, is `"unreadable"`. */
|
|
1290
|
+
private readStoreState;
|
|
1260
1291
|
/** The shared challenge writer: append events idempotently, then announce OPAQUELY (id + code +
|
|
1261
1292
|
* generation only — the announcement is a model-visible face, so no name/description/free reason
|
|
1262
1293
|
* rides it; content stays on the host audit face). Failures are disclosed, never thrown past. */
|
|
@@ -1339,6 +1370,9 @@ export declare class MemoryEngine {
|
|
|
1339
1370
|
*/
|
|
1340
1371
|
eraseMemoryEntries(input: EraseMemoryEntriesInput): Promise<MemoryErasureAttestation>;
|
|
1341
1372
|
private eraseMemoryEntriesCore;
|
|
1373
|
+
/** {@link indexCopiesAnswered} over either lane's answer; an attestation that cannot carry it is handed on as it came and
|
|
1374
|
+
* the copies that may still name erased entries are disclosed the way the sweep discloses residue it cannot carry. */
|
|
1375
|
+
private answerIndexCopies;
|
|
1342
1376
|
/** #3463 / #3623 — the `clearanceCustody` class of an evidence face's attestation, answered over the governance store the
|
|
1343
1377
|
* engine keeps the clearances in, for every resolved id a conflict did not keep standing. The engine's step ALWAYS runs: a
|
|
1344
1378
|
* face's own count is a statement about whatever store the face works over, and a face that counted without ever touching
|
|
@@ -1349,7 +1383,8 @@ export declare class MemoryEngine {
|
|
|
1349
1383
|
* `unverified`, or an answer that is no pair of counts) is answered by the engine alone; an account that cannot be updated
|
|
1350
1384
|
* in passing keeps the face's count, an account that is CORRUPT never does (a corrupt clearance account gives no
|
|
1351
1385
|
* evidence: the class is `unverified` and the request `partial`, whatever the face counted), and the class is `unverified`
|
|
1352
|
-
* when the face gave none.
|
|
1386
|
+
* when the face gave none. `counted` ⇔ the engine's step ran to its answer, so the store's erasure count moved
|
|
1387
|
+
* ({@link indexCopiesAnswered} reads it). */
|
|
1353
1388
|
private answerClearanceCustody;
|
|
1354
1389
|
/**
|
|
1355
1390
|
* design/178 v2-b (rescan hardening) — the erase-time DERIVED-INDEX sweep, both lanes. MEMORY.md
|
|
@@ -1475,6 +1510,7 @@ export declare class MemoryEngine {
|
|
|
1475
1510
|
inject(handle: MemorySessionHandle, opts?: {
|
|
1476
1511
|
writeToolMounted?: boolean;
|
|
1477
1512
|
reminderMark?: string;
|
|
1513
|
+
frozenIndex?: string;
|
|
1478
1514
|
}): Promise<MemoryInjection>;
|
|
1479
1515
|
/**
|
|
1480
1516
|
* design/138 S2-C — gate ONE tool write (Write/Edit/NotebookEdit) against the memory domain.
|