@tangle-network/agent-eval 0.120.2 → 0.120.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/analyst/index.d.ts +3111 -0
  3. package/dist/analyst/index.js +403 -0
  4. package/dist/analyst/index.js.map +1 -0
  5. package/dist/authenticity/index.d.ts +161 -0
  6. package/dist/authenticity/index.js +215 -0
  7. package/dist/authenticity/index.js.map +1 -0
  8. package/dist/belief-state/index.d.ts +1301 -0
  9. package/dist/belief-state/index.js +2152 -0
  10. package/dist/belief-state/index.js.map +1 -0
  11. package/dist/benchmarks/index.d.ts +974 -0
  12. package/dist/benchmarks/index.js +60 -0
  13. package/dist/benchmarks/index.js.map +1 -0
  14. package/dist/builder-eval/index.d.ts +695 -0
  15. package/dist/builder-eval/index.js +366 -0
  16. package/dist/builder-eval/index.js.map +1 -0
  17. package/dist/campaign/index.d.ts +7454 -0
  18. package/dist/campaign/index.js +272 -0
  19. package/dist/campaign/index.js.map +1 -0
  20. package/dist/chunk-3CDFMEMO.js +3878 -0
  21. package/dist/chunk-3CDFMEMO.js.map +1 -0
  22. package/dist/chunk-3RF76KTD.js +84 -0
  23. package/dist/chunk-3RF76KTD.js.map +1 -0
  24. package/dist/chunk-3XH4Y2SS.js +750 -0
  25. package/dist/chunk-3XH4Y2SS.js.map +1 -0
  26. package/dist/chunk-3YYRZDON.js +45 -0
  27. package/dist/chunk-3YYRZDON.js.map +1 -0
  28. package/dist/chunk-5BYTIDZ7.js +550 -0
  29. package/dist/chunk-5BYTIDZ7.js.map +1 -0
  30. package/dist/chunk-5CVUPHJ4.js +2668 -0
  31. package/dist/chunk-5CVUPHJ4.js.map +1 -0
  32. package/dist/chunk-ARU2PZFM.js +312 -0
  33. package/dist/chunk-ARU2PZFM.js.map +1 -0
  34. package/dist/chunk-BOD4O7OF.js +40 -0
  35. package/dist/chunk-BOD4O7OF.js.map +1 -0
  36. package/dist/chunk-CVJP5TMD.js +766 -0
  37. package/dist/chunk-CVJP5TMD.js.map +1 -0
  38. package/dist/chunk-DPZAEKA6.js +880 -0
  39. package/dist/chunk-DPZAEKA6.js.map +1 -0
  40. package/dist/chunk-DTJ6QUQB.js +131 -0
  41. package/dist/chunk-DTJ6QUQB.js.map +1 -0
  42. package/dist/chunk-GGE4NNQT.js +65 -0
  43. package/dist/chunk-GGE4NNQT.js.map +1 -0
  44. package/dist/chunk-H5UD2323.js +286 -0
  45. package/dist/chunk-H5UD2323.js.map +1 -0
  46. package/dist/chunk-HHWE3POT.js +94 -0
  47. package/dist/chunk-HHWE3POT.js.map +1 -0
  48. package/dist/chunk-HKUCJ437.js +787 -0
  49. package/dist/chunk-HKUCJ437.js.map +1 -0
  50. package/dist/chunk-JHCHEVET.js +274 -0
  51. package/dist/chunk-JHCHEVET.js.map +1 -0
  52. package/dist/chunk-K4DBDHLK.js +158 -0
  53. package/dist/chunk-K4DBDHLK.js.map +1 -0
  54. package/dist/chunk-K6N6XJJX.js +306 -0
  55. package/dist/chunk-K6N6XJJX.js.map +1 -0
  56. package/dist/chunk-MA6HLL3S.js +65 -0
  57. package/dist/chunk-MA6HLL3S.js.map +1 -0
  58. package/dist/chunk-MAZ26DC7.js +99 -0
  59. package/dist/chunk-MAZ26DC7.js.map +1 -0
  60. package/dist/chunk-MOXWMGPC.js +577 -0
  61. package/dist/chunk-MOXWMGPC.js.map +1 -0
  62. package/dist/chunk-NJC7U437.js +626 -0
  63. package/dist/chunk-NJC7U437.js.map +1 -0
  64. package/dist/chunk-NMN4WGSJ.js +1030 -0
  65. package/dist/chunk-NMN4WGSJ.js.map +1 -0
  66. package/dist/chunk-NPCTHQIO.js +91 -0
  67. package/dist/chunk-NPCTHQIO.js.map +1 -0
  68. package/dist/chunk-ONWEPEDO.js +57 -0
  69. package/dist/chunk-ONWEPEDO.js.map +1 -0
  70. package/dist/chunk-OYZAPX5G.js +1526 -0
  71. package/dist/chunk-OYZAPX5G.js.map +1 -0
  72. package/dist/chunk-P5MGQ2FY.js +7958 -0
  73. package/dist/chunk-P5MGQ2FY.js.map +1 -0
  74. package/dist/chunk-PC4UYEBM.js +166 -0
  75. package/dist/chunk-PC4UYEBM.js.map +1 -0
  76. package/dist/chunk-PJQFMIOX.js +1182 -0
  77. package/dist/chunk-PJQFMIOX.js.map +1 -0
  78. package/dist/chunk-PXD6ZFNY.js +1107 -0
  79. package/dist/chunk-PXD6ZFNY.js.map +1 -0
  80. package/dist/chunk-PXE2VKMX.js +140 -0
  81. package/dist/chunk-PXE2VKMX.js.map +1 -0
  82. package/dist/chunk-PZ5AY32C.js +10 -0
  83. package/dist/chunk-PZ5AY32C.js.map +1 -0
  84. package/dist/chunk-QBRSJK47.js +622 -0
  85. package/dist/chunk-QBRSJK47.js.map +1 -0
  86. package/dist/chunk-S3UZOQ5Y.js +328 -0
  87. package/dist/chunk-S3UZOQ5Y.js.map +1 -0
  88. package/dist/chunk-SQQED7ZH.js +998 -0
  89. package/dist/chunk-SQQED7ZH.js.map +1 -0
  90. package/dist/chunk-SYV364BL.js +1266 -0
  91. package/dist/chunk-SYV364BL.js.map +1 -0
  92. package/dist/chunk-T4SQEITX.js +95 -0
  93. package/dist/chunk-T4SQEITX.js.map +1 -0
  94. package/dist/chunk-TT4KNT67.js +124 -0
  95. package/dist/chunk-TT4KNT67.js.map +1 -0
  96. package/dist/chunk-U5CHZ5M3.js +357 -0
  97. package/dist/chunk-U5CHZ5M3.js.map +1 -0
  98. package/dist/chunk-ULOKLHIQ.js +1937 -0
  99. package/dist/chunk-ULOKLHIQ.js.map +1 -0
  100. package/dist/chunk-VI2UW6B6.js +162 -0
  101. package/dist/chunk-VI2UW6B6.js.map +1 -0
  102. package/dist/chunk-VQMK5FMP.js +247 -0
  103. package/dist/chunk-VQMK5FMP.js.map +1 -0
  104. package/dist/chunk-VSMTAMNK.js +53 -0
  105. package/dist/chunk-VSMTAMNK.js.map +1 -0
  106. package/dist/chunk-VZSRQ272.js +149 -0
  107. package/dist/chunk-VZSRQ272.js.map +1 -0
  108. package/dist/chunk-WW2A73HW.js +159 -0
  109. package/dist/chunk-WW2A73HW.js.map +1 -0
  110. package/dist/chunk-X4UCIOTZ.js +136 -0
  111. package/dist/chunk-X4UCIOTZ.js.map +1 -0
  112. package/dist/chunk-XJYR7XFV.js +317 -0
  113. package/dist/chunk-XJYR7XFV.js.map +1 -0
  114. package/dist/chunk-ZET2UAYW.js +89 -0
  115. package/dist/chunk-ZET2UAYW.js.map +1 -0
  116. package/dist/chunk-ZMXDQ4K7.js +870 -0
  117. package/dist/chunk-ZMXDQ4K7.js.map +1 -0
  118. package/dist/chunk-ZZUXHH3R.js +99 -0
  119. package/dist/chunk-ZZUXHH3R.js.map +1 -0
  120. package/dist/cli.d.ts +1 -0
  121. package/dist/cli.js +112 -0
  122. package/dist/cli.js.map +1 -0
  123. package/dist/contract/index.d.ts +4972 -0
  124. package/dist/contract/index.js +1654 -0
  125. package/dist/contract/index.js.map +1 -0
  126. package/dist/control.d.ts +1013 -0
  127. package/dist/control.js +34 -0
  128. package/dist/control.js.map +1 -0
  129. package/dist/fuzz.d.ts +759 -0
  130. package/dist/fuzz.js +714 -0
  131. package/dist/fuzz.js.map +1 -0
  132. package/dist/hosted/index.d.ts +730 -0
  133. package/dist/hosted/index.js +14 -0
  134. package/dist/hosted/index.js.map +1 -0
  135. package/dist/index.d.ts +16780 -0
  136. package/dist/index.js +12168 -0
  137. package/dist/index.js.map +1 -0
  138. package/dist/matrix/index.d.ts +155 -0
  139. package/dist/matrix/index.js +8 -0
  140. package/dist/matrix/index.js.map +1 -0
  141. package/dist/meta-eval/index.d.ts +1030 -0
  142. package/dist/meta-eval/index.js +417 -0
  143. package/dist/meta-eval/index.js.map +1 -0
  144. package/dist/multishot/index.d.ts +579 -0
  145. package/dist/multishot/index.js +589 -0
  146. package/dist/multishot/index.js.map +1 -0
  147. package/dist/openapi.json +992 -0
  148. package/dist/pipelines/index.d.ts +567 -0
  149. package/dist/pipelines/index.js +515 -0
  150. package/dist/pipelines/index.js.map +1 -0
  151. package/dist/reporting.d.ts +1277 -0
  152. package/dist/reporting.js +48 -0
  153. package/dist/reporting.js.map +1 -0
  154. package/dist/rl.d.ts +4092 -0
  155. package/dist/rl.js +1724 -0
  156. package/dist/rl.js.map +1 -0
  157. package/dist/run-campaign-75RTPVV5.js +14 -0
  158. package/dist/run-campaign-75RTPVV5.js.map +1 -0
  159. package/dist/storyboard/index.d.ts +279 -0
  160. package/dist/storyboard/index.js +767 -0
  161. package/dist/storyboard/index.js.map +1 -0
  162. package/dist/trace-attributes.d.ts +52 -0
  163. package/dist/trace-attributes.js +62 -0
  164. package/dist/trace-attributes.js.map +1 -0
  165. package/dist/traces.d.ts +2343 -0
  166. package/dist/traces.js +249 -0
  167. package/dist/traces.js.map +1 -0
  168. package/dist/wire/index.d.ts +1252 -0
  169. package/dist/wire/index.js +81 -0
  170. package/dist/wire/index.js.map +1 -0
  171. package/package.json +1 -1
@@ -0,0 +1,279 @@
1
+ type SpanKind = 'agent' | 'llm' | 'tool' | 'retrieval' | 'judge' | 'sandbox' | 'custom';
2
+ type SpanStatus = 'ok' | 'error';
3
+ interface SpanBase {
4
+ spanId: string;
5
+ parentSpanId?: string;
6
+ runId: string;
7
+ kind: SpanKind;
8
+ name: string;
9
+ startedAt: number;
10
+ endedAt?: number;
11
+ status?: SpanStatus;
12
+ error?: string;
13
+ /** Anything not covered by typed fields. Kept deliberately free-form. */
14
+ attributes?: Record<string, unknown>;
15
+ }
16
+ interface Message {
17
+ role: 'system' | 'user' | 'assistant' | 'tool';
18
+ content: string;
19
+ tokens?: number;
20
+ /** Multi-modal content descriptors; blobs themselves live in Artifacts. */
21
+ images?: Array<{
22
+ artifactId?: string;
23
+ url?: string;
24
+ mime?: string;
25
+ }>;
26
+ }
27
+ interface LlmSpan extends SpanBase {
28
+ kind: 'llm';
29
+ model: string;
30
+ messages: Message[];
31
+ output?: string;
32
+ inputTokens?: number;
33
+ /** All generated tokens, including the reasoning subset when present. */
34
+ outputTokens?: number;
35
+ cachedTokens?: number;
36
+ cacheWriteTokens?: number;
37
+ /** Reasoning-token subset of `outputTokens`. */
38
+ reasoningTokens?: number;
39
+ costUsd?: number;
40
+ finishReason?: string;
41
+ }
42
+ interface ToolSpan extends SpanBase {
43
+ kind: 'tool';
44
+ toolName: string;
45
+ args: unknown;
46
+ /** False when the source observed the call but did not capture its arguments. */
47
+ argsCaptured?: boolean;
48
+ result?: unknown;
49
+ latencyMs?: number;
50
+ }
51
+ interface RetrievalSpan extends SpanBase {
52
+ kind: 'retrieval';
53
+ query: string;
54
+ hits: Array<{
55
+ docId: string;
56
+ score: number;
57
+ content?: string;
58
+ }>;
59
+ }
60
+ interface JudgeSpan extends SpanBase {
61
+ kind: 'judge';
62
+ judgeId: string;
63
+ /** Span this judgment applies to. */
64
+ targetSpanId: string;
65
+ dimension: string;
66
+ /** Numeric score (free-range; interpretation up to the judge). */
67
+ score: number;
68
+ rationale?: string;
69
+ evidence?: string;
70
+ }
71
+ interface SandboxSpan extends SpanBase {
72
+ kind: 'sandbox';
73
+ image?: string;
74
+ command?: string;
75
+ exitCode?: number;
76
+ testsTotal?: number;
77
+ testsPassed?: number;
78
+ stdoutHash?: string;
79
+ stderrHash?: string;
80
+ /** Duration in ms; the harness fills this explicitly (endedAt - startedAt may miss setup). */
81
+ wallMs?: number;
82
+ }
83
+ interface GenericSpan extends SpanBase {
84
+ kind: 'agent' | 'custom';
85
+ }
86
+ type Span = LlmSpan | ToolSpan | RetrievalSpan | JudgeSpan | SandboxSpan | GenericSpan;
87
+
88
+ /**
89
+ * Code-edit extraction + the "watch the agent write code" animation.
90
+ *
91
+ * The base storyboard (./index) compresses a run into scenes but keeps scenes
92
+ * payload-free (title + narration + evidence span ids). To actually SHOW the
93
+ * code an agent wrote, this module pulls the concrete edit (path, diff,
94
+ * before/after, language) out of the raw edit-tool spans and renders a
95
+ * self-contained HTML replay that types each file out, character by character,
96
+ * like an editor recording.
97
+ *
98
+ * Additive on purpose: it reuses the canonical `Span` (trace/schema) and the
99
+ * `Storyboard` IR (./index) without modifying the reducer/compiler — so it
100
+ * composes with the existing pipeline and a Remotion consumer can read the same
101
+ * `CodeEdit[]` to render an MP4.
102
+ */
103
+
104
+ /** A concrete code change lifted from a tool span. */
105
+ interface CodeEdit {
106
+ /** Span the edit came from — back-reference into the trace. */
107
+ spanId: string;
108
+ path: string;
109
+ language?: string;
110
+ /** Unified diff, when the tool carried one. */
111
+ diff?: string;
112
+ /** Full file body before / after, when present — enables true keystroke
113
+ * animation rather than only flashing a diff. */
114
+ before?: string;
115
+ after?: string;
116
+ additions: number;
117
+ deletions: number;
118
+ startedAt: number;
119
+ }
120
+ /** Extract a CodeEdit from a single span, or undefined if it is not an edit. */
121
+ declare function codeEditFromSpan(span: Span): CodeEdit | undefined;
122
+ /** All code edits in a run, in chronological order. */
123
+ declare function extractCodeEdits(spans: readonly Span[]): CodeEdit[];
124
+ /** Pair each code-edit (`diff`) scene with its concrete edit, matched via the
125
+ * scene's evidence span ids. Scenes without a recoverable edit are dropped. */
126
+ declare function codeEditsForStoryboard(storyboard: Storyboard, spans: readonly Span[]): Array<{
127
+ scene: Scene;
128
+ edit: CodeEdit;
129
+ }>;
130
+ /** The text the animation types for an edit: prefer the full new file body,
131
+ * then the added lines of a diff, then a minimal placeholder so the scene is
132
+ * never blank. */
133
+ declare function editAnimationText(edit: CodeEdit): string;
134
+ interface CodeAnimationOptions {
135
+ /** Page title. Default "Agent writing code". */
136
+ title?: string;
137
+ /** Characters typed per animation tick. Higher = faster. Default 4. */
138
+ charsPerTick?: number;
139
+ /** Pause between files, ms. Default 900. */
140
+ pauseBetweenMs?: number;
141
+ }
142
+ /**
143
+ * Render a self-contained HTML page that animates the agent writing each file,
144
+ * character by character, with a filename tab, line numbers, and a blinking
145
+ * cursor — the shareable "watch it build" clip. No build step, no assets, no
146
+ * deps. The same `CodeEdit[]` feeds a Remotion MP4 renderer in a consumer
147
+ * package; this is the dependency-free baseline.
148
+ */
149
+ declare function renderCodeAnimationHtml(source: readonly Span[] | readonly CodeEdit[], opts?: CodeAnimationOptions): string;
150
+
151
+ /**
152
+ * Storyboard — compile a raw agent trace into a small set of meaningful scenes,
153
+ * then render them as a shareable, watchable replay.
154
+ *
155
+ * Span[] → SemanticEvent[] → Storyboard{scenes} → { markdown | html }
156
+ *
157
+ * The trace is the source of truth; the storyboard is the IR; markdown/html
158
+ * (and, in a consumer package, Remotion/MP4) are compiled targets. Everything
159
+ * here is PURE — same spans in, same bytes out (no clock/random) — so a run's
160
+ * replay is deterministic and diffable.
161
+ *
162
+ * Crucially, every scene carries a modality-typed VISUAL extracted from the
163
+ * span — a browser/computer screenshot, a code diff, a terminal command +
164
+ * output, file content, an API request/response, or reasoning prose — so no
165
+ * matter what the agent did, the replay SHOWS it, not just narrates it. The
166
+ * reducer is rules-based; an LLM pass can refine titles/summaries later, but
167
+ * the structure + visuals do not depend on one. Renderers that need a browser
168
+ * (Remotion, React) live in consumers; this module only emits strings.
169
+ */
170
+
171
+ /** What the agent meaningfully did — the compressed vocabulary. */
172
+ type SemanticKind = 'understood_task' | 'user_message' | 'agent_reply' | 'reasoned' | 'ran_command' | 'read_file' | 'edited_code' | 'searched' | 'used_browser' | 'used_computer' | 'called_api' | 'called_tool' | 'evaluated' | 'observed_failure' | 'completed';
173
+ /** The modality-typed payload a scene shows. This is what makes any agent
174
+ * action — screen, browser, shell, code, API — actually viewable. */
175
+ type SceneVisual = {
176
+ type: 'screenshot';
177
+ src: string;
178
+ caption?: string;
179
+ } | {
180
+ type: 'browser';
181
+ url?: string;
182
+ action?: string;
183
+ screenshot?: string;
184
+ } | {
185
+ type: 'diff';
186
+ path: string;
187
+ patch: string;
188
+ } | {
189
+ type: 'code';
190
+ path: string;
191
+ content: string;
192
+ } | {
193
+ type: 'terminal';
194
+ command: string;
195
+ output?: string;
196
+ } | {
197
+ type: 'api';
198
+ method?: string;
199
+ url: string;
200
+ status?: number;
201
+ request?: string;
202
+ response?: string;
203
+ } | {
204
+ type: 'prose';
205
+ text: string;
206
+ } | {
207
+ type: 'none';
208
+ };
209
+ interface SemanticEvent {
210
+ kind: SemanticKind;
211
+ /** One-line headline (the ticket/scene title). */
212
+ title: string;
213
+ /** Short human summary. */
214
+ summary: string;
215
+ /** The modality payload to show for this moment. */
216
+ visual: SceneVisual;
217
+ /** Span ids backing this moment — the evidence trail. */
218
+ evidenceSpanIds: string[];
219
+ /** 1 (noise) … 5 (pivotal: failures, edits). Drives selection + duration. */
220
+ importance: 1 | 2 | 3 | 4 | 5;
221
+ startTs: number;
222
+ endTs: number;
223
+ }
224
+ interface ReduceOptions {
225
+ /** Collapse adjacent same-kind moments into one. Default true. */
226
+ collapseAdjacent?: boolean;
227
+ }
228
+ /**
229
+ * Reduce a span tree into the meaningful moments a viewer cares about. The
230
+ * conversation (user asks, agent replies) is lifted from LLM spans first so the
231
+ * dialogue is first-class; the remaining work spans are classified + have their
232
+ * modality visual extracted. Adjacent same-kind work moments collapse (the
233
+ * compression step), carrying the latest visual; failures and conversation
234
+ * turns never collapse.
235
+ */
236
+ declare function reduceToSemanticEvents(spans: readonly Span[], opts?: ReduceOptions): SemanticEvent[];
237
+ type SceneType = 'title_card' | 'prompt' | 'reply' | 'reasoning' | 'terminal' | 'file' | 'diff' | 'search' | 'browser' | 'computer' | 'api' | 'tool' | 'eval' | 'error' | 'summary';
238
+ interface Scene {
239
+ sceneType: SceneType;
240
+ title: string;
241
+ narration: string;
242
+ /** The modality payload the renderer shows. */
243
+ visual: SceneVisual;
244
+ durationMs: number;
245
+ evidenceSpanIds: string[];
246
+ }
247
+ interface Storyboard {
248
+ title: string;
249
+ totalMs: number;
250
+ scenes: Scene[];
251
+ }
252
+ interface CompileOptions {
253
+ /** Headline for the title card. Default "Agent run". */
254
+ title?: string;
255
+ /** Max action scenes between the title + summary cards. Default 16. */
256
+ maxScenes?: number;
257
+ }
258
+ /**
259
+ * Select the moments worth showing and lay them out as scenes. Every failure
260
+ * (importance 5) and edit (4) is always kept; the rest fill the budget by
261
+ * importance, then re-sort chronological. A title card opens, a summary closes.
262
+ */
263
+ declare function compileStoryboard(events: readonly SemanticEvent[], opts?: CompileOptions): Storyboard;
264
+ /** Render the storyboard as a Markdown timeline — the human-readable shot list. */
265
+ declare function renderStoryboardMarkdown(storyboard: Storyboard): string;
266
+ interface HtmlRenderOptions {
267
+ /** Document title + on-page heading. Defaults to the storyboard title. */
268
+ title?: string;
269
+ }
270
+ /**
271
+ * Render the storyboard as a self-contained, auto-playing HTML replay — one
272
+ * shareable file, no build step, no external assets. Each scene animates in
273
+ * for its duration and SHOWS its modality (screenshot / diff / terminal / API
274
+ * / browser / prose); controls let a viewer scrub. This is the "free clip" a
275
+ * run produces; an MP4 is the same storyboard fed to Remotion in a consumer.
276
+ */
277
+ declare function renderStoryboardHtml(storyboard: Storyboard, opts?: HtmlRenderOptions): string;
278
+
279
+ export { type CodeAnimationOptions, type CodeEdit, type CompileOptions, type HtmlRenderOptions, type ReduceOptions, type Scene, type SceneType, type SceneVisual, type SemanticEvent, type SemanticKind, type Storyboard, codeEditFromSpan, codeEditsForStoryboard, compileStoryboard, editAnimationText, extractCodeEdits, reduceToSemanticEvents, renderCodeAnimationHtml, renderStoryboardHtml, renderStoryboardMarkdown };