@agentdeck/bridge 1.0.24 → 1.1.0

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 (117) hide show
  1. package/dist/adapters/openclaw.d.ts +74 -4
  2. package/dist/adapters/openclaw.d.ts.map +1 -1
  3. package/dist/adapters/openclaw.js +235 -43
  4. package/dist/adapters/openclaw.js.map +1 -1
  5. package/dist/apme/adapters/openclaw-hook.d.ts +38 -10
  6. package/dist/apme/adapters/openclaw-hook.d.ts.map +1 -1
  7. package/dist/apme/adapters/openclaw-hook.js +181 -37
  8. package/dist/apme/adapters/openclaw-hook.js.map +1 -1
  9. package/dist/apme/collector.d.ts +37 -1
  10. package/dist/apme/collector.d.ts.map +1 -1
  11. package/dist/apme/collector.js +277 -35
  12. package/dist/apme/collector.js.map +1 -1
  13. package/dist/apme/pareto.d.ts +2 -1
  14. package/dist/apme/pareto.d.ts.map +1 -1
  15. package/dist/apme/pareto.js +15 -4
  16. package/dist/apme/pareto.js.map +1 -1
  17. package/dist/apme/recommend.d.ts +24 -1
  18. package/dist/apme/recommend.d.ts.map +1 -1
  19. package/dist/apme/recommend.js +43 -7
  20. package/dist/apme/recommend.js.map +1 -1
  21. package/dist/apme/store.d.ts +6 -0
  22. package/dist/apme/store.d.ts.map +1 -1
  23. package/dist/apme/store.js +244 -72
  24. package/dist/apme/store.js.map +1 -1
  25. package/dist/bridge-core.d.ts +10 -1
  26. package/dist/bridge-core.d.ts.map +1 -1
  27. package/dist/bridge-core.js +20 -5
  28. package/dist/bridge-core.js.map +1 -1
  29. package/dist/card-feed.d.ts +46 -1
  30. package/dist/card-feed.d.ts.map +1 -1
  31. package/dist/card-feed.js +166 -6
  32. package/dist/card-feed.js.map +1 -1
  33. package/dist/cli.d.ts +45 -0
  34. package/dist/cli.d.ts.map +1 -1
  35. package/dist/cli.js +388 -27
  36. package/dist/cli.js.map +1 -1
  37. package/dist/daemon-build-identity.d.ts +124 -0
  38. package/dist/daemon-build-identity.d.ts.map +1 -0
  39. package/dist/daemon-build-identity.js +310 -0
  40. package/dist/daemon-build-identity.js.map +1 -0
  41. package/dist/daemon-server.d.ts +34 -6
  42. package/dist/daemon-server.d.ts.map +1 -1
  43. package/dist/daemon-server.js +613 -108
  44. package/dist/daemon-server.js.map +1 -1
  45. package/dist/daemon-takeover.d.ts +11 -0
  46. package/dist/daemon-takeover.d.ts.map +1 -1
  47. package/dist/daemon-takeover.js +62 -17
  48. package/dist/daemon-takeover.js.map +1 -1
  49. package/dist/daemon.js +1 -1
  50. package/dist/daemon.js.map +1 -1
  51. package/dist/esp32-serial.d.ts +14 -0
  52. package/dist/esp32-serial.d.ts.map +1 -1
  53. package/dist/esp32-serial.js +19 -1
  54. package/dist/esp32-serial.js.map +1 -1
  55. package/dist/glance-frame.d.ts.map +1 -1
  56. package/dist/glance-frame.js +3 -1
  57. package/dist/glance-frame.js.map +1 -1
  58. package/dist/hook-codex-sessions.d.ts +3 -1
  59. package/dist/hook-codex-sessions.d.ts.map +1 -1
  60. package/dist/hook-codex-sessions.js +27 -7
  61. package/dist/hook-codex-sessions.js.map +1 -1
  62. package/dist/legacy-rearm-ledger.d.ts +56 -0
  63. package/dist/legacy-rearm-ledger.d.ts.map +1 -0
  64. package/dist/legacy-rearm-ledger.js +66 -0
  65. package/dist/legacy-rearm-ledger.js.map +1 -0
  66. package/dist/mdns.d.ts +33 -0
  67. package/dist/mdns.d.ts.map +1 -1
  68. package/dist/mdns.js +91 -2
  69. package/dist/mdns.js.map +1 -1
  70. package/dist/openclaw-session.d.ts.map +1 -1
  71. package/dist/openclaw-session.js +13 -0
  72. package/dist/openclaw-session.js.map +1 -1
  73. package/dist/openclaw-timeline-feed.d.ts +84 -0
  74. package/dist/openclaw-timeline-feed.d.ts.map +1 -0
  75. package/dist/openclaw-timeline-feed.js +162 -0
  76. package/dist/openclaw-timeline-feed.js.map +1 -0
  77. package/dist/openclaw-transcript-timeline.d.ts +103 -0
  78. package/dist/openclaw-transcript-timeline.d.ts.map +1 -0
  79. package/dist/openclaw-transcript-timeline.js +328 -0
  80. package/dist/openclaw-transcript-timeline.js.map +1 -0
  81. package/dist/passive-observer.d.ts +21 -1
  82. package/dist/passive-observer.d.ts.map +1 -1
  83. package/dist/passive-observer.js +37 -3
  84. package/dist/passive-observer.js.map +1 -1
  85. package/dist/relayed-usage.d.ts +68 -0
  86. package/dist/relayed-usage.d.ts.map +1 -0
  87. package/dist/relayed-usage.js +80 -0
  88. package/dist/relayed-usage.js.map +1 -0
  89. package/dist/session-aggregator.d.ts +3 -0
  90. package/dist/session-aggregator.d.ts.map +1 -1
  91. package/dist/session-aggregator.js.map +1 -1
  92. package/dist/session-registry.d.ts +1 -0
  93. package/dist/session-registry.d.ts.map +1 -1
  94. package/dist/surface-protocol.d.ts +84 -0
  95. package/dist/surface-protocol.d.ts.map +1 -0
  96. package/dist/surface-protocol.js +235 -0
  97. package/dist/surface-protocol.js.map +1 -0
  98. package/dist/timeline-store.d.ts +1 -1
  99. package/dist/timeline-store.d.ts.map +1 -1
  100. package/dist/timeline-store.js +16 -1
  101. package/dist/timeline-store.js.map +1 -1
  102. package/dist/tui/renderer.d.ts.map +1 -1
  103. package/dist/tui/renderer.js +35 -0
  104. package/dist/tui/renderer.js.map +1 -1
  105. package/dist/weather-config.d.ts +17 -0
  106. package/dist/weather-config.d.ts.map +1 -0
  107. package/dist/weather-config.js +54 -0
  108. package/dist/weather-config.js.map +1 -0
  109. package/dist/weather.d.ts +44 -4
  110. package/dist/weather.d.ts.map +1 -1
  111. package/dist/weather.js +223 -15
  112. package/dist/weather.js.map +1 -1
  113. package/dist/ws-server.d.ts.map +1 -1
  114. package/dist/ws-server.js +55 -5
  115. package/dist/ws-server.js.map +1 -1
  116. package/fm-helper/AgentDeckFMHelper.swift +51 -5
  117. package/package.json +3 -3
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Feeds OpenClaw's own transcript into the daemon's live timeline.
3
+ *
4
+ * The Gateway stream says that OpenClaw answered; it does not say what it did
5
+ * to answer. Only tools that needed approval ever reached the strip, which is a
6
+ * biased sample rather than a log. This is the producer for the rest, read off
7
+ * the store OpenClaw writes anyway (`openclaw-transcript-timeline.ts`).
8
+ *
9
+ * Three bounds, each for a measured reason:
10
+ *
11
+ * - **Only recently-active sessions are read.** The store keeps every session
12
+ * forever — 103 of them on the machine this was built against, most long
13
+ * finished. Sessions are polled by `updatedAt`, newest first, inside
14
+ * `ACTIVE_WINDOW_MS`.
15
+ *
16
+ * - **A first sighting emits NOTHING.** This is the opposite of
17
+ * `KiroTimelineFeed`, deliberately: Kiro seeds the last turn because a Kiro
18
+ * session otherwise shows a live row beside a blank strip, which reads as
19
+ * broken. OpenClaw has no such gap — the Gateway stream is already filling
20
+ * the strip live — so seeding here would only inject minutes-old tool calls
21
+ * from finished eval runs into an activity log, competing with the live
22
+ * rows it is meant to supplement.
23
+ *
24
+ * - **Rows land on the existing `openclaw-gateway` row, not on new sessions.**
25
+ * One OpenClaw instance is one session everywhere else in AgentDeck, the
26
+ * deck is sized for sessions, and an eval suite opens a fresh session key
27
+ * per run — six in the three hours this was measured over. Which session key
28
+ * produced a row rides its `detail` instead, since that is the fact that
29
+ * distinguishes the chat the user is looking at from a cron job and from a
30
+ * model-eval run.
31
+ */
32
+ import type { TimelineEntry } from '@agentdeck/shared';
33
+ import { type OpenClawStoreSession } from './openclaw-transcript-timeline.js';
34
+ /**
35
+ * How often the daemon pumps this feed.
36
+ *
37
+ * Deliberately equal to the passive observer's `SCAN_INTERVAL_MS`: this feed is
38
+ * polled, so an OpenClaw tool call reaches the timeline seconds late rather
39
+ * than instantly, which is the same contract every transcript-observed agent
40
+ * already carries. It is exported so the daemon cannot quietly drift to a
41
+ * cadence nobody measured — the pump is synchronous fs work (~7 ms typical,
42
+ * ~28 ms worst case against a real store).
43
+ */
44
+ export declare const OPENCLAW_FEED_INTERVAL_MS = 5000;
45
+ export type OpenClawRowReader = (sessionId: string, opts: {
46
+ since?: number;
47
+ limit?: number;
48
+ }) => TimelineEntry[];
49
+ export type OpenClawSessionLister = () => OpenClawStoreSession[];
50
+ /**
51
+ * The human-facing half of a session key.
52
+ *
53
+ * `agent:main:eval-full-unified-mlx-2026-08-23-a03__openrouter-stealth-ox-alpha__r2`
54
+ * is what the store holds and it does not fit anywhere. The leading
55
+ * `agent:<agent>:` is constant for a given install and carries nothing, so it
56
+ * is dropped; what remains is the part that says which KIND of work this is.
57
+ */
58
+ export declare function shortSessionKey(sessionKey: string): string;
59
+ export declare class OpenClawTimelineFeed {
60
+ private readonly readRows;
61
+ private readonly listSessions;
62
+ /** sessionId → newest row timestamp already accounted for. */
63
+ private readonly watermark;
64
+ constructor(readRows?: OpenClawRowReader, listSessions?: OpenClawSessionLister);
65
+ /**
66
+ * Rows to emit for this tick, oldest-first across all sessions.
67
+ *
68
+ * `now` is injectable so a test can drive the activity window without a clock.
69
+ */
70
+ pump(now?: number): TimelineEntry[];
71
+ /** Tracked session count — for tests and diagnostics. */
72
+ get size(): number;
73
+ /**
74
+ * Stamp the row with the virtual Gateway session and say which OpenClaw
75
+ * session key produced it.
76
+ *
77
+ * The key leads `detail`: everything below it (the tool's own output, the
78
+ * model) is context, while "this came from a model-eval run and not from your
79
+ * chat" is the part that reorients the reader.
80
+ */
81
+ private attribute;
82
+ private enforceCeiling;
83
+ }
84
+ //# sourceMappingURL=openclaw-timeline-feed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openclaw-timeline-feed.d.ts","sourceRoot":"","sources":["../src/openclaw-timeline-feed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,mCAAmC,CAAC;AAG3C;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,OAAQ,CAAC;AAW/C,MAAM,MAAM,iBAAiB,GAAG,CAC9B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,KACrC,aAAa,EAAE,CAAC;AACrB,MAAM,MAAM,qBAAqB,GAAG,MAAM,oBAAoB,EAAE,CAAC;AAEjE;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAG1D;AAED,qBAAa,oBAAoB;IAK7B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAL/B,8DAA8D;IAC9D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA6B;gBAGpC,QAAQ,GAAE,iBAA8C,EACxD,YAAY,GAAE,qBAA4C;IAG7E;;;;OAIG;IACH,IAAI,CAAC,GAAG,GAAE,MAAmB,GAAG,aAAa,EAAE;IA+C/C,yDAAyD;IACzD,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;;;;;OAOG;IACH,OAAO,CAAC,SAAS;IAWjB,OAAO,CAAC,cAAc;CAQvB"}
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Feeds OpenClaw's own transcript into the daemon's live timeline.
3
+ *
4
+ * The Gateway stream says that OpenClaw answered; it does not say what it did
5
+ * to answer. Only tools that needed approval ever reached the strip, which is a
6
+ * biased sample rather than a log. This is the producer for the rest, read off
7
+ * the store OpenClaw writes anyway (`openclaw-transcript-timeline.ts`).
8
+ *
9
+ * Three bounds, each for a measured reason:
10
+ *
11
+ * - **Only recently-active sessions are read.** The store keeps every session
12
+ * forever — 103 of them on the machine this was built against, most long
13
+ * finished. Sessions are polled by `updatedAt`, newest first, inside
14
+ * `ACTIVE_WINDOW_MS`.
15
+ *
16
+ * - **A first sighting emits NOTHING.** This is the opposite of
17
+ * `KiroTimelineFeed`, deliberately: Kiro seeds the last turn because a Kiro
18
+ * session otherwise shows a live row beside a blank strip, which reads as
19
+ * broken. OpenClaw has no such gap — the Gateway stream is already filling
20
+ * the strip live — so seeding here would only inject minutes-old tool calls
21
+ * from finished eval runs into an activity log, competing with the live
22
+ * rows it is meant to supplement.
23
+ *
24
+ * - **Rows land on the existing `openclaw-gateway` row, not on new sessions.**
25
+ * One OpenClaw instance is one session everywhere else in AgentDeck, the
26
+ * deck is sized for sessions, and an eval suite opens a fresh session key
27
+ * per run — six in the three hours this was measured over. Which session key
28
+ * produced a row rides its `detail` instead, since that is the fact that
29
+ * distinguishes the chat the user is looking at from a cron job and from a
30
+ * model-eval run.
31
+ */
32
+ import { OPENCLAW_SESSION_ID } from './openclaw-session.js';
33
+ import { listOpenClawSessions, openClawTimelineForSession, } from './openclaw-transcript-timeline.js';
34
+ import { debug } from './logger.js';
35
+ /**
36
+ * How often the daemon pumps this feed.
37
+ *
38
+ * Deliberately equal to the passive observer's `SCAN_INTERVAL_MS`: this feed is
39
+ * polled, so an OpenClaw tool call reaches the timeline seconds late rather
40
+ * than instantly, which is the same contract every transcript-observed agent
41
+ * already carries. It is exported so the daemon cannot quietly drift to a
42
+ * cadence nobody measured — the pump is synchronous fs work (~7 ms typical,
43
+ * ~28 ms worst case against a real store).
44
+ */
45
+ export const OPENCLAW_FEED_INTERVAL_MS = 5_000;
46
+ /** How recently a session must have been written to be worth reading. */
47
+ const ACTIVE_WINDOW_MS = 30 * 60 * 1000;
48
+ /** Sessions read per tick, newest-first. An eval suite runs a handful at once. */
49
+ const MAX_SESSIONS_PER_TICK = 8;
50
+ /** Rows read per session per tick — measured traffic was 28 tool calls / 3 h. */
51
+ const ROWS_PER_TICK = 12;
52
+ /** Watermarks kept at most, newest-first: the store never forgets a session. */
53
+ const MAX_TRACKED = 64;
54
+ /**
55
+ * The human-facing half of a session key.
56
+ *
57
+ * `agent:main:eval-full-unified-mlx-2026-08-23-a03__openrouter-stealth-ox-alpha__r2`
58
+ * is what the store holds and it does not fit anywhere. The leading
59
+ * `agent:<agent>:` is constant for a given install and carries nothing, so it
60
+ * is dropped; what remains is the part that says which KIND of work this is.
61
+ */
62
+ export function shortSessionKey(sessionKey) {
63
+ const stripped = sessionKey.replace(/^agent:[^:]+:/, '');
64
+ return stripped || sessionKey;
65
+ }
66
+ export class OpenClawTimelineFeed {
67
+ readRows;
68
+ listSessions;
69
+ /** sessionId → newest row timestamp already accounted for. */
70
+ watermark = new Map();
71
+ constructor(readRows = openClawTimelineForSession, listSessions = listOpenClawSessions) {
72
+ this.readRows = readRows;
73
+ this.listSessions = listSessions;
74
+ }
75
+ /**
76
+ * Rows to emit for this tick, oldest-first across all sessions.
77
+ *
78
+ * `now` is injectable so a test can drive the activity window without a clock.
79
+ */
80
+ pump(now = Date.now()) {
81
+ let sessions;
82
+ try {
83
+ sessions = this.listSessions();
84
+ }
85
+ catch (err) {
86
+ debug('daemon', `openclaw-feed session list failed: ${String(err)}`);
87
+ return [];
88
+ }
89
+ const active = sessions
90
+ .filter((s) => now - s.updatedAt <= ACTIVE_WINDOW_MS)
91
+ .slice(0, MAX_SESSIONS_PER_TICK);
92
+ const live = new Set(active.map((s) => s.sessionId));
93
+ for (const id of [...this.watermark.keys()]) {
94
+ if (!live.has(id))
95
+ this.watermark.delete(id);
96
+ }
97
+ const out = [];
98
+ for (const session of active) {
99
+ const since = this.watermark.get(session.sessionId);
100
+ let rows;
101
+ try {
102
+ rows = this.readRows(session.sessionId, { since, limit: ROWS_PER_TICK });
103
+ }
104
+ catch (err) {
105
+ debug('daemon', `openclaw-feed read failed for ${session.sessionId}: ${String(err)}`);
106
+ continue;
107
+ }
108
+ if (rows.length === 0) {
109
+ // Seed an empty/unreadable session at 0 so its first real row is
110
+ // emitted rather than swallowed as history.
111
+ if (since === undefined)
112
+ this.watermark.set(session.sessionId, 0);
113
+ continue;
114
+ }
115
+ const newest = rows[rows.length - 1].ts;
116
+ this.watermark.set(session.sessionId, newest);
117
+ if (since === undefined) {
118
+ // First sighting: adopt the position, emit nothing. See the header —
119
+ // the Gateway stream is already filling this session's strip.
120
+ debug('daemon', `openclaw-feed seeded ${session.sessionId} at ${newest} (silent)`);
121
+ continue;
122
+ }
123
+ for (const row of rows)
124
+ out.push(this.attribute(row, session));
125
+ }
126
+ this.enforceCeiling();
127
+ return out.sort((a, b) => (a.ts < b.ts ? -1 : a.ts > b.ts ? 1 : 0));
128
+ }
129
+ /** Tracked session count — for tests and diagnostics. */
130
+ get size() {
131
+ return this.watermark.size;
132
+ }
133
+ /**
134
+ * Stamp the row with the virtual Gateway session and say which OpenClaw
135
+ * session key produced it.
136
+ *
137
+ * The key leads `detail`: everything below it (the tool's own output, the
138
+ * model) is context, while "this came from a model-eval run and not from your
139
+ * chat" is the part that reorients the reader.
140
+ */
141
+ attribute(row, session) {
142
+ const head = `session: ${shortSessionKey(session.sessionKey)}`;
143
+ return {
144
+ ...row,
145
+ sessionId: OPENCLAW_SESSION_ID,
146
+ agentType: 'openclaw',
147
+ projectName: 'OpenClaw',
148
+ detail: [head, row.detail].filter(Boolean).join('\n'),
149
+ };
150
+ }
151
+ enforceCeiling() {
152
+ if (this.watermark.size <= MAX_TRACKED)
153
+ return;
154
+ const byAge = [...this.watermark.entries()].sort((a, b) => a[1] - b[1]);
155
+ for (const [id] of byAge) {
156
+ if (this.watermark.size <= MAX_TRACKED)
157
+ break;
158
+ this.watermark.delete(id);
159
+ }
160
+ }
161
+ }
162
+ //# sourceMappingURL=openclaw-timeline-feed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openclaw-timeline-feed.js","sourceRoot":"","sources":["../src/openclaw-timeline-feed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACL,oBAAoB,EACpB,0BAA0B,GAE3B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG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,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxE,KAAK,MAAM,CAAC,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,WAAW;gBAAE,MAAM;YAC9C,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Timeline rows read from OpenClaw's OWN on-disk session store.
3
+ *
4
+ * WHY THIS EXISTS. OpenClaw reaches this daemon through the Gateway WebSocket
5
+ * event stream and nothing else — the adapter's whole RPC surface is `connect`
6
+ * / `sessions.list` / `chat.send` / `chat.abort` / `exec.approval.*`. That
7
+ * stream carries the prompt, the final response, and the approvals it has to
8
+ * block on. It does NOT carry the individual tool calls, so the timeline showed
9
+ * "OpenClaw said something" with no account of what it actually did, and the
10
+ * only tools that ever appeared were the ones that happened to need approval —
11
+ * a biased sample, not a log.
12
+ *
13
+ * OpenClaw writes a full transcript per session (measured 2026-08-23 against
14
+ * OpenClaw 2026.7.1-2). This reads it, exactly the way `kiro-transcript-timeline`
15
+ * reads Kiro's — an agent that pushes nothing still has a producer.
16
+ *
17
+ * **Scope is deliberately the complement of the Gateway stream, not a
18
+ * duplicate of it.** Only `tool_exec` rows are emitted here. Prompts, responses
19
+ * and approval rows already arrive live over the Gateway and re-deriving them
20
+ * would double every turn in the strip.
21
+ *
22
+ * The record shapes below were copied off a real store, never invented — this
23
+ * repo has a specific history of parsers written against imagined fixtures that
24
+ * passed their tests and matched nothing real, so the test file pins the
25
+ * measured shape verbatim:
26
+ *
27
+ * {"type":"session","version":3,"id":"fef73899-…","timestamp":"2026-08-22T23:52:16.443Z",
28
+ * "cwd":"/Users/x/.openclaw/workspace"}
29
+ * {"type":"message","id":"577c04b8","parentId":"40296bc1",
30
+ * "timestamp":"2026-08-22T23:52:23.315Z",
31
+ * "message":{"role":"assistant","content":[
32
+ * {"type":"thinking","thinking":"…"},
33
+ * {"type":"toolCall","id":"38e16c61-…","name":"exec",
34
+ * "arguments":{"command":"ls ~/github/OpenClaw && …"}}],
35
+ * "provider":"openrouter","model":"stealth/ox-alpha","usage":{…}}}
36
+ * {"type":"message","id":"53079fbe","timestamp":"2026-08-22T23:52:23.376Z",
37
+ * "message":{"role":"toolResult","toolCallId":"38e16c61-…","toolName":"exec",
38
+ * "content":[{"type":"text","text":"CAPTURE_GUIDE.md\n…"}],
39
+ * "details":{"status":"completed","exitCode":0,"durationMs":13},"isError":false}}
40
+ *
41
+ * Three properties of that shape drive the code:
42
+ * - A line carries an ISO `timestamp` AND `message.timestamp` in epoch-ms.
43
+ * They agree; the ISO one is used, with the epoch one as the fallback,
44
+ * because a row with no time cannot be ordered against the live stream.
45
+ * - A tool call and its result are SEPARATE lines linked by `toolCallId`. The
46
+ * call names what was attempted and only the result knows whether it worked,
47
+ * so a row is emitted once, at the call, and completed from the result.
48
+ * - `isError` and `details.exitCode` disagree in the interesting direction: a
49
+ * command can exit 0 while the tool reports an error (and vice versa), so
50
+ * both are consulted rather than picking one.
51
+ */
52
+ import type { TimelineEntry } from '@agentdeck/shared';
53
+ export interface OpenClawStoreOptions {
54
+ /** Injectable for tests; defaults to `~/.openclaw`. */
55
+ stateDir?: string;
56
+ }
57
+ export interface OpenClawTimelineOptions extends OpenClawStoreOptions {
58
+ /** Epoch-ms lower bound; rows at or before it are dropped. */
59
+ since?: number;
60
+ /** Newest N rows kept. */
61
+ limit?: number;
62
+ }
63
+ /** One session as the index describes it. */
64
+ export interface OpenClawStoreSession {
65
+ /** `agent:main:main`, `agent:main:cron:<uuid>`, `agent:main:eval-…__r2`. */
66
+ sessionKey: string;
67
+ sessionId: string;
68
+ agent: string;
69
+ updatedAt: number;
70
+ }
71
+ export declare function openClawStateDir(opts?: OpenClawStoreOptions): string;
72
+ /**
73
+ * Sessions across every agent, newest-first.
74
+ *
75
+ * Reads each agent's `sessions.json`, whose keys ARE the session keys — the one
76
+ * fact that says whether a given piece of OpenClaw activity is the chat the
77
+ * user is looking at (`agent:main:main`), a scheduled job
78
+ * (`agent:main:cron:<id>`) or a model-eval run (`agent:main:eval-…__r2`). All
79
+ * three arrive at AgentDeck as the single literal "OpenClaw", which is why an
80
+ * approval raised by an eval harness looked like it came from a conversation
81
+ * the user could not find.
82
+ */
83
+ export declare function listOpenClawSessions(opts?: OpenClawStoreOptions): OpenClawStoreSession[];
84
+ /**
85
+ * The one line that says what a tool call is going to do.
86
+ *
87
+ * `exec` is the overwhelming majority and its `command` is the whole story.
88
+ * Anything else falls back to the first string-valued argument, then to the
89
+ * argument names — a tool this build has never seen must degrade to something
90
+ * true ("browser · url, selector") rather than render as nothing.
91
+ */
92
+ export declare function summarizeToolArguments(args: unknown): string;
93
+ /**
94
+ * `tool_exec` rows for one session's transcript, oldest-first.
95
+ *
96
+ * Emitted at the CALL, then completed in place from the matching result: the
97
+ * call is when the work started and is what orders correctly against the live
98
+ * Gateway rows, while only the result knows the outcome. Building the row at
99
+ * the result instead would stamp every tool with the time it finished and lose
100
+ * any call still running when the read happened.
101
+ */
102
+ export declare function openClawTimelineForSession(sessionId: string, opts?: OpenClawTimelineOptions): TimelineEntry[];
103
+ //# sourceMappingURL=openclaw-transcript-timeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openclaw-transcript-timeline.d.ts","sourceRoot":"","sources":["../src/openclaw-transcript-timeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAWvD,MAAM,WAAW,oBAAoB;IACnC,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,uBAAwB,SAAQ,oBAAoB;IACnE,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,6CAA6C;AAC7C,MAAM,WAAW,oBAAoB;IACnC,4EAA4E;IAC5E,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,oBAAyB,GAAG,MAAM,CAExE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,GAAE,oBAAyB,GAAG,oBAAoB,EAAE,CAqC5F;AA2CD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAa5D;AAOD;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE,uBAA4B,GACjC,aAAa,EAAE,CA2HjB"}