@cydm/pie 2.7.16 → 2.7.18

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
@@ -215,8 +215,8 @@ Main key bindings:
215
215
  - `Ctrl+D` exit when the editor is empty; forward-delete otherwise
216
216
  - `Ctrl+V` / `Alt+V` / `Cmd+V` paste an image from the clipboard when the main chat editor owns focus (terminal clipboard first, OS helper fallback). Plan refinement, extension input/editor/custom UI, visible overlays, and the mention picker retain their own paste keys.
217
217
  - `Ctrl+O` expand or collapse tool output
218
- - `Alt+O` toggle YOLO mode
219
- - `Alt+I` set up or toggle IM forwarding
218
+ - `Ctrl+X` toggle YOLO mode (`Alt+O` is an optional alias where the terminal delivers Alt)
219
+ - `Ctrl+R` set up or toggle IM forwarding (`Alt+I` is an optional alias where the terminal delivers Alt)
220
220
  - `/` open the slash command menu
221
221
 
222
222
  OS clipboard images are staged in per-read private temporary directories (0700 directories and exclusively reserved 0600 files on POSIX), including subprocess output, and removed after staging or on failure. Windows uses the user's temporary directory and inherited OS access controls. Terminal OSC 5522 frames and CSI 5522 support replies are incrementally framed, size-bounded, and never flushed as keyboard input while recognized: the default inter-chunk deadline is 1s, with a 10s absolute frame deadline. Failed frames discard their tails through the terminator or until 1s of idle recovery. An ambiguous lone Escape keeps its normal keyboard timeout unless a clipboard request is active; even then it is eventually delivered as Escape. After idle recovery, arbitrarily late bare payload bytes cannot be distinguished from new typing.
@@ -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-JTD4JJTG.js";
5
- import "../../../chunks/chunk-TDHVB2FH.js";
6
- import "../../../chunks/chunk-NM2JLPJ6.js";
4
+ } from "../../../chunks/chunk-UDCGB3LZ.js";
5
+ import "../../../chunks/chunk-2H2DD22Z.js";
6
+ import "../../../chunks/chunk-X7UO6BA6.js";
7
7
  import "../../../chunks/chunk-XXGYUYXI.js";
8
8
  import "../../../chunks/chunk-LZQXQOPJ.js";
9
9
 
@@ -608,6 +608,7 @@ function cron(ctx) {
608
608
  ctx.on("session:changed", async (e) => {
609
609
  try {
610
610
  await runtime.bind(e.sessionId);
611
+ startupError = void 0;
611
612
  } catch (e2) {
612
613
  startupError = String(e2);
613
614
  }
@@ -623,7 +624,7 @@ function cron(ctx) {
623
624
  } catch {
624
625
  }
625
626
  ctx.ui.notify("cron: session ownership is uncertain or duplicated; input blocked. Close the duplicate/worker and inspect /cron.", "warning");
626
- return { action: "consume" };
627
+ return { action: "reject" };
627
628
  });
628
629
  ctx.on("session:before_switch", (e) => {
629
630
  if (!e.targetSessionId) return;
@@ -639,7 +640,7 @@ function cron(ctx) {
639
640
  }
640
641
  });
641
642
  const run = (action, id, prompt, schedule) => {
642
- if (startupError) throw new Error(`cron unavailable: ${startupError}; see docs/cron.md recovery`);
643
+ if (startupError && action !== "list") throw new Error(`cron unavailable: ${startupError}; see docs/cron.md recovery`);
643
644
  if (action === "list") return JSON.stringify({ ...store.read(), recoveryRequired: fs3.existsSync(path4.join(store.dir, "unsafe.lock")), coordinatorPresent: fs3.existsSync(path4.join(store.dir, "scheduler.lock")) }, null, 2);
644
645
  if (action === "add") {
645
646
  if (!runtime.ready || !runtime.sessionId) throw new Error("wait for an existing session to load and register");
@@ -365,10 +365,14 @@ function createRuntime(ctx, cfg, connection, liveEnabled, persistEnabled) {
365
365
  ctx.ui.notify("IM forwarding disabled", "info");
366
366
  }
367
367
  }
368
- ctx.registerShortcut("alt+i", {
368
+ ctx.registerShortcut("ctrl+r", {
369
369
  description: "Toggle IM forwarding",
370
370
  handler: toggleForwarding
371
371
  });
372
+ ctx.registerShortcut("alt+i", {
373
+ description: "Toggle IM forwarding (terminal Alt alias)",
374
+ handler: toggleForwarding
375
+ });
372
376
  let currentSessionId = null;
373
377
  const pendingInputs = [];
374
378
  const replyAnchor = /* @__PURE__ */ new Map();
@@ -581,6 +585,9 @@ ${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
581
585
  if (cfg.allowUsers && (!event.sender_id || !cfg.allowUsers.includes(event.sender_id))) return;
582
586
  const messageId = event.message_id;
583
587
  if (!messageId) return;
588
+ const releaseInvalidatedEvent = () => {
589
+ if (event.event_id) seenEventIds.delete(key(event.event_id));
590
+ };
584
591
  const sessionId = currentSessionId;
585
592
  const epoch = inputEpoch;
586
593
  const scope = ctx.beginUserInput?.(() => !terminated && inputEpoch === epoch && currentSessionId === sessionId && isForwardingEnabled());
@@ -595,7 +602,10 @@ ${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
595
602
  retry();
596
603
  return;
597
604
  }
598
- if (!scope.isCurrent()) return;
605
+ if (!scope.isCurrent()) {
606
+ releaseInvalidatedEvent();
607
+ return;
608
+ }
599
609
  const resolution = await resolveRouteForInbound(messageId, meta);
600
610
  if (!("found" in resolution)) {
601
611
  if (isTransient(resolution)) retry();
@@ -603,15 +613,20 @@ ${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
603
613
  return;
604
614
  }
605
615
  const route = resolution.found;
606
- if (route.sessionId !== sessionId || !scope.isCurrent()) return;
616
+ if (route.sessionId !== sessionId || !scope.isCurrent()) {
617
+ releaseInvalidatedEvent();
618
+ return;
619
+ }
607
620
  const imageKeys = event.images;
608
621
  const caption = event.text;
609
622
  if (!caption && !imageKeys.length) return;
610
623
  const submitText = `${IM_INPUT_PREFIX}
611
624
  ${caption || IM_INPUT_FALLBACK_CAPTION}`;
612
625
  const accepted = imageKeys.length ? await injectImageMessage(messageId, imageKeys, submitText, scope) : await scope.submit(submitText);
613
- if (!accepted || !scope.isCurrent()) {
614
- if (scope.isCurrent()) {
626
+ const currentAfterSubmit = scope.isCurrent();
627
+ if (!accepted || !currentAfterSubmit) {
628
+ if (!accepted && !currentAfterSubmit) releaseInvalidatedEvent();
629
+ if (currentAfterSubmit) {
615
630
  ctx.ui.notify("im-forward: message was not accepted; no input submitted.", "warning");
616
631
  await forwardMessage(`\u26A0\uFE0F \u6D88\u606F\u63A5\u6536\u5931\u8D25\uFF0C\u672A\u63D0\u4EA4\u4EFB\u52A1\u3002${imageKeys.length ? "\u8BF7\u68C0\u67E5\u9644\u4EF6\u540E\u91CD\u8BD5\u3002" : "\u8BF7\u91CD\u8BD5\u3002"}`, route.sessionId, ++forwardCounter, caption, messageId);
617
632
  }
@@ -2068,13 +2083,13 @@ function initializeImForward(ctx, providers = implementedProviders) {
2068
2083
  try {
2069
2084
  const settings = provider.resolve(config.settings);
2070
2085
  if (!settings) {
2071
- ctx.ui.notify(`IM forwarding: ${provider.label} target/settings are incomplete. Use Alt+I or /im-forward setup.`, "warning");
2086
+ ctx.ui.notify(`IM forwarding: ${provider.label} target/settings are incomplete. Use Ctrl+R or /im-forward setup.`, "warning");
2072
2087
  ctx.ui.setStatus?.("im-forward", "[IM!]");
2073
2088
  return;
2074
2089
  }
2075
2090
  const connection = provider.connect(settings, ctx.cwd);
2076
2091
  if (!connection) {
2077
- ctx.ui.notify(`IM forwarding: ${provider.label} connection could not be prepared. Use Alt+I or /im-forward setup to check provider dependencies and configuration.`, "warning");
2092
+ ctx.ui.notify(`IM forwarding: ${provider.label} connection could not be prepared. Use Ctrl+R or /im-forward setup to check provider dependencies and configuration.`, "warning");
2078
2093
  ctx.ui.setStatus?.("im-forward", "[IM!]");
2079
2094
  return;
2080
2095
  }
@@ -2173,7 +2188,7 @@ function initializeImForward(ctx, providers = implementedProviders) {
2173
2188
  }
2174
2189
  function showStatus(commandCtx) {
2175
2190
  if (status) status(commandCtx);
2176
- else commandCtx.ui.notify("IM forwarding is not configured or unavailable. Use Alt+I or /im-forward setup.", "info");
2191
+ else commandCtx.ui.notify("IM forwarding is not configured or unavailable. Use Ctrl+R or /im-forward setup.", "info");
2177
2192
  }
2178
2193
  async function clearConfiguration(commandCtx) {
2179
2194
  setupAbort?.abort();
@@ -2193,7 +2208,8 @@ This does not remove the app credentials lark-cli itself stores; re-running setu
2193
2208
  commandCtx.ui.notify(error.message || "IM forwarding configuration could not be cleared.", "error");
2194
2209
  }
2195
2210
  }
2196
- ctx.registerShortcut("alt+i", { description: "Set up or toggle IM forwarding", handler: () => toggleNow(ctx) });
2211
+ ctx.registerShortcut("ctrl+r", { description: "Set up or toggle IM forwarding", handler: () => toggleNow(ctx) });
2212
+ ctx.registerShortcut("alt+i", { description: "Set up or toggle IM forwarding (terminal Alt alias)", handler: () => toggleNow(ctx) });
2197
2213
  ctx.registerCommand({ path: ["im-forward", "status"], description: "Show IM forwarding status", handler: async (commandCtx) => {
2198
2214
  if (!disposed) showStatus(commandCtx);
2199
2215
  } });
@@ -2203,7 +2219,7 @@ This does not remove the app credentials lark-cli itself stores; re-running setu
2203
2219
  ctx.registerCommand({ path: ["im-forward", "setup"], description: "Run the IM forwarding setup wizard", handler: async () => {
2204
2220
  if (!disposed) await setup();
2205
2221
  } });
2206
- ctx.registerCommand({ path: ["im-forward", "toggle"], description: "Toggle IM forwarding on/off (same as Alt+I)", handler: async (commandCtx) => {
2222
+ ctx.registerCommand({ path: ["im-forward", "toggle"], description: "Toggle IM forwarding on/off (same as Ctrl+R)", handler: async (commandCtx) => {
2207
2223
  if (!disposed) await toggleNow(commandCtx);
2208
2224
  } });
2209
2225
  ctx.registerCommand({ path: ["im-forward", "clear"], description: "Remove IM forwarding configuration (with confirmation)", handler: async (commandCtx) => {
@@ -824,6 +824,7 @@ function buildStatusFile(input) {
824
824
  import * as net from "node:net";
825
825
  import { createHmac, randomBytes as randomBytes4, randomUUID, timingSafeEqual } from "node:crypto";
826
826
  import { StringDecoder } from "node:string_decoder";
827
+ var CLOSE_FLUSH_TIMEOUT_MS = 1e3;
827
828
  function signEnvelope(e, secret) {
828
829
  const payload = [e.v, e.id, e.from, e.to, e.kind, e.createdAt, e.sessionId ?? null, e.text ?? null, e.replyTo ?? null, e.waitMs ?? null];
829
830
  return { ...e, auth: createHmac("sha256", secret).update(JSON.stringify(payload)).digest("hex") };
@@ -972,6 +973,7 @@ var IpcTransport = class {
972
973
  if (e.waitMs) socket.setTimeout(Math.max(6e4, e.waitMs + 1e3));
973
974
  if (!this.seen.add(`${e.from}:${e.id}`)) return;
974
975
  try {
976
+ if (this.closed) return;
975
977
  this.host.onEnvelope(e, (reply) => {
976
978
  if (reply.from === this.instanceId && reply.to === e.from && reply.replyTo === e.id) this.write(socket, reply, this.secret);
977
979
  }, lifecycle.signal);
@@ -1046,7 +1048,12 @@ var IpcTransport = class {
1046
1048
  if (this.closed) return;
1047
1049
  this.closed = true;
1048
1050
  for (const cancel of [...this.cancels]) cancel();
1049
- for (const socket of this.sockets) socket.destroy();
1051
+ for (const socket of this.sockets) {
1052
+ if (socket.destroyed) continue;
1053
+ socket.end();
1054
+ const timer = setTimeout(() => socket.destroy(), CLOSE_FLUSH_TIMEOUT_MS);
1055
+ timer.unref();
1056
+ }
1050
1057
  this.sockets.clear();
1051
1058
  this.server.close();
1052
1059
  this.port = null;
@@ -6,9 +6,9 @@ import {
6
6
  extractPlanTodoItems,
7
7
  markCompletedPlanSteps,
8
8
  restoreExecutionState
9
- } from "../../../chunks/chunk-JTD4JJTG.js";
10
- import "../../../chunks/chunk-TDHVB2FH.js";
11
- import "../../../chunks/chunk-NM2JLPJ6.js";
9
+ } from "../../../chunks/chunk-UDCGB3LZ.js";
10
+ import "../../../chunks/chunk-2H2DD22Z.js";
11
+ import "../../../chunks/chunk-X7UO6BA6.js";
12
12
  import {
13
13
  Type
14
14
  } from "../../../chunks/chunk-XXGYUYXI.js";
@@ -6,15 +6,15 @@ import {
6
6
  formatTransportLifecycle,
7
7
  getConfigDir,
8
8
  logTransportLifecycle
9
- } from "../../../chunks/chunk-ZDGSTGF2.js";
9
+ } from "../../../chunks/chunk-TGCI5M6R.js";
10
10
  import {
11
11
  SUBAGENT_SESSION_RECORD_VERSION,
12
12
  createPolicyEnforcedTools,
13
13
  createSharedFileSystemTools,
14
14
  createSubagentCapability
15
- } from "../../../chunks/chunk-JTD4JJTG.js";
16
- import "../../../chunks/chunk-TDHVB2FH.js";
17
- import "../../../chunks/chunk-NM2JLPJ6.js";
15
+ } from "../../../chunks/chunk-UDCGB3LZ.js";
16
+ import "../../../chunks/chunk-2H2DD22Z.js";
17
+ import "../../../chunks/chunk-X7UO6BA6.js";
18
18
  import "../../../chunks/chunk-XXGYUYXI.js";
19
19
  import "../../../chunks/chunk-LZQXQOPJ.js";
20
20
 
@@ -8,9 +8,9 @@ import {
8
8
  executeManageTodoList,
9
9
  executionStateToTodos,
10
10
  restoreExecutionState
11
- } from "../../../chunks/chunk-JTD4JJTG.js";
12
- import "../../../chunks/chunk-TDHVB2FH.js";
13
- import "../../../chunks/chunk-NM2JLPJ6.js";
11
+ } from "../../../chunks/chunk-UDCGB3LZ.js";
12
+ import "../../../chunks/chunk-2H2DD22Z.js";
13
+ import "../../../chunks/chunk-X7UO6BA6.js";
14
14
  import "../../../chunks/chunk-XXGYUYXI.js";
15
15
  import "../../../chunks/chunk-LZQXQOPJ.js";
16
16
 
@@ -4,7 +4,7 @@ import {
4
4
  disposeModelTransports,
5
5
  streamSimple,
6
6
  validateToolArguments
7
- } from "./chunk-NM2JLPJ6.js";
7
+ } from "./chunk-X7UO6BA6.js";
8
8
 
9
9
  // ../../packages/agent-core/src/failure.ts
10
10
  function getAgentFailureMetadata(error) {
@@ -850,6 +850,7 @@ var Agent = class {
850
850
  convertToLlm: this.convertToLlm,
851
851
  transformContext: this.transformContext,
852
852
  beforeToolContinuation: beforeToolContinuation ? async () => {
853
+ if (!ownsRun() || runController.signal.aborted) throw new Error("Request was aborted");
853
854
  await new Promise((resolve) => {
854
855
  acknowledgeToolTurn = resolve;
855
856
  });
@@ -7,12 +7,12 @@ import {
7
7
  defaultShellKindForPlatform,
8
8
  interpretShellExit,
9
9
  requestInteraction
10
- } from "./chunk-JTD4JJTG.js";
10
+ } from "./chunk-UDCGB3LZ.js";
11
11
  import {
12
12
  EMPTY_ASSISTANT_CONTENT_ERROR,
13
13
  OPENAI_COMPAT_PROTOCOL_ERROR_CODE,
14
14
  getLogger
15
- } from "./chunk-NM2JLPJ6.js";
15
+ } from "./chunk-X7UO6BA6.js";
16
16
  import {
17
17
  Type
18
18
  } from "./chunk-XXGYUYXI.js";
@@ -4,7 +4,7 @@ import {
4
4
  createAgentOperationError,
5
5
  getAgentFailureMetadata,
6
6
  getToolCallerIdentity
7
- } from "./chunk-TDHVB2FH.js";
7
+ } from "./chunk-2H2DD22Z.js";
8
8
  import {
9
9
  AssistantMessageEventStream,
10
10
  FileSystemGateway,
@@ -14,7 +14,7 @@ import {
14
14
  getPlatformConfig,
15
15
  hashText,
16
16
  streamSimple
17
- } from "./chunk-NM2JLPJ6.js";
17
+ } from "./chunk-X7UO6BA6.js";
18
18
  import {
19
19
  Type
20
20
  } from "./chunk-XXGYUYXI.js";
@@ -1528,7 +1528,7 @@ function getSystemIO() {
1528
1528
  return CS.System.IO;
1529
1529
  }
1530
1530
  function looksLikeBase64(value) {
1531
- return value.length > 0 && value.length % 4 === 0 && /^[A-Za-z0-9+/]+={0,2}$/.test(value);
1531
+ return value.length === 0 || value.length % 4 === 0 && /^[A-Za-z0-9+/]+={0,2}$/.test(value);
1532
1532
  }
1533
1533
  function getPieFileBridge() {
1534
1534
  if (typeof CS === "undefined" || !CS?.Pie?.PieFileBridge) {
@@ -8,8 +8,8 @@ import {
8
8
  createToolCallerIdentity,
9
9
  getAgentFailureMetadata,
10
10
  getToolCallerIdentity
11
- } from "./chunk-TDHVB2FH.js";
12
- import "./chunk-NM2JLPJ6.js";
11
+ } from "./chunk-2H2DD22Z.js";
12
+ import "./chunk-X7UO6BA6.js";
13
13
  import "./chunk-XXGYUYXI.js";
14
14
  import "./chunk-LZQXQOPJ.js";
15
15
  export {
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  EventStream
4
- } from "./chunk-NM2JLPJ6.js";
4
+ } from "./chunk-X7UO6BA6.js";
5
5
  import "./chunk-XXGYUYXI.js";
6
6
  import "./chunk-LZQXQOPJ.js";
7
7
 
package/dist/cli.js CHANGED
@@ -29,7 +29,7 @@ import {
29
29
  migrateConfigFromAgentDir,
30
30
  setYoloGrantListener,
31
31
  truncateHeadTail
32
- } from "./chunks/chunk-ZDGSTGF2.js";
32
+ } from "./chunks/chunk-TGCI5M6R.js";
33
33
  import {
34
34
  AGENTS_CONTEXT_FILE_NAME,
35
35
  AgentSessionController,
@@ -91,8 +91,8 @@ import {
91
91
  shouldPreserveExecutionStateForUserText,
92
92
  supersedeExecutionState,
93
93
  verifyPreparedCompactionCommit
94
- } from "./chunks/chunk-JTD4JJTG.js";
95
- import "./chunks/chunk-TDHVB2FH.js";
94
+ } from "./chunks/chunk-UDCGB3LZ.js";
95
+ import "./chunks/chunk-2H2DD22Z.js";
96
96
  import {
97
97
  Deref,
98
98
  Errors,
@@ -115,7 +115,7 @@ import {
115
115
  sortToolModelCandidatesByCapability,
116
116
  streamSimple,
117
117
  type_exports
118
- } from "./chunks/chunk-NM2JLPJ6.js";
118
+ } from "./chunks/chunk-X7UO6BA6.js";
119
119
  import {
120
120
  IsArray,
121
121
  IsBigInt,
@@ -58512,7 +58512,7 @@ function matchesKey(data, keyId) {
58512
58512
  if (ctrl && alt && !shift && !_kittyProtocolActive && rawCtrl) {
58513
58513
  return data === `\x1B${rawCtrl}`;
58514
58514
  }
58515
- if (alt && !ctrl && !shift && !_kittyProtocolActive && key >= "a" && key <= "z") {
58515
+ if (alt && !ctrl && !shift && key >= "a" && key <= "z") {
58516
58516
  if (data === `\x1B${key}`) return true;
58517
58517
  }
58518
58518
  if (ctrl && !shift && !alt) {
@@ -64960,7 +64960,7 @@ var ExtensionRunner = class {
64960
64960
  /**
64961
64961
  * Emit terminal:input to all extensions. Transforms chain through handlers
64962
64962
  * in registration order (each handler sees the previous transform); a
64963
- * consume result stops the chain and wins. Default: continue unchanged.
64963
+ * consume/reject result stops the chain and wins. Default: continue unchanged.
64964
64964
  */
64965
64965
  async emitTerminalInput(event) {
64966
64966
  const ctx = this.createContext();
@@ -64974,6 +64974,7 @@ var ExtensionRunner = class {
64974
64974
  const result = await handler({ ...event, text }, ctx);
64975
64975
  if (!result || typeof result !== "object" || !("action" in result)) continue;
64976
64976
  if (result.action === "consume") return { action: "consume" };
64977
+ if (result.action === "reject") return { action: "reject" };
64977
64978
  if (result.action === "transform" && typeof result.text === "string") {
64978
64979
  text = result.text;
64979
64980
  current = { action: "transform", text };
@@ -65401,7 +65402,7 @@ var DEFAULT_APP_KEYBINDINGS = {
65401
65402
  selectModel: "ctrl+l",
65402
65403
  expandTools: "ctrl+o",
65403
65404
  toggleThinking: "ctrl+t",
65404
- toggleYolo: "alt+o",
65405
+ toggleYolo: ["ctrl+x", "alt+o"],
65405
65406
  toggleSessionNamedFilter: "ctrl+n",
65406
65407
  externalEditor: "ctrl+g",
65407
65408
  steer: "alt+enter",
@@ -77980,6 +77981,9 @@ function setupInteractiveEditorSubmitHandler(host) {
77980
77981
  if (!text) return;
77981
77982
  if (host.extensionRunner) {
77982
77983
  const decision = await host.extensionRunner.emitTerminalInput({ type: "terminal:input", text });
77984
+ if (decision.action === "reject") {
77985
+ return;
77986
+ }
77983
77987
  if (decision.action === "consume") {
77984
77988
  host.editor.setText("");
77985
77989
  return;
@@ -80064,8 +80068,9 @@ function setupInteractiveKeybindings(host) {
80064
80068
  host.handleFollowUp();
80065
80069
  return { consume: true };
80066
80070
  }
80071
+ if (!mainEditorOwnsInput(host)) return { consume: false };
80067
80072
  const shortcuts = host.getExtensionShortcuts?.();
80068
- if (shortcuts && shortcuts.size > 0 && mainEditorOwnsInput(host)) {
80073
+ if (shortcuts && shortcuts.size > 0) {
80069
80074
  for (const shortcut of shortcuts.values()) {
80070
80075
  if (matchesKey(data, shortcut.key)) {
80071
80076
  void shortcut.handler();
@@ -83116,7 +83121,7 @@ function beginUserInput(host, extensionIsCurrent = () => true) {
83116
83121
  }
83117
83122
  let content = [text.trim(), ...mentions].filter(Boolean).join("\n");
83118
83123
  const decision = await runner.emitTerminalInput({ type: "terminal:input", text: content });
83119
- if (!isCurrent() || decision.action === "consume") return false;
83124
+ if (!isCurrent() || decision.action === "consume" || decision.action === "reject") return false;
83120
83125
  if (decision.action === "transform") content = decision.text.trim();
83121
83126
  if (!content || mentions.some((mention) => !content.includes(mention))) return false;
83122
83127
  host.queueMessage(content, "followUp", { clearEditor: false, deliverWhileStreaming: false });
@@ -83423,6 +83428,7 @@ var InteractiveMode = class {
83423
83428
  knowledgeSection = "";
83424
83429
  extensions = [];
83425
83430
  extensionRunner;
83431
+ extensionShortcutsCache;
83426
83432
  extensionUIContext;
83427
83433
  allTools = [];
83428
83434
  streamingComponent;
@@ -83766,7 +83772,7 @@ var InteractiveMode = class {
83766
83772
  async init() {
83767
83773
  const activeSession = this.sessionManager.getActiveSession();
83768
83774
  this.thinkingLevel = resolveInitialThinkingLevel({ session: activeSession, settingsManager: this.options.settingsManager });
83769
- const { Agent } = await import("./chunks/src-IY6TEIL7.js");
83775
+ const { Agent } = await import("./chunks/src-GX4UBAYF.js");
83770
83776
  this.agent = new Agent({
83771
83777
  initialState: {
83772
83778
  systemPrompt: this.buildSystemPrompt(),
@@ -84114,17 +84120,22 @@ var InteractiveMode = class {
84114
84120
  * dispatcher (duck-typed onto InteractiveKeybindingsHost). Handlers are
84115
84121
  * bound to the extension runner context here. */
84116
84122
  getExtensionShortcuts() {
84123
+ const cached = this.extensionShortcutsCache;
84124
+ if (cached && cached.extensions === this.extensions && cached.runner === this.extensionRunner) {
84125
+ return cached.shortcuts;
84126
+ }
84117
84127
  const merged = /* @__PURE__ */ new Map();
84128
+ const context = this.extensionRunner?.createContext();
84118
84129
  for (const extension of this.extensions) {
84119
84130
  for (const [key, shortcut] of extension.shortcuts) {
84120
84131
  if (merged.has(key)) continue;
84121
- const context = this.extensionRunner?.createContext();
84122
84132
  merged.set(key, {
84123
84133
  key,
84124
84134
  handler: () => shortcut.handler(context)
84125
84135
  });
84126
84136
  }
84127
84137
  }
84138
+ this.extensionShortcutsCache = { extensions: this.extensions, runner: this.extensionRunner, shortcuts: merged };
84128
84139
  return merged;
84129
84140
  }
84130
84141
  /** Live mention handler for extension-driven attachments (duck-typed onto
@@ -84654,7 +84665,7 @@ async function runPrintMode(params) {
84654
84665
  `);
84655
84666
  console.log("Assistant: ");
84656
84667
  }
84657
- const { Agent: AgentClass } = await import("./chunks/src-IY6TEIL7.js");
84668
+ const { Agent: AgentClass } = await import("./chunks/src-GX4UBAYF.js");
84658
84669
  let agent;
84659
84670
  const printModeExtensions = await loadPrintModeExtensions({
84660
84671
  cwd: runtime.cwd,
@@ -85549,7 +85560,7 @@ async function runJsonEventsMode(params) {
85549
85560
  const sideTrace = trace;
85550
85561
  const sideApiKey = runtime.apiKey;
85551
85562
  const snapshot = structuredClone(parent.state.messages);
85552
- const { Agent: AgentClass } = await import("./chunks/src-IY6TEIL7.js");
85563
+ const { Agent: AgentClass } = await import("./chunks/src-GX4UBAYF.js");
85553
85564
  const sideAgent = new AgentClass({
85554
85565
  initialState: {
85555
85566
  systemPrompt: parent.state.systemPrompt,
@@ -85913,7 +85924,7 @@ async function runJsonEventsMode(params) {
85913
85924
  if (runtime.initialModel.unconfigured || controller) {
85914
85925
  return;
85915
85926
  }
85916
- const { Agent: AgentClass } = await import("./chunks/src-IY6TEIL7.js");
85927
+ const { Agent: AgentClass } = await import("./chunks/src-GX4UBAYF.js");
85917
85928
  if (runtimeClosing) return;
85918
85929
  const compositionRegistry = createCliHostEnvelopeRegistry();
85919
85930
  const jsonModeExtensions = await loadJsonModeExtensions({ runtime, envelopeRegistry: compositionRegistry, getAgent: () => agent });
@@ -86601,7 +86612,7 @@ async function runWithJsonEventsConsoleIsolation(fn) {
86601
86612
  }
86602
86613
  async function createCliTestStreamFnFromEnv() {
86603
86614
  if (!process.env.PIE_TEST_MOCK_STREAM_SEQUENCE) return void 0;
86604
- return (await import("./chunks/test-stream-EXSL5TIO.js")).createTestStreamFnFromSequenceEnv();
86615
+ return (await import("./chunks/test-stream-AKIZNFCM.js")).createTestStreamFnFromSequenceEnv();
86605
86616
  }
86606
86617
  function resolveJsonEventsDetailFlag() {
86607
86618
  for (let index = 0; index < process.argv.length; index += 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cydm/pie",
3
- "version": "2.7.16",
3
+ "version": "2.7.18",
4
4
  "description": "Pie AI Agent CLI",
5
5
  "type": "module",
6
6
  "bin": {