@wirecat/attio-cli 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -916,7 +916,7 @@ import {
916
916
  IDENTITY,
917
917
  PACKAGE,
918
918
  SKILL
919
- } from "./chunk-X5UPBSTP.js";
919
+ } from "./chunk-UXJZISVL.js";
920
920
  import {
921
921
  installerOf
922
922
  } from "./chunk-TXDR6YSF.js";
@@ -1090,20 +1090,20 @@ var tableLines = /* @__PURE__ */ __name((rows2) => {
1090
1090
  }, "tableLines");
1091
1091
  var toTelegramHtml = /* @__PURE__ */ __name((markdown) => {
1092
1092
  const out = [];
1093
- const lines2 = markdown.replace(/\r\n?/g, "\n").split("\n");
1094
- for (let at5 = 0; at5 < lines2.length; at5 += 1) {
1095
- const line7 = lines2[at5] ?? "";
1093
+ const lines3 = markdown.replace(/\r\n?/g, "\n").split("\n");
1094
+ for (let at5 = 0; at5 < lines3.length; at5 += 1) {
1095
+ const line7 = lines3[at5] ?? "";
1096
1096
  if (/^\s*```/.test(line7)) {
1097
1097
  const code = [];
1098
1098
  at5 += 1;
1099
- while (at5 < lines2.length && !/^\s*```/.test(lines2[at5] ?? ""))
1100
- code.push(lines2[at5++] ?? "");
1099
+ while (at5 < lines3.length && !/^\s*```/.test(lines3[at5] ?? ""))
1100
+ code.push(lines3[at5++] ?? "");
1101
1101
  out.push(`<pre>${esc(code.join("\n"))}</pre>`);
1102
1102
  } else if (/^\s*\|.*\|\s*$/.test(line7)) {
1103
1103
  const rows2 = [line7];
1104
- while (/^\s*\|.*\|\s*$/.test(lines2[at5 + 1] ?? "")) {
1104
+ while (/^\s*\|.*\|\s*$/.test(lines3[at5 + 1] ?? "")) {
1105
1105
  at5 += 1;
1106
- rows2.push(lines2[at5] ?? "");
1106
+ rows2.push(lines3[at5] ?? "");
1107
1107
  }
1108
1108
  for (const row2 of tableLines(rows2))
1109
1109
  out.push(row2);
@@ -2371,24 +2371,24 @@ var renderReport = /* @__PURE__ */ __name(async (view5, channel, { template: tem
2371
2371
  if (parts)
2372
2372
  return { text: parts.join("\n\n"), parts, templateFailed: failed2, templateTags: whole2.templateTags };
2373
2373
  }
2374
- let current = view5;
2374
+ let current2 = view5;
2375
2375
  let source2 = template2;
2376
2376
  for (; ; ) {
2377
- const rendering = await renderWithFallback(current, channel, source2);
2377
+ const rendering = await renderWithFallback(current2, channel, source2);
2378
2378
  if (rendering.templateFailed)
2379
2379
  source2 = void 0;
2380
- const smaller = fits(rendering.text) ? void 0 : dropOne(current);
2380
+ const smaller = fits(rendering.text) ? void 0 : dropOne(current2);
2381
2381
  if (!smaller)
2382
2382
  return { ...rendering, parts: [rendering.text], templateFailed: rendering.templateFailed || source2 !== template2 };
2383
- current = smaller;
2383
+ current2 = smaller;
2384
2384
  }
2385
2385
  }, "renderReport");
2386
2386
  var checkTemplate = /* @__PURE__ */ __name(async (view5, channel, source2) => {
2387
- let current = view5;
2387
+ let current2 = view5;
2388
2388
  for (; ; ) {
2389
2389
  let rendering;
2390
2390
  try {
2391
- rendering = await renderOnce(current, channel, source2);
2391
+ rendering = await renderOnce(current2, channel, source2);
2392
2392
  } catch (error) {
2393
2393
  const message2 = error instanceof Error ? error.message : String(error);
2394
2394
  return { problems: [message2 === "empty" ? "it renders nothing" : `it does not render: ${message2}`], text: "" };
@@ -2400,12 +2400,12 @@ var checkTemplate = /* @__PURE__ */ __name(async (view5, channel, source2) => {
2400
2400
  };
2401
2401
  if (channel !== "telegram" || fits(rendering.text))
2402
2402
  return { problems: [], text: rendering.text };
2403
- if (current === view5 && current.kind === "morning-digest") {
2404
- const parts = await digestParts(current, async (part) => (await renderOnce(part, channel, source2)).text).catch(() => void 0);
2403
+ if (current2 === view5 && current2.kind === "morning-digest") {
2404
+ const parts = await digestParts(current2, async (part) => (await renderOnce(part, channel, source2)).text).catch(() => void 0);
2405
2405
  if (parts)
2406
2406
  return { problems: [], text: parts.join("\n\n") };
2407
2407
  }
2408
- const smaller = dropOne(current);
2408
+ const smaller = dropOne(current2);
2409
2409
  if (!smaller)
2410
2410
  return {
2411
2411
  problems: [
@@ -2413,7 +2413,7 @@ var checkTemplate = /* @__PURE__ */ __name(async (view5, channel, source2) => {
2413
2413
  ],
2414
2414
  text: rendering.text
2415
2415
  };
2416
- current = smaller;
2416
+ current2 = smaller;
2417
2417
  }
2418
2418
  }, "checkTemplate");
2419
2419
  var INVALID_LINES = {
@@ -2850,10 +2850,10 @@ var shortTime = /* @__PURE__ */ __name((iso5) => {
2850
2850
  return `${at5.getFullYear()}-${two(at5.getMonth() + 1)}-${two(at5.getDate())} ${two(at5.getHours())}:${two(at5.getMinutes())}`;
2851
2851
  }, "shortTime");
2852
2852
  var failingNotice = /* @__PURE__ */ __name((command, runs, statusCommand3) => {
2853
- const lines2 = runs.flatMap(({ job: job2, last }) => last && last.exitCode !== 0 ? [
2853
+ const lines3 = runs.flatMap(({ job: job2, last }) => last && last.exitCode !== 0 ? [
2854
2854
  `${command}: scheduled ${job2} failing since ${shortTime(last.failingSince ?? last.at)} (${last.failures ?? 1} run${(last.failures ?? 1) === 1 ? "" : "s"})${last.reason ? `: ${last.reason}` : ""} \u2014 ${statusCommand3}`
2855
2855
  ] : []);
2856
- return lines2.length ? lines2.join("\n") : void 0;
2856
+ return lines3.length ? lines3.join("\n") : void 0;
2857
2857
  }, "failingNotice");
2858
2858
  var NAME = /^[a-z0-9][a-z0-9-]{0,39}$/;
2859
2859
  var scheduleName = /* @__PURE__ */ __name((name3) => {
@@ -3062,8 +3062,8 @@ ${join4(folder2, "latest.md")}`);
3062
3062
  }
3063
3063
  } else if (exitCode !== 0 && mode !== "never") {
3064
3064
  const notice = await failureNotice(app, schedule, last, now(), await messageOptions());
3065
- const lines2 = notice?.text.split("\n").slice(1).join("\n");
3066
- await notify(system, env, title, lines2 ? `${lines2}
3065
+ const lines3 = notice?.text.split("\n").slice(1).join("\n");
3066
+ await notify(system, env, title, lines3 ? `${lines3}
3067
3067
  ${errors}` : `failed (exit ${exitCode}) \u2014 ${errors}`);
3068
3068
  }
3069
3069
  const routes = chosen ?? schedule.to ?? [];
@@ -4339,11 +4339,11 @@ var stepLines = /* @__PURE__ */ __name((diagnostic, json) => (event) => {
4339
4339
 
4340
4340
  // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/terminal/sign-in-steps.js
4341
4341
  var answerStdinOption = /* @__PURE__ */ __name(() => new Option("--answer-stdin", "with --json and no terminal: print each question as a `needs` line on stderr and read its answer, one line, from stdin"), "answerStdinOption");
4342
- var signInSteps = /* @__PURE__ */ __name(({ diagnostic, json, answers, input: input2 = process.stdin, lines: lines2 }) => {
4342
+ var signInSteps = /* @__PURE__ */ __name(({ diagnostic, json, answers, input: input2 = process.stdin, lines: lines3 }) => {
4343
4343
  if (answers && !json)
4344
4344
  throw new CliError("validation_error", "--answer-stdin needs --json");
4345
4345
  const emit = stepLines(diagnostic, json);
4346
- const next = answers ? lines2 ?? lineReader(input2) : void 0;
4346
+ const next = answers ? lines3 ?? lineReader(input2) : void 0;
4347
4347
  return {
4348
4348
  json,
4349
4349
  answers,
@@ -4513,7 +4513,7 @@ var systemd = /* @__PURE__ */ __name((app, system, env) => {
4513
4513
  ...fields.ActiveState ? { detail: `${fields.ActiveState} (${fields.SubState})` } : {}
4514
4514
  };
4515
4515
  }, "state"),
4516
- logs: /* @__PURE__ */ __name((unit, lines2) => checked3(["journalctl", "--user", "-u", unit.name, "-n", String(lines2), "--no-pager"]), "logs")
4516
+ logs: /* @__PURE__ */ __name((unit, lines3) => checked3(["journalctl", "--user", "-u", unit.name, "-n", String(lines3), "--no-pager"]), "logs")
4517
4517
  };
4518
4518
  }, "systemd");
4519
4519
  var xml2 = /* @__PURE__ */ __name((value3) => value3.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;"), "xml");
@@ -4580,7 +4580,7 @@ var launchd = /* @__PURE__ */ __name((app, system, env) => {
4580
4580
  if (unit.logPath)
4581
4581
  mkdirSync4(dirname4(unit.logPath), { recursive: true, mode: 448 });
4582
4582
  }, "prepare"),
4583
- logs: /* @__PURE__ */ __name(async (unit, lines2) => tail(unit.logPath, lines2), "logs")
4583
+ logs: /* @__PURE__ */ __name(async (unit, lines3) => tail(unit.logPath, lines3), "logs")
4584
4584
  };
4585
4585
  }, "launchd");
4586
4586
  var launchdEnabled = /* @__PURE__ */ __name((listing, label) => {
@@ -4601,7 +4601,7 @@ var readableLog = /* @__PURE__ */ __name((text4) => text4.split("\n").map((line7
4601
4601
  return line7;
4602
4602
  }
4603
4603
  }).join("\n"), "readableLog");
4604
- var tail = /* @__PURE__ */ __name((path, lines2) => path && existsSync5(path) ? `${readFileSync6(path, "utf8").split("\n").filter(Boolean).slice(-lines2).join("\n")}
4604
+ var tail = /* @__PURE__ */ __name((path, lines3) => path && existsSync5(path) ? `${readFileSync6(path, "utf8").split("\n").filter(Boolean).slice(-lines3).join("\n")}
4605
4605
  ` : "", "tail");
4606
4606
  var noUnits = /* @__PURE__ */ __name((app, system) => {
4607
4607
  const refuse3 = /* @__PURE__ */ __name((unit) => {
@@ -4883,9 +4883,9 @@ var accountRemoveCommand = /* @__PURE__ */ __name((app, removal, options = {}) =
4883
4883
  }
4884
4884
  if (this.optsWithGlobals().yes !== true) {
4885
4885
  const what = `this signs ${profile} out and forgets it, and ${data === "deleted" ? "deletes" : "keeps"} its data`;
4886
- const lines2 = removed.map((one) => ` ${one.kind}: ${one.target}`).join("\n");
4886
+ const lines3 = removed.map((one) => ` ${one.kind}: ${one.target}`).join("\n");
4887
4887
  const reply = await answerOf(this, `${what}:
4888
- ${lines2}
4888
+ ${lines3}
4889
4889
  Go ahead? [y/N] `);
4890
4890
  if (reply === null)
4891
4891
  throw new CliError("confirmation_required", `${what} \u2014 add --yes to go ahead, or --dry-run to see the list`, {
@@ -5074,9 +5074,9 @@ var accountRenameCommand = /* @__PURE__ */ __name((app, renaming, options = {})
5074
5074
  }
5075
5075
  if (this.optsWithGlobals().yes !== true) {
5076
5076
  const what = `this renames ${profile} to ${next}`;
5077
- const lines2 = moved.map((one) => ` ${one.kind}: ${one.from} \u2192 ${one.to}`).join("\n");
5077
+ const lines3 = moved.map((one) => ` ${one.kind}: ${one.from} \u2192 ${one.to}`).join("\n");
5078
5078
  const reply = await answerOf(this, `${what}:
5079
- ${lines2}
5079
+ ${lines3}
5080
5080
  Go ahead? [y/N] `);
5081
5081
  if (reply === null)
5082
5082
  throw new CliError("confirmation_required", `${what} \u2014 add --yes to go ahead, or --dry-run to see the list`, {
@@ -7116,7 +7116,7 @@ var parseButtons = /* @__PURE__ */ __name((values) => {
7116
7116
  }, "parseButtons");
7117
7117
 
7118
7118
  // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/cli/bot/examples.js
7119
- var botExamples = /* @__PURE__ */ __name((bot, ...lines2) => lines2.map((line7) => `${bot.app.command} sales bot ${line7}`), "botExamples");
7119
+ var botExamples = /* @__PURE__ */ __name((bot, ...lines3) => lines3.map((line7) => `${bot.app.command} sales bot ${line7}`), "botExamples");
7120
7120
 
7121
7121
  // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/cli/bot/list-queries.js
7122
7122
  var termsOnly = /* @__PURE__ */ __name((registry) => ({
@@ -7602,22 +7602,22 @@ var commandsText = /* @__PURE__ */ __name((root, commands, scope) => {
7602
7602
  for (const info of commands.flatMap(runs))
7603
7603
  bySection.get(sectionOf(findCommand(root, info.path)))?.push(info);
7604
7604
  const where = scope ? `${cli} ${scope.join(" ")}` : cli;
7605
- const lines2 = [
7605
+ const lines3 = [
7606
7606
  `${where} commands, by section. One command's arguments and options: ${cli} <command> --help.`,
7607
7607
  `As JSON: ${cli} commands${scope ? ` ${scope.join(" ")}` : ""} --json. (writes) marks a command that changes something.`
7608
7608
  ];
7609
7609
  for (const [section, infos] of bySection) {
7610
7610
  if (infos.length === 0)
7611
7611
  continue;
7612
- lines2.push("", SECTIONS[section]);
7612
+ lines3.push("", SECTIONS[section]);
7613
7613
  for (const { usage, summary: summary4, description, effects, availability } of infos) {
7614
7614
  const what = short(summary4 ?? description);
7615
7615
  const mark = effects === void 0 || writes(effects) ? " (writes)" : "";
7616
7616
  const access = availability?.available === false ? ` [unavailable: ${availability.reason}]` : "";
7617
- lines2.push(` ${usage.padEnd(COLUMN)} ${what}${mark}${access}`.trimEnd());
7617
+ lines3.push(` ${usage.padEnd(COLUMN)} ${what}${mark}${access}`.trimEnd());
7618
7618
  }
7619
7619
  }
7620
- return `${lines2.join("\n")}
7620
+ return `${lines3.join("\n")}
7621
7621
  `;
7622
7622
  }, "commandsText");
7623
7623
 
@@ -7772,8 +7772,8 @@ var changeStoreSetting = /* @__PURE__ */ __name(async (app, env, setting, value3
7772
7772
  const script = SCRIPTS[setting];
7773
7773
  const store = await openStore({ env });
7774
7774
  try {
7775
- const current = await store.searchIndex.stemmers() ?? DEFAULT_STEMMERS;
7776
- const next = parseStemmers({ ...current, [script]: value3 ?? DEFAULT_STEMMERS[script] });
7775
+ const current2 = await store.searchIndex.stemmers() ?? DEFAULT_STEMMERS;
7776
+ const next = parseStemmers({ ...current2, [script]: value3 ?? DEFAULT_STEMMERS[script] });
7777
7777
  await store.searchIndex.saveStemmers(next);
7778
7778
  return {
7779
7779
  result: { store: storePath(env), scope: "store", setting, value: next[script] },
@@ -8916,7 +8916,7 @@ var mcpGroup = /* @__PURE__ */ __name((host) => {
8916
8916
  version: app.version
8917
8917
  };
8918
8918
  }, "target"),
8919
- answer: /* @__PURE__ */ __name((self, item, lines2) => renderAnswer(self, host.context(self, { needsProfile: false }), itemOf(item), () => lines2.join("\n")), "answer"),
8919
+ answer: /* @__PURE__ */ __name((self, item, lines3) => renderAnswer(self, host.context(self, { needsProfile: false }), itemOf(item), () => lines3.join("\n")), "answer"),
8920
8920
  system: /* @__PURE__ */ __name((self) => environmentOf(self).system, "system")
8921
8921
  }));
8922
8922
  command.addCommand(withProfiles(flagged(annotate(new Command("config"), {
@@ -9154,8 +9154,8 @@ var redactTail = /* @__PURE__ */ __name((text4, home2) => {
9154
9154
  if (home2)
9155
9155
  out = out.split(home2).join("~");
9156
9156
  out = out.replace(/[A-Za-z0-9_\-+=]{32,}/g, "[hidden]").replace(/\+?\d[\d ]{5,}\d/g, "[number]");
9157
- const lines2 = out.split("\n").filter((line7) => line7.trim() !== "");
9158
- return lines2.slice(-TAIL_LINES).join("\n").slice(-TAIL_BYTES);
9157
+ const lines3 = out.split("\n").filter((line7) => line7.trim() !== "");
9158
+ return lines3.slice(-TAIL_LINES).join("\n").slice(-TAIL_BYTES);
9159
9159
  }, "redactTail");
9160
9160
  var serverName = /* @__PURE__ */ __name((app, profile, profiles) => {
9161
9161
  if (profile !== void 0)
@@ -10119,7 +10119,7 @@ var linksCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("l
10119
10119
  }), "linksCommand");
10120
10120
  var line = /* @__PURE__ */ __name((one) => `${one.id} ${one.firstAt.slice(0, 16).replace("T", " ")}\u2013${one.lastAt.slice(11, 16)} ${one.messageCount} messages \xB7 ${one.senders} people \xB7 from message ${one.firstMessageId}`, "line");
10121
10121
  var itemLine = /* @__PURE__ */ __name((one) => `${one.id} ${one.started_at.slice(0, 16).replace("T", " ")}\u2013${one.ended_at.slice(11, 16)} ${one.messages_count} messages \xB7 ${one.senders_count} people \xB7 from ${one.first_message}`, "itemLine");
10122
- var hitLine = /* @__PURE__ */ __name(({ summary: summary4, chunk, score, stale, locator, lines: lines2 }, mark) => `${score === null ? " \u2014 " : score.toFixed(3)} ${line(summary4)} (messages ${chunk.firstMessageId}\u2013${chunk.lastMessageId})${locator ? ` ${locator}` : ""}${stale ? " stale" : ""}` + (lines2 ?? []).map((one) => `
10122
+ var hitLine = /* @__PURE__ */ __name(({ summary: summary4, chunk, score, stale, locator, lines: lines3 }, mark) => `${score === null ? " \u2014 " : score.toFixed(3)} ${line(summary4)} (messages ${chunk.firstMessageId}\u2013${chunk.lastMessageId})${locator ? ` ${locator}` : ""}${stale ? " stale" : ""}` + (lines3 ?? []).map((one) => `
10123
10123
  ${mark === void 0 ? one : marked(one, mark, "lines", locator)}`).join(""), "hitLine");
10124
10124
  var readinessLine = /* @__PURE__ */ __name(({ chat: chat2, state: state3, graph, pending, vectors }, model2) => graph === null ? `${chat2} ${state3} \u2014 \`conversations links rebuild --chat ${chat2}\`` : `${chat2} ${state3} built ${graph.builtAt.slice(0, 16).replace("T", " ")}, rules v${graph.rulesVersion}${graph.outdatedRules ? " (outdated)" : ""} \xB7 not in the build: ${pending.new} new, ${pending.edited} edited, ${pending.deleted} deleted \xB7 ${model2}: ${vectors.current} current, ${vectors.stale} stale, ${vectors.missing} missing of ${vectors.chunks} chunks`, "readinessLine");
10125
10125
  var conversationsSearchCommand = /* @__PURE__ */ __name((messenger) => syncOptions(boundOptions(withModelOptions(reachesOtherService(annotate(new Command("conversations"), { output: { entity: "conversation_hit" }, effects: REMOTE_READ })))), messenger).summary("find conversations by words and meaning").description("the conversations nearest to a query in meaning and in words, best first, in one chat or every one \u2014 meaning after `conversations embed`; runs on this machine").argument("<query>", "what to look for, in your own words, in any language the model reads").option("--like <text>", "a made-up reply that would answer the query, one sentence: searched by meaning too, which finds an answer worded unlike the question").option("--chat <chat>", `only this chat: ${messenger.chatArgument}`).option("--since-time <time>", "only those still going at this ISO 8601 time, or 30m / 2h / 1d ago, or later").option("--filter <query>", "strict Lucene filter: any message in a conversation must match; does not change the meaning query").option("--source <accounts>", "accounts to search: personal, bots, all, a provider, or a list like group:work,telegram:Alice,email:me@example.com; defaults to the active account").option("--timezone <zone>", "IANA timezone for filter dates; system timezone by default").option("--limit <n>", "how many", positiveCount("--limit")).option("--catch-up", "first build and embed, on this machine, the chats in scope that changed or were never built \u2014 within --max-chats and --max-chunks").action(async function(query) {
@@ -10371,7 +10371,7 @@ var searchAction = /* @__PURE__ */ __name((messenger) => async function(given2)
10371
10371
  };
10372
10372
  const hits = found.items.map((hit) => ({ hit, at: parseLocator(hit.locator) }));
10373
10373
  const spans = new Set(hits.map(({ at: at5 }) => `${at5.provider}/${at5.account}`)).size > 1;
10374
- const lines2 = hits.map(({ hit, at: at5 }) => {
10374
+ const lines3 = hits.map(({ hit, at: at5 }) => {
10375
10375
  const title = hit.chatTitle ?? hit.chatId;
10376
10376
  const links = hit.thread ? renderThreadLinks(hit.thread) : "";
10377
10377
  const place = hit.matchedIn && hit.matchedIn !== "text" && "excerpt" in hit ? `
@@ -10397,7 +10397,7 @@ ${links}` : ""}`;
10397
10397
  Pictures, by what they show (an English query matches best):
10398
10398
  ${found.pictures.map(({ locator, score }) => ` ${locator} ${score.toFixed(2)}`).join("\n")}
10399
10399
  ` : "";
10400
- return `${lines2}${pictures}`;
10400
+ return `${lines3}${pictures}`;
10401
10401
  }, "view");
10402
10402
  const again2 = {
10403
10403
  ...given2.length ? { query: given2.join(" ") } : {},
@@ -13433,43 +13433,43 @@ var projectStatusText = /* @__PURE__ */ __name((found, hints) => {
13433
13433
  const payments = found.items.filter((one) => one.signal === "payments");
13434
13434
  const children = found.items.filter((one) => one.signal === "children");
13435
13435
  const key = found.project.key ? `${found.project.key} \xB7 ` : "";
13436
- const lines2 = [
13436
+ const lines3 = [
13437
13437
  `${key}${found.project.name} \xB7 ${found.chats.length} linked chats in ${found.accounts.length} accounts, ${day(found.window.since)} to ${day(found.window.until)}`
13438
13438
  ];
13439
13439
  if (money.length || payments.length) {
13440
- lines2.push("Money");
13440
+ lines3.push("Money");
13441
13441
  for (const one of money)
13442
- lines2.push(moneyLine(one, titles));
13442
+ lines3.push(moneyLine(one, titles));
13443
13443
  for (const one of payments) {
13444
13444
  const data = one.data;
13445
- lines2.push(` payment ${data.title} \xB7 ${one.evidence[0]?.ref ?? ""} [${data.status}]`);
13445
+ lines3.push(` payment ${data.title} \xB7 ${one.evidence[0]?.ref ?? ""} [${data.status}]`);
13446
13446
  }
13447
13447
  }
13448
13448
  if (found.chats.length)
13449
- lines2.push("Chats");
13449
+ lines3.push("Chats");
13450
13450
  for (const chat2 of found.chats)
13451
13451
  for (const line7 of chatLine(found, chat2))
13452
- lines2.push(line7);
13452
+ lines3.push(line7);
13453
13453
  if (children.length)
13454
- lines2.push("Children");
13454
+ lines3.push("Children");
13455
13455
  for (const one of children) {
13456
13456
  const data = one.data;
13457
13457
  const cut3 = one.data.cut;
13458
- lines2.push(` ${cut3 ? `${data.child} not read (${cut3})` : `${data.key ?? data.child} \xB7 ${data.name} \xB7 ${data.chats} chats`}`);
13458
+ lines3.push(` ${cut3 ? `${data.child} not read (${cut3})` : `${data.key ?? data.child} \xB7 ${data.name} \xB7 ${data.chats} chats`}`);
13459
13459
  }
13460
13460
  const others = found.outOfScope.filter((one) => one.reason !== "purpose");
13461
13461
  if (others.length)
13462
- lines2.push(`Not read here: ${others.map((one) => `${one.chat} (${one.reason})`).join(", ")}`);
13462
+ lines3.push(`Not read here: ${others.map((one) => `${one.chat} (${one.reason})`).join(", ")}`);
13463
13463
  for (const one of leftOutOf(found))
13464
- lines2.push(`Left out: ${leftOutWhy(one, readLine(found, one, hints))}`);
13464
+ lines3.push(`Left out: ${leftOutWhy(one, readLine(found, one, hints))}`);
13465
13465
  for (const one of found.failed)
13466
- lines2.push(`Signal ${one.signal} failed: ${one.why}`);
13466
+ lines3.push(`Signal ${one.signal} failed: ${one.why}`);
13467
13467
  if (next.length)
13468
- lines2.push("Next");
13468
+ lines3.push("Next");
13469
13469
  next.forEach((step, index) => {
13470
- lines2.push(` ${index + 1}. ${hints.line(step)}`);
13470
+ lines3.push(` ${index + 1}. ${hints.line(step)}`);
13471
13471
  });
13472
- return lines2.join("\n");
13472
+ return lines3.join("\n");
13473
13473
  }, "projectStatusText");
13474
13474
 
13475
13475
  // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/cli/project-evidence.js
@@ -13552,7 +13552,7 @@ var projectEvidenceText = /* @__PURE__ */ __name((found, hints) => {
13552
13552
  const sent = found.items.filter((item) => item.context === "sender").length;
13553
13553
  const unreadSenders = found.lanes.filter((lane) => lane.kinds.includes("sender") && !found.units.some((unit) => unit.lane === lane.id));
13554
13554
  const failed2 = found.units.filter((unit) => unit.state === "failed" || unit.state === "unavailable");
13555
- const lines2 = [
13555
+ const lines3 = [
13556
13556
  `${found.project.name}${found.projectRef ? ` \u2014 ${found.projectRef}` : ""}: ${found.items.length} new references, ${day2(found.window.after)} to ${day2(found.window.before)}, ${found.scope.sources.length} sources`,
13557
13557
  `as of: ${new Date(found.window.asOf).toISOString()} (exclusive end; reuse --before-time to repeat this window)`,
13558
13558
  `searched: ${[...lanes.values()].join("; ")}`,
@@ -13563,60 +13563,60 @@ var projectEvidenceText = /* @__PURE__ */ __name((found, hints) => {
13563
13563
  const people2 = found.people.slice(0, 8);
13564
13564
  const morePeople = found.people.length - people2.length + found.peopleOmitted;
13565
13565
  if (people2.length)
13566
- lines2.push(`people who wrote these: ${people2.map((one) => `${one.name} (${one.items})`).join(", ")}${morePeople ? ` and ${morePeople} more` : ""} \u2014 by stored contact, not by names in the text; yours left out`);
13566
+ lines3.push(`people who wrote these: ${people2.map((one) => `${one.name} (${one.items})`).join(", ")}${morePeople ? ` and ${morePeople} more` : ""} \u2014 by stored contact, not by names in the text; yours left out`);
13567
13567
  if (linked2)
13568
- lines2.push(`${linked2} of these come from the project's linked chats and name nothing: membership, not a word match`);
13568
+ lines3.push(`${linked2} of these come from the project's linked chats and name nothing: membership, not a word match`);
13569
13569
  if (sent)
13570
- lines2.push(`${sent} of these were written by a contact and may name nothing: matched by sender, not words`);
13570
+ lines3.push(`${sent} of these were written by a contact and may name nothing: matched by sender, not words`);
13571
13571
  for (const lane of unreadSenders)
13572
- lines2.push(`${lane.people.join(", ")}: no stored identity in the selected sources, so nothing they wrote was read`);
13572
+ lines3.push(`${lane.people.join(", ")}: no stored identity in the selected sources, so nothing they wrote was read`);
13573
13573
  if (found.mentions.items.length)
13574
- lines2.push(`also names: ${found.mentions.items.slice(0, 8).map((one) => `${one.target.kind} ${one.target.name} (${one.matches.length})`).join(", ")} \u2014 words found, not membership`);
13574
+ lines3.push(`also names: ${found.mentions.items.slice(0, 8).map((one) => `${one.target.kind} ${one.target.name} (${one.matches.length})`).join(", ")} \u2014 words found, not membership`);
13575
13575
  if (found.matchedAgain.length)
13576
- lines2.push(`${found.matchedAgain.length} earlier references found again`);
13576
+ lines3.push(`${found.matchedAgain.length} earlier references found again`);
13577
13577
  if (found.oversized.length)
13578
- lines2.push(`too large to read here: ${found.oversized.map((one) => `${one.ref} (${Math.ceil(one.bytes / 1024)} KiB)`).join(", ")} \u2014 open each with ${hints.showDocument}`);
13578
+ lines3.push(`too large to read here: ${found.oversized.map((one) => `${one.ref} (${Math.ceil(one.bytes / 1024)} KiB)`).join(", ")} \u2014 open each with ${hints.showDocument}`);
13579
13579
  if (failed2.length)
13580
- lines2.push(`${failed2.length} reads failed or had no source: see --json units`);
13580
+ lines3.push(`${failed2.length} reads failed or had no source: see --json units`);
13581
13581
  if (found.index.state === "failed" || found.index.state === "unavailable")
13582
- lines2.push(`the search index could not be brought up to date first (${found.index.code ?? found.index.state})`);
13582
+ lines3.push(`the search index could not be brought up to date first (${found.index.code ?? found.index.state})`);
13583
13583
  const pending = [
13584
13584
  ...new Set(found.units.filter((unit) => unit.issue?.startsWith("index-")).map((unit) => found.scope.sources[unit.source]))
13585
13585
  ];
13586
13586
  if (pending.length)
13587
- lines2.push(`not yet searchable: new text in ${pending.map((one) => `${one?.provider}:${one?.account}`).join(", ")} is still waiting for the search index, so it was not found`);
13587
+ lines3.push(`not yet searchable: new text in ${pending.map((one) => `${one?.provider}:${one?.account}`).join(", ")} is still waiting for the search index, so it was not found`);
13588
13588
  if (pending.some((one) => one?.kind === "mail" || one?.kind === "document") && found.index.state === "as-is")
13589
- lines2.push("leave out --no-catch-up to index new mail and documents first");
13589
+ lines3.push("leave out --no-catch-up to index new mail and documents first");
13590
13590
  if (pending.some((one) => one?.kind === "meeting"))
13591
- lines2.push("index stored transcript cues through the meeting provider's indexing workflow; mail/document catch-up does not index them");
13591
+ lines3.push("index stored transcript cues through the meeting provider's indexing workflow; mail/document catch-up does not index them");
13592
13592
  if (found.unreadSources.length)
13593
- lines2.push(`not read: ${found.unreadSources.map((one) => `${one.source} (${one.kind}${one.reason ? `, ${one.reason}` : ""})`).join(", ")}`);
13593
+ lines3.push(`not read: ${found.unreadSources.map((one) => `${one.source} (${one.kind}${one.reason ? `, ${one.reason}` : ""})`).join(", ")}`);
13594
13594
  for (const one of found.fetch)
13595
- lines2.push(`${one.chat}: ${FETCH_STATES[one.state] ?? one.state} before reading${one.reason && one.state !== "skipped" ? ` (${one.reason})` : ""}`);
13595
+ lines3.push(`${one.chat}: ${FETCH_STATES[one.state] ?? one.state} before reading${one.reason && one.state !== "skipped" ? ` (${one.reason})` : ""}`);
13596
13596
  for (const one of found.linkedChats)
13597
13597
  if (one.completeness !== null && one.completeness.state !== "complete") {
13598
13598
  const sync = hints.sync(one, day2(found.window.after));
13599
13599
  const held = one.held === null ? "never fetched" : heldPhrase({ completeness: one.completeness, held: one.held });
13600
- lines2.push(`${one.title ?? one.ref}: ${held}${one.state === "pending" ? ", not read this run" : ""}` + (sync ? ` \u2014 sync it: ${sync}` : ""));
13600
+ lines3.push(`${one.title ?? one.ref}: ${held}${one.state === "pending" ? ", not read this run" : ""}` + (sync ? ` \u2014 sync it: ${sync}` : ""));
13601
13601
  }
13602
13602
  const proposed = [
13603
13603
  ...found.linkedChats.flatMap((one) => one.proposed ? [`${one.title ?? one.ref} (${one.proposed})`] : []),
13604
13604
  ...found.members.flatMap((one) => one.proposed ? [`${one.person} (${one.proposed})`] : [])
13605
13605
  ];
13606
13606
  if (proposed.length)
13607
- lines2.push(`read as proposed, not confirmed: ${proposed.join(", ")}`);
13607
+ lines3.push(`read as proposed, not confirmed: ${proposed.join(", ")}`);
13608
13608
  for (const one of found.leftOut)
13609
- lines2.push(`left out: ${leftOutLine(one, hints.read?.(one, day2(found.window.after)) ?? null)}`);
13609
+ lines3.push(`left out: ${leftOutLine(one, hints.read?.(one, day2(found.window.after)) ?? null)}`);
13610
13610
  if (found.purposeHint)
13611
- lines2.push(purposeHintLine(found.purposeHint));
13611
+ lines3.push(purposeHintLine(found.purposeHint));
13612
13612
  const capped2 = found.linkedChats.filter((one) => one.capped);
13613
13613
  if (capped2.length)
13614
- lines2.push(`linked chats with more to read, left for --cursor so one chat does not fill the run: ${capped2.map((one) => `${one.ref} (${one.items} this run)`).join(", ")}`);
13614
+ lines3.push(`linked chats with more to read, left for --cursor so one chat does not fill the run: ${capped2.map((one) => `${one.ref} (${one.items} this run)`).join(", ")}`);
13615
13615
  if (found.checkpoint)
13616
- lines2.push(`stopped${found.stopped ? ` at the ${found.stopped} budget` : ""}; continue with the same options and`, `--cursor ${found.checkpoint}`);
13616
+ lines3.push(`stopped${found.stopped ? ` at the ${found.stopped} budget` : ""}; continue with the same options and`, `--cursor ${found.checkpoint}`);
13617
13617
  else
13618
- lines2.push("every read finished; a finished search does not prove there is nothing more");
13619
- return lines2.join("\n");
13618
+ lines3.push("every read finished; a finished search does not prove there is nothing more");
13619
+ return lines3.join("\n");
13620
13620
  }, "projectEvidenceText");
13621
13621
 
13622
13622
  // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/cli/schedule/harnesses.js
@@ -14408,7 +14408,7 @@ var scheduleCommandFor = /* @__PURE__ */ __name(({ app, context: contextOf3, new
14408
14408
  limits: configured?.(self) ?? {}
14409
14409
  };
14410
14410
  const state3 = scheduleState(site);
14411
- const say = /* @__PURE__ */ __name((value3, lines2) => renderAnswer(self, context, itemOf(value3), () => lines2.join("\n")), "say");
14411
+ const say = /* @__PURE__ */ __name((value3, lines3) => renderAnswer(self, context, itemOf(value3), () => lines3.join("\n")), "say");
14412
14412
  const timer = /* @__PURE__ */ __name(() => timerFor(app, system, context.env), "timer");
14413
14413
  const environment = /* @__PURE__ */ __name(() => scheduleEnvironment(site), "environment");
14414
14414
  const save2 = /* @__PURE__ */ __name(async (schedule) => {
@@ -17428,7 +17428,7 @@ var suggest = /* @__PURE__ */ __name(({ commands, globalOptions = [], words: wor
17428
17428
  const typed2 = words3.at(-1) ?? "";
17429
17429
  const before = words3.slice(0, -1);
17430
17430
  let level = commands;
17431
- let current;
17431
+ let current2;
17432
17432
  let positional = 0;
17433
17433
  let pending;
17434
17434
  for (const word of before) {
@@ -17437,24 +17437,24 @@ var suggest = /* @__PURE__ */ __name(({ commands, globalOptions = [], words: wor
17437
17437
  continue;
17438
17438
  }
17439
17439
  if (word.startsWith("-")) {
17440
- const option = findOption(word, current, globalOptions);
17440
+ const option = findOption(word, current2, globalOptions);
17441
17441
  if (option?.takes_value && !word.includes("="))
17442
17442
  pending = option;
17443
17443
  continue;
17444
17444
  }
17445
17445
  const child = level.find((command) => command.name === word);
17446
17446
  if (child) {
17447
- current = child;
17447
+ current2 = child;
17448
17448
  level = child.commands;
17449
17449
  positional = 0;
17450
17450
  } else {
17451
17451
  positional += 1;
17452
17452
  }
17453
17453
  }
17454
- const candidates = pending ? optionValues(pending, sources) : typed2.startsWith("-") ? typed2.includes("=") ? valuesAfterEquals(typed2, current, globalOptions, sources) : optionNames(current, globalOptions) : [
17454
+ const candidates = pending ? optionValues(pending, sources) : typed2.startsWith("-") ? typed2.includes("=") ? valuesAfterEquals(typed2, current2, globalOptions, sources) : optionNames(current2, globalOptions) : [
17455
17455
  ...level.filter((command) => command.state !== "deprecated").map(asSuggestion),
17456
- ...current ? argumentValues(current.arguments, positional, sources) : [],
17457
- ...current ? [] : resolve6(sources.firstWord)
17456
+ ...current2 ? argumentValues(current2.arguments, positional, sources) : [],
17457
+ ...current2 ? [] : resolve6(sources.firstWord)
17458
17458
  ];
17459
17459
  const unique = new Map(candidates.map((candidate) => [candidate.value, candidate]));
17460
17460
  return [...unique.values()].filter(({ value: value3 }) => value3.startsWith(typed2));
@@ -17465,12 +17465,12 @@ var asSuggestion = /* @__PURE__ */ __name((command) => ({
17465
17465
  description: command.summary ?? command.description
17466
17466
  }), "asSuggestion");
17467
17467
  var longName = /* @__PURE__ */ __name((option) => option.flags.match(/--([\w-]+)/)?.[1], "longName");
17468
- var findOption = /* @__PURE__ */ __name((word, current, globals) => {
17468
+ var findOption = /* @__PURE__ */ __name((word, current2, globals) => {
17469
17469
  const name3 = word.replace(/^-+/, "").split("=")[0];
17470
17470
  const matches2 = /* @__PURE__ */ __name((option) => longName(option) === name3 || option.flags.split(/[ ,]+/).includes(`-${name3}`), "matches");
17471
- return [...current?.options ?? [], ...globals].find(matches2);
17471
+ return [...current2?.options ?? [], ...globals].find(matches2);
17472
17472
  }, "findOption");
17473
- var optionNames = /* @__PURE__ */ __name((current, globals) => [...current?.options ?? [], ...globals].flatMap((option) => {
17473
+ var optionNames = /* @__PURE__ */ __name((current2, globals) => [...current2?.options ?? [], ...globals].flatMap((option) => {
17474
17474
  const name3 = longName(option);
17475
17475
  return name3 ? [{ value: `--${name3}`, description: option.description }] : [];
17476
17476
  }), "optionNames");
@@ -17482,9 +17482,9 @@ var optionValues = /* @__PURE__ */ __name((option, sources) => {
17482
17482
  ...resolve6(name3 ? sources.options?.[name3] : void 0)
17483
17483
  ];
17484
17484
  }, "optionValues");
17485
- var valuesAfterEquals = /* @__PURE__ */ __name((typed2, current, globals, sources) => {
17485
+ var valuesAfterEquals = /* @__PURE__ */ __name((typed2, current2, globals, sources) => {
17486
17486
  const [flag2] = typed2.split("=");
17487
- const option = findOption(flag2 ?? "", current, globals);
17487
+ const option = findOption(flag2 ?? "", current2, globals);
17488
17488
  if (!option?.takes_value)
17489
17489
  return [];
17490
17490
  return optionValues(option, sources).map(({ value: value3, description }) => ({ value: `${flag2}=${value3}`, description }));
@@ -17935,10 +17935,10 @@ var listProfiles = /* @__PURE__ */ __name(async (command, messenger, words3, lab
17935
17935
  const terms = queryTerms(words3, ACCOUNT_PROFILES_QUERY, label);
17936
17936
  const context = messengerContext(command, messenger, { needsProfile: false });
17937
17937
  const { app, provider } = messenger;
17938
- const current = context.settings.sources.profile === NONE_NAMED ? void 0 : context.settings.profile;
17938
+ const current2 = context.settings.sources.profile === NONE_NAMED ? void 0 : context.settings.profile;
17939
17939
  const { profilesHere: profilesHere2, accountProfiles = profilesHere2, botProfiles = [] } = context.settings;
17940
17940
  const isAccount = /* @__PURE__ */ __name((profile) => accountProfiles.includes(profile) || messenger.profileState?.(profile, context.env) === "signed-in", "isAccount");
17941
- const profiles = [.../* @__PURE__ */ new Set([...current === void 0 ? [] : [current], ...profilesHere2.filter(isAccount)])].filter((profile) => terms.get("profile") === void 0 || profile === terms.get("profile")).filter((profile) => terms.get("current") === void 0 || profile === current === (terms.get("current")?.toLowerCase() === "true")).sort();
17941
+ const profiles = [.../* @__PURE__ */ new Set([...current2 === void 0 ? [] : [current2], ...profilesHere2.filter(isAccount)])].filter((profile) => terms.get("profile") === void 0 || profile === terms.get("profile")).filter((profile) => terms.get("current") === void 0 || profile === current2 === (terms.get("current")?.toLowerCase() === "true")).sort();
17942
17942
  const store = await storeOf(context.env);
17943
17943
  try {
17944
17944
  const items = [];
@@ -17946,7 +17946,7 @@ var listProfiles = /* @__PURE__ */ __name(async (command, messenger, words3, lab
17946
17946
  const key = recalledAccount(app, provider, profile, context.env);
17947
17947
  items.push({
17948
17948
  profile,
17949
- current: profile === current,
17949
+ current: profile === current2,
17950
17950
  account: key?.account ?? null,
17951
17951
  name: key && store ? await store.accounts.accountName(key) : null,
17952
17952
  ...messenger.profileState ? { signed_in: messenger.profileState(profile, context.env) !== "signed-out" } : {},
@@ -18050,31 +18050,31 @@ var toMarkdown = /* @__PURE__ */ __name((title, messages, timeZone) => {
18050
18050
  const day3 = new Intl.DateTimeFormat("sv-SE", { ...zone, year: "numeric", month: "2-digit", day: "2-digit" });
18051
18051
  const clock3 = new Intl.DateTimeFormat("en-GB", { ...zone, hour: "2-digit", minute: "2-digit", hourCycle: "h23" });
18052
18052
  const byId = new Map(messages.map((message2) => [message2.id, message2]));
18053
- const lines2 = [`# ${literal2(singleLine(title))}`, "", `Times are in ${zone.timeZone}.`];
18053
+ const lines3 = [`# ${literal2(singleLine(title))}`, "", `Times are in ${zone.timeZone}.`];
18054
18054
  let today = "";
18055
18055
  for (const message2 of messages) {
18056
18056
  const when3 = new Date(message2.timestamp);
18057
18057
  const date2 = day3.format(when3);
18058
18058
  if (date2 !== today) {
18059
- lines2.push("", `## ${date2}`);
18059
+ lines3.push("", `## ${date2}`);
18060
18060
  today = date2;
18061
18061
  }
18062
18062
  const edited = message2.editedAt ? " \xB7 edited" : "";
18063
- lines2.push("", `**${clock3.format(when3)} ${nameOf(message2)}**${edited}`);
18063
+ lines3.push("", `**${clock3.format(when3)} ${nameOf(message2)}**${edited}`);
18064
18064
  const answered = message2.replyTo ?? (message2.replyToId === void 0 ? void 0 : byId.get(message2.replyToId));
18065
18065
  if (answered)
18066
18066
  for (const line7 of quote(`**${nameOf(answered)}:** ${literal2(visibleControls(answered.text))}`))
18067
- lines2.push(line7);
18067
+ lines3.push(line7);
18068
18068
  else if (message2.replyToId !== void 0)
18069
- lines2.push(`> in reply to message ${singleLine(message2.replyToId)}`);
18069
+ lines3.push(`> in reply to message ${singleLine(message2.replyToId)}`);
18070
18070
  if (message2.forwardedFrom)
18071
18071
  for (const line7 of forwarded(message2.forwardedFrom))
18072
- lines2.push(line7);
18072
+ lines3.push(line7);
18073
18073
  if (message2.text)
18074
- lines2.push(visibleControls(message2.text));
18075
- lines2.push(...message2.attachments.map((attachment) => `- ${attachmentLine(attachment)}`));
18074
+ lines3.push(visibleControls(message2.text));
18075
+ lines3.push(...message2.attachments.map((attachment) => `- ${attachmentLine(attachment)}`));
18076
18076
  }
18077
- return `${lines2.join("\n")}
18077
+ return `${lines3.join("\n")}
18078
18078
  `;
18079
18079
  }, "toMarkdown");
18080
18080
  var literal2 = /* @__PURE__ */ __name((text4) => text4, "literal");
@@ -18155,12 +18155,12 @@ var ALL_CHATS = "--all";
18155
18155
  var limitedLines = /* @__PURE__ */ __name((result, status) => {
18156
18156
  if ("items" in result) {
18157
18157
  const { groupTooLarge = 0, olderThanWindow = 0, muted = 0 } = result.limited ?? {};
18158
- const lines2 = [];
18158
+ const lines3 = [];
18159
18159
  if (groupTooLarge + olderThanWindow > 0)
18160
- lines2.push(`the history limits (history_* settings) left ${groupTooLarge} big group(s) unread and read ${olderThanWindow} chat(s) only to the window's start \u2014 \`${status}\` lists them; \`messages sync <chat> --full-history\` reads one in full`);
18160
+ lines3.push(`the history limits (history_* settings) left ${groupTooLarge} big group(s) unread and read ${olderThanWindow} chat(s) only to the window's start \u2014 \`${status}\` lists them; \`messages sync <chat> --full-history\` reads one in full`);
18161
18161
  if (muted > 0)
18162
- lines2.push(`${muted} muted chat(s) not read \u2014 --with-muted or history_muted true reads them; \`messages sync <chat>\` reads one, and \`--full-history\` keeps it in every --all`);
18163
- return lines2;
18162
+ lines3.push(`${muted} muted chat(s) not read \u2014 --with-muted or history_muted true reads them; \`messages sync <chat>\` reads one, and \`--full-history\` keeps it in every --all`);
18163
+ return lines3;
18164
18164
  }
18165
18165
  if (result.limited === "group_too_large")
18166
18166
  return ["not read: a group above history_group_members_max \u2014 `--full-history` reads it and keeps it in full"];
@@ -18596,10 +18596,10 @@ var admitPassword = /* @__PURE__ */ __name(async (manifest, password) => {
18596
18596
  throw new CliError("validation_error", "not the password this folder was sealed with \u2014 nothing was written");
18597
18597
  }
18598
18598
  }, "admitPassword");
18599
- var sealRun = /* @__PURE__ */ __name(async (dir, name3, lines2, password) => {
18599
+ var sealRun = /* @__PURE__ */ __name(async (dir, name3, lines3, password) => {
18600
18600
  let count7 = 0;
18601
18601
  const counted2 = /* @__PURE__ */ __name(async function* () {
18602
- for await (const line7 of lines2) {
18602
+ for await (const line7 of lines3) {
18603
18603
  count7 += 1;
18604
18604
  yield `${line7}
18605
18605
  `;
@@ -18613,9 +18613,9 @@ var sealRun = /* @__PURE__ */ __name(async (dir, name3, lines2, password) => {
18613
18613
  var safe = /* @__PURE__ */ __name((chatId) => chatId.replace(/[^\w-]/g, "_"), "safe");
18614
18614
  var writeChanges = /* @__PURE__ */ __name((dir, chatId, mark, { messages, deleted }, reader) => {
18615
18615
  const name3 = `${safe(chatId)}-${stampOf(mark)}.jsonl`;
18616
- const lines2 = linesOf(chatId, { messages, deleted }, reader);
18616
+ const lines3 = linesOf(chatId, { messages, deleted }, reader);
18617
18617
  try {
18618
- writeFileSync3(join20(dir, name3), `${lines2.join("\n")}
18618
+ writeFileSync3(join20(dir, name3), `${lines3.join("\n")}
18619
18619
  `, { flag: "wx", mode: 384 });
18620
18620
  } catch (error) {
18621
18621
  if (error.code === "EEXIST") {
@@ -23184,7 +23184,7 @@ var repliesCommand = /* @__PURE__ */ __name((messenger) => {
23184
23184
  skipped
23185
23185
  }))
23186
23186
  };
23187
- const lines2 = found.rules.flatMap(({ id: id5, would, skipped }) => [
23187
+ const lines3 = found.rules.flatMap(({ id: id5, would, skipped }) => [
23188
23188
  `${id5}: would act on ${would.length}`,
23189
23189
  ...would.map((one) => ` ${one.at} ${one.chatTitle ?? one.chatId} \u2192 ${one.to.name ?? one.to.id}: ${[
23190
23190
  one.text === null ? void 0 : JSON.stringify(one.text),
@@ -23194,7 +23194,7 @@ var repliesCommand = /* @__PURE__ */ __name((messenger) => {
23194
23194
  ].filter(Boolean).join(" + ")}`),
23195
23195
  ...Object.entries(skipped).sort(([, a2], [, b]) => b - a2).map(([why, count7]) => ` passed over ${count7}: ${why}`)
23196
23196
  ]);
23197
- renderAnswer(this, context, itemOf(answer2, { meta: window2.meta }), () => `${lines2.join("\n")}
23197
+ renderAnswer(this, context, itemOf(answer2, { meta: window2.meta }), () => `${lines3.join("\n")}
23198
23198
  `);
23199
23199
  });
23200
23200
  const switched = /* @__PURE__ */ __name((on) => async function() {
@@ -23383,7 +23383,7 @@ var serverCommand = /* @__PURE__ */ __name((messenger, options = {}) => {
23383
23383
  throw new CliError("configuration_error", `${argv.join(" ")} failed: ${ran.stderr.trim()}`);
23384
23384
  }
23385
23385
  }, "each");
23386
- const say = /* @__PURE__ */ __name((value3, lines2, next = []) => renderAnswer(self, context, itemOf(snakeKeys(value3), { next }), () => lines2.join("\n")), "say");
23386
+ const say = /* @__PURE__ */ __name((value3, lines3, next = []) => renderAnswer(self, context, itemOf(snakeKeys(value3), { next }), () => lines3.join("\n")), "say");
23387
23387
  return { context, system, platform, unit, server, each, say };
23388
23388
  }, "prepare");
23389
23389
  const installed = /* @__PURE__ */ __name((unit) => {
@@ -23548,9 +23548,9 @@ ${last}` : ""}`);
23548
23548
  effects: LOCAL_READ,
23549
23549
  examples: [`${app.command} personal server logs --limit 20`]
23550
23550
  }).description("serve's latest log lines \u2014 from the journal under systemd, else its log file").option("-n, --limit <n>", "how many lines", (value3) => wholeNumber3(value3), 50).action(async function() {
23551
- const { limit: lines2 } = this.opts();
23551
+ const { limit: lines3 } = this.opts();
23552
23552
  const { context, platform, unit } = prepare(this);
23553
- const text4 = existsSync22(unit.path) ? await platform.logs(unit, lines2) : tail(unit.logPath, lines2);
23553
+ const text4 = existsSync22(unit.path) ? await platform.logs(unit, lines3) : tail(unit.logPath, lines3);
23554
23554
  if (!text4)
23555
23555
  context.renderer.note(`no log yet for profile ${unit.profile}`);
23556
23556
  renderAnswer(this, context, wholeList("server logs", text4.split("\n").filter(Boolean)), () => text4 ? readableLog(text4.replace(/\n$/, "")) : "");
@@ -23827,7 +23827,7 @@ var statsCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("s
23827
23827
  }), "statsCommand");
23828
23828
  var view4 = /* @__PURE__ */ __name((stats) => {
23829
23829
  const { questions, members } = stats;
23830
- const lines2 = [
23830
+ const lines3 = [
23831
23831
  `${stats.since} \u2013 ${stats.until}`,
23832
23832
  `messages ${stats.messages}, from ${stats.senders} people; replies ${stats.replies}, threads ${stats.threads}`,
23833
23833
  `reactions ${stats.reactions}${stats.views === void 0 ? "" : `, views ${stats.views}`}${stats.forwards === void 0 ? "" : `, forwards ${stats.forwards}`}${stats.comments === void 0 ? "" : `, comments ${stats.comments}`}`,
@@ -23837,7 +23837,7 @@ var view4 = /* @__PURE__ */ __name((stats) => {
23837
23837
  ] : [],
23838
23838
  ...(stats.series ?? []).map(({ key, messages, senders, joined: joined2, left }) => [key, `${messages} messages`, `${senders} people`, ...joined2 === void 0 ? [] : [`+${joined2} \u2212${left}`]].join(" "))
23839
23839
  ];
23840
- return `${lines2.join("\n")}
23840
+ return `${lines3.join("\n")}
23841
23841
  `;
23842
23842
  }, "view");
23843
23843
  var minutes3 = /* @__PURE__ */ __name((value3, what) => value3 === null ? "" : `; median ${value3} min to ${what}`, "minutes");
@@ -23890,21 +23890,21 @@ var officialStatsCommand = /* @__PURE__ */ __name((messenger) => annotate(new Co
23890
23890
  renderAnswer(this, context, officialAnswer(stats, messenger.provider), () => `${pretty(stats)}
23891
23891
  `);
23892
23892
  }), "officialStatsCommand");
23893
- var value2 = /* @__PURE__ */ __name((name3, { current, previous: previous2 }) => `${name3} ${current} (before ${previous2})`, "value");
23893
+ var value2 = /* @__PURE__ */ __name((name3, { current: current2, previous: previous2 }) => `${name3} ${current2} (before ${previous2})`, "value");
23894
23894
  var people = /* @__PURE__ */ __name((title, list2, counts) => list2.length === 0 ? [] : [`${title}:`, ...list2.slice(0, TOP).map((one) => ` ${one.name ?? one.person} ${counts(one)}`)], "people");
23895
23895
  var pretty = /* @__PURE__ */ __name((stats) => {
23896
- const lines2 = [`${stats.chat.title} \u2014 ${stats.kind}, ${stats.period.since} \u2013 ${stats.period.until}`];
23897
- lines2.push(...Object.entries(stats.totals).map(([name3, totals]) => value2(name3, totals)));
23896
+ const lines3 = [`${stats.chat.title} \u2014 ${stats.kind}, ${stats.period.since} \u2013 ${stats.period.until}`];
23897
+ lines3.push(...Object.entries(stats.totals).map(([name3, totals]) => value2(name3, totals)));
23898
23898
  if (stats.kind === "group") {
23899
- lines2.push(...people("top posters", stats.top.posters, (one) => `${one.messages} messages, ${one.averageChars} chars avg`), ...people("top admins", stats.top.admins, (one) => `${one.deleted} deleted, ${one.removed} removed, ${one.banned} banned`), ...people("top inviters", stats.top.inviters, (one) => `${one.invited} invited`));
23899
+ lines3.push(...people("top posters", stats.top.posters, (one) => `${one.messages} messages, ${one.averageChars} chars avg`), ...people("top admins", stats.top.admins, (one) => `${one.deleted} deleted, ${one.removed} removed, ${one.banned} banned`), ...people("top inviters", stats.top.inviters, (one) => `${one.invited} invited`));
23900
23900
  } else {
23901
- lines2.push(`notifications on for ${stats.notifications.enabled} of ${stats.notifications.total}`);
23901
+ lines3.push(`notifications on for ${stats.notifications.enabled} of ${stats.notifications.total}`);
23902
23902
  if (stats.recentPosts.length > 0) {
23903
- lines2.push("recent posts:", ...stats.recentPosts.slice(0, TOP).map((post) => ` ${post.kind} ${post.id} ${post.views} views, ${post.forwards} forwards, ${post.reactions} reactions`));
23903
+ lines3.push("recent posts:", ...stats.recentPosts.slice(0, TOP).map((post) => ` ${post.kind} ${post.id} ${post.views} views, ${post.forwards} forwards, ${post.reactions} reactions`));
23904
23904
  }
23905
23905
  }
23906
- lines2.push("graphs:", ...Object.entries(stats.graphs).map(([key, graph]) => "error" in graph ? ` ${key} not given: ${graph.error}` : ` ${key} ${graph.x.values.length} points`));
23907
- return lines2.join("\n");
23906
+ lines3.push("graphs:", ...Object.entries(stats.graphs).map(([key, graph]) => "error" in graph ? ` ${key} not given: ${graph.error}` : ` ${key} ${graph.x.values.length} points`));
23907
+ return lines3.join("\n");
23908
23908
  }, "pretty");
23909
23909
 
23910
23910
  // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/cli/messenger/rankings-command.js
@@ -24334,13 +24334,13 @@ var shapeProblem = /* @__PURE__ */ __name((field, value3) => {
24334
24334
  return typeof value3 === "string" ? void 0 : "has to be text";
24335
24335
  }
24336
24336
  }, "shapeProblem");
24337
- var checkField = /* @__PURE__ */ __name((field, raw, { current = {}, settingSchema }) => {
24337
+ var checkField = /* @__PURE__ */ __name((field, raw, { current: current2 = {}, settingSchema }) => {
24338
24338
  const bound2 = field.setting ?? (field.type === "input" ? field.secret : void 0);
24339
24339
  if (blank(raw)) {
24340
- if (field.default !== void 0 && (bound2 === void 0 || current[bound2] === void 0))
24340
+ if (field.default !== void 0 && (bound2 === void 0 || current2[bound2] === void 0))
24341
24341
  return { value: field.default };
24342
24342
  const toggle = field.type === "input" && field.input === "toggle";
24343
- if (field.optional || toggle || bound2 !== void 0 && current[bound2] !== void 0)
24343
+ if (field.optional || toggle || bound2 !== void 0 && current2[bound2] !== void 0)
24344
24344
  return {};
24345
24345
  return { problem: "is needed" };
24346
24346
  }
@@ -24355,7 +24355,7 @@ var checkField = /* @__PURE__ */ __name((field, raw, { current = {}, settingSche
24355
24355
  }
24356
24356
  return { value: raw };
24357
24357
  }, "checkField");
24358
- var walk = /* @__PURE__ */ __name((setup, answers, { current = {}, results = {} } = {}) => {
24358
+ var walk = /* @__PURE__ */ __name((setup, answers, { current: current2 = {}, results = {} } = {}) => {
24359
24359
  const { document, definition: definition2 } = setup;
24360
24360
  const settingSchema = definition2.configuration.settingSchema;
24361
24361
  const fields = /* @__PURE__ */ new Map();
@@ -24369,7 +24369,7 @@ var walk = /* @__PURE__ */ __name((setup, answers, { current = {}, results = {}
24369
24369
  return void 0;
24370
24370
  if (!blank(answers[id5]))
24371
24371
  return answers[id5];
24372
- return field.setting === void 0 ? void 0 : current[field.setting];
24372
+ return field.setting === void 0 ? void 0 : current2[field.setting];
24373
24373
  }, "field"),
24374
24374
  result: /* @__PURE__ */ __name((name3) => results[name3], "result")
24375
24375
  };
@@ -24406,7 +24406,7 @@ var walk = /* @__PURE__ */ __name((setup, answers, { current = {}, results = {}
24406
24406
  shown4 = now;
24407
24407
  }
24408
24408
  for (const field of shown4) {
24409
- const checked3 = checkField(field, answers[field.id], { current, settingSchema });
24409
+ const checked3 = checkField(field, answers[field.id], { current: current2, settingSchema });
24410
24410
  const name3 = field.setting ?? (field.type === "input" ? field.secret : void 0);
24411
24411
  if (checked3.problem) {
24412
24412
  result.errors.push({ input: field.id, setting: field.setting ?? null, message: checked3.problem });
@@ -24475,7 +24475,7 @@ var setupCommand = /* @__PURE__ */ __name((setup) => {
24475
24475
  }, "storeFor");
24476
24476
  const currentOf = /* @__PURE__ */ __name((command, context, { dryRun: dryRun2 = false } = {}) => {
24477
24477
  const { settings, renderer } = context;
24478
- const current = {};
24478
+ const current2 = {};
24479
24479
  let store;
24480
24480
  const keptOf = /* @__PURE__ */ __name((secret) => {
24481
24481
  try {
@@ -24489,17 +24489,17 @@ var setupCommand = /* @__PURE__ */ __name((setup) => {
24489
24489
  if (field.setting !== void 0) {
24490
24490
  const value3 = fromFile(settings, field.setting, void 0).value;
24491
24491
  if (value3 !== void 0)
24492
- current[field.setting] = value3;
24492
+ current2[field.setting] = value3;
24493
24493
  }
24494
24494
  const secret = secretOf(field);
24495
- if (secret === void 0 || secret in current)
24495
+ if (secret === void 0 || secret in current2)
24496
24496
  continue;
24497
24497
  if (dryRun2) {
24498
- current[secret] = { set: true };
24498
+ current2[secret] = { set: true };
24499
24499
  continue;
24500
24500
  }
24501
24501
  let read4;
24502
- Object.defineProperty(current, secret, {
24502
+ Object.defineProperty(current2, secret, {
24503
24503
  enumerable: true,
24504
24504
  get: /* @__PURE__ */ __name(() => {
24505
24505
  read4 ??= { value: keptOf(secret) };
@@ -24507,7 +24507,7 @@ var setupCommand = /* @__PURE__ */ __name((setup) => {
24507
24507
  }, "get")
24508
24508
  });
24509
24509
  }
24510
- return current;
24510
+ return current2;
24511
24511
  }, "currentOf");
24512
24512
  const described2 = /* @__PURE__ */ __name(() => {
24513
24513
  const withSchema = /* @__PURE__ */ __name((blocks = []) => blocks.map((block) => {
@@ -24524,13 +24524,13 @@ var setupCommand = /* @__PURE__ */ __name((setup) => {
24524
24524
  ]));
24525
24525
  return { ...document, steps };
24526
24526
  }, "described");
24527
- const readAnswers = /* @__PURE__ */ __name(async (command, lines2, { noneAllowed = false } = {}) => {
24527
+ const readAnswers = /* @__PURE__ */ __name(async (command, lines3, { noneAllowed = false } = {}) => {
24528
24528
  const input2 = environmentOf(command).stdin ?? process.stdin;
24529
- if (!lines2 && input2.isTTY)
24529
+ if (!lines3 && input2.isTTY)
24530
24530
  throw new CliError("validation_error", `pipe the answers as one JSON object on stdin: echo '{\u2026}' | ${cli} \u2026`, {
24531
24531
  reason: "input.required"
24532
24532
  });
24533
- const text4 = lines2 ? await lines2() : (await bufferedInput(input2, { maxBytes: SETUP_LIMITS.bytes })).toString("utf8");
24533
+ const text4 = lines3 ? await lines3() : (await bufferedInput(input2, { maxBytes: SETUP_LIMITS.bytes })).toString("utf8");
24534
24534
  if (noneAllowed && text4.trim() === "")
24535
24535
  return {};
24536
24536
  let parsed;
@@ -24602,11 +24602,11 @@ var setupCommand = /* @__PURE__ */ __name((setup) => {
24602
24602
  ...checked3
24603
24603
  };
24604
24604
  }, "apply");
24605
- const stepsFor = /* @__PURE__ */ __name((command, json, lines2) => signInSteps({
24605
+ const stepsFor = /* @__PURE__ */ __name((command, json, lines3) => signInSteps({
24606
24606
  diagnostic: contextFor(command, false, true).streams.diagnostic,
24607
24607
  json,
24608
- answers: lines2 !== void 0,
24609
- ...lines2 ? { lines: lines2 } : {}
24608
+ answers: lines3 !== void 0,
24609
+ ...lines3 ? { lines: lines3 } : {}
24610
24610
  }), "stepsFor");
24611
24611
  const show2 = annotate(new Command("show"), {
24612
24612
  effects: LOCAL_READ,
@@ -24639,9 +24639,9 @@ var setupCommand = /* @__PURE__ */ __name((setup) => {
24639
24639
  const json = this.optsWithGlobals();
24640
24640
  const machine = json.json === true || json.jsonl === true;
24641
24641
  const input2 = environmentOf(this).stdin ?? process.stdin;
24642
- const lines2 = answerStdin ? lineReader(input2) : void 0;
24643
- const steps = stepsFor(this, machine, lines2);
24644
- const answers = await readAnswers(this, lines2);
24642
+ const lines3 = answerStdin ? lineReader(input2) : void 0;
24643
+ const steps = stepsFor(this, machine, lines3);
24644
+ const answers = await readAnswers(this, lines3);
24645
24645
  renderAnswer(this, contextFor(this, false, true), itemOf(await apply(this, answers, { dryRun: false, steps })));
24646
24646
  });
24647
24647
  const group = logsInOrOut(annotate(new Command("setup"), {
@@ -24658,7 +24658,7 @@ var setupCommand = /* @__PURE__ */ __name((setup) => {
24658
24658
  const walkThrough = /* @__PURE__ */ __name(async (command) => {
24659
24659
  const context = contextFor(command, true);
24660
24660
  const { renderer, env } = context;
24661
- const current = currentOf(command, context);
24661
+ const current2 = currentOf(command, context);
24662
24662
  const language = systemLanguage(env) ?? "en";
24663
24663
  const text4 = /* @__PURE__ */ __name((id5, params2 = {}) => id5 === void 0 ? "" : (document.texts[language]?.[id5] ?? document.texts.en[id5] ?? id5).replace(/\{([a-z][a-z0-9_]*)\}/g, (all, name3) => params2[name3] ?? all), "text");
24664
24664
  const drawn = drawsHyperlinks(env) ? { link: hyperlink } : {};
@@ -24684,7 +24684,7 @@ var setupCommand = /* @__PURE__ */ __name((setup) => {
24684
24684
  if (Object.hasOwn(answers, id5))
24685
24685
  return answers[id5];
24686
24686
  const setting = allFields(document).find((field) => field.id === id5)?.setting;
24687
- return setting === void 0 ? void 0 : current[setting];
24687
+ return setting === void 0 ? void 0 : current2[setting];
24688
24688
  }, "field"),
24689
24689
  result: /* @__PURE__ */ __name((name3) => results[name3], "result")
24690
24690
  };
@@ -24707,7 +24707,7 @@ var setupCommand = /* @__PURE__ */ __name((setup) => {
24707
24707
  }, "coerce");
24708
24708
  const askField = /* @__PURE__ */ __name(async (field) => {
24709
24709
  const bound2 = field.setting ?? secretOf(field);
24710
- const now = bound2 === void 0 ? void 0 : current[bound2];
24710
+ const now = bound2 === void 0 ? void 0 : current2[bound2];
24711
24711
  const options = field.options ?? [];
24712
24712
  for (const [index, option] of options.entries())
24713
24713
  say(` ${index + 1}) ${text4(option.label)}${option.hint ? ` \u2014 ${text4(option.hint)}` : ""}`);
@@ -24724,7 +24724,7 @@ var setupCommand = /* @__PURE__ */ __name((setup) => {
24724
24724
  for (let tries = 1; ; tries++) {
24725
24725
  const typed2 = await ask(`${label}${toggle}${kept}: `, field.type === "input" && field.input === "password");
24726
24726
  const checked3 = checkField(field, coerce(field, typed2), {
24727
- current,
24727
+ current: current2,
24728
24728
  settingSchema: configuration2.settingSchema
24729
24729
  });
24730
24730
  if (!checked3.problem) {
@@ -25021,25 +25021,25 @@ var staleMcpSessions = /* @__PURE__ */ __name((system) => {
25021
25021
  const root = system.packageRoot;
25022
25022
  if (root === void 0)
25023
25023
  return { checked: false, sessions: [], reason: "this process does not run from an installed package" };
25024
- const lines2 = system.processes();
25025
- if (lines2 === void 0)
25024
+ const lines3 = system.processes();
25025
+ if (lines3 === void 0)
25026
25026
  return { checked: false, sessions: [], reason: `could not list the processes on ${system.platform}` };
25027
25027
  return {
25028
25028
  checked: true,
25029
- sessions: lines2.filter((line7) => line7.pid !== process.pid && isStdioMcp(line7.words, root, system.platform)).map((line7) => ({ pid: line7.pid, version: null }))
25029
+ sessions: lines3.filter((line7) => line7.pid !== process.pid && isStdioMcp(line7.words, root, system.platform)).map((line7) => ({ pid: line7.pid, version: null }))
25030
25030
  };
25031
25031
  }, "staleMcpSessions");
25032
25032
 
25033
25033
  // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/cli/upgrade-command.js
25034
25034
  var RESTART_FROM_APP = "restart them from your agent app (start a new chat, or reload its MCP servers)";
25035
- var mcpWarnings = /* @__PURE__ */ __name((command, current, servers2, stale) => [
25035
+ var mcpWarnings = /* @__PURE__ */ __name((command, current2, servers2, stale) => [
25036
25036
  ...servers2.flatMap((server) => !server.restarted ? [`the HTTP MCP server ${server.name} (PID ${server.pid}) was not restarted: ${server.reason}`] : server.to !== null && server.to === server.from ? [
25037
25037
  `the HTTP MCP server ${server.name} came back on ${command} ${server.to}: it runs from another install than the one upgraded`
25038
25038
  ] : []),
25039
25039
  ...stale === void 0 ? [] : !stale.checked ? [
25040
- `could not check for MCP sessions over stdio (${stale.reason}); any that run keep ${command} ${current} or older \u2014 ${RESTART_FROM_APP}`
25040
+ `could not check for MCP sessions over stdio (${stale.reason}); any that run keep ${command} ${current2} or older \u2014 ${RESTART_FROM_APP}`
25041
25041
  ] : stale.sessions.length > 0 ? [
25042
- `${stale.sessions.length} MCP ${stale.sessions.length === 1 ? "session" : "sessions"} over stdio still ${stale.sessions.length === 1 ? "runs" : "run"} ${command} ${current} or older (PID ${stale.sessions.map((session) => session.pid).join(", ")}) \u2014 ${RESTART_FROM_APP}`
25042
+ `${stale.sessions.length} MCP ${stale.sessions.length === 1 ? "session" : "sessions"} over stdio still ${stale.sessions.length === 1 ? "runs" : "run"} ${command} ${current2} or older (PID ${stale.sessions.map((session) => session.pid).join(", ")}) \u2014 ${RESTART_FROM_APP}`
25043
25043
  ] : []
25044
25044
  ], "mcpWarnings");
25045
25045
  var upgradeCommand = /* @__PURE__ */ __name((app, packageName, contextFor) => grantsAuthority(annotate(new Command("upgrade"), {
@@ -25235,11 +25235,11 @@ var templatesCommand = /* @__PURE__ */ __name((app, options) => {
25235
25235
  const env = options.env();
25236
25236
  refuseAgent(this, env);
25237
25237
  const { address, kind: kind3, channel, schedule } = await addressOf(key, given2, env, stateOf2(app, env));
25238
- const { current, previous: previous2 } = await withStore2(env, (store) => ({
25238
+ const { current: current2, previous: previous2 } = await withStore2(env, (store) => ({
25239
25239
  current: appliedBody(store, address, kind3, schedule),
25240
25240
  previous: store.templates.history(address, 1)[0]?.body
25241
25241
  }));
25242
- const effective = current ?? defaultTemplate(kind3, channel, address.language);
25242
+ const effective = current2 ?? defaultTemplate(kind3, channel, address.language);
25243
25243
  let draft;
25244
25244
  let body;
25245
25245
  if (given2.undo) {
@@ -25462,16 +25462,103 @@ var appUpdate = /* @__PURE__ */ __name((app) => {
25462
25462
  };
25463
25463
  }, "appUpdate");
25464
25464
 
25465
+ // dist/links.js
25466
+ var KINDS = { deals: "deal", people: "person", companies: "organization" };
25467
+ var member2 = /* @__PURE__ */ __name((actor) => actor?.referenced_actor_type === "workspace-member" ? actor.referenced_actor_id : actor?.type === "workspace-member" ? actor.id : null, "member");
25468
+
25469
+ // dist/meetings.js
25470
+ var MEETINGS_PAGE = 50;
25471
+ var DEALS_PAGE = 500;
25472
+ var lines2 = /* @__PURE__ */ __name((segments) => segments.map(({ speech, speaker }) => speaker?.name ? `${speaker.name}: ${speech}` : speech).join("\n"), "lines");
25473
+ var meetingActivity = /* @__PURE__ */ __name((meeting, transcripts, dealsOf) => {
25474
+ const at5 = Date.parse(meeting.start.datetime ?? meeting.start.date ?? meeting.created_at);
25475
+ const on = /* @__PURE__ */ new Map();
25476
+ for (const link of meeting.linked_records) {
25477
+ const kind3 = KINDS[link.object_slug];
25478
+ if (!kind3)
25479
+ continue;
25480
+ on.set(`${kind3}:${link.record_id}`, { kind: kind3, externalId: link.record_id });
25481
+ for (const deal2 of dealsOf.get(link.record_id) ?? [])
25482
+ on.set(`deal:${deal2}`, { kind: "deal", externalId: deal2 });
25483
+ }
25484
+ const body = [meeting.description?.trim(), ...transcripts.map(lines2)].filter(Boolean).join("\n\n");
25485
+ return {
25486
+ externalId: `meeting:${meeting.id.meeting_id}`,
25487
+ kind: "meeting",
25488
+ subject: meeting.title ?? "",
25489
+ body: body || null,
25490
+ done: true,
25491
+ assignee: member2(meeting.created_by_actor) ?? null,
25492
+ createdAt: at5,
25493
+ updatedAt: at5,
25494
+ on: [...on.values()]
25495
+ };
25496
+ }, "meetingActivity");
25497
+ var current = /* @__PURE__ */ __name((entries) => (entries ?? []).flatMap((one) => one.active_until == null && one.target_record_id ? [one.target_record_id] : []), "current");
25498
+ var dealsByContact = /* @__PURE__ */ __name(async (send, context) => {
25499
+ const found = /* @__PURE__ */ new Map();
25500
+ for (let offset = 0; ; offset += DEALS_PAGE) {
25501
+ context?.spend();
25502
+ const { data } = await send("postV2ObjectsByObjectRecordsQuery", {
25503
+ path: { object: "deals" },
25504
+ query: {},
25505
+ headers: {},
25506
+ fields: {},
25507
+ body: JSON.stringify({ limit: DEALS_PAGE, offset, sorts: [{ direction: "desc", attribute: "created_at" }] })
25508
+ });
25509
+ for (const deal2 of data)
25510
+ for (const contact2 of [...current(deal2.values.associated_people), ...current(deal2.values.associated_company)])
25511
+ found.set(contact2, [...found.get(contact2) ?? [], deal2.id.record_id]);
25512
+ if (data.length < DEALS_PAGE)
25513
+ return found;
25514
+ }
25515
+ }, "dealsByContact");
25516
+ var meetingsPage = /* @__PURE__ */ __name(async (send, cursor, run3, context) => {
25517
+ const input2 = { path: {}, headers: {}, fields: {} };
25518
+ run3.scopes ??= send("getV2Self", { ...input2, query: {} }).then((self) => new Set(String(self.scope ?? "").split(/\s+/)));
25519
+ const scopes = await run3.scopes;
25520
+ if (!scopes.has("meeting:read") && !scopes.has("meeting:read-write"))
25521
+ return { items: [], hasMore: false, listedAll: true };
25522
+ const recordings = scopes.has("call_recording:read") || scopes.has("call_recording:read-write");
25523
+ run3.dealsOf ??= dealsByContact(send, context);
25524
+ const dealsOf = await run3.dealsOf;
25525
+ context?.spend();
25526
+ const page = await send("getV2Meetings", {
25527
+ ...input2,
25528
+ query: { limit: String(MEETINGS_PAGE), ...cursor ? { cursor } : {} }
25529
+ });
25530
+ const items = [];
25531
+ for (const meeting of page.data) {
25532
+ const transcripts = [];
25533
+ if (recordings) {
25534
+ const path = { meeting_id: meeting.id.meeting_id };
25535
+ context?.spend();
25536
+ const { data } = await send("getV2MeetingsByMeetingIdCallRecordings", { ...input2, path, query: {} });
25537
+ for (const recording of data.filter((one) => one.status === "completed")) {
25538
+ context?.spend();
25539
+ const { data: full } = await send("getV2MeetingsByMeetingIdCallRecordingsByCallRecordingId", {
25540
+ ...input2,
25541
+ path: { ...path, call_recording_id: recording.id.call_recording_id },
25542
+ query: {}
25543
+ });
25544
+ if (full.transcript?.segments.length)
25545
+ transcripts.push(full.transcript.segments);
25546
+ }
25547
+ }
25548
+ items.push(meetingActivity(meeting, transcripts, dealsOf));
25549
+ }
25550
+ const next = page.pagination.next_cursor;
25551
+ return next ? { items, hasMore: true, nextCursor: `meetings:${next}` } : { items, hasMore: false, listedAll: true };
25552
+ }, "meetingsPage");
25553
+
25465
25554
  // dist/hooks.js
25466
25555
  var described = /* @__PURE__ */ __name((record2, raw) => {
25467
25556
  const [first2] = raw.values?.description ?? [];
25468
25557
  const text4 = typeof first2?.value === "string" ? first2.value.trim() : "";
25469
25558
  return text4 ? { ...record2, metadata: { ...record2.metadata, description: { label: "Description", value: text4 } } } : record2;
25470
25559
  }, "described");
25471
- var KINDS = { deals: "deal", people: "person", companies: "organization" };
25472
25560
  var NOTES_PAGE = 50;
25473
25561
  var TASKS_PAGE = 200;
25474
- var member2 = /* @__PURE__ */ __name((actor) => actor?.referenced_actor_type === "workspace-member" ? actor.referenced_actor_id : actor?.type === "workspace-member" ? actor.id : null, "member");
25475
25562
  var noteActivity = /* @__PURE__ */ __name((note2) => {
25476
25563
  const at5 = Date.parse(note2.created_at);
25477
25564
  const kind3 = KINDS[note2.parent_object];
@@ -25507,49 +25594,54 @@ var taskActivity = /* @__PURE__ */ __name((task, objects) => {
25507
25594
  }, "taskActivity");
25508
25595
  var refused = /* @__PURE__ */ __name((error) => error instanceof CliError && (error.code === "permission_error" || typeof error.details?.scope === "string"), "refused");
25509
25596
  var hooks = {
25510
- // Attio's notes and tasks lists take no time filter, so every sync reads them all, as it reads every record, and the
25511
- // last page says so: one stored and no longer listed was deleted. A token may have one of their scopes and not the
25512
- // other: the list it may not read is a gap, the other is still read, and the gap keeps the sync from removing any.
25513
- extend: /* @__PURE__ */ __name((_base, { call }) => ({
25514
- activities: /* @__PURE__ */ __name(async (_since, page, context) => {
25515
- const [list2, at5] = (page ?? "notes:0").split(":");
25516
- const offset = Number(at5);
25517
- const query = /* @__PURE__ */ __name((limit) => ({ limit: String(limit), offset: String(offset) }), "query");
25518
- const input2 = { path: {}, headers: {}, fields: {} };
25519
- const read4 = /* @__PURE__ */ __name(async (operation, limit, scope) => {
25520
- try {
25521
- return (await call(operation, { ...input2, query: query(limit) })).data;
25522
- } catch (error) {
25523
- if (!refused(error))
25524
- throw error;
25525
- context?.gap({ kind: "activities", scope, message: `${scope} scope missing: no ${list2} were read` });
25526
- return null;
25527
- }
25528
- }, "read");
25529
- if (list2 === "notes") {
25530
- const data2 = await read4("getV2Notes", NOTES_PAGE, "note:read");
25531
- const next = !data2 || data2.length < NOTES_PAGE ? "tasks:0" : `notes:${offset + NOTES_PAGE}`;
25532
- return { items: (data2 ?? []).map(noteActivity), hasMore: true, nextCursor: next };
25533
- }
25534
- const data = await read4("getV2Tasks", TASKS_PAGE, "task:read");
25535
- if (!data)
25536
- return { items: [], hasMore: false };
25537
- if (!data.length)
25538
- return { items: [], hasMore: false, listedAll: true };
25539
- context?.spend();
25540
- const { data: types } = await call("getV2Objects", { ...input2, query: {} });
25541
- const objects = new Map(types.flatMap((one) => {
25542
- const kind3 = KINDS[one.api_slug];
25543
- return kind3 ? [[one.id.object_id, kind3]] : [];
25544
- }));
25545
- const more = data.length === TASKS_PAGE;
25546
- return {
25547
- items: data.map((task) => taskActivity(task, objects)),
25548
- hasMore: more,
25549
- ...more ? { nextCursor: `tasks:${offset + TASKS_PAGE}` } : { listedAll: true }
25550
- };
25551
- }, "activities")
25552
- }), "extend"),
25597
+ // Attio's notes, tasks and meetings are read whole at every sync, as every record is, and the last page of meetings
25598
+ // says so: one stored and no longer listed was deleted. A token may have one of their scopes and not another: the
25599
+ // list it may not read is a gap, the others are still read, and the gap keeps the sync from removing any.
25600
+ extend: /* @__PURE__ */ __name((_base, { call }) => {
25601
+ const run3 = {};
25602
+ return {
25603
+ activities: /* @__PURE__ */ __name(async (_since, page, context) => {
25604
+ const cursor = page ?? "notes:0";
25605
+ const list2 = cursor.slice(0, cursor.indexOf(":"));
25606
+ const at5 = cursor.slice(cursor.indexOf(":") + 1);
25607
+ if (list2 === "meetings")
25608
+ return meetingsPage(call, at5, run3, context);
25609
+ const offset = Number(at5);
25610
+ const query = /* @__PURE__ */ __name((limit) => ({ limit: String(limit), offset: String(offset) }), "query");
25611
+ const input2 = { path: {}, headers: {}, fields: {} };
25612
+ const read4 = /* @__PURE__ */ __name(async (operation, limit, scope) => {
25613
+ try {
25614
+ return (await call(operation, { ...input2, query: query(limit) })).data;
25615
+ } catch (error) {
25616
+ if (!refused(error))
25617
+ throw error;
25618
+ context?.gap({ kind: "activities", scope, message: `${scope} scope missing: no ${list2} were read` });
25619
+ return null;
25620
+ }
25621
+ }, "read");
25622
+ if (list2 === "notes") {
25623
+ const data2 = await read4("getV2Notes", NOTES_PAGE, "note:read");
25624
+ const next = !data2 || data2.length < NOTES_PAGE ? "tasks:0" : `notes:${offset + NOTES_PAGE}`;
25625
+ return { items: (data2 ?? []).map(noteActivity), hasMore: true, nextCursor: next };
25626
+ }
25627
+ const data = await read4("getV2Tasks", TASKS_PAGE, "task:read");
25628
+ if (!data?.length)
25629
+ return { items: [], hasMore: true, nextCursor: "meetings:" };
25630
+ context?.spend();
25631
+ const { data: types } = await call("getV2Objects", { ...input2, query: {} });
25632
+ const objects = new Map(types.flatMap((one) => {
25633
+ const kind3 = KINDS[one.api_slug];
25634
+ return kind3 ? [[one.id.object_id, kind3]] : [];
25635
+ }));
25636
+ const more = data.length === TASKS_PAGE;
25637
+ return {
25638
+ items: data.map((task) => taskActivity(task, objects)),
25639
+ hasMore: true,
25640
+ nextCursor: more ? `tasks:${offset + TASKS_PAGE}` : "meetings:"
25641
+ };
25642
+ }, "activities")
25643
+ };
25644
+ }, "extend"),
25553
25645
  after: { organization: described, person: described },
25554
25646
  // Attio's stages carry no outcome. A won one is celebrated or named so, since a workspace may turn the celebration
25555
25647
  // off; a lost one has only its title to tell it. A new workspace's deal stages are Lead, In Progress, Won 🎉 and Lost.
@@ -33546,7 +33638,7 @@ var addCrmCommandsDefinition = /* @__PURE__ */ __name((program, options) => {
33546
33638
  }
33547
33639
  renderAnswer(command, outputFor(command), body, view5);
33548
33640
  }), "within");
33549
- const example = /* @__PURE__ */ __name((command, ...lines2) => annotate(command, { examples: lines2.map((line7) => `${options.app.command} work ${line7}`) }), "example");
33641
+ const example = /* @__PURE__ */ __name((command, ...lines3) => annotate(command, { examples: lines3.map((line7) => `${options.app.command} work ${line7}`) }), "example");
33550
33642
  const hasLeads = options.leads !== false;
33551
33643
  const dealsAndLeads = hasLeads ? "deals and leads" : "deals";
33552
33644
  example(answerEntity(annotate(program.command("sync"), { effects: FETCH, offline: false, cooperative: true, partial: true }), "crm_sync", crmSync).description(`bring the CRM's copy in the local store up to date: pipelines, companies, contacts, ${dealsAndLeads} that changed since the last sync, or everything with --rescan; a run stops before its deadline or --max-pages and the next one goes on from there`).addHelpText("after", `