@cydm/pie 2.7.3 → 2.7.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.
@@ -1,9 +1,9 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  createAskUserCapability
4
- } from "../../../chunks/chunk-F3U2TYDT.js";
5
- import "../../../chunks/chunk-MPTME6HX.js";
6
- import "../../../chunks/chunk-E5JQ5SVA.js";
4
+ } from "../../../chunks/chunk-BFHCZVNO.js";
5
+ import "../../../chunks/chunk-MLRF72MK.js";
6
+ import "../../../chunks/chunk-SUPAWIKP.js";
7
7
  import "../../../chunks/chunk-XXGYUYXI.js";
8
8
  import "../../../chunks/chunk-LZQXQOPJ.js";
9
9
 
@@ -7,9 +7,9 @@ import {
7
7
  isPlanModeSafeCommand,
8
8
  markCompletedPlanSteps,
9
9
  restoreExecutionState
10
- } from "../../../chunks/chunk-F3U2TYDT.js";
11
- import "../../../chunks/chunk-MPTME6HX.js";
12
- import "../../../chunks/chunk-E5JQ5SVA.js";
10
+ } from "../../../chunks/chunk-BFHCZVNO.js";
11
+ import "../../../chunks/chunk-MLRF72MK.js";
12
+ import "../../../chunks/chunk-SUPAWIKP.js";
13
13
  import {
14
14
  Type
15
15
  } from "../../../chunks/chunk-XXGYUYXI.js";
@@ -2,15 +2,16 @@ import { createRequire as __createRequire } from "node:module"; const require =
2
2
  import {
3
3
  createCliHostCapabilities,
4
4
  formatTransportLifecycle,
5
+ getConfigDir,
5
6
  logTransportLifecycle
6
- } from "../../../chunks/chunk-WLLZTG4W.js";
7
+ } from "../../../chunks/chunk-OOUL3DRE.js";
7
8
  import {
8
9
  SUBAGENT_SESSION_RECORD_VERSION,
9
10
  createSharedFileSystemTools,
10
11
  createSubagentCapability
11
- } from "../../../chunks/chunk-F3U2TYDT.js";
12
- import "../../../chunks/chunk-MPTME6HX.js";
13
- import "../../../chunks/chunk-E5JQ5SVA.js";
12
+ } from "../../../chunks/chunk-BFHCZVNO.js";
13
+ import "../../../chunks/chunk-MLRF72MK.js";
14
+ import "../../../chunks/chunk-SUPAWIKP.js";
14
15
  import "../../../chunks/chunk-XXGYUYXI.js";
15
16
  import "../../../chunks/chunk-LZQXQOPJ.js";
16
17
 
@@ -366,7 +367,6 @@ function createSubagentSessionStore(sessionsDir, log, deps) {
366
367
  }
367
368
 
368
369
  // builtin/extensions/subagent/index.ts
369
- import * as os from "os";
370
370
  import * as path2 from "path";
371
371
  function subagentExtension(ctx) {
372
372
  ctx.log("Subagent extension loaded (transparent parallel mode)");
@@ -381,7 +381,7 @@ function subagentExtension(ctx) {
381
381
  // Persisted alongside the CLI's own session state: a sessionId from an
382
382
  // earlier result stays recallable across restarts and /resume. Tools and
383
383
  // credentials are re-resolved at recall time, never persisted.
384
- sessionStore: createSubagentSessionStore(path2.join(os.homedir(), ".pie", "subagent-sessions"), (message) => ctx.log(message)),
384
+ sessionStore: createSubagentSessionStore(path2.join(getConfigDir(), "subagent-sessions"), (message) => ctx.log(message)),
385
385
  get apiKey() {
386
386
  return resolveRuntimePair().apiKey;
387
387
  },
@@ -412,7 +412,7 @@ function subagentExtension(ctx) {
412
412
  if (mode === "edit") {
413
413
  throw new Error("Edit delegation requires the parent's executable runtime tools; fallback tools are read-mode only.");
414
414
  }
415
- const configDir = path2.join(os.homedir(), ".pie");
415
+ const configDir = getConfigDir();
416
416
  const fsOptions = ctx.yoloMode ? { allowlistedDirs: ["/"] } : {
417
417
  accessRoots: [
418
418
  ctx.cwd,
@@ -425,6 +425,7 @@ function subagentExtension(ctx) {
425
425
  return [...fsTools, ...cliHostCapabilities.tools];
426
426
  }
427
427
  });
428
+ ctx.registerCleanup?.(() => capability.dispose());
428
429
  for (const tool of capability.tools) {
429
430
  ctx.registerTool(tool);
430
431
  }
@@ -8,18 +8,18 @@ import {
8
8
  executeManageTodoList,
9
9
  executionStateToTodos,
10
10
  restoreExecutionState
11
- } from "../../../chunks/chunk-F3U2TYDT.js";
12
- import "../../../chunks/chunk-MPTME6HX.js";
13
- import "../../../chunks/chunk-E5JQ5SVA.js";
11
+ } from "../../../chunks/chunk-BFHCZVNO.js";
12
+ import "../../../chunks/chunk-MLRF72MK.js";
13
+ import "../../../chunks/chunk-SUPAWIKP.js";
14
14
  import "../../../chunks/chunk-XXGYUYXI.js";
15
15
  import "../../../chunks/chunk-LZQXQOPJ.js";
16
16
 
17
17
  // builtin/extensions/todo/index.ts
18
18
  var EXECUTION_METADATA_KEY = "executionState";
19
- function persistExecutionState(ctx, state) {
19
+ function persistExecutionState(ctx, state, reason) {
20
20
  const nextState = state ?? restoreExecutionState(null);
21
21
  ctx.setSessionMetadata(EXECUTION_METADATA_KEY, nextState);
22
- ctx.setExecutionState(nextState);
22
+ ctx.setExecutionState(nextState, reason);
23
23
  ctx.setExecutionReminder(buildExecutionReminder(nextState) ?? void 0);
24
24
  return nextState;
25
25
  }
@@ -36,32 +36,25 @@ function todoExtension(ctx) {
36
36
  label: "manage_todo_list",
37
37
  description: MANAGE_TODO_LIST_TOOL_DESCRIPTION,
38
38
  parameters: ManageTodoListParamsSchema,
39
- async execute(args) {
39
+ async execute(args, context) {
40
+ if (context.signal?.aborted) throw new Error("Todo call cancelled");
40
41
  const currentTodos = executionStateToTodos(ctx.getExecutionState());
41
42
  const execution = executeManageTodoList(args, currentTodos);
42
- const nextState = createExecutionStateFromTodos(execution.nextTodos, "todo", "user_todo");
43
- persistExecutionState(ctx, nextState);
44
- notifyWidget(ctx, nextState);
43
+ const explanation = ctx.getExecutionStateExplanation?.();
44
+ if (currentTodos.length === 0 && explanation && (args.action === "read" || args.action === "complete_current")) {
45
+ execution.result.content.push({ type: "text", text: explanation.slice(0, 320) });
46
+ }
47
+ if (!execution.result.isError && args.action !== "read") {
48
+ const nextState = createExecutionStateFromTodos(execution.nextTodos, "todo", "user_todo");
49
+ persistExecutionState(ctx, nextState, args.action === "create" ? "create" : args.action === "clear" ? "explicit_clear" : execution.nextTodos.length === 0 ? "completed_clear" : "advance");
50
+ notifyWidget(ctx, nextState);
51
+ }
45
52
  return execution.result;
46
53
  }
47
54
  });
48
55
  ctx.on("session:changed", async () => {
49
56
  const state = restoreExecutionState(ctx.getSessionMetadata()?.[EXECUTION_METADATA_KEY]);
50
- persistExecutionState(ctx, state);
51
- });
52
- ctx.on("tool:execution:end", async (event) => {
53
- if (event.toolName !== "manage_todo_list") return;
54
- const details = event.result?.details;
55
- if (!details?.todos) return;
56
- const state = createExecutionStateFromTodos(details.todos, "todo", "user_todo");
57
- persistExecutionState(ctx, state);
58
- });
59
- ctx.on("agent:end", async () => {
60
- const state = ctx.getExecutionState();
61
- if (state.mode !== "todo") return;
62
- if (state.lifecycle === "completed") {
63
- persistExecutionState(ctx, null);
64
- }
57
+ persistExecutionState(ctx, state, "session_restore");
65
58
  });
66
59
  ctx.log("Builtin todo extension ready");
67
60
  }
@@ -175,8 +175,13 @@ The deterministic fake desktop backend used by the broker test suite is not
175
175
  shipped in release bundles. In a source checkout it activates only when both
176
176
  `PIE_COMPUTER_USE_FAKE_BACKEND=1` and
177
177
  `PIE_COMPUTER_USE_ENABLE_TEST_COMMANDS=1` are set; otherwise the setting is
178
- ignored with a warning and the real platform backend is used. Never rely on it
179
- for real UI work.
178
+ ignored with a warning and the real platform backend is used unless
179
+ `PIE_COMPUTER_USE_REQUIRE_FAKE_BACKEND=1` is also set. Desktop-free tests must
180
+ set this requirement: incomplete activation or a missing fake module is fatal,
181
+ and native helper access is forbidden even if a separate ESM/CJS module instance
182
+ missed the fake override. CLI/skill fixtures set the requirement without enabling
183
+ the fake so accidental desktop calls fail rather than reach the real UI. Never
184
+ rely on the fake for real UI work.
180
185
 
181
186
  ## Output bounds and exit codes
182
187