dsh-completion-guard 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as isDeterministicCheck, $n as deriveItemDiagnosis, $t as proofDigestV2, A as previewFirstStepInjection, An as isWholeTaskCompletionClaim, Ar as STOP_PROTOCOL_VERSION_V2, At as evaluateMinimumHostVersion, B as RELEASE_SETTLEMENT_PREFIX, Bn as qualifyBoundary, Br as validateActionManifest, Bt as PROOF_CAPABILITY_MATRIX, C as gitCommandMatchesTarget, Cn as NO_PROGRESS_RECORD_PREFIX, Cr as ACTION_MANIFEST_VERSION, Ct as hostVersionFromPackages, D as FIRST_STEP_GUIDANCE, Dn as decideTurnStopping, Dr as SEMANTIC_ACTIONS, Dt as SUPPORTED_HOST_RANGE, E as verifiedLinearCommitReadback, En as decideTurnBoundary, Er as CERTIFICATE_VERSION_V2, Et as MIN_SUPPORTED_HOST_VERSION, F as PROTOCOL_V5_NOTICE, Fn as goalCompletionDenial, Fr as requestedIdentityKey, Ft as RC1_HOST_PACKAGES, G as releaseContractFor, Gn as proposeRebindOutcome, Gr as classifyUserInteraction, Gt as PROOF_PROTOCOL_VERSION_V2, H as inFlightReservation, Hn as createProjection, Hr as COMMAND_SURFACE_MANIFEST, Ht as PROOF_KINDS_V2, I as deriveProjection, In as hasCurrentCertificate, Ir as requestedTargetAuthorizesMutation, It as ALPHA3_HOST_PACKAGES, J as reservationFor, Jn as rebindResponse, Jr as normalizeClause, Jt as canonicalProjection, K as releaseCoverage, Kn as proposeRebindV042, Kr as canonicalizePath, Kt as bindProofToProjection, L as RELEASE_OPERATIONS, Ln as availableBoundaryQualifications, Lr as requestedTargetMatchesResolved, Lt as authorityCaptureCounts, M as DEFAULT_DELEGATION_TOOL_NAMES, Mn as latestRootInstruction, Mr as actionCompatible, Mt as satisfiesSupportedHostRange, N as PROTOCOL_V3_NOTICE, Nn as observeAssistantOutcome, Nr as boundedArtifactChoiceMatches, Nt as RC015_RC2_HOST_PACKAGES, O as claimedBatchHasRealRootInput, On as decisionBoundaryKey, Or as STATEFUL_ACTIONS, Ot as SUPPORTED_HOST_VERSIONS, P as PROTOCOL_V4_NOTICE, Pn as progressFingerprint, Pr as isStatefulAction, Pt as RC015_HOST_PACKAGES, Q as extractToolSubject, Qn as parseConfirmationMessage, Qt as proofDigest, R as RELEASE_OPERATION_SURFACES, Rn as effectuateBoundary, Rr as semanticActionFromCommand, Rt as segmentAuthorityBlocks, S as executeRevalidatedGitEffect, Sn as CONTROL_RECORD_PREFIX, Sr as ACTION_MANIFEST, St as evaluateToolSurfaceCapability, T as revalidateGitPrestate, Tn as classifyCompletionClaim, Tr as CERTIFICATE_VERSION, Tt as LATEST_SUPPORTED_HOST_VERSION, U as normalizeReleaseContract, Un as confirmRebind, Ur as validateManifest, Ut as PROOF_MANIFEST_DOMAIN_V2, V as contractById, Vn as currentContractDigest, Vr as validateActionTarget, Vt as PROOF_KINDS, W as readbackSettlesContract, Wn as proposeRebind, Wr as classifyTaskIntent, Wt as PROOF_PROTOCOL_VERSION, X as evidenceFromPersistedToolResult, Xn as CONFIRM_LINE_PATTERN, Xr as sanitizeUrl, Xt as createProofManifestV2, Y as supersedeItem, Yn as replayRebindResult, Yr as sanitizeClauseText, Yt as createProofManifest, Z as extractTextContent, Zn as isFrozenV042RebindResponse, Zr as sha256, Zt as proofCapabilityReport, _ as GIT_COMMAND_MANIFEST_IDS, _n as renderRecoveryPacket, _r as namedActions, _t as bindExecutableIdentity, a as injectActiveProfileHostLock, an as scopeCoverageDigest, ar as classifyClause, at as ACTIVE_HOST_COHORT_ID, b as commitTreeSnapshotDigest, bn as evidenceMatchesItem, br as canonicalRegistryBase, bt as evaluateHostCapability, c as packageRowsFromPnpmLock, cn as validateProofManifest, cr as extractOperation, ct as ALPHA2_DSHMARKET_139_HOST_PACKAGES, d as resolveInstalledHostLock, dn as certificateClosure, dr as interpretClause, dt as DEFAULT_HOST_LOCK, en as proofEvidenceConstraints, er as evidenceAvailabilityReason, et as withDurability, f as verifyComposedHostLockDump, fn as DEFAULT_RECOVERY_CHAR_BUDGET, fr as interpretMessage, ft as EXPECTED_HOST_PACKAGES, g as snapshotSessionEvents, gn as recoveryDigest, gr as maskCodeSpans, gt as LEGACY_HOST_COHORTS, h as SessionApiError, hn as openItems, hr as kindOfScope, ht as HOST_COHORTS, i as hostLockRowsFromComposedDump, in as requiredSubjectsOf, ir as captureItem, it as parseShellCommand, j as CAPTURE_V042_NOTICE, jn as latestAssistantText, jr as SUPPORTED_EVIDENCE_ADAPTERS, jt as parseHostVersion, k as lifecyclePhase, kn as isRootPauseRequest, kr as STOP_PROTOCOL_VERSION, kt as compareHostVersions, l as readActiveHostGraph, ln as validateProofManifestV2, lr as isInformationalMessage, lt as ALPHA2_HOST_PACKAGES, m as SESSION_EVENT_ENVELOPE_INVALID, mn as closingHint, mr as isOpenObligation, mt as HOST_CAPABILITY_PACKAGE_GROUPS, n as combineHostPolicy, nn as proofOperationMatches, nr as relevantEvidence, nt as isRunExecutable, o as inspectTargetHostGraph, on as sessionQuery, or as extractArtifactPaths, ot as ACTIVE_HOST_COHORT_IDS, p as SESSION_API_UNSUPPORTED, pn as MIN_RECOVERY_CHAR_BUDGET, pr as isExecutableItem, pt as GOAL_HOST_PACKAGES, q as releasePreEffectDecision, qn as rebindAttemptKey, qr as digestStrings, qt as bindProofV2ToProjection, r as hostLockContextFromComposedDump, rn as proofV2Rejection, rr as captureClause, rt as parsePwshCommand, s as packageRowsFromActiveGraph, sn as sessionQueryV2, sr as extractMethod, st as ACTIVE_HOST_LAUNCHER_VERSION, t as HostProfileError, tn as proofHostSurfacesOf, tr as itemDiagnosis, tt as canonicalArgvFromCommand, u as resolveActiveProfileHostLock, un as certifiableOpenItems, ur as segmentClauses, ut as BASE_HOST_PACKAGES, v as GIT_COMMAND_TEMPLATES, vn as bindingSatisfies, vr as semanticActionOfScope, vt as bindLiveGoalCapability, w as parseGitCommandManifest, wn as NO_PROGRESS_TURNS_BEFORE_STOP, wr as BOUNDED_ARTIFACT_TYPES, wt as selectHostCohort, x as createGitPrestateEnvelope, xn as isVerifyingCapability, xr as npmEscapedPackageName, xt as evaluateHostLock, y as commitIndexSnapshotDigest, yn as evidenceCoverage, yr as statefulActionsOfScope, yt as evaluateExternalWaitCapability, z as RELEASE_RESERVATION_PREFIX, zn as isCurrentAcceptedBoundary, zr as semanticActionFromText, zt as certifyCheckpoint } from "./domain-COehX7MB.js";
1
+ import { $ as extractToolSubject, $n as isFrozenV042RebindResponse, $r as sha256, $t as proofDigest, A as lifecyclePhase, An as decisionBoundaryKey, Ar as STATEFUL_ACTIONS, At as compareHostVersions, B as RELEASE_RESERVATION_PREFIX, Bn as effectuateBoundary, Br as semanticActionFromCommand, Bt as certifyCheckpoint, C as gitCommandMatchesTarget, Cn as isVerifyingCapability, Cr as npmEscapedPackageName, Ct as evaluateToolSurfaceCapability, D as FIRST_STEP_GUIDANCE, Dn as classifyCompletionClaim, Dr as CERTIFICATE_VERSION, Dt as MIN_SUPPORTED_HOST_VERSION, E as verifiedLinearCommitReadback, En as NO_PROGRESS_TURNS_BEFORE_STOP, Er as BOUNDED_ARTIFACT_TYPES, Et as LATEST_SUPPORTED_HOST_VERSION, F as PROTOCOL_V4_NOTICE, Fn as observeAssistantOutcome, Fr as boundedArtifactChoiceMatches, Ft as RC015_HOST_PACKAGES, G as readbackSettlesContract, Gn as confirmRebind, Gr as validateManifest, Gt as PROOF_PROTOCOL_VERSION, H as contractById, Hn as qualifyBoundary, Hr as validateActionManifest, Ht as PROOF_KINDS, I as PROTOCOL_V5_NOTICE, In as progressFingerprint, Ir as isStatefulAction, It as RC1_HOST_PACKAGES, J as releasePreEffectDecision, Jn as proposeRebindV042, Jr as canonicalizePath, Jt as bindProofV2ToProjection, K as releaseContractFor, Kn as proposeRebind, Kr as classifyTaskIntent, Kt as PROOF_PROTOCOL_VERSION_V2, L as deriveProjection, Ln as goalCompletionDenial, Lr as requestedIdentityKey, Lt as ALPHA3_HOST_PACKAGES, M as CAPTURE_V042_NOTICE, Mn as isWholeTaskCompletionClaim, Mr as STOP_PROTOCOL_VERSION_V2, Mt as parseHostVersion, N as DEFAULT_DELEGATION_TOOL_NAMES, Nn as latestAssistantText, Nr as SUPPORTED_EVIDENCE_ADAPTERS, Nt as satisfiesSupportedHostRange, O as claimedBatchHasRealRootInput, On as decideTurnBoundary, Or as CERTIFICATE_VERSION_V2, Ot as SUPPORTED_HOST_RANGE, P as PROTOCOL_V3_NOTICE, Pn as latestRootInstruction, Pr as actionCompatible, Pt as RC015_RC2_HOST_PACKAGES, Q as extractTextContent, Qn as CONFIRM_LINE_PATTERN, Qr as sanitizeUrl, Qt as proofCapabilityReport, R as RELEASE_OPERATIONS, Rn as hasCurrentCertificate, Rr as requestedTargetAuthorizesMutation, Rt as authorityCaptureCounts, S as executeRevalidatedGitEffect, Sn as evidenceMatchesItem, Sr as canonicalRegistryBase, St as evaluateHostLock, T as revalidateGitPrestate, Tn as NO_PROGRESS_RECORD_PREFIX, Tr as ACTION_MANIFEST_VERSION, Tt as selectHostCohort, U as inFlightReservation, Un as currentContractDigest, Ur as validateActionTarget, Ut as PROOF_KINDS_V2, V as RELEASE_SETTLEMENT_PREFIX, Vn as isCurrentAcceptedBoundary, Vr as semanticActionFromText, Vt as PROOF_CAPABILITY_MATRIX, W as normalizeReleaseContract, Wn as createProjection, Wr as COMMAND_SURFACE_MANIFEST, Wt as PROOF_MANIFEST_DOMAIN_V2, X as supersedeItem, Xn as rebindResponse, Xr as normalizeClause, Xt as createProofManifest, Y as reservationFor, Yn as rebindAttemptKey, Yr as digestStrings, Yt as canonicalProjection, Z as evidenceFromPersistedToolResult, Zn as replayRebindResult, Zr as sanitizeClauseText, Zt as createProofManifestV2, _ as GIT_COMMAND_MANIFEST_IDS, _n as openItems, _r as kindOfScope, _t as LEGACY_HOST_COHORTS, a as injectActiveProfileHostLock, an as requiredSubjectsOf, ar as captureClause, at as parseShellCommand, b as commitTreeSnapshotDigest, bn as bindingSatisfies, br as semanticActionOfScope, bt as evaluateExternalWaitCapability, c as packageRowsFromPnpmLock, cn as sessionQueryV2, cr as extractArtifactPaths, ct as ACTIVE_HOST_LAUNCHER_VERSION, d as resolveInstalledHostLock, dn as certifiableOpenItems, dr as isInformationalMessage, dt as BASE_HOST_PACKAGES, en as proofDigestV2, er as parseConfirmationMessage, et as isDeterministicCheck, f as verifyComposedHostLockDump, fn as certificateClosure, fr as segmentClauses, ft as DEFAULT_HOST_LOCK, g as snapshotSessionEvents, gn as closingHint, gr as isOpenObligation, gt as HOST_COHORTS, h as SessionApiError, hn as MIN_RECOVERY_CHAR_BUDGET, hr as isExecutableItem, ht as HOST_CAPABILITY_PACKAGE_GROUPS, i as hostLockRowsFromComposedDump, in as proofV2Rejection, ir as relevantEvidence, it as parsePwshCommand, j as previewFirstStepInjection, jn as isRootPauseRequest, jr as STOP_PROTOCOL_VERSION, jt as evaluateMinimumHostVersion, k as firstStepGuidance, kn as decideTurnStopping, kr as SEMANTIC_ACTIONS, kt as SUPPORTED_HOST_VERSIONS, l as readActiveHostGraph, ln as validateProofManifest, lr as extractMethod, lt as ALPHA2_DSHMARKET_139_HOST_PACKAGES, m as SESSION_EVENT_ENVELOPE_INVALID, mn as DEFAULT_RECOVERY_CHAR_BUDGET, mr as interpretMessage, mt as GOAL_HOST_PACKAGES, n as combineHostPolicy, nn as proofHostSurfacesOf, nr as evidenceAvailabilityReason, nt as canonicalArgvFromCommand, o as inspectTargetHostGraph, on as scopeCoverageDigest, or as captureItem, ot as ACTIVE_HOST_COHORT_ID, p as SESSION_API_UNSUPPORTED, pn as unitDescendantIds, pr as interpretClause, pt as EXPECTED_HOST_PACKAGES, q as releaseCoverage, qn as proposeRebindOutcome, qr as classifyUserInteraction, qt as bindProofToProjection, r as hostLockContextFromComposedDump, rn as proofOperationMatches, rr as itemDiagnosis, rt as isRunExecutable, s as packageRowsFromActiveGraph, sn as sessionQuery, sr as classifyClause, st as ACTIVE_HOST_COHORT_IDS, t as HostProfileError, tn as proofEvidenceConstraints, tr as deriveItemDiagnosis, tt as withDurability, u as resolveActiveProfileHostLock, un as validateProofManifestV2, ur as extractOperation, ut as ALPHA2_HOST_PACKAGES, v as GIT_COMMAND_TEMPLATES, vn as recoveryDigest, vr as maskCodeSpans, vt as bindExecutableIdentity, w as parseGitCommandManifest, wn as CONTROL_RECORD_PREFIX, wr as ACTION_MANIFEST, wt as hostVersionFromPackages, x as createGitPrestateEnvelope, xn as evidenceCoverage, xr as statefulActionsOfScope, xt as evaluateHostCapability, y as commitIndexSnapshotDigest, yn as renderRecoveryPacket, yr as namedActions, yt as bindLiveGoalCapability, z as RELEASE_OPERATION_SURFACES, zn as availableBoundaryQualifications, zr as requestedTargetMatchesResolved, zt as segmentAuthorityBlocks } from "./domain-DKr8sLZZ.js";
2
2
  import { defineTool } from "@deepseek-ai/dsh-tools";
3
3
  import { createHash } from "node:crypto";
4
4
  import { basename, delimiter, dirname, isAbsolute, join, resolve } from "node:path";
@@ -1101,6 +1101,22 @@ function actionPreparation(action) {
1101
1101
  //#region src/tools/prepare.ts
1102
1102
  /** Discovery pages stay bounded like checkpoint pages. */
1103
1103
  const DISCOVERY_ITEM_LIMIT = 8;
1104
+ const encodeCursor = (cursor) => Buffer.from(JSON.stringify(cursor), "utf8").toString("base64url");
1105
+ /**
1106
+ * The items discovery lists for the CURRENT work: under a v5 boundary that is
1107
+ * the current unit's closure plus its required descendants (the same scope a
1108
+ * v2 certificate answers for, prohibitions included because a standing
1109
+ * constraint is never finished work) plus every pre-v5 obligation, which keeps
1110
+ * their birth rules and must never be silently dropped. A legacy session lists
1111
+ * the whole session. Switched-away sibling units keep their own history and
1112
+ * are reached by item ID, not re-listed here (0.6.1, W060-03).
1113
+ */
1114
+ function discoveryItemIds(p) {
1115
+ const pending = [...p.items.values()].filter((item) => item.status === "pending").sort((a, b) => a.revision - b.revision || a.id.localeCompare(b.id));
1116
+ if (p.boundaryProtocol !== 5) return pending.map((item) => item.id);
1117
+ const closureUnits = new Set([...p.currentUnitId !== void 0 ? [p.currentUnitId, ...unitDescendantIds(p, p.currentUnitId)] : []]);
1118
+ return pending.filter((item) => item.unitId === void 0 || item.unitId !== void 0 && closureUnits.has(item.unitId)).map((item) => item.id);
1119
+ }
1104
1120
  /**
1105
1121
  * Thin READ-ONLY preparation surface (v0.5/0.6): before any stateful action it
1106
1122
  * reports the supported command shape, the required resolution/effect/state
@@ -1113,7 +1129,7 @@ const DISCOVERY_ITEM_LIMIT = 8;
1113
1129
  function createPrepareTool(options) {
1114
1130
  return defineTool({
1115
1131
  name: "context_guard_prepare",
1116
- description: "Read-only pre-action preparation: report the supported command shape, required resolution/effect/state evidence order, existing references, and exact missing target fields for one contract item. Omit item_id to list current open items with their IDs. Performs no action and grants no authority.",
1132
+ description: "Read-only pre-action preparation: report the supported command shape, required evidence order, existing references, and exact missing target fields for one contract item. Omit item_id to list current open items with their IDs; a stateful change needs resolution/effect/state, a read-only verification needs one matching fact. Pagination follows page_cursor (bound to the contract revision) and semantic_action filters the listing. Performs no action and grants no authority.",
1117
1133
  parameters: {
1118
1134
  item_id: { type: "string" },
1119
1135
  item_revision: { type: "number" },
@@ -1122,7 +1138,8 @@ function createPrepareTool(options) {
1122
1138
  type: "object",
1123
1139
  additionalProperties: true
1124
1140
  },
1125
- planned_operation: { type: "string" }
1141
+ planned_operation: { type: "string" },
1142
+ page_cursor: { type: "string" }
1126
1143
  },
1127
1144
  output: {
1128
1145
  schema: {
@@ -1154,14 +1171,44 @@ function createPrepareTool(options) {
1154
1171
  reason_code: "guard_unavailable"
1155
1172
  };
1156
1173
  if (args.item_id === void 0) {
1157
- const open = [...p.items.values()].filter((item$1) => item$1.status === "pending").sort((a, b) => a.revision - b.revision || a.id.localeCompare(b.id));
1174
+ const filter = args.semantic_action ?? null;
1175
+ const invalidCursor = (reason_code, note) => ({
1176
+ status: "rejected",
1177
+ reason_code,
1178
+ mode: "discovery",
1179
+ contract_revision: p.contractRevision,
1180
+ ...note !== void 0 ? { note } : { note: "Re-run discovery without page_cursor to list from the first page." }
1181
+ });
1182
+ let startAfter;
1183
+ if (args.page_cursor !== void 0) {
1184
+ let parsed;
1185
+ try {
1186
+ if (args.page_cursor.length <= 1024) {
1187
+ const value = JSON.parse(Buffer.from(args.page_cursor, "base64url").toString("utf8"));
1188
+ if (value?.v === 1 && Number.isSafeInteger(value.r) && (value.f === null || typeof value.f === "string") && Array.isArray(value.k) && Number.isSafeInteger(value.k[0]) && typeof value.k[1] === "string") parsed = value;
1189
+ }
1190
+ } catch {
1191
+ parsed = void 0;
1192
+ }
1193
+ if (!parsed) return invalidCursor("discovery_cursor_malformed");
1194
+ if (parsed.r !== p.contractRevision) return invalidCursor("discovery_cursor_stale", `The contract changed (cursor revision ${parsed.r}, current ${p.contractRevision}). Re-run discovery without page_cursor; items are never skipped by a stale page.`);
1195
+ if ((parsed.f ?? null) !== (filter ?? null)) return invalidCursor("discovery_cursor_filter_mismatch");
1196
+ startAfter = parsed.k;
1197
+ }
1198
+ const eligible = discoveryItemIds(p).map((id) => p.items.get(id)).filter((item$1) => filter === null || (item$1.semanticAction ?? "generic_run") === filter);
1199
+ const startIndex = startAfter === void 0 ? 0 : eligible.findIndex((item$1) => item$1.revision === startAfter[0] && item$1.id === startAfter[1]) + 1;
1200
+ if (startAfter !== void 0 && startIndex <= 0) return invalidCursor("discovery_cursor_stale", "The cursor names an item no longer in the current listing. Re-run discovery without page_cursor.");
1201
+ const page = eligible.slice(startIndex, startIndex + DISCOVERY_ITEM_LIMIT);
1202
+ const hasMore = startIndex + page.length < eligible.length;
1158
1203
  return {
1159
1204
  status: "prepared",
1160
1205
  mode: "discovery",
1161
1206
  durability: p.durabilityWatermark,
1162
1207
  contract_revision: p.contractRevision,
1163
- total_open: open.length,
1164
- items: open.slice(0, DISCOVERY_ITEM_LIMIT).map((item$1) => {
1208
+ total_open: eligible.length,
1209
+ listed: page.length,
1210
+ has_more: hasMore,
1211
+ items: page.map((item$1) => {
1165
1212
  const diagnosis$1 = deriveItemDiagnosis(p, item$1);
1166
1213
  return {
1167
1214
  id: item$1.id,
@@ -1173,7 +1220,14 @@ function createPrepareTool(options) {
1173
1220
  text: item$1.normalizedText
1174
1221
  };
1175
1222
  }),
1176
- note: "Re-run with one item_id to prepare that item. Preparation performs no action."
1223
+ ...hasMore ? { next_cursor: encodeCursor({
1224
+ v: 1,
1225
+ r: p.contractRevision,
1226
+ f: filter,
1227
+ k: [page[page.length - 1].revision, page[page.length - 1].id]
1228
+ }) } : {},
1229
+ ...filter !== null ? { filtered_by: { semantic_action: filter } } : {},
1230
+ note: "Re-run with one item_id to prepare that item, or pass page_cursor for the next page. Preparation performs no action."
1177
1231
  };
1178
1232
  }
1179
1233
  const item = p.items.get(args.item_id ?? "");
@@ -1200,11 +1254,11 @@ function createPrepareTool(options) {
1200
1254
  resolved_target: evidence.resolvedTarget,
1201
1255
  tool_result_seq: evidence.toolResultSeq
1202
1256
  }));
1203
- const requiredOrder = manifestEntry?.stateful ? [
1257
+ const requiredOrder = plannedAction && isStatefulAction(plannedAction) ? [
1204
1258
  "resolution (prestate facts from a trusted read)",
1205
1259
  "effect (the exact planned change)",
1206
1260
  "state (independent post-state readback)"
1207
- ] : ["state (matching durable evidence for the requested verification)"];
1261
+ ] : ["effect (one matching durable verification fact)"];
1208
1262
  const recipe = plannedAction && isStatefulAction(plannedAction) ? actionPreparation(plannedAction) : void 0;
1209
1263
  const missingTargetFields = recipe ? recipe.selector_fields.filter((key) => !(item.requestedTarget?.[key] !== void 0 || args.requested_target?.[key] !== void 0)) : [];
1210
1264
  const capability = plannedAction && options.hostCapability ? options.hostCapability(plannedAction) : void 0;
@@ -1243,6 +1297,145 @@ function createPrepareTool(options) {
1243
1297
  });
1244
1298
  }
1245
1299
 
1300
+ //#endregion
1301
+ //#region src/tools/interpret.ts
1302
+ function parsePartition(args, extent) {
1303
+ const read = (key) => {
1304
+ const raw = args[key];
1305
+ if (raw === void 0) return void 0;
1306
+ if (!Array.isArray(raw)) return void 0;
1307
+ const spans = [];
1308
+ for (const entry of raw) {
1309
+ const record$1 = entry;
1310
+ const start = record$1?.start;
1311
+ const end = record$1?.end;
1312
+ if (typeof start !== "number" || !Number.isSafeInteger(start) || typeof end !== "number" || !Number.isSafeInteger(end) || start >= end) return void 0;
1313
+ spans.push({
1314
+ start,
1315
+ end
1316
+ });
1317
+ }
1318
+ return spans;
1319
+ };
1320
+ const information = read("information_spans");
1321
+ const unknown = read("unknown_spans");
1322
+ if (information === void 0 || unknown === void 0) return { error: "interpretation_partition_required" };
1323
+ if (information.length === 0) return { error: "interpretation_partition_required" };
1324
+ const all = [...information, ...unknown];
1325
+ for (const span of all) if (span.start < extent.start || span.end > extent.end) return { error: "interpretation_span_outside_input" };
1326
+ const ordered = [...all].sort((left, right) => left.start - right.start || left.end - right.end);
1327
+ for (let index = 1; index < ordered.length; index += 1) if (ordered[index].start < ordered[index - 1].end) return { error: "interpretation_spans_overlap" };
1328
+ return {
1329
+ information,
1330
+ unknown
1331
+ };
1332
+ }
1333
+ /** The byte extent that covers every source span of one item. */
1334
+ function itemExtent(spans) {
1335
+ return {
1336
+ start: Math.min(...spans.map((span) => span.start)),
1337
+ end: Math.max(...spans.map((span) => span.end))
1338
+ };
1339
+ }
1340
+ function createInterpretTool(options) {
1341
+ return defineTool({
1342
+ name: "context_guard_interpret",
1343
+ description: "Record the interpretation of one unresolved obligation: pass the item ID from context_guard_prepare plus the partition of its input spans you read as information (information_spans) and the sub-spans you could not resolve (unknown_spans); for an attached asset, the partition is unnecessary. Contract bookkeeping only — performs no action, grants no authority. Information sub-spans close when this turn's host-confirmed final answer is delivered; unknown sub-spans remain pending obligations. Correctness is never certified.",
1344
+ parameters: {
1345
+ item_id: {
1346
+ type: "string",
1347
+ required: true
1348
+ },
1349
+ information_spans: {
1350
+ type: "array",
1351
+ items: {
1352
+ type: "object",
1353
+ additionalProperties: true
1354
+ }
1355
+ },
1356
+ unknown_spans: {
1357
+ type: "array",
1358
+ items: {
1359
+ type: "object",
1360
+ additionalProperties: true
1361
+ }
1362
+ }
1363
+ },
1364
+ output: {
1365
+ schema: {
1366
+ type: "object",
1367
+ additionalProperties: true
1368
+ },
1369
+ render: (_args, value) => [{
1370
+ type: "text",
1371
+ text: JSON.stringify(value)
1372
+ }]
1373
+ },
1374
+ async execute(rawArgs) {
1375
+ const args = rawArgs;
1376
+ const reject = (reason_code) => ({
1377
+ status: "rejected",
1378
+ reason_code
1379
+ });
1380
+ if (options.refreshProjection) {
1381
+ let durable = false;
1382
+ try {
1383
+ durable = await options.refreshProjection() === true;
1384
+ } catch {
1385
+ durable = false;
1386
+ }
1387
+ if (!durable) return {
1388
+ status: "unknown",
1389
+ reason_code: "projection_durability_unavailable"
1390
+ };
1391
+ }
1392
+ const p = options.getProjection();
1393
+ if (!p || !p.enabled || p.integrity !== "valid") return reject("guard_unavailable");
1394
+ const itemId = typeof args.item_id === "string" ? args.item_id.trim() : "";
1395
+ if (!itemId) return reject("item_not_found");
1396
+ const item = p.items.get(itemId);
1397
+ if (!item) return reject("item_not_found");
1398
+ if (item.status !== "pending") return reject("item_not_pending");
1399
+ if (!item.asset && item.authorityDisposition !== "unresolved") return reject("not_interpretable");
1400
+ if (item.asset) return {
1401
+ status: "recorded",
1402
+ item_id: item.id,
1403
+ item_revision: item.revision,
1404
+ kind: "asset",
1405
+ asset: {
1406
+ message_seq: item.asset.messageSeq,
1407
+ part_index: item.asset.partIndex,
1408
+ media_sha256: item.asset.mediaSha256
1409
+ },
1410
+ note: "Interpretation recorded for this asset obligation. It closes when the host-confirmed final answer of this interpreting turn is delivered; this record never certifies the interpretation's correctness and never authorizes or proves any execution."
1411
+ };
1412
+ if (!item.spans || item.spans.length === 0) return reject("item_spans_unavailable");
1413
+ const partition = parsePartition(args, itemExtent(item.spans));
1414
+ if ("error" in partition) return reject(partition.error);
1415
+ return {
1416
+ status: "recorded",
1417
+ item_id: item.id,
1418
+ item_revision: item.revision,
1419
+ kind: "clause",
1420
+ spans: item.spans.map((span) => ({
1421
+ part_index: span.partIndex,
1422
+ start: span.start,
1423
+ end: span.end
1424
+ })),
1425
+ information_spans: partition.information.map((span) => ({
1426
+ start: span.start,
1427
+ end: span.end
1428
+ })),
1429
+ unknown_spans: partition.unknown.map((span) => ({
1430
+ start: span.start,
1431
+ end: span.end
1432
+ })),
1433
+ note: "Interpretation partition recorded for this unresolved clause: information sub-spans close when the host-confirmed final answer of this interpreting turn is delivered; every unknown sub-span remains a pending obligation and must still be resolved or performed. This record never certifies correctness and never authorizes any execution."
1434
+ };
1435
+ }
1436
+ });
1437
+ }
1438
+
1246
1439
  //#endregion
1247
1440
  //#region src/tools/evidence.ts
1248
1441
  const execFileAsync = promisify(execFile);
@@ -1836,7 +2029,7 @@ async function executeGuardAction(action, resolution, roots, signal, executableI
1836
2029
  if (action === "install" || action === "apply") {
1837
2030
  const tgzPath = requireString(resolution.commandManifest, "tgz_path");
1838
2031
  const identity = tgzPath ? await tgzIdentity(tgzPath) : void 0;
1839
- if (!executableIdentity$1 || !tgzPath || !identity || identity.name !== target.package_id || identity.version !== target.version || identity.integrity !== target.integrity_digest || roots.profile?.name !== target.profile) return "unavailable";
2032
+ if (!executableIdentity$1 || !tgzPath || !identity || identity.name !== target.package_id || identity.version !== target.version || identity.integrity !== target.integrity_digest || roots.profile?.name !== target.profile) return { status: "unavailable" };
1840
2033
  await runCommand(roots, executableIdentity$1, [
1841
2034
  "plugin",
1842
2035
  "--profile",
@@ -1844,13 +2037,13 @@ async function executeGuardAction(action, resolution, roots, signal, executableI
1844
2037
  "add",
1845
2038
  `file:${tgzPath}`
1846
2039
  ], void 0, signal);
1847
- return "completed";
2040
+ return { status: "completed" };
1848
2041
  }
1849
2042
  if (action === "publish") {
1850
2043
  const tgzPath = requireString(resolution.commandManifest, "tgz_path");
1851
2044
  const identity = tgzPath ? await tgzIdentity(tgzPath) : void 0;
1852
2045
  const registry = typeof target.registry === "string" ? canonicalRegistryBase(target.registry, { allowLoopbackHttp: roots.allowLoopbackHttpRegistry }) : void 0;
1853
- if (!executableIdentity$1 || !tgzPath || !identity || identity.name !== target.artifact_id || identity.version !== target.version || identity.integrity !== target.integrity_digest || !registry || registry !== target.registry) return "unavailable";
2046
+ if (!executableIdentity$1 || !tgzPath || !identity || identity.name !== target.artifact_id || identity.version !== target.version || identity.integrity !== target.integrity_digest || !registry || registry !== target.registry) return { status: "unavailable" };
1854
2047
  await runCommand(roots, executableIdentity$1, [
1855
2048
  "publish",
1856
2049
  tgzPath,
@@ -1858,19 +2051,19 @@ async function executeGuardAction(action, resolution, roots, signal, executableI
1858
2051
  registry,
1859
2052
  "--ignore-scripts"
1860
2053
  ], void 0, signal);
1861
- return "completed";
2054
+ return { status: "completed" };
1862
2055
  }
1863
2056
  if (action === "restart") {
1864
2057
  const capabilities = await marketCapabilities(roots, signal);
1865
- if (!capabilities || !roots.marketOrigin || !resolutionCallId || !agent) return "unavailable";
1866
- if (!sameMarketProvider(target.pre_generation, capabilities.generation)) return "unavailable";
1867
- if (capabilities.generation !== target.pre_generation) return restartIntent(snapshotSessionEvents(agent.session), resolutionCallId, target) ? "completed" : "unavailable";
1868
- if (restartIntent(snapshotSessionEvents(agent.session), resolutionCallId, target)) return "handoff_pending";
2058
+ if (!capabilities || !roots.marketOrigin || !resolutionCallId || !agent) return { status: "unavailable" };
2059
+ if (!sameMarketProvider(target.pre_generation, capabilities.generation)) return { status: "unavailable" };
2060
+ if (capabilities.generation !== target.pre_generation) return restartIntent(snapshotSessionEvents(agent.session), resolutionCallId, target) ? { status: "completed" } : { status: "unavailable" };
2061
+ if (restartIntent(snapshotSessionEvents(agent.session), resolutionCallId, target)) return { status: "handoff_pending" };
1869
2062
  if (!roots.persistRestartIntent || !await roots.persistRestartIntent(agent, {
1870
2063
  resolutionCallId,
1871
2064
  serviceId: String(target.service_id),
1872
2065
  preGeneration: String(target.pre_generation)
1873
- })) return "unavailable";
2066
+ })) return { status: "unavailable" };
1874
2067
  const response = await (roots.fetcher ?? fetch)(`${roots.marketOrigin}/dsh-market/api/v1/restart`, {
1875
2068
  method: "POST",
1876
2069
  signal,
@@ -1882,21 +2075,25 @@ async function executeGuardAction(action, resolution, roots, signal, executableI
1882
2075
  },
1883
2076
  body: "{}"
1884
2077
  });
1885
- if (!response.ok) return "unavailable";
1886
- return record(await response.json())?.schema === MARKET_SCHEMA ? "handoff_pending" : "unavailable";
2078
+ if (!response.ok) return { status: "unavailable" };
2079
+ return record(await response.json())?.schema === MARKET_SCHEMA ? { status: "handoff_pending" } : { status: "unavailable" };
1887
2080
  }
1888
2081
  if (action === "commit" || action === "push" || action === "pull" || action === "fetch") {
1889
2082
  const binding = resolution.gitBinding;
1890
2083
  const repository = requireString(resolution.target, "repository");
1891
- if (!executableIdentity$1 || !binding || !repository) return "unavailable";
2084
+ if (!executableIdentity$1 || !binding || !repository) return { status: "unavailable" };
1892
2085
  const targetIdentity = {
1893
2086
  repository,
1894
2087
  ...typeof resolution.target.remote === "string" ? { remote: resolution.target.remote } : {},
1895
2088
  ...typeof resolution.target.refspec === "string" ? { refspec: resolution.target.refspec } : {}
1896
2089
  };
1897
2090
  const current = await gitPrestate(binding.manifest, repository, signal, executableIdentity$1.realpath);
1898
- if (!current) return "unavailable";
1899
- if ((await executeRevalidatedGitEffect(binding.envelope, binding.manifest, targetIdentity, current, async (_file, argv, workingDirectory) => runCommand(roots, executableIdentity$1, argv, workingDirectory, signal))).status !== "executed") return "unavailable";
2091
+ if (!current) return { status: "unavailable" };
2092
+ const executed = await executeRevalidatedGitEffect(binding.envelope, binding.manifest, targetIdentity, current, async (_file, argv, workingDirectory) => runCommand(roots, executableIdentity$1, argv, workingDirectory, signal));
2093
+ if (executed.status !== "executed") return {
2094
+ status: "unavailable",
2095
+ reasonCode: executed.reasonCode
2096
+ };
1900
2097
  if (action === "commit") {
1901
2098
  const commit = verifiedLinearCommitReadback(await gitBytes(repository, [
1902
2099
  "rev-list",
@@ -1911,10 +2108,10 @@ async function executeGuardAction(action, resolution, roots, signal, executableI
1911
2108
  "-z",
1912
2109
  commit.postHeadOid
1913
2110
  ], signal, executableIdentity$1.realpath)) : void 0;
1914
- if (!commit || postTree !== resolution.target.change_set_digest) return "unavailable";
2111
+ if (!commit || postTree !== resolution.target.change_set_digest) return { status: "unavailable" };
1915
2112
  } else if (action === "push") {
1916
2113
  const remoteOid = binding.manifest.remote && binding.manifest.destinationRef ? await exactRemoteOid(repository, binding.manifest.remote, binding.manifest.destinationRef, signal, executableIdentity$1.realpath) : void 0;
1917
- if (!remoteOid || remoteOid !== resolution.target.local_oid) return "unavailable";
2114
+ if (!remoteOid || remoteOid !== resolution.target.local_oid) return { status: "unavailable" };
1918
2115
  } else {
1919
2116
  const upstream = String(resolution.target.upstream_oid ?? "");
1920
2117
  const trackingRef = binding.manifest.action === "fetch" ? binding.manifest.trackingRef : binding.manifest.remote && binding.manifest.sourceRef ? `refs/remotes/${binding.manifest.remote}/${binding.manifest.sourceRef.slice(11)}` : void 0;
@@ -1923,13 +2120,13 @@ async function executeGuardAction(action, resolution, roots, signal, executableI
1923
2120
  "--verify",
1924
2121
  trackingRef
1925
2122
  ], signal, executableIdentity$1.realpath)) : void 0;
1926
- if (!tracking || tracking !== upstream) return "unavailable";
1927
- if (action === "pull" && oid(await git(repository, ["rev-parse", "HEAD"], signal, executableIdentity$1.realpath)) !== upstream) return "unavailable";
1928
- if (action === "fetch" && oid(await git(repository, ["rev-parse", "HEAD"], signal, executableIdentity$1.realpath)) !== resolution.target.pre_head_oid) return "unavailable";
2123
+ if (!tracking || tracking !== upstream) return { status: "unavailable" };
2124
+ if (action === "pull" && oid(await git(repository, ["rev-parse", "HEAD"], signal, executableIdentity$1.realpath)) !== upstream) return { status: "unavailable" };
2125
+ if (action === "fetch" && oid(await git(repository, ["rev-parse", "HEAD"], signal, executableIdentity$1.realpath)) !== resolution.target.pre_head_oid) return { status: "unavailable" };
1929
2126
  }
1930
- return "completed";
2127
+ return { status: "completed" };
1931
2128
  }
1932
- return "unavailable";
2129
+ return { status: "unavailable" };
1933
2130
  }
1934
2131
  async function gitBytes(repository, args, signal, file = "git") {
1935
2132
  const { stdout } = await execFileAsync(file, args, {
@@ -2575,15 +2772,15 @@ function createActionTool(options = {}) {
2575
2772
  releaseContractId = decision.contractId;
2576
2773
  }
2577
2774
  try {
2578
- const status = await executeGuardAction(action, resolution, roots, exec.signal, currentExecutable, args.resolution_call_id, agent);
2775
+ const outcome = await executeGuardAction(action, resolution, roots, exec.signal, currentExecutable, args.resolution_call_id, agent);
2579
2776
  if (releaseOperation && releaseGranted && roots.releaseSettle) {
2580
- const readback$1 = status === "completed" ? await publishReadback(resolution.target, roots, exec.signal) : void 0;
2777
+ const readback$1 = outcome.status === "completed" ? await publishReadback(resolution.target, roots, exec.signal) : void 0;
2581
2778
  await roots.releaseSettle({
2582
2779
  agent,
2583
2780
  operation: releaseOperation,
2584
2781
  callId: args.resolution_call_id,
2585
2782
  ...releaseContractId !== void 0 ? { contractId: releaseContractId } : {},
2586
- effect: status === "completed" ? "completed" : status === "unavailable" ? "not_effected" : "unknown",
2783
+ effect: outcome.status === "completed" ? "completed" : outcome.status === "unavailable" ? "not_effected" : "unknown",
2587
2784
  readback: readback$1 === void 0 ? "unavailable" : {
2588
2785
  kind: "npm_integrity",
2589
2786
  identity: readback$1
@@ -2591,8 +2788,8 @@ function createActionTool(options = {}) {
2591
2788
  });
2592
2789
  }
2593
2790
  return {
2594
- status,
2595
- reason_code: status === "completed" ? "action_completed" : status === "handoff_pending" ? "restart_handoff_pending" : "action_execution_failed",
2791
+ status: outcome.status,
2792
+ reason_code: outcome.status === "completed" ? "action_completed" : outcome.status === "handoff_pending" ? "restart_handoff_pending" : outcome.reasonCode === "effect_already_applied" ? "action_already_applied" : "action_execution_failed",
2596
2793
  ...identity
2597
2794
  };
2598
2795
  } catch {
@@ -4927,6 +5124,15 @@ function apply(ctx, rawConfig = {}, seams = {}) {
4927
5124
  return durable;
4928
5125
  }
4929
5126
  }));
5127
+ agent.ctx.tools.register(createInterpretTool({
5128
+ getProjection: () => runtime.projection,
5129
+ refreshProjection: async () => {
5130
+ const durable = await ctx.sessions.flush(agent.session);
5131
+ runtime.setDurability(durable);
5132
+ runtime.sync();
5133
+ return durable;
5134
+ }
5135
+ }));
4930
5136
  agent.ctx.tools.register(createReleaseTool({
4931
5137
  getProjection: () => runtime.projection,
4932
5138
  fetcher: evidenceOptions.fetcher,
@@ -4958,7 +5164,8 @@ function apply(ctx, rawConfig = {}, seams = {}) {
4958
5164
  enabled: runtime.projection.enabled,
4959
5165
  boundaryV5Present: runtime.protocolV5Present,
4960
5166
  boundaryPresent: runtime.protocolV4Present,
4961
- delegated
5167
+ delegated,
5168
+ policy: runtime.projection.policy
4962
5169
  }, claimedBatchHasRealRootInput(decision.messages));
4963
5170
  if (firstStep) {
4964
5171
  injected.push(pluginNoticeMessage(firstStep.boundary, "Context Guard recorded a replay version boundary"));
@@ -5117,4 +5324,4 @@ function normalizeGoalState(value) {
5117
5324
  }
5118
5325
 
5119
5326
  //#endregion
5120
- export { ACTION_MANIFEST, ACTION_MANIFEST_VERSION, ACTIVE_HOST_COHORT_ID, ACTIVE_HOST_COHORT_IDS, ACTIVE_HOST_LAUNCHER_VERSION, ALPHA2_DSHMARKET_139_HOST_PACKAGES, ALPHA2_HOST_PACKAGES, ALPHA3_HOST_PACKAGES, BASE_HOST_PACKAGES, BOUNDED_ARTIFACT_TYPES, CAPTURE_V042_NOTICE, CERTIFICATE_VERSION, CERTIFICATE_VERSION_V2, COMMAND_SURFACE_MANIFEST, CONFIRM_LINE_PATTERN, CONTROL_RECORD_PREFIX, Config, DEFAULT_DELEGATION_TOOL_NAMES, DEFAULT_HOST_LOCK, DEFAULT_RECOVERY_CHAR_BUDGET, EXPECTED_HOST_PACKAGES, FIRST_STEP_GUIDANCE, GIT_COMMAND_MANIFEST_IDS, GIT_COMMAND_TEMPLATES, GOAL_HOST_PACKAGES, HOST_CAPABILITY_PACKAGE_GROUPS, HOST_COHORTS, HostProfileError, LATEST_SUPPORTED_HOST_VERSION, LEGACY_HOST_COHORTS, MIN_RECOVERY_CHAR_BUDGET, MIN_SUPPORTED_HOST_VERSION, NO_PROGRESS_RECORD_PREFIX, NO_PROGRESS_TURNS_BEFORE_STOP, PROOF_CAPABILITY_MATRIX, PROOF_KINDS, PROOF_KINDS_V2, PROOF_MANIFEST_DOMAIN_V2, PROOF_PROTOCOL_VERSION, PROOF_PROTOCOL_VERSION_V2, PROTOCOL_V3_NOTICE, PROTOCOL_V4_NOTICE, PROTOCOL_V5_NOTICE, RC015_HOST_PACKAGES, RC015_RC2_HOST_PACKAGES, RC1_HOST_PACKAGES, SEMANTIC_ACTIONS, SESSION_API_UNSUPPORTED, SESSION_EVENT_ENVELOPE_INVALID, STATEFUL_ACTIONS, STOP_PROTOCOL_VERSION, STOP_PROTOCOL_VERSION_V2, SUPPORTED_EVIDENCE_ADAPTERS, SUPPORTED_HOST_RANGE, SUPPORTED_HOST_VERSIONS, SessionApiError, actionCompatible, apply, authorityCaptureCounts, availableBoundaryQualifications, bindExecutableIdentity, bindLiveGoalCapability, bindProofToProjection, bindProofV2ToProjection, bindingSatisfies, boundedArtifactChoiceMatches, canonicalArgvFromCommand, canonicalProjection, canonicalizePath, captureClause, captureItem, certifyCheckpoint, claimedBatchHasRealRootInput, classifyClause, classifyCompletionClaim, classifyTaskIntent, classifyUserInteraction, closingHint, combineHostPolicy, commitIndexSnapshotDigest, commitTreeSnapshotDigest, compareHostVersions, confirmRebind, createGitPrestateEnvelope, createProjection, createProofManifest, createProofManifestV2, currentContractDigest, decideTurnBoundary, decideTurnStopping, decisionBoundaryKey, deriveItemDiagnosis, deriveProjection, digestStrings, effectuateBoundary, evaluateExternalWaitCapability, evaluateHostCapability, evaluateHostLock, evaluateMinimumHostVersion, evaluateToolSurfaceCapability, evidenceAvailabilityReason, evidenceCoverage, evidenceFromPersistedToolResult, evidenceMatchesItem, executeRevalidatedGitEffect, extractArtifactPaths, extractMethod, extractOperation, extractTextContent, extractToolSubject, gitCommandMatchesTarget, goalCompletionDenial, hasCurrentCertificate, hostLockContextFromComposedDump, hostLockRowsFromComposedDump, hostVersionFromPackages, inject, injectActiveProfileHostLock, inspectTargetHostGraph, interpretClause, interpretMessage, isCurrentAcceptedBoundary, isDeterministicCheck, isExecutableItem, isFrozenV042RebindResponse, isInformationalMessage, isOpenObligation, isRootPauseRequest, isRunExecutable, isStatefulAction, isVerifyingCapability, isWholeTaskCompletionClaim, itemDiagnosis, kindOfScope, latestAssistantText, latestRootInstruction, lifecyclePhase, maskCodeSpans, name, namedActions, normalizeClause, observeAssistantOutcome, openItems, packageRowsFromActiveGraph, packageRowsFromPnpmLock, parseConfirmationMessage, parseGitCommandManifest, parseHostVersion, parsePwshCommand, parseShellCommand, previewFirstStepInjection, progressFingerprint, proofCapabilityReport, proofDigest, proofDigestV2, proofEvidenceConstraints, proofHostSurfacesOf, proofOperationMatches, proofV2Rejection, proposeRebind, proposeRebindOutcome, proposeRebindV042, qualifyBoundary, readActiveHostGraph, rebindAttemptKey, rebindResponse, recoveryDigest, relevantEvidence, renderRecoveryPacket, replayRebindResult, requestedIdentityKey, requestedTargetAuthorizesMutation, requestedTargetMatchesResolved, requiredSubjectsOf, resolveActiveProfileHostLock, resolveInstalledHostLock, revalidateGitPrestate, sanitizeClauseText, sanitizeUrl, satisfiesSupportedHostRange, scopeCoverageDigest, segmentAuthorityBlocks, segmentClauses, selectHostCohort, semanticActionFromCommand, semanticActionFromText, semanticActionOfScope, sessionQuery, sessionQueryV2, sha256, snapshotSessionEvents, statefulActionsOfScope, supersedeItem, validateActionManifest, validateActionTarget, validateManifest, validateProofManifest, validateProofManifestV2, verifiedLinearCommitReadback, verifyComposedHostLockDump, withDurability };
5327
+ export { ACTION_MANIFEST, ACTION_MANIFEST_VERSION, ACTIVE_HOST_COHORT_ID, ACTIVE_HOST_COHORT_IDS, ACTIVE_HOST_LAUNCHER_VERSION, ALPHA2_DSHMARKET_139_HOST_PACKAGES, ALPHA2_HOST_PACKAGES, ALPHA3_HOST_PACKAGES, BASE_HOST_PACKAGES, BOUNDED_ARTIFACT_TYPES, CAPTURE_V042_NOTICE, CERTIFICATE_VERSION, CERTIFICATE_VERSION_V2, COMMAND_SURFACE_MANIFEST, CONFIRM_LINE_PATTERN, CONTROL_RECORD_PREFIX, Config, DEFAULT_DELEGATION_TOOL_NAMES, DEFAULT_HOST_LOCK, DEFAULT_RECOVERY_CHAR_BUDGET, EXPECTED_HOST_PACKAGES, FIRST_STEP_GUIDANCE, GIT_COMMAND_MANIFEST_IDS, GIT_COMMAND_TEMPLATES, GOAL_HOST_PACKAGES, HOST_CAPABILITY_PACKAGE_GROUPS, HOST_COHORTS, HostProfileError, LATEST_SUPPORTED_HOST_VERSION, LEGACY_HOST_COHORTS, MIN_RECOVERY_CHAR_BUDGET, MIN_SUPPORTED_HOST_VERSION, NO_PROGRESS_RECORD_PREFIX, NO_PROGRESS_TURNS_BEFORE_STOP, PROOF_CAPABILITY_MATRIX, PROOF_KINDS, PROOF_KINDS_V2, PROOF_MANIFEST_DOMAIN_V2, PROOF_PROTOCOL_VERSION, PROOF_PROTOCOL_VERSION_V2, PROTOCOL_V3_NOTICE, PROTOCOL_V4_NOTICE, PROTOCOL_V5_NOTICE, RC015_HOST_PACKAGES, RC015_RC2_HOST_PACKAGES, RC1_HOST_PACKAGES, SEMANTIC_ACTIONS, SESSION_API_UNSUPPORTED, SESSION_EVENT_ENVELOPE_INVALID, STATEFUL_ACTIONS, STOP_PROTOCOL_VERSION, STOP_PROTOCOL_VERSION_V2, SUPPORTED_EVIDENCE_ADAPTERS, SUPPORTED_HOST_RANGE, SUPPORTED_HOST_VERSIONS, SessionApiError, actionCompatible, apply, authorityCaptureCounts, availableBoundaryQualifications, bindExecutableIdentity, bindLiveGoalCapability, bindProofToProjection, bindProofV2ToProjection, bindingSatisfies, boundedArtifactChoiceMatches, canonicalArgvFromCommand, canonicalProjection, canonicalizePath, captureClause, captureItem, certifyCheckpoint, claimedBatchHasRealRootInput, classifyClause, classifyCompletionClaim, classifyTaskIntent, classifyUserInteraction, closingHint, combineHostPolicy, commitIndexSnapshotDigest, commitTreeSnapshotDigest, compareHostVersions, confirmRebind, createGitPrestateEnvelope, createProjection, createProofManifest, createProofManifestV2, currentContractDigest, decideTurnBoundary, decideTurnStopping, decisionBoundaryKey, deriveItemDiagnosis, deriveProjection, digestStrings, effectuateBoundary, evaluateExternalWaitCapability, evaluateHostCapability, evaluateHostLock, evaluateMinimumHostVersion, evaluateToolSurfaceCapability, evidenceAvailabilityReason, evidenceCoverage, evidenceFromPersistedToolResult, evidenceMatchesItem, executeRevalidatedGitEffect, extractArtifactPaths, extractMethod, extractOperation, extractTextContent, extractToolSubject, firstStepGuidance, gitCommandMatchesTarget, goalCompletionDenial, hasCurrentCertificate, hostLockContextFromComposedDump, hostLockRowsFromComposedDump, hostVersionFromPackages, inject, injectActiveProfileHostLock, inspectTargetHostGraph, interpretClause, interpretMessage, isCurrentAcceptedBoundary, isDeterministicCheck, isExecutableItem, isFrozenV042RebindResponse, isInformationalMessage, isOpenObligation, isRootPauseRequest, isRunExecutable, isStatefulAction, isVerifyingCapability, isWholeTaskCompletionClaim, itemDiagnosis, kindOfScope, latestAssistantText, latestRootInstruction, lifecyclePhase, maskCodeSpans, name, namedActions, normalizeClause, observeAssistantOutcome, openItems, packageRowsFromActiveGraph, packageRowsFromPnpmLock, parseConfirmationMessage, parseGitCommandManifest, parseHostVersion, parsePwshCommand, parseShellCommand, previewFirstStepInjection, progressFingerprint, proofCapabilityReport, proofDigest, proofDigestV2, proofEvidenceConstraints, proofHostSurfacesOf, proofOperationMatches, proofV2Rejection, proposeRebind, proposeRebindOutcome, proposeRebindV042, qualifyBoundary, readActiveHostGraph, rebindAttemptKey, rebindResponse, recoveryDigest, relevantEvidence, renderRecoveryPacket, replayRebindResult, requestedIdentityKey, requestedTargetAuthorizesMutation, requestedTargetMatchesResolved, requiredSubjectsOf, resolveActiveProfileHostLock, resolveInstalledHostLock, revalidateGitPrestate, sanitizeClauseText, sanitizeUrl, satisfiesSupportedHostRange, scopeCoverageDigest, segmentAuthorityBlocks, segmentClauses, selectHostCohort, semanticActionFromCommand, semanticActionFromText, semanticActionOfScope, sessionQuery, sessionQueryV2, sha256, snapshotSessionEvents, statefulActionsOfScope, supersedeItem, validateActionManifest, validateActionTarget, validateManifest, validateProofManifest, validateProofManifestV2, verifiedLinearCommitReadback, verifyComposedHostLockDump, withDurability };
@@ -62,6 +62,103 @@ The two scope facts decided on 2026-09-14 (candidate-only v2 plus open parity;
62
62
  attributed as an approved scope reduction) are recorded in
63
63
  [SEMANTIC_COMPATIBILITY.md](SEMANTIC_COMPATIBILITY.md).
64
64
 
65
+ ## 0.6.0 publication facts (verified 2026-09-15)
66
+
67
+ The "not established" list of the 2026-09-14 source-candidate section below was
68
+ written before publication and is superseded by the following readback, recorded
69
+ the same day it was performed. The historical section text is kept as written.
70
+
71
+ - The annotated tag `v0.6.0` resolves to commit
72
+ `cc5cbc6d408664172d9383de7c83c55ec6dfd602`, and the GitHub Release `v0.6.0`
73
+ targets the same commit.
74
+ - The npm registry carries `dsh-completion-guard@0.6.0`; its registry
75
+ `dist.integrity` is
76
+ `sha512-xIV5wAmDhdXGr7xlpOAceaVJUYgkxmqO2/7zuIat95T+QH2k0e09oYRGokUpH18NNNC2p6UVqnjO8fcpp1V58Q==`
77
+ and `dist.shasum` is `4573474855d2f36c011cb64cc7139ec2bf68d613`.
78
+ - The byte-level comparison of the published artifact against the release
79
+ receipt's frozen tgz belongs to the release archive and is not re-derived
80
+ here.
81
+
82
+ ## 0.6.1 source candidate (2026-09-15)
83
+
84
+ This section records a **source and deterministic** claim only. It is not a
85
+ release, not an artifact acceptance, and not a native-platform result; each of
86
+ those is a separate fact that, when established, gets its own section and its
87
+ own frozen-artifact identity.
88
+
89
+ Established at this point:
90
+
91
+ - The five W060-01–05 repairs from the Windows 0.6.0 session review
92
+ (`docs/WINDOWS_0_6_0_REPAIR_PLAN.md`) are implemented and covered by
93
+ dedicated positive/negative suites:
94
+ `tests/domain/v061-attachment-interpretation.test.ts`,
95
+ `tests/domain/v061-conservative-interpretation.test.ts`,
96
+ `tests/domain/v061-discovery-pagination.test.ts`,
97
+ `tests/domain/v061-evidence-contract.test.ts`, and
98
+ `tests/domain/v061-ordinary-observation.test.ts`, alongside the full
99
+ pre-existing regression matrix. The suites include the review rounds'
100
+ counterexamples: an answer that states the images were not viewed closes no
101
+ asset; a replayed log without interpretation records keeps assets `pending`;
102
+ an OLD asset closes through the turn that explicitly re-interpreted it, and
103
+ the closing turn must be the interpreting turn; a receipt contradicting the
104
+ call, item, revision, or asset identity is an `interpretation_receipt_mismatch`
105
+ integrity violation that records nothing, and so is a transplanted result
106
+ whose call turn and receipt turn disagree, while a valid-identity receipt
107
+ with a MISSING turn association simply records nothing and keeps the log
108
+ valid; a real order containing a relative wh-clause ("Create a file where
109
+ logs are stored") stays executable; unknown requests stay unresolved
110
+ regardless of wording, under the final interpretation contract: a
111
+ grammatical declarative can express a task requirement, so no surface
112
+ shape proves a clause is closable information — the review rounds'
113
+ holdouts all stay unresolved and unanswered ("Please sanitize inputs
114
+ that are untrusted", "请处理被遮挡的面板", "Have these inputs
115
+ sanitized", "处理被遮挡的面板", "处理没有标签的输入", "Sanitize inputs
116
+ I have received", the long-attributive "处理被异常宽大…遮挡的面板",
117
+ "I need you to sanitize these inputs", "Our requirement is to sanitize
118
+ all inputs", "避免面板被遮挡", "没有标签的输入也要处理", "Sanitize all
119
+ inputs", and declarative contexts like "设置面板被遮挡。请修复登录页。"
120
+ whose undecidable context stays pending) — while clauses with POSITIVE
121
+ information grounds (questions, quoted actions, past/aspect reports as the
122
+ clause's entire predicate such as "我刚才已经推送过了") keep closing
123
+ through their own turn's answer, a bare whole-message acknowledgment
124
+ ("当然。") is session talk that is never captured, and an unresolved
125
+ clause — including explanation/investigation openers and every holdout
126
+ above — is closable only in parts: the implemented structured-interpretation
127
+ pathway (`context_guard_interpret`) requires a span partition
128
+ (information_spans/unknown_spans) validated against the full input spans,
129
+ and only the information sub-item closes with that turn's answer while
130
+ every unknown/undeclared sub-span stays pending ("Explain the issue,
131
+ sanitize all inputs" keeps the sanitize demand open); a verbatim concrete
132
+ clarification supersedes an unresolved clause; a successful command whose
133
+ text merely contains quoted
134
+ action text flags nothing; and a git effect that already holds (push with
135
+ the remote at the local head, pull/fetch already up to date) is refused
136
+ with `effect_already_applied` before any command runs. The test host lifecycle
137
+ now disposes every started loop host, which removes the intermittent
138
+ FileHandle garbage-collection failure of the full-suite run.
139
+ - Compatibility boundaries hold: the asset obligation's contract text is
140
+ byte-identical to 0.6.0 (replayed contract digests do not move, recorded
141
+ certificates still verify); asset closure requires a per-asset
142
+ `context_guard_interpret` record plus the turn's trusted delivery, so logs
143
+ written by 0.6.0 replay with their assets `pending` — the same status 0.6.0
144
+ produced; new fields, the interpretation tool, and reason codes are
145
+ additive; legacy sessions keep their historical reading; and no digest
146
+ domain was reused.
147
+ - The full local deterministic matrix (this section's top lists it in
148
+ `NEXT_VERSION_REPAIR_NOTES.md` and the repository instructions) and byte-identical
149
+ repeated builds of the candidate dist. The dist differs from the 0.6.0
150
+ base until the 0.6.1 candidate is committed.
151
+
152
+ Not established here, and deliberately not claimed:
153
+
154
+ - No 0.6.1 tgz has been packed with `scripts/release-pack.mjs`, so there is no
155
+ frozen artifact digest for 0.6.1.
156
+ - No native macOS or Windows Web/Headless run has been executed against a
157
+ 0.6.1 artifact; the v5-session, attachment, discovery, and
158
+ unattributed-observation behaviours above have deterministic coverage only.
159
+ - No tag, npm publication, GitHub Release, or consumer installation exists for
160
+ 0.6.1 in this state.
161
+
65
162
  ## 0.6.0 source candidate (2026-09-14)
66
163
 
67
164
  This section records a **source and deterministic** claim only. It is not a