@runtypelabs/cli 2.31.6 → 2.32.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 +465 -282
- package/package.json +7 -5
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');
|
|
@@ -1238,9 +1238,9 @@ function $constructor(name, initializer3, params) {
|
|
|
1238
1238
|
const proto = _2.prototype;
|
|
1239
1239
|
const keys = Object.keys(proto);
|
|
1240
1240
|
for (let i = 0; i < keys.length; i++) {
|
|
1241
|
-
const
|
|
1242
|
-
if (!(
|
|
1243
|
-
inst[
|
|
1241
|
+
const k2 = keys[i];
|
|
1242
|
+
if (!(k2 in inst)) {
|
|
1243
|
+
inst[k2] = proto[k2].bind(inst);
|
|
1244
1244
|
}
|
|
1245
1245
|
}
|
|
1246
1246
|
}
|
|
@@ -1371,7 +1371,7 @@ function assert(_2) {
|
|
|
1371
1371
|
}
|
|
1372
1372
|
function getEnumValues(entries) {
|
|
1373
1373
|
const numericValues = Object.values(entries).filter((v2) => typeof v2 === "number");
|
|
1374
|
-
const values = Object.entries(entries).filter(([
|
|
1374
|
+
const values = Object.entries(entries).filter(([k2, _2]) => numericValues.indexOf(+k2) === -1).map(([_2, v2]) => v2);
|
|
1375
1375
|
return values;
|
|
1376
1376
|
}
|
|
1377
1377
|
function joinValues(array2, separator = "|") {
|
|
@@ -1499,8 +1499,8 @@ var allowsEval = /* @__PURE__ */ cached(() => {
|
|
|
1499
1499
|
return false;
|
|
1500
1500
|
}
|
|
1501
1501
|
try {
|
|
1502
|
-
const
|
|
1503
|
-
new
|
|
1502
|
+
const F2 = Function;
|
|
1503
|
+
new F2("");
|
|
1504
1504
|
return true;
|
|
1505
1505
|
} catch (_2) {
|
|
1506
1506
|
return false;
|
|
@@ -1661,8 +1661,8 @@ function stringifyPrimitive(value) {
|
|
|
1661
1661
|
return `${value}`;
|
|
1662
1662
|
}
|
|
1663
1663
|
function optionalKeys(shape) {
|
|
1664
|
-
return Object.keys(shape).filter((
|
|
1665
|
-
return shape[
|
|
1664
|
+
return Object.keys(shape).filter((k2) => {
|
|
1665
|
+
return shape[k2]._zod.optin === "optional" && shape[k2]._zod.optout === "optional";
|
|
1666
1666
|
});
|
|
1667
1667
|
}
|
|
1668
1668
|
var NUMBER_FORMAT_RANGES = {
|
|
@@ -1762,20 +1762,20 @@ function safeExtend(schema, shape) {
|
|
|
1762
1762
|
});
|
|
1763
1763
|
return clone(schema, def);
|
|
1764
1764
|
}
|
|
1765
|
-
function merge(a,
|
|
1765
|
+
function merge(a, b2) {
|
|
1766
1766
|
if (a._zod.def.checks?.length) {
|
|
1767
1767
|
throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
1768
1768
|
}
|
|
1769
1769
|
const def = mergeDefs(a._zod.def, {
|
|
1770
1770
|
get shape() {
|
|
1771
|
-
const _shape = { ...a._zod.def.shape, ...
|
|
1771
|
+
const _shape = { ...a._zod.def.shape, ...b2._zod.def.shape };
|
|
1772
1772
|
assignProp(this, "shape", _shape);
|
|
1773
1773
|
return _shape;
|
|
1774
1774
|
},
|
|
1775
1775
|
get catchall() {
|
|
1776
|
-
return
|
|
1776
|
+
return b2._zod.def.catchall;
|
|
1777
1777
|
},
|
|
1778
|
-
checks:
|
|
1778
|
+
checks: b2._zod.def.checks ?? []
|
|
1779
1779
|
});
|
|
1780
1780
|
return clone(a, def);
|
|
1781
1781
|
}
|
|
@@ -1939,8 +1939,8 @@ function issue(...args) {
|
|
|
1939
1939
|
return { ...iss };
|
|
1940
1940
|
}
|
|
1941
1941
|
function cleanEnum(obj) {
|
|
1942
|
-
return Object.entries(obj).filter(([
|
|
1943
|
-
return Number.isNaN(Number.parseInt(
|
|
1942
|
+
return Object.entries(obj).filter(([k2, _2]) => {
|
|
1943
|
+
return Number.isNaN(Number.parseInt(k2, 10));
|
|
1944
1944
|
}).map((el) => el[1]);
|
|
1945
1945
|
}
|
|
1946
1946
|
function base64ToUint8Array(base643) {
|
|
@@ -1978,7 +1978,7 @@ function hexToUint8Array(hex3) {
|
|
|
1978
1978
|
return bytes;
|
|
1979
1979
|
}
|
|
1980
1980
|
function uint8ArrayToHex(bytes) {
|
|
1981
|
-
return Array.from(bytes).map((
|
|
1981
|
+
return Array.from(bytes).map((b2) => b2.toString(16).padStart(2, "0")).join("");
|
|
1982
1982
|
}
|
|
1983
1983
|
var Class = class {
|
|
1984
1984
|
constructor(..._args) {
|
|
@@ -2115,7 +2115,7 @@ function toDotPath(_path) {
|
|
|
2115
2115
|
}
|
|
2116
2116
|
function prettifyError(error51) {
|
|
2117
2117
|
const lines = [];
|
|
2118
|
-
const issues = [...error51.issues].sort((a,
|
|
2118
|
+
const issues = [...error51.issues].sort((a, b2) => (a.path ?? []).length - (b2.path ?? []).length);
|
|
2119
2119
|
for (const issue2 of issues) {
|
|
2120
2120
|
lines.push(`\u2716 ${issue2.message}`);
|
|
2121
2121
|
if (issue2.path?.length)
|
|
@@ -2947,11 +2947,11 @@ var Doc = class {
|
|
|
2947
2947
|
}
|
|
2948
2948
|
}
|
|
2949
2949
|
compile() {
|
|
2950
|
-
const
|
|
2950
|
+
const F2 = Function;
|
|
2951
2951
|
const args = this?.args;
|
|
2952
2952
|
const content = this?.content ?? [``];
|
|
2953
2953
|
const lines = [...content.map((x2) => ` ${x2}`)];
|
|
2954
|
-
return new
|
|
2954
|
+
return new F2(...args, lines.join("\n"));
|
|
2955
2955
|
}
|
|
2956
2956
|
};
|
|
2957
2957
|
|
|
@@ -3648,9 +3648,9 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
3648
3648
|
}
|
|
3649
3649
|
function normalizeDef(def) {
|
|
3650
3650
|
const keys = Object.keys(def.shape);
|
|
3651
|
-
for (const
|
|
3652
|
-
if (!def.shape?.[
|
|
3653
|
-
throw new Error(`Invalid element at key "${
|
|
3651
|
+
for (const k2 of keys) {
|
|
3652
|
+
if (!def.shape?.[k2]?._zod?.traits?.has("$ZodType")) {
|
|
3653
|
+
throw new Error(`Invalid element at key "${k2}": expected a Zod schema`);
|
|
3654
3654
|
}
|
|
3655
3655
|
}
|
|
3656
3656
|
const okeys = optionalKeys(def.shape);
|
|
@@ -3771,8 +3771,8 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3771
3771
|
const doc = new Doc(["shape", "payload", "ctx"]);
|
|
3772
3772
|
const normalized = _normalized.value;
|
|
3773
3773
|
const parseStr = (key) => {
|
|
3774
|
-
const
|
|
3775
|
-
return `shape[${
|
|
3774
|
+
const k2 = esc(key);
|
|
3775
|
+
return `shape[${k2}]._zod.run({ value: input[${k2}], issues: [] }, ctx)`;
|
|
3776
3776
|
};
|
|
3777
3777
|
doc.write(`const input = payload.value;`);
|
|
3778
3778
|
const ids = /* @__PURE__ */ Object.create(null);
|
|
@@ -3783,7 +3783,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3783
3783
|
doc.write(`const newResult = {};`);
|
|
3784
3784
|
for (const key of normalized.keys) {
|
|
3785
3785
|
const id = ids[key];
|
|
3786
|
-
const
|
|
3786
|
+
const k2 = esc(key);
|
|
3787
3787
|
const schema = shape[key];
|
|
3788
3788
|
const isOptionalIn = schema?._zod?.optin === "optional";
|
|
3789
3789
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
@@ -3791,30 +3791,30 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3791
3791
|
if (isOptionalIn && isOptionalOut) {
|
|
3792
3792
|
doc.write(`
|
|
3793
3793
|
if (${id}.issues.length) {
|
|
3794
|
-
if (${
|
|
3794
|
+
if (${k2} in input) {
|
|
3795
3795
|
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
3796
3796
|
...iss,
|
|
3797
|
-
path: iss.path ? [${
|
|
3797
|
+
path: iss.path ? [${k2}, ...iss.path] : [${k2}]
|
|
3798
3798
|
})));
|
|
3799
3799
|
}
|
|
3800
3800
|
}
|
|
3801
3801
|
|
|
3802
3802
|
if (${id}.value === undefined) {
|
|
3803
|
-
if (${
|
|
3804
|
-
newResult[${
|
|
3803
|
+
if (${k2} in input) {
|
|
3804
|
+
newResult[${k2}] = undefined;
|
|
3805
3805
|
}
|
|
3806
3806
|
} else {
|
|
3807
|
-
newResult[${
|
|
3807
|
+
newResult[${k2}] = ${id}.value;
|
|
3808
3808
|
}
|
|
3809
3809
|
|
|
3810
3810
|
`);
|
|
3811
3811
|
} else if (!isOptionalIn) {
|
|
3812
3812
|
doc.write(`
|
|
3813
|
-
const ${id}_present = ${
|
|
3813
|
+
const ${id}_present = ${k2} in input;
|
|
3814
3814
|
if (${id}.issues.length) {
|
|
3815
3815
|
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
3816
3816
|
...iss,
|
|
3817
|
-
path: iss.path ? [${
|
|
3817
|
+
path: iss.path ? [${k2}, ...iss.path] : [${k2}]
|
|
3818
3818
|
})));
|
|
3819
3819
|
}
|
|
3820
3820
|
if (!${id}_present && !${id}.issues.length) {
|
|
@@ -3822,15 +3822,15 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3822
3822
|
code: "invalid_type",
|
|
3823
3823
|
expected: "nonoptional",
|
|
3824
3824
|
input: undefined,
|
|
3825
|
-
path: [${
|
|
3825
|
+
path: [${k2}]
|
|
3826
3826
|
});
|
|
3827
3827
|
}
|
|
3828
3828
|
|
|
3829
3829
|
if (${id}_present) {
|
|
3830
3830
|
if (${id}.value === undefined) {
|
|
3831
|
-
newResult[${
|
|
3831
|
+
newResult[${k2}] = undefined;
|
|
3832
3832
|
} else {
|
|
3833
|
-
newResult[${
|
|
3833
|
+
newResult[${k2}] = ${id}.value;
|
|
3834
3834
|
}
|
|
3835
3835
|
}
|
|
3836
3836
|
|
|
@@ -3840,16 +3840,16 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3840
3840
|
if (${id}.issues.length) {
|
|
3841
3841
|
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
3842
3842
|
...iss,
|
|
3843
|
-
path: iss.path ? [${
|
|
3843
|
+
path: iss.path ? [${k2}, ...iss.path] : [${k2}]
|
|
3844
3844
|
})));
|
|
3845
3845
|
}
|
|
3846
3846
|
|
|
3847
3847
|
if (${id}.value === undefined) {
|
|
3848
|
-
if (${
|
|
3849
|
-
newResult[${
|
|
3848
|
+
if (${k2} in input) {
|
|
3849
|
+
newResult[${k2}] = undefined;
|
|
3850
3850
|
}
|
|
3851
3851
|
} else {
|
|
3852
|
-
newResult[${
|
|
3852
|
+
newResult[${k2}] = ${id}.value;
|
|
3853
3853
|
}
|
|
3854
3854
|
|
|
3855
3855
|
`);
|
|
@@ -4018,11 +4018,11 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
4018
4018
|
const pv = option._zod.propValues;
|
|
4019
4019
|
if (!pv || Object.keys(pv).length === 0)
|
|
4020
4020
|
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
4021
|
-
for (const [
|
|
4022
|
-
if (!propValues[
|
|
4023
|
-
propValues[
|
|
4021
|
+
for (const [k2, v2] of Object.entries(pv)) {
|
|
4022
|
+
if (!propValues[k2])
|
|
4023
|
+
propValues[k2] = /* @__PURE__ */ new Set();
|
|
4024
4024
|
for (const val of v2) {
|
|
4025
|
-
propValues[
|
|
4025
|
+
propValues[k2].add(val);
|
|
4026
4026
|
}
|
|
4027
4027
|
}
|
|
4028
4028
|
}
|
|
@@ -4090,19 +4090,19 @@ var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, d
|
|
|
4090
4090
|
return handleIntersectionResults(payload, left, right);
|
|
4091
4091
|
};
|
|
4092
4092
|
});
|
|
4093
|
-
function mergeValues(a,
|
|
4094
|
-
if (a ===
|
|
4093
|
+
function mergeValues(a, b2) {
|
|
4094
|
+
if (a === b2) {
|
|
4095
4095
|
return { valid: true, data: a };
|
|
4096
4096
|
}
|
|
4097
|
-
if (a instanceof Date &&
|
|
4097
|
+
if (a instanceof Date && b2 instanceof Date && +a === +b2) {
|
|
4098
4098
|
return { valid: true, data: a };
|
|
4099
4099
|
}
|
|
4100
|
-
if (isPlainObject(a) && isPlainObject(
|
|
4101
|
-
const bKeys = Object.keys(
|
|
4100
|
+
if (isPlainObject(a) && isPlainObject(b2)) {
|
|
4101
|
+
const bKeys = Object.keys(b2);
|
|
4102
4102
|
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
4103
|
-
const newObj = { ...a, ...
|
|
4103
|
+
const newObj = { ...a, ...b2 };
|
|
4104
4104
|
for (const key of sharedKeys) {
|
|
4105
|
-
const sharedValue = mergeValues(a[key],
|
|
4105
|
+
const sharedValue = mergeValues(a[key], b2[key]);
|
|
4106
4106
|
if (!sharedValue.valid) {
|
|
4107
4107
|
return {
|
|
4108
4108
|
valid: false,
|
|
@@ -4113,14 +4113,14 @@ function mergeValues(a, b) {
|
|
|
4113
4113
|
}
|
|
4114
4114
|
return { valid: true, data: newObj };
|
|
4115
4115
|
}
|
|
4116
|
-
if (Array.isArray(a) && Array.isArray(
|
|
4117
|
-
if (a.length !==
|
|
4116
|
+
if (Array.isArray(a) && Array.isArray(b2)) {
|
|
4117
|
+
if (a.length !== b2.length) {
|
|
4118
4118
|
return { valid: false, mergeErrorPath: [] };
|
|
4119
4119
|
}
|
|
4120
4120
|
const newArray = [];
|
|
4121
4121
|
for (let index = 0; index < a.length; index++) {
|
|
4122
4122
|
const itemA = a[index];
|
|
4123
|
-
const itemB =
|
|
4123
|
+
const itemB = b2[index];
|
|
4124
4124
|
const sharedValue = mergeValues(itemA, itemB);
|
|
4125
4125
|
if (!sharedValue.valid) {
|
|
4126
4126
|
return {
|
|
@@ -4140,10 +4140,10 @@ function handleIntersectionResults(result, left, right) {
|
|
|
4140
4140
|
for (const iss of left.issues) {
|
|
4141
4141
|
if (iss.code === "unrecognized_keys") {
|
|
4142
4142
|
unrecIssue ?? (unrecIssue = iss);
|
|
4143
|
-
for (const
|
|
4144
|
-
if (!unrecKeys.has(
|
|
4145
|
-
unrecKeys.set(
|
|
4146
|
-
unrecKeys.get(
|
|
4143
|
+
for (const k2 of iss.keys) {
|
|
4144
|
+
if (!unrecKeys.has(k2))
|
|
4145
|
+
unrecKeys.set(k2, {});
|
|
4146
|
+
unrecKeys.get(k2).l = true;
|
|
4147
4147
|
}
|
|
4148
4148
|
} else {
|
|
4149
4149
|
result.issues.push(iss);
|
|
@@ -4151,16 +4151,16 @@ function handleIntersectionResults(result, left, right) {
|
|
|
4151
4151
|
}
|
|
4152
4152
|
for (const iss of right.issues) {
|
|
4153
4153
|
if (iss.code === "unrecognized_keys") {
|
|
4154
|
-
for (const
|
|
4155
|
-
if (!unrecKeys.has(
|
|
4156
|
-
unrecKeys.set(
|
|
4157
|
-
unrecKeys.get(
|
|
4154
|
+
for (const k2 of iss.keys) {
|
|
4155
|
+
if (!unrecKeys.has(k2))
|
|
4156
|
+
unrecKeys.set(k2, {});
|
|
4157
|
+
unrecKeys.get(k2).r = true;
|
|
4158
4158
|
}
|
|
4159
4159
|
} else {
|
|
4160
4160
|
result.issues.push(iss);
|
|
4161
4161
|
}
|
|
4162
4162
|
}
|
|
4163
|
-
const bothKeys = [...unrecKeys].filter(([, f2]) => f2.l && f2.r).map(([
|
|
4163
|
+
const bothKeys = [...unrecKeys].filter(([, f2]) => f2.l && f2.r).map(([k2]) => k2);
|
|
4164
4164
|
if (bothKeys.length && unrecIssue) {
|
|
4165
4165
|
result.issues.push({ ...unrecIssue, keys: bothKeys });
|
|
4166
4166
|
}
|
|
@@ -4504,7 +4504,7 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
4504
4504
|
const values = getEnumValues(def.entries);
|
|
4505
4505
|
const valuesSet = new Set(values);
|
|
4506
4506
|
inst._zod.values = valuesSet;
|
|
4507
|
-
inst._zod.pattern = new RegExp(`^(${values.filter((
|
|
4507
|
+
inst._zod.pattern = new RegExp(`^(${values.filter((k2) => propertyKeyTypes.has(typeof k2)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
4508
4508
|
inst._zod.parse = (payload, _ctx) => {
|
|
4509
4509
|
const input = payload.value;
|
|
4510
4510
|
if (valuesSet.has(input)) {
|
|
@@ -4970,9 +4970,9 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
|
|
|
4970
4970
|
return payload;
|
|
4971
4971
|
};
|
|
4972
4972
|
inst.input = (...args) => {
|
|
4973
|
-
const
|
|
4973
|
+
const F2 = inst.constructor;
|
|
4974
4974
|
if (Array.isArray(args[0])) {
|
|
4975
|
-
return new
|
|
4975
|
+
return new F2({
|
|
4976
4976
|
type: "function",
|
|
4977
4977
|
input: new $ZodTuple({
|
|
4978
4978
|
type: "tuple",
|
|
@@ -4982,15 +4982,15 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
|
|
|
4982
4982
|
output: inst._def.output
|
|
4983
4983
|
});
|
|
4984
4984
|
}
|
|
4985
|
-
return new
|
|
4985
|
+
return new F2({
|
|
4986
4986
|
type: "function",
|
|
4987
4987
|
input: args[0],
|
|
4988
4988
|
output: inst._def.output
|
|
4989
4989
|
});
|
|
4990
4990
|
};
|
|
4991
4991
|
inst.output = (output) => {
|
|
4992
|
-
const
|
|
4993
|
-
return new
|
|
4992
|
+
const F2 = inst.constructor;
|
|
4993
|
+
return new F2({
|
|
4994
4994
|
type: "function",
|
|
4995
4995
|
input: inst._def.input,
|
|
4996
4996
|
output
|
|
@@ -12759,14 +12759,14 @@ var intersectionProcessor = (schema, ctx, json2, params) => {
|
|
|
12759
12759
|
...params,
|
|
12760
12760
|
path: [...params.path, "allOf", 0]
|
|
12761
12761
|
});
|
|
12762
|
-
const
|
|
12762
|
+
const b2 = process2(def.right, ctx, {
|
|
12763
12763
|
...params,
|
|
12764
12764
|
path: [...params.path, "allOf", 1]
|
|
12765
12765
|
});
|
|
12766
12766
|
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
12767
12767
|
const allOf = [
|
|
12768
12768
|
...isSimpleIntersection(a) ? a.allOf : [a],
|
|
12769
|
-
...isSimpleIntersection(
|
|
12769
|
+
...isSimpleIntersection(b2) ? b2.allOf : [b2]
|
|
12770
12770
|
];
|
|
12771
12771
|
json2.allOf = allOf;
|
|
12772
12772
|
};
|
|
@@ -14208,11 +14208,11 @@ function record(keyType, valueType, params) {
|
|
|
14208
14208
|
});
|
|
14209
14209
|
}
|
|
14210
14210
|
function partialRecord(keyType, valueType, params) {
|
|
14211
|
-
const
|
|
14212
|
-
|
|
14211
|
+
const k2 = clone(keyType);
|
|
14212
|
+
k2._zod.values = void 0;
|
|
14213
14213
|
return new ZodRecord({
|
|
14214
14214
|
type: "record",
|
|
14215
|
-
keyType:
|
|
14215
|
+
keyType: k2,
|
|
14216
14216
|
valueType,
|
|
14217
14217
|
...util_exports.normalizeParams(params)
|
|
14218
14218
|
});
|
|
@@ -15395,7 +15395,7 @@ function renderDefaultModelStrengthsGuide() {
|
|
|
15395
15395
|
).join("\n");
|
|
15396
15396
|
}
|
|
15397
15397
|
|
|
15398
|
-
// ../shared/dist/chunk-
|
|
15398
|
+
// ../shared/dist/chunk-UB6BK3TZ.mjs
|
|
15399
15399
|
function getNestedValue(obj, path20) {
|
|
15400
15400
|
let normalizedPath = path20;
|
|
15401
15401
|
normalizedPath = normalizedPath.replace(/^\$\.?/, "");
|
|
@@ -17164,6 +17164,14 @@ var AGENT_CONTENT_CONFIG_KEYS = {
|
|
|
17164
17164
|
tenancyStrategy: true
|
|
17165
17165
|
};
|
|
17166
17166
|
var AGENT_CONTENT_CONFIG_KEY_LIST = Object.keys(AGENT_CONTENT_CONFIG_KEYS).sort();
|
|
17167
|
+
function stripTrailingChars(value, char) {
|
|
17168
|
+
const code = char.charCodeAt(0);
|
|
17169
|
+
let end = value.length;
|
|
17170
|
+
while (end > 0 && value.charCodeAt(end - 1) === code) {
|
|
17171
|
+
end--;
|
|
17172
|
+
}
|
|
17173
|
+
return end === value.length ? value : value.slice(0, end);
|
|
17174
|
+
}
|
|
17167
17175
|
var configurationStatusSchema = external_exports.enum(["configured", "needs_configuration", "invalid"]);
|
|
17168
17176
|
var secretDocsUrlSchema = external_exports.url({ protocol: /^https$/ }).max(2048);
|
|
17169
17177
|
var secretRequirementSourceSchema = external_exports.object({
|
|
@@ -17242,9 +17250,17 @@ var productConfigurationSummarySchema = external_exports.object({
|
|
|
17242
17250
|
configurationUrl: external_exports.string(),
|
|
17243
17251
|
handoff: secretHandoffSchema.optional()
|
|
17244
17252
|
});
|
|
17245
|
-
var ORGANIZATION_INTEGRATION_PROVIDERS = ["slack", "telegram", "discord", "linear", "github", "granola"];
|
|
17253
|
+
var ORGANIZATION_INTEGRATION_PROVIDERS = ["slack", "telegram", "discord", "linear", "github", "granola", "google"];
|
|
17246
17254
|
var integrationProviderSchema = external_exports.enum(ORGANIZATION_INTEGRATION_PROVIDERS);
|
|
17247
17255
|
var integrationStatusSchema = external_exports.enum(["active", "revoked", "pending"]);
|
|
17256
|
+
var GOOGLE_SCOPE_BUNDLES = {
|
|
17257
|
+
gmail: ["https://www.googleapis.com/auth/gmail.modify"],
|
|
17258
|
+
calendar: ["https://www.googleapis.com/auth/calendar"],
|
|
17259
|
+
docs: ["https://www.googleapis.com/auth/documents"],
|
|
17260
|
+
sheets: ["https://www.googleapis.com/auth/spreadsheets"],
|
|
17261
|
+
drive: ["https://www.googleapis.com/auth/drive.file"]
|
|
17262
|
+
};
|
|
17263
|
+
var GOOGLE_SCOPE_FEATURES = Object.keys(GOOGLE_SCOPE_BUNDLES);
|
|
17248
17264
|
var FILTER_OPERATORS = [
|
|
17249
17265
|
"eq",
|
|
17250
17266
|
"neq",
|
|
@@ -20677,28 +20693,28 @@ function formatPath(path20) {
|
|
|
20677
20693
|
return acc ? `${acc}.${key}` : key;
|
|
20678
20694
|
}, "");
|
|
20679
20695
|
}
|
|
20680
|
-
function compareIssuePath(a,
|
|
20681
|
-
if (!a && !
|
|
20696
|
+
function compareIssuePath(a, b2) {
|
|
20697
|
+
if (!a && !b2) return 0;
|
|
20682
20698
|
if (!a) return 1;
|
|
20683
|
-
if (!
|
|
20684
|
-
return a.localeCompare(
|
|
20699
|
+
if (!b2) return -1;
|
|
20700
|
+
return a.localeCompare(b2);
|
|
20685
20701
|
}
|
|
20686
20702
|
function sortIssues(issues) {
|
|
20687
|
-
return [...issues].sort((a,
|
|
20703
|
+
return [...issues].sort((a, b2) => {
|
|
20688
20704
|
const aStepIndex = a.step?.index ?? Number.MAX_SAFE_INTEGER;
|
|
20689
|
-
const bStepIndex =
|
|
20705
|
+
const bStepIndex = b2.step?.index ?? Number.MAX_SAFE_INTEGER;
|
|
20690
20706
|
if (aStepIndex !== bStepIndex) {
|
|
20691
20707
|
return aStepIndex - bStepIndex;
|
|
20692
20708
|
}
|
|
20693
|
-
const pathCompare = compareIssuePath(a.path,
|
|
20709
|
+
const pathCompare = compareIssuePath(a.path, b2.path);
|
|
20694
20710
|
if (pathCompare !== 0) {
|
|
20695
20711
|
return pathCompare;
|
|
20696
20712
|
}
|
|
20697
|
-
const codeCompare = a.code.localeCompare(
|
|
20713
|
+
const codeCompare = a.code.localeCompare(b2.code);
|
|
20698
20714
|
if (codeCompare !== 0) {
|
|
20699
20715
|
return codeCompare;
|
|
20700
20716
|
}
|
|
20701
|
-
return a.message.localeCompare(
|
|
20717
|
+
return a.message.localeCompare(b2.message);
|
|
20702
20718
|
});
|
|
20703
20719
|
}
|
|
20704
20720
|
function addIssue(level, issue2, buckets) {
|
|
@@ -22633,6 +22649,24 @@ var EMIT_ARTIFACT_MARKDOWN_TOOL_ID = "emit_artifact_markdown";
|
|
|
22633
22649
|
var EMIT_ARTIFACT_COMPONENT_TOOL_ID = "emit_artifact_component";
|
|
22634
22650
|
var EMIT_ARTIFACT_MARKDOWN_FULL_ID = `builtin:${EMIT_ARTIFACT_MARKDOWN_TOOL_ID}`;
|
|
22635
22651
|
var EMIT_ARTIFACT_COMPONENT_FULL_ID = `builtin:${EMIT_ARTIFACT_COMPONENT_TOOL_ID}`;
|
|
22652
|
+
var IMPLICIT_ARTIFACT_TOOLS = [
|
|
22653
|
+
{
|
|
22654
|
+
artifactType: "component",
|
|
22655
|
+
toolIds: [
|
|
22656
|
+
"browser:request_handoff",
|
|
22657
|
+
"builtin:browser:request_handoff",
|
|
22658
|
+
"browser-request-handoff",
|
|
22659
|
+
"builtin:browser-request-handoff",
|
|
22660
|
+
"browser:handoff",
|
|
22661
|
+
"builtin:browser:handoff"
|
|
22662
|
+
]
|
|
22663
|
+
}
|
|
22664
|
+
];
|
|
22665
|
+
var IMPLICIT_ARTIFACT_TYPE_BY_TOOL_ID = new Map(
|
|
22666
|
+
IMPLICIT_ARTIFACT_TOOLS.flatMap(
|
|
22667
|
+
({ artifactType, toolIds }) => toolIds.map((id) => [id, artifactType])
|
|
22668
|
+
)
|
|
22669
|
+
);
|
|
22636
22670
|
var ORTHOGONAL_PLATFORM_TOOLS = [
|
|
22637
22671
|
{
|
|
22638
22672
|
"id": "orthogonal:agentmail:create_draft",
|
|
@@ -34945,6 +34979,106 @@ var CORE_BUILTIN_TOOLS_REGISTRY = [
|
|
|
34945
34979
|
executionHint: "platform",
|
|
34946
34980
|
platformKeySupport: true
|
|
34947
34981
|
},
|
|
34982
|
+
// -----------------------------------------------------------------------
|
|
34983
|
+
// Live View + human-in-the-loop handoff.
|
|
34984
|
+
// A Live View URL lets a person watch and drive the same browser session the
|
|
34985
|
+
// agent is using; a handoff formally parks the agent until they are done.
|
|
34986
|
+
// -----------------------------------------------------------------------
|
|
34987
|
+
{
|
|
34988
|
+
id: "browser:get_live_view",
|
|
34989
|
+
aliases: ["browser-get-live-view", "browser:live-view"],
|
|
34990
|
+
name: "Browser Live View",
|
|
34991
|
+
description: 'Get a shareable Live View URL for a browser session: a link a person can open to watch the live page and interact with it directly. Use it to show someone what the browser is doing. Anyone holding the link can control the session, so share it only with the person you are helping. Defaults to "tab" mode, the only mode that supports handoff. If you need a human to actually DO something (sign in, solve a CAPTCHA, complete MFA), use browser:request_handoff instead \u2014 it returns the same kind of URL and also tracks when they finish.',
|
|
34992
|
+
category: BuiltInToolCategory.BROWSER,
|
|
34993
|
+
toolGroup: BuiltInToolGroup.BROWSER_USE,
|
|
34994
|
+
providers: [BuiltInToolProvider.MULTI],
|
|
34995
|
+
parametersSchema: {
|
|
34996
|
+
type: "object",
|
|
34997
|
+
properties: {
|
|
34998
|
+
sessionId: {
|
|
34999
|
+
type: "string",
|
|
35000
|
+
description: "The session ID returned by browser:open"
|
|
35001
|
+
},
|
|
35002
|
+
mode: {
|
|
35003
|
+
type: "string",
|
|
35004
|
+
description: 'Live View layout. "tab" shows just the page and is the only mode that supports handoff. "full" and "devtools" expose the DevTools frontend.',
|
|
35005
|
+
enum: ["tab", "full", "devtools"],
|
|
35006
|
+
default: "tab"
|
|
35007
|
+
},
|
|
35008
|
+
expiresInMs: {
|
|
35009
|
+
type: "number",
|
|
35010
|
+
description: "How long the URL stays valid, in milliseconds (min 60000, max 3600000). Defaults to 600000 (10 minutes).",
|
|
35011
|
+
minimum: 6e4,
|
|
35012
|
+
maximum: 36e5,
|
|
35013
|
+
default: 6e5
|
|
35014
|
+
}
|
|
35015
|
+
},
|
|
35016
|
+
required: ["sessionId"]
|
|
35017
|
+
},
|
|
35018
|
+
documentationUrl: BROWSER_SESSION_DOCUMENTATION_URL,
|
|
35019
|
+
requiresApiKey: false,
|
|
35020
|
+
executionHint: "platform",
|
|
35021
|
+
platformKeySupport: true
|
|
35022
|
+
},
|
|
35023
|
+
{
|
|
35024
|
+
id: "browser:request_handoff",
|
|
35025
|
+
aliases: ["browser-request-handoff", "browser:handoff"],
|
|
35026
|
+
name: "Browser Handoff to Human",
|
|
35027
|
+
description: 'Hand control of a browser session to a human, then continue once they are done. Use this the moment the page needs something you cannot or should not do yourself: a login form, an MFA or 2FA prompt, a CAPTCHA, a payment step, or any decision that needs a person. Never guess at credentials \u2014 hand off instead.\n\nWrite "instructions" as a specific, actionable request that names exactly what to do and what should be true when they finish, for example: "Sign in with the team Google account, approve the 2FA prompt on your phone, and stop once the billing dashboard is visible." The human reads this text next to the live page.\n\nThis tool returns IMMEDIATELY and does not wait for the human \u2014 a handoff can take many minutes while a single tool call is capped at 30 seconds. It normally returns "status": "active" plus a Live View URL the person opens to drive the page; they click "Done" or "Failed" in the Live View UI when finished. If the person happens to finish before this call returns it comes back with "status": "completed" and no URL: the work is already done, so do not poll and do not share a link, just carry on. After calling it: share the Live View URL with the user, then poll browser:get_handoff_state until its "status" is "completed" before doing anything else with the session. Only one handoff can be active per session, and a session allows a limited number of handoffs in total, so do not re-request one while polling.\n\nIf a client tool named "wait_for_human_handoff" is present in your tool list, call it immediately after this tool with { liveViewUrl, handoffId, instructions } from this result; it renders the live page inline for the person. Skip it if no such tool is listed.',
|
|
35028
|
+
category: BuiltInToolCategory.BROWSER,
|
|
35029
|
+
toolGroup: BuiltInToolGroup.BROWSER_USE,
|
|
35030
|
+
providers: [BuiltInToolProvider.MULTI],
|
|
35031
|
+
parametersSchema: {
|
|
35032
|
+
type: "object",
|
|
35033
|
+
properties: {
|
|
35034
|
+
sessionId: {
|
|
35035
|
+
type: "string",
|
|
35036
|
+
description: "The session ID returned by browser:open"
|
|
35037
|
+
},
|
|
35038
|
+
instructions: {
|
|
35039
|
+
type: "string",
|
|
35040
|
+
description: "What the human should do, in specific and actionable terms. Shown to them alongside the live page.",
|
|
35041
|
+
minLength: 1,
|
|
35042
|
+
maxLength: 4e3
|
|
35043
|
+
},
|
|
35044
|
+
timeoutMs: {
|
|
35045
|
+
type: "number",
|
|
35046
|
+
description: "How long to wait for the human, in milliseconds (min 30000, max 1800000). Defaults to 600000 (10 minutes). When it elapses the handoff completes with success=false.",
|
|
35047
|
+
minimum: 3e4,
|
|
35048
|
+
maximum: 18e5,
|
|
35049
|
+
default: 6e5
|
|
35050
|
+
}
|
|
35051
|
+
},
|
|
35052
|
+
required: ["sessionId", "instructions"]
|
|
35053
|
+
},
|
|
35054
|
+
documentationUrl: BROWSER_SESSION_DOCUMENTATION_URL,
|
|
35055
|
+
requiresApiKey: false,
|
|
35056
|
+
executionHint: "platform",
|
|
35057
|
+
platformKeySupport: true
|
|
35058
|
+
},
|
|
35059
|
+
{
|
|
35060
|
+
id: "browser:get_handoff_state",
|
|
35061
|
+
aliases: ["browser-get-handoff-state", "browser:handoff-state"],
|
|
35062
|
+
name: "Browser Handoff State",
|
|
35063
|
+
description: 'Check whether a browser session is still waiting on a human or the handoff has finished. Returns "status": "active" while the person is working, "completed" once they clicked Done or Failed (or the handoff timed out), and "none" if no handoff was ever requested. A completed result also carries the "success" verdict and any reason they gave. Poll this after browser:request_handoff rather than blocking; it returns fast. Keep polling while status is "active"; once it is "completed", resume the task. If "success" is false or absent, take a screenshot with browser:session-screenshot to confirm the real page state before you continue. A result with "reconciled": false means the browser could not be consulted and the status is a best guess, so poll again before acting on it.',
|
|
35064
|
+
category: BuiltInToolCategory.BROWSER,
|
|
35065
|
+
toolGroup: BuiltInToolGroup.BROWSER_USE,
|
|
35066
|
+
providers: [BuiltInToolProvider.MULTI],
|
|
35067
|
+
parametersSchema: {
|
|
35068
|
+
type: "object",
|
|
35069
|
+
properties: {
|
|
35070
|
+
sessionId: {
|
|
35071
|
+
type: "string",
|
|
35072
|
+
description: "The session ID returned by browser:open"
|
|
35073
|
+
}
|
|
35074
|
+
},
|
|
35075
|
+
required: ["sessionId"]
|
|
35076
|
+
},
|
|
35077
|
+
documentationUrl: BROWSER_SESSION_DOCUMENTATION_URL,
|
|
35078
|
+
requiresApiKey: false,
|
|
35079
|
+
executionHint: "platform",
|
|
35080
|
+
platformKeySupport: true
|
|
35081
|
+
},
|
|
34948
35082
|
{
|
|
34949
35083
|
id: "browser:agent",
|
|
34950
35084
|
aliases: ["browser-agent", "browser:task", "browser-task"],
|
|
@@ -35447,7 +35581,7 @@ var CORE_BUILTIN_TOOLS_REGISTRY = [
|
|
|
35447
35581
|
{
|
|
35448
35582
|
id: "publish_page",
|
|
35449
35583
|
name: "Publish Page",
|
|
35450
|
-
description: "Publish an HTML page on Runtype's CDN and get back a shareable URL that renders the page inline in the browser. Two source modes: (1) pass `url` to download an HTML file from an HTTP(S) URL, or (2) pass base64-encoded `content` (defaults to `contentType: text/html`) to upload inline HTML directly \u2014 useful when running inside a sandboxed code-execution environment with restricted outbound network. Exactly one of `url` or `content` must be provided. Served inline from a `/preview/` path under a locked-down CSP
|
|
35584
|
+
description: "Publish an HTML page on Runtype's CDN and get back a shareable URL that renders the page inline in the browser. Two source modes: (1) pass `url` to download an HTML file from an HTTP(S) URL, or (2) pass base64-encoded `content` (defaults to `contentType: text/html`) to upload inline HTML directly \u2014 useful when running inside a sandboxed code-execution environment with restricted outbound network. Exactly one of `url` or `content` must be provided. Served inline from a `/preview/` path under a locked-down CSP: no inline scripts, no same-origin scripts, no form submissions, and no network requests except to the Runtype API. The one executable seam is Runtype's own CDN (`https://cdn.runtype.com`), so a Persona chat widget can be embedded using the script-installer form (a `<script src=\u2026>` tag with `data-*` attributes); an inline `<script type=\"module\">` will not run. Any other JavaScript, third-party CDN, or outbound call is blocked. Page URLs are public and expire based on the account's plan (7 days on the default plan; longer or permanent on higher tiers \u2014 check `expiresAt` in the result). Pass `expiresInSeconds` to choose a shorter lifetime; the plan TTL is a hard ceiling. A page can be re-upped to the current plan TTL at the same URL via `POST /v1/assets/:assetId/extend`. Accepts only HTML content. 25 MB max. To host a non-HTML file, or HTML as a permanent downloadable file, use `store_asset` instead.",
|
|
35451
35585
|
category: BuiltInToolCategory.FILE_OPERATIONS,
|
|
35452
35586
|
toolGroup: BuiltInToolGroup.FILE_OUTPUTS,
|
|
35453
35587
|
providers: [BuiltInToolProvider.MULTI],
|
|
@@ -37492,8 +37626,9 @@ var GOOGLE_INTEGRATION = {
|
|
|
37492
37626
|
transport: "http",
|
|
37493
37627
|
url: "",
|
|
37494
37628
|
// Direct API calls - no external proxy needed
|
|
37629
|
+
// Supplied by the token broker at call time from the `provider: 'google'`
|
|
37630
|
+
// organization integration, not pasted by the user. Refresh is automatic.
|
|
37495
37631
|
requiredCredentials: ["googleAccessToken"],
|
|
37496
|
-
// googleRefreshToken is optional but recommended for long-lived access
|
|
37497
37632
|
category: MCPServerCategory.PRODUCTIVITY,
|
|
37498
37633
|
documentationUrl: "https://developers.google.com/workspace",
|
|
37499
37634
|
icon: "google",
|
|
@@ -39029,6 +39164,11 @@ var userProfileFeaturesSchema = external_exports.object({
|
|
|
39029
39164
|
// rule enables it). When false the dashboard renders byte-identical to today
|
|
39030
39165
|
// (personal sentinel, personal/team chooser, personal Schematic identify).
|
|
39031
39166
|
enableWorkspaceModel: external_exports.boolean(),
|
|
39167
|
+
// Gates the "OAuth apps" settings tab in the dashboard (self-serve OAuth
|
|
39168
|
+
// client registration). Driven by the `enable-self-serve-oauth-clients`
|
|
39169
|
+
// boolean flag (fail-closed in production until a rule enables it; non-prod
|
|
39170
|
+
// defaults on). The whole /v1/oauth-clients surface 404s when this is off.
|
|
39171
|
+
enableSelfServeOauthClients: external_exports.boolean(),
|
|
39032
39172
|
// Durable server-side workspace migration state. `workspaceModelReady`
|
|
39033
39173
|
// means the user's workspace pointer is set. `workspaceModelEligible` means
|
|
39034
39174
|
// the user belongs to the new-signup auto-provision cohort; when true while
|
|
@@ -39078,9 +39218,6 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39078
39218
|
"anthropic": "claude-opus-4-7",
|
|
39079
39219
|
"vercel": "anthropic/claude-opus-4.7"
|
|
39080
39220
|
},
|
|
39081
|
-
"claude-opus-4-7-fast": {
|
|
39082
|
-
"vercel": "anthropic/claude-opus-4.7-fast"
|
|
39083
|
-
},
|
|
39084
39221
|
"claude-opus-4-8": {
|
|
39085
39222
|
"anthropic": "claude-opus-4-8",
|
|
39086
39223
|
"vercel": "anthropic/claude-opus-4.8"
|
|
@@ -39100,9 +39237,6 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39100
39237
|
"claude-opus-4.7": {
|
|
39101
39238
|
"vercel": "anthropic/claude-opus-4.7"
|
|
39102
39239
|
},
|
|
39103
|
-
"claude-opus-4.7-fast": {
|
|
39104
|
-
"vercel": "anthropic/claude-opus-4.7-fast"
|
|
39105
|
-
},
|
|
39106
39240
|
"claude-opus-4.8": {
|
|
39107
39241
|
"vercel": "anthropic/claude-opus-4.8"
|
|
39108
39242
|
},
|
|
@@ -39706,8 +39840,12 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39706
39840
|
"vercel": "moonshotai/kimi-k2.7-code-highspeed"
|
|
39707
39841
|
},
|
|
39708
39842
|
"kimi-k3": {
|
|
39843
|
+
"togetherai": "togetherai/moonshotai/Kimi-K3",
|
|
39709
39844
|
"vercel": "moonshotai/kimi-k3"
|
|
39710
39845
|
},
|
|
39846
|
+
"kimi-k3-fast": {
|
|
39847
|
+
"vercel": "moonshotai/kimi-k3-fast"
|
|
39848
|
+
},
|
|
39711
39849
|
"laguna-s-2-1": {
|
|
39712
39850
|
"vercel": "poolside/laguna-s-2.1"
|
|
39713
39851
|
},
|
|
@@ -39847,6 +39985,9 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39847
39985
|
"moonshotai/Kimi-K2.7-Code": {
|
|
39848
39986
|
"togetherai": "togetherai/moonshotai/Kimi-K2.7-Code"
|
|
39849
39987
|
},
|
|
39988
|
+
"moonshotai/Kimi-K3": {
|
|
39989
|
+
"togetherai": "togetherai/moonshotai/Kimi-K3"
|
|
39990
|
+
},
|
|
39850
39991
|
"morph-v3-fast": {
|
|
39851
39992
|
"vercel": "morph/morph-v3-fast"
|
|
39852
39993
|
},
|
|
@@ -40183,7 +40324,7 @@ var PLATFORM_KEY_PROVIDER_MAP = {
|
|
|
40183
40324
|
"mock": false
|
|
40184
40325
|
};
|
|
40185
40326
|
var PLATFORM_KEY_PROVIDERS = new Set(
|
|
40186
|
-
Object.entries(PLATFORM_KEY_PROVIDER_MAP).filter(([, v2]) => v2).map(([
|
|
40327
|
+
Object.entries(PLATFORM_KEY_PROVIDER_MAP).filter(([, v2]) => v2).map(([k2]) => k2)
|
|
40187
40328
|
);
|
|
40188
40329
|
var MANUAL_PROVIDER_MAP_OVERRIDES = {
|
|
40189
40330
|
// Bedrock uses different model ID format
|
|
@@ -41526,10 +41667,7 @@ function extractSecretReferencesFromAnyValue(value, maxDepth = 10) {
|
|
|
41526
41667
|
}
|
|
41527
41668
|
var ACCOUNT_QUERY_PARAM = "account";
|
|
41528
41669
|
function buildDashboardUrl(opts) {
|
|
41529
|
-
|
|
41530
|
-
while (base.endsWith("/")) {
|
|
41531
|
-
base = base.slice(0, -1);
|
|
41532
|
-
}
|
|
41670
|
+
const base = stripTrailingChars(opts.baseUrl, "/");
|
|
41533
41671
|
const path20 = opts.path.startsWith("/") ? opts.path : `/${opts.path}`;
|
|
41534
41672
|
const params = new URLSearchParams();
|
|
41535
41673
|
if (isValidAccountId(opts.account)) {
|
|
@@ -44325,7 +44463,7 @@ var TOOL_CATALOG_FOR_FLOW_GENERATION = (() => {
|
|
|
44325
44463
|
const toolName = tool.id.replace(`orthogonal:${slug}:`, "");
|
|
44326
44464
|
vendorGroups.get(slug).push(toolName);
|
|
44327
44465
|
}
|
|
44328
|
-
const orthogonalLines = Array.from(vendorGroups.entries()).sort(([a], [
|
|
44466
|
+
const orthogonalLines = Array.from(vendorGroups.entries()).sort(([a], [b2]) => a.localeCompare(b2)).map(([slug, tools]) => {
|
|
44329
44467
|
const vendorName = ORTHOGONAL_API_NAMES[slug] ?? slug;
|
|
44330
44468
|
return `- **${vendorName}** (\`platform:orthogonal:${slug}:<tool>\`): ${tools.join(", ")}`;
|
|
44331
44469
|
});
|
|
@@ -44357,6 +44495,7 @@ ${orthogonalLines.join("\n")}
|
|
|
44357
44495
|
- **Rendered web pages, screenshots, structured extraction, or link harvesting** \u2192 \`builtin:browser:markdown\`, \`builtin:browser:snapshot\`, \`builtin:browser:json\`, \`builtin:browser:scrape\`, \`builtin:browser:links\` (stateless, one-shot \u2014 cheap, no session overhead)
|
|
44358
44496
|
- **Autonomous browsing (just want the outcome \u2014 extract data, complete a form, find info on a page)** \u2192 \`builtin:browser:agent\` with a natural-language \`goal\` plus \`startUrl\` (fresh browser) or \`sessionId\` (continue an existing session). Stagehand handles observe/act/extract; you get back text or, with an \`outputSchema\`, structured JSON. Try this BEFORE reaching for the manual session tools below.
|
|
44359
44497
|
- **Interactive browsing (precise control over individual actions)** \u2192 \`builtin:browser:open\` to start a session, then \`builtin:browser:click\`, \`builtin:browser:type\`, \`builtin:browser:scroll\`, \`builtin:browser:session-screenshot\`, \`builtin:browser:evaluate\`, \`builtin:browser:navigate\`, and \`builtin:browser:close\` when done. Session tools maintain cookies and page state across calls but cost more than stateless tools \u2014 prefer stateless tools when a single page read suffices.
|
|
44498
|
+
- **A browser session hits a login, MFA, CAPTCHA, or payment wall** \u2192 \`builtin:browser:request_handoff\` hands the live page to a human via a shareable Live View URL and returns immediately; poll \`builtin:browser:get_handoff_state\` until they finish. \`builtin:browser:get_live_view\` alone just mints a watch/drive URL without parking the agent. Add these to any agent that browses sites requiring authentication.
|
|
44360
44499
|
- **Multi-page rendered crawling** \u2192 use the flow \`crawl\` step instead of repeated \`browser:*\` tool calls
|
|
44361
44500
|
- **Find people / company enrichment** \u2192 \`platform:orthogonal:apollo:people_match\`, \`platform:orthogonal:apollo:organization_enrich\`
|
|
44362
44501
|
- **Send Slack message** \u2192 \`builtin:slack:send_message\`
|
|
@@ -44364,7 +44503,7 @@ ${orthogonalLines.join("\n")}
|
|
|
44364
44503
|
- **Create Linear issue** \u2192 \`builtin:linear:create_issue\`
|
|
44365
44504
|
- **Create GitHub PR** \u2192 \`builtin:github:create_pull_request\`
|
|
44366
44505
|
- **Host a file (public CDN URL or signed private URL)** \u2192 \`builtin:store_asset\` \u2014 pass \`url\` to rehost, or base64 \`content\` + \`contentType\` to upload inline bytes (useful from sandboxed code-execution environments). Served as attachment.
|
|
44367
|
-
- **Publish an HTML page that renders in the browser** \u2192 \`builtin:publish_page\` \u2014 returns a shareable \`/preview/\` URL (public, 7-day TTL, locked-down CSP: no
|
|
44506
|
+
- **Publish an HTML page that renders in the browser** \u2192 \`builtin:publish_page\` \u2014 returns a shareable \`/preview/\` URL (public, 7-day TTL, locked-down CSP: no form-submit, and no scripts or network calls beyond a Persona widget from \`cdn.runtype.com\` calling the Runtype API). Accepts \`url\` or inline base64 HTML. Prefer this over \`store_asset\` whenever you want inline browser rendering.
|
|
44368
44507
|
- **Semantic vector search** \u2192 \`builtin:vector-search\`
|
|
44369
44508
|
- **Text-to-speech** \u2192 \`builtin:elevenlabs-tts\`
|
|
44370
44509
|
- **Speech-to-text** \u2192 \`builtin:elevenlabs-stt\`
|
|
@@ -44423,6 +44562,7 @@ Tools are added to prompt steps via \`tools: { toolIds: ["<id>"] }\`. The AI mod
|
|
|
44423
44562
|
- **Rendered web pages, screenshots, structured extraction, or link harvesting** \u2192 \`builtin:browser:markdown\`, \`builtin:browser:snapshot\`, \`builtin:browser:json\`, \`builtin:browser:scrape\`, \`builtin:browser:links\` (stateless, one-shot)
|
|
44424
44563
|
- **Autonomous browsing (just want the outcome)** \u2192 \`builtin:browser:agent\` with a natural-language \`goal\` plus \`startUrl\` or \`sessionId\` \u2014 try this BEFORE the manual session tools
|
|
44425
44564
|
- **Interactive browsing (precise control)** \u2192 \`builtin:browser:open\`, then \`builtin:browser:click\` / \`type\` / \`scroll\` / \`session-screenshot\` / \`evaluate\` / \`navigate\`, and \`builtin:browser:close\` when done
|
|
44565
|
+
- **Login / MFA / CAPTCHA wall in a browser session** \u2192 \`builtin:browser:request_handoff\` (hands the live page to a human, returns immediately) + \`builtin:browser:get_handoff_state\` to poll for completion
|
|
44426
44566
|
- **Multi-page rendered crawling** \u2192 use the flow \`crawl\` step instead of repeated \`browser:*\` calls
|
|
44427
44567
|
- **Find people / company enrichment** \u2192 \`platform:orthogonal:apollo:people_match\`, \`platform:orthogonal:apollo:organization_enrich\`
|
|
44428
44568
|
- **Send Slack message** \u2192 \`builtin:slack:send_message\`
|
|
@@ -45183,14 +45323,43 @@ var MOCK_INVENTORY_LEVELS = MOCK_PRODUCTS.flatMap(
|
|
|
45183
45323
|
}))
|
|
45184
45324
|
);
|
|
45185
45325
|
var LOCAL_INFERENCE_PROTOCOL_VERSION = 1;
|
|
45326
|
+
var LocalInferenceSurfaceSchema = external_exports.enum(["playground", "flows", "agents"]);
|
|
45186
45327
|
var LocalInferenceSelectionSchema = external_exports.object({
|
|
45187
45328
|
sessionId: external_exports.string().uuid(),
|
|
45188
45329
|
model: external_exports.string().trim().min(1).max(256),
|
|
45189
|
-
backend: external_exports.literal("ollama")
|
|
45330
|
+
backend: external_exports.literal("ollama"),
|
|
45331
|
+
/**
|
|
45332
|
+
* Dashboard surface that created the session. Optional during the rolling
|
|
45333
|
+
* upgrade from protocol v1 clients; new clients always send it.
|
|
45334
|
+
*/
|
|
45335
|
+
surface: LocalInferenceSurfaceSchema.optional()
|
|
45190
45336
|
});
|
|
45191
|
-
var
|
|
45192
|
-
|
|
45193
|
-
|
|
45337
|
+
var LocalInferenceToolCallSchema = external_exports.object({
|
|
45338
|
+
id: external_exports.string().min(1).max(512),
|
|
45339
|
+
name: external_exports.string().min(1).max(256),
|
|
45340
|
+
arguments: external_exports.record(external_exports.string(), external_exports.unknown())
|
|
45341
|
+
});
|
|
45342
|
+
var LocalInferenceMessageSchema = external_exports.discriminatedUnion("role", [
|
|
45343
|
+
external_exports.object({
|
|
45344
|
+
role: external_exports.enum(["system", "user"]),
|
|
45345
|
+
content: external_exports.string().max(1e6)
|
|
45346
|
+
}),
|
|
45347
|
+
external_exports.object({
|
|
45348
|
+
role: external_exports.literal("assistant"),
|
|
45349
|
+
content: external_exports.string().max(1e6),
|
|
45350
|
+
toolCalls: external_exports.array(LocalInferenceToolCallSchema).max(100).optional()
|
|
45351
|
+
}),
|
|
45352
|
+
external_exports.object({
|
|
45353
|
+
role: external_exports.literal("tool"),
|
|
45354
|
+
content: external_exports.string().max(1e6),
|
|
45355
|
+
toolCallId: external_exports.string().min(1).max(512),
|
|
45356
|
+
name: external_exports.string().min(1).max(256)
|
|
45357
|
+
})
|
|
45358
|
+
]);
|
|
45359
|
+
var LocalInferenceToolSchema = external_exports.object({
|
|
45360
|
+
name: external_exports.string().min(1).max(256),
|
|
45361
|
+
description: external_exports.string().max(8e3),
|
|
45362
|
+
parametersSchema: external_exports.record(external_exports.string(), external_exports.unknown())
|
|
45194
45363
|
});
|
|
45195
45364
|
var LocalInferenceInvokeSchema = external_exports.object({
|
|
45196
45365
|
type: external_exports.literal("inference.invoke"),
|
|
@@ -45198,6 +45367,8 @@ var LocalInferenceInvokeSchema = external_exports.object({
|
|
|
45198
45367
|
invocationId: external_exports.string().uuid(),
|
|
45199
45368
|
model: external_exports.string().trim().min(1).max(256),
|
|
45200
45369
|
messages: external_exports.array(LocalInferenceMessageSchema).min(1).max(500),
|
|
45370
|
+
tools: external_exports.array(LocalInferenceToolSchema).min(1).max(50).optional(),
|
|
45371
|
+
toolChoice: external_exports.enum(["auto", "required", "none"]).optional(),
|
|
45201
45372
|
temperature: external_exports.number().finite().min(0).max(2).optional(),
|
|
45202
45373
|
maxTokens: external_exports.number().int().positive().max(131072).optional()
|
|
45203
45374
|
});
|
|
@@ -45226,6 +45397,13 @@ var LocalInferenceClientFrameSchema = external_exports.discriminatedUnion("type"
|
|
|
45226
45397
|
sequence: external_exports.number().int().nonnegative(),
|
|
45227
45398
|
text: external_exports.string().max(256e3)
|
|
45228
45399
|
}),
|
|
45400
|
+
external_exports.object({
|
|
45401
|
+
type: external_exports.literal("inference.tool-call"),
|
|
45402
|
+
protocolVersion: external_exports.literal(LOCAL_INFERENCE_PROTOCOL_VERSION),
|
|
45403
|
+
invocationId: external_exports.string().uuid(),
|
|
45404
|
+
sequence: external_exports.number().int().nonnegative(),
|
|
45405
|
+
toolCall: LocalInferenceToolCallSchema
|
|
45406
|
+
}),
|
|
45229
45407
|
external_exports.object({
|
|
45230
45408
|
type: external_exports.literal("inference.complete"),
|
|
45231
45409
|
protocolVersion: external_exports.literal(LOCAL_INFERENCE_PROTOCOL_VERSION),
|
|
@@ -49881,18 +50059,18 @@ batchCommand.command("summary").description("Show a summary of active and recent
|
|
|
49881
50059
|
console.log(` Recently completed: ${data.recentlyCompleted}`);
|
|
49882
50060
|
if (data.batches.length > 0) {
|
|
49883
50061
|
console.log(chalk9.cyan("\nActive Batches:"));
|
|
49884
|
-
for (const
|
|
50062
|
+
for (const b2 of data.batches) {
|
|
49885
50063
|
console.log(
|
|
49886
|
-
` ${chalk9.green(
|
|
50064
|
+
` ${chalk9.green(b2.id)} ${b2.flowName ?? ""} \u2014 ${b2.status} (${b2.processedRecords}/${b2.totalRecords}, ${b2.progress}%)`
|
|
49887
50065
|
);
|
|
49888
50066
|
}
|
|
49889
50067
|
}
|
|
49890
50068
|
if (data.recent.length > 0) {
|
|
49891
50069
|
console.log(chalk9.cyan("\nRecently Completed:"));
|
|
49892
|
-
for (const
|
|
49893
|
-
const statusColor =
|
|
50070
|
+
for (const b2 of data.recent) {
|
|
50071
|
+
const statusColor = b2.status === "completed" ? chalk9.green(b2.status) : chalk9.red(b2.status);
|
|
49894
50072
|
console.log(
|
|
49895
|
-
` ${chalk9.green(
|
|
50073
|
+
` ${chalk9.green(b2.id)} ${b2.flowName ?? ""} \u2014 ${statusColor} (${b2.processedRecords}/${b2.totalRecords})`
|
|
49896
50074
|
);
|
|
49897
50075
|
}
|
|
49898
50076
|
}
|
|
@@ -49921,18 +50099,18 @@ batchCommand.command("summary").description("Show a summary of active and recent
|
|
|
49921
50099
|
{ label: "Active", value: data.activeBatches, color: "green" },
|
|
49922
50100
|
{ label: "Recently completed", value: data.recentlyCompleted }
|
|
49923
50101
|
];
|
|
49924
|
-
for (const
|
|
50102
|
+
for (const b2 of data.batches) {
|
|
49925
50103
|
fields.push({
|
|
49926
|
-
label:
|
|
49927
|
-
value: `${
|
|
50104
|
+
label: b2.id,
|
|
50105
|
+
value: `${b2.flowName ?? ""} \u2014 ${b2.status} (${b2.processedRecords}/${b2.totalRecords}, ${b2.progress}%)`,
|
|
49928
50106
|
color: "yellow"
|
|
49929
50107
|
});
|
|
49930
50108
|
}
|
|
49931
|
-
for (const
|
|
50109
|
+
for (const b2 of data.recent) {
|
|
49932
50110
|
fields.push({
|
|
49933
|
-
label:
|
|
49934
|
-
value: `${
|
|
49935
|
-
color:
|
|
50111
|
+
label: b2.id,
|
|
50112
|
+
value: `${b2.flowName ?? ""} \u2014 ${b2.status} (${b2.processedRecords}/${b2.totalRecords})`,
|
|
50113
|
+
color: b2.status === "completed" ? "green" : "red"
|
|
49936
50114
|
});
|
|
49937
50115
|
}
|
|
49938
50116
|
setResultNode(React6.createElement(EntityCard, { fields }));
|
|
@@ -50096,8 +50274,8 @@ configCommand.command("get [key]").description("Get configuration value").action
|
|
|
50096
50274
|
const allConfig = config2.store;
|
|
50097
50275
|
if (Object.keys(allConfig).length > 0) {
|
|
50098
50276
|
console.log(chalk10.cyan("Current Configuration:"));
|
|
50099
|
-
for (const [
|
|
50100
|
-
console.log(` ${chalk10.green(
|
|
50277
|
+
for (const [k2, v2] of Object.entries(allConfig)) {
|
|
50278
|
+
console.log(` ${chalk10.green(k2)}: ${v2}`);
|
|
50101
50279
|
}
|
|
50102
50280
|
} else {
|
|
50103
50281
|
console.log(chalk10.gray("No configuration set"));
|
|
@@ -51497,7 +51675,7 @@ Keys (${keys.length}):`));
|
|
|
51497
51675
|
const itemSummary = items.length === 0 ? "No items" : items.map(
|
|
51498
51676
|
(i) => `${i.exposedName || i.capabilityName || i.capabilityId}${i.isEntryPoint ? " (entry point)" : ""}`
|
|
51499
51677
|
).join("\n");
|
|
51500
|
-
const keySummary = keys.length === 0 ? "No keys" : keys.map((
|
|
51678
|
+
const keySummary = keys.length === 0 ? "No keys" : keys.map((k2) => `${k2.name ?? "(unnamed)"} ${k2.keyPrefix ?? ""}`.trim()).join("\n");
|
|
51501
51679
|
setResultNode(
|
|
51502
51680
|
React10.createElement(EntityCard, {
|
|
51503
51681
|
fields: [
|
|
@@ -51676,7 +51854,7 @@ logsCommand.command("stats").description("Aggregate log stats: totals, counts by
|
|
|
51676
51854
|
const formatCounts = (counts) => {
|
|
51677
51855
|
const entries = Object.entries(counts);
|
|
51678
51856
|
if (entries.length === 0) return "(none)";
|
|
51679
|
-
return entries.map(([
|
|
51857
|
+
return entries.map(([k2, v2]) => `${k2}=${v2}`).join(", ");
|
|
51680
51858
|
};
|
|
51681
51859
|
if (!isTTY(options) || options.json) {
|
|
51682
51860
|
try {
|
|
@@ -51702,9 +51880,9 @@ Histogram (${histogram.length} buckets):`));
|
|
|
51702
51880
|
if (histogram.length === 0) {
|
|
51703
51881
|
console.log(chalk15.gray(" No data"));
|
|
51704
51882
|
} else {
|
|
51705
|
-
for (const
|
|
51706
|
-
const errPart =
|
|
51707
|
-
console.log(` ${chalk15.dim(
|
|
51883
|
+
for (const b2 of histogram) {
|
|
51884
|
+
const errPart = b2.errors > 0 ? chalk15.red(` (${b2.errors} errors)`) : "";
|
|
51885
|
+
console.log(` ${chalk15.dim(b2.bucket)} ${b2.count}${errPart}`);
|
|
51708
51886
|
}
|
|
51709
51887
|
}
|
|
51710
51888
|
} catch (error51) {
|
|
@@ -51726,7 +51904,7 @@ Histogram (${histogram.length} buckets):`));
|
|
|
51726
51904
|
const stats = res.data;
|
|
51727
51905
|
const histogram = stats.histogram ?? [];
|
|
51728
51906
|
const histogramSummary = histogram.length === 0 ? "No data" : histogram.map(
|
|
51729
|
-
(
|
|
51907
|
+
(b2) => `${b2.bucket}: ${b2.count}${b2.errors > 0 ? ` (${b2.errors} err)` : ""}`
|
|
51730
51908
|
).join("\n");
|
|
51731
51909
|
setResultNode(
|
|
51732
51910
|
React11.createElement(EntityCard, {
|
|
@@ -55766,7 +55944,7 @@ function extractTrackedFiles(snapshots, liveTools, planPath) {
|
|
|
55766
55944
|
result.push({ path: planPath, type: "plan" });
|
|
55767
55945
|
}
|
|
55768
55946
|
const sorted = Array.from(fileMap.values()).sort(
|
|
55769
|
-
(a,
|
|
55947
|
+
(a, b2) => (b2.lastTouchedAt ?? 0) - (a.lastTouchedAt ?? 0)
|
|
55770
55948
|
);
|
|
55771
55949
|
result.push(...sorted);
|
|
55772
55950
|
return result;
|
|
@@ -56997,7 +57175,7 @@ function ModelPicker({ currentModel, onSelect, onCancel, models }) {
|
|
|
56997
57175
|
[contentWidth]
|
|
56998
57176
|
);
|
|
56999
57177
|
const sorted = useMemo7(
|
|
57000
|
-
() => [...availableModels].sort((a,
|
|
57178
|
+
() => [...availableModels].sort((a, b2) => a.group.localeCompare(b2.group)),
|
|
57001
57179
|
[availableModels]
|
|
57002
57180
|
);
|
|
57003
57181
|
const filtered = useMemo7(() => {
|
|
@@ -58356,11 +58534,11 @@ function compactRawStreamEventForCopy(event) {
|
|
|
58356
58534
|
data = JSON.parse(JSON.stringify(event.listData, stringCompactionReplacer));
|
|
58357
58535
|
} else {
|
|
58358
58536
|
data = {};
|
|
58359
|
-
for (const [
|
|
58360
|
-
if (STREAM_EVENT_HEAVY_KEYS.has(
|
|
58361
|
-
data[
|
|
58537
|
+
for (const [k2, v2] of Object.entries(event.data)) {
|
|
58538
|
+
if (STREAM_EVENT_HEAVY_KEYS.has(k2)) {
|
|
58539
|
+
data[k2] = compactHeavyField(v2);
|
|
58362
58540
|
} else {
|
|
58363
|
-
data[
|
|
58541
|
+
data[k2] = compactJsonLike(v2);
|
|
58364
58542
|
}
|
|
58365
58543
|
}
|
|
58366
58544
|
}
|
|
@@ -61376,7 +61554,7 @@ function getSanitizedEnv() {
|
|
|
61376
61554
|
return clean;
|
|
61377
61555
|
}
|
|
61378
61556
|
function redactSecrets(output, secrets) {
|
|
61379
|
-
const sorted = secrets.filter((s) => s.length >= 8).sort((a,
|
|
61557
|
+
const sorted = secrets.filter((s) => s.length >= 8).sort((a, b2) => b2.length - a.length);
|
|
61380
61558
|
let redacted = output;
|
|
61381
61559
|
for (const secret of sorted) {
|
|
61382
61560
|
redacted = redacted.replaceAll(secret, "[REDACTED]");
|
|
@@ -62309,7 +62487,7 @@ function buildTree(dirPath, maxDepth, depth = 0) {
|
|
|
62309
62487
|
return [`${" ".repeat(depth)}[error reading ${normalizeToolPath(dirPath)}: ${message}]`];
|
|
62310
62488
|
}
|
|
62311
62489
|
const lines = [];
|
|
62312
|
-
for (const entry of entries.sort((a,
|
|
62490
|
+
for (const entry of entries.sort((a, b2) => a.name.localeCompare(b2.name))) {
|
|
62313
62491
|
const entryPath = path10.join(dirPath, entry.name);
|
|
62314
62492
|
if (shouldIgnoreRepoEntry(entryPath)) continue;
|
|
62315
62493
|
lines.push(`${" ".repeat(depth)}- ${entry.name}${entry.isDirectory() ? "/" : ""}`);
|
|
@@ -62564,7 +62742,7 @@ function createDefaultLocalTools(context) {
|
|
|
62564
62742
|
});
|
|
62565
62743
|
}
|
|
62566
62744
|
});
|
|
62567
|
-
const matches = candidates.sort((a,
|
|
62745
|
+
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);
|
|
62568
62746
|
return matches.length > 0 ? matches.join("\n") : `No matches found for "${query}" under ${normalizeToolPath(startPath.resolvedPath)}`;
|
|
62569
62747
|
}
|
|
62570
62748
|
},
|
|
@@ -62613,7 +62791,7 @@ function createDefaultLocalTools(context) {
|
|
|
62613
62791
|
});
|
|
62614
62792
|
}
|
|
62615
62793
|
});
|
|
62616
|
-
const rankedMatches = matches.sort((a,
|
|
62794
|
+
const rankedMatches = matches.sort((a, b2) => b2.score - a.score || a.path.localeCompare(b2.path)).map((match) => match.path).slice(0, maxResults);
|
|
62617
62795
|
return rankedMatches.length > 0 ? rankedMatches.join("\n") : `No files matched "${pattern}" under ${normalizeToolPath(startPath.resolvedPath)}`;
|
|
62618
62796
|
}
|
|
62619
62797
|
},
|
|
@@ -67135,14 +67313,14 @@ evalCommand.command("list").description("List eval batches").option("--flow <id>
|
|
|
67135
67313
|
total,
|
|
67136
67314
|
emptyMessage: "No eval batches found",
|
|
67137
67315
|
renderCard: (item) => {
|
|
67138
|
-
const
|
|
67139
|
-
const name =
|
|
67140
|
-
const progress =
|
|
67141
|
-
const statusColor =
|
|
67316
|
+
const b2 = item;
|
|
67317
|
+
const name = b2.name || b2.id;
|
|
67318
|
+
const progress = b2.totalRecords ? `${b2.completedRecords ?? 0}/${b2.totalRecords}` : "";
|
|
67319
|
+
const statusColor = b2.status === "completed" ? "green" : "yellow";
|
|
67142
67320
|
return React20.createElement(
|
|
67143
67321
|
Text34,
|
|
67144
67322
|
{ color: statusColor },
|
|
67145
|
-
` ${
|
|
67323
|
+
` ${b2.id} ${name} [${b2.status}] ${progress}`
|
|
67146
67324
|
);
|
|
67147
67325
|
}
|
|
67148
67326
|
});
|
|
@@ -67525,10 +67703,10 @@ apiKeysCommand.command("list").description("List your API keys").option("--json"
|
|
|
67525
67703
|
total,
|
|
67526
67704
|
emptyMessage: "No API keys found",
|
|
67527
67705
|
renderCard: (item) => {
|
|
67528
|
-
const
|
|
67529
|
-
const prefix =
|
|
67530
|
-
const lastUsed =
|
|
67531
|
-
return React21.createElement(Text35, null, ` ${
|
|
67706
|
+
const k2 = item;
|
|
67707
|
+
const prefix = k2.prefix ? ` (${k2.prefix}...)` : "";
|
|
67708
|
+
const lastUsed = k2.lastUsedAt ? ` last used: ${k2.lastUsedAt}` : "";
|
|
67709
|
+
return React21.createElement(Text35, null, ` ${k2.id} ${k2.name}${prefix}${lastUsed}`);
|
|
67532
67710
|
}
|
|
67533
67711
|
});
|
|
67534
67712
|
};
|
|
@@ -68309,13 +68487,16 @@ import { execFileSync } from "child_process";
|
|
|
68309
68487
|
// src/lib/persona-init.ts
|
|
68310
68488
|
init_credential_store();
|
|
68311
68489
|
|
|
68312
|
-
// ../../node_modules/.pnpm/@runtypelabs+persona@4.
|
|
68313
|
-
var w = "4.
|
|
68314
|
-
var
|
|
68490
|
+
// ../../node_modules/.pnpm/@runtypelabs+persona@4.13.0/node_modules/@runtypelabs/persona/dist/codegen.js
|
|
68491
|
+
var w = "4.13.0";
|
|
68492
|
+
var S = w;
|
|
68493
|
+
function b(e) {
|
|
68494
|
+
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`;
|
|
68495
|
+
}
|
|
68315
68496
|
function u(e) {
|
|
68316
68497
|
if (e !== void 0) return typeof e == "string" ? e : Array.isArray(e) ? `[${e.map((i) => i.toString()).join(", ")}]` : e.toString();
|
|
68317
68498
|
}
|
|
68318
|
-
function
|
|
68499
|
+
function I(e) {
|
|
68319
68500
|
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) };
|
|
68320
68501
|
}
|
|
68321
68502
|
var x = `({ text, message }: any) => {
|
|
@@ -68332,7 +68513,7 @@ var x = `({ text, message }: any) => {
|
|
|
68332
68513
|
} catch (e) { return null; }
|
|
68333
68514
|
return null;
|
|
68334
68515
|
}`;
|
|
68335
|
-
var
|
|
68516
|
+
var A = `function(ctx) {
|
|
68336
68517
|
var jsonSource = ctx.message.rawContent || ctx.text || ctx.message.content;
|
|
68337
68518
|
if (!jsonSource || typeof jsonSource !== 'string') return null;
|
|
68338
68519
|
var cleanJson = jsonSource
|
|
@@ -68346,7 +68527,7 @@ var S = `function(ctx) {
|
|
|
68346
68527
|
} catch (e) { return null; }
|
|
68347
68528
|
return null;
|
|
68348
68529
|
}`;
|
|
68349
|
-
var
|
|
68530
|
+
var j = `(action: any, context: any) => {
|
|
68350
68531
|
if (action.type !== 'nav_then_click') return;
|
|
68351
68532
|
const payload = action.payload || action.raw || {};
|
|
68352
68533
|
const url = payload?.page;
|
|
@@ -68364,7 +68545,7 @@ var A = `(action: any, context: any) => {
|
|
|
68364
68545
|
window.location.href = targetUrl;
|
|
68365
68546
|
return { handled: true, displayText: text };
|
|
68366
68547
|
}`;
|
|
68367
|
-
var
|
|
68548
|
+
var O = `function(action, context) {
|
|
68368
68549
|
if (action.type !== 'nav_then_click') return;
|
|
68369
68550
|
var payload = action.payload || action.raw || {};
|
|
68370
68551
|
var url = payload.page;
|
|
@@ -68389,126 +68570,126 @@ var v = `(parsed: any) => {
|
|
|
68389
68570
|
if (parsed.action === 'message_and_click') return parsed.text || 'Processing...';
|
|
68390
68571
|
return parsed.text || null;
|
|
68391
68572
|
}`;
|
|
68392
|
-
var
|
|
68573
|
+
var _ = `function(parsed) {
|
|
68393
68574
|
if (!parsed || typeof parsed !== 'object') return null;
|
|
68394
68575
|
if (parsed.action === 'nav_then_click') return 'Navigating...';
|
|
68395
68576
|
if (parsed.action === 'message') return parsed.text || '';
|
|
68396
68577
|
if (parsed.action === 'message_and_click') return parsed.text || 'Processing...';
|
|
68397
68578
|
return parsed.text || null;
|
|
68398
68579
|
}`;
|
|
68399
|
-
function
|
|
68580
|
+
function T(e) {
|
|
68400
68581
|
if (!e) return null;
|
|
68401
68582
|
let i = e.toString();
|
|
68402
68583
|
return i.includes("createJsonStreamParser") || i.includes("partial-json") ? "json" : i.includes("createRegexJsonParser") || i.includes("regex") ? "regex-json" : i.includes("createXmlParser") || i.includes("<text>") ? "xml" : null;
|
|
68403
68584
|
}
|
|
68404
|
-
function
|
|
68405
|
-
return e.parserType ??
|
|
68406
|
-
}
|
|
68407
|
-
function
|
|
68408
|
-
let
|
|
68409
|
-
return e.toolCall && (
|
|
68410
|
-
typeof a == "string" &&
|
|
68411
|
-
}),
|
|
68412
|
-
}
|
|
68413
|
-
function
|
|
68414
|
-
let s = [], a = e.messageActions && Object.entries(e.messageActions).some(([
|
|
68415
|
-
return (a || t) && (s.push(`${i}messageActions: {`), e.messageActions && Object.entries(e.messageActions).forEach(([
|
|
68416
|
-
|
|
68417
|
-
}),
|
|
68418
|
-
}
|
|
68419
|
-
function
|
|
68420
|
-
let
|
|
68585
|
+
function h(e) {
|
|
68586
|
+
return e.parserType ?? T(e.streamParser) ?? "plain";
|
|
68587
|
+
}
|
|
68588
|
+
function g(e, i) {
|
|
68589
|
+
let r = [];
|
|
68590
|
+
return e.toolCall && (r.push(`${i}toolCall: {`), Object.entries(e.toolCall).forEach(([s, a]) => {
|
|
68591
|
+
typeof a == "string" && r.push(`${i} ${s}: "${a}",`);
|
|
68592
|
+
}), r.push(`${i}},`)), r;
|
|
68593
|
+
}
|
|
68594
|
+
function m(e, i, r) {
|
|
68595
|
+
let s = [], a = e.messageActions && Object.entries(e.messageActions).some(([n, o]) => n !== "onFeedback" && n !== "onCopy" && o !== void 0), t = r?.onFeedback || r?.onCopy;
|
|
68596
|
+
return (a || t) && (s.push(`${i}messageActions: {`), e.messageActions && Object.entries(e.messageActions).forEach(([n, o]) => {
|
|
68597
|
+
n === "onFeedback" || n === "onCopy" || (typeof o == "string" ? s.push(`${i} ${n}: "${o}",`) : typeof o == "boolean" && s.push(`${i} ${n}: ${o},`));
|
|
68598
|
+
}), r?.onFeedback && s.push(`${i} onFeedback: ${r.onFeedback},`), r?.onCopy && s.push(`${i} onCopy: ${r.onCopy},`), s.push(`${i}},`)), s;
|
|
68599
|
+
}
|
|
68600
|
+
function f(e, i) {
|
|
68601
|
+
let r = [];
|
|
68421
68602
|
if (e.markdown) {
|
|
68422
68603
|
let s = e.markdown.options && Object.keys(e.markdown.options).length > 0, a = e.markdown.disableDefaultStyles !== void 0;
|
|
68423
|
-
(s || a) && (
|
|
68424
|
-
typeof
|
|
68425
|
-
}),
|
|
68604
|
+
(s || a) && (r.push(`${i}markdown: {`), s && (r.push(`${i} options: {`), Object.entries(e.markdown.options).forEach(([t, n]) => {
|
|
68605
|
+
typeof n == "string" ? r.push(`${i} ${t}: "${n}",`) : typeof n == "boolean" && r.push(`${i} ${t}: ${n},`);
|
|
68606
|
+
}), r.push(`${i} },`)), a && r.push(`${i} disableDefaultStyles: ${e.markdown.disableDefaultStyles},`), r.push(`${i}},`));
|
|
68426
68607
|
}
|
|
68427
|
-
return
|
|
68608
|
+
return r;
|
|
68428
68609
|
}
|
|
68429
|
-
function
|
|
68430
|
-
let
|
|
68610
|
+
function y(e, i) {
|
|
68611
|
+
let r = [];
|
|
68431
68612
|
if (e.layout) {
|
|
68432
68613
|
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");
|
|
68433
|
-
(s || a) && (
|
|
68434
|
-
t !== "render" && (typeof
|
|
68435
|
-
}),
|
|
68436
|
-
t === "renderUserMessage" || t === "renderAssistantMessage" || (t === "avatar" && typeof
|
|
68437
|
-
typeof p == "string" ?
|
|
68438
|
-
}),
|
|
68439
|
-
p !== "format" && (typeof l == "string" ?
|
|
68440
|
-
}),
|
|
68441
|
-
}),
|
|
68614
|
+
(s || a) && (r.push(`${i}layout: {`), s && (r.push(`${i} header: {`), Object.entries(e.layout.header).forEach(([t, n]) => {
|
|
68615
|
+
t !== "render" && (typeof n == "string" ? r.push(`${i} ${t}: "${n}",`) : typeof n == "boolean" && r.push(`${i} ${t}: ${n},`));
|
|
68616
|
+
}), r.push(`${i} },`)), a && (r.push(`${i} messages: {`), Object.entries(e.layout.messages).forEach(([t, n]) => {
|
|
68617
|
+
t === "renderUserMessage" || t === "renderAssistantMessage" || (t === "avatar" && typeof n == "object" && n !== null ? (r.push(`${i} avatar: {`), Object.entries(n).forEach(([o, p]) => {
|
|
68618
|
+
typeof p == "string" ? r.push(`${i} ${o}: "${p}",`) : typeof p == "boolean" && r.push(`${i} ${o}: ${p},`);
|
|
68619
|
+
}), r.push(`${i} },`)) : t === "timestamp" && typeof n == "object" && n !== null ? Object.entries(n).some(([p]) => p !== "format") && (r.push(`${i} timestamp: {`), Object.entries(n).forEach(([p, l]) => {
|
|
68620
|
+
p !== "format" && (typeof l == "string" ? r.push(`${i} ${p}: "${l}",`) : typeof l == "boolean" && r.push(`${i} ${p}: ${l},`));
|
|
68621
|
+
}), r.push(`${i} },`)) : typeof n == "string" ? r.push(`${i} ${t}: "${n}",`) : typeof n == "boolean" && r.push(`${i} ${t}: ${n},`));
|
|
68622
|
+
}), r.push(`${i} },`)), r.push(`${i}},`));
|
|
68442
68623
|
}
|
|
68443
|
-
return
|
|
68624
|
+
return r;
|
|
68444
68625
|
}
|
|
68445
68626
|
function $(e, i) {
|
|
68446
|
-
let
|
|
68447
|
-
return e && (e.getHeaders &&
|
|
68627
|
+
let r = [];
|
|
68628
|
+
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;
|
|
68448
68629
|
}
|
|
68449
|
-
function
|
|
68630
|
+
function E(e, i, r) {
|
|
68450
68631
|
Object.entries(i).forEach(([s, a]) => {
|
|
68451
68632
|
if (!(a === void 0 || typeof a == "function")) {
|
|
68452
68633
|
if (Array.isArray(a)) {
|
|
68453
|
-
e.push(`${
|
|
68634
|
+
e.push(`${r}${s}: ${JSON.stringify(a)},`);
|
|
68454
68635
|
return;
|
|
68455
68636
|
}
|
|
68456
68637
|
if (a && typeof a == "object") {
|
|
68457
|
-
e.push(`${
|
|
68638
|
+
e.push(`${r}${s}: {`), E(e, a, `${r} `), e.push(`${r}},`);
|
|
68458
68639
|
return;
|
|
68459
68640
|
}
|
|
68460
|
-
e.push(`${
|
|
68641
|
+
e.push(`${r}${s}: ${JSON.stringify(a)},`);
|
|
68461
68642
|
}
|
|
68462
68643
|
});
|
|
68463
68644
|
}
|
|
68464
|
-
function d(e, i,
|
|
68465
|
-
|
|
68645
|
+
function d(e, i, r, s) {
|
|
68646
|
+
r && (e.push(`${s}${i}: {`), E(e, r, `${s} `), e.push(`${s}},`));
|
|
68466
68647
|
}
|
|
68467
|
-
function
|
|
68648
|
+
function c(e) {
|
|
68468
68649
|
return (e?.target ?? "body").replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
|
68469
68650
|
}
|
|
68470
|
-
function
|
|
68651
|
+
function M(e, i = "esm", r) {
|
|
68471
68652
|
let s = { ...e };
|
|
68472
68653
|
delete s.postprocessMessage, delete s.initialMessages;
|
|
68473
|
-
let a =
|
|
68474
|
-
return i === "esm" ?
|
|
68475
|
-
}
|
|
68476
|
-
function M(e, i) {
|
|
68477
|
-
let n = i?.hooks, s = g(e), a = s !== "plain", t = ["import '@runtypelabs/persona/widget.css';", "import { initAgentWidget, markdownPostprocessor } from '@runtypelabs/persona';", "", "initAgentWidget({", ` target: '${h(i)}',`, " config: {"];
|
|
68478
|
-
return e.apiUrl && t.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && t.push(` clientToken: "${e.clientToken}",`), e.agentId && t.push(` agentId: "${e.agentId}",`), e.target && t.push(` target: "${e.target}",`), e.flowId && t.push(` flowId: "${e.flowId}",`), a && t.push(` parserType: "${s}",`), e.theme && typeof e.theme == "object" && Object.keys(e.theme).length > 0 && d(t, "theme", e.theme, " "), e.launcher && d(t, "launcher", e.launcher, " "), e.copy && (t.push(" copy: {"), Object.entries(e.copy).forEach(([r, o]) => {
|
|
68479
|
-
t.push(` ${r}: "${o}",`);
|
|
68480
|
-
}), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([r, o]) => {
|
|
68481
|
-
typeof o == "string" ? t.push(` ${r}: "${o}",`) : typeof o == "boolean" && t.push(` ${r}: ${o},`);
|
|
68482
|
-
}), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([r, o]) => {
|
|
68483
|
-
typeof o == "string" ? t.push(` ${r}: "${o}",`) : typeof o == "boolean" ? t.push(` ${r}: ${o},`) : typeof o == "number" && t.push(` ${r}: ${o},`);
|
|
68484
|
-
}), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([r, o]) => {
|
|
68485
|
-
typeof o == "string" ? t.push(` ${r}: "${o}",`) : typeof o == "boolean" && t.push(` ${r}: ${o},`);
|
|
68486
|
-
}), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([r, o]) => {
|
|
68487
|
-
t.push(` ${r}: ${o},`);
|
|
68488
|
-
}), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((r) => {
|
|
68489
|
-
t.push(` "${r}",`);
|
|
68490
|
-
}), 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(...m(e, " ")), t.push(...f(e, " ", n)), t.push(...y(e, " ")), t.push(...C(e, " ")), t.push(...$(n, " ")), e.debug && t.push(` debug: ${e.debug},`), n?.postprocessMessage ? t.push(` postprocessMessage: ${n.postprocessMessage}`) : t.push(" postprocessMessage: ({ text }) => markdownPostprocessor(text)"), t.push(" }"), t.push("});"), t.join(`
|
|
68491
|
-
`);
|
|
68654
|
+
let a = r ? { ...r, hooks: I(r.hooks) } : void 0;
|
|
68655
|
+
return i === "esm" ? R(s, a) : i === "script-installer" ? N(s, a) : i === "script-advanced" ? F(s, a) : i === "react-component" ? W(s, a) : i === "react-advanced" ? H(s, a) : D(s, a);
|
|
68492
68656
|
}
|
|
68493
68657
|
function R(e, i) {
|
|
68494
|
-
let
|
|
68495
|
-
return e.apiUrl && t.push(`
|
|
68496
|
-
t.push(`
|
|
68497
|
-
}), t.push("
|
|
68498
|
-
typeof o == "string" ? t.push(`
|
|
68499
|
-
}), t.push("
|
|
68500
|
-
typeof o == "string" ? t.push(`
|
|
68501
|
-
}), t.push("
|
|
68502
|
-
typeof o == "string" ? t.push(`
|
|
68503
|
-
}), t.push("
|
|
68504
|
-
t.push(`
|
|
68505
|
-
}), t.push("
|
|
68506
|
-
t.push(`
|
|
68507
|
-
}), t.push("
|
|
68658
|
+
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: {"];
|
|
68659
|
+
return e.apiUrl && t.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && t.push(` clientToken: "${e.clientToken}",`), e.agentId && t.push(` agentId: "${e.agentId}",`), e.target && t.push(` target: "${e.target}",`), e.flowId && t.push(` flowId: "${e.flowId}",`), a && t.push(` parserType: "${s}",`), e.theme && typeof e.theme == "object" && Object.keys(e.theme).length > 0 && d(t, "theme", e.theme, " "), e.launcher && d(t, "launcher", e.launcher, " "), e.copy && (t.push(" copy: {"), Object.entries(e.copy).forEach(([n, o]) => {
|
|
68660
|
+
t.push(` ${n}: "${o}",`);
|
|
68661
|
+
}), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([n, o]) => {
|
|
68662
|
+
typeof o == "string" ? t.push(` ${n}: "${o}",`) : typeof o == "boolean" && t.push(` ${n}: ${o},`);
|
|
68663
|
+
}), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([n, o]) => {
|
|
68664
|
+
typeof o == "string" ? t.push(` ${n}: "${o}",`) : typeof o == "boolean" ? t.push(` ${n}: ${o},`) : typeof o == "number" && t.push(` ${n}: ${o},`);
|
|
68665
|
+
}), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([n, o]) => {
|
|
68666
|
+
typeof o == "string" ? t.push(` ${n}: "${o}",`) : typeof o == "boolean" && t.push(` ${n}: ${o},`);
|
|
68667
|
+
}), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([n, o]) => {
|
|
68668
|
+
t.push(` ${n}: ${o},`);
|
|
68669
|
+
}), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((n) => {
|
|
68670
|
+
t.push(` "${n}",`);
|
|
68671
|
+
}), 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(...y(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(`
|
|
68508
68672
|
`);
|
|
68509
68673
|
}
|
|
68510
68674
|
function W(e, i) {
|
|
68511
|
-
let
|
|
68675
|
+
let r = i?.hooks, s = h(e), a = s !== "plain", t = ["// ChatWidget.tsx", "'use client'; // Required for Next.js - remove for Vite/CRA", "", "import { useEffect } from 'react';", "import '@runtypelabs/persona/widget.css';", "import { initAgentWidget, markdownPostprocessor } from '@runtypelabs/persona';", "import type { AgentWidgetInitHandle } from '@runtypelabs/persona';", "", "export function ChatWidget() {", " useEffect(() => {", " let handle: AgentWidgetInitHandle | null = null;", "", " handle = initAgentWidget({", ` target: '${c(i)}',`, " config: {"];
|
|
68676
|
+
return e.apiUrl && t.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && t.push(` clientToken: "${e.clientToken}",`), e.agentId && t.push(` agentId: "${e.agentId}",`), e.target && t.push(` target: "${e.target}",`), e.flowId && t.push(` flowId: "${e.flowId}",`), a && t.push(` parserType: "${s}",`), e.theme && typeof e.theme == "object" && Object.keys(e.theme).length > 0 && d(t, "theme", e.theme, " "), e.launcher && d(t, "launcher", e.launcher, " "), e.copy && (t.push(" copy: {"), Object.entries(e.copy).forEach(([n, o]) => {
|
|
68677
|
+
t.push(` ${n}: "${o}",`);
|
|
68678
|
+
}), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([n, o]) => {
|
|
68679
|
+
typeof o == "string" ? t.push(` ${n}: "${o}",`) : typeof o == "boolean" && t.push(` ${n}: ${o},`);
|
|
68680
|
+
}), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([n, o]) => {
|
|
68681
|
+
typeof o == "string" ? t.push(` ${n}: "${o}",`) : typeof o == "boolean" ? t.push(` ${n}: ${o},`) : typeof o == "number" && t.push(` ${n}: ${o},`);
|
|
68682
|
+
}), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([n, o]) => {
|
|
68683
|
+
typeof o == "string" ? t.push(` ${n}: "${o}",`) : typeof o == "boolean" && t.push(` ${n}: ${o},`);
|
|
68684
|
+
}), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([n, o]) => {
|
|
68685
|
+
t.push(` ${n}: ${o},`);
|
|
68686
|
+
}), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((n) => {
|
|
68687
|
+
t.push(` "${n}",`);
|
|
68688
|
+
}), 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(...y(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(`
|
|
68689
|
+
`);
|
|
68690
|
+
}
|
|
68691
|
+
function H(e, i) {
|
|
68692
|
+
let r = i?.hooks, s = ["// ChatWidgetAdvanced.tsx", "'use client'; // Required for Next.js - remove for Vite/CRA", "", "import { useEffect } from 'react';", "import '@runtypelabs/persona/widget.css';", "import {", " initAgentWidget,", " createFlexibleJsonStreamParser,", " defaultJsonActionParser,", " defaultActionHandlers,", " markdownPostprocessor", "} from '@runtypelabs/persona';", "import type { AgentWidgetInitHandle } from '@runtypelabs/persona';", "", "const STORAGE_KEY = 'chat-widget-state';", "const PROCESSED_ACTIONS_KEY = 'chat-widget-processed-actions';", "", "// Types for DOM elements", "interface PageElement {", " type: string;", " tagName: string;", " selector: string;", " innerText: string;", " href?: string;", "}", "", "interface DOMContext {", " page_elements: PageElement[];", " page_element_count: number;", " element_types: Record<string, number>;", " page_url: string;", " page_title: string;", " timestamp: string;", "}", "", "// DOM context provider - extracts page elements for AI context", "const collectDOMContext = (): DOMContext => {", " const selectors = {", ` products: '[data-product-id], .product-card, .product-item, [role="article"]',`, ` buttons: 'button, [role="button"], .btn',`, " links: 'a[href]',", " inputs: 'input, textarea, select'", " };", "", " const elements: PageElement[] = [];", " Object.entries(selectors).forEach(([type, selector]) => {", " document.querySelectorAll(selector).forEach((element) => {", " if (!(element instanceof HTMLElement)) return;", " ", " // Exclude elements within the widget", " const widgetHost = element.closest('.persona-host');", " if (widgetHost) return;", " ", " const text = element.innerText?.trim();", " if (!text) return;", "", " const 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();", "", " const elementData: PageElement = {", " 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);", " });", " });", "", " const counts = elements.reduce((acc, el) => {", " acc[el.type] = (acc[el.type] || 0) + 1;", " return acc;", " }, {} as Record<string, number>);", "", " 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()", " };", "};", "", "export function ChatWidgetAdvanced() {", " useEffect(() => {", " let handle: AgentWidgetInitHandle | null = null;", "", " // Load saved state", " const loadSavedMessages = () => {", " const savedState = localStorage.getItem(STORAGE_KEY);", " if (savedState) {", " try {", " const { messages } = JSON.parse(savedState);", " return messages || [];", " } catch (e) {", " console.error('Failed to load saved state:', e);", " }", " }", " return [];", " };", "", " handle = initAgentWidget({", ` target: '${c(i)}',`, " config: {"];
|
|
68512
68693
|
return e.apiUrl && s.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && s.push(` clientToken: "${e.clientToken}",`), e.agentId && s.push(` agentId: "${e.agentId}",`), e.target && s.push(` target: "${e.target}",`), e.flowId && s.push(` flowId: "${e.flowId}",`), e.theme && typeof e.theme == "object" && Object.keys(e.theme).length > 0 && d(s, "theme", e.theme, " "), e.launcher && d(s, "launcher", e.launcher, " "), e.copy && (s.push(" copy: {"), Object.entries(e.copy).forEach(([a, t]) => {
|
|
68513
68694
|
s.push(` ${a}: "${t}",`);
|
|
68514
68695
|
}), s.push(" },")), e.sendButton && (s.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([a, t]) => {
|
|
@@ -68521,21 +68702,21 @@ function W(e, i) {
|
|
|
68521
68702
|
s.push(` ${a}: ${t},`);
|
|
68522
68703
|
}), s.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (s.push(" suggestionChips: ["), e.suggestionChips.forEach((a) => {
|
|
68523
68704
|
s.push(` "${a}",`);
|
|
68524
|
-
}), 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(...
|
|
68705
|
+
}), 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(...y(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(${v}),`)), 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(` ${x}`), 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(` ${x}`), 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(` ${j}`), 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(` ${j}`), 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(`
|
|
68525
68706
|
`);
|
|
68526
68707
|
}
|
|
68527
|
-
function
|
|
68528
|
-
let i =
|
|
68529
|
-
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),
|
|
68708
|
+
function k(e) {
|
|
68709
|
+
let i = h(e), r = i !== "plain", s = {};
|
|
68710
|
+
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.suggestionChips?.length > 0 && (s.suggestionChips = e.suggestionChips), e.suggestionChipsConfig && (s.suggestionChipsConfig = e.suggestionChipsConfig), e.debug && (s.debug = e.debug), e.toolCall) {
|
|
68530
68711
|
let a = {};
|
|
68531
|
-
Object.entries(e.toolCall).forEach(([t,
|
|
68532
|
-
typeof
|
|
68712
|
+
Object.entries(e.toolCall).forEach(([t, n]) => {
|
|
68713
|
+
typeof n == "string" && (a[t] = n);
|
|
68533
68714
|
}), Object.keys(a).length > 0 && (s.toolCall = a);
|
|
68534
68715
|
}
|
|
68535
68716
|
if (e.messageActions) {
|
|
68536
68717
|
let a = {};
|
|
68537
|
-
Object.entries(e.messageActions).forEach(([t,
|
|
68538
|
-
t !== "onFeedback" && t !== "onCopy" &&
|
|
68718
|
+
Object.entries(e.messageActions).forEach(([t, n]) => {
|
|
68719
|
+
t !== "onFeedback" && t !== "onCopy" && n !== void 0 && (typeof n == "string" || typeof n == "boolean") && (a[t] = n);
|
|
68539
68720
|
}), Object.keys(a).length > 0 && (s.messageActions = a);
|
|
68540
68721
|
}
|
|
68541
68722
|
if (e.markdown) {
|
|
@@ -68546,52 +68727,52 @@ function E(e) {
|
|
|
68546
68727
|
let a = {};
|
|
68547
68728
|
if (e.layout.header) {
|
|
68548
68729
|
let t = {};
|
|
68549
|
-
Object.entries(e.layout.header).forEach(([
|
|
68550
|
-
|
|
68730
|
+
Object.entries(e.layout.header).forEach(([n, o]) => {
|
|
68731
|
+
n !== "render" && (typeof o == "string" || typeof o == "boolean") && (t[n] = o);
|
|
68551
68732
|
}), Object.keys(t).length > 0 && (a.header = t);
|
|
68552
68733
|
}
|
|
68553
68734
|
if (e.layout.messages) {
|
|
68554
68735
|
let t = {};
|
|
68555
|
-
Object.entries(e.layout.messages).forEach(([
|
|
68556
|
-
if (
|
|
68557
|
-
else if (
|
|
68736
|
+
Object.entries(e.layout.messages).forEach(([n, o]) => {
|
|
68737
|
+
if (n !== "renderUserMessage" && n !== "renderAssistantMessage") if (n === "avatar" && typeof o == "object" && o !== null) t.avatar = o;
|
|
68738
|
+
else if (n === "timestamp" && typeof o == "object" && o !== null) {
|
|
68558
68739
|
let p = {};
|
|
68559
|
-
Object.entries(o).forEach(([l,
|
|
68560
|
-
l !== "format" && (typeof
|
|
68740
|
+
Object.entries(o).forEach(([l, C]) => {
|
|
68741
|
+
l !== "format" && (typeof C == "string" || typeof C == "boolean") && (p[l] = C);
|
|
68561
68742
|
}), Object.keys(p).length > 0 && (t.timestamp = p);
|
|
68562
|
-
} else (typeof o == "string" || typeof o == "boolean") && (t[
|
|
68743
|
+
} else (typeof o == "string" || typeof o == "boolean") && (t[n] = o);
|
|
68563
68744
|
}), Object.keys(t).length > 0 && (a.messages = t);
|
|
68564
68745
|
}
|
|
68565
68746
|
Object.keys(a).length > 0 && (s.layout = a);
|
|
68566
68747
|
}
|
|
68567
68748
|
return s;
|
|
68568
68749
|
}
|
|
68569
|
-
function H(e, i) {
|
|
68570
|
-
let n = E(e), a = !!(i?.windowKey || i?.target) ? { config: n, ...i?.windowKey ? { windowKey: i.windowKey } : {}, ...i?.target ? { target: i.target } : {} } : n, t = JSON.stringify(a, null, 0).replace(/'/g, "'");
|
|
68571
|
-
return `<script src="https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${c}/dist/install.global.js" data-config='${t}'></script>`;
|
|
68572
|
-
}
|
|
68573
68750
|
function N(e, i) {
|
|
68574
|
-
let
|
|
68575
|
-
return
|
|
68576
|
-
t.push(` ${r}: "${o}",`);
|
|
68577
|
-
}), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([r, o]) => {
|
|
68578
|
-
typeof o == "string" ? t.push(` ${r}: "${o}",`) : typeof o == "boolean" && t.push(` ${r}: ${o},`);
|
|
68579
|
-
}), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([r, o]) => {
|
|
68580
|
-
typeof o == "string" ? t.push(` ${r}: "${o}",`) : typeof o == "boolean" ? t.push(` ${r}: ${o},`) : typeof o == "number" && t.push(` ${r}: ${o},`);
|
|
68581
|
-
}), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([r, o]) => {
|
|
68582
|
-
typeof o == "string" ? t.push(` ${r}: "${o}",`) : typeof o == "boolean" && t.push(` ${r}: ${o},`);
|
|
68583
|
-
}), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([r, o]) => {
|
|
68584
|
-
t.push(` ${r}: ${o},`);
|
|
68585
|
-
}), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((r) => {
|
|
68586
|
-
t.push(` "${r}",`);
|
|
68587
|
-
}), 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(...m(e, " ")), t.push(...f(e, " ", n)), t.push(...y(e, " ")), t.push(...C(e, " ")), t.push(...$(n, " ")), e.debug && t.push(` debug: ${e.debug},`), n?.postprocessMessage ? t.push(` postprocessMessage: ${n.postprocessMessage}`) : t.push(" postprocessMessage: ({ text }) => window.AgentWidget.markdownPostprocessor(text)"), t.push(" }"), t.push(" });"), t.push("</script>"), t.join(`
|
|
68588
|
-
`);
|
|
68751
|
+
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, "'");
|
|
68752
|
+
return `<script src="${b(i)}/install.global.js" data-config='${t}'></script>`;
|
|
68589
68753
|
}
|
|
68590
68754
|
function D(e, i) {
|
|
68591
|
-
let
|
|
68592
|
-
`).
|
|
68593
|
-
|
|
68594
|
-
|
|
68755
|
+
let r = i?.hooks, s = h(e), a = s !== "plain", t = b(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: {"];
|
|
68756
|
+
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]) => {
|
|
68757
|
+
n.push(` ${o}: "${p}",`);
|
|
68758
|
+
}), n.push(" },")), e.sendButton && (n.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([o, p]) => {
|
|
68759
|
+
typeof p == "string" ? n.push(` ${o}: "${p}",`) : typeof p == "boolean" && n.push(` ${o}: ${p},`);
|
|
68760
|
+
}), n.push(" },")), e.voiceRecognition && (n.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([o, p]) => {
|
|
68761
|
+
typeof p == "string" ? n.push(` ${o}: "${p}",`) : typeof p == "boolean" ? n.push(` ${o}: ${p},`) : typeof p == "number" && n.push(` ${o}: ${p},`);
|
|
68762
|
+
}), n.push(" },")), e.statusIndicator && (n.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([o, p]) => {
|
|
68763
|
+
typeof p == "string" ? n.push(` ${o}: "${p}",`) : typeof p == "boolean" && n.push(` ${o}: ${p},`);
|
|
68764
|
+
}), n.push(" },")), e.features && (n.push(" features: {"), Object.entries(e.features).forEach(([o, p]) => {
|
|
68765
|
+
n.push(` ${o}: ${p},`);
|
|
68766
|
+
}), n.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (n.push(" suggestionChips: ["), e.suggestionChips.forEach((o) => {
|
|
68767
|
+
n.push(` "${o}",`);
|
|
68768
|
+
}), 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(...y(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(`
|
|
68769
|
+
`);
|
|
68770
|
+
}
|
|
68771
|
+
function F(e, i) {
|
|
68772
|
+
let r = i?.hooks, s = k(e), t = ["<script>", "(function() {", " 'use strict';", "", " // Configuration", ` var CONFIG = ${JSON.stringify(s, null, 2).split(`
|
|
68773
|
+
`).map((n, o) => o === 0 ? n : " " + n).join(`
|
|
68774
|
+
`)};`, "", " // Constants", ` var CDN_BASE = '${b(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);", ""];
|
|
68775
|
+
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.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(` ${O}`), 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(` ${O}`), 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(`
|
|
68595
68776
|
`);
|
|
68596
68777
|
}
|
|
68597
68778
|
|
|
@@ -68631,14 +68812,14 @@ function buildWidgetConfig(input) {
|
|
|
68631
68812
|
function generatePersonaInitSnippet(input, personaFormat) {
|
|
68632
68813
|
const widgetConfig = buildWidgetConfig(input);
|
|
68633
68814
|
const target = input.targetSelector?.trim();
|
|
68634
|
-
return
|
|
68815
|
+
return M(
|
|
68635
68816
|
widgetConfig,
|
|
68636
68817
|
personaFormat,
|
|
68637
68818
|
target ? { target } : void 0
|
|
68638
68819
|
);
|
|
68639
68820
|
}
|
|
68640
68821
|
function getPersonaInstallerScriptUrl() {
|
|
68641
|
-
const snippet =
|
|
68822
|
+
const snippet = M(
|
|
68642
68823
|
{
|
|
68643
68824
|
apiUrl: "https://api.runtype.com",
|
|
68644
68825
|
clientToken: "ct_test_demo_00000000000000000000000000000000",
|
|
@@ -71030,7 +71211,7 @@ function categoryBadge(category, useColor) {
|
|
|
71030
71211
|
return chalk36.magenta(`[${category}]`);
|
|
71031
71212
|
}
|
|
71032
71213
|
function formatTailData(data) {
|
|
71033
|
-
return Object.entries(data).map(([
|
|
71214
|
+
return Object.entries(data).map(([k2, v2]) => `${k2}=${typeof v2 === "string" ? v2 : JSON.stringify(v2)}`).join(" ");
|
|
71034
71215
|
}
|
|
71035
71216
|
function formatContextIds(event, useColor) {
|
|
71036
71217
|
const ids = [];
|
|
@@ -71118,9 +71299,9 @@ async function createSession(apiUrl, apiKey, filters) {
|
|
|
71118
71299
|
level: "levels",
|
|
71119
71300
|
category: "categories"
|
|
71120
71301
|
};
|
|
71121
|
-
for (const [
|
|
71122
|
-
if (v2 !== void 0 && arrayFields[
|
|
71123
|
-
filter[arrayFields[
|
|
71302
|
+
for (const [k2, v2] of Object.entries(filters)) {
|
|
71303
|
+
if (v2 !== void 0 && arrayFields[k2]) {
|
|
71304
|
+
filter[arrayFields[k2]] = [v2];
|
|
71124
71305
|
}
|
|
71125
71306
|
}
|
|
71126
71307
|
const body = Object.keys(filter).length > 0 ? { filter } : {};
|
|
@@ -71175,7 +71356,7 @@ async function runTail(options) {
|
|
|
71175
71356
|
category: options.category
|
|
71176
71357
|
};
|
|
71177
71358
|
const useColor = options.color;
|
|
71178
|
-
const activeFilters = Object.entries(filters).filter(([, v2]) => v2 !== void 0).map(([
|
|
71359
|
+
const activeFilters = Object.entries(filters).filter(([, v2]) => v2 !== void 0).map(([k2, v2]) => `${k2}=${v2}`);
|
|
71179
71360
|
process.stderr.write(
|
|
71180
71361
|
(useColor ? chalk36.gray(
|
|
71181
71362
|
`Connecting to ${apiUrl}...${activeFilters.length ? ` filters: ${activeFilters.join(", ")}` : ""}`
|
|
@@ -74255,10 +74436,10 @@ function parseVersion(version2) {
|
|
|
74255
74436
|
}
|
|
74256
74437
|
function compareVersions(left, right) {
|
|
74257
74438
|
const a = parseVersion(left);
|
|
74258
|
-
const
|
|
74259
|
-
if (!a || !
|
|
74439
|
+
const b2 = parseVersion(right);
|
|
74440
|
+
if (!a || !b2) return 0;
|
|
74260
74441
|
for (let index = 0; index < 3; index++) {
|
|
74261
|
-
const diff = a[index] -
|
|
74442
|
+
const diff = a[index] - b2[index];
|
|
74262
74443
|
if (diff !== 0) return diff;
|
|
74263
74444
|
}
|
|
74264
74445
|
return 0;
|
|
@@ -74940,8 +75121,7 @@ import { Command as Command37, InvalidArgumentError } from "commander";
|
|
|
74940
75121
|
import chalk46 from "chalk";
|
|
74941
75122
|
|
|
74942
75123
|
// src/lib/mcp-client.ts
|
|
74943
|
-
import { Client } from "@modelcontextprotocol/
|
|
74944
|
-
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
75124
|
+
import { Client, StreamableHTTPClientTransport } from "@modelcontextprotocol/client";
|
|
74945
75125
|
var CONNECT_TIMEOUT_MS = 1e4;
|
|
74946
75126
|
function parseHttpUrl(raw, label) {
|
|
74947
75127
|
let url2;
|
|
@@ -75299,9 +75479,12 @@ function createMcpCommand(overrides = {}) {
|
|
|
75299
75479
|
dependencies,
|
|
75300
75480
|
async (client) => {
|
|
75301
75481
|
const args = await dependencies.resolveArguments(options);
|
|
75302
|
-
const result = await client.callTool(
|
|
75303
|
-
|
|
75304
|
-
|
|
75482
|
+
const result = await client.callTool(
|
|
75483
|
+
{ name, arguments: args },
|
|
75484
|
+
{
|
|
75485
|
+
timeout: options.timeout
|
|
75486
|
+
}
|
|
75487
|
+
);
|
|
75305
75488
|
if (!("content" in result) || !Array.isArray(result.content)) {
|
|
75306
75489
|
throw new Error("Task-augmented MCP tool results are not supported by this command");
|
|
75307
75490
|
}
|