@azure-id/orc 1.9.2 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/CHANGELOG.md +321 -0
  2. package/README-id.md +21 -36
  3. package/README.md +25 -36
  4. package/bin/build-agents.js +117 -20
  5. package/bin/cli.js +725 -29
  6. package/bin/gotcha-import.js +1081 -0
  7. package/bin/gotcha.js +1286 -0
  8. package/bin/graph-query.js +1 -1
  9. package/bin/graph.js +717 -717
  10. package/bin/habit.js +1453 -0
  11. package/bin/mockrun-catalog.js +281 -276
  12. package/bin/run-undo.js +398 -0
  13. package/bin/trace-write.js +657 -0
  14. package/bin/verify-contracts.js +525 -79
  15. package/bin/verify-package.js +51 -4
  16. package/bin/webui/api.js +26 -0
  17. package/bin/webui/app.html +239 -232
  18. package/bin/webui/css/00-tokens.css +110 -92
  19. package/bin/webui/css/04-motion.css +87 -0
  20. package/bin/webui/css/06-responsive.css +203 -178
  21. package/bin/webui/css/panels/behaviour.css +205 -0
  22. package/bin/webui/fixtures/behaviour.js +532 -0
  23. package/bin/webui/fixtures/index.js +34 -0
  24. package/bin/webui/fixtures/knowledge.js +7 -1
  25. package/bin/webui/fixtures/stats.js +16 -0
  26. package/bin/webui/i18n/en/behaviour.json +143 -0
  27. package/bin/webui/i18n/en/nav.json +25 -24
  28. package/bin/webui/i18n/en/tour.json +37 -35
  29. package/bin/webui/i18n/id/behaviour.json +143 -0
  30. package/bin/webui/i18n/id/nav.json +25 -24
  31. package/bin/webui/i18n/id/tour.json +37 -35
  32. package/bin/webui/js/01-i18n.js +155 -154
  33. package/bin/webui/js/90-tour.js +498 -494
  34. package/bin/webui/js/91-shortcuts.js +126 -126
  35. package/bin/webui/js/99-boot.js +121 -118
  36. package/bin/webui/js/panels/behaviour.js +1022 -0
  37. package/mock-run/INDEX.md +109 -107
  38. package/mock-run/gotcha-import.md +118 -0
  39. package/mock-run/habits.md +129 -0
  40. package/mock-run/orc-quick.md +6 -1
  41. package/package.json +1 -1
  42. package/templates/agents/MODEL-MAPPING.md +7 -7
  43. package/templates/agents/orc-advisor-opus-5-xhigh.md +1 -7
  44. package/templates/agents/orc-analyze-mini-opus-5-med.md +1 -6
  45. package/templates/agents/orc-analyze-mini-sonnet-5-high.md +1 -4
  46. package/templates/agents/orc-claude-writer-opus-4-8-high.md +48 -53
  47. package/templates/agents/orc-claude-writer-opus-5-med.md +1 -8
  48. package/templates/agents/orc-context-combiner-opus-5-high.md +1 -11
  49. package/templates/agents/orc-executor-haiku-4-5.md +14 -6
  50. package/templates/agents/orc-executor-opus-4-7-high.md +14 -6
  51. package/templates/agents/orc-executor-opus-4-7-med.md +14 -6
  52. package/templates/agents/orc-executor-opus-4-8-high.md +14 -6
  53. package/templates/agents/orc-executor-opus-5-high.md +14 -6
  54. package/templates/agents/orc-executor-opus-5-low.md +14 -6
  55. package/templates/agents/orc-executor-opus-5-med.md +14 -6
  56. package/templates/agents/orc-executor-sonnet-4-6-high.md +14 -6
  57. package/templates/agents/orc-executor-sonnet-4-6-med.md +14 -6
  58. package/templates/agents/orc-executor-sonnet-5-high.md +14 -6
  59. package/templates/agents/orc-graph-noter-sonnet-4-6-med.md +1 -10
  60. package/templates/agents/orc-judge-opus-5-xhigh.md +5 -9
  61. package/templates/agents/orc-learn-writer-opus-5-low.md +1 -7
  62. package/templates/agents/orc-pattern-codifier-opus-5-med.md +1 -8
  63. package/templates/agents/orc-pattern-codifier-sonnet-5-high.md +58 -63
  64. package/templates/agents/orc-planner-mini-opus-5-med.md +1 -4
  65. package/templates/agents/orc-planner-mini-sonnet-5-high.md +1 -2
  66. package/templates/agents/orc-planner-opus-5-med.md +1 -4
  67. package/templates/agents/orc-recon-opus-5-low.md +1 -8
  68. package/templates/agents/orc-recon-sonnet-4-6-med.md +1 -8
  69. package/templates/agents/orc-retro-opus-5-med.md +6 -8
  70. package/templates/agents/orc-retro-sonnet-5-high.md +6 -7
  71. package/templates/agents/orc-reviewer-opus-5-med.md +52 -16
  72. package/templates/agents/orc-scout-opus-5-low.md +1 -6
  73. package/templates/agents/orc-scout-sonnet-4-6-high.md +35 -39
  74. package/templates/agents/orc-system-analyst-opus-5-high.md +1 -6
  75. package/templates/agents/orc-test-author-opus-5-med.md +4 -5
  76. package/templates/agents/orc-trace-writer-haiku-4-5.md +3 -7
  77. package/templates/agents/orc-verifier-opus-5-med.md +16 -8
  78. package/templates/agents/orc-wiki-scanner-opus-4-8-high.md +74 -79
  79. package/templates/agents/orc-wiki-scanner-opus-5-med.md +1 -8
  80. package/templates/agents/orc-wiki-scanner-sonnet-5-high.md +97 -106
  81. package/templates/commands/orc-analyze.md +13 -21
  82. package/templates/commands/orc-fast.md +10 -15
  83. package/templates/commands/orc-poly.md +12 -21
  84. package/templates/commands/orc-pr-driver.md +11 -30
  85. package/templates/commands/orc-pr-setup.md +10 -31
  86. package/templates/commands/orc-route.md +11 -41
  87. package/templates/commands/orc-test.md +5 -60
  88. package/templates/hooks/README.md +34 -0
  89. package/templates/hooks/orc-session-hook.js +264 -0
  90. package/templates/hooks/orc-statusline.js +3 -1
  91. package/templates/skills/_shared/README.md +9 -0
  92. package/templates/skills/_shared/code-graph.md +47 -55
  93. package/templates/skills/_shared/config-precedence.md +3 -1
  94. package/templates/skills/_shared/extra-dispatch.md +73 -88
  95. package/templates/skills/_shared/gotchas.md +228 -177
  96. package/templates/skills/_shared/habits.md +101 -0
  97. package/templates/skills/_shared/lane-contract.md +84 -0
  98. package/templates/skills/_shared/phases/README.md +142 -83
  99. package/templates/skills/_shared/phases/analyst-gates.md +10 -21
  100. package/templates/skills/_shared/phases/execution.md +8 -14
  101. package/templates/skills/_shared/phases/house-rules.md +27 -32
  102. package/templates/skills/_shared/phases/intake.md +127 -133
  103. package/templates/skills/_shared/phases/mock-example.md +46 -56
  104. package/templates/skills/_shared/phases/plan-handoff.md +91 -97
  105. package/templates/skills/_shared/phases/planning.md +7 -17
  106. package/templates/skills/_shared/phases/preflight.md +19 -42
  107. package/templates/skills/_shared/phases/review.md +23 -27
  108. package/templates/skills/_shared/phases/rules.md +18 -42
  109. package/templates/skills/_shared/phases/scoring.md +55 -65
  110. package/templates/skills/_shared/phases/security-checklist.md +46 -50
  111. package/templates/skills/_shared/phases/security.md +45 -55
  112. package/templates/skills/_shared/phases/ship.md +6 -15
  113. package/templates/skills/_shared/phases/stop-resume.md +2 -5
  114. package/templates/skills/_shared/phases/summary.md +73 -48
  115. package/templates/skills/_shared/phases/testgen.md +41 -51
  116. package/templates/skills/_shared/phases/trace-verbs.md +433 -0
  117. package/templates/skills/_shared/phases/trace.md +136 -367
  118. package/templates/skills/_shared/phases/verify.md +62 -70
  119. package/templates/skills/_shared/phases/wave-grouping.md +128 -133
  120. package/templates/skills/_shared/phases/wiki-consult.md +10 -6
  121. package/templates/skills/_shared/read-ladder.md +2 -55
  122. package/templates/skills/_shared/return-validation.md +17 -70
  123. package/templates/skills/_shared/review-slice.md +79 -0
  124. package/templates/skills/_shared/smoke-gate.md +46 -28
  125. package/templates/skills/context-combiner/SKILL.md +15 -44
  126. package/templates/skills/orc/SKILL.md +34 -62
  127. package/templates/skills/orc/references/pattern-gate.md +89 -89
  128. package/templates/skills/orc/references/phases/intake.md +41 -47
  129. package/templates/skills/orc/references/phases/integration.md +13 -19
  130. package/templates/skills/orc/references/preflight-report.md +8 -9
  131. package/templates/skills/orc/references/ultra-mode.md +8 -6
  132. package/templates/skills/orc/subskills/orc-execution/SKILL.md +27 -73
  133. package/templates/skills/orc/subskills/orc-execution/core.md +12 -99
  134. package/templates/skills/orc/subskills/orc-execution/subagent.md +14 -13
  135. package/templates/skills/orc/subskills/orc-review-verify/SKILL.md +11 -52
  136. package/templates/skills/orc/subskills/orc-review-verify/core.md +52 -135
  137. package/templates/skills/orc/subskills/orc-review-verify/subagent.md +7 -7
  138. package/templates/skills/orc/subskills/orc-testgen/SKILL.md +11 -22
  139. package/templates/skills/orc/subskills/orc-testgen/core.md +20 -59
  140. package/templates/skills/orc/subskills/orc-testgen/subagent.md +7 -7
  141. package/templates/skills/orc-advisor/SKILL.md +56 -60
  142. package/templates/skills/orc-analyze/SKILL.md +30 -66
  143. package/templates/skills/orc-analyze/schemas/report-audit.md +2 -1
  144. package/templates/skills/orc-analyze/schemas/report-prose.md +2 -1
  145. package/templates/skills/orc-analyze-mini/SKILL.md +35 -70
  146. package/templates/skills/orc-diy/README.md +31 -0
  147. package/templates/skills/orc-diy/SKILL.md +23 -74
  148. package/templates/skills/orc-diy/references/blocks/pattern.md +18 -18
  149. package/templates/skills/orc-fast/SKILL.md +44 -72
  150. package/templates/skills/orc-judge/SKILL.md +77 -82
  151. package/templates/skills/orc-mini/SKILL.md +61 -109
  152. package/templates/skills/orc-pattern/SKILL.md +27 -48
  153. package/templates/skills/orc-poly/SKILL.md +32 -61
  154. package/templates/skills/orc-pr-driver/SKILL.md +25 -51
  155. package/templates/skills/orc-pr-driver/references/green-gate.md +113 -105
  156. package/templates/skills/orc-pr-setup/SKILL.md +20 -45
  157. package/templates/skills/orc-quick/README.md +43 -2
  158. package/templates/skills/orc-quick/SKILL.md +76 -107
  159. package/templates/skills/orc-quick/references/dispatch-gate.md +16 -5
  160. package/templates/skills/orc-quick/references/gh-mode.md +48 -1
  161. package/templates/skills/orc-quick/references/look.md +3 -1
  162. package/templates/skills/orc-retro/SKILL.md +19 -18
  163. package/templates/skills/orc-retro/examples/retro-mock.md +1 -1
  164. package/templates/skills/orc-route/SKILL.md +25 -45
  165. package/templates/skills/orc-test/SKILL.md +16 -37
  166. package/templates/skills/orc-verify/SKILL.md +14 -32
  167. package/templates/skills/orc-wait/SKILL.md +156 -163
  168. package/templates/skills/orc-wiki/references/phases/phase-0.md +1 -6
  169. package/templates/skills/orc-wiki/references/phases/phase-1.md +1 -6
  170. package/templates/skills/orc-wiki/references/phases/phase-2.md +1 -6
  171. package/templates/skills/orc-wiki/references/phases/phase-3.md +1 -6
  172. package/templates/skills/orc-wiki/references/phases/phase-3c.md +1 -6
@@ -46,6 +46,7 @@ const required = [
46
46
  "bin/webui/css/panels/mockrun.css",
47
47
  "bin/webui/css/panels/maintenance.css",
48
48
  "bin/webui/css/panels/pact.css",
49
+ "bin/webui/css/panels/behaviour.css",
49
50
  "bin/webui/css/panels/boundary.css",
50
51
  "bin/webui/css/panels/wait.css",
51
52
  "bin/webui/css/panels/hookui.css",
@@ -78,6 +79,7 @@ const required = [
78
79
  "bin/webui/js/panels/experiment.js",
79
80
  "bin/webui/js/panels/maintenance.js",
80
81
  "bin/webui/js/panels/pact.js",
82
+ "bin/webui/js/panels/behaviour.js",
81
83
  "bin/webui/js/panels/boundary.js",
82
84
  "bin/webui/js/panels/wait.js",
83
85
  "bin/webui/js/panels/hookui.js",
@@ -101,6 +103,7 @@ const required = [
101
103
  "bin/webui/fixtures/runs.js",
102
104
  "bin/webui/fixtures/stats.js",
103
105
  "bin/webui/fixtures/pact.js",
106
+ "bin/webui/fixtures/behaviour.js",
104
107
  "bin/webui/fixtures/boundary.js",
105
108
  "bin/webui/fixtures/wait.js",
106
109
  "bin/webui/fixtures/hookui.js",
@@ -136,6 +139,7 @@ const required = [
136
139
  "bin/webui/i18n/en/mockrun.json",
137
140
  "bin/webui/i18n/en/maintenance.json",
138
141
  "bin/webui/i18n/en/pact.json",
142
+ "bin/webui/i18n/en/behaviour.json",
139
143
  "bin/webui/i18n/en/boundary.json",
140
144
  "bin/webui/i18n/en/wait.json",
141
145
  "bin/webui/i18n/en/hookui.json",
@@ -162,6 +166,7 @@ const required = [
162
166
  "bin/webui/i18n/id/mockrun.json",
163
167
  "bin/webui/i18n/id/maintenance.json",
164
168
  "bin/webui/i18n/id/pact.json",
169
+ "bin/webui/i18n/id/behaviour.json",
165
170
  "bin/webui/i18n/id/boundary.json",
166
171
  "bin/webui/i18n/id/wait.json",
167
172
  "bin/webui/i18n/id/hookui.json",
@@ -202,6 +207,22 @@ const required = [
202
207
  // the only answer that says WHY a THIN map is thin. Without it the status
203
208
  // line still says THIN and names a command that is not there.
204
209
  "bin/graph-audit.js",
210
+ // v2.0.0 W2 — the habit engine. `orc habit` requires it, and so do
211
+ // `orc lane config` and `orc config list` when `habits` is not off — a publish
212
+ // that drops it breaks the resolver for every lane that turned habits on.
213
+ "bin/habit.js",
214
+ // v2.0.0 W4 / W6a — the gotchas engine and its importers. `orc gotcha` and
215
+ // `orc lane config` require the first; `import`, `sync`, `orc pr threads`
216
+ // and `orc ci failed` require the second. A publish that drops the importer
217
+ // makes every review step's sync fail — silently, because a sync never blocks.
218
+ "bin/gotcha.js",
219
+ "bin/gotcha-import.js",
220
+ // v2.0.0 T21 — the trace pen. `orc trace write` requires it; a publish that
221
+ // drops it sends every lane to the Haiku fallback on every phase close.
222
+ "bin/trace-write.js",
223
+ // v2.0.0 W6b — `orc run snapshot` + `orc undo`. A publish that drops it
224
+ // leaves every end-of-run card printing an undo command that crashes.
225
+ "bin/run-undo.js",
205
226
 
206
227
  // The two DATED data files (v0.50.0). Both ship inside the package and both
207
228
  // are load-bearing on absence rather than on content: without the catalog
@@ -368,6 +389,18 @@ const required = [
368
389
  // trimmed lane reading a full-lane procedure.
369
390
  "templates/skills/_shared/phases/README.md",
370
391
  "templates/skills/_shared/phases/trace.md",
392
+ // v2.0.0 T1 — the CLOSED verb table, split out of trace.md and read on
393
+ // demand. A publish missing it leaves every lane's fallback for a verb not
394
+ // in `trace_grammar` pointing at nothing.
395
+ "templates/skills/_shared/phases/trace-verbs.md",
396
+ // v2.0.0 T3 — the common text of the coding-lane spine blocks. A publish
397
+ // missing it leaves every exit ≠ 0 fallback pointing at nothing.
398
+ "templates/skills/_shared/lane-contract.md",
399
+ // v2.0.0 W3 — the lane side of habits, read on demand. A publish missing it
400
+ // leaves every `(H <qid>)` mark pointing at nothing once habits is on.
401
+ "templates/skills/_shared/habits.md",
402
+ // v2.0.0 W5a — the one review slice, read on demand at a review dispatch.
403
+ "templates/skills/_shared/review-slice.md",
371
404
  "templates/skills/_shared/phases/preflight.md",
372
405
  "templates/skills/_shared/phases/stop-resume.md",
373
406
  // v1.0.0 W12 — the seven files that were already SHARED while living in one
@@ -431,8 +464,10 @@ const required = [
431
464
  // v1.8.0 — the code graph's notes writer (Layer 2).
432
465
  "templates/agents/orc-graph-noter-sonnet-4-6-med.md",
433
466
  // Core non-generated agents — named explicitly so a dropped file is REPORTED
434
- // by name, not merely absorbed by the count floor. (The 8 executor agents are
435
- // checked separately by `build-agents.js --check`.)
467
+ // by name, not merely absorbed by the count floor. (The 10 executor agents are
468
+ // checked separately by `build-agents.js --check`. v2.0.0 T15: the 16 model
469
+ // twins below are GENERATED too — from agents-src/twins/ — and `--check`
470
+ // guards their content; this list still guards that each one ships.)
436
471
  "templates/agents/orc-system-analyst-opus-5-high.md",
437
472
  "templates/agents/orc-planner-opus-5-med.md",
438
473
  "templates/agents/orc-reviewer-opus-5-med.md",
@@ -522,6 +557,9 @@ const required = [
522
557
  // the ORCHESTRATOR. Ships wired but OFF; `read_gate` arms it.
523
558
  "templates/hooks/orc-read-gate.js",
524
559
  "templates/hooks/orc-trace.js",
560
+ // v2.0.0 W6c — the session hook: the bell at a run's turn end (Q8, `notify`,
561
+ // off by default) and the run pointer after a compaction (Q9).
562
+ "templates/hooks/orc-session-hook.js",
525
563
  ];
526
564
 
527
565
  const missing = [];
@@ -624,13 +662,22 @@ function scanEncoding(dir, hits) {
624
662
  if (!fs.existsSync(dir)) return;
625
663
  const st = fs.statSync(dir);
626
664
  if (st.isFile()) {
627
- let text;
665
+ let buf;
628
666
  try {
629
- text = fs.readFileSync(dir, "utf8");
667
+ buf = fs.readFileSync(dir);
630
668
  } catch (_) {
631
669
  return; // unreadable → not our concern here
632
670
  }
633
671
  const rel = path.relative(ROOT, dir).replace(/\\/g, "/");
672
+ // v2.0.0 Q10 — a raw 0x00 byte. Grep and ripgrep then treat the WHOLE file as
673
+ // binary and stop reporting matches after it, so every agent that greps the
674
+ // file gets a partial answer. Write the "\u0000" escape instead.
675
+ const nul = buf.indexOf(0);
676
+ if (nul >= 0) {
677
+ hits.push(`${rel} (raw NUL byte at offset ${nul} — write the "\\u0000" escape)`);
678
+ return;
679
+ }
680
+ const text = buf.toString("utf8");
634
681
  // Reference U+FFFD via escape, never as a literal, so this scanner does not
635
682
  // flag its own source.
636
683
  if (text.includes(REPL)) hits.push(`${rel} (U+FFFD replacement char — corrupted bytes)`);
package/bin/webui/api.js CHANGED
@@ -453,6 +453,22 @@ const READS = {
453
453
  "/api/test/ui": () => ["test", "ui", "tools"],
454
454
  "/api/patterns": () => ["pattern", "status"],
455
455
  "/api/gotchas": () => ["gotcha", "list"],
456
+ // v2.0.0 W7 — the Behaviour panel. Every one is a CLI read, and every exit
457
+ // code is DATA: `habit show` 0 · 1 no ASK lines yet · 3 `habits: off`;
458
+ // `habit log` 0 · 1 empty; `gotcha card` 0 · 1 no match (an ANSWER: no card);
459
+ // `gotcha quality` 0 · 1 below the 5-review floor. The window is DROPPED
460
+ // unless it is one of the three the CLI knows — a query string is user input.
461
+ "/api/habits": (q) => (["30d", "90d", "all"].includes(String(q.window || "")) ? ["habit", "show", "--window", String(q.window)] : ["habit", "show"]),
462
+ "/api/habits/log": () => ["habit", "log", "--limit", "40"],
463
+ "/api/habits/states": () => ["habit", "log", "--states"],
464
+ "/api/habits/points": () => ["habit", "points"],
465
+ "/api/gotcha/card": (q) => ["gotcha", "card", "--files", String(q.files || ""), "--full"],
466
+ // The panel window (30d · 90d · all) in the days `gotcha quality --window` takes.
467
+ "/api/gotcha/quality": (q) => {
468
+ const days = { "30d": "30", "90d": "90", all: "3650" }[String(q.window || "")];
469
+ return days ? ["gotcha", "quality", "--window", days] : ["gotcha", "quality"];
470
+ },
471
+ "/api/gotcha/candidates": () => ["gotcha", "list", "--candidates"],
456
472
  "/api/stats": (q) => (q.since ? ["stats", "--since", String(q.since)] : ["stats"]),
457
473
  "/api/diy": () => ["diy", "show"],
458
474
  "/api/crosslink": () => ["crosslink", "list"],
@@ -555,6 +571,16 @@ const WRITES = {
555
571
  "/api/graph/update": () => ["graph", "update"],
556
572
  "/api/wiki/usage/rebuild": () => ["wiki", "usage", "--rebuild"],
557
573
  "/api/gotcha/prune": () => ["gotcha", "prune"],
574
+ // v2.0.0 W7 — the Behaviour panel writes. FREE, local and reversible: each
575
+ // one changes `.claude/orc/habits-state.json` only (or promotes ONE gotcha
576
+ // candidate), and each is a person's click on a confirmation that names the
577
+ // command. `--by panel` is how the history says who made the change. The
578
+ // learning switch itself is `/api/config/set` — no second route for it.
579
+ "/api/habit/accept": (b) => ["habit", "accept", String(b.id), "--by", "panel"],
580
+ "/api/habit/decline": (b) => (b.never ? ["habit", "decline", String(b.id), "--never", "--by", "panel"] : ["habit", "decline", String(b.id), "--by", "panel"]),
581
+ "/api/habit/forget": (b) => ["habit", "forget", String(b.id), "--by", "panel"],
582
+ "/api/habit/reset": (b) => ["habit", "reset", String(b.id), "--by", "panel"],
583
+ "/api/gotcha/accept": (b) => ["gotcha", "accept", String(b.id)],
558
584
  "/api/pact/check": (b) => (b.id ? ["pact", "check", String(b.id)] : ["pact", "check"]),
559
585
  "/api/pact/sync": () => ["pact", "sync"],
560
586
  // The surface id, the key and the value all come from the browser — and all