@centralu/host-win32-x64 0.1.0-beta.61 → 0.1.0-beta.62
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/host/bundle-info.json +2 -2
- package/host/centralu-package.json +5 -5
- package/host/main.mjs +121 -44
- package/package.json +1 -1
package/host/bundle-info.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"commit": "
|
|
2
|
+
"commit": "4b3be7a",
|
|
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-12T19:57:28.399Z",
|
|
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.62",
|
|
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.62",
|
|
42
|
+
"@centralu/linux-arm64": "0.1.0-beta.62",
|
|
43
|
+
"@centralu/linux-x64": "0.1.0-beta.62",
|
|
44
|
+
"@centralu/win32-x64": "0.1.0-beta.62"
|
|
45
45
|
}
|
|
46
46
|
}
|
package/host/main.mjs
CHANGED
|
@@ -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.62";
|
|
43050
43050
|
|
|
43051
43051
|
// packages/protocol/src/brand.ts
|
|
43052
43052
|
var APP_NAME = "Centralu";
|
|
@@ -57798,7 +57798,8 @@ function applyBackgroundTasks(prev, e) {
|
|
|
57798
57798
|
const liveIds = new Set(live2.map((t) => t.id));
|
|
57799
57799
|
const fresh = (e.ended ?? []).filter((t) => !liveIds.has(t.id) && t.status !== "running");
|
|
57800
57800
|
const freshIds = new Set(fresh.map((t) => t.id));
|
|
57801
|
-
const
|
|
57801
|
+
const newBurst = liveBackgroundTasks(live2).length > 0 && liveBackgroundTasks(prev).length === 0;
|
|
57802
|
+
const kept = e.clearEnded || newBurst ? [] : prev.filter((t) => t.status !== "running" && !liveIds.has(t.id) && !freshIds.has(t.id));
|
|
57802
57803
|
return [...live2, ...[...kept, ...fresh].slice(-BACKGROUND_ENDED_KEPT)];
|
|
57803
57804
|
}
|
|
57804
57805
|
function liveBackgroundTasks(tasks) {
|
|
@@ -59581,6 +59582,16 @@ var MailParty = external_exports.object({
|
|
|
59581
59582
|
state: external_exports.string().nullable().default(null)
|
|
59582
59583
|
});
|
|
59583
59584
|
var MailChoices = external_exports.array(external_exports.string()).min(2).max(6);
|
|
59585
|
+
var MailAsk = external_exports.object({
|
|
59586
|
+
/** The message waiting for the answer: the one a pick or words answer (`mail.reply` `answers`) */
|
|
59587
|
+
id: external_exports.string(),
|
|
59588
|
+
sender: MailParty,
|
|
59589
|
+
/** Its first lines, as plain words */
|
|
59590
|
+
text: external_exports.string(),
|
|
59591
|
+
choices: MailChoices.optional().catch(void 0),
|
|
59592
|
+
/** Every message to the person that waits for an answer in this thread, oldest first, `id` being the last: the host's one rule for an open question, which a window reads and never works out (#2233). */
|
|
59593
|
+
open: external_exports.array(external_exports.string())
|
|
59594
|
+
});
|
|
59584
59595
|
var MailThreadRow = external_exports.object({
|
|
59585
59596
|
id: external_exports.string(),
|
|
59586
59597
|
subject: external_exports.string(),
|
|
@@ -59592,6 +59603,8 @@ var MailThreadRow = external_exports.object({
|
|
|
59592
59603
|
assignee: MailParty.nullable().default(null),
|
|
59593
59604
|
/** Messages to the person in this thread that the person has not read */
|
|
59594
59605
|
unread: external_exports.number().default(0),
|
|
59606
|
+
/** What the thread waits on the person to answer; null when nothing does. Absent from a host of an older build */
|
|
59607
|
+
ask: MailAsk.nullable().default(null),
|
|
59595
59608
|
/** Mail in the thread held for the person to act on (a loop, a spent budget, a policy, a delivery that failed), for any receiver */
|
|
59596
59609
|
held: external_exports.number().default(0),
|
|
59597
59610
|
/** Standing blockers: none since blockers went with threads (§12.2); kept for a window of an older build, which reads it */
|
|
@@ -62048,7 +62061,7 @@ var mailParams = {
|
|
|
62048
62061
|
threadId: external_exports.string(),
|
|
62049
62062
|
text: external_exports.string().min(1).max(16e3),
|
|
62050
62063
|
kind: external_exports.enum(["note", "answer", "question"]).optional(),
|
|
62051
|
-
/**
|
|
62064
|
+
/** The id of the question in this thread that `text` answers (#1630, #2191): a pick of one of its choices, or the person's own words. The answer goes to that question, not to the newest open one, and a question already answered refuses it (`answered`). An older host takes only a choice of the question, and refuses other words */
|
|
62052
62065
|
answers: external_exports.string().optional()
|
|
62053
62066
|
}),
|
|
62054
62067
|
/** The person closes a thread */
|
|
@@ -64092,6 +64105,26 @@ function builderErrorFrame(app2, report) {
|
|
|
64092
64105
|
` + body;
|
|
64093
64106
|
}
|
|
64094
64107
|
|
|
64108
|
+
// packages/protocol/src/plain-line.ts
|
|
64109
|
+
var LINE_MARKS = /^\s*(?:`{3,}|~{3,}|#{1,6}\s+|>\s?|(?:[-*+]|\d{1,9}[.)])\s+(?:\[[ xX]\]\s+)?)+/;
|
|
64110
|
+
function plainLine(body, max) {
|
|
64111
|
+
return oneLineText(plainText(body), max);
|
|
64112
|
+
}
|
|
64113
|
+
function plainLines(body, lines, max) {
|
|
64114
|
+
const text3 = plainText(body).split("\n").map((l) => oneLineText(l)).filter((l) => l !== "").slice(0, lines).join("\n");
|
|
64115
|
+
return text3.length > max ? `${text3.slice(0, max)}\u2026` : text3;
|
|
64116
|
+
}
|
|
64117
|
+
function plainText(body) {
|
|
64118
|
+
return body.split("\n").map((line) => line.replace(LINE_MARKS, "")).join("\n").replace(/!?\[([^\]\n]*)\]\([^)\n]*\)/g, "$1").replace(/`+([^`\n]+?)`+/g, "$1").replace(/(\*\*|__|~~)(?=\S)(.+?)(?<=\S)\1/g, "$2").replace(/(?<![\w*])\*(?=\S)([^*\n]+?)(?<=\S)\*(?![\w*])/g, "$1").replace(/(?<![\w_])_(?=\S)([^_\n]+?)(?<=\S)_(?![\w_])/g, "$1");
|
|
64119
|
+
}
|
|
64120
|
+
|
|
64121
|
+
// packages/protocol/src/mail-ask.ts
|
|
64122
|
+
var ASK_LINES = 4;
|
|
64123
|
+
var ASK_CHARS = 320;
|
|
64124
|
+
function mailAsk(newest, sender, open6) {
|
|
64125
|
+
return { id: newest.id, sender, text: plainLines(newest.body, ASK_LINES, ASK_CHARS), ...newest.choices ? { choices: newest.choices } : {}, open: [...open6] };
|
|
64126
|
+
}
|
|
64127
|
+
|
|
64095
64128
|
// packages/protocol/src/centralu-calls.ts
|
|
64096
64129
|
function mcpNameParts(name) {
|
|
64097
64130
|
const m = /^mcp__([^_]+(?:_(?!_)[^_]*)*)__(.+)$/.exec(name);
|
|
@@ -130574,13 +130607,33 @@ function endedSummary(text3) {
|
|
|
130574
130607
|
const summary = (text3 ?? "").slice(0, BACKGROUND_SUMMARY_CHARS);
|
|
130575
130608
|
return summary ? { summary } : {};
|
|
130576
130609
|
}
|
|
130610
|
+
var NONE = /* @__PURE__ */ new Set();
|
|
130611
|
+
var KIND_WORDS = { agent: "agent", shell: "shell", mcp: "MCP task", other: "task" };
|
|
130612
|
+
function endedNotice(sessionId, t) {
|
|
130613
|
+
if (t.status !== "failed" && t.status !== "stopped") return [];
|
|
130614
|
+
const why2 = t.summary ? `: ${oneLineText(t.summary, BACKGROUND_SUMMARY_CHARS)}` : "";
|
|
130615
|
+
return [
|
|
130616
|
+
{
|
|
130617
|
+
type: "notice",
|
|
130618
|
+
sessionId,
|
|
130619
|
+
level: t.status === "failed" ? "warning" : "info",
|
|
130620
|
+
text: `Background ${KIND_WORDS[t.kind]} "${oneLineText(t.description, 80)}" ${t.status}${why2}`,
|
|
130621
|
+
from: "Centralu",
|
|
130622
|
+
label: "background task"
|
|
130623
|
+
}
|
|
130624
|
+
];
|
|
130625
|
+
}
|
|
130577
130626
|
var BackgroundEvents = class {
|
|
130578
130627
|
constructor(sessionId) {
|
|
130579
130628
|
this.sessionId = sessionId;
|
|
130580
130629
|
}
|
|
130581
130630
|
sessionId;
|
|
130582
130631
|
last = "[]";
|
|
130583
|
-
|
|
130632
|
+
/**
|
|
130633
|
+
* `carded`: the launch cards that carry the ending of their own task as they close with it (a background agent's card marked failed with the reason when the process
|
|
130634
|
+
* goes away). A task whose card is one of them leaves no line of its own: its ending is said once
|
|
130635
|
+
*/
|
|
130636
|
+
event(live2, ended2 = [], snapshot2 = false, carded = NONE) {
|
|
130584
130637
|
const key = JSON.stringify(live2);
|
|
130585
130638
|
if (key === this.last && ended2.length === 0 && !snapshot2) return [];
|
|
130586
130639
|
this.last = key;
|
|
@@ -130591,7 +130644,8 @@ var BackgroundEvents = class {
|
|
|
130591
130644
|
sessionId: this.sessionId,
|
|
130592
130645
|
live: live2,
|
|
130593
130646
|
...ended2.length ? { ended: ended2 } : {}
|
|
130594
|
-
}
|
|
130647
|
+
},
|
|
130648
|
+
...ended2.flatMap((t) => t.parentCallId !== void 0 && carded.has(t.parentCallId) ? [] : endedNotice(this.sessionId, t))
|
|
130595
130649
|
];
|
|
130596
130650
|
}
|
|
130597
130651
|
};
|
|
@@ -130654,7 +130708,8 @@ var ClaudeBackgroundTracker = class {
|
|
|
130654
130708
|
tick() {
|
|
130655
130709
|
return this.schedules.prune() ? this.event() : [];
|
|
130656
130710
|
}
|
|
130657
|
-
|
|
130711
|
+
/** `cards`: the launch cards still open, which an ending closes with it (`BackgroundEvents.event`) */
|
|
130712
|
+
push(m, cards) {
|
|
130658
130713
|
if (str(m.type) === "assistant" || str(m.type) === "user") {
|
|
130659
130714
|
const changed = this.schedules.push(m);
|
|
130660
130715
|
return changed ? this.event() : [];
|
|
@@ -130710,7 +130765,7 @@ var ClaudeBackgroundTracker = class {
|
|
|
130710
130765
|
this.live = this.live.filter((x) => x !== id3);
|
|
130711
130766
|
const raw = str(m.status);
|
|
130712
130767
|
const status = raw === "failed" || raw === "stopped" ? raw : "completed";
|
|
130713
|
-
return this.event([{ ...this.entry(id3, known), status, ...endedSummary(str(m.summary)) }]);
|
|
130768
|
+
return this.event([{ ...this.entry(id3, known), status, ...endedSummary(str(m.summary)) }], void 0, cards);
|
|
130714
130769
|
}
|
|
130715
130770
|
return [];
|
|
130716
130771
|
}
|
|
@@ -130718,8 +130773,8 @@ var ClaudeBackgroundTracker = class {
|
|
|
130718
130773
|
get running() {
|
|
130719
130774
|
return this.live.length > 0;
|
|
130720
130775
|
}
|
|
130721
|
-
/** The process went away and took its tasks with it — each live one ends as stopped, with the reason. */
|
|
130722
|
-
release(why2) {
|
|
130776
|
+
/** The process went away and took its tasks with it — each live one ends as stopped, with the reason. `cards`: the launch cards that close with it */
|
|
130777
|
+
release(why2, cards) {
|
|
130723
130778
|
const timers = this.schedules.release().map((t) => ({ ...t, status: "stopped", summary: why2 }));
|
|
130724
130779
|
if (this.live.length === 0 && timers.length === 0) {
|
|
130725
130780
|
this.info.clear();
|
|
@@ -130730,7 +130785,7 @@ var ClaudeBackgroundTracker = class {
|
|
|
130730
130785
|
this.live = [];
|
|
130731
130786
|
this.info.clear();
|
|
130732
130787
|
this.seen.clear();
|
|
130733
|
-
return this.event(ended2);
|
|
130788
|
+
return this.event(ended2, void 0, cards);
|
|
130734
130789
|
}
|
|
130735
130790
|
entry(id3, i) {
|
|
130736
130791
|
const kind = i?.kind ?? "other";
|
|
@@ -130746,8 +130801,8 @@ var ClaudeBackgroundTracker = class {
|
|
|
130746
130801
|
status: "running"
|
|
130747
130802
|
};
|
|
130748
130803
|
}
|
|
130749
|
-
event(ended2, snapshot2) {
|
|
130750
|
-
return this.events.event([...this.live.map((id3) => this.entry(id3, this.info.get(id3))), ...this.schedules.live()], ended2, snapshot2);
|
|
130804
|
+
event(ended2, snapshot2, cards) {
|
|
130805
|
+
return this.events.event([...this.live.map((id3) => this.entry(id3, this.info.get(id3))), ...this.schedules.live()], ended2, snapshot2, cards);
|
|
130751
130806
|
}
|
|
130752
130807
|
};
|
|
130753
130808
|
|
|
@@ -131337,7 +131392,7 @@ var ClaudeStreamNormalizer = class {
|
|
|
131337
131392
|
const type = msg.type;
|
|
131338
131393
|
const subagent = "parent_tool_use_id" in msg && str(msg.parent_tool_use_id) !== "";
|
|
131339
131394
|
this.unmapped.note(msg.type === "system" ? `system/${str(msg.subtype)}` : type);
|
|
131340
|
-
const tasks = this.tasks.push(msg);
|
|
131395
|
+
const tasks = this.tasks.push(msg, this.background);
|
|
131341
131396
|
if (msg.type === "system" && msg.subtype === "task_notification") {
|
|
131342
131397
|
const callId = str(msg.tool_use_id);
|
|
131343
131398
|
if (!this.background.delete(callId)) return tasks;
|
|
@@ -131436,8 +131491,8 @@ var ClaudeStreamNormalizer = class {
|
|
|
131436
131491
|
const out = [...this.releaseRequest(), ...this.deferred.splice(0)];
|
|
131437
131492
|
this.held = null;
|
|
131438
131493
|
for (const callId of this.background) out.push({ type: "tool_result", sessionId: this.sessionId, callId, ok: false, summary: why2 });
|
|
131494
|
+
out.push(...this.tasks.release("Ended with the session process", this.background));
|
|
131439
131495
|
this.background.clear();
|
|
131440
|
-
out.push(...this.tasks.release("Ended with the session process"));
|
|
131441
131496
|
return out;
|
|
131442
131497
|
}
|
|
131443
131498
|
};
|
|
@@ -135130,9 +135185,10 @@ var CodexChildTracker = class {
|
|
|
135130
135185
|
t.turnId = null;
|
|
135131
135186
|
}
|
|
135132
135187
|
const held3 = [...this.held.keys()].map((callId) => ({ type: "tool_result", sessionId: this.sessionId, callId, ok: false, summary: why2 }));
|
|
135188
|
+
const carded = new Set(this.held.keys());
|
|
135133
135189
|
this.held.clear();
|
|
135134
135190
|
if (live2.length === 0) return held3;
|
|
135135
|
-
return [...this.changed(live2.map((task) => ({ ...task, status: "stopped", summary: why2 }))), ...held3];
|
|
135191
|
+
return [...this.changed(live2.map((task) => ({ ...task, status: "stopped", summary: why2 })), carded), ...held3];
|
|
135136
135192
|
}
|
|
135137
135193
|
ended(thread, status, summary) {
|
|
135138
135194
|
const task = this.task(thread);
|
|
@@ -135161,10 +135217,12 @@ var CodexChildTracker = class {
|
|
|
135161
135217
|
return out;
|
|
135162
135218
|
}
|
|
135163
135219
|
/** The event when the live set or an ending moved; nothing when neither did. */
|
|
135164
|
-
changed(ended2 = []) {
|
|
135220
|
+
changed(ended2 = [], carded) {
|
|
135165
135221
|
return this.events.event(
|
|
135166
135222
|
this.live(),
|
|
135167
|
-
ended2.filter((t) => t !== null)
|
|
135223
|
+
ended2.filter((t) => t !== null),
|
|
135224
|
+
false,
|
|
135225
|
+
carded
|
|
135168
135226
|
);
|
|
135169
135227
|
}
|
|
135170
135228
|
};
|
|
@@ -149784,7 +149842,7 @@ var PREVIEW_CHARS2 = 140;
|
|
|
149784
149842
|
var PERSON_HOLDS = ["uncertain", "failed", "loop", "budget", "policy"];
|
|
149785
149843
|
function subjectLine(m) {
|
|
149786
149844
|
const script = m.facts.fromScript?.credential;
|
|
149787
|
-
return m.subject ??
|
|
149845
|
+
return plainLine(m.subject ?? (script === void 0 ? m.body : `The script "${script}": ${m.body}`), SUBJECT_CHARS);
|
|
149788
149846
|
}
|
|
149789
149847
|
var MailPerson = class {
|
|
149790
149848
|
constructor(service, records, delivery, host) {
|
|
@@ -149813,7 +149871,7 @@ var MailPerson = class {
|
|
|
149813
149871
|
recipient: this.party(r.recipient),
|
|
149814
149872
|
kind: windowKind(m),
|
|
149815
149873
|
reason: r.held,
|
|
149816
|
-
preview:
|
|
149874
|
+
preview: plainLine(m.body, PREVIEW_CHARS2),
|
|
149817
149875
|
since: m.createdAt
|
|
149818
149876
|
});
|
|
149819
149877
|
}
|
|
@@ -149836,7 +149894,7 @@ var MailPerson = class {
|
|
|
149836
149894
|
const upTo = opts.before === void 0 ? all : all.filter((s) => s.seq < (opts.before ?? 0));
|
|
149837
149895
|
page = upTo.slice(-Math.min(opts.tail ?? THREAD_PAGE, THREAD_PAGE));
|
|
149838
149896
|
} else page = all;
|
|
149839
|
-
|
|
149897
|
+
this.readFor(page);
|
|
149840
149898
|
const first = page[0]?.seq;
|
|
149841
149899
|
const last = page.at(-1)?.seq;
|
|
149842
149900
|
const legacy = this.legacyOf(all[0]?.m);
|
|
@@ -149860,27 +149918,28 @@ var MailPerson = class {
|
|
|
149860
149918
|
*/
|
|
149861
149919
|
reply(threadId, text3, kind = "note", answers2) {
|
|
149862
149920
|
const roots = this.rootsOf(threadId);
|
|
149863
|
-
const found = answers2 === void 0 ? this.replyTarget(roots) : this.pickTarget(roots, answers2
|
|
149921
|
+
const found = answers2 === void 0 ? this.replyTarget(roots) : this.pickTarget(roots, answers2);
|
|
149864
149922
|
if (!found) throw refuse4("unknown_message", `There is no message in ${threadId} to answer.`);
|
|
149865
149923
|
const { target, to } = found;
|
|
149866
|
-
const sent = this.service.send(PERSON, { to, text: text3, replyTo: target.id, needsReply: kind === "question", ...answers2
|
|
149867
|
-
const
|
|
149924
|
+
const sent = this.service.send(PERSON, { to, text: text3, replyTo: target.id, needsReply: kind === "question", ...answers2 !== void 0 && target.choices?.includes(text3) ? { picked: true } : {} });
|
|
149925
|
+
const shown3 = this.shown(target.rootId);
|
|
149926
|
+
const answered = shown3.find((s) => s.m.id === target.id)?.seq ?? 0;
|
|
149927
|
+
this.readFor(shown3.filter((s) => s.seq <= answered));
|
|
149928
|
+
const at2 = shown3.find((s) => s.m.id === sent.message.id)?.seq ?? 1;
|
|
149868
149929
|
return this.thread(target.rootId, { after: at2 - 1 });
|
|
149869
149930
|
}
|
|
149931
|
+
/** What was shown the person is read for them, and every window's list hears it */
|
|
149932
|
+
readFor(shown3) {
|
|
149933
|
+
if (this.records.markRead(PERSON, shown3.flatMap((s) => this.records.recipient(s.m.id, PERSON)?.readAt === null ? [s.m.id] : []), Date.now()) > 0) this.service.announce();
|
|
149934
|
+
}
|
|
149870
149935
|
/**
|
|
149871
149936
|
* The message the person's word in these chains answers, and whom it goes to: the one `reply` writes to, and so what the window's reply box (`canReply`) is
|
|
149872
149937
|
* offered for. Undefined when the chains hold nothing of the person's to answer: only mail between sessions held for them, or to sessions that are gone
|
|
149873
149938
|
*/
|
|
149874
149939
|
replyTarget(roots) {
|
|
149875
149940
|
const chain = roots.flatMap((root3) => this.shown(root3).map((s) => s.m)).sort((a, b2) => a.createdAt - b2.createdAt || (a.id < b2.id ? -1 : a.id > b2.id ? 1 : 0));
|
|
149876
|
-
const toPerson =
|
|
149877
|
-
|
|
149878
|
-
return m.sender !== PERSON && parseAddress(m.sender)?.kind !== "centralu" && row !== void 0 && !hiddenFromPerson(row) && this.here(m.sender);
|
|
149879
|
-
});
|
|
149880
|
-
const open6 = toPerson.findLast((m) => {
|
|
149881
|
-
const row = this.records.recipient(m.id, PERSON);
|
|
149882
|
-
return m.needsReply && row !== void 0 && row.answerId === null && (row.settled === null || row.settled === "legacy");
|
|
149883
|
-
});
|
|
149941
|
+
const toPerson = this.toPerson(chain);
|
|
149942
|
+
const open6 = this.asking(chain).at(-1);
|
|
149884
149943
|
const theirs = open6 ?? toPerson.at(-1);
|
|
149885
149944
|
const mine = chain.findLast((m) => m.sender === PERSON && this.records.recipients(m.id).some((r) => this.here(r.recipient)));
|
|
149886
149945
|
const target = theirs ?? mine;
|
|
@@ -149889,14 +149948,13 @@ var MailPerson = class {
|
|
|
149889
149948
|
return { target, to };
|
|
149890
149949
|
}
|
|
149891
149950
|
/**
|
|
149892
|
-
* The question a pick
|
|
149893
|
-
*
|
|
149951
|
+
* The question a pick or the person's own words answer (#1630, #2191): the one the window names, which must be a question in these chains sent to the person
|
|
149952
|
+
* by a session that is still here, and not answered already (a question is answered once, whichever window gives the answer first)
|
|
149894
149953
|
*/
|
|
149895
|
-
pickTarget(roots, id3
|
|
149954
|
+
pickTarget(roots, id3) {
|
|
149896
149955
|
const target = roots.flatMap((root3) => this.shown(root3).map((s) => s.m)).find((m) => m.id === id3);
|
|
149897
149956
|
const row = target && this.records.recipient(target.id, PERSON);
|
|
149898
149957
|
if (!target || !row || hiddenFromPerson(row) || !this.here(target.sender)) return void 0;
|
|
149899
|
-
if (!target.choices?.includes(text3)) throw refuse4("bad_value", `${id3} does not offer that choice.`);
|
|
149900
149958
|
if (row.answerId !== null || row.settled !== null && row.settled !== "legacy") throw refuse4("answered", REFUSAL_TEXT.answered(id3));
|
|
149901
149959
|
return { target, to: [target.sender] };
|
|
149902
149960
|
}
|
|
@@ -149929,11 +149987,9 @@ var MailPerson = class {
|
|
|
149929
149987
|
for (const row of this.records.recipients(m.id)) if (row.settled === null) asked.push({ id: m.id, recipient: row.recipient, seen: row.deliveredAt !== null || row.attemptAt !== null || row.held === "uncertain" });
|
|
149930
149988
|
}
|
|
149931
149989
|
const working = this.workers(chain);
|
|
149932
|
-
this.
|
|
149933
|
-
|
|
149934
|
-
|
|
149935
|
-
now
|
|
149936
|
-
);
|
|
149990
|
+
const readable = this.shown(r).map((s) => s.m.id);
|
|
149991
|
+
this.records.closeFor(PERSON, readable, now);
|
|
149992
|
+
this.records.markRead(PERSON, readable, now);
|
|
149937
149993
|
const withdrawn = asked.filter((a) => this.records.settle(a.id, a.recipient, "withdrawn", now) > 0);
|
|
149938
149994
|
for (const m of chain) {
|
|
149939
149995
|
if (m.sender === PERSON && (m.needsReply || m.kind === "task")) for (const row of this.records.recipients(m.id)) this.records.settle(m.id, row.recipient, "done", now);
|
|
@@ -150105,6 +150161,8 @@ var MailPerson = class {
|
|
|
150105
150161
|
const done2 = (closedAs !== void 0 || toPerson.some((r) => r.settled === "done") || tasks.some((r) => r.settled === "done")) && !waits;
|
|
150106
150162
|
const working = done2 ? [] : this.workers(this.chainOf(root3));
|
|
150107
150163
|
const state = done2 ? "done" : working.length > 0 || tasks.some((r) => r.settled === null && r.releasedAt === null) ? "running" : tasks.some((r) => r.settled === "reported") ? "review" : "open";
|
|
150164
|
+
const asking = done2 ? [] : this.asking(all);
|
|
150165
|
+
const asked = asking.at(-1);
|
|
150108
150166
|
const assignee = working[0]?.address ?? (first.sender === PERSON ? this.records.recipients(first.id)[0]?.recipient : void 0);
|
|
150109
150167
|
return {
|
|
150110
150168
|
id: root3,
|
|
@@ -150115,20 +150173,39 @@ var MailPerson = class {
|
|
|
150115
150173
|
projectId: first.senderProject,
|
|
150116
150174
|
owner: this.party(first.sender),
|
|
150117
150175
|
assignee: assignee === void 0 ? null : this.party(assignee),
|
|
150176
|
+
ask: asked ? mailAsk(asked, this.party(asked.sender), asking.map((m) => m.id)) : null,
|
|
150118
150177
|
unread: toPerson.filter((r) => r.readAt === null && !hiddenFromPerson(r)).length,
|
|
150119
150178
|
held: held3,
|
|
150120
150179
|
blocked: 0,
|
|
150121
150180
|
working: working.length > 0,
|
|
150122
150181
|
createdAt: first.createdAt,
|
|
150123
150182
|
updatedAt: last.createdAt,
|
|
150124
|
-
last: { sender: this.party(last.sender), kind: windowKind(last), preview:
|
|
150183
|
+
last: { sender: this.party(last.sender), kind: windowKind(last), preview: plainLine(last.body, PREVIEW_CHARS2), at: last.createdAt }
|
|
150125
150184
|
};
|
|
150126
150185
|
}
|
|
150186
|
+
/** The messages in a chain sent to the person, in its order: not by Centralu, from a sender that is still here (one that is gone cannot be answered), and that they may read */
|
|
150187
|
+
toPerson(chain) {
|
|
150188
|
+
return chain.filter((m) => {
|
|
150189
|
+
const row = this.records.recipient(m.id, PERSON);
|
|
150190
|
+
return m.sender !== PERSON && parseAddress(m.sender)?.kind !== "centralu" && row !== void 0 && !hiddenFromPerson(row) && this.here(m.sender);
|
|
150191
|
+
});
|
|
150192
|
+
}
|
|
150193
|
+
/**
|
|
150194
|
+
* The messages in a chain that wait on the person's answer, oldest first: the one definition of an open question. A message to them that asks for an
|
|
150195
|
+
* answer (a session's question, or one that needs a reply) and is not answered or settled yet. The row's `ask` (#2229), the reply box's target
|
|
150196
|
+
* (`replyTarget`) and the thread's `ask.open` all come from here; a window works nothing out of its own
|
|
150197
|
+
*/
|
|
150198
|
+
asking(chain) {
|
|
150199
|
+
return this.toPerson(chain).filter((m) => {
|
|
150200
|
+
const row = this.records.recipient(m.id, PERSON);
|
|
150201
|
+
return m.needsReply && row !== void 0 && row.answerId === null && (row.settled === null || row.settled === "legacy");
|
|
150202
|
+
});
|
|
150203
|
+
}
|
|
150127
150204
|
/** A chain whose every message the person may not read (held for them, then let go): a row with nothing in it */
|
|
150128
150205
|
emptyRow(root3) {
|
|
150129
150206
|
const m = this.records.message(root3);
|
|
150130
150207
|
const at2 = m?.createdAt ?? 0;
|
|
150131
|
-
return { id: root3, subject: m ? subjectLine(m) : root3, state: "open", outcome: null, next: null, projectId: null, owner: this.party(m?.sender ?? PERSON), assignee: null, unread: 0, held: 0, blocked: 0, working: false, createdAt: at2, updatedAt: at2, last: null };
|
|
150208
|
+
return { id: root3, subject: m ? subjectLine(m) : root3, state: "open", outcome: null, next: null, projectId: null, owner: this.party(m?.sender ?? PERSON), assignee: null, ask: null, unread: 0, held: 0, blocked: 0, working: false, createdAt: at2, updatedAt: at2, last: null };
|
|
150132
150209
|
}
|
|
150133
150210
|
// ── Shapes ──
|
|
150134
150211
|
/** The windows' `mail_changed` for a change to the mail (main.ts): a new message the person can read also names itself, for the OS notification (#1630) */
|
|
@@ -150142,7 +150219,7 @@ var MailPerson = class {
|
|
|
150142
150219
|
const m = this.records.message(messageId);
|
|
150143
150220
|
const row = this.records.recipient(messageId, PERSON);
|
|
150144
150221
|
if (!m || !row || m.sender === PERSON || hiddenFromPerson(row) || row.held !== null) return void 0;
|
|
150145
|
-
return { messageId, from: this.party(m.sender), kind: windowKind(m), preview:
|
|
150222
|
+
return { messageId, from: this.party(m.sender), kind: windowKind(m), preview: plainLine(m.body, PREVIEW_CHARS2) };
|
|
150146
150223
|
}
|
|
150147
150224
|
party(address) {
|
|
150148
150225
|
const p = parseAddress(address);
|
|
@@ -161781,7 +161858,7 @@ var handedToken = launch.tokenOnStdin ? await readHandedToken(process.stdin).cat
|
|
|
161781
161858
|
console.error(`[agent-host] the launcher did not hand over the token: ${e.message}`);
|
|
161782
161859
|
process.exit(1);
|
|
161783
161860
|
}) : launch.token;
|
|
161784
|
-
var BUILD = true ? "
|
|
161861
|
+
var BUILD = true ? "4b3be7a" : "dev";
|
|
161785
161862
|
var { values } = parseArgs({
|
|
161786
161863
|
options: {
|
|
161787
161864
|
port: { type: "string", default: "5175" },
|
package/package.json
CHANGED