@centralu/win32-x64 0.1.0-beta.74 → 0.1.0-beta.76

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.
Binary file
@@ -16,12 +16,12 @@
16
16
  * its own. Spacing (margins, padding, gaps) has no theme variable and stays literal.
17
17
  */
18
18
  :root {
19
- --bg: var(--color-background-secondary, #282320);
20
- --bg-hover: var(--color-background-tertiary, #46413d);
21
- --ink: var(--color-text-primary, #f0ecea);
22
- --danger: var(--color-text-danger, #fb9e86);
23
- --edge: var(--color-border-secondary, #514c48);
24
- --ring: var(--color-ring-primary, #b8b3af);
19
+ --bg: var(--color-background-secondary, #2c2c2e);
20
+ --bg-hover: var(--color-background-tertiary, #48484a);
21
+ --ink: var(--color-text-primary, #f5f5f7);
22
+ --danger: var(--color-text-danger, #ff9f97);
23
+ --edge: var(--color-border-secondary, #545456);
24
+ --ring: var(--color-ring-primary, #409cff);
25
25
  --sans: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', system-ui, sans-serif);
26
26
  --text: var(--font-text-md-size, 13px);
27
27
  --leading: var(--font-text-md-line-height, 1.65);
@@ -34,8 +34,8 @@
34
34
  --sb-inset: var(--centralu-scrollbar-inset, 3px);
35
35
  --sb-radius: var(--centralu-scrollbar-radius, 999px);
36
36
  --sb-track: var(--centralu-scrollbar-track, transparent);
37
- --sb-thumb: var(--centralu-scrollbar-thumb, #403b37);
38
- --sb-thumb-hover: var(--centralu-scrollbar-thumb-hover, #514c48);
37
+ --sb-thumb: var(--centralu-scrollbar-thumb, #48484a);
38
+ --sb-thumb-hover: var(--centralu-scrollbar-thumb-hover, #636366);
39
39
  }
40
40
  body {
41
41
  margin: 16px;
@@ -1,11 +1,11 @@
1
1
  {
2
- "commit": "a599200",
2
+ "commit": "f6d2451",
3
3
  "protocolVersion": 1,
4
4
  "hostProof": 1,
5
5
  "tokenOnStdin": 1,
6
6
  "verifiers": 1,
7
7
  "keyPairing": 1,
8
- "builtAt": "2026-11-16T15:31:22.591Z",
8
+ "builtAt": "2026-11-17T16:06:01.502Z",
9
9
  "runtime": "system-node",
10
10
  "platform": "win32",
11
11
  "arch": "x64"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "centralu",
3
- "version": "0.1.0-beta.74",
3
+ "version": "0.1.0-beta.76",
4
4
  "description": "Run, watch and steer several Claude Code and Codex CLI sessions from one window",
5
5
  "license": "MIT",
6
6
  "author": "ijun17",
@@ -38,9 +38,9 @@
38
38
  "win32"
39
39
  ],
40
40
  "optionalDependencies": {
41
- "@centralu/darwin-arm64": "0.1.0-beta.74",
42
- "@centralu/linux-arm64": "0.1.0-beta.74",
43
- "@centralu/linux-x64": "0.1.0-beta.74",
44
- "@centralu/win32-x64": "0.1.0-beta.74"
41
+ "@centralu/darwin-arm64": "0.1.0-beta.76",
42
+ "@centralu/linux-arm64": "0.1.0-beta.76",
43
+ "@centralu/linux-x64": "0.1.0-beta.76",
44
+ "@centralu/win32-x64": "0.1.0-beta.76"
45
45
  }
46
46
  }
@@ -43046,7 +43046,7 @@ import { dirname as dirname27, join as join58 } from "node:path";
43046
43046
  import { mkdirSync as mkdirSync21, readFileSync as readFileSync27, writeSync as writeSync4 } from "node:fs";
43047
43047
 
43048
43048
  // packages/protocol/src/version.generated.ts
43049
- var APP_VERSION = "0.1.0-beta.74";
43049
+ var APP_VERSION = "0.1.0-beta.76";
43050
43050
 
43051
43051
  // packages/protocol/src/brand.ts
43052
43052
  var APP_NAME = "Centralu";
@@ -59798,6 +59798,7 @@ var appScoped = { sessionId: external_exports.string().optional() };
59798
59798
  var persistedSeq = { seq: external_exports.number().optional() };
59799
59799
  var APP_VIEWS_LIVE_PER_SESSION = 3;
59800
59800
  var STOP_NOT_CONFIRMED_LABEL = "stop not confirmed";
59801
+ var MailDelivered = external_exports.object({ threadId: external_exports.string(), messageId: external_exports.string() });
59801
59802
  var AppChangeCause = external_exports.looseObject({ kind: external_exports.string(), instanceId: external_exports.string().optional() });
59802
59803
  var MessageDelta = external_exports.object({
59803
59804
  ...base,
@@ -60233,7 +60234,13 @@ var NormalizedEvent = external_exports.discriminatedUnion("type", [
60233
60234
  /** What the explanation names, one per line (the settings Codex ignored) */
60234
60235
  items: external_exports.array(external_exports.string()).optional(),
60235
60236
  /** What would make the notice go away, or that nothing needs doing */
60236
- hint: external_exports.string().optional()
60237
+ hint: external_exports.string().optional(),
60238
+ /**
60239
+ * A mail delivery's line (`label: 'mail'`, #2333): the messages it delivered, each with the chain it is in (`mail.thread`'s `threadId`), so the
60240
+ * window can fold the line open to show them. Absent from an older host, from a row stored before it and from the mailbox's other lines: the line
60241
+ * then does not fold. Malformed, it reads as absent
60242
+ */
60243
+ mail: external_exports.array(MailDelivered).optional().catch(void 0)
60237
60244
  }),
60238
60245
  /**
60239
60246
  * This session was born from a handoff, and the predecessor's note is pinned here (#102).
@@ -63722,8 +63729,7 @@ var THEME_PRESETS = [
63722
63729
  { id: "dark", name: "Dark", base: "dark" },
63723
63730
  { id: "light", name: "Light", base: "light" },
63724
63731
  { id: "hc-dark", name: "High contrast dark", base: "dark" },
63725
- { id: "hc-light", name: "High contrast light", base: "light" },
63726
- { id: "graphite", name: "Graphite", base: "dark" }
63732
+ { id: "hc-light", name: "High contrast light", base: "light" }
63727
63733
  ];
63728
63734
  function themeSlug(name) {
63729
63735
  return name.toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 48) || "theme";
@@ -110478,7 +110484,7 @@ var MailDelivery = class {
110478
110484
  const party = parseAddress(recipient);
110479
110485
  if (held3 > 0 && party?.kind === "session") {
110480
110486
  const n = held3 === 1 ? "A delivery" : `${held3} deliveries`;
110481
- this.sessions.note(party.sessionId, `\u2709 ${n} may have reached you although the tool reported a failure, and was not sent again: the Inbox has Resend and Dismiss`);
110487
+ this.sessions.note(party.sessionId, `${n} may have reached you although the tool reported a failure, and was not sent again: the Inbox has Resend and Dismiss`);
110482
110488
  }
110483
110489
  }
110484
110490
  /** A delivery the previous host left half done is held or sent again (`reconcileInterrupted`), and the receiver is told when it is held */
@@ -110488,7 +110494,7 @@ var MailDelivery = class {
110488
110494
  const party = parseAddress(recipient);
110489
110495
  if (held3 > 0 && party?.kind === "session") {
110490
110496
  const n = held3 === 1 ? "A delivery" : `${held3} deliveries`;
110491
- this.sessions.note(party.sessionId, `\u2709 ${n} may not have arrived when Centralu restarted, and was not sent again: the Inbox has Resend and Dismiss`);
110497
+ this.sessions.note(party.sessionId, `${n} may not have arrived when Centralu restarted, and was not sent again: the Inbox has Resend and Dismiss`);
110492
110498
  }
110493
110499
  }
110494
110500
  } catch (e) {
@@ -110575,7 +110581,7 @@ var MailDelivery = class {
110575
110581
  const inputId = joins ? randomUUID11() : void 0;
110576
110582
  const depth = Math.max(0, ...drained.messageIds.map((id3) => this.records.message(id3)?.facts.agentDepth ?? 0));
110577
110583
  try {
110578
- await this.sessions.deliver(sessionId, { text: drained.text, quiet: quiet2, line: drained.line, wanted: () => drained.messageIds.some((id3) => this.records.recipient(id3, recipient)?.settled !== "withdrawn"), ...joins ? { joins, id: inputId } : {}, ...shown3 ? { shown: shown3 } : {}, ...depth ? { depth } : {} }, (e) => {
110584
+ await this.sessions.deliver(sessionId, { text: drained.text, quiet: quiet2, line: drained.line, listed: drained.listed, wanted: () => drained.messageIds.some((id3) => this.records.recipient(id3, recipient)?.settled !== "withdrawn"), ...joins ? { joins, id: inputId } : {}, ...shown3 ? { shown: shown3 } : {}, ...depth ? { depth } : {} }, (e) => {
110579
110585
  cancelTurn();
110580
110586
  if (delivered.at !== void 0) this.takeBack(recipient, drained.messageIds, delivered.at, e);
110581
110587
  });
@@ -110644,7 +110650,7 @@ var MailDelivery = class {
110644
110650
  const work = drained.workMessage === null ? void 0 : this.records.message(drained.workMessage);
110645
110651
  const m = drained.workMessage === null ? drained.messageIds.map((id3) => this.records.message(id3)).find((n) => n !== void 0 && isSendNote(n)) : work?.kind === "task" && SEND_ORIGINS.has(work.origin ?? "") ? work : void 0;
110646
110652
  const from = m && parseAddress(m.sender);
110647
- return m && from?.kind === "session" ? { senderId: from.sessionId, text: m.body } : void 0;
110653
+ return m && from?.kind === "session" ? { senderId: from.sessionId, text: m.body, messageId: m.id } : void 0;
110648
110654
  }
110649
110655
  /** What the receiver's conversation shows as a session's message (`MailInput.shown`): the delegated task, else a card's notice, from its session */
110650
110656
  shownOf(drained) {
@@ -110654,7 +110660,7 @@ var MailDelivery = class {
110654
110660
  for (const id3 of drained.messageIds) {
110655
110661
  const m = this.records.message(id3);
110656
110662
  const about = m?.facts.card ? parseAddress(m.facts.card.session) : void 0;
110657
- if (m && about?.kind === "session") return { senderId: about.sessionId, text: m.body, alone };
110663
+ if (m && about?.kind === "session") return { senderId: about.sessionId, text: m.body, alone, messageId: id3 };
110658
110664
  }
110659
110665
  return void 0;
110660
110666
  }
@@ -120700,7 +120706,16 @@ function buildMessageFrame(items, calls = PLAIN_MESSAGE_CALLS, budget = MAIL_FRA
120700
120706
  });
120701
120707
  }
120702
120708
  function deliveryLine(messages2, relations) {
120703
- return `\u2709 ${messages2} ${messages2 === 1 ? "message" : "messages"}, from ${[...relations].join(", ")}`;
120709
+ const parties = [...relations];
120710
+ const from = parties.length > 1 ? `${parties.slice(0, -1).join(", ")} and ${parties.at(-1)}` : parties[0] ?? "";
120711
+ return `${messages2} ${messages2 === 1 ? "message" : "messages"} from ${from}`;
120712
+ }
120713
+ function mailLine(listed2, leaveOut) {
120714
+ const rest = listed2.filter((l) => l.messageId !== leaveOut);
120715
+ return {
120716
+ line: rest.length === 0 ? "" : deliveryLine(rest.length, new Set(rest.map((l) => l.relation))),
120717
+ mail: rest.map(({ threadId, messageId }) => ({ threadId, messageId }))
120718
+ };
120704
120719
  }
120705
120720
 
120706
120721
  // packages/agent-host/src/sessions/script-messages.ts
@@ -124392,7 +124407,8 @@ ${attachments.map((a) => `@${a.path}`).join("\n")}` : text3;
124392
124407
  }
124393
124408
  if (input.skipLine?.()) return;
124394
124409
  const shown3 = !input.quiet && input.shown !== void 0 && this.showSent(sessionId, input.shown);
124395
- if (!shown3 || !input.shown?.alone) this.onEvent({ type: "notice", sessionId, level: "info", from: "Centralu", label: input.label ?? "mail", text: input.line });
124410
+ const { line, mail } = input.listed ? mailLine(input.listed, shown3 ? input.shown?.messageId : void 0) : { line: input.line, mail: [] };
124411
+ if (line) this.onEvent({ type: "notice", sessionId, level: "info", from: "Centralu", label: input.label ?? "mail", text: line, ...mail.length ? { mail } : {} });
124396
124412
  }
124397
124413
  /**
124398
124414
  * A delegated task or a card's notice the mailbox gave, written in the receiver's conversation as its sender's message (`deliverMail`): stored and shown, never
@@ -124578,7 +124594,7 @@ var MailSessionsView = class {
124578
124594
  /** Puts a notice from Centralu into the session's process, quietly (`tellsMailNow`). It stops nothing: the person's close tells a session its work is not wanted, and the session decides */
124579
124595
  async tellMailNow(sessionId, text3) {
124580
124596
  try {
124581
- await this.host.events.deliverMail(sessionId, { text: `[Centralu] ${text3}`, quiet: true, line: "\u2709 Centralu told it the person closed its work" });
124597
+ await this.host.events.deliverMail(sessionId, { text: `[Centralu] ${text3}`, quiet: true, line: "Centralu told it the person closed its work" });
124582
124598
  } catch (e) {
124583
124599
  console.error(`[mail] could not tell ${sessionId.slice(0, 8)} that the person closed its work (${errorMessage(e)}); the notice goes with its next mail`);
124584
124600
  throw e;
@@ -128726,7 +128742,7 @@ var AcpAdapter = class {
128726
128742
  const label = this.profile.descriptor.label;
128727
128743
  const launch2 = await this.profile.launch(opts);
128728
128744
  if (!launch2) throw toolNotInstalled(label, this.profile.descriptor.install);
128729
- const spec = { command: launch2.command, args: launch2.args, cwd: launch2.cwd ?? opts.cwd, env: { ...process.env, ...launch2.env } };
128745
+ const spec = { command: launch2.command, args: launch2.args, cwd: opts.cwd, env: { ...process.env, ...launch2.env } };
128730
128746
  const source = opts.processSource;
128731
128747
  const shape = this.profile.shape;
128732
128748
  if (source?.adopt) await closeAdopted(source.adopt, opts.sessionId, emit).catch(async (err) => {
@@ -129379,7 +129395,7 @@ function agyEnv(home, browser) {
129379
129395
  return { GEMINI_HOME: home.geminiHome, BROWSER: browser };
129380
129396
  }
129381
129397
  function agyLaunch(home, archive, browser) {
129382
- return { command: agyProgram(home, archive), args: [...archive.args], cwd: home.root, env: agyEnv(home, browser) };
129398
+ return { command: agyProgram(home, archive), args: [...archive.args], env: agyEnv(home, browser) };
129383
129399
  }
129384
129400
 
129385
129401
  // packages/agent-host/src/adapters/antigravity/shape.ts
@@ -129490,7 +129506,7 @@ async function runSignIn(home, archive, signal, deps = {}) {
129490
129506
  openUrl(url2);
129491
129507
  };
129492
129508
  const launch2 = agyLaunch(home, archive, folder.browser);
129493
- const spec = { ...launch2, env: { ...process.env, ...launch2.env } };
129509
+ const spec = { ...launch2, cwd: home.root, env: { ...process.env, ...launch2.env } };
129494
129510
  const proc = startToolProcess(spec, deps.spawn ? { spawn: deps.spawn } : {});
129495
129511
  const lines = lineSplitter((line) => {
129496
129512
  const m = URL_LINE.exec(line);
@@ -129715,7 +129731,7 @@ async function gather() {
129715
129731
  const home = agyHome(dataRoot(), AGY_RELEASE.version);
129716
129732
  if (!archive || !isInstalled(home, archive)) throw new Error("Antigravity is not installed by Centralu on this machine");
129717
129733
  const launch2 = agyLaunch(home, archive, "");
129718
- const initialize = await acpInitialize({ ...launch2, env: { ...process.env, ...launch2.env } }, "antigravity-surface", agyStderrLine);
129734
+ const initialize = await acpInitialize({ ...launch2, cwd: home.root, env: { ...process.env, ...launch2.env } }, "antigravity-surface", agyStderrLine);
129719
129735
  return { version: AGY_RELEASE.version, initialize };
129720
129736
  }
129721
129737
  function readAgySurface(inputs) {
@@ -130703,7 +130719,12 @@ var INJECTED_TAGS = [
130703
130719
  "command-args",
130704
130720
  "local-command-stdout",
130705
130721
  "local-command-stderr",
130706
- "user-prompt-submit-hook"
130722
+ "user-prompt-submit-hook",
130723
+ /*
130724
+ * Claude Code's notice that a background task ended (#2323). A Claude transcript says who wrote such a line
130725
+ * (claude/history.ts `writtenByTheCli`); the tag is for a line read without that, from an SDK or CLI that does not give it
130726
+ */
130727
+ "task-notification"
130707
130728
  ];
130708
130729
  var BLOCK = new RegExp(`<(${INJECTED_TAGS.join("|")})\\b[^>]*>[\\s\\S]*?</\\1>`, "gi");
130709
130730
  var OPEN_ONLY = new RegExp(`<(${INJECTED_TAGS.join("|")})\\b[^>]*>[\\s\\S]*$`, "i");
@@ -131047,8 +131068,8 @@ async function readClaudeTranscriptTail(externalId, cwd, last) {
131047
131068
  var COMPACT_SUMMARY = /^This session is being continued from a previous conversation that ran out of context\./;
131048
131069
  async function readClaudeHistory(externalId, cwd, limit) {
131049
131070
  const sdk = await sessionApi();
131050
- if (!sdk?.getSessionMessages) throw new Error(UNSUPPORTED);
131051
- const rows3 = await sdk.getSessionMessages(externalId, { dir: cwd });
131071
+ if (!sdk) throw new Error(UNSUPPORTED);
131072
+ const { rows: rows3, byTheCli } = await readTranscript(sdk, externalId, cwd);
131052
131073
  if (!Array.isArray(rows3)) return [];
131053
131074
  const out = [];
131054
131075
  const agents = /* @__PURE__ */ new Set();
@@ -131056,13 +131077,40 @@ async function readClaudeHistory(externalId, cwd, limit) {
131056
131077
  try {
131057
131078
  const message = readableMessage(r?.message);
131058
131079
  if (r?.type === "assistant") out.push(...assistantLines(message, agents));
131059
- else if (r?.type === "user") out.push(...userLines(message, agents, isCentraluInputId(r.uuid)));
131080
+ else if (r?.type === "user") {
131081
+ const sent = isCentraluInputId(r.uuid);
131082
+ out.push(...userLines(message, agents, sent, !sent && typeof r.uuid === "string" && byTheCli.has(r.uuid)));
131083
+ }
131060
131084
  } catch (err) {
131061
131085
  console.error(`[claude] a transcript row was skipped on read-back: ${err.message}`);
131062
131086
  }
131063
131087
  }
131064
131088
  return lastLines(out, limit);
131065
131089
  }
131090
+ async function readTranscript(sdk, externalId, cwd) {
131091
+ if (!sdk.getSessionMessages) throw new Error(UNSUPPORTED);
131092
+ if (sdk.importSessionToStore) {
131093
+ const kept = [];
131094
+ const store2 = {
131095
+ append: async (_key, batch) => void kept.push(...batch),
131096
+ load: async (key2) => isObj(key2) && key2.subpath !== void 0 ? null : kept
131097
+ };
131098
+ try {
131099
+ await sdk.importSessionToStore(externalId, store2, { dir: cwd, includeSubagents: false });
131100
+ const rows3 = await sdk.getSessionMessages(externalId, { dir: cwd, sessionStore: store2 });
131101
+ const byTheCli = /* @__PURE__ */ new Set();
131102
+ for (const e of kept) if (isObj(e) && e.type === "user" && typeof e.uuid === "string" && writtenByTheCli(e)) byTheCli.add(e.uuid);
131103
+ return { rows: rows3, byTheCli };
131104
+ } catch (err) {
131105
+ console.error(`[claude] the transcript's own entries could not be read, so who wrote a line is judged by its text: ${errorMessage(err)}`);
131106
+ }
131107
+ }
131108
+ return { rows: await sdk.getSessionMessages(externalId, { dir: cwd }), byTheCli: /* @__PURE__ */ new Set() };
131109
+ }
131110
+ function writtenByTheCli(entry) {
131111
+ if (entry.isMeta === true || entry.promptSource === "system") return true;
131112
+ return isObj(entry.origin) && entry.origin.kind !== "human";
131113
+ }
131066
131114
  function readableMessage(message) {
131067
131115
  if (typeof message === "string") return { content: [{ type: "text", text: message }] };
131068
131116
  if (!isObj(message)) return { content: [] };
@@ -131085,10 +131133,10 @@ function agentResult(e, agents) {
131085
131133
  return toolResultEvent(HISTORY_SESSION, e.callId, e.ok, "", AGENT_REPORT_NOT_RECORDED);
131086
131134
  }
131087
131135
  var INTERRUPT_LINE = /^\[Request interrupted by user( for tool use)?\]$/;
131088
- function userLines(message, agents, sent) {
131136
+ function userLines(message, agents, sent, cli) {
131089
131137
  const raw = userText(message);
131090
131138
  if (COMPACT_SUMMARY.test(raw)) return [{ role: "system", event: { type: "compaction", sessionId: HISTORY_SESSION, failed: false } }];
131091
- const text3 = INTERRUPT_LINE.test(raw) ? "" : stripInjectedBlocks(raw);
131139
+ const text3 = cli || INTERRUPT_LINE.test(raw) ? "" : stripInjectedBlocks(raw);
131092
131140
  const note = isCentraluNote(text3);
131093
131141
  if (note && !sent) console.error("[claude] Centralu's Continue note is in the transcript without the input id Centralu gave it: this CLI does not keep it. The catch-up recognises the note by its text");
131094
131142
  const out = text3 ? [{ role: "user", text: text3, ...sent || note ? { sent: true } : {} }] : [];
@@ -148509,8 +148557,10 @@ var SessionManager = class {
148509
148557
  );
148510
148558
  for (const s of leavesFirst) await this.trash.trashSession(s.id).catch(() => {
148511
148559
  });
148512
- const root3 = this.projectRegistry.projectRow(projectId)?.path;
148560
+ const row = this.projectRegistry.projectRow(projectId);
148561
+ const root3 = row?.path;
148513
148562
  this.store.trash.deleteProject(projectId);
148563
+ if (row) this.emit({ type: "projects_changed" });
148514
148564
  this.apps.appsHub?.rt.forgetProject(projectId);
148515
148565
  this.files.forgetProject(projectId, root3);
148516
148566
  }
@@ -150096,7 +150146,7 @@ var MessageService = class {
150096
150146
  const kept = turnStarts ? candidates.filter((c) => !isWork(c) || groupOf(c) === picked) : candidates;
150097
150147
  const workMessage = !turnStarts || opts.joining ? null : handedOn ?? (toAssistant ? kept.find((c) => c.request)?.message.id ?? null : picked);
150098
150148
  const items = [];
150099
- const relations = /* @__PURE__ */ new Set();
150149
+ const given = [];
150100
150150
  let wake = false;
150101
150151
  let immediate = false;
150102
150152
  let needsReply = false;
@@ -150105,10 +150155,11 @@ var MessageService = class {
150105
150155
  if (message.urgent || isPerson(message.sender)) immediate = true;
150106
150156
  if (message.kind === "message" && message.needsReply) needsReply = true;
150107
150157
  const relation = this.relation(recipient, message);
150108
- relations.add(relation);
150158
+ given.push({ threadId: message.rootId, messageId: message.id, relation });
150109
150159
  items.push(this.frameItem(recipient, message, relation, down && row.deliveredAt === null, row.lastError === "maybe_repeated"));
150110
150160
  }
150111
150161
  const frame = buildMessageFrame(items, this.opts.calls?.(recipient));
150162
+ const listed2 = given.filter((l) => frame.shown.includes(l.messageId));
150112
150163
  return {
150113
150164
  text: frame.text,
150114
150165
  messageIds: frame.shown,
@@ -150117,7 +150168,8 @@ var MessageService = class {
150117
150168
  wake,
150118
150169
  immediate,
150119
150170
  needsReply,
150120
- line: items.length === 0 ? "" : deliveryLine(items.length, relations),
150171
+ line: mailLine(listed2).line,
150172
+ listed: listed2,
150121
150173
  heldBack,
150122
150174
  workMessage,
150123
150175
  asker: turnStarts && toAssistant ? picked : null
@@ -153637,8 +153689,13 @@ var Qualifier = class {
153637
153689
  if ("projectId" in p) out.projectId = this.maybeId(p.projectId);
153638
153690
  if (typeof p.instanceId === "string") out.instanceId = this.id(p.instanceId);
153639
153691
  if (isObj(p.detail)) out.detail = this.approvalDetail(p.detail);
153692
+ if (p.type === "notice" && "mail" in p) out.mail = this.delivered(p.mail);
153640
153693
  return out;
153641
153694
  }
153695
+ /** A mail line's messages (#2333): each chain qualified, so the line opens it on the machine it is on (`mail.thread`). The message id is every host's */
153696
+ delivered(mail) {
153697
+ return Array.isArray(mail) ? mail.map((d2) => isObj(d2) ? { ...d2, threadId: this.maybeId(d2.threadId) } : d2) : mail;
153698
+ }
153642
153699
  /** `ApprovalDetail`: the kinds that name a project */
153643
153700
  approvalDetail(d2) {
153644
153701
  if (!isObj(d2)) return d2;
@@ -153831,6 +153888,9 @@ var Qualifier = class {
153831
153888
  }
153832
153889
  case "handoff":
153833
153890
  return { ...base2, fromSessionId: this.maybeId(e.fromSessionId) };
153891
+ // A mail line live, as `payload` qualifies it stored
153892
+ case "notice":
153893
+ return "mail" in e ? { ...base2, mail: this.delivered(e.mail) } : base2;
153834
153894
  case "session_owner":
153835
153895
  return { ...base2, askedBy: (sid !== void 0 ? this.ownerOf?.(sid) : void 0) ?? this.maybeId(e.askedBy), parentSessionId: this.maybeId(e.parentSessionId) };
153836
153896
  case "approval_request":
@@ -159447,6 +159507,92 @@ async function askHubAuto(call2, allowed) {
159447
159507
  // packages/agent-host/src/links/linked-machine-connection.ts
159448
159508
  import { randomBytes as randomBytes15 } from "node:crypto";
159449
159509
 
159510
+ // packages/agent-host/src/links/pending-project-deletes.ts
159511
+ var TRIES = 5;
159512
+ var PendingProjectDeletes = class {
159513
+ constructor(host) {
159514
+ this.host = host;
159515
+ }
159516
+ host;
159517
+ /** The failures in a row of each delete asked in this run, by project */
159518
+ failed = /* @__PURE__ */ new Map();
159519
+ /** This machine's, oldest first */
159520
+ owed() {
159521
+ return this.host.list.read().filter((d2) => d2.machine === this.host.machine.id);
159522
+ }
159523
+ drop(keeps) {
159524
+ const all = this.host.list.read();
159525
+ const left = all.filter((d2) => d2.machine !== this.host.machine.id || keeps(d2));
159526
+ if (left.length !== all.length) this.host.list.write(left);
159527
+ }
159528
+ /** Whether a delete is still owed: one the machine failed is asked again while the link holds (`readLists`) */
159529
+ get any() {
159530
+ return this.owed().length > 0;
159531
+ }
159532
+ /** Whether one is owed that the machine was not asked for yet: kept while it was being asked for the others */
159533
+ get unasked() {
159534
+ return this.owed().some((d2) => !this.failed.has(d2.projectId));
159535
+ }
159536
+ /**
159537
+ * Keeps the delete of `projectId` (the machine's own id) and takes the project and its sessions out of the hub's
159538
+ * lists at once. Asked twice, it is kept once
159539
+ */
159540
+ keep(projectId) {
159541
+ const { machine, mirror } = this.host;
159542
+ const id3 = machine.id;
159543
+ const projects = mirror.read(id3, "projects") ?? [];
159544
+ const project2 = projects.find((p) => isObj(p) && p.id === projectId);
159545
+ const owed = this.owed().find((d2) => d2.projectId === projectId);
159546
+ const name = owed?.name ?? (isObj(project2) && typeof project2.name === "string" ? project2.name : projectId);
159547
+ if (!owed) this.host.list.write([...this.host.list.read(), { machine: id3, projectId, name, at: Date.now() }]);
159548
+ for (const s of mirror.read(id3, "sessions") ?? []) {
159549
+ if (isObj(s) && s.projectId === projectId && typeof s.id === "string") this.host.heard({ type: "session_deleted", sessionId: s.id });
159550
+ }
159551
+ if (project2 !== void 0) mirror.replace(id3, "projects", projects.filter((p) => p !== project2));
159552
+ this.host.heard({ type: "projects_changed" });
159553
+ this.host.log(`[links] ${machine.name}: project "${name}" was deleted here while it is away; it is deleted there when the link is back`);
159554
+ }
159555
+ /**
159556
+ * Asks the machine for every delete owed, at its hello and again while one it failed stays owed. `linkUp` says whether
159557
+ * the link still holds after a call failed: an answer that never came over a link that went is no try
159558
+ */
159559
+ async apply(call2, linkUp) {
159560
+ const { name } = this.host.machine;
159561
+ const log = (line) => this.host.log(line);
159562
+ for (const d2 of this.owed()) {
159563
+ try {
159564
+ await call2("projects.delete", { projectId: d2.projectId });
159565
+ log(`[links] ${name}: deleted project "${d2.name}", as asked here while it was away`);
159566
+ if (this.failed.has(d2.projectId)) this.host.heard({ type: "projects_changed" });
159567
+ } catch (err) {
159568
+ if (!linkUp()) {
159569
+ log(`[links] ${name}: the link went before it answered the delete of project "${d2.name}"; it is asked again when the link is back`);
159570
+ return;
159571
+ }
159572
+ const failed5 = (this.failed.get(d2.projectId) ?? 0) + 1;
159573
+ const why2 = older2(err) ? `${name} runs an older Centralu, which cannot do this` : errorMessage(err);
159574
+ if (!older2(err) && failed5 < TRIES) {
159575
+ this.failed.set(d2.projectId, failed5);
159576
+ log(`[links] ${name}: could not delete project "${d2.name}", as asked here while it was away: ${why2}. It is asked again`);
159577
+ continue;
159578
+ }
159579
+ log(`[links] ${name}: could not delete project "${d2.name}", as asked here while it was away: ${why2}. The project is listed again`);
159580
+ this.host.tell(
159581
+ `Couldn't delete "${d2.name}" on ${name}, so it's back in the list. ${older2(err) ? `Update Centralu on ${name}, then delete it again.` : "Delete it again to try once more."}`,
159582
+ `project-delete:${d2.machine}:${d2.projectId}:${d2.at}`
159583
+ );
159584
+ }
159585
+ this.failed.delete(d2.projectId);
159586
+ this.drop((x) => x.projectId !== d2.projectId);
159587
+ }
159588
+ }
159589
+ /** The machine was removed from the hub: nothing is owed to it */
159590
+ forget() {
159591
+ this.failed.clear();
159592
+ this.drop(() => false);
159593
+ }
159594
+ };
159595
+
159450
159596
  // packages/agent-host/src/links/remote-client.ts
159451
159597
  var MAX_INCOMING_CALLS = 16;
159452
159598
  var DEFAULT_CALL_TIMEOUT_MS = 2e5;
@@ -159994,6 +160140,7 @@ function hiddenKind(s) {
159994
160140
  var RETRY_MS2 = [2e3, 5 * 6e4];
159995
160141
  var LINK_REDIALS = 5;
159996
160142
  var STABLE_MS = 6e4;
160143
+ var DELETE_RETRY_MS = 15e3;
159997
160144
  var RESTARTS = { max: 3, windowMs: 10 * 6e4 };
159998
160145
  var KEEPS_TRYING = "reconnecting";
159999
160146
  var WAITS_FOR_PERSON = "press Connect to try again";
@@ -160016,6 +160163,14 @@ var LinkedMachineConnection = class {
160016
160163
  this.tunnel = tunnel;
160017
160164
  this.deps = deps;
160018
160165
  this.q = new Qualifier(record2.id, record2.slot, deps.ownerOf);
160166
+ this.pendingDeletes = new PendingProjectDeletes({
160167
+ machine: this,
160168
+ list: deps.projectDeletes,
160169
+ mirror: deps.mirror,
160170
+ heard: (event) => this.onEvent(event),
160171
+ tell: deps.tellPerson,
160172
+ log: (line) => deps.log?.(line)
160173
+ });
160019
160174
  for (const s of deps.mirror.read(record2.id, "sessions") ?? []) this.classify(s);
160020
160175
  this.lastConnectedAt = record2.lastConnectedAt ?? null;
160021
160176
  for (const [credential, at2] of Object.entries(record2.revoked ?? {})) {
@@ -160029,6 +160184,8 @@ var LinkedMachineConnection = class {
160029
160184
  tunnel;
160030
160185
  deps;
160031
160186
  q;
160187
+ /** The projects the person deleted while this machine could not be asked, deleted there at its next hello (#2330) */
160188
+ pendingDeletes;
160032
160189
  status = "connecting";
160033
160190
  error = null;
160034
160191
  versions = null;
@@ -160092,6 +160249,8 @@ var LinkedMachineConnection = class {
160092
160249
  attempt = 0;
160093
160250
  /** Starts the backoff over once the host that last said hello has stayed up `STABLE_MS` */
160094
160251
  stableTimer;
160252
+ /** The next try of a delete the machine failed (`readLists`) */
160253
+ deleteRetryTimer;
160095
160254
  /** When the link started a host there by itself, within the last `RESTARTS.windowMs` (#1143) */
160096
160255
  autoStarts = [];
160097
160256
  /**
@@ -161089,22 +161248,42 @@ var LinkedMachineConnection = class {
161089
161248
  this.client = client;
161090
161249
  client.connect();
161091
161250
  }
161251
+ /**
161252
+ * The machine's lists, into the mirror. What the person deleted here while it was away goes first (#2330), so the lists
161253
+ * read after are without it; and again at once when a delete was kept while they were being read. Nothing awaits
161254
+ * between the lists and `connected` (`onHello`), so no delete waits unasked for a machine that can be asked. A delete the
161255
+ * machine failed stays owed (pending-project-deletes.ts): it is asked again, and the lists read again, after a pause
161256
+ * for as long as this link holds; the next hello asks it otherwise
161257
+ */
161258
+ async readLists(client) {
161259
+ clearTimeout(this.deleteRetryTimer);
161260
+ do {
161261
+ await this.pendingDeletes.apply((method, params) => client.call(method, params), () => client.connected);
161262
+ try {
161263
+ await Promise.all(
161264
+ ["sessions", "projects"].map(async (kind) => {
161265
+ const list2 = await client.call(kind === "sessions" ? "sessions.list" : "projects.list", {});
161266
+ if (Array.isArray(list2)) this.observe(kind, list2);
161267
+ })
161268
+ );
161269
+ } catch (err) {
161270
+ this.deps.log?.(`[links] ${this.name}: could not read its lists after connecting: ${err.message}`);
161271
+ }
161272
+ } while (this.client === client && client.connected && this.pendingDeletes.unasked);
161273
+ if (this.client !== client || !client.connected || !this.pendingDeletes.any) return;
161274
+ clearTimeout(this.deleteRetryTimer);
161275
+ this.deleteRetryTimer = setTimeout(() => {
161276
+ if (this.client === client && client.connected) void this.readLists(client);
161277
+ }, this.deps.deleteRetryMs ?? DELETE_RETRY_MS);
161278
+ this.deleteRetryTimer.unref?.();
161279
+ }
161092
161280
  async onHello(client, h) {
161093
161281
  if (this.client !== client) return;
161094
161282
  if (h.build) {
161095
161283
  const v = this.check({ version: h.build.version ?? this.versions?.remote.version ?? "unknown", protocolVersion: h.build.protocolVersion, dev: h.build.commit === "dev" });
161096
161284
  if (!mayConnect(v)) return;
161097
161285
  }
161098
- try {
161099
- await Promise.all(
161100
- ["sessions", "projects"].map(async (kind) => {
161101
- const list2 = await client.call(kind === "sessions" ? "sessions.list" : "projects.list", {});
161102
- if (Array.isArray(list2)) this.observe(kind, list2);
161103
- })
161104
- );
161105
- } catch (err) {
161106
- this.deps.log?.(`[links] ${this.name}: could not read its lists after connecting: ${err.message}`);
161107
- }
161286
+ await this.readLists(client);
161108
161287
  if (this.client !== client) return;
161109
161288
  clearTimeout(this.stableTimer);
161110
161289
  this.stableTimer = setTimeout(() => {
@@ -162026,6 +162205,7 @@ var Links = class {
162026
162205
  await m.stop();
162027
162206
  this.deps.registry.remove(id3);
162028
162207
  this.deps.mirror.forget(id3);
162208
+ m.pendingDeletes.forget();
162029
162209
  this.deps.broadcast({ type: "machine_resync", machineId: id3 });
162030
162210
  }
162031
162211
  async stop() {
@@ -162964,7 +163144,13 @@ var Router = class {
162964
163144
  throw rpcError(`A script's message is not sent to ${m.name}: Centralu there would store it as the person's. Run the script on ${m.name} instead.`);
162965
163145
  }
162966
163146
  if (!m.reachable && ctx === void 0) await m.reachForCall?.();
162967
- if (!m.reachable) throw new MachineUnreachableError(m, ctx?.window === true);
163147
+ if (!m.reachable) {
163148
+ if (method === "projects.delete" && m.pendingDeletes && isObj(params) && typeof params.projectId === "string") {
163149
+ m.pendingDeletes.keep(params.projectId);
163150
+ return { ok: true };
163151
+ }
163152
+ throw new MachineUnreachableError(m, ctx?.window === true);
163153
+ }
162968
163154
  return callOn(m, method, params, ctx);
162969
163155
  }
162970
163156
  async byKey(method, params, key2, route, ctx) {
@@ -163352,7 +163538,7 @@ function tunnelsFor(store2, log) {
163352
163538
  }
163353
163539
  function linkDepsFor(store2, rest) {
163354
163540
  const log = (line) => rest.log?.(stamped(line));
163355
- return { ...rest, log, mirror: storeMirror(store2), registry: storeRegistry(store2), tunnelFor: tunnelsFor(store2, log) };
163541
+ return { ...rest, log, mirror: storeMirror(store2), registry: storeRegistry(store2), tunnelFor: tunnelsFor(store2, log), projectDeletes: storeProjectDeletes(store2) };
163356
163542
  }
163357
163543
  var kindOf3 = (k2) => k2 === "sessions" ? "session" : "project";
163358
163544
  var withIds = (list2) => list2.filter((x) => isObj(x) && typeof x.id === "string");
@@ -163377,6 +163563,14 @@ function storeProjectOrder(store2) {
163377
163563
  write: (orderedIds) => store2.settings.setAppSetting(PROJECT_ORDER_KEY, JSON.stringify(orderedIds))
163378
163564
  };
163379
163565
  }
163566
+ var PENDING_PROJECT_DELETES_KEY = "hub.pendingProjectDeletes";
163567
+ function storeProjectDeletes(store2) {
163568
+ return listSetting(
163569
+ store2.settings,
163570
+ PENDING_PROJECT_DELETES_KEY,
163571
+ (x) => typeof x.machine === "string" && typeof x.projectId === "string" && typeof x.name === "string" && typeof x.at === "number"
163572
+ );
163573
+ }
163380
163574
 
163381
163575
  // packages/agent-host/src/links/linked-hubs.ts
163382
163576
  var MAIL_MS = 3e4;
@@ -164113,7 +164307,7 @@ var handedToken = launch.tokenOnStdin ? await readHandedToken(process.stdin).cat
164113
164307
  console.error(`[agent-host] the launcher did not hand over the token: ${e.message}`);
164114
164308
  process.exit(1);
164115
164309
  }) : launch.token;
164116
- var BUILD = true ? "a599200" : "dev";
164310
+ var BUILD = true ? "f6d2451" : "dev";
164117
164311
  var { values } = parseArgs({
164118
164312
  options: {
164119
164313
  port: { type: "string", default: "5175" },
@@ -164452,6 +164646,8 @@ var links = new Links(linkDepsFor(store, {
164452
164646
  // A machine that took this hub's mail at a connect hears what became of mail that crossed while it was away (#2067 review); the tasks it says never arrived are settled (#2289)
164453
164647
  onOfferAnswered: (machineId, lacks) => hostMailbox.across.offerAnswered(machineId, lacks),
164454
164648
  openTasks: (machineId) => hostMailbox.across.openTasksTo(machineId),
164649
+ // What the person asked for here and a machine did not do (#2330) reaches them as Centralu's notice in the Inbox
164650
+ tellPerson: (body, dedupeKey) => void hostMailbox.service.notice(PERSON, { body, facts: {}, dedupeKey }),
164455
164651
  // When agents compact: this hub's setting governs the machines it links (#1376)
164456
164652
  autoCompact: () => autoCompactOf(mgr.prefs.uiPreferences()),
164457
164653
  // Automatic updates cover the linked machines too (#1508): one on an older release follows this hub's version; none starts while this host drains to stop
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centralu/win32-x64",
3
- "version": "0.1.0-beta.74",
3
+ "version": "0.1.0-beta.76",
4
4
  "description": "Centralu app folder for Windows on x86-64",
5
5
  "license": "MIT",
6
6
  "author": "ijun17",