@cydm/pie 4.3.3 → 4.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builtin/extensions/im-forward/index.js +111 -54
- package/dist/builtin/extensions/pie-ipc/index.js +20 -24
- package/dist/chunks/{chunk-G253KOFU.js → chunk-H5G55G3R.js} +15 -1
- package/dist/chunks/{concierge-cli-CQMIAGWJ.js → concierge-cli-MCHXTFBA.js} +11 -4
- package/dist/cli.js +1 -1
- package/package.json +1 -1
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
readLiveConfig,
|
|
19
19
|
readLiveEnabled,
|
|
20
20
|
registerDispatchReceiver,
|
|
21
|
+
registerTurnImDriver,
|
|
21
22
|
resolveConfig,
|
|
22
23
|
resolveConfigDir,
|
|
23
24
|
resolveImForwardConfig,
|
|
@@ -26,7 +27,7 @@ import {
|
|
|
26
27
|
truncateMarkdown,
|
|
27
28
|
tryClaimConsumer,
|
|
28
29
|
writeConfig
|
|
29
|
-
} from "../../../chunks/chunk-
|
|
30
|
+
} from "../../../chunks/chunk-H5G55G3R.js";
|
|
30
31
|
import {
|
|
31
32
|
detectImageMime,
|
|
32
33
|
readImageFormat
|
|
@@ -44,16 +45,16 @@ import { basename } from "node:path";
|
|
|
44
45
|
// builtin/extensions/im-forward/address-book.ts
|
|
45
46
|
import * as fs from "node:fs";
|
|
46
47
|
import * as os from "node:os";
|
|
47
|
-
import * as
|
|
48
|
+
import * as path2 from "node:path";
|
|
48
49
|
var MAX_ADDRESS_HEAD = 64;
|
|
49
50
|
function addressBookRoot() {
|
|
50
51
|
const raw = process.env.PIE_IPC_CONFIG_DIR;
|
|
51
52
|
if (raw && raw.trim()) {
|
|
52
53
|
const value = raw.trim();
|
|
53
|
-
const expanded = value === "~" ? os.homedir() : value.startsWith("~/") ?
|
|
54
|
-
return
|
|
54
|
+
const expanded = value === "~" ? os.homedir() : value.startsWith("~/") ? path2.join(os.homedir(), value.slice(2)) : value;
|
|
55
|
+
return path2.resolve(expanded);
|
|
55
56
|
}
|
|
56
|
-
return
|
|
57
|
+
return path2.resolve(resolveConfigDir());
|
|
57
58
|
}
|
|
58
59
|
function pidAlive(pid) {
|
|
59
60
|
if (!Number.isInteger(pid) || pid <= 0) return true;
|
|
@@ -69,7 +70,7 @@ function scanAddressBook() {
|
|
|
69
70
|
let complete = true;
|
|
70
71
|
let selfPublished;
|
|
71
72
|
let dirExists = false;
|
|
72
|
-
const dir =
|
|
73
|
+
const dir = path2.join(addressBookRoot(), "run", "ipc");
|
|
73
74
|
let entries;
|
|
74
75
|
try {
|
|
75
76
|
entries = fs.readdirSync(dir);
|
|
@@ -81,7 +82,7 @@ function scanAddressBook() {
|
|
|
81
82
|
for (const [index, file] of entries.entries()) {
|
|
82
83
|
if (!file.endsWith(".json")) continue;
|
|
83
84
|
try {
|
|
84
|
-
const status = JSON.parse(fs.readFileSync(
|
|
85
|
+
const status = JSON.parse(fs.readFileSync(path2.join(dir, file), "utf8"));
|
|
85
86
|
dirExists = true;
|
|
86
87
|
const name = typeof status.sessionName === "string" ? status.sessionName.trim() : "";
|
|
87
88
|
const pid = typeof status.pid === "number" ? status.pid : void 0;
|
|
@@ -141,7 +142,7 @@ function resolveAddress(text, ownLiveName, book) {
|
|
|
141
142
|
|
|
142
143
|
// builtin/extensions/im-forward/thread-registry.ts
|
|
143
144
|
import * as fs2 from "node:fs";
|
|
144
|
-
import * as
|
|
145
|
+
import * as path3 from "node:path";
|
|
145
146
|
import { randomUUID } from "node:crypto";
|
|
146
147
|
var SCHEMA = 1;
|
|
147
148
|
var RUNTIME_ID = randomUUID();
|
|
@@ -150,7 +151,7 @@ function encodeThreadKey(input) {
|
|
|
150
151
|
return Buffer.from(raw, "utf8").toString("base64url");
|
|
151
152
|
}
|
|
152
153
|
function threadsDir() {
|
|
153
|
-
return
|
|
154
|
+
return path3.join(addressBookRoot(), "threads");
|
|
154
155
|
}
|
|
155
156
|
function pidAlive2(pid) {
|
|
156
157
|
if (!Number.isInteger(pid) || pid <= 0) return true;
|
|
@@ -162,7 +163,7 @@ function pidAlive2(pid) {
|
|
|
162
163
|
}
|
|
163
164
|
}
|
|
164
165
|
function ownerPath(threadKey) {
|
|
165
|
-
return
|
|
166
|
+
return path3.join(threadsDir(), `${threadKey}.json`);
|
|
166
167
|
}
|
|
167
168
|
function readOwner(threadKey) {
|
|
168
169
|
const file = ownerPath(threadKey);
|
|
@@ -217,7 +218,7 @@ function decide(owner, threadKey, sessionId) {
|
|
|
217
218
|
function writeNew(threadKey, sessionId) {
|
|
218
219
|
const file = ownerPath(threadKey);
|
|
219
220
|
const record = recordFor(threadKey, sessionId);
|
|
220
|
-
const tmp =
|
|
221
|
+
const tmp = path3.join(threadsDir(), `.new-${randomUUID()}.json`);
|
|
221
222
|
try {
|
|
222
223
|
const fd = fs2.openSync(tmp, "wx", 384);
|
|
223
224
|
try {
|
|
@@ -292,10 +293,10 @@ function claimThreadOwnership(input, sessionId) {
|
|
|
292
293
|
}
|
|
293
294
|
}
|
|
294
295
|
function lockDirPath(threadKey) {
|
|
295
|
-
return
|
|
296
|
+
return path3.join(threadsDir(), `${threadKey}.lock`);
|
|
296
297
|
}
|
|
297
298
|
function writeHolderEntry(dir, token) {
|
|
298
|
-
fs2.writeFileSync(
|
|
299
|
+
fs2.writeFileSync(path3.join(dir, `held.${token}`), JSON.stringify({ version: 1, pid: process.pid, createdAt: Date.now() }), { mode: 384, flag: "wx" });
|
|
299
300
|
}
|
|
300
301
|
function retireStaleLock(lock) {
|
|
301
302
|
let entries;
|
|
@@ -317,7 +318,7 @@ function retireStaleLock(lock) {
|
|
|
317
318
|
for (const name of holders) {
|
|
318
319
|
let pid;
|
|
319
320
|
try {
|
|
320
|
-
const parsed = JSON.parse(fs2.readFileSync(
|
|
321
|
+
const parsed = JSON.parse(fs2.readFileSync(path3.join(lock, name), "utf8"));
|
|
321
322
|
if (parsed?.version !== 1 || !Number.isInteger(parsed.pid) || parsed.pid <= 0) return false;
|
|
322
323
|
pid = parsed.pid;
|
|
323
324
|
} catch {
|
|
@@ -332,7 +333,7 @@ function retireStaleLock(lock) {
|
|
|
332
333
|
}
|
|
333
334
|
for (const name of holders) {
|
|
334
335
|
try {
|
|
335
|
-
fs2.unlinkSync(
|
|
336
|
+
fs2.unlinkSync(path3.join(lock, name));
|
|
336
337
|
} catch (error) {
|
|
337
338
|
if (error.code !== "ENOENT") return false;
|
|
338
339
|
}
|
|
@@ -349,7 +350,7 @@ function acquireThreadLock(threadKey) {
|
|
|
349
350
|
if (acquiredLocks.has(threadKey)) return { acquired: true };
|
|
350
351
|
const lock = lockDirPath(threadKey);
|
|
351
352
|
const token = randomUUID();
|
|
352
|
-
const candidate =
|
|
353
|
+
const candidate = path3.join(threadsDir(), `lock.acquire.${token}`);
|
|
353
354
|
try {
|
|
354
355
|
try {
|
|
355
356
|
fs2.mkdirSync(candidate, { mode: 448 });
|
|
@@ -397,7 +398,7 @@ function releaseThreadLock(threadKey) {
|
|
|
397
398
|
acquiredLocks.delete(threadKey);
|
|
398
399
|
const lock = lockDirPath(threadKey);
|
|
399
400
|
try {
|
|
400
|
-
fs2.unlinkSync(
|
|
401
|
+
fs2.unlinkSync(path3.join(lock, `held.${token}`));
|
|
401
402
|
} catch {
|
|
402
403
|
}
|
|
403
404
|
try {
|
|
@@ -425,10 +426,10 @@ function threadOwner(input) {
|
|
|
425
426
|
// builtin/extensions/im-forward/event-dispatch.ts
|
|
426
427
|
import * as net from "node:net";
|
|
427
428
|
import * as fs3 from "node:fs";
|
|
428
|
-
import * as
|
|
429
|
+
import * as path4 from "node:path";
|
|
429
430
|
import { createHmac, randomUUID as randomUUID2 } from "node:crypto";
|
|
430
431
|
function discoveryDir() {
|
|
431
|
-
return
|
|
432
|
+
return path4.join(addressBookRoot(), "run", "ipc");
|
|
432
433
|
}
|
|
433
434
|
function pidAlive3(pid) {
|
|
434
435
|
if (!Number.isInteger(pid) || pid <= 0) return false;
|
|
@@ -450,7 +451,7 @@ function findOwnerInstance(sessionId) {
|
|
|
450
451
|
for (const name of entries.slice(0, 256)) {
|
|
451
452
|
if (!name.endsWith(".json")) continue;
|
|
452
453
|
try {
|
|
453
|
-
const parsed = JSON.parse(fs3.readFileSync(
|
|
454
|
+
const parsed = JSON.parse(fs3.readFileSync(path4.join(discoveryDir(), name), "utf8"));
|
|
454
455
|
if (parsed.instanceId === name.slice(0, -".json".length) && parsed.sessionId === sessionId && parsed.port && typeof parsed.secret === "string" && parsed.protocol === IPC_PROTOCOL_VERSION && pidAlive3(parsed.pid ?? 0)) {
|
|
455
456
|
candidates.push({ file: parsed, startedAt: typeof parsed.startedAt === "number" ? parsed.startedAt : 0 });
|
|
456
457
|
}
|
|
@@ -538,13 +539,13 @@ async function dispatchEventToSession(sessionId, eventText) {
|
|
|
538
539
|
|
|
539
540
|
// builtin/extensions/im-forward/session-roots.ts
|
|
540
541
|
import * as fs4 from "node:fs";
|
|
541
|
-
import * as
|
|
542
|
+
import * as path5 from "node:path";
|
|
542
543
|
function rootsDir() {
|
|
543
|
-
return
|
|
544
|
+
return path5.join(resolveConfigDir(), "im-forward", "roots");
|
|
544
545
|
}
|
|
545
546
|
function rootPath(provider, messageId) {
|
|
546
547
|
const safe = `${provider}:${messageId}`.replace(/[^a-zA-Z0-9._:-]/g, "_");
|
|
547
|
-
return
|
|
548
|
+
return path5.join(rootsDir(), `${safe}.json`);
|
|
548
549
|
}
|
|
549
550
|
function pidAlive4(pid) {
|
|
550
551
|
if (!Number.isInteger(pid) || pid <= 0) return false;
|
|
@@ -581,13 +582,13 @@ function sessionRootOwner(provider, messageId) {
|
|
|
581
582
|
|
|
582
583
|
// builtin/extensions/im-forward/session-anchors.ts
|
|
583
584
|
import * as fs5 from "node:fs";
|
|
584
|
-
import * as
|
|
585
|
+
import * as path6 from "node:path";
|
|
585
586
|
function anchorsDir() {
|
|
586
|
-
return
|
|
587
|
+
return path6.join(addressBookRoot(), "im-forward", "anchors");
|
|
587
588
|
}
|
|
588
589
|
function anchorPath(sessionId) {
|
|
589
590
|
const safe = sessionId.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
590
|
-
return
|
|
591
|
+
return path6.join(anchorsDir(), `${safe}.json`);
|
|
591
592
|
}
|
|
592
593
|
function loadPersistedAnchor(sessionId, identity) {
|
|
593
594
|
try {
|
|
@@ -620,7 +621,7 @@ function savePersistedAnchor(sessionId, identity, anchor) {
|
|
|
620
621
|
anchor
|
|
621
622
|
};
|
|
622
623
|
const target = anchorPath(sessionId);
|
|
623
|
-
fs5.mkdirSync(
|
|
624
|
+
fs5.mkdirSync(path6.dirname(target), { recursive: true });
|
|
624
625
|
fs5.writeFileSync(target, `${JSON.stringify(file)}
|
|
625
626
|
`, "utf8");
|
|
626
627
|
} catch {
|
|
@@ -934,7 +935,8 @@ ${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
|
|
|
934
935
|
}
|
|
935
936
|
if (inbound?.role === "user" && isConcierge && currentSessionId) {
|
|
936
937
|
const userText = typeof inbound.content === "string" ? inbound.content : Array.isArray(inbound.content) ? inbound.content.map((block) => block && typeof block === "object" && typeof block.text === "string" ? block.text : "").join("") : "";
|
|
937
|
-
const
|
|
938
|
+
const stampedWake = /^\[pie-ipc\][^\n]*says:\s*\n?\[(?:ipc-done|ipc-check|ipc-done-check)\] (?:No completion notification arrived for |The completion notification for )?requestId=[a-zA-Z0-9:-]+ (?:outcome=\S+ )?(?:\([^)]*\) )?user_assigned=true(?:\s|$)/;
|
|
939
|
+
const wrappedNotify = stampedWake.exec(userText);
|
|
938
940
|
if (wrappedNotify) {
|
|
939
941
|
const requestTag = /requestId=([a-zA-Z0-9:-]+)/.exec(userText)?.[1] ?? "ipc-delivery";
|
|
940
942
|
stampDeliveryDestination(`ipc-done:${requestTag}`);
|
|
@@ -997,11 +999,13 @@ ${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
|
|
|
997
999
|
async function forwardMessage(text, sessionId, sequence, userInput, replyTo, attribution) {
|
|
998
1000
|
pruneState();
|
|
999
1001
|
const sessionName = ctx.getSessionDisplayName?.() ?? ctx.getSessionName?.();
|
|
1002
|
+
const composeMode = resolveSessionAnchor(sessionId).threadId ? "topic-reply" : "topic-root";
|
|
1000
1003
|
const composed = composeForwardBody(
|
|
1001
1004
|
sessionId,
|
|
1002
1005
|
sessionName,
|
|
1003
1006
|
userInput,
|
|
1004
|
-
text
|
|
1007
|
+
text,
|
|
1008
|
+
composeMode
|
|
1005
1009
|
);
|
|
1006
1010
|
if (terminated || !isForwardingEnabled()) return;
|
|
1007
1011
|
const [chunks] = chunkMarkdown(composed);
|
|
@@ -1188,18 +1192,18 @@ ${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
|
|
|
1188
1192
|
const files = collectFileReferences(
|
|
1189
1193
|
text,
|
|
1190
1194
|
ctx.cwd,
|
|
1191
|
-
(
|
|
1195
|
+
(path12) => {
|
|
1192
1196
|
try {
|
|
1193
|
-
const stat = fs6.statSync(
|
|
1197
|
+
const stat = fs6.statSync(path12);
|
|
1194
1198
|
return { isFile: stat.isFile(), size: stat.size };
|
|
1195
1199
|
} catch {
|
|
1196
1200
|
return null;
|
|
1197
1201
|
}
|
|
1198
1202
|
},
|
|
1199
1203
|
{
|
|
1200
|
-
canonicalize: (
|
|
1204
|
+
canonicalize: (path12) => {
|
|
1201
1205
|
try {
|
|
1202
|
-
return fs6.realpathSync(
|
|
1206
|
+
return fs6.realpathSync(path12);
|
|
1203
1207
|
} catch {
|
|
1204
1208
|
return null;
|
|
1205
1209
|
}
|
|
@@ -1278,6 +1282,30 @@ ${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
|
|
|
1278
1282
|
claimThread: seamClaimThread,
|
|
1279
1283
|
anchors: sentAnchors
|
|
1280
1284
|
};
|
|
1285
|
+
registerTurnImDriver(() => {
|
|
1286
|
+
const sid = currentSessionId;
|
|
1287
|
+
if (!sid) return false;
|
|
1288
|
+
const messages = ctx.getMessages?.() ?? [];
|
|
1289
|
+
let lastUserText;
|
|
1290
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
1291
|
+
const message = messages[i];
|
|
1292
|
+
if (!isRecord(message) || message.role !== "user") continue;
|
|
1293
|
+
const joined = (typeof message.content === "string" ? message.content : Array.isArray(message.content) ? message.content.map((block) => isRecord(block) && typeof block.text === "string" ? block.text : "").join("") : "").trim();
|
|
1294
|
+
if (joined) {
|
|
1295
|
+
lastUserText = joined;
|
|
1296
|
+
break;
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
if (!lastUserText) return false;
|
|
1300
|
+
for (let j = 0; j < pendingInputs.length; j++) {
|
|
1301
|
+
const pending = pendingInputs[j];
|
|
1302
|
+
if (pending.sessionId !== sid) continue;
|
|
1303
|
+
const expected = (pending.messageId ? `${IM_INPUT_PREFIX}
|
|
1304
|
+
${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
|
|
1305
|
+
if (lastUserText === expected) return true;
|
|
1306
|
+
}
|
|
1307
|
+
return false;
|
|
1308
|
+
});
|
|
1281
1309
|
registerDispatchReceiver((text) => {
|
|
1282
1310
|
const trimmed = text.trimStart();
|
|
1283
1311
|
if (!trimmed.startsWith(DISPATCH_PREFIX)) return false;
|
|
@@ -1717,6 +1745,30 @@ ${caption || IM_INPUT_FALLBACK_CAPTION}`;
|
|
|
1717
1745
|
return resolvedBindingKey;
|
|
1718
1746
|
}
|
|
1719
1747
|
let consumerStartupInFlight = false;
|
|
1748
|
+
function residentAliveSomewhere() {
|
|
1749
|
+
if (isConcierge) return false;
|
|
1750
|
+
try {
|
|
1751
|
+
const dir = path.join(resolveConfigDir(), "run", "ipc");
|
|
1752
|
+
const entries = fs6.readdirSync(dir);
|
|
1753
|
+
for (const name of entries) {
|
|
1754
|
+
if (!name.endsWith(".json")) continue;
|
|
1755
|
+
try {
|
|
1756
|
+
const parsed = JSON.parse(fs6.readFileSync(path.join(dir, name), "utf8"));
|
|
1757
|
+
const unattended = parsed.unattended === true;
|
|
1758
|
+
if (unattended && typeof parsed.pid === "number" && parsed.pid > 0) {
|
|
1759
|
+
try {
|
|
1760
|
+
process.kill(parsed.pid, 0);
|
|
1761
|
+
return true;
|
|
1762
|
+
} catch {
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
} catch {
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
} catch {
|
|
1769
|
+
}
|
|
1770
|
+
return false;
|
|
1771
|
+
}
|
|
1720
1772
|
function needsCanonicalResolution() {
|
|
1721
1773
|
return !resolvedBindingKey && !cfg.appId && !!cfg.profile && connection.canonicalAppId !== void 0;
|
|
1722
1774
|
}
|
|
@@ -1733,6 +1785,10 @@ ${caption || IM_INPUT_FALLBACK_CAPTION}`;
|
|
|
1733
1785
|
}
|
|
1734
1786
|
function acquireClaimedSlot(binding) {
|
|
1735
1787
|
if (consumerLock) return true;
|
|
1788
|
+
if (!isConcierge && residentAliveSomewhere()) {
|
|
1789
|
+
ctx.log("im-forward: a live resident owns the feed class; standing down (dispatch mode)");
|
|
1790
|
+
return false;
|
|
1791
|
+
}
|
|
1736
1792
|
const claim = tryClaimConsumer(binding, `pie-${currentSessionId ?? "unknown"}`, () => {
|
|
1737
1793
|
ctx.log("im-forward: event-hub slot lost to another consumer; retiring ours");
|
|
1738
1794
|
consumerLock = void 0;
|
|
@@ -1907,6 +1963,7 @@ ${caption || IM_INPUT_FALLBACK_CAPTION}`;
|
|
|
1907
1963
|
inputEpoch++;
|
|
1908
1964
|
terminated = true;
|
|
1909
1965
|
registerDispatchReceiver(void 0);
|
|
1966
|
+
registerTurnImDriver(void 0);
|
|
1910
1967
|
consumerLock?.release();
|
|
1911
1968
|
consumerLock = void 0;
|
|
1912
1969
|
const resources = [...scopes];
|
|
@@ -2016,7 +2073,7 @@ Enable forwarding and start the connection? No test message will be sent. Saving
|
|
|
2016
2073
|
import { spawn as spawn4 } from "node:child_process";
|
|
2017
2074
|
import * as fs9 from "node:fs";
|
|
2018
2075
|
import * as os2 from "node:os";
|
|
2019
|
-
import * as
|
|
2076
|
+
import * as path11 from "node:path";
|
|
2020
2077
|
|
|
2021
2078
|
// builtin/extensions/im-forward/lark-cli.ts
|
|
2022
2079
|
import { spawn as spawn2 } from "node:child_process";
|
|
@@ -2025,24 +2082,24 @@ import { StringDecoder as StringDecoder2 } from "node:string_decoder";
|
|
|
2025
2082
|
// builtin/extensions/im-forward/launch.ts
|
|
2026
2083
|
import { spawn } from "node:child_process";
|
|
2027
2084
|
import * as fs7 from "node:fs";
|
|
2028
|
-
import * as
|
|
2085
|
+
import * as path7 from "node:path";
|
|
2029
2086
|
import { StringDecoder } from "node:string_decoder";
|
|
2030
2087
|
function resolveLaunchSpec(explicit, cwd = process.cwd(), platform = process.platform, env = process.env) {
|
|
2031
2088
|
const windows = platform === "win32";
|
|
2032
|
-
const candidates = explicit ? [
|
|
2089
|
+
const candidates = explicit ? [path7.resolve(cwd, explicit)] : (env.PATH ?? "").split(windows ? ";" : ":").filter(Boolean).flatMap((dir) => (windows ? ["lark-cli.exe", "lark-cli.cmd"] : ["lark-cli"]).map((name) => path7.resolve(cwd, dir, name)));
|
|
2033
2090
|
for (const candidate of candidates) {
|
|
2034
2091
|
try {
|
|
2035
2092
|
if (!fs7.statSync(candidate).isFile()) continue;
|
|
2036
|
-
const ext =
|
|
2093
|
+
const ext = path7.extname(candidate).toLowerCase();
|
|
2037
2094
|
if (ext === ".js" || ext === ".mjs") return { command: process.execPath, prefix: [candidate] };
|
|
2038
2095
|
if (windows && ext === ".cmd") {
|
|
2039
|
-
const dir =
|
|
2040
|
-
for (const root of [
|
|
2096
|
+
const dir = path7.dirname(candidate);
|
|
2097
|
+
for (const root of [path7.join(dir, "node_modules", "@larksuite", "cli"), path7.resolve(dir, "..", "@larksuite", "cli")]) {
|
|
2041
2098
|
try {
|
|
2042
|
-
const pkg = JSON.parse(fs7.readFileSync(
|
|
2099
|
+
const pkg = JSON.parse(fs7.readFileSync(path7.join(root, "package.json"), "utf8"));
|
|
2043
2100
|
const bin = typeof pkg.bin === "string" ? pkg.bin : pkg.bin?.["lark-cli"];
|
|
2044
2101
|
if (pkg.name !== "@larksuite/cli" || typeof bin !== "string" || bin.replace(/^\.\//, "") !== "scripts/run.js") continue;
|
|
2045
|
-
const entry =
|
|
2102
|
+
const entry = path7.join(root, "scripts", "run.js");
|
|
2046
2103
|
if (fs7.statSync(entry).isFile()) return { command: process.execPath, prefix: [entry] };
|
|
2047
2104
|
} catch {
|
|
2048
2105
|
}
|
|
@@ -2106,7 +2163,7 @@ function stopOwnedTreeInner(child, signal) {
|
|
|
2106
2163
|
}, 1500);
|
|
2107
2164
|
try {
|
|
2108
2165
|
const root = process.env.SystemRoot || process.env.windir || "C:\\Windows";
|
|
2109
|
-
killer = spawn(
|
|
2166
|
+
killer = spawn(path7.join(root, "System32", "taskkill.exe"), ["/PID", String(child.pid), "/T", "/F"], { shell: false, windowsHide: true, stdio: "ignore" });
|
|
2110
2167
|
killer.on("error", () => finish(false));
|
|
2111
2168
|
killer.on("exit", (code) => finish(code === 0));
|
|
2112
2169
|
} catch {
|
|
@@ -2352,16 +2409,16 @@ function extractImageKey(content) {
|
|
|
2352
2409
|
|
|
2353
2410
|
// builtin/extensions/im-forward/providers/feishu/setup.ts
|
|
2354
2411
|
import * as fs8 from "node:fs";
|
|
2355
|
-
import * as
|
|
2412
|
+
import * as path10 from "node:path";
|
|
2356
2413
|
|
|
2357
2414
|
// builtin/extensions/im-forward/browser.ts
|
|
2358
2415
|
import { spawn as spawn3 } from "node:child_process";
|
|
2359
|
-
import
|
|
2416
|
+
import path8 from "node:path";
|
|
2360
2417
|
var browserScript = "$ErrorActionPreference = 'Stop'; try { $reader = [System.IO.StreamReader]::new([Console]::OpenStandardInput(), [System.Text.Encoding]::UTF8); $url = $reader.ReadToEnd(); Start-Process -FilePath $url; exit 0 } catch { exit 1 }";
|
|
2361
2418
|
function browserLaunch(platform = process.platform, root = process.env.SystemRoot || "C:\\Windows") {
|
|
2362
2419
|
if (platform === "win32") {
|
|
2363
2420
|
if (!/^[A-Za-z]:\\/.test(root) || /[\x00-\x1f]/.test(root)) return;
|
|
2364
|
-
return { command:
|
|
2421
|
+
return { command: path8.win32.join(root, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"), args: ["-NoLogo", "-NoProfile", "-NonInteractive", "-EncodedCommand", Buffer.from(browserScript, "utf16le").toString("base64")], stdin: true };
|
|
2365
2422
|
}
|
|
2366
2423
|
if (platform === "darwin") return { command: "/usr/bin/open", args: ["--"], stdin: false };
|
|
2367
2424
|
if (platform === "linux") return { command: "/usr/bin/xdg-open", args: [], stdin: false };
|
|
@@ -2420,23 +2477,23 @@ async function openBrowser(url, signal, seam = {}) {
|
|
|
2420
2477
|
}
|
|
2421
2478
|
|
|
2422
2479
|
// builtin/extensions/im-forward/existing-app-terminal.ts
|
|
2423
|
-
import
|
|
2480
|
+
import path9 from "node:path";
|
|
2424
2481
|
var existingAppInnerScript = "$ErrorActionPreference = 'Stop'; try { $payload = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String('__PAYLOAD__')) | ConvertFrom-Json; Set-Location -LiteralPath $payload.cwd; & $payload.command @($payload.args); $code = $LASTEXITCODE; if ($null -eq $code) { exit 1 }; exit $code } catch { Write-Host 'Official setup failed. Close this window and retry from Pie.'; exit 1 }";
|
|
2425
2482
|
var existingAppOuterTemplate = "$ErrorActionPreference = 'Stop'; try { $inner = '" + existingAppInnerScript.replaceAll("'", "''") + "'; $encoded = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($inner)); $child = Start-Process -FilePath (Join-Path $PSHOME 'powershell.exe') -WindowStyle Normal -Wait -PassThru -ArgumentList @('-NoLogo', '-NoProfile', '-EncodedCommand', $encoded); exit $child.ExitCode } catch { exit 1 }";
|
|
2426
2483
|
function existingAppTerminal(binary, cwd, platform = process.platform, root = process.env.SystemRoot || "C:\\Windows") {
|
|
2427
2484
|
if (platform !== "win32" || !/^[A-Za-z]:\\/.test(root) || /[\x00-\x1f]/.test(root)) return null;
|
|
2428
2485
|
const payload = Buffer.from(JSON.stringify({ command: binary.command, args: [...binary.prefix, "config", "init", "--brand", "feishu"], cwd }), "utf8").toString("base64");
|
|
2429
2486
|
const script = existingAppOuterTemplate.replace("__PAYLOAD__", payload);
|
|
2430
|
-
return { command:
|
|
2487
|
+
return { command: path9.win32.join(root, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"), prefix: ["-NoLogo", "-NoProfile", "-NonInteractive", "-EncodedCommand", Buffer.from(script, "utf16le").toString("base64")] };
|
|
2431
2488
|
}
|
|
2432
2489
|
|
|
2433
2490
|
// builtin/extensions/im-forward/providers/feishu/setup.ts
|
|
2434
2491
|
function findNpmCli() {
|
|
2435
|
-
const dirs = [
|
|
2436
|
-
for (const dir of dirs) for (const root of [
|
|
2492
|
+
const dirs = [path10.dirname(process.execPath), ...(process.env.PATH ?? "").split(path10.delimiter)];
|
|
2493
|
+
for (const dir of dirs) for (const root of [path10.join(dir, "node_modules", "npm"), path10.resolve(dir, "..", "lib", "node_modules", "npm")]) {
|
|
2437
2494
|
try {
|
|
2438
|
-
const pkg = JSON.parse(fs8.readFileSync(
|
|
2439
|
-
const entry =
|
|
2495
|
+
const pkg = JSON.parse(fs8.readFileSync(path10.join(root, "package.json"), "utf8"));
|
|
2496
|
+
const entry = path10.join(root, "bin", "npm-cli.js");
|
|
2440
2497
|
if (pkg.name === "npm" && pkg.bin?.npm === "bin/npm-cli.js" && fs8.statSync(entry).isFile()) return { command: process.execPath, prefix: [entry] };
|
|
2441
2498
|
} catch {
|
|
2442
2499
|
}
|
|
@@ -3025,18 +3082,18 @@ function connect(binary, profile, targetKind = "chat") {
|
|
|
3025
3082
|
return Array.isArray(data?.messages) ? data.messages.flatMap((message) => isRecord(message) && typeof message.message_id === "string" ? [message.message_id] : []) : null;
|
|
3026
3083
|
},
|
|
3027
3084
|
async downloadImage(messageId, image, index) {
|
|
3028
|
-
const directory = fs9.mkdtempSync(
|
|
3085
|
+
const directory = fs9.mkdtempSync(path11.join(os2.tmpdir(), "pie-im-forward-"));
|
|
3029
3086
|
const cleanup = () => fs9.rmSync(directory, { recursive: true, force: true });
|
|
3030
3087
|
try {
|
|
3031
3088
|
const name = `image-${index + 1}.png`;
|
|
3032
3089
|
const result = await native(binary, profile ? ["im", "+messages-resources-download", "--as", "bot", "--message-id", messageId, "--file-key", image, "--type", "image", "--output", name, "--profile", profile] : ["im", "+messages-resources-download", "--as", "bot", "--message-id", messageId, "--file-key", image, "--type", "image", "--output", name], 3e4, directory, { signal: lifetime.signal });
|
|
3033
3090
|
if (result.error || !parseLarkCliEnvelope(result.stdout).ok) throw new Error("Image download failed");
|
|
3034
|
-
let target =
|
|
3091
|
+
let target = path11.join(directory, name);
|
|
3035
3092
|
if (fs9.statSync(target).size > 10 * 1024 * 1024) throw new Error("Image exceeds 10 MiB");
|
|
3036
3093
|
const detected = readImageFormat(target);
|
|
3037
3094
|
if (detected.ext === ".bin") throw new Error("Unsupported image format");
|
|
3038
3095
|
if (detected.ext !== ".png") {
|
|
3039
|
-
const corrected =
|
|
3096
|
+
const corrected = path11.join(directory, `image-${index + 1}${detected.ext}`);
|
|
3040
3097
|
fs9.renameSync(target, corrected);
|
|
3041
3098
|
target = corrected;
|
|
3042
3099
|
}
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
clipBody,
|
|
16
16
|
foldLifecycleEvent,
|
|
17
17
|
generateInstanceId,
|
|
18
|
+
isTurnUserImDriven,
|
|
18
19
|
isValidInstanceId,
|
|
19
20
|
isWrappedInboundText,
|
|
20
21
|
parseStatusFile,
|
|
@@ -24,7 +25,7 @@ import {
|
|
|
24
25
|
takeDispatchFrame,
|
|
25
26
|
wrapInboundText,
|
|
26
27
|
wrappedMessageMarker
|
|
27
|
-
} from "../../../chunks/chunk-
|
|
28
|
+
} from "../../../chunks/chunk-H5G55G3R.js";
|
|
28
29
|
import {
|
|
29
30
|
Type
|
|
30
31
|
} from "../../../chunks/chunk-XXGYUYXI.js";
|
|
@@ -523,7 +524,8 @@ function buildStatusFile(input) {
|
|
|
523
524
|
updatedAt: Date.now(),
|
|
524
525
|
state: "idle",
|
|
525
526
|
undeliveredInjections: 0,
|
|
526
|
-
port: input.port
|
|
527
|
+
port: input.port,
|
|
528
|
+
...input.unattended === true ? { unattended: true } : {}
|
|
527
529
|
};
|
|
528
530
|
}
|
|
529
531
|
|
|
@@ -1341,7 +1343,8 @@ var Runtime = class {
|
|
|
1341
1343
|
sessionId: this.sessionId,
|
|
1342
1344
|
sessionName: this.sessionName,
|
|
1343
1345
|
cwd: this.ctx.cwd,
|
|
1344
|
-
port
|
|
1346
|
+
port,
|
|
1347
|
+
unattended: this.ctx.capabilities?.unattended === true
|
|
1345
1348
|
});
|
|
1346
1349
|
this.statusBase.secret = this.transport.secret;
|
|
1347
1350
|
this.serverReady = true;
|
|
@@ -1468,7 +1471,10 @@ var Runtime = class {
|
|
|
1468
1471
|
return;
|
|
1469
1472
|
}
|
|
1470
1473
|
const doneMatch = /^\[ipc-done\] requestId=([a-zA-Z0-9:-]{1,128}) /.exec(envelope.text ?? "");
|
|
1471
|
-
if (doneMatch && this.allowPolicy.allows(envelope.from))
|
|
1474
|
+
if (doneMatch && this.allowPolicy.allows(envelope.from)) {
|
|
1475
|
+
const stampedDone = /^\[ipc-done\] requestId=[a-zA-Z0-9:-]{1,128} (?:outcome=\S+ )?(?:\([^)]*\) )?user_assigned=true(?:\s|$)/.test((envelope.text ?? "").split("\n")[0] ?? "");
|
|
1476
|
+
this.completeNotify(doneMatch[1], stampedDone);
|
|
1477
|
+
}
|
|
1472
1478
|
if (envelope.waitMs && this.awaitingReply.size >= 100) {
|
|
1473
1479
|
reply("result", "rejected: reply capacity reached");
|
|
1474
1480
|
return;
|
|
@@ -1674,7 +1680,7 @@ ${body}` : ""}`;
|
|
|
1674
1680
|
* hint so the model checks ipc_result itself. The wake goes through the
|
|
1675
1681
|
* normal inbound path (sendUserMessage), which the interactive host queues
|
|
1676
1682
|
* when busy and the embedded host emits as a user.message event. */
|
|
1677
|
-
armNotifyFallback(requestId, fallbackMs, peerName) {
|
|
1683
|
+
armNotifyFallback(requestId, fallbackMs, peerName, userAssigned = false) {
|
|
1678
1684
|
if (this.completedNotifies.has(requestId)) {
|
|
1679
1685
|
this.completedNotifies.delete(requestId);
|
|
1680
1686
|
return true;
|
|
@@ -1688,7 +1694,8 @@ ${body}` : ""}`;
|
|
|
1688
1694
|
this.notifyFallbacks.delete(requestId);
|
|
1689
1695
|
this.completedNotifies.delete(requestId);
|
|
1690
1696
|
if (this.disposed) return;
|
|
1691
|
-
const
|
|
1697
|
+
const hintBody = `[ipc-check] No completion notification arrived for requestId=${requestId}${userAssigned ? " user_assigned=true" : ""} (peer ${peerName}) within ${Math.round(fallbackMs / 1e3)}s. Query ipc_result for the authoritative status; accepted/running means the peer is still working \u2014 keep waiting or check again later, and never resend while a result is pending.`;
|
|
1698
|
+
const hint = wrapInboundText(`local-recovery (${peerName})`, hintBody);
|
|
1692
1699
|
try {
|
|
1693
1700
|
const scope = this.ctx.beginUserInput?.();
|
|
1694
1701
|
if (scope) {
|
|
@@ -1710,7 +1717,7 @@ ${body}` : ""}`;
|
|
|
1710
1717
|
* not observation, so instead of silently cancelling the only wake, the
|
|
1711
1718
|
* fallback fires IMMEDIATELY as a [ipc-done-check] hint carrying the
|
|
1712
1719
|
* outcome — every host kind surfaces the completion exactly once. */
|
|
1713
|
-
completeNotify(requestId) {
|
|
1720
|
+
completeNotify(requestId, userAssigned = false) {
|
|
1714
1721
|
const willInject = this.delivery?.willInjectNow() ?? this.ctx.capabilities.editorInjection;
|
|
1715
1722
|
if (willInject) {
|
|
1716
1723
|
this.clearNotifyFallback(requestId);
|
|
@@ -1725,7 +1732,9 @@ ${body}` : ""}`;
|
|
|
1725
1732
|
}
|
|
1726
1733
|
if (this.disposed) return;
|
|
1727
1734
|
try {
|
|
1728
|
-
|
|
1735
|
+
const stamped = userAssigned ? " user_assigned=true" : "";
|
|
1736
|
+
const body = `[ipc-done-check] The completion notification for requestId=${requestId}${stamped} is waiting in the ipc inbox (this host is not auto-injecting right now \u2014 muted, degraded, or embedded). Call ipc_poll to read it; the outcome line starts with [ipc-done]. Do not resend.`;
|
|
1737
|
+
this.ctx.sendUserMessage(wrapInboundText("local-inbox-wake", body));
|
|
1729
1738
|
} catch {
|
|
1730
1739
|
}
|
|
1731
1740
|
}
|
|
@@ -1862,20 +1871,7 @@ last body (snapshot; may be stale): ${clipBody(target.lastBodyText, 400)}` : ""}
|
|
|
1862
1871
|
const sendGeneration = this.notifyGeneration;
|
|
1863
1872
|
let userAssigned = false;
|
|
1864
1873
|
if (notifyMode) {
|
|
1865
|
-
|
|
1866
|
-
const messages = this.ctx.getMessages?.() ?? [];
|
|
1867
|
-
for (let i = messages.length - 1; i >= 0; i--) {
|
|
1868
|
-
const message = messages[i];
|
|
1869
|
-
if (!message || message.role !== "user") continue;
|
|
1870
|
-
const content = message.content;
|
|
1871
|
-
const text2 = typeof content === "string" ? content : Array.isArray(content) ? content.map((block) => block && typeof block === "object" && "text" in block && typeof block.text === "string" ? block.text : "").join("") : "";
|
|
1872
|
-
const trimmed = text2.trim();
|
|
1873
|
-
if (!trimmed) continue;
|
|
1874
|
-
userAssigned = /^\[(Feishu|Other)\]/.test(trimmed) && !trimmed.startsWith("[ipc-done]") && !trimmed.startsWith("[pie-ipc]");
|
|
1875
|
-
break;
|
|
1876
|
-
}
|
|
1877
|
-
} catch {
|
|
1878
|
-
}
|
|
1874
|
+
userAssigned = isTurnUserImDriven();
|
|
1879
1875
|
}
|
|
1880
1876
|
const reply = await this.transport.send(target.instanceId, target.port, "message", {
|
|
1881
1877
|
requestId,
|
|
@@ -1895,7 +1891,7 @@ last body (snapshot; may be stale): ${clipBody(target.lastBodyText, 400)}` : ""}
|
|
|
1895
1891
|
}
|
|
1896
1892
|
if (!reply) {
|
|
1897
1893
|
const peerName2 = peerLabel(target.instanceId, target.displayName);
|
|
1898
|
-
const armed2 = this.armNotifyFallback(requestId, fallbackMs, peerName2);
|
|
1894
|
+
const armed2 = this.armNotifyFallback(requestId, fallbackMs, peerName2, userAssigned);
|
|
1899
1895
|
return {
|
|
1900
1896
|
content: [{ type: "text", text: `Receipt UNCONFIRMED \u2014 the request may already be accepted by ${peerName2} (accepted work is never cancelled). Query ipc_result with requestId=${requestId} before resending. ${armed2 ? `A fallback check is armed for ${Math.round(fallbackMs / 1e3)}s if the peer's completion push never arrives.` : "No automatic wake is armed (fallback budget exhausted) \u2014 check ipc_result yourself."}` }],
|
|
1901
1897
|
isError: true,
|
|
@@ -1906,7 +1902,7 @@ last body (snapshot; may be stale): ${clipBody(target.lastBodyText, 400)}` : ""}
|
|
|
1906
1902
|
return { content: [{ type: "text", text: reply.text ?? "(empty reply)" }], isError: true, details: { requestId } };
|
|
1907
1903
|
}
|
|
1908
1904
|
const peerName = peerLabel(target.instanceId, target.displayName);
|
|
1909
|
-
const armed = this.armNotifyFallback(requestId, fallbackMs, peerName);
|
|
1905
|
+
const armed = this.armNotifyFallback(requestId, fallbackMs, peerName, userAssigned);
|
|
1910
1906
|
return { content: [{ type: "text", text: armed ? `Sent to ${peerName} with completion subscription (receipt acked as ${reply.kind}; the peer pushes one [ipc-done] notification when its turn settles). If no notification arrives within ${Math.round(fallbackMs / 1e3)}s, check ipc_result with this requestId; do not resend on a pending result. requestId=${requestId}` : `Sent to ${peerName} with completion subscription (receipt acked). The local fallback-wake budget is exhausted (${this.notifyFallbacks.size} outstanding checks), so NO automatic wake is armed for this request \u2014 check ipc_result yourself when you need its result. requestId=${requestId}` }], details: { requestId } };
|
|
1911
1907
|
}
|
|
1912
1908
|
if (!wait) {
|
|
@@ -37,7 +37,8 @@ function inputHeaderLine(userInput) {
|
|
|
37
37
|
}
|
|
38
38
|
return `> [UserInput] ${escaped}`;
|
|
39
39
|
}
|
|
40
|
-
function composeForwardBody(sessionId, sessionName, userInput, text) {
|
|
40
|
+
function composeForwardBody(sessionId, sessionName, userInput, text, mode = "topic-root") {
|
|
41
|
+
if (mode === "topic-reply") return text;
|
|
41
42
|
const lines = [`**[Pie] \xB7 ${sessionLabel(sessionId, sessionName)}**`];
|
|
42
43
|
const input = inputHeaderLine(userInput);
|
|
43
44
|
if (input) lines.push(input);
|
|
@@ -551,6 +552,17 @@ import * as fs2 from "node:fs";
|
|
|
551
552
|
import * as path2 from "node:path";
|
|
552
553
|
var DISPATCH_PREFIX = "[im-forward-dispatch]";
|
|
553
554
|
var dispatchReceiver;
|
|
555
|
+
var turnImDriverOracle;
|
|
556
|
+
function registerTurnImDriver(oracle) {
|
|
557
|
+
turnImDriverOracle = oracle;
|
|
558
|
+
}
|
|
559
|
+
function isTurnUserImDriven() {
|
|
560
|
+
try {
|
|
561
|
+
return turnImDriverOracle?.() === true;
|
|
562
|
+
} catch {
|
|
563
|
+
return false;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
554
566
|
function registerDispatchReceiver(receiver) {
|
|
555
567
|
dispatchReceiver = receiver;
|
|
556
568
|
}
|
|
@@ -1025,6 +1037,8 @@ export {
|
|
|
1025
1037
|
readLiveConfig,
|
|
1026
1038
|
resolveImForwardConfig,
|
|
1027
1039
|
DISPATCH_PREFIX,
|
|
1040
|
+
registerTurnImDriver,
|
|
1041
|
+
isTurnUserImDriven,
|
|
1028
1042
|
registerDispatchReceiver,
|
|
1029
1043
|
takeDispatchFrame,
|
|
1030
1044
|
tryClaimConsumer,
|
|
@@ -21,9 +21,9 @@ ${CRON_SECTION_MARKER}
|
|
|
21
21
|
- \u4F60\u6240\u5728\u7684\u65E0\u503C\u5B88\u5BBF\u4E3B\u53EF\u4EE5\u81EA\u5DF1\u7528 cron_manage\uFF08\u65E0\u4EBA\u503C\u5B88\u4E0A\u81EA\u52A8\u6388\u6743\u5E76\u7559\u75D5\uFF0C\u4E0D\u5FC5\u7B49\u4EBA\u786E\u8BA4\uFF09\u3002\u9002\u5408\u201C\u6BCF\u5929 9 \u70B9\u7ED9\u6211\u7B80\u62A5\u201D\u8FD9\u7C7B\u56FA\u5B9A\u8282\u594F\u7684\u4E8B\uFF1B\u4E0D\u9002\u5408\u62FF\u6765\u4EE3\u66FF worker \u5E72\u6D3B\u3002
|
|
22
22
|
- \u5BBF\u4E3B\u91CD\u542F\u540E\uFF08\u5C24\u5176\u5D29\u6E83/\u65AD\u7535/OOM \u4E4B\u540E\uFF09\u7684\u7B2C\u4E00\u6B21\u5BF9\u8BDD\uFF0C\u5148\u7528 cron_manage list \u770B\u4E00\u773C\uFF1A\u82E5\u6709 blocked \u7684\u4EFB\u52A1\uFF0C\u8BF4\u660E\u4E0A\u6B21\u6267\u884C\u7ED3\u679C\u4E0D\u786E\u5B9A\uFF0C\u8981\u539F\u6837\u544A\u8BC9\u7528\u6237\u5E76\u7B49\u4ED6\u51B3\u5B9A\u662F\u5426 resume\uFF1B**\u4E0D\u8981\u81EA\u4F5C\u4E3B\u5F20 resume\uFF0C\u4E5F\u4E0D\u8981\u5220\u4E86\u91CD\u5EFA**\uFF08\u91CD\u5EFA\u4F1A\u4E22\u6389\u4E0D\u786E\u5B9A\u6267\u884C\u7684\u8BB0\u5F55\uFF09\u3002
|
|
23
23
|
`;
|
|
24
|
-
var SEED_AGENTS_MD = `# Pie Concierge
|
|
24
|
+
var SEED_AGENTS_MD = `# Pie Concierge (manager)
|
|
25
25
|
|
|
26
|
-
\u4F60\u662F\u7528\u6237\u7684\u5E38\u9A7B
|
|
26
|
+
\u4F60\u662F\u7528\u6237\u7684\u5E38\u9A7B manager pie\uFF1A\u7ED1\u5B9A IM\uFF08\u5E73\u53F0\u65E0\u5173\uFF09\uFF0C\u65E0\u4EBA\u503C\u5B88\uFF0C\u901A\u8FC7 IM \u4E0E\u7528\u6237\u5BF9\u8BDD\u3002
|
|
27
27
|
|
|
28
28
|
## \u89D2\u8272\u51C6\u5219
|
|
29
29
|
|
|
@@ -176,6 +176,13 @@ function seedWorkspace(dir) {
|
|
|
176
176
|
if (current.includes(v1Marker) && !current.includes(v2Marker)) {
|
|
177
177
|
fs.writeFileSync(agents, SEED_AGENTS_MD);
|
|
178
178
|
}
|
|
179
|
+
const oldV2Intro = "\u4F60\u662F\u7528\u6237\u7684\u5E38\u9A7B\u7BA1\u5BB6 pie";
|
|
180
|
+
const newV2Intro = "\u4F60\u662F\u7528\u6237\u7684\u5E38\u9A7B manager pie";
|
|
181
|
+
if (current.includes(oldV2Intro) && !current.includes(newV2Intro)) {
|
|
182
|
+
fs.writeFileSync(agents, SEED_AGENTS_MD);
|
|
183
|
+
} else if (current.includes("\u7BA1\u5BB6") && current.includes(v2Marker) && !current.includes(newV2Intro)) {
|
|
184
|
+
fs.appendFileSync(agents, "\n> \u6CE8\u610F\uFF1A\u5E38\u9A7B\u89D2\u8272\u5DF2\u66F4\u540D manager\uFF08\u539F\u300C\u7BA1\u5BB6\u300D\uFF09\u3002\u5982\u9700\u65B0\u7248\u89D2\u8272\u5361\u53EF\u624B\u52A8\u66F4\u65B0\u3002\n");
|
|
185
|
+
}
|
|
179
186
|
}
|
|
180
187
|
function isTooBroadForWorkerSandbox(input) {
|
|
181
188
|
let resolved;
|
|
@@ -274,10 +281,10 @@ function spawnResident(state, dir) {
|
|
|
274
281
|
detached: true,
|
|
275
282
|
stdio: ["ignore", out, out],
|
|
276
283
|
windowsHide: true,
|
|
277
|
-
// PIE_PROC_CURATED_NAME: the resident's display name is
|
|
284
|
+
// PIE_PROC_CURATED_NAME: the resident's display name is manager from the
|
|
278
285
|
// very first composition (v2 Phase 1.3) — never the first IM/terminal
|
|
279
286
|
// message title, never a flip-flopping derived label.
|
|
280
|
-
env: { ...process.env, PIE_PROC_CURATED_NAME: "
|
|
287
|
+
env: { ...process.env, PIE_PROC_CURATED_NAME: "manager" }
|
|
281
288
|
});
|
|
282
289
|
child.unref();
|
|
283
290
|
writeState({ ...state, pid: child.pid, startedAt: Date.now() });
|
package/dist/cli.js
CHANGED
|
@@ -86782,7 +86782,7 @@ async function main() {
|
|
|
86782
86782
|
return;
|
|
86783
86783
|
}
|
|
86784
86784
|
if (args[0] === STABLE_CLI_COMMANDS.concierge) {
|
|
86785
|
-
const { runConciergeCommand } = await import("./chunks/concierge-cli-
|
|
86785
|
+
const { runConciergeCommand } = await import("./chunks/concierge-cli-MCHXTFBA.js");
|
|
86786
86786
|
try {
|
|
86787
86787
|
await runConciergeCommand(args.slice(1));
|
|
86788
86788
|
} catch (error) {
|