@tracecode/harness 0.4.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +113 -0
  2. package/LICENSE +674 -0
  3. package/README.md +266 -0
  4. package/dist/browser.cjs +1352 -0
  5. package/dist/browser.cjs.map +1 -0
  6. package/dist/browser.d.cts +49 -0
  7. package/dist/browser.d.ts +49 -0
  8. package/dist/browser.js +1317 -0
  9. package/dist/browser.js.map +1 -0
  10. package/dist/cli.cjs +70 -0
  11. package/dist/cli.cjs.map +1 -0
  12. package/dist/cli.d.cts +1 -0
  13. package/dist/cli.d.ts +1 -0
  14. package/dist/cli.js +70 -0
  15. package/dist/cli.js.map +1 -0
  16. package/dist/core.cjs +286 -0
  17. package/dist/core.cjs.map +1 -0
  18. package/dist/core.d.cts +69 -0
  19. package/dist/core.d.ts +69 -0
  20. package/dist/core.js +254 -0
  21. package/dist/core.js.map +1 -0
  22. package/dist/index.cjs +2603 -0
  23. package/dist/index.cjs.map +1 -0
  24. package/dist/index.d.cts +6 -0
  25. package/dist/index.d.ts +6 -0
  26. package/dist/index.js +2538 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/internal/browser.cjs +647 -0
  29. package/dist/internal/browser.cjs.map +1 -0
  30. package/dist/internal/browser.d.cts +143 -0
  31. package/dist/internal/browser.d.ts +143 -0
  32. package/dist/internal/browser.js +617 -0
  33. package/dist/internal/browser.js.map +1 -0
  34. package/dist/javascript.cjs +549 -0
  35. package/dist/javascript.cjs.map +1 -0
  36. package/dist/javascript.d.cts +11 -0
  37. package/dist/javascript.d.ts +11 -0
  38. package/dist/javascript.js +518 -0
  39. package/dist/javascript.js.map +1 -0
  40. package/dist/python.cjs +744 -0
  41. package/dist/python.cjs.map +1 -0
  42. package/dist/python.d.cts +97 -0
  43. package/dist/python.d.ts +97 -0
  44. package/dist/python.js +698 -0
  45. package/dist/python.js.map +1 -0
  46. package/dist/runtime-types-C7d1LFbx.d.ts +85 -0
  47. package/dist/runtime-types-Dvgn07z9.d.cts +85 -0
  48. package/dist/types-Bzr1Ohcf.d.cts +96 -0
  49. package/dist/types-Bzr1Ohcf.d.ts +96 -0
  50. package/package.json +89 -0
  51. package/workers/javascript/javascript-worker.js +2918 -0
  52. package/workers/python/generated-python-harness-snippets.js +20 -0
  53. package/workers/python/pyodide-worker.js +1197 -0
  54. package/workers/python/runtime-core.js +1529 -0
  55. package/workers/vendor/typescript.js +200276 -0
package/dist/core.cjs ADDED
@@ -0,0 +1,286 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/harness-core/src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ RUNTIME_TRACE_CONTRACT_SCHEMA_VERSION: () => RUNTIME_TRACE_CONTRACT_SCHEMA_VERSION,
24
+ adaptJavaScriptTraceExecutionResult: () => adaptJavaScriptTraceExecutionResult,
25
+ adaptPythonTraceExecutionResult: () => adaptPythonTraceExecutionResult,
26
+ adaptTraceExecutionResult: () => adaptTraceExecutionResult,
27
+ normalizeRuntimeTraceContract: () => normalizeRuntimeTraceContract,
28
+ stableStringifyRuntimeTraceContract: () => stableStringifyRuntimeTraceContract
29
+ });
30
+ module.exports = __toCommonJS(src_exports);
31
+
32
+ // packages/harness-core/src/trace-contract.ts
33
+ var RUNTIME_TRACE_CONTRACT_SCHEMA_VERSION = "2026-03-07";
34
+ var TRACE_EVENTS = /* @__PURE__ */ new Set([
35
+ "line",
36
+ "call",
37
+ "return",
38
+ "exception",
39
+ "timeout",
40
+ "stdout"
41
+ ]);
42
+ var TRACE_ACCESS_KINDS = /* @__PURE__ */ new Set([
43
+ "indexed-read",
44
+ "indexed-write",
45
+ "cell-read",
46
+ "cell-write",
47
+ "mutating-call"
48
+ ]);
49
+ function normalizeLineNumber(value, fallback = 1) {
50
+ if (typeof value !== "number" || !Number.isFinite(value)) return fallback;
51
+ const normalized = Math.floor(value);
52
+ return normalized > 0 ? normalized : fallback;
53
+ }
54
+ function normalizeOutputLineCount(value) {
55
+ if (typeof value !== "number" || !Number.isFinite(value)) return void 0;
56
+ const normalized = Math.floor(value);
57
+ return normalized >= 0 ? normalized : void 0;
58
+ }
59
+ function normalizeEvent(value) {
60
+ if (typeof value === "string" && TRACE_EVENTS.has(value)) {
61
+ return value;
62
+ }
63
+ return "line";
64
+ }
65
+ function normalizeAccessKind(value) {
66
+ if (typeof value === "string" && TRACE_ACCESS_KINDS.has(value)) {
67
+ return value;
68
+ }
69
+ return null;
70
+ }
71
+ function normalizeFunctionName(value) {
72
+ if (typeof value === "string" && value.length > 0) return value;
73
+ return "<module>";
74
+ }
75
+ function normalizeKind(value) {
76
+ if (value === "map" || value === "set" || value === "hashmap") {
77
+ return value;
78
+ }
79
+ return "hashmap";
80
+ }
81
+ function normalizeObjectKind(value) {
82
+ if (value === "hashmap" || value === "map" || value === "set" || value === "tree" || value === "linked-list" || value === "graph-adjacency") {
83
+ return value;
84
+ }
85
+ return null;
86
+ }
87
+ function normalizeScalar(value) {
88
+ if (value === null || value === void 0) return value;
89
+ if (typeof value === "string" || typeof value === "boolean") return value;
90
+ if (typeof value === "number") return Number.isFinite(value) ? value : String(value);
91
+ if (typeof value === "bigint") {
92
+ const asNumber = Number(value);
93
+ return Number.isSafeInteger(asNumber) ? asNumber : String(value);
94
+ }
95
+ if (typeof value === "function") return "<function>";
96
+ return null;
97
+ }
98
+ function normalizeUnknown(value, depth = 0, seen = /* @__PURE__ */ new WeakSet()) {
99
+ if (depth > 48) return "<max depth>";
100
+ const scalar = normalizeScalar(value);
101
+ if (scalar !== null || value === null || value === void 0) {
102
+ return scalar;
103
+ }
104
+ if (Array.isArray(value)) {
105
+ return value.map((item) => {
106
+ if (item === void 0) return null;
107
+ return normalizeUnknown(item, depth + 1, seen);
108
+ });
109
+ }
110
+ if (typeof value === "object" && value) {
111
+ if (seen.has(value)) return "<cycle>";
112
+ seen.add(value);
113
+ const normalized = {};
114
+ for (const key of Object.keys(value).sort()) {
115
+ const child = value[key];
116
+ if (child === void 0) continue;
117
+ normalized[key] = normalizeUnknown(child, depth + 1, seen);
118
+ }
119
+ seen.delete(value);
120
+ return normalized;
121
+ }
122
+ return String(value);
123
+ }
124
+ function normalizeAccesses(accesses) {
125
+ if (!Array.isArray(accesses) || accesses.length === 0) {
126
+ return void 0;
127
+ }
128
+ const normalized = accesses.map((access) => {
129
+ const variable = typeof access?.variable === "string" && access.variable.length > 0 ? access.variable : "";
130
+ const kind = normalizeAccessKind(access?.kind);
131
+ if (!variable || !kind) {
132
+ return null;
133
+ }
134
+ const indices = Array.isArray(access?.indices) ? access.indices.map(
135
+ (index) => typeof index === "number" && Number.isFinite(index) ? Math.floor(index) : null
136
+ ).filter((index) => index !== null) : void 0;
137
+ const pathDepth = access?.pathDepth === 1 || access?.pathDepth === 2 ? access.pathDepth : void 0;
138
+ const method = typeof access?.method === "string" && access.method.length > 0 ? access.method : void 0;
139
+ const payload = {
140
+ variable,
141
+ kind
142
+ };
143
+ if (indices && indices.length > 0) {
144
+ payload.indices = indices;
145
+ }
146
+ if (pathDepth !== void 0) {
147
+ payload.pathDepth = pathDepth;
148
+ }
149
+ if (method) {
150
+ payload.method = method;
151
+ }
152
+ return payload;
153
+ }).filter((access) => access !== null);
154
+ return normalized.length > 0 ? normalized : void 0;
155
+ }
156
+ function normalizeRecord(value) {
157
+ if (!value || typeof value !== "object" || Array.isArray(value)) return {};
158
+ return normalizeUnknown(value);
159
+ }
160
+ function normalizeCallStackFrame(frame) {
161
+ return {
162
+ function: normalizeFunctionName(frame?.function),
163
+ line: normalizeLineNumber(frame?.line, 1),
164
+ args: normalizeRecord(frame?.args)
165
+ };
166
+ }
167
+ function normalizeVisualizationPayload(payload) {
168
+ const hashMaps = Array.isArray(payload?.hashMaps) ? payload.hashMaps.map((entry) => ({
169
+ name: typeof entry?.name === "string" ? entry.name : "",
170
+ kind: normalizeKind(entry?.kind),
171
+ entries: Array.isArray(entry?.entries) ? entry.entries.map((item) => ({
172
+ key: normalizeUnknown(item?.key),
173
+ value: normalizeUnknown(item?.value),
174
+ ...item?.highlight ? { highlight: true } : {}
175
+ })) : [],
176
+ ...entry?.highlightedKey !== void 0 ? { highlightedKey: normalizeUnknown(entry.highlightedKey) } : {},
177
+ ...entry?.deletedKey !== void 0 ? { deletedKey: normalizeUnknown(entry.deletedKey) } : {}
178
+ })).sort((a, b) => `${a.name}:${a.kind}`.localeCompare(`${b.name}:${b.kind}`)) : [];
179
+ const objectKinds = payload?.objectKinds && typeof payload.objectKinds === "object" ? Object.fromEntries(
180
+ Object.entries(payload.objectKinds).filter(([name]) => typeof name === "string" && name.length > 0).map(([name, kind]) => [name, normalizeObjectKind(kind)]).filter((entry) => entry[1] !== null).sort((a, b) => a[0].localeCompare(b[0]))
181
+ ) : void 0;
182
+ if (hashMaps.length === 0 && (!objectKinds || Object.keys(objectKinds).length === 0)) {
183
+ return void 0;
184
+ }
185
+ return {
186
+ ...hashMaps.length > 0 ? { hashMaps } : {},
187
+ ...objectKinds && Object.keys(objectKinds).length > 0 ? { objectKinds } : {}
188
+ };
189
+ }
190
+ function normalizeTraceStep(step) {
191
+ const normalizedStdoutCount = normalizeOutputLineCount(step?.stdoutLineCount);
192
+ const normalizedVisualization = normalizeVisualizationPayload(step?.visualization);
193
+ const normalizedAccesses = normalizeAccesses(step?.accesses);
194
+ return {
195
+ event: normalizeEvent(step?.event),
196
+ line: normalizeLineNumber(step?.line, 1),
197
+ function: normalizeFunctionName(step?.function),
198
+ variables: normalizeRecord(step?.variables),
199
+ ...Array.isArray(step?.callStack) && step.callStack.length > 0 ? { callStack: step.callStack.map(normalizeCallStackFrame) } : {},
200
+ ...normalizedAccesses ? { accesses: normalizedAccesses } : {},
201
+ ...step?.returnValue !== void 0 ? { returnValue: normalizeUnknown(step.returnValue) } : {},
202
+ ...normalizedStdoutCount !== void 0 ? { stdoutLineCount: normalizedStdoutCount } : {},
203
+ ...normalizedVisualization ? { visualization: normalizedVisualization } : {}
204
+ };
205
+ }
206
+ function normalizeRuntimeTraceContract(language, result) {
207
+ const normalizedTrace = Array.isArray(result.trace) ? result.trace.map(normalizeTraceStep) : [];
208
+ const lineEventCount = typeof result.lineEventCount === "number" && Number.isFinite(result.lineEventCount) ? Math.floor(result.lineEventCount) : normalizedTrace.filter((step) => step.event === "line").length;
209
+ const normalizedConsole = Array.isArray(result.consoleOutput) ? result.consoleOutput.map((line) => String(line)) : [];
210
+ return {
211
+ schemaVersion: RUNTIME_TRACE_CONTRACT_SCHEMA_VERSION,
212
+ language,
213
+ success: Boolean(result.success),
214
+ ...Object.prototype.hasOwnProperty.call(result, "output") ? { output: normalizeUnknown(result.output) } : {},
215
+ ...typeof result.error === "string" && result.error.length > 0 ? { error: result.error } : {},
216
+ ...typeof result.errorLine === "number" && Number.isFinite(result.errorLine) ? { errorLine: Math.floor(result.errorLine) } : {},
217
+ consoleOutput: normalizedConsole,
218
+ trace: normalizedTrace,
219
+ ...result.traceLimitExceeded !== void 0 ? { traceLimitExceeded: Boolean(result.traceLimitExceeded) } : {},
220
+ ...typeof result.timeoutReason === "string" && result.timeoutReason.length > 0 ? { timeoutReason: result.timeoutReason } : {},
221
+ lineEventCount: Math.max(0, lineEventCount),
222
+ traceStepCount: normalizedTrace.length
223
+ };
224
+ }
225
+ function stableStringifyRuntimeTraceContract(value) {
226
+ return JSON.stringify(normalizeUnknown(value), null, 2);
227
+ }
228
+
229
+ // packages/harness-core/src/trace-adapters/shared.ts
230
+ function denormalizeCallStackFrame(frame) {
231
+ return {
232
+ function: frame.function,
233
+ line: frame.line,
234
+ args: frame.args
235
+ };
236
+ }
237
+ function denormalizeTraceStep(step) {
238
+ return {
239
+ line: step.line,
240
+ event: step.event,
241
+ variables: step.variables,
242
+ function: step.function,
243
+ ...step.callStack ? { callStack: step.callStack.map(denormalizeCallStackFrame) } : {},
244
+ ...step.accesses ? { accesses: step.accesses } : {},
245
+ ...step.returnValue !== void 0 ? { returnValue: step.returnValue } : {},
246
+ ...step.stdoutLineCount !== void 0 ? { stdoutLineCount: step.stdoutLineCount } : {},
247
+ ...step.visualization ? { visualization: step.visualization } : {}
248
+ };
249
+ }
250
+ function adaptTraceExecutionResult(language, result) {
251
+ const normalized = normalizeRuntimeTraceContract(language, result);
252
+ const adaptedTrace = normalized.trace.map(denormalizeTraceStep);
253
+ return {
254
+ success: normalized.success,
255
+ ...Object.prototype.hasOwnProperty.call(normalized, "output") ? { output: normalized.output } : {},
256
+ ...normalized.error ? { error: normalized.error } : {},
257
+ ...normalized.errorLine !== void 0 ? { errorLine: normalized.errorLine } : {},
258
+ trace: adaptedTrace,
259
+ executionTimeMs: typeof result.executionTimeMs === "number" && Number.isFinite(result.executionTimeMs) ? result.executionTimeMs : 0,
260
+ consoleOutput: normalized.consoleOutput,
261
+ ...normalized.traceLimitExceeded !== void 0 ? { traceLimitExceeded: normalized.traceLimitExceeded } : {},
262
+ ...normalized.timeoutReason ? { timeoutReason: normalized.timeoutReason } : {},
263
+ lineEventCount: normalized.lineEventCount,
264
+ traceStepCount: adaptedTrace.length
265
+ };
266
+ }
267
+
268
+ // packages/harness-core/src/trace-adapters/python.ts
269
+ function adaptPythonTraceExecutionResult(result) {
270
+ return adaptTraceExecutionResult("python", result);
271
+ }
272
+
273
+ // packages/harness-core/src/trace-adapters/javascript.ts
274
+ function adaptJavaScriptTraceExecutionResult(language, result) {
275
+ return adaptTraceExecutionResult(language, result);
276
+ }
277
+ // Annotate the CommonJS export names for ESM import in node:
278
+ 0 && (module.exports = {
279
+ RUNTIME_TRACE_CONTRACT_SCHEMA_VERSION,
280
+ adaptJavaScriptTraceExecutionResult,
281
+ adaptPythonTraceExecutionResult,
282
+ adaptTraceExecutionResult,
283
+ normalizeRuntimeTraceContract,
284
+ stableStringifyRuntimeTraceContract
285
+ });
286
+ //# sourceMappingURL=core.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../packages/harness-core/src/index.ts","../packages/harness-core/src/trace-contract.ts","../packages/harness-core/src/trace-adapters/shared.ts","../packages/harness-core/src/trace-adapters/python.ts","../packages/harness-core/src/trace-adapters/javascript.ts"],"sourcesContent":["export * from './runtime-types';\nexport * from './types';\nexport * from './trace-contract';\nexport * from './trace-adapters/shared';\nexport * from './trace-adapters/python';\nexport * from './trace-adapters/javascript';\n","import type { Language } from './runtime-types';\nimport type {\n CallStackFrame,\n ExecutionResult,\n RawTraceStep,\n RuntimeTraceAccessEvent,\n RuntimeTraceAccessKind,\n RuntimeObjectKind,\n RuntimeVisualizationPayload,\n} from './types';\n\n/**\n * Runtime trace contract schema version.\n *\n * Bump this when payload shape/normalization semantics change in a way that\n * should invalidate golden fixtures.\n */\nexport const RUNTIME_TRACE_CONTRACT_SCHEMA_VERSION = '2026-03-07';\n\nexport type RuntimeTraceContractEvent =\n | 'line'\n | 'call'\n | 'return'\n | 'exception'\n | 'timeout'\n | 'stdout';\n\nexport interface RuntimeTraceContractHashMapEntry {\n key: unknown;\n value: unknown;\n highlight?: boolean;\n}\n\nexport interface RuntimeTraceContractHashMap {\n name: string;\n kind: 'hashmap' | 'map' | 'set';\n entries: RuntimeTraceContractHashMapEntry[];\n highlightedKey?: unknown;\n deletedKey?: unknown;\n}\n\nexport interface RuntimeTraceContractVisualization {\n hashMaps?: RuntimeTraceContractHashMap[];\n objectKinds?: Partial<Record<string, RuntimeObjectKind>>;\n}\n\nexport interface RuntimeTraceContractCallStackFrame {\n function: string;\n line: number;\n args: Record<string, unknown>;\n}\n\nexport interface RuntimeTraceContractStep {\n event: RuntimeTraceContractEvent;\n line: number;\n function: string;\n variables: Record<string, unknown>;\n callStack?: RuntimeTraceContractCallStackFrame[];\n accesses?: RuntimeTraceAccessEvent[];\n returnValue?: unknown;\n stdoutLineCount?: number;\n visualization?: RuntimeTraceContractVisualization;\n}\n\nexport interface RuntimeTraceContractResult {\n schemaVersion: typeof RUNTIME_TRACE_CONTRACT_SCHEMA_VERSION;\n language: Language;\n success: boolean;\n output?: unknown;\n error?: string;\n errorLine?: number;\n consoleOutput: string[];\n trace: RuntimeTraceContractStep[];\n traceLimitExceeded?: boolean;\n timeoutReason?: string;\n lineEventCount: number;\n traceStepCount: number;\n}\n\nconst TRACE_EVENTS: ReadonlySet<string> = new Set([\n 'line',\n 'call',\n 'return',\n 'exception',\n 'timeout',\n 'stdout',\n]);\n\nconst TRACE_ACCESS_KINDS: ReadonlySet<RuntimeTraceAccessKind> = new Set([\n 'indexed-read',\n 'indexed-write',\n 'cell-read',\n 'cell-write',\n 'mutating-call',\n]);\n\nfunction normalizeLineNumber(value: unknown, fallback = 1): number {\n if (typeof value !== 'number' || !Number.isFinite(value)) return fallback;\n const normalized = Math.floor(value);\n return normalized > 0 ? normalized : fallback;\n}\n\nfunction normalizeOutputLineCount(value: unknown): number | undefined {\n if (typeof value !== 'number' || !Number.isFinite(value)) return undefined;\n const normalized = Math.floor(value);\n return normalized >= 0 ? normalized : undefined;\n}\n\nfunction normalizeEvent(value: unknown): RuntimeTraceContractEvent {\n if (typeof value === 'string' && TRACE_EVENTS.has(value)) {\n return value as RuntimeTraceContractEvent;\n }\n return 'line';\n}\n\nfunction normalizeAccessKind(value: unknown): RuntimeTraceAccessKind | null {\n if (typeof value === 'string' && TRACE_ACCESS_KINDS.has(value as RuntimeTraceAccessKind)) {\n return value as RuntimeTraceAccessKind;\n }\n return null;\n}\n\nfunction normalizeFunctionName(value: unknown): string {\n if (typeof value === 'string' && value.length > 0) return value;\n return '<module>';\n}\n\nfunction normalizeKind(value: unknown): 'hashmap' | 'map' | 'set' {\n if (value === 'map' || value === 'set' || value === 'hashmap') {\n return value;\n }\n return 'hashmap';\n}\n\nfunction normalizeObjectKind(value: unknown): RuntimeObjectKind | null {\n if (\n value === 'hashmap' ||\n value === 'map' ||\n value === 'set' ||\n value === 'tree' ||\n value === 'linked-list' ||\n value === 'graph-adjacency'\n ) {\n return value;\n }\n return null;\n}\n\nfunction normalizeScalar(value: unknown): unknown {\n if (value === null || value === undefined) return value;\n if (typeof value === 'string' || typeof value === 'boolean') return value;\n if (typeof value === 'number') return Number.isFinite(value) ? value : String(value);\n if (typeof value === 'bigint') {\n const asNumber = Number(value);\n return Number.isSafeInteger(asNumber) ? asNumber : String(value);\n }\n if (typeof value === 'function') return '<function>';\n return null;\n}\n\nfunction normalizeUnknown(value: unknown, depth = 0, seen = new WeakSet<object>()): unknown {\n if (depth > 48) return '<max depth>';\n\n const scalar = normalizeScalar(value);\n if (scalar !== null || value === null || value === undefined) {\n return scalar;\n }\n\n if (Array.isArray(value)) {\n return value.map((item) => {\n if (item === undefined) return null;\n return normalizeUnknown(item, depth + 1, seen);\n });\n }\n\n if (typeof value === 'object' && value) {\n if (seen.has(value)) return '<cycle>';\n seen.add(value);\n\n const normalized: Record<string, unknown> = {};\n for (const key of Object.keys(value as Record<string, unknown>).sort()) {\n const child = (value as Record<string, unknown>)[key];\n if (child === undefined) continue;\n normalized[key] = normalizeUnknown(child, depth + 1, seen);\n }\n\n seen.delete(value);\n return normalized;\n }\n\n return String(value);\n}\n\nfunction normalizeAccesses(\n accesses: RuntimeTraceAccessEvent[] | undefined\n): RuntimeTraceAccessEvent[] | undefined {\n if (!Array.isArray(accesses) || accesses.length === 0) {\n return undefined;\n }\n\n const normalized = accesses\n .map((access) => {\n const variable =\n typeof access?.variable === 'string' && access.variable.length > 0 ? access.variable : '';\n const kind = normalizeAccessKind(access?.kind);\n if (!variable || !kind) {\n return null;\n }\n\n const indices = Array.isArray(access?.indices)\n ? access.indices\n .map((index) =>\n typeof index === 'number' && Number.isFinite(index) ? Math.floor(index) : null\n )\n .filter((index): index is number => index !== null)\n : undefined;\n const pathDepth =\n access?.pathDepth === 1 || access?.pathDepth === 2 ? access.pathDepth : undefined;\n const method =\n typeof access?.method === 'string' && access.method.length > 0 ? access.method : undefined;\n\n const payload: RuntimeTraceAccessEvent = {\n variable,\n kind,\n };\n\n if (indices && indices.length > 0) {\n payload.indices = indices;\n }\n if (pathDepth !== undefined) {\n payload.pathDepth = pathDepth;\n }\n if (method) {\n payload.method = method;\n }\n\n return payload;\n })\n .filter((access): access is RuntimeTraceAccessEvent => access !== null);\n\n return normalized.length > 0 ? normalized : undefined;\n}\n\nfunction normalizeRecord(value: unknown): Record<string, unknown> {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return {};\n return normalizeUnknown(value) as Record<string, unknown>;\n}\n\nfunction normalizeCallStackFrame(frame: CallStackFrame): RuntimeTraceContractCallStackFrame {\n return {\n function: normalizeFunctionName(frame?.function),\n line: normalizeLineNumber(frame?.line, 1),\n args: normalizeRecord(frame?.args),\n };\n}\n\nfunction normalizeVisualizationPayload(\n payload: RuntimeVisualizationPayload | undefined\n): RuntimeTraceContractVisualization | undefined {\n const hashMaps = Array.isArray(payload?.hashMaps)\n ? payload.hashMaps\n .map((entry) => ({\n name: typeof entry?.name === 'string' ? entry.name : '',\n kind: normalizeKind(entry?.kind),\n entries: Array.isArray(entry?.entries)\n ? entry.entries.map((item) => ({\n key: normalizeUnknown(item?.key),\n value: normalizeUnknown(item?.value),\n ...(item?.highlight ? { highlight: true } : {}),\n }))\n : [],\n ...(entry?.highlightedKey !== undefined\n ? { highlightedKey: normalizeUnknown(entry.highlightedKey) }\n : {}),\n ...(entry?.deletedKey !== undefined\n ? { deletedKey: normalizeUnknown(entry.deletedKey) }\n : {}),\n }))\n .sort((a, b) => `${a.name}:${a.kind}`.localeCompare(`${b.name}:${b.kind}`))\n : [];\n\n const objectKinds =\n payload?.objectKinds && typeof payload.objectKinds === 'object'\n ? Object.fromEntries(\n Object.entries(payload.objectKinds)\n .filter(([name]) => typeof name === 'string' && name.length > 0)\n .map(([name, kind]) => [name, normalizeObjectKind(kind)])\n .filter((entry): entry is [string, RuntimeObjectKind] => entry[1] !== null)\n .sort((a, b) => a[0].localeCompare(b[0]))\n )\n : undefined;\n\n if (hashMaps.length === 0 && (!objectKinds || Object.keys(objectKinds).length === 0)) {\n return undefined;\n }\n\n return {\n ...(hashMaps.length > 0 ? { hashMaps } : {}),\n ...(objectKinds && Object.keys(objectKinds).length > 0 ? { objectKinds } : {}),\n };\n}\n\nfunction normalizeTraceStep(step: RawTraceStep): RuntimeTraceContractStep {\n const normalizedStdoutCount = normalizeOutputLineCount(step?.stdoutLineCount);\n const normalizedVisualization = normalizeVisualizationPayload(step?.visualization);\n const normalizedAccesses = normalizeAccesses(step?.accesses);\n\n return {\n event: normalizeEvent(step?.event),\n line: normalizeLineNumber(step?.line, 1),\n function: normalizeFunctionName(step?.function),\n variables: normalizeRecord(step?.variables),\n ...(Array.isArray(step?.callStack) && step.callStack.length > 0\n ? { callStack: step.callStack.map(normalizeCallStackFrame) }\n : {}),\n ...(normalizedAccesses ? { accesses: normalizedAccesses } : {}),\n ...(step?.returnValue !== undefined ? { returnValue: normalizeUnknown(step.returnValue) } : {}),\n ...(normalizedStdoutCount !== undefined ? { stdoutLineCount: normalizedStdoutCount } : {}),\n ...(normalizedVisualization ? { visualization: normalizedVisualization } : {}),\n };\n}\n\nexport function normalizeRuntimeTraceContract(\n language: Language,\n result: ExecutionResult\n): RuntimeTraceContractResult {\n const normalizedTrace = Array.isArray(result.trace) ? result.trace.map(normalizeTraceStep) : [];\n const lineEventCount =\n typeof result.lineEventCount === 'number' && Number.isFinite(result.lineEventCount)\n ? Math.floor(result.lineEventCount)\n : normalizedTrace.filter((step) => step.event === 'line').length;\n\n const normalizedConsole = Array.isArray(result.consoleOutput)\n ? result.consoleOutput.map((line) => String(line))\n : [];\n\n return {\n schemaVersion: RUNTIME_TRACE_CONTRACT_SCHEMA_VERSION,\n language,\n success: Boolean(result.success),\n ...(Object.prototype.hasOwnProperty.call(result, 'output')\n ? { output: normalizeUnknown(result.output) }\n : {}),\n ...(typeof result.error === 'string' && result.error.length > 0\n ? { error: result.error }\n : {}),\n ...(typeof result.errorLine === 'number' && Number.isFinite(result.errorLine)\n ? { errorLine: Math.floor(result.errorLine) }\n : {}),\n consoleOutput: normalizedConsole,\n trace: normalizedTrace,\n ...(result.traceLimitExceeded !== undefined\n ? { traceLimitExceeded: Boolean(result.traceLimitExceeded) }\n : {}),\n ...(typeof result.timeoutReason === 'string' && result.timeoutReason.length > 0\n ? { timeoutReason: result.timeoutReason }\n : {}),\n lineEventCount: Math.max(0, lineEventCount),\n traceStepCount: normalizedTrace.length,\n };\n}\n\nexport function stableStringifyRuntimeTraceContract(value: unknown): string {\n return JSON.stringify(normalizeUnknown(value), null, 2);\n}\n","import type { Language } from '../runtime-types';\nimport {\n normalizeRuntimeTraceContract,\n type RuntimeTraceContractCallStackFrame,\n type RuntimeTraceContractStep,\n} from '../trace-contract';\nimport type {\n CallStackFrame,\n ExecutionResult,\n RawTraceStep,\n RuntimeVisualizationPayload,\n} from '../types';\n\nfunction denormalizeCallStackFrame(frame: RuntimeTraceContractCallStackFrame): CallStackFrame {\n return {\n function: frame.function,\n line: frame.line,\n args: frame.args,\n };\n}\n\nfunction denormalizeTraceStep(step: RuntimeTraceContractStep): RawTraceStep {\n return {\n line: step.line,\n event: step.event,\n variables: step.variables,\n function: step.function,\n ...(step.callStack ? { callStack: step.callStack.map(denormalizeCallStackFrame) } : {}),\n ...(step.accesses ? { accesses: step.accesses } : {}),\n ...(step.returnValue !== undefined ? { returnValue: step.returnValue } : {}),\n ...(step.stdoutLineCount !== undefined ? { stdoutLineCount: step.stdoutLineCount } : {}),\n ...(step.visualization ? { visualization: step.visualization as RuntimeVisualizationPayload } : {}),\n };\n}\n\nexport function adaptTraceExecutionResult(\n language: Language,\n result: ExecutionResult\n): ExecutionResult {\n const normalized = normalizeRuntimeTraceContract(language, result);\n const adaptedTrace: RawTraceStep[] = normalized.trace.map(denormalizeTraceStep);\n\n return {\n success: normalized.success,\n ...(Object.prototype.hasOwnProperty.call(normalized, 'output') ? { output: normalized.output } : {}),\n ...(normalized.error ? { error: normalized.error } : {}),\n ...(normalized.errorLine !== undefined ? { errorLine: normalized.errorLine } : {}),\n trace: adaptedTrace,\n executionTimeMs:\n typeof result.executionTimeMs === 'number' && Number.isFinite(result.executionTimeMs)\n ? result.executionTimeMs\n : 0,\n consoleOutput: normalized.consoleOutput,\n ...(normalized.traceLimitExceeded !== undefined ? { traceLimitExceeded: normalized.traceLimitExceeded } : {}),\n ...(normalized.timeoutReason\n ? { timeoutReason: normalized.timeoutReason as ExecutionResult['timeoutReason'] }\n : {}),\n lineEventCount: normalized.lineEventCount,\n traceStepCount: adaptedTrace.length,\n };\n}\n","import type { ExecutionResult } from '../types';\nimport { adaptTraceExecutionResult } from './shared';\n\nexport function adaptPythonTraceExecutionResult(result: ExecutionResult): ExecutionResult {\n return adaptTraceExecutionResult('python', result);\n}\n","import type { Language } from '../runtime-types';\nimport type { ExecutionResult } from '../types';\nimport { adaptTraceExecutionResult } from './shared';\n\nexport function adaptJavaScriptTraceExecutionResult(\n language: Extract<Language, 'javascript' | 'typescript'>,\n result: ExecutionResult\n): ExecutionResult {\n return adaptTraceExecutionResult(language, result);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,IAAM,wCAAwC;AA8DrD,IAAM,eAAoC,oBAAI,IAAI;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IA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AC;AAAA,IACnD,GAAI,KAAK,gBAAgB,SAAY,EAAE,aAAa,KAAK,YAAY,IAAI,CAAC;AAAA,IAC1E,GAAI,KAAK,oBAAoB,SAAY,EAAE,iBAAiB,KAAK,gBAAgB,IAAI,CAAC;AAAA,IACtF,GAAI,KAAK,gBAAgB,EAAE,eAAe,KAAK,cAA6C,IAAI,CAAC;AAAA,EACnG;AACF;AAEO,SAAS,0BACd,UACA,QACiB;AACjB,QAAM,aAAa,8BAA8B,UAAU,MAAM;AACjE,QAAM,eAA+B,WAAW,MAAM,IAAI,oBAAoB;AAE9E,SAAO;AAAA,IACL,SAAS,WAAW;AAAA,IACpB,GAAI,OAAO,UAAU,eAAe,KAAK,YAAY,QAAQ,IAAI,EAAE,QAAQ,WAAW,OAAO,IAAI,CAAC;AAAA,IAClG,GAAI,WAAW,QAAQ,EAAE,OAAO,WAAW,MAAM,IAAI,CAAC;AAAA,IACtD,GAAI,WAAW,cAAc,SAAY,EAAE,WAAW,WAAW,UAAU,IAAI,CAAC;AAAA,IAChF,OAAO;AAAA,IACP,iBACE,OAAO,OAAO,oBAAoB,YAAY,OAAO,SAAS,OAAO,eAAe,IAChF,OAAO,kBACP;AAAA,IACN,eAAe,WAAW;AAAA,IAC1B,GAAI,WAAW,uBAAuB,SAAY,EAAE,oBAAoB,WAAW,mBAAmB,IAAI,CAAC;AAAA,IAC3G,GAAI,WAAW,gBACX,EAAE,eAAe,WAAW,cAAkD,IAC9E,CAAC;AAAA,IACL,gBAAgB,WAAW;AAAA,IAC3B,gBAAgB,aAAa;AAAA,EAC/B;AACF;;;ACzDO,SAAS,gCAAgC,QAA0C;AACxF,SAAO,0BAA0B,UAAU,MAAM;AACnD;;;ACDO,SAAS,oCACd,UACA,QACiB;AACjB,SAAO,0BAA0B,UAAU,MAAM;AACnD;","names":[]}
@@ -0,0 +1,69 @@
1
+ import { L as Language } from './runtime-types-Dvgn07z9.cjs';
2
+ export { a as LanguageRuntimeProfile, R as RuntimeCapabilities, b as RuntimeClient, c as RuntimeExecutionStyle, d as RuntimeMaturity, T as TraceExecutionOptions } from './runtime-types-Dvgn07z9.cjs';
3
+ import { g as RuntimeTraceAccessEvent, f as RuntimeObjectKind, E as ExecutionResult } from './types-Bzr1Ohcf.cjs';
4
+ export { C as CallStackFrame, a as CodeExecutionResult, b as ExecutionStatus, P as ProcessedStep, c as PyodideState, R as RawTraceStep, d as RuntimeHashMapEntry, e as RuntimeHashMapVisualization, h as RuntimeTraceAccessKind, i as RuntimeVisualizationPayload, T as TestResult } from './types-Bzr1Ohcf.cjs';
5
+
6
+ /**
7
+ * Runtime trace contract schema version.
8
+ *
9
+ * Bump this when payload shape/normalization semantics change in a way that
10
+ * should invalidate golden fixtures.
11
+ */
12
+ declare const RUNTIME_TRACE_CONTRACT_SCHEMA_VERSION = "2026-03-07";
13
+ type RuntimeTraceContractEvent = 'line' | 'call' | 'return' | 'exception' | 'timeout' | 'stdout';
14
+ interface RuntimeTraceContractHashMapEntry {
15
+ key: unknown;
16
+ value: unknown;
17
+ highlight?: boolean;
18
+ }
19
+ interface RuntimeTraceContractHashMap {
20
+ name: string;
21
+ kind: 'hashmap' | 'map' | 'set';
22
+ entries: RuntimeTraceContractHashMapEntry[];
23
+ highlightedKey?: unknown;
24
+ deletedKey?: unknown;
25
+ }
26
+ interface RuntimeTraceContractVisualization {
27
+ hashMaps?: RuntimeTraceContractHashMap[];
28
+ objectKinds?: Partial<Record<string, RuntimeObjectKind>>;
29
+ }
30
+ interface RuntimeTraceContractCallStackFrame {
31
+ function: string;
32
+ line: number;
33
+ args: Record<string, unknown>;
34
+ }
35
+ interface RuntimeTraceContractStep {
36
+ event: RuntimeTraceContractEvent;
37
+ line: number;
38
+ function: string;
39
+ variables: Record<string, unknown>;
40
+ callStack?: RuntimeTraceContractCallStackFrame[];
41
+ accesses?: RuntimeTraceAccessEvent[];
42
+ returnValue?: unknown;
43
+ stdoutLineCount?: number;
44
+ visualization?: RuntimeTraceContractVisualization;
45
+ }
46
+ interface RuntimeTraceContractResult {
47
+ schemaVersion: typeof RUNTIME_TRACE_CONTRACT_SCHEMA_VERSION;
48
+ language: Language;
49
+ success: boolean;
50
+ output?: unknown;
51
+ error?: string;
52
+ errorLine?: number;
53
+ consoleOutput: string[];
54
+ trace: RuntimeTraceContractStep[];
55
+ traceLimitExceeded?: boolean;
56
+ timeoutReason?: string;
57
+ lineEventCount: number;
58
+ traceStepCount: number;
59
+ }
60
+ declare function normalizeRuntimeTraceContract(language: Language, result: ExecutionResult): RuntimeTraceContractResult;
61
+ declare function stableStringifyRuntimeTraceContract(value: unknown): string;
62
+
63
+ declare function adaptTraceExecutionResult(language: Language, result: ExecutionResult): ExecutionResult;
64
+
65
+ declare function adaptPythonTraceExecutionResult(result: ExecutionResult): ExecutionResult;
66
+
67
+ declare function adaptJavaScriptTraceExecutionResult(language: Extract<Language, 'javascript' | 'typescript'>, result: ExecutionResult): ExecutionResult;
68
+
69
+ export { ExecutionResult, Language, RUNTIME_TRACE_CONTRACT_SCHEMA_VERSION, RuntimeObjectKind, RuntimeTraceAccessEvent, type RuntimeTraceContractCallStackFrame, type RuntimeTraceContractEvent, type RuntimeTraceContractHashMap, type RuntimeTraceContractHashMapEntry, type RuntimeTraceContractResult, type RuntimeTraceContractStep, type RuntimeTraceContractVisualization, adaptJavaScriptTraceExecutionResult, adaptPythonTraceExecutionResult, adaptTraceExecutionResult, normalizeRuntimeTraceContract, stableStringifyRuntimeTraceContract };
package/dist/core.d.ts ADDED
@@ -0,0 +1,69 @@
1
+ import { L as Language } from './runtime-types-C7d1LFbx.js';
2
+ export { a as LanguageRuntimeProfile, R as RuntimeCapabilities, b as RuntimeClient, c as RuntimeExecutionStyle, d as RuntimeMaturity, T as TraceExecutionOptions } from './runtime-types-C7d1LFbx.js';
3
+ import { g as RuntimeTraceAccessEvent, f as RuntimeObjectKind, E as ExecutionResult } from './types-Bzr1Ohcf.js';
4
+ export { C as CallStackFrame, a as CodeExecutionResult, b as ExecutionStatus, P as ProcessedStep, c as PyodideState, R as RawTraceStep, d as RuntimeHashMapEntry, e as RuntimeHashMapVisualization, h as RuntimeTraceAccessKind, i as RuntimeVisualizationPayload, T as TestResult } from './types-Bzr1Ohcf.js';
5
+
6
+ /**
7
+ * Runtime trace contract schema version.
8
+ *
9
+ * Bump this when payload shape/normalization semantics change in a way that
10
+ * should invalidate golden fixtures.
11
+ */
12
+ declare const RUNTIME_TRACE_CONTRACT_SCHEMA_VERSION = "2026-03-07";
13
+ type RuntimeTraceContractEvent = 'line' | 'call' | 'return' | 'exception' | 'timeout' | 'stdout';
14
+ interface RuntimeTraceContractHashMapEntry {
15
+ key: unknown;
16
+ value: unknown;
17
+ highlight?: boolean;
18
+ }
19
+ interface RuntimeTraceContractHashMap {
20
+ name: string;
21
+ kind: 'hashmap' | 'map' | 'set';
22
+ entries: RuntimeTraceContractHashMapEntry[];
23
+ highlightedKey?: unknown;
24
+ deletedKey?: unknown;
25
+ }
26
+ interface RuntimeTraceContractVisualization {
27
+ hashMaps?: RuntimeTraceContractHashMap[];
28
+ objectKinds?: Partial<Record<string, RuntimeObjectKind>>;
29
+ }
30
+ interface RuntimeTraceContractCallStackFrame {
31
+ function: string;
32
+ line: number;
33
+ args: Record<string, unknown>;
34
+ }
35
+ interface RuntimeTraceContractStep {
36
+ event: RuntimeTraceContractEvent;
37
+ line: number;
38
+ function: string;
39
+ variables: Record<string, unknown>;
40
+ callStack?: RuntimeTraceContractCallStackFrame[];
41
+ accesses?: RuntimeTraceAccessEvent[];
42
+ returnValue?: unknown;
43
+ stdoutLineCount?: number;
44
+ visualization?: RuntimeTraceContractVisualization;
45
+ }
46
+ interface RuntimeTraceContractResult {
47
+ schemaVersion: typeof RUNTIME_TRACE_CONTRACT_SCHEMA_VERSION;
48
+ language: Language;
49
+ success: boolean;
50
+ output?: unknown;
51
+ error?: string;
52
+ errorLine?: number;
53
+ consoleOutput: string[];
54
+ trace: RuntimeTraceContractStep[];
55
+ traceLimitExceeded?: boolean;
56
+ timeoutReason?: string;
57
+ lineEventCount: number;
58
+ traceStepCount: number;
59
+ }
60
+ declare function normalizeRuntimeTraceContract(language: Language, result: ExecutionResult): RuntimeTraceContractResult;
61
+ declare function stableStringifyRuntimeTraceContract(value: unknown): string;
62
+
63
+ declare function adaptTraceExecutionResult(language: Language, result: ExecutionResult): ExecutionResult;
64
+
65
+ declare function adaptPythonTraceExecutionResult(result: ExecutionResult): ExecutionResult;
66
+
67
+ declare function adaptJavaScriptTraceExecutionResult(language: Extract<Language, 'javascript' | 'typescript'>, result: ExecutionResult): ExecutionResult;
68
+
69
+ export { ExecutionResult, Language, RUNTIME_TRACE_CONTRACT_SCHEMA_VERSION, RuntimeObjectKind, RuntimeTraceAccessEvent, type RuntimeTraceContractCallStackFrame, type RuntimeTraceContractEvent, type RuntimeTraceContractHashMap, type RuntimeTraceContractHashMapEntry, type RuntimeTraceContractResult, type RuntimeTraceContractStep, type RuntimeTraceContractVisualization, adaptJavaScriptTraceExecutionResult, adaptPythonTraceExecutionResult, adaptTraceExecutionResult, normalizeRuntimeTraceContract, stableStringifyRuntimeTraceContract };