dsh-completion-guard 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/CHANGELOG.zh-CN.md +38 -0
- package/README.md +12 -8
- package/README.zh-CN.md +12 -8
- package/bin/dsh-completion-guard-host-lock.mjs +16 -0
- package/dist/domain/index.d.ts +2 -2
- package/dist/domain/index.js +2 -2
- package/dist/{domain-Cx8vpxSj.js → domain-RuX9l07o.js} +2616 -581
- package/dist/{index-Cd3wXBLi.d.ts → index-BTaiOcE-.d.ts} +491 -31
- package/dist/index.d.ts +3 -2
- package/dist/index.js +270 -18
- package/docs/ARCHITECTURE.md +7 -2
- package/docs/COMPATIBILITY.md +65 -5
- package/docs/HOST_LOCK_UPGRADE.md +42 -5
- package/docs/LOCAL_ACCEPTANCE.md +20 -2
- package/docs/PORTING_NOTES.md +22 -0
- package/docs/SEMANTIC_COMPATIBILITY.md +24 -0
- package/docs/distribution.md +12 -6
- package/docs/upstream-deltas.json +30 -4
- package/manifests/supported-host.v1.json +298 -89
- package/package.json +38 -32
|
@@ -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,65 @@ 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.2 supports exactly the two registered DSH host releases:
|
|
831
|
+
* `0.1.5-rc.2` (latest) and `0.1.5-rc.1` (verified minimum). Package discovery,
|
|
832
|
+
* npm installation, and the exported support range use the same newest-first
|
|
833
|
+
* exact union, so an unregistered stable or future prerelease is never advertised
|
|
834
|
+
* merely because it sorts above the minimum.
|
|
835
|
+
*
|
|
836
|
+
* The minimum comparison remains a diagnostic layer for distinguishing an old
|
|
837
|
+
* host from an at-or-above-floor but unregistered host. It never substitutes for
|
|
838
|
+
* the exact support set or the complete 33-package host graph.
|
|
839
|
+
*/
|
|
840
|
+
/** Lowest supported DSH host version. DSH packages version independently of Cordis. */
|
|
841
|
+
declare const MIN_SUPPORTED_HOST_VERSION = "0.1.5-rc.1";
|
|
842
|
+
/** Latest DSH release with a registered complete host graph. */
|
|
843
|
+
declare const LATEST_SUPPORTED_HOST_VERSION = "0.1.5-rc.2";
|
|
844
|
+
/** Exact endpoints supported by the current release, newest first. */
|
|
845
|
+
declare const SUPPORTED_HOST_VERSIONS: readonly string[];
|
|
846
|
+
/** Exact npm range shared by package discovery and peer dependency declarations. */
|
|
847
|
+
declare const SUPPORTED_HOST_RANGE: string;
|
|
848
|
+
interface ParsedHostVersion {
|
|
849
|
+
major: number;
|
|
850
|
+
minor: number;
|
|
851
|
+
patch: number;
|
|
852
|
+
/** Dot-separated prerelease identifiers; empty for a release version. */
|
|
853
|
+
prerelease: readonly string[];
|
|
854
|
+
}
|
|
855
|
+
declare function parseHostVersion(value: string): ParsedHostVersion | undefined;
|
|
856
|
+
/**
|
|
857
|
+
* SemVer precedence comparison, including the prerelease rules. Returns
|
|
858
|
+
* `undefined` for a value that is not a version this module can order, so an
|
|
859
|
+
* unparseable host version fails closed rather than sorting as "newer".
|
|
860
|
+
*/
|
|
861
|
+
declare function compareHostVersions(a: string, b: string): number | undefined;
|
|
862
|
+
type HostVersionStatus = "supported" | "below_minimum" | "unparseable";
|
|
863
|
+
interface HostVersionDecision {
|
|
864
|
+
status: HostVersionStatus;
|
|
865
|
+
version: string;
|
|
866
|
+
minimum: string;
|
|
867
|
+
reasonCode: "host_version_supported" | "host_version_below_minimum" | "host_version_unparseable";
|
|
868
|
+
}
|
|
869
|
+
/** Decide the version-policy half of host support. Never a substitute for the graph lock. */
|
|
870
|
+
declare function evaluateMinimumHostVersion(version: string, minimum?: string): HostVersionDecision;
|
|
871
|
+
/** Whether npm's exact public support union admits this host version. */
|
|
872
|
+
declare function satisfiesSupportedHostRange(version: string): boolean;
|
|
873
|
+
//#endregion
|
|
611
874
|
//#region src/domain/host-lock.d.ts
|
|
612
875
|
type HostLockStatus = "supported" | "unsupported" | "unavailable";
|
|
613
876
|
type HostPlatform = "posix" | "windows";
|
|
614
877
|
type HostProfileKind = "headless" | "web";
|
|
878
|
+
/**
|
|
879
|
+
* How a cohort's package rows were established. Bound into every host-lock
|
|
880
|
+
* digest through the `host_audit_provenance` capability row, so a certificate
|
|
881
|
+
* records whether the exact graph it used was loaded on a native host or only
|
|
882
|
+
* resolved from the registry.
|
|
883
|
+
*/
|
|
884
|
+
type HostAuditProvenance = "native-audited" | "registry-derived-pending-native-audit";
|
|
615
885
|
interface HostCohort {
|
|
616
886
|
/** Stable cohort identity; bound into every hostLockDigest via `host_cohort`. */
|
|
617
887
|
id: string;
|
|
@@ -619,10 +889,19 @@ interface HostCohort {
|
|
|
619
889
|
supportedGoalVersions: string[];
|
|
620
890
|
/**
|
|
621
891
|
* Platforms where this cohort's exact package graph was extracted from a
|
|
622
|
-
* native host and audited.
|
|
623
|
-
*
|
|
892
|
+
* native host and audited. A cohort with no native audit has an empty list
|
|
893
|
+
* here even while it accepts evaluations — see {@link acceptedPlatforms}.
|
|
624
894
|
*/
|
|
625
895
|
auditedPlatforms: readonly HostPlatform[];
|
|
896
|
+
/**
|
|
897
|
+
* Platforms on which the cohort may evaluate to `supported`. This is the
|
|
898
|
+
* gating list; a platform outside it fails closed with
|
|
899
|
+
* `host_cohort_platform_not_audited`. `auditedPlatforms` remains the stricter
|
|
900
|
+
* fact and `auditProvenance` states which one a certificate actually rests
|
|
901
|
+
* on, so a registry-derived graph is never silently reported as a native pass.
|
|
902
|
+
*/
|
|
903
|
+
acceptedPlatforms: readonly HostPlatform[];
|
|
904
|
+
auditProvenance: HostAuditProvenance;
|
|
626
905
|
packages: PackageRow[];
|
|
627
906
|
capabilities: CapabilityRow[];
|
|
628
907
|
}
|
|
@@ -644,27 +923,39 @@ declare const ALPHA2_DSHMARKET_139_HOST_PACKAGES: PackageRow[];
|
|
|
644
923
|
/**
|
|
645
924
|
* Historical audited host cohort registry. Every entry keeps the exact package
|
|
646
925
|
* 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
|
|
926
|
+
* contracts). These are historical verification facts only: since 0.5.1 the
|
|
927
|
+
* active support targets are `0.1.5-rc.1` and `0.1.5-rc.2`, so an installed graph from any of
|
|
649
928
|
* these cohorts — including previous RCs and alphas — is no longer an active
|
|
650
929
|
* support entry and fails closed in `evaluateHostLock`.
|
|
651
930
|
*/
|
|
652
931
|
declare const LEGACY_HOST_COHORTS: readonly HostCohort[];
|
|
932
|
+
/** Baseline cohort retained for callers that need a default fixture. */
|
|
933
|
+
declare const ACTIVE_HOST_COHORT_ID = "dsh-0.1.5-rc.1";
|
|
934
|
+
declare const ACTIVE_HOST_COHORT_IDS: readonly string[];
|
|
653
935
|
/** Core-lock/v1 separates optional market identity from the audited DSH graph.
|
|
654
|
-
* The active support
|
|
936
|
+
* The active support targets are the exact registered rc.1 and rc.2 graphs:
|
|
655
937
|
* historical cohorts stay in `LEGACY_HOST_COHORTS` as verification data but are
|
|
656
938
|
* never silently re-labelled as accepted active locks, and an installed
|
|
657
|
-
* historical graph fails closed under `evaluateHostLock`.
|
|
939
|
+
* historical graph fails closed under `evaluateHostLock`. The version policy
|
|
940
|
+
* (the exact rc.2-or-rc.1 public set) and the graph lock are separate
|
|
941
|
+
* judgments: a host that has not been registered here is "unverified / pending
|
|
942
|
+
* audit", never supported by version order alone.
|
|
658
943
|
*/
|
|
659
944
|
declare const HOST_COHORTS: readonly HostCohort[];
|
|
660
945
|
/**
|
|
661
|
-
*
|
|
662
|
-
*
|
|
663
|
-
*
|
|
664
|
-
*
|
|
665
|
-
*
|
|
946
|
+
* Baseline fixture package identities (DSH 0.1.5-rc.1). The cohort
|
|
947
|
+
* is an atomic whole-graph contract (CG-DSH-001): any drifted, duplicated,
|
|
948
|
+
* unknown-version, unbound, OR MISSING row fails the whole lock closed
|
|
949
|
+
* (`host_lock_missing`); no capability inherits independence from a partially
|
|
950
|
+
* present graph.
|
|
666
951
|
*/
|
|
667
952
|
declare const EXPECTED_HOST_PACKAGES: PackageRow[];
|
|
953
|
+
/**
|
|
954
|
+
* The `@deepseek-ai/dsh` launcher version of the baseline fixture, read from the
|
|
955
|
+
* cohort rows rather than hardcoded, so a cohort bump cannot leave a stale
|
|
956
|
+
* literal behind in the target-inspection path.
|
|
957
|
+
*/
|
|
958
|
+
declare const ACTIVE_HOST_LAUNCHER_VERSION: string | undefined;
|
|
668
959
|
declare const BASE_HOST_PACKAGES: ReadonlySet<string>;
|
|
669
960
|
declare const GOAL_HOST_PACKAGES: ReadonlySet<string>;
|
|
670
961
|
type HostCapabilityId = "agent_loop" | "terminal_posix" | "terminal_windows" | "dsh_cli" | "plugin_inventory" | "web_control" | "jobs" | "filesystem";
|
|
@@ -681,14 +972,28 @@ interface HostLockEvaluation {
|
|
|
681
972
|
status: HostLockStatus;
|
|
682
973
|
digest: string;
|
|
683
974
|
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";
|
|
975
|
+
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
976
|
packages: PackageRow[];
|
|
686
977
|
capabilities: Record<HostCapabilityId, HostCapabilityEvaluation>;
|
|
687
978
|
platform?: HostPlatform;
|
|
688
979
|
profileKind?: HostProfileKind;
|
|
689
980
|
liveGoalAvailable?: boolean;
|
|
981
|
+
/**
|
|
982
|
+
* The version-policy half of host support, decided separately from the graph.
|
|
983
|
+
* A host below the minimum is refused here even when its graph matches an
|
|
984
|
+
* audited cohort, and an in-range version never substitutes for the
|
|
985
|
+
* exact-graph audit: the two are independent facts, both reported.
|
|
986
|
+
*/
|
|
987
|
+
hostVersion?: HostVersionDecision;
|
|
690
988
|
/** Readback of the audited cohort the supplied graph was evaluated against. */
|
|
691
989
|
cohortId?: string;
|
|
990
|
+
/**
|
|
991
|
+
* Readback of how that cohort's rows were established. `registry-derived-
|
|
992
|
+
* pending-native-audit` means the exact published graph was verified but no
|
|
993
|
+
* native host load has happened yet; a certificate must never present that as
|
|
994
|
+
* a native pass.
|
|
995
|
+
*/
|
|
996
|
+
auditProvenance?: HostAuditProvenance;
|
|
692
997
|
/** Audited cohort rows absent from the supplied graph (diagnostic). */
|
|
693
998
|
missingPackages?: string[];
|
|
694
999
|
}
|
|
@@ -696,7 +1001,21 @@ interface HostLockContext {
|
|
|
696
1001
|
platform?: HostPlatform;
|
|
697
1002
|
profileKind?: HostProfileKind;
|
|
698
1003
|
capabilityId?: string;
|
|
1004
|
+
/**
|
|
1005
|
+
* The DSH host version the graph was read from, when the caller read one.
|
|
1006
|
+
* Supplying it turns the version policy into a production decision; omitting
|
|
1007
|
+
* it leaves the version question unanswered rather than assumed supported.
|
|
1008
|
+
*/
|
|
1009
|
+
hostVersion?: string;
|
|
699
1010
|
}
|
|
1011
|
+
/**
|
|
1012
|
+
* The host version a package graph records, for the version-policy decision.
|
|
1013
|
+
*
|
|
1014
|
+
* Every DSH package versions with the host, so the graph's own `dsh` row is the
|
|
1015
|
+
* version the caller is running. A graph without that row leaves the version
|
|
1016
|
+
* unknown, and an unknown version is not treated as supported.
|
|
1017
|
+
*/
|
|
1018
|
+
declare function hostVersionFromPackages(rows: readonly PackageRow[]): string | undefined;
|
|
700
1019
|
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
1020
|
interface HostCohortSelection {
|
|
702
1021
|
/**
|
|
@@ -783,7 +1102,7 @@ declare const PROTOCOL_V4_NOTICE = "Context Guard protocol boundary: v4.0.0";
|
|
|
783
1102
|
* Pure, deterministic re-derivation of the guard projection from the DSH
|
|
784
1103
|
* native event log. Context Guard never writes custom session events, so every
|
|
785
1104
|
* piece of state is derived from `command/run`, `user/message`, `tool/call`,
|
|
786
|
-
* `tool/result`, `tool/
|
|
1105
|
+
* `tool/result`, `tool/ptc-dispatch-start`, `tool/ptc-dispatch`, and
|
|
787
1106
|
* `compaction/summary`.
|
|
788
1107
|
*/
|
|
789
1108
|
declare function deriveProjection(sourceEvents: readonly DerivedEnvelope[], config: DeriveConfig, scope: DeriveScope, durableConfirmed: boolean, hostLock?: HostLockEvaluation): DeriveResult;
|
|
@@ -1073,6 +1392,18 @@ declare class HostProfileError extends Error {
|
|
|
1073
1392
|
* callers cannot silently select a nearest instance.
|
|
1074
1393
|
*/
|
|
1075
1394
|
declare function packageRowsFromPnpmLock(text: string, names?: readonly string[]): PackageRow[];
|
|
1395
|
+
/**
|
|
1396
|
+
* The production host verdict: the version floor and the exact-graph audit,
|
|
1397
|
+
* combined into the one answer a caller acts on.
|
|
1398
|
+
*
|
|
1399
|
+
* The two facts stay separable — `hostVersion` is always reported on the
|
|
1400
|
+
* evaluation — but a host below the supported floor is refused here even when
|
|
1401
|
+
* its graph matches an audited cohort, because no graph can lift a version
|
|
1402
|
+
* floor. Keeping this combination out of `evaluateHostLock` leaves that
|
|
1403
|
+
* function a pure graph audit, so a graph verdict is never overwritten by a
|
|
1404
|
+
* version verdict inside it.
|
|
1405
|
+
*/
|
|
1406
|
+
declare function combineHostPolicy(evaluation: HostLockEvaluation): HostLockEvaluation;
|
|
1076
1407
|
declare function resolveInstalledHostLock(moduleUrl?: string): HostLockEvaluation;
|
|
1077
1408
|
/**
|
|
1078
1409
|
* Resolve only package identities reachable from the active pnpm importer.
|
|
@@ -1356,22 +1687,130 @@ declare function renderRecoveryPacket(projection: GuardProjection, options?: Rec
|
|
|
1356
1687
|
/** Exact 34-row rc.1 runtime/web graph from the 2026-09-03 native macOS audit. */
|
|
1357
1688
|
declare const RC1_HOST_PACKAGES: PackageRow[];
|
|
1358
1689
|
//#endregion
|
|
1690
|
+
//#region src/domain/rc015-host.d.ts
|
|
1691
|
+
/**
|
|
1692
|
+
* Exact 33-row DSH 0.1.5-rc.1 core graph.
|
|
1693
|
+
*
|
|
1694
|
+
* Provenance: every row is the npm registry `dist.integrity` of the exact
|
|
1695
|
+
* published tarball for the named version, read from
|
|
1696
|
+
* `https://registry.npmjs.org/<name>/0.1.5-rc.1` (and `4.0.2` for
|
|
1697
|
+
* `@deepseek-ai/cordis`, which is versioned independently of DSH). The single
|
|
1698
|
+
* resolver for this graph is an isolated DSH installation plus the repository
|
|
1699
|
+
* worktree lockfile, both installed from the public registry.
|
|
1700
|
+
*
|
|
1701
|
+
* This is a REGISTRY-DERIVED graph, not a natively audited one: the cohort
|
|
1702
|
+
* carries `auditedPlatforms: []` until a native macOS/Windows host audit runs,
|
|
1703
|
+
* and `auditProvenance: 'registry-derived-pending-native-audit'` is bound into
|
|
1704
|
+
* the host-lock digest so a certificate can never claim a native pass this round
|
|
1705
|
+
* did not produce. (`acceptedPlatforms` is the separate, wider gate: this cohort
|
|
1706
|
+
* accepts evaluation on both platforms while claiming an audit on neither.)
|
|
1707
|
+
* `dshmarket` is deliberately absent: market identity is verified independently
|
|
1708
|
+
* by the action adapter and never participates in the core lock.
|
|
1709
|
+
*
|
|
1710
|
+
* The row-name set is unchanged from the historical 0.1.2-rc.1 cohort's 33
|
|
1711
|
+
* core rows: no package entered or left the audited core graph, so a future
|
|
1712
|
+
* reader must not infer a graph change from the version bump alone. The count
|
|
1713
|
+
* is asserted from this list, never assumed.
|
|
1714
|
+
*/
|
|
1715
|
+
declare const RC015_HOST_PACKAGES: PackageRow[];
|
|
1716
|
+
//#endregion
|
|
1717
|
+
//#region src/domain/rc015-rc2-host.d.ts
|
|
1718
|
+
/** Exact npm registry identities for DSH 0.1.5-rc.2 (Cordis 4.0.2).
|
|
1719
|
+
* Native acceptance is recorded separately; these rows are registry-derived.
|
|
1720
|
+
*/
|
|
1721
|
+
declare const RC015_RC2_HOST_PACKAGES: PackageRow[];
|
|
1722
|
+
//#endregion
|
|
1359
1723
|
//#region src/domain/session-events.d.ts
|
|
1360
1724
|
/**
|
|
1361
|
-
* Read a stable snapshot from
|
|
1362
|
-
*
|
|
1363
|
-
*
|
|
1364
|
-
*
|
|
1725
|
+
* Read a validated, stable event snapshot from the DSH Session V3 API.
|
|
1726
|
+
*
|
|
1727
|
+
* Session V3 replaced the V2 `events` getter with `snapshotEvents()`. Context
|
|
1728
|
+
* Guard supports only the V3 API: a session object that does not expose that
|
|
1729
|
+
* method is an unsupported host, never a reason to fall back to a legacy
|
|
1730
|
+
* accessor. Failing loud here keeps a V2-shaped object from being projected as
|
|
1731
|
+
* if its events had V3 semantics — the two vocabularies differ (surfaces,
|
|
1732
|
+
* `assistant/chunk` vs embedded streams, `session/end-seed` payload), so a
|
|
1733
|
+
* silent fallback would derive contract state from a log it cannot read.
|
|
1734
|
+
*
|
|
1735
|
+
* Guard is a READER of the durable log, so the envelope check below is the one
|
|
1736
|
+
* part of log validation it owns itself. The host validates a session it
|
|
1737
|
+
* constructs or restores; Guard additionally refuses a snapshot that is not a
|
|
1738
|
+
* sequence of event envelopes, because a projection that silently dropped or
|
|
1739
|
+
* mis-numbered an event would fabricate contract state rather than report a
|
|
1740
|
+
* damaged log.
|
|
1741
|
+
*
|
|
1742
|
+
* The V3 contract also asks a reader to refuse an unrecognized event type that
|
|
1743
|
+
* is not marked `ignorable`. Guard does NOT implement that half, deliberately:
|
|
1744
|
+
* the host's persistence reader already refuses such a log before publishing a
|
|
1745
|
+
* Session, and a whitelist of event types Guard happens to know would
|
|
1746
|
+
* false-refuse a healthy host whose composition registers a required event type
|
|
1747
|
+
* through a third-party plugin. The full rationale is in
|
|
1748
|
+
* `UPSTREAM_API_AUDIT.md`; revisit it there rather than adding a whitelist here.
|
|
1365
1749
|
*/
|
|
1750
|
+
declare const SESSION_API_UNSUPPORTED = "session_api_unsupported";
|
|
1751
|
+
declare const SESSION_EVENT_ENVELOPE_INVALID = "session_event_envelope_invalid";
|
|
1752
|
+
declare class SessionApiError extends Error {
|
|
1753
|
+
readonly code: string;
|
|
1754
|
+
constructor(message: string, code?: string);
|
|
1755
|
+
}
|
|
1756
|
+
/** The V3 session surface Guard reads: one bounded, immutable event snapshot. */
|
|
1757
|
+
interface V3SessionLike {
|
|
1758
|
+
snapshotEvents(fromSeq?: number, toSeqExclusive?: number): readonly unknown[];
|
|
1759
|
+
}
|
|
1366
1760
|
declare function snapshotSessionEvents(session: unknown): readonly unknown[];
|
|
1367
1761
|
//#endregion
|
|
1368
1762
|
//#region src/domain/stop-policy.d.ts
|
|
1763
|
+
/**
|
|
1764
|
+
* What "relevant progress" means, as one value.
|
|
1765
|
+
*
|
|
1766
|
+
* The inputs are the recorded state a caller could not have faked without
|
|
1767
|
+
* changing the work itself: the epoch and contract revision, the open items and
|
|
1768
|
+
* their blockers, the qualified evidence set, the boundary qualifications
|
|
1769
|
+
* available right now, and the Goal's identity and activation. Deliberately
|
|
1770
|
+
* absent: timestamps, event counts, wording, checkpoint bodies, and the Goal
|
|
1771
|
+
* *revision* — editing a Goal's text is not progress, and treating it as such
|
|
1772
|
+
* would let a re-statement reset the stop budget.
|
|
1773
|
+
*/
|
|
1774
|
+
/**
|
|
1775
|
+
* How many times the same progress fingerprint must be observed at a turn
|
|
1776
|
+
* boundary before Guard stops the automatic continuation.
|
|
1777
|
+
*
|
|
1778
|
+
* The first sighting is a baseline, not a stalled turn: it is the state a turn
|
|
1779
|
+
* either advanced to or started from, and the host's driver owns continuation
|
|
1780
|
+
* there. The second sighting is the first turn that produced nothing new, which
|
|
1781
|
+
* earns the one diagnosis and correction opportunity. The third is the bounded
|
|
1782
|
+
* stop. The count is a resource bound on repetition, never a way to declare the
|
|
1783
|
+
* task finished.
|
|
1784
|
+
*/
|
|
1785
|
+
declare const NO_PROGRESS_TURNS_BEFORE_STOP = 3;
|
|
1786
|
+
/** Marks the durable no-progress record; replay reads the budget from these. */
|
|
1787
|
+
declare const NO_PROGRESS_RECORD_PREFIX = "Context Guard no-progress record: ";
|
|
1788
|
+
/**
|
|
1789
|
+
* The identity of the turn boundary a decision is taken at.
|
|
1790
|
+
*
|
|
1791
|
+
* Guard does not own the host's turn counter, and a retry must be recognisable
|
|
1792
|
+
* as the same boundary rather than as a new one. The last durable event is that
|
|
1793
|
+
* identity: it is derivable from the log alone, it is stable across a reload,
|
|
1794
|
+
* and it only advances when the session actually records something new.
|
|
1795
|
+
*/
|
|
1796
|
+
declare function decisionBoundaryKey(projection: GuardProjection): number | undefined;
|
|
1797
|
+
declare function progressFingerprint(projection: GuardProjection): string;
|
|
1369
1798
|
type CompletionDisposition = "complete" | "user_wait" | "external_wait" | "report";
|
|
1370
1799
|
declare function isWholeTaskCompletionClaim(text: string): boolean;
|
|
1371
1800
|
declare function classifyCompletionClaim(text: string): CompletionDisposition;
|
|
1372
1801
|
interface TurnStoppingDecision {
|
|
1373
1802
|
action: "continue" | "stop";
|
|
1374
1803
|
reason?: string;
|
|
1804
|
+
/**
|
|
1805
|
+
* The no-progress attempt this decision asks the caller to record durably.
|
|
1806
|
+
* Recording is the caller's job because it is a durable side effect; deciding
|
|
1807
|
+
* is this function's job and must stay free of them.
|
|
1808
|
+
*/
|
|
1809
|
+
noProgressClaim?: {
|
|
1810
|
+
fingerprint: string;
|
|
1811
|
+
boundaryKey: string;
|
|
1812
|
+
attempt: number;
|
|
1813
|
+
};
|
|
1375
1814
|
}
|
|
1376
1815
|
interface AssistantOutcomeObservation {
|
|
1377
1816
|
kind: "completion_claim" | "user_wait_claim" | "external_wait_claim" | "report";
|
|
@@ -1388,6 +1827,27 @@ declare function observeAssistantOutcome(text: string): AssistantOutcomeObservat
|
|
|
1388
1827
|
*/
|
|
1389
1828
|
declare function decideTurnBoundary(projection: GuardProjection): TurnStoppingDecision;
|
|
1390
1829
|
declare function decideTurnStopping(projection: GuardProjection, _assistantText: string, _turn: number, _maxAttempts: number): TurnStoppingDecision;
|
|
1830
|
+
/**
|
|
1831
|
+
* Whether the last trusted ROOT instruction asked to pause.
|
|
1832
|
+
*
|
|
1833
|
+
* The source filter is the contract, not a heuristic: a quoted log, a tool
|
|
1834
|
+
* result, a plugin notice or a model message is not a `user/message` with
|
|
1835
|
+
* `source.kind === 'user'`, so none of them can reach this function at all, and
|
|
1836
|
+
* neither can the model's own summary of one. A negated pause ("不要暂停") is not
|
|
1837
|
+
* a pause request, and the check is anchored to a clause head so a pause word
|
|
1838
|
+
* mentioned inside a longer instruction is not a control request.
|
|
1839
|
+
*/
|
|
1840
|
+
declare function latestRootInstruction(events: readonly {
|
|
1841
|
+
type: string;
|
|
1842
|
+
seq?: number;
|
|
1843
|
+
data: unknown;
|
|
1844
|
+
}[]): {
|
|
1845
|
+
text: string;
|
|
1846
|
+
seq: number;
|
|
1847
|
+
} | undefined;
|
|
1848
|
+
/** Marks a root control request Guard has already carried to the host. */
|
|
1849
|
+
declare const CONTROL_RECORD_PREFIX = "Context Guard control record: ";
|
|
1850
|
+
declare function isRootPauseRequest(text: string): boolean;
|
|
1391
1851
|
declare function latestAssistantText(events: readonly {
|
|
1392
1852
|
type: string;
|
|
1393
1853
|
data: unknown;
|
|
@@ -1396,4 +1856,4 @@ declare function latestAssistantText(events: readonly {
|
|
|
1396
1856
|
//#region src/domain/supersession.d.ts
|
|
1397
1857
|
declare function supersedeItem(items: Map<string, GuardItem>, oldId: string, replacement: GuardItem): boolean;
|
|
1398
1858
|
//#endregion
|
|
1399
|
-
export {
|
|
1859
|
+
export { COMMAND_SURFACE_MANIFEST as $, kindOfScope as $i, bindLiveGoalCapability as $n, BindingActionClosure as $r, parsePwshCommand as $t, openItems as A, WaitAuthorization as Ai, BASE_HOST_PACKAGES as An, parseConfirmationMessage as Ar, GitCommandManifest as At, SessionQuery as B, proposeRebindV042 as Bi, HostCapabilityId as Bn, extractMethod as Br, commitTreeSnapshotDigest as Bt, RC015_RC2_HOST_PACKAGES as C, canonicalizePath as Ca, HostStatus as Ci, deriveProjection as Cn, TaskIntent as Cr, resolveActiveProfileHostLock as Ct, MIN_RECOVERY_CHAR_BUDGET as D, sanitizeUrl as Da, TargetTuple as Di, ALPHA2_DSHMARKET_139_HOST_PACKAGES as Dn, CONFIRM_LINE_PATTERN as Dr, GIT_COMMAND_TEMPLATES as Dt, DEFAULT_RECOVERY_CHAR_BUDGET as E, sanitizeClauseText as Ea, TargetCaptureStatus as Ei, ACTIVE_HOST_LAUNCHER_VERSION as En, classifyUserInteraction as Er, GIT_COMMAND_MANIFEST_IDS as Et, PROOF_PROTOCOL_VERSION as F, RebindArgs as Fi, GOAL_HOST_PACKAGES as Fn, ClauseSegment as Fr, GitPrestateCheck as Ft, proofEvidenceConstraints as G, DirectiveClass as Gi, HostLockContext as Gn, BoundaryQualification as Gr, revalidateGitPrestate as Gt, canonicalProjection as H, rebindResponse as Hi, HostCohort as Hn, isInformationalMessage as Hr, executeRevalidatedGitEffect as Ht, ProofKind as I, RebindProposal as Ii, HOST_CAPABILITY_PACKAGE_GROUPS as In, captureClause as Ir, GitPrestateEnvelope as It, EvidenceFacetCoverage as J, ScopeInterpretation as Ji, HostPlatform as Jn, GoalBoundaryAccess as Jr, CanonicalCommandSurface as Jt, sessionQuery as K, Executee as Ki, HostLockEvaluation as Kn, BoundaryRequest as Kr, verifiedLinearCommitReadback as Kt, ProofManifest as L, confirmRebind as Li, HOST_COHORTS as Ln, captureItem as Lr, GitTargetIdentity as Lt, renderRecoveryPacket as M, PackageRow as Mi, EXPECTED_HOST_PACKAGES as Mn, RejectedBinding as Mr, GitCommandRejected as Mt, ALPHA3_HOST_PACKAGES as N, BoundedSource as Ni, ExecutableIdentity as Nn, certifyCheckpoint as Nr, GitEffectExecution as Nt, RecoveryOptions as O, sha256 as Oa, TargetValue as Oi, ALPHA2_HOST_PACKAGES as On, ParsedConfirmation as Or, GitAdapterAction as Ot, PROOF_KINDS as P, ProposeOutcome as Pi, ExecutableIdentityBinding as Pn, CaptureScope as Pr, GitEffectRunner as Pt, isVerifyingCapability as Q, isOpenObligation as Qi, bindExecutableIdentity as Qn, qualifyBoundary as Qr, isRunExecutable as Qt, ProofObligation as R, proposeRebind as Ri, HostAuditProvenance as Rn, classifyClause as Rr, LinearCommitReadback as Rt, snapshotSessionEvents as S, validateActionTarget as Sa, GuardProjection as Si, PROTOCOL_V4_NOTICE as Sn, segmentAuthorityBlocks as Sr, readActiveHostGraph as St, RC1_HOST_PACKAGES as T, normalizeClause as Ta, TargetCaptureReasonCode as Ti, ACTIVE_HOST_COHORT_IDS as Tn, classifyTaskIntent as Tr, verifyComposedHostLockDump as Tt, createProofManifest as U, replayRebindResult as Ui, HostCohortSelection as Un, segmentClauses as Ur, gitCommandMatchesTarget as Ut, bindProofToProjection as V, rebindAttemptKey as Vi, HostCapabilityRequest as Vn, extractOperation as Vr, createGitPrestateEnvelope as Vt, proofDigest as W, AuthorityDisposition as Wi, HostCohortSelectionReason as Wn, BoundaryEffectuation as Wr, parseGitCommandManifest as Wt, evidenceCoverage as X, interpretMessage as Xi, HostToolSurface as Xn, effectuateBoundary as Xr, ShellParseStatus as Xt, bindingSatisfies as Y, interpretClause as Yi, HostProfileKind as Yn, availableBoundaryQualifications as Yr, ParsedShell as Yt, evidenceMatchesItem as Z, isExecutableItem as Zi, LEGACY_HOST_COHORTS as Zn, isCurrentAcceptedBoundary as Zr, canonicalArgvFromCommand as Zt, progressFingerprint as _, requestedTargetAuthorizesMutation as _a, GuardIntegrity as _i, evidenceAvailabilityReason as _n, currentContractDigest as _r, hostLockRowsFromComposedDump as _t, NO_PROGRESS_RECORD_PREFIX as a, ACTION_MANIFEST_VERSION as aa, DeriveScope as ai, ToolSubject as an, selectHostCohort as ar, FIRST_STEP_GUIDANCE as at, SessionApiError as b, semanticActionFromText as ba, GuardItemStatus as bi, CAPTURE_V042_NOTICE as bn, AuthorityKind as br, packageRowsFromActiveGraph as bt, classifyCompletionClaim as c, CERTIFICATE_VERSION as ca, EvidenceOutcome as ci, extractToolSubject as cn, LATEST_SUPPORTED_HOST_VERSION as cr, LifecyclePhase as ct, decisionBoundaryKey as d, STOP_PROTOCOL_VERSION as da, ExpectedTransition as di, CertificationSupport as dn, SUPPORTED_HOST_RANGE as dr, previewFirstStepInjection as dt, maskCodeSpans as ea, BoundaryDisposition as ei, parseShellCommand as en, evaluateExternalWaitCapability as er, CommandSurfaceManifest as et, isRootPauseRequest as f, SUPPORTED_EVIDENCE_ADAPTERS as fa, ExternalOperation as fi, DiagnosisNextAction as fn, SUPPORTED_HOST_VERSIONS as fr, ActiveProfileHostLock as ft, observeAssistantOutcome as g, isStatefulAction as ga, GuardEvidence as gi, deriveItemDiagnosis as gn, satisfiesSupportedHostRange as gr, hostLockContextFromComposedDump as gt, latestRootInstruction as h, actionCompatible as ha, GuardCheckpoint as hi, UnifiedItemDiagnosis as hn, parseHostVersion as hr, combineHostPolicy as ht, CompletionDisposition as i, ACTION_MANIFEST as ia, DeriveResult as ii, ToolResultInput as in, hostVersionFromPackages as ir, ClaimedMessage as it, recoveryDigest as j, createProjection as ji, DEFAULT_HOST_LOCK as jn, CheckpointResult as jr, GitCommandParseResult as jt, closingHint as k, VerificationContract as ki, AuditedExecutable as kn, isFrozenV042RebindResponse as kr, GitCommandAccepted as kt, decideTurnBoundary as l, SEMANTIC_ACTIONS as la, EvidenceParseStatus as li, isDeterministicCheck as ln, MIN_SUPPORTED_HOST_VERSION as lr, claimedBatchHasRealRootInput as lt, latestAssistantText as m, StatefulAction as ma, GuardBoundary as mi, TaskKind as mn, evaluateMinimumHostVersion as mr, TargetHostGraph as mt, AssistantOutcomeObservation as n, semanticActionOfScope as na, DeferAuthorization as ni, hasCurrentCertificate as nn, evaluateHostLock as nr, OperationVerbEntry as nt, NO_PROGRESS_TURNS_BEFORE_STOP as o, ActionManifest as oa, DerivedEnvelope as oi, evidenceFromPersistedToolResult as on, HostVersionDecision as or, FirstStepInjection as ot, isWholeTaskCompletionClaim as p, SemanticAction as pa, GoalRef as pi, Repairability as pn, compareHostVersions as pr, HostProfileError as pt, validateProofManifest as q, InterpretOptions as qi, HostLockStatus as qn, GoalActivationState as qr, CanonicalArgv as qt, CONTROL_RECORD_PREFIX as r, statefulActionsOfScope as ra, DeriveConfig as ri, ToolCallInput as rn, evaluateToolSurfaceCapability as rr, validateManifest as rt, TurnStoppingDecision as s, ActionSpec as sa, EvidenceBinding as si, extractTextContent as sn, HostVersionStatus as sr, FirstStepPreviewInput as st, supersedeItem as t, namedActions as ta, BoundaryQualificationKind as ti, goalCompletionDenial as tn, evaluateHostCapability as tr, ManifestIssue as tt, decideTurnStopping as u, STATEFUL_ACTIONS as ua, EvidenceRole as ui, withDurability as un, ParsedHostVersion as ur, lifecyclePhase as ut, SESSION_API_UNSUPPORTED as v, requestedTargetMatchesResolved as va, GuardItem as vi, itemDiagnosis as vn, AuthorityBlock as vr, injectActiveProfileHostLock as vt, RC015_HOST_PACKAGES as w, digestStrings as wa, PersistenceAuthorization as wi, ACTIVE_HOST_COHORT_ID as wn, UserInteractionKind as wr, resolveInstalledHostLock as wt, V3SessionLike as x, validateActionManifest as xa, GuardOperation as xi, PROTOCOL_V3_NOTICE as xn, authorityCaptureCounts as xr, packageRowsFromPnpmLock as xt, SESSION_EVENT_ENVELOPE_INVALID as y, semanticActionFromCommand as ya, GuardItemKind as yi, relevantEvidence as yn, AuthorityBlockKind as yr, inspectTargetHostGraph as yt, ProofSurface as z, proposeRebindOutcome as zi, HostCapabilityEvaluation as zn, extractArtifactPaths as zr, commitIndexSnapshotDigest as zt };
|