ahead-pi 0.2.1 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/README.md +26 -41
  2. package/dist/ahead_wasm.wasm +0 -0
  3. package/generated/corrective-debugging/ai-audit.md +39 -0
  4. package/generated/corrective-debugging/ai-review.md +46 -0
  5. package/generated/corrective-debugging/characterize.md +53 -0
  6. package/generated/corrective-debugging/conclude.md +59 -0
  7. package/generated/corrective-debugging/correction.md +53 -0
  8. package/generated/corrective-debugging/deploy.md +38 -0
  9. package/generated/corrective-debugging/human-review.md +45 -0
  10. package/generated/corrective-debugging/implement.md +42 -0
  11. package/generated/corrective-debugging/investigate.md +59 -0
  12. package/generated/corrective-debugging/manifest.json +30 -0
  13. package/generated/corrective-debugging/model.md +53 -0
  14. package/generated/corrective-debugging/outcome.md +38 -0
  15. package/generated/corrective-debugging/plan.md +53 -0
  16. package/generated/corrective-debugging/verify.md +47 -0
  17. package/generated/decision/compare.md +45 -0
  18. package/generated/decision/criteria.md +45 -0
  19. package/generated/decision/decide.md +45 -0
  20. package/generated/decision/frame.md +45 -0
  21. package/generated/decision/manifest.json +21 -0
  22. package/generated/decision/options.md +47 -0
  23. package/generated/decision/publish.md +38 -0
  24. package/generated/decision/research.md +45 -0
  25. package/generated/internal-improvement/ai-audit.md +39 -0
  26. package/generated/internal-improvement/ai-review.md +46 -0
  27. package/generated/internal-improvement/baseline.md +46 -0
  28. package/generated/internal-improvement/decision.md +45 -0
  29. package/generated/internal-improvement/deploy.md +38 -0
  30. package/generated/internal-improvement/human-review.md +45 -0
  31. package/generated/internal-improvement/implement.md +42 -0
  32. package/generated/internal-improvement/invariants.md +38 -0
  33. package/generated/internal-improvement/manifest.json +29 -0
  34. package/generated/internal-improvement/options.md +47 -0
  35. package/generated/internal-improvement/outcome.md +38 -0
  36. package/generated/internal-improvement/plan.md +53 -0
  37. package/generated/internal-improvement/target.md +45 -0
  38. package/generated/internal-improvement/verify.md +45 -0
  39. package/generated/investigation/bound.md +45 -0
  40. package/generated/investigation/conclude.md +45 -0
  41. package/generated/investigation/explore.md +60 -0
  42. package/generated/investigation/frame.md +45 -0
  43. package/generated/investigation/gather.md +45 -0
  44. package/generated/investigation/manifest.json +21 -0
  45. package/generated/investigation/synthesize.md +51 -0
  46. package/generated/operational-stabilization/assess.md +46 -0
  47. package/generated/operational-stabilization/execute-observe.md +45 -0
  48. package/generated/operational-stabilization/manifest.json +19 -0
  49. package/generated/operational-stabilization/monitor.md +45 -0
  50. package/generated/operational-stabilization/outcome.md +38 -0
  51. package/generated/operational-stabilization/respond.md +40 -0
  52. package/generated/operational-stabilization/verify-recovery.md +45 -0
  53. package/generated/product-change/ai-audit.md +7 -4
  54. package/generated/product-change/ai-review.md +15 -5
  55. package/generated/product-change/decision.md +11 -2
  56. package/generated/product-change/define.md +4 -2
  57. package/generated/product-change/deploy.md +4 -2
  58. package/generated/product-change/human-review.md +11 -2
  59. package/generated/product-change/implement.md +4 -2
  60. package/generated/product-change/manifest.json +8 -3
  61. package/generated/product-change/options.md +11 -2
  62. package/generated/product-change/outcome.md +4 -2
  63. package/generated/product-change/plan.md +17 -2
  64. package/generated/product-change/questions.md +17 -2
  65. package/generated/product-change/research.md +11 -2
  66. package/generated/product-change/verify.md +4 -2
  67. package/generated/recommended-skills.json +24 -0
  68. package/generated/reference/CONSTITUTION.md +2 -0
  69. package/generated/reference/docs/evidence/README.md +17 -0
  70. package/generated/reference/docs/evidence/evidence-standard.md +2 -0
  71. package/generated/reference/docs/evidence/research-map.md +2 -0
  72. package/generated/reference/docs/{references → evidence/sources}/pragmatic-programmer-page-index.md +3 -1
  73. package/generated/reference/docs/{references → evidence/sources}/submitted-engineering-notes.md +3 -1
  74. package/generated/reference/docs/guide/README.md +28 -0
  75. package/generated/reference/docs/{acceptable-ai-use.md → guide/acceptable-ai-use.md} +4 -2
  76. package/generated/reference/docs/{engineering-practice.md → guide/engineering-practice.md} +5 -3
  77. package/generated/reference/docs/{rationale.md → guide/rationale.md} +3 -1
  78. package/generated/reference/docs/guide/recommended-skills.md +21 -0
  79. package/generated/reference/docs/{workflows → guide/workflows}/README.md +6 -4
  80. package/generated/reference/docs/{workflows → guide/workflows}/corrective-debugging.md +39 -19
  81. package/generated/reference/docs/{workflows → guide/workflows}/decision.md +4 -2
  82. package/generated/reference/docs/{workflows → guide/workflows}/internal-improvement.md +37 -23
  83. package/generated/reference/docs/{workflows → guide/workflows}/investigation.md +5 -1
  84. package/generated/reference/docs/{workflows → guide/workflows}/operational-stabilization.md +16 -12
  85. package/generated/reference/docs/{workflows → guide/workflows}/product-change.md +16 -3
  86. package/generated/reference/index.json +200 -87
  87. package/package.json +34 -25
  88. package/src/engine.ts +27 -8
  89. package/src/flow-guides.ts +168 -0
  90. package/src/guidance.ts +220 -78
  91. package/src/index.ts +852 -189
  92. package/src/reference-viewer.ts +20 -18
  93. package/src/reference.ts +76 -14
  94. package/src/review.ts +360 -0
  95. package/src/skills.ts +133 -0
  96. package/src/storage.ts +139 -15
  97. package/src/types.ts +1 -0
  98. package/generated/reference/docs/design/debugging-and-operations.md +0 -119
  99. package/generated/reference/docs/design/executable-workflows.md +0 -110
  100. package/generated/reference/docs/design/process-taxonomy.md +0 -144
  101. package/generated/reference/docs/releasing-pi.md +0 -89
@@ -1,24 +1,24 @@
1
1
  {
2
+ "api_version": "ahead.references/v0.1",
2
3
  "generated_from": [
3
4
  "CONSTITUTION.md",
4
- "docs/acceptable-ai-use.md",
5
- "docs/design/debugging-and-operations.md",
6
- "docs/design/executable-workflows.md",
7
- "docs/design/process-taxonomy.md",
8
- "docs/engineering-practice.md",
5
+ "docs/evidence/README.md",
9
6
  "docs/evidence/evidence-standard.md",
10
7
  "docs/evidence/research-map.md",
11
- "docs/rationale.md",
12
- "docs/references/pragmatic-programmer-page-index.md",
13
- "docs/references/submitted-engineering-notes.md",
14
- "docs/releasing-pi.md",
15
- "docs/workflows/README.md",
16
- "docs/workflows/corrective-debugging.md",
17
- "docs/workflows/decision.md",
18
- "docs/workflows/internal-improvement.md",
19
- "docs/workflows/investigation.md",
20
- "docs/workflows/operational-stabilization.md",
21
- "docs/workflows/product-change.md"
8
+ "docs/evidence/sources/pragmatic-programmer-page-index.md",
9
+ "docs/evidence/sources/submitted-engineering-notes.md",
10
+ "docs/guide/README.md",
11
+ "docs/guide/acceptable-ai-use.md",
12
+ "docs/guide/engineering-practice.md",
13
+ "docs/guide/rationale.md",
14
+ "docs/guide/recommended-skills.md",
15
+ "docs/guide/workflows/README.md",
16
+ "docs/guide/workflows/corrective-debugging.md",
17
+ "docs/guide/workflows/decision.md",
18
+ "docs/guide/workflows/internal-improvement.md",
19
+ "docs/guide/workflows/investigation.md",
20
+ "docs/guide/workflows/operational-stabilization.md",
21
+ "docs/guide/workflows/product-change.md"
22
22
  ],
23
23
  "references": [
24
24
  {
@@ -26,48 +26,26 @@
26
26
  "path": "CONSTITUTION.md",
27
27
  "title": "AHEAD Constitution",
28
28
  "summary": "This constitution records the durable principles of **Assisted Human Engineering and Development**. Workflows and tools may evolve. These principles define what makes them AHEAD.",
29
+ "audience": "practitioner",
30
+ "authority": "binding",
31
+ "distribution": "agent-and-human",
29
32
  "phases": [
30
33
  "*"
31
- ]
32
- },
33
- {
34
- "id": "acceptable-ai-use",
35
- "path": "docs/acceptable-ai-use.md",
36
- "title": "Acceptable AI Use in AHEAD",
37
- "summary": "This policy is binding for AHEAD pilot workflows. The [AHEAD Constitution](../CONSTITUTION.md) is the highest authority; this policy interprets its human-ownership boundaries; workflow profiles apply both and may narrow AI permissions for a",
38
- "phases": [
34
+ ],
35
+ "workflows": [
39
36
  "*"
40
37
  ]
41
38
  },
42
39
  {
43
- "id": "design:debugging-and-operations",
44
- "path": "docs/design/debugging-and-operations.md",
45
- "title": "Debugging and Operational Investigation",
46
- "summary": "The minimal [corrective-debugging](../workflows/corrective-debugging.md) and [operational-stabilization](../workflows/operational-stabilization.md) profiles translate this discussion into pilotable flows. This document retains the reasoning",
47
- "phases": []
48
- },
49
- {
50
- "id": "design:executable-workflows",
51
- "path": "docs/design/executable-workflows.md",
52
- "title": "Executable AHEAD Workflows",
53
- "summary": "The executable layer makes AHEAD workflow state durable and makes selected human/AI boundaries enforceable across integrations. It does not turn judgment into a checklist or make workflow artifacts proof of understanding.",
54
- "phases": [
55
- "*"
56
- ]
57
- },
58
- {
59
- "id": "design:process-taxonomy",
60
- "path": "docs/design/process-taxonomy.md",
61
- "title": "AHEAD Process Taxonomy",
62
- "summary": "AHEAD should not create a workflow for every issue label. “Security,” “performance,” “data,” “incident,” and “technical debt” often describe risk, domain, urgency, or cause—not the kind of reasoning needed to complete the work.",
63
- "phases": []
64
- },
65
- {
66
- "id": "engineering-practice",
67
- "path": "docs/engineering-practice.md",
68
- "title": "AHEAD Engineering Practice",
69
- "summary": "AHEAD is not only a sequence of AI gates. It is a way of practicing engineering. This guide distills general habits from the submitted starting list into a smaller set of principles that can be remembered, applied, and evaluated.",
70
- "phases": [
40
+ "id": "evidence",
41
+ "path": "docs/evidence/README.md",
42
+ "title": "AHEAD Evidence and Provenance",
43
+ "summary": "This library records why AHEAD makes its process choices and how strong the support for those choices is. It is separate from the practitioner guide so source material and methodology governance do not become extra steps in ordinary enginee",
44
+ "audience": "evidence",
45
+ "authority": "supporting",
46
+ "distribution": "agent-and-human",
47
+ "phases": [],
48
+ "workflows": [
71
49
  "*"
72
50
  ]
73
51
  },
@@ -76,6 +54,9 @@
76
54
  "path": "docs/evidence/evidence-standard.md",
77
55
  "title": "AHEAD Evidence Standard",
78
56
  "summary": "AHEAD should be supported by the best available evidence without claiming more certainty than software-engineering research can provide. A credible methodology must distinguish evidence for a descriptive claim from evidence that a particula",
57
+ "audience": "evidence",
58
+ "authority": "supporting",
59
+ "distribution": "agent-and-human",
79
60
  "phases": [
80
61
  "research",
81
62
  "questions",
@@ -86,6 +67,9 @@
86
67
  "verify",
87
68
  "ai-audit",
88
69
  "outcome"
70
+ ],
71
+ "workflows": [
72
+ "*"
89
73
  ]
90
74
  },
91
75
  {
@@ -93,87 +77,216 @@
93
77
  "path": "docs/evidence/research-map.md",
94
78
  "title": "AHEAD Research Map",
95
79
  "summary": "This document maps current AHEAD design claims to available evidence. It is not a bibliography of everything related to software engineering. It focuses on claims that materially shape the methodology.",
96
- "phases": []
97
- },
98
- {
99
- "id": "rationale",
100
- "path": "docs/rationale.md",
101
- "title": "Why AHEAD",
102
- "summary": "AI can make software engineering faster. It can search broadly, synthesize information, identify omissions, generate alternatives, produce routine code, explain unfamiliar systems, and review more material than a person can inspect unaided.",
103
- "phases": [
80
+ "audience": "evidence",
81
+ "authority": "supporting",
82
+ "distribution": "agent-and-human",
83
+ "phases": [],
84
+ "workflows": [
104
85
  "*"
105
86
  ]
106
87
  },
107
88
  {
108
- "id": "references:pragmatic-programmer-page-index",
109
- "path": "docs/references/pragmatic-programmer-page-index.md",
89
+ "id": "evidence:sources:pragmatic-programmer-page-index",
90
+ "path": "docs/evidence/sources/pragmatic-programmer-page-index.md",
110
91
  "title": "*The Pragmatic Programmer* Page Index",
111
92
  "summary": "This index preserves the page-level provenance from the original AHEAD engineering-practice notes for:",
112
- "phases": []
93
+ "audience": "evidence",
94
+ "authority": "supporting",
95
+ "distribution": "agent-and-human",
96
+ "phases": [],
97
+ "workflows": [
98
+ "*"
99
+ ]
113
100
  },
114
101
  {
115
- "id": "references:submitted-engineering-notes",
116
- "path": "docs/references/submitted-engineering-notes.md",
102
+ "id": "evidence:sources:submitted-engineering-notes",
103
+ "path": "docs/evidence/sources/submitted-engineering-notes.md",
117
104
  "title": "Submitted Engineering Notes",
118
- "summary": "This document preserves submitted engineering tips, checklists, and practices that are intentionally condensed in the [AHEAD Engineering Practice](../engineering-practice.md) guide. It is a source record, not a claim that every item is an e",
119
- "phases": []
105
+ "summary": "This document preserves submitted engineering tips, checklists, and practices that are intentionally condensed in the [AHEAD Engineering Practice](../../guide/engineering-practice.md) guide. It is a source record, not a claim that every ite",
106
+ "audience": "evidence",
107
+ "authority": "supporting",
108
+ "distribution": "agent-and-human",
109
+ "phases": [],
110
+ "workflows": [
111
+ "*"
112
+ ]
120
113
  },
121
114
  {
122
- "id": "releasing-pi",
123
- "path": "docs/releasing-pi.md",
124
- "title": "Releasing the Pi Extension",
125
- "summary": "- npm package: `ahead-pi` - package source: `integrations/pi` - release workflow: `.github/workflows/publish-pi.yml` - release tag: `pi-v<package-version>` - stable npm dist-tag: `latest` - prerelease npm dist-tag: `next` - registry: `https",
126
- "phases": []
115
+ "id": "guide",
116
+ "path": "docs/guide/README.md",
117
+ "title": "AHEAD Practitioner Guide",
118
+ "summary": "This is the starting point for people applying AHEAD to engineering work. These documents explain what practitioners are expected to understand, decide, record, and review. They do not describe how the Rust engine, Pi adapter, instruction g",
119
+ "audience": "practitioner",
120
+ "authority": "guidance",
121
+ "distribution": "agent-and-human",
122
+ "phases": [
123
+ "*"
124
+ ],
125
+ "workflows": [
126
+ "*"
127
+ ]
128
+ },
129
+ {
130
+ "id": "acceptable-ai-use",
131
+ "path": "docs/guide/acceptable-ai-use.md",
132
+ "title": "Acceptable AI Use in AHEAD",
133
+ "summary": "This policy is binding for AHEAD pilot workflows. The [AHEAD Constitution](../../CONSTITUTION.md) is the highest authority; this policy interprets its human-ownership boundaries; workflow profiles apply both and may narrow AI permissions fo",
134
+ "audience": "practitioner",
135
+ "authority": "binding",
136
+ "distribution": "agent-and-human",
137
+ "phases": [
138
+ "*"
139
+ ],
140
+ "workflows": [
141
+ "*"
142
+ ]
127
143
  },
128
144
  {
129
- "id": "workflows:readme",
130
- "path": "docs/workflows/README.md",
145
+ "id": "engineering-practice",
146
+ "path": "docs/guide/engineering-practice.md",
147
+ "title": "AHEAD Engineering Practice",
148
+ "summary": "AHEAD is not only a sequence of AI gates. It is a way of practicing engineering. This guide distills general habits from the submitted starting list into a smaller set of principles that can be remembered, applied, and evaluated.",
149
+ "audience": "practitioner",
150
+ "authority": "guidance",
151
+ "distribution": "agent-and-human",
152
+ "phases": [
153
+ "*"
154
+ ],
155
+ "workflows": [
156
+ "*"
157
+ ]
158
+ },
159
+ {
160
+ "id": "rationale",
161
+ "path": "docs/guide/rationale.md",
162
+ "title": "Why AHEAD",
163
+ "summary": "AI can make software engineering faster. It can search broadly, synthesize information, identify omissions, generate alternatives, produce routine code, explain unfamiliar systems, and review more material than a person can inspect unaided.",
164
+ "audience": "practitioner",
165
+ "authority": "guidance",
166
+ "distribution": "agent-and-human",
167
+ "phases": [
168
+ "*"
169
+ ],
170
+ "workflows": [
171
+ "*"
172
+ ]
173
+ },
174
+ {
175
+ "id": "recommended-skills",
176
+ "path": "docs/guide/recommended-skills.md",
177
+ "title": "Recommended Skills",
178
+ "summary": "AHEAD may recommend independently maintained agent skills when they strengthen an active phase. Recommendations are references, not bundled code or silent dependencies. A human chooses whether to inspect and install one, and AHEAD's workflo",
179
+ "audience": "practitioner",
180
+ "authority": "guidance",
181
+ "distribution": "agent-and-human",
182
+ "phases": [],
183
+ "workflows": [
184
+ "*"
185
+ ]
186
+ },
187
+ {
188
+ "id": "workflows",
189
+ "path": "docs/guide/workflows/README.md",
131
190
  "title": "AHEAD Pilot Workflows",
132
- "summary": "These six minimal workflow profiles are meant to be used on real engineering work before AHEAD builds a workflow engine, editor extension, or CI enforcement. They are deliberately small. The pilot should reveal which phases, gates, and reco",
133
- "phases": []
191
+ "summary": "These six minimal workflow profiles are meant to be used on real engineering work through the Pi adapter or a manual record. Their canonical executable contracts live in `spec/workflows`, while these documents explain the same boundaries an",
192
+ "audience": "practitioner",
193
+ "authority": "binding",
194
+ "distribution": "agent-and-human",
195
+ "phases": [
196
+ "*"
197
+ ],
198
+ "workflows": [
199
+ "*"
200
+ ]
134
201
  },
135
202
  {
136
203
  "id": "workflows:corrective-debugging",
137
- "path": "docs/workflows/corrective-debugging.md",
204
+ "path": "docs/guide/workflows/corrective-debugging.md",
138
205
  "title": "Corrective Debugging Workflow",
139
206
  "summary": "Use this flow when observed behavior conflicts with intended behavior and the dominant work is causal diagnosis plus correction. It ends with a verified correction or an explicit human acceptance of remaining uncertainty.",
140
- "phases": []
207
+ "audience": "practitioner",
208
+ "authority": "binding",
209
+ "distribution": "agent-and-human",
210
+ "phases": [
211
+ "*"
212
+ ],
213
+ "workflows": [
214
+ "corrective-debugging"
215
+ ]
141
216
  },
142
217
  {
143
218
  "id": "workflows:decision",
144
- "path": "docs/workflows/decision.md",
219
+ "path": "docs/guide/workflows/decision.md",
145
220
  "title": "Decision Workflow",
146
221
  "summary": "Use this flow when the deliverable is an accountable human choice among alternatives: architecture, buy versus build, technology selection, platform direction, policy, or another consequential course.",
147
- "phases": []
222
+ "audience": "practitioner",
223
+ "authority": "binding",
224
+ "distribution": "agent-and-human",
225
+ "phases": [
226
+ "*"
227
+ ],
228
+ "workflows": [
229
+ "decision"
230
+ ]
148
231
  },
149
232
  {
150
233
  "id": "workflows:internal-improvement",
151
- "path": "docs/workflows/internal-improvement.md",
234
+ "path": "docs/guide/workflows/internal-improvement.md",
152
235
  "title": "Internal Improvement Workflow",
153
236
  "summary": "Use this flow when externally required behavior should remain invariant while an internal quality improves: maintainability, comprehensibility, performance, reliability margin, operability, testability, cost, or preventive risk reduction.",
154
- "phases": []
237
+ "audience": "practitioner",
238
+ "authority": "binding",
239
+ "distribution": "agent-and-human",
240
+ "phases": [
241
+ "*"
242
+ ],
243
+ "workflows": [
244
+ "internal-improvement"
245
+ ]
155
246
  },
156
247
  {
157
248
  "id": "workflows:investigation",
158
- "path": "docs/workflows/investigation.md",
249
+ "path": "docs/guide/workflows/investigation.md",
159
250
  "title": "Investigation Workflow",
160
251
  "summary": "Use this flow when the primary deliverable is knowledge or reduced uncertainty and no intervention has yet been selected. It may answer feasibility, causal, capacity, vendor, architectural, or technical questions.",
161
- "phases": []
252
+ "audience": "practitioner",
253
+ "authority": "binding",
254
+ "distribution": "agent-and-human",
255
+ "phases": [
256
+ "*"
257
+ ],
258
+ "workflows": [
259
+ "investigation"
260
+ ]
162
261
  },
163
262
  {
164
263
  "id": "workflows:operational-stabilization",
165
- "path": "docs/workflows/operational-stabilization.md",
264
+ "path": "docs/guide/workflows/operational-stabilization.md",
166
265
  "title": "Operational Stabilization Workflow",
167
266
  "summary": "Use this flow when a live system is outside an acceptable operating state and the immediate outcome is restoration, stabilization, or demonstrated convergence. It covers code and non-code causes such as reconciliation storms, configuration ",
168
- "phases": []
267
+ "audience": "practitioner",
268
+ "authority": "binding",
269
+ "distribution": "agent-and-human",
270
+ "phases": [
271
+ "*"
272
+ ],
273
+ "workflows": [
274
+ "operational-stabilization"
275
+ ]
169
276
  },
170
277
  {
171
278
  "id": "workflows:product-change",
172
- "path": "docs/workflows/product-change.md",
279
+ "path": "docs/guide/workflows/product-change.md",
173
280
  "title": "Product Change Workflow",
174
281
  "summary": "Use this flow when the dominant outcome is new, changed, adapted, migrated, or retired externally meaningful behavior. It ends with verified intended behavior and an accountable human outcome decision.",
282
+ "audience": "practitioner",
283
+ "authority": "binding",
284
+ "distribution": "agent-and-human",
175
285
  "phases": [
176
286
  "*"
287
+ ],
288
+ "workflows": [
289
+ "product-change"
177
290
  ]
178
291
  }
179
292
  ]
package/package.json CHANGED
@@ -1,62 +1,71 @@
1
1
  {
2
2
  "name": "ahead-pi",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
4
4
  "description": "AHEAD workflow enforcement and context for Pi",
5
+ "keywords": [
6
+ "ahead",
7
+ "human-in-the-loop",
8
+ "pi-package"
9
+ ],
10
+ "homepage": "https://github.com/Kade-Powell/ahead/tree/main/integrations/pi#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/Kade-Powell/ahead/issues"
13
+ },
5
14
  "license": "MIT",
6
- "type": "module",
7
15
  "repository": {
8
16
  "type": "git",
9
17
  "url": "git+https://github.com/Kade-Powell/ahead.git",
10
18
  "directory": "integrations/pi"
11
19
  },
12
- "homepage": "https://github.com/Kade-Powell/ahead/tree/main/integrations/pi#readme",
13
- "bugs": {
14
- "url": "https://github.com/Kade-Powell/ahead/issues"
15
- },
16
- "engines": {
17
- "node": ">=22.19.0"
18
- },
19
20
  "files": [
20
21
  "dist/ahead_wasm.wasm",
21
22
  "generated/",
22
23
  "src/"
23
24
  ],
25
+ "type": "module",
24
26
  "publishConfig": {
25
27
  "access": "public",
26
28
  "provenance": true,
27
29
  "registry": "https://registry.npmjs.org/"
28
30
  },
29
- "keywords": [
30
- "pi-package",
31
- "ahead",
32
- "human-in-the-loop"
33
- ],
34
- "pi": {
35
- "extensions": [
36
- "./src/index.ts"
37
- ]
38
- },
39
31
  "scripts": {
40
32
  "build": "npm run build:instructions && npm run build:wasm && npm run typecheck",
41
33
  "build:instructions": "node ../../scripts/build-instructions.mjs",
42
34
  "build:wasm": "node ./scripts/build-wasm.mjs",
35
+ "format": "cd ../.. && integrations/pi/node_modules/.bin/oxfmt -c ./.oxfmtrc.json .oxfmtrc.json .oxlintrc.json scripts integrations/pi/scripts integrations/pi/src integrations/pi/test integrations/pi/package.json integrations/pi/tsconfig.json",
36
+ "format:check": "npm run format -- --check",
37
+ "lint": "npm run lint:source && npm run lint:types",
38
+ "lint:source": "cd ../.. && integrations/pi/node_modules/.bin/oxlint -c ./.oxlintrc.json --report-unused-disable-directives-severity=off scripts integrations/pi/scripts integrations/pi/src integrations/pi/test",
39
+ "lint:types": "cd ../.. && integrations/pi/node_modules/.bin/oxlint -c ./.oxlintrc.json --type-aware --tsconfig integrations/pi/tsconfig.json integrations/pi/src",
43
40
  "prepack": "npm run build",
44
41
  "prepublishOnly": "npm run verify",
45
42
  "pack:verify": "node ./scripts/verify-package.mjs",
43
+ "quality": "npm run format:check && npm run lint && npm run typecheck",
46
44
  "typecheck": "tsc --noEmit",
47
- "verify": "npm run build && node --test ./test/*.test.mjs",
45
+ "verify": "npm run build && npm run format:check && npm run lint && node --test ./test/*.test.mjs",
48
46
  "test": "npm run verify && npm run pack:verify"
49
47
  },
50
- "peerDependencies": {
51
- "@earendil-works/pi-coding-agent": "*",
52
- "@earendil-works/pi-tui": "*",
53
- "typebox": "*"
54
- },
55
48
  "devDependencies": {
56
49
  "@earendil-works/pi-coding-agent": "^0.84.1",
57
50
  "@earendil-works/pi-tui": "^0.84.1",
58
51
  "@types/node": "24.12.4",
52
+ "oxfmt": "^0.63.0",
53
+ "oxlint": "^1.78.0",
54
+ "oxlint-tsgolint": "^7.0.2001",
59
55
  "typebox": "1.1.38",
60
56
  "typescript": "5.9.3"
57
+ },
58
+ "peerDependencies": {
59
+ "@earendil-works/pi-coding-agent": "*",
60
+ "@earendil-works/pi-tui": "*",
61
+ "typebox": "*"
62
+ },
63
+ "engines": {
64
+ "node": ">=22.19.0"
65
+ },
66
+ "pi": {
67
+ "extensions": [
68
+ "./src/index.ts"
69
+ ]
61
70
  }
62
71
  }
package/src/engine.ts CHANGED
@@ -40,11 +40,9 @@ export class AheadEngine {
40
40
  static async load(path: string): Promise<AheadEngine> {
41
41
  const bytes = await readFile(path);
42
42
  const instantiated = await WebAssembly.instantiate(bytes, {});
43
- const wasm = instantiated.instance.exports as WasmExports;
44
- for (const name of ["memory", "ahead_alloc", "ahead_dealloc", "ahead_dispatch"]) {
45
- if (!(name in wasm)) {
46
- throw new Error(`AHEAD WebAssembly module is missing export: ${name}`);
47
- }
43
+ const wasm = instantiated.instance.exports;
44
+ if (!isWasmExports(wasm)) {
45
+ throw new Error("AHEAD WebAssembly module does not expose the required engine ABI");
48
46
  }
49
47
  return new AheadEngine(wasm);
50
48
  }
@@ -53,12 +51,16 @@ export class AheadEngine {
53
51
  return this.call("get_workflow", { workflow_id: workflowId });
54
52
  }
55
53
 
54
+ listWorkflows(): WorkflowDefinition[] {
55
+ return this.call("list_workflows", {});
56
+ }
57
+
56
58
  createRun(input: {
57
59
  id: string;
58
60
  title: string;
59
61
  owner: Actor;
60
62
  timestamp: string;
61
- workflow_id?: string;
63
+ workflow_id: string;
62
64
  }): Run {
63
65
  return this.call("create_run", input);
64
66
  }
@@ -78,10 +80,14 @@ export class AheadEngine {
78
80
  });
79
81
  }
80
82
 
81
- toolAllowed(run: Run, capability: Capability): { allowed: boolean; reason: string; capability: Capability } {
83
+ toolAllowed(
84
+ run: Run,
85
+ capability: Capability,
86
+ ): { allowed: boolean; reason: string; capability: Capability } {
82
87
  return this.call("tool_allowed", { run, capability });
83
88
  }
84
89
 
90
+ // oxlint-disable-next-line typescript/no-unnecessary-type-parameters -- the operation selects the Rust response type
85
91
  private call<T>(operation: string, input: unknown): T {
86
92
  const request = new TextEncoder().encode(
87
93
  JSON.stringify({ api_version: ENGINE_API_VERSION, operation, input }),
@@ -96,9 +102,13 @@ export class AheadEngine {
96
102
  outputPointer = Number(packed >> 32n);
97
103
  outputLength = Number(packed & 0xffff_ffffn);
98
104
  const output = new Uint8Array(this.wasm.memory.buffer, outputPointer, outputLength).slice();
105
+ // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- the versioned Rust ABI owns this response envelope
99
106
  const response = JSON.parse(new TextDecoder().decode(output)) as EngineResponse<T>;
100
107
  if (!response.ok || response.result === undefined) {
101
- const error = response.error ?? { code: "unknown_engine_error", message: "AHEAD engine call failed" };
108
+ const error = response.error ?? {
109
+ code: "unknown_engine_error",
110
+ message: "AHEAD engine call failed",
111
+ };
102
112
  throw new AheadEngineError(error.code, error.message);
103
113
  }
104
114
  return response.result;
@@ -110,3 +120,12 @@ export class AheadEngine {
110
120
  }
111
121
  }
112
122
  }
123
+
124
+ function isWasmExports(exports: WebAssembly.Exports): exports is WasmExports {
125
+ return (
126
+ exports.memory instanceof WebAssembly.Memory &&
127
+ typeof exports.ahead_alloc === "function" &&
128
+ typeof exports.ahead_dealloc === "function" &&
129
+ typeof exports.ahead_dispatch === "function"
130
+ );
131
+ }