@cydm/pie 4.5.0 → 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 CHANGED
@@ -196,8 +196,32 @@ If you want an agent that feels lightweight but still has serious capability, th
196
196
 
197
197
  The CLI should consume shared capability and framework contracts; it should not redefine shared runtime or extension semantics locally.
198
198
 
199
+ ## Windows manager service
200
+
201
+ `pie manager start` (or bare `pie manager`) starts an already-installed Windows
202
+ scheduled task without uninstalling it or creating a separate manual resident.
203
+ The message confirms the start request, not model/IM readiness; use
204
+ `pie manager tail` to inspect startup output.
205
+
206
+ `pie manager --install-service` builds a small GUI-subsystem launcher using the
207
+ Windows .NET Framework v4 compiler. The task and its Node resident create no
208
+ console window. A private Windows Job Object keeps descendants tied to the
209
+ launcher: stopping the task also ends its descendant processes. stdout/stderr
210
+ append to `~/.pie/manager/log.jsonl`; native launch failures go to
211
+ `service-launcher.log` beside it. No extra package is downloaded.
212
+
213
+ Existing scheduled tasks retain their old action until reinstalled. After
214
+ updating Pie, stop the manager and run `pie manager --install-service`, then
215
+ `pie manager start`, to adopt the windowless launcher. The service runs as the
216
+ same Windows user/profile that installed it. The generated launcher captures
217
+ the Node/CLI paths and configuration roots; reinstall after changing those paths.
218
+
199
219
  ## Interactive Experience
200
220
 
221
+ Product-owned UI labels, errors, and operational hints default to English.
222
+ User-authored content, multilingual input recognition, and explicitly selected
223
+ localizations are preserved rather than translated.
224
+
201
225
  Run:
202
226
 
203
227
  ```bash
@@ -1530,7 +1530,7 @@ WARNING: change applied but the audit log could not be written (${String(e)})`;
1530
1530
  } catch {
1531
1531
  }
1532
1532
  const safeStartupError = typeof startupError === "string" ? startupError.replace(/[\u0000-\u001f\u007f]/g, " ").slice(0, 160) : void 0;
1533
- const why = unsafe ? "cron \u72B6\u6001\u4E0D\u5B89\u5168\uFF08unsafe.lock\uFF09\u2014\u2014\u9700\u4EBA\u5DE5\u68C0\u67E5 /tools/cron \u540E\u6062\u590D" : duplicates ? "\u5B58\u5728\u540C\u4F1A\u8BDD\u7684\u91CD\u590D owner\uFF08\u7591\u4F3C\u6B8B\u7559\u8FDB\u7A0B\uFF09\u2014\u2014\u91CD\u8BD5\u65E0\u6548\uFF0C\u8BF7\u68C0\u67E5 /tools/cron" : worker ? "\u672C\u4F1A\u8BDD\u6709\u6B63\u5728\u6267\u884C\u7684 cron \u4EFB\u52A1\uFF08worker \u6A21\u5F0F\uFF09\u2014\u2014\u4EFB\u52A1\u7ED3\u675F\u540E\u81EA\u52A8\u6062\u590D" : safeStartupError ? `cron \u542F\u52A8\u5F02\u5E38\uFF1A${safeStartupError}` : "cron \u4F1A\u8BDD\u6240\u6709\u6743\u672A\u5C31\u7EEA\u2014\u2014\u7A0D\u540E\u91CD\u8BD5";
1533
+ const why = unsafe ? "cron state is unsafe (unsafe.lock); inspect /tools/cron before recovering manually." : duplicates ? "Duplicate owners for this session (possibly leftover processes); retrying will not help. Inspect /tools/cron." : worker ? "A cron worker is running a task for this session; input will resume when the task finishes." : safeStartupError ? `cron startup failed: ${safeStartupError}` : "cron session ownership is not ready; try again shortly.";
1534
1534
  ctx.ui.notify("cron: session ownership is uncertain or duplicated; input blocked. Close the duplicate/worker and inspect /tools/cron.", "warning");
1535
1535
  return { action: "reject", reason: why };
1536
1536
  });
@@ -819,7 +819,7 @@ function summarizeFailureReason(reason) {
819
819
  return { summary: "network problem", persistent: false };
820
820
  return { summary: "provider exited", persistent: false };
821
821
  }
822
- var IM_INPUT_FALLBACK_CAPTION = "\u8BF7\u67E5\u770B\u8FD9\u4E9B\u56FE\u7247\u5E76\u5904\u7406\u3002";
822
+ var IM_INPUT_FALLBACK_CAPTION = "Please review these images and respond.";
823
823
  function hashText(input) {
824
824
  let hash = 0;
825
825
  for (let i = 0; i < input.length; i++) {
@@ -1351,7 +1351,7 @@ ${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
1351
1351
  const attribution = resolveOutboundAttribution(sessionId);
1352
1352
  const deliverTf = /* @__PURE__ */ new Map();
1353
1353
  if (!outboundRoleAllows(attribution, deliverTf)) return;
1354
- const recoveryHint = `Your input is still in the session \u2014 reply "\u91CD\u7B54\u4E0A\u4E00\u6761" (redo the last one) to answer from it again without resending the original request.`;
1354
+ const recoveryHint = `Your input is still in the session \u2014 reply "redo the last one" to answer from it again without resending the original request.`;
1355
1355
  void forwardMessage(
1356
1356
  `\u26A0\uFE0F Task failed: ${reason} (retries exhausted)
1357
1357
  ${recoveryHint}`,
@@ -2733,7 +2733,7 @@ async function probeCardActionSubscription(ctx, cwd, binaryOverride, profile) {
2733
2733
  done();
2734
2734
  }, 3500);
2735
2735
  timer.unref?.();
2736
- const child = spawn5(binary, ["event", "consume", "card.action.trigger", "--as", "bot", ...profile ? ["--profile", profile] : []], { cwd, stdio: ["ignore", "pipe", "pipe"] });
2736
+ const child = spawn5(binary, ["event", "consume", "card.action.trigger", "--as", "bot", ...profile ? ["--profile", profile] : []], { cwd, stdio: ["ignore", "pipe", "pipe"], windowsHide: true });
2737
2737
  child.on("error", () => done());
2738
2738
  child.on("close", () => done());
2739
2739
  let out = "";
@@ -2744,8 +2744,8 @@ async function probeCardActionSubscription(ctx, cwd, binaryOverride, profile) {
2744
2744
  const unsubscribed = /requires callbacks not subscribed/i.test(out);
2745
2745
  if (unsubscribed) {
2746
2746
  const launcher = /https:\/\/open\.feishu\.cn\/page\/launcher\?[^\s"]+/.exec(out)?.[0];
2747
- ctx.ui.notify(`\u9762\u677F\u5361\u7247\u6309\u94AE\u9700\u8981\u4E00\u6B21\u6027\u8BA2\u9605 card.action.trigger\uFF08\u672A\u8BA2\u9605\u65F6\u9762\u677F\u4ECD\u53EF\u7528\uFF0C\u6309\u94AE\u964D\u7EA7\u4E3A\u6587\u5B57\u547D\u4EE4\uFF09\u3002${launcher ? `
2748
- \u626B\u7801\u8BA2\u9605\uFF1A${launcher}` : "\n\u5728\u5F00\u53D1\u8005\u540E\u53F0 \u2192 \u4E8B\u4EF6\u4E0E\u56DE\u8C03 \u2192 \u8BA2\u9605 card.action.trigger\u3002"}`, "info");
2747
+ ctx.ui.notify(`Panel buttons require a one-time subscription to card.action.trigger. Without it, the panel still works through text commands.${launcher ? `
2748
+ Open this link and scan the QR code to subscribe: ${launcher}` : "\nIn the developer console, open Events & Callbacks and subscribe to card.action.trigger."}`, "info");
2749
2749
  }
2750
2750
  });
2751
2751
  });
@@ -2753,7 +2753,7 @@ async function probeCardActionSubscription(ctx, cwd, binaryOverride, profile) {
2753
2753
  async function settingsProbeBinary() {
2754
2754
  try {
2755
2755
  const { spawnSync } = await import("node:child_process");
2756
- const which = spawnSync(process.platform === "win32" ? "where" : "which", ["lark-cli"], { encoding: "utf8", timeout: 3e3 });
2756
+ const which = spawnSync(process.platform === "win32" ? "where" : "which", ["lark-cli"], { encoding: "utf8", timeout: 3e3, windowsHide: true });
2757
2757
  const path12 = which.stdout?.split(/\r?\n/)[0]?.trim();
2758
2758
  return path12 || void 0;
2759
2759
  } catch {
@@ -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. "\u5DF2\u8BB0\u4F4F\uFF1A\u2026"). If this tool is unavailable, say the request only holds for the current session.',
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\uFF08\u4EBA\u683C\u622A\u65AD\uFF1ASOUL.md \u8D85\u51FA\u9884\u7B97\uFF0C\u5B8C\u6574\u7248\u8BF7\u7F16\u8F91 ~/.pie/memory/SOUL.md \u7F29\u77ED\uFF09` : void 0;
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 ACL verification and atomic protected directory and temporary-file creation. Ancestors with public add-file/write-data, write-attributes, write-EA, delete or control grants are rejected (including standard ProgramData when it has these rights). No-delete handles prevent rename/delete; ACL checks, not a reparse lock, exclude untrusted in-place mutation. Unsafe profile/TEMP/drive ancestry fails closed without repair or insecure fallback; use an explicitly provisioned safe `PIE_IPC_CONFIG_DIR` if needed. Same-user isolation and the stale-advertisement/first-send unencrypted endpoint-identity limitation remain outside this guarantee; see the release checklist below.
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.
@@ -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
- const dangerousAncestorRights = 1343029586;
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]);
@@ -1770,7 +1770,7 @@ function pieIpcExtension(ctx) {
1770
1770
  try {
1771
1771
  discoveryDir = ipcDiscoveryDir(configDir);
1772
1772
  } catch {
1773
- ctx.log("pie-ipc: disabled: Windows discovery security validation failed");
1773
+ ctx.log("pie-ipc: disabled: discovery path validation failed");
1774
1774
  return;
1775
1775
  }
1776
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-X6LBWHK3.js";
4
+ } from "../../../chunks/chunk-7RJXKN7N.js";
5
5
  import {
6
6
  liveSessionHolder
7
7
  } from "../../../chunks/chunk-CGSFBWOM.js";
@@ -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 "\u8F93\u51FA\u8BA1\u5212"/"give me the plan" or /tools/plan/submit when you want the plan itself.` : "Plan mode disabled. Full access restored."
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 ? `\u8F93\u51FA\u8BA1\u5212\u3002Additional context from the user: ${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.` : "\u8F93\u51FA\u8BA1\u5212\u3002Produce 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. \u8F93\u51FA\u8BA1\u5212 / /tools/plan/submit), call plan_submit with the REVISED REMAINING steps only.`;
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", {
@@ -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;