@axlsdk/studio 0.19.1 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -3
- package/dist/{chunk-AYUKXMYW.js → chunk-KQ3HBRTC.js} +86 -42
- package/dist/chunk-KQ3HBRTC.js.map +1 -0
- package/dist/cli.cjs +84 -40
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/client/assets/index-C8R_CZcW.css +1 -0
- package/dist/client/assets/index-Dq8QQtXe.js +313 -0
- package/dist/client/index.html +2 -2
- package/dist/middleware.cjs +84 -40
- package/dist/middleware.cjs.map +1 -1
- package/dist/middleware.js +1 -1
- package/dist/server/index.cjs +84 -40
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +14 -4
- package/dist/server/index.d.ts +14 -4
- package/dist/server/index.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-AYUKXMYW.js.map +0 -1
- package/dist/client/assets/index-7Nf4lAQm.js +0 -313
- package/dist/client/assets/index-CxBvTZU2.css +0 -1
package/dist/client/index.html
CHANGED
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
}
|
|
23
23
|
})();
|
|
24
24
|
</script>
|
|
25
|
-
<script type="module" crossorigin src="./assets/index-
|
|
26
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
25
|
+
<script type="module" crossorigin src="./assets/index-Dq8QQtXe.js"></script>
|
|
26
|
+
<link rel="stylesheet" crossorigin href="./assets/index-C8R_CZcW.css">
|
|
27
27
|
</head>
|
|
28
28
|
<body>
|
|
29
29
|
<div id="root"></div>
|
package/dist/middleware.cjs
CHANGED
|
@@ -55,8 +55,7 @@ var SAFE_ERROR_NAMES = /* @__PURE__ */ new Set([
|
|
|
55
55
|
"NoConsensus",
|
|
56
56
|
"TimeoutError",
|
|
57
57
|
"MaxTurnsError",
|
|
58
|
-
"BudgetExceededError"
|
|
59
|
-
"ToolDenied"
|
|
58
|
+
"BudgetExceededError"
|
|
60
59
|
]);
|
|
61
60
|
function redactErrorMessage(err, redact) {
|
|
62
61
|
const raw = err instanceof Error ? err.message : String(err);
|
|
@@ -124,7 +123,7 @@ function redactSessionHistory(history, redact) {
|
|
|
124
123
|
}
|
|
125
124
|
function redactStreamEvent(event, redact) {
|
|
126
125
|
if (!redact) return event;
|
|
127
|
-
return (0, import_axl.
|
|
126
|
+
return (0, import_axl.redactHistoricalEvent)(event);
|
|
128
127
|
}
|
|
129
128
|
function redactEvalItem(item) {
|
|
130
129
|
const scrubbed = {
|
|
@@ -187,31 +186,29 @@ function redactPendingDecisionList(decisions, redact) {
|
|
|
187
186
|
}
|
|
188
187
|
|
|
189
188
|
// src/server/middleware/error-handler.ts
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
status = 400;
|
|
206
|
-
}
|
|
207
|
-
const runtime = c.get("runtime");
|
|
208
|
-
const redactOn = runtime?.isRedactEnabled?.() ?? false;
|
|
209
|
-
const body = {
|
|
210
|
-
ok: false,
|
|
211
|
-
error: { code, message: redactErrorMessage(err, redactOn) }
|
|
212
|
-
};
|
|
213
|
-
return c.json(body, status);
|
|
189
|
+
function errorHandler(err, c) {
|
|
190
|
+
const rawMessage = err.message;
|
|
191
|
+
const code = err.code ?? "INTERNAL_ERROR";
|
|
192
|
+
let status = 500;
|
|
193
|
+
if ("status" in err) {
|
|
194
|
+
const errStatus = err.status;
|
|
195
|
+
if (typeof errStatus === "number" && errStatus >= 400 && errStatus < 600) {
|
|
196
|
+
status = errStatus;
|
|
197
|
+
}
|
|
198
|
+
} else if (code === "CROSS_PROCESS_RESUME_UNSUPPORTED") {
|
|
199
|
+
status = 409;
|
|
200
|
+
} else if (code === "NOT_FOUND" || code === "PENDING_DECISION_NOT_FOUND" || rawMessage.includes("not found") || rawMessage.includes("not registered")) {
|
|
201
|
+
status = 404;
|
|
202
|
+
} else if (code === "VALIDATION_ERROR" || code === "INVALID_HUMAN_DECISION" || rawMessage.includes("Expected") || rawMessage.includes("invalid")) {
|
|
203
|
+
status = 400;
|
|
214
204
|
}
|
|
205
|
+
const runtime = c.get("runtime");
|
|
206
|
+
const redactOn = runtime?.isRedactEnabled?.() ?? false;
|
|
207
|
+
const body = {
|
|
208
|
+
ok: false,
|
|
209
|
+
error: { code, message: redactErrorMessage(err, redactOn) }
|
|
210
|
+
};
|
|
211
|
+
return c.json(body, status);
|
|
215
212
|
}
|
|
216
213
|
|
|
217
214
|
// src/server/ws/connection-manager.ts
|
|
@@ -1127,19 +1124,58 @@ function reduceTraceStats(acc, event) {
|
|
|
1127
1124
|
const eventTypeCounts = { ...acc.eventTypeCounts };
|
|
1128
1125
|
eventTypeCounts[event.type] = (eventTypeCounts[event.type] ?? 0) + 1;
|
|
1129
1126
|
const byTool = { ...acc.byTool };
|
|
1130
|
-
if (event.type === "tool_call_end" || event.type === "tool_denied" || event.type === "tool_approval") {
|
|
1127
|
+
if (event.type === "tool_call_start" || event.type === "tool_call_end" || event.type === "tool_call_rejected" || event.type === "tool_denied" || event.type === "tool_approval") {
|
|
1131
1128
|
const toolName = event.tool;
|
|
1132
|
-
const prev = byTool[toolName] ?? {
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1129
|
+
const prev = byTool[toolName] ?? {
|
|
1130
|
+
accepted: 0,
|
|
1131
|
+
succeeded: 0,
|
|
1132
|
+
failed: 0,
|
|
1133
|
+
failedByPhase: {},
|
|
1134
|
+
denied: 0,
|
|
1135
|
+
cancelled: 0,
|
|
1136
|
+
rejected: 0,
|
|
1137
|
+
approved: 0,
|
|
1138
|
+
legacy: { calls: 0, denied: 0, approved: 0 }
|
|
1139
|
+
};
|
|
1140
|
+
const next = {
|
|
1141
|
+
...prev,
|
|
1142
|
+
failedByPhase: { ...prev.failedByPhase },
|
|
1143
|
+
legacy: { ...prev.legacy }
|
|
1142
1144
|
};
|
|
1145
|
+
if (event.schemaVersion === 2) {
|
|
1146
|
+
if (event.type === "tool_call_start") next.accepted++;
|
|
1147
|
+
if (event.type === "tool_call_rejected") next.rejected++;
|
|
1148
|
+
if (event.type === "tool_approval" && event.data?.approved) next.approved++;
|
|
1149
|
+
if (event.type === "tool_call_end") {
|
|
1150
|
+
switch (event.data.outcome.status) {
|
|
1151
|
+
case "succeeded":
|
|
1152
|
+
next.succeeded++;
|
|
1153
|
+
break;
|
|
1154
|
+
case "failed": {
|
|
1155
|
+
next.failed++;
|
|
1156
|
+
const phase = event.data.outcome.failure.phase;
|
|
1157
|
+
next.failedByPhase[phase] = (next.failedByPhase[phase] ?? 0) + 1;
|
|
1158
|
+
break;
|
|
1159
|
+
}
|
|
1160
|
+
case "denied":
|
|
1161
|
+
next.denied++;
|
|
1162
|
+
break;
|
|
1163
|
+
case "cancelled":
|
|
1164
|
+
next.cancelled++;
|
|
1165
|
+
break;
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
} else if (event.type === "tool_call_end") {
|
|
1169
|
+
next.legacy.calls++;
|
|
1170
|
+
} else if (event.type === "tool_denied") {
|
|
1171
|
+
const approved = event.data?.approved === true;
|
|
1172
|
+
if (approved) next.legacy.approved++;
|
|
1173
|
+
else next.legacy.denied++;
|
|
1174
|
+
} else if (event.type === "tool_approval") {
|
|
1175
|
+
if (event.data?.approved === true) next.legacy.approved++;
|
|
1176
|
+
else if (event.data?.approved === false) next.legacy.denied++;
|
|
1177
|
+
}
|
|
1178
|
+
byTool[toolName] = next;
|
|
1143
1179
|
}
|
|
1144
1180
|
const retryByAgent = { ...acc.retryByAgent };
|
|
1145
1181
|
if (event.agent && event.type === "agent_call_end") {
|
|
@@ -1619,7 +1655,14 @@ app4.get("/decisions", async (c) => {
|
|
|
1619
1655
|
app4.post("/decisions/:executionId/resolve", async (c) => {
|
|
1620
1656
|
const runtime = c.get("runtime");
|
|
1621
1657
|
const executionId = c.req.param("executionId");
|
|
1622
|
-
|
|
1658
|
+
let body;
|
|
1659
|
+
try {
|
|
1660
|
+
body = await c.req.json();
|
|
1661
|
+
} catch {
|
|
1662
|
+
const error48 = new Error("Invalid JSON request body");
|
|
1663
|
+
Object.assign(error48, { code: "INVALID_HUMAN_DECISION", status: 400 });
|
|
1664
|
+
throw error48;
|
|
1665
|
+
}
|
|
1623
1666
|
await runtime.resolveDecision(executionId, body);
|
|
1624
1667
|
return c.json({ ok: true, data: { resolved: true } });
|
|
1625
1668
|
});
|
|
@@ -15959,6 +16002,7 @@ function createPlaygroundRoutes(connMgr) {
|
|
|
15959
16002
|
(async () => {
|
|
15960
16003
|
let stepCounter = Number.MAX_SAFE_INTEGER - 1;
|
|
15961
16004
|
const terminalFields = () => ({
|
|
16005
|
+
schemaVersion: 2,
|
|
15962
16006
|
executionId,
|
|
15963
16007
|
step: stepCounter++,
|
|
15964
16008
|
timestamp: Date.now()
|
|
@@ -16075,7 +16119,7 @@ function createServer(options) {
|
|
|
16075
16119
|
if (options.cors !== false) {
|
|
16076
16120
|
app5.use("*", (0, import_cors.cors)());
|
|
16077
16121
|
}
|
|
16078
|
-
app5.
|
|
16122
|
+
app5.onError(errorHandler);
|
|
16079
16123
|
app5.use("*", async (c, next) => {
|
|
16080
16124
|
c.set("runtime", runtime);
|
|
16081
16125
|
await next();
|