@cydm/pie 1.0.31 → 1.0.32

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,7 +1,7 @@
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-BOFCKEV5.js";
4
+ } from "../../../chunks/chunk-MPZSDREV.js";
5
5
  import "../../../chunks/chunk-4B42ZU4B.js";
6
6
  import "../../../chunks/chunk-64XJIKVK.js";
7
7
  import "../../../chunks/chunk-TG2EQLX2.js";
@@ -7,7 +7,7 @@ import {
7
7
  isPlanModeSafeCommand,
8
8
  markCompletedPlanSteps,
9
9
  restoreExecutionState
10
- } from "../../../chunks/chunk-BOFCKEV5.js";
10
+ } from "../../../chunks/chunk-MPZSDREV.js";
11
11
  import "../../../chunks/chunk-4B42ZU4B.js";
12
12
  import "../../../chunks/chunk-64XJIKVK.js";
13
13
  import "../../../chunks/chunk-TG2EQLX2.js";
@@ -1,11 +1,11 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  createCliHostCapabilities
4
- } from "../../../chunks/chunk-PLJQYVFC.js";
4
+ } from "../../../chunks/chunk-PJWPGKQK.js";
5
5
  import {
6
6
  createSharedFileSystemTools,
7
7
  createSubagentCapability
8
- } from "../../../chunks/chunk-BOFCKEV5.js";
8
+ } from "../../../chunks/chunk-MPZSDREV.js";
9
9
  import "../../../chunks/chunk-4B42ZU4B.js";
10
10
  import "../../../chunks/chunk-64XJIKVK.js";
11
11
  import "../../../chunks/chunk-TG2EQLX2.js";
@@ -7,7 +7,7 @@ import {
7
7
  executeManageTodoList,
8
8
  executionStateToTodos,
9
9
  restoreExecutionState
10
- } from "../../../chunks/chunk-BOFCKEV5.js";
10
+ } from "../../../chunks/chunk-MPZSDREV.js";
11
11
  import "../../../chunks/chunk-4B42ZU4B.js";
12
12
  import "../../../chunks/chunk-64XJIKVK.js";
13
13
  import "../../../chunks/chunk-TG2EQLX2.js";
@@ -4109,6 +4109,11 @@ var AgentSessionQueueDispatcher = class {
4109
4109
  if (this.options.getDisposed() || this.options.isStreaming() || this.options.isBlockedByRuntimePolicy()) {
4110
4110
  return false;
4111
4111
  }
4112
+ await this.options.agent.waitForIdle();
4113
+ if (this.options.getDisposed() || this.options.isStreaming() || this.options.isBlockedByRuntimePolicy()) {
4114
+ this.schedule(100);
4115
+ return false;
4116
+ }
4112
4117
  const queuedInput = this.options.queue.peek();
4113
4118
  if (!queuedInput) {
4114
4119
  return false;
@@ -8,7 +8,7 @@ import {
8
8
  createSharedWebSearchTool,
9
9
  interpretShellExit,
10
10
  requestInteraction
11
- } from "./chunk-BOFCKEV5.js";
11
+ } from "./chunk-MPZSDREV.js";
12
12
  import {
13
13
  Type
14
14
  } from "./chunk-64XJIKVK.js";
package/dist/cli.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  getThemesDir,
20
20
  migrateConfigFromAgentDir,
21
21
  truncateHeadTail
22
- } from "./chunks/chunk-PLJQYVFC.js";
22
+ } from "./chunks/chunk-PJWPGKQK.js";
23
23
  import {
24
24
  AGENTS_CONTEXT_FILE_NAME,
25
25
  AgentSessionController,
@@ -69,7 +69,7 @@ import {
69
69
  setExtensionEnabledInSettings,
70
70
  shouldPreserveExecutionStateForUserText,
71
71
  supersedeExecutionState
72
- } from "./chunks/chunk-BOFCKEV5.js";
72
+ } from "./chunks/chunk-MPZSDREV.js";
73
73
  import "./chunks/chunk-4B42ZU4B.js";
74
74
  import {
75
75
  Deref,
@@ -50616,26 +50616,32 @@ var Editor = class {
50616
50616
  return;
50617
50617
  }
50618
50618
  if (kb.matches(data, "selectConfirm")) {
50619
- const selected = this.autocompleteList.getSelectedItem();
50620
- if (selected && this.autocompleteProvider) {
50621
- this.pushUndoSnapshot();
50622
- this.lastAction = null;
50623
- const result = this.autocompleteProvider.applyCompletion(
50624
- this.state.lines,
50625
- this.state.cursorLine,
50626
- this.state.cursorCol,
50627
- selected,
50628
- this.autocompletePrefix
50629
- );
50630
- this.state.lines = result.lines;
50631
- this.state.cursorLine = result.cursorLine;
50632
- this.setCursorCol(result.cursorCol);
50633
- if (this.autocompletePrefix.startsWith("/")) {
50634
- this.cancelAutocomplete();
50635
- } else {
50636
- this.cancelAutocomplete();
50637
- if (this.onChange) this.onChange(this.getText());
50638
- return;
50619
+ const currentLine = this.state.lines[this.state.cursorLine] || "";
50620
+ const isBareSlashSubmit = this.state.lines.length === 1 && currentLine === "/" && this.state.cursorCol === 1;
50621
+ if (isBareSlashSubmit) {
50622
+ this.cancelAutocomplete();
50623
+ } else {
50624
+ const selected = this.autocompleteList.getSelectedItem();
50625
+ if (selected && this.autocompleteProvider) {
50626
+ this.pushUndoSnapshot();
50627
+ this.lastAction = null;
50628
+ const result = this.autocompleteProvider.applyCompletion(
50629
+ this.state.lines,
50630
+ this.state.cursorLine,
50631
+ this.state.cursorCol,
50632
+ selected,
50633
+ this.autocompletePrefix
50634
+ );
50635
+ this.state.lines = result.lines;
50636
+ this.state.cursorLine = result.cursorLine;
50637
+ this.setCursorCol(result.cursorCol);
50638
+ if (this.autocompletePrefix.startsWith("/")) {
50639
+ this.cancelAutocomplete();
50640
+ } else {
50641
+ this.cancelAutocomplete();
50642
+ if (this.onChange) this.onChange(this.getText());
50643
+ return;
50644
+ }
50639
50645
  }
50640
50646
  }
50641
50647
  }
@@ -63067,10 +63073,11 @@ var TITLE_SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\
63067
63073
  var TITLE_SPINNER_INTERVAL_MS = 80;
63068
63074
  var TITLE_WAITING_PREFIX = "\u23F8";
63069
63075
  var titleSpinnerTimers = /* @__PURE__ */ new WeakMap();
63076
+ var explicitSubmitLockHosts = /* @__PURE__ */ new WeakSet();
63070
63077
  var controllerBusyHosts = /* @__PURE__ */ new WeakSet();
63071
63078
  var waitingForUserHosts = /* @__PURE__ */ new WeakSet();
63072
63079
  function isHostBusy(host) {
63073
- return host.submitLock || controllerBusyHosts.has(host);
63080
+ return explicitSubmitLockHosts.has(host) || controllerBusyHosts.has(host);
63074
63081
  }
63075
63082
  function isWaitingForUser(host) {
63076
63083
  return waitingForUserHosts.has(host);
@@ -63127,10 +63134,17 @@ function syncTitleActivity(host) {
63127
63134
  host.updateTerminalTitle();
63128
63135
  }
63129
63136
  function setSubmitLock(host, locked) {
63130
- if (host.submitLock === locked) {
63137
+ const hadExplicitLock = explicitSubmitLockHosts.has(host);
63138
+ if (locked) {
63139
+ explicitSubmitLockHosts.add(host);
63140
+ } else {
63141
+ explicitSubmitLockHosts.delete(host);
63142
+ }
63143
+ const nextSubmitLock = explicitSubmitLockHosts.has(host) || controllerBusyHosts.has(host);
63144
+ if (hadExplicitLock === locked && host.submitLock === nextSubmitLock) {
63131
63145
  return;
63132
63146
  }
63133
- host.submitLock = locked;
63147
+ host.submitLock = nextSubmitLock;
63134
63148
  syncTitleActivity(host);
63135
63149
  }
63136
63150
  function setControllerBusy(host, busy) {
@@ -63143,6 +63157,7 @@ function setControllerBusy(host, busy) {
63143
63157
  } else {
63144
63158
  controllerBusyHosts.delete(host);
63145
63159
  }
63160
+ host.submitLock = explicitSubmitLockHosts.has(host) || controllerBusyHosts.has(host);
63146
63161
  syncTitleActivity(host);
63147
63162
  }
63148
63163
  function setWaitingForUser(host, waiting) {
@@ -64672,6 +64687,16 @@ function handleToolStart(host, event) {
64672
64687
  if (event.toolCallId) {
64673
64688
  const toolComponent = host.pendingTools.get(event.toolCallId);
64674
64689
  if (toolComponent) {
64690
+ toolComponent.updateArgs(event.args);
64691
+ } else {
64692
+ const newToolComponent = new ToolExecutionComponent(
64693
+ event.toolName,
64694
+ event.args,
64695
+ { expanded: host.toolOutputExpanded },
64696
+ host.ui
64697
+ );
64698
+ host.pendingTools.set(event.toolCallId, newToolComponent);
64699
+ host.chatContainer.addChild(newToolComponent);
64675
64700
  }
64676
64701
  }
64677
64702
  host.footer.setState({ lifecycleEvent: formatFooterLifecycleEvent(event) });
@@ -64750,6 +64775,12 @@ function handleMessageEnd(host, event) {
64750
64775
  }
64751
64776
 
64752
64777
  // src/input/interactive-input-pipeline.ts
64778
+ function shouldQueueUserInput(host) {
64779
+ return host.submitLock || (host.agentSessionController?.hasQueuedMessages ?? false);
64780
+ }
64781
+ function showBusyCommandStatus(host, command) {
64782
+ host.showStatus(`Wait for the current response to finish before running ${command}`);
64783
+ }
64753
64784
  function setupInteractiveEditorSubmitHandler(host) {
64754
64785
  host.editor.onSubmit = async (text) => {
64755
64786
  text = text.trim();
@@ -64758,7 +64789,7 @@ function setupInteractiveEditorSubmitHandler(host) {
64758
64789
  const skillText = text.slice("/skills/".length);
64759
64790
  const expanded = host.expandSkillCommand(skillText);
64760
64791
  if (expanded !== skillText) {
64761
- if (host.submitLock) {
64792
+ if (shouldQueueUserInput(host)) {
64762
64793
  host.queueMessage(expanded, "followUp", { deliverWhileStreaming: false });
64763
64794
  return;
64764
64795
  }
@@ -64789,8 +64820,8 @@ function setupInteractiveEditorSubmitHandler(host) {
64789
64820
  }
64790
64821
  if (text.startsWith("/tools/subagent")) {
64791
64822
  const args = text.slice("/tools/subagent".length).trim();
64792
- if (host.submitLock) {
64793
- host.queueMessage(text, "followUp", { deliverWhileStreaming: false });
64823
+ if (shouldQueueUserInput(host)) {
64824
+ showBusyCommandStatus(host, "/tools/subagent");
64794
64825
  return;
64795
64826
  }
64796
64827
  host.editor.setText("");
@@ -64804,12 +64835,12 @@ function setupInteractiveEditorSubmitHandler(host) {
64804
64835
  const firstPartSegments = firstPart.slice(1).split("/").filter(Boolean);
64805
64836
  const exactMatch = commandTree.find(firstPartSegments);
64806
64837
  if (exactMatch?.handler) {
64807
- if (host.submitLock) {
64838
+ if (shouldQueueUserInput(host)) {
64808
64839
  if (firstPart === "/sessions/compact") {
64809
64840
  host.showStatus("Wait for the current response to finish before compacting");
64810
64841
  return;
64811
64842
  }
64812
- host.queueMessage(text, "followUp", { deliverWhileStreaming: false });
64843
+ showBusyCommandStatus(host, firstPart);
64813
64844
  return;
64814
64845
  }
64815
64846
  host.editor.setText("");
@@ -64860,12 +64891,12 @@ function setupInteractiveEditorSubmitHandler(host) {
64860
64891
  }
64861
64892
  }
64862
64893
  if (node?.handler) {
64863
- if (host.submitLock) {
64894
+ if (shouldQueueUserInput(host)) {
64864
64895
  if (commandSegments.join("/") === "sessions/compact") {
64865
64896
  host.showStatus("Wait for the current response to finish before compacting");
64866
64897
  return;
64867
64898
  }
64868
- host.queueMessage(text, "followUp", { deliverWhileStreaming: false });
64899
+ showBusyCommandStatus(host, "/" + commandSegments.join("/"));
64869
64900
  return;
64870
64901
  }
64871
64902
  host.editor.setText("");
@@ -64905,8 +64936,8 @@ function setupInteractiveEditorSubmitHandler(host) {
64905
64936
  for (const ext of host.extensions) {
64906
64937
  for (const [name, command] of ext.commands) {
64907
64938
  if (command.path?.join("/") === fullPath) {
64908
- if (host.submitLock) {
64909
- host.queueMessage(text, "followUp", { deliverWhileStreaming: false });
64939
+ if (shouldQueueUserInput(host)) {
64940
+ showBusyCommandStatus(host, "/" + fullPath);
64910
64941
  return;
64911
64942
  }
64912
64943
  host.editor.setText("");
@@ -64960,7 +64991,7 @@ function setupInteractiveEditorSubmitHandler(host) {
64960
64991
  host.agentSessionController?.requestQueueDispatch();
64961
64992
  return;
64962
64993
  }
64963
- if (host.submitLock) {
64994
+ if (shouldQueueUserInput(host)) {
64964
64995
  host.queueMessage(text, "followUp", { deliverWhileStreaming: false });
64965
64996
  return;
64966
64997
  }
@@ -66831,7 +66862,11 @@ function queueMessage(host, text, mode, options = {}) {
66831
66862
  function handleFollowUp(host) {
66832
66863
  const text = host.editor.getText().trim();
66833
66864
  if (!text) return;
66834
- if (host.submitLock) {
66865
+ if (isCommandLikeInput(text)) {
66866
+ host.editor.onSubmit?.(text);
66867
+ return;
66868
+ }
66869
+ if (host.submitLock || (host.agentSessionController?.hasQueuedMessages ?? false)) {
66835
66870
  queueMessage(host, text, "followUp");
66836
66871
  } else if (host.editor.onSubmit) {
66837
66872
  void host.editor.onSubmit(text);
@@ -66841,6 +66876,9 @@ function truncate(text, maxLength) {
66841
66876
  if (text.length <= maxLength) return text;
66842
66877
  return text.slice(0, maxLength) + "...";
66843
66878
  }
66879
+ function isCommandLikeInput(text) {
66880
+ return text.startsWith("/") || text.startsWith("!!");
66881
+ }
66844
66882
 
66845
66883
  // src/components/footer.ts
66846
66884
  var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
@@ -67973,6 +68011,8 @@ function createInteractiveAgentSessionController(host) {
67973
68011
  }
67974
68012
  host.sessionTrace.completeTurn(event.message, false);
67975
68013
  host._semanticTurnIndex++;
68014
+ } else if (event.type === "turn_settled") {
68015
+ host.setControllerBusy(false);
67976
68016
  } else if (event.type === "turn_failed_terminal") {
67977
68017
  host.clearContinuationTimeout("turn_failed_terminal");
67978
68018
  if (event.message) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cydm/pie",
3
- "version": "1.0.31",
3
+ "version": "1.0.32",
4
4
  "description": "Pie AI Agent CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -20,7 +20,7 @@
20
20
  "posttest:offline": "node --test --import tsx test/remote-model-catalog.test.ts",
21
21
  "test:offline": "node --test --import tsx test/core-services.test.ts test/cli.test.ts test/cli-auto-compaction.test.ts test/execution-state-manager.test.ts test/queued-steer-execution-state.test.ts test/architecture-boundaries.test.ts test/attachment-resolver.test.ts test/kimi-attachment-extension.test.ts test/document-attachment-extension.test.ts test/auto-compact-overflow.test.ts test/hierarchical-command-system.test.ts test/extensions-enablement.test.ts test/message-queue-unit.test.ts test/evals-harness.test.ts test/session-trace.test.ts test/runtime-mode-context.test.ts test/tool-policy.test.ts test/retry-policy.test.ts test/yolo-command.test.ts test/footer-lifecycle.test.ts test/files-utils.test.ts test/source-size-guard.test.ts test/runtime-logger.test.ts test/release-readiness.test.ts test/package-artifacts.test.ts test/code-intel-typescript-provider.test.ts test/init-extension-contract.test.ts test/skills-runtime.test.ts test/cross-host-parity.test.ts test/tool-name-rendering.test.ts test/session-selector.test.ts test/terminal-title.test.ts test/tools-registry.test.ts test/system-prompt-contract.test.ts test/direct-bash.test.ts test/daily-agent-smoke.terminal.test.ts",
22
22
  "test:all": "npm run test:offline && npm run test:terminal:vitest",
23
- "test:terminal:vitest": "vitest run test/mention-file-select.terminal.test.ts test/tool-partial-display.terminal.test.ts test/viewport-position-final.test.ts",
23
+ "test:terminal:vitest": "vitest run test/mention-file-select.terminal.test.ts test/tool-partial-display.terminal.test.ts test/viewport-position-final.test.ts --no-file-parallelism",
24
24
  "test:todo-tui": "PIE_REAL_TODO_TUI=1 node --test --import tsx test/todo-closure.terminal.test.ts",
25
25
  "test:daily-tui": "npm run test:daily-tui:quick",
26
26
  "test:daily-tui:quick": "PIE_REAL_DAILY_TUI=1 PIE_DAILY_TUI_LEVEL=quick node --test --import tsx test/daily-agent-smoke.terminal.test.ts",