@inflexa-ai/harness 0.48.1 → 0.48.3

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 (120) hide show
  1. package/dist/app/chat-turn-workflow.d.ts +3 -1
  2. package/dist/app/chat-turn-workflow.js +18 -3
  3. package/dist/app/chat-turn.js +27 -1
  4. package/dist/app/in-process-turn.js +3 -6
  5. package/dist/contracts/chat-events.d.ts +45 -0
  6. package/dist/contracts/chat-frame.js +11 -0
  7. package/dist/contracts/chat-parts.d.ts +19 -1
  8. package/dist/contracts/chat-parts.js +1 -0
  9. package/dist/contracts/index.d.ts +2 -2
  10. package/dist/contracts/message.d.ts +7 -1
  11. package/dist/contracts/part-registry.js +1 -0
  12. package/dist/contracts/schemas/chat-events.d.ts +321 -0
  13. package/dist/contracts/schemas/chat-events.js +30 -0
  14. package/dist/contracts/schemas/chat-parts.d.ts +29 -1
  15. package/dist/contracts/schemas/chat-parts.js +10 -0
  16. package/dist/execution/run-synthesis.js +1 -0
  17. package/dist/index.d.ts +4 -2
  18. package/dist/index.js +1 -0
  19. package/dist/input-sanitization.d.ts +30 -2
  20. package/dist/input-sanitization.js +187 -2
  21. package/dist/loop/chat-stream.js +1 -1
  22. package/dist/loop/run-loop.js +66 -5
  23. package/dist/loop/tool-adapter.d.ts +8 -0
  24. package/dist/loop/tool-adapter.js +75 -4
  25. package/dist/loop/tool-detail.d.ts +5 -1
  26. package/dist/loop/tool-detail.js +7 -3
  27. package/dist/loop/tool-value.d.ts +57 -0
  28. package/dist/loop/tool-value.js +249 -0
  29. package/dist/loop/types.d.ts +9 -2
  30. package/dist/memory/conversation-display-storage.d.ts +3 -2
  31. package/dist/memory/conversation-display-storage.js +14 -2
  32. package/dist/memory/count-tokens.js +29 -2
  33. package/dist/providers/ai-sdk.d.ts +17 -14
  34. package/dist/providers/ai-sdk.js +14 -16
  35. package/dist/sandbox/sandbox-step-translate.d.ts +5 -9
  36. package/dist/sandbox/sandbox-step-translate.js +5 -9
  37. package/dist/tasks/data-profile-activity.d.ts +3 -7
  38. package/dist/tasks/data-profile-activity.js +1 -1
  39. package/dist/tasks/data-profile.js +3 -6
  40. package/dist/tools/ad-hoc-router.js +1 -0
  41. package/dist/tools/bio/alphafold-prediction.js +1 -0
  42. package/dist/tools/bio/chembl.js +1 -0
  43. package/dist/tools/bio/comptox.js +1 -0
  44. package/dist/tools/bio/drug-gene-interactions.js +1 -0
  45. package/dist/tools/bio/gene-disease-evidence.js +1 -0
  46. package/dist/tools/bio/gene-preclinical-profile.js +1 -0
  47. package/dist/tools/bio/lookup-annotation.js +1 -0
  48. package/dist/tools/bio/opentargets.js +1 -0
  49. package/dist/tools/bio/pubchem.js +1 -0
  50. package/dist/tools/bio/pubmed.js +1 -0
  51. package/dist/tools/bio/search-clinical-trials.js +1 -0
  52. package/dist/tools/bio/search-faers.js +1 -0
  53. package/dist/tools/bio/search-gene.js +1 -0
  54. package/dist/tools/bio/search-geo-datasets.js +1 -0
  55. package/dist/tools/bio/search-interactions.js +1 -0
  56. package/dist/tools/bio/search-patents.js +1 -0
  57. package/dist/tools/bio/search-protein.js +1 -0
  58. package/dist/tools/bio/search-regulatory-approvals.js +1 -0
  59. package/dist/tools/bio/target-safety.js +1 -0
  60. package/dist/tools/capability-data.js +5 -0
  61. package/dist/tools/define-tool.d.ts +18 -0
  62. package/dist/tools/define-tool.js +2 -0
  63. package/dist/tools/display/show-user.js +1 -0
  64. package/dist/tools/execute-analysis.js +4 -0
  65. package/dist/tools/knowledge/check.d.ts +47 -1
  66. package/dist/tools/knowledge/check.js +10 -1
  67. package/dist/tools/knowledge/client.d.ts +1 -1
  68. package/dist/tools/knowledge/recommend.js +4 -3
  69. package/dist/tools/knowledge/situation.d.ts +39 -1
  70. package/dist/tools/knowledge/situation.js +80 -8
  71. package/dist/tools/knowledge/skeleton.d.ts +7 -0
  72. package/dist/tools/knowledge/skeleton.js +88 -2
  73. package/dist/tools/knowledge/template.js +1 -0
  74. package/dist/tools/memory/update-working-memory.js +5 -0
  75. package/dist/tools/read-tool-output.js +4 -0
  76. package/dist/tools/report-authoring/authoring-tools.js +8 -0
  77. package/dist/tools/report-session/examine-page.js +5 -0
  78. package/dist/tools/report-session/list-artifacts.js +5 -0
  79. package/dist/tools/report-session/preview-report.js +1 -0
  80. package/dist/tools/report-session/record-version.js +1 -0
  81. package/dist/tools/report-session/script-tools.js +2 -0
  82. package/dist/tools/research/context7-docs.js +2 -0
  83. package/dist/tools/research/generate-analogy-report.js +3 -0
  84. package/dist/tools/research/generate-plan.js +6 -0
  85. package/dist/tools/research/inspect-data-profile.js +5 -0
  86. package/dist/tools/research/inspect-run.js +5 -0
  87. package/dist/tools/research/resolve-citation.js +1 -0
  88. package/dist/tools/research/search-arxiv.js +1 -0
  89. package/dist/tools/research/search-github-repos.js +1 -0
  90. package/dist/tools/research/search-semantic-scholar.js +1 -0
  91. package/dist/tools/research/web-fetch.js +1 -0
  92. package/dist/tools/research/web-search.js +1 -0
  93. package/dist/tools/sandbox/lease-tools.js +2 -0
  94. package/dist/tools/sandbox/link-packages.js +1 -0
  95. package/dist/tools/sandbox/list-available-packages.js +5 -0
  96. package/dist/tools/sandbox/list-available-refs.js +5 -0
  97. package/dist/tools/sandbox/report-blocker.js +1 -0
  98. package/dist/tools/sandbox/skills.js +2 -0
  99. package/dist/tools/sandbox/submit-file-metadata.js +1 -0
  100. package/dist/tools/script/file-tools.js +6 -0
  101. package/dist/tools/script/run-script.js +20 -1
  102. package/dist/tools/start-report-session.js +1 -0
  103. package/dist/tools/tool-view.d.ts +63 -0
  104. package/dist/tools/tool-view.js +68 -0
  105. package/dist/tools/workspace/edit-file.js +5 -0
  106. package/dist/tools/workspace/execute-command.js +5 -2
  107. package/dist/tools/workspace/file-stat.js +5 -0
  108. package/dist/tools/workspace/grep.js +4 -0
  109. package/dist/tools/workspace/list-files.js +5 -0
  110. package/dist/tools/workspace/read-file.js +4 -0
  111. package/dist/tools/workspace/scan-inputs.js +5 -0
  112. package/dist/tools/workspace/show-file.js +1 -0
  113. package/dist/tools/workspace/show-plan.js +1 -0
  114. package/dist/tools/workspace/workspace-search.js +5 -0
  115. package/dist/tools/workspace/write-file.js +7 -2
  116. package/dist/workflows/execute-analysis.js +2 -1
  117. package/dist/workflows/sandbox-step.js +3 -7
  118. package/package.json +1 -1
  119. package/dist/tools/detail-resolver.d.ts +0 -40
  120. package/dist/tools/detail-resolver.js +0 -44
@@ -37,11 +37,99 @@ export declare const ToolCallOutcomeSchema: z.ZodEnum<{
37
37
  incomplete: "incomplete";
38
38
  ok: "ok";
39
39
  }>;
40
+ /** The most named leaves that a `fields` value holds. */
41
+ export declare const TOOL_CALL_FIELDS_MAX = 4;
42
+ /** A field name has 1 to 40 characters of letters, digits, `_`, and `-`. */
43
+ export declare const ToolCallFieldNameSchema: z.ZodString;
44
+ /** A language has 1 to 20 characters of lowercase letters, digits, `+`, `#`, `.`, and `-`. */
45
+ export declare const ToolCallLanguageSchema: z.ZodString;
46
+ /** Mirrors `ToolCallLeaf`. */
47
+ export declare const ToolCallLeafSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
48
+ kind: z.ZodLiteral<"text">;
49
+ text: z.ZodString;
50
+ cut: z.ZodBoolean;
51
+ }, z.core.$strip>, z.ZodObject<{
52
+ kind: z.ZodLiteral<"json">;
53
+ text: z.ZodString;
54
+ cut: z.ZodBoolean;
55
+ }, z.core.$strip>, z.ZodObject<{
56
+ kind: z.ZodLiteral<"code">;
57
+ language: z.ZodString;
58
+ text: z.ZodString;
59
+ cut: z.ZodBoolean;
60
+ }, z.core.$strip>], "kind">;
61
+ /** Mirrors `ToolCallValue`. A `fields` value holds 1 to 4 leaves and no `fields` value. */
62
+ export declare const ToolCallValueSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
63
+ kind: z.ZodLiteral<"text">;
64
+ text: z.ZodString;
65
+ cut: z.ZodBoolean;
66
+ }, z.core.$strip>, z.ZodObject<{
67
+ kind: z.ZodLiteral<"json">;
68
+ text: z.ZodString;
69
+ cut: z.ZodBoolean;
70
+ }, z.core.$strip>, z.ZodObject<{
71
+ kind: z.ZodLiteral<"code">;
72
+ language: z.ZodString;
73
+ text: z.ZodString;
74
+ cut: z.ZodBoolean;
75
+ }, z.core.$strip>, z.ZodObject<{
76
+ kind: z.ZodLiteral<"fields">;
77
+ fields: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
78
+ kind: z.ZodLiteral<"text">;
79
+ text: z.ZodString;
80
+ cut: z.ZodBoolean;
81
+ name: z.ZodString;
82
+ }, z.core.$strip>, z.ZodObject<{
83
+ kind: z.ZodLiteral<"json">;
84
+ text: z.ZodString;
85
+ cut: z.ZodBoolean;
86
+ name: z.ZodString;
87
+ }, z.core.$strip>, z.ZodObject<{
88
+ kind: z.ZodLiteral<"code">;
89
+ language: z.ZodString;
90
+ text: z.ZodString;
91
+ cut: z.ZodBoolean;
92
+ name: z.ZodString;
93
+ }, z.core.$strip>], "kind">>;
94
+ }, z.core.$strip>], "kind">;
40
95
  export declare const ToolStartedEventSchema: z.ZodObject<{
41
96
  type: z.ZodLiteral<"tool-started">;
42
97
  toolUseId: z.ZodString;
43
98
  name: z.ZodString;
44
99
  detail: z.ZodOptional<z.ZodString>;
100
+ input: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
101
+ kind: z.ZodLiteral<"text">;
102
+ text: z.ZodString;
103
+ cut: z.ZodBoolean;
104
+ }, z.core.$strip>, z.ZodObject<{
105
+ kind: z.ZodLiteral<"json">;
106
+ text: z.ZodString;
107
+ cut: z.ZodBoolean;
108
+ }, z.core.$strip>, z.ZodObject<{
109
+ kind: z.ZodLiteral<"code">;
110
+ language: z.ZodString;
111
+ text: z.ZodString;
112
+ cut: z.ZodBoolean;
113
+ }, z.core.$strip>, z.ZodObject<{
114
+ kind: z.ZodLiteral<"fields">;
115
+ fields: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
116
+ kind: z.ZodLiteral<"text">;
117
+ text: z.ZodString;
118
+ cut: z.ZodBoolean;
119
+ name: z.ZodString;
120
+ }, z.core.$strip>, z.ZodObject<{
121
+ kind: z.ZodLiteral<"json">;
122
+ text: z.ZodString;
123
+ cut: z.ZodBoolean;
124
+ name: z.ZodString;
125
+ }, z.core.$strip>, z.ZodObject<{
126
+ kind: z.ZodLiteral<"code">;
127
+ language: z.ZodString;
128
+ text: z.ZodString;
129
+ cut: z.ZodBoolean;
130
+ name: z.ZodString;
131
+ }, z.core.$strip>], "kind">>;
132
+ }, z.core.$strip>], "kind">>;
45
133
  source: z.ZodObject<{
46
134
  agentId: z.ZodString;
47
135
  callPath: z.ZodArray<z.ZodString>;
@@ -59,6 +147,105 @@ export declare const ToolFinishedEventSchema: z.ZodObject<{
59
147
  }>;
60
148
  detail: z.ZodOptional<z.ZodString>;
61
149
  durationMs: z.ZodOptional<z.ZodNumber>;
150
+ input: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
151
+ kind: z.ZodLiteral<"text">;
152
+ text: z.ZodString;
153
+ cut: z.ZodBoolean;
154
+ }, z.core.$strip>, z.ZodObject<{
155
+ kind: z.ZodLiteral<"json">;
156
+ text: z.ZodString;
157
+ cut: z.ZodBoolean;
158
+ }, z.core.$strip>, z.ZodObject<{
159
+ kind: z.ZodLiteral<"code">;
160
+ language: z.ZodString;
161
+ text: z.ZodString;
162
+ cut: z.ZodBoolean;
163
+ }, z.core.$strip>, z.ZodObject<{
164
+ kind: z.ZodLiteral<"fields">;
165
+ fields: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
166
+ kind: z.ZodLiteral<"text">;
167
+ text: z.ZodString;
168
+ cut: z.ZodBoolean;
169
+ name: z.ZodString;
170
+ }, z.core.$strip>, z.ZodObject<{
171
+ kind: z.ZodLiteral<"json">;
172
+ text: z.ZodString;
173
+ cut: z.ZodBoolean;
174
+ name: z.ZodString;
175
+ }, z.core.$strip>, z.ZodObject<{
176
+ kind: z.ZodLiteral<"code">;
177
+ language: z.ZodString;
178
+ text: z.ZodString;
179
+ cut: z.ZodBoolean;
180
+ name: z.ZodString;
181
+ }, z.core.$strip>], "kind">>;
182
+ }, z.core.$strip>], "kind">>;
183
+ result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
184
+ kind: z.ZodLiteral<"text">;
185
+ text: z.ZodString;
186
+ cut: z.ZodBoolean;
187
+ }, z.core.$strip>, z.ZodObject<{
188
+ kind: z.ZodLiteral<"json">;
189
+ text: z.ZodString;
190
+ cut: z.ZodBoolean;
191
+ }, z.core.$strip>, z.ZodObject<{
192
+ kind: z.ZodLiteral<"code">;
193
+ language: z.ZodString;
194
+ text: z.ZodString;
195
+ cut: z.ZodBoolean;
196
+ }, z.core.$strip>, z.ZodObject<{
197
+ kind: z.ZodLiteral<"fields">;
198
+ fields: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
199
+ kind: z.ZodLiteral<"text">;
200
+ text: z.ZodString;
201
+ cut: z.ZodBoolean;
202
+ name: z.ZodString;
203
+ }, z.core.$strip>, z.ZodObject<{
204
+ kind: z.ZodLiteral<"json">;
205
+ text: z.ZodString;
206
+ cut: z.ZodBoolean;
207
+ name: z.ZodString;
208
+ }, z.core.$strip>, z.ZodObject<{
209
+ kind: z.ZodLiteral<"code">;
210
+ language: z.ZodString;
211
+ text: z.ZodString;
212
+ cut: z.ZodBoolean;
213
+ name: z.ZodString;
214
+ }, z.core.$strip>], "kind">>;
215
+ }, z.core.$strip>], "kind">>;
216
+ error: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
217
+ kind: z.ZodLiteral<"text">;
218
+ text: z.ZodString;
219
+ cut: z.ZodBoolean;
220
+ }, z.core.$strip>, z.ZodObject<{
221
+ kind: z.ZodLiteral<"json">;
222
+ text: z.ZodString;
223
+ cut: z.ZodBoolean;
224
+ }, z.core.$strip>, z.ZodObject<{
225
+ kind: z.ZodLiteral<"code">;
226
+ language: z.ZodString;
227
+ text: z.ZodString;
228
+ cut: z.ZodBoolean;
229
+ }, z.core.$strip>, z.ZodObject<{
230
+ kind: z.ZodLiteral<"fields">;
231
+ fields: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
232
+ kind: z.ZodLiteral<"text">;
233
+ text: z.ZodString;
234
+ cut: z.ZodBoolean;
235
+ name: z.ZodString;
236
+ }, z.core.$strip>, z.ZodObject<{
237
+ kind: z.ZodLiteral<"json">;
238
+ text: z.ZodString;
239
+ cut: z.ZodBoolean;
240
+ name: z.ZodString;
241
+ }, z.core.$strip>, z.ZodObject<{
242
+ kind: z.ZodLiteral<"code">;
243
+ language: z.ZodString;
244
+ text: z.ZodString;
245
+ cut: z.ZodBoolean;
246
+ name: z.ZodString;
247
+ }, z.core.$strip>], "kind">>;
248
+ }, z.core.$strip>], "kind">>;
62
249
  source: z.ZodObject<{
63
250
  agentId: z.ZodString;
64
251
  callPath: z.ZodArray<z.ZodString>;
@@ -72,6 +259,7 @@ export declare const FinishEventSchema: z.ZodObject<{
72
259
  callPath: z.ZodArray<z.ZodString>;
73
260
  invocationId: z.ZodOptional<z.ZodString>;
74
261
  }, z.core.$strip>;
262
+ finishReason: z.ZodString;
75
263
  usage: z.ZodOptional<z.ZodObject<{
76
264
  inputTokens: z.ZodOptional<z.ZodNumber>;
77
265
  outputTokens: z.ZodOptional<z.ZodNumber>;
@@ -137,6 +325,39 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
137
325
  toolUseId: z.ZodString;
138
326
  name: z.ZodString;
139
327
  detail: z.ZodOptional<z.ZodString>;
328
+ input: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
329
+ kind: z.ZodLiteral<"text">;
330
+ text: z.ZodString;
331
+ cut: z.ZodBoolean;
332
+ }, z.core.$strip>, z.ZodObject<{
333
+ kind: z.ZodLiteral<"json">;
334
+ text: z.ZodString;
335
+ cut: z.ZodBoolean;
336
+ }, z.core.$strip>, z.ZodObject<{
337
+ kind: z.ZodLiteral<"code">;
338
+ language: z.ZodString;
339
+ text: z.ZodString;
340
+ cut: z.ZodBoolean;
341
+ }, z.core.$strip>, z.ZodObject<{
342
+ kind: z.ZodLiteral<"fields">;
343
+ fields: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
344
+ kind: z.ZodLiteral<"text">;
345
+ text: z.ZodString;
346
+ cut: z.ZodBoolean;
347
+ name: z.ZodString;
348
+ }, z.core.$strip>, z.ZodObject<{
349
+ kind: z.ZodLiteral<"json">;
350
+ text: z.ZodString;
351
+ cut: z.ZodBoolean;
352
+ name: z.ZodString;
353
+ }, z.core.$strip>, z.ZodObject<{
354
+ kind: z.ZodLiteral<"code">;
355
+ language: z.ZodString;
356
+ text: z.ZodString;
357
+ cut: z.ZodBoolean;
358
+ name: z.ZodString;
359
+ }, z.core.$strip>], "kind">>;
360
+ }, z.core.$strip>], "kind">>;
140
361
  source: z.ZodObject<{
141
362
  agentId: z.ZodString;
142
363
  callPath: z.ZodArray<z.ZodString>;
@@ -153,6 +374,105 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
153
374
  }>;
154
375
  detail: z.ZodOptional<z.ZodString>;
155
376
  durationMs: z.ZodOptional<z.ZodNumber>;
377
+ input: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
378
+ kind: z.ZodLiteral<"text">;
379
+ text: z.ZodString;
380
+ cut: z.ZodBoolean;
381
+ }, z.core.$strip>, z.ZodObject<{
382
+ kind: z.ZodLiteral<"json">;
383
+ text: z.ZodString;
384
+ cut: z.ZodBoolean;
385
+ }, z.core.$strip>, z.ZodObject<{
386
+ kind: z.ZodLiteral<"code">;
387
+ language: z.ZodString;
388
+ text: z.ZodString;
389
+ cut: z.ZodBoolean;
390
+ }, z.core.$strip>, z.ZodObject<{
391
+ kind: z.ZodLiteral<"fields">;
392
+ fields: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
393
+ kind: z.ZodLiteral<"text">;
394
+ text: z.ZodString;
395
+ cut: z.ZodBoolean;
396
+ name: z.ZodString;
397
+ }, z.core.$strip>, z.ZodObject<{
398
+ kind: z.ZodLiteral<"json">;
399
+ text: z.ZodString;
400
+ cut: z.ZodBoolean;
401
+ name: z.ZodString;
402
+ }, z.core.$strip>, z.ZodObject<{
403
+ kind: z.ZodLiteral<"code">;
404
+ language: z.ZodString;
405
+ text: z.ZodString;
406
+ cut: z.ZodBoolean;
407
+ name: z.ZodString;
408
+ }, z.core.$strip>], "kind">>;
409
+ }, z.core.$strip>], "kind">>;
410
+ result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
411
+ kind: z.ZodLiteral<"text">;
412
+ text: z.ZodString;
413
+ cut: z.ZodBoolean;
414
+ }, z.core.$strip>, z.ZodObject<{
415
+ kind: z.ZodLiteral<"json">;
416
+ text: z.ZodString;
417
+ cut: z.ZodBoolean;
418
+ }, z.core.$strip>, z.ZodObject<{
419
+ kind: z.ZodLiteral<"code">;
420
+ language: z.ZodString;
421
+ text: z.ZodString;
422
+ cut: z.ZodBoolean;
423
+ }, z.core.$strip>, z.ZodObject<{
424
+ kind: z.ZodLiteral<"fields">;
425
+ fields: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
426
+ kind: z.ZodLiteral<"text">;
427
+ text: z.ZodString;
428
+ cut: z.ZodBoolean;
429
+ name: z.ZodString;
430
+ }, z.core.$strip>, z.ZodObject<{
431
+ kind: z.ZodLiteral<"json">;
432
+ text: z.ZodString;
433
+ cut: z.ZodBoolean;
434
+ name: z.ZodString;
435
+ }, z.core.$strip>, z.ZodObject<{
436
+ kind: z.ZodLiteral<"code">;
437
+ language: z.ZodString;
438
+ text: z.ZodString;
439
+ cut: z.ZodBoolean;
440
+ name: z.ZodString;
441
+ }, z.core.$strip>], "kind">>;
442
+ }, z.core.$strip>], "kind">>;
443
+ error: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
444
+ kind: z.ZodLiteral<"text">;
445
+ text: z.ZodString;
446
+ cut: z.ZodBoolean;
447
+ }, z.core.$strip>, z.ZodObject<{
448
+ kind: z.ZodLiteral<"json">;
449
+ text: z.ZodString;
450
+ cut: z.ZodBoolean;
451
+ }, z.core.$strip>, z.ZodObject<{
452
+ kind: z.ZodLiteral<"code">;
453
+ language: z.ZodString;
454
+ text: z.ZodString;
455
+ cut: z.ZodBoolean;
456
+ }, z.core.$strip>, z.ZodObject<{
457
+ kind: z.ZodLiteral<"fields">;
458
+ fields: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
459
+ kind: z.ZodLiteral<"text">;
460
+ text: z.ZodString;
461
+ cut: z.ZodBoolean;
462
+ name: z.ZodString;
463
+ }, z.core.$strip>, z.ZodObject<{
464
+ kind: z.ZodLiteral<"json">;
465
+ text: z.ZodString;
466
+ cut: z.ZodBoolean;
467
+ name: z.ZodString;
468
+ }, z.core.$strip>, z.ZodObject<{
469
+ kind: z.ZodLiteral<"code">;
470
+ language: z.ZodString;
471
+ text: z.ZodString;
472
+ cut: z.ZodBoolean;
473
+ name: z.ZodString;
474
+ }, z.core.$strip>], "kind">>;
475
+ }, z.core.$strip>], "kind">>;
156
476
  source: z.ZodObject<{
157
477
  agentId: z.ZodString;
158
478
  callPath: z.ZodArray<z.ZodString>;
@@ -165,6 +485,7 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
165
485
  callPath: z.ZodArray<z.ZodString>;
166
486
  invocationId: z.ZodOptional<z.ZodString>;
167
487
  }, z.core.$strip>;
488
+ finishReason: z.ZodString;
168
489
  usage: z.ZodOptional<z.ZodObject<{
169
490
  inputTokens: z.ZodOptional<z.ZodNumber>;
170
491
  outputTokens: z.ZodOptional<z.ZodNumber>;
@@ -21,11 +21,37 @@ export const IterationEventSchema = z.object({
21
21
  export const ToolOutcomeSchema = z.enum(["ok", "error", "denied"]);
22
22
  /** Mirrors `ToolCallOutcome` — the live three plus the record-only `incomplete`. */
23
23
  export const ToolCallOutcomeSchema = z.enum(["ok", "error", "denied", "incomplete"]);
24
+ /** The most named leaves that a `fields` value holds. */
25
+ export const TOOL_CALL_FIELDS_MAX = 4;
26
+ /** A field name has 1 to 40 characters of letters, digits, `_`, and `-`. */
27
+ // oxlint-disable-next-line eslint-js/no-restricted-syntax -- a bounded character class has no zod builtin.
28
+ export const ToolCallFieldNameSchema = z.string().regex(/^[A-Za-z0-9_-]{1,40}$/);
29
+ /** A language has 1 to 20 characters of lowercase letters, digits, `+`, `#`, `.`, and `-`. */
30
+ // oxlint-disable-next-line eslint-js/no-restricted-syntax -- a bounded character class has no zod builtin.
31
+ export const ToolCallLanguageSchema = z.string().regex(/^[a-z0-9+#.-]{1,20}$/);
32
+ const TextLeafShape = { kind: z.literal("text"), text: z.string(), cut: z.boolean() };
33
+ const JsonLeafShape = { kind: z.literal("json"), text: z.string(), cut: z.boolean() };
34
+ const CodeLeafShape = { kind: z.literal("code"), language: ToolCallLanguageSchema, text: z.string(), cut: z.boolean() };
35
+ /** Mirrors `ToolCallLeaf`. */
36
+ export const ToolCallLeafSchema = z.discriminatedUnion("kind", [z.object(TextLeafShape), z.object(JsonLeafShape), z.object(CodeLeafShape)]);
37
+ const ToolCallFieldSchema = z.discriminatedUnion("kind", [
38
+ z.object({ name: ToolCallFieldNameSchema, ...TextLeafShape }),
39
+ z.object({ name: ToolCallFieldNameSchema, ...JsonLeafShape }),
40
+ z.object({ name: ToolCallFieldNameSchema, ...CodeLeafShape }),
41
+ ]);
42
+ /** Mirrors `ToolCallValue`. A `fields` value holds 1 to 4 leaves and no `fields` value. */
43
+ export const ToolCallValueSchema = z.discriminatedUnion("kind", [
44
+ z.object(TextLeafShape),
45
+ z.object(JsonLeafShape),
46
+ z.object(CodeLeafShape),
47
+ z.object({ kind: z.literal("fields"), fields: z.array(ToolCallFieldSchema).min(1).max(TOOL_CALL_FIELDS_MAX) }),
48
+ ]);
24
49
  export const ToolStartedEventSchema = z.object({
25
50
  type: z.literal("tool-started"),
26
51
  toolUseId: z.string(),
27
52
  name: z.string(),
28
53
  detail: z.string().optional(),
54
+ input: ToolCallValueSchema.optional(),
29
55
  source: EventSourceSchema,
30
56
  });
31
57
  export const ToolFinishedEventSchema = z.object({
@@ -36,11 +62,15 @@ export const ToolFinishedEventSchema = z.object({
36
62
  detail: z.string().optional(),
37
63
  /** Optional and absent when unmeasured — never a zero in place of a figure. */
38
64
  durationMs: z.number().optional(),
65
+ input: ToolCallValueSchema.optional(),
66
+ result: ToolCallValueSchema.optional(),
67
+ error: ToolCallValueSchema.optional(),
39
68
  source: EventSourceSchema,
40
69
  });
41
70
  export const FinishEventSchema = z.object({
42
71
  type: z.literal("finish"),
43
72
  source: EventSourceSchema,
73
+ finishReason: z.string(),
44
74
  usage: TokenUsageRollupSchema.optional(),
45
75
  turnUsage: TokenUsageRollupSchema.optional(),
46
76
  });
@@ -625,6 +625,25 @@ export declare const PausePartSchema: z.ZodObject<{
625
625
  attempt: z.ZodOptional<z.ZodNumber>;
626
626
  retryAt: z.ZodOptional<z.ZodString>;
627
627
  }, z.core.$strip>;
628
+ /** Mirrors `ModelRefusalPart` without its `type`: the stored payload of the part. */
629
+ export declare const ModelRefusalPayloadSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
630
+ id: z.ZodString;
631
+ outcome: z.ZodLiteral<"fallback">;
632
+ model: z.ZodString;
633
+ }, z.core.$strip>, z.ZodObject<{
634
+ id: z.ZodString;
635
+ outcome: z.ZodLiteral<"stopped">;
636
+ }, z.core.$strip>], "outcome">;
637
+ export declare const ModelRefusalPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
638
+ id: z.ZodString;
639
+ outcome: z.ZodLiteral<"fallback">;
640
+ model: z.ZodString;
641
+ type: z.ZodLiteral<"data-model-refusal">;
642
+ }, z.core.$strip>, z.ZodObject<{
643
+ id: z.ZodString;
644
+ outcome: z.ZodLiteral<"stopped">;
645
+ type: z.ZodLiteral<"data-model-refusal">;
646
+ }, z.core.$strip>], "outcome">;
628
647
  export declare const ModelRetryPartSchema: z.ZodObject<{
629
648
  type: z.ZodLiteral<"data-model-retry">;
630
649
  id: z.ZodString;
@@ -1090,4 +1109,13 @@ export declare const ChatPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1090
1109
  maxRetries: z.ZodNumber;
1091
1110
  retryAt: z.ZodString;
1092
1111
  status: z.ZodOptional<z.ZodNumber>;
1093
- }, z.core.$strip>], "type">;
1112
+ }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
1113
+ id: z.ZodString;
1114
+ outcome: z.ZodLiteral<"fallback">;
1115
+ model: z.ZodString;
1116
+ type: z.ZodLiteral<"data-model-refusal">;
1117
+ }, z.core.$strip>, z.ZodObject<{
1118
+ id: z.ZodString;
1119
+ outcome: z.ZodLiteral<"stopped">;
1120
+ type: z.ZodLiteral<"data-model-refusal">;
1121
+ }, z.core.$strip>], "outcome">], "type">;
@@ -375,6 +375,15 @@ export const PausePartSchema = z.object({
375
375
  attempt: z.number().int().nonnegative().optional(),
376
376
  retryAt: z.string().optional(),
377
377
  });
378
+ // ── Model refusal ───────────────────────────────────────────────────
379
+ const ModelRefusalFallbackShape = { id: z.string(), outcome: z.literal("fallback"), model: z.string() };
380
+ const ModelRefusalStoppedShape = { id: z.string(), outcome: z.literal("stopped") };
381
+ /** Mirrors `ModelRefusalPart` without its `type`: the stored payload of the part. */
382
+ export const ModelRefusalPayloadSchema = z.discriminatedUnion("outcome", [z.object(ModelRefusalFallbackShape), z.object(ModelRefusalStoppedShape)]);
383
+ export const ModelRefusalPartSchema = z.discriminatedUnion("outcome", [
384
+ z.object({ type: z.literal("data-model-refusal"), ...ModelRefusalFallbackShape }),
385
+ z.object({ type: z.literal("data-model-refusal"), ...ModelRefusalStoppedShape }),
386
+ ]);
378
387
  // ── Model retry ─────────────────────────────────────────────────────
379
388
  export const ModelRetryPartSchema = z.object({
380
389
  type: z.literal("data-model-retry"),
@@ -428,4 +437,5 @@ export const ChatPartSchema = z.discriminatedUnion("type", [
428
437
  CompactionPartSchema,
429
438
  PausePartSchema,
430
439
  ModelRetryPartSchema,
440
+ ModelRefusalPartSchema,
431
441
  ]);
@@ -237,6 +237,7 @@ function buildSubmitTool(ctx) {
237
237
  "path and call again, or switch to report_blocker if the synthesis " +
238
238
  "cannot be made valid. The last accepted submission is the synthesis.",
239
239
  inputSchema: z.object({ synthesis: SynthesisDraftSchema }),
240
+ view: "none",
240
241
  describeCall: "none",
241
242
  execute: (input) => {
242
243
  const issues = semanticCheck(input.synthesis, ctx);
package/dist/index.d.ts CHANGED
@@ -55,6 +55,8 @@ export { defineTool, isToolError } from "./tools/define-tool.js";
55
55
  export { createHttpKnowledgeClient, createKnowledgeRecommendTool, createKnowledgeCheckTool, createKnowledgeTools, knowledgeToolDefinitionHash, } from "./tools/knowledge/index.js";
56
56
  export type { KnowledgeClient, KnowledgeSituation, HttpKnowledgeClientConfig } from "./tools/knowledge/index.js";
57
57
  export type { Tool, ToolDefinition, ToolContext, ToolError } from "./tools/define-tool.js";
58
+ export { viewText, viewJson, viewCode, viewFields } from "./tools/tool-view.js";
59
+ export type { ToolCallView, ViewText, ViewJson, ViewCode, ViewFields, ViewLeaf, ViewValue } from "./tools/tool-view.js";
58
60
  export { normalizeDetail, DETAIL_MAX_LENGTH } from "./loop/tool-detail.js";
59
61
  export { createCitationResolver } from "./citations/resolve.js";
60
62
  export type { CitationResolverConfig, CitationResolverDependencies, CitationResolverSourceConfig } from "./citations/resolve.js";
@@ -99,14 +101,14 @@ export type { ConversationDisplayRecorder, ConversationDisplayRecorderOptions }
99
101
  export { envelopeDisplayMessages, parseStoredDisplayEnvelope } from "./memory/conversation-display-storage.js";
100
102
  export type { ConversationDisplayMetadata, ConversationUIData, ConversationUIMessage, StoredDisplayEnvelope } from "./memory/conversation-display-storage.js";
101
103
  export { storedMessagesToChat } from "./memory/conversation-display-replay.js";
102
- export type { ChatEvent, ChatFrame, ChatPartFrame, TextDeltaEvent, IterationEvent, ToolStartedEvent, ToolFinishedEvent, ToolOutcome, ToolCallOutcome, ToolCallDetail, FinishEvent, ChatErrorEvent, MessageStartEvent, } from "./contracts/chat-events.js";
104
+ export type { ChatEvent, ChatFrame, ChatPartFrame, TextDeltaEvent, IterationEvent, ToolStartedEvent, ToolFinishedEvent, ToolOutcome, ToolCallOutcome, ToolCallDetail, ToolCallLeaf, ToolCallValue, FinishEvent, ChatErrorEvent, MessageStartEvent, } from "./contracts/chat-events.js";
103
105
  export { toChatFrame, applyChatFrame, checkChatPart, isKnownPartFrame } from "./contracts/chat-frame.js";
104
106
  export { createSubAgentActivityTracker, SUBAGENT_ACTIVITY_MAX_ENTRIES } from "./contracts/subagent-activity.js";
105
107
  export type { SubAgentActivityTracker } from "./contracts/subagent-activity.js";
106
108
  export type { TextPart, ToolCallPart, MessagePart, ChatMessage } from "./contracts/message.js";
107
109
  export type { TurnTerminal, ApplyFrameResult, ChatPartCheck } from "./contracts/chat-frame.js";
108
110
  export type { TokenUsageRollup } from "./contracts/usage.js";
109
- export type { ChatPart, PresentationPart, PresentationContent, PlanPart, RunCardPart, PlanApprovalPart, FileReferencePart, FileReferenceEntry, RunStartedPart, DagStatePart, DagStepState, PlanGraphStep, StepStatus, StepActivityPart, ActivityEntryPart, SubAgentActivityEntry, SubAgentActivityPart, StepPhase, StepFileTreePart, FileTreeEntry, StepOutputPart, StepOutputFile, StepSummaryPart, StepUsagePart, StepBlockedPart, RunSynthesisPart, FindingReference, SynthesizedFinding, BiologicalTheme, SynthesisProgressPart, SynthesisPhase, RunCompletedPart, RunCompletedFinding, RunFailedPart, CompactionPart, PauseCause, WorkKind, PausePart, ModelRetryPart, AskPart, ChildSessionStartedPart, ReportRenderedPart, } from "./contracts/chat-parts.js";
111
+ export type { ChatPart, PresentationPart, PresentationContent, PlanPart, RunCardPart, PlanApprovalPart, FileReferencePart, FileReferenceEntry, RunStartedPart, DagStatePart, DagStepState, PlanGraphStep, StepStatus, StepActivityPart, ActivityEntryPart, SubAgentActivityEntry, SubAgentActivityPart, StepPhase, StepFileTreePart, FileTreeEntry, StepOutputPart, StepOutputFile, StepSummaryPart, StepUsagePart, StepBlockedPart, RunSynthesisPart, FindingReference, SynthesizedFinding, BiologicalTheme, SynthesisProgressPart, SynthesisPhase, RunCompletedPart, RunCompletedFinding, RunFailedPart, CompactionPart, PauseCause, WorkKind, PausePart, ModelRetryPart, ModelRefusal, ModelRefusalPart, AskPart, ChildSessionStartedPart, ReportRenderedPart, } from "./contracts/chat-parts.js";
110
112
  export { PART_REGISTRY, isTransient, isReconciling, isSidebarPart } from "./contracts/part-registry.js";
111
113
  export type { ChatPartType, PartDescriptor, PartEmitter, PartConsumer } from "./contracts/part-registry.js";
112
114
  export { parseStructureUrl, alphafoldEntryUrl, alphafoldPredictionUrl } from "./contracts/structure-source.js";
package/dist/index.js CHANGED
@@ -73,6 +73,7 @@ export { defineTool, isToolError } from "./tools/define-tool.js";
73
73
  // (or none), and it can hand `knowledge_recommend` to the conversation agent
74
74
  // through `hostTools`.
75
75
  export { createHttpKnowledgeClient, createKnowledgeRecommendTool, createKnowledgeCheckTool, createKnowledgeTools, knowledgeToolDefinitionHash, } from "./tools/knowledge/index.js";
76
+ export { viewText, viewJson, viewCode, viewFields } from "./tools/tool-view.js";
76
77
  // Tool-call-detail authoring aids for an embedder that contributes a host tool.
77
78
  // A `describeCall` hook that pre-empts truncation — a count in place of a
78
79
  // mid-value cut that would name a file that does not exist — must gate on the
@@ -3,8 +3,14 @@
3
3
  * What runs is exactly what is declared here.
4
4
  *
5
5
  * `normalizeUnicode` and `redactSecrets` are applied once to the incoming user
6
- * message by the chat route (change 6), and never to assistant messages or tool
7
- * results. `stripNulCharacters` is the exception — it applies to tool results.
6
+ * message by the chat route, and never to assistant messages or to the result
7
+ * that a tool gives the model. `stripNulCharacters` is the exception — it
8
+ * applies to tool results.
9
+ *
10
+ * `redactSecretForms`, `redactSecretFields`, and `redactSecretAssignments` are
11
+ * the value-only rules: only the shown values of a tool call (`loop/tool-value.ts`)
12
+ * get them. They are name-based rules that would mark prose and sequences in a
13
+ * user message. The model reads the unchanged result.
8
14
  */
9
15
  /**
10
16
  * NFC-normalize and strip control characters.
@@ -30,3 +36,25 @@ export declare function stripNulCharacters(text: string): string;
30
36
  * 40-residue protein sequence passes through unchanged.
31
37
  */
32
38
  export declare function redactSecrets(text: string): string;
39
+ /**
40
+ * A copy of a JSON value in which the value of each object field with a secret name is the redaction marker. The
41
+ * walk goes to each depth, thus the `GITHUB_TOKEN` field of an `env` object is found. An array applies the rule of
42
+ * {@link redactArgvValues} to its strings. The rule belongs to the values of a tool call only. `redactSecrets` stays
43
+ * free of any name-based rule, because a user message holds prose and sequences that such a rule would mark.
44
+ */
45
+ export declare function redactSecretFields(value: unknown): unknown;
46
+ /**
47
+ * Replace the value of each `NAME=value` assignment and of each quoted `"name": value` field whose name ends with a
48
+ * secret word. A caller runs it on a plain text or on one string of a JSON value, never on serialized JSON, because a
49
+ * JSON escape hides the quotes that the rules read. It runs on the text of a tool call value only. See
50
+ * {@link redactSecretFields}.
51
+ */
52
+ export declare function redactSecretAssignments(text: string): string;
53
+ /**
54
+ * Replace the secret that each of these forms holds: a private-key block, the password of a URL, the password of a
55
+ * `-u user:password` option, the value of a `Cookie` header, the value of a `--name value` flag, the value of a
56
+ * `name: value` pair, and each form of {@link redactSecretAssignments}. A name must end with a secret word.
57
+ * It covers these forms only: a text can hold a secret in a different form. It runs on the text of a tool call value
58
+ * only, on a plain text or on one string of a JSON value.
59
+ */
60
+ export declare function redactSecretForms(text: string): string;