@ordewell/web 0.11.2 → 0.12.0

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/AUTHORS.md CHANGED
@@ -26,12 +26,14 @@ record of who built what, rather than `git log`.
26
26
  planner's duplicated usage-limit message (#79, #96).
27
27
  - [@haltingstate](https://github.com/haltingstate) — made the terminal UI's
28
28
  stepper say what a saved step does next, instead of encoding it in a
29
- sentinel index (#123).
29
+ sentinel index (#123), and improved tool-call errors (#124).
30
30
  - [@Logic769](https://github.com/Logic769) — made `/resume` an alias of
31
31
  `/sessions` in the planner chat (#139).
32
32
  - Hanbin Tan ([@hskl18](https://github.com/hskl18)) — documented how
33
33
  planners and runners get their models and credentials (#140).
34
34
 
35
+ - [@torialfaro](https://github.com/torialfaro) and [@aavykyy](https://github.com/aavykyy) — made VS Code task prompts keyboard accessible (#141).
36
+
35
37
  Thank you. Contributions are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md).
36
38
 
37
39
  ## Acknowledgements
package/README.md CHANGED
@@ -27,7 +27,9 @@ task, skip, mark complete, message) are one `POST /api/plans/:id/execute-command
27
27
  whose body is core's `ExecutionCommand`. Mark complete and Mark not done on an
28
28
  AI or script task are refused while a run could advance the task, and otherwise
29
29
  need `"confirmed": true`, the user's yes (with `"seen"`, the task status they
30
- were asked about); a manual task's sign-off needs neither.
30
+ were asked about); a manual task's sign-off needs neither. What waits on a
31
+ person (ADR-0053) is `GET /api/plans/:id/escalations`, and on every status
32
+ update; `POST /api/plans/:id/escalations/answer` answers one by its id.
31
33
 
32
34
  Skills are read by the planner and the task orchestrator, not served as a
33
35
  route; the format is in [Writing skills](https://github.com/ordewell/ordewell/blob/main/docs/skills.md).
@@ -166,14 +166,14 @@ function run(file, args2, opts) {
166
166
  signal: opts.signal
167
167
  }, (err, stdout, stderr) => {
168
168
  const code = err && typeof err.code === "number" ? err.code : err ? 1 : 0;
169
- resolve3({ stdout: stdout ?? "", stderr: stderr ?? "", code, timedOut: err?.killed === true });
169
+ resolve3({ stdout: stdout ?? "", stderr: stderr ?? "", code, timedOut: err?.killed === true, signal: err?.signal ?? null });
170
170
  });
171
171
  if (opts.sealed) child.once("exit", () => setTimeout(() => {
172
172
  child.stdout?.destroy();
173
173
  child.stderr?.destroy();
174
174
  }, SEALED_OUTPUT_GRACE_MS).unref());
175
175
  } catch (err) {
176
- resolve3({ stdout: "", stderr: err.message, code: null, timedOut: false });
176
+ resolve3({ stdout: "", stderr: err.message, code: null, timedOut: false, signal: null });
177
177
  }
178
178
  });
179
179
  }
@@ -338,7 +338,7 @@ var PoolFileSystem = class extends core.BaseFileSystem {
338
338
  if (result.code !== 0) {
339
339
  const detail = err || out || `exited with code ${result.code}`;
340
340
  return { success: false, output: `Command exited ${result.code}:
341
- ${detail.slice(0, 2e4)}`, truncated: detail.length > 2e4, ...result.timedOut ? { timedOut: true } : {} };
341
+ ${detail.slice(0, 2e4)}`, truncated: detail.length > 2e4, ...result.timedOut ? { timedOut: true } : {}, ...result.signal ? { signal: result.signal } : {} };
342
342
  }
343
343
  const combined = err ? `${out}
344
344
  [stderr]
@@ -611,6 +611,9 @@ var OrchestratorPool = class {
611
611
  plannerCompaction(sessionId) {
612
612
  return this.sessions.get(sessionId)?.plannerCompaction();
613
613
  }
614
+ plannerDetection(sessionId) {
615
+ return this.sessions.get(sessionId)?.plannerDetection();
616
+ }
614
617
  /** The planner's approval requests still waiting, as they were announced. */
615
618
  announcedApprovals(sessionId) {
616
619
  return this.sessions.get(sessionId)?.announcedApprovals() ?? [];
@@ -1386,6 +1389,24 @@ function plansRoute(pool2) {
1386
1389
  return failure(c, err, "execute-command");
1387
1390
  }
1388
1391
  });
1392
+ router.get("/:sessionId/escalations", (c) => {
1393
+ try {
1394
+ return c.json({ escalations: pool2.session(c.req.param("sessionId")).escalations() });
1395
+ } catch (err) {
1396
+ return failure(c, err, "escalations");
1397
+ }
1398
+ });
1399
+ router.post("/:sessionId/escalations/answer", async (c) => {
1400
+ try {
1401
+ const { id, option, note, confirmed } = await jsonObject(c);
1402
+ if (typeof id !== "string" || typeof option !== "string") return refuse(c, 400, "id and option are required", "refused");
1403
+ const outcome = await pool2.session(c.req.param("sessionId")).answerEscalation(id, option, typeof note === "string" ? note : void 0, confirmed === true);
1404
+ if (!outcome.ok) return c.json({ error: outcome.message, code: "refused", ...outcome.payload ? { payload: outcome.payload } : {} }, 400);
1405
+ return c.json({ ok: true, message: outcome.message, ...outcome.payload ? { payload: outcome.payload } : {} });
1406
+ } catch (err) {
1407
+ return failure(c, err, "escalations");
1408
+ }
1409
+ });
1389
1410
  router.post("/:sessionId/tasks/:taskId/commands", async (c) => {
1390
1411
  try {
1391
1412
  const body = await c.req.json().catch(() => ({}));
@@ -1426,6 +1447,14 @@ function plansRoute(pool2) {
1426
1447
  return failure(c, err, "task edit");
1427
1448
  }
1428
1449
  });
1450
+ router.get("/:sessionId/tasks/:taskId/revert-preview", async (c) => {
1451
+ try {
1452
+ const session = pool2.session(c.req.param("sessionId"));
1453
+ return c.json(await session.revertPreview(idOfRef(session, c.req.param("taskId"))));
1454
+ } catch (err) {
1455
+ return failure(c, err, "task edit");
1456
+ }
1457
+ });
1429
1458
  router.get("/:sessionId/isolation/diff", async (c) => {
1430
1459
  try {
1431
1460
  return c.json({ diff: await pool2.session(c.req.param("sessionId")).reviewRunDiff() });
@@ -1766,6 +1795,8 @@ function createWsHandler(pool2) {
1766
1795
  }
1767
1796
  const compaction = pool2.plannerCompaction(sessionId);
1768
1797
  if (compaction) ws.send(JSON.stringify(compaction));
1798
+ const detection = pool2.plannerDetection(sessionId);
1799
+ if (detection?.waiting) ws.send(JSON.stringify(detection));
1769
1800
  pool2.subscribe(sessionId, ws);
1770
1801
  });
1771
1802
  return (request, socket, head) => {