@ordewell/web 0.13.2 → 0.13.3

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.
@@ -1297,7 +1297,7 @@ var OrchestratorPool = class {
1297
1297
  const recheck = this.recheckSignedOutPlanner(workspace, this.plannerConfig(modelOverride, workspace).aiProvider);
1298
1298
  if (recheck) await recheck;
1299
1299
  const session = this.openPlanningSession(sessionId, runners, workspace, modelOverride, options);
1300
- return this.firstTurn(sessionId, session, () => session.startPlanning(goal, runners));
1300
+ return this.firstTurn(sessionId, session, () => session.startPlanning(goal, runners, { surface: options?.surface }));
1301
1301
  }
1302
1302
  /**
1303
1303
  * Continue the planner dialogue with the user's reply: queued behind the
@@ -1306,11 +1306,11 @@ var OrchestratorPool = class {
1306
1306
  * session's own planner gate waits for the probe and judges the planner, as
1307
1307
  * it does for every turn.
1308
1308
  */
1309
- async continuePlanning(sessionId, message, workspace) {
1309
+ async continuePlanning(sessionId, message, workspace, surface) {
1310
1310
  const session = this.session(sessionId, workspace);
1311
1311
  const recheck = this.recheckSignedOutPlanner(session.workspaceRoot, session.plannerProvider);
1312
1312
  if (recheck) await recheck;
1313
- return session.continueConversation(message);
1313
+ return session.continueConversation(message, { surface });
1314
1314
  }
1315
1315
  /** Condense a session's conversation. The summary turn is a planner turn, so `cancelPlanning` stops it. */
1316
1316
  async compactConversation(sessionId, workspace) {
@@ -1326,11 +1326,11 @@ var OrchestratorPool = class {
1326
1326
  * waiting. The recheck is the one a reply does before the gate: a login done
1327
1327
  * with the runner's own command is seen here too.
1328
1328
  */
1329
- async forceSendPrompt(sessionId, message, workspace) {
1329
+ async forceSendPrompt(sessionId, message, workspace, surface) {
1330
1330
  const session = this.session(sessionId, workspace);
1331
1331
  const recheck = this.recheckSignedOutPlanner(session.workspaceRoot, session.plannerProvider);
1332
1332
  if (recheck) await recheck;
1333
- return session.forceSendPrompt(message);
1333
+ return session.forceSendPrompt(message, { surface });
1334
1334
  }
1335
1335
  /** Retry a compaction paused on the planner's context: a planner turn, and gated as one. */
1336
1336
  async retryPlannerCompaction(sessionId, workspace) {
@@ -1954,6 +1954,7 @@ function plansRoute(pool) {
1954
1954
  if (outcome.payload?.kind === "merge_hold") return refuse(c, 409, outcome.message, "merge_past_check");
1955
1955
  if (outcome.payload?.kind === "merge_beside_ops") return refuse(c, 409, outcome.message, "merge_beside_ops");
1956
1956
  if (!outcome.ok) throw new core.TaskControlError(outcome.message);
1957
+ if (!outcome.payload) return c.json({ outcome: "nothing", message: outcome.message });
1957
1958
  throw new Error("Merge all answered without its result.");
1958
1959
  } catch (err) {
1959
1960
  return failure(c, err, "task edit");
@@ -2036,11 +2037,11 @@ function plansRoute(pool) {
2036
2037
  });
2037
2038
  router.post("/:sessionId/converse/start", async (c) => {
2038
2039
  try {
2039
- const { goal, runners, workspace, model, allowInit } = await jsonObject(c);
2040
+ const { goal, runners, workspace, model, allowInit, surface } = await jsonObject(c);
2040
2041
  if (!goal) return c.json({ error: "goal is required" }, 400);
2041
2042
  const ws = workspace || c.req.query("workspace") || process.cwd();
2042
2043
  const runnerList = Array.isArray(runners) ? runners : runners ? [runners] : void 0;
2043
- const plan = await pool.startPlanning(c.req.param("sessionId"), goal, runnerList, ws, model, { allowInit });
2044
+ const plan = await pool.startPlanning(c.req.param("sessionId"), goal, runnerList, ws, model, { allowInit, surface: core.clientSurface(surface) });
2044
2045
  return c.json({ plan: core.surfacePlan(plan) });
2045
2046
  } catch (err) {
2046
2047
  return failure(c, err, "converse start", { message: "Planning failed" });
@@ -2048,9 +2049,9 @@ function plansRoute(pool) {
2048
2049
  });
2049
2050
  router.post("/:sessionId/converse/message", async (c) => {
2050
2051
  try {
2051
- const { message } = await jsonObject(c);
2052
+ const { message, surface } = await jsonObject(c);
2052
2053
  if (!message) return c.json({ error: "message is required" }, 400);
2053
- const plan = await pool.continuePlanning(c.req.param("sessionId"), message, callerWorkspace(c));
2054
+ const plan = await pool.continuePlanning(c.req.param("sessionId"), message, callerWorkspace(c), core.clientSurface(surface));
2054
2055
  return c.json({ plan: core.surfacePlan(plan) });
2055
2056
  } catch (err) {
2056
2057
  return failure(c, err, "conversation message");
@@ -2058,9 +2059,9 @@ function plansRoute(pool) {
2058
2059
  });
2059
2060
  router.post("/:sessionId/converse/message/now", async (c) => {
2060
2061
  try {
2061
- const { message } = await jsonObject(c);
2062
+ const { message, surface } = await jsonObject(c);
2062
2063
  if (!message) return c.json({ error: "message is required" }, 400);
2063
- const plan = await pool.forceSendPrompt(c.req.param("sessionId"), message, callerWorkspace(c));
2064
+ const plan = await pool.forceSendPrompt(c.req.param("sessionId"), message, callerWorkspace(c), core.clientSurface(surface));
2064
2065
  return c.json({ plan: core.surfacePlan(plan) });
2065
2066
  } catch (err) {
2066
2067
  return failure(c, err, "conversation message");
@@ -2906,9 +2907,11 @@ function runDaemon(args) {
2906
2907
  app.get("/", (c) => c.json({ message: "Ordewell API", docs: "/api/workspaces" }));
2907
2908
  server.on("request", createRequestListener(app, admission));
2908
2909
  attachWsHandler(server, pool, admission);
2909
- pool.getProviderModels().catch((err) => {
2910
- console.error(`[web] model discovery warmup failed: ${err?.message ?? err}`);
2911
- });
2910
+ if (!args.includes("--desktop-app")) {
2911
+ pool.getProviderModels().catch((err) => {
2912
+ console.error(`[web] model discovery warmup failed: ${err?.message ?? err}`);
2913
+ });
2914
+ }
2912
2915
  console.error(`[web] Ordewell API server: http://localhost:${port}`);
2913
2916
  });
2914
2917
  function shutdown() {