@ordewell/core 0.4.18 → 0.4.19

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.
@@ -458,6 +458,14 @@ interface ITerminalSession {
458
458
  kill(): void;
459
459
  getOutput(): string;
460
460
  write(text: string): void;
461
+ /**
462
+ * True when the session runs the agent as a raw-mode TUI (a real PTY for the
463
+ * VS Code terminal, a tmux window). Such a surface submits an input line on
464
+ * the Enter keystroke (`\r`), so a synchronized resume token terminated with
465
+ * `\n` only types the line and never sends it. A line-oriented piped session
466
+ * (`defaultInteractive = false`) leaves this false and accepts `\n`.
467
+ */
468
+ readonly interactive?: boolean;
461
469
  /**
462
470
  * Optional transport-level control channel: PTY resize requests for a session
463
471
  * whose runner renders a TUI. Absent on transports without a resizable PTY
@@ -458,6 +458,14 @@ interface ITerminalSession {
458
458
  kill(): void;
459
459
  getOutput(): string;
460
460
  write(text: string): void;
461
+ /**
462
+ * True when the session runs the agent as a raw-mode TUI (a real PTY for the
463
+ * VS Code terminal, a tmux window). Such a surface submits an input line on
464
+ * the Enter keystroke (`\r`), so a synchronized resume token terminated with
465
+ * `\n` only types the line and never sends it. A line-oriented piped session
466
+ * (`defaultInteractive = false`) leaves this false and accepts `\n`.
467
+ */
468
+ readonly interactive?: boolean;
461
469
  /**
462
470
  * Optional transport-level control channel: PTY resize requests for a session
463
471
  * whose runner renders a TUI. Absent on transports without a resizable PTY
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { h as RunnerId, c as PlanStatus, L as LegacyPlanState, a as DiscoveredModel, T as Task, d as ResearchProgress, R as ResearchLogEntry, C as ConversationMessage, n as TaskSnapshot, Q as QueuedMessage, A as ActiveTaskSession, g as ResearchToolType, b as PlanState, v as Verdict } from './Task-4rDGr8Su.mjs';
2
2
  export { D as DiscoveredMode, M as Message, P as PlanModificationWarnings, e as ResearchStep, f as ResearchStepOutcome, S as StreamEvent, i as StreamStepEvent, j as StreamThinkingEvent, k as TaskMode, l as TaskModelAssignment, m as TaskOutputSummary, o as TaskStatus, p as TaskType, q as TaskWithParent, r as ThinkingBlock, U as UserPromptEntry, s as UserStep, V as ValidationCheck, t as ValidationContext, u as ValidationResult, w as VerificationCheck, x as addTaskToPlan, y as createEmptyPlan, z as createTask, B as emptyWarnings, E as flattenTasks, F as flattenTasksWithParents, G as migrateLegacyPlan, H as migratePlanState, I as migrateTask, J as removeTaskFromPlan, K as renumberTasks, N as updateTaskInPlan, O as validateModifiedPlan, W as warningsText } from './Task-4rDGr8Su.mjs';
3
- import { f as IFileSystem, R as ReadFileOpts, T as ToolOutcome, d as GrepOptions, c as GlobOptions, b as FindSymbolOptions, I as IConfig, A as AiProvider, r as ProviderModelLists, i as ITerminalSession, h as ITerminalRunner, w as RunnerRegistry, k as OrchestratorOption, u as RunnerInvocation, g as IPluginStore, v as RunnerPluginManifest, t as ResolveContext } from './ITerminalRunner-E3-6QNUS.mjs';
4
- export { a as AllProviderModels, C as CatalogModel, D as DiscoveryCommand, F as FetchAllProviderModelsOptions, G as GREP_DEFAULT_HEAD_LIMIT, e as GrepOutputMode, M as ModelCatalog, j as ModelShortcut, O as ORCHESTRATOR_SHORTCUTS, P as PluginCloneFn, l as PluginEntry, m as PluginFeatures, n as PluginMode, o as PluginModelDiscovery, p as PluginRunnerDef, q as ProviderCredentialSource, s as ProviderModelsResult, S as SEARCH_EXCLUSIONS, x as collectProviderCredentials, y as enabledRunners, z as fetchAllProviderModels, B as isReservedRunnerName, E as knownModelId, H as resolveModelShortcut, J as resolveProvider, K as toOrchestratorOptions } from './ITerminalRunner-E3-6QNUS.mjs';
3
+ import { f as IFileSystem, R as ReadFileOpts, T as ToolOutcome, d as GrepOptions, c as GlobOptions, b as FindSymbolOptions, I as IConfig, A as AiProvider, r as ProviderModelLists, i as ITerminalSession, h as ITerminalRunner, w as RunnerRegistry, k as OrchestratorOption, u as RunnerInvocation, g as IPluginStore, v as RunnerPluginManifest, t as ResolveContext } from './ITerminalRunner-C-HlFxuS.mjs';
4
+ export { a as AllProviderModels, C as CatalogModel, D as DiscoveryCommand, F as FetchAllProviderModelsOptions, G as GREP_DEFAULT_HEAD_LIMIT, e as GrepOutputMode, M as ModelCatalog, j as ModelShortcut, O as ORCHESTRATOR_SHORTCUTS, P as PluginCloneFn, l as PluginEntry, m as PluginFeatures, n as PluginMode, o as PluginModelDiscovery, p as PluginRunnerDef, q as ProviderCredentialSource, s as ProviderModelsResult, S as SEARCH_EXCLUSIONS, x as collectProviderCredentials, y as enabledRunners, z as fetchAllProviderModels, B as isReservedRunnerName, E as knownModelId, H as resolveModelShortcut, J as resolveProvider, K as toOrchestratorOptions } from './ITerminalRunner-C-HlFxuS.mjs';
5
5
  import { I as IApproval, d as ApprovalRequest, a as ApprovalMode } from './ApprovalPolicy-BVhGdECT.mjs';
6
6
  export { A as ApprovalKind, b as ApprovalPolicy, c as ApprovalPolicyOptions, e as ApprovalSource, D as DENY_ALL } from './ApprovalPolicy-BVhGdECT.mjs';
7
7
  import { R as RunnerModeInfo } from './ModeResolver-mtIWrLXn.mjs';
@@ -936,10 +936,11 @@ interface HeadlessRunnerDeps {
936
936
  }
937
937
  declare class HeadlessSession extends AbstractTerminalSession {
938
938
  private spawnImpl;
939
+ readonly interactive: boolean;
939
940
  private process;
940
941
  private outputBuffer;
941
942
  private controlStream;
942
- constructor(id: string, taskId: string, spawnImpl: SpawnFn);
943
+ constructor(id: string, taskId: string, spawnImpl: SpawnFn, interactive?: boolean);
943
944
  get isStarted(): boolean;
944
945
  start(launch: LaunchPlan, cwd: string, resolvedPath: string, env?: Record<string, string>, options?: {
945
946
  controlChannel?: boolean;
@@ -2868,6 +2869,14 @@ declare class VerdictEngine {
2868
2869
  private touchIdle;
2869
2870
  /** Tear down idle tracking for a task; broadcasts the null transition if it was idle. */
2870
2871
  private clearIdle;
2872
+ /**
2873
+ * Submit a synchronized resume token to the paused session. An interactive
2874
+ * TUI only accepts the Enter keystroke (`\r`) — a `\n` types the token into
2875
+ * its composer without sending it, leaving the agent paused until a human
2876
+ * presses Enter. A line-oriented piped session has no composer; it reads a
2877
+ * `\n`-terminated line, and the leading newline flushes a partial line.
2878
+ */
2879
+ private resumeToken;
2871
2880
  approveCheckpoint(taskId: string): void;
2872
2881
  rejectCheckpoint(taskId: string, reason: string): void;
2873
2882
  /**
@@ -3166,6 +3175,8 @@ declare class TmuxSession extends AbstractTerminalSession {
3166
3175
  private pollIntervalMs;
3167
3176
  private logPath;
3168
3177
  private socket;
3178
+ /** A tmux window is a real TTY running the agent's TUI, so it submits on Enter. */
3179
+ readonly interactive = true;
3169
3180
  private outputBuffer;
3170
3181
  private offset;
3171
3182
  private timer;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { h as RunnerId, c as PlanStatus, L as LegacyPlanState, a as DiscoveredModel, T as Task, d as ResearchProgress, R as ResearchLogEntry, C as ConversationMessage, n as TaskSnapshot, Q as QueuedMessage, A as ActiveTaskSession, g as ResearchToolType, b as PlanState, v as Verdict } from './Task-4rDGr8Su.js';
2
2
  export { D as DiscoveredMode, M as Message, P as PlanModificationWarnings, e as ResearchStep, f as ResearchStepOutcome, S as StreamEvent, i as StreamStepEvent, j as StreamThinkingEvent, k as TaskMode, l as TaskModelAssignment, m as TaskOutputSummary, o as TaskStatus, p as TaskType, q as TaskWithParent, r as ThinkingBlock, U as UserPromptEntry, s as UserStep, V as ValidationCheck, t as ValidationContext, u as ValidationResult, w as VerificationCheck, x as addTaskToPlan, y as createEmptyPlan, z as createTask, B as emptyWarnings, E as flattenTasks, F as flattenTasksWithParents, G as migrateLegacyPlan, H as migratePlanState, I as migrateTask, J as removeTaskFromPlan, K as renumberTasks, N as updateTaskInPlan, O as validateModifiedPlan, W as warningsText } from './Task-4rDGr8Su.js';
3
- import { f as IFileSystem, R as ReadFileOpts, T as ToolOutcome, d as GrepOptions, c as GlobOptions, b as FindSymbolOptions, I as IConfig, A as AiProvider, r as ProviderModelLists, i as ITerminalSession, h as ITerminalRunner, w as RunnerRegistry, k as OrchestratorOption, u as RunnerInvocation, g as IPluginStore, v as RunnerPluginManifest, t as ResolveContext } from './ITerminalRunner-CbLHKXT5.js';
4
- export { a as AllProviderModels, C as CatalogModel, D as DiscoveryCommand, F as FetchAllProviderModelsOptions, G as GREP_DEFAULT_HEAD_LIMIT, e as GrepOutputMode, M as ModelCatalog, j as ModelShortcut, O as ORCHESTRATOR_SHORTCUTS, P as PluginCloneFn, l as PluginEntry, m as PluginFeatures, n as PluginMode, o as PluginModelDiscovery, p as PluginRunnerDef, q as ProviderCredentialSource, s as ProviderModelsResult, S as SEARCH_EXCLUSIONS, x as collectProviderCredentials, y as enabledRunners, z as fetchAllProviderModels, B as isReservedRunnerName, E as knownModelId, H as resolveModelShortcut, J as resolveProvider, K as toOrchestratorOptions } from './ITerminalRunner-CbLHKXT5.js';
3
+ import { f as IFileSystem, R as ReadFileOpts, T as ToolOutcome, d as GrepOptions, c as GlobOptions, b as FindSymbolOptions, I as IConfig, A as AiProvider, r as ProviderModelLists, i as ITerminalSession, h as ITerminalRunner, w as RunnerRegistry, k as OrchestratorOption, u as RunnerInvocation, g as IPluginStore, v as RunnerPluginManifest, t as ResolveContext } from './ITerminalRunner-BVU7TfT3.js';
4
+ export { a as AllProviderModels, C as CatalogModel, D as DiscoveryCommand, F as FetchAllProviderModelsOptions, G as GREP_DEFAULT_HEAD_LIMIT, e as GrepOutputMode, M as ModelCatalog, j as ModelShortcut, O as ORCHESTRATOR_SHORTCUTS, P as PluginCloneFn, l as PluginEntry, m as PluginFeatures, n as PluginMode, o as PluginModelDiscovery, p as PluginRunnerDef, q as ProviderCredentialSource, s as ProviderModelsResult, S as SEARCH_EXCLUSIONS, x as collectProviderCredentials, y as enabledRunners, z as fetchAllProviderModels, B as isReservedRunnerName, E as knownModelId, H as resolveModelShortcut, J as resolveProvider, K as toOrchestratorOptions } from './ITerminalRunner-BVU7TfT3.js';
5
5
  import { I as IApproval, d as ApprovalRequest, a as ApprovalMode } from './ApprovalPolicy-BVhGdECT.js';
6
6
  export { A as ApprovalKind, b as ApprovalPolicy, c as ApprovalPolicyOptions, e as ApprovalSource, D as DENY_ALL } from './ApprovalPolicy-BVhGdECT.js';
7
7
  import { R as RunnerModeInfo } from './ModeResolver-Ob-ihQbI.js';
@@ -936,10 +936,11 @@ interface HeadlessRunnerDeps {
936
936
  }
937
937
  declare class HeadlessSession extends AbstractTerminalSession {
938
938
  private spawnImpl;
939
+ readonly interactive: boolean;
939
940
  private process;
940
941
  private outputBuffer;
941
942
  private controlStream;
942
- constructor(id: string, taskId: string, spawnImpl: SpawnFn);
943
+ constructor(id: string, taskId: string, spawnImpl: SpawnFn, interactive?: boolean);
943
944
  get isStarted(): boolean;
944
945
  start(launch: LaunchPlan, cwd: string, resolvedPath: string, env?: Record<string, string>, options?: {
945
946
  controlChannel?: boolean;
@@ -2868,6 +2869,14 @@ declare class VerdictEngine {
2868
2869
  private touchIdle;
2869
2870
  /** Tear down idle tracking for a task; broadcasts the null transition if it was idle. */
2870
2871
  private clearIdle;
2872
+ /**
2873
+ * Submit a synchronized resume token to the paused session. An interactive
2874
+ * TUI only accepts the Enter keystroke (`\r`) — a `\n` types the token into
2875
+ * its composer without sending it, leaving the agent paused until a human
2876
+ * presses Enter. A line-oriented piped session has no composer; it reads a
2877
+ * `\n`-terminated line, and the leading newline flushes a partial line.
2878
+ */
2879
+ private resumeToken;
2871
2880
  approveCheckpoint(taskId: string): void;
2872
2881
  rejectCheckpoint(taskId: string, reason: string): void;
2873
2882
  /**
@@ -3166,6 +3175,8 @@ declare class TmuxSession extends AbstractTerminalSession {
3166
3175
  private pollIntervalMs;
3167
3176
  private logPath;
3168
3177
  private socket;
3178
+ /** A tmux window is a real TTY running the agent's TUI, so it submits on Enter. */
3179
+ readonly interactive = true;
3169
3180
  private outputBuffer;
3170
3181
  private offset;
3171
3182
  private timer;
package/dist/index.js CHANGED
@@ -8114,19 +8114,29 @@ var VerdictEngine = class {
8114
8114
  for (const l of this.idleListeners) l(taskId, null);
8115
8115
  }
8116
8116
  }
8117
+ /**
8118
+ * Submit a synchronized resume token to the paused session. An interactive
8119
+ * TUI only accepts the Enter keystroke (`\r`) — a `\n` types the token into
8120
+ * its composer without sending it, leaving the agent paused until a human
8121
+ * presses Enter. A line-oriented piped session has no composer; it reads a
8122
+ * `\n`-terminated line, and the leading newline flushes a partial line.
8123
+ */
8124
+ resumeToken(session, line) {
8125
+ return session.interactive ? `${line}\r` : `
8126
+ ${line}
8127
+ `;
8128
+ }
8117
8129
  approveCheckpoint(taskId) {
8118
8130
  const session = this.pausedSessions.get(taskId);
8119
8131
  if (session) {
8120
- session.write("\nORDEWELL_CONTINUE\n");
8132
+ session.write(this.resumeToken(session, "ORDEWELL_CONTINUE"));
8121
8133
  this.pausedSessions.delete(taskId);
8122
8134
  }
8123
8135
  }
8124
8136
  rejectCheckpoint(taskId, reason) {
8125
8137
  const session = this.pausedSessions.get(taskId);
8126
8138
  if (session) {
8127
- session.write(`
8128
- ORDEWELL_REJECT: ${reason}
8129
- `);
8139
+ session.write(this.resumeToken(session, `ORDEWELL_REJECT: ${reason}`));
8130
8140
  this.pausedSessions.delete(taskId);
8131
8141
  }
8132
8142
  }
@@ -14633,11 +14643,13 @@ function defaultHasScriptCmd() {
14633
14643
  }
14634
14644
  }
14635
14645
  var HeadlessSession = class extends AbstractTerminalSession {
14636
- constructor(id, taskId, spawnImpl) {
14646
+ constructor(id, taskId, spawnImpl, interactive = false) {
14637
14647
  super(id, taskId);
14638
14648
  this.spawnImpl = spawnImpl;
14649
+ this.interactive = interactive;
14639
14650
  }
14640
14651
  spawnImpl;
14652
+ interactive;
14641
14653
  process = null;
14642
14654
  outputBuffer = "";
14643
14655
  controlStream = null;
@@ -14719,7 +14731,7 @@ var HeadlessRunner = class extends AbstractRunner {
14719
14731
  this.launchDeps = { resolvePath: this.resolvePath, ...deps.launchDeps };
14720
14732
  }
14721
14733
  createSession(id, taskId) {
14722
- return new HeadlessSession(id, taskId, this.spawnImpl);
14734
+ return new HeadlessSession(id, taskId, this.spawnImpl, this.defaultInteractive);
14723
14735
  }
14724
14736
  /** Everything up to, but not including, spawning — so a surface that owns its own child reaches the same decisions. */
14725
14737
  async prepareLaunch(opts, ptyOptions) {
@@ -14836,6 +14848,8 @@ var TmuxSession = class extends AbstractTerminalSession {
14836
14848
  pollIntervalMs;
14837
14849
  logPath;
14838
14850
  socket;
14851
+ /** A tmux window is a real TTY running the agent's TUI, so it submits on Enter. */
14852
+ interactive = true;
14839
14853
  outputBuffer = "";
14840
14854
  offset = 0;
14841
14855
  timer = null;