@clawsaga/cli 0.1.21 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/clawsaga.mjs CHANGED
@@ -19,9 +19,9 @@ var __commonJS = (cb, mod) => function __require2() {
19
19
  throw mod = 0, e;
20
20
  }
21
21
  };
22
- var __export = (target5, all) => {
22
+ var __export = (target2, all) => {
23
23
  for (var name in all)
24
- __defProp(target5, name, { get: all[name], enumerable: true });
24
+ __defProp(target2, name, { get: all[name], enumerable: true });
25
25
  };
26
26
  var __copyProps = (to, from, except, desc) => {
27
27
  if (from && typeof from === "object" || typeof from === "function") {
@@ -31,12 +31,12 @@ var __copyProps = (to, from, except, desc) => {
31
31
  }
32
32
  return to;
33
33
  };
34
- var __toESM = (mod, isNodeMode, target5) => (target5 = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
34
+ var __toESM = (mod, isNodeMode, target2) => (target2 = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
35
35
  // If the importer is in node compatibility mode or this is not an ESM
36
36
  // file that has been converted to a CommonJS file using a Babel-
37
37
  // compatible transform (i.e. "__esModule" has not been set), then set
38
38
  // "default" to the CommonJS "module.exports" for node compatibility.
39
- isNodeMode || !mod || !mod.__esModule ? __defProp(target5, "default", { value: mod, enumerable: true }) : target5,
39
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target2, "default", { value: mod, enumerable: true }) : target2,
40
40
  mod
41
41
  ));
42
42
 
@@ -248,8 +248,8 @@ var require_polyfills = __commonJS({
248
248
  }
249
249
  function chmodFix(orig) {
250
250
  if (!orig) return orig;
251
- return function(target5, mode, cb) {
252
- return orig.call(fs2, target5, mode, function(er) {
251
+ return function(target2, mode, cb) {
252
+ return orig.call(fs2, target2, mode, function(er) {
253
253
  if (chownErOk(er)) er = null;
254
254
  if (cb) cb.apply(this, arguments);
255
255
  });
@@ -257,9 +257,9 @@ var require_polyfills = __commonJS({
257
257
  }
258
258
  function chmodFixSync(orig) {
259
259
  if (!orig) return orig;
260
- return function(target5, mode) {
260
+ return function(target2, mode) {
261
261
  try {
262
- return orig.call(fs2, target5, mode);
262
+ return orig.call(fs2, target2, mode);
263
263
  } catch (er) {
264
264
  if (!chownErOk(er)) throw er;
265
265
  }
@@ -267,8 +267,8 @@ var require_polyfills = __commonJS({
267
267
  }
268
268
  function chownFix(orig) {
269
269
  if (!orig) return orig;
270
- return function(target5, uid, gid, cb) {
271
- return orig.call(fs2, target5, uid, gid, function(er) {
270
+ return function(target2, uid, gid, cb) {
271
+ return orig.call(fs2, target2, uid, gid, function(er) {
272
272
  if (chownErOk(er)) er = null;
273
273
  if (cb) cb.apply(this, arguments);
274
274
  });
@@ -276,9 +276,9 @@ var require_polyfills = __commonJS({
276
276
  }
277
277
  function chownFixSync(orig) {
278
278
  if (!orig) return orig;
279
- return function(target5, uid, gid) {
279
+ return function(target2, uid, gid) {
280
280
  try {
281
- return orig.call(fs2, target5, uid, gid);
281
+ return orig.call(fs2, target2, uid, gid);
282
282
  } catch (er) {
283
283
  if (!chownErOk(er)) throw er;
284
284
  }
@@ -286,7 +286,7 @@ var require_polyfills = __commonJS({
286
286
  }
287
287
  function statFix(orig) {
288
288
  if (!orig) return orig;
289
- return function(target5, options, cb) {
289
+ return function(target2, options, cb) {
290
290
  if (typeof options === "function") {
291
291
  cb = options;
292
292
  options = null;
@@ -298,13 +298,13 @@ var require_polyfills = __commonJS({
298
298
  }
299
299
  if (cb) cb.apply(this, arguments);
300
300
  }
301
- return options ? orig.call(fs2, target5, options, callback) : orig.call(fs2, target5, callback);
301
+ return options ? orig.call(fs2, target2, options, callback) : orig.call(fs2, target2, callback);
302
302
  };
303
303
  }
304
304
  function statFixSync(orig) {
305
305
  if (!orig) return orig;
306
- return function(target5, options) {
307
- var stats = options ? orig.call(fs2, target5, options) : orig.call(fs2, target5);
306
+ return function(target2, options) {
307
+ var stats = options ? orig.call(fs2, target2, options) : orig.call(fs2, target2);
308
308
  if (stats) {
309
309
  if (stats.uid < 0) stats.uid += 4294967296;
310
310
  if (stats.gid < 0) stats.gid += 4294967296;
@@ -3243,9 +3243,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3243
3243
  * @param {string} invalidArgumentMessage
3244
3244
  * @private
3245
3245
  */
3246
- _callParseArg(target5, value, previous, invalidArgumentMessage) {
3246
+ _callParseArg(target2, value, previous, invalidArgumentMessage) {
3247
3247
  try {
3248
- return target5.parseArg(value, previous);
3248
+ return target2.parseArg(value, previous);
3249
3249
  } catch (err) {
3250
3250
  if (err.code === "commander.invalidArgument") {
3251
3251
  const message = `${invalidArgumentMessage} ${err.message}`;
@@ -3534,13 +3534,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
3534
3534
  * @param {string} source - expected values are default/config/env/cli/implied
3535
3535
  * @return {Command} `this` command for chaining
3536
3536
  */
3537
- setOptionValueWithSource(key, value, source2) {
3537
+ setOptionValueWithSource(key, value, source) {
3538
3538
  if (this._storeOptionsAsProperties) {
3539
3539
  this[key] = value;
3540
3540
  } else {
3541
3541
  this._optionValues[key] = value;
3542
3542
  }
3543
- this._optionValueSources[key] = source2;
3543
+ this._optionValueSources[key] = source;
3544
3544
  return this;
3545
3545
  }
3546
3546
  /**
@@ -3561,13 +3561,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
3561
3561
  * @return {string}
3562
3562
  */
3563
3563
  getOptionValueSourceWithGlobals(key) {
3564
- let source2;
3564
+ let source;
3565
3565
  this._getCommandAndAncestors().forEach((cmd) => {
3566
3566
  if (cmd.getOptionValueSource(key) !== void 0) {
3567
- source2 = cmd.getOptionValueSource(key);
3567
+ source = cmd.getOptionValueSource(key);
3568
3568
  }
3569
3569
  });
3570
- return source2;
3570
+ return source;
3571
3571
  }
3572
3572
  /**
3573
3573
  * Get user arguments from implied or explicit arguments.
@@ -4434,10 +4434,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
4434
4434
  const optionKey2 = option2.attributeName();
4435
4435
  const optionValue = this.getOptionValue(optionKey2);
4436
4436
  const negativeOption = this.options.find(
4437
- (target5) => target5.negate && optionKey2 === target5.attributeName()
4437
+ (target2) => target2.negate && optionKey2 === target2.attributeName()
4438
4438
  );
4439
4439
  const positiveOption = this.options.find(
4440
- (target5) => !target5.negate && optionKey2 === target5.attributeName()
4440
+ (target2) => !target2.negate && optionKey2 === target2.attributeName()
4441
4441
  );
4442
4442
  if (negativeOption && (negativeOption.presetArg === void 0 && optionValue === false || negativeOption.presetArg !== void 0 && optionValue === negativeOption.presetArg)) {
4443
4443
  return negativeOption;
@@ -4447,8 +4447,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
4447
4447
  const getErrorMessage = (option2) => {
4448
4448
  const bestOption = findBestOptionFromValue(option2);
4449
4449
  const optionKey2 = bestOption.attributeName();
4450
- const source2 = this.getOptionValueSource(optionKey2);
4451
- if (source2 === "env") {
4450
+ const source = this.getOptionValueSource(optionKey2);
4451
+ if (source === "env") {
4452
4452
  return `environment variable '${bestOption.envVar}'`;
4453
4453
  }
4454
4454
  return `option '${bestOption.flags}'`;
@@ -5674,10 +5674,10 @@ function cached(getter) {
5674
5674
  function nullish(input2) {
5675
5675
  return input2 === null || input2 === void 0;
5676
5676
  }
5677
- function cleanRegex(source2) {
5678
- const start = source2.startsWith("^") ? 1 : 0;
5679
- const end = source2.endsWith("$") ? source2.length - 1 : source2.length;
5680
- return source2.slice(start, end);
5677
+ function cleanRegex(source) {
5678
+ const start = source.startsWith("^") ? 1 : 0;
5679
+ const end = source.endsWith("$") ? source.length - 1 : source.length;
5680
+ return source.slice(start, end);
5681
5681
  }
5682
5682
  function floatSafeRemainder(val, step) {
5683
5683
  const ratio = val / step;
@@ -5713,8 +5713,8 @@ function defineLazy(object2, key, getter) {
5713
5713
  function objectClone(obj) {
5714
5714
  return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));
5715
5715
  }
5716
- function assignProp(target5, prop, value) {
5717
- Object.defineProperty(target5, prop, {
5716
+ function assignProp(target2, prop, value) {
5717
+ Object.defineProperty(target2, prop, {
5718
5718
  value,
5719
5719
  writable: true,
5720
5720
  enumerable: true,
@@ -5897,35 +5897,35 @@ function normalizeParams(_params) {
5897
5897
  return params;
5898
5898
  }
5899
5899
  function createTransparentProxy(getter) {
5900
- let target5;
5900
+ let target2;
5901
5901
  return new Proxy({}, {
5902
5902
  get(_, prop, receiver) {
5903
- target5 ?? (target5 = getter());
5904
- return Reflect.get(target5, prop, receiver);
5903
+ target2 ?? (target2 = getter());
5904
+ return Reflect.get(target2, prop, receiver);
5905
5905
  },
5906
5906
  set(_, prop, value, receiver) {
5907
- target5 ?? (target5 = getter());
5908
- return Reflect.set(target5, prop, value, receiver);
5907
+ target2 ?? (target2 = getter());
5908
+ return Reflect.set(target2, prop, value, receiver);
5909
5909
  },
5910
5910
  has(_, prop) {
5911
- target5 ?? (target5 = getter());
5912
- return Reflect.has(target5, prop);
5911
+ target2 ?? (target2 = getter());
5912
+ return Reflect.has(target2, prop);
5913
5913
  },
5914
5914
  deleteProperty(_, prop) {
5915
- target5 ?? (target5 = getter());
5916
- return Reflect.deleteProperty(target5, prop);
5915
+ target2 ?? (target2 = getter());
5916
+ return Reflect.deleteProperty(target2, prop);
5917
5917
  },
5918
5918
  ownKeys(_) {
5919
- target5 ?? (target5 = getter());
5920
- return Reflect.ownKeys(target5);
5919
+ target2 ?? (target2 = getter());
5920
+ return Reflect.ownKeys(target2);
5921
5921
  },
5922
5922
  getOwnPropertyDescriptor(_, prop) {
5923
- target5 ?? (target5 = getter());
5924
- return Reflect.getOwnPropertyDescriptor(target5, prop);
5923
+ target2 ?? (target2 = getter());
5924
+ return Reflect.getOwnPropertyDescriptor(target2, prop);
5925
5925
  },
5926
5926
  defineProperty(_, prop, descriptor) {
5927
- target5 ?? (target5 = getter());
5928
- return Reflect.defineProperty(target5, prop, descriptor);
5927
+ target2 ?? (target2 = getter());
5928
+ return Reflect.defineProperty(target2, prop, descriptor);
5929
5929
  }
5930
5930
  });
5931
5931
  }
@@ -6447,10 +6447,10 @@ function $constructor(name, initializer3, proto, params) {
6447
6447
  let up = own2;
6448
6448
  while (up && up !== ctorProto)
6449
6449
  up = Object.getPrototypeOf(up);
6450
- const target5 = up ?? own2;
6451
- if (!initialized.has(target5)) {
6452
- initialized.add(target5);
6453
- members(target5, protoMembers);
6450
+ const target2 = up ?? own2;
6451
+ if (!initialized.has(target2)) {
6452
+ initialized.add(target2);
6453
+ members(target2, protoMembers);
6454
6454
  }
6455
6455
  }
6456
6456
  const proto2 = _.prototype;
@@ -6962,8 +6962,8 @@ var httpProtocol = /^https?$/;
6962
6962
  var e164 = /^\+[1-9]\d{6,14}$/;
6963
6963
  var creditCard = /^\d(?:[ -]?\d){11,18}$/;
6964
6964
  var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
6965
- function anchor(source2) {
6966
- return new RegExp(`^${source2}$`);
6965
+ function anchor(source) {
6966
+ return new RegExp(`^${source}$`);
6967
6967
  }
6968
6968
  var date = /* @__PURE__ */ anchor(dateSource);
6969
6969
  function timeSource(args) {
@@ -9698,12 +9698,12 @@ var $ZodTemplateLiteral = /* @__PURE__ */ $constructor("$ZodTemplateLiteral", (i
9698
9698
  if (!part._zod.pattern) {
9699
9699
  throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
9700
9700
  }
9701
- const source2 = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;
9702
- if (!source2)
9701
+ const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;
9702
+ if (!source)
9703
9703
  throw new Error(`Invalid template literal part: ${part._zod.traits}`);
9704
- const start = source2.startsWith("^") ? 1 : 0;
9705
- const end = source2.endsWith("$") ? source2.length - 1 : source2.length;
9706
- regexParts.push(source2.slice(start, end));
9704
+ const start = source.startsWith("^") ? 1 : 0;
9705
+ const end = source.endsWith("$") ? source.length - 1 : source.length;
9706
+ regexParts.push(source.slice(start, end));
9707
9707
  } else if (part === null || primitiveTypes.has(typeof part)) {
9708
9708
  regexParts.push(escapeRegex(`${part}`));
9709
9709
  } else {
@@ -17547,9 +17547,9 @@ function compile(schema, options) {
17547
17547
  return schema;
17548
17548
  }
17549
17549
  }
17550
- function installCompiledUserMethods(target5, source2, parser) {
17551
- const targetAny = target5;
17552
- const sourceAny = source2;
17550
+ function installCompiledUserMethods(target2, source, parser) {
17551
+ const targetAny = target2;
17552
+ const sourceAny = source;
17553
17553
  if (typeof sourceAny.safeParse === "function") {
17554
17554
  const originalSafeParse = sourceAny.safeParse;
17555
17555
  targetAny.safeParse = (data, params) => {
@@ -20089,26 +20089,26 @@ function _stringFormat(Class2, format, fnOrRegex, _params = {}) {
20089
20089
  }
20090
20090
 
20091
20091
  // node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/to-json-schema.js
20092
- function assignProps(target5, ...sources) {
20093
- for (const source2 of sources) {
20094
- for (const key of Reflect.ownKeys(source2)) {
20095
- if (Object.prototype.propertyIsEnumerable.call(source2, key)) {
20096
- assignProp(target5, key, source2[key]);
20092
+ function assignProps(target2, ...sources) {
20093
+ for (const source of sources) {
20094
+ for (const key of Reflect.ownKeys(source)) {
20095
+ if (Object.prototype.propertyIsEnumerable.call(source, key)) {
20096
+ assignProp(target2, key, source[key]);
20097
20097
  }
20098
20098
  }
20099
20099
  }
20100
- return target5;
20100
+ return target2;
20101
20101
  }
20102
20102
  function initializeContext(params) {
20103
- let target5 = params?.target ?? "draft-2020-12";
20104
- if (target5 === "draft-4")
20105
- target5 = "draft-04";
20106
- if (target5 === "draft-7")
20107
- target5 = "draft-07";
20103
+ let target2 = params?.target ?? "draft-2020-12";
20104
+ if (target2 === "draft-4")
20105
+ target2 = "draft-04";
20106
+ if (target2 === "draft-7")
20107
+ target2 = "draft-07";
20108
20108
  return {
20109
20109
  processors: params.processors ?? {},
20110
20110
  metadataRegistry: params?.metadata ?? globalRegistry,
20111
- target: target5,
20111
+ target: target2,
20112
20112
  unrepresentable: params?.unrepresentable ?? "throw",
20113
20113
  override: params?.override ?? (() => {
20114
20114
  }),
@@ -20612,8 +20612,8 @@ var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
20612
20612
  return finalize(ctx, schema);
20613
20613
  };
20614
20614
  var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
20615
- const { libraryOptions, target: target5 } = params ?? {};
20616
- const ctx = initializeContext({ ...libraryOptions ?? {}, target: target5, io, processors });
20615
+ const { libraryOptions, target: target2 } = params ?? {};
20616
+ const ctx = initializeContext({ ...libraryOptions ?? {}, target: target2, io, processors });
20617
20617
  process3(schema, ctx);
20618
20618
  extractDefs(ctx, schema);
20619
20619
  return finalize(ctx, schema);
@@ -21713,8 +21713,8 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
21713
21713
  catch(params) {
21714
21714
  return _catch2(this, params);
21715
21715
  },
21716
- pipe(target5) {
21717
- return pipe(this, target5);
21716
+ pipe(target2) {
21717
+ return pipe(this, target2);
21718
21718
  },
21719
21719
  readonly() {
21720
21720
  return readonly(this);
@@ -23861,8 +23861,15 @@ var unicodeTextSchema = external_exports.string().regex(/^[^\0\p{Cs}]*$/u, "Use
23861
23861
  var localeSchema = external_exports.enum(["ja", "en"]);
23862
23862
  var jobSchema = external_exports.enum(["warrior", "rogue", "mage", "priest", "bard"]);
23863
23863
  var characterIdSchema = external_exports.string().regex(/^[A-Za-z0-9_-]{12}$/);
23864
+ var characterTarget = {
23865
+ character_id: characterIdSchema,
23866
+ locale: localeSchema.optional()
23867
+ };
23864
23868
  var discriminatorSchema = external_exports.string().regex(/^[0-9]{4}$/);
23865
23869
  var uuidSchema = external_exports.uuid();
23870
+ var activityIdSchema = external_exports.number().int().min(1);
23871
+ var instanceIdSchema = external_exports.string().regex(/^[0-9a-z]{10}$/);
23872
+ var dropIdSchema = instanceIdSchema;
23866
23873
  var itemIdSchema = external_exports.string().regex(/^[a-z][a-z0-9_]{0,63}$/);
23867
23874
  var skillIdSchema = external_exports.enum([
23868
23875
  "mining",
@@ -23884,7 +23891,8 @@ var target = {
23884
23891
  var includeSchema = external_exports.enum([
23885
23892
  "profile",
23886
23893
  "inventory",
23887
- "repair_estimates"
23894
+ "repair_estimates",
23895
+ "growth"
23888
23896
  ]);
23889
23897
  var helloSchema = external_exports.object({ ...target, ...presentation }).strict();
23890
23898
  var getCharacterSchema = external_exports.object({
@@ -23923,7 +23931,7 @@ var getOnboardingOptionsSchema = external_exports.object(presentation).strict();
23923
23931
  // src/protocol/activity.ts
23924
23932
  var agentRunningActivitySchema = external_exports.looseObject({
23925
23933
  kind: external_exports.string(),
23926
- activity_id: external_exports.string(),
23934
+ activity_id: external_exports.number(),
23927
23935
  started_at: external_exports.string(),
23928
23936
  completes_at: external_exports.string().optional(),
23929
23937
  arrives_at: external_exports.string().optional(),
@@ -23931,11 +23939,11 @@ var agentRunningActivitySchema = external_exports.looseObject({
23931
23939
  });
23932
23940
  var agentLastResultSchema = external_exports.looseObject({
23933
23941
  kind: external_exports.string(),
23934
- activity_id: external_exports.string(),
23942
+ activity_id: external_exports.number(),
23935
23943
  status: external_exports.string().optional(),
23936
23944
  end_reason: external_exports.string().optional(),
23937
23945
  output: external_exports.looseObject({ item_id: external_exports.string(), quantity: external_exports.number() }).optional(),
23938
- ambush: external_exports.looseObject({ activity_id: external_exports.string() }).optional()
23946
+ ambush: external_exports.looseObject({ activity_id: external_exports.number() }).optional()
23939
23947
  });
23940
23948
 
23941
23949
  // src/protocol/responses.ts
@@ -23953,7 +23961,7 @@ var agentResumeResponseSchema = external_exports.looseObject({
23953
23961
  var changelogResponseSchema = external_exports.looseObject({
23954
23962
  changelog: external_exports.looseObject({})
23955
23963
  });
23956
- var agentSchemaVersion = "3.13";
23964
+ var agentSchemaVersion = "3.14";
23957
23965
  var agentGameResponseSchema = external_exports.looseObject({
23958
23966
  ok: external_exports.boolean(),
23959
23967
  schema_version: external_exports.literal(agentSchemaVersion),
@@ -23994,45 +24002,47 @@ var travelSchema = external_exports.object({ ...common, to: locationIdSchema }).
23994
24002
  var rideCarriageSchema = travelSchema;
23995
24003
  var getActivitySchema = external_exports.object({
23996
24004
  ...common,
23997
- activity_id: external_exports.uuid().optional()
24005
+ activity_id: activityIdSchema.optional()
23998
24006
  }).strict();
23999
24007
 
24000
24008
  // src/protocol/production.ts
24001
- var common2 = {
24002
- character_id: characterIdSchema,
24003
- locale: localeSchema.optional()
24004
- };
24005
- var gatherSchema = external_exports.object({ ...common2, item_id: itemIdSchema }).strict();
24009
+ var gatherSchema = external_exports.object({ ...characterTarget, item_id: itemIdSchema }).strict();
24006
24010
  var getRecipesSchema = external_exports.object({
24007
- ...common2,
24011
+ ...characterTarget,
24008
24012
  location_id: locationIdSchema.optional(),
24009
24013
  skill_id: skillIdSchema.optional(),
24010
24014
  recipe_id: external_exports.string().min(1).optional()
24011
24015
  }).strict();
24012
24016
  var getItemsSchema = external_exports.object({
24013
- ...common2,
24017
+ ...characterTarget,
24014
24018
  query: external_exports.string().min(1).optional(),
24015
24019
  item_id: itemIdSchema.optional()
24016
24020
  }).strict();
24017
24021
  var craftSchema = external_exports.object({
24018
- ...common2,
24022
+ ...characterTarget,
24019
24023
  recipe_id: external_exports.string().min(1),
24020
24024
  max_fee_per_lot: external_exports.number().int().min(0).optional(),
24021
24025
  request_id: external_exports.uuid()
24022
24026
  }).strict();
24023
- var stopActivitySchema = external_exports.object({ ...common2, activity_id: external_exports.uuid() }).strict();
24024
- var getShopSchema = external_exports.object(common2).strict();
24027
+ var stopActivitySchema = external_exports.object({ ...characterTarget, activity_id: activityIdSchema }).strict();
24028
+ var getShopSchema = external_exports.object(characterTarget).strict();
24025
24029
  var buySchema = external_exports.object({
24026
- ...common2,
24030
+ ...characterTarget,
24027
24031
  item_id: itemIdSchema,
24028
24032
  quantity: external_exports.number().int().positive().optional(),
24029
24033
  max_payment: external_exports.number().int().min(0).optional(),
24030
24034
  request_id: external_exports.uuid()
24031
24035
  }).strict();
24032
- var equipSchema = external_exports.object({ ...common2, instance_id: external_exports.uuid() }).strict();
24033
- var repairSchema = external_exports.object({ ...common2, instance_id: external_exports.uuid(), method: external_exports.enum(["kit", "npc"]) }).strict();
24036
+ var equipSchema = external_exports.object({ ...characterTarget, instance_id: instanceIdSchema }).strict();
24037
+ var repairMethodSchema = external_exports.enum(["kit", "npc"]);
24038
+ var repairSchema = external_exports.object({
24039
+ ...characterTarget,
24040
+ instance_id: instanceIdSchema,
24041
+ method: repairMethodSchema
24042
+ }).strict();
24043
+ var expandBagSchema = external_exports.object({ ...characterTarget, tier: external_exports.number().int().min(1) }).strict();
24034
24044
  var discardItemSchema = external_exports.object({
24035
- ...common2,
24045
+ ...characterTarget,
24036
24046
  target: external_exports.discriminatedUnion("kind", [
24037
24047
  external_exports.object({
24038
24048
  kind: external_exports.literal("stack"),
@@ -24041,16 +24051,12 @@ var discardItemSchema = external_exports.object({
24041
24051
  }).strict(),
24042
24052
  external_exports.object({
24043
24053
  kind: external_exports.literal("individual"),
24044
- instance_id: external_exports.uuid()
24054
+ instance_id: instanceIdSchema
24045
24055
  }).strict()
24046
24056
  ])
24047
24057
  }).strict();
24048
24058
 
24049
24059
  // src/protocol/combat.ts
24050
- var target2 = {
24051
- character_id: characterIdSchema,
24052
- locale: localeSchema.optional()
24053
- };
24054
24060
  var combatIdSchema = external_exports.string().regex(/^[a-z][a-z0-9_]{0,63}$/);
24055
24061
  var damageTypeSchema = external_exports.enum([
24056
24062
  "physical",
@@ -24117,8 +24123,8 @@ var tacticActionSchema = external_exports.discriminatedUnion("kind", [
24117
24123
  var tacticSchema = external_exports.object({
24118
24124
  rules: external_exports.array(
24119
24125
  external_exports.object({
24120
- conditions: external_exports.array(tacticConditionSchema).describe(
24121
- "All conditions must match (AND); an empty list always matches."
24126
+ conditions: external_exports.array(tacticConditionSchema).optional().describe(
24127
+ "All conditions must match (AND); an omitted or empty list always matches."
24122
24128
  ),
24123
24129
  action: tacticActionSchema
24124
24130
  }).strict()
@@ -24130,68 +24136,81 @@ var tacticSchema = external_exports.object({
24130
24136
  )
24131
24137
  }).strict().meta({ id: "Tactic" });
24132
24138
  var presetIdSchema = external_exports.enum(["safe", "aggressive"]);
24133
- var getTacticsSchema = external_exports.object(target2).strict();
24134
- var setTacticsSchema = external_exports.object({ ...target2, tactic: tacticSchema }).strict();
24139
+ var getTacticsSchema = external_exports.object(characterTarget).strict();
24140
+ var setTacticsSchema = external_exports.object({ ...characterTarget, tactic: tacticSchema }).strict();
24135
24141
  var validateTacticsSchema = setTacticsSchema;
24136
24142
  var startCombatSchema = external_exports.object({
24137
- ...target2,
24143
+ ...characterTarget,
24138
24144
  enemy_id: combatIdSchema,
24139
24145
  preset: presetIdSchema.optional(),
24140
24146
  tactic: tacticSchema.optional(),
24141
24147
  practice: external_exports.boolean().optional()
24142
24148
  }).strict();
24143
- var restSchema = external_exports.object(target2).strict();
24149
+ var restSchema = external_exports.object(characterTarget).strict();
24144
24150
  var stayAtInnSchema = restSchema;
24145
24151
  var useItemSchema = external_exports.object({
24146
- ...target2,
24152
+ ...characterTarget,
24147
24153
  item_id: itemIdSchema,
24148
24154
  count: external_exports.number().int().positive().optional().meta({
24149
24155
  description: "Maximum number of this item to use in this one call (default 1). The server uses only as many as still recover HP or MP, limited by the quantity you carry across qualities, and reports the number in used_item."
24150
24156
  })
24151
24157
  }).strict();
24152
- var changeJobSchema = external_exports.object({ ...target2, job_id: jobSchema }).strict();
24153
- var getCombatReportSchema = external_exports.object({ ...target2, activity_id: uuidSchema }).strict();
24154
- var getEncountersSchema = external_exports.object(target2).strict();
24155
- var getLostItemsSchema = external_exports.object(target2).strict();
24156
- var recoverLostItemsSchema = external_exports.object({ ...target2, drop_id: uuidSchema }).strict();
24158
+ var changeJobSchema = external_exports.object({ ...characterTarget, job_id: jobSchema }).strict();
24159
+ var combatReportIncludeSchema = external_exports.enum(["frames", "preparation"]);
24160
+ var getCombatReportSchema = external_exports.object({
24161
+ ...characterTarget,
24162
+ activity_id: activityIdSchema,
24163
+ include: external_exports.array(combatReportIncludeSchema).optional()
24164
+ }).strict();
24165
+ var getEncountersSchema = external_exports.object(characterTarget).strict();
24166
+ var getLostItemsSchema = external_exports.object(characterTarget).strict();
24167
+ var recoverLostItemsSchema = external_exports.object({ ...characterTarget, drop_id: dropIdSchema }).strict();
24157
24168
 
24158
24169
  // src/protocol/quests.ts
24159
- var target3 = {
24160
- character_id: characterIdSchema,
24161
- locale: localeSchema.optional()
24162
- };
24163
24170
  var getQuestsSchema = external_exports.object({
24164
- ...target3,
24171
+ ...characterTarget,
24165
24172
  before: external_exports.number().int().positive().optional(),
24166
24173
  active_only: external_exports.boolean().optional()
24167
24174
  }).strict();
24168
- var getQuestBoardSchema = external_exports.object(target3).strict();
24175
+ var getQuestBoardSchema = external_exports.object(characterTarget).strict();
24169
24176
  var questNumber = external_exports.number().int().min(1);
24170
24177
  var acceptQuestSchema = external_exports.object({
24171
- ...target3,
24178
+ ...characterTarget,
24172
24179
  offer_id: uuidSchema.optional(),
24173
- fixed_quest_id: external_exports.string().regex(/^[a-z][a-z0-9_]{0,63}$/).optional()
24180
+ fixed_quest_id: external_exports.string().regex(/^[a-z][a-z0-9_]{0,63}$/).optional(),
24181
+ goal_id: questNumber.optional()
24182
+ }).strict().refine(
24183
+ (input2) => [input2.offer_id, input2.fixed_quest_id, input2.goal_id].filter(
24184
+ (source) => source !== void 0
24185
+ ).length === 1,
24186
+ { message: "Supply exactly one of offer_id, fixed_quest_id and goal_id" }
24187
+ );
24188
+ var deliverGoalSchema = external_exports.object({
24189
+ ...characterTarget,
24190
+ goal_id: questNumber,
24191
+ item_id: itemIdSchema,
24192
+ quantity: questNumber
24193
+ }).strict();
24194
+ var claimQuestSchema = external_exports.object({
24195
+ ...characterTarget,
24196
+ quest_number: questNumber.optional(),
24197
+ goal_id: questNumber.optional()
24174
24198
  }).strict().refine(
24175
- (input2) => input2.offer_id !== void 0 !== (input2.fixed_quest_id !== void 0),
24176
- { message: "Supply exactly one of offer_id and fixed_quest_id" }
24199
+ (input2) => input2.quest_number !== void 0 !== (input2.goal_id !== void 0),
24200
+ { message: "Supply exactly one of quest_number and goal_id" }
24177
24201
  );
24178
- var claimQuestSchema = external_exports.object({ ...target3, quest_number: questNumber }).strict();
24179
- var discardQuestSchema = external_exports.object({ ...target3, quest_number: questNumber }).strict();
24202
+ var discardQuestSchema = external_exports.object({ ...characterTarget, quest_number: questNumber }).strict();
24180
24203
 
24181
24204
  // src/protocol/social.ts
24182
- var target4 = {
24183
- character_id: characterIdSchema,
24184
- locale: localeSchema.optional()
24185
- };
24186
24205
  var cursor = external_exports.number().int().min(1);
24187
24206
  var text = unicodeTextSchema.min(1);
24188
- var sendMonologueSchema = external_exports.object({ ...target4, text, language: localeSchema }).strict();
24207
+ var sendMonologueSchema = external_exports.object({ ...characterTarget, text, language: localeSchema }).strict();
24189
24208
  var contentReferenceSchema = external_exports.object({
24190
24209
  kind: external_exports.enum(["activity", "quest", "item", "character", "location"]),
24191
24210
  id: unicodeTextSchema.min(1)
24192
24211
  }).strict();
24193
24212
  var journalFields = {
24194
- ...target4,
24213
+ ...characterTarget,
24195
24214
  request_id: uuidSchema,
24196
24215
  text,
24197
24216
  language: localeSchema,
@@ -24203,14 +24222,14 @@ var endSessionSchema = external_exports.object({
24203
24222
  activity_policy: external_exports.enum(["continue", "stop_at_boundary"])
24204
24223
  }).strict();
24205
24224
  var getJournalsSchema = external_exports.object({
24206
- ...target4,
24225
+ ...characterTarget,
24207
24226
  before: cursor.optional(),
24208
24227
  query: unicodeTextSchema.optional(),
24209
24228
  journal_number: cursor.optional()
24210
24229
  }).strict();
24211
- var getPlanSchema = external_exports.object(target4).strict();
24230
+ var getPlanSchema = external_exports.object(characterTarget).strict();
24212
24231
  var updatePlanSchema = external_exports.object({
24213
- ...target4,
24232
+ ...characterTarget,
24214
24233
  text: unicodeTextSchema,
24215
24234
  language: localeSchema
24216
24235
  }).strict();
@@ -24220,38 +24239,38 @@ var messagePage = {
24220
24239
  limit: external_exports.number().int().min(1).optional()
24221
24240
  };
24222
24241
  var getChatSchema = external_exports.object({
24223
- ...target4,
24242
+ ...characterTarget,
24224
24243
  ...messagePage
24225
24244
  }).strict();
24226
24245
  var sendChatSchema = external_exports.object({
24227
- ...target4,
24246
+ ...characterTarget,
24228
24247
  text,
24229
24248
  language: localeSchema,
24230
24249
  references: external_exports.array(contentReferenceSchema).optional()
24231
24250
  }).strict();
24232
24251
  var getDirectMessagesSchema = external_exports.object({
24233
- ...target4,
24252
+ ...characterTarget,
24234
24253
  ...messagePage,
24235
24254
  with_character_id: characterIdSchema.optional(),
24236
24255
  unread_only: external_exports.boolean().optional()
24237
24256
  }).strict();
24238
24257
  var getDirectConversationsSchema = external_exports.object({
24239
- ...target4,
24258
+ ...characterTarget,
24240
24259
  before: cursor.optional(),
24241
24260
  limit: external_exports.number().int().min(1).optional()
24242
24261
  }).strict();
24243
24262
  var sendDirectMessageSchema = external_exports.object({
24244
- ...target4,
24263
+ ...characterTarget,
24245
24264
  recipient_character_id: characterIdSchema,
24246
24265
  text,
24247
24266
  language: localeSchema
24248
24267
  }).strict();
24249
24268
  var getNewsSchema = external_exports.object({
24250
- ...target4,
24269
+ ...characterTarget,
24251
24270
  before: cursor.optional(),
24252
24271
  limit: external_exports.number().int().min(1).optional()
24253
24272
  }).strict();
24254
- var getNewsArticleSchema = external_exports.object({ ...target4, number: cursor }).strict();
24273
+ var getNewsArticleSchema = external_exports.object({ ...characterTarget, number: cursor }).strict();
24255
24274
  var boardCategorySchema = external_exports.enum([
24256
24275
  "general",
24257
24276
  "strategy",
@@ -24260,7 +24279,7 @@ var boardCategorySchema = external_exports.enum([
24260
24279
  "trade"
24261
24280
  ]);
24262
24281
  var listBoardThreadsSchema = external_exports.object({
24263
- ...target4,
24282
+ ...characterTarget,
24264
24283
  category: boardCategorySchema.optional(),
24265
24284
  language: localeSchema.optional(),
24266
24285
  authored_by_self: external_exports.boolean().optional(),
@@ -24271,104 +24290,107 @@ var listBoardThreadsSchema = external_exports.object({
24271
24290
  limit: external_exports.number().int().min(1).optional()
24272
24291
  }).strict();
24273
24292
  var readBoardThreadSchema = external_exports.object({
24274
- ...target4,
24293
+ ...characterTarget,
24275
24294
  thread_number: cursor,
24276
24295
  after: external_exports.number().int().nonnegative().optional(),
24277
24296
  limit: external_exports.number().int().min(1).optional()
24278
24297
  }).strict();
24279
24298
  var createBoardThreadSchema = external_exports.object({
24280
- ...target4,
24299
+ ...characterTarget,
24281
24300
  category: boardCategorySchema,
24282
24301
  title: text,
24283
24302
  body: text,
24284
24303
  language: localeSchema.optional()
24285
24304
  }).strict();
24286
24305
  var replyBoardThreadSchema = external_exports.object({
24287
- ...target4,
24306
+ ...characterTarget,
24288
24307
  thread_number: cursor,
24289
24308
  body: text
24290
24309
  }).strict();
24291
24310
 
24292
24311
  // src/protocol/storage.ts
24293
- var common3 = {
24294
- character_id: characterIdSchema,
24295
- locale: localeSchema.optional()
24296
- };
24297
24312
  var stackTransferSchema = external_exports.object({
24298
- kind: external_exports.literal("stack"),
24299
24313
  item_id: itemIdSchema,
24300
- quality: external_exports.enum(["standard", "fine", "superior"]),
24314
+ quality: external_exports.enum(["standard", "fine", "superior"]).optional(),
24301
24315
  quantity: external_exports.number().int().min(1)
24302
24316
  }).strict();
24303
- var individualTransferSchema = external_exports.object({
24304
- kind: external_exports.literal("individual"),
24305
- instance_id: uuidSchema
24306
- }).strict();
24307
- var storageTransferItemsSchema = external_exports.array(
24308
- external_exports.discriminatedUnion("kind", [
24309
- stackTransferSchema,
24310
- individualTransferSchema
24311
- ])
24312
- ).min(1);
24313
- var getStorageSchema = external_exports.object({ ...common3, town_id: locationIdSchema }).strict();
24314
- var searchStorageSchema = external_exports.object({ ...common3, query: unicodeTextSchema }).strict();
24317
+ var individualTransferSchema = external_exports.object({ instance_id: external_exports.string().toLowerCase().pipe(instanceIdSchema) }).strict();
24318
+ var storageTransferItemsSchema = external_exports.array(external_exports.union([stackTransferSchema, individualTransferSchema])).min(1);
24319
+ var getStorageSchema = external_exports.object({ ...characterTarget, town_id: locationIdSchema }).strict();
24320
+ var searchStorageSchema = external_exports.object({ ...characterTarget, query: unicodeTextSchema }).strict();
24315
24321
  var depositItemsSchema = external_exports.object({
24316
- ...common3,
24322
+ ...characterTarget,
24317
24323
  town_id: locationIdSchema,
24318
24324
  request_id: uuidSchema,
24319
24325
  items: storageTransferItemsSchema
24320
24326
  }).strict();
24321
24327
  var withdrawItemsSchema = external_exports.object({
24322
- ...common3,
24328
+ ...characterTarget,
24323
24329
  town_id: locationIdSchema,
24324
24330
  request_id: uuidSchema,
24325
24331
  items: storageTransferItemsSchema
24326
24332
  }).strict();
24327
24333
 
24334
+ // src/protocol/gift.ts
24335
+ var sendGiftSchema = external_exports.object({
24336
+ ...characterTarget,
24337
+ recipient_character_id: characterIdSchema,
24338
+ request_id: uuidSchema,
24339
+ items: storageTransferItemsSchema.optional(),
24340
+ gold: external_exports.number().int().min(1).optional()
24341
+ }).strict();
24342
+ var claimGiftsSchema = external_exports.object(characterTarget).strict();
24343
+ var getGiftsSchema = external_exports.object({
24344
+ ...characterTarget,
24345
+ cursor: external_exports.number().int().positive().optional()
24346
+ }).strict();
24347
+
24328
24348
  // src/protocol/market.ts
24329
- var common4 = {
24330
- character_id: characterIdSchema,
24331
- locale: localeSchema.optional()
24332
- };
24333
- var change = { ...common4, request_id: uuidSchema };
24334
- var quality = external_exports.enum(["standard", "fine", "superior"]);
24349
+ var change = { ...characterTarget, request_id: uuidSchema };
24350
+ var marketQualitySchema = external_exports.enum(["standard", "fine", "superior"]);
24335
24351
  var price = external_exports.number().int().positive();
24336
24352
  var quantity = external_exports.number().int().positive();
24337
24353
  var number4 = external_exports.number().int().positive();
24338
- var source = external_exports.enum(["carried", "storage"]);
24354
+ var marketSourceSchema = external_exports.enum(["carried", "storage"]);
24355
+ var marketSectionSchema = external_exports.enum(["orders", "listings", "trades"]);
24339
24356
  var getMarketSchema = external_exports.object({
24340
- ...common4,
24357
+ ...characterTarget,
24341
24358
  town_id: locationIdSchema,
24342
24359
  item_id: itemIdSchema.optional(),
24343
- quality: quality.optional(),
24360
+ quality: marketQualitySchema.optional(),
24344
24361
  levels: external_exports.number().int().min(1).optional(),
24345
24362
  cursor: external_exports.number().int().positive().optional(),
24346
24363
  max_price: price.optional(),
24347
24364
  minimum_durability: external_exports.number().int().nonnegative().optional()
24348
24365
  }).strict();
24349
24366
  var getMyMarketSchema = external_exports.object({
24350
- ...common4,
24351
- section: external_exports.enum(["orders", "listings", "trades"]).optional(),
24367
+ ...characterTarget,
24368
+ section: marketSectionSchema.optional(),
24352
24369
  cursor: external_exports.number().int().positive().optional()
24353
24370
  }).strict();
24354
24371
  var placeMarketSellOrderSchema = external_exports.object({
24355
24372
  ...change,
24356
24373
  item_id: itemIdSchema,
24357
- quality,
24374
+ quality: marketQualitySchema,
24358
24375
  quantity,
24359
24376
  unit_price: price,
24360
- source
24377
+ source: marketSourceSchema
24361
24378
  }).strict();
24362
24379
  var placeMarketBuyOrderSchema = external_exports.object({
24363
24380
  ...change,
24364
24381
  item_id: itemIdSchema,
24365
- quality,
24382
+ quality: marketQualitySchema,
24366
24383
  quantity,
24367
24384
  unit_price: price
24368
24385
  }).strict();
24369
24386
  var cancelMarketOrderSchema = external_exports.object({ ...change, order_id: number4 }).strict();
24370
24387
  var claimMarketOrderSchema = cancelMarketOrderSchema;
24371
- var createMarketListingSchema = external_exports.object({ ...change, instance_id: uuidSchema, price, source }).strict();
24388
+ var createMarketListingSchema = external_exports.object({
24389
+ ...change,
24390
+ instance_id: instanceIdSchema,
24391
+ price,
24392
+ source: marketSourceSchema
24393
+ }).strict();
24372
24394
  var buyMarketListingSchema = external_exports.object({
24373
24395
  ...change,
24374
24396
  listing_id: number4,
@@ -24423,6 +24445,9 @@ var CliError = class extends Error {
24423
24445
  code;
24424
24446
  detail;
24425
24447
  };
24448
+ function invalidArguments(fields, message) {
24449
+ return new CliError("INVALID_ARGUMENTS", { fields, message });
24450
+ }
24426
24451
  function cliFailure(error61) {
24427
24452
  const failure = error61 instanceof CliError ? error61 : new CliError("CLIENT_ERROR");
24428
24453
  const { message, ...detail } = failure.detail;
@@ -24476,8 +24501,9 @@ var CredentialStore = class {
24476
24501
  try {
24477
24502
  return storeSchema.parse(JSON.parse(await readFile(this.path, "utf8")));
24478
24503
  } catch (error61) {
24479
- if (error61 instanceof Error && "code" in error61 && error61.code === "ENOENT")
24504
+ if (error61 instanceof Error && "code" in error61 && error61.code === "ENOENT") {
24480
24505
  return {};
24506
+ }
24481
24507
  throw error61;
24482
24508
  }
24483
24509
  }
@@ -24550,6 +24576,9 @@ var retryAfterSchema = external_exports.object({
24550
24576
  var schemaVersionSchema = external_exports.object({ schema_version: external_exports.string() });
24551
24577
  var [supportedSchemaMajor = 0, supportedSchemaMinor = 0] = agentSchemaVersion.split(".").map(Number);
24552
24578
  var checkOutcome = "The action may still have been applied; check its outcome before another change.";
24579
+ async function readBody(response) {
24580
+ return response.json().catch(() => void 0);
24581
+ }
24553
24582
  function serverMessage(body) {
24554
24583
  const parsed = serverMessageSchema.safeParse(body);
24555
24584
  return parsed.success ? parsed.data.error?.message : void 0;
@@ -24574,8 +24603,9 @@ function needsUpdate(body) {
24574
24603
  }
24575
24604
  function serverOrigin(input2) {
24576
24605
  const url2 = URL.parse(input2);
24577
- if (!url2 || url2.username || url2.password || url2.pathname !== "/" || url2.search || url2.hash || url2.protocol !== "https:" && !(url2.protocol === "http:" && ["localhost", "127.0.0.1", "[::1]"].includes(url2.hostname)))
24606
+ if (!url2 || url2.username || url2.password || url2.pathname !== "/" || url2.search || url2.hash || url2.protocol !== "https:" && !(url2.protocol === "http:" && ["localhost", "127.0.0.1", "[::1]"].includes(url2.hostname))) {
24578
24607
  throw new CliError("INVALID_SERVER");
24608
+ }
24579
24609
  return url2.origin;
24580
24610
  }
24581
24611
  function expiringSoon(credential) {
@@ -24608,15 +24638,14 @@ var GameClient = class {
24608
24638
  body: new URLSearchParams(body)
24609
24639
  });
24610
24640
  if (response.status >= 500) throw new CliError("SERVICE_UNAVAILABLE");
24611
- if (response.status === 429)
24612
- throw rateLimited(response, await response.json().catch(() => void 0));
24641
+ if (response.status === 429) {
24642
+ throw rateLimited(response, await readBody(response));
24643
+ }
24613
24644
  return response;
24614
24645
  }
24615
24646
  async decodeTokens(response) {
24616
24647
  if (!response.ok) throw new CliError("AUTH_REQUIRED");
24617
- const parsed = tokensSchema.safeParse(
24618
- await response.json().catch(() => null)
24619
- );
24648
+ const parsed = tokensSchema.safeParse(await readBody(response));
24620
24649
  if (!parsed.success) throw new CliError("INVALID_RESPONSE");
24621
24650
  return {
24622
24651
  ...parsed.data,
@@ -24630,13 +24659,12 @@ var GameClient = class {
24630
24659
  resource: `${this.origin}/mcp`
24631
24660
  });
24632
24661
  if (!response.ok) throw new CliError("AUTH_START_FAILED");
24633
- const parsed = deviceSchema.safeParse(
24634
- await response.json().catch(() => null)
24635
- );
24662
+ const parsed = deviceSchema.safeParse(await readBody(response));
24636
24663
  if (!parsed.success) throw new CliError("INVALID_RESPONSE");
24637
24664
  const device = parsed.data;
24638
- if (new URL(device.verification_uri_complete).origin !== this.origin)
24665
+ if (new URL(device.verification_uri_complete).origin !== this.origin) {
24639
24666
  throw new CliError("INVALID_AUTH_SERVER");
24667
+ }
24640
24668
  await this.credentials.update((entries) => {
24641
24669
  entries[this.origin] = {
24642
24670
  device_code: device.device_code,
@@ -24653,8 +24681,9 @@ var GameClient = class {
24653
24681
  async accessToken() {
24654
24682
  const cached2 = (await this.credentials.read())[this.origin];
24655
24683
  if (!cached2) throw new CliError("AUTH_REQUIRED");
24656
- if (!isPendingAuthorization(cached2) && !expiringSoon(cached2))
24684
+ if (!isPendingAuthorization(cached2) && !expiringSoon(cached2)) {
24657
24685
  return cached2.access_token;
24686
+ }
24658
24687
  const result = await this.credentials.update(async (entries) => {
24659
24688
  const current = entries[this.origin];
24660
24689
  if (!current) throw new CliError("AUTH_REQUIRED");
@@ -24675,16 +24704,16 @@ var GameClient = class {
24675
24704
  entries[this.origin] = credential;
24676
24705
  return credential.access_token;
24677
24706
  }
24678
- const failure = errorSchema.safeParse(
24679
- await polled.json().catch(() => null)
24680
- );
24681
- if (!failure.success)
24707
+ const failure = errorSchema.safeParse(await readBody(polled));
24708
+ if (!failure.success) {
24682
24709
  throw new CliError("AUTH_NOT_COMPLETED", {
24683
24710
  reason: "invalid_response"
24684
24711
  });
24712
+ }
24685
24713
  const reason = failure.data.error;
24686
- if (reason === "authorization_pending" || reason === "slow_down")
24714
+ if (reason === "authorization_pending" || reason === "slow_down") {
24687
24715
  throw new CliError("AUTH_NOT_COMPLETED", { reason });
24716
+ }
24688
24717
  delete entries[this.origin];
24689
24718
  return new CliError("AUTH_NOT_COMPLETED", { reason });
24690
24719
  }
@@ -24718,24 +24747,27 @@ var GameClient = class {
24718
24747
  },
24719
24748
  body: JSON.stringify(input2)
24720
24749
  });
24721
- const body = await response.json().catch(() => void 0);
24750
+ const body = await readBody(response);
24722
24751
  const message = serverMessage(body);
24723
- if (response.status === 401)
24752
+ if (response.status === 401) {
24724
24753
  throw new CliError("AUTH_REQUIRED", {
24725
24754
  message: message ? `${message} Run auth login and try again.` : cliErrorMessage("AUTH_REQUIRED")
24726
24755
  });
24756
+ }
24727
24757
  if (response.status === 429) throw rateLimited(response, body);
24728
- if (response.status >= 500)
24758
+ if (response.status >= 500) {
24729
24759
  throw new CliError("SERVICE_UNAVAILABLE", message ? { message } : {});
24730
- if (body === void 0)
24760
+ }
24761
+ if (body === void 0) {
24731
24762
  throw new CliError("INVALID_RESPONSE", {
24732
24763
  message: `The server returned a response that was not valid JSON. ${checkOutcome}`,
24733
24764
  operation: path2,
24734
24765
  http_status: response.status
24735
24766
  });
24767
+ }
24736
24768
  const parsed = agentGameResponseSchema.safeParse(body);
24737
24769
  if (!parsed.success) {
24738
- if (needsUpdate(body))
24770
+ if (needsUpdate(body)) {
24739
24771
  throw new CliError("UPDATE_REQUIRED", {
24740
24772
  operation: path2,
24741
24773
  http_status: response.status,
@@ -24743,6 +24775,7 @@ var GameClient = class {
24743
24775
  // The automatic update verifies a read against this server.
24744
24776
  server: this.origin
24745
24777
  });
24778
+ }
24746
24779
  throw new CliError("INVALID_RESPONSE", {
24747
24780
  message: `The server response did not match this CLI's expected format. ${checkOutcome}`,
24748
24781
  operation: path2,
@@ -24757,20 +24790,22 @@ var GameClient = class {
24757
24790
  // Public reads stay usable before authorization and are not agent responses.
24758
24791
  async readDocument(path2, schema) {
24759
24792
  const response = await this.send(`/api/v1/${path2}`, { method: "GET" });
24760
- const body = await response.json().catch(() => void 0);
24793
+ const body = await readBody(response);
24761
24794
  if (response.status === 429) throw rateLimited(response, body);
24762
24795
  if (response.status >= 500) throw new CliError("SERVICE_UNAVAILABLE");
24763
24796
  const parsed = schema.safeParse(body);
24764
24797
  if (parsed.success) return parsed.data;
24765
24798
  const message = serverMessage(body);
24766
- if (response.status === 400 && message)
24799
+ if (response.status === 400 && message) {
24767
24800
  throw new CliError("INVALID_ARGUMENTS", { message });
24768
- if (body === void 0)
24801
+ }
24802
+ if (body === void 0) {
24769
24803
  throw new CliError("INVALID_RESPONSE", {
24770
24804
  message: "The server returned a response that was not valid JSON.",
24771
24805
  operation: path2,
24772
24806
  http_status: response.status
24773
24807
  });
24808
+ }
24774
24809
  throw new CliError("INVALID_RESPONSE", {
24775
24810
  message: "The server response did not match this CLI's expected format.",
24776
24811
  operation: path2,
@@ -24814,10 +24849,11 @@ function ambushNotes(response, character) {
24814
24849
  notes.push(
24815
24850
  `The ${lastResult.kind} activity is complete. Read the ambush battle report with \`${activityCommand(ambush.activity_id, character)}\` if you have not seen it.`
24816
24851
  );
24817
- if (activity)
24852
+ if (activity) {
24818
24853
  notes.push(
24819
24854
  `Your ${activity.kind} activity (${activity.activity_id}) is now in progress.`
24820
24855
  );
24856
+ }
24821
24857
  }
24822
24858
  return { notes, supersededActivityId: ambush.activity_id };
24823
24859
  }
@@ -24832,19 +24868,20 @@ function stateNotes(response, character, wait) {
24832
24868
  `Stopped with ${repetition.completed_count} of ${repetition.requested_count} attempts completed. You keep their results.${unconfirmed}`
24833
24869
  );
24834
24870
  } else if (!wait && response.ok) {
24835
- if (lastResult)
24871
+ if (lastResult) {
24836
24872
  notes.push(
24837
24873
  `This ${lastResult.kind} activity has already finished. No new activity was started.`
24838
24874
  );
24839
- else if (activity)
24875
+ } else if (activity) {
24840
24876
  notes.push(
24841
24877
  `Your ${activity.kind} activity is in progress. Check it with \`${activityCommand(activity.activity_id, character)}\`.`
24842
24878
  );
24879
+ }
24843
24880
  }
24844
24881
  return { notes, supersededActivityId };
24845
24882
  }
24846
24883
  function supersededAmbushHint(hint, activityId) {
24847
- return hint.operation === "get_activity" && hint.arguments?.activity_id === activityId;
24884
+ return hint.operation === "get_activity" && hint.arguments?.activity_id === String(activityId);
24848
24885
  }
24849
24886
  function withRenderedHints(response, character, options = {}) {
24850
24887
  const { hints, ...rest } = response;
@@ -24872,10 +24909,11 @@ function itemChangeRecovery(character) {
24872
24909
  }
24873
24910
  function recoveryHint(detail, context) {
24874
24911
  const repetition = detail.repetition;
24875
- if (detail.outcome !== "unknown" && repetition?.stopped_reason !== "unknown")
24912
+ if (detail.outcome !== "unknown" && repetition?.stopped_reason !== "unknown") {
24876
24913
  return void 0;
24914
+ }
24877
24915
  if (context.itemChange) return itemChangeRecovery(context.character);
24878
- const activityId = typeof detail.activity_id === "string" ? detail.activity_id : void 0;
24916
+ const activityId = typeof detail.activity_id === "number" ? detail.activity_id : void 0;
24879
24917
  const requestId = typeof detail.request_id === "string" ? detail.request_id : void 0;
24880
24918
  const parts = [
24881
24919
  "The result is unclear. Check what happened before taking another action."
@@ -24891,10 +24929,11 @@ function recoveryHint(detail, context) {
24891
24929
  `Check your current or latest activity with \`${current}\`. Compare its kind and time with your command. If you cannot tell whether it is the same activity, do not repeat the command.`
24892
24930
  );
24893
24931
  }
24894
- if (requestId)
24932
+ if (requestId) {
24895
24933
  parts.push(
24896
24934
  context.craft ? `Retry only that craft with the same recipe, fee limit and \`--request ${requestId}\` to check what happened. This will not start a second craft. Do not start another lot or repeat the remaining count.` : `Retry the same command with the same arguments and \`--request ${requestId}\` to check what happened. This will not repeat the action.`
24897
24935
  );
24936
+ }
24898
24937
  return parts.join(" ");
24899
24938
  }
24900
24939
 
@@ -24959,8 +24998,9 @@ async function readCli(executable, args, timeout) {
24959
24998
  timeout,
24960
24999
  env: { ...process.env, CLAWSAGA_AUTO_UPDATE: "0" }
24961
25000
  }).catch((error61) => {
24962
- if (error61 && typeof error61 === "object" && "stdout" in error61 && typeof error61.stdout === "string" && error61.stdout.trim())
25001
+ if (error61 && typeof error61 === "object" && "stdout" in error61 && typeof error61.stdout === "string" && error61.stdout.trim()) {
24963
25002
  return { stdout: error61.stdout };
25003
+ }
24964
25004
  throw error61;
24965
25005
  });
24966
25006
  return resultSchema.parse(JSON.parse(output2.stdout));
@@ -24997,11 +25037,12 @@ async function updateCli(server) {
24997
25037
  remaining()
24998
25038
  );
24999
25039
  if (check2.ok) return installedVersion;
25000
- if (!check2.error?.update_required)
25040
+ if (!check2.error?.update_required) {
25001
25041
  throw new CliError("UPDATE_FAILED", {
25002
25042
  message: "The CLI was updated, but play could not be verified. Stop and resolve the verification error before continuing.",
25003
25043
  verification_error: check2.error
25004
25044
  });
25045
+ }
25005
25046
  await sleep(Math.min(6e4, remaining()));
25006
25047
  } while (Date.now() < deadline);
25007
25048
  } catch (error61) {
@@ -25012,8 +25053,9 @@ async function updateCli(server) {
25012
25053
  }
25013
25054
  async function recoverUpdate(error61, notify) {
25014
25055
  if (!(error61 instanceof CliError) || error61.code !== "UPDATE_REQUIRED" || // Set for the verification read, which must not start an update of its own.
25015
- process.env.CLAWSAGA_AUTO_UPDATE === "0")
25056
+ process.env.CLAWSAGA_AUTO_UPDATE === "0") {
25016
25057
  return error61;
25058
+ }
25017
25059
  const { server } = error61.detail;
25018
25060
  if (typeof server !== "string") return error61;
25019
25061
  notify?.(
@@ -25039,7 +25081,7 @@ async function recoverUpdate(error61, notify) {
25039
25081
  // package.json
25040
25082
  var package_default = {
25041
25083
  name: "@clawsaga/cli",
25042
- version: "0.1.21",
25084
+ version: "0.1.23",
25043
25085
  homepage: "https://clawsaga.net",
25044
25086
  repository: {
25045
25087
  type: "git",
@@ -25075,6 +25117,7 @@ var package_default = {
25075
25117
  devDependencies: {
25076
25118
  "@eslint-community/eslint-plugin-eslint-comments": "4.8.1",
25077
25119
  "@eslint/js": "10.0.1",
25120
+ "@stylistic/eslint-plugin": "5.10.0",
25078
25121
  "@types/node": "22.20.4",
25079
25122
  "@types/proper-lockfile": "4.1.4",
25080
25123
  commander: "15.0.0",
@@ -25131,8 +25174,9 @@ async function repeatActivity(client, path2, input2, values, count, options) {
25131
25174
  });
25132
25175
  const attempt = async (lotInput, requestId) => {
25133
25176
  const started = await client.invoke(path2, lotInput);
25134
- if (!started.ok)
25177
+ if (!started.ok) {
25135
25178
  return { ...started, repetition: summary("start_rejected") };
25179
+ }
25136
25180
  const completed = started.data.last_result ? started : await waitForActivity(
25137
25181
  client,
25138
25182
  values,
@@ -25140,22 +25184,27 @@ async function repeatActivity(client, path2, input2, values, count, options) {
25140
25184
  options?.notify,
25141
25185
  requestId
25142
25186
  );
25143
- if (!completed.ok)
25187
+ if (!completed.ok) {
25144
25188
  return { ...completed, repetition: summary("activity_failed") };
25189
+ }
25145
25190
  const result = endedProduction(completed);
25146
- if (result.end_reason !== "COMPLETED")
25191
+ if (result.end_reason !== "COMPLETED") {
25147
25192
  return incomplete(completed, "activity_stopped");
25193
+ }
25148
25194
  const output2 = result.output;
25149
- if (!output2)
25195
+ if (!output2) {
25150
25196
  throw new CliError("INVALID_RESPONSE", {
25151
25197
  reason: "unexpected_production_result"
25152
25198
  });
25199
+ }
25153
25200
  confirmed += 1;
25154
25201
  produced[output2.item_id] = (produced[output2.item_id] ?? 0) + output2.quantity;
25155
- if (result.kind === "gather" && result.ambush)
25202
+ if (result.kind === "gather" && result.ambush) {
25156
25203
  return confirmed === count ? { ...completed, repetition: summary("ambush") } : incomplete(completed, "ambush");
25157
- if (confirmed === count)
25204
+ }
25205
+ if (confirmed === count) {
25158
25206
  return { ...completed, repetition: summary("count_reached") };
25207
+ }
25159
25208
  return void 0;
25160
25209
  };
25161
25210
  while (confirmed < count) {
@@ -25167,13 +25216,14 @@ async function repeatActivity(client, path2, input2, values, count, options) {
25167
25216
  const final = await attempt(lotInput, requestId);
25168
25217
  if (final) return final;
25169
25218
  } catch (error61) {
25170
- if (error61 instanceof CliError)
25219
+ if (error61 instanceof CliError) {
25171
25220
  throw new CliError(error61.code, {
25172
25221
  ...error61.detail,
25173
25222
  ...requestId === void 0 ? {} : { request_id: requestId },
25174
25223
  // 送信前の失敗は開始していないため、成果があった可能性を主張しない。
25175
25224
  repetition: summary(notSent(error61) ? "start_rejected" : "unknown")
25176
25225
  });
25226
+ }
25177
25227
  throw error61;
25178
25228
  }
25179
25229
  }
@@ -25181,28 +25231,31 @@ async function repeatActivity(client, path2, input2, values, count, options) {
25181
25231
  }
25182
25232
  function endedProduction(response) {
25183
25233
  const result = response.data.last_result;
25184
- if (!result || result.kind !== "gather" && result.kind !== "craft" || result.status !== "ENDED")
25234
+ if (!result || result.kind !== "gather" && result.kind !== "craft" || result.status !== "ENDED") {
25185
25235
  throw new CliError("INVALID_RESPONSE", {
25186
25236
  reason: "unexpected_production_result"
25187
25237
  });
25238
+ }
25188
25239
  return result;
25189
25240
  }
25190
25241
  async function waitForActivity(client, values, initial, notify, requestId) {
25191
25242
  let result = initial;
25192
25243
  const activity = result.ok ? result.data.activity : void 0;
25193
- if (!activity)
25244
+ if (!activity) {
25194
25245
  throw new CliError("INVALID_RESPONSE", { reason: "missing_activity_id" });
25246
+ }
25195
25247
  const activityId = activity.activity_id;
25196
25248
  notify?.(
25197
25249
  acceptedActivityNote(activity, result.next_poll_after_seconds, requestId)
25198
25250
  );
25199
25251
  while (result.data.activity?.activity_id === activityId) {
25200
25252
  const seconds = result.next_poll_after_seconds;
25201
- if (!seconds)
25253
+ if (!seconds) {
25202
25254
  throw new CliError("INVALID_RESPONSE", {
25203
25255
  reason: "missing_poll_interval",
25204
25256
  activity_id: activityId
25205
25257
  });
25258
+ }
25206
25259
  await sleep2(seconds * 1e3);
25207
25260
  try {
25208
25261
  result = await client.invoke("character/activity", {
@@ -25211,22 +25264,24 @@ async function waitForActivity(client, values, initial, notify, requestId) {
25211
25264
  ...values.locale ? { locale: values.locale } : {}
25212
25265
  });
25213
25266
  } catch (error61) {
25214
- if (error61 instanceof CliError)
25267
+ if (error61 instanceof CliError) {
25215
25268
  throw new CliError(error61.code, {
25216
25269
  ...error61.detail,
25217
25270
  activity_id: activityId,
25218
25271
  outcome: "unknown"
25219
25272
  });
25273
+ }
25220
25274
  throw error61;
25221
25275
  }
25222
25276
  if (!result.ok) return result;
25223
25277
  }
25224
25278
  const lastResult = result.data.last_result;
25225
- if (!lastResult || lastResult.activity_id !== activityId)
25279
+ if (!lastResult || lastResult.activity_id !== activityId) {
25226
25280
  throw new CliError("INVALID_RESPONSE", {
25227
25281
  reason: "activity_id_mismatch",
25228
25282
  activity_id: activityId
25229
25283
  });
25284
+ }
25230
25285
  return result;
25231
25286
  }
25232
25287
 
@@ -25240,7 +25295,7 @@ var globalOptions = [
25240
25295
  {
25241
25296
  flags: "-l, --content-language <language>",
25242
25297
  description: "Game content language for this call",
25243
- choices: ["ja", "en"]
25298
+ choices: localeSchema.options
25244
25299
  },
25245
25300
  {
25246
25301
  flags: "-s, --server <origin>",
@@ -25263,7 +25318,9 @@ var noWaitFlag = [
25263
25318
  function bodySchema(definition) {
25264
25319
  const mask = { locale: true };
25265
25320
  if ("character_id" in definition.schema.shape) mask.character_id = true;
25266
- return external_exports.strictObject(definition.schema.shape).omit(mask);
25321
+ const { shape } = definition.schema;
25322
+ const body = external_exports.strictObject(shape).omit(mask);
25323
+ return definition.autoRequestId && shape.request_id ? body.extend({ request_id: external_exports.optional(shape.request_id) }) : body;
25267
25324
  }
25268
25325
 
25269
25326
  // src/command-input.ts
@@ -25300,6 +25357,7 @@ var optionsSchema = external_exports.object({
25300
25357
  drop: external_exports.string().optional(),
25301
25358
  offer: external_exports.string().optional(),
25302
25359
  fixedQuest: external_exports.string().optional(),
25360
+ goal: external_exports.string().optional(),
25303
25361
  quest: external_exports.string().optional(),
25304
25362
  journal: external_exports.string().optional(),
25305
25363
  article: external_exports.string().optional(),
@@ -25319,6 +25377,7 @@ var optionsSchema = external_exports.object({
25319
25377
  thread: external_exports.string().optional(),
25320
25378
  town: external_exports.string().optional(),
25321
25379
  items: external_exports.string().optional(),
25380
+ gold: external_exports.string().optional(),
25322
25381
  quality: external_exports.string().optional(),
25323
25382
  levels: external_exports.string().optional(),
25324
25383
  maxPrice: external_exports.string().optional(),
@@ -25328,7 +25387,8 @@ var optionsSchema = external_exports.object({
25328
25387
  price: external_exports.string().optional(),
25329
25388
  order: external_exports.string().optional(),
25330
25389
  listing: external_exports.string().optional(),
25331
- section: external_exports.string().optional()
25390
+ section: external_exports.string().optional(),
25391
+ tier: external_exports.string().optional()
25332
25392
  });
25333
25393
  function isJsonObject(value) {
25334
25394
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -25357,11 +25417,12 @@ function optionKey(flags) {
25357
25417
  }
25358
25418
  function integerFlag(option, value) {
25359
25419
  const number5 = Number(value);
25360
- if (typeof value !== "string" || !/^\d+$/.test(value) || !Number.isSafeInteger(number5))
25361
- throw new CliError("INVALID_ARGUMENTS", {
25362
- fields: [option],
25363
- message: `--${option.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)} must be a non-negative integer.`
25364
- });
25420
+ if (typeof value !== "string" || !/^\d+$/.test(value) || !Number.isSafeInteger(number5)) {
25421
+ throw invalidArguments(
25422
+ [option],
25423
+ `--${option.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)} must be a non-negative integer.`
25424
+ );
25425
+ }
25365
25426
  return number5;
25366
25427
  }
25367
25428
  async function commandInput(definition, values) {
@@ -25372,6 +25433,7 @@ async function bodyFileInput(definition, values, file2) {
25372
25433
  if (!isJsonObject(fileBody)) throw new CliError("INVALID_INPUT_FILE");
25373
25434
  const body = definition.bodyInput?.(values, fileBody) ?? fileBody;
25374
25435
  return {
25436
+ ...definition.autoRequestId ? { request_id: values.request } : {},
25375
25437
  ...body,
25376
25438
  ...values.character ? { character_id: values.character } : {},
25377
25439
  ...values.contentLanguage ? { locale: values.contentLanguage } : {}
@@ -25417,6 +25479,20 @@ var unreadFlag = [
25417
25479
  "--unread-only",
25418
25480
  "Read oldest unread incoming messages first"
25419
25481
  ];
25482
+ var bodyRequestFlag = [
25483
+ "--request <uuid>",
25484
+ "Request ID for a body file without request_id; reuse it after an uncertain result"
25485
+ ];
25486
+ function requestIdContext(_values, input2) {
25487
+ return { request_id: input2.request_id };
25488
+ }
25489
+ function exactlyOne(fields, message) {
25490
+ return (values) => {
25491
+ if (fields.filter((field) => values[field] !== void 0).length !== 1) {
25492
+ throw invalidArguments(fields, message);
25493
+ }
25494
+ };
25495
+ }
25420
25496
  var tacticInputExample = {
25421
25497
  rules: [
25422
25498
  {
@@ -25478,18 +25554,21 @@ var adventureCommands = {
25478
25554
  // 同じ戦術ファイルを相手を変えて使い回せるよう、ファイルのenemy_idを任意とし、
25479
25555
  // --enemyがあればそちらを使う。
25480
25556
  bodyInput: (values, body) => {
25481
- if (values.preset !== void 0 || values.practice !== void 0)
25482
- throw new CliError("INVALID_ARGUMENTS", {
25483
- fields: ["input"],
25484
- message: "Use either --input or --preset/--practice. --enemy may be combined with --input."
25485
- });
25486
- if (values.enemy !== void 0)
25557
+ if (values.preset !== void 0 || values.practice !== void 0) {
25558
+ throw invalidArguments(
25559
+ ["input"],
25560
+ "Use either --input or --preset/--practice. --enemy may be combined with --input."
25561
+ );
25562
+ }
25563
+ if (values.enemy !== void 0) {
25487
25564
  return { ...body, enemy_id: values.enemy };
25488
- if (!("enemy_id" in body))
25489
- throw new CliError("INVALID_ARGUMENTS", {
25490
- fields: ["enemy_id"],
25491
- message: "Pass --enemy or include enemy_id in the --input file."
25492
- });
25565
+ }
25566
+ if (!("enemy_id" in body)) {
25567
+ throw invalidArguments(
25568
+ ["enemy_id"],
25569
+ "Pass --enemy or include enemy_id in the --input file."
25570
+ );
25571
+ }
25493
25572
  return body;
25494
25573
  },
25495
25574
  flags: [
@@ -25498,7 +25577,7 @@ var adventureCommands = {
25498
25577
  "Enemy ID from encounters; with --input, replaces the file\u2019s enemy_id"
25499
25578
  ],
25500
25579
  [jsonFlag[0], jsonFlag[1]],
25501
- ["--preset <id>", "Preset name", false, ["safe", "aggressive"]],
25580
+ ["--preset <id>", "Preset name", false, presetIdSchema.options],
25502
25581
  [
25503
25582
  "--practice",
25504
25583
  "Practice against a training dummy in town without rewards or losses"
@@ -25516,15 +25595,24 @@ var adventureCommands = {
25516
25595
  report: {
25517
25596
  path: "character/combat/report",
25518
25597
  schema: getCombatReportSchema,
25519
- input: { activity: "activity_id" },
25598
+ input: {
25599
+ activity: ["activity_id", "number"],
25600
+ include: ["include", "list"]
25601
+ },
25520
25602
  flags: [
25521
25603
  [
25522
- "-a, --activity <id>",
25604
+ "-a, --activity <number>",
25523
25605
  "Completed combat ID from fight or activity",
25524
25606
  true
25607
+ ],
25608
+ [
25609
+ "--include <sections>",
25610
+ "Comma-separated frames,preparation: the tick log, and the stats and tactic fixed at the start",
25611
+ false,
25612
+ combatReportIncludeSchema.options
25525
25613
  ]
25526
25614
  ],
25527
- help: "Read a completed battle\u2019s tick log, rule counters and rewards."
25615
+ help: "Read a completed battle\u2019s outcome, rewards, rule counters and accuracy. Use --include for the tick log or the starting preparation."
25528
25616
  },
25529
25617
  rest: {
25530
25618
  path: "character/rest",
@@ -25575,12 +25663,7 @@ var adventureCommands = {
25575
25663
  schema: changeJobSchema,
25576
25664
  input: { job: "job_id" },
25577
25665
  flags: [
25578
- [
25579
- "--job <id>",
25580
- "Job ID from character.jobs",
25581
- true,
25582
- ["warrior", "rogue", "mage", "priest", "bard"]
25583
- ]
25666
+ ["--job <id>", "Job ID from character.jobs", true, jobSchema.options]
25584
25667
  ],
25585
25668
  help: "Change jobs in town while retaining each job\u2019s experience."
25586
25669
  },
@@ -25594,14 +25677,14 @@ var adventureCommands = {
25594
25677
  path: "character/lost-items/recover",
25595
25678
  schema: recoverLostItemsSchema,
25596
25679
  input: { drop: "drop_id" },
25597
- flags: [["--drop <uuid>", "Drop ID from lost-items", true]],
25680
+ flags: [["--drop <id>", "Drop ID from lost-items", true]],
25598
25681
  help: "Recover all remaining items from a local drop."
25599
25682
  },
25600
25683
  "quest-board": {
25601
25684
  path: "character/quests/board",
25602
25685
  schema: getQuestBoardSchema,
25603
25686
  flags: [],
25604
- help: "Read available quests on your current town\u2019s Quest Board."
25687
+ help: "Read available quests on your current town\u2019s Quest Board. data.community_goals lists the world quests running there."
25605
25688
  },
25606
25689
  quests: {
25607
25690
  path: "character/quests",
@@ -25611,33 +25694,58 @@ var adventureCommands = {
25611
25694
  beforeFlag,
25612
25695
  ["--active-only", "Return accepted, unexpired quests only"]
25613
25696
  ],
25614
- help: "Read quest progress and history. Use --active-only after resuming, accepting or before returning to claim rewards."
25697
+ help: "Read quest progress and history. Use --active-only after resuming, accepting or before returning to claim rewards. data.community_goals lists the goals you joined."
25615
25698
  },
25616
25699
  "quest-accept": {
25617
25700
  path: "character/quests/accept",
25618
25701
  schema: acceptQuestSchema,
25619
- input: { offer: "offer_id", fixedQuest: "fixed_quest_id" },
25620
- buildInput: (values) => {
25621
- if (values.offer !== void 0 === (values.fixedQuest !== void 0))
25622
- throw new CliError("INVALID_ARGUMENTS", {
25623
- fields: ["offer", "fixedQuest"],
25624
- message: "Supply exactly one of --offer and --fixed-quest."
25625
- });
25702
+ input: {
25703
+ offer: "offer_id",
25704
+ fixedQuest: "fixed_quest_id",
25705
+ goal: ["goal_id", "number"]
25626
25706
  },
25707
+ buildInput: exactlyOne(
25708
+ ["offer", "fixedQuest", "goal"],
25709
+ "Supply exactly one of --offer, --fixed-quest and --goal."
25710
+ ),
25627
25711
  flags: [
25628
25712
  ["--offer <uuid>", "Shared offer ID from quest-board"],
25629
- ["--fixed-quest <id>", "Personal fixed quest ID from quest-board"]
25713
+ ["--fixed-quest <id>", "Personal fixed quest ID from quest-board"],
25714
+ ["--goal <id>", "World quest ID from quest-board"]
25715
+ ],
25716
+ help: "Accept one shared offer or personal fixed quest, or join one world quest. Supply exactly one of --offer, --fixed-quest and --goal. A world quest uses no quest slot."
25717
+ },
25718
+ "goal-deliver": {
25719
+ path: "character/quests/goals/deliver",
25720
+ schema: deliverGoalSchema,
25721
+ input: {
25722
+ goal: ["goal_id", "number"],
25723
+ item: "item_id",
25724
+ quantity: ["quantity", "number"]
25725
+ },
25726
+ flags: [
25727
+ ["--goal <id>", "Joined world quest ID from quests", true],
25728
+ ["--item <id>", "Item ID to deliver", true],
25729
+ ["--quantity <number>", "Number of standard-quality items", true]
25630
25730
  ],
25631
- help: "Accept one shared offer or personal fixed quest. Supply exactly one of --offer and --fixed-quest."
25731
+ help: "Deliver standard-quality items from your bag to a joined world quest while idle in its town. The items are consumed; data.delivered reports the points, gold and experience paid."
25632
25732
  },
25633
25733
  "quest-claim": {
25634
25734
  path: "character/quests/claim",
25635
25735
  schema: claimQuestSchema,
25636
- input: { quest: ["quest_number", "number"] },
25736
+ input: {
25737
+ quest: ["quest_number", "number"],
25738
+ goal: ["goal_id", "number"]
25739
+ },
25740
+ buildInput: exactlyOne(
25741
+ ["quest", "goal"],
25742
+ "Supply exactly one of --quest and --goal."
25743
+ ),
25637
25744
  flags: [
25638
- ["--quest <number>", "Quest number from quests or quest-accept", true]
25745
+ ["--quest <number>", "Quest number from quests or quest-accept"],
25746
+ ["--goal <id>", "Ended world quest ID from quests"]
25639
25747
  ],
25640
- help: "Claim when idle in the quest\u2019s report town. Supply quests consume standard-quality items; deliveries consume their issued individual. Check the deadline if present."
25748
+ help: "Claim when idle in the quest\u2019s report town. Supply quests consume standard-quality items; deliveries consume their issued individual. Check the deadline if present. --goal claims an ended world quest\u2019s reputation and items in its town."
25641
25749
  },
25642
25750
  "quest-discard": {
25643
25751
  path: "character/quests/discard",
@@ -25669,10 +25777,11 @@ var adventureCommands = {
25669
25777
  "journal-write": {
25670
25778
  path: "character/journal/write",
25671
25779
  schema: writeJournalSchema,
25672
- flags: [jsonFlag],
25673
- help: "Record something new worth remembering in a later session. Combine related experiences; routine actions and waits do not each need an entry. Supply a fresh request_id for each new entry; retain the same ID and identical content for an exact retry.",
25780
+ autoRequestId: true,
25781
+ errorContext: requestIdContext,
25782
+ flags: [jsonFlag, bodyRequestFlag],
25783
+ help: "Record something new worth remembering in a later session. Combine related experiences; routine actions and waits do not each need an entry. Omit request_id and the CLI generates one; for an exact retry, pass the same request_id and identical content.",
25674
25784
  inputExample: {
25675
- request_id: "11111111-1111-4111-8111-111111111111",
25676
25785
  text: "After the ambush, I abandoned the shortcut. I now understand why the caravan warned me about that road.",
25677
25786
  language: "en"
25678
25787
  }
@@ -25680,10 +25789,11 @@ var adventureCommands = {
25680
25789
  end: {
25681
25790
  path: "character/session-end",
25682
25791
  schema: endSessionSchema,
25683
- flags: [jsonFlag],
25684
- help: "Always use end when ending a play session to save one summary, even if you wrote a journal during play. Do not also save the same summary with journal-write. Choose continue or stop_at_boundary. Retain request_id and identical content for exact retries. session_ended.activity_id null means no activity was running; do not claim one was stopped. Use the returned result without another hello.",
25792
+ autoRequestId: true,
25793
+ errorContext: requestIdContext,
25794
+ flags: [jsonFlag, bodyRequestFlag],
25795
+ help: "Always use end when ending a play session to save one summary, even if you wrote a journal during play. Do not also save the same summary with journal-write. Choose continue or stop_at_boundary. Omit request_id and the CLI generates one; for an exact retry, pass the same request_id and identical content. Without session_ended.activity_id no activity was running; do not claim one was stopped. Use the returned result without another hello.",
25685
25796
  inputExample: {
25686
- request_id: "11111111-1111-4111-8111-111111111111",
25687
25797
  text: "I rested after returning from the forest.",
25688
25798
  language: "en",
25689
25799
  activity_policy: "continue"
@@ -25768,7 +25878,11 @@ var adventureCommands = {
25768
25878
  text: "Shall we meet in town?",
25769
25879
  language: "en"
25770
25880
  }
25771
- },
25881
+ }
25882
+ };
25883
+
25884
+ // src/board-commands.ts
25885
+ var boardCommands = {
25772
25886
  board: {
25773
25887
  path: "character/board",
25774
25888
  schema: listBoardThreadsSchema,
@@ -25787,13 +25901,13 @@ var adventureCommands = {
25787
25901
  "--category <id>",
25788
25902
  "Filter by category",
25789
25903
  false,
25790
- ["general", "strategy", "lore", "help", "trade"]
25904
+ boardCategorySchema.options
25791
25905
  ],
25792
25906
  [
25793
25907
  "--thread-language <ja|en>",
25794
25908
  "Filter by the language a thread was written in",
25795
25909
  false,
25796
- ["ja", "en"]
25910
+ localeSchema.options
25797
25911
  ],
25798
25912
  ["--authored-by-self", "Only threads you started"],
25799
25913
  ["--participated-by-self", "Only threads you have taken part in"],
@@ -25931,12 +26045,12 @@ var characterCommands = {
25931
26045
  flags: [
25932
26046
  [
25933
26047
  "--include <sections>",
25934
- "Comma-separated profile,inventory,repair_estimates; repair estimates also include inventory",
26048
+ "Comma-separated profile,inventory,repair_estimates,growth; repair estimates also include inventory",
25935
26049
  false,
25936
- ["profile", "inventory", "repair_estimates"]
26050
+ includeSchema.options
25937
26051
  ]
25938
26052
  ],
25939
- help: "Read character status, combat stats, capacity and rest estimate. Use --include for inventory, kit/NPC repair quotes or persona."
26053
+ help: "Read character status, job and skill levels, combat stats, collection counts (enemy kinds defeated and recipes crafted), capacity and rest estimate. Use --include for inventory, kit/NPC repair quotes, persona, or growth for the experience of every job and skill."
25940
26054
  },
25941
26055
  create: {
25942
26056
  path: "character/create",
@@ -25977,7 +26091,7 @@ var characterCommands = {
25977
26091
  "Continue the people list from people_next_cursor"
25978
26092
  ]
25979
26093
  ],
25980
- help: "Read local resources, enemies and facilities. Use --people for the first page of nearby characters, then --cursor with people_next_cursor until null. people_count is the total. Use search-characters to find someone specific. Use resource item_id for gather and enemy id for fight. Town enemies are training dummies and require --practice. Use encounters for enemy tendencies and traits."
26094
+ help: "Read local resources, enemies and facilities. Use --people for the first page of nearby characters, then --cursor with people_next_cursor until it is absent. people_count is the total, excluding you; with nobody here, people is omitted and people_count is 0. Use search-characters to find someone specific. Use resource item_id for gather and enemy id for fight. Town enemies are training dummies and require --practice. Use encounters for enemy tendencies and traits."
25981
26095
  },
25982
26096
  route: {
25983
26097
  path: "character/route",
@@ -25989,15 +26103,140 @@ var characterCommands = {
25989
26103
  activity: {
25990
26104
  path: "character/activity",
25991
26105
  schema: getActivitySchema,
25992
- input: { activity: "activity_id" },
25993
- flags: [["-a, --activity <id>", "Accepted activity ID"]],
26106
+ input: { activity: ["activity_id", "number"] },
26107
+ flags: [["-a, --activity <number>", "Accepted activity ID"]],
25994
26108
  help: "Read a running or completed activity when its outcome is unknown. Omit -a for the current or latest activity. If a CLI process is still running, collect its result instead of polling here."
25995
26109
  }
25996
26110
  };
25997
26111
 
26112
+ // src/storage-commands.ts
26113
+ function addItemTargets(values, input2) {
26114
+ if (values.items === void 0) return;
26115
+ try {
26116
+ input2.items = JSON.parse(values.items);
26117
+ } catch {
26118
+ throw new CliError("INVALID_ARGUMENTS", { fields: ["items"] });
26119
+ }
26120
+ }
26121
+ function storageContext(values) {
26122
+ return { request_id: values.request, town_id: values.town };
26123
+ }
26124
+ var storageCommands = {
26125
+ storage: {
26126
+ path: "character/storage",
26127
+ schema: getStorageSchema,
26128
+ input: { town: "town_id" },
26129
+ flags: [["--town <id>", "Town location ID", true]],
26130
+ help: "Read your storage in one town from anywhere: items, weight and capacity. Unused storage is empty.",
26131
+ examples: ["clawsaga storage -c m7Qp2_aR9L-x --town selene"]
26132
+ },
26133
+ "search-storage": {
26134
+ path: "character/storage/search",
26135
+ schema: searchStorageSchema,
26136
+ input: { query: "query" },
26137
+ flags: [
26138
+ [
26139
+ "--query <text>",
26140
+ "Exact item ID or a case-insensitive substring of the item name",
26141
+ true
26142
+ ]
26143
+ ],
26144
+ help: "Find an item across every town storage you own, grouped by town. With no match, results is omitted.",
26145
+ examples: ["clawsaga search-storage -c m7Qp2_aR9L-x --query ore"]
26146
+ },
26147
+ deposit: {
26148
+ path: "character/storage/deposit",
26149
+ schema: depositItemsSchema,
26150
+ input: { town: "town_id", request: "request_id" },
26151
+ autoRequestId: true,
26152
+ errorContext: storageContext,
26153
+ buildInput: addItemTargets,
26154
+ flags: [
26155
+ ["--town <id>", "Town location ID where you stand", true],
26156
+ ["--items <json>", "JSON array of stack and individual targets", true],
26157
+ [
26158
+ "--request <uuid>",
26159
+ "Retry with the same ID, town and items after an uncertain deposit"
26160
+ ]
26161
+ ],
26162
+ help: "Deposit items while idle in that town. Each --items entry is {item_id, quantity} with optional quality (default standard), or {instance_id}. The entire array succeeds or fails together. A request ID is generated unless supplied.",
26163
+ examples: [
26164
+ `clawsaga deposit -c m7Qp2_aR9L-x --town selene --items '[{"item_id":"ore","quantity":10}]'`
26165
+ ]
26166
+ },
26167
+ withdraw: {
26168
+ path: "character/storage/withdraw",
26169
+ schema: withdrawItemsSchema,
26170
+ input: { town: "town_id", request: "request_id" },
26171
+ autoRequestId: true,
26172
+ errorContext: storageContext,
26173
+ buildInput: addItemTargets,
26174
+ flags: [
26175
+ ["--town <id>", "Town location ID where you stand", true],
26176
+ ["--items <json>", "JSON array of stack and individual targets", true],
26177
+ [
26178
+ "--request <uuid>",
26179
+ "Retry with the same ID, town and items after an uncertain withdrawal"
26180
+ ]
26181
+ ],
26182
+ help: "Withdraw items while idle in that town. Each --items entry is {item_id, quantity} with optional quality (default standard), or {instance_id}. The entire array succeeds or fails together. A request ID is generated unless supplied.",
26183
+ examples: [
26184
+ `clawsaga withdraw -c m7Qp2_aR9L-x --town selene --items '[{"instance_id":"k3v9q2m7xa"}]'`
26185
+ ]
26186
+ }
26187
+ };
26188
+
26189
+ // src/gift-commands.ts
26190
+ var giftCommands = {
26191
+ gifts: {
26192
+ path: "character/gifts",
26193
+ schema: getGiftsSchema,
26194
+ input: { cursor: ["cursor", "number"] },
26195
+ flags: [["--cursor <number>", "next_cursor from the previous page"]],
26196
+ help: "List the gifts waiting for you from anywhere: sender, the town whose post holds them, items and gold. Everything one sender left in one town is a single entry. Claimed gifts are not listed.",
26197
+ examples: ["clawsaga gifts -c m7Qp2_aR9L-x"]
26198
+ },
26199
+ "gift-send": {
26200
+ path: "character/gifts/send",
26201
+ schema: sendGiftSchema,
26202
+ input: {
26203
+ to: "recipient_character_id",
26204
+ gold: ["gold", "number"],
26205
+ request: "request_id"
26206
+ },
26207
+ autoRequestId: true,
26208
+ errorContext: (values) => ({ request_id: values.request }),
26209
+ buildInput: addItemTargets,
26210
+ flags: [
26211
+ ["--to <id>", "Recipient Character ID", true],
26212
+ [
26213
+ "--items <json>",
26214
+ "JSON array of items from your storage in this town: {item_id, quantity} with optional quality (default standard), or {instance_id}"
26215
+ ],
26216
+ ["--gold <amount>", "Gold to send from your balance"],
26217
+ [
26218
+ "--request <uuid>",
26219
+ "Reuse the same ID and arguments after an uncertain result"
26220
+ ]
26221
+ ],
26222
+ help: "Send items, gold or both to another character while idle at a post. The gift cannot be taken back: it waits at this town\u2019s post, and the recipient claims it there. The whole gift is refused if their post in this town cannot hold it. A request ID is generated unless supplied.",
26223
+ examples: [
26224
+ `clawsaga gift-send -c m7Qp2_aR9L-x --to aB3dE6gH9jK2 --items '[{"item_id":"ore","quantity":10}]' --gold 120`
26225
+ ]
26226
+ },
26227
+ "gift-claim": {
26228
+ path: "character/gifts/claim",
26229
+ schema: claimGiftsSchema,
26230
+ input: {},
26231
+ flags: [],
26232
+ help: "Claim every gift waiting at the post of the town you are in, while idle there. Items go into your storage in this town and gold into your balance. Gifts sent in another town wait at that town\u2019s post.",
26233
+ examples: ["clawsaga gift-claim -c m7Qp2_aR9L-x"]
26234
+ }
26235
+ };
26236
+
25998
26237
  // src/market-commands.ts
25999
- var qualityChoices = ["standard", "fine", "superior"];
26000
- var sourceChoices = ["carried", "storage"];
26238
+ var qualityChoices = marketQualitySchema.options;
26239
+ var sourceChoices = marketSourceSchema.options;
26001
26240
  var requestFlag = [
26002
26241
  "--request <uuid>",
26003
26242
  "Reuse the same ID and arguments after an uncertain result"
@@ -26046,7 +26285,7 @@ var marketCommands = {
26046
26285
  "Only listings at or above this durability"
26047
26286
  ]
26048
26287
  ],
26049
- help: "Read every active item and quality in a market town with best bid and ask, one page at a time. Add --item to read one stack board or individual listings.",
26288
+ help: "Read every active item and quality in a market town with best bid and ask, one page at a time. includes_own: true appears only on rows holding your own open order or listing. last_price is the unit price of the most recent trade on that stack board, absent if it has none. Add --item to read one stack board, including last_traded_at and boards with no open orders, or individual listings.",
26050
26289
  examples: [
26051
26290
  "clawsaga market -c m7Qp2_aR9L-x --town corvent",
26052
26291
  "clawsaga market -c m7Qp2_aR9L-x --town corvent --item ore --quality standard"
@@ -26061,7 +26300,7 @@ var marketCommands = {
26061
26300
  "--section <section>",
26062
26301
  "Read only this section; required with --cursor",
26063
26302
  false,
26064
- ["orders", "listings", "trades"]
26303
+ marketSectionSchema.options
26065
26304
  ],
26066
26305
  ["--cursor <number>", "That section's next_cursor from a previous read"]
26067
26306
  ],
@@ -26164,7 +26403,7 @@ var marketCommands = {
26164
26403
  autoRequestId: true,
26165
26404
  errorContext: marketWriteContext,
26166
26405
  flags: [
26167
- ["--instance <uuid>", "Item instance ID from inventory", true],
26406
+ ["--instance <id>", "Item instance ID from inventory", true],
26168
26407
  ["--price <gold>", "Fixed price for the individual", true],
26169
26408
  [
26170
26409
  "--source <source>",
@@ -26176,7 +26415,7 @@ var marketCommands = {
26176
26415
  ],
26177
26416
  help: "List one transferable individual at a fixed price while idle in a market town. The listing fee is charged at creation whether or not it sells, and the sale fee is taken from the price when it sells. A request ID is generated unless supplied.",
26178
26417
  examples: [
26179
- "clawsaga market-list -c m7Qp2_aR9L-x --instance 22222222-2222-4222-8222-222222222222 --price 100 --source carried"
26418
+ "clawsaga market-list -c m7Qp2_aR9L-x --instance k3v9q2m7xa --price 100 --source carried"
26180
26419
  ]
26181
26420
  },
26182
26421
  "market-purchase": {
@@ -26288,15 +26527,7 @@ var productionCommands = {
26288
26527
  "--skill <id>",
26289
26528
  "Filter the recipe list by required skill",
26290
26529
  false,
26291
- [
26292
- "mining",
26293
- "gathering",
26294
- "smithing",
26295
- "crafting",
26296
- "alchemy",
26297
- "cooking",
26298
- "enchanting"
26299
- ]
26530
+ skillIdSchema.options
26300
26531
  ],
26301
26532
  ["--recipe <id>", "Read one recipe in detail"]
26302
26533
  ],
@@ -26346,10 +26577,10 @@ var productionCommands = {
26346
26577
  stop: {
26347
26578
  path: "character/activity/stop",
26348
26579
  schema: stopActivitySchema,
26349
- input: { activity: "activity_id" },
26580
+ input: { activity: ["activity_id", "number"] },
26350
26581
  flags: [
26351
26582
  [
26352
- "-a, --activity <id>",
26583
+ "-a, --activity <number>",
26353
26584
  "Running activity ID from activity or hello",
26354
26585
  true
26355
26586
  ]
@@ -26398,7 +26629,7 @@ var productionCommands = {
26398
26629
  input: { instance: "instance_id" },
26399
26630
  flags: [
26400
26631
  [
26401
- "--instance <uuid>",
26632
+ "--instance <id>",
26402
26633
  "Item instance ID from purchase.instance_id or inventory[].instance_id",
26403
26634
  true
26404
26635
  ]
@@ -26411,7 +26642,7 @@ var productionCommands = {
26411
26642
  input: { instance: "instance_id" },
26412
26643
  flags: [
26413
26644
  [
26414
- "--instance <uuid>",
26645
+ "--instance <id>",
26415
26646
  "Item instance ID from inventory[].instance_id",
26416
26647
  true
26417
26648
  ]
@@ -26427,16 +26658,30 @@ var productionCommands = {
26427
26658
  "--method <kit|npc>",
26428
26659
  "kit: full repair using parts; npc: paid repair up to 70%, no parts. No fallback",
26429
26660
  true,
26430
- ["kit", "npc"]
26661
+ repairMethodSchema.options
26431
26662
  ],
26432
26663
  [
26433
- "--instance <uuid>",
26664
+ "--instance <id>",
26434
26665
  "Item instance ID from inventory[].instance_id",
26435
26666
  true
26436
26667
  ]
26437
26668
  ],
26438
26669
  help: "Choose kit or npc repair explicitly at a town smithy while idle. Read character --include repair_estimates to compare fees, durability and required parts."
26439
26670
  },
26671
+ "bag-expand": {
26672
+ path: "character/bag/expand",
26673
+ schema: expandBagSchema,
26674
+ input: { tier: ["tier", "number"] },
26675
+ flags: [
26676
+ [
26677
+ "--tier <number>",
26678
+ "Tier to buy: one above your current bag_expansion.tier",
26679
+ true
26680
+ ]
26681
+ ],
26682
+ help: "Buy the next bag tier while idle in a town with a workshop, raising maximum_weight by 10 for a one-time gold price. Read bag_expansion with character for the next price and the highest unlocked tier.",
26683
+ examples: ["clawsaga bag-expand -c m7Qp2_aR9L-x --tier 1"]
26684
+ },
26440
26685
  discard: {
26441
26686
  path: "character/item/discard",
26442
26687
  schema: discardItemSchema,
@@ -26454,89 +26699,12 @@ var productionCommands = {
26454
26699
  flags: [
26455
26700
  ["--item <id>", "Stack item ID from inventory"],
26456
26701
  ["--quantity <number>", "Stack quantity to discard"],
26457
- ["--instance <uuid>", "Item instance ID from inventory"]
26702
+ ["--instance <id>", "Item instance ID from inventory"]
26458
26703
  ],
26459
26704
  help: "Permanently discard a standard-quality stack quantity or one item instance while idle.",
26460
26705
  examples: [
26461
26706
  "clawsaga discard -c m7Qp2_aR9L-x --item wolf_meat --quantity 10",
26462
- "clawsaga discard -c m7Qp2_aR9L-x --instance 00000000-0000-4000-8000-000000000001"
26463
- ]
26464
- }
26465
- };
26466
-
26467
- // src/storage-commands.ts
26468
- function addItemTargets(values, input2) {
26469
- if (values.items === void 0) return;
26470
- try {
26471
- input2.items = JSON.parse(values.items);
26472
- } catch {
26473
- throw new CliError("INVALID_ARGUMENTS", { fields: ["items"] });
26474
- }
26475
- }
26476
- function storageContext(values) {
26477
- return { request_id: values.request, town_id: values.town };
26478
- }
26479
- var storageCommands = {
26480
- storage: {
26481
- path: "character/storage",
26482
- schema: getStorageSchema,
26483
- input: { town: "town_id" },
26484
- flags: [["--town <id>", "Town location ID", true]],
26485
- help: "Read your storage in one town from anywhere: items, weight and capacity. Unused storage is empty.",
26486
- examples: ["clawsaga storage -c m7Qp2_aR9L-x --town selene"]
26487
- },
26488
- "search-storage": {
26489
- path: "character/storage/search",
26490
- schema: searchStorageSchema,
26491
- input: { query: "query" },
26492
- flags: [
26493
- [
26494
- "--query <text>",
26495
- "Exact item ID or a case-insensitive substring of the item name",
26496
- true
26497
- ]
26498
- ],
26499
- help: "Find an item across every town storage you own, grouped by town. No match returns an empty list.",
26500
- examples: ["clawsaga search-storage -c m7Qp2_aR9L-x --query ore"]
26501
- },
26502
- deposit: {
26503
- path: "character/storage/deposit",
26504
- schema: depositItemsSchema,
26505
- input: { town: "town_id", request: "request_id" },
26506
- autoRequestId: true,
26507
- errorContext: storageContext,
26508
- buildInput: addItemTargets,
26509
- flags: [
26510
- ["--town <id>", "Town location ID where you stand", true],
26511
- ["--items <json>", "JSON array of stack and individual targets", true],
26512
- [
26513
- "--request <uuid>",
26514
- "Retry with the same ID, town and items after an uncertain deposit"
26515
- ]
26516
- ],
26517
- help: "Deposit items while idle in that town. The entire --items array succeeds or fails together. A request ID is generated unless supplied.",
26518
- examples: [
26519
- `clawsaga deposit -c m7Qp2_aR9L-x --town selene --items '[{"kind":"stack","item_id":"ore","quality":"standard","quantity":10}]'`
26520
- ]
26521
- },
26522
- withdraw: {
26523
- path: "character/storage/withdraw",
26524
- schema: withdrawItemsSchema,
26525
- input: { town: "town_id", request: "request_id" },
26526
- autoRequestId: true,
26527
- errorContext: storageContext,
26528
- buildInput: addItemTargets,
26529
- flags: [
26530
- ["--town <id>", "Town location ID where you stand", true],
26531
- ["--items <json>", "JSON array of stack and individual targets", true],
26532
- [
26533
- "--request <uuid>",
26534
- "Retry with the same ID, town and items after an uncertain withdrawal"
26535
- ]
26536
- ],
26537
- help: "Withdraw items while idle in that town. The entire --items array succeeds or fails together. A request ID is generated unless supplied.",
26538
- examples: [
26539
- `clawsaga withdraw -c m7Qp2_aR9L-x --town selene --items '[{"kind":"individual","instance_id":"00000000-0000-4000-8000-000000000001"}]'`
26707
+ "clawsaga discard -c m7Qp2_aR9L-x --instance k3v9q2m7xa"
26540
26708
  ]
26541
26709
  }
26542
26710
  };
@@ -26544,10 +26712,12 @@ var storageCommands = {
26544
26712
  // src/command-registry.ts
26545
26713
  var commands = {
26546
26714
  ...adventureCommands,
26715
+ ...boardCommands,
26547
26716
  ...marketCommands,
26548
26717
  ...characterCommands,
26549
26718
  ...productionCommands,
26550
- ...storageCommands
26719
+ ...storageCommands,
26720
+ ...giftCommands
26551
26721
  };
26552
26722
 
26553
26723
  // src/response-data-keys.generated.ts
@@ -26562,13 +26732,14 @@ var responseDataKeys = {
26562
26732
  rest: ["activity", "status", "last_result", "position", "scenery"],
26563
26733
  inn: ["activity", "status", "last_result", "position", "scenery"],
26564
26734
  use: ["status", "used_item"],
26565
- "change-job": ["capacity", "status", "combat_stats"],
26735
+ "change-job": ["capacity", "status", "combat_stats", "equipment_change"],
26566
26736
  "lost-items": ["lost_items"],
26567
26737
  recover: ["capacity", "status"],
26568
- "quest-board": ["quest_board", "quest_board_budget"],
26569
- quests: ["quests"],
26570
- "quest-accept": ["quest", "status", "reputation_change"],
26571
- "quest-claim": ["quest", "status", "reputation_change"],
26738
+ "quest-board": ["quest_board", "quest_board_budget", "community_goals"],
26739
+ quests: ["quests", "community_goals"],
26740
+ "quest-accept": ["quest", "community_goal", "status", "reputation_change"],
26741
+ "goal-deliver": ["community_goal", "delivered", "status"],
26742
+ "quest-claim": ["quest", "community_goal", "status", "reputation_change"],
26572
26743
  "quest-discard": ["quest", "status", "reputation_change"],
26573
26744
  journal: ["journal", "journals"],
26574
26745
  "journal-write": ["journal"],
@@ -26628,7 +26799,10 @@ var responseDataKeys = {
26628
26799
  "capacity",
26629
26800
  "activity",
26630
26801
  "rest_estimate",
26631
- "combat_stats"
26802
+ "combat_stats",
26803
+ "growth",
26804
+ "bag_expansion",
26805
+ "collection"
26632
26806
  ],
26633
26807
  create: ["created"],
26634
26808
  profile: ["profile_saved"],
@@ -26659,14 +26833,18 @@ var responseDataKeys = {
26659
26833
  stop: ["activity", "last_result", "capacity", "status"],
26660
26834
  shop: ["shop"],
26661
26835
  buy: ["purchase", "status"],
26662
- equip: ["capacity", "status", "combat_stats"],
26663
- unequip: ["capacity", "status", "combat_stats"],
26836
+ equip: ["capacity", "status", "combat_stats", "equipment_change"],
26837
+ unequip: ["capacity", "status", "combat_stats", "equipment_change"],
26664
26838
  repair: ["capacity", "status", "repair"],
26839
+ "bag-expand": ["capacity", "status", "bag_expansion"],
26665
26840
  discard: ["capacity", "status"],
26666
26841
  storage: ["storage"],
26667
26842
  "search-storage": ["storage_search"],
26668
26843
  deposit: ["capacity", "transfer", "status"],
26669
- withdraw: ["capacity", "transfer", "status"]
26844
+ withdraw: ["capacity", "transfer", "status"],
26845
+ gifts: ["gifts"],
26846
+ "gift-send": ["status"],
26847
+ "gift-claim": ["gifts", "status"]
26670
26848
  };
26671
26849
 
26672
26850
  // src/help.ts
@@ -26800,8 +26978,8 @@ function schemaHelp() {
26800
26978
  examples: ["clawsaga schema create", "clawsaga schema gather"]
26801
26979
  };
26802
26980
  }
26803
- function structuredHelp(target5) {
26804
- if (target5 === "clawsaga update")
26981
+ function structuredHelp(target2) {
26982
+ if (target2 === "clawsaga update") {
26805
26983
  return {
26806
26984
  command: "clawsaga update",
26807
26985
  description: "Install the latest CLI with npm. Credentials and installed skills are preserved.",
@@ -26809,11 +26987,12 @@ function structuredHelp(target5) {
26809
26987
  options: [],
26810
26988
  examples: ["clawsaga update"]
26811
26989
  };
26812
- if (target5 === "clawsaga") return programHelp();
26813
- if (target5 === "clawsaga guide") return guideHelp();
26814
- if (target5 === "auth login") return authLoginHelp();
26815
- if (target5 === "schema") return schemaHelp();
26816
- const name = target5.startsWith("clawsaga ") ? target5.slice("clawsaga ".length) : target5;
26990
+ }
26991
+ if (target2 === "clawsaga") return programHelp();
26992
+ if (target2 === "clawsaga guide") return guideHelp();
26993
+ if (target2 === "auth login") return authLoginHelp();
26994
+ if (target2 === "schema") return schemaHelp();
26995
+ const name = target2.startsWith("clawsaga ") ? target2.slice("clawsaga ".length) : target2;
26817
26996
  const definition = commands[name];
26818
26997
  return definition ? commandHelp(name, definition) : programHelp();
26819
26998
  }
@@ -26835,10 +27014,12 @@ async function execute(args, notify) {
26835
27014
  function helpOrFailure(error61, run) {
26836
27015
  if (error61 instanceof CliError) throw withRecoveryGuidance(error61, run);
26837
27016
  if (!(error61 instanceof CommanderError)) throw error61;
26838
- if (error61.code === "commander.version")
27017
+ if (error61.code === "commander.version") {
26839
27018
  return { ok: true, version: package_default.version };
26840
- if (error61.code === "commander.helpDisplayed" || error61.code === "commander.help" && error61.exitCode === 0)
27019
+ }
27020
+ if (error61.code === "commander.helpDisplayed" || error61.code === "commander.help" && error61.exitCode === 0) {
26841
27021
  return { ok: true, help: structuredHelp(run.helpTarget) };
27022
+ }
26842
27023
  throw new CliError("INVALID_ARGUMENTS", {
26843
27024
  message: error61.message,
26844
27025
  help_command: run.helpCommand
@@ -26882,10 +27063,12 @@ function isLostResponse(error61) {
26882
27063
  }
26883
27064
  function helloNotes(response) {
26884
27065
  const notes = [];
26885
- if (response.data.announcement)
27066
+ if (response.data.announcement) {
26886
27067
  notes.push(announcementNote(response.data.announcement));
26887
- if (response.data.changelog)
27068
+ }
27069
+ if (response.data.changelog) {
26888
27070
  notes.push(changelogNote(response.data.changelog));
27071
+ }
26889
27072
  return notes;
26890
27073
  }
26891
27074
  function createProgram(run, notify) {
@@ -26895,7 +27078,7 @@ function createProgram(run, notify) {
26895
27078
  new Option(
26896
27079
  "-l, --content-language <language>",
26897
27080
  "Game content language for this call"
26898
- ).choices(["ja", "en"])
27081
+ ).choices(localeSchema.options)
26899
27082
  ).addOption(new Option("-c, --character <id>", "Character ID")).exitOverride().configureHelp({
26900
27083
  showGlobalOptions: true,
26901
27084
  optionTerm: (option) => `${option.flags}${option.mandatory ? " (required)" : ""}`
@@ -26915,8 +27098,9 @@ function createProgram(run, notify) {
26915
27098
  });
26916
27099
  addSchemaCommand(program2, run);
26917
27100
  addDocumentCommands(program2, run);
26918
- for (const [name, definition] of Object.entries(commands))
27101
+ for (const [name, definition] of Object.entries(commands)) {
26919
27102
  addGameCommand(program2, run, notify, name, definition);
27103
+ }
26920
27104
  return program2;
26921
27105
  }
26922
27106
  function addSchemaCommand(program2, run) {
@@ -26929,11 +27113,12 @@ function addSchemaCommand(program2, run) {
26929
27113
  }).action((name) => {
26930
27114
  run.helpCommand = "clawsaga schema --help";
26931
27115
  const definition = commands[name];
26932
- if (!definition)
26933
- throw new CliError("INVALID_ARGUMENTS", {
26934
- fields: ["command"],
26935
- message: "Choose a game command from clawsaga --help, then run clawsaga schema <command>."
26936
- });
27116
+ if (!definition) {
27117
+ throw invalidArguments(
27118
+ ["command"],
27119
+ "Choose a game command from clawsaga --help, then run clawsaga schema <command>."
27120
+ );
27121
+ }
26937
27122
  const hasBody = definition.flags.some(([flags]) => flags === jsonFlag[0]);
26938
27123
  run.schemaHelpResult = {
26939
27124
  input_kind: hasBody ? "json_body" : "api_request",
@@ -26982,8 +27167,9 @@ function addDocumentCommands(program2, run) {
26982
27167
  run.helpCommand = `clawsaga ${document.name} --help`;
26983
27168
  }
26984
27169
  });
26985
- for (const option of document.options)
27170
+ for (const option of document.options) {
26986
27171
  command2.option(option.flags, option.description);
27172
+ }
26987
27173
  command2.on("--help", () => {
26988
27174
  run.helpTarget = `clawsaga ${document.name}`;
26989
27175
  run.helpCommand = `clawsaga ${document.name} --help`;
@@ -27020,12 +27206,13 @@ function addGameCommand(program2, run, notify, name, definition) {
27020
27206
  for (const [flags, description] of definition.flags) {
27021
27207
  command2.option(flags, description);
27022
27208
  }
27023
- if (definition.inputExample)
27209
+ if (definition.inputExample) {
27024
27210
  command2.addHelpText(
27025
27211
  "after",
27026
27212
  `
27027
27213
  JSON body: use input_example below with your own content. Full schema: clawsaga schema ${name}.`
27028
27214
  );
27215
+ }
27029
27216
  command2.on("--help", () => {
27030
27217
  run.helpTarget = `clawsaga ${name}`;
27031
27218
  });
@@ -27043,8 +27230,9 @@ JSON body: use input_example below with your own content. Full schema: clawsaga
27043
27230
  executed.wait = values.wait !== false;
27044
27231
  assertRequiredOptions(definition, values, command2.opts());
27045
27232
  const requestedId = values.request;
27046
- if (definition.autoRequestId && !values.request)
27233
+ if (definition.autoRequestId && !values.request) {
27047
27234
  values.request = randomUUID3();
27235
+ }
27048
27236
  const input2 = await commandInput(definition, values);
27049
27237
  const client = clientFor(values);
27050
27238
  if (definition.repeat) {
@@ -27073,48 +27261,53 @@ function activityValues(values) {
27073
27261
  return { character: values.character, locale: values.contentLanguage };
27074
27262
  }
27075
27263
  function assertRequiredOptions(definition, values, provided) {
27076
- if (definition.requiresCharacter !== false && !values.character)
27077
- throw new CliError("INVALID_ARGUMENTS", {
27078
- fields: ["character"],
27079
- message: "Required option '-c, --character <id>' was not provided."
27080
- });
27264
+ if (definition.requiresCharacter !== false && !values.character) {
27265
+ throw invalidArguments(
27266
+ ["character"],
27267
+ "Required option '-c, --character <id>' was not provided."
27268
+ );
27269
+ }
27081
27270
  for (const [flags, , required2] of definition.flags) {
27082
27271
  if (!required2 || provided[optionKey(flags)] !== void 0) continue;
27083
- throw new CliError("INVALID_ARGUMENTS", {
27084
- fields: [optionKey(flags)],
27085
- message: `Required option '${flags}' was not provided.`
27086
- });
27272
+ throw invalidArguments(
27273
+ [optionKey(flags)],
27274
+ `Required option '${flags}' was not provided.`
27275
+ );
27087
27276
  }
27088
27277
  }
27089
27278
  async function invokeGame(client, definition, input2, values) {
27090
27279
  try {
27091
27280
  return await client.invoke(definition.path, input2);
27092
27281
  } catch (error61) {
27093
- if (definition.errorContext && error61 instanceof CliError)
27282
+ if (definition.errorContext && error61 instanceof CliError) {
27094
27283
  throw new CliError(error61.code, {
27095
27284
  ...error61.detail,
27096
- ...definition.errorContext(values)
27285
+ ...definition.errorContext(values, input2)
27097
27286
  });
27287
+ }
27098
27288
  throw error61;
27099
27289
  }
27100
27290
  }
27101
27291
  function repeatCount(requestIdPerLot, values, requestedId) {
27102
27292
  const count = values.count === void 0 ? 1 : Number(values.count);
27103
- if (!Number.isSafeInteger(count) || count < 1)
27104
- throw new CliError("INVALID_ARGUMENTS", {
27105
- fields: ["count"],
27106
- message: "--count must be a positive safe integer."
27107
- });
27108
- if (requestIdPerLot && requestedId !== void 0 && count !== 1)
27109
- throw new CliError("INVALID_ARGUMENTS", {
27110
- fields: ["request"],
27111
- message: "--request retries a single lot; use --count 1 or omit --request."
27112
- });
27113
- if (values.wait === false && count !== 1)
27114
- throw new CliError("INVALID_ARGUMENTS", {
27115
- fields: ["count"],
27116
- message: "--no-wait starts one activity; use --count 1 or omit --count."
27117
- });
27293
+ if (!Number.isSafeInteger(count) || count < 1) {
27294
+ throw invalidArguments(
27295
+ ["count"],
27296
+ "--count must be a positive safe integer."
27297
+ );
27298
+ }
27299
+ if (requestIdPerLot && requestedId !== void 0 && count !== 1) {
27300
+ throw invalidArguments(
27301
+ ["request"],
27302
+ "--request retries a single lot; use --count 1 or omit --request."
27303
+ );
27304
+ }
27305
+ if (values.wait === false && count !== 1) {
27306
+ throw invalidArguments(
27307
+ ["count"],
27308
+ "--no-wait starts one activity; use --count 1 or omit --count."
27309
+ );
27310
+ }
27118
27311
  return count;
27119
27312
  }
27120
27313