@centralu/win32-x64 0.1.0-beta.75 → 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.
package/Centralu/centralu.exe
CHANGED
|
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, #
|
|
20
|
-
--bg-hover: var(--color-background-tertiary, #
|
|
21
|
-
--ink: var(--color-text-primary, #
|
|
22
|
-
--danger: var(--color-text-danger, #
|
|
23
|
-
--edge: var(--color-border-secondary, #
|
|
24
|
-
--ring: var(--color-ring-primary, #
|
|
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, #
|
|
38
|
-
--sb-thumb-hover: var(--centralu-scrollbar-thumb-hover, #
|
|
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": "
|
|
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-
|
|
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.
|
|
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.
|
|
42
|
-
"@centralu/linux-arm64": "0.1.0-beta.
|
|
43
|
-
"@centralu/linux-x64": "0.1.0-beta.
|
|
44
|
-
"@centralu/win32-x64": "0.1.0-beta.
|
|
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.
|
|
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,
|
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
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: "
|
|
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;
|
|
@@ -148541,8 +148557,10 @@ var SessionManager = class {
|
|
|
148541
148557
|
);
|
|
148542
148558
|
for (const s of leavesFirst) await this.trash.trashSession(s.id).catch(() => {
|
|
148543
148559
|
});
|
|
148544
|
-
const
|
|
148560
|
+
const row = this.projectRegistry.projectRow(projectId);
|
|
148561
|
+
const root3 = row?.path;
|
|
148545
148562
|
this.store.trash.deleteProject(projectId);
|
|
148563
|
+
if (row) this.emit({ type: "projects_changed" });
|
|
148546
148564
|
this.apps.appsHub?.rt.forgetProject(projectId);
|
|
148547
148565
|
this.files.forgetProject(projectId, root3);
|
|
148548
148566
|
}
|
|
@@ -150128,7 +150146,7 @@ var MessageService = class {
|
|
|
150128
150146
|
const kept = turnStarts ? candidates.filter((c) => !isWork(c) || groupOf(c) === picked) : candidates;
|
|
150129
150147
|
const workMessage = !turnStarts || opts.joining ? null : handedOn ?? (toAssistant ? kept.find((c) => c.request)?.message.id ?? null : picked);
|
|
150130
150148
|
const items = [];
|
|
150131
|
-
const
|
|
150149
|
+
const given = [];
|
|
150132
150150
|
let wake = false;
|
|
150133
150151
|
let immediate = false;
|
|
150134
150152
|
let needsReply = false;
|
|
@@ -150137,10 +150155,11 @@ var MessageService = class {
|
|
|
150137
150155
|
if (message.urgent || isPerson(message.sender)) immediate = true;
|
|
150138
150156
|
if (message.kind === "message" && message.needsReply) needsReply = true;
|
|
150139
150157
|
const relation = this.relation(recipient, message);
|
|
150140
|
-
|
|
150158
|
+
given.push({ threadId: message.rootId, messageId: message.id, relation });
|
|
150141
150159
|
items.push(this.frameItem(recipient, message, relation, down && row.deliveredAt === null, row.lastError === "maybe_repeated"));
|
|
150142
150160
|
}
|
|
150143
150161
|
const frame = buildMessageFrame(items, this.opts.calls?.(recipient));
|
|
150162
|
+
const listed2 = given.filter((l) => frame.shown.includes(l.messageId));
|
|
150144
150163
|
return {
|
|
150145
150164
|
text: frame.text,
|
|
150146
150165
|
messageIds: frame.shown,
|
|
@@ -150149,7 +150168,8 @@ var MessageService = class {
|
|
|
150149
150168
|
wake,
|
|
150150
150169
|
immediate,
|
|
150151
150170
|
needsReply,
|
|
150152
|
-
line:
|
|
150171
|
+
line: mailLine(listed2).line,
|
|
150172
|
+
listed: listed2,
|
|
150153
150173
|
heldBack,
|
|
150154
150174
|
workMessage,
|
|
150155
150175
|
asker: turnStarts && toAssistant ? picked : null
|
|
@@ -153669,8 +153689,13 @@ var Qualifier = class {
|
|
|
153669
153689
|
if ("projectId" in p) out.projectId = this.maybeId(p.projectId);
|
|
153670
153690
|
if (typeof p.instanceId === "string") out.instanceId = this.id(p.instanceId);
|
|
153671
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);
|
|
153672
153693
|
return out;
|
|
153673
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
|
+
}
|
|
153674
153699
|
/** `ApprovalDetail`: the kinds that name a project */
|
|
153675
153700
|
approvalDetail(d2) {
|
|
153676
153701
|
if (!isObj(d2)) return d2;
|
|
@@ -153863,6 +153888,9 @@ var Qualifier = class {
|
|
|
153863
153888
|
}
|
|
153864
153889
|
case "handoff":
|
|
153865
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;
|
|
153866
153894
|
case "session_owner":
|
|
153867
153895
|
return { ...base2, askedBy: (sid !== void 0 ? this.ownerOf?.(sid) : void 0) ?? this.maybeId(e.askedBy), parentSessionId: this.maybeId(e.parentSessionId) };
|
|
153868
153896
|
case "approval_request":
|
|
@@ -159479,6 +159507,92 @@ async function askHubAuto(call2, allowed) {
|
|
|
159479
159507
|
// packages/agent-host/src/links/linked-machine-connection.ts
|
|
159480
159508
|
import { randomBytes as randomBytes15 } from "node:crypto";
|
|
159481
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
|
+
|
|
159482
159596
|
// packages/agent-host/src/links/remote-client.ts
|
|
159483
159597
|
var MAX_INCOMING_CALLS = 16;
|
|
159484
159598
|
var DEFAULT_CALL_TIMEOUT_MS = 2e5;
|
|
@@ -160026,6 +160140,7 @@ function hiddenKind(s) {
|
|
|
160026
160140
|
var RETRY_MS2 = [2e3, 5 * 6e4];
|
|
160027
160141
|
var LINK_REDIALS = 5;
|
|
160028
160142
|
var STABLE_MS = 6e4;
|
|
160143
|
+
var DELETE_RETRY_MS = 15e3;
|
|
160029
160144
|
var RESTARTS = { max: 3, windowMs: 10 * 6e4 };
|
|
160030
160145
|
var KEEPS_TRYING = "reconnecting";
|
|
160031
160146
|
var WAITS_FOR_PERSON = "press Connect to try again";
|
|
@@ -160048,6 +160163,14 @@ var LinkedMachineConnection = class {
|
|
|
160048
160163
|
this.tunnel = tunnel;
|
|
160049
160164
|
this.deps = deps;
|
|
160050
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
|
+
});
|
|
160051
160174
|
for (const s of deps.mirror.read(record2.id, "sessions") ?? []) this.classify(s);
|
|
160052
160175
|
this.lastConnectedAt = record2.lastConnectedAt ?? null;
|
|
160053
160176
|
for (const [credential, at2] of Object.entries(record2.revoked ?? {})) {
|
|
@@ -160061,6 +160184,8 @@ var LinkedMachineConnection = class {
|
|
|
160061
160184
|
tunnel;
|
|
160062
160185
|
deps;
|
|
160063
160186
|
q;
|
|
160187
|
+
/** The projects the person deleted while this machine could not be asked, deleted there at its next hello (#2330) */
|
|
160188
|
+
pendingDeletes;
|
|
160064
160189
|
status = "connecting";
|
|
160065
160190
|
error = null;
|
|
160066
160191
|
versions = null;
|
|
@@ -160124,6 +160249,8 @@ var LinkedMachineConnection = class {
|
|
|
160124
160249
|
attempt = 0;
|
|
160125
160250
|
/** Starts the backoff over once the host that last said hello has stayed up `STABLE_MS` */
|
|
160126
160251
|
stableTimer;
|
|
160252
|
+
/** The next try of a delete the machine failed (`readLists`) */
|
|
160253
|
+
deleteRetryTimer;
|
|
160127
160254
|
/** When the link started a host there by itself, within the last `RESTARTS.windowMs` (#1143) */
|
|
160128
160255
|
autoStarts = [];
|
|
160129
160256
|
/**
|
|
@@ -161121,22 +161248,42 @@ var LinkedMachineConnection = class {
|
|
|
161121
161248
|
this.client = client;
|
|
161122
161249
|
client.connect();
|
|
161123
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
|
+
}
|
|
161124
161280
|
async onHello(client, h) {
|
|
161125
161281
|
if (this.client !== client) return;
|
|
161126
161282
|
if (h.build) {
|
|
161127
161283
|
const v = this.check({ version: h.build.version ?? this.versions?.remote.version ?? "unknown", protocolVersion: h.build.protocolVersion, dev: h.build.commit === "dev" });
|
|
161128
161284
|
if (!mayConnect(v)) return;
|
|
161129
161285
|
}
|
|
161130
|
-
|
|
161131
|
-
await Promise.all(
|
|
161132
|
-
["sessions", "projects"].map(async (kind) => {
|
|
161133
|
-
const list2 = await client.call(kind === "sessions" ? "sessions.list" : "projects.list", {});
|
|
161134
|
-
if (Array.isArray(list2)) this.observe(kind, list2);
|
|
161135
|
-
})
|
|
161136
|
-
);
|
|
161137
|
-
} catch (err) {
|
|
161138
|
-
this.deps.log?.(`[links] ${this.name}: could not read its lists after connecting: ${err.message}`);
|
|
161139
|
-
}
|
|
161286
|
+
await this.readLists(client);
|
|
161140
161287
|
if (this.client !== client) return;
|
|
161141
161288
|
clearTimeout(this.stableTimer);
|
|
161142
161289
|
this.stableTimer = setTimeout(() => {
|
|
@@ -162058,6 +162205,7 @@ var Links = class {
|
|
|
162058
162205
|
await m.stop();
|
|
162059
162206
|
this.deps.registry.remove(id3);
|
|
162060
162207
|
this.deps.mirror.forget(id3);
|
|
162208
|
+
m.pendingDeletes.forget();
|
|
162061
162209
|
this.deps.broadcast({ type: "machine_resync", machineId: id3 });
|
|
162062
162210
|
}
|
|
162063
162211
|
async stop() {
|
|
@@ -162996,7 +163144,13 @@ var Router = class {
|
|
|
162996
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.`);
|
|
162997
163145
|
}
|
|
162998
163146
|
if (!m.reachable && ctx === void 0) await m.reachForCall?.();
|
|
162999
|
-
if (!m.reachable)
|
|
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
|
+
}
|
|
163000
163154
|
return callOn(m, method, params, ctx);
|
|
163001
163155
|
}
|
|
163002
163156
|
async byKey(method, params, key2, route, ctx) {
|
|
@@ -163384,7 +163538,7 @@ function tunnelsFor(store2, log) {
|
|
|
163384
163538
|
}
|
|
163385
163539
|
function linkDepsFor(store2, rest) {
|
|
163386
163540
|
const log = (line) => rest.log?.(stamped(line));
|
|
163387
|
-
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) };
|
|
163388
163542
|
}
|
|
163389
163543
|
var kindOf3 = (k2) => k2 === "sessions" ? "session" : "project";
|
|
163390
163544
|
var withIds = (list2) => list2.filter((x) => isObj(x) && typeof x.id === "string");
|
|
@@ -163409,6 +163563,14 @@ function storeProjectOrder(store2) {
|
|
|
163409
163563
|
write: (orderedIds) => store2.settings.setAppSetting(PROJECT_ORDER_KEY, JSON.stringify(orderedIds))
|
|
163410
163564
|
};
|
|
163411
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
|
+
}
|
|
163412
163574
|
|
|
163413
163575
|
// packages/agent-host/src/links/linked-hubs.ts
|
|
163414
163576
|
var MAIL_MS = 3e4;
|
|
@@ -164145,7 +164307,7 @@ var handedToken = launch.tokenOnStdin ? await readHandedToken(process.stdin).cat
|
|
|
164145
164307
|
console.error(`[agent-host] the launcher did not hand over the token: ${e.message}`);
|
|
164146
164308
|
process.exit(1);
|
|
164147
164309
|
}) : launch.token;
|
|
164148
|
-
var BUILD = true ? "
|
|
164310
|
+
var BUILD = true ? "f6d2451" : "dev";
|
|
164149
164311
|
var { values } = parseArgs({
|
|
164150
164312
|
options: {
|
|
164151
164313
|
port: { type: "string", default: "5175" },
|
|
@@ -164484,6 +164646,8 @@ var links = new Links(linkDepsFor(store, {
|
|
|
164484
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)
|
|
164485
164647
|
onOfferAnswered: (machineId, lacks) => hostMailbox.across.offerAnswered(machineId, lacks),
|
|
164486
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 }),
|
|
164487
164651
|
// When agents compact: this hub's setting governs the machines it links (#1376)
|
|
164488
164652
|
autoCompact: () => autoCompactOf(mgr.prefs.uiPreferences()),
|
|
164489
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
|