@beeos-ai/device-agent 0.8.0 → 0.9.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 (77) hide show
  1. package/dist/app/fixed-session-id.d.ts +19 -0
  2. package/dist/app/fixed-session-id.js +26 -0
  3. package/dist/app/fixed-session-id.js.map +1 -0
  4. package/dist/app/jsonl-session-sweeper.d.ts +90 -0
  5. package/dist/app/jsonl-session-sweeper.js +162 -0
  6. package/dist/app/jsonl-session-sweeper.js.map +1 -0
  7. package/dist/app/jsonl-store.d.ts +10 -0
  8. package/dist/app/jsonl-store.js +10 -4
  9. package/dist/app/jsonl-store.js.map +1 -1
  10. package/dist/app/session-manager.d.ts +135 -1
  11. package/dist/app/session-manager.js +195 -12
  12. package/dist/app/session-manager.js.map +1 -1
  13. package/dist/bootstrap.js +146 -2
  14. package/dist/bootstrap.js.map +1 -1
  15. package/dist/config/loader.js +2 -0
  16. package/dist/config/loader.js.map +1 -1
  17. package/dist/config/schema.d.ts +2 -0
  18. package/dist/config/schema.js +41 -1
  19. package/dist/config/schema.js.map +1 -1
  20. package/dist/fleet/domain/device.d.ts +17 -0
  21. package/dist/fleet/domain/device.js +1 -0
  22. package/dist/fleet/domain/device.js.map +1 -1
  23. package/dist/fleet/domain/fsm.d.ts +30 -1
  24. package/dist/fleet/domain/fsm.js +100 -4
  25. package/dist/fleet/domain/fsm.js.map +1 -1
  26. package/dist/fleet/supervisor.js +38 -18
  27. package/dist/fleet/supervisor.js.map +1 -1
  28. package/dist/plugins/acp/index.d.ts +27 -30
  29. package/dist/plugins/acp/index.js +44 -137
  30. package/dist/plugins/acp/index.js.map +1 -1
  31. package/dist/plugins/message-bus/cancel.d.ts +48 -0
  32. package/dist/plugins/message-bus/cancel.js +66 -0
  33. package/dist/plugins/message-bus/cancel.js.map +1 -0
  34. package/dist/plugins/message-bus/inbound.d.ts +38 -22
  35. package/dist/plugins/message-bus/inbound.js +107 -50
  36. package/dist/plugins/message-bus/inbound.js.map +1 -1
  37. package/dist/plugins/message-bus/index.d.ts +1 -2
  38. package/dist/plugins/message-bus/index.js +25 -35
  39. package/dist/plugins/message-bus/index.js.map +1 -1
  40. package/dist/plugins/message-bus/ms-channel-notifier.d.ts +101 -0
  41. package/dist/plugins/message-bus/ms-channel-notifier.js +181 -0
  42. package/dist/plugins/message-bus/ms-channel-notifier.js.map +1 -0
  43. package/dist/plugins/message-bus/ms-inflight-tracker.d.ts +36 -0
  44. package/dist/plugins/message-bus/ms-inflight-tracker.js +42 -0
  45. package/dist/plugins/message-bus/ms-inflight-tracker.js.map +1 -0
  46. package/dist/ports/plugin.d.ts +12 -0
  47. package/package.json +1 -1
  48. package/dist/agent-runtime/skills/sqlite-store.d.ts +0 -60
  49. package/dist/agent-runtime/skills/sqlite-store.js +0 -234
  50. package/dist/agent-runtime/skills/sqlite-store.js.map +0 -1
  51. package/dist/plugins/message-bus/outbound.d.ts +0 -43
  52. package/dist/plugins/message-bus/outbound.js +0 -149
  53. package/dist/plugins/message-bus/outbound.js.map +0 -1
  54. package/dist/plugins/message-bus/turn-context.d.ts +0 -57
  55. package/dist/plugins/message-bus/turn-context.js +0 -53
  56. package/dist/plugins/message-bus/turn-context.js.map +0 -1
  57. package/dist/test-lan-autoglm.d.ts +0 -7
  58. package/dist/test-lan-autoglm.js +0 -46
  59. package/dist/test-lan-autoglm.js.map +0 -1
  60. package/dist/test-mem-breakdown.d.ts +0 -1
  61. package/dist/test-mem-breakdown.js +0 -103
  62. package/dist/test-mem-breakdown.js.map +0 -1
  63. package/dist/test-mem.d.ts +0 -1
  64. package/dist/test-mem.js +0 -60
  65. package/dist/test-mem.js.map +0 -1
  66. package/dist/test-mobile-use.d.ts +0 -1
  67. package/dist/test-mobile-use.js +0 -18
  68. package/dist/test-mobile-use.js.map +0 -1
  69. package/dist/test-screenshot-loop.d.ts +0 -1
  70. package/dist/test-screenshot-loop.js +0 -43
  71. package/dist/test-screenshot-loop.js.map +0 -1
  72. package/dist/test-screenshot.d.ts +0 -1
  73. package/dist/test-screenshot.js +0 -10
  74. package/dist/test-screenshot.js.map +0 -1
  75. package/dist/test-ui-xml-dump.d.ts +0 -15
  76. package/dist/test-ui-xml-dump.js +0 -49
  77. package/dist/test-ui-xml-dump.js.map +0 -1
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Compute the per-device fixed sid used by the operator dashboard
3
+ * (ACP) and the JsonlSessionSweeper "never reap" filter.
4
+ *
5
+ * Format: `device:<first16HexOfSha256(publicKey)>` — 16 hex chars give
6
+ * 64 bits of entropy, far more than enough to avoid collisions across
7
+ * the BeeOS device fleet, while keeping the sid short enough to use
8
+ * as a filename / log correlation tag without truncation.
9
+ *
10
+ * Standalone mode (no keypair) falls back to `device:standalone` so
11
+ * local CLI testing still gets a stable sid that JsonlMessageStore
12
+ * can persist under.
13
+ *
14
+ * Single source of truth — both `bootstrap.ts` (constructs
15
+ * SessionManager) and `plugins/acp/index.ts` (binds the
16
+ * TransportSessionNotifier to this sid) consume this function so the
17
+ * two can never disagree on what sid the device "is".
18
+ */
19
+ export declare function deriveFixedSessionId(publicKey: Uint8Array | undefined): string;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Compute the per-device fixed sid used by the operator dashboard
3
+ * (ACP) and the JsonlSessionSweeper "never reap" filter.
4
+ *
5
+ * Format: `device:<first16HexOfSha256(publicKey)>` — 16 hex chars give
6
+ * 64 bits of entropy, far more than enough to avoid collisions across
7
+ * the BeeOS device fleet, while keeping the sid short enough to use
8
+ * as a filename / log correlation tag without truncation.
9
+ *
10
+ * Standalone mode (no keypair) falls back to `device:standalone` so
11
+ * local CLI testing still gets a stable sid that JsonlMessageStore
12
+ * can persist under.
13
+ *
14
+ * Single source of truth — both `bootstrap.ts` (constructs
15
+ * SessionManager) and `plugins/acp/index.ts` (binds the
16
+ * TransportSessionNotifier to this sid) consume this function so the
17
+ * two can never disagree on what sid the device "is".
18
+ */
19
+ import { fingerprint as sha256Fingerprint } from "@beeos-ai/bridge-client";
20
+ export function deriveFixedSessionId(publicKey) {
21
+ if (!publicKey || publicKey.length === 0)
22
+ return "device:standalone";
23
+ const hex = sha256Fingerprint(publicKey);
24
+ return `device:${hex.slice(0, 16)}`;
25
+ }
26
+ //# sourceMappingURL=fixed-session-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-session-id.js","sourceRoot":"","sources":["../../src/app/fixed-session-id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE3E,MAAM,UAAU,oBAAoB,CAAC,SAAiC;IACpE,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,mBAAmB,CAAC;IACrE,MAAM,GAAG,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACzC,OAAO,UAAU,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;AACtC,CAAC"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * JsonlSessionSweeper — periodic TTL-based cleanup for per-channel
3
+ * JSONL session files written by `JsonlMessageStore`.
4
+ *
5
+ * Sweep policy (KISS):
6
+ * - Per pass, list `*.jsonl` under `sessionsDir`, compare `mtimeMs`
7
+ * to `now - ttlMs`. If older AND the filename does NOT match the
8
+ * fixed sid's filesystem form → delete the file + sibling
9
+ * `<sid>.meta.json`.
10
+ * - The fixed sid (operator dashboard) is NEVER reaped — it carries
11
+ * the device's primary chat history.
12
+ * - File mtime is the truth source. We deliberately do NOT track a
13
+ * separate "last activity" map — JsonlMessageStore bumps the
14
+ * file's mtime on every appendUserMessage / appendAssistantTurn
15
+ * write, which is exactly the activity we care about.
16
+ * - In-memory cleanup is NOT this sweeper's job: SessionManager's
17
+ * `findOrCreateSession` opportunistically calls `evictExpired`,
18
+ * which honours `sessionTtlMs` and skips `fixedSessionId`. Files
19
+ * and memory live independently — a file may be deleted while
20
+ * the in-memory entry persists (the next prompt finds an empty
21
+ * history, recreates the file). That's the correct trade.
22
+ *
23
+ * Failure mode: every disk operation is wrapped in try/catch with a
24
+ * single warn log and ignored. A locked / vanished file on one pass
25
+ * just means the next pass tries again.
26
+ *
27
+ * The sweeper is intentionally cheap: a directory scan + a stat per
28
+ * file, ~once an hour. With even 10k session files this is sub-second
29
+ * on any modern filesystem.
30
+ *
31
+ * Why a separate component (vs reusing the resource-lifecycle sweeper):
32
+ * - The resource-lifecycle sweeper operates on device-side files
33
+ * (`/sdcard/Pictures/...`) via the device adapter; it has no concept
34
+ * of host-side JSONL paths.
35
+ * - Session files are host-side artefacts of the messaging layer,
36
+ * orthogonal to device resources.
37
+ */
38
+ export interface JsonlSessionSweeperOptions {
39
+ /** Directory containing `<sid>.jsonl` + `<sid>.meta.json` files. */
40
+ sessionsDir: string;
41
+ /** Idle TTL in milliseconds. Files older than this are eligible. */
42
+ ttlMs: number;
43
+ /** Sweep interval in milliseconds. */
44
+ intervalMs: number;
45
+ /**
46
+ * Filesystem form of the fixed sid (operator dashboard). NEVER
47
+ * reaped. Optional — when unset (e.g. tests), every aged file is
48
+ * eligible. Pass the value AFTER applying the same `:` → `_`
49
+ * transliteration `JsonlMessageStore.safeFilename` does, since this
50
+ * sweeper compares against the on-disk filename.
51
+ */
52
+ fixedSessionFilename?: string;
53
+ /** Optional logger. Defaults to no-op. */
54
+ logger?: {
55
+ info?: (...args: unknown[]) => void;
56
+ warn?: (...args: unknown[]) => void;
57
+ };
58
+ /**
59
+ * Test seam — `setInterval` / `clearInterval` shim. Defaults to the
60
+ * global timer family. Tests inject deterministic schedulers so they
61
+ * can drive sweep cycles synchronously.
62
+ */
63
+ scheduler?: {
64
+ setInterval: (cb: () => void, ms: number) => unknown;
65
+ clearInterval: (handle: unknown) => void;
66
+ };
67
+ /** Test seam — clock. Defaults to `Date.now`. */
68
+ now?: () => number;
69
+ }
70
+ export declare class JsonlSessionSweeper {
71
+ private readonly opts;
72
+ private handle;
73
+ private running;
74
+ private readonly now;
75
+ constructor(opts: JsonlSessionSweeperOptions);
76
+ /** Start the periodic sweep. Idempotent. */
77
+ start(): void;
78
+ /** Stop the periodic sweep. Idempotent. */
79
+ stop(): void;
80
+ /**
81
+ * Run one sweep pass. Exposed for tests + for shutdown flush. Safe
82
+ * to call concurrently with the timer-driven path — `running` guards
83
+ * against re-entry.
84
+ */
85
+ sweep(): Promise<{
86
+ scanned: number;
87
+ deleted: number;
88
+ }>;
89
+ private scheduler;
90
+ }
@@ -0,0 +1,162 @@
1
+ /**
2
+ * JsonlSessionSweeper — periodic TTL-based cleanup for per-channel
3
+ * JSONL session files written by `JsonlMessageStore`.
4
+ *
5
+ * Sweep policy (KISS):
6
+ * - Per pass, list `*.jsonl` under `sessionsDir`, compare `mtimeMs`
7
+ * to `now - ttlMs`. If older AND the filename does NOT match the
8
+ * fixed sid's filesystem form → delete the file + sibling
9
+ * `<sid>.meta.json`.
10
+ * - The fixed sid (operator dashboard) is NEVER reaped — it carries
11
+ * the device's primary chat history.
12
+ * - File mtime is the truth source. We deliberately do NOT track a
13
+ * separate "last activity" map — JsonlMessageStore bumps the
14
+ * file's mtime on every appendUserMessage / appendAssistantTurn
15
+ * write, which is exactly the activity we care about.
16
+ * - In-memory cleanup is NOT this sweeper's job: SessionManager's
17
+ * `findOrCreateSession` opportunistically calls `evictExpired`,
18
+ * which honours `sessionTtlMs` and skips `fixedSessionId`. Files
19
+ * and memory live independently — a file may be deleted while
20
+ * the in-memory entry persists (the next prompt finds an empty
21
+ * history, recreates the file). That's the correct trade.
22
+ *
23
+ * Failure mode: every disk operation is wrapped in try/catch with a
24
+ * single warn log and ignored. A locked / vanished file on one pass
25
+ * just means the next pass tries again.
26
+ *
27
+ * The sweeper is intentionally cheap: a directory scan + a stat per
28
+ * file, ~once an hour. With even 10k session files this is sub-second
29
+ * on any modern filesystem.
30
+ *
31
+ * Why a separate component (vs reusing the resource-lifecycle sweeper):
32
+ * - The resource-lifecycle sweeper operates on device-side files
33
+ * (`/sdcard/Pictures/...`) via the device adapter; it has no concept
34
+ * of host-side JSONL paths.
35
+ * - Session files are host-side artefacts of the messaging layer,
36
+ * orthogonal to device resources.
37
+ */
38
+ import * as fs from "node:fs/promises";
39
+ import * as path from "node:path";
40
+ export class JsonlSessionSweeper {
41
+ opts;
42
+ handle = null;
43
+ running = false;
44
+ now;
45
+ constructor(opts) {
46
+ this.opts = opts;
47
+ this.now = opts.now ?? Date.now;
48
+ }
49
+ /** Start the periodic sweep. Idempotent. */
50
+ start() {
51
+ if (this.handle != null)
52
+ return;
53
+ const sched = this.scheduler();
54
+ this.handle = sched.setInterval(() => {
55
+ void this.sweep();
56
+ }, this.opts.intervalMs);
57
+ // Don't keep the event loop alive solely for the sweep timer.
58
+ if (this.handle &&
59
+ typeof this.handle.unref === "function") {
60
+ this.handle.unref();
61
+ }
62
+ }
63
+ /** Stop the periodic sweep. Idempotent. */
64
+ stop() {
65
+ if (this.handle == null)
66
+ return;
67
+ const sched = this.scheduler();
68
+ try {
69
+ sched.clearInterval(this.handle);
70
+ }
71
+ catch {
72
+ /* ignore */
73
+ }
74
+ this.handle = null;
75
+ }
76
+ /**
77
+ * Run one sweep pass. Exposed for tests + for shutdown flush. Safe
78
+ * to call concurrently with the timer-driven path — `running` guards
79
+ * against re-entry.
80
+ */
81
+ async sweep() {
82
+ if (this.running)
83
+ return { scanned: 0, deleted: 0 };
84
+ this.running = true;
85
+ let scanned = 0;
86
+ let deleted = 0;
87
+ try {
88
+ let entries;
89
+ try {
90
+ entries = await fs.readdir(this.opts.sessionsDir);
91
+ }
92
+ catch (err) {
93
+ if (err.code === "ENOENT") {
94
+ return { scanned: 0, deleted: 0 };
95
+ }
96
+ this.opts.logger?.warn?.({
97
+ sessionsDir: this.opts.sessionsDir,
98
+ err: err.message,
99
+ }, "jsonl-session-sweeper: readdir failed");
100
+ return { scanned: 0, deleted: 0 };
101
+ }
102
+ const cutoff = this.now() - this.opts.ttlMs;
103
+ for (const entry of entries) {
104
+ if (!entry.endsWith(".jsonl"))
105
+ continue;
106
+ scanned++;
107
+ const filename = entry.slice(0, -".jsonl".length);
108
+ if (this.opts.fixedSessionFilename &&
109
+ filename === this.opts.fixedSessionFilename) {
110
+ continue;
111
+ }
112
+ const jsonlPath = path.join(this.opts.sessionsDir, entry);
113
+ let stat;
114
+ try {
115
+ stat = await fs.stat(jsonlPath);
116
+ }
117
+ catch {
118
+ // Vanished between readdir and stat — nothing to do.
119
+ continue;
120
+ }
121
+ if (stat.mtimeMs > cutoff)
122
+ continue;
123
+ try {
124
+ await fs.unlink(jsonlPath);
125
+ }
126
+ catch (err) {
127
+ this.opts.logger?.warn?.({
128
+ file: jsonlPath,
129
+ err: err.message,
130
+ }, "jsonl-session-sweeper: unlink jsonl failed");
131
+ continue;
132
+ }
133
+ try {
134
+ await fs.unlink(path.join(this.opts.sessionsDir, `${filename}.meta.json`));
135
+ }
136
+ catch (err) {
137
+ if (err.code !== "ENOENT") {
138
+ this.opts.logger?.warn?.({
139
+ file: `${filename}.meta.json`,
140
+ err: err.message,
141
+ }, "jsonl-session-sweeper: unlink meta failed");
142
+ }
143
+ }
144
+ deleted++;
145
+ }
146
+ if (deleted > 0) {
147
+ this.opts.logger?.info?.({ scanned, deleted, sessionsDir: this.opts.sessionsDir }, "jsonl-session-sweeper: pass complete");
148
+ }
149
+ return { scanned, deleted };
150
+ }
151
+ finally {
152
+ this.running = false;
153
+ }
154
+ }
155
+ scheduler() {
156
+ return (this.opts.scheduler ?? {
157
+ setInterval: (cb, t) => setInterval(cb, t),
158
+ clearInterval: (h) => clearInterval(h),
159
+ });
160
+ }
161
+ }
162
+ //# sourceMappingURL=jsonl-session-sweeper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonl-session-sweeper.js","sourceRoot":"","sources":["../../src/app/jsonl-session-sweeper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,O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E,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EACxD,sCAAsC,CACvC,CAAC;YACJ,CAAC;YACD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;QAC9B,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IAEO,SAAS;QACf,OAAO,CACL,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI;YACrB,WAAW,EAAE,CAAC,EAAc,EAAE,CAAS,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC;YAC9D,aAAa,EAAE,CAAC,CAAU,EAAE,EAAE,CAC5B,aAAa,CAAC,CAAmC,CAAC;SACrD,CACF,CAAC;IACJ,CAAC;CACF"}
@@ -107,3 +107,13 @@ export declare class JsonlMessageStore extends MessageStore {
107
107
  private snapshotMeta;
108
108
  private writeMetaNow;
109
109
  }
110
+ /**
111
+ * Convert a sid into a safe filename — reject path separators + magic
112
+ * dot entries and transliterate `:` (the `device:<id>` /
113
+ * `agent:<id>:invoke:ctx-<x>` convention) to `_`.
114
+ *
115
+ * Exported so collaborators (e.g. `JsonlSessionSweeper` in
116
+ * `bootstrap.ts`) can compute the on-disk filename for a known sid
117
+ * without re-implementing the rule.
118
+ */
119
+ export declare function safeFilename(sid: string): string;
@@ -355,10 +355,16 @@ export class JsonlMessageStore extends MessageStore {
355
355
  }
356
356
  }
357
357
  }
358
- /** Reject sids that would escape the sessions directory. */
359
- function safeFilename(sid) {
360
- // Forbid path separators and the magic dotted entries; allow `:` for
361
- // our `device:<deviceId>` convention by transliterating to `_`.
358
+ /**
359
+ * Convert a sid into a safe filename — reject path separators + magic
360
+ * dot entries and transliterate `:` (the `device:<id>` /
361
+ * `agent:<id>:invoke:ctx-<x>` convention) to `_`.
362
+ *
363
+ * Exported so collaborators (e.g. `JsonlSessionSweeper` in
364
+ * `bootstrap.ts`) can compute the on-disk filename for a known sid
365
+ * without re-implementing the rule.
366
+ */
367
+ export function safeFilename(sid) {
362
368
  const cleaned = sid.replace(/[\\/]/g, "_").replace(/^\.+$/, "_");
363
369
  return cleaned.replace(/:/g, "_");
364
370
  }
@@ -1 +1 @@
1
- {"version":3,"file":"jsonl-store.js","sourceRoot":"","sources":["../../src/app/jsonl-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AACxC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,EACL,YAAY,GAKb,MAAM,oBAAoB,CAAC;AAG5B;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,GAAG,CAAC;AA4B7B;;;;;;;GAOG;AACH,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IAChC,WAAW,CAAS;IACpB,MAAM,CAA0C;IACjE,wDAAwD;IACvC,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAC;IAChC,UAAU,GAAG,IAAI,GAAG,EAAyB,CAAC;IACvD,MAAM,GAAG,KAAK,CAAC;IAEvB,YAAoB,IAA8B;QAChD,KAAK,CAAC;YACJ,GAAG,CAAC,IAAI,CAAC,oBAAoB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACvG,GAAG,CAAC,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC7E,CAAC,CAAC;QACH,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACpC,IAAI,IAAI,CAAC,MAAM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C,UAAU,KAAK,QAAQ,EAChC,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QACD,iEAAiE;QACjE,uDAAuD;QACvD,IAAI,CAAC,CAAC,WAAW,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC;YACjE,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IACE,CAAC,CAAC,MAAM,KAAK,SAAS;YACtB,CAAC,CAAC,MAAM,KAAK,OAAO;YACpB,CAAC,CAAC,MAAM,KAAK,gBAAgB,EAC7B,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -39,6 +39,7 @@
39
39
  * `handleSessionLoad` exactly so the same chat-store reducer paths
40
40
  * handle both agents.
41
41
  */
42
+ import { type Session } from "../core/session.js";
42
43
  import { MessageStore } from "./message-store.js";
43
44
  import type { AgentHost } from "../ports/agent-host.js";
44
45
  import type { PluginCommandRegistry } from "./plugin-commands/registry.js";
@@ -74,6 +75,14 @@ export type PluginCommandEvent = {
74
75
  export interface SessionManagerOptions {
75
76
  host: AgentHost;
76
77
  messageStore?: MessageStore;
78
+ /**
79
+ * Fallback notifier used when no per-session binding exists
80
+ * (`bindNotifier`). For backwards compatibility this is the same
81
+ * field name as before; callers that only set this field get the
82
+ * old "single notifier per SessionManager" behaviour. AcpPlugin /
83
+ * MessageBusPlugin in v0.9.0+ instead use `bindNotifier(sid, n)`
84
+ * to route per-session updates to different transports.
85
+ */
77
86
  notifier?: SessionUpdateNotifier;
78
87
  /**
79
88
  * Called when the user asks to switch the underlying agent model.
@@ -85,6 +94,13 @@ export interface SessionManagerOptions {
85
94
  * If set, single-session mode is active: every session-management
86
95
  * method aliases to this sid, `multipleSessions` should be advertised
87
96
  * as `false` in `initialize`, and `delete` collapses to `clear`.
97
+ *
98
+ * NOTE: `fixedSessionId` only affects ACP-style management methods
99
+ * (`newSession`, `loadSession`, `listSessions`, `deleteSession`,
100
+ * `prompt(...)`). `promptForSession(sid, ...)` and
101
+ * `findOrCreateSession(sid)` (introduced in v0.9.0 for the
102
+ * MessageBus path) bypass it deliberately so per-channel sessions
103
+ * can coexist with the operator's fixed device session.
88
104
  */
89
105
  fixedSessionId?: string;
90
106
  maxSessions?: number;
@@ -108,17 +124,49 @@ export interface SessionManagerOptions {
108
124
  * may or may not surface.
109
125
  */
110
126
  onPluginCommandEvent?: (ev: PluginCommandEvent) => void;
127
+ /**
128
+ * v0.9.0 — when `true`, `promptForSession()` reads prior
129
+ * `user_message` + `assistant_turn` records from the message store,
130
+ * formats them as a `[Conversation history ...]` preamble, and
131
+ * prepends it to the prompt that gets sent to the agent core.
132
+ * Lets MS callers maintain multi-turn conversations via `context_id`
133
+ * (the LLM "remembers" prior turns).
134
+ *
135
+ * `prompt()` (ACP path) is INTENTIONALLY NOT affected — the operator
136
+ * dashboard's behaviour stays exactly as v0.8.0. ACP can opt-in
137
+ * later via a separate config knob if needed.
138
+ *
139
+ * Disabled automatically for `pi=true` mode at the bootstrap layer
140
+ * (Pi orchestrator's task-style prompt may misread history as a new
141
+ * task).
142
+ */
143
+ historyEnabled?: boolean;
144
+ /** Max (user, assistant) turn pairs included in the preamble. */
145
+ historyMaxTurns?: number;
146
+ /** Hard byte cap on the preamble; oldest turns get dropped first. */
147
+ historyMaxBytes?: number;
111
148
  }
112
149
  export declare class SessionManager {
113
150
  private readonly host;
114
151
  private readonly store;
115
- private readonly notifier;
152
+ /**
153
+ * Default notifier — called when no per-session notifier is bound
154
+ * via `bindNotifier`. AcpPlugin in v0.9.0+ does NOT pass this; it
155
+ * binds its TransportSessionNotifier per-fixedSessionId instead.
156
+ * Kept for back-compat with single-notifier callers.
157
+ */
158
+ private readonly fallbackNotifier;
159
+ /** sid → notifier overrides for routing per-session updates. */
160
+ private readonly notifiers;
116
161
  private readonly onSetModel;
117
162
  private readonly fixedSessionId;
118
163
  private readonly maxSessions;
119
164
  private readonly sessionTtlMs;
120
165
  private readonly pluginCommands;
121
166
  private readonly onPluginCommandEvent;
167
+ private readonly historyEnabled;
168
+ private readonly historyMaxTurns;
169
+ private readonly historyMaxBytes;
122
170
  private readonly sessions;
123
171
  /** taskId → sessionId for routing host events to the right ACP session. */
124
172
  private readonly taskToSession;
@@ -128,8 +176,65 @@ export declare class SessionManager {
128
176
  private currentTask;
129
177
  private unsubscribe;
130
178
  constructor(opts: SessionManagerOptions);
179
+ /** True iff a turn is in flight (any session). Used by MS busy-reject. */
180
+ isTurnInFlight(): boolean;
181
+ /**
182
+ * Read-only access to the plugin command registry passed at
183
+ * construction. Plugins (e.g. AcpSkillsHandlers) consume this to
184
+ * surface registered commands without re-injecting the registry
185
+ * separately. Returns `undefined` when no registry was provided.
186
+ */
187
+ get pluginCommandRegistry(): PluginCommandRegistry | undefined;
188
+ /**
189
+ * Look up a session by exact sid, bypassing `fixedSessionId`. Creates
190
+ * an in-memory entry on first call (rehydrating from store if a
191
+ * previous instance wrote a JSONL with that sid). Used by the
192
+ * MessageBus path so per-channel sessions coexist with the
193
+ * operator's fixed ACP session.
194
+ *
195
+ * Opportunistically runs `evictExpired` before allocating so MS-only
196
+ * deployments (which never call `listSessions` / `newSession`) don't
197
+ * accumulate stale in-memory entries indefinitely. The eviction
198
+ * deliberately preserves `fixedSessionId`.
199
+ */
200
+ findOrCreateSession(sessionId: string): Session;
201
+ /**
202
+ * Run a prompt against a specific session id, bypassing the
203
+ * `fixedSessionId` ACP single-session aliasing. When `historyEnabled`
204
+ * is on, prepends a `[Conversation history ...]` preamble built from
205
+ * the prior `user_message` + `assistant_turn` records on the same
206
+ * sid so the LLM has multi-turn memory.
207
+ *
208
+ * Throws `Error("agent_busy")` if a turn is already running on any
209
+ * session — caller (MessageBus inbound) translates to a busy-reply.
210
+ */
211
+ promptForSession(sessionId: string, prompt: string): Promise<{
212
+ stopReason: string;
213
+ }>;
214
+ /** Bind a notifier to a specific session id. Replaces any existing binding. */
215
+ bindNotifier(sessionId: string, notifier: SessionUpdateNotifier): void;
216
+ /** Remove the per-session notifier (subsequent updates fall back to the default). */
217
+ unbindNotifier(sessionId: string): void;
131
218
  /** Detach from the host bus (used when shutting down the ACP plugin). */
132
219
  detach(): void;
220
+ /**
221
+ * Drop a session from in-memory state without touching the store.
222
+ * Used by `JsonlSessionSweeper` after it has already decided the
223
+ * session's JSONL on disk is stale — calling this keeps
224
+ * `this.sessions` from holding a phantom in-memory entry that
225
+ * would re-create the file on the next prompt.
226
+ *
227
+ * Returns:
228
+ * - `"dropped"` — the entry existed and was removed; caller is
229
+ * free to delete the JSONL on disk.
230
+ * - `"absent"` — no in-memory entry for this sid; caller is
231
+ * free to delete the JSONL on disk (a rehydrate
232
+ * would have re-loaded it).
233
+ * - `"in-flight"` — an in-flight task is using this sid; caller
234
+ * MUST skip the disk delete and try again on
235
+ * the next sweep pass.
236
+ */
237
+ dropFromMemory(sessionId: string): "dropped" | "absent" | "in-flight";
133
238
  newSession(): {
134
239
  sessionId: string;
135
240
  };
@@ -193,6 +298,35 @@ export declare class SessionManager {
193
298
  prompt(rawPrompt: string | PromptContentBlock[], sessionIdHint?: string): Promise<{
194
299
  stopReason: string;
195
300
  }>;
301
+ /**
302
+ * Shared turn dispatch. Both `prompt()` (ACP) and `promptForSession()`
303
+ * (MessageBus) funnel through here so the in-flight gate, persistence,
304
+ * notify-status, and submit-task paths can't drift between callers.
305
+ *
306
+ * - Throws `Error("agent_busy")` if another turn is in-flight (any
307
+ * session). Layer 3 device-physical-serial constraint.
308
+ * - When `injectHistory` is true, prepends a `[Conversation history ...]`
309
+ * preamble built from store records to the prompt. JSONL persists
310
+ * the ORIGINAL prompt — preamble is for the LLM only, never written
311
+ * to disk (otherwise next turn would re-include the preamble and
312
+ * recursively bloat).
313
+ */
314
+ private _executePrompt;
315
+ /**
316
+ * Build a `[Conversation history ...]` preamble from prior store
317
+ * records on `sessionId`. Returns "" when:
318
+ * - history injection is disabled
319
+ * - no prior records exist
320
+ * - all records are empty after filtering
321
+ *
322
+ * Truncates from the OLDEST end when the body would exceed
323
+ * `historyMaxBytes`. Caps at `historyMaxTurns * 2` lines (each
324
+ * "turn" ≈ one user line + one assistant line).
325
+ *
326
+ * Returns the formatted string ending with two newlines so the new
327
+ * user prompt naturally appears after a blank line.
328
+ */
329
+ private buildHistoryPreamble;
196
330
  /** Cancel the in-flight task for the active session, if any. */
197
331
  cancel(): Promise<boolean>;
198
332
  /**