@entelligentsia/forgecli 0.6.6 → 0.7.7

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 (187) hide show
  1. package/CHANGELOG.md +112 -0
  2. package/README.md +99 -190
  3. package/dist/bin/forge.js +20 -0
  4. package/dist/bin/forge.js.map +1 -1
  5. package/dist/extensions/forgecli/approve.d.ts +24 -0
  6. package/dist/extensions/forgecli/approve.js +202 -0
  7. package/dist/extensions/forgecli/approve.js.map +1 -0
  8. package/dist/extensions/forgecli/audience-gate.d.ts +4 -0
  9. package/dist/extensions/forgecli/audience-gate.js +8 -5
  10. package/dist/extensions/forgecli/audience-gate.js.map +1 -1
  11. package/dist/extensions/forgecli/collate.d.ts +24 -0
  12. package/dist/extensions/forgecli/collate.js +199 -0
  13. package/dist/extensions/forgecli/collate.js.map +1 -0
  14. package/dist/extensions/forgecli/commit.d.ts +24 -0
  15. package/dist/extensions/forgecli/commit.js +202 -0
  16. package/dist/extensions/forgecli/commit.js.map +1 -0
  17. package/dist/extensions/forgecli/fix-bug.d.ts +75 -0
  18. package/dist/extensions/forgecli/fix-bug.js +1133 -0
  19. package/dist/extensions/forgecli/fix-bug.js.map +1 -0
  20. package/dist/extensions/forgecli/forge-commands.js +7 -0
  21. package/dist/extensions/forgecli/forge-commands.js.map +1 -1
  22. package/dist/extensions/forgecli/forge-header.js +10 -4
  23. package/dist/extensions/forgecli/forge-header.js.map +1 -1
  24. package/dist/extensions/forgecli/forge-init.js +16 -8
  25. package/dist/extensions/forgecli/forge-init.js.map +1 -1
  26. package/dist/extensions/forgecli/forge-subagent.d.ts +29 -0
  27. package/dist/extensions/forgecli/forge-subagent.js +14 -1
  28. package/dist/extensions/forgecli/forge-subagent.js.map +1 -1
  29. package/dist/extensions/forgecli/hook-dispatcher.d.ts +53 -1
  30. package/dist/extensions/forgecli/hook-dispatcher.js +47 -1
  31. package/dist/extensions/forgecli/hook-dispatcher.js.map +1 -1
  32. package/dist/extensions/forgecli/hooks/post-init-hook.d.ts +15 -0
  33. package/dist/extensions/forgecli/hooks/post-init-hook.js +127 -0
  34. package/dist/extensions/forgecli/hooks/post-init-hook.js.map +1 -0
  35. package/dist/extensions/forgecli/hooks/post-sprint-hook.d.ts +37 -0
  36. package/dist/extensions/forgecli/hooks/post-sprint-hook.js +166 -0
  37. package/dist/extensions/forgecli/hooks/post-sprint-hook.js.map +1 -0
  38. package/dist/extensions/forgecli/index.js +56 -5
  39. package/dist/extensions/forgecli/index.js.map +1 -1
  40. package/dist/extensions/forgecli/review-code.d.ts +24 -0
  41. package/dist/extensions/forgecli/review-code.js +202 -0
  42. package/dist/extensions/forgecli/review-code.js.map +1 -0
  43. package/dist/extensions/forgecli/review-plan.d.ts +24 -0
  44. package/dist/extensions/forgecli/review-plan.js +203 -0
  45. package/dist/extensions/forgecli/review-plan.js.map +1 -0
  46. package/dist/extensions/forgecli/run-sprint.d.ts +18 -0
  47. package/dist/extensions/forgecli/run-sprint.js +33 -1
  48. package/dist/extensions/forgecli/run-sprint.js.map +1 -1
  49. package/dist/extensions/forgecli/run-task.d.ts +21 -2
  50. package/dist/extensions/forgecli/run-task.js +33 -9
  51. package/dist/extensions/forgecli/run-task.js.map +1 -1
  52. package/dist/extensions/forgecli/session-registry.d.ts +10 -0
  53. package/dist/extensions/forgecli/session-registry.js +9 -0
  54. package/dist/extensions/forgecli/session-registry.js.map +1 -1
  55. package/dist/extensions/forgecli/validate.d.ts +24 -0
  56. package/dist/extensions/forgecli/validate.js +202 -0
  57. package/dist/extensions/forgecli/validate.js.map +1 -0
  58. package/dist/extensions/forgecli/wf-engine/engine.d.ts +23 -0
  59. package/dist/extensions/forgecli/wf-engine/engine.js +384 -0
  60. package/dist/extensions/forgecli/wf-engine/engine.js.map +1 -0
  61. package/dist/extensions/forgecli/wf-engine/event-parser.d.ts +6 -0
  62. package/dist/extensions/forgecli/wf-engine/event-parser.js +29 -0
  63. package/dist/extensions/forgecli/wf-engine/event-parser.js.map +1 -0
  64. package/dist/extensions/forgecli/wf-engine/id-gen.d.ts +6 -0
  65. package/dist/extensions/forgecli/wf-engine/id-gen.js +17 -0
  66. package/dist/extensions/forgecli/wf-engine/id-gen.js.map +1 -0
  67. package/dist/extensions/forgecli/wf-engine/loader.d.ts +2 -0
  68. package/dist/extensions/forgecli/wf-engine/loader.js +100 -0
  69. package/dist/extensions/forgecli/wf-engine/loader.js.map +1 -0
  70. package/dist/extensions/forgecli/wf-engine/predicate.d.ts +7 -0
  71. package/dist/extensions/forgecli/wf-engine/predicate.js +36 -0
  72. package/dist/extensions/forgecli/wf-engine/predicate.js.map +1 -0
  73. package/dist/extensions/forgecli/wf-engine/prompt-compiler.d.ts +15 -0
  74. package/dist/extensions/forgecli/wf-engine/prompt-compiler.js +23 -0
  75. package/dist/extensions/forgecli/wf-engine/prompt-compiler.js.map +1 -0
  76. package/dist/extensions/forgecli/wf-engine/register.d.ts +9 -0
  77. package/dist/extensions/forgecli/wf-engine/register.js +59 -0
  78. package/dist/extensions/forgecli/wf-engine/register.js.map +1 -0
  79. package/dist/extensions/forgecli/wf-engine/remit-check.d.ts +6 -0
  80. package/dist/extensions/forgecli/wf-engine/remit-check.js +42 -0
  81. package/dist/extensions/forgecli/wf-engine/remit-check.js.map +1 -0
  82. package/dist/extensions/forgecli/wf-engine/state-store.d.ts +13 -0
  83. package/dist/extensions/forgecli/wf-engine/state-store.js +43 -0
  84. package/dist/extensions/forgecli/wf-engine/state-store.js.map +1 -0
  85. package/dist/extensions/forgecli/wf-engine/types.d.ts +66 -0
  86. package/dist/extensions/forgecli/wf-engine/types.js +2 -0
  87. package/dist/extensions/forgecli/wf-engine/types.js.map +1 -0
  88. package/dist/extensions/forgecli/wf-engine/worker.d.ts +11 -0
  89. package/dist/extensions/forgecli/wf-engine/worker.js +50 -0
  90. package/dist/extensions/forgecli/wf-engine/worker.js.map +1 -0
  91. package/dist/forge-payload/.base-pack/workflows/_fragments/context-injection.md +10 -4
  92. package/dist/forge-payload/.base-pack/workflows/fix_bug.md +12 -0
  93. package/dist/forge-payload/.schemas/bug.schema.json +4 -2
  94. package/dist/forge-payload/.schemas/event.schema.json +22 -3
  95. package/dist/forge-payload/commands/add-pipeline.md +342 -0
  96. package/dist/forge-payload/commands/add-task.md +269 -0
  97. package/dist/forge-payload/commands/ask.md +43 -0
  98. package/dist/forge-payload/commands/calibrate.md +356 -0
  99. package/dist/forge-payload/commands/config.md +202 -0
  100. package/dist/forge-payload/commands/enhance.md +38 -0
  101. package/dist/forge-payload/commands/health.md +225 -0
  102. package/dist/forge-payload/commands/init.md +165 -0
  103. package/dist/forge-payload/commands/materialize.md +119 -0
  104. package/dist/forge-payload/commands/migrate.md +160 -0
  105. package/dist/forge-payload/commands/quiz-agent.md +38 -0
  106. package/dist/forge-payload/commands/regenerate.md +673 -0
  107. package/dist/forge-payload/commands/remove.md +174 -0
  108. package/dist/forge-payload/commands/report-bug.md +191 -0
  109. package/dist/forge-payload/commands/store-query.md +73 -0
  110. package/dist/forge-payload/commands/store-repair.md +187 -0
  111. package/dist/forge-payload/commands/update-tools.md +56 -0
  112. package/dist/forge-payload/commands/update.md +1376 -0
  113. package/dist/forge-payload/tools/preflight-gate.cjs +2 -1
  114. package/dist/forge-payload/tools/read-verdict.cjs +41 -8
  115. package/dist/forge-payload/tools/store-cli.cjs +4 -3
  116. package/node_modules/argparse/CHANGELOG.md +216 -0
  117. package/node_modules/argparse/LICENSE +254 -0
  118. package/node_modules/argparse/README.md +84 -0
  119. package/node_modules/argparse/argparse.js +3707 -0
  120. package/node_modules/argparse/lib/sub.js +67 -0
  121. package/node_modules/argparse/lib/textwrap.js +440 -0
  122. package/node_modules/argparse/package.json +31 -0
  123. package/node_modules/cliui/CHANGELOG.md +121 -0
  124. package/node_modules/color-convert/CHANGELOG.md +54 -0
  125. package/node_modules/esprima/ChangeLog +235 -0
  126. package/node_modules/js-yaml/LICENSE +21 -0
  127. package/node_modules/js-yaml/README.md +247 -0
  128. package/node_modules/js-yaml/bin/js-yaml.js +126 -0
  129. package/node_modules/js-yaml/dist/js-yaml.js +3880 -0
  130. package/node_modules/js-yaml/dist/js-yaml.min.js +2 -0
  131. package/node_modules/js-yaml/dist/js-yaml.mjs +3856 -0
  132. package/node_modules/js-yaml/index.js +47 -0
  133. package/node_modules/js-yaml/lib/common.js +59 -0
  134. package/node_modules/js-yaml/lib/dumper.js +965 -0
  135. package/node_modules/js-yaml/lib/exception.js +55 -0
  136. package/node_modules/js-yaml/lib/loader.js +1733 -0
  137. package/node_modules/js-yaml/lib/schema/core.js +11 -0
  138. package/node_modules/js-yaml/lib/schema/default.js +22 -0
  139. package/node_modules/js-yaml/lib/schema/failsafe.js +17 -0
  140. package/node_modules/js-yaml/lib/schema/json.js +19 -0
  141. package/node_modules/js-yaml/lib/schema.js +121 -0
  142. package/node_modules/js-yaml/lib/snippet.js +101 -0
  143. package/node_modules/js-yaml/lib/type/binary.js +125 -0
  144. package/node_modules/js-yaml/lib/type/bool.js +35 -0
  145. package/node_modules/js-yaml/lib/type/float.js +97 -0
  146. package/node_modules/js-yaml/lib/type/int.js +156 -0
  147. package/node_modules/js-yaml/lib/type/map.js +8 -0
  148. package/node_modules/js-yaml/lib/type/merge.js +12 -0
  149. package/node_modules/js-yaml/lib/type/null.js +35 -0
  150. package/node_modules/js-yaml/lib/type/omap.js +44 -0
  151. package/node_modules/js-yaml/lib/type/pairs.js +53 -0
  152. package/node_modules/js-yaml/lib/type/seq.js +8 -0
  153. package/node_modules/js-yaml/lib/type/set.js +29 -0
  154. package/node_modules/js-yaml/lib/type/str.js +8 -0
  155. package/node_modules/js-yaml/lib/type/timestamp.js +88 -0
  156. package/node_modules/js-yaml/lib/type.js +66 -0
  157. package/node_modules/js-yaml/package.json +66 -0
  158. package/node_modules/mz/HISTORY.md +66 -0
  159. package/node_modules/proper-lockfile/CHANGELOG.md +108 -0
  160. package/node_modules/source-map/CHANGELOG.md +301 -0
  161. package/node_modules/thenify/History.md +11 -0
  162. package/node_modules/thenify-all/History.md +11 -0
  163. package/node_modules/y18n/CHANGELOG.md +100 -0
  164. package/node_modules/yargs/CHANGELOG.md +88 -0
  165. package/node_modules/yargs-parser/CHANGELOG.md +263 -0
  166. package/package.json +6 -2
  167. package/themes/forge-matrix.json +89 -0
  168. package/themes/forge-mono.json +86 -0
  169. package/workflows/lead-qualifier/prompts/digest.md +44 -0
  170. package/workflows/lead-qualifier/prompts/draft-outreach.md +44 -0
  171. package/workflows/lead-qualifier/prompts/enrich.md +52 -0
  172. package/workflows/lead-qualifier/prompts/intake.md +48 -0
  173. package/workflows/lead-qualifier/prompts/mark-cold.md +38 -0
  174. package/workflows/lead-qualifier/prompts/score.md +45 -0
  175. package/workflows/lead-qualifier/workflow.yaml +95 -0
  176. package/workflows/research-brief/prompts/brief-synthesize.md +43 -0
  177. package/workflows/research-brief/prompts/intake.md +51 -0
  178. package/workflows/research-brief/prompts/source-critique.md +38 -0
  179. package/workflows/research-brief/prompts/source-score.md +38 -0
  180. package/workflows/research-brief/prompts/source-summarize.md +54 -0
  181. package/workflows/research-brief/workflow.yaml +66 -0
  182. package/dist/extensions/forgecli/session-monitor-widget.d.ts +0 -37
  183. package/dist/extensions/forgecli/session-monitor-widget.js +0 -320
  184. package/dist/extensions/forgecli/session-monitor-widget.js.map +0 -1
  185. package/dist/extensions/forgecli/session-monitor.d.ts +0 -2
  186. package/dist/extensions/forgecli/session-monitor.js +0 -135
  187. package/dist/extensions/forgecli/session-monitor.js.map +0 -1
@@ -0,0 +1,38 @@
1
+ # Role
2
+ You are the `mark-cold` node. You run for leads with score < 4.
3
+ You record a brief disposition note and tag the outcome as cold.
4
+
5
+ # Inputs
6
+ - Lead (with score and enrichment):
7
+ {{loop.item}}
8
+
9
+ # Your remit
10
+ Write a 1-sentence rationale for why this lead is being deprioritized (e.g. "Industry
11
+ mismatch", "Headcount too small", "Tech stack misalignment"). Set
12
+ `leads.{{loop.item.id}}.outcome` to `{ "status": "cold", "rationale": "<one sentence>" }`.
13
+
14
+ # Output protocol (MANDATORY)
15
+
16
+ ```json events
17
+ [
18
+ { "type": "started" },
19
+ {
20
+ "type": "success",
21
+ "summary": "Marked {{loop.item.id}} cold",
22
+ "writes": {
23
+ "state": {
24
+ "leads.{{loop.item.id}}.outcome": { "status": "cold", "rationale": "..." }
25
+ }
26
+ }
27
+ }
28
+ ]
29
+ ```
30
+
31
+ On failure:
32
+
33
+ ```json events
34
+ [
35
+ { "type": "started" },
36
+ { "type": "failure", "reason": "cannot-disposition", "details": "<why>" }
37
+ ]
38
+ ```
@@ -0,0 +1,45 @@
1
+ # Role
2
+ You are the `score` node of the per-lead pipeline.
3
+ You assign a single integer fit score 1–5 to ONE lead.
4
+
5
+ # Inputs
6
+ - ICP / target description (from intake): see `state.entryPrompt`
7
+ - Current lead (with enrichment already applied):
8
+ {{loop.item}}
9
+
10
+ # Your remit
11
+ Score the lead's fit on a 1–5 integer scale:
12
+ - 5 = ideal-fit, prioritize immediately
13
+ - 4 = strong-fit, worth outreach
14
+ - 3 = marginal, might warm up later
15
+ - 2 = poor-fit
16
+ - 1 = exclude
17
+
18
+ The number MUST be a plain integer at `loop.item.score`. Downstream branching depends on
19
+ this exact path. Do not nest it inside an object.
20
+
21
+ # Output protocol (MANDATORY)
22
+
23
+ ```json events
24
+ [
25
+ { "type": "started" },
26
+ {
27
+ "type": "success",
28
+ "summary": "Scored {{loop.item.id}} = <N>",
29
+ "writes": {
30
+ "state": {
31
+ "leads.{{loop.item.id}}.score": 4
32
+ }
33
+ }
34
+ }
35
+ ]
36
+ ```
37
+
38
+ On failure:
39
+
40
+ ```json events
41
+ [
42
+ { "type": "started" },
43
+ { "type": "failure", "reason": "cannot-score", "details": "<why>" }
44
+ ]
45
+ ```
@@ -0,0 +1,95 @@
1
+ id: lead-qualifier
2
+ version: 1
3
+ description: >
4
+ Per-lead pipeline demo. For each lead in state.leads: enrich → score → branch on score
5
+ (>=4: draft outreach; else: mark cold) → next lead. Final digest summarizes the cohort.
6
+ Exercises: (a) `loop.group` per-item pipeline, (b) `when:` conditional edges.
7
+
8
+ nodes:
9
+ - id: intake
10
+ prompt: prompts/intake.md
11
+ expects:
12
+ success:
13
+ writes:
14
+ state: [leads]
15
+ failure: {}
16
+
17
+ - id: enrich
18
+ prompt: prompts/enrich.md
19
+ loop:
20
+ over: leads
21
+ alias: loop.item
22
+ group: per-lead
23
+ head: true
24
+ expects:
25
+ success:
26
+ writes:
27
+ state: ["leads.{loop.item.id}.enriched"]
28
+ failure: {}
29
+
30
+ - id: score
31
+ prompt: prompts/score.md
32
+ loop:
33
+ over: leads
34
+ alias: loop.item
35
+ group: per-lead
36
+ expects:
37
+ success:
38
+ writes:
39
+ state: ["leads.{loop.item.id}.score"]
40
+ failure: {}
41
+
42
+ - id: draft-outreach
43
+ prompt: prompts/draft-outreach.md
44
+ loop:
45
+ over: leads
46
+ alias: loop.item
47
+ group: per-lead
48
+ expects:
49
+ success:
50
+ writes:
51
+ artifact: { pattern: "artifacts/outreach/{loop.item.id}.md" }
52
+ state: ["leads.{loop.item.id}.outcome"]
53
+ failure: {}
54
+
55
+ - id: mark-cold
56
+ prompt: prompts/mark-cold.md
57
+ loop:
58
+ over: leads
59
+ alias: loop.item
60
+ group: per-lead
61
+ expects:
62
+ success:
63
+ writes:
64
+ state: ["leads.{loop.item.id}.outcome"]
65
+ failure: {}
66
+
67
+ - id: digest
68
+ prompt: prompts/digest.md
69
+ expects:
70
+ success:
71
+ writes:
72
+ artifact: { pattern: "artifacts/BRIEF.md" }
73
+ failure: {}
74
+
75
+ edges:
76
+ - { from: intake, on: success, to: enrich }
77
+ - { from: intake, on: failure, halt: intake-failed }
78
+
79
+ - { from: enrich, on: success, to: score }
80
+ - { from: enrich, on: failure, advance: loop-or-next }
81
+ - { from: enrich, on: exhausted, to: digest }
82
+
83
+ # Conditional: warm leads (score >= 4) get an outreach draft; everyone else is marked cold.
84
+ - { from: score, on: success, when: "loop.item.score >= 4", to: draft-outreach }
85
+ - { from: score, on: success, to: mark-cold }
86
+ - { from: score, on: failure, advance: loop-or-next }
87
+
88
+ - { from: draft-outreach, on: success, advance: loop-or-next }
89
+ - { from: draft-outreach, on: failure, advance: loop-or-next }
90
+
91
+ - { from: mark-cold, on: success, advance: loop-or-next }
92
+ - { from: mark-cold, on: failure, advance: loop-or-next }
93
+
94
+ - { from: digest, on: success, terminal: complete }
95
+ - { from: digest, on: failure, halt: digest-failed }
@@ -0,0 +1,43 @@
1
+ # Role
2
+ You are the `brief-synthesize` node — produce the final research brief.
3
+
4
+ # Inputs
5
+ - Original question: state.entryPrompt
6
+ - Full state JSON:
7
+ {{state}}
8
+
9
+ # Your remit
10
+ Read every source's summary (artifacts/sources/*.summary.md), its score, and its critique.
11
+ Produce `artifacts/BRIEF.md` — a single document with:
12
+
13
+ - TL;DR (3–5 sentences)
14
+ - Findings (grouped, with inline source citations using the source ids)
15
+ - Open questions (from the critiques)
16
+ - Sources table (id, title, kind, score)
17
+
18
+ # Output protocol (MANDATORY)
19
+
20
+ ```json events
21
+ [
22
+ { "type": "started" },
23
+ {
24
+ "type": "success",
25
+ "summary": "Brief written",
26
+ "writes": {
27
+ "artifact": {
28
+ "path": "artifacts/BRIEF.md",
29
+ "content": "# Research Brief\n\n## TL;DR\n...\n\n## Findings\n...\n\n## Open Questions\n...\n\n## Sources\n| id | title | kind | score |\n|---|---|---|---|\n..."
30
+ }
31
+ }
32
+ }
33
+ ]
34
+ ```
35
+
36
+ On failure:
37
+
38
+ ```json events
39
+ [
40
+ { "type": "started" },
41
+ { "type": "failure", "reason": "cannot-synthesize", "details": "<why>" }
42
+ ]
43
+ ```
@@ -0,0 +1,51 @@
1
+ # Role
2
+ You are the `intake` node of the `research-brief` workflow.
3
+
4
+ # Inputs
5
+ - Workflow instance: {{wf.instanceId}}
6
+ - Working directory: {{wf.workingDir}}
7
+ - Your node exec id: {{node.execId}}
8
+ - Current state JSON:
9
+ {{state}}
10
+
11
+ # Your remit
12
+ Read `state.entryPrompt` (the user's research question). Identify 2 to 4 plausible
13
+ information sources that would help answer it. For each source, produce:
14
+ - `id`: a short kebab-case identifier (e.g. "rfc-9001", "nist-pqc-report")
15
+ - `url`: a real or representative URL
16
+ - `title`: human-readable title
17
+ - `kind`: one of "spec" / "paper" / "report" / "blog" / "doc"
18
+
19
+ # Output protocol (MANDATORY)
20
+ End your reply with a fenced ```json events block. The engine parses ONLY this block.
21
+ Exactly two events: `started`, then `success` (or `failure` if the prompt is unintelligible).
22
+
23
+ Example success:
24
+
25
+ ```json events
26
+ [
27
+ { "type": "started" },
28
+ {
29
+ "type": "success",
30
+ "summary": "Identified 3 sources for post-quantum crypto adoption",
31
+ "writes": {
32
+ "state": {
33
+ "sources": [
34
+ { "id": "nist-pqc", "url": "https://csrc.nist.gov/projects/post-quantum-cryptography", "title": "NIST PQC Project", "kind": "report" },
35
+ { "id": "rfc-9180", "url": "https://www.rfc-editor.org/rfc/rfc9180", "title": "RFC 9180 (HPKE)", "kind": "spec" },
36
+ { "id": "cloudflare-pq", "url": "https://blog.cloudflare.com/pq-2024/", "title": "Cloudflare PQ rollout 2024", "kind": "blog" }
37
+ ]
38
+ }
39
+ }
40
+ }
41
+ ]
42
+ ```
43
+
44
+ Example failure:
45
+
46
+ ```json events
47
+ [
48
+ { "type": "started" },
49
+ { "type": "failure", "reason": "unintelligible-prompt", "details": "entryPrompt was empty or not parseable as a research question" }
50
+ ]
51
+ ```
@@ -0,0 +1,38 @@
1
+ # Role
2
+ You are the `source-critique` node — identify gaps, biases, or follow-up questions for one source.
3
+
4
+ # Inputs
5
+ - Source (loop item):
6
+ {{loop.item}}
7
+
8
+ # Your remit
9
+ Produce a short critique (1–3 bullets) and 1–2 follow-up questions.
10
+
11
+ # Output protocol (MANDATORY)
12
+
13
+ ```json events
14
+ [
15
+ { "type": "started" },
16
+ {
17
+ "type": "success",
18
+ "summary": "Critiqued {{loop.item.id}}",
19
+ "writes": {
20
+ "state": {
21
+ "sources.{{loop.item.id}}.critique": {
22
+ "concerns": ["..."],
23
+ "followUps": ["..."]
24
+ }
25
+ }
26
+ }
27
+ }
28
+ ]
29
+ ```
30
+
31
+ On failure:
32
+
33
+ ```json events
34
+ [
35
+ { "type": "started" },
36
+ { "type": "failure", "reason": "cannot-critique", "details": "<why>" }
37
+ ]
38
+ ```
@@ -0,0 +1,38 @@
1
+ # Role
2
+ You are the `source-score` node — assign quality scores to one source.
3
+
4
+ # Inputs
5
+ - Source (loop item):
6
+ {{loop.item}}
7
+
8
+ # Your remit
9
+ Score the source on three axes, each 1–5:
10
+ - `relevance`: how directly relevant to the research question (state.entryPrompt)
11
+ - `recency`: how recent / current the source is
12
+ - `authority`: how authoritative the source is
13
+
14
+ # Output protocol (MANDATORY)
15
+
16
+ ```json events
17
+ [
18
+ { "type": "started" },
19
+ {
20
+ "type": "success",
21
+ "summary": "Scored {{loop.item.id}}",
22
+ "writes": {
23
+ "state": {
24
+ "sources.{{loop.item.id}}.score": { "relevance": 5, "recency": 4, "authority": 5 }
25
+ }
26
+ }
27
+ }
28
+ ]
29
+ ```
30
+
31
+ On failure:
32
+
33
+ ```json events
34
+ [
35
+ { "type": "started" },
36
+ { "type": "failure", "reason": "cannot-score", "details": "<why>" }
37
+ ]
38
+ ```
@@ -0,0 +1,54 @@
1
+ # Role
2
+ You are the `source-summarize` node of the `research-brief` workflow, executing for one source.
3
+
4
+ # Inputs
5
+ - Workflow instance: {{wf.instanceId}}
6
+ - Your node exec id: {{node.execId}}
7
+ - Current source (loop item):
8
+ {{loop.item}}
9
+
10
+ # Your remit
11
+ Produce a structured summary of the source identified by `loop.item.url` / `loop.item.title`.
12
+ You do not need to actually fetch the URL — write a plausible summary based on the title
13
+ and what such a source typically contains. The summary should include:
14
+
15
+ - thesis: ≤200 chars
16
+ - key-claims: 3–7 bullet points
17
+ - methodology: 1–3 sentences
18
+ - limitations: 1–3 sentences
19
+
20
+ # Output protocol (MANDATORY)
21
+ End your reply with a fenced ```json events block. Exactly two events: `started`, then
22
+ `success` carrying both the artifact (the full markdown summary) and a state write.
23
+
24
+ The artifact path MUST be exactly `artifacts/sources/{{loop.item.id}}.summary.md`.
25
+
26
+ Example:
27
+
28
+ ```json events
29
+ [
30
+ { "type": "started" },
31
+ {
32
+ "type": "success",
33
+ "summary": "Summarized {{loop.item.id}}",
34
+ "writes": {
35
+ "artifact": {
36
+ "path": "artifacts/sources/{{loop.item.id}}.summary.md",
37
+ "content": "# Summary: <title>\n\n## Thesis\n...\n\n## Key Claims\n- ...\n\n## Methodology\n...\n\n## Limitations\n...\n"
38
+ },
39
+ "state": {
40
+ "sources.{{loop.item.id}}.summarized": true
41
+ }
42
+ }
43
+ }
44
+ ]
45
+ ```
46
+
47
+ If you cannot summarize (e.g. source kind is unknown):
48
+
49
+ ```json events
50
+ [
51
+ { "type": "started" },
52
+ { "type": "failure", "reason": "cannot-summarize", "details": "<why>" }
53
+ ]
54
+ ```
@@ -0,0 +1,66 @@
1
+ id: research-brief
2
+ version: 1
3
+ description: Multi-source research brief synthesis — 5-node PoC with 3 loop-body nodes.
4
+
5
+ nodes:
6
+ - id: intake
7
+ prompt: prompts/intake.md
8
+ expects:
9
+ success:
10
+ writes:
11
+ state: [sources]
12
+ failure: {}
13
+
14
+ - id: source-summarize
15
+ prompt: prompts/source-summarize.md
16
+ loop:
17
+ over: sources
18
+ alias: loop.item
19
+ expects:
20
+ success:
21
+ writes:
22
+ artifact: { pattern: "artifacts/sources/{loop.item.id}.summary.md" }
23
+ state: ["sources.{loop.item.id}.summarized"]
24
+ failure: {}
25
+
26
+ - id: source-score
27
+ prompt: prompts/source-score.md
28
+ loop:
29
+ over: sources
30
+ alias: loop.item
31
+ expects:
32
+ success:
33
+ writes:
34
+ state: ["sources.{loop.item.id}.score"]
35
+ failure: {}
36
+
37
+ - id: source-critique
38
+ prompt: prompts/source-critique.md
39
+ loop:
40
+ over: sources
41
+ alias: loop.item
42
+ expects:
43
+ success:
44
+ writes:
45
+ state: ["sources.{loop.item.id}.critique"]
46
+ failure: {}
47
+
48
+ - id: brief-synthesize
49
+ prompt: prompts/brief-synthesize.md
50
+ expects:
51
+ success:
52
+ writes:
53
+ artifact: { pattern: "artifacts/BRIEF.md" }
54
+ failure: {}
55
+
56
+ edges:
57
+ - { from: intake, on: success, to: source-summarize }
58
+ - { from: intake, on: failure, halt: intake-failed }
59
+ - { from: source-summarize, on: success, advance: loop-or-next, next: source-score }
60
+ - { from: source-summarize, on: failure, halt: source-summarize-failed }
61
+ - { from: source-score, on: success, advance: loop-or-next, next: source-critique }
62
+ - { from: source-score, on: failure, halt: source-score-failed }
63
+ - { from: source-critique, on: success, advance: loop-or-next, next: brief-synthesize }
64
+ - { from: source-critique, on: failure, halt: source-critique-failed }
65
+ - { from: brief-synthesize, on: success, terminal: complete }
66
+ - { from: brief-synthesize, on: failure, halt: brief-failed }
@@ -1,37 +0,0 @@
1
- import type { Component } from "@entelligentsia/pi-tui";
2
- import type { Theme } from "@entelligentsia/pi-coding-agent";
3
- interface WidgetDeps {
4
- theme: Theme;
5
- requestRender: () => void;
6
- onClose: () => void;
7
- /** Called once after the widget instance is constructed. The session-monitor
8
- * controller uses this to capture a reference for onTerminalInput routing. */
9
- onMount?: (widget: SessionMonitorWidget) => void;
10
- }
11
- /**
12
- * Build the widget factory expected by ctx.ui.setWidget.
13
- * The factory captures dependencies (theme, render hook, close hook) and
14
- * returns a fresh Component on each setWidget() call.
15
- */
16
- export declare function buildSessionMonitorWidget(deps: Omit<WidgetDeps, "theme">): (tui: unknown, theme: Theme) => Component & {
17
- dispose?(): void;
18
- };
19
- export declare class SessionMonitorWidget implements Component {
20
- private registry;
21
- private listener;
22
- private focusedPane;
23
- private selectedTaskId?;
24
- private selectedEventIndex;
25
- private sessionsList;
26
- private eventsList;
27
- private deps;
28
- private disposed;
29
- constructor(deps: WidgetDeps);
30
- dispose(): void;
31
- invalidate(): void;
32
- handleInput(data: string): void;
33
- render(width: number): string[];
34
- private refreshSessions;
35
- private rebuildEvents;
36
- }
37
- export {};