agent-relay 18.13.0 → 18.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/bootstrap.d.ts.map +1 -1
- package/dist/cli/bootstrap.js +2 -0
- package/dist/cli/bootstrap.js.map +1 -1
- package/dist/cli/commands/delegates.d.ts +48 -0
- package/dist/cli/commands/delegates.d.ts.map +1 -0
- package/dist/cli/commands/delegates.js +194 -0
- package/dist/cli/commands/delegates.js.map +1 -0
- package/dist/index.cjs +550 -222
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -183,6 +183,8 @@ __export(index_exports, {
|
|
|
183
183
|
OBSERVABILITY_UNAVAILABLE: () => OBSERVABILITY_UNAVAILABLE,
|
|
184
184
|
RELAYCAST_SDK_VERSION: () => RELAYCAST_SDK_VERSION,
|
|
185
185
|
RELAY_ATTEST_SESSION_ID_ENV: () => RELAY_ATTEST_SESSION_ID_ENV,
|
|
186
|
+
RELAY_DELEGATION_CLASSES: () => RELAY_DELEGATION_CLASSES,
|
|
187
|
+
RELAY_DELEGATION_PROTECTED_SETTINGS: () => RELAY_DELEGATION_PROTECTED_SETTINGS,
|
|
186
188
|
RELAY_FILE_DOWNLOAD_MAX_BYTES: () => RELAY_FILE_DOWNLOAD_MAX_BYTES,
|
|
187
189
|
RELAY_OBSERVER_SCOPES: () => RELAY_OBSERVER_SCOPES,
|
|
188
190
|
RELAY_SERVICE_FAILURE_MESSAGE: () => RELAY_SERVICE_FAILURE_MESSAGE,
|
|
@@ -229,6 +231,7 @@ __export(index_exports, {
|
|
|
229
231
|
createWorkspaceFacade: () => createWorkspaceFacade,
|
|
230
232
|
currentReplaySessionRef: () => currentReplaySessionRef,
|
|
231
233
|
defineHarness: () => defineHarness,
|
|
234
|
+
delegationCovers: () => delegationCovers,
|
|
232
235
|
downloadRelayFile: () => downloadRelayFile,
|
|
233
236
|
findGitRoot: () => findGitRoot,
|
|
234
237
|
formatAgentHandle: () => formatAgentHandle,
|
|
@@ -283,8 +286,11 @@ __export(index_exports, {
|
|
|
283
286
|
normalizeSearchResult: () => normalizeSearchResult,
|
|
284
287
|
normalizeThread: () => normalizeThread,
|
|
285
288
|
normalizeWebhookSubscription: () => normalizeWebhookSubscription,
|
|
289
|
+
parseConfigChangeTarget: () => parseConfigChangeTarget,
|
|
286
290
|
parseGitRemoteUrl: () => parseGitRemoteUrl,
|
|
291
|
+
parsePrOpsTarget: () => parsePrOpsTarget,
|
|
287
292
|
printUpdateNotification: () => printUpdateNotification,
|
|
293
|
+
redeemOwnerApproval: () => redeemOwnerApproval,
|
|
288
294
|
reduceAgentActivity: () => reduceAgentActivity,
|
|
289
295
|
registerFacadeAction: () => registerFacadeAction,
|
|
290
296
|
replayMessageMetadata: () => replayMessageMetadata,
|
|
@@ -296,16 +302,21 @@ __export(index_exports, {
|
|
|
296
302
|
revokeObserverToken: () => revokeObserverToken,
|
|
297
303
|
routerLog: () => routerLog,
|
|
298
304
|
safeRelayErrorMessage: () => safeRelayErrorMessage,
|
|
305
|
+
sessionSocketEndpoint: () => sessionSocketEndpoint,
|
|
299
306
|
stripAnsiFast: () => stripAnsiFast,
|
|
300
307
|
toPublicMessagingEvent: () => toPublicMessagingEvent,
|
|
301
308
|
toReleaseResult: () => toReleaseResult,
|
|
302
309
|
toSpawnResult: () => toSpawnResult,
|
|
310
|
+
toWireOwnerApproval: () => toWireOwnerApproval,
|
|
303
311
|
trackPatternPerformance: () => trackPatternPerformance,
|
|
304
312
|
unescapeFenceMarkersFast: () => unescapeFenceMarkersFast,
|
|
305
313
|
uploadRelayFile: () => uploadRelayFile,
|
|
306
314
|
validateJsonSchemaLite: () => validateJsonSchemaLite,
|
|
307
315
|
validateModelForCli: () => validateModelForCli,
|
|
308
|
-
|
|
316
|
+
verifyDelegationAttestation: () => verifyDelegationAttestation,
|
|
317
|
+
withErrorTracing: () => withErrorTracing,
|
|
318
|
+
withVerifiedDelegation: () => withVerifiedDelegation,
|
|
319
|
+
withdrawOwnerApproval: () => withdrawOwnerApproval
|
|
309
320
|
});
|
|
310
321
|
module.exports = __toCommonJS(index_exports);
|
|
311
322
|
|
|
@@ -15959,13 +15970,13 @@ function initializeContext(params) {
|
|
|
15959
15970
|
external: params?.external ?? void 0
|
|
15960
15971
|
};
|
|
15961
15972
|
}
|
|
15962
|
-
function handleUnrepresentable(schema, ctx,
|
|
15973
|
+
function handleUnrepresentable(schema, ctx, json3, params, message) {
|
|
15963
15974
|
const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({ zodSchema: schema, path: params.path, message }) : ctx.unrepresentable;
|
|
15964
15975
|
if (result === "any")
|
|
15965
15976
|
return false;
|
|
15966
15977
|
if (result === void 0 || result === "throw")
|
|
15967
15978
|
throw new Error(message);
|
|
15968
|
-
Object.assign(
|
|
15979
|
+
Object.assign(json3, result);
|
|
15969
15980
|
return true;
|
|
15970
15981
|
}
|
|
15971
15982
|
function processSchema(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
@@ -16201,12 +16212,12 @@ function foldObjects(members2) {
|
|
|
16201
16212
|
}
|
|
16202
16213
|
return folded;
|
|
16203
16214
|
}
|
|
16204
|
-
function foldIntersection(
|
|
16205
|
-
const allOf =
|
|
16215
|
+
function foldIntersection(json3) {
|
|
16216
|
+
const allOf = json3.allOf;
|
|
16206
16217
|
if (!Array.isArray(allOf) || allOf.length < 2)
|
|
16207
16218
|
return;
|
|
16208
16219
|
for (const key of FOLDABLE_KEYS)
|
|
16209
|
-
if (key in
|
|
16220
|
+
if (key in json3)
|
|
16210
16221
|
return;
|
|
16211
16222
|
const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
|
|
16212
16223
|
let folded = null;
|
|
@@ -16225,8 +16236,8 @@ function foldIntersection(json2) {
|
|
|
16225
16236
|
}
|
|
16226
16237
|
if (!folded)
|
|
16227
16238
|
return;
|
|
16228
|
-
delete
|
|
16229
|
-
assignProps(
|
|
16239
|
+
delete json3.allOf;
|
|
16240
|
+
assignProps(json3, folded);
|
|
16230
16241
|
}
|
|
16231
16242
|
function finalize(ctx, schema) {
|
|
16232
16243
|
const root = ctx.seen.get(schema);
|
|
@@ -16308,20 +16319,20 @@ function finalize(ctx, schema) {
|
|
|
16308
16319
|
if (ctx.intersections.length) {
|
|
16309
16320
|
const carriers = /* @__PURE__ */ new Map();
|
|
16310
16321
|
for (const seen of ctx.seen.values()) {
|
|
16311
|
-
for (const
|
|
16312
|
-
const allOf =
|
|
16322
|
+
for (const json3 of [seen.schema, seen.def]) {
|
|
16323
|
+
const allOf = json3?.allOf;
|
|
16313
16324
|
if (!Array.isArray(allOf))
|
|
16314
16325
|
continue;
|
|
16315
16326
|
const existing = carriers.get(allOf);
|
|
16316
16327
|
if (existing)
|
|
16317
|
-
existing.push(
|
|
16328
|
+
existing.push(json3);
|
|
16318
16329
|
else
|
|
16319
|
-
carriers.set(allOf, [
|
|
16330
|
+
carriers.set(allOf, [json3]);
|
|
16320
16331
|
}
|
|
16321
16332
|
}
|
|
16322
16333
|
for (const allOf of ctx.intersections) {
|
|
16323
|
-
for (const
|
|
16324
|
-
foldIntersection(
|
|
16334
|
+
for (const json3 of carriers.get(allOf) ?? [])
|
|
16335
|
+
foldIntersection(json3);
|
|
16325
16336
|
}
|
|
16326
16337
|
}
|
|
16327
16338
|
}
|
|
@@ -16556,29 +16567,29 @@ var exactPatterns = /* @__PURE__ */ new Map([
|
|
|
16556
16567
|
]);
|
|
16557
16568
|
var exactPattern = (p) => exactPatterns.get(p) ?? p;
|
|
16558
16569
|
var stringProcessor = (schema, ctx, _json, _params) => {
|
|
16559
|
-
const
|
|
16560
|
-
|
|
16570
|
+
const json3 = _json;
|
|
16571
|
+
json3.type = "string";
|
|
16561
16572
|
const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
|
|
16562
16573
|
if (typeof minimum === "number")
|
|
16563
|
-
|
|
16574
|
+
json3.minLength = minimum;
|
|
16564
16575
|
if (typeof maximum === "number")
|
|
16565
|
-
|
|
16576
|
+
json3.maxLength = maximum;
|
|
16566
16577
|
if (format) {
|
|
16567
|
-
|
|
16568
|
-
if (
|
|
16569
|
-
delete
|
|
16578
|
+
json3.format = formatMap[format] ?? format;
|
|
16579
|
+
if (json3.format === "")
|
|
16580
|
+
delete json3.format;
|
|
16570
16581
|
if (format === "time" || laxFormat) {
|
|
16571
|
-
delete
|
|
16582
|
+
delete json3.format;
|
|
16572
16583
|
}
|
|
16573
16584
|
}
|
|
16574
16585
|
if (contentEncoding)
|
|
16575
|
-
|
|
16586
|
+
json3.contentEncoding = contentEncoding;
|
|
16576
16587
|
if (patterns && patterns.size > 0) {
|
|
16577
16588
|
const patternList = [...patterns].map(exactPattern);
|
|
16578
16589
|
if (patternList.length === 1)
|
|
16579
|
-
|
|
16590
|
+
json3.pattern = patternList[0].source;
|
|
16580
16591
|
else if (patternList.length > 1) {
|
|
16581
|
-
|
|
16592
|
+
json3.allOf = [
|
|
16582
16593
|
...patternList.map((regex) => ({
|
|
16583
16594
|
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
16584
16595
|
pattern: regex.source
|
|
@@ -16588,31 +16599,31 @@ var stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
16588
16599
|
}
|
|
16589
16600
|
};
|
|
16590
16601
|
var numberProcessor = (schema, ctx, _json, params) => {
|
|
16591
|
-
const
|
|
16602
|
+
const json3 = _json;
|
|
16592
16603
|
const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
|
|
16593
|
-
|
|
16604
|
+
json3.type = isInt ? "integer" : "number";
|
|
16594
16605
|
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
16595
16606
|
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
16596
16607
|
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
16597
16608
|
if (exMin) {
|
|
16598
16609
|
if (legacy) {
|
|
16599
|
-
|
|
16600
|
-
|
|
16610
|
+
json3.minimum = exclusiveMinimum;
|
|
16611
|
+
json3.exclusiveMinimum = true;
|
|
16601
16612
|
} else {
|
|
16602
|
-
|
|
16613
|
+
json3.exclusiveMinimum = exclusiveMinimum;
|
|
16603
16614
|
}
|
|
16604
16615
|
} else if (typeof minimum === "number") {
|
|
16605
|
-
|
|
16616
|
+
json3.minimum = minimum;
|
|
16606
16617
|
}
|
|
16607
16618
|
if (exMax) {
|
|
16608
16619
|
if (legacy) {
|
|
16609
|
-
|
|
16610
|
-
|
|
16620
|
+
json3.maximum = exclusiveMaximum;
|
|
16621
|
+
json3.exclusiveMaximum = true;
|
|
16611
16622
|
} else {
|
|
16612
|
-
|
|
16623
|
+
json3.exclusiveMaximum = exclusiveMaximum;
|
|
16613
16624
|
}
|
|
16614
16625
|
} else if (typeof maximum === "number") {
|
|
16615
|
-
|
|
16626
|
+
json3.maximum = maximum;
|
|
16616
16627
|
}
|
|
16617
16628
|
if (multipleOf) {
|
|
16618
16629
|
const divisors = /* @__PURE__ */ new Set();
|
|
@@ -16620,75 +16631,75 @@ var numberProcessor = (schema, ctx, _json, params) => {
|
|
|
16620
16631
|
if (Number.isFinite(divisor) && divisor !== 0)
|
|
16621
16632
|
divisors.add(Math.abs(divisor));
|
|
16622
16633
|
else
|
|
16623
|
-
handleUnrepresentable(schema, ctx,
|
|
16634
|
+
handleUnrepresentable(schema, ctx, json3, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
|
|
16624
16635
|
}
|
|
16625
16636
|
const [first, ...rest] = divisors;
|
|
16626
16637
|
if (first !== void 0)
|
|
16627
|
-
|
|
16638
|
+
json3.multipleOf = first;
|
|
16628
16639
|
if (rest.length)
|
|
16629
|
-
|
|
16640
|
+
json3.allOf = [...json3.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
|
|
16630
16641
|
}
|
|
16631
16642
|
};
|
|
16632
|
-
var booleanProcessor = (_schema, _ctx,
|
|
16633
|
-
|
|
16643
|
+
var booleanProcessor = (_schema, _ctx, json3, _params) => {
|
|
16644
|
+
json3.type = "boolean";
|
|
16634
16645
|
};
|
|
16635
|
-
var bigintProcessor = (schema, ctx,
|
|
16636
|
-
handleUnrepresentable(schema, ctx,
|
|
16646
|
+
var bigintProcessor = (schema, ctx, json3, params) => {
|
|
16647
|
+
handleUnrepresentable(schema, ctx, json3, params, "BigInt cannot be represented in JSON Schema");
|
|
16637
16648
|
};
|
|
16638
|
-
var symbolProcessor = (schema, ctx,
|
|
16639
|
-
handleUnrepresentable(schema, ctx,
|
|
16649
|
+
var symbolProcessor = (schema, ctx, json3, params) => {
|
|
16650
|
+
handleUnrepresentable(schema, ctx, json3, params, "Symbols cannot be represented in JSON Schema");
|
|
16640
16651
|
};
|
|
16641
|
-
var nullProcessor = (_schema, ctx,
|
|
16652
|
+
var nullProcessor = (_schema, ctx, json3, _params) => {
|
|
16642
16653
|
if (ctx.target === "openapi-3.0") {
|
|
16643
|
-
|
|
16644
|
-
|
|
16645
|
-
|
|
16654
|
+
json3.type = "string";
|
|
16655
|
+
json3.nullable = true;
|
|
16656
|
+
json3.enum = [null];
|
|
16646
16657
|
} else {
|
|
16647
|
-
|
|
16658
|
+
json3.type = "null";
|
|
16648
16659
|
}
|
|
16649
16660
|
};
|
|
16650
|
-
var undefinedProcessor = (schema, ctx,
|
|
16651
|
-
handleUnrepresentable(schema, ctx,
|
|
16661
|
+
var undefinedProcessor = (schema, ctx, json3, params) => {
|
|
16662
|
+
handleUnrepresentable(schema, ctx, json3, params, "Undefined cannot be represented in JSON Schema");
|
|
16652
16663
|
};
|
|
16653
|
-
var voidProcessor = (schema, ctx,
|
|
16654
|
-
handleUnrepresentable(schema, ctx,
|
|
16664
|
+
var voidProcessor = (schema, ctx, json3, params) => {
|
|
16665
|
+
handleUnrepresentable(schema, ctx, json3, params, "Void cannot be represented in JSON Schema");
|
|
16655
16666
|
};
|
|
16656
|
-
var neverProcessor = (_schema, _ctx,
|
|
16657
|
-
|
|
16667
|
+
var neverProcessor = (_schema, _ctx, json3, _params) => {
|
|
16668
|
+
json3.not = {};
|
|
16658
16669
|
};
|
|
16659
16670
|
var anyProcessor = (_schema, _ctx, _json, _params) => {
|
|
16660
16671
|
};
|
|
16661
16672
|
var unknownProcessor = (_schema, _ctx, _json, _params) => {
|
|
16662
16673
|
};
|
|
16663
|
-
var dateProcessor = (schema, ctx,
|
|
16664
|
-
handleUnrepresentable(schema, ctx,
|
|
16674
|
+
var dateProcessor = (schema, ctx, json3, params) => {
|
|
16675
|
+
handleUnrepresentable(schema, ctx, json3, params, "Date cannot be represented in JSON Schema");
|
|
16665
16676
|
};
|
|
16666
|
-
var enumProcessor = (schema, _ctx,
|
|
16677
|
+
var enumProcessor = (schema, _ctx, json3, _params) => {
|
|
16667
16678
|
const def = schema._zod.def;
|
|
16668
16679
|
const values = getEnumValues(def.entries);
|
|
16669
16680
|
if (values.length === 0) {
|
|
16670
|
-
|
|
16681
|
+
json3.not = {};
|
|
16671
16682
|
return;
|
|
16672
16683
|
}
|
|
16673
16684
|
if (values.every((v) => typeof v === "number"))
|
|
16674
|
-
|
|
16685
|
+
json3.type = "number";
|
|
16675
16686
|
if (values.every((v) => typeof v === "string"))
|
|
16676
|
-
|
|
16677
|
-
|
|
16687
|
+
json3.type = "string";
|
|
16688
|
+
json3.enum = values;
|
|
16678
16689
|
};
|
|
16679
|
-
var literalProcessor = (schema, ctx,
|
|
16690
|
+
var literalProcessor = (schema, ctx, json3, params) => {
|
|
16680
16691
|
const def = schema._zod.def;
|
|
16681
16692
|
if (def.values.length === 0) {
|
|
16682
|
-
|
|
16693
|
+
json3.not = {};
|
|
16683
16694
|
return;
|
|
16684
16695
|
}
|
|
16685
16696
|
const vals = [];
|
|
16686
16697
|
for (const val of def.values) {
|
|
16687
16698
|
if (val === void 0) {
|
|
16688
|
-
if (handleUnrepresentable(schema, ctx,
|
|
16699
|
+
if (handleUnrepresentable(schema, ctx, json3, params, "Literal `undefined` cannot be represented in JSON Schema"))
|
|
16689
16700
|
return;
|
|
16690
16701
|
} else if (typeof val === "bigint") {
|
|
16691
|
-
if (handleUnrepresentable(schema, ctx,
|
|
16702
|
+
if (handleUnrepresentable(schema, ctx, json3, params, "BigInt literals cannot be represented in JSON Schema"))
|
|
16692
16703
|
return;
|
|
16693
16704
|
vals.push(Number(val));
|
|
16694
16705
|
} else {
|
|
@@ -16698,37 +16709,37 @@ var literalProcessor = (schema, ctx, json2, params) => {
|
|
|
16698
16709
|
if (vals.length === 0) {
|
|
16699
16710
|
} else if (vals.length === 1) {
|
|
16700
16711
|
const val = vals[0];
|
|
16701
|
-
|
|
16712
|
+
json3.type = val === null ? "null" : typeof val;
|
|
16702
16713
|
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
16703
|
-
|
|
16714
|
+
json3.enum = [val];
|
|
16704
16715
|
} else {
|
|
16705
|
-
|
|
16716
|
+
json3.const = val;
|
|
16706
16717
|
}
|
|
16707
16718
|
} else {
|
|
16708
16719
|
if (vals.every((v) => typeof v === "number"))
|
|
16709
|
-
|
|
16720
|
+
json3.type = "number";
|
|
16710
16721
|
if (vals.every((v) => typeof v === "string"))
|
|
16711
|
-
|
|
16722
|
+
json3.type = "string";
|
|
16712
16723
|
if (vals.every((v) => typeof v === "boolean"))
|
|
16713
|
-
|
|
16724
|
+
json3.type = "boolean";
|
|
16714
16725
|
if (vals.every((v) => v === null))
|
|
16715
|
-
|
|
16716
|
-
|
|
16726
|
+
json3.type = "null";
|
|
16727
|
+
json3.enum = vals;
|
|
16717
16728
|
}
|
|
16718
16729
|
};
|
|
16719
|
-
var nanProcessor = (schema, ctx,
|
|
16720
|
-
handleUnrepresentable(schema, ctx,
|
|
16730
|
+
var nanProcessor = (schema, ctx, json3, params) => {
|
|
16731
|
+
handleUnrepresentable(schema, ctx, json3, params, "NaN cannot be represented in JSON Schema");
|
|
16721
16732
|
};
|
|
16722
|
-
var templateLiteralProcessor = (schema, _ctx,
|
|
16723
|
-
const _json =
|
|
16733
|
+
var templateLiteralProcessor = (schema, _ctx, json3, _params) => {
|
|
16734
|
+
const _json = json3;
|
|
16724
16735
|
const pattern = schema._zod.pattern;
|
|
16725
16736
|
if (!pattern)
|
|
16726
16737
|
throw new Error("Pattern not found in template literal");
|
|
16727
16738
|
_json.type = "string";
|
|
16728
16739
|
_json.pattern = pattern.source;
|
|
16729
16740
|
};
|
|
16730
|
-
var fileProcessor = (schema, _ctx,
|
|
16731
|
-
const _json =
|
|
16741
|
+
var fileProcessor = (schema, _ctx, json3, _params) => {
|
|
16742
|
+
const _json = json3;
|
|
16732
16743
|
_json.type = "string";
|
|
16733
16744
|
_json.format = "binary";
|
|
16734
16745
|
_json.contentEncoding = "binary";
|
|
@@ -16746,34 +16757,34 @@ var fileProcessor = (schema, _ctx, json2, _params) => {
|
|
|
16746
16757
|
else
|
|
16747
16758
|
_json.anyOf = mime.map((m) => ({ contentMediaType: m }));
|
|
16748
16759
|
};
|
|
16749
|
-
var successProcessor = (_schema, _ctx,
|
|
16750
|
-
|
|
16760
|
+
var successProcessor = (_schema, _ctx, json3, _params) => {
|
|
16761
|
+
json3.type = "boolean";
|
|
16751
16762
|
};
|
|
16752
|
-
var customProcessor = (schema, ctx,
|
|
16753
|
-
handleUnrepresentable(schema, ctx,
|
|
16763
|
+
var customProcessor = (schema, ctx, json3, params) => {
|
|
16764
|
+
handleUnrepresentable(schema, ctx, json3, params, "Custom types cannot be represented in JSON Schema");
|
|
16754
16765
|
};
|
|
16755
|
-
var functionProcessor = (schema, ctx,
|
|
16756
|
-
handleUnrepresentable(schema, ctx,
|
|
16766
|
+
var functionProcessor = (schema, ctx, json3, params) => {
|
|
16767
|
+
handleUnrepresentable(schema, ctx, json3, params, "Function types cannot be represented in JSON Schema");
|
|
16757
16768
|
};
|
|
16758
|
-
var transformProcessor = (schema, ctx,
|
|
16759
|
-
handleUnrepresentable(schema, ctx,
|
|
16769
|
+
var transformProcessor = (schema, ctx, json3, params) => {
|
|
16770
|
+
handleUnrepresentable(schema, ctx, json3, params, "Transforms cannot be represented in JSON Schema");
|
|
16760
16771
|
};
|
|
16761
|
-
var mapProcessor = (schema, ctx,
|
|
16762
|
-
handleUnrepresentable(schema, ctx,
|
|
16772
|
+
var mapProcessor = (schema, ctx, json3, params) => {
|
|
16773
|
+
handleUnrepresentable(schema, ctx, json3, params, "Map cannot be represented in JSON Schema");
|
|
16763
16774
|
};
|
|
16764
|
-
var setProcessor = (schema, ctx,
|
|
16765
|
-
handleUnrepresentable(schema, ctx,
|
|
16775
|
+
var setProcessor = (schema, ctx, json3, params) => {
|
|
16776
|
+
handleUnrepresentable(schema, ctx, json3, params, "Set cannot be represented in JSON Schema");
|
|
16766
16777
|
};
|
|
16767
16778
|
var arrayProcessor = (schema, ctx, _json, params) => {
|
|
16768
|
-
const
|
|
16779
|
+
const json3 = _json;
|
|
16769
16780
|
const def = schema._zod.def;
|
|
16770
16781
|
const { minimum, maximum } = aggregateChecks(schema);
|
|
16771
16782
|
if (typeof minimum === "number")
|
|
16772
|
-
|
|
16783
|
+
json3.minItems = minimum;
|
|
16773
16784
|
if (typeof maximum === "number")
|
|
16774
|
-
|
|
16775
|
-
|
|
16776
|
-
|
|
16785
|
+
json3.maxItems = maximum;
|
|
16786
|
+
json3.type = "array";
|
|
16787
|
+
json3.items = processSchema(def.element, ctx, {
|
|
16777
16788
|
...params,
|
|
16778
16789
|
path: [...params.path, "items"]
|
|
16779
16790
|
});
|
|
@@ -16789,17 +16800,17 @@ function inputOptin(schema) {
|
|
|
16789
16800
|
return schema._zod.optin;
|
|
16790
16801
|
}
|
|
16791
16802
|
var objectProcessor = (schema, ctx, _json, params) => {
|
|
16792
|
-
const
|
|
16803
|
+
const json3 = _json;
|
|
16793
16804
|
const def = schema._zod.def;
|
|
16794
16805
|
const shape = def.shape;
|
|
16795
16806
|
const symbolKeys = Object.getOwnPropertySymbols(shape);
|
|
16796
|
-
if (symbolKeys.length && handleUnrepresentable(schema, ctx,
|
|
16807
|
+
if (symbolKeys.length && handleUnrepresentable(schema, ctx, json3, params, "Symbol keys cannot be represented in JSON Schema")) {
|
|
16797
16808
|
return;
|
|
16798
16809
|
}
|
|
16799
|
-
|
|
16800
|
-
|
|
16810
|
+
json3.type = "object";
|
|
16811
|
+
json3.properties = {};
|
|
16801
16812
|
for (const key in shape) {
|
|
16802
|
-
assignProp(
|
|
16813
|
+
assignProp(json3.properties, key, processSchema(shape[key], ctx, {
|
|
16803
16814
|
...params,
|
|
16804
16815
|
path: [...params.path, "properties", key]
|
|
16805
16816
|
}));
|
|
@@ -16812,21 +16823,21 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
16812
16823
|
}
|
|
16813
16824
|
}
|
|
16814
16825
|
if (requiredKeys.length > 0) {
|
|
16815
|
-
|
|
16826
|
+
json3.required = requiredKeys;
|
|
16816
16827
|
}
|
|
16817
16828
|
if (def.catchall?._zod.def.type === "never") {
|
|
16818
|
-
|
|
16829
|
+
json3.additionalProperties = false;
|
|
16819
16830
|
} else if (!def.catchall) {
|
|
16820
16831
|
if (ctx.io === "output")
|
|
16821
|
-
|
|
16832
|
+
json3.additionalProperties = false;
|
|
16822
16833
|
} else if (def.catchall) {
|
|
16823
|
-
|
|
16834
|
+
json3.additionalProperties = processSchema(def.catchall, ctx, {
|
|
16824
16835
|
...params,
|
|
16825
16836
|
path: [...params.path, "additionalProperties"]
|
|
16826
16837
|
});
|
|
16827
16838
|
}
|
|
16828
16839
|
};
|
|
16829
|
-
var unionProcessor = (schema, ctx,
|
|
16840
|
+
var unionProcessor = (schema, ctx, json3, params) => {
|
|
16830
16841
|
const def = schema._zod.def;
|
|
16831
16842
|
const isExclusive = def.inclusive === false;
|
|
16832
16843
|
const options = def.options.map((x, i) => processSchema(x, ctx, {
|
|
@@ -16834,12 +16845,12 @@ var unionProcessor = (schema, ctx, json2, params) => {
|
|
|
16834
16845
|
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
|
|
16835
16846
|
}));
|
|
16836
16847
|
if (isExclusive) {
|
|
16837
|
-
|
|
16848
|
+
json3.oneOf = options;
|
|
16838
16849
|
} else {
|
|
16839
|
-
|
|
16850
|
+
json3.anyOf = options;
|
|
16840
16851
|
}
|
|
16841
16852
|
};
|
|
16842
|
-
var intersectionProcessor = (schema, ctx,
|
|
16853
|
+
var intersectionProcessor = (schema, ctx, json3, params) => {
|
|
16843
16854
|
const def = schema._zod.def;
|
|
16844
16855
|
const a = processSchema(def.left, ctx, {
|
|
16845
16856
|
...params,
|
|
@@ -16854,13 +16865,13 @@ var intersectionProcessor = (schema, ctx, json2, params) => {
|
|
|
16854
16865
|
...isSimpleIntersection(a) ? a.allOf : [a],
|
|
16855
16866
|
...isSimpleIntersection(b) ? b.allOf : [b]
|
|
16856
16867
|
];
|
|
16857
|
-
|
|
16868
|
+
json3.allOf = allOf;
|
|
16858
16869
|
ctx.intersections.push(allOf);
|
|
16859
16870
|
};
|
|
16860
16871
|
var tupleProcessor = (schema, ctx, _json, params) => {
|
|
16861
|
-
const
|
|
16872
|
+
const json3 = _json;
|
|
16862
16873
|
const def = schema._zod.def;
|
|
16863
|
-
|
|
16874
|
+
json3.type = "array";
|
|
16864
16875
|
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
16865
16876
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
16866
16877
|
const prefixItems = def.items.map((x, i) => processSchema(x, ctx, {
|
|
@@ -16882,70 +16893,70 @@ var tupleProcessor = (schema, ctx, _json, params) => {
|
|
|
16882
16893
|
const maxItems = def.items.length;
|
|
16883
16894
|
const isClosed = !def.rest;
|
|
16884
16895
|
if (ctx.target === "draft-2020-12") {
|
|
16885
|
-
|
|
16896
|
+
json3.prefixItems = prefixItems;
|
|
16886
16897
|
if (isClosed) {
|
|
16887
|
-
|
|
16898
|
+
json3.items = false;
|
|
16888
16899
|
} else if (rest) {
|
|
16889
|
-
|
|
16900
|
+
json3.items = rest;
|
|
16890
16901
|
}
|
|
16891
16902
|
if (minItems > 0)
|
|
16892
|
-
|
|
16903
|
+
json3.minItems = minItems;
|
|
16893
16904
|
if (isClosed)
|
|
16894
|
-
|
|
16905
|
+
json3.maxItems = maxItems;
|
|
16895
16906
|
} else if (ctx.target === "openapi-3.0") {
|
|
16896
|
-
|
|
16907
|
+
json3.items = {
|
|
16897
16908
|
anyOf: prefixItems
|
|
16898
16909
|
};
|
|
16899
16910
|
if (rest) {
|
|
16900
|
-
|
|
16911
|
+
json3.items.anyOf.push(rest);
|
|
16901
16912
|
}
|
|
16902
16913
|
if (minItems > 0)
|
|
16903
|
-
|
|
16914
|
+
json3.minItems = minItems;
|
|
16904
16915
|
if (isClosed)
|
|
16905
|
-
|
|
16916
|
+
json3.maxItems = maxItems;
|
|
16906
16917
|
} else {
|
|
16907
|
-
|
|
16918
|
+
json3.items = prefixItems;
|
|
16908
16919
|
if (isClosed) {
|
|
16909
|
-
|
|
16920
|
+
json3.additionalItems = false;
|
|
16910
16921
|
} else if (rest) {
|
|
16911
|
-
|
|
16922
|
+
json3.additionalItems = rest;
|
|
16912
16923
|
}
|
|
16913
16924
|
if (minItems > 0)
|
|
16914
|
-
|
|
16925
|
+
json3.minItems = minItems;
|
|
16915
16926
|
if (isClosed)
|
|
16916
|
-
|
|
16927
|
+
json3.maxItems = maxItems;
|
|
16917
16928
|
}
|
|
16918
16929
|
const { minimum, maximum } = aggregateChecks(schema);
|
|
16919
16930
|
if (typeof minimum === "number")
|
|
16920
|
-
|
|
16931
|
+
json3.minItems = minimum;
|
|
16921
16932
|
if (typeof maximum === "number")
|
|
16922
|
-
|
|
16933
|
+
json3.maxItems = maximum;
|
|
16923
16934
|
};
|
|
16924
|
-
function stringifyKeyNames(bySchema,
|
|
16925
|
-
if (
|
|
16926
|
-
if (visited.has(
|
|
16927
|
-
return
|
|
16928
|
-
visited.add(
|
|
16929
|
-
const def = bySchema.get(
|
|
16935
|
+
function stringifyKeyNames(bySchema, json3, visited) {
|
|
16936
|
+
if (json3.$ref) {
|
|
16937
|
+
if (visited.has(json3))
|
|
16938
|
+
return json3;
|
|
16939
|
+
visited.add(json3);
|
|
16940
|
+
const def = bySchema.get(json3)?.def;
|
|
16930
16941
|
if (!def)
|
|
16931
|
-
return
|
|
16942
|
+
return json3;
|
|
16932
16943
|
const inlined = stringifyKeyNames(bySchema, def, visited);
|
|
16933
|
-
return inlined === def ?
|
|
16944
|
+
return inlined === def ? json3 : inlined;
|
|
16934
16945
|
}
|
|
16935
16946
|
for (const keyword of ["anyOf", "oneOf"]) {
|
|
16936
|
-
const branches =
|
|
16947
|
+
const branches = json3[keyword];
|
|
16937
16948
|
if (!Array.isArray(branches))
|
|
16938
16949
|
continue;
|
|
16939
16950
|
const mapped = branches.map((branch) => stringifyKeyNames(bySchema, branch, visited));
|
|
16940
16951
|
if (mapped.some((branch, i) => branch !== branches[i]))
|
|
16941
|
-
|
|
16952
|
+
json3 = { ...json3, [keyword]: mapped };
|
|
16942
16953
|
}
|
|
16943
|
-
const types = Array.isArray(
|
|
16954
|
+
const types = Array.isArray(json3.type) ? json3.type : [json3.type];
|
|
16944
16955
|
const numericType = !types.includes("string") && types.some((t) => t === "number" || t === "integer");
|
|
16945
|
-
const values =
|
|
16956
|
+
const values = json3.enum ?? (json3.const !== void 0 ? [json3.const] : void 0);
|
|
16946
16957
|
if (!numericType && !values?.some((v) => typeof v === "number"))
|
|
16947
|
-
return
|
|
16948
|
-
const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } =
|
|
16958
|
+
return json3;
|
|
16959
|
+
const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } = json3;
|
|
16949
16960
|
if (rest.enum)
|
|
16950
16961
|
rest.enum = rest.enum.map((v) => typeof v === "number" ? String(v) : v);
|
|
16951
16962
|
else if (typeof rest.const === "number")
|
|
@@ -16985,9 +16996,9 @@ function rewriteKeyNames(ctx) {
|
|
|
16985
16996
|
}
|
|
16986
16997
|
}
|
|
16987
16998
|
var recordProcessor = (schema, ctx, _json, params) => {
|
|
16988
|
-
const
|
|
16999
|
+
const json3 = _json;
|
|
16989
17000
|
const def = schema._zod.def;
|
|
16990
|
-
|
|
17001
|
+
json3.type = "object";
|
|
16991
17002
|
const keyType = def.keyType;
|
|
16992
17003
|
const patterns = aggregateChecks(keyType).patterns;
|
|
16993
17004
|
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
@@ -16995,13 +17006,13 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
16995
17006
|
...params,
|
|
16996
17007
|
path: [...params.path, "patternProperties", "*"]
|
|
16997
17008
|
});
|
|
16998
|
-
|
|
17009
|
+
json3.patternProperties = {};
|
|
16999
17010
|
for (const pattern of patterns) {
|
|
17000
|
-
assignProp(
|
|
17011
|
+
assignProp(json3.patternProperties, exactPattern(pattern).source, valueSchema);
|
|
17001
17012
|
}
|
|
17002
17013
|
} else {
|
|
17003
17014
|
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
17004
|
-
|
|
17015
|
+
json3.propertyNames = processSchema(def.keyType, ctx, {
|
|
17005
17016
|
...params,
|
|
17006
17017
|
path: [...params.path, "propertyNames"]
|
|
17007
17018
|
});
|
|
@@ -17013,7 +17024,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
17013
17024
|
}
|
|
17014
17025
|
pending.push(schema);
|
|
17015
17026
|
}
|
|
17016
|
-
|
|
17027
|
+
json3.additionalProperties = processSchema(def.valueType, ctx, {
|
|
17017
17028
|
...params,
|
|
17018
17029
|
path: [...params.path, "additionalProperties"]
|
|
17019
17030
|
});
|
|
@@ -17023,19 +17034,19 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
17023
17034
|
if (keyValues && !def.partial && !omittableOnInput) {
|
|
17024
17035
|
const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
|
|
17025
17036
|
if (validKeyValues.length > 0) {
|
|
17026
|
-
|
|
17037
|
+
json3.required = validKeyValues.map(String);
|
|
17027
17038
|
}
|
|
17028
17039
|
}
|
|
17029
17040
|
};
|
|
17030
|
-
var nullableProcessor = (schema, ctx,
|
|
17041
|
+
var nullableProcessor = (schema, ctx, json3, params) => {
|
|
17031
17042
|
const def = schema._zod.def;
|
|
17032
17043
|
const inner = processSchema(def.innerType, ctx, params);
|
|
17033
17044
|
const seen = ctx.seen.get(schema);
|
|
17034
17045
|
if (ctx.target === "openapi-3.0") {
|
|
17035
17046
|
seen.ref = def.innerType;
|
|
17036
|
-
|
|
17047
|
+
json3.nullable = true;
|
|
17037
17048
|
} else {
|
|
17038
|
-
|
|
17049
|
+
json3.anyOf = [inner, { type: "null" }];
|
|
17039
17050
|
}
|
|
17040
17051
|
};
|
|
17041
17052
|
var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
@@ -17045,7 +17056,7 @@ var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
|
17045
17056
|
seen.ref = def.innerType;
|
|
17046
17057
|
};
|
|
17047
17058
|
var UNREPRESENTABLE_DEFAULT = /* @__PURE__ */ Symbol();
|
|
17048
|
-
function serializeDefaultValue(value, schema, ctx,
|
|
17059
|
+
function serializeDefaultValue(value, schema, ctx, json3, params) {
|
|
17049
17060
|
let unrepresentable = false;
|
|
17050
17061
|
const serialized = JSON.stringify(value, (_, val) => {
|
|
17051
17062
|
if (typeof val !== "bigint")
|
|
@@ -17055,30 +17066,30 @@ function serializeDefaultValue(value, schema, ctx, json2, params) {
|
|
|
17055
17066
|
});
|
|
17056
17067
|
if (!unrepresentable)
|
|
17057
17068
|
return JSON.parse(serialized);
|
|
17058
|
-
handleUnrepresentable(schema, ctx,
|
|
17069
|
+
handleUnrepresentable(schema, ctx, json3, params, "BigInt defaults cannot be represented in JSON Schema");
|
|
17059
17070
|
return UNREPRESENTABLE_DEFAULT;
|
|
17060
17071
|
}
|
|
17061
|
-
var defaultProcessor = (schema, ctx,
|
|
17072
|
+
var defaultProcessor = (schema, ctx, json3, params) => {
|
|
17062
17073
|
const def = schema._zod.def;
|
|
17063
17074
|
processSchema(def.innerType, ctx, params);
|
|
17064
17075
|
const seen = ctx.seen.get(schema);
|
|
17065
17076
|
seen.ref = def.innerType;
|
|
17066
|
-
const value = serializeDefaultValue(def.defaultValue, schema, ctx,
|
|
17077
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json3, params);
|
|
17067
17078
|
if (value !== UNREPRESENTABLE_DEFAULT)
|
|
17068
|
-
|
|
17079
|
+
json3.default = value;
|
|
17069
17080
|
};
|
|
17070
|
-
var prefaultProcessor = (schema, ctx,
|
|
17081
|
+
var prefaultProcessor = (schema, ctx, json3, params) => {
|
|
17071
17082
|
const def = schema._zod.def;
|
|
17072
17083
|
processSchema(def.innerType, ctx, params);
|
|
17073
17084
|
const seen = ctx.seen.get(schema);
|
|
17074
17085
|
seen.ref = def.innerType;
|
|
17075
17086
|
if (ctx.io !== "input")
|
|
17076
17087
|
return;
|
|
17077
|
-
const value = serializeDefaultValue(def.defaultValue, schema, ctx,
|
|
17088
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json3, params);
|
|
17078
17089
|
if (value !== UNREPRESENTABLE_DEFAULT)
|
|
17079
|
-
|
|
17090
|
+
json3._prefault = value;
|
|
17080
17091
|
};
|
|
17081
|
-
var catchProcessor = (schema, ctx,
|
|
17092
|
+
var catchProcessor = (schema, ctx, json3, params) => {
|
|
17082
17093
|
const def = schema._zod.def;
|
|
17083
17094
|
processSchema(def.innerType, ctx, params);
|
|
17084
17095
|
const seen = ctx.seen.get(schema);
|
|
@@ -17087,10 +17098,10 @@ var catchProcessor = (schema, ctx, json2, params) => {
|
|
|
17087
17098
|
try {
|
|
17088
17099
|
catchValue = def.catchValue(void 0);
|
|
17089
17100
|
} catch {
|
|
17090
|
-
handleUnrepresentable(schema, ctx,
|
|
17101
|
+
handleUnrepresentable(schema, ctx, json3, params, "Dynamic catch values are not supported in JSON Schema");
|
|
17091
17102
|
return;
|
|
17092
17103
|
}
|
|
17093
|
-
|
|
17104
|
+
json3.default = catchValue;
|
|
17094
17105
|
};
|
|
17095
17106
|
var pipeProcessor = (schema, ctx, _json, params) => {
|
|
17096
17107
|
const def = schema._zod.def;
|
|
@@ -17100,12 +17111,12 @@ var pipeProcessor = (schema, ctx, _json, params) => {
|
|
|
17100
17111
|
const seen = ctx.seen.get(schema);
|
|
17101
17112
|
seen.ref = innerType;
|
|
17102
17113
|
};
|
|
17103
|
-
var readonlyProcessor = (schema, ctx,
|
|
17114
|
+
var readonlyProcessor = (schema, ctx, json3, params) => {
|
|
17104
17115
|
const def = schema._zod.def;
|
|
17105
17116
|
processSchema(def.innerType, ctx, params);
|
|
17106
17117
|
const seen = ctx.seen.get(schema);
|
|
17107
17118
|
seen.ref = def.innerType;
|
|
17108
|
-
|
|
17119
|
+
json3.readOnly = true;
|
|
17109
17120
|
};
|
|
17110
17121
|
var promiseProcessor = (schema, ctx, _json, params) => {
|
|
17111
17122
|
const def = schema._zod.def;
|
|
@@ -17747,7 +17758,7 @@ var _ZodString = /* @__PURE__ */ $constructor(
|
|
|
17747
17758
|
(inst, def) => {
|
|
17748
17759
|
$ZodString.init(inst, def);
|
|
17749
17760
|
ZodType.init(inst, def);
|
|
17750
|
-
inst._zod.processJSONSchema = (ctx,
|
|
17761
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => stringProcessor(inst, ctx, json3, params);
|
|
17751
17762
|
},
|
|
17752
17763
|
/* @__PURE__ */ util_exports.derived({
|
|
17753
17764
|
format: (inst) => aggregateChecks(inst).format ?? null,
|
|
@@ -18106,7 +18117,7 @@ var ZodNumber = /* @__PURE__ */ $constructor(
|
|
|
18106
18117
|
(inst, def) => {
|
|
18107
18118
|
$ZodNumber.init(inst, def);
|
|
18108
18119
|
ZodType.init(inst, def);
|
|
18109
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18120
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => numberProcessor(inst, ctx, json3, params);
|
|
18110
18121
|
inst.isFinite = true;
|
|
18111
18122
|
},
|
|
18112
18123
|
/* @__PURE__ */ util_exports.derived({
|
|
@@ -18196,7 +18207,7 @@ function uint32(params) {
|
|
|
18196
18207
|
var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
18197
18208
|
$ZodBoolean.init(inst, def);
|
|
18198
18209
|
ZodType.init(inst, def);
|
|
18199
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18210
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => booleanProcessor(inst, ctx, json3, params);
|
|
18200
18211
|
});
|
|
18201
18212
|
function boolean2(params) {
|
|
18202
18213
|
return _boolean(ZodBoolean, params);
|
|
@@ -18206,7 +18217,7 @@ var ZodBigInt = /* @__PURE__ */ $constructor(
|
|
|
18206
18217
|
(inst, def) => {
|
|
18207
18218
|
$ZodBigInt.init(inst, def);
|
|
18208
18219
|
ZodType.init(inst, def);
|
|
18209
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18220
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => bigintProcessor(inst, ctx, json3, params);
|
|
18210
18221
|
},
|
|
18211
18222
|
/* @__PURE__ */ util_exports.derived({
|
|
18212
18223
|
minValue: (inst) => aggregateChecks(inst).minimum ?? null,
|
|
@@ -18264,7 +18275,7 @@ function uint64(params) {
|
|
|
18264
18275
|
var ZodSymbol = /* @__PURE__ */ $constructor("ZodSymbol", (inst, def) => {
|
|
18265
18276
|
$ZodSymbol.init(inst, def);
|
|
18266
18277
|
ZodType.init(inst, def);
|
|
18267
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18278
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => symbolProcessor(inst, ctx, json3, params);
|
|
18268
18279
|
});
|
|
18269
18280
|
function symbol(params) {
|
|
18270
18281
|
return _symbol(ZodSymbol, params);
|
|
@@ -18272,7 +18283,7 @@ function symbol(params) {
|
|
|
18272
18283
|
var ZodUndefined = /* @__PURE__ */ $constructor("ZodUndefined", (inst, def) => {
|
|
18273
18284
|
$ZodUndefined.init(inst, def);
|
|
18274
18285
|
ZodType.init(inst, def);
|
|
18275
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18286
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => undefinedProcessor(inst, ctx, json3, params);
|
|
18276
18287
|
});
|
|
18277
18288
|
function _undefined3(params) {
|
|
18278
18289
|
return _undefined2(ZodUndefined, params);
|
|
@@ -18280,7 +18291,7 @@ function _undefined3(params) {
|
|
|
18280
18291
|
var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
|
|
18281
18292
|
$ZodNull.init(inst, def);
|
|
18282
18293
|
ZodType.init(inst, def);
|
|
18283
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18294
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => nullProcessor(inst, ctx, json3, params);
|
|
18284
18295
|
});
|
|
18285
18296
|
function _null3(params) {
|
|
18286
18297
|
return _null2(ZodNull, params);
|
|
@@ -18288,7 +18299,7 @@ function _null3(params) {
|
|
|
18288
18299
|
var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
|
|
18289
18300
|
$ZodAny.init(inst, def);
|
|
18290
18301
|
ZodType.init(inst, def);
|
|
18291
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18302
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => anyProcessor(inst, ctx, json3, params);
|
|
18292
18303
|
});
|
|
18293
18304
|
function any() {
|
|
18294
18305
|
return _any(ZodAny);
|
|
@@ -18296,7 +18307,7 @@ function any() {
|
|
|
18296
18307
|
var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
18297
18308
|
$ZodUnknown.init(inst, def);
|
|
18298
18309
|
ZodType.init(inst, def);
|
|
18299
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18310
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => unknownProcessor(inst, ctx, json3, params);
|
|
18300
18311
|
});
|
|
18301
18312
|
function unknown() {
|
|
18302
18313
|
return _unknown(ZodUnknown);
|
|
@@ -18304,7 +18315,7 @@ function unknown() {
|
|
|
18304
18315
|
var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
|
|
18305
18316
|
$ZodNever.init(inst, def);
|
|
18306
18317
|
ZodType.init(inst, def);
|
|
18307
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18318
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => neverProcessor(inst, ctx, json3, params);
|
|
18308
18319
|
});
|
|
18309
18320
|
function never(params) {
|
|
18310
18321
|
return _never(ZodNever, params);
|
|
@@ -18312,7 +18323,7 @@ function never(params) {
|
|
|
18312
18323
|
var ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {
|
|
18313
18324
|
$ZodVoid.init(inst, def);
|
|
18314
18325
|
ZodType.init(inst, def);
|
|
18315
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18326
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => voidProcessor(inst, ctx, json3, params);
|
|
18316
18327
|
});
|
|
18317
18328
|
function _void2(params) {
|
|
18318
18329
|
return _void(ZodVoid, params);
|
|
@@ -18322,7 +18333,7 @@ var ZodDate = /* @__PURE__ */ $constructor(
|
|
|
18322
18333
|
(inst, def) => {
|
|
18323
18334
|
$ZodDate.init(inst, def);
|
|
18324
18335
|
ZodType.init(inst, def);
|
|
18325
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18336
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => dateProcessor(inst, ctx, json3, params);
|
|
18326
18337
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
18327
18338
|
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
18328
18339
|
},
|
|
@@ -18344,7 +18355,7 @@ var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
|
18344
18355
|
_ensureDefaultMemoizer();
|
|
18345
18356
|
$ZodArray.init(inst, def);
|
|
18346
18357
|
ZodType.init(inst, def);
|
|
18347
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18358
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => arrayProcessor(inst, ctx, json3, params);
|
|
18348
18359
|
inst.element = def.element;
|
|
18349
18360
|
}, {
|
|
18350
18361
|
min(n, params) {
|
|
@@ -18374,7 +18385,7 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
|
18374
18385
|
_ensureDefaultMemoizer();
|
|
18375
18386
|
$ZodObjectJIT.init(inst, def);
|
|
18376
18387
|
ZodType.init(inst, def);
|
|
18377
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18388
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => objectProcessor(inst, ctx, json3, params);
|
|
18378
18389
|
util_exports.installLazyProp(inst, "shape", (self2) => self2._zod.def.shape, false);
|
|
18379
18390
|
}, {
|
|
18380
18391
|
keyof() {
|
|
@@ -18447,7 +18458,7 @@ function looseObject(shape, params) {
|
|
|
18447
18458
|
var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
18448
18459
|
$ZodUnion.init(inst, def);
|
|
18449
18460
|
ZodType.init(inst, def);
|
|
18450
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18461
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => unionProcessor(inst, ctx, json3, params);
|
|
18451
18462
|
inst.options = def.options;
|
|
18452
18463
|
});
|
|
18453
18464
|
function union(options, params) {
|
|
@@ -18460,7 +18471,7 @@ function union(options, params) {
|
|
|
18460
18471
|
var ZodXor = /* @__PURE__ */ $constructor("ZodXor", (inst, def) => {
|
|
18461
18472
|
ZodUnion.init(inst, def);
|
|
18462
18473
|
$ZodXor.init(inst, def);
|
|
18463
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18474
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => unionProcessor(inst, ctx, json3, params);
|
|
18464
18475
|
inst.options = def.options;
|
|
18465
18476
|
});
|
|
18466
18477
|
function xor(options, params) {
|
|
@@ -18486,7 +18497,7 @@ function discriminatedUnion(discriminator, options, params) {
|
|
|
18486
18497
|
var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
18487
18498
|
$ZodIntersection.init(inst, def);
|
|
18488
18499
|
ZodType.init(inst, def);
|
|
18489
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18500
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => intersectionProcessor(inst, ctx, json3, params);
|
|
18490
18501
|
});
|
|
18491
18502
|
function intersection(left, right) {
|
|
18492
18503
|
return new ZodIntersection({
|
|
@@ -18499,7 +18510,7 @@ var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
|
|
|
18499
18510
|
_ensureDefaultMemoizer();
|
|
18500
18511
|
$ZodTuple.init(inst, def);
|
|
18501
18512
|
ZodType.init(inst, def);
|
|
18502
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18513
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => tupleProcessor(inst, ctx, json3, params);
|
|
18503
18514
|
}, {
|
|
18504
18515
|
rest(rest) {
|
|
18505
18516
|
return this.clone({
|
|
@@ -18532,7 +18543,7 @@ var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
|
18532
18543
|
_ensureDefaultMemoizer();
|
|
18533
18544
|
$ZodRecord.init(inst, def);
|
|
18534
18545
|
ZodType.init(inst, def);
|
|
18535
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18546
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => recordProcessor(inst, ctx, json3, params);
|
|
18536
18547
|
inst.keyType = def.keyType;
|
|
18537
18548
|
inst.valueType = def.valueType;
|
|
18538
18549
|
});
|
|
@@ -18574,7 +18585,7 @@ var ZodMap = /* @__PURE__ */ $constructor("ZodMap", (inst, def) => {
|
|
|
18574
18585
|
_ensureDefaultMemoizer();
|
|
18575
18586
|
$ZodMap.init(inst, def);
|
|
18576
18587
|
ZodType.init(inst, def);
|
|
18577
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18588
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => mapProcessor(inst, ctx, json3, params);
|
|
18578
18589
|
inst.keyType = def.keyType;
|
|
18579
18590
|
inst.valueType = def.valueType;
|
|
18580
18591
|
inst.min = (...args) => inst.check(_minSize(...args));
|
|
@@ -18594,7 +18605,7 @@ var ZodSet = /* @__PURE__ */ $constructor("ZodSet", (inst, def) => {
|
|
|
18594
18605
|
_ensureDefaultMemoizer();
|
|
18595
18606
|
$ZodSet.init(inst, def);
|
|
18596
18607
|
ZodType.init(inst, def);
|
|
18597
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18608
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => setProcessor(inst, ctx, json3, params);
|
|
18598
18609
|
inst.min = (...args) => inst.check(_minSize(...args));
|
|
18599
18610
|
inst.nonempty = (params) => inst.check(_minSize(1, params));
|
|
18600
18611
|
inst.max = (...args) => inst.check(_maxSize(...args));
|
|
@@ -18610,7 +18621,7 @@ function set(valueType, params) {
|
|
|
18610
18621
|
var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
18611
18622
|
$ZodEnum.init(inst, def);
|
|
18612
18623
|
ZodType.init(inst, def);
|
|
18613
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18624
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => enumProcessor(inst, ctx, json3, params);
|
|
18614
18625
|
inst.enum = def.entries;
|
|
18615
18626
|
inst.options = [...inst._zod.values];
|
|
18616
18627
|
const keys = new Set(Object.keys(def.entries));
|
|
@@ -18663,7 +18674,7 @@ function nativeEnum(entries, params) {
|
|
|
18663
18674
|
var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
18664
18675
|
$ZodLiteral.init(inst, def);
|
|
18665
18676
|
ZodType.init(inst, def);
|
|
18666
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18677
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => literalProcessor(inst, ctx, json3, params);
|
|
18667
18678
|
inst.values = new Set(def.values);
|
|
18668
18679
|
Object.defineProperty(inst, "value", {
|
|
18669
18680
|
get() {
|
|
@@ -18684,7 +18695,7 @@ function literal(value, params) {
|
|
|
18684
18695
|
var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => {
|
|
18685
18696
|
$ZodFile.init(inst, def);
|
|
18686
18697
|
ZodType.init(inst, def);
|
|
18687
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18698
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => fileProcessor(inst, ctx, json3, params);
|
|
18688
18699
|
inst.min = (size, params) => inst.check(_minSize(size, params));
|
|
18689
18700
|
inst.max = (size, params) => inst.check(_maxSize(size, params));
|
|
18690
18701
|
inst.mime = (types, params) => inst.check(_mime(Array.isArray(types) ? types : [types], params));
|
|
@@ -18696,7 +18707,7 @@ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
|
18696
18707
|
_ensureDefaultMemoizer();
|
|
18697
18708
|
$ZodTransform.init(inst, def);
|
|
18698
18709
|
ZodType.init(inst, def);
|
|
18699
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18710
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => transformProcessor(inst, ctx, json3, params);
|
|
18700
18711
|
inst._zod.parse = (payload, _ctx) => {
|
|
18701
18712
|
if (_ctx.direction === "backward") {
|
|
18702
18713
|
throw new $ZodEncodeError(inst.constructor.name);
|
|
@@ -18735,7 +18746,7 @@ function transform(fn) {
|
|
|
18735
18746
|
var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
18736
18747
|
$ZodOptional.init(inst, def);
|
|
18737
18748
|
ZodType.init(inst, def);
|
|
18738
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18749
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => optionalProcessor(inst, ctx, json3, params);
|
|
18739
18750
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
18740
18751
|
});
|
|
18741
18752
|
function optional(innerType) {
|
|
@@ -18747,7 +18758,7 @@ function optional(innerType) {
|
|
|
18747
18758
|
var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
|
|
18748
18759
|
$ZodExactOptional.init(inst, def);
|
|
18749
18760
|
ZodType.init(inst, def);
|
|
18750
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18761
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => optionalProcessor(inst, ctx, json3, params);
|
|
18751
18762
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
18752
18763
|
});
|
|
18753
18764
|
function exactOptional(innerType) {
|
|
@@ -18759,7 +18770,7 @@ function exactOptional(innerType) {
|
|
|
18759
18770
|
var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
18760
18771
|
$ZodNullable.init(inst, def);
|
|
18761
18772
|
ZodType.init(inst, def);
|
|
18762
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18773
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => nullableProcessor(inst, ctx, json3, params);
|
|
18763
18774
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
18764
18775
|
});
|
|
18765
18776
|
function nullable(innerType) {
|
|
@@ -18774,7 +18785,7 @@ function nullish2(innerType) {
|
|
|
18774
18785
|
var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
18775
18786
|
$ZodDefault.init(inst, def);
|
|
18776
18787
|
ZodType.init(inst, def);
|
|
18777
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18788
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => defaultProcessor(inst, ctx, json3, params);
|
|
18778
18789
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
18779
18790
|
inst.removeDefault = inst.unwrap;
|
|
18780
18791
|
});
|
|
@@ -18790,7 +18801,7 @@ function _default2(innerType, defaultValue) {
|
|
|
18790
18801
|
var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
18791
18802
|
$ZodPrefault.init(inst, def);
|
|
18792
18803
|
ZodType.init(inst, def);
|
|
18793
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18804
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => prefaultProcessor(inst, ctx, json3, params);
|
|
18794
18805
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
18795
18806
|
});
|
|
18796
18807
|
function prefault(innerType, defaultValue) {
|
|
@@ -18805,7 +18816,7 @@ function prefault(innerType, defaultValue) {
|
|
|
18805
18816
|
var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
18806
18817
|
$ZodNonOptional.init(inst, def);
|
|
18807
18818
|
ZodType.init(inst, def);
|
|
18808
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18819
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => nonoptionalProcessor(inst, ctx, json3, params);
|
|
18809
18820
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
18810
18821
|
});
|
|
18811
18822
|
function nonoptional(innerType, params) {
|
|
@@ -18818,7 +18829,7 @@ function nonoptional(innerType, params) {
|
|
|
18818
18829
|
var ZodSuccess = /* @__PURE__ */ $constructor("ZodSuccess", (inst, def) => {
|
|
18819
18830
|
$ZodSuccess.init(inst, def);
|
|
18820
18831
|
ZodType.init(inst, def);
|
|
18821
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18832
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => successProcessor(inst, ctx, json3, params);
|
|
18822
18833
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
18823
18834
|
});
|
|
18824
18835
|
function success(innerType) {
|
|
@@ -18830,7 +18841,7 @@ function success(innerType) {
|
|
|
18830
18841
|
var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
18831
18842
|
$ZodCatch.init(inst, def);
|
|
18832
18843
|
ZodType.init(inst, def);
|
|
18833
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18844
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => catchProcessor(inst, ctx, json3, params);
|
|
18834
18845
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
18835
18846
|
inst.removeCatch = inst.unwrap;
|
|
18836
18847
|
});
|
|
@@ -18844,7 +18855,7 @@ function _catch2(innerType, catchValue) {
|
|
|
18844
18855
|
var ZodNaN = /* @__PURE__ */ $constructor("ZodNaN", (inst, def) => {
|
|
18845
18856
|
$ZodNaN.init(inst, def);
|
|
18846
18857
|
ZodType.init(inst, def);
|
|
18847
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18858
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => nanProcessor(inst, ctx, json3, params);
|
|
18848
18859
|
});
|
|
18849
18860
|
function nan(params) {
|
|
18850
18861
|
return _nan(ZodNaN, params);
|
|
@@ -18852,7 +18863,7 @@ function nan(params) {
|
|
|
18852
18863
|
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
18853
18864
|
$ZodPipe.init(inst, def);
|
|
18854
18865
|
ZodType.init(inst, def);
|
|
18855
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18866
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => pipeProcessor(inst, ctx, json3, params);
|
|
18856
18867
|
inst.in = def.in;
|
|
18857
18868
|
inst.out = def.out;
|
|
18858
18869
|
});
|
|
@@ -18894,7 +18905,7 @@ var ZodPreprocess = /* @__PURE__ */ $constructor("ZodPreprocess", (inst, def) =>
|
|
|
18894
18905
|
var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
18895
18906
|
$ZodReadonly.init(inst, def);
|
|
18896
18907
|
ZodType.init(inst, def);
|
|
18897
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18908
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => readonlyProcessor(inst, ctx, json3, params);
|
|
18898
18909
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
18899
18910
|
});
|
|
18900
18911
|
function readonly(innerType) {
|
|
@@ -18906,7 +18917,7 @@ function readonly(innerType) {
|
|
|
18906
18917
|
var ZodTemplateLiteral = /* @__PURE__ */ $constructor("ZodTemplateLiteral", (inst, def) => {
|
|
18907
18918
|
$ZodTemplateLiteral.init(inst, def);
|
|
18908
18919
|
ZodType.init(inst, def);
|
|
18909
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18920
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => templateLiteralProcessor(inst, ctx, json3, params);
|
|
18910
18921
|
});
|
|
18911
18922
|
function templateLiteral(parts, params) {
|
|
18912
18923
|
return new ZodTemplateLiteral({
|
|
@@ -18918,7 +18929,7 @@ function templateLiteral(parts, params) {
|
|
|
18918
18929
|
var ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
|
|
18919
18930
|
$ZodLazy.init(inst, def);
|
|
18920
18931
|
ZodType.init(inst, def);
|
|
18921
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18932
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => lazyProcessor(inst, ctx, json3, params);
|
|
18922
18933
|
inst.unwrap = () => inst._zod.def.getter();
|
|
18923
18934
|
});
|
|
18924
18935
|
function lazy(getter) {
|
|
@@ -18930,7 +18941,7 @@ function lazy(getter) {
|
|
|
18930
18941
|
var ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => {
|
|
18931
18942
|
$ZodPromise.init(inst, def);
|
|
18932
18943
|
ZodType.init(inst, def);
|
|
18933
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18944
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => promiseProcessor(inst, ctx, json3, params);
|
|
18934
18945
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
18935
18946
|
});
|
|
18936
18947
|
function promise(innerType) {
|
|
@@ -18942,7 +18953,7 @@ function promise(innerType) {
|
|
|
18942
18953
|
var ZodFunction = /* @__PURE__ */ $constructor("ZodFunction", (inst, def) => {
|
|
18943
18954
|
$ZodFunction.init(inst, def);
|
|
18944
18955
|
ZodType.init(inst, def);
|
|
18945
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18956
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => functionProcessor(inst, ctx, json3, params);
|
|
18946
18957
|
});
|
|
18947
18958
|
function _function(params) {
|
|
18948
18959
|
return new ZodFunction({
|
|
@@ -18954,7 +18965,7 @@ function _function(params) {
|
|
|
18954
18965
|
var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
18955
18966
|
$ZodCustom.init(inst, def);
|
|
18956
18967
|
ZodType.init(inst, def);
|
|
18957
|
-
inst._zod.processJSONSchema = (ctx,
|
|
18968
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => customProcessor(inst, ctx, json3, params);
|
|
18958
18969
|
});
|
|
18959
18970
|
function check(fn) {
|
|
18960
18971
|
const ch = new $ZodCheck({
|
|
@@ -23344,13 +23355,13 @@ var HttpClient = class _HttpClient {
|
|
|
23344
23355
|
if (res.status === 204) {
|
|
23345
23356
|
return void 0;
|
|
23346
23357
|
}
|
|
23347
|
-
let
|
|
23358
|
+
let json3;
|
|
23348
23359
|
try {
|
|
23349
|
-
|
|
23360
|
+
json3 = await res.json();
|
|
23350
23361
|
} catch (err) {
|
|
23351
23362
|
throw new RelayError("transport_error", `Failed to parse response as JSON: ${err instanceof Error ? err.message : "unknown error"}`, { statusCode: res.status, retryable: false, cause: err });
|
|
23352
23363
|
}
|
|
23353
|
-
const envelope = apiEnvelopeSchema.safeParse(
|
|
23364
|
+
const envelope = apiEnvelopeSchema.safeParse(json3);
|
|
23354
23365
|
if (!envelope.success) {
|
|
23355
23366
|
throw new RelayError("transport_error", "Invalid API response", {
|
|
23356
23367
|
statusCode: res.status,
|
|
@@ -23358,7 +23369,7 @@ var HttpClient = class _HttpClient {
|
|
|
23358
23369
|
});
|
|
23359
23370
|
}
|
|
23360
23371
|
if (!envelope.data.ok) {
|
|
23361
|
-
const errParsed = ApiErrorSchema.safeParse(
|
|
23372
|
+
const errParsed = ApiErrorSchema.safeParse(json3);
|
|
23362
23373
|
const code = errParsed.success ? errParsed.data.error.code : "unknown_error";
|
|
23363
23374
|
const message = errParsed.success ? errParsed.data.error.message : "Unknown error";
|
|
23364
23375
|
throw relayErrorFromApi(code, message, res.status, parseRetryAfterMs(res) ?? void 0);
|
|
@@ -24606,6 +24617,260 @@ function actionContext(input2) {
|
|
|
24606
24617
|
};
|
|
24607
24618
|
}
|
|
24608
24619
|
|
|
24620
|
+
// ../sdk/dist/messaging/delegation.js
|
|
24621
|
+
var import_node_crypto = require("node:crypto");
|
|
24622
|
+
var import_node_http = require("node:http");
|
|
24623
|
+
var RELAY_DELEGATION_CLASSES = [
|
|
24624
|
+
"merge",
|
|
24625
|
+
"pr_ops",
|
|
24626
|
+
"deploy",
|
|
24627
|
+
"release",
|
|
24628
|
+
"secret_change",
|
|
24629
|
+
"destructive",
|
|
24630
|
+
"spend",
|
|
24631
|
+
"external_comms",
|
|
24632
|
+
"prompt_approval",
|
|
24633
|
+
"config_change"
|
|
24634
|
+
];
|
|
24635
|
+
var RELAY_DELEGATION_PROTECTED_SETTINGS = [
|
|
24636
|
+
"delegated_approvals_from",
|
|
24637
|
+
"spawn_delegate_approvals"
|
|
24638
|
+
];
|
|
24639
|
+
function parseConfigChangeTarget(target) {
|
|
24640
|
+
if (target.includes("*"))
|
|
24641
|
+
return void 0;
|
|
24642
|
+
const colon = target.indexOf(":");
|
|
24643
|
+
if (colon <= 0)
|
|
24644
|
+
return void 0;
|
|
24645
|
+
const change = target.slice(colon + 1);
|
|
24646
|
+
const equals = change.indexOf("=");
|
|
24647
|
+
if (equals <= 0 || equals === change.length - 1)
|
|
24648
|
+
return void 0;
|
|
24649
|
+
return {
|
|
24650
|
+
agentId: target.slice(0, colon),
|
|
24651
|
+
setting: change.slice(0, equals),
|
|
24652
|
+
value: change.slice(equals + 1)
|
|
24653
|
+
};
|
|
24654
|
+
}
|
|
24655
|
+
var MAX_LIFETIME_SECS = 360;
|
|
24656
|
+
var SKEW_SECS = 60;
|
|
24657
|
+
function decode3(part) {
|
|
24658
|
+
return Buffer.from(part, "base64url");
|
|
24659
|
+
}
|
|
24660
|
+
function json2(part) {
|
|
24661
|
+
try {
|
|
24662
|
+
const value = JSON.parse(decode3(part).toString("utf8"));
|
|
24663
|
+
return value && typeof value === "object" ? value : void 0;
|
|
24664
|
+
} catch {
|
|
24665
|
+
return void 0;
|
|
24666
|
+
}
|
|
24667
|
+
}
|
|
24668
|
+
function validCondition(condition) {
|
|
24669
|
+
if (!condition || typeof condition !== "object")
|
|
24670
|
+
return false;
|
|
24671
|
+
const c = condition;
|
|
24672
|
+
switch (c.type) {
|
|
24673
|
+
case "ci_green":
|
|
24674
|
+
case "mergeable":
|
|
24675
|
+
return true;
|
|
24676
|
+
case "head_sha":
|
|
24677
|
+
return typeof c.sha === "string" && /^[0-9a-f]{40}$/.test(c.sha);
|
|
24678
|
+
case "reviews_approved":
|
|
24679
|
+
return typeof c.min === "number" && Number.isInteger(c.min) && c.min >= 1 && c.min <= 10;
|
|
24680
|
+
case "not_before":
|
|
24681
|
+
return typeof c.at === "string" && !Number.isNaN(Date.parse(c.at));
|
|
24682
|
+
default:
|
|
24683
|
+
return false;
|
|
24684
|
+
}
|
|
24685
|
+
}
|
|
24686
|
+
function validAction(action) {
|
|
24687
|
+
if (!action || typeof action !== "object")
|
|
24688
|
+
return false;
|
|
24689
|
+
const a = action;
|
|
24690
|
+
const conditions = a.conditions ?? [];
|
|
24691
|
+
return typeof a.class === "string" && RELAY_DELEGATION_CLASSES.includes(a.class) && typeof a.target === "string" && a.target.trim().length > 0 && [...a.target].length <= 256 && Array.isArray(conditions) && conditions.length <= 5 && conditions.every(validCondition) && (a.class !== "config_change" || parseConfigChangeTarget(a.target) !== void 0) && (a.class !== "config_change" || conditions.every((c) => c.type === "not_before")) && (a.class !== "prompt_approval" || conditions.length === 0 && PROMPT_TARGET.test(a.target)) && (a.class !== "pr_ops" || parsePrOpsTarget(a.target) !== void 0);
|
|
24692
|
+
}
|
|
24693
|
+
var PROMPT_TARGET = /^[^:\s]+:[0-9a-f]{16}:(approve|deny)$/;
|
|
24694
|
+
function parsePrOpsTarget(target) {
|
|
24695
|
+
const match = /^([^\s/#:]+\/[^\s/#:]+#\d+):(.+)$/.exec(target);
|
|
24696
|
+
if (!match)
|
|
24697
|
+
return void 0;
|
|
24698
|
+
const [, pull, op] = match;
|
|
24699
|
+
const ok = ["open", "close", "reopen", "rerun_ci", "comment"].includes(op) || /^request_review=[^\s]+$/.test(op) || // A label may hold single spaces (`help wanted`), never at its ends,
|
|
24700
|
+
// repeated, or a control character.
|
|
24701
|
+
/^(label|unlabel)=[^\s](?:[^\s]| (?! ))*$/.test(op) && !new RegExp("\\p{Cc}", "u").test(op) && !op.endsWith(" ");
|
|
24702
|
+
return ok ? { pull, op } : void 0;
|
|
24703
|
+
}
|
|
24704
|
+
function verifyDelegationAttestation(jws, jwks, expected) {
|
|
24705
|
+
const parts = jws.split(".");
|
|
24706
|
+
if (parts.length !== 3)
|
|
24707
|
+
return void 0;
|
|
24708
|
+
const [headerPart, payloadPart, signaturePart] = parts;
|
|
24709
|
+
const header = json2(headerPart);
|
|
24710
|
+
if (!header || header.alg !== "EdDSA" || header.typ !== "relay-delegation+jws" || "crit" in header) {
|
|
24711
|
+
return void 0;
|
|
24712
|
+
}
|
|
24713
|
+
const kid = header.kid;
|
|
24714
|
+
const jwk = jwks.keys.find((key) => key.kty === "OKP" && key.crv === "Ed25519" && typeof key.kid === "string" && key.kid === kid && (key.use === void 0 || key.use === "sig") && typeof key.x === "string");
|
|
24715
|
+
if (!jwk)
|
|
24716
|
+
return void 0;
|
|
24717
|
+
let valid = false;
|
|
24718
|
+
try {
|
|
24719
|
+
const key = (0, import_node_crypto.createPublicKey)({ key: { kty: "OKP", crv: "Ed25519", x: jwk.x }, format: "jwk" });
|
|
24720
|
+
valid = (0, import_node_crypto.verify)(null, Buffer.from(`${headerPart}.${payloadPart}`), key, decode3(signaturePart));
|
|
24721
|
+
} catch {
|
|
24722
|
+
return void 0;
|
|
24723
|
+
}
|
|
24724
|
+
if (!valid)
|
|
24725
|
+
return void 0;
|
|
24726
|
+
const claims = json2(payloadPart);
|
|
24727
|
+
if (!claims)
|
|
24728
|
+
return void 0;
|
|
24729
|
+
const now = expected.now ?? Math.floor(Date.now() / 1e3);
|
|
24730
|
+
const actions = claims.actions;
|
|
24731
|
+
const standing = claims.standing ?? "own_owner";
|
|
24732
|
+
const iat = claims.iat;
|
|
24733
|
+
const exp = claims.exp;
|
|
24734
|
+
if (claims.v !== 1 || claims.tier !== "D" && claims.tier !== "O" || standing !== "own_owner" && standing !== "code_owner" || !Array.isArray(actions) || actions.length < 1 || actions.length > 20 || !actions.every(validAction) || typeof iat !== "number" || typeof exp !== "number" || typeof claims.approval_id !== "string" || typeof claims.delegate_agent_id !== "string" || typeof claims.grant_id !== "string" || typeof claims.owner_id !== "string") {
|
|
24735
|
+
return void 0;
|
|
24736
|
+
}
|
|
24737
|
+
if (claims.ws !== expected.workspaceId || claims.message_id !== expected.messageId || claims.recipient_agent_id !== expected.recipientAgentId || expected.senderId !== void 0 && claims.delegate_agent_id !== expected.senderId) {
|
|
24738
|
+
return void 0;
|
|
24739
|
+
}
|
|
24740
|
+
if (exp <= now || iat > now + SKEW_SECS || exp - now > MAX_LIFETIME_SECS || exp - iat > MAX_LIFETIME_SECS || exp < iat) {
|
|
24741
|
+
return void 0;
|
|
24742
|
+
}
|
|
24743
|
+
for (const action of actions) {
|
|
24744
|
+
const change = action.class === "config_change" ? parseConfigChangeTarget(action.target) : void 0;
|
|
24745
|
+
if (change && (change.agentId !== expected.recipientAgentId || RELAY_DELEGATION_PROTECTED_SETTINGS.includes(change.setting))) {
|
|
24746
|
+
return void 0;
|
|
24747
|
+
}
|
|
24748
|
+
}
|
|
24749
|
+
const singleUse = claims.single_use === true;
|
|
24750
|
+
if (!singleUse && actions.some((action) => action.class === "config_change"))
|
|
24751
|
+
return void 0;
|
|
24752
|
+
return {
|
|
24753
|
+
verified: true,
|
|
24754
|
+
tier: claims.tier,
|
|
24755
|
+
standing,
|
|
24756
|
+
ownerId: claims.owner_id,
|
|
24757
|
+
...typeof claims.owner_display === "string" ? { ownerDisplay: claims.owner_display } : {},
|
|
24758
|
+
delegateAgentId: claims.delegate_agent_id,
|
|
24759
|
+
grantId: claims.grant_id,
|
|
24760
|
+
approvalId: claims.approval_id,
|
|
24761
|
+
actions,
|
|
24762
|
+
singleUse,
|
|
24763
|
+
...typeof claims.quote === "string" ? { quote: claims.quote } : {},
|
|
24764
|
+
expiresAt: new Date(exp * 1e3).toISOString(),
|
|
24765
|
+
jws
|
|
24766
|
+
};
|
|
24767
|
+
}
|
|
24768
|
+
function withVerifiedDelegation(message, jws, jwks, expected) {
|
|
24769
|
+
const { delegation: _unverified, ...rest } = message;
|
|
24770
|
+
const delegation = verifyDelegationAttestation(jws, jwks, {
|
|
24771
|
+
...expected,
|
|
24772
|
+
messageId: message.id,
|
|
24773
|
+
...message.from.id ? { senderId: message.from.id } : {}
|
|
24774
|
+
});
|
|
24775
|
+
return delegation ? { ...rest, delegation } : rest;
|
|
24776
|
+
}
|
|
24777
|
+
function delegationCovers(message, action, now = Date.now()) {
|
|
24778
|
+
const delegation = message.delegation;
|
|
24779
|
+
return delegation?.verified === true && Date.parse(delegation.expiresAt) > now && delegation.actions.some((covered) => covered.class === action.class && covered.target === action.target);
|
|
24780
|
+
}
|
|
24781
|
+
function toWireOwnerApproval(input2) {
|
|
24782
|
+
return {
|
|
24783
|
+
v: 1,
|
|
24784
|
+
owner_id: input2.ownerId,
|
|
24785
|
+
actions: input2.actions.map((action) => ({
|
|
24786
|
+
class: action.class,
|
|
24787
|
+
target: action.target,
|
|
24788
|
+
...action.conditions?.length ? { conditions: action.conditions } : {},
|
|
24789
|
+
...action.note !== void 0 ? { note: action.note } : {}
|
|
24790
|
+
})),
|
|
24791
|
+
...input2.quote !== void 0 ? { quote: input2.quote } : {},
|
|
24792
|
+
...input2.quotedAt !== void 0 ? { quoted_at: input2.quotedAt } : {},
|
|
24793
|
+
...input2.quoteSource !== void 0 ? { quote_source: input2.quoteSource } : {},
|
|
24794
|
+
...input2.expiresAt !== void 0 ? { expires_at: input2.expiresAt } : {},
|
|
24795
|
+
...input2.approvalRef !== void 0 ? { approval_ref: input2.approvalRef } : {}
|
|
24796
|
+
};
|
|
24797
|
+
}
|
|
24798
|
+
function sessionSocketEndpoint(path5, platform = process.platform) {
|
|
24799
|
+
if (platform !== "win32")
|
|
24800
|
+
return path5;
|
|
24801
|
+
let key = path5.replace(/\//g, "\\").toLowerCase();
|
|
24802
|
+
if (key.startsWith("\\\\?\\"))
|
|
24803
|
+
key = key.slice(4);
|
|
24804
|
+
while (key.length > 1 && key.endsWith("\\"))
|
|
24805
|
+
key = key.slice(0, -1);
|
|
24806
|
+
const hex3 = (0, import_node_crypto.createHash)("sha256").update(key, "utf8").digest().subarray(0, 8).toString("hex");
|
|
24807
|
+
return `\\\\.\\pipe\\agent-relay-${hex3}`;
|
|
24808
|
+
}
|
|
24809
|
+
async function redeemOwnerApproval(approvalId, action, options = {}) {
|
|
24810
|
+
const socketPath = options.socketPath ?? process.env.AGENT_RELAY_SOCKET;
|
|
24811
|
+
if (!socketPath) {
|
|
24812
|
+
throw new Error("redeemOwnerApproval needs socketPath or AGENT_RELAY_SOCKET: the node session socket.");
|
|
24813
|
+
}
|
|
24814
|
+
const query = new URLSearchParams({ approval: approvalId, class: action.class, target: action.target });
|
|
24815
|
+
const answer = await postSessionSocket(socketPath, `/delegation/redeem?${query.toString()}`);
|
|
24816
|
+
if (answer.ok === true) {
|
|
24817
|
+
const checked = answer.checked;
|
|
24818
|
+
const sha = checked && typeof checked.head_sha === "string" ? checked.head_sha : void 0;
|
|
24819
|
+
return {
|
|
24820
|
+
ok: true,
|
|
24821
|
+
consumed: answer.consumed === true,
|
|
24822
|
+
...sha && /^[0-9a-f]{40}$/.test(sha) ? { checked: { head_sha: sha } } : {}
|
|
24823
|
+
};
|
|
24824
|
+
}
|
|
24825
|
+
return {
|
|
24826
|
+
ok: false,
|
|
24827
|
+
reason: typeof answer.reason === "string" ? answer.reason : "refused",
|
|
24828
|
+
...Array.isArray(answer.unmet) ? { unmet: answer.unmet } : {}
|
|
24829
|
+
};
|
|
24830
|
+
}
|
|
24831
|
+
async function postSessionSocket(socketPath, path5) {
|
|
24832
|
+
const route = path5.split("?")[0];
|
|
24833
|
+
const body = await new Promise((resolve2, reject) => {
|
|
24834
|
+
const req = (0, import_node_http.request)({
|
|
24835
|
+
socketPath: sessionSocketEndpoint(socketPath),
|
|
24836
|
+
method: "POST",
|
|
24837
|
+
path: path5,
|
|
24838
|
+
headers: { "content-length": 0 }
|
|
24839
|
+
}, (res) => {
|
|
24840
|
+
const chunks = [];
|
|
24841
|
+
res.on("data", (chunk) => chunks.push(chunk));
|
|
24842
|
+
res.on("end", () => {
|
|
24843
|
+
const text = Buffer.concat(chunks).toString("utf8");
|
|
24844
|
+
if ((res.statusCode ?? 500) >= 400) {
|
|
24845
|
+
reject(new Error(`${route} refused (${res.statusCode}): ${text}`));
|
|
24846
|
+
} else {
|
|
24847
|
+
resolve2(text);
|
|
24848
|
+
}
|
|
24849
|
+
});
|
|
24850
|
+
res.on("error", reject);
|
|
24851
|
+
});
|
|
24852
|
+
req.on("error", reject);
|
|
24853
|
+
req.end();
|
|
24854
|
+
});
|
|
24855
|
+
const envelope = JSON.parse(body);
|
|
24856
|
+
const data = envelope.data;
|
|
24857
|
+
if (envelope.ok !== true || !data || typeof data !== "object") {
|
|
24858
|
+
throw new Error(`${route} answered without a result: ${body}`);
|
|
24859
|
+
}
|
|
24860
|
+
return data;
|
|
24861
|
+
}
|
|
24862
|
+
async function withdrawOwnerApproval(approvalId, options = {}) {
|
|
24863
|
+
const socketPath = options.socketPath ?? process.env.AGENT_RELAY_SOCKET;
|
|
24864
|
+
if (!socketPath) {
|
|
24865
|
+
throw new Error("withdrawOwnerApproval needs socketPath or AGENT_RELAY_SOCKET: the node session socket.");
|
|
24866
|
+
}
|
|
24867
|
+
const query = new URLSearchParams({ approval: approvalId });
|
|
24868
|
+
const answer = await postSessionSocket(socketPath, `/delegation/withdraw?${query.toString()}`);
|
|
24869
|
+
if (answer.ok === true)
|
|
24870
|
+
return { ok: true };
|
|
24871
|
+
return { ok: false, reason: typeof answer.reason === "string" ? answer.reason : "refused" };
|
|
24872
|
+
}
|
|
24873
|
+
|
|
24609
24874
|
// ../sdk/dist/relaycast-telemetry.js
|
|
24610
24875
|
var ORIGIN_ACTOR_ENV = "AGENT_RELAY_ORIGIN_ACTOR";
|
|
24611
24876
|
var HARNESS_ENV_KEYS = [
|
|
@@ -26328,6 +26593,7 @@ function delay(ms) {
|
|
|
26328
26593
|
}
|
|
26329
26594
|
|
|
26330
26595
|
// ../sdk/dist/messaging/relaycast.js
|
|
26596
|
+
var import_node_crypto2 = require("node:crypto");
|
|
26331
26597
|
var DEFAULT_CONFIRM_TIMEOUT_MS = 36e4;
|
|
26332
26598
|
var DEFAULT_CONFIRM_POLL_MS = 500;
|
|
26333
26599
|
var MAX_CONFIRM_TIMEOUT_MS = 2147483647;
|
|
@@ -26467,6 +26733,22 @@ var RelaycastMessagingClient = class {
|
|
|
26467
26733
|
};
|
|
26468
26734
|
messages = {
|
|
26469
26735
|
send: async (input2) => {
|
|
26736
|
+
if (input2.ownerApproval) {
|
|
26737
|
+
const name = normalizeChannelName(input2.channel).replace(/^#/, "");
|
|
26738
|
+
const message2 = await this.postWithOwnerApproval("messages.send", `/v1/channels/${encodeURIComponent(name)}/messages`, {
|
|
26739
|
+
text: input2.text,
|
|
26740
|
+
...definedOptions({
|
|
26741
|
+
attachments: serializeAttachmentInputs(input2.attachments),
|
|
26742
|
+
blocks: input2.blocks,
|
|
26743
|
+
data: replayMessageMetadata(input2.metadata, this.sessionRef)
|
|
26744
|
+
}),
|
|
26745
|
+
mode: input2.mode ?? "wait"
|
|
26746
|
+
}, input2.ownerApproval, input2.idempotencyKey);
|
|
26747
|
+
return normalizeMessage(message2, {
|
|
26748
|
+
kind: "channel",
|
|
26749
|
+
channelName: normalizeChannelName(input2.channel)
|
|
26750
|
+
});
|
|
26751
|
+
}
|
|
26470
26752
|
const message = await this.requireAgentClient("messages.send").send(input2.channel, input2.text, definedOptions({
|
|
26471
26753
|
attachments: serializeAttachmentInputs(input2.attachments),
|
|
26472
26754
|
blocks: input2.blocks,
|
|
@@ -26495,6 +26777,18 @@ var RelaycastMessagingClient = class {
|
|
|
26495
26777
|
});
|
|
26496
26778
|
},
|
|
26497
26779
|
direct: async (input2) => {
|
|
26780
|
+
if (input2.ownerApproval) {
|
|
26781
|
+
const response2 = await this.postWithOwnerApproval("messages.direct", "/v1/dm", {
|
|
26782
|
+
to: input2.to,
|
|
26783
|
+
text: input2.text,
|
|
26784
|
+
...definedOptions({
|
|
26785
|
+
attachments: serializeAttachmentInputs(input2.attachments),
|
|
26786
|
+
data: replayMessageMetadata(input2.metadata, this.sessionRef)
|
|
26787
|
+
}),
|
|
26788
|
+
mode: input2.mode ?? "wait"
|
|
26789
|
+
}, input2.ownerApproval, input2.idempotencyKey);
|
|
26790
|
+
return this.normalizeDirectResponse(response2, "dm");
|
|
26791
|
+
}
|
|
26498
26792
|
const response = await this.requireAgentClient("messages.direct").dm(input2.to, input2.text, definedOptions({
|
|
26499
26793
|
attachments: serializeAttachmentInputs(input2.attachments),
|
|
26500
26794
|
data: replayMessageMetadata(input2.metadata, this.sessionRef),
|
|
@@ -27162,6 +27456,21 @@ var RelaycastMessagingClient = class {
|
|
|
27162
27456
|
}
|
|
27163
27457
|
return actions;
|
|
27164
27458
|
}
|
|
27459
|
+
/**
|
|
27460
|
+
* Sends `body` with `owner_approval` beside it, as a delegate: the
|
|
27461
|
+
* relaycast client's own send drops fields it does not know, so this
|
|
27462
|
+
* posts through its HTTP client. The approval goes out in wire (snake_case)
|
|
27463
|
+
* form, which the client's key casing leaves as it is.
|
|
27464
|
+
*/
|
|
27465
|
+
async postWithOwnerApproval(operation, path5, body, ownerApproval, idempotencyKey) {
|
|
27466
|
+
const agent = this.requireAgentClient(operation);
|
|
27467
|
+
const post = agent.client?.post?.bind(agent.client);
|
|
27468
|
+
if (!post) {
|
|
27469
|
+
throw new Error(`RelaycastMessagingClient.${operation} with ownerApproval requires a relaycast agent client.`);
|
|
27470
|
+
}
|
|
27471
|
+
const key = idempotencyKey?.trim() || (0, import_node_crypto2.randomUUID)();
|
|
27472
|
+
return post(path5, { ...body, owner_approval: toWireOwnerApproval(ownerApproval) }, { headers: { "Idempotency-Key": key, "X-Idempotency-Key": key } });
|
|
27473
|
+
}
|
|
27165
27474
|
requireAgentClient(operation) {
|
|
27166
27475
|
if (!this.agentClient) {
|
|
27167
27476
|
throw new Error(`RelaycastMessagingClient.${operation} requires agentToken or agentClient.`);
|
|
@@ -27942,6 +28251,9 @@ function createEnrichedMessages(base, resolveFrom) {
|
|
|
27942
28251
|
const messages = resolveFrom(sendInput.from);
|
|
27943
28252
|
const text = buildText(sendInput.text ?? sendInput.msg, sendInput.mentions);
|
|
27944
28253
|
if (Array.isArray(sendInput.to)) {
|
|
28254
|
+
if (sendInput.ownerApproval) {
|
|
28255
|
+
throw new Error("ownerApproval goes on a channel or direct message, not a group DM.");
|
|
28256
|
+
}
|
|
27945
28257
|
return messages.groupDirect({
|
|
27946
28258
|
participants: sendInput.to.map(resolveAgentName),
|
|
27947
28259
|
text,
|
|
@@ -27959,7 +28271,8 @@ function createEnrichedMessages(base, resolveFrom) {
|
|
|
27959
28271
|
attachments: sendInput.attachments,
|
|
27960
28272
|
mode: sendInput.mode,
|
|
27961
28273
|
idempotencyKey: sendInput.idempotencyKey,
|
|
27962
|
-
metadata: sendInput.metadata
|
|
28274
|
+
metadata: sendInput.metadata,
|
|
28275
|
+
ownerApproval: sendInput.ownerApproval
|
|
27963
28276
|
});
|
|
27964
28277
|
}
|
|
27965
28278
|
return messages.direct({
|
|
@@ -27968,7 +28281,8 @@ function createEnrichedMessages(base, resolveFrom) {
|
|
|
27968
28281
|
attachments: sendInput.attachments,
|
|
27969
28282
|
mode: sendInput.mode,
|
|
27970
28283
|
idempotencyKey: sendInput.idempotencyKey,
|
|
27971
|
-
metadata: sendInput.metadata
|
|
28284
|
+
metadata: sendInput.metadata,
|
|
28285
|
+
ownerApproval: sendInput.ownerApproval
|
|
27972
28286
|
});
|
|
27973
28287
|
};
|
|
27974
28288
|
enriched.reply = async (input2) => {
|
|
@@ -27997,7 +28311,8 @@ function createEnrichedMessages(base, resolveFrom) {
|
|
|
27997
28311
|
attachments: input2.attachments,
|
|
27998
28312
|
mode: input2.mode,
|
|
27999
28313
|
idempotencyKey: input2.idempotencyKey,
|
|
28000
|
-
metadata: input2.metadata
|
|
28314
|
+
metadata: input2.metadata,
|
|
28315
|
+
ownerApproval: input2.ownerApproval
|
|
28001
28316
|
});
|
|
28002
28317
|
};
|
|
28003
28318
|
return enriched;
|
|
@@ -28156,6 +28471,7 @@ function createNotifyHandler(messages, target, options) {
|
|
|
28156
28471
|
// ../sdk/dist/agent-relay.js
|
|
28157
28472
|
var AgentRelay = class _AgentRelay {
|
|
28158
28473
|
messaging;
|
|
28474
|
+
approvals = { redeem: redeemOwnerApproval, withdraw: withdrawOwnerApproval };
|
|
28159
28475
|
actions;
|
|
28160
28476
|
workspaceKey;
|
|
28161
28477
|
observerToken;
|
|
@@ -28416,6 +28732,7 @@ function agentRelayAgent(messaging, actions, handlerAgent, options) {
|
|
|
28416
28732
|
nodes: messaging.nodes,
|
|
28417
28733
|
triggers: messaging.triggers,
|
|
28418
28734
|
files: messaging.files,
|
|
28735
|
+
approvals: { redeem: redeemOwnerApproval, withdraw: withdrawOwnerApproval },
|
|
28419
28736
|
workspace: createWorkspaceFacade(messaging),
|
|
28420
28737
|
registerAction: (def) => registerFacadeAction(actions, def, { messaging, handlerAgent, onError: options?.onError }),
|
|
28421
28738
|
addListener: ((selector, handler) => hub.addListener(selector, handler)),
|
|
@@ -29714,9 +30031,9 @@ function handleResponse(res, resolve2, reject) {
|
|
|
29714
30031
|
});
|
|
29715
30032
|
res.on("end", () => {
|
|
29716
30033
|
try {
|
|
29717
|
-
const
|
|
29718
|
-
if (
|
|
29719
|
-
resolve2(
|
|
30034
|
+
const json3 = JSON.parse(data);
|
|
30035
|
+
if (json3.version) {
|
|
30036
|
+
resolve2(json3.version);
|
|
29720
30037
|
} else {
|
|
29721
30038
|
reject(new Error("No version in response"));
|
|
29722
30039
|
}
|
|
@@ -29796,10 +30113,10 @@ function checkForUpdatesInBackground(currentVersion) {
|
|
|
29796
30113
|
}
|
|
29797
30114
|
|
|
29798
30115
|
// ../utils/dist/error-tracking.js
|
|
29799
|
-
var
|
|
30116
|
+
var import_node_crypto3 = require("node:crypto");
|
|
29800
30117
|
function generateErrorId() {
|
|
29801
30118
|
const timestamp = Math.floor(Date.now() / 1e3);
|
|
29802
|
-
const random = (0,
|
|
30119
|
+
const random = (0, import_node_crypto3.randomBytes)(2).toString("hex");
|
|
29803
30120
|
return `ERR-${timestamp}-${random}`;
|
|
29804
30121
|
}
|
|
29805
30122
|
function createTraceableError(message, context = {}, originalError) {
|
|
@@ -29958,7 +30275,7 @@ function validateModelForCli(cli, model) {
|
|
|
29958
30275
|
|
|
29959
30276
|
// ../utils/dist/client-helpers.js
|
|
29960
30277
|
var import_node_net = require("node:net");
|
|
29961
|
-
var
|
|
30278
|
+
var import_node_crypto4 = require("node:crypto");
|
|
29962
30279
|
|
|
29963
30280
|
// ../utils/dist/legacy-protocol.js
|
|
29964
30281
|
var PROTOCOL_VERSION = 1;
|
|
@@ -30085,7 +30402,7 @@ function createRequestHandler(socketPath, envelope, options) {
|
|
|
30085
30402
|
});
|
|
30086
30403
|
}
|
|
30087
30404
|
function generateRequestId(prefix = "") {
|
|
30088
|
-
return `${prefix}${Date.now().toString(36)}-${(0,
|
|
30405
|
+
return `${prefix}${Date.now().toString(36)}-${(0, import_node_crypto4.randomUUID)().slice(0, 8)}`;
|
|
30089
30406
|
}
|
|
30090
30407
|
// Annotate the CommonJS export names for ESM import in node:
|
|
30091
30408
|
0 && (module.exports = {
|
|
@@ -30113,6 +30430,8 @@ function generateRequestId(prefix = "") {
|
|
|
30113
30430
|
OBSERVABILITY_UNAVAILABLE,
|
|
30114
30431
|
RELAYCAST_SDK_VERSION,
|
|
30115
30432
|
RELAY_ATTEST_SESSION_ID_ENV,
|
|
30433
|
+
RELAY_DELEGATION_CLASSES,
|
|
30434
|
+
RELAY_DELEGATION_PROTECTED_SETTINGS,
|
|
30116
30435
|
RELAY_FILE_DOWNLOAD_MAX_BYTES,
|
|
30117
30436
|
RELAY_OBSERVER_SCOPES,
|
|
30118
30437
|
RELAY_SERVICE_FAILURE_MESSAGE,
|
|
@@ -30159,6 +30478,7 @@ function generateRequestId(prefix = "") {
|
|
|
30159
30478
|
createWorkspaceFacade,
|
|
30160
30479
|
currentReplaySessionRef,
|
|
30161
30480
|
defineHarness,
|
|
30481
|
+
delegationCovers,
|
|
30162
30482
|
downloadRelayFile,
|
|
30163
30483
|
findGitRoot,
|
|
30164
30484
|
formatAgentHandle,
|
|
@@ -30213,8 +30533,11 @@ function generateRequestId(prefix = "") {
|
|
|
30213
30533
|
normalizeSearchResult,
|
|
30214
30534
|
normalizeThread,
|
|
30215
30535
|
normalizeWebhookSubscription,
|
|
30536
|
+
parseConfigChangeTarget,
|
|
30216
30537
|
parseGitRemoteUrl,
|
|
30538
|
+
parsePrOpsTarget,
|
|
30217
30539
|
printUpdateNotification,
|
|
30540
|
+
redeemOwnerApproval,
|
|
30218
30541
|
reduceAgentActivity,
|
|
30219
30542
|
registerFacadeAction,
|
|
30220
30543
|
replayMessageMetadata,
|
|
@@ -30226,14 +30549,19 @@ function generateRequestId(prefix = "") {
|
|
|
30226
30549
|
revokeObserverToken,
|
|
30227
30550
|
routerLog,
|
|
30228
30551
|
safeRelayErrorMessage,
|
|
30552
|
+
sessionSocketEndpoint,
|
|
30229
30553
|
stripAnsiFast,
|
|
30230
30554
|
toPublicMessagingEvent,
|
|
30231
30555
|
toReleaseResult,
|
|
30232
30556
|
toSpawnResult,
|
|
30557
|
+
toWireOwnerApproval,
|
|
30233
30558
|
trackPatternPerformance,
|
|
30234
30559
|
unescapeFenceMarkersFast,
|
|
30235
30560
|
uploadRelayFile,
|
|
30236
30561
|
validateJsonSchemaLite,
|
|
30237
30562
|
validateModelForCli,
|
|
30238
|
-
|
|
30563
|
+
verifyDelegationAttestation,
|
|
30564
|
+
withErrorTracing,
|
|
30565
|
+
withVerifiedDelegation,
|
|
30566
|
+
withdrawOwnerApproval
|
|
30239
30567
|
});
|