@kortix/sdk 0.14.1 → 0.14.2

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 (162) hide show
  1. package/README.md +6 -3
  2. package/dist/core/attachments/prompt-attachments.d.ts.map +1 -1
  3. package/dist/core/attachments/prompt-attachments.js +104 -86
  4. package/dist/core/attachments/prompt-attachments.js.map +1 -1
  5. package/dist/core/client/kortix.d.ts +12 -1
  6. package/dist/core/client/kortix.d.ts.map +1 -1
  7. package/dist/core/client/project-operations-admin.d.ts +15 -1
  8. package/dist/core/client/project-operations-admin.d.ts.map +1 -1
  9. package/dist/core/client/project-operations-admin.js +7 -1
  10. package/dist/core/client/project-operations-admin.js.map +1 -1
  11. package/dist/core/client/project-operations.d.ts +12 -1
  12. package/dist/core/client/project-operations.d.ts.map +1 -1
  13. package/dist/core/files/client.d.ts.map +1 -1
  14. package/dist/core/files/client.js +26 -33
  15. package/dist/core/files/client.js.map +1 -1
  16. package/dist/core/http/transport.d.ts +7 -1
  17. package/dist/core/http/transport.d.ts.map +1 -1
  18. package/dist/core/http/transport.js +8 -11
  19. package/dist/core/http/transport.js.map +1 -1
  20. package/dist/core/rest/platform-client/capture.d.ts +5 -0
  21. package/dist/core/rest/platform-client/capture.d.ts.map +1 -1
  22. package/dist/core/rest/platform-client/capture.js.map +1 -1
  23. package/dist/core/rest/platform-client/host-boundary.d.ts +2 -0
  24. package/dist/core/rest/platform-client/host-boundary.d.ts.map +1 -1
  25. package/dist/core/rest/platform-client/host-boundary.js.map +1 -1
  26. package/dist/core/rest/projects-client/access.d.ts +31 -0
  27. package/dist/core/rest/projects-client/access.d.ts.map +1 -1
  28. package/dist/core/rest/projects-client/access.js.map +1 -1
  29. package/dist/core/rest/projects-client/git-backend.d.ts +4 -0
  30. package/dist/core/rest/projects-client/git-backend.d.ts.map +1 -1
  31. package/dist/core/rest/projects-client/git-backend.js.map +1 -1
  32. package/dist/core/rest/projects-client/projects.d.ts +39 -0
  33. package/dist/core/rest/projects-client/projects.d.ts.map +1 -1
  34. package/dist/core/rest/projects-client/projects.js +44 -2
  35. package/dist/core/rest/projects-client/projects.js.map +1 -1
  36. package/dist/core/rest/projects-client/sessions.d.ts +16 -5
  37. package/dist/core/rest/projects-client/sessions.d.ts.map +1 -1
  38. package/dist/core/rest/projects-client/sessions.js +5 -1
  39. package/dist/core/rest/projects-client/sessions.js.map +1 -1
  40. package/dist/core/rest/projects-client/tokens.d.ts +8 -2
  41. package/dist/core/rest/projects-client/tokens.d.ts.map +1 -1
  42. package/dist/core/rest/projects-client/tokens.js +12 -4
  43. package/dist/core/rest/projects-client/tokens.js.map +1 -1
  44. package/dist/core/rest/projects-client/triggers.d.ts +112 -3
  45. package/dist/core/rest/projects-client/triggers.d.ts.map +1 -1
  46. package/dist/core/rest/projects-client/triggers.js +35 -2
  47. package/dist/core/rest/projects-client/triggers.js.map +1 -1
  48. package/dist/core/session-log/turns/turn.d.ts +17 -0
  49. package/dist/core/session-log/turns/turn.d.ts.map +1 -1
  50. package/dist/core/session-log/turns/turn.js +35 -2
  51. package/dist/core/session-log/turns/turn.js.map +1 -1
  52. package/dist/core/session-sync/saved-copy-index.d.ts +50 -0
  53. package/dist/core/session-sync/saved-copy-index.d.ts.map +1 -0
  54. package/dist/core/session-sync/saved-copy-index.js +103 -0
  55. package/dist/core/session-sync/saved-copy-index.js.map +1 -0
  56. package/dist/core/session-sync/saved-copy-store.d.ts.map +1 -1
  57. package/dist/core/session-sync/saved-copy-store.js +3 -84
  58. package/dist/core/session-sync/saved-copy-store.js.map +1 -1
  59. package/dist/core/session-sync/session-sync-controller.d.ts +4 -5
  60. package/dist/core/session-sync/session-sync-controller.d.ts.map +1 -1
  61. package/dist/core/session-sync/session-sync-controller.js +5 -5
  62. package/dist/core/session-sync/session-sync-controller.js.map +1 -1
  63. package/dist/core/stream/event-attempt.d.ts +76 -0
  64. package/dist/core/stream/event-attempt.d.ts.map +1 -0
  65. package/dist/core/stream/event-attempt.js +451 -0
  66. package/dist/core/stream/event-attempt.js.map +1 -0
  67. package/dist/core/stream/event-stream.d.ts +8 -0
  68. package/dist/core/stream/event-stream.d.ts.map +1 -1
  69. package/dist/core/stream/event-stream.js +38 -404
  70. package/dist/core/stream/event-stream.js.map +1 -1
  71. package/dist/core/turns/display-order.d.ts +125 -0
  72. package/dist/core/turns/display-order.d.ts.map +1 -0
  73. package/dist/core/turns/display-order.js +134 -0
  74. package/dist/core/turns/display-order.js.map +1 -0
  75. package/dist/core/turns/grouping.d.ts +0 -49
  76. package/dist/core/turns/grouping.d.ts.map +1 -1
  77. package/dist/core/turns/grouping.js +4 -126
  78. package/dist/core/turns/grouping.js.map +1 -1
  79. package/dist/core/turns/index.d.ts +1 -0
  80. package/dist/core/turns/index.d.ts.map +1 -1
  81. package/dist/core/turns/index.js +1 -0
  82. package/dist/core/turns/index.js.map +1 -1
  83. package/dist/core/turns/parts.d.ts +9 -1
  84. package/dist/core/turns/parts.d.ts.map +1 -1
  85. package/dist/core/turns/parts.js +140 -176
  86. package/dist/core/turns/parts.js.map +1 -1
  87. package/dist/core/turns/state.d.ts +0 -7
  88. package/dist/core/turns/state.d.ts.map +1 -1
  89. package/dist/core/turns/state.js +45 -31
  90. package/dist/core/turns/state.js.map +1 -1
  91. package/dist/core/turns/text-scan.d.ts +0 -2
  92. package/dist/core/turns/text-scan.d.ts.map +1 -1
  93. package/dist/core/turns/text-scan.js +0 -4
  94. package/dist/core/turns/text-scan.js.map +1 -1
  95. package/dist/core/turns/tools/tool-meta.d.ts.map +1 -1
  96. package/dist/core/turns/tools/tool-meta.js +4 -4
  97. package/dist/core/turns/tools/tool-meta.js.map +1 -1
  98. package/dist/core/turns/tools/tool-outcome.d.ts.map +1 -1
  99. package/dist/core/turns/tools/tool-outcome.js +7 -29
  100. package/dist/core/turns/tools/tool-outcome.js.map +1 -1
  101. package/dist/core/turns/tools/web-helpers.d.ts +3 -3
  102. package/dist/core/turns/tools/web-helpers.d.ts.map +1 -1
  103. package/dist/core/turns/tools/web-helpers.js +59 -42
  104. package/dist/core/turns/tools/web-helpers.js.map +1 -1
  105. package/dist/core/turns/view-model.d.ts.map +1 -1
  106. package/dist/core/turns/view-model.js +2 -10
  107. package/dist/core/turns/view-model.js.map +1 -1
  108. package/dist/kortix.esm.min.js +36 -36
  109. package/dist/kortix.global.js +36 -36
  110. package/dist/react/connector-setup.d.ts +2 -1
  111. package/dist/react/connector-setup.d.ts.map +1 -1
  112. package/dist/react/human-presence.d.ts +2 -1
  113. package/dist/react/human-presence.d.ts.map +1 -1
  114. package/dist/react/index.d.ts +1 -1
  115. package/dist/react/index.d.ts.map +1 -1
  116. package/dist/react/index.js +1 -1
  117. package/dist/react/index.js.map +1 -1
  118. package/dist/react/query-contracts.d.ts +13 -0
  119. package/dist/react/query-contracts.d.ts.map +1 -1
  120. package/dist/react/query-contracts.js +36 -0
  121. package/dist/react/query-contracts.js.map +1 -1
  122. package/dist/react/query-keys.d.ts +12 -0
  123. package/dist/react/query-keys.d.ts.map +1 -1
  124. package/dist/react/query-keys.js +12 -0
  125. package/dist/react/query-keys.js.map +1 -1
  126. package/dist/react/session-stop.d.ts +2 -1
  127. package/dist/react/session-stop.d.ts.map +1 -1
  128. package/dist/react/session-title-sync.d.ts +0 -7
  129. package/dist/react/session-title-sync.d.ts.map +1 -1
  130. package/dist/react/session-title-sync.js +1 -1
  131. package/dist/react/session-title-sync.js.map +1 -1
  132. package/dist/react/sign-in-with-kortix.d.ts +1 -1
  133. package/dist/react/teams-install-polling.d.ts +0 -2
  134. package/dist/react/teams-install-polling.d.ts.map +1 -1
  135. package/dist/react/teams-install-polling.js +1 -1
  136. package/dist/react/teams-install-polling.js.map +1 -1
  137. package/dist/react/use-accounts.d.ts +2 -0
  138. package/dist/react/use-accounts.d.ts.map +1 -1
  139. package/dist/react/use-admin-accounts.d.ts +1 -3
  140. package/dist/react/use-admin-accounts.d.ts.map +1 -1
  141. package/dist/react/use-admin-accounts.js +3 -6
  142. package/dist/react/use-admin-accounts.js.map +1 -1
  143. package/dist/react/use-impersonation.d.ts +8 -1
  144. package/dist/react/use-impersonation.d.ts.map +1 -1
  145. package/dist/react/use-impersonation.js +17 -4
  146. package/dist/react/use-impersonation.js.map +1 -1
  147. package/dist/react/use-notifications.d.ts +1 -0
  148. package/dist/react/use-notifications.d.ts.map +1 -1
  149. package/dist/react/use-project-name.d.ts.map +1 -1
  150. package/dist/react/use-project-name.js +12 -18
  151. package/dist/react/use-project-name.js.map +1 -1
  152. package/dist/react/use-project-triggers.d.ts +98 -7
  153. package/dist/react/use-project-triggers.d.ts.map +1 -1
  154. package/dist/react/use-project-triggers.js +53 -7
  155. package/dist/react/use-project-triggers.js.map +1 -1
  156. package/dist/react/use-session-sync.d.ts +1 -1
  157. package/dist/react/use-session.d.ts +1 -1
  158. package/package.json +2 -2
  159. package/dist/core/stream/keepalive.d.ts +0 -17
  160. package/dist/core/stream/keepalive.d.ts.map +0 -1
  161. package/dist/core/stream/keepalive.js +0 -19
  162. package/dist/core/stream/keepalive.js.map +0 -1
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Display order and session-list comparators — framework-agnostic.
3
+ *
4
+ * Owns the TOTAL order the transcript sorts by (`compareMessagesForDisplay`)
5
+ * and the session-list helpers (sidebar / tabs). Split out of `grouping.ts`,
6
+ * which keeps turn grouping; `display-order.test.ts` pins the order.
7
+ */
8
+ /**
9
+ * Display order, as a TOTAL order over two disjoint segments.
10
+ *
11
+ * 1. PLACED — the message has a wire id, so the server has given it a
12
+ * position. Ordered by that id.
13
+ * 2. LOCAL — an optimistic stub, or a queued inbox row the transcript has
14
+ * not echoed yet. Ordered by the instant the user sent it, untimed last.
15
+ *
16
+ * Every placed message precedes every local one, because a local placeholder
17
+ * exists precisely because the server has not placed it yet; the moment it is
18
+ * echoed it gains a wire id and moves into segment 1.
19
+ *
20
+ * The wire id is the message's POSITION: OpenCode's own loop resolves "is this
21
+ * answered?" by id order, and every id that reaches the transcript is placed by
22
+ * the control plane (the proxy's wire-id repair lifts a stale client id; the
23
+ * drain re-mints a queued prompt above the live turn). So for wire ids, id
24
+ * order IS conversation order.
25
+ *
26
+ * `time.created` is NOT, which is why it only ever orders segment 2. OpenCode
27
+ * stamps it at PERSISTENCE, from arrival wall-clock. A batch of queued prompts
28
+ * is posted concurrently on purpose (so one step answers them all), and their
29
+ * arrival order is the network's — sorting placed messages by it displayed
30
+ * "B4, FIRST, B2, B3" for a burst the model itself read, and answered, in id
31
+ * order.
32
+ *
33
+ * WHY THE SEGMENTS. This function used to switch ordering per PAIR: wire-id
34
+ * order when both ids were well-formed wire ids, `time.created` for every pair
35
+ * involving anything else. That is not an order at all. Two placed messages A,
36
+ * B and one queued row S whose host-fabricated stamp sat below the box clock
37
+ * compared as A < B (by id), S < A (by time) and B < S (by time) — a cycle.
38
+ * `Array.prototype.sort` may emit any permutation of a cyclic comparator, and
39
+ * V8 switches algorithm with input length, so three prompts sent "who", "are",
40
+ * "you" rendered "who", "you", "are". `groupMessagesIntoTurns` walks the same
41
+ * sorted list to attach assistant messages that carry no `parentID`, so the
42
+ * replies re-parented too, and a queued row could sort ABOVE the whole
43
+ * transcript. Segmenting removes the mixed comparison, and with it the need
44
+ * for any host to fabricate a timestamp to keep a queued row in place.
45
+ *
46
+ * A message with no timestamp AND no wire id (a host's plain stub) sorts last —
47
+ * it is the latest thing the user did — and two such are a TIE, so the stable
48
+ * sort keeps the order the host handed them over in. Equal timestamps keep id
49
+ * order.
50
+ *
51
+ * AN ID IS A POSITION ONLY WHILE IT AGREES WITH ITS OWN CLOCK. The id encodes
52
+ * the low 48 bits of `Date.now() * 0x1000`, so a placed message is ordered by
53
+ * that clock UNWRAPPED against its own `time.created` — which is what keeps a
54
+ * session spanning the 2026-08-14 wrap in order. Every correct mint sits within
55
+ * minutes of its timestamp. An id more than {@link WIRE_ID_CLOCK_TOLERANCE}
56
+ * (1 hour) away from it was not placed by any transcript — `kortix sessions
57
+ * send` minted the HIGH bits, ~40 days ahead, until 2026-09 — and falls back to
58
+ * the server's own order: `time.created`, then id (`MessageV2.page()`). Without
59
+ * this, every turn sent after such a prompt rendered ABOVE it. A placed message
60
+ * with no timestamp (an optimistic stub keyed by a wire id) is unwrapped
61
+ * against the newest timestamp in the list being sorted — the stub is the
62
+ * newest thing the user did — or, compared pairwise, against the current clock.
63
+ */
64
+ type DisplayOrdered = {
65
+ info: {
66
+ id: string;
67
+ time?: {
68
+ created?: number;
69
+ };
70
+ };
71
+ };
72
+ export declare function compareMessagesForDisplay(a: {
73
+ info: {
74
+ id: string;
75
+ time?: {
76
+ created?: number;
77
+ };
78
+ };
79
+ }, b: {
80
+ info: {
81
+ id: string;
82
+ time?: {
83
+ created?: number;
84
+ };
85
+ };
86
+ }): number;
87
+ /** The anchor untimed placed ids unwrap against: the list's newest timestamp. */
88
+ export declare function untimedAnchorOf(messages: readonly DisplayOrdered[]): bigint;
89
+ export declare function compareForDisplayAt(a: DisplayOrdered, b: DisplayOrdered, untimedAnchor: bigint): number;
90
+ /**
91
+ * Build a map from parent session ID → array of child session IDs.
92
+ * Used to aggregate child session status (permissions, busy) in the sidebar.
93
+ * Matches SolidJS reference `childMapByParent()` in helpers.ts.
94
+ */
95
+ export declare function childMapByParent(sessions: ReadonlyArray<{
96
+ id: string;
97
+ parentID?: string;
98
+ }>): Map<string, string[]>;
99
+ /**
100
+ * Sort comparator for sessions.
101
+ * Two tiers:
102
+ * 1. Sessions updated within `now - 60s` are pinned to top, sorted by ID (stable).
103
+ * 2. Older sessions sorted by `updated` time descending.
104
+ * Matches SolidJS reference `sortSessions()` in helpers.ts.
105
+ */
106
+ export declare function sortSessions(now: number): (a: {
107
+ id: string;
108
+ time: {
109
+ updated?: number;
110
+ created: number;
111
+ };
112
+ }, b: {
113
+ id: string;
114
+ time: {
115
+ updated?: number;
116
+ created: number;
117
+ };
118
+ }) => number;
119
+ /**
120
+ * Recursively collect ALL descendant session IDs for a given parent.
121
+ * Walks the full tree so deeply nested sub-agents are included.
122
+ */
123
+ export declare function allDescendantIds(childMap: Map<string, string[]>, sessionId: string): string[];
124
+ export {};
125
+ //# sourceMappingURL=display-order.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display-order.d.ts","sourceRoot":"","sources":["../../../src/core/turns/display-order.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,KAAK,cAAc,GAAG;IAAE,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE;YAAE,OAAO,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,CAAC;AAsB5E,wBAAgB,yBAAyB,CACvC,CAAC,EAAE;IAAE,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE;YAAE,OAAO,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,EACxD,CAAC,EAAE;IAAE,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE;YAAE,OAAO,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,GACvD,MAAM,CAER;AAED,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,GAAG,MAAM,CAO3E;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CA2BvG;AAMD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,aAAa,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GACzD,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAYvB;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,IAGpC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,EAC9D,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,YAWjE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAS7F"}
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Display order and session-list comparators — framework-agnostic.
3
+ *
4
+ * Owns the TOTAL order the transcript sorts by (`compareMessagesForDisplay`)
5
+ * and the session-list helpers (sidebar / tabs). Split out of `grouping.ts`,
6
+ * which keeps turn grouping; `display-order.test.ts` pins the order.
7
+ */
8
+ import { WIRE_ID_CLOCK_TOLERANCE, wireIdClock } from '../session/wire-message-id.js';
9
+ import { absoluteWireIdClockAt, unwrapWireIdClock } from '../session/wire-id-unwrap.js';
10
+ /** The absolute id clock a placed message is ordered by. */
11
+ function placedDisplayClock(message, untimedAnchor) {
12
+ const clock = wireIdClock(message.info.id) ?? BigInt(0);
13
+ const created = message.info.time?.created;
14
+ if (typeof created !== 'number')
15
+ return unwrapWireIdClock(clock, untimedAnchor);
16
+ const own = absoluteWireIdClockAt(created);
17
+ const unwrapped = unwrapWireIdClock(clock, own);
18
+ const drift = unwrapped > own ? unwrapped - own : own - unwrapped;
19
+ return drift <= WIRE_ID_CLOCK_TOLERANCE ? unwrapped : own;
20
+ }
21
+ /** `0` for a message the server has placed, `1` for one only this tab knows. */
22
+ function displaySegment(id) {
23
+ return wireIdClock(id) === null ? 1 : 0;
24
+ }
25
+ function compareIds(a, b) {
26
+ return a < b ? -1 : a > b ? 1 : 0;
27
+ }
28
+ export function compareMessagesForDisplay(a, b) {
29
+ return compareForDisplayAt(a, b, absoluteWireIdClockAt(Date.now()));
30
+ }
31
+ /** The anchor untimed placed ids unwrap against: the list's newest timestamp. */
32
+ export function untimedAnchorOf(messages) {
33
+ let newest = null;
34
+ for (const message of messages) {
35
+ const created = message.info.time?.created;
36
+ if (typeof created === 'number' && (newest === null || created > newest))
37
+ newest = created;
38
+ }
39
+ return absoluteWireIdClockAt(newest ?? Date.now());
40
+ }
41
+ export function compareForDisplayAt(a, b, untimedAnchor) {
42
+ const segmentA = displaySegment(a.info.id);
43
+ const segmentB = displaySegment(b.info.id);
44
+ if (segmentA !== segmentB)
45
+ return segmentA - segmentB;
46
+ // Placed: the wire id is the position, and it is the only clock that agrees
47
+ // with the loop that produced the messages.
48
+ if (segmentA === 0) {
49
+ const clockA = placedDisplayClock(a, untimedAnchor);
50
+ const clockB = placedDisplayClock(b, untimedAnchor);
51
+ if (clockA !== clockB)
52
+ return clockA < clockB ? -1 : 1;
53
+ return compareIds(a.info.id, b.info.id);
54
+ }
55
+ // Local: the send instant is the only record of what the user did, and it is
56
+ // this tab's own clock for both sides, so it is comparable. Untimed last.
57
+ const at = typeof a.info.time?.created === 'number' ? a.info.time.created : null;
58
+ const bt = typeof b.info.time?.created === 'number' ? b.info.time.created : null;
59
+ // Two untimed stubs are a TIE, so the stable sort keeps the order the host
60
+ // handed them over in. That is the only signal left about which came first,
61
+ // and an id tiebreak here would reorder `groupMessagesIntoTurns`' own
62
+ // sequential fallback (`u1`, `a1`, `a2` regrouped as `a1`, `a2`, `u1`).
63
+ if (at === null && bt === null)
64
+ return 0;
65
+ if (at === null)
66
+ return 1;
67
+ if (bt === null)
68
+ return -1;
69
+ if (at !== bt)
70
+ return at < bt ? -1 : 1;
71
+ return compareIds(a.info.id, b.info.id);
72
+ }
73
+ // ============================================================================
74
+ // Session list helpers (sidebar / tabs)
75
+ // ============================================================================
76
+ /**
77
+ * Build a map from parent session ID → array of child session IDs.
78
+ * Used to aggregate child session status (permissions, busy) in the sidebar.
79
+ * Matches SolidJS reference `childMapByParent()` in helpers.ts.
80
+ */
81
+ export function childMapByParent(sessions) {
82
+ const map = new Map();
83
+ for (const session of sessions) {
84
+ if (!session.parentID)
85
+ continue;
86
+ const existing = map.get(session.parentID);
87
+ if (existing) {
88
+ existing.push(session.id);
89
+ }
90
+ else {
91
+ map.set(session.parentID, [session.id]);
92
+ }
93
+ }
94
+ return map;
95
+ }
96
+ /**
97
+ * Sort comparator for sessions.
98
+ * Two tiers:
99
+ * 1. Sessions updated within `now - 60s` are pinned to top, sorted by ID (stable).
100
+ * 2. Older sessions sorted by `updated` time descending.
101
+ * Matches SolidJS reference `sortSessions()` in helpers.ts.
102
+ */
103
+ export function sortSessions(now) {
104
+ const oneMinuteAgo = now - 60 * 1000;
105
+ return (a, b) => {
106
+ const aUpdated = a.time.updated ?? a.time.created;
107
+ const bUpdated = b.time.updated ?? b.time.created;
108
+ const aRecent = aUpdated > oneMinuteAgo;
109
+ const bRecent = bUpdated > oneMinuteAgo;
110
+ if (aRecent && bRecent)
111
+ return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
112
+ if (aRecent && !bRecent)
113
+ return -1;
114
+ if (!aRecent && bRecent)
115
+ return 1;
116
+ return bUpdated - aUpdated;
117
+ };
118
+ }
119
+ /**
120
+ * Recursively collect ALL descendant session IDs for a given parent.
121
+ * Walks the full tree so deeply nested sub-agents are included.
122
+ */
123
+ export function allDescendantIds(childMap, sessionId) {
124
+ const directChildren = childMap.get(sessionId);
125
+ if (!directChildren || directChildren.length === 0)
126
+ return [];
127
+ const result = [];
128
+ for (const childId of directChildren) {
129
+ result.push(childId);
130
+ result.push(...allDescendantIds(childMap, childId));
131
+ }
132
+ return result;
133
+ }
134
+ //# sourceMappingURL=display-order.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display-order.js","sourceRoot":"","sources":["../../../src/core/tur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,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAA+B,EAAE,SAAiB;IACjF,MAAM,cAAc,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC/C,IAAI,CAAC,cAAc,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAC9D,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,MAAM,OAAO,IAAI,cAAc,EAAE,CAAC;QACrC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -8,21 +8,6 @@
8
8
  * single-file version. No React / DOM / framework imports allowed.
9
9
  */
10
10
  import type { MessageWithPartsLike, PartLike, PartWithMessage, TurnLike } from './types.js';
11
- export declare function compareMessagesForDisplay(a: {
12
- info: {
13
- id: string;
14
- time?: {
15
- created?: number;
16
- };
17
- };
18
- }, b: {
19
- info: {
20
- id: string;
21
- time?: {
22
- created?: number;
23
- };
24
- };
25
- }): number;
26
11
  /**
27
12
  * Group messages into turns: each turn starts with a user message followed
28
13
  * by 0+ assistant messages.
@@ -53,38 +38,4 @@ export declare function turnHasSteps(parts: ReadonlyArray<{
53
38
  * so answered questions are shown regardless of stepsExpanded state.
54
39
  */
55
40
  export declare function getAnsweredQuestionParts<M extends MessageWithPartsLike>(turn: TurnLike<M>, _stepsExpanded: boolean, hasActiveQuestion: boolean): PartWithMessage<M>[];
56
- /**
57
- * Build a map from parent session ID → array of child session IDs.
58
- * Used to aggregate child session status (permissions, busy) in the sidebar.
59
- * Matches SolidJS reference `childMapByParent()` in helpers.ts.
60
- */
61
- export declare function childMapByParent(sessions: ReadonlyArray<{
62
- id: string;
63
- parentID?: string;
64
- }>): Map<string, string[]>;
65
- /**
66
- * Sort comparator for sessions.
67
- * Two tiers:
68
- * 1. Sessions updated within `now - 60s` are pinned to top, sorted by ID (stable).
69
- * 2. Older sessions sorted by `updated` time descending.
70
- * Matches SolidJS reference `sortSessions()` in helpers.ts.
71
- */
72
- export declare function sortSessions(now: number): (a: {
73
- id: string;
74
- time: {
75
- updated?: number;
76
- created: number;
77
- };
78
- }, b: {
79
- id: string;
80
- time: {
81
- updated?: number;
82
- created: number;
83
- };
84
- }) => number;
85
- /**
86
- * Recursively collect ALL descendant session IDs for a given parent.
87
- * Walks the full tree so deeply nested sub-agents are included.
88
- */
89
- export declare function allDescendantIds(childMap: Map<string, string[]>, sessionId: string): string[];
90
41
  //# sourceMappingURL=grouping.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"grouping.d.ts","sourceRoot":"","sources":["../../../src/core/turns/grouping.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAmB,oBAAoB,EAAE,QAAQ,EAAE,eAAe,EAAgB,QAAQ,EAAE,MAAM,SAAS,CAAC;AAiGxH,wBAAgB,yBAAyB,CACvC,CAAC,EAAE;IAAE,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE;YAAE,OAAO,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,EACxD,CAAC,EAAE;IAAE,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE;YAAE,OAAO,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,GACvD,MAAM,CAER;AAyCD;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,oBAAoB,EACnE,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,OAAO,CAAC,EAAE;IAAE,iBAAiB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAAE,GACpD,QAAQ,CAAC,CAAC,CAAC,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AAC,EACjB,cAAc,EAAE,OAAO,EACvB,iBAAiB,EAAE,OAAO,GACzB,eAAe,CAAC,CAAC,CAAC,EAAE,CAgBtB"}
@@ -8,71 +8,10 @@
8
8
  * single-file version. No React / DOM / framework imports allowed.
9
9
  */
10
10
  import { isTextPart, isToolPart } from './parts.js';
11
- import { WIRE_ID_CLOCK_TOLERANCE, wireIdClock } from '../session/wire-message-id.js';
12
- import { absoluteWireIdClockAt, unwrapWireIdClock } from '../session/wire-id-unwrap.js';
13
- /** The absolute id clock a placed message is ordered by. */
14
- function placedDisplayClock(message, untimedAnchor) {
15
- const clock = wireIdClock(message.info.id) ?? BigInt(0);
16
- const created = message.info.time?.created;
17
- if (typeof created !== 'number')
18
- return unwrapWireIdClock(clock, untimedAnchor);
19
- const own = absoluteWireIdClockAt(created);
20
- const unwrapped = unwrapWireIdClock(clock, own);
21
- const drift = unwrapped > own ? unwrapped - own : own - unwrapped;
22
- return drift <= WIRE_ID_CLOCK_TOLERANCE ? unwrapped : own;
23
- }
24
- /** `0` for a message the server has placed, `1` for one only this tab knows. */
25
- function displaySegment(id) {
26
- return wireIdClock(id) === null ? 1 : 0;
27
- }
28
- function compareIds(a, b) {
29
- return a < b ? -1 : a > b ? 1 : 0;
30
- }
31
- export function compareMessagesForDisplay(a, b) {
32
- return compareForDisplayAt(a, b, absoluteWireIdClockAt(Date.now()));
33
- }
34
- /** The anchor untimed placed ids unwrap against: the list's newest timestamp. */
35
- function untimedAnchorOf(messages) {
36
- let newest = null;
37
- for (const message of messages) {
38
- const created = message.info.time?.created;
39
- if (typeof created === 'number' && (newest === null || created > newest))
40
- newest = created;
41
- }
42
- return absoluteWireIdClockAt(newest ?? Date.now());
43
- }
44
- function compareForDisplayAt(a, b, untimedAnchor) {
45
- const segmentA = displaySegment(a.info.id);
46
- const segmentB = displaySegment(b.info.id);
47
- if (segmentA !== segmentB)
48
- return segmentA - segmentB;
49
- // Placed: the wire id is the position, and it is the only clock that agrees
50
- // with the loop that produced the messages.
51
- if (segmentA === 0) {
52
- const clockA = placedDisplayClock(a, untimedAnchor);
53
- const clockB = placedDisplayClock(b, untimedAnchor);
54
- if (clockA !== clockB)
55
- return clockA < clockB ? -1 : 1;
56
- return compareIds(a.info.id, b.info.id);
57
- }
58
- // Local: the send instant is the only record of what the user did, and it is
59
- // this tab's own clock for both sides, so it is comparable. Untimed last.
60
- const at = typeof a.info.time?.created === 'number' ? a.info.time.created : null;
61
- const bt = typeof b.info.time?.created === 'number' ? b.info.time.created : null;
62
- // Two untimed stubs are a TIE, so the stable sort keeps the order the host
63
- // handed them over in. That is the only signal left about which came first,
64
- // and an id tiebreak here would reorder `groupMessagesIntoTurns`' own
65
- // sequential fallback (`u1`, `a1`, `a2` regrouped as `a1`, `a2`, `u1`).
66
- if (at === null && bt === null)
67
- return 0;
68
- if (at === null)
69
- return 1;
70
- if (bt === null)
71
- return -1;
72
- if (at !== bt)
73
- return at < bt ? -1 : 1;
74
- return compareIds(a.info.id, b.info.id);
75
- }
11
+ import { compareForDisplayAt, untimedAnchorOf } from './display-order.js';
12
+ // ============================================================================
13
+ // Turn grouping
14
+ // ============================================================================
76
15
  /**
77
16
  * Group messages into turns: each turn starts with a user message followed
78
17
  * by 0+ assistant messages.
@@ -284,65 +223,4 @@ export function getAnsweredQuestionParts(turn, _stepsExpanded, hasActiveQuestion
284
223
  }
285
224
  return result;
286
225
  }
287
- // ============================================================================
288
- // Session list helpers (sidebar / tabs)
289
- // ============================================================================
290
- /**
291
- * Build a map from parent session ID → array of child session IDs.
292
- * Used to aggregate child session status (permissions, busy) in the sidebar.
293
- * Matches SolidJS reference `childMapByParent()` in helpers.ts.
294
- */
295
- export function childMapByParent(sessions) {
296
- const map = new Map();
297
- for (const session of sessions) {
298
- if (!session.parentID)
299
- continue;
300
- const existing = map.get(session.parentID);
301
- if (existing) {
302
- existing.push(session.id);
303
- }
304
- else {
305
- map.set(session.parentID, [session.id]);
306
- }
307
- }
308
- return map;
309
- }
310
- /**
311
- * Sort comparator for sessions.
312
- * Two tiers:
313
- * 1. Sessions updated within `now - 60s` are pinned to top, sorted by ID (stable).
314
- * 2. Older sessions sorted by `updated` time descending.
315
- * Matches SolidJS reference `sortSessions()` in helpers.ts.
316
- */
317
- export function sortSessions(now) {
318
- const oneMinuteAgo = now - 60 * 1000;
319
- return (a, b) => {
320
- const aUpdated = a.time.updated ?? a.time.created;
321
- const bUpdated = b.time.updated ?? b.time.created;
322
- const aRecent = aUpdated > oneMinuteAgo;
323
- const bRecent = bUpdated > oneMinuteAgo;
324
- if (aRecent && bRecent)
325
- return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
326
- if (aRecent && !bRecent)
327
- return -1;
328
- if (!aRecent && bRecent)
329
- return 1;
330
- return bUpdated - aUpdated;
331
- };
332
- }
333
- /**
334
- * Recursively collect ALL descendant session IDs for a given parent.
335
- * Walks the full tree so deeply nested sub-agents are included.
336
- */
337
- export function allDescendantIds(childMap, sessionId) {
338
- const directChildren = childMap.get(sessionId);
339
- if (!directChildren || directChildren.length === 0)
340
- return [];
341
- const result = [];
342
- for (const childId of directChildren) {
343
- result.push(childId);
344
- result.push(...allDescendantIds(childMap, childId));
345
- }
346
- return result;
347
- }
348
226
  //# sourceMappingURL=grouping.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"grouping.js","sourceRoot":"","sources":["../../../src/core/turns/grouping.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AA0ErF,4DAA4D;AAC5D,SAAS,kBAAkB,CAAC,OAAuB,EAAE,aAAqB;IACxE,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,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gD,EAAE,OAAO,CAAC;YACrF,IAAI,EAAE,CAAC,IAAI,KAAK,UAAU,IAAI,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;gBACzD,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAwB,CAAC,CAAC;YAC5D,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -5,6 +5,7 @@
5
5
  */
6
6
  export type * from './types.js';
7
7
  export * from './classify.js';
8
+ export * from './display-order.js';
8
9
  export * from './errors.js';
9
10
  export * from './grouping.js';
10
11
  export * from './open-turn.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/turns/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,mBAAmB,SAAS,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/turns/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,mBAAmB,SAAS,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from './classify.js';
2
+ export * from './display-order.js';
2
3
  export * from './errors.js';
3
4
  export * from './grouping.js';
4
5
  export * from './open-turn.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/turns/index.ts"],"names":[],"mappings":"AAMA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/turns/index.ts"],"names":[],"mappings":"AAMA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
@@ -87,13 +87,20 @@ export declare function getChildSessionError(childMessages: readonly MessageWith
87
87
  export declare function getChildSessionToolParts<M extends MessageWithPartsLike>(childMessages: readonly M[]): Array<M['parts'][number] & {
88
88
  type: 'tool';
89
89
  }>;
90
+ /**
91
+ * The tool presentation catalog: one card per known tool name, keyed by
92
+ * `normalizeName`. A title is either a literal or built from the input;
93
+ * a subtitle reads the input. Anything not in the table falls back to
94
+ * {@link coreToolInfo}, which cards by tool KIND.
95
+ */
96
+ type ToolCardInput = Record<string, any>;
90
97
  /**
91
98
  * Get icon, title, subtitle for a tool part.
92
99
  * Matches SolidJS getToolInfo — message-part.tsx:184-270
93
100
  *
94
101
  * Icon names are Lucide icon names used by the React frontend.
95
102
  */
96
- export declare function getToolInfo(tool: string, input?: Record<string, any>): ToolInfo;
103
+ export declare function getToolInfo(tool: string, input?: ToolCardInput): ToolInfo;
97
104
  /** Extract filename from a path. */
98
105
  export declare function getFilename(path: string | undefined): string | undefined;
99
106
  /** Extract filename + parent directory, e.g. "main.go /workspace" */
@@ -118,4 +125,5 @@ export declare function getPermissionForTool<T extends RequestWithToolLike>(perm
118
125
  export declare function getQuestionForTool<T extends RequestWithToolLike>(questions: readonly T[], callID: string): T | undefined;
119
126
  /** Strip ANSI escape codes from terminal output. */
120
127
  export declare function stripAnsi(str: string): string;
128
+ export {};
121
129
  //# sourceMappingURL=parts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parts.d.ts","sourceRoot":"","sources":["../../../src/core/turns/parts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,KAAK,EACV,UAAU,EACV,oBAAoB,EACpB,QAAQ,EACR,mBAAmB,EACnB,QAAQ,EACR,YAAY,EACb,MAAM,SAAS,CAAC;AA0BjB,wBAAgB,UAAU,CAAC,CAAC,SAAS,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAEpF;AAED,wBAAgB,eAAe,CAAC,CAAC,SAAS,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAE9F;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,QAAQ,EAAE,IAAI,EAAE,CAAC,GA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