@pmate/cli 0.24.9 → 0.24.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -9071,7 +9071,7 @@ __export(index_exports, {
9071
9071
  parseCommandArgs: () => parseCommandArgs
9072
9072
  });
9073
9073
  module.exports = __toCommonJS(index_exports);
9074
- var import_node_fs21 = require("fs");
9074
+ var import_node_fs22 = require("fs");
9075
9075
  var import_node_path26 = __toESM(require("path"));
9076
9076
  var import_chalk4 = __toESM(require("chalk"));
9077
9077
 
@@ -16052,8 +16052,90 @@ function pad2(value) {
16052
16052
  return String(value).padStart(2, "0");
16053
16053
  }
16054
16054
 
16055
- // src/commands/AgentCommandHandler.ts
16055
+ // src/commands/ChatRoomCommandHandler.ts
16056
16056
  var import_node_fs12 = require("fs");
16057
+ var ChatRoomCommandHandler = class {
16058
+ async handle(args) {
16059
+ const sdk = await loadChatSdk();
16060
+ if (args.action === "smoke") {
16061
+ await this.smoke(sdk, args);
16062
+ return;
16063
+ }
16064
+ const client = await this.connect(sdk, args.bot, args.app, args.hubUrl, args.authBaseUrl);
16065
+ try {
16066
+ switch (args.action) {
16067
+ case "join":
16068
+ client.watchMessages((message) => ui.plain(JSON.stringify(message)));
16069
+ ui.success("chat-room joined");
16070
+ return;
16071
+ case "request-friend":
16072
+ await client.requestFriend({ to: args.to, message: args.message });
16073
+ ui.success("friend request sent");
16074
+ return;
16075
+ case "accept-friend":
16076
+ await client.acceptFriend({ to: args.to, requestId: args.requestId, message: args.message });
16077
+ ui.success("friend request accepted");
16078
+ return;
16079
+ case "delete-friend":
16080
+ await client.removeFriend({ to: args.to, reason: args.reason });
16081
+ ui.success("friend deleted");
16082
+ return;
16083
+ case "send":
16084
+ await client.sendDm({ to: args.to, text: args.text });
16085
+ ui.success("message sent");
16086
+ return;
16087
+ case "group-create":
16088
+ await client.createGroup({ groupId: args.groupId, members: args.members, title: args.title });
16089
+ ui.success("group created");
16090
+ return;
16091
+ case "group-send":
16092
+ await client.sendGroup({ groupId: args.groupId, text: args.text, recipients: args.recipients });
16093
+ ui.success("group message sent");
16094
+ return;
16095
+ }
16096
+ } finally {
16097
+ if (args.action !== "join") {
16098
+ client.close();
16099
+ }
16100
+ }
16101
+ }
16102
+ async smoke(sdk, args) {
16103
+ const a = await this.connect(sdk, args.botA, args.app, args.hubUrl, args.authBaseUrl);
16104
+ const b = await this.connect(sdk, args.botB, args.app, args.hubUrl, args.authBaseUrl);
16105
+ try {
16106
+ const botA = sdk.parsePmateBotKeyJson((0, import_node_fs12.readFileSync)(args.botA, "utf8"));
16107
+ const botB = sdk.parsePmateBotKeyJson((0, import_node_fs12.readFileSync)(args.botB, "utf8"));
16108
+ await a.requestFriend({ to: botB.name, message: "smoke friend request" });
16109
+ await b.acceptFriend({ to: botA.name, message: "smoke friend accept" });
16110
+ await a.sendDm({ to: botB.name, text: "smoke dm from a" });
16111
+ await b.sendDm({ to: botA.name, text: "smoke dm from b" });
16112
+ const groupId = `smoke-${Date.now()}`;
16113
+ await a.createGroup({ groupId, members: [botB.name], title: "Smoke Group" });
16114
+ await a.sendGroup({ groupId, text: "smoke group message", recipients: [botB.name] });
16115
+ await a.removeFriend({ to: botB.name, reason: "smoke cleanup" });
16116
+ ui.success("chat-room smoke passed");
16117
+ } finally {
16118
+ a.close();
16119
+ b.close();
16120
+ }
16121
+ }
16122
+ async connect(sdk, botPath, appId, hubUrl, authBaseUrl) {
16123
+ if (!botPath) {
16124
+ throw new Error("Missing required option: --bot");
16125
+ }
16126
+ const botKey = sdk.parsePmateBotKeyJson((0, import_node_fs12.readFileSync)(botPath, "utf8"));
16127
+ const client = sdk.createChatClient({ appId, botKey, hubUrl, authBaseUrl });
16128
+ await client.connect();
16129
+ return client;
16130
+ }
16131
+ };
16132
+ async function loadChatSdk() {
16133
+ const dynamicImport = new Function("specifier", "return import(specifier)");
16134
+ return await dynamicImport("@pmate/chat-sdk/runtime");
16135
+ }
16136
+
16137
+ // src/commands/AgentCommandHandler.ts
16138
+ var import_node_fs13 = require("fs");
16057
16139
  var import_node_path17 = __toESM(require("path"));
16058
16140
  init_AgentLlmClient();
16059
16141
  init_sessionStore();
@@ -16521,10 +16603,10 @@ var AgentCommandHandler = class {
16521
16603
  }
16522
16604
  readJsonFile(filePath) {
16523
16605
  const absolutePath = import_node_path17.default.resolve(process.cwd(), filePath);
16524
- if (!(0, import_node_fs12.existsSync)(absolutePath)) {
16606
+ if (!(0, import_node_fs13.existsSync)(absolutePath)) {
16525
16607
  throw new Error(`JSON file not found: ${absolutePath}`);
16526
16608
  }
16527
- const raw = (0, import_node_fs12.readFileSync)(absolutePath, "utf8");
16609
+ const raw = (0, import_node_fs13.readFileSync)(absolutePath, "utf8");
16528
16610
  try {
16529
16611
  return JSON.parse(raw);
16530
16612
  } catch (error) {
@@ -16619,7 +16701,7 @@ var AgentCommandHandler = class {
16619
16701
  };
16620
16702
 
16621
16703
  // src/commands/RunnerCommandHandler.ts
16622
- var import_node_fs13 = require("fs");
16704
+ var import_node_fs14 = require("fs");
16623
16705
  var import_node_path18 = __toESM(require("path"));
16624
16706
  init_sessionStore();
16625
16707
  init_namespacedRef();
@@ -16716,10 +16798,10 @@ var RunnerCommandHandler = class {
16716
16798
  }
16717
16799
  readJsonFile(filePath) {
16718
16800
  const absolutePath = import_node_path18.default.resolve(process.cwd(), filePath);
16719
- if (!(0, import_node_fs13.existsSync)(absolutePath)) {
16801
+ if (!(0, import_node_fs14.existsSync)(absolutePath)) {
16720
16802
  throw new Error(`JSON file not found: ${absolutePath}`);
16721
16803
  }
16722
- const raw = (0, import_node_fs13.readFileSync)(absolutePath, "utf8");
16804
+ const raw = (0, import_node_fs14.readFileSync)(absolutePath, "utf8");
16723
16805
  try {
16724
16806
  return JSON.parse(raw);
16725
16807
  } catch (error) {
@@ -16838,7 +16920,7 @@ var NsCommandHandler = class {
16838
16920
  };
16839
16921
 
16840
16922
  // src/commands/StoreCommandHandler.ts
16841
- var import_node_fs14 = require("fs");
16923
+ var import_node_fs15 = require("fs");
16842
16924
  var import_node_path19 = __toESM(require("path"));
16843
16925
  var StoreCommandHandler = class {
16844
16926
  async handle(args) {
@@ -16982,10 +17064,10 @@ var StoreCommandHandler = class {
16982
17064
  }
16983
17065
  readJsonFile(filePath) {
16984
17066
  const absolutePath = import_node_path19.default.resolve(process.cwd(), filePath);
16985
- if (!(0, import_node_fs14.existsSync)(absolutePath)) {
17067
+ if (!(0, import_node_fs15.existsSync)(absolutePath)) {
16986
17068
  throw new Error(`JSON file not found: ${absolutePath}`);
16987
17069
  }
16988
- const raw = (0, import_node_fs14.readFileSync)(absolutePath, "utf8");
17070
+ const raw = (0, import_node_fs15.readFileSync)(absolutePath, "utf8");
16989
17071
  try {
16990
17072
  return JSON.parse(raw);
16991
17073
  } catch (error) {
@@ -17037,12 +17119,12 @@ var StoreCommandHandler = class {
17037
17119
  };
17038
17120
 
17039
17121
  // src/commands/AppCommandHandler.ts
17040
- var import_node_fs16 = require("fs");
17122
+ var import_node_fs17 = require("fs");
17041
17123
  var import_node_path21 = __toESM(require("path"));
17042
17124
  init_sessionStore();
17043
17125
 
17044
17126
  // src/appIcon.ts
17045
- var import_node_fs15 = require("fs");
17127
+ var import_node_fs16 = require("fs");
17046
17128
  var import_node_os7 = __toESM(require("os"));
17047
17129
  var import_node_path20 = __toESM(require("path"));
17048
17130
  var import_sharp = __toESM(require("sharp"));
@@ -17150,7 +17232,7 @@ function createAppIconExportPlans(input) {
17150
17232
  throw new Error("App icon preset export requires --out-dir.");
17151
17233
  }
17152
17234
  const outDir = import_node_path20.default.resolve(input.cwd, input.outDir);
17153
- (0, import_node_fs15.mkdirSync)(outDir, { recursive: true });
17235
+ (0, import_node_fs16.mkdirSync)(outDir, { recursive: true });
17154
17236
  return specs.map((spec) => ({
17155
17237
  width: spec.width,
17156
17238
  height: spec.height,
@@ -17169,7 +17251,7 @@ function createAppIconExportPlans(input) {
17169
17251
  throw new Error("Single-size app icon export requires --output.");
17170
17252
  }
17171
17253
  const resolvedOutput = import_node_path20.default.resolve(input.cwd, input.output);
17172
- (0, import_node_fs15.mkdirSync)(import_node_path20.default.dirname(resolvedOutput), { recursive: true });
17254
+ (0, import_node_fs16.mkdirSync)(import_node_path20.default.dirname(resolvedOutput), { recursive: true });
17173
17255
  return [
17174
17256
  {
17175
17257
  width: input.width,
@@ -17183,7 +17265,7 @@ async function exportAppIcon(icon, plans) {
17183
17265
  const svg = await resolveAppIconSvg(icon);
17184
17266
  for (const plan of plans) {
17185
17267
  const bytes = await renderAppIcon(svg, plan.width, plan.height, plan.format);
17186
- (0, import_node_fs15.writeFileSync)(plan.outputPath, bytes);
17268
+ (0, import_node_fs16.writeFileSync)(plan.outputPath, bytes);
17187
17269
  }
17188
17270
  }
17189
17271
  async function renderAppIconVariant(input) {
@@ -17192,8 +17274,8 @@ async function renderAppIconVariant(input) {
17192
17274
  let outputPath;
17193
17275
  if (input.output) {
17194
17276
  outputPath = import_node_path20.default.resolve(input.cwd, input.output);
17195
- (0, import_node_fs15.mkdirSync)(import_node_path20.default.dirname(outputPath), { recursive: true });
17196
- (0, import_node_fs15.writeFileSync)(outputPath, bytes);
17277
+ (0, import_node_fs16.mkdirSync)(import_node_path20.default.dirname(outputPath), { recursive: true });
17278
+ (0, import_node_fs16.writeFileSync)(outputPath, bytes);
17197
17279
  }
17198
17280
  if (input.name) {
17199
17281
  return {
@@ -17223,7 +17305,7 @@ async function loadAppIconVariantFile(input) {
17223
17305
  name: input.name,
17224
17306
  format,
17225
17307
  sourcePath: absolutePath
17226
- }) : createImageDataUrl((0, import_node_fs15.readFileSync)(absolutePath), format),
17308
+ }) : createImageDataUrl((0, import_node_fs16.readFileSync)(absolutePath), format),
17227
17309
  format,
17228
17310
  absolutePath
17229
17311
  };
@@ -17353,7 +17435,7 @@ async function uploadAppIconVariantAsset(input) {
17353
17435
  await AliyunService.uploadFile(sourcePath, DEFAULT_APP_ICON_VARIANT_BUCKET, objectKey);
17354
17436
  } finally {
17355
17437
  if (shouldCleanup) {
17356
- (0, import_node_fs15.rmSync)(import_node_path20.default.dirname(sourcePath), { recursive: true, force: true });
17438
+ (0, import_node_fs16.rmSync)(import_node_path20.default.dirname(sourcePath), { recursive: true, force: true });
17357
17439
  }
17358
17440
  }
17359
17441
  return `${DEFAULT_APP_ICON_VARIANT_PUBLIC_BASE_URL}/${objectKey}`;
@@ -17398,9 +17480,9 @@ function writeTempAppIconVariantFile(objectKey, format, bytes) {
17398
17480
  if (!bytes) {
17399
17481
  throw new Error("App icon variant upload requires bytes or a source file.");
17400
17482
  }
17401
- const tempDir = (0, import_node_fs15.mkdtempSync)(import_node_path20.default.join(import_node_os7.default.tmpdir(), "pmate-app-icon-"));
17483
+ const tempDir = (0, import_node_fs16.mkdtempSync)(import_node_path20.default.join(import_node_os7.default.tmpdir(), "pmate-app-icon-"));
17402
17484
  const tempPath = import_node_path20.default.join(tempDir, import_node_path20.default.basename(objectKey) || `variant.${extensionForIconFormat(format)}`);
17403
- (0, import_node_fs15.writeFileSync)(tempPath, bytes);
17485
+ (0, import_node_fs16.writeFileSync)(tempPath, bytes);
17404
17486
  return tempPath;
17405
17487
  }
17406
17488
 
@@ -17609,10 +17691,10 @@ var AppCommandHandler = class {
17609
17691
  }
17610
17692
  readJsonFile(filePath) {
17611
17693
  const absolutePath = this.resolveFilePath(filePath);
17612
- if (!(0, import_node_fs16.existsSync)(absolutePath)) {
17694
+ if (!(0, import_node_fs17.existsSync)(absolutePath)) {
17613
17695
  throw new Error(`JSON file not found: ${absolutePath}`);
17614
17696
  }
17615
- const raw = (0, import_node_fs16.readFileSync)(absolutePath, "utf8");
17697
+ const raw = (0, import_node_fs17.readFileSync)(absolutePath, "utf8");
17616
17698
  try {
17617
17699
  return JSON.parse(raw);
17618
17700
  } catch (error) {
@@ -17742,13 +17824,13 @@ function readNamespaceFromPayload(payload) {
17742
17824
  }
17743
17825
 
17744
17826
  // src/commands/ServiceCommandHandler.ts
17745
- var import_node_fs18 = require("fs");
17827
+ var import_node_fs19 = require("fs");
17746
17828
  var import_promises5 = require("fs/promises");
17747
17829
  var import_node_path23 = __toESM(require("path"));
17748
17830
  var import_promises6 = require("readline/promises");
17749
17831
 
17750
17832
  // src/services/ServiceRuntimeRunner.ts
17751
- var import_node_fs17 = require("fs");
17833
+ var import_node_fs18 = require("fs");
17752
17834
  var import_node_os8 = __toESM(require("os"));
17753
17835
  var import_node_path22 = __toESM(require("path"));
17754
17836
  var import_node_child_process10 = require("child_process");
@@ -18137,7 +18219,7 @@ var ServiceRuntimeRunner = class {
18137
18219
  import_node_path22.default.join(import_node_os8.default.homedir(), "dev", "pmate-envs", repoName)
18138
18220
  ];
18139
18221
  for (const candidate of candidates) {
18140
- if ((0, import_node_fs17.existsSync)(candidate)) {
18222
+ if ((0, import_node_fs18.existsSync)(candidate)) {
18141
18223
  return candidate;
18142
18224
  }
18143
18225
  }
@@ -18156,7 +18238,7 @@ var ServiceRuntimeRunner = class {
18156
18238
  async deployVite(service, options) {
18157
18239
  const appDir = this.resolveLocalDir(service, options.cwd);
18158
18240
  const packageJsonPath = import_node_path22.default.join(appDir, "package.json");
18159
- if (!(0, import_node_fs17.existsSync)(packageJsonPath)) {
18241
+ if (!(0, import_node_fs18.existsSync)(packageJsonPath)) {
18160
18242
  throw new Error(`No package.json found at ${packageJsonPath}`);
18161
18243
  }
18162
18244
  const pkg2 = this.loadPackageJson(packageJsonPath);
@@ -18166,7 +18248,7 @@ var ServiceRuntimeRunner = class {
18166
18248
  }
18167
18249
  await this.runCommand("pnpm", ["--filter", pkgName, "build"], this.resolveRepoRoot(service, options.cwd));
18168
18250
  const distDir = import_node_path22.default.join(appDir, "dist");
18169
- if (!(0, import_node_fs17.existsSync)(distDir)) {
18251
+ if (!(0, import_node_fs18.existsSync)(distDir)) {
18170
18252
  throw new Error(`No dist directory found at ${distDir}`);
18171
18253
  }
18172
18254
  const site = this.getSite(service);
@@ -18179,7 +18261,7 @@ var ServiceRuntimeRunner = class {
18179
18261
  async deployStatic(service, options) {
18180
18262
  const appDir = this.resolveLocalDir(service, options.cwd);
18181
18263
  const srcDir = import_node_path22.default.join(appDir, "src");
18182
- if (!(0, import_node_fs17.existsSync)(srcDir)) {
18264
+ if (!(0, import_node_fs18.existsSync)(srcDir)) {
18183
18265
  throw new Error(`No src directory found at ${srcDir}`);
18184
18266
  }
18185
18267
  const site = this.getSite(service);
@@ -18195,7 +18277,7 @@ var ServiceRuntimeRunner = class {
18195
18277
  const repoRoot = this.resolveRepoRoot(service);
18196
18278
  const appDir = this.resolveLocalDir(service);
18197
18279
  const packageJsonPath = import_node_path22.default.join(appDir, "package.json");
18198
- if (!(0, import_node_fs17.existsSync)(packageJsonPath)) {
18280
+ if (!(0, import_node_fs18.existsSync)(packageJsonPath)) {
18199
18281
  throw new Error(`No package.json found at ${packageJsonPath}`);
18200
18282
  }
18201
18283
  const pkg2 = this.loadPackageJson(packageJsonPath);
@@ -18249,14 +18331,14 @@ var ServiceRuntimeRunner = class {
18249
18331
  const appDir = this.resolveLocalDir(service, options.cwd);
18250
18332
  await this.ensurePnpmWorkspaceRoot(repoRoot);
18251
18333
  const configPath = import_node_path22.default.join(appDir, fc.configFile ?? "s.yaml");
18252
- if (!(0, import_node_fs17.existsSync)(configPath)) {
18334
+ if (!(0, import_node_fs18.existsSync)(configPath)) {
18253
18335
  throw new Error(`Missing FC config file at ${configPath}`);
18254
18336
  }
18255
18337
  const packageJsonPath = import_node_path22.default.join(appDir, "package.json");
18256
- if (!(0, import_node_fs17.existsSync)(packageJsonPath)) {
18338
+ if (!(0, import_node_fs18.existsSync)(packageJsonPath)) {
18257
18339
  throw new Error(`No package.json found at ${packageJsonPath}`);
18258
18340
  }
18259
- const rawConfig = (0, import_node_fs17.readFileSync)(configPath, "utf8");
18341
+ const rawConfig = (0, import_node_fs18.readFileSync)(configPath, "utf8");
18260
18342
  if (!rawConfig.includes(fc.functionName)) {
18261
18343
  throw new Error(`FC config ${configPath} does not mention functionName ${fc.functionName}`);
18262
18344
  }
@@ -18444,7 +18526,7 @@ var ServiceRuntimeRunner = class {
18444
18526
  const serverAddress = await resolveServerAddress(server);
18445
18527
  const templateName = exposeType === "websocket" ? "nginx.ws.template" : "nginx.rest.template";
18446
18528
  const templatePath = this.resolveTemplatePath(templateName);
18447
- const template = (0, import_node_fs17.readFileSync)(templatePath, "utf8");
18529
+ const template = (0, import_node_fs18.readFileSync)(templatePath, "utf8");
18448
18530
  const host = `${subdomain}.${("domain" in network ? network.domain?.trim() : void 0) || "pmate.chat"}`;
18449
18531
  const rendered = template.replace(/\$\{\{PORT\}\}/g, String(port)).replace(/\$\{\{HOSTS\}\}/g, host).replace(/\$\{\{HOST\}\}/g, host);
18450
18532
  const remotePath = `/etc/nginx/sites-enabled/${subdomain}.conf`;
@@ -18477,10 +18559,10 @@ var ServiceRuntimeRunner = class {
18477
18559
  if (config.ensurePackageJson) {
18478
18560
  const appDir = this.resolveLocalDir(service, options.cwd);
18479
18561
  const packageJsonPath = import_node_path22.default.join(appDir, "package.json");
18480
- if (!(0, import_node_fs17.existsSync)(packageJsonPath)) {
18562
+ if (!(0, import_node_fs18.existsSync)(packageJsonPath)) {
18481
18563
  throw new Error(`Missing package.json at ${packageJsonPath}`);
18482
18564
  }
18483
- const pkgStat = (0, import_node_fs17.statSync)(packageJsonPath);
18565
+ const pkgStat = (0, import_node_fs18.statSync)(packageJsonPath);
18484
18566
  if (!pkgStat.isFile()) {
18485
18567
  throw new Error(`package.json is not a file at ${packageJsonPath}`);
18486
18568
  }
@@ -18954,7 +19036,7 @@ var ServiceRuntimeRunner = class {
18954
19036
  import_node_path22.default.join(__dirname, "templates", templateName)
18955
19037
  ];
18956
19038
  for (const candidate of candidates) {
18957
- if ((0, import_node_fs17.existsSync)(candidate)) {
19039
+ if ((0, import_node_fs18.existsSync)(candidate)) {
18958
19040
  return candidate;
18959
19041
  }
18960
19042
  }
@@ -18986,7 +19068,7 @@ var ServiceRuntimeRunner = class {
18986
19068
  });
18987
19069
  }
18988
19070
  loadPackageJson(packageJsonPath) {
18989
- const raw = (0, import_node_fs17.readFileSync)(packageJsonPath, "utf8");
19071
+ const raw = (0, import_node_fs18.readFileSync)(packageJsonPath, "utf8");
18990
19072
  const parsed = JSON.parse(raw);
18991
19073
  if (!parsed || typeof parsed !== "object") {
18992
19074
  throw new Error(`Invalid package.json at ${packageJsonPath}`);
@@ -18995,7 +19077,7 @@ var ServiceRuntimeRunner = class {
18995
19077
  }
18996
19078
  writePackageJson(packageJsonPath, data) {
18997
19079
  const serialized = JSON.stringify(data, null, 2);
18998
- (0, import_node_fs17.writeFileSync)(packageJsonPath, `${serialized}
19080
+ (0, import_node_fs18.writeFileSync)(packageJsonPath, `${serialized}
18999
19081
  `, "utf8");
19000
19082
  }
19001
19083
  validateFcConfig(service, fc) {
@@ -19023,7 +19105,7 @@ var ServiceRuntimeRunner = class {
19023
19105
  }
19024
19106
  async ensurePnpmWorkspaceRoot(repoRoot) {
19025
19107
  const workspacePath = import_node_path22.default.join(repoRoot, "pnpm-workspace.yaml");
19026
- if (!(0, import_node_fs17.existsSync)(workspacePath)) {
19108
+ if (!(0, import_node_fs18.existsSync)(workspacePath)) {
19027
19109
  throw new Error(`Missing pnpm-workspace.yaml at ${workspacePath}`);
19028
19110
  }
19029
19111
  }
@@ -19092,16 +19174,16 @@ var ServiceRuntimeRunner = class {
19092
19174
  if (!privateKeyPath) {
19093
19175
  throw new Error("Missing ssl.prv in ~/.pmate/config.yaml.");
19094
19176
  }
19095
- if (!(0, import_node_fs17.existsSync)(certificatePath)) {
19177
+ if (!(0, import_node_fs18.existsSync)(certificatePath)) {
19096
19178
  throw new Error(`SSL certificate file not found: ${certificatePath}`);
19097
19179
  }
19098
- if (!(0, import_node_fs17.existsSync)(privateKeyPath)) {
19180
+ if (!(0, import_node_fs18.existsSync)(privateKeyPath)) {
19099
19181
  throw new Error(`SSL private key file not found: ${privateKeyPath}`);
19100
19182
  }
19101
19183
  return {
19102
19184
  certName: host,
19103
- certificate: (0, import_node_fs17.readFileSync)(certificatePath, "utf8"),
19104
- privateKey: (0, import_node_fs17.readFileSync)(privateKeyPath, "utf8")
19185
+ certificate: (0, import_node_fs18.readFileSync)(certificatePath, "utf8"),
19186
+ privateKey: (0, import_node_fs18.readFileSync)(privateKeyPath, "utf8")
19105
19187
  };
19106
19188
  }
19107
19189
  resolveFcProtocol(fc, certConfig) {
@@ -19454,10 +19536,10 @@ var ServiceCommandHandler = class {
19454
19536
  }
19455
19537
  readJsonFile(filePath) {
19456
19538
  const absolutePath = import_node_path23.default.resolve(process.cwd(), filePath);
19457
- if (!(0, import_node_fs18.existsSync)(absolutePath)) {
19539
+ if (!(0, import_node_fs19.existsSync)(absolutePath)) {
19458
19540
  throw new Error(`JSON file not found: ${absolutePath}`);
19459
19541
  }
19460
- const raw = (0, import_node_fs18.readFileSync)(absolutePath, "utf8");
19542
+ const raw = (0, import_node_fs19.readFileSync)(absolutePath, "utf8");
19461
19543
  try {
19462
19544
  return JSON.parse(raw);
19463
19545
  } catch (error) {
@@ -19839,7 +19921,7 @@ var RoleCommandHandler = class {
19839
19921
  };
19840
19922
 
19841
19923
  // src/commands/AccountCommandHandler.ts
19842
- var import_node_fs19 = require("fs");
19924
+ var import_node_fs20 = require("fs");
19843
19925
  var import_node_crypto4 = require("crypto");
19844
19926
  var import_node_path24 = __toESM(require("path"));
19845
19927
  init_sessionStore();
@@ -19850,8 +19932,8 @@ var AccountCommandHandler = class {
19850
19932
  const keyFile = this.generateBotKeyFile(args.app, args.name);
19851
19933
  if (args.out) {
19852
19934
  const outPath = this.resolveFilePath(args.out);
19853
- (0, import_node_fs19.writeFileSync)(outPath, JSON.stringify(keyFile, null, 2), { mode: 384 });
19854
- (0, import_node_fs19.chmodSync)(outPath, 384);
19935
+ (0, import_node_fs20.writeFileSync)(outPath, JSON.stringify(keyFile, null, 2), { mode: 384 });
19936
+ (0, import_node_fs20.chmodSync)(outPath, 384);
19855
19937
  if (!args.json) {
19856
19938
  ui.success(`Bot key saved to ${outPath}`);
19857
19939
  }
@@ -20296,10 +20378,10 @@ var AccountCommandHandler = class {
20296
20378
  throw new Error("Missing visible apps input");
20297
20379
  }
20298
20380
  const absolutePath = this.resolveFilePath(args.filePath);
20299
- if (!(0, import_node_fs19.existsSync)(absolutePath)) {
20381
+ if (!(0, import_node_fs20.existsSync)(absolutePath)) {
20300
20382
  throw new Error(`JSON file not found: ${absolutePath}`);
20301
20383
  }
20302
- const raw = (0, import_node_fs19.readFileSync)(absolutePath, "utf8");
20384
+ const raw = (0, import_node_fs20.readFileSync)(absolutePath, "utf8");
20303
20385
  let parsed;
20304
20386
  try {
20305
20387
  parsed = JSON.parse(raw);
@@ -20333,10 +20415,10 @@ var AccountCommandHandler = class {
20333
20415
  throw new Error("Missing bot key file");
20334
20416
  }
20335
20417
  const absolutePath = this.resolveFilePath(filePath);
20336
- if (!(0, import_node_fs19.existsSync)(absolutePath)) {
20418
+ if (!(0, import_node_fs20.existsSync)(absolutePath)) {
20337
20419
  throw new Error(`Bot key file not found: ${absolutePath}`);
20338
20420
  }
20339
- const parsed = JSON.parse((0, import_node_fs19.readFileSync)(absolutePath, "utf8"));
20421
+ const parsed = JSON.parse((0, import_node_fs20.readFileSync)(absolutePath, "utf8"));
20340
20422
  if (parsed.type !== "pmate-bot-key" || parsed.version !== 1 || parsed.algorithm !== "ed25519" || !parsed.publicKey || !parsed.privateKey) {
20341
20423
  throw new Error(`Invalid PMate bot key file: ${absolutePath}`);
20342
20424
  }
@@ -20388,7 +20470,7 @@ function encodePathSegment(value) {
20388
20470
  }
20389
20471
 
20390
20472
  // src/commands/OrgCommandHandler.ts
20391
- var import_node_fs20 = require("fs");
20473
+ var import_node_fs21 = require("fs");
20392
20474
  var import_node_path25 = __toESM(require("path"));
20393
20475
  init_sessionStore();
20394
20476
  var OrgCommandHandler = class {
@@ -20561,10 +20643,10 @@ var OrgCommandHandler = class {
20561
20643
  throw new Error(`Missing ${itemLabel} input`);
20562
20644
  }
20563
20645
  const absolutePath = import_node_path25.default.resolve(process.cwd(), filePath);
20564
- if (!(0, import_node_fs20.existsSync)(absolutePath)) {
20646
+ if (!(0, import_node_fs21.existsSync)(absolutePath)) {
20565
20647
  throw new Error(`JSON file not found: ${absolutePath}`);
20566
20648
  }
20567
- const raw = (0, import_node_fs20.readFileSync)(absolutePath, "utf8");
20649
+ const raw = (0, import_node_fs21.readFileSync)(absolutePath, "utf8");
20568
20650
  let parsed;
20569
20651
  try {
20570
20652
  parsed = JSON.parse(raw);
@@ -23252,6 +23334,144 @@ function requireValue10(tokens, optionName) {
23252
23334
  return value;
23253
23335
  }
23254
23336
 
23337
+ // src/chatRoomCommandParser.ts
23338
+ function parseChatRoomArgs(tokens) {
23339
+ const rest = [...tokens];
23340
+ const action = rest.shift();
23341
+ if (!action) {
23342
+ throw new Error("Usage: chat-room <join|request-friend|accept-friend|delete-friend|send|group-create|group-send|smoke>");
23343
+ }
23344
+ const parsed = parseShared(rest);
23345
+ const { options, multiOptions, ...shared } = parsed;
23346
+ switch (action) {
23347
+ case "smoke":
23348
+ return {
23349
+ type: "chat-room" /* ChatRoom */,
23350
+ action,
23351
+ botA: requiredOption(options, "--bot-a"),
23352
+ botB: requiredOption(options, "--bot-b"),
23353
+ app: shared.app,
23354
+ hubUrl: shared.hubUrl,
23355
+ authBaseUrl: shared.authBaseUrl
23356
+ };
23357
+ case "join":
23358
+ return { type: "chat-room" /* ChatRoom */, action, ...withBot(shared, options) };
23359
+ case "request-friend":
23360
+ return {
23361
+ type: "chat-room" /* ChatRoom */,
23362
+ action,
23363
+ ...withBot(shared, options),
23364
+ to: requiredOption(options, "--to"),
23365
+ message: options.get("--message")
23366
+ };
23367
+ case "accept-friend":
23368
+ return {
23369
+ type: "chat-room" /* ChatRoom */,
23370
+ action,
23371
+ ...withBot(shared, options),
23372
+ to: requiredOption(options, "--to"),
23373
+ requestId: options.get("--request-id"),
23374
+ message: options.get("--message")
23375
+ };
23376
+ case "delete-friend":
23377
+ return {
23378
+ type: "chat-room" /* ChatRoom */,
23379
+ action,
23380
+ ...withBot(shared, options),
23381
+ to: requiredOption(options, "--to"),
23382
+ reason: options.get("--reason")
23383
+ };
23384
+ case "send":
23385
+ return {
23386
+ type: "chat-room" /* ChatRoom */,
23387
+ action,
23388
+ ...withBot(shared, options),
23389
+ to: requiredOption(options, "--to"),
23390
+ text: requiredOption(options, "--text")
23391
+ };
23392
+ case "group-create":
23393
+ return {
23394
+ type: "chat-room" /* ChatRoom */,
23395
+ action,
23396
+ ...withBot(shared, options),
23397
+ groupId: requiredOption(options, "--group"),
23398
+ members: multiOptions.get("--member") ?? [],
23399
+ title: options.get("--title")
23400
+ };
23401
+ case "group-send":
23402
+ return {
23403
+ type: "chat-room" /* ChatRoom */,
23404
+ action,
23405
+ ...withBot(shared, options),
23406
+ groupId: requiredOption(options, "--group"),
23407
+ text: requiredOption(options, "--text"),
23408
+ recipients: multiOptions.get("--recipient")
23409
+ };
23410
+ default:
23411
+ throw new Error(`Unknown chat-room action: ${action}`);
23412
+ }
23413
+ }
23414
+ function withBot(shared, options) {
23415
+ return { ...shared, bot: requiredOption(options, "--bot") };
23416
+ }
23417
+ function parseShared(tokens) {
23418
+ const options = /* @__PURE__ */ new Map();
23419
+ const multiOptions = /* @__PURE__ */ new Map();
23420
+ while (tokens.length > 0) {
23421
+ const token = tokens.shift();
23422
+ switch (token) {
23423
+ case "--bot":
23424
+ case "--app":
23425
+ case "--hub-url":
23426
+ case "--auth-base-url":
23427
+ case "--to":
23428
+ case "--message":
23429
+ case "--reason":
23430
+ case "--request-id":
23431
+ case "--text":
23432
+ case "--group":
23433
+ case "--title":
23434
+ case "--bot-a":
23435
+ case "--bot-b":
23436
+ options.set(token, requireValue11(tokens, token));
23437
+ break;
23438
+ case "--member":
23439
+ case "--recipient": {
23440
+ const values = multiOptions.get(token) ?? [];
23441
+ values.push(requireValue11(tokens, token));
23442
+ multiOptions.set(token, values);
23443
+ break;
23444
+ }
23445
+ default:
23446
+ throw new Error(`Unknown chat-room option: ${token}`);
23447
+ }
23448
+ }
23449
+ const app = requiredOption(options, "--app");
23450
+ const bot = options.get("--bot");
23451
+ return {
23452
+ bot,
23453
+ app,
23454
+ hubUrl: options.get("--hub-url"),
23455
+ authBaseUrl: options.get("--auth-base-url"),
23456
+ options,
23457
+ multiOptions
23458
+ };
23459
+ }
23460
+ function requiredOption(options, option) {
23461
+ const value = options.get(option);
23462
+ if (!value) {
23463
+ throw new Error(`Missing required option: ${option}`);
23464
+ }
23465
+ return value;
23466
+ }
23467
+ function requireValue11(tokens, option) {
23468
+ const value = tokens.shift();
23469
+ if (!value || value.startsWith("--")) {
23470
+ throw new Error(`Missing value for ${option}`);
23471
+ }
23472
+ return value;
23473
+ }
23474
+
23255
23475
  // src/prepareDevCommandParser.ts
23256
23476
  function parsePrepareDevArgs(tokens) {
23257
23477
  const rest = [...tokens];
@@ -23279,7 +23499,7 @@ function parsePrepareDevArgs(tokens) {
23279
23499
  close = true;
23280
23500
  break;
23281
23501
  case "--env": {
23282
- const rawValue = requireValue11(rest, token);
23502
+ const rawValue = requireValue12(rest, token);
23283
23503
  const parsed = Number.parseInt(rawValue, 10);
23284
23504
  if (!Number.isInteger(parsed) || parsed < 0) {
23285
23505
  throw new Error(`Invalid --env value: ${rawValue}`);
@@ -23288,13 +23508,13 @@ function parsePrepareDevArgs(tokens) {
23288
23508
  break;
23289
23509
  }
23290
23510
  case "--env-root":
23291
- envRoot = requireValue11(rest, token);
23511
+ envRoot = requireValue12(rest, token);
23292
23512
  break;
23293
23513
  case "--base-root":
23294
- baseRoot = requireValue11(rest, token);
23514
+ baseRoot = requireValue12(rest, token);
23295
23515
  break;
23296
23516
  case "--note":
23297
- note = requireValue11(rest, token);
23517
+ note = requireValue12(rest, token);
23298
23518
  break;
23299
23519
  case "--json":
23300
23520
  json = true;
@@ -23330,7 +23550,7 @@ function parsePrepareDevArgs(tokens) {
23330
23550
  json
23331
23551
  };
23332
23552
  }
23333
- function requireValue11(tokens, option) {
23553
+ function requireValue12(tokens, option) {
23334
23554
  const value = tokens.shift();
23335
23555
  if (!value || value.startsWith("-")) {
23336
23556
  throw new Error(`Missing value for ${option}`);
@@ -23340,7 +23560,7 @@ function requireValue11(tokens, option) {
23340
23560
 
23341
23561
  // src/index.ts
23342
23562
  var pkg = JSON.parse(
23343
- (0, import_node_fs21.readFileSync)(import_node_path26.default.resolve(__dirname, "..", "package.json"), "utf8")
23563
+ (0, import_node_fs22.readFileSync)(import_node_path26.default.resolve(__dirname, "..", "package.json"), "utf8")
23344
23564
  );
23345
23565
  var HELP_TEXT = [
23346
23566
  import_chalk4.default.bold(`pmate v${pkg.version}`),
@@ -23423,6 +23643,8 @@ var HELP_TEXT = [
23423
23643
  ` ${import_chalk4.default.gray(" --easy [--words <n>] [--digits <n>] [--separator <s>] [--count <n>]")}`,
23424
23644
  ` ${import_chalk4.default.cyan("collect")} Collect threads/messages from Electron chat app via CDP`,
23425
23645
  ` ${import_chalk4.default.gray(" sync (--source <cc|yelling> | --endpoint <url>)")}`,
23646
+ ` ${import_chalk4.default.cyan("chat-room")} Run social chat regression commands with PMate bot key JSON`,
23647
+ ` ${import_chalk4.default.gray(" join|request-friend|accept-friend|delete-friend|send|group-create|group-send|smoke --app <ns:app> --bot <file>")}`,
23426
23648
  ` ${import_chalk4.default.cyan("agent")} Manage agent registry entries and call agents for debugging`,
23427
23649
  ` ${import_chalk4.default.gray(" namespaces [--base-url <url>] [--json]")}`,
23428
23650
  ` ${import_chalk4.default.gray(" list [--namespace <ns>] [--base-url <url>] [--json]")}`,
@@ -23578,7 +23800,7 @@ function parseCommandArgs(args) {
23578
23800
  const token = rest.shift();
23579
23801
  switch (token) {
23580
23802
  case "--app":
23581
- app = requireValue12(rest, token);
23803
+ app = requireValue13(rest, token);
23582
23804
  break;
23583
23805
  default:
23584
23806
  throw new Error(`Unknown login option: ${token}`);
@@ -23640,6 +23862,9 @@ function parseCommandArgs(args) {
23640
23862
  if (args.rest[0] === "collect") {
23641
23863
  return parseCollectArgs(args.rest.slice(1));
23642
23864
  }
23865
+ if (args.rest[0] === "chat-room") {
23866
+ return parseChatRoomArgs(args.rest.slice(1));
23867
+ }
23643
23868
  if (args.rest[0] === "agent") {
23644
23869
  return parseAgentArgs(args.rest.slice(1));
23645
23870
  }
@@ -23684,7 +23909,7 @@ function parseVercelArgs(tokens) {
23684
23909
  const token = rest.shift();
23685
23910
  switch (token) {
23686
23911
  case "--scope":
23687
- scope = requireValue12(rest, token);
23912
+ scope = requireValue13(rest, token);
23688
23913
  break;
23689
23914
  default:
23690
23915
  throw new Error(`Unknown vercel option: ${token}`);
@@ -23704,10 +23929,10 @@ function parseVercelArgs(tokens) {
23704
23929
  const token = rest.shift();
23705
23930
  switch (token) {
23706
23931
  case "--scope":
23707
- scope = requireValue12(rest, token);
23932
+ scope = requireValue13(rest, token);
23708
23933
  break;
23709
23934
  case "--project":
23710
- project = requireValue12(rest, token);
23935
+ project = requireValue13(rest, token);
23711
23936
  break;
23712
23937
  case "--last-week":
23713
23938
  lastWeek = true;
@@ -23738,16 +23963,16 @@ function parseAddDnsArgs(tokens) {
23738
23963
  const token = rest.shift();
23739
23964
  switch (token) {
23740
23965
  case "--type":
23741
- options.dnsType = requireValue12(rest, token);
23966
+ options.dnsType = requireValue13(rest, token);
23742
23967
  break;
23743
23968
  case "--value":
23744
- options.dnsValue = requireValue12(rest, token);
23969
+ options.dnsValue = requireValue13(rest, token);
23745
23970
  break;
23746
23971
  case "--rr":
23747
- options.dnsRr = requireValue12(rest, token);
23972
+ options.dnsRr = requireValue13(rest, token);
23748
23973
  break;
23749
23974
  case "--ttl": {
23750
- const ttlValue = requireValue12(rest, token);
23975
+ const ttlValue = requireValue13(rest, token);
23751
23976
  const ttl = Number.parseInt(ttlValue, 10);
23752
23977
  if (!Number.isFinite(ttl) || ttl <= 0) {
23753
23978
  throw new Error(`Invalid --ttl value: ${ttlValue}`);
@@ -23756,7 +23981,7 @@ function parseAddDnsArgs(tokens) {
23756
23981
  break;
23757
23982
  }
23758
23983
  case "--domain":
23759
- options.dnsDomain = requireValue12(rest, token);
23984
+ options.dnsDomain = requireValue13(rest, token);
23760
23985
  break;
23761
23986
  default:
23762
23987
  throw new Error(`Unknown add-dns option: ${token}`);
@@ -23789,13 +24014,13 @@ function parseBucketArgs(tokens) {
23789
24014
  options.bucketCreate = true;
23790
24015
  break;
23791
24016
  case "--name":
23792
- options.bucketName = requireValue12(rest, token);
24017
+ options.bucketName = requireValue13(rest, token);
23793
24018
  break;
23794
24019
  case "--subdomain":
23795
- options.bucketSubdomain = requireValue12(rest, token);
24020
+ options.bucketSubdomain = requireValue13(rest, token);
23796
24021
  break;
23797
24022
  case "--domain":
23798
- options.bucketDomain = requireValue12(rest, token);
24023
+ options.bucketDomain = requireValue13(rest, token);
23799
24024
  break;
23800
24025
  default:
23801
24026
  throw new Error(`Unknown bucket option: ${token}`);
@@ -23827,7 +24052,7 @@ function parseDevArgs(tokens) {
23827
24052
  const token = rest.shift();
23828
24053
  switch (token) {
23829
24054
  case "--cwd":
23830
- options.devCwd = requireValue12(rest, token);
24055
+ options.devCwd = requireValue13(rest, token);
23831
24056
  break;
23832
24057
  default:
23833
24058
  throw new Error(`Unknown dev option: ${token}`);
@@ -23847,7 +24072,7 @@ function parseDeleteArgs(tokens) {
23847
24072
  const token = rest.shift();
23848
24073
  switch (token) {
23849
24074
  case "--cwd":
23850
- deleteCwd = requireValue12(rest, token);
24075
+ deleteCwd = requireValue13(rest, token);
23851
24076
  break;
23852
24077
  default:
23853
24078
  throw new Error(`Unknown delete option: ${token}`);
@@ -23881,13 +24106,13 @@ function parseOssArgs(tokens) {
23881
24106
  const token = rest.shift();
23882
24107
  switch (token) {
23883
24108
  case "--bucket":
23884
- bucket = requireValue12(rest, token);
24109
+ bucket = requireValue13(rest, token);
23885
24110
  break;
23886
24111
  case "--file":
23887
- filePath = requireValue12(rest, token);
24112
+ filePath = requireValue13(rest, token);
23888
24113
  break;
23889
24114
  case "--key":
23890
- objectKey = requireValue12(rest, token);
24115
+ objectKey = requireValue13(rest, token);
23891
24116
  break;
23892
24117
  default:
23893
24118
  throw new Error(`Unknown oss option: ${token}`);
@@ -23920,7 +24145,7 @@ function parseEnvArgs(tokens) {
23920
24145
  throw new Error("Only one env action is allowed.");
23921
24146
  }
23922
24147
  action = "set";
23923
- key = requireValue12(rest, token);
24148
+ key = requireValue13(rest, token);
23924
24149
  break;
23925
24150
  case "--list":
23926
24151
  if (action) {
@@ -23933,17 +24158,17 @@ function parseEnvArgs(tokens) {
23933
24158
  throw new Error("Only one env action is allowed.");
23934
24159
  }
23935
24160
  action = "delete";
23936
- key = requireValue12(rest, token);
24161
+ key = requireValue13(rest, token);
23937
24162
  break;
23938
24163
  case "--value":
23939
- value = requireValue12(rest, token);
24164
+ value = requireValue13(rest, token);
23940
24165
  break;
23941
24166
  case "--verbose":
23942
24167
  case "-v":
23943
24168
  verbose = true;
23944
24169
  break;
23945
24170
  case "--cwd":
23946
- cwd = requireValue12(rest, token);
24171
+ cwd = requireValue13(rest, token);
23947
24172
  break;
23948
24173
  default:
23949
24174
  throw new Error(`Unknown env option: ${token}`);
@@ -24001,7 +24226,7 @@ function parseCommitArgs(tokens) {
24001
24226
  push = true;
24002
24227
  break;
24003
24228
  case "--cwd":
24004
- cwd = requireValue12(rest, token);
24229
+ cwd = requireValue13(rest, token);
24005
24230
  break;
24006
24231
  default:
24007
24232
  throw new Error(`Unknown commit option: ${token}`);
@@ -24017,10 +24242,10 @@ function parseSummaryArgs(tokens) {
24017
24242
  const token = rest.shift();
24018
24243
  switch (token) {
24019
24244
  case "--pr":
24020
- prRef = requireValue12(rest, token);
24245
+ prRef = requireValue13(rest, token);
24021
24246
  break;
24022
24247
  case "--cwd":
24023
- cwd = requireValue12(rest, token);
24248
+ cwd = requireValue13(rest, token);
24024
24249
  break;
24025
24250
  default:
24026
24251
  throw new Error(`Unknown summary option: ${token}`);
@@ -24045,13 +24270,13 @@ function parseQuizArgs(tokens) {
24045
24270
  const token = rest.shift();
24046
24271
  switch (token) {
24047
24272
  case "--paper-id":
24048
- paperId = requireValue12(rest, token);
24273
+ paperId = requireValue13(rest, token);
24049
24274
  break;
24050
24275
  case "--base-url":
24051
- apiBaseUrl = requireValue12(rest, token);
24276
+ apiBaseUrl = requireValue13(rest, token);
24052
24277
  break;
24053
24278
  case "--link-base":
24054
- linkBaseUrl = requireValue12(rest, token);
24279
+ linkBaseUrl = requireValue13(rest, token);
24055
24280
  break;
24056
24281
  default:
24057
24282
  throw new Error(`Unknown quiz create-draft option: ${token}`);
@@ -24077,16 +24302,16 @@ function parseQuizArgs(tokens) {
24077
24302
  const token = rest.shift();
24078
24303
  switch (token) {
24079
24304
  case "--paper-id":
24080
- paperId = requireValue12(rest, token);
24305
+ paperId = requireValue13(rest, token);
24081
24306
  break;
24082
24307
  case "--file":
24083
- filePath = requireValue12(rest, token);
24308
+ filePath = requireValue13(rest, token);
24084
24309
  break;
24085
24310
  case "--base-url":
24086
- apiBaseUrl = requireValue12(rest, token);
24311
+ apiBaseUrl = requireValue13(rest, token);
24087
24312
  break;
24088
24313
  case "--link-base":
24089
- linkBaseUrl = requireValue12(rest, token);
24314
+ linkBaseUrl = requireValue13(rest, token);
24090
24315
  break;
24091
24316
  default:
24092
24317
  throw new Error(`Unknown quiz update-meta option: ${token}`);
@@ -24116,16 +24341,16 @@ function parseQuizArgs(tokens) {
24116
24341
  const token = rest.shift();
24117
24342
  switch (token) {
24118
24343
  case "--paper-id":
24119
- paperId = requireValue12(rest, token);
24344
+ paperId = requireValue13(rest, token);
24120
24345
  break;
24121
24346
  case "--file":
24122
- filePath = requireValue12(rest, token);
24347
+ filePath = requireValue13(rest, token);
24123
24348
  break;
24124
24349
  case "--base-url":
24125
- apiBaseUrl = requireValue12(rest, token);
24350
+ apiBaseUrl = requireValue13(rest, token);
24126
24351
  break;
24127
24352
  case "--link-base":
24128
- linkBaseUrl = requireValue12(rest, token);
24353
+ linkBaseUrl = requireValue13(rest, token);
24129
24354
  break;
24130
24355
  default:
24131
24356
  throw new Error(`Unknown quiz append-step option: ${token}`);
@@ -24156,19 +24381,19 @@ function parseQuizArgs(tokens) {
24156
24381
  const token = rest.shift();
24157
24382
  switch (token) {
24158
24383
  case "--paper-id":
24159
- paperId = requireValue12(rest, token);
24384
+ paperId = requireValue13(rest, token);
24160
24385
  break;
24161
24386
  case "--step-id":
24162
- stepId = requireValue12(rest, token);
24387
+ stepId = requireValue13(rest, token);
24163
24388
  break;
24164
24389
  case "--file":
24165
- filePath = requireValue12(rest, token);
24390
+ filePath = requireValue13(rest, token);
24166
24391
  break;
24167
24392
  case "--base-url":
24168
- apiBaseUrl = requireValue12(rest, token);
24393
+ apiBaseUrl = requireValue13(rest, token);
24169
24394
  break;
24170
24395
  case "--link-base":
24171
- linkBaseUrl = requireValue12(rest, token);
24396
+ linkBaseUrl = requireValue13(rest, token);
24172
24397
  break;
24173
24398
  default:
24174
24399
  throw new Error(`Unknown quiz update-step option: ${token}`);
@@ -24202,16 +24427,16 @@ function parseQuizArgs(tokens) {
24202
24427
  const token = rest.shift();
24203
24428
  switch (token) {
24204
24429
  case "--paper-id":
24205
- paperId = requireValue12(rest, token);
24430
+ paperId = requireValue13(rest, token);
24206
24431
  break;
24207
24432
  case "--step-ids":
24208
- stepIdsRaw = requireValue12(rest, token);
24433
+ stepIdsRaw = requireValue13(rest, token);
24209
24434
  break;
24210
24435
  case "--base-url":
24211
- apiBaseUrl = requireValue12(rest, token);
24436
+ apiBaseUrl = requireValue13(rest, token);
24212
24437
  break;
24213
24438
  case "--link-base":
24214
- linkBaseUrl = requireValue12(rest, token);
24439
+ linkBaseUrl = requireValue13(rest, token);
24215
24440
  break;
24216
24441
  default:
24217
24442
  throw new Error(`Unknown quiz reorder option: ${token}`);
@@ -24244,13 +24469,13 @@ function parseQuizArgs(tokens) {
24244
24469
  const token = rest.shift();
24245
24470
  switch (token) {
24246
24471
  case "--paper-id":
24247
- paperId = requireValue12(rest, token);
24472
+ paperId = requireValue13(rest, token);
24248
24473
  break;
24249
24474
  case "--base-url":
24250
- apiBaseUrl = requireValue12(rest, token);
24475
+ apiBaseUrl = requireValue13(rest, token);
24251
24476
  break;
24252
24477
  case "--link-base":
24253
- linkBaseUrl = requireValue12(rest, token);
24478
+ linkBaseUrl = requireValue13(rest, token);
24254
24479
  break;
24255
24480
  default:
24256
24481
  throw new Error(`Unknown quiz activate option: ${token}`);
@@ -24275,13 +24500,13 @@ function parseQuizArgs(tokens) {
24275
24500
  const token = rest.shift();
24276
24501
  switch (token) {
24277
24502
  case "--paper-id":
24278
- paperId = requireValue12(rest, token);
24503
+ paperId = requireValue13(rest, token);
24279
24504
  break;
24280
24505
  case "--base-url":
24281
- apiBaseUrl = requireValue12(rest, token);
24506
+ apiBaseUrl = requireValue13(rest, token);
24282
24507
  break;
24283
24508
  case "--link-base":
24284
- linkBaseUrl = requireValue12(rest, token);
24509
+ linkBaseUrl = requireValue13(rest, token);
24285
24510
  break;
24286
24511
  default:
24287
24512
  throw new Error(`Unknown quiz view option: ${token}`);
@@ -24310,22 +24535,22 @@ function parseQuizArgs(tokens) {
24310
24535
  const token = rest.shift();
24311
24536
  switch (token) {
24312
24537
  case "--paper-id":
24313
- paperId = requireValue12(rest, token);
24538
+ paperId = requireValue13(rest, token);
24314
24539
  break;
24315
24540
  case "--step-id":
24316
- stepId = requireValue12(rest, token);
24541
+ stepId = requireValue13(rest, token);
24317
24542
  break;
24318
24543
  case "--file":
24319
- filePath = requireValue12(rest, token);
24544
+ filePath = requireValue13(rest, token);
24320
24545
  break;
24321
24546
  case "--new-paper-id":
24322
- newPaperId = requireValue12(rest, token);
24547
+ newPaperId = requireValue13(rest, token);
24323
24548
  break;
24324
24549
  case "--base-url":
24325
- apiBaseUrl = requireValue12(rest, token);
24550
+ apiBaseUrl = requireValue13(rest, token);
24326
24551
  break;
24327
24552
  case "--link-base":
24328
- linkBaseUrl = requireValue12(rest, token);
24553
+ linkBaseUrl = requireValue13(rest, token);
24329
24554
  break;
24330
24555
  case "--activate":
24331
24556
  activate = true;
@@ -24415,10 +24640,10 @@ function parseLinearPrArgs(tokens) {
24415
24640
  const token = rest.shift();
24416
24641
  switch (token) {
24417
24642
  case "--account":
24418
- account = requireValue12(rest, token);
24643
+ account = requireValue13(rest, token);
24419
24644
  break;
24420
24645
  case "--cwd":
24421
- cwd = requireValue12(rest, token);
24646
+ cwd = requireValue13(rest, token);
24422
24647
  break;
24423
24648
  default:
24424
24649
  throw new Error(`Unknown linear option: ${token}`);
@@ -24447,35 +24672,35 @@ function parseLinearCreateArgs(tokens) {
24447
24672
  const token = rest.shift();
24448
24673
  switch (token) {
24449
24674
  case "--account":
24450
- account = requireValue12(rest, token);
24675
+ account = requireValue13(rest, token);
24451
24676
  break;
24452
24677
  case "--repl":
24453
24678
  useRepl = true;
24454
24679
  break;
24455
24680
  case "--title":
24456
- title = requireValue12(rest, token);
24681
+ title = requireValue13(rest, token);
24457
24682
  break;
24458
24683
  case "--desc":
24459
24684
  case "--description":
24460
- description = decodeEscapedNewlines(requireValue12(rest, token));
24685
+ description = decodeEscapedNewlines(requireValue13(rest, token));
24461
24686
  break;
24462
24687
  case "--team-id":
24463
- teamId = requireValue12(rest, token);
24688
+ teamId = requireValue13(rest, token);
24464
24689
  break;
24465
24690
  case "--team-key":
24466
- teamKey = requireValue12(rest, token);
24691
+ teamKey = requireValue13(rest, token);
24467
24692
  break;
24468
24693
  case "--priority":
24469
- priority = parseLinearPriority(requireValue12(rest, token));
24694
+ priority = parseLinearPriority(requireValue13(rest, token));
24470
24695
  break;
24471
24696
  case "--parent-id":
24472
- parentId = requireValue12(rest, token);
24697
+ parentId = requireValue13(rest, token);
24473
24698
  break;
24474
24699
  case "--state-id":
24475
- stateId = requireValue12(rest, token);
24700
+ stateId = requireValue13(rest, token);
24476
24701
  break;
24477
24702
  case "--cwd":
24478
- cwd = requireValue12(rest, token);
24703
+ cwd = requireValue13(rest, token);
24479
24704
  break;
24480
24705
  default:
24481
24706
  throw new Error(`Unknown linear option: ${token}`);
@@ -24510,10 +24735,10 @@ function parseLinearWhoamiArgs(tokens) {
24510
24735
  const token = rest.shift();
24511
24736
  switch (token) {
24512
24737
  case "--account":
24513
- account = requireValue12(rest, token);
24738
+ account = requireValue13(rest, token);
24514
24739
  break;
24515
24740
  case "--cwd":
24516
- cwd = requireValue12(rest, token);
24741
+ cwd = requireValue13(rest, token);
24517
24742
  break;
24518
24743
  default:
24519
24744
  throw new Error(`Unknown linear option: ${token}`);
@@ -24538,10 +24763,10 @@ function parseLinearViewArgs(tokens) {
24538
24763
  const token = rest.shift();
24539
24764
  switch (token) {
24540
24765
  case "--account":
24541
- account = requireValue12(rest, token);
24766
+ account = requireValue13(rest, token);
24542
24767
  break;
24543
24768
  case "--cwd":
24544
- cwd = requireValue12(rest, token);
24769
+ cwd = requireValue13(rest, token);
24545
24770
  break;
24546
24771
  default:
24547
24772
  throw new Error(`Unknown linear option: ${token}`);
@@ -24576,32 +24801,32 @@ function parseLinearUpdateArgs(tokens) {
24576
24801
  const token = rest.shift();
24577
24802
  switch (token) {
24578
24803
  case "--account":
24579
- account = requireValue12(rest, token);
24804
+ account = requireValue13(rest, token);
24580
24805
  break;
24581
24806
  case "--title":
24582
- title = requireValue12(rest, token);
24807
+ title = requireValue13(rest, token);
24583
24808
  break;
24584
24809
  case "--desc":
24585
24810
  case "--description":
24586
- description = decodeEscapedNewlines(requireValue12(rest, token));
24811
+ description = decodeEscapedNewlines(requireValue13(rest, token));
24587
24812
  break;
24588
24813
  case "--team-id":
24589
- teamId = requireValue12(rest, token);
24814
+ teamId = requireValue13(rest, token);
24590
24815
  break;
24591
24816
  case "--team-key":
24592
- teamKey = requireValue12(rest, token);
24817
+ teamKey = requireValue13(rest, token);
24593
24818
  break;
24594
24819
  case "--priority":
24595
- priority = parseLinearPriority(requireValue12(rest, token));
24820
+ priority = parseLinearPriority(requireValue13(rest, token));
24596
24821
  break;
24597
24822
  case "--parent-id":
24598
- parentId = requireValue12(rest, token);
24823
+ parentId = requireValue13(rest, token);
24599
24824
  break;
24600
24825
  case "--state-id":
24601
- stateId = requireValue12(rest, token);
24826
+ stateId = requireValue13(rest, token);
24602
24827
  break;
24603
24828
  case "--cwd":
24604
- cwd = requireValue12(rest, token);
24829
+ cwd = requireValue13(rest, token);
24605
24830
  break;
24606
24831
  default:
24607
24832
  throw new Error(`Unknown linear option: ${token}`);
@@ -24639,10 +24864,10 @@ function parseLinearSubIssuesArgs(tokens) {
24639
24864
  const token = rest.shift();
24640
24865
  switch (token) {
24641
24866
  case "--account":
24642
- account = requireValue12(rest, token);
24867
+ account = requireValue13(rest, token);
24643
24868
  break;
24644
24869
  case "--cwd":
24645
- cwd = requireValue12(rest, token);
24870
+ cwd = requireValue13(rest, token);
24646
24871
  break;
24647
24872
  default:
24648
24873
  throw new Error(`Unknown linear option: ${token}`);
@@ -24669,15 +24894,15 @@ function parseLinearCommentArgs(tokens) {
24669
24894
  const token = rest.shift();
24670
24895
  switch (token) {
24671
24896
  case "--account":
24672
- account = requireValue12(rest, token);
24897
+ account = requireValue13(rest, token);
24673
24898
  break;
24674
24899
  case "--body":
24675
24900
  case "--desc":
24676
24901
  case "--description":
24677
- body = decodeEscapedNewlines(requireValue12(rest, token));
24902
+ body = decodeEscapedNewlines(requireValue13(rest, token));
24678
24903
  break;
24679
24904
  case "--cwd":
24680
- cwd = requireValue12(rest, token);
24905
+ cwd = requireValue13(rest, token);
24681
24906
  break;
24682
24907
  default:
24683
24908
  throw new Error(`Unknown linear option: ${token}`);
@@ -24707,10 +24932,10 @@ function parseLinearCommentsArgs(tokens) {
24707
24932
  const token = rest.shift();
24708
24933
  switch (token) {
24709
24934
  case "--account":
24710
- account = requireValue12(rest, token);
24935
+ account = requireValue13(rest, token);
24711
24936
  break;
24712
24937
  case "--cwd":
24713
- cwd = requireValue12(rest, token);
24938
+ cwd = requireValue13(rest, token);
24714
24939
  break;
24715
24940
  default:
24716
24941
  throw new Error(`Unknown linear option: ${token}`);
@@ -24734,16 +24959,16 @@ function parseLinearCycleArgs(tokens) {
24734
24959
  const token = rest.shift();
24735
24960
  switch (token) {
24736
24961
  case "--account":
24737
- account = requireValue12(rest, token);
24962
+ account = requireValue13(rest, token);
24738
24963
  break;
24739
24964
  case "--team-id":
24740
- teamId = requireValue12(rest, token);
24965
+ teamId = requireValue13(rest, token);
24741
24966
  break;
24742
24967
  case "--team-key":
24743
- teamKey = requireValue12(rest, token);
24968
+ teamKey = requireValue13(rest, token);
24744
24969
  break;
24745
24970
  case "--cwd":
24746
- cwd = requireValue12(rest, token);
24971
+ cwd = requireValue13(rest, token);
24747
24972
  break;
24748
24973
  default:
24749
24974
  throw new Error(`Unknown linear option: ${token}`);
@@ -24766,10 +24991,10 @@ function parseLinearTeamsArgs(tokens) {
24766
24991
  const token = rest.shift();
24767
24992
  switch (token) {
24768
24993
  case "--account":
24769
- account = requireValue12(rest, token);
24994
+ account = requireValue13(rest, token);
24770
24995
  break;
24771
24996
  case "--cwd":
24772
- cwd = requireValue12(rest, token);
24997
+ cwd = requireValue13(rest, token);
24773
24998
  break;
24774
24999
  default:
24775
25000
  throw new Error(`Unknown linear option: ${token}`);
@@ -24796,16 +25021,16 @@ function parseLinearUserIssuesArgs(tokens) {
24796
25021
  const token = rest.shift();
24797
25022
  switch (token) {
24798
25023
  case "--account":
24799
- account = requireValue12(rest, token);
25024
+ account = requireValue13(rest, token);
24800
25025
  break;
24801
25026
  case "--cycle":
24802
- cycle = parseLinearCycle(requireValue12(rest, token));
25027
+ cycle = parseLinearCycle(requireValue13(rest, token));
24803
25028
  break;
24804
25029
  case "--status":
24805
- status = parseLinearStatus(requireValue12(rest, token));
25030
+ status = parseLinearStatus(requireValue13(rest, token));
24806
25031
  break;
24807
25032
  case "--cwd":
24808
- cwd = requireValue12(rest, token);
25033
+ cwd = requireValue13(rest, token);
24809
25034
  break;
24810
25035
  default:
24811
25036
  throw new Error(`Unknown linear option: ${token}`);
@@ -24839,28 +25064,28 @@ function parseLinearIssuesArgs(tokens) {
24839
25064
  const token = rest.shift();
24840
25065
  switch (token) {
24841
25066
  case "--account":
24842
- account = requireValue12(rest, token);
25067
+ account = requireValue13(rest, token);
24843
25068
  break;
24844
25069
  case "--team-id":
24845
- teamId = requireValue12(rest, token);
25070
+ teamId = requireValue13(rest, token);
24846
25071
  break;
24847
25072
  case "--team-key":
24848
- teamKey = requireValue12(rest, token);
25073
+ teamKey = requireValue13(rest, token);
24849
25074
  break;
24850
25075
  case "--user":
24851
- user = requireValue12(rest, token);
25076
+ user = requireValue13(rest, token);
24852
25077
  break;
24853
25078
  case "--cycle":
24854
- cycle = parseLinearCycle(requireValue12(rest, token));
25079
+ cycle = parseLinearCycle(requireValue13(rest, token));
24855
25080
  break;
24856
25081
  case "--status":
24857
- status = parseLinearStatus(requireValue12(rest, token));
25082
+ status = parseLinearStatus(requireValue13(rest, token));
24858
25083
  break;
24859
25084
  case "--query":
24860
- query = requireValue12(rest, token).trim();
25085
+ query = requireValue13(rest, token).trim();
24861
25086
  break;
24862
25087
  case "--limit": {
24863
- const value = Number.parseInt(requireValue12(rest, token), 10);
25088
+ const value = Number.parseInt(requireValue13(rest, token), 10);
24864
25089
  if (!Number.isInteger(value) || value < 1 || value > 250) {
24865
25090
  throw new Error("Invalid --limit. Expected an integer between 1 and 250.");
24866
25091
  }
@@ -24868,7 +25093,7 @@ function parseLinearIssuesArgs(tokens) {
24868
25093
  break;
24869
25094
  }
24870
25095
  case "--cwd":
24871
- cwd = requireValue12(rest, token);
25096
+ cwd = requireValue13(rest, token);
24872
25097
  break;
24873
25098
  default:
24874
25099
  throw new Error(`Unknown linear option: ${token}`);
@@ -24909,10 +25134,10 @@ function parseLinearLegacyArgs(tokens) {
24909
25134
  useScreenshot = true;
24910
25135
  break;
24911
25136
  case "--account":
24912
- account = requireValue12(rest, token);
25137
+ account = requireValue13(rest, token);
24913
25138
  break;
24914
25139
  case "--cwd":
24915
- cwd = requireValue12(rest, token);
25140
+ cwd = requireValue13(rest, token);
24916
25141
  break;
24917
25142
  default:
24918
25143
  throw new Error(`Unknown linear option: ${token}`);
@@ -25006,19 +25231,19 @@ function parseNotionArgs(tokens) {
25006
25231
  const token = rest.shift();
25007
25232
  switch (token) {
25008
25233
  case "--parent":
25009
- parentPageId = requireValue12(rest, token);
25234
+ parentPageId = requireValue13(rest, token);
25010
25235
  break;
25011
25236
  case "--title":
25012
- title = requireValue12(rest, token);
25237
+ title = requireValue13(rest, token);
25013
25238
  break;
25014
25239
  case "--private":
25015
25240
  isPrivate = true;
25016
25241
  break;
25017
25242
  case "--content":
25018
- content2 = requireValue12(rest, token);
25243
+ content2 = requireValue13(rest, token);
25019
25244
  break;
25020
25245
  case "--file":
25021
- filePath2 = requireValue12(rest, token);
25246
+ filePath2 = requireValue13(rest, token);
25022
25247
  break;
25023
25248
  default:
25024
25249
  throw new Error(`Unknown notion option: ${token}`);
@@ -25062,10 +25287,10 @@ function parseNotionArgs(tokens) {
25062
25287
  const token = rest.shift();
25063
25288
  switch (token) {
25064
25289
  case "--content":
25065
- content = requireValue12(rest, token);
25290
+ content = requireValue13(rest, token);
25066
25291
  break;
25067
25292
  case "--file":
25068
- filePath = requireValue12(rest, token);
25293
+ filePath = requireValue13(rest, token);
25069
25294
  break;
25070
25295
  case "--append":
25071
25296
  append = true;
@@ -25110,11 +25335,11 @@ function parseRandomArgs(tokens) {
25110
25335
  mode = "easy";
25111
25336
  break;
25112
25337
  case "--length":
25113
- length = parsePositiveInt2(requireValue12(rest, token), token);
25338
+ length = parsePositiveInt2(requireValue13(rest, token), token);
25114
25339
  seenLength = true;
25115
25340
  break;
25116
25341
  case "--charset": {
25117
- const value = requireValue12(rest, token);
25342
+ const value = requireValue13(rest, token);
25118
25343
  if (!["base64url", "hex", "alnum", "ascii"].includes(value)) {
25119
25344
  throw new Error(
25120
25345
  `Invalid --charset value: ${value}. Use base64url|hex|alnum|ascii.`
@@ -25125,18 +25350,18 @@ function parseRandomArgs(tokens) {
25125
25350
  break;
25126
25351
  }
25127
25352
  case "--count":
25128
- count = parsePositiveInt2(requireValue12(rest, token), token);
25353
+ count = parsePositiveInt2(requireValue13(rest, token), token);
25129
25354
  break;
25130
25355
  case "--words":
25131
- words = parsePositiveInt2(requireValue12(rest, token), token);
25356
+ words = parsePositiveInt2(requireValue13(rest, token), token);
25132
25357
  seenWords = true;
25133
25358
  break;
25134
25359
  case "--digits":
25135
- digits = parseNonNegativeInt(requireValue12(rest, token), token);
25360
+ digits = parseNonNegativeInt(requireValue13(rest, token), token);
25136
25361
  seenDigits = true;
25137
25362
  break;
25138
25363
  case "--separator":
25139
- separator = requireValue12(rest, token);
25364
+ separator = requireValue13(rest, token);
25140
25365
  seenSeparator = true;
25141
25366
  break;
25142
25367
  default:
@@ -25167,7 +25392,7 @@ function parseRandomArgs(tokens) {
25167
25392
  count
25168
25393
  };
25169
25394
  }
25170
- function requireValue12(tokens, optionName) {
25395
+ function requireValue13(tokens, optionName) {
25171
25396
  const value = tokens.shift();
25172
25397
  if (!value) {
25173
25398
  throw new Error(`Missing value for ${optionName}`);
@@ -25298,6 +25523,11 @@ async function main() {
25298
25523
  await handler.handle(commandArgs);
25299
25524
  return;
25300
25525
  }
25526
+ case "chat-room" /* ChatRoom */: {
25527
+ const handler = new ChatRoomCommandHandler();
25528
+ await handler.handle(commandArgs);
25529
+ return;
25530
+ }
25301
25531
  case "oss" /* Oss */: {
25302
25532
  const handler = new OssCommandHandler();
25303
25533
  await handler.handle(commandArgs);