agent-remnote 0.3.0 → 0.4.1

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/main.js CHANGED
@@ -48355,6 +48355,7 @@ var sleep4 = sleep3;
48355
48355
  var timeout2 = timeout;
48356
48356
  var timeoutOption2 = timeoutOption;
48357
48357
  var timeoutFail2 = timeoutFail;
48358
+ var timeoutTo2 = timeoutTo;
48358
48359
  var withConfigProvider2 = withConfigProvider;
48359
48360
  var context3 = context;
48360
48361
  var contextWithEffect2 = contextWithEffect;
@@ -74153,6 +74154,9 @@ var ROOT_VALUE_FLAGS = new Set([
74153
74154
  "--ws-port",
74154
74155
  "--repo",
74155
74156
  "--api-base-url",
74157
+ "--api-host",
74158
+ "--api-port",
74159
+ "--api-base-path",
74156
74160
  "--config-file",
74157
74161
  ...BUILTIN_VALUE_FLAGS
74158
74162
  ]);
@@ -74209,6 +74213,10 @@ function normalizeApiBasePath(raw4) {
74209
74213
  return "/v1";
74210
74214
  return trimmed2.startsWith("/") ? trimmed2 : `/${trimmed2}`;
74211
74215
  }
74216
+ function normalizeApiHost(raw4) {
74217
+ const trimmed2 = raw4.trim();
74218
+ return trimmed2 || "0.0.0.0";
74219
+ }
74212
74220
  function normalizeApiBaseUrl(raw4) {
74213
74221
  const trimmed2 = raw4.trim();
74214
74222
  if (!trimmed2)
@@ -74235,6 +74243,18 @@ function normalizeApiBaseUrl(raw4) {
74235
74243
  const normalized = trimmed2.replace(/\/+$/, "");
74236
74244
  return normalized;
74237
74245
  }
74246
+ function normalizeApiPort(raw4) {
74247
+ const value8 = typeof raw4 === "number" ? raw4 : Number.parseInt(String(raw4).trim(), 10);
74248
+ if (!Number.isInteger(value8) || value8 <= 0 || value8 > 65535) {
74249
+ throw new CliError({
74250
+ code: "INVALID_ARGS",
74251
+ message: `Invalid apiPort: ${String(raw4)}`,
74252
+ exitCode: 2,
74253
+ details: { api_port: raw4 }
74254
+ });
74255
+ }
74256
+ return value8;
74257
+ }
74238
74258
  function resolveWsStateFile(spec) {
74239
74259
  const raw4 = spec.trim();
74240
74260
  if (raw4 === "0" || raw4.toLowerCase() === "false") {
@@ -74327,9 +74347,12 @@ var rawConfigSpec = all8({
74327
74347
  statusLineDebug: boolean4("statusLineDebug").pipe(withDefault2(false)),
74328
74348
  statusLineJsonFile: string5("statusLineJsonFile").pipe(withDefault2(defaultStatusLineJsonFilePath())),
74329
74349
  apiBaseUrl: string5("apiBaseUrl").pipe(withDefault2("")),
74330
- apiHost: string5("apiHost").pipe(withDefault2("0.0.0.0")),
74331
- apiPort: port2("apiPort").pipe(withDefault2(3000)),
74332
- apiBasePath: string5("apiBasePath").pipe(withDefault2("/v1")),
74350
+ apiHost: string5("apiHost").pipe(withDefault2("")),
74351
+ apiPort: integer2("apiPort").pipe(withDefault2(-1), validate3({
74352
+ message: "apiPort must be -1 or a valid port",
74353
+ validation: (n) => Number.isInteger(n) && (n === -1 || n > 0 && n <= 65535)
74354
+ })),
74355
+ apiBasePath: string5("apiBasePath").pipe(withDefault2("")),
74333
74356
  apiPidFile: string5("apiPidFile").pipe(withDefault2(defaultApiPidFilePath())),
74334
74357
  apiLogFile: string5("apiLogFile").pipe(withDefault2(defaultApiLogFilePath())),
74335
74358
  apiStateFile: string5("apiStateFile").pipe(withDefault2(defaultApiStateFilePath()))
@@ -74390,11 +74413,16 @@ function readUserConfigFile(configFile) {
74390
74413
  }
74391
74414
  const config3 = parsed;
74392
74415
  const api = config3.api;
74393
- const nestedBaseUrl = api && typeof api === "object" && !Array.isArray(api) ? api.baseUrl : undefined;
74416
+ const apiObject = api && typeof api === "object" && !Array.isArray(api) ? api : undefined;
74417
+ const nestedBaseUrl = apiObject?.baseUrl;
74418
+ const nestedHost = apiObject?.host;
74419
+ const nestedPort = apiObject?.port;
74420
+ const nestedBasePath = apiObject?.basePath;
74394
74421
  const apiBaseUrl = config3.apiBaseUrl ?? nestedBaseUrl;
74395
- if (apiBaseUrl === undefined)
74396
- return {};
74397
- if (typeof apiBaseUrl !== "string") {
74422
+ const apiHostRaw = config3.apiHost ?? nestedHost;
74423
+ const apiPortRaw = config3.apiPort ?? nestedPort;
74424
+ const apiBasePathRaw = config3.apiBasePath ?? nestedBasePath;
74425
+ if (apiBaseUrl !== undefined && typeof apiBaseUrl !== "string") {
74398
74426
  throw new CliError({
74399
74427
  code: "INVALID_ARGS",
74400
74428
  message: `Config key apiBaseUrl must be a string: ${file6}`,
@@ -74402,7 +74430,43 @@ function readUserConfigFile(configFile) {
74402
74430
  details: { config_file: file6 }
74403
74431
  });
74404
74432
  }
74405
- return { apiBaseUrl };
74433
+ const apiHost = apiHostRaw === undefined ? undefined : (() => {
74434
+ if (typeof apiHostRaw !== "string") {
74435
+ throw new CliError({
74436
+ code: "INVALID_ARGS",
74437
+ message: `Config key apiHost must be a string: ${file6}`,
74438
+ exitCode: 2,
74439
+ details: { config_file: file6 }
74440
+ });
74441
+ }
74442
+ return normalizeApiHost(apiHostRaw);
74443
+ })();
74444
+ const apiPort = apiPortRaw === undefined ? undefined : (() => {
74445
+ if (typeof apiPortRaw !== "number" && typeof apiPortRaw !== "string") {
74446
+ throw new CliError({
74447
+ code: "INVALID_ARGS",
74448
+ message: `Config key apiPort must be a valid port number: ${file6}`,
74449
+ exitCode: 2,
74450
+ details: { config_file: file6 }
74451
+ });
74452
+ }
74453
+ return normalizeApiPort(apiPortRaw);
74454
+ })();
74455
+ const apiBasePath = apiBasePathRaw === undefined ? undefined : (() => {
74456
+ if (typeof apiBasePathRaw !== "string") {
74457
+ throw new CliError({
74458
+ code: "INVALID_ARGS",
74459
+ message: `Config key apiBasePath must be a string: ${file6}`,
74460
+ exitCode: 2,
74461
+ details: { config_file: file6 }
74462
+ });
74463
+ }
74464
+ return normalizeApiBasePath(apiBasePathRaw);
74465
+ })();
74466
+ if (apiBaseUrl === undefined && apiHost === undefined && apiPort === undefined && apiBasePath === undefined) {
74467
+ return {};
74468
+ }
74469
+ return { apiBaseUrl, apiHost, apiPort, apiBasePath };
74406
74470
  }
74407
74471
  function resolveConfig() {
74408
74472
  return gen2(function* () {
@@ -74434,6 +74498,11 @@ function resolveConfig() {
74434
74498
  });
74435
74499
  const apiBaseUrlRaw = optionalTrimmed(raw4.apiBaseUrl) ?? optionalTrimmed(userConfig.apiBaseUrl ?? "");
74436
74500
  const apiBaseUrl = apiBaseUrlRaw ? normalizeApiBaseUrl(apiBaseUrlRaw) : undefined;
74501
+ const apiHostRaw = optionalTrimmed(raw4.apiHost ?? "") ?? optionalTrimmed(userConfig.apiHost ?? "") ?? "0.0.0.0";
74502
+ const apiHost = normalizeApiHost(apiHostRaw);
74503
+ const apiPort = raw4.apiPort && raw4.apiPort > 0 ? raw4.apiPort : userConfig.apiPort ?? 3000;
74504
+ const apiBasePathRaw = optionalTrimmed(raw4.apiBasePath ?? "") ?? optionalTrimmed(userConfig.apiBasePath ?? "") ?? "/v1";
74505
+ const apiBasePath = normalizeApiBasePath(apiBasePathRaw);
74437
74506
  return {
74438
74507
  format: format8,
74439
74508
  quiet: raw4.quiet,
@@ -74455,9 +74524,9 @@ function resolveConfig() {
74455
74524
  statusLineDebug: raw4.statusLineDebug,
74456
74525
  statusLineJsonFile: resolveUserFilePath(raw4.statusLineJsonFile),
74457
74526
  apiBaseUrl,
74458
- apiHost: raw4.apiHost.trim() || "0.0.0.0",
74459
- apiPort: raw4.apiPort,
74460
- apiBasePath: normalizeApiBasePath(raw4.apiBasePath),
74527
+ apiHost,
74528
+ apiPort,
74529
+ apiBasePath,
74461
74530
  apiPidFile: resolveUserFilePath(raw4.apiPidFile),
74462
74531
  apiLogFile: resolveUserFilePath(raw4.apiLogFile),
74463
74532
  apiStateFile: resolveUserFilePath(raw4.apiStateFile)
@@ -74486,6 +74555,12 @@ function canonicalKey(input) {
74486
74555
  }
74487
74556
  if (key === "apiBaseUrl" || key === "api.baseUrl" || key === "api-base-url")
74488
74557
  return "apiBaseUrl";
74558
+ if (key === "apiHost" || key === "api.host" || key === "api-host")
74559
+ return "apiHost";
74560
+ if (key === "apiPort" || key === "api.port" || key === "api-port")
74561
+ return "apiPort";
74562
+ if (key === "apiBasePath" || key === "api.basePath" || key === "api-base-path")
74563
+ return "apiBasePath";
74489
74564
  throw new CliError({ code: "INVALID_ARGS", message: `Unsupported config key: ${key}`, exitCode: 2 });
74490
74565
  }
74491
74566
  function isPlainObject(value8) {
@@ -74513,11 +74588,82 @@ function readApiBaseUrl(doc) {
74513
74588
  }
74514
74589
  return { value: rootValue ?? nestedValue, errors: errors3 };
74515
74590
  }
74591
+ function normalizeApiHostCandidate(candidate, keyName, errors3) {
74592
+ if (candidate === undefined)
74593
+ return;
74594
+ if (typeof candidate !== "string") {
74595
+ errors3.push(`Config key ${keyName} must be a string`);
74596
+ return;
74597
+ }
74598
+ return normalizeApiHost(candidate);
74599
+ }
74600
+ function readApiHost(doc) {
74601
+ const errors3 = [];
74602
+ const root = doc.apiHost;
74603
+ const api = doc.api;
74604
+ const nested4 = isPlainObject(api) ? api.host : undefined;
74605
+ const rootValue = normalizeApiHostCandidate(root, "apiHost", errors3);
74606
+ const nestedValue = normalizeApiHostCandidate(nested4, "api.host", errors3);
74607
+ if (rootValue !== undefined && nestedValue !== undefined && rootValue !== nestedValue) {
74608
+ errors3.push("Config keys apiHost and api.host conflict");
74609
+ }
74610
+ return { value: rootValue ?? nestedValue, errors: errors3 };
74611
+ }
74612
+ function normalizeApiPortCandidate(candidate, keyName, errors3) {
74613
+ if (candidate === undefined)
74614
+ return;
74615
+ if (typeof candidate !== "number" && typeof candidate !== "string") {
74616
+ errors3.push(`Config key ${keyName} must be a valid port number`);
74617
+ return;
74618
+ }
74619
+ try {
74620
+ return normalizeApiPort(candidate);
74621
+ } catch (error4) {
74622
+ errors3.push(isCliError(error4) ? error4.message : `Config key ${keyName} must be a valid port number`);
74623
+ return;
74624
+ }
74625
+ }
74626
+ function readApiPort(doc) {
74627
+ const errors3 = [];
74628
+ const root = doc.apiPort;
74629
+ const api = doc.api;
74630
+ const nested4 = isPlainObject(api) ? api.port : undefined;
74631
+ const rootValue = normalizeApiPortCandidate(root, "apiPort", errors3);
74632
+ const nestedValue = normalizeApiPortCandidate(nested4, "api.port", errors3);
74633
+ if (rootValue !== undefined && nestedValue !== undefined && rootValue !== nestedValue) {
74634
+ errors3.push("Config keys apiPort and api.port conflict");
74635
+ }
74636
+ return { value: rootValue ?? nestedValue, errors: errors3 };
74637
+ }
74638
+ function normalizeApiBasePathCandidate(candidate, keyName, errors3) {
74639
+ if (candidate === undefined)
74640
+ return;
74641
+ if (typeof candidate !== "string") {
74642
+ errors3.push(`Config key ${keyName} must be a string`);
74643
+ return;
74644
+ }
74645
+ return normalizeApiBasePath(candidate);
74646
+ }
74647
+ function readApiBasePath(doc) {
74648
+ const errors3 = [];
74649
+ const root = doc.apiBasePath;
74650
+ const api = doc.api;
74651
+ const nested4 = isPlainObject(api) ? api.basePath : undefined;
74652
+ const rootValue = normalizeApiBasePathCandidate(root, "apiBasePath", errors3);
74653
+ const nestedValue = normalizeApiBasePathCandidate(nested4, "api.basePath", errors3);
74654
+ if (rootValue !== undefined && nestedValue !== undefined && rootValue !== nestedValue) {
74655
+ errors3.push("Config keys apiBasePath and api.basePath conflict");
74656
+ }
74657
+ return { value: rootValue ?? nestedValue, errors: errors3 };
74658
+ }
74516
74659
  function inspectDoc(configFile, exists3, doc) {
74517
74660
  const apiBaseUrl = readApiBaseUrl(doc);
74661
+ const apiHost = readApiHost(doc);
74662
+ const apiPort = readApiPort(doc);
74663
+ const apiBasePath = readApiBasePath(doc);
74518
74664
  const unknownKeys = [];
74519
74665
  for (const key of Object.keys(doc)) {
74520
- if (key === "apiBaseUrl")
74666
+ if (key === "apiBaseUrl" || key === "apiHost" || key === "apiPort" || key === "apiBasePath")
74521
74667
  continue;
74522
74668
  if (key !== "api") {
74523
74669
  unknownKeys.push(key);
@@ -74528,18 +74674,25 @@ function inspectDoc(configFile, exists3, doc) {
74528
74674
  continue;
74529
74675
  }
74530
74676
  for (const nestedKey of Object.keys(api)) {
74531
- if (nestedKey === "baseUrl")
74677
+ if (nestedKey === "baseUrl" || nestedKey === "host" || nestedKey === "port" || nestedKey === "basePath") {
74532
74678
  continue;
74679
+ }
74533
74680
  unknownKeys.push(`api.${nestedKey}`);
74534
74681
  }
74535
74682
  }
74683
+ const errors3 = [...apiBaseUrl.errors, ...apiHost.errors, ...apiPort.errors, ...apiBasePath.errors];
74536
74684
  return {
74537
74685
  configFile,
74538
74686
  exists: exists3,
74539
- values: { apiBaseUrl: apiBaseUrl.value },
74687
+ values: {
74688
+ apiBaseUrl: apiBaseUrl.value,
74689
+ apiHost: apiHost.value,
74690
+ apiPort: apiPort.value,
74691
+ apiBasePath: apiBasePath.value
74692
+ },
74540
74693
  unknownKeys,
74541
- errors: apiBaseUrl.errors,
74542
- valid: apiBaseUrl.errors.length === 0
74694
+ errors: errors3,
74695
+ valid: errors3.length === 0
74543
74696
  };
74544
74697
  }
74545
74698
  async function ensureDir(filePath) {
@@ -74612,6 +74765,36 @@ function setApiBaseUrl(doc, value8) {
74612
74765
  }
74613
74766
  return next4;
74614
74767
  }
74768
+ function setApiHost(doc, value8) {
74769
+ const next4 = cloneDoc(doc);
74770
+ next4.apiHost = normalizeApiHost(value8);
74771
+ const api = next4.api;
74772
+ if (isPlainObject(api)) {
74773
+ delete api.host;
74774
+ removeEmptyApiObject(next4);
74775
+ }
74776
+ return next4;
74777
+ }
74778
+ function setApiPort(doc, value8) {
74779
+ const next4 = cloneDoc(doc);
74780
+ next4.apiPort = normalizeApiPort(value8);
74781
+ const api = next4.api;
74782
+ if (isPlainObject(api)) {
74783
+ delete api.port;
74784
+ removeEmptyApiObject(next4);
74785
+ }
74786
+ return next4;
74787
+ }
74788
+ function setApiBasePath(doc, value8) {
74789
+ const next4 = cloneDoc(doc);
74790
+ next4.apiBasePath = normalizeApiBasePath(value8);
74791
+ const api = next4.api;
74792
+ if (isPlainObject(api)) {
74793
+ delete api.basePath;
74794
+ removeEmptyApiObject(next4);
74795
+ }
74796
+ return next4;
74797
+ }
74615
74798
  function unsetApiBaseUrl(doc) {
74616
74799
  const next4 = cloneDoc(doc);
74617
74800
  let removed = false;
@@ -74627,6 +74810,51 @@ function unsetApiBaseUrl(doc) {
74627
74810
  }
74628
74811
  return { next: next4, removed };
74629
74812
  }
74813
+ function unsetApiHost(doc) {
74814
+ const next4 = cloneDoc(doc);
74815
+ let removed = false;
74816
+ if (Object.prototype.hasOwnProperty.call(next4, "apiHost")) {
74817
+ delete next4.apiHost;
74818
+ removed = true;
74819
+ }
74820
+ const api = next4.api;
74821
+ if (isPlainObject(api) && Object.prototype.hasOwnProperty.call(api, "host")) {
74822
+ delete api.host;
74823
+ removeEmptyApiObject(next4);
74824
+ removed = true;
74825
+ }
74826
+ return { next: next4, removed };
74827
+ }
74828
+ function unsetApiPort(doc) {
74829
+ const next4 = cloneDoc(doc);
74830
+ let removed = false;
74831
+ if (Object.prototype.hasOwnProperty.call(next4, "apiPort")) {
74832
+ delete next4.apiPort;
74833
+ removed = true;
74834
+ }
74835
+ const api = next4.api;
74836
+ if (isPlainObject(api) && Object.prototype.hasOwnProperty.call(api, "port")) {
74837
+ delete api.port;
74838
+ removeEmptyApiObject(next4);
74839
+ removed = true;
74840
+ }
74841
+ return { next: next4, removed };
74842
+ }
74843
+ function unsetApiBasePath(doc) {
74844
+ const next4 = cloneDoc(doc);
74845
+ let removed = false;
74846
+ if (Object.prototype.hasOwnProperty.call(next4, "apiBasePath")) {
74847
+ delete next4.apiBasePath;
74848
+ removed = true;
74849
+ }
74850
+ const api = next4.api;
74851
+ if (isPlainObject(api) && Object.prototype.hasOwnProperty.call(api, "basePath")) {
74852
+ delete api.basePath;
74853
+ removeEmptyApiObject(next4);
74854
+ removed = true;
74855
+ }
74856
+ return { next: next4, removed };
74857
+ }
74630
74858
  function isEmptyDoc(doc) {
74631
74859
  return Object.keys(doc).length === 0;
74632
74860
  }
@@ -74670,7 +74898,7 @@ var UserConfigFileLive = succeed10(UserConfigFile, {
74670
74898
  catch: (error4) => toCliFailure(error4, "Invalid config file")
74671
74899
  });
74672
74900
  const inspection = inspectDoc(configFile, parsed.exists, doc);
74673
- const value8 = targetKey === "apiBaseUrl" ? inspection.values.apiBaseUrl ?? null : null;
74901
+ const value8 = targetKey === "apiBaseUrl" ? inspection.values.apiBaseUrl ?? null : targetKey === "apiHost" ? inspection.values.apiHost ?? null : targetKey === "apiPort" ? inspection.values.apiPort ?? null : targetKey === "apiBasePath" ? inspection.values.apiBasePath ?? null : null;
74674
74902
  return {
74675
74903
  configFile,
74676
74904
  key: targetKey,
@@ -74692,6 +74920,15 @@ var UserConfigFileLive = succeed10(UserConfigFile, {
74692
74920
  const next4 = targetKey === "apiBaseUrl" ? yield* try_3({
74693
74921
  try: () => setApiBaseUrl(doc, value8),
74694
74922
  catch: (error4) => toCliFailure(error4, "Invalid config value")
74923
+ }) : targetKey === "apiHost" ? yield* try_3({
74924
+ try: () => setApiHost(doc, value8),
74925
+ catch: (error4) => toCliFailure(error4, "Invalid config value")
74926
+ }) : targetKey === "apiPort" ? yield* try_3({
74927
+ try: () => setApiPort(doc, value8),
74928
+ catch: (error4) => toCliFailure(error4, "Invalid config value")
74929
+ }) : targetKey === "apiBasePath" ? yield* try_3({
74930
+ try: () => setApiBasePath(doc, value8),
74931
+ catch: (error4) => toCliFailure(error4, "Invalid config value")
74695
74932
  }) : doc;
74696
74933
  yield* tryPromise2({
74697
74934
  try: async () => await writeDoc(configFile, next4),
@@ -74705,7 +74942,7 @@ var UserConfigFileLive = succeed10(UserConfigFile, {
74705
74942
  return {
74706
74943
  configFile,
74707
74944
  key: targetKey,
74708
- value: String(next4.apiBaseUrl ?? ""),
74945
+ value: targetKey === "apiBaseUrl" ? String(next4.apiBaseUrl ?? "") : targetKey === "apiHost" ? String(next4.apiHost ?? "") : targetKey === "apiPort" ? Number(next4.apiPort) : targetKey === "apiBasePath" ? String(next4.apiBasePath ?? "") : "",
74709
74946
  changed: true
74710
74947
  };
74711
74948
  }),
@@ -74728,7 +74965,7 @@ var UserConfigFileLive = succeed10(UserConfigFile, {
74728
74965
  fileDeleted: false
74729
74966
  };
74730
74967
  }
74731
- const result = targetKey === "apiBaseUrl" ? unsetApiBaseUrl(doc) : { next: doc, removed: false };
74968
+ const result = targetKey === "apiBaseUrl" ? unsetApiBaseUrl(doc) : targetKey === "apiHost" ? unsetApiHost(doc) : targetKey === "apiPort" ? unsetApiPort(doc) : targetKey === "apiBasePath" ? unsetApiBasePath(doc) : { next: doc, removed: false };
74732
74969
  if (!result.removed) {
74733
74970
  return {
74734
74971
  configFile,
@@ -74911,6 +75148,9 @@ var configListCommand = exports_Command.make("list", {}, () => gen2(function* ()
74911
75148
  `- exists: ${data.exists}`,
74912
75149
  `- valid: ${data.valid}`,
74913
75150
  `- apiBaseUrl: ${data.values.apiBaseUrl ?? ""}`,
75151
+ `- apiHost: ${data.values.apiHost ?? ""}`,
75152
+ `- apiPort: ${data.values.apiPort ?? ""}`,
75153
+ `- apiBasePath: ${data.values.apiBasePath ?? ""}`,
74914
75154
  `- unknown_keys: ${data.unknown_keys.join(", ")}`,
74915
75155
  `- errors: ${data.errors.join(" | ")}`
74916
75156
  ];
@@ -75224,6 +75464,10 @@ var configValidateCommand = exports_Command.make("validate", {}, () => gen2(func
75224
75464
  `- config_file: ${data.config_file}`,
75225
75465
  `- exists: ${data.exists}`,
75226
75466
  `- valid: ${data.valid}`,
75467
+ `- apiBaseUrl: ${data.values.apiBaseUrl ?? ""}`,
75468
+ `- apiHost: ${data.values.apiHost ?? ""}`,
75469
+ `- apiPort: ${data.values.apiPort ?? ""}`,
75470
+ `- apiBasePath: ${data.values.apiBasePath ?? ""}`,
75227
75471
  `- unknown_keys: ${data.unknown_keys.join(", ")}`,
75228
75472
  `- errors: ${data.errors.join(" | ")}`
75229
75473
  ];
@@ -84870,7 +85114,12 @@ async function executeSearchRemOverviewWithDb(db, params3) {
84870
85114
  const offset2 = parsed.dateOffsetDays ?? 0;
84871
85115
  const now2 = new Date;
84872
85116
  const target2 = new Date(now2.getFullYear(), now2.getMonth(), now2.getDate() + offset2);
84873
- const format9 = await getDateFormatting(db) ?? "yyyy/MM/dd";
85117
+ let format9 = "yyyy/MM/dd";
85118
+ try {
85119
+ format9 = await getDateFormatting(db) ?? "yyyy/MM/dd";
85120
+ } catch {
85121
+ format9 = "yyyy/MM/dd";
85122
+ }
84874
85123
  effectiveQuery = formatDateWithPattern(target2, format9);
84875
85124
  }
84876
85125
  const items = searchRems(db, {
@@ -90387,6 +90636,18 @@ function unsafeKillAny(child, signal) {
90387
90636
  child.kill(signal);
90388
90637
  } catch {}
90389
90638
  }
90639
+ function drainReadable(stream11) {
90640
+ if (!stream11 || typeof stream11.read !== "function")
90641
+ return "";
90642
+ let out = "";
90643
+ while (true) {
90644
+ const chunk4 = stream11.read();
90645
+ if (chunk4 === null)
90646
+ break;
90647
+ out += String(chunk4);
90648
+ }
90649
+ return out;
90650
+ }
90390
90651
  var SubprocessLive = succeed10(Subprocess, {
90391
90652
  run: ({ command, args: args2, timeoutMs, cwd, env: env2, killSignal }) => scoped2(acquireRelease2(gen2(function* () {
90392
90653
  const stdout2 = { text: "" };
@@ -90453,9 +90714,18 @@ var SubprocessLive = succeed10(Subprocess, {
90453
90714
  yield* sync3(() => unsafeKill(state.child, state.killSignal));
90454
90715
  }
90455
90716
  yield* sync3(state.cleanup);
90456
- })).pipe(flatMap9((state) => _await3(state.exit).pipe(timeoutFail2({
90717
+ })).pipe(flatMap9((state) => _await3(state.exit).pipe(timeoutTo2({
90457
90718
  duration: sanitizeTimeoutMs(timeoutMs),
90458
- onTimeout: () => timeoutCliError({
90719
+ onSuccess: (result) => right2(result),
90720
+ onTimeout: () => left2(undefined)
90721
+ }), flatMap9((result) => isRight2(result) ? succeed8(result.right) : gen2(function* () {
90722
+ yield* sync3(() => unsafeKill(state.child, state.killSignal));
90723
+ yield* sleep4(millis(50));
90724
+ yield* sync3(() => {
90725
+ state.stdout.text += drainReadable(state.child.stdout);
90726
+ state.stderr.text += drainReadable(state.child.stderr);
90727
+ });
90728
+ return yield* fail8(timeoutCliError({
90459
90729
  command,
90460
90730
  args: args2,
90461
90731
  timeoutMs: sanitizeTimeoutMs(timeoutMs),
@@ -90463,8 +90733,8 @@ var SubprocessLive = succeed10(Subprocess, {
90463
90733
  killSignal: state.killSignal,
90464
90734
  stdout: state.stdout.text,
90465
90735
  stderr: state.stderr.text
90466
- })
90467
- }))))),
90736
+ }));
90737
+ })))))),
90468
90738
  runInherit: ({ command, args: args2, cwd, env: env2, killSignal }) => scoped2(acquireRelease2(gen2(function* () {
90469
90739
  const done11 = { value: false };
90470
90740
  const exit3 = yield* make40();
@@ -91216,6 +91486,7 @@ var StatusLineControllerLive = scoped3(StatusLineController, gen2(function* () {
91216
91486
  const cfg = yield* AppConfig;
91217
91487
  const updater = yield* StatusLineUpdater;
91218
91488
  const state = yield* make25(INITIAL_STATE);
91489
+ const runLoopScope = yield* acquireRelease2(make38(), (scope5) => close(scope5, void_3));
91219
91490
  const runLoop2 = gen2(function* () {
91220
91491
  while (true) {
91221
91492
  const snapBefore = yield* get11(state);
@@ -91267,7 +91538,7 @@ var StatusLineControllerLive = scoped3(StatusLineController, gen2(function* () {
91267
91538
  return [s.scheduled === false, next4];
91268
91539
  });
91269
91540
  if (shouldStart) {
91270
- yield* fork3(runLoop2.pipe(catchAll2(() => _void)));
91541
+ yield* forkIn2(runLoopScope)(runLoop2.pipe(catchAll2(() => _void)));
91271
91542
  }
91272
91543
  yield* _await3(waiter);
91273
91544
  })
@@ -92418,6 +92689,188 @@ var dailySummaryCommand = exports_Command.make("summary", { days: days2, maxLine
92418
92689
  yield* writeSuccess({ data: result, md: result.markdown ?? "" });
92419
92690
  }).pipe(catchAll2(writeFailure)));
92420
92691
 
92692
+ // src/services/RefResolver.ts
92693
+ class RefResolver extends Tag2("RefResolver")() {
92694
+ }
92695
+ function stripQuotes(s) {
92696
+ const t = s.trim();
92697
+ if (t.startsWith('"') && t.endsWith('"') || t.startsWith("'") && t.endsWith("'")) {
92698
+ return t.slice(1, -1);
92699
+ }
92700
+ return t;
92701
+ }
92702
+ function parseRef(input) {
92703
+ const raw4 = input.trim();
92704
+ const link3 = tryParseRemnoteLink(raw4);
92705
+ if (link3?.remId) {
92706
+ return { kind: "id", value: link3.remId };
92707
+ }
92708
+ const idx = raw4.indexOf(":");
92709
+ if (idx <= 0) {
92710
+ throw new CliError({
92711
+ code: "INVALID_ARGS",
92712
+ message: `Invalid ref: ${input}`,
92713
+ exitCode: 2,
92714
+ hint: [
92715
+ "Example: --ref id:xxx",
92716
+ 'Example: --ref "remnote://w/<workspaceId>/<remId>"',
92717
+ "Example: --ref page:Demo",
92718
+ "Example: --ref title:Demo",
92719
+ "Example: --ref daily:today",
92720
+ "Example: --ref daily:-1"
92721
+ ]
92722
+ });
92723
+ }
92724
+ const kind = raw4.slice(0, idx).trim();
92725
+ const value8 = stripQuotes(raw4.slice(idx + 1));
92726
+ if (!value8) {
92727
+ throw new CliError({
92728
+ code: "INVALID_ARGS",
92729
+ message: `Invalid ref (missing value): ${input}`,
92730
+ exitCode: 2
92731
+ });
92732
+ }
92733
+ if (kind === "id" || kind === "title" || kind === "daily") {
92734
+ if (kind === "id") {
92735
+ const link22 = tryParseRemnoteLink(value8);
92736
+ return { kind, value: link22?.remId ?? value8 };
92737
+ }
92738
+ return { kind, value: value8 };
92739
+ }
92740
+ if (kind === "page") {
92741
+ return { kind, value: value8 };
92742
+ }
92743
+ throw new CliError({
92744
+ code: "INVALID_ARGS",
92745
+ message: `Unsupported ref: ${input}`,
92746
+ exitCode: 2,
92747
+ hint: ["Supported prefixes: id:/page:/title:/daily:"]
92748
+ });
92749
+ }
92750
+ function parseDailyOffset(value8) {
92751
+ const v = value8.trim().toLowerCase();
92752
+ if (v === "today" || v === "now" || v === "0")
92753
+ return 0;
92754
+ if (v === "yesterday")
92755
+ return -1;
92756
+ if (v === "tomorrow")
92757
+ return 1;
92758
+ const n = Number.parseInt(v, 10);
92759
+ if (!Number.isFinite(n)) {
92760
+ throw new CliError({
92761
+ code: "INVALID_ARGS",
92762
+ message: `Invalid daily ref: ${value8} (expected today/yesterday/tomorrow or an integer offset)`,
92763
+ exitCode: 2
92764
+ });
92765
+ }
92766
+ return n;
92767
+ }
92768
+ var RefResolverLive = succeed10(RefResolver, {
92769
+ resolve: (ref) => gen2(function* () {
92770
+ const cfg = yield* AppConfig;
92771
+ const parsed = yield* try_3({
92772
+ try: () => parseRef(ref),
92773
+ catch: (e) => e && typeof e === "object" && e._tag === "CliError" ? e : new CliError({ code: "INVALID_ARGS", message: `Invalid ref: ${ref}`, exitCode: 2 })
92774
+ });
92775
+ if (parsed.kind === "id")
92776
+ return parsed.value;
92777
+ const dailyOffset = parsed.kind === "daily" ? yield* try_3({
92778
+ try: () => parseDailyOffset(parsed.value),
92779
+ catch: (e) => e && typeof e === "object" && e._tag === "CliError" ? e : new CliError({
92780
+ code: "INVALID_ARGS",
92781
+ message: `Invalid daily ref: ${parsed.value}`,
92782
+ exitCode: 2
92783
+ })
92784
+ }) : undefined;
92785
+ const queryInput = parsed.kind === "title" || parsed.kind === "page" ? { query: parsed.value } : { query: "date", useCurrentDate: true, dateOffsetDays: dailyOffset };
92786
+ const result = yield* tryPromise2({
92787
+ try: async () => await executeSearchRemOverview({
92788
+ ...queryInput,
92789
+ dbPath: cfg.remnoteDb,
92790
+ limit: 1,
92791
+ preferExact: true,
92792
+ exactFirstSingle: true,
92793
+ pagesOnly: parsed.kind === "page" ? true : undefined
92794
+ }),
92795
+ catch: (e) => new CliError({
92796
+ code: "DB_UNAVAILABLE",
92797
+ message: String(e?.message || e || "RemNote DB is unavailable"),
92798
+ exitCode: 1
92799
+ })
92800
+ });
92801
+ const first3 = Array.isArray(result.matches) ? result.matches[0] : undefined;
92802
+ const id2 = first3?.id ? String(first3.id) : "";
92803
+ if (!id2) {
92804
+ return yield* fail8(new CliError({
92805
+ code: "INVALID_ARGS",
92806
+ message: `No Rem found for ref: ${ref}`,
92807
+ exitCode: 2
92808
+ }));
92809
+ }
92810
+ return id2;
92811
+ })
92812
+ });
92813
+
92814
+ // src/commands/daily/rem-id.ts
92815
+ function optionToUndefined10(opt) {
92816
+ return isSome2(opt) ? opt.value : undefined;
92817
+ }
92818
+ function parseDateInput(raw4) {
92819
+ const value8 = new Date(raw4);
92820
+ if (Number.isNaN(value8.getTime())) {
92821
+ throw new CliError({ code: "INVALID_ARGS", message: `Invalid date: ${raw4}`, exitCode: 2 });
92822
+ }
92823
+ return value8;
92824
+ }
92825
+ var date6 = text9("date").pipe(optional5, map34(optionToUndefined10));
92826
+ var offsetDays = integer7("offset-days").pipe(optional5, map34(optionToUndefined10));
92827
+ var dailyRemIdCommand = exports_Command.make("rem-id", { date: date6, offsetDays }, ({ date: date7, offsetDays: offsetDays2 }) => gen2(function* () {
92828
+ if (date7 && offsetDays2 !== undefined) {
92829
+ return yield* fail8(new CliError({ code: "INVALID_ARGS", message: "Choose only one of --date or --offset-days", exitCode: 2 }));
92830
+ }
92831
+ const cfg = yield* AppConfig;
92832
+ const refs = yield* RefResolver;
92833
+ const remDb = yield* RemDb;
92834
+ let ref = `daily:${offsetDays2 ?? 0}`;
92835
+ let remId = "";
92836
+ let dateString;
92837
+ if (date7) {
92838
+ const target2 = parseDateInput(date7);
92839
+ dateString = yield* remDb.withDb(cfg.remnoteDb, async (db) => {
92840
+ const format9 = await getDateFormatting(db) ?? "yyyy/MM/dd";
92841
+ return formatDateWithPattern(target2, format9);
92842
+ }).pipe(map17((r) => r.result), catchAll2(() => succeed8(formatDateWithPattern(target2, "yyyy/MM/dd"))));
92843
+ const searchInput = {
92844
+ query: dateString,
92845
+ dbPath: cfg.remnoteDb,
92846
+ limit: 1,
92847
+ preferExact: true,
92848
+ exactFirstSingle: true,
92849
+ excludePages: true
92850
+ };
92851
+ const result = yield* tryPromise2({
92852
+ try: async () => await executeSearchRemOverview(searchInput),
92853
+ catch: (e) => cliErrorFromUnknown(e, { code: "DB_UNAVAILABLE" })
92854
+ });
92855
+ const first3 = Array.isArray(result.matches) ? result.matches[0] : undefined;
92856
+ remId = first3?.id ? String(first3.id) : "";
92857
+ ref = `daily:${date7}`;
92858
+ if (!remId) {
92859
+ return yield* fail8(new CliError({ code: "INVALID_ARGS", message: `No Daily Rem found for date: ${date7}`, exitCode: 2 }));
92860
+ }
92861
+ } else {
92862
+ remId = yield* refs.resolve(ref);
92863
+ }
92864
+ yield* writeSuccess({
92865
+ data: { ref, remId, dateString },
92866
+ ids: [remId],
92867
+ md: `- ref: ${ref}
92868
+ - rem_id: ${remId}${dateString ? `
92869
+ - date_string: ${dateString}` : ""}
92870
+ `
92871
+ });
92872
+ }).pipe(catchAll2(writeFailure)));
92873
+
92421
92874
  // src/services/FileInput.ts
92422
92875
  import { promises as fs16 } from "node:fs";
92423
92876
  class FileInput extends Tag2("FileInput")() {
@@ -92639,6 +93092,14 @@ function dropBlankLinesOutsideFences(input) {
92639
93092
  return out.join(`
92640
93093
  `);
92641
93094
  }
93095
+ var STRUCTURED_MARKDOWN_LINE_RE = /^\s{0,3}(?:#{1,6}\s+\S|[-*+]\s+\S|\d+\.\s+\S|```|~~~)/m;
93096
+ function looksLikeStructuredMarkdown(input) {
93097
+ const normalized = input.replace(/\r\n?/g, `
93098
+ `).trim();
93099
+ if (!normalized)
93100
+ return false;
93101
+ return STRUCTURED_MARKDOWN_LINE_RE.test(normalized);
93102
+ }
92642
93103
 
92643
93104
  // src/commands/_waitTxn.ts
92644
93105
  function normalizeTxnStatus(raw4) {
@@ -92976,32 +93437,35 @@ function normalizeOps(rawOps) {
92976
93437
  }
92977
93438
 
92978
93439
  // src/commands/daily/write.ts
92979
- function optionToUndefined10(opt) {
93440
+ function optionToUndefined11(opt) {
92980
93441
  return isSome2(opt) ? opt.value : undefined;
92981
93442
  }
92982
93443
  function readOptionalText(name) {
92983
- return text9(name).pipe(optional5, map34(optionToUndefined10));
93444
+ return text9(name).pipe(optional5, map34(optionToUndefined11));
92984
93445
  }
92985
93446
  var text14 = readOptionalText("text");
93447
+ var markdown = readOptionalText("markdown");
92986
93448
  var mdFile = readOptionalText("md-file");
92987
- var date6 = readOptionalText("date");
92988
- var offsetDays = integer7("offset-days").pipe(optional5, map34(optionToUndefined10));
93449
+ var stdin3 = boolean8("stdin");
93450
+ var date7 = readOptionalText("date");
93451
+ var offsetDays2 = integer7("offset-days").pipe(optional5, map34(optionToUndefined11));
92989
93452
  var createIfMissing = boolean8("create-if-missing");
92990
93453
  var noCreateIfMissing = boolean8("no-create-if-missing");
92991
93454
  var clientId = readOptionalText("client-id");
92992
93455
  var idempotencyKey = readOptionalText("idempotency-key");
92993
93456
  var metaSpec = readOptionalText("meta");
92994
- var priority = integer7("priority").pipe(optional5, map34(optionToUndefined10));
93457
+ var priority = integer7("priority").pipe(optional5, map34(optionToUndefined11));
92995
93458
  var notify = boolean8("no-notify").pipe(map34((v) => !v));
92996
93459
  var ensureDaemon2 = boolean8("no-ensure-daemon").pipe(map34((v) => !v));
93460
+ var forceText = boolean8("force-text");
92997
93461
  var wait = boolean8("wait");
92998
- var timeoutMs = integer7("timeout-ms").pipe(optional5, map34(optionToUndefined10));
92999
- var pollMs = integer7("poll-ms").pipe(optional5, map34(optionToUndefined10));
93000
- var bulk = choice5("bulk", ["auto", "always", "never"]).pipe(optional5, map34(optionToUndefined10));
93462
+ var timeoutMs = integer7("timeout-ms").pipe(optional5, map34(optionToUndefined11));
93463
+ var pollMs = integer7("poll-ms").pipe(optional5, map34(optionToUndefined11));
93464
+ var bulk = choice5("bulk", ["auto", "always", "never"]).pipe(optional5, map34(optionToUndefined11));
93001
93465
  var bundleTitle = readOptionalText("bundle-title");
93002
93466
  var BULK_THRESHOLD_LINES = 80;
93003
93467
  var BULK_THRESHOLD_CHARS = 5000;
93004
- function parseDateInput(raw4) {
93468
+ function parseDateInput2(raw4) {
93005
93469
  const d = new Date(raw4);
93006
93470
  if (isNaN(d.getTime())) {
93007
93471
  throw new CliError({ code: "INVALID_ARGS", message: `Invalid date: ${raw4}`, exitCode: 2 });
@@ -93014,14 +93478,17 @@ function todayAtMidnight() {
93014
93478
  }
93015
93479
  var dailyWriteCommand = exports_Command.make("write", {
93016
93480
  text: text14,
93481
+ markdown,
93017
93482
  mdFile,
93018
- date: date6,
93019
- offsetDays,
93483
+ stdin: stdin3,
93484
+ date: date7,
93485
+ offsetDays: offsetDays2,
93020
93486
  prepend: boolean8("prepend"),
93021
93487
  createIfMissing,
93022
93488
  noCreateIfMissing,
93023
93489
  notify,
93024
93490
  ensureDaemon: ensureDaemon2,
93491
+ forceText,
93025
93492
  dryRun: boolean8("dry-run"),
93026
93493
  bulk,
93027
93494
  bundleTitle,
@@ -93034,14 +93501,17 @@ var dailyWriteCommand = exports_Command.make("write", {
93034
93501
  meta: metaSpec
93035
93502
  }, ({
93036
93503
  text: text15,
93504
+ markdown: markdownInput,
93037
93505
  mdFile: mdFile2,
93038
- date: date7,
93039
- offsetDays: offsetDays2,
93506
+ stdin: stdin4,
93507
+ date: date8,
93508
+ offsetDays: offsetDays3,
93040
93509
  prepend: prepend5,
93041
93510
  createIfMissing: createIfMissing2,
93042
93511
  noCreateIfMissing: noCreateIfMissing2,
93043
93512
  notify: notify2,
93044
93513
  ensureDaemon: ensureDaemon3,
93514
+ forceText: forceText2,
93045
93515
  dryRun,
93046
93516
  bulk: bulk2,
93047
93517
  bundleTitle: bundleTitle2,
@@ -93060,13 +93530,29 @@ var dailyWriteCommand = exports_Command.make("write", {
93060
93530
  exitCode: 2
93061
93531
  }));
93062
93532
  }
93063
- if (text15 && mdFile2) {
93064
- return yield* fail8(new CliError({ code: "INVALID_ARGS", message: "Choose only one of --text or --md-file", exitCode: 2 }));
93533
+ if (dryRun && wait2) {
93534
+ return yield* fail8(new CliError({
93535
+ code: "INVALID_ARGS",
93536
+ message: "--wait is not compatible with --dry-run",
93537
+ exitCode: 2
93538
+ }));
93065
93539
  }
93066
- if (!text15 && !mdFile2) {
93067
- return yield* fail8(new CliError({ code: "INVALID_ARGS", message: "You must provide --text or --md-file", exitCode: 2 }));
93540
+ const inputModeCount = Number(text15 !== undefined) + Number(markdownInput !== undefined) + Number(mdFile2 !== undefined) + Number(stdin4);
93541
+ if (inputModeCount > 1) {
93542
+ return yield* fail8(new CliError({
93543
+ code: "INVALID_ARGS",
93544
+ message: "Choose only one of --text, --markdown, --md-file, or --stdin",
93545
+ exitCode: 2
93546
+ }));
93068
93547
  }
93069
- if (date7 && offsetDays2 !== undefined) {
93548
+ if (inputModeCount === 0) {
93549
+ return yield* fail8(new CliError({
93550
+ code: "INVALID_ARGS",
93551
+ message: "You must provide one of --text, --markdown, --md-file, or --stdin",
93552
+ exitCode: 2
93553
+ }));
93554
+ }
93555
+ if (date8 && offsetDays3 !== undefined) {
93070
93556
  return yield* fail8(new CliError({ code: "INVALID_ARGS", message: "Choose only one of --date or --offset-days", exitCode: 2 }));
93071
93557
  }
93072
93558
  if (createIfMissing2 && noCreateIfMissing2) {
@@ -93080,9 +93566,16 @@ var dailyWriteCommand = exports_Command.make("write", {
93080
93566
  const fileInput = yield* FileInput;
93081
93567
  const payloadSvc = yield* Payload;
93082
93568
  const remDb = yield* RemDb;
93083
- const markdownRaw = mdFile2 ? yield* fileInput.readTextFromFileSpec({ spec: mdFile2 }) : undefined;
93084
- const markdown = markdownRaw !== undefined ? trimBoundaryBlankLines(markdownRaw) : undefined;
93569
+ const markdownRaw = mdFile2 ? yield* fileInput.readTextFromFileSpec({ spec: mdFile2 }) : stdin4 ? yield* fileInput.readTextFromFileSpec({ spec: "-" }) : markdownInput;
93570
+ const markdown2 = markdownRaw !== undefined ? trimBoundaryBlankLines(markdownRaw) : undefined;
93085
93571
  const textValue = text15 !== undefined ? trimBoundaryBlankLines(text15) : undefined;
93572
+ if (textValue && !forceText2 && looksLikeStructuredMarkdown(textValue)) {
93573
+ return yield* fail8(new CliError({
93574
+ code: "INVALID_ARGS",
93575
+ message: "Input passed to --text looks like structured Markdown. Use --markdown, --stdin, or --md-file instead.",
93576
+ exitCode: 2
93577
+ }));
93578
+ }
93086
93579
  const bulkMode = bulk2 ?? "auto";
93087
93580
  const bundleTitleValue = typeof bundleTitle2 === "string" ? bundleTitle2.trim() : "";
93088
93581
  const hasBundleTitle = Boolean(bundleTitleValue);
@@ -93093,24 +93586,24 @@ var dailyWriteCommand = exports_Command.make("write", {
93093
93586
  exitCode: 2
93094
93587
  }));
93095
93588
  }
93096
- const target2 = date7 ? yield* try_3({
93097
- try: () => parseDateInput(date7),
93589
+ const target2 = date8 ? yield* try_3({
93590
+ try: () => parseDateInput2(date8),
93098
93591
  catch: (e) => isCliError(e) ? e : new CliError({ code: "INVALID_ARGS", message: "Invalid date", exitCode: 2 })
93099
- }) : new Date(todayAtMidnight().getTime() + (offsetDays2 ?? 0) * 24 * 3600 * 1000);
93592
+ }) : new Date(todayAtMidnight().getTime() + (offsetDays3 ?? 0) * 24 * 3600 * 1000);
93100
93593
  const dateString = yield* remDb.withDb(cfg.remnoteDb, async (db) => {
93101
93594
  const fmt = await getDateFormatting(db) ?? "yyyy/MM/dd";
93102
93595
  return formatDateWithPattern(target2, fmt);
93103
93596
  }).pipe(map17((r) => r.result), catchAll2(() => succeed8(undefined)));
93104
93597
  const createIfMissingBool = noCreateIfMissing2 ? false : createIfMissing2 ? true : undefined;
93105
- const content = markdown ?? textValue ?? "";
93598
+ const content = markdown2 ?? textValue ?? "";
93106
93599
  const lines3 = typeof content === "string" ? content.split(`
93107
93600
  `).length : 0;
93108
93601
  const chars = typeof content === "string" ? content.length : 0;
93109
93602
  const shouldBundle = bulkMode === "always" || bulkMode === "auto" && (hasBundleTitle || lines3 >= BULK_THRESHOLD_LINES || chars >= BULK_THRESHOLD_CHARS);
93110
93603
  const payload = {
93111
- ...markdown !== undefined ? { markdown } : {},
93604
+ ...markdown2 !== undefined ? { markdown: markdown2 } : {},
93112
93605
  ...textValue !== undefined ? { text: textValue } : {},
93113
- ...date7 ? { date: target2.toISOString() } : { offsetDays: offsetDays2 ?? 0 },
93606
+ ...date8 ? { date: target2.toISOString() } : { offsetDays: offsetDays3 ?? 0 },
93114
93607
  ...dateString ? { dateString } : {},
93115
93608
  ...prepend5 ? { prepend: true } : {},
93116
93609
  ...createIfMissingBool !== undefined ? { createIfMissing: createIfMissingBool } : {},
@@ -93132,13 +93625,6 @@ var dailyWriteCommand = exports_Command.make("write", {
93132
93625
  });
93133
93626
  const metaValue = meta ? yield* payloadSvc.readJson(meta) : undefined;
93134
93627
  if (dryRun) {
93135
- if (wait2) {
93136
- return yield* fail8(new CliError({
93137
- code: "INVALID_ARGS",
93138
- message: "--wait is not compatible with --dry-run",
93139
- exitCode: 2
93140
- }));
93141
- }
93142
93628
  yield* writeSuccess({
93143
93629
  data: { dry_run: true, ops: [op], meta: metaValue ? payloadSvc.normalizeKeys(metaValue) : undefined },
93144
93630
  md: `- dry_run: true
@@ -93174,13 +93660,13 @@ var dailyWriteCommand = exports_Command.make("write", {
93174
93660
  }).pipe(catchAll2(writeFailure)));
93175
93661
 
93176
93662
  // src/commands/daily/index.ts
93177
- var dailyCommand = exports_Command.make("daily", {}).pipe(exports_Command.withSubcommands([dailySummaryCommand, dailyWriteCommand]));
93663
+ var dailyCommand = exports_Command.make("daily", {}).pipe(exports_Command.withSubcommands([dailySummaryCommand, dailyRemIdCommand, dailyWriteCommand]));
93178
93664
 
93179
93665
  // src/commands/read/db/backups.ts
93180
- function optionToUndefined11(opt) {
93666
+ function optionToUndefined12(opt) {
93181
93667
  return isSome2(opt) ? opt.value : undefined;
93182
93668
  }
93183
- var basePath = text9("base-path").pipe(optional5, map34(optionToUndefined11));
93669
+ var basePath = text9("base-path").pipe(optional5, map34(optionToUndefined12));
93184
93670
  var limit = integer7("limit").pipe(withDefault5(50));
93185
93671
  var dbBackupsCommand = exports_Command.make("backups", { basePath, limit }, ({ basePath: basePath2, limit: limit2 }) => tryPromise2({
93186
93672
  try: async () => await executeListRemBackups({
@@ -93199,7 +93685,7 @@ var dbBackupsCommand = exports_Command.make("backups", { basePath, limit }, ({ b
93199
93685
  }), catchAll2(writeFailure)));
93200
93686
 
93201
93687
  // src/commands/read/db/recent.ts
93202
- function optionToUndefined12(opt) {
93688
+ function optionToUndefined13(opt) {
93203
93689
  return isSome2(opt) ? opt.value : undefined;
93204
93690
  }
93205
93691
  function pad2(n) {
@@ -93227,9 +93713,9 @@ function scalar(db, sql, params3) {
93227
93713
  const row = db.prepare(sql).get(...params3);
93228
93714
  return asInt(row?.c ?? row?.count ?? row?.["count(*)"]);
93229
93715
  }
93230
- var days3 = integer7("days").pipe(optional5, map34(optionToUndefined12));
93231
- var maxParents = integer7("max-parents").pipe(optional5, map34(optionToUndefined12));
93232
- var perParent = integer7("per-parent").pipe(optional5, map34(optionToUndefined12));
93716
+ var days3 = integer7("days").pipe(optional5, map34(optionToUndefined13));
93717
+ var maxParents = integer7("max-parents").pipe(optional5, map34(optionToUndefined13));
93718
+ var perParent = integer7("per-parent").pipe(optional5, map34(optionToUndefined13));
93233
93719
  var dbRecentCommand = exports_Command.make("recent", {
93234
93720
  days: days3,
93235
93721
  maxParents,
@@ -93372,130 +93858,8 @@ var readDbCommand = exports_Command.make("db", {}).pipe(exports_Command.withSubc
93372
93858
  // src/commands/db/index.ts
93373
93859
  var dbCommand = readDbCommand;
93374
93860
 
93375
- // src/services/RefResolver.ts
93376
- class RefResolver extends Tag2("RefResolver")() {
93377
- }
93378
- function stripQuotes(s) {
93379
- const t = s.trim();
93380
- if (t.startsWith('"') && t.endsWith('"') || t.startsWith("'") && t.endsWith("'")) {
93381
- return t.slice(1, -1);
93382
- }
93383
- return t;
93384
- }
93385
- function parseRef(input) {
93386
- const raw4 = input.trim();
93387
- const link3 = tryParseRemnoteLink(raw4);
93388
- if (link3?.remId) {
93389
- return { kind: "id", value: link3.remId };
93390
- }
93391
- const idx = raw4.indexOf(":");
93392
- if (idx <= 0) {
93393
- throw new CliError({
93394
- code: "INVALID_ARGS",
93395
- message: `Invalid ref: ${input}`,
93396
- exitCode: 2,
93397
- hint: [
93398
- "Example: --ref id:xxx",
93399
- 'Example: --ref "remnote://w/<workspaceId>/<remId>"',
93400
- "Example: --ref page:Demo",
93401
- "Example: --ref title:Demo",
93402
- "Example: --ref daily:today",
93403
- "Example: --ref daily:-1"
93404
- ]
93405
- });
93406
- }
93407
- const kind = raw4.slice(0, idx).trim();
93408
- const value8 = stripQuotes(raw4.slice(idx + 1));
93409
- if (!value8) {
93410
- throw new CliError({
93411
- code: "INVALID_ARGS",
93412
- message: `Invalid ref (missing value): ${input}`,
93413
- exitCode: 2
93414
- });
93415
- }
93416
- if (kind === "id" || kind === "title" || kind === "daily") {
93417
- if (kind === "id") {
93418
- const link22 = tryParseRemnoteLink(value8);
93419
- return { kind, value: link22?.remId ?? value8 };
93420
- }
93421
- return { kind, value: value8 };
93422
- }
93423
- if (kind === "page") {
93424
- return { kind, value: value8 };
93425
- }
93426
- throw new CliError({
93427
- code: "INVALID_ARGS",
93428
- message: `Unsupported ref: ${input}`,
93429
- exitCode: 2,
93430
- hint: ["Supported prefixes: id:/page:/title:/daily:"]
93431
- });
93432
- }
93433
- function parseDailyOffset(value8) {
93434
- const v = value8.trim().toLowerCase();
93435
- if (v === "today" || v === "now" || v === "0")
93436
- return 0;
93437
- if (v === "yesterday")
93438
- return -1;
93439
- if (v === "tomorrow")
93440
- return 1;
93441
- const n = Number.parseInt(v, 10);
93442
- if (!Number.isFinite(n)) {
93443
- throw new CliError({
93444
- code: "INVALID_ARGS",
93445
- message: `Invalid daily ref: ${value8} (expected today/yesterday/tomorrow or an integer offset)`,
93446
- exitCode: 2
93447
- });
93448
- }
93449
- return n;
93450
- }
93451
- var RefResolverLive = succeed10(RefResolver, {
93452
- resolve: (ref) => gen2(function* () {
93453
- const cfg = yield* AppConfig;
93454
- const parsed = yield* try_3({
93455
- try: () => parseRef(ref),
93456
- catch: (e) => e && typeof e === "object" && e._tag === "CliError" ? e : new CliError({ code: "INVALID_ARGS", message: `Invalid ref: ${ref}`, exitCode: 2 })
93457
- });
93458
- if (parsed.kind === "id")
93459
- return parsed.value;
93460
- const dailyOffset = parsed.kind === "daily" ? yield* try_3({
93461
- try: () => parseDailyOffset(parsed.value),
93462
- catch: (e) => e && typeof e === "object" && e._tag === "CliError" ? e : new CliError({
93463
- code: "INVALID_ARGS",
93464
- message: `Invalid daily ref: ${parsed.value}`,
93465
- exitCode: 2
93466
- })
93467
- }) : undefined;
93468
- const queryInput = parsed.kind === "title" || parsed.kind === "page" ? { query: parsed.value } : { query: "date", useCurrentDate: true, dateOffsetDays: dailyOffset };
93469
- const result = yield* tryPromise2({
93470
- try: async () => await executeSearchRemOverview({
93471
- ...queryInput,
93472
- dbPath: cfg.remnoteDb,
93473
- limit: 1,
93474
- preferExact: true,
93475
- exactFirstSingle: true,
93476
- pagesOnly: parsed.kind === "page" ? true : undefined
93477
- }),
93478
- catch: (e) => new CliError({
93479
- code: "DB_UNAVAILABLE",
93480
- message: String(e?.message || e || "RemNote DB is unavailable"),
93481
- exitCode: 1
93482
- })
93483
- });
93484
- const first3 = Array.isArray(result.matches) ? result.matches[0] : undefined;
93485
- const id2 = first3?.id ? String(first3.id) : "";
93486
- if (!id2) {
93487
- return yield* fail8(new CliError({
93488
- code: "INVALID_ARGS",
93489
- message: `No Rem found for ref: ${ref}`,
93490
- exitCode: 2
93491
- }));
93492
- }
93493
- return id2;
93494
- })
93495
- });
93496
-
93497
93861
  // src/commands/write/wechat/outline.ts
93498
- function optionToUndefined13(opt) {
93862
+ function optionToUndefined14(opt) {
93499
93863
  return isSome2(opt) ? opt.value : undefined;
93500
93864
  }
93501
93865
  function clampInt4(value8, min5, max7) {
@@ -93743,16 +94107,16 @@ function mergeMeta(base, extra) {
93743
94107
  return base;
93744
94108
  return { ...base, ...extra };
93745
94109
  }
93746
- var parent = text9("parent").pipe(optional5, map34(optionToUndefined13));
93747
- var ref = text9("ref").pipe(optional5, map34(optionToUndefined13));
93748
- var cdpPort = integer7("cdp-port").pipe(optional5, map34(optionToUndefined13));
93749
- var maxDepth = integer7("max-depth").pipe(optional5, map34(optionToUndefined13));
93750
- var waitMs = integer7("wait-ms").pipe(optional5, map34(optionToUndefined13));
93751
- var titleSuffix = text9("title-suffix").pipe(optional5, map34(optionToUndefined13));
93752
- var clientId2 = text9("client-id").pipe(optional5, map34(optionToUndefined13));
93753
- var idempotencyKey2 = text9("idempotency-key").pipe(optional5, map34(optionToUndefined13));
93754
- var priority2 = integer7("priority").pipe(optional5, map34(optionToUndefined13));
93755
- var metaSpec2 = text9("meta").pipe(optional5, map34(optionToUndefined13));
94110
+ var parent = text9("parent").pipe(optional5, map34(optionToUndefined14));
94111
+ var ref = text9("ref").pipe(optional5, map34(optionToUndefined14));
94112
+ var cdpPort = integer7("cdp-port").pipe(optional5, map34(optionToUndefined14));
94113
+ var maxDepth = integer7("max-depth").pipe(optional5, map34(optionToUndefined14));
94114
+ var waitMs = integer7("wait-ms").pipe(optional5, map34(optionToUndefined14));
94115
+ var titleSuffix = text9("title-suffix").pipe(optional5, map34(optionToUndefined14));
94116
+ var clientId2 = text9("client-id").pipe(optional5, map34(optionToUndefined14));
94117
+ var idempotencyKey2 = text9("idempotency-key").pipe(optional5, map34(optionToUndefined14));
94118
+ var priority2 = integer7("priority").pipe(optional5, map34(optionToUndefined14));
94119
+ var metaSpec2 = text9("meta").pipe(optional5, map34(optionToUndefined14));
93756
94120
  var notify2 = boolean8("no-notify").pipe(map34((v) => !v));
93757
94121
  var ensureDaemon3 = boolean8("no-ensure-daemon").pipe(map34((v) => !v));
93758
94122
  var wechatOutlineCommand = exports_Command.make("outline", {
@@ -93832,7 +94196,7 @@ var wechatOutlineCommand = exports_Command.make("outline", {
93832
94196
  }));
93833
94197
  }
93834
94198
  const title = suffix ? `${rawTitle}${suffix}` : rawTitle;
93835
- const markdown = dropBlankLinesOutsideFences(outlineify({ title, url: url2, content: rawContent, maxDepth: depth }));
94199
+ const markdown2 = dropBlankLinesOutsideFences(outlineify({ title, url: url2, content: rawContent, maxDepth: depth }));
93836
94200
  const baseMeta = {
93837
94201
  source: "wechat",
93838
94202
  url: url2,
@@ -93845,7 +94209,7 @@ var wechatOutlineCommand = exports_Command.make("outline", {
93845
94209
  const op = yield* try_3({
93846
94210
  try: () => normalizeOp({
93847
94211
  type: "create_tree_with_markdown",
93848
- payload: { parentId: resolvedParent, markdown, parseMode: "smart" }
94212
+ payload: { parentId: resolvedParent, markdown: markdown2, parseMode: "smart" }
93849
94213
  }, payloadSvc.normalizeKeys),
93850
94214
  catch: (e) => isCliError(e) ? e : new CliError({
93851
94215
  code: "INVALID_PAYLOAD",
@@ -94060,32 +94424,32 @@ var HostApiClientLive = succeed10(HostApiClient, {
94060
94424
  });
94061
94425
 
94062
94426
  // src/commands/import/markdown.ts
94063
- function optionToUndefined14(opt) {
94427
+ function optionToUndefined15(opt) {
94064
94428
  return isSome2(opt) ? opt.value : undefined;
94065
94429
  }
94066
94430
  function readOptionalText2(name) {
94067
- return text9(name).pipe(optional5, map34(optionToUndefined14));
94431
+ return text9(name).pipe(optional5, map34(optionToUndefined15));
94068
94432
  }
94069
94433
  var parent2 = readOptionalText2("parent");
94070
94434
  var ref2 = readOptionalText2("ref");
94071
94435
  var file7 = readOptionalText2("file");
94072
94436
  var markdownInline = readOptionalText2("markdown");
94073
- var stdin3 = boolean8("stdin");
94074
- var mode = choice5("mode", ["indent", "native"]).pipe(optional5, map34(optionToUndefined14));
94075
- var indentSize = integer7("indent-size").pipe(optional5, map34(optionToUndefined14));
94076
- var position3 = integer7("position").pipe(optional5, map34(optionToUndefined14));
94077
- var bulk2 = choice5("bulk", ["auto", "always", "never"]).pipe(optional5, map34(optionToUndefined14));
94437
+ var stdin4 = boolean8("stdin");
94438
+ var mode = choice5("mode", ["indent", "native"]).pipe(optional5, map34(optionToUndefined15));
94439
+ var indentSize = integer7("indent-size").pipe(optional5, map34(optionToUndefined15));
94440
+ var position3 = integer7("position").pipe(optional5, map34(optionToUndefined15));
94441
+ var bulk2 = choice5("bulk", ["auto", "always", "never"]).pipe(optional5, map34(optionToUndefined15));
94078
94442
  var bundleTitle2 = readOptionalText2("bundle-title");
94079
94443
  var staged = boolean8("staged");
94080
94444
  var clientId3 = readOptionalText2("client-id");
94081
94445
  var idempotencyKey3 = readOptionalText2("idempotency-key");
94082
94446
  var metaSpec3 = readOptionalText2("meta");
94083
- var priority3 = integer7("priority").pipe(optional5, map34(optionToUndefined14));
94447
+ var priority3 = integer7("priority").pipe(optional5, map34(optionToUndefined15));
94084
94448
  var notify3 = boolean8("no-notify").pipe(map34((v) => !v));
94085
94449
  var ensureDaemon4 = boolean8("no-ensure-daemon").pipe(map34((v) => !v));
94086
94450
  var wait2 = boolean8("wait");
94087
- var timeoutMs2 = integer7("timeout-ms").pipe(optional5, map34(optionToUndefined14));
94088
- var pollMs2 = integer7("poll-ms").pipe(optional5, map34(optionToUndefined14));
94451
+ var timeoutMs2 = integer7("timeout-ms").pipe(optional5, map34(optionToUndefined15));
94452
+ var pollMs2 = integer7("poll-ms").pipe(optional5, map34(optionToUndefined15));
94089
94453
  var BULK_THRESHOLD_LINES2 = 80;
94090
94454
  var BULK_THRESHOLD_CHARS2 = 5000;
94091
94455
  var importMarkdownCommand = exports_Command.make("markdown", {
@@ -94093,7 +94457,7 @@ var importMarkdownCommand = exports_Command.make("markdown", {
94093
94457
  ref: ref2,
94094
94458
  file: file7,
94095
94459
  markdown: markdownInline,
94096
- stdin: stdin3,
94460
+ stdin: stdin4,
94097
94461
  mode,
94098
94462
  indentSize,
94099
94463
  position: position3,
@@ -94114,8 +94478,8 @@ var importMarkdownCommand = exports_Command.make("markdown", {
94114
94478
  parent: parent3,
94115
94479
  ref: ref3,
94116
94480
  file: file8,
94117
- markdown,
94118
- stdin: stdin4,
94481
+ markdown: markdown2,
94482
+ stdin: stdin5,
94119
94483
  mode: mode2,
94120
94484
  indentSize: indentSize2,
94121
94485
  position: position4,
@@ -94150,14 +94514,14 @@ var importMarkdownCommand = exports_Command.make("markdown", {
94150
94514
  }
94151
94515
  const payloadSvc = yield* Payload;
94152
94516
  const fileInput = yield* FileInput;
94153
- if (file8 && markdown || stdin4 && (file8 || markdown)) {
94517
+ if (file8 && markdown2 || stdin5 && (file8 || markdown2)) {
94154
94518
  return yield* fail8(new CliError({
94155
94519
  code: "INVALID_ARGS",
94156
94520
  message: "Choose exactly one of --file / --markdown / --stdin",
94157
94521
  exitCode: 2
94158
94522
  }));
94159
94523
  }
94160
- if (!file8 && !markdown && !stdin4) {
94524
+ if (!file8 && !markdown2 && !stdin5) {
94161
94525
  return yield* fail8(new CliError({
94162
94526
  code: "INVALID_ARGS",
94163
94527
  message: "You must provide --file or --markdown or --stdin",
@@ -94172,7 +94536,7 @@ var importMarkdownCommand = exports_Command.make("markdown", {
94172
94536
  details: { position: position4 }
94173
94537
  }));
94174
94538
  }
94175
- const markdownValueRaw = typeof markdown === "string" ? markdown : yield* fileInput.readTextFromFileSpec({ spec: stdin4 ? "-" : String(file8) });
94539
+ const markdownValueRaw = typeof markdown2 === "string" ? markdown2 : yield* fileInput.readTextFromFileSpec({ spec: stdin5 ? "-" : String(file8) });
94176
94540
  const markdownValue = dropBlankLinesOutsideFences(trimBoundaryBlankLines(markdownValueRaw));
94177
94541
  const bulkMode = bulk3 ?? "auto";
94178
94542
  const bundleTitleValue = typeof bundleTitle3 === "string" ? bundleTitle3.trim() : "";
@@ -94414,17 +94778,17 @@ var opsSchemaCommand = exports_Command.make("schema", { type: text9("type") }, (
94414
94778
  var opsCommand = exports_Command.make("ops", {}).pipe(exports_Command.withSubcommands([opsListCommand, opsSchemaCommand]));
94415
94779
 
94416
94780
  // src/commands/apply.ts
94417
- function optionToUndefined15(opt) {
94781
+ function optionToUndefined16(opt) {
94418
94782
  return isSome2(opt) ? opt.value : undefined;
94419
94783
  }
94420
94784
  function readOptionalText3(name) {
94421
- return text9(name).pipe(optional5, map34(optionToUndefined15));
94785
+ return text9(name).pipe(optional5, map34(optionToUndefined16));
94422
94786
  }
94423
94787
  var payloadSpec = text9("payload");
94424
94788
  var metaSpec4 = readOptionalText3("meta");
94425
94789
  var clientId4 = readOptionalText3("client-id");
94426
94790
  var idempotencyKey4 = readOptionalText3("idempotency-key");
94427
- var priority4 = integer7("priority").pipe(optional5, map34(optionToUndefined15));
94791
+ var priority4 = integer7("priority").pipe(optional5, map34(optionToUndefined16));
94428
94792
  var notify4 = boolean8("no-notify").pipe(map34((v) => !v));
94429
94793
  var ensureDaemon5 = boolean8("no-ensure-daemon").pipe(map34((v) => !v));
94430
94794
  var applyCommand = exports_Command.make("apply", {
@@ -94841,14 +95205,14 @@ function ensureApiDaemon(params3) {
94841
95205
  }
94842
95206
 
94843
95207
  // src/commands/api/ensure.ts
94844
- function optionToUndefined16(opt) {
95208
+ function optionToUndefined17(opt) {
94845
95209
  return isSome2(opt) ? opt.value : undefined;
94846
95210
  }
94847
- var host = text9("host").pipe(optional5, map34(optionToUndefined16));
94848
- var port3 = integer7("port").pipe(optional5, map34(optionToUndefined16));
94849
- var pidFile8 = text9("pid-file").pipe(optional5, map34(optionToUndefined16));
94850
- var logFile5 = text9("log-file").pipe(optional5, map34(optionToUndefined16));
94851
- var stateFile3 = text9("state-file").pipe(optional5, map34(optionToUndefined16));
95211
+ var host = text9("host").pipe(optional5, map34(optionToUndefined17));
95212
+ var port3 = integer7("port").pipe(optional5, map34(optionToUndefined17));
95213
+ var pidFile8 = text9("pid-file").pipe(optional5, map34(optionToUndefined17));
95214
+ var logFile5 = text9("log-file").pipe(optional5, map34(optionToUndefined17));
95215
+ var stateFile3 = text9("state-file").pipe(optional5, map34(optionToUndefined17));
94852
95216
  var apiEnsureCommand = exports_Command.make("ensure", {
94853
95217
  host,
94854
95218
  port: port3,
@@ -94871,11 +95235,11 @@ var apiEnsureCommand = exports_Command.make("ensure", {
94871
95235
  }).pipe(catchAll2(writeFailure)));
94872
95236
 
94873
95237
  // src/commands/api/logs.ts
94874
- function optionToUndefined17(opt) {
95238
+ function optionToUndefined18(opt) {
94875
95239
  return isSome2(opt) ? opt.value : undefined;
94876
95240
  }
94877
- var pidFile9 = text9("pid-file").pipe(optional5, map34(optionToUndefined17));
94878
- var file8 = text9("file").pipe(optional5, map34(optionToUndefined17));
95241
+ var pidFile9 = text9("pid-file").pipe(optional5, map34(optionToUndefined18));
95242
+ var file8 = text9("file").pipe(optional5, map34(optionToUndefined18));
94879
95243
  var apiLogsCommand = exports_Command.make("logs", { pidFile: pidFile9, file: file8, lines: integer7("lines").pipe(withDefault5(200)), follow: boolean8("follow") }, ({ pidFile: pidFile10, file: file9, lines: lines3, follow }) => gen2(function* () {
94880
95244
  const cfg = yield* AppConfig;
94881
95245
  const apiFiles = yield* ApiDaemonFiles;
@@ -94928,14 +95292,14 @@ var apiLogsCommand = exports_Command.make("logs", { pidFile: pidFile9, file: fil
94928
95292
  }).pipe(catchAll2(writeFailure)));
94929
95293
 
94930
95294
  // src/commands/api/restart.ts
94931
- function optionToUndefined18(opt) {
95295
+ function optionToUndefined19(opt) {
94932
95296
  return isSome2(opt) ? opt.value : undefined;
94933
95297
  }
94934
- var host2 = text9("host").pipe(optional5, map34(optionToUndefined18));
94935
- var port4 = integer7("port").pipe(optional5, map34(optionToUndefined18));
94936
- var pidFile10 = text9("pid-file").pipe(optional5, map34(optionToUndefined18));
94937
- var logFile6 = text9("log-file").pipe(optional5, map34(optionToUndefined18));
94938
- var stateFile4 = text9("state-file").pipe(optional5, map34(optionToUndefined18));
95298
+ var host2 = text9("host").pipe(optional5, map34(optionToUndefined19));
95299
+ var port4 = integer7("port").pipe(optional5, map34(optionToUndefined19));
95300
+ var pidFile10 = text9("pid-file").pipe(optional5, map34(optionToUndefined19));
95301
+ var logFile6 = text9("log-file").pipe(optional5, map34(optionToUndefined19));
95302
+ var stateFile4 = text9("state-file").pipe(optional5, map34(optionToUndefined19));
94939
95303
  var apiRestartCommand = exports_Command.make("restart", {
94940
95304
  force: boolean8("force"),
94941
95305
  host: host2,
@@ -95832,11 +96196,12 @@ function runHttpApiRuntime(params3) {
95832
96196
  const refs = yield* RefResolver;
95833
96197
  const hostApi = yield* HostApiClient;
95834
96198
  const remDb = yield* RemDb;
96199
+ const statusLine = yield* StatusLineController;
95835
96200
  const host3 = params3?.host ?? cfg.apiHost ?? "0.0.0.0";
95836
96201
  const configuredPort = params3?.port ?? cfg.apiPort ?? 3000;
95837
96202
  const stateFilePath = params3?.stateFile ?? cfg.apiStateFile ?? apiFiles.defaultStateFile();
95838
96203
  const startedAt = Date.now();
95839
- const provide6 = (effect4) => effect4.pipe(provideService2(AppConfig, cfg), provideService2(ApiDaemonFiles, apiFiles), provideService2(WsClient, ws), provideService2(Queue, queue), provideService2(Payload, payload), provideService2(RefResolver, refs), provideService2(HostApiClient, hostApi), provideService2(RemDb, remDb));
96204
+ const provide6 = (effect4) => effect4.pipe(provideService2(AppConfig, cfg), provideService2(ApiDaemonFiles, apiFiles), provideService2(WsClient, ws), provideService2(Queue, queue), provideService2(Payload, payload), provideService2(RefResolver, refs), provideService2(HostApiClient, hostApi), provideService2(RemDb, remDb), provideService2(StatusLineController, statusLine));
95840
96205
  const server = createServer((req, res) => {
95841
96206
  const url2 = new URL(req.url || "/", `http://${req.headers.host || "localhost"}`);
95842
96207
  const method = req.method || "GET";
@@ -96180,23 +96545,23 @@ function runHttpApiRuntime(params3) {
96180
96545
  }
96181
96546
 
96182
96547
  // src/commands/api/serve.ts
96183
- function optionToUndefined19(opt) {
96548
+ function optionToUndefined20(opt) {
96184
96549
  return isSome2(opt) ? opt.value : undefined;
96185
96550
  }
96186
- var host3 = text9("host").pipe(optional5, map34(optionToUndefined19));
96187
- var port5 = integer7("port").pipe(optional5, map34(optionToUndefined19));
96188
- var stateFile5 = text9("state-file").pipe(optional5, map34(optionToUndefined19));
96551
+ var host3 = text9("host").pipe(optional5, map34(optionToUndefined20));
96552
+ var port5 = integer7("port").pipe(optional5, map34(optionToUndefined20));
96553
+ var stateFile5 = text9("state-file").pipe(optional5, map34(optionToUndefined20));
96189
96554
  var apiServeCommand = exports_Command.make("serve", { host: host3, port: port5, stateFile: stateFile5 }, ({ host: host4, port: port6, stateFile: stateFile6 }) => runHttpApiRuntime({ host: host4, port: port6, stateFile: stateFile6 }).pipe(catchAll2(writeFailure)));
96190
96555
 
96191
96556
  // src/commands/api/start.ts
96192
- function optionToUndefined20(opt) {
96557
+ function optionToUndefined21(opt) {
96193
96558
  return isSome2(opt) ? opt.value : undefined;
96194
96559
  }
96195
- var host4 = text9("host").pipe(optional5, map34(optionToUndefined20));
96196
- var port6 = integer7("port").pipe(optional5, map34(optionToUndefined20));
96197
- var pidFile11 = text9("pid-file").pipe(optional5, map34(optionToUndefined20));
96198
- var logFile7 = text9("log-file").pipe(optional5, map34(optionToUndefined20));
96199
- var stateFile6 = text9("state-file").pipe(optional5, map34(optionToUndefined20));
96560
+ var host4 = text9("host").pipe(optional5, map34(optionToUndefined21));
96561
+ var port6 = integer7("port").pipe(optional5, map34(optionToUndefined21));
96562
+ var pidFile11 = text9("pid-file").pipe(optional5, map34(optionToUndefined21));
96563
+ var logFile7 = text9("log-file").pipe(optional5, map34(optionToUndefined21));
96564
+ var stateFile6 = text9("state-file").pipe(optional5, map34(optionToUndefined21));
96200
96565
  var apiStartCommand = exports_Command.make("start", {
96201
96566
  host: host4,
96202
96567
  port: port6,
@@ -96219,11 +96584,11 @@ var apiStartCommand = exports_Command.make("start", {
96219
96584
  }).pipe(catchAll2(writeFailure)));
96220
96585
 
96221
96586
  // src/commands/api/status.ts
96222
- function optionToUndefined21(opt) {
96587
+ function optionToUndefined22(opt) {
96223
96588
  return isSome2(opt) ? opt.value : undefined;
96224
96589
  }
96225
- var pidFile12 = text9("pid-file").pipe(optional5, map34(optionToUndefined21));
96226
- var stateFile7 = text9("state-file").pipe(optional5, map34(optionToUndefined21));
96590
+ var pidFile12 = text9("pid-file").pipe(optional5, map34(optionToUndefined22));
96591
+ var stateFile7 = text9("state-file").pipe(optional5, map34(optionToUndefined22));
96227
96592
  var apiStatusCommand = exports_Command.make("status", { pidFile: pidFile12, stateFile: stateFile7 }, ({ pidFile: pidFile13, stateFile: stateFile8 }) => gen2(function* () {
96228
96593
  const cfg = yield* AppConfig;
96229
96594
  const apiFiles = yield* ApiDaemonFiles;
@@ -96271,11 +96636,11 @@ var apiStatusCommand = exports_Command.make("status", { pidFile: pidFile12, stat
96271
96636
  }).pipe(catchAll2(writeFailure)));
96272
96637
 
96273
96638
  // src/commands/api/stop.ts
96274
- function optionToUndefined22(opt) {
96639
+ function optionToUndefined23(opt) {
96275
96640
  return isSome2(opt) ? opt.value : undefined;
96276
96641
  }
96277
- var pidFile13 = text9("pid-file").pipe(optional5, map34(optionToUndefined22));
96278
- var stateFile8 = text9("state-file").pipe(optional5, map34(optionToUndefined22));
96642
+ var pidFile13 = text9("pid-file").pipe(optional5, map34(optionToUndefined23));
96643
+ var stateFile8 = text9("state-file").pipe(optional5, map34(optionToUndefined23));
96279
96644
  var apiStopCommand = exports_Command.make("stop", { force: boolean8("force"), pidFile: pidFile13, stateFile: stateFile8 }, ({ force, pidFile: pidFile14, stateFile: stateFile9 }) => gen2(function* () {
96280
96645
  const apiFiles = yield* ApiDaemonFiles;
96281
96646
  const proc = yield* Process;
@@ -96436,14 +96801,14 @@ var ACTIONS = {
96436
96801
  aliasRefAllowlist: ["parent_id"],
96437
96802
  compile: ({ input }) => {
96438
96803
  const parent_id = input.parent_id;
96439
- const markdown = input.markdown;
96804
+ const markdown2 = input.markdown;
96440
96805
  if (typeof parent_id !== "string" || !parent_id.trim()) {
96441
96806
  throw new Error("write.md requires input.parent_id");
96442
96807
  }
96443
- if (typeof markdown !== "string") {
96808
+ if (typeof markdown2 !== "string") {
96444
96809
  throw new Error("write.md requires input.markdown");
96445
96810
  }
96446
- const payload = { parent_id, markdown };
96811
+ const payload = { parent_id, markdown: markdown2 };
96447
96812
  if (typeof input.indent_mode === "boolean")
96448
96813
  payload.indent_mode = input.indent_mode;
96449
96814
  if (typeof input.indent_size === "number")
@@ -96465,14 +96830,14 @@ var ACTIONS = {
96465
96830
  aliasRefAllowlist: ["parent_id"],
96466
96831
  compile: ({ input, aliasTempId }) => {
96467
96832
  const parent_id = input.parent_id;
96468
- const markdown = input.markdown;
96833
+ const markdown2 = input.markdown;
96469
96834
  if (typeof parent_id !== "string" || !parent_id.trim()) {
96470
96835
  throw new Error("write.md.single requires input.parent_id");
96471
96836
  }
96472
- if (typeof markdown !== "string") {
96837
+ if (typeof markdown2 !== "string") {
96473
96838
  throw new Error("write.md.single requires input.markdown");
96474
96839
  }
96475
- const payload = { parent_id, markdown };
96840
+ const payload = { parent_id, markdown: markdown2 };
96476
96841
  if (aliasTempId)
96477
96842
  payload.client_temp_id = aliasTempId;
96478
96843
  return { ops: [{ type: "create_single_rem_with_markdown", payload }] };
@@ -96533,8 +96898,8 @@ var ACTIONS = {
96533
96898
  supportsAs: false,
96534
96899
  aliasRefAllowlist: ["target.rem_ids[]", "portal_id"],
96535
96900
  compile: ({ input }) => {
96536
- const markdown = input.markdown;
96537
- if (typeof markdown !== "string") {
96901
+ const markdown2 = input.markdown;
96902
+ if (typeof markdown2 !== "string") {
96538
96903
  throw new Error("replace.block requires input.markdown");
96539
96904
  }
96540
96905
  const target2 = getObject(input.target);
@@ -96547,7 +96912,7 @@ var ACTIONS = {
96547
96912
  throw new Error("replace.block requires input.target.rem_ids[]");
96548
96913
  }
96549
96914
  const payload = {
96550
- markdown,
96915
+ markdown: markdown2,
96551
96916
  target: { mode: "explicit", rem_ids: remIdsRaw }
96552
96917
  };
96553
96918
  if (typeof input.require_same_parent === "boolean")
@@ -96707,22 +97072,22 @@ function makeTempId() {
96707
97072
  }
96708
97073
 
96709
97074
  // src/commands/_writePlanCommand.ts
96710
- function optionToUndefined23(opt) {
97075
+ function optionToUndefined24(opt) {
96711
97076
  return isSome2(opt) ? opt.value : undefined;
96712
97077
  }
96713
97078
  function readOptionalText4(name) {
96714
- return text9(name).pipe(optional5, map34(optionToUndefined23));
97079
+ return text9(name).pipe(optional5, map34(optionToUndefined24));
96715
97080
  }
96716
97081
  var payload = text9("payload");
96717
97082
  var clientId5 = readOptionalText4("client-id");
96718
97083
  var idempotencyKey5 = readOptionalText4("idempotency-key");
96719
97084
  var metaSpec5 = readOptionalText4("meta");
96720
- var priority5 = integer7("priority").pipe(optional5, map34(optionToUndefined23));
97085
+ var priority5 = integer7("priority").pipe(optional5, map34(optionToUndefined24));
96721
97086
  var notify5 = boolean8("no-notify").pipe(map34((v) => !v));
96722
97087
  var ensureDaemon6 = boolean8("no-ensure-daemon").pipe(map34((v) => !v));
96723
97088
  var wait3 = boolean8("wait");
96724
- var timeoutMs3 = integer7("timeout-ms").pipe(optional5, map34(optionToUndefined23));
96725
- var pollMs3 = integer7("poll-ms").pipe(optional5, map34(optionToUndefined23));
97089
+ var timeoutMs3 = integer7("timeout-ms").pipe(optional5, map34(optionToUndefined24));
97090
+ var pollMs3 = integer7("poll-ms").pipe(optional5, map34(optionToUndefined24));
96726
97091
  function makeWritePlanCommand(config3) {
96727
97092
  return exports_Command.make(config3.commandName, {
96728
97093
  payload,
@@ -96867,11 +97232,11 @@ var planApplyCommand = makeWritePlanCommand({
96867
97232
  var planCommand = exports_Command.make("plan", {}).pipe(exports_Command.withSubcommands([planApplyCommand]));
96868
97233
 
96869
97234
  // src/commands/read/selection/current.ts
96870
- function optionToUndefined24(opt) {
97235
+ function optionToUndefined25(opt) {
96871
97236
  return isSome2(opt) ? opt.value : undefined;
96872
97237
  }
96873
- var stateFile9 = text9("state-file").pipe(optional5, map34(optionToUndefined24));
96874
- var staleMs2 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined24));
97238
+ var stateFile9 = text9("state-file").pipe(optional5, map34(optionToUndefined25));
97239
+ var staleMs2 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined25));
96875
97240
  function toCompact(data) {
96876
97241
  return {
96877
97242
  selection_kind: data?.selection_kind ?? "",
@@ -96917,11 +97282,11 @@ var readSelectionCurrentCommand = exports_Command.make("current", { stateFile: s
96917
97282
  }).pipe(catchAll2(writeFailure)));
96918
97283
 
96919
97284
  // src/commands/read/selection/outline.ts
96920
- function optionToUndefined25(opt) {
97285
+ function optionToUndefined26(opt) {
96921
97286
  return isSome2(opt) ? opt.value : undefined;
96922
97287
  }
96923
- var stateFile10 = text9("state-file").pipe(optional5, map34(optionToUndefined25));
96924
- var staleMs3 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined25));
97288
+ var stateFile10 = text9("state-file").pipe(optional5, map34(optionToUndefined26));
97289
+ var staleMs3 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined26));
96925
97290
  var maxDepth2 = integer7("max-depth").pipe(withDefault5(10));
96926
97291
  var maxNodes = integer7("max-nodes").pipe(withDefault5(1000));
96927
97292
  var readSelectionOutlineCommand = exports_Command.make("outline", {
@@ -96932,7 +97297,7 @@ var readSelectionOutlineCommand = exports_Command.make("outline", {
96932
97297
  excludeProperties: boolean8("exclude-properties"),
96933
97298
  includeEmpty: boolean8("include-empty"),
96934
97299
  expandReferences: boolean8("expand-references"),
96935
- maxReferenceDepth: integer7("max-reference-depth").pipe(optional5, map34(optionToUndefined25)),
97300
+ maxReferenceDepth: integer7("max-reference-depth").pipe(optional5, map34(optionToUndefined26)),
96936
97301
  detail: boolean8("detail")
96937
97302
  }, ({
96938
97303
  stateFile: stateFile11,
@@ -97075,11 +97440,11 @@ var readSelectionOutlineCommand = exports_Command.make("outline", {
97075
97440
  }).pipe(catchAll2(writeFailure)));
97076
97441
 
97077
97442
  // src/commands/read/selection/roots.ts
97078
- function optionToUndefined26(opt) {
97443
+ function optionToUndefined27(opt) {
97079
97444
  return isSome2(opt) ? opt.value : undefined;
97080
97445
  }
97081
- var stateFile11 = text9("state-file").pipe(optional5, map34(optionToUndefined26));
97082
- var staleMs4 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined26));
97446
+ var stateFile11 = text9("state-file").pipe(optional5, map34(optionToUndefined27));
97447
+ var staleMs4 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined27));
97083
97448
  var readSelectionRootsCommand = exports_Command.make("roots", { stateFile: stateFile11, staleMs: staleMs4 }, ({ stateFile: stateFile12, staleMs: staleMs5 }) => gen2(function* () {
97084
97449
  const cfg = yield* AppConfig;
97085
97450
  const hostApi = yield* HostApiClient;
@@ -97116,11 +97481,11 @@ var readSelectionRootsCommand = exports_Command.make("roots", { stateFile: state
97116
97481
  }).pipe(catchAll2(writeFailure)));
97117
97482
 
97118
97483
  // src/commands/read/selection/snapshot.ts
97119
- function optionToUndefined27(opt) {
97484
+ function optionToUndefined28(opt) {
97120
97485
  return isSome2(opt) ? opt.value : undefined;
97121
97486
  }
97122
- var stateFile12 = text9("state-file").pipe(optional5, map34(optionToUndefined27));
97123
- var staleMs5 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined27));
97487
+ var stateFile12 = text9("state-file").pipe(optional5, map34(optionToUndefined28));
97488
+ var staleMs5 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined28));
97124
97489
  var readSelectionSnapshotCommand = exports_Command.make("snapshot", { stateFile: stateFile12, staleMs: staleMs5 }, ({ stateFile: stateFile13, staleMs: staleMs6 }) => gen2(function* () {
97125
97490
  const cfg = yield* AppConfig;
97126
97491
  const hostApi = yield* HostApiClient;
@@ -97167,11 +97532,11 @@ var readSelectionSnapshotCommand = exports_Command.make("snapshot", { stateFile:
97167
97532
  var readSelectionCommand = exports_Command.make("selection", {}).pipe(exports_Command.withSubcommands([readSelectionSnapshotCommand, readSelectionRootsCommand, readSelectionCurrentCommand, readSelectionOutlineCommand]));
97168
97533
 
97169
97534
  // src/commands/read/uiContext/describe.ts
97170
- function optionToUndefined28(opt) {
97535
+ function optionToUndefined29(opt) {
97171
97536
  return isSome2(opt) ? opt.value : undefined;
97172
97537
  }
97173
- var stateFile13 = text9("state-file").pipe(optional5, map34(optionToUndefined28));
97174
- var staleMs6 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined28));
97538
+ var stateFile13 = text9("state-file").pipe(optional5, map34(optionToUndefined29));
97539
+ var staleMs6 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined29));
97175
97540
  var selectionLimit = integer7("selection-limit").pipe(withDefault5(5));
97176
97541
  function normalizeText2(value8) {
97177
97542
  return typeof value8 === "string" ? value8.trim() : "";
@@ -97432,11 +97797,11 @@ var readUiContextDescribeCommand = exports_Command.make("describe", { stateFile:
97432
97797
  }).pipe(catchAll2(writeFailure)));
97433
97798
 
97434
97799
  // src/commands/read/uiContext/focused-rem.ts
97435
- function optionToUndefined29(opt) {
97800
+ function optionToUndefined30(opt) {
97436
97801
  return isSome2(opt) ? opt.value : undefined;
97437
97802
  }
97438
- var stateFile14 = text9("state-file").pipe(optional5, map34(optionToUndefined29));
97439
- var staleMs7 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined29));
97803
+ var stateFile14 = text9("state-file").pipe(optional5, map34(optionToUndefined30));
97804
+ var staleMs7 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined30));
97440
97805
  var readUiContextFocusedRemCommand = exports_Command.make("focused-rem", { stateFile: stateFile14, staleMs: staleMs7 }, ({ stateFile: stateFile15, staleMs: staleMs8 }) => gen2(function* () {
97441
97806
  const cfg = yield* AppConfig;
97442
97807
  const hostApi = yield* HostApiClient;
@@ -97464,11 +97829,11 @@ var readUiContextFocusedRemCommand = exports_Command.make("focused-rem", { state
97464
97829
  }).pipe(catchAll2(writeFailure)));
97465
97830
 
97466
97831
  // src/commands/read/uiContext/page.ts
97467
- function optionToUndefined30(opt) {
97832
+ function optionToUndefined31(opt) {
97468
97833
  return isSome2(opt) ? opt.value : undefined;
97469
97834
  }
97470
- var stateFile15 = text9("state-file").pipe(optional5, map34(optionToUndefined30));
97471
- var staleMs8 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined30));
97835
+ var stateFile15 = text9("state-file").pipe(optional5, map34(optionToUndefined31));
97836
+ var staleMs8 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined31));
97472
97837
  var readUiContextPageCommand = exports_Command.make("page", { stateFile: stateFile15, staleMs: staleMs8 }, ({ stateFile: stateFile16, staleMs: staleMs9 }) => gen2(function* () {
97473
97838
  const cfg = yield* AppConfig;
97474
97839
  const hostApi = yield* HostApiClient;
@@ -97496,11 +97861,11 @@ var readUiContextPageCommand = exports_Command.make("page", { stateFile: stateFi
97496
97861
  }).pipe(catchAll2(writeFailure)));
97497
97862
 
97498
97863
  // src/commands/read/uiContext/snapshot.ts
97499
- function optionToUndefined31(opt) {
97864
+ function optionToUndefined32(opt) {
97500
97865
  return isSome2(opt) ? opt.value : undefined;
97501
97866
  }
97502
- var stateFile16 = text9("state-file").pipe(optional5, map34(optionToUndefined31));
97503
- var staleMs9 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined31));
97867
+ var stateFile16 = text9("state-file").pipe(optional5, map34(optionToUndefined32));
97868
+ var staleMs9 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined32));
97504
97869
  var readUiContextSnapshotCommand = exports_Command.make("snapshot", { stateFile: stateFile16, staleMs: staleMs9 }, ({ stateFile: stateFile17, staleMs: staleMs10 }) => gen2(function* () {
97505
97870
  const cfg = yield* AppConfig;
97506
97871
  const hostApi = yield* HostApiClient;
@@ -97534,11 +97899,11 @@ var readUiContextCommand = exports_Command.make("ui-context", {}).pipe(exports_C
97534
97899
  ]));
97535
97900
 
97536
97901
  // src/commands/plugin/current.ts
97537
- function optionToUndefined32(opt) {
97902
+ function optionToUndefined33(opt) {
97538
97903
  return isSome2(opt) ? opt.value : undefined;
97539
97904
  }
97540
- var stateFile17 = text9("state-file").pipe(optional5, map34(optionToUndefined32));
97541
- var staleMs10 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined32));
97905
+ var stateFile17 = text9("state-file").pipe(optional5, map34(optionToUndefined33));
97906
+ var staleMs10 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined33));
97542
97907
  var selectionLimit2 = integer7("selection-limit").pipe(withDefault5(5));
97543
97908
  function toCompact2(data) {
97544
97909
  return {
@@ -97585,10 +97950,10 @@ var pluginCurrentCommand = exports_Command.make("current", { stateFile: stateFil
97585
97950
  }).pipe(catchAll2(writeFailure)));
97586
97951
 
97587
97952
  // src/commands/plugin/search.ts
97588
- function optionToUndefined33(opt) {
97953
+ function optionToUndefined34(opt) {
97589
97954
  return isSome2(opt) ? opt.value : undefined;
97590
97955
  }
97591
- var searchContextRemId = text9("context-rem-id").pipe(optional5, map34(optionToUndefined33));
97956
+ var searchContextRemId = text9("context-rem-id").pipe(optional5, map34(optionToUndefined34));
97592
97957
  var limit2 = integer7("limit").pipe(withDefault5(20));
97593
97958
  var timeoutMs4 = integer7("timeout-ms").pipe(withDefault5(3000));
97594
97959
  var ensureDaemon7 = boolean8("no-ensure-daemon").pipe(map34((v) => !v));
@@ -97644,10 +98009,10 @@ var pluginSearchCommand = exports_Command.make("search", { query: text9("query")
97644
98009
  var pluginCommand = exports_Command.make("plugin", {}).pipe(exports_Command.withSubcommands([pluginCurrentCommand, pluginSearchCommand, readUiContextCommand, readSelectionCommand]));
97645
98010
 
97646
98011
  // src/commands/read/powerup/list.ts
97647
- function optionToUndefined34(opt) {
98012
+ function optionToUndefined35(opt) {
97648
98013
  return isSome2(opt) ? opt.value : undefined;
97649
98014
  }
97650
- var query = text9("query").pipe(optional5, map34(optionToUndefined34));
98015
+ var query = text9("query").pipe(optional5, map34(optionToUndefined35));
97651
98016
  var limit3 = integer7("limit").pipe(withDefault5(50));
97652
98017
  var offset = integer7("offset").pipe(withDefault5(0));
97653
98018
  function safeJsonParse3(input) {
@@ -98002,11 +98367,11 @@ var readPowerupResolveCommand = exports_Command.make("resolve", { powerup: text9
98002
98367
  })), catchAll2(writeFailure)));
98003
98368
 
98004
98369
  // src/commands/read/powerup/schema.ts
98005
- function optionToUndefined35(opt) {
98370
+ function optionToUndefined36(opt) {
98006
98371
  return isSome2(opt) ? opt.value : undefined;
98007
98372
  }
98008
- var powerup = text9("powerup").pipe(optional5, map34(optionToUndefined35));
98009
- var id2 = text9("id").pipe(optional5, map34(optionToUndefined35));
98373
+ var powerup = text9("powerup").pipe(optional5, map34(optionToUndefined36));
98374
+ var id2 = text9("id").pipe(optional5, map34(optionToUndefined36));
98010
98375
  var limit4 = integer7("limit").pipe(withDefault5(50));
98011
98376
  var offset2 = integer7("offset").pipe(withDefault5(0));
98012
98377
  var readPowerupSchemaCommand = exports_Command.make("schema", { powerup, id: id2, includeOptions: boolean8("include-options"), limit: limit4, offset: offset2 }, ({ powerup: powerup2, id: id3, includeOptions, limit: limit5, offset: offset3 }) => gen2(function* () {
@@ -98283,33 +98648,33 @@ function compileTableValueOps(params3) {
98283
98648
  }
98284
98649
 
98285
98650
  // src/commands/write/_shared.ts
98286
- function optionToUndefined36(opt) {
98651
+ function optionToUndefined37(opt) {
98287
98652
  return isSome2(opt) ? opt.value : undefined;
98288
98653
  }
98289
98654
  function readOptionalText5(name) {
98290
- return text9(name).pipe(optional5, map34(optionToUndefined36));
98655
+ return text9(name).pipe(optional5, map34(optionToUndefined37));
98291
98656
  }
98292
98657
  var writeCommonOptions = {
98293
98658
  notify: boolean8("no-notify").pipe(map34((v) => !v)),
98294
98659
  ensureDaemon: boolean8("no-ensure-daemon").pipe(map34((v) => !v)),
98295
98660
  wait: boolean8("wait"),
98296
- timeoutMs: integer7("timeout-ms").pipe(optional5, map34(optionToUndefined36)),
98297
- pollMs: integer7("poll-ms").pipe(optional5, map34(optionToUndefined36)),
98661
+ timeoutMs: integer7("timeout-ms").pipe(optional5, map34(optionToUndefined37)),
98662
+ pollMs: integer7("poll-ms").pipe(optional5, map34(optionToUndefined37)),
98298
98663
  dryRun: boolean8("dry-run"),
98299
- priority: integer7("priority").pipe(optional5, map34(optionToUndefined36)),
98664
+ priority: integer7("priority").pipe(optional5, map34(optionToUndefined37)),
98300
98665
  clientId: readOptionalText5("client-id"),
98301
98666
  idempotencyKey: readOptionalText5("idempotency-key"),
98302
98667
  meta: readOptionalText5("meta")
98303
98668
  };
98304
98669
 
98305
98670
  // src/commands/write/powerup/apply.ts
98306
- var dispatchMode = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(optionToUndefined36));
98671
+ var dispatchMode = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(optionToUndefined37));
98307
98672
  var writePowerupApplyCommand = exports_Command.make("apply", {
98308
98673
  rem: text9("rem"),
98309
- tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined36)),
98310
- powerup: text9("powerup").pipe(optional5, map34(optionToUndefined36)),
98311
- text: text9("text").pipe(optional5, map34(optionToUndefined36)),
98312
- values: text9("values").pipe(optional5, map34(optionToUndefined36)),
98674
+ tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined37)),
98675
+ powerup: text9("powerup").pipe(optional5, map34(optionToUndefined37)),
98676
+ text: text9("text").pipe(optional5, map34(optionToUndefined37)),
98677
+ values: text9("values").pipe(optional5, map34(optionToUndefined37)),
98313
98678
  ensureTag: boolean8("no-ensure-tag").pipe(map34((v) => !v)),
98314
98679
  notify: writeCommonOptions.notify,
98315
98680
  ensureDaemon: writeCommonOptions.ensureDaemon,
@@ -98670,11 +99035,11 @@ var writePowerupOptionCommand = exports_Command.make("option", {}).pipe(exports_
98670
99035
 
98671
99036
  // src/commands/write/powerup/property/add.ts
98672
99037
  var writePowerupPropertyAddCommand = exports_Command.make("add", {
98673
- tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined36)),
98674
- powerup: text9("powerup").pipe(optional5, map34(optionToUndefined36)),
99038
+ tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined37)),
99039
+ powerup: text9("powerup").pipe(optional5, map34(optionToUndefined37)),
98675
99040
  name: text9("name"),
98676
- type: text9("type").pipe(optional5, map34(optionToUndefined36)),
98677
- options: text9("options").pipe(optional5, map34(optionToUndefined36)),
99041
+ type: text9("type").pipe(optional5, map34(optionToUndefined37)),
99042
+ options: text9("options").pipe(optional5, map34(optionToUndefined37)),
98678
99043
  notify: writeCommonOptions.notify,
98679
99044
  ensureDaemon: writeCommonOptions.ensureDaemon,
98680
99045
  wait: writeCommonOptions.wait,
@@ -98903,14 +99268,14 @@ var writePowerupPropertySetTypeCommand = exports_Command.make("set-type", {
98903
99268
  var writePowerupPropertyCommand = exports_Command.make("property", {}).pipe(exports_Command.withSubcommands([writePowerupPropertyAddCommand, writePowerupPropertySetTypeCommand]));
98904
99269
 
98905
99270
  // src/commands/write/powerup/record/add.ts
98906
- var dispatchMode2 = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(optionToUndefined36));
99271
+ var dispatchMode2 = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(optionToUndefined37));
98907
99272
  var writePowerupRecordAddCommand = exports_Command.make("add", {
98908
- tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined36)),
98909
- powerup: text9("powerup").pipe(optional5, map34(optionToUndefined36)),
98910
- parent: text9("parent").pipe(optional5, map34(optionToUndefined36)),
98911
- ref: text9("ref").pipe(optional5, map34(optionToUndefined36)),
98912
- text: text9("text").pipe(optional5, map34(optionToUndefined36)),
98913
- values: text9("values").pipe(optional5, map34(optionToUndefined36)),
99273
+ tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined37)),
99274
+ powerup: text9("powerup").pipe(optional5, map34(optionToUndefined37)),
99275
+ parent: text9("parent").pipe(optional5, map34(optionToUndefined37)),
99276
+ ref: text9("ref").pipe(optional5, map34(optionToUndefined37)),
99277
+ text: text9("text").pipe(optional5, map34(optionToUndefined37)),
99278
+ values: text9("values").pipe(optional5, map34(optionToUndefined37)),
98914
99279
  extraTag: text9("extra-tag").pipe(repeated5),
98915
99280
  notify: writeCommonOptions.notify,
98916
99281
  ensureDaemon: writeCommonOptions.ensureDaemon,
@@ -99124,8 +99489,8 @@ function rowHasTag(doc, tagId) {
99124
99489
  return Object.prototype.hasOwnProperty.call(tp, tagId);
99125
99490
  }
99126
99491
  var writePowerupRecordDeleteCommand = exports_Command.make("delete", {
99127
- tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined36)),
99128
- powerup: text9("powerup").pipe(optional5, map34(optionToUndefined36)),
99492
+ tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined37)),
99493
+ powerup: text9("powerup").pipe(optional5, map34(optionToUndefined37)),
99129
99494
  rem: text9("rem"),
99130
99495
  validateMembership: boolean8("no-validate-membership").pipe(map34((v) => !v)),
99131
99496
  notify: writeCommonOptions.notify,
@@ -99270,7 +99635,7 @@ var writePowerupRecordDeleteCommand = exports_Command.make("delete", {
99270
99635
  }).pipe(catchAll2(writeFailure)));
99271
99636
 
99272
99637
  // src/commands/write/powerup/record/update.ts
99273
- var dispatchMode3 = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(optionToUndefined36));
99638
+ var dispatchMode3 = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(optionToUndefined37));
99274
99639
  function rowHasTag2(doc, tagId) {
99275
99640
  const tp = doc?.tp;
99276
99641
  if (!tp || typeof tp !== "object" || Array.isArray(tp))
@@ -99278,11 +99643,11 @@ function rowHasTag2(doc, tagId) {
99278
99643
  return Object.prototype.hasOwnProperty.call(tp, tagId);
99279
99644
  }
99280
99645
  var writePowerupRecordUpdateCommand = exports_Command.make("update", {
99281
- tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined36)),
99282
- powerup: text9("powerup").pipe(optional5, map34(optionToUndefined36)),
99646
+ tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined37)),
99647
+ powerup: text9("powerup").pipe(optional5, map34(optionToUndefined37)),
99283
99648
  rem: text9("rem"),
99284
- text: text9("text").pipe(optional5, map34(optionToUndefined36)),
99285
- values: text9("values").pipe(optional5, map34(optionToUndefined36)),
99649
+ text: text9("text").pipe(optional5, map34(optionToUndefined37)),
99650
+ values: text9("values").pipe(optional5, map34(optionToUndefined37)),
99286
99651
  validateMembership: boolean8("no-validate-membership").pipe(map34((v) => !v)),
99287
99652
  notify: writeCommonOptions.notify,
99288
99653
  ensureDaemon: writeCommonOptions.ensureDaemon,
@@ -99499,9 +99864,9 @@ var writePowerupRecordCommand = exports_Command.make("record", {}).pipe(exports_
99499
99864
  // src/commands/write/powerup/remove.ts
99500
99865
  var writePowerupRemoveCommand = exports_Command.make("remove", {
99501
99866
  rem: text9("rem"),
99502
- tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined36)),
99503
- powerup: text9("powerup").pipe(optional5, map34(optionToUndefined36)),
99504
- removeProperties: boolean8("remove-properties").pipe(optional5, map34(optionToUndefined36)),
99867
+ tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined37)),
99868
+ powerup: text9("powerup").pipe(optional5, map34(optionToUndefined37)),
99869
+ removeProperties: boolean8("remove-properties").pipe(optional5, map34(optionToUndefined37)),
99505
99870
  notify: writeCommonOptions.notify,
99506
99871
  ensureDaemon: writeCommonOptions.ensureDaemon,
99507
99872
  wait: writeCommonOptions.wait,
@@ -99636,7 +100001,7 @@ var powerupCommand = exports_Command.make("powerup", {}).pipe(exports_Command.wi
99636
100001
  ]));
99637
100002
 
99638
100003
  // src/commands/read/query.ts
99639
- function optionToUndefined37(opt) {
100004
+ function optionToUndefined38(opt) {
99640
100005
  return isSome2(opt) ? opt.value : undefined;
99641
100006
  }
99642
100007
  function buildMarkdown3(items, total) {
@@ -99651,14 +100016,14 @@ function buildMarkdown3(items, total) {
99651
100016
  return lines3.join(`
99652
100017
  `);
99653
100018
  }
99654
- var payload2 = text9("payload").pipe(optional5, map34(optionToUndefined37));
99655
- var text15 = text9("text").pipe(optional5, map34(optionToUndefined37));
100019
+ var payload2 = text9("payload").pipe(optional5, map34(optionToUndefined38));
100020
+ var text15 = text9("text").pipe(optional5, map34(optionToUndefined38));
99656
100021
  var tag7 = text9("tag").pipe(repeated5);
99657
100022
  var limit5 = integer7("limit").pipe(withDefault5(20));
99658
100023
  var offset3 = integer7("offset").pipe(withDefault5(0));
99659
100024
  var snippetLength = integer7("snippet-length").pipe(withDefault5(200));
99660
- var sort2 = choice5("sort", ["rank", "updatedAt", "createdAt"]).pipe(optional5, map34(optionToUndefined37));
99661
- var sortDirection = choice5("sort-direction", ["asc", "desc"]).pipe(optional5, map34(optionToUndefined37));
100025
+ var sort2 = choice5("sort", ["rank", "updatedAt", "createdAt"]).pipe(optional5, map34(optionToUndefined38));
100026
+ var sortDirection = choice5("sort-direction", ["asc", "desc"]).pipe(optional5, map34(optionToUndefined38));
99662
100027
  var readQueryCommand = exports_Command.make("query", { payload: payload2, text: text15, tag: tag7, limit: limit5, offset: offset3, snippetLength, sort: sort2, sortDirection }, ({ payload: payload3, text: text16, tag: tag8, limit: limit6, offset: offset4, snippetLength: snippetLength2, sort: sort3, sortDirection: sortDirection2 }) => gen2(function* () {
99663
100028
  const cfg = yield* AppConfig;
99664
100029
  const payloadSvc = yield* Payload;
@@ -99777,11 +100142,11 @@ var queueConflictsCommand = exports_Command.make("conflicts", {
99777
100142
  }).pipe(catchAll2(writeFailure)));
99778
100143
 
99779
100144
  // src/commands/queue/inspect.ts
99780
- function optionToUndefined38(opt) {
100145
+ function optionToUndefined39(opt) {
99781
100146
  return isSome2(opt) ? opt.value : undefined;
99782
100147
  }
99783
- var txn = text9("txn").pipe(optional5, map34(optionToUndefined38));
99784
- var op = text9("op").pipe(optional5, map34(optionToUndefined38));
100148
+ var txn = text9("txn").pipe(optional5, map34(optionToUndefined39));
100149
+ var op = text9("op").pipe(optional5, map34(optionToUndefined39));
99785
100150
  var queueInspectCommand = exports_Command.make("inspect", { txn, op }, ({ txn: txn2, op: op2 }) => gen2(function* () {
99786
100151
  const cfg = yield* AppConfig;
99787
100152
  const queue = yield* Queue;
@@ -99907,13 +100272,13 @@ var queueStatsCommand = exports_Command.make("stats", { includeConflicts: boolea
99907
100272
  }).pipe(catchAll2(writeFailure)));
99908
100273
 
99909
100274
  // src/commands/queue/wait.ts
99910
- function optionToUndefined39(opt) {
100275
+ function optionToUndefined40(opt) {
99911
100276
  return isSome2(opt) ? opt.value : undefined;
99912
100277
  }
99913
100278
  var queueWaitCommand = exports_Command.make("wait", {
99914
100279
  txn: text9("txn"),
99915
- timeoutMs: integer7("timeout-ms").pipe(optional5, map34(optionToUndefined39)),
99916
- pollMs: integer7("poll-ms").pipe(optional5, map34(optionToUndefined39))
100280
+ timeoutMs: integer7("timeout-ms").pipe(optional5, map34(optionToUndefined40)),
100281
+ pollMs: integer7("poll-ms").pipe(optional5, map34(optionToUndefined40))
99917
100282
  }, ({ txn: txn2, timeoutMs: timeoutMs5, pollMs: pollMs4 }) => gen2(function* () {
99918
100283
  const cfg = yield* AppConfig;
99919
100284
  const hostApi = yield* HostApiClient;
@@ -99946,12 +100311,12 @@ var queueCommand = exports_Command.make("queue", {}).pipe(exports_Command.withSu
99946
100311
  ]));
99947
100312
 
99948
100313
  // src/commands/read/by-reference.ts
99949
- function optionToUndefined40(opt) {
100314
+ function optionToUndefined41(opt) {
99950
100315
  return isSome2(opt) ? opt.value : undefined;
99951
100316
  }
99952
100317
  var reference = text9("reference").pipe(repeated5);
99953
- var timeRange = text9("time").pipe(optional5, map34(optionToUndefined40));
99954
- var maxDepth3 = integer7("max-depth").pipe(optional5, map34(optionToUndefined40));
100318
+ var timeRange = text9("time").pipe(optional5, map34(optionToUndefined41));
100319
+ var maxDepth3 = integer7("max-depth").pipe(optional5, map34(optionToUndefined41));
99955
100320
  var limit6 = integer7("limit").pipe(withDefault5(40));
99956
100321
  var offset4 = integer7("offset").pipe(withDefault5(0));
99957
100322
  var readByReferenceCommand = exports_Command.make("by-reference", { reference, timeRange, maxDepth: maxDepth3, limit: limit6, offset: offset4 }, ({ reference: reference2, timeRange: timeRange2, maxDepth: maxDepth4, limit: limit7, offset: offset5 }) => gen2(function* () {
@@ -99984,10 +100349,10 @@ var readConnectionsCommand = exports_Command.make("connections", { id: text9("id
99984
100349
  }).pipe(catchAll2(writeFailure)));
99985
100350
 
99986
100351
  // src/commands/read/inspect.ts
99987
- function optionToUndefined41(opt) {
100352
+ function optionToUndefined42(opt) {
99988
100353
  return isSome2(opt) ? opt.value : undefined;
99989
100354
  }
99990
- var maxReferenceDepth = integer7("max-reference-depth").pipe(optional5, map34(optionToUndefined41));
100355
+ var maxReferenceDepth = integer7("max-reference-depth").pipe(optional5, map34(optionToUndefined42));
99991
100356
  var readInspectCommand = exports_Command.make("inspect", {
99992
100357
  id: text9("id"),
99993
100358
  expandReferences: boolean8("expand-references"),
@@ -100015,15 +100380,15 @@ var readInspectCommand = exports_Command.make("inspect", {
100015
100380
  }).pipe(catchAll2(writeFailure)));
100016
100381
 
100017
100382
  // src/commands/read/outline.ts
100018
- function optionToUndefined42(opt) {
100383
+ function optionToUndefined43(opt) {
100019
100384
  return isSome2(opt) ? opt.value : undefined;
100020
100385
  }
100021
- var depth = integer7("depth").pipe(optional5, map34(optionToUndefined42));
100022
- var offset5 = integer7("offset").pipe(optional5, map34(optionToUndefined42));
100023
- var nodes = integer7("nodes").pipe(optional5, map34(optionToUndefined42));
100024
- var format9 = choice5("format", ["md", "json"]).pipe(optional5, map34(optionToUndefined42));
100025
- var id3 = text9("id").pipe(optional5, map34(optionToUndefined42));
100026
- var ref3 = text9("ref").pipe(optional5, map34(optionToUndefined42));
100386
+ var depth = integer7("depth").pipe(optional5, map34(optionToUndefined43));
100387
+ var offset5 = integer7("offset").pipe(optional5, map34(optionToUndefined43));
100388
+ var nodes = integer7("nodes").pipe(optional5, map34(optionToUndefined43));
100389
+ var format9 = choice5("format", ["md", "json"]).pipe(optional5, map34(optionToUndefined43));
100390
+ var id3 = text9("id").pipe(optional5, map34(optionToUndefined43));
100391
+ var ref3 = text9("ref").pipe(optional5, map34(optionToUndefined43));
100027
100392
  var readOutlineCommand = exports_Command.make("outline", {
100028
100393
  id: id3,
100029
100394
  ref: ref3,
@@ -100034,7 +100399,7 @@ var readOutlineCommand = exports_Command.make("outline", {
100034
100399
  excludeProperties: boolean8("exclude-properties"),
100035
100400
  includeEmpty: boolean8("include-empty"),
100036
100401
  expandReferences: boolean8("expand-references"),
100037
- maxReferenceDepth: integer7("max-reference-depth").pipe(optional5, map34(optionToUndefined42)),
100402
+ maxReferenceDepth: integer7("max-reference-depth").pipe(optional5, map34(optionToUndefined43)),
100038
100403
  detail: boolean8("detail")
100039
100404
  }, ({
100040
100405
  id: id4,
@@ -100081,12 +100446,12 @@ var readOutlineCommand = exports_Command.make("outline", {
100081
100446
  }).pipe(catchAll2(writeFailure)));
100082
100447
 
100083
100448
  // src/commands/read/page-id.ts
100084
- function optionToUndefined43(opt) {
100449
+ function optionToUndefined44(opt) {
100085
100450
  return isSome2(opt) ? opt.value : undefined;
100086
100451
  }
100087
- var ref4 = text9("ref").pipe(optional5, map34(optionToUndefined43));
100452
+ var ref4 = text9("ref").pipe(optional5, map34(optionToUndefined44));
100088
100453
  var id4 = text9("id").pipe(repeated5);
100089
- var maxHops = integer7("max-hops").pipe(optional5, map34(optionToUndefined43));
100454
+ var maxHops = integer7("max-hops").pipe(optional5, map34(optionToUndefined44));
100090
100455
  var readPageIdCommand = exports_Command.make("page-id", { ref: ref4, id: id4, maxHops, detail: boolean8("detail") }, ({ ref: ref5, id: id5, maxHops: maxHops2, detail }) => gen2(function* () {
100091
100456
  const cfg = yield* AppConfig;
100092
100457
  const refs = yield* RefResolver;
@@ -100136,11 +100501,11 @@ var readPageIdCommand = exports_Command.make("page-id", { ref: ref4, id: id4, ma
100136
100501
  }).pipe(catchAll2(writeFailure)));
100137
100502
 
100138
100503
  // src/commands/read/references.ts
100139
- function optionToUndefined44(opt) {
100504
+ function optionToUndefined45(opt) {
100140
100505
  return isSome2(opt) ? opt.value : undefined;
100141
100506
  }
100142
- var maxDepth4 = integer7("max-depth").pipe(optional5, map34(optionToUndefined44));
100143
- var inboundMaxDepth = integer7("inbound-max-depth").pipe(optional5, map34(optionToUndefined44));
100507
+ var maxDepth4 = integer7("max-depth").pipe(optional5, map34(optionToUndefined45));
100508
+ var inboundMaxDepth = integer7("inbound-max-depth").pipe(optional5, map34(optionToUndefined45));
100144
100509
  var readReferencesCommand = exports_Command.make("references", {
100145
100510
  id: text9("id"),
100146
100511
  includeDescendants: boolean8("include-descendants"),
@@ -100172,10 +100537,10 @@ var readReferencesCommand = exports_Command.make("references", {
100172
100537
 
100173
100538
  // src/commands/read/resolve-ref.ts
100174
100539
  var ids3 = text9("ids").pipe(repeated5);
100175
- function optionToUndefined45(opt) {
100540
+ function optionToUndefined46(opt) {
100176
100541
  return isSome2(opt) ? opt.value : undefined;
100177
100542
  }
100178
- var maxReferenceDepth2 = integer7("max-reference-depth").pipe(optional5, map34(optionToUndefined45));
100543
+ var maxReferenceDepth2 = integer7("max-reference-depth").pipe(optional5, map34(optionToUndefined46));
100179
100544
  var readResolveRefCommand = exports_Command.make("resolve-ref", {
100180
100545
  ids: ids3,
100181
100546
  expandReferences: boolean8("expand-references"),
@@ -100206,13 +100571,14 @@ function normalizeRemIdInput2(raw4) {
100206
100571
  }
100207
100572
  var tag8 = text9("tag").pipe(repeated5);
100208
100573
  var writeRemCreateCommand = exports_Command.make("create", {
100209
- parent: text9("parent").pipe(optional5, map34(optionToUndefined36)),
100210
- ref: text9("ref").pipe(optional5, map34(optionToUndefined36)),
100211
- text: text9("text").pipe(optional5, map34(optionToUndefined36)),
100574
+ parent: text9("parent").pipe(optional5, map34(optionToUndefined37)),
100575
+ ref: text9("ref").pipe(optional5, map34(optionToUndefined37)),
100576
+ text: text9("text").pipe(optional5, map34(optionToUndefined37)),
100212
100577
  isDocument: boolean8("is-document"),
100213
100578
  tag: tag8,
100214
- position: integer7("position").pipe(optional5, map34(optionToUndefined36)),
100215
- clientTempId: text9("client-temp-id").pipe(optional5, map34(optionToUndefined36)),
100579
+ position: integer7("position").pipe(optional5, map34(optionToUndefined37)),
100580
+ clientTempId: text9("client-temp-id").pipe(optional5, map34(optionToUndefined37)),
100581
+ forceText: boolean8("force-text"),
100216
100582
  notify: writeCommonOptions.notify,
100217
100583
  ensureDaemon: writeCommonOptions.ensureDaemon,
100218
100584
  wait: writeCommonOptions.wait,
@@ -100231,6 +100597,7 @@ var writeRemCreateCommand = exports_Command.make("create", {
100231
100597
  tag: tag9,
100232
100598
  position: position4,
100233
100599
  clientTempId,
100600
+ forceText: forceText2,
100234
100601
  notify: notify6,
100235
100602
  ensureDaemon: ensureDaemon8,
100236
100603
  wait: wait4,
@@ -100286,6 +100653,13 @@ var writeRemCreateCommand = exports_Command.make("create", {
100286
100653
  const tags2 = Array.isArray(tag9) ? tag9.map(normalizeRemIdInput2).filter(Boolean) : [];
100287
100654
  const remClientTempId = clientTempId ? String(clientTempId).trim() : makeTempId();
100288
100655
  const textValue = text16 !== undefined ? trimBoundaryBlankLines(text16) : undefined;
100656
+ if (textValue && !forceText2 && looksLikeStructuredMarkdown(textValue)) {
100657
+ return yield* fail8(new CliError({
100658
+ code: "INVALID_ARGS",
100659
+ message: "Input passed to --text looks like structured Markdown. Use import markdown --parent/--ref instead, or pass --force-text to keep it literal.",
100660
+ exitCode: 2
100661
+ }));
100662
+ }
100289
100663
  const payload3 = {
100290
100664
  parentId,
100291
100665
  clientTempId: remClientTempId
@@ -100440,9 +100814,9 @@ function normalizeRemIdInput3(raw4) {
100440
100814
  }
100441
100815
  var writeRemMoveCommand = exports_Command.make("move", {
100442
100816
  rem: text9("rem"),
100443
- parent: text9("parent").pipe(optional5, map34(optionToUndefined36)),
100444
- ref: text9("ref").pipe(optional5, map34(optionToUndefined36)),
100445
- position: integer7("position").pipe(optional5, map34(optionToUndefined36)),
100817
+ parent: text9("parent").pipe(optional5, map34(optionToUndefined37)),
100818
+ ref: text9("ref").pipe(optional5, map34(optionToUndefined37)),
100819
+ position: integer7("position").pipe(optional5, map34(optionToUndefined37)),
100446
100820
  notify: writeCommonOptions.notify,
100447
100821
  ensureDaemon: writeCommonOptions.ensureDaemon,
100448
100822
  wait: writeCommonOptions.wait,
@@ -100645,7 +101019,7 @@ var writeTagAddCommand = exports_Command.make("add", {
100645
101019
  var writeTagRemoveCommand = exports_Command.make("remove", {
100646
101020
  rem: text9("rem"),
100647
101021
  tag: text9("tag"),
100648
- removeProperties: boolean8("remove-properties").pipe(optional5, map34(optionToUndefined36)),
101022
+ removeProperties: boolean8("remove-properties").pipe(optional5, map34(optionToUndefined37)),
100649
101023
  notify: writeCommonOptions.notify,
100650
101024
  ensureDaemon: writeCommonOptions.ensureDaemon,
100651
101025
  wait: writeCommonOptions.wait,
@@ -100956,18 +101330,18 @@ function expandTargetIds(params3) {
100956
101330
  }
100957
101331
 
100958
101332
  // src/commands/write/replace/block.ts
100959
- function optionToUndefined46(opt) {
101333
+ function optionToUndefined47(opt) {
100960
101334
  return isSome2(opt) ? opt.value : undefined;
100961
101335
  }
100962
101336
  function readOptionalText6(name) {
100963
- return text9(name).pipe(optional5, map34(optionToUndefined46));
101337
+ return text9(name).pipe(optional5, map34(optionToUndefined47));
100964
101338
  }
100965
101339
  var selection = boolean8("selection");
100966
101340
  var stateFile18 = readOptionalText6("state-file");
100967
- var staleMs11 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined46));
101341
+ var staleMs11 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined47));
100968
101342
  var ref5 = readOptionalText6("ref");
100969
101343
  var ids4 = text9("id").pipe(repeated5);
100970
- var scope5 = choice5("scope", ["roots", "subtree"]).pipe(optional5, map34(optionToUndefined46));
101344
+ var scope5 = choice5("scope", ["roots", "subtree"]).pipe(optional5, map34(optionToUndefined47));
100971
101345
  var requireComplete = boolean8("require-complete");
100972
101346
  var maxDepth5 = integer7("max-depth").pipe(withDefault5(10));
100973
101347
  var maxNodes2 = integer7("max-nodes").pipe(withDefault5(1000));
@@ -100979,12 +101353,12 @@ var file9 = readOptionalText6("file");
100979
101353
  var clientId6 = readOptionalText6("client-id");
100980
101354
  var idempotencyKey6 = readOptionalText6("idempotency-key");
100981
101355
  var metaSpec6 = readOptionalText6("meta");
100982
- var priority6 = integer7("priority").pipe(optional5, map34(optionToUndefined46));
101356
+ var priority6 = integer7("priority").pipe(optional5, map34(optionToUndefined47));
100983
101357
  var notify6 = boolean8("no-notify").pipe(map34((v) => !v));
100984
101358
  var ensureDaemon8 = boolean8("no-ensure-daemon").pipe(map34((v) => !v));
100985
101359
  var wait4 = boolean8("wait");
100986
- var timeoutMs5 = integer7("timeout-ms").pipe(optional5, map34(optionToUndefined46));
100987
- var pollMs4 = integer7("poll-ms").pipe(optional5, map34(optionToUndefined46));
101360
+ var timeoutMs5 = integer7("timeout-ms").pipe(optional5, map34(optionToUndefined47));
101361
+ var pollMs4 = integer7("poll-ms").pipe(optional5, map34(optionToUndefined47));
100988
101362
  var replaceMarkdownCommand = exports_Command.make("markdown", {
100989
101363
  selection,
100990
101364
  stateFile: stateFile18,
@@ -101024,7 +101398,7 @@ var replaceMarkdownCommand = exports_Command.make("markdown", {
101024
101398
  useCurrentSelection: useCurrentSelection2,
101025
101399
  portalId: portalId2,
101026
101400
  file: file10,
101027
- markdown,
101401
+ markdown: markdown2,
101028
101402
  notify: notify7,
101029
101403
  ensureDaemon: ensureDaemon9,
101030
101404
  wait: wait5,
@@ -101053,17 +101427,17 @@ var replaceMarkdownCommand = exports_Command.make("markdown", {
101053
101427
  const fileInput = yield* FileInput;
101054
101428
  const payloadSvc = yield* Payload;
101055
101429
  const resolvedTarget = yield* resolveReplaceTarget({ selection: selection2, stateFile: stateFile19, staleMs: staleMs12, ref: ref6, ids: id5 });
101056
- if (file10 && markdown) {
101430
+ if (file10 && markdown2) {
101057
101431
  return yield* fail8(new CliError({
101058
101432
  code: "INVALID_ARGS",
101059
101433
  message: "Choose only one of --file or --markdown",
101060
101434
  exitCode: 2
101061
101435
  }));
101062
101436
  }
101063
- if (!file10 && !markdown) {
101437
+ if (!file10 && !markdown2) {
101064
101438
  return yield* fail8(new CliError({ code: "INVALID_ARGS", message: "You must provide --file or --markdown", exitCode: 2 }));
101065
101439
  }
101066
- const mdRaw = typeof markdown === "string" ? markdown : yield* fileInput.readTextFromFileSpec({ spec: String(file10) });
101440
+ const mdRaw = typeof markdown2 === "string" ? markdown2 : yield* fileInput.readTextFromFileSpec({ spec: String(file10) });
101067
101441
  const md = trimBoundaryBlankLines(mdRaw);
101068
101442
  const scopeValue = scope6 ?? "roots";
101069
101443
  if (scopeValue !== "roots") {
@@ -101154,18 +101528,18 @@ var replaceMarkdownCommand = exports_Command.make("markdown", {
101154
101528
  }).pipe(catchAll2(writeFailure)));
101155
101529
 
101156
101530
  // src/commands/write/replace/text.ts
101157
- function optionToUndefined47(opt) {
101531
+ function optionToUndefined48(opt) {
101158
101532
  return isSome2(opt) ? opt.value : undefined;
101159
101533
  }
101160
101534
  function readOptionalText7(name) {
101161
- return text9(name).pipe(optional5, map34(optionToUndefined47));
101535
+ return text9(name).pipe(optional5, map34(optionToUndefined48));
101162
101536
  }
101163
101537
  var selection2 = boolean8("selection");
101164
101538
  var stateFile19 = readOptionalText7("state-file");
101165
- var staleMs12 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined47));
101539
+ var staleMs12 = integer7("stale-ms").pipe(optional5, map34(optionToUndefined48));
101166
101540
  var ref6 = readOptionalText7("ref");
101167
101541
  var ids5 = text9("id").pipe(repeated5);
101168
- var scope6 = choice5("scope", ["roots", "subtree"]).pipe(optional5, map34(optionToUndefined47));
101542
+ var scope6 = choice5("scope", ["roots", "subtree"]).pipe(optional5, map34(optionToUndefined48));
101169
101543
  var maxDepth6 = integer7("max-depth").pipe(withDefault5(10));
101170
101544
  var maxNodes3 = integer7("max-nodes").pipe(withDefault5(1000));
101171
101545
  var requireComplete2 = boolean8("require-complete");
@@ -101177,12 +101551,12 @@ var flags = readOptionalText7("flags");
101177
101551
  var clientId7 = readOptionalText7("client-id");
101178
101552
  var idempotencyKey7 = readOptionalText7("idempotency-key");
101179
101553
  var metaSpec7 = readOptionalText7("meta");
101180
- var priority7 = integer7("priority").pipe(optional5, map34(optionToUndefined47));
101554
+ var priority7 = integer7("priority").pipe(optional5, map34(optionToUndefined48));
101181
101555
  var notify7 = boolean8("no-notify").pipe(map34((v) => !v));
101182
101556
  var ensureDaemon9 = boolean8("no-ensure-daemon").pipe(map34((v) => !v));
101183
101557
  var wait5 = boolean8("wait");
101184
- var timeoutMs6 = integer7("timeout-ms").pipe(optional5, map34(optionToUndefined47));
101185
- var pollMs5 = integer7("poll-ms").pipe(optional5, map34(optionToUndefined47));
101558
+ var timeoutMs6 = integer7("timeout-ms").pipe(optional5, map34(optionToUndefined48));
101559
+ var pollMs5 = integer7("poll-ms").pipe(optional5, map34(optionToUndefined48));
101186
101560
  function tryMakeRegExp(pattern2, rawFlags) {
101187
101561
  const f = typeof rawFlags === "string" && rawFlags.trim() ? rawFlags.trim() : "g";
101188
101562
  const withGlobal = f.includes("g") ? f : `g${f}`;
@@ -101430,11 +101804,11 @@ var writeReplaceCommand = exports_Command.make("replace", {}).pipe(exports_Comma
101430
101804
  var replaceCommand = writeReplaceCommand;
101431
101805
 
101432
101806
  // src/commands/read/search.ts
101433
- function optionToUndefined48(opt) {
101807
+ function optionToUndefined49(opt) {
101434
101808
  return isSome2(opt) ? opt.value : undefined;
101435
101809
  }
101436
- var timeRange2 = text9("time").pipe(optional5, map34(optionToUndefined48));
101437
- var parentId = text9("parent").pipe(optional5, map34(optionToUndefined48));
101810
+ var timeRange2 = text9("time").pipe(optional5, map34(optionToUndefined49));
101811
+ var parentId = text9("parent").pipe(optional5, map34(optionToUndefined49));
101438
101812
  var limit7 = integer7("limit").pipe(withDefault5(10));
101439
101813
  var offset6 = integer7("offset").pipe(withDefault5(0));
101440
101814
  var timeoutMs7 = integer7("timeout-ms").pipe(withDefault5(30000));
@@ -101511,10 +101885,10 @@ function normalizeRemIdInput6(raw4) {
101511
101885
  }
101512
101886
  var writeTableCreateCommand = exports_Command.make("create", {
101513
101887
  tableTag: text9("table-tag"),
101514
- parent: text9("parent").pipe(optional5, map34(optionToUndefined36)),
101515
- ref: text9("ref").pipe(optional5, map34(optionToUndefined36)),
101516
- position: integer7("position").pipe(optional5, map34(optionToUndefined36)),
101517
- clientTempId: text9("client-temp-id").pipe(optional5, map34(optionToUndefined36)),
101888
+ parent: text9("parent").pipe(optional5, map34(optionToUndefined37)),
101889
+ ref: text9("ref").pipe(optional5, map34(optionToUndefined37)),
101890
+ position: integer7("position").pipe(optional5, map34(optionToUndefined37)),
101891
+ clientTempId: text9("client-temp-id").pipe(optional5, map34(optionToUndefined37)),
101518
101892
  notify: writeCommonOptions.notify,
101519
101893
  ensureDaemon: writeCommonOptions.ensureDaemon,
101520
101894
  wait: writeCommonOptions.wait,
@@ -101827,8 +102201,8 @@ var writeTableOptionCommand = exports_Command.make("option", {}).pipe(exports_Co
101827
102201
  var writeTablePropertyAddCommand = exports_Command.make("add", {
101828
102202
  tableTag: text9("table-tag"),
101829
102203
  name: text9("name"),
101830
- type: text9("type").pipe(optional5, map34(optionToUndefined36)),
101831
- options: text9("options").pipe(optional5, map34(optionToUndefined36)),
102204
+ type: text9("type").pipe(optional5, map34(optionToUndefined37)),
102205
+ options: text9("options").pipe(optional5, map34(optionToUndefined37)),
101832
102206
  notify: writeCommonOptions.notify,
101833
102207
  ensureDaemon: writeCommonOptions.ensureDaemon,
101834
102208
  wait: writeCommonOptions.wait,
@@ -102029,10 +102403,10 @@ var writeTablePropertyCommand = exports_Command.make("property", {}).pipe(export
102029
102403
  // src/commands/write/table/record/add.ts
102030
102404
  var writeTableRecordAddCommand = exports_Command.make("add", {
102031
102405
  tableTag: text9("table-tag"),
102032
- parent: text9("parent").pipe(optional5, map34(optionToUndefined36)),
102033
- ref: text9("ref").pipe(optional5, map34(optionToUndefined36)),
102034
- text: text9("text").pipe(optional5, map34(optionToUndefined36)),
102035
- values: text9("values").pipe(optional5, map34(optionToUndefined36)),
102406
+ parent: text9("parent").pipe(optional5, map34(optionToUndefined37)),
102407
+ ref: text9("ref").pipe(optional5, map34(optionToUndefined37)),
102408
+ text: text9("text").pipe(optional5, map34(optionToUndefined37)),
102409
+ values: text9("values").pipe(optional5, map34(optionToUndefined37)),
102036
102410
  notify: writeCommonOptions.notify,
102037
102411
  ensureDaemon: writeCommonOptions.ensureDaemon,
102038
102412
  wait: writeCommonOptions.wait,
@@ -102339,8 +102713,8 @@ function rowHasTag4(doc, tagId) {
102339
102713
  var writeTableRecordUpdateCommand = exports_Command.make("update", {
102340
102714
  tableTag: text9("table-tag"),
102341
102715
  row: text9("row"),
102342
- text: text9("text").pipe(optional5, map34(optionToUndefined36)),
102343
- values: text9("values").pipe(optional5, map34(optionToUndefined36)),
102716
+ text: text9("text").pipe(optional5, map34(optionToUndefined37)),
102717
+ values: text9("values").pipe(optional5, map34(optionToUndefined37)),
102344
102718
  notify: writeCommonOptions.notify,
102345
102719
  ensureDaemon: writeCommonOptions.ensureDaemon,
102346
102720
  wait: writeCommonOptions.wait,
@@ -102553,10 +102927,10 @@ var tableCommand = exports_Command.make("table", {}).pipe(exports_Command.withSu
102553
102927
  var tagCommand = writeTagCommand;
102554
102928
 
102555
102929
  // src/commands/read/todos/list.ts
102556
- function optionToUndefined49(opt) {
102930
+ function optionToUndefined50(opt) {
102557
102931
  return isSome2(opt) ? opt.value : undefined;
102558
102932
  }
102559
- var status2 = choice5("status", ["unfinished", "finished", "all"]).pipe(optional5, map34(optionToUndefined49));
102933
+ var status2 = choice5("status", ["unfinished", "finished", "all"]).pipe(optional5, map34(optionToUndefined50));
102560
102934
  var sort3 = choice5("sort", [
102561
102935
  "dueAsc",
102562
102936
  "dueDesc",
@@ -102564,22 +102938,22 @@ var sort3 = choice5("sort", [
102564
102938
  "updatedAtDesc",
102565
102939
  "createdAtAsc",
102566
102940
  "createdAtDesc"
102567
- ]).pipe(optional5, map34(optionToUndefined49));
102941
+ ]).pipe(optional5, map34(optionToUndefined50));
102568
102942
  var tagId = text9("tag-id").pipe(repeated5);
102569
102943
  var tagTitle = text9("tag-title").pipe(repeated5);
102570
102944
  var preferTodoOnly = boolean8("prefer-todo-only");
102571
102945
  var preferTodoFirst = boolean8("prefer-todo-first");
102572
102946
  var includeDescendants = boolean8("no-descendants").pipe(map34((v) => !v));
102573
- var ancestor = text9("ancestor").pipe(optional5, map34(optionToUndefined49));
102574
- var dueBefore = text9("due-before").pipe(optional5, map34(optionToUndefined49));
102575
- var dueAfter = text9("due-after").pipe(optional5, map34(optionToUndefined49));
102947
+ var ancestor = text9("ancestor").pipe(optional5, map34(optionToUndefined50));
102948
+ var dueBefore = text9("due-before").pipe(optional5, map34(optionToUndefined50));
102949
+ var dueAfter = text9("due-after").pipe(optional5, map34(optionToUndefined50));
102576
102950
  var includeTagOnlyWhenNoStatus = boolean8("no-tag-only-when-no-status").pipe(map34((v) => !v));
102577
102951
  var statusAttrTitle = text9("status-attr-title").pipe(repeated5);
102578
102952
  var unfinishedOptionTitle = text9("unfinished-option-title").pipe(repeated5);
102579
102953
  var finishedOptionTitle = text9("finished-option-title").pipe(repeated5);
102580
102954
  var dueDateAttrTitle = text9("due-date-attr-title").pipe(repeated5);
102581
102955
  var alwaysIncludeTagOnlyTitle = text9("always-include-tag-only-title").pipe(repeated5);
102582
- var snippetLength2 = integer7("snippet-length").pipe(optional5, map34(optionToUndefined49));
102956
+ var snippetLength2 = integer7("snippet-length").pipe(optional5, map34(optionToUndefined50));
102583
102957
  var limit9 = integer7("limit").pipe(withDefault5(20));
102584
102958
  var offset8 = integer7("offset").pipe(withDefault5(0));
102585
102959
  function makeTodosListCommand() {
@@ -102656,8 +103030,8 @@ function makeTodosListCommand() {
102656
103030
  var todosListCommand = makeTodosListCommand();
102657
103031
 
102658
103032
  // src/commands/write/powerup/todo/todoAdd.ts
102659
- var status3 = choice5("status", ["unfinished", "finished", "clear"]).pipe(optional5, map34(optionToUndefined36));
102660
- var dispatchMode4 = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(optionToUndefined36));
103033
+ var status3 = choice5("status", ["unfinished", "finished", "clear"]).pipe(optional5, map34(optionToUndefined37));
103034
+ var dispatchMode4 = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(optionToUndefined37));
102661
103035
  function pickTodoSchema(schemas, tagId2) {
102662
103036
  const mapped = schemas.map((s) => ({
102663
103037
  tagId: String(s?.tagId ?? ""),
@@ -102676,10 +103050,10 @@ function pickTodoSchema(schemas, tagId2) {
102676
103050
  }
102677
103051
  var writePowerupTodoAddCommand = exports_Command.make("add", {
102678
103052
  rem: text9("rem"),
102679
- tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined36)),
103053
+ tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined37)),
102680
103054
  status: status3,
102681
- due: text9("due").pipe(optional5, map34(optionToUndefined36)),
102682
- values: text9("values").pipe(optional5, map34(optionToUndefined36)),
103055
+ due: text9("due").pipe(optional5, map34(optionToUndefined37)),
103056
+ values: text9("values").pipe(optional5, map34(optionToUndefined37)),
102683
103057
  notify: writeCommonOptions.notify,
102684
103058
  ensureDaemon: writeCommonOptions.ensureDaemon,
102685
103059
  wait: writeCommonOptions.wait,
@@ -102933,12 +103307,12 @@ function todoWriteEffect(params3) {
102933
103307
  }
102934
103308
 
102935
103309
  // src/commands/write/powerup/todo/todoDone.ts
102936
- var dispatchMode5 = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(optionToUndefined36));
103310
+ var dispatchMode5 = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(optionToUndefined37));
102937
103311
  var writePowerupTodoDoneCommand = exports_Command.make("done", {
102938
103312
  rem: text9("rem"),
102939
- tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined36)),
102940
- due: text9("due").pipe(optional5, map34(optionToUndefined36)),
102941
- values: text9("values").pipe(optional5, map34(optionToUndefined36)),
103313
+ tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined37)),
103314
+ due: text9("due").pipe(optional5, map34(optionToUndefined37)),
103315
+ values: text9("values").pipe(optional5, map34(optionToUndefined37)),
102942
103316
  notify: writeCommonOptions.notify,
102943
103317
  ensureDaemon: writeCommonOptions.ensureDaemon,
102944
103318
  wait: writeCommonOptions.wait,
@@ -102995,8 +103369,8 @@ function pickTodoTagId(schemas, tagId2) {
102995
103369
  }
102996
103370
  var writePowerupTodoRemoveCommand = exports_Command.make("remove", {
102997
103371
  rem: text9("rem"),
102998
- tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined36)),
102999
- removeProperties: boolean8("remove-properties").pipe(optional5, map34(optionToUndefined36)),
103372
+ tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined37)),
103373
+ removeProperties: boolean8("remove-properties").pipe(optional5, map34(optionToUndefined37)),
103000
103374
  notify: writeCommonOptions.notify,
103001
103375
  ensureDaemon: writeCommonOptions.ensureDaemon,
103002
103376
  wait: writeCommonOptions.wait,
@@ -103119,12 +103493,12 @@ var writePowerupTodoRemoveCommand = exports_Command.make("remove", {
103119
103493
  }).pipe(catchAll2(writeFailure)));
103120
103494
 
103121
103495
  // src/commands/write/powerup/todo/todoUndone.ts
103122
- var dispatchMode6 = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(optionToUndefined36));
103496
+ var dispatchMode6 = choice5("dispatch-mode", ["serial", "conflict_parallel"]).pipe(optional5, map34(optionToUndefined37));
103123
103497
  var writePowerupTodoUndoneCommand = exports_Command.make("undone", {
103124
103498
  rem: text9("rem"),
103125
- tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined36)),
103126
- due: text9("due").pipe(optional5, map34(optionToUndefined36)),
103127
- values: text9("values").pipe(optional5, map34(optionToUndefined36)),
103499
+ tagId: text9("tag-id").pipe(optional5, map34(optionToUndefined37)),
103500
+ due: text9("due").pipe(optional5, map34(optionToUndefined37)),
103501
+ values: text9("values").pipe(optional5, map34(optionToUndefined37)),
103128
103502
  notify: writeCommonOptions.notify,
103129
103503
  ensureDaemon: writeCommonOptions.ensureDaemon,
103130
103504
  wait: writeCommonOptions.wait,
@@ -103181,15 +103555,15 @@ var todoCommand = exports_Command.make("todo", {}).pipe(exports_Command.withSubc
103181
103555
  ]));
103182
103556
 
103183
103557
  // src/commands/read/topic/summary.ts
103184
- function optionToUndefined50(opt) {
103558
+ function optionToUndefined51(opt) {
103185
103559
  return isSome2(opt) ? opt.value : undefined;
103186
103560
  }
103187
- var keywords = text9("keywords").pipe(optional5, map34(optionToUndefined50));
103188
- var query2 = text9("query").pipe(optional5, map34(optionToUndefined50));
103189
- var timeRange3 = text9("time").pipe(optional5, map34(optionToUndefined50));
103190
- var maxResults = integer7("max-results").pipe(optional5, map34(optionToUndefined50));
103191
- var maxNodesPerResult = integer7("max-nodes").pipe(optional5, map34(optionToUndefined50));
103192
- var groupBy2 = choice5("group-by", ["none", "parent", "date"]).pipe(optional5, map34(optionToUndefined50));
103561
+ var keywords = text9("keywords").pipe(optional5, map34(optionToUndefined51));
103562
+ var query2 = text9("query").pipe(optional5, map34(optionToUndefined51));
103563
+ var timeRange3 = text9("time").pipe(optional5, map34(optionToUndefined51));
103564
+ var maxResults = integer7("max-results").pipe(optional5, map34(optionToUndefined51));
103565
+ var maxNodesPerResult = integer7("max-nodes").pipe(optional5, map34(optionToUndefined51));
103566
+ var groupBy2 = choice5("group-by", ["none", "parent", "date"]).pipe(optional5, map34(optionToUndefined51));
103193
103567
  var topicSummaryCommand = exports_Command.make("summary", { keywords, query: query2, timeRange: timeRange3, maxResults, maxNodesPerResult, groupBy: groupBy2 }, ({ keywords: keywords2, query: query3, timeRange: timeRange4, maxResults: maxResults2, maxNodesPerResult: maxNodesPerResult2, groupBy: groupBy3 }) => gen2(function* () {
103194
103568
  const cfg = yield* AppConfig;
103195
103569
  const keywordList = keywords2 ? keywords2.split(",").map((s) => s.trim()).filter(Boolean) : undefined;
@@ -103241,8 +103615,8 @@ function looksLikeRef(raw4) {
103241
103615
  var writePortalCreateCommand = exports_Command.make("create", {
103242
103616
  parent: text9("parent"),
103243
103617
  target: text9("target"),
103244
- position: integer7("position").pipe(optional5, map34(optionToUndefined36)),
103245
- clientTempId: text9("client-temp-id").pipe(optional5, map34(optionToUndefined36)),
103618
+ position: integer7("position").pipe(optional5, map34(optionToUndefined37)),
103619
+ clientTempId: text9("client-temp-id").pipe(optional5, map34(optionToUndefined37)),
103246
103620
  notify: writeCommonOptions.notify,
103247
103621
  ensureDaemon: writeCommonOptions.ensureDaemon,
103248
103622
  wait: writeCommonOptions.wait,
@@ -103552,16 +103926,19 @@ var stackStopCommand = exports_Command.make("stop", {}, () => gen2(function* ()
103552
103926
  var stackCommand = exports_Command.make("stack", {}).pipe(exports_Command.withSubcommands([stackEnsureCommand, stackStopCommand, stackStatusCommand]));
103553
103927
 
103554
103928
  // src/commands/index.ts
103555
- function optionToUndefined51(opt) {
103929
+ function optionToUndefined52(opt) {
103556
103930
  return isSome2(opt) ? opt.value : undefined;
103557
103931
  }
103558
- var remnoteDb = text9("remnote-db").pipe(optional5, map34(optionToUndefined51));
103559
- var storeDb = text9("store-db").pipe(optional5, map34(optionToUndefined51));
103560
- var daemonUrl = text9("daemon-url").pipe(optional5, map34(optionToUndefined51));
103561
- var wsPort = integer7("ws-port").pipe(optional5, map34(optionToUndefined51));
103562
- var repo = text9("repo").pipe(optional5, map34(optionToUndefined51));
103563
- var apiBaseUrl = text9("api-base-url").pipe(optional5, map34(optionToUndefined51));
103564
- var configFile = text9("config-file").pipe(optional5, map34(optionToUndefined51));
103932
+ var remnoteDb = text9("remnote-db").pipe(optional5, map34(optionToUndefined52));
103933
+ var storeDb = text9("store-db").pipe(optional5, map34(optionToUndefined52));
103934
+ var daemonUrl = text9("daemon-url").pipe(optional5, map34(optionToUndefined52));
103935
+ var wsPort = integer7("ws-port").pipe(optional5, map34(optionToUndefined52));
103936
+ var repo = text9("repo").pipe(optional5, map34(optionToUndefined52));
103937
+ var apiBaseUrl = text9("api-base-url").pipe(optional5, map34(optionToUndefined52));
103938
+ var apiHost = text9("api-host").pipe(optional5, map34(optionToUndefined52));
103939
+ var apiPort = integer7("api-port").pipe(optional5, map34(optionToUndefined52));
103940
+ var apiBasePath = text9("api-base-path").pipe(optional5, map34(optionToUndefined52));
103941
+ var configFile = text9("config-file").pipe(optional5, map34(optionToUndefined52));
103565
103942
  var appConfigLive = effect(AppConfig, resolveConfig());
103566
103943
  var statusLineUpdaterLive = StatusLineUpdaterLive.pipe(provide3([appConfigLive, QueueLive, StatusLineFileLive, TmuxLive, WsBridgeStateLive]));
103567
103944
  var statusLineLive = StatusLineControllerLive.pipe(provide3(statusLineUpdaterLive), provide3(appConfigLive));
@@ -103578,6 +103955,9 @@ var rootCommand = exports_Command.make("agent-remnote", {
103578
103955
  wsPort,
103579
103956
  repo,
103580
103957
  apiBaseUrl,
103958
+ apiHost,
103959
+ apiPort,
103960
+ apiBasePath,
103581
103961
  configFile
103582
103962
  }).pipe(exports_Command.withSubcommands([
103583
103963
  daemonCommand,
@@ -103789,6 +104169,9 @@ var ROOT_VALUE_FLAGS2 = new Set([
103789
104169
  "--ws-port",
103790
104170
  "--repo",
103791
104171
  "--api-base-url",
104172
+ "--api-host",
104173
+ "--api-port",
104174
+ "--api-base-path",
103792
104175
  "--config-file",
103793
104176
  ...BUILTIN_VALUE_FLAGS2
103794
104177
  ]);
@@ -103823,7 +104206,7 @@ function parseRootConfigFromArgv(argv2) {
103823
104206
  continue;
103824
104207
  }
103825
104208
  if (ROOT_VALUE_FLAGS2.has(flag)) {
103826
- const key = flag === "--remnote-db" ? "remnoteDb" : flag === "--store-db" ? "storeDb" : flag === "--daemon-url" ? "daemonUrl" : flag === "--ws-port" ? "wsPort" : flag === "--repo" ? "repo" : flag === "--api-base-url" ? "apiBaseUrl" : flag === "--config-file" ? "configFile" : null;
104209
+ const key = flag === "--remnote-db" ? "remnoteDb" : flag === "--store-db" ? "storeDb" : flag === "--daemon-url" ? "daemonUrl" : flag === "--ws-port" ? "wsPort" : flag === "--repo" ? "repo" : flag === "--api-base-url" ? "apiBaseUrl" : flag === "--api-host" ? "apiHost" : flag === "--api-port" ? "apiPort" : flag === "--api-base-path" ? "apiBasePath" : flag === "--config-file" ? "configFile" : null;
103827
104210
  if (inlineValue !== null) {
103828
104211
  if (key)
103829
104212
  out.set(key, inlineValue);