@tangle-network/agent-eval 0.120.0 → 0.120.2
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/CHANGELOG.md +12 -0
- package/package.json +1 -1
- package/dist/analyst/index.d.ts +0 -3111
- package/dist/analyst/index.js +0 -403
- package/dist/analyst/index.js.map +0 -1
- package/dist/authenticity/index.d.ts +0 -161
- package/dist/authenticity/index.js +0 -215
- package/dist/authenticity/index.js.map +0 -1
- package/dist/belief-state/index.d.ts +0 -1301
- package/dist/belief-state/index.js +0 -2152
- package/dist/belief-state/index.js.map +0 -1
- package/dist/benchmarks/index.d.ts +0 -974
- package/dist/benchmarks/index.js +0 -60
- package/dist/benchmarks/index.js.map +0 -1
- package/dist/builder-eval/index.d.ts +0 -695
- package/dist/builder-eval/index.js +0 -366
- package/dist/builder-eval/index.js.map +0 -1
- package/dist/campaign/index.d.ts +0 -7454
- package/dist/campaign/index.js +0 -272
- package/dist/campaign/index.js.map +0 -1
- package/dist/chunk-32BZXMSO.js +0 -3878
- package/dist/chunk-32BZXMSO.js.map +0 -1
- package/dist/chunk-3A246TSA.js +0 -998
- package/dist/chunk-3A246TSA.js.map +0 -1
- package/dist/chunk-3RF76KTD.js +0 -84
- package/dist/chunk-3RF76KTD.js.map +0 -1
- package/dist/chunk-3YYRZDON.js +0 -45
- package/dist/chunk-3YYRZDON.js.map +0 -1
- package/dist/chunk-4I2E3LLO.js +0 -1030
- package/dist/chunk-4I2E3LLO.js.map +0 -1
- package/dist/chunk-ARU2PZFM.js +0 -312
- package/dist/chunk-ARU2PZFM.js.map +0 -1
- package/dist/chunk-BOD4O7OF.js +0 -40
- package/dist/chunk-BOD4O7OF.js.map +0 -1
- package/dist/chunk-DPZAEKA6.js +0 -880
- package/dist/chunk-DPZAEKA6.js.map +0 -1
- package/dist/chunk-DTJ6QUQB.js +0 -131
- package/dist/chunk-DTJ6QUQB.js.map +0 -1
- package/dist/chunk-GGE4NNQT.js +0 -65
- package/dist/chunk-GGE4NNQT.js.map +0 -1
- package/dist/chunk-H5UD2323.js +0 -286
- package/dist/chunk-H5UD2323.js.map +0 -1
- package/dist/chunk-HHWE3POT.js +0 -94
- package/dist/chunk-HHWE3POT.js.map +0 -1
- package/dist/chunk-HKUCJ437.js +0 -787
- package/dist/chunk-HKUCJ437.js.map +0 -1
- package/dist/chunk-JHCHEVET.js +0 -274
- package/dist/chunk-JHCHEVET.js.map +0 -1
- package/dist/chunk-JHOJHHU7.js +0 -867
- package/dist/chunk-JHOJHHU7.js.map +0 -1
- package/dist/chunk-JM2SKQMS.js +0 -750
- package/dist/chunk-JM2SKQMS.js.map +0 -1
- package/dist/chunk-JN2FCO5W.js +0 -7958
- package/dist/chunk-JN2FCO5W.js.map +0 -1
- package/dist/chunk-K4DBDHLK.js +0 -158
- package/dist/chunk-K4DBDHLK.js.map +0 -1
- package/dist/chunk-K6N6XJJX.js +0 -306
- package/dist/chunk-K6N6XJJX.js.map +0 -1
- package/dist/chunk-MA6HLL3S.js +0 -65
- package/dist/chunk-MA6HLL3S.js.map +0 -1
- package/dist/chunk-MAZ26DC7.js +0 -99
- package/dist/chunk-MAZ26DC7.js.map +0 -1
- package/dist/chunk-MOXWMGPC.js +0 -577
- package/dist/chunk-MOXWMGPC.js.map +0 -1
- package/dist/chunk-NJC7U437.js +0 -626
- package/dist/chunk-NJC7U437.js.map +0 -1
- package/dist/chunk-NPCTHQIO.js +0 -91
- package/dist/chunk-NPCTHQIO.js.map +0 -1
- package/dist/chunk-ONWEPEDO.js +0 -57
- package/dist/chunk-ONWEPEDO.js.map +0 -1
- package/dist/chunk-OYZAPX5G.js +0 -1526
- package/dist/chunk-OYZAPX5G.js.map +0 -1
- package/dist/chunk-PC4UYEBM.js +0 -166
- package/dist/chunk-PC4UYEBM.js.map +0 -1
- package/dist/chunk-PICTDURQ.js +0 -766
- package/dist/chunk-PICTDURQ.js.map +0 -1
- package/dist/chunk-PJQFMIOX.js +0 -1182
- package/dist/chunk-PJQFMIOX.js.map +0 -1
- package/dist/chunk-PXD6ZFNY.js +0 -1107
- package/dist/chunk-PXD6ZFNY.js.map +0 -1
- package/dist/chunk-PXE2VKMX.js +0 -140
- package/dist/chunk-PXE2VKMX.js.map +0 -1
- package/dist/chunk-PZ5AY32C.js +0 -10
- package/dist/chunk-PZ5AY32C.js.map +0 -1
- package/dist/chunk-QBRSJK47.js +0 -622
- package/dist/chunk-QBRSJK47.js.map +0 -1
- package/dist/chunk-QWMPPZ3X.js +0 -550
- package/dist/chunk-QWMPPZ3X.js.map +0 -1
- package/dist/chunk-S3UZOQ5Y.js +0 -328
- package/dist/chunk-S3UZOQ5Y.js.map +0 -1
- package/dist/chunk-S5TT5R3L.js +0 -2668
- package/dist/chunk-S5TT5R3L.js.map +0 -1
- package/dist/chunk-T4SQEITX.js +0 -95
- package/dist/chunk-T4SQEITX.js.map +0 -1
- package/dist/chunk-TT4KNT67.js +0 -124
- package/dist/chunk-TT4KNT67.js.map +0 -1
- package/dist/chunk-U5CHZ5M3.js +0 -357
- package/dist/chunk-U5CHZ5M3.js.map +0 -1
- package/dist/chunk-ULOKLHIQ.js +0 -1937
- package/dist/chunk-ULOKLHIQ.js.map +0 -1
- package/dist/chunk-VI2UW6B6.js +0 -162
- package/dist/chunk-VI2UW6B6.js.map +0 -1
- package/dist/chunk-VQMK5FMP.js +0 -247
- package/dist/chunk-VQMK5FMP.js.map +0 -1
- package/dist/chunk-VSMTAMNK.js +0 -53
- package/dist/chunk-VSMTAMNK.js.map +0 -1
- package/dist/chunk-VZSRQ272.js +0 -149
- package/dist/chunk-VZSRQ272.js.map +0 -1
- package/dist/chunk-WW2A73HW.js +0 -159
- package/dist/chunk-WW2A73HW.js.map +0 -1
- package/dist/chunk-X4UCIOTZ.js +0 -136
- package/dist/chunk-X4UCIOTZ.js.map +0 -1
- package/dist/chunk-XDIRG3TO.js +0 -1266
- package/dist/chunk-XDIRG3TO.js.map +0 -1
- package/dist/chunk-XJYR7XFV.js +0 -317
- package/dist/chunk-XJYR7XFV.js.map +0 -1
- package/dist/chunk-ZET2UAYW.js +0 -89
- package/dist/chunk-ZET2UAYW.js.map +0 -1
- package/dist/chunk-ZZUXHH3R.js +0 -99
- package/dist/chunk-ZZUXHH3R.js.map +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -112
- package/dist/cli.js.map +0 -1
- package/dist/contract/index.d.ts +0 -4969
- package/dist/contract/index.js +0 -1653
- package/dist/contract/index.js.map +0 -1
- package/dist/control.d.ts +0 -1013
- package/dist/control.js +0 -34
- package/dist/control.js.map +0 -1
- package/dist/fuzz.d.ts +0 -759
- package/dist/fuzz.js +0 -714
- package/dist/fuzz.js.map +0 -1
- package/dist/hosted/index.d.ts +0 -730
- package/dist/hosted/index.js +0 -14
- package/dist/hosted/index.js.map +0 -1
- package/dist/index.d.ts +0 -16780
- package/dist/index.js +0 -12168
- package/dist/index.js.map +0 -1
- package/dist/matrix/index.d.ts +0 -155
- package/dist/matrix/index.js +0 -8
- package/dist/matrix/index.js.map +0 -1
- package/dist/meta-eval/index.d.ts +0 -1030
- package/dist/meta-eval/index.js +0 -417
- package/dist/meta-eval/index.js.map +0 -1
- package/dist/multishot/index.d.ts +0 -579
- package/dist/multishot/index.js +0 -589
- package/dist/multishot/index.js.map +0 -1
- package/dist/openapi.json +0 -992
- package/dist/pipelines/index.d.ts +0 -567
- package/dist/pipelines/index.js +0 -515
- package/dist/pipelines/index.js.map +0 -1
- package/dist/reporting.d.ts +0 -1277
- package/dist/reporting.js +0 -48
- package/dist/reporting.js.map +0 -1
- package/dist/rl.d.ts +0 -4092
- package/dist/rl.js +0 -1724
- package/dist/rl.js.map +0 -1
- package/dist/run-campaign-HNFPJET4.js +0 -14
- package/dist/run-campaign-HNFPJET4.js.map +0 -1
- package/dist/storyboard/index.d.ts +0 -279
- package/dist/storyboard/index.js +0 -767
- package/dist/storyboard/index.js.map +0 -1
- package/dist/trace-attributes.d.ts +0 -52
- package/dist/trace-attributes.js +0 -62
- package/dist/trace-attributes.js.map +0 -1
- package/dist/traces.d.ts +0 -2343
- package/dist/traces.js +0 -249
- package/dist/traces.js.map +0 -1
- package/dist/wire/index.d.ts +0 -1252
- package/dist/wire/index.js +0 -81
- package/dist/wire/index.js.map +0 -1
|
@@ -1,695 +0,0 @@
|
|
|
1
|
-
type RunStatus = 'running' | 'completed' | 'failed' | 'aborted';
|
|
2
|
-
interface BudgetSpec {
|
|
3
|
-
tokens?: number;
|
|
4
|
-
wallMs?: number;
|
|
5
|
-
calls?: number;
|
|
6
|
-
usd?: number;
|
|
7
|
-
}
|
|
8
|
-
interface RunOutcome {
|
|
9
|
-
score?: number;
|
|
10
|
-
pass?: boolean;
|
|
11
|
-
failureClass?: FailureClass;
|
|
12
|
-
notes?: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Layer — optional classification in a nested build workflow.
|
|
16
|
-
* `builder`: the meta-agent editing a project (e.g. agent-builder Forge chat).
|
|
17
|
-
* `app-build`: sandbox harness that compiled + tested the generated scaffold.
|
|
18
|
-
* `app-runtime`: a run of the generated agent against a domain scenario.
|
|
19
|
-
* `meta`: any meta-eval (judge replay, correlation analysis).
|
|
20
|
-
*/
|
|
21
|
-
type RunLayer = 'builder' | 'app-build' | 'app-runtime' | 'meta' | 'custom';
|
|
22
|
-
interface Run {
|
|
23
|
-
runId: string;
|
|
24
|
-
/**
|
|
25
|
-
* Stable identifier of the scenario being executed.
|
|
26
|
-
*
|
|
27
|
-
* Always populated on the persisted Run — but `TraceEmitter.startRun` accepts
|
|
28
|
-
* input WITHOUT this field, substituting a sensible default
|
|
29
|
-
* (`run.layer ?? run.tags?.['kind'] ?? 'runtime'`) when the caller has no
|
|
30
|
-
* curated scenario to anchor to (runtime / operator / meta-eval runs). This
|
|
31
|
-
* keeps the persisted shape unambiguous for downstream filters + aggregations
|
|
32
|
-
* while removing the boilerplate of inventing placeholder ids at the call site.
|
|
33
|
-
*/
|
|
34
|
-
scenarioId: string;
|
|
35
|
-
variantId?: string;
|
|
36
|
-
datasetVersion?: string;
|
|
37
|
-
/** Git SHA of agent code at run time. */
|
|
38
|
-
codeSha?: string;
|
|
39
|
-
/** Hash of the prompt template + any system prompt. */
|
|
40
|
-
promptSha?: string;
|
|
41
|
-
/** Model id + date + system-prompt hash, concatenated. */
|
|
42
|
-
modelFingerprint?: string;
|
|
43
|
-
seed?: number;
|
|
44
|
-
/** Arbitrary environment markers (shell, docker version, tz). */
|
|
45
|
-
envFingerprint?: Record<string, string>;
|
|
46
|
-
/** Version of the redaction rules applied to this run. */
|
|
47
|
-
redactionVersion?: string;
|
|
48
|
-
/** Parent run in a nested build workflow. A builder run's children are
|
|
49
|
-
* app-build runs; those children are app-runtime runs. */
|
|
50
|
-
parentRunId?: string;
|
|
51
|
-
/** Stable project identifier — groups runs across chats + sessions. */
|
|
52
|
-
projectId?: string;
|
|
53
|
-
/** Chat/conversation identifier within a project. */
|
|
54
|
-
chatId?: string;
|
|
55
|
-
/** Layer classification — hint for aggregation; not enforced. */
|
|
56
|
-
layer?: RunLayer;
|
|
57
|
-
startedAt: number;
|
|
58
|
-
endedAt?: number;
|
|
59
|
-
status: RunStatus;
|
|
60
|
-
outcome?: RunOutcome;
|
|
61
|
-
budget?: BudgetSpec;
|
|
62
|
-
/** Free-form labels for downstream grouping. */
|
|
63
|
-
tags?: Record<string, string>;
|
|
64
|
-
}
|
|
65
|
-
type SpanKind = 'agent' | 'llm' | 'tool' | 'retrieval' | 'judge' | 'sandbox' | 'custom';
|
|
66
|
-
type SpanStatus = 'ok' | 'error';
|
|
67
|
-
interface SpanBase {
|
|
68
|
-
spanId: string;
|
|
69
|
-
parentSpanId?: string;
|
|
70
|
-
runId: string;
|
|
71
|
-
kind: SpanKind;
|
|
72
|
-
name: string;
|
|
73
|
-
startedAt: number;
|
|
74
|
-
endedAt?: number;
|
|
75
|
-
status?: SpanStatus;
|
|
76
|
-
error?: string;
|
|
77
|
-
/** Anything not covered by typed fields. Kept deliberately free-form. */
|
|
78
|
-
attributes?: Record<string, unknown>;
|
|
79
|
-
}
|
|
80
|
-
interface Message {
|
|
81
|
-
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
82
|
-
content: string;
|
|
83
|
-
tokens?: number;
|
|
84
|
-
/** Multi-modal content descriptors; blobs themselves live in Artifacts. */
|
|
85
|
-
images?: Array<{
|
|
86
|
-
artifactId?: string;
|
|
87
|
-
url?: string;
|
|
88
|
-
mime?: string;
|
|
89
|
-
}>;
|
|
90
|
-
}
|
|
91
|
-
interface LlmSpan extends SpanBase {
|
|
92
|
-
kind: 'llm';
|
|
93
|
-
model: string;
|
|
94
|
-
messages: Message[];
|
|
95
|
-
output?: string;
|
|
96
|
-
inputTokens?: number;
|
|
97
|
-
/** All generated tokens, including the reasoning subset when present. */
|
|
98
|
-
outputTokens?: number;
|
|
99
|
-
cachedTokens?: number;
|
|
100
|
-
cacheWriteTokens?: number;
|
|
101
|
-
/** Reasoning-token subset of `outputTokens`. */
|
|
102
|
-
reasoningTokens?: number;
|
|
103
|
-
costUsd?: number;
|
|
104
|
-
finishReason?: string;
|
|
105
|
-
}
|
|
106
|
-
interface ToolSpan extends SpanBase {
|
|
107
|
-
kind: 'tool';
|
|
108
|
-
toolName: string;
|
|
109
|
-
args: unknown;
|
|
110
|
-
/** False when the source observed the call but did not capture its arguments. */
|
|
111
|
-
argsCaptured?: boolean;
|
|
112
|
-
result?: unknown;
|
|
113
|
-
latencyMs?: number;
|
|
114
|
-
}
|
|
115
|
-
interface RetrievalSpan extends SpanBase {
|
|
116
|
-
kind: 'retrieval';
|
|
117
|
-
query: string;
|
|
118
|
-
hits: Array<{
|
|
119
|
-
docId: string;
|
|
120
|
-
score: number;
|
|
121
|
-
content?: string;
|
|
122
|
-
}>;
|
|
123
|
-
}
|
|
124
|
-
interface JudgeSpan extends SpanBase {
|
|
125
|
-
kind: 'judge';
|
|
126
|
-
judgeId: string;
|
|
127
|
-
/** Span this judgment applies to. */
|
|
128
|
-
targetSpanId: string;
|
|
129
|
-
dimension: string;
|
|
130
|
-
/** Numeric score (free-range; interpretation up to the judge). */
|
|
131
|
-
score: number;
|
|
132
|
-
rationale?: string;
|
|
133
|
-
evidence?: string;
|
|
134
|
-
}
|
|
135
|
-
interface SandboxSpan extends SpanBase {
|
|
136
|
-
kind: 'sandbox';
|
|
137
|
-
image?: string;
|
|
138
|
-
command?: string;
|
|
139
|
-
exitCode?: number;
|
|
140
|
-
testsTotal?: number;
|
|
141
|
-
testsPassed?: number;
|
|
142
|
-
stdoutHash?: string;
|
|
143
|
-
stderrHash?: string;
|
|
144
|
-
/** Duration in ms; the harness fills this explicitly (endedAt - startedAt may miss setup). */
|
|
145
|
-
wallMs?: number;
|
|
146
|
-
}
|
|
147
|
-
interface GenericSpan extends SpanBase {
|
|
148
|
-
kind: 'agent' | 'custom';
|
|
149
|
-
}
|
|
150
|
-
type Span = LlmSpan | ToolSpan | RetrievalSpan | JudgeSpan | SandboxSpan | GenericSpan;
|
|
151
|
-
type EventKind = 'log' | 'error' | 'budget_decrement' | 'budget_breach' | 'state_mutation' | 'policy_violation' | 'redaction_applied' | 'custom';
|
|
152
|
-
interface TraceEvent {
|
|
153
|
-
eventId: string;
|
|
154
|
-
runId: string;
|
|
155
|
-
spanId?: string;
|
|
156
|
-
kind: EventKind;
|
|
157
|
-
timestamp: number;
|
|
158
|
-
payload: Record<string, unknown>;
|
|
159
|
-
}
|
|
160
|
-
interface BudgetLedgerEntry {
|
|
161
|
-
runId: string;
|
|
162
|
-
dimension: keyof BudgetSpec;
|
|
163
|
-
limit: number;
|
|
164
|
-
consumed: number;
|
|
165
|
-
remaining: number;
|
|
166
|
-
timestamp: number;
|
|
167
|
-
breached: boolean;
|
|
168
|
-
/** Span that triggered this entry, if any. */
|
|
169
|
-
spanId?: string;
|
|
170
|
-
}
|
|
171
|
-
interface Artifact {
|
|
172
|
-
artifactId: string;
|
|
173
|
-
runId: string;
|
|
174
|
-
spanId?: string;
|
|
175
|
-
contentType: string;
|
|
176
|
-
sizeBytes: number;
|
|
177
|
-
/** sha256 in hex. */
|
|
178
|
-
hash: string;
|
|
179
|
-
/** External storage URL (R2, S3, filesystem path). */
|
|
180
|
-
storageUrl?: string;
|
|
181
|
-
/** Inline content for small blobs — keep under ~64KB. */
|
|
182
|
-
inlineContent?: string;
|
|
183
|
-
}
|
|
184
|
-
type FailureClass = 'success' | 'reasoning_error' | 'tool_selection_error' | 'tool_argument_error' | 'tool_recovery_failure' | 'hallucination' | 'instruction_following' | 'safety_refusal_miss' | 'policy_violation' | 'budget_exceeded' | 'format_drift' | 'permission_escalation' | 'pii_leak' | 'cost_overrun' | 'timeout' | 'sandbox_failure' | 'missing_user_data' | 'missing_domain_data' | 'missing_codebase_context' | 'missing_runtime_context' | 'missing_credentials' | 'missing_integration_connection' | 'missing_integration_scope' | 'integration_approval_required' | 'integration_auth_expired' | 'integration_provider_failure' | 'bad_integration_manifest' | 'unsafe_integration_write_denied' | 'stale_external_data' | 'bad_retrieval' | 'insufficient_evidence' | 'contradictory_evidence' | 'ambiguous_user_intent' | 'knowledge_readiness_blocked' | 'unknown';
|
|
185
|
-
|
|
186
|
-
interface RunFilter {
|
|
187
|
-
scenarioId?: string;
|
|
188
|
-
variantId?: string;
|
|
189
|
-
status?: RunStatus;
|
|
190
|
-
since?: number;
|
|
191
|
-
until?: number;
|
|
192
|
-
tag?: {
|
|
193
|
-
key: string;
|
|
194
|
-
value: string;
|
|
195
|
-
};
|
|
196
|
-
parentRunId?: string;
|
|
197
|
-
projectId?: string;
|
|
198
|
-
chatId?: string;
|
|
199
|
-
layer?: RunLayer;
|
|
200
|
-
}
|
|
201
|
-
interface SpanFilter {
|
|
202
|
-
runId?: string;
|
|
203
|
-
parentSpanId?: string;
|
|
204
|
-
kind?: SpanKind;
|
|
205
|
-
name?: string;
|
|
206
|
-
toolName?: string;
|
|
207
|
-
judgeId?: string;
|
|
208
|
-
since?: number;
|
|
209
|
-
until?: number;
|
|
210
|
-
}
|
|
211
|
-
interface EventFilter {
|
|
212
|
-
runId?: string;
|
|
213
|
-
spanId?: string;
|
|
214
|
-
kind?: EventKind;
|
|
215
|
-
since?: number;
|
|
216
|
-
until?: number;
|
|
217
|
-
}
|
|
218
|
-
interface TraceStore {
|
|
219
|
-
appendRun(run: Run): Promise<void>;
|
|
220
|
-
updateRun(runId: string, patch: Partial<Run>): Promise<void>;
|
|
221
|
-
appendSpan(span: Span): Promise<void>;
|
|
222
|
-
updateSpan(spanId: string, patch: Partial<Span>): Promise<void>;
|
|
223
|
-
appendEvent(event: TraceEvent): Promise<void>;
|
|
224
|
-
appendArtifact(artifact: Artifact): Promise<void>;
|
|
225
|
-
appendBudgetEntry(entry: BudgetLedgerEntry): Promise<void>;
|
|
226
|
-
getRun(runId: string): Promise<Run | undefined>;
|
|
227
|
-
listRuns(filter?: RunFilter): Promise<Run[]>;
|
|
228
|
-
spans(filter?: SpanFilter): Promise<Span[]>;
|
|
229
|
-
events(filter?: EventFilter): Promise<TraceEvent[]>;
|
|
230
|
-
budget(runId: string): Promise<BudgetLedgerEntry[]>;
|
|
231
|
-
artifacts(runId: string): Promise<Artifact[]>;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* TraceEmitter — hierarchical span builder that auto-parents using an
|
|
236
|
-
* internal stack. One emitter per Run; emitters do NOT share state.
|
|
237
|
-
*
|
|
238
|
-
* Convenience methods (`llm`, `tool`, `retrieval`, `judge`, `sandbox`)
|
|
239
|
-
* return a `SpanHandle` with `.end()` / `.fail()` so callers don't
|
|
240
|
-
* have to thread spanIds manually. For async workflows that can't use
|
|
241
|
-
* the stack (e.g. fan-out parallel calls), pass `parentSpanId`
|
|
242
|
-
* explicitly.
|
|
243
|
-
*/
|
|
244
|
-
|
|
245
|
-
interface SpanHandle<S extends Span = Span> {
|
|
246
|
-
span: S;
|
|
247
|
-
end(patch?: Partial<S>): Promise<void>;
|
|
248
|
-
fail(error: string | Error, patch?: Partial<S>): Promise<void>;
|
|
249
|
-
}
|
|
250
|
-
interface RunCompleteHookContext {
|
|
251
|
-
runId: string;
|
|
252
|
-
emitter: TraceEmitter;
|
|
253
|
-
store: TraceStore;
|
|
254
|
-
/** Outcome the caller passed to `endRun` (undefined for `abortRun`). */
|
|
255
|
-
outcome?: RunOutcome;
|
|
256
|
-
/** Final run status. */
|
|
257
|
-
status: 'completed' | 'failed' | 'aborted';
|
|
258
|
-
}
|
|
259
|
-
type RunCompleteHook = (ctx: RunCompleteHookContext) => Promise<void> | void;
|
|
260
|
-
interface TraceEmitterOptions {
|
|
261
|
-
runId?: string;
|
|
262
|
-
/** Inject a clock for deterministic tests. */
|
|
263
|
-
now?: () => number;
|
|
264
|
-
/** Inject an id generator for deterministic tests. */
|
|
265
|
-
id?: () => string;
|
|
266
|
-
/**
|
|
267
|
-
* Hooks fired after `endRun` / `abortRun` writes the final run state.
|
|
268
|
-
* Designed for trace-analyst auto-execution, integrity assertions, and
|
|
269
|
-
* outbound notifications. Hooks run sequentially in the order supplied.
|
|
270
|
-
*
|
|
271
|
-
* By default a hook that throws is swallowed and logged as a `note` event
|
|
272
|
-
* on the run — auto-orchestration must not crash the underlying flow.
|
|
273
|
-
* Set `hookErrors: 'throw'` to propagate.
|
|
274
|
-
*/
|
|
275
|
-
onRunComplete?: RunCompleteHook[];
|
|
276
|
-
/** `'swallow'` (default) | `'throw'`. */
|
|
277
|
-
hookErrors?: 'swallow' | 'throw';
|
|
278
|
-
}
|
|
279
|
-
declare class TraceEmitter {
|
|
280
|
-
private store;
|
|
281
|
-
private stack;
|
|
282
|
-
private _runId;
|
|
283
|
-
private now;
|
|
284
|
-
private id;
|
|
285
|
-
private hooks;
|
|
286
|
-
private hookErrors;
|
|
287
|
-
constructor(store: TraceStore, options?: TraceEmitterOptions);
|
|
288
|
-
get runId(): string;
|
|
289
|
-
get traceStore(): TraceStore;
|
|
290
|
-
/** Append a hook after construction (e.g. attach the trace analyst). */
|
|
291
|
-
addRunCompleteHook(hook: RunCompleteHook): void;
|
|
292
|
-
/**
|
|
293
|
-
* Begin a Run.
|
|
294
|
-
*
|
|
295
|
-
* `scenarioId` is required on the persisted Run shape — every Run downstream
|
|
296
|
-
* gets a non-empty scenarioId so filters and aggregations stay simple — but
|
|
297
|
-
* the INPUT here accepts it as optional. When omitted, startRun substitutes
|
|
298
|
-
* a sensible default (`run.layer ?? run.tags?.['kind'] ?? 'runtime'`) so
|
|
299
|
-
* runtime / operator / meta-eval runs that have no curated-scenario corpus
|
|
300
|
-
* to anchor to don't have to invent placeholder strings at the call site.
|
|
301
|
-
*/
|
|
302
|
-
startRun(run: Omit<Run, 'runId' | 'scenarioId' | 'startedAt' | 'status'> & {
|
|
303
|
-
scenarioId?: string;
|
|
304
|
-
}): Promise<Run>;
|
|
305
|
-
endRun(outcome?: RunOutcome): Promise<void>;
|
|
306
|
-
abortRun(reason: string): Promise<void>;
|
|
307
|
-
private runHooks;
|
|
308
|
-
span<S extends Span = Span>(init: {
|
|
309
|
-
kind: SpanKind;
|
|
310
|
-
name: string;
|
|
311
|
-
parentSpanId?: string;
|
|
312
|
-
attributes?: Record<string, unknown>;
|
|
313
|
-
} & Partial<Omit<S, 'spanId' | 'runId' | 'startedAt' | 'kind' | 'name'>>): Promise<SpanHandle<S>>;
|
|
314
|
-
private handle;
|
|
315
|
-
private pop;
|
|
316
|
-
llm(init: Omit<LlmSpan, 'spanId' | 'runId' | 'kind' | 'startedAt'>): Promise<SpanHandle<LlmSpan>>;
|
|
317
|
-
tool(init: Omit<ToolSpan, 'spanId' | 'runId' | 'kind' | 'startedAt'>): Promise<SpanHandle<ToolSpan>>;
|
|
318
|
-
retrieval(init: Omit<RetrievalSpan, 'spanId' | 'runId' | 'kind' | 'startedAt'>): Promise<SpanHandle<RetrievalSpan>>;
|
|
319
|
-
recordJudge(verdict: Omit<JudgeSpan, 'spanId' | 'runId' | 'kind' | 'startedAt' | 'endedAt'>): Promise<JudgeSpan>;
|
|
320
|
-
sandbox(init: Omit<SandboxSpan, 'spanId' | 'runId' | 'kind' | 'startedAt'>): Promise<SpanHandle<SandboxSpan>>;
|
|
321
|
-
emit(event: {
|
|
322
|
-
kind: EventKind;
|
|
323
|
-
spanId?: string;
|
|
324
|
-
payload?: Record<string, unknown>;
|
|
325
|
-
}): Promise<TraceEvent>;
|
|
326
|
-
recordBudget(entry: Omit<BudgetLedgerEntry, 'runId' | 'timestamp'> & {
|
|
327
|
-
timestamp?: number;
|
|
328
|
-
}): Promise<BudgetLedgerEntry>;
|
|
329
|
-
recordArtifact(artifact: Omit<Artifact, 'artifactId' | 'runId'>): Promise<Artifact>;
|
|
330
|
-
/**
|
|
331
|
-
* Runs `fn` inside a span; auto-ends on success, auto-fails on throw.
|
|
332
|
-
* Returns the fn's return value. Use this for the 95% case.
|
|
333
|
-
*/
|
|
334
|
-
within<T>(init: Parameters<TraceEmitter['span']>[0], fn: (handle: SpanHandle) => Promise<T>): Promise<T>;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* SandboxHarness — executes a scenario in an isolated environment and
|
|
339
|
-
* emits a rich SandboxSpan into the trace.
|
|
340
|
-
*
|
|
341
|
-
* Two built-in drivers:
|
|
342
|
-
* - `SubprocessSandboxDriver` — spawn in a local cwd with env vars.
|
|
343
|
-
* Fast, no dependencies, fine for unit tests and most CI gates.
|
|
344
|
-
* - `DockerSandboxDriver` — lifted from tangle-router's sandbox path;
|
|
345
|
-
* shells out to `docker run`. Stronger isolation, slower startup.
|
|
346
|
-
*
|
|
347
|
-
* Consumers implement `SandboxDriver` for custom backends (Firecracker,
|
|
348
|
-
* Cloudflare sandbox product, etc.). The harness doesn't care which.
|
|
349
|
-
*/
|
|
350
|
-
|
|
351
|
-
interface HarnessConfig {
|
|
352
|
-
/** Setup command (e.g. "pnpm install"). Non-zero exit fails the run. */
|
|
353
|
-
setupCommand?: string;
|
|
354
|
-
/** Run command (e.g. "pnpm build"). */
|
|
355
|
-
runCommand?: string;
|
|
356
|
-
/** Test command (e.g. "pnpm test --run"). Drives the test count + pass count. */
|
|
357
|
-
testCommand?: string;
|
|
358
|
-
/** Absolute cwd for the subprocess driver. Ignored by docker driver. */
|
|
359
|
-
cwd?: string;
|
|
360
|
-
/** Max wall-clock per phase in ms. Default 10 minutes. */
|
|
361
|
-
timeoutMs?: number;
|
|
362
|
-
/**
|
|
363
|
-
* Cap on captured stdout+stderr bytes per phase. A runaway process can
|
|
364
|
-
* otherwise grow the in-memory buffer without bound. Once hit, further
|
|
365
|
-
* output is dropped and `outputTruncated` is set. Default 16 MiB.
|
|
366
|
-
*/
|
|
367
|
-
maxOutputBytes?: number;
|
|
368
|
-
/** Image for the docker driver. */
|
|
369
|
-
image?: string;
|
|
370
|
-
/** Extra env vars (validated; shell-escaped). */
|
|
371
|
-
env?: Record<string, string>;
|
|
372
|
-
/** Parser for the test output — maps stdout/stderr/exit code → pass count. */
|
|
373
|
-
testParser?: TestOutputParser;
|
|
374
|
-
}
|
|
375
|
-
interface TestOutputParser {
|
|
376
|
-
id: string;
|
|
377
|
-
parse(stdout: string, stderr: string, exitCode: number): {
|
|
378
|
-
testsTotal: number;
|
|
379
|
-
testsPassed: number;
|
|
380
|
-
} | undefined;
|
|
381
|
-
}
|
|
382
|
-
interface SandboxResult {
|
|
383
|
-
phase: 'setup' | 'run' | 'test';
|
|
384
|
-
exitCode: number;
|
|
385
|
-
stdout: string;
|
|
386
|
-
stderr: string;
|
|
387
|
-
wallMs: number;
|
|
388
|
-
testsTotal?: number;
|
|
389
|
-
testsPassed?: number;
|
|
390
|
-
/**
|
|
391
|
-
* True when the process was killed because it exceeded `timeoutMs`. A
|
|
392
|
-
* SIGKILLed child can still close with exit code 0; callers MUST treat
|
|
393
|
-
* a timed-out phase as a hard failure regardless of `exitCode`, never
|
|
394
|
-
* as a pass. `undefined`/`false` means the process completed on its own.
|
|
395
|
-
*/
|
|
396
|
-
killedByTimeout?: boolean;
|
|
397
|
-
/**
|
|
398
|
-
* True when captured stdout/stderr hit `maxOutputBytes` and further
|
|
399
|
-
* output was dropped. The result is still returned (the process was
|
|
400
|
-
* not killed for this), but downstream parsers see truncated text.
|
|
401
|
-
*/
|
|
402
|
-
outputTruncated?: boolean;
|
|
403
|
-
}
|
|
404
|
-
interface SandboxDriver {
|
|
405
|
-
id: string;
|
|
406
|
-
exec(phase: SandboxResult['phase'], command: string, config: HarnessConfig): Promise<SandboxResult>;
|
|
407
|
-
}
|
|
408
|
-
interface SandboxHarnessResult {
|
|
409
|
-
passed: boolean;
|
|
410
|
-
setup?: SandboxResult;
|
|
411
|
-
run?: SandboxResult;
|
|
412
|
-
test?: SandboxResult;
|
|
413
|
-
totalWallMs: number;
|
|
414
|
-
/** Final score — 0 when no tests; otherwise testsPassed/testsTotal. */
|
|
415
|
-
score: number;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* TestGradedScenario — a scenario whose score comes from a test suite.
|
|
420
|
-
*
|
|
421
|
-
* This is the SWE-bench pattern generalized. The scenario ships:
|
|
422
|
-
* - fixture data (setup instructions)
|
|
423
|
-
* - a test command the harness runs
|
|
424
|
-
* - optional assertion overrides
|
|
425
|
-
*
|
|
426
|
-
* The runner emits a run, delegates to SandboxHarness, records the
|
|
427
|
-
* outcome, and returns a structured verdict. Consumers bind their own
|
|
428
|
-
* agent execution to this contract.
|
|
429
|
-
*/
|
|
430
|
-
|
|
431
|
-
interface TestGradedScenario {
|
|
432
|
-
id: string;
|
|
433
|
-
description?: string;
|
|
434
|
-
harness: HarnessConfig;
|
|
435
|
-
/** Optional pass threshold in 0..1 (default 1.0 = all tests must pass). */
|
|
436
|
-
passThreshold?: number;
|
|
437
|
-
/** Provenance for dataset tracking. */
|
|
438
|
-
datasetVersion?: string;
|
|
439
|
-
/** Free-form tags (difficulty, category, etc.). */
|
|
440
|
-
tags?: Record<string, string>;
|
|
441
|
-
}
|
|
442
|
-
interface TestGradedRunResult {
|
|
443
|
-
runId: string;
|
|
444
|
-
scenario: TestGradedScenario;
|
|
445
|
-
harness: SandboxHarnessResult;
|
|
446
|
-
pass: boolean;
|
|
447
|
-
score: number;
|
|
448
|
-
failureClass?: FailureClass;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* BuilderSession — ties a builder-of-builders workflow together.
|
|
453
|
-
*
|
|
454
|
-
* Models agent-builder's shape: Project → Chat → Edit → Ship → App →
|
|
455
|
-
* AppAgent. Each layer is a Run (linked via parentRunId). The
|
|
456
|
-
* framework-enforced invariants:
|
|
457
|
-
*
|
|
458
|
-
* - One Project → many Chats; chatId scopes runs within a project.
|
|
459
|
-
* - One Chat = one builder Run with `layer='builder'`.
|
|
460
|
-
* - One Ship = one child Run with `layer='app-build'` + SandboxHarness.
|
|
461
|
-
* - One AppScenario = one grandchild Run with `layer='app-runtime'`.
|
|
462
|
-
*
|
|
463
|
-
* Consumers obtain a BuilderSession, call `startChat`, drive the
|
|
464
|
-
* builder agent (emitting spans), and call `ship` / `runAppScenario`
|
|
465
|
-
* as the workflow progresses. The session reconstructs itself from
|
|
466
|
-
* trace data via `resume(store, projectId)`.
|
|
467
|
-
*/
|
|
468
|
-
|
|
469
|
-
interface BuilderSessionInit {
|
|
470
|
-
projectId: string;
|
|
471
|
-
chatId?: string;
|
|
472
|
-
/** Free-form: user's task description, project name, etc. Stored on the builder Run. */
|
|
473
|
-
tags?: Record<string, string>;
|
|
474
|
-
}
|
|
475
|
-
interface ShipOptions {
|
|
476
|
-
harness: HarnessConfig;
|
|
477
|
-
driver?: SandboxDriver;
|
|
478
|
-
/** scenarioId of this app-build run. Defaults to `${projectId}/build`. */
|
|
479
|
-
scenarioId?: string;
|
|
480
|
-
}
|
|
481
|
-
interface RunAppScenarioOptions {
|
|
482
|
-
scenario: TestGradedScenario;
|
|
483
|
-
/** Harness driver override; defaults to the one the session was created with. */
|
|
484
|
-
driver?: SandboxDriver;
|
|
485
|
-
}
|
|
486
|
-
declare class BuilderSession {
|
|
487
|
-
private store;
|
|
488
|
-
private builderEmitter;
|
|
489
|
-
readonly projectId: string;
|
|
490
|
-
readonly chatId: string;
|
|
491
|
-
private builderRunId?;
|
|
492
|
-
private lastBuildRunId?;
|
|
493
|
-
private defaultDriver?;
|
|
494
|
-
constructor(store: TraceStore, init: BuilderSessionInit, driver?: SandboxDriver);
|
|
495
|
-
/** Start the builder (L0) run for this chat. Returns the runId. */
|
|
496
|
-
startChat(scenarioId?: string): Promise<string>;
|
|
497
|
-
/** The emitter for builder-level spans (edits, LLM calls, tool invocations). */
|
|
498
|
-
get emitter(): TraceEmitter;
|
|
499
|
-
/**
|
|
500
|
-
* Ship the project's generated app: run the sandbox harness as a child
|
|
501
|
-
* Run (`layer='app-build'`). Returns the build result + runId.
|
|
502
|
-
*/
|
|
503
|
-
ship(options: ShipOptions): Promise<{
|
|
504
|
-
runId: string;
|
|
505
|
-
result: SandboxHarnessResult;
|
|
506
|
-
}>;
|
|
507
|
-
/**
|
|
508
|
-
* Run a domain scenario against the just-built app as a grandchild Run
|
|
509
|
-
* (`layer='app-runtime'`). The `ship` call must precede this so the
|
|
510
|
-
* parent is set correctly; if no build exists yet the session attaches
|
|
511
|
-
* directly to the builder run (useful for prototypes).
|
|
512
|
-
*/
|
|
513
|
-
runAppScenario(options: RunAppScenarioOptions): Promise<TestGradedRunResult>;
|
|
514
|
-
/** Record an end-of-chat meta score (judge verdict on whether the builder
|
|
515
|
-
* served the user's intent). Accepts a numeric score + optional rationale. */
|
|
516
|
-
recordMetaScore(score: number, rationale?: string): Promise<void>;
|
|
517
|
-
/** Close the builder Run with a final outcome. */
|
|
518
|
-
endChat(outcome: {
|
|
519
|
-
pass: boolean;
|
|
520
|
-
score?: number;
|
|
521
|
-
notes?: string;
|
|
522
|
-
}): Promise<void>;
|
|
523
|
-
/**
|
|
524
|
-
* Inline app-runtime run — for cases where the "scenario" isn't a
|
|
525
|
-
* SWE-bench-style test suite but a live agent interaction (LLM chat,
|
|
526
|
-
* domain flow). Returns an emitter bound to a fresh Run in the
|
|
527
|
-
* `app-runtime` layer; caller emits spans inside and calls
|
|
528
|
-
* `.endRun()` with the final verdict.
|
|
529
|
-
*/
|
|
530
|
-
startAppRuntime(scenarioId: string): Promise<TraceEmitter>;
|
|
531
|
-
/**
|
|
532
|
-
* Lightweight "ship marker" — record an app-build Run with a caller-
|
|
533
|
-
* provided verdict. Use when there isn't a sandbox harness to run but
|
|
534
|
-
* you still want to mark the build state at publish time.
|
|
535
|
-
*/
|
|
536
|
-
recordShipMarker(args: {
|
|
537
|
-
pass: boolean;
|
|
538
|
-
score: number;
|
|
539
|
-
scenarioId?: string;
|
|
540
|
-
notes?: string;
|
|
541
|
-
}): Promise<string>;
|
|
542
|
-
get lastBuildRunIdValue(): string | undefined;
|
|
543
|
-
get builderRunIdValue(): string | undefined;
|
|
544
|
-
}
|
|
545
|
-
/**
|
|
546
|
-
* Reconstruct the most recent BuilderSession state for a given project —
|
|
547
|
-
* returns { builderRunId, lastBuildRunId, chatRuns }. For chat-first UIs
|
|
548
|
-
* this is how a resumed session finds its place in the edit history.
|
|
549
|
-
*/
|
|
550
|
-
declare function resumeBuilderSession(store: TraceStore, projectId: string): Promise<{
|
|
551
|
-
projectId: string;
|
|
552
|
-
chatRuns: Run[];
|
|
553
|
-
lastBuilderRun?: Run;
|
|
554
|
-
lastBuildRun?: Run;
|
|
555
|
-
lastAppRuntimeRuns: Run[];
|
|
556
|
-
}>;
|
|
557
|
-
|
|
558
|
-
/**
|
|
559
|
-
* Three-layer evaluation — the canonical scoring breakdown for
|
|
560
|
-
* builder-of-builders workflows.
|
|
561
|
-
*
|
|
562
|
-
* meta_score: did the builder understand + satisfy user intent?
|
|
563
|
-
* (judge verdict attached to the builder run)
|
|
564
|
-
* build_score: did the generated scaffold build + pass its own tests?
|
|
565
|
-
* (outcome.score on the app-build child run)
|
|
566
|
-
* runtime_score: did the generated agent pass its domain scenarios?
|
|
567
|
-
* (mean outcome.score over app-runtime grandchild runs)
|
|
568
|
-
*
|
|
569
|
-
* Returns a structured report per project. The cross-layer correlation
|
|
570
|
-
* is the highest-leverage signal the framework computes — if
|
|
571
|
-
* meta_score doesn't predict runtime_score, the builder's self-scoring
|
|
572
|
-
* is broken.
|
|
573
|
-
*
|
|
574
|
-
* Scaffold-only mode: when a project has no `app-runtime` runs (e.g. a
|
|
575
|
-
* scaffold-builder eval that grades compose + build without driving a
|
|
576
|
-
* runtime scenario), `kind` is `'scaffold-only'` and `complete` measures
|
|
577
|
-
* meta + build only. Consumers can tell the two apart without having to
|
|
578
|
-
* interpret null-runtime as either "not yet computed" or "N/A for this
|
|
579
|
-
* project shape".
|
|
580
|
-
*/
|
|
581
|
-
|
|
582
|
-
type ProjectKind = 'full' | 'scaffold-only';
|
|
583
|
-
interface ThreeLayerProjectReport {
|
|
584
|
-
projectId: string;
|
|
585
|
-
/**
|
|
586
|
-
* `'full'` when the project has at least one `app-runtime` run;
|
|
587
|
-
* `'scaffold-only'` when it only has meta + build layers. Lets
|
|
588
|
-
* downstream consumers treat a null runtime score as expected
|
|
589
|
-
* (scaffold-only) vs. missing (full, pipeline broke).
|
|
590
|
-
*/
|
|
591
|
-
kind: ProjectKind;
|
|
592
|
-
builderRunId?: string;
|
|
593
|
-
/** Judge-verdict score on the builder run (0..1 after normalization). */
|
|
594
|
-
metaScore: number | null;
|
|
595
|
-
buildRunId?: string;
|
|
596
|
-
/** 0..1 from the sandbox harness (testsPassed / testsTotal). */
|
|
597
|
-
buildScore: number | null;
|
|
598
|
-
appRuntimeRunIds: string[];
|
|
599
|
-
/** Mean of outcome.score over app-runtime runs, 0..1. Always null in scaffold-only mode. */
|
|
600
|
-
runtimeScore: number | null;
|
|
601
|
-
runtimePassRate: number | null;
|
|
602
|
-
/**
|
|
603
|
-
* Layer-aware completeness:
|
|
604
|
-
* - `kind='full'`: all three layers scored
|
|
605
|
-
* - `kind='scaffold-only'`: meta + build scored (runtime not applicable)
|
|
606
|
-
*/
|
|
607
|
-
complete: boolean;
|
|
608
|
-
}
|
|
609
|
-
declare function scoreProject(store: TraceStore, projectId: string): Promise<ThreeLayerProjectReport>;
|
|
610
|
-
/** Aggregate scoring across every project in a corpus. */
|
|
611
|
-
declare function scoreAllProjects(store: TraceStore): Promise<ThreeLayerProjectReport[]>;
|
|
612
|
-
|
|
613
|
-
/**
|
|
614
|
-
* Meta-eval correlation — the highest-leverage signal in the framework.
|
|
615
|
-
*
|
|
616
|
-
* Given a corpus of three-layer project reports, compute how well each
|
|
617
|
-
* pair of layers correlates. The question we care about most:
|
|
618
|
-
*
|
|
619
|
-
* Does `metaScore` (what the builder thinks it did) predict
|
|
620
|
-
* `runtimeScore` (what the user actually gets)?
|
|
621
|
-
*
|
|
622
|
-
* If r < ~0.4, the builder's self-scoring is broken — it's optimizing
|
|
623
|
-
* for something other than real-world success. If r > 0.7, meta_score
|
|
624
|
-
* is a usable proxy and can drive CI gates cheaply.
|
|
625
|
-
*
|
|
626
|
-
* Non-parametric rank correlation (Spearman) is also reported because
|
|
627
|
-
* meta scores are often ordinal-ish.
|
|
628
|
-
*/
|
|
629
|
-
|
|
630
|
-
interface LayerCorrelation {
|
|
631
|
-
n: number;
|
|
632
|
-
pearson: number;
|
|
633
|
-
spearman: number;
|
|
634
|
-
}
|
|
635
|
-
interface CorrelationReport {
|
|
636
|
-
/** Pairs present in the corpus (layers with ≥ 2 matched data points). */
|
|
637
|
-
metaVsBuild?: LayerCorrelation;
|
|
638
|
-
metaVsRuntime?: LayerCorrelation;
|
|
639
|
-
buildVsRuntime?: LayerCorrelation;
|
|
640
|
-
/** Number of complete projects (all 3 scores present). */
|
|
641
|
-
completeProjects: number;
|
|
642
|
-
}
|
|
643
|
-
declare function correlateLayers(reports: ThreeLayerProjectReport[]): CorrelationReport;
|
|
644
|
-
|
|
645
|
-
/**
|
|
646
|
-
* ProjectRegistry — project-level aggregation over the trace corpus.
|
|
647
|
-
*
|
|
648
|
-
* Thin reader over TraceStore that answers the questions a chat-first,
|
|
649
|
-
* resumable UI needs:
|
|
650
|
-
* - listProjects() → project IDs with latest activity
|
|
651
|
-
* - projectTimeline(id) → chats + builds + runtime runs, chronological
|
|
652
|
-
* - projectChats(id) → chat-level summaries (turn count, outcome)
|
|
653
|
-
*
|
|
654
|
-
* All queries are pure reads; no state duplication.
|
|
655
|
-
*/
|
|
656
|
-
|
|
657
|
-
interface ProjectSummary {
|
|
658
|
-
projectId: string;
|
|
659
|
-
chatCount: number;
|
|
660
|
-
buildCount: number;
|
|
661
|
-
appRuntimeCount: number;
|
|
662
|
-
lastActivityAt: number;
|
|
663
|
-
latestChatId?: string;
|
|
664
|
-
latestOutcome?: {
|
|
665
|
-
pass: boolean;
|
|
666
|
-
score?: number;
|
|
667
|
-
};
|
|
668
|
-
}
|
|
669
|
-
interface ChatSummary {
|
|
670
|
-
chatId: string;
|
|
671
|
-
projectId: string;
|
|
672
|
-
builderRunId: string;
|
|
673
|
-
startedAt: number;
|
|
674
|
-
endedAt?: number;
|
|
675
|
-
status: Run['status'];
|
|
676
|
-
outcome?: Run['outcome'];
|
|
677
|
-
/** Counts of spans emitted during the chat. */
|
|
678
|
-
llmTurns?: number;
|
|
679
|
-
toolCalls?: number;
|
|
680
|
-
buildRunId?: string;
|
|
681
|
-
appRuntimeRunIds: string[];
|
|
682
|
-
}
|
|
683
|
-
interface ProjectTimelineEntry {
|
|
684
|
-
run: Run;
|
|
685
|
-
layerBucket: 'chat' | 'build' | 'runtime' | 'other';
|
|
686
|
-
}
|
|
687
|
-
declare class ProjectRegistry {
|
|
688
|
-
private store;
|
|
689
|
-
constructor(store: TraceStore);
|
|
690
|
-
listProjects(): Promise<ProjectSummary[]>;
|
|
691
|
-
projectTimeline(projectId: string): Promise<ProjectTimelineEntry[]>;
|
|
692
|
-
projectChats(projectId: string): Promise<ChatSummary[]>;
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
export { BuilderSession, type BuilderSessionInit, type ChatSummary, type CorrelationReport, type LayerCorrelation, type ProjectKind, ProjectRegistry, type ProjectSummary, type ProjectTimelineEntry, type RunAppScenarioOptions, type ShipOptions, type ThreeLayerProjectReport, correlateLayers, resumeBuilderSession, scoreAllProjects, scoreProject };
|