@inflexa-ai/harness 0.23.0 → 0.24.0
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/README.md +1 -2
- package/dist/agents/conversation-agent.d.ts +0 -9
- package/dist/contracts/chat-parts.d.ts +29 -33
- package/dist/contracts/content-url.d.ts +7 -41
- package/dist/contracts/content-url.js +7 -48
- package/dist/contracts/index.d.ts +2 -2
- package/dist/contracts/index.js +1 -1
- package/dist/contracts/message.d.ts +1 -1
- package/dist/contracts/message.js +1 -1
- package/dist/contracts/part-registry.js +2 -3
- package/dist/contracts/schemas/chat-parts.d.ts +16 -53
- package/dist/contracts/schemas/chat-parts.js +15 -25
- package/dist/contracts/schemas/index.d.ts +1 -1
- package/dist/contracts/schemas/index.js +1 -1
- package/dist/execution/run-authorizer.d.ts +1 -1
- package/dist/execution/run-authorizer.js +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.js +0 -2
- package/dist/lib/zod-issues.d.ts +2 -3
- package/dist/lib/zod-issues.js +2 -3
- package/dist/loop/__fixtures__/scripted-provider.js +3 -1
- package/dist/loop/run-agent.d.ts +5 -0
- package/dist/loop/run-agent.js +10 -1
- package/dist/loop/run-to-terminal.d.ts +1 -1
- package/dist/loop/run-to-terminal.js +1 -1
- package/dist/memory/card-builders.d.ts +0 -27
- package/dist/memory/card-builders.js +0 -75
- package/dist/memory/conversation-display-backfill.d.ts +2 -4
- package/dist/memory/conversation-display-backfill.js +3 -9
- package/dist/memory/conversation-display-storage.d.ts +3 -4
- package/dist/memory/conversation-display-storage.js +3 -4
- package/dist/memory/reconstruct-cards.d.ts +5 -7
- package/dist/memory/reconstruct-cards.js +6 -20
- package/dist/runtime/boot.js +2 -12
- package/dist/tools/report-session/preview-report.d.ts +2 -1
- package/dist/tools/report-session/preview-report.js +9 -1
- package/dist/tools/start-report-session.js +2 -2
- package/dist/workspace/paths.d.ts +0 -21
- package/dist/workspace/paths.js +0 -37
- package/package.json +1 -3
- package/dist/agents/report-builder.d.ts +0 -34
- package/dist/agents/report-builder.js +0 -34
- package/dist/execution/report-render.d.ts +0 -39
- package/dist/execution/report-render.js +0 -98
- package/dist/execution/report-runner.d.ts +0 -111
- package/dist/execution/report-runner.js +0 -230
- package/dist/prompts/report-builder.d.ts +0 -1
- package/dist/prompts/report-builder.js +0 -174
- package/dist/tools/iterate-report.d.ts +0 -227
- package/dist/tools/iterate-report.js +0 -883
- package/dist/tools/lib/preview-lock.d.ts +0 -20
- package/dist/tools/lib/preview-lock.js +0 -35
- package/dist/tools/lib/report-preflight.d.ts +0 -39
- package/dist/tools/lib/report-preflight.js +0 -283
- package/dist/tools/report/build-report.d.ts +0 -13
- package/dist/tools/report/build-report.js +0 -27
- package/dist/tools/report/index.d.ts +0 -15
- package/dist/tools/report/index.js +0 -15
- package/dist/tools/report/mint-preview-url.d.ts +0 -26
- package/dist/tools/report/mint-preview-url.js +0 -47
- package/dist/tools/report/preview-publisher.d.ts +0 -53
- package/dist/tools/report/preview-publisher.js +0 -45
- package/dist/tools/report/preview-snapshot.d.ts +0 -34
- package/dist/tools/report/preview-snapshot.js +0 -98
- package/dist/tools/report/submit-report.d.ts +0 -26
- package/dist/tools/report/submit-report.js +0 -148
- package/dist/tools/report/version-fs.d.ts +0 -15
- package/dist/tools/report/version-fs.js +0 -165
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Report authoring tools for the conversation agent: `plan_report` + `submit_report`.
|
|
3
|
-
*
|
|
4
|
-
* WHY TWO TOOLS. The report brief (title/audience/sources plus the section
|
|
5
|
-
* union — narrative/metrics/figure/table/chart, each with its own
|
|
6
|
-
* encoding/transform/asset sub-fields) is a ~12k-char JSON schema. Every
|
|
7
|
-
* registered tool's schema ships on EVERY conversation turn, so parking that
|
|
8
|
-
* brief on an always-on tool would tax every turn for a tool used only when a
|
|
9
|
-
* report is actually built. We split the single former tool in two and deliver
|
|
10
|
-
* the heavy schema just-in-time:
|
|
11
|
-
*
|
|
12
|
-
* - `plan_report` — a tiny, always-on trigger (no-arg). Its `execute` RETURNS
|
|
13
|
-
* the brief schema (`z.toJSONSchema(ReportBriefSchema)`) plus the authoring
|
|
14
|
-
* rules as its tool RESULT, so the full contract enters context only on a
|
|
15
|
-
* report-building turn — and thereafter rides in the cached history prefix,
|
|
16
|
-
* not at full price on every request.
|
|
17
|
-
* - `submit_report` — takes the composed brief and does the real work
|
|
18
|
-
* (pre-flight staging, previewId/versioning, `runReportIteration`, preview
|
|
19
|
-
* publishing). It accepts the brief as `unknown` so the 12k schema stays off
|
|
20
|
-
* the always-on surface, then validates it against `ReportBriefSchema` INSIDE
|
|
21
|
-
* `execute`, returning `{ ok: false, issues }` as DATA the model can fix (not
|
|
22
|
-
* a thrown error). That is the same trade `validate_plan` makes: a runtime
|
|
23
|
-
* contract in exchange for keeping the schema out of every request. The small
|
|
24
|
-
* iterate-mode + common fields (modifications / previewId / baseVersion /
|
|
25
|
-
* sources / format) stay fully typed — they cost little and guide iteration.
|
|
26
|
-
*
|
|
27
|
-
* On a valid brief, `submit_report`'s behaviour is identical to the former
|
|
28
|
-
* `iterate_report`: two modes (Create v1 via `report`; Iterate v2+ via
|
|
29
|
-
* `modifications` + `previewId`), pre-flight stages every source into the
|
|
30
|
-
* preview's assets/ dir, and it emits a `data-report-preview` chat data part on
|
|
31
|
-
* success or `data-report-preview-failed` on pre-flight/builder failure. The
|
|
32
|
-
* hosted preview surface is reached through an injected `PreviewPublisher` seam
|
|
33
|
-
* (managed default mints a short-lived run-authorization grant; local default
|
|
34
|
-
* returns "unavailable"). The 4 custom report tools the builder drives are
|
|
35
|
-
* constructed inside `runReportIteration` — see design.md Decision #9.
|
|
36
|
-
*
|
|
37
|
-
* Naming note: the report-builder SUB-agent has its OWN same-id `submit_report`
|
|
38
|
-
* terminal tool (`tools/report/submit-report.ts`). The two never share a tool
|
|
39
|
-
* roster — this one is the conversation agent's brief-submission entry point;
|
|
40
|
-
* that one is the builder's finalize gate.
|
|
41
|
-
*/
|
|
42
|
-
import type { Pool } from "pg";
|
|
43
|
-
import { z } from "zod";
|
|
44
|
-
import type { ChatProvider } from "../providers/types.js";
|
|
45
|
-
import { type Tool } from "./define-tool.js";
|
|
46
|
-
import { type ResolveWorkspaceRoot } from "../workspace/paths.js";
|
|
47
|
-
import { type StagedAsset } from "./lib/report-preflight.js";
|
|
48
|
-
import type { PreviewPublisher } from "./report/preview-publisher.js";
|
|
49
|
-
import type { ChromeConfig } from "../lib/chrome.js";
|
|
50
|
-
import type { Logger } from "../lib/logger.js";
|
|
51
|
-
import type { UsageRecorder } from "../billing/usage-recorder.js";
|
|
52
|
-
/**
|
|
53
|
-
* The report brief the conversation agent composes: title/audience + sources +
|
|
54
|
-
* the section union. This is the ~12k-char schema that `plan_report` hands back
|
|
55
|
-
* just-in-time and that `submit_report` validates its `report` field against
|
|
56
|
-
* inside `execute`. Exported for `plan_report`, `submit_report`, and the
|
|
57
|
-
* brief-shape tests.
|
|
58
|
-
*/
|
|
59
|
-
export declare const ReportBriefSchema: z.ZodObject<{
|
|
60
|
-
title: z.ZodString;
|
|
61
|
-
audience: z.ZodString;
|
|
62
|
-
styleGuidance: z.ZodOptional<z.ZodString>;
|
|
63
|
-
sources: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
64
|
-
path: z.ZodString;
|
|
65
|
-
as: z.ZodOptional<z.ZodString>;
|
|
66
|
-
}, z.core.$strip>>>;
|
|
67
|
-
sections: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
68
|
-
type: z.ZodLiteral<"narrative">;
|
|
69
|
-
title: z.ZodString;
|
|
70
|
-
intent: z.ZodString;
|
|
71
|
-
content: z.ZodObject<{
|
|
72
|
-
prose: z.ZodString;
|
|
73
|
-
}, z.core.$strip>;
|
|
74
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
75
|
-
type: z.ZodLiteral<"metrics">;
|
|
76
|
-
title: z.ZodString;
|
|
77
|
-
intent: z.ZodString;
|
|
78
|
-
content: z.ZodObject<{
|
|
79
|
-
stats: z.ZodArray<z.ZodObject<{
|
|
80
|
-
label: z.ZodString;
|
|
81
|
-
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
82
|
-
unit: z.ZodOptional<z.ZodString>;
|
|
83
|
-
}, z.core.$strip>>;
|
|
84
|
-
}, z.core.$strip>;
|
|
85
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
86
|
-
type: z.ZodLiteral<"figure">;
|
|
87
|
-
title: z.ZodString;
|
|
88
|
-
intent: z.ZodString;
|
|
89
|
-
content: z.ZodObject<{
|
|
90
|
-
imageAsset: z.ZodString;
|
|
91
|
-
caption: z.ZodOptional<z.ZodString>;
|
|
92
|
-
}, z.core.$strip>;
|
|
93
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
94
|
-
type: z.ZodLiteral<"table">;
|
|
95
|
-
title: z.ZodString;
|
|
96
|
-
intent: z.ZodString;
|
|
97
|
-
content: z.ZodObject<{
|
|
98
|
-
dataAsset: z.ZodString;
|
|
99
|
-
columns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
100
|
-
topN: z.ZodOptional<z.ZodNumber>;
|
|
101
|
-
sortBy: z.ZodOptional<z.ZodObject<{
|
|
102
|
-
column: z.ZodString;
|
|
103
|
-
order: z.ZodEnum<{
|
|
104
|
-
desc: "desc";
|
|
105
|
-
asc: "asc";
|
|
106
|
-
}>;
|
|
107
|
-
}, z.core.$strip>>;
|
|
108
|
-
transform: z.ZodOptional<z.ZodString>;
|
|
109
|
-
caption: z.ZodOptional<z.ZodString>;
|
|
110
|
-
}, z.core.$strip>;
|
|
111
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
112
|
-
type: z.ZodLiteral<"chart">;
|
|
113
|
-
title: z.ZodString;
|
|
114
|
-
intent: z.ZodString;
|
|
115
|
-
content: z.ZodObject<{
|
|
116
|
-
dataAsset: z.ZodOptional<z.ZodString>;
|
|
117
|
-
data: z.ZodOptional<z.ZodObject<{
|
|
118
|
-
columns: z.ZodArray<z.ZodString>;
|
|
119
|
-
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>>;
|
|
120
|
-
source: z.ZodString;
|
|
121
|
-
}, z.core.$strip>>;
|
|
122
|
-
chartType: z.ZodEnum<{
|
|
123
|
-
bar: "bar";
|
|
124
|
-
line: "line";
|
|
125
|
-
scatter: "scatter";
|
|
126
|
-
histogram: "histogram";
|
|
127
|
-
box: "box";
|
|
128
|
-
heatmap: "heatmap";
|
|
129
|
-
pie: "pie";
|
|
130
|
-
}>;
|
|
131
|
-
encoding: z.ZodObject<{
|
|
132
|
-
x: z.ZodOptional<z.ZodString>;
|
|
133
|
-
y: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
134
|
-
group: z.ZodOptional<z.ZodString>;
|
|
135
|
-
value: z.ZodOptional<z.ZodString>;
|
|
136
|
-
}, z.core.$strip>;
|
|
137
|
-
topN: z.ZodOptional<z.ZodNumber>;
|
|
138
|
-
sortBy: z.ZodOptional<z.ZodObject<{
|
|
139
|
-
column: z.ZodString;
|
|
140
|
-
order: z.ZodEnum<{
|
|
141
|
-
desc: "desc";
|
|
142
|
-
asc: "asc";
|
|
143
|
-
}>;
|
|
144
|
-
}, z.core.$strip>>;
|
|
145
|
-
transform: z.ZodOptional<z.ZodString>;
|
|
146
|
-
caption: z.ZodOptional<z.ZodString>;
|
|
147
|
-
}, z.core.$strip>;
|
|
148
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
149
|
-
type: z.ZodLiteral<"methods">;
|
|
150
|
-
title: z.ZodString;
|
|
151
|
-
intent: z.ZodString;
|
|
152
|
-
content: z.ZodObject<{
|
|
153
|
-
prose: z.ZodString;
|
|
154
|
-
}, z.core.$strip>;
|
|
155
|
-
}, z.core.$strip>], "type">>;
|
|
156
|
-
}, z.core.$strip>;
|
|
157
|
-
/**
|
|
158
|
-
* `submit_report`'s always-on input surface. The heavy brief rides in `report`
|
|
159
|
-
* as `unknown` — typed that way ON PURPOSE so the ~12k `ReportBriefSchema` does
|
|
160
|
-
* NOT ship on every conversation turn; `execute` validates it against
|
|
161
|
-
* `ReportBriefSchema` and returns issues as data. The iterate-mode + common
|
|
162
|
-
* fields stay fully typed (they are small and guide iteration). Exported for
|
|
163
|
-
* the envelope-validation tests.
|
|
164
|
-
*/
|
|
165
|
-
export declare const submitReportInputSchema: z.ZodObject<{
|
|
166
|
-
previewId: z.ZodOptional<z.ZodString>;
|
|
167
|
-
baseVersion: z.ZodOptional<z.ZodNumber>;
|
|
168
|
-
format: z.ZodDefault<z.ZodEnum<{
|
|
169
|
-
html: "html";
|
|
170
|
-
}>>;
|
|
171
|
-
report: z.ZodOptional<z.ZodUnknown>;
|
|
172
|
-
modifications: z.ZodOptional<z.ZodString>;
|
|
173
|
-
sources: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
174
|
-
path: z.ZodString;
|
|
175
|
-
as: z.ZodOptional<z.ZodString>;
|
|
176
|
-
}, z.core.$strip>>>;
|
|
177
|
-
}, z.core.$strip>;
|
|
178
|
-
/**
|
|
179
|
-
* `plan_report` — the tiny, always-on trigger (no args). Its result delivers
|
|
180
|
-
* the brief schema + authoring rules just-in-time, so the ~12k contract enters
|
|
181
|
-
* context only on a report-building turn (and thereafter rides in the cached
|
|
182
|
-
* history prefix). Compose the brief from what it returns, then call
|
|
183
|
-
* `submit_report`. Pure logic, no deps — hence a module-scope leaf tool.
|
|
184
|
-
*/
|
|
185
|
-
export declare const planReportTool: Tool;
|
|
186
|
-
export interface SubmitReportDeps {
|
|
187
|
-
/** Operational logging seam; omitted falls back to no-op. */
|
|
188
|
-
readonly logger?: Logger;
|
|
189
|
-
readonly provider: ChatProvider;
|
|
190
|
-
readonly pool: Pool;
|
|
191
|
-
/** Embedder-supplied workspace-root resolution seam (see workspace/paths.ts). */
|
|
192
|
-
readonly resolveWorkspaceRoot: ResolveWorkspaceRoot;
|
|
193
|
-
/** Model id — provenance / metric label; provider owns the wire model. */
|
|
194
|
-
readonly model: string;
|
|
195
|
-
/** Root templates dir; report-runner joins `report-html`. */
|
|
196
|
-
readonly templatesDir: string;
|
|
197
|
-
/** Skills root; report-runner gives the report-builder `report-html` skill tools. */
|
|
198
|
-
readonly skillsDir: string;
|
|
199
|
-
readonly chrome: ChromeConfig;
|
|
200
|
-
/**
|
|
201
|
-
* Builds the preview-publishing seam for this iteration. A managed
|
|
202
|
-
* embedder's realization mints a short-lived access grant + client eagerly
|
|
203
|
-
* at iteration start; the local default returns an "unavailable" publisher.
|
|
204
|
-
* Rejection (e.g. grant-mint failure) surfaces as a failed-preview tool result.
|
|
205
|
-
*/
|
|
206
|
-
readonly createPreviewPublisher: (args: {
|
|
207
|
-
session: import("../auth/types.js").AgentSession;
|
|
208
|
-
resourceId: string;
|
|
209
|
-
runId: string;
|
|
210
|
-
previewId: string;
|
|
211
|
-
ttlSeconds: number;
|
|
212
|
-
}) => Promise<PreviewPublisher>;
|
|
213
|
-
/** LLM usage-accounting seam for the report-builder loop; omitted falls back to the no-op recorder. */
|
|
214
|
-
readonly usageRecorder?: UsageRecorder;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* `submit_report` — takes the composed brief and drives the report iteration.
|
|
218
|
-
* On a valid brief its behaviour is byte-for-byte the former `iterate_report`:
|
|
219
|
-
* pre-flight staging, previewId/versioning, `runReportIteration`, preview
|
|
220
|
-
* publishing. The brief rides as `unknown` on the wire (keeping its ~12k schema
|
|
221
|
-
* off the always-on surface) and is validated against `ReportBriefSchema` here.
|
|
222
|
-
*/
|
|
223
|
-
export declare function createReportSubmitTool(deps: SubmitReportDeps): Tool;
|
|
224
|
-
/** Exported for unit tests — pipe-escape correctness. */
|
|
225
|
-
export declare function stagedAssetsBlock(staged: StagedAsset[], opts?: {
|
|
226
|
-
newOnly?: boolean;
|
|
227
|
-
}): string;
|