@inflexa-ai/harness 0.20.0 → 0.21.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.
Files changed (133) hide show
  1. package/dist/agents/conversation-agent.d.ts +26 -14
  2. package/dist/agents/conversation-agent.js +12 -23
  3. package/dist/agents/report-session-agent.d.ts +31 -5
  4. package/dist/agents/report-session-agent.js +35 -9
  5. package/dist/app/chat-turn.js +3 -1
  6. package/dist/app/message-assembly.d.ts +15 -1
  7. package/dist/app/message-assembly.js +22 -8
  8. package/dist/app/report-session-runtime.d.ts +21 -4
  9. package/dist/app/report-session-runtime.js +53 -6
  10. package/dist/app/spawn-report-session.d.ts +174 -17
  11. package/dist/app/spawn-report-session.js +233 -21
  12. package/dist/contracts/chat-events.d.ts +7 -2
  13. package/dist/contracts/message.d.ts +10 -0
  14. package/dist/contracts/report-blocks.d.ts +743 -19
  15. package/dist/contracts/report-blocks.js +186 -11
  16. package/dist/contracts/report-reference.d.ts +88 -0
  17. package/dist/contracts/report-reference.js +48 -0
  18. package/dist/index.d.ts +9 -0
  19. package/dist/index.js +20 -0
  20. package/dist/lib/chrome.d.ts +26 -6
  21. package/dist/lib/chrome.js +99 -32
  22. package/dist/lib/eyes.d.ts +57 -0
  23. package/dist/lib/eyes.js +45 -0
  24. package/dist/lib/page-capture.d.ts +14 -0
  25. package/dist/lib/page-capture.js +56 -2
  26. package/dist/loop/run-agent.js +58 -23
  27. package/dist/loop/tool-detail.d.ts +19 -2
  28. package/dist/loop/tool-detail.js +35 -2
  29. package/dist/memory/content-to-cortex.d.ts +3 -2
  30. package/dist/memory/content-to-cortex.js +21 -12
  31. package/dist/memory/conversation-display-replay.js +14 -7
  32. package/dist/memory/thread-history.d.ts +60 -3
  33. package/dist/memory/thread-history.js +55 -16
  34. package/dist/memory/thread-store.d.ts +11 -1
  35. package/dist/memory/thread-store.js +12 -2
  36. package/dist/prompts/conversation.d.ts +1 -1
  37. package/dist/prompts/conversation.js +23 -6
  38. package/dist/prompts/report-session.d.ts +1 -1
  39. package/dist/prompts/report-session.js +190 -9
  40. package/dist/report-model/authoring-grammar.d.ts +463 -0
  41. package/dist/report-model/authoring-grammar.js +77 -0
  42. package/dist/report-model/block-walk.d.ts +57 -14
  43. package/dist/report-model/block-walk.js +116 -11
  44. package/dist/report-model/draft-finish.d.ts +22 -4
  45. package/dist/report-model/draft-finish.js +39 -7
  46. package/dist/report-model/draft-operations.d.ts +3 -0
  47. package/dist/report-model/draft-operations.js +19 -5
  48. package/dist/report-model/draft-read.d.ts +8 -5
  49. package/dist/report-model/draft-read.js +21 -5
  50. package/dist/report-model/fixture-resolver.js +15 -4
  51. package/dist/report-model/pin-snapshot.d.ts +24 -6
  52. package/dist/report-model/pin-snapshot.js +204 -6
  53. package/dist/report-model/production-resolver.js +15 -4
  54. package/dist/report-model/reference-resolver.d.ts +50 -1
  55. package/dist/report-model/reference-resolver.js +94 -1
  56. package/dist/report-model/reference-stamp.d.ts +45 -0
  57. package/dist/report-model/reference-stamp.js +173 -0
  58. package/dist/report-model/structural-validation.d.ts +4 -1
  59. package/dist/report-model/structural-validation.js +48 -3
  60. package/dist/report-model/validate.d.ts +1 -1
  61. package/dist/report-model/validate.js +1 -1
  62. package/dist/report-render/asset-lookup.d.ts +19 -0
  63. package/dist/report-render/asset-lookup.js +37 -0
  64. package/dist/report-render/assets.d.ts +45 -1
  65. package/dist/report-render/assets.js +65 -6
  66. package/dist/report-render/chart-presets.d.ts +102 -0
  67. package/dist/report-render/chart-presets.js +205 -0
  68. package/dist/report-render/chart.d.ts +112 -10
  69. package/dist/report-render/chart.js +1164 -41
  70. package/dist/report-render/design.d.ts +99 -0
  71. package/dist/report-render/design.js +289 -107
  72. package/dist/report-render/number-format.d.ts +117 -0
  73. package/dist/report-render/number-format.js +479 -0
  74. package/dist/report-render/page.d.ts +121 -5
  75. package/dist/report-render/page.js +689 -7
  76. package/dist/report-render/references.d.ts +70 -16
  77. package/dist/report-render/references.js +54 -22
  78. package/dist/report-render/render.d.ts +23 -5
  79. package/dist/report-render/render.js +81 -22
  80. package/dist/report-render/table-data.d.ts +92 -0
  81. package/dist/report-render/table-data.js +129 -0
  82. package/dist/report-render/types.d.ts +15 -0
  83. package/dist/report-render/value-bridge.js +6 -2
  84. package/dist/report-render/views/chart-view.d.ts +12 -5
  85. package/dist/report-render/views/chart-view.js +14 -8
  86. package/dist/report-render/views/page-view.d.ts +36 -15
  87. package/dist/report-render/views/page-view.js +45 -23
  88. package/dist/report-render/views/prose.d.ts +12 -2
  89. package/dist/report-render/views/prose.js +29 -7
  90. package/dist/report-render/views/references-view.d.ts +22 -8
  91. package/dist/report-render/views/references-view.js +101 -13
  92. package/dist/report-render/views/values.d.ts +128 -13
  93. package/dist/report-render/views/values.js +199 -18
  94. package/dist/runtime/assemble.d.ts +39 -5
  95. package/dist/runtime/assemble.js +47 -6
  96. package/dist/sandbox/client.d.ts +10 -1
  97. package/dist/sandbox/create-sandbox.d.ts +9 -4
  98. package/dist/sandbox/create-sandbox.js +22 -16
  99. package/dist/sandbox/docker-client.js +10 -7
  100. package/dist/sandbox/mount-plan.d.ts +45 -7
  101. package/dist/sandbox/mount-plan.js +43 -5
  102. package/dist/sandbox/types.d.ts +6 -0
  103. package/dist/state/init.js +38 -9
  104. package/dist/state/report-session-state.d.ts +42 -1
  105. package/dist/state/report-session-state.js +70 -2
  106. package/dist/state/report-versions.d.ts +22 -17
  107. package/dist/state/report-versions.js +48 -35
  108. package/dist/state/snapshot-parse.js +16 -1
  109. package/dist/tools/define-tool.d.ts +32 -0
  110. package/dist/tools/define-tool.js +4 -0
  111. package/dist/tools/detail-resolver.d.ts +7 -2
  112. package/dist/tools/detail-resolver.js +7 -2
  113. package/dist/tools/iterate-report.d.ts +1 -1
  114. package/dist/tools/report/preview-snapshot.js +1 -0
  115. package/dist/tools/report-authoring/authoring-tools.d.ts +15 -6
  116. package/dist/tools/report-authoring/authoring-tools.js +99 -18
  117. package/dist/tools/report-session/derive-table.d.ts +162 -0
  118. package/dist/tools/report-session/derive-table.js +459 -0
  119. package/dist/tools/report-session/examine-page.d.ts +48 -18
  120. package/dist/tools/report-session/examine-page.js +204 -24
  121. package/dist/tools/report-session/index.d.ts +2 -0
  122. package/dist/tools/report-session/index.js +2 -0
  123. package/dist/tools/report-session/list-artifacts.d.ts +97 -0
  124. package/dist/tools/report-session/list-artifacts.js +197 -0
  125. package/dist/tools/report-session/preview-report.d.ts +6 -0
  126. package/dist/tools/report-session/preview-report.js +180 -28
  127. package/dist/tools/report-session/record-version.d.ts +22 -10
  128. package/dist/tools/report-session/record-version.js +99 -14
  129. package/dist/tools/start-report-session.d.ts +115 -0
  130. package/dist/tools/start-report-session.js +179 -0
  131. package/dist/workspace/paths.d.ts +50 -0
  132. package/dist/workspace/paths.js +63 -0
  133. package/package.json +2 -1
@@ -1,15 +1,27 @@
1
1
  /**
2
- * The page constants: the head references, the readiness names, and the two page-side scripts.
2
+ * The page constants: the head references, the readiness names, and the page-side scripts.
3
3
  *
4
4
  * A script here is browser source text, not module code. Thus it reads no module binding, and each value
5
- * that it needs is interpolated at build time. The style rules and the ECharts theme live in `design.ts`.
5
+ * that it needs is interpolated at build time. The style rules, the ECharts theme, and the grid theme
6
+ * parameters live in `design.ts`.
6
7
  */
7
8
  /**
8
- * The head references of the staged assets. The page loads the chart runtime from the sibling assets
9
- * directory, thus the head names no remote host. The manifest gives the staged name, thus the tag and the
10
- * stage step of the caller cannot disagree.
9
+ * The head reference of the chart runtime. The page loads it from the sibling assets directory, thus the
10
+ * head names no remote host. The manifest gives the staged name, thus the tag and the stage step of the
11
+ * caller cannot disagree.
12
+ *
13
+ * The tag is a classic script. A `file://` page refuses a module request, thus a classic script is the one
14
+ * form that loads beside the page.
11
15
  */
12
16
  export declare const ASSET_HEAD: string;
17
+ /**
18
+ * The head reference of the grid runtime.
19
+ *
20
+ * The bundle weighs about two megabytes, and a page with no table has nothing to build. Thus the skeleton
21
+ * writes this tag only for a page that carries table data, and the manifest still stages the file for the
22
+ * whole directory.
23
+ */
24
+ export declare const GRID_ASSET_HEAD: string;
13
25
  /**
14
26
  * The name of the readiness event, and the name of the window sentinel that guards a late listener. The
15
27
  * bootstrap below emits both names, thus this module owns them. A capture that waits for the page reads the
@@ -24,12 +36,32 @@ export declare const THEME_READY_SENTINEL = "__inflexaThemeReady";
24
36
  */
25
37
  export declare const PAGE_NAV_TIMEOUT_MS = 20000;
26
38
  export declare const PAGE_READY_TIMEOUT_MS = 8000;
39
+ /**
40
+ * The client twin of the chart data derivation, as browser source text.
41
+ *
42
+ * A dense chart ships no row. Its option states, for each series, the columns of the payload that it reads,
43
+ * the transform of each column, the split that it holds, and the rows that carry a point label. This
44
+ * fragment reads those descriptors and builds the data of each series.
45
+ *
46
+ * The fragment writes its own constants, because a page script reads no module binding. Each rule here is
47
+ * the twin of one rule of the server derivation: the number read of a cell, the four transforms, the
48
+ * competition rank, the compare of a sort, and the three-way classification of a preset. A shared test
49
+ * vector runs the transforms of both sides over one set of cells, thus the two cannot drift in silence.
50
+ *
51
+ * The build reads the decoded rows of the payload. The decoder runs before this script, thus a row is a
52
+ * record and a cell reads by its column name.
53
+ */
54
+ export declare const CHART_SERIES_BUILDER: string;
27
55
  /**
28
56
  * The page-side script that wires each chart. It finds every chart container, reads the option JSON from
29
57
  * the sibling `<script type="application/json">` element, and initializes ECharts with the registered
30
58
  * theme. The skeleton registers the theme before this script runs. A resize handler keeps each chart
31
59
  * fit to the window.
32
60
  *
61
+ * An option that carries the data-source member holds no row. The script then reads the registered payload
62
+ * of the artifact and builds the data of each series from the descriptors. A mount whose payload the
63
+ * registry does not hold keeps its empty card, and the walk continues.
64
+ *
33
65
  * The script signals readiness when the bootstrap completes, and immediately when no chart exists. It sets
34
66
  * the `window.__inflexaThemeReady` sentinel and dispatches the `inflexa-theme-ready` event on the document.
35
67
  * A reader that captures the page keys on this signal, thus the capture returns when the page is ready and
@@ -65,3 +97,87 @@ export declare const CHART_BOOTSTRAP: string;
65
97
  * element without this script.
66
98
  */
67
99
  export declare const FADE_IN_OBSERVER = "(function () {\n var waiting = [];\n var settled = false;\n function settle() {\n if (settled) {\n return;\n }\n settled = true;\n for (var w = 0; w < waiting.length; w++) {\n waiting[w]();\n }\n waiting = [];\n }\n window.__inflexaWhenRevealed = function (done) {\n if (settled) {\n done();\n return;\n }\n waiting.push(done);\n };\n function reveal(node) {\n node.classList.add(\"fade-in-visible\");\n }\n function revealSettled(node) {\n node.classList.add(\"fade-in-instant\");\n node.classList.add(\"fade-in-visible\");\n }\n function start() {\n var nodes = document.querySelectorAll(\".fade-in\");\n if (typeof IntersectionObserver === \"undefined\" || nodes.length === 0) {\n for (var i = 0; i < nodes.length; i++) {\n revealSettled(nodes[i]);\n }\n settle();\n return;\n }\n var firstPass = true;\n var observer = new IntersectionObserver(function (entries) {\n var instant = firstPass;\n firstPass = false;\n for (var j = 0; j < entries.length; j++) {\n var entry = entries[j];\n if (!entry.isIntersecting) {\n continue;\n }\n var target = entry.target;\n observer.unobserve(target);\n if (instant) {\n revealSettled(target);\n continue;\n }\n var delay = parseInt(target.getAttribute(\"data-delay\") || \"0\", 10) || 0;\n setTimeout(reveal.bind(null, target), delay);\n }\n if (instant) {\n settle();\n }\n }, { threshold: 0 });\n for (var k = 0; k < nodes.length; k++) {\n observer.observe(nodes[k]);\n }\n setTimeout(settle, 2000);\n }\n if (document.readyState === \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", start);\n } else {\n start();\n }\n})();";
100
+ /**
101
+ * The page-side script that marks the navigation link of the section in view.
102
+ *
103
+ * Each navigation anchor targets one top-level section by its id. The script resolves each anchor to its
104
+ * section, and an `IntersectionObserver` over those sections drives the active class. The observation box
105
+ * covers the top band of the viewport alone, thus the script marks the first section of that band in
106
+ * document order and exactly one link carries the class.
107
+ *
108
+ * A section that no anchor targets, and an anchor whose target is absent, drop out of the walk. Thus the
109
+ * reference band never takes the mark.
110
+ *
111
+ * A page can leave the observation box empty. At scroll 0, each section can start below the box. A short
112
+ * tail also holds the last section below the box for the whole scroll. Thus the paint step has a fallback.
113
+ * The fallback marks the last section whose top sits at the end of the box or above it. It marks the first
114
+ * section when every top sits below the box.
115
+ *
116
+ * The fallback reads each position with `getBoundingClientRect` at paint time. A scroll moves each section,
117
+ * thus a cached position names the wrong link. As a result, exactly one link carries the active class on a
118
+ * page that has a section.
119
+ *
120
+ * The highlight is decoration. A browser with no `IntersectionObserver`, and a page with no navigation,
121
+ * keep the plain links. The script writes one class and it reads nothing that the reveal script writes,
122
+ * thus the two observers never contend.
123
+ */
124
+ export declare const SECTION_SPY: string;
125
+ /**
126
+ * The decoder of the table data assets.
127
+ *
128
+ * Each data asset registers its payload under the global map, keyed by the block id. The payload is
129
+ * columnar: a row is an array in column order, and a number in a column that carries a dictionary is the
130
+ * index of its value. This script materializes the decoded rows one time, thus a reader of the data takes
131
+ * plain row objects and no reader repeats the decode.
132
+ *
133
+ * The decoded rows land on the payload itself, under `rows`. The encoded arrays stay under `encoded`, thus
134
+ * the decode runs one time even when the script runs again. A cell of `null` names a column that the row
135
+ * does not hold, and the decoded row omits that key. Thus a ragged row stays ragged and no key reads as an
136
+ * empty value.
137
+ *
138
+ * The script runs after the data assets and before the page scripts. A page with no table registers no
139
+ * map, and the guard leaves such a page untouched.
140
+ */
141
+ export declare const TABLE_DATA_DECODER = "(function () {\n var registry = window.__REPORT_TABLES;\n if (!registry) {\n return;\n }\n var ids = Object.keys(registry);\n for (var i = 0; i < ids.length; i++) {\n var payload = registry[ids[i]];\n if (!payload || payload.encoded) {\n continue;\n }\n var columns = payload.columns || [];\n var dict = payload.dict || {};\n var encoded = payload.rows || [];\n var decoded = [];\n for (var r = 0; r < encoded.length; r++) {\n var row = encoded[r];\n // A column name is authored text. A plain object would read an inherited member such as\n // \"constructor\" as a dictionary, and it would send a \"__proto__\" column to the prototype. The\n // null-prototype record and the own-key test keep every column name an ordinary entry.\n var record = Object.create(null);\n for (var c = 0; c < columns.length; c++) {\n var cell = row[c];\n if (cell === null || cell === undefined) {\n continue;\n }\n var name = columns[c];\n var values = Object.prototype.hasOwnProperty.call(dict, name) ? dict[name] : null;\n record[name] = values && typeof cell === \"number\" ? values[cell] : cell;\n }\n decoded.push(record);\n }\n payload.encoded = encoded;\n payload.rows = decoded;\n }\n})();";
142
+ /**
143
+ * The client twin of `formatTableCell`, as browser source text.
144
+ *
145
+ * The rows of a table reach the reader through the data asset, thus the page formats each cell. The server
146
+ * ships the kind of each column, and this fragment reads the cell under that kind: the identifier text, the
147
+ * bound of a stored zero, the exponent of a small probability, the grouped whole number, the rounded float,
148
+ * the typographic minus of a negative, and the trim of a delimited name.
149
+ *
150
+ * The fragment writes its own constants, because a page script reads no module binding. A shared test vector
151
+ * runs the server helper and this twin over the same entries, thus the two cannot give different text in
152
+ * silence. `formatCell` is the one entry point, and the grid boot below inlines the whole fragment.
153
+ */
154
+ export declare const TABLE_CELL_FORMATTER = "function formatCell(cell, kind, bound) {\n var text = cellText(cell, kind, bound);\n var segments = text.split(\"%\");\n if (segments.length < 3) {\n return text;\n }\n for (var s = 0; s < segments.length; s++) {\n if (segments[s].length === 0 || /\\s/.test(segments[s])) {\n return text;\n }\n }\n return segments[0];\n}\nfunction cellText(cell, kind, bound) {\n if (kind === \"identifier\") {\n return String(cell).trim();\n }\n var value = finiteValue(cell);\n if (value === null) {\n return String(cell);\n }\n return shownMinus(numberText(value, kind, bound));\n}\nfunction shownMinus(text) {\n // The leading character alone. An exponent keeps its own hyphen, thus one form reads one notation.\n return text.charAt(0) === \"-\" ? \"\u2212\" + text.slice(1) : text;\n}\nfunction numberText(value, kind, bound) {\n if (kind === \"scientific\") {\n if (value === 0) {\n return bound !== undefined && bound !== null && bound > 0 ? \"<\" + boundForm(bound) : \"\u2248\" + \"0\";\n }\n if (value > 0 && value < 1e-2) {\n return scientificForm(value);\n }\n }\n if (Number.isSafeInteger(value)) {\n return compactForm(value);\n }\n var magnitude = Math.abs(value);\n if (value !== 0 && magnitude < 1e-3) {\n return scientificForm(value);\n }\n var rounded = Math.round(magnitude);\n if (rounded >= 1e3 && rounded < 1e15) {\n return compactForm(value);\n }\n return tidy(value.toPrecision(3));\n}\nfunction finiteValue(cell) {\n if (typeof cell === \"number\") {\n return isFinite(cell) ? cell : null;\n }\n var trimmed = String(cell).trim();\n if (trimmed === \"\") {\n return null;\n }\n var parsed = Number(trimmed);\n return isFinite(parsed) ? parsed : null;\n}\nfunction boundForm(bound) {\n var parts = bound.toExponential().split(\"e\");\n var digits = parts[0].replace(\".\", \"\");\n var raised = Number(digits.charAt(0)) + (digits.length > 1 ? 1 : 0);\n var carries = raised === 10;\n var digit = carries ? 1 : raised;\n var power = Number(parts[1]) + (carries ? 1 : 0);\n if (power < -2) {\n return digit + \"e\" + power;\n }\n return power >= 0 ? String(digit) + zeros(power) : \"0.\" + zeros(-power - 1) + digit;\n}\nfunction zeros(count) {\n var text = \"\";\n for (var z = 0; z < count; z++) {\n text += \"0\";\n }\n return text;\n}\nfunction scientificForm(value) {\n return tidy(value.toExponential(1));\n}\nfunction compactForm(value) {\n return (value < 0 ? \"-\" : \"\") + groupDigits(Math.abs(value).toFixed(0));\n}\nfunction groupDigits(digits) {\n if (!/^[0-9]+$/.test(digits)) {\n return digits;\n }\n var grouped = \"\";\n for (var d = 0; d < digits.length; d++) {\n if (d > 0 && (digits.length - d) % 3 === 0) {\n grouped += \",\";\n }\n grouped += digits.charAt(d);\n }\n return grouped;\n}\nfunction tidy(text) {\n var marker = text.indexOf(\"e\");\n if (marker < 0) {\n return trimZeros(text);\n }\n return trimZeros(text.slice(0, marker)) + \"e\" + text.slice(marker + 1).replace(\"+\", \"\");\n}\nfunction trimZeros(text) {\n if (text.indexOf(\".\") < 0) {\n return text;\n }\n var end = text.length;\n while (end > 0 && text.charAt(end - 1) === \"0\") {\n end -= 1;\n }\n if (text.charAt(end - 1) === \".\") {\n end -= 1;\n }\n return text.slice(0, end);\n}";
155
+ /**
156
+ * The page-side script that builds one grid for each table block.
157
+ *
158
+ * The script walks the grid mounts. Each mount names its block, and the registry holds the decoded rows and
159
+ * the column display of that block. Thus the boot reads what the server resolved, and it resolves nothing
160
+ * again. A mount whose block the registry does not hold keeps its empty card, and the walk continues.
161
+ *
162
+ * The column definition takes the label, the filter, and the two readings of a cell. The formatter gives the
163
+ * shown text under the kind of the column, and the tooltip gives the raw cell where the shown text differs
164
+ * from it. A value getter reads the own key of the row, because the field of a column reads a point as a
165
+ * path and a column name can hold one. A number column also parses the cell for its filter, thus a column
166
+ * of numeric text compares as a number and a sentinel matches nothing.
167
+ *
168
+ * The row model is the client-side model. It renders the visible slice alone, thus a table of many thousands
169
+ * of rows costs the DOM a screen of rows. The mount takes the height of its rows, up to the visible count,
170
+ * thus a short table leaves no empty box under it. A wide table adds the horizontal scroll bar that the
171
+ * host paints, measured at the first data render, thus the bar covers no row.
172
+ *
173
+ * The status of the card reads the model of the grid. The grid gives a model event after each filter and
174
+ * each sort, thus the count states what the reader sees against what the table holds.
175
+ *
176
+ * The print hooks switch the grid to its print layout. That layout lays every row out at once and it holds
177
+ * no scroll viewport, thus each row of the print form reaches the paper. The print stops at the print bound,
178
+ * and the note of the card then states what the paper shows and where the whole table is.
179
+ *
180
+ * One grid builds inside a guard. A malformed payload is exactly the fault that a look must diagnose, thus
181
+ * it must never stop a sibling grid and it must never throw out of the page.
182
+ */
183
+ export declare const GRID_BOOTSTRAP: string;