@ordewell/web 0.15.4 → 0.15.5

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.
@@ -1570,7 +1570,27 @@ var OrchestratorPool = class {
1570
1570
  async startPlanning(sessionId, goal, runners, workspace, modelOverride, options) {
1571
1571
  const opening = this.openPlanningSession(sessionId, runners, workspace, modelOverride);
1572
1572
  const session = opening instanceof Promise ? await opening : opening;
1573
- return this.firstTurn(sessionId, session, () => session.startPlanning(goal, runners, { surface: options?.surface }));
1573
+ return this.firstTurn(sessionId, session, () => session.startPlanning(goal, runners, options));
1574
+ }
1575
+ /**
1576
+ * Planning nobody watches (ADR-0083): resolved once the goal is admitted,
1577
+ * past the planner and runner refusals, while its first turn runs on asking
1578
+ * nobody. How the turn ends is the session's to keep, as an opening that
1579
+ * fails keeps its failure in the transcript, so nothing here waits for it.
1580
+ * Worded for the command line: the person runs the plan with `ordewell run`.
1581
+ */
1582
+ async startUnattendedPlanning(sessionId, goal, runners, workspace) {
1583
+ let admitted = () => void 0;
1584
+ const opened = new Promise((resolve3) => {
1585
+ admitted = resolve3;
1586
+ });
1587
+ const planning = this.startPlanning(sessionId, goal, runners, workspace, void 0, { surface: "cli", unattended: true, admitted });
1588
+ planning.catch(() => void 0);
1589
+ await Promise.race([opened, planning.then(() => void 0)]);
1590
+ }
1591
+ /** The workspaces of the sessions this daemon holds. */
1592
+ workspacesHeld() {
1593
+ return [...new Set(this.sessionWorkspaces.values())];
1574
1594
  }
1575
1595
  /**
1576
1596
  * Continue the planner dialogue with the user's reply: queued behind the
@@ -2137,6 +2157,21 @@ function plansRoute(pool) {
2137
2157
  return failure(c, err, "generate", { message: "Plan generation failed" });
2138
2158
  }
2139
2159
  });
2160
+ router.post("/:sessionId/start", async (c) => {
2161
+ try {
2162
+ const { goal, runners, workspace, ancestry } = await jsonObject(c);
2163
+ if (typeof goal !== "string" || !goal.trim()) return c.json({ error: "goal is required" }, 400);
2164
+ const ws = typeof workspace === "string" && workspace || c.req.query("workspace") || process.cwd();
2165
+ const runnerList = Array.isArray(runners) && runners.every((r) => typeof r === "string") ? runners : void 0;
2166
+ const groups = core.liveRunnerGroups([ws, ...pool.workspacesHeld(), ...scanWorkspaces2()]);
2167
+ if (core.callerInRunnerGroup(core.parseCallerAncestry(ancestry), groups)) return refuse(c, 403, core.RUNNER_PLAN_REFUSAL, "refused");
2168
+ const sessionId = c.req.param("sessionId");
2169
+ await pool.startUnattendedPlanning(sessionId, goal, runnerList, ws);
2170
+ return c.json({ sessionId });
2171
+ } catch (err) {
2172
+ return failure(c, err, "start planning", { message: "Planning failed" });
2173
+ }
2174
+ });
2140
2175
  router.post("/:sessionId/execute", async (c) => {
2141
2176
  try {
2142
2177
  const session = pool.session(c.req.param("sessionId"), callerWorkspace(c));