@inflexa-ai/harness 0.20.0 → 0.21.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/dist/agents/conversation-agent.d.ts +26 -14
- package/dist/agents/conversation-agent.js +12 -23
- package/dist/agents/report-session-agent.d.ts +31 -5
- package/dist/agents/report-session-agent.js +31 -6
- package/dist/app/chat-turn.js +3 -1
- package/dist/app/message-assembly.d.ts +15 -1
- package/dist/app/message-assembly.js +22 -8
- package/dist/app/report-session-runtime.d.ts +21 -4
- package/dist/app/report-session-runtime.js +53 -6
- package/dist/app/spawn-report-session.d.ts +174 -17
- package/dist/app/spawn-report-session.js +233 -21
- package/dist/contracts/chat-events.d.ts +7 -2
- package/dist/contracts/message.d.ts +10 -0
- package/dist/contracts/report-blocks.d.ts +743 -19
- package/dist/contracts/report-blocks.js +186 -11
- package/dist/contracts/report-reference.d.ts +88 -0
- package/dist/contracts/report-reference.js +48 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +20 -0
- package/dist/lib/chrome.d.ts +26 -6
- package/dist/lib/chrome.js +99 -32
- package/dist/lib/eyes.d.ts +57 -0
- package/dist/lib/eyes.js +45 -0
- package/dist/lib/page-capture.d.ts +14 -0
- package/dist/lib/page-capture.js +56 -2
- package/dist/loop/run-agent.js +58 -23
- package/dist/loop/tool-detail.d.ts +19 -2
- package/dist/loop/tool-detail.js +35 -2
- package/dist/memory/content-to-cortex.d.ts +3 -2
- package/dist/memory/content-to-cortex.js +21 -12
- package/dist/memory/conversation-display-replay.js +14 -7
- package/dist/memory/thread-history.d.ts +60 -3
- package/dist/memory/thread-history.js +55 -16
- package/dist/memory/thread-store.d.ts +11 -1
- package/dist/memory/thread-store.js +12 -2
- package/dist/prompts/conversation.d.ts +1 -1
- package/dist/prompts/conversation.js +23 -6
- package/dist/prompts/report-session.d.ts +1 -1
- package/dist/prompts/report-session.js +183 -9
- package/dist/report-model/authoring-grammar.d.ts +463 -0
- package/dist/report-model/authoring-grammar.js +77 -0
- package/dist/report-model/block-walk.d.ts +57 -14
- package/dist/report-model/block-walk.js +116 -11
- package/dist/report-model/draft-finish.d.ts +22 -4
- package/dist/report-model/draft-finish.js +39 -7
- package/dist/report-model/draft-operations.d.ts +3 -0
- package/dist/report-model/draft-operations.js +19 -5
- package/dist/report-model/draft-read.d.ts +8 -5
- package/dist/report-model/draft-read.js +21 -5
- package/dist/report-model/fixture-resolver.js +15 -4
- package/dist/report-model/pin-snapshot.d.ts +24 -6
- package/dist/report-model/pin-snapshot.js +204 -6
- package/dist/report-model/production-resolver.js +15 -4
- package/dist/report-model/reference-resolver.d.ts +50 -1
- package/dist/report-model/reference-resolver.js +94 -1
- package/dist/report-model/reference-stamp.d.ts +45 -0
- package/dist/report-model/reference-stamp.js +173 -0
- package/dist/report-model/structural-validation.d.ts +4 -1
- package/dist/report-model/structural-validation.js +48 -3
- package/dist/report-model/validate.d.ts +1 -1
- package/dist/report-model/validate.js +1 -1
- package/dist/report-render/asset-lookup.d.ts +19 -0
- package/dist/report-render/asset-lookup.js +37 -0
- package/dist/report-render/assets.d.ts +45 -1
- package/dist/report-render/assets.js +65 -6
- package/dist/report-render/chart-presets.d.ts +102 -0
- package/dist/report-render/chart-presets.js +205 -0
- package/dist/report-render/chart.d.ts +112 -10
- package/dist/report-render/chart.js +1164 -41
- package/dist/report-render/design.d.ts +99 -0
- package/dist/report-render/design.js +289 -107
- package/dist/report-render/number-format.d.ts +117 -0
- package/dist/report-render/number-format.js +479 -0
- package/dist/report-render/page.d.ts +121 -5
- package/dist/report-render/page.js +689 -7
- package/dist/report-render/references.d.ts +70 -16
- package/dist/report-render/references.js +54 -22
- package/dist/report-render/render.d.ts +23 -5
- package/dist/report-render/render.js +81 -22
- package/dist/report-render/table-data.d.ts +92 -0
- package/dist/report-render/table-data.js +129 -0
- package/dist/report-render/types.d.ts +15 -0
- package/dist/report-render/value-bridge.js +6 -2
- package/dist/report-render/views/chart-view.d.ts +12 -5
- package/dist/report-render/views/chart-view.js +14 -8
- package/dist/report-render/views/page-view.d.ts +36 -15
- package/dist/report-render/views/page-view.js +45 -23
- package/dist/report-render/views/prose.d.ts +12 -2
- package/dist/report-render/views/prose.js +29 -7
- package/dist/report-render/views/references-view.d.ts +22 -8
- package/dist/report-render/views/references-view.js +101 -13
- package/dist/report-render/views/values.d.ts +128 -13
- package/dist/report-render/views/values.js +199 -18
- package/dist/runtime/assemble.d.ts +39 -5
- package/dist/runtime/assemble.js +47 -6
- package/dist/sandbox/client.d.ts +10 -1
- package/dist/sandbox/create-sandbox.d.ts +9 -4
- package/dist/sandbox/create-sandbox.js +22 -16
- package/dist/sandbox/docker-client.js +10 -7
- package/dist/sandbox/mount-plan.d.ts +45 -7
- package/dist/sandbox/mount-plan.js +43 -5
- package/dist/sandbox/types.d.ts +6 -0
- package/dist/state/init.js +38 -9
- package/dist/state/report-session-state.d.ts +42 -1
- package/dist/state/report-session-state.js +70 -2
- package/dist/state/report-versions.d.ts +22 -17
- package/dist/state/report-versions.js +48 -35
- package/dist/state/snapshot-parse.js +16 -1
- package/dist/tools/define-tool.d.ts +32 -0
- package/dist/tools/define-tool.js +4 -0
- package/dist/tools/detail-resolver.d.ts +7 -2
- package/dist/tools/detail-resolver.js +7 -2
- package/dist/tools/iterate-report.d.ts +1 -1
- package/dist/tools/report/preview-snapshot.js +1 -0
- package/dist/tools/report-authoring/authoring-tools.d.ts +15 -6
- package/dist/tools/report-authoring/authoring-tools.js +99 -18
- package/dist/tools/report-session/derive-table.d.ts +162 -0
- package/dist/tools/report-session/derive-table.js +459 -0
- package/dist/tools/report-session/examine-page.d.ts +48 -18
- package/dist/tools/report-session/examine-page.js +204 -24
- package/dist/tools/report-session/index.d.ts +2 -0
- package/dist/tools/report-session/index.js +2 -0
- package/dist/tools/report-session/list-artifacts.d.ts +97 -0
- package/dist/tools/report-session/list-artifacts.js +197 -0
- package/dist/tools/report-session/preview-report.d.ts +6 -0
- package/dist/tools/report-session/preview-report.js +180 -28
- package/dist/tools/report-session/record-version.d.ts +22 -10
- package/dist/tools/report-session/record-version.js +99 -14
- package/dist/tools/start-report-session.d.ts +115 -0
- package/dist/tools/start-report-session.js +179 -0
- package/dist/workspace/paths.d.ts +50 -0
- package/dist/workspace/paths.js +63 -0
- package/package.json +2 -1
|
@@ -15,20 +15,154 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { z } from "zod";
|
|
17
17
|
import { ArtifactFileReferenceSchema, ArtifactTableReferenceSchema, CitationReferenceSchema, ReferenceSchema, ScalarReferenceSchema, } from "./report-reference.js";
|
|
18
|
-
/**
|
|
19
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The chart vocabulary. The first seven values name one plot form each. The last four are presets of a
|
|
20
|
+
* scientific plot, and the renderer expands a preset into a composition.
|
|
21
|
+
*/
|
|
22
|
+
const ChartTypeSchema = z.enum(["bar", "line", "scatter", "histogram", "box", "heatmap", "pie", "volcano", "manhattan", "ma", "km"]);
|
|
23
|
+
/** The per-row transforms of a channel. Each derived value comes from one cell. */
|
|
24
|
+
const ChartTransformSchema = z.enum(["log10", "neg_log10", "abs", "rank"]);
|
|
25
|
+
/**
|
|
26
|
+
* The arrangement of a bar. The channels keep their data meaning under both values, thus one encoding
|
|
27
|
+
* serves both and the author flips this one field.
|
|
28
|
+
*/
|
|
29
|
+
const ChartOrientationSchema = z.enum(["vertical", "horizontal"]);
|
|
30
|
+
/**
|
|
31
|
+
* The threshold pair of a preset that classifies its rows.
|
|
32
|
+
*
|
|
33
|
+
* One declaration moves the guide lines and the color split together. Thus the split always lands on the
|
|
34
|
+
* drawn lines, and no second declaration can disagree with the first one.
|
|
35
|
+
*/
|
|
36
|
+
const ChartThresholdsSchema = z.strictObject({
|
|
37
|
+
significance: z
|
|
38
|
+
.number()
|
|
39
|
+
.positive()
|
|
40
|
+
.describe("The significance cut of the p column, for example `0.05`. The guide line sits at the transformed value of it, and a point past the line reads as significant."),
|
|
41
|
+
effect: z
|
|
42
|
+
.number()
|
|
43
|
+
.positive()
|
|
44
|
+
.describe("The effect cut, for example `1`. One guide line sits at each side of zero, and a point past a line reads as a signal on that side."),
|
|
45
|
+
});
|
|
46
|
+
/** The teaching text of the orientation. The quick path and the bar series form both carry it. */
|
|
47
|
+
const ORIENTATION_DESCRIPTION = "The arrangement of the bars. `vertical` is the default, and it draws the categories along the bottom. `horizontal` draws them up the left side, and it is the form to reach for when a category name is long, for example a gene-set name: a long name reads on the y axis, and it is unreadable slanted under a vertical bar. The channels do not move with the orientation. `x` names the category column and `y` names the value column in both.";
|
|
48
|
+
/**
|
|
49
|
+
* One visual channel: a column name, or a column with a per-row transform.
|
|
50
|
+
*
|
|
51
|
+
* The object form carries a column and a transform, and it carries no value. Thus a channel can never
|
|
52
|
+
* bring a data literal into the chart option.
|
|
53
|
+
*/
|
|
54
|
+
export const ChartChannelSchema = z.union([
|
|
55
|
+
z.string().describe("The column that feeds the channel."),
|
|
56
|
+
z.strictObject({
|
|
57
|
+
column: z.string().describe("The column that feeds the channel."),
|
|
58
|
+
transform: ChartTransformSchema.describe("The per-row transform. `log10` and `neg_log10` drop a cell that is not positive. `rank` gives the place of the cell in the ascending order of the column, and a tie shares its place."),
|
|
59
|
+
}),
|
|
60
|
+
]);
|
|
20
61
|
/** The mapping from a data column to a visual channel. Each channel is optional. */
|
|
21
62
|
const ChartEncodingSchema = z.strictObject({
|
|
22
|
-
x:
|
|
23
|
-
y:
|
|
24
|
-
group:
|
|
25
|
-
value:
|
|
63
|
+
x: ChartChannelSchema.optional().describe("The channel on the x axis."),
|
|
64
|
+
y: ChartChannelSchema.optional().describe("The channel on the y axis."),
|
|
65
|
+
group: ChartChannelSchema.optional().describe("The column that splits and colors the series."),
|
|
66
|
+
value: ChartChannelSchema.optional().describe("The value column for a pie or heatmap."),
|
|
67
|
+
label: z.string().optional().describe("The column that names each point. The name rides the tooltip of a bar, a line, and a scatter."),
|
|
68
|
+
});
|
|
69
|
+
/** The channels of one series. A series plots two channels, thus `x` and `y` are both present. */
|
|
70
|
+
const ChartSeriesEncodingSchema = z.strictObject({
|
|
71
|
+
x: ChartChannelSchema.describe("The channel on the x axis."),
|
|
72
|
+
y: ChartChannelSchema.describe("The channel on the y axis."),
|
|
73
|
+
y0: ChartChannelSchema.optional().describe("The lower bound of a band. It is legal on an `area` series only."),
|
|
74
|
+
group: ChartChannelSchema.optional().describe("The column that splits the series, one series for each value."),
|
|
75
|
+
label: z.string().optional().describe("The column that names each point of the series."),
|
|
76
|
+
});
|
|
77
|
+
/**
|
|
78
|
+
* One series of a composition: a plot form, its own channels, and an optional legend name.
|
|
79
|
+
*
|
|
80
|
+
* A `step` series is a line with the step flag. An `area` series can name a `y0` lower bound, thus a band
|
|
81
|
+
* between two columns of one row is expressible. The refine holds `y0` to the one form that draws a band,
|
|
82
|
+
* and the second refine holds the orientation to the one form that carries an arrangement.
|
|
83
|
+
*/
|
|
84
|
+
export const ChartSeriesSchema = z
|
|
85
|
+
.strictObject({
|
|
86
|
+
form: z.enum(["line", "scatter", "bar", "area", "step"]).describe("The plot form of the series."),
|
|
87
|
+
encoding: ChartSeriesEncodingSchema.describe("The columns that feed the series."),
|
|
88
|
+
name: z.string().optional().describe("The legend name of the series."),
|
|
89
|
+
orientation: ChartOrientationSchema.optional().describe(ORIENTATION_DESCRIPTION),
|
|
90
|
+
})
|
|
91
|
+
.refine((series) => series.form === "area" || series.encoding.y0 === undefined, {
|
|
92
|
+
message: "`y0` is legal on an `area` series only.",
|
|
93
|
+
path: ["encoding", "y0"],
|
|
94
|
+
})
|
|
95
|
+
.refine((series) => series.form === "bar" || series.orientation === undefined, {
|
|
96
|
+
message: "`orientation` is legal on a `bar` series only.",
|
|
97
|
+
path: ["orientation"],
|
|
98
|
+
});
|
|
99
|
+
/** A guide line at one constant on one axis. */
|
|
100
|
+
const ReferenceLineAnnotationSchema = z.strictObject({
|
|
101
|
+
kind: z.literal("reference-line"),
|
|
102
|
+
axis: z.enum(["x", "y"]).describe("The axis that the constant sits on."),
|
|
103
|
+
value: z.number().describe("The constant of the guide line."),
|
|
104
|
+
label: z.string().optional().describe("The text beside the line."),
|
|
105
|
+
});
|
|
106
|
+
/** A guide band between two constants on one axis. */
|
|
107
|
+
const ReferenceBandAnnotationSchema = z.strictObject({
|
|
108
|
+
kind: z.literal("reference-band"),
|
|
109
|
+
axis: z.enum(["x", "y"]).describe("The axis that the two constants sit on."),
|
|
110
|
+
from: z.number().describe("The lower bound of the band."),
|
|
111
|
+
to: z.number().describe("The upper bound of the band."),
|
|
112
|
+
label: z.string().optional().describe("The text on the band."),
|
|
113
|
+
});
|
|
114
|
+
/** A name beside each point of a declared top-N subset. The subset comes from a rank over one column. */
|
|
115
|
+
const PointLabelsAnnotationSchema = z.strictObject({
|
|
116
|
+
kind: z.literal("point-labels"),
|
|
117
|
+
column: z.string().describe("The column that ranks the rows."),
|
|
118
|
+
order: z.enum(["asc", "desc"]).describe("The direction of the rank."),
|
|
119
|
+
n: z.number().int().min(1).max(20).describe("How many points carry a name. The maximum is 20."),
|
|
120
|
+
});
|
|
121
|
+
/**
|
|
122
|
+
* One annotation of a composition.
|
|
123
|
+
*
|
|
124
|
+
* A reference line and a reference band both carry a declared constant. Such a constant is a guide, and it
|
|
125
|
+
* is never a plotted value.
|
|
126
|
+
*/
|
|
127
|
+
export const ChartAnnotationSchema = z.discriminatedUnion("kind", [ReferenceLineAnnotationSchema, ReferenceBandAnnotationSchema, PointLabelsAnnotationSchema]);
|
|
128
|
+
/** The title and the scale of one axis. */
|
|
129
|
+
const ChartAxisSchema = z.strictObject({
|
|
130
|
+
title: z.string().optional().describe("The axis title. It replaces the column name."),
|
|
131
|
+
scale: z.enum(["linear", "log"]).optional().describe("The axis scale."),
|
|
132
|
+
});
|
|
133
|
+
/** The two axes of a composition. */
|
|
134
|
+
export const ChartAxesSchema = z.strictObject({
|
|
135
|
+
x: ChartAxisSchema.optional().describe("The x axis."),
|
|
136
|
+
y: ChartAxisSchema.optional().describe("The y axis."),
|
|
137
|
+
});
|
|
138
|
+
/** The full chart grammar: the series, the annotations, and the axes. Each series reads the one bound table. */
|
|
139
|
+
export const ChartCompositionSchema = z.strictObject({
|
|
140
|
+
series: z.array(ChartSeriesSchema).min(1).describe("One series at least. Each one reads the bound table."),
|
|
141
|
+
annotations: z.array(ChartAnnotationSchema).optional().describe("The guide lines, the guide bands, and the point names."),
|
|
142
|
+
axes: ChartAxesSchema.optional().describe("The axis titles and the axis scales."),
|
|
143
|
+
});
|
|
144
|
+
/**
|
|
145
|
+
* One typed list of a text block: the flag that selects the form, and the items.
|
|
146
|
+
*
|
|
147
|
+
* An item is one inline line, and the renderer escapes it as it escapes a paragraph. No item carries
|
|
148
|
+
* markup, and no item carries a list of its own. A deeper structure composes as a section with blocks.
|
|
149
|
+
*/
|
|
150
|
+
export const TextListSchema = z.strictObject({
|
|
151
|
+
ordered: z.boolean().describe("True for a numbered list, for example a ranked set or a sequence of steps. False for a bulleted list of parallel points."),
|
|
152
|
+
items: z
|
|
153
|
+
.array(z.string().min(1).describe("One item as one inline line. It carries no markup and no list of its own."))
|
|
154
|
+
.min(1)
|
|
155
|
+
.describe("One item at least. Each item is one point."),
|
|
26
156
|
});
|
|
27
157
|
/** Prose with no binding. The absence of a binding field is the rule for this kind. */
|
|
28
158
|
export const TextBlockSchema = z.strictObject({
|
|
29
159
|
kind: z.literal("text"),
|
|
30
160
|
id: z.string().min(1).describe("The stable identity of the block."),
|
|
31
|
-
content: z.strictObject({
|
|
161
|
+
content: z.strictObject({
|
|
162
|
+
prose: z.string(),
|
|
163
|
+
list: TextListSchema.optional().describe("The enumeration of the block, as a list. Three or more parallel points compose here, and never inline in the prose as " +
|
|
164
|
+
'"(1) ... (6)". The prose above the list carries the lead sentences that introduce it, and it can be empty.'),
|
|
165
|
+
}),
|
|
32
166
|
});
|
|
33
167
|
/** Prose with at least one reference that justifies it. */
|
|
34
168
|
export const ClaimBlockSchema = z.strictObject({
|
|
@@ -52,15 +186,42 @@ export const TableBlockSchema = z.strictObject({
|
|
|
52
186
|
binding: ArtifactTableReferenceSchema.describe("The whole-table artifact to render."),
|
|
53
187
|
caption: z.string().optional(),
|
|
54
188
|
});
|
|
55
|
-
/**
|
|
56
|
-
|
|
189
|
+
/**
|
|
190
|
+
* A whole-table artifact rendered as a chart.
|
|
191
|
+
*
|
|
192
|
+
* The block carries the quick path or the composition, and never both. The quick path is one chart type
|
|
193
|
+
* with one encoding. The composition holds the series, the annotations, and the axes. The refine makes the
|
|
194
|
+
* exactly-one rule a parse failure.
|
|
195
|
+
*
|
|
196
|
+
* No member of either path carries a data literal, and no member carries script text. Thus every plotted
|
|
197
|
+
* value comes from the resolved rows of the bound table.
|
|
198
|
+
*/
|
|
199
|
+
export const ChartBlockSchema = z
|
|
200
|
+
.strictObject({
|
|
57
201
|
kind: z.literal("chart"),
|
|
58
202
|
id: z.string().min(1).describe("The stable identity of the block."),
|
|
59
203
|
title: z.string().optional(),
|
|
60
204
|
binding: ArtifactTableReferenceSchema.describe("The whole-table artifact to plot."),
|
|
61
|
-
chartType: ChartTypeSchema,
|
|
62
|
-
encoding: ChartEncodingSchema,
|
|
205
|
+
chartType: ChartTypeSchema.optional().describe("The quick path. Give `encoding` with it, and omit `composition`. A preset (`volcano`, `manhattan`, `ma`, `km`) reads the same channels, and it applies its own transform and its own guide lines."),
|
|
206
|
+
encoding: ChartEncodingSchema.optional().describe("The channels of the quick path."),
|
|
207
|
+
orientation: ChartOrientationSchema.optional().describe(`${ORIENTATION_DESCRIPTION} The field belongs to the \`bar\` chart type, and every other type refuses it.`),
|
|
208
|
+
thresholds: ChartThresholdsSchema.optional().describe("The threshold pair of a `volcano`. It replaces the preset defaults of `0.05` and `1`, and it moves the guide lines and the color split together. State it to draw the volcano of a corrected significance column. Every other chart type reads no threshold, thus every other type refuses the field."),
|
|
209
|
+
composition: ChartCompositionSchema.optional().describe("The full grammar. Omit `chartType` and `encoding` with it."),
|
|
63
210
|
caption: z.string().optional(),
|
|
211
|
+
})
|
|
212
|
+
.refine((block) => {
|
|
213
|
+
const quickPath = block.chartType !== undefined && block.encoding !== undefined;
|
|
214
|
+
// The orientation and the thresholds are quick-path fields. A composition states the arrangement
|
|
215
|
+
// on its own bar series, and it draws its own guide lines. Thus either field beside a composition
|
|
216
|
+
// names a rule that nothing reads.
|
|
217
|
+
const partialQuickPath = block.chartType !== undefined || block.encoding !== undefined || block.orientation !== undefined || block.thresholds !== undefined;
|
|
218
|
+
return block.composition !== undefined ? !partialQuickPath : quickPath;
|
|
219
|
+
}, { message: "A chart carries either `chartType` with `encoding`, or `composition`. The `orientation` and the `thresholds` belong to the quick path." })
|
|
220
|
+
.refine((block) => block.thresholds === undefined || block.chartType === "volcano", {
|
|
221
|
+
// The member is a pair, and the volcano is the one type that reads both values. A silent ignore
|
|
222
|
+
// would teach the author a field that does nothing, thus the parse states the fault.
|
|
223
|
+
message: "`thresholds` is legal beside the `volcano` chart type alone. Every other type reads no threshold pair.",
|
|
224
|
+
path: ["thresholds"],
|
|
64
225
|
});
|
|
65
226
|
/** A static image artifact. An image has no per-cell address, thus it is pinned whole-file. */
|
|
66
227
|
export const FigureBlockSchema = z.strictObject({
|
|
@@ -115,3 +276,17 @@ export const ReportDocumentSchema = z.strictObject({
|
|
|
115
276
|
title: z.string().min(1),
|
|
116
277
|
sections: z.array(SectionBlockSchema).min(1).describe("The top-level sections, each with at least one block."),
|
|
117
278
|
});
|
|
279
|
+
/**
|
|
280
|
+
* The column that one channel names.
|
|
281
|
+
*
|
|
282
|
+
* A transform rides beside the column and never in place of it, thus the two channel forms name their
|
|
283
|
+
* column the same way. The walk, the preset expansion, and the derivation all read the name through this
|
|
284
|
+
* one function.
|
|
285
|
+
*/
|
|
286
|
+
export function channelColumn(channel) {
|
|
287
|
+
return typeof channel === "string" ? channel : channel.column;
|
|
288
|
+
}
|
|
289
|
+
/** The transform of one channel, or `undefined` when the channel names a plain column. */
|
|
290
|
+
export function channelTransform(channel) {
|
|
291
|
+
return typeof channel === "string" ? undefined : channel.transform;
|
|
292
|
+
}
|
|
@@ -36,16 +36,62 @@ export declare const ArtifactValueReferenceSchema: z.ZodObject<{
|
|
|
36
36
|
snapshot: z.ZodOptional<z.ZodString>;
|
|
37
37
|
kind: z.ZodLiteral<"artifact-value">;
|
|
38
38
|
}, z.core.$strict>;
|
|
39
|
+
/**
|
|
40
|
+
* What one column of a table holds, as a closed set of five.
|
|
41
|
+
*
|
|
42
|
+
* A meaning states the content of the column. It is not a format: the design source keeps the one rule for
|
|
43
|
+
* how each meaning reads on the page, thus no block carries a format field.
|
|
44
|
+
*/
|
|
45
|
+
export declare const ColumnMeaningSchema: z.ZodEnum<{
|
|
46
|
+
count: "count";
|
|
47
|
+
identifier: "identifier";
|
|
48
|
+
category: "category";
|
|
49
|
+
"p-value": "p-value";
|
|
50
|
+
effect: "effect";
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* The row bound of a whole-table binding: the top rows by one column.
|
|
54
|
+
*
|
|
55
|
+
* The bound is content and not presentation. The resolution applies it, thus the resolved table, the
|
|
56
|
+
* rendered card, the staged data, and the gate all read one bounded set.
|
|
57
|
+
*/
|
|
58
|
+
export declare const RowBoundSchema: z.ZodObject<{
|
|
59
|
+
column: z.ZodString;
|
|
60
|
+
count: z.ZodNumber;
|
|
61
|
+
order: z.ZodOptional<z.ZodEnum<{
|
|
62
|
+
desc: "desc";
|
|
63
|
+
asc: "asc";
|
|
64
|
+
}>>;
|
|
65
|
+
}, z.core.$strict>;
|
|
39
66
|
/**
|
|
40
67
|
* A reference to a whole table artifact. It carries no locator, because it binds every row.
|
|
41
68
|
*
|
|
42
69
|
* It carries no assert. A table is not one value, thus the only belief that an author can hold about it
|
|
43
70
|
* is its bytes, and the pinned `hash` already carries that belief.
|
|
71
|
+
*
|
|
72
|
+
* The two declaration maps state what the columns are and what to call them. They ride the whole-table
|
|
73
|
+
* binding, thus one declaration serves the table block and the chart block alike.
|
|
44
74
|
*/
|
|
45
75
|
export declare const ArtifactTableReferenceSchema: z.ZodObject<{
|
|
46
76
|
unit: z.ZodOptional<z.ZodString>;
|
|
47
77
|
format: z.ZodOptional<z.ZodString>;
|
|
78
|
+
rowBound: z.ZodOptional<z.ZodObject<{
|
|
79
|
+
column: z.ZodString;
|
|
80
|
+
count: z.ZodNumber;
|
|
81
|
+
order: z.ZodOptional<z.ZodEnum<{
|
|
82
|
+
desc: "desc";
|
|
83
|
+
asc: "asc";
|
|
84
|
+
}>>;
|
|
85
|
+
}, z.core.$strict>>;
|
|
48
86
|
columns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
87
|
+
columnMeanings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
88
|
+
count: "count";
|
|
89
|
+
identifier: "identifier";
|
|
90
|
+
category: "category";
|
|
91
|
+
"p-value": "p-value";
|
|
92
|
+
effect: "effect";
|
|
93
|
+
}>>>;
|
|
94
|
+
columnLabels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
49
95
|
run: z.ZodOptional<z.ZodString>;
|
|
50
96
|
path: z.ZodString;
|
|
51
97
|
hash: z.ZodString;
|
|
@@ -181,7 +227,23 @@ export declare const ReferenceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
181
227
|
}, z.core.$strict>, z.ZodObject<{
|
|
182
228
|
unit: z.ZodOptional<z.ZodString>;
|
|
183
229
|
format: z.ZodOptional<z.ZodString>;
|
|
230
|
+
rowBound: z.ZodOptional<z.ZodObject<{
|
|
231
|
+
column: z.ZodString;
|
|
232
|
+
count: z.ZodNumber;
|
|
233
|
+
order: z.ZodOptional<z.ZodEnum<{
|
|
234
|
+
desc: "desc";
|
|
235
|
+
asc: "asc";
|
|
236
|
+
}>>;
|
|
237
|
+
}, z.core.$strict>>;
|
|
184
238
|
columns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
239
|
+
columnMeanings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
240
|
+
count: "count";
|
|
241
|
+
identifier: "identifier";
|
|
242
|
+
category: "category";
|
|
243
|
+
"p-value": "p-value";
|
|
244
|
+
effect: "effect";
|
|
245
|
+
}>>>;
|
|
246
|
+
columnLabels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
185
247
|
run: z.ZodOptional<z.ZodString>;
|
|
186
248
|
path: z.ZodString;
|
|
187
249
|
hash: z.ZodString;
|
|
@@ -351,7 +413,23 @@ export declare const UnresolvedReferenceSchema: z.ZodObject<{
|
|
|
351
413
|
}, z.core.$strict>, z.ZodObject<{
|
|
352
414
|
unit: z.ZodOptional<z.ZodString>;
|
|
353
415
|
format: z.ZodOptional<z.ZodString>;
|
|
416
|
+
rowBound: z.ZodOptional<z.ZodObject<{
|
|
417
|
+
column: z.ZodString;
|
|
418
|
+
count: z.ZodNumber;
|
|
419
|
+
order: z.ZodOptional<z.ZodEnum<{
|
|
420
|
+
desc: "desc";
|
|
421
|
+
asc: "asc";
|
|
422
|
+
}>>;
|
|
423
|
+
}, z.core.$strict>>;
|
|
354
424
|
columns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
425
|
+
columnMeanings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
426
|
+
count: "count";
|
|
427
|
+
identifier: "identifier";
|
|
428
|
+
category: "category";
|
|
429
|
+
"p-value": "p-value";
|
|
430
|
+
effect: "effect";
|
|
431
|
+
}>>>;
|
|
432
|
+
columnLabels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
355
433
|
run: z.ZodOptional<z.ZodString>;
|
|
356
434
|
path: z.ZodString;
|
|
357
435
|
hash: z.ZodString;
|
|
@@ -428,6 +506,8 @@ export declare const UnresolvedReferenceSchema: z.ZodObject<{
|
|
|
428
506
|
}, z.core.$strict>;
|
|
429
507
|
export type ArtifactValueReference = z.infer<typeof ArtifactValueReferenceSchema>;
|
|
430
508
|
export type ArtifactTableReference = z.infer<typeof ArtifactTableReferenceSchema>;
|
|
509
|
+
export type RowBound = z.infer<typeof RowBoundSchema>;
|
|
510
|
+
export type ColumnMeaning = z.infer<typeof ColumnMeaningSchema>;
|
|
431
511
|
export type ArtifactFileReference = z.infer<typeof ArtifactFileReferenceSchema>;
|
|
432
512
|
export type CitationReference = z.infer<typeof CitationReferenceSchema>;
|
|
433
513
|
export type DerivationInputReference = z.infer<typeof DerivationInputReferenceSchema>;
|
|
@@ -436,6 +516,14 @@ export type Reference = z.infer<typeof ReferenceSchema>;
|
|
|
436
516
|
export type ScalarReference = z.infer<typeof ScalarReferenceSchema>;
|
|
437
517
|
export type UnresolvedReason = z.infer<typeof UnresolvedReasonSchema>;
|
|
438
518
|
export type UnresolvedReference = z.infer<typeof UnresolvedReferenceSchema>;
|
|
519
|
+
/**
|
|
520
|
+
* The declaration that a binding holds for one column, or `undefined` when it holds none.
|
|
521
|
+
*
|
|
522
|
+
* A key that names no column of the artifact never reaches this reader, thus a stale declaration after a
|
|
523
|
+
* re-derivation has no effect. The reader takes an own key alone. Thus a column that carries the name of a
|
|
524
|
+
* member of the object prototype gives no value, and the declared type stays true at runtime.
|
|
525
|
+
*/
|
|
526
|
+
export declare function declaredForColumn<T>(declarations: Record<string, T> | undefined, column: string): T | undefined;
|
|
439
527
|
/**
|
|
440
528
|
* Serialize a reference to a canonical URI.
|
|
441
529
|
*
|
|
@@ -87,16 +87,51 @@ export const ArtifactValueReferenceSchema = z.strictObject({
|
|
|
87
87
|
assert: AssertValueSchema.optional().describe("The authored belief that resolution matches against."),
|
|
88
88
|
...displayShape,
|
|
89
89
|
});
|
|
90
|
+
/**
|
|
91
|
+
* What one column of a table holds, as a closed set of five.
|
|
92
|
+
*
|
|
93
|
+
* A meaning states the content of the column. It is not a format: the design source keeps the one rule for
|
|
94
|
+
* how each meaning reads on the page, thus no block carries a format field.
|
|
95
|
+
*/
|
|
96
|
+
export const ColumnMeaningSchema = z.enum(["p-value", "effect", "count", "identifier", "category"]);
|
|
97
|
+
/**
|
|
98
|
+
* The row bound of a whole-table binding: the top rows by one column.
|
|
99
|
+
*
|
|
100
|
+
* The bound is content and not presentation. The resolution applies it, thus the resolved table, the
|
|
101
|
+
* rendered card, the staged data, and the gate all read one bounded set.
|
|
102
|
+
*/
|
|
103
|
+
export const RowBoundSchema = z.strictObject({
|
|
104
|
+
column: z.string().min(1).describe("The column that ranks the rows. The artifact must hold it, and the bound refuses a name that it does not."),
|
|
105
|
+
count: z.number().int().positive().describe("How many rows to keep. The bound takes the first rows of the ranked order."),
|
|
106
|
+
order: z
|
|
107
|
+
.enum(["desc", "asc"])
|
|
108
|
+
.optional()
|
|
109
|
+
.describe("The rank direction. Omit it for `desc`, which keeps the largest values. Use `asc` for a column where the smallest value ranks first, such as a p-value."),
|
|
110
|
+
});
|
|
90
111
|
/**
|
|
91
112
|
* A reference to a whole table artifact. It carries no locator, because it binds every row.
|
|
92
113
|
*
|
|
93
114
|
* It carries no assert. A table is not one value, thus the only belief that an author can hold about it
|
|
94
115
|
* is its bytes, and the pinned `hash` already carries that belief.
|
|
116
|
+
*
|
|
117
|
+
* The two declaration maps state what the columns are and what to call them. They ride the whole-table
|
|
118
|
+
* binding, thus one declaration serves the table block and the chart block alike.
|
|
95
119
|
*/
|
|
96
120
|
export const ArtifactTableReferenceSchema = z.strictObject({
|
|
97
121
|
kind: z.literal("artifact-table"),
|
|
98
122
|
...artifactPinShape,
|
|
123
|
+
rowBound: RowBoundSchema.optional().describe("The primary size control of a table: the top rows by one column. Bind the whole artifact and bound it here, and never bind a pre-cut copy of the file. A binding with no bound resolves every row of the artifact."),
|
|
99
124
|
columns: z.array(z.string()).optional().describe("An optional column subset to render. Omit to bind every column."),
|
|
125
|
+
columnMeanings: z
|
|
126
|
+
.record(z.string(), ColumnMeaningSchema)
|
|
127
|
+
.optional()
|
|
128
|
+
.describe("What each column holds, keyed by the raw column name. A meaning is the content of the column, and it is not a format: `p-value` is a probability, `effect` is a signed magnitude such as a fold change, `count` is a whole tally, `identifier` is a name that is written with digits, and `category` is a label. You read the artifact, thus you know which column is which. Declare the columns that you know, and omit the rest. A key that names no column of the artifact has no effect."),
|
|
129
|
+
columnLabels: z
|
|
130
|
+
// A label replaces the column name on the page. Empty text names nothing, thus it would blank the
|
|
131
|
+
// header and the axis title. Omit the key instead, which is the way to declare no label.
|
|
132
|
+
.record(z.string(), z.string().min(1))
|
|
133
|
+
.optional()
|
|
134
|
+
.describe("The display name of each column, keyed by the raw column name. A label names what the column measures, for example `Adjusted p-value` for `padj`. The page shows the label in the table header and in the axis title, and the raw name stays on hover. A key that names no column of the artifact has no effect."),
|
|
100
135
|
...displayShape,
|
|
101
136
|
});
|
|
102
137
|
/**
|
|
@@ -193,6 +228,19 @@ export const UnresolvedReferenceSchema = z.strictObject({
|
|
|
193
228
|
reason: UnresolvedReasonSchema,
|
|
194
229
|
detail: z.string().optional(),
|
|
195
230
|
});
|
|
231
|
+
/**
|
|
232
|
+
* The declaration that a binding holds for one column, or `undefined` when it holds none.
|
|
233
|
+
*
|
|
234
|
+
* A key that names no column of the artifact never reaches this reader, thus a stale declaration after a
|
|
235
|
+
* re-derivation has no effect. The reader takes an own key alone. Thus a column that carries the name of a
|
|
236
|
+
* member of the object prototype gives no value, and the declared type stays true at runtime.
|
|
237
|
+
*/
|
|
238
|
+
export function declaredForColumn(declarations, column) {
|
|
239
|
+
if (declarations === undefined || !Object.prototype.hasOwnProperty.call(declarations, column)) {
|
|
240
|
+
return undefined;
|
|
241
|
+
}
|
|
242
|
+
return declarations[column];
|
|
243
|
+
}
|
|
196
244
|
/** The URI scheme and version for a serialized reference. The payload after it is opaque. */
|
|
197
245
|
const REFERENCE_URI_PREFIX = "inflexa-ref:v1:";
|
|
198
246
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,15 @@ export { assembleCoreRuntime } from "./runtime/assemble.js";
|
|
|
8
8
|
export type { CoreRuntime, CoreRuntimeDeps, CoreWorkflowDeps, RegisteredWorkflows, ConversationAssemblyDeps, SandboxStepCallable, MakeReportReferenceResolver, ReportResolverScope, } from "./runtime/assemble.js";
|
|
9
9
|
export type { ReferenceResolver, ReportSnapshot, ResolvedValue } from "./report-model/reference-resolver.js";
|
|
10
10
|
export type { ResolvePageAsset } from "./tools/report-session/index.js";
|
|
11
|
+
export { PAGE_ASSETS } from "./report-render/assets.js";
|
|
12
|
+
export type { PageAsset } from "./report-render/assets.js";
|
|
13
|
+
export { createStaticEyes } from "./lib/eyes.js";
|
|
14
|
+
export type { AcquireEyes, EyesScope, EyesLease } from "./lib/eyes.js";
|
|
15
|
+
export { resolveCompositionEyes } from "./runtime/assemble.js";
|
|
11
16
|
export type { ThreadAgentResolver, UnregisteredThreadType } from "./runtime/assemble.js";
|
|
17
|
+
export { createReportSessionSpawn } from "./app/spawn-report-session.js";
|
|
18
|
+
export type { ReportSessionSpawn, ReportSessionSpawnDeps, ReportSessionPaging, SpawnRefusal, ReportBrief, ReportSessionDelta, NewestReportChild, } from "./app/spawn-report-session.js";
|
|
19
|
+
export type { EnsureSessionStateResult } from "./app/report-session-runtime.js";
|
|
12
20
|
export { bootHarness } from "./runtime/boot.js";
|
|
13
21
|
export type { BootHarnessDeps, BootedHarness } from "./runtime/boot.js";
|
|
14
22
|
export { createConversationAgent } from "./agents/conversation-agent.js";
|
|
@@ -151,6 +159,7 @@ export { REFERENCE_INSTALL_RECEIPT_VERSION, ReferenceInstallReceiptSchema, parse
|
|
|
151
159
|
export type { ReferenceInstallReceipt, ReferenceReceiptArtifact } from "./reference-data/receipt.js";
|
|
152
160
|
export { queryActiveSandboxes } from "./state/active-sandboxes.js";
|
|
153
161
|
export { runStepDir } from "./workspace/paths.js";
|
|
162
|
+
export { reportSessionDir } from "./workspace/paths.js";
|
|
154
163
|
export type { LogFields, LogLevel, Logger } from "./lib/logger.js";
|
|
155
164
|
export { defaultErrorFields } from "./lib/logger.js";
|
|
156
165
|
export { createConsoleLogger, createNoopLogger } from "./lib/console-logger.js";
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,22 @@
|
|
|
6
6
|
*/
|
|
7
7
|
// Runtime assembly + composition root.
|
|
8
8
|
export { assembleCoreRuntime } from "./runtime/assemble.js";
|
|
9
|
+
export { PAGE_ASSETS } from "./report-render/assets.js";
|
|
10
|
+
// Seam: the eyes of a report session — where a browser comes from for one look at the
|
|
11
|
+
// rendered page. A host with a standing sidecar names the endpoint in its chrome config, and
|
|
12
|
+
// the assembly wraps it. A host with no sidecar starts a browser for one look, thus it binds
|
|
13
|
+
// its own realization. The names of the acquire, the scope, and the lease then belong on the
|
|
14
|
+
// front door. `createStaticEyes` is the shipped realization over a standing sidecar, and an
|
|
15
|
+
// embedder that wires the spawn itself binds the same eyes there. That embedder reads the same
|
|
16
|
+
// precedence through `resolveCompositionEyes`: the bound seam first, then a chrome config that
|
|
17
|
+
// names a browser. Thus the gate of the spawn and the gate of the look cannot disagree. A
|
|
18
|
+
// runtime that can look never carries a spawn that refuses with `no_browser`.
|
|
19
|
+
export { createStaticEyes } from "./lib/eyes.js";
|
|
20
|
+
export { resolveCompositionEyes } from "./runtime/assemble.js";
|
|
21
|
+
// The report-session spawn makes a `report` child thread, and its listing gives
|
|
22
|
+
// the report sessions of one analysis. An embedder reaches the listing for its
|
|
23
|
+
// navigation surface, thus these names belong on the front door.
|
|
24
|
+
export { createReportSessionSpawn } from "./app/spawn-report-session.js";
|
|
9
25
|
// The harness-owned boot sequence: ordered boot steps around `assembleCoreRuntime`
|
|
10
26
|
// (skill validation → state init → connection budget → assemble → launch) + a
|
|
11
27
|
// `shutdown` handle the embedder wires to its process signals.
|
|
@@ -241,6 +257,10 @@ export { queryActiveSandboxes } from "./state/active-sandboxes.js";
|
|
|
241
257
|
// Workspace-tree path convention — the root-relative step directory each
|
|
242
258
|
// sandbox step confines its artifact writes to (join onto the resolved root).
|
|
243
259
|
export { runStepDir } from "./workspace/paths.js";
|
|
260
|
+
// An embedder removes the page files of a purged report session. Thus it needs
|
|
261
|
+
// the root-relative directory of that session, and it restates no layout of the
|
|
262
|
+
// harness.
|
|
263
|
+
export { reportSessionDir } from "./workspace/paths.js";
|
|
244
264
|
// `Logger.errorFields` is on the interface so a realization can defer to its
|
|
245
265
|
// sink's native error handling (pino's `err` serializer, OTel's `exception.*`);
|
|
246
266
|
// `defaultErrorFields` is the shipped mapping for one with no opinion.
|
package/dist/lib/chrome.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Chrome sidecar reachable at `CHROME_BROWSER_URL`. Used by the iterate-report
|
|
4
|
-
* preview-snapshot tool for visual validation.
|
|
2
|
+
* The connection to a headless Chrome endpoint.
|
|
5
3
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Two callers name an endpoint. A composition names a standing sidecar at assembly, and a lease of the eyes
|
|
5
|
+
* seam names a browser for one look. Thus the module holds one connection for each endpoint, and it holds no
|
|
6
|
+
* connection for the process.
|
|
7
|
+
*
|
|
8
|
+
* A connection is lazy, and an endpoint connects again after a disconnect. Each endpoint also carries its own
|
|
9
|
+
* page gate. The gate bounds the pages that run at the same time against that one sidecar.
|
|
8
10
|
*/
|
|
9
11
|
import type { Browser, BrowserContext, Page } from "puppeteer-core";
|
|
10
12
|
import type { Logger } from "./logger.js";
|
|
@@ -26,7 +28,25 @@ export interface ChromeConfig {
|
|
|
26
28
|
/**
|
|
27
29
|
* Whether the config names a browser to connect to. A composition with no endpoint has no eyes, and a
|
|
28
30
|
* caller reads that up front instead of failing once for each attempted connection.
|
|
31
|
+
*
|
|
32
|
+
* The predicate narrows the config. Thus a caller that reads the endpoint after the gate needs no type
|
|
33
|
+
* assertion for a field that the gate proved.
|
|
34
|
+
*/
|
|
35
|
+
export declare function hasBrowserUrl(cfg: ChromeConfig): cfg is ChromeConfig & {
|
|
36
|
+
readonly browserUrl: string;
|
|
37
|
+
};
|
|
38
|
+
/** The connect operation of one endpoint. */
|
|
39
|
+
export type BrowserConnector = (browserUrl: string) => Promise<Browser>;
|
|
40
|
+
/**
|
|
41
|
+
* Replace the connect operation, and give back the restore of the previous one.
|
|
42
|
+
*
|
|
43
|
+
* The cache keeps no state that a caller can read, because a connection is the only product of the module.
|
|
44
|
+
* Thus a real browser is the only other way to drive the cache, and a unit test of the keys needs this seam.
|
|
45
|
+
*
|
|
46
|
+
* Two facts make the seam safe. The module reads the binding at each connect, and no module under `src/`
|
|
47
|
+
* calls the setter. Thus a deployment always runs the connect of puppeteer. The caller restores the previous
|
|
48
|
+
* binding, thus a replacement never reaches a later file of the same test run.
|
|
29
49
|
*/
|
|
30
|
-
export declare function
|
|
50
|
+
export declare function setBrowserConnector(next: BrowserConnector): () => void;
|
|
31
51
|
export declare function getBrowser(browserUrl?: string, injected?: Logger): Promise<Browser>;
|
|
32
52
|
export declare function withPage<T>(cfg: ChromeConfig, fn: (page: Page, context: BrowserContext) => Promise<T>): Promise<T>;
|