@inflexa-ai/harness 0.44.0 → 0.45.1
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.
- package/dist/agents/conversation-agent.d.ts +10 -0
- package/dist/agents/conversation-agent.js +19 -1
- package/dist/agents/sandbox/shared.d.ts +23 -2
- package/dist/agents/sandbox/shared.js +51 -18
- package/dist/agents/sandbox/translational-safety-agent.js +26 -0
- package/dist/agents/sandbox/types.d.ts +24 -1
- package/dist/agents/sandbox-catalog.d.ts +14 -0
- package/dist/agents/sandbox-catalog.js +19 -0
- package/dist/app/approve-plan.d.ts +51 -0
- package/dist/app/approve-plan.js +84 -0
- package/dist/app/chat-turn.js +6 -3
- package/dist/app/data-profile-view.d.ts +1 -1
- package/dist/app/run-activity.js +4 -6
- package/dist/config/environment-stores.d.ts +4 -2
- package/dist/contracts/chat-events.d.ts +14 -2
- package/dist/contracts/chat-events.js +1 -1
- package/dist/contracts/chat-frame.d.ts +7 -0
- package/dist/contracts/chat-frame.js +24 -6
- package/dist/contracts/chat-parts.d.ts +73 -2
- package/dist/contracts/chat-parts.js +3 -1
- package/dist/contracts/index.d.ts +4 -2
- package/dist/contracts/index.js +1 -0
- package/dist/contracts/part-registry.js +3 -0
- package/dist/contracts/schemas/chat-events.d.ts +38 -0
- package/dist/contracts/schemas/chat-events.js +8 -0
- package/dist/contracts/schemas/chat-parts.d.ts +239 -15
- package/dist/contracts/schemas/chat-parts.js +80 -12
- package/dist/contracts/schemas/index.d.ts +2 -2
- package/dist/contracts/schemas/index.js +2 -2
- package/dist/contracts/subagent-activity.d.ts +12 -0
- package/dist/contracts/subagent-activity.js +76 -0
- package/dist/execution/artifact-metadata.js +1 -3
- package/dist/execution/dbos-workflow-purger.d.ts +2 -0
- package/dist/execution/dbos-workflow-purger.js +21 -14
- package/dist/execution/run-canceler.d.ts +33 -11
- package/dist/execution/run-canceler.js +130 -28
- package/dist/execution/run-end-record.d.ts +30 -0
- package/dist/execution/run-end-record.js +27 -0
- package/dist/execution/run-event-parts.d.ts +6 -5
- package/dist/execution/run-event-parts.js +6 -5
- package/dist/execution/run-event-stream.d.ts +18 -6
- package/dist/execution/run-event-stream.js +67 -17
- package/dist/execution/run-synthesis.d.ts +21 -0
- package/dist/execution/run-synthesis.js +77 -3
- package/dist/index.d.ts +28 -10
- package/dist/index.js +26 -2
- package/dist/lib/hooks.d.ts +1 -1
- package/dist/lib/metrics.d.ts +2 -2
- package/dist/loop/call-guard.d.ts +50 -0
- package/dist/loop/call-guard.js +90 -0
- package/dist/loop/compaction.d.ts +5 -0
- package/dist/loop/compaction.js +17 -0
- package/dist/loop/run-agent.d.ts +9 -0
- package/dist/loop/run-agent.js +16 -1
- package/dist/loop/run-to-terminal.js +4 -1
- package/dist/loop/types.d.ts +8 -0
- package/dist/memory/card-builders.d.ts +11 -0
- package/dist/memory/card-builders.js +35 -21
- package/dist/memory/conversation-display-recorder.d.ts +2 -2
- package/dist/memory/conversation-display-recorder.js +38 -4
- package/dist/memory/conversation-display-storage.d.ts +9 -2
- package/dist/memory/conversation-display-storage.js +18 -3
- package/dist/memory/thread-history.d.ts +42 -8
- package/dist/memory/thread-history.js +164 -45
- package/dist/memory/thread-store.d.ts +13 -0
- package/dist/memory/thread-store.js +15 -1
- package/dist/prompts/briefing.d.ts +57 -3
- package/dist/prompts/briefing.js +129 -2
- package/dist/prompts/conversation.d.ts +1 -1
- package/dist/prompts/conversation.js +3 -1
- package/dist/prompts/planner.js +13 -2
- package/dist/provenance/seam.d.ts +39 -20
- package/dist/provenance/seam.js +7 -5
- package/dist/providers/ai-sdk.js +93 -11
- package/dist/providers/types.d.ts +6 -0
- package/dist/reference-data/catalog.js +141 -2
- package/dist/report-model/authoring-grammar.d.ts +26 -26
- package/dist/report-model/pin-snapshot.d.ts +1 -1
- package/dist/report-model/pin-snapshot.js +2 -50
- package/dist/runtime/assemble.d.ts +8 -1
- package/dist/runtime/assemble.js +11 -0
- package/dist/runtime/boot.d.ts +3 -0
- package/dist/runtime/boot.js +10 -1
- package/dist/sandbox/image-packages.d.ts +26 -4
- package/dist/sandbox/image-packages.js +18 -4
- package/dist/sandbox/sandbox-step-translate.d.ts +23 -0
- package/dist/sandbox/sandbox-step-translate.js +24 -0
- package/dist/schemas/artifact-manifest.d.ts +1 -1
- package/dist/schemas/artifact-manifest.js +11 -9
- package/dist/schemas/data-profile-schemas.d.ts +12 -12
- package/dist/schemas/plan-schemas.d.ts +75 -21
- package/dist/schemas/plan-schemas.js +1 -1
- package/dist/schemas/run-synthesis.d.ts +2 -2
- package/dist/schemas/workflow-state.d.ts +113 -0
- package/dist/schemas/workflow-state.js +54 -0
- package/dist/state/analyses-metrics.d.ts +79 -7
- package/dist/state/analyses-metrics.js +141 -6
- package/dist/state/artifacts.d.ts +66 -3
- package/dist/state/artifacts.js +85 -7
- package/dist/state/data-profile.d.ts +4 -2
- package/dist/state/data-profile.js +7 -5
- package/dist/state/index.d.ts +9 -8
- package/dist/state/index.js +5 -5
- package/dist/state/migrations/20261012120000_index_the_runs_by_start.d.ts +8 -0
- package/dist/state/migrations/20261012120000_index_the_runs_by_start.js +12 -0
- package/dist/state/migrations/20261013120000_index_the_ended_runs_and_the_recent_threads.d.ts +8 -0
- package/dist/state/migrations/20261013120000_index_the_ended_runs_and_the_recent_threads.js +13 -0
- package/dist/state/migrations/20261013180000_narrow_the_active_run_index.d.ts +8 -0
- package/dist/state/migrations/20261013180000_narrow_the_active_run_index.js +13 -0
- package/dist/state/migrations/20261014120000_index_the_plans_by_parent_and_the_runs_by_plan.d.ts +8 -0
- package/dist/state/migrations/20261014120000_index_the_plans_by_parent_and_the_runs_by_plan.js +13 -0
- package/dist/state/migrations/index.js +8 -0
- package/dist/state/plans.d.ts +21 -0
- package/dist/state/plans.js +25 -0
- package/dist/state/runs.d.ts +79 -14
- package/dist/state/runs.js +150 -33
- package/dist/state/schema.d.ts +2 -0
- package/dist/state/step-executions.d.ts +9 -0
- package/dist/state/step-executions.js +22 -0
- package/dist/tasks/data-profile-activity.d.ts +7 -1
- package/dist/tasks/data-profile-activity.js +18 -9
- package/dist/tasks/data-profile.d.ts +15 -1
- package/dist/tasks/data-profile.js +16 -11
- package/dist/tools/ad-hoc-router.d.ts +2 -0
- package/dist/tools/ad-hoc-router.js +18 -2
- package/dist/tools/approval/gateway.js +28 -5
- package/dist/tools/capability-data.d.ts +36 -0
- package/dist/tools/capability-data.js +73 -0
- package/dist/tools/display/show-user.d.ts +1 -1
- package/dist/tools/execute-analysis.d.ts +80 -1
- package/dist/tools/execute-analysis.js +352 -110
- package/dist/tools/knowledge/check.d.ts +60 -0
- package/dist/tools/knowledge/check.js +92 -0
- package/dist/tools/knowledge/client.d.ts +382 -0
- package/dist/tools/knowledge/client.js +302 -0
- package/dist/tools/knowledge/environment.d.ts +78 -0
- package/dist/tools/knowledge/environment.js +105 -0
- package/dist/tools/knowledge/index.d.ts +49 -0
- package/dist/tools/knowledge/index.js +70 -0
- package/dist/tools/knowledge/local-slots.d.ts +62 -0
- package/dist/tools/knowledge/local-slots.js +177 -0
- package/dist/tools/knowledge/pin.d.ts +14 -0
- package/dist/tools/knowledge/pin.js +17 -0
- package/dist/tools/knowledge/recommend.d.ts +92 -0
- package/dist/tools/knowledge/recommend.js +98 -0
- package/dist/tools/knowledge/situation.d.ts +143 -0
- package/dist/tools/knowledge/situation.js +164 -0
- package/dist/tools/knowledge/skeleton.d.ts +69 -0
- package/dist/tools/knowledge/skeleton.js +202 -0
- package/dist/tools/knowledge/template.d.ts +137 -0
- package/dist/tools/knowledge/template.js +267 -0
- package/dist/tools/research/generate-plan.d.ts +23 -0
- package/dist/tools/research/generate-plan.js +203 -12
- package/dist/tools/research/guarded-address.d.ts +20 -0
- package/dist/tools/research/guarded-address.js +148 -0
- package/dist/tools/research/inspect-data-profile.d.ts +1 -1
- package/dist/tools/research/inspect-run.d.ts +1 -1
- package/dist/tools/research/inspect-run.js +7 -7
- package/dist/tools/research/searxng-engine.d.ts +40 -0
- package/dist/tools/research/searxng-engine.js +120 -0
- package/dist/tools/research/web-fetch.d.ts +124 -0
- package/dist/tools/research/web-fetch.js +627 -0
- package/dist/tools/research/web-search.d.ts +75 -0
- package/dist/tools/research/web-search.js +112 -0
- package/dist/tools/sandbox/list-available-packages.d.ts +7 -4
- package/dist/tools/sandbox/list-available-packages.js +12 -4
- package/dist/tools/sandbox/list-available-refs.d.ts +21 -0
- package/dist/tools/sandbox/list-available-refs.js +60 -3
- package/dist/tools/sandbox/report-blocker.js +5 -1
- package/dist/tools/terminal-text.d.ts +11 -0
- package/dist/tools/terminal-text.js +19 -0
- package/dist/tools/workspace/decision-record.d.ts +81 -0
- package/dist/tools/workspace/decision-record.js +117 -0
- package/dist/tools/workspace/edit-file.d.ts +3 -1
- package/dist/tools/workspace/edit-file.js +20 -2
- package/dist/tools/workspace/execute-command.d.ts +17 -0
- package/dist/tools/workspace/execute-command.js +28 -1
- package/dist/tools/workspace/index.d.ts +1 -0
- package/dist/tools/workspace/index.js +1 -0
- package/dist/tools/workspace/mutator.d.ts +1 -1
- package/dist/workflows/execute-analysis.d.ts +62 -21
- package/dist/workflows/execute-analysis.js +307 -79
- package/dist/workflows/plan/graph.d.ts +16 -0
- package/dist/workflows/plan/graph.js +36 -0
- package/dist/workflows/sandbox-step.d.ts +12 -0
- package/dist/workflows/sandbox-step.js +14 -12
- package/package.json +5 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Chat-stream events — the harness wire vocabulary.
|
|
3
3
|
*
|
|
4
|
-
* Distinct from the
|
|
4
|
+
* Distinct from the `data-*` chat parts (`chat-parts.ts`): those are UI
|
|
5
5
|
* presentation payloads a tool emits; these are the agent-loop stream events
|
|
6
6
|
* the host chat route frames as SSE. Together they are the sole
|
|
7
7
|
* host↔frontend wire contract — there is no AI SDK UI Message Stream
|
|
@@ -20,6 +20,8 @@ import type { TokenUsageRollup } from "./usage.js";
|
|
|
20
20
|
export interface EventSource {
|
|
21
21
|
agentId: string;
|
|
22
22
|
callPath: string[];
|
|
23
|
+
/** The id of the tool call that runs this loop. For a data profile, the workflow id of its attempt. */
|
|
24
|
+
invocationId?: string;
|
|
23
25
|
}
|
|
24
26
|
/** A run of assistant text. Deltas accumulate into the turn's reply. */
|
|
25
27
|
export interface TextDeltaEvent {
|
|
@@ -140,8 +142,18 @@ export interface ChatErrorEvent {
|
|
|
140
142
|
reason?: string;
|
|
141
143
|
source: EventSource;
|
|
142
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* The id that the stored display gives a message of the turn. The frames after it belong to that message, up to
|
|
147
|
+
* the next `message-start` of the same role.
|
|
148
|
+
*/
|
|
149
|
+
export interface MessageStartEvent {
|
|
150
|
+
type: "message-start";
|
|
151
|
+
messageId: string;
|
|
152
|
+
role: "user" | "assistant";
|
|
153
|
+
source: EventSource;
|
|
154
|
+
}
|
|
143
155
|
/** The discriminated union of all chat-stream events. */
|
|
144
|
-
export type ChatEvent = TextDeltaEvent | IterationEvent | ToolStartedEvent | ToolFinishedEvent | FinishEvent | ChatErrorEvent;
|
|
156
|
+
export type ChatEvent = TextDeltaEvent | IterationEvent | ToolStartedEvent | ToolFinishedEvent | FinishEvent | ChatErrorEvent | MessageStartEvent;
|
|
145
157
|
/** A `data-*` part as a frame, with the source of its emitter when the emitter stamped one. */
|
|
146
158
|
export type ChatPartFrame = ChatPart & {
|
|
147
159
|
source?: EventSource;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Chat-stream events — the harness wire vocabulary.
|
|
3
3
|
*
|
|
4
|
-
* Distinct from the
|
|
4
|
+
* Distinct from the `data-*` chat parts (`chat-parts.ts`): those are UI
|
|
5
5
|
* presentation payloads a tool emits; these are the agent-loop stream events
|
|
6
6
|
* the host chat route frames as SSE. Together they are the sole
|
|
7
7
|
* host↔frontend wire contract — there is no AI SDK UI Message Stream
|
|
@@ -16,6 +16,13 @@ export type ChatPartCheck = {
|
|
|
16
16
|
readonly ok: false;
|
|
17
17
|
readonly error: string;
|
|
18
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* The wire shape of a data part, `{ ...data, type }`, which is the flat shape of the part contracts. The chat stream
|
|
21
|
+
* and the run streams use this one rule.
|
|
22
|
+
*/
|
|
23
|
+
export declare function flattenDataPart(part: Pick<ChatDataPart, "type" | "data">): {
|
|
24
|
+
type: `data-${string}`;
|
|
25
|
+
} & Record<string, unknown>;
|
|
19
26
|
/**
|
|
20
27
|
* The frame of one emitted event, or `null` for `done` and for an `iteration` of the root agent. A frame of a sub-agent
|
|
21
28
|
* keeps its source, thus a consumer can filter it. A `text-delta` has no source, thus its frame gets `fallbackSource`,
|
|
@@ -3,7 +3,22 @@ import { isReconciling, PART_REGISTRY } from "./part-registry.js";
|
|
|
3
3
|
import { EventSourceSchema } from "./schemas/chat-events.js";
|
|
4
4
|
import { ChatPartSchema } from "./schemas/chat-parts.js";
|
|
5
5
|
function toSource(source) {
|
|
6
|
-
return {
|
|
6
|
+
return {
|
|
7
|
+
agentId: source.agentId,
|
|
8
|
+
callPath: [...source.callPath],
|
|
9
|
+
...(source.invocationId === undefined ? {} : { invocationId: source.invocationId }),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The wire shape of a data part, `{ ...data, type }`, which is the flat shape of the part contracts. The chat stream
|
|
14
|
+
* and the run streams use this one rule.
|
|
15
|
+
*/
|
|
16
|
+
export function flattenDataPart(part) {
|
|
17
|
+
// The payload is `unknown`, and the spread is not checked here. The chat stream checks each frame with `checkChatPart`.
|
|
18
|
+
// On the run stream the producer builds the payload with the fields of its part contract, and the synthesis-sink test
|
|
19
|
+
// parses the result with `RunSynthesisPartSchema`.
|
|
20
|
+
const data = (part.data ?? {});
|
|
21
|
+
return { ...data, type: part.type };
|
|
7
22
|
}
|
|
8
23
|
/**
|
|
9
24
|
* The frame of one emitted event, or `null` for `done` and for an `iteration` of the root agent. A frame of a sub-agent
|
|
@@ -38,11 +53,12 @@ export function toChatFrame(event, fallbackSource) {
|
|
|
38
53
|
};
|
|
39
54
|
case "text-delta":
|
|
40
55
|
return { type: "text-delta", text: event.text, source: toSource(fallbackSource) };
|
|
56
|
+
case "message-start":
|
|
57
|
+
return { type: "message-start", messageId: event.messageId, role: event.role, source: toSource(event.source) };
|
|
41
58
|
default: {
|
|
42
|
-
// A `ChatDataPart`, whose payload the emitter types as `unknown`. The wire part is flat: `{ type, ...data }`.
|
|
43
59
|
// The cast names the frame that the type claims. `checkChatPart` is the check.
|
|
44
|
-
const
|
|
45
|
-
return { ...
|
|
60
|
+
const part = flattenDataPart(event);
|
|
61
|
+
return { ...part, ...(event.source === undefined ? {} : { source: toSource(event.source) }) };
|
|
46
62
|
}
|
|
47
63
|
}
|
|
48
64
|
}
|
|
@@ -103,7 +119,7 @@ export function applyChatFrame(messages, frame, assistantId) {
|
|
|
103
119
|
if (frame.type === "error") {
|
|
104
120
|
return { messages, terminal: { error: frame } };
|
|
105
121
|
}
|
|
106
|
-
if (frame.type === "iteration")
|
|
122
|
+
if (frame.type === "iteration" || frame.type === "message-start")
|
|
107
123
|
return { messages, terminal: null };
|
|
108
124
|
const partFrame = frame;
|
|
109
125
|
const next = updateAssistant(messages, assistantId, (parts) => applyPartFrame(parts, partFrame));
|
|
@@ -143,9 +159,11 @@ function applyPartFrame(parts, frame) {
|
|
|
143
159
|
return started ? next : [...parts, finished];
|
|
144
160
|
}
|
|
145
161
|
default: {
|
|
162
|
+
// A chat event type that no case above takes is not a part frame, thus this annotation fails to compile.
|
|
163
|
+
const partFrame = frame;
|
|
146
164
|
// The source routes the frame, and it is not a field of the part. A rest type does not distribute over the
|
|
147
165
|
// union of the part frames, thus the cast names the part that remains.
|
|
148
|
-
const { source: _source, ...part } =
|
|
166
|
+
const { source: _source, ...part } = partFrame;
|
|
149
167
|
return upsertPart(parts, part);
|
|
150
168
|
}
|
|
151
169
|
}
|
|
@@ -5,13 +5,16 @@
|
|
|
5
5
|
* Categories:
|
|
6
6
|
* Presentation: data-presentation (agent-synthesized content),
|
|
7
7
|
* data-plan (plan by id), data-file-reference (files by path)
|
|
8
|
-
* Approval: data-ask (a tool's pending user-approval prompt)
|
|
8
|
+
* Approval: data-ask (a tool's pending user-approval prompt),
|
|
9
|
+
* data-plan-approval (the record of an approved plan)
|
|
9
10
|
* Compaction: data-compaction (a compaction of the conversation thread)
|
|
10
11
|
* Run lifecycle: run-started, dag-state, run-completed, run-failed, run-synthesis,
|
|
11
12
|
* synthesis-progress
|
|
12
13
|
* Per-step live: step-activity, step-file-tree
|
|
14
|
+
* Activity history: activity-entry (run stream), subagent-activity (conversation)
|
|
13
15
|
* Per-step final: step-output, step-summary, step-usage
|
|
14
16
|
*/
|
|
17
|
+
import type { ToolCallOutcome } from "./chat-events.js";
|
|
15
18
|
import type { TokenUsageRollup } from "./usage.js";
|
|
16
19
|
export interface PlanStep {
|
|
17
20
|
id: string;
|
|
@@ -78,6 +81,8 @@ export interface PlanPart {
|
|
|
78
81
|
type: "data-plan";
|
|
79
82
|
id: string;
|
|
80
83
|
planId: string;
|
|
84
|
+
/** The plan that this plan revised. Absent for a first plan. */
|
|
85
|
+
parentPlanId?: string;
|
|
81
86
|
title?: string;
|
|
82
87
|
steps?: PlanStep[];
|
|
83
88
|
analytical_narrative?: string;
|
|
@@ -92,6 +97,14 @@ export interface RunCardPart {
|
|
|
92
97
|
title: string;
|
|
93
98
|
stepCount: number;
|
|
94
99
|
}
|
|
100
|
+
export interface PlanApprovalPart {
|
|
101
|
+
type: "data-plan-approval";
|
|
102
|
+
planId: string;
|
|
103
|
+
/** The run that the approval started. */
|
|
104
|
+
runId: string;
|
|
105
|
+
/** ISO 8601. The instant of the approval, equal to the time of the `approve-plan` provenance event. */
|
|
106
|
+
approvedAt: string;
|
|
107
|
+
}
|
|
95
108
|
export interface FileReferenceEntry {
|
|
96
109
|
path: string;
|
|
97
110
|
runId?: string;
|
|
@@ -119,6 +132,8 @@ export interface AskPart {
|
|
|
119
132
|
/** Optional additional detail a surface may render. */
|
|
120
133
|
detail?: string;
|
|
121
134
|
status: "pending" | "resolved" | "rejected" | "aborted" | "expired";
|
|
135
|
+
/** The kind of the ledger reply. Only a `resolved` or `rejected` part carries it, and never the rejection feedback. */
|
|
136
|
+
reply?: "once" | "always" | "reject";
|
|
122
137
|
}
|
|
123
138
|
export interface RunStartedPart {
|
|
124
139
|
type: "data-run-started";
|
|
@@ -152,6 +167,8 @@ export interface DagStepState {
|
|
|
152
167
|
/** Error message (set on failure). */
|
|
153
168
|
error?: string;
|
|
154
169
|
}
|
|
170
|
+
/** One step of the stored plan graph: the fields of {@link DagStepState} that the plan alone fixes. */
|
|
171
|
+
export type PlanGraphStep = Pick<DagStepState, "id" | "name" | "agent" | "dependsOn" | "level">;
|
|
155
172
|
export interface DagStatePart {
|
|
156
173
|
type: "data-dag-state";
|
|
157
174
|
/** Stable ID for reconciliation — same across all updates for a run. */
|
|
@@ -176,6 +193,24 @@ export interface StepActivityPart {
|
|
|
176
193
|
phase: StepPhase;
|
|
177
194
|
/** Human-readable activity description (e.g., "Running DESeq2 analysis"). */
|
|
178
195
|
activity: string;
|
|
196
|
+
/** ISO 8601 time of the emission. Absent on a part that an older harness wrote. */
|
|
197
|
+
at?: string;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* One activity emission of a step or a data profile, kept in the run stream with no reconciliation. The fold
|
|
201
|
+
* delivers each entry in write order.
|
|
202
|
+
*/
|
|
203
|
+
export interface ActivityEntryPart {
|
|
204
|
+
type: "data-activity-entry";
|
|
205
|
+
/** Unique per emission within a stream. */
|
|
206
|
+
id: string;
|
|
207
|
+
runId: string;
|
|
208
|
+
stepId: string;
|
|
209
|
+
/** A `SynthesisPhase` for the entries of the synthesis step, a `StepPhase` for each other step. */
|
|
210
|
+
phase: StepPhase | SynthesisPhase;
|
|
211
|
+
activity: string;
|
|
212
|
+
/** ISO 8601 time of the emission. */
|
|
213
|
+
at: string;
|
|
179
214
|
}
|
|
180
215
|
export interface FileTreeEntry {
|
|
181
216
|
path: string;
|
|
@@ -290,6 +325,12 @@ export interface RunCompletedPart {
|
|
|
290
325
|
*/
|
|
291
326
|
usage?: TokenUsageRollup;
|
|
292
327
|
}
|
|
328
|
+
export interface FindingReference {
|
|
329
|
+
pmid: string;
|
|
330
|
+
citation: string;
|
|
331
|
+
relevance: string;
|
|
332
|
+
concordance: "supports" | "contradicts" | "extends" | "contextualizes";
|
|
333
|
+
}
|
|
293
334
|
export interface SynthesizedFinding {
|
|
294
335
|
stepId: string;
|
|
295
336
|
title: string;
|
|
@@ -297,6 +338,7 @@ export interface SynthesizedFinding {
|
|
|
297
338
|
confidence: "high" | "medium" | "low";
|
|
298
339
|
noveltyStatus: "novel" | "confirmed" | "partially_confirmed" | "contradicted" | "expected";
|
|
299
340
|
literatureInterpretation: string;
|
|
341
|
+
references: FindingReference[];
|
|
300
342
|
}
|
|
301
343
|
export interface BiologicalTheme {
|
|
302
344
|
name: string;
|
|
@@ -336,6 +378,8 @@ export interface SynthesisProgressPart {
|
|
|
336
378
|
phase: SynthesisPhase;
|
|
337
379
|
/** Human-readable activity description. */
|
|
338
380
|
activity: string;
|
|
381
|
+
/** ISO 8601 time of the emission. Absent in a stream that an older harness wrote. */
|
|
382
|
+
at?: string;
|
|
339
383
|
/** Number of literature-reviewer delegations started so far. */
|
|
340
384
|
delegationCount?: number;
|
|
341
385
|
/** Agent-provided reason — set when phase === "skipped". */
|
|
@@ -407,4 +451,31 @@ export interface CompactionPart {
|
|
|
407
451
|
/** Before the user message of a turn, or before a later request. */
|
|
408
452
|
trigger?: "turn-start" | "mid-turn";
|
|
409
453
|
}
|
|
410
|
-
|
|
454
|
+
/** One tool call of a sub-agent. It holds no input, no output, and no text of the sub-agent. */
|
|
455
|
+
export interface SubAgentActivityEntry {
|
|
456
|
+
agentId: string;
|
|
457
|
+
callPath: string[];
|
|
458
|
+
tool: string;
|
|
459
|
+
/** The one-line detail of the call, normalized, redacted, and capped by the loop. */
|
|
460
|
+
label?: string;
|
|
461
|
+
/** ISO 8601. */
|
|
462
|
+
startedAt: string;
|
|
463
|
+
/** ISO 8601. Absent while the call is in flight and for an `incomplete` call. */
|
|
464
|
+
endedAt?: string;
|
|
465
|
+
/** Absent while the call is in flight. A stored entry always has it. */
|
|
466
|
+
outcome?: ToolCallOutcome;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* The tool calls of the sub-agents below one root tool call. Re-emitted under the same `id` after each change,
|
|
470
|
+
* so reconciling readers keep the latest list.
|
|
471
|
+
*/
|
|
472
|
+
export interface SubAgentActivityPart {
|
|
473
|
+
type: "data-subagent-activity";
|
|
474
|
+
id: string;
|
|
475
|
+
/** The id of the root tool call. */
|
|
476
|
+
toolCallId: string;
|
|
477
|
+
entries: SubAgentActivityEntry[];
|
|
478
|
+
/** The count of calls past the cap of the entries. */
|
|
479
|
+
dropped: number;
|
|
480
|
+
}
|
|
481
|
+
export type ChatPart = PresentationPart | PlanPart | RunCardPart | PlanApprovalPart | FileReferencePart | AskPart | RunStartedPart | DagStatePart | StepActivityPart | ActivityEntryPart | SubAgentActivityPart | StepFileTreePart | StepOutputPart | StepSummaryPart | StepUsagePart | StepBlockedPart | RunSynthesisPart | SynthesisProgressPart | RunCompletedPart | RunFailedPart | ChildSessionStartedPart | ReportRenderedPart | CompactionPart;
|
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
* Categories:
|
|
6
6
|
* Presentation: data-presentation (agent-synthesized content),
|
|
7
7
|
* data-plan (plan by id), data-file-reference (files by path)
|
|
8
|
-
* Approval: data-ask (a tool's pending user-approval prompt)
|
|
8
|
+
* Approval: data-ask (a tool's pending user-approval prompt),
|
|
9
|
+
* data-plan-approval (the record of an approved plan)
|
|
9
10
|
* Compaction: data-compaction (a compaction of the conversation thread)
|
|
10
11
|
* Run lifecycle: run-started, dag-state, run-completed, run-failed, run-synthesis,
|
|
11
12
|
* synthesis-progress
|
|
12
13
|
* Per-step live: step-activity, step-file-tree
|
|
14
|
+
* Activity history: activity-entry (run stream), subagent-activity (conversation)
|
|
13
15
|
* Per-step final: step-output, step-summary, step-usage
|
|
14
16
|
*/
|
|
15
17
|
export {};
|
|
@@ -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, FileReferenceEntry, FileReferencePart, AskPart, RunStartedPart, StepStatus, DagStepState, DagStatePart, StepPhase, StepActivityPart, FileTreeEntry, StepFileTreePart, StepOutputFile, StepOutputPart, StepSummaryPart, StepUsagePart, StepBlockedPart, SynthesizedFinding, BiologicalTheme, RunSynthesisPart, SynthesisPhase, SynthesisProgressPart, RunCompletedFinding, RunCompletedPart, RunFailedPart, ChildSessionStartedPart, ReportRenderedPart, CompactionPart, ChatPart, } from "./chat-parts.js";
|
|
6
|
-
export type { EventSource, TextDeltaEvent, IterationEvent, ToolStartedEvent, ToolFinishedEvent, FinishEvent, ChatErrorEvent, 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, ChatPart, } from "./chat-parts.js";
|
|
6
|
+
export type { EventSource, TextDeltaEvent, IterationEvent, ToolStartedEvent, ToolFinishedEvent, 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";
|
|
@@ -12,6 +12,8 @@ export type { DimensionCategory, DimensionCategoryEntry, DimensionProbe, Dimensi
|
|
|
12
12
|
export type { TextPart, ToolCallPart, MessagePart, ChatMessage } from "./message.js";
|
|
13
13
|
export { toChatFrame, applyChatFrame, checkChatPart } from "./chat-frame.js";
|
|
14
14
|
export type { TurnTerminal, ApplyFrameResult, ChatPartCheck } from "./chat-frame.js";
|
|
15
|
+
export { createSubAgentActivityTracker, SUBAGENT_ACTIVITY_MAX_ENTRIES } from "./subagent-activity.js";
|
|
16
|
+
export type { SubAgentActivityTracker } from "./subagent-activity.js";
|
|
15
17
|
export { PART_REGISTRY, isTransient, isReconciling, isSidebarPart } from "./part-registry.js";
|
|
16
18
|
export type { ChatPartType, PartDescriptor, PartEmitter, PartConsumer } from "./part-registry.js";
|
|
17
19
|
export { AnalogyCoverageSchema, AnalogyReportSchema, AnalogyReportErrorSchema, AnalogicalReasonerOutputSchema } from "./analogy-report.js";
|
package/dist/contracts/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { SEVERITIES, SeveritySchema } from "./severity.js";
|
|
|
3
3
|
export { DATA_PROFILE_RUN_LITERAL } from "./data-profile.js";
|
|
4
4
|
export { DIMENSION_CATEGORIES, DIMENSION_CATEGORY_IDS, DIMENSION_PROBE_IDS, DIMENSION_PROBES, GROUP_CATEGORIES, GROUP_CATEGORY_IDS, GROUP_ROLE_IDS, GROUP_ROLES, PROBE_OUTCOME_IDS, dimensionCategoryEntry, dimensionScope, groupCategoryEntry, } from "./profile-vocabulary.js";
|
|
5
5
|
export { toChatFrame, applyChatFrame, checkChatPart } from "./chat-frame.js";
|
|
6
|
+
export { createSubAgentActivityTracker, SUBAGENT_ACTIVITY_MAX_ENTRIES } from "./subagent-activity.js";
|
|
6
7
|
export { PART_REGISTRY, isTransient, isReconciling, isSidebarPart } from "./part-registry.js";
|
|
7
8
|
export { AnalogyCoverageSchema, AnalogyReportSchema, AnalogyReportErrorSchema, AnalogicalReasonerOutputSchema } from "./analogy-report.js";
|
|
8
9
|
export { buildReportSessionUrl, reportSessionResourceId } from "./content-url.js";
|
|
@@ -2,11 +2,14 @@ export const PART_REGISTRY = {
|
|
|
2
2
|
"data-presentation": { emitter: "conversation", consumer: "conversation", transient: false, reconciling: false },
|
|
3
3
|
"data-plan": { emitter: "conversation", consumer: "conversation", transient: false, reconciling: false },
|
|
4
4
|
"data-run-card": { emitter: "conversation", consumer: "conversation", transient: false, reconciling: false },
|
|
5
|
+
"data-plan-approval": { emitter: "conversation", consumer: "conversation", transient: false, reconciling: false },
|
|
5
6
|
"data-file-reference": { emitter: "conversation", consumer: "conversation", transient: false, reconciling: false },
|
|
6
7
|
"data-ask": { emitter: "conversation", consumer: "conversation", transient: false, reconciling: true },
|
|
7
8
|
"data-run-started": { emitter: "workflow", consumer: "sidebar", transient: true, reconciling: false },
|
|
8
9
|
"data-dag-state": { emitter: "workflow", consumer: "sidebar", transient: false, reconciling: true },
|
|
9
10
|
"data-step-activity": { emitter: "workflow", consumer: "sidebar", transient: true, reconciling: true },
|
|
11
|
+
"data-activity-entry": { emitter: "workflow", consumer: "sidebar", transient: false, reconciling: false },
|
|
12
|
+
"data-subagent-activity": { emitter: "conversation", consumer: "conversation", transient: false, reconciling: true },
|
|
10
13
|
"data-step-file-tree": { emitter: "workflow", consumer: "sidebar", transient: true, reconciling: true },
|
|
11
14
|
"data-step-output": { emitter: "workflow", consumer: "sidebar", transient: false, reconciling: false },
|
|
12
15
|
"data-step-summary": { emitter: "workflow", consumer: "sidebar", transient: false, reconciling: false },
|
|
@@ -5,6 +5,7 @@ import { z } from "zod";
|
|
|
5
5
|
export declare const EventSourceSchema: z.ZodObject<{
|
|
6
6
|
agentId: z.ZodString;
|
|
7
7
|
callPath: z.ZodArray<z.ZodString>;
|
|
8
|
+
invocationId: z.ZodOptional<z.ZodString>;
|
|
8
9
|
}, z.core.$strip>;
|
|
9
10
|
export declare const TextDeltaEventSchema: z.ZodObject<{
|
|
10
11
|
type: z.ZodLiteral<"text-delta">;
|
|
@@ -12,6 +13,7 @@ export declare const TextDeltaEventSchema: z.ZodObject<{
|
|
|
12
13
|
source: z.ZodObject<{
|
|
13
14
|
agentId: z.ZodString;
|
|
14
15
|
callPath: z.ZodArray<z.ZodString>;
|
|
16
|
+
invocationId: z.ZodOptional<z.ZodString>;
|
|
15
17
|
}, z.core.$strip>;
|
|
16
18
|
}, z.core.$strip>;
|
|
17
19
|
export declare const IterationEventSchema: z.ZodObject<{
|
|
@@ -19,6 +21,7 @@ export declare const IterationEventSchema: z.ZodObject<{
|
|
|
19
21
|
source: z.ZodObject<{
|
|
20
22
|
agentId: z.ZodString;
|
|
21
23
|
callPath: z.ZodArray<z.ZodString>;
|
|
24
|
+
invocationId: z.ZodOptional<z.ZodString>;
|
|
22
25
|
}, z.core.$strip>;
|
|
23
26
|
}, z.core.$strip>;
|
|
24
27
|
/** Mirrors the `ToolOutcome` union — three states, never a boolean. */
|
|
@@ -42,6 +45,7 @@ export declare const ToolStartedEventSchema: z.ZodObject<{
|
|
|
42
45
|
source: z.ZodObject<{
|
|
43
46
|
agentId: z.ZodString;
|
|
44
47
|
callPath: z.ZodArray<z.ZodString>;
|
|
48
|
+
invocationId: z.ZodOptional<z.ZodString>;
|
|
45
49
|
}, z.core.$strip>;
|
|
46
50
|
}, z.core.$strip>;
|
|
47
51
|
export declare const ToolFinishedEventSchema: z.ZodObject<{
|
|
@@ -58,6 +62,7 @@ export declare const ToolFinishedEventSchema: z.ZodObject<{
|
|
|
58
62
|
source: z.ZodObject<{
|
|
59
63
|
agentId: z.ZodString;
|
|
60
64
|
callPath: z.ZodArray<z.ZodString>;
|
|
65
|
+
invocationId: z.ZodOptional<z.ZodString>;
|
|
61
66
|
}, z.core.$strip>;
|
|
62
67
|
}, z.core.$strip>;
|
|
63
68
|
export declare const FinishEventSchema: z.ZodObject<{
|
|
@@ -65,6 +70,7 @@ export declare const FinishEventSchema: z.ZodObject<{
|
|
|
65
70
|
source: z.ZodObject<{
|
|
66
71
|
agentId: z.ZodString;
|
|
67
72
|
callPath: z.ZodArray<z.ZodString>;
|
|
73
|
+
invocationId: z.ZodOptional<z.ZodString>;
|
|
68
74
|
}, z.core.$strip>;
|
|
69
75
|
usage: z.ZodOptional<z.ZodObject<{
|
|
70
76
|
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
@@ -88,6 +94,20 @@ export declare const ChatErrorEventSchema: z.ZodObject<{
|
|
|
88
94
|
source: z.ZodObject<{
|
|
89
95
|
agentId: z.ZodString;
|
|
90
96
|
callPath: z.ZodArray<z.ZodString>;
|
|
97
|
+
invocationId: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
export declare const MessageStartEventSchema: z.ZodObject<{
|
|
101
|
+
type: z.ZodLiteral<"message-start">;
|
|
102
|
+
messageId: z.ZodUUID;
|
|
103
|
+
role: z.ZodEnum<{
|
|
104
|
+
assistant: "assistant";
|
|
105
|
+
user: "user";
|
|
106
|
+
}>;
|
|
107
|
+
source: z.ZodObject<{
|
|
108
|
+
agentId: z.ZodString;
|
|
109
|
+
callPath: z.ZodArray<z.ZodString>;
|
|
110
|
+
invocationId: z.ZodOptional<z.ZodString>;
|
|
91
111
|
}, z.core.$strip>;
|
|
92
112
|
}, z.core.$strip>;
|
|
93
113
|
export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -96,12 +116,14 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
96
116
|
source: z.ZodObject<{
|
|
97
117
|
agentId: z.ZodString;
|
|
98
118
|
callPath: z.ZodArray<z.ZodString>;
|
|
119
|
+
invocationId: z.ZodOptional<z.ZodString>;
|
|
99
120
|
}, z.core.$strip>;
|
|
100
121
|
}, z.core.$strip>, z.ZodObject<{
|
|
101
122
|
type: z.ZodLiteral<"iteration">;
|
|
102
123
|
source: z.ZodObject<{
|
|
103
124
|
agentId: z.ZodString;
|
|
104
125
|
callPath: z.ZodArray<z.ZodString>;
|
|
126
|
+
invocationId: z.ZodOptional<z.ZodString>;
|
|
105
127
|
}, z.core.$strip>;
|
|
106
128
|
}, z.core.$strip>, z.ZodObject<{
|
|
107
129
|
type: z.ZodLiteral<"tool-started">;
|
|
@@ -111,6 +133,7 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
111
133
|
source: z.ZodObject<{
|
|
112
134
|
agentId: z.ZodString;
|
|
113
135
|
callPath: z.ZodArray<z.ZodString>;
|
|
136
|
+
invocationId: z.ZodOptional<z.ZodString>;
|
|
114
137
|
}, z.core.$strip>;
|
|
115
138
|
}, z.core.$strip>, z.ZodObject<{
|
|
116
139
|
type: z.ZodLiteral<"tool-finished">;
|
|
@@ -126,12 +149,14 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
126
149
|
source: z.ZodObject<{
|
|
127
150
|
agentId: z.ZodString;
|
|
128
151
|
callPath: z.ZodArray<z.ZodString>;
|
|
152
|
+
invocationId: z.ZodOptional<z.ZodString>;
|
|
129
153
|
}, z.core.$strip>;
|
|
130
154
|
}, z.core.$strip>, z.ZodObject<{
|
|
131
155
|
type: z.ZodLiteral<"finish">;
|
|
132
156
|
source: z.ZodObject<{
|
|
133
157
|
agentId: z.ZodString;
|
|
134
158
|
callPath: z.ZodArray<z.ZodString>;
|
|
159
|
+
invocationId: z.ZodOptional<z.ZodString>;
|
|
135
160
|
}, z.core.$strip>;
|
|
136
161
|
usage: z.ZodOptional<z.ZodObject<{
|
|
137
162
|
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
@@ -154,5 +179,18 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
154
179
|
source: z.ZodObject<{
|
|
155
180
|
agentId: z.ZodString;
|
|
156
181
|
callPath: z.ZodArray<z.ZodString>;
|
|
182
|
+
invocationId: z.ZodOptional<z.ZodString>;
|
|
183
|
+
}, z.core.$strip>;
|
|
184
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
185
|
+
type: z.ZodLiteral<"message-start">;
|
|
186
|
+
messageId: z.ZodUUID;
|
|
187
|
+
role: z.ZodEnum<{
|
|
188
|
+
assistant: "assistant";
|
|
189
|
+
user: "user";
|
|
190
|
+
}>;
|
|
191
|
+
source: z.ZodObject<{
|
|
192
|
+
agentId: z.ZodString;
|
|
193
|
+
callPath: z.ZodArray<z.ZodString>;
|
|
194
|
+
invocationId: z.ZodOptional<z.ZodString>;
|
|
157
195
|
}, z.core.$strip>;
|
|
158
196
|
}, z.core.$strip>], "type">;
|
|
@@ -6,6 +6,7 @@ import { TokenUsageRollupSchema } from "./usage.js";
|
|
|
6
6
|
export const EventSourceSchema = z.object({
|
|
7
7
|
agentId: z.string(),
|
|
8
8
|
callPath: z.array(z.string()),
|
|
9
|
+
invocationId: z.string().optional(),
|
|
9
10
|
});
|
|
10
11
|
export const TextDeltaEventSchema = z.object({
|
|
11
12
|
type: z.literal("text-delta"),
|
|
@@ -49,6 +50,12 @@ export const ChatErrorEventSchema = z.object({
|
|
|
49
50
|
reason: z.string().optional(),
|
|
50
51
|
source: EventSourceSchema,
|
|
51
52
|
});
|
|
53
|
+
export const MessageStartEventSchema = z.object({
|
|
54
|
+
type: z.literal("message-start"),
|
|
55
|
+
messageId: z.uuid(),
|
|
56
|
+
role: z.enum(["user", "assistant"]),
|
|
57
|
+
source: EventSourceSchema,
|
|
58
|
+
});
|
|
52
59
|
export const ChatEventSchema = z.discriminatedUnion("type", [
|
|
53
60
|
TextDeltaEventSchema,
|
|
54
61
|
IterationEventSchema,
|
|
@@ -56,4 +63,5 @@ export const ChatEventSchema = z.discriminatedUnion("type", [
|
|
|
56
63
|
ToolFinishedEventSchema,
|
|
57
64
|
FinishEventSchema,
|
|
58
65
|
ChatErrorEventSchema,
|
|
66
|
+
MessageStartEventSchema,
|
|
59
67
|
]);
|