@jungjaehoon/mama-core 2.0.0 → 2.1.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.
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
-- Migration 043: tool_traces.failure_code — carry the thrower's closed cause.
|
|
2
|
+
--
|
|
3
|
+
-- The failure choke already emits a structured code (envelope_missing,
|
|
4
|
+
-- context_compile_scope_denied, ...) and the sanitizer explicitly preserves
|
|
5
|
+
-- it; the trace INSERT was the one place that dropped it, leaving only
|
|
6
|
+
-- `gateway_tool_failed;sha256=...` digests (measured 2026-07-30: the dominant
|
|
7
|
+
-- digest covered 52% of 2,460 context_compile failures with no name).
|
|
8
|
+
-- Nullable on purpose: a failure without a code stays NULL — labels are
|
|
9
|
+
-- carried, never invented.
|
|
10
|
+
|
|
11
|
+
ALTER TABLE tool_traces ADD COLUMN failure_code TEXT;
|
|
@@ -58,6 +58,7 @@ function mapToolTraceRow(row) {
|
|
|
58
58
|
execution_status: nullableString(row.execution_status),
|
|
59
59
|
duration_ms: requiredNonNegativeInteger(row.duration_ms, 'duration_ms'),
|
|
60
60
|
envelope_hash: nullableString(row.envelope_hash),
|
|
61
|
+
failure_code: nullableString(row.failure_code),
|
|
61
62
|
created_at: requiredInteger(row.created_at, 'created_at'),
|
|
62
63
|
};
|
|
63
64
|
}
|
|
@@ -70,7 +71,8 @@ function selectToolTrace(adapter, id) {
|
|
|
70
71
|
.prepare(`
|
|
71
72
|
SELECT
|
|
72
73
|
trace_id, model_run_id, gateway_call_id, tool_name, input_summary,
|
|
73
|
-
output_summary, execution_status, duration_ms, envelope_hash,
|
|
74
|
+
output_summary, execution_status, duration_ms, envelope_hash, failure_code,
|
|
75
|
+
created_at
|
|
74
76
|
FROM tool_traces
|
|
75
77
|
WHERE trace_id = ?
|
|
76
78
|
`)
|
|
@@ -89,11 +91,12 @@ async function appendToolTrace(input) {
|
|
|
89
91
|
.prepare(`
|
|
90
92
|
INSERT INTO tool_traces (
|
|
91
93
|
trace_id, model_run_id, gateway_call_id, tool_name, input_summary,
|
|
92
|
-
output_summary, execution_status, duration_ms, envelope_hash,
|
|
94
|
+
output_summary, execution_status, duration_ms, envelope_hash, failure_code,
|
|
95
|
+
created_at
|
|
93
96
|
)
|
|
94
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
97
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
95
98
|
`)
|
|
96
|
-
.run(id, modelRunId, nullableString(input.gateway_call_id), toolName, nullableString(input.input_summary), nullableString(input.output_summary), nullableString(input.execution_status), normalizeDuration(input.duration_ms), nullableString(input.envelope_hash), normalizeTimestamp(input.created_at));
|
|
99
|
+
.run(id, modelRunId, nullableString(input.gateway_call_id), toolName, nullableString(input.input_summary), nullableString(input.output_summary), nullableString(input.execution_status), normalizeDuration(input.duration_ms), nullableString(input.envelope_hash), nullableString(input.failure_code), normalizeTimestamp(input.created_at));
|
|
97
100
|
return selectToolTrace(adapter, id);
|
|
98
101
|
}
|
|
99
102
|
async function listToolTracesForRun(modelRunId) {
|
|
@@ -103,7 +106,8 @@ async function listToolTracesForRun(modelRunId) {
|
|
|
103
106
|
.prepare(`
|
|
104
107
|
SELECT
|
|
105
108
|
trace_id, model_run_id, gateway_call_id, tool_name, input_summary,
|
|
106
|
-
output_summary, execution_status, duration_ms, envelope_hash,
|
|
109
|
+
output_summary, execution_status, duration_ms, envelope_hash, failure_code,
|
|
110
|
+
created_at
|
|
107
111
|
FROM tool_traces
|
|
108
112
|
WHERE model_run_id = ?
|
|
109
113
|
ORDER BY created_at DESC, rowid DESC
|
|
@@ -52,6 +52,8 @@ export interface AppendToolTraceInput {
|
|
|
52
52
|
execution_status?: string | null;
|
|
53
53
|
duration_ms?: number | null;
|
|
54
54
|
envelope_hash?: string | null;
|
|
55
|
+
/** Thrower's closed cause (e.g. envelope_missing). Carried, never invented. */
|
|
56
|
+
failure_code?: string | null;
|
|
55
57
|
created_at?: number;
|
|
56
58
|
}
|
|
57
59
|
export interface ToolTraceRecord {
|
|
@@ -64,6 +66,7 @@ export interface ToolTraceRecord {
|
|
|
64
66
|
execution_status: string | null;
|
|
65
67
|
duration_ms: number;
|
|
66
68
|
envelope_hash: string | null;
|
|
69
|
+
failure_code: string | null;
|
|
67
70
|
created_at: number;
|
|
68
71
|
}
|
|
69
72
|
//# sourceMappingURL=types.d.ts.map
|