infernoflow 0.10.14 → 0.10.15

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.
@@ -6,7 +6,7 @@
6
6
  * - UserPromptSubmit: appends the user's prompt to inferno/CONTEXT.draft.md
7
7
  * - Stop: reads transcript_path (JSONL or session JSON), appends last assistant text if found
8
8
  *
9
- * Always prints {"continue":true} so the agent is never blocked. Errors stderr only.
9
+ * Always prints {"continue":true} so the agent is never blocked. Errors → stderr only.
10
10
  */
11
11
  import * as fs from "node:fs";
12
12
  import * as path from "node:path";
@@ -14,7 +14,7 @@ import * as path from "node:path";
14
14
  /** Keep in sync with inferno-promote-draft.mjs / inferno-session-draft.mjs */
15
15
  const DRAFT_HEADER = `# CONTEXT draft (gitignored)
16
16
 
17
- Auto-captured by VS Code / Copilot hooks. **Not product truth** review, then run \`npm run inferno:promote-draft\` or \`infernoflow context\`.
17
+ Auto-captured by VS Code / Copilot hooks. **Not product truth** — review, then run \`npm run inferno:promote-draft\` or \`infernoflow context\`.
18
18
 
19
19
  ---
20
20
  `;
@@ -25,6 +25,25 @@ const MAX_FILE_BYTES = 280_000;
25
25
  function draftPath(root) {
26
26
  return path.join(root, "inferno", "CONTEXT.draft.md");
27
27
  }
28
+ function agentPromptPath(root) { return path.join(root, "inferno", "agent-prompt.md"); }
29
+ function agentResponsePath(root) { return path.join(root, "inferno", "agent-response.json"); }
30
+ function extractJsonFromText(text) {
31
+ const fm = text.match(/```(?:json)?\s*([\s\S]*?)```/);
32
+ if (fm) { try { JSON.parse(fm[1].trim()); return fm[1].trim(); } catch {} }
33
+ const jm = text.match(/\{[\s\S]*\}/);
34
+ if (jm) { try { JSON.parse(jm[0]); return jm[0]; } catch {} }
35
+ return null;
36
+ }
37
+ function maybeWriteAgentResponse(text, root) {
38
+ const pf = agentPromptPath(root), rf = agentResponsePath(root);
39
+ if (!fs.existsSync(pf)) return false;
40
+ const json = extractJsonFromText(text);
41
+ if (!json) return false;
42
+ fs.writeFileSync(rf, json, "utf8");
43
+ try { fs.unlinkSync(pf); } catch {}
44
+ process.stderr.write("[inferno-vscode-copilot-hook] ✔ agent-response.json written\n");
45
+ return true;
46
+ }
28
47
 
29
48
  function ensureDraft(file) {
30
49
  if (!fs.existsSync(file)) {
@@ -160,6 +179,7 @@ function main() {
160
179
  const assistant = lastAssistantFromTranscriptFile(tp);
161
180
  const stopActive = data.stop_hook_active ?? data.stopHookActive;
162
181
  if (assistant) {
182
+ maybeWriteAgentResponse(assistant, root);
163
183
  append(
164
184
  root,
165
185
  `\n### Assistant (from transcript) (${new Date().toISOString()})\n\n${assistant}\n\n---\n`
@@ -168,7 +188,7 @@ function main() {
168
188
  append(
169
189
  root,
170
190
  `\n### _Copilot Stop_ (${new Date().toISOString()})\n\nstop_hook_active: ${Boolean(stopActive)}${
171
- tp ? ` · transcript: ${tp}` : " · (no transcript_path or empty parse)"
191
+ tp ? ` · transcript: ${tp}` : " · (no transcript_path or empty parse)"
172
192
  }\n\n---\n`
173
193
  );
174
194
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "infernoflow",
3
- "version": "0.10.14",
3
+ "version": "0.10.15",
4
4
  "description": "The forge for liquid code — keep capabilities, contracts, and docs in sync.",
5
5
  "type": "module",
6
6
  "bin": {