@runtypelabs/cli 2.35.7 → 2.36.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/dist/index.js +378 -182
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
|
|
5
|
-
get: (a,
|
|
5
|
+
get: (a, b2) => (typeof require !== "undefined" ? require : a)[b2]
|
|
6
6
|
}) : x2)(function(x2) {
|
|
7
7
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
8
8
|
throw Error('Dynamic require of "' + x2 + '" is not supported');
|
|
@@ -1395,8 +1395,8 @@ var allowsEval = /* @__PURE__ */ cached(() => {
|
|
|
1395
1395
|
return false;
|
|
1396
1396
|
}
|
|
1397
1397
|
try {
|
|
1398
|
-
const
|
|
1399
|
-
new
|
|
1398
|
+
const F = Function;
|
|
1399
|
+
new F("");
|
|
1400
1400
|
return true;
|
|
1401
1401
|
} catch (_2) {
|
|
1402
1402
|
return false;
|
|
@@ -1658,8 +1658,8 @@ function safeExtend(schema, shape) {
|
|
|
1658
1658
|
});
|
|
1659
1659
|
return clone(schema, def);
|
|
1660
1660
|
}
|
|
1661
|
-
function merge(a,
|
|
1662
|
-
if (!
|
|
1661
|
+
function merge(a, b2) {
|
|
1662
|
+
if (!b2?._zod?.def) {
|
|
1663
1663
|
throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
|
|
1664
1664
|
}
|
|
1665
1665
|
if (a._zod.def.checks?.length) {
|
|
@@ -1667,14 +1667,14 @@ function merge(a, b) {
|
|
|
1667
1667
|
}
|
|
1668
1668
|
const def = mergeDefs(a._zod.def, {
|
|
1669
1669
|
get shape() {
|
|
1670
|
-
const _shape = { ...a._zod.def.shape, ...
|
|
1670
|
+
const _shape = { ...a._zod.def.shape, ...b2._zod.def.shape };
|
|
1671
1671
|
assignProp(this, "shape", _shape);
|
|
1672
1672
|
return _shape;
|
|
1673
1673
|
},
|
|
1674
1674
|
get catchall() {
|
|
1675
|
-
return
|
|
1675
|
+
return b2._zod.def.catchall;
|
|
1676
1676
|
},
|
|
1677
|
-
checks:
|
|
1677
|
+
checks: b2._zod.def.checks ?? []
|
|
1678
1678
|
});
|
|
1679
1679
|
return clone(a, def);
|
|
1680
1680
|
}
|
|
@@ -1906,7 +1906,7 @@ function hexToUint8Array(hex3) {
|
|
|
1906
1906
|
return bytes;
|
|
1907
1907
|
}
|
|
1908
1908
|
function uint8ArrayToHex(bytes) {
|
|
1909
|
-
return Array.from(bytes).map((
|
|
1909
|
+
return Array.from(bytes).map((b2) => b2.toString(16).padStart(2, "0")).join("");
|
|
1910
1910
|
}
|
|
1911
1911
|
var Class = class {
|
|
1912
1912
|
constructor(..._args) {
|
|
@@ -2319,7 +2319,7 @@ function toDotPath(_path) {
|
|
|
2319
2319
|
}
|
|
2320
2320
|
function prettifyError(error61) {
|
|
2321
2321
|
const lines = [];
|
|
2322
|
-
const issues = [...error61.issues].sort((a,
|
|
2322
|
+
const issues = [...error61.issues].sort((a, b2) => (a.path ?? []).length - (b2.path ?? []).length);
|
|
2323
2323
|
for (const issue2 of issues) {
|
|
2324
2324
|
lines.push(`\u2716 ${issue2.message}`);
|
|
2325
2325
|
if (issue2.path?.length)
|
|
@@ -3209,9 +3209,9 @@ var Doc = class {
|
|
|
3209
3209
|
}
|
|
3210
3210
|
}
|
|
3211
3211
|
compile() {
|
|
3212
|
-
const
|
|
3212
|
+
const F = Function;
|
|
3213
3213
|
const content = this?.content ?? [``];
|
|
3214
|
-
const factory = new
|
|
3214
|
+
const factory = new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {
|
|
3215
3215
|
${content.join("\n")}
|
|
3216
3216
|
};`);
|
|
3217
3217
|
return factory(...Object.values(this.closed));
|
|
@@ -4482,23 +4482,23 @@ var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, d
|
|
|
4482
4482
|
return handleIntersectionResults(payload, left, right);
|
|
4483
4483
|
};
|
|
4484
4484
|
});
|
|
4485
|
-
function mergeValues(a,
|
|
4486
|
-
if (a ===
|
|
4485
|
+
function mergeValues(a, b2) {
|
|
4486
|
+
if (a === b2) {
|
|
4487
4487
|
return { valid: true, data: a };
|
|
4488
4488
|
}
|
|
4489
|
-
if (a instanceof Date &&
|
|
4489
|
+
if (a instanceof Date && b2 instanceof Date && +a === +b2) {
|
|
4490
4490
|
return { valid: true, data: a };
|
|
4491
4491
|
}
|
|
4492
|
-
if (isPlainObject(a) && isPlainObject(
|
|
4493
|
-
const bKeys = Object.keys(
|
|
4492
|
+
if (isPlainObject(a) && isPlainObject(b2)) {
|
|
4493
|
+
const bKeys = Object.keys(b2);
|
|
4494
4494
|
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
4495
|
-
const newObj = { ...a, ...
|
|
4495
|
+
const newObj = { ...a, ...b2 };
|
|
4496
4496
|
if (Object.prototype.hasOwnProperty.call(newObj, "__proto__"))
|
|
4497
4497
|
delete newObj.__proto__;
|
|
4498
4498
|
for (const key of sharedKeys) {
|
|
4499
4499
|
if (key === "__proto__")
|
|
4500
4500
|
continue;
|
|
4501
|
-
const sharedValue = mergeValues(a[key],
|
|
4501
|
+
const sharedValue = mergeValues(a[key], b2[key]);
|
|
4502
4502
|
if (!sharedValue.valid) {
|
|
4503
4503
|
return {
|
|
4504
4504
|
valid: false,
|
|
@@ -4509,14 +4509,14 @@ function mergeValues(a, b) {
|
|
|
4509
4509
|
}
|
|
4510
4510
|
return { valid: true, data: newObj };
|
|
4511
4511
|
}
|
|
4512
|
-
if (Array.isArray(a) && Array.isArray(
|
|
4513
|
-
if (a.length !==
|
|
4512
|
+
if (Array.isArray(a) && Array.isArray(b2)) {
|
|
4513
|
+
if (a.length !== b2.length) {
|
|
4514
4514
|
return { valid: false, mergeErrorPath: [] };
|
|
4515
4515
|
}
|
|
4516
4516
|
const newArray = [];
|
|
4517
4517
|
for (let index = 0; index < a.length; index++) {
|
|
4518
4518
|
const itemA = a[index];
|
|
4519
|
-
const itemB =
|
|
4519
|
+
const itemB = b2[index];
|
|
4520
4520
|
const sharedValue = mergeValues(itemA, itemB);
|
|
4521
4521
|
if (!sharedValue.valid) {
|
|
4522
4522
|
return {
|
|
@@ -5404,9 +5404,9 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
|
|
|
5404
5404
|
return payload;
|
|
5405
5405
|
};
|
|
5406
5406
|
inst.input = (...args) => {
|
|
5407
|
-
const
|
|
5407
|
+
const F = inst.constructor;
|
|
5408
5408
|
if (Array.isArray(args[0])) {
|
|
5409
|
-
return new
|
|
5409
|
+
return new F({
|
|
5410
5410
|
type: "function",
|
|
5411
5411
|
input: new $ZodTuple({
|
|
5412
5412
|
type: "tuple",
|
|
@@ -5416,15 +5416,15 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
|
|
|
5416
5416
|
output: inst._def.output
|
|
5417
5417
|
});
|
|
5418
5418
|
}
|
|
5419
|
-
return new
|
|
5419
|
+
return new F({
|
|
5420
5420
|
type: "function",
|
|
5421
5421
|
input: args[0],
|
|
5422
5422
|
output: inst._def.output
|
|
5423
5423
|
});
|
|
5424
5424
|
};
|
|
5425
5425
|
inst.output = (output2) => {
|
|
5426
|
-
const
|
|
5427
|
-
return new
|
|
5426
|
+
const F = inst.constructor;
|
|
5427
|
+
return new F({
|
|
5428
5428
|
type: "function",
|
|
5429
5429
|
input: inst._def.input,
|
|
5430
5430
|
output: output2
|
|
@@ -13136,13 +13136,13 @@ function compileFn(schema, options) {
|
|
|
13136
13136
|
const code = doc.content.join("\n");
|
|
13137
13137
|
const fullCode = options?.debug ? constantNames.length > 0 ? `// Constants: ${constantNames.join(", ")}
|
|
13138
13138
|
${code}` : code : "";
|
|
13139
|
-
const
|
|
13139
|
+
const F = Function;
|
|
13140
13140
|
const factoryCode = `return (input) => {
|
|
13141
13141
|
${code}
|
|
13142
13142
|
}`;
|
|
13143
13143
|
let fn;
|
|
13144
13144
|
try {
|
|
13145
|
-
const factory = new
|
|
13145
|
+
const factory = new F(...constantNames, factoryCode);
|
|
13146
13146
|
fn = factory(...constantValues);
|
|
13147
13147
|
} catch (err) {
|
|
13148
13148
|
throw new ZodCompileUnsupportedError(`this schema (generated code failed to evaluate: ${err.message})`);
|
|
@@ -15927,7 +15927,7 @@ function foldIntersection(json2) {
|
|
|
15927
15927
|
return;
|
|
15928
15928
|
const rest = allOf.filter((m2) => m2 !== union2);
|
|
15929
15929
|
const branches = union2[keyword].map((branch) => foldObjects([...rest, branch]));
|
|
15930
|
-
if (branches.some((
|
|
15930
|
+
if (branches.some((b2) => !b2))
|
|
15931
15931
|
return;
|
|
15932
15932
|
folded = { [keyword]: branches };
|
|
15933
15933
|
}
|
|
@@ -16460,14 +16460,14 @@ var intersectionProcessor = (schema, ctx, json2, params) => {
|
|
|
16460
16460
|
...params,
|
|
16461
16461
|
path: [...params.path, "allOf", 0]
|
|
16462
16462
|
});
|
|
16463
|
-
const
|
|
16463
|
+
const b2 = process2(def.right, ctx, {
|
|
16464
16464
|
...params,
|
|
16465
16465
|
path: [...params.path, "allOf", 1]
|
|
16466
16466
|
});
|
|
16467
16467
|
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
16468
16468
|
const allOf = [
|
|
16469
16469
|
...isSimpleIntersection(a) ? a.allOf : [a],
|
|
16470
|
-
...isSimpleIntersection(
|
|
16470
|
+
...isSimpleIntersection(b2) ? b2.allOf : [b2]
|
|
16471
16471
|
];
|
|
16472
16472
|
json2.allOf = allOf;
|
|
16473
16473
|
ctx.intersections.push(allOf);
|
|
@@ -19436,12 +19436,19 @@ var CANONICAL_LOG_COLUMN_SET = {
|
|
|
19436
19436
|
};
|
|
19437
19437
|
var CANONICAL_LOG_COLUMNS = Object.keys(CANONICAL_LOG_COLUMN_SET);
|
|
19438
19438
|
|
|
19439
|
-
// ../shared/dist/chunk-
|
|
19439
|
+
// ../shared/dist/chunk-NQDOLEMM.mjs
|
|
19440
19440
|
var MODEL_FAMILY_PROVIDER_IDS = {
|
|
19441
19441
|
"claude-fable-5": {
|
|
19442
19442
|
"anthropic": "claude-fable-5",
|
|
19443
19443
|
"vercel": "anthropic/claude-fable-5"
|
|
19444
19444
|
},
|
|
19445
|
+
"claude-fable-5-1": {
|
|
19446
|
+
"anthropic": "claude-fable-5-1",
|
|
19447
|
+
"vercel": "anthropic/claude-fable-5.1"
|
|
19448
|
+
},
|
|
19449
|
+
"claude-fable-5.1": {
|
|
19450
|
+
"vercel": "anthropic/claude-fable-5.1"
|
|
19451
|
+
},
|
|
19445
19452
|
"claude-haiku-4-5": {
|
|
19446
19453
|
"anthropic": "claude-haiku-4-5-20251001",
|
|
19447
19454
|
"vercel": "anthropic/claude-haiku-4.5"
|
|
@@ -19635,6 +19642,10 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
19635
19642
|
"google": "gemini-3.7-flash",
|
|
19636
19643
|
"vercel": "google/gemini-3.7-flash"
|
|
19637
19644
|
},
|
|
19645
|
+
"gemini-3-8-flash": {
|
|
19646
|
+
"google": "gemini-3.8-flash",
|
|
19647
|
+
"vercel": "google/gemini-3.8-flash"
|
|
19648
|
+
},
|
|
19638
19649
|
"gemini-3-flash": {
|
|
19639
19650
|
"google": "gemini-3-flash-preview"
|
|
19640
19651
|
},
|
|
@@ -19686,6 +19697,10 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
19686
19697
|
"google": "gemini-3.7-flash",
|
|
19687
19698
|
"vercel": "google/gemini-3.7-flash"
|
|
19688
19699
|
},
|
|
19700
|
+
"gemini-3.8-flash": {
|
|
19701
|
+
"google": "gemini-3.8-flash",
|
|
19702
|
+
"vercel": "google/gemini-3.8-flash"
|
|
19703
|
+
},
|
|
19689
19704
|
"gemini-embedding-001": {
|
|
19690
19705
|
"google": "gemini-embedding-001"
|
|
19691
19706
|
},
|
|
@@ -19698,12 +19713,6 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
19698
19713
|
"gemini-omni-flash-preview": {
|
|
19699
19714
|
"vercel": "google/gemini-omni-flash-preview"
|
|
19700
19715
|
},
|
|
19701
|
-
"gemini-robotics-er-1-6": {
|
|
19702
|
-
"google": "gemini-robotics-er-1.6-preview"
|
|
19703
|
-
},
|
|
19704
|
-
"gemini-robotics-er-1.6-preview": {
|
|
19705
|
-
"google": "gemini-robotics-er-1.6-preview"
|
|
19706
|
-
},
|
|
19707
19716
|
"gemma-4-26b-a4b-it": {
|
|
19708
19717
|
"google": "gemma-4-26b-a4b-it",
|
|
19709
19718
|
"vercel": "google/gemma-4-26b-a4b-it"
|
|
@@ -20241,12 +20250,18 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
20241
20250
|
"mimo-v2-5-pro": {
|
|
20242
20251
|
"vercel": "xiaomi/mimo-v2.5-pro"
|
|
20243
20252
|
},
|
|
20253
|
+
"mimo-v2-5-pro-ultraspeed": {
|
|
20254
|
+
"vercel": "xiaomi/mimo-v2.5-pro-ultraspeed"
|
|
20255
|
+
},
|
|
20244
20256
|
"mimo-v2.5": {
|
|
20245
20257
|
"vercel": "xiaomi/mimo-v2.5"
|
|
20246
20258
|
},
|
|
20247
20259
|
"mimo-v2.5-pro": {
|
|
20248
20260
|
"vercel": "xiaomi/mimo-v2.5-pro"
|
|
20249
20261
|
},
|
|
20262
|
+
"mimo-v2.5-pro-ultraspeed": {
|
|
20263
|
+
"vercel": "xiaomi/mimo-v2.5-pro-ultraspeed"
|
|
20264
|
+
},
|
|
20250
20265
|
"minimax-m2-7": {
|
|
20251
20266
|
"vercel": "minimax/minimax-m2.7"
|
|
20252
20267
|
},
|
|
@@ -20410,7 +20425,6 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
20410
20425
|
"vercel": "alibaba/qwen3.5-plus"
|
|
20411
20426
|
},
|
|
20412
20427
|
"qwen3-6-27b": {
|
|
20413
|
-
"mixlayer": "qwen/qwen3.6-27b",
|
|
20414
20428
|
"vercel": "alibaba/qwen3.6-27b"
|
|
20415
20429
|
},
|
|
20416
20430
|
"qwen3-6-35b-a3b": {
|
|
@@ -20432,14 +20446,21 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
20432
20446
|
"vercel": "alibaba/qwen3.8-2.4t-a95b"
|
|
20433
20447
|
},
|
|
20434
20448
|
"qwen3-8-27b": {
|
|
20449
|
+
"mixlayer": "qwen/qwen3.8-27b",
|
|
20435
20450
|
"vercel": "alibaba/qwen3.8-27b"
|
|
20436
20451
|
},
|
|
20437
20452
|
"qwen3-8-flash": {
|
|
20438
20453
|
"vercel": "alibaba/qwen3.8-flash"
|
|
20439
20454
|
},
|
|
20455
|
+
"qwen3-8-flash-next": {
|
|
20456
|
+
"vercel": "alibaba/qwen3.8-flash-next"
|
|
20457
|
+
},
|
|
20440
20458
|
"qwen3-8-max": {
|
|
20441
20459
|
"vercel": "alibaba/qwen3.8-max"
|
|
20442
20460
|
},
|
|
20461
|
+
"qwen3-8-max-0902": {
|
|
20462
|
+
"vercel": "alibaba/qwen3.8-max-0902"
|
|
20463
|
+
},
|
|
20443
20464
|
"qwen3-coder": {
|
|
20444
20465
|
"vercel": "alibaba/qwen3-coder"
|
|
20445
20466
|
},
|
|
@@ -20504,7 +20525,6 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
20504
20525
|
"vercel": "alibaba/qwen3.5-plus"
|
|
20505
20526
|
},
|
|
20506
20527
|
"qwen3.6-27b": {
|
|
20507
|
-
"mixlayer": "qwen/qwen3.6-27b",
|
|
20508
20528
|
"vercel": "alibaba/qwen3.6-27b"
|
|
20509
20529
|
},
|
|
20510
20530
|
"qwen3.6-35b-a3b": {
|
|
@@ -20526,14 +20546,21 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
20526
20546
|
"vercel": "alibaba/qwen3.8-2.4t-a95b"
|
|
20527
20547
|
},
|
|
20528
20548
|
"qwen3.8-27b": {
|
|
20549
|
+
"mixlayer": "qwen/qwen3.8-27b",
|
|
20529
20550
|
"vercel": "alibaba/qwen3.8-27b"
|
|
20530
20551
|
},
|
|
20531
20552
|
"qwen3.8-flash": {
|
|
20532
20553
|
"vercel": "alibaba/qwen3.8-flash"
|
|
20533
20554
|
},
|
|
20555
|
+
"qwen3.8-flash-next": {
|
|
20556
|
+
"vercel": "alibaba/qwen3.8-flash-next"
|
|
20557
|
+
},
|
|
20534
20558
|
"qwen3.8-max": {
|
|
20535
20559
|
"vercel": "alibaba/qwen3.8-max"
|
|
20536
20560
|
},
|
|
20561
|
+
"qwen3.8-max-0902": {
|
|
20562
|
+
"vercel": "alibaba/qwen3.8-max-0902"
|
|
20563
|
+
},
|
|
20537
20564
|
"rerank-v3-5": {
|
|
20538
20565
|
"vercel": "cohere/rerank-v3.5"
|
|
20539
20566
|
},
|
|
@@ -20639,6 +20666,14 @@ var DEEPSEEK_V4_FLASH_IDS = [
|
|
|
20639
20666
|
"deepseek/deepseek-v4-flash-0731"
|
|
20640
20667
|
];
|
|
20641
20668
|
var GLM_5_3_FLASH_IDS = ["glm-5.3-flash", "glm-5-3-flash", "zai/glm-5.3-flash"];
|
|
20669
|
+
var QWEN_3_8_27B_IDS = ["qwen3.8-27b", "qwen3-8-27b"];
|
|
20670
|
+
function mixlayerPrimary(ids) {
|
|
20671
|
+
const config3 = {
|
|
20672
|
+
providers: [{ provider: "mixlayer", weight: 100 }],
|
|
20673
|
+
fallback: ["vercel"]
|
|
20674
|
+
};
|
|
20675
|
+
return Object.fromEntries(ids.map((id) => [id, config3]));
|
|
20676
|
+
}
|
|
20642
20677
|
var PROVIDER_ROUTING_CONFIG = {
|
|
20643
20678
|
"claude-sonnet-4-5": {
|
|
20644
20679
|
providers: [
|
|
@@ -20866,7 +20901,8 @@ var PROVIDER_ROUTING_CONFIG = {
|
|
|
20866
20901
|
},
|
|
20867
20902
|
// WHY(docs/why/packages/shared/src.md#deepseek-v4-flash-mirrors-v4-pro-each-slash-form): DeepSeek V4 Flash mirrors V4 Pro: each slash form needs its own explicit Vercel fallback entry to escape the
|
|
20868
20903
|
...workersAiPrimary(DEEPSEEK_V4_FLASH_IDS),
|
|
20869
|
-
// WHY(
|
|
20904
|
+
// WHY(packages/shared/src/provider-routing.ts): Qwen 3.8 27B routes through Mixlayer because its 262K context is below Vercel's 1M.
|
|
20905
|
+
...mixlayerPrimary(QWEN_3_8_27B_IDS),
|
|
20870
20906
|
// WHY(docs/why/packages/shared/src.md#vercel-renamed-its-xai-gateway-namespace-xai-to): Vercel renamed its xAI gateway namespace xai/ to spacexai/ on 2026-08-22; this hand-maintained table isn't
|
|
20871
20907
|
...workersAiPrimary(GLM_5_3_FLASH_IDS),
|
|
20872
20908
|
"minimax-m2.7": {
|
|
@@ -21293,7 +21329,7 @@ var BuiltInToolIdPrefix = {
|
|
|
21293
21329
|
PLATFORM: "platform"
|
|
21294
21330
|
};
|
|
21295
21331
|
|
|
21296
|
-
// ../shared/dist/chunk-
|
|
21332
|
+
// ../shared/dist/chunk-UPJ4KSD4.mjs
|
|
21297
21333
|
function sanitizeToolNameForAiSdk(name) {
|
|
21298
21334
|
return name.replace(/[^a-zA-Z0-9_]/g, "_").toLowerCase().replace(/_+/g, "_").replace(/^_|_$/g, "");
|
|
21299
21335
|
}
|
|
@@ -21654,7 +21690,7 @@ var recordCollectionSchemaSchema = external_exports.strictObject({
|
|
|
21654
21690
|
additionalProperties: external_exports.boolean().optional()
|
|
21655
21691
|
}).superRefine((schema, ctx) => addSemanticIssues(schema, ctx));
|
|
21656
21692
|
|
|
21657
|
-
// ../shared/dist/chunk-
|
|
21693
|
+
// ../shared/dist/chunk-44VM7STG.mjs
|
|
21658
21694
|
var MCPServerCategory = {
|
|
21659
21695
|
COMMUNICATION: "communication",
|
|
21660
21696
|
PRODUCTIVITY: "productivity",
|
|
@@ -23531,6 +23567,50 @@ var GITHUB_INTEGRATION = {
|
|
|
23531
23567
|
required: ["owner", "repo", "pull_number"]
|
|
23532
23568
|
}
|
|
23533
23569
|
},
|
|
23570
|
+
{
|
|
23571
|
+
name: "list_pull_request_files",
|
|
23572
|
+
description: "List all files changed by a pull request, including GitHub patch data (up to 3,000 files)",
|
|
23573
|
+
parametersSchema: {
|
|
23574
|
+
type: "object",
|
|
23575
|
+
properties: {
|
|
23576
|
+
owner: {
|
|
23577
|
+
type: "string",
|
|
23578
|
+
description: "Repository owner"
|
|
23579
|
+
},
|
|
23580
|
+
repo: {
|
|
23581
|
+
type: "string",
|
|
23582
|
+
description: "Repository name"
|
|
23583
|
+
},
|
|
23584
|
+
pull_number: {
|
|
23585
|
+
type: "number",
|
|
23586
|
+
description: "Pull request number"
|
|
23587
|
+
}
|
|
23588
|
+
},
|
|
23589
|
+
required: ["owner", "repo", "pull_number"]
|
|
23590
|
+
}
|
|
23591
|
+
},
|
|
23592
|
+
{
|
|
23593
|
+
name: "list_issue_comments",
|
|
23594
|
+
description: "List all comments on an issue or pull request; fails instead of returning an incomplete list above 3,000 comments",
|
|
23595
|
+
parametersSchema: {
|
|
23596
|
+
type: "object",
|
|
23597
|
+
properties: {
|
|
23598
|
+
owner: {
|
|
23599
|
+
type: "string",
|
|
23600
|
+
description: "Repository owner"
|
|
23601
|
+
},
|
|
23602
|
+
repo: {
|
|
23603
|
+
type: "string",
|
|
23604
|
+
description: "Repository name"
|
|
23605
|
+
},
|
|
23606
|
+
issue_number: {
|
|
23607
|
+
type: "number",
|
|
23608
|
+
description: "Issue or pull request number"
|
|
23609
|
+
}
|
|
23610
|
+
},
|
|
23611
|
+
required: ["owner", "repo", "issue_number"]
|
|
23612
|
+
}
|
|
23613
|
+
},
|
|
23534
23614
|
{
|
|
23535
23615
|
name: "create_pr_comment",
|
|
23536
23616
|
description: "Add a comment to a pull request",
|
|
@@ -23635,6 +23715,58 @@ var GITHUB_INTEGRATION = {
|
|
|
23635
23715
|
required: ["owner", "repo"]
|
|
23636
23716
|
}
|
|
23637
23717
|
},
|
|
23718
|
+
{
|
|
23719
|
+
name: "create_branch",
|
|
23720
|
+
description: "Create a branch at a commit SHA. Repeating the same request succeeds without creating a duplicate branch.",
|
|
23721
|
+
parametersSchema: {
|
|
23722
|
+
type: "object",
|
|
23723
|
+
properties: {
|
|
23724
|
+
owner: {
|
|
23725
|
+
type: "string",
|
|
23726
|
+
description: "Repository owner"
|
|
23727
|
+
},
|
|
23728
|
+
repo: {
|
|
23729
|
+
type: "string",
|
|
23730
|
+
description: "Repository name"
|
|
23731
|
+
},
|
|
23732
|
+
branch: {
|
|
23733
|
+
type: "string",
|
|
23734
|
+
description: "Branch name to create"
|
|
23735
|
+
},
|
|
23736
|
+
sha: {
|
|
23737
|
+
type: "string",
|
|
23738
|
+
description: "Commit SHA where the branch starts"
|
|
23739
|
+
}
|
|
23740
|
+
},
|
|
23741
|
+
required: ["owner", "repo", "branch", "sha"]
|
|
23742
|
+
}
|
|
23743
|
+
},
|
|
23744
|
+
{
|
|
23745
|
+
name: "compare_commits",
|
|
23746
|
+
description: "Compare a base commit or branch with a head commit or branch, including changed files and ahead/behind counts",
|
|
23747
|
+
parametersSchema: {
|
|
23748
|
+
type: "object",
|
|
23749
|
+
properties: {
|
|
23750
|
+
owner: {
|
|
23751
|
+
type: "string",
|
|
23752
|
+
description: "Repository owner"
|
|
23753
|
+
},
|
|
23754
|
+
repo: {
|
|
23755
|
+
type: "string",
|
|
23756
|
+
description: "Repository name"
|
|
23757
|
+
},
|
|
23758
|
+
base: {
|
|
23759
|
+
type: "string",
|
|
23760
|
+
description: "Base branch, tag, or commit SHA"
|
|
23761
|
+
},
|
|
23762
|
+
head: {
|
|
23763
|
+
type: "string",
|
|
23764
|
+
description: "Head branch, tag, or commit SHA"
|
|
23765
|
+
}
|
|
23766
|
+
},
|
|
23767
|
+
required: ["owner", "repo", "base", "head"]
|
|
23768
|
+
}
|
|
23769
|
+
},
|
|
23638
23770
|
{
|
|
23639
23771
|
name: "commit_files",
|
|
23640
23772
|
description: "Create one atomic Git commit that writes and/or deletes multiple files, then fast-forward a branch to it. If any operation fails, the branch is not partially updated.",
|
|
@@ -24081,15 +24213,8 @@ var GRANOLA_INTEGRATION = {
|
|
|
24081
24213
|
]
|
|
24082
24214
|
};
|
|
24083
24215
|
|
|
24084
|
-
// ../shared/dist/chunk-
|
|
24216
|
+
// ../shared/dist/chunk-IMR6WLWN.mjs
|
|
24085
24217
|
var DEFAULT_MODELS_FOR_NEW_ACCOUNTS = [
|
|
24086
|
-
{
|
|
24087
|
-
provider: "runtype",
|
|
24088
|
-
modelId: "qwen/qwen3.6-27b",
|
|
24089
|
-
isDefault: false,
|
|
24090
|
-
strengths: "Fast, low-cost open-weight workhorse with reasoning, tool-use, and vision \u2014 good for high-volume extraction, classification, and simple transforms.",
|
|
24091
|
-
bestFor: ["fast-cheap", "vision"]
|
|
24092
|
-
},
|
|
24093
24218
|
// WHY(docs/why/packages/shared/src.md#openai-models-route-via-openai-direct-with-verce): OpenAI models route via OpenAI direct with Vercel fallback; routed entries benefit from automatic provider
|
|
24094
24219
|
{
|
|
24095
24220
|
provider: "runtype",
|
|
@@ -24137,7 +24262,7 @@ var DEFAULT_MODELS_FOR_NEW_ACCOUNTS = [
|
|
|
24137
24262
|
// WHY(docs/why/packages/shared/src.md#google-models-route-via-google-direct-with-verte): Google models route via Google direct, with Vertex/Vercel fallback.
|
|
24138
24263
|
{
|
|
24139
24264
|
provider: "runtype",
|
|
24140
|
-
modelId: "gemini-3.
|
|
24265
|
+
modelId: "gemini-3.8-flash",
|
|
24141
24266
|
isDefault: true,
|
|
24142
24267
|
strengths: "Fast, low-cost, and natively multimodal with good reasoning, tool-use, and a 1M context \u2014 the account default and a strong choice for vision and high-throughput steps.",
|
|
24143
24268
|
bestFor: ["default", "vision", "fast-cheap", "agentic-tools", "long-context"]
|
|
@@ -24150,14 +24275,6 @@ var DEFAULT_MODELS_FOR_NEW_ACCOUNTS = [
|
|
|
24150
24275
|
strengths: "Specialised coding workhorse with strong tool-use, low cost, and a 1M context \u2014 ideal for code generation, debugging, and multi-file editing workflows.",
|
|
24151
24276
|
bestFor: ["agentic-tools", "long-context"]
|
|
24152
24277
|
},
|
|
24153
|
-
// WHY(docs/why/packages/shared/src.md#nvidia-nemotron-ultra-reasoning-tool-use-flagshi): NVIDIA Nemotron Ultra: reasoning + tool-use flagship, routed via Vercel.
|
|
24154
|
-
{
|
|
24155
|
-
provider: "runtype",
|
|
24156
|
-
modelId: "nemotron-3-ultra-550b-a55b",
|
|
24157
|
-
isDefault: false,
|
|
24158
|
-
strengths: "Large open-weight reasoning and tool-use flagship with a 1M context at a low price \u2014 strong analytical depth where an open model is preferred.",
|
|
24159
|
-
bestFor: ["deep-reasoning", "agentic-tools", "long-context"]
|
|
24160
|
-
},
|
|
24161
24278
|
// WHY(docs/why/packages/shared/src.md#deepseek-v4-flash-routes-via-cloudflare-workers): DeepSeek V4 Flash routes via Cloudflare Workers AI (bare name resolves to
|
|
24162
24279
|
{
|
|
24163
24280
|
provider: "runtype",
|
|
@@ -24173,6 +24290,22 @@ var DEFAULT_MODELS_FOR_NEW_ACCOUNTS = [
|
|
|
24173
24290
|
isDefault: false,
|
|
24174
24291
|
strengths: "Agentic flagship \u2014 best-in-class at long, multi-round tool-call loops and coding/agent workflows, with a 1M context; well suited to tool-heavy agent steps.",
|
|
24175
24292
|
bestFor: ["agentic-tools", "default", "deep-reasoning", "long-context"]
|
|
24293
|
+
},
|
|
24294
|
+
// WHY(packages/shared/src/provider-routing.ts): Z.ai GLM-5.3 Flash routes via Workers AI, with Vercel fallback.
|
|
24295
|
+
{
|
|
24296
|
+
provider: "runtype",
|
|
24297
|
+
modelId: "glm-5.3-flash",
|
|
24298
|
+
isDefault: false,
|
|
24299
|
+
strengths: "Fast, low-cost model with strong reasoning, tool-use, and a 1M context \u2014 well suited to high-throughput agentic steps and long documents.",
|
|
24300
|
+
bestFor: ["fast-cheap", "default", "agentic-tools", "long-context"]
|
|
24301
|
+
},
|
|
24302
|
+
// WHY(packages/shared/src/provider-routing.ts): Qwen 3.8 27B routes via Mixlayer, with Vercel fallback.
|
|
24303
|
+
{
|
|
24304
|
+
provider: "runtype",
|
|
24305
|
+
modelId: "qwen3.8-27b",
|
|
24306
|
+
isDefault: false,
|
|
24307
|
+
strengths: "Fast open-weight model with strong reasoning, tool-use, and a 262K context \u2014 well suited to agentic tasks and long documents.",
|
|
24308
|
+
bestFor: ["fast-cheap", "default", "deep-reasoning", "agentic-tools", "long-context"]
|
|
24176
24309
|
}
|
|
24177
24310
|
];
|
|
24178
24311
|
var DEFAULT_MODEL_ID = DEFAULT_MODELS_FOR_NEW_ACCOUNTS.find((m2) => m2.isDefault)?.modelId ?? "kimi-k2.6";
|
|
@@ -26397,7 +26530,8 @@ var AGENT_CONTENT_CONFIG_KEYS = {
|
|
|
26397
26530
|
memory: true,
|
|
26398
26531
|
sandbox: true,
|
|
26399
26532
|
tenancyStrategy: true,
|
|
26400
|
-
durability: true
|
|
26533
|
+
durability: true,
|
|
26534
|
+
state: true
|
|
26401
26535
|
};
|
|
26402
26536
|
var AGENT_CONTENT_CONFIG_KEY_LIST = Object.keys(AGENT_CONTENT_CONFIG_KEYS).sort();
|
|
26403
26537
|
function stripTrailingChars(value, char) {
|
|
@@ -26718,6 +26852,28 @@ var MAX_MESSAGE_CONTENT_BYTES = 1024 * 1024;
|
|
|
26718
26852
|
var MAX_MESSAGES_TOTAL_BYTES = 32 * 1024 * 1024;
|
|
26719
26853
|
var encoder = new TextEncoder();
|
|
26720
26854
|
var UNEVALUATED_VERDICT = Object.freeze({ status: "unevaluated" });
|
|
26855
|
+
var AGENT_STATE_DEFAULT_MERGE_STRATEGY = "merge";
|
|
26856
|
+
var agentPredictStateMappingSchema = external_exports.object({
|
|
26857
|
+
/** Top-level state key the predicted argument projects into. */
|
|
26858
|
+
stateKey: external_exports.string().min(1),
|
|
26859
|
+
// WHY(docs/why/packages/shared/src.md#the-tool-may-be-one-the-agent-never-declares-the): The tool may be one the agent never declares: the canonical demo predicts from a CLIENT-declared frontend tool.
|
|
26860
|
+
/** Name of the tool whose arguments are predicted from. */
|
|
26861
|
+
tool: external_exports.string().min(1),
|
|
26862
|
+
/** Argument of that tool carrying the predicted value. */
|
|
26863
|
+
toolArgument: external_exports.string().min(1)
|
|
26864
|
+
});
|
|
26865
|
+
var agentStateChannelSchema = external_exports.object({
|
|
26866
|
+
/** Initial state when a run starts with no client-supplied state. */
|
|
26867
|
+
initial: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
26868
|
+
/** Optional JSON Schema describing the state shape (documentation + client codegen). */
|
|
26869
|
+
schema: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
26870
|
+
// WHY(docs/why/packages/shared/src.md#how-client-supplied-state-merges-with-the-agents): How client-supplied state merges with the agent's own: `'replace'` (the client's state wins wholesale) or
|
|
26871
|
+
/** How client-supplied state merges with the agent's own: `'replace'` (the client's state wins wholesale) or `'merge'` (shallow last-writer-wins per top-level key). */
|
|
26872
|
+
mergeStrategy: external_exports.enum(["replace", "merge"]).default(AGENT_STATE_DEFAULT_MERGE_STRATEGY),
|
|
26873
|
+
// WHY(docs/why/packages/shared/src.md#the-mapping-is-server-authored-because-only-the-a): The mapping is server-authored because only the agent knows which argument feeds which state key.
|
|
26874
|
+
/** Tool arguments the client may optimistically project into state while they stream. */
|
|
26875
|
+
predictState: external_exports.array(agentPredictStateMappingSchema).optional()
|
|
26876
|
+
});
|
|
26721
26877
|
var tenancyAssuranceLevelSchema = external_exports.enum(["anonymous", "asserted", "verified"]);
|
|
26722
26878
|
var tenancyStrategyPresetSchema = external_exports.enum([
|
|
26723
26879
|
"internal",
|
|
@@ -27068,7 +27224,9 @@ var agentRuntimeConfigSchema = external_exports.object({
|
|
|
27068
27224
|
// WHY(docs/why/packages/shared/src.md#tenancystrategy-is-optional-per-resource-isolati): tenancyStrategy is optional per-resource isolation opt-in; absent means platform-global default
|
|
27069
27225
|
tenancyStrategy: tenancyStrategySchema.optional(),
|
|
27070
27226
|
// WHY(docs/why/packages/shared/src.md#durable-turn-knobs-single-sourced-from-agentdura): Durable-turn knobs single-sourced from agentDurabilityConfigSchema; durability is the platform default
|
|
27071
|
-
durability: agentDurabilityConfigSchema.optional()
|
|
27227
|
+
durability: agentDurabilityConfigSchema.optional(),
|
|
27228
|
+
// WHY(docs/why/packages/shared/src.md#the-same-schema-instance-the-export-plane-uses): The SAME instance the export plane uses, so the authoring and export planes cannot drift.
|
|
27229
|
+
state: agentStateChannelSchema.optional()
|
|
27072
27230
|
}).strict();
|
|
27073
27231
|
var contextFallbackSchema = external_exports.union([
|
|
27074
27232
|
external_exports.object({ type: external_exports.literal("retry"), delay: external_exports.number().optional() }),
|
|
@@ -30297,28 +30455,28 @@ function formatPath(path21) {
|
|
|
30297
30455
|
return acc ? `${acc}.${key}` : key;
|
|
30298
30456
|
}, "");
|
|
30299
30457
|
}
|
|
30300
|
-
function compareIssuePath(a,
|
|
30301
|
-
if (!a && !
|
|
30458
|
+
function compareIssuePath(a, b2) {
|
|
30459
|
+
if (!a && !b2) return 0;
|
|
30302
30460
|
if (!a) return 1;
|
|
30303
|
-
if (!
|
|
30304
|
-
return a.localeCompare(
|
|
30461
|
+
if (!b2) return -1;
|
|
30462
|
+
return a.localeCompare(b2);
|
|
30305
30463
|
}
|
|
30306
30464
|
function sortIssues(issues) {
|
|
30307
|
-
return [...issues].sort((a,
|
|
30465
|
+
return [...issues].sort((a, b2) => {
|
|
30308
30466
|
const aStepIndex = a.step?.index ?? Number.MAX_SAFE_INTEGER;
|
|
30309
|
-
const bStepIndex =
|
|
30467
|
+
const bStepIndex = b2.step?.index ?? Number.MAX_SAFE_INTEGER;
|
|
30310
30468
|
if (aStepIndex !== bStepIndex) {
|
|
30311
30469
|
return aStepIndex - bStepIndex;
|
|
30312
30470
|
}
|
|
30313
|
-
const pathCompare = compareIssuePath(a.path,
|
|
30471
|
+
const pathCompare = compareIssuePath(a.path, b2.path);
|
|
30314
30472
|
if (pathCompare !== 0) {
|
|
30315
30473
|
return pathCompare;
|
|
30316
30474
|
}
|
|
30317
|
-
const codeCompare = a.code.localeCompare(
|
|
30475
|
+
const codeCompare = a.code.localeCompare(b2.code);
|
|
30318
30476
|
if (codeCompare !== 0) {
|
|
30319
30477
|
return codeCompare;
|
|
30320
30478
|
}
|
|
30321
|
-
return a.message.localeCompare(
|
|
30479
|
+
return a.message.localeCompare(b2.message);
|
|
30322
30480
|
});
|
|
30323
30481
|
}
|
|
30324
30482
|
function addIssue(level, issue2, buckets) {
|
|
@@ -30844,7 +31002,7 @@ var APPROVAL_UNATTENDED_SURFACES = [
|
|
|
30844
31002
|
"a2a"
|
|
30845
31003
|
];
|
|
30846
31004
|
var APPROVAL_PREFLIGHT_REJECTED_SURFACES = ["client-chat"];
|
|
30847
|
-
var
|
|
31005
|
+
var APPROVAL_REFUSING_SURFACES = APPROVAL_UNATTENDED_SURFACES.filter(
|
|
30848
31006
|
(surface) => surface !== "client-chat"
|
|
30849
31007
|
);
|
|
30850
31008
|
function validatePromptApprovalSurfaceEnforcement(flowSteps, buckets) {
|
|
@@ -30856,7 +31014,7 @@ function validatePromptApprovalSurfaceEnforcement(flowSteps, buckets) {
|
|
|
30856
31014
|
"warning",
|
|
30857
31015
|
{
|
|
30858
31016
|
code: APPROVAL_ENFORCED_ON_ATTENDED_SURFACES_ONLY_CODE,
|
|
30859
|
-
message: `Step "${step.name}" arms a human approval gate (config.tools.approval.require), which is enforced only on attended surfaces that can present the prompt and resume the run: interactive dispatch and agent execute. Client chat rejects approval-gated execution because it has no secure continuation channel back to the visitor.
|
|
31017
|
+
message: `Step "${step.name}" arms a human approval gate (config.tools.approval.require), which is enforced only on attended surfaces that can present the prompt and resume the run: interactive dispatch and agent execute. Client chat rejects approval-gated execution because it has no secure continuation channel back to the visitor. The other unattended surfaces (${APPROVAL_REFUSING_SURFACES.join(", ")}) refuse the run (ineligible:surface-approval-pause): no engine answers the prompt without an attended client, so the flow does not run there at all. If it must run unattended, remove the approval requirement from this step.`,
|
|
30860
31018
|
path: `flowSteps[${stepIndex}].config.tools.approval`,
|
|
30861
31019
|
step: { index: stepIndex, name: step.name, type: step.type },
|
|
30862
31020
|
details: {
|
|
@@ -30878,7 +31036,7 @@ function validateStoreVectorSource(flowSteps, buckets, declaredFlowInputs) {
|
|
|
30878
31036
|
(step) => step.enabled !== false && step.type === "vector-search"
|
|
30879
31037
|
);
|
|
30880
31038
|
const executionOrderedSteps = [...flowSteps.entries()].sort(
|
|
30881
|
-
([, a], [,
|
|
31039
|
+
([, a], [, b2]) => (a.order ?? 0) - (b2.order ?? 0)
|
|
30882
31040
|
);
|
|
30883
31041
|
for (const [stepIndex, step] of executionOrderedSteps) {
|
|
30884
31042
|
if (step.enabled === false) continue;
|
|
@@ -33173,6 +33331,8 @@ var userProfileFeaturesSchema = external_exports.object({
|
|
|
33173
33331
|
// WHY(docs/why/packages/shared/src.md#workspacemodelready-tracks-migration-workspacemo): workspaceModelReady tracks migration; workspaceModelEligible is a kept compatibility constant
|
|
33174
33332
|
workspaceModelReady: external_exports.boolean(),
|
|
33175
33333
|
workspaceModelEligible: external_exports.boolean(),
|
|
33334
|
+
// INVARIANT: Gates the first-run intent gate; fail-closed so a flag outage shows the ordinary dashboard
|
|
33335
|
+
enableOnboardingIntentGate: external_exports.boolean(),
|
|
33176
33336
|
// WHY(docs/why/packages/shared/src.md#model-credit-promo-multiplier-for-billing-discou): Model credit promo multiplier for billing discounts; billing never trusts the client value
|
|
33177
33337
|
modelCreditPromoMultiplier: external_exports.number().min(0).max(1).optional(),
|
|
33178
33338
|
// WHY(docs/claude/telemetry-suppression.md): Org-scoped external-telemetry gate; browser and Code Mode MCP surfaces read it here.
|
|
@@ -40467,18 +40627,18 @@ batchCommand.command("summary").description("Show a summary of active and recent
|
|
|
40467
40627
|
console.log(` Recently completed: ${data.recentlyCompleted}`);
|
|
40468
40628
|
if (data.batches.length > 0) {
|
|
40469
40629
|
console.log(chalk9.cyan("\nActive Batches:"));
|
|
40470
|
-
for (const
|
|
40630
|
+
for (const b2 of data.batches) {
|
|
40471
40631
|
console.log(
|
|
40472
|
-
` ${chalk9.green(
|
|
40632
|
+
` ${chalk9.green(b2.id)} ${b2.flowName ?? ""} \u2014 ${b2.status} (${b2.processedRecords}/${b2.totalRecords}, ${b2.progress}%)`
|
|
40473
40633
|
);
|
|
40474
40634
|
}
|
|
40475
40635
|
}
|
|
40476
40636
|
if (data.recent.length > 0) {
|
|
40477
40637
|
console.log(chalk9.cyan("\nRecently Completed:"));
|
|
40478
|
-
for (const
|
|
40479
|
-
const statusColor =
|
|
40638
|
+
for (const b2 of data.recent) {
|
|
40639
|
+
const statusColor = b2.status === "completed" ? chalk9.green(b2.status) : chalk9.red(b2.status);
|
|
40480
40640
|
console.log(
|
|
40481
|
-
` ${chalk9.green(
|
|
40641
|
+
` ${chalk9.green(b2.id)} ${b2.flowName ?? ""} \u2014 ${statusColor} (${b2.processedRecords}/${b2.totalRecords})`
|
|
40482
40642
|
);
|
|
40483
40643
|
}
|
|
40484
40644
|
}
|
|
@@ -40507,18 +40667,18 @@ batchCommand.command("summary").description("Show a summary of active and recent
|
|
|
40507
40667
|
{ label: "Active", value: data.activeBatches, color: "green" },
|
|
40508
40668
|
{ label: "Recently completed", value: data.recentlyCompleted }
|
|
40509
40669
|
];
|
|
40510
|
-
for (const
|
|
40670
|
+
for (const b2 of data.batches) {
|
|
40511
40671
|
fields.push({
|
|
40512
|
-
label:
|
|
40513
|
-
value: `${
|
|
40672
|
+
label: b2.id,
|
|
40673
|
+
value: `${b2.flowName ?? ""} \u2014 ${b2.status} (${b2.processedRecords}/${b2.totalRecords}, ${b2.progress}%)`,
|
|
40514
40674
|
color: "yellow"
|
|
40515
40675
|
});
|
|
40516
40676
|
}
|
|
40517
|
-
for (const
|
|
40677
|
+
for (const b2 of data.recent) {
|
|
40518
40678
|
fields.push({
|
|
40519
|
-
label:
|
|
40520
|
-
value: `${
|
|
40521
|
-
color:
|
|
40679
|
+
label: b2.id,
|
|
40680
|
+
value: `${b2.flowName ?? ""} \u2014 ${b2.status} (${b2.processedRecords}/${b2.totalRecords})`,
|
|
40681
|
+
color: b2.status === "completed" ? "green" : "red"
|
|
40522
40682
|
});
|
|
40523
40683
|
}
|
|
40524
40684
|
setResultNode(React6.createElement(EntityCard, { fields }));
|
|
@@ -41939,11 +42099,18 @@ integrationsCommand.command("get <id>").description("Get integration details, in
|
|
|
41939
42099
|
});
|
|
41940
42100
|
|
|
41941
42101
|
// src/commands/surfaces.ts
|
|
41942
|
-
import { Command as Command11 } from "commander";
|
|
42102
|
+
import { Command as Command11, Option } from "commander";
|
|
41943
42103
|
import chalk14 from "chalk";
|
|
41944
42104
|
import React10 from "react";
|
|
41945
42105
|
import { render as render10 } from "ink";
|
|
41946
42106
|
import { useState as useState11, useEffect as useEffect12 } from "react";
|
|
42107
|
+
function parsePositiveInteger(value, option) {
|
|
42108
|
+
const parsed = Number(value);
|
|
42109
|
+
if (!Number.isInteger(parsed) || parsed < 1) {
|
|
42110
|
+
throw new Error(`${option} must be a positive integer`);
|
|
42111
|
+
}
|
|
42112
|
+
return parsed;
|
|
42113
|
+
}
|
|
41947
42114
|
var surfacesCommand = new Command11("surfaces").description("View product surfaces");
|
|
41948
42115
|
surfacesCommand.command("list").description("List surfaces across your products").option("--json", "Output as JSON").option("--limit <n>", "Maximum number of surfaces to return").option("--cursor <cursor>", "Pagination cursor for the next page").option("--type <type>", "Filter by surface type").option("--status <status>", "Filter by surface status").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(
|
|
41949
42116
|
async (options) => {
|
|
@@ -42029,12 +42196,14 @@ surfacesCommand.command("list").description("List surfaces across your products"
|
|
|
42029
42196
|
await waitUntilExit();
|
|
42030
42197
|
}
|
|
42031
42198
|
);
|
|
42032
|
-
surfacesCommand.command("get <id>").description("Get surface details including its items and keys
|
|
42199
|
+
surfacesCommand.command("get <id>").description("Get surface details including its items and keys").addOption(
|
|
42200
|
+
new Option("--product <productId>", "Deprecated; surface IDs resolve their product").hideHelp()
|
|
42201
|
+
).option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(
|
|
42033
42202
|
async (id, options) => {
|
|
42034
42203
|
const apiKey = await ensureAuth();
|
|
42035
42204
|
if (!apiKey) return;
|
|
42036
42205
|
const client = createCliClient(apiKey);
|
|
42037
|
-
const detailPath = `/
|
|
42206
|
+
const detailPath = `/surfaces/${encodeURIComponent(id)}`;
|
|
42038
42207
|
if (!isTTY(options) || options.json) {
|
|
42039
42208
|
try {
|
|
42040
42209
|
const data = await client.get(detailPath);
|
|
@@ -42136,6 +42305,51 @@ Keys (${keys.length}):`));
|
|
|
42136
42305
|
await waitUntilExit();
|
|
42137
42306
|
}
|
|
42138
42307
|
);
|
|
42308
|
+
surfacesCommand.command("test <id>").description("Send a provider fixture through a surface\u2019s real ingress").addOption(
|
|
42309
|
+
new Option("--product <productId>", "Deprecated; surface IDs resolve their product").hideHelp()
|
|
42310
|
+
).requiredOption(
|
|
42311
|
+
"--fixture <fixture>",
|
|
42312
|
+
"Fixture name, such as github.pull_request.opened or github.pull_request.merged_plan"
|
|
42313
|
+
).requiredOption("--repo <owner/repository>", "GitHub repository in owner/repository format").requiredOption("--pr <number>", "Pull request number").option("--repeat <number>", "Deliver the same provider event more than once", "1").option("--planning-path <path>", "Planning-document directory for merged-plan fixtures").option("--json", "Output as JSON").action(
|
|
42314
|
+
async (id, options) => {
|
|
42315
|
+
const apiKey = await ensureAuth();
|
|
42316
|
+
if (!apiKey) return;
|
|
42317
|
+
try {
|
|
42318
|
+
const pullRequest = parsePositiveInteger(options.pr, "--pr");
|
|
42319
|
+
const repeat = parsePositiveInteger(options.repeat, "--repeat");
|
|
42320
|
+
if (repeat > 3) throw new Error("--repeat must not exceed 3");
|
|
42321
|
+
const client = createCliClient(apiKey);
|
|
42322
|
+
const result = await client.post(
|
|
42323
|
+
`/surfaces/${encodeURIComponent(id)}/test-deliveries`,
|
|
42324
|
+
{
|
|
42325
|
+
fixture: options.fixture,
|
|
42326
|
+
repository: options.repo,
|
|
42327
|
+
pullRequest,
|
|
42328
|
+
repeat,
|
|
42329
|
+
...options.planningPath ? { planningPath: options.planningPath } : {}
|
|
42330
|
+
}
|
|
42331
|
+
);
|
|
42332
|
+
if (options.json) {
|
|
42333
|
+
printJson(result);
|
|
42334
|
+
return;
|
|
42335
|
+
}
|
|
42336
|
+
console.log(chalk14.green("Test delivery accepted"));
|
|
42337
|
+
console.log(
|
|
42338
|
+
` Surface: ${result.surface.id} [${result.surface.type}/${result.surface.provider}]`
|
|
42339
|
+
);
|
|
42340
|
+
console.log(` Fixture: ${result.fixture}`);
|
|
42341
|
+
console.log(` Source: ${result.repository}#${result.pullRequest}`);
|
|
42342
|
+
console.log(` Delivery: ${result.deliveryId}`);
|
|
42343
|
+
for (const attempt of result.attempts) {
|
|
42344
|
+
console.log(` Attempt ${attempt.attempt}: HTTP ${attempt.status}`);
|
|
42345
|
+
}
|
|
42346
|
+
} catch (error61) {
|
|
42347
|
+
const message = error61 instanceof Error ? error61.message : "Unknown error";
|
|
42348
|
+
console.error(chalk14.red(`Failed to test surface: ${message}`));
|
|
42349
|
+
process.exitCode = 1;
|
|
42350
|
+
}
|
|
42351
|
+
}
|
|
42352
|
+
);
|
|
42139
42353
|
|
|
42140
42354
|
// src/commands/logs.ts
|
|
42141
42355
|
import { Command as Command12 } from "commander";
|
|
@@ -42309,9 +42523,9 @@ Histogram (${histogram.length} buckets):`));
|
|
|
42309
42523
|
if (histogram.length === 0) {
|
|
42310
42524
|
console.log(chalk15.gray(" No data"));
|
|
42311
42525
|
} else {
|
|
42312
|
-
for (const
|
|
42313
|
-
const errPart =
|
|
42314
|
-
console.log(` ${chalk15.dim(
|
|
42526
|
+
for (const b2 of histogram) {
|
|
42527
|
+
const errPart = b2.errors > 0 ? chalk15.red(` (${b2.errors} errors)`) : "";
|
|
42528
|
+
console.log(` ${chalk15.dim(b2.bucket)} ${b2.count}${errPart}`);
|
|
42315
42529
|
}
|
|
42316
42530
|
}
|
|
42317
42531
|
} catch (error61) {
|
|
@@ -42333,7 +42547,7 @@ Histogram (${histogram.length} buckets):`));
|
|
|
42333
42547
|
const stats = res.data;
|
|
42334
42548
|
const histogram = stats.histogram ?? [];
|
|
42335
42549
|
const histogramSummary = histogram.length === 0 ? "No data" : histogram.map(
|
|
42336
|
-
(
|
|
42550
|
+
(b2) => `${b2.bucket}: ${b2.count}${b2.errors > 0 ? ` (${b2.errors} err)` : ""}`
|
|
42337
42551
|
).join("\n");
|
|
42338
42552
|
setResultNode(
|
|
42339
42553
|
React11.createElement(EntityCard, {
|
|
@@ -46372,7 +46586,7 @@ function extractTrackedFiles(snapshots, liveTools, planPath) {
|
|
|
46372
46586
|
result.push({ path: planPath, type: "plan" });
|
|
46373
46587
|
}
|
|
46374
46588
|
const sorted = Array.from(fileMap.values()).sort(
|
|
46375
|
-
(a,
|
|
46589
|
+
(a, b2) => (b2.lastTouchedAt ?? 0) - (a.lastTouchedAt ?? 0)
|
|
46376
46590
|
);
|
|
46377
46591
|
result.push(...sorted);
|
|
46378
46592
|
return result;
|
|
@@ -47597,14 +47811,14 @@ function ModelPicker({ currentModel, onSelect, onCancel, models }) {
|
|
|
47597
47811
|
[contentWidth]
|
|
47598
47812
|
);
|
|
47599
47813
|
const sorted = useMemo7(
|
|
47600
|
-
() => [...availableModels].sort((a,
|
|
47814
|
+
() => [...availableModels].sort((a, b2) => a.group.localeCompare(b2.group)),
|
|
47601
47815
|
[availableModels]
|
|
47602
47816
|
);
|
|
47603
47817
|
const filtered = useMemo7(() => {
|
|
47604
47818
|
if (!search.trim()) return sorted;
|
|
47605
|
-
const
|
|
47819
|
+
const q2 = search.toLowerCase();
|
|
47606
47820
|
return sorted.filter(
|
|
47607
|
-
(m2) => m2.label.toLowerCase().includes(
|
|
47821
|
+
(m2) => m2.label.toLowerCase().includes(q2) || m2.value.toLowerCase().includes(q2) || m2.group.toLowerCase().includes(q2)
|
|
47608
47822
|
);
|
|
47609
47823
|
}, [sorted, search]);
|
|
47610
47824
|
const searchRef = useRef6("");
|
|
@@ -47820,9 +48034,9 @@ function CommandPicker({ onSelect, onCancel, initialFilter = "" }) {
|
|
|
47820
48034
|
);
|
|
47821
48035
|
const filtered = useMemo8(() => {
|
|
47822
48036
|
if (!search.trim()) return MARATHON_CHECKPOINT_COMMANDS;
|
|
47823
|
-
const
|
|
48037
|
+
const q2 = search.toLowerCase();
|
|
47824
48038
|
return MARATHON_CHECKPOINT_COMMANDS.filter(
|
|
47825
|
-
(cmd) => cmd.name.toLowerCase().includes(
|
|
48039
|
+
(cmd) => cmd.name.toLowerCase().includes(q2) || cmd.description.toLowerCase().includes(q2)
|
|
47826
48040
|
);
|
|
47827
48041
|
}, [search]);
|
|
47828
48042
|
const handleSearchChange = (value) => {
|
|
@@ -51974,7 +52188,7 @@ function getSanitizedEnv() {
|
|
|
51974
52188
|
return clean;
|
|
51975
52189
|
}
|
|
51976
52190
|
function redactSecrets(output2, secrets) {
|
|
51977
|
-
const sorted = secrets.filter((s) => s.length >= 8).sort((a,
|
|
52191
|
+
const sorted = secrets.filter((s) => s.length >= 8).sort((a, b2) => b2.length - a.length);
|
|
51978
52192
|
let redacted = output2;
|
|
51979
52193
|
for (const secret of sorted) {
|
|
51980
52194
|
redacted = redacted.replaceAll(secret, "[REDACTED]");
|
|
@@ -52906,7 +53120,7 @@ function buildTree(dirPath, maxDepth, depth = 0) {
|
|
|
52906
53120
|
return [`${" ".repeat(depth)}[error reading ${normalizeToolPath(dirPath)}: ${message}]`];
|
|
52907
53121
|
}
|
|
52908
53122
|
const lines = [];
|
|
52909
|
-
for (const entry of entries.sort((a,
|
|
53123
|
+
for (const entry of entries.sort((a, b2) => a.name.localeCompare(b2.name))) {
|
|
52910
53124
|
const entryPath = path10.join(dirPath, entry.name);
|
|
52911
53125
|
if (shouldIgnoreRepoEntry(entryPath)) continue;
|
|
52912
53126
|
lines.push(`${" ".repeat(depth)}- ${entry.name}${entry.isDirectory() ? "/" : ""}`);
|
|
@@ -53161,7 +53375,7 @@ function createDefaultLocalTools(context) {
|
|
|
53161
53375
|
});
|
|
53162
53376
|
}
|
|
53163
53377
|
});
|
|
53164
|
-
const matches = candidates.sort((a,
|
|
53378
|
+
const matches = candidates.sort((a, b2) => b2.score - a.score || a.text.localeCompare(b2.text)).map((candidate) => candidate.text).filter((text, index, array2) => array2.indexOf(text) === index).slice(0, maxResults);
|
|
53165
53379
|
return matches.length > 0 ? matches.join("\n") : `No matches found for "${query}" under ${normalizeToolPath(startPath.resolvedPath)}`;
|
|
53166
53380
|
}
|
|
53167
53381
|
},
|
|
@@ -53210,7 +53424,7 @@ function createDefaultLocalTools(context) {
|
|
|
53210
53424
|
});
|
|
53211
53425
|
}
|
|
53212
53426
|
});
|
|
53213
|
-
const rankedMatches = matches.sort((a,
|
|
53427
|
+
const rankedMatches = matches.sort((a, b2) => b2.score - a.score || a.path.localeCompare(b2.path)).map((match) => match.path).slice(0, maxResults);
|
|
53214
53428
|
return rankedMatches.length > 0 ? rankedMatches.join("\n") : `No files matched "${pattern}" under ${normalizeToolPath(startPath.resolvedPath)}`;
|
|
53215
53429
|
}
|
|
53216
53430
|
},
|
|
@@ -57721,14 +57935,14 @@ evalCommand.command("list").description("List eval batches").option("--flow <id>
|
|
|
57721
57935
|
total,
|
|
57722
57936
|
emptyMessage: "No eval batches found",
|
|
57723
57937
|
renderCard: (item) => {
|
|
57724
|
-
const
|
|
57725
|
-
const name =
|
|
57726
|
-
const progress =
|
|
57727
|
-
const statusColor =
|
|
57938
|
+
const b2 = item;
|
|
57939
|
+
const name = b2.name || b2.id;
|
|
57940
|
+
const progress = b2.totalRecords ? `${b2.completedRecords ?? 0}/${b2.totalRecords}` : "";
|
|
57941
|
+
const statusColor = b2.status === "completed" ? "green" : "yellow";
|
|
57728
57942
|
return React20.createElement(
|
|
57729
57943
|
Text34,
|
|
57730
57944
|
{ color: statusColor },
|
|
57731
|
-
` ${
|
|
57945
|
+
` ${b2.id} ${name} [${b2.status}] ${progress}`
|
|
57732
57946
|
);
|
|
57733
57947
|
}
|
|
57734
57948
|
});
|
|
@@ -59585,19 +59799,19 @@ import { execFileSync } from "child_process";
|
|
|
59585
59799
|
// src/lib/persona-init.ts
|
|
59586
59800
|
init_credential_store();
|
|
59587
59801
|
|
|
59588
|
-
// ../../node_modules/.pnpm/@runtypelabs+persona@4.
|
|
59589
|
-
var
|
|
59590
|
-
var
|
|
59591
|
-
function
|
|
59592
|
-
return e?.cdnBase?.trim().replace(/\/+$/, "").replace(/[\\'"<>`]/g, (r) => `%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")}`) || `https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${
|
|
59802
|
+
// ../../node_modules/.pnpm/@runtypelabs+persona@4.22.0/node_modules/@runtypelabs/persona/dist/codegen.js
|
|
59803
|
+
var x = "4.22.0";
|
|
59804
|
+
var S = x;
|
|
59805
|
+
function w(e) {
|
|
59806
|
+
return e?.cdnBase?.trim().replace(/\/+$/, "").replace(/[\\'"<>`]/g, (r) => `%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")}`) || `https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${S}/dist`;
|
|
59593
59807
|
}
|
|
59594
59808
|
function u(e) {
|
|
59595
59809
|
if (e !== void 0) return typeof e == "string" ? e : Array.isArray(e) ? `[${e.map((i) => i.toString()).join(", ")}]` : e.toString();
|
|
59596
59810
|
}
|
|
59597
|
-
function
|
|
59811
|
+
function I(e) {
|
|
59598
59812
|
if (e) return { getHeaders: u(e.getHeaders), onFeedback: u(e.onFeedback), onCopy: u(e.onCopy), requestMiddleware: u(e.requestMiddleware), actionHandlers: u(e.actionHandlers), actionParsers: u(e.actionParsers), postprocessMessage: u(e.postprocessMessage), contextProviders: u(e.contextProviders), streamParser: u(e.streamParser) };
|
|
59599
59813
|
}
|
|
59600
|
-
var
|
|
59814
|
+
var j = `({ text, message }: any) => {
|
|
59601
59815
|
const jsonSource = (message as any).rawContent || text || message.content;
|
|
59602
59816
|
if (!jsonSource || typeof jsonSource !== 'string') return null;
|
|
59603
59817
|
let cleanJson = jsonSource
|
|
@@ -59611,7 +59825,7 @@ var A = `({ text, message }: any) => {
|
|
|
59611
59825
|
} catch (e) { return null; }
|
|
59612
59826
|
return null;
|
|
59613
59827
|
}`;
|
|
59614
|
-
var
|
|
59828
|
+
var A = `function(ctx) {
|
|
59615
59829
|
var jsonSource = ctx.message.rawContent || ctx.text || ctx.message.content;
|
|
59616
59830
|
if (!jsonSource || typeof jsonSource !== 'string') return null;
|
|
59617
59831
|
var cleanJson = jsonSource
|
|
@@ -59714,7 +59928,7 @@ function y(e, i) {
|
|
|
59714
59928
|
return `${t}${s}${n}`;
|
|
59715
59929
|
});
|
|
59716
59930
|
}
|
|
59717
|
-
function
|
|
59931
|
+
function b(e, i) {
|
|
59718
59932
|
let r = [];
|
|
59719
59933
|
if (e.layout) {
|
|
59720
59934
|
let s = e.layout.header && Object.keys(e.layout.header).some((t) => t !== "render"), a = e.layout.messages && Object.keys(e.layout.messages).some((t) => t !== "renderUserMessage" && t !== "renderAssistantMessage");
|
|
@@ -59730,11 +59944,11 @@ function C(e, i) {
|
|
|
59730
59944
|
}
|
|
59731
59945
|
return r;
|
|
59732
59946
|
}
|
|
59733
|
-
function
|
|
59947
|
+
function $(e, i) {
|
|
59734
59948
|
let r = [];
|
|
59735
59949
|
return e && (e.getHeaders && r.push(`${i}getHeaders: ${e.getHeaders},`), e.requestMiddleware && r.push(`${i}requestMiddleware: ${e.requestMiddleware},`), e.actionParsers && r.push(`${i}actionParsers: ${e.actionParsers},`), e.actionHandlers && r.push(`${i}actionHandlers: ${e.actionHandlers},`), e.contextProviders && r.push(`${i}contextProviders: ${e.contextProviders},`), e.streamParser && r.push(`${i}streamParser: ${e.streamParser},`)), r;
|
|
59736
59950
|
}
|
|
59737
|
-
function
|
|
59951
|
+
function v(e, i, r) {
|
|
59738
59952
|
Object.entries(i).forEach(([s, a]) => {
|
|
59739
59953
|
if (!(a === void 0 || typeof a == "function")) {
|
|
59740
59954
|
if (Array.isArray(a)) {
|
|
@@ -59742,7 +59956,7 @@ function k(e, i, r) {
|
|
|
59742
59956
|
return;
|
|
59743
59957
|
}
|
|
59744
59958
|
if (a && typeof a == "object") {
|
|
59745
|
-
e.push(`${r}${s}: {`),
|
|
59959
|
+
e.push(`${r}${s}: {`), v(e, a, `${r} `), e.push(`${r}},`);
|
|
59746
59960
|
return;
|
|
59747
59961
|
}
|
|
59748
59962
|
e.push(`${r}${s}: ${JSON.stringify(a)},`);
|
|
@@ -59750,7 +59964,7 @@ function k(e, i, r) {
|
|
|
59750
59964
|
});
|
|
59751
59965
|
}
|
|
59752
59966
|
function d(e, i, r, s) {
|
|
59753
|
-
r && (e.push(`${s}${i}: {`),
|
|
59967
|
+
r && (e.push(`${s}${i}: {`), v(e, r, `${s} `), e.push(`${s}},`));
|
|
59754
59968
|
}
|
|
59755
59969
|
function c(e) {
|
|
59756
59970
|
return (e?.target ?? "body").replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
|
@@ -59758,8 +59972,8 @@ function c(e) {
|
|
|
59758
59972
|
function R(e, i = "esm", r) {
|
|
59759
59973
|
let s = { ...e };
|
|
59760
59974
|
delete s.postprocessMessage, delete s.initialMessages;
|
|
59761
|
-
let a = r ? { ...r, hooks:
|
|
59762
|
-
return i === "esm" ? W(s, a) : i === "script-installer" ?
|
|
59975
|
+
let a = r ? { ...r, hooks: I(r.hooks) } : void 0;
|
|
59976
|
+
return i === "esm" ? W(s, a) : i === "script-installer" ? q(s, a) : i === "script-advanced" ? J(s, a) : i === "react-component" ? H(s, a) : i === "react-advanced" ? N(s, a) : D(s, a);
|
|
59763
59977
|
}
|
|
59764
59978
|
function W(e, i) {
|
|
59765
59979
|
let r = i?.hooks, s = h(e), a = s !== "plain", t = ["import '@runtypelabs/persona/widget.css';", "import { initAgentWidget, markdownPostprocessor } from '@runtypelabs/persona';", "", "initAgentWidget({", ` target: '${c(i)}',`, " config: {"];
|
|
@@ -59775,7 +59989,7 @@ function W(e, i) {
|
|
|
59775
59989
|
t.push(` ${n}: ${o},`);
|
|
59776
59990
|
}), t.push(" },")), t.push(...y(e, " ")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((n) => {
|
|
59777
59991
|
t.push(` "${n}",`);
|
|
59778
|
-
}), t.push(" ],")), e.suggestionChipsConfig && (t.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && t.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && t.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && t.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && t.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), t.push(" },")), t.push(...g(e, " ")), t.push(...m(e, " ", r)), t.push(...f(e, " ")), t.push(...
|
|
59992
|
+
}), t.push(" ],")), e.suggestionChipsConfig && (t.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && t.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && t.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && t.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && t.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), t.push(" },")), t.push(...g(e, " ")), t.push(...m(e, " ", r)), t.push(...f(e, " ")), t.push(...b(e, " ")), t.push(...$(r, " ")), e.debug && t.push(` debug: ${e.debug},`), r?.postprocessMessage ? t.push(` postprocessMessage: ${r.postprocessMessage}`) : t.push(" postprocessMessage: ({ text }) => markdownPostprocessor(text)"), t.push(" }"), t.push("});"), t.join(`
|
|
59779
59993
|
`);
|
|
59780
59994
|
}
|
|
59781
59995
|
function H(e, i) {
|
|
@@ -59792,7 +60006,7 @@ function H(e, i) {
|
|
|
59792
60006
|
t.push(` ${n}: ${o},`);
|
|
59793
60007
|
}), t.push(" },")), t.push(...y(e, " ")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((n) => {
|
|
59794
60008
|
t.push(` "${n}",`);
|
|
59795
|
-
}), t.push(" ],")), e.suggestionChipsConfig && (t.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && t.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && t.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && t.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && t.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), t.push(" },")), t.push(...g(e, " ")), t.push(...m(e, " ", r)), t.push(...f(e, " ")), t.push(...
|
|
60009
|
+
}), t.push(" ],")), e.suggestionChipsConfig && (t.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && t.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && t.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && t.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && t.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), t.push(" },")), t.push(...g(e, " ")), t.push(...m(e, " ", r)), t.push(...f(e, " ")), t.push(...b(e, " ")), t.push(...$(r, " ")), e.debug && t.push(` debug: ${e.debug},`), r?.postprocessMessage ? t.push(` postprocessMessage: ${r.postprocessMessage}`) : t.push(" postprocessMessage: ({ text }) => markdownPostprocessor(text)"), t.push(" }"), t.push(" });"), t.push(""), t.push(" // Cleanup on unmount"), t.push(" return () => {"), t.push(" if (handle) {"), t.push(" handle.destroy();"), t.push(" }"), t.push(" };"), t.push(" }, []);"), t.push(""), t.push(" return null; // Widget injects itself into the DOM"), t.push("}"), t.push(""), t.push("// Usage in your app:"), t.push("// import { ChatWidget } from './components/ChatWidget';"), t.push("//"), t.push("// export default function App() {"), t.push("// return ("), t.push("// <div>"), t.push("// {/* Your app content */}"), t.push("// <ChatWidget />"), t.push("// </div>"), t.push("// );"), t.push("// }"), t.join(`
|
|
59796
60010
|
`);
|
|
59797
60011
|
}
|
|
59798
60012
|
function N(e, i) {
|
|
@@ -59809,10 +60023,10 @@ function N(e, i) {
|
|
|
59809
60023
|
s.push(` ${a}: ${t},`);
|
|
59810
60024
|
}), s.push(" },")), s.push(...y(e, " ")), e.suggestionChips && e.suggestionChips.length > 0 && (s.push(" suggestionChips: ["), e.suggestionChips.forEach((a) => {
|
|
59811
60025
|
s.push(` "${a}",`);
|
|
59812
|
-
}), s.push(" ],")), e.suggestionChipsConfig && (s.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && s.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && s.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && s.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && s.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), s.push(" },")), s.push(...g(e, " ")), s.push(...m(e, " ", r)), s.push(...f(e, " ")), s.push(...
|
|
60026
|
+
}), s.push(" ],")), e.suggestionChipsConfig && (s.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && s.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && s.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && s.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && s.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), s.push(" },")), s.push(...g(e, " ")), s.push(...m(e, " ", r)), s.push(...f(e, " ")), s.push(...b(e, " ")), r?.getHeaders && s.push(` getHeaders: ${r.getHeaders},`), r?.contextProviders && s.push(` contextProviders: ${r.contextProviders},`), e.debug && s.push(` debug: ${e.debug},`), s.push(" initialMessages: loadSavedMessages(),"), r?.streamParser ? s.push(` streamParser: ${r.streamParser},`) : (s.push(" // Flexible JSON stream parser for handling structured actions"), s.push(` streamParser: () => createFlexibleJsonStreamParser(${_}),`)), r?.actionParsers ? (s.push(" // Action parsers (custom merged with defaults)"), s.push(` actionParsers: [...(${r.actionParsers}), defaultJsonActionParser,`), s.push(" // Built-in parser for markdown-wrapped JSON"), s.push(` ${j}`), s.push(" ],")) : (s.push(" // Action parsers to detect JSON actions in responses"), s.push(" actionParsers: ["), s.push(" defaultJsonActionParser,"), s.push(" // Parser for markdown-wrapped JSON"), s.push(` ${j}`), s.push(" ],")), r?.actionHandlers ? (s.push(" // Action handlers (custom merged with defaults)"), s.push(` actionHandlers: [...(${r.actionHandlers}),`), s.push(" defaultActionHandlers.message,"), s.push(" defaultActionHandlers.messageAndClick,"), s.push(" // Built-in handler for nav_then_click action"), s.push(` ${O}`), s.push(" ],")) : (s.push(" // Action handlers for navigation and other actions"), s.push(" actionHandlers: ["), s.push(" defaultActionHandlers.message,"), s.push(" defaultActionHandlers.messageAndClick,"), s.push(" // Handler for nav_then_click action"), s.push(` ${O}`), s.push(" ],")), r?.postprocessMessage ? s.push(` postprocessMessage: ${r.postprocessMessage},`) : s.push(" postprocessMessage: ({ text }) => markdownPostprocessor(text),"), r?.requestMiddleware ? (s.push(" // Request middleware (custom merged with DOM context)"), s.push(" requestMiddleware: ({ payload, config }) => {"), s.push(` const customResult = (${r.requestMiddleware})({ payload, config });`), s.push(" const merged = customResult || payload;"), s.push(" return {"), s.push(" ...merged,"), s.push(" metadata: { ...merged.metadata, ...collectDOMContext() }"), s.push(" };"), s.push(" }")) : (s.push(" requestMiddleware: ({ payload }) => {"), s.push(" return {"), s.push(" ...payload,"), s.push(" metadata: collectDOMContext()"), s.push(" };"), s.push(" }")), s.push(" }"), s.push(" });"), s.push(""), s.push(" // Save state on message events"), s.push(" const handleMessage = () => {"), s.push(" const session = handle?.getSession?.();"), s.push(" if (session) {"), s.push(" localStorage.setItem(STORAGE_KEY, JSON.stringify({"), s.push(" messages: session.messages,"), s.push(" timestamp: new Date().toISOString()"), s.push(" }));"), s.push(" }"), s.push(" };"), s.push(""), s.push(" // Clear state on clear chat"), s.push(" const handleClearChat = () => {"), s.push(" localStorage.removeItem(STORAGE_KEY);"), s.push(" localStorage.removeItem(PROCESSED_ACTIONS_KEY);"), s.push(" };"), s.push(""), s.push(" window.addEventListener('persona:message', handleMessage);"), s.push(" window.addEventListener('persona:clear-chat', handleClearChat);"), s.push(""), s.push(" // Cleanup on unmount"), s.push(" return () => {"), s.push(" window.removeEventListener('persona:message', handleMessage);"), s.push(" window.removeEventListener('persona:clear-chat', handleClearChat);"), s.push(" if (handle) {"), s.push(" handle.destroy();"), s.push(" }"), s.push(" };"), s.push(" }, []);"), s.push(""), s.push(" return null; // Widget injects itself into the DOM"), s.push("}"), s.push(""), s.push("// Usage: Collects DOM context for AI-powered navigation"), s.push("// Features:"), s.push("// - Extracts page elements (products, buttons, links)"), s.push("// - Persists chat history across page loads"), s.push("// - Handles navigation actions (nav_then_click)"), s.push("// - Processes structured JSON actions from AI"), s.push("//"), s.push("// Example usage in Next.js:"), s.push("// import { ChatWidgetAdvanced } from './components/ChatWidgetAdvanced';"), s.push("//"), s.push("// export default function RootLayout({ children }) {"), s.push("// return ("), s.push('// <html lang="en">'), s.push("// <body>"), s.push("// {children}"), s.push("// <ChatWidgetAdvanced />"), s.push("// </body>"), s.push("// </html>"), s.push("// );"), s.push("// }"), s.join(`
|
|
59813
60027
|
`);
|
|
59814
60028
|
}
|
|
59815
|
-
function
|
|
60029
|
+
function k(e) {
|
|
59816
60030
|
let i = h(e), r = i !== "plain", s = {};
|
|
59817
60031
|
if (e.apiUrl && (s.apiUrl = e.apiUrl), e.clientToken && (s.clientToken = e.clientToken), e.agentId && (s.agentId = e.agentId), e.target && (s.target = e.target), e.flowId && (s.flowId = e.flowId), r && (s.parserType = i), e.theme && (s.theme = e.theme), e.launcher && (s.launcher = e.launcher), e.copy && (s.copy = e.copy), e.sendButton && (s.sendButton = e.sendButton), e.voiceRecognition && (s.voiceRecognition = e.voiceRecognition), e.statusIndicator && (s.statusIndicator = e.statusIndicator), e.features && (s.features = e.features), e.suggestions && (s.suggestions = e.suggestions), e.suggestionChips?.length > 0 && (s.suggestionChips = e.suggestionChips), e.suggestionChipsConfig && (s.suggestionChipsConfig = e.suggestionChipsConfig), e.debug && (s.debug = e.debug), e.toolCall) {
|
|
59818
60032
|
let a = {};
|
|
@@ -59844,8 +60058,8 @@ function P(e) {
|
|
|
59844
60058
|
if (n !== "renderUserMessage" && n !== "renderAssistantMessage") if (n === "avatar" && typeof o == "object" && o !== null) t.avatar = o;
|
|
59845
60059
|
else if (n === "timestamp" && typeof o == "object" && o !== null) {
|
|
59846
60060
|
let p = {};
|
|
59847
|
-
Object.entries(o).forEach(([l,
|
|
59848
|
-
l !== "format" && (typeof
|
|
60061
|
+
Object.entries(o).forEach(([l, C]) => {
|
|
60062
|
+
l !== "format" && (typeof C == "string" || typeof C == "boolean") && (p[l] = C);
|
|
59849
60063
|
}), Object.keys(p).length > 0 && (t.timestamp = p);
|
|
59850
60064
|
} else (typeof o == "string" || typeof o == "boolean") && (t[n] = o);
|
|
59851
60065
|
}), Object.keys(t).length > 0 && (a.messages = t);
|
|
@@ -59854,12 +60068,12 @@ function P(e) {
|
|
|
59854
60068
|
}
|
|
59855
60069
|
return s;
|
|
59856
60070
|
}
|
|
59857
|
-
function
|
|
59858
|
-
let r =
|
|
59859
|
-
return `<script src="${
|
|
60071
|
+
function q(e, i) {
|
|
60072
|
+
let r = k(e), a = !!(i?.windowKey || i?.target) ? { config: r, ...i?.windowKey ? { windowKey: i.windowKey } : {}, ...i?.target ? { target: i.target } : {} } : r, t = JSON.stringify(a, null, 0).replace(/'/g, "'");
|
|
60073
|
+
return `<script src="${w(i)}/install.global.js" data-config='${t}'></script>`;
|
|
59860
60074
|
}
|
|
59861
|
-
function
|
|
59862
|
-
let r = i?.hooks, s = h(e), a = s !== "plain", t =
|
|
60075
|
+
function D(e, i) {
|
|
60076
|
+
let r = i?.hooks, s = h(e), a = s !== "plain", t = w(i), n = ["<!-- Load CSS -->", `<link rel="stylesheet" href="${t}/widget.css" />`, "", "<!-- Load JavaScript -->", `<script src="${t}/index.global.js"></script>`, "", "<!-- Initialize widget -->", "<script>", " var handle = window.AgentWidget.initAgentWidget({", ` target: '${c(i)}',`, ...i?.windowKey ? [` windowKey: '${i.windowKey}',`] : [], " config: {"];
|
|
59863
60077
|
return e.apiUrl && n.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && n.push(` clientToken: "${e.clientToken}",`), e.agentId && n.push(` agentId: "${e.agentId}",`), e.target && n.push(` target: "${e.target}",`), e.flowId && n.push(` flowId: "${e.flowId}",`), a && n.push(` parserType: "${s}",`), e.theme && typeof e.theme == "object" && Object.keys(e.theme).length > 0 && d(n, "theme", e.theme, " "), e.launcher && d(n, "launcher", e.launcher, " "), e.copy && (n.push(" copy: {"), Object.entries(e.copy).forEach(([o, p]) => {
|
|
59864
60078
|
n.push(` ${o}: "${p}",`);
|
|
59865
60079
|
}), n.push(" },")), e.sendButton && (n.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([o, p]) => {
|
|
@@ -59872,14 +60086,14 @@ function J(e, i) {
|
|
|
59872
60086
|
n.push(` ${o}: ${p},`);
|
|
59873
60087
|
}), n.push(" },")), n.push(...y(e, " ")), e.suggestionChips && e.suggestionChips.length > 0 && (n.push(" suggestionChips: ["), e.suggestionChips.forEach((o) => {
|
|
59874
60088
|
n.push(` "${o}",`);
|
|
59875
|
-
}), n.push(" ],")), e.suggestionChipsConfig && (n.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && n.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && n.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && n.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && n.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), n.push(" },")), n.push(...g(e, " ")), n.push(...m(e, " ", r)), n.push(...f(e, " ")), n.push(...
|
|
60089
|
+
}), n.push(" ],")), e.suggestionChipsConfig && (n.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && n.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && n.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && n.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && n.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), n.push(" },")), n.push(...g(e, " ")), n.push(...m(e, " ", r)), n.push(...f(e, " ")), n.push(...b(e, " ")), n.push(...$(r, " ")), e.debug && n.push(` debug: ${e.debug},`), r?.postprocessMessage ? n.push(` postprocessMessage: ${r.postprocessMessage}`) : n.push(" postprocessMessage: ({ text }) => window.AgentWidget.markdownPostprocessor(text)"), n.push(" }"), n.push(" });"), n.push("</script>"), n.join(`
|
|
59876
60090
|
`);
|
|
59877
60091
|
}
|
|
59878
|
-
function
|
|
59879
|
-
let r = i?.hooks, s =
|
|
60092
|
+
function J(e, i) {
|
|
60093
|
+
let r = i?.hooks, s = k(e), t = ["<script>", "(function() {", " 'use strict';", "", " // Configuration", ` var CONFIG = ${JSON.stringify(s, null, 2).split(`
|
|
59880
60094
|
`).map((n, o) => o === 0 ? n : " " + n).join(`
|
|
59881
|
-
`)};`, "", " // Constants", ` var CDN_BASE = '${
|
|
59882
|
-
return r?.getHeaders && (t.push(` widgetConfig.getHeaders = ${r.getHeaders};`), t.push("")), r?.contextProviders && (t.push(` widgetConfig.contextProviders = ${r.contextProviders};`), t.push("")), r?.streamParser ? t.push(` widgetConfig.streamParser = ${r.streamParser};`) : (t.push(" // Flexible JSON stream parser for handling structured actions"), t.push(" widgetConfig.streamParser = function() {"), t.push(` return agentWidget.createFlexibleJsonStreamParser(${T});`), t.push(" };")), t.push(""), r?.actionParsers ? (t.push(" // Action parsers (custom merged with defaults)"), t.push(` var customParsers = ${r.actionParsers};`), t.push(" widgetConfig.actionParsers = customParsers.concat(["), t.push(" agentWidget.defaultJsonActionParser,"), t.push(` ${
|
|
60095
|
+
`)};`, "", " // Constants", ` var CDN_BASE = '${w(i)}';`, " var STORAGE_KEY = 'chat-widget-state';", " var PROCESSED_ACTIONS_KEY = 'chat-widget-processed-actions';", "", " // DOM context provider - extracts page elements for AI context", " var domContextProvider = function() {", " var selectors = {", ` products: '[data-product-id], .product-card, .product-item, [role="article"]',`, ` buttons: 'button, [role="button"], .btn',`, " links: 'a[href]',", " inputs: 'input, textarea, select'", " };", "", " var elements = [];", " Object.entries(selectors).forEach(function(entry) {", " var type = entry[0], selector = entry[1];", " document.querySelectorAll(selector).forEach(function(element) {", " if (!(element instanceof HTMLElement)) return;", " var widgetHost = element.closest('.persona-host');", " if (widgetHost) return;", " var text = element.innerText ? element.innerText.trim() : '';", " if (!text) return;", "", " var selectorString = element.id ? '#' + element.id :", ` element.getAttribute('data-testid') ? '[data-testid="' + element.getAttribute('data-testid') + '"]' :`, ` element.getAttribute('data-product-id') ? '[data-product-id="' + element.getAttribute('data-product-id') + '"]' :`, " element.tagName.toLowerCase();", "", " var elementData = {", " type: type,", " tagName: element.tagName.toLowerCase(),", " selector: selectorString,", " innerText: text.substring(0, 200)", " };", "", " if (type === 'links' && element instanceof HTMLAnchorElement && element.href) {", " elementData.href = element.href;", " }", " elements.push(elementData);", " });", " });", "", " var counts = elements.reduce(function(acc, el) {", " acc[el.type] = (acc[el.type] || 0) + 1;", " return acc;", " }, {});", "", " return {", " page_elements: elements.slice(0, 50),", " page_element_count: elements.length,", " element_types: counts,", " page_url: window.location.href,", " page_title: document.title,", " timestamp: new Date().toISOString()", " };", " };", "", " // Load CSS dynamically", " var loadCSS = function() {", " if (document.querySelector('link[data-persona]')) return;", " var link = document.createElement('link');", " link.rel = 'stylesheet';", " link.href = CDN_BASE + '/widget.css';", " link.setAttribute('data-persona', 'true');", " document.head.appendChild(link);", " };", "", " // Load JS dynamically", " var loadJS = function(callback) {", " if (window.AgentWidget) { callback(); return; }", " var script = document.createElement('script');", " script.src = CDN_BASE + '/index.global.js';", " script.onload = callback;", " script.onerror = function() { console.error('Failed to load AgentWidget'); };", " document.head.appendChild(script);", " };", "", " // Create widget config with advanced features", " var createWidgetConfig = function(agentWidget) {", " var widgetConfig = Object.assign({}, CONFIG);", ""];
|
|
60096
|
+
return r?.getHeaders && (t.push(` widgetConfig.getHeaders = ${r.getHeaders};`), t.push("")), r?.contextProviders && (t.push(` widgetConfig.contextProviders = ${r.contextProviders};`), t.push("")), r?.streamParser ? t.push(` widgetConfig.streamParser = ${r.streamParser};`) : (t.push(" // Flexible JSON stream parser for handling structured actions"), t.push(" widgetConfig.streamParser = function() {"), t.push(` return agentWidget.createFlexibleJsonStreamParser(${T});`), t.push(" };")), t.push(""), r?.actionParsers ? (t.push(" // Action parsers (custom merged with defaults)"), t.push(` var customParsers = ${r.actionParsers};`), t.push(" widgetConfig.actionParsers = customParsers.concat(["), t.push(" agentWidget.defaultJsonActionParser,"), t.push(` ${A}`), t.push(" ]);")) : (t.push(" // Action parsers to detect JSON actions in responses"), t.push(" widgetConfig.actionParsers = ["), t.push(" agentWidget.defaultJsonActionParser,"), t.push(` ${A}`), t.push(" ];")), t.push(""), r?.actionHandlers ? (t.push(" // Action handlers (custom merged with defaults)"), t.push(` var customHandlers = ${r.actionHandlers};`), t.push(" widgetConfig.actionHandlers = customHandlers.concat(["), t.push(" agentWidget.defaultActionHandlers.message,"), t.push(" agentWidget.defaultActionHandlers.messageAndClick,"), t.push(` ${E}`), t.push(" ]);")) : (t.push(" // Action handlers for navigation and other actions"), t.push(" widgetConfig.actionHandlers = ["), t.push(" agentWidget.defaultActionHandlers.message,"), t.push(" agentWidget.defaultActionHandlers.messageAndClick,"), t.push(` ${E}`), t.push(" ];")), t.push(""), r?.requestMiddleware ? (t.push(" // Request middleware (custom merged with DOM context)"), t.push(" widgetConfig.requestMiddleware = function(ctx) {"), t.push(` var customResult = (${r.requestMiddleware})(ctx);`), t.push(" var merged = customResult || ctx.payload;"), t.push(" return Object.assign({}, merged, { metadata: Object.assign({}, merged.metadata, domContextProvider()) });"), t.push(" };")) : (t.push(" // Send DOM context with each request"), t.push(" widgetConfig.requestMiddleware = function(ctx) {"), t.push(" return Object.assign({}, ctx.payload, { metadata: domContextProvider() });"), t.push(" };")), t.push(""), r?.postprocessMessage ? t.push(` widgetConfig.postprocessMessage = ${r.postprocessMessage};`) : (t.push(" // Markdown postprocessor"), t.push(" widgetConfig.postprocessMessage = function(ctx) {"), t.push(" return agentWidget.markdownPostprocessor(ctx.text);"), t.push(" };")), t.push(""), (r?.onFeedback || r?.onCopy) && (t.push(" // Message action callbacks"), t.push(" widgetConfig.messageActions = widgetConfig.messageActions || {};"), r?.onFeedback && t.push(` widgetConfig.messageActions.onFeedback = ${r.onFeedback};`), r?.onCopy && t.push(` widgetConfig.messageActions.onCopy = ${r.onCopy};`), t.push("")), t.push(" return widgetConfig;", " };", "", " // Initialize widget", " var init = function() {", " var agentWidget = window.AgentWidget;", " if (!agentWidget) {", " console.error('AgentWidget not loaded');", " return;", " }", "", " var widgetConfig = createWidgetConfig(agentWidget);", "", " // Load saved state", " var savedState = localStorage.getItem(STORAGE_KEY);", " if (savedState) {", " try {", " var parsed = JSON.parse(savedState);", " widgetConfig.initialMessages = parsed.messages || [];", " } catch (e) {", " console.error('Failed to load saved state:', e);", " }", " }", "", " // Initialize widget", " var handle = agentWidget.initAgentWidget({", ` target: '${c(i)}',`, " useShadowDom: false,", ...i?.windowKey ? [` windowKey: '${i.windowKey}',`] : [], " config: widgetConfig", " });", "", " // Save state on message events", " window.addEventListener('persona:message', function() {", " var session = handle.getSession ? handle.getSession() : null;", " if (session) {", " localStorage.setItem(STORAGE_KEY, JSON.stringify({", " messages: session.messages,", " timestamp: new Date().toISOString()", " }));", " }", " });", "", " // Clear state on clear chat", " window.addEventListener('persona:clear-chat', function() {", " localStorage.removeItem(STORAGE_KEY);", " localStorage.removeItem(PROCESSED_ACTIONS_KEY);", " });", " };", "", " // Wait for framework hydration to complete (Next.js, Nuxt, etc.)", " // This prevents the framework from removing dynamically added CSS during reconciliation", " var waitForHydration = function(callback) {", " var executed = false;", " ", " var execute = function() {", " if (executed) return;", " executed = true;", " callback();", " };", "", " var afterDom = function() {", " // Strategy 1: Use requestIdleCallback if available (best for detecting idle after hydration)", " if (typeof requestIdleCallback !== 'undefined') {", " requestIdleCallback(function() {", " // Double requestAnimationFrame ensures at least one full paint cycle completed", " requestAnimationFrame(function() {", " requestAnimationFrame(execute);", " });", " }, { timeout: 3000 }); // Max wait 3 seconds, then proceed anyway", " } else {", " // Strategy 2: Fallback for Safari (no requestIdleCallback)", " // 300ms is typically enough for hydration on most pages", " setTimeout(execute, 300);", " }", " };", "", " if (document.readyState === 'loading') {", " document.addEventListener('DOMContentLoaded', afterDom);", " } else {", " // DOM already ready, but still wait for potential hydration", " afterDom();", " }", " };", "", " // Boot sequence: wait for hydration, then load CSS and JS, then initialize", " // This prevents Next.js/Nuxt/etc. from removing dynamically added CSS during reconciliation", " waitForHydration(function() {", " loadCSS();", " loadJS(function() {", " init();", " });", " });", "})();", "</script>"), t.join(`
|
|
59883
60097
|
`);
|
|
59884
60098
|
}
|
|
59885
60099
|
|
|
@@ -62549,7 +62763,7 @@ var tailCommand = new Command29("tail").description("Stream live execution logs
|
|
|
62549
62763
|
});
|
|
62550
62764
|
|
|
62551
62765
|
// src/commands/validate-product.ts
|
|
62552
|
-
import { Command as Command30, Option } from "commander";
|
|
62766
|
+
import { Command as Command30, Option as Option2 } from "commander";
|
|
62553
62767
|
import chalk38 from "chalk";
|
|
62554
62768
|
import { readFileSync as readFileSync18 } from "fs";
|
|
62555
62769
|
function createValidateProductCommand() {
|
|
@@ -62557,7 +62771,7 @@ function createValidateProductCommand() {
|
|
|
62557
62771
|
"[input]",
|
|
62558
62772
|
'Path to JSON file, raw JSON string (starts with "{"), or "-" for stdin'
|
|
62559
62773
|
).option("--template", "Force FPO template validation").option("--fpo", "Force FPO (non-template) validation").addOption(
|
|
62560
|
-
new
|
|
62774
|
+
new Option2("--json", "Output the full validation result as JSON").default(void 0)
|
|
62561
62775
|
).option("-q, --quiet", "Suppress output; rely on exit code only").addHelpText(
|
|
62562
62776
|
"after",
|
|
62563
62777
|
`
|
|
@@ -63751,7 +63965,6 @@ function collectExportedExecutionInventory(definition) {
|
|
|
63751
63965
|
walkTools(agent.config.tools);
|
|
63752
63966
|
}
|
|
63753
63967
|
if (isObject2(agent.claudeManagedConfig)) addModel(agent.claudeManagedConfig.model);
|
|
63754
|
-
if (isObject2(agent.primaryFlow)) walkFlow(agent.primaryFlow);
|
|
63755
63968
|
if (Array.isArray(agent.capabilities)) {
|
|
63756
63969
|
for (const capability of agent.capabilities) {
|
|
63757
63970
|
if (!isObject2(capability)) continue;
|
|
@@ -63790,18 +64003,31 @@ function collectDeploymentSecretInventory(agentDef) {
|
|
|
63790
64003
|
function slugify2(s) {
|
|
63791
64004
|
return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 63);
|
|
63792
64005
|
}
|
|
63793
|
-
var
|
|
64006
|
+
var RETIRED_DEPLOY_FLOW_MESSAGE = [
|
|
64007
|
+
"Error: `runtype deploy --flow` is retired (ADR 0024).",
|
|
64008
|
+
" The scaffold wrapped an exported flow in a primary-flow agent, and that agent execution mode is gone.",
|
|
64009
|
+
" Two ways to deploy a flow instead:",
|
|
64010
|
+
" 1. Attach the flow to an agent as a runtime tool ({ toolType: 'flow', flowId }), then deploy that agent:",
|
|
64011
|
+
" runtype deploy --agent <agentId>",
|
|
64012
|
+
" 2. Run the flow on the hosted API without scaffolding anything:",
|
|
64013
|
+
" runtype dispatch --flow <flowId>"
|
|
64014
|
+
];
|
|
64015
|
+
var deployCommand = new Command31("deploy").description("Export an agent and scaffold a deployment (cloud-run, cloudflare, or vercel)").option("--agent <id>", "Agent ID to export (may be repeated)", (v2, acc) => {
|
|
63794
64016
|
acc.push(v2);
|
|
63795
64017
|
return acc;
|
|
63796
|
-
}, []).option("--flow <id>", "
|
|
64018
|
+
}, []).option("--flow <id>", "Removed (ADR 0024): export the agent that runs the flow instead", (v2, acc) => {
|
|
63797
64019
|
acc.push(v2);
|
|
63798
64020
|
return acc;
|
|
63799
64021
|
}, []).option("--output <dir>", "Output directory for the scaffold (default: ./runtype-deploy)", "./runtype-deploy").option("--name <name>", "Project name used in package.json (default: derived from output dir)").option("--target <target>", "Deployment target: cloud-run, cloudflare, or vercel (default: cloud-run)", "cloud-run").action(
|
|
63800
64022
|
async (options) => {
|
|
63801
64023
|
const agentIds = options.agent;
|
|
63802
64024
|
const flowIds = options.flow;
|
|
63803
|
-
if (
|
|
63804
|
-
console.error(chalk39.
|
|
64025
|
+
if (flowIds.length > 0) {
|
|
64026
|
+
for (const line of RETIRED_DEPLOY_FLOW_MESSAGE) console.error(chalk39.yellow(line));
|
|
64027
|
+
process.exit(1);
|
|
64028
|
+
}
|
|
64029
|
+
if (agentIds.length === 0) {
|
|
64030
|
+
console.error(chalk39.red("Error: provide at least one --agent <id>"));
|
|
63805
64031
|
process.exit(1);
|
|
63806
64032
|
}
|
|
63807
64033
|
const target = options.target;
|
|
@@ -63836,36 +64062,6 @@ Scaffolding ${target} deployment to ${outDir}
|
|
|
63836
64062
|
process.exit(1);
|
|
63837
64063
|
}
|
|
63838
64064
|
}
|
|
63839
|
-
for (const id of flowIds) {
|
|
63840
|
-
process.stdout.write(` Exporting flow ${chalk39.green(id)}... `);
|
|
63841
|
-
try {
|
|
63842
|
-
const def = await client.get(`/flows/${id}/export-runtime`);
|
|
63843
|
-
const wrappedName = String(def.name ?? id);
|
|
63844
|
-
agentDefs.push({
|
|
63845
|
-
id,
|
|
63846
|
-
name: wrappedName,
|
|
63847
|
-
def: {
|
|
63848
|
-
id: def.id,
|
|
63849
|
-
name: wrappedName,
|
|
63850
|
-
description: def.description ?? null,
|
|
63851
|
-
agentType: "runtype",
|
|
63852
|
-
config: {},
|
|
63853
|
-
primaryFlow: def
|
|
63854
|
-
}
|
|
63855
|
-
});
|
|
63856
|
-
process.stdout.write(chalk39.green("\u2713\n"));
|
|
63857
|
-
} catch (err) {
|
|
63858
|
-
const msg = err instanceof RuntypeApiError4 ? err.message : String(err);
|
|
63859
|
-
process.stdout.write(chalk39.red(`\u2717
|
|
63860
|
-
`));
|
|
63861
|
-
console.error(chalk39.red(` Failed to export flow ${id}: ${msg}`));
|
|
63862
|
-
if (err instanceof RuntypeApiError4 && err.statusCode === 404) {
|
|
63863
|
-
console.error(chalk39.yellow(" The export-runtime feature may not be enabled on your account or environment."));
|
|
63864
|
-
console.error(chalk39.gray(" If you have your own environment, try: RUNTYPE_API_URL={API Base URI} runtype deploy ..."));
|
|
63865
|
-
}
|
|
63866
|
-
process.exit(1);
|
|
63867
|
-
}
|
|
63868
|
-
}
|
|
63869
64065
|
const agentSlugs = agentDefs.map(({ name }) => slugify2(name));
|
|
63870
64066
|
const slugSet = /* @__PURE__ */ new Set();
|
|
63871
64067
|
for (let i = 0; i < agentSlugs.length; i++) {
|
|
@@ -65707,10 +65903,10 @@ function parseVersion(version2) {
|
|
|
65707
65903
|
}
|
|
65708
65904
|
function compareVersions(left, right) {
|
|
65709
65905
|
const a = parseVersion(left);
|
|
65710
|
-
const
|
|
65711
|
-
if (!a || !
|
|
65906
|
+
const b2 = parseVersion(right);
|
|
65907
|
+
if (!a || !b2) return 0;
|
|
65712
65908
|
for (let index = 0; index < 3; index++) {
|
|
65713
|
-
const diff = a[index] -
|
|
65909
|
+
const diff = a[index] - b2[index];
|
|
65714
65910
|
if (diff !== 0) return diff;
|
|
65715
65911
|
}
|
|
65716
65912
|
return 0;
|
|
@@ -66623,7 +66819,7 @@ function parseServer(value) {
|
|
|
66623
66819
|
if (value === "standard" || value === "code") return value;
|
|
66624
66820
|
throw new InvalidArgumentError('Allowed values are "standard" and "code"');
|
|
66625
66821
|
}
|
|
66626
|
-
function
|
|
66822
|
+
function parsePositiveInteger2(value) {
|
|
66627
66823
|
const parsed = Number(value);
|
|
66628
66824
|
if (!Number.isSafeInteger(parsed) || parsed <= 0) {
|
|
66629
66825
|
throw new InvalidArgumentError("Timeout must be a positive integer in milliseconds");
|
|
@@ -66740,7 +66936,7 @@ function createMcpCommand(overrides = {}) {
|
|
|
66740
66936
|
).option("--json-body <json>", "Use an inline JSON object as the tool arguments").option("--input <file>", "Read the tool arguments JSON object from a file or - for stdin").option(
|
|
66741
66937
|
"--timeout <ms>",
|
|
66742
66938
|
"Maximum time to wait for the tool result in milliseconds",
|
|
66743
|
-
|
|
66939
|
+
parsePositiveInteger2,
|
|
66744
66940
|
DEFAULT_TOOL_TIMEOUT_MS
|
|
66745
66941
|
)
|
|
66746
66942
|
).action(async (name, options) => {
|