dsh-completion-guard 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/CHANGELOG.zh-CN.md +22 -0
- package/README.md +14 -6
- package/README.zh-CN.md +14 -6
- 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-BqmJLHcu.js} +2645 -581
- package/dist/{index-Cd3wXBLi.d.ts → index-Dcee_NYF.d.ts} +517 -31
- package/dist/index.d.ts +3 -2
- package/dist/index.js +270 -18
- package/docs/ARCHITECTURE.md +7 -2
- package/docs/COMPATIBILITY.md +70 -5
- package/docs/HOST_LOCK_UPGRADE.md +53 -5
- package/docs/LOCAL_ACCEPTANCE.md +10 -2
- package/docs/PORTING_NOTES.md +22 -0
- package/docs/SEMANTIC_COMPATIBILITY.md +24 -0
- package/docs/upstream-deltas.json +30 -4
- package/manifests/supported-host.v1.json +298 -89
- package/package.json +33 -31
|
@@ -53,6 +53,117 @@ declare function requestedTargetMatchesResolved(action: StatefulAction, requeste
|
|
|
53
53
|
declare function requestedTargetAuthorizesMutation(action: StatefulAction, requested: TargetTuple | undefined, resolved: TargetTuple | undefined): boolean;
|
|
54
54
|
declare function validateActionManifest(): string[];
|
|
55
55
|
//#endregion
|
|
56
|
+
//#region src/domain/semantics.d.ts
|
|
57
|
+
/**
|
|
58
|
+
* The single interpretation of a root-user instruction.
|
|
59
|
+
*
|
|
60
|
+
* Before 0.5.1, capture, mutation authorization and boundary qualification each
|
|
61
|
+
* re-guessed what one sentence meant, and the guesses disagreed: the incident
|
|
62
|
+
* instruction "按 P0—P4 完成本地实现、测试和文档,在跨平台验证前停止,不推送、
|
|
63
|
+
* 不正式发布。" was captured as a *push* obligation, so the only certifiable item
|
|
64
|
+
* demanded the very action its own text forbade.
|
|
65
|
+
*
|
|
66
|
+
* This module answers the question once. It partitions the message into
|
|
67
|
+
* semantic scopes first, then reads the action inside each scope, so:
|
|
68
|
+
*
|
|
69
|
+
* 1. a prohibition's scope covers every coordinated action it governs, and a
|
|
70
|
+
* prohibition constrains execution instead of creating an obligation to
|
|
71
|
+
* perform the forbidden action;
|
|
72
|
+
* 2. only an explicit, agent-owned, unconditional directive becomes an
|
|
73
|
+
* immediately executable duty — naming an action is not authorizing it;
|
|
74
|
+
* 3. a conditional directive stays unexecuted until its condition holds, and a
|
|
75
|
+
* human-owned action never becomes agent work;
|
|
76
|
+
* 4. quotation and code keep an action visible but never grant authority;
|
|
77
|
+
* 5. an interpretation that cannot be resolved reads conservatively and is not
|
|
78
|
+
* executed.
|
|
79
|
+
*
|
|
80
|
+
* No rule here keys on a session id, an event sequence, a file name, or a fixed
|
|
81
|
+
* phrase list for one incident sentence: the rules are polarity, scope,
|
|
82
|
+
* executee and condition, so paraphrases, mixed languages, word-order changes
|
|
83
|
+
* and punctuation changes agree with the original.
|
|
84
|
+
*/
|
|
85
|
+
/**
|
|
86
|
+
* How one message is read.
|
|
87
|
+
*
|
|
88
|
+
* `coordinationSplit` is the one historical granularity switch: a message
|
|
89
|
+
* captured before the 0.4.2 capture boundary keeps a coordinated action in one
|
|
90
|
+
* clause, exactly as that release recorded it. Every semantic rule (polarity,
|
|
91
|
+
* executee, condition, quotation) applies identically in both modes, so replay
|
|
92
|
+
* stability never depends on re-reading an older message with newer semantics.
|
|
93
|
+
*/
|
|
94
|
+
interface InterpretOptions {
|
|
95
|
+
coordinationSplit?: boolean;
|
|
96
|
+
}
|
|
97
|
+
/** What one scope does with the action it names. */
|
|
98
|
+
type DirectiveClass = "directive" | "prohibition" | "conditional" | "informational" | "narrative";
|
|
99
|
+
/** Who is expected to perform the action. */
|
|
100
|
+
type Executee = "agent" | "user" | "unresolved";
|
|
101
|
+
/** How the scope's authority reads. */
|
|
102
|
+
type AuthorityDisposition = "executable_now" | "conditional_wait" | "human_actor" | "informational" | "prohibition" | "unresolved";
|
|
103
|
+
interface ScopeInterpretation {
|
|
104
|
+
/** Verbatim scope text, trimmed: the audit record of what was read. */
|
|
105
|
+
text: string;
|
|
106
|
+
/** The action-bearing text with leading connectors and negators removed. */
|
|
107
|
+
body: string;
|
|
108
|
+
directive: DirectiveClass;
|
|
109
|
+
executee: Executee;
|
|
110
|
+
/** The unresolved condition that must hold before the action may run. */
|
|
111
|
+
condition?: string;
|
|
112
|
+
/** The event that ends a human wait, when the source names one. */
|
|
113
|
+
resumeEvent?: string;
|
|
114
|
+
/** True only for an explicit, agent-owned, unconditional instruction. */
|
|
115
|
+
immediatelyExecutable: boolean;
|
|
116
|
+
authorityDisposition: AuthorityDisposition;
|
|
117
|
+
/** Explicitly named tool/method, when the scope names one. */
|
|
118
|
+
method?: string;
|
|
119
|
+
/** Stable identity of this interpretation, reproducible from the same bytes. */
|
|
120
|
+
fingerprint: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* The contract kind a scope maps to. A prohibition and an acceptance keep their
|
|
124
|
+
* own lanes; everything else is a requirement. Acceptance is decided from the
|
|
125
|
+
* clause's own head verb, so "确保构建通过" stays an acceptance while a
|
|
126
|
+
* conditional or prohibition clause is never mislabelled.
|
|
127
|
+
*/
|
|
128
|
+
declare function kindOfScope(directive: DirectiveClass, body?: string): GuardItemKind;
|
|
129
|
+
declare function maskCodeSpans(text: string): string;
|
|
130
|
+
/** Interpret one already-segmented clause. */
|
|
131
|
+
declare function interpretClause(text: string, options?: InterpretOptions): ScopeInterpretation;
|
|
132
|
+
/** Interpret a whole message into independent scopes, in source order. */
|
|
133
|
+
declare function interpretMessage(text: string, options?: InterpretOptions): ScopeInterpretation[];
|
|
134
|
+
/**
|
|
135
|
+
* Whether the item is an executable obligation right now. A prohibition is a
|
|
136
|
+
* standing constraint, a human-owned action belongs to the user, a conditional
|
|
137
|
+
* action waits for its condition, and an explanation is not work. None of them
|
|
138
|
+
* may block completion or be certified as agent work.
|
|
139
|
+
*
|
|
140
|
+
* An item without an interpretation is a legacy or fixture item created before
|
|
141
|
+
* this module existed; it keeps its historical executable reading.
|
|
142
|
+
*/
|
|
143
|
+
declare function isExecutableItem(item: {
|
|
144
|
+
kind?: string;
|
|
145
|
+
executee?: Executee;
|
|
146
|
+
authorityDisposition?: AuthorityDisposition;
|
|
147
|
+
waitAuthorization?: unknown;
|
|
148
|
+
}): boolean;
|
|
149
|
+
/** Whether an item is an open obligation for certification purposes. */
|
|
150
|
+
declare function isOpenObligation(item: GuardItem): boolean;
|
|
151
|
+
/**
|
|
152
|
+
* The action a scope names. `semanticActionFromText` maps the command surface,
|
|
153
|
+
* but a prohibition keeps a bare verb as its body ("不要提交并推送" → 提交并推送),
|
|
154
|
+
* and the closed CJK vocabulary is consulted first so such a ban is still
|
|
155
|
+
* recorded against the action it forbids.
|
|
156
|
+
*/
|
|
157
|
+
declare function semanticActionOfScope(body: string, source?: string, isProhibition?: boolean): ReturnType<typeof semanticActionFromText>;
|
|
158
|
+
/**
|
|
159
|
+
* Every stateful action the clause names, in source order. A clause may order
|
|
160
|
+
* more than one ("安装插件,重启 DSH"); each is a separate evidence obligation
|
|
161
|
+
* even though the clause stays one top-level item.
|
|
162
|
+
*/
|
|
163
|
+
declare function statefulActionsOfScope(body: string): StatefulAction[];
|
|
164
|
+
/** Actions this interpretation names, in source order (diagnostics only). */
|
|
165
|
+
declare function namedActions(text: string): string[];
|
|
166
|
+
//#endregion
|
|
56
167
|
//#region src/domain/rebind.d.ts
|
|
57
168
|
interface RebindArgs {
|
|
58
169
|
operation: "propose" | "query" | "withdraw";
|
|
@@ -143,10 +254,32 @@ type TypedObject = {
|
|
|
143
254
|
};
|
|
144
255
|
type Typed = boolean | number | string | TypedObject;
|
|
145
256
|
interface SessionHeader {
|
|
257
|
+
/**
|
|
258
|
+
* DSH Session format version stamped into the durable header. Guard supports
|
|
259
|
+
* only the V3 session format (`3`); any other value is a different digest
|
|
260
|
+
* domain input rather than being reinterpreted as V3.
|
|
261
|
+
*/
|
|
146
262
|
version: number;
|
|
147
263
|
id: string;
|
|
148
264
|
createdAt: number;
|
|
149
265
|
parentSession?: string;
|
|
266
|
+
/**
|
|
267
|
+
* Durable fork-inherited prefix length.
|
|
268
|
+
*
|
|
269
|
+
* DSH Session V3 moved this value out of the header onto the `Session`
|
|
270
|
+
* itself as `inheritedEventCount` (durably marked by `session/end-seed`); the
|
|
271
|
+
* meaning is unchanged, so the token keeps its historical name and the `v3`
|
|
272
|
+
* digest domain keeps every byte-mirrored vector identical.
|
|
273
|
+
*
|
|
274
|
+
* V3's `header.isSeeded` marker is deliberately NOT added as a digest input.
|
|
275
|
+
* It is not needed for identity — `parentSession`, `seedLength`,
|
|
276
|
+
* `delegationDepth` and `origin` already bind the fork lineage, and `id` plus
|
|
277
|
+
* `createdAt` separate distinct sessions — while adding any field (even an
|
|
278
|
+
* optional one) would change every existing digest, because an absent
|
|
279
|
+
* optional field still encodes a presence-0 row. Changing the shared digest
|
|
280
|
+
* domain is an upstream semantic decision with its own cross-repository
|
|
281
|
+
* parity gate; a host upgrade must not make it silently.
|
|
282
|
+
*/
|
|
150
283
|
seedLength?: number;
|
|
151
284
|
agentPreset?: string;
|
|
152
285
|
origin?: string;
|
|
@@ -231,6 +364,34 @@ interface GuardItem {
|
|
|
231
364
|
legacyFlags?: Array<"legacy_generic_run" | "legacy_authority_unclassified">;
|
|
232
365
|
/** v0.5 intent layer: inquiries keep the obligation but are not machine certifiable. */
|
|
233
366
|
taskKind?: "inquiry" | "action";
|
|
367
|
+
/**
|
|
368
|
+
* v0.5.1 interpretation layer, derived from the same source bytes as
|
|
369
|
+
* {@link normalizedText} by `domain/semantics.ts`. These fields record what
|
|
370
|
+
* the message actually authorized, so a prohibition, a human-owned action, a
|
|
371
|
+
* conditional action and an explanation can never become an agent obligation.
|
|
372
|
+
* Absent on legacy items, which keep their historical executable reading.
|
|
373
|
+
*/
|
|
374
|
+
directive?: DirectiveClass;
|
|
375
|
+
executee?: Executee;
|
|
376
|
+
authorityDisposition?: AuthorityDisposition;
|
|
377
|
+
/** The unresolved condition guarding a `conditional_wait` item. */
|
|
378
|
+
condition?: string;
|
|
379
|
+
/** The event that ends a human wait, when the source names one. */
|
|
380
|
+
resumeEvent?: string;
|
|
381
|
+
/** Stable identity of the interpretation these fields came from. */
|
|
382
|
+
interpretationFingerprint?: string;
|
|
383
|
+
/**
|
|
384
|
+
* Every stateful action this item's clause names, in source order, with the
|
|
385
|
+
* target captured for each. A clause may order more than one action
|
|
386
|
+
* ("安装插件,重启 DSH"): the item stays one top-level obligation, and every
|
|
387
|
+
* action it names needs its own matching evidence before it can close.
|
|
388
|
+
*/
|
|
389
|
+
actionPlan?: Array<{
|
|
390
|
+
action: "install" | "apply" | "create" | "modify" | "restart" | "commit" | "push" | "publish" | "pull" | "fetch";
|
|
391
|
+
requestedTarget: TargetTuple;
|
|
392
|
+
targetCaptureStatus: TargetCaptureStatus;
|
|
393
|
+
targetCaptureReasonCode?: TargetCaptureReasonCode;
|
|
394
|
+
}>;
|
|
234
395
|
waitAuthorization?: WaitAuthorization;
|
|
235
396
|
deferAuthorization?: DeferAuthorization;
|
|
236
397
|
persistenceAuthorization?: PersistenceAuthorization;
|
|
@@ -290,6 +451,20 @@ interface EvidenceBinding {
|
|
|
290
451
|
resolutionEvidenceId?: string;
|
|
291
452
|
effectEvidenceId?: string;
|
|
292
453
|
stateEvidenceIds?: string[];
|
|
454
|
+
/**
|
|
455
|
+
* Per-action closure for a clause that ordered several actions. Every entry
|
|
456
|
+
* of {@link GuardItem.actionPlan} needs its own entry here: one action's
|
|
457
|
+
* evidence never covers another action, and two instances of the same action
|
|
458
|
+
* on different targets are two separate entries.
|
|
459
|
+
*/
|
|
460
|
+
actionBindings?: BindingActionClosure[];
|
|
461
|
+
}
|
|
462
|
+
interface BindingActionClosure {
|
|
463
|
+
action: StatefulAction;
|
|
464
|
+
evidenceIds: string[];
|
|
465
|
+
resolvedTarget: TargetTuple;
|
|
466
|
+
/** Position of this action in the clause's instruction order. */
|
|
467
|
+
order: number;
|
|
293
468
|
}
|
|
294
469
|
interface GuardCheckpoint {
|
|
295
470
|
id: string;
|
|
@@ -308,8 +483,8 @@ interface GuardCheckpoint {
|
|
|
308
483
|
certificationDigest: string;
|
|
309
484
|
result: "certified" | "incomplete" | "unknown";
|
|
310
485
|
}
|
|
311
|
-
type BoundaryDisposition = "user_wait" | "external_wait" | "deferred";
|
|
312
|
-
type BoundaryQualificationKind = "user_decision_item" | "root_explicit_wait" | "external_operation_pending" | "root_explicit_defer";
|
|
486
|
+
type BoundaryDisposition = "user_wait" | "external_wait" | "deferred" | "guard_bounded_stop";
|
|
487
|
+
type BoundaryQualificationKind = "user_decision_item" | "root_explicit_wait" | "external_operation_pending" | "root_explicit_defer" | "guard_no_progress";
|
|
313
488
|
interface GuardBoundary {
|
|
314
489
|
protocolVersion: "1";
|
|
315
490
|
id: string;
|
|
@@ -371,6 +546,32 @@ interface GuardProjection {
|
|
|
371
546
|
continuationAttempts: Map<number, number>;
|
|
372
547
|
/** Process-local one-shot fallback counters keyed by epoch + contract revision. */
|
|
373
548
|
persistenceCorrectionAttempts: Map<string, number>;
|
|
549
|
+
/**
|
|
550
|
+
* The no-progress budget, rebuilt from the durable log.
|
|
551
|
+
*
|
|
552
|
+
* Keyed by progress fingerprint, then by the boundary the claim was decided
|
|
553
|
+
* at, holding the attempt number that boundary was given. Keyed by boundary
|
|
554
|
+
* rather than counted per fingerprint on purpose: the same boundary processed
|
|
555
|
+
* twice — a retry, with or without the projection being re-derived in between
|
|
556
|
+
* — maps to the same key and therefore the same attempt, so a retry cannot
|
|
557
|
+
* spend the budget twice, while a genuinely new boundary adds a new key.
|
|
558
|
+
*/
|
|
559
|
+
noProgressClaims: Map<string, Map<string, number>>;
|
|
560
|
+
/**
|
|
561
|
+
* Root event sequences whose control request Guard already carried to the
|
|
562
|
+
* host. A pause is a one-shot input: once the host has paused, the same
|
|
563
|
+
* message stays in the log forever, and re-reading it must not re-pause a goal
|
|
564
|
+
* the human has since resumed.
|
|
565
|
+
*/
|
|
566
|
+
handledControlSeqs: Set<number>;
|
|
567
|
+
/**
|
|
568
|
+
* The host turn the projection is currently in, taken from the host's own
|
|
569
|
+
* durable `turn/start` event. This is the turn boundary's identity: the host
|
|
570
|
+
* opens it before it claims input or runs pre-step, so it is stable across a
|
|
571
|
+
* reload, it does not move when Guard writes its own bookkeeping, and a retry
|
|
572
|
+
* of the same turn re-reads the same number.
|
|
573
|
+
*/
|
|
574
|
+
hostTurn?: number;
|
|
374
575
|
/** Log-derived count of rejected rebind attempts by stable attempt key; survives reload. */
|
|
375
576
|
rebindRejections: Map<string, number>;
|
|
376
577
|
integrity: GuardIntegrity;
|
|
@@ -451,11 +652,12 @@ interface BoundaryEffectuation {
|
|
|
451
652
|
declare function effectuateBoundary(boundary: GuardBoundary, access: GoalBoundaryAccess): Promise<BoundaryEffectuation>;
|
|
452
653
|
//#endregion
|
|
453
654
|
//#region src/domain/capture.d.ts
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
655
|
+
/**
|
|
656
|
+
* Whether a clause opens with an explicit ban. The lane question ("is this a
|
|
657
|
+
* constraint or a duty?") is answered by {@link ScopeInterpretation}; this stays
|
|
658
|
+
* exported because the framing/segmentation callers ask it directly.
|
|
659
|
+
*/
|
|
660
|
+
declare function classifyClause(text: string): GuardItemKind;
|
|
459
661
|
/**
|
|
460
662
|
* Detect an explicitly named tool/method in a clause ("使用 bash 创建",
|
|
461
663
|
* "via bash", "bash to create"). Returns the canonical tool id (e.g. 'bash')
|
|
@@ -485,27 +687,40 @@ interface CaptureScope {
|
|
|
485
687
|
declare function extractArtifactPaths(text: string): string[];
|
|
486
688
|
/**
|
|
487
689
|
* Split a single human message into independently tracked clauses. Sentence
|
|
488
|
-
* boundaries and
|
|
489
|
-
*
|
|
490
|
-
*
|
|
690
|
+
* boundaries and negations delimit segments so a compound instruction such as
|
|
691
|
+
* "Modify src/a.ts and src/b.ts. Do not push." yields separate items instead of
|
|
692
|
+
* collapsing into one artifact.
|
|
693
|
+
*
|
|
694
|
+
* Segmentation asks {@link interpretMessage} where the semantic scopes are, so a
|
|
695
|
+
* negation keeps its whole coordinated span ("不推送、不发布" is two
|
|
696
|
+
* prohibitions, not one requirement) and a mixed sentence keeps both executees.
|
|
491
697
|
*/
|
|
492
698
|
interface ClauseSegment {
|
|
493
699
|
kind: GuardItemKind;
|
|
700
|
+
/** Action-bearing text used for target, method and operation extraction. */
|
|
494
701
|
body: string;
|
|
702
|
+
/** Verbatim source scope, kept for the audit record. */
|
|
703
|
+
text: string;
|
|
495
704
|
paths: string[];
|
|
705
|
+
/** The one interpretation this segment came from; never re-derived downstream. */
|
|
706
|
+
interpretation: ScopeInterpretation;
|
|
496
707
|
}
|
|
497
|
-
declare function segmentClauses(text: string,
|
|
708
|
+
declare function segmentClauses(text: string, options?: InterpretOptions): ClauseSegment[];
|
|
498
709
|
/**
|
|
499
710
|
* Build a GuardItem from an already-classified clause body and a resolved
|
|
500
711
|
* verification subject/surface.
|
|
712
|
+
*
|
|
713
|
+
* The optional `interpretation` carries the scope reading taken from the same
|
|
714
|
+
* bytes. It is passed through rather than re-derived, so the obligation lane and
|
|
715
|
+
* the authority of one clause cannot disagree between callers.
|
|
501
716
|
*/
|
|
502
|
-
declare function captureItem(kind: GuardItemKind, body: string, sourceMessageId: string, id: string, revision: number, subject: string, surface: "artifact" | "scope", method?: string, operation?: GuardOperation,
|
|
717
|
+
declare function captureItem(kind: GuardItemKind, body: string, sourceMessageId: string, id: string, revision: number, subject: string, surface: "artifact" | "scope", method?: string, operation?: GuardOperation, interpretation?: ScopeInterpretation): GuardItem;
|
|
503
718
|
/**
|
|
504
719
|
* Capture one contract clause. Every captured item receives a concrete
|
|
505
720
|
* verification contract: a named artifact path (artifact surface) or the
|
|
506
721
|
* session scope (scope surface), so an unrelated file read can never close it.
|
|
507
722
|
*/
|
|
508
|
-
declare function captureClause(text: string, sourceMessageId: string, id: string, revision: number, scope?: CaptureScope): GuardItem;
|
|
723
|
+
declare function captureClause(text: string, sourceMessageId: string, id: string, revision: number, scope?: CaptureScope, options?: InterpretOptions): GuardItem;
|
|
509
724
|
//#endregion
|
|
510
725
|
//#region src/domain/checkpoint.d.ts
|
|
511
726
|
interface RejectedBinding {
|
|
@@ -608,10 +823,91 @@ declare function authorityCaptureCounts(blocks: readonly AuthorityBlock[]): Reco
|
|
|
608
823
|
/** One authoritative contract identity shared by checkpoints and boundaries. */
|
|
609
824
|
declare function currentContractDigest(projection: GuardProjection): string;
|
|
610
825
|
//#endregion
|
|
826
|
+
//#region src/domain/host-version.d.ts
|
|
827
|
+
/**
|
|
828
|
+
* DSH host version support policy.
|
|
829
|
+
*
|
|
830
|
+
* Context Guard 0.5.1 supports **DSH >= 0.1.5-rc.1** and nothing older. The
|
|
831
|
+
* policy is one value with one comparison, used by the install entry
|
|
832
|
+
* (`peerDependencies`), by the runtime host readback, and by the decision tests
|
|
833
|
+
* — so the advertised range and the enforced range cannot drift apart.
|
|
834
|
+
*
|
|
835
|
+
* ## Why a range is not enough on its own
|
|
836
|
+
*
|
|
837
|
+
* npm's SemVer prerelease rule is narrower than "0.1.5-rc.1 or newer": a
|
|
838
|
+
* version carrying a prerelease satisfies a comparator set only when some
|
|
839
|
+
* comparator in that set names the SAME `major.minor.patch` tuple and itself
|
|
840
|
+
* carries a prerelease. For the range `>=0.1.5-rc.1` that means:
|
|
841
|
+
*
|
|
842
|
+
* | Candidate | Satisfies `>=0.1.5-rc.1` | Why |
|
|
843
|
+
* | --- | --- | --- |
|
|
844
|
+
* | `0.1.5-rc.1` | yes | the bound itself |
|
|
845
|
+
* | `0.1.5-rc.2` | yes | same tuple, comparator has a prerelease |
|
|
846
|
+
* | `0.1.5` | yes | a release is ordered after its own prereleases |
|
|
847
|
+
* | `0.1.6`, `0.2.0` | yes | higher release |
|
|
848
|
+
* | `0.1.6-rc.1` | **no** | prerelease of a DIFFERENT tuple |
|
|
849
|
+
* | `0.2.0-rc.1` | **no** | prerelease of a DIFFERENT tuple |
|
|
850
|
+
* | `0.1.4`, `0.1.5-alpha.9` | no | below the bound |
|
|
851
|
+
*
|
|
852
|
+
* No finite SemVer range expresses "every future prerelease at any base", and
|
|
853
|
+
* an unconditional `*` would drop the lower bound entirely. The range is
|
|
854
|
+
* therefore the honest, conservative install-time statement, and this module is
|
|
855
|
+
* the explicit runtime/decision path for the policy itself: {@link
|
|
856
|
+
* compareHostVersions} accepts a future different-base RC by the documented
|
|
857
|
+
* policy while {@link evaluateMinimumHostVersion} still refuses anything below
|
|
858
|
+
* the minimum. An unobserved new-base RC remains `unverified` for host-lock
|
|
859
|
+
* purposes — the version policy never substitutes for the exact-graph host
|
|
860
|
+
* audit.
|
|
861
|
+
*/
|
|
862
|
+
/** Lowest supported DSH host version. DSH packages version independently of Cordis. */
|
|
863
|
+
declare const MIN_SUPPORTED_HOST_VERSION = "0.1.5-rc.1";
|
|
864
|
+
/**
|
|
865
|
+
* The exact npm range published in `peerDependencies`. It is deliberately the
|
|
866
|
+
* plain lower bound plus the documented prerelease caveat above.
|
|
867
|
+
*/
|
|
868
|
+
declare const SUPPORTED_HOST_RANGE: string;
|
|
869
|
+
interface ParsedHostVersion {
|
|
870
|
+
major: number;
|
|
871
|
+
minor: number;
|
|
872
|
+
patch: number;
|
|
873
|
+
/** Dot-separated prerelease identifiers; empty for a release version. */
|
|
874
|
+
prerelease: readonly string[];
|
|
875
|
+
}
|
|
876
|
+
declare function parseHostVersion(value: string): ParsedHostVersion | undefined;
|
|
877
|
+
/**
|
|
878
|
+
* SemVer precedence comparison, including the prerelease rules. Returns
|
|
879
|
+
* `undefined` for a value that is not a version this module can order, so an
|
|
880
|
+
* unparseable host version fails closed rather than sorting as "newer".
|
|
881
|
+
*/
|
|
882
|
+
declare function compareHostVersions(a: string, b: string): number | undefined;
|
|
883
|
+
type HostVersionStatus = "supported" | "below_minimum" | "unparseable";
|
|
884
|
+
interface HostVersionDecision {
|
|
885
|
+
status: HostVersionStatus;
|
|
886
|
+
version: string;
|
|
887
|
+
minimum: string;
|
|
888
|
+
reasonCode: "host_version_supported" | "host_version_below_minimum" | "host_version_unparseable";
|
|
889
|
+
}
|
|
890
|
+
/** Decide the version-policy half of host support. Never a substitute for the graph lock. */
|
|
891
|
+
declare function evaluateMinimumHostVersion(version: string, minimum?: string): HostVersionDecision;
|
|
892
|
+
/**
|
|
893
|
+
* Whether npm's own range resolution would admit this version for
|
|
894
|
+
* {@link SUPPORTED_HOST_RANGE}. Used by the decision tests to keep the
|
|
895
|
+
* documented prerelease table true, and by diagnostics to explain why an
|
|
896
|
+
* install did not resolve.
|
|
897
|
+
*/
|
|
898
|
+
declare function satisfiesSupportedHostRange(version: string): boolean;
|
|
899
|
+
//#endregion
|
|
611
900
|
//#region src/domain/host-lock.d.ts
|
|
612
901
|
type HostLockStatus = "supported" | "unsupported" | "unavailable";
|
|
613
902
|
type HostPlatform = "posix" | "windows";
|
|
614
903
|
type HostProfileKind = "headless" | "web";
|
|
904
|
+
/**
|
|
905
|
+
* How a cohort's package rows were established. Bound into every host-lock
|
|
906
|
+
* digest through the `host_audit_provenance` capability row, so a certificate
|
|
907
|
+
* records whether the exact graph it used was loaded on a native host or only
|
|
908
|
+
* resolved from the registry.
|
|
909
|
+
*/
|
|
910
|
+
type HostAuditProvenance = "native-audited" | "registry-derived-pending-native-audit";
|
|
615
911
|
interface HostCohort {
|
|
616
912
|
/** Stable cohort identity; bound into every hostLockDigest via `host_cohort`. */
|
|
617
913
|
id: string;
|
|
@@ -619,10 +915,19 @@ interface HostCohort {
|
|
|
619
915
|
supportedGoalVersions: string[];
|
|
620
916
|
/**
|
|
621
917
|
* Platforms where this cohort's exact package graph was extracted from a
|
|
622
|
-
* native host and audited.
|
|
623
|
-
*
|
|
918
|
+
* native host and audited. A cohort with no native audit has an empty list
|
|
919
|
+
* here even while it accepts evaluations — see {@link acceptedPlatforms}.
|
|
624
920
|
*/
|
|
625
921
|
auditedPlatforms: readonly HostPlatform[];
|
|
922
|
+
/**
|
|
923
|
+
* Platforms on which the cohort may evaluate to `supported`. This is the
|
|
924
|
+
* gating list; a platform outside it fails closed with
|
|
925
|
+
* `host_cohort_platform_not_audited`. `auditedPlatforms` remains the stricter
|
|
926
|
+
* fact and `auditProvenance` states which one a certificate actually rests
|
|
927
|
+
* on, so a registry-derived graph is never silently reported as a native pass.
|
|
928
|
+
*/
|
|
929
|
+
acceptedPlatforms: readonly HostPlatform[];
|
|
930
|
+
auditProvenance: HostAuditProvenance;
|
|
626
931
|
packages: PackageRow[];
|
|
627
932
|
capabilities: CapabilityRow[];
|
|
628
933
|
}
|
|
@@ -644,27 +949,39 @@ declare const ALPHA2_DSHMARKET_139_HOST_PACKAGES: PackageRow[];
|
|
|
644
949
|
/**
|
|
645
950
|
* Historical audited host cohort registry. Every entry keeps the exact package
|
|
646
951
|
* identities audited natively for a past Guard release (CG-DSH-001 whole-graph
|
|
647
|
-
* contracts). These are historical verification facts only: since 0.5.
|
|
648
|
-
* active support
|
|
952
|
+
* contracts). These are historical verification facts only: since 0.5.1 the
|
|
953
|
+
* active support targets are `0.1.5-rc.1` and `0.1.5-rc.2`, so an installed graph from any of
|
|
649
954
|
* these cohorts — including previous RCs and alphas — is no longer an active
|
|
650
955
|
* support entry and fails closed in `evaluateHostLock`.
|
|
651
956
|
*/
|
|
652
957
|
declare const LEGACY_HOST_COHORTS: readonly HostCohort[];
|
|
958
|
+
/** Baseline cohort retained for callers that need a default fixture. */
|
|
959
|
+
declare const ACTIVE_HOST_COHORT_ID = "dsh-0.1.5-rc.1";
|
|
960
|
+
declare const ACTIVE_HOST_COHORT_IDS: readonly string[];
|
|
653
961
|
/** Core-lock/v1 separates optional market identity from the audited DSH graph.
|
|
654
|
-
* The active support
|
|
962
|
+
* The active support targets are the exact registered rc.1 and rc.2 graphs:
|
|
655
963
|
* historical cohorts stay in `LEGACY_HOST_COHORTS` as verification data but are
|
|
656
964
|
* never silently re-labelled as accepted active locks, and an installed
|
|
657
|
-
* historical graph fails closed under `evaluateHostLock`.
|
|
965
|
+
* historical graph fails closed under `evaluateHostLock`. The version policy
|
|
966
|
+
* (`>=0.1.5-rc.1`) and the graph lock are separate judgments: a newer host that
|
|
967
|
+
* has not been registered here is "unverified / pending audit", never
|
|
968
|
+
* supported by range alone.
|
|
658
969
|
*/
|
|
659
970
|
declare const HOST_COHORTS: readonly HostCohort[];
|
|
660
971
|
/**
|
|
661
|
-
*
|
|
662
|
-
*
|
|
663
|
-
*
|
|
664
|
-
*
|
|
665
|
-
*
|
|
972
|
+
* Baseline fixture package identities (DSH 0.1.5-rc.1). The cohort
|
|
973
|
+
* is an atomic whole-graph contract (CG-DSH-001): any drifted, duplicated,
|
|
974
|
+
* unknown-version, unbound, OR MISSING row fails the whole lock closed
|
|
975
|
+
* (`host_lock_missing`); no capability inherits independence from a partially
|
|
976
|
+
* present graph.
|
|
666
977
|
*/
|
|
667
978
|
declare const EXPECTED_HOST_PACKAGES: PackageRow[];
|
|
979
|
+
/**
|
|
980
|
+
* The `@deepseek-ai/dsh` launcher version of the baseline fixture, read from the
|
|
981
|
+
* cohort rows rather than hardcoded, so a cohort bump cannot leave a stale
|
|
982
|
+
* literal behind in the target-inspection path.
|
|
983
|
+
*/
|
|
984
|
+
declare const ACTIVE_HOST_LAUNCHER_VERSION: string | undefined;
|
|
668
985
|
declare const BASE_HOST_PACKAGES: ReadonlySet<string>;
|
|
669
986
|
declare const GOAL_HOST_PACKAGES: ReadonlySet<string>;
|
|
670
987
|
type HostCapabilityId = "agent_loop" | "terminal_posix" | "terminal_windows" | "dsh_cli" | "plugin_inventory" | "web_control" | "jobs" | "filesystem";
|
|
@@ -681,14 +998,28 @@ interface HostLockEvaluation {
|
|
|
681
998
|
status: HostLockStatus;
|
|
682
999
|
digest: string;
|
|
683
1000
|
goalAvailable: boolean;
|
|
684
|
-
reasonCode?: "host_lock_migration_required" | "host_lock_installed_graph_drift" | "host_lock_missing" | "host_lock_version_mismatch" | "host_lock_integrity_mismatch" | "host_lock_unknown_package" | "host_lock_duplicate_package" | "host_lock_goal_graph_incomplete" | "host_lock_goal_capability_mismatch" | "host_lock_cohort_mixed_graph" | "host_lock_cohort_unbound_identity" | "host_lock_cohort_platform_not_audited";
|
|
1001
|
+
reasonCode?: "host_lock_migration_required" | "host_lock_installed_graph_drift" | "host_lock_missing" | "host_lock_version_mismatch" | "host_lock_version_below_minimum" | "host_lock_version_unparseable" | "host_lock_integrity_mismatch" | "host_lock_unknown_package" | "host_lock_duplicate_package" | "host_lock_goal_graph_incomplete" | "host_lock_goal_capability_mismatch" | "host_lock_cohort_mixed_graph" | "host_lock_cohort_unbound_identity" | "host_lock_cohort_platform_not_audited";
|
|
685
1002
|
packages: PackageRow[];
|
|
686
1003
|
capabilities: Record<HostCapabilityId, HostCapabilityEvaluation>;
|
|
687
1004
|
platform?: HostPlatform;
|
|
688
1005
|
profileKind?: HostProfileKind;
|
|
689
1006
|
liveGoalAvailable?: boolean;
|
|
1007
|
+
/**
|
|
1008
|
+
* The version-policy half of host support, decided separately from the graph.
|
|
1009
|
+
* A host below the minimum is refused here even when its graph matches an
|
|
1010
|
+
* audited cohort, and an in-range version never substitutes for the
|
|
1011
|
+
* exact-graph audit: the two are independent facts, both reported.
|
|
1012
|
+
*/
|
|
1013
|
+
hostVersion?: HostVersionDecision;
|
|
690
1014
|
/** Readback of the audited cohort the supplied graph was evaluated against. */
|
|
691
1015
|
cohortId?: string;
|
|
1016
|
+
/**
|
|
1017
|
+
* Readback of how that cohort's rows were established. `registry-derived-
|
|
1018
|
+
* pending-native-audit` means the exact published graph was verified but no
|
|
1019
|
+
* native host load has happened yet; a certificate must never present that as
|
|
1020
|
+
* a native pass.
|
|
1021
|
+
*/
|
|
1022
|
+
auditProvenance?: HostAuditProvenance;
|
|
692
1023
|
/** Audited cohort rows absent from the supplied graph (diagnostic). */
|
|
693
1024
|
missingPackages?: string[];
|
|
694
1025
|
}
|
|
@@ -696,7 +1027,21 @@ interface HostLockContext {
|
|
|
696
1027
|
platform?: HostPlatform;
|
|
697
1028
|
profileKind?: HostProfileKind;
|
|
698
1029
|
capabilityId?: string;
|
|
1030
|
+
/**
|
|
1031
|
+
* The DSH host version the graph was read from, when the caller read one.
|
|
1032
|
+
* Supplying it turns the version policy into a production decision; omitting
|
|
1033
|
+
* it leaves the version question unanswered rather than assumed supported.
|
|
1034
|
+
*/
|
|
1035
|
+
hostVersion?: string;
|
|
699
1036
|
}
|
|
1037
|
+
/**
|
|
1038
|
+
* The host version a package graph records, for the version-policy decision.
|
|
1039
|
+
*
|
|
1040
|
+
* Every DSH package versions with the host, so the graph's own `dsh` row is the
|
|
1041
|
+
* version the caller is running. A graph without that row leaves the version
|
|
1042
|
+
* unknown, and an unknown version is not treated as supported.
|
|
1043
|
+
*/
|
|
1044
|
+
declare function hostVersionFromPackages(rows: readonly PackageRow[]): string | undefined;
|
|
700
1045
|
type HostCohortSelectionReason = "host_cohort_unknown_package" | "host_cohort_version_mismatch" | "host_cohort_integrity_mismatch" | "host_cohort_mixed_graph" | "host_cohort_incomplete_graph" | "host_cohort_unbound_identity" | "host_cohort_platform_not_audited";
|
|
701
1046
|
interface HostCohortSelection {
|
|
702
1047
|
/**
|
|
@@ -783,7 +1128,7 @@ declare const PROTOCOL_V4_NOTICE = "Context Guard protocol boundary: v4.0.0";
|
|
|
783
1128
|
* Pure, deterministic re-derivation of the guard projection from the DSH
|
|
784
1129
|
* native event log. Context Guard never writes custom session events, so every
|
|
785
1130
|
* piece of state is derived from `command/run`, `user/message`, `tool/call`,
|
|
786
|
-
* `tool/result`, `tool/
|
|
1131
|
+
* `tool/result`, `tool/ptc-dispatch-start`, `tool/ptc-dispatch`, and
|
|
787
1132
|
* `compaction/summary`.
|
|
788
1133
|
*/
|
|
789
1134
|
declare function deriveProjection(sourceEvents: readonly DerivedEnvelope[], config: DeriveConfig, scope: DeriveScope, durableConfirmed: boolean, hostLock?: HostLockEvaluation): DeriveResult;
|
|
@@ -1073,6 +1418,18 @@ declare class HostProfileError extends Error {
|
|
|
1073
1418
|
* callers cannot silently select a nearest instance.
|
|
1074
1419
|
*/
|
|
1075
1420
|
declare function packageRowsFromPnpmLock(text: string, names?: readonly string[]): PackageRow[];
|
|
1421
|
+
/**
|
|
1422
|
+
* The production host verdict: the version floor and the exact-graph audit,
|
|
1423
|
+
* combined into the one answer a caller acts on.
|
|
1424
|
+
*
|
|
1425
|
+
* The two facts stay separable — `hostVersion` is always reported on the
|
|
1426
|
+
* evaluation — but a host below the supported floor is refused here even when
|
|
1427
|
+
* its graph matches an audited cohort, because no graph can lift a version
|
|
1428
|
+
* floor. Keeping this combination out of `evaluateHostLock` leaves that
|
|
1429
|
+
* function a pure graph audit, so a graph verdict is never overwritten by a
|
|
1430
|
+
* version verdict inside it.
|
|
1431
|
+
*/
|
|
1432
|
+
declare function combineHostPolicy(evaluation: HostLockEvaluation): HostLockEvaluation;
|
|
1076
1433
|
declare function resolveInstalledHostLock(moduleUrl?: string): HostLockEvaluation;
|
|
1077
1434
|
/**
|
|
1078
1435
|
* Resolve only package identities reachable from the active pnpm importer.
|
|
@@ -1356,22 +1713,130 @@ declare function renderRecoveryPacket(projection: GuardProjection, options?: Rec
|
|
|
1356
1713
|
/** Exact 34-row rc.1 runtime/web graph from the 2026-09-03 native macOS audit. */
|
|
1357
1714
|
declare const RC1_HOST_PACKAGES: PackageRow[];
|
|
1358
1715
|
//#endregion
|
|
1716
|
+
//#region src/domain/rc015-host.d.ts
|
|
1717
|
+
/**
|
|
1718
|
+
* Exact 33-row DSH 0.1.5-rc.1 core graph.
|
|
1719
|
+
*
|
|
1720
|
+
* Provenance: every row is the npm registry `dist.integrity` of the exact
|
|
1721
|
+
* published tarball for the named version, read from
|
|
1722
|
+
* `https://registry.npmjs.org/<name>/0.1.5-rc.1` (and `4.0.2` for
|
|
1723
|
+
* `@deepseek-ai/cordis`, which is versioned independently of DSH). The single
|
|
1724
|
+
* resolver for this graph is an isolated DSH installation plus the repository
|
|
1725
|
+
* worktree lockfile, both installed from the public registry.
|
|
1726
|
+
*
|
|
1727
|
+
* This is a REGISTRY-DERIVED graph, not a natively audited one: the cohort
|
|
1728
|
+
* carries `auditedPlatforms: []` until a native macOS/Windows host audit runs,
|
|
1729
|
+
* and `auditProvenance: 'registry-derived-pending-native-audit'` is bound into
|
|
1730
|
+
* the host-lock digest so a certificate can never claim a native pass this round
|
|
1731
|
+
* did not produce. (`acceptedPlatforms` is the separate, wider gate: this cohort
|
|
1732
|
+
* accepts evaluation on both platforms while claiming an audit on neither.)
|
|
1733
|
+
* `dshmarket` is deliberately absent: market identity is verified independently
|
|
1734
|
+
* by the action adapter and never participates in the core lock.
|
|
1735
|
+
*
|
|
1736
|
+
* The row-name set is unchanged from the historical 0.1.2-rc.1 cohort's 33
|
|
1737
|
+
* core rows: no package entered or left the audited core graph, so a future
|
|
1738
|
+
* reader must not infer a graph change from the version bump alone. The count
|
|
1739
|
+
* is asserted from this list, never assumed.
|
|
1740
|
+
*/
|
|
1741
|
+
declare const RC015_HOST_PACKAGES: PackageRow[];
|
|
1742
|
+
//#endregion
|
|
1743
|
+
//#region src/domain/rc015-rc2-host.d.ts
|
|
1744
|
+
/** Exact npm registry identities for DSH 0.1.5-rc.2 (Cordis 4.0.2).
|
|
1745
|
+
* Native acceptance is recorded separately; these rows are registry-derived.
|
|
1746
|
+
*/
|
|
1747
|
+
declare const RC015_RC2_HOST_PACKAGES: PackageRow[];
|
|
1748
|
+
//#endregion
|
|
1359
1749
|
//#region src/domain/session-events.d.ts
|
|
1360
1750
|
/**
|
|
1361
|
-
* Read a stable snapshot from
|
|
1362
|
-
*
|
|
1363
|
-
*
|
|
1364
|
-
*
|
|
1751
|
+
* Read a validated, stable event snapshot from the DSH Session V3 API.
|
|
1752
|
+
*
|
|
1753
|
+
* Session V3 replaced the V2 `events` getter with `snapshotEvents()`. Context
|
|
1754
|
+
* Guard supports only the V3 API: a session object that does not expose that
|
|
1755
|
+
* method is an unsupported host, never a reason to fall back to a legacy
|
|
1756
|
+
* accessor. Failing loud here keeps a V2-shaped object from being projected as
|
|
1757
|
+
* if its events had V3 semantics — the two vocabularies differ (surfaces,
|
|
1758
|
+
* `assistant/chunk` vs embedded streams, `session/end-seed` payload), so a
|
|
1759
|
+
* silent fallback would derive contract state from a log it cannot read.
|
|
1760
|
+
*
|
|
1761
|
+
* Guard is a READER of the durable log, so the envelope check below is the one
|
|
1762
|
+
* part of log validation it owns itself. The host validates a session it
|
|
1763
|
+
* constructs or restores; Guard additionally refuses a snapshot that is not a
|
|
1764
|
+
* sequence of event envelopes, because a projection that silently dropped or
|
|
1765
|
+
* mis-numbered an event would fabricate contract state rather than report a
|
|
1766
|
+
* damaged log.
|
|
1767
|
+
*
|
|
1768
|
+
* The V3 contract also asks a reader to refuse an unrecognized event type that
|
|
1769
|
+
* is not marked `ignorable`. Guard does NOT implement that half, deliberately:
|
|
1770
|
+
* the host's persistence reader already refuses such a log before publishing a
|
|
1771
|
+
* Session, and a whitelist of event types Guard happens to know would
|
|
1772
|
+
* false-refuse a healthy host whose composition registers a required event type
|
|
1773
|
+
* through a third-party plugin. The full rationale is in
|
|
1774
|
+
* `UPSTREAM_API_AUDIT.md`; revisit it there rather than adding a whitelist here.
|
|
1365
1775
|
*/
|
|
1776
|
+
declare const SESSION_API_UNSUPPORTED = "session_api_unsupported";
|
|
1777
|
+
declare const SESSION_EVENT_ENVELOPE_INVALID = "session_event_envelope_invalid";
|
|
1778
|
+
declare class SessionApiError extends Error {
|
|
1779
|
+
readonly code: string;
|
|
1780
|
+
constructor(message: string, code?: string);
|
|
1781
|
+
}
|
|
1782
|
+
/** The V3 session surface Guard reads: one bounded, immutable event snapshot. */
|
|
1783
|
+
interface V3SessionLike {
|
|
1784
|
+
snapshotEvents(fromSeq?: number, toSeqExclusive?: number): readonly unknown[];
|
|
1785
|
+
}
|
|
1366
1786
|
declare function snapshotSessionEvents(session: unknown): readonly unknown[];
|
|
1367
1787
|
//#endregion
|
|
1368
1788
|
//#region src/domain/stop-policy.d.ts
|
|
1789
|
+
/**
|
|
1790
|
+
* What "relevant progress" means, as one value.
|
|
1791
|
+
*
|
|
1792
|
+
* The inputs are the recorded state a caller could not have faked without
|
|
1793
|
+
* changing the work itself: the epoch and contract revision, the open items and
|
|
1794
|
+
* their blockers, the qualified evidence set, the boundary qualifications
|
|
1795
|
+
* available right now, and the Goal's identity and activation. Deliberately
|
|
1796
|
+
* absent: timestamps, event counts, wording, checkpoint bodies, and the Goal
|
|
1797
|
+
* *revision* — editing a Goal's text is not progress, and treating it as such
|
|
1798
|
+
* would let a re-statement reset the stop budget.
|
|
1799
|
+
*/
|
|
1800
|
+
/**
|
|
1801
|
+
* How many times the same progress fingerprint must be observed at a turn
|
|
1802
|
+
* boundary before Guard stops the automatic continuation.
|
|
1803
|
+
*
|
|
1804
|
+
* The first sighting is a baseline, not a stalled turn: it is the state a turn
|
|
1805
|
+
* either advanced to or started from, and the host's driver owns continuation
|
|
1806
|
+
* there. The second sighting is the first turn that produced nothing new, which
|
|
1807
|
+
* earns the one diagnosis and correction opportunity. The third is the bounded
|
|
1808
|
+
* stop. The count is a resource bound on repetition, never a way to declare the
|
|
1809
|
+
* task finished.
|
|
1810
|
+
*/
|
|
1811
|
+
declare const NO_PROGRESS_TURNS_BEFORE_STOP = 3;
|
|
1812
|
+
/** Marks the durable no-progress record; replay reads the budget from these. */
|
|
1813
|
+
declare const NO_PROGRESS_RECORD_PREFIX = "Context Guard no-progress record: ";
|
|
1814
|
+
/**
|
|
1815
|
+
* The identity of the turn boundary a decision is taken at.
|
|
1816
|
+
*
|
|
1817
|
+
* Guard does not own the host's turn counter, and a retry must be recognisable
|
|
1818
|
+
* as the same boundary rather than as a new one. The last durable event is that
|
|
1819
|
+
* identity: it is derivable from the log alone, it is stable across a reload,
|
|
1820
|
+
* and it only advances when the session actually records something new.
|
|
1821
|
+
*/
|
|
1822
|
+
declare function decisionBoundaryKey(projection: GuardProjection): number | undefined;
|
|
1823
|
+
declare function progressFingerprint(projection: GuardProjection): string;
|
|
1369
1824
|
type CompletionDisposition = "complete" | "user_wait" | "external_wait" | "report";
|
|
1370
1825
|
declare function isWholeTaskCompletionClaim(text: string): boolean;
|
|
1371
1826
|
declare function classifyCompletionClaim(text: string): CompletionDisposition;
|
|
1372
1827
|
interface TurnStoppingDecision {
|
|
1373
1828
|
action: "continue" | "stop";
|
|
1374
1829
|
reason?: string;
|
|
1830
|
+
/**
|
|
1831
|
+
* The no-progress attempt this decision asks the caller to record durably.
|
|
1832
|
+
* Recording is the caller's job because it is a durable side effect; deciding
|
|
1833
|
+
* is this function's job and must stay free of them.
|
|
1834
|
+
*/
|
|
1835
|
+
noProgressClaim?: {
|
|
1836
|
+
fingerprint: string;
|
|
1837
|
+
boundaryKey: string;
|
|
1838
|
+
attempt: number;
|
|
1839
|
+
};
|
|
1375
1840
|
}
|
|
1376
1841
|
interface AssistantOutcomeObservation {
|
|
1377
1842
|
kind: "completion_claim" | "user_wait_claim" | "external_wait_claim" | "report";
|
|
@@ -1388,6 +1853,27 @@ declare function observeAssistantOutcome(text: string): AssistantOutcomeObservat
|
|
|
1388
1853
|
*/
|
|
1389
1854
|
declare function decideTurnBoundary(projection: GuardProjection): TurnStoppingDecision;
|
|
1390
1855
|
declare function decideTurnStopping(projection: GuardProjection, _assistantText: string, _turn: number, _maxAttempts: number): TurnStoppingDecision;
|
|
1856
|
+
/**
|
|
1857
|
+
* Whether the last trusted ROOT instruction asked to pause.
|
|
1858
|
+
*
|
|
1859
|
+
* The source filter is the contract, not a heuristic: a quoted log, a tool
|
|
1860
|
+
* result, a plugin notice or a model message is not a `user/message` with
|
|
1861
|
+
* `source.kind === 'user'`, so none of them can reach this function at all, and
|
|
1862
|
+
* neither can the model's own summary of one. A negated pause ("不要暂停") is not
|
|
1863
|
+
* a pause request, and the check is anchored to a clause head so a pause word
|
|
1864
|
+
* mentioned inside a longer instruction is not a control request.
|
|
1865
|
+
*/
|
|
1866
|
+
declare function latestRootInstruction(events: readonly {
|
|
1867
|
+
type: string;
|
|
1868
|
+
seq?: number;
|
|
1869
|
+
data: unknown;
|
|
1870
|
+
}[]): {
|
|
1871
|
+
text: string;
|
|
1872
|
+
seq: number;
|
|
1873
|
+
} | undefined;
|
|
1874
|
+
/** Marks a root control request Guard has already carried to the host. */
|
|
1875
|
+
declare const CONTROL_RECORD_PREFIX = "Context Guard control record: ";
|
|
1876
|
+
declare function isRootPauseRequest(text: string): boolean;
|
|
1391
1877
|
declare function latestAssistantText(events: readonly {
|
|
1392
1878
|
type: string;
|
|
1393
1879
|
data: unknown;
|
|
@@ -1396,4 +1882,4 @@ declare function latestAssistantText(events: readonly {
|
|
|
1396
1882
|
//#region src/domain/supersession.d.ts
|
|
1397
1883
|
declare function supersedeItem(items: Map<string, GuardItem>, oldId: string, replacement: GuardItem): boolean;
|
|
1398
1884
|
//#endregion
|
|
1399
|
-
export {
|
|
1885
|
+
export { COMMAND_SURFACE_MANIFEST as $, namedActions as $i, bindLiveGoalCapability as $n, BoundaryQualificationKind as $r, parsePwshCommand as $t, openItems as A, PackageRow as Ai, BASE_HOST_PACKAGES as An, RejectedBinding as Ar, GitCommandManifest as At, SessionQuery as B, rebindResponse as Bi, HostCapabilityId as Bn, isInformationalMessage as Br, commitTreeSnapshotDigest as Bt, RC015_RC2_HOST_PACKAGES as C, normalizeClause as Ca, TargetCaptureReasonCode as Ci, deriveProjection as Cn, classifyTaskIntent as Cr, resolveActiveProfileHostLock as Ct, MIN_RECOVERY_CHAR_BUDGET as D, VerificationContract as Di, ALPHA2_DSHMARKET_139_HOST_PACKAGES as Dn, isFrozenV042RebindResponse as Dr, GIT_COMMAND_TEMPLATES as Dt, DEFAULT_RECOVERY_CHAR_BUDGET as E, sha256 as Ea, TargetValue as Ei, ACTIVE_HOST_LAUNCHER_VERSION as En, ParsedConfirmation as Er, GIT_COMMAND_MANIFEST_IDS as Et, PROOF_PROTOCOL_VERSION as F, confirmRebind as Fi, GOAL_HOST_PACKAGES as Fn, captureItem as Fr, GitPrestateCheck as Ft, proofEvidenceConstraints as G, InterpretOptions as Gi, HostLockContext as Gn, GoalActivationState as Gr, revalidateGitPrestate as Gt, canonicalProjection as H, AuthorityDisposition as Hi, HostCohort as Hn, BoundaryEffectuation as Hr, executeRevalidatedGitEffect as Ht, ProofKind as I, proposeRebind as Ii, HOST_CAPABILITY_PACKAGE_GROUPS as In, classifyClause as Ir, GitPrestateEnvelope as It, EvidenceFacetCoverage as J, interpretMessage as Ji, HostPlatform as Jn, effectuateBoundary as Jr, CanonicalCommandSurface as Jt, sessionQuery as K, ScopeInterpretation as Ki, HostLockEvaluation as Kn, GoalBoundaryAccess as Kr, verifiedLinearCommitReadback as Kt, ProofManifest as L, proposeRebindOutcome as Li, HOST_COHORTS as Ln, extractArtifactPaths as Lr, GitTargetIdentity as Lt, renderRecoveryPacket as M, ProposeOutcome as Mi, EXPECTED_HOST_PACKAGES as Mn, CaptureScope as Mr, GitCommandRejected as Mt, ALPHA3_HOST_PACKAGES as N, RebindArgs as Ni, ExecutableIdentity as Nn, ClauseSegment as Nr, GitEffectExecution as Nt, RecoveryOptions as O, WaitAuthorization as Oi, ALPHA2_HOST_PACKAGES as On, parseConfirmationMessage as Or, GitAdapterAction as Ot, PROOF_KINDS as P, RebindProposal as Pi, ExecutableIdentityBinding as Pn, captureClause as Pr, GitEffectRunner as Pt, isVerifyingCapability as Q, maskCodeSpans as Qi, bindExecutableIdentity as Qn, BoundaryDisposition as Qr, isRunExecutable as Qt, ProofObligation as R, proposeRebindV042 as Ri, HostAuditProvenance as Rn, extractMethod as Rr, LinearCommitReadback as Rt, snapshotSessionEvents as S, digestStrings as Sa, PersistenceAuthorization as Si, PROTOCOL_V4_NOTICE as Sn, UserInteractionKind as Sr, readActiveHostGraph as St, RC1_HOST_PACKAGES as T, sanitizeUrl as Ta, TargetTuple as Ti, ACTIVE_HOST_COHORT_IDS as Tn, CONFIRM_LINE_PATTERN as Tr, verifyComposedHostLockDump as Tt, createProofManifest as U, DirectiveClass as Ui, HostCohortSelection as Un, BoundaryQualification as Ur, gitCommandMatchesTarget as Ut, bindProofToProjection as V, replayRebindResult as Vi, HostCapabilityRequest as Vn, segmentClauses as Vr, createGitPrestateEnvelope as Vt, proofDigest as W, Executee as Wi, HostCohortSelectionReason as Wn, BoundaryRequest as Wr, parseGitCommandManifest as Wt, evidenceCoverage as X, isOpenObligation as Xi, HostToolSurface as Xn, qualifyBoundary as Xr, ShellParseStatus as Xt, bindingSatisfies as Y, isExecutableItem as Yi, HostProfileKind as Yn, isCurrentAcceptedBoundary as Yr, ParsedShell as Yt, evidenceMatchesItem as Z, kindOfScope as Zi, LEGACY_HOST_COHORTS as Zn, BindingActionClosure as Zr, canonicalArgvFromCommand as Zt, progressFingerprint as _, semanticActionFromCommand as _a, GuardItemKind as _i, evidenceAvailabilityReason as _n, AuthorityBlockKind as _r, hostLockRowsFromComposedDump as _t, NO_PROGRESS_RECORD_PREFIX as a, ActionSpec as aa, EvidenceBinding as ai, ToolSubject as an, selectHostCohort as ar, FIRST_STEP_GUIDANCE as at, SessionApiError as b, validateActionTarget as ba, GuardProjection as bi, CAPTURE_V042_NOTICE as bn, segmentAuthorityBlocks as br, packageRowsFromActiveGraph as bt, classifyCompletionClaim as c, STATEFUL_ACTIONS as ca, EvidenceRole as ci, extractToolSubject as cn, MIN_SUPPORTED_HOST_VERSION as cr, LifecyclePhase as ct, decisionBoundaryKey as d, SemanticAction as da, GoalRef as di, CertificationSupport as dn, compareHostVersions as dr, previewFirstStepInjection as dt, semanticActionOfScope as ea, DeferAuthorization as ei, parseShellCommand as en, evaluateExternalWaitCapability as er, CommandSurfaceManifest as et, isRootPauseRequest as f, StatefulAction as fa, GuardBoundary as fi, DiagnosisNextAction as fn, evaluateMinimumHostVersion as fr, ActiveProfileHostLock as ft, observeAssistantOutcome as g, requestedTargetMatchesResolved as ga, GuardItem as gi, deriveItemDiagnosis as gn, AuthorityBlock as gr, hostLockContextFromComposedDump as gt, latestRootInstruction as h, requestedTargetAuthorizesMutation as ha, GuardIntegrity as hi, UnifiedItemDiagnosis as hn, currentContractDigest as hr, combineHostPolicy as ht, CompletionDisposition as i, ActionManifest as ia, DerivedEnvelope as ii, ToolResultInput as in, hostVersionFromPackages as ir, ClaimedMessage as it, recoveryDigest as j, BoundedSource as ji, DEFAULT_HOST_LOCK as jn, certifyCheckpoint as jr, GitCommandParseResult as jt, closingHint as k, createProjection as ki, AuditedExecutable as kn, CheckpointResult as kr, GitCommandAccepted as kt, decideTurnBoundary as l, STOP_PROTOCOL_VERSION as la, ExpectedTransition as li, isDeterministicCheck as ln, ParsedHostVersion as lr, claimedBatchHasRealRootInput as lt, latestAssistantText as m, isStatefulAction as ma, GuardEvidence as mi, TaskKind as mn, satisfiesSupportedHostRange as mr, TargetHostGraph as mt, AssistantOutcomeObservation as n, ACTION_MANIFEST as na, DeriveResult as ni, hasCurrentCertificate as nn, evaluateHostLock as nr, OperationVerbEntry as nt, NO_PROGRESS_TURNS_BEFORE_STOP as o, CERTIFICATE_VERSION as oa, EvidenceOutcome as oi, evidenceFromPersistedToolResult as on, HostVersionDecision as or, FirstStepInjection as ot, isWholeTaskCompletionClaim as p, actionCompatible as pa, GuardCheckpoint as pi, Repairability as pn, parseHostVersion as pr, HostProfileError as pt, validateProofManifest as q, interpretClause as qi, HostLockStatus as qn, availableBoundaryQualifications as qr, CanonicalArgv as qt, CONTROL_RECORD_PREFIX as r, ACTION_MANIFEST_VERSION as ra, DeriveScope as ri, ToolCallInput as rn, evaluateToolSurfaceCapability as rr, validateManifest as rt, TurnStoppingDecision as s, SEMANTIC_ACTIONS as sa, EvidenceParseStatus as si, extractTextContent as sn, HostVersionStatus as sr, FirstStepPreviewInput as st, supersedeItem as t, statefulActionsOfScope as ta, DeriveConfig as ti, goalCompletionDenial as tn, evaluateHostCapability as tr, ManifestIssue as tt, decideTurnStopping as u, SUPPORTED_EVIDENCE_ADAPTERS as ua, ExternalOperation as ui, withDurability as un, SUPPORTED_HOST_RANGE as ur, lifecyclePhase as ut, SESSION_API_UNSUPPORTED as v, semanticActionFromText as va, GuardItemStatus as vi, itemDiagnosis as vn, AuthorityKind as vr, injectActiveProfileHostLock as vt, RC015_HOST_PACKAGES as w, sanitizeClauseText as wa, TargetCaptureStatus as wi, ACTIVE_HOST_COHORT_ID as wn, classifyUserInteraction as wr, resolveInstalledHostLock as wt, V3SessionLike as x, canonicalizePath as xa, HostStatus as xi, PROTOCOL_V3_NOTICE as xn, TaskIntent as xr, packageRowsFromPnpmLock as xt, SESSION_EVENT_ENVELOPE_INVALID as y, validateActionManifest as ya, GuardOperation as yi, relevantEvidence as yn, authorityCaptureCounts as yr, inspectTargetHostGraph as yt, ProofSurface as z, rebindAttemptKey as zi, HostCapabilityEvaluation as zn, extractOperation as zr, commitIndexSnapshotDigest as zt };
|