@fungi.computer/oyster 0.28.2 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14920,16 +14920,6 @@ var Json2 = /* @__PURE__ */ make5(/* @__PURE__ */ annotate(Json, {
14920
14920
  }));
14921
14921
  var JsonObject = /* @__PURE__ */ Record(String4, Json2);
14922
14922
 
14923
- // ../puffball/dist/internal/background-sync.js
14924
- function backgroundSyncAllowed(api, sync3) {
14925
- if (sync3 === void 0)
14926
- return true;
14927
- const continuation = api?.methods[sync3.method];
14928
- if (continuation?.effect !== "write")
14929
- return false;
14930
- return Object.values(api?.methods ?? {}).every((method2) => method2.effect !== "write" || method2.requires.every((capability) => continuation.requires.includes(capability)));
14931
- }
14932
-
14933
14923
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
14934
14924
  var _a;
14935
14925
  var NEVER = /* @__PURE__ */ Object.freeze({
@@ -19101,1934 +19091,1934 @@ var lazyProcessor = (schema2, ctx, _json, params) => {
19101
19091
  seen.ref = innerType;
19102
19092
  };
19103
19093
 
19104
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/mini/schemas.js
19105
- var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
19106
- if (!inst._zod)
19107
- throw new Error("Uninitialized schema in ZodMiniType.");
19108
- $ZodType.init(inst, def);
19109
- inst.def = def;
19110
- inst.type = def.type;
19111
- inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
19112
- inst.safeParse = (data, params) => safeParse(inst, data, params);
19113
- inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
19114
- inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
19115
- inst.check = (...checks) => {
19116
- return inst.clone({
19117
- ...def,
19118
- checks: [
19119
- ...def.checks ?? [],
19120
- ...checks.map((ch) => typeof ch === "function" ? {
19121
- _zod: { check: ch, def: { check: "custom" }, onattach: [] }
19122
- } : ch)
19123
- ]
19124
- }, { parent: true });
19125
- };
19126
- inst.with = inst.check;
19127
- inst.clone = (_def, params) => clone(inst, _def, params);
19128
- inst.brand = () => inst;
19129
- inst.register = ((reg, meta2) => {
19130
- reg.add(inst, meta2);
19131
- return inst;
19132
- });
19133
- inst.apply = (fn2) => fn2(inst);
19134
- });
19135
- var ZodMiniString = /* @__PURE__ */ $constructor("ZodMiniString", (inst, def) => {
19136
- $ZodString.init(inst, def);
19137
- ZodMiniType.init(inst, def);
19138
- });
19139
- // @__NO_SIDE_EFFECTS__
19140
- function string4(params) {
19141
- return _string(ZodMiniString, params);
19142
- }
19143
- var ZodMiniNever = /* @__PURE__ */ $constructor("ZodMiniNever", (inst, def) => {
19144
- $ZodNever.init(inst, def);
19145
- ZodMiniType.init(inst, def);
19146
- });
19147
- // @__NO_SIDE_EFFECTS__
19148
- function never3(params) {
19149
- return _never(ZodMiniNever, params);
19150
- }
19151
- var ZodMiniObject = /* @__PURE__ */ $constructor("ZodMiniObject", (inst, def) => {
19152
- $ZodObject.init(inst, def);
19153
- ZodMiniType.init(inst, def);
19154
- defineLazy(inst, "shape", () => def.shape);
19094
+ // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.js
19095
+ var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
19096
+ $ZodISODateTime.init(inst, def);
19097
+ ZodStringFormat.init(inst, def);
19155
19098
  });
19156
- // @__NO_SIDE_EFFECTS__
19157
- function object(shape, params) {
19158
- const def = {
19159
- type: "object",
19160
- shape: shape ?? {},
19161
- ...normalizeParams(params)
19162
- };
19163
- return new ZodMiniObject(def);
19164
- }
19165
- // @__NO_SIDE_EFFECTS__
19166
- function strictObject(shape, params) {
19167
- return new ZodMiniObject({
19168
- type: "object",
19169
- shape,
19170
- catchall: /* @__PURE__ */ never3(),
19171
- ...normalizeParams(params)
19172
- });
19099
+ function datetime2(params) {
19100
+ return _isoDateTime(ZodISODateTime, params);
19173
19101
  }
19174
- var ZodMiniDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodMiniDiscriminatedUnion", (inst, def) => {
19175
- $ZodDiscriminatedUnion.init(inst, def);
19176
- ZodMiniType.init(inst, def);
19102
+ var ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
19103
+ $ZodISODate.init(inst, def);
19104
+ ZodStringFormat.init(inst, def);
19177
19105
  });
19178
- // @__NO_SIDE_EFFECTS__
19179
- function discriminatedUnion(discriminator, options, params) {
19180
- return new ZodMiniDiscriminatedUnion({
19181
- type: "union",
19182
- options,
19183
- discriminator,
19184
- ...normalizeParams(params)
19185
- });
19106
+ function date2(params) {
19107
+ return _isoDate(ZodISODate, params);
19186
19108
  }
19187
- var ZodMiniEnum = /* @__PURE__ */ $constructor("ZodMiniEnum", (inst, def) => {
19188
- $ZodEnum.init(inst, def);
19189
- ZodMiniType.init(inst, def);
19190
- inst.options = Object.values(def.entries);
19109
+ var ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
19110
+ $ZodISOTime.init(inst, def);
19111
+ ZodStringFormat.init(inst, def);
19191
19112
  });
19192
- // @__NO_SIDE_EFFECTS__
19193
- function _enum(values, params) {
19194
- const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
19195
- return new ZodMiniEnum({
19196
- type: "enum",
19197
- entries,
19198
- ...normalizeParams(params)
19199
- });
19113
+ function time2(params) {
19114
+ return _isoTime(ZodISOTime, params);
19200
19115
  }
19201
- var ZodMiniLiteral = /* @__PURE__ */ $constructor("ZodMiniLiteral", (inst, def) => {
19202
- $ZodLiteral.init(inst, def);
19203
- ZodMiniType.init(inst, def);
19116
+ var ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
19117
+ $ZodISODuration.init(inst, def);
19118
+ ZodStringFormat.init(inst, def);
19204
19119
  });
19205
- // @__NO_SIDE_EFFECTS__
19206
- function literal(value, params) {
19207
- return new ZodMiniLiteral({
19208
- type: "literal",
19209
- values: Array.isArray(value) ? value : [value],
19210
- ...normalizeParams(params)
19211
- });
19120
+ function duration2(params) {
19121
+ return _isoDuration(ZodISODuration, params);
19212
19122
  }
19213
- var ZodMiniOptional = /* @__PURE__ */ $constructor("ZodMiniOptional", (inst, def) => {
19214
- $ZodOptional.init(inst, def);
19215
- ZodMiniType.init(inst, def);
19216
- });
19217
- // @__NO_SIDE_EFFECTS__
19218
- function optional3(innerType) {
19219
- return new ZodMiniOptional({
19220
- type: "optional",
19221
- innerType
19123
+
19124
+ // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js
19125
+ var initializer2 = (inst, issues) => {
19126
+ $ZodError.init(inst, issues);
19127
+ inst.name = "ZodError";
19128
+ Object.defineProperties(inst, {
19129
+ format: {
19130
+ value: (mapper) => formatError(inst, mapper)
19131
+ // enumerable: false,
19132
+ },
19133
+ flatten: {
19134
+ value: (mapper) => flattenError(inst, mapper)
19135
+ // enumerable: false,
19136
+ },
19137
+ addIssue: {
19138
+ value: (issue2) => {
19139
+ inst.issues.push(issue2);
19140
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
19141
+ }
19142
+ // enumerable: false,
19143
+ },
19144
+ addIssues: {
19145
+ value: (issues2) => {
19146
+ inst.issues.push(...issues2);
19147
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
19148
+ }
19149
+ // enumerable: false,
19150
+ },
19151
+ isEmpty: {
19152
+ get() {
19153
+ return inst.issues.length === 0;
19154
+ }
19155
+ // enumerable: false,
19156
+ }
19222
19157
  });
19223
- }
19224
- var ZodMiniNullable = /* @__PURE__ */ $constructor("ZodMiniNullable", (inst, def) => {
19225
- $ZodNullable.init(inst, def);
19226
- ZodMiniType.init(inst, def);
19158
+ };
19159
+ var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, {
19160
+ Parent: Error
19227
19161
  });
19228
- // @__NO_SIDE_EFFECTS__
19229
- function nullable(innerType) {
19230
- return new ZodMiniNullable({
19231
- type: "nullable",
19232
- innerType
19233
- });
19162
+
19163
+ // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js
19164
+ var parse2 = /* @__PURE__ */ _parse(ZodRealError);
19165
+ var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
19166
+ var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
19167
+ var safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
19168
+ var encode2 = /* @__PURE__ */ _encode(ZodRealError);
19169
+ var decode2 = /* @__PURE__ */ _decode(ZodRealError);
19170
+ var encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
19171
+ var decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
19172
+ var safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
19173
+ var safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
19174
+ var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
19175
+ var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
19176
+
19177
+ // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.js
19178
+ var _installedGroups = /* @__PURE__ */ new WeakMap();
19179
+ function _installLazyMethods(inst, group, methods) {
19180
+ const proto = Object.getPrototypeOf(inst);
19181
+ let installed = _installedGroups.get(proto);
19182
+ if (!installed) {
19183
+ installed = /* @__PURE__ */ new Set();
19184
+ _installedGroups.set(proto, installed);
19185
+ }
19186
+ if (installed.has(group))
19187
+ return;
19188
+ installed.add(group);
19189
+ for (const key in methods) {
19190
+ const fn2 = methods[key];
19191
+ Object.defineProperty(proto, key, {
19192
+ configurable: true,
19193
+ enumerable: false,
19194
+ get() {
19195
+ const bound = fn2.bind(this);
19196
+ Object.defineProperty(this, key, {
19197
+ configurable: true,
19198
+ writable: true,
19199
+ enumerable: true,
19200
+ value: bound
19201
+ });
19202
+ return bound;
19203
+ },
19204
+ set(v) {
19205
+ Object.defineProperty(this, key, {
19206
+ configurable: true,
19207
+ writable: true,
19208
+ enumerable: true,
19209
+ value: v
19210
+ });
19211
+ }
19212
+ });
19213
+ }
19234
19214
  }
19235
- var ZodMiniLazy = /* @__PURE__ */ $constructor("ZodMiniLazy", (inst, def) => {
19236
- $ZodLazy.init(inst, def);
19237
- ZodMiniType.init(inst, def);
19238
- });
19239
- // @__NO_SIDE_EFFECTS__
19240
- function _lazy(getter) {
19241
- return new ZodMiniLazy({
19242
- type: "lazy",
19243
- getter
19215
+ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
19216
+ $ZodType.init(inst, def);
19217
+ Object.assign(inst["~standard"], {
19218
+ jsonSchema: {
19219
+ input: createStandardJSONSchemaMethod(inst, "input"),
19220
+ output: createStandardJSONSchemaMethod(inst, "output")
19221
+ }
19244
19222
  });
19245
- }
19246
- var ZodMiniCustom = /* @__PURE__ */ $constructor("ZodMiniCustom", (inst, def) => {
19247
- $ZodCustom.init(inst, def);
19248
- ZodMiniType.init(inst, def);
19249
- });
19250
- // @__NO_SIDE_EFFECTS__
19251
- function refine2(fn2, _params = {}) {
19252
- return _refine(ZodMiniCustom, fn2, _params);
19253
- }
19254
-
19255
- // ../puffball/dist/app-method-runtime.js
19256
- var appApiReservedMethodNames = Object.freeze({
19257
- intrinsic: [
19258
- "constructor",
19259
- "toString",
19260
- "valueOf",
19261
- "hasOwnProperty",
19262
- "isPrototypeOf",
19263
- "propertyIsEnumerable",
19264
- "toLocaleString"
19265
- ],
19266
- rpc: ["then", "dup", "connect", "id", "name"],
19267
- instance: ["ctx", "env"],
19268
- lifecycle: [
19269
- "gill",
19270
- "onGitPush",
19271
- "syncRefused",
19272
- "authorizeGitPush",
19273
- "fetch",
19274
- "alarm",
19275
- "queue",
19276
- "scheduled",
19277
- "tail",
19278
- "trace",
19279
- "email",
19280
- "test",
19281
- "tailStream",
19282
- "webSocketMessage",
19283
- "webSocketClose",
19284
- "webSocketError"
19285
- ]
19223
+ inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
19224
+ inst.def = def;
19225
+ inst.type = def.type;
19226
+ Object.defineProperty(inst, "_def", { value: def });
19227
+ inst.parse = (data, params) => parse2(inst, data, params, { callee: inst.parse });
19228
+ inst.safeParse = (data, params) => safeParse2(inst, data, params);
19229
+ inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
19230
+ inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);
19231
+ inst.spa = inst.safeParseAsync;
19232
+ inst.encode = (data, params) => encode2(inst, data, params);
19233
+ inst.decode = (data, params) => decode2(inst, data, params);
19234
+ inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
19235
+ inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
19236
+ inst.safeEncode = (data, params) => safeEncode(inst, data, params);
19237
+ inst.safeDecode = (data, params) => safeDecode(inst, data, params);
19238
+ inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
19239
+ inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
19240
+ _installLazyMethods(inst, "ZodType", {
19241
+ check(...chks) {
19242
+ const def2 = this.def;
19243
+ return this.clone(util_exports.mergeDefs(def2, {
19244
+ checks: [
19245
+ ...def2.checks ?? [],
19246
+ ...chks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
19247
+ ]
19248
+ }), { parent: true });
19249
+ },
19250
+ with(...chks) {
19251
+ return this.check(...chks);
19252
+ },
19253
+ clone(def2, params) {
19254
+ return clone(this, def2, params);
19255
+ },
19256
+ brand() {
19257
+ return this;
19258
+ },
19259
+ register(reg, meta2) {
19260
+ reg.add(this, meta2);
19261
+ return this;
19262
+ },
19263
+ refine(check2, params) {
19264
+ return this.check(refine2(check2, params));
19265
+ },
19266
+ superRefine(refinement, params) {
19267
+ return this.check(superRefine(refinement, params));
19268
+ },
19269
+ overwrite(fn2) {
19270
+ return this.check(_overwrite(fn2));
19271
+ },
19272
+ optional() {
19273
+ return optional3(this);
19274
+ },
19275
+ exactOptional() {
19276
+ return exactOptional(this);
19277
+ },
19278
+ nullable() {
19279
+ return nullable(this);
19280
+ },
19281
+ nullish() {
19282
+ return optional3(nullable(this));
19283
+ },
19284
+ nonoptional(params) {
19285
+ return nonoptional(this, params);
19286
+ },
19287
+ array() {
19288
+ return array2(this);
19289
+ },
19290
+ or(arg) {
19291
+ return union2([this, arg]);
19292
+ },
19293
+ and(arg) {
19294
+ return intersection(this, arg);
19295
+ },
19296
+ transform(tx) {
19297
+ return pipe(this, transform3(tx));
19298
+ },
19299
+ default(d) {
19300
+ return _default(this, d);
19301
+ },
19302
+ prefault(d) {
19303
+ return prefault(this, d);
19304
+ },
19305
+ catch(params) {
19306
+ return _catch(this, params);
19307
+ },
19308
+ pipe(target) {
19309
+ return pipe(this, target);
19310
+ },
19311
+ readonly() {
19312
+ return readonly(this);
19313
+ },
19314
+ describe(description) {
19315
+ const cl = this.clone();
19316
+ globalRegistry.add(cl, { description });
19317
+ return cl;
19318
+ },
19319
+ meta(...args2) {
19320
+ if (args2.length === 0)
19321
+ return globalRegistry.get(this);
19322
+ const cl = this.clone();
19323
+ globalRegistry.add(cl, args2[0]);
19324
+ return cl;
19325
+ },
19326
+ isOptional() {
19327
+ return this.safeParse(void 0).success;
19328
+ },
19329
+ isNullable() {
19330
+ return this.safeParse(null).success;
19331
+ },
19332
+ apply(fn2) {
19333
+ return fn2(this);
19334
+ }
19335
+ });
19336
+ Object.defineProperty(inst, "description", {
19337
+ get() {
19338
+ return globalRegistry.get(inst)?.description;
19339
+ },
19340
+ configurable: true
19341
+ });
19342
+ return inst;
19286
19343
  });
19287
- var identity2 = string4().check(_minLength(1), _maxLength(256));
19288
- var memberActor = object({ kind: literal("member"), memberId: identity2 });
19289
- var agentActor = object({ kind: literal("agent"), agentId: identity2 });
19290
- var keyActor = object({ kind: literal("team-key"), keyId: identity2 });
19291
- var hostActorSchema = discriminatedUnion("kind", [
19292
- memberActor,
19293
- agentActor,
19294
- keyActor
19295
- ]);
19296
- var workflowAttestationSchema = object({
19297
- /** Published Workflow selected by the run owner. */
19298
- workflowId: identity2,
19299
- /** Run identity held by the run owner. */
19300
- runId: identity2,
19301
- /** Node selected by the stored published Workflow. */
19302
- nodeId: identity2,
19303
- /** Actor that armed the run, re-admitted by the host at dispatch. */
19304
- armedBy: hostActorSchema
19344
+ var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
19345
+ $ZodString.init(inst, def);
19346
+ ZodType.init(inst, def);
19347
+ inst._zod.processJSONSchema = (ctx, json2, params) => stringProcessor(inst, ctx, json2, params);
19348
+ const bag = inst._zod.bag;
19349
+ inst.format = bag.format ?? null;
19350
+ inst.minLength = bag.minimum ?? null;
19351
+ inst.maxLength = bag.maximum ?? null;
19352
+ _installLazyMethods(inst, "_ZodString", {
19353
+ regex(...args2) {
19354
+ return this.check(_regex(...args2));
19355
+ },
19356
+ includes(...args2) {
19357
+ return this.check(_includes(...args2));
19358
+ },
19359
+ startsWith(...args2) {
19360
+ return this.check(_startsWith(...args2));
19361
+ },
19362
+ endsWith(...args2) {
19363
+ return this.check(_endsWith(...args2));
19364
+ },
19365
+ min(...args2) {
19366
+ return this.check(_minLength(...args2));
19367
+ },
19368
+ max(...args2) {
19369
+ return this.check(_maxLength(...args2));
19370
+ },
19371
+ length(...args2) {
19372
+ return this.check(_length(...args2));
19373
+ },
19374
+ nonempty(...args2) {
19375
+ return this.check(_minLength(1, ...args2));
19376
+ },
19377
+ lowercase(params) {
19378
+ return this.check(_lowercase(params));
19379
+ },
19380
+ uppercase(params) {
19381
+ return this.check(_uppercase(params));
19382
+ },
19383
+ trim() {
19384
+ return this.check(_trim());
19385
+ },
19386
+ normalize(...args2) {
19387
+ return this.check(_normalize(...args2));
19388
+ },
19389
+ toLowerCase() {
19390
+ return this.check(_toLowerCase());
19391
+ },
19392
+ toUpperCase() {
19393
+ return this.check(_toUpperCase());
19394
+ },
19395
+ slugify() {
19396
+ return this.check(_slugify());
19397
+ }
19398
+ });
19305
19399
  });
19306
- var backgroundOrigin = _lazy(() => strictObject({
19307
- method: string4().check(refine2((name) => isAppApiMethodName(name))),
19308
- seal: string4().check(_regex(/^[A-Za-z0-9_-]{43}$/u))
19309
- }));
19310
- var appMethodCallerSchema = object({
19311
- computerId: nullable(identity2),
19312
- actor: hostActorSchema,
19313
- /** Host-attested enqueue eligibility for this ordinary write; absent otherwise. */
19314
- backgroundLane: optional3(string4().check(_minLength(8), _maxLength(263))),
19315
- /** Host-sealed foreground method for durable jobs; paired with backgroundLane. */
19316
- backgroundOrigin: optional3(backgroundOrigin),
19317
- /** Team role attested by the host, never selected by App method input. */
19318
- role: optional3(_enum(["owner", "member"])),
19319
- /**
19320
- * The host attests that this member is currently the Team's only member.
19321
- * Present only on a member's own call; never on an Agent, Team key or
19322
- * Workflow node, and never selected by App method input.
19323
- */
19324
- soleMember: optional3(literal(true)),
19325
- /** Present only on a Workflow node invocation admitted by its host. */
19326
- workflow: optional3(workflowAttestationSchema),
19327
- /**
19328
- * The host's stable key for this logical call (for example one Workflow
19329
- * node), the same on every retry. A method with side effects uses it to do
19330
- * its work at most once. Absent when the caller supplies its own request id.
19331
- */
19332
- idempotencyKey: optional3(string4().check(_minLength(1), _maxLength(128)))
19400
+ var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
19401
+ $ZodString.init(inst, def);
19402
+ _ZodString.init(inst, def);
19403
+ inst.email = (params) => inst.check(_email(ZodEmail, params));
19404
+ inst.url = (params) => inst.check(_url(ZodURL, params));
19405
+ inst.jwt = (params) => inst.check(_jwt(ZodJWT, params));
19406
+ inst.emoji = (params) => inst.check(_emoji2(ZodEmoji, params));
19407
+ inst.guid = (params) => inst.check(_guid(ZodGUID, params));
19408
+ inst.uuid = (params) => inst.check(_uuid(ZodUUID, params));
19409
+ inst.uuidv4 = (params) => inst.check(_uuidv4(ZodUUID, params));
19410
+ inst.uuidv6 = (params) => inst.check(_uuidv6(ZodUUID, params));
19411
+ inst.uuidv7 = (params) => inst.check(_uuidv7(ZodUUID, params));
19412
+ inst.nanoid = (params) => inst.check(_nanoid(ZodNanoID, params));
19413
+ inst.guid = (params) => inst.check(_guid(ZodGUID, params));
19414
+ inst.cuid = (params) => inst.check(_cuid(ZodCUID, params));
19415
+ inst.cuid2 = (params) => inst.check(_cuid2(ZodCUID2, params));
19416
+ inst.ulid = (params) => inst.check(_ulid(ZodULID, params));
19417
+ inst.base64 = (params) => inst.check(_base64(ZodBase64, params));
19418
+ inst.base64url = (params) => inst.check(_base64url(ZodBase64URL, params));
19419
+ inst.xid = (params) => inst.check(_xid(ZodXID, params));
19420
+ inst.ksuid = (params) => inst.check(_ksuid(ZodKSUID, params));
19421
+ inst.ipv4 = (params) => inst.check(_ipv4(ZodIPv4, params));
19422
+ inst.ipv6 = (params) => inst.check(_ipv6(ZodIPv6, params));
19423
+ inst.cidrv4 = (params) => inst.check(_cidrv4(ZodCIDRv4, params));
19424
+ inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params));
19425
+ inst.e164 = (params) => inst.check(_e164(ZodE164, params));
19426
+ inst.datetime = (params) => inst.check(datetime2(params));
19427
+ inst.date = (params) => inst.check(date2(params));
19428
+ inst.time = (params) => inst.check(time2(params));
19429
+ inst.duration = (params) => inst.check(duration2(params));
19333
19430
  });
19334
- var strictActor = discriminatedUnion("kind", [
19335
- strictObject(memberActor.shape),
19336
- strictObject(agentActor.shape),
19337
- strictObject(keyActor.shape)
19338
- ]);
19339
- var strictCaller = strictObject({
19340
- ...appMethodCallerSchema.shape,
19341
- actor: strictActor,
19342
- workflow: optional3(strictObject({
19343
- ...workflowAttestationSchema.shape,
19344
- armedBy: strictActor
19345
- }))
19431
+ function string4(params) {
19432
+ return _string(ZodString, params);
19433
+ }
19434
+ var ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
19435
+ $ZodStringFormat.init(inst, def);
19436
+ _ZodString.init(inst, def);
19346
19437
  });
19347
- var parseAppMethodCallContext = (value, rejectUnknownKeys = false) => validateCaller((rejectUnknownKeys ? strictCaller : appMethodCallerSchema).parse(value));
19348
- function validateCaller(context3) {
19349
- if (context3.soleMember !== void 0 && (context3.actor.kind !== "member" || context3.workflow !== void 0))
19350
- throw new Error("Only a member's own call can be its Team's sole member");
19351
- if (context3.backgroundLane === void 0 !== (context3.backgroundOrigin === void 0))
19352
- throw new Error("Background lane and origin must be attested together");
19353
- if (context3.backgroundLane !== void 0 && (context3.actor.kind !== "member" || context3.workflow !== void 0 || context3.backgroundLane !== `member:${context3.actor.memberId}`))
19354
- throw new Error("Background lane must name an ordinary member");
19355
- return context3;
19438
+ var ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
19439
+ $ZodEmail.init(inst, def);
19440
+ ZodStringFormat.init(inst, def);
19441
+ });
19442
+ var ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
19443
+ $ZodGUID.init(inst, def);
19444
+ ZodStringFormat.init(inst, def);
19445
+ });
19446
+ var ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
19447
+ $ZodUUID.init(inst, def);
19448
+ ZodStringFormat.init(inst, def);
19449
+ });
19450
+ var ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
19451
+ $ZodURL.init(inst, def);
19452
+ ZodStringFormat.init(inst, def);
19453
+ });
19454
+ var ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
19455
+ $ZodEmoji.init(inst, def);
19456
+ ZodStringFormat.init(inst, def);
19457
+ });
19458
+ var ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
19459
+ $ZodNanoID.init(inst, def);
19460
+ ZodStringFormat.init(inst, def);
19461
+ });
19462
+ var ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
19463
+ $ZodCUID.init(inst, def);
19464
+ ZodStringFormat.init(inst, def);
19465
+ });
19466
+ var ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
19467
+ $ZodCUID2.init(inst, def);
19468
+ ZodStringFormat.init(inst, def);
19469
+ });
19470
+ var ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
19471
+ $ZodULID.init(inst, def);
19472
+ ZodStringFormat.init(inst, def);
19473
+ });
19474
+ var ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
19475
+ $ZodXID.init(inst, def);
19476
+ ZodStringFormat.init(inst, def);
19477
+ });
19478
+ var ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
19479
+ $ZodKSUID.init(inst, def);
19480
+ ZodStringFormat.init(inst, def);
19481
+ });
19482
+ var ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
19483
+ $ZodIPv4.init(inst, def);
19484
+ ZodStringFormat.init(inst, def);
19485
+ });
19486
+ var ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
19487
+ $ZodIPv6.init(inst, def);
19488
+ ZodStringFormat.init(inst, def);
19489
+ });
19490
+ var ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
19491
+ $ZodCIDRv4.init(inst, def);
19492
+ ZodStringFormat.init(inst, def);
19493
+ });
19494
+ var ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
19495
+ $ZodCIDRv6.init(inst, def);
19496
+ ZodStringFormat.init(inst, def);
19497
+ });
19498
+ var ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
19499
+ $ZodBase64.init(inst, def);
19500
+ ZodStringFormat.init(inst, def);
19501
+ });
19502
+ var ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
19503
+ $ZodBase64URL.init(inst, def);
19504
+ ZodStringFormat.init(inst, def);
19505
+ });
19506
+ var ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
19507
+ $ZodE164.init(inst, def);
19508
+ ZodStringFormat.init(inst, def);
19509
+ });
19510
+ var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
19511
+ $ZodJWT.init(inst, def);
19512
+ ZodStringFormat.init(inst, def);
19513
+ });
19514
+ var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
19515
+ $ZodUnknown.init(inst, def);
19516
+ ZodType.init(inst, def);
19517
+ inst._zod.processJSONSchema = (ctx, json2, params) => unknownProcessor(inst, ctx, json2, params);
19518
+ });
19519
+ function unknown2() {
19520
+ return _unknown(ZodUnknown);
19356
19521
  }
19357
- var isAppApiMethodName = (name) => name.length <= 80 && /^[A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z][A-Za-z0-9_]*)*$/.test(name) && !Object.values(appApiReservedMethodNames).flat().some((reserved) => reserved === name);
19358
-
19359
- // ../puffball/dist/app-method-context.js
19360
- var appMethodCallContextSchema = declareConstructor()([], () => (value, ast, options) => try_2({
19361
- try: () => parseAppMethodCallContext(value, options.onExcessProperty === "error"),
19362
- catch: () => new InvalidType(ast, value, options)
19363
- }));
19364
-
19365
- // ../puffball/dist/app-backend-binding-vocabulary.js
19366
- var appBackendBindingKinds = {
19367
- BACKGROUND: {
19368
- name: "BACKGROUND",
19369
- operations: {
19370
- admit: { cap: "app.background.admit", requires: [], effect: "read" }
19371
- }
19372
- },
19373
- GIT: {
19374
- name: "GIT",
19375
- operations: {
19376
- create: {
19377
- cap: "app.git.create",
19378
- requires: ["git.repository"],
19379
- effect: "write"
19380
- },
19381
- fork: {
19382
- cap: "app.git.fork",
19383
- requires: ["git.repository"],
19384
- effect: "write"
19385
- },
19386
- read: {
19387
- cap: "app.git.read",
19388
- requires: ["git.repository"],
19389
- effect: "read"
19390
- },
19391
- write: {
19392
- cap: "app.git.write",
19393
- requires: ["git.repository"],
19394
- effect: "write"
19395
- },
19396
- exchange: {
19397
- cap: "app.git.exchange",
19398
- requires: ["git.repository"],
19399
- effect: "write"
19400
- }
19522
+ var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
19523
+ $ZodNever.init(inst, def);
19524
+ ZodType.init(inst, def);
19525
+ inst._zod.processJSONSchema = (ctx, json2, params) => neverProcessor(inst, ctx, json2, params);
19526
+ });
19527
+ function never3(params) {
19528
+ return _never(ZodNever, params);
19529
+ }
19530
+ var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
19531
+ $ZodArray.init(inst, def);
19532
+ ZodType.init(inst, def);
19533
+ inst._zod.processJSONSchema = (ctx, json2, params) => arrayProcessor(inst, ctx, json2, params);
19534
+ inst.element = def.element;
19535
+ _installLazyMethods(inst, "ZodArray", {
19536
+ min(n, params) {
19537
+ return this.check(_minLength(n, params));
19538
+ },
19539
+ nonempty(params) {
19540
+ return this.check(_minLength(1, params));
19541
+ },
19542
+ max(n, params) {
19543
+ return this.check(_maxLength(n, params));
19544
+ },
19545
+ length(n, params) {
19546
+ return this.check(_length(n, params));
19547
+ },
19548
+ unwrap() {
19549
+ return this.element;
19401
19550
  }
19402
- },
19403
- EVENTS: {
19404
- name: "EVENTS",
19405
- operations: {
19406
- emit: {
19407
- cap: "app.events.emit",
19408
- requires: ["app.events.emit"],
19409
- effect: "write"
19410
- }
19551
+ });
19552
+ });
19553
+ function array2(element, params) {
19554
+ return _array(ZodArray, element, params);
19555
+ }
19556
+ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
19557
+ $ZodObjectJIT.init(inst, def);
19558
+ ZodType.init(inst, def);
19559
+ inst._zod.processJSONSchema = (ctx, json2, params) => objectProcessor(inst, ctx, json2, params);
19560
+ util_exports.defineLazy(inst, "shape", () => {
19561
+ return def.shape;
19562
+ });
19563
+ _installLazyMethods(inst, "ZodObject", {
19564
+ keyof() {
19565
+ return _enum(Object.keys(this._zod.def.shape));
19566
+ },
19567
+ catchall(catchall) {
19568
+ return this.clone({ ...this._zod.def, catchall });
19569
+ },
19570
+ passthrough() {
19571
+ return this.clone({ ...this._zod.def, catchall: unknown2() });
19572
+ },
19573
+ loose() {
19574
+ return this.clone({ ...this._zod.def, catchall: unknown2() });
19575
+ },
19576
+ strict() {
19577
+ return this.clone({ ...this._zod.def, catchall: never3() });
19578
+ },
19579
+ strip() {
19580
+ return this.clone({ ...this._zod.def, catchall: void 0 });
19581
+ },
19582
+ extend(incoming) {
19583
+ return util_exports.extend(this, incoming);
19584
+ },
19585
+ safeExtend(incoming) {
19586
+ return util_exports.safeExtend(this, incoming);
19587
+ },
19588
+ merge(other) {
19589
+ return util_exports.merge(this, other);
19590
+ },
19591
+ pick(mask) {
19592
+ return util_exports.pick(this, mask);
19593
+ },
19594
+ omit(mask) {
19595
+ return util_exports.omit(this, mask);
19596
+ },
19597
+ partial(...args2) {
19598
+ return util_exports.partial(ZodOptional, this, args2[0]);
19599
+ },
19600
+ required(...args2) {
19601
+ return util_exports.required(ZodNonOptional, this, args2[0]);
19411
19602
  }
19412
- },
19413
- APPS: {
19414
- name: "APPS",
19415
- operations: {
19416
- /** Register the calling installation's repository as an App from its
19417
- * exact main manifest. No Computer execution or installation is implied. */
19418
- register: {
19419
- cap: "app.register",
19420
- requires: ["git.repository"],
19421
- effect: "write"
19422
- },
19423
- /** Read the captured installation's registered repository identity. */
19424
- repository: {
19425
- cap: "app.catalog.read",
19426
- requires: ["git.repository"],
19427
- effect: "read"
19428
- },
19429
- build: {
19430
- cap: "app.build",
19431
- requires: ["git.repository", "computer.execute"],
19432
- effect: "write"
19433
- },
19434
- /** Read one build job's current status; the host re-checks the caller
19435
- * is the owner. An operation is granted only through approved
19436
- * capabilities, so it needs the ones its build was admitted with. */
19437
- buildStatus: {
19438
- cap: "app.build",
19439
- requires: ["git.repository", "computer.execute"],
19440
- effect: "read"
19441
- },
19442
- /** Install a Release at an installation id, or switch a live one onto
19443
- * it; the host re-checks the caller is the owner. It completes the
19444
- * build-and-install loop, under the capabilities a build needs. */
19445
- select: {
19446
- cap: "app.select",
19447
- requires: ["git.repository", "computer.execute"],
19448
- effect: "write"
19449
- },
19450
- catalog: {
19451
- cap: "app.catalog.read",
19452
- requires: ["team.workbenchHost"],
19453
- effect: "read"
19454
- },
19455
- /** Fork a platform App's published source into its own Team-owned App,
19456
- * as a repository in the calling installation's Git. */
19457
- fork: {
19458
- cap: "app.fork",
19459
- requires: ["git.repository"],
19460
- effect: "write"
19461
- }
19603
+ });
19604
+ });
19605
+ function object(shape, params) {
19606
+ const def = {
19607
+ type: "object",
19608
+ shape: shape ?? {},
19609
+ ...util_exports.normalizeParams(params)
19610
+ };
19611
+ return new ZodObject(def);
19612
+ }
19613
+ var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
19614
+ $ZodUnion.init(inst, def);
19615
+ ZodType.init(inst, def);
19616
+ inst._zod.processJSONSchema = (ctx, json2, params) => unionProcessor(inst, ctx, json2, params);
19617
+ inst.options = def.options;
19618
+ });
19619
+ function union2(options, params) {
19620
+ return new ZodUnion({
19621
+ type: "union",
19622
+ options,
19623
+ ...util_exports.normalizeParams(params)
19624
+ });
19625
+ }
19626
+ var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
19627
+ $ZodIntersection.init(inst, def);
19628
+ ZodType.init(inst, def);
19629
+ inst._zod.processJSONSchema = (ctx, json2, params) => intersectionProcessor(inst, ctx, json2, params);
19630
+ });
19631
+ function intersection(left, right) {
19632
+ return new ZodIntersection({
19633
+ type: "intersection",
19634
+ left,
19635
+ right
19636
+ });
19637
+ }
19638
+ var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
19639
+ $ZodTuple.init(inst, def);
19640
+ ZodType.init(inst, def);
19641
+ inst._zod.processJSONSchema = (ctx, json2, params) => tupleProcessor(inst, ctx, json2, params);
19642
+ inst.rest = (rest) => inst.clone({
19643
+ ...inst._zod.def,
19644
+ rest
19645
+ });
19646
+ });
19647
+ function tuple2(items, _paramsOrRest, _params) {
19648
+ const hasRest = _paramsOrRest instanceof $ZodType;
19649
+ const params = hasRest ? _params : _paramsOrRest;
19650
+ const rest = hasRest ? _paramsOrRest : null;
19651
+ return new ZodTuple({
19652
+ type: "tuple",
19653
+ items,
19654
+ rest,
19655
+ ...util_exports.normalizeParams(params)
19656
+ });
19657
+ }
19658
+ var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
19659
+ $ZodRecord.init(inst, def);
19660
+ ZodType.init(inst, def);
19661
+ inst._zod.processJSONSchema = (ctx, json2, params) => recordProcessor(inst, ctx, json2, params);
19662
+ inst.keyType = def.keyType;
19663
+ inst.valueType = def.valueType;
19664
+ });
19665
+ function record2(keyType, valueType, params) {
19666
+ if (!valueType || !valueType._zod) {
19667
+ return new ZodRecord({
19668
+ type: "record",
19669
+ keyType: string4(),
19670
+ valueType: keyType,
19671
+ ...util_exports.normalizeParams(valueType)
19672
+ });
19673
+ }
19674
+ return new ZodRecord({
19675
+ type: "record",
19676
+ keyType,
19677
+ valueType,
19678
+ ...util_exports.normalizeParams(params)
19679
+ });
19680
+ }
19681
+ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
19682
+ $ZodEnum.init(inst, def);
19683
+ ZodType.init(inst, def);
19684
+ inst._zod.processJSONSchema = (ctx, json2, params) => enumProcessor(inst, ctx, json2, params);
19685
+ inst.enum = def.entries;
19686
+ inst.options = Object.values(def.entries);
19687
+ const keys = new Set(Object.keys(def.entries));
19688
+ inst.extract = (values, params) => {
19689
+ const newEntries = {};
19690
+ for (const value of values) {
19691
+ if (keys.has(value)) {
19692
+ newEntries[value] = def.entries[value];
19693
+ } else
19694
+ throw new Error(`Key ${value} not found in enum`);
19462
19695
  }
19463
- },
19464
- WORKFLOWS: {
19465
- name: "WORKFLOWS",
19466
- operations: {
19467
- /** The member's callable App methods, for an editor's palette. */
19468
- catalog: {
19469
- cap: "app.workflow.read",
19470
- requires: ["workflow.run"],
19471
- effect: "read"
19472
- },
19473
- /** Compile and start a definition as the member on the pinned Computer. */
19474
- runGraph: {
19475
- cap: "app.workflow.run",
19476
- requires: ["workflow.run"],
19477
- effect: "write"
19478
- },
19479
- armSchedule: {
19480
- cap: "app.workflow.run",
19481
- requires: ["workflow.run", "workflow.arm"],
19482
- effect: "write"
19483
- },
19484
- disarmSchedule: {
19485
- cap: "app.workflow.run",
19486
- requires: ["workflow.run", "workflow.arm"],
19487
- effect: "write"
19488
- },
19489
- pauseSchedule: {
19490
- cap: "app.workflow.run",
19491
- requires: ["workflow.run", "workflow.arm"],
19492
- effect: "write"
19493
- },
19494
- resumeSchedule: {
19495
- cap: "app.workflow.run",
19496
- requires: ["workflow.run", "workflow.arm"],
19497
- effect: "write"
19498
- },
19499
- schedules: {
19500
- cap: "app.workflow.read",
19501
- requires: ["workflow.run"],
19502
- effect: "read"
19503
- },
19504
- armEventTrigger: {
19505
- cap: "app.workflow.run",
19506
- requires: ["workflow.run", "workflow.arm"],
19507
- effect: "write"
19508
- },
19509
- disarmEventTrigger: {
19510
- cap: "app.workflow.run",
19511
- requires: ["workflow.run", "workflow.arm"],
19512
- effect: "write"
19513
- },
19514
- eventTriggers: {
19515
- cap: "app.workflow.read",
19516
- requires: ["workflow.run"],
19517
- effect: "read"
19518
- },
19519
- /** A person's answer to one of a run's reviews; Agents never answer. */
19520
- cancel: {
19521
- cap: "app.workflow.run",
19522
- requires: ["workflow.run"],
19523
- effect: "write"
19524
- },
19525
- answerReview: {
19526
- cap: "app.workflow.run",
19527
- requires: ["workflow.run"],
19528
- effect: "write"
19529
- },
19530
- /** One of the member's runs: node events, reviews and engine status. */
19531
- graphStatus: {
19532
- cap: "app.workflow.read",
19533
- requires: ["workflow.run"],
19534
- effect: "read"
19535
- },
19536
- /** Up to 50 runs of this library, newest first; source and initiator included. */
19537
- runs: {
19538
- cap: "app.workflow.read",
19539
- requires: ["workflow.run"],
19540
- effect: "read"
19696
+ return new ZodEnum({
19697
+ ...def,
19698
+ checks: [],
19699
+ ...util_exports.normalizeParams(params),
19700
+ entries: newEntries
19701
+ });
19702
+ };
19703
+ inst.exclude = (values, params) => {
19704
+ const newEntries = { ...def.entries };
19705
+ for (const value of values) {
19706
+ if (keys.has(value)) {
19707
+ delete newEntries[value];
19708
+ } else
19709
+ throw new Error(`Key ${value} not found in enum`);
19710
+ }
19711
+ return new ZodEnum({
19712
+ ...def,
19713
+ checks: [],
19714
+ ...util_exports.normalizeParams(params),
19715
+ entries: newEntries
19716
+ });
19717
+ };
19718
+ });
19719
+ function _enum(values, params) {
19720
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
19721
+ return new ZodEnum({
19722
+ type: "enum",
19723
+ entries,
19724
+ ...util_exports.normalizeParams(params)
19725
+ });
19726
+ }
19727
+ var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
19728
+ $ZodLiteral.init(inst, def);
19729
+ ZodType.init(inst, def);
19730
+ inst._zod.processJSONSchema = (ctx, json2, params) => literalProcessor(inst, ctx, json2, params);
19731
+ inst.values = new Set(def.values);
19732
+ Object.defineProperty(inst, "value", {
19733
+ get() {
19734
+ if (def.values.length > 1) {
19735
+ throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
19541
19736
  }
19737
+ return def.values[0];
19542
19738
  }
19543
- },
19544
- APP_STORAGE: {
19545
- name: "APP_STORAGE",
19546
- operations: {
19547
- read: {
19548
- cap: "app.storage.read",
19549
- requires: ["app.storage"],
19550
- effect: "read"
19551
- },
19552
- write: {
19553
- cap: "app.storage.write",
19554
- requires: ["app.storage"],
19555
- effect: "write"
19556
- },
19557
- reset: {
19558
- cap: "app.storage.write",
19559
- requires: ["app.storage"],
19560
- effect: "write"
19561
- }
19562
- }
19563
- },
19564
- MEDIA: {
19565
- name: "MEDIA",
19566
- operations: {
19567
- models: {
19568
- cap: "app.media.read",
19569
- requires: ["media.generation"],
19570
- effect: "read"
19571
- },
19572
- generate: {
19573
- cap: "app.media.generate",
19574
- requires: ["media.generation", "computer.writeFile"],
19575
- effect: "write"
19576
- }
19577
- }
19578
- },
19579
- COMPUTER: {
19580
- name: "COMPUTER",
19581
- operations: {
19582
- list: {
19583
- cap: "app.computer.read",
19584
- requires: ["computer.list"],
19585
- effect: "read"
19586
- },
19587
- read: {
19588
- cap: "app.computer.read",
19589
- requires: ["computer.readFile"],
19590
- effect: "read"
19591
- },
19592
- ports: {
19593
- cap: "app.computer.read",
19594
- requires: ["computer.execute"],
19595
- effect: "read"
19596
- },
19597
- processes: {
19598
- cap: "app.computer.read",
19599
- requires: ["computer.execute"],
19600
- effect: "read"
19601
- },
19602
- gitChanges: {
19603
- cap: "app.computer.read",
19604
- requires: ["computer.readFile"],
19605
- effect: "read"
19606
- },
19607
- write: {
19608
- cap: "app.computer.write",
19609
- requires: ["computer.writeFile"],
19610
- effect: "write"
19611
- },
19612
- mkdir: {
19613
- cap: "app.computer.write",
19614
- requires: ["computer.writeFile"],
19615
- effect: "write"
19616
- },
19617
- move: {
19618
- cap: "app.computer.write",
19619
- requires: ["computer.writeFile"],
19620
- effect: "write"
19621
- },
19622
- preview: {
19623
- cap: "app.computer.exec",
19624
- requires: ["computer.execute"],
19625
- effect: "write"
19626
- },
19627
- processKill: {
19628
- cap: "app.computer.exec",
19629
- requires: ["computer.execute"],
19630
- effect: "write"
19631
- },
19632
- processStart: {
19633
- cap: "app.computer.exec",
19634
- requires: ["computer.execute"],
19635
- effect: "write"
19636
- },
19637
- exec: {
19638
- cap: "app.computer.exec",
19639
- requires: ["computer.execute"],
19640
- effect: "write"
19641
- }
19642
- }
19643
- },
19644
- INBOX: {
19645
- name: "INBOX",
19646
- operations: {
19647
- page: { cap: "inbox.read", requires: ["agent.read"], effect: "read" },
19648
- visit: { cap: "inbox.visit", requires: ["agent.read"], effect: "write" }
19739
+ });
19740
+ });
19741
+ function literal(value, params) {
19742
+ return new ZodLiteral({
19743
+ type: "literal",
19744
+ values: Array.isArray(value) ? value : [value],
19745
+ ...util_exports.normalizeParams(params)
19746
+ });
19747
+ }
19748
+ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
19749
+ $ZodTransform.init(inst, def);
19750
+ ZodType.init(inst, def);
19751
+ inst._zod.processJSONSchema = (ctx, json2, params) => transformProcessor(inst, ctx, json2, params);
19752
+ inst._zod.parse = (payload, _ctx) => {
19753
+ if (_ctx.direction === "backward") {
19754
+ throw new $ZodEncodeError(inst.constructor.name);
19649
19755
  }
19650
- },
19651
- AGENTS: {
19652
- name: "AGENTS",
19653
- operations: {
19654
- list: { cap: "agent.list", requires: ["agent.list"], effect: "read" },
19655
- send: { cap: "agent.send", requires: ["agent.send"], effect: "write" },
19656
- schedules: {
19657
- cap: "agent.read",
19658
- requires: ["agent.read"],
19659
- effect: "read"
19660
- },
19661
- pauseSchedule: {
19662
- cap: "agent.manage",
19663
- requires: ["agent.manage"],
19664
- effect: "write"
19665
- },
19666
- resumeSchedule: {
19667
- cap: "agent.manage",
19668
- requires: ["agent.manage"],
19669
- effect: "write"
19670
- },
19671
- deleteSchedule: {
19672
- cap: "agent.manage",
19673
- requires: ["agent.manage"],
19674
- effect: "write"
19756
+ payload.addIssue = (issue2) => {
19757
+ if (typeof issue2 === "string") {
19758
+ payload.issues.push(util_exports.issue(issue2, payload.value, def));
19759
+ } else {
19760
+ const _issue2 = issue2;
19761
+ if (_issue2.fatal)
19762
+ _issue2.continue = false;
19763
+ _issue2.code ?? (_issue2.code = "custom");
19764
+ _issue2.input ?? (_issue2.input = payload.value);
19765
+ _issue2.inst ?? (_issue2.inst = inst);
19766
+ payload.issues.push(util_exports.issue(_issue2));
19675
19767
  }
19768
+ };
19769
+ const output = def.transform(payload.value, payload);
19770
+ if (output instanceof Promise) {
19771
+ return output.then((output2) => {
19772
+ payload.value = output2;
19773
+ payload.fallback = true;
19774
+ return payload;
19775
+ });
19676
19776
  }
19677
- }
19678
- };
19679
-
19680
- // ../puffball/dist/app-vocabulary.js
19681
- var appRoles = [
19682
- "dashboard",
19683
- "inbox",
19684
- "files",
19685
- "media",
19686
- "sessions",
19687
- "terminal"
19688
- ];
19689
- var appCapabilityIds = [
19690
- "approvals",
19691
- "agent.list",
19692
- "agent.manage",
19693
- "agent.rename",
19694
- "agent.avatar",
19695
- "agent.instructions",
19696
- "agent.toolPolicy",
19697
- "agent.read",
19698
- "agent.send",
19699
- "computer.list",
19700
- "computer.readFile",
19701
- "computer.writeFile",
19702
- "computer.execute",
19703
- "llm.generation",
19704
- "media.generation",
19705
- "media.share",
19706
- "games:servers",
19707
- "git.repository",
19708
- "apps.open",
19709
- "apps.call",
19710
- "app.storage",
19711
- "app.events.emit",
19712
- "team.workbenchHost",
19713
- "marketplace.browse",
19714
- "marketplace.purchase",
19715
- "workflow.run",
19716
- "workflow.publish",
19717
- "workflow.arm",
19718
- "world",
19719
- "channels.read",
19720
- "channels.personal.manage"
19721
- ];
19722
- var appHandlers = ["file.open"];
19723
- var appStorageScopes = ["team", "member"];
19724
- var emptyAppDeclaration = Object.freeze({
19725
- capabilities: [],
19726
- handlers: [],
19727
- roles: []
19777
+ payload.value = output;
19778
+ payload.fallback = true;
19779
+ return payload;
19780
+ };
19728
19781
  });
19729
-
19730
- // ../puffball/dist/app-api.js
19731
- var appApiMethodNameSchema = String4.check(makeFilter2(isAppApiMethodName));
19732
- function isJsonContainer(value) {
19733
- return value !== null && typeof value === "object";
19782
+ function transform3(fn2) {
19783
+ return new ZodTransform({
19784
+ type: "transform",
19785
+ transform: fn2
19786
+ });
19734
19787
  }
19735
- function withinDepth(value, depth = 0) {
19736
- if (depth > 16)
19737
- return false;
19738
- if (isJsonContainer(value)) {
19739
- for (const child of Object.values(value))
19740
- if (!withinDepth(child, depth + 1))
19741
- return false;
19742
- }
19743
- return true;
19788
+ var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
19789
+ $ZodOptional.init(inst, def);
19790
+ ZodType.init(inst, def);
19791
+ inst._zod.processJSONSchema = (ctx, json2, params) => optionalProcessor(inst, ctx, json2, params);
19792
+ inst.unwrap = () => inst._zod.def.innerType;
19793
+ });
19794
+ function optional3(innerType) {
19795
+ return new ZodOptional({
19796
+ type: "optional",
19797
+ innerType
19798
+ });
19744
19799
  }
19745
- var projection = JsonObject.pipe(check(makeFilter2((value) => new TextEncoder().encode(JSON.stringify(value)).byteLength <= 2e4 && withinDepth(value), { message: "App API schema exceeds its byte or depth bound" })));
19746
- var eventName = String4.check(isMinLength(1), isMaxLength(128));
19747
- var method = Struct({
19748
- description: String4.pipe(check(isMinLength(1)), check(isMaxLength(1e3))),
19749
- input: projection,
19750
- output: projection,
19751
- pending: optional2(Literal2(true)),
19752
- hidden: optional2(Literal2(true)),
19753
- present: optional2(Struct({
19754
- verb: String4.check(isMinLength(1), isMaxLength(32))
19755
- })),
19756
- effect: Literals(["read", "write", "external"]),
19757
- requires: ArraySchema(Literals(appCapabilityIds)).pipe(check(makeFilter2((values) => new Set(values).size === values.length)))
19800
+ var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
19801
+ $ZodExactOptional.init(inst, def);
19802
+ ZodType.init(inst, def);
19803
+ inst._zod.processJSONSchema = (ctx, json2, params) => optionalProcessor(inst, ctx, json2, params);
19804
+ inst.unwrap = () => inst._zod.def.innerType;
19758
19805
  });
19759
- var appApiSchema = Struct({
19760
- methods: Record(String4, method).pipe(check(makeFilter2((methods) => Object.keys(methods).every(is2(appApiMethodNameSchema)), { message: "Invalid App API method name" })), check(makeFilter2((methods) => Object.keys(methods).length <= 64)), check(makeFilter2((methods) => {
19761
- const names = Object.keys(methods);
19762
- return names.every((name) => !names.some((other) => other.startsWith(`${name}.`)));
19763
- }, { message: "App API method name is also a method group" }))),
19764
- toolFamily: optionalKey2(Struct({
19765
- name: appApiMethodNameSchema.check(makeFilter2((name) => !name.includes("."))),
19766
- list: appApiMethodNameSchema,
19767
- call: appApiMethodNameSchema
19768
- })),
19769
- events: optionalKey2(Record(String4, Struct({
19770
- description: String4.check(isMinLength(1), isMaxLength(1e3)),
19771
- payload: projection
19772
- })).check(makeFilter2((events) => Object.keys(events).every(is2(eventName)), { message: "Invalid App API event name" }), makeFilter2((events) => Object.keys(events).length <= 64)))
19773
- }).pipe(check(makeFilter2((api) => {
19774
- if (api.toolFamily === void 0)
19775
- return true;
19776
- const { name, list, call } = api.toolFamily;
19777
- const listing = api.methods[list];
19778
- const operation = api.methods[call];
19779
- return listing?.effect === "read" && operation !== void 0 && operation.effect !== "external" && operation.hidden !== true && !Object.keys(api.methods).some((method2) => method2.split(".")[0] === name);
19780
- }, {
19781
- message: "Tool family must reference declared callable methods in a distinct namespace"
19782
- })), check(makeFilter2((api) => new TextEncoder().encode(JSON.stringify(api)).byteLength <= 256e3, { message: "App API exceeds its total byte bound" })));
19783
-
19784
- // ../puffball/dist/app-backend-bindings.js
19785
- var unique = (values) => new Set(values).size === values.length;
19786
- function bindingKind(name, operations) {
19787
- const names = Object.keys(operations);
19788
- for (const operation of names)
19789
- decodeUnknownSync(appApiMethodNameSchema)(operation);
19790
- const declaration3 = Struct({
19791
- name: Literal2(name),
19792
- operations: ArraySchema(Literals(names)).pipe(check(isMinLength(1)), check(isMaxLength(names.length)), check(makeFilter2(unique)))
19806
+ function exactOptional(innerType) {
19807
+ return new ZodExactOptional({
19808
+ type: "optional",
19809
+ innerType
19793
19810
  });
19794
- const shard = Struct({
19795
- name: Literal2(name),
19796
- operations: ArraySchema(Union2(Object.entries(operations).map(([name2, operation]) => Struct({
19797
- name: Literal2(name2),
19798
- cap: Literal2(operation.cap)
19799
- })))).pipe(check(isMinLength(1)), check(isMaxLength(names.length)), check(makeFilter2((ops) => unique(ops.map((op) => op.name)), {
19800
- message: "App backend operation repeated"
19801
- })))
19811
+ }
19812
+ var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
19813
+ $ZodNullable.init(inst, def);
19814
+ ZodType.init(inst, def);
19815
+ inst._zod.processJSONSchema = (ctx, json2, params) => nullableProcessor(inst, ctx, json2, params);
19816
+ inst.unwrap = () => inst._zod.def.innerType;
19817
+ });
19818
+ function nullable(innerType) {
19819
+ return new ZodNullable({
19820
+ type: "nullable",
19821
+ innerType
19802
19822
  });
19803
- return { declaration: declaration3, shard };
19804
19823
  }
19805
- var kinds = Object.values(appBackendBindingKinds).map((kind) => bindingKind(kind.name, kind.operations));
19806
- var count = kinds.length;
19807
- var appBackendBindingsSchema = ArraySchema(Union2(kinds.map((kind) => kind.declaration))).pipe(check(isMaxLength(count)), check(makeFilter2((bindings) => unique(bindings.map((binding) => binding.name)))));
19808
- var appBackendShardBindingsSchema = ArraySchema(Union2(kinds.map((kind) => kind.shard))).pipe(check(isMaxLength(count)), check(makeFilter2((bindings) => unique(bindings.map((binding) => binding.name)))));
19809
- var operationCatalog = new Map(Object.entries(appBackendBindingKinds).map(([name, operations]) => [
19810
- name,
19811
- new Map(Object.entries(operations.operations))
19812
- ]));
19813
- function appBackendBindingOperation(name, operation) {
19814
- return operationCatalog.get(name)?.get(operation);
19824
+ var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
19825
+ $ZodDefault.init(inst, def);
19826
+ ZodType.init(inst, def);
19827
+ inst._zod.processJSONSchema = (ctx, json2, params) => defaultProcessor(inst, ctx, json2, params);
19828
+ inst.unwrap = () => inst._zod.def.innerType;
19829
+ inst.removeDefault = inst.unwrap;
19830
+ });
19831
+ function _default(innerType, defaultValue) {
19832
+ return new ZodDefault({
19833
+ type: "default",
19834
+ innerType,
19835
+ get defaultValue() {
19836
+ return typeof defaultValue === "function" ? defaultValue() : util_exports.shallowClone(defaultValue);
19837
+ }
19838
+ });
19815
19839
  }
19816
-
19817
- // ../gills/dist/rows.js
19818
- var rowLabelSchemaV1 = String4.pipe(check(isMinLength(1)), check(isMaxLength(4096)));
19819
- var rowIdentitySchemaV1 = String4.pipe(check(isMinLength(1)), check(isMaxLength(513)));
19820
- var rowOpenSchemaV1 = Struct({
19821
- params: ArraySchema(Struct({
19822
- key: String4.check(isMinLength(1), isMaxLength(64)),
19823
- value: String4.check(isMaxLength(4096))
19824
- })).check(isMaxLength(16))
19840
+ var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
19841
+ $ZodPrefault.init(inst, def);
19842
+ ZodType.init(inst, def);
19843
+ inst._zod.processJSONSchema = (ctx, json2, params) => prefaultProcessor(inst, ctx, json2, params);
19844
+ inst.unwrap = () => inst._zod.def.innerType;
19825
19845
  });
19826
- var rowSchemaV1 = Struct({
19827
- id: rowIdentitySchemaV1,
19828
- title: rowLabelSchemaV1,
19829
- detail: optional2(String4.pipe(check(isMaxLength(1024)))),
19830
- tone: optional2(Literals(["attention", "running", "error", "settled", "muted"])),
19831
- /** App-owned status text with the semantic colors used by Caps Status. */
19832
- status: optional2(Struct({
19833
- label: rowLabelSchemaV1,
19834
- tone: Literals([
19835
- "neutral",
19836
- "primary",
19837
- "secondary",
19838
- "accent",
19839
- "success",
19840
- "info",
19841
- "warning",
19842
- "error"
19843
- ])
19844
- })),
19845
- /** The host supplies this Gill's App identity; rows only select its view. */
19846
- open: optional2(rowOpenSchemaV1)
19846
+ function prefault(innerType, defaultValue) {
19847
+ return new ZodPrefault({
19848
+ type: "prefault",
19849
+ innerType,
19850
+ get defaultValue() {
19851
+ return typeof defaultValue === "function" ? defaultValue() : util_exports.shallowClone(defaultValue);
19852
+ }
19853
+ });
19854
+ }
19855
+ var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
19856
+ $ZodNonOptional.init(inst, def);
19857
+ ZodType.init(inst, def);
19858
+ inst._zod.processJSONSchema = (ctx, json2, params) => nonoptionalProcessor(inst, ctx, json2, params);
19859
+ inst.unwrap = () => inst._zod.def.innerType;
19847
19860
  });
19848
- var rowPageSchemaV1 = ArraySchema(rowSchemaV1).pipe(check(isMaxLength(200)));
19849
- var resultRowSchemaV1 = Struct({
19850
- ...rowSchemaV1.fields,
19851
- /** A Computer file the receiving host may preview; the host authorizes the read. */
19852
- media: optional2(Struct({
19853
- path: rowLabelSchemaV1,
19854
- format: Literals(["fungi:image", "fungi:video"])
19855
- }))
19861
+ function nonoptional(innerType, params) {
19862
+ return new ZodNonOptional({
19863
+ type: "nonoptional",
19864
+ innerType,
19865
+ ...util_exports.normalizeParams(params)
19866
+ });
19867
+ }
19868
+ var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
19869
+ $ZodCatch.init(inst, def);
19870
+ ZodType.init(inst, def);
19871
+ inst._zod.processJSONSchema = (ctx, json2, params) => catchProcessor(inst, ctx, json2, params);
19872
+ inst.unwrap = () => inst._zod.def.innerType;
19873
+ inst.removeCatch = inst.unwrap;
19856
19874
  });
19857
-
19858
- // ../gills/dist/declaration.js
19859
- var isUnique = (values) => new Set(values).size === values.length;
19860
- var meaningful = String4.pipe(check(isMaxLength(256)), check(makeFilter2((value) => value.trim().length > 0, {
19861
- message: "Declared command text must not be blank"
19862
- })));
19863
- var appGillParamKeySchema = meaningful.pipe(check(isMaxLength(64)));
19864
- var appGillParamSchema = Struct({
19865
- key: appGillParamKeySchema,
19866
- label: meaningful,
19867
- kind: Literals(["computer", "repository", "branch"]),
19868
- required: Boolean3,
19869
- options: optional2(meaningful)
19870
- }).check(makeFilter2((param) => param.kind !== "computer" || param.options === void 0, {
19871
- message: "Computer options are host-owned"
19872
- }));
19873
- var appGillParamsSchema = ArraySchema(appGillParamSchema).check(isMaxLength(4), makeFilter2((params) => isUnique(params.map((param) => param.key)), {
19874
- message: "Gill parameter keys must be unique"
19875
- }));
19876
- var appGillWatchSchema = Union2([
19877
- Struct({ storage: meaningful }),
19878
- Struct({ binding: meaningful })
19879
- ]);
19880
- var appDeclaredGillSchema = Struct({
19881
- id: meaningful.pipe(check(makeFilter2((id) => !id.includes(":"), {
19882
- message: "Gill IDs are App-local"
19883
- }))),
19884
- title: meaningful,
19885
- source: meaningful,
19886
- params: optional2(appGillParamsSchema),
19887
- watch: optional2(appGillWatchSchema),
19888
- desktop: optional2(Struct({
19889
- sizes: ArraySchema(Literals(["S", "M", "L"])).check(isMinLength(1), isMaxLength(3), makeFilter2(isUnique, {
19890
- message: "Desktop Gill sizes must be unique"
19891
- }))
19892
- }))
19875
+ function _catch(innerType, catchValue) {
19876
+ return new ZodCatch({
19877
+ type: "catch",
19878
+ innerType,
19879
+ catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
19880
+ });
19881
+ }
19882
+ var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
19883
+ $ZodPipe.init(inst, def);
19884
+ ZodType.init(inst, def);
19885
+ inst._zod.processJSONSchema = (ctx, json2, params) => pipeProcessor(inst, ctx, json2, params);
19886
+ inst.in = def.in;
19887
+ inst.out = def.out;
19893
19888
  });
19894
-
19895
- // ../gills/dist/gill.js
19896
- var gillParamsSchema = Record(appGillParamKeySchema, String4.check(isMaxLength(256))).check(makeFilter2((params) => Object.keys(params).length <= 4, {
19897
- message: "Gill placement supports at most four parameters"
19898
- }));
19899
- var gillRequestSchema = Struct({
19900
- viewId: rowIdentitySchemaV1,
19901
- params: optional2(gillParamsSchema),
19902
- after: optional2(String4.check(isMaxLength(1024))),
19903
- options: optional2(appGillParamKeySchema)
19889
+ function pipe(in_, out) {
19890
+ return new ZodPipe({
19891
+ type: "pipe",
19892
+ in: in_,
19893
+ out
19894
+ // ...util.normalizeParams(params),
19895
+ });
19896
+ }
19897
+ var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
19898
+ $ZodReadonly.init(inst, def);
19899
+ ZodType.init(inst, def);
19900
+ inst._zod.processJSONSchema = (ctx, json2, params) => readonlyProcessor(inst, ctx, json2, params);
19901
+ inst.unwrap = () => inst._zod.def.innerType;
19904
19902
  });
19905
- var gillCallSchema = Struct({
19906
- id: rowIdentitySchemaV1,
19907
- params: optional2(gillParamsSchema),
19908
- after: optional2(String4.check(isMaxLength(1024))),
19909
- options: optional2(appGillParamKeySchema)
19903
+ function readonly(innerType) {
19904
+ return new ZodReadonly({
19905
+ type: "readonly",
19906
+ innerType
19907
+ });
19908
+ }
19909
+ var ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
19910
+ $ZodLazy.init(inst, def);
19911
+ ZodType.init(inst, def);
19912
+ inst._zod.processJSONSchema = (ctx, json2, params) => lazyProcessor(inst, ctx, json2, params);
19913
+ inst.unwrap = () => inst._zod.def.getter();
19910
19914
  });
19911
- var gillResponseSchema = Union2([
19912
- Struct({
19913
- viewId: rowIdentitySchemaV1,
19914
- title: rowLabelSchemaV1,
19915
- state: Literal2("empty"),
19916
- rows: Tuple([]),
19917
- /** One line naming the first action, in the App's own words. */
19918
- emptyText: optional2(String4.pipe(check(isMinLength(1)), check(isMaxLength(120)))),
19919
- /** The host supplies the button; the App only says it belongs. */
19920
- action: optional2(Struct({ kind: Literal2("open") })),
19921
- next: optional2(String4.pipe(check(isMaxLength(1024))))
19922
- }),
19923
- Struct({
19924
- viewId: rowIdentitySchemaV1,
19925
- title: rowLabelSchemaV1,
19926
- state: Literal2("error"),
19927
- rows: Tuple([]),
19928
- /** Host-owned permanent execution refusal; an ordinary error may still be refreshed. */
19929
- reason: optional2(Literals([
19930
- "exec_isolation_required",
19931
- "params_required",
19932
- "disabled"
19933
- ])),
19934
- error: String4.pipe(check(isMinLength(1)), check(isMaxLength(512))),
19935
- /** The host supplies the same-placement picker and this App's launch. */
19936
- recovery: optional2(Union2([
19937
- Struct({
19938
- kind: Literal2("configure"),
19939
- param: appGillParamKeySchema
19940
- }),
19941
- Struct({ kind: Literal2("open") })
19942
- ]))
19943
- }),
19944
- Struct({
19945
- viewId: rowIdentitySchemaV1,
19946
- title: rowLabelSchemaV1,
19947
- state: Literal2("full"),
19948
- rows: rowPageSchemaV1.pipe(check(isMinLength(1))),
19949
- next: optional2(String4.pipe(check(isMaxLength(1024))))
19950
- })
19951
- ]);
19952
- var decodeGillResponse = decodeUnknownSync(gillResponseSchema, {
19953
- onExcessProperty: "error"
19954
- });
19955
- var gillOptionsResponseSchema = Struct({
19956
- options: ArraySchema(Struct({
19957
- value: String4.check(isMaxLength(256)),
19958
- label: rowLabelSchemaV1,
19959
- detail: optional2(String4.check(isMaxLength(1024)))
19960
- })).check(isMaxLength(200)),
19961
- next: optional2(String4.check(isMaxLength(1024)))
19962
- });
19963
- var gillReplySchema = Union2([
19964
- gillResponseSchema,
19965
- gillOptionsResponseSchema
19966
- ]);
19967
- var decodeGillReply = decodeUnknownSync(gillReplySchema, {
19968
- onExcessProperty: "error"
19969
- });
19970
- var decodeGillOptionsResponse = decodeUnknownSync(gillOptionsResponseSchema, { onExcessProperty: "error" });
19971
-
19972
- // ../puffball/dist/app-declaration.js
19973
- var appRoleSchema = Literals(appRoles);
19974
- var appCapabilityIdSchema = Literals(appCapabilityIds);
19975
- var appHandlerSchema = Literals(appHandlers);
19976
- var unique2 = {
19977
- message: "App declaration entries must be unique"
19978
- };
19979
- var isUnique2 = (values) => new Set(values).size === values.length;
19980
- var reservedBindings = /* @__PURE__ */ new Set([
19981
- "super+k",
19982
- "meta+k",
19983
- "cmd+k",
19984
- "mod+k",
19985
- "ctrl+k",
19986
- "control+k"
19987
- ]);
19988
- var meaningful2 = String4.pipe(check(isMaxLength(256)), check(makeFilter2((value) => value.trim().length > 0, {
19989
- message: "Declared command text must not be blank"
19990
- })));
19991
- var order = { order: optional2(Int) };
19992
- var ordered = Struct(order);
19993
- var appDeclaredCommandSchema = Struct({
19994
- id: meaningful2.pipe(check(makeFilter2((id) => !id.includes(":"), {
19995
- message: "Declared command IDs are namespace-local"
19996
- }))),
19997
- title: meaningful2,
19998
- category: meaningful2,
19999
- description: optional2(String4.pipe(check(isMaxLength(1024)))),
20000
- sigil: optional2(meaningful2.pipe(check(isMaxLength(64)))),
20001
- projections: optional2(Struct({
20002
- bindings: optional2(Struct({
20003
- ...order,
20004
- values: ArraySchema(meaningful2).pipe(check(isMaxLength(16)), check(makeFilter2((values) => !values.some((binding) => reservedBindings.has(binding.trim().toLowerCase())), { message: "Apps cannot bind the reserved leader chord" })))
20005
- })),
20006
- agent: optional2(Struct({ ...order, keybind: optional2(String4) })),
20007
- help: optional2(ordered),
20008
- menu: optional2(ordered),
20009
- palette: optional2(ordered),
20010
- slash: optional2(Struct({
20011
- ...order,
20012
- aliases: ArraySchema(meaningful2).pipe(check(isMaxLength(16)))
20013
- }))
20014
- }))
20015
- });
20016
- var commandsAreUnique = (commands) => isUnique2(commands.map((command) => command.id)) && isUnique2(commands.flatMap((command) => command.projections?.slash?.aliases ?? []));
20017
- var gillsAreUnique = (gills) => isUnique2(gills.map((gill) => gill.id));
20018
- var appStorageKeyNameSchema = String4.check(isPattern2(/^[a-z][a-z0-9.-]{0,63}$/));
20019
- var storageKeyFields = Struct({
20020
- key: appStorageKeyNameSchema,
20021
- scopes: ArraySchema(Literals(appStorageScopes)).check(isMinLength(1), makeFilter2(isUnique2, unique2)),
20022
- maxBytes: Int.check(isBetween({ minimum: 1, maximum: 65536 }))
20023
- });
20024
- var appStorageKeySchema = declareConstructor()([storageKeyFields], ([fields]) => (input, _self, options) => decodeUnknownEffect(fields)(input, {
20025
- ...options,
20026
- onExcessProperty: "error"
20027
- }), {
20028
- toCodecJson: () => new Link(storageKeyFields.ast, passthrough2())
20029
- });
20030
- var appCallFields = Struct({
20031
- appId: String4.check(isMinLength(1), isMaxLength(128)),
20032
- methods: ArraySchema(appApiMethodNameSchema).check(isMinLength(1), isMaxLength(16), makeFilter2(isUnique2, unique2))
19915
+ function lazy(getter) {
19916
+ return new ZodLazy({
19917
+ type: "lazy",
19918
+ getter
19919
+ });
19920
+ }
19921
+ var ZodFunction = /* @__PURE__ */ $constructor("ZodFunction", (inst, def) => {
19922
+ $ZodFunction.init(inst, def);
19923
+ ZodType.init(inst, def);
19924
+ inst._zod.processJSONSchema = (ctx, json2, params) => functionProcessor(inst, ctx, json2, params);
20033
19925
  });
20034
- var appCallSchema = declareConstructor()([appCallFields], ([fields]) => (input, _self, options) => decodeUnknownEffect(fields)(input, {
20035
- ...options,
20036
- onExcessProperty: "error"
20037
- }), {
20038
- toCodecJson: () => new Link(appCallFields.ast, passthrough2())
19926
+ function _function(params) {
19927
+ return new ZodFunction({
19928
+ type: "function",
19929
+ input: Array.isArray(params?.input) ? tuple2(params?.input) : params?.input ?? array2(unknown2()),
19930
+ output: params?.output ?? unknown2()
19931
+ });
19932
+ }
19933
+ var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
19934
+ $ZodCustom.init(inst, def);
19935
+ ZodType.init(inst, def);
19936
+ inst._zod.processJSONSchema = (ctx, json2, params) => customProcessor(inst, ctx, json2, params);
20039
19937
  });
20040
- var appCallsSchema = ArraySchema(appCallSchema).check(isMinLength(1), isMaxLength(16), makeFilter2((calls) => isUnique2(calls.map((call) => call.appId)), unique2));
20041
- var appDeclarationSchema = Struct({
20042
- api: optionalKey2(appApiSchema),
20043
- displayName: optional2(String4.pipe(check(isMinLength(1)), check(isMaxLength(64)))),
20044
- capabilities: ArraySchema(appCapabilityIdSchema).pipe(check(makeFilter2(isUnique2, unique2))),
20045
- calls: optionalKey2(appCallsSchema),
20046
- guidance: optional2(String4.pipe(check(isMinLength(1)), check(isMaxLength(12e3)))),
20047
- handlers: ArraySchema(appHandlerSchema).pipe(check(makeFilter2(isUnique2, unique2))),
20048
- receives: optionalKey2(ArraySchema(Literal2("git.push")).check(isMaxLength(1), makeFilter2(isUnique2, unique2))),
20049
- icon: optionalKey2(String4.pipe(check(isMinLength(1)), check(isMaxLength(80)))),
20050
- roles: ArraySchema(appRoleSchema).pipe(check(makeFilter2(isUnique2, unique2))),
20051
- storage: optionalKey2(ArraySchema(appStorageKeySchema).check(isMaxLength(16), makeFilter2((keys) => isUnique2(keys.map((entry) => entry.key)), unique2))),
20052
- commands: optional2(ArraySchema(appDeclaredCommandSchema).pipe(check(isMaxLength(64)), check(makeFilter2(commandsAreUnique, {
20053
- message: "Declared command IDs and slash aliases must be unique"
20054
- })))),
20055
- gills: optional2(ArraySchema(appDeclaredGillSchema).pipe(check(isMaxLength(16)), check(makeFilter2(gillsAreUnique, {
20056
- message: "Declared Gill IDs must be unique"
20057
- })))),
20058
- backend: optional2(Struct({
20059
- bindings: appBackendBindingsSchema,
20060
- sync: optionalKey2(Struct({ method: appApiMethodNameSchema }))
20061
- }))
20062
- }).pipe(check(makeFilter2((declaration3) => declaration3.calls === void 0 || declaration3.capabilities.includes("apps.call"), { message: "App calls require apps.call" })), check(makeFilter2((declaration3) => declaration3.backend?.bindings.every((binding) => binding.name !== "BACKGROUND") ?? true, { message: "BACKGROUND is host-minted and cannot be declared by an App" })), check(makeFilter2((declaration3) => backgroundSyncAllowed(declaration3.api, declaration3.backend?.sync), {
20063
- message: "Background continuation must be a declared write covering all write requirements"
20064
- })), check(makeFilter2((declaration3) => !(declaration3.receives?.includes("git.push") ?? false) || declaration3.capabilities.includes("git.repository"), { message: "Git push reception requires git.repository" })), check(makeFilter2((declaration3) => declaration3.backend?.bindings.every((binding) => binding.operations.every((name) => appBackendBindingOperation(binding.name, name)?.requires.every((capability) => declaration3.capabilities.includes(capability)) === true)) ?? true, { message: "Backend bindings require declared App capabilities" })), check(makeFilter2((declaration3) => !declaration3.backend?.bindings.some((binding) => binding.name === "APP_STORAGE") || (declaration3.storage?.length ?? 0) > 0, { message: "App storage bindings require declared keys" })), check(makeFilter2((declaration3) => Object.values(declaration3.api?.methods ?? {}).every((method2) => method2.requires.every((capability) => declaration3.capabilities.includes(capability))), { message: "App API requires capabilities outside the App declaration" })));
20065
-
20066
- // ../../node_modules/.pnpm/nanoid@5.1.16/node_modules/nanoid/index.js
20067
- import { webcrypto as crypto2 } from "node:crypto";
20068
- var POOL_SIZE_MULTIPLIER = 128;
20069
- var pool;
20070
- var poolOffset;
20071
- function fillPool(bytes) {
20072
- if (bytes < 0) throw new RangeError("Wrong ID size");
20073
- try {
20074
- if (!pool || pool.length < bytes) {
20075
- pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
20076
- crypto2.getRandomValues(pool);
20077
- poolOffset = 0;
20078
- } else if (poolOffset + bytes > pool.length) {
20079
- crypto2.getRandomValues(pool);
20080
- poolOffset = 0;
20081
- }
20082
- } catch (e) {
20083
- pool = void 0;
20084
- throw e;
20085
- }
20086
- poolOffset += bytes;
19938
+ function custom(fn2, _params) {
19939
+ return _custom(ZodCustom, fn2 ?? (() => true), _params);
20087
19940
  }
20088
- function random2(bytes) {
20089
- fillPool(bytes |= 0);
20090
- return pool.subarray(poolOffset - bytes, poolOffset);
19941
+ function refine2(fn2, _params = {}) {
19942
+ return _refine(ZodCustom, fn2, _params);
20091
19943
  }
20092
- function customRandom(alphabet2, defaultSize, getRandom) {
20093
- let safeByteCutoff = 256 - 256 % alphabet2.length;
20094
- if (safeByteCutoff === 256) {
20095
- let mask = alphabet2.length - 1;
20096
- return (size = defaultSize) => {
20097
- if (!size) return "";
20098
- let id = "";
20099
- while (true) {
20100
- let bytes = getRandom(size);
20101
- let i2 = size;
20102
- while (i2--) {
20103
- id += alphabet2[bytes[i2] & mask];
20104
- if (id.length >= size) return id;
20105
- }
20106
- }
20107
- };
20108
- }
20109
- let step = Math.ceil(1.6 * 256 * defaultSize / safeByteCutoff);
20110
- return (size = defaultSize) => {
20111
- if (!size) return "";
20112
- let id = "";
20113
- while (true) {
20114
- let bytes = getRandom(step);
20115
- let i2 = step;
20116
- while (i2--) {
20117
- if (bytes[i2] < safeByteCutoff) {
20118
- id += alphabet2[bytes[i2] % alphabet2.length];
20119
- if (id.length >= size) return id;
20120
- }
20121
- }
19944
+ function superRefine(fn2, params) {
19945
+ return _superRefine(fn2, params);
19946
+ }
19947
+ function _instanceof(cls, params = {}) {
19948
+ const inst = new ZodCustom({
19949
+ type: "custom",
19950
+ check: "custom",
19951
+ fn: (data) => data instanceof cls,
19952
+ abort: true,
19953
+ ...util_exports.normalizeParams(params)
19954
+ });
19955
+ inst._zod.bag.Class = cls;
19956
+ inst._zod.check = (payload) => {
19957
+ if (!(payload.value instanceof cls)) {
19958
+ payload.issues.push({
19959
+ code: "invalid_type",
19960
+ expected: cls.name,
19961
+ input: payload.value,
19962
+ inst,
19963
+ path: [...inst._zod.def.path ?? []]
19964
+ });
20122
19965
  }
20123
19966
  };
20124
- }
20125
- function customAlphabet(alphabet2, size = 21) {
20126
- return customRandom(alphabet2, size, random2);
19967
+ return inst;
20127
19968
  }
20128
19969
 
20129
- // ../cairn/dist/nanoid.js
20130
- var ALPHABET = "abcdefghijklmnopqrstuvwxyz0123456789";
20131
- var DEFAULT = 21;
20132
- function nanoid2(length = DEFAULT) {
20133
- if (length === Number.POSITIVE_INFINITY || length === Number.NEGATIVE_INFINITY)
20134
- throw new RangeError("nanoid length must be finite");
20135
- return customAlphabet(ALPHABET, length)();
20136
- }
19970
+ // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
19971
+ config(en_default());
20137
19972
 
20138
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.js
20139
- var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
20140
- $ZodISODateTime.init(inst, def);
20141
- ZodStringFormat.init(inst, def);
20142
- });
20143
- function datetime2(params) {
20144
- return _isoDateTime(ZodISODateTime, params);
19973
+ // ../cairn/dist/team-role.js
19974
+ var teamRoles = Object.freeze(["owner", "admin", "member"]);
19975
+ var teamRoleSchema = lazy(() => _enum(teamRoles));
19976
+
19977
+ // ../puffball/dist/internal/background-sync.js
19978
+ function backgroundSyncAllowed(api, sync3) {
19979
+ if (sync3 === void 0)
19980
+ return true;
19981
+ const continuation = api?.methods[sync3.method];
19982
+ if (continuation?.effect !== "write")
19983
+ return false;
19984
+ return Object.values(api?.methods ?? {}).every((method2) => method2.effect !== "write" || method2.requires.every((capability) => continuation.requires.includes(capability)));
20145
19985
  }
20146
- var ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
20147
- $ZodISODate.init(inst, def);
20148
- ZodStringFormat.init(inst, def);
19986
+
19987
+ // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/mini/schemas.js
19988
+ var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
19989
+ if (!inst._zod)
19990
+ throw new Error("Uninitialized schema in ZodMiniType.");
19991
+ $ZodType.init(inst, def);
19992
+ inst.def = def;
19993
+ inst.type = def.type;
19994
+ inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
19995
+ inst.safeParse = (data, params) => safeParse(inst, data, params);
19996
+ inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
19997
+ inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
19998
+ inst.check = (...checks) => {
19999
+ return inst.clone({
20000
+ ...def,
20001
+ checks: [
20002
+ ...def.checks ?? [],
20003
+ ...checks.map((ch) => typeof ch === "function" ? {
20004
+ _zod: { check: ch, def: { check: "custom" }, onattach: [] }
20005
+ } : ch)
20006
+ ]
20007
+ }, { parent: true });
20008
+ };
20009
+ inst.with = inst.check;
20010
+ inst.clone = (_def, params) => clone(inst, _def, params);
20011
+ inst.brand = () => inst;
20012
+ inst.register = ((reg, meta2) => {
20013
+ reg.add(inst, meta2);
20014
+ return inst;
20015
+ });
20016
+ inst.apply = (fn2) => fn2(inst);
20149
20017
  });
20150
- function date2(params) {
20151
- return _isoDate(ZodISODate, params);
20018
+ var ZodMiniString = /* @__PURE__ */ $constructor("ZodMiniString", (inst, def) => {
20019
+ $ZodString.init(inst, def);
20020
+ ZodMiniType.init(inst, def);
20021
+ });
20022
+ // @__NO_SIDE_EFFECTS__
20023
+ function string5(params) {
20024
+ return _string(ZodMiniString, params);
20152
20025
  }
20153
- var ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
20154
- $ZodISOTime.init(inst, def);
20155
- ZodStringFormat.init(inst, def);
20026
+ var ZodMiniNever = /* @__PURE__ */ $constructor("ZodMiniNever", (inst, def) => {
20027
+ $ZodNever.init(inst, def);
20028
+ ZodMiniType.init(inst, def);
20156
20029
  });
20157
- function time2(params) {
20158
- return _isoTime(ZodISOTime, params);
20030
+ // @__NO_SIDE_EFFECTS__
20031
+ function never4(params) {
20032
+ return _never(ZodMiniNever, params);
20159
20033
  }
20160
- var ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
20161
- $ZodISODuration.init(inst, def);
20162
- ZodStringFormat.init(inst, def);
20034
+ var ZodMiniObject = /* @__PURE__ */ $constructor("ZodMiniObject", (inst, def) => {
20035
+ $ZodObject.init(inst, def);
20036
+ ZodMiniType.init(inst, def);
20037
+ defineLazy(inst, "shape", () => def.shape);
20163
20038
  });
20164
- function duration2(params) {
20165
- return _isoDuration(ZodISODuration, params);
20039
+ // @__NO_SIDE_EFFECTS__
20040
+ function object2(shape, params) {
20041
+ const def = {
20042
+ type: "object",
20043
+ shape: shape ?? {},
20044
+ ...normalizeParams(params)
20045
+ };
20046
+ return new ZodMiniObject(def);
20166
20047
  }
20167
-
20168
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js
20169
- var initializer2 = (inst, issues) => {
20170
- $ZodError.init(inst, issues);
20171
- inst.name = "ZodError";
20172
- Object.defineProperties(inst, {
20173
- format: {
20174
- value: (mapper) => formatError(inst, mapper)
20175
- // enumerable: false,
20176
- },
20177
- flatten: {
20178
- value: (mapper) => flattenError(inst, mapper)
20179
- // enumerable: false,
20180
- },
20181
- addIssue: {
20182
- value: (issue2) => {
20183
- inst.issues.push(issue2);
20184
- inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
20185
- }
20186
- // enumerable: false,
20187
- },
20188
- addIssues: {
20189
- value: (issues2) => {
20190
- inst.issues.push(...issues2);
20191
- inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
20192
- }
20193
- // enumerable: false,
20194
- },
20195
- isEmpty: {
20196
- get() {
20197
- return inst.issues.length === 0;
20198
- }
20199
- // enumerable: false,
20200
- }
20048
+ // @__NO_SIDE_EFFECTS__
20049
+ function strictObject(shape, params) {
20050
+ return new ZodMiniObject({
20051
+ type: "object",
20052
+ shape,
20053
+ catchall: /* @__PURE__ */ never4(),
20054
+ ...normalizeParams(params)
20201
20055
  });
20202
- };
20203
- var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, {
20204
- Parent: Error
20056
+ }
20057
+ var ZodMiniDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodMiniDiscriminatedUnion", (inst, def) => {
20058
+ $ZodDiscriminatedUnion.init(inst, def);
20059
+ ZodMiniType.init(inst, def);
20205
20060
  });
20206
-
20207
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js
20208
- var parse2 = /* @__PURE__ */ _parse(ZodRealError);
20209
- var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
20210
- var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
20211
- var safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
20212
- var encode3 = /* @__PURE__ */ _encode(ZodRealError);
20213
- var decode3 = /* @__PURE__ */ _decode(ZodRealError);
20214
- var encodeAsync2 = /* @__PURE__ */ _encodeAsync(ZodRealError);
20215
- var decodeAsync2 = /* @__PURE__ */ _decodeAsync(ZodRealError);
20216
- var safeEncode2 = /* @__PURE__ */ _safeEncode(ZodRealError);
20217
- var safeDecode2 = /* @__PURE__ */ _safeDecode(ZodRealError);
20218
- var safeEncodeAsync2 = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
20219
- var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
20220
-
20221
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.js
20222
- var _installedGroups = /* @__PURE__ */ new WeakMap();
20223
- function _installLazyMethods(inst, group, methods) {
20224
- const proto = Object.getPrototypeOf(inst);
20225
- let installed = _installedGroups.get(proto);
20226
- if (!installed) {
20227
- installed = /* @__PURE__ */ new Set();
20228
- _installedGroups.set(proto, installed);
20229
- }
20230
- if (installed.has(group))
20231
- return;
20232
- installed.add(group);
20233
- for (const key in methods) {
20234
- const fn2 = methods[key];
20235
- Object.defineProperty(proto, key, {
20236
- configurable: true,
20237
- enumerable: false,
20238
- get() {
20239
- const bound = fn2.bind(this);
20240
- Object.defineProperty(this, key, {
20241
- configurable: true,
20242
- writable: true,
20243
- enumerable: true,
20244
- value: bound
20245
- });
20246
- return bound;
20247
- },
20248
- set(v) {
20249
- Object.defineProperty(this, key, {
20250
- configurable: true,
20251
- writable: true,
20252
- enumerable: true,
20253
- value: v
20254
- });
20255
- }
20256
- });
20257
- }
20061
+ // @__NO_SIDE_EFFECTS__
20062
+ function discriminatedUnion(discriminator, options, params) {
20063
+ return new ZodMiniDiscriminatedUnion({
20064
+ type: "union",
20065
+ options,
20066
+ discriminator,
20067
+ ...normalizeParams(params)
20068
+ });
20258
20069
  }
20259
- var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
20260
- $ZodType.init(inst, def);
20261
- Object.assign(inst["~standard"], {
20262
- jsonSchema: {
20263
- input: createStandardJSONSchemaMethod(inst, "input"),
20264
- output: createStandardJSONSchemaMethod(inst, "output")
20265
- }
20070
+ var ZodMiniLiteral = /* @__PURE__ */ $constructor("ZodMiniLiteral", (inst, def) => {
20071
+ $ZodLiteral.init(inst, def);
20072
+ ZodMiniType.init(inst, def);
20073
+ });
20074
+ // @__NO_SIDE_EFFECTS__
20075
+ function literal2(value, params) {
20076
+ return new ZodMiniLiteral({
20077
+ type: "literal",
20078
+ values: Array.isArray(value) ? value : [value],
20079
+ ...normalizeParams(params)
20266
20080
  });
20267
- inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
20268
- inst.def = def;
20269
- inst.type = def.type;
20270
- Object.defineProperty(inst, "_def", { value: def });
20271
- inst.parse = (data, params) => parse2(inst, data, params, { callee: inst.parse });
20272
- inst.safeParse = (data, params) => safeParse2(inst, data, params);
20273
- inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
20274
- inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);
20275
- inst.spa = inst.safeParseAsync;
20276
- inst.encode = (data, params) => encode3(inst, data, params);
20277
- inst.decode = (data, params) => decode3(inst, data, params);
20278
- inst.encodeAsync = async (data, params) => encodeAsync2(inst, data, params);
20279
- inst.decodeAsync = async (data, params) => decodeAsync2(inst, data, params);
20280
- inst.safeEncode = (data, params) => safeEncode2(inst, data, params);
20281
- inst.safeDecode = (data, params) => safeDecode2(inst, data, params);
20282
- inst.safeEncodeAsync = async (data, params) => safeEncodeAsync2(inst, data, params);
20283
- inst.safeDecodeAsync = async (data, params) => safeDecodeAsync2(inst, data, params);
20284
- _installLazyMethods(inst, "ZodType", {
20285
- check(...chks) {
20286
- const def2 = this.def;
20287
- return this.clone(util_exports.mergeDefs(def2, {
20288
- checks: [
20289
- ...def2.checks ?? [],
20290
- ...chks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
20291
- ]
20292
- }), { parent: true });
20293
- },
20294
- with(...chks) {
20295
- return this.check(...chks);
20296
- },
20297
- clone(def2, params) {
20298
- return clone(this, def2, params);
20299
- },
20300
- brand() {
20301
- return this;
20302
- },
20303
- register(reg, meta2) {
20304
- reg.add(this, meta2);
20305
- return this;
20306
- },
20307
- refine(check2, params) {
20308
- return this.check(refine3(check2, params));
20309
- },
20310
- superRefine(refinement, params) {
20311
- return this.check(superRefine(refinement, params));
20312
- },
20313
- overwrite(fn2) {
20314
- return this.check(_overwrite(fn2));
20315
- },
20316
- optional() {
20317
- return optional4(this);
20318
- },
20319
- exactOptional() {
20320
- return exactOptional(this);
20321
- },
20322
- nullable() {
20323
- return nullable2(this);
20324
- },
20325
- nullish() {
20326
- return optional4(nullable2(this));
20327
- },
20328
- nonoptional(params) {
20329
- return nonoptional(this, params);
20330
- },
20331
- array() {
20332
- return array2(this);
20333
- },
20334
- or(arg) {
20335
- return union2([this, arg]);
20336
- },
20337
- and(arg) {
20338
- return intersection(this, arg);
20339
- },
20340
- transform(tx) {
20341
- return pipe(this, transform3(tx));
20342
- },
20343
- default(d) {
20344
- return _default(this, d);
20345
- },
20346
- prefault(d) {
20347
- return prefault(this, d);
20348
- },
20349
- catch(params) {
20350
- return _catch(this, params);
20351
- },
20352
- pipe(target) {
20353
- return pipe(this, target);
20354
- },
20355
- readonly() {
20356
- return readonly(this);
20357
- },
20358
- describe(description) {
20359
- const cl = this.clone();
20360
- globalRegistry.add(cl, { description });
20361
- return cl;
20362
- },
20363
- meta(...args2) {
20364
- if (args2.length === 0)
20365
- return globalRegistry.get(this);
20366
- const cl = this.clone();
20367
- globalRegistry.add(cl, args2[0]);
20368
- return cl;
20369
- },
20370
- isOptional() {
20371
- return this.safeParse(void 0).success;
20372
- },
20373
- isNullable() {
20374
- return this.safeParse(null).success;
20375
- },
20376
- apply(fn2) {
20377
- return fn2(this);
20378
- }
20379
- });
20380
- Object.defineProperty(inst, "description", {
20381
- get() {
20382
- return globalRegistry.get(inst)?.description;
20383
- },
20384
- configurable: true
20081
+ }
20082
+ var ZodMiniOptional = /* @__PURE__ */ $constructor("ZodMiniOptional", (inst, def) => {
20083
+ $ZodOptional.init(inst, def);
20084
+ ZodMiniType.init(inst, def);
20085
+ });
20086
+ // @__NO_SIDE_EFFECTS__
20087
+ function optional4(innerType) {
20088
+ return new ZodMiniOptional({
20089
+ type: "optional",
20090
+ innerType
20385
20091
  });
20386
- return inst;
20092
+ }
20093
+ var ZodMiniNullable = /* @__PURE__ */ $constructor("ZodMiniNullable", (inst, def) => {
20094
+ $ZodNullable.init(inst, def);
20095
+ ZodMiniType.init(inst, def);
20387
20096
  });
20388
- var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
20389
- $ZodString.init(inst, def);
20390
- ZodType.init(inst, def);
20391
- inst._zod.processJSONSchema = (ctx, json2, params) => stringProcessor(inst, ctx, json2, params);
20392
- const bag = inst._zod.bag;
20393
- inst.format = bag.format ?? null;
20394
- inst.minLength = bag.minimum ?? null;
20395
- inst.maxLength = bag.maximum ?? null;
20396
- _installLazyMethods(inst, "_ZodString", {
20397
- regex(...args2) {
20398
- return this.check(_regex(...args2));
20399
- },
20400
- includes(...args2) {
20401
- return this.check(_includes(...args2));
20402
- },
20403
- startsWith(...args2) {
20404
- return this.check(_startsWith(...args2));
20405
- },
20406
- endsWith(...args2) {
20407
- return this.check(_endsWith(...args2));
20408
- },
20409
- min(...args2) {
20410
- return this.check(_minLength(...args2));
20411
- },
20412
- max(...args2) {
20413
- return this.check(_maxLength(...args2));
20414
- },
20415
- length(...args2) {
20416
- return this.check(_length(...args2));
20417
- },
20418
- nonempty(...args2) {
20419
- return this.check(_minLength(1, ...args2));
20420
- },
20421
- lowercase(params) {
20422
- return this.check(_lowercase(params));
20423
- },
20424
- uppercase(params) {
20425
- return this.check(_uppercase(params));
20426
- },
20427
- trim() {
20428
- return this.check(_trim());
20429
- },
20430
- normalize(...args2) {
20431
- return this.check(_normalize(...args2));
20432
- },
20433
- toLowerCase() {
20434
- return this.check(_toLowerCase());
20435
- },
20436
- toUpperCase() {
20437
- return this.check(_toUpperCase());
20438
- },
20439
- slugify() {
20440
- return this.check(_slugify());
20441
- }
20097
+ // @__NO_SIDE_EFFECTS__
20098
+ function nullable2(innerType) {
20099
+ return new ZodMiniNullable({
20100
+ type: "nullable",
20101
+ innerType
20442
20102
  });
20103
+ }
20104
+ var ZodMiniLazy = /* @__PURE__ */ $constructor("ZodMiniLazy", (inst, def) => {
20105
+ $ZodLazy.init(inst, def);
20106
+ ZodMiniType.init(inst, def);
20443
20107
  });
20444
- var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
20445
- $ZodString.init(inst, def);
20446
- _ZodString.init(inst, def);
20447
- inst.email = (params) => inst.check(_email(ZodEmail, params));
20448
- inst.url = (params) => inst.check(_url(ZodURL, params));
20449
- inst.jwt = (params) => inst.check(_jwt(ZodJWT, params));
20450
- inst.emoji = (params) => inst.check(_emoji2(ZodEmoji, params));
20451
- inst.guid = (params) => inst.check(_guid(ZodGUID, params));
20452
- inst.uuid = (params) => inst.check(_uuid(ZodUUID, params));
20453
- inst.uuidv4 = (params) => inst.check(_uuidv4(ZodUUID, params));
20454
- inst.uuidv6 = (params) => inst.check(_uuidv6(ZodUUID, params));
20455
- inst.uuidv7 = (params) => inst.check(_uuidv7(ZodUUID, params));
20456
- inst.nanoid = (params) => inst.check(_nanoid(ZodNanoID, params));
20457
- inst.guid = (params) => inst.check(_guid(ZodGUID, params));
20458
- inst.cuid = (params) => inst.check(_cuid(ZodCUID, params));
20459
- inst.cuid2 = (params) => inst.check(_cuid2(ZodCUID2, params));
20460
- inst.ulid = (params) => inst.check(_ulid(ZodULID, params));
20461
- inst.base64 = (params) => inst.check(_base64(ZodBase64, params));
20462
- inst.base64url = (params) => inst.check(_base64url(ZodBase64URL, params));
20463
- inst.xid = (params) => inst.check(_xid(ZodXID, params));
20464
- inst.ksuid = (params) => inst.check(_ksuid(ZodKSUID, params));
20465
- inst.ipv4 = (params) => inst.check(_ipv4(ZodIPv4, params));
20466
- inst.ipv6 = (params) => inst.check(_ipv6(ZodIPv6, params));
20467
- inst.cidrv4 = (params) => inst.check(_cidrv4(ZodCIDRv4, params));
20468
- inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params));
20469
- inst.e164 = (params) => inst.check(_e164(ZodE164, params));
20470
- inst.datetime = (params) => inst.check(datetime2(params));
20471
- inst.date = (params) => inst.check(date2(params));
20472
- inst.time = (params) => inst.check(time2(params));
20473
- inst.duration = (params) => inst.check(duration2(params));
20108
+ // @__NO_SIDE_EFFECTS__
20109
+ function _lazy(getter) {
20110
+ return new ZodMiniLazy({
20111
+ type: "lazy",
20112
+ getter
20113
+ });
20114
+ }
20115
+ var ZodMiniCustom = /* @__PURE__ */ $constructor("ZodMiniCustom", (inst, def) => {
20116
+ $ZodCustom.init(inst, def);
20117
+ ZodMiniType.init(inst, def);
20474
20118
  });
20475
- function string5(params) {
20476
- return _string(ZodString, params);
20119
+ // @__NO_SIDE_EFFECTS__
20120
+ function refine3(fn2, _params = {}) {
20121
+ return _refine(ZodMiniCustom, fn2, _params);
20477
20122
  }
20478
- var ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
20479
- $ZodStringFormat.init(inst, def);
20480
- _ZodString.init(inst, def);
20123
+
20124
+ // ../puffball/dist/app-method-runtime.js
20125
+ var appApiReservedMethodNames = Object.freeze({
20126
+ intrinsic: [
20127
+ "constructor",
20128
+ "toString",
20129
+ "valueOf",
20130
+ "hasOwnProperty",
20131
+ "isPrototypeOf",
20132
+ "propertyIsEnumerable",
20133
+ "toLocaleString"
20134
+ ],
20135
+ rpc: ["then", "dup", "connect", "id", "name"],
20136
+ instance: ["ctx", "env"],
20137
+ lifecycle: [
20138
+ "gill",
20139
+ "onGitPush",
20140
+ "syncRefused",
20141
+ "authorizeGitPush",
20142
+ "fetch",
20143
+ "alarm",
20144
+ "queue",
20145
+ "scheduled",
20146
+ "tail",
20147
+ "trace",
20148
+ "email",
20149
+ "test",
20150
+ "tailStream",
20151
+ "webSocketMessage",
20152
+ "webSocketClose",
20153
+ "webSocketError"
20154
+ ]
20481
20155
  });
20482
- var ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
20483
- $ZodEmail.init(inst, def);
20484
- ZodStringFormat.init(inst, def);
20156
+ var identity2 = string5().check(_minLength(1), _maxLength(256));
20157
+ var memberActor = object2({ kind: literal2("member"), memberId: identity2 });
20158
+ var agentActor = object2({ kind: literal2("agent"), agentId: identity2 });
20159
+ var keyActor = object2({ kind: literal2("team-key"), keyId: identity2 });
20160
+ var hostActorSchema = discriminatedUnion("kind", [
20161
+ memberActor,
20162
+ agentActor,
20163
+ keyActor
20164
+ ]);
20165
+ var workflowAttestationSchema = object2({
20166
+ /** Published Workflow selected by the run owner. */
20167
+ workflowId: identity2,
20168
+ /** Run identity held by the run owner. */
20169
+ runId: identity2,
20170
+ /** Node selected by the stored published Workflow. */
20171
+ nodeId: identity2,
20172
+ /** Actor that armed the run, re-admitted by the host at dispatch. */
20173
+ armedBy: hostActorSchema
20485
20174
  });
20486
- var ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
20487
- $ZodGUID.init(inst, def);
20488
- ZodStringFormat.init(inst, def);
20175
+ var backgroundOrigin = _lazy(() => strictObject({
20176
+ method: string5().check(refine3((name) => isAppApiMethodName(name))),
20177
+ seal: string5().check(_regex(/^[A-Za-z0-9_-]{43}$/u))
20178
+ }));
20179
+ var appMethodCallerSchema = object2({
20180
+ computerId: nullable2(identity2),
20181
+ actor: hostActorSchema,
20182
+ /** Host-attested enqueue eligibility for this ordinary write; absent otherwise. */
20183
+ backgroundLane: optional4(string5().check(_minLength(8), _maxLength(263))),
20184
+ /** Host-sealed foreground method for durable jobs; paired with backgroundLane. */
20185
+ backgroundOrigin: optional4(backgroundOrigin),
20186
+ /** Team role attested by the host, never selected by App method input. */
20187
+ role: optional4(teamRoleSchema),
20188
+ /**
20189
+ * The host attests that this member is currently the Team's only member.
20190
+ * Present only on a member's own call; never on an Agent, Team key or
20191
+ * Workflow node, and never selected by App method input.
20192
+ */
20193
+ soleMember: optional4(literal2(true)),
20194
+ /** Present only on a Workflow node invocation admitted by its host. */
20195
+ workflow: optional4(workflowAttestationSchema),
20196
+ /**
20197
+ * The host's stable key for this logical call (for example one Workflow
20198
+ * node), the same on every retry. A method with side effects uses it to do
20199
+ * its work at most once. Absent when the caller supplies its own request id.
20200
+ */
20201
+ idempotencyKey: optional4(string5().check(_minLength(1), _maxLength(128)))
20489
20202
  });
20490
- var ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
20491
- $ZodUUID.init(inst, def);
20492
- ZodStringFormat.init(inst, def);
20203
+ var strictActor = discriminatedUnion("kind", [
20204
+ strictObject(memberActor.shape),
20205
+ strictObject(agentActor.shape),
20206
+ strictObject(keyActor.shape)
20207
+ ]);
20208
+ var strictCaller = strictObject({
20209
+ ...appMethodCallerSchema.shape,
20210
+ actor: strictActor,
20211
+ workflow: optional4(strictObject({
20212
+ ...workflowAttestationSchema.shape,
20213
+ armedBy: strictActor
20214
+ }))
20493
20215
  });
20494
- var ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
20495
- $ZodURL.init(inst, def);
20496
- ZodStringFormat.init(inst, def);
20497
- });
20498
- var ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
20499
- $ZodEmoji.init(inst, def);
20500
- ZodStringFormat.init(inst, def);
20501
- });
20502
- var ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
20503
- $ZodNanoID.init(inst, def);
20504
- ZodStringFormat.init(inst, def);
20505
- });
20506
- var ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
20507
- $ZodCUID.init(inst, def);
20508
- ZodStringFormat.init(inst, def);
20509
- });
20510
- var ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
20511
- $ZodCUID2.init(inst, def);
20512
- ZodStringFormat.init(inst, def);
20513
- });
20514
- var ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
20515
- $ZodULID.init(inst, def);
20516
- ZodStringFormat.init(inst, def);
20517
- });
20518
- var ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
20519
- $ZodXID.init(inst, def);
20520
- ZodStringFormat.init(inst, def);
20521
- });
20522
- var ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
20523
- $ZodKSUID.init(inst, def);
20524
- ZodStringFormat.init(inst, def);
20525
- });
20526
- var ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
20527
- $ZodIPv4.init(inst, def);
20528
- ZodStringFormat.init(inst, def);
20529
- });
20530
- var ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
20531
- $ZodIPv6.init(inst, def);
20532
- ZodStringFormat.init(inst, def);
20533
- });
20534
- var ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
20535
- $ZodCIDRv4.init(inst, def);
20536
- ZodStringFormat.init(inst, def);
20537
- });
20538
- var ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
20539
- $ZodCIDRv6.init(inst, def);
20540
- ZodStringFormat.init(inst, def);
20541
- });
20542
- var ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
20543
- $ZodBase64.init(inst, def);
20544
- ZodStringFormat.init(inst, def);
20545
- });
20546
- var ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
20547
- $ZodBase64URL.init(inst, def);
20548
- ZodStringFormat.init(inst, def);
20549
- });
20550
- var ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
20551
- $ZodE164.init(inst, def);
20552
- ZodStringFormat.init(inst, def);
20553
- });
20554
- var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
20555
- $ZodJWT.init(inst, def);
20556
- ZodStringFormat.init(inst, def);
20557
- });
20558
- var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
20559
- $ZodUnknown.init(inst, def);
20560
- ZodType.init(inst, def);
20561
- inst._zod.processJSONSchema = (ctx, json2, params) => unknownProcessor(inst, ctx, json2, params);
20562
- });
20563
- function unknown2() {
20564
- return _unknown(ZodUnknown);
20565
- }
20566
- var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
20567
- $ZodNever.init(inst, def);
20568
- ZodType.init(inst, def);
20569
- inst._zod.processJSONSchema = (ctx, json2, params) => neverProcessor(inst, ctx, json2, params);
20570
- });
20571
- function never4(params) {
20572
- return _never(ZodNever, params);
20216
+ var parseAppMethodCallContext = (value, rejectUnknownKeys = false) => validateCaller((rejectUnknownKeys ? strictCaller : appMethodCallerSchema).parse(value));
20217
+ function validateCaller(context3) {
20218
+ if (context3.soleMember !== void 0 && (context3.actor.kind !== "member" || context3.workflow !== void 0))
20219
+ throw new Error("Only a member's own call can be its Team's sole member");
20220
+ if (context3.backgroundLane === void 0 !== (context3.backgroundOrigin === void 0))
20221
+ throw new Error("Background lane and origin must be attested together");
20222
+ if (context3.backgroundLane !== void 0 && (context3.actor.kind !== "member" || context3.workflow !== void 0 || context3.backgroundLane !== `member:${context3.actor.memberId}`))
20223
+ throw new Error("Background lane must name an ordinary member");
20224
+ return context3;
20573
20225
  }
20574
- var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
20575
- $ZodArray.init(inst, def);
20576
- ZodType.init(inst, def);
20577
- inst._zod.processJSONSchema = (ctx, json2, params) => arrayProcessor(inst, ctx, json2, params);
20578
- inst.element = def.element;
20579
- _installLazyMethods(inst, "ZodArray", {
20580
- min(n, params) {
20581
- return this.check(_minLength(n, params));
20582
- },
20583
- nonempty(params) {
20584
- return this.check(_minLength(1, params));
20585
- },
20586
- max(n, params) {
20587
- return this.check(_maxLength(n, params));
20588
- },
20589
- length(n, params) {
20590
- return this.check(_length(n, params));
20591
- },
20592
- unwrap() {
20593
- return this.element;
20226
+ var isAppApiMethodName = (name) => name.length <= 80 && /^[A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z][A-Za-z0-9_]*)*$/.test(name) && !Object.values(appApiReservedMethodNames).flat().some((reserved) => reserved === name);
20227
+
20228
+ // ../puffball/dist/app-method-context.js
20229
+ var appMethodCallContextSchema = declareConstructor()([], () => (value, ast, options) => try_2({
20230
+ try: () => parseAppMethodCallContext(value, options.onExcessProperty === "error"),
20231
+ catch: () => new InvalidType(ast, value, options)
20232
+ }));
20233
+
20234
+ // ../puffball/dist/app-backend-binding-vocabulary.js
20235
+ var appBackendBindingKinds = {
20236
+ BACKGROUND: {
20237
+ name: "BACKGROUND",
20238
+ operations: {
20239
+ admit: { cap: "app.background.admit", requires: [], effect: "read" }
20594
20240
  }
20595
- });
20596
- });
20597
- function array2(element, params) {
20598
- return _array(ZodArray, element, params);
20599
- }
20600
- var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
20601
- $ZodObjectJIT.init(inst, def);
20602
- ZodType.init(inst, def);
20603
- inst._zod.processJSONSchema = (ctx, json2, params) => objectProcessor(inst, ctx, json2, params);
20604
- util_exports.defineLazy(inst, "shape", () => {
20605
- return def.shape;
20606
- });
20607
- _installLazyMethods(inst, "ZodObject", {
20608
- keyof() {
20609
- return _enum2(Object.keys(this._zod.def.shape));
20610
- },
20611
- catchall(catchall) {
20612
- return this.clone({ ...this._zod.def, catchall });
20613
- },
20614
- passthrough() {
20615
- return this.clone({ ...this._zod.def, catchall: unknown2() });
20616
- },
20617
- loose() {
20618
- return this.clone({ ...this._zod.def, catchall: unknown2() });
20619
- },
20620
- strict() {
20621
- return this.clone({ ...this._zod.def, catchall: never4() });
20622
- },
20623
- strip() {
20624
- return this.clone({ ...this._zod.def, catchall: void 0 });
20625
- },
20626
- extend(incoming) {
20627
- return util_exports.extend(this, incoming);
20628
- },
20629
- safeExtend(incoming) {
20630
- return util_exports.safeExtend(this, incoming);
20631
- },
20632
- merge(other) {
20633
- return util_exports.merge(this, other);
20634
- },
20635
- pick(mask) {
20636
- return util_exports.pick(this, mask);
20637
- },
20638
- omit(mask) {
20639
- return util_exports.omit(this, mask);
20640
- },
20641
- partial(...args2) {
20642
- return util_exports.partial(ZodOptional, this, args2[0]);
20643
- },
20644
- required(...args2) {
20645
- return util_exports.required(ZodNonOptional, this, args2[0]);
20241
+ },
20242
+ GIT: {
20243
+ name: "GIT",
20244
+ operations: {
20245
+ create: {
20246
+ cap: "app.git.create",
20247
+ requires: ["git.repository"],
20248
+ effect: "write"
20249
+ },
20250
+ fork: {
20251
+ cap: "app.git.fork",
20252
+ requires: ["git.repository"],
20253
+ effect: "write"
20254
+ },
20255
+ read: {
20256
+ cap: "app.git.read",
20257
+ requires: ["git.repository"],
20258
+ effect: "read"
20259
+ },
20260
+ write: {
20261
+ cap: "app.git.write",
20262
+ requires: ["git.repository"],
20263
+ effect: "write"
20264
+ },
20265
+ exchange: {
20266
+ cap: "app.git.exchange",
20267
+ requires: ["git.repository"],
20268
+ effect: "write"
20269
+ }
20646
20270
  }
20647
- });
20648
- });
20649
- function object2(shape, params) {
20650
- const def = {
20651
- type: "object",
20652
- shape: shape ?? {},
20653
- ...util_exports.normalizeParams(params)
20654
- };
20655
- return new ZodObject(def);
20656
- }
20657
- var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
20658
- $ZodUnion.init(inst, def);
20659
- ZodType.init(inst, def);
20660
- inst._zod.processJSONSchema = (ctx, json2, params) => unionProcessor(inst, ctx, json2, params);
20661
- inst.options = def.options;
20662
- });
20663
- function union2(options, params) {
20664
- return new ZodUnion({
20665
- type: "union",
20666
- options,
20667
- ...util_exports.normalizeParams(params)
20668
- });
20669
- }
20670
- var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
20671
- $ZodIntersection.init(inst, def);
20672
- ZodType.init(inst, def);
20673
- inst._zod.processJSONSchema = (ctx, json2, params) => intersectionProcessor(inst, ctx, json2, params);
20674
- });
20675
- function intersection(left, right) {
20676
- return new ZodIntersection({
20677
- type: "intersection",
20678
- left,
20679
- right
20680
- });
20681
- }
20682
- var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
20683
- $ZodTuple.init(inst, def);
20684
- ZodType.init(inst, def);
20685
- inst._zod.processJSONSchema = (ctx, json2, params) => tupleProcessor(inst, ctx, json2, params);
20686
- inst.rest = (rest) => inst.clone({
20687
- ...inst._zod.def,
20688
- rest
20689
- });
20690
- });
20691
- function tuple2(items, _paramsOrRest, _params) {
20692
- const hasRest = _paramsOrRest instanceof $ZodType;
20693
- const params = hasRest ? _params : _paramsOrRest;
20694
- const rest = hasRest ? _paramsOrRest : null;
20695
- return new ZodTuple({
20696
- type: "tuple",
20697
- items,
20698
- rest,
20699
- ...util_exports.normalizeParams(params)
20700
- });
20701
- }
20702
- var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
20703
- $ZodRecord.init(inst, def);
20704
- ZodType.init(inst, def);
20705
- inst._zod.processJSONSchema = (ctx, json2, params) => recordProcessor(inst, ctx, json2, params);
20706
- inst.keyType = def.keyType;
20707
- inst.valueType = def.valueType;
20708
- });
20709
- function record2(keyType, valueType, params) {
20710
- if (!valueType || !valueType._zod) {
20711
- return new ZodRecord({
20712
- type: "record",
20713
- keyType: string5(),
20714
- valueType: keyType,
20715
- ...util_exports.normalizeParams(valueType)
20716
- });
20717
- }
20718
- return new ZodRecord({
20719
- type: "record",
20720
- keyType,
20721
- valueType,
20722
- ...util_exports.normalizeParams(params)
20723
- });
20724
- }
20725
- var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
20726
- $ZodEnum.init(inst, def);
20727
- ZodType.init(inst, def);
20728
- inst._zod.processJSONSchema = (ctx, json2, params) => enumProcessor(inst, ctx, json2, params);
20729
- inst.enum = def.entries;
20730
- inst.options = Object.values(def.entries);
20731
- const keys = new Set(Object.keys(def.entries));
20732
- inst.extract = (values, params) => {
20733
- const newEntries = {};
20734
- for (const value of values) {
20735
- if (keys.has(value)) {
20736
- newEntries[value] = def.entries[value];
20737
- } else
20738
- throw new Error(`Key ${value} not found in enum`);
20271
+ },
20272
+ EVENTS: {
20273
+ name: "EVENTS",
20274
+ operations: {
20275
+ emit: {
20276
+ cap: "app.events.emit",
20277
+ requires: ["app.events.emit"],
20278
+ effect: "write"
20279
+ }
20739
20280
  }
20740
- return new ZodEnum({
20741
- ...def,
20742
- checks: [],
20743
- ...util_exports.normalizeParams(params),
20744
- entries: newEntries
20745
- });
20746
- };
20747
- inst.exclude = (values, params) => {
20748
- const newEntries = { ...def.entries };
20749
- for (const value of values) {
20750
- if (keys.has(value)) {
20751
- delete newEntries[value];
20752
- } else
20753
- throw new Error(`Key ${value} not found in enum`);
20281
+ },
20282
+ APPS: {
20283
+ name: "APPS",
20284
+ operations: {
20285
+ /** Register the calling installation's repository as an App from its
20286
+ * exact main manifest. No Computer execution or installation is implied. */
20287
+ register: {
20288
+ cap: "app.register",
20289
+ requires: ["git.repository"],
20290
+ effect: "write"
20291
+ },
20292
+ /** Read the captured installation's registered repository identity. */
20293
+ repository: {
20294
+ cap: "app.catalog.read",
20295
+ requires: ["git.repository"],
20296
+ effect: "read"
20297
+ },
20298
+ build: {
20299
+ cap: "app.build",
20300
+ requires: ["git.repository", "computer.execute"],
20301
+ effect: "write"
20302
+ },
20303
+ /** Read one build job's current status; the host re-checks the caller
20304
+ * is the owner. An operation is granted only through approved
20305
+ * capabilities, so it needs the ones its build was admitted with. */
20306
+ buildStatus: {
20307
+ cap: "app.build",
20308
+ requires: ["git.repository", "computer.execute"],
20309
+ effect: "read"
20310
+ },
20311
+ /** Install a Release at an installation id, or switch a live one onto
20312
+ * it; the host re-checks the caller is the owner. It completes the
20313
+ * build-and-install loop, under the capabilities a build needs. */
20314
+ select: {
20315
+ cap: "app.select",
20316
+ requires: ["git.repository", "computer.execute"],
20317
+ effect: "write"
20318
+ },
20319
+ catalog: {
20320
+ cap: "app.catalog.read",
20321
+ requires: ["team.workbenchHost"],
20322
+ effect: "read"
20323
+ },
20324
+ /** Fork a platform App's published source into its own Team-owned App,
20325
+ * as a repository in the calling installation's Git. */
20326
+ fork: {
20327
+ cap: "app.fork",
20328
+ requires: ["git.repository"],
20329
+ effect: "write"
20330
+ }
20331
+ }
20332
+ },
20333
+ WORKFLOWS: {
20334
+ name: "WORKFLOWS",
20335
+ operations: {
20336
+ /** The member's callable App methods, for an editor's palette. */
20337
+ catalog: {
20338
+ cap: "app.workflow.read",
20339
+ requires: ["workflow.run"],
20340
+ effect: "read"
20341
+ },
20342
+ /** Compile and start a definition as the member on the pinned Computer. */
20343
+ runGraph: {
20344
+ cap: "app.workflow.run",
20345
+ requires: ["workflow.run"],
20346
+ effect: "write"
20347
+ },
20348
+ armSchedule: {
20349
+ cap: "app.workflow.run",
20350
+ requires: ["workflow.run", "workflow.arm"],
20351
+ effect: "write"
20352
+ },
20353
+ disarmSchedule: {
20354
+ cap: "app.workflow.run",
20355
+ requires: ["workflow.run", "workflow.arm"],
20356
+ effect: "write"
20357
+ },
20358
+ pauseSchedule: {
20359
+ cap: "app.workflow.run",
20360
+ requires: ["workflow.run", "workflow.arm"],
20361
+ effect: "write"
20362
+ },
20363
+ resumeSchedule: {
20364
+ cap: "app.workflow.run",
20365
+ requires: ["workflow.run", "workflow.arm"],
20366
+ effect: "write"
20367
+ },
20368
+ schedules: {
20369
+ cap: "app.workflow.read",
20370
+ requires: ["workflow.run"],
20371
+ effect: "read"
20372
+ },
20373
+ armEventTrigger: {
20374
+ cap: "app.workflow.run",
20375
+ requires: ["workflow.run", "workflow.arm"],
20376
+ effect: "write"
20377
+ },
20378
+ disarmEventTrigger: {
20379
+ cap: "app.workflow.run",
20380
+ requires: ["workflow.run", "workflow.arm"],
20381
+ effect: "write"
20382
+ },
20383
+ eventTriggers: {
20384
+ cap: "app.workflow.read",
20385
+ requires: ["workflow.run"],
20386
+ effect: "read"
20387
+ },
20388
+ /** A person's answer to one of a run's reviews; Agents never answer. */
20389
+ cancel: {
20390
+ cap: "app.workflow.run",
20391
+ requires: ["workflow.run"],
20392
+ effect: "write"
20393
+ },
20394
+ answerReview: {
20395
+ cap: "app.workflow.run",
20396
+ requires: ["workflow.run"],
20397
+ effect: "write"
20398
+ },
20399
+ /** One of the member's runs: node events, reviews and engine status. */
20400
+ graphStatus: {
20401
+ cap: "app.workflow.read",
20402
+ requires: ["workflow.run"],
20403
+ effect: "read"
20404
+ },
20405
+ /** Up to 50 runs of this library, newest first; source and initiator included. */
20406
+ runs: {
20407
+ cap: "app.workflow.read",
20408
+ requires: ["workflow.run"],
20409
+ effect: "read"
20410
+ }
20411
+ }
20412
+ },
20413
+ APP_STORAGE: {
20414
+ name: "APP_STORAGE",
20415
+ operations: {
20416
+ read: {
20417
+ cap: "app.storage.read",
20418
+ requires: ["app.storage"],
20419
+ effect: "read"
20420
+ },
20421
+ write: {
20422
+ cap: "app.storage.write",
20423
+ requires: ["app.storage"],
20424
+ effect: "write"
20425
+ },
20426
+ reset: {
20427
+ cap: "app.storage.write",
20428
+ requires: ["app.storage"],
20429
+ effect: "write"
20430
+ }
20431
+ }
20432
+ },
20433
+ MEDIA: {
20434
+ name: "MEDIA",
20435
+ operations: {
20436
+ models: {
20437
+ cap: "app.media.read",
20438
+ requires: ["media.generation"],
20439
+ effect: "read"
20440
+ },
20441
+ generate: {
20442
+ cap: "app.media.generate",
20443
+ requires: ["media.generation", "computer.writeFile"],
20444
+ effect: "write"
20445
+ }
20754
20446
  }
20755
- return new ZodEnum({
20756
- ...def,
20757
- checks: [],
20758
- ...util_exports.normalizeParams(params),
20759
- entries: newEntries
20760
- });
20761
- };
20762
- });
20763
- function _enum2(values, params) {
20764
- const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
20765
- return new ZodEnum({
20766
- type: "enum",
20767
- entries,
20768
- ...util_exports.normalizeParams(params)
20769
- });
20770
- }
20771
- var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
20772
- $ZodLiteral.init(inst, def);
20773
- ZodType.init(inst, def);
20774
- inst._zod.processJSONSchema = (ctx, json2, params) => literalProcessor(inst, ctx, json2, params);
20775
- inst.values = new Set(def.values);
20776
- Object.defineProperty(inst, "value", {
20777
- get() {
20778
- if (def.values.length > 1) {
20779
- throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
20447
+ },
20448
+ COMPUTER: {
20449
+ name: "COMPUTER",
20450
+ operations: {
20451
+ list: {
20452
+ cap: "app.computer.read",
20453
+ requires: ["computer.list"],
20454
+ effect: "read"
20455
+ },
20456
+ read: {
20457
+ cap: "app.computer.read",
20458
+ requires: ["computer.readFile"],
20459
+ effect: "read"
20460
+ },
20461
+ ports: {
20462
+ cap: "app.computer.read",
20463
+ requires: ["computer.execute"],
20464
+ effect: "read"
20465
+ },
20466
+ processes: {
20467
+ cap: "app.computer.read",
20468
+ requires: ["computer.execute"],
20469
+ effect: "read"
20470
+ },
20471
+ gitChanges: {
20472
+ cap: "app.computer.read",
20473
+ requires: ["computer.readFile"],
20474
+ effect: "read"
20475
+ },
20476
+ write: {
20477
+ cap: "app.computer.write",
20478
+ requires: ["computer.writeFile"],
20479
+ effect: "write"
20480
+ },
20481
+ mkdir: {
20482
+ cap: "app.computer.write",
20483
+ requires: ["computer.writeFile"],
20484
+ effect: "write"
20485
+ },
20486
+ move: {
20487
+ cap: "app.computer.write",
20488
+ requires: ["computer.writeFile"],
20489
+ effect: "write"
20490
+ },
20491
+ preview: {
20492
+ cap: "app.computer.exec",
20493
+ requires: ["computer.execute"],
20494
+ effect: "write"
20495
+ },
20496
+ processKill: {
20497
+ cap: "app.computer.exec",
20498
+ requires: ["computer.execute"],
20499
+ effect: "write"
20500
+ },
20501
+ processStart: {
20502
+ cap: "app.computer.exec",
20503
+ requires: ["computer.execute"],
20504
+ effect: "write"
20505
+ },
20506
+ exec: {
20507
+ cap: "app.computer.exec",
20508
+ requires: ["computer.execute"],
20509
+ effect: "write"
20780
20510
  }
20781
- return def.values[0];
20782
20511
  }
20783
- });
20784
- });
20785
- function literal2(value, params) {
20786
- return new ZodLiteral({
20787
- type: "literal",
20788
- values: Array.isArray(value) ? value : [value],
20789
- ...util_exports.normalizeParams(params)
20790
- });
20791
- }
20792
- var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
20793
- $ZodTransform.init(inst, def);
20794
- ZodType.init(inst, def);
20795
- inst._zod.processJSONSchema = (ctx, json2, params) => transformProcessor(inst, ctx, json2, params);
20796
- inst._zod.parse = (payload, _ctx) => {
20797
- if (_ctx.direction === "backward") {
20798
- throw new $ZodEncodeError(inst.constructor.name);
20512
+ },
20513
+ INBOX: {
20514
+ name: "INBOX",
20515
+ operations: {
20516
+ page: { cap: "inbox.read", requires: ["agent.read"], effect: "read" },
20517
+ visit: { cap: "inbox.visit", requires: ["agent.read"], effect: "write" }
20799
20518
  }
20800
- payload.addIssue = (issue2) => {
20801
- if (typeof issue2 === "string") {
20802
- payload.issues.push(util_exports.issue(issue2, payload.value, def));
20803
- } else {
20804
- const _issue2 = issue2;
20805
- if (_issue2.fatal)
20806
- _issue2.continue = false;
20807
- _issue2.code ?? (_issue2.code = "custom");
20808
- _issue2.input ?? (_issue2.input = payload.value);
20809
- _issue2.inst ?? (_issue2.inst = inst);
20810
- payload.issues.push(util_exports.issue(_issue2));
20519
+ },
20520
+ AGENTS: {
20521
+ name: "AGENTS",
20522
+ operations: {
20523
+ list: { cap: "agent.list", requires: ["agent.list"], effect: "read" },
20524
+ send: { cap: "agent.send", requires: ["agent.send"], effect: "write" },
20525
+ schedules: {
20526
+ cap: "agent.read",
20527
+ requires: ["agent.read"],
20528
+ effect: "read"
20529
+ },
20530
+ pauseSchedule: {
20531
+ cap: "agent.manage",
20532
+ requires: ["agent.manage"],
20533
+ effect: "write"
20534
+ },
20535
+ resumeSchedule: {
20536
+ cap: "agent.manage",
20537
+ requires: ["agent.manage"],
20538
+ effect: "write"
20539
+ },
20540
+ deleteSchedule: {
20541
+ cap: "agent.manage",
20542
+ requires: ["agent.manage"],
20543
+ effect: "write"
20811
20544
  }
20812
- };
20813
- const output = def.transform(payload.value, payload);
20814
- if (output instanceof Promise) {
20815
- return output.then((output2) => {
20816
- payload.value = output2;
20817
- payload.fallback = true;
20818
- return payload;
20819
- });
20820
20545
  }
20821
- payload.value = output;
20822
- payload.fallback = true;
20823
- return payload;
20824
- };
20546
+ }
20547
+ };
20548
+
20549
+ // ../puffball/dist/app-vocabulary.js
20550
+ var appRoles = [
20551
+ "dashboard",
20552
+ "inbox",
20553
+ "files",
20554
+ "media",
20555
+ "sessions",
20556
+ "terminal"
20557
+ ];
20558
+ var appCapabilityIds = [
20559
+ "approvals",
20560
+ "agent.list",
20561
+ "agent.manage",
20562
+ "agent.rename",
20563
+ "agent.avatar",
20564
+ "agent.instructions",
20565
+ "agent.toolPolicy",
20566
+ "agent.read",
20567
+ "agent.send",
20568
+ "computer.list",
20569
+ "computer.readFile",
20570
+ "computer.writeFile",
20571
+ "computer.execute",
20572
+ "llm.generation",
20573
+ "media.generation",
20574
+ "media.share",
20575
+ "games:servers",
20576
+ "git.repository",
20577
+ "apps.open",
20578
+ "apps.call",
20579
+ "app.storage",
20580
+ "app.events.emit",
20581
+ "team.workbenchHost",
20582
+ "marketplace.browse",
20583
+ "marketplace.purchase",
20584
+ "workflow.run",
20585
+ "workflow.publish",
20586
+ "workflow.arm",
20587
+ "world",
20588
+ "channels.read",
20589
+ "channels.personal.manage"
20590
+ ];
20591
+ var appHandlers = ["file.open"];
20592
+ var appStorageScopes = ["team", "member"];
20593
+ var emptyAppDeclaration = Object.freeze({
20594
+ capabilities: [],
20595
+ handlers: [],
20596
+ roles: []
20825
20597
  });
20826
- function transform3(fn2) {
20827
- return new ZodTransform({
20828
- type: "transform",
20829
- transform: fn2
20598
+
20599
+ // ../puffball/dist/app-api.js
20600
+ var appApiMethodNameSchema = String4.check(makeFilter2(isAppApiMethodName));
20601
+ function isJsonContainer(value) {
20602
+ return value !== null && typeof value === "object";
20603
+ }
20604
+ function withinDepth(value, depth = 0) {
20605
+ if (depth > 16)
20606
+ return false;
20607
+ if (isJsonContainer(value)) {
20608
+ for (const child of Object.values(value))
20609
+ if (!withinDepth(child, depth + 1))
20610
+ return false;
20611
+ }
20612
+ return true;
20613
+ }
20614
+ var projection = JsonObject.pipe(check(makeFilter2((value) => new TextEncoder().encode(JSON.stringify(value)).byteLength <= 2e4 && withinDepth(value), { message: "App API schema exceeds its byte or depth bound" })));
20615
+ var eventName = String4.check(isMinLength(1), isMaxLength(128));
20616
+ var method = Struct({
20617
+ description: String4.pipe(check(isMinLength(1)), check(isMaxLength(1e3))),
20618
+ input: projection,
20619
+ output: projection,
20620
+ pending: optional2(Literal2(true)),
20621
+ hidden: optional2(Literal2(true)),
20622
+ present: optional2(Struct({
20623
+ verb: String4.check(isMinLength(1), isMaxLength(32))
20624
+ })),
20625
+ effect: Literals(["read", "write", "external"]),
20626
+ requires: ArraySchema(Literals(appCapabilityIds)).pipe(check(makeFilter2((values) => new Set(values).size === values.length)))
20627
+ });
20628
+ var appApiSchema = Struct({
20629
+ methods: Record(String4, method).pipe(check(makeFilter2((methods) => Object.keys(methods).every(is2(appApiMethodNameSchema)), { message: "Invalid App API method name" })), check(makeFilter2((methods) => Object.keys(methods).length <= 64)), check(makeFilter2((methods) => {
20630
+ const names = Object.keys(methods);
20631
+ return names.every((name) => !names.some((other) => other.startsWith(`${name}.`)));
20632
+ }, { message: "App API method name is also a method group" }))),
20633
+ toolFamily: optionalKey2(Struct({
20634
+ name: appApiMethodNameSchema.check(makeFilter2((name) => !name.includes("."))),
20635
+ list: appApiMethodNameSchema,
20636
+ call: appApiMethodNameSchema
20637
+ })),
20638
+ events: optionalKey2(Record(String4, Struct({
20639
+ description: String4.check(isMinLength(1), isMaxLength(1e3)),
20640
+ payload: projection
20641
+ })).check(makeFilter2((events) => Object.keys(events).every(is2(eventName)), { message: "Invalid App API event name" }), makeFilter2((events) => Object.keys(events).length <= 64)))
20642
+ }).pipe(check(makeFilter2((api) => {
20643
+ if (api.toolFamily === void 0)
20644
+ return true;
20645
+ const { name, list, call } = api.toolFamily;
20646
+ const listing = api.methods[list];
20647
+ const operation = api.methods[call];
20648
+ return listing?.effect === "read" && operation !== void 0 && operation.effect !== "external" && operation.hidden !== true && !Object.keys(api.methods).some((method2) => method2.split(".")[0] === name);
20649
+ }, {
20650
+ message: "Tool family must reference declared callable methods in a distinct namespace"
20651
+ })), check(makeFilter2((api) => new TextEncoder().encode(JSON.stringify(api)).byteLength <= 256e3, { message: "App API exceeds its total byte bound" })));
20652
+
20653
+ // ../puffball/dist/app-backend-bindings.js
20654
+ var unique = (values) => new Set(values).size === values.length;
20655
+ function bindingKind(name, operations) {
20656
+ const names = Object.keys(operations);
20657
+ for (const operation of names)
20658
+ decodeUnknownSync(appApiMethodNameSchema)(operation);
20659
+ const declaration3 = Struct({
20660
+ name: Literal2(name),
20661
+ operations: ArraySchema(Literals(names)).pipe(check(isMinLength(1)), check(isMaxLength(names.length)), check(makeFilter2(unique)))
20830
20662
  });
20831
- }
20832
- var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
20833
- $ZodOptional.init(inst, def);
20834
- ZodType.init(inst, def);
20835
- inst._zod.processJSONSchema = (ctx, json2, params) => optionalProcessor(inst, ctx, json2, params);
20836
- inst.unwrap = () => inst._zod.def.innerType;
20837
- });
20838
- function optional4(innerType) {
20839
- return new ZodOptional({
20840
- type: "optional",
20841
- innerType
20663
+ const shard = Struct({
20664
+ name: Literal2(name),
20665
+ operations: ArraySchema(Union2(Object.entries(operations).map(([name2, operation]) => Struct({
20666
+ name: Literal2(name2),
20667
+ cap: Literal2(operation.cap)
20668
+ })))).pipe(check(isMinLength(1)), check(isMaxLength(names.length)), check(makeFilter2((ops) => unique(ops.map((op) => op.name)), {
20669
+ message: "App backend operation repeated"
20670
+ })))
20842
20671
  });
20672
+ return { declaration: declaration3, shard };
20843
20673
  }
20844
- var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
20845
- $ZodExactOptional.init(inst, def);
20846
- ZodType.init(inst, def);
20847
- inst._zod.processJSONSchema = (ctx, json2, params) => optionalProcessor(inst, ctx, json2, params);
20848
- inst.unwrap = () => inst._zod.def.innerType;
20849
- });
20850
- function exactOptional(innerType) {
20851
- return new ZodExactOptional({
20852
- type: "optional",
20853
- innerType
20854
- });
20674
+ var kinds = Object.values(appBackendBindingKinds).map((kind) => bindingKind(kind.name, kind.operations));
20675
+ var count = kinds.length;
20676
+ var appBackendBindingsSchema = ArraySchema(Union2(kinds.map((kind) => kind.declaration))).pipe(check(isMaxLength(count)), check(makeFilter2((bindings) => unique(bindings.map((binding) => binding.name)))));
20677
+ var appBackendShardBindingsSchema = ArraySchema(Union2(kinds.map((kind) => kind.shard))).pipe(check(isMaxLength(count)), check(makeFilter2((bindings) => unique(bindings.map((binding) => binding.name)))));
20678
+ var operationCatalog = new Map(Object.entries(appBackendBindingKinds).map(([name, operations]) => [
20679
+ name,
20680
+ new Map(Object.entries(operations.operations))
20681
+ ]));
20682
+ function appBackendBindingOperation(name, operation) {
20683
+ return operationCatalog.get(name)?.get(operation);
20855
20684
  }
20856
- var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
20857
- $ZodNullable.init(inst, def);
20858
- ZodType.init(inst, def);
20859
- inst._zod.processJSONSchema = (ctx, json2, params) => nullableProcessor(inst, ctx, json2, params);
20860
- inst.unwrap = () => inst._zod.def.innerType;
20685
+
20686
+ // ../gills/dist/rows.js
20687
+ var rowLabelSchemaV1 = String4.pipe(check(isMinLength(1)), check(isMaxLength(4096)));
20688
+ var rowIdentitySchemaV1 = String4.pipe(check(isMinLength(1)), check(isMaxLength(513)));
20689
+ var rowOpenSchemaV1 = Struct({
20690
+ params: ArraySchema(Struct({
20691
+ key: String4.check(isMinLength(1), isMaxLength(64)),
20692
+ value: String4.check(isMaxLength(4096))
20693
+ })).check(isMaxLength(16))
20861
20694
  });
20862
- function nullable2(innerType) {
20863
- return new ZodNullable({
20864
- type: "nullable",
20865
- innerType
20866
- });
20867
- }
20868
- var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
20869
- $ZodDefault.init(inst, def);
20870
- ZodType.init(inst, def);
20871
- inst._zod.processJSONSchema = (ctx, json2, params) => defaultProcessor(inst, ctx, json2, params);
20872
- inst.unwrap = () => inst._zod.def.innerType;
20873
- inst.removeDefault = inst.unwrap;
20695
+ var rowSchemaV1 = Struct({
20696
+ id: rowIdentitySchemaV1,
20697
+ title: rowLabelSchemaV1,
20698
+ detail: optional2(String4.pipe(check(isMaxLength(1024)))),
20699
+ tone: optional2(Literals(["attention", "running", "error", "settled", "muted"])),
20700
+ /** App-owned status text with the semantic colors used by Caps Status. */
20701
+ status: optional2(Struct({
20702
+ label: rowLabelSchemaV1,
20703
+ tone: Literals([
20704
+ "neutral",
20705
+ "primary",
20706
+ "secondary",
20707
+ "accent",
20708
+ "success",
20709
+ "info",
20710
+ "warning",
20711
+ "error"
20712
+ ])
20713
+ })),
20714
+ /** The host supplies this Gill's App identity; rows only select its view. */
20715
+ open: optional2(rowOpenSchemaV1)
20874
20716
  });
20875
- function _default(innerType, defaultValue) {
20876
- return new ZodDefault({
20877
- type: "default",
20878
- innerType,
20879
- get defaultValue() {
20880
- return typeof defaultValue === "function" ? defaultValue() : util_exports.shallowClone(defaultValue);
20881
- }
20882
- });
20883
- }
20884
- var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
20885
- $ZodPrefault.init(inst, def);
20886
- ZodType.init(inst, def);
20887
- inst._zod.processJSONSchema = (ctx, json2, params) => prefaultProcessor(inst, ctx, json2, params);
20888
- inst.unwrap = () => inst._zod.def.innerType;
20717
+ var rowPageSchemaV1 = ArraySchema(rowSchemaV1).pipe(check(isMaxLength(200)));
20718
+ var resultRowSchemaV1 = Struct({
20719
+ ...rowSchemaV1.fields,
20720
+ /** A Computer file the receiving host may preview; the host authorizes the read. */
20721
+ media: optional2(Struct({
20722
+ path: rowLabelSchemaV1,
20723
+ format: Literals(["fungi:image", "fungi:video"])
20724
+ }))
20889
20725
  });
20890
- function prefault(innerType, defaultValue) {
20891
- return new ZodPrefault({
20892
- type: "prefault",
20893
- innerType,
20894
- get defaultValue() {
20895
- return typeof defaultValue === "function" ? defaultValue() : util_exports.shallowClone(defaultValue);
20896
- }
20897
- });
20898
- }
20899
- var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
20900
- $ZodNonOptional.init(inst, def);
20901
- ZodType.init(inst, def);
20902
- inst._zod.processJSONSchema = (ctx, json2, params) => nonoptionalProcessor(inst, ctx, json2, params);
20903
- inst.unwrap = () => inst._zod.def.innerType;
20726
+
20727
+ // ../gills/dist/declaration.js
20728
+ var isUnique = (values) => new Set(values).size === values.length;
20729
+ var meaningful = String4.pipe(check(isMaxLength(256)), check(makeFilter2((value) => value.trim().length > 0, {
20730
+ message: "Declared command text must not be blank"
20731
+ })));
20732
+ var appGillParamKeySchema = meaningful.pipe(check(isMaxLength(64)));
20733
+ var appGillParamSchema = Struct({
20734
+ key: appGillParamKeySchema,
20735
+ label: meaningful,
20736
+ kind: Literals(["computer", "repository", "branch"]),
20737
+ required: Boolean3,
20738
+ options: optional2(meaningful)
20739
+ }).check(makeFilter2((param) => param.kind !== "computer" || param.options === void 0, {
20740
+ message: "Computer options are host-owned"
20741
+ }));
20742
+ var appGillParamsSchema = ArraySchema(appGillParamSchema).check(isMaxLength(4), makeFilter2((params) => isUnique(params.map((param) => param.key)), {
20743
+ message: "Gill parameter keys must be unique"
20744
+ }));
20745
+ var appGillWatchSchema = Union2([
20746
+ Struct({ storage: meaningful }),
20747
+ Struct({ binding: meaningful })
20748
+ ]);
20749
+ var appDeclaredGillSchema = Struct({
20750
+ id: meaningful.pipe(check(makeFilter2((id) => !id.includes(":"), {
20751
+ message: "Gill IDs are App-local"
20752
+ }))),
20753
+ title: meaningful,
20754
+ source: meaningful,
20755
+ params: optional2(appGillParamsSchema),
20756
+ watch: optional2(appGillWatchSchema),
20757
+ desktop: optional2(Struct({
20758
+ sizes: ArraySchema(Literals(["S", "M", "L"])).check(isMinLength(1), isMaxLength(3), makeFilter2(isUnique, {
20759
+ message: "Desktop Gill sizes must be unique"
20760
+ }))
20761
+ }))
20904
20762
  });
20905
- function nonoptional(innerType, params) {
20906
- return new ZodNonOptional({
20907
- type: "nonoptional",
20908
- innerType,
20909
- ...util_exports.normalizeParams(params)
20910
- });
20911
- }
20912
- var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
20913
- $ZodCatch.init(inst, def);
20914
- ZodType.init(inst, def);
20915
- inst._zod.processJSONSchema = (ctx, json2, params) => catchProcessor(inst, ctx, json2, params);
20916
- inst.unwrap = () => inst._zod.def.innerType;
20917
- inst.removeCatch = inst.unwrap;
20763
+
20764
+ // ../gills/dist/gill.js
20765
+ var gillParamsSchema = Record(appGillParamKeySchema, String4.check(isMaxLength(256))).check(makeFilter2((params) => Object.keys(params).length <= 4, {
20766
+ message: "Gill placement supports at most four parameters"
20767
+ }));
20768
+ var gillRequestSchema = Struct({
20769
+ viewId: rowIdentitySchemaV1,
20770
+ params: optional2(gillParamsSchema),
20771
+ after: optional2(String4.check(isMaxLength(1024))),
20772
+ options: optional2(appGillParamKeySchema)
20773
+ });
20774
+ var gillCallSchema = Struct({
20775
+ id: rowIdentitySchemaV1,
20776
+ params: optional2(gillParamsSchema),
20777
+ after: optional2(String4.check(isMaxLength(1024))),
20778
+ options: optional2(appGillParamKeySchema)
20779
+ });
20780
+ var gillResponseSchema = Union2([
20781
+ Struct({
20782
+ viewId: rowIdentitySchemaV1,
20783
+ title: rowLabelSchemaV1,
20784
+ state: Literal2("empty"),
20785
+ rows: Tuple([]),
20786
+ /** One line naming the first action, in the App's own words. */
20787
+ emptyText: optional2(String4.pipe(check(isMinLength(1)), check(isMaxLength(120)))),
20788
+ /** The host supplies the button; the App only says it belongs. */
20789
+ action: optional2(Struct({ kind: Literal2("open") })),
20790
+ next: optional2(String4.pipe(check(isMaxLength(1024))))
20791
+ }),
20792
+ Struct({
20793
+ viewId: rowIdentitySchemaV1,
20794
+ title: rowLabelSchemaV1,
20795
+ state: Literal2("error"),
20796
+ rows: Tuple([]),
20797
+ /** Host-owned permanent execution refusal; an ordinary error may still be refreshed. */
20798
+ reason: optional2(Literals([
20799
+ "exec_isolation_required",
20800
+ "params_required",
20801
+ "disabled"
20802
+ ])),
20803
+ error: String4.pipe(check(isMinLength(1)), check(isMaxLength(512))),
20804
+ /** The host supplies the same-placement picker and this App's launch. */
20805
+ recovery: optional2(Union2([
20806
+ Struct({
20807
+ kind: Literal2("configure"),
20808
+ param: appGillParamKeySchema
20809
+ }),
20810
+ Struct({ kind: Literal2("open") })
20811
+ ]))
20812
+ }),
20813
+ Struct({
20814
+ viewId: rowIdentitySchemaV1,
20815
+ title: rowLabelSchemaV1,
20816
+ state: Literal2("full"),
20817
+ rows: rowPageSchemaV1.pipe(check(isMinLength(1))),
20818
+ next: optional2(String4.pipe(check(isMaxLength(1024))))
20819
+ })
20820
+ ]);
20821
+ var decodeGillResponse = decodeUnknownSync(gillResponseSchema, {
20822
+ onExcessProperty: "error"
20823
+ });
20824
+ var gillOptionsResponseSchema = Struct({
20825
+ options: ArraySchema(Struct({
20826
+ value: String4.check(isMaxLength(256)),
20827
+ label: rowLabelSchemaV1,
20828
+ detail: optional2(String4.check(isMaxLength(1024)))
20829
+ })).check(isMaxLength(200)),
20830
+ next: optional2(String4.check(isMaxLength(1024)))
20918
20831
  });
20919
- function _catch(innerType, catchValue) {
20920
- return new ZodCatch({
20921
- type: "catch",
20922
- innerType,
20923
- catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
20924
- });
20925
- }
20926
- var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
20927
- $ZodPipe.init(inst, def);
20928
- ZodType.init(inst, def);
20929
- inst._zod.processJSONSchema = (ctx, json2, params) => pipeProcessor(inst, ctx, json2, params);
20930
- inst.in = def.in;
20931
- inst.out = def.out;
20832
+ var gillReplySchema = Union2([
20833
+ gillResponseSchema,
20834
+ gillOptionsResponseSchema
20835
+ ]);
20836
+ var decodeGillReply = decodeUnknownSync(gillReplySchema, {
20837
+ onExcessProperty: "error"
20932
20838
  });
20933
- function pipe(in_, out) {
20934
- return new ZodPipe({
20935
- type: "pipe",
20936
- in: in_,
20937
- out
20938
- // ...util.normalizeParams(params),
20939
- });
20940
- }
20941
- var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
20942
- $ZodReadonly.init(inst, def);
20943
- ZodType.init(inst, def);
20944
- inst._zod.processJSONSchema = (ctx, json2, params) => readonlyProcessor(inst, ctx, json2, params);
20945
- inst.unwrap = () => inst._zod.def.innerType;
20839
+ var decodeGillOptionsResponse = decodeUnknownSync(gillOptionsResponseSchema, { onExcessProperty: "error" });
20840
+
20841
+ // ../puffball/dist/app-declaration.js
20842
+ var appRoleSchema = Literals(appRoles);
20843
+ var appCapabilityIdSchema = Literals(appCapabilityIds);
20844
+ var appHandlerSchema = Literals(appHandlers);
20845
+ var unique2 = {
20846
+ message: "App declaration entries must be unique"
20847
+ };
20848
+ var isUnique2 = (values) => new Set(values).size === values.length;
20849
+ var reservedBindings = /* @__PURE__ */ new Set([
20850
+ "super+k",
20851
+ "meta+k",
20852
+ "cmd+k",
20853
+ "mod+k",
20854
+ "ctrl+k",
20855
+ "control+k"
20856
+ ]);
20857
+ var meaningful2 = String4.pipe(check(isMaxLength(256)), check(makeFilter2((value) => value.trim().length > 0, {
20858
+ message: "Declared command text must not be blank"
20859
+ })));
20860
+ var order = { order: optional2(Int) };
20861
+ var ordered = Struct(order);
20862
+ var appDeclaredCommandSchema = Struct({
20863
+ id: meaningful2.pipe(check(makeFilter2((id) => !id.includes(":"), {
20864
+ message: "Declared command IDs are namespace-local"
20865
+ }))),
20866
+ title: meaningful2,
20867
+ category: meaningful2,
20868
+ description: optional2(String4.pipe(check(isMaxLength(1024)))),
20869
+ sigil: optional2(meaningful2.pipe(check(isMaxLength(64)))),
20870
+ projections: optional2(Struct({
20871
+ bindings: optional2(Struct({
20872
+ ...order,
20873
+ values: ArraySchema(meaningful2).pipe(check(isMaxLength(16)), check(makeFilter2((values) => !values.some((binding) => reservedBindings.has(binding.trim().toLowerCase())), { message: "Apps cannot bind the reserved leader chord" })))
20874
+ })),
20875
+ agent: optional2(Struct({ ...order, keybind: optional2(String4) })),
20876
+ help: optional2(ordered),
20877
+ menu: optional2(ordered),
20878
+ palette: optional2(ordered),
20879
+ slash: optional2(Struct({
20880
+ ...order,
20881
+ aliases: ArraySchema(meaningful2).pipe(check(isMaxLength(16)))
20882
+ }))
20883
+ }))
20946
20884
  });
20947
- function readonly(innerType) {
20948
- return new ZodReadonly({
20949
- type: "readonly",
20950
- innerType
20951
- });
20952
- }
20953
- var ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
20954
- $ZodLazy.init(inst, def);
20955
- ZodType.init(inst, def);
20956
- inst._zod.processJSONSchema = (ctx, json2, params) => lazyProcessor(inst, ctx, json2, params);
20957
- inst.unwrap = () => inst._zod.def.getter();
20885
+ var commandsAreUnique = (commands) => isUnique2(commands.map((command) => command.id)) && isUnique2(commands.flatMap((command) => command.projections?.slash?.aliases ?? []));
20886
+ var gillsAreUnique = (gills) => isUnique2(gills.map((gill) => gill.id));
20887
+ var appStorageKeyNameSchema = String4.check(isPattern2(/^[a-z][a-z0-9.-]{0,63}$/));
20888
+ var storageKeyFields = Struct({
20889
+ key: appStorageKeyNameSchema,
20890
+ scopes: ArraySchema(Literals(appStorageScopes)).check(isMinLength(1), makeFilter2(isUnique2, unique2)),
20891
+ maxBytes: Int.check(isBetween({ minimum: 1, maximum: 65536 }))
20958
20892
  });
20959
- function lazy(getter) {
20960
- return new ZodLazy({
20961
- type: "lazy",
20962
- getter
20963
- });
20964
- }
20965
- var ZodFunction = /* @__PURE__ */ $constructor("ZodFunction", (inst, def) => {
20966
- $ZodFunction.init(inst, def);
20967
- ZodType.init(inst, def);
20968
- inst._zod.processJSONSchema = (ctx, json2, params) => functionProcessor(inst, ctx, json2, params);
20893
+ var appStorageKeySchema = declareConstructor()([storageKeyFields], ([fields]) => (input, _self, options) => decodeUnknownEffect(fields)(input, {
20894
+ ...options,
20895
+ onExcessProperty: "error"
20896
+ }), {
20897
+ toCodecJson: () => new Link(storageKeyFields.ast, passthrough2())
20969
20898
  });
20970
- function _function(params) {
20971
- return new ZodFunction({
20972
- type: "function",
20973
- input: Array.isArray(params?.input) ? tuple2(params?.input) : params?.input ?? array2(unknown2()),
20974
- output: params?.output ?? unknown2()
20975
- });
20976
- }
20977
- var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
20978
- $ZodCustom.init(inst, def);
20979
- ZodType.init(inst, def);
20980
- inst._zod.processJSONSchema = (ctx, json2, params) => customProcessor(inst, ctx, json2, params);
20899
+ var appCallFields = Struct({
20900
+ appId: String4.check(isMinLength(1), isMaxLength(128)),
20901
+ methods: ArraySchema(appApiMethodNameSchema).check(isMinLength(1), isMaxLength(16), makeFilter2(isUnique2, unique2))
20981
20902
  });
20982
- function custom(fn2, _params) {
20983
- return _custom(ZodCustom, fn2 ?? (() => true), _params);
20984
- }
20985
- function refine3(fn2, _params = {}) {
20986
- return _refine(ZodCustom, fn2, _params);
20903
+ var appCallSchema = declareConstructor()([appCallFields], ([fields]) => (input, _self, options) => decodeUnknownEffect(fields)(input, {
20904
+ ...options,
20905
+ onExcessProperty: "error"
20906
+ }), {
20907
+ toCodecJson: () => new Link(appCallFields.ast, passthrough2())
20908
+ });
20909
+ var appCallsSchema = ArraySchema(appCallSchema).check(isMinLength(1), isMaxLength(16), makeFilter2((calls) => isUnique2(calls.map((call) => call.appId)), unique2));
20910
+ var appDeclarationSchema = Struct({
20911
+ api: optionalKey2(appApiSchema),
20912
+ displayName: optional2(String4.pipe(check(isMinLength(1)), check(isMaxLength(64)))),
20913
+ capabilities: ArraySchema(appCapabilityIdSchema).pipe(check(makeFilter2(isUnique2, unique2))),
20914
+ calls: optionalKey2(appCallsSchema),
20915
+ guidance: optional2(String4.pipe(check(isMinLength(1)), check(isMaxLength(12e3)))),
20916
+ handlers: ArraySchema(appHandlerSchema).pipe(check(makeFilter2(isUnique2, unique2))),
20917
+ receives: optionalKey2(ArraySchema(Literal2("git.push")).check(isMaxLength(1), makeFilter2(isUnique2, unique2))),
20918
+ icon: optionalKey2(String4.pipe(check(isMinLength(1)), check(isMaxLength(80)))),
20919
+ roles: ArraySchema(appRoleSchema).pipe(check(makeFilter2(isUnique2, unique2))),
20920
+ storage: optionalKey2(ArraySchema(appStorageKeySchema).check(isMaxLength(16), makeFilter2((keys) => isUnique2(keys.map((entry) => entry.key)), unique2))),
20921
+ commands: optional2(ArraySchema(appDeclaredCommandSchema).pipe(check(isMaxLength(64)), check(makeFilter2(commandsAreUnique, {
20922
+ message: "Declared command IDs and slash aliases must be unique"
20923
+ })))),
20924
+ gills: optional2(ArraySchema(appDeclaredGillSchema).pipe(check(isMaxLength(16)), check(makeFilter2(gillsAreUnique, {
20925
+ message: "Declared Gill IDs must be unique"
20926
+ })))),
20927
+ backend: optional2(Struct({
20928
+ bindings: appBackendBindingsSchema,
20929
+ sync: optionalKey2(Struct({ method: appApiMethodNameSchema }))
20930
+ }))
20931
+ }).pipe(check(makeFilter2((declaration3) => declaration3.calls === void 0 || declaration3.capabilities.includes("apps.call"), { message: "App calls require apps.call" })), check(makeFilter2((declaration3) => declaration3.backend?.bindings.every((binding) => binding.name !== "BACKGROUND") ?? true, { message: "BACKGROUND is host-minted and cannot be declared by an App" })), check(makeFilter2((declaration3) => backgroundSyncAllowed(declaration3.api, declaration3.backend?.sync), {
20932
+ message: "Background continuation must be a declared write covering all write requirements"
20933
+ })), check(makeFilter2((declaration3) => !(declaration3.receives?.includes("git.push") ?? false) || declaration3.capabilities.includes("git.repository"), { message: "Git push reception requires git.repository" })), check(makeFilter2((declaration3) => declaration3.backend?.bindings.every((binding) => binding.operations.every((name) => appBackendBindingOperation(binding.name, name)?.requires.every((capability) => declaration3.capabilities.includes(capability)) === true)) ?? true, { message: "Backend bindings require declared App capabilities" })), check(makeFilter2((declaration3) => !declaration3.backend?.bindings.some((binding) => binding.name === "APP_STORAGE") || (declaration3.storage?.length ?? 0) > 0, { message: "App storage bindings require declared keys" })), check(makeFilter2((declaration3) => Object.values(declaration3.api?.methods ?? {}).every((method2) => method2.requires.every((capability) => declaration3.capabilities.includes(capability))), { message: "App API requires capabilities outside the App declaration" })));
20934
+
20935
+ // ../../node_modules/.pnpm/nanoid@5.1.16/node_modules/nanoid/index.js
20936
+ import { webcrypto as crypto2 } from "node:crypto";
20937
+ var POOL_SIZE_MULTIPLIER = 128;
20938
+ var pool;
20939
+ var poolOffset;
20940
+ function fillPool(bytes) {
20941
+ if (bytes < 0) throw new RangeError("Wrong ID size");
20942
+ try {
20943
+ if (!pool || pool.length < bytes) {
20944
+ pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
20945
+ crypto2.getRandomValues(pool);
20946
+ poolOffset = 0;
20947
+ } else if (poolOffset + bytes > pool.length) {
20948
+ crypto2.getRandomValues(pool);
20949
+ poolOffset = 0;
20950
+ }
20951
+ } catch (e) {
20952
+ pool = void 0;
20953
+ throw e;
20954
+ }
20955
+ poolOffset += bytes;
20987
20956
  }
20988
- function superRefine(fn2, params) {
20989
- return _superRefine(fn2, params);
20957
+ function random2(bytes) {
20958
+ fillPool(bytes |= 0);
20959
+ return pool.subarray(poolOffset - bytes, poolOffset);
20990
20960
  }
20991
- function _instanceof(cls, params = {}) {
20992
- const inst = new ZodCustom({
20993
- type: "custom",
20994
- check: "custom",
20995
- fn: (data) => data instanceof cls,
20996
- abort: true,
20997
- ...util_exports.normalizeParams(params)
20998
- });
20999
- inst._zod.bag.Class = cls;
21000
- inst._zod.check = (payload) => {
21001
- if (!(payload.value instanceof cls)) {
21002
- payload.issues.push({
21003
- code: "invalid_type",
21004
- expected: cls.name,
21005
- input: payload.value,
21006
- inst,
21007
- path: [...inst._zod.def.path ?? []]
21008
- });
20961
+ function customRandom(alphabet2, defaultSize, getRandom) {
20962
+ let safeByteCutoff = 256 - 256 % alphabet2.length;
20963
+ if (safeByteCutoff === 256) {
20964
+ let mask = alphabet2.length - 1;
20965
+ return (size = defaultSize) => {
20966
+ if (!size) return "";
20967
+ let id = "";
20968
+ while (true) {
20969
+ let bytes = getRandom(size);
20970
+ let i2 = size;
20971
+ while (i2--) {
20972
+ id += alphabet2[bytes[i2] & mask];
20973
+ if (id.length >= size) return id;
20974
+ }
20975
+ }
20976
+ };
20977
+ }
20978
+ let step = Math.ceil(1.6 * 256 * defaultSize / safeByteCutoff);
20979
+ return (size = defaultSize) => {
20980
+ if (!size) return "";
20981
+ let id = "";
20982
+ while (true) {
20983
+ let bytes = getRandom(step);
20984
+ let i2 = step;
20985
+ while (i2--) {
20986
+ if (bytes[i2] < safeByteCutoff) {
20987
+ id += alphabet2[bytes[i2] % alphabet2.length];
20988
+ if (id.length >= size) return id;
20989
+ }
20990
+ }
21009
20991
  }
21010
20992
  };
21011
- return inst;
20993
+ }
20994
+ function customAlphabet(alphabet2, size = 21) {
20995
+ return customRandom(alphabet2, size, random2);
21012
20996
  }
21013
20997
 
21014
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
21015
- config(en_default());
20998
+ // ../cairn/dist/nanoid.js
20999
+ var ALPHABET = "abcdefghijklmnopqrstuvwxyz0123456789";
21000
+ var DEFAULT = 21;
21001
+ function nanoid2(length = DEFAULT) {
21002
+ if (length === Number.POSITIVE_INFINITY || length === Number.NEGATIVE_INFINITY)
21003
+ throw new RangeError("nanoid length must be finite");
21004
+ return customAlphabet(ALPHABET, length)();
21005
+ }
21016
21006
 
21017
21007
  // ../cairn/dist/input-schema.js
21018
21008
  var FAMILY_OR_KIND_PATTERN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
21019
21009
  var PREFIX_PATTERN = /^[a-z][a-z0-9]*(?:_[a-z][a-z0-9]*)*$/;
21020
- var familySchema = string5().min(1).max(64).regex(FAMILY_OR_KIND_PATTERN);
21021
- var kindSchema = string5().min(1).max(64).regex(FAMILY_OR_KIND_PATTERN);
21022
- var prefixSchema = string5().min(1).max(32).regex(PREFIX_PATTERN);
21023
- var kindDefinitionSchema = object2({
21010
+ var familySchema = string4().min(1).max(64).regex(FAMILY_OR_KIND_PATTERN);
21011
+ var kindSchema = string4().min(1).max(64).regex(FAMILY_OR_KIND_PATTERN);
21012
+ var prefixSchema = string4().min(1).max(32).regex(PREFIX_PATTERN);
21013
+ var kindDefinitionSchema = object({
21024
21014
  /** Lowercase wire prefix for this kind. */
21025
21015
  prefix: prefixSchema
21026
21016
  });
21027
- var identifierDefinitionSchema = object2({
21017
+ var identifierDefinitionSchema = object({
21028
21018
  /** Caller-owned family name. */
21029
21019
  family: familySchema,
21030
21020
  /** Supported wire grammar version. */
21031
- version: literal2(1),
21021
+ version: literal(1),
21032
21022
  /** Kind declarations with unique wire prefixes. */
21033
21023
  kinds: record2(kindSchema, kindDefinitionSchema)
21034
21024
  }).superRefine((definition, context3) => {
@@ -21052,7 +21042,7 @@ var identifierDefinitionSchema = object2({
21052
21042
  prefixes.add(kind.prefix);
21053
21043
  }
21054
21044
  });
21055
- var identifierCandidateSchema = string5();
21045
+ var identifierCandidateSchema = string4();
21056
21046
 
21057
21047
  // ../cairn/dist/internal/identifier-codec.js
21058
21048
  var SUFFIX_PATTERN = /^[a-z0-9]+$/;
@@ -21140,10 +21130,10 @@ function createIdentifierCodec(input) {
21140
21130
  }
21141
21131
 
21142
21132
  // ../cairn/dist/identifier.js
21143
- var codecMapSchema = record2(string5(), object2({
21144
- family: string5(),
21145
- kind: string5(),
21146
- version: literal2(1),
21133
+ var codecMapSchema = record2(string4(), object({
21134
+ family: string4(),
21135
+ kind: string4(),
21136
+ version: literal(1),
21147
21137
  generate: _function(),
21148
21138
  schema: _instanceof(ZodType),
21149
21139
  parse: _function(),