@kortix/sdk 0.13.28 → 0.13.30

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 (164) hide show
  1. package/dist/core/client/kortix.d.ts +4 -0
  2. package/dist/core/client/kortix.d.ts.map +1 -1
  3. package/dist/core/client/kortix.js +32 -1
  4. package/dist/core/client/kortix.js.map +1 -1
  5. package/dist/core/http/api-client.js.map +1 -1
  6. package/dist/core/rest/projects-client/accounts.d.ts +5 -0
  7. package/dist/core/rest/projects-client/accounts.d.ts.map +1 -1
  8. package/dist/core/rest/projects-client/accounts.js.map +1 -1
  9. package/dist/core/rest/projects-client/agent-config.d.ts +8 -0
  10. package/dist/core/rest/projects-client/agent-config.d.ts.map +1 -1
  11. package/dist/core/rest/projects-client/agent-config.js.map +1 -1
  12. package/dist/core/rest/projects-client/apps.d.ts +14 -0
  13. package/dist/core/rest/projects-client/apps.d.ts.map +1 -1
  14. package/dist/core/rest/projects-client/apps.js +4 -0
  15. package/dist/core/rest/projects-client/apps.js.map +1 -1
  16. package/dist/core/rest/projects-client/audit.d.ts +4 -0
  17. package/dist/core/rest/projects-client/audit.d.ts.map +1 -1
  18. package/dist/core/rest/projects-client/audit.js.map +1 -1
  19. package/dist/core/rest/projects-client/gateway.d.ts +4 -8
  20. package/dist/core/rest/projects-client/gateway.d.ts.map +1 -1
  21. package/dist/core/rest/projects-client/gateway.js.map +1 -1
  22. package/dist/core/rest/projects-client/iam.d.ts +16 -0
  23. package/dist/core/rest/projects-client/iam.d.ts.map +1 -1
  24. package/dist/core/rest/projects-client/iam.js +7 -0
  25. package/dist/core/rest/projects-client/iam.js.map +1 -1
  26. package/dist/core/rest/projects-client/index.d.ts +1 -0
  27. package/dist/core/rest/projects-client/index.d.ts.map +1 -1
  28. package/dist/core/rest/projects-client/index.js +1 -0
  29. package/dist/core/rest/projects-client/index.js.map +1 -1
  30. package/dist/core/rest/projects-client/projects.d.ts +15 -1
  31. package/dist/core/rest/projects-client/projects.d.ts.map +1 -1
  32. package/dist/core/rest/projects-client/projects.js +1 -0
  33. package/dist/core/rest/projects-client/projects.js.map +1 -1
  34. package/dist/core/rest/projects-client/review-items.d.ts +173 -0
  35. package/dist/core/rest/projects-client/review-items.d.ts.map +1 -0
  36. package/dist/core/rest/projects-client/review-items.js +260 -0
  37. package/dist/core/rest/projects-client/review-items.js.map +1 -0
  38. package/dist/core/rest/projects-client/session-costs.d.ts +7 -9
  39. package/dist/core/rest/projects-client/session-costs.d.ts.map +1 -1
  40. package/dist/core/rest/projects-client/session-costs.js.map +1 -1
  41. package/dist/core/turns/index.d.ts +3 -0
  42. package/dist/core/turns/index.d.ts.map +1 -1
  43. package/dist/core/turns/index.js +2 -0
  44. package/dist/core/turns/index.js.map +1 -1
  45. package/dist/core/turns/segments/burst-summary.d.ts +49 -0
  46. package/dist/core/turns/segments/burst-summary.d.ts.map +1 -0
  47. package/dist/core/turns/segments/burst-summary.js +64 -0
  48. package/dist/core/turns/segments/burst-summary.js.map +1 -0
  49. package/dist/core/turns/segments/compaction-state.d.ts +44 -0
  50. package/dist/core/turns/segments/compaction-state.d.ts.map +1 -0
  51. package/dist/core/turns/segments/compaction-state.js +79 -0
  52. package/dist/core/turns/segments/compaction-state.js.map +1 -0
  53. package/dist/core/turns/segments/group-steps.d.ts +22 -0
  54. package/dist/core/turns/segments/group-steps.d.ts.map +1 -0
  55. package/dist/core/turns/segments/group-steps.js +89 -0
  56. package/dist/core/turns/segments/group-steps.js.map +1 -0
  57. package/dist/core/turns/segments/index.d.ts +21 -0
  58. package/dist/core/turns/segments/index.d.ts.map +1 -0
  59. package/dist/core/turns/segments/index.js +21 -0
  60. package/dist/core/turns/segments/index.js.map +1 -0
  61. package/dist/core/turns/segments/merge-steps.d.ts +79 -0
  62. package/dist/core/turns/segments/merge-steps.d.ts.map +1 -0
  63. package/dist/core/turns/segments/merge-steps.js +190 -0
  64. package/dist/core/turns/segments/merge-steps.js.map +1 -0
  65. package/dist/core/turns/segments/message-time.d.ts +86 -0
  66. package/dist/core/turns/segments/message-time.d.ts.map +1 -0
  67. package/dist/core/turns/segments/message-time.js +196 -0
  68. package/dist/core/turns/segments/message-time.js.map +1 -0
  69. package/dist/core/turns/segments/narration.d.ts +71 -0
  70. package/dist/core/turns/segments/narration.d.ts.map +1 -0
  71. package/dist/core/turns/segments/narration.js +836 -0
  72. package/dist/core/turns/segments/narration.js.map +1 -0
  73. package/dist/core/turns/segments/segment-turn.d.ts +26 -0
  74. package/dist/core/turns/segments/segment-turn.d.ts.map +1 -0
  75. package/dist/core/turns/segments/segment-turn.js +36 -0
  76. package/dist/core/turns/segments/segment-turn.js.map +1 -0
  77. package/dist/core/turns/segments/session-activity-groups.d.ts +93 -0
  78. package/dist/core/turns/segments/session-activity-groups.d.ts.map +1 -0
  79. package/dist/core/turns/segments/session-activity-groups.js +127 -0
  80. package/dist/core/turns/segments/session-activity-groups.js.map +1 -0
  81. package/dist/core/turns/segments/step-label.d.ts +44 -0
  82. package/dist/core/turns/segments/step-label.d.ts.map +1 -0
  83. package/dist/core/turns/segments/step-label.js +129 -0
  84. package/dist/core/turns/segments/step-label.js.map +1 -0
  85. package/dist/core/turns/segments/turn-busy-visibility.d.ts +51 -0
  86. package/dist/core/turns/segments/turn-busy-visibility.d.ts.map +1 -0
  87. package/dist/core/turns/segments/turn-busy-visibility.js +47 -0
  88. package/dist/core/turns/segments/turn-busy-visibility.js.map +1 -0
  89. package/dist/core/turns/segments/working-turn.d.ts +165 -0
  90. package/dist/core/turns/segments/working-turn.d.ts.map +1 -0
  91. package/dist/core/turns/segments/working-turn.js +168 -0
  92. package/dist/core/turns/segments/working-turn.js.map +1 -0
  93. package/dist/core/turns/text-scan.d.ts +65 -0
  94. package/dist/core/turns/text-scan.d.ts.map +1 -0
  95. package/dist/core/turns/text-scan.js +344 -0
  96. package/dist/core/turns/text-scan.js.map +1 -0
  97. package/dist/core/turns/tools/agent-helpers.d.ts +10 -0
  98. package/dist/core/turns/tools/agent-helpers.d.ts.map +1 -0
  99. package/dist/core/turns/tools/agent-helpers.js +54 -0
  100. package/dist/core/turns/tools/agent-helpers.js.map +1 -0
  101. package/dist/core/turns/tools/file-verb.d.ts +81 -0
  102. package/dist/core/turns/tools/file-verb.d.ts.map +1 -0
  103. package/dist/core/turns/tools/file-verb.js +70 -0
  104. package/dist/core/turns/tools/file-verb.js.map +1 -0
  105. package/dist/core/turns/tools/index.d.ts +22 -0
  106. package/dist/core/turns/tools/index.d.ts.map +1 -0
  107. package/dist/core/turns/tools/index.js +22 -0
  108. package/dist/core/turns/tools/index.js.map +1 -0
  109. package/dist/core/turns/tools/memory-helpers.d.ts +16 -0
  110. package/dist/core/turns/tools/memory-helpers.d.ts.map +1 -0
  111. package/dist/core/turns/tools/memory-helpers.js +55 -0
  112. package/dist/core/turns/tools/memory-helpers.js.map +1 -0
  113. package/dist/core/turns/tools/patch-summary.d.ts +53 -0
  114. package/dist/core/turns/tools/patch-summary.d.ts.map +1 -0
  115. package/dist/core/turns/tools/patch-summary.js +71 -0
  116. package/dist/core/turns/tools/patch-summary.js.map +1 -0
  117. package/dist/core/turns/tools/presentation-helpers.d.ts +16 -0
  118. package/dist/core/turns/tools/presentation-helpers.d.ts.map +1 -0
  119. package/dist/core/turns/tools/presentation-helpers.js +18 -0
  120. package/dist/core/turns/tools/presentation-helpers.js.map +1 -0
  121. package/dist/core/turns/tools/question-helpers.d.ts +10 -0
  122. package/dist/core/turns/tools/question-helpers.d.ts.map +1 -0
  123. package/dist/core/turns/tools/question-helpers.js +13 -0
  124. package/dist/core/turns/tools/question-helpers.js.map +1 -0
  125. package/dist/core/turns/tools/read-helpers.d.ts +8 -0
  126. package/dist/core/turns/tools/read-helpers.d.ts.map +1 -0
  127. package/dist/core/turns/tools/read-helpers.js +25 -0
  128. package/dist/core/turns/tools/read-helpers.js.map +1 -0
  129. package/dist/core/turns/tools/search-query.d.ts +28 -0
  130. package/dist/core/turns/tools/search-query.d.ts.map +1 -0
  131. package/dist/core/turns/tools/search-query.js +137 -0
  132. package/dist/core/turns/tools/search-query.js.map +1 -0
  133. package/dist/core/turns/tools/show-availability.d.ts +53 -0
  134. package/dist/core/turns/tools/show-availability.d.ts.map +1 -0
  135. package/dist/core/turns/tools/show-availability.js +110 -0
  136. package/dist/core/turns/tools/show-availability.js.map +1 -0
  137. package/dist/core/turns/tools/skill-helpers.d.ts +35 -0
  138. package/dist/core/turns/tools/skill-helpers.d.ts.map +1 -0
  139. package/dist/core/turns/tools/skill-helpers.js +129 -0
  140. package/dist/core/turns/tools/skill-helpers.js.map +1 -0
  141. package/dist/core/turns/tools/tool-meta.d.ts +72 -0
  142. package/dist/core/turns/tools/tool-meta.d.ts.map +1 -0
  143. package/dist/core/turns/tools/tool-meta.js +174 -0
  144. package/dist/core/turns/tools/tool-meta.js.map +1 -0
  145. package/dist/core/turns/tools/tool-outcome.d.ts +78 -0
  146. package/dist/core/turns/tools/tool-outcome.d.ts.map +1 -0
  147. package/dist/core/turns/tools/tool-outcome.js +244 -0
  148. package/dist/core/turns/tools/tool-outcome.js.map +1 -0
  149. package/dist/core/turns/tools/tool-output-format.d.ts +63 -0
  150. package/dist/core/turns/tools/tool-output-format.d.ts.map +1 -0
  151. package/dist/core/turns/tools/tool-output-format.js +174 -0
  152. package/dist/core/turns/tools/tool-output-format.js.map +1 -0
  153. package/dist/core/turns/tools/web-helpers.d.ts +40 -0
  154. package/dist/core/turns/tools/web-helpers.d.ts.map +1 -0
  155. package/dist/core/turns/tools/web-helpers.js +297 -0
  156. package/dist/core/turns/tools/web-helpers.js.map +1 -0
  157. package/dist/kortix.esm.min.js +42 -26
  158. package/dist/kortix.global.js +42 -26
  159. package/dist/react/session-cache-write.d.ts +3 -3
  160. package/dist/react/session-cache-write.d.ts.map +1 -1
  161. package/dist/react/session-cache-write.js +31 -5
  162. package/dist/react/session-cache-write.js.map +1 -1
  163. package/dist/react/sign-in-with-kortix.d.ts +3 -3
  164. package/package.json +2 -2
@@ -0,0 +1,344 @@
1
+ /**
2
+ * Linear-time string scanners for the tool-output parsers in `core/turns`.
3
+ *
4
+ * Each function replaces one regex that CodeQL flags as polynomial ReDoS
5
+ * (js/polynomial-redos) now that these parsers are exported library functions
6
+ * whose input is arbitrary tool output. Each returns exactly what the regex it
7
+ * replaces returned — `text-scan.test.ts` runs the old regex as the oracle over
8
+ * seeded random inputs — so call sites change their expression, not their
9
+ * behaviour. Internal: not exported from the package.
10
+ */
11
+ const WS = /\s/;
12
+ const WORD = /\w/;
13
+ /** JavaScript `\s`: WhiteSpace and LineTerminator. */
14
+ function isWs(ch) {
15
+ return ch !== undefined && WS.test(ch);
16
+ }
17
+ /** What `.` refuses to match without the `s` flag. */
18
+ function isLineTerminator(ch) {
19
+ return ch === '\n' || ch === '\r' || ch === '\u2028' || ch === '\u2029';
20
+ }
21
+ function isWord(ch) {
22
+ return ch !== undefined && WORD.test(ch);
23
+ }
24
+ /**
25
+ * Case-folds the way a non-unicode `/i` regex compares characters: upper-case
26
+ * a character only when that yields exactly one code unit. Same length as the
27
+ * input, so indexes carry over.
28
+ */
29
+ function fold(s) {
30
+ let out = '';
31
+ for (const ch of s) {
32
+ if (ch.length !== 1) {
33
+ out += ch;
34
+ continue;
35
+ }
36
+ const upper = ch.toUpperCase();
37
+ out += upper.length === 1 ? upper : ch;
38
+ }
39
+ return out;
40
+ }
41
+ /** `s.replace(/\/+$/, '')` */
42
+ export function stripTrailingSlashes(s) {
43
+ let end = s.length;
44
+ while (end > 0 && s[end - 1] === '/')
45
+ end--;
46
+ return s.slice(0, end);
47
+ }
48
+ /** `s.replace(/^\/+|\/+$/g, '')` */
49
+ export function stripEdgeSlashes(s) {
50
+ let start = 0;
51
+ while (start < s.length && s[start] === '/')
52
+ start++;
53
+ return stripTrailingSlashes(s.slice(start));
54
+ }
55
+ /** Capture of `/open([\s\S]*?)close/` for literal `open` and `close`, or null. */
56
+ export function textBetween(s, open, close) {
57
+ const o = s.indexOf(open);
58
+ if (o === -1)
59
+ return null;
60
+ const c = s.indexOf(close, o + open.length);
61
+ return c === -1 ? null : s.slice(o + open.length, c);
62
+ }
63
+ /** Capture of `/<tag>\n?([\s\S]*?)\n?<\/tag>/`, or null. */
64
+ export function tagBodyTrimNewline(s, tag) {
65
+ let inner = textBetween(s, `<${tag}>`, `</${tag}>`);
66
+ if (inner === null)
67
+ return null;
68
+ if (inner.startsWith('\n'))
69
+ inner = inner.slice(1);
70
+ if (inner.endsWith('\n'))
71
+ inner = inner.slice(0, -1);
72
+ return inner;
73
+ }
74
+ /** First `<tag…>` open: index of `<` and of its `>`. */
75
+ function openTag(s, tag, from = 0) {
76
+ const open = s.indexOf(`<${tag}`, from);
77
+ if (open === -1)
78
+ return null;
79
+ const end = s.indexOf('>', open + 1 + tag.length);
80
+ return end === -1 ? null : { open, end };
81
+ }
82
+ /** Capture of `/<tag([^>]*)>/`, or null. */
83
+ export function tagAttributes(s, tag) {
84
+ const found = openTag(s, tag);
85
+ return found ? s.slice(found.open + 1 + tag.length, found.end) : null;
86
+ }
87
+ /** Capture of `/<tag[^>]*>([\s\S]*?)<\/tag>/`, or null. */
88
+ export function tagBody(s, tag) {
89
+ const found = openTag(s, tag);
90
+ if (!found)
91
+ return null;
92
+ const close = s.indexOf(`</${tag}>`, found.end + 1);
93
+ return close === -1 ? null : s.slice(found.end + 1, close);
94
+ }
95
+ /** `s.replace(/<tag[^>]*>[\s\S]*?<\/tag>/g, '')` */
96
+ export function removeTagBlocks(s, tag) {
97
+ const closeTag = `</${tag}>`;
98
+ let out = '';
99
+ let pos = 0;
100
+ for (;;) {
101
+ const found = openTag(s, tag, pos);
102
+ if (!found)
103
+ break;
104
+ const close = s.indexOf(closeTag, found.end + 1);
105
+ // No close after this open means none after any later open either.
106
+ if (close === -1)
107
+ break;
108
+ out += s.slice(pos, found.open);
109
+ pos = close + closeTag.length;
110
+ }
111
+ return out + s.slice(pos);
112
+ }
113
+ /**
114
+ * Every capture of `/open(.*?)close/g`. `.` never crosses a line terminator,
115
+ * so every match lies inside one line: scan line by line.
116
+ */
117
+ export function textItems(s, open, close) {
118
+ const items = [];
119
+ for (const line of s.split(/[\n\r\u2028\u2029]/)) {
120
+ let pos = 0;
121
+ for (;;) {
122
+ const o = line.indexOf(open, pos);
123
+ if (o === -1)
124
+ break;
125
+ const c = line.indexOf(close, o + open.length);
126
+ if (c === -1)
127
+ break;
128
+ items.push(line.slice(o + open.length, c));
129
+ pos = c + close.length;
130
+ }
131
+ }
132
+ return items;
133
+ }
134
+ /**
135
+ * Capture of `/:\s*(\{[\s\S]*\})\s*$/`: the `{…}` tail after the first colon
136
+ * that is followed (past whitespace) by `{`, when the string ends in `}`.
137
+ */
138
+ export function jsonTail(s) {
139
+ const t = s.trimEnd();
140
+ if (!t.endsWith('}'))
141
+ return null;
142
+ let colon = t.indexOf(':');
143
+ while (colon !== -1) {
144
+ let j = colon + 1;
145
+ while (j < t.length && isWs(t[j]))
146
+ j++;
147
+ if (t[j] === '{')
148
+ return t.slice(j);
149
+ colon = t.indexOf(':', colon + 1);
150
+ }
151
+ return null;
152
+ }
153
+ /**
154
+ * `/content of .* with line numbers/i.test(s)` for `first` and `second` in
155
+ * place of the two phrases: `first`, then any run without a line terminator,
156
+ * then `second`, case-insensitively.
157
+ */
158
+ export function hasPhrasePair(s, first, second) {
159
+ const a = fold(first);
160
+ const b = fold(second);
161
+ for (const line of fold(s).split(/[\n\r\u2028\u2029]/)) {
162
+ const i = line.indexOf(a);
163
+ if (i === -1)
164
+ continue;
165
+ if (line.lastIndexOf(b) >= i + a.length)
166
+ return true;
167
+ }
168
+ return false;
169
+ }
170
+ /**
171
+ * Capture of `/^\s*(?:L1|L2|…)\s*:\s*(.+?)\s*$/im` for the given labels.
172
+ *
173
+ * `^` is a line start, and every `\s*` may cross newlines. The value is the
174
+ * rest of the line where it starts, less trailing whitespace. When only
175
+ * whitespace follows the colon, the regex backtracks one character into the
176
+ * value; that case is reproduced below.
177
+ */
178
+ export function labelledValue(s, labels) {
179
+ const folded = fold(s);
180
+ const wanted = labels.map(fold);
181
+ const n = s.length;
182
+ const skipWs = (from) => {
183
+ let i = from;
184
+ while (i < n && isWs(s[i]))
185
+ i++;
186
+ return i;
187
+ };
188
+ const nextLineStart = (from) => {
189
+ for (let i = from; i < n; i++)
190
+ if (isLineTerminator(s[i]))
191
+ return i + 1;
192
+ return -1;
193
+ };
194
+ let p = 0;
195
+ while (p !== -1 && p <= n) {
196
+ const q = skipWs(p);
197
+ if (q >= n)
198
+ return null;
199
+ const label = wanted.find((l) => folded.startsWith(l, q));
200
+ if (label !== undefined) {
201
+ const k = skipWs(q + label.length);
202
+ if (s[k] === ':') {
203
+ const r = skipWs(k + 1);
204
+ if (r < n) {
205
+ let end = r;
206
+ while (end < n && !isLineTerminator(s[end]))
207
+ end++;
208
+ while (end > r + 1 && isWs(s[end - 1]))
209
+ end--;
210
+ return s.slice(r, end);
211
+ }
212
+ // Only whitespace after the colon: `.+?` takes the last character
213
+ // that is not a line terminator, if there is one.
214
+ for (let i = n - 1; i > k; i--)
215
+ if (!isLineTerminator(s[i]))
216
+ return s[i];
217
+ return null;
218
+ }
219
+ }
220
+ // Every line start up to q skips to the same q; move past its line.
221
+ p = nextLineStart(q);
222
+ }
223
+ return null;
224
+ }
225
+ /**
226
+ * Captures of `/\*\*(task-[a-z0-9]+)\*\*\s+(.+?)\s+—\s+(\w+)/` as
227
+ * `{ id, title, status }`, or null. Reproduces the regex's backtracking: the
228
+ * title may begin inside the whitespace run after the id when the first
229
+ * non-space character is the dash itself.
230
+ */
231
+ export function taskRow(s) {
232
+ const n = s.length;
233
+ // wsStart[i]: start of the whitespace run that ends at i - 1 (i when none).
234
+ const wsStart = new Array(n + 1);
235
+ wsStart[0] = 0;
236
+ for (let i = 1; i <= n; i++)
237
+ wsStart[i] = isWs(s[i - 1]) ? wsStart[i - 1] : i;
238
+ // Dashes that can separate title and status: whitespace before, then
239
+ // whitespace, then a word character. nextDash[i]: first such dash at >= i.
240
+ const nextDash = new Array(n + 1).fill(-1);
241
+ for (let i = n - 1; i >= 0; i--) {
242
+ nextDash[i] = nextDash[i + 1];
243
+ if (s[i] !== '—' || !isWs(s[i - 1]))
244
+ continue;
245
+ let j = i + 1;
246
+ if (!isWs(s[j]))
247
+ continue;
248
+ while (j < n && isWs(s[j]))
249
+ j++;
250
+ if (isWord(s[j]))
251
+ nextDash[i] = i;
252
+ }
253
+ // Line terminators before i, so "no terminator in [a, b)" is O(1).
254
+ const terminators = new Array(n + 1);
255
+ terminators[0] = 0;
256
+ for (let i = 0; i < n; i++)
257
+ terminators[i + 1] = terminators[i] + (isLineTerminator(s[i]) ? 1 : 0);
258
+ const clean = (a, b) => terminators[b] === terminators[a];
259
+ const statusAt = (dash) => {
260
+ let j = dash + 1;
261
+ while (isWs(s[j]))
262
+ j++;
263
+ let end = j;
264
+ while (end < n && isWord(s[end]))
265
+ end++;
266
+ return s.slice(j, end);
267
+ };
268
+ for (let o = s.indexOf('**task-'); o !== -1; o = s.indexOf('**task-', o + 1)) {
269
+ let k = o + 7;
270
+ while (k < n && /[a-z0-9]/.test(s[k]))
271
+ k++;
272
+ if (k === o + 7 || s[k] !== '*' || s[k + 1] !== '*')
273
+ continue;
274
+ const a = k + 2;
275
+ let firstNonWs = a;
276
+ while (firstNonWs < n && isWs(s[firstNonWs]))
277
+ firstNonWs++;
278
+ if (firstNonWs === a)
279
+ continue;
280
+ // Title starting at the first non-space character (greedy `\s+`).
281
+ if (firstNonWs < n && firstNonWs + 2 <= n) {
282
+ const dash = nextDash[firstNonWs + 2] ?? -1;
283
+ if (dash !== -1) {
284
+ const te = Math.max(firstNonWs + 1, wsStart[dash]);
285
+ if (clean(firstNonWs, te)) {
286
+ return { id: s.slice(o + 2, k), title: s.slice(firstNonWs, te), status: statusAt(dash) };
287
+ }
288
+ }
289
+ }
290
+ // Backtracked: a one-character title from inside the whitespace run, when
291
+ // the dash is the first non-space character.
292
+ if (firstNonWs < n && nextDash[firstNonWs] === firstNonWs) {
293
+ for (let ts = firstNonWs - 2; ts >= a + 1; ts--) {
294
+ if (!isLineTerminator(s[ts])) {
295
+ return { id: s.slice(o + 2, k), title: s[ts], status: statusAt(firstNonWs) };
296
+ }
297
+ }
298
+ }
299
+ }
300
+ return null;
301
+ }
302
+ /**
303
+ * `s.replace(/^(?:\s*Error:\s*)+/i, '').replace(/(?:\bError:\s*){2,}/gi, '')`
304
+ */
305
+ export function stripErrorPrefixes(s) {
306
+ const isError = (t, i) => t.slice(i, i + 6).toLowerCase() === 'error:';
307
+ // Leading `(\s*Error:\s*)+`: keep going while a full repetition matches.
308
+ let cut = 0;
309
+ for (;;) {
310
+ let i = cut;
311
+ while (i < s.length && isWs(s[i]))
312
+ i++;
313
+ if (!isError(s, i))
314
+ break;
315
+ i += 6;
316
+ while (i < s.length && isWs(s[i]))
317
+ i++;
318
+ cut = i;
319
+ }
320
+ const t = s.slice(cut);
321
+ // Runs of two or more `\bError:\s*`.
322
+ let out = '';
323
+ let i = 0;
324
+ while (i < t.length) {
325
+ if (isError(t, i) && (i === 0 || !isWord(t[i - 1]))) {
326
+ let j = i;
327
+ let count = 0;
328
+ while (isError(t, j)) {
329
+ j += 6;
330
+ while (j < t.length && isWs(t[j]))
331
+ j++;
332
+ count++;
333
+ }
334
+ if (count >= 2) {
335
+ i = j;
336
+ continue;
337
+ }
338
+ }
339
+ out += t[i];
340
+ i++;
341
+ }
342
+ return out;
343
+ }
344
+ //# sourceMappingURL=text-scan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-scan.js","sourceRoot":"","sources":["../../../src/core/turns/text-scan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,EAAE,GAAG,IAAI,CAAC;AAChB,MAAM,IAAI,GAAG,IAAI,CAAC;AAElB,sDAAsD;AACtD,SAAS,IAAI,CAAC,EAAsB;IAClC,OAAO,EAAE,KAAK,SAAS,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACzC,CAAC;AAED,sDAAsD;AACtD,SAAS,gBA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AG,CAAC,CAAC;YACV,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,OAAO,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;gBACrB,CAAC,IAAI,CAAC,CAAC;gBACP,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBAAE,CAAC,EAAE,CAAC;gBACvC,KAAK,EAAE,CAAC;YACV,CAAC;YACD,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;gBACf,CAAC,GAAG,CAAC,CAAC;gBACN,SAAS;YACX,CAAC;QACH,CAAC;QACD,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACZ,CAAC,EAAE,CAAC;IACN,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare function cleanWorkerOutput(raw: string): string;
2
+ export declare function isShortOutput(cleaned: string): boolean;
3
+ export declare function extractWorkerPreview(cleaned: string): string | null;
4
+ export declare function parseTaskRows(output: string): Array<{
5
+ id: string;
6
+ title: string;
7
+ status: string;
8
+ sessionId?: string;
9
+ }>;
10
+ //# sourceMappingURL=agent-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-helpers.d.ts","sourceRoot":"","sources":["../../../../src/core/turns/tools/agent-helpers.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAyBrD;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAItD;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOnE;AAED,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,GACb,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAa1E"}
@@ -0,0 +1,54 @@
1
+ import { removeTagBlocks, taskRow } from '../text-scan.js';
2
+ export function cleanWorkerOutput(raw) {
3
+ if (!raw)
4
+ return '';
5
+ let text = raw;
6
+ text = text.replace(/^##\s*Worker Result\s*\n/i, '');
7
+ text = text.replace(/^\*\*Agent:\*\*.*\n?/m, '');
8
+ text = text.replace(/^\*\*Task:\*\*.*\n?/m, '');
9
+ text = text.replace(/^\*\*Status:\*\*.*\n?/m, '');
10
+ text = text.replace(/^\*\*Session:\*\*.*\n?/m, '');
11
+ text = text.replace(/^\*\*Duration:\*\*.*\n?/m, '');
12
+ text = removeTagBlocks(text, 'kortix_goal_system');
13
+ text = text.replace(/^Task \*\*task-[a-z0-9]+\*\* created and started\..*$/gm, '');
14
+ text = text.replace(/^Task \*\*task-[a-z0-9]+\*\* created:.*$/gm, '');
15
+ text = text.replace(/^Task \*\*task-[a-z0-9]+\*\* started\..*$/gm, '');
16
+ text = text.replace(/^Task \*\*task-[a-z0-9]+\*\* failed to start.*$/gm, '');
17
+ text = text.replace(/^Message sent to task.*$/gm, '');
18
+ text = text.replace(/^Task \*\*task-[a-z0-9]+\*\* approved.*$/gm, '');
19
+ text = text.replace(/^Task \*\*task-[a-z0-9]+\*\* cancelled.*$/gm, '');
20
+ text = text.replace(/Worker session: ses_[a-zA-Z0-9]+/g, '');
21
+ text = text.replace(/^---\s*\n/gm, '');
22
+ text = text.trim();
23
+ return text || '';
24
+ }
25
+ export function isShortOutput(cleaned) {
26
+ if (!cleaned)
27
+ return false;
28
+ const lines = cleaned.split('\n').filter((l) => l.trim());
29
+ return lines.length <= 3;
30
+ }
31
+ export function extractWorkerPreview(cleaned) {
32
+ if (!cleaned)
33
+ return null;
34
+ const lines = cleaned.split('\n').filter((l) => l.trim() && !l.startsWith('#'));
35
+ const first = lines[0]?.replace(/^\*\*.*?\*\*\s*/, '').trim();
36
+ if (!first)
37
+ return null;
38
+ return first.length > 120 ? first.slice(0, 120).trim() + '…' : first;
39
+ }
40
+ export function parseTaskRows(output) {
41
+ if (!output)
42
+ return [];
43
+ const rows = [];
44
+ const lines = output.split('\n').filter((l) => l.trim());
45
+ for (const line of lines) {
46
+ const row = taskRow(line);
47
+ if (row) {
48
+ const sessionMatch = line.match(/\bses_[a-zA-Z0-9]+/);
49
+ rows.push({ ...row, sessionId: sessionMatch?.[0] });
50
+ }
51
+ }
52
+ return rows;
53
+ }
54
+ //# sourceMappingURL=agent-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-helpers.js","sourceRoot":"","sources":["../../../../src/core/turns/tools/agent-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAExD,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,IAAI,IAAI,GAAG,GAAG,CAAC;IAEf,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,2BAA2B,EAAE,EAAE,CAAC,CAAC;IACrD,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC;IACjD,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC;IAChD,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,EAAE,CAAC,CAAC;IAClD,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAC;IACnD,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC;IAEpD,IAAI,GAAG,eAAe,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;IAEnD,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,yDAAyD,EAAE,EAAE,CAAC,CAAC;IACnF,IAAI,GAAG,IAAI,CAAC,O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;IAChF,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9D,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,OAAO,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,MAAc;IAEd,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACvB,MAAM,IAAI,GAA6E,EAAE,CAAC;IAE1F,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACzD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,GAAG,EAAE,CAAC;YACR,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;YACtD,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * What a call DID to a file, in the tense the row is actually in.
3
+ *
4
+ * Every other surface in this feature already speaks this way. `step-label.ts`
5
+ * turns a part into `Wrote` / `Writing`, `activity-file-chips.tsx` labels a run
6
+ * of writes `Wrote 3 files`, `narration.ts` narrates the panel, and
7
+ * `patch-summary.ts` derives a patch's verb from what the patch contains. The
8
+ * `BasicTool` trigger was the one surface left speaking machine: `write`
9
+ * rendered the literal registry key `Write`, and `edit` rendered `Editing`
10
+ * forever — present participle on a transcript from last week, which is the
11
+ * whole reason a settled row read as a paused one.
12
+ *
13
+ * So the trigger joins the others rather than growing a sixth copy of the
14
+ * grammar: this module is the table, and `patch-summary.ts` reads it too.
15
+ *
16
+ * Three tenses, because a row has three things it can honestly say:
17
+ *
18
+ * running — the call is in flight and the input is still arriving
19
+ * done — the call settled and did what the verb says
20
+ * failed — the call settled and did NOT do what the verb says
21
+ *
22
+ * `failed` is not decoration. `group-steps.ts` already forbids a failed step
23
+ * from wearing success wording ("Wrote budget.csv" for a write that errored is
24
+ * the panel lying, W7) and routes it through `narrateFailedStep`. The trigger
25
+ * had no such route: it flipped its icon to a warning and kept claiming the
26
+ * write landed. The wording here is `narration.ts:805` character for character
27
+ * — `write` for a write, `update` for an edit — so the row and the panel say
28
+ * the same thing about the same failure.
29
+ *
30
+ * No React import: this is a pure lookup, and it is unit-tested as one.
31
+ */
32
+ /** The tenses one file action can be rendered in. */
33
+ export interface FileVerb {
34
+ /** Past tense, shown once the call has settled. */
35
+ verb: string;
36
+ /** Present participle, shown while it runs. */
37
+ running: string;
38
+ /** The call did not land. Never claims the outcome the other two claim. */
39
+ failed: string;
40
+ }
41
+ /**
42
+ * What was done, not which tool did it.
43
+ *
44
+ * Keyed by action rather than by tool name because the two consumers key
45
+ * differently: the trigger rows come in as `write` / `edit` / `morph_edit`,
46
+ * while `patch-summary.ts` comes in as an `add` / `update` / `delete` / `move`
47
+ * patch op. Both map onto the same short list of English verbs, and mapping onto
48
+ * a shared vocabulary is the point — it is what stops `apply_patch` from
49
+ * inventing a second word for something `write` already has a word for.
50
+ *
51
+ * There is deliberately NO `create`. Producing a file that was not there is a
52
+ * WRITE, and the reader has already met that word on every `write` row in the
53
+ * session; a patch that adds four files saying `Created 4 files` beside a
54
+ * `write` row saying `Wrote app.py` is one product speaking two vocabularies
55
+ * about one act. `narration.ts` reached this conclusion already — it reports a
56
+ * write-family patch as `Wrote`, never as `Created`. `patch-summary.ts` maps
57
+ * its `add` op onto `write` for the same reason. `delete` and `rename` keep
58
+ * their own verbs because no write-family word covers them.
59
+ */
60
+ export type FileAction = 'write' | 'edit' | 'delete' | 'rename' | 'change' | 'read' | 'list';
61
+ export declare const FILE_VERBS: Record<FileAction, FileVerb>;
62
+ /**
63
+ * Which tense a row is in.
64
+ *
65
+ * A union rather than two booleans because a call site that takes booleans is a
66
+ * call site that can forget `failed` — which is exactly what the trigger rows
67
+ * did for as long as they existed.
68
+ */
69
+ export type FilePhase = 'running' | 'done' | 'failed';
70
+ export declare function fileVerb(action: FileAction, phase: FilePhase): string;
71
+ /**
72
+ * The tense a tool row is in, from the two facts every trigger already has.
73
+ *
74
+ * `running` is `ToolRunningContext` — true only while the turn that owns this
75
+ * part is live. A leftover `pending` part from a finished run reads `false`
76
+ * here and therefore renders in the PAST tense, which is the honest thing for
77
+ * it to say: whatever was going to happen has already not happened. The old
78
+ * present-participle title claimed the opposite on every restored session.
79
+ */
80
+ export declare function filePhase(running: boolean, isError: boolean): FilePhase;
81
+ //# sourceMappingURL=file-verb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-verb.d.ts","sourceRoot":"","sources":["../../../../src/core/turns/tools/file-verb.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,qDAAqD;AACrD,MAAM,WAAW,QAAQ;IACvB,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAE7F,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,QAAQ,CAenD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEtD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM,CAKrE;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS,CAGvE"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * What a call DID to a file, in the tense the row is actually in.
3
+ *
4
+ * Every other surface in this feature already speaks this way. `step-label.ts`
5
+ * turns a part into `Wrote` / `Writing`, `activity-file-chips.tsx` labels a run
6
+ * of writes `Wrote 3 files`, `narration.ts` narrates the panel, and
7
+ * `patch-summary.ts` derives a patch's verb from what the patch contains. The
8
+ * `BasicTool` trigger was the one surface left speaking machine: `write`
9
+ * rendered the literal registry key `Write`, and `edit` rendered `Editing`
10
+ * forever — present participle on a transcript from last week, which is the
11
+ * whole reason a settled row read as a paused one.
12
+ *
13
+ * So the trigger joins the others rather than growing a sixth copy of the
14
+ * grammar: this module is the table, and `patch-summary.ts` reads it too.
15
+ *
16
+ * Three tenses, because a row has three things it can honestly say:
17
+ *
18
+ * running — the call is in flight and the input is still arriving
19
+ * done — the call settled and did what the verb says
20
+ * failed — the call settled and did NOT do what the verb says
21
+ *
22
+ * `failed` is not decoration. `group-steps.ts` already forbids a failed step
23
+ * from wearing success wording ("Wrote budget.csv" for a write that errored is
24
+ * the panel lying, W7) and routes it through `narrateFailedStep`. The trigger
25
+ * had no such route: it flipped its icon to a warning and kept claiming the
26
+ * write landed. The wording here is `narration.ts:805` character for character
27
+ * — `write` for a write, `update` for an edit — so the row and the panel say
28
+ * the same thing about the same failure.
29
+ *
30
+ * No React import: this is a pure lookup, and it is unit-tested as one.
31
+ */
32
+ export const FILE_VERBS = {
33
+ write: { verb: 'Wrote', running: 'Writing', failed: "Couldn't write" },
34
+ edit: { verb: 'Edited', running: 'Editing', failed: "Couldn't update" },
35
+ delete: { verb: 'Deleted', running: 'Deleting', failed: "Couldn't delete" },
36
+ rename: { verb: 'Renamed', running: 'Renaming', failed: "Couldn't rename" },
37
+ // The weakest word here, deliberately — see `patchVerb`. A patch that creates
38
+ // one file and deletes another has no honest single verb.
39
+ change: { verb: 'Changed', running: 'Changing', failed: "Couldn't apply" },
40
+ // `read` and `list` mutate nothing, but they had the same two defects the
41
+ // mutating rows did: `List` was the bare registry key, and `Read` is a past
42
+ // tense that a call still streaming has not earned. The failed wording is
43
+ // `narration.ts`'s explore family, trimmed to this row's scope — the row
44
+ // knows WHICH file it could not open, so it says that instead of "your files".
45
+ read: { verb: 'Read', running: 'Reading', failed: "Couldn't read" },
46
+ list: { verb: 'Listed', running: 'Listing', failed: "Couldn't list" },
47
+ };
48
+ export function fileVerb(action, phase) {
49
+ const verbs = FILE_VERBS[action];
50
+ if (phase === 'running')
51
+ return verbs.running;
52
+ if (phase === 'failed')
53
+ return verbs.failed;
54
+ return verbs.verb;
55
+ }
56
+ /**
57
+ * The tense a tool row is in, from the two facts every trigger already has.
58
+ *
59
+ * `running` is `ToolRunningContext` — true only while the turn that owns this
60
+ * part is live. A leftover `pending` part from a finished run reads `false`
61
+ * here and therefore renders in the PAST tense, which is the honest thing for
62
+ * it to say: whatever was going to happen has already not happened. The old
63
+ * present-participle title claimed the opposite on every restored session.
64
+ */
65
+ export function filePhase(running, isError) {
66
+ if (isError)
67
+ return 'failed';
68
+ return running ? 'running' : 'done';
69
+ }
70
+ //# sourceMappingURL=file-verb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-verb.js","sourceRoot":"","sources":["../../../../src/core/turns/tools/file-verb.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAiCH,MAAM,CAAC,MAAM,UAAU,GAAiC;IACtD,KAAK,EAAE,EAAE,IAAI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AAC,CAAC,CAAC,MAAM,CAAC;AACtC,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Tool-call presentation helpers — what a tool call is called, what it did,
3
+ * and what its output says. Primary-arg extraction, file verbs, search-query
4
+ * humanizing, patch verbs, success/partial/failed outcomes, and parsers for
5
+ * web search, scrape, skill, memory, read, question, presentation and worker
6
+ * output. Pure data → data, no framework.
7
+ */
8
+ export * from './agent-helpers.js';
9
+ export * from './file-verb.js';
10
+ export * from './memory-helpers.js';
11
+ export * from './patch-summary.js';
12
+ export * from './presentation-helpers.js';
13
+ export * from './question-helpers.js';
14
+ export * from './read-helpers.js';
15
+ export * from './search-query.js';
16
+ export * from './show-availability.js';
17
+ export * from './skill-helpers.js';
18
+ export * from './tool-meta.js';
19
+ export * from './tool-outcome.js';
20
+ export * from './tool-output-format.js';
21
+ export * from './web-helpers.js';
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/turns/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Tool-call presentation helpers — what a tool call is called, what it did,
3
+ * and what its output says. Primary-arg extraction, file verbs, search-query
4
+ * humanizing, patch verbs, success/partial/failed outcomes, and parsers for
5
+ * web search, scrape, skill, memory, read, question, presentation and worker
6
+ * output. Pure data → data, no framework.
7
+ */
8
+ export * from './agent-helpers.js';
9
+ export * from './file-verb.js';
10
+ export * from './memory-helpers.js';
11
+ export * from './patch-summary.js';
12
+ export * from './presentation-helpers.js';
13
+ export * from './question-helpers.js';
14
+ export * from './read-helpers.js';
15
+ export * from './search-query.js';
16
+ export * from './show-availability.js';
17
+ export * from './skill-helpers.js';
18
+ export * from './tool-meta.js';
19
+ export * from './tool-outcome.js';
20
+ export * from './tool-output-format.js';
21
+ export * from './web-helpers.js';
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/turns/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC"}