dsh-completion-guard 0.8.2 → 0.8.4
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 +21 -1
- package/CHANGELOG.zh-CN.md +21 -1
- package/README.md +4 -4
- package/README.zh-CN.md +4 -4
- package/dist/domain/index.d.ts +2 -2
- package/dist/domain/index.js +2 -2
- package/dist/{domain-B-2fya9P.js → domain-DZTbCIYn.js} +579 -128
- package/dist/{index-DqvBEsNc.d.ts → index-BmTaAEkJ.d.ts} +67 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.js +672 -130
- package/docs/COMPATIBILITY.md +12 -4
- package/docs/HOST_LOCK_UPGRADE.md +8 -6
- package/docs/LOCAL_ACCEPTANCE.md +9 -5
- package/docs/README.md +13 -8
- package/docs/WRITER_LOCK_PROTOCOL.md +63 -0
- package/package.json +2 -2
- package/docs/CORE_ALIGNMENT_PLAN_REVIEW.json +0 -144
- package/docs/DEVELOPMENT_PLAN_0_7_0.md +0 -93
- package/docs/DEVELOPMENT_PLAN_DSH_0_1_7_RC2.md +0 -283
- package/docs/DEVELOPMENT_PLAN_DSH_0_2_0_RC2_DESKTOP.md +0 -85
- package/docs/DSH_0_1_7_RC2_ACCEPTANCE.md +0 -57
- package/docs/RELEASE_NOTES_0_7_1.md +0 -21
- package/docs/RELEASE_NOTES_0_8_2.md +0 -21
- package/docs/dsh-0.1.7-rc.2-planning-evidence.json +0 -585
|
@@ -21,7 +21,7 @@ const physicalFs = process.versions.electron ? createRequire(import.meta.url)("o
|
|
|
21
21
|
|
|
22
22
|
//#endregion
|
|
23
23
|
//#region src/domain/host-audit-session.ts
|
|
24
|
-
const { existsSync: existsSync$4, readFileSync: readFileSync$3, readdirSync, realpathSync: realpathSync$4, statSync: statSync$2 } = physicalFs;
|
|
24
|
+
const { existsSync: existsSync$4, readFileSync: readFileSync$3, readdirSync: readdirSync$1, realpathSync: realpathSync$4, statSync: statSync$2 } = physicalFs;
|
|
25
25
|
function createHostAuditSession(onPhysicalRead) {
|
|
26
26
|
const cache = /* @__PURE__ */ new Map();
|
|
27
27
|
const once = (key, compute) => {
|
|
@@ -56,7 +56,7 @@ function createHostAuditSession(onPhysicalRead) {
|
|
|
56
56
|
readFile: (path$1) => readBytes(path$1),
|
|
57
57
|
readJson: (path$1) => once(`json:${path$1}`, () => JSON.parse(session.readFile(path$1).toString("utf8"))),
|
|
58
58
|
fileDigest: (path$1) => once(`digest:${path$1}`, () => createFileDigest(session.readFile(path$1))),
|
|
59
|
-
listDir: (dir) => once(`listdir:${dir}`, () => readdirSync(dir, { withFileTypes: true }).map((entry) => ({
|
|
59
|
+
listDir: (dir) => once(`listdir:${dir}`, () => readdirSync$1(dir, { withFileTypes: true }).map((entry) => ({
|
|
60
60
|
name: entry.name,
|
|
61
61
|
isFile: entry.isFile(),
|
|
62
62
|
isDirectory: entry.isDirectory()
|
|
@@ -9092,6 +9092,22 @@ const DESKTOP_GRAPH_ROOT = "dsh/node_modules";
|
|
|
9092
9092
|
const DESKTOP_CARRIER_ENTRY = "dsh/node_modules/@deepseek-ai/dsh-desktop-host/lib/cli.js";
|
|
9093
9093
|
const MAX_ASAR_HEADER_BYTES = 128 * 1024 * 1024;
|
|
9094
9094
|
const MAX_ASAR_FILE_BYTES = 64 * 1024 * 1024;
|
|
9095
|
+
/**
|
|
9096
|
+
* CG-083-PERF03: operation-scoped asar reads. Within ONE host-lock
|
|
9097
|
+
* validation the same helpers used to re-open the archive and re-read the
|
|
9098
|
+
* header, metadata and module bytes several times; with a session, the index
|
|
9099
|
+
* and every entry's bytes are memoized on that operation's audit session —
|
|
9100
|
+
* they live and die with the validation and are never a cross-entry cache.
|
|
9101
|
+
* Without a session the original direct reads run unchanged.
|
|
9102
|
+
*/
|
|
9103
|
+
function memoizedAsarIndex(session, archivePath) {
|
|
9104
|
+
if (!session) return readAsarIndex(archivePath);
|
|
9105
|
+
return session.memo(`desktop-asar-index:${archivePath}`, () => readAsarIndex(archivePath));
|
|
9106
|
+
}
|
|
9107
|
+
function memoizedAsarFile(session, archivePath, index$1, entryPath) {
|
|
9108
|
+
if (!session) return readAsarFile(archivePath, index$1, entryPath);
|
|
9109
|
+
return session.memo(`desktop-asar-bytes:${archivePath}\u0000${entryPath}`, () => readAsarFile(archivePath, index$1, entryPath));
|
|
9110
|
+
}
|
|
9095
9111
|
/** Read the asar header (the JSON index) without extracting any payload. */
|
|
9096
9112
|
function readAsarIndex(archivePath) {
|
|
9097
9113
|
const header = Buffer.alloc(16);
|
|
@@ -9196,15 +9212,15 @@ function isRecord(value) {
|
|
|
9196
9212
|
* manifest, the `desktop-runtime.json` metadata block, and the official CLI
|
|
9197
9213
|
* carrier entry the app installs.
|
|
9198
9214
|
*/
|
|
9199
|
-
function readDesktopAppRuntime(appAsarPath) {
|
|
9215
|
+
function readDesktopAppRuntime(appAsarPath, session) {
|
|
9200
9216
|
if (!isAbsolute(appAsarPath)) throw new HostProfileError("desktop_app_invalid", "the app archive path must be absolute");
|
|
9201
9217
|
if (!existsSync$2(appAsarPath) || !lstatSync$2(appAsarPath).isFile()) throw new HostProfileError("desktop_app_missing", "the official app archive was not found");
|
|
9202
9218
|
const asarRealpath = realpathSync$2(appAsarPath);
|
|
9203
|
-
const index$1 =
|
|
9219
|
+
const index$1 = memoizedAsarIndex(session, asarRealpath);
|
|
9204
9220
|
if (!asarNode(index$1, DESKTOP_CARRIER_ENTRY.split("/"))) throw new HostProfileError("desktop_app_invalid", "the official CLI carrier entry is missing from the app bundle");
|
|
9205
|
-
|
|
9206
|
-
const manifestBytes =
|
|
9207
|
-
const metadataBytes =
|
|
9221
|
+
memoizedAsarFile(session, asarRealpath, index$1, DESKTOP_CARRIER_ENTRY);
|
|
9222
|
+
const manifestBytes = memoizedAsarFile(session, asarRealpath, index$1, DESKTOP_RUNTIME_MANIFEST_ENTRY);
|
|
9223
|
+
const metadataBytes = memoizedAsarFile(session, asarRealpath, index$1, DESKTOP_RUNTIME_METADATA_ENTRY);
|
|
9208
9224
|
const manifest = JSON.parse(manifestBytes.toString("utf8"));
|
|
9209
9225
|
const metadata = JSON.parse(metadataBytes.toString("utf8"));
|
|
9210
9226
|
if (manifest.name !== DESKTOP_RUNTIME_PACKAGE_NAME) throw new HostProfileError("desktop_app_invalid", "the app runtime manifest is not the official desktop runtime");
|
|
@@ -9290,7 +9306,7 @@ function readDesktopTargetGraph(appAsarPath, profileRoot) {
|
|
|
9290
9306
|
const dsh = isRecord(manifest.dsh) ? manifest.dsh : void 0;
|
|
9291
9307
|
const bundles = (isRecord(dsh?.profile) ? dsh.profile : void 0)?.bundles;
|
|
9292
9308
|
if (!Array.isArray(bundles) || !bundles.includes("@deepseek-ai/dsh-base") || !bundles.includes("@deepseek-ai/dsh-web-app")) throw new HostProfileError("target_profile_bundles_unsupported", "not the official Desktop bundle tuple");
|
|
9293
|
-
if (bundles.includes("@deepseek-ai/dsh-headless")
|
|
9309
|
+
if (bundles.includes("@deepseek-ai/dsh-headless")) throw new HostProfileError("desktop_profile_bundle_conflict", "the desktop profile carries the headless-only bundle");
|
|
9294
9310
|
const runtime = readDesktopAppRuntime(appAsarPath);
|
|
9295
9311
|
return {
|
|
9296
9312
|
packages: runtime.rows,
|
|
@@ -9311,10 +9327,10 @@ function readDesktopTargetGraph(appAsarPath, profileRoot) {
|
|
|
9311
9327
|
* graph is an ambiguity no adapter resolves, so its presence fails closed
|
|
9312
9328
|
* before any digest is computed.
|
|
9313
9329
|
*/
|
|
9314
|
-
function auditDesktopInstalledImplementation(appAsarPath, expectations) {
|
|
9330
|
+
function auditDesktopInstalledImplementation(appAsarPath, expectations, session) {
|
|
9315
9331
|
try {
|
|
9316
9332
|
const realArchive = realpathSync$2(appAsarPath);
|
|
9317
|
-
const index$1 =
|
|
9333
|
+
const index$1 = memoizedAsarIndex(session, realArchive);
|
|
9318
9334
|
const { CRITICAL_NAME_SET } = criticalNames();
|
|
9319
9335
|
const topLevelRoot = DESKTOP_GRAPH_ROOT.split("/");
|
|
9320
9336
|
const scan = (node, parts, depth) => {
|
|
@@ -9332,7 +9348,7 @@ function auditDesktopInstalledImplementation(appAsarPath, expectations) {
|
|
|
9332
9348
|
};
|
|
9333
9349
|
scan(index$1.root, [], 0);
|
|
9334
9350
|
const fileTable = /* @__PURE__ */ new Map();
|
|
9335
|
-
const metadataBytes =
|
|
9351
|
+
const metadataBytes = memoizedAsarFile(session, realArchive, index$1, DESKTOP_RUNTIME_METADATA_ENTRY);
|
|
9336
9352
|
const metadata = JSON.parse(metadataBytes.toString("utf8"));
|
|
9337
9353
|
if (Array.isArray(metadata.files)) {
|
|
9338
9354
|
for (const entry of metadata.files) if (entry && typeof entry === "object" && typeof entry.path === "string" && /^[a-f0-9]{64}$/.test(String(entry.sha256))) fileTable.set(`dsh/${entry.path}`, String(entry.sha256));
|
|
@@ -9341,7 +9357,7 @@ function auditDesktopInstalledImplementation(appAsarPath, expectations) {
|
|
|
9341
9357
|
const parts = [...topLevelRoot, ...expected.name.split("/")];
|
|
9342
9358
|
const node = asarNode(index$1, parts);
|
|
9343
9359
|
if (!node || !node.files) return false;
|
|
9344
|
-
const manifestBytes =
|
|
9360
|
+
const manifestBytes = memoizedAsarFile(session, realArchive, index$1, [...parts, "package.json"].join("/"));
|
|
9345
9361
|
const manifest = JSON.parse(manifestBytes.toString("utf8"));
|
|
9346
9362
|
if (manifest.name !== expected.name || manifest.version !== expected.version) return false;
|
|
9347
9363
|
const inventory = [];
|
|
@@ -9363,10 +9379,10 @@ function auditDesktopInstalledImplementation(appAsarPath, expectations) {
|
|
|
9363
9379
|
for (const file of inventory) {
|
|
9364
9380
|
const tableEntry = fileTable.get(`${DESKTOP_GRAPH_ROOT}/${expected.name}/${file}`);
|
|
9365
9381
|
if (tableEntry === void 0) return false;
|
|
9366
|
-
if (tableEntry !== createHash("sha256").update(
|
|
9382
|
+
if (tableEntry !== createHash("sha256").update(memoizedAsarFile(session, realArchive, index$1, [...parts, ...file.split("/")].join("/"))).digest("hex")) return false;
|
|
9367
9383
|
}
|
|
9368
9384
|
for (const file of Object.keys(expected.modules ?? {})) {
|
|
9369
|
-
const actual = createHash("sha256").update(
|
|
9385
|
+
const actual = createHash("sha256").update(memoizedAsarFile(session, realArchive, index$1, [...parts, ...file.split("/")].join("/"))).digest("hex");
|
|
9370
9386
|
if (expected.modules[file] === actual) continue;
|
|
9371
9387
|
if (file === "package.json") continue;
|
|
9372
9388
|
return false;
|
|
@@ -9421,12 +9437,12 @@ const DESKTOP_IDENTITY_FACTS = {
|
|
|
9421
9437
|
* installed-byte audit separately refuses nested critical duplicates, so a
|
|
9422
9438
|
* nested-only dependency can never be silently resolved here).
|
|
9423
9439
|
*/
|
|
9424
|
-
function readDesktopDependency(appAsarPath, name) {
|
|
9440
|
+
function readDesktopDependency(appAsarPath, name, session) {
|
|
9425
9441
|
const realArchive = realpathSync$2(appAsarPath);
|
|
9426
|
-
const index$1 =
|
|
9442
|
+
const index$1 = memoizedAsarIndex(session, realArchive);
|
|
9427
9443
|
const manifestPath = `${DESKTOP_GRAPH_ROOT}/${name}/package.json`;
|
|
9428
9444
|
if (!asarNode(index$1, manifestPath.split("/"))) throw new HostProfileError("host_contract_probe_dependency_unbound", `dependency ${name} has no top-level manifest in the app graph`);
|
|
9429
|
-
const bytes$1 =
|
|
9445
|
+
const bytes$1 = memoizedAsarFile(session, realArchive, index$1, manifestPath);
|
|
9430
9446
|
const manifest = JSON.parse(bytes$1.toString("utf8"));
|
|
9431
9447
|
if (manifest.name !== name || typeof manifest.version !== "string" || !parseHostVersion(manifest.version)) throw new HostProfileError("host_contract_probe_dependency_unbound", `dependency ${name} has an invalid manifest identity`);
|
|
9432
9448
|
return {
|
|
@@ -9598,7 +9614,7 @@ function desktopDependencyGraph(archive, expectations, base = createHostAuditSes
|
|
|
9598
9614
|
|
|
9599
9615
|
//#endregion
|
|
9600
9616
|
//#region src/domain/host-resolver.ts
|
|
9601
|
-
const { existsSync: existsSync$1, lstatSync: lstatSync$1, readFileSync: readFileSync$1, realpathSync: realpathSync$1, renameSync, statSync: statSync$1, writeFileSync: writeFileSync$1 } = physicalFs;
|
|
9617
|
+
const { existsSync: existsSync$1, lstatSync: lstatSync$1, readFileSync: readFileSync$1, realpathSync: realpathSync$1, renameSync: renameSync$1, statSync: statSync$1, writeFileSync: writeFileSync$1 } = physicalFs;
|
|
9602
9618
|
/**
|
|
9603
9619
|
* Names registered in any cohort; rows outside the union are unknown.
|
|
9604
9620
|
*
|
|
@@ -10230,9 +10246,7 @@ function resolveActiveProfileHostLock(runtimeRoot, profileRoot, expectedPluginVe
|
|
|
10230
10246
|
if (!dependencies || typeof dependencies !== "object" || typeof dependencies["dsh-completion-guard"] !== "string" || !Array.isArray(bundles) || !bundles.includes("dsh-completion-guard")) throw new HostProfileError("profile_plugin_unbound", "profile does not bind the dsh-completion-guard dependency and bundle");
|
|
10231
10247
|
if (installedPlugin.name !== "dsh-completion-guard" || installedPlugin.version !== expectedPluginVersion) throw new HostProfileError("profile_plugin_version_mismatch", "installed profile plugin identity does not match the generator version");
|
|
10232
10248
|
const bundleList = Array.isArray(bundles) ? bundles.map(String) : [];
|
|
10233
|
-
const
|
|
10234
|
-
if (isDesktopProfile && (bundleList.includes("@deepseek-ai/dsh-headless") || bundleList.includes("dshmarket"))) throw new HostProfileError("desktop_profile_bundle_conflict", "the desktop profile carries a web/headless-only bundle");
|
|
10235
|
-
const profileKind = isDesktopProfile ? "desktop" : bundleList.includes("@deepseek-ai/dsh-headless") ? "headless" : bundleList.includes("@deepseek-ai/dsh-web-app") || bundleList.includes("dshmarket") ? "web" : "headless";
|
|
10249
|
+
const profileKind = profileManifest.name === DESKTOP_PROFILE_PACKAGE_NAME ? "desktop" : bundleList.includes("@deepseek-ai/dsh-headless") ? "headless" : bundleList.includes("@deepseek-ai/dsh-web-app") || bundleList.includes("dshmarket") ? "web" : "headless";
|
|
10236
10250
|
const platform = process.platform === "win32" ? "windows" : "posix";
|
|
10237
10251
|
const evaluation = evaluateActiveHostLock(runtime, profile, {
|
|
10238
10252
|
platform,
|
|
@@ -10326,7 +10340,7 @@ function verifyDesktopPluginIdentity(profileRoot, expectedPluginVersion) {
|
|
|
10326
10340
|
const settings = dsh.profile && typeof dsh.profile === "object" ? dsh.profile : {};
|
|
10327
10341
|
const bundles = Array.isArray(settings.bundles) ? settings.bundles : [];
|
|
10328
10342
|
const dependencies = profile.dependencies && typeof profile.dependencies === "object" ? profile.dependencies : {};
|
|
10329
|
-
if (profile.name !== DESKTOP_PROFILE_PACKAGE_NAME || typeof dependencies["dsh-completion-guard"] !== "string" || !bundles.includes("dsh-completion-guard") || !bundles.includes("@deepseek-ai/dsh-base") || !bundles.includes("@deepseek-ai/dsh-web-app") || bundles.includes("@deepseek-ai/dsh-headless")
|
|
10343
|
+
if (profile.name !== DESKTOP_PROFILE_PACKAGE_NAME || typeof dependencies["dsh-completion-guard"] !== "string" || !bundles.includes("dsh-completion-guard") || !bundles.includes("@deepseek-ai/dsh-base") || !bundles.includes("@deepseek-ai/dsh-web-app") || bundles.includes("@deepseek-ai/dsh-headless")) throw new HostProfileError("profile_plugin_unbound", "the desktop profile does not bind the installed plugin and official bundles");
|
|
10330
10344
|
const pluginManifestPath = join(profileRoot, "node_modules", "dsh-completion-guard", "package.json");
|
|
10331
10345
|
if (!existsSync$1(pluginManifestPath)) throw new HostProfileError("profile_plugin_unbound", "the desktop profile importer does not carry the dsh-completion-guard plugin");
|
|
10332
10346
|
const installedPlugin = readJsonObject(pluginManifestPath, "installed_plugin_invalid");
|
|
@@ -10337,8 +10351,8 @@ function verifyDesktopPluginIdentity(profileRoot, expectedPluginVersion) {
|
|
|
10337
10351
|
* fresh runtime revalidation, so both compute the same digest. */
|
|
10338
10352
|
function reevaluateDesktopCoreLock(appAsarPath, profileRoot, trust) {
|
|
10339
10353
|
const profile = resolve(profileRoot);
|
|
10340
|
-
const runtime = readDesktopAppRuntime(appAsarPath);
|
|
10341
10354
|
const session = createHostAuditSession();
|
|
10355
|
+
const runtime = readDesktopAppRuntime(appAsarPath, session);
|
|
10342
10356
|
const executable = verifyDesktopCarrier(runtime.asarRealpath, runtime.headerSha256);
|
|
10343
10357
|
const pluginManifestPath = join(profile, "node_modules", "dsh-completion-guard", "package.json");
|
|
10344
10358
|
const installedPlugin = session.readJson(pluginManifestPath);
|
|
@@ -10352,7 +10366,7 @@ function reevaluateDesktopCoreLock(appAsarPath, profileRoot, trust) {
|
|
|
10352
10366
|
}, trust ? JSON.stringify(trust) : void 0, profile);
|
|
10353
10367
|
if (evaluation.status !== "supported") return evaluation;
|
|
10354
10368
|
const expectations = trust ? [...trust.packages, ...trust.probeDependencies ?? []] : packages$1;
|
|
10355
|
-
if (!auditDesktopInstalledImplementation(runtime.asarRealpath, expectations)) return {
|
|
10369
|
+
if (!auditDesktopInstalledImplementation(runtime.asarRealpath, expectations, session)) return {
|
|
10356
10370
|
...evaluation,
|
|
10357
10371
|
status: "unsupported",
|
|
10358
10372
|
goalAvailable: false,
|
|
@@ -10538,7 +10552,7 @@ function injectActiveProfileHostLock(input) {
|
|
|
10538
10552
|
encoding: "utf8",
|
|
10539
10553
|
flag: "wx"
|
|
10540
10554
|
});
|
|
10541
|
-
renameSync(temporary, patchPath);
|
|
10555
|
+
renameSync$1(temporary, patchPath);
|
|
10542
10556
|
return patchPath;
|
|
10543
10557
|
}
|
|
10544
10558
|
function parseYamlScalar(value) {
|
|
@@ -10731,6 +10745,76 @@ function sanitizeUrl(value) {
|
|
|
10731
10745
|
return cut === Infinity ? value : value.slice(0, cut);
|
|
10732
10746
|
}
|
|
10733
10747
|
|
|
10748
|
+
//#endregion
|
|
10749
|
+
//#region src/domain/parse-cache.ts
|
|
10750
|
+
/** Pure parser storage only. Never store projections, evidence or authority. */
|
|
10751
|
+
var ParseCache = class {
|
|
10752
|
+
probation = /* @__PURE__ */ new Map();
|
|
10753
|
+
protected = /* @__PURE__ */ new Map();
|
|
10754
|
+
bytes = 0;
|
|
10755
|
+
protectedBytes = 0;
|
|
10756
|
+
constructor(byteBudget, entryBudget = 32768) {
|
|
10757
|
+
this.byteBudget = byteBudget;
|
|
10758
|
+
this.entryBudget = entryBudget;
|
|
10759
|
+
}
|
|
10760
|
+
get(key) {
|
|
10761
|
+
const hot = this.protected.get(key);
|
|
10762
|
+
if (hot) {
|
|
10763
|
+
this.protected.delete(key);
|
|
10764
|
+
this.protected.set(key, hot);
|
|
10765
|
+
return hot.value;
|
|
10766
|
+
}
|
|
10767
|
+
const entry = this.probation.get(key);
|
|
10768
|
+
if (!entry) return void 0;
|
|
10769
|
+
this.probation.delete(key);
|
|
10770
|
+
this.protected.set(key, entry);
|
|
10771
|
+
this.protectedBytes += entry.bytes;
|
|
10772
|
+
while (this.protectedBytes > this.byteBudget * .75) {
|
|
10773
|
+
const oldest = this.protected.keys().next().value;
|
|
10774
|
+
const row$3 = this.protected.get(oldest);
|
|
10775
|
+
this.protected.delete(oldest);
|
|
10776
|
+
this.protectedBytes -= row$3.bytes;
|
|
10777
|
+
this.probation.set(oldest, row$3);
|
|
10778
|
+
}
|
|
10779
|
+
return entry.value;
|
|
10780
|
+
}
|
|
10781
|
+
set(key, value, valueBytes) {
|
|
10782
|
+
const bytes$1 = key.length * 2 + valueBytes + 128;
|
|
10783
|
+
if (bytes$1 > this.byteBudget) return;
|
|
10784
|
+
const cold = this.probation.get(key), hot = this.protected.get(key);
|
|
10785
|
+
if (cold) {
|
|
10786
|
+
this.bytes -= cold.bytes;
|
|
10787
|
+
this.probation.delete(key);
|
|
10788
|
+
}
|
|
10789
|
+
if (hot) {
|
|
10790
|
+
this.bytes -= hot.bytes;
|
|
10791
|
+
this.protectedBytes -= hot.bytes;
|
|
10792
|
+
this.protected.delete(key);
|
|
10793
|
+
}
|
|
10794
|
+
while (this.bytes + bytes$1 > this.byteBudget || this.probation.size + this.protected.size >= this.entryBudget) {
|
|
10795
|
+
const segment = this.probation.size ? this.probation : this.protected;
|
|
10796
|
+
const oldest = segment.keys().next().value;
|
|
10797
|
+
if (oldest === void 0) break;
|
|
10798
|
+
const row$3 = segment.get(oldest);
|
|
10799
|
+
this.bytes -= row$3.bytes;
|
|
10800
|
+
if (segment === this.protected) this.protectedBytes -= row$3.bytes;
|
|
10801
|
+
segment.delete(oldest);
|
|
10802
|
+
}
|
|
10803
|
+
this.probation.set(key, {
|
|
10804
|
+
value,
|
|
10805
|
+
bytes: bytes$1
|
|
10806
|
+
});
|
|
10807
|
+
this.bytes += bytes$1;
|
|
10808
|
+
}
|
|
10809
|
+
/** Deterministic storage diagnostics, without exposing keys or parsed text. */
|
|
10810
|
+
storage() {
|
|
10811
|
+
return {
|
|
10812
|
+
entries: this.probation.size + this.protected.size,
|
|
10813
|
+
bytes: this.bytes
|
|
10814
|
+
};
|
|
10815
|
+
}
|
|
10816
|
+
};
|
|
10817
|
+
|
|
10734
10818
|
//#endregion
|
|
10735
10819
|
//#region src/domain/manifest.ts
|
|
10736
10820
|
const COMMAND_SURFACE_MANIFEST = {
|
|
@@ -10923,14 +11007,12 @@ function kindOfScope(directive, body = "") {
|
|
|
10923
11007
|
* Backticks are Markdown emphasis, but they are also how a log line or a
|
|
10924
11008
|
* command is quoted — and a quoted command is data, never an order.
|
|
10925
11009
|
*/
|
|
10926
|
-
const MASK_CACHE =
|
|
10927
|
-
const MASK_CACHE_LIMIT = 64;
|
|
11010
|
+
const MASK_CACHE = new ParseCache(4 * 1024 * 1024);
|
|
10928
11011
|
function maskCodeSpans(text) {
|
|
10929
11012
|
const cached = MASK_CACHE.get(text);
|
|
10930
11013
|
if (cached !== void 0) return cached;
|
|
10931
11014
|
const masked = computeMaskedSpans(text);
|
|
10932
|
-
|
|
10933
|
-
MASK_CACHE.set(text, masked);
|
|
11015
|
+
MASK_CACHE.set(text, masked, masked.length * 2);
|
|
10934
11016
|
return masked;
|
|
10935
11017
|
}
|
|
10936
11018
|
function computeMaskedSpans(text) {
|
|
@@ -11334,9 +11416,21 @@ function quotedSpans(text) {
|
|
|
11334
11416
|
inside
|
|
11335
11417
|
};
|
|
11336
11418
|
}
|
|
11337
|
-
/**
|
|
11419
|
+
/**
|
|
11420
|
+
* CG-083-PERF02 (profile-guided): maskQuotedSpans is a pure function of the
|
|
11421
|
+
* text and capture re-asks it many times per clause on long histories
|
|
11422
|
+
* (segmentsForBoundary, captureItem, the observer-method scan all mask the
|
|
11423
|
+
* same strings). Memoize by exact input in a bounded map — a pure parse cache
|
|
11424
|
+
* over immutable strings, not a trust cache; any change of text produces a
|
|
11425
|
+
* different key.
|
|
11426
|
+
*/
|
|
11427
|
+
const quotedMaskCache = new ParseCache(4 * 1024 * 1024);
|
|
11338
11428
|
function maskQuotedSpans(text) {
|
|
11339
|
-
|
|
11429
|
+
const cached = quotedMaskCache.get(text);
|
|
11430
|
+
if (cached !== void 0) return cached;
|
|
11431
|
+
const masked = quotedSpans(text).masked;
|
|
11432
|
+
quotedMaskCache.set(text, masked, masked.length * 2);
|
|
11433
|
+
return masked;
|
|
11340
11434
|
}
|
|
11341
11435
|
/** Whether the offset lies inside a quoted span. */
|
|
11342
11436
|
function insideQuote(masked, index$1) {
|
|
@@ -12457,7 +12551,10 @@ function negatedSpanEnd(text, start) {
|
|
|
12457
12551
|
const character = text[cursor];
|
|
12458
12552
|
if (character === "\n" || character === "\r") return cursor;
|
|
12459
12553
|
if (character === "。" || character === "!" || character === "?" || character === "!" || character === "?") return cursor;
|
|
12460
|
-
if (character === "."
|
|
12554
|
+
if (character === ".") {
|
|
12555
|
+
if (cursor + 1 >= text.length || /\s/.test(text[cursor + 1])) return cursor;
|
|
12556
|
+
continue;
|
|
12557
|
+
}
|
|
12461
12558
|
if (character === "但" && text[cursor + 1] !== "是") return cursor;
|
|
12462
12559
|
if (character === "而" && text[cursor + 1] === "是") return cursor;
|
|
12463
12560
|
if (character === ";" || character === ";") return cursor;
|
|
@@ -14266,7 +14363,35 @@ function extractArtifactPaths(text) {
|
|
|
14266
14363
|
}
|
|
14267
14364
|
return [...found];
|
|
14268
14365
|
}
|
|
14269
|
-
|
|
14366
|
+
const clauseSegmentCache = new ParseCache(8 * 1024 * 1024);
|
|
14367
|
+
function copySegments(segments) {
|
|
14368
|
+
return segments.map((segment) => ({
|
|
14369
|
+
...segment,
|
|
14370
|
+
paths: [...segment.paths],
|
|
14371
|
+
interpretation: {
|
|
14372
|
+
...segment.interpretation,
|
|
14373
|
+
qualification: { ...segment.interpretation.qualification }
|
|
14374
|
+
}
|
|
14375
|
+
}));
|
|
14376
|
+
}
|
|
14377
|
+
/**
|
|
14378
|
+
* CG-083-PERF02 (profile-guided): segmentClauses is a pure parse of the text,
|
|
14379
|
+
* and the v6 capture path asks the SAME strings many times (splitIndependent
|
|
14380
|
+
* re-parses left/right fragments per delimiter, the coordination and
|
|
14381
|
+
* explanation paths re-parse prefixes). Cache the parse result by exact input
|
|
14382
|
+
* and omitted options — a pure parse cache over immutable strings, not a
|
|
14383
|
+
* trust cache. Every explicit options object bypasses storage, including empty,
|
|
14384
|
+
* inherited and accessor-bearing objects; no enumeration can prove identity.
|
|
14385
|
+
*/
|
|
14386
|
+
function segmentClauses(text, options) {
|
|
14387
|
+
if (options !== void 0) return copySegments(segmentClausesUncached(text, options));
|
|
14388
|
+
const cached = clauseSegmentCache.get(text);
|
|
14389
|
+
if (cached !== void 0) return copySegments(cached);
|
|
14390
|
+
const segments = segmentClausesUncached(text);
|
|
14391
|
+
clauseSegmentCache.set(text, copySegments(segments), JSON.stringify(segments).length * 2);
|
|
14392
|
+
return copySegments(segments);
|
|
14393
|
+
}
|
|
14394
|
+
function segmentClausesUncached(text, options = {}) {
|
|
14270
14395
|
const normalized = normalizeClause(text);
|
|
14271
14396
|
if (!normalized) return [];
|
|
14272
14397
|
return interpretMessage(normalized, options).filter((interpretation) => interpretation.text.trim().length > 0).map((interpretation) => ({
|
|
@@ -15167,6 +15292,92 @@ function capabilityRemedyPhrase(remedy) {
|
|
|
15167
15292
|
}
|
|
15168
15293
|
}
|
|
15169
15294
|
|
|
15295
|
+
//#endregion
|
|
15296
|
+
//#region src/domain/item-fold-index.ts
|
|
15297
|
+
const itemFoldIndexes = /* @__PURE__ */ new WeakMap();
|
|
15298
|
+
const KIND_PREFIXES = {
|
|
15299
|
+
requirement: "R",
|
|
15300
|
+
acceptance: "A",
|
|
15301
|
+
prohibition: "P"
|
|
15302
|
+
};
|
|
15303
|
+
function indexesEnabled() {
|
|
15304
|
+
return process.env.DSH_GUARD_DISABLE_INDEXES !== "1";
|
|
15305
|
+
}
|
|
15306
|
+
function foldIndexOf(items) {
|
|
15307
|
+
let index$1 = itemFoldIndexes.get(items);
|
|
15308
|
+
if (!index$1) {
|
|
15309
|
+
index$1 = {
|
|
15310
|
+
idCounters: /* @__PURE__ */ new Map(),
|
|
15311
|
+
prefixCounters: /* @__PURE__ */ new Map(),
|
|
15312
|
+
duplicates: /* @__PURE__ */ new Map()
|
|
15313
|
+
};
|
|
15314
|
+
itemFoldIndexes.set(items, index$1);
|
|
15315
|
+
}
|
|
15316
|
+
return index$1;
|
|
15317
|
+
}
|
|
15318
|
+
/** Register one insertion into the item map. Cheap and idempotent per id. */
|
|
15319
|
+
function registerFoldItem(items, item) {
|
|
15320
|
+
if (!indexesEnabled()) return;
|
|
15321
|
+
const index$1 = foldIndexOf(items);
|
|
15322
|
+
const kindMax = index$1.idCounters.get(item.kind);
|
|
15323
|
+
const kindNum = Number(item.id.slice(KIND_PREFIXES[item.kind].length));
|
|
15324
|
+
if (Number.isInteger(kindNum) && (kindMax === void 0 || kindNum > kindMax)) index$1.idCounters.set(item.kind, kindNum);
|
|
15325
|
+
for (const prefix of Object.values(KIND_PREFIXES)) {
|
|
15326
|
+
if (!item.id.startsWith(prefix)) continue;
|
|
15327
|
+
const num = Number(item.id.slice(prefix.length));
|
|
15328
|
+
const max = index$1.prefixCounters.get(prefix);
|
|
15329
|
+
if (Number.isInteger(num) && (max === void 0 || num > max)) index$1.prefixCounters.set(prefix, num);
|
|
15330
|
+
}
|
|
15331
|
+
const key = `${item.kind}\0${item.textSha256}\0${item.verification.subject}`;
|
|
15332
|
+
const bucket = index$1.duplicates.get(key);
|
|
15333
|
+
if (bucket) bucket.push(item.id);
|
|
15334
|
+
else index$1.duplicates.set(key, [item.id]);
|
|
15335
|
+
}
|
|
15336
|
+
/** nextId, with the same result as the historical full scan. */
|
|
15337
|
+
function nextIdFromIndex(items, kind) {
|
|
15338
|
+
if (!indexesEnabled()) return void 0;
|
|
15339
|
+
const index$1 = foldIndexOf(items);
|
|
15340
|
+
const max = index$1.idCounters.get(kind);
|
|
15341
|
+
if (max === void 0) {
|
|
15342
|
+
let seeded = 0;
|
|
15343
|
+
for (const item of items.values()) {
|
|
15344
|
+
if (item.kind !== kind) continue;
|
|
15345
|
+
const num = Number(item.id.slice(KIND_PREFIXES[kind].length));
|
|
15346
|
+
if (Number.isInteger(num) && num > seeded) seeded = num;
|
|
15347
|
+
}
|
|
15348
|
+
index$1.idCounters.set(kind, seeded);
|
|
15349
|
+
return `${KIND_PREFIXES[kind]}${String(seeded + 1).padStart(3, "0")}`;
|
|
15350
|
+
}
|
|
15351
|
+
return `${KIND_PREFIXES[kind]}${String(max + 1).padStart(3, "0")}`;
|
|
15352
|
+
}
|
|
15353
|
+
/** nextNumericId (literal prefix scan over all kinds), same result. */
|
|
15354
|
+
function nextNumericIdFromIndex(items, prefix) {
|
|
15355
|
+
if (!indexesEnabled()) return void 0;
|
|
15356
|
+
const index$1 = foldIndexOf(items);
|
|
15357
|
+
const max = index$1.prefixCounters.get(prefix);
|
|
15358
|
+
if (max === void 0) {
|
|
15359
|
+
let seeded = 0;
|
|
15360
|
+
for (const item of items.values()) {
|
|
15361
|
+
if (!item.id.startsWith(prefix)) continue;
|
|
15362
|
+
const num = Number(item.id.slice(prefix.length));
|
|
15363
|
+
if (Number.isInteger(num) && num > seeded) seeded = num;
|
|
15364
|
+
}
|
|
15365
|
+
index$1.prefixCounters.set(prefix, seeded);
|
|
15366
|
+
return seeded + 1;
|
|
15367
|
+
}
|
|
15368
|
+
return max + 1;
|
|
15369
|
+
}
|
|
15370
|
+
/** The pending duplicate the historical scan would have found, if any. */
|
|
15371
|
+
function findPendingDuplicateFromIndex(items, kind, textSha256, subject) {
|
|
15372
|
+
if (!indexesEnabled()) return void 0;
|
|
15373
|
+
const bucket = foldIndexOf(items).duplicates.get(`${kind}\0${textSha256}\0${subject}`);
|
|
15374
|
+
if (!bucket) return void 0;
|
|
15375
|
+
for (const id of bucket) {
|
|
15376
|
+
const existing = items.get(id);
|
|
15377
|
+
if (existing && existing.status === "pending" && existing.textSha256 === textSha256 && existing.verification.subject === subject) return existing;
|
|
15378
|
+
}
|
|
15379
|
+
}
|
|
15380
|
+
|
|
15170
15381
|
//#endregion
|
|
15171
15382
|
//#region src/domain/confirm-parse.ts
|
|
15172
15383
|
const CONFIRM_LINE_PATTERN = /^确认重绑定 (RB-[a-f0-9]{24})$/;
|
|
@@ -15700,7 +15911,10 @@ function confirmRebind(p, proposalId, eventId, durable) {
|
|
|
15700
15911
|
proposal.status = "stale";
|
|
15701
15912
|
return true;
|
|
15702
15913
|
}
|
|
15703
|
-
for (const item of replacements)
|
|
15914
|
+
for (const item of replacements) {
|
|
15915
|
+
p.items.set(item.id, item);
|
|
15916
|
+
registerFoldItem(p.items, item);
|
|
15917
|
+
}
|
|
15704
15918
|
old.status = "superseded";
|
|
15705
15919
|
old.supersededByItems = replacements.map((item) => item.id);
|
|
15706
15920
|
old.supersededBy = replacements[0].id;
|
|
@@ -17580,6 +17794,13 @@ function verifiedCore(projection) {
|
|
|
17580
17794
|
currentActions: core.current_actions
|
|
17581
17795
|
} };
|
|
17582
17796
|
}
|
|
17797
|
+
/** Read-only core diagnostics for signing feedback; adoption never becomes
|
|
17798
|
+
* ordinary completion. This grants no certificate or execution authority. */
|
|
17799
|
+
function confirmedV6CoreDiagnostic(projection) {
|
|
17800
|
+
if (projection.boundaryProtocol !== 6 || projection.hostStatus !== "supported" || needsReviewObligations(projection).length) return void 0;
|
|
17801
|
+
const verified = verifiedCore(projection);
|
|
17802
|
+
return "reason" in verified ? void 0 : verified.core;
|
|
17803
|
+
}
|
|
17583
17804
|
/**
|
|
17584
17805
|
* The core's condition-release map, but ONLY from a core object that passed
|
|
17585
17806
|
* the full verification chain above. A corrupt, unconfirmed or unsourceable
|
|
@@ -18767,9 +18988,28 @@ function tuplesEqual(left, right) {
|
|
|
18767
18988
|
function transitionsEqual(left, right) {
|
|
18768
18989
|
return stable$1(left) === stable$1(right);
|
|
18769
18990
|
}
|
|
18991
|
+
/** Canonical digest rules remain strict; untrusted parameters become rejection,
|
|
18992
|
+
* never an exception escaping the live tool or persisted replay. */
|
|
18993
|
+
function checkedPredParamsDigest(parameters) {
|
|
18994
|
+
try {
|
|
18995
|
+
return predParamsDigest(parameters, resolveAllowlist("product"));
|
|
18996
|
+
} catch (error) {
|
|
18997
|
+
if (error instanceof DigestError) return void 0;
|
|
18998
|
+
throw error;
|
|
18999
|
+
}
|
|
19000
|
+
}
|
|
19001
|
+
function bindingParametersProblem(binding) {
|
|
19002
|
+
const parameters = binding.expectedTransition?.parameters;
|
|
19003
|
+
if (parameters !== void 0 && checkedPredParamsDigest(parameters) === void 0) return {
|
|
19004
|
+
itemId: binding.itemId,
|
|
19005
|
+
reasonCode: "expected_transition_parameters_invalid",
|
|
19006
|
+
reason: "predicate parameters violate the frozen key/type/size rules; use the supplied expected_transition parameters unchanged"
|
|
19007
|
+
};
|
|
19008
|
+
}
|
|
18770
19009
|
function transitionIsSelfConsistent(action, transition) {
|
|
18771
19010
|
if (!transition?.parameters || transition.predicateId !== ACTION_MANIFEST.actions[action].predicateId || transition.version !== 1 || transition.predParamsKind !== "inline") return false;
|
|
18772
|
-
const recomputed =
|
|
19011
|
+
const recomputed = checkedPredParamsDigest(transition.parameters);
|
|
19012
|
+
if (recomputed === void 0) return false;
|
|
18773
19013
|
return transition.parametersDigest === void 0 || transition.parametersDigest === recomputed;
|
|
18774
19014
|
}
|
|
18775
19015
|
function evidenceFact(evidence) {
|
|
@@ -18889,7 +19129,8 @@ function expectedTransitionMatches(action, transition, resolved, observed) {
|
|
|
18889
19129
|
const expectedPredicate = ACTION_MANIFEST.actions[action].predicateId;
|
|
18890
19130
|
if (transition.predicateId !== expectedPredicate || transition.version !== 1 || transition.predParamsKind !== "inline" || !transition.parameters) return false;
|
|
18891
19131
|
const params = transition.parameters;
|
|
18892
|
-
const recomputed =
|
|
19132
|
+
const recomputed = checkedPredParamsDigest(params);
|
|
19133
|
+
if (recomputed === void 0) return false;
|
|
18893
19134
|
if (transition.parametersDigest && transition.parametersDigest !== recomputed) return false;
|
|
18894
19135
|
switch (action) {
|
|
18895
19136
|
case "install":
|
|
@@ -18913,7 +19154,8 @@ function expectedTransitionMatches(action, transition, resolved, observed) {
|
|
|
18913
19154
|
function nonStatefulTransitionMatches(action, transition, resolved, observed) {
|
|
18914
19155
|
if (transition.predicateId !== ACTION_MANIFEST.actions[action].predicateId || transition.version !== 1 || transition.predParamsKind !== "inline" || !transition.parameters) return false;
|
|
18915
19156
|
const params = transition.parameters;
|
|
18916
|
-
const recomputed =
|
|
19157
|
+
const recomputed = checkedPredParamsDigest(params);
|
|
19158
|
+
if (recomputed === void 0) return false;
|
|
18917
19159
|
if (transition.parametersDigest && transition.parametersDigest !== recomputed) return false;
|
|
18918
19160
|
if (action === "inspect_remote_updates") return ["remote", "version"].every((key) => stable$1(params[key]) === stable$1(resolved[key])) && stable$1(params.upstream_oid) === stable$1(observed.upstream_oid);
|
|
18919
19161
|
return stable$1(params) === stable$1({
|
|
@@ -19296,7 +19538,7 @@ function simpleRecord(projection, item, binding) {
|
|
|
19296
19538
|
/** Preview one evidence binding through the same per-item acceptance checks as
|
|
19297
19539
|
* certificate construction. This does not decide whole-contract closure. */
|
|
19298
19540
|
function bindingIndividuallyAccepted(projection, item, binding) {
|
|
19299
|
-
if (item.status === "superseded" || item.targetCaptureStatus === "clarification_required" || binding.semanticAction !== item.semanticAction || !tuplesEqual(binding.requestedTarget, item.requestedTarget) || evidenceProblem(projection, item, binding) || projection.policy === "strict" && strictProofProblem(projection, item, binding)) return false;
|
|
19541
|
+
if (bindingParametersProblem(binding) || item.status === "superseded" || item.targetCaptureStatus === "clarification_required" || binding.semanticAction !== item.semanticAction || !tuplesEqual(binding.requestedTarget, item.requestedTarget) || evidenceProblem(projection, item, binding) || projection.policy === "strict" && strictProofProblem(projection, item, binding)) return false;
|
|
19300
19542
|
const built = isStatefulAction(item.semanticAction ?? "generic_run") ? binding.resolutionEvidenceId ? richStatefulRecord(projection, item, binding) : item.semanticAction === "commit" || item.semanticAction === "push" ? nativeGitRecord(projection, item, binding) : nativeFileRecord(projection, item, binding) : simpleRecord(projection, item, binding);
|
|
19301
19543
|
return built.record !== void 0 && built.rejected === void 0;
|
|
19302
19544
|
}
|
|
@@ -19307,21 +19549,17 @@ function certifyCheckpoint(projection, bindings, id, commit = true) {
|
|
|
19307
19549
|
openItems: certifiableOpenItems(projection).map((item) => item.id),
|
|
19308
19550
|
rejectedBindings: []
|
|
19309
19551
|
};
|
|
19310
|
-
|
|
19311
|
-
status: "incomplete",
|
|
19312
|
-
contractRevision: projection.contractRevision,
|
|
19313
|
-
openItems: certifiableOpenItems(projection).map((item) => item.id),
|
|
19314
|
-
rejectedBindings: [{
|
|
19315
|
-
itemId: "*",
|
|
19316
|
-
reason: "the current shared-core closure is not verified complete",
|
|
19317
|
-
reasonCode: "current_closure_unmet"
|
|
19318
|
-
}]
|
|
19319
|
-
};
|
|
19552
|
+
const coreIncomplete = projection.boundaryProtocol === 6 && projection.durabilityWatermark === "confirmed" && projection.coreV2?.certifiable !== true;
|
|
19320
19553
|
const rejectedBindings = [];
|
|
19321
19554
|
const records = [];
|
|
19322
19555
|
const nativeDigests = [];
|
|
19323
19556
|
const referencedFacts = [];
|
|
19324
19557
|
for (const binding of bindings) {
|
|
19558
|
+
const parameterProblem = bindingParametersProblem(binding);
|
|
19559
|
+
if (parameterProblem) {
|
|
19560
|
+
rejectedBindings.push(parameterProblem);
|
|
19561
|
+
continue;
|
|
19562
|
+
}
|
|
19325
19563
|
const item = projection.items.get(binding.itemId);
|
|
19326
19564
|
if (!item || item.status === "superseded") {
|
|
19327
19565
|
rejectedBindings.push({
|
|
@@ -19382,6 +19620,22 @@ function certifyCheckpoint(projection, bindings, id, commit = true) {
|
|
|
19382
19620
|
});
|
|
19383
19621
|
continue;
|
|
19384
19622
|
}
|
|
19623
|
+
if (binding.semanticAction !== void 0 && binding.semanticAction !== item.semanticAction) {
|
|
19624
|
+
rejectedBindings.push({
|
|
19625
|
+
itemId: item.id,
|
|
19626
|
+
reason: "binding semantic action differs from the captured contract",
|
|
19627
|
+
reasonCode: "semantic_action_mismatch"
|
|
19628
|
+
});
|
|
19629
|
+
continue;
|
|
19630
|
+
}
|
|
19631
|
+
if (binding.requestedTarget !== void 0 && !tuplesEqual(binding.requestedTarget, item.requestedTarget)) {
|
|
19632
|
+
rejectedBindings.push({
|
|
19633
|
+
itemId: item.id,
|
|
19634
|
+
reason: "requested target differs from the captured contract; use the captured requested_target unchanged",
|
|
19635
|
+
reasonCode: "requested_target_mismatch"
|
|
19636
|
+
});
|
|
19637
|
+
continue;
|
|
19638
|
+
}
|
|
19385
19639
|
const problem = evidenceProblem(projection, item, binding);
|
|
19386
19640
|
if (problem) {
|
|
19387
19641
|
rejectedBindings.push(problem);
|
|
@@ -19419,6 +19673,16 @@ function certifyCheckpoint(projection, bindings, id, commit = true) {
|
|
|
19419
19673
|
if ("nativeDigest" in built && typeof built.nativeDigest === "string") nativeDigests.push(built.nativeDigest);
|
|
19420
19674
|
referencedFacts.push(...citedEvidence(projection, binding).map(evidenceFact));
|
|
19421
19675
|
}
|
|
19676
|
+
if (coreIncomplete) return {
|
|
19677
|
+
status: "incomplete",
|
|
19678
|
+
contractRevision: projection.contractRevision,
|
|
19679
|
+
openItems: certifiableOpenItems(projection).map((item) => item.id),
|
|
19680
|
+
rejectedBindings: [...rejectedBindings, {
|
|
19681
|
+
itemId: "*",
|
|
19682
|
+
reason: "the current shared-core closure is not verified complete",
|
|
19683
|
+
reasonCode: "current_closure_unmet"
|
|
19684
|
+
}]
|
|
19685
|
+
};
|
|
19422
19686
|
const unreusable = needsReviewObligations(projection);
|
|
19423
19687
|
if (unreusable.length > 0) return {
|
|
19424
19688
|
status: "incomplete",
|
|
@@ -20397,6 +20661,17 @@ function parseArguments$1(raw) {
|
|
|
20397
20661
|
function asRecord$1(value) {
|
|
20398
20662
|
return typeof value === "object" && value !== null ? value : void 0;
|
|
20399
20663
|
}
|
|
20664
|
+
/**
|
|
20665
|
+
* CG-083-BUG02: the explicit, VERIFIED no-parent state of a repository's
|
|
20666
|
+
* first commit, minted only by the native Git observer after reading the
|
|
20667
|
+
* commit object itself. It is distinct from a missing or unknown parent and
|
|
20668
|
+
* binds into certificates like any other parent identity.
|
|
20669
|
+
*/
|
|
20670
|
+
const NATIVE_GIT_ROOT_PARENT_OID = "root";
|
|
20671
|
+
/** CG-083-BUG02 parent identity accepted for a commit readback. */
|
|
20672
|
+
function nativeGitParentOidVerified(parentOid) {
|
|
20673
|
+
return parentOid === NATIVE_GIT_ROOT_PARENT_OID || typeof parentOid === "string" && /^[0-9a-f]{40,64}$/.test(parentOid);
|
|
20674
|
+
}
|
|
20400
20675
|
function extractTextContent(content) {
|
|
20401
20676
|
const parts = [];
|
|
20402
20677
|
for (const block$1 of content) {
|
|
@@ -20730,6 +21005,31 @@ function shellOutcome(surface, terminal, resultError, backgrounded) {
|
|
|
20730
21005
|
* frozen value is the historical record and this batch must not rewrite it; the
|
|
20731
21006
|
* derived layer records its source and conflict flag instead of changing history.
|
|
20732
21007
|
*/
|
|
21008
|
+
/**
|
|
21009
|
+
* CG-083-BUG03/R4: the ONE terminal verdict a native observer may rely on for
|
|
21010
|
+
* a persisted shell call. Reuses the evidence layer's AUTHORITATIVE terminal
|
|
21011
|
+
* resolution (the run's own `contextGuardProcess` declaration, then any other
|
|
21012
|
+
* structured meta fact, then the audited renderer markers) and cross-checks
|
|
21013
|
+
* it against the rendered markers: a declared failure is never upgraded, and
|
|
21014
|
+
* a declared verdict that CONTRADICTS the rendered markers is unresolvable
|
|
21015
|
+
* and stays `unknown`. A failed hook, a backgrounded or truncated result, or
|
|
21016
|
+
* an unclassifiable terminal state is therefore never "success". This reads
|
|
21017
|
+
* the CURRENT observation only; the historical frozen `outcome` of
|
|
21018
|
+
* already-recorded evidence is not rewritten.
|
|
21019
|
+
*/
|
|
21020
|
+
function shellReadbackOutcome(surface, args, result) {
|
|
21021
|
+
const backgrounded = args.run_in_background === true || /^\[still running after \d+ms; moved to background job [^\]\r\n]+\]$/m.test(result.textContent) || /^started background job \S+\s*$/.test(result.textContent);
|
|
21022
|
+
const outputIncomplete = /\[(?:output truncated;|some output was dropped from memory;)[^\]]*\]/i.test(result.textContent);
|
|
21023
|
+
const declaredFacts = resolveDeclaredTerminalFacts(result.meta, result.textContent).facts;
|
|
21024
|
+
const renderedFacts = extractTerminalFacts(result.textContent);
|
|
21025
|
+
const declared = shellOutcome(surface, declaredFacts, result.error, backgrounded);
|
|
21026
|
+
const rendered = shellOutcome(surface, renderedFacts, result.error, backgrounded);
|
|
21027
|
+
let outcome;
|
|
21028
|
+
if (declared === rendered) outcome = declared;
|
|
21029
|
+
else if (declared === "failure" && rendered === "success" && !renderedFacts.marked) outcome = "failure";
|
|
21030
|
+
else outcome = "unknown";
|
|
21031
|
+
return outputIncomplete && outcome !== "failure" ? "unknown" : outcome;
|
|
21032
|
+
}
|
|
20733
21033
|
function shellProcessFacts(meta, textContent, frozenOutcome, resultError, surface, backgrounded, parseStatus$1) {
|
|
20734
21034
|
const { facts: terminal, source } = resolveDeclaredTerminalFacts(meta, textContent);
|
|
20735
21035
|
const declaredOperations = declaredOperationResults(meta);
|
|
@@ -20875,7 +21175,7 @@ function extractToolSubject(call, result, defaultCwd, hostLock) {
|
|
|
20875
21175
|
const refspec = native?.refspec;
|
|
20876
21176
|
const parentOid = native?.parentOid;
|
|
20877
21177
|
const treeOid = native?.treeOid;
|
|
20878
|
-
if (action === "commit" && (typeof parentOid !== "string" || typeof treeOid !== "string" ||
|
|
21178
|
+
if (action === "commit" && (typeof parentOid !== "string" || typeof treeOid !== "string" || !nativeGitParentOidVerified(parentOid) || !/^[0-9a-f]{40,64}$/.test(treeOid))) return {
|
|
20879
21179
|
capabilities: [],
|
|
20880
21180
|
subjects: [],
|
|
20881
21181
|
surfaces: [],
|
|
@@ -21266,6 +21566,7 @@ function supersedeItem(items, oldId, replacement) {
|
|
|
21266
21566
|
old.status = "superseded";
|
|
21267
21567
|
old.supersededBy = replacement.id;
|
|
21268
21568
|
items.set(replacement.id, replacement);
|
|
21569
|
+
registerFoldItem(items, replacement);
|
|
21269
21570
|
return true;
|
|
21270
21571
|
}
|
|
21271
21572
|
|
|
@@ -21694,6 +21995,7 @@ function supersedeClauseByPartition(projection, item, receipt) {
|
|
|
21694
21995
|
interpretedFromUnresolved: item.id
|
|
21695
21996
|
};
|
|
21696
21997
|
projection.items.set(id, sub);
|
|
21998
|
+
registerFoldItem(projection.items, sub);
|
|
21697
21999
|
projection.contractRevision = Math.max(projection.contractRevision, revision);
|
|
21698
22000
|
return sub;
|
|
21699
22001
|
};
|
|
@@ -21714,6 +22016,8 @@ function supersedeClauseByPartition(projection, item, receipt) {
|
|
|
21714
22016
|
}
|
|
21715
22017
|
/** The next numeric id for a prefix, shared with nextId's numbering. */
|
|
21716
22018
|
function nextNumericId(items, prefix) {
|
|
22019
|
+
const indexed = nextNumericIdFromIndex(items, prefix);
|
|
22020
|
+
if (indexed !== void 0) return indexed;
|
|
21717
22021
|
let max = 0;
|
|
21718
22022
|
for (const item of items.values()) {
|
|
21719
22023
|
if (!item.id.startsWith(prefix)) continue;
|
|
@@ -21937,6 +22241,8 @@ function restoreHistoricalCheckpoint(recorded, bindings, id) {
|
|
|
21937
22241
|
};
|
|
21938
22242
|
}
|
|
21939
22243
|
function nextId(items, kind) {
|
|
22244
|
+
const indexed = nextIdFromIndex(items, kind);
|
|
22245
|
+
if (indexed !== void 0) return indexed;
|
|
21940
22246
|
const prefix = kind === "requirement" ? "R" : kind === "acceptance" ? "A" : "P";
|
|
21941
22247
|
let max = 0;
|
|
21942
22248
|
for (const item of items.values()) {
|
|
@@ -22460,7 +22766,8 @@ function segmentsForBoundary(text, coordinationSplit, v6) {
|
|
|
22460
22766
|
* files or embeds prohibitions.
|
|
22461
22767
|
*/
|
|
22462
22768
|
function insertItems(projection, text, sourceMessageId, scope, authority = "root_instruction", legacy = false, legacyAuthorityProven = false, coordinationSplit = true, unitId, provenance, clarificationText) {
|
|
22463
|
-
const
|
|
22769
|
+
const freshItems = [];
|
|
22770
|
+
const isFresh = /* @__PURE__ */ new Set();
|
|
22464
22771
|
let coveredSpans = 0;
|
|
22465
22772
|
const usedOccurrences = /* @__PURE__ */ new Set();
|
|
22466
22773
|
for (const segment of segmentsForBoundary(text, coordinationSplit, projection.boundaryProtocol === 6 && !legacy)) {
|
|
@@ -22482,6 +22789,26 @@ function insertItems(projection, text, sourceMessageId, scope, authority = "root
|
|
|
22482
22789
|
}
|
|
22483
22790
|
}
|
|
22484
22791
|
if (span) coveredSpans += 1;
|
|
22792
|
+
const frontedTest = segment.interpretation.fingerprint.startsWith("v6-locative:") && /^\s*(?:in|within)\s+.+?[,,]\s*(?:run|execute)\s+(?:npm|pnpm|yarn|bun)\s+test(?:\s|[.!?]|$)/iu.test(segment.body);
|
|
22793
|
+
if (segment.interpretation.fingerprint.startsWith("v6-test:") || frontedTest) {
|
|
22794
|
+
const locationText = (frontedTest ? /^\s*(?:in|within)\s+(.+?)[,,]\s*(?:run|execute)\b/iu.exec(segment.body) : /(?:\b(?:in|within)\s+|(?:^|[,,\s])在\s*)(.+?)\s*$/iu.exec(segment.body))?.[1]?.replace(/[.!?。!?]$/, "").trim().replace(/\s+before\s+finishing$/iu, "").trim();
|
|
22795
|
+
if (locationText && !/^(?:(?:the|this)\s+)?(?:current\s+)?workspace$/iu.test(locationText)) {
|
|
22796
|
+
const raw = locationText;
|
|
22797
|
+
const target = /^(["'`])([^"'`]+)\1$/u.exec(raw)?.[2] ?? (/^[^\s"'`]+$/u.test(raw) ? raw : void 0);
|
|
22798
|
+
const resolved = target && rootLocatorFlavor(target) && !/(?:^|[\\/])package\.json$/iu.test(target);
|
|
22799
|
+
const item = insert(projection, segment, sourceMessageId, resolved ? target : "scope", "scope", unitId, provenance ? {
|
|
22800
|
+
rawTextSha256: provenance.rawTextSha256,
|
|
22801
|
+
span
|
|
22802
|
+
} : void 0, freshItems);
|
|
22803
|
+
if (resolved) item.targetSource = { kind: "explicit_path" };
|
|
22804
|
+
else {
|
|
22805
|
+
delete item.requestedTarget?.scope;
|
|
22806
|
+
item.targetCaptureStatus = "clarification_required";
|
|
22807
|
+
delete item.targetSource;
|
|
22808
|
+
}
|
|
22809
|
+
continue;
|
|
22810
|
+
}
|
|
22811
|
+
}
|
|
22485
22812
|
if (segment.interpretation.fingerprint.startsWith("v6-package-script:")) {
|
|
22486
22813
|
if (/\b(?:in|within)\s+["'`]/iu.test(segment.body)) {
|
|
22487
22814
|
const target = /\b(?:in|within)\s+(["'`])([^"'`]+)\1(?:\s*[.!?])?\s*$/iu.exec(segment.body)?.[2];
|
|
@@ -22489,13 +22816,13 @@ function insertItems(projection, text, sourceMessageId, scope, authority = "root
|
|
|
22489
22816
|
const item = insert(projection, segment, sourceMessageId, target, "scope", unitId, provenance ? {
|
|
22490
22817
|
rawTextSha256: provenance.rawTextSha256,
|
|
22491
22818
|
span
|
|
22492
|
-
} : void 0);
|
|
22819
|
+
} : void 0, freshItems);
|
|
22493
22820
|
item.targetSource = { kind: "explicit_path" };
|
|
22494
22821
|
} else {
|
|
22495
22822
|
const item = insert(projection, segment, sourceMessageId, "scope", "scope", unitId, provenance ? {
|
|
22496
22823
|
rawTextSha256: provenance.rawTextSha256,
|
|
22497
22824
|
span
|
|
22498
|
-
} : void 0);
|
|
22825
|
+
} : void 0, freshItems);
|
|
22499
22826
|
delete item.requestedTarget?.scope;
|
|
22500
22827
|
item.targetCaptureStatus = "clarification_required";
|
|
22501
22828
|
delete item.targetSource;
|
|
@@ -22508,7 +22835,7 @@ function insertItems(projection, text, sourceMessageId, scope, authority = "root
|
|
|
22508
22835
|
insert(projection, segment, sourceMessageId, resolved.replace(/[\\/]package\.json$/iu, "") || resolved, "scope", unitId, provenance ? {
|
|
22509
22836
|
rawTextSha256: provenance.rawTextSha256,
|
|
22510
22837
|
span
|
|
22511
|
-
} : void 0);
|
|
22838
|
+
} : void 0, freshItems);
|
|
22512
22839
|
continue;
|
|
22513
22840
|
}
|
|
22514
22841
|
}
|
|
@@ -22516,16 +22843,17 @@ function insertItems(projection, text, sourceMessageId, scope, authority = "root
|
|
|
22516
22843
|
insert(projection, segment, sourceMessageId, scope.cwd || "scope", "scope", unitId, provenance ? {
|
|
22517
22844
|
rawTextSha256: provenance.rawTextSha256,
|
|
22518
22845
|
span
|
|
22519
|
-
} : void 0);
|
|
22846
|
+
} : void 0, freshItems);
|
|
22520
22847
|
continue;
|
|
22521
22848
|
}
|
|
22522
22849
|
for (const path$1 of segment.paths) insert(projection, segment, sourceMessageId, resolveArtifact(path$1, scope), "artifact", unitId, provenance ? {
|
|
22523
22850
|
rawTextSha256: provenance.rawTextSha256,
|
|
22524
22851
|
span
|
|
22525
|
-
} : void 0);
|
|
22852
|
+
} : void 0, freshItems);
|
|
22526
22853
|
}
|
|
22854
|
+
for (const added of freshItems) isFresh.add(added.id);
|
|
22527
22855
|
if (projection.boundaryProtocol === 6 && !legacy && provenance) {
|
|
22528
|
-
const fresh =
|
|
22856
|
+
const fresh = freshItems.filter((item) => item.sourceMessageId === sourceMessageId && item.rawTextSha256 === provenance.rawTextSha256 && item.spans?.[0]?.partIndex === 0).sort((a, b) => a.spans[0].start - b.spans[0].start);
|
|
22529
22857
|
for (const method of fresh) {
|
|
22530
22858
|
const text$1 = maskQuotedSpans(method.normalizedText).trim();
|
|
22531
22859
|
if (!/^(?:(?:for\s+[^,,]{1,100}[,,]\s*)?(?:use|consult|invoke|call)\b|(?:为|针对|对)[^,,。]{1,80}(?:调用|使用))/iu.test(text$1) || method.kind !== "requirement" || [
|
|
@@ -22551,9 +22879,9 @@ function insertItems(projection, text, sourceMessageId, scope, authority = "root
|
|
|
22551
22879
|
};
|
|
22552
22880
|
}
|
|
22553
22881
|
let parent;
|
|
22882
|
+
const raw = Buffer.from(provenance.rawText, "utf8");
|
|
22554
22883
|
for (const item of fresh) {
|
|
22555
22884
|
const own = item.spans[0];
|
|
22556
|
-
const raw = Buffer.from(provenance.rawText, "utf8");
|
|
22557
22885
|
const clause = raw.subarray(own.start, own.end).toString("utf8");
|
|
22558
22886
|
if (item.semanticAction === "modify" && item.authorityDisposition === "executable_now" && item.requestedTarget?.artifact_id) {
|
|
22559
22887
|
parent = item;
|
|
@@ -22584,8 +22912,8 @@ function insertItems(projection, text, sourceMessageId, scope, authority = "root
|
|
|
22584
22912
|
};
|
|
22585
22913
|
}
|
|
22586
22914
|
}
|
|
22587
|
-
for (const
|
|
22588
|
-
|
|
22915
|
+
for (const item of freshItems) {
|
|
22916
|
+
const id = item.id;
|
|
22589
22917
|
if (item.kind !== "requirement" || item.waitAuthorization || item.authorityDisposition === "conditional_wait") continue;
|
|
22590
22918
|
if (item.authorityDisposition !== void 0 && item.authorityDisposition !== "executable_now") continue;
|
|
22591
22919
|
for (const [otherId, other] of projection.items) {
|
|
@@ -22599,13 +22927,13 @@ function insertItems(projection, text, sourceMessageId, scope, authority = "root
|
|
|
22599
22927
|
break;
|
|
22600
22928
|
}
|
|
22601
22929
|
}
|
|
22602
|
-
if (clarificationText) for (const
|
|
22603
|
-
|
|
22930
|
+
if (clarificationText) for (const item of freshItems) {
|
|
22931
|
+
const id = item.id;
|
|
22604
22932
|
if (item.kind === "prohibition" || item.status !== "pending") continue;
|
|
22605
22933
|
if (item.authorityDisposition !== "executable_now") continue;
|
|
22606
22934
|
if (!item.semanticAction || item.semanticAction === "generic_run") continue;
|
|
22607
22935
|
for (const [otherId, other] of projection.items) {
|
|
22608
|
-
if (otherId === id ||
|
|
22936
|
+
if (otherId === id || isFresh.has(otherId)) continue;
|
|
22609
22937
|
if (other.status !== "pending" || other.kind === "prohibition") continue;
|
|
22610
22938
|
if (other.waitAuthorization || other.legacyFlags?.length) continue;
|
|
22611
22939
|
if (!(other.semanticAction === "generic_run" && (other.authorityDisposition === "executable_now" || other.authorityDisposition === "unresolved"))) continue;
|
|
@@ -22618,27 +22946,24 @@ function insertItems(projection, text, sourceMessageId, scope, authority = "root
|
|
|
22618
22946
|
}
|
|
22619
22947
|
}
|
|
22620
22948
|
for (let round = 0; round < 8; round += 1) {
|
|
22621
|
-
const unresolved =
|
|
22949
|
+
const unresolved = freshItems.filter((item) => item.targetSource?.kind === "environment_default");
|
|
22622
22950
|
if (unresolved.length === 0) break;
|
|
22623
22951
|
let resolvedAny = false;
|
|
22624
|
-
for (const
|
|
22952
|
+
for (const item of unresolved) {
|
|
22625
22953
|
resolveInheritedGitTarget(projection, item);
|
|
22626
22954
|
if (item.targetSource?.kind === "unit_inherited") resolvedAny = true;
|
|
22627
22955
|
}
|
|
22628
22956
|
if (!resolvedAny) break;
|
|
22629
22957
|
}
|
|
22630
|
-
for (const
|
|
22631
|
-
|
|
22632
|
-
|
|
22633
|
-
|
|
22634
|
-
|
|
22635
|
-
|
|
22636
|
-
|
|
22637
|
-
item.semanticAction = "generic_run";
|
|
22638
|
-
item.legacyFlags = ["legacy_generic_run", "legacy_authority_unclassified"];
|
|
22639
|
-
}
|
|
22640
|
-
else item.authority = authority;
|
|
22958
|
+
for (const item of freshItems) if (legacy) if (legacyAuthorityProven && item.semanticAction !== void 0 && item.semanticAction !== "generic_run" && item.targetCaptureStatus === "resolved") {
|
|
22959
|
+
item.authority = authority;
|
|
22960
|
+
item.legacyFlags = void 0;
|
|
22961
|
+
} else {
|
|
22962
|
+
item.authority = "legacy_authority_unclassified";
|
|
22963
|
+
item.semanticAction = "generic_run";
|
|
22964
|
+
item.legacyFlags = ["legacy_generic_run", "legacy_authority_unclassified"];
|
|
22641
22965
|
}
|
|
22966
|
+
else item.authority = authority;
|
|
22642
22967
|
return coveredSpans;
|
|
22643
22968
|
}
|
|
22644
22969
|
/** The 0.6.3 eligibility check identity for a legacy record's own reading. */
|
|
@@ -22672,6 +22997,18 @@ function informationReadingNamesWork(text) {
|
|
|
22672
22997
|
if (scopes.length === 0) return false;
|
|
22673
22998
|
return scopes.some((scope) => scope.authorityDisposition !== "informational");
|
|
22674
22999
|
}
|
|
23000
|
+
/** CG-083-PERF02: the interpretation rule is a pure function of the record's
|
|
23001
|
+
* own bytes; a long history re-asks it per delivery, so memoize by text. */
|
|
23002
|
+
const informationReadingMemo = /* @__PURE__ */ new Map();
|
|
23003
|
+
function informationReadingNamesWorkMemoized(text) {
|
|
23004
|
+
const digest$1 = sha256(text);
|
|
23005
|
+
const cached = informationReadingMemo.get(digest$1);
|
|
23006
|
+
if (cached !== void 0) return cached;
|
|
23007
|
+
const value = informationReadingNamesWork(text);
|
|
23008
|
+
if (informationReadingMemo.size > 512) informationReadingMemo.clear();
|
|
23009
|
+
informationReadingMemo.set(digest$1, value);
|
|
23010
|
+
return value;
|
|
23011
|
+
}
|
|
22675
23012
|
/**
|
|
22676
23013
|
* The pure upgrade-eligibility predicate: the records in the current closure
|
|
22677
23014
|
* scope that may NOT be inherited as a current pass, with the reason that
|
|
@@ -22720,7 +23057,7 @@ function eligibilityReviewReasons(projection) {
|
|
|
22720
23057
|
findings.push([item.id, "unknown_state_version"]);
|
|
22721
23058
|
continue;
|
|
22722
23059
|
}
|
|
22723
|
-
if (informationReading &&
|
|
23060
|
+
if (informationReading && informationReadingNamesWorkMemoized(item.normalizedText)) {
|
|
22724
23061
|
findings.push([item.id, "legacy_mixed_information_scope"]);
|
|
22725
23062
|
continue;
|
|
22726
23063
|
}
|
|
@@ -22858,7 +23195,7 @@ function resolveInheritedGitTarget(projection, item) {
|
|
|
22858
23195
|
item.targetCaptureStatus = "clarification_required";
|
|
22859
23196
|
item.targetCaptureReasonCode = repositories.size > 1 ? "requested_target_repository_ambiguous" : "requested_target_repository_missing";
|
|
22860
23197
|
}
|
|
22861
|
-
function insert(projection, segment, sourceMessageId, subject, surface, unitId, provenance) {
|
|
23198
|
+
function insert(projection, segment, sourceMessageId, subject, surface, unitId, provenance, freshOut) {
|
|
22862
23199
|
const revision = projection.contractRevision + 1;
|
|
22863
23200
|
const id = nextId(projection.items, segment.kind);
|
|
22864
23201
|
const method = extractMethod(segment.body);
|
|
@@ -22940,9 +23277,13 @@ function insert(projection, segment, sourceMessageId, subject, surface, unitId,
|
|
|
22940
23277
|
item.rawTextSha256 = provenance.rawTextSha256;
|
|
22941
23278
|
if (provenance.span) item.spans = [provenance.span];
|
|
22942
23279
|
}
|
|
22943
|
-
const duplicate = [...projection.items.values()].find((existing) => existing.kind === segment.kind && existing.status === "pending" && existing.textSha256 === item.textSha256 && existing.verification.subject === subject);
|
|
23280
|
+
const duplicate = indexesEnabled() ? findPendingDuplicateFromIndex(projection.items, segment.kind, item.textSha256, subject) : [...projection.items.values()].find((existing) => existing.kind === segment.kind && existing.status === "pending" && existing.textSha256 === item.textSha256 && existing.verification.subject === subject);
|
|
22944
23281
|
if (duplicate) supersedeItem(projection.items, duplicate.id, item);
|
|
22945
|
-
else
|
|
23282
|
+
else {
|
|
23283
|
+
projection.items.set(id, item);
|
|
23284
|
+
registerFoldItem(projection.items, item);
|
|
23285
|
+
}
|
|
23286
|
+
freshOut?.push(item);
|
|
22946
23287
|
projection.contractRevision = item.revision;
|
|
22947
23288
|
return item;
|
|
22948
23289
|
}
|
|
@@ -22957,7 +23298,17 @@ function rootLocatorFlavor(cwd) {
|
|
|
22957
23298
|
const posixBase = cwd.startsWith("/") && !cwd.startsWith("//") && !cwd.includes("\\") && !cwd.includes("//") && !cwd.split("/").some((part) => part === "." || part === "..");
|
|
22958
23299
|
return /^[A-Za-z]:\\/.test(cwd) && !cwd.includes("/") && !cwd.slice(3).includes("\\\\") && !cwd.slice(3).includes(":") && !cwd.split("\\").some((part) => part === "." || part === "..") ? "windows" : posixBase ? "posix" : void 0;
|
|
22959
23300
|
}
|
|
22960
|
-
|
|
23301
|
+
/**
|
|
23302
|
+
* CG-083-R5: the seq index is scoped to ONE derive call and built from the
|
|
23303
|
+
* exact array that call consumes. It is never cached across calls: the
|
|
23304
|
+
* exported derive API accepts any event array and its immutability is not a
|
|
23305
|
+
* verified premise, so an array that was appended to between two derives must
|
|
23306
|
+
* resolve its newly added sequences.
|
|
23307
|
+
*/
|
|
23308
|
+
function buildEventsBySeq(sourceEvents) {
|
|
23309
|
+
return new Map(sourceEvents.map((event) => [event.seq, event]));
|
|
23310
|
+
}
|
|
23311
|
+
function refreshRootLocatorContext(projection, bySeq, scope, asOf) {
|
|
22961
23312
|
projection.rootLocatorContexts.clear();
|
|
22962
23313
|
projection.rootLocatorIdentity = void 0;
|
|
22963
23314
|
if (projection.boundaryProtocol !== 6 || !scope.sessionHeader || typeof scope.cwd !== "string") return;
|
|
@@ -22966,8 +23317,8 @@ function refreshRootLocatorContext(projection, sourceEvents, scope, asOf) {
|
|
|
22966
23317
|
const refs = projection.currentUnitId ? projection.units.get(projection.currentUnitId)?.rootInputRefs ?? [] : [];
|
|
22967
23318
|
for (const ref$1 of refs) {
|
|
22968
23319
|
if (ref$1.seq > asOf) continue;
|
|
22969
|
-
const source =
|
|
22970
|
-
if (!source) continue;
|
|
23320
|
+
const source = bySeq.get(ref$1.seq);
|
|
23321
|
+
if (!source || source.type !== "user/message" || asRecord(asRecord(source.data)?.source)?.kind !== "user") continue;
|
|
22971
23322
|
const content = asRecord(source.data)?.content;
|
|
22972
23323
|
const raw = Array.isArray(content) ? content.filter((part) => asRecord(part)?.type === "text").map((part) => String(asRecord(part)?.text ?? "")).join("") : "";
|
|
22973
23324
|
projection.rootLocatorContexts.set(ref$1.seq, {
|
|
@@ -23038,6 +23389,7 @@ function deriveProjection(sourceEvents, config, scope, durableConfirmed, hostLoc
|
|
|
23038
23389
|
const turnUnitIds = /* @__PURE__ */ new Map();
|
|
23039
23390
|
let activeTurn;
|
|
23040
23391
|
const unitSemanticsActive = () => v5BoundarySeq !== void 0 && !scope.sessionHeader?.parentSession && !scope.sessionHeader?.delegationDepth && scope.sessionHeader?.origin !== "subagent";
|
|
23392
|
+
const eventsBySeq = buildEventsBySeq(sourceEvents);
|
|
23041
23393
|
for (const event of sourceEvents) {
|
|
23042
23394
|
projection.enabled = enabled;
|
|
23043
23395
|
projection.lastObservedSourceSeq = Math.max(projection.lastObservedSourceSeq, event.seq);
|
|
@@ -23474,7 +23826,7 @@ function deriveProjection(sourceEvents, config, scope, durableConfirmed, hostLoc
|
|
|
23474
23826
|
break;
|
|
23475
23827
|
}
|
|
23476
23828
|
const id = `C${projection.checkpoints.length + 1}`;
|
|
23477
|
-
refreshRootLocatorContext(projection,
|
|
23829
|
+
refreshRootLocatorContext(projection, eventsBySeq, scope, event.seq);
|
|
23478
23830
|
const result = certifyCheckpoint(projection, call.bindings ?? [], id, false);
|
|
23479
23831
|
if (result.status !== "certified" || !result.checkpoint || !recordedCertificateMatches(recorded.certificate, result.checkpoint)) {
|
|
23480
23832
|
projection.integrity = "corrupt";
|
|
@@ -23586,7 +23938,7 @@ function deriveProjection(sourceEvents, config, scope, durableConfirmed, hostLoc
|
|
|
23586
23938
|
if (item.status !== "pending" || !item.observerMethod?.tools.length) continue;
|
|
23587
23939
|
if (item.observerMethod.tools.every((_, index$1) => observerMethodEvidence(projection, sourceEvents, item, index$1))) item.status = "passed";
|
|
23588
23940
|
}
|
|
23589
|
-
refreshRootLocatorContext(projection,
|
|
23941
|
+
refreshRootLocatorContext(projection, eventsBySeq, scope, sourceEvents.at(-1)?.seq ?? 0);
|
|
23590
23942
|
applyUpgradeEligibility(projection);
|
|
23591
23943
|
if (interpretationFacts.length > 64) interpretationFacts.splice(0, interpretationFacts.length - 64);
|
|
23592
23944
|
projection.interpretationFacts = interpretationFacts;
|
|
@@ -24964,6 +25316,17 @@ function foldRootControls(snapshot, sources, requirements, facts, units, waterma
|
|
|
24964
25316
|
resumed
|
|
24965
25317
|
};
|
|
24966
25318
|
}
|
|
25319
|
+
/** Stable buckets are local to one validated snapshot; rows stay in source order. */
|
|
25320
|
+
function bySource(rows) {
|
|
25321
|
+
const result = /* @__PURE__ */ new Map();
|
|
25322
|
+
for (const row$3 of rows) {
|
|
25323
|
+
const key = row$3.source.source_id;
|
|
25324
|
+
const bucket = result.get(key);
|
|
25325
|
+
if (bucket) bucket.push(row$3);
|
|
25326
|
+
else result.set(key, [row$3]);
|
|
25327
|
+
}
|
|
25328
|
+
return result;
|
|
25329
|
+
}
|
|
24967
25330
|
/** Pure, host-neutral core/v2 projection. The adapter owns event trust and durability. */
|
|
24968
25331
|
function projectCoreV2(snapshot) {
|
|
24969
25332
|
validateCoreSnapshot(snapshot, observation_schema_default);
|
|
@@ -25012,10 +25375,11 @@ function projectCoreV2(snapshot) {
|
|
|
25012
25375
|
...[...requirements.values()].filter((req) => units.has(req.unit)).map((req) => req.source.source_id),
|
|
25013
25376
|
...listed(snapshot.root_controls ?? []).filter((control) => control.seq <= watermark && units.has(sources.get(control.source.source_id)?.unit)).map((control) => control.source.source_id)
|
|
25014
25377
|
]);
|
|
25378
|
+
const coverageBySource = bySource(listed(snapshot.coverage));
|
|
25015
25379
|
const coverageErrors = [], unknownCoverage = [];
|
|
25016
25380
|
for (const [key, source] of sources) {
|
|
25017
25381
|
if (source.kind !== "root" || !activeRootIds.has(key)) continue;
|
|
25018
|
-
const spans =
|
|
25382
|
+
const spans = (coverageBySource.get(key) ?? []).slice().sort((a, b) => a.source.start - b.source.start);
|
|
25019
25383
|
let cursor = 0;
|
|
25020
25384
|
for (const coverage of spans) {
|
|
25021
25385
|
const span = coverage.source;
|
|
@@ -25079,10 +25443,12 @@ function projectCoreV2(snapshot) {
|
|
|
25079
25443
|
}
|
|
25080
25444
|
const historicalExplained = new Map([...requirements].filter(([, req]) => units.has(req.unit) && req.status === "superseded" && req.superseded_at_seq !== void 0 && req.superseded_at_seq <= watermark && sourceMatches(req.source, sources, true)));
|
|
25081
25445
|
const structuralGap = (raw, start, end) => Buffer.from(raw.subarray(start, end)).toString("utf8").replace(/^[ \t\r\n,,。.!??;;::、]+|[ \t\r\n,,。.!??;;::、]+$/gu, "").length > 0;
|
|
25446
|
+
const explainedBySource = bySource([...current.values(), ...historicalExplained.values()]);
|
|
25447
|
+
const controlsBySource = bySource(listed(snapshot.root_controls ?? []).filter((control) => control.seq <= watermark && sourceMatches(control.source, sources, true)));
|
|
25082
25448
|
for (const coverage of listed(snapshot.coverage)) {
|
|
25083
25449
|
const span = coverage.source, source = sources.get(span.source_id);
|
|
25084
25450
|
if (!source || !units.has(source.unit) || coverage.kind !== "interpreted") continue;
|
|
25085
|
-
const covered = [...
|
|
25451
|
+
const covered = [...(explainedBySource.get(span.source_id) ?? []).filter((r) => r.source.start < span.end && r.source.end > span.start).map((r) => [r.source.start, r.source.end]), ...(controlsBySource.get(span.source_id) ?? []).map((control) => [control.source.start, control.source.end])].sort((a, b) => a[0] - b[0] || a[1] - b[1]);
|
|
25086
25452
|
let cursor = span.start;
|
|
25087
25453
|
const raw = bytes(source.text);
|
|
25088
25454
|
for (const [start, end] of covered) {
|
|
@@ -25654,17 +26020,75 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
25654
26020
|
const rootBySeq = new Map(usedRoots.map((root) => [root.seq, root]));
|
|
25655
26021
|
const revisionByRootSeq = new Map(usedRoots.map((root, index$1) => [root.seq, index$1 + 1]));
|
|
25656
26022
|
const revisionFor = (seq) => revisionByRootSeq.get(seq);
|
|
26023
|
+
const ix = process.env.DSH_GUARD_DISABLE_INDEXES !== "1";
|
|
26024
|
+
const evidenceList = ix ? [...projection.evidence.values()] : [];
|
|
26025
|
+
const evidenceOrdinal = /* @__PURE__ */ new Map();
|
|
26026
|
+
const evidenceByCallIx = /* @__PURE__ */ new Map();
|
|
26027
|
+
const evidenceBySubjectIx = /* @__PURE__ */ new Map();
|
|
26028
|
+
const readinessByItemIx = /* @__PURE__ */ new Map();
|
|
26029
|
+
if (ix) evidenceList.forEach((fact, ordinal) => {
|
|
26030
|
+
evidenceOrdinal.set(fact, ordinal);
|
|
26031
|
+
const push = (map, key) => {
|
|
26032
|
+
if (key === void 0) return;
|
|
26033
|
+
const bucket = map.get(key);
|
|
26034
|
+
if (bucket) bucket.push(fact);
|
|
26035
|
+
else map.set(key, [fact]);
|
|
26036
|
+
};
|
|
26037
|
+
push(evidenceByCallIx, fact.callId);
|
|
26038
|
+
for (const subject of fact.subjects) push(evidenceBySubjectIx, subject);
|
|
26039
|
+
push(readinessByItemIx, fact.readinessForItemId);
|
|
26040
|
+
});
|
|
26041
|
+
const candidatesForSubjects = (targets) => {
|
|
26042
|
+
if (!ix) return evidenceList.length ? evidenceList : [...projection.evidence.values()];
|
|
26043
|
+
const selected = /* @__PURE__ */ new Set();
|
|
26044
|
+
for (const target of targets) {
|
|
26045
|
+
if (target === void 0) continue;
|
|
26046
|
+
for (const fact of evidenceBySubjectIx.get(target) ?? []) selected.add(fact);
|
|
26047
|
+
}
|
|
26048
|
+
const ordered = [...selected];
|
|
26049
|
+
ordered.sort((left, right) => evidenceOrdinal.get(left) - evidenceOrdinal.get(right));
|
|
26050
|
+
return ordered;
|
|
26051
|
+
};
|
|
26052
|
+
const evidenceByCall = (callId) => ix ? evidenceByCallIx.get(callId) ?? [] : [...projection.evidence.values()].filter((fact) => fact.callId === callId);
|
|
26053
|
+
const evidenceReadyFor = (itemId) => ix ? readinessByItemIx.get(itemId) ?? [] : [...projection.evidence.values()].filter((fact) => fact.readinessForItemId === itemId);
|
|
26054
|
+
const successModifyEffects = ix ? evidenceList.filter((fact) => fact.semanticAction === "modify" && fact.evidenceRole === "effect" && fact.outcome === "success") : void 0;
|
|
26055
|
+
const successFileStateEvidence = ix ? evidenceList.filter((fact) => fact.evidenceRole === "state" && fact.toolName === "context_guard_observe_file" && fact.outcome === "success") : void 0;
|
|
26056
|
+
const testEffectEvidence = ix ? evidenceList.filter((entry) => entry.semanticAction === "test" && entry.evidenceRole === "effect" && entry.parseStatus === "supported" && entry.processFacts?.operationAttribution === "single_operation") : void 0;
|
|
26057
|
+
const rootCache = /* @__PURE__ */ new Map();
|
|
26058
|
+
const rootInfo = (root) => {
|
|
26059
|
+
let info = rootCache.get(root.seq);
|
|
26060
|
+
if (!info) {
|
|
26061
|
+
const text = rootText(root);
|
|
26062
|
+
info = {
|
|
26063
|
+
text,
|
|
26064
|
+
digest: hash(text),
|
|
26065
|
+
bytes: Buffer.from(text, "utf8"),
|
|
26066
|
+
byteLength: Buffer.byteLength(text, "utf8")
|
|
26067
|
+
};
|
|
26068
|
+
rootCache.set(root.seq, info);
|
|
26069
|
+
}
|
|
26070
|
+
return info;
|
|
26071
|
+
};
|
|
26072
|
+
const itemsByRootSeq = /* @__PURE__ */ new Map();
|
|
26073
|
+
for (const item of currentItems) {
|
|
26074
|
+
const seq = sourceSeq(item);
|
|
26075
|
+
if (seq === void 0) continue;
|
|
26076
|
+
const bucket = itemsByRootSeq.get(seq);
|
|
26077
|
+
if (bucket) bucket.push(item);
|
|
26078
|
+
else itemsByRootSeq.set(seq, [item]);
|
|
26079
|
+
}
|
|
26080
|
+
const peersOf = (item) => itemsByRootSeq.get(sourceSeq(item) ?? -1) ?? [];
|
|
25657
26081
|
const supersessionOf = (item) => {
|
|
25658
26082
|
if (item.status !== "superseded" || !item.supersededBy) return void 0;
|
|
25659
26083
|
const successor = projection.items.get(item.supersededBy);
|
|
25660
26084
|
const seq = successor ? sourceSeq(successor) : void 0;
|
|
25661
26085
|
const successorRoot = seq === void 0 ? void 0 : rootBySeq.get(seq);
|
|
25662
26086
|
const successorSpan = successor?.spans?.[0];
|
|
25663
|
-
const successorClause = successorRoot && successorSpan?.partIndex === 0 ?
|
|
26087
|
+
const successorClause = successorRoot && successorSpan?.partIndex === 0 ? rootInfo(successorRoot).bytes.subarray(successorSpan.start, successorSpan.end).toString("utf8") : void 0;
|
|
25664
26088
|
const predecessorSeq = sourceSeq(item);
|
|
25665
26089
|
const predecessorRoot = predecessorSeq === void 0 ? void 0 : rootBySeq.get(predecessorSeq);
|
|
25666
26090
|
const predecessorSpan = item.spans?.[0];
|
|
25667
|
-
const predecessorClause = predecessorRoot && predecessorSpan?.partIndex === 0 ?
|
|
26091
|
+
const predecessorClause = predecessorRoot && predecessorSpan?.partIndex === 0 ? rootInfo(predecessorRoot).bytes.subarray(predecessorSpan.start, predecessorSpan.end).toString("utf8") : void 0;
|
|
25668
26092
|
const sourcedReplacement = Boolean(successorClause && predecessorClause && successorClause === predecessorClause && successor?.textSha256 === item.textSha256);
|
|
25669
26093
|
return successor?.unitId === unit && successor.kind === item.kind && successor.semanticAction === item.semanticAction && targetOf(successor) === targetOf(item) && successor.authorityDisposition === "executable_now" && sourcedReplacement && seq !== void 0 && seq > (sourceSeq(item) ?? -1) && rootBySeq.has(seq) && revisionFor(seq) > revisionFor(sourceSeq(item)) ? {
|
|
25670
26094
|
seq,
|
|
@@ -25674,19 +26098,19 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
25674
26098
|
};
|
|
25675
26099
|
if (!currentItems.every((item) => {
|
|
25676
26100
|
const root = rootBySeq.get(sourceSeq(item) ?? -1);
|
|
25677
|
-
return root && item.rawTextSha256 ===
|
|
26101
|
+
return root && item.rawTextSha256 === rootInfo(root).digest;
|
|
25678
26102
|
})) return void 0;
|
|
25679
26103
|
const sources = usedRoots.map((root) => {
|
|
25680
|
-
const
|
|
26104
|
+
const info = rootInfo(root);
|
|
25681
26105
|
return {
|
|
25682
26106
|
id: `root:${root.seq}`,
|
|
25683
26107
|
seq: root.seq,
|
|
25684
26108
|
kind: "root",
|
|
25685
26109
|
unit,
|
|
25686
26110
|
revision: revisionFor(root.seq),
|
|
25687
|
-
sha256:
|
|
25688
|
-
byte_length:
|
|
25689
|
-
text,
|
|
26111
|
+
sha256: info.digest,
|
|
26112
|
+
byte_length: info.byteLength,
|
|
26113
|
+
text: info.text,
|
|
25690
26114
|
call_id: null,
|
|
25691
26115
|
turn: String(row(root.data).turn ?? turn),
|
|
25692
26116
|
...projection.rootLocatorContexts.get(root.seq) ? {
|
|
@@ -25695,21 +26119,33 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
25695
26119
|
} : {}
|
|
25696
26120
|
};
|
|
25697
26121
|
});
|
|
26122
|
+
const sourceIds = new Set(sources.map((source) => String(source.id)));
|
|
26123
|
+
const sourceById = new Map(sources.map((source) => [String(source.id), source]));
|
|
26124
|
+
const addSource = (row$3) => {
|
|
26125
|
+
const id = String(row$3.id);
|
|
26126
|
+
if (!sourceIds.has(id)) {
|
|
26127
|
+
sourceIds.add(id);
|
|
26128
|
+
sourceById.set(id, row$3);
|
|
26129
|
+
sources.push(row$3);
|
|
26130
|
+
}
|
|
26131
|
+
};
|
|
25698
26132
|
const requirements = [];
|
|
25699
26133
|
const facts = [];
|
|
25700
26134
|
const actions = [];
|
|
25701
26135
|
const conditions = [];
|
|
25702
26136
|
const coverage = [];
|
|
25703
26137
|
for (const root of usedRoots) {
|
|
25704
|
-
const
|
|
26138
|
+
const info = rootInfo(root);
|
|
26139
|
+
const text = info.text, digest$1 = info.digest, byteLength = info.byteLength;
|
|
25705
26140
|
const span = (start, end) => ({
|
|
25706
26141
|
source_id: `root:${root.seq}`,
|
|
25707
26142
|
start,
|
|
25708
26143
|
end,
|
|
25709
26144
|
sha256: digest$1
|
|
25710
26145
|
});
|
|
25711
|
-
const
|
|
25712
|
-
|
|
26146
|
+
const rootItems = itemsByRootSeq.get(root.seq) ?? [];
|
|
26147
|
+
const sortedSpans = rootItems.flatMap((item) => {
|
|
26148
|
+
const own = sourceSpan(item, text, rootItems);
|
|
25713
26149
|
return own ? [own] : [];
|
|
25714
26150
|
}).sort((a, b) => a.start - b.start || a.end - b.end);
|
|
25715
26151
|
let cursor = 0;
|
|
@@ -25790,28 +26226,35 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
25790
26226
|
result
|
|
25791
26227
|
});
|
|
25792
26228
|
}
|
|
26229
|
+
const basesByItem = /* @__PURE__ */ new Map();
|
|
26230
|
+
for (const base of currentActionBases(projection, false)) {
|
|
26231
|
+
const bucket = basesByItem.get(base.itemId);
|
|
26232
|
+
if (bucket) bucket.push(base);
|
|
26233
|
+
else basesByItem.set(base.itemId, [base]);
|
|
26234
|
+
}
|
|
25793
26235
|
const attached = /* @__PURE__ */ new Set();
|
|
25794
26236
|
for (const item of currentItems) {
|
|
25795
26237
|
const root = rootBySeq.get(sourceSeq(item) ?? -1);
|
|
25796
26238
|
if (!root) continue;
|
|
25797
26239
|
const itemRevision = revisionFor(root.seq);
|
|
25798
|
-
const
|
|
26240
|
+
const info = rootInfo(root);
|
|
26241
|
+
const text = info.text, digest$1 = info.digest;
|
|
25799
26242
|
const span = (start, end) => ({
|
|
25800
26243
|
source_id: `root:${root.seq}`,
|
|
25801
26244
|
start,
|
|
25802
26245
|
end,
|
|
25803
26246
|
sha256: digest$1
|
|
25804
26247
|
});
|
|
25805
|
-
const itemSpan = sourceSpan(item, text,
|
|
26248
|
+
const itemSpan = sourceSpan(item, text, peersOf(item));
|
|
25806
26249
|
if (!itemSpan) continue;
|
|
25807
|
-
if (item.observerMethod && item.rawTextSha256 ===
|
|
26250
|
+
if (item.observerMethod && item.rawTextSha256 === digest$1 && item.authority === "root_instruction") {
|
|
25808
26251
|
const methodSource = {
|
|
25809
26252
|
source_id: `root:${root.seq}`,
|
|
25810
26253
|
start: itemSpan.start,
|
|
25811
26254
|
end: itemSpan.end,
|
|
25812
|
-
sha256:
|
|
26255
|
+
sha256: digest$1
|
|
25813
26256
|
};
|
|
25814
|
-
const methodConstraint =
|
|
26257
|
+
const methodConstraint = info.bytes.subarray(itemSpan.start, itemSpan.end).toString("utf8");
|
|
25815
26258
|
for (const [index$1, tool] of item.observerMethod.tools.entries()) {
|
|
25816
26259
|
const related = projection.items.get(item.observerMethod.targetItemIds[index$1]);
|
|
25817
26260
|
if (!related || related.rawTextSha256 !== item.rawTextSha256 || related.unitId !== item.unitId || sourceSeq(related) !== root.seq) continue;
|
|
@@ -25823,7 +26266,7 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
25823
26266
|
const subjectKind$1 = tool === "context_guard_observe_file" ? "filesystem" : "opaque";
|
|
25824
26267
|
const relatedSpan = related.spans?.[0];
|
|
25825
26268
|
const targetBytes = Buffer.from(target$1, "utf8");
|
|
25826
|
-
const targetAt = relatedSpan ?
|
|
26269
|
+
const targetAt = relatedSpan ? info.bytes.subarray(relatedSpan.start, relatedSpan.end).indexOf(targetBytes) : -1;
|
|
25827
26270
|
const literalTarget = targetAt >= 0 && relatedSpan !== void 0;
|
|
25828
26271
|
const targetSource = literalTarget ? {
|
|
25829
26272
|
source_id: `root:${root.seq}`,
|
|
@@ -25868,11 +26311,11 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
25868
26311
|
});
|
|
25869
26312
|
if (!fact || !pair) continue;
|
|
25870
26313
|
const callId = `call:${fact.callId}`, resultId = `result:${fact.callId}`;
|
|
25871
|
-
if (!
|
|
26314
|
+
if (!sourceIds.has(callId)) {
|
|
25872
26315
|
const callBytes = String(row(pair.call.data).arguments ?? "");
|
|
25873
26316
|
const resultBytes = Array.isArray(row(row(pair.result.data).message).content) ? row(row(pair.result.data).message).content.filter((part) => row(part).type === "text").map((part) => String(row(part).text ?? "")).join("\n") : "";
|
|
25874
26317
|
const callTurn = String(row(pair.call.data).turn ?? turn);
|
|
25875
|
-
|
|
26318
|
+
addSource({
|
|
25876
26319
|
id: callId,
|
|
25877
26320
|
seq: pair.call.seq,
|
|
25878
26321
|
kind: "host_call",
|
|
@@ -25887,7 +26330,7 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
25887
26330
|
target_kind: subjectKind$1,
|
|
25888
26331
|
origin_root_source_id: `root:${root.seq}`
|
|
25889
26332
|
});
|
|
25890
|
-
|
|
26333
|
+
addSource({
|
|
25891
26334
|
id: resultId,
|
|
25892
26335
|
seq: pair.result.seq,
|
|
25893
26336
|
kind: "host_result",
|
|
@@ -25930,7 +26373,7 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
25930
26373
|
}))) continue;
|
|
25931
26374
|
const kind = kindOf(item);
|
|
25932
26375
|
const named = targetOf(item);
|
|
25933
|
-
const raw =
|
|
26376
|
+
const raw = info.bytes;
|
|
25934
26377
|
const namedBytes = named ? Buffer.from(named, "utf8") : void 0;
|
|
25935
26378
|
const atWithin = namedBytes ? raw.subarray(itemSpan.start, itemSpan.end).indexOf(namedBytes) : -1;
|
|
25936
26379
|
const at = atWithin >= 0 ? itemSpan.start + atWithin : -1;
|
|
@@ -25941,7 +26384,7 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
25941
26384
|
const readbackReferent = readbackAntecedents.length === 1 ? readbackAntecedents[0].requestedTarget.artifact_id : void 0;
|
|
25942
26385
|
const referents = kind === "constraint" ? currentItems.flatMap((candidate) => {
|
|
25943
26386
|
if (candidate.taskKind !== "context" || sourceSeq(candidate) !== root.seq) return [];
|
|
25944
|
-
const own = sourceSpan(candidate, text,
|
|
26387
|
+
const own = sourceSpan(candidate, text, peersOf(candidate));
|
|
25945
26388
|
const path$1 = candidate.requestedTarget?.artifact_id;
|
|
25946
26389
|
const base = projection.rootLocatorContexts.get(root.seq)?.base;
|
|
25947
26390
|
if (!own || own.end > itemSpan.start || typeof path$1 !== "string" || !base || !portableContains(base, path$1)) return [];
|
|
@@ -25966,9 +26409,9 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
25966
26409
|
const relativeAt = relativeLiteral ? itemSpan.start + raw.subarray(itemSpan.start, itemSpan.end).indexOf(Buffer.from(relativeLiteral, "utf8")) : -1;
|
|
25967
26410
|
const scopeValue = typeof item.requestedTarget?.scope === "string" ? item.requestedTarget.scope : typeof item.requestedTarget?.artifact_id === "string" ? item.requestedTarget.artifact_id : void 0;
|
|
25968
26411
|
const editScope = directoryLiteral && scopeValue ? portableResolve(scopeValue, directoryLiteral) : scopeValue;
|
|
25969
|
-
const editChoices = item.semanticAction === "modify" && (!item.requestedTarget?.artifact_id || directoryLiteral) && typeof editScope === "string" ? [...projection.evidence.values()].filter((fact) => fact.semanticAction === "modify" && fact.evidenceRole === "effect" && fact.outcome === "success" && fact.toolResultSeq > root.seq && (sourceByCall.get(fact.callId)?.call.seq ?? -1) > root.seq && fact.subjects.length === 1 && typeof fact.subjects[0] === "string" && portableContains(editScope, fact.subjects[0])) : [];
|
|
26412
|
+
const editChoices = item.semanticAction === "modify" && (!item.requestedTarget?.artifact_id || directoryLiteral) && typeof editScope === "string" ? (successModifyEffects ?? [...projection.evidence.values()]).filter((fact) => fact.semanticAction === "modify" && fact.evidenceRole === "effect" && fact.outcome === "success" && fact.toolResultSeq > root.seq && (sourceByCall.get(fact.callId)?.call.seq ?? -1) > root.seq && fact.subjects.length === 1 && typeof fact.subjects[0] === "string" && portableContains(editScope, fact.subjects[0])) : [];
|
|
25970
26413
|
const selectedEdit = editChoices.length === 1 ? editChoices[0] : void 0;
|
|
25971
|
-
const readbackChoices = fileReadback ? [...projection.evidence.values()].filter((fact) => fact.evidenceRole === "state" && fact.toolName === "context_guard_observe_file" && fact.outcome === "success" && fact.toolResultSeq > root.seq && fact.subjects.length === 1 && (sourceByCall.get(fact.callId)?.call.seq ?? -1) > root.seq && (!anaphoricReadback || typeof readbackReferent === "string" && fact.subjects[0] === readbackReferent) &&
|
|
26414
|
+
const readbackChoices = fileReadback ? (successFileStateEvidence ?? [...projection.evidence.values()]).filter((fact) => fact.evidenceRole === "state" && fact.toolName === "context_guard_observe_file" && fact.outcome === "success" && fact.toolResultSeq > root.seq && fact.subjects.length === 1 && (sourceByCall.get(fact.callId)?.call.seq ?? -1) > root.seq && (!anaphoricReadback || typeof readbackReferent === "string" && fact.subjects[0] === readbackReferent) && evidenceByCall(fact.causedByCallId ?? "").some((effect) => effect.semanticAction === "modify" && effect.evidenceRole === "effect" && effect.outcome === "success" && effect.subjects.includes(fact.subjects[0]) && effect.toolResultSeq < fact.toolResultSeq)) : [];
|
|
25972
26415
|
const selectedReadback = readbackChoices.length === 1 ? readbackChoices[0] : void 0;
|
|
25973
26416
|
const subjectKind = forbiddenFile || fileReadback || [
|
|
25974
26417
|
"modify",
|
|
@@ -25989,9 +26432,9 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
25989
26432
|
} : ownConstraintSpan;
|
|
25990
26433
|
const needsReadiness = item.semanticAction === "test" || item.semanticAction === "verify" && !fileReadback;
|
|
25991
26434
|
const readinessPredicate = item.semanticAction === "test" ? "test_passed" : "verification_passed";
|
|
25992
|
-
const selectedReadiness = needsReadiness && !guarded ?
|
|
26435
|
+
const selectedReadiness = needsReadiness && !guarded ? evidenceReadyFor(item.id).find((fact) => {
|
|
25993
26436
|
const pair = sourceByCall.get(fact.callId);
|
|
25994
|
-
const assessmentEffect = item.semanticAction !== "verify" || !fact.readinessEffectCallId && fact.readinessInputSha256 === fact.readinessManifestSha256 ||
|
|
26437
|
+
const assessmentEffect = item.semanticAction !== "verify" || !fact.readinessEffectCallId && fact.readinessInputSha256 === fact.readinessManifestSha256 || evidenceByCall(fact.readinessEffectCallId ?? "").some((effect) => effect.toolResultSeq < fact.toolResultSeq && effect.epoch === fact.epoch && effect.outcome === "success" && effect.parseStatus === "supported" && effect.semanticAction === "modify" && effect.evidenceRole === "effect" && effect.operations?.some((operation) => operation.op === "modify" && operation.path === fact.readinessSelectedPath));
|
|
25995
26438
|
return fact.readinessForItemId === item.id && fact.readinessPredicate === readinessPredicate && assessmentEffect && fact.toolName === "context_guard_observe_test_readiness" && fact.outcome === "success" && fact.epoch === projection.epoch && pair?.result.seq === fact.toolResultSeq && pair.call.seq > root.seq && typeof item.requestedTarget?.scope === "string" && fact.subjects.includes(item.requestedTarget.scope);
|
|
25996
26439
|
}) : void 0;
|
|
25997
26440
|
const namedTest = item.semanticAction === "test" ? /\b((?:npm|pnpm))\s+test\b/iu.exec(item.normalizedText) : null;
|
|
@@ -26014,13 +26457,13 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
26014
26457
|
const selectedScope = (selectedReadiness || selectedDirectTest) && typeof item.requestedTarget?.scope === "string" ? item.requestedTarget.scope : void 0;
|
|
26015
26458
|
const target = forbiddenFile?.path ?? selectedScope ?? selectedEdit?.subjects[0] ?? selectedReadback?.subjects[0] ?? (relativeLiteral && named ? named : at >= 0 && named ? named : trimmed);
|
|
26016
26459
|
if (!target) continue;
|
|
26017
|
-
const knownForbiddenEffect = forbiddenFile && [
|
|
26460
|
+
const knownForbiddenEffect = forbiddenFile && candidatesForSubjects([target]).some((fact) => fact.epoch === projection.epoch && fact.toolResultSeq > root.seq && (sourceByCall.get(fact.callId)?.call.seq ?? -1) > root.seq && fact.evidenceRole === "effect" && fact.outcome === "success" && fact.subjects.includes(target) && [
|
|
26018
26461
|
"write",
|
|
26019
26462
|
"write_file",
|
|
26020
26463
|
"edit",
|
|
26021
26464
|
"edit_file"
|
|
26022
26465
|
].includes(fact.toolName) && fact.operations?.some((operation) => ["create", "modify"].includes(operation.op) && operation.path === target));
|
|
26023
|
-
const uncertainForbiddenEffect = forbiddenFile && !knownForbiddenEffect && [
|
|
26466
|
+
const uncertainForbiddenEffect = forbiddenFile && !knownForbiddenEffect && candidatesForSubjects([target]).some((fact) => fact.epoch === projection.epoch && fact.toolResultSeq > root.seq && (sourceByCall.get(fact.callId)?.call.seq ?? -1) > root.seq && fact.evidenceRole === "effect" && fact.subjects.includes(target) && ([
|
|
26024
26467
|
"write",
|
|
26025
26468
|
"write_file",
|
|
26026
26469
|
"edit",
|
|
@@ -26098,7 +26541,7 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
26098
26541
|
constraint_kind: forbiddenFile ? "exact" : directoryLiteral ? "directory" : relativeLiteral ? "exact" : selectedScope || selectedEdit || selectedReadback ? "work_unit" : "exact",
|
|
26099
26542
|
...(forbiddenFile || directoryLiteral || relativeLiteral) && rootBase ? { resolved_constraint: portableResolve(rootBase, forbiddenFile?.literal ?? directoryLiteral ?? relativeLiteral) } : {},
|
|
26100
26543
|
selection_source_id: kind === "constraint" ? null : selectedReadiness ? `call:${selectedReadiness.callId}` : selectedDirectTest ? `call:${selectedDirectTest.callId}` : selectedEdit ? `call:${selectedEdit.callId}` : selectedReadback ? `call:${selectedReadback.callId}` : relativeLiteral ? (() => {
|
|
26101
|
-
const fact = [...projection.evidence.values()].find((entry) => entry.semanticAction === "modify" && entry.evidenceRole === "effect" && entry.outcome === "success" && entry.subjects.includes(target) && sourceByCall.has(entry.callId));
|
|
26544
|
+
const fact = (successModifyEffects ?? [...projection.evidence.values()]).find((entry) => entry.semanticAction === "modify" && entry.evidenceRole === "effect" && entry.outcome === "success" && entry.subjects.includes(target) && sourceByCall.has(entry.callId));
|
|
26102
26545
|
return fact ? `call:${fact.callId}` : null;
|
|
26103
26546
|
})() : null
|
|
26104
26547
|
}
|
|
@@ -26109,10 +26552,10 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
26109
26552
|
const deliveryId = `delivery:${delivery.seq}:revision:${itemRevision}`;
|
|
26110
26553
|
const deliveredText = Array.isArray(row(row(delivery.data).message).content) ? row(row(delivery.data).message).content.filter((part) => row(part).type === "text").map((part) => String(row(part).text ?? "")).join("\n") : "";
|
|
26111
26554
|
const isTestReport = /\b(?:report|summari[sz]e)\b[^。.!??]{0,80}\b(?:result|outcome)\b|(?:报告|汇报|说明)[^。.!??]{0,80}(?:结果|运行情况)/iu.test(item.normalizedText);
|
|
26112
|
-
const rootTests =
|
|
26555
|
+
const rootTests = (itemsByRootSeq.get(root.seq) ?? []).filter((candidate) => candidate.semanticAction === "test");
|
|
26113
26556
|
const reportTest = isTestReport && rootTests.length === 1 ? rootTests[0] : void 0;
|
|
26114
26557
|
const expectedCommand = reportTest ? /\b(npm|pnpm)\s+test\b/iu.exec(reportTest.normalizedText)?.[0]?.toLowerCase() : void 0;
|
|
26115
|
-
const run = expectedCommand ? [...projection.evidence.values()].filter((entry) => {
|
|
26558
|
+
const run = expectedCommand ? (testEffectEvidence ?? [...projection.evidence.values()]).filter((entry) => {
|
|
26116
26559
|
const pair = sourceByCall.get(entry.callId);
|
|
26117
26560
|
if (!pair || pair.call.seq <= root.seq || pair.result.seq >= delivery.seq || entry.semanticAction !== "test" || entry.evidenceRole !== "effect" || entry.parseStatus !== "supported" || entry.processFacts?.operationAttribution !== "single_operation" || !projection.auditedForegroundRenderers?.includes(entry.toolName) || persistedToolResultStatus(pair.result.data, entry.callId) === "unknown" || !entry.subjects.includes(String(reportTest?.requestedTarget?.scope ?? ""))) return false;
|
|
26118
26561
|
let args = {};
|
|
@@ -26134,7 +26577,7 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
26134
26577
|
const numericReport = declaredExit !== void 0 && reportedExits.length > 0 && reportedExits.every((value) => value === declaredExit);
|
|
26135
26578
|
const statusReport = run?.processFacts?.outcome === "success" ? /(?:test(?:s)?\s+(?:passed|succeeded)|测试(?:已)?通过|测试成功)/iu.test(assertedText) : trustedFailure ? /(?:test(?:s)?\s+(?:failed|did\s+not\s+pass)|测试(?:未通过|失败))/iu.test(assertedText) : false;
|
|
26136
26579
|
if (reportTest && (conflictingStatus || !numericReport && !statusReport)) continue;
|
|
26137
|
-
if (!
|
|
26580
|
+
if (!sourceIds.has(deliveryId)) addSource({
|
|
26138
26581
|
id: deliveryId,
|
|
26139
26582
|
seq: delivery.seq,
|
|
26140
26583
|
kind: "final_delivery",
|
|
@@ -26164,7 +26607,8 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
26164
26607
|
});
|
|
26165
26608
|
}
|
|
26166
26609
|
}
|
|
26167
|
-
|
|
26610
|
+
const evidenceCandidates = guarded ? [] : candidatesForSubjects([target, needsReadiness && typeof item.requestedTarget?.scope === "string" ? item.requestedTarget.scope : void 0]);
|
|
26611
|
+
for (const evidence of evidenceCandidates) {
|
|
26168
26612
|
const inTestScope = needsReadiness && typeof item.requestedTarget?.scope === "string" && evidence.subjects.includes(item.requestedTarget.scope);
|
|
26169
26613
|
if (evidence.epoch !== projection.epoch || !evidence.subjects.includes(target) && !inTestScope || evidence.toolResultSeq <= root.seq || attached.has(evidence.id) && !fileReadback) continue;
|
|
26170
26614
|
if (kind === "constraint" && (!forbiddenFile || evidence.evidenceRole !== "effect" || ![
|
|
@@ -26179,7 +26623,7 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
26179
26623
|
if (fileReadback && (evidence.evidenceRole !== "state" || evidence.toolName !== "context_guard_observe_file")) continue;
|
|
26180
26624
|
if (evidence.toolName === "context_guard_observe_test_readiness" && evidence.readinessForItemId !== item.id) continue;
|
|
26181
26625
|
if (evidence.evidenceRole === "state" && evidence.toolName !== "context_guard_observe_test_readiness") {
|
|
26182
|
-
if (!
|
|
26626
|
+
if (!evidenceByCall(evidence.causedByCallId ?? "").find((fact) => fact.callId === evidence.causedByCallId && fact.epoch === evidence.epoch && fact.outcome === "success" && fact.toolResultSeq < evidence.toolResultSeq && fact.subjects.includes(target) && fact.semanticAction === evidence.semanticAction) || !["context_guard_observe_file", "context_guard_observe_git"].includes(evidence.toolName)) continue;
|
|
26183
26627
|
}
|
|
26184
26628
|
const pair = sourceByCall.get(evidence.callId);
|
|
26185
26629
|
const crossesNewConstraint = kind === "constraint" && forbiddenFile && pair && pair.call.seq <= root.seq && pair.result.seq >= root.seq;
|
|
@@ -26188,7 +26632,7 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
26188
26632
|
if (item.semanticAction === "test" && evidence.evidenceRole === "effect" && (namedTest ? !isDirectTestFact(evidence) : !selectedReadiness)) continue;
|
|
26189
26633
|
const outcome = hostResultStatus === "failure" || evidence.outcome === "failure" || evidence.processFacts?.outcome === "failure" ? "failure" : evidence.outcome !== "success" || evidence.processFacts?.outcome === "unknown" || hostResultStatus === "unknown" || evidence.evidenceRole === "effect" && evidence.processFacts && evidence.processFacts.operationAttribution !== "single_operation" || evidence.parseStatus !== "supported" ? "unknown" : "success";
|
|
26190
26634
|
const callId = `call:${evidence.callId}`, resultId = `result:${evidence.callId}`;
|
|
26191
|
-
const existingCall =
|
|
26635
|
+
const existingCall = sourceById.get(callId);
|
|
26192
26636
|
if (existingCall && existingCall.revision !== itemRevision) continue;
|
|
26193
26637
|
const callName = String(row(pair.call.data).name ?? "");
|
|
26194
26638
|
let callArgs = {};
|
|
@@ -26207,13 +26651,13 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
26207
26651
|
const fileCallTarget = fileCall && typeof filePath === "string" && filePath ? portableResolve(rootBase, filePath) : void 0;
|
|
26208
26652
|
const hostTarget = fileCall ? fileCallTarget : evidence.subjects[0];
|
|
26209
26653
|
if (!hostTarget || fileCall && evidence.parseStatus !== "supported") continue;
|
|
26210
|
-
if (!
|
|
26654
|
+
if (!sourceIds.has(callId)) {
|
|
26211
26655
|
const callTurn = String(row(pair.call.data).turn ?? turn);
|
|
26212
26656
|
const resultTurn = String(row(pair.result.data).turn ?? callTurn);
|
|
26213
26657
|
const originRoot = usedRoots.filter((candidate) => candidate.seq <= pair.call.seq && String(row(candidate.data).turn ?? turn) === callTurn).at(-1);
|
|
26214
26658
|
const callBytes = String(row(pair.call.data).arguments ?? "");
|
|
26215
26659
|
const resultBytes = Array.isArray(row(row(pair.result.data).message).content) ? row(row(pair.result.data).message).content.filter((part) => row(part).type === "text").map((part) => String(row(part).text ?? "")).join("\n") : "";
|
|
26216
|
-
|
|
26660
|
+
addSource({
|
|
26217
26661
|
id: callId,
|
|
26218
26662
|
seq: pair.call.seq,
|
|
26219
26663
|
kind: "host_call",
|
|
@@ -26228,7 +26672,7 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
26228
26672
|
target_kind: subjectKind,
|
|
26229
26673
|
...originRoot ? { origin_root_source_id: `root:${originRoot.seq}` } : {}
|
|
26230
26674
|
});
|
|
26231
|
-
|
|
26675
|
+
addSource({
|
|
26232
26676
|
id: resultId,
|
|
26233
26677
|
seq: pair.result.seq,
|
|
26234
26678
|
kind: "host_result",
|
|
@@ -26260,7 +26704,7 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
26260
26704
|
});
|
|
26261
26705
|
if (!fileReadback) attached.add(evidence.id);
|
|
26262
26706
|
}
|
|
26263
|
-
for (const base of
|
|
26707
|
+
for (const base of basesByItem.get(item.id) ?? []) {
|
|
26264
26708
|
const ready = facts.filter((fact) => fact.requirement_id === item.id && fact.kind === "readiness" && fact.outcome === "success").map((fact) => fact.id);
|
|
26265
26709
|
if (!ready.length) continue;
|
|
26266
26710
|
actions.push({
|
|
@@ -26283,9 +26727,16 @@ function sessionCoreSnapshot(events, projection, displayOrigins) {
|
|
|
26283
26727
|
}
|
|
26284
26728
|
const latestText = rootText(latestRoot), latestDigest = hash(latestText);
|
|
26285
26729
|
const resume = isResume(latestText);
|
|
26730
|
+
const unitIdsByRootSeq = /* @__PURE__ */ new Map();
|
|
26731
|
+
for (const entry of projection.units.values()) for (const ref$1 of entry.rootInputRefs) {
|
|
26732
|
+
const bucket = unitIdsByRootSeq.get(ref$1.seq);
|
|
26733
|
+
if (bucket) {
|
|
26734
|
+
if (!bucket.includes(entry.unitId)) bucket.push(entry.unitId);
|
|
26735
|
+
} else unitIdsByRootSeq.set(ref$1.seq, [entry.unitId]);
|
|
26736
|
+
}
|
|
26286
26737
|
const selectedUnitAtRoot = (seq) => {
|
|
26287
|
-
const selected =
|
|
26288
|
-
return selected.length === 1 ? selected[0]
|
|
26738
|
+
const selected = unitIdsByRootSeq.get(seq) ?? [];
|
|
26739
|
+
return selected.length === 1 ? selected[0] : void 0;
|
|
26289
26740
|
};
|
|
26290
26741
|
const controls = rootControls(usedRoots, requirements, sources, facts, unit, selectedUnitAtRoot);
|
|
26291
26742
|
return {
|
|
@@ -26409,7 +26860,7 @@ function firstStepGuidance(policy = "standard") {
|
|
|
26409
26860
|
}
|
|
26410
26861
|
const FIRST_STEP_GUIDANCE = firstStepGuidance("standard");
|
|
26411
26862
|
function firstStepGuidanceV6(policy = "standard") {
|
|
26412
|
-
return "Context Guard
|
|
26863
|
+
return "Context Guard verifies requirements from persisted host results and independent readback. Use host tools for ordinary edits, tests and Git; read-only Guard observers and context_guard_checkpoint provide required certification. Older Guard action/evidence records are historical: they neither authorize nor certify current work." + (policy === "strict" ? " Explicit visual or complete-scope proof requires real readback." : "") + " Goal protection requires explicit /context-guard on adoption; adopted releases keep separate checks.";
|
|
26413
26864
|
}
|
|
26414
26865
|
/**
|
|
26415
26866
|
* Lifecycle phase derived from durable facts. `enabled` is the log-derived
|
|
@@ -27633,4 +28084,4 @@ const RC020_RC1_HOST_PACKAGES = packages.map(({ name, version: version$1, integr
|
|
|
27633
28084
|
}));
|
|
27634
28085
|
|
|
27635
28086
|
//#endregion
|
|
27636
|
-
export {
|
|
28087
|
+
export { segmentAuthorityBlocks as $, createHostAuditSession as $a, acquireHostTrust as $i, evidenceAvailabilityReason as $n, presentExplanationHead as $r, normalizeSettlement as $t, PROTOCOL_V3_NOTICE as A, parseHostVersion as Aa, packageRowsFromActiveGraph as Ai, certifiableOpenItems as An, clauseIsProtected as Ar, MIN_RECOVERY_CHAR_BUDGET as At, evidenceFromPersistedToolResult as B, STOP_PROTOCOL_VERSION_V2 as Ba, verifyComposedHostLockDump as Bi, createProjection as Bn, isExplanationScope as Br, renderRecoveryPacket as Bt, SESSION_API_UNSUPPORTED as C, HOST_VALIDATED_VERSIONS as Ca, evaluateActiveHostLock as Ci, observeAssistantOutcome as Cn, classifyUserInteraction as Cr, sessionQueryV2 as Ct, projectCoreV2 as D, SUPPORTED_HOST_VERSIONS as Da, injectActiveProfileHostLock as Di, goalCompletionDenial as Dn, clarifiedSpanOf as Dr, CLEANUP_CONDITION_RULE_COMPACT as Dt, snapshotSessionEvents as E, SUPPORTED_HOST_RANGE as Ea, hostLockRowsFromComposedDump as Ei, v6TestPredicate as En, actionVerbMatches as Er, CLEANUP_CONDITION_RULE as Et, deriveProjection as F, CERTIFICATE_VERSION as Fa, readActiveHostGraph as Fi, availableBoundaryQualifications as Fn, hasWorkPredicate as Fr, cleanupConditionFor as Ft, persistedToolResultStatus as G, requestedIdentityKey as Ga, hasDesktopImporterState as Gi, rebindAttemptKey as Gn, itemHoldsExecutionAuthority as Gr, sourceItemForCoreRequirement as Gt, extractToolSubject as H, actionCompatible as Ha, DESKTOP_PROFILE_PACKAGE_NAME as Hi, proposeRebind as Hn, isOpenObligation as Hr, confirmedV6CoreDiagnostic as Ht, legacyRecordsNeedingReview as I, CERTIFICATE_VERSION_V2 as Ia, resolveActiveProfileHostLock as Ii, effectuateBoundary as In, interpretClause as Ir, closingHint as It, canonicalArgvFromCommand as J, semanticActionFromCommand as Ja, readDesktopAppRuntime as Ji, CONFIRM_LINE_PATTERN as Jn, maskCodeSpans as Jr, RELEASE_OPERATION_SURFACES as Jt, shellReadbackOutcome as K, requestedTargetAuthorizesMutation as Ka, readAsarFile as Ki, rebindResponse as Kn, kindOfScope as Kr, OUTCOME_STRENGTH as Kt, rootLocatorFlavor as L, SEMANTIC_ACTIONS as La, resolveDesktopProfileHostLock as Li, isCurrentAcceptedBoundary as Ln, interpretMessage as Lr, openItems as Lt, PROTOCOL_V5_NOTICE as M, ACTION_MANIFEST as Ma, prepareActiveHostTrust as Mi, needsReviewObligations as Mn, governedClauseRestrictsExecution as Mr, V6_ORDINARY_COMPLETION_RULE_COMPACT as Mt, PROTOCOL_V6_NOTICE as N, ACTION_MANIFEST_VERSION as Na, prepareDesktopHostTrust as Ni, unitDescendantIds as Nn, hasOrderedCoordination as Nr, V6_ORDINARY_COMPLETION_RULE_SHORT as Nt, CAPTURE_V042_NOTICE as O, compareHostVersions as Oa, inspectDesktopTargetGraph as Oi, hasCurrentCertificate as On, clauseAsksOwnQuestion as Or, CLEANUP_CONDITION_RULE_SHORT as Ot, applyUpgradeEligibility as P, BOUNDED_ARTIFACT_TYPES as Pa, prepareTargetHostTrust as Pi, BOUNDARY_RECORD_PREFIX as Pn, hasQuestionScope as Pr, carriesCleanupCondition as Pt, authorityCaptureCounts as Q, RC020_RC2_HOST_PACKAGES as Qa, HostTrustError as Qi, deriveItemDiagnosis as Qn, opensWithDirective as Qr, normalizeReservation as Qt, supersedeItem as R, STATEFUL_ACTIONS as Ra, resolveInstalledHostLock as Ri, qualifyBoundary as Rn, introducesActionClause as Rr, recoveryDigest as Rt, sourcedNamedTestRoot as S, selectHostCohort as Sa, combineHostPolicy as Si, latestRootInstruction as Sn, classifyTaskIntent as Sr, sessionQuery as St, SessionApiError as T, MIN_SUPPORTED_HOST_VERSION as Ta, hostLockContextFromComposedDump as Ti, testOutcomePredicate as Tn, LEGACY_QUALIFICATION as Tr, validateProofManifestV2 as Tt, isDeterministicCheck as U, boundedArtifactChoiceMatches as Ua, DESKTOP_RUNTIME_PACKAGE_NAME as Ui, proposeRebindOutcome as Un, isQuestionScopeNeedingReview as Ur, currentV6Feedback as Ut, extractTextContent as V, SUPPORTED_EVIDENCE_ADAPTERS as Va, DESKTOP_IDENTITY_FACTS as Vi, confirmRebind as Vn, isInformationalFragment as Vr, v6CurrentRootBoundaries as Vt, nativeGitParentOidVerified as W, isStatefulAction as Wa, auditDesktopInstalledImplementation as Wi, proposeRebindV042 as Wn, isRestatement as Wr, isV6PendingRootWait as Wt, parsePwshCommand as X, validateActionManifest as Xa, readDesktopTargetGraph as Xi, parseConfirmationMessage as Xn, namedActions as Xr, inFlightReservation as Xt, isRunExecutable as Y, semanticActionFromText as Ya, readDesktopDependency as Yi, isFrozenV042RebindResponse as Yn, maskQuotedSpans as Yr, contractById as Yt, parseShellCommand as Z, validateActionTarget as Za, writeDesktopRuntimeReceipt as Zi, capabilityRemedyPhrase as Zn, opensConditionLead as Zr, normalizeReleaseContract as Zt, previewFirstStepInjection as _, evaluateGraphDerivedHostLock as _a, activeRendererModule as _i, decideTurnStopping as _n, extractOperation as _r, proofHostSurfacesOf as _t, commitTreeSnapshotDigest as a, ACTIVE_HOST_COHORT_ID as aa, splitTextFragments as ai, bindingSatisfies as an, admissibleForRemoval as ar, PROOF_MANIFEST_DOMAIN_V2 as at, HOST_WORKDIR_PREFIX as b, evaluateToolSurfaceCapability as ba, auditedForegroundRenderers as bi, isWholeTaskCompletionClaim as bn, canonicalRegistryBase as br, requiredSubjectsOf as bt, gitCommandMatchesTarget as c, BASE_HOST_PACKAGES as ca, COMMAND_SURFACE_MANIFEST as ci, isVerifyingCapability as cn, partialFailureOf as cr, bindProofToProjection as ct, verifiedLinearCommitReadback as d, GOAL_HOST_PACKAGES as da, digestStrings as di, NO_PROGRESS_TURNS_BEFORE_STOP as dn, captureClause as dr, createProofManifest as dt, hostTrustDigest as ea, qualificationOfClause as ei, readbackSettlesContract as en, itemDiagnosis as er, bindingIndividuallyAccepted as et, FIRST_STEP_GUIDANCE as f, HOST_CAPABILITY_PACKAGE_GROUPS as fa, normalizeClause as fi, assessmentAction as fn, captureItem as fr, createProofManifestV2 as ft, lifecyclePhase as g, evaluateExternalWaitCapability as ga, HostProfileError as gi, decideTurnBoundary as gn, extractMethod as gr, proofEvidenceConstraints as gt, firstStepGuidanceV6 as h, bindLiveGoalCapability as ha, sha256 as hi, currentActionBases as hn, extractArtifactPaths as hr, proofDigestV2 as ht, commitIndexSnapshotDigest as i, registryArchiveModules as ia, semanticActionOfScope as ii, reservationFor as in, actionHasCertificationPath as ir, PROOF_KINDS_V2 as it, PROTOCOL_V4_NOTICE as j, satisfiesSupportedHostRange as ja, packageRowsFromPnpmLock as ji, certificateClosure as jn, explanationHasActionResidue as jr, V6_ORDINARY_COMPLETION_RULE as jt, DEFAULT_DELEGATION_TOOL_NAMES as k, evaluateMinimumHostVersion as ka, inspectTargetHostGraph as ki, ancestorConstraintForBinding as kn, clauseIsGoverned as kr, DEFAULT_RECOVERY_CHAR_BUDGET as kt, parseGitCommandManifest as l, DEFAULT_HOST_LOCK as la, validateManifest as li, CONTROL_RECORD_PREFIX as ln, removalIsComplete as lr, bindProofV2ToProjection as lt, firstStepGuidance as m, bindExecutableIdentity as ma, sanitizeUrl as mi, classifyCompletionClaim as mn, environmentDefaultRepositoryTarget as mr, proofDigest as mt, GIT_COMMAND_MANIFEST_IDS as n, qualifyHostTrust as na, reportingHeadGoverns as ni, releaseCoverage as nn, relevantEvidence as nr, PROOF_CAPABILITY_MATRIX as nt, createGitPrestateEnvelope as o, ACTIVE_HOST_COHORT_IDS as oa, statefulActionsOfScope as oi, evidenceCoverage as on, capabilityConsequence as or, PROOF_PROTOCOL_VERSION as ot, claimedBatchHasRealRootInput as p, HOST_COHORTS as pa, sanitizeClauseText as pi, assessmentOutcomePredicate as pn, classifyClause as pr, proofCapabilityReport as pt, withDurability as q, requestedTargetMatchesResolved as qa, readAsarIndex as qi, replayRebindResult as qn, legacyQuestionReadingIsInformational as qr, RELEASE_OPERATIONS as qt, GIT_COMMAND_TEMPLATES as r, registryArchiveFiles as ra, restatedContentOf as ri, releasePreEffectDecision as rn, DEPENDENCY_FREE_ONLY_CONDITION as rr, PROOF_KINDS as rt, executeRevalidatedGitEffect as s, ACTIVE_HOST_LAUNCHER_VERSION as sa, verbIsNegated as si, evidenceMatchesItem as sn, capabilityFactOf as sr, PROOF_PROTOCOL_VERSION_V2 as st, RC020_RC1_HOST_PACKAGES as t, parseHostTrust as ta, questionHeadsClause as ti, releaseContractFor as tn, nativeFileTwoRole as tr, certifyCheckpoint as tt, revalidateGitPrestate as u, EXPECTED_HOST_PACKAGES as ua, canonicalizePath as ui, NO_PROGRESS_RECORD_PREFIX as un, removalIsPartiallyKnown as ur, canonicalProjection as ut, projectSessionCoreV2 as v, evaluateHostCapability as va, auditedDefaultWorkdirHost as vi, decisionBoundaryKey as vn, isInformationalMessage as vr, proofOperationMatches as vt, SESSION_EVENT_ENVELOPE_INVALID as w, LATEST_TESTED_HOST_VERSION as wa, evaluateConfiguredHostLock as wi, progressFingerprint as wn, GRANTED_QUALIFICATION as wr, validateProofManifest as wt, captureHostWorkdir as x, hostVersionFromPackages as xa, auditedHostImplementation as xi, latestAssistantText as xn, npmEscapedPackageName as xr, scopeCoverageDigest as xt, sessionCoreSnapshot as y, evaluateHostLock as ya, auditedDefaultWorkdirProvider as yi, isRootPauseRequest as yn, segmentClauses as yr, proofV2Rejection as yt, NATIVE_GIT_ROOT_PARENT_OID as z, STOP_PROTOCOL_VERSION as za, revalidateDesktopCoreLock as zi, currentContractDigest as zn, isExecutableItem as zr, recoveryTitle as zt };
|