@dexto/core 1.10.0 → 1.10.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 (53) hide show
  1. package/dist/approval/schemas.cjs +2 -7
  2. package/dist/approval/schemas.d.ts +508 -5
  3. package/dist/approval/schemas.d.ts.map +1 -1
  4. package/dist/approval/schemas.js +1 -6
  5. package/dist/context/utils.cjs +28 -0
  6. package/dist/context/utils.d.ts.map +1 -1
  7. package/dist/context/utils.js +28 -0
  8. package/dist/index.browser.cjs +6 -0
  9. package/dist/index.browser.d.ts +4 -0
  10. package/dist/index.browser.d.ts.map +1 -1
  11. package/dist/index.browser.js +4 -0
  12. package/dist/llm/errors.d.ts +8 -8
  13. package/dist/llm/formatters/vercel.cjs +59 -24
  14. package/dist/llm/formatters/vercel.d.ts.map +1 -1
  15. package/dist/llm/formatters/vercel.js +59 -24
  16. package/dist/llm/schemas.d.ts +3 -3
  17. package/dist/llm/services/factory.cjs +7 -0
  18. package/dist/llm/services/factory.d.ts.map +1 -1
  19. package/dist/llm/services/factory.js +7 -0
  20. package/dist/session/schemas.d.ts +2 -2
  21. package/dist/storage/tool-executions/types.cjs +2 -1
  22. package/dist/storage/tool-executions/types.d.ts +254 -3
  23. package/dist/storage/tool-executions/types.d.ts.map +1 -1
  24. package/dist/storage/tool-executions/types.js +2 -1
  25. package/dist/systemPrompt/schemas.d.ts +3 -3
  26. package/dist/tools/activity.cjs +341 -0
  27. package/dist/tools/activity.d.ts +70 -0
  28. package/dist/tools/activity.d.ts.map +1 -0
  29. package/dist/tools/activity.js +318 -0
  30. package/dist/tools/display-types.cjs +34 -4
  31. package/dist/tools/display-types.d.ts.map +1 -1
  32. package/dist/tools/display-types.js +34 -4
  33. package/dist/tools/index.cjs +8 -1
  34. package/dist/tools/index.d.ts +3 -0
  35. package/dist/tools/index.d.ts.map +1 -1
  36. package/dist/tools/index.js +8 -1
  37. package/dist/tools/presentation/tool-presentation.cjs +78 -25
  38. package/dist/tools/presentation/tool-presentation.d.ts +2 -1
  39. package/dist/tools/presentation/tool-presentation.d.ts.map +1 -1
  40. package/dist/tools/presentation/tool-presentation.js +78 -25
  41. package/dist/tools/presentation-schema.cjs +118 -0
  42. package/dist/tools/presentation-schema.d.ts +132 -0
  43. package/dist/tools/presentation-schema.d.ts.map +1 -0
  44. package/dist/tools/presentation-schema.js +94 -0
  45. package/dist/tools/presentation.cjs +8 -0
  46. package/dist/tools/presentation.d.ts +4 -0
  47. package/dist/tools/presentation.d.ts.map +1 -1
  48. package/dist/tools/presentation.js +8 -0
  49. package/dist/tools/types.d.ts +12 -79
  50. package/dist/tools/types.d.ts.map +1 -1
  51. package/dist/workspace/types.d.ts +1 -0
  52. package/dist/workspace/types.d.ts.map +1 -1
  53. package/package.json +7 -2
@@ -0,0 +1,70 @@
1
+ /** Opaque grouping key owned by the tool package or host. */
2
+ export type ToolActivityCategory = string;
3
+ /**
4
+ * Tool-owned transcript copy and aggregation grammar.
5
+ *
6
+ * The semantic call description remains model-authored. This metadata provides deterministic
7
+ * lifecycle copy and lets UIs summarize first-party calls without inspecting tool ids or args.
8
+ */
9
+ export type ToolActivityPresentation = {
10
+ category: ToolActivityCategory;
11
+ label: {
12
+ running: string;
13
+ completed: string;
14
+ };
15
+ summary: {
16
+ verb: string;
17
+ singular: string;
18
+ plural: string;
19
+ };
20
+ };
21
+ /** Shared activity declarations for first-party tools with identical transcript semantics. */
22
+ export declare const TOOL_ACTIVITY: {
23
+ readonly runCommand: ToolActivityPresentation;
24
+ readonly checkCommandOutput: ToolActivityPresentation;
25
+ readonly stopProcess: ToolActivityPresentation;
26
+ readonly readFile: ToolActivityPresentation;
27
+ readonly writeFile: ToolActivityPresentation;
28
+ readonly createFile: ToolActivityPresentation;
29
+ readonly editFile: ToolActivityPresentation;
30
+ readonly searchFiles: ToolActivityPresentation;
31
+ readonly searchWeb: ToolActivityPresentation;
32
+ readonly searchCode: ToolActivityPresentation;
33
+ readonly useSkill: ToolActivityPresentation;
34
+ readonly readSkill: ToolActivityPresentation;
35
+ readonly createSkill: ToolActivityPresentation;
36
+ readonly updateSkill: ToolActivityPresentation;
37
+ readonly refreshSkill: ToolActivityPresentation;
38
+ readonly searchSkills: ToolActivityPresentation;
39
+ readonly readResource: ToolActivityPresentation;
40
+ readonly listResources: ToolActivityPresentation;
41
+ readonly requestHttp: ToolActivityPresentation;
42
+ readonly delegate: ToolActivityPresentation;
43
+ readonly runAgent: ToolActivityPresentation;
44
+ readonly checkTask: ToolActivityPresentation;
45
+ readonly listTasks: ToolActivityPresentation;
46
+ readonly updateTasks: ToolActivityPresentation;
47
+ readonly createPlan: ToolActivityPresentation;
48
+ readonly readPlan: ToolActivityPresentation;
49
+ readonly reviewPlan: ToolActivityPresentation;
50
+ readonly updatePlan: ToolActivityPresentation;
51
+ readonly listMemories: ToolActivityPresentation;
52
+ readonly readMemory: ToolActivityPresentation;
53
+ readonly createMemory: ToolActivityPresentation;
54
+ readonly updateMemory: ToolActivityPresentation;
55
+ readonly deleteMemory: ToolActivityPresentation;
56
+ readonly searchHistory: ToolActivityPresentation;
57
+ readonly listSchedules: ToolActivityPresentation;
58
+ readonly readSchedule: ToolActivityPresentation;
59
+ readonly readScheduleHistory: ToolActivityPresentation;
60
+ readonly createSchedule: ToolActivityPresentation;
61
+ readonly updateSchedule: ToolActivityPresentation;
62
+ readonly deleteSchedule: ToolActivityPresentation;
63
+ readonly triggerSchedule: ToolActivityPresentation;
64
+ readonly inspectLogs: ToolActivityPresentation;
65
+ readonly wait: ToolActivityPresentation;
66
+ readonly pause: ToolActivityPresentation;
67
+ readonly askUser: ToolActivityPresentation;
68
+ readonly discoverTools: ToolActivityPresentation;
69
+ };
70
+ //# sourceMappingURL=activity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../src/tools/activity.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACnC,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,KAAK,EAAE;QACH,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,OAAO,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;KAClB,CAAC;CACL,CAAC;AAiBF,8FAA8F;AAC9F,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkTmC,CAAC"}
@@ -0,0 +1,318 @@
1
+ import "../chunk-C6A6W6XS.js";
2
+ function activity(category, running, completed, verb, singular, plural) {
3
+ return {
4
+ category,
5
+ label: { running, completed },
6
+ summary: { verb, singular, plural }
7
+ };
8
+ }
9
+ const TOOL_ACTIVITY = {
10
+ runCommand: activity(
11
+ "command",
12
+ "Running command",
13
+ "Ran command",
14
+ "Ran",
15
+ "a command",
16
+ "commands"
17
+ ),
18
+ checkCommandOutput: activity(
19
+ "command-output",
20
+ "Checking command output",
21
+ "Checked command output",
22
+ "Checked",
23
+ "command output",
24
+ "command outputs"
25
+ ),
26
+ stopProcess: activity(
27
+ "process",
28
+ "Stopping process",
29
+ "Stopped process",
30
+ "Stopped",
31
+ "a process",
32
+ "processes"
33
+ ),
34
+ readFile: activity("file-read", "Reading file", "Read file", "Read", "a file", "files"),
35
+ writeFile: activity("file-write", "Writing file", "Wrote file", "Wrote", "a file", "files"),
36
+ createFile: activity(
37
+ "file-create",
38
+ "Creating file",
39
+ "Created file",
40
+ "Created",
41
+ "a file",
42
+ "files"
43
+ ),
44
+ editFile: activity("file-edit", "Editing file", "Edited file", "Edited", "a file", "files"),
45
+ searchFiles: activity(
46
+ "file-search",
47
+ "Searching files",
48
+ "Searched files",
49
+ "Ran",
50
+ "a file search",
51
+ "file searches"
52
+ ),
53
+ searchWeb: activity(
54
+ "web-search",
55
+ "Searching the web",
56
+ "Searched the web",
57
+ "Ran",
58
+ "a web search",
59
+ "web searches"
60
+ ),
61
+ searchCode: activity(
62
+ "code-search",
63
+ "Searching code",
64
+ "Searched code",
65
+ "Ran",
66
+ "a code search",
67
+ "code searches"
68
+ ),
69
+ useSkill: activity("skill", "Using skill", "Used skill", "Used", "a skill", "skills"),
70
+ readSkill: activity("skill-read", "Reading skill", "Read skill", "Read", "a skill", "skills"),
71
+ createSkill: activity(
72
+ "skill-create",
73
+ "Creating skill",
74
+ "Created skill",
75
+ "Created",
76
+ "a skill",
77
+ "skills"
78
+ ),
79
+ updateSkill: activity(
80
+ "skill-update",
81
+ "Updating skill",
82
+ "Updated skill",
83
+ "Updated",
84
+ "a skill",
85
+ "skills"
86
+ ),
87
+ refreshSkill: activity(
88
+ "skill-refresh",
89
+ "Refreshing skill",
90
+ "Refreshed skill",
91
+ "Refreshed",
92
+ "a skill",
93
+ "skills"
94
+ ),
95
+ searchSkills: activity(
96
+ "skill-search",
97
+ "Searching skills",
98
+ "Searched skills",
99
+ "Ran",
100
+ "a skill search",
101
+ "skill searches"
102
+ ),
103
+ readResource: activity(
104
+ "resource",
105
+ "Reading resource",
106
+ "Read resource",
107
+ "Read",
108
+ "a resource",
109
+ "resources"
110
+ ),
111
+ listResources: activity(
112
+ "resource-list",
113
+ "Listing resources",
114
+ "Listed resources",
115
+ "Listed",
116
+ "a resource catalog",
117
+ "resource catalogs"
118
+ ),
119
+ requestHttp: activity(
120
+ "http-request",
121
+ "Sending request",
122
+ "Sent request",
123
+ "Sent",
124
+ "a request",
125
+ "requests"
126
+ ),
127
+ delegate: activity(
128
+ "delegation",
129
+ "Delegating task",
130
+ "Delegated task",
131
+ "Delegated",
132
+ "a task",
133
+ "tasks"
134
+ ),
135
+ runAgent: activity("agent", "Running agent", "Ran agent", "Ran", "an agent", "agents"),
136
+ checkTask: activity(
137
+ "task-check",
138
+ "Checking task",
139
+ "Checked task",
140
+ "Checked",
141
+ "a task",
142
+ "tasks"
143
+ ),
144
+ listTasks: activity(
145
+ "task-list",
146
+ "Listing tasks",
147
+ "Listed tasks",
148
+ "Listed",
149
+ "a task collection",
150
+ "task collections"
151
+ ),
152
+ updateTasks: activity(
153
+ "task",
154
+ "Updating tasks",
155
+ "Updated tasks",
156
+ "Updated",
157
+ "a task list",
158
+ "task lists"
159
+ ),
160
+ createPlan: activity(
161
+ "plan-create",
162
+ "Creating plan",
163
+ "Created plan",
164
+ "Created",
165
+ "a plan",
166
+ "plans"
167
+ ),
168
+ readPlan: activity("plan-read", "Reading plan", "Read plan", "Read", "a plan", "plans"),
169
+ reviewPlan: activity(
170
+ "plan-review",
171
+ "Reviewing plan",
172
+ "Reviewed plan",
173
+ "Reviewed",
174
+ "a plan",
175
+ "plans"
176
+ ),
177
+ updatePlan: activity(
178
+ "plan-update",
179
+ "Updating plan",
180
+ "Updated plan",
181
+ "Updated",
182
+ "a plan",
183
+ "plans"
184
+ ),
185
+ listMemories: activity(
186
+ "memory-list",
187
+ "Listing memories",
188
+ "Listed memories",
189
+ "Listed",
190
+ "a memory collection",
191
+ "memory collections"
192
+ ),
193
+ readMemory: activity(
194
+ "memory-read",
195
+ "Reading memory",
196
+ "Read memory",
197
+ "Read",
198
+ "a memory",
199
+ "memories"
200
+ ),
201
+ createMemory: activity(
202
+ "memory-create",
203
+ "Creating memory",
204
+ "Created memory",
205
+ "Created",
206
+ "a memory",
207
+ "memories"
208
+ ),
209
+ updateMemory: activity(
210
+ "memory-update",
211
+ "Updating memory",
212
+ "Updated memory",
213
+ "Updated",
214
+ "a memory",
215
+ "memories"
216
+ ),
217
+ deleteMemory: activity(
218
+ "memory-delete",
219
+ "Deleting memory",
220
+ "Deleted memory",
221
+ "Deleted",
222
+ "a memory",
223
+ "memories"
224
+ ),
225
+ searchHistory: activity(
226
+ "history-search",
227
+ "Searching history",
228
+ "Searched history",
229
+ "Ran",
230
+ "a history search",
231
+ "history searches"
232
+ ),
233
+ listSchedules: activity(
234
+ "schedule-list",
235
+ "Listing schedules",
236
+ "Listed schedules",
237
+ "Listed",
238
+ "a schedule collection",
239
+ "schedule collections"
240
+ ),
241
+ readSchedule: activity(
242
+ "schedule-read",
243
+ "Reading schedule",
244
+ "Read schedule",
245
+ "Read",
246
+ "a schedule",
247
+ "schedules"
248
+ ),
249
+ readScheduleHistory: activity(
250
+ "schedule-history",
251
+ "Reading schedule history",
252
+ "Read schedule history",
253
+ "Read",
254
+ "a schedule history",
255
+ "schedule histories"
256
+ ),
257
+ createSchedule: activity(
258
+ "schedule-create",
259
+ "Creating schedule",
260
+ "Created schedule",
261
+ "Created",
262
+ "a schedule",
263
+ "schedules"
264
+ ),
265
+ updateSchedule: activity(
266
+ "schedule-update",
267
+ "Updating schedule",
268
+ "Updated schedule",
269
+ "Updated",
270
+ "a schedule",
271
+ "schedules"
272
+ ),
273
+ deleteSchedule: activity(
274
+ "schedule-delete",
275
+ "Deleting schedule",
276
+ "Deleted schedule",
277
+ "Deleted",
278
+ "a schedule",
279
+ "schedules"
280
+ ),
281
+ triggerSchedule: activity(
282
+ "schedule-trigger",
283
+ "Running schedule",
284
+ "Ran schedule",
285
+ "Ran",
286
+ "a schedule",
287
+ "schedules"
288
+ ),
289
+ inspectLogs: activity(
290
+ "logs",
291
+ "Inspecting logs",
292
+ "Inspected logs",
293
+ "Inspected",
294
+ "a log set",
295
+ "log sets"
296
+ ),
297
+ wait: activity("wait", "Waiting", "Waited", "Waited for", "an event", "events"),
298
+ pause: activity("pause", "Waiting", "Waited", "Waited for", "a period", "periods"),
299
+ askUser: activity(
300
+ "user-input",
301
+ "Waiting for input",
302
+ "Received input",
303
+ "Requested",
304
+ "user input",
305
+ "user inputs"
306
+ ),
307
+ discoverTools: activity(
308
+ "tool-discovery",
309
+ "Finding tools",
310
+ "Found tools",
311
+ "Ran",
312
+ "a tool search",
313
+ "tool searches"
314
+ )
315
+ };
316
+ export {
317
+ TOOL_ACTIVITY
318
+ };
@@ -41,13 +41,43 @@ function isFileDisplay(d) {
41
41
  function isGenericDisplay(d) {
42
42
  return d.type === "generic";
43
43
  }
44
- const VALID_DISPLAY_TYPES = ["diff", "shell", "search", "file", "generic"];
44
+ function isRecord(value) {
45
+ return typeof value === "object" && value !== null && !Array.isArray(value);
46
+ }
47
+ function isOptionalString(value) {
48
+ return value === void 0 || typeof value === "string";
49
+ }
50
+ function isNonNegativeInteger(value) {
51
+ return typeof value === "number" && Number.isInteger(value) && value >= 0;
52
+ }
53
+ function isOptionalNonNegativeInteger(value) {
54
+ return value === void 0 || isNonNegativeInteger(value);
55
+ }
56
+ function isSearchMatch(value) {
57
+ if (!isRecord(value)) {
58
+ return false;
59
+ }
60
+ const context = value["context"];
61
+ return typeof value["file"] === "string" && isNonNegativeInteger(value["line"]) && typeof value["content"] === "string" && (context === void 0 || Array.isArray(context) && context.every((line) => typeof line === "string"));
62
+ }
45
63
  function isValidDisplayData(d) {
46
- if (d === null || typeof d !== "object") {
64
+ if (!isRecord(d)) {
47
65
  return false;
48
66
  }
49
- const obj = d;
50
- return typeof obj.type === "string" && VALID_DISPLAY_TYPES.includes(obj.type);
67
+ switch (d["type"]) {
68
+ case "diff":
69
+ return typeof d["unified"] === "string" && typeof d["filename"] === "string" && isNonNegativeInteger(d["additions"]) && isNonNegativeInteger(d["deletions"]) && isOptionalString(d["title"]) && isOptionalString(d["beforeContent"]) && isOptionalString(d["afterContent"]);
70
+ case "shell":
71
+ return typeof d["command"] === "string" && typeof d["exitCode"] === "number" && Number.isFinite(d["exitCode"]) && typeof d["duration"] === "number" && Number.isFinite(d["duration"]) && isOptionalString(d["title"]) && (d["isBackground"] === void 0 || typeof d["isBackground"] === "boolean") && isOptionalString(d["stdout"]) && isOptionalString(d["stderr"]);
72
+ case "search":
73
+ return typeof d["pattern"] === "string" && Array.isArray(d["matches"]) && d["matches"].every(isSearchMatch) && isNonNegativeInteger(d["totalMatches"]) && typeof d["truncated"] === "boolean" && isOptionalString(d["title"]);
74
+ case "file":
75
+ return typeof d["path"] === "string" && (d["operation"] === "read" || d["operation"] === "write" || d["operation"] === "create" || d["operation"] === "delete") && isOptionalString(d["title"]) && isOptionalNonNegativeInteger(d["size"]) && isOptionalNonNegativeInteger(d["lineCount"]) && isOptionalString(d["backupPath"]) && isOptionalString(d["content"]);
76
+ case "generic":
77
+ return isOptionalString(d["title"]);
78
+ default:
79
+ return false;
80
+ }
51
81
  }
52
82
  // Annotate the CommonJS export names for ESM import in node:
53
83
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"file":"display-types.d.ts","sourceRoot":"","sources":["../../src/tools/display-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH;;;GAGG;AACH,MAAM,MAAM,eAAe,GACrB,eAAe,GACf,gBAAgB,GAChB,iBAAiB,GACjB,eAAe,GACf,kBAAkB,CAAC;AAEzB;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,OAAO,CA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MD;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,IAAI,eAAe,CAEtE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,IAAI,gBAAgB,CAExE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,IAAI,iBAAiB,CAE1E;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,IAAI,eAAe,CAEtE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,IAAI,kBAAkB,CAE5E;AASD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,eAAe,CASnE"}
1
+ {"version":3,"file":"display-types.d.ts","sourceRoot":"","sources":["../../src/tools/display-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH;;;GAGG;AACH,MAAM,MAAM,eAAe,GACrB,eAAe,GACf,gBAAgB,GAChB,iBAAiB,GACjB,eAAe,GACf,kBAAkB,CAAC;AAEzB;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,wDAAwD;IACxD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UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,SAAS,CAAC;IAChB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAMD;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,IAAI,eAAe,CAEtE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,IAAI,gBAAgB,CAExE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,IAAI,iBAAiB,CAE1E;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,IAAI,eAAe,CAEtE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,IAAI,kBAAkB,CAE5E;AAqCD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,eAAe,CAuDnE"}
@@ -14,13 +14,43 @@ function isFileDisplay(d) {
14
14
  function isGenericDisplay(d) {
15
15
  return d.type === "generic";
16
16
  }
17
- const VALID_DISPLAY_TYPES = ["diff", "shell", "search", "file", "generic"];
17
+ function isRecord(value) {
18
+ return typeof value === "object" && value !== null && !Array.isArray(value);
19
+ }
20
+ function isOptionalString(value) {
21
+ return value === void 0 || typeof value === "string";
22
+ }
23
+ function isNonNegativeInteger(value) {
24
+ return typeof value === "number" && Number.isInteger(value) && value >= 0;
25
+ }
26
+ function isOptionalNonNegativeInteger(value) {
27
+ return value === void 0 || isNonNegativeInteger(value);
28
+ }
29
+ function isSearchMatch(value) {
30
+ if (!isRecord(value)) {
31
+ return false;
32
+ }
33
+ const context = value["context"];
34
+ return typeof value["file"] === "string" && isNonNegativeInteger(value["line"]) && typeof value["content"] === "string" && (context === void 0 || Array.isArray(context) && context.every((line) => typeof line === "string"));
35
+ }
18
36
  function isValidDisplayData(d) {
19
- if (d === null || typeof d !== "object") {
37
+ if (!isRecord(d)) {
20
38
  return false;
21
39
  }
22
- const obj = d;
23
- return typeof obj.type === "string" && VALID_DISPLAY_TYPES.includes(obj.type);
40
+ switch (d["type"]) {
41
+ case "diff":
42
+ return typeof d["unified"] === "string" && typeof d["filename"] === "string" && isNonNegativeInteger(d["additions"]) && isNonNegativeInteger(d["deletions"]) && isOptionalString(d["title"]) && isOptionalString(d["beforeContent"]) && isOptionalString(d["afterContent"]);
43
+ case "shell":
44
+ return typeof d["command"] === "string" && typeof d["exitCode"] === "number" && Number.isFinite(d["exitCode"]) && typeof d["duration"] === "number" && Number.isFinite(d["duration"]) && isOptionalString(d["title"]) && (d["isBackground"] === void 0 || typeof d["isBackground"] === "boolean") && isOptionalString(d["stdout"]) && isOptionalString(d["stderr"]);
45
+ case "search":
46
+ return typeof d["pattern"] === "string" && Array.isArray(d["matches"]) && d["matches"].every(isSearchMatch) && isNonNegativeInteger(d["totalMatches"]) && typeof d["truncated"] === "boolean" && isOptionalString(d["title"]);
47
+ case "file":
48
+ return typeof d["path"] === "string" && (d["operation"] === "read" || d["operation"] === "write" || d["operation"] === "create" || d["operation"] === "delete") && isOptionalString(d["title"]) && isOptionalNonNegativeInteger(d["size"]) && isOptionalNonNegativeInteger(d["lineCount"]) && isOptionalString(d["backupPath"]) && isOptionalString(d["content"]);
49
+ case "generic":
50
+ return isOptionalString(d["title"]);
51
+ default:
52
+ return false;
53
+ }
24
54
  }
25
55
  export {
26
56
  isDiffDisplay,
@@ -24,13 +24,17 @@ __export(tools_exports, {
24
24
  ToolError: () => import_errors.ToolError,
25
25
  ToolErrorCode: () => import_error_codes.ToolErrorCode,
26
26
  ToolManager: () => import_tool_manager.ToolManager,
27
- defineTool: () => import_define_tool.defineTool
27
+ ToolPresentationSnapshotV1Schema: () => import_presentation_schema.ToolPresentationSnapshotV1Schema,
28
+ defineTool: () => import_define_tool.defineTool,
29
+ isToolPresentationSnapshotV1: () => import_presentation_schema.isToolPresentationSnapshotV1
28
30
  });
29
31
  module.exports = __toCommonJS(tools_exports);
30
32
  __reExport(tools_exports, require("./types.js"), module.exports);
31
33
  var import_define_tool = require("./define-tool.js");
32
34
  var import_session_tool_preferences_store = require("./session-tool-preferences-store.js");
33
35
  __reExport(tools_exports, require("./display-types.js"), module.exports);
36
+ __reExport(tools_exports, require("./activity.js"), module.exports);
37
+ var import_presentation_schema = require("./presentation-schema.js");
34
38
  __reExport(tools_exports, require("./schemas.js"), module.exports);
35
39
  __reExport(tools_exports, require("./presentation.js"), module.exports);
36
40
  var import_errors = require("./errors.js");
@@ -43,9 +47,12 @@ var import_tool_manager = require("./tool-manager.js");
43
47
  ToolError,
44
48
  ToolErrorCode,
45
49
  ToolManager,
50
+ ToolPresentationSnapshotV1Schema,
46
51
  defineTool,
52
+ isToolPresentationSnapshotV1,
47
53
  ...require("./types.js"),
48
54
  ...require("./display-types.js"),
55
+ ...require("./activity.js"),
49
56
  ...require("./schemas.js"),
50
57
  ...require("./presentation.js")
51
58
  });
@@ -9,6 +9,9 @@ export { defineTool } from './define-tool.js';
9
9
  export { SessionToolPreferencesSchema, SessionToolPreferencesStore, } from './session-tool-preferences-store.js';
10
10
  export type { SessionToolPreferences } from './session-tool-preferences-store.js';
11
11
  export * from './display-types.js';
12
+ export * from './activity.js';
13
+ export { isToolPresentationSnapshotV1, ToolPresentationSnapshotV1Schema, } from './presentation-schema.js';
14
+ export type { ToolPresentationSnapshotV1 } from './presentation-schema.js';
12
15
  export * from './schemas.js';
13
16
  export * from './presentation.js';
14
17
  export type { ToolCallMetadata, ToolCallMetaWrapper } from './tool-call-metadata.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,YAAY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,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EAAE,WAAW,EAAE,KAAK,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAClF,YAAY,EACR,kBAAkB,EAClB,oBAAoB,EACpB,+BAA+B,EAC/B,0BAA0B,EAC1B,gCAAgC,EAChC,gBAAgB,EAChB,oBAAoB,GACvB,MAAM,mBAAmB,CAAC"}
@@ -6,6 +6,11 @@ import {
6
6
  SessionToolPreferencesStore
7
7
  } from "./session-tool-preferences-store.js";
8
8
  export * from "./display-types.js";
9
+ export * from "./activity.js";
10
+ import {
11
+ isToolPresentationSnapshotV1,
12
+ ToolPresentationSnapshotV1Schema
13
+ } from "./presentation-schema.js";
9
14
  export * from "./schemas.js";
10
15
  export * from "./presentation.js";
11
16
  import { ToolError } from "./errors.js";
@@ -17,5 +22,7 @@ export {
17
22
  ToolError,
18
23
  ToolErrorCode,
19
24
  ToolManager,
20
- defineTool
25
+ ToolPresentationSnapshotV1Schema,
26
+ defineTool,
27
+ isToolPresentationSnapshotV1
21
28
  };