@ordewell/web 0.15.6 → 0.15.7

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.
@@ -615,6 +615,12 @@ var SessionOpenElsewhereError = class extends Error {
615
615
  this.name = "SessionOpenElsewhereError";
616
616
  }
617
617
  };
618
+ var SessionExistsError = class extends Error {
619
+ constructor(sessionId) {
620
+ super(`Session "${sessionId}" is saved already. Open it to continue it.`);
621
+ this.name = "SessionExistsError";
622
+ }
623
+ };
618
624
  var OrchestratorPool = class {
619
625
  // A daemon serves several workspaces; login selection must never follow
620
626
  // whichever session was opened most recently (ADR-0051).
@@ -1587,6 +1593,7 @@ var OrchestratorPool = class {
1587
1593
  * assistant message lives in conversationHistory).
1588
1594
  */
1589
1595
  async startPlanning(sessionId, goal, runners, workspace, modelOverride, options) {
1596
+ if (!this.live(sessionId, workspace) && core.hasSavedSession(sessionId, workspace)) throw new SessionExistsError(sessionId);
1590
1597
  const opening = this.openPlanningSession(sessionId, runners, workspace, modelOverride);
1591
1598
  const session = opening instanceof Promise ? await opening : opening;
1592
1599
  return this.firstTurn(sessionId, session, () => session.startPlanning(goal, runners, options));
@@ -1865,6 +1872,7 @@ function classify(err) {
1865
1872
  if (err instanceof ChildNotFoundError) return { status: 404, code: "child_not_found" };
1866
1873
  if (err instanceof core.SessionHeldError) return { status: 409, code: "session_held" };
1867
1874
  if (err instanceof SessionOpenElsewhereError) return { status: 409, code: "refused" };
1875
+ if (err instanceof SessionExistsError) return { status: 409, code: "session_exists" };
1868
1876
  if (err instanceof core.RunnerAccountError) return { status: err.status, code: err.status === 404 ? "account_not_found" : "refused" };
1869
1877
  if (err instanceof core.NoPlanError) return { status: 400, code: "no_plan" };
1870
1878
  if (err instanceof core.AlreadyExecutingError) return { status: 409, code: "already_executing" };