@ouro.bot/cli 0.1.0-alpha.1598 → 0.1.0-alpha.1599

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/changelog.json CHANGED
@@ -1,6 +1,13 @@
1
1
  {
2
2
  "_note": "Each pull request writes its own change note under changes/; the release job on main gives each landed change its version and adds the notes here (scripts/release-version.cjs). On main this file stops at the last version set by hand; the published package has every release. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.1599",
6
+ "changes": [
7
+ "`coding_spawn` on Orca now checks that the coding agent actually took its task. It no longer trusts Orca's \"handed to terminal\" receipt, which only means the keystrokes were sent. If no agent shows up in the tab within 90 seconds, Ouro closes the tab and launches once more in the same worktree. If that also fails, the spawn fails and says what the terminal showed, for example `zsh: command not found: laude`.",
8
+ "When the agent opens but stops at a question before taking its task, such as Codex's \"Hooks need review\" or a folder-trust prompt, Ouro no longer reports it as working. The session is marked as waiting for input, its tab stays open, and its checkpoint shows the question and says a person has to answer it there. Ouro does not answer trust questions itself. Once someone answers, the agent takes the task and the session goes back to running."
9
+ ]
10
+ },
4
11
  {
5
12
  "version": "0.1.0-alpha.1598",
6
13
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1598",
2
+ "runtimeVersion": "0.1.0-alpha.1599",
3
3
  "bundleSchemaVersion": 3,
4
4
  "lastUpdated": "2026-09-03T00:00:00.000Z"
5
5
  }
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0"?>
2
2
  <Container version="2">
3
3
  <Name>ouro-butler</Name>
4
- <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1598</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1599</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -45,6 +45,10 @@ const orca_client_1 = require("./orca-client");
45
45
  const spawner_1 = require("./spawner");
46
46
  /** Refreshes in a row that must miss a session's terminal before it counts as gone; one miss may be Orca restarting or asleep. */
47
47
  exports.ORCA_MISSES_BEFORE_GONE = 3;
48
+ /** Whitespace-collapsed, so a task line the agent's screen wrapped or padded still matches. */
49
+ function squash(text) {
50
+ return text.replace(/\s+/g, " ").trim();
51
+ }
48
52
  /** A session is closed once its Orca terminal is gone (killed, failed, or closed after it finished). */
49
53
  function isClosed(session) {
50
54
  return session.endedAt !== null;
@@ -95,6 +99,10 @@ class OrcaCodingSessionManager {
95
99
  writeFileSync;
96
100
  mkdirSync;
97
101
  pollIntervalMs;
102
+ launchStartTimeoutMs;
103
+ launchStartPollMs;
104
+ sleep;
105
+ nowMs;
98
106
  onUpdate;
99
107
  pollTimer = null;
100
108
  polling = false;
@@ -109,6 +117,10 @@ class OrcaCodingSessionManager {
109
117
  this.writeFileSync = options.writeFileSync ?? fs.writeFileSync;
110
118
  this.mkdirSync = options.mkdirSync ?? fs.mkdirSync;
111
119
  this.pollIntervalMs = options.pollIntervalMs ?? 30_000;
120
+ this.launchStartTimeoutMs = options.launchStartTimeoutMs ?? 90_000;
121
+ this.launchStartPollMs = options.launchStartPollMs ?? 2_000;
122
+ this.sleep = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
123
+ this.nowMs = options.nowMs ?? Date.now;
112
124
  this.onUpdate = options.onUpdate;
113
125
  this.loadState();
114
126
  this.syncPolling();
@@ -128,7 +140,7 @@ class OrcaCodingSessionManager {
128
140
  // so parallel jobs never collide.
129
141
  const existing = await this.cli.showWorktree(normalized.workdir);
130
142
  const inExisting = existing !== null && !existing.isMainWorktree;
131
- const launch = inExisting
143
+ let launch = inExisting
132
144
  ? await this.cli.launchAgent({ worktree: existing, agent: normalized.runner, prompt })
133
145
  : await this.cli.createWorktreeWithAgent({
134
146
  repoDir: normalized.workdir,
@@ -137,17 +149,39 @@ class OrcaCodingSessionManager {
137
149
  agent: normalized.runner,
138
150
  prompt,
139
151
  });
140
- if (launch.promptDelivered === false) {
152
+ // Orca's "handed-to-terminal" means bytes reached the PTY, not that the agent ran: a shell still in its
153
+ // rc files can eat them (2026-11-24, `laude`). The agent showing up in its pane is the proof; one relaunch
154
+ // in the same worktree covers a lost launch line.
155
+ let check = await this.checkLaunch(launch, prompt);
156
+ if (!check.started && !check.askedFirst) {
141
157
  await this.cli.closeTerminal(launch.terminalHandle).catch(() => undefined);
142
- throw new Error(`Orca opened ${normalized.runner} in ${launch.worktree.path} but did not deliver its task prompt, so its tab was closed; the worktree stays. Spawn again with workdir ${launch.worktree.path}`);
158
+ (0, runtime_1.emitNervesEvent)({
159
+ level: "warn",
160
+ component: "repertoire",
161
+ event: "repertoire.orca_agent_launch_retried",
162
+ message: "Orca launched no agent; relaunching once in the same worktree",
163
+ meta: { id, runner: normalized.runner, worktreePath: launch.worktree.path, screen: clip(check.screen) },
164
+ });
165
+ launch = await this.cli.launchAgent({ worktree: launch.worktree, agent: normalized.runner, prompt });
166
+ check = await this.checkLaunch(launch, prompt);
143
167
  }
144
- let paneKey;
145
- try {
146
- const terminal = (await this.cli.listTerminals(launch.worktree.id)).find((item) => item.handle === launch.terminalHandle);
147
- paneKey = terminal?.tabId && terminal.leafId ? `${terminal.tabId}:${terminal.leafId}` : undefined;
168
+ if (!check.started && !check.askedFirst) {
169
+ await this.cli.closeTerminal(launch.terminalHandle).catch(() => undefined);
170
+ throw new Error(`Orca opened ${normalized.runner} in ${launch.worktree.path} twice but the agent never started, so its tabs were closed; the worktree stays. Its terminal showed: ${clip(check.screen) || "(nothing)"}. Spawn again with workdir ${launch.worktree.path}`);
148
171
  }
149
- catch (error) {
150
- this.reportOrcaUnreachable(id, error);
172
+ // An agent asking before it takes its task is not relaunched: a new tab would ask the same thing. Answering
173
+ // trust questions widens what runs on this machine, so that stays a person's call; once it is answered the
174
+ // agent takes the task Orca queued, and refresh sees it go to work.
175
+ const paneKey = check.paneKey;
176
+ const askedFirst = !check.started ? clip(check.screen) : null;
177
+ if (askedFirst !== null) {
178
+ (0, runtime_1.emitNervesEvent)({
179
+ level: "warn",
180
+ component: "repertoire",
181
+ event: "repertoire.orca_agent_asked_first",
182
+ message: "Orca agent is asking a question before taking its task",
183
+ meta: { id, runner: normalized.runner, worktreePath: launch.worktree.path, screen: askedFirst },
184
+ });
151
185
  }
152
186
  const session = {
153
187
  id,
@@ -168,10 +202,10 @@ class OrcaCodingSessionManager {
168
202
  evolutionCaseId: normalized.evolutionCaseId,
169
203
  scopeFile: normalized.scopeFile,
170
204
  stateFile: normalized.stateFile,
171
- checkpoint: launch.promptDelivered === null
172
- ? "Orca did not confirm the task prompt arrived; read coding_tail to check"
173
- : launch.detail,
174
- status: "running",
205
+ checkpoint: askedFirst === null
206
+ ? launch.detail
207
+ : `${normalized.runner} is asking a question before it takes its task; a person has to answer it in its Orca tab. Its terminal showed: ${askedFirst}`,
208
+ status: askedFirst === null ? "running" : "waiting_input",
175
209
  stdoutTail: "",
176
210
  stderrTail: "",
177
211
  pid: null,
@@ -366,6 +400,46 @@ class OrcaCodingSessionManager {
366
400
  this.notify(session.id, { kind: updateKindFor(session.status), session: cloneSession(session) });
367
401
  }
368
402
  }
403
+ /**
404
+ * Waits for the launched agent to take its task: at work or done, replied, or waiting with the task on screen.
405
+ * Orca's own prompt receipt only rules a launch out.
406
+ */
407
+ async checkLaunch(launch, prompt) {
408
+ const readScreen = () => this.cli.readTerminal(launch.terminalHandle, 20).then((read) => read.tail, () => "");
409
+ // buildCodingPrompt's first line is the same for every task, so it marks the task arriving, not which task.
410
+ const taskLine = squash(prompt.trimStart().split("\n")[0]);
411
+ let waiting = null;
412
+ if (launch.promptDelivered !== false) {
413
+ const deadline = this.nowMs() + this.launchStartTimeoutMs;
414
+ for (;;) {
415
+ try {
416
+ const terminal = (await this.cli.listTerminals(launch.worktree.id)).find((item) => item.handle === launch.terminalHandle);
417
+ const paneKey = terminal?.tabId && terminal.leafId ? `${terminal.tabId}:${terminal.leafId}` : undefined;
418
+ const agent = paneKey ? (await this.cli.listAgents(launch.worktree.id)).find((item) => item.paneKey === paneKey) : undefined;
419
+ if (paneKey && agent) {
420
+ if ((agent.state !== "waiting" && agent.state !== "blocked") || agent.lastAssistantMessage)
421
+ return { started: true, paneKey };
422
+ const screen = await readScreen();
423
+ if (squash(screen).includes(taskLine))
424
+ return { started: true, paneKey };
425
+ waiting = { paneKey, screen };
426
+ }
427
+ else {
428
+ waiting = null;
429
+ }
430
+ }
431
+ catch {
432
+ // Orca busy or restarting: keep looking until the deadline.
433
+ }
434
+ if (this.nowMs() >= deadline)
435
+ break;
436
+ await this.sleep(this.launchStartPollMs);
437
+ }
438
+ }
439
+ if (waiting)
440
+ return { started: false, askedFirst: true, ...waiting };
441
+ return { started: false, screen: await readScreen() };
442
+ }
369
443
  reportOrcaUnreachable(sessionId, error) {
370
444
  (0, runtime_1.emitNervesEvent)({
371
445
  level: "warn",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1598",
3
+ "version": "0.1.0-alpha.1599",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@ouro.bot/cli",
9
- "version": "0.1.0-alpha.1598",
9
+ "version": "0.1.0-alpha.1599",
10
10
  "bundleDependencies": [
11
11
  "@ouro.bot/friends"
12
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1598",
3
+ "version": "0.1.0-alpha.1599",
4
4
  "description": "Ouroboros, the agent harness: agents with durable memory that live where you talk (terminal, Teams, iMessage, mail, voice) and use real tools. Start with npx ouro.bot@latest.",
5
5
  "homepage": "https://ouroboros.bot/",
6
6
  "engines": {