dsh-completion-guard 0.5.0 → 0.5.2
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 +38 -0
- package/CHANGELOG.zh-CN.md +38 -0
- package/README.md +12 -8
- package/README.zh-CN.md +12 -8
- package/bin/dsh-completion-guard-host-lock.mjs +16 -0
- package/dist/domain/index.d.ts +2 -2
- package/dist/domain/index.js +2 -2
- package/dist/{domain-Cx8vpxSj.js → domain-RuX9l07o.js} +2616 -581
- package/dist/{index-Cd3wXBLi.d.ts → index-BTaiOcE-.d.ts} +491 -31
- package/dist/index.d.ts +3 -2
- package/dist/index.js +270 -18
- package/docs/ARCHITECTURE.md +7 -2
- package/docs/COMPATIBILITY.md +65 -5
- package/docs/HOST_LOCK_UPGRADE.md +42 -5
- package/docs/LOCAL_ACCEPTANCE.md +20 -2
- package/docs/PORTING_NOTES.md +22 -0
- package/docs/SEMANTIC_COMPATIBILITY.md +24 -0
- package/docs/distribution.md +12 -6
- package/docs/upstream-deltas.json +30 -4
- package/manifests/supported-host.v1.json +298 -89
- package/package.json +38 -32
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as COMMAND_SURFACE_MANIFEST, $i as kindOfScope, $n as bindLiveGoalCapability, $r as BindingActionClosure, $t as parsePwshCommand, A as openItems, Ai as WaitAuthorization, An as BASE_HOST_PACKAGES, Ar as parseConfirmationMessage, At as GitCommandManifest, B as SessionQuery, Bi as proposeRebindV042, Bn as HostCapabilityId, Br as extractMethod, Bt as commitTreeSnapshotDigest, C as RC015_RC2_HOST_PACKAGES, Ca as canonicalizePath, Ci as HostStatus, Cn as deriveProjection, Cr as TaskIntent, Ct as resolveActiveProfileHostLock, D as MIN_RECOVERY_CHAR_BUDGET, Da as sanitizeUrl, Di as TargetTuple, Dn as ALPHA2_DSHMARKET_139_HOST_PACKAGES, Dr as CONFIRM_LINE_PATTERN, Dt as GIT_COMMAND_TEMPLATES, E as DEFAULT_RECOVERY_CHAR_BUDGET, Ea as sanitizeClauseText, Ei as TargetCaptureStatus, En as ACTIVE_HOST_LAUNCHER_VERSION, Er as classifyUserInteraction, Et as GIT_COMMAND_MANIFEST_IDS, F as PROOF_PROTOCOL_VERSION, Fi as RebindArgs, Fn as GOAL_HOST_PACKAGES, Fr as ClauseSegment, Ft as GitPrestateCheck, G as proofEvidenceConstraints, Gi as DirectiveClass, Gn as HostLockContext, Gr as BoundaryQualification, Gt as revalidateGitPrestate, H as canonicalProjection, Hi as rebindResponse, Hn as HostCohort, Hr as isInformationalMessage, Ht as executeRevalidatedGitEffect, I as ProofKind, Ii as RebindProposal, In as HOST_CAPABILITY_PACKAGE_GROUPS, Ir as captureClause, It as GitPrestateEnvelope, J as EvidenceFacetCoverage, Ji as ScopeInterpretation, Jn as HostPlatform, Jr as GoalBoundaryAccess, Jt as CanonicalCommandSurface, K as sessionQuery, Ki as Executee, Kn as HostLockEvaluation, Kr as BoundaryRequest, Kt as verifiedLinearCommitReadback, L as ProofManifest, Li as confirmRebind, Ln as HOST_COHORTS, Lr as captureItem, Lt as GitTargetIdentity, M as renderRecoveryPacket, Mi as PackageRow, Mn as EXPECTED_HOST_PACKAGES, Mr as RejectedBinding, Mt as GitCommandRejected, N as ALPHA3_HOST_PACKAGES, Ni as BoundedSource, Nn as ExecutableIdentity, Nr as certifyCheckpoint, Nt as GitEffectExecution, O as RecoveryOptions, Oa as sha256, Oi as TargetValue, On as ALPHA2_HOST_PACKAGES, Or as ParsedConfirmation, Ot as GitAdapterAction, P as PROOF_KINDS, Pi as ProposeOutcome, Pn as ExecutableIdentityBinding, Pr as CaptureScope, Pt as GitEffectRunner, Q as isVerifyingCapability, Qi as isOpenObligation, Qn as bindExecutableIdentity, Qr as qualifyBoundary, Qt as isRunExecutable, R as ProofObligation, Ri as proposeRebind, Rn as HostAuditProvenance, Rr as classifyClause, Rt as LinearCommitReadback, S as snapshotSessionEvents, Sa as validateActionTarget, Si as GuardProjection, Sn as PROTOCOL_V4_NOTICE, Sr as segmentAuthorityBlocks, St as readActiveHostGraph, T as RC1_HOST_PACKAGES, Ta as normalizeClause, Ti as TargetCaptureReasonCode, Tn as ACTIVE_HOST_COHORT_IDS, Tr as classifyTaskIntent, Tt as verifyComposedHostLockDump, U as createProofManifest, Ui as replayRebindResult, Un as HostCohortSelection, Ur as segmentClauses, Ut as gitCommandMatchesTarget, V as bindProofToProjection, Vi as rebindAttemptKey, Vn as HostCapabilityRequest, Vr as extractOperation, Vt as createGitPrestateEnvelope, W as proofDigest, Wi as AuthorityDisposition, Wn as HostCohortSelectionReason, Wr as BoundaryEffectuation, Wt as parseGitCommandManifest, X as evidenceCoverage, Xi as interpretMessage, Xn as HostToolSurface, Xr as effectuateBoundary, Xt as ShellParseStatus, Y as bindingSatisfies, Yi as interpretClause, Yn as HostProfileKind, Yr as availableBoundaryQualifications, Yt as ParsedShell, Z as evidenceMatchesItem, Zi as isExecutableItem, Zn as LEGACY_HOST_COHORTS, Zr as isCurrentAcceptedBoundary, Zt as canonicalArgvFromCommand, _ as progressFingerprint, _a as requestedTargetAuthorizesMutation, _i as GuardIntegrity, _n as evidenceAvailabilityReason, _r as currentContractDigest, _t as hostLockRowsFromComposedDump, a as NO_PROGRESS_RECORD_PREFIX, aa as ACTION_MANIFEST_VERSION, ai as DeriveScope, an as ToolSubject, ar as selectHostCohort, at as FIRST_STEP_GUIDANCE, b as SessionApiError, ba as semanticActionFromText, bi as GuardItemStatus, bn as CAPTURE_V042_NOTICE, br as AuthorityKind, bt as packageRowsFromActiveGraph, c as classifyCompletionClaim, ca as CERTIFICATE_VERSION, ci as EvidenceOutcome, cn as extractToolSubject, cr as LATEST_SUPPORTED_HOST_VERSION, ct as LifecyclePhase, d as decisionBoundaryKey, da as STOP_PROTOCOL_VERSION, di as ExpectedTransition, dn as CertificationSupport, dr as SUPPORTED_HOST_RANGE, dt as previewFirstStepInjection, ea as maskCodeSpans, ei as BoundaryDisposition, en as parseShellCommand, er as evaluateExternalWaitCapability, et as CommandSurfaceManifest, f as isRootPauseRequest, fa as SUPPORTED_EVIDENCE_ADAPTERS, fi as ExternalOperation, fn as DiagnosisNextAction, fr as SUPPORTED_HOST_VERSIONS, ft as ActiveProfileHostLock, g as observeAssistantOutcome, ga as isStatefulAction, gi as GuardEvidence, gn as deriveItemDiagnosis, gr as satisfiesSupportedHostRange, gt as hostLockContextFromComposedDump, h as latestRootInstruction, ha as actionCompatible, hi as GuardCheckpoint, hn as UnifiedItemDiagnosis, hr as parseHostVersion, ht as combineHostPolicy, i as CompletionDisposition, ia as ACTION_MANIFEST, ii as DeriveResult, in as ToolResultInput, ir as hostVersionFromPackages, it as ClaimedMessage, j as recoveryDigest, ji as createProjection, jn as DEFAULT_HOST_LOCK, jr as CheckpointResult, jt as GitCommandParseResult, k as closingHint, ki as VerificationContract, kn as AuditedExecutable, kr as isFrozenV042RebindResponse, kt as GitCommandAccepted, l as decideTurnBoundary, la as SEMANTIC_ACTIONS, li as EvidenceParseStatus, ln as isDeterministicCheck, lr as MIN_SUPPORTED_HOST_VERSION, lt as claimedBatchHasRealRootInput, m as latestAssistantText, ma as StatefulAction, mi as GuardBoundary, mn as TaskKind, mr as evaluateMinimumHostVersion, mt as TargetHostGraph, n as AssistantOutcomeObservation, na as semanticActionOfScope, ni as DeferAuthorization, nn as hasCurrentCertificate, nr as evaluateHostLock, nt as OperationVerbEntry, o as NO_PROGRESS_TURNS_BEFORE_STOP, oa as ActionManifest, oi as DerivedEnvelope, on as evidenceFromPersistedToolResult, or as HostVersionDecision, ot as FirstStepInjection, p as isWholeTaskCompletionClaim, pa as SemanticAction, pi as GoalRef, pn as Repairability, pr as compareHostVersions, pt as HostProfileError, q as validateProofManifest, qi as InterpretOptions, qn as HostLockStatus, qr as GoalActivationState, qt as CanonicalArgv, r as CONTROL_RECORD_PREFIX, ra as statefulActionsOfScope, ri as DeriveConfig, rn as ToolCallInput, rr as evaluateToolSurfaceCapability, rt as validateManifest, s as TurnStoppingDecision, sa as ActionSpec, si as EvidenceBinding, sn as extractTextContent, sr as HostVersionStatus, st as FirstStepPreviewInput, t as supersedeItem, ta as namedActions, ti as BoundaryQualificationKind, tn as goalCompletionDenial, tr as evaluateHostCapability, tt as ManifestIssue, u as decideTurnStopping, ua as STATEFUL_ACTIONS, ui as EvidenceRole, un as withDurability, ur as ParsedHostVersion, ut as lifecyclePhase, v as SESSION_API_UNSUPPORTED, va as requestedTargetMatchesResolved, vi as GuardItem, vn as itemDiagnosis, vr as AuthorityBlock, vt as injectActiveProfileHostLock, w as RC015_HOST_PACKAGES, wa as digestStrings, wi as PersistenceAuthorization, wn as ACTIVE_HOST_COHORT_ID, wr as UserInteractionKind, wt as resolveInstalledHostLock, x as V3SessionLike, xa as validateActionManifest, xi as GuardOperation, xn as PROTOCOL_V3_NOTICE, xr as authorityCaptureCounts, xt as packageRowsFromPnpmLock, y as SESSION_EVENT_ENVELOPE_INVALID, ya as semanticActionFromCommand, yi as GuardItemKind, yn as relevantEvidence, yr as AuthorityBlockKind, yt as inspectTargetHostGraph, z as ProofSurface, zi as proposeRebindOutcome, zn as HostCapabilityEvaluation, zr as extractArtifactPaths, zt as commitIndexSnapshotDigest } from "./index-BTaiOcE-.js";
|
|
2
2
|
import "@deepseek-ai/dsh-tools";
|
|
3
|
+
import "@deepseek-ai/dsh-session";
|
|
3
4
|
import { Context } from "@deepseek-ai/cordis";
|
|
4
5
|
import z from "@deepseek-ai/schemastery";
|
|
5
6
|
|
|
@@ -27,4 +28,4 @@ declare function apply(ctx: Context, rawConfig?: {
|
|
|
27
28
|
hostLockProfileRoot?: unknown;
|
|
28
29
|
}): void;
|
|
29
30
|
//#endregion
|
|
30
|
-
export { ACTION_MANIFEST, ACTION_MANIFEST_VERSION, ALPHA2_DSHMARKET_139_HOST_PACKAGES, ALPHA2_HOST_PACKAGES, ALPHA3_HOST_PACKAGES, ActionManifest, ActionSpec, ActiveProfileHostLock, AssistantOutcomeObservation, AuditedExecutable, AuthorityBlock, AuthorityBlockKind, AuthorityKind, BASE_HOST_PACKAGES, BoundaryDisposition, BoundaryEffectuation, BoundaryQualification, BoundaryQualificationKind, BoundaryRequest, BoundedSource, CAPTURE_V042_NOTICE, CERTIFICATE_VERSION, COMMAND_SURFACE_MANIFEST, CONFIRM_LINE_PATTERN, CanonicalArgv, CanonicalCommandSurface, CaptureScope, CertificationSupport, CheckpointResult, ClaimedMessage,
|
|
31
|
+
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, ActionManifest, ActionSpec, ActiveProfileHostLock, AssistantOutcomeObservation, AuditedExecutable, AuthorityBlock, AuthorityBlockKind, AuthorityDisposition, AuthorityKind, BASE_HOST_PACKAGES, BindingActionClosure, BoundaryDisposition, BoundaryEffectuation, BoundaryQualification, BoundaryQualificationKind, BoundaryRequest, BoundedSource, CAPTURE_V042_NOTICE, CERTIFICATE_VERSION, COMMAND_SURFACE_MANIFEST, CONFIRM_LINE_PATTERN, CONTROL_RECORD_PREFIX, CanonicalArgv, CanonicalCommandSurface, CaptureScope, CertificationSupport, CheckpointResult, ClaimedMessage, ClauseSegment, CommandSurfaceManifest, CompletionDisposition, Config, DEFAULT_HOST_LOCK, DEFAULT_RECOVERY_CHAR_BUDGET, DeferAuthorization, DeriveConfig, DeriveResult, DeriveScope, DerivedEnvelope, DiagnosisNextAction, DirectiveClass, EXPECTED_HOST_PACKAGES, EvidenceBinding, EvidenceFacetCoverage, EvidenceOutcome, EvidenceParseStatus, EvidenceRole, ExecutableIdentity, ExecutableIdentityBinding, Executee, ExpectedTransition, ExternalOperation, FIRST_STEP_GUIDANCE, FirstStepInjection, FirstStepPreviewInput, GIT_COMMAND_MANIFEST_IDS, GIT_COMMAND_TEMPLATES, GOAL_HOST_PACKAGES, GitAdapterAction, GitCommandAccepted, GitCommandManifest, GitCommandParseResult, GitCommandRejected, GitEffectExecution, GitEffectRunner, GitPrestateCheck, GitPrestateEnvelope, GitTargetIdentity, GoalActivationState, GoalBoundaryAccess, GoalRef, GuardBoundary, GuardCheckpoint, GuardEvidence, GuardIntegrity, GuardItem, GuardItemKind, GuardItemStatus, GuardOperation, GuardProjection, HOST_CAPABILITY_PACKAGE_GROUPS, HOST_COHORTS, HostAuditProvenance, HostCapabilityEvaluation, HostCapabilityId, HostCapabilityRequest, HostCohort, HostCohortSelection, HostCohortSelectionReason, HostLockContext, HostLockEvaluation, HostLockStatus, HostPlatform, HostProfileError, HostProfileKind, HostStatus, HostToolSurface, HostVersionDecision, HostVersionStatus, InterpretOptions, LATEST_SUPPORTED_HOST_VERSION, LEGACY_HOST_COHORTS, LifecyclePhase, LinearCommitReadback, MIN_RECOVERY_CHAR_BUDGET, MIN_SUPPORTED_HOST_VERSION, ManifestIssue, NO_PROGRESS_RECORD_PREFIX, NO_PROGRESS_TURNS_BEFORE_STOP, OperationVerbEntry, PROOF_KINDS, PROOF_PROTOCOL_VERSION, PROTOCOL_V3_NOTICE, PROTOCOL_V4_NOTICE, ParsedConfirmation, ParsedHostVersion, ParsedShell, PersistenceAuthorization, ProofKind, ProofManifest, ProofObligation, ProofSurface, ProposeOutcome, RC015_HOST_PACKAGES, RC015_RC2_HOST_PACKAGES, RC1_HOST_PACKAGES, RebindArgs, RebindProposal, RecoveryOptions, RejectedBinding, Repairability, SEMANTIC_ACTIONS, SESSION_API_UNSUPPORTED, SESSION_EVENT_ENVELOPE_INVALID, STATEFUL_ACTIONS, STOP_PROTOCOL_VERSION, SUPPORTED_EVIDENCE_ADAPTERS, SUPPORTED_HOST_RANGE, SUPPORTED_HOST_VERSIONS, ScopeInterpretation, SemanticAction, SessionApiError, SessionQuery, ShellParseStatus, StatefulAction, TargetCaptureReasonCode, TargetCaptureStatus, TargetHostGraph, TargetTuple, TargetValue, TaskIntent, TaskKind, ToolCallInput, ToolResultInput, ToolSubject, TurnStoppingDecision, UnifiedItemDiagnosis, UserInteractionKind, V3SessionLike, VerificationContract, WaitAuthorization, actionCompatible, apply, authorityCaptureCounts, availableBoundaryQualifications, bindExecutableIdentity, bindLiveGoalCapability, bindProofToProjection, bindingSatisfies, canonicalArgvFromCommand, canonicalProjection, canonicalizePath, captureClause, captureItem, certifyCheckpoint, claimedBatchHasRealRootInput, classifyClause, classifyCompletionClaim, classifyTaskIntent, classifyUserInteraction, closingHint, combineHostPolicy, commitIndexSnapshotDigest, commitTreeSnapshotDigest, compareHostVersions, confirmRebind, createGitPrestateEnvelope, createProjection, createProofManifest, 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, proofDigest, proofEvidenceConstraints, proposeRebind, proposeRebindOutcome, proposeRebindV042, qualifyBoundary, readActiveHostGraph, rebindAttemptKey, rebindResponse, recoveryDigest, relevantEvidence, renderRecoveryPacket, replayRebindResult, requestedTargetAuthorizesMutation, requestedTargetMatchesResolved, resolveActiveProfileHostLock, resolveInstalledHostLock, revalidateGitPrestate, sanitizeClauseText, sanitizeUrl, satisfiesSupportedHostRange, segmentAuthorityBlocks, segmentClauses, selectHostCohort, semanticActionFromCommand, semanticActionFromText, semanticActionOfScope, sessionQuery, sha256, snapshotSessionEvents, statefulActionsOfScope, supersedeItem, validateActionManifest, validateActionTarget, validateManifest, validateProofManifest, verifiedLinearCommitReadback, verifyComposedHostLockDump, withDurability };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as parseShellCommand, $n as isStatefulAction, $t as isWholeTaskCompletionClaim, A as createGitPrestateEnvelope, An as extractMethod, At as RC1_HOST_PACKAGES, B as CAPTURE_V042_NOTICE, Bn as namedActions, Bt as renderRecoveryPacket, C as SESSION_EVENT_ENVELOPE_INVALID, Cn as evidenceAvailabilityReason, Ct as SUPPORTED_HOST_VERSIONS, D as GIT_COMMAND_TEMPLATES, Dn as captureItem, Dt as satisfiesSupportedHostRange, E as GIT_COMMAND_MANIFEST_IDS, En as captureClause, Et as parseHostVersion, F as verifiedLinearCommitReadback, Fn as interpretMessage, Ft as DEFAULT_RECOVERY_CHAR_BUDGET, G as evidenceFromPersistedToolResult, Gn as ACTION_MANIFEST, Gt as CONTROL_RECORD_PREFIX, H as PROTOCOL_V4_NOTICE, Hn as statefulActionsOfScope, Ht as evidenceCoverage, I as FIRST_STEP_GUIDANCE, In as isExecutableItem, It as MIN_RECOVERY_CHAR_BUDGET, J as isDeterministicCheck, Jn as SEMANTIC_ACTIONS, Jt as classifyCompletionClaim, K as extractTextContent, Kn as ACTION_MANIFEST_VERSION, Kt as NO_PROGRESS_RECORD_PREFIX, L as claimedBatchHasRealRootInput, Ln as isOpenObligation, Lt as closingHint, M as gitCommandMatchesTarget, Mn as isInformationalMessage, Mt as authorityCaptureCounts, N as parseGitCommandManifest, Nn as segmentClauses, Nt as segmentAuthorityBlocks, O as commitIndexSnapshotDigest, On as classifyClause, Ot as RC015_RC2_HOST_PACKAGES, P as revalidateGitPrestate, Pn as interpretClause, Pt as certifyCheckpoint, Q as parsePwshCommand, Qn as actionCompatible, Qt as isRootPauseRequest, R as lifecyclePhase, Rn as kindOfScope, Rt as openItems, S as SESSION_API_UNSUPPORTED, Sn as deriveItemDiagnosis, St as SUPPORTED_HOST_RANGE, T as snapshotSessionEvents, Tn as relevantEvidence, Tt as evaluateMinimumHostVersion, U as deriveProjection, Un as canonicalRegistryBase, Ut as evidenceMatchesItem, V as PROTOCOL_V3_NOTICE, Vn as semanticActionOfScope, Vt as bindingSatisfies, W as supersedeItem, Wn as npmEscapedPackageName, Wt as isVerifyingCapability, X as canonicalArgvFromCommand, Xn as STOP_PROTOCOL_VERSION, Xt as decideTurnStopping, Y as withDurability, Yn as STATEFUL_ACTIONS, Yt as decideTurnBoundary, Z as isRunExecutable, Zn as SUPPORTED_EVIDENCE_ADAPTERS, Zt as decisionBoundaryKey, _ as packageRowsFromPnpmLock, _n as rebindResponse, _t as evaluateToolSurfaceCapability, a as createProofManifest, an as hasCurrentCertificate, ar as validateActionTarget, at as BASE_HOST_PACKAGES, b as resolveInstalledHostLock, bn as isFrozenV042RebindResponse, bt as LATEST_SUPPORTED_HOST_VERSION, c as sessionQuery, cn as isCurrentAcceptedBoundary, cr as classifyTaskIntent, ct as GOAL_HOST_PACKAGES, d as combineHostPolicy, dn as createProjection, dr as digestStrings, dt as LEGACY_HOST_COHORTS, en as latestAssistantText, er as requestedTargetAuthorizesMutation, et as ACTIVE_HOST_COHORT_ID, f as hostLockContextFromComposedDump, fn as confirmRebind, fr as normalizeClause, ft as bindExecutableIdentity, g as packageRowsFromActiveGraph, gn as rebindAttemptKey, gt as evaluateHostLock, h as inspectTargetHostGraph, hn as proposeRebindV042, hr as sha256, ht as evaluateHostCapability, i as canonicalProjection, in as goalCompletionDenial, ir as validateActionManifest, it as ALPHA2_HOST_PACKAGES, j as executeRevalidatedGitEffect, jn as extractOperation, jt as ALPHA3_HOST_PACKAGES, k as commitTreeSnapshotDigest, kn as extractArtifactPaths, kt as RC015_HOST_PACKAGES, l as validateProofManifest, ln as qualifyBoundary, lr as classifyUserInteraction, lt as HOST_CAPABILITY_PACKAGE_GROUPS, m as injectActiveProfileHostLock, mn as proposeRebindOutcome, mr as sanitizeUrl, mt as evaluateExternalWaitCapability, n as PROOF_PROTOCOL_VERSION, nn as observeAssistantOutcome, nr as semanticActionFromCommand, nt as ACTIVE_HOST_LAUNCHER_VERSION, o as proofDigest, on as availableBoundaryQualifications, or as COMMAND_SURFACE_MANIFEST, ot as DEFAULT_HOST_LOCK, p as hostLockRowsFromComposedDump, pn as proposeRebind, pr as sanitizeClauseText, pt as bindLiveGoalCapability, q as extractToolSubject, qn as CERTIFICATE_VERSION, qt as NO_PROGRESS_TURNS_BEFORE_STOP, r as bindProofToProjection, rn as progressFingerprint, rr as semanticActionFromText, rt as ALPHA2_DSHMARKET_139_HOST_PACKAGES, s as proofEvidenceConstraints, sn as effectuateBoundary, sr as validateManifest, st as EXPECTED_HOST_PACKAGES, t as PROOF_KINDS, tn as latestRootInstruction, tr as requestedTargetMatchesResolved, tt as ACTIVE_HOST_COHORT_IDS, u as HostProfileError, un as currentContractDigest, ur as canonicalizePath, ut as HOST_COHORTS, v as readActiveHostGraph, vn as replayRebindResult, vt as hostVersionFromPackages, w as SessionApiError, wn as itemDiagnosis, wt as compareHostVersions, x as verifyComposedHostLockDump, xn as parseConfirmationMessage, xt as MIN_SUPPORTED_HOST_VERSION, y as resolveActiveProfileHostLock, yn as CONFIRM_LINE_PATTERN, yt as selectHostCohort, z as previewFirstStepInjection, zn as maskCodeSpans, zt as recoveryDigest } from "./domain-RuX9l07o.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";
|
|
5
|
-
import { boundContextSummary, createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
5
|
+
import { boundContextSummary, createToolResultMessage, createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
6
6
|
import { execFile } from "node:child_process";
|
|
7
7
|
import { constants, existsSync, readFileSync } from "node:fs";
|
|
8
8
|
import { access, readFile, realpath } from "node:fs/promises";
|
|
@@ -10,6 +10,7 @@ import { tmpdir } from "node:os";
|
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
11
|
import { promisify } from "node:util";
|
|
12
12
|
import { gunzip } from "node:zlib";
|
|
13
|
+
import { SESSION_FORMAT_VERSION } from "@deepseek-ai/dsh-session";
|
|
13
14
|
|
|
14
15
|
//#region src/tools/rebind.ts
|
|
15
16
|
function createRebindTool(getProjection, prepare) {
|
|
@@ -414,6 +415,33 @@ function createCheckpointTool(getProjection, onRejected, prepare = async () => t
|
|
|
414
415
|
state_evidence_ids: {
|
|
415
416
|
type: "array",
|
|
416
417
|
items: { type: "string" }
|
|
418
|
+
},
|
|
419
|
+
action_bindings: {
|
|
420
|
+
type: "array",
|
|
421
|
+
items: {
|
|
422
|
+
type: "object",
|
|
423
|
+
additionalProperties: false,
|
|
424
|
+
properties: {
|
|
425
|
+
action: {
|
|
426
|
+
type: "string",
|
|
427
|
+
required: true
|
|
428
|
+
},
|
|
429
|
+
evidence_ids: {
|
|
430
|
+
type: "array",
|
|
431
|
+
required: true,
|
|
432
|
+
items: { type: "string" }
|
|
433
|
+
},
|
|
434
|
+
resolved_target: {
|
|
435
|
+
type: "object",
|
|
436
|
+
required: true,
|
|
437
|
+
additionalProperties: true
|
|
438
|
+
},
|
|
439
|
+
order: {
|
|
440
|
+
type: "integer",
|
|
441
|
+
required: true
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
417
445
|
}
|
|
418
446
|
}
|
|
419
447
|
}
|
|
@@ -619,7 +647,13 @@ function createCheckpointTool(getProjection, onRejected, prepare = async () => t
|
|
|
619
647
|
} } : {},
|
|
620
648
|
...binding.resolution_evidence_id ? { resolutionEvidenceId: binding.resolution_evidence_id } : {},
|
|
621
649
|
...binding.effect_evidence_id ? { effectEvidenceId: binding.effect_evidence_id } : {},
|
|
622
|
-
...binding.state_evidence_ids ? { stateEvidenceIds: binding.state_evidence_ids } : {}
|
|
650
|
+
...binding.state_evidence_ids ? { stateEvidenceIds: binding.state_evidence_ids } : {},
|
|
651
|
+
...binding.action_bindings ? { actionBindings: binding.action_bindings.map((closure) => ({
|
|
652
|
+
action: closure.action,
|
|
653
|
+
evidenceIds: closure.evidence_ids,
|
|
654
|
+
resolvedTarget: closure.resolved_target,
|
|
655
|
+
order: closure.order
|
|
656
|
+
})) } : {}
|
|
623
657
|
})), `C${projection.checkpoints.length + 1}`, false);
|
|
624
658
|
if (!result.checkpoint) onRejected();
|
|
625
659
|
const available_evidence = [...projection.evidence.values()].filter((evidence) => evidence.epoch === projection.epoch && (args.evidence_scope === "history" || [...projection.items.values()].some((item) => item.status === "pending" && relevantEvidence(projection, item, evidence)))).sort((a, b) => b.toolResultSeq - a.toolResultSeq || (a.id < b.id ? -1 : 1)).map((evidence) => ({
|
|
@@ -689,7 +723,7 @@ function createCheckpointTool(getProjection, onRejected, prepare = async () => t
|
|
|
689
723
|
function createBoundaryTool(getProjection, prepare, onRejected) {
|
|
690
724
|
return defineTool({
|
|
691
725
|
name: "context_guard_boundary",
|
|
692
|
-
description: "Persist a qualified user_wait, external_wait, or
|
|
726
|
+
description: "Persist a qualified user_wait, external_wait, deferred, or guard_bounded_stop boundary. Free-form notes never qualify a boundary.",
|
|
693
727
|
parameters: {
|
|
694
728
|
disposition: {
|
|
695
729
|
type: "string",
|
|
@@ -697,7 +731,8 @@ function createBoundaryTool(getProjection, prepare, onRejected) {
|
|
|
697
731
|
enum: [
|
|
698
732
|
"user_wait",
|
|
699
733
|
"external_wait",
|
|
700
|
-
"deferred"
|
|
734
|
+
"deferred",
|
|
735
|
+
"guard_bounded_stop"
|
|
701
736
|
]
|
|
702
737
|
},
|
|
703
738
|
qualification_kind: {
|
|
@@ -707,7 +742,8 @@ function createBoundaryTool(getProjection, prepare, onRejected) {
|
|
|
707
742
|
"user_decision_item",
|
|
708
743
|
"root_explicit_wait",
|
|
709
744
|
"external_operation_pending",
|
|
710
|
-
"root_explicit_defer"
|
|
745
|
+
"root_explicit_defer",
|
|
746
|
+
"guard_no_progress"
|
|
711
747
|
]
|
|
712
748
|
},
|
|
713
749
|
qualification_ids: {
|
|
@@ -886,6 +922,7 @@ function createPrepareTool(options) {
|
|
|
886
922
|
] : ["state (matching durable evidence for the requested verification)"];
|
|
887
923
|
const missingTargetFields = manifestEntry?.stateful && plannedAction ? manifestEntry.resolvedTargetKeys.filter((key) => !(item.requestedTarget?.[key] !== void 0 || args.requested_target?.[key] !== void 0)) : [];
|
|
888
924
|
const capability = plannedAction && options.hostCapability ? options.hostCapability(plannedAction) : void 0;
|
|
925
|
+
const commandShape = options.commandTemplate && plannedAction ? options.commandTemplate(plannedAction) : void 0;
|
|
889
926
|
return {
|
|
890
927
|
status: "prepared",
|
|
891
928
|
item: {
|
|
@@ -893,15 +930,15 @@ function createPrepareTool(options) {
|
|
|
893
930
|
revision: item.revision
|
|
894
931
|
},
|
|
895
932
|
diagnosis,
|
|
896
|
-
planned_action: plannedAction,
|
|
897
|
-
|
|
933
|
+
...plannedAction !== void 0 ? { planned_action: plannedAction } : {},
|
|
934
|
+
...commandShape !== void 0 ? { supported_command_shape: commandShape } : {},
|
|
898
935
|
required_evidence_order: requiredOrder,
|
|
899
936
|
reusable_references: reusable,
|
|
900
937
|
missing_target_fields: missingTargetFields,
|
|
901
|
-
|
|
938
|
+
...capability ? { host_capability: {
|
|
902
939
|
status: capability.status,
|
|
903
940
|
reason_code: capability.reasonCode
|
|
904
|
-
} :
|
|
941
|
+
} } : {},
|
|
905
942
|
note: "Preparation performs no action. A default or guessed target is not user authority; explicit root instruction is required for missing target fields."
|
|
906
943
|
};
|
|
907
944
|
}
|
|
@@ -2578,7 +2615,7 @@ function createContextGuardCommand(projectionFor, setEnabled, clearContract, lif
|
|
|
2578
2615
|
}
|
|
2579
2616
|
|
|
2580
2617
|
//#endregion
|
|
2581
|
-
//#region node_modules/.pnpm/@deepseek-ai+cosmokit@1.8.
|
|
2618
|
+
//#region node_modules/.pnpm/@deepseek-ai+cosmokit@1.8.3/node_modules/@deepseek-ai/cosmokit/lib/index.js
|
|
2582
2619
|
/** Return true when a value is `null` or `undefined`. */
|
|
2583
2620
|
function isNullable(value) {
|
|
2584
2621
|
return value === null || value === void 0;
|
|
@@ -2779,7 +2816,7 @@ var Time;
|
|
|
2779
2816
|
})(Time || (Time = {}));
|
|
2780
2817
|
|
|
2781
2818
|
//#endregion
|
|
2782
|
-
//#region node_modules/.pnpm/@deepseek-ai+schemastery@3.18.
|
|
2819
|
+
//#region node_modules/.pnpm/@deepseek-ai+schemastery@3.18.2/node_modules/@deepseek-ai/schemastery/lib/index.mjs
|
|
2783
2820
|
const kSchema = Symbol.for("schemastery");
|
|
2784
2821
|
const kValidationError = Symbol.for("ValidationError");
|
|
2785
2822
|
globalThis.__schemastery_index__ ??= 0;
|
|
@@ -3462,6 +3499,14 @@ function authorizeMutationFromProjection(projection, request) {
|
|
|
3462
3499
|
status: "denied",
|
|
3463
3500
|
reasonCode: "mutation_contract_item_not_pending"
|
|
3464
3501
|
};
|
|
3502
|
+
if (item.authorityDisposition === "conditional_wait" || item.waitAuthorization) return {
|
|
3503
|
+
status: "denied",
|
|
3504
|
+
reasonCode: item.authorityDisposition === "conditional_wait" ? "mutation_awaiting_root_condition" : "mutation_awaiting_root_wait"
|
|
3505
|
+
};
|
|
3506
|
+
if (item.authorityDisposition === "human_actor") return {
|
|
3507
|
+
status: "denied",
|
|
3508
|
+
reasonCode: "mutation_human_executor"
|
|
3509
|
+
};
|
|
3465
3510
|
if (item.kind !== "requirement" || item.verification.enforced !== true) return {
|
|
3466
3511
|
status: "denied",
|
|
3467
3512
|
reasonCode: "mutation_contract_item_not_authorizing"
|
|
@@ -3503,13 +3548,159 @@ function authorizeMutationFromProjection(projection, request) {
|
|
|
3503
3548
|
};
|
|
3504
3549
|
}
|
|
3505
3550
|
const PROTOCOL_CORRECTION_NOTICE = "Context Guard protocol correction: root-authorized work remains pending; continue with tools or obtain a typed boundary.";
|
|
3551
|
+
/**
|
|
3552
|
+
* Establish a boundary Guard itself owns, through the same durable record the
|
|
3553
|
+
* boundary tool writes.
|
|
3554
|
+
*
|
|
3555
|
+
* Replay reads boundaries from the `context_guard_boundary` call/result pair, so
|
|
3556
|
+
* a Guard-created boundary is written in exactly that wire shape rather than in
|
|
3557
|
+
* a private side channel — otherwise it would not survive a reload, and a
|
|
3558
|
+
* boundary that only exists in memory is not a persisted wait or stop.
|
|
3559
|
+
*
|
|
3560
|
+
* Returns the boundary only after the durable flush succeeded. A failed flush
|
|
3561
|
+
* reports the failure instead of a boundary, because an unflushed record must
|
|
3562
|
+
* never be read back as an established boundary.
|
|
3563
|
+
*/
|
|
3564
|
+
async function establishBoundary(agent, runtime, flush, request) {
|
|
3565
|
+
const projection = runtime.projection;
|
|
3566
|
+
const candidate = qualifyBoundary(projection, request);
|
|
3567
|
+
if (candidate.persistedResult !== "accepted") return { reasonCode: candidate.reasonCode };
|
|
3568
|
+
const session = agent.session;
|
|
3569
|
+
const callId = `guard-boundary-${candidate.id}`;
|
|
3570
|
+
session.append("tool/call", {
|
|
3571
|
+
turn: 0,
|
|
3572
|
+
step: session.seq,
|
|
3573
|
+
callId,
|
|
3574
|
+
name: "context_guard_boundary",
|
|
3575
|
+
arguments: JSON.stringify({
|
|
3576
|
+
disposition: request.disposition,
|
|
3577
|
+
qualification_kind: request.qualificationKind,
|
|
3578
|
+
qualification_ids: request.qualificationIds
|
|
3579
|
+
})
|
|
3580
|
+
});
|
|
3581
|
+
session.append("tool/result", {
|
|
3582
|
+
turn: 0,
|
|
3583
|
+
step: session.seq,
|
|
3584
|
+
message: createToolResultMessage({
|
|
3585
|
+
callId,
|
|
3586
|
+
content: [{
|
|
3587
|
+
type: "text",
|
|
3588
|
+
text: JSON.stringify({
|
|
3589
|
+
status: candidate.persistedResult,
|
|
3590
|
+
reason_code: candidate.reasonCode,
|
|
3591
|
+
boundary: { candidate_sha256: candidate.candidateSha256 }
|
|
3592
|
+
})
|
|
3593
|
+
}],
|
|
3594
|
+
isError: false
|
|
3595
|
+
})
|
|
3596
|
+
}, { surfaceOp: "append" });
|
|
3597
|
+
let durable = false;
|
|
3598
|
+
try {
|
|
3599
|
+
durable = await flush();
|
|
3600
|
+
} catch {
|
|
3601
|
+
durable = false;
|
|
3602
|
+
}
|
|
3603
|
+
runtime.setDurability(durable);
|
|
3604
|
+
runtime.sync();
|
|
3605
|
+
if (!durable) return { reasonCode: "boundary_flush_failed" };
|
|
3606
|
+
return {
|
|
3607
|
+
boundary: candidate,
|
|
3608
|
+
reasonCode: candidate.reasonCode
|
|
3609
|
+
};
|
|
3610
|
+
}
|
|
3611
|
+
/**
|
|
3612
|
+
* Effectuate a boundary Guard established in this turn, with the Goal revision
|
|
3613
|
+
* re-checked at the moment of the side effect.
|
|
3614
|
+
*
|
|
3615
|
+
* The progress fingerprint deliberately ignores the Goal revision, because an
|
|
3616
|
+
* edited Goal text is not progress. That is a statement about *detecting*
|
|
3617
|
+
* progress, not permission to act on a stale reference: before disarming, the
|
|
3618
|
+
* boundary's own Goal identity and revision are compared with the live readback,
|
|
3619
|
+
* so a Goal that changed under the boundary is refused rather than disarmed.
|
|
3620
|
+
*/
|
|
3621
|
+
async function effectuateOwnBoundary(runtime, boundary, access$1) {
|
|
3622
|
+
const goalAccess = access$1.goalAccess ?? {
|
|
3623
|
+
get: async () => void 0,
|
|
3624
|
+
disarm: async () => void 0
|
|
3625
|
+
};
|
|
3626
|
+
const recorded = boundary.goalRef;
|
|
3627
|
+
const effect = await effectuateBoundary(boundary, {
|
|
3628
|
+
...goalAccess,
|
|
3629
|
+
requalify: async () => {
|
|
3630
|
+
const live = await goalAccess.get();
|
|
3631
|
+
if (!live || !recorded) return false;
|
|
3632
|
+
return live.id === recorded.id && live.revision === recorded.revision && live.activation === "armed";
|
|
3633
|
+
}
|
|
3634
|
+
});
|
|
3635
|
+
if (effect.resumeRequired) {
|
|
3636
|
+
runtime.projection.integrity = "unknown";
|
|
3637
|
+
runtime.projection.integrityViolations.push(effect.reasonCode);
|
|
3638
|
+
}
|
|
3639
|
+
return effect.reasonCode;
|
|
3640
|
+
}
|
|
3506
3641
|
/** Production Stop boundary: durable replay first, then immutable/live checks. */
|
|
3507
3642
|
async function handleGuardTurnStopping(agent, runtime, access$1) {
|
|
3508
|
-
|
|
3643
|
+
let durable = false;
|
|
3644
|
+
try {
|
|
3645
|
+
durable = await access$1.flush();
|
|
3646
|
+
} catch {
|
|
3647
|
+
durable = false;
|
|
3648
|
+
}
|
|
3509
3649
|
runtime.setDurability(durable);
|
|
3510
3650
|
runtime.sync();
|
|
3511
3651
|
if (!durable) return "boundary_flush_failed";
|
|
3652
|
+
const rootInstruction = latestRootInstruction(agent.session?.snapshotEvents?.() ?? []);
|
|
3653
|
+
if (rootInstruction !== void 0 && isRootPauseRequest(rootInstruction.text) && !runtime.projection.handledControlSeqs.has(rootInstruction.seq) && access$1.pauseAccess) {
|
|
3654
|
+
agent.session.append("user/message", createUserMessage({
|
|
3655
|
+
content: [{
|
|
3656
|
+
type: "text",
|
|
3657
|
+
text: `${CONTROL_RECORD_PREFIX}${JSON.stringify({
|
|
3658
|
+
kind: "root_pause",
|
|
3659
|
+
rootSeq: rootInstruction.seq
|
|
3660
|
+
})}`
|
|
3661
|
+
}],
|
|
3662
|
+
source: {
|
|
3663
|
+
kind: "plugin",
|
|
3664
|
+
plugin: "context-guard",
|
|
3665
|
+
form: "notice",
|
|
3666
|
+
summary: boundContextSummary("carrying the root pause request to the host")
|
|
3667
|
+
}
|
|
3668
|
+
}), { surfaceOp: "append" });
|
|
3669
|
+
const current = await access$1.pauseAccess.get();
|
|
3670
|
+
const paused = current?.phase === "paused" && current.activation === "disarmed" ? current : await access$1.pauseAccess.pause();
|
|
3671
|
+
const readback$1 = await access$1.pauseAccess.get();
|
|
3672
|
+
if (!paused || paused.activation !== "disarmed" || readback$1?.activation !== "disarmed") {
|
|
3673
|
+
runtime.projection.integrity = "unknown";
|
|
3674
|
+
runtime.projection.integrityViolations.push("root_pause_readback_failed");
|
|
3675
|
+
return "root_pause_readback_failed";
|
|
3676
|
+
}
|
|
3677
|
+
return "root_pause_routed";
|
|
3678
|
+
}
|
|
3512
3679
|
const decision = decideTurnBoundary(runtime.projection);
|
|
3680
|
+
if (decision.noProgressClaim) {
|
|
3681
|
+
const record$1 = `${NO_PROGRESS_RECORD_PREFIX}${JSON.stringify(decision.noProgressClaim)}`;
|
|
3682
|
+
agent.session.append("user/message", createUserMessage({
|
|
3683
|
+
content: [{
|
|
3684
|
+
type: "text",
|
|
3685
|
+
text: record$1
|
|
3686
|
+
}],
|
|
3687
|
+
source: {
|
|
3688
|
+
kind: "plugin",
|
|
3689
|
+
plugin: "context-guard",
|
|
3690
|
+
form: "notice",
|
|
3691
|
+
summary: boundContextSummary("recording a turn boundary without relevant progress")
|
|
3692
|
+
}
|
|
3693
|
+
}), { surfaceOp: "append" });
|
|
3694
|
+
let recorded = false;
|
|
3695
|
+
try {
|
|
3696
|
+
recorded = await access$1.flush();
|
|
3697
|
+
} catch {
|
|
3698
|
+
recorded = false;
|
|
3699
|
+
}
|
|
3700
|
+
runtime.setDurability(recorded);
|
|
3701
|
+
runtime.sync();
|
|
3702
|
+
if (!recorded) return "boundary_flush_failed";
|
|
3703
|
+
}
|
|
3513
3704
|
if (decision.action === "continue") {
|
|
3514
3705
|
agent.steer(createUserMessage({
|
|
3515
3706
|
content: [{
|
|
@@ -3525,6 +3716,39 @@ async function handleGuardTurnStopping(agent, runtime, access$1) {
|
|
|
3525
3716
|
}));
|
|
3526
3717
|
return decision.reason ?? "protocol_correction_steer";
|
|
3527
3718
|
}
|
|
3719
|
+
if (decision.reason === "no_progress_bounded_disarm") {
|
|
3720
|
+
if (!access$1.goalAccess || !access$1.hostSupported) {
|
|
3721
|
+
runtime.projection.integrity = "unknown";
|
|
3722
|
+
runtime.projection.integrityViolations.push("boundary_host_lock_unsupported");
|
|
3723
|
+
return "boundary_host_lock_unsupported";
|
|
3724
|
+
}
|
|
3725
|
+
const established = await establishBoundary(agent, runtime, access$1.flush, {
|
|
3726
|
+
disposition: "guard_bounded_stop",
|
|
3727
|
+
qualificationKind: "guard_no_progress",
|
|
3728
|
+
qualificationIds: [progressFingerprint(runtime.projection)]
|
|
3729
|
+
});
|
|
3730
|
+
if (!established.boundary) return established.reasonCode;
|
|
3731
|
+
return await effectuateOwnBoundary(runtime, established.boundary, access$1);
|
|
3732
|
+
}
|
|
3733
|
+
if (decision.reason === "goal_round_driver_owns_continuation" && access$1.goalAccess) {
|
|
3734
|
+
const waiting = [...runtime.projection.items.values()].filter((item) => item.status === "pending" && item.waitAuthorization).map((item) => item.waitAuthorization.id).sort();
|
|
3735
|
+
const current = runtime.projection.boundaries.at(-1);
|
|
3736
|
+
const alreadyCurrent = current && isCurrentAcceptedBoundary(runtime.projection, current) && current.disposition === "user_wait" && current.qualificationIds.slice().sort().join(",") === waiting.join(",");
|
|
3737
|
+
if (waiting.length > 0 && !alreadyCurrent) {
|
|
3738
|
+
if (!access$1.hostSupported) {
|
|
3739
|
+
runtime.projection.integrity = "unknown";
|
|
3740
|
+
runtime.projection.integrityViolations.push("boundary_host_lock_unsupported");
|
|
3741
|
+
return "boundary_host_lock_unsupported";
|
|
3742
|
+
}
|
|
3743
|
+
const established = await establishBoundary(agent, runtime, access$1.flush, {
|
|
3744
|
+
disposition: "user_wait",
|
|
3745
|
+
qualificationKind: "root_explicit_wait",
|
|
3746
|
+
qualificationIds: waiting
|
|
3747
|
+
});
|
|
3748
|
+
if (established.boundary) return await effectuateOwnBoundary(runtime, established.boundary, access$1);
|
|
3749
|
+
return established.reasonCode;
|
|
3750
|
+
}
|
|
3751
|
+
}
|
|
3528
3752
|
if (decision.reason !== "accepted_boundary_pending_effectuation") return decision.reason ?? "safe_yield_pending_preserved";
|
|
3529
3753
|
const boundary = runtime.projection.boundaries.at(-1);
|
|
3530
3754
|
if (!boundary || !isCurrentAcceptedBoundary(runtime.projection, boundary)) return "boundary_candidate_stale";
|
|
@@ -3553,15 +3777,29 @@ async function handleGuardTurnStopping(agent, runtime, access$1) {
|
|
|
3553
3777
|
function createHostCapabilityEvaluator(hostLock) {
|
|
3554
3778
|
return (action) => evaluateHostCapability(hostLock, { action });
|
|
3555
3779
|
}
|
|
3780
|
+
/**
|
|
3781
|
+
* Durable session identity for the certificate binding, read from the
|
|
3782
|
+
* DSH Session V3 header plus the Session-owned inherited prefix length.
|
|
3783
|
+
*
|
|
3784
|
+
* Session V3 stamps `version: 3`, requires the `isSeeded` fork-lineage marker,
|
|
3785
|
+
* and moved the inherited-prefix length off the header onto the `Session`
|
|
3786
|
+
* (`inheritedEventCount`). Anything else is not a V3 identity: returning
|
|
3787
|
+
* `undefined` makes the projection report `session_ref_unavailable` instead of
|
|
3788
|
+
* certifying against a guessed identity.
|
|
3789
|
+
*/
|
|
3556
3790
|
function sessionHeaderForDigest(session) {
|
|
3557
3791
|
const raw = session.header;
|
|
3558
|
-
if (!raw ||
|
|
3792
|
+
if (!raw || raw.version !== SESSION_FORMAT_VERSION) return void 0;
|
|
3793
|
+
if (typeof raw.id !== "string" || typeof raw.createdAt !== "number") return void 0;
|
|
3794
|
+
if (typeof raw.isSeeded !== "boolean") return void 0;
|
|
3795
|
+
const inherited = session.inheritedEventCount;
|
|
3796
|
+
if (typeof inherited !== "number" || !Number.isSafeInteger(inherited) || inherited < 0) return void 0;
|
|
3559
3797
|
return {
|
|
3560
3798
|
version: raw.version,
|
|
3561
3799
|
id: raw.id,
|
|
3562
3800
|
createdAt: raw.createdAt,
|
|
3563
3801
|
...typeof raw.parentSession === "string" ? { parentSession: raw.parentSession } : {},
|
|
3564
|
-
|
|
3802
|
+
seedLength: inherited,
|
|
3565
3803
|
...typeof raw.agentPreset === "string" ? { agentPreset: raw.agentPreset } : {},
|
|
3566
3804
|
...typeof raw.origin === "string" ? { origin: raw.origin } : {},
|
|
3567
3805
|
delegationDepth: typeof raw.delegationDepth === "number" ? raw.delegationDepth : 0
|
|
@@ -3584,11 +3822,25 @@ function createRuntime(agent, config, hostLock = DEFAULT_HOST_LOCK, readGoalStat
|
|
|
3584
3822
|
if (refreshHostLock) hostLock = refreshHostLock();
|
|
3585
3823
|
const header = session.header;
|
|
3586
3824
|
const priorRecoveryDigest = projection.lastRecoveryDigest;
|
|
3587
|
-
const
|
|
3825
|
+
const sessionHeader = sessionHeaderForDigest(session);
|
|
3826
|
+
let events;
|
|
3827
|
+
try {
|
|
3828
|
+
events = snapshotSessionEvents(session);
|
|
3829
|
+
} catch (error) {
|
|
3830
|
+
const code = error instanceof SessionApiError ? error.code : "session_snapshot_failed";
|
|
3831
|
+
projection.integrity = "unknown";
|
|
3832
|
+
if (!projection.integrityViolations.includes(code)) projection.integrityViolations.push(code);
|
|
3833
|
+
return;
|
|
3834
|
+
}
|
|
3835
|
+
const derived = deriveProjection(events, { activation: config.activation }, {
|
|
3588
3836
|
cwd: typeof header?.cwd === "string" ? header.cwd : "",
|
|
3589
|
-
sessionHeader
|
|
3837
|
+
sessionHeader
|
|
3590
3838
|
}, durabilityConfirmed, hostLock);
|
|
3591
3839
|
Object.assign(projection, derived.projection);
|
|
3840
|
+
if (!sessionHeader) {
|
|
3841
|
+
projection.integrity = "unknown";
|
|
3842
|
+
if (!projection.integrityViolations.includes("session_ref_unavailable")) projection.integrityViolations.push("session_ref_unavailable");
|
|
3843
|
+
}
|
|
3592
3844
|
if (readGoalState) try {
|
|
3593
3845
|
const state = normalizeGoalState(readGoalState());
|
|
3594
3846
|
if (state && projection.currentGoalRef?.id === state.id && projection.currentGoalRef.revision === state.revision) {
|
|
@@ -3970,4 +4222,4 @@ function normalizeGoalState(value) {
|
|
|
3970
4222
|
}
|
|
3971
4223
|
|
|
3972
4224
|
//#endregion
|
|
3973
|
-
export { ACTION_MANIFEST, ACTION_MANIFEST_VERSION, ALPHA2_DSHMARKET_139_HOST_PACKAGES, ALPHA2_HOST_PACKAGES, ALPHA3_HOST_PACKAGES, BASE_HOST_PACKAGES, CAPTURE_V042_NOTICE, CERTIFICATE_VERSION, COMMAND_SURFACE_MANIFEST, CONFIRM_LINE_PATTERN, Config, 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, LEGACY_HOST_COHORTS, MIN_RECOVERY_CHAR_BUDGET, PROOF_KINDS, PROOF_PROTOCOL_VERSION, PROTOCOL_V3_NOTICE, PROTOCOL_V4_NOTICE, RC1_HOST_PACKAGES, SEMANTIC_ACTIONS, STATEFUL_ACTIONS, STOP_PROTOCOL_VERSION, SUPPORTED_EVIDENCE_ADAPTERS, actionCompatible, apply, authorityCaptureCounts, availableBoundaryQualifications, bindExecutableIdentity, bindLiveGoalCapability, bindProofToProjection, bindingSatisfies, canonicalArgvFromCommand, canonicalProjection, canonicalizePath, captureClause, captureItem, certifyCheckpoint, claimedBatchHasRealRootInput, classifyClause, classifyCompletionClaim, classifyTaskIntent, classifyUserInteraction, closingHint, commitIndexSnapshotDigest, commitTreeSnapshotDigest, confirmRebind, createGitPrestateEnvelope, createProjection, createProofManifest, currentContractDigest, decideTurnBoundary, decideTurnStopping, deriveItemDiagnosis, deriveProjection, digestStrings, effectuateBoundary, evaluateExternalWaitCapability, evaluateHostCapability, evaluateHostLock, evaluateToolSurfaceCapability, evidenceAvailabilityReason, evidenceCoverage, evidenceFromPersistedToolResult, evidenceMatchesItem, executeRevalidatedGitEffect, extractArtifactPaths, extractMethod, extractOperation, extractTextContent, extractToolSubject, gitCommandMatchesTarget, goalCompletionDenial, hasCurrentCertificate, hostLockContextFromComposedDump, hostLockRowsFromComposedDump, inject, injectActiveProfileHostLock, inspectTargetHostGraph, isCurrentAcceptedBoundary, isDeterministicCheck, isFrozenV042RebindResponse, isInformationalMessage, isRunExecutable, isStatefulAction, isVerifyingCapability, isWholeTaskCompletionClaim, itemDiagnosis, latestAssistantText, lifecyclePhase, name, normalizeClause, observeAssistantOutcome, openItems, packageRowsFromActiveGraph, packageRowsFromPnpmLock, parseConfirmationMessage, parseGitCommandManifest, parsePwshCommand, parseShellCommand, previewFirstStepInjection, proofDigest, proofEvidenceConstraints, proposeRebind, proposeRebindOutcome, proposeRebindV042, qualifyBoundary, readActiveHostGraph, rebindAttemptKey, rebindResponse, recoveryDigest, relevantEvidence, renderRecoveryPacket, replayRebindResult, requestedTargetAuthorizesMutation, requestedTargetMatchesResolved, resolveActiveProfileHostLock, resolveInstalledHostLock, revalidateGitPrestate, sanitizeClauseText, sanitizeUrl, segmentAuthorityBlocks, segmentClauses, selectHostCohort, semanticActionFromCommand, semanticActionFromText, sessionQuery, sha256, snapshotSessionEvents, supersedeItem, validateActionManifest, validateActionTarget, validateManifest, validateProofManifest, verifiedLinearCommitReadback, verifyComposedHostLockDump, withDurability };
|
|
4225
|
+
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, CAPTURE_V042_NOTICE, CERTIFICATE_VERSION, COMMAND_SURFACE_MANIFEST, CONFIRM_LINE_PATTERN, CONTROL_RECORD_PREFIX, Config, 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_KINDS, PROOF_PROTOCOL_VERSION, PROTOCOL_V3_NOTICE, PROTOCOL_V4_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, SUPPORTED_EVIDENCE_ADAPTERS, SUPPORTED_HOST_RANGE, SUPPORTED_HOST_VERSIONS, SessionApiError, actionCompatible, apply, authorityCaptureCounts, availableBoundaryQualifications, bindExecutableIdentity, bindLiveGoalCapability, bindProofToProjection, bindingSatisfies, canonicalArgvFromCommand, canonicalProjection, canonicalizePath, captureClause, captureItem, certifyCheckpoint, claimedBatchHasRealRootInput, classifyClause, classifyCompletionClaim, classifyTaskIntent, classifyUserInteraction, closingHint, combineHostPolicy, commitIndexSnapshotDigest, commitTreeSnapshotDigest, compareHostVersions, confirmRebind, createGitPrestateEnvelope, createProjection, createProofManifest, 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, proofDigest, proofEvidenceConstraints, proposeRebind, proposeRebindOutcome, proposeRebindV042, qualifyBoundary, readActiveHostGraph, rebindAttemptKey, rebindResponse, recoveryDigest, relevantEvidence, renderRecoveryPacket, replayRebindResult, requestedTargetAuthorizesMutation, requestedTargetMatchesResolved, resolveActiveProfileHostLock, resolveInstalledHostLock, revalidateGitPrestate, sanitizeClauseText, sanitizeUrl, satisfiesSupportedHostRange, segmentAuthorityBlocks, segmentClauses, selectHostCohort, semanticActionFromCommand, semanticActionFromText, semanticActionOfScope, sessionQuery, sha256, snapshotSessionEvents, statefulActionsOfScope, supersedeItem, validateActionManifest, validateActionTarget, validateManifest, validateProofManifest, verifiedLinearCommitReadback, verifyComposedHostLockDump, withDurability };
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -20,7 +20,12 @@ The effective plugin configuration and the DSH Session append-only log are the i
|
|
|
20
20
|
- effective plugin configuration — initial enablement (`opt-in` starts disabled; `always` starts enabled before log replay);
|
|
21
21
|
- `command/run` — later enablement (`/context-guard on|off|clear`) and epoch transitions;
|
|
22
22
|
- `user/message` — captured contract clauses;
|
|
23
|
-
- `tool/call` + `tool/result` — bounded evidence and completion-certificate attempts
|
|
23
|
+
- `tool/call` + `tool/result` — bounded evidence and completion-certificate attempts;
|
|
24
|
+
- `tool/ptc-dispatch-start` + `tool/ptc-dispatch` — evidence for sub-calls dispatched from a `run_code` program. These are the current names; the retired `tool/code-dispatch*` vocabulary is ignored and mints nothing;
|
|
25
|
+
- `compaction/summary` — the compaction cut that re-arms the recovery reminder;
|
|
26
|
+
- `goal/change` — the recorded Goal reference, revision, and phase used by the completion gate.
|
|
27
|
+
|
|
28
|
+
Everything else in the DSH log is deliberately ignored. In particular a V3 `system/message` is a plugin-sourced surface node rather than root authority, a compaction checkpoint `user/message` stays plugin context, and `request/header`, `request/context`, `assistant/attempt`, `session/end-seed` and raw `assistant` streams carry no contract state.
|
|
24
29
|
|
|
25
30
|
The in-memory `GuardProjection` is a rebuildable cache: `deriveProjection` applies the effective activation configuration, replays the native log deterministically, recomputes every contract, evidence, and certificate, and flags `corrupt` when a recorded certificate no longer re-derives from the evidence in the log. The projection and its evidence are session-scoped: a new DSH session starts a new projection and cannot import, look up, or certify evidence IDs from another session. A completed workflow that needs a certificate must therefore produce its evidence and call `context_guard_checkpoint` in the same session. Under `always`, replay begins enabled; changing an existing profile from `opt-in` to `always` can therefore bring earlier persisted user messages into the derived contract. A recorded `/context-guard off` disables capture from that point until a later `on`. A recorded `/context-guard clear` supersedes every pending requirement and acceptance under a `CLEAR:<revision>` sentinel (prohibitions are retained) and bumps the contract revision, so a fresh empty-binding checkpoint can certify while the guard stays enabled. Captured contracts always carry a concrete subject/surface, so no unrelated evidence can close a requirement.
|
|
26
31
|
|
|
@@ -28,7 +33,7 @@ The in-memory `GuardProjection` is a rebuildable cache: `deriveProjection` appli
|
|
|
28
33
|
|
|
29
34
|
The runtime separates what it injects from what it certifies. An internal lifecycle phase — `armed` (protection enabled, waiting for the first real root input), `active` (real input entered a step), `disabled` (explicitly off) — expresses the startup strategy only; certification still depends solely on durable events, the current contract, and the evidence chain.
|
|
30
35
|
|
|
31
|
-
Session start (`agent/session-start`) registers tools and the runtime, reads history, and arms recovery for resume/compact. It appends nothing, so a fresh session stays blank (`seq === 0`) and a DSH preset can still be selected while the session is new. The
|
|
36
|
+
Session start (`agent/session-start`) registers tools and the runtime, reads history, and arms recovery for resume/compact. It appends nothing, so a fresh session stays blank (`seq === 0`) and a DSH preset can still be selected while the session is new. The Web surface treats a session as blank until a `turn/start` (server preset lock) and falls back to `seq === 0` for cold list entries; Guard writes no message at T0, so both stay satisfiable. Guard reads history only through the DSH Session V3 `snapshotEvents()` API and refuses a session that does not expose it, so no V2 log can be projected as if it had V3 semantics.
|
|
32
37
|
|
|
33
38
|
At `agent/pre-step` the loop has CLAIMED this step's input but has not persisted it yet. A pure preview reads only the validated claim: under `always`, the first claimed batch that carries a real root user message (non-empty text, or any image/attachment part) injects the `Context Guard protocol boundary: v4.0.0` notice and a compact first-step guidance message ahead of the claimed messages, inside the same step batch. The formal projection never derives from the preview — the boundary and the user message become durable events when the loop appends the batch, and the contract is re-derived from them exactly as from any other log. `opt-in` never auto-injects; delegated/subagent sessions receive no boundary, guidance, or activation (their scope arrives through the parent's delegation prompt). Rejection, cancellation, or a filtered batch injects nothing and retries on the next legal input.
|
|
34
39
|
|