dsh-completion-guard 0.8.0 → 0.8.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 +19 -1
- package/CHANGELOG.zh-CN.md +18 -0
- package/README.md +17 -12
- package/README.zh-CN.md +17 -12
- package/bin/dsh-completion-guard-host-lock.mjs +103 -7
- package/dist/domain/index.d.ts +2 -2
- package/dist/domain/index.js +2 -2
- package/dist/{domain-D0zTh3O_.js → domain-B-2fya9P.js} +22039 -13785
- package/dist/{index-DMr57AgL.d.ts → index-DqvBEsNc.d.ts} +345 -29
- package/dist/index.d.ts +23 -2
- package/dist/index.js +198 -80
- package/docs/COMPATIBILITY.md +65 -10
- package/docs/DEVELOPMENT_PLAN_DSH_0_2_0_RC2_DESKTOP.md +85 -0
- package/docs/HISTORICAL_INCIDENT_COVERAGE.md +148 -0
- package/docs/HOST_LOCK_UPGRADE.md +72 -22
- package/docs/LOCAL_ACCEPTANCE.md +12 -2
- package/docs/RELEASE_NOTES_0_8_2.md +21 -0
- package/docs/THIRD_PARTY_LICENSES.md +27 -0
- package/manifests/rc020-rc1-byte-audit.json +944 -0
- package/manifests/rc020-rc2-byte-audit.json +948 -0
- package/manifests/supported-host.v1.json +93 -93
- package/package.json +39 -38
package/dist/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as PROOF_CAPABILITY_MATRIX, $i as ACTIVE_HOST_COHORT_ID, $n as admissibleForRemoval, $r as splitTextFragments, $t as releasePreEffectDecision, A as PROTOCOL_V3_NOTICE, Aa as CERTIFICATE_VERSION_V2, Ai as resolveActiveProfileHostLock, An as effectuateBoundary, Ar as interpretClause, At as V6_ORDINARY_COMPLETION_RULE_SHORT, B as extractTextContent, Ba as requestedTargetAuthorizesMutation, Bi as readAsarFile, Bn as rebindResponse, Br as kindOfScope, Bt as isV6PendingRootWait, C as SESSION_API_UNSUPPORTED, Ca as evaluateMinimumHostVersion, Ci as inspectTargetHostGraph, Cn as goalCompletionDenial, Cr as clauseIsGoverned, Ct as CLEANUP_CONDITION_RULE, D as projectCoreV2, Da as ACTION_MANIFEST_VERSION, Di as prepareDesktopHostTrust, Dn as unitDescendantIds, Dr as hasOrderedCoordination, Dt as MIN_RECOVERY_CHAR_BUDGET, E as snapshotSessionEvents, Ea as ACTION_MANIFEST, Ei as prepareActiveHostTrust, En as certificateClosure, Er as governedClauseRestrictsExecution, Et as DEFAULT_RECOVERY_CHAR_BUDGET, F as deriveProjection, Fa as SUPPORTED_EVIDENCE_ADAPTERS, Fi as DESKTOP_IDENTITY_FACTS, Fn as confirmRebind, Fr as isInformationalFragment, Ft as recoveryDigest, G as canonicalArgvFromCommand, Ga as validateActionTarget, Gi as writeDesktopRuntimeReceipt, Gn as capabilityRemedyPhrase, Gr as opensConditionLead, Gt as contractById, H as isDeterministicCheck, Ha as semanticActionFromCommand, Hi as readDesktopAppRuntime, Hn as CONFIRM_LINE_PATTERN, Hr as maskCodeSpans, Ht as OUTCOME_STRENGTH, I as legacyRecordsNeedingReview, Ia as actionCompatible, Ii as DESKTOP_PROFILE_PACKAGE_NAME, In as proposeRebind, Ir as isOpenObligation, It as recoveryTitle, J as parseShellCommand, Ji as hostTrustDigest, Jn as itemDiagnosis, Jr as qualificationOfClause, Jt as normalizeReservation, K as isRunExecutable, Ka as RC020_RC2_HOST_PACKAGES, Ki as HostTrustError, Kn as deriveItemDiagnosis, Kr as opensWithDirective, Kt as inFlightReservation, L as rootLocatorFlavor, La as boundedArtifactChoiceMatches, Li as DESKTOP_RUNTIME_PACKAGE_NAME, Ln as proposeRebindOutcome, Lr as isQuestionScopeNeedingReview, Lt as renderRecoveryPacket, M as PROTOCOL_V5_NOTICE, Ma as STATEFUL_ACTIONS, Mi as resolveInstalledHostLock, Mn as qualifyBoundary, Mr as introducesActionClause, Mt as cleanupConditionFor, N as PROTOCOL_V6_NOTICE, Na as STOP_PROTOCOL_VERSION, Ni as revalidateDesktopCoreLock, Nn as currentContractDigest, Nr as isExecutableItem, Nt as closingHint, O as CAPTURE_V042_NOTICE, Oa as BOUNDED_ARTIFACT_TYPES, Oi as prepareTargetHostTrust, On as BOUNDARY_RECORD_PREFIX, Or as hasQuestionScope, Ot as V6_ORDINARY_COMPLETION_RULE, P as applyUpgradeEligibility, Pa as STOP_PROTOCOL_VERSION_V2, Pi as verifyComposedHostLockDump, Pn as createProjection, Pr as isExplanationScope, Pt as openItems, Q as certifyCheckpoint, Qi as registryArchiveModules, Qn as actionHasCertificationPath, Qr as semanticActionOfScope, Qt as releaseCoverage, R as supersedeItem, Ra as isStatefulAction, Ri as auditDesktopInstalledImplementation, Rn as proposeRebindV042, Rr as isRestatement, Rt as v6CurrentRootBoundaries, S as sourcedNamedTestRoot, Sa as compareHostVersions, Si as inspectDesktopTargetGraph, Sn as v6TestPredicate, Sr as clauseAsksOwnQuestion, St as validateProofManifestV2, T as SessionApiError, Ta as satisfiesSupportedHostRange, Ti as packageRowsFromPnpmLock, Tn as certifiableOpenItems, Tr as explanationHasActionResidue, Tt as CLEANUP_CONDITION_RULE_SHORT, U as persistedToolResultStatus, Ua as semanticActionFromText, Ui as readDesktopDependency, Un as isFrozenV042RebindResponse, Ur as maskQuotedSpans, Ut as RELEASE_OPERATIONS, V as extractToolSubject, Va as requestedTargetMatchesResolved, Vi as readAsarIndex, Vn as replayRebindResult, Vr as legacyQuestionReadingIsInformational, Vt as sourceItemForCoreRequirement, W as withDurability, Wa as validateActionManifest, Wi as readDesktopTargetGraph, Wn as parseConfirmationMessage, Wr as namedActions, Wt as RELEASE_OPERATION_SURFACES, X as segmentAuthorityBlocks, Xi as qualifyHostTrust, Xn as relevantEvidence, Xr as reportingHeadGoverns, Xt as readbackSettlesContract, Y as authorityCaptureCounts, Yi as parseHostTrust, Yn as nativeFileTwoRole, Yr as questionHeadsClause, Yt as normalizeSettlement, Z as bindingIndividuallyAccepted, Zi as registryArchiveFiles, Zn as DEPENDENCY_FREE_ONLY_CONDITION, Zr as restatedContentOf, Zt as releaseContractFor, _ as previewFirstStepInjection, _a as HOST_VALIDATED_VERSIONS, _i as evaluateActiveHostLock, _n as latestAssistantText, _r as classifyUserInteraction, _t as requiredSubjectsOf, a as commitTreeSnapshotDigest, aa as GOAL_HOST_PACKAGES, ai as digestStrings, an as CONTROL_RECORD_PREFIX, ar as captureClause, at as bindProofToProjection, b as HOST_WORKDIR_PREFIX, ba as SUPPORTED_HOST_RANGE, bi as hostLockRowsFromComposedDump, bn as progressFingerprint, br as actionVerbMatches, bt as sessionQueryV2, c as gitCommandMatchesTarget, ca as bindExecutableIdentity, ci as sanitizeUrl, cn as assessmentAction, cr as environmentDefaultRepositoryTarget, ct as createProofManifest, d as verifiedLinearCommitReadback, da as evaluateGraphDerivedHostLock, di as activeRendererModule, dn as currentActionBases, dr as extractOperation, dt as proofDigest, ea as ACTIVE_HOST_COHORT_IDS, ei as statefulActionsOfScope, en as reservationFor, er as capabilityConsequence, et as PROOF_KINDS, f as FIRST_STEP_GUIDANCE, fa as evaluateHostCapability, fi as auditedDefaultWorkdirHost, fn as decideTurnBoundary, fr as isInformationalMessage, ft as proofDigestV2, g as lifecyclePhase, ga as selectHostCohort, gi as combineHostPolicy, gn as isWholeTaskCompletionClaim, gr as classifyTaskIntent, gt as proofV2Rejection, h as firstStepGuidanceV6, ha as hostVersionFromPackages, hi as auditedHostImplementation, hn as isRootPauseRequest, hr as npmEscapedPackageName, ht as proofOperationMatches, i as commitIndexSnapshotDigest, ia as EXPECTED_HOST_PACKAGES, ii as canonicalizePath, in as isVerifyingCapability, ir as removalIsPartiallyKnown, it as PROOF_PROTOCOL_VERSION_V2, j as PROTOCOL_V4_NOTICE, ja as SEMANTIC_ACTIONS, ji as resolveDesktopProfileHostLock, jn as isCurrentAcceptedBoundary, jr as interpretMessage, jt as carriesCleanupCondition, k as DEFAULT_DELEGATION_TOOL_NAMES, ka as CERTIFICATE_VERSION, ki as readActiveHostGraph, kn as availableBoundaryQualifications, kr as hasWorkPredicate, kt as V6_ORDINARY_COMPLETION_RULE_COMPACT, l as parseGitCommandManifest, la as bindLiveGoalCapability, li as sha256, ln as assessmentOutcomePredicate, lr as extractArtifactPaths, lt as createProofManifestV2, m as firstStepGuidance, ma as evaluateToolSurfaceCapability, mi as auditedForegroundRenderers, mn as decisionBoundaryKey, mr as canonicalRegistryBase, mt as proofHostSurfacesOf, n as GIT_COMMAND_MANIFEST_IDS, na as BASE_HOST_PACKAGES, ni as COMMAND_SURFACE_MANIFEST, nn as evidenceCoverage, nr as partialFailureOf, nt as PROOF_MANIFEST_DOMAIN_V2, o as createGitPrestateEnvelope, oa as HOST_CAPABILITY_PACKAGE_GROUPS, oi as normalizeClause, on as NO_PROGRESS_RECORD_PREFIX, or as captureItem, ot as bindProofV2ToProjection, p as claimedBatchHasRealRootInput, pa as evaluateHostLock, pi as auditedDefaultWorkdirProvider, pn as decideTurnStopping, pr as segmentClauses, pt as proofEvidenceConstraints, q as parsePwshCommand, qa as createHostAuditSession, qi as acquireHostTrust, qn as evidenceAvailabilityReason, qr as presentExplanationHead, qt as normalizeReleaseContract, r as GIT_COMMAND_TEMPLATES, ra as DEFAULT_HOST_LOCK, ri as validateManifest, rn as evidenceMatchesItem, rr as removalIsComplete, rt as PROOF_PROTOCOL_VERSION, s as executeRevalidatedGitEffect, sa as HOST_COHORTS, si as sanitizeClauseText, sn as NO_PROGRESS_TURNS_BEFORE_STOP, sr as classifyClause, st as canonicalProjection, t as RC020_RC1_HOST_PACKAGES, ta as ACTIVE_HOST_LAUNCHER_VERSION, ti as verbIsNegated, tn as bindingSatisfies, tr as capabilityFactOf, tt as PROOF_KINDS_V2, u as revalidateGitPrestate, ua as evaluateExternalWaitCapability, ui as HostProfileError, un as classifyCompletionClaim, ur as extractMethod, ut as proofCapabilityReport, v as projectSessionCoreV2, va as LATEST_TESTED_HOST_VERSION, vi as evaluateConfiguredHostLock, vn as latestRootInstruction, vr as GRANTED_QUALIFICATION, vt as scopeCoverageDigest, w as SESSION_EVENT_ENVELOPE_INVALID, wa as parseHostVersion, wi as packageRowsFromActiveGraph, wn as hasCurrentCertificate, wr as clauseIsProtected, wt as CLEANUP_CONDITION_RULE_COMPACT, x as captureHostWorkdir, xa as SUPPORTED_HOST_VERSIONS, xi as injectActiveProfileHostLock, xn as testOutcomePredicate, xr as clarifiedSpanOf, xt as validateProofManifest, y as sessionCoreSnapshot, ya as MIN_SUPPORTED_HOST_VERSION, yi as hostLockContextFromComposedDump, yn as observeAssistantOutcome, yr as LEGACY_QUALIFICATION, yt as sessionQuery, z as evidenceFromPersistedToolResult, za as requestedIdentityKey, zi as hasDesktopImporterState, zn as rebindAttemptKey, zr as itemHoldsExecutionAuthority, zt as currentV6Feedback } from "./domain-B-2fya9P.js";
|
|
2
2
|
import { boundContextSummary, createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
3
|
-
import { closeSync, constants, existsSync, fchmodSync, fstatSync, fsyncSync, lstatSync, mkdirSync, openSync, readFileSync, realpathSync, unlinkSync, writeSync } from "node:fs";
|
|
4
3
|
import { basename, delimiter, dirname, isAbsolute, join, posix, resolve, win32 } from "node:path";
|
|
5
|
-
import { createHash } from "node:crypto";
|
|
6
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { createHash } from "node:crypto";
|
|
6
|
+
import { closeSync, constants, existsSync, fchmodSync, fstatSync, fsyncSync, lstatSync, mkdirSync, openSync, readFileSync, realpathSync, unlinkSync, writeSync } from "node:fs";
|
|
7
|
+
import { gunzip } from "node:zlib";
|
|
8
|
+
import { execFile } from "node:child_process";
|
|
9
|
+
import { homedir, tmpdir } from "node:os";
|
|
7
10
|
import { JobId } from "@deepseek-ai/dsh-jobs";
|
|
8
11
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
9
|
-
import {
|
|
12
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
10
13
|
import { promisify } from "node:util";
|
|
11
|
-
import { execFile } from "node:child_process";
|
|
12
14
|
import { access, readFile, realpath } from "node:fs/promises";
|
|
13
|
-
import { gunzip } from "node:zlib";
|
|
14
15
|
import { SESSION_FORMAT_VERSION, Session, SessionId } from "@deepseek-ai/dsh-session";
|
|
15
16
|
|
|
16
17
|
//#region src/tools/rebind.ts
|
|
@@ -410,7 +411,7 @@ function openItemForTool(projection, item) {
|
|
|
410
411
|
...template ? { binding_template: template } : {}
|
|
411
412
|
};
|
|
412
413
|
}
|
|
413
|
-
function createCheckpointTool(getProjection, onRejected, prepare = async () => true) {
|
|
414
|
+
function createCheckpointTool(getProjection, onRejected, prepare = async () => true, revalidate = () => {}) {
|
|
414
415
|
return defineTool({
|
|
415
416
|
name: "context_guard_checkpoint",
|
|
416
417
|
description: "Read current ordinary closure from confirmed observations; request a certificate only for an explicitly adopted proof, Goal, or release contract.",
|
|
@@ -836,6 +837,7 @@ function createCheckpointTool(getProjection, onRejected, prepare = async () => t
|
|
|
836
837
|
order: closure.order
|
|
837
838
|
})) } : {}
|
|
838
839
|
}));
|
|
840
|
+
revalidate();
|
|
839
841
|
let proofState = {
|
|
840
842
|
status: "absent",
|
|
841
843
|
reason_codes: []
|
|
@@ -2487,6 +2489,10 @@ async function executeGuardAction(action, resolution, roots, signal, executableI
|
|
|
2487
2489
|
const tgzPath = requireString(resolution.commandManifest, "tgz_path");
|
|
2488
2490
|
const identity = tgzPath ? await tgzIdentity(tgzPath) : void 0;
|
|
2489
2491
|
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" };
|
|
2492
|
+
if (roots.preEffectVeto?.() === false) return {
|
|
2493
|
+
status: "unavailable",
|
|
2494
|
+
reasonCode: "pre_effect_host_veto_refused"
|
|
2495
|
+
};
|
|
2490
2496
|
await runCommand(roots, executableIdentity$1, [
|
|
2491
2497
|
"plugin",
|
|
2492
2498
|
"--profile",
|
|
@@ -2501,6 +2507,10 @@ async function executeGuardAction(action, resolution, roots, signal, executableI
|
|
|
2501
2507
|
const identity = tgzPath ? await tgzIdentity(tgzPath) : void 0;
|
|
2502
2508
|
const registry = typeof target.registry === "string" ? canonicalRegistryBase(target.registry, { allowLoopbackHttp: roots.allowLoopbackHttpRegistry }) : void 0;
|
|
2503
2509
|
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" };
|
|
2510
|
+
if (roots.preEffectVeto?.() === false) return {
|
|
2511
|
+
status: "unavailable",
|
|
2512
|
+
reasonCode: "pre_effect_host_veto_refused"
|
|
2513
|
+
};
|
|
2504
2514
|
await runCommand(roots, executableIdentity$1, [
|
|
2505
2515
|
"publish",
|
|
2506
2516
|
tgzPath,
|
|
@@ -3025,7 +3035,8 @@ function normalizedRoots(options) {
|
|
|
3025
3035
|
...options.readExecutableIdentity ? { readExecutableIdentity: options.readExecutableIdentity } : {},
|
|
3026
3036
|
...options.allowLoopbackHttpRegistry ? { allowLoopbackHttpRegistry: true } : {},
|
|
3027
3037
|
...options.releaseGate ? { releaseGate: options.releaseGate } : {},
|
|
3028
|
-
...options.releaseSettle ? { releaseSettle: options.releaseSettle } : {}
|
|
3038
|
+
...options.releaseSettle ? { releaseSettle: options.releaseSettle } : {},
|
|
3039
|
+
...options.preEffectVeto ? { preEffectVeto: options.preEffectVeto } : {}
|
|
3029
3040
|
};
|
|
3030
3041
|
}
|
|
3031
3042
|
function createActionTool(options = {}) {
|
|
@@ -3139,11 +3150,6 @@ function createActionTool(options = {}) {
|
|
|
3139
3150
|
reason_code: "action_adapter_unavailable",
|
|
3140
3151
|
...empty
|
|
3141
3152
|
};
|
|
3142
|
-
if (roots.hostCapability?.(action).status !== "supported" && roots.hostCapability) return {
|
|
3143
|
-
status: "unavailable",
|
|
3144
|
-
reason_code: "host_capability_unavailable",
|
|
3145
|
-
...empty
|
|
3146
|
-
};
|
|
3147
3153
|
let durable = false;
|
|
3148
3154
|
try {
|
|
3149
3155
|
durable = await roots.prepareMutation?.(agent) === true;
|
|
@@ -3173,6 +3179,31 @@ function createActionTool(options = {}) {
|
|
|
3173
3179
|
reason_code: "target_digest_mismatch",
|
|
3174
3180
|
...identity
|
|
3175
3181
|
};
|
|
3182
|
+
const executable = executableFor(action);
|
|
3183
|
+
let currentExecutable;
|
|
3184
|
+
if (executable) {
|
|
3185
|
+
currentExecutable = await (roots.readExecutableIdentity ?? executableIdentity)(executable, exec.signal);
|
|
3186
|
+
if (bindExecutableIdentity(resolution.executableIdentity, currentExecutable).status !== "supported") return {
|
|
3187
|
+
status: "unavailable",
|
|
3188
|
+
reason_code: "executable_identity_drift",
|
|
3189
|
+
...identity
|
|
3190
|
+
};
|
|
3191
|
+
}
|
|
3192
|
+
const releaseOperation = action === "publish" ? "npm_publish" : void 0;
|
|
3193
|
+
let observed;
|
|
3194
|
+
if (releaseOperation && roots.releaseGate) {
|
|
3195
|
+
observed = await observePublishCandidate(resolution, roots, exec.signal, cwdOf(agent));
|
|
3196
|
+
if (!observed) return {
|
|
3197
|
+
status: "unavailable",
|
|
3198
|
+
reason_code: "release_candidate_unobservable",
|
|
3199
|
+
...identity
|
|
3200
|
+
};
|
|
3201
|
+
}
|
|
3202
|
+
if (roots.hostCapability?.(action).status !== "supported" && roots.hostCapability) return {
|
|
3203
|
+
status: "unavailable",
|
|
3204
|
+
reason_code: "host_capability_unavailable",
|
|
3205
|
+
...empty
|
|
3206
|
+
};
|
|
3176
3207
|
let authorization;
|
|
3177
3208
|
try {
|
|
3178
3209
|
authorization = roots.authorizeMutation?.({
|
|
@@ -3189,26 +3220,9 @@ function createActionTool(options = {}) {
|
|
|
3189
3220
|
reason_code: authorization?.reasonCode ?? "mutation_authority_unavailable",
|
|
3190
3221
|
...identity
|
|
3191
3222
|
};
|
|
3192
|
-
const executable = executableFor(action);
|
|
3193
|
-
let currentExecutable;
|
|
3194
|
-
if (executable) {
|
|
3195
|
-
currentExecutable = await (roots.readExecutableIdentity ?? executableIdentity)(executable, exec.signal);
|
|
3196
|
-
if (bindExecutableIdentity(resolution.executableIdentity, currentExecutable).status !== "supported") return {
|
|
3197
|
-
status: "unavailable",
|
|
3198
|
-
reason_code: "executable_identity_drift",
|
|
3199
|
-
...identity
|
|
3200
|
-
};
|
|
3201
|
-
}
|
|
3202
|
-
const releaseOperation = action === "publish" ? "npm_publish" : void 0;
|
|
3203
3223
|
let releaseGranted = false;
|
|
3204
3224
|
let releaseContractId;
|
|
3205
3225
|
if (releaseOperation && roots.releaseGate) {
|
|
3206
|
-
const observed = await observePublishCandidate(resolution, roots, exec.signal, cwdOf(agent));
|
|
3207
|
-
if (!observed) return {
|
|
3208
|
-
status: "unavailable",
|
|
3209
|
-
reason_code: "release_candidate_unobservable",
|
|
3210
|
-
...identity
|
|
3211
|
-
};
|
|
3212
3226
|
let decision;
|
|
3213
3227
|
try {
|
|
3214
3228
|
decision = await roots.releaseGate({
|
|
@@ -5486,6 +5500,8 @@ const Config = Schema.object({
|
|
|
5486
5500
|
hostLockPolicy: Schema.string(),
|
|
5487
5501
|
hostLockRuntimeRoot: Schema.string(),
|
|
5488
5502
|
hostLockProfileRoot: Schema.string(),
|
|
5503
|
+
hostLockTrust: Schema.string(),
|
|
5504
|
+
hostLockDesktopDigest: Schema.string(),
|
|
5489
5505
|
hostLockPackages: Schema.array(Schema.object({
|
|
5490
5506
|
name: Schema.string().required(),
|
|
5491
5507
|
version: Schema.string(),
|
|
@@ -5514,15 +5530,19 @@ function resolveConfig(config) {
|
|
|
5514
5530
|
});
|
|
5515
5531
|
}
|
|
5516
5532
|
if (config.hostLockPlatform !== void 0 && config.hostLockPlatform !== "posix" && config.hostLockPlatform !== "windows") throw new TypeError("hostLockPlatform must be \"posix\" or \"windows\"");
|
|
5517
|
-
if (config.hostLockProfile !== void 0 && config.hostLockProfile !== "headless" && config.hostLockProfile !== "web") throw new TypeError("hostLockProfile must be \"headless\" or \"
|
|
5533
|
+
if (config.hostLockProfile !== void 0 && config.hostLockProfile !== "headless" && config.hostLockProfile !== "web" && config.hostLockProfile !== "desktop") throw new TypeError("hostLockProfile must be \"headless\", \"web\", or \"desktop\"");
|
|
5518
5534
|
const hasHostRows = hostLockPackages !== void 0;
|
|
5519
5535
|
if (hasHostRows !== (config.hostLockPlatform !== void 0) || hasHostRows !== (config.hostLockProfile !== void 0)) throw new TypeError("hostLockPackages, hostLockPlatform, and hostLockProfile must be injected together");
|
|
5520
5536
|
for (const key of [
|
|
5521
5537
|
"hostLockPolicy",
|
|
5522
5538
|
"hostLockRuntimeRoot",
|
|
5523
|
-
"hostLockProfileRoot"
|
|
5539
|
+
"hostLockProfileRoot",
|
|
5540
|
+
"hostLockTrust"
|
|
5524
5541
|
]) if (config[key] !== void 0 && (typeof config[key] !== "string" || !config[key])) throw new TypeError(`${key} must be a non-empty string`);
|
|
5542
|
+
if (config.hostLockDesktopDigest !== void 0 && (config.hostLockProfile !== "desktop" || typeof config.hostLockDesktopDigest !== "string" || !/^[a-f0-9]{64}$/.test(config.hostLockDesktopDigest))) throw new TypeError("hostLockDesktopDigest must be an injected Desktop SHA-256");
|
|
5525
5543
|
return {
|
|
5544
|
+
...typeof config.hostLockDesktopDigest === "string" ? { hostLockDesktopDigest: config.hostLockDesktopDigest } : {},
|
|
5545
|
+
...typeof config.hostLockTrust === "string" ? { hostLockTrust: config.hostLockTrust } : {},
|
|
5526
5546
|
...typeof config.hostLockPolicy === "string" ? { hostLockPolicy: config.hostLockPolicy } : {},
|
|
5527
5547
|
...typeof config.hostLockRuntimeRoot === "string" ? { hostLockRuntimeRoot: config.hostLockRuntimeRoot } : {},
|
|
5528
5548
|
...typeof config.hostLockProfileRoot === "string" ? { hostLockProfileRoot: config.hostLockProfileRoot } : {},
|
|
@@ -6107,8 +6127,9 @@ async function handleGuardTurnStopping(agent, runtime, access$1) {
|
|
|
6107
6127
|
durable = false;
|
|
6108
6128
|
}
|
|
6109
6129
|
runtime.setDurability(durable);
|
|
6110
|
-
runtime.sync();
|
|
6130
|
+
runtime.sync({ revalidateHostLock: true });
|
|
6111
6131
|
if (!durable) return "boundary_flush_failed";
|
|
6132
|
+
const hostSupported = access$1.hostSupported && runtime.projection.hostStatus === "supported";
|
|
6112
6133
|
const rootInstruction = latestRootInstruction(agent.session?.snapshotEvents?.() ?? []);
|
|
6113
6134
|
if (rootInstruction !== void 0 && isRootPauseRequest(rootInstruction.text) && !runtime.projection.handledControlSeqs.has(rootInstruction.seq) && access$1.pauseAccess) {
|
|
6114
6135
|
agent.session.append("user/message", createUserMessage({
|
|
@@ -6177,7 +6198,7 @@ async function handleGuardTurnStopping(agent, runtime, access$1) {
|
|
|
6177
6198
|
return decision.reason ?? "protocol_correction_steer";
|
|
6178
6199
|
}
|
|
6179
6200
|
if (decision.reason === "no_progress_bounded_disarm") {
|
|
6180
|
-
if (!access$1.goalAccess || !
|
|
6201
|
+
if (!access$1.goalAccess || !hostSupported) {
|
|
6181
6202
|
runtime.projection.integrity = "unknown";
|
|
6182
6203
|
runtime.projection.integrityViolations.push("boundary_host_lock_unsupported");
|
|
6183
6204
|
return "boundary_host_lock_unsupported";
|
|
@@ -6195,7 +6216,7 @@ async function handleGuardTurnStopping(agent, runtime, access$1) {
|
|
|
6195
6216
|
const current = runtime.projection.boundaries.at(-1);
|
|
6196
6217
|
const alreadyCurrent = current && isCurrentAcceptedBoundary(runtime.projection, current) && current.disposition === "user_wait" && current.qualificationIds.slice().sort().join(",") === waiting.join(",");
|
|
6197
6218
|
if (waiting.length > 0 && !alreadyCurrent) {
|
|
6198
|
-
if (!
|
|
6219
|
+
if (!hostSupported) {
|
|
6199
6220
|
runtime.projection.integrity = "unknown";
|
|
6200
6221
|
runtime.projection.integrityViolations.push("boundary_host_lock_unsupported");
|
|
6201
6222
|
return "boundary_host_lock_unsupported";
|
|
@@ -6212,15 +6233,17 @@ async function handleGuardTurnStopping(agent, runtime, access$1) {
|
|
|
6212
6233
|
if (decision.reason !== "accepted_boundary_pending_effectuation") return decision.reason ?? "safe_yield_pending_preserved";
|
|
6213
6234
|
const boundary = runtime.projection.boundaries.at(-1);
|
|
6214
6235
|
if (!boundary || !isCurrentAcceptedBoundary(runtime.projection, boundary)) return "boundary_candidate_stale";
|
|
6215
|
-
if (boundary.goalRef && (!access$1.goalAccess || !
|
|
6236
|
+
if (boundary.goalRef && (!access$1.goalAccess || !hostSupported)) {
|
|
6216
6237
|
runtime.projection.integrity = "unknown";
|
|
6217
6238
|
runtime.projection.integrityViolations.push("boundary_host_lock_unsupported");
|
|
6218
6239
|
return "boundary_host_lock_unsupported";
|
|
6219
6240
|
}
|
|
6220
|
-
const requalify = boundary.disposition === "external_wait" ? async () =>
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6241
|
+
const requalify = boundary.disposition === "external_wait" ? async () => {
|
|
6242
|
+
return (access$1.refreshExternalWaitCapability?.() ?? access$1.externalWaitCapability)?.status === "supported" && boundary.qualificationIds.every((id) => {
|
|
6243
|
+
const row = access$1.readExternalOperation(id);
|
|
6244
|
+
return row?.status === "running" || row?.status === "pending";
|
|
6245
|
+
});
|
|
6246
|
+
} : void 0;
|
|
6224
6247
|
const effect = await effectuateBoundary(boundary, {
|
|
6225
6248
|
...access$1.goalAccess ?? {
|
|
6226
6249
|
get: async () => void 0,
|
|
@@ -6285,7 +6308,6 @@ function createRuntime(agent, config, hostLock = DEFAULT_HOST_LOCK, readGoalStat
|
|
|
6285
6308
|
const persistenceCorrectionAttempts = projection.persistenceCorrectionAttempts;
|
|
6286
6309
|
const rebuild = () => {
|
|
6287
6310
|
const previousReleaseContracts = projection.releaseContracts.length;
|
|
6288
|
-
if (refreshHostLock) hostLock = refreshHostLock();
|
|
6289
6311
|
const header = session.header;
|
|
6290
6312
|
const priorRecoveryDigest = projection.lastRecoveryDigest;
|
|
6291
6313
|
const sessionHeader = sessionHeaderForDigest(session);
|
|
@@ -6372,11 +6394,33 @@ function createRuntime(agent, config, hostLock = DEFAULT_HOST_LOCK, readGoalStat
|
|
|
6372
6394
|
observedCompactionSeq = derived.lastCompactionSeq;
|
|
6373
6395
|
}
|
|
6374
6396
|
};
|
|
6375
|
-
const
|
|
6397
|
+
const entryStorage = new AsyncLocalStorage();
|
|
6398
|
+
const sync = (options) => {
|
|
6399
|
+
if (options?.revalidateHostLock && refreshHostLock) {
|
|
6400
|
+
const cell = entryStorage.getStore();
|
|
6401
|
+
if (cell && !cell.stale) hostLock = cell.lock;
|
|
6402
|
+
else {
|
|
6403
|
+
hostLock = refreshHostLock();
|
|
6404
|
+
if (cell) {
|
|
6405
|
+
cell.lock = hostLock;
|
|
6406
|
+
cell.stale = false;
|
|
6407
|
+
queueMicrotask(() => {
|
|
6408
|
+
cell.stale = true;
|
|
6409
|
+
});
|
|
6410
|
+
}
|
|
6411
|
+
}
|
|
6412
|
+
}
|
|
6376
6413
|
rebuild();
|
|
6377
6414
|
};
|
|
6415
|
+
const runHostLockEntry = async (operation) => {
|
|
6416
|
+
if (!refreshHostLock) return await operation();
|
|
6417
|
+
return await entryStorage.run({
|
|
6418
|
+
lock: void 0,
|
|
6419
|
+
stale: true
|
|
6420
|
+
}, async () => await operation());
|
|
6421
|
+
};
|
|
6378
6422
|
const setEnabled = (_enabled) => {
|
|
6379
|
-
|
|
6423
|
+
sync({ revalidateHostLock: true });
|
|
6380
6424
|
};
|
|
6381
6425
|
const setDurability = (confirmed) => {
|
|
6382
6426
|
durabilityConfirmed = confirmed;
|
|
@@ -6413,6 +6457,7 @@ function createRuntime(agent, config, hostLock = DEFAULT_HOST_LOCK, readGoalStat
|
|
|
6413
6457
|
return [...pendingRecoveryCauses];
|
|
6414
6458
|
},
|
|
6415
6459
|
sync,
|
|
6460
|
+
runHostLockEntry,
|
|
6416
6461
|
setEnabled,
|
|
6417
6462
|
setDurability,
|
|
6418
6463
|
markRecoveryNeeded,
|
|
@@ -6434,18 +6479,56 @@ function isDelegatedSession(session) {
|
|
|
6434
6479
|
return header?.origin === "subagent" || typeof header?.delegationDepth === "number" && header.delegationDepth > 0 || typeof header?.parentSession === "string";
|
|
6435
6480
|
}
|
|
6436
6481
|
/** Never reinterpret a legacy injected snapshot as freshly accepted core/v1. */
|
|
6437
|
-
function revalidateCoreLock(config, expected) {
|
|
6482
|
+
function revalidateCoreLock(config, expected, providedSession) {
|
|
6438
6483
|
if (config.hostLockPolicy !== "dsh-core/v1" || !config.hostLockRuntimeRoot || !config.hostLockProfileRoot) return {
|
|
6439
6484
|
...expected,
|
|
6440
6485
|
status: "unavailable",
|
|
6441
6486
|
goalAvailable: false,
|
|
6442
6487
|
reasonCode: "host_lock_migration_required"
|
|
6443
6488
|
};
|
|
6489
|
+
if (config.hostLockProfile === "desktop") {
|
|
6490
|
+
if (!config.hostLockDesktopDigest) return {
|
|
6491
|
+
...expected,
|
|
6492
|
+
status: "unavailable",
|
|
6493
|
+
goalAvailable: false,
|
|
6494
|
+
reasonCode: "host_lock_migration_required"
|
|
6495
|
+
};
|
|
6496
|
+
try {
|
|
6497
|
+
const configured = evaluateConfiguredHostLock(config.hostLockPackages ?? [], {
|
|
6498
|
+
platform: config.hostLockPlatform,
|
|
6499
|
+
profileKind: "desktop"
|
|
6500
|
+
}, config.hostLockTrust, config.hostLockProfileRoot);
|
|
6501
|
+
if (configured.status !== "supported") return configured;
|
|
6502
|
+
const actual = revalidateDesktopCoreLock(config.hostLockRuntimeRoot, config.hostLockProfileRoot, expected, config.hostLockTrust);
|
|
6503
|
+
if (actual.status !== "supported") return actual;
|
|
6504
|
+
const currentRows = evaluateConfiguredHostLock(actual.packages, {
|
|
6505
|
+
platform: config.hostLockPlatform,
|
|
6506
|
+
profileKind: "desktop"
|
|
6507
|
+
}, config.hostLockTrust, config.hostLockProfileRoot);
|
|
6508
|
+
if (actual.digest !== config.hostLockDesktopDigest || currentRows.digest !== configured.digest) return {
|
|
6509
|
+
...actual,
|
|
6510
|
+
status: "unsupported",
|
|
6511
|
+
goalAvailable: false,
|
|
6512
|
+
reasonCode: "host_lock_installed_graph_drift"
|
|
6513
|
+
};
|
|
6514
|
+
return actual;
|
|
6515
|
+
} catch {
|
|
6516
|
+
return {
|
|
6517
|
+
...expected,
|
|
6518
|
+
status: "unavailable",
|
|
6519
|
+
goalAvailable: false,
|
|
6520
|
+
reasonCode: "host_lock_missing"
|
|
6521
|
+
};
|
|
6522
|
+
}
|
|
6523
|
+
}
|
|
6524
|
+
const session = providedSession ?? createHostAuditSession();
|
|
6444
6525
|
try {
|
|
6445
|
-
const
|
|
6526
|
+
const runtimeRoot = session.realpath(config.hostLockRuntimeRoot);
|
|
6527
|
+
const profileRoot = session.realpath(config.hostLockProfileRoot);
|
|
6528
|
+
const actual = evaluateActiveHostLock(runtimeRoot, profileRoot, {
|
|
6446
6529
|
platform: config.hostLockPlatform,
|
|
6447
6530
|
profileKind: config.hostLockProfile
|
|
6448
|
-
});
|
|
6531
|
+
}, session, config.hostLockTrust);
|
|
6449
6532
|
if (actual.status !== "supported") return actual;
|
|
6450
6533
|
if (actual.digest !== expected.digest) return {
|
|
6451
6534
|
...actual,
|
|
@@ -6453,13 +6536,7 @@ function revalidateCoreLock(config, expected) {
|
|
|
6453
6536
|
goalAvailable: false,
|
|
6454
6537
|
reasonCode: "host_lock_installed_graph_drift"
|
|
6455
6538
|
};
|
|
6456
|
-
|
|
6457
|
-
...actual,
|
|
6458
|
-
status: "unsupported",
|
|
6459
|
-
goalAvailable: false,
|
|
6460
|
-
reasonCode: "host_lock_installed_graph_drift"
|
|
6461
|
-
};
|
|
6462
|
-
const audited = auditedForegroundRenderers(config.hostLockRuntimeRoot, config.hostLockProfileRoot);
|
|
6539
|
+
const audited = auditedForegroundRenderers(runtimeRoot, profileRoot, session);
|
|
6463
6540
|
return audited.length ? {
|
|
6464
6541
|
...actual,
|
|
6465
6542
|
auditedForegroundRenderers: audited,
|
|
@@ -6481,7 +6558,8 @@ function registerPassiveHostWorkdirObserver(agent, hostLockAtCall, attestedRoute
|
|
|
6481
6558
|
const pre = agent.ctx.on("tools/pre-execute", async (exec, next) => {
|
|
6482
6559
|
if (exec.agent === agent && (exec.name === "bash" || exec.name === "pwsh")) try {
|
|
6483
6560
|
const policy = agent.ctx.get("sandboxPolicy");
|
|
6484
|
-
const
|
|
6561
|
+
const audit = createHostAuditSession();
|
|
6562
|
+
const receipt = captureHostWorkdir(agent.session, exec, hostLockAtCall(audit), policy, await attestedRouteAtCall(exec.name, agent.ctx.get("shell"), policy, audit), sourcedRootAtCall?.(exec) ?? null, SESSION_FORMAT_VERSION);
|
|
6485
6563
|
if (receipt) pending.set(exec, receipt);
|
|
6486
6564
|
} catch {}
|
|
6487
6565
|
return next();
|
|
@@ -6515,13 +6593,18 @@ function registerPassiveHostWorkdirObserver(agent, hostLockAtCall, attestedRoute
|
|
|
6515
6593
|
}
|
|
6516
6594
|
function apply(ctx, rawConfig = {}, seams = {}) {
|
|
6517
6595
|
const config = resolveConfig(rawConfig);
|
|
6518
|
-
const
|
|
6596
|
+
const configuredHostLock = seams.hostLock ?? evaluateConfiguredHostLock(config.hostLockPackages ?? [], {
|
|
6519
6597
|
platform: config.hostLockPlatform,
|
|
6520
6598
|
profileKind: config.hostLockProfile
|
|
6521
|
-
});
|
|
6599
|
+
}, config.hostLockTrust, config.hostLockProfileRoot);
|
|
6600
|
+
const installedHostLock = seams.hostLock ?? (config.hostLockProfile === "desktop" && config.hostLockDesktopDigest ? {
|
|
6601
|
+
...configuredHostLock,
|
|
6602
|
+
digest: config.hostLockDesktopDigest
|
|
6603
|
+
} : configuredHostLock);
|
|
6522
6604
|
const runtimes = /* @__PURE__ */ new Map();
|
|
6523
6605
|
const privateLedgerRoot = seams.privateLedgerRoot ?? resolvePrivateLedgerRoot(void 0, process.env.DSH_HOME, homedir());
|
|
6524
6606
|
const hostLocks = /* @__PURE__ */ new Map();
|
|
6607
|
+
const qualifiedGoalService = (agent) => (hostLocks.get(agent) ?? installedHostLock).goalQualificationFailure ? void 0 : optionalGoalService(ctx, agent);
|
|
6525
6608
|
const ledgerContext = (agent, fallback = installedHostLock) => ({
|
|
6526
6609
|
sessionId: String(agent.session.id),
|
|
6527
6610
|
sessionHeader: structuredClone(agent.session.header),
|
|
@@ -6542,19 +6625,25 @@ function apply(ctx, rawConfig = {}, seams = {}) {
|
|
|
6542
6625
|
ctx.on("agent/disposed", ({ agent }) => {
|
|
6543
6626
|
detach(agent);
|
|
6544
6627
|
});
|
|
6628
|
+
/** One full host-lock validation for the named agent, recorded as the
|
|
6629
|
+
* agent's current authority. Every fresh-validation entry funnels here. */
|
|
6630
|
+
const fullHostLockValidation = () => {
|
|
6631
|
+
const evaluated = revalidateCoreLock(config, installedHostLock);
|
|
6632
|
+
seams.onHostLockValidation?.();
|
|
6633
|
+
return evaluated;
|
|
6634
|
+
};
|
|
6635
|
+
const refreshAgentHostLock = (agent) => {
|
|
6636
|
+
const current = bindLiveGoalCapability(seams.hostLock ?? fullHostLockValidation(), Boolean(qualifiedGoalService(agent)) && hasPinnedUpdateGoalTool(agent));
|
|
6637
|
+
hostLocks.set(agent, current);
|
|
6638
|
+
return current;
|
|
6639
|
+
};
|
|
6545
6640
|
const ensure = (agent) => {
|
|
6546
6641
|
let runtime = runtimes.get(agent);
|
|
6547
6642
|
if (!runtime) {
|
|
6548
|
-
const goals =
|
|
6549
|
-
const
|
|
6550
|
-
|
|
6551
|
-
hostLocks.set(agent, current);
|
|
6552
|
-
return current;
|
|
6553
|
-
};
|
|
6554
|
-
const agentHostLock = refreshHostLock();
|
|
6555
|
-
runtime = createRuntime(agent, config, agentHostLock, goals ? () => goals.get(agent) : void 0, refreshHostLock, privateLedgerRoot ? () => readPrivateLedger(privateLedgerRoot, ledgerContext(agent, agentHostLock)) : void 0, privateLedgerRoot ? () => initializePrivateLedger(privateLedgerRoot, ledgerContext(agent, agentHostLock)) : void 0);
|
|
6643
|
+
const goals = qualifiedGoalService(agent);
|
|
6644
|
+
const agentHostLock = refreshAgentHostLock(agent);
|
|
6645
|
+
runtime = createRuntime(agent, config, agentHostLock, goals ? () => goals.get(agent) : void 0, () => refreshAgentHostLock(agent), privateLedgerRoot ? () => readPrivateLedger(privateLedgerRoot, ledgerContext(agent, agentHostLock)) : void 0, privateLedgerRoot ? () => initializePrivateLedger(privateLedgerRoot, ledgerContext(agent, agentHostLock)) : void 0);
|
|
6556
6646
|
runtimes.set(agent, runtime);
|
|
6557
|
-
hostLocks.set(agent, agentHostLock);
|
|
6558
6647
|
}
|
|
6559
6648
|
return runtime;
|
|
6560
6649
|
};
|
|
@@ -6585,7 +6674,12 @@ function apply(ctx, rawConfig = {}, seams = {}) {
|
|
|
6585
6674
|
runtime.projection.lastRecoveryDigest = void 0;
|
|
6586
6675
|
runtime.markRecoveryNeeded(source === "resume" ? "resume" : "compaction");
|
|
6587
6676
|
}
|
|
6588
|
-
own(registerPassiveHostWorkdirObserver(agent, () =>
|
|
6677
|
+
own(registerPassiveHostWorkdirObserver(agent, (audit) => {
|
|
6678
|
+
if (seams.hostLock) return seams.hostLock;
|
|
6679
|
+
const evaluated = revalidateCoreLock(config, installedHostLock, audit);
|
|
6680
|
+
seams.onHostLockValidation?.();
|
|
6681
|
+
return evaluated;
|
|
6682
|
+
}, (tool, provider, policy, audit) => config.hostLockRuntimeRoot && config.hostLockProfileRoot ? auditedDefaultWorkdirProvider(config.hostLockRuntimeRoot, config.hostLockProfileRoot, tool, provider, policy, audit) : false, (exec) => {
|
|
6589
6683
|
runtime.sync();
|
|
6590
6684
|
return sourcedNamedTestRoot(runtime.projection, agent.session, exec.arguments);
|
|
6591
6685
|
}));
|
|
@@ -6600,7 +6694,7 @@ function apply(ctx, rawConfig = {}, seams = {}) {
|
|
|
6600
6694
|
runtime.setDurability(durable);
|
|
6601
6695
|
runtime.sync();
|
|
6602
6696
|
return durable;
|
|
6603
|
-
}));
|
|
6697
|
+
}, () => runtime.sync({ revalidateHostLock: true })));
|
|
6604
6698
|
ownedTools.register(createBoundaryTool(() => runtime.projection, async () => {
|
|
6605
6699
|
const durable = await ctx.sessions.flush(agent.session);
|
|
6606
6700
|
runtime.setDurability(durable);
|
|
@@ -6615,11 +6709,17 @@ function apply(ctx, rawConfig = {}, seams = {}) {
|
|
|
6615
6709
|
runtime.sync();
|
|
6616
6710
|
return durable;
|
|
6617
6711
|
};
|
|
6712
|
+
const hostCapabilityFromCache = (action) => createHostCapabilityEvaluator(hostLocks.get(agent) ?? installedHostLock)(action);
|
|
6618
6713
|
const evidenceOptions = {
|
|
6619
|
-
hostCapability:
|
|
6714
|
+
hostCapability: hostCapabilityFromCache,
|
|
6620
6715
|
...seams.commandRunner ? { commandRunner: seams.commandRunner } : {},
|
|
6621
6716
|
...seams.fetcher ? { fetcher: seams.fetcher } : {},
|
|
6717
|
+
...seams.readExecutableIdentity ? { readExecutableIdentity: seams.readExecutableIdentity } : {},
|
|
6622
6718
|
...seams.allowLoopbackHttpRegistry ? { allowLoopbackHttpRegistry: true } : {},
|
|
6719
|
+
preEffectVeto: () => {
|
|
6720
|
+
runtime.sync({ revalidateHostLock: true });
|
|
6721
|
+
return runtime.projection.hostStatus === "supported";
|
|
6722
|
+
},
|
|
6623
6723
|
prepareMutation: async (toolAgent) => {
|
|
6624
6724
|
if (toolAgent.session !== agent.session) return false;
|
|
6625
6725
|
const durable = await ctx.sessions.flush(agent.session);
|
|
@@ -6628,20 +6728,14 @@ function apply(ctx, rawConfig = {}, seams = {}) {
|
|
|
6628
6728
|
return durable;
|
|
6629
6729
|
},
|
|
6630
6730
|
authorizeMutation: (request) => {
|
|
6631
|
-
runtime.sync();
|
|
6731
|
+
runtime.sync({ revalidateHostLock: true });
|
|
6632
6732
|
return authorizeMutationFromProjection(runtime.projection, request);
|
|
6633
6733
|
},
|
|
6634
6734
|
marketOrigin: optionalMarketOrigin(ctx, agent),
|
|
6635
6735
|
hasRestartIntent: (resolutionCallId, serviceId, preGeneration) => hasPrivateRestartIntent(readPrivateLedger(privateLedgerRoot, ledgerContext(agent)), resolutionCallId, serviceId, preGeneration),
|
|
6636
6736
|
releaseGate: async (request) => {
|
|
6637
|
-
runtime.sync();
|
|
6638
|
-
const projection = runtime.projection;
|
|
6639
|
-
if (!(projection.policy === "release" || projection.releaseContracts.length > 0)) return {
|
|
6640
|
-
status: "denied",
|
|
6641
|
-
reasonCode: "release_contract_not_adopted"
|
|
6642
|
-
};
|
|
6643
6737
|
const observed = { ...request.observed };
|
|
6644
|
-
const declaredRef = releaseContractFor(projection, request.operation)?.candidate.ref;
|
|
6738
|
+
const declaredRef = releaseContractFor(runtime.projection, request.operation)?.candidate.ref;
|
|
6645
6739
|
if (declaredRef !== void 0 && observed.ref === void 0) {
|
|
6646
6740
|
const refSha = await resolveAuditedRef(sessionCwd(runtime.session), declaredRef, evidenceOptions, requestSignal());
|
|
6647
6741
|
if (refSha !== void 0) {
|
|
@@ -6649,6 +6743,16 @@ function apply(ctx, rawConfig = {}, seams = {}) {
|
|
|
6649
6743
|
observed.refSha = refSha;
|
|
6650
6744
|
}
|
|
6651
6745
|
}
|
|
6746
|
+
runtime.sync({ revalidateHostLock: true });
|
|
6747
|
+
const projection = runtime.projection;
|
|
6748
|
+
if (!(projection.policy === "release" || projection.releaseContracts.length > 0)) return {
|
|
6749
|
+
status: "denied",
|
|
6750
|
+
reasonCode: "release_contract_not_adopted"
|
|
6751
|
+
};
|
|
6752
|
+
if (projection.hostStatus !== "supported") return {
|
|
6753
|
+
status: "denied",
|
|
6754
|
+
reasonCode: projection.hostReasonCode ?? "host_lock_unavailable"
|
|
6755
|
+
};
|
|
6652
6756
|
const decision = releasePreEffectDecision(projection, {
|
|
6653
6757
|
operation: request.operation,
|
|
6654
6758
|
observed,
|
|
@@ -6723,7 +6827,17 @@ function apply(ctx, rawConfig = {}, seams = {}) {
|
|
|
6723
6827
|
fs: ctx.fs,
|
|
6724
6828
|
flush: (session) => ctx.sessions.flush(session)
|
|
6725
6829
|
}));
|
|
6726
|
-
|
|
6830
|
+
const actionTool = createActionTool({
|
|
6831
|
+
...evidenceOptions,
|
|
6832
|
+
hostCapability: (action) => {
|
|
6833
|
+
runtime.sync({ revalidateHostLock: true });
|
|
6834
|
+
return createHostCapabilityEvaluator(hostLocks.get(agent) ?? installedHostLock)(action);
|
|
6835
|
+
}
|
|
6836
|
+
});
|
|
6837
|
+
ownedTools.register({
|
|
6838
|
+
...actionTool,
|
|
6839
|
+
execute: (...args) => runtime.runHostLockEntry(() => actionTool.execute(...args))
|
|
6840
|
+
});
|
|
6727
6841
|
ownedTools.register(createPrepareTool({
|
|
6728
6842
|
getProjection: () => runtime.projection,
|
|
6729
6843
|
hostCapability: (action) => {
|
|
@@ -6765,7 +6879,10 @@ function apply(ctx, rawConfig = {}, seams = {}) {
|
|
|
6765
6879
|
})
|
|
6766
6880
|
}));
|
|
6767
6881
|
ownedTools.register(createExternalOperationTool((id, toolAgent) => readExternalOperation(ctx, toolAgent, id), () => evaluateExternalWaitCapability(hostLocks.get(agent) ?? installedHostLock)));
|
|
6768
|
-
ownedTools.guard((exec) =>
|
|
6882
|
+
ownedTools.guard((exec) => {
|
|
6883
|
+
if (exec.name === "update_goal" && exec.arguments?.action === "complete" && runtime.projection.enabled) runtime.sync({ revalidateHostLock: true });
|
|
6884
|
+
return goalCompletionDenial(runtime.projection, exec.name, exec.arguments);
|
|
6885
|
+
});
|
|
6769
6886
|
} catch (error) {
|
|
6770
6887
|
detach(agent);
|
|
6771
6888
|
throw error;
|
|
@@ -6835,11 +6952,12 @@ function apply(ctx, rawConfig = {}, seams = {}) {
|
|
|
6835
6952
|
});
|
|
6836
6953
|
ctx.on("agent/turn-stopping", async ({ agent }) => {
|
|
6837
6954
|
const runtime = ensure(agent);
|
|
6838
|
-
const goals =
|
|
6955
|
+
const goals = qualifiedGoalService(agent);
|
|
6839
6956
|
await handleGuardTurnStopping(agent, runtime, {
|
|
6840
6957
|
flush: () => ctx.sessions.flush(agent.session),
|
|
6841
6958
|
hostSupported: runtime.projection.hostStatus === "supported",
|
|
6842
6959
|
externalWaitCapability: evaluateExternalWaitCapability(hostLocks.get(agent) ?? installedHostLock),
|
|
6960
|
+
refreshExternalWaitCapability: () => evaluateExternalWaitCapability(hostLocks.get(agent) ?? installedHostLock),
|
|
6843
6961
|
...goals ? { goalAccess: {
|
|
6844
6962
|
get: async () => normalizeGoalState(await goals.get(agent)),
|
|
6845
6963
|
disarm: async () => normalizeGoalState(await goals.disarm(agent))
|
|
@@ -7065,4 +7183,4 @@ async function replayRawV2(input) {
|
|
|
7065
7183
|
}
|
|
7066
7184
|
|
|
7067
7185
|
//#endregion
|
|
7068
|
-
export { ACTION_MANIFEST, ACTION_MANIFEST_VERSION, ACTIVE_HOST_COHORT_ID, ACTIVE_HOST_COHORT_IDS, ACTIVE_HOST_LAUNCHER_VERSION, BASE_HOST_PACKAGES, BOUNDARY_RECORD_PREFIX, BOUNDED_ARTIFACT_TYPES, CAPTURE_V042_NOTICE, CERTIFICATE_VERSION, CERTIFICATE_VERSION_V2, CLEANUP_CONDITION_RULE, CLEANUP_CONDITION_RULE_COMPACT, CLEANUP_CONDITION_RULE_SHORT, COMMAND_SURFACE_MANIFEST, CONFIRM_LINE_PATTERN, CONTROL_RECORD_PREFIX, Config, DEFAULT_DELEGATION_TOOL_NAMES, DEFAULT_HOST_LOCK, DEFAULT_RECOVERY_CHAR_BUDGET, DEPENDENCY_FREE_ONLY_CONDITION, EXPECTED_HOST_PACKAGES, FIRST_STEP_GUIDANCE, GIT_COMMAND_MANIFEST_IDS, GIT_COMMAND_TEMPLATES, GOAL_HOST_PACKAGES, GRANTED_QUALIFICATION, HOST_CAPABILITY_PACKAGE_GROUPS, HOST_COHORTS, HostProfileError,
|
|
7186
|
+
export { ACTION_MANIFEST, ACTION_MANIFEST_VERSION, ACTIVE_HOST_COHORT_ID, ACTIVE_HOST_COHORT_IDS, ACTIVE_HOST_LAUNCHER_VERSION, BASE_HOST_PACKAGES, BOUNDARY_RECORD_PREFIX, BOUNDED_ARTIFACT_TYPES, CAPTURE_V042_NOTICE, CERTIFICATE_VERSION, CERTIFICATE_VERSION_V2, CLEANUP_CONDITION_RULE, CLEANUP_CONDITION_RULE_COMPACT, CLEANUP_CONDITION_RULE_SHORT, COMMAND_SURFACE_MANIFEST, CONFIRM_LINE_PATTERN, CONTROL_RECORD_PREFIX, Config, DEFAULT_DELEGATION_TOOL_NAMES, DEFAULT_HOST_LOCK, DEFAULT_RECOVERY_CHAR_BUDGET, DEPENDENCY_FREE_ONLY_CONDITION, DESKTOP_IDENTITY_FACTS, DESKTOP_PROFILE_PACKAGE_NAME, DESKTOP_RUNTIME_PACKAGE_NAME, EXPECTED_HOST_PACKAGES, FIRST_STEP_GUIDANCE, GIT_COMMAND_MANIFEST_IDS, GIT_COMMAND_TEMPLATES, GOAL_HOST_PACKAGES, GRANTED_QUALIFICATION, HOST_CAPABILITY_PACKAGE_GROUPS, HOST_COHORTS, HOST_VALIDATED_VERSIONS, HostProfileError, HostTrustError, LATEST_TESTED_HOST_VERSION, LEGACY_QUALIFICATION, 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, PROTOCOL_V6_NOTICE, RC020_RC1_HOST_PACKAGES, RC020_RC2_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, V6_ORDINARY_COMPLETION_RULE, V6_ORDINARY_COMPLETION_RULE_COMPACT, V6_ORDINARY_COMPLETION_RULE_SHORT, acquireHostTrust, actionCompatible, actionHasCertificationPath, actionVerbMatches, activeRendererModule, admissibleForRemoval, apply, applyUpgradeEligibility, assessmentAction, assessmentOutcomePredicate, auditDesktopInstalledImplementation, auditedDefaultWorkdirHost, auditedDefaultWorkdirProvider, auditedForegroundRenderers, auditedHostImplementation, authorityCaptureCounts, availableBoundaryQualifications, bindExecutableIdentity, bindLiveGoalCapability, bindProofToProjection, bindProofV2ToProjection, bindingIndividuallyAccepted, bindingSatisfies, boundedArtifactChoiceMatches, canonicalArgvFromCommand, canonicalProjection, canonicalizePath, capabilityConsequence, capabilityFactOf, capabilityRemedyPhrase, captureClause, captureItem, carriesCleanupCondition, certifyCheckpoint, claimedBatchHasRealRootInput, clarifiedSpanOf, classifyClause, classifyCompletionClaim, classifyTaskIntent, classifyUserInteraction, clauseAsksOwnQuestion, clauseIsGoverned, clauseIsProtected, cleanupConditionFor, closingHint, combineHostPolicy, commitIndexSnapshotDigest, commitTreeSnapshotDigest, compareHostVersions, confirmRebind, createGitPrestateEnvelope, createProjection, createProofManifest, createProofManifestV2, currentActionBases, currentContractDigest, decideTurnBoundary, decideTurnStopping, decisionBoundaryKey, deriveItemDiagnosis, deriveProjection, digestStrings, effectuateBoundary, environmentDefaultRepositoryTarget, evaluateActiveHostLock, evaluateConfiguredHostLock, evaluateExternalWaitCapability, evaluateGraphDerivedHostLock, evaluateHostCapability, evaluateHostLock, evaluateMinimumHostVersion, evaluateToolSurfaceCapability, evidenceAvailabilityReason, evidenceCoverage, evidenceFromPersistedToolResult, evidenceMatchesItem, executeRevalidatedGitEffect, explanationHasActionResidue, extractArtifactPaths, extractMethod, extractOperation, extractTextContent, extractToolSubject, firstStepGuidance, firstStepGuidanceV6, gitCommandMatchesTarget, goalCompletionDenial, governedClauseRestrictsExecution, hasCurrentCertificate, hasDesktopImporterState, hasOrderedCoordination, hasQuestionScope, hasWorkPredicate, hostLockContextFromComposedDump, hostLockRowsFromComposedDump, hostTrustDigest, hostVersionFromPackages, inject, injectActiveProfileHostLock, inspectDesktopTargetGraph, inspectTargetHostGraph, interpretClause, interpretMessage, introducesActionClause, isCurrentAcceptedBoundary, isDeterministicCheck, isExecutableItem, isExplanationScope, isFrozenV042RebindResponse, isInformationalFragment, isInformationalMessage, isOpenObligation, isQuestionScopeNeedingReview, isRestatement, isRootPauseRequest, isRunExecutable, isStatefulAction, isVerifyingCapability, isWholeTaskCompletionClaim, itemDiagnosis, itemHoldsExecutionAuthority, kindOfScope, latestAssistantText, latestRootInstruction, legacyQuestionReadingIsInformational, legacyRecordsNeedingReview, lifecyclePhase, maskCodeSpans, maskQuotedSpans, name, namedActions, nativeFileTwoRole, normalizeClause, observeAssistantOutcome, openItems, opensConditionLead, opensWithDirective, packageRowsFromActiveGraph, packageRowsFromPnpmLock, parseConfirmationMessage, parseGitCommandManifest, parseHostTrust, parseHostVersion, parsePwshCommand, parseShellCommand, partialFailureOf, persistedToolResultStatus, prepareActiveHostTrust, prepareDesktopHostTrust, prepareTargetHostTrust, presentExplanationHead, previewFirstStepInjection, progressFingerprint, projectCoreV2, projectSessionCoreV2, proofCapabilityReport, proofDigest, proofDigestV2, proofEvidenceConstraints, proofHostSurfacesOf, proofOperationMatches, proofV2Rejection, proposeRebind, proposeRebindOutcome, proposeRebindV042, qualificationOfClause, qualifyBoundary, qualifyHostTrust, questionHeadsClause, readActiveHostGraph, readAsarFile, readAsarIndex, readDesktopAppRuntime, readDesktopDependency, readDesktopTargetGraph, rebindAttemptKey, rebindResponse, recoveryDigest, recoveryTitle, registryArchiveFiles, registryArchiveModules, relevantEvidence, removalIsComplete, removalIsPartiallyKnown, renderRecoveryPacket, replayRawV2, replayRebindResult, reportingHeadGoverns, requestedIdentityKey, requestedTargetAuthorizesMutation, requestedTargetMatchesResolved, requiredSubjectsOf, resolveActiveProfileHostLock, resolveDesktopProfileHostLock, resolveInstalledHostLock, restatedContentOf, revalidateDesktopCoreLock, revalidateGitPrestate, rootLocatorFlavor, sanitizeClauseText, sanitizeUrl, satisfiesSupportedHostRange, scopeCoverageDigest, segmentAuthorityBlocks, segmentClauses, selectHostCohort, semanticActionFromCommand, semanticActionFromText, semanticActionOfScope, sessionQuery, sessionQueryV2, sha256, snapshotSessionEvents, splitTextFragments, statefulActionsOfScope, supersedeItem, testOutcomePredicate, v6CurrentRootBoundaries, v6TestPredicate, validateActionManifest, validateActionTarget, validateManifest, validateProofManifest, validateProofManifestV2, verbIsNegated, verifiedLinearCommitReadback, verifyComposedHostLockDump, withDurability, writeDesktopRuntimeReceipt };
|