@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,16 @@
1
+ export declare const MEMORY_VERBS: Record<string, string>;
2
+ export declare function memoryRelPath(p?: string): string;
3
+ interface MemoryDirEntry {
4
+ path: string;
5
+ size: string;
6
+ isDir: boolean;
7
+ }
8
+ export declare function parseMemoryView(output: string, viewedPath: string): {
9
+ type: 'dir';
10
+ entries: MemoryDirEntry[];
11
+ } | {
12
+ type: 'file';
13
+ content: string;
14
+ } | null;
15
+ export {};
16
+ //# sourceMappingURL=memory-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-helpers.d.ts","sourceRoot":"","sources":["../../../../src/core/turns/tools/memory-helpers.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAO/C,CAAC;AAEF,wBAAgB,aAAa,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAIhD;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,GACjB;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,cAAc,EAAE,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAqCvF"}
@@ -0,0 +1,55 @@
1
+ import { hasPhrasePair } from '../text-scan.js';
2
+ export const MEMORY_VERBS = {
3
+ view: 'View',
4
+ create: 'Create',
5
+ str_replace: 'Edit',
6
+ insert: 'Insert',
7
+ delete: 'Delete',
8
+ rename: 'Rename',
9
+ };
10
+ export function memoryRelPath(p) {
11
+ if (!p)
12
+ return '';
13
+ const rel = p.replace(/^\.kortix\/memory\/?/, '').replace(/\/$/, '');
14
+ return rel || 'memory';
15
+ }
16
+ export function parseMemoryView(output, viewedPath) {
17
+ if (!output)
18
+ return null;
19
+ const nl = output.indexOf('\n');
20
+ const header = nl === -1 ? output : output.slice(0, nl);
21
+ const body = nl === -1 ? '' : output.slice(nl + 1);
22
+ if (hasPhrasePair(header, 'content of ', ' with line numbers')) {
23
+ // `(\t|$)`, not `\t`. A file that ends with a newline — nearly every one —
24
+ // makes `memory view` emit a final entry with an EMPTY body: `28\t`. The
25
+ // output then passes through `partOutput`, which trims it, and the trim
26
+ // takes that trailing tab with it. The line reaching here is the bare
27
+ // `28`, which a tab-anchored strip cannot match, so the file's last line
28
+ // number survived into the markdown and rendered as prose at the bottom of
29
+ // every memory document.
30
+ const content = body
31
+ .split('\n')
32
+ .map((line) => line.replace(/^\s*\d+(\t|$)/, ''))
33
+ .join('\n');
34
+ return { type: 'file', content };
35
+ }
36
+ if (/files and directories/i.test(header)) {
37
+ const root = viewedPath.replace(/\/$/, '');
38
+ const entries = [];
39
+ for (const line of body.split('\n')) {
40
+ if (!line.trim())
41
+ continue;
42
+ const tab = line.indexOf('\t');
43
+ if (tab === -1)
44
+ continue;
45
+ const size = line.slice(0, tab).trim();
46
+ const path = line.slice(tab + 1).trim();
47
+ if (path === root)
48
+ continue;
49
+ entries.push({ size, path, isDir: !/\.\w+$/.test(path) });
50
+ }
51
+ return { type: 'dir', entries };
52
+ }
53
+ return null;
54
+ }
55
+ //# sourceMappingURL=memory-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-helpers.js","sourceRoot":"","sources":["../../../../src/core/turns/tools/memory-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,CAAC,MAAM,YAAY,GAA2B;IAClD,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,MAAM;IACnB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACjB,CAAC;AAEF,MAAM,UAAU,aAAa,CAAC,CAAU;IACt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K,EAAE,EAAE,CAAC,CAAC;QAC3C,MAAM,OAAO,GAAqB,EAAE,CAAC;QACrC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YACpC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;gBAAE,SAAS;YAC3B,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC/B,IAAI,GAAG,KAAK,CAAC,CAAC;gBAAE,SAAS;YACzB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;YACvC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YACxC,IAAI,IAAI,KAAK,IAAI;gBAAE,SAAS;YAC5B,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IAClC,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * What a patch DID, in words a non-developer already knows.
3
+ *
4
+ * The row used to read `Apply Patch 4 files +4` under a code-file glyph. Every
5
+ * part of that is wrong for the person reading it: "apply patch" is version
6
+ * control jargon that names the MECHANISM rather than the outcome, and the
7
+ * mechanism is the one thing the reader neither chose nor cares about. Four new
8
+ * `.txt` files had been created; the row said none of that.
9
+ *
10
+ * So the label is derived from what the patch actually contains. `apply_patch`
11
+ * can create, edit, delete and rename in one call, and each of those is an
12
+ * ordinary English verb:
13
+ *
14
+ * all add → Wrote
15
+ * all delete → Deleted
16
+ * all move → Renamed
17
+ * all update → Edited
18
+ * mixed → Changed
19
+ *
20
+ * `add` reports as `Wrote`, not `Created`. Producing a file that was not there
21
+ * is a write, and that is the word the reader has already met on every `write`
22
+ * row in the session — `Created 4 files` here beside `Wrote app.py` there is one
23
+ * product speaking two vocabularies about one act. `narration.ts` settled this
24
+ * the same way. The `create` GLYPH stays (`FilePlusIcon`): the mark still says
25
+ * these files are new, which is the part the verb no longer has to carry.
26
+ *
27
+ * "Changed" for a mixed patch is deliberately the weakest word here. A patch
28
+ * that creates one file and deletes another has no honest single verb, and
29
+ * inventing one ("Updated 2 files") would claim a shape the patch does not have.
30
+ * The per-file rows below already say which is which.
31
+ *
32
+ * No React import: this is a pure function, and it is unit-tested as one.
33
+ */
34
+ import { type FileVerb } from './file-verb.js';
35
+ export type PatchOp = 'add' | 'update' | 'delete' | 'move';
36
+ export interface PatchVerb extends FileVerb {
37
+ /**
38
+ * Which glyph the row leads with. `FileCode` was wrong twice over — it says
39
+ * "code" about files that are usually not code, and it says nothing about the
40
+ * operation, which is the only thing this row is reporting.
41
+ */
42
+ icon: 'create' | 'delete' | 'edit';
43
+ }
44
+ /**
45
+ * The one verb that covers every file in the patch.
46
+ *
47
+ * An empty patch — the call is still streaming and no file list has arrived —
48
+ * gets the neutral `Changed`/`Changing` rather than a guess. A file whose `type`
49
+ * the backend did not send counts as an edit, which is what the per-file row
50
+ * already falls back to (`PATCH_TYPE_STYLE.update`), so the two agree.
51
+ */
52
+ export declare function patchVerb(types: ReadonlyArray<string | undefined>): PatchVerb;
53
+ //# sourceMappingURL=patch-summary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patch-summary.d.ts","sourceRoot":"","sources":["../../../../src/core/turns/tools/patch-summary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE3D,MAAM,WAAW,SAAU,SAAQ,QAAQ;IACzC;;;;OAIG;IACH,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;CACpC;AAmBD;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,CAQ7E"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * What a patch DID, in words a non-developer already knows.
3
+ *
4
+ * The row used to read `Apply Patch 4 files +4` under a code-file glyph. Every
5
+ * part of that is wrong for the person reading it: "apply patch" is version
6
+ * control jargon that names the MECHANISM rather than the outcome, and the
7
+ * mechanism is the one thing the reader neither chose nor cares about. Four new
8
+ * `.txt` files had been created; the row said none of that.
9
+ *
10
+ * So the label is derived from what the patch actually contains. `apply_patch`
11
+ * can create, edit, delete and rename in one call, and each of those is an
12
+ * ordinary English verb:
13
+ *
14
+ * all add → Wrote
15
+ * all delete → Deleted
16
+ * all move → Renamed
17
+ * all update → Edited
18
+ * mixed → Changed
19
+ *
20
+ * `add` reports as `Wrote`, not `Created`. Producing a file that was not there
21
+ * is a write, and that is the word the reader has already met on every `write`
22
+ * row in the session — `Created 4 files` here beside `Wrote app.py` there is one
23
+ * product speaking two vocabularies about one act. `narration.ts` settled this
24
+ * the same way. The `create` GLYPH stays (`FilePlusIcon`): the mark still says
25
+ * these files are new, which is the part the verb no longer has to carry.
26
+ *
27
+ * "Changed" for a mixed patch is deliberately the weakest word here. A patch
28
+ * that creates one file and deletes another has no honest single verb, and
29
+ * inventing one ("Updated 2 files") would claim a shape the patch does not have.
30
+ * The per-file rows below already say which is which.
31
+ *
32
+ * No React import: this is a pure function, and it is unit-tested as one.
33
+ */
34
+ import { FILE_VERBS } from './file-verb.js';
35
+ /**
36
+ * The words come from `file-verb.ts`, the table every file row shares; only the
37
+ * glyph is this module's own. A patch that adds a file and a `write` that adds a
38
+ * file did the same thing to the user's disk, so they must not reach for two
39
+ * different words for it — and before this they each owned a private copy of the
40
+ * vocabulary that could drift apart one edit at a time.
41
+ */
42
+ const VERBS = {
43
+ // `write`, not a `create` of its own — see the note above the op table.
44
+ add: { ...FILE_VERBS.write, icon: 'create' },
45
+ delete: { ...FILE_VERBS.delete, icon: 'delete' },
46
+ move: { ...FILE_VERBS.rename, icon: 'edit' },
47
+ update: { ...FILE_VERBS.edit, icon: 'edit' },
48
+ };
49
+ const MIXED = { ...FILE_VERBS.change, icon: 'edit' };
50
+ /**
51
+ * The one verb that covers every file in the patch.
52
+ *
53
+ * An empty patch — the call is still streaming and no file list has arrived —
54
+ * gets the neutral `Changed`/`Changing` rather than a guess. A file whose `type`
55
+ * the backend did not send counts as an edit, which is what the per-file row
56
+ * already falls back to (`PATCH_TYPE_STYLE.update`), so the two agree.
57
+ */
58
+ export function patchVerb(types) {
59
+ if (types.length === 0)
60
+ return MIXED;
61
+ const first = normalizeOp(types[0]);
62
+ for (let i = 1; i < types.length; i++) {
63
+ if (normalizeOp(types[i]) !== first)
64
+ return MIXED;
65
+ }
66
+ return VERBS[first];
67
+ }
68
+ function normalizeOp(type) {
69
+ return type === 'add' || type === 'delete' || type === 'move' ? type : 'update';
70
+ }
71
+ //# sourceMappingURL=patch-summary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patch-summary.js","sourceRoot":"","sources":["../../../../src/core/turns/tools/patch-summary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,UAAU,EAAiB,MAAM,aAAa,CAAC;AAaxD;;;;;;GAMG;AACH,MAAM,KAAK,GAA+B;IACxC,wEAAwE;IACxE,GAAG,EAAE,EAAE,GAAG,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC5C,MAAM,EAAE,EAAE,GAAG,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;IAChD,IAAI,EAAE,EAAE,GAAG,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;IAC5C,MAAM,EAAE,EAAE,GAAG,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE;CAC7C,CAAC;AAEF,MAAM,KAAK,GAAc,EAAE,GAAG,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAEhE;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAC,KAAwC;IAChE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAErC,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK;YAAE,OAAO,KAAK,CAAC;IACpD,CAAC;IACD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC;AAED,SAAS,WAAW,CAAC,IAAwB;IAC3C,OAAO,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;AAClF,CAAC"}
@@ -0,0 +1,16 @@
1
+ export interface PresentationOutput {
2
+ success: boolean;
3
+ action: string;
4
+ error?: string;
5
+ presentation_name?: string;
6
+ presentation_path?: string;
7
+ slide_number?: number;
8
+ slide_title?: string;
9
+ slide_file?: string;
10
+ total_slides?: number;
11
+ viewer_url?: string;
12
+ viewer_file?: string;
13
+ message?: string;
14
+ }
15
+ export declare function parsePresentationOutput(output: string): PresentationOutput | null;
16
+ //# sourceMappingURL=presentation-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation-helpers.d.ts","sourceRoot":"","sources":["../../../../src/core/turns/tools/presentation-helpers.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI,CAcjF"}
@@ -0,0 +1,18 @@
1
+ export function parsePresentationOutput(output) {
2
+ if (!output)
3
+ return null;
4
+ try {
5
+ return JSON.parse(output);
6
+ }
7
+ catch {
8
+ if (output.startsWith('Error:')) {
9
+ return {
10
+ success: false,
11
+ action: 'unknown',
12
+ error: output.replace(/^Error:\s*/, ''),
13
+ };
14
+ }
15
+ return null;
16
+ }
17
+ }
18
+ //# sourceMappingURL=presentation-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation-helpers.js","sourceRoot":"","sources":["../../../../src/core/turns/tools/presentation-helpers.ts"],"names":[],"mappings":"AAeA,MAAM,UAAU,uBAAuB,CAAC,MAAc;IACpD,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAuB,CAAC;IAClD,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAChC,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,MAAM,EAAE,SAAS;gBACjB,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;aACxC,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ export interface ParsedQuestion {
2
+ question: string;
3
+ header?: string;
4
+ options: {
5
+ label: string;
6
+ description?: string;
7
+ }[];
8
+ }
9
+ export declare function parseQuestionAnswersFromOutput(output: string, count: number): string[][] | null;
10
+ //# sourceMappingURL=question-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"question-helpers.d.ts","sourceRoot":"","sources":["../../../../src/core/turns/tools/question-helpers.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACpD;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,GAAG,IAAI,CAU/F"}
@@ -0,0 +1,13 @@
1
+ export function parseQuestionAnswersFromOutput(output, count) {
2
+ if (!output)
3
+ return null;
4
+ const pairRegex = /"([^"]*)"="([^"]*)"/g;
5
+ const found = [];
6
+ let m;
7
+ while ((m = pairRegex.exec(output)) !== null)
8
+ found.push(m[2]);
9
+ if (found.length === 0)
10
+ return null;
11
+ return Array.from({ length: Math.max(count, found.length) }, (_, i) => found[i] ? [found[i]] : []);
12
+ }
13
+ //# sourceMappingURL=question-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"question-helpers.js","sourceRoot":"","sources":["../../../../src/core/turns/tools/question-helpers.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,8BAA8B,CAAC,MAAc,EAAE,KAAa;IAC1E,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,MAAM,SAAS,GAAG,sBAAsB,CAAC;IACzC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,CAAyB,CAAC;IAC9B,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI;QAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACpC,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACpE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAC3B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ export interface ParsedReadOutput {
2
+ path?: string;
3
+ type?: 'file' | 'directory';
4
+ content?: string;
5
+ entries?: string[];
6
+ }
7
+ export declare function parseReadOutput(output: string): ParsedReadOutput | null;
8
+ //# sourceMappingURL=read-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-helpers.d.ts","sourceRoot":"","sources":["../../../../src/core/turns/tools/read-helpers.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAwBvE"}
@@ -0,0 +1,25 @@
1
+ import { tagBodyTrimNewline, textBetween } from '../text-scan.js';
2
+ export function parseReadOutput(output) {
3
+ if (!output)
4
+ return null;
5
+ const pathText = textBetween(output, '<path>', '</path>');
6
+ const path = pathText !== null ? pathText.trim() : undefined;
7
+ const contentText = tagBodyTrimNewline(output, 'content');
8
+ if (contentText !== null) {
9
+ const content = contentText
10
+ .split('\n')
11
+ .map((l) => l.replace(/^\s*\d+:\s?/, ''))
12
+ .join('\n');
13
+ return { path, type: 'file', content };
14
+ }
15
+ const entriesText = tagBodyTrimNewline(output, 'entries');
16
+ if (entriesText !== null) {
17
+ const entries = entriesText
18
+ .split('\n')
19
+ .map((l) => l.trim())
20
+ .filter((l) => l && !/^\(\d+\s+entr/i.test(l));
21
+ return { path, type: 'directory', entries };
22
+ }
23
+ return null;
24
+ }
25
+ //# sourceMappingURL=read-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-helpers.js","sourceRoot":"","sources":["../../../../src/core/turns/tools/read-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAS/D,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC1D,MAAM,IAAI,GAAG,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAE7D,MAAM,WAAW,GAAG,kBAAkB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC1D,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,WAAW;aACxB,KAAK,CAAC,IAAI,CAAC;aACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;aACxC,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IACzC,CAAC;IAED,MAAM,WAAW,GAAG,kBAAkB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC1D,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,WAAW;aACxB,KAAK,CAAC,IAAI,CAAC;aACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;aACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACjD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;IAC9C,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * A search query → the words a reader sees.
3
+ *
4
+ * Models write queries in engine syntax: `site:daytona.io Daytona sandboxes`,
5
+ * `filetype:pdf annual report`, `pricing -site:pinterest.com`. That syntax is
6
+ * an instruction to a search engine, not a description of what was looked for —
7
+ * and every row that renders a query renders it to someone who never typed it.
8
+ * `site:daytona.io Daytona sandboxes` on an activity row reads as a bug.
9
+ *
10
+ * So operators are read, then removed. `site:` survives as English — it is the
11
+ * one operator naming part of the SUBJECT ("on daytona.io") rather than the
12
+ * machinery. The rest carry nothing a reader can act on: `filetype:pdf` does not
13
+ * change what was searched for, it changes what the engine was allowed to
14
+ * return.
15
+ *
16
+ * Two rules keep this from eating real text:
17
+ *
18
+ * 1. Operators are an ALLOWLIST, never a `\w+:` pattern. A query holding
19
+ * `https://example.com` matches `https:` under a pattern and loses the URL
20
+ * it was about — the exact class of bug this module exists to fix.
21
+ * 2. The result is never empty. A query that is nothing but operators falls
22
+ * back to the sites it scoped to, and failing that to the original text.
23
+ * An empty row hides more than an ugly one.
24
+ *
25
+ * No React import — every rule here is unit-tested.
26
+ */
27
+ export declare function humanizeSearchQuery(query: string | undefined | null): string;
28
+ //# sourceMappingURL=search-query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-query.d.ts","sourceRoot":"","sources":["../../../../src/core/turns/tools/search-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAoFH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAuC5E"}
@@ -0,0 +1,137 @@
1
+ /**
2
+ * A search query → the words a reader sees.
3
+ *
4
+ * Models write queries in engine syntax: `site:daytona.io Daytona sandboxes`,
5
+ * `filetype:pdf annual report`, `pricing -site:pinterest.com`. That syntax is
6
+ * an instruction to a search engine, not a description of what was looked for —
7
+ * and every row that renders a query renders it to someone who never typed it.
8
+ * `site:daytona.io Daytona sandboxes` on an activity row reads as a bug.
9
+ *
10
+ * So operators are read, then removed. `site:` survives as English — it is the
11
+ * one operator naming part of the SUBJECT ("on daytona.io") rather than the
12
+ * machinery. The rest carry nothing a reader can act on: `filetype:pdf` does not
13
+ * change what was searched for, it changes what the engine was allowed to
14
+ * return.
15
+ *
16
+ * Two rules keep this from eating real text:
17
+ *
18
+ * 1. Operators are an ALLOWLIST, never a `\w+:` pattern. A query holding
19
+ * `https://example.com` matches `https:` under a pattern and loses the URL
20
+ * it was about — the exact class of bug this module exists to fix.
21
+ * 2. The result is never empty. A query that is nothing but operators falls
22
+ * back to the sites it scoped to, and failing that to the original text.
23
+ * An empty row hides more than an ugly one.
24
+ *
25
+ * No React import — every rule here is unit-tested.
26
+ */
27
+ /**
28
+ * Operators recognised by the major engines. `site` is handled separately (see
29
+ * the module comment); the rest are stripped outright.
30
+ *
31
+ * Anything not on this list is left alone, which is the point: an unknown
32
+ * `foo:bar` is far more likely to be real text than a search operator.
33
+ */
34
+ const OPERATORS = [
35
+ 'site',
36
+ 'filetype',
37
+ 'ext',
38
+ 'inurl',
39
+ 'allinurl',
40
+ 'intitle',
41
+ 'allintitle',
42
+ 'intext',
43
+ 'allintext',
44
+ 'inanchor',
45
+ 'inbody',
46
+ 'before',
47
+ 'after',
48
+ 'daterange',
49
+ 'related',
50
+ 'cache',
51
+ 'define',
52
+ 'link',
53
+ 'source',
54
+ 'lang',
55
+ 'loc',
56
+ 'location',
57
+ 'imagesize',
58
+ ];
59
+ /**
60
+ * `name:value`, with the value optionally quoted so `intitle:"annual report"`
61
+ * is consumed whole rather than leaving `report"` behind. A leading `-` or `+`
62
+ * is captured, not skipped: the sign is what separates "search this site" from
63
+ * "search everything except this site".
64
+ *
65
+ * Built fresh per call rather than hoisted — a module-level `/g` regex carries
66
+ * `lastIndex` between calls, so a shared one would start mid-string on every
67
+ * second query and silently leave operators in.
68
+ */
69
+ function operatorPattern() {
70
+ return new RegExp(`(^|\\s)([-+]?)(${OPERATORS.join('|')}):("[^"]*"|\\S+)`, 'gi');
71
+ }
72
+ /** A term the query explicitly excluded, e.g. `-pinterest` or `-"stock photo"`. */
73
+ function negatedTermPattern() {
74
+ return /(^|\s)-(?:"[^"]*"|\S+)/g;
75
+ }
76
+ /** Bare boolean glue. Uppercase only — "or" mid-sentence is a word. */
77
+ function booleanPattern() {
78
+ return /(^|\s)(?:OR|AND)(?=\s|$)/g;
79
+ }
80
+ function stripQuotes(value) {
81
+ return value.startsWith('"') && value.endsWith('"') ? value.slice(1, -1) : value;
82
+ }
83
+ /**
84
+ * A `site:` value → the host a reader recognises.
85
+ *
86
+ * Models write the scope inconsistently — `site:daytona.io`,
87
+ * `site:https://daytona.io`, `site:www.daytona.io/docs`. All three mean the
88
+ * same site, and all three should read the same way on the row.
89
+ */
90
+ function hostOf(value) {
91
+ return stripQuotes(value)
92
+ .replace(/^[a-z]+:\/\//i, '')
93
+ .replace(/^www\./i, '')
94
+ .replace(/\/.*$/, '')
95
+ .trim();
96
+ }
97
+ /** `[a]` → `a`; `[a, b]` → `a or b`; `[a, b, c]` → `a, b or c`. */
98
+ function listPhrase(items) {
99
+ if (items.length <= 1)
100
+ return items[0] ?? '';
101
+ return `${items.slice(0, -1).join(', ')} or ${items[items.length - 1]}`;
102
+ }
103
+ export function humanizeSearchQuery(query) {
104
+ const raw = typeof query === 'string' ? query.trim() : '';
105
+ if (!raw)
106
+ return '';
107
+ const scopes = [];
108
+ let rest = raw.replace(operatorPattern(), (_match, lead, sign, name, value) => {
109
+ // A negated scope (`-site:pinterest.com`) narrows by exclusion. The row has
110
+ // no room to explain "everything except", and a bare "on pinterest.com"
111
+ // would state the opposite of what actually ran — so it is dropped, not
112
+ // reworded.
113
+ if (!sign && name.toLowerCase() === 'site') {
114
+ const host = hostOf(value);
115
+ if (host && !scopes.includes(host))
116
+ scopes.push(host);
117
+ }
118
+ // Return the separator, not '': without it `a site:x b` fuses into `a b`
119
+ // with no space, and consecutive operators run their neighbours together.
120
+ return lead;
121
+ });
122
+ rest = rest
123
+ .replace(negatedTermPattern(), '$1')
124
+ .replace(booleanPattern(), '$1')
125
+ // Grouping parens are engine syntax too, and removing their contents'
126
+ // operators routinely leaves them empty.
127
+ .replace(/[()]/g, ' ')
128
+ .replace(/\s+/g, ' ')
129
+ .trim();
130
+ if (!rest) {
131
+ // Nothing but operators. The sites are the only thing left that names what
132
+ // was looked at; with no sites either, the original beats a blank row.
133
+ return scopes.length > 0 ? listPhrase(scopes) : raw;
134
+ }
135
+ return scopes.length > 0 ? `${rest} on ${listPhrase(scopes)}` : rest;
136
+ }
137
+ //# sourceMappingURL=search-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-query.js","sourceRoot":"","sources":["../../../../src/core/turns/tools/search-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;;;GAMG;AACH,MAAM,SAAS,GAAG;IAChB,MAAM;IACN,UAAU;I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AAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACtD,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,OAAO,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACvE,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Availability gating for `show` tool cards.
3
+ *
4
+ * A `show` tool call points at an artifact — a generated file, an image, a
5
+ * rendered iframe preview, etc. Artifacts get renamed, regenerated, or deleted
6
+ * as a session progresses, so a `show` from earlier in the run can end up
7
+ * pointing at something that no longer loads (a 404'd file, an unhealthy
8
+ * preview). Rather than render a broken "File not found" card for these dead
9
+ * references, the renderer hides them entirely and only keeps the `show` cards
10
+ * whose content actually loaded.
11
+ *
12
+ * This module holds the pure decision used by `ShowTool`, kept separate so it
13
+ * can be unit-tested without rendering the (async, data-fetching) tree.
14
+ */
15
+ /** Load status reported up from a show's single-item content renderer. */
16
+ export type ShowLoadStatus = 'loading' | 'ready' | 'error';
17
+ export interface ShowAvailabilityInput {
18
+ /** The tool part is still streaming/producing — the artifact may not exist yet. */
19
+ running: boolean;
20
+ /** Multi-item carousel — manages its own per-item state, never hidden wholesale. */
21
+ isCarousel: boolean;
22
+ /** Status reported by the single-item file/media content renderer. */
23
+ contentStatus: ShowLoadStatus;
24
+ /** This show renders an embedded website/file iframe preview. */
25
+ isWebsitePreview: boolean;
26
+ /** The iframe preview failed to load (errored or timed out). */
27
+ previewHasError: boolean;
28
+ /** The preview is an intentional link-only fallback (a card, not a failure). */
29
+ previewIsLinkOnly: boolean;
30
+ }
31
+ /**
32
+ * Decide whether a single-item `show` card should be hidden because its
33
+ * underlying artifact failed to load.
34
+ *
35
+ * Rules:
36
+ * - While the tool is still running, never hide — the file may still be
37
+ * materializing, and a transient 404 shouldn't make the card flicker away.
38
+ * - Carousels are never hidden wholesale (they navigate between items).
39
+ * - A website/iframe preview is hidden only when it actually errored AND it
40
+ * isn't a deliberate link-only fallback.
41
+ * - Otherwise the card is hidden when its file/media content errored (e.g. the
42
+ * file was renamed or deleted → 404).
43
+ */
44
+ export declare function isShowContentUnavailable(input: ShowAvailabilityInput): boolean;
45
+ /**
46
+ * True when a `show` has no artifact to render — no `items`, no `path`, no
47
+ * `url`, no `content`.
48
+ *
49
+ * A carousel is empty only when NONE of its items carries an artifact; one good
50
+ * item keeps the whole carousel, since paging is how the rest are reached.
51
+ */
52
+ export declare function isShowPayloadEmpty(input: Record<string, unknown> | null | undefined): boolean;
53
+ //# sourceMappingURL=show-availability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"show-availability.d.ts","sourceRoot":"","sources":["../../../../src/core/turns/tools/show-availability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,0EAA0E;AAC1E,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAE3D,MAAM,WAAW,qBAAqB;IACpC,mFAAmF;IACnF,OAAO,EAAE,OAAO,CAAC;IACjB,oFAAoF;IACpF,UAAU,EAAE,OAAO,CAAC;IACpB,sEAAsE;IACtE,aAAa,EAAE,cAAc,CAAC;IAC9B,iEAAiE;IACjE,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gEAAgE;IAChE,eAAe,EAAE,OAAO,CAAC;IACzB,gFAAgF;IAChF,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAa9E;AA6DD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAK7F"}