@kabmo-labs/kabmo 0.53.2 → 0.55.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 (146) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +538 -527
  3. package/dist/client/static/js/{Body-vaa10tcd.js → Body-a4dwe3hh.js} +1 -1
  4. package/dist/client/static/js/{CsvGrid-wabx4e6w.js → CsvGrid-ppj80brw.js} +1 -1
  5. package/dist/client/static/js/{DocxView-22b3mhh5.js → DocxView-ef0bd2pg.js} +1 -1
  6. package/dist/client/static/js/{DrawioView-e02qhkp2.js → DrawioView-44tpkzbd.js} +1 -1
  7. package/dist/client/static/js/{HtmlPreview-q7hwcf4s.js → HtmlPreview-w654aykz.js} +1 -1
  8. package/dist/client/static/js/{ImageView-fxb60ge7.js → ImageView-kg0skt5s.js} +1 -1
  9. package/dist/client/static/js/{LayoutWrapper-cey5agsf.js → LayoutWrapper-qepkrtd8.js} +2 -2
  10. package/dist/client/static/js/MergeDiffView-n2h8vv0j.js +1 -0
  11. package/dist/client/static/js/{Modal-e4yq7p5f.js → Modal-8d299emm.js} +17 -17
  12. package/dist/client/static/js/{PdfView-pf3angsq.js → PdfView-eq7fnqa2.js} +1 -1
  13. package/dist/client/static/js/{SessionsView-mcvhpx0b.js → SessionsView-tedh2es3.js} +1 -1
  14. package/dist/client/static/js/{SheetView-5ha5vvsr.js → SheetView-5xm33kgk.js} +1 -1
  15. package/dist/client/static/js/{SvgPreview-45wqjw0b.js → SvgPreview-tp1m8r4t.js} +1 -1
  16. package/dist/client/static/js/{abnfDiagram-O67JEVCF-gnf6krbs.js → abnfDiagram-O67JEVCF-xppr9jf1.js} +1 -1
  17. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-00fd0wsg.js → architectureDiagram-NJMV4G6O-s23e6vtk.js} +1 -1
  18. package/dist/client/static/js/{blockDiagram-BEXU5L5S-9c2sm96a.js → blockDiagram-BEXU5L5S-7ws8yq9e.js} +1 -1
  19. package/dist/client/static/js/{c4Diagram-YGBWAQC7-pemygn0s.js → c4Diagram-YGBWAQC7-517yhfzj.js} +1 -1
  20. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-h7r3sx3s.js → classDiagram-v2-NBCMYWYE-tcad3rst.js} +1 -1
  21. package/dist/client/static/js/{cose-bilkent-JH36ORCC-krx9crwv.js → cose-bilkent-JH36ORCC-a76vf82p.js} +1 -1
  22. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-5rp2btew.js → cynefinDiagram-VND7K2PF-9kety453.js} +1 -1
  23. package/dist/client/static/js/{dagre-6A5THRUB-q57cnz52.js → dagre-6A5THRUB-6g6gsp6b.js} +1 -1
  24. package/dist/client/static/js/{diagram-22UHCM2B-0bptn06k.js → diagram-22UHCM2B-ngj4fyg3.js} +1 -1
  25. package/dist/client/static/js/{diagram-3UASUU5V-60snxawz.js → diagram-3UASUU5V-xw2m99qa.js} +1 -1
  26. package/dist/client/static/js/{diagram-ATOU4E4O-bb0kewfp.js → diagram-ATOU4E4O-hz3bd083.js} +2 -2
  27. package/dist/client/static/js/{diagram-CDSNMT55-3cdkns0z.js → diagram-CDSNMT55-vfhtemve.js} +3 -3
  28. package/dist/client/static/js/{diagram-MLGK6HIB-03mbhzeq.js → diagram-MLGK6HIB-22cjvj5g.js} +1 -1
  29. package/dist/client/static/js/{diagram-MPIPVDR6-bcvzqqf4.js → diagram-MPIPVDR6-xv8fsecp.js} +2 -2
  30. package/dist/client/static/js/{dockerfile-7kqkk4tz.js → dockerfile-491tyqmj.js} +1 -1
  31. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-sg6kwnbx.js → ebnfDiagram-ZINNZB2B-m6mkn986.js} +1 -1
  32. package/dist/client/static/js/{elk-276RUBZZ-5b8v0sdv.js → elk-276RUBZZ-jccw706n.js} +1 -1
  33. package/dist/client/static/js/{erDiagram-OPXOYQCR-xbs156j5.js → erDiagram-OPXOYQCR-rxk86jsf.js} +1 -1
  34. package/dist/client/static/js/flowDiagram-KWPJA3E3-aegwx04w.js +1 -0
  35. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-4p7pfk6c.js → ganttDiagram-FUAMR5RP-veweech7.js} +1 -1
  36. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-3xqwr9pf.js → gitGraphDiagram-X574FWY7-7dyqcj8r.js} +2 -2
  37. package/dist/client/static/js/{index-p75b7phb.js → index-088gwjbz.js} +1 -1
  38. package/dist/client/static/js/{index-5qtnmn76.js → index-0ak5wdz1.js} +1 -1
  39. package/dist/client/static/js/{index-pak6t03c.js → index-0qmpqtp2.js} +1 -1
  40. package/dist/client/static/js/{index-26a4afcr.js → index-0xh8402w.js} +1 -1
  41. package/dist/client/static/js/{index-yf5a6t3p.js → index-2asa0faw.js} +1 -1
  42. package/dist/client/static/js/{index-gzz6snng.js → index-2cfw7wem.js} +1 -1
  43. package/dist/client/static/js/{index-e2esj214.js → index-39mr4tym.js} +1 -1
  44. package/dist/client/static/js/{index-hp3s5r3g.js → index-3x88fxzj.js} +1 -1
  45. package/dist/client/static/js/{index-trrmbq0h.js → index-4m94cbms.js} +1 -1
  46. package/dist/client/static/js/{index-rtpg4t84.js → index-5701gj1f.js} +1 -1
  47. package/dist/client/static/js/{index-pdkt3r4r.js → index-60fjqzdw.js} +1 -1
  48. package/dist/client/static/js/{index-mtjbp5ga.js → index-637my5h0.js} +1 -1
  49. package/dist/client/static/js/{index-c8ta3k4g.js → index-7ckzdf4r.js} +158 -156
  50. package/dist/client/static/js/{index-1d8ff4t7.js → index-7ehep28z.js} +2 -2
  51. package/dist/client/static/js/{index-hwq7zgqd.js → index-bfy437re.js} +1 -1
  52. package/dist/client/static/js/{index-zc3snsr9.js → index-bhst1c2x.js} +1 -1
  53. package/dist/client/static/js/{index-nnhs52db.js → index-cz80n8yc.js} +1 -1
  54. package/dist/client/static/js/{index-ayx3q8t9.js → index-d9dz0wt0.js} +1 -1
  55. package/dist/client/static/js/{index-3bmn5cc5.js → index-dg714jam.js} +1 -1
  56. package/dist/client/static/js/{index-z7gd7nvb.js → index-e6tjaccf.js} +1 -1
  57. package/dist/client/static/js/{index-vwxt5ss9.js → index-gsw1zh30.js} +1 -1
  58. package/dist/client/static/js/{index-x0y2c61e.js → index-j0qt8gaj.js} +1 -1
  59. package/dist/client/static/js/{index-45vcpqp9.js → index-kfcpkx7h.js} +1 -1
  60. package/dist/client/static/js/{index-cy6ceab8.js → index-na95tr1k.js} +1 -1
  61. package/dist/client/static/js/{index-ng3e6k6x.js → index-nzjc24v9.js} +1 -1
  62. package/dist/client/static/js/{index-3amzzsdk.js → index-pqmvhqmj.js} +11 -11
  63. package/dist/client/static/js/{index-0btbxkxf.js → index-r51fqzb5.js} +1 -1
  64. package/dist/client/static/js/{index-cj8v7b50.js → index-sx5x2q80.js} +1 -1
  65. package/dist/client/static/js/{index-qj9tcz44.js → index-tk1vr8q2.js} +1 -1
  66. package/dist/client/static/js/{index-j9t5xc3y.js → index-trpn9gxs.js} +1 -1
  67. package/dist/client/static/js/{index-1regq9wd.js → index-twjq786a.js} +1 -1
  68. package/dist/client/static/js/{index-xqkcx4az.js → index-wa234c7k.js} +1 -1
  69. package/dist/client/static/js/{index-mgs5nscx.js → index-wp7tsava.js} +1 -1
  70. package/dist/client/static/js/{index-nmhwjwmt.js → index-wvqwzgpx.js} +1 -1
  71. package/dist/client/static/js/{index-jg6ecfc7.js → index-xbvjpa60.js} +2 -2
  72. package/dist/client/static/js/{index-jf8zcg99.js → index-xm3691yp.js} +4 -4
  73. package/dist/client/static/js/{index-cysdvwqw.js → index-xq78fj64.js} +1 -1
  74. package/dist/client/static/js/{index-ryww3xxj.js → index-zjc8yfbe.js} +1 -1
  75. package/dist/client/static/js/{infoDiagram-VRGFBTTK-c362sv3t.js → infoDiagram-VRGFBTTK-ksz9cvq3.js} +1 -1
  76. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-yc8ts8wj.js → ishikawaDiagram-OU5B5YK6-g8symmrp.js} +1 -1
  77. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-178c75fy.js → journeyDiagram-ZHPQQLJL-qs2e3hdf.js} +1 -1
  78. package/dist/client/static/js/{kanban-definition-PNTS6WVX-w6g3n001.js → kanban-definition-PNTS6WVX-pzef80sz.js} +1 -1
  79. package/dist/client/static/js/{mermaid.core-vcdgn378.js → mermaid.core-chfcvkkc.js} +3 -3
  80. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-t9e8arca.js → mindmap-definition-NLK3R4M7-sds2e243.js} +1 -1
  81. package/dist/client/static/js/one-dark-pro-5fvhpb1t.js +1 -0
  82. package/dist/client/static/js/one-light-pwj40vbr.js +1 -0
  83. package/dist/client/static/js/{pegDiagram-GJSIUBJH-nehn0x9n.js → pegDiagram-GJSIUBJH-m8199cy0.js} +1 -1
  84. package/dist/client/static/js/{pieDiagram-5QR66LMP-p1t3ctd4.js → pieDiagram-5QR66LMP-wqz5k5w6.js} +2 -2
  85. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-614rtbfe.js → quadrantDiagram-O4NWA36T-rjszd8an.js} +1 -1
  86. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-2vpr6pw8.js → railroadDiagram-XR7U4H2S-qv0be7dh.js} +1 -1
  87. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-b91s5q3p.js → requirementDiagram-PLB6GJNP-b87kqbr7.js} +1 -1
  88. package/dist/client/static/js/{rust-jj206pb7.js → rust-m7ma3tq9.js} +1 -1
  89. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-4101kt9r.js → sankeyDiagram-IPEJSGJF-dh5we479.js} +1 -1
  90. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-yq0cxg8c.js → sequenceDiagram-PO4LG4MO-e6fg0x45.js} +1 -1
  91. package/dist/client/static/js/{sizeCapture-INFHLROL-jkvq39vz.js → sizeCapture-INFHLROL-mam6cagq.js} +1 -1
  92. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-y0h7w5rw.js → stateDiagram-v2-GCMORJYK-htwar22v.js} +1 -1
  93. package/dist/client/static/js/{swimlanes-2SLR337P-1y073wzx.js → swimlanes-2SLR337P-5g26cnkr.js} +1 -1
  94. package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-8ahz3c68.js → swimlanesDiagram-TC7HE7FX-rseba3zs.js} +1 -1
  95. package/dist/client/static/js/{timeline-definition-EJHVYXUP-yjb0g0ys.js → timeline-definition-EJHVYXUP-5km8n8mj.js} +1 -1
  96. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-8xjkxrkv.js → usecaseDiagram-POWQR4AR-0vt6ms5g.js} +1 -1
  97. package/dist/client/static/js/{vennDiagram-UO4OBE2U-18wjbwtg.js → vennDiagram-UO4OBE2U-k425105a.js} +2 -2
  98. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-xqrfsrwp.js → wardleyDiagram-VNRHLVJA-s0gd4jg1.js} +2 -2
  99. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-azygghkz.js → xychartDiagram-PMCCYNJV-2nrdzp7p.js} +2 -2
  100. package/package.json +5 -5
  101. package/src/client/App.tsx +4 -0
  102. package/src/client/bootstrap.d.ts +11 -0
  103. package/src/client/components/workspace/chat-timeline/tool-renderers/index.tsx +2 -0
  104. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AgentAdmin.test.tsx +67 -0
  105. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AgentAdmin.tsx +89 -0
  106. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Mcp.test.tsx +91 -0
  107. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Mcp.tsx +8 -2
  108. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.test.ts +9 -0
  109. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +16 -1
  110. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/WebSearch.test.tsx +59 -0
  111. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/WebSearch.tsx +11 -1
  112. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/agent-admin-rows.test.ts +119 -0
  113. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/agent-admin-rows.ts +174 -0
  114. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/task-rows.ts +14 -2
  115. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.test.ts +22 -0
  116. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.ts +14 -0
  117. package/src/client/data/settings/omp-schema.json +455 -165
  118. package/src/client/hooks/shell/last-opened-session.test.ts +166 -0
  119. package/src/client/hooks/shell/last-opened-session.ts +74 -0
  120. package/src/client/lib/router/open-session.test.ts +8 -0
  121. package/src/client/lib/router/open-session.ts +9 -4
  122. package/src/client/main.tsx +7 -0
  123. package/src/server/lib/db/schema.ts +10 -0
  124. package/src/server/lib/sessions/last-opened-client.server.ts +86 -0
  125. package/src/server/lib/sessions/last-opened-client.test.ts +91 -0
  126. package/src/server/lib/sessions/last-opened.server.test.ts +127 -0
  127. package/src/server/lib/sessions/last-opened.server.ts +129 -0
  128. package/src/server/plugins/ssr.ts +40 -17
  129. package/src/server/routes/fs/raw.test.ts +33 -0
  130. package/src/server/routes/fs/raw.ts +31 -11
  131. package/src/server/routes/sessions/index.ts +14 -0
  132. package/src/server/routes/sessions/last-opened.test.ts +139 -0
  133. package/src/server/routes/sessions/last-opened.ts +66 -0
  134. package/src/shared/lib/chat/timeline/tool-phrases.test.ts +4 -0
  135. package/src/shared/lib/chat/timeline/tool-phrases.ts +2 -0
  136. package/src/shared/lib/models/provider/glyph.test.ts +13 -11
  137. package/src/shared/lib/models/provider/glyph.ts +1 -0
  138. package/src/shared/lib/models/provider/label.ts +3 -0
  139. package/src/shared/lib/omp/config/schema-releases-19-3.test.ts +64 -0
  140. package/src/shared/lib/omp/config/schema-releases.test.ts +21 -4
  141. package/src/shared/lib/omp/session/wait-idle.test.ts +12 -2
  142. package/src/shared/lib/omp/session/wait-idle.ts +11 -6
  143. package/dist/client/static/js/MergeDiffView-1z9mwf73.js +0 -1
  144. package/dist/client/static/js/flowDiagram-KWPJA3E3-sasgvf55.js +0 -1
  145. package/dist/client/static/js/one-dark-pro-17hh3q12.js +0 -1
  146. package/dist/client/static/js/one-light-cntgvscy.js +0 -1
@@ -0,0 +1,129 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The session a native shell resumes on a cold start — PER CLIENT.
8
+ *
9
+ * The shells load the console's origin with no query, and the console used to
10
+ * answer that with its empty workspace. "The session I had open" is a fact the
11
+ * URL cannot carry across a relaunch — the shell stores no session id of its
12
+ * own — so the server keeps it.
13
+ *
14
+ * The grain is the CLIENT, not the server. A console is one database but not
15
+ * one device: the phone shell, the desktop shell and a browser tab can all
16
+ * point at the same instance, and a single shared row made each of them
17
+ * overwrite the others (open a chat on the desktop, and the phone restored it on
18
+ * its next launch). `client_id` comes from the `kabmo_client` cookie
19
+ * (`last-opened-client.server.ts`), whose jar is per WebView data store — the
20
+ * same boundary the user sees as "this app".
21
+ *
22
+ * ## What is recorded
23
+ *
24
+ * Every session a shell's URL selects. A browser records too (its cookie names
25
+ * its own row), but only a shell restores: the record is the fact a relaunch
26
+ * needs, not a browser navigation rule.
27
+ *
28
+ * ## What is NOT recorded
29
+ *
30
+ * Pending ids (`new-…`, `__new__…`). They name a chat that has not been spawned
31
+ * and may never be; restoring one would relaunch into a placeholder that no
32
+ * longer exists. The spawn adoption writes the real id through the same path,
33
+ * so the open is not lost — only deferred until it is a real session.
34
+ *
35
+ * ## Why the record is validated on read
36
+ *
37
+ * A shell restores before anyone can press anything, so a stale id is a launch
38
+ * into a 404. The read therefore answers `null` — and clears the row — for an
39
+ * id that is deleted, archived, or no longer present. Already-deleted sessions
40
+ * also lose their record at delete time; this check is the backstop for the
41
+ * paths that remove a session without going through that route (an omp
42
+ * transcript removed by hand, another instance, a restored backup).
43
+ */
44
+
45
+ import { isMockMode } from '@kabmo-labs/kabmo-runtime-flags';
46
+ import { isSinglePathSegment } from '@kabmo-labs/kabmo-paths/path-segment';
47
+ import { getDb } from '@/server/db.server';
48
+ import { isSessionArchived, sessionExists } from '@/server/lib/sessions/resolve.server';
49
+
50
+ /** The stored id for one client, or null when there is none. */
51
+ export async function readLastOpenedSessionId(clientId: string): Promise<string | null> {
52
+ if (!clientId) return null;
53
+ const db = await getDb();
54
+ const row = await db.get<{ session_id?: string }>(
55
+ 'SELECT session_id FROM last_opened_sessions WHERE client_id = ?',
56
+ [clientId],
57
+ );
58
+ const value = row?.session_id?.trim();
59
+ return value ? value : null;
60
+ }
61
+
62
+ /**
63
+ * Persist `sessionId` as this client's last opened session.
64
+ *
65
+ * Returns false for an id that is not a recordable session: a placeholder, a
66
+ * value that is not one path segment, or a no-op rewrite of the current row. A
67
+ * caller reports the refusal rather than pretending the write happened.
68
+ */
69
+ export async function recordLastOpenedSession(clientId: string, sessionId: string): Promise<boolean> {
70
+ if (!clientId) return false;
71
+ if (!isSinglePathSegment(sessionId)) return false;
72
+ // A pending chat (`new-…`, `__new__…`) has no session to reopen yet; the
73
+ // spawn adoption sends the real id through this same call.
74
+ if (sessionId.startsWith('new-') || sessionId.startsWith('__new__')) return false;
75
+ if ((await readLastOpenedSessionId(clientId)) === sessionId) return true;
76
+
77
+ const db = await getDb();
78
+ await db.run(
79
+ `INSERT OR REPLACE INTO last_opened_sessions (client_id, session_id, updated_at)
80
+ VALUES (?, ?, CURRENT_TIMESTAMP)`,
81
+ [clientId, sessionId],
82
+ );
83
+ return true;
84
+ }
85
+
86
+ /** Drop this client's record, so its next cold start lands on the empty workspace. */
87
+ export async function clearLastOpenedSession(clientId: string): Promise<void> {
88
+ if (!clientId) return;
89
+ const db = await getDb();
90
+ await db.run('DELETE FROM last_opened_sessions WHERE client_id = ?', [clientId]);
91
+ }
92
+
93
+ /**
94
+ * Whether a session id can still be opened: present, not archived, not
95
+ * tombstoned. Mock rows live in `sessions`; a real session is live, recorded in
96
+ * `harness_sessions`, or has a transcript on disk.
97
+ */
98
+ async function sessionCanOpen(sessionId: string): Promise<boolean> {
99
+ const db = await getDb();
100
+ const deleted = await db.get(
101
+ 'SELECT 1 AS present FROM deleted_sessions WHERE session_id = ?',
102
+ [sessionId],
103
+ );
104
+ if (deleted) return false;
105
+ if (await isSessionArchived(sessionId)) return false;
106
+
107
+ if (isMockMode()) {
108
+ const row = await db.get('SELECT 1 AS present FROM sessions WHERE CAST(id AS TEXT) = ?', [
109
+ sessionId,
110
+ ]);
111
+ return row != null;
112
+ }
113
+
114
+ return sessionExists(sessionId);
115
+ }
116
+
117
+ /**
118
+ * The session this client should restore, or null.
119
+ *
120
+ * A stale record is DELETED, not merely skipped: every later launch would
121
+ * otherwise repeat the same check for a session that can never come back.
122
+ */
123
+ export async function lastOpenedSession(clientId: string): Promise<string | null> {
124
+ const sessionId = await readLastOpenedSessionId(clientId);
125
+ if (!sessionId) return null;
126
+ if (await sessionCanOpen(sessionId)) return sessionId;
127
+ await clearLastOpenedSession(clientId);
128
+ return null;
129
+ }
@@ -31,6 +31,8 @@ import { windowChromeColor } from '@/shared/lib/theme/chrome';
31
31
  import { THEME_CSS_ROUTE, serveThemeCss } from '@/server/lib/assets/theme-css.server';
32
32
  import { THEME_CSS_LINK_ATTRIBUTE } from '@/shared/lib/theme/css';
33
33
  import { isAndroidDevice, shellVersion } from '@/shared/lib/updates/shell-ua';
34
+ import { lastOpenedSession } from '@/server/lib/sessions/last-opened.server';
35
+ import { resolveClientIdentity } from '@/server/lib/sessions/last-opened-client.server';
34
36
 
35
37
  /** HTML-escape a string for interpolation into the failure page's `<pre>`. */
36
38
  function escapeHtmlText(value: string): string {
@@ -223,6 +225,21 @@ export const ssrRoutes = new Elysia({ name: 'ssr' }).get('*', async ({ request }
223
225
  const androidVersion = shellVersion(userAgent, 'android');
224
226
  const iosVersion = shellVersion(userAgent, 'ios');
225
227
  const isAndroid = isAndroidDevice(userAgent);
228
+ // The session THIS install would restore, resolved BEFORE the page exists so
229
+ // the client can select it in its first render. The id is per WebView/app
230
+ // cookie jar, so a phone and a desktop never overwrite each other. Validated
231
+ // here rather than by the page: a stale id must not become a launch into a
232
+ // 404. Skipped for an unauthenticated request — the client shows the login
233
+ // screen and has no workspace to restore into.
234
+ const clientIdentity = resolveClientIdentity(request);
235
+ const lastOpenedSessionId = authenticated
236
+ ? await lastOpenedSession(clientIdentity.clientId).catch((error: unknown) => {
237
+ // The record is what makes a relaunch resume; failing to read it must
238
+ // leave the landing, never take the whole document down.
239
+ console.warn('[ssr] last-opened session read failed:', error);
240
+ return null;
241
+ })
242
+ : null;
226
243
 
227
244
  const rendered = await renderShell();
228
245
  if (!rendered.ok) return shellUnavailableResponse(rendered.reason);
@@ -234,7 +251,7 @@ export const ssrRoutes = new Elysia({ name: 'ssr' }).get('*', async ({ request }
234
251
  // questions: "this browser has a session" versus "there is a session to have".
235
252
  // A Kabmo running open answers `authenticated: true` for every visitor, so
236
253
  // the navbar cannot use it to decide whether a sign-out control applies.
237
- const bootstrap = JSON.stringify({ initialIsMobile, shellVersion: androidVersion, iosShellVersion: iosVersion, isAndroid, authenticated, authEnabled: isAuthEnabled(), production: !DEV_ASSETS_ENABLED, appSettings: publishedSettings }).replace(/</g, '\\u003c');
254
+ const bootstrap = JSON.stringify({ initialIsMobile, shellVersion: androidVersion, iosShellVersion: iosVersion, isAndroid, authenticated, authEnabled: isAuthEnabled(), production: !DEV_ASSETS_ENABLED, lastOpenedSessionId, appSettings: publishedSettings }).replace(/</g, '\\u003c');
238
255
  // The template's own `<meta name="theme-color">` is REWRITTEN, not joined by
239
256
  // a second tag: with both present Chrome reads the first one, so an appended
240
257
  // tag would leave a dark theme painting light browser chrome.
@@ -269,23 +286,29 @@ export const ssrRoutes = new Elysia({ name: 'ssr' }).get('*', async ({ request }
269
286
  // bundled copy (which no route can vary) is replaced by the themed route.
270
287
  const shellHtml = rewriteManifestLink(served);
271
288
 
289
+ const document = new Response(
290
+ applyShellDocumentFacts(shellHtml, {
291
+ palette: theme,
292
+ // The presentation styles are read from the same blob as the palette,
293
+ // so the FIRST frame is already the material, the hairline set and the
294
+ // paint the user chose: without this a glass install paints one opaque
295
+ // frame and swaps, and a borderless one paints every separator first.
296
+ surfaceStyle: readSettingsBlob(settings)[SURFACE_STYLE_SETTING_KEY],
297
+ borderStyle: readSettingsBlob(settings)[BORDER_STYLE_SETTING_KEY],
298
+ iconStyle: readSettingsBlob(settings)[ICON_STYLE_SETTING_KEY],
299
+ chromeColor: chrome,
300
+ })
301
+ .replace('<!--app-head-->', firstFrame + themeLink + fontLink)
302
+ .replace(SHELL_MARKER, `<script>window.__OMP_BOOTSTRAP__=${bootstrap}</script>`),
303
+ { headers: HTML_HEADERS },
304
+ );
305
+ // The FIRST document a shell/webview ever loads is where its client id is
306
+ // minted. Every later request (the recorder's POST included) carries it, so
307
+ // the last-opened row belongs to this install and not to the server.
308
+ if (clientIdentity.setCookie) document.headers.append('set-cookie', clientIdentity.setCookie);
309
+
272
310
  return maybeCompress(
273
- new Response(
274
- applyShellDocumentFacts(shellHtml, {
275
- palette: theme,
276
- // The presentation styles are read from the same blob as the palette,
277
- // so the FIRST frame is already the material, the hairline set and the
278
- // paint the user chose: without this a glass install paints one opaque
279
- // frame and swaps, and a borderless one paints every separator first.
280
- surfaceStyle: readSettingsBlob(settings)[SURFACE_STYLE_SETTING_KEY],
281
- borderStyle: readSettingsBlob(settings)[BORDER_STYLE_SETTING_KEY],
282
- iconStyle: readSettingsBlob(settings)[ICON_STYLE_SETTING_KEY],
283
- chromeColor: chrome,
284
- })
285
- .replace('<!--app-head-->', firstFrame + themeLink + fontLink)
286
- .replace(SHELL_MARKER, `<script>window.__OMP_BOOTSTRAP__=${bootstrap}</script>`),
287
- { headers: HTML_HEADERS },
288
- ),
311
+ document,
289
312
  // 24 KB of markup the browser can never store (`no-store`), so every
290
313
  // navigation pays for it again — compressed, it is about a fifth of that.
291
314
  // `maybeCompress` adds the `Vary` this response needs for the same reason
@@ -39,6 +39,14 @@ async function raw(relPath: string, init?: RequestInit) {
39
39
  return res;
40
40
  }
41
41
 
42
+ /** An ABSOLUTE reference: `root` is deliberately absent. */
43
+ async function rawReference(reference: string) {
44
+ const url = new URL('http://localhost/api/fs/raw');
45
+ url.searchParams.set('path', reference);
46
+ const res = await serveRawFile({ request: new Request(url) } as never);
47
+ return res;
48
+ }
49
+
42
50
  function write(relPath: string, bytes: Uint8Array) {
43
51
  const target = path.join(DIR, relPath);
44
52
  fs.mkdirSync(path.dirname(target), { recursive: true });
@@ -117,6 +125,31 @@ describe('fs raw route', () => {
117
125
  expect(res.headers.get('content-disposition')).toContain('report.pdf');
118
126
  });
119
127
 
128
+ // An ACP `read_file` names its file ABSOLUTELY (`locations[].path`), and the
129
+ // reader paints an image from this route. Stripping the leading `/` pointed
130
+ // it at `<root>/Users/…` — a 404 over a file that exists.
131
+ test('an absolute path inside an allowed root is served', async () => {
132
+ const target = write('abs.png', new Uint8Array([0x89, 0x50, 0x4e, 0x47]));
133
+ const res = await rawReference(target);
134
+
135
+ expect(res.status).toBe(200);
136
+ expect(res.headers.get('content-type')).toBe('image/png');
137
+ });
138
+
139
+ test('a file:// reference is served under the same allow-list', async () => {
140
+ const target = write('abs-ref.png', new Uint8Array([0x89, 0x50, 0x4e, 0x47]));
141
+ const res = await rawReference(`file://${target}`);
142
+
143
+ expect(res.status).toBe(200);
144
+ });
145
+
146
+ test('an absolute path outside every allowed root is refused', async () => {
147
+ // `/etc/hosts` exists on every POSIX host; it is not on the allow-list.
148
+ const res = await rawReference('/etc/hosts');
149
+
150
+ expect(res.status).toBe(403);
151
+ });
152
+
120
153
  // The HTML preview loads a page's relative assets through this route, inside
121
154
  // a sandboxed frame where the browser enforces strict MIME checking: a
122
155
  // stylesheet served as `application/octet-stream` is refused and the page
@@ -4,9 +4,10 @@
4
4
  */
5
5
 
6
6
  import { json, type LoaderFunctionArgs } from '@kabmo-labs/kabmo-http';
7
+ import path from 'path';
7
8
  import { errorResponse } from '@/server/lib/route-adapter';
8
9
  import { isMockMode } from '@kabmo-labs/kabmo-runtime-flags';
9
- import { getDefaultFsRoot, resolveRoot, resolveWithinRoot } from '@kabmo-labs/kabmo-workspace/root/root';
10
+ import { getDefaultFsRoot, resolveReferencedPath, resolveRoot, resolveWithinRoot } from '@kabmo-labs/kabmo-workspace/root/root';
10
11
  import { EDITOR_MAX_BYTES_BY_EXT, unsupportedEditorMessage } from '@kabmo-labs/kabmo-fs/media/file-kind';
11
12
  import { getFileExtension, getRawContentType } from '@kabmo-labs/kabmo-fs/media/mime';
12
13
 
@@ -26,7 +27,10 @@ import { getFileExtension, getRawContentType } from '@kabmo-labs/kabmo-fs/media/
26
27
  *
27
28
  * Scope resolution is identical to `/api/fs/read` (same root allow-list, same
28
29
  * `resolveWithinRoot` containment), so a path that reads as text can be served
29
- * as bytes and vice versa.
30
+ * as bytes and vice versa. An ABSOLUTE reference is resolved through
31
+ * `resolveReferencedPath` (the drop allow-list) instead of being made relative
32
+ * to `root`: an ACP `locations[].path` is absolute, and stripping its leading
33
+ * `/` pointed the `<img>` at `<root>/Users/…` — a 404 over a file that exists.
30
34
  */
31
35
  export async function serveRawFile({ request }: LoaderFunctionArgs) {
32
36
  const url = new URL(request.url);
@@ -36,18 +40,34 @@ export async function serveRawFile({ request }: LoaderFunctionArgs) {
36
40
  return json({ error: 'Missing path' }, { status: 400 });
37
41
  }
38
42
 
39
- let baseDir = await resolveRoot(url.searchParams.get('root'), await getDefaultFsRoot(isMockMode()));
43
+ // An absolute path is a REFERENCE, not a path relative to `root`: resolve it
44
+ // against the same allow-list a dropped file uses. A relative one keeps the
45
+ // Files panel's scoped resolution (`root` + nested `repo`).
46
+ const reference = /^file:\/\//i.test(filePath)
47
+ ? filePath.replace(/^file:\/\//, '')
48
+ : path.isAbsolute(filePath)
49
+ ? filePath
50
+ : null;
40
51
 
41
- const repo = url.searchParams.get('repo');
42
- if (repo && repo !== '.') {
43
- const repoDir = resolveWithinRoot(baseDir, repo);
44
- if (repoDir) {
45
- baseDir = repoDir;
52
+ let cleanPath: string;
53
+ let fullPath: string | null;
54
+ if (reference) {
55
+ cleanPath = reference;
56
+ fullPath = await resolveReferencedPath(reference);
57
+ } else {
58
+ let baseDir = await resolveRoot(url.searchParams.get('root'), await getDefaultFsRoot(isMockMode()));
59
+
60
+ const repo = url.searchParams.get('repo');
61
+ if (repo && repo !== '.') {
62
+ const repoDir = resolveWithinRoot(baseDir, repo);
63
+ if (repoDir) {
64
+ baseDir = repoDir;
65
+ }
46
66
  }
47
- }
48
67
 
49
- const cleanPath = filePath.replace(/^\/+/, '');
50
- const fullPath = resolveWithinRoot(baseDir, cleanPath);
68
+ cleanPath = filePath.replace(/^\/+/, '');
69
+ fullPath = resolveWithinRoot(baseDir, cleanPath);
70
+ }
51
71
 
52
72
  if (!fullPath) {
53
73
  return json({ error: 'Invalid path' }, { status: 403 });
@@ -24,6 +24,10 @@ import { serveSessionImage } from '@/server/routes/sessions/local-image';
24
24
  import { exportSessionMarkdown } from '@/server/routes/sessions/export';
25
25
  import { getSessionMcp, probeSessionMcp, setSessionMcp } from '@/server/routes/sessions/mcp';
26
26
  import { getSessionChangeDiff, getSessionChanges, getSessionChangeStats } from '@/server/routes/sessions/changes';
27
+ import {
28
+ getLastOpenedSession,
29
+ markSessionOpened,
30
+ } from '@/server/routes/sessions/last-opened';
27
31
 
28
32
  export const sessionsBindings: HandlerBinding[] = [
29
33
  ...bindingsFor(sessionsList, '/api/sessions/list'),
@@ -37,6 +41,10 @@ export const sessionsBindings: HandlerBinding[] = [
37
41
  // The archive batch is static too, and must be registered before the
38
42
  // `:sessionId` routes for the same reason as batch-delete.
39
43
  { method: 'POST', path: '/api/sessions/batch-archive', handler: batchArchiveSessions },
44
+ // The static segment must be registered BEFORE the `:sessionId` folder
45
+ // loader: Elysia matches in registration order, and a parameter route winning
46
+ // would answer this path as a session named "last-opened".
47
+ { method: 'GET', path: '/api/sessions/last-opened', handler: getLastOpenedSession },
40
48
  ...bindingsFor(sessionsFolder, '/api/sessions/:sessionId'),
41
49
  // The tree around one session. Both are static suffixes under the same
42
50
  // `:sessionId` position, whose name must stay `sessionId` — Elysia requires
@@ -82,6 +90,12 @@ export const sessionsBindings: HandlerBinding[] = [
82
90
  ...actionBindings(renameSession, '/api/sessions/:sessionId/rename'),
83
91
  ...actionBindings(renameWithAi, '/api/sessions/:sessionId/rename-with-ai'),
84
92
  ...actionBindings(putSessionState, '/api/sessions/:sessionId/state', getSessionState),
93
+ // What a native shell restores on its next launch. POST-only: the write is a
94
+ // side effect of opening, and a GET on the path is the ported route shape's
95
+ // 405 rather than a 404 that hides its existence.
96
+ ...bindingsFor({ action: markSessionOpened }, '/api/sessions/:sessionId/opened', {
97
+ mutating: ['POST'],
98
+ }),
85
99
  { method: 'GET', path: '/api/sessions/:sessionId/modes', handler: getSessionModes },
86
100
  ...actionBindings(markSeen, '/api/sessions/:sessionId/stream-seen'),
87
101
  { method: 'GET', path: '/api/sessions/:sessionId/subagents', handler: listSubagents },
@@ -0,0 +1,139 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The last-opened route pair's request contract.
8
+ *
9
+ * The read is what the SSR bootstrap and any late caller trust, and the write is
10
+ * what a shell's next launch depends on — so the cases here pin the refusals
11
+ * that would otherwise be silent: a wrong verb must not be read as "nothing
12
+ * recorded", a blank or path-shaped id must not reach the store, a pending
13
+ * placeholder must answer `recorded: false`, and one client's write must not
14
+ * become another client's restore.
15
+ */
16
+
17
+ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
18
+ import { getDb } from '@/server/db.server';
19
+ import type { DbClient } from '@kabmo-labs/kabmo-db/client';
20
+ import type { ActionFunctionArgs, LoaderFunctionArgs } from '@kabmo-labs/kabmo-http';
21
+ import { isolateDb, releaseDb } from '@/test-support/isolated-db';
22
+ import { getLastOpenedSession, markSessionOpened } from '@/server/routes/sessions/last-opened';
23
+ import { readLastOpenedSessionId } from '@/server/lib/sessions/last-opened.server';
24
+ import { CLIENT_COOKIE } from '@/server/lib/sessions/last-opened-client.server';
25
+
26
+ const SESSION_ID = '43';
27
+ const CLIENT = '11111111-2222-4333-8444-555555555555';
28
+ const OTHER_CLIENT = '99999999-8888-4777-8666-555555555555';
29
+ let db: DbClient;
30
+ let priorMock: string | undefined;
31
+
32
+ beforeAll(() => {
33
+ priorMock = Bun.env.MOCK;
34
+ Bun.env.MOCK = 'true';
35
+ });
36
+
37
+ beforeEach(async () => {
38
+ await isolateDb();
39
+ db = await getDb();
40
+ await db.run("INSERT OR IGNORE INTO workspace_folders (id, name) VALUES (8, 'test')");
41
+ await db.run('INSERT INTO sessions (id, folder_id, title) VALUES (?, 8, ?)', [SESSION_ID, 'Probe']);
42
+ });
43
+
44
+ afterEach(async () => {
45
+ await releaseDb();
46
+ });
47
+
48
+ afterAll(() => {
49
+ if (priorMock === undefined) delete Bun.env.MOCK;
50
+ else Bun.env.MOCK = priorMock;
51
+ });
52
+
53
+ function request(method: string, clientId?: string): Request {
54
+ return new Request('http://localhost/api/x', {
55
+ method,
56
+ headers: clientId ? { cookie: `${CLIENT_COOKIE}=${clientId}` } : {},
57
+ });
58
+ }
59
+
60
+ function actionArgs(method: string, sessionId?: string, clientId?: string): ActionFunctionArgs {
61
+ return {
62
+ request: request(method, clientId),
63
+ params: sessionId === undefined ? {} : { sessionId },
64
+ };
65
+ }
66
+
67
+ function loaderArgs(clientId?: string): LoaderFunctionArgs {
68
+ return { request: request('GET', clientId), params: {} };
69
+ }
70
+
71
+ async function readBody(response: unknown): Promise<Record<string, unknown>> {
72
+ return (await (response as Response).json()) as Record<string, unknown>;
73
+ }
74
+
75
+ describe('getLastOpenedSession', () => {
76
+ test('answers no-store, because the value moves with every open', async () => {
77
+ const response = (await getLastOpenedSession(loaderArgs(CLIENT))) as Response;
78
+ expect(response.status).toBe(200);
79
+ expect(response.headers.get('cache-control')).toBe('no-store');
80
+ expect(await readBody(response)).toEqual({ sessionId: null });
81
+ });
82
+
83
+ test('a request with no client cookie has no pointer', async () => {
84
+ expect(await readBody(await getLastOpenedSession(loaderArgs()))).toEqual({ sessionId: null });
85
+ });
86
+ });
87
+
88
+ describe('markSessionOpened', () => {
89
+ test('records a real session, and the read answers it for that client', async () => {
90
+ const posted = await markSessionOpened(actionArgs('POST', SESSION_ID, CLIENT));
91
+ expect(await readBody(posted)).toEqual({ success: true, recorded: true });
92
+ expect(await readBody(await getLastOpenedSession(loaderArgs(CLIENT)))).toEqual({
93
+ sessionId: SESSION_ID,
94
+ });
95
+ });
96
+
97
+ test("one client's write is not another client's restore", async () => {
98
+ await markSessionOpened(actionArgs('POST', SESSION_ID, CLIENT));
99
+ expect(await readBody(await getLastOpenedSession(loaderArgs(OTHER_CLIENT)))).toEqual({
100
+ sessionId: null,
101
+ });
102
+ });
103
+
104
+ test('a request without a cookie gets one, and it is what gets recorded', async () => {
105
+ const posted = (await markSessionOpened(actionArgs('POST', SESSION_ID))) as Response;
106
+ const cookie = posted.headers.get('set-cookie');
107
+ expect(cookie).toContain(CLIENT_COOKIE);
108
+ expect(await readBody(posted)).toEqual({ success: true, recorded: true });
109
+
110
+ const clientId = cookie?.match(new RegExp(`${CLIENT_COOKIE}=([^;]+)`))?.[1] ?? '';
111
+ expect(await readBody(await getLastOpenedSession(loaderArgs(decodeURIComponent(clientId))))).toEqual({
112
+ sessionId: SESSION_ID,
113
+ });
114
+ });
115
+
116
+ test('a pending placeholder is refused without failing the request', async () => {
117
+ const posted = await markSessionOpened(actionArgs('POST', 'new-1761000000000', CLIENT));
118
+ expect((posted as Response).status).toBe(200);
119
+ expect(await readBody(posted)).toEqual({ success: true, recorded: false });
120
+ expect(await readLastOpenedSessionId(CLIENT)).toBeNull();
121
+ });
122
+
123
+ test('a wrong verb is a 405', async () => {
124
+ const response = (await markSessionOpened(actionArgs('GET', SESSION_ID, CLIENT))) as Response;
125
+ expect(response.status).toBe(405);
126
+ });
127
+
128
+ test('a missing id is a 400', async () => {
129
+ const response = (await markSessionOpened(actionArgs('POST'))) as Response;
130
+ expect(response.status).toBe(400);
131
+ });
132
+
133
+ test('a path-shaped id is a 404 before the store sees it', async () => {
134
+ for (const id of ['.', '..', 'a/b', 'a\\b']) {
135
+ const response = (await markSessionOpened(actionArgs('POST', id, CLIENT))) as Response;
136
+ expect(response.status).toBe(404);
137
+ }
138
+ });
139
+ });
@@ -0,0 +1,66 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The last-opened session: what a native shell restores on a cold start, and
8
+ * the write every open makes.
9
+ *
10
+ * The record is keyed by the `kabmo_client` cookie, so a phone and a desktop
11
+ * pointed at the same console keep separate pointers. Both routes resolve that
12
+ * identity here rather than trusting a client-supplied id: a value the page can
13
+ * choose would let one shell read or rewrite another's row.
14
+ */
15
+
16
+ import { json, NO_STORE_HEADERS } from '@kabmo-labs/kabmo-http';
17
+ import type { ActionFunctionArgs, LoaderFunctionArgs } from '@kabmo-labs/kabmo-http';
18
+ import { isSinglePathSegment } from '@kabmo-labs/kabmo-paths/path-segment';
19
+ import { methodNotAllowed } from '@/server/lib/route-adapter';
20
+ import {
21
+ lastOpenedSession,
22
+ recordLastOpenedSession,
23
+ } from '@/server/lib/sessions/last-opened.server';
24
+ import {
25
+ readClientId,
26
+ resolveClientIdentity,
27
+ } from '@/server/lib/sessions/last-opened-client.server';
28
+
29
+ /**
30
+ * GET /api/sessions/last-opened — this client's validated id, or null.
31
+ *
32
+ * Never cached: the answer moves with every session the user opens, and a
33
+ * shell's first request after a relaunch must not receive a previous response.
34
+ */
35
+ export async function getLastOpenedSession({ request }: LoaderFunctionArgs) {
36
+ const clientId = readClientId(request);
37
+ const sessionId = clientId ? await lastOpenedSession(clientId) : null;
38
+ return json({ sessionId }, { headers: NO_STORE_HEADERS });
39
+ }
40
+
41
+ /**
42
+ * POST /api/sessions/:sessionId/opened — remember this session as the target
43
+ * THIS client opens next time.
44
+ *
45
+ * A pending id is a refusal, not an error: the caller's URL may still name
46
+ * `new-…`, and the record must wait for the spawn's real id. `recorded: false`
47
+ * says which happened without turning a placeholder into a failed request.
48
+ *
49
+ * A request with no client cookie gets one, so a caller that reached this
50
+ * endpoint without the document still lands on a row of its own.
51
+ */
52
+ export async function markSessionOpened({ request, params }: ActionFunctionArgs) {
53
+ if (request.method !== 'POST') {
54
+ return methodNotAllowed({ request, params });
55
+ }
56
+
57
+ const sessionId = params.sessionId;
58
+ if (!sessionId) return json({ error: 'Missing session id' }, { status: 400 });
59
+ if (!isSinglePathSegment(sessionId)) return json({ error: 'Session not found' }, { status: 404 });
60
+
61
+ const identity = resolveClientIdentity(request);
62
+ const recorded = await recordLastOpenedSession(identity.clientId, sessionId);
63
+ const headers: Record<string, string> = {};
64
+ if (identity.setCookie) headers['set-cookie'] = identity.setCookie;
65
+ return json({ success: true, recorded }, { headers });
66
+ }
@@ -83,6 +83,7 @@ describe('tool phrase tables', () => {
83
83
  test('canonical names and legacy aliases resolve to the expected stems', () => {
84
84
  expect(TOOL_VERBS.read).toBe('Reading');
85
85
  expect(TOOL_VERBS.todo).toBe('Updating plan');
86
+ expect(TOOL_VERBS.gitlab).toBe('GitLab');
86
87
  expect(TOOL_ALIASES.read_file).toBe('read');
87
88
  expect(TOOL_ALIASES.terminal).toBe('bash');
88
89
  expect(DEVICE_VERBS.lsp).toBe('Running LSP');
@@ -153,6 +154,9 @@ describe('subjectFor', () => {
153
154
  expect(subjectFor('debug', { action: 'attach' })).toBe('attach');
154
155
  expect(subjectFor('github', { op: 'pr', repo: 'o/r' })).toBe('pr o/r');
155
156
  expect(subjectFor('github', {})).toBeUndefined();
157
+ // omp 19.3.0's `gitlab` tool shares the `{ op, repo|mr|query }` shape.
158
+ expect(subjectFor('gitlab', { op: 'mr_create', repo: 'g/p' })).toBe('mr_create g/p');
159
+ expect(subjectFor('gitlab', {})).toBeUndefined();
156
160
  });
157
161
 
158
162
  test('ask reads the first question header, then its question text', () => {
@@ -43,6 +43,7 @@ export const TOOL_VERBS: Record<string, string> = {
43
43
  lsp: 'Running LSP',
44
44
  debug: 'Debugging',
45
45
  github: 'GitHub',
46
+ gitlab: 'GitLab',
46
47
  web_search: 'Searching the web',
47
48
  ask: 'Asking you',
48
49
  checkpoint: 'Checkpointing',
@@ -212,6 +213,7 @@ export function subjectFor(name: string, args: Record<string, unknown>): string
212
213
  case 'debug':
213
214
  return pick(args, ['action', 'program']);
214
215
  case 'github':
216
+ case 'gitlab':
215
217
  return [pick(args, ['op']), pick(args, ['repo', 'pr', 'query'])].filter(Boolean).join(' ') || undefined;
216
218
  case 'ask':
217
219
  return askSubject(args);
@@ -17,20 +17,21 @@ import { PROVIDER_GLYPHS } from '@/client/components/common/provider-icon/glyphs
17
17
  import { providerInitials, resolveProviderGlyph } from '@/shared/lib/models/provider/glyph';
18
18
 
19
19
  /**
20
- * Every provider id omp 18.3.0 ships (`KnownProvider`) plus Kabmo's own
21
- * additions. A provider added upstream appears here as one more id, and the
22
- * coverage test below is what makes its missing mark a loud failure instead of a
23
- * blank badge in the picker.
20
+ * Every provider id omp ships (`KnownProvider`), plus Kabmo's own additions and
21
+ * the slugs omp retired but stored sessions still name. A provider added
22
+ * upstream appears here as one more id, and the coverage test below is what
23
+ * makes its missing mark a loud failure instead of a blank badge in the picker.
24
24
  */
25
25
  const PROVIDER_IDS = [
26
26
  'abliteration', 'aiand', 'aimlapi', 'alibaba-coding-plan', 'alibaba-token-plan', 'amazon-bedrock',
27
- 'anthropic', 'apple', 'azure', 'baseten', 'bedrock-mantle', 'cerebras', 'charm-hyper', 'cline-pass',
28
- 'cloudflare-ai-gateway', 'commandcode', 'coreweave', 'cursor', 'deepinfra', 'deepseek', 'devin',
29
- 'firepass', 'fireworks', 'github-copilot', 'gitlab-duo', 'gitlab-duo-agent', 'gmi-cloud', 'google',
30
- 'google-antigravity', 'google-gemini-cli', 'google-vertex', 'groq', 'huggingface', 'kilo', 'kimi-code',
31
- 'litellm', 'llama.cpp', 'lm-studio', 'local', 'meta', 'minimax', 'minimax-code', 'minimax-code-cn',
32
- 'mistral', 'moonshot', 'muse-code', 'nanogpt', 'novita', 'nvidia', 'ollama', 'ollama-cloud', 'openai',
33
- 'openai-codex', 'opencode-go', 'opencode-zen', 'openrouter', 'qianfan', 'qwen-portal', 'sakana',
27
+ 'anthropic', 'apple', 'arkanecloud', 'azure', 'baseten', 'bedrock-mantle', 'cerebras', 'charm-hyper',
28
+ 'cline-pass', 'cloudflare-ai-gateway', 'commandcode', 'coreweave', 'cursor', 'deepinfra', 'deepseek',
29
+ 'devin', 'firepass', 'fireworks', 'github-copilot', 'gitlab-duo', 'gitlab-duo-agent', 'gmi-cloud',
30
+ 'google', 'google-antigravity', 'google-gemini-cli', 'google-vertex', 'groq', 'huggingface', 'kilo',
31
+ 'kimi-code', 'kimi-code-global', 'litellm', 'llama.cpp', 'lm-studio', 'local', 'meta', 'minimax',
32
+ 'minimax-code', 'minimax-code-cn', 'mistral', 'moonshot', 'muse-code', 'nanogpt', 'novita', 'nvidia',
33
+ 'ollama', 'ollama-cloud', 'openai', 'openai-codex', 'opencode-go', 'opencode-zen', 'openrouter',
34
+ 'qianfan', 'qwen-portal', 'refuseless', 'sakana',
34
35
  'siliconflow', 'siliconflow-cn', 'singularityapi-dev', 'singularityapi-tech', 'stepfun', 'synthetic',
35
36
  'together', 'typesafe', 'umans', 'venice', 'vercel-ai-gateway', 'vllm', 'wafer-serverless', 'web',
36
37
  'xai', 'xai-oauth', 'xiaomi', 'xiaomi-token-plan-ams', 'xiaomi-token-plan-cn', 'xiaomi-token-plan-sgp',
@@ -75,6 +76,7 @@ describe('resolveProviderGlyph', () => {
75
76
  expect(resolveProviderGlyph('openai-codex')).toBe(resolveProviderGlyph('codex'));
76
77
  expect(resolveProviderGlyph('opencode-zen')).toBe(resolveProviderGlyph('opencode-go'));
77
78
  expect(resolveProviderGlyph('gitlab-duo-agent')).toBe(resolveProviderGlyph('gitlab-duo'));
79
+ expect(resolveProviderGlyph('kimi-code-global')).toBe(resolveProviderGlyph('kimi'));
78
80
  });
79
81
 
80
82
  test('spelling differences fold to the same key', () => {
@@ -91,6 +91,7 @@ export const PROVIDER_GLYPH_ALIASES: Readonly<Record<string, string>> = {
91
91
  kilocode: 'kilocode',
92
92
  kimi: 'kimi',
93
93
  kimicode: 'kimi',
94
+ kimicodeglobal: 'kimi',
94
95
  litellm: 'litellm',
95
96
  llama: 'meta',
96
97
  llamacpp: 'llamacpp',