@ordewell/core 0.4.18 → 0.4.20
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/dist/{ITerminalRunner-E3-6QNUS.d.mts → ITerminalRunner-CuNYBnqK.d.mts} +18 -0
- package/dist/{ITerminalRunner-CbLHKXT5.d.ts → ITerminalRunner-Da1gIAFX.d.ts} +18 -0
- package/dist/index.d.mts +16 -3
- package/dist/index.d.ts +16 -3
- package/dist/index.js +32 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -9
- package/dist/index.mjs.map +1 -1
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6281,19 +6281,29 @@ var VerdictEngine = class {
|
|
|
6281
6281
|
for (const l of this.idleListeners) l(taskId, null);
|
|
6282
6282
|
}
|
|
6283
6283
|
}
|
|
6284
|
+
/**
|
|
6285
|
+
* Submit a synchronized resume token to the paused session. An interactive
|
|
6286
|
+
* TUI only accepts the Enter keystroke (`\r`) — a `\n` types the token into
|
|
6287
|
+
* its composer without sending it, leaving the agent paused until a human
|
|
6288
|
+
* presses Enter. A line-oriented piped session has no composer; it reads a
|
|
6289
|
+
* `\n`-terminated line, and the leading newline flushes a partial line.
|
|
6290
|
+
*/
|
|
6291
|
+
resumeToken(session, line) {
|
|
6292
|
+
return session.interactive ? `${line}\r` : `
|
|
6293
|
+
${line}
|
|
6294
|
+
`;
|
|
6295
|
+
}
|
|
6284
6296
|
approveCheckpoint(taskId) {
|
|
6285
6297
|
const session = this.pausedSessions.get(taskId);
|
|
6286
6298
|
if (session) {
|
|
6287
|
-
session.write("
|
|
6299
|
+
session.write(this.resumeToken(session, "ORDEWELL_CONTINUE"));
|
|
6288
6300
|
this.pausedSessions.delete(taskId);
|
|
6289
6301
|
}
|
|
6290
6302
|
}
|
|
6291
6303
|
rejectCheckpoint(taskId, reason) {
|
|
6292
6304
|
const session = this.pausedSessions.get(taskId);
|
|
6293
6305
|
if (session) {
|
|
6294
|
-
session.write(`
|
|
6295
|
-
ORDEWELL_REJECT: ${reason}
|
|
6296
|
-
`);
|
|
6306
|
+
session.write(this.resumeToken(session, `ORDEWELL_REJECT: ${reason}`));
|
|
6297
6307
|
this.pausedSessions.delete(taskId);
|
|
6298
6308
|
}
|
|
6299
6309
|
}
|
|
@@ -12443,7 +12453,8 @@ function resolveArgs(manifest, ctx) {
|
|
|
12443
12453
|
command: manifest.runner.command,
|
|
12444
12454
|
args,
|
|
12445
12455
|
env,
|
|
12446
|
-
promptInArgs: manifest.runner.promptInArgs
|
|
12456
|
+
promptInArgs: manifest.runner.promptInArgs,
|
|
12457
|
+
submitPromptKey: manifest.runner.submitPromptKey === true && isInteractive(ctx)
|
|
12447
12458
|
};
|
|
12448
12459
|
}
|
|
12449
12460
|
function parseBlockOpen(raw) {
|
|
@@ -12684,11 +12695,13 @@ function defaultHasScriptCmd() {
|
|
|
12684
12695
|
}
|
|
12685
12696
|
}
|
|
12686
12697
|
var HeadlessSession = class extends AbstractTerminalSession {
|
|
12687
|
-
constructor(id, taskId, spawnImpl) {
|
|
12698
|
+
constructor(id, taskId, spawnImpl, interactive = false) {
|
|
12688
12699
|
super(id, taskId);
|
|
12689
12700
|
this.spawnImpl = spawnImpl;
|
|
12701
|
+
this.interactive = interactive;
|
|
12690
12702
|
}
|
|
12691
12703
|
spawnImpl;
|
|
12704
|
+
interactive;
|
|
12692
12705
|
process = null;
|
|
12693
12706
|
outputBuffer = "";
|
|
12694
12707
|
controlStream = null;
|
|
@@ -12770,7 +12783,7 @@ var HeadlessRunner = class extends AbstractRunner {
|
|
|
12770
12783
|
this.launchDeps = { resolvePath: this.resolvePath, ...deps.launchDeps };
|
|
12771
12784
|
}
|
|
12772
12785
|
createSession(id, taskId) {
|
|
12773
|
-
return new HeadlessSession(id, taskId, this.spawnImpl);
|
|
12786
|
+
return new HeadlessSession(id, taskId, this.spawnImpl, this.defaultInteractive);
|
|
12774
12787
|
}
|
|
12775
12788
|
/** Everything up to, but not including, spawning — so a surface that owns its own child reaches the same decisions. */
|
|
12776
12789
|
async prepareLaunch(opts, ptyOptions) {
|
|
@@ -12795,7 +12808,8 @@ var HeadlessRunner = class extends AbstractRunner {
|
|
|
12795
12808
|
launch: await planDirectLaunch(command, args, this.launchDeps),
|
|
12796
12809
|
resolvedPath,
|
|
12797
12810
|
env: invocation.env,
|
|
12798
|
-
pty
|
|
12811
|
+
pty,
|
|
12812
|
+
submitPromptKey: invocation.submitPromptKey
|
|
12799
12813
|
};
|
|
12800
12814
|
}
|
|
12801
12815
|
async spawn(opts) {
|
|
@@ -12805,6 +12819,7 @@ var HeadlessRunner = class extends AbstractRunner {
|
|
|
12805
12819
|
const modeStr = opts.mode === "plan" ? "plan" : "build";
|
|
12806
12820
|
console.error(`[headless] Starting ${opts.runner} [${modeStr}] (${opts.modelId || "default"}) for task ${opts.taskId.slice(0, 8)}${prepared.pty ? " (PTY)" : ""}`);
|
|
12807
12821
|
session.start(prepared.launch, opts.cwd, prepared.resolvedPath, prepared.env);
|
|
12822
|
+
if (prepared.submitPromptKey) session.write("\r");
|
|
12808
12823
|
this.registerSession(id, session);
|
|
12809
12824
|
return session;
|
|
12810
12825
|
}
|
|
@@ -12887,6 +12902,8 @@ var TmuxSession = class extends AbstractTerminalSession {
|
|
|
12887
12902
|
pollIntervalMs;
|
|
12888
12903
|
logPath;
|
|
12889
12904
|
socket;
|
|
12905
|
+
/** A tmux window is a real TTY running the agent's TUI, so it submits on Enter. */
|
|
12906
|
+
interactive = true;
|
|
12890
12907
|
outputBuffer = "";
|
|
12891
12908
|
offset = 0;
|
|
12892
12909
|
timer = null;
|
|
@@ -13104,6 +13121,7 @@ var TmuxRunner = class extends AbstractRunner {
|
|
|
13104
13121
|
);
|
|
13105
13122
|
invocation.env = { ...invocation.env, PATH: await this.resolvePath() };
|
|
13106
13123
|
await session.start(invocation.command, invocation.args, opts.cwd, invocation.env);
|
|
13124
|
+
if (invocation.submitPromptKey) session.write("\r");
|
|
13107
13125
|
this.registerSession(id, session);
|
|
13108
13126
|
return session;
|
|
13109
13127
|
}
|
|
@@ -13572,7 +13590,12 @@ var OPENCODE_MANIFEST = {
|
|
|
13572
13590
|
OPENCODE_CONFIG_CONTENT: "{{if interactiveVariant}}{{opencodeVariantConfig}}{{/if}}"
|
|
13573
13591
|
},
|
|
13574
13592
|
promptInArgs: true,
|
|
13575
|
-
requiresTty: true
|
|
13593
|
+
requiresTty: true,
|
|
13594
|
+
// `--prompt` only pre-fills the TUI's composer; it does not submit it.
|
|
13595
|
+
// (`opencode run` — the headless subcommand — has no such gap: its
|
|
13596
|
+
// message is a positional arg that runs immediately.) An unattended
|
|
13597
|
+
// surface driving the TUI must press Enter itself.
|
|
13598
|
+
submitPromptKey: true
|
|
13576
13599
|
},
|
|
13577
13600
|
features: {
|
|
13578
13601
|
modelSelection: true,
|