dsh-openwrite 0.2.27 → 0.2.33

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.
Files changed (130) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +55 -6
  3. package/THIRD_PARTY_NOTICES.md +4 -3
  4. package/companions.mjs +508 -0
  5. package/cordis.patch.yml +0 -2
  6. package/docs/CLOSED_ISSUE_FOLLOWUPS.md +5 -3
  7. package/docs/COMPANION_PLUGINS.md +142 -0
  8. package/docs/CONTEXT_SLOTS.md +60 -0
  9. package/docs/COST_MEASUREMENT.md +2 -2
  10. package/docs/DEVELOPMENT.md +6 -11
  11. package/docs/DSH_STORE.md +14 -2
  12. package/docs/EDITOR_SAFETY_REPAIRS.md +17 -0
  13. package/docs/INSTALL.md +112 -4
  14. package/docs/ISSUES_121_123.md +97 -0
  15. package/docs/ISSUES_140_142.md +58 -0
  16. package/docs/ISSUES_149_150_151.md +77 -0
  17. package/docs/ISSUES_98_100.md +2 -0
  18. package/docs/ISSUE_123_FOLLOWUP.md +55 -0
  19. package/docs/ISSUE_146_REVIEW_EVIDENCE.md +53 -0
  20. package/docs/LEARNING.md +1 -1
  21. package/docs/MOBILE_READINESS.md +62 -0
  22. package/docs/PLUGIN_MAINTENANCE.md +1 -3
  23. package/docs/RELEASE_ACCEPTANCE.md +90 -3
  24. package/docs/REVIEW_ROUND_22.md +67 -0
  25. package/docs/REVIEW_ROUND_23.md +48 -0
  26. package/docs/REVIEW_ROUND_25.md +51 -0
  27. package/docs/SELECTION_UPGRADE_REPAIRS.md +16 -0
  28. package/docs/TOOLS.md +933 -0
  29. package/docs/WORKFLOWS.md +5 -5
  30. package/package.json +18 -21
  31. package/packages/openwrite-bridge/lib/client.d.ts +0 -1
  32. package/packages/openwrite-bridge/lib/client.js +90 -9
  33. package/packages/openwrite-bridge/lib/contracts-generated.js +2 -1
  34. package/packages/openwrite-bridge/lib/dog-delivery.d.ts +1 -0
  35. package/packages/openwrite-bridge/lib/dog-delivery.js +10 -4
  36. package/packages/openwrite-bridge/lib/dog-review.js +15 -3
  37. package/packages/openwrite-bridge/lib/domain.d.ts +27 -0
  38. package/packages/openwrite-bridge/lib/domain.js +250 -29
  39. package/packages/openwrite-bridge/lib/host-llm.d.ts +188 -0
  40. package/packages/openwrite-bridge/lib/host-llm.js +657 -0
  41. package/packages/openwrite-bridge/lib/host-web.d.ts +61 -0
  42. package/packages/openwrite-bridge/lib/host-web.js +166 -0
  43. package/packages/openwrite-bridge/lib/index.d.ts +4 -0
  44. package/packages/openwrite-bridge/lib/index.js +150 -6
  45. package/packages/openwrite-bridge/lib/managed-runtime.d.ts +47 -2
  46. package/packages/openwrite-bridge/lib/managed-runtime.js +179 -35
  47. package/packages/openwrite-bridge/lib/tool-policy.js +39 -12
  48. package/packages/openwrite-bridge/lib/tools.js +1238 -1219
  49. package/packages/openwrite-bridge/package.json +7 -5
  50. package/packages/studio-panel/lib/client.js +116667 -114773
  51. package/packages/studio-panel/lib/client.js.map +1 -1
  52. package/packages/studio-panel/lib/types/client/LaunchOpenWrite.d.ts +10 -0
  53. package/packages/studio-panel/lib/types/client/ModelView.d.ts +28 -4
  54. package/packages/studio-panel/lib/types/client/OpenWriteSettings.d.ts +64 -0
  55. package/packages/studio-panel/lib/types/client/SceneWorkbench.d.ts +2 -0
  56. package/packages/studio-panel/lib/types/client/SearchSettings.d.ts +2 -0
  57. package/packages/studio-panel/lib/types/client/SerialWritingView.d.ts +2 -1
  58. package/packages/studio-panel/lib/types/client/TurnMutationSummary.d.ts +2 -0
  59. package/packages/studio-panel/lib/types/client/VditorBody.d.ts +8 -2
  60. package/packages/studio-panel/lib/types/client/api.d.ts +41 -2
  61. package/packages/studio-panel/lib/types/client/browser-download.d.ts +4 -0
  62. package/packages/studio-panel/lib/types/client/companions.d.ts +46 -0
  63. package/packages/studio-panel/lib/types/client/dto.d.ts +22 -0
  64. package/packages/studio-panel/lib/types/client/locales.d.ts +1 -1
  65. package/packages/studio-panel/lib/types/client/manuscript-annotations.d.ts +2 -1
  66. package/packages/studio-panel/lib/types/client/manuscript-overlay.d.ts +2 -1
  67. package/packages/studio-panel/lib/types/client/manuscript-selection.d.ts +18 -5
  68. package/packages/studio-panel/lib/types/client/selection-coordinates.d.ts +15 -0
  69. package/packages/studio-panel/lib/types/client/workspace-chrome.d.ts +41 -0
  70. package/packages/studio-panel/package.json +5 -3
  71. package/plugin.mjs +159 -20
  72. package/preset-definition.mjs +144 -4
  73. package/presets/openwrite/agent.cordis.yml +7 -9
  74. package/presets/openwrite/ops-integration.mjs +28 -0
  75. package/presets/openwrite/preset.yml +2 -1
  76. package/presets/openwrite/skills/canon/SKILL.md +3 -3
  77. package/presets/openwrite/skills/delivery-artifact-query/SKILL.md +41 -0
  78. package/presets/openwrite/skills/dialoguequality/SKILL.md +16 -17
  79. package/presets/openwrite/skills/dog-delivery-verification/SKILL.md +113 -0
  80. package/presets/openwrite/skills/export-book/SKILL.md +3 -3
  81. package/presets/openwrite/skills/foreshadow/SKILL.md +1 -1
  82. package/presets/openwrite/skills/foreshadowing-system/SKILL.md +16 -25
  83. package/presets/openwrite/skills/import-artifact-query/SKILL.md +30 -0
  84. package/presets/openwrite/skills/learn/SKILL.md +3 -3
  85. package/presets/openwrite/skills/novel-creator/SKILL.md +10 -10
  86. package/presets/openwrite/skills/novel-reviewer/SKILL.md +11 -11
  87. package/presets/openwrite/skills/progress/SKILL.md +1 -1
  88. package/presets/openwrite/skills/review-artifact-query/SKILL.md +41 -0
  89. package/presets/openwrite/skills/review-chapter/SKILL.md +2 -2
  90. package/presets/openwrite/skills/revise-span/SKILL.md +5 -5
  91. package/presets/openwrite/skills/style-system/SKILL.md +13 -6
  92. package/presets/openwrite/skills/truth-validation/SKILL.md +9 -12
  93. package/presets/openwrite/skills/workflow-manager/SKILL.md +13 -13
  94. package/presets/openwrite/skills/world-query/SKILL.md +16 -11
  95. package/presets/openwrite/skills/write-next/SKILL.md +1 -1
  96. package/release/{openwrite-5.8.16-py3-none-any.whl → openwrite-5.8.30-py3-none-any.whl} +0 -0
  97. package/release/runtime-manifest.json +4 -12
  98. package/release/source.json +21 -21
  99. package/release/wheels/licenses/OPENSSL-3.6.3-LICENSE.txt +225 -0
  100. package/scripts/maintenance.mjs +67 -7
  101. package/scripts/plugin-doctor.mjs +179 -0
  102. package/scripts/prepare.mjs +11 -2
  103. package/scripts/safe-upgrade.mjs +141 -13
  104. package/dog-tools.mjs +0 -11
  105. package/presets/openwrite/skills/dog-delivery-query/SKILL.md +0 -42
  106. package/presets/openwrite/skills/dog-import-query/SKILL.md +0 -29
  107. package/presets/openwrite/skills/dog-review-query/SKILL.md +0 -42
  108. package/scripts/dog/delivery-stage.js +0 -32
  109. package/scripts/dog/import-chapter.js +0 -20
  110. package/scripts/dog/import-record.js +0 -35
  111. package/scripts/dog/review-dimension.js +0 -41
  112. package/scripts/dog/review-record.js +0 -42
  113. package/vendor/dsh-dog/LICENSE +0 -29
  114. package/vendor/dsh-dog/README.md +0 -114
  115. package/vendor/dsh-dog/UPSTREAM.md +0 -30
  116. package/vendor/dsh-dog/cordis.patch.yml +0 -14
  117. package/vendor/dsh-dog/lib/client.js +0 -2960
  118. package/vendor/dsh-dog/lib/client.js.map +0 -1
  119. package/vendor/dsh-dog/lib/core-BAlgZpLq.js +0 -2074
  120. package/vendor/dsh-dog/lib/core-BiEBMLz3.d.ts +0 -495
  121. package/vendor/dsh-dog/lib/core.d.ts +0 -2
  122. package/vendor/dsh-dog/lib/core.js +0 -2
  123. package/vendor/dsh-dog/lib/index.d.ts +0 -143
  124. package/vendor/dsh-dog/lib/index.js +0 -1279
  125. package/vendor/dsh-dog/package.json +0 -110
  126. package/vendor/dsh-dog/schemas/schema-0.2/graph.schema.json +0 -139
  127. package/vendor/dsh-dog/schemas/schema-0.2/report.schema.json +0 -87
  128. package/vendor/dsh-dog/schemas/schema-0.2/run.schema.json +0 -259
  129. package/vendor/dsh-dog/schemas/schema-0.2/runtime-event.schema.json +0 -105
  130. package/vendor/dsh-dog/schemas/schema-0.2/verification.schema.json +0 -40
@@ -1,495 +0,0 @@
1
- import { ValidateFunction } from "ajv/dist/2020.js";
2
- import { Agent } from "@deepseek-ai/dsh-agent";
3
- //#region src/model.d.ts
4
- /** Core JSON-compatible types for the DoG v0.9 protocol. */
5
- declare const DOG_SCHEMA_VERSION: "0.9";
6
- type JsonPrimitive = string | number | boolean | null;
7
- type JsonValue = JsonPrimitive | JsonValue[] | {
8
- [key: string]: JsonValue;
9
- };
10
- type GoalId = string;
11
- type ConstraintKind = 'hard' | 'soft';
12
- type GoalKind = 'leaf' | 'composite';
13
- type FailurePolicy = 'fatal' | 'tolerable' | 'degrade';
14
- type GoalState = 'pending' | 'running' | 'success' | 'failure' | 'blocked' | 'needs_human' | 'cancelled' | 'invalidated' | 'partial' | 'inherited';
15
- interface RefExpr {
16
- readonly op: 'ref';
17
- readonly id: GoalId;
18
- }
19
- interface AllExpr {
20
- readonly op: 'all';
21
- readonly items: readonly BoolExpr[];
22
- }
23
- interface AnyExpr {
24
- readonly op: 'any';
25
- readonly items: readonly BoolExpr[];
26
- }
27
- interface NotExpr {
28
- readonly op: 'not';
29
- readonly item: BoolExpr;
30
- }
31
- interface AtLeastExpr {
32
- readonly op: 'atLeast';
33
- readonly count: number;
34
- readonly items: readonly BoolExpr[];
35
- }
36
- type BoolExpr = RefExpr | AllExpr | AnyExpr | NotExpr | AtLeastExpr;
37
- /** One of exactly two judgment kernels: a script, or a natural-language instruction. */
38
- type VerifierShape = {
39
- readonly mode: 'programmatic';
40
- readonly script: string;
41
- } | {
42
- readonly mode: 'agentic';
43
- readonly instruction: string;
44
- };
45
- interface GoalNodeInput {
46
- readonly kind: GoalKind;
47
- readonly title: string;
48
- readonly constraint: ConstraintKind;
49
- /** Single file path or a directory/collection (engine packs it into .tar). */
50
- readonly target: string;
51
- /** Leaf: required. Composite: optional whole-object assertion (runs after subtree settles). */
52
- readonly verifier?: VerifierShape;
53
- /** Composite only: boolean combination of children. */
54
- readonly completion?: BoolExpr;
55
- }
56
- interface ContainsEdge {
57
- readonly parent: GoalId;
58
- readonly child: GoalId;
59
- readonly required: boolean;
60
- readonly failure: FailurePolicy;
61
- readonly degradeTo?: GoalId;
62
- }
63
- interface DependencyEdge {
64
- readonly source: GoalId;
65
- readonly target: GoalId;
66
- readonly data?: readonly string[];
67
- }
68
- interface DogGraphInput {
69
- readonly schemaVersion: typeof DOG_SCHEMA_VERSION;
70
- readonly id: string;
71
- readonly root: GoalId;
72
- readonly nodes: Record<GoalId, GoalNodeInput>;
73
- readonly contains: readonly ContainsEdge[];
74
- readonly dependsOn: readonly DependencyEdge[];
75
- }
76
- interface DogConfig {
77
- readonly storageDirectory: string;
78
- /** Sandbox/root for captured inputs: verifiers' objects come from this tree. */
79
- readonly workspaceRoot: string;
80
- /** Host-registered script library directory (programmatic kernels). */
81
- readonly scriptsDirectory: string;
82
- readonly maxGraphNodes: number;
83
- readonly maxExpressionNodes: number;
84
- readonly maxExpressionDepth: number;
85
- readonly maxSandboxBytes: number;
86
- readonly allowPartialRoot: boolean;
87
- readonly maxConcurrentVerifications: number;
88
- readonly revalidateThreshold: number;
89
- readonly gmDigestAlgo: string;
90
- }
91
- interface GraphLimits {
92
- readonly maxGraphNodes: number;
93
- readonly maxExpressionNodes: number;
94
- readonly maxExpressionDepth: number;
95
- }
96
- /** One captured object (file, or packed .tar for a collection). */
97
- interface CapturedInput {
98
- readonly path: string;
99
- readonly digest: string;
100
- readonly exists: boolean;
101
- readonly byteLength: number;
102
- readonly sha256: string;
103
- /** True when the capture is a .tar of a directory/collection. */
104
- readonly packed?: boolean;
105
- }
106
- /** Deterministic or agentic: judgment identity double-anchors incremental reuse. */
107
- type JudgmentIdentity = {
108
- readonly mode: 'programmatic';
109
- readonly script: string;
110
- readonly scriptDigest: string;
111
- } | {
112
- readonly mode: 'agentic';
113
- readonly instructionHash: string;
114
- };
115
- interface AcceptancePlan {
116
- readonly goalId: GoalId;
117
- /** Which kernel judges this goal. */
118
- readonly verifier: VerifierShape;
119
- /** Identity of the judgment source; part of the inheritance anchor. */
120
- readonly judgment: JudgmentIdentity;
121
- readonly target: string;
122
- /** Captured object metadata (absent when target is missing/empty). */
123
- readonly input?: CapturedInput;
124
- readonly gmDigest?: string;
125
- }
126
- interface VerificationRecord {
127
- readonly schemaVersion: '0.1';
128
- readonly runId: string;
129
- readonly graphId: string;
130
- readonly graphDigest: string;
131
- readonly goalId: GoalId;
132
- readonly judgment: JudgmentIdentity;
133
- readonly gmDigest?: string;
134
- readonly passed: boolean | null;
135
- readonly evidence?: JsonValue;
136
- readonly at: string;
137
- }
138
- interface GoalRuntimeVerifier {
139
- readonly mode: 'programmatic' | 'agentic';
140
- }
141
- interface GoalRuntimeError {
142
- readonly kind: 'acceptance_plan_missing' | 'completion_expression_missing' | 'verification_error' | 'agentic_unavailable';
143
- readonly stage: 'scheduling' | 'verification' | 'composition';
144
- readonly message: string;
145
- }
146
- type GoalRuntimePhase = 'goal_started' | 'dependency_blocked' | 'grounding_extracted' | 'workspace_allocated' | 'verifier_started' | 'verifier_passed' | 'verifier_failed' | 'verifier_inconclusive' | 'composite_evaluated' | 'result_inherited' | 'verifier_released' | 'verifier_bind_failed' | 'structured_error' | 'goal_settled' | 'run_warning';
147
- interface GoalRuntimeEvent {
148
- readonly schemaVersion: '0.1';
149
- readonly runId: string;
150
- readonly goalId: GoalId;
151
- readonly phase: GoalRuntimePhase;
152
- readonly state?: GoalState;
153
- readonly at: string;
154
- readonly reason?: string;
155
- readonly verifier?: GoalRuntimeVerifier;
156
- readonly gmDigest?: string;
157
- readonly attempt?: number;
158
- readonly durationMs?: number;
159
- }
160
- type GoalAgentRole = 'orchestrator' | 'verifier' | 'reviewer';
161
- interface GoalAgentSessionRef {
162
- readonly sessionId: string;
163
- readonly parentSessionId?: string;
164
- readonly role: GoalAgentRole;
165
- readonly boundAt: string;
166
- }
167
- interface RunInvocationContext {
168
- readonly callId: string;
169
- readonly agentSessionId?: string;
170
- readonly parentSessionId?: string;
171
- readonly invokedAt: string;
172
- }
173
- interface GoalResult {
174
- readonly state: GoalState;
175
- readonly reason?: string;
176
- readonly verification?: VerificationRecord;
177
- readonly inheritedFrom?: string;
178
- readonly agentSessions?: readonly GoalAgentSessionRef[];
179
- }
180
- type RootTerminalState = 'success' | 'partial_success' | 'failure' | 'infeasible' | 'needs_replan' | 'cancelled';
181
- interface CompiledGraph {
182
- readonly input: DogGraphInput;
183
- readonly graphDigest: string;
184
- readonly acceptancePlans: Readonly<Record<GoalId, AcceptancePlan>>;
185
- }
186
- interface DogRun {
187
- readonly runId: string;
188
- readonly graphId: string;
189
- readonly graphDigest: string;
190
- /** Calling session's cwd; verifier workspaces are allocated under it. */
191
- readonly workspaceBaseDir?: string;
192
- readonly state: 'running' | 'completed' | 'cancelled' | 'failed';
193
- readonly rootState?: RootTerminalState;
194
- readonly invocation?: RunInvocationContext;
195
- readonly runtimeWarning?: string;
196
- readonly gmDigests: Readonly<Record<GoalId, string>>;
197
- readonly goals: Readonly<Record<GoalId, GoalResult>>;
198
- readonly createdAt: string;
199
- readonly updatedAt: string;
200
- }
201
- interface GoalRuntimeTrace {
202
- readonly schemaVersion: '0.1';
203
- readonly runId: string;
204
- readonly graphId: string;
205
- readonly graphDigest: string;
206
- readonly runState: DogRun['state'];
207
- readonly rootState?: RootTerminalState;
208
- readonly goalId: GoalId;
209
- readonly result: GoalResult;
210
- readonly invocation?: RunInvocationContext;
211
- readonly runtimeWarning?: string;
212
- readonly events: readonly GoalRuntimeEvent[];
213
- readonly truncated: boolean;
214
- }
215
- interface GraphValidationReport {
216
- readonly valid: boolean;
217
- readonly errors: readonly string[];
218
- readonly warnings: readonly string[];
219
- }
220
- interface CiGoalReport {
221
- readonly goalId: GoalId;
222
- readonly state: GoalState;
223
- readonly verifier?: GoalRuntimeVerifier;
224
- readonly evidence?: readonly Record<string, JsonValue>[];
225
- readonly defect?: string;
226
- readonly settledAt?: string;
227
- }
228
- interface CiReport {
229
- readonly runId: string;
230
- readonly graphId: string;
231
- readonly graphDigest?: string;
232
- readonly rootState: RootTerminalState | 'running' | 'cancelled';
233
- readonly goals: readonly CiGoalReport[];
234
- readonly revalidated?: readonly GoalId[];
235
- readonly inherited?: readonly {
236
- goalId: GoalId;
237
- fromRunId: string;
238
- state: 'inherited';
239
- }[];
240
- readonly warning?: string;
241
- readonly generatedAt: string;
242
- }
243
- declare function isJsonValue(value: unknown): value is JsonValue;
244
- //#endregion
245
- //#region src/schema.d.ts
246
- interface SchemaSet {
247
- readonly validateGraph: ValidateFunction;
248
- readonly validateRun: ValidateFunction;
249
- readonly validateVerification: ValidateFunction;
250
- readonly validateRuntimeEvent: ValidateFunction;
251
- readonly validateReport: ValidateFunction;
252
- }
253
- /** Load the five normative schemas from schemas/schema-0.2 (checked into the package root). */
254
- declare function loadSchemaSet(): Promise<SchemaSet>;
255
- //#endregion
256
- //#region src/storage.d.ts
257
- declare class DogRepository {
258
- readonly rootPath: string;
259
- private readonly runMutationTails;
260
- private readonly schema;
261
- constructor(rootPath: string, schema?: SchemaSet | undefined);
262
- /** Create the repository directory layout. */
263
- initialize(): Promise<void>;
264
- /** Persist one immutable compiled graph revision and its ID index. */
265
- saveGraph(compiled: CompiledGraph): Promise<void>;
266
- /** Load the latest graph revision for a graph ID. */
267
- loadGraph(graphId: string): Promise<CompiledGraph>;
268
- /** Enumerate immutable graph revisions. Pre-v0.2 records (no grounding/gmDigest contract) are skipped, not deleted. */
269
- listGraphs(): Promise<readonly CompiledGraph[]>;
270
- /** Persist a run snapshot. */
271
- saveRun(run: DogRun): Promise<void>;
272
- /** Atomically read, transform, and replace one run within this repository process. */
273
- updateRun(runId: string, update: (run: DogRun) => DogRun): Promise<DogRun>;
274
- private withRunMutation;
275
- /** Load one run snapshot, fail-closed against the run schema. */
276
- loadRun(runId: string): Promise<DogRun>;
277
- /**
278
- * Load the most recently updated non-running run for a graph ID
279
- * (revalidate_select input). Any terminal record may carry verification
280
- * settlements worth inheriting — including orphaned runs that a host restart
281
- * left running and that recovery later invalidated or cancelled.
282
- */
283
- loadLatestSettledRun(graphId: string): Promise<DogRun | undefined>;
284
- /** Enumerate persisted run snapshots, newest update first. Pre-v0.2 records are skipped. */
285
- listRuns(): Promise<readonly DogRun[]>;
286
- /**
287
- * Cancel every persisted run still in `running` state. Called at host boot
288
- * (before any engine instance exists), so runs from a killed/restarted host
289
- * surface as cancelled instead of frozen "running" forever. Their settled
290
- * leaves stay inheritable by the next run of the same graph.
291
- */
292
- markOrphanedRunningRuns(nowIso: string): Promise<number>;
293
- /** Append one verification record without rewriting prior records. */
294
- appendVerification(record: VerificationRecord): Promise<void>;
295
- /** Append diagnostic runtime context to the selected goal shard, separately from trusted verifier evidence. */
296
- appendRuntimeEvent(event: GoalRuntimeEvent): Promise<void>;
297
- /** Load one goal's validated event shard. A torn final line is ignored. */
298
- loadGoalRuntimeEvents(runId: string, goalId: string): Promise<readonly GoalRuntimeEvent[]>;
299
- /** Persist the verbatim verifier settlement text (survives workspace cleanup). */
300
- saveSettlement(runId: string, goalId: string, content: string): Promise<void>;
301
- /** Store captured input bytes and its metadata manifest under content identity. */
302
- putSandboxFile(input: CapturedInput, bytes: Uint8Array | undefined): Promise<void>;
303
- /** Read and re-hash a captured input named by a verification plan. */
304
- readCapturedFile(input: CapturedInput): Promise<Uint8Array>;
305
- /** InputReader contract: read one captured input. */
306
- read(input: CapturedInput): Promise<Uint8Array>;
307
- /** Copy a captured input into one run workspace (or resolve to the workspace dir). */
308
- copyCapturedInput(input: CapturedInput | undefined, workspacePath: string): Promise<string>;
309
- }
310
- //#endregion
311
- //#region src/verifiers.d.ts
312
- /** A verdict is a two-field minimum: the judgment and free-form evidence. */
313
- interface Verdict {
314
- readonly state: 'pass' | 'fail' | 'inconclusive';
315
- readonly evidence: JsonValue;
316
- readonly reason?: string;
317
- }
318
- interface IsolatedWorkspace {
319
- /** Absolute path of the mutually exclusive workspace directory. */
320
- readonly path: string;
321
- }
322
- interface VerifierExecutionEnv {
323
- readonly parent?: Agent | undefined;
324
- readonly signal?: AbortSignal;
325
- readonly runId?: string;
326
- readonly goalId?: string;
327
- }
328
- /** Programmatic kernel: runs a host-registered script with the captured object path. */
329
- type ProgrammaticRunner = (script: string, inputPath: string, env: VerifierExecutionEnv) => Promise<Verdict>;
330
- /** Agentic kernel: hands one natural-language instruction + the object to a worker agent. */
331
- type AgenticRunner = (instruction: string, workspace: IsolatedWorkspace, inputPath: string, env: VerifierExecutionEnv) => Promise<Verdict>;
332
- /** Result of one judgment, unified across both kernels. */
333
- interface Settlement {
334
- readonly state: 'pass' | 'fail' | 'inconclusive';
335
- readonly observation: Record<string, JsonValue>;
336
- readonly evidence?: JsonValue;
337
- }
338
- /**
339
- * Run one plan through the selected kernel. The engine holds none of the
340
- * judgment semantics: programmatic goes to a script, agentic to a worker agent
341
- * with only the instruction text — no parameter schema, no evidence format,
342
- * no tool allow-list.
343
- */
344
- declare function runPlan(plan: {
345
- readonly verifier: VerifierShape;
346
- readonly target: string;
347
- }, workspace: IsolatedWorkspace, inputPath: string, env: VerifierExecutionEnv, programmatic: ProgrammaticRunner | undefined, agentic: AgenticRunner | undefined): Promise<Settlement>;
348
- //#endregion
349
- //#region src/workspace.d.ts
350
- interface WorkspaceOptions {
351
- readonly baseDir?: string;
352
- }
353
- declare class WorkspaceManager {
354
- private readonly baseDir;
355
- private readonly pending;
356
- constructor(options?: WorkspaceOptions);
357
- /**
358
- * Allocate one mutually exclusive workspace directory.
359
- *
360
- * `baseDir` overrides the construction default: the engine passes the calling
361
- * session's cwd so the workspace lands inside the session workspace, which is
362
- * exactly the tree the verifier subagent's sandbox (workspace-write) permits.
363
- * Defaults to the manager's configured base dir when no override is given.
364
- */
365
- acquire(baseDir?: string): Promise<IsolatedWorkspace>;
366
- /** Release a workspace after verification completes; contents are discarded. */
367
- release(workspace: IsolatedWorkspace): Promise<void>;
368
- /** Wait for every in-flight release (host shutdown). */
369
- drain(): Promise<void>;
370
- /** Release a batch at once — used at run teardown, after every verifier settled. */
371
- releaseAll(workspaces: readonly IsolatedWorkspace[]): Promise<void>;
372
- }
373
- //#endregion
374
- //#region src/core.d.ts
375
- interface DogEngineOptions {
376
- readonly config: DogConfig;
377
- readonly repository: DogRepository;
378
- /** Runtime knob source: read once per run, so host settings changes apply without a restart. */
379
- readonly liveConfig?: () => Partial<Pick<DogConfig, 'maxConcurrentVerifications'>>;
380
- /** Host hook fired after a run is cancelled — used to interrupt its verifier subagents. */
381
- readonly onRunCancelled?: (runId: string) => void;
382
- /** Programmatic kernel (script executor) — host wiring; may be installed later. */
383
- readonly programmatic?: ProgrammaticRunner;
384
- /** Agentic kernel (worker-agent launcher) — host wiring; may be installed later. */
385
- readonly agentic?: AgenticRunner;
386
- readonly workspaces?: WorkspaceManager;
387
- readonly now?: () => Date;
388
- readonly nextRunId?: () => string;
389
- readonly heartbeatMs?: number;
390
- /** Resolve a live Agent by its session id (host wiring: AgentRegistry.get). */
391
- readonly resolveLivingAgent?: (sessionId: string) => Agent | undefined;
392
- }
393
- interface DogRunOptions {
394
- readonly invocation?: {
395
- readonly callId: string;
396
- readonly agentSessionId?: string;
397
- readonly parentSessionId?: string;
398
- };
399
- readonly signal?: AbortSignal;
400
- readonly agent?: Agent | undefined;
401
- }
402
- interface DogBindAgentOptions {
403
- readonly runId: string;
404
- readonly goalId: string;
405
- readonly role: GoalAgentRole;
406
- readonly sessionId: string;
407
- readonly parentSessionId?: string;
408
- }
409
- interface DogAgentDelegationOptions {
410
- readonly runId: string;
411
- readonly goalId: string;
412
- readonly parentSessionId: string;
413
- }
414
- /** Agentic CI engine used by the DSH tools and tests. */
415
- declare class DogEngine {
416
- private readonly config;
417
- private readonly repository;
418
- private readonly liveConfig;
419
- private readonly onRunCancelled;
420
- private readonly runControllers;
421
- private programmatic;
422
- private agentic;
423
- private readonly workspaces;
424
- private readonly now;
425
- private readonly nextRunId;
426
- private readonly heartbeatMs;
427
- private readonly workspaceRoot;
428
- private readonly backgroundTasks;
429
- private readonly runStops;
430
- private readonly workspaceBaseDirs;
431
- private readonly resolveLivingAgent;
432
- /** Install the two judgment kernels (host wiring; may arrive later than construction). */
433
- setKernels(programmatic: ProgrammaticRunner | undefined, agentic: AgenticRunner | undefined): void;
434
- constructor(options: DogEngineOptions);
435
- validate(value: unknown): GraphValidationReport;
436
- /** Compile and persist one graph revision against the captured input files. */
437
- create(value: unknown, options?: {
438
- readonly captureBaseDir?: string;
439
- }): Promise<CompiledGraph>;
440
- /** Synchronous run: prepare + execute to completion (tests, CLI). */
441
- run(graphId: string, options?: DogRunOptions): Promise<DogRun>;
442
- /** Asynchronous run: returns after the initial record is persisted; verification continues in background. */
443
- startRun(graphId: string, options?: DogRunOptions): Promise<DogRun>;
444
- /** Execute a prepared run on the engine's process-level loop, independent of any caller session. */
445
- private enqueueBackground;
446
- /** Stop this engine's owned runs before awaiting their settlement. */
447
- dispose(): Promise<void>;
448
- /** Wait for every in-flight background run (host shutdown). */
449
- drainBackground(): Promise<void>;
450
- /** Persist a bounded run-level warning (verifier binding/release diagnostics). */
451
- annotateRun(runId: string, warning: string): Promise<void>;
452
- /** Append a verifier worker lifecycle event (verifier_released / verifier_bind_failed). */
453
- recordVerifierLifecycle(runId: string, goalId: string, phase: 'verifier_released' | 'verifier_bind_failed', _sessionId: string, reason?: string): Promise<void>;
454
- /** Cancel one run and stop its heartbeat; partial records remain inspectable. */
455
- cancelRun(runId: string, reason: string): Promise<DogRun>;
456
- /**
457
- * Block on one run's settlement. Keeps the calling agent/session alive in
458
- * the process while verifier workers (continuable children of this process)
459
- * run to completion — the deterministic automation gate after dog_run. A
460
- * one-shot process that returns before this settles kills the workers it
461
- * spawned, so automation MUST wait through a dog_wait/monitor step.
462
- * @param options - bounded wait: default 15 minutes; abort (tool cancel)
463
- * and timeout both return the current run with a non-terminal state.
464
- */
465
- waitRun(runId: string, options?: {
466
- readonly timeoutMs?: number;
467
- readonly pollMs?: number;
468
- readonly signal?: AbortSignal;
469
- }): Promise<DogRun>;
470
- private prepareRun;
471
- /** The Agentic CI cycle: revalidate-select, parallel verification, recompute. */
472
- private executeRun;
473
- /**
474
- * Merge in-memory goal progress with host-agent-session bindings recorded
475
- * concurrently inside an atomic read-modify-write: bindAgent (and future
476
- * host writers) update the same row under updateRun's serialization, so a
477
- * progress save can never overwrite a binding it never saw.
478
- */
479
- private mergeGoalsKeepingHostSessions;
480
- /** Mark any prior run of the same graph that never reached a terminal state, so a host restart cannot leave zombies. */
481
- private supersedePriorRunningRuns;
482
- status(runId: string): Promise<DogRun>;
483
- assertAgentCanDelegate(options: DogAgentDelegationOptions): Promise<void>;
484
- bindAgent(options: DogBindAgentOptions, policy?: {
485
- readonly allowUnrooted?: boolean;
486
- }): Promise<{
487
- readonly run: DogRun;
488
- readonly agent: GoalAgentSessionRef;
489
- }>;
490
- private parse;
491
- private validateWorkspaceRefs;
492
- }
493
- declare function resolveScriptPath(scriptsDirectory: string, script: string): string;
494
- //#endregion
495
- export { VerifierShape as $, FailurePolicy as A, GoalRuntimeTrace as B, ConstraintKind as C, DogConfig as D, DependencyEdge as E, GoalNodeInput as F, JsonPrimitive as G, GoalState as H, GoalResult as I, NotExpr as J, JsonValue as K, GoalRuntimeError as L, GoalAgentSessionRef as M, GoalId as N, DogGraphInput as O, GoalKind as P, VerificationRecord as Q, GoalRuntimeEvent as R, CompiledGraph as S, DOG_SCHEMA_VERSION as T, GraphLimits as U, GoalRuntimeVerifier as V, GraphValidationReport as W, RootTerminalState as X, RefExpr as Y, RunInvocationContext as Z, AtLeastExpr as _, DogRunOptions as a, CiGoalReport as b, AgenticRunner as c, runPlan as d, isJsonValue as et, DogRepository as f, AnyExpr as g, AllExpr as h, DogEngineOptions as i, GoalAgentRole as j, DogRun as k, ProgrammaticRunner as l, AcceptancePlan as m, DogBindAgentOptions as n, resolveScriptPath as o, loadSchemaSet as p, JudgmentIdentity as q, DogEngine as r, WorkspaceManager as s, DogAgentDelegationOptions as t, Verdict as u, BoolExpr as v, ContainsEdge as w, CiReport as x, CapturedInput as y, GoalRuntimePhase as z };
@@ -1,2 +0,0 @@
1
- import { a as DogRunOptions, i as DogEngineOptions, n as DogBindAgentOptions, o as resolveScriptPath, r as DogEngine, t as DogAgentDelegationOptions } from "./core-BiEBMLz3.js";
2
- export { DogAgentDelegationOptions, DogBindAgentOptions, DogEngine, DogEngineOptions, DogRunOptions, resolveScriptPath };
@@ -1,2 +0,0 @@
1
- import { n as resolveScriptPath, t as DogEngine } from "./core-BAlgZpLq.js";
2
- export { DogEngine, resolveScriptPath };
@@ -1,143 +0,0 @@
1
- import { $ as VerifierShape, A as FailurePolicy, B as GoalRuntimeTrace, C as ConstraintKind, D as DogConfig, E as DependencyEdge, F as GoalNodeInput, G as JsonPrimitive, H as GoalState, I as GoalResult, J as NotExpr, K as JsonValue, L as GoalRuntimeError, M as GoalAgentSessionRef, N as GoalId, O as DogGraphInput, P as GoalKind, Q as VerificationRecord, R as GoalRuntimeEvent, S as CompiledGraph, T as DOG_SCHEMA_VERSION, U as GraphLimits, V as GoalRuntimeVerifier, W as GraphValidationReport, X as RootTerminalState, Y as RefExpr, Z as RunInvocationContext, _ as AtLeastExpr, b as CiGoalReport, c as AgenticRunner, d as runPlan, et as isJsonValue, f as DogRepository, g as AnyExpr, h as AllExpr, j as GoalAgentRole, k as DogRun, l as ProgrammaticRunner, m as AcceptancePlan, p as loadSchemaSet, q as JudgmentIdentity, r as DogEngine, s as WorkspaceManager, u as Verdict, v as BoolExpr, w as ContainsEdge, x as CiReport, y as CapturedInput, z as GoalRuntimePhase } from "./core-BiEBMLz3.js";
2
- import z from "@deepseek-ai/schemastery";
3
- import { Agent } from "@deepseek-ai/dsh-agent";
4
- import { ToolDefinition } from "@deepseek-ai/dsh-tools";
5
- import { Context } from "@deepseek-ai/cordis";
6
- import { ConnectionRpcHandler } from "@deepseek-ai/dsh-client-connection";
7
- import { SessionId } from "@deepseek-ai/dsh-session";
8
- import { JobRegistry } from "@deepseek-ai/dsh-jobs";
9
- //#region src/debug-contract.d.ts
10
- /**
11
- * Dedicated debugger channel. It is served by this plugin directly on the Web
12
- * carrier (see serveDogDebugRpc): Connection's generic channel registry mounts
13
- * its HTTP route through the Connection plugin's own context, which only sees
14
- * `webServer` when a bundle patch injects it into the shared connection row —
15
- * and per-key patch semantics make any such patch clobber other bundles
16
- * (OpenWrite issue #81), while the shared `/api` channel already belongs to
17
- * the host's Typert gateway. The wire envelope mirrors Connection's, so the
18
- * browser side keeps using its stock `connection.rpc.call`.
19
- */
20
- declare const DOG_DEBUG_RPC_CHANNEL = "/dog-rpc";
21
- declare const DOG_DEBUG_SNAPSHOT_ENDPOINT = "snapshot";
22
- declare const DOG_RUNTIME_TRACE_ENDPOINT = "goal-runtime";
23
- /** One immutable graph revision and every run bound to that exact digest. */
24
- interface DogDebugGraphRevision {
25
- readonly graph: CompiledGraph;
26
- readonly current: boolean;
27
- readonly runs: readonly DogRun[];
28
- }
29
- /** Complete, point-in-time view exposed to the debugger. */
30
- interface DogDebugSnapshot {
31
- readonly schemaVersion: '0.1';
32
- readonly generatedAt: string;
33
- readonly graphs: readonly DogDebugGraphRevision[];
34
- }
35
- //#endregion
36
- //#region src/debug.d.ts
37
- /** Build a digest-safe view: an old run is never shown against a newer graph revision. */
38
- declare function buildDogDebugSnapshot(repository: DogRepository, now?: () => Date): Promise<DogDebugSnapshot>;
39
- /** Build one bounded node trace without loading any DSH transcript or artifact bytes. */
40
- declare function buildGoalRuntimeTrace(repository: DogRepository, runId: string, goalId: string): Promise<GoalRuntimeTrace>;
41
- /** Register this handler on the trusted-host Connection channel, never as an unauthenticated raw HTTP route. */
42
- declare function createDogDebugRpcHandler(repository: DogRepository): ConnectionRpcHandler;
43
- //#endregion
44
- //#region src/graph.d.ts
45
- /** Structured validation failure at the model-to-core boundary. */
46
- declare class DogValidationError extends Error {
47
- readonly errors: readonly string[];
48
- constructor(errors: readonly string[]);
49
- }
50
- /** Parse an untrusted graph value into a normalized, acyclic DoG graph. */
51
- declare function parseGraph(value: unknown, limits: GraphLimits): DogGraphInput;
52
- //#endregion
53
- //#region src/logic.d.ts
54
- type TruthValue = true | false | 'unknown';
55
- interface ExpressionLimits {
56
- readonly maxNodes: number;
57
- readonly maxDepth: number;
58
- }
59
- interface ParsedExpression {
60
- readonly expression?: BoolExpr;
61
- readonly errors: readonly string[];
62
- }
63
- /**
64
- * Parse and type-check the only expression language accepted by DoG.
65
- * @param value - untrusted JSON value from a graph draft.
66
- * @param allowedRefs - child IDs that the enclosing composite may reference.
67
- * @param limits - expression size limits.
68
- * @returns a typed AST or validation errors; never evaluates source text.
69
- */
70
- declare function parseBoolExpr(value: unknown, allowedRefs: ReadonlySet<string>, limits: ExpressionLimits): ParsedExpression;
71
- /**
72
- * Evaluate a typed AST against settled child truth values.
73
- * @param expression - validated DoG Boolean AST.
74
- * @param values - child success values; missing values are unresolved.
75
- * @returns three-valued result so pending work cannot be mistaken for failure.
76
- */
77
- declare function evaluateBoolExpr(expression: BoolExpr, values: ReadonlyMap<string, boolean | undefined>): TruthValue;
78
- //#endregion
79
- //#region src/tools.d.ts
80
- declare module '@deepseek-ai/dsh-jobs' {
81
- interface JobKindMap {
82
- dog: 'dog';
83
- }
84
- }
85
- interface DogAgentLauncher {
86
- launch(input: {
87
- readonly label: string;
88
- readonly prompt: string;
89
- readonly parent: Agent;
90
- readonly signal: AbortSignal;
91
- }): Promise<{
92
- readonly sessionId: SessionId;
93
- }>;
94
- interrupt?(sessionId: SessionId, parent: Agent): void | Promise<void>;
95
- }
96
- declare const DOG_VALIDATE_TOOL = "dog_validate";
97
- declare const DOG_CREATE_TOOL = "dog_create";
98
- declare const DOG_RUN_TOOL = "dog_run";
99
- declare const DOG_BIND_AGENT_TOOL = "dog_bind_agent";
100
- declare const DOG_DELEGATE_AGENT_TOOL = "dog_delegate_agent";
101
- declare const DOG_STATUS_TOOL = "dog_status";
102
- declare const DOG_WAIT_TOOL = "dog_wait";
103
- /** Build the complete DoG v0.1 tool surface around one engine instance. */
104
- declare function createDogTools(engine: () => DogEngine, hostJobs?: () => JobRegistry | undefined): readonly ToolDefinition[];
105
- /** Build the DoG-aware continuable Agent launcher once the host subagent service is available. */
106
- declare function createDogDelegateAgentTool(engine: () => DogEngine, launcher: DogAgentLauncher): ToolDefinition;
107
- //#endregion
108
- //#region src/index.d.ts
109
- /** Cordis plugin name. */
110
- declare const name = "dsh-dog";
111
- /** Required Harness services. */
112
- declare const inject: string[];
113
- declare module '@deepseek-ai/cordis' {
114
- interface Context {
115
- openwriteDog: {
116
- tools: ToolDefinition[];
117
- };
118
- }
119
- }
120
- /** Host-owned deployment configuration. */
121
- interface Config {
122
- storageDirectory: string;
123
- /** Verifier workspace root (WorkspaceManager.baseDir): verifiers only read files inside this tree. */
124
- workspaceRoot: string;
125
- /** Host-registered programmatic script library (relative to DSH_HOME, or absolute). */
126
- scriptsDirectory: string;
127
- maxGraphNodes: number;
128
- maxExpressionNodes: number;
129
- maxExpressionDepth: number;
130
- maxSandboxBytes: number;
131
- allowPartialRoot: boolean;
132
- maxConcurrentVerifications: number;
133
- revalidateThreshold: number;
134
- gmDigestAlgo: string;
135
- subagentProvider: string;
136
- subagentMaxDepth: number;
137
- }
138
- /** Loader-validated DoG deployment configuration. */
139
- declare const Config: z<Config>;
140
- /** Register all DoG tools as Cordis-owned effects so fiber disposal removes them. */
141
- declare function apply(ctx: Context, config: Config): Promise<void>;
142
- //#endregion
143
- export { type AcceptancePlan, type AgenticRunner, type AllExpr, type AnyExpr, type AtLeastExpr, type BoolExpr, type CapturedInput, type CiGoalReport, type CiReport, type CompiledGraph, Config, type ConstraintKind, type ContainsEdge, DOG_BIND_AGENT_TOOL, DOG_CREATE_TOOL, DOG_DEBUG_RPC_CHANNEL, DOG_DEBUG_SNAPSHOT_ENDPOINT, DOG_DELEGATE_AGENT_TOOL, DOG_RUNTIME_TRACE_ENDPOINT, DOG_RUN_TOOL, type DOG_SCHEMA_VERSION, DOG_STATUS_TOOL, DOG_VALIDATE_TOOL, DOG_WAIT_TOOL, type DependencyEdge, type DogConfig, type DogDebugGraphRevision, type DogDebugSnapshot, DogEngine, type DogGraphInput, type DogRun, DogValidationError, type FailurePolicy, type GoalAgentRole, type GoalAgentSessionRef, type GoalId, type GoalKind, type GoalNodeInput, type GoalResult, type GoalRuntimeError, type GoalRuntimeEvent, type GoalRuntimePhase, type GoalRuntimeTrace, type GoalRuntimeVerifier, type GoalState, type GraphLimits, type GraphValidationReport, type JsonPrimitive, type JsonValue, type JudgmentIdentity, type NotExpr, type ProgrammaticRunner, type RefExpr, type RootTerminalState, type RunInvocationContext, type Verdict, type VerificationRecord, type VerifierShape, WorkspaceManager, apply, buildDogDebugSnapshot, buildGoalRuntimeTrace, createDogDebugRpcHandler, createDogDelegateAgentTool, createDogTools, evaluateBoolExpr, inject, type isJsonValue, loadSchemaSet, name, parseBoolExpr, parseGraph, runPlan };