@cydm/pie 4.4.3 → 4.5.1
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/README.md +24 -0
- package/dist/builtin/extensions/cron/index.js +1 -1
- package/dist/builtin/extensions/im-forward/index.js +272 -83
- package/dist/builtin/extensions/memory/index.js +2 -2
- package/dist/builtin/extensions/pie-ipc/README.md +1 -1
- package/dist/builtin/extensions/pie-ipc/index.js +30 -6
- package/dist/builtin/extensions/pie-proc/index.js +10 -2
- package/dist/builtin/extensions/plan-mode/index.js +4 -4
- package/dist/chunks/{chunk-JMKLTTZQ.js → chunk-2CJIENLY.js} +1 -0
- package/dist/chunks/{chunk-X6LBWHK3.js → chunk-7RJXKN7N.js} +1 -1
- package/dist/chunks/{manager-cli-WEHNUV5T.js → manager-cli-T26F3FUW.js} +299 -141
- package/dist/chunks/manager-upgrade-YVHK3XZE.js +582 -0
- package/dist/cli.js +62 -10
- package/package.json +2 -2
|
@@ -213,7 +213,7 @@ ${injectionMemo.text}` };
|
|
|
213
213
|
const snapshotConsumedIn = (snapshot, output) => materialConsumedIn(snapshot.text, snapshot.quotes, output);
|
|
214
214
|
ctx.registerTool({
|
|
215
215
|
name: "memory_save",
|
|
216
|
-
description: 'Explicitly save a durable memory. HIGHEST-PRIORITY RULE: when the user explicitly asks to remember something (e.g. "\u8BB0\u4F4F\u2026", "from now on\u2026", "always\u2026"), you MUST call this tool \u2014 never claim you will remember without a successful call. Supersedes conflicting entries of the same kind automatically. After success, confirm briefly (e.g. "\
|
|
216
|
+
description: 'Explicitly save a durable memory. HIGHEST-PRIORITY RULE: when the user explicitly asks to remember something (e.g. "\u8BB0\u4F4F\u2026", "from now on\u2026", "always\u2026"), you MUST call this tool \u2014 never claim you will remember without a successful call. Supersedes conflicting entries of the same kind automatically. After success, confirm briefly (e.g. "Remembered: \u2026"). If this tool is unavailable, say the request only holds for the current session.',
|
|
217
217
|
parameters: Type.Object({
|
|
218
218
|
kind: Type.Union([
|
|
219
219
|
Type.Literal("preference"),
|
|
@@ -322,7 +322,7 @@ function buildInjectionSectionWithIds(store, budget, projectKey) {
|
|
|
322
322
|
fit = cut > 0 ? fit.slice(0, cut) : fit.slice(0, Math.floor(fit.length / 2));
|
|
323
323
|
}
|
|
324
324
|
soulText = fit.length > 0 ? `${fit}
|
|
325
|
-
\u2026
|
|
325
|
+
\u2026 (Persona truncated: SOUL.md exceeds its budget; shorten ~/.pie/memory/SOUL.md.)` : void 0;
|
|
326
326
|
soulBudgetTokens = fit.length > 0 ? estimateTokens(fit) : 0;
|
|
327
327
|
}
|
|
328
328
|
}
|
|
@@ -16,6 +16,6 @@ Absent `allowPeers` defaults to `["*"]`, trusting authenticated local clients; a
|
|
|
16
16
|
|
|
17
17
|
Use `/tools/ipc peers`, `/tools/ipc status <peer>`, `/tools/ipc send <peer> <text>`, `/tools/ipc result <peer> [requestId]`, `/tools/ipc poll`, `/tools/ipc name`, `/tools/ipc mute [off]`, and `/tools/ipc allow <id|*>`. Only explicit `/tools/ipc poll` submits command output to the model; other commands notify the user. Changes from commands are ephemeral.
|
|
18
18
|
|
|
19
|
-
Tools: `ipc_list_peers`, `ipc_status`, `ipc_send_notify`, `ipc_result`, `ipc_poll`. Every send exposes a requestId. `ipc_send_notify` — the name is the contract: sending subscribes to completion by DEFAULT (returns after the receipt ack; the peer pushes one `[ipc-done]` message with outcome + bounded answer when its turn settles). On interactive AND embedded resident hosts it is injected (single wake — both are editorInjection hosts); on one-shot headless clients it lands in the pollable inbox with an informational `[ipc-done-check]` hint. A local fallback timer (`fallbackMs`) wakes a result check if no push arrives. Explicit `notify:false` opts out to fire-and-forget (no wake, receipt unconfirmed). Non-waiting requests can be polled with `ipc_result` through accepted/running/done or failed; omitting requestId lists recent results. Reads do not consume results. Results are session-scoped, bounded, retained in memory only, and unknown after eviction/restart. A receipt is not a result: waited results use the original authenticated socket after input consumption and execution settlement. Queued/muted input never receives unrelated turn output. Delivery is bounded, best-effort, not durable; uncertain busy followups are never automatically duplicated. Restart every peer after protocol changes; there is no compatibility layer. Windows uses native HANDLE-based
|
|
19
|
+
Tools: `ipc_list_peers`, `ipc_status`, `ipc_send_notify`, `ipc_result`, `ipc_poll`. Every send exposes a requestId. `ipc_send_notify` — the name is the contract: sending subscribes to completion by DEFAULT (returns after the receipt ack; the peer pushes one `[ipc-done]` message with outcome + bounded answer when its turn settles). On interactive AND embedded resident hosts it is injected (single wake — both are editorInjection hosts); on one-shot headless clients it lands in the pollable inbox with an informational `[ipc-done-check]` hint. A local fallback timer (`fallbackMs`) wakes a result check if no push arrives. Explicit `notify:false` opts out to fire-and-forget (no wake, receipt unconfirmed). Non-waiting requests can be polled with `ipc_result` through accepted/running/done or failed; omitting requestId lists recent results. Reads do not consume results. Results are session-scoped, bounded, retained in memory only, and unknown after eviction/restart. A receipt is not a result: waited results use the original authenticated socket after input consumption and execution settlement. Queued/muted input never receives unrelated turn output. Delivery is bounded, best-effort, not durable; uncertain busy followups are never automatically duplicated. Restart every peer after protocol changes; there is no compatibility layer. Windows uses native HANDLE-based owner checks and private discovery-directory/file ACL checks, with atomic protected directory and temporary-file creation. Ancestor write grants (including sandbox grants on the profile) no longer disable IPC: availability takes precedence over defending against hostile concurrent ancestor mutation. Owner/type checks, observed reparse rejection, and per-operation no-delete handles remain, but these are not a guarantee against path redirection races. Unsafe discovery-directory/file ACLs still fail closed without repair; no user/system ACLs are rewritten and there is no presence-only fallback. Same-user isolation, hostile ancestor mutation, and the stale-advertisement/first-send unencrypted endpoint-identity limitation remain outside this guarantee; see the complete contract below.
|
|
20
20
|
|
|
21
21
|
See [the complete contract](../../../../../docs/pie-ipc.md) for configuration, HMAC/permissions, snapshot freshness, limits, recovery limitations, and reproducible tests including a checked-in two-process factory dogfood driver.
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
takeDispatchFrame,
|
|
28
28
|
wrapInboundText,
|
|
29
29
|
wrappedMessageMarker
|
|
30
|
-
} from "../../../chunks/chunk-
|
|
30
|
+
} from "../../../chunks/chunk-2CJIENLY.js";
|
|
31
31
|
import "../../../chunks/chunk-ZPJ3BNQB.js";
|
|
32
32
|
import "../../../chunks/chunk-LZQXQOPJ.js";
|
|
33
33
|
|
|
@@ -125,9 +125,10 @@ function initialize() {
|
|
|
125
125
|
if (!directory && (b.readUInt32LE(40) !== 1 || b.readUInt32LE(32) !== 0)) fail();
|
|
126
126
|
const owner = [null], dacl = [null], sd = [null];
|
|
127
127
|
try {
|
|
128
|
-
if (security(h, 1, 5, owner, null, dacl, null, sd) !== 0 || !owner[0] || !dacl[0]) fail();
|
|
128
|
+
if (security(h, 1, privateObject ? 5 : 1, owner, null, privateObject ? dacl : null, null, sd) !== 0 || !owner[0] || privateObject && !dacl[0]) fail();
|
|
129
129
|
const ownerSid = sid(owner[0]);
|
|
130
130
|
if (!trusted.has(ownerSid) && !(!privateObject && systemAncestor && ownerSid === installer)) fail();
|
|
131
|
+
if (!privateObject) return b.readUInt32LE(36);
|
|
131
132
|
const header = Buffer.from(k.decode(dacl[0], "uint8", 8));
|
|
132
133
|
const count = header.readUInt16LE(4);
|
|
133
134
|
for (let i = 0; i < count; i++) {
|
|
@@ -139,8 +140,7 @@ function initialize() {
|
|
|
139
140
|
if (head[0] !== 0 || head.readUInt16LE(2) < 12) fail();
|
|
140
141
|
const principal = sid(k.address(a[0]) + 8n);
|
|
141
142
|
const mask = head.readUInt32LE(4);
|
|
142
|
-
|
|
143
|
-
if (!trusted.has(principal) && (privateObject ? mask !== 0 : !!(mask & dangerousAncestorRights))) fail();
|
|
143
|
+
if (!trusted.has(principal) && mask !== 0) fail();
|
|
144
144
|
}
|
|
145
145
|
} finally {
|
|
146
146
|
if (sd[0]) free(sd[0]);
|
|
@@ -276,6 +276,7 @@ function windowsSecurity() {
|
|
|
276
276
|
// builtin/extensions/pie-ipc/discovery.ts
|
|
277
277
|
import * as path3 from "node:path";
|
|
278
278
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
279
|
+
import { fileURLToPath } from "node:url";
|
|
279
280
|
function ipcDiscoveryDir(configDir) {
|
|
280
281
|
return process.platform === "win32" ? `${canonicalWindowsDirectory(configDir)}\\run\\ipc` : path3.join(configDir, "run", "ipc");
|
|
281
282
|
}
|
|
@@ -451,9 +452,32 @@ function buildStatusFile(input) {
|
|
|
451
452
|
state: "idle",
|
|
452
453
|
undeliveredInjections: 0,
|
|
453
454
|
port: input.port,
|
|
454
|
-
...input.unattended === true ? { unattended: true } : {}
|
|
455
|
+
...input.unattended === true ? { unattended: true } : {},
|
|
456
|
+
// 4.4.4: the running pie's version (upgrade visibility — the panel
|
|
457
|
+
// shows which peers are on stale code). Additive: old peers simply
|
|
458
|
+
// omit it and readers render "—".
|
|
459
|
+
...piePackageVersion() ? { version: piePackageVersion() } : {}
|
|
455
460
|
};
|
|
456
461
|
}
|
|
462
|
+
function piePackageVersion() {
|
|
463
|
+
if (cachedVersion !== void 0) return cachedVersion || void 0;
|
|
464
|
+
try {
|
|
465
|
+
const here = path3.dirname(fileURLToPath(import.meta.url));
|
|
466
|
+
for (const up of [3, 4, 5]) {
|
|
467
|
+
const pkgPath = path3.resolve(here, ...Array(up).fill(".."), "package.json");
|
|
468
|
+
if (!fs2.existsSync(pkgPath)) continue;
|
|
469
|
+
const parsed = JSON.parse(fs2.readFileSync(pkgPath, "utf8"));
|
|
470
|
+
if (parsed.name === "@cydm/pie" && typeof parsed.version === "string") {
|
|
471
|
+
cachedVersion = parsed.version;
|
|
472
|
+
return parsed.version;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
} catch {
|
|
476
|
+
}
|
|
477
|
+
cachedVersion = "";
|
|
478
|
+
return void 0;
|
|
479
|
+
}
|
|
480
|
+
var cachedVersion;
|
|
457
481
|
|
|
458
482
|
// builtin/extensions/pie-ipc/delivery.ts
|
|
459
483
|
var AllowPolicy = class {
|
|
@@ -1746,7 +1770,7 @@ function pieIpcExtension(ctx) {
|
|
|
1746
1770
|
try {
|
|
1747
1771
|
discoveryDir = ipcDiscoveryDir(configDir);
|
|
1748
1772
|
} catch {
|
|
1749
|
-
ctx.log("pie-ipc: disabled:
|
|
1773
|
+
ctx.log("pie-ipc: disabled: discovery path validation failed");
|
|
1750
1774
|
return;
|
|
1751
1775
|
}
|
|
1752
1776
|
const { config, problems } = loadConfig(ctx, configDir);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
readProcessCommandLine
|
|
4
|
-
} from "../../../chunks/chunk-
|
|
4
|
+
} from "../../../chunks/chunk-7RJXKN7N.js";
|
|
5
5
|
import {
|
|
6
6
|
liveSessionHolder
|
|
7
7
|
} from "../../../chunks/chunk-CGSFBWOM.js";
|
|
@@ -556,7 +556,15 @@ function pieProc(ctx) {
|
|
|
556
556
|
PIE_IPC_CONFIG_DIR: inheritedIpcRoot,
|
|
557
557
|
PIE_IPC_DISPLAY_NAME: params.kind === "resident" ? params.name : process.env.PIE_IPC_DISPLAY_NAME
|
|
558
558
|
};
|
|
559
|
-
if (params.kind === "oneshot")
|
|
559
|
+
if (params.kind === "oneshot") {
|
|
560
|
+
childEnv[ONESHOT_TASK_ENV] = params.task ?? "";
|
|
561
|
+
const explicitTimeout = Number(childEnv.PIE_PRINT_TURN_TIMEOUT_MS);
|
|
562
|
+
const validOverride = Number.isFinite(explicitTimeout) && explicitTimeout > 0 && String(explicitTimeout) === String(childEnv.PIE_PRINT_TURN_TIMEOUT_MS).trim();
|
|
563
|
+
if (childEnv.PIE_PRINT_TURN_TIMEOUT_MS === "0") {
|
|
564
|
+
} else if (!validOverride) {
|
|
565
|
+
childEnv.PIE_PRINT_TURN_TIMEOUT_MS = "1800000";
|
|
566
|
+
}
|
|
567
|
+
}
|
|
560
568
|
if (resumeSessionId && resumeSessionsDir !== void 0) childEnv.PIE_SESSIONS_DIR = resumeSessionsDir;
|
|
561
569
|
try {
|
|
562
570
|
child = spawn(process.execPath, args, {
|
|
@@ -234,7 +234,7 @@ Rules: execute one step, verify it (run its verify criterion when practical), th
|
|
|
234
234
|
ctx.setSessionMetadata(SESSION_METADATA_KEY, planModeEnabled);
|
|
235
235
|
applyPlanModeState(planModeEnabled, true);
|
|
236
236
|
ctx.ui.notify(
|
|
237
|
-
planModeEnabled ? `Plan mode enabled \u2014 discussion first (grilling); say "
|
|
237
|
+
planModeEnabled ? `Plan mode enabled \u2014 discussion first (grilling); say "give me the plan" or /tools/plan/submit when you want the plan itself.` : "Plan mode disabled. Full access restored."
|
|
238
238
|
);
|
|
239
239
|
updateStatus();
|
|
240
240
|
}
|
|
@@ -353,9 +353,9 @@ Update the plan accordingly and call plan_submit again with the revised steps. D
|
|
|
353
353
|
return;
|
|
354
354
|
}
|
|
355
355
|
const context = (args ?? "").trim();
|
|
356
|
-
return context ?
|
|
356
|
+
return context ? `Give me the plan. Additional context from the user: ${context}
|
|
357
357
|
|
|
358
|
-
Produce the MVP-ladder plan now (each step: title, optional detail, verify criterion, file scope) and call plan_submit with it.` : "
|
|
358
|
+
Produce the MVP-ladder plan now (each step: title, optional detail, verify criterion, file scope) and call plan_submit with it.` : "Give me the plan. Produce the MVP-ladder plan now (each step: title, optional detail, verify criterion, file scope) and call plan_submit with it.";
|
|
359
359
|
}
|
|
360
360
|
});
|
|
361
361
|
ctx.registerCommand({
|
|
@@ -381,7 +381,7 @@ ${completedLines}
|
|
|
381
381
|
Remaining steps as previously approved:
|
|
382
382
|
${remainingItems.map((item) => `- ${item.text}${item.detail ? ` \u2014 ${item.detail}` : ""}${item.verify ? ` (verify: ${item.verify})` : ""}${item.files?.length ? ` [files: ${item.files.join(", ")}]` : ""}`).join("\n") || "- (none)"}
|
|
383
383
|
|
|
384
|
-
Discuss the revision with the user (read-only; Plan mode is back on). When the user asks for the revised plan (e.g.
|
|
384
|
+
Discuss the revision with the user (read-only; Plan mode is back on). When the user asks for the revised plan (e.g. "give me the plan" or /tools/plan/submit), call plan_submit with the REVISED REMAINING steps only.`;
|
|
385
385
|
}
|
|
386
386
|
});
|
|
387
387
|
ctx.registerShortcut("ctrl+alt+p", {
|
|
@@ -776,6 +776,7 @@ function parseStatusFile(raw) {
|
|
|
776
776
|
};
|
|
777
777
|
if (typeof record.unattended === "boolean") file.unattended = record.unattended;
|
|
778
778
|
if (typeof record.isManager === "boolean") file.isManager = record.isManager;
|
|
779
|
+
if (typeof record.version === "string" && record.version.length <= 64 && !hasControlChars(record.version)) file.version = record.version;
|
|
779
780
|
if (typeof record.imBinding === "string" && record.imBinding.length <= 512 && !hasControlChars(record.imBinding)) file.imBinding = record.imBinding;
|
|
780
781
|
if (Array.isArray(record.allowPeers) && record.allowPeers.length <= 1e3 && record.allowPeers.every((id) => typeof id === "string" && (id === "*" || isValidInstanceId(id)))) file.allowPeers = record.allowPeers;
|
|
781
782
|
if (typeof record.secret === "string" && /^[a-f0-9]{64}$/.test(record.secret)) file.secret = record.secret;
|
|
@@ -13,7 +13,7 @@ function probeWindows(pid, exec) {
|
|
|
13
13
|
for (const spec of windowsProbeSpecs(pid)) {
|
|
14
14
|
let out;
|
|
15
15
|
try {
|
|
16
|
-
out = exec(spec.file, spec.args, { encoding: "utf8", timeout: 3e3, stdio: ["ignore", "pipe", "pipe"] });
|
|
16
|
+
out = exec(spec.file, spec.args, { encoding: "utf8", timeout: 3e3, stdio: ["ignore", "pipe", "pipe"], windowsHide: true });
|
|
17
17
|
} catch (error) {
|
|
18
18
|
const code = error.code;
|
|
19
19
|
if (code === "ENOENT") continue;
|