@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
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import type { AuthContext } from "../auth/types.js";
17
17
  import type { TokenUsageRollup } from "../contracts/usage.js";
18
- import type { ChatFrame } from "../contracts/chat-events.js";
18
+ import type { ChatErrorEvent, ChatFrame, EventSource, FinishEvent } from "../contracts/chat-events.js";
19
19
  import type { AgentDefinition } from "../loop/types.js";
20
20
  import type { ThreadType } from "../memory/thread-store.js";
21
21
  import type { PromptCachePolicy } from "../providers/types.js";
@@ -110,5 +110,7 @@ export declare const DEFAULT_ASK_WAIT_SECONDS: number;
110
110
  * finds the workflow of a recovery by its registered name.
111
111
  */
112
112
  export declare function registerChatTurns(deps: ChatTurnWorkflowDeps): ChatTurns;
113
+ /** The last frame of a turn that ran: `error` for a failed turn, else `finish` with the stop reason of the turn. */
114
+ export declare function endFrameOf(ran: ChatTurnRan, rootSource: EventSource): ChatErrorEvent | FinishEvent;
113
115
  /** How a turn that ran ended, as a host reads it. */
114
116
  export declare function chatTurnEndOf(ran: ChatTurnRan): ChatTurnEnd;
@@ -277,9 +277,7 @@ async function runTurnWorkflow(deps, input, signal) {
277
277
  };
278
278
  const ran = await runOpenTurn(deps, { analysisId: input.analysisId, threadId: input.threadId, userInput: input.userText }, { kind: "ok", threadType: input.threadType, history: view, userMessage: opening.userMessage, contextRecords: opening.contextRecords }, agent.value, { session, author: input.author, startedAtMs: input.startedAtMs, promptCache: input.promptCache }, transport);
279
279
  const { outcome } = ran;
280
- await writer.write(outcome.status === "failed"
281
- ? { type: "error", message: outcome.reason, reason: outcome.code, source: rootSource }
282
- : { type: "finish", source: rootSource, turnUsage: ran.turnUsage });
280
+ await writer.write(endFrameOf(ran, rootSource));
283
281
  await writer.settle();
284
282
  await closeDurableStream(CHAT_STREAM_KEY, outcome.status === "done" ? "stop" : outcome.status === "aborted" ? "aborted" : "error");
285
283
  // A sub-agent that a stop canceled in its pause leaves its row, thus the end of the turn clears each row of the turn.
@@ -287,6 +285,23 @@ async function runTurnWorkflow(deps, input, signal) {
287
285
  await DBOS.runStep(async () => unwrapOrThrow(await releaseThreadOfTurn(deps.pool, input.threadId, input.turnId)), { name: "chat-turn.release" });
288
286
  return chatTurnEndOf(ran);
289
287
  }
288
+ /** The last frame of a turn that ran: `error` for a failed turn, else `finish` with the stop reason of the turn. */
289
+ export function endFrameOf(ran, rootSource) {
290
+ const { outcome } = ran;
291
+ switch (outcome.status) {
292
+ case "failed":
293
+ return { type: "error", message: outcome.reason, reason: outcome.code, source: rootSource };
294
+ case "done":
295
+ return { type: "finish", source: rootSource, finishReason: outcome.finish.reason, turnUsage: ran.turnUsage };
296
+ // An abort that cut the run before its end leaves no finish of the loop.
297
+ case "aborted":
298
+ return { type: "finish", source: rootSource, finishReason: "aborted", turnUsage: ran.turnUsage };
299
+ default: {
300
+ const exhaustive = outcome;
301
+ throw new Error(`unhandled turn outcome: ${JSON.stringify(exhaustive)}`);
302
+ }
303
+ }
304
+ }
290
305
  /** How a turn that ran ended, as a host reads it. */
291
306
  export function chatTurnEndOf(ran) {
292
307
  const { outcome } = ran;
@@ -218,7 +218,7 @@ export async function runOpenTurn(deps, turn, prepared, agent, params, transport
218
218
  await flush({
219
219
  status: outcome.status,
220
220
  reason: outcome.status === "failed" ? outcome.reason : undefined,
221
- note: outcome.status === "failed" ? conversationRecordTurn(failureNote(outcome.reason)) : outcome.status === "aborted" ? interruptionNote() : undefined,
221
+ note: closingNoteOf(outcome, recorder),
222
222
  turnUsage,
223
223
  turnDurationMs: durationMs,
224
224
  });
@@ -292,6 +292,32 @@ function failureReasonOf(err) {
292
292
  return findProviderError(err) === undefined ? "The turn stopped on an internal error." : "The model request failed.";
293
293
  }
294
294
  }
295
+ /** The note that closes a turn: a failed, an aborted, or a declined turn has one, and a turn that the model answered has none. */
296
+ function closingNoteOf(outcome, recorder) {
297
+ switch (outcome.status) {
298
+ case "failed":
299
+ return conversationRecordTurn(failureNote(outcome.reason));
300
+ case "aborted":
301
+ return interruptionNote();
302
+ case "done":
303
+ return outcome.finish.reason === "content-filter" ? declineNote(recorder) : undefined;
304
+ default: {
305
+ const exhaustive = outcome;
306
+ throw new Error(`unhandled turn outcome: ${JSON.stringify(exhaustive)}`);
307
+ }
308
+ }
309
+ }
310
+ /**
311
+ * The note of a turn that the content filter stopped. A declined request often gives no message, and a round
312
+ * with no message gives no row. The note is the row that holds the display of such a round, thus a reload
313
+ * shows the refusal. It also tells the next turn that this request has no reply.
314
+ */
315
+ function declineNote(recorder) {
316
+ return {
317
+ modelMessages: [syntheticUserMessage("[The model provider declined the request above, thus it has no reply.]")],
318
+ displayMessages: recorder.takeRound([]),
319
+ };
320
+ }
295
321
  /**
296
322
  * The note of an aborted turn. Without it, the next turn reads the request of the aborted turn as open, and
297
323
  * its reply also answers that request. The transcript shows the interruption from the turn record, thus the
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { randomUUID } from "node:crypto";
8
8
  import { toChatFrame } from "../contracts/chat-frame.js";
9
- import { chatTurnEndOf } from "./chat-turn-workflow.js";
9
+ import { chatTurnEndOf, endFrameOf } from "./chat-turn-workflow.js";
10
10
  import { createConversationDisplayRecorder } from "../memory/conversation-display-recorder.js";
11
11
  import { prepareChatTurn, runOpenTurn, userTextOf, } from "./chat-turn.js";
12
12
  /** Prepare a turn and resolve its agent. A refusal comes back before any row of the turn exists. */
@@ -112,11 +112,8 @@ export function inProcessChatTurns(deps) {
112
112
  promptCache: request.promptCache,
113
113
  })
114
114
  .then((ran) => {
115
- const turnEnd = chatTurnEndOf(ran);
116
- log.push(turnEnd.status === "failed"
117
- ? { type: "error", message: turnEnd.reason ?? "The turn failed.", reason: turnEnd.code, source: rootSource }
118
- : { type: "finish", source: rootSource, turnUsage: turnEnd.turnUsage });
119
- return turnEnd;
115
+ log.push(endFrameOf(ran, rootSource));
116
+ return chatTurnEndOf(ran);
120
117
  })
121
118
  .catch(() => null)
122
119
  .finally(() => log.close());
@@ -67,6 +67,38 @@ export type ToolCallOutcome = ToolOutcome | "incomplete";
67
67
  * when the detail could not be produced.
68
68
  */
69
69
  export type ToolCallDetail = string;
70
+ /**
71
+ * One shown text of a tool call value. The harness removes the control characters and each listed secret form from
72
+ * the text, and it cuts a text over its cap. `cut` is true when the cap cut the text.
73
+ *
74
+ * - `text`: plain text.
75
+ * - `json`: the JSON text of a value. A host can parse it only when `cut` is false, because a cut text is not valid JSON.
76
+ * - `code`: source code in `language`.
77
+ */
78
+ export type ToolCallLeaf = {
79
+ kind: "text";
80
+ text: string;
81
+ cut: boolean;
82
+ } | {
83
+ kind: "json";
84
+ text: string;
85
+ cut: boolean;
86
+ } | {
87
+ kind: "code";
88
+ language: string;
89
+ text: string;
90
+ cut: boolean;
91
+ };
92
+ /**
93
+ * The shown value of a tool call: its input, its result, or its error. A host selects a renderer from `kind`.
94
+ * `fields` holds an ordered list of at most 4 named leaves, and a leaf never holds a `fields` value.
95
+ */
96
+ export type ToolCallValue = ToolCallLeaf | {
97
+ kind: "fields";
98
+ fields: Array<{
99
+ name: string;
100
+ } & ToolCallLeaf>;
101
+ };
70
102
  /**
71
103
  * A sub-agent loop started a request to its model. Only a sub-agent gives this frame, thus a consumer that
72
104
  * keeps the root frames only (`isRootFrame`) never sees it. A host reads it as "the sub-agent thinks".
@@ -84,6 +116,8 @@ export type ToolStartedEvent = {
84
116
  name: string;
85
117
  /** See {@link ToolCallDetail}. Absent — never empty — when none was produced. */
86
118
  detail?: ToolCallDetail;
119
+ /** See {@link ToolCallValue}. The input of the call. */
120
+ input?: ToolCallValue;
87
121
  source: EventSource;
88
122
  };
89
123
  /** A tool call has resolved. */
@@ -109,6 +143,12 @@ export type ToolFinishedEvent = {
109
143
  * it dispatches anything. Thus the fallback is correct only for one call.
110
144
  */
111
145
  durationMs?: number;
146
+ /** See {@link ToolCallValue}. The input again, because a replay of a tool step does not give its `tool-started`. */
147
+ input?: ToolCallValue;
148
+ /** The value of a call with the outcome `ok`. */
149
+ result?: ToolCallValue;
150
+ /** The error text of a call with the outcome `error`. */
151
+ error?: ToolCallValue;
112
152
  source: EventSource;
113
153
  };
114
154
  /**
@@ -122,6 +162,11 @@ export type ToolFinishedEvent = {
122
162
  export type FinishEvent = {
123
163
  type: "finish";
124
164
  source: EventSource;
165
+ /**
166
+ * Why the turn stopped: the finish reason of the last reply, for example `stop` or `content-filter`, or `aborted`,
167
+ * `max_iterations`, or `denied`. A word outside these stays as the provider sent it.
168
+ */
169
+ finishReason: string;
125
170
  /** What this loop's own LLM calls used. */
126
171
  usage?: TokenUsageRollup;
127
172
  /**
@@ -50,6 +50,7 @@ export function toChatFrame(event, fallbackSource) {
50
50
  toolUseId: event.toolUseId,
51
51
  name: event.name,
52
52
  detail: event.detail,
53
+ input: event.input,
53
54
  source: toSource(event.source),
54
55
  };
55
56
  case "tool-finished":
@@ -60,6 +61,9 @@ export function toChatFrame(event, fallbackSource) {
60
61
  outcome: event.outcome,
61
62
  detail: event.detail,
62
63
  durationMs: event.durationMs,
64
+ input: event.input,
65
+ result: event.result,
66
+ error: event.error,
63
67
  source: toSource(event.source),
64
68
  };
65
69
  case "text-delta":
@@ -161,6 +165,7 @@ function applyPartFrame(parts, frame) {
161
165
  toolCallId: frame.toolUseId,
162
166
  toolName: frame.name,
163
167
  detail: frame.detail,
168
+ input: frame.input,
164
169
  },
165
170
  ];
166
171
  case "tool-finished": {
@@ -174,6 +179,12 @@ function applyPartFrame(parts, frame) {
174
179
  finished.detail = frame.detail;
175
180
  if (frame.durationMs !== undefined)
176
181
  finished.durationMs = frame.durationMs;
182
+ if (frame.input !== undefined)
183
+ finished.input = frame.input;
184
+ if (frame.result !== undefined)
185
+ finished.result = frame.result;
186
+ if (frame.error !== undefined)
187
+ finished.error = frame.error;
177
188
  const started = parts.some((p) => p.type === "tool-call" && p.toolCallId === frame.toolUseId);
178
189
  if (!started) {
179
190
  // The stored transcript keeps a call whose start never arrived, thus a live view keeps it too.
@@ -9,6 +9,7 @@
9
9
  * data-plan-approval (the record of an approved plan)
10
10
  * Compaction: data-compaction (a compaction of the conversation thread)
11
11
  * Model retry: data-model-retry (a retry of a model request inside the retry envelope of the provider)
12
+ * Model refusal: data-model-refusal (a model request that the provider declined)
12
13
  * Run lifecycle: run-started, dag-state, run-completed, run-failed, run-synthesis,
13
14
  * synthesis-progress
14
15
  * Per-step live: step-activity, step-file-tree
@@ -498,6 +499,23 @@ export type ModelRetryPart = {
498
499
  /** The HTTP status of the failed attempt. Absent for a failure with no status, for example a lost connection. */
499
500
  status?: number;
500
501
  };
502
+ /**
503
+ * A model request that the provider declined. `fallback`: another model answered the request, and `model` names it.
504
+ * `stopped`: no model answered, thus the reply of the request ended with the content filter.
505
+ */
506
+ export type ModelRefusal = {
507
+ /** The id of the model response. */
508
+ id: string;
509
+ outcome: "fallback";
510
+ model: string;
511
+ } | {
512
+ /** The id of the model response. */
513
+ id: string;
514
+ outcome: "stopped";
515
+ };
516
+ export type ModelRefusalPart = {
517
+ type: "data-model-refusal";
518
+ } & ModelRefusal;
501
519
  /** The kind of a durable work, and of the work that a pause belongs to. A sub-agent belongs to its turn, and a sandbox step to its run. */
502
520
  export type WorkKind = "turn" | "run" | "profile";
503
521
  /**
@@ -521,7 +539,7 @@ export type PausePart = {
521
539
  retryAt?: string;
522
540
  };
523
541
  /** The parts whose contracts this version of the package declares — the arms the part registry knows. */
524
- export type KnownChatPart = PresentationPart | PlanPart | RunCardPart | PlanApprovalPart | FileReferencePart | AskPart | RunStartedPart | DagStatePart | StepActivityPart | ActivityEntryPart | SubAgentActivityPart | StepFileTreePart | StepOutputPart | StepSummaryPart | StepUsagePart | StepBlockedPart | RunSynthesisPart | SynthesisProgressPart | RunCompletedPart | RunFailedPart | ChildSessionStartedPart | ReportRenderedPart | CompactionPart | PausePart | ModelRetryPart;
542
+ export type KnownChatPart = PresentationPart | PlanPart | RunCardPart | PlanApprovalPart | FileReferencePart | AskPart | RunStartedPart | DagStatePart | StepActivityPart | ActivityEntryPart | SubAgentActivityPart | StepFileTreePart | StepOutputPart | StepSummaryPart | StepUsagePart | StepBlockedPart | RunSynthesisPart | SynthesisProgressPart | RunCompletedPart | RunFailedPart | ChildSessionStartedPart | ReportRenderedPart | CompactionPart | PausePart | ModelRetryPart | ModelRefusalPart;
525
543
  /**
526
544
  * A part of a known contract, or a part whose type this build does not know. An emitter newer than this
527
545
  * build can lead the registry, and such a part already rides through the check boundary and the live view
@@ -9,6 +9,7 @@
9
9
  * data-plan-approval (the record of an approved plan)
10
10
  * Compaction: data-compaction (a compaction of the conversation thread)
11
11
  * Model retry: data-model-retry (a retry of a model request inside the retry envelope of the provider)
12
+ * Model refusal: data-model-refusal (a model request that the provider declined)
12
13
  * Run lifecycle: run-started, dag-state, run-completed, run-failed, run-synthesis,
13
14
  * synthesis-progress
14
15
  * Per-step live: step-activity, step-file-tree
@@ -2,8 +2,8 @@ export { ORGAN_SYSTEMS, OrganSystemSchema, ORGAN_SYSTEM_LABELS, organSystemLabel
2
2
  export type { OrganSystem } from "./organ-system.js";
3
3
  export { SEVERITIES, SeveritySchema } from "./severity.js";
4
4
  export type { Severity } from "./severity.js";
5
- export type { PlanStep, PresentationContent, PresentationPart, PlanPart, RunCardPart, PlanApprovalPart, FileReferenceEntry, FileReferencePart, AskPart, RunStartedPart, StepStatus, DagStepState, PlanGraphStep, DagStatePart, StepPhase, StepActivityPart, ActivityEntryPart, SubAgentActivityEntry, SubAgentActivityPart, FileTreeEntry, StepFileTreePart, StepOutputFile, StepOutputPart, StepSummaryPart, StepUsagePart, StepBlockedPart, FindingReference, SynthesizedFinding, BiologicalTheme, RunSynthesisPart, SynthesisPhase, SynthesisProgressPart, RunCompletedFinding, RunCompletedPart, RunFailedPart, ChildSessionStartedPart, ReportRenderedPart, CompactionPart, PauseCause, WorkKind, PausePart, ModelRetryPart, ChatPart, KnownChatPart, } from "./chat-parts.js";
6
- export type { EventSource, TextDeltaEvent, IterationEvent, ToolStartedEvent, ToolFinishedEvent, FinishEvent, ChatErrorEvent, MessageStartEvent, ChatEvent, ChatFrame, ChatPartFrame, } from "./chat-events.js";
5
+ export type { PlanStep, PresentationContent, PresentationPart, PlanPart, RunCardPart, PlanApprovalPart, FileReferenceEntry, FileReferencePart, AskPart, RunStartedPart, StepStatus, DagStepState, PlanGraphStep, DagStatePart, StepPhase, StepActivityPart, ActivityEntryPart, SubAgentActivityEntry, SubAgentActivityPart, FileTreeEntry, StepFileTreePart, StepOutputFile, StepOutputPart, StepSummaryPart, StepUsagePart, StepBlockedPart, FindingReference, SynthesizedFinding, BiologicalTheme, RunSynthesisPart, SynthesisPhase, SynthesisProgressPart, RunCompletedFinding, RunCompletedPart, RunFailedPart, ChildSessionStartedPart, ReportRenderedPart, CompactionPart, PauseCause, WorkKind, PausePart, ModelRetryPart, ModelRefusal, ModelRefusalPart, ChatPart, KnownChatPart, } from "./chat-parts.js";
6
+ export type { EventSource, TextDeltaEvent, IterationEvent, ToolStartedEvent, ToolFinishedEvent, ToolCallLeaf, ToolCallValue, FinishEvent, ChatErrorEvent, MessageStartEvent, ChatEvent, ChatFrame, ChatPartFrame, } from "./chat-events.js";
7
7
  export type { TokenUsageRollup } from "./usage.js";
8
8
  export { DATA_PROFILE_RUN_LITERAL } from "./data-profile.js";
9
9
  export type { DataProfileAxis, DataProfileChecked, DataProfileCompanionCompleteness, DataProfileCoverage, DataProfileDimension, DataProfileFile, DataProfileGroup, DataProfileGroupSlot, DataProfileInputSignature, DataProfileKind, DataProfileLifecycleStatus, DataProfileMemberAnnotation, DataProfileObservation, DataProfileOrganism, DataProfilePartition, DataProfileProbeReport, DataProfileQualityAssessment, DataProfileQuarantine, DataProfileRecipeStep, DataProfileResult, DataProfileSubjectSource, } from "./data-profile.js";
@@ -6,7 +6,7 @@
6
6
  * discriminant is `type`, so `switch (part.type) { case "data-child-session-started": ... }`
7
7
  * narrows the union member without any `as` cast.
8
8
  */
9
- import type { ToolCallDetail, ToolCallOutcome } from "./chat-events.js";
9
+ import type { ToolCallDetail, ToolCallOutcome, ToolCallValue } from "./chat-events.js";
10
10
  import type { ChatPart } from "./chat-parts.js";
11
11
  import type { TokenUsageRollup } from "./usage.js";
12
12
  /** A plain assistant/user text run. */
@@ -40,6 +40,12 @@ export type ToolCallPart = {
40
40
  detail?: ToolCallDetail;
41
41
  /** The time in milliseconds around the dispatch of the call, from `tool-finished`. Absent when no measurement was taken. */
42
42
  durationMs?: number;
43
+ /** See {@link ToolCallValue}. Absent when the tool declares no input view, and in a row stored without one. */
44
+ input?: ToolCallValue;
45
+ /** The shown result of a call with the outcome `ok`. Absent when the tool declares no result view, for each other outcome, and in a row stored without one. */
46
+ result?: ToolCallValue;
47
+ /** The shown error of a call with the outcome `error`. Absent when the tool declares no error view, for each other outcome, and in a row stored without one. */
48
+ error?: ToolCallValue;
43
49
  };
44
50
  /** The discriminated union of every part the chat path can carry. */
45
51
  export type MessagePart = TextPart | ToolCallPart | ChatPart;
@@ -24,6 +24,7 @@ export const PART_REGISTRY = {
24
24
  "data-compaction": { emitter: "conversation", consumer: "conversation", transient: true, reconciling: true },
25
25
  "data-pause": { emitter: "workflow", consumer: "conversation", transient: false, reconciling: true },
26
26
  "data-model-retry": { emitter: "conversation", consumer: "conversation", transient: true, reconciling: true },
27
+ "data-model-refusal": { emitter: "conversation", consumer: "conversation", transient: false, reconciling: false },
27
28
  };
28
29
  export function isTransient(type) {
29
30
  return PART_REGISTRY[type].transient;