aibroker 0.60.0 → 0.60.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.
@@ -19,7 +19,10 @@
19
19
  * "did not look" unless the code refuses to say "none" without looking.
20
20
  *
21
21
  * So discovery lives here, both readers call it, and nobody has to remember to
22
- * populate anything first.
22
+ * populate anything first. HybridManager grew its own "keep the known list on
23
+ * a bad enumeration" guard directly; every OTHER caller of this function was
24
+ * still getting the raw `[]` an unreadable iTerm produces. The guard belongs
25
+ * here instead, once, so every reader inherits it.
23
26
  */
24
27
  import { snapshotAllSessions } from "../adapters/iterm/core.js";
25
28
  export type LiveSession = ReturnType<typeof snapshotAllSessions>[0];
@@ -29,6 +32,10 @@ export type LiveSession = ReturnType<typeof snapshotAllSessions>[0];
29
32
  * `snapshotAllSessions()` has returned `paiName: null` since 0.7.10 — the
30
33
  * authoritative source is the persistent store — so a caller that skips this
31
34
  * step gets tab titles where it expects names.
35
+ *
36
+ * A failed enumeration (`wasLastSnapshotReliable()` false) replays the last
37
+ * good list instead of the `[]` iTerm hands back on an osascript fault — an
38
+ * unreadable machine must not read as an empty one (see file header).
32
39
  */
33
40
  export declare function discoverLiveSessions(opts?: {
34
41
  fresh?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"session-discovery.d.ts","sourceRoot":"","sources":["../../src/core/session-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAGhE,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;AAEpE;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,WAAW,EAAE,CAOlF;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAM1D"}
1
+ {"version":3,"file":"session-discovery.d.ts","sourceRoot":"","sources":["../../src/core/session-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,mBAAmB,EAA2B,MAAM,2BAA2B,CAAC;AAGzF,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;AAIpE;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,WAAW,EAAE,CAgBlF;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAM1D"}
@@ -19,24 +19,39 @@
19
19
  * "did not look" unless the code refuses to say "none" without looking.
20
20
  *
21
21
  * So discovery lives here, both readers call it, and nobody has to remember to
22
- * populate anything first.
22
+ * populate anything first. HybridManager grew its own "keep the known list on
23
+ * a bad enumeration" guard directly; every OTHER caller of this function was
24
+ * still getting the raw `[]` an unreadable iTerm produces. The guard belongs
25
+ * here instead, once, so every reader inherits it.
23
26
  */
24
- import { snapshotAllSessions } from "../adapters/iterm/core.js";
27
+ import { snapshotAllSessions, wasLastSnapshotReliable } from "../adapters/iterm/core.js";
25
28
  import { getAllPersistentSessionNames, lookupPersistentName } from "./persistence.js";
29
+ let lastGoodSnapshots = [];
26
30
  /**
27
31
  * Live sessions, with their PAI names filled in.
28
32
  *
29
33
  * `snapshotAllSessions()` has returned `paiName: null` since 0.7.10 — the
30
34
  * authoritative source is the persistent store — so a caller that skips this
31
35
  * step gets tab titles where it expects names.
36
+ *
37
+ * A failed enumeration (`wasLastSnapshotReliable()` false) replays the last
38
+ * good list instead of the `[]` iTerm hands back on an osascript fault — an
39
+ * unreadable machine must not read as an empty one (see file header).
32
40
  */
33
41
  export function discoverLiveSessions(opts = {}) {
34
42
  const snaps = snapshotAllSessions(opts);
35
43
  const persistentNames = getAllPersistentSessionNames();
36
- for (const snap of snaps) {
37
- snap.paiName = lookupPersistentName(persistentNames, snap.id, snap.aibrokerId);
44
+ if (wasLastSnapshotReliable()) {
45
+ for (const snap of snaps) {
46
+ snap.paiName = lookupPersistentName(persistentNames, snap.id, snap.aibrokerId);
47
+ }
48
+ lastGoodSnapshots = snaps;
49
+ return snaps;
38
50
  }
39
- return snaps;
51
+ return lastGoodSnapshots.map((snap) => ({
52
+ ...snap,
53
+ paiName: lookupPersistentName(persistentNames, snap.id, snap.aibrokerId),
54
+ }));
40
55
  }
41
56
  /**
42
57
  * Is this tab something a person would call a session?
@@ -1 +1 @@
1
- {"version":3,"file":"session-discovery.js","sourceRoot":"","sources":["../../src/core/session-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,4BAA4B,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAItF;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAA4B,EAAE;IACjE,MAAM,KAAK,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,eAAe,GAAG,4BAA4B,EAAE,CAAC;IACvD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,oBAAoB,CAAC,eAAe,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,IAAiB;IAC/C,IAAI,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC9B,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,W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;QAAE,OAAO,IAAI,CAAC;IAC9B,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IACxD,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAC;IACzC,IAAI,CAAC,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAChC,OAAO,KAAK,CAAC;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aibroker",
3
- "version": "0.60.0",
3
+ "version": "0.60.1",
4
4
  "description": "Platform-agnostic AI message broker — routes between user channels and AI backends",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",