@yitom/agy-acp-map 0.1.13 → 0.1.14

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.
package/README.md CHANGED
@@ -64,6 +64,21 @@ bun run smoke:all # units + full live matrix
64
64
 
65
65
  **Windows:** install [Bun](https://bun.sh), put `agy` on `PATH`, then the same commands.
66
66
 
67
+ ## Run via bunx / npx (no install, codex-style)
68
+
69
+ The npm tarball is thin (~5MB: `dist/bin.js` + `dist/agy-headless.exe`, no runtime
70
+ needed beyond node/bun). First run downloads `@latest` into the runner cache,
71
+ later runs reuse it:
72
+
73
+ ```powershell
74
+ bunx @yitom/agy-acp-map@latest # bun users (preferred: no prompt, no shim flash)
75
+ npx -y @yitom/agy-acp-map@latest # node users
76
+ ```
77
+
78
+ Requirements are the same as source runs: a logged-in `agy` on `PATH`. The
79
+ optional 95MB single-file `agy-acp-win-x64.exe` is **not** in the npm package —
80
+ grab it from GitHub Releases if you want zero-runtime distribution.
81
+
67
82
 
68
83
  ## Launch flags / 启动参数 (v0.1.2)
69
84
 
Binary file
package/dist/bin.js CHANGED
@@ -12463,7 +12463,7 @@ class SessionHistoryStore {
12463
12463
  filePath(sessionId) {
12464
12464
  return path8.join(this.directory, historyFileName(sessionId));
12465
12465
  }
12466
- appendTurn(sessionId, userText, assistantText) {
12466
+ appendTurn(sessionId, userText, assistantText, opts) {
12467
12467
  const records = [];
12468
12468
  const now = new Date().toISOString();
12469
12469
  if (userText) {
@@ -12483,7 +12483,8 @@ class SessionHistoryStore {
12483
12483
  messageId: `history_agent_${randomUUID2()}`,
12484
12484
  role: "assistant",
12485
12485
  text: assistantText,
12486
- createdAt: new Date().toISOString()
12486
+ createdAt: new Date().toISOString(),
12487
+ ...opts?.partial ? { partial: true } : {}
12487
12488
  });
12488
12489
  }
12489
12490
  if (!records.length)
@@ -12543,7 +12544,7 @@ class SessionHistoryStore {
12543
12544
  var AGENT_INFO = {
12544
12545
  name: "agy-acp",
12545
12546
  title: "agy ACP (stream-json)",
12546
- version: "0.1.13"
12547
+ version: "0.1.14"
12547
12548
  };
12548
12549
  var BRIDGE_CAPABILITIES = {
12549
12550
  prompt: true,
@@ -12792,7 +12793,8 @@ class AgySessionCore {
12792
12793
  }
12793
12794
  persistTurnHistory(sessionId, userText, assistantText, stopReason, eligible = true) {
12794
12795
  try {
12795
- this.historyStore.appendTurn(sessionId, userText, eligible && stopReason !== "cancelled" ? assistantText : undefined);
12796
+ const partial = stopReason === "cancelled" || !eligible;
12797
+ this.historyStore.appendTurn(sessionId, userText, assistantText, partial ? { partial: true } : undefined);
12796
12798
  } catch (err) {
12797
12799
  console.warn(`[ACP-HISTORY] Warning: failed to persist turn ${sessionId}:`, err);
12798
12800
  }
package/dist/index.js CHANGED
@@ -12250,7 +12250,7 @@ class SessionHistoryStore {
12250
12250
  filePath(sessionId) {
12251
12251
  return path8.join(this.directory, historyFileName(sessionId));
12252
12252
  }
12253
- appendTurn(sessionId, userText, assistantText) {
12253
+ appendTurn(sessionId, userText, assistantText, opts) {
12254
12254
  const records = [];
12255
12255
  const now = new Date().toISOString();
12256
12256
  if (userText) {
@@ -12270,7 +12270,8 @@ class SessionHistoryStore {
12270
12270
  messageId: `history_agent_${randomUUID2()}`,
12271
12271
  role: "assistant",
12272
12272
  text: assistantText,
12273
- createdAt: new Date().toISOString()
12273
+ createdAt: new Date().toISOString(),
12274
+ ...opts?.partial ? { partial: true } : {}
12274
12275
  });
12275
12276
  }
12276
12277
  if (!records.length)
@@ -12330,7 +12331,7 @@ class SessionHistoryStore {
12330
12331
  var AGENT_INFO = {
12331
12332
  name: "agy-acp",
12332
12333
  title: "agy ACP (stream-json)",
12333
- version: "0.1.13"
12334
+ version: "0.1.14"
12334
12335
  };
12335
12336
  var BRIDGE_CAPABILITIES = {
12336
12337
  prompt: true,
@@ -12592,7 +12593,8 @@ class AgySessionCore {
12592
12593
  }
12593
12594
  persistTurnHistory(sessionId, userText, assistantText, stopReason, eligible = true) {
12594
12595
  try {
12595
- this.historyStore.appendTurn(sessionId, userText, eligible && stopReason !== "cancelled" ? assistantText : undefined);
12596
+ const partial = stopReason === "cancelled" || !eligible;
12597
+ this.historyStore.appendTurn(sessionId, userText, assistantText, partial ? { partial: true } : undefined);
12596
12598
  } catch (err) {
12597
12599
  console.warn(`[ACP-HISTORY] Warning: failed to persist turn ${sessionId}:`, err);
12598
12600
  }
@@ -5,6 +5,11 @@
5
5
  * only stores the text that an ACP client can display: user prompts and final
6
6
  * assistant text. Tool calls, tool output, thoughts, and internal events are
7
7
  * deliberately excluded.
8
+ *
9
+ * Display/persist parity: whatever text the client actually saw must be
10
+ * reloadable. Interrupted turns (cancelled / failed) still persist their
11
+ * partial text, marked with `partial: true`, so `session/load` replay shows
12
+ * exactly what was on screen instead of dropping the turn entirely.
8
13
  */
9
14
  export type SessionHistoryRole = 'user' | 'assistant';
10
15
  export type SessionHistoryRecord = {
@@ -14,6 +19,12 @@ export type SessionHistoryRecord = {
14
19
  role: SessionHistoryRole;
15
20
  text: string;
16
21
  createdAt: string;
22
+ /**
23
+ * True when the turn did not complete (cancelled / failed) and `text` is
24
+ * only the partial output the client saw. Replay ignores the flag and
25
+ * returns the text; readers must tolerate its absence (old journals).
26
+ */
27
+ partial?: boolean;
17
28
  };
18
29
  export declare function resolveHistoryDir(sessionStorePath?: string, env?: NodeJS.ProcessEnv, homedir?: () => string): string;
19
30
  export declare class SessionHistoryStore {
@@ -21,12 +32,16 @@ export declare class SessionHistoryStore {
21
32
  constructor(directory?: string);
22
33
  filePath(sessionId: string): string;
23
34
  /**
24
- * Append one completed turn as two JSONL records.
35
+ * Append one completed (or interrupted) turn as JSONL records.
25
36
  *
26
- * The assistant record is omitted when the turn produced no visible final
27
- * text. This keeps cancelled/error-only turns from becoming fake answers.
37
+ * The assistant record is written whenever the turn produced visible text —
38
+ * including cancelled/failed turns (`partial: true`). Only a truly empty
39
+ * assistant answer is omitted, so cancelled/error-only turns never become
40
+ * fake answers, while partial output stays reloadable.
28
41
  */
29
- appendTurn(sessionId: string, userText: string, assistantText?: string): void;
42
+ appendTurn(sessionId: string, userText: string, assistantText?: string, opts?: {
43
+ partial?: boolean;
44
+ }): void;
30
45
  /** Read valid records and ignore incomplete/corrupt trailing lines. */
31
46
  read(sessionId: string): SessionHistoryRecord[];
32
47
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yitom/agy-acp-map",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },