@axlsdk/axl 0.8.0 → 0.9.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 +3 -1
- package/dist/index.cjs +12 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -10
- package/dist/index.d.ts +14 -10
- package/dist/index.js +13 -44
- package/dist/index.js.map +1 -1
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -7,9 +7,11 @@ Core SDK for orchestrating agentic systems in TypeScript. Part of the [Axl](http
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install @axlsdk/axl zod
|
|
10
|
+
npm install @axlsdk/axl zod@^4
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
> **Note:** `zod` is a peer dependency — your application and Axl share a single Zod instance. Zod v4 (`^4.0.0`) is required.
|
|
14
|
+
|
|
13
15
|
## Project Structure
|
|
14
16
|
|
|
15
17
|
The recommended pattern separates config, tools, agents, workflows, and runtime into their own modules. Dependencies flow one direction: tools → agents → workflows → runtime.
|
package/dist/index.cjs
CHANGED
|
@@ -2248,48 +2248,9 @@ function resolveConfig(config) {
|
|
|
2248
2248
|
// src/context.ts
|
|
2249
2249
|
var signalStorage = new import_node_async_hooks.AsyncLocalStorage();
|
|
2250
2250
|
function zodToJsonSchema(schema) {
|
|
2251
|
-
const
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
case "ZodString":
|
|
2255
|
-
return { type: "string" };
|
|
2256
|
-
case "ZodNumber":
|
|
2257
|
-
return { type: "number" };
|
|
2258
|
-
case "ZodBoolean":
|
|
2259
|
-
return { type: "boolean" };
|
|
2260
|
-
case "ZodArray":
|
|
2261
|
-
return { type: "array", items: zodToJsonSchema(def.type) };
|
|
2262
|
-
case "ZodObject": {
|
|
2263
|
-
const shape = def.shape?.() ?? {};
|
|
2264
|
-
const properties = {};
|
|
2265
|
-
const required = [];
|
|
2266
|
-
for (const [key, value] of Object.entries(shape)) {
|
|
2267
|
-
properties[key] = zodToJsonSchema(value);
|
|
2268
|
-
const innerDef = value._def;
|
|
2269
|
-
if (innerDef?.typeName !== "ZodOptional" && innerDef?.typeName !== "ZodDefault") {
|
|
2270
|
-
required.push(key);
|
|
2271
|
-
}
|
|
2272
|
-
}
|
|
2273
|
-
return { type: "object", properties, required: required.length > 0 ? required : void 0 };
|
|
2274
|
-
}
|
|
2275
|
-
case "ZodOptional":
|
|
2276
|
-
return zodToJsonSchema(def.innerType);
|
|
2277
|
-
case "ZodDefault":
|
|
2278
|
-
return zodToJsonSchema(def.innerType);
|
|
2279
|
-
case "ZodEnum":
|
|
2280
|
-
return { type: "string", enum: def.values };
|
|
2281
|
-
case "ZodLiteral": {
|
|
2282
|
-
const v = def.value;
|
|
2283
|
-
const t = v === null ? "null" : typeof v;
|
|
2284
|
-
return { type: t, const: v };
|
|
2285
|
-
}
|
|
2286
|
-
case "ZodUnion":
|
|
2287
|
-
return { oneOf: def.options.map((o) => zodToJsonSchema(o)) };
|
|
2288
|
-
case "ZodNullable":
|
|
2289
|
-
return { ...zodToJsonSchema(def.innerType), nullable: true };
|
|
2290
|
-
default:
|
|
2291
|
-
return {};
|
|
2292
|
-
}
|
|
2251
|
+
const result = import_zod.z.toJSONSchema(schema, { unrepresentable: "any" });
|
|
2252
|
+
delete result.$schema;
|
|
2253
|
+
return result;
|
|
2293
2254
|
}
|
|
2294
2255
|
function estimateTokens(text) {
|
|
2295
2256
|
return Math.ceil(text.length / 4);
|
|
@@ -3530,7 +3491,7 @@ ${summaryResponse.content}`
|
|
|
3530
3491
|
if (err instanceof ValidationError) {
|
|
3531
3492
|
lastRetry = {
|
|
3532
3493
|
error: err.reason,
|
|
3533
|
-
output: rawOutput,
|
|
3494
|
+
output: rawOutput ?? err.lastOutput,
|
|
3534
3495
|
parsed: err.lastOutput
|
|
3535
3496
|
};
|
|
3536
3497
|
if (attempt === maxRetries) {
|
|
@@ -3539,6 +3500,14 @@ ${summaryResponse.content}`
|
|
|
3539
3500
|
}
|
|
3540
3501
|
continue;
|
|
3541
3502
|
}
|
|
3503
|
+
if (err instanceof VerifyError) {
|
|
3504
|
+
lastRetry = { error: err.message, output: rawOutput ?? err.lastOutput };
|
|
3505
|
+
if (attempt === maxRetries) {
|
|
3506
|
+
if (options?.fallback !== void 0) return options.fallback;
|
|
3507
|
+
throw err;
|
|
3508
|
+
}
|
|
3509
|
+
continue;
|
|
3510
|
+
}
|
|
3542
3511
|
const errorMsg = err instanceof import_zod.ZodError ? err.message : err instanceof Error ? err.message : String(err);
|
|
3543
3512
|
lastRetry = { error: errorMsg, output: rawOutput };
|
|
3544
3513
|
if (attempt === maxRetries) {
|