dsh-openwrite 0.2.8

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 (275) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +107 -0
  3. package/THIRD_PARTY_NOTICES.md +33 -0
  4. package/assets/logo-dark.svg +31 -0
  5. package/assets/logo-light.svg +31 -0
  6. package/cordis.patch.yml +11 -0
  7. package/docs/BENCHMARK_TASKS.md +54 -0
  8. package/docs/COST_MEASUREMENT.md +39 -0
  9. package/docs/DEVELOPMENT.md +65 -0
  10. package/docs/DSH_STORE.md +58 -0
  11. package/docs/FRAMEWORK_ADVANTAGES.md +288 -0
  12. package/docs/IMPROVEMENT_PLAN.md +252 -0
  13. package/docs/INSTALL.md +99 -0
  14. package/docs/LEARNING.md +68 -0
  15. package/docs/OPEN_SOURCE_NOVEL_AUDIT.md +191 -0
  16. package/docs/PLUGIN_MAINTENANCE.md +54 -0
  17. package/docs/PLUGIN_MAINTENANCE_RC7.md +157 -0
  18. package/docs/QA_20260908.md +103 -0
  19. package/docs/QA_20260909_BENCHMARK.md +24 -0
  20. package/docs/RELEASE_ACCEPTANCE.md +116 -0
  21. package/docs/REVIEW_DAG_FRAMEWORK.md +82 -0
  22. package/docs/TARGETED_NOVEL_PROJECT_REVIEW.md +167 -0
  23. package/docs/WORKFLOWS.md +74 -0
  24. package/docs/WORKSPACE_CONTEXT_CONTRACT.md +125 -0
  25. package/docs/WORKSPACE_INTEGRATION_GOAL.md +278 -0
  26. package/docs/research/autosave-race-repro.mjs +133 -0
  27. package/docs/research/framework-stats-2026-09-05.json +116 -0
  28. package/dog-tools.mjs +11 -0
  29. package/package.json +132 -0
  30. package/packages/openwrite-bridge/LICENSE +201 -0
  31. package/packages/openwrite-bridge/cordis.patch.yml +10 -0
  32. package/packages/openwrite-bridge/lib/client.d.ts +95 -0
  33. package/packages/openwrite-bridge/lib/client.js +193 -0
  34. package/packages/openwrite-bridge/lib/contracts-generated.d.ts +367 -0
  35. package/packages/openwrite-bridge/lib/contracts-generated.js +1764 -0
  36. package/packages/openwrite-bridge/lib/dog-delivery.d.ts +12 -0
  37. package/packages/openwrite-bridge/lib/dog-delivery.js +362 -0
  38. package/packages/openwrite-bridge/lib/dog-review.d.ts +50 -0
  39. package/packages/openwrite-bridge/lib/dog-review.js +470 -0
  40. package/packages/openwrite-bridge/lib/domain.d.ts +70 -0
  41. package/packages/openwrite-bridge/lib/domain.js +496 -0
  42. package/packages/openwrite-bridge/lib/index.d.ts +17 -0
  43. package/packages/openwrite-bridge/lib/index.js +89 -0
  44. package/packages/openwrite-bridge/lib/managed-runtime.d.ts +95 -0
  45. package/packages/openwrite-bridge/lib/managed-runtime.js +510 -0
  46. package/packages/openwrite-bridge/lib/preset-tools.d.ts +13 -0
  47. package/packages/openwrite-bridge/lib/preset-tools.js +18 -0
  48. package/packages/openwrite-bridge/lib/tool-policy.d.ts +6 -0
  49. package/packages/openwrite-bridge/lib/tool-policy.js +56 -0
  50. package/packages/openwrite-bridge/lib/tools.d.ts +24 -0
  51. package/packages/openwrite-bridge/lib/tools.js +2404 -0
  52. package/packages/openwrite-bridge/package.json +67 -0
  53. package/packages/studio-panel/LICENSE +21 -0
  54. package/packages/studio-panel/README.md +51 -0
  55. package/packages/studio-panel/cordis.patch.yml +5 -0
  56. package/packages/studio-panel/lib/client.js +158087 -0
  57. package/packages/studio-panel/lib/client.js.map +1 -0
  58. package/packages/studio-panel/lib/index.js +50 -0
  59. package/packages/studio-panel/lib/types/client/AssetEditor.d.ts +122 -0
  60. package/packages/studio-panel/lib/types/client/AssetsView.d.ts +43 -0
  61. package/packages/studio-panel/lib/types/client/BenchmarkView.d.ts +9 -0
  62. package/packages/studio-panel/lib/types/client/ContinuousReader.d.ts +13 -0
  63. package/packages/studio-panel/lib/types/client/CreationView.d.ts +6 -0
  64. package/packages/studio-panel/lib/types/client/DagCanvas.d.ts +11 -0
  65. package/packages/studio-panel/lib/types/client/DiscardDraftDialog.d.ts +8 -0
  66. package/packages/studio-panel/lib/types/client/DomainToolCard.d.ts +9 -0
  67. package/packages/studio-panel/lib/types/client/GraphView.d.ts +46 -0
  68. package/packages/studio-panel/lib/types/client/HeaderChrome.d.ts +18 -0
  69. package/packages/studio-panel/lib/types/client/LaunchOpenWrite.d.ts +13 -0
  70. package/packages/studio-panel/lib/types/client/LibraryView.d.ts +6 -0
  71. package/packages/studio-panel/lib/types/client/MarkdownText.d.ts +3 -0
  72. package/packages/studio-panel/lib/types/client/ModelView.d.ts +9 -0
  73. package/packages/studio-panel/lib/types/client/OperationsView.d.ts +6 -0
  74. package/packages/studio-panel/lib/types/client/OutlinePlans.d.ts +37 -0
  75. package/packages/studio-panel/lib/types/client/OutlineView.d.ts +29 -0
  76. package/packages/studio-panel/lib/types/client/ResearchView.d.ts +7 -0
  77. package/packages/studio-panel/lib/types/client/ReviewCard.d.ts +28 -0
  78. package/packages/studio-panel/lib/types/client/SceneWorkbench.d.ts +55 -0
  79. package/packages/studio-panel/lib/types/client/SearchView.d.ts +33 -0
  80. package/packages/studio-panel/lib/types/client/TasksView.d.ts +11 -0
  81. package/packages/studio-panel/lib/types/client/TransferWorkspaces.d.ts +19 -0
  82. package/packages/studio-panel/lib/types/client/TurnMutationSummary.d.ts +62 -0
  83. package/packages/studio-panel/lib/types/client/VditorBody.d.ts +55 -0
  84. package/packages/studio-panel/lib/types/client/WorkbenchStore.d.ts +121 -0
  85. package/packages/studio-panel/lib/types/client/api.d.ts +72 -0
  86. package/packages/studio-panel/lib/types/client/asset-drafts.d.ts +20 -0
  87. package/packages/studio-panel/lib/types/client/benchmark-options.d.ts +43 -0
  88. package/packages/studio-panel/lib/types/client/draft-store.d.ts +26 -0
  89. package/packages/studio-panel/lib/types/client/dto.d.ts +517 -0
  90. package/packages/studio-panel/lib/types/client/index.d.ts +4 -0
  91. package/packages/studio-panel/lib/types/client/locales.d.ts +15 -0
  92. package/packages/studio-panel/lib/types/client/manuscript-annotations.d.ts +59 -0
  93. package/packages/studio-panel/lib/types/client/manuscript-markers.d.ts +61 -0
  94. package/packages/studio-panel/lib/types/client/manuscript-mentions.d.ts +30 -0
  95. package/packages/studio-panel/lib/types/client/manuscript-overlay-dom.d.ts +7 -0
  96. package/packages/studio-panel/lib/types/client/manuscript-overlay.d.ts +42 -0
  97. package/packages/studio-panel/lib/types/client/manuscript-selection.d.ts +59 -0
  98. package/packages/studio-panel/lib/types/client/model-view-memory.d.ts +17 -0
  99. package/packages/studio-panel/lib/types/client/storage.d.ts +8 -0
  100. package/packages/studio-panel/lib/types/client/workbench-epochs.d.ts +16 -0
  101. package/packages/studio-panel/lib/types/client/workspace-context.d.ts +52 -0
  102. package/packages/studio-panel/lib/types/client/writing-scope.d.ts +7 -0
  103. package/packages/studio-panel/lib/types/index.d.ts +5 -0
  104. package/packages/studio-panel/package.json +105 -0
  105. package/packages/studio-panel/vendor/vditor/LICENSE +21 -0
  106. package/packages/studio-panel/vendor/vditor/dist/css/content-theme/dark.css +123 -0
  107. package/packages/studio-panel/vendor/vditor/dist/css/content-theme/light.css +101 -0
  108. package/packages/studio-panel/vendor/vditor/dist/index.css +1823 -0
  109. package/packages/studio-panel/vendor/vditor/dist/index.min.js +1 -0
  110. package/packages/studio-panel/vendor/vditor/dist/js/i18n/zh_CN.js +86 -0
  111. package/packages/studio-panel/vendor/vditor/dist/js/icons/ant.js +174 -0
  112. package/packages/studio-panel/vendor/vditor/dist/js/lute/lute.min.js +72 -0
  113. package/plugin.d.ts +3 -0
  114. package/plugin.mjs +80 -0
  115. package/presets/README.md +32 -0
  116. package/presets/openwrite/agent.cordis.yml +317 -0
  117. package/presets/openwrite/preset.yml +3 -0
  118. package/presets/openwrite/skills/canon/SKILL.md +15 -0
  119. package/presets/openwrite/skills/dialoguequality/SKILL.md +166 -0
  120. package/presets/openwrite/skills/dog-delivery-query/SKILL.md +40 -0
  121. package/presets/openwrite/skills/dog-import-query/SKILL.md +27 -0
  122. package/presets/openwrite/skills/dog-review-query/SKILL.md +40 -0
  123. package/presets/openwrite/skills/export-book/SKILL.md +14 -0
  124. package/presets/openwrite/skills/foreshadow/SKILL.md +14 -0
  125. package/presets/openwrite/skills/foreshadowing-system/SKILL.md +125 -0
  126. package/presets/openwrite/skills/learn/SKILL.md +24 -0
  127. package/presets/openwrite/skills/novel-creator/SKILL.md +88 -0
  128. package/presets/openwrite/skills/novel-creator/templates/beat_templates.yaml +179 -0
  129. package/presets/openwrite/skills/novel-creator/templates/example_usage.yaml +74 -0
  130. package/presets/openwrite/skills/novel-reviewer/SKILL.md +85 -0
  131. package/presets/openwrite/skills/oh-story-deslop/LICENSE +21 -0
  132. package/presets/openwrite/skills/oh-story-deslop/SKILL.md +36 -0
  133. package/presets/openwrite/skills/oh-story-deslop/agents/openai.yaml +4 -0
  134. package/presets/openwrite/skills/oh-story-deslop/references/method.md +22 -0
  135. package/presets/openwrite/skills/oh-story-long-analyze/LICENSE +21 -0
  136. package/presets/openwrite/skills/oh-story-long-analyze/SKILL.md +37 -0
  137. package/presets/openwrite/skills/oh-story-long-analyze/agents/openai.yaml +4 -0
  138. package/presets/openwrite/skills/oh-story-long-analyze/references/method.md +22 -0
  139. package/presets/openwrite/skills/oh-story-long-scan/LICENSE +21 -0
  140. package/presets/openwrite/skills/oh-story-long-scan/SKILL.md +36 -0
  141. package/presets/openwrite/skills/oh-story-long-scan/agents/openai.yaml +4 -0
  142. package/presets/openwrite/skills/oh-story-long-scan/references/method.md +21 -0
  143. package/presets/openwrite/skills/oh-story-long-write/LICENSE +21 -0
  144. package/presets/openwrite/skills/oh-story-long-write/SKILL.md +37 -0
  145. package/presets/openwrite/skills/oh-story-long-write/agents/openai.yaml +4 -0
  146. package/presets/openwrite/skills/oh-story-long-write/references/method.md +33 -0
  147. package/presets/openwrite/skills/oh-story-review/LICENSE +21 -0
  148. package/presets/openwrite/skills/oh-story-review/SKILL.md +36 -0
  149. package/presets/openwrite/skills/oh-story-review/agents/openai.yaml +4 -0
  150. package/presets/openwrite/skills/oh-story-review/references/method.md +25 -0
  151. package/presets/openwrite/skills/progress/SKILL.md +16 -0
  152. package/presets/openwrite/skills/review-chapter/SKILL.md +17 -0
  153. package/presets/openwrite/skills/revise-span/SKILL.md +16 -0
  154. package/presets/openwrite/skills/style-system/SKILL.md +135 -0
  155. package/presets/openwrite/skills/style-system/prompts/analyze_style.md +214 -0
  156. package/presets/openwrite/skills/style-system/prompts/batch_extract_style.md +66 -0
  157. package/presets/openwrite/skills/style-system/prompts/compose_style.md +83 -0
  158. package/presets/openwrite/skills/style-system/prompts/extract_style.md +84 -0
  159. package/presets/openwrite/skills/style-system/prompts/initialize_style.md +52 -0
  160. package/presets/openwrite/skills/style-system/templates/analysis_report.yaml +78 -0
  161. package/presets/openwrite/skills/style-system/templates/composed_style.md +96 -0
  162. package/presets/openwrite/skills/style-system/templates/extraction_report.yaml +80 -0
  163. package/presets/openwrite/skills/style-system/templates/fingerprint.yaml +61 -0
  164. package/presets/openwrite/skills/style-system/tools/README.md +33 -0
  165. package/presets/openwrite/skills/truth-validation/SKILL.md +119 -0
  166. package/presets/openwrite/skills/workflow-manager/SKILL.md +81 -0
  167. package/presets/openwrite/skills/world-query/SKILL.md +45 -0
  168. package/presets/openwrite/skills/write-next/SKILL.md +17 -0
  169. package/release/core-requirements.in +12 -0
  170. package/release/licenses/@deepseek-ai__cosmokit@1.8.3/LICENSE +21 -0
  171. package/release/licenses/@deepseek-ai__schemastery@3.18.2/LICENSE +21 -0
  172. package/release/licenses/@isaacs__fs-minipass@4.0.1/LICENSE +15 -0
  173. package/release/licenses/@standard-schema__spec@1.1.0/LICENSE +21 -0
  174. package/release/licenses/@types__d3-color@3.1.3/LICENSE +21 -0
  175. package/release/licenses/@types__d3-drag@3.0.7/LICENSE +21 -0
  176. package/release/licenses/@types__d3-interpolate@3.0.4/LICENSE +21 -0
  177. package/release/licenses/@types__d3-selection@3.0.11/LICENSE +21 -0
  178. package/release/licenses/@types__d3-transition@3.0.9/LICENSE +21 -0
  179. package/release/licenses/@types__d3-zoom@3.0.8/LICENSE +21 -0
  180. package/release/licenses/@xyflow__react@12.11.6/LICENSE +21 -0
  181. package/release/licenses/@xyflow__system@0.0.82/LICENSE +21 -0
  182. package/release/licenses/ajv-formats@3.0.1/LICENSE +21 -0
  183. package/release/licenses/ajv@8.20.0/LICENSE +22 -0
  184. package/release/licenses/chownr@3.0.0/LICENSE.md +63 -0
  185. package/release/licenses/classcat@5.0.5/LICENSE.md +7 -0
  186. package/release/licenses/commander@7.2.0/LICENSE +22 -0
  187. package/release/licenses/d3-array@3.2.4/LICENSE +13 -0
  188. package/release/licenses/d3-axis@3.0.0/LICENSE +13 -0
  189. package/release/licenses/d3-brush@3.0.0/LICENSE +13 -0
  190. package/release/licenses/d3-chord@3.0.1/LICENSE +13 -0
  191. package/release/licenses/d3-color@3.1.0/LICENSE +13 -0
  192. package/release/licenses/d3-contour@4.0.2/LICENSE +13 -0
  193. package/release/licenses/d3-delaunay@6.0.4/LICENSE +14 -0
  194. package/release/licenses/d3-dispatch@3.0.1/LICENSE +13 -0
  195. package/release/licenses/d3-drag@3.0.0/LICENSE +13 -0
  196. package/release/licenses/d3-dsv@3.0.1/LICENSE +13 -0
  197. package/release/licenses/d3-ease@3.0.1/LICENSE +28 -0
  198. package/release/licenses/d3-fetch@3.0.1/LICENSE +13 -0
  199. package/release/licenses/d3-force@3.0.0/LICENSE +13 -0
  200. package/release/licenses/d3-format@3.1.2/LICENSE +13 -0
  201. package/release/licenses/d3-geo@3.1.1/LICENSE +34 -0
  202. package/release/licenses/d3-hierarchy@3.1.2/LICENSE +13 -0
  203. package/release/licenses/d3-interpolate@3.0.1/LICENSE +13 -0
  204. package/release/licenses/d3-path@3.1.0/LICENSE +13 -0
  205. package/release/licenses/d3-polygon@3.0.1/LICENSE +13 -0
  206. package/release/licenses/d3-quadtree@3.0.1/LICENSE +13 -0
  207. package/release/licenses/d3-random@3.0.1/LICENSE +13 -0
  208. package/release/licenses/d3-scale-chromatic@3.1.0/LICENSE +28 -0
  209. package/release/licenses/d3-scale@4.0.2/LICENSE +13 -0
  210. package/release/licenses/d3-selection@3.0.0/LICENSE +13 -0
  211. package/release/licenses/d3-shape@3.2.0/LICENSE +13 -0
  212. package/release/licenses/d3-time-format@4.1.0/LICENSE +13 -0
  213. package/release/licenses/d3-time@3.1.0/LICENSE +13 -0
  214. package/release/licenses/d3-timer@3.0.1/LICENSE +13 -0
  215. package/release/licenses/d3-transition@3.0.1/LICENSE +13 -0
  216. package/release/licenses/d3-zoom@3.0.0/LICENSE +13 -0
  217. package/release/licenses/d3@7.9.0/LICENSE +13 -0
  218. package/release/licenses/delaunator@5.1.0/LICENSE +15 -0
  219. package/release/licenses/elkjs@0.12.0/LICENSE.md +263 -0
  220. package/release/licenses/fast-deep-equal@3.1.3/LICENSE +21 -0
  221. package/release/licenses/fast-uri@3.1.7/LICENSE +30 -0
  222. package/release/licenses/fflate@0.8.2/LICENSE +21 -0
  223. package/release/licenses/graceful-fs@4.2.11/LICENSE +15 -0
  224. package/release/licenses/iconv-lite@0.6.3/LICENSE +21 -0
  225. package/release/licenses/internmap@2.0.3/LICENSE +13 -0
  226. package/release/licenses/json-schema-traverse@1.0.0/LICENSE +21 -0
  227. package/release/licenses/lucide-react@0.468.0/LICENSE +15 -0
  228. package/release/licenses/minipass@7.1.3/LICENSE.md +55 -0
  229. package/release/licenses/minizlib@3.1.0/LICENSE +26 -0
  230. package/release/licenses/proper-lockfile@4.1.2/LICENSE +21 -0
  231. package/release/licenses/require-from-string@2.0.2/license +21 -0
  232. package/release/licenses/retry@0.12.0/License +21 -0
  233. package/release/licenses/robust-predicates@3.0.3/LICENSE +24 -0
  234. package/release/licenses/rw@1.3.3/LICENSE +26 -0
  235. package/release/licenses/safer-buffer@2.1.2/LICENSE +21 -0
  236. package/release/licenses/signal-exit@3.0.7/LICENSE.txt +16 -0
  237. package/release/licenses/tar@7.5.7/LICENSE.md +55 -0
  238. package/release/licenses/use-sync-external-store@1.6.0/LICENSE +21 -0
  239. package/release/licenses/yallist@5.0.0/LICENSE.md +63 -0
  240. package/release/licenses/zustand@4.5.7/LICENSE +21 -0
  241. package/release/openwrite-5.8.1-py3-none-any.whl +0 -0
  242. package/release/platform-overrides.in +5 -0
  243. package/release/python-constraints.in +96 -0
  244. package/release/requirements.lock +2927 -0
  245. package/release/runtime-manifest.json +98 -0
  246. package/release/sdk-compatibility.json +240 -0
  247. package/release/source.json +859 -0
  248. package/release/wheels/cryptography-50.0.1-cp312-abi3-macosx_13_0_x86_64.whl +0 -0
  249. package/release/wheels/licenses/LICENSE.txt +177 -0
  250. package/release/wheels/provenance.json +15 -0
  251. package/scripts/dog/delivery-stage.js +32 -0
  252. package/scripts/dog/import-chapter.js +20 -0
  253. package/scripts/dog/import-record.js +35 -0
  254. package/scripts/dog/review-dimension.js +41 -0
  255. package/scripts/dog/review-record.js +42 -0
  256. package/scripts/maintenance.mjs +179 -0
  257. package/scripts/prepare.mjs +21 -0
  258. package/vendor/dsh-dog/LICENSE +29 -0
  259. package/vendor/dsh-dog/README.md +114 -0
  260. package/vendor/dsh-dog/UPSTREAM.md +22 -0
  261. package/vendor/dsh-dog/cordis.patch.yml +14 -0
  262. package/vendor/dsh-dog/lib/client.js +2898 -0
  263. package/vendor/dsh-dog/lib/client.js.map +1 -0
  264. package/vendor/dsh-dog/lib/core-BiEBMLz3.d.ts +495 -0
  265. package/vendor/dsh-dog/lib/core-DdfMcrB4.js +2074 -0
  266. package/vendor/dsh-dog/lib/core.d.ts +2 -0
  267. package/vendor/dsh-dog/lib/core.js +2 -0
  268. package/vendor/dsh-dog/lib/index.d.ts +133 -0
  269. package/vendor/dsh-dog/lib/index.js +967 -0
  270. package/vendor/dsh-dog/package.json +97 -0
  271. package/vendor/dsh-dog/schemas/schema-0.2/graph.schema.json +139 -0
  272. package/vendor/dsh-dog/schemas/schema-0.2/report.schema.json +87 -0
  273. package/vendor/dsh-dog/schemas/schema-0.2/run.schema.json +259 -0
  274. package/vendor/dsh-dog/schemas/schema-0.2/runtime-event.schema.json +105 -0
  275. package/vendor/dsh-dog/schemas/schema-0.2/verification.schema.json +40 -0
@@ -0,0 +1,495 @@
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 };