@integrity-labs/agt-cli 0.28.889 → 0.28.891
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/bin/agt.js +5 -5
- package/dist/{chunk-SQZYQ3KY.js → chunk-2IVLMJXQ.js} +4 -4
- package/dist/{chunk-7LIBFSX6.js → chunk-BH5RFBUM.js} +38 -13
- package/dist/chunk-BH5RFBUM.js.map +1 -0
- package/dist/{chunk-OMRYKBFE.js → chunk-SXYTFXPO.js} +139 -3
- package/dist/chunk-SXYTFXPO.js.map +1 -0
- package/dist/{claude-pair-runtime-5UINWQ52.js → claude-pair-runtime-TCDKO2CZ.js} +2 -2
- package/dist/lib/manager-worker.js +14 -14
- package/dist/mcp/direct-chat-channel.js +31 -7
- package/dist/mcp/index.js +1384 -1345
- package/dist/mcp/origami.js +31 -7
- package/dist/mcp/slack-channel.js +31 -7
- package/dist/mcp/telegram-channel.js +31 -7
- package/dist/{persistent-session-RFQKA2H5.js → persistent-session-ZDZSEODJ.js} +15 -3
- package/dist/{responsiveness-probe-65AHLKWV.js → responsiveness-probe-7CY5VZMG.js} +3 -3
- package/dist/{session-auth-dead-LXGSDCB7.js → session-auth-dead-65TG2DLW.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-7LIBFSX6.js.map +0 -1
- package/dist/chunk-OMRYKBFE.js.map +0 -1
- /package/dist/{chunk-SQZYQ3KY.js.map → chunk-2IVLMJXQ.js.map} +0 -0
- /package/dist/{claude-pair-runtime-5UINWQ52.js.map → claude-pair-runtime-TCDKO2CZ.js.map} +0 -0
- /package/dist/{persistent-session-RFQKA2H5.js.map → persistent-session-ZDZSEODJ.js.map} +0 -0
- /package/dist/{responsiveness-probe-65AHLKWV.js.map → responsiveness-probe-7CY5VZMG.js.map} +0 -0
- /package/dist/{session-auth-dead-LXGSDCB7.js.map → session-auth-dead-65TG2DLW.js.map} +0 -0
package/dist/mcp/index.js
CHANGED
|
@@ -29779,14 +29779,38 @@ var FLAG_REGISTRY = [
|
|
|
29779
29779
|
},
|
|
29780
29780
|
{
|
|
29781
29781
|
key: "agent-unified-screen",
|
|
29782
|
-
description: 'Unified agent screen redesign (ENG-8478 epic / ENG-8480). When ON, the webapp renders the new single-screen "viewing is editing" agent surface (stripped-back hero, working agent switcher, inline-editable profile, embedded operational panels + a live direct-chat drawer) in place of the separate agent view/edit pages; when OFF, the current view/edit pages are unchanged. Additive UI gate \u2014 no data-model change: each panel reads the same existing endpoints the current pages use. Composes independently with app-top-nav-shell (the two flags are reconciled in ENG-8488).
|
|
29782
|
+
description: 'Unified agent screen redesign (ENG-8478 epic / ENG-8480). When ON, the webapp renders the new single-screen "viewing is editing" agent surface (stripped-back hero, working agent switcher, inline-editable profile, embedded operational panels + a live direct-chat drawer) in place of the separate agent view/edit pages; when OFF, the current view/edit pages are unchanged. Additive UI gate \u2014 no data-model change: each panel reads the same existing endpoints the current pages use. Composes independently with app-top-nav-shell (the two flags are reconciled in ENG-8488). NO LONGER DARK: ENG-9832 cutover step 1 flipped the default to true, so an org with no override now gets the unified screen. The key survives only until cutover step 2 deletes it \u2014 which is blocked on ENG-8547 and ENG-8559, because the flag-off branch is still the only home for the /edit tabs.',
|
|
29783
29783
|
flagType: "boolean",
|
|
29784
|
-
//
|
|
29785
|
-
//
|
|
29786
|
-
|
|
29787
|
-
//
|
|
29788
|
-
// so
|
|
29789
|
-
//
|
|
29784
|
+
// ENG-9832 (cutover step 1): flipped `false` -> `true`. The comment this
|
|
29785
|
+
// replaces called `false` the safe direction — "the current view/edit
|
|
29786
|
+
// pages", never "a half-built redesign". That was true while the redesign
|
|
29787
|
+
// was half built. It has been the shipped surface for the pilot orgs since
|
|
29788
|
+
// ENG-8481, so `false` now points at the pages being retired, not at safety.
|
|
29789
|
+
// The old rationale is recorded rather than deleted because it was correct
|
|
29790
|
+
// under a premise that has since expired.
|
|
29791
|
+
//
|
|
29792
|
+
// MIND THE SPLIT. This value is consulted by the API evaluator when it
|
|
29793
|
+
// builds the `GET /flags` map for an org with NO override. It is NOT the
|
|
29794
|
+
// fallback the webapp uses when that fetch fails: `getPublicBooleanFlagServer`
|
|
29795
|
+
// and `usePublicBooleanFlag` both return the argument passed at the CALL
|
|
29796
|
+
// SITE and never consult this registry. Three call sites carry `true` to
|
|
29797
|
+
// match — agents/[agentId]/page.tsx, agents/[agentId]/edit/page.tsx and
|
|
29798
|
+
// `useAgentUnifiedScreenEnabled` in lib/redesign-flags.ts. Flipping the
|
|
29799
|
+
// registry alone leaves the cutover half-applied with no error anywhere;
|
|
29800
|
+
// eng-9832-unified-fallback-parity.test.ts fails if any of the three drifts.
|
|
29801
|
+
defaultValue: true,
|
|
29802
|
+
// Read BOTH server-side (agents/[agentId]/page.tsx and its /edit sibling, via
|
|
29803
|
+
// getPublicBooleanFlagServer) and client-side (dashboard-sherlock-shell.tsx,
|
|
29804
|
+
// via usePublicBooleanFlag), so the key must be in the browser-exposed public
|
|
29805
|
+
// map. Additive viewer gate, resolved within the active-org cookie's scope
|
|
29806
|
+
// — not sensitive.
|
|
29807
|
+
//
|
|
29808
|
+
// `public` MUST STAY until step 2 deletes the key, and the reason reads
|
|
29809
|
+
// backwards: the server helper resolves against the very SAME public-filtered
|
|
29810
|
+
// `GET /flags` the browser uses (routes/flags.ts filters to
|
|
29811
|
+
// listPublicFlagKeys()). Drop `public` and the key is simply absent from the
|
|
29812
|
+
// map, so both server readers fall through to their call-site argument
|
|
29813
|
+
// forever — silently, with no error raised anywhere.
|
|
29790
29814
|
public: true
|
|
29791
29815
|
},
|
|
29792
29816
|
{
|
|
@@ -30141,660 +30165,296 @@ var MIN_PROVISIONING_MAX_FOR_QUARANTINE_ORDERING = BIND_FAILURE_QUARANTINE_THRES
|
|
|
30141
30165
|
var FORCED_UPDATE_RELAX_AFTER_MS = 7 * 6e4;
|
|
30142
30166
|
var FORCED_UPDATE_HARD_DEADLINE_MS = 15 * 6e4;
|
|
30143
30167
|
|
|
30144
|
-
//
|
|
30145
|
-
var
|
|
30146
|
-
|
|
30147
|
-
|
|
30148
|
-
|
|
30149
|
-
|
|
30150
|
-
|
|
30151
|
-
|
|
30152
|
-
|
|
30153
|
-
|
|
30154
|
-
|
|
30155
|
-
|
|
30156
|
-
|
|
30157
|
-
|
|
30158
|
-
|
|
30159
|
-
|
|
30160
|
-
|
|
30161
|
-
|
|
30162
|
-
|
|
30163
|
-
|
|
30164
|
-
|
|
30165
|
-
|
|
30166
|
-
|
|
30168
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
|
|
30169
|
+
var external_exports = {};
|
|
30170
|
+
__export(external_exports, {
|
|
30171
|
+
BRAND: () => BRAND,
|
|
30172
|
+
DIRTY: () => DIRTY,
|
|
30173
|
+
EMPTY_PATH: () => EMPTY_PATH,
|
|
30174
|
+
INVALID: () => INVALID,
|
|
30175
|
+
NEVER: () => NEVER,
|
|
30176
|
+
OK: () => OK,
|
|
30177
|
+
ParseStatus: () => ParseStatus,
|
|
30178
|
+
Schema: () => ZodType,
|
|
30179
|
+
ZodAny: () => ZodAny,
|
|
30180
|
+
ZodArray: () => ZodArray,
|
|
30181
|
+
ZodBigInt: () => ZodBigInt,
|
|
30182
|
+
ZodBoolean: () => ZodBoolean,
|
|
30183
|
+
ZodBranded: () => ZodBranded,
|
|
30184
|
+
ZodCatch: () => ZodCatch,
|
|
30185
|
+
ZodDate: () => ZodDate,
|
|
30186
|
+
ZodDefault: () => ZodDefault,
|
|
30187
|
+
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
30188
|
+
ZodEffects: () => ZodEffects,
|
|
30189
|
+
ZodEnum: () => ZodEnum,
|
|
30190
|
+
ZodError: () => ZodError,
|
|
30191
|
+
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
30192
|
+
ZodFunction: () => ZodFunction,
|
|
30193
|
+
ZodIntersection: () => ZodIntersection,
|
|
30194
|
+
ZodIssueCode: () => ZodIssueCode,
|
|
30195
|
+
ZodLazy: () => ZodLazy,
|
|
30196
|
+
ZodLiteral: () => ZodLiteral,
|
|
30197
|
+
ZodMap: () => ZodMap,
|
|
30198
|
+
ZodNaN: () => ZodNaN,
|
|
30199
|
+
ZodNativeEnum: () => ZodNativeEnum,
|
|
30200
|
+
ZodNever: () => ZodNever,
|
|
30201
|
+
ZodNull: () => ZodNull,
|
|
30202
|
+
ZodNullable: () => ZodNullable,
|
|
30203
|
+
ZodNumber: () => ZodNumber,
|
|
30204
|
+
ZodObject: () => ZodObject,
|
|
30205
|
+
ZodOptional: () => ZodOptional,
|
|
30206
|
+
ZodParsedType: () => ZodParsedType,
|
|
30207
|
+
ZodPipeline: () => ZodPipeline,
|
|
30208
|
+
ZodPromise: () => ZodPromise,
|
|
30209
|
+
ZodReadonly: () => ZodReadonly,
|
|
30210
|
+
ZodRecord: () => ZodRecord,
|
|
30211
|
+
ZodSchema: () => ZodType,
|
|
30212
|
+
ZodSet: () => ZodSet,
|
|
30213
|
+
ZodString: () => ZodString,
|
|
30214
|
+
ZodSymbol: () => ZodSymbol,
|
|
30215
|
+
ZodTransformer: () => ZodEffects,
|
|
30216
|
+
ZodTuple: () => ZodTuple,
|
|
30217
|
+
ZodType: () => ZodType,
|
|
30218
|
+
ZodUndefined: () => ZodUndefined,
|
|
30219
|
+
ZodUnion: () => ZodUnion,
|
|
30220
|
+
ZodUnknown: () => ZodUnknown,
|
|
30221
|
+
ZodVoid: () => ZodVoid,
|
|
30222
|
+
addIssueToContext: () => addIssueToContext,
|
|
30223
|
+
any: () => anyType,
|
|
30224
|
+
array: () => arrayType,
|
|
30225
|
+
bigint: () => bigIntType,
|
|
30226
|
+
boolean: () => booleanType,
|
|
30227
|
+
coerce: () => coerce,
|
|
30228
|
+
custom: () => custom,
|
|
30229
|
+
date: () => dateType,
|
|
30230
|
+
datetimeRegex: () => datetimeRegex,
|
|
30231
|
+
defaultErrorMap: () => en_default,
|
|
30232
|
+
discriminatedUnion: () => discriminatedUnionType,
|
|
30233
|
+
effect: () => effectsType,
|
|
30234
|
+
enum: () => enumType,
|
|
30235
|
+
function: () => functionType,
|
|
30236
|
+
getErrorMap: () => getErrorMap,
|
|
30237
|
+
getParsedType: () => getParsedType,
|
|
30238
|
+
instanceof: () => instanceOfType,
|
|
30239
|
+
intersection: () => intersectionType,
|
|
30240
|
+
isAborted: () => isAborted,
|
|
30241
|
+
isAsync: () => isAsync,
|
|
30242
|
+
isDirty: () => isDirty,
|
|
30243
|
+
isValid: () => isValid,
|
|
30244
|
+
late: () => late,
|
|
30245
|
+
lazy: () => lazyType,
|
|
30246
|
+
literal: () => literalType,
|
|
30247
|
+
makeIssue: () => makeIssue,
|
|
30248
|
+
map: () => mapType,
|
|
30249
|
+
nan: () => nanType,
|
|
30250
|
+
nativeEnum: () => nativeEnumType,
|
|
30251
|
+
never: () => neverType,
|
|
30252
|
+
null: () => nullType,
|
|
30253
|
+
nullable: () => nullableType,
|
|
30254
|
+
number: () => numberType,
|
|
30255
|
+
object: () => objectType,
|
|
30256
|
+
objectUtil: () => objectUtil,
|
|
30257
|
+
oboolean: () => oboolean,
|
|
30258
|
+
onumber: () => onumber,
|
|
30259
|
+
optional: () => optionalType,
|
|
30260
|
+
ostring: () => ostring,
|
|
30261
|
+
pipeline: () => pipelineType,
|
|
30262
|
+
preprocess: () => preprocessType,
|
|
30263
|
+
promise: () => promiseType,
|
|
30264
|
+
quotelessJson: () => quotelessJson,
|
|
30265
|
+
record: () => recordType,
|
|
30266
|
+
set: () => setType,
|
|
30267
|
+
setErrorMap: () => setErrorMap,
|
|
30268
|
+
strictObject: () => strictObjectType,
|
|
30269
|
+
string: () => stringType,
|
|
30270
|
+
symbol: () => symbolType,
|
|
30271
|
+
transformer: () => effectsType,
|
|
30272
|
+
tuple: () => tupleType,
|
|
30273
|
+
undefined: () => undefinedType,
|
|
30274
|
+
union: () => unionType,
|
|
30275
|
+
unknown: () => unknownType,
|
|
30276
|
+
util: () => util,
|
|
30277
|
+
void: () => voidType
|
|
30278
|
+
});
|
|
30279
|
+
|
|
30280
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js
|
|
30281
|
+
var util;
|
|
30282
|
+
(function(util2) {
|
|
30283
|
+
util2.assertEqual = (_) => {
|
|
30284
|
+
};
|
|
30285
|
+
function assertIs2(_arg) {
|
|
30286
|
+
}
|
|
30287
|
+
util2.assertIs = assertIs2;
|
|
30288
|
+
function assertNever2(_x) {
|
|
30289
|
+
throw new Error();
|
|
30290
|
+
}
|
|
30291
|
+
util2.assertNever = assertNever2;
|
|
30292
|
+
util2.arrayToEnum = (items) => {
|
|
30293
|
+
const obj = {};
|
|
30294
|
+
for (const item of items) {
|
|
30295
|
+
obj[item] = item;
|
|
30167
30296
|
}
|
|
30297
|
+
return obj;
|
|
30168
30298
|
};
|
|
30169
|
-
|
|
30170
|
-
|
|
30171
|
-
|
|
30172
|
-
|
|
30173
|
-
|
|
30174
|
-
required: ["columns", "rows"],
|
|
30175
|
-
additionalProperties: false,
|
|
30176
|
-
properties: {
|
|
30177
|
-
rowHeader: { type: "string", maxLength: L.label },
|
|
30178
|
-
columns: { type: "array", minItems: 1, maxItems: L.columns, items: { type: "string", maxLength: L.label } },
|
|
30179
|
-
rows: {
|
|
30180
|
-
type: "array",
|
|
30181
|
-
maxItems: L.rows,
|
|
30182
|
-
items: {
|
|
30183
|
-
type: "object",
|
|
30184
|
-
required: ["label", "cells"],
|
|
30185
|
-
additionalProperties: false,
|
|
30186
|
-
properties: {
|
|
30187
|
-
label: { type: "string", maxLength: L.label },
|
|
30188
|
-
sub: { type: "string", maxLength: L.label },
|
|
30189
|
-
cells: {
|
|
30190
|
-
type: "array",
|
|
30191
|
-
maxItems: L.columns,
|
|
30192
|
-
items: {
|
|
30193
|
-
type: "object",
|
|
30194
|
-
additionalProperties: false,
|
|
30195
|
-
properties: {
|
|
30196
|
-
value: { type: ["string", "number"], maxLength: L.cellText },
|
|
30197
|
-
sub: { type: "string", maxLength: L.cellText },
|
|
30198
|
-
state: { enum: [...TABLE_CELL_STATES] }
|
|
30199
|
-
}
|
|
30200
|
-
}
|
|
30201
|
-
}
|
|
30202
|
-
}
|
|
30203
|
-
}
|
|
30204
|
-
},
|
|
30205
|
-
legend: {
|
|
30206
|
-
type: "array",
|
|
30207
|
-
maxItems: TABLE_CELL_STATES.length,
|
|
30208
|
-
items: {
|
|
30209
|
-
type: "object",
|
|
30210
|
-
required: ["state", "label"],
|
|
30211
|
-
additionalProperties: false,
|
|
30212
|
-
properties: {
|
|
30213
|
-
state: { enum: [...TABLE_CELL_STATES] },
|
|
30214
|
-
label: { type: "string", maxLength: L.label }
|
|
30215
|
-
}
|
|
30216
|
-
}
|
|
30217
|
-
}
|
|
30299
|
+
util2.getValidEnumValues = (obj) => {
|
|
30300
|
+
const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
|
|
30301
|
+
const filtered = {};
|
|
30302
|
+
for (const k of validKeys) {
|
|
30303
|
+
filtered[k] = obj[k];
|
|
30218
30304
|
}
|
|
30305
|
+
return util2.objectValues(filtered);
|
|
30219
30306
|
};
|
|
30220
|
-
|
|
30221
|
-
|
|
30222
|
-
|
|
30223
|
-
|
|
30224
|
-
|
|
30225
|
-
|
|
30226
|
-
|
|
30227
|
-
|
|
30228
|
-
|
|
30229
|
-
|
|
30230
|
-
|
|
30231
|
-
values: { type: "array", items: { type: "number" } },
|
|
30232
|
-
color: { type: "string", pattern: "^#[0-9a-fA-F]{6}$" }
|
|
30307
|
+
util2.objectValues = (obj) => {
|
|
30308
|
+
return util2.objectKeys(obj).map(function(e) {
|
|
30309
|
+
return obj[e];
|
|
30310
|
+
});
|
|
30311
|
+
};
|
|
30312
|
+
util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object3) => {
|
|
30313
|
+
const keys = [];
|
|
30314
|
+
for (const key in object3) {
|
|
30315
|
+
if (Object.prototype.hasOwnProperty.call(object3, key)) {
|
|
30316
|
+
keys.push(key);
|
|
30317
|
+
}
|
|
30233
30318
|
}
|
|
30234
|
-
|
|
30235
|
-
|
|
30236
|
-
|
|
30237
|
-
|
|
30238
|
-
|
|
30239
|
-
|
|
30240
|
-
required: ["labels", "series"],
|
|
30241
|
-
additionalProperties: false,
|
|
30242
|
-
properties: {
|
|
30243
|
-
labels: { type: "array", items: { type: "string" } },
|
|
30244
|
-
series: { type: "array", items: { type: "number" } }
|
|
30319
|
+
return keys;
|
|
30320
|
+
};
|
|
30321
|
+
util2.find = (arr, checker) => {
|
|
30322
|
+
for (const item of arr) {
|
|
30323
|
+
if (checker(item))
|
|
30324
|
+
return item;
|
|
30245
30325
|
}
|
|
30246
|
-
|
|
30247
|
-
|
|
30248
|
-
|
|
30249
|
-
|
|
30250
|
-
|
|
30251
|
-
function kanbanGetErrorMessage(status, id, fallbackMessage) {
|
|
30252
|
-
if (status === 400) return "A card id is required.";
|
|
30253
|
-
if (status === 404) return `No card with id "${id}" on your board.`;
|
|
30254
|
-
return `Could not read the card: ${fallbackMessage}`;
|
|
30255
|
-
}
|
|
30256
|
-
|
|
30257
|
-
// src/knowledge-body-render.ts
|
|
30258
|
-
function renderKnowledgeBody(content) {
|
|
30259
|
-
if (content === void 0 || content === null) {
|
|
30260
|
-
return "(!) CONTRACT FAILURE: the API returned no `content` field for this entry. This is NOT an empty entry \u2014 the body was not delivered. Do not treat this as the entry text, and do not knowledge_update from it: an update replaces the whole body and would erase the real one. Report this as a bug.";
|
|
30261
|
-
}
|
|
30262
|
-
if (content.length === 0) {
|
|
30263
|
-
return "(empty \u2014 this entry genuinely has no body text)";
|
|
30326
|
+
return void 0;
|
|
30327
|
+
};
|
|
30328
|
+
util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
|
|
30329
|
+
function joinValues2(array2, separator = " | ") {
|
|
30330
|
+
return array2.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
|
|
30264
30331
|
}
|
|
30265
|
-
|
|
30266
|
-
|
|
30267
|
-
|
|
30268
|
-
|
|
30269
|
-
import { homedir as homedir3 } from "os";
|
|
30270
|
-
import { basename, isAbsolute as isAbsolute2, join as join6, resolve as pathResolve, sep as sep2 } from "path";
|
|
30271
|
-
|
|
30272
|
-
// src/host-file-path.ts
|
|
30273
|
-
var SKILL_BODY_PATH_MAX_BYTES = 512 * 1024;
|
|
30274
|
-
var AGT_LIVE_CONTENT_PATH_MAX_BYTES = 2 * 1024 * 1024;
|
|
30275
|
-
var HOST_FILE_PATH_TOOLS = /* @__PURE__ */ new Map([
|
|
30276
|
-
[
|
|
30277
|
-
"skill_create",
|
|
30278
|
-
{ pathArg: "body_path", targetArg: "body", maxBytes: SKILL_BODY_PATH_MAX_BYTES, label: "a skill body" }
|
|
30279
|
-
],
|
|
30280
|
-
[
|
|
30281
|
-
"skill_update",
|
|
30282
|
-
{ pathArg: "body_path", targetArg: "body", maxBytes: SKILL_BODY_PATH_MAX_BYTES, label: "a skill body" }
|
|
30283
|
-
],
|
|
30284
|
-
[
|
|
30285
|
-
"agt_live_publish",
|
|
30286
|
-
{
|
|
30287
|
-
pathArg: "content_path",
|
|
30288
|
-
targetArg: "content",
|
|
30289
|
-
maxBytes: AGT_LIVE_CONTENT_PATH_MAX_BYTES,
|
|
30290
|
-
label: "a published page"
|
|
30332
|
+
util2.joinValues = joinValues2;
|
|
30333
|
+
util2.jsonStringifyReplacer = (_, value) => {
|
|
30334
|
+
if (typeof value === "bigint") {
|
|
30335
|
+
return value.toString();
|
|
30291
30336
|
}
|
|
30292
|
-
|
|
30293
|
-
|
|
30294
|
-
|
|
30295
|
-
|
|
30296
|
-
|
|
30297
|
-
|
|
30298
|
-
return [path.join(agentDir, "project"), path.join(agentDir, "scratch")];
|
|
30299
|
-
}
|
|
30300
|
-
function openContained(target, roots, opts) {
|
|
30301
|
-
const { path, fs, procFdBase } = opts;
|
|
30302
|
-
if (!procFdBase) {
|
|
30337
|
+
return value;
|
|
30338
|
+
};
|
|
30339
|
+
})(util || (util = {}));
|
|
30340
|
+
var objectUtil;
|
|
30341
|
+
(function(objectUtil2) {
|
|
30342
|
+
objectUtil2.mergeShapes = (first, second) => {
|
|
30303
30343
|
return {
|
|
30304
|
-
|
|
30305
|
-
|
|
30344
|
+
...first,
|
|
30345
|
+
...second
|
|
30346
|
+
// second overwrites first
|
|
30306
30347
|
};
|
|
30307
|
-
}
|
|
30308
|
-
|
|
30309
|
-
|
|
30310
|
-
|
|
30311
|
-
|
|
30312
|
-
|
|
30313
|
-
|
|
30314
|
-
|
|
30315
|
-
|
|
30316
|
-
|
|
30317
|
-
|
|
30318
|
-
|
|
30319
|
-
|
|
30320
|
-
|
|
30321
|
-
|
|
30322
|
-
|
|
30323
|
-
|
|
30324
|
-
|
|
30325
|
-
|
|
30326
|
-
|
|
30327
|
-
|
|
30328
|
-
|
|
30329
|
-
|
|
30330
|
-
|
|
30331
|
-
|
|
30332
|
-
|
|
30333
|
-
|
|
30334
|
-
|
|
30335
|
-
|
|
30336
|
-
|
|
30348
|
+
};
|
|
30349
|
+
})(objectUtil || (objectUtil = {}));
|
|
30350
|
+
var ZodParsedType = util.arrayToEnum([
|
|
30351
|
+
"string",
|
|
30352
|
+
"nan",
|
|
30353
|
+
"number",
|
|
30354
|
+
"integer",
|
|
30355
|
+
"float",
|
|
30356
|
+
"boolean",
|
|
30357
|
+
"date",
|
|
30358
|
+
"bigint",
|
|
30359
|
+
"symbol",
|
|
30360
|
+
"function",
|
|
30361
|
+
"undefined",
|
|
30362
|
+
"null",
|
|
30363
|
+
"array",
|
|
30364
|
+
"object",
|
|
30365
|
+
"unknown",
|
|
30366
|
+
"promise",
|
|
30367
|
+
"void",
|
|
30368
|
+
"never",
|
|
30369
|
+
"map",
|
|
30370
|
+
"set"
|
|
30371
|
+
]);
|
|
30372
|
+
var getParsedType = (data) => {
|
|
30373
|
+
const t = typeof data;
|
|
30374
|
+
switch (t) {
|
|
30375
|
+
case "undefined":
|
|
30376
|
+
return ZodParsedType.undefined;
|
|
30377
|
+
case "string":
|
|
30378
|
+
return ZodParsedType.string;
|
|
30379
|
+
case "number":
|
|
30380
|
+
return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
|
30381
|
+
case "boolean":
|
|
30382
|
+
return ZodParsedType.boolean;
|
|
30383
|
+
case "function":
|
|
30384
|
+
return ZodParsedType.function;
|
|
30385
|
+
case "bigint":
|
|
30386
|
+
return ZodParsedType.bigint;
|
|
30387
|
+
case "symbol":
|
|
30388
|
+
return ZodParsedType.symbol;
|
|
30389
|
+
case "object":
|
|
30390
|
+
if (Array.isArray(data)) {
|
|
30391
|
+
return ZodParsedType.array;
|
|
30337
30392
|
}
|
|
30338
|
-
|
|
30339
|
-
|
|
30340
|
-
} catch {
|
|
30393
|
+
if (data === null) {
|
|
30394
|
+
return ZodParsedType.null;
|
|
30341
30395
|
}
|
|
30342
|
-
|
|
30343
|
-
|
|
30344
|
-
|
|
30345
|
-
|
|
30346
|
-
|
|
30347
|
-
|
|
30348
|
-
|
|
30349
|
-
|
|
30350
|
-
|
|
30351
|
-
|
|
30352
|
-
|
|
30353
|
-
|
|
30354
|
-
|
|
30355
|
-
|
|
30356
|
-
|
|
30357
|
-
} catch {
|
|
30358
|
-
}
|
|
30396
|
+
if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
|
|
30397
|
+
return ZodParsedType.promise;
|
|
30398
|
+
}
|
|
30399
|
+
if (typeof Map !== "undefined" && data instanceof Map) {
|
|
30400
|
+
return ZodParsedType.map;
|
|
30401
|
+
}
|
|
30402
|
+
if (typeof Set !== "undefined" && data instanceof Set) {
|
|
30403
|
+
return ZodParsedType.set;
|
|
30404
|
+
}
|
|
30405
|
+
if (typeof Date !== "undefined" && data instanceof Date) {
|
|
30406
|
+
return ZodParsedType.date;
|
|
30407
|
+
}
|
|
30408
|
+
return ZodParsedType.object;
|
|
30409
|
+
default:
|
|
30410
|
+
return ZodParsedType.unknown;
|
|
30359
30411
|
}
|
|
30360
|
-
}
|
|
30361
|
-
|
|
30362
|
-
|
|
30363
|
-
|
|
30364
|
-
|
|
30365
|
-
|
|
30366
|
-
|
|
30367
|
-
|
|
30368
|
-
|
|
30369
|
-
|
|
30370
|
-
|
|
30371
|
-
|
|
30372
|
-
|
|
30412
|
+
};
|
|
30413
|
+
|
|
30414
|
+
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js
|
|
30415
|
+
var ZodIssueCode = util.arrayToEnum([
|
|
30416
|
+
"invalid_type",
|
|
30417
|
+
"invalid_literal",
|
|
30418
|
+
"custom",
|
|
30419
|
+
"invalid_union",
|
|
30420
|
+
"invalid_union_discriminator",
|
|
30421
|
+
"invalid_enum_value",
|
|
30422
|
+
"unrecognized_keys",
|
|
30423
|
+
"invalid_arguments",
|
|
30424
|
+
"invalid_return_type",
|
|
30425
|
+
"invalid_date",
|
|
30426
|
+
"invalid_string",
|
|
30427
|
+
"too_small",
|
|
30428
|
+
"too_big",
|
|
30429
|
+
"invalid_intersection_types",
|
|
30430
|
+
"not_multiple_of",
|
|
30431
|
+
"not_finite"
|
|
30432
|
+
]);
|
|
30433
|
+
var quotelessJson = (obj) => {
|
|
30434
|
+
const json = JSON.stringify(obj, null, 2);
|
|
30435
|
+
return json.replace(/"([^"]+)":/g, "$1:");
|
|
30436
|
+
};
|
|
30437
|
+
var ZodError = class _ZodError extends Error {
|
|
30438
|
+
get errors() {
|
|
30439
|
+
return this.issues;
|
|
30373
30440
|
}
|
|
30374
|
-
|
|
30375
|
-
|
|
30376
|
-
|
|
30377
|
-
|
|
30441
|
+
constructor(issues) {
|
|
30442
|
+
super();
|
|
30443
|
+
this.issues = [];
|
|
30444
|
+
this.addIssue = (sub) => {
|
|
30445
|
+
this.issues = [...this.issues, sub];
|
|
30378
30446
|
};
|
|
30379
|
-
|
|
30380
|
-
|
|
30381
|
-
const maxBytes = opts.maxBytes ?? spec.maxBytes;
|
|
30382
|
-
const roots = allowedHostFileRoots(agentDir, path);
|
|
30383
|
-
const absolute = path.isAbsolute(raw) ? path.resolve(raw) : path.resolve(path.join(agentDir, "project"), raw);
|
|
30384
|
-
if (!roots.some((r) => isContained(absolute, r, path.sep))) {
|
|
30385
|
-
return {
|
|
30386
|
-
ok: false,
|
|
30387
|
-
error: `${spec.pathArg} must be inside your own project or scratch directory. Got '${raw}'. Allowed: ${roots.join(", ")}`
|
|
30447
|
+
this.addIssues = (subs = []) => {
|
|
30448
|
+
this.issues = [...this.issues, ...subs];
|
|
30388
30449
|
};
|
|
30389
|
-
|
|
30390
|
-
|
|
30391
|
-
|
|
30392
|
-
|
|
30393
|
-
|
|
30394
|
-
|
|
30395
|
-
|
|
30396
|
-
|
|
30397
|
-
return {
|
|
30398
|
-
ok: false,
|
|
30399
|
-
error: `${spec.pathArg} resolves outside your own directories (symlink?). '${raw}' \u2192 '${real}'. Allowed: ${roots.join(", ")}`
|
|
30400
|
-
};
|
|
30401
|
-
}
|
|
30402
|
-
const opened = openContained(real, roots, opts);
|
|
30403
|
-
if (!opened.ok) return { ok: false, error: `${spec.pathArg}: ${opened.error} ('${raw}')` };
|
|
30404
|
-
const fd = opened.fd;
|
|
30405
|
-
try {
|
|
30406
|
-
let stat;
|
|
30407
|
-
try {
|
|
30408
|
-
stat = fs.fstatSync(fd);
|
|
30409
|
-
} catch {
|
|
30410
|
-
return { ok: false, error: `${spec.pathArg} could not be inspected: '${raw}'` };
|
|
30411
|
-
}
|
|
30412
|
-
if (!stat.isFile()) {
|
|
30413
|
-
return { ok: false, error: `${spec.pathArg} is not a regular file: '${raw}'` };
|
|
30414
|
-
}
|
|
30415
|
-
if (stat.size > maxBytes) {
|
|
30416
|
-
return {
|
|
30417
|
-
ok: false,
|
|
30418
|
-
error: `${spec.pathArg} is ${stat.size} bytes, over the ${maxBytes}-byte limit for ${spec.label}.`
|
|
30419
|
-
};
|
|
30420
|
-
}
|
|
30421
|
-
let bytes;
|
|
30422
|
-
try {
|
|
30423
|
-
bytes = fs.readFdSync(fd, maxBytes);
|
|
30424
|
-
} catch (err) {
|
|
30425
|
-
return { ok: false, error: `${spec.pathArg} could not be read: ${err.message}` };
|
|
30426
|
-
}
|
|
30427
|
-
if (bytes.byteLength > maxBytes) {
|
|
30428
|
-
return { ok: false, error: `${spec.pathArg} grew past the ${maxBytes}-byte limit while being read.` };
|
|
30429
|
-
}
|
|
30430
|
-
const value = fs.decodeUtf8(bytes);
|
|
30431
|
-
const next = { ...args, [spec.targetArg]: value };
|
|
30432
|
-
delete next[spec.pathArg];
|
|
30433
|
-
return { ok: true, args: next };
|
|
30434
|
-
} finally {
|
|
30435
|
-
try {
|
|
30436
|
-
fs.closeSync(fd);
|
|
30437
|
-
} catch {
|
|
30438
|
-
}
|
|
30439
|
-
}
|
|
30440
|
-
}
|
|
30441
|
-
|
|
30442
|
-
// src/artefact-work-dir.ts
|
|
30443
|
-
import { mkdir, mkdtemp } from "fs/promises";
|
|
30444
|
-
import { existsSync } from "fs";
|
|
30445
|
-
import { dirname, join as join2 } from "path";
|
|
30446
|
-
|
|
30447
|
-
// ../core/dist/provisioning/frameworks/claudecode/agent-dir-alias.js
|
|
30448
|
-
import { isAbsolute, join, relative, sep } from "path";
|
|
30449
|
-
var VALID_CODE_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
30450
|
-
var VALID_AGENT_ID = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
30451
|
-
var INITIATOR_BASENAME = ".current-turn-initiator.json";
|
|
30452
|
-
function isSafeAgentSegment(segment) {
|
|
30453
|
-
return VALID_CODE_NAME.test(segment) || VALID_AGENT_ID.test(segment);
|
|
30454
|
-
}
|
|
30455
|
-
function initiatorDirSegment(initiatorFile, homeDir) {
|
|
30456
|
-
const rel = relative(join(homeDir, ".augmented"), initiatorFile);
|
|
30457
|
-
if (!rel || isAbsolute(rel))
|
|
30458
|
-
return null;
|
|
30459
|
-
const parts = rel.split(sep);
|
|
30460
|
-
if (parts.length !== 2 || parts[1] !== INITIATOR_BASENAME)
|
|
30461
|
-
return null;
|
|
30462
|
-
const segment = parts[0];
|
|
30463
|
-
if (segment === void 0)
|
|
30464
|
-
return null;
|
|
30465
|
-
return isSafeAgentSegment(segment) ? segment : null;
|
|
30466
|
-
}
|
|
30467
|
-
function resolveAgentDirAlias(input) {
|
|
30468
|
-
const { codeName, turnInitiatorFile, agentId, homeDir } = input;
|
|
30469
|
-
const codeNameTrimmed = typeof codeName === "string" ? codeName.trim() : "";
|
|
30470
|
-
if (codeNameTrimmed && VALID_CODE_NAME.test(codeNameTrimmed)) {
|
|
30471
|
-
return join(homeDir, ".augmented", codeNameTrimmed);
|
|
30472
|
-
}
|
|
30473
|
-
const initiator = typeof turnInitiatorFile === "string" ? turnInitiatorFile.trim() : "";
|
|
30474
|
-
if (initiator) {
|
|
30475
|
-
const segment = initiatorDirSegment(initiator, homeDir);
|
|
30476
|
-
if (segment)
|
|
30477
|
-
return join(homeDir, ".augmented", segment);
|
|
30478
|
-
}
|
|
30479
|
-
const agentIdTrimmed = typeof agentId === "string" ? agentId.trim() : "";
|
|
30480
|
-
if (agentIdTrimmed && VALID_AGENT_ID.test(agentIdTrimmed)) {
|
|
30481
|
-
return join(homeDir, ".augmented", agentIdTrimmed);
|
|
30482
|
-
}
|
|
30483
|
-
return null;
|
|
30484
|
-
}
|
|
30485
|
-
function resolveAgentScratchDir(input) {
|
|
30486
|
-
const alias = resolveAgentDirAlias(input);
|
|
30487
|
-
return alias === null ? null : join(alias, "scratch");
|
|
30488
|
-
}
|
|
30489
|
-
|
|
30490
|
-
// src/artefact-work-dir.ts
|
|
30491
|
-
async function makeArtefactWorkDir(prefix, env2) {
|
|
30492
|
-
const scratch = resolveAgentScratchDir(env2);
|
|
30493
|
-
if (scratch === null) {
|
|
30494
|
-
throw new Error(
|
|
30495
|
-
"Cannot save the artefact: none of AGT_AGENT_CODE_NAME, AGT_TURN_INITIATOR_FILE or AGT_AGENT_ID is set, so this server cannot tell which agent directory the file belongs in."
|
|
30496
|
-
);
|
|
30497
|
-
}
|
|
30498
|
-
const agentDir = dirname(scratch);
|
|
30499
|
-
if (!existsSync(agentDir)) {
|
|
30500
|
-
throw new Error(
|
|
30501
|
-
`Cannot save the artefact: the agent directory ${agentDir} does not exist on this host.`
|
|
30502
|
-
);
|
|
30503
|
-
}
|
|
30504
|
-
await mkdir(scratch, { recursive: true });
|
|
30505
|
-
return mkdtemp(join2(scratch, prefix));
|
|
30506
|
-
}
|
|
30507
|
-
|
|
30508
|
-
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
|
|
30509
|
-
var external_exports = {};
|
|
30510
|
-
__export(external_exports, {
|
|
30511
|
-
BRAND: () => BRAND,
|
|
30512
|
-
DIRTY: () => DIRTY,
|
|
30513
|
-
EMPTY_PATH: () => EMPTY_PATH,
|
|
30514
|
-
INVALID: () => INVALID,
|
|
30515
|
-
NEVER: () => NEVER,
|
|
30516
|
-
OK: () => OK,
|
|
30517
|
-
ParseStatus: () => ParseStatus,
|
|
30518
|
-
Schema: () => ZodType,
|
|
30519
|
-
ZodAny: () => ZodAny,
|
|
30520
|
-
ZodArray: () => ZodArray,
|
|
30521
|
-
ZodBigInt: () => ZodBigInt,
|
|
30522
|
-
ZodBoolean: () => ZodBoolean,
|
|
30523
|
-
ZodBranded: () => ZodBranded,
|
|
30524
|
-
ZodCatch: () => ZodCatch,
|
|
30525
|
-
ZodDate: () => ZodDate,
|
|
30526
|
-
ZodDefault: () => ZodDefault,
|
|
30527
|
-
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
30528
|
-
ZodEffects: () => ZodEffects,
|
|
30529
|
-
ZodEnum: () => ZodEnum,
|
|
30530
|
-
ZodError: () => ZodError,
|
|
30531
|
-
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
30532
|
-
ZodFunction: () => ZodFunction,
|
|
30533
|
-
ZodIntersection: () => ZodIntersection,
|
|
30534
|
-
ZodIssueCode: () => ZodIssueCode,
|
|
30535
|
-
ZodLazy: () => ZodLazy,
|
|
30536
|
-
ZodLiteral: () => ZodLiteral,
|
|
30537
|
-
ZodMap: () => ZodMap,
|
|
30538
|
-
ZodNaN: () => ZodNaN,
|
|
30539
|
-
ZodNativeEnum: () => ZodNativeEnum,
|
|
30540
|
-
ZodNever: () => ZodNever,
|
|
30541
|
-
ZodNull: () => ZodNull,
|
|
30542
|
-
ZodNullable: () => ZodNullable,
|
|
30543
|
-
ZodNumber: () => ZodNumber,
|
|
30544
|
-
ZodObject: () => ZodObject,
|
|
30545
|
-
ZodOptional: () => ZodOptional,
|
|
30546
|
-
ZodParsedType: () => ZodParsedType,
|
|
30547
|
-
ZodPipeline: () => ZodPipeline,
|
|
30548
|
-
ZodPromise: () => ZodPromise,
|
|
30549
|
-
ZodReadonly: () => ZodReadonly,
|
|
30550
|
-
ZodRecord: () => ZodRecord,
|
|
30551
|
-
ZodSchema: () => ZodType,
|
|
30552
|
-
ZodSet: () => ZodSet,
|
|
30553
|
-
ZodString: () => ZodString,
|
|
30554
|
-
ZodSymbol: () => ZodSymbol,
|
|
30555
|
-
ZodTransformer: () => ZodEffects,
|
|
30556
|
-
ZodTuple: () => ZodTuple,
|
|
30557
|
-
ZodType: () => ZodType,
|
|
30558
|
-
ZodUndefined: () => ZodUndefined,
|
|
30559
|
-
ZodUnion: () => ZodUnion,
|
|
30560
|
-
ZodUnknown: () => ZodUnknown,
|
|
30561
|
-
ZodVoid: () => ZodVoid,
|
|
30562
|
-
addIssueToContext: () => addIssueToContext,
|
|
30563
|
-
any: () => anyType,
|
|
30564
|
-
array: () => arrayType,
|
|
30565
|
-
bigint: () => bigIntType,
|
|
30566
|
-
boolean: () => booleanType,
|
|
30567
|
-
coerce: () => coerce,
|
|
30568
|
-
custom: () => custom,
|
|
30569
|
-
date: () => dateType,
|
|
30570
|
-
datetimeRegex: () => datetimeRegex,
|
|
30571
|
-
defaultErrorMap: () => en_default,
|
|
30572
|
-
discriminatedUnion: () => discriminatedUnionType,
|
|
30573
|
-
effect: () => effectsType,
|
|
30574
|
-
enum: () => enumType,
|
|
30575
|
-
function: () => functionType,
|
|
30576
|
-
getErrorMap: () => getErrorMap,
|
|
30577
|
-
getParsedType: () => getParsedType,
|
|
30578
|
-
instanceof: () => instanceOfType,
|
|
30579
|
-
intersection: () => intersectionType,
|
|
30580
|
-
isAborted: () => isAborted,
|
|
30581
|
-
isAsync: () => isAsync,
|
|
30582
|
-
isDirty: () => isDirty,
|
|
30583
|
-
isValid: () => isValid,
|
|
30584
|
-
late: () => late,
|
|
30585
|
-
lazy: () => lazyType,
|
|
30586
|
-
literal: () => literalType,
|
|
30587
|
-
makeIssue: () => makeIssue,
|
|
30588
|
-
map: () => mapType,
|
|
30589
|
-
nan: () => nanType,
|
|
30590
|
-
nativeEnum: () => nativeEnumType,
|
|
30591
|
-
never: () => neverType,
|
|
30592
|
-
null: () => nullType,
|
|
30593
|
-
nullable: () => nullableType,
|
|
30594
|
-
number: () => numberType,
|
|
30595
|
-
object: () => objectType,
|
|
30596
|
-
objectUtil: () => objectUtil,
|
|
30597
|
-
oboolean: () => oboolean,
|
|
30598
|
-
onumber: () => onumber,
|
|
30599
|
-
optional: () => optionalType,
|
|
30600
|
-
ostring: () => ostring,
|
|
30601
|
-
pipeline: () => pipelineType,
|
|
30602
|
-
preprocess: () => preprocessType,
|
|
30603
|
-
promise: () => promiseType,
|
|
30604
|
-
quotelessJson: () => quotelessJson,
|
|
30605
|
-
record: () => recordType,
|
|
30606
|
-
set: () => setType,
|
|
30607
|
-
setErrorMap: () => setErrorMap,
|
|
30608
|
-
strictObject: () => strictObjectType,
|
|
30609
|
-
string: () => stringType,
|
|
30610
|
-
symbol: () => symbolType,
|
|
30611
|
-
transformer: () => effectsType,
|
|
30612
|
-
tuple: () => tupleType,
|
|
30613
|
-
undefined: () => undefinedType,
|
|
30614
|
-
union: () => unionType,
|
|
30615
|
-
unknown: () => unknownType,
|
|
30616
|
-
util: () => util,
|
|
30617
|
-
void: () => voidType
|
|
30618
|
-
});
|
|
30619
|
-
|
|
30620
|
-
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js
|
|
30621
|
-
var util;
|
|
30622
|
-
(function(util2) {
|
|
30623
|
-
util2.assertEqual = (_) => {
|
|
30624
|
-
};
|
|
30625
|
-
function assertIs2(_arg) {
|
|
30626
|
-
}
|
|
30627
|
-
util2.assertIs = assertIs2;
|
|
30628
|
-
function assertNever2(_x) {
|
|
30629
|
-
throw new Error();
|
|
30630
|
-
}
|
|
30631
|
-
util2.assertNever = assertNever2;
|
|
30632
|
-
util2.arrayToEnum = (items) => {
|
|
30633
|
-
const obj = {};
|
|
30634
|
-
for (const item of items) {
|
|
30635
|
-
obj[item] = item;
|
|
30636
|
-
}
|
|
30637
|
-
return obj;
|
|
30638
|
-
};
|
|
30639
|
-
util2.getValidEnumValues = (obj) => {
|
|
30640
|
-
const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
|
|
30641
|
-
const filtered = {};
|
|
30642
|
-
for (const k of validKeys) {
|
|
30643
|
-
filtered[k] = obj[k];
|
|
30644
|
-
}
|
|
30645
|
-
return util2.objectValues(filtered);
|
|
30646
|
-
};
|
|
30647
|
-
util2.objectValues = (obj) => {
|
|
30648
|
-
return util2.objectKeys(obj).map(function(e) {
|
|
30649
|
-
return obj[e];
|
|
30650
|
-
});
|
|
30651
|
-
};
|
|
30652
|
-
util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object3) => {
|
|
30653
|
-
const keys = [];
|
|
30654
|
-
for (const key in object3) {
|
|
30655
|
-
if (Object.prototype.hasOwnProperty.call(object3, key)) {
|
|
30656
|
-
keys.push(key);
|
|
30657
|
-
}
|
|
30658
|
-
}
|
|
30659
|
-
return keys;
|
|
30660
|
-
};
|
|
30661
|
-
util2.find = (arr, checker) => {
|
|
30662
|
-
for (const item of arr) {
|
|
30663
|
-
if (checker(item))
|
|
30664
|
-
return item;
|
|
30665
|
-
}
|
|
30666
|
-
return void 0;
|
|
30667
|
-
};
|
|
30668
|
-
util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
|
|
30669
|
-
function joinValues2(array2, separator = " | ") {
|
|
30670
|
-
return array2.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
|
|
30671
|
-
}
|
|
30672
|
-
util2.joinValues = joinValues2;
|
|
30673
|
-
util2.jsonStringifyReplacer = (_, value) => {
|
|
30674
|
-
if (typeof value === "bigint") {
|
|
30675
|
-
return value.toString();
|
|
30676
|
-
}
|
|
30677
|
-
return value;
|
|
30678
|
-
};
|
|
30679
|
-
})(util || (util = {}));
|
|
30680
|
-
var objectUtil;
|
|
30681
|
-
(function(objectUtil2) {
|
|
30682
|
-
objectUtil2.mergeShapes = (first, second) => {
|
|
30683
|
-
return {
|
|
30684
|
-
...first,
|
|
30685
|
-
...second
|
|
30686
|
-
// second overwrites first
|
|
30687
|
-
};
|
|
30688
|
-
};
|
|
30689
|
-
})(objectUtil || (objectUtil = {}));
|
|
30690
|
-
var ZodParsedType = util.arrayToEnum([
|
|
30691
|
-
"string",
|
|
30692
|
-
"nan",
|
|
30693
|
-
"number",
|
|
30694
|
-
"integer",
|
|
30695
|
-
"float",
|
|
30696
|
-
"boolean",
|
|
30697
|
-
"date",
|
|
30698
|
-
"bigint",
|
|
30699
|
-
"symbol",
|
|
30700
|
-
"function",
|
|
30701
|
-
"undefined",
|
|
30702
|
-
"null",
|
|
30703
|
-
"array",
|
|
30704
|
-
"object",
|
|
30705
|
-
"unknown",
|
|
30706
|
-
"promise",
|
|
30707
|
-
"void",
|
|
30708
|
-
"never",
|
|
30709
|
-
"map",
|
|
30710
|
-
"set"
|
|
30711
|
-
]);
|
|
30712
|
-
var getParsedType = (data) => {
|
|
30713
|
-
const t = typeof data;
|
|
30714
|
-
switch (t) {
|
|
30715
|
-
case "undefined":
|
|
30716
|
-
return ZodParsedType.undefined;
|
|
30717
|
-
case "string":
|
|
30718
|
-
return ZodParsedType.string;
|
|
30719
|
-
case "number":
|
|
30720
|
-
return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
|
30721
|
-
case "boolean":
|
|
30722
|
-
return ZodParsedType.boolean;
|
|
30723
|
-
case "function":
|
|
30724
|
-
return ZodParsedType.function;
|
|
30725
|
-
case "bigint":
|
|
30726
|
-
return ZodParsedType.bigint;
|
|
30727
|
-
case "symbol":
|
|
30728
|
-
return ZodParsedType.symbol;
|
|
30729
|
-
case "object":
|
|
30730
|
-
if (Array.isArray(data)) {
|
|
30731
|
-
return ZodParsedType.array;
|
|
30732
|
-
}
|
|
30733
|
-
if (data === null) {
|
|
30734
|
-
return ZodParsedType.null;
|
|
30735
|
-
}
|
|
30736
|
-
if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
|
|
30737
|
-
return ZodParsedType.promise;
|
|
30738
|
-
}
|
|
30739
|
-
if (typeof Map !== "undefined" && data instanceof Map) {
|
|
30740
|
-
return ZodParsedType.map;
|
|
30741
|
-
}
|
|
30742
|
-
if (typeof Set !== "undefined" && data instanceof Set) {
|
|
30743
|
-
return ZodParsedType.set;
|
|
30744
|
-
}
|
|
30745
|
-
if (typeof Date !== "undefined" && data instanceof Date) {
|
|
30746
|
-
return ZodParsedType.date;
|
|
30747
|
-
}
|
|
30748
|
-
return ZodParsedType.object;
|
|
30749
|
-
default:
|
|
30750
|
-
return ZodParsedType.unknown;
|
|
30751
|
-
}
|
|
30752
|
-
};
|
|
30753
|
-
|
|
30754
|
-
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js
|
|
30755
|
-
var ZodIssueCode = util.arrayToEnum([
|
|
30756
|
-
"invalid_type",
|
|
30757
|
-
"invalid_literal",
|
|
30758
|
-
"custom",
|
|
30759
|
-
"invalid_union",
|
|
30760
|
-
"invalid_union_discriminator",
|
|
30761
|
-
"invalid_enum_value",
|
|
30762
|
-
"unrecognized_keys",
|
|
30763
|
-
"invalid_arguments",
|
|
30764
|
-
"invalid_return_type",
|
|
30765
|
-
"invalid_date",
|
|
30766
|
-
"invalid_string",
|
|
30767
|
-
"too_small",
|
|
30768
|
-
"too_big",
|
|
30769
|
-
"invalid_intersection_types",
|
|
30770
|
-
"not_multiple_of",
|
|
30771
|
-
"not_finite"
|
|
30772
|
-
]);
|
|
30773
|
-
var quotelessJson = (obj) => {
|
|
30774
|
-
const json = JSON.stringify(obj, null, 2);
|
|
30775
|
-
return json.replace(/"([^"]+)":/g, "$1:");
|
|
30776
|
-
};
|
|
30777
|
-
var ZodError = class _ZodError extends Error {
|
|
30778
|
-
get errors() {
|
|
30779
|
-
return this.issues;
|
|
30780
|
-
}
|
|
30781
|
-
constructor(issues) {
|
|
30782
|
-
super();
|
|
30783
|
-
this.issues = [];
|
|
30784
|
-
this.addIssue = (sub) => {
|
|
30785
|
-
this.issues = [...this.issues, sub];
|
|
30786
|
-
};
|
|
30787
|
-
this.addIssues = (subs = []) => {
|
|
30788
|
-
this.issues = [...this.issues, ...subs];
|
|
30789
|
-
};
|
|
30790
|
-
const actualProto = new.target.prototype;
|
|
30791
|
-
if (Object.setPrototypeOf) {
|
|
30792
|
-
Object.setPrototypeOf(this, actualProto);
|
|
30793
|
-
} else {
|
|
30794
|
-
this.__proto__ = actualProto;
|
|
30795
|
-
}
|
|
30796
|
-
this.name = "ZodError";
|
|
30797
|
-
this.issues = issues;
|
|
30450
|
+
const actualProto = new.target.prototype;
|
|
30451
|
+
if (Object.setPrototypeOf) {
|
|
30452
|
+
Object.setPrototypeOf(this, actualProto);
|
|
30453
|
+
} else {
|
|
30454
|
+
this.__proto__ = actualProto;
|
|
30455
|
+
}
|
|
30456
|
+
this.name = "ZodError";
|
|
30457
|
+
this.issues = issues;
|
|
30798
30458
|
}
|
|
30799
30459
|
format(_mapper) {
|
|
30800
30460
|
const mapper = _mapper || function(issue2) {
|
|
@@ -33743,808 +33403,1203 @@ var ZodSet = class _ZodSet extends ZodType {
|
|
|
33743
33403
|
return finalizeSet(elements);
|
|
33744
33404
|
}
|
|
33745
33405
|
}
|
|
33746
|
-
min(minSize, message) {
|
|
33747
|
-
return new _ZodSet({
|
|
33406
|
+
min(minSize, message) {
|
|
33407
|
+
return new _ZodSet({
|
|
33408
|
+
...this._def,
|
|
33409
|
+
minSize: { value: minSize, message: errorUtil.toString(message) }
|
|
33410
|
+
});
|
|
33411
|
+
}
|
|
33412
|
+
max(maxSize, message) {
|
|
33413
|
+
return new _ZodSet({
|
|
33414
|
+
...this._def,
|
|
33415
|
+
maxSize: { value: maxSize, message: errorUtil.toString(message) }
|
|
33416
|
+
});
|
|
33417
|
+
}
|
|
33418
|
+
size(size, message) {
|
|
33419
|
+
return this.min(size, message).max(size, message);
|
|
33420
|
+
}
|
|
33421
|
+
nonempty(message) {
|
|
33422
|
+
return this.min(1, message);
|
|
33423
|
+
}
|
|
33424
|
+
};
|
|
33425
|
+
ZodSet.create = (valueType, params) => {
|
|
33426
|
+
return new ZodSet({
|
|
33427
|
+
valueType,
|
|
33428
|
+
minSize: null,
|
|
33429
|
+
maxSize: null,
|
|
33430
|
+
typeName: ZodFirstPartyTypeKind.ZodSet,
|
|
33431
|
+
...processCreateParams(params)
|
|
33432
|
+
});
|
|
33433
|
+
};
|
|
33434
|
+
var ZodFunction = class _ZodFunction extends ZodType {
|
|
33435
|
+
constructor() {
|
|
33436
|
+
super(...arguments);
|
|
33437
|
+
this.validate = this.implement;
|
|
33438
|
+
}
|
|
33439
|
+
_parse(input) {
|
|
33440
|
+
const { ctx } = this._processInputParams(input);
|
|
33441
|
+
if (ctx.parsedType !== ZodParsedType.function) {
|
|
33442
|
+
addIssueToContext(ctx, {
|
|
33443
|
+
code: ZodIssueCode.invalid_type,
|
|
33444
|
+
expected: ZodParsedType.function,
|
|
33445
|
+
received: ctx.parsedType
|
|
33446
|
+
});
|
|
33447
|
+
return INVALID;
|
|
33448
|
+
}
|
|
33449
|
+
function makeArgsIssue(args, error2) {
|
|
33450
|
+
return makeIssue({
|
|
33451
|
+
data: args,
|
|
33452
|
+
path: ctx.path,
|
|
33453
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
|
|
33454
|
+
issueData: {
|
|
33455
|
+
code: ZodIssueCode.invalid_arguments,
|
|
33456
|
+
argumentsError: error2
|
|
33457
|
+
}
|
|
33458
|
+
});
|
|
33459
|
+
}
|
|
33460
|
+
function makeReturnsIssue(returns, error2) {
|
|
33461
|
+
return makeIssue({
|
|
33462
|
+
data: returns,
|
|
33463
|
+
path: ctx.path,
|
|
33464
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
|
|
33465
|
+
issueData: {
|
|
33466
|
+
code: ZodIssueCode.invalid_return_type,
|
|
33467
|
+
returnTypeError: error2
|
|
33468
|
+
}
|
|
33469
|
+
});
|
|
33470
|
+
}
|
|
33471
|
+
const params = { errorMap: ctx.common.contextualErrorMap };
|
|
33472
|
+
const fn = ctx.data;
|
|
33473
|
+
if (this._def.returns instanceof ZodPromise) {
|
|
33474
|
+
const me = this;
|
|
33475
|
+
return OK(async function(...args) {
|
|
33476
|
+
const error2 = new ZodError([]);
|
|
33477
|
+
const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
|
|
33478
|
+
error2.addIssue(makeArgsIssue(args, e));
|
|
33479
|
+
throw error2;
|
|
33480
|
+
});
|
|
33481
|
+
const result = await Reflect.apply(fn, this, parsedArgs);
|
|
33482
|
+
const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
|
|
33483
|
+
error2.addIssue(makeReturnsIssue(result, e));
|
|
33484
|
+
throw error2;
|
|
33485
|
+
});
|
|
33486
|
+
return parsedReturns;
|
|
33487
|
+
});
|
|
33488
|
+
} else {
|
|
33489
|
+
const me = this;
|
|
33490
|
+
return OK(function(...args) {
|
|
33491
|
+
const parsedArgs = me._def.args.safeParse(args, params);
|
|
33492
|
+
if (!parsedArgs.success) {
|
|
33493
|
+
throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
|
|
33494
|
+
}
|
|
33495
|
+
const result = Reflect.apply(fn, this, parsedArgs.data);
|
|
33496
|
+
const parsedReturns = me._def.returns.safeParse(result, params);
|
|
33497
|
+
if (!parsedReturns.success) {
|
|
33498
|
+
throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
|
|
33499
|
+
}
|
|
33500
|
+
return parsedReturns.data;
|
|
33501
|
+
});
|
|
33502
|
+
}
|
|
33503
|
+
}
|
|
33504
|
+
parameters() {
|
|
33505
|
+
return this._def.args;
|
|
33506
|
+
}
|
|
33507
|
+
returnType() {
|
|
33508
|
+
return this._def.returns;
|
|
33509
|
+
}
|
|
33510
|
+
args(...items) {
|
|
33511
|
+
return new _ZodFunction({
|
|
33512
|
+
...this._def,
|
|
33513
|
+
args: ZodTuple.create(items).rest(ZodUnknown.create())
|
|
33514
|
+
});
|
|
33515
|
+
}
|
|
33516
|
+
returns(returnType) {
|
|
33517
|
+
return new _ZodFunction({
|
|
33518
|
+
...this._def,
|
|
33519
|
+
returns: returnType
|
|
33520
|
+
});
|
|
33521
|
+
}
|
|
33522
|
+
implement(func) {
|
|
33523
|
+
const validatedFunc = this.parse(func);
|
|
33524
|
+
return validatedFunc;
|
|
33525
|
+
}
|
|
33526
|
+
strictImplement(func) {
|
|
33527
|
+
const validatedFunc = this.parse(func);
|
|
33528
|
+
return validatedFunc;
|
|
33529
|
+
}
|
|
33530
|
+
static create(args, returns, params) {
|
|
33531
|
+
return new _ZodFunction({
|
|
33532
|
+
args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
|
|
33533
|
+
returns: returns || ZodUnknown.create(),
|
|
33534
|
+
typeName: ZodFirstPartyTypeKind.ZodFunction,
|
|
33535
|
+
...processCreateParams(params)
|
|
33536
|
+
});
|
|
33537
|
+
}
|
|
33538
|
+
};
|
|
33539
|
+
var ZodLazy = class extends ZodType {
|
|
33540
|
+
get schema() {
|
|
33541
|
+
return this._def.getter();
|
|
33542
|
+
}
|
|
33543
|
+
_parse(input) {
|
|
33544
|
+
const { ctx } = this._processInputParams(input);
|
|
33545
|
+
const lazySchema = this._def.getter();
|
|
33546
|
+
return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
|
|
33547
|
+
}
|
|
33548
|
+
};
|
|
33549
|
+
ZodLazy.create = (getter, params) => {
|
|
33550
|
+
return new ZodLazy({
|
|
33551
|
+
getter,
|
|
33552
|
+
typeName: ZodFirstPartyTypeKind.ZodLazy,
|
|
33553
|
+
...processCreateParams(params)
|
|
33554
|
+
});
|
|
33555
|
+
};
|
|
33556
|
+
var ZodLiteral = class extends ZodType {
|
|
33557
|
+
_parse(input) {
|
|
33558
|
+
if (input.data !== this._def.value) {
|
|
33559
|
+
const ctx = this._getOrReturnCtx(input);
|
|
33560
|
+
addIssueToContext(ctx, {
|
|
33561
|
+
received: ctx.data,
|
|
33562
|
+
code: ZodIssueCode.invalid_literal,
|
|
33563
|
+
expected: this._def.value
|
|
33564
|
+
});
|
|
33565
|
+
return INVALID;
|
|
33566
|
+
}
|
|
33567
|
+
return { status: "valid", value: input.data };
|
|
33568
|
+
}
|
|
33569
|
+
get value() {
|
|
33570
|
+
return this._def.value;
|
|
33571
|
+
}
|
|
33572
|
+
};
|
|
33573
|
+
ZodLiteral.create = (value, params) => {
|
|
33574
|
+
return new ZodLiteral({
|
|
33575
|
+
value,
|
|
33576
|
+
typeName: ZodFirstPartyTypeKind.ZodLiteral,
|
|
33577
|
+
...processCreateParams(params)
|
|
33578
|
+
});
|
|
33579
|
+
};
|
|
33580
|
+
function createZodEnum(values, params) {
|
|
33581
|
+
return new ZodEnum({
|
|
33582
|
+
values,
|
|
33583
|
+
typeName: ZodFirstPartyTypeKind.ZodEnum,
|
|
33584
|
+
...processCreateParams(params)
|
|
33585
|
+
});
|
|
33586
|
+
}
|
|
33587
|
+
var ZodEnum = class _ZodEnum extends ZodType {
|
|
33588
|
+
_parse(input) {
|
|
33589
|
+
if (typeof input.data !== "string") {
|
|
33590
|
+
const ctx = this._getOrReturnCtx(input);
|
|
33591
|
+
const expectedValues = this._def.values;
|
|
33592
|
+
addIssueToContext(ctx, {
|
|
33593
|
+
expected: util.joinValues(expectedValues),
|
|
33594
|
+
received: ctx.parsedType,
|
|
33595
|
+
code: ZodIssueCode.invalid_type
|
|
33596
|
+
});
|
|
33597
|
+
return INVALID;
|
|
33598
|
+
}
|
|
33599
|
+
if (!this._cache) {
|
|
33600
|
+
this._cache = new Set(this._def.values);
|
|
33601
|
+
}
|
|
33602
|
+
if (!this._cache.has(input.data)) {
|
|
33603
|
+
const ctx = this._getOrReturnCtx(input);
|
|
33604
|
+
const expectedValues = this._def.values;
|
|
33605
|
+
addIssueToContext(ctx, {
|
|
33606
|
+
received: ctx.data,
|
|
33607
|
+
code: ZodIssueCode.invalid_enum_value,
|
|
33608
|
+
options: expectedValues
|
|
33609
|
+
});
|
|
33610
|
+
return INVALID;
|
|
33611
|
+
}
|
|
33612
|
+
return OK(input.data);
|
|
33613
|
+
}
|
|
33614
|
+
get options() {
|
|
33615
|
+
return this._def.values;
|
|
33616
|
+
}
|
|
33617
|
+
get enum() {
|
|
33618
|
+
const enumValues = {};
|
|
33619
|
+
for (const val of this._def.values) {
|
|
33620
|
+
enumValues[val] = val;
|
|
33621
|
+
}
|
|
33622
|
+
return enumValues;
|
|
33623
|
+
}
|
|
33624
|
+
get Values() {
|
|
33625
|
+
const enumValues = {};
|
|
33626
|
+
for (const val of this._def.values) {
|
|
33627
|
+
enumValues[val] = val;
|
|
33628
|
+
}
|
|
33629
|
+
return enumValues;
|
|
33630
|
+
}
|
|
33631
|
+
get Enum() {
|
|
33632
|
+
const enumValues = {};
|
|
33633
|
+
for (const val of this._def.values) {
|
|
33634
|
+
enumValues[val] = val;
|
|
33635
|
+
}
|
|
33636
|
+
return enumValues;
|
|
33637
|
+
}
|
|
33638
|
+
extract(values, newDef = this._def) {
|
|
33639
|
+
return _ZodEnum.create(values, {
|
|
33748
33640
|
...this._def,
|
|
33749
|
-
|
|
33641
|
+
...newDef
|
|
33750
33642
|
});
|
|
33751
33643
|
}
|
|
33752
|
-
|
|
33753
|
-
return
|
|
33644
|
+
exclude(values, newDef = this._def) {
|
|
33645
|
+
return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
|
|
33754
33646
|
...this._def,
|
|
33755
|
-
|
|
33647
|
+
...newDef
|
|
33756
33648
|
});
|
|
33757
33649
|
}
|
|
33758
|
-
|
|
33759
|
-
|
|
33650
|
+
};
|
|
33651
|
+
ZodEnum.create = createZodEnum;
|
|
33652
|
+
var ZodNativeEnum = class extends ZodType {
|
|
33653
|
+
_parse(input) {
|
|
33654
|
+
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
33655
|
+
const ctx = this._getOrReturnCtx(input);
|
|
33656
|
+
if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
|
|
33657
|
+
const expectedValues = util.objectValues(nativeEnumValues);
|
|
33658
|
+
addIssueToContext(ctx, {
|
|
33659
|
+
expected: util.joinValues(expectedValues),
|
|
33660
|
+
received: ctx.parsedType,
|
|
33661
|
+
code: ZodIssueCode.invalid_type
|
|
33662
|
+
});
|
|
33663
|
+
return INVALID;
|
|
33664
|
+
}
|
|
33665
|
+
if (!this._cache) {
|
|
33666
|
+
this._cache = new Set(util.getValidEnumValues(this._def.values));
|
|
33667
|
+
}
|
|
33668
|
+
if (!this._cache.has(input.data)) {
|
|
33669
|
+
const expectedValues = util.objectValues(nativeEnumValues);
|
|
33670
|
+
addIssueToContext(ctx, {
|
|
33671
|
+
received: ctx.data,
|
|
33672
|
+
code: ZodIssueCode.invalid_enum_value,
|
|
33673
|
+
options: expectedValues
|
|
33674
|
+
});
|
|
33675
|
+
return INVALID;
|
|
33676
|
+
}
|
|
33677
|
+
return OK(input.data);
|
|
33760
33678
|
}
|
|
33761
|
-
|
|
33762
|
-
return this.
|
|
33679
|
+
get enum() {
|
|
33680
|
+
return this._def.values;
|
|
33763
33681
|
}
|
|
33764
33682
|
};
|
|
33765
|
-
|
|
33766
|
-
return new
|
|
33767
|
-
|
|
33768
|
-
|
|
33769
|
-
maxSize: null,
|
|
33770
|
-
typeName: ZodFirstPartyTypeKind.ZodSet,
|
|
33683
|
+
ZodNativeEnum.create = (values, params) => {
|
|
33684
|
+
return new ZodNativeEnum({
|
|
33685
|
+
values,
|
|
33686
|
+
typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
|
|
33771
33687
|
...processCreateParams(params)
|
|
33772
33688
|
});
|
|
33773
33689
|
};
|
|
33774
|
-
var
|
|
33775
|
-
|
|
33776
|
-
|
|
33777
|
-
this.validate = this.implement;
|
|
33690
|
+
var ZodPromise = class extends ZodType {
|
|
33691
|
+
unwrap() {
|
|
33692
|
+
return this._def.type;
|
|
33778
33693
|
}
|
|
33779
33694
|
_parse(input) {
|
|
33780
33695
|
const { ctx } = this._processInputParams(input);
|
|
33781
|
-
if (ctx.parsedType !== ZodParsedType.
|
|
33696
|
+
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
|
33782
33697
|
addIssueToContext(ctx, {
|
|
33783
33698
|
code: ZodIssueCode.invalid_type,
|
|
33784
|
-
expected: ZodParsedType.
|
|
33699
|
+
expected: ZodParsedType.promise,
|
|
33785
33700
|
received: ctx.parsedType
|
|
33786
33701
|
});
|
|
33787
33702
|
return INVALID;
|
|
33788
33703
|
}
|
|
33789
|
-
|
|
33790
|
-
|
|
33791
|
-
|
|
33704
|
+
const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
|
|
33705
|
+
return OK(promisified.then((data) => {
|
|
33706
|
+
return this._def.type.parseAsync(data, {
|
|
33792
33707
|
path: ctx.path,
|
|
33793
|
-
|
|
33794
|
-
issueData: {
|
|
33795
|
-
code: ZodIssueCode.invalid_arguments,
|
|
33796
|
-
argumentsError: error2
|
|
33797
|
-
}
|
|
33708
|
+
errorMap: ctx.common.contextualErrorMap
|
|
33798
33709
|
});
|
|
33799
|
-
}
|
|
33800
|
-
|
|
33801
|
-
|
|
33802
|
-
|
|
33803
|
-
|
|
33804
|
-
|
|
33805
|
-
|
|
33806
|
-
|
|
33807
|
-
|
|
33710
|
+
}));
|
|
33711
|
+
}
|
|
33712
|
+
};
|
|
33713
|
+
ZodPromise.create = (schema, params) => {
|
|
33714
|
+
return new ZodPromise({
|
|
33715
|
+
type: schema,
|
|
33716
|
+
typeName: ZodFirstPartyTypeKind.ZodPromise,
|
|
33717
|
+
...processCreateParams(params)
|
|
33718
|
+
});
|
|
33719
|
+
};
|
|
33720
|
+
var ZodEffects = class extends ZodType {
|
|
33721
|
+
innerType() {
|
|
33722
|
+
return this._def.schema;
|
|
33723
|
+
}
|
|
33724
|
+
sourceType() {
|
|
33725
|
+
return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
33726
|
+
}
|
|
33727
|
+
_parse(input) {
|
|
33728
|
+
const { status, ctx } = this._processInputParams(input);
|
|
33729
|
+
const effect = this._def.effect || null;
|
|
33730
|
+
const checkCtx = {
|
|
33731
|
+
addIssue: (arg) => {
|
|
33732
|
+
addIssueToContext(ctx, arg);
|
|
33733
|
+
if (arg.fatal) {
|
|
33734
|
+
status.abort();
|
|
33735
|
+
} else {
|
|
33736
|
+
status.dirty();
|
|
33808
33737
|
}
|
|
33809
|
-
}
|
|
33810
|
-
|
|
33811
|
-
|
|
33812
|
-
|
|
33813
|
-
|
|
33814
|
-
|
|
33815
|
-
|
|
33816
|
-
|
|
33817
|
-
|
|
33818
|
-
|
|
33819
|
-
|
|
33738
|
+
},
|
|
33739
|
+
get path() {
|
|
33740
|
+
return ctx.path;
|
|
33741
|
+
}
|
|
33742
|
+
};
|
|
33743
|
+
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
|
|
33744
|
+
if (effect.type === "preprocess") {
|
|
33745
|
+
const processed = effect.transform(ctx.data, checkCtx);
|
|
33746
|
+
if (ctx.common.async) {
|
|
33747
|
+
return Promise.resolve(processed).then(async (processed2) => {
|
|
33748
|
+
if (status.value === "aborted")
|
|
33749
|
+
return INVALID;
|
|
33750
|
+
const result = await this._def.schema._parseAsync({
|
|
33751
|
+
data: processed2,
|
|
33752
|
+
path: ctx.path,
|
|
33753
|
+
parent: ctx
|
|
33754
|
+
});
|
|
33755
|
+
if (result.status === "aborted")
|
|
33756
|
+
return INVALID;
|
|
33757
|
+
if (result.status === "dirty")
|
|
33758
|
+
return DIRTY(result.value);
|
|
33759
|
+
if (status.value === "dirty")
|
|
33760
|
+
return DIRTY(result.value);
|
|
33761
|
+
return result;
|
|
33820
33762
|
});
|
|
33821
|
-
|
|
33822
|
-
|
|
33823
|
-
|
|
33824
|
-
|
|
33763
|
+
} else {
|
|
33764
|
+
if (status.value === "aborted")
|
|
33765
|
+
return INVALID;
|
|
33766
|
+
const result = this._def.schema._parseSync({
|
|
33767
|
+
data: processed,
|
|
33768
|
+
path: ctx.path,
|
|
33769
|
+
parent: ctx
|
|
33825
33770
|
});
|
|
33826
|
-
|
|
33827
|
-
|
|
33828
|
-
|
|
33829
|
-
|
|
33830
|
-
|
|
33831
|
-
|
|
33832
|
-
|
|
33833
|
-
|
|
33771
|
+
if (result.status === "aborted")
|
|
33772
|
+
return INVALID;
|
|
33773
|
+
if (result.status === "dirty")
|
|
33774
|
+
return DIRTY(result.value);
|
|
33775
|
+
if (status.value === "dirty")
|
|
33776
|
+
return DIRTY(result.value);
|
|
33777
|
+
return result;
|
|
33778
|
+
}
|
|
33779
|
+
}
|
|
33780
|
+
if (effect.type === "refinement") {
|
|
33781
|
+
const executeRefinement = (acc) => {
|
|
33782
|
+
const result = effect.refinement(acc, checkCtx);
|
|
33783
|
+
if (ctx.common.async) {
|
|
33784
|
+
return Promise.resolve(result);
|
|
33834
33785
|
}
|
|
33835
|
-
|
|
33836
|
-
|
|
33837
|
-
if (!parsedReturns.success) {
|
|
33838
|
-
throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
|
|
33786
|
+
if (result instanceof Promise) {
|
|
33787
|
+
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
33839
33788
|
}
|
|
33840
|
-
return
|
|
33841
|
-
}
|
|
33789
|
+
return acc;
|
|
33790
|
+
};
|
|
33791
|
+
if (ctx.common.async === false) {
|
|
33792
|
+
const inner = this._def.schema._parseSync({
|
|
33793
|
+
data: ctx.data,
|
|
33794
|
+
path: ctx.path,
|
|
33795
|
+
parent: ctx
|
|
33796
|
+
});
|
|
33797
|
+
if (inner.status === "aborted")
|
|
33798
|
+
return INVALID;
|
|
33799
|
+
if (inner.status === "dirty")
|
|
33800
|
+
status.dirty();
|
|
33801
|
+
executeRefinement(inner.value);
|
|
33802
|
+
return { status: status.value, value: inner.value };
|
|
33803
|
+
} else {
|
|
33804
|
+
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
|
|
33805
|
+
if (inner.status === "aborted")
|
|
33806
|
+
return INVALID;
|
|
33807
|
+
if (inner.status === "dirty")
|
|
33808
|
+
status.dirty();
|
|
33809
|
+
return executeRefinement(inner.value).then(() => {
|
|
33810
|
+
return { status: status.value, value: inner.value };
|
|
33811
|
+
});
|
|
33812
|
+
});
|
|
33813
|
+
}
|
|
33842
33814
|
}
|
|
33843
|
-
|
|
33844
|
-
|
|
33845
|
-
|
|
33846
|
-
|
|
33847
|
-
|
|
33848
|
-
|
|
33849
|
-
|
|
33850
|
-
|
|
33851
|
-
|
|
33852
|
-
|
|
33853
|
-
|
|
33854
|
-
|
|
33855
|
-
|
|
33856
|
-
|
|
33857
|
-
|
|
33858
|
-
|
|
33859
|
-
|
|
33860
|
-
|
|
33861
|
-
|
|
33862
|
-
|
|
33863
|
-
|
|
33864
|
-
|
|
33865
|
-
|
|
33866
|
-
|
|
33867
|
-
|
|
33868
|
-
|
|
33869
|
-
}
|
|
33870
|
-
static create(args, returns, params) {
|
|
33871
|
-
return new _ZodFunction({
|
|
33872
|
-
args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
|
|
33873
|
-
returns: returns || ZodUnknown.create(),
|
|
33874
|
-
typeName: ZodFirstPartyTypeKind.ZodFunction,
|
|
33875
|
-
...processCreateParams(params)
|
|
33876
|
-
});
|
|
33815
|
+
if (effect.type === "transform") {
|
|
33816
|
+
if (ctx.common.async === false) {
|
|
33817
|
+
const base = this._def.schema._parseSync({
|
|
33818
|
+
data: ctx.data,
|
|
33819
|
+
path: ctx.path,
|
|
33820
|
+
parent: ctx
|
|
33821
|
+
});
|
|
33822
|
+
if (!isValid(base))
|
|
33823
|
+
return INVALID;
|
|
33824
|
+
const result = effect.transform(base.value, checkCtx);
|
|
33825
|
+
if (result instanceof Promise) {
|
|
33826
|
+
throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
|
|
33827
|
+
}
|
|
33828
|
+
return { status: status.value, value: result };
|
|
33829
|
+
} else {
|
|
33830
|
+
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
|
|
33831
|
+
if (!isValid(base))
|
|
33832
|
+
return INVALID;
|
|
33833
|
+
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
33834
|
+
status: status.value,
|
|
33835
|
+
value: result
|
|
33836
|
+
}));
|
|
33837
|
+
});
|
|
33838
|
+
}
|
|
33839
|
+
}
|
|
33840
|
+
util.assertNever(effect);
|
|
33877
33841
|
}
|
|
33878
33842
|
};
|
|
33879
|
-
|
|
33880
|
-
|
|
33881
|
-
|
|
33882
|
-
|
|
33883
|
-
|
|
33884
|
-
|
|
33885
|
-
|
|
33886
|
-
return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
|
|
33887
|
-
}
|
|
33843
|
+
ZodEffects.create = (schema, effect, params) => {
|
|
33844
|
+
return new ZodEffects({
|
|
33845
|
+
schema,
|
|
33846
|
+
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
33847
|
+
effect,
|
|
33848
|
+
...processCreateParams(params)
|
|
33849
|
+
});
|
|
33888
33850
|
};
|
|
33889
|
-
|
|
33890
|
-
return new
|
|
33891
|
-
|
|
33892
|
-
|
|
33851
|
+
ZodEffects.createWithPreprocess = (preprocess2, schema, params) => {
|
|
33852
|
+
return new ZodEffects({
|
|
33853
|
+
schema,
|
|
33854
|
+
effect: { type: "preprocess", transform: preprocess2 },
|
|
33855
|
+
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
33893
33856
|
...processCreateParams(params)
|
|
33894
33857
|
});
|
|
33895
33858
|
};
|
|
33896
|
-
var
|
|
33859
|
+
var ZodOptional = class extends ZodType {
|
|
33897
33860
|
_parse(input) {
|
|
33898
|
-
|
|
33899
|
-
|
|
33900
|
-
|
|
33901
|
-
received: ctx.data,
|
|
33902
|
-
code: ZodIssueCode.invalid_literal,
|
|
33903
|
-
expected: this._def.value
|
|
33904
|
-
});
|
|
33905
|
-
return INVALID;
|
|
33861
|
+
const parsedType2 = this._getType(input);
|
|
33862
|
+
if (parsedType2 === ZodParsedType.undefined) {
|
|
33863
|
+
return OK(void 0);
|
|
33906
33864
|
}
|
|
33907
|
-
return
|
|
33865
|
+
return this._def.innerType._parse(input);
|
|
33908
33866
|
}
|
|
33909
|
-
|
|
33910
|
-
return this._def.
|
|
33867
|
+
unwrap() {
|
|
33868
|
+
return this._def.innerType;
|
|
33911
33869
|
}
|
|
33912
33870
|
};
|
|
33913
|
-
|
|
33914
|
-
return new
|
|
33915
|
-
|
|
33916
|
-
typeName: ZodFirstPartyTypeKind.
|
|
33871
|
+
ZodOptional.create = (type, params) => {
|
|
33872
|
+
return new ZodOptional({
|
|
33873
|
+
innerType: type,
|
|
33874
|
+
typeName: ZodFirstPartyTypeKind.ZodOptional,
|
|
33917
33875
|
...processCreateParams(params)
|
|
33918
33876
|
});
|
|
33919
33877
|
};
|
|
33920
|
-
|
|
33921
|
-
return new ZodEnum({
|
|
33922
|
-
values,
|
|
33923
|
-
typeName: ZodFirstPartyTypeKind.ZodEnum,
|
|
33924
|
-
...processCreateParams(params)
|
|
33925
|
-
});
|
|
33926
|
-
}
|
|
33927
|
-
var ZodEnum = class _ZodEnum extends ZodType {
|
|
33878
|
+
var ZodNullable = class extends ZodType {
|
|
33928
33879
|
_parse(input) {
|
|
33929
|
-
|
|
33930
|
-
|
|
33931
|
-
|
|
33932
|
-
addIssueToContext(ctx, {
|
|
33933
|
-
expected: util.joinValues(expectedValues),
|
|
33934
|
-
received: ctx.parsedType,
|
|
33935
|
-
code: ZodIssueCode.invalid_type
|
|
33936
|
-
});
|
|
33937
|
-
return INVALID;
|
|
33938
|
-
}
|
|
33939
|
-
if (!this._cache) {
|
|
33940
|
-
this._cache = new Set(this._def.values);
|
|
33941
|
-
}
|
|
33942
|
-
if (!this._cache.has(input.data)) {
|
|
33943
|
-
const ctx = this._getOrReturnCtx(input);
|
|
33944
|
-
const expectedValues = this._def.values;
|
|
33945
|
-
addIssueToContext(ctx, {
|
|
33946
|
-
received: ctx.data,
|
|
33947
|
-
code: ZodIssueCode.invalid_enum_value,
|
|
33948
|
-
options: expectedValues
|
|
33949
|
-
});
|
|
33950
|
-
return INVALID;
|
|
33951
|
-
}
|
|
33952
|
-
return OK(input.data);
|
|
33953
|
-
}
|
|
33954
|
-
get options() {
|
|
33955
|
-
return this._def.values;
|
|
33956
|
-
}
|
|
33957
|
-
get enum() {
|
|
33958
|
-
const enumValues = {};
|
|
33959
|
-
for (const val of this._def.values) {
|
|
33960
|
-
enumValues[val] = val;
|
|
33880
|
+
const parsedType2 = this._getType(input);
|
|
33881
|
+
if (parsedType2 === ZodParsedType.null) {
|
|
33882
|
+
return OK(null);
|
|
33961
33883
|
}
|
|
33962
|
-
return
|
|
33884
|
+
return this._def.innerType._parse(input);
|
|
33963
33885
|
}
|
|
33964
|
-
|
|
33965
|
-
|
|
33966
|
-
for (const val of this._def.values) {
|
|
33967
|
-
enumValues[val] = val;
|
|
33968
|
-
}
|
|
33969
|
-
return enumValues;
|
|
33886
|
+
unwrap() {
|
|
33887
|
+
return this._def.innerType;
|
|
33970
33888
|
}
|
|
33971
|
-
|
|
33972
|
-
|
|
33973
|
-
|
|
33974
|
-
|
|
33889
|
+
};
|
|
33890
|
+
ZodNullable.create = (type, params) => {
|
|
33891
|
+
return new ZodNullable({
|
|
33892
|
+
innerType: type,
|
|
33893
|
+
typeName: ZodFirstPartyTypeKind.ZodNullable,
|
|
33894
|
+
...processCreateParams(params)
|
|
33895
|
+
});
|
|
33896
|
+
};
|
|
33897
|
+
var ZodDefault = class extends ZodType {
|
|
33898
|
+
_parse(input) {
|
|
33899
|
+
const { ctx } = this._processInputParams(input);
|
|
33900
|
+
let data = ctx.data;
|
|
33901
|
+
if (ctx.parsedType === ZodParsedType.undefined) {
|
|
33902
|
+
data = this._def.defaultValue();
|
|
33975
33903
|
}
|
|
33976
|
-
return
|
|
33977
|
-
|
|
33978
|
-
|
|
33979
|
-
|
|
33980
|
-
...this._def,
|
|
33981
|
-
...newDef
|
|
33904
|
+
return this._def.innerType._parse({
|
|
33905
|
+
data,
|
|
33906
|
+
path: ctx.path,
|
|
33907
|
+
parent: ctx
|
|
33982
33908
|
});
|
|
33983
33909
|
}
|
|
33984
|
-
|
|
33985
|
-
return
|
|
33986
|
-
...this._def,
|
|
33987
|
-
...newDef
|
|
33988
|
-
});
|
|
33910
|
+
removeDefault() {
|
|
33911
|
+
return this._def.innerType;
|
|
33989
33912
|
}
|
|
33990
33913
|
};
|
|
33991
|
-
|
|
33992
|
-
|
|
33914
|
+
ZodDefault.create = (type, params) => {
|
|
33915
|
+
return new ZodDefault({
|
|
33916
|
+
innerType: type,
|
|
33917
|
+
typeName: ZodFirstPartyTypeKind.ZodDefault,
|
|
33918
|
+
defaultValue: typeof params.default === "function" ? params.default : () => params.default,
|
|
33919
|
+
...processCreateParams(params)
|
|
33920
|
+
});
|
|
33921
|
+
};
|
|
33922
|
+
var ZodCatch = class extends ZodType {
|
|
33993
33923
|
_parse(input) {
|
|
33994
|
-
const
|
|
33995
|
-
const
|
|
33996
|
-
|
|
33997
|
-
|
|
33998
|
-
|
|
33999
|
-
|
|
34000
|
-
|
|
34001
|
-
|
|
34002
|
-
|
|
34003
|
-
|
|
34004
|
-
|
|
34005
|
-
|
|
34006
|
-
|
|
34007
|
-
|
|
34008
|
-
|
|
34009
|
-
|
|
34010
|
-
|
|
34011
|
-
|
|
34012
|
-
|
|
34013
|
-
|
|
33924
|
+
const { ctx } = this._processInputParams(input);
|
|
33925
|
+
const newCtx = {
|
|
33926
|
+
...ctx,
|
|
33927
|
+
common: {
|
|
33928
|
+
...ctx.common,
|
|
33929
|
+
issues: []
|
|
33930
|
+
}
|
|
33931
|
+
};
|
|
33932
|
+
const result = this._def.innerType._parse({
|
|
33933
|
+
data: newCtx.data,
|
|
33934
|
+
path: newCtx.path,
|
|
33935
|
+
parent: {
|
|
33936
|
+
...newCtx
|
|
33937
|
+
}
|
|
33938
|
+
});
|
|
33939
|
+
if (isAsync(result)) {
|
|
33940
|
+
return result.then((result2) => {
|
|
33941
|
+
return {
|
|
33942
|
+
status: "valid",
|
|
33943
|
+
value: result2.status === "valid" ? result2.value : this._def.catchValue({
|
|
33944
|
+
get error() {
|
|
33945
|
+
return new ZodError(newCtx.common.issues);
|
|
33946
|
+
},
|
|
33947
|
+
input: newCtx.data
|
|
33948
|
+
})
|
|
33949
|
+
};
|
|
34014
33950
|
});
|
|
34015
|
-
|
|
33951
|
+
} else {
|
|
33952
|
+
return {
|
|
33953
|
+
status: "valid",
|
|
33954
|
+
value: result.status === "valid" ? result.value : this._def.catchValue({
|
|
33955
|
+
get error() {
|
|
33956
|
+
return new ZodError(newCtx.common.issues);
|
|
33957
|
+
},
|
|
33958
|
+
input: newCtx.data
|
|
33959
|
+
})
|
|
33960
|
+
};
|
|
34016
33961
|
}
|
|
34017
|
-
return OK(input.data);
|
|
34018
33962
|
}
|
|
34019
|
-
|
|
34020
|
-
return this._def.
|
|
33963
|
+
removeCatch() {
|
|
33964
|
+
return this._def.innerType;
|
|
34021
33965
|
}
|
|
34022
33966
|
};
|
|
34023
|
-
|
|
34024
|
-
return new
|
|
34025
|
-
|
|
34026
|
-
typeName: ZodFirstPartyTypeKind.
|
|
33967
|
+
ZodCatch.create = (type, params) => {
|
|
33968
|
+
return new ZodCatch({
|
|
33969
|
+
innerType: type,
|
|
33970
|
+
typeName: ZodFirstPartyTypeKind.ZodCatch,
|
|
33971
|
+
catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
|
|
34027
33972
|
...processCreateParams(params)
|
|
34028
33973
|
});
|
|
34029
33974
|
};
|
|
34030
|
-
var
|
|
34031
|
-
unwrap() {
|
|
34032
|
-
return this._def.type;
|
|
34033
|
-
}
|
|
33975
|
+
var ZodNaN = class extends ZodType {
|
|
34034
33976
|
_parse(input) {
|
|
34035
|
-
const
|
|
34036
|
-
if (
|
|
33977
|
+
const parsedType2 = this._getType(input);
|
|
33978
|
+
if (parsedType2 !== ZodParsedType.nan) {
|
|
33979
|
+
const ctx = this._getOrReturnCtx(input);
|
|
34037
33980
|
addIssueToContext(ctx, {
|
|
34038
33981
|
code: ZodIssueCode.invalid_type,
|
|
34039
|
-
expected: ZodParsedType.
|
|
33982
|
+
expected: ZodParsedType.nan,
|
|
34040
33983
|
received: ctx.parsedType
|
|
34041
33984
|
});
|
|
34042
33985
|
return INVALID;
|
|
34043
33986
|
}
|
|
34044
|
-
|
|
34045
|
-
return OK(promisified.then((data) => {
|
|
34046
|
-
return this._def.type.parseAsync(data, {
|
|
34047
|
-
path: ctx.path,
|
|
34048
|
-
errorMap: ctx.common.contextualErrorMap
|
|
34049
|
-
});
|
|
34050
|
-
}));
|
|
33987
|
+
return { status: "valid", value: input.data };
|
|
34051
33988
|
}
|
|
34052
33989
|
};
|
|
34053
|
-
|
|
34054
|
-
return new
|
|
34055
|
-
|
|
34056
|
-
typeName: ZodFirstPartyTypeKind.ZodPromise,
|
|
33990
|
+
ZodNaN.create = (params) => {
|
|
33991
|
+
return new ZodNaN({
|
|
33992
|
+
typeName: ZodFirstPartyTypeKind.ZodNaN,
|
|
34057
33993
|
...processCreateParams(params)
|
|
34058
33994
|
});
|
|
34059
33995
|
};
|
|
34060
|
-
var
|
|
34061
|
-
|
|
34062
|
-
|
|
33996
|
+
var BRAND = /* @__PURE__ */ Symbol("zod_brand");
|
|
33997
|
+
var ZodBranded = class extends ZodType {
|
|
33998
|
+
_parse(input) {
|
|
33999
|
+
const { ctx } = this._processInputParams(input);
|
|
34000
|
+
const data = ctx.data;
|
|
34001
|
+
return this._def.type._parse({
|
|
34002
|
+
data,
|
|
34003
|
+
path: ctx.path,
|
|
34004
|
+
parent: ctx
|
|
34005
|
+
});
|
|
34063
34006
|
}
|
|
34064
|
-
|
|
34065
|
-
return this._def.
|
|
34007
|
+
unwrap() {
|
|
34008
|
+
return this._def.type;
|
|
34066
34009
|
}
|
|
34010
|
+
};
|
|
34011
|
+
var ZodPipeline = class _ZodPipeline extends ZodType {
|
|
34067
34012
|
_parse(input) {
|
|
34068
34013
|
const { status, ctx } = this._processInputParams(input);
|
|
34069
|
-
|
|
34070
|
-
|
|
34071
|
-
|
|
34072
|
-
|
|
34073
|
-
|
|
34074
|
-
|
|
34075
|
-
}
|
|
34014
|
+
if (ctx.common.async) {
|
|
34015
|
+
const handleAsync = async () => {
|
|
34016
|
+
const inResult = await this._def.in._parseAsync({
|
|
34017
|
+
data: ctx.data,
|
|
34018
|
+
path: ctx.path,
|
|
34019
|
+
parent: ctx
|
|
34020
|
+
});
|
|
34021
|
+
if (inResult.status === "aborted")
|
|
34022
|
+
return INVALID;
|
|
34023
|
+
if (inResult.status === "dirty") {
|
|
34076
34024
|
status.dirty();
|
|
34077
|
-
|
|
34078
|
-
|
|
34079
|
-
|
|
34080
|
-
|
|
34081
|
-
}
|
|
34082
|
-
};
|
|
34083
|
-
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
|
|
34084
|
-
if (effect.type === "preprocess") {
|
|
34085
|
-
const processed = effect.transform(ctx.data, checkCtx);
|
|
34086
|
-
if (ctx.common.async) {
|
|
34087
|
-
return Promise.resolve(processed).then(async (processed2) => {
|
|
34088
|
-
if (status.value === "aborted")
|
|
34089
|
-
return INVALID;
|
|
34090
|
-
const result = await this._def.schema._parseAsync({
|
|
34091
|
-
data: processed2,
|
|
34025
|
+
return DIRTY(inResult.value);
|
|
34026
|
+
} else {
|
|
34027
|
+
return this._def.out._parseAsync({
|
|
34028
|
+
data: inResult.value,
|
|
34092
34029
|
path: ctx.path,
|
|
34093
34030
|
parent: ctx
|
|
34094
34031
|
});
|
|
34095
|
-
|
|
34096
|
-
|
|
34097
|
-
|
|
34098
|
-
|
|
34099
|
-
|
|
34100
|
-
|
|
34101
|
-
|
|
34102
|
-
|
|
34032
|
+
}
|
|
34033
|
+
};
|
|
34034
|
+
return handleAsync();
|
|
34035
|
+
} else {
|
|
34036
|
+
const inResult = this._def.in._parseSync({
|
|
34037
|
+
data: ctx.data,
|
|
34038
|
+
path: ctx.path,
|
|
34039
|
+
parent: ctx
|
|
34040
|
+
});
|
|
34041
|
+
if (inResult.status === "aborted")
|
|
34042
|
+
return INVALID;
|
|
34043
|
+
if (inResult.status === "dirty") {
|
|
34044
|
+
status.dirty();
|
|
34045
|
+
return {
|
|
34046
|
+
status: "dirty",
|
|
34047
|
+
value: inResult.value
|
|
34048
|
+
};
|
|
34103
34049
|
} else {
|
|
34104
|
-
|
|
34105
|
-
|
|
34106
|
-
const result = this._def.schema._parseSync({
|
|
34107
|
-
data: processed,
|
|
34050
|
+
return this._def.out._parseSync({
|
|
34051
|
+
data: inResult.value,
|
|
34108
34052
|
path: ctx.path,
|
|
34109
34053
|
parent: ctx
|
|
34110
34054
|
});
|
|
34111
|
-
if (result.status === "aborted")
|
|
34112
|
-
return INVALID;
|
|
34113
|
-
if (result.status === "dirty")
|
|
34114
|
-
return DIRTY(result.value);
|
|
34115
|
-
if (status.value === "dirty")
|
|
34116
|
-
return DIRTY(result.value);
|
|
34117
|
-
return result;
|
|
34118
34055
|
}
|
|
34119
34056
|
}
|
|
34120
|
-
|
|
34121
|
-
|
|
34122
|
-
|
|
34123
|
-
|
|
34124
|
-
|
|
34057
|
+
}
|
|
34058
|
+
static create(a, b) {
|
|
34059
|
+
return new _ZodPipeline({
|
|
34060
|
+
in: a,
|
|
34061
|
+
out: b,
|
|
34062
|
+
typeName: ZodFirstPartyTypeKind.ZodPipeline
|
|
34063
|
+
});
|
|
34064
|
+
}
|
|
34065
|
+
};
|
|
34066
|
+
var ZodReadonly = class extends ZodType {
|
|
34067
|
+
_parse(input) {
|
|
34068
|
+
const result = this._def.innerType._parse(input);
|
|
34069
|
+
const freeze = (data) => {
|
|
34070
|
+
if (isValid(data)) {
|
|
34071
|
+
data.value = Object.freeze(data.value);
|
|
34072
|
+
}
|
|
34073
|
+
return data;
|
|
34074
|
+
};
|
|
34075
|
+
return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
|
|
34076
|
+
}
|
|
34077
|
+
unwrap() {
|
|
34078
|
+
return this._def.innerType;
|
|
34079
|
+
}
|
|
34080
|
+
};
|
|
34081
|
+
ZodReadonly.create = (type, params) => {
|
|
34082
|
+
return new ZodReadonly({
|
|
34083
|
+
innerType: type,
|
|
34084
|
+
typeName: ZodFirstPartyTypeKind.ZodReadonly,
|
|
34085
|
+
...processCreateParams(params)
|
|
34086
|
+
});
|
|
34087
|
+
};
|
|
34088
|
+
function cleanParams(params, data) {
|
|
34089
|
+
const p2 = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
34090
|
+
const p22 = typeof p2 === "string" ? { message: p2 } : p2;
|
|
34091
|
+
return p22;
|
|
34092
|
+
}
|
|
34093
|
+
function custom(check2, _params = {}, fatal) {
|
|
34094
|
+
if (check2)
|
|
34095
|
+
return ZodAny.create().superRefine((data, ctx) => {
|
|
34096
|
+
const r = check2(data);
|
|
34097
|
+
if (r instanceof Promise) {
|
|
34098
|
+
return r.then((r2) => {
|
|
34099
|
+
if (!r2) {
|
|
34100
|
+
const params = cleanParams(_params, data);
|
|
34101
|
+
const _fatal = params.fatal ?? fatal ?? true;
|
|
34102
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
34103
|
+
}
|
|
34104
|
+
});
|
|
34105
|
+
}
|
|
34106
|
+
if (!r) {
|
|
34107
|
+
const params = cleanParams(_params, data);
|
|
34108
|
+
const _fatal = params.fatal ?? fatal ?? true;
|
|
34109
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
34110
|
+
}
|
|
34111
|
+
return;
|
|
34112
|
+
});
|
|
34113
|
+
return ZodAny.create();
|
|
34114
|
+
}
|
|
34115
|
+
var late = {
|
|
34116
|
+
object: ZodObject.lazycreate
|
|
34117
|
+
};
|
|
34118
|
+
var ZodFirstPartyTypeKind;
|
|
34119
|
+
(function(ZodFirstPartyTypeKind2) {
|
|
34120
|
+
ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
|
|
34121
|
+
ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber";
|
|
34122
|
+
ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN";
|
|
34123
|
+
ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";
|
|
34124
|
+
ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";
|
|
34125
|
+
ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";
|
|
34126
|
+
ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";
|
|
34127
|
+
ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";
|
|
34128
|
+
ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";
|
|
34129
|
+
ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";
|
|
34130
|
+
ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown";
|
|
34131
|
+
ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever";
|
|
34132
|
+
ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid";
|
|
34133
|
+
ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray";
|
|
34134
|
+
ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
|
|
34135
|
+
ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
|
|
34136
|
+
ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
|
|
34137
|
+
ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
|
|
34138
|
+
ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
|
|
34139
|
+
ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
|
|
34140
|
+
ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
|
|
34141
|
+
ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
|
|
34142
|
+
ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
|
|
34143
|
+
ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
|
|
34144
|
+
ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
|
|
34145
|
+
ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
|
|
34146
|
+
ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
|
|
34147
|
+
ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
|
|
34148
|
+
ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
|
|
34149
|
+
ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
|
|
34150
|
+
ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
|
|
34151
|
+
ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
|
|
34152
|
+
ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
|
|
34153
|
+
ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
|
|
34154
|
+
ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
|
|
34155
|
+
ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
|
|
34156
|
+
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
34157
|
+
var instanceOfType = (cls, params = {
|
|
34158
|
+
message: `Input not instance of ${cls.name}`
|
|
34159
|
+
}) => custom((data) => data instanceof cls, params);
|
|
34160
|
+
var stringType = ZodString.create;
|
|
34161
|
+
var numberType = ZodNumber.create;
|
|
34162
|
+
var nanType = ZodNaN.create;
|
|
34163
|
+
var bigIntType = ZodBigInt.create;
|
|
34164
|
+
var booleanType = ZodBoolean.create;
|
|
34165
|
+
var dateType = ZodDate.create;
|
|
34166
|
+
var symbolType = ZodSymbol.create;
|
|
34167
|
+
var undefinedType = ZodUndefined.create;
|
|
34168
|
+
var nullType = ZodNull.create;
|
|
34169
|
+
var anyType = ZodAny.create;
|
|
34170
|
+
var unknownType = ZodUnknown.create;
|
|
34171
|
+
var neverType = ZodNever.create;
|
|
34172
|
+
var voidType = ZodVoid.create;
|
|
34173
|
+
var arrayType = ZodArray.create;
|
|
34174
|
+
var objectType = ZodObject.create;
|
|
34175
|
+
var strictObjectType = ZodObject.strictCreate;
|
|
34176
|
+
var unionType = ZodUnion.create;
|
|
34177
|
+
var discriminatedUnionType = ZodDiscriminatedUnion.create;
|
|
34178
|
+
var intersectionType = ZodIntersection.create;
|
|
34179
|
+
var tupleType = ZodTuple.create;
|
|
34180
|
+
var recordType = ZodRecord.create;
|
|
34181
|
+
var mapType = ZodMap.create;
|
|
34182
|
+
var setType = ZodSet.create;
|
|
34183
|
+
var functionType = ZodFunction.create;
|
|
34184
|
+
var lazyType = ZodLazy.create;
|
|
34185
|
+
var literalType = ZodLiteral.create;
|
|
34186
|
+
var enumType = ZodEnum.create;
|
|
34187
|
+
var nativeEnumType = ZodNativeEnum.create;
|
|
34188
|
+
var promiseType = ZodPromise.create;
|
|
34189
|
+
var effectsType = ZodEffects.create;
|
|
34190
|
+
var optionalType = ZodOptional.create;
|
|
34191
|
+
var nullableType = ZodNullable.create;
|
|
34192
|
+
var preprocessType = ZodEffects.createWithPreprocess;
|
|
34193
|
+
var pipelineType = ZodPipeline.create;
|
|
34194
|
+
var ostring = () => stringType().optional();
|
|
34195
|
+
var onumber = () => numberType().optional();
|
|
34196
|
+
var oboolean = () => booleanType().optional();
|
|
34197
|
+
var coerce = {
|
|
34198
|
+
string: ((arg) => ZodString.create({ ...arg, coerce: true })),
|
|
34199
|
+
number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),
|
|
34200
|
+
boolean: ((arg) => ZodBoolean.create({
|
|
34201
|
+
...arg,
|
|
34202
|
+
coerce: true
|
|
34203
|
+
})),
|
|
34204
|
+
bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
|
|
34205
|
+
date: ((arg) => ZodDate.create({ ...arg, coerce: true }))
|
|
34206
|
+
};
|
|
34207
|
+
var NEVER = INVALID;
|
|
34208
|
+
|
|
34209
|
+
// ../core/dist/dashboards/widget-kinds.js
|
|
34210
|
+
var DASHBOARD_WIDGET_KINDS = ["kpi", "area", "line", "bar", "donut", "table"];
|
|
34211
|
+
var TABLE_CELL_STATES = ["good", "warning", "critical", "info", "neutral", "empty"];
|
|
34212
|
+
var TABLE_WIDGET_LIMITS = { columns: 60, rows: 500, label: 120, cellText: 64 };
|
|
34213
|
+
function categoriesSeriesSchema() {
|
|
34214
|
+
return {
|
|
34215
|
+
type: "object",
|
|
34216
|
+
required: ["categories", "series"],
|
|
34217
|
+
additionalProperties: false,
|
|
34218
|
+
properties: {
|
|
34219
|
+
categories: { type: "array", items: { type: "string" } },
|
|
34220
|
+
series: {
|
|
34221
|
+
type: "array",
|
|
34222
|
+
items: {
|
|
34223
|
+
type: "object",
|
|
34224
|
+
required: ["name", "data"],
|
|
34225
|
+
additionalProperties: false,
|
|
34226
|
+
properties: {
|
|
34227
|
+
name: { type: "string" },
|
|
34228
|
+
data: { type: "array", items: { type: "number" } }
|
|
34229
|
+
}
|
|
34230
|
+
}
|
|
34231
|
+
}
|
|
34232
|
+
}
|
|
34233
|
+
};
|
|
34234
|
+
}
|
|
34235
|
+
function tableSchema() {
|
|
34236
|
+
const L = TABLE_WIDGET_LIMITS;
|
|
34237
|
+
return {
|
|
34238
|
+
type: "object",
|
|
34239
|
+
required: ["columns", "rows"],
|
|
34240
|
+
additionalProperties: false,
|
|
34241
|
+
properties: {
|
|
34242
|
+
rowHeader: { type: "string", maxLength: L.label },
|
|
34243
|
+
columns: { type: "array", minItems: 1, maxItems: L.columns, items: { type: "string", maxLength: L.label } },
|
|
34244
|
+
rows: {
|
|
34245
|
+
type: "array",
|
|
34246
|
+
maxItems: L.rows,
|
|
34247
|
+
items: {
|
|
34248
|
+
type: "object",
|
|
34249
|
+
required: ["label", "cells"],
|
|
34250
|
+
additionalProperties: false,
|
|
34251
|
+
properties: {
|
|
34252
|
+
label: { type: "string", maxLength: L.label },
|
|
34253
|
+
sub: { type: "string", maxLength: L.label },
|
|
34254
|
+
cells: {
|
|
34255
|
+
type: "array",
|
|
34256
|
+
maxItems: L.columns,
|
|
34257
|
+
items: {
|
|
34258
|
+
type: "object",
|
|
34259
|
+
additionalProperties: false,
|
|
34260
|
+
properties: {
|
|
34261
|
+
value: { type: ["string", "number"], maxLength: L.cellText },
|
|
34262
|
+
sub: { type: "string", maxLength: L.cellText },
|
|
34263
|
+
state: { enum: [...TABLE_CELL_STATES] }
|
|
34264
|
+
}
|
|
34265
|
+
}
|
|
34266
|
+
}
|
|
34267
|
+
}
|
|
34125
34268
|
}
|
|
34126
|
-
|
|
34127
|
-
|
|
34269
|
+
},
|
|
34270
|
+
legend: {
|
|
34271
|
+
type: "array",
|
|
34272
|
+
maxItems: TABLE_CELL_STATES.length,
|
|
34273
|
+
items: {
|
|
34274
|
+
type: "object",
|
|
34275
|
+
required: ["state", "label"],
|
|
34276
|
+
additionalProperties: false,
|
|
34277
|
+
properties: {
|
|
34278
|
+
state: { enum: [...TABLE_CELL_STATES] },
|
|
34279
|
+
label: { type: "string", maxLength: L.label }
|
|
34280
|
+
}
|
|
34128
34281
|
}
|
|
34129
|
-
return acc;
|
|
34130
|
-
};
|
|
34131
|
-
if (ctx.common.async === false) {
|
|
34132
|
-
const inner = this._def.schema._parseSync({
|
|
34133
|
-
data: ctx.data,
|
|
34134
|
-
path: ctx.path,
|
|
34135
|
-
parent: ctx
|
|
34136
|
-
});
|
|
34137
|
-
if (inner.status === "aborted")
|
|
34138
|
-
return INVALID;
|
|
34139
|
-
if (inner.status === "dirty")
|
|
34140
|
-
status.dirty();
|
|
34141
|
-
executeRefinement(inner.value);
|
|
34142
|
-
return { status: status.value, value: inner.value };
|
|
34143
|
-
} else {
|
|
34144
|
-
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
|
|
34145
|
-
if (inner.status === "aborted")
|
|
34146
|
-
return INVALID;
|
|
34147
|
-
if (inner.status === "dirty")
|
|
34148
|
-
status.dirty();
|
|
34149
|
-
return executeRefinement(inner.value).then(() => {
|
|
34150
|
-
return { status: status.value, value: inner.value };
|
|
34151
|
-
});
|
|
34152
|
-
});
|
|
34153
34282
|
}
|
|
34154
34283
|
}
|
|
34155
|
-
|
|
34156
|
-
|
|
34157
|
-
|
|
34158
|
-
|
|
34159
|
-
|
|
34160
|
-
|
|
34161
|
-
|
|
34162
|
-
|
|
34163
|
-
|
|
34164
|
-
|
|
34165
|
-
|
|
34166
|
-
|
|
34167
|
-
|
|
34168
|
-
|
|
34169
|
-
} else {
|
|
34170
|
-
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
|
|
34171
|
-
if (!isValid(base))
|
|
34172
|
-
return INVALID;
|
|
34173
|
-
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
34174
|
-
status: status.value,
|
|
34175
|
-
value: result
|
|
34176
|
-
}));
|
|
34177
|
-
});
|
|
34178
|
-
}
|
|
34284
|
+
};
|
|
34285
|
+
}
|
|
34286
|
+
var DASHBOARD_WIDGET_SCHEMAS = {
|
|
34287
|
+
kpi: {
|
|
34288
|
+
type: "object",
|
|
34289
|
+
required: ["value"],
|
|
34290
|
+
additionalProperties: false,
|
|
34291
|
+
properties: {
|
|
34292
|
+
label: { type: "string" },
|
|
34293
|
+
value: { type: ["string", "number"] },
|
|
34294
|
+
delta: { type: "string" },
|
|
34295
|
+
deltaTone: { enum: ["positive", "negative", "neutral"] },
|
|
34296
|
+
values: { type: "array", items: { type: "number" } },
|
|
34297
|
+
color: { type: "string", pattern: "^#[0-9a-fA-F]{6}$" }
|
|
34179
34298
|
}
|
|
34180
|
-
|
|
34181
|
-
|
|
34182
|
-
|
|
34183
|
-
|
|
34184
|
-
|
|
34185
|
-
|
|
34186
|
-
|
|
34187
|
-
|
|
34188
|
-
|
|
34189
|
-
|
|
34190
|
-
}
|
|
34191
|
-
ZodEffects.createWithPreprocess = (preprocess2, schema, params) => {
|
|
34192
|
-
return new ZodEffects({
|
|
34193
|
-
schema,
|
|
34194
|
-
effect: { type: "preprocess", transform: preprocess2 },
|
|
34195
|
-
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
34196
|
-
...processCreateParams(params)
|
|
34197
|
-
});
|
|
34198
|
-
};
|
|
34199
|
-
var ZodOptional = class extends ZodType {
|
|
34200
|
-
_parse(input) {
|
|
34201
|
-
const parsedType2 = this._getType(input);
|
|
34202
|
-
if (parsedType2 === ZodParsedType.undefined) {
|
|
34203
|
-
return OK(void 0);
|
|
34299
|
+
},
|
|
34300
|
+
area: categoriesSeriesSchema(),
|
|
34301
|
+
line: categoriesSeriesSchema(),
|
|
34302
|
+
bar: categoriesSeriesSchema(),
|
|
34303
|
+
donut: {
|
|
34304
|
+
type: "object",
|
|
34305
|
+
required: ["labels", "series"],
|
|
34306
|
+
additionalProperties: false,
|
|
34307
|
+
properties: {
|
|
34308
|
+
labels: { type: "array", items: { type: "string" } },
|
|
34309
|
+
series: { type: "array", items: { type: "number" } }
|
|
34204
34310
|
}
|
|
34205
|
-
|
|
34311
|
+
},
|
|
34312
|
+
table: tableSchema()
|
|
34313
|
+
};
|
|
34314
|
+
|
|
34315
|
+
// ../core/dist/dashboards/y-axis-hints.js
|
|
34316
|
+
var Y_AXIS_WIDGET_KINDS = ["area", "line", "bar"];
|
|
34317
|
+
var Y_AXIS_MAX_TICKS = 21;
|
|
34318
|
+
|
|
34319
|
+
// src/dashboard-widget-def-schema.ts
|
|
34320
|
+
var WidgetDefSchema = external_exports.object({
|
|
34321
|
+
id: external_exports.string().describe("Stable id within the dashboard, e.g. 'kpi.revenue' or 'chart.cashflow'."),
|
|
34322
|
+
kind: external_exports.enum(DASHBOARD_WIDGET_KINDS).describe(
|
|
34323
|
+
`Widget kind. The kind picks both the renderer AND the data shape your refresh must produce:
|
|
34324
|
+
kpi \u2192 { value, [delta], [deltaTone: positive|negative|neutral], [values: number[]], [color: '#rrggbb'], [label] }
|
|
34325
|
+
area \u2192 { categories: string[], series: [{ name, data: number[] }] }
|
|
34326
|
+
line \u2192 { categories: string[], series: [{ name, data: number[] }] }
|
|
34327
|
+
bar \u2192 { categories: string[], series: [{ name, data: number[] }] }
|
|
34328
|
+
donut \u2192 { labels: string[], series: number[] }
|
|
34329
|
+
table \u2192 { [rowHeader], columns: string[], rows: [{ label, [sub], cells: [{ [value], [sub], [state] }] }], [legend: [{ state, label }]] }
|
|
34330
|
+
Exactly one cell per column in every row. state (${TABLE_CELL_STATES.join("|")}) colours the cell. For a grid coloured by category (e.g. work type), map each category to a state and name it in legend.`
|
|
34331
|
+
),
|
|
34332
|
+
title: external_exports.string().optional().describe("Title shown above the widget."),
|
|
34333
|
+
prompt: external_exports.string().describe("What future-you reads on every refresh. Tight, specific \u2014 e.g. 'Total Xero revenue last 30 days. value as $N,NNN AUD (whole dollars \u2014 no cents on dashboards), delta vs prior 30d, values = daily revenue.'"),
|
|
34334
|
+
refresh_cron: external_exports.string().optional().describe('Optional per-widget cron override (e.g. "0 6 * * *" for 6am daily).'),
|
|
34335
|
+
// CS-1708: without this key z.object strips y_axis, and the hint never reaches the host.
|
|
34336
|
+
y_axis: external_exports.object({
|
|
34337
|
+
min: external_exports.number().optional(),
|
|
34338
|
+
max: external_exports.number().optional(),
|
|
34339
|
+
step: external_exports.number().optional(),
|
|
34340
|
+
integer: external_exports.boolean().optional()
|
|
34341
|
+
}).strict().optional().describe(
|
|
34342
|
+
`Optional, for ${Y_AXIS_WIDGET_KINDS.join(", ")} widgets: fix the y axis when the chart counts whole units or has a hard limit. e.g. { min: 0, max: 7, step: 1, integer: true } for days in a week. step must divide max - min (min defaults to 0), with at most ${Y_AXIS_MAX_TICKS} ticks. integer: true on its own gives whole-number ticks sized to the data. Refused on kpi, donut and table widgets.`
|
|
34343
|
+
)
|
|
34344
|
+
});
|
|
34345
|
+
|
|
34346
|
+
// src/kanban-get-error.ts
|
|
34347
|
+
function kanbanGetErrorMessage(status, id, fallbackMessage) {
|
|
34348
|
+
if (status === 400) return "A card id is required.";
|
|
34349
|
+
if (status === 404) return `No card with id "${id}" on your board.`;
|
|
34350
|
+
return `Could not read the card: ${fallbackMessage}`;
|
|
34351
|
+
}
|
|
34352
|
+
|
|
34353
|
+
// src/knowledge-body-render.ts
|
|
34354
|
+
function renderKnowledgeBody(content) {
|
|
34355
|
+
if (content === void 0 || content === null) {
|
|
34356
|
+
return "(!) CONTRACT FAILURE: the API returned no `content` field for this entry. This is NOT an empty entry \u2014 the body was not delivered. Do not treat this as the entry text, and do not knowledge_update from it: an update replaces the whole body and would erase the real one. Report this as a bug.";
|
|
34206
34357
|
}
|
|
34207
|
-
|
|
34208
|
-
return this
|
|
34358
|
+
if (content.length === 0) {
|
|
34359
|
+
return "(empty \u2014 this entry genuinely has no body text)";
|
|
34209
34360
|
}
|
|
34210
|
-
|
|
34211
|
-
|
|
34212
|
-
|
|
34213
|
-
|
|
34214
|
-
|
|
34215
|
-
|
|
34216
|
-
|
|
34217
|
-
|
|
34218
|
-
var
|
|
34219
|
-
|
|
34220
|
-
|
|
34221
|
-
|
|
34222
|
-
|
|
34361
|
+
return content;
|
|
34362
|
+
}
|
|
34363
|
+
|
|
34364
|
+
// src/index.ts
|
|
34365
|
+
import { homedir as homedir3 } from "os";
|
|
34366
|
+
import { basename, isAbsolute as isAbsolute2, join as join6, resolve as pathResolve, sep as sep2 } from "path";
|
|
34367
|
+
|
|
34368
|
+
// src/host-file-path.ts
|
|
34369
|
+
var SKILL_BODY_PATH_MAX_BYTES = 512 * 1024;
|
|
34370
|
+
var AGT_LIVE_CONTENT_PATH_MAX_BYTES = 2 * 1024 * 1024;
|
|
34371
|
+
var HOST_FILE_PATH_TOOLS = /* @__PURE__ */ new Map([
|
|
34372
|
+
[
|
|
34373
|
+
"skill_create",
|
|
34374
|
+
{ pathArg: "body_path", targetArg: "body", maxBytes: SKILL_BODY_PATH_MAX_BYTES, label: "a skill body" }
|
|
34375
|
+
],
|
|
34376
|
+
[
|
|
34377
|
+
"skill_update",
|
|
34378
|
+
{ pathArg: "body_path", targetArg: "body", maxBytes: SKILL_BODY_PATH_MAX_BYTES, label: "a skill body" }
|
|
34379
|
+
],
|
|
34380
|
+
[
|
|
34381
|
+
"agt_live_publish",
|
|
34382
|
+
{
|
|
34383
|
+
pathArg: "content_path",
|
|
34384
|
+
targetArg: "content",
|
|
34385
|
+
maxBytes: AGT_LIVE_CONTENT_PATH_MAX_BYTES,
|
|
34386
|
+
label: "a published page"
|
|
34223
34387
|
}
|
|
34224
|
-
|
|
34388
|
+
]
|
|
34389
|
+
]);
|
|
34390
|
+
function hostFilePathArg(toolName) {
|
|
34391
|
+
return HOST_FILE_PATH_TOOLS.get(toolName)?.pathArg;
|
|
34392
|
+
}
|
|
34393
|
+
function allowedHostFileRoots(agentDir, path) {
|
|
34394
|
+
return [path.join(agentDir, "project"), path.join(agentDir, "scratch")];
|
|
34395
|
+
}
|
|
34396
|
+
function openContained(target, roots, opts) {
|
|
34397
|
+
const { path, fs, procFdBase } = opts;
|
|
34398
|
+
if (!procFdBase) {
|
|
34399
|
+
return {
|
|
34400
|
+
ok: false,
|
|
34401
|
+
error: "reading a host path needs descriptor-relative traversal (procfs), which this platform does not provide. Pass the content inline instead."
|
|
34402
|
+
};
|
|
34225
34403
|
}
|
|
34226
|
-
|
|
34227
|
-
|
|
34404
|
+
const root = roots.find((r) => isContained(target, r, path.sep));
|
|
34405
|
+
if (!root) return { ok: false, error: "resolved outside the allowed roots" };
|
|
34406
|
+
const segments = target.slice(root.length).split(path.sep).filter(Boolean);
|
|
34407
|
+
const fileName = segments[segments.length - 1];
|
|
34408
|
+
if (fileName === void 0) {
|
|
34409
|
+
return { ok: false, error: `'${target}' is a directory, not a file` };
|
|
34228
34410
|
}
|
|
34229
|
-
|
|
34230
|
-
|
|
34231
|
-
|
|
34232
|
-
innerType: type,
|
|
34233
|
-
typeName: ZodFirstPartyTypeKind.ZodNullable,
|
|
34234
|
-
...processCreateParams(params)
|
|
34235
|
-
});
|
|
34236
|
-
};
|
|
34237
|
-
var ZodDefault = class extends ZodType {
|
|
34238
|
-
_parse(input) {
|
|
34239
|
-
const { ctx } = this._processInputParams(input);
|
|
34240
|
-
let data = ctx.data;
|
|
34241
|
-
if (ctx.parsedType === ZodParsedType.undefined) {
|
|
34242
|
-
data = this._def.defaultValue();
|
|
34411
|
+
for (const segment of segments) {
|
|
34412
|
+
if (segment === "." || segment === "..") {
|
|
34413
|
+
return { ok: false, error: `'${target}' contains a '${segment}' component` };
|
|
34243
34414
|
}
|
|
34244
|
-
return this._def.innerType._parse({
|
|
34245
|
-
data,
|
|
34246
|
-
path: ctx.path,
|
|
34247
|
-
parent: ctx
|
|
34248
|
-
});
|
|
34249
34415
|
}
|
|
34250
|
-
|
|
34251
|
-
|
|
34416
|
+
const dirNames = segments.slice(0, -1);
|
|
34417
|
+
let dirFd;
|
|
34418
|
+
try {
|
|
34419
|
+
dirFd = fs.openSync(root, opts.dirOpenFlags);
|
|
34420
|
+
} catch (err) {
|
|
34421
|
+
return { ok: false, error: `the allowed root '${root}' could not be opened \u2014 ${err.message}` };
|
|
34252
34422
|
}
|
|
34253
|
-
|
|
34254
|
-
|
|
34255
|
-
|
|
34256
|
-
|
|
34257
|
-
|
|
34258
|
-
|
|
34259
|
-
...processCreateParams(params)
|
|
34260
|
-
});
|
|
34261
|
-
};
|
|
34262
|
-
var ZodCatch = class extends ZodType {
|
|
34263
|
-
_parse(input) {
|
|
34264
|
-
const { ctx } = this._processInputParams(input);
|
|
34265
|
-
const newCtx = {
|
|
34266
|
-
...ctx,
|
|
34267
|
-
common: {
|
|
34268
|
-
...ctx.common,
|
|
34269
|
-
issues: []
|
|
34270
|
-
}
|
|
34271
|
-
};
|
|
34272
|
-
const result = this._def.innerType._parse({
|
|
34273
|
-
data: newCtx.data,
|
|
34274
|
-
path: newCtx.path,
|
|
34275
|
-
parent: {
|
|
34276
|
-
...newCtx
|
|
34277
|
-
}
|
|
34278
|
-
});
|
|
34279
|
-
if (isAsync(result)) {
|
|
34280
|
-
return result.then((result2) => {
|
|
34423
|
+
try {
|
|
34424
|
+
for (const name of dirNames) {
|
|
34425
|
+
let nextFd;
|
|
34426
|
+
try {
|
|
34427
|
+
nextFd = fs.openSync(path.join(procFdBase, String(dirFd), name), opts.dirOpenFlags);
|
|
34428
|
+
} catch (err) {
|
|
34281
34429
|
return {
|
|
34282
|
-
|
|
34283
|
-
|
|
34284
|
-
get error() {
|
|
34285
|
-
return new ZodError(newCtx.common.issues);
|
|
34286
|
-
},
|
|
34287
|
-
input: newCtx.data
|
|
34288
|
-
})
|
|
34430
|
+
ok: false,
|
|
34431
|
+
error: `'${name}' could not be entered \u2014 it is a symlink, is not a directory, or was replaced mid-traversal (${err.message})`
|
|
34289
34432
|
};
|
|
34290
|
-
}
|
|
34291
|
-
|
|
34433
|
+
}
|
|
34434
|
+
try {
|
|
34435
|
+
fs.closeSync(dirFd);
|
|
34436
|
+
} catch {
|
|
34437
|
+
}
|
|
34438
|
+
dirFd = nextFd;
|
|
34439
|
+
}
|
|
34440
|
+
let fd;
|
|
34441
|
+
try {
|
|
34442
|
+
fd = fs.openSync(path.join(procFdBase, String(dirFd), fileName), opts.openFlags);
|
|
34443
|
+
} catch (err) {
|
|
34292
34444
|
return {
|
|
34293
|
-
|
|
34294
|
-
|
|
34295
|
-
get error() {
|
|
34296
|
-
return new ZodError(newCtx.common.issues);
|
|
34297
|
-
},
|
|
34298
|
-
input: newCtx.data
|
|
34299
|
-
})
|
|
34445
|
+
ok: false,
|
|
34446
|
+
error: `'${fileName}' could not be opened (a symlink, or replaced mid-check) \u2014 ${err.message}`
|
|
34300
34447
|
};
|
|
34301
34448
|
}
|
|
34449
|
+
return { ok: true, fd };
|
|
34450
|
+
} finally {
|
|
34451
|
+
try {
|
|
34452
|
+
fs.closeSync(dirFd);
|
|
34453
|
+
} catch {
|
|
34454
|
+
}
|
|
34302
34455
|
}
|
|
34303
|
-
|
|
34304
|
-
|
|
34456
|
+
}
|
|
34457
|
+
function isContained(candidate, root, sep3) {
|
|
34458
|
+
if (candidate === root) return true;
|
|
34459
|
+
const rootWithSep = root.endsWith(sep3) ? root : root + sep3;
|
|
34460
|
+
return candidate.startsWith(rootWithSep);
|
|
34461
|
+
}
|
|
34462
|
+
function resolveHostFilePath(toolName, args, opts) {
|
|
34463
|
+
const spec = HOST_FILE_PATH_TOOLS.get(toolName);
|
|
34464
|
+
if (!spec) return { ok: true, args };
|
|
34465
|
+
const raw = args[spec.pathArg];
|
|
34466
|
+
if (raw === void 0 || raw === null) return { ok: true, args };
|
|
34467
|
+
if (typeof raw !== "string" || raw.trim() === "") {
|
|
34468
|
+
return { ok: false, error: `${spec.pathArg} must be a non-empty string.` };
|
|
34305
34469
|
}
|
|
34306
|
-
|
|
34307
|
-
|
|
34308
|
-
|
|
34309
|
-
|
|
34310
|
-
|
|
34311
|
-
catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
|
|
34312
|
-
...processCreateParams(params)
|
|
34313
|
-
});
|
|
34314
|
-
};
|
|
34315
|
-
var ZodNaN = class extends ZodType {
|
|
34316
|
-
_parse(input) {
|
|
34317
|
-
const parsedType2 = this._getType(input);
|
|
34318
|
-
if (parsedType2 !== ZodParsedType.nan) {
|
|
34319
|
-
const ctx = this._getOrReturnCtx(input);
|
|
34320
|
-
addIssueToContext(ctx, {
|
|
34321
|
-
code: ZodIssueCode.invalid_type,
|
|
34322
|
-
expected: ZodParsedType.nan,
|
|
34323
|
-
received: ctx.parsedType
|
|
34324
|
-
});
|
|
34325
|
-
return INVALID;
|
|
34326
|
-
}
|
|
34327
|
-
return { status: "valid", value: input.data };
|
|
34470
|
+
if (typeof args[spec.targetArg] === "string") {
|
|
34471
|
+
return {
|
|
34472
|
+
ok: false,
|
|
34473
|
+
error: `Pass either ${spec.targetArg} or ${spec.pathArg}, not both \u2014 they are two ways to say the same thing and I will not guess which one you meant.`
|
|
34474
|
+
};
|
|
34328
34475
|
}
|
|
34329
|
-
};
|
|
34330
|
-
|
|
34331
|
-
|
|
34332
|
-
|
|
34333
|
-
|
|
34334
|
-
|
|
34335
|
-
|
|
34336
|
-
|
|
34337
|
-
|
|
34338
|
-
_parse(input) {
|
|
34339
|
-
const { ctx } = this._processInputParams(input);
|
|
34340
|
-
const data = ctx.data;
|
|
34341
|
-
return this._def.type._parse({
|
|
34342
|
-
data,
|
|
34343
|
-
path: ctx.path,
|
|
34344
|
-
parent: ctx
|
|
34345
|
-
});
|
|
34476
|
+
const { agentDir, path, fs } = opts;
|
|
34477
|
+
const maxBytes = opts.maxBytes ?? spec.maxBytes;
|
|
34478
|
+
const roots = allowedHostFileRoots(agentDir, path);
|
|
34479
|
+
const absolute = path.isAbsolute(raw) ? path.resolve(raw) : path.resolve(path.join(agentDir, "project"), raw);
|
|
34480
|
+
if (!roots.some((r) => isContained(absolute, r, path.sep))) {
|
|
34481
|
+
return {
|
|
34482
|
+
ok: false,
|
|
34483
|
+
error: `${spec.pathArg} must be inside your own project or scratch directory. Got '${raw}'. Allowed: ${roots.join(", ")}`
|
|
34484
|
+
};
|
|
34346
34485
|
}
|
|
34347
|
-
|
|
34348
|
-
|
|
34486
|
+
let real;
|
|
34487
|
+
try {
|
|
34488
|
+
real = fs.realpathSync(absolute);
|
|
34489
|
+
} catch {
|
|
34490
|
+
return { ok: false, error: `${spec.pathArg} does not exist or is unreadable: '${raw}'` };
|
|
34349
34491
|
}
|
|
34350
|
-
|
|
34351
|
-
|
|
34352
|
-
|
|
34353
|
-
|
|
34354
|
-
|
|
34355
|
-
|
|
34356
|
-
|
|
34357
|
-
|
|
34358
|
-
|
|
34359
|
-
|
|
34360
|
-
|
|
34361
|
-
|
|
34362
|
-
|
|
34363
|
-
|
|
34364
|
-
|
|
34365
|
-
|
|
34366
|
-
|
|
34367
|
-
|
|
34368
|
-
|
|
34369
|
-
|
|
34370
|
-
|
|
34371
|
-
|
|
34372
|
-
}
|
|
34373
|
-
};
|
|
34374
|
-
|
|
34375
|
-
|
|
34376
|
-
|
|
34377
|
-
|
|
34378
|
-
|
|
34379
|
-
|
|
34380
|
-
|
|
34381
|
-
|
|
34382
|
-
|
|
34383
|
-
|
|
34384
|
-
|
|
34385
|
-
|
|
34386
|
-
|
|
34387
|
-
|
|
34388
|
-
|
|
34389
|
-
|
|
34390
|
-
|
|
34391
|
-
|
|
34392
|
-
path: ctx.path,
|
|
34393
|
-
parent: ctx
|
|
34394
|
-
});
|
|
34395
|
-
}
|
|
34492
|
+
if (!roots.some((r) => isContained(real, r, path.sep))) {
|
|
34493
|
+
return {
|
|
34494
|
+
ok: false,
|
|
34495
|
+
error: `${spec.pathArg} resolves outside your own directories (symlink?). '${raw}' \u2192 '${real}'. Allowed: ${roots.join(", ")}`
|
|
34496
|
+
};
|
|
34497
|
+
}
|
|
34498
|
+
const opened = openContained(real, roots, opts);
|
|
34499
|
+
if (!opened.ok) return { ok: false, error: `${spec.pathArg}: ${opened.error} ('${raw}')` };
|
|
34500
|
+
const fd = opened.fd;
|
|
34501
|
+
try {
|
|
34502
|
+
let stat;
|
|
34503
|
+
try {
|
|
34504
|
+
stat = fs.fstatSync(fd);
|
|
34505
|
+
} catch {
|
|
34506
|
+
return { ok: false, error: `${spec.pathArg} could not be inspected: '${raw}'` };
|
|
34507
|
+
}
|
|
34508
|
+
if (!stat.isFile()) {
|
|
34509
|
+
return { ok: false, error: `${spec.pathArg} is not a regular file: '${raw}'` };
|
|
34510
|
+
}
|
|
34511
|
+
if (stat.size > maxBytes) {
|
|
34512
|
+
return {
|
|
34513
|
+
ok: false,
|
|
34514
|
+
error: `${spec.pathArg} is ${stat.size} bytes, over the ${maxBytes}-byte limit for ${spec.label}.`
|
|
34515
|
+
};
|
|
34516
|
+
}
|
|
34517
|
+
let bytes;
|
|
34518
|
+
try {
|
|
34519
|
+
bytes = fs.readFdSync(fd, maxBytes);
|
|
34520
|
+
} catch (err) {
|
|
34521
|
+
return { ok: false, error: `${spec.pathArg} could not be read: ${err.message}` };
|
|
34522
|
+
}
|
|
34523
|
+
if (bytes.byteLength > maxBytes) {
|
|
34524
|
+
return { ok: false, error: `${spec.pathArg} grew past the ${maxBytes}-byte limit while being read.` };
|
|
34525
|
+
}
|
|
34526
|
+
const value = fs.decodeUtf8(bytes);
|
|
34527
|
+
const next = { ...args, [spec.targetArg]: value };
|
|
34528
|
+
delete next[spec.pathArg];
|
|
34529
|
+
return { ok: true, args: next };
|
|
34530
|
+
} finally {
|
|
34531
|
+
try {
|
|
34532
|
+
fs.closeSync(fd);
|
|
34533
|
+
} catch {
|
|
34396
34534
|
}
|
|
34397
34535
|
}
|
|
34398
|
-
|
|
34399
|
-
|
|
34400
|
-
|
|
34401
|
-
|
|
34402
|
-
|
|
34403
|
-
|
|
34536
|
+
}
|
|
34537
|
+
|
|
34538
|
+
// src/artefact-work-dir.ts
|
|
34539
|
+
import { mkdir, mkdtemp } from "fs/promises";
|
|
34540
|
+
import { existsSync } from "fs";
|
|
34541
|
+
import { dirname, join as join2 } from "path";
|
|
34542
|
+
|
|
34543
|
+
// ../core/dist/provisioning/frameworks/claudecode/agent-dir-alias.js
|
|
34544
|
+
import { isAbsolute, join, relative, sep } from "path";
|
|
34545
|
+
var VALID_CODE_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
34546
|
+
var VALID_AGENT_ID = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
34547
|
+
var INITIATOR_BASENAME = ".current-turn-initiator.json";
|
|
34548
|
+
function isSafeAgentSegment(segment) {
|
|
34549
|
+
return VALID_CODE_NAME.test(segment) || VALID_AGENT_ID.test(segment);
|
|
34550
|
+
}
|
|
34551
|
+
function initiatorDirSegment(initiatorFile, homeDir) {
|
|
34552
|
+
const rel = relative(join(homeDir, ".augmented"), initiatorFile);
|
|
34553
|
+
if (!rel || isAbsolute(rel))
|
|
34554
|
+
return null;
|
|
34555
|
+
const parts = rel.split(sep);
|
|
34556
|
+
if (parts.length !== 2 || parts[1] !== INITIATOR_BASENAME)
|
|
34557
|
+
return null;
|
|
34558
|
+
const segment = parts[0];
|
|
34559
|
+
if (segment === void 0)
|
|
34560
|
+
return null;
|
|
34561
|
+
return isSafeAgentSegment(segment) ? segment : null;
|
|
34562
|
+
}
|
|
34563
|
+
function resolveAgentDirAlias(input) {
|
|
34564
|
+
const { codeName, turnInitiatorFile, agentId, homeDir } = input;
|
|
34565
|
+
const codeNameTrimmed = typeof codeName === "string" ? codeName.trim() : "";
|
|
34566
|
+
if (codeNameTrimmed && VALID_CODE_NAME.test(codeNameTrimmed)) {
|
|
34567
|
+
return join(homeDir, ".augmented", codeNameTrimmed);
|
|
34404
34568
|
}
|
|
34405
|
-
|
|
34406
|
-
|
|
34407
|
-
|
|
34408
|
-
|
|
34409
|
-
|
|
34410
|
-
if (isValid(data)) {
|
|
34411
|
-
data.value = Object.freeze(data.value);
|
|
34412
|
-
}
|
|
34413
|
-
return data;
|
|
34414
|
-
};
|
|
34415
|
-
return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
|
|
34569
|
+
const initiator = typeof turnInitiatorFile === "string" ? turnInitiatorFile.trim() : "";
|
|
34570
|
+
if (initiator) {
|
|
34571
|
+
const segment = initiatorDirSegment(initiator, homeDir);
|
|
34572
|
+
if (segment)
|
|
34573
|
+
return join(homeDir, ".augmented", segment);
|
|
34416
34574
|
}
|
|
34417
|
-
|
|
34418
|
-
|
|
34575
|
+
const agentIdTrimmed = typeof agentId === "string" ? agentId.trim() : "";
|
|
34576
|
+
if (agentIdTrimmed && VALID_AGENT_ID.test(agentIdTrimmed)) {
|
|
34577
|
+
return join(homeDir, ".augmented", agentIdTrimmed);
|
|
34419
34578
|
}
|
|
34420
|
-
|
|
34421
|
-
ZodReadonly.create = (type, params) => {
|
|
34422
|
-
return new ZodReadonly({
|
|
34423
|
-
innerType: type,
|
|
34424
|
-
typeName: ZodFirstPartyTypeKind.ZodReadonly,
|
|
34425
|
-
...processCreateParams(params)
|
|
34426
|
-
});
|
|
34427
|
-
};
|
|
34428
|
-
function cleanParams(params, data) {
|
|
34429
|
-
const p2 = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
34430
|
-
const p22 = typeof p2 === "string" ? { message: p2 } : p2;
|
|
34431
|
-
return p22;
|
|
34579
|
+
return null;
|
|
34432
34580
|
}
|
|
34433
|
-
function
|
|
34434
|
-
|
|
34435
|
-
|
|
34436
|
-
|
|
34437
|
-
|
|
34438
|
-
|
|
34439
|
-
|
|
34440
|
-
|
|
34441
|
-
|
|
34442
|
-
|
|
34443
|
-
|
|
34444
|
-
|
|
34445
|
-
|
|
34446
|
-
|
|
34447
|
-
|
|
34448
|
-
|
|
34449
|
-
|
|
34450
|
-
|
|
34451
|
-
|
|
34452
|
-
|
|
34453
|
-
return
|
|
34581
|
+
function resolveAgentScratchDir(input) {
|
|
34582
|
+
const alias = resolveAgentDirAlias(input);
|
|
34583
|
+
return alias === null ? null : join(alias, "scratch");
|
|
34584
|
+
}
|
|
34585
|
+
|
|
34586
|
+
// src/artefact-work-dir.ts
|
|
34587
|
+
async function makeArtefactWorkDir(prefix, env2) {
|
|
34588
|
+
const scratch = resolveAgentScratchDir(env2);
|
|
34589
|
+
if (scratch === null) {
|
|
34590
|
+
throw new Error(
|
|
34591
|
+
"Cannot save the artefact: none of AGT_AGENT_CODE_NAME, AGT_TURN_INITIATOR_FILE or AGT_AGENT_ID is set, so this server cannot tell which agent directory the file belongs in."
|
|
34592
|
+
);
|
|
34593
|
+
}
|
|
34594
|
+
const agentDir = dirname(scratch);
|
|
34595
|
+
if (!existsSync(agentDir)) {
|
|
34596
|
+
throw new Error(
|
|
34597
|
+
`Cannot save the artefact: the agent directory ${agentDir} does not exist on this host.`
|
|
34598
|
+
);
|
|
34599
|
+
}
|
|
34600
|
+
await mkdir(scratch, { recursive: true });
|
|
34601
|
+
return mkdtemp(join2(scratch, prefix));
|
|
34454
34602
|
}
|
|
34455
|
-
var late = {
|
|
34456
|
-
object: ZodObject.lazycreate
|
|
34457
|
-
};
|
|
34458
|
-
var ZodFirstPartyTypeKind;
|
|
34459
|
-
(function(ZodFirstPartyTypeKind2) {
|
|
34460
|
-
ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
|
|
34461
|
-
ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber";
|
|
34462
|
-
ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN";
|
|
34463
|
-
ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";
|
|
34464
|
-
ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";
|
|
34465
|
-
ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";
|
|
34466
|
-
ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";
|
|
34467
|
-
ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";
|
|
34468
|
-
ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";
|
|
34469
|
-
ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";
|
|
34470
|
-
ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown";
|
|
34471
|
-
ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever";
|
|
34472
|
-
ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid";
|
|
34473
|
-
ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray";
|
|
34474
|
-
ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
|
|
34475
|
-
ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
|
|
34476
|
-
ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
|
|
34477
|
-
ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
|
|
34478
|
-
ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
|
|
34479
|
-
ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
|
|
34480
|
-
ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
|
|
34481
|
-
ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
|
|
34482
|
-
ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
|
|
34483
|
-
ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
|
|
34484
|
-
ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
|
|
34485
|
-
ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
|
|
34486
|
-
ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
|
|
34487
|
-
ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
|
|
34488
|
-
ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
|
|
34489
|
-
ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
|
|
34490
|
-
ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
|
|
34491
|
-
ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
|
|
34492
|
-
ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
|
|
34493
|
-
ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
|
|
34494
|
-
ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
|
|
34495
|
-
ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
|
|
34496
|
-
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
34497
|
-
var instanceOfType = (cls, params = {
|
|
34498
|
-
message: `Input not instance of ${cls.name}`
|
|
34499
|
-
}) => custom((data) => data instanceof cls, params);
|
|
34500
|
-
var stringType = ZodString.create;
|
|
34501
|
-
var numberType = ZodNumber.create;
|
|
34502
|
-
var nanType = ZodNaN.create;
|
|
34503
|
-
var bigIntType = ZodBigInt.create;
|
|
34504
|
-
var booleanType = ZodBoolean.create;
|
|
34505
|
-
var dateType = ZodDate.create;
|
|
34506
|
-
var symbolType = ZodSymbol.create;
|
|
34507
|
-
var undefinedType = ZodUndefined.create;
|
|
34508
|
-
var nullType = ZodNull.create;
|
|
34509
|
-
var anyType = ZodAny.create;
|
|
34510
|
-
var unknownType = ZodUnknown.create;
|
|
34511
|
-
var neverType = ZodNever.create;
|
|
34512
|
-
var voidType = ZodVoid.create;
|
|
34513
|
-
var arrayType = ZodArray.create;
|
|
34514
|
-
var objectType = ZodObject.create;
|
|
34515
|
-
var strictObjectType = ZodObject.strictCreate;
|
|
34516
|
-
var unionType = ZodUnion.create;
|
|
34517
|
-
var discriminatedUnionType = ZodDiscriminatedUnion.create;
|
|
34518
|
-
var intersectionType = ZodIntersection.create;
|
|
34519
|
-
var tupleType = ZodTuple.create;
|
|
34520
|
-
var recordType = ZodRecord.create;
|
|
34521
|
-
var mapType = ZodMap.create;
|
|
34522
|
-
var setType = ZodSet.create;
|
|
34523
|
-
var functionType = ZodFunction.create;
|
|
34524
|
-
var lazyType = ZodLazy.create;
|
|
34525
|
-
var literalType = ZodLiteral.create;
|
|
34526
|
-
var enumType = ZodEnum.create;
|
|
34527
|
-
var nativeEnumType = ZodNativeEnum.create;
|
|
34528
|
-
var promiseType = ZodPromise.create;
|
|
34529
|
-
var effectsType = ZodEffects.create;
|
|
34530
|
-
var optionalType = ZodOptional.create;
|
|
34531
|
-
var nullableType = ZodNullable.create;
|
|
34532
|
-
var preprocessType = ZodEffects.createWithPreprocess;
|
|
34533
|
-
var pipelineType = ZodPipeline.create;
|
|
34534
|
-
var ostring = () => stringType().optional();
|
|
34535
|
-
var onumber = () => numberType().optional();
|
|
34536
|
-
var oboolean = () => booleanType().optional();
|
|
34537
|
-
var coerce = {
|
|
34538
|
-
string: ((arg) => ZodString.create({ ...arg, coerce: true })),
|
|
34539
|
-
number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),
|
|
34540
|
-
boolean: ((arg) => ZodBoolean.create({
|
|
34541
|
-
...arg,
|
|
34542
|
-
coerce: true
|
|
34543
|
-
})),
|
|
34544
|
-
bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
|
|
34545
|
-
date: ((arg) => ZodDate.create({ ...arg, coerce: true }))
|
|
34546
|
-
};
|
|
34547
|
-
var NEVER = INVALID;
|
|
34548
34603
|
|
|
34549
34604
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/core.js
|
|
34550
34605
|
var NEVER2 = Object.freeze({
|
|
@@ -48807,22 +48862,6 @@ server.tool(
|
|
|
48807
48862
|
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
48808
48863
|
}
|
|
48809
48864
|
);
|
|
48810
|
-
var WidgetDefSchema = external_exports.object({
|
|
48811
|
-
id: external_exports.string().describe("Stable id within the dashboard, e.g. 'kpi.revenue' or 'chart.cashflow'."),
|
|
48812
|
-
kind: external_exports.enum(DASHBOARD_WIDGET_KINDS).describe(
|
|
48813
|
-
`Widget kind. The kind picks both the renderer AND the data shape your refresh must produce:
|
|
48814
|
-
kpi \u2192 { value, [delta], [deltaTone: positive|negative|neutral], [values: number[]], [color: '#rrggbb'], [label] }
|
|
48815
|
-
area \u2192 { categories: string[], series: [{ name, data: number[] }] }
|
|
48816
|
-
line \u2192 { categories: string[], series: [{ name, data: number[] }] }
|
|
48817
|
-
bar \u2192 { categories: string[], series: [{ name, data: number[] }] }
|
|
48818
|
-
donut \u2192 { labels: string[], series: number[] }
|
|
48819
|
-
table \u2192 { [rowHeader], columns: string[], rows: [{ label, [sub], cells: [{ [value], [sub], [state] }] }], [legend: [{ state, label }]] }
|
|
48820
|
-
Exactly one cell per column in every row. state (${TABLE_CELL_STATES.join("|")}) colours the cell. For a grid coloured by category (e.g. work type), map each category to a state and name it in legend.`
|
|
48821
|
-
),
|
|
48822
|
-
title: external_exports.string().optional().describe("Title shown above the widget."),
|
|
48823
|
-
prompt: external_exports.string().describe("What future-you reads on every refresh. Tight, specific \u2014 e.g. 'Total Xero revenue last 30 days. value as $N,NNN AUD (whole dollars \u2014 no cents on dashboards), delta vs prior 30d, values = daily revenue.'"),
|
|
48824
|
-
refresh_cron: external_exports.string().optional().describe('Optional per-widget cron override (e.g. "0 6 * * *" for 6am daily).')
|
|
48825
|
-
});
|
|
48826
48865
|
server.tool(
|
|
48827
48866
|
"dashboards_list",
|
|
48828
48867
|
'List dashboards visible to your team. Use to answer "what dashboards exist", "show me the dashboards I built", or before authoring a new one to avoid duplicating an existing slug.',
|