@dendelion/paper-camp 0.23.1 → 0.23.2

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.
Files changed (27) hide show
  1. package/dist/app/assets/{index-DoH_Ktpt.js → index-BHPCJror.js} +2 -2
  2. package/dist/app/assets/{index-DoH_Ktpt.js.map → index-BHPCJror.js.map} +1 -1
  3. package/dist/app/assets/{index-CTHTRX-O.js → index-DG2ri3IF.js} +2 -2
  4. package/dist/app/assets/{index-CTHTRX-O.js.map → index-DG2ri3IF.js.map} +1 -1
  5. package/dist/app/assets/{index-CKO_a_mt.js → index-D_2SBGCS.js} +2 -2
  6. package/dist/app/assets/{index-CKO_a_mt.js.map → index-D_2SBGCS.js.map} +1 -1
  7. package/dist/app/assets/{index-CeEpQji6.js → index-DePKcR5b.js} +2 -2
  8. package/dist/app/assets/{index-CeEpQji6.js.map → index-DePKcR5b.js.map} +1 -1
  9. package/dist/app/assets/{index-DC_F8eQU.js → index-Do4T60UL.js} +2 -2
  10. package/dist/app/assets/{index-DC_F8eQU.js.map → index-Do4T60UL.js.map} +1 -1
  11. package/dist/app/assets/{index-Twqzhu_o.js → index-DxehIB14.js} +2 -2
  12. package/dist/app/assets/{index-Twqzhu_o.js.map → index-DxehIB14.js.map} +1 -1
  13. package/dist/app/assets/{index-CFMhKXQf.js → index-SD_x9Z5F.js} +2 -2
  14. package/dist/app/assets/{index-CFMhKXQf.js.map → index-SD_x9Z5F.js.map} +1 -1
  15. package/dist/app/assets/{index-B0T4zOOc.js → index-mmzETz6G.js} +2 -2
  16. package/dist/app/assets/{index-B0T4zOOc.js.map → index-mmzETz6G.js.map} +1 -1
  17. package/dist/app/assets/{main-CDkrPxrg.js → main-DiplEwD3.js} +120 -120
  18. package/dist/app/assets/main-DiplEwD3.js.map +1 -0
  19. package/dist/app/assets/main-DoJre3S-.css +1 -0
  20. package/dist/app/assets/{sidebar-section-7T-4hlR4.js → sidebar-section-RSOrdZKe.js} +2 -2
  21. package/dist/app/assets/{sidebar-section-7T-4hlR4.js.map → sidebar-section-RSOrdZKe.js.map} +1 -1
  22. package/dist/app/index.html +2 -2
  23. package/dist/cli/index.js +234 -236
  24. package/dist/cli/index.js.map +1 -1
  25. package/package.json +1 -1
  26. package/dist/app/assets/main-BAlJ6w7u.css +0 -1
  27. package/dist/app/assets/main-CDkrPxrg.js.map +0 -1
package/dist/cli/index.js CHANGED
@@ -4473,7 +4473,7 @@ const zl = /* @__PURE__ */ N("$ZodObject", (e, t) => {
4473
4473
  g[P] = `key_${p++}`;
4474
4474
  h.write("const newResult = {};");
4475
4475
  for (const P of y.keys) {
4476
- const I = g[P], D = Iu(P), ue = f[P], Ne = ((b = ue == null ? void 0 : ue._zod) == null ? void 0 : b.optin) === "optional", Ee = (($ = ue == null ? void 0 : ue._zod) == null ? void 0 : $.optout) === "optional";
4476
+ const I = g[P], D = Iu(P), de = f[P], Ne = ((b = de == null ? void 0 : de._zod) == null ? void 0 : b.optin) === "optional", Ee = (($ = de == null ? void 0 : de._zod) == null ? void 0 : $.optout) === "optional";
4477
4477
  h.write(`const ${I} = ${w(P)};`), Ne && Ee ? h.write(`
4478
4478
  if (${I}.issues.length) {
4479
4479
  if (${D} in input) {
@@ -6931,10 +6931,10 @@ const C0 = G({
6931
6931
  id: Ha,
6932
6932
  result: xt
6933
6933
  }).strict(), Bs = (e) => Co.safeParse(e).success;
6934
- var fe;
6934
+ var he;
6935
6935
  (function(e) {
6936
6936
  e[e.ConnectionClosed = -32e3] = "ConnectionClosed", e[e.RequestTimeout = -32001] = "RequestTimeout", e[e.ParseError = -32700] = "ParseError", e[e.InvalidRequest = -32600] = "InvalidRequest", e[e.MethodNotFound = -32601] = "MethodNotFound", e[e.InvalidParams = -32602] = "InvalidParams", e[e.InternalError = -32603] = "InternalError", e[e.UrlElicitationRequired = -32042] = "UrlElicitationRequired";
6937
- })(fe || (fe = {}));
6937
+ })(he || (he = {}));
6938
6938
  const jo = G({
6939
6939
  jsonrpc: oe(Ua),
6940
6940
  id: Ha.optional(),
@@ -8203,7 +8203,7 @@ class ie extends Error {
8203
8203
  * Factory method to create the appropriate error type based on the error code and data
8204
8204
  */
8205
8205
  static fromError(t, n, r) {
8206
- if (t === fe.UrlElicitationRequired && r) {
8206
+ if (t === he.UrlElicitationRequired && r) {
8207
8207
  const s = r;
8208
8208
  if (s.elicitations)
8209
8209
  return new h$(s.elicitations, n);
@@ -8213,7 +8213,7 @@ class ie extends Error {
8213
8213
  }
8214
8214
  class h$ extends ie {
8215
8215
  constructor(t, n = `URL elicitation${t.length > 1 ? "s" : ""} required`) {
8216
- super(fe.UrlElicitationRequired, n, {
8216
+ super(he.UrlElicitationRequired, n, {
8217
8217
  elicitations: t
8218
8218
  });
8219
8219
  }
@@ -9200,7 +9200,7 @@ class ek {
9200
9200
  ), this._taskStore = t == null ? void 0 : t.taskStore, this._taskMessageQueue = t == null ? void 0 : t.taskMessageQueue, this._taskStore && (this.setRequestHandler(Zo, async (n, r) => {
9201
9201
  const s = await this._taskStore.getTask(n.params.taskId, r.sessionId);
9202
9202
  if (!s)
9203
- throw new ie(fe.InvalidParams, "Failed to retrieve task: Task not found");
9203
+ throw new ie(he.InvalidParams, "Failed to retrieve task: Task not found");
9204
9204
  return {
9205
9205
  ...s
9206
9206
  };
@@ -9231,7 +9231,7 @@ class ek {
9231
9231
  }
9232
9232
  const i = await this._taskStore.getTask(a, r.sessionId);
9233
9233
  if (!i)
9234
- throw new ie(fe.InvalidParams, `Task not found: ${a}`);
9234
+ throw new ie(he.InvalidParams, `Task not found: ${a}`);
9235
9235
  if (!cr(i.status))
9236
9236
  return await this._waitForTaskUpdate(a, r.signal), await s();
9237
9237
  if (cr(i.status)) {
@@ -9259,25 +9259,25 @@ class ek {
9259
9259
  _meta: {}
9260
9260
  };
9261
9261
  } catch (a) {
9262
- throw new ie(fe.InvalidParams, `Failed to list tasks: ${a instanceof Error ? a.message : String(a)}`);
9262
+ throw new ie(he.InvalidParams, `Failed to list tasks: ${a instanceof Error ? a.message : String(a)}`);
9263
9263
  }
9264
9264
  }), this.setRequestHandler(Vo, async (n, r) => {
9265
9265
  try {
9266
9266
  const s = await this._taskStore.getTask(n.params.taskId, r.sessionId);
9267
9267
  if (!s)
9268
- throw new ie(fe.InvalidParams, `Task not found: ${n.params.taskId}`);
9268
+ throw new ie(he.InvalidParams, `Task not found: ${n.params.taskId}`);
9269
9269
  if (cr(s.status))
9270
- throw new ie(fe.InvalidParams, `Cannot cancel task in terminal status: ${s.status}`);
9270
+ throw new ie(he.InvalidParams, `Cannot cancel task in terminal status: ${s.status}`);
9271
9271
  await this._taskStore.updateTaskStatus(n.params.taskId, "cancelled", "Client cancelled task execution.", r.sessionId), this._clearTaskQueue(n.params.taskId);
9272
9272
  const a = await this._taskStore.getTask(n.params.taskId, r.sessionId);
9273
9273
  if (!a)
9274
- throw new ie(fe.InvalidParams, `Task not found after cancellation: ${n.params.taskId}`);
9274
+ throw new ie(he.InvalidParams, `Task not found after cancellation: ${n.params.taskId}`);
9275
9275
  return {
9276
9276
  _meta: {},
9277
9277
  ...a
9278
9278
  };
9279
9279
  } catch (s) {
9280
- throw s instanceof ie ? s : new ie(fe.InvalidRequest, `Failed to cancel task: ${s instanceof Error ? s.message : String(s)}`);
9280
+ throw s instanceof ie ? s : new ie(he.InvalidRequest, `Failed to cancel task: ${s instanceof Error ? s.message : String(s)}`);
9281
9281
  }
9282
9282
  }));
9283
9283
  }
@@ -9303,7 +9303,7 @@ class ek {
9303
9303
  return !1;
9304
9304
  const r = Date.now() - n.startTime;
9305
9305
  if (n.maxTotalTimeout && r >= n.maxTotalTimeout)
9306
- throw this._timeoutInfo.delete(t), ie.fromError(fe.RequestTimeout, "Maximum total timeout exceeded", {
9306
+ throw this._timeoutInfo.delete(t), ie.fromError(he.RequestTimeout, "Maximum total timeout exceeded", {
9307
9307
  maxTotalTimeout: n.maxTotalTimeout,
9308
9308
  totalElapsed: r
9309
9309
  });
@@ -9346,7 +9346,7 @@ class ek {
9346
9346
  for (const s of this._requestHandlerAbortControllers.values())
9347
9347
  s.abort();
9348
9348
  this._requestHandlerAbortControllers.clear();
9349
- const n = ie.fromError(fe.ConnectionClosed, "Connection closed");
9349
+ const n = ie.fromError(he.ConnectionClosed, "Connection closed");
9350
9350
  this._transport = void 0, (r = this.onclose) == null || r.call(this);
9351
9351
  for (const s of t.values())
9352
9352
  s(n);
@@ -9367,7 +9367,7 @@ class ek {
9367
9367
  jsonrpc: "2.0",
9368
9368
  id: t.id,
9369
9369
  error: {
9370
- code: fe.MethodNotFound,
9370
+ code: he.MethodNotFound,
9371
9371
  message: "Method not found"
9372
9372
  }
9373
9373
  };
@@ -9393,7 +9393,7 @@ class ek {
9393
9393
  sendRequest: async (y, w, g) => {
9394
9394
  var b;
9395
9395
  if (i.signal.aborted)
9396
- throw new ie(fe.ConnectionClosed, "Request was cancelled");
9396
+ throw new ie(he.ConnectionClosed, "Request was cancelled");
9397
9397
  const p = { ...g, relatedRequestId: t.id };
9398
9398
  a && !p.relatedTask && (p.relatedTask = { taskId: a });
9399
9399
  const v = ((b = p.relatedTask) == null ? void 0 : b.taskId) ?? a;
@@ -9430,7 +9430,7 @@ class ek {
9430
9430
  jsonrpc: "2.0",
9431
9431
  id: t.id,
9432
9432
  error: {
9433
- code: Number.isSafeInteger(y.code) ? y.code : fe.InternalError,
9433
+ code: Number.isSafeInteger(y.code) ? y.code : he.InternalError,
9434
9434
  message: y.message ?? "Internal error",
9435
9435
  ...y.data !== void 0 && { data: y.data }
9436
9436
  }
@@ -9538,7 +9538,7 @@ class ek {
9538
9538
  } catch (c) {
9539
9539
  yield {
9540
9540
  type: "error",
9541
- error: c instanceof ie ? c : new ie(fe.InternalError, String(c))
9541
+ error: c instanceof ie ? c : new ie(he.InternalError, String(c))
9542
9542
  };
9543
9543
  }
9544
9544
  return;
@@ -9549,16 +9549,16 @@ class ek {
9549
9549
  if (c.task)
9550
9550
  a = c.task.taskId, yield { type: "taskCreated", task: c.task };
9551
9551
  else
9552
- throw new ie(fe.InternalError, "Task creation did not return a task");
9552
+ throw new ie(he.InternalError, "Task creation did not return a task");
9553
9553
  for (; ; ) {
9554
9554
  const u = await this.getTask({ taskId: a }, r);
9555
9555
  if (yield { type: "taskStatus", task: u }, cr(u.status)) {
9556
9556
  u.status === "completed" ? yield { type: "result", result: await this.getTaskResult({ taskId: a }, n, r) } : u.status === "failed" ? yield {
9557
9557
  type: "error",
9558
- error: new ie(fe.InternalError, `Task ${a} failed`)
9558
+ error: new ie(he.InternalError, `Task ${a} failed`)
9559
9559
  } : u.status === "cancelled" && (yield {
9560
9560
  type: "error",
9561
- error: new ie(fe.InternalError, `Task ${a} was cancelled`)
9561
+ error: new ie(he.InternalError, `Task ${a} was cancelled`)
9562
9562
  });
9563
9563
  return;
9564
9564
  }
@@ -9572,7 +9572,7 @@ class ek {
9572
9572
  } catch (c) {
9573
9573
  yield {
9574
9574
  type: "error",
9575
- error: c instanceof ie ? c : new ie(fe.InternalError, String(c))
9575
+ error: c instanceof ie ? c : new ie(he.InternalError, String(c))
9576
9576
  };
9577
9577
  }
9578
9578
  }
@@ -9631,12 +9631,12 @@ class ek {
9631
9631
  reason: String(D)
9632
9632
  }
9633
9633
  }, { relatedRequestId: s, resumptionToken: a, onresumptiontoken: i }).catch((Ee) => this._onerror(new Error(`Failed to send cancellation: ${Ee}`)));
9634
- const ue = D instanceof ie ? D : new ie(fe.RequestTimeout, String(D));
9635
- d(ue);
9634
+ const de = D instanceof ie ? D : new ie(he.RequestTimeout, String(D));
9635
+ d(de);
9636
9636
  };
9637
9637
  this._responseHandlers.set(f, (D) => {
9638
- var ue;
9639
- if (!((ue = r == null ? void 0 : r.signal) != null && ue.aborted)) {
9638
+ var de;
9639
+ if (!((de = r == null ? void 0 : r.signal) != null && de.aborted)) {
9640
9640
  if (D instanceof Error)
9641
9641
  return d(D);
9642
9642
  try {
@@ -9650,20 +9650,20 @@ class ek {
9650
9650
  var D;
9651
9651
  y((D = r == null ? void 0 : r.signal) == null ? void 0 : D.reason);
9652
9652
  });
9653
- const w = (r == null ? void 0 : r.timeout) ?? X$, g = () => y(ie.fromError(fe.RequestTimeout, "Request timed out", { timeout: w }));
9653
+ const w = (r == null ? void 0 : r.timeout) ?? X$, g = () => y(ie.fromError(he.RequestTimeout, "Request timed out", { timeout: w }));
9654
9654
  this._setupTimeout(f, w, r == null ? void 0 : r.maxTotalTimeout, g, (r == null ? void 0 : r.resetTimeoutOnProgress) ?? !1);
9655
9655
  const p = c == null ? void 0 : c.taskId;
9656
9656
  if (p) {
9657
- const D = (ue) => {
9657
+ const D = (de) => {
9658
9658
  const Ne = this._responseHandlers.get(f);
9659
- Ne ? Ne(ue) : this._onerror(new Error(`Response handler missing for side-channeled request ${f}`));
9659
+ Ne ? Ne(de) : this._onerror(new Error(`Response handler missing for side-channeled request ${f}`));
9660
9660
  };
9661
9661
  this._requestResolvers.set(f, D), this._enqueueTaskMessage(p, {
9662
9662
  type: "request",
9663
9663
  message: h,
9664
9664
  timestamp: Date.now()
9665
- }).catch((ue) => {
9666
- this._cleanupTimeout(f), d(ue);
9665
+ }).catch((de) => {
9666
+ this._cleanupTimeout(f), d(de);
9667
9667
  });
9668
9668
  } else
9669
9669
  this._transport.send(h, { relatedRequestId: s, resumptionToken: a, onresumptiontoken: i }).catch((D) => {
@@ -9850,7 +9850,7 @@ class ek {
9850
9850
  for (const s of r)
9851
9851
  if (s.type === "request" && Qu(s.message)) {
9852
9852
  const a = s.message.id, i = this._requestResolvers.get(a);
9853
- i ? (i(new ie(fe.InternalError, "Task cancelled or completed")), this._requestResolvers.delete(a)) : this._onerror(new Error(`Resolver missing for request ${a} during task ${t} cleanup`));
9853
+ i ? (i(new ie(he.InternalError, "Task cancelled or completed")), this._requestResolvers.delete(a)) : this._onerror(new Error(`Resolver missing for request ${a} during task ${t} cleanup`));
9854
9854
  }
9855
9855
  }
9856
9856
  }
@@ -9871,12 +9871,12 @@ class ek {
9871
9871
  }
9872
9872
  return new Promise((i, o) => {
9873
9873
  if (n.aborted) {
9874
- o(new ie(fe.InvalidRequest, "Request cancelled"));
9874
+ o(new ie(he.InvalidRequest, "Request cancelled"));
9875
9875
  return;
9876
9876
  }
9877
9877
  const c = setTimeout(i, r);
9878
9878
  n.addEventListener("abort", () => {
9879
- clearTimeout(c), o(new ie(fe.InvalidRequest, "Request cancelled"));
9879
+ clearTimeout(c), o(new ie(he.InvalidRequest, "Request cancelled"));
9880
9880
  }, { once: !0 });
9881
9881
  });
9882
9882
  }
@@ -9896,7 +9896,7 @@ class ek {
9896
9896
  getTask: async (s) => {
9897
9897
  const a = await r.getTask(s, n);
9898
9898
  if (!a)
9899
- throw new ie(fe.InvalidParams, "Failed to retrieve task: Task not found");
9899
+ throw new ie(he.InvalidParams, "Failed to retrieve task: Task not found");
9900
9900
  return a;
9901
9901
  },
9902
9902
  storeTaskResult: async (s, a, i) => {
@@ -9914,9 +9914,9 @@ class ek {
9914
9914
  updateTaskStatus: async (s, a, i) => {
9915
9915
  const o = await r.getTask(s, n);
9916
9916
  if (!o)
9917
- throw new ie(fe.InvalidParams, `Task "${s}" not found - it may have been cleaned up`);
9917
+ throw new ie(he.InvalidParams, `Task "${s}" not found - it may have been cleaned up`);
9918
9918
  if (cr(o.status))
9919
- throw new ie(fe.InvalidParams, `Cannot update task "${s}" from terminal status "${o.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);
9919
+ throw new ie(he.InvalidParams, `Cannot update task "${s}" from terminal status "${o.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);
9920
9920
  await r.updateTaskStatus(s, a, i, n);
9921
9921
  const c = await r.getTask(s, n);
9922
9922
  if (c) {
@@ -10250,7 +10250,7 @@ var Wi = {};
10250
10250
  }
10251
10251
  optimizeNames(_, k) {
10252
10252
  if (_[this.name.str])
10253
- return this.rhs && (this.rhs = he(this.rhs, _, k)), this;
10253
+ return this.rhs && (this.rhs = pe(this.rhs, _, k)), this;
10254
10254
  }
10255
10255
  get names() {
10256
10256
  return this.rhs instanceof t._CodeOrName ? this.rhs.names : {};
@@ -10265,7 +10265,7 @@ var Wi = {};
10265
10265
  }
10266
10266
  optimizeNames(_, k) {
10267
10267
  if (!(this.lhs instanceof t.Name && !_[this.lhs.str] && !this.sideEffects))
10268
- return this.rhs = he(this.rhs, _, k), this;
10268
+ return this.rhs = pe(this.rhs, _, k), this;
10269
10269
  }
10270
10270
  get names() {
10271
10271
  const _ = this.lhs instanceof t.Name ? {} : { ...this.lhs.names };
@@ -10318,7 +10318,7 @@ var Wi = {};
10318
10318
  return `${this.code}` ? this : void 0;
10319
10319
  }
10320
10320
  optimizeNames(_, k) {
10321
- return this.code = he(this.code, _, k), this;
10321
+ return this.code = pe(this.code, _, k), this;
10322
10322
  }
10323
10323
  get names() {
10324
10324
  return this.code instanceof t._CodeOrName ? this.code.names : {};
@@ -10350,7 +10350,7 @@ var Wi = {};
10350
10350
  return A.length > 0 ? this : void 0;
10351
10351
  }
10352
10352
  get names() {
10353
- return this.nodes.reduce((_, k) => de(_, k.names), {});
10353
+ return this.nodes.reduce((_, k) => le(_, k.names), {});
10354
10354
  }
10355
10355
  }
10356
10356
  class y extends h {
@@ -10389,11 +10389,11 @@ var Wi = {};
10389
10389
  optimizeNames(_, k) {
10390
10390
  var A;
10391
10391
  if (this.else = (A = this.else) === null || A === void 0 ? void 0 : A.optimizeNames(_, k), !!(super.optimizeNames(_, k) || this.else))
10392
- return this.condition = he(this.condition, _, k), this;
10392
+ return this.condition = pe(this.condition, _, k), this;
10393
10393
  }
10394
10394
  get names() {
10395
10395
  const _ = super.names;
10396
- return Se(_, this.condition), this.else && de(_, this.else.names), _;
10396
+ return Se(_, this.condition), this.else && le(_, this.else.names), _;
10397
10397
  }
10398
10398
  }
10399
10399
  p.kind = "if";
@@ -10409,10 +10409,10 @@ var Wi = {};
10409
10409
  }
10410
10410
  optimizeNames(_, k) {
10411
10411
  if (super.optimizeNames(_, k))
10412
- return this.iteration = he(this.iteration, _, k), this;
10412
+ return this.iteration = pe(this.iteration, _, k), this;
10413
10413
  }
10414
10414
  get names() {
10415
- return de(super.names, this.iteration.names);
10415
+ return le(super.names, this.iteration.names);
10416
10416
  }
10417
10417
  }
10418
10418
  class $ extends v {
@@ -10437,10 +10437,10 @@ var Wi = {};
10437
10437
  }
10438
10438
  optimizeNames(_, k) {
10439
10439
  if (super.optimizeNames(_, k))
10440
- return this.iterable = he(this.iterable, _, k), this;
10440
+ return this.iterable = pe(this.iterable, _, k), this;
10441
10441
  }
10442
10442
  get names() {
10443
- return de(super.names, this.iterable.names);
10443
+ return le(super.names, this.iterable.names);
10444
10444
  }
10445
10445
  }
10446
10446
  class I extends y {
@@ -10458,7 +10458,7 @@ var Wi = {};
10458
10458
  }
10459
10459
  }
10460
10460
  D.kind = "return";
10461
- class ue extends y {
10461
+ class de extends y {
10462
10462
  render(_) {
10463
10463
  let k = "try" + super.render(_);
10464
10464
  return this.catch && (k += this.catch.render(_)), this.finally && (k += this.finally.render(_)), k;
@@ -10473,7 +10473,7 @@ var Wi = {};
10473
10473
  }
10474
10474
  get names() {
10475
10475
  const _ = super.names;
10476
- return this.catch && de(_, this.catch.names), this.finally && de(_, this.finally.names), _;
10476
+ return this.catch && le(_, this.catch.names), this.finally && le(_, this.finally.names), _;
10477
10477
  }
10478
10478
  }
10479
10479
  class Ne extends y {
@@ -10634,7 +10634,7 @@ var Wi = {};
10634
10634
  try(_, k, A) {
10635
10635
  if (!k && !A)
10636
10636
  throw new Error('CodeGen: "try" without "catch" and "finally"');
10637
- const te = new ue();
10637
+ const te = new de();
10638
10638
  if (this._blockNode(te), this.code(_), k) {
10639
10639
  const re = this.name("e");
10640
10640
  this._currNode = te.catch = new Ne(re), k(re);
@@ -10702,15 +10702,15 @@ var Wi = {};
10702
10702
  }
10703
10703
  }
10704
10704
  e.CodeGen = W;
10705
- function de(E, _) {
10705
+ function le(E, _) {
10706
10706
  for (const k in _)
10707
10707
  E[k] = (E[k] || 0) + (_[k] || 0);
10708
10708
  return E;
10709
10709
  }
10710
10710
  function Se(E, _) {
10711
- return _ instanceof t._CodeOrName ? de(E, _.names) : E;
10711
+ return _ instanceof t._CodeOrName ? le(E, _.names) : E;
10712
10712
  }
10713
- function he(E, _, k) {
10713
+ function pe(E, _, k) {
10714
10714
  if (E instanceof t.Name)
10715
10715
  return A(E);
10716
10716
  if (!te(E))
@@ -10929,8 +10929,8 @@ Rn.default = fk;
10929
10929
  message: ({ keyword: g, schemaType: p }) => p ? (0, t.str)`"${g}" keyword must be ${p} ($data)` : (0, t.str)`"${g}" keyword is invalid ($data)`
10930
10930
  };
10931
10931
  function s(g, p = e.keywordError, v, b) {
10932
- const { it: $ } = g, { gen: P, compositeRule: I, allErrors: D } = $, ue = l(g, p, v);
10933
- b ?? (I || D) ? c(P, ue) : u($, (0, t._)`[${ue}]`);
10932
+ const { it: $ } = g, { gen: P, compositeRule: I, allErrors: D } = $, de = l(g, p, v);
10933
+ b ?? (I || D) ? c(P, de) : u($, (0, t._)`[${de}]`);
10934
10934
  }
10935
10935
  e.reportError = s;
10936
10936
  function a(g, p = e.keywordError, v) {
@@ -10989,8 +10989,8 @@ Rn.default = fk;
10989
10989
  return v && ($ = (0, t.str)`${$}${(0, n.getErrorPath)(v, n.Type.Str)}`), [d.schemaPath, $];
10990
10990
  }
10991
10991
  function w(g, { params: p, message: v }, b) {
10992
- const { keyword: $, data: P, schemaValue: I, it: D } = g, { opts: ue, propertyName: Ne, topSchemaRef: Ee, schemaPath: W } = D;
10993
- b.push([d.keyword, $], [d.params, typeof p == "function" ? p(g) : p || (0, t._)`{}`]), ue.messages && b.push([d.message, typeof v == "function" ? v(g) : v]), ue.verbose && b.push([d.schema, I], [d.parentSchema, (0, t._)`${Ee}${W}`], [r.default.data, P]), Ne && b.push([d.propertyName, Ne]);
10992
+ const { keyword: $, data: P, schemaValue: I, it: D } = g, { opts: de, propertyName: Ne, topSchemaRef: Ee, schemaPath: W } = D;
10993
+ b.push([d.keyword, $], [d.params, typeof p == "function" ? p(g) : p || (0, t._)`{}`]), de.messages && b.push([d.message, typeof v == "function" ? v(g) : v]), de.verbose && b.push([d.schema, I], [d.parentSchema, (0, t._)`${Ee}${W}`], [r.default.data, P]), Ne && b.push([d.propertyName, Ne]);
10994
10994
  }
10995
10995
  })(Zs);
10996
10996
  Object.defineProperty(Ur, "__esModule", { value: !0 });
@@ -12791,9 +12791,9 @@ dc.default = Lh;
12791
12791
  constructor(T = {}) {
12792
12792
  this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), T = this.opts = { ...T, ...b(T) };
12793
12793
  const { es5: C, lines: E } = this.opts.code;
12794
- this.scope = new o.ValueScope({ scope: {}, prefixes: w, es5: C, lines: E }), this.logger = de(T.logger);
12794
+ this.scope = new o.ValueScope({ scope: {}, prefixes: w, es5: C, lines: E }), this.logger = le(T.logger);
12795
12795
  const _ = T.validateFormats;
12796
- T.validateFormats = !1, this.RULES = (0, a.getRules)(), P.call(this, g, T, "NOT SUPPORTED"), P.call(this, p, T, "DEPRECATED", "warn"), this._metaOpts = Ee.call(this), T.formats && ue.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), T.keywords && Ne.call(this, T.keywords), typeof T.meta == "object" && this.addMetaSchema(T.meta), D.call(this), T.validateFormats = _;
12796
+ T.validateFormats = !1, this.RULES = (0, a.getRules)(), P.call(this, g, T, "NOT SUPPORTED"), P.call(this, p, T, "DEPRECATED", "warn"), this._metaOpts = Ee.call(this), T.formats && de.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), T.keywords && Ne.call(this, T.keywords), typeof T.meta == "object" && this.addMetaSchema(T.meta), D.call(this), T.validateFormats = _;
12797
12797
  }
12798
12798
  _addVocabularies() {
12799
12799
  this.addKeyword("$async");
@@ -12954,7 +12954,7 @@ dc.default = Lh;
12954
12954
  throw new Error("addKeywords: keyword must be string or non-empty array");
12955
12955
  } else
12956
12956
  throw new Error("invalid addKeywords parameters");
12957
- if (he.call(this, E, C), !C)
12957
+ if (pe.call(this, E, C), !C)
12958
12958
  return (0, d.eachItem)(E, (k) => Ve.call(this, k)), this;
12959
12959
  Et.call(this, C);
12960
12960
  const _ = {
@@ -13065,7 +13065,7 @@ dc.default = Lh;
13065
13065
  for (const T in F)
13066
13066
  this.addSchema(F[T], T);
13067
13067
  }
13068
- function ue() {
13068
+ function de() {
13069
13069
  for (const F in this.opts.formats) {
13070
13070
  const T = this.opts.formats[F];
13071
13071
  T && this.addFormat(F, T);
@@ -13092,7 +13092,7 @@ dc.default = Lh;
13092
13092
  }, warn() {
13093
13093
  }, error() {
13094
13094
  } };
13095
- function de(F) {
13095
+ function le(F) {
13096
13096
  if (F === !1)
13097
13097
  return W;
13098
13098
  if (F === void 0)
@@ -13102,7 +13102,7 @@ dc.default = Lh;
13102
13102
  throw new Error("logger must implement log, warn and error methods");
13103
13103
  }
13104
13104
  const Se = /^[a-z_$][a-z0-9_$:-]*$/i;
13105
- function he(F, T) {
13105
+ function pe(F, T) {
13106
13106
  const { RULES: C } = this;
13107
13107
  if ((0, d.eachItem)(F, (E) => {
13108
13108
  if (C.keywords[E])
@@ -14577,8 +14577,8 @@ const sR = /* @__PURE__ */ Jf(Kh);
14577
14577
  var ro = { exports: {} }, Gh = {};
14578
14578
  (function(e) {
14579
14579
  Object.defineProperty(e, "__esModule", { value: !0 }), e.formatNames = e.fastFormats = e.fullFormats = void 0;
14580
- function t(W, de) {
14581
- return { validate: W, compare: de };
14580
+ function t(W, le) {
14581
+ return { validate: W, compare: le };
14582
14582
  }
14583
14583
  e.fullFormats = {
14584
14584
  // date: http://tools.ietf.org/html/rfc3339#section-5.6
@@ -14619,9 +14619,9 @@ var ro = { exports: {} }, Gh = {};
14619
14619
  // signed 64 bit integer
14620
14620
  int64: { type: "number", validate: D },
14621
14621
  // C-type float
14622
- float: { type: "number", validate: ue },
14622
+ float: { type: "number", validate: de },
14623
14623
  // C-type double
14624
- double: { type: "number", validate: ue },
14624
+ double: { type: "number", validate: de },
14625
14625
  // hint to the UI to hide input strings
14626
14626
  password: !0,
14627
14627
  // unchecked string payload
@@ -14646,23 +14646,23 @@ var ro = { exports: {} }, Gh = {};
14646
14646
  }
14647
14647
  const r = /^(\d\d\d\d)-(\d\d)-(\d\d)$/, s = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
14648
14648
  function a(W) {
14649
- const de = r.exec(W);
14650
- if (!de)
14649
+ const le = r.exec(W);
14650
+ if (!le)
14651
14651
  return !1;
14652
- const Se = +de[1], he = +de[2], Ve = +de[3];
14653
- return he >= 1 && he <= 12 && Ve >= 1 && Ve <= (he === 2 && n(Se) ? 29 : s[he]);
14652
+ const Se = +le[1], pe = +le[2], Ve = +le[3];
14653
+ return pe >= 1 && pe <= 12 && Ve >= 1 && Ve <= (pe === 2 && n(Se) ? 29 : s[pe]);
14654
14654
  }
14655
- function i(W, de) {
14656
- if (W && de)
14657
- return W > de ? 1 : W < de ? -1 : 0;
14655
+ function i(W, le) {
14656
+ if (W && le)
14657
+ return W > le ? 1 : W < le ? -1 : 0;
14658
14658
  }
14659
14659
  const o = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
14660
14660
  function c(W) {
14661
14661
  return function(Se) {
14662
- const he = o.exec(Se);
14663
- if (!he)
14662
+ const pe = o.exec(Se);
14663
+ if (!pe)
14664
14664
  return !1;
14665
- const Ve = +he[1], ht = +he[2], Et = +he[3], Ke = he[4], pt = he[5] === "-" ? -1 : 1, F = +(he[6] || 0), T = +(he[7] || 0);
14665
+ const Ve = +pe[1], ht = +pe[2], Et = +pe[3], Ke = pe[4], pt = pe[5] === "-" ? -1 : 1, F = +(pe[6] || 0), T = +(pe[7] || 0);
14666
14666
  if (F > 23 || T > 59 || W && !Ke)
14667
14667
  return !1;
14668
14668
  if (Ve <= 23 && ht <= 59 && Et < 60)
@@ -14671,41 +14671,41 @@ var ro = { exports: {} }, Gh = {};
14671
14671
  return (E === 23 || E === -1) && (C === 59 || C === -1) && Et < 61;
14672
14672
  };
14673
14673
  }
14674
- function u(W, de) {
14675
- if (!(W && de))
14674
+ function u(W, le) {
14675
+ if (!(W && le))
14676
14676
  return;
14677
- const Se = (/* @__PURE__ */ new Date("2020-01-01T" + W)).valueOf(), he = (/* @__PURE__ */ new Date("2020-01-01T" + de)).valueOf();
14678
- if (Se && he)
14679
- return Se - he;
14677
+ const Se = (/* @__PURE__ */ new Date("2020-01-01T" + W)).valueOf(), pe = (/* @__PURE__ */ new Date("2020-01-01T" + le)).valueOf();
14678
+ if (Se && pe)
14679
+ return Se - pe;
14680
14680
  }
14681
- function d(W, de) {
14682
- if (!(W && de))
14681
+ function d(W, le) {
14682
+ if (!(W && le))
14683
14683
  return;
14684
- const Se = o.exec(W), he = o.exec(de);
14685
- if (Se && he)
14686
- return W = Se[1] + Se[2] + Se[3], de = he[1] + he[2] + he[3], W > de ? 1 : W < de ? -1 : 0;
14684
+ const Se = o.exec(W), pe = o.exec(le);
14685
+ if (Se && pe)
14686
+ return W = Se[1] + Se[2] + Se[3], le = pe[1] + pe[2] + pe[3], W > le ? 1 : W < le ? -1 : 0;
14687
14687
  }
14688
14688
  const l = /t|\s/i;
14689
14689
  function f(W) {
14690
- const de = c(W);
14691
- return function(he) {
14692
- const Ve = he.split(l);
14693
- return Ve.length === 2 && a(Ve[0]) && de(Ve[1]);
14690
+ const le = c(W);
14691
+ return function(pe) {
14692
+ const Ve = pe.split(l);
14693
+ return Ve.length === 2 && a(Ve[0]) && le(Ve[1]);
14694
14694
  };
14695
14695
  }
14696
- function h(W, de) {
14697
- if (!(W && de))
14696
+ function h(W, le) {
14697
+ if (!(W && le))
14698
14698
  return;
14699
- const Se = new Date(W).valueOf(), he = new Date(de).valueOf();
14700
- if (Se && he)
14701
- return Se - he;
14699
+ const Se = new Date(W).valueOf(), pe = new Date(le).valueOf();
14700
+ if (Se && pe)
14701
+ return Se - pe;
14702
14702
  }
14703
- function y(W, de) {
14704
- if (!(W && de))
14703
+ function y(W, le) {
14704
+ if (!(W && le))
14705
14705
  return;
14706
- const [Se, he] = W.split(l), [Ve, ht] = de.split(l), Et = i(Se, Ve);
14706
+ const [Se, pe] = W.split(l), [Ve, ht] = le.split(l), Et = i(Se, Ve);
14707
14707
  if (Et !== void 0)
14708
- return Et || u(he, ht);
14708
+ return Et || u(pe, ht);
14709
14709
  }
14710
14710
  const w = /\/|:/, g = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
14711
14711
  function p(W) {
@@ -14722,7 +14722,7 @@ var ro = { exports: {} }, Gh = {};
14722
14722
  function D(W) {
14723
14723
  return Number.isInteger(W);
14724
14724
  }
14725
- function ue() {
14725
+ function de() {
14726
14726
  return !0;
14727
14727
  }
14728
14728
  const Ne = /[^\\]\\Z/;
@@ -15156,21 +15156,21 @@ class fR extends ek {
15156
15156
  const l = gs($a, u);
15157
15157
  if (!l.success) {
15158
15158
  const w = l.error instanceof Error ? l.error.message : String(l.error);
15159
- throw new ie(fe.InvalidParams, `Invalid tools/call request: ${w}`);
15159
+ throw new ie(he.InvalidParams, `Invalid tools/call request: ${w}`);
15160
15160
  }
15161
15161
  const { params: f } = l.data, h = await Promise.resolve(n(u, d));
15162
15162
  if (f.task) {
15163
15163
  const w = gs(Va, h);
15164
15164
  if (!w.success) {
15165
15165
  const g = w.error instanceof Error ? w.error.message : String(w.error);
15166
- throw new ie(fe.InvalidParams, `Invalid task creation result: ${g}`);
15166
+ throw new ie(he.InvalidParams, `Invalid task creation result: ${g}`);
15167
15167
  }
15168
15168
  return w.data;
15169
15169
  }
15170
15170
  const y = gs(Qo, h);
15171
15171
  if (!y.success) {
15172
15172
  const w = y.error instanceof Error ? y.error.message : String(y.error);
15173
- throw new ie(fe.InvalidParams, `Invalid tools/call result: ${w}`);
15173
+ throw new ie(he.InvalidParams, `Invalid tools/call result: ${w}`);
15174
15174
  }
15175
15175
  return y.data;
15176
15176
  };
@@ -15337,9 +15337,9 @@ class fR extends ek {
15337
15337
  try {
15338
15338
  const l = this._jsonSchemaValidator.getValidator(c.requestedSchema)(u.content);
15339
15339
  if (!l.valid)
15340
- throw new ie(fe.InvalidParams, `Elicitation response content does not match requested schema: ${l.errorMessage}`);
15340
+ throw new ie(he.InvalidParams, `Elicitation response content does not match requested schema: ${l.errorMessage}`);
15341
15341
  } catch (d) {
15342
- throw d instanceof ie ? d : new ie(fe.InternalError, `Error validating elicitation response: ${d instanceof Error ? d.message : String(d)}`);
15342
+ throw d instanceof ie ? d : new ie(he.InternalError, `Error validating elicitation response: ${d instanceof Error ? d.message : String(d)}`);
15343
15343
  }
15344
15344
  return u;
15345
15345
  }
@@ -15522,20 +15522,20 @@ class vR {
15522
15522
  try {
15523
15523
  const s = this._registeredTools[t.params.name];
15524
15524
  if (!s)
15525
- throw new ie(fe.InvalidParams, `Tool ${t.params.name} not found`);
15525
+ throw new ie(he.InvalidParams, `Tool ${t.params.name} not found`);
15526
15526
  if (!s.enabled)
15527
- throw new ie(fe.InvalidParams, `Tool ${t.params.name} disabled`);
15527
+ throw new ie(he.InvalidParams, `Tool ${t.params.name} disabled`);
15528
15528
  const a = !!t.params.task, i = (r = s.execution) == null ? void 0 : r.taskSupport, o = "createTask" in s.handler;
15529
15529
  if ((i === "required" || i === "optional") && !o)
15530
- throw new ie(fe.InternalError, `Tool ${t.params.name} has taskSupport '${i}' but was not registered with registerToolTask`);
15530
+ throw new ie(he.InternalError, `Tool ${t.params.name} has taskSupport '${i}' but was not registered with registerToolTask`);
15531
15531
  if (i === "required" && !a)
15532
- throw new ie(fe.MethodNotFound, `Tool ${t.params.name} requires task augmentation (taskSupport: 'required')`);
15532
+ throw new ie(he.MethodNotFound, `Tool ${t.params.name} requires task augmentation (taskSupport: 'required')`);
15533
15533
  if (i === "optional" && !a && o)
15534
15534
  return await this.handleAutomaticTaskPolling(s, t, n);
15535
15535
  const c = await this.validateToolInput(s, t.params.arguments, t.params.name), u = await this.executeToolHandler(s, c, n);
15536
15536
  return a || await this.validateToolOutput(s, u, t.params.name), u;
15537
15537
  } catch (s) {
15538
- if (s instanceof ie && s.code === fe.UrlElicitationRequired)
15538
+ if (s instanceof ie && s.code === he.UrlElicitationRequired)
15539
15539
  throw s;
15540
15540
  return this.createToolError(s instanceof Error ? s.message : String(s));
15541
15541
  }
@@ -15567,7 +15567,7 @@ class vR {
15567
15567
  const a = Xr(t.inputSchema) ?? t.inputSchema, i = await ai(a, n);
15568
15568
  if (!i.success) {
15569
15569
  const o = "error" in i ? i.error : "Unknown error", c = ii(o);
15570
- throw new ie(fe.InvalidParams, `Input validation error: Invalid arguments for tool ${r}: ${c}`);
15570
+ throw new ie(he.InvalidParams, `Input validation error: Invalid arguments for tool ${r}: ${c}`);
15571
15571
  }
15572
15572
  return i.data;
15573
15573
  }
@@ -15578,11 +15578,11 @@ class vR {
15578
15578
  if (!t.outputSchema || !("content" in n) || n.isError)
15579
15579
  return;
15580
15580
  if (!n.structuredContent)
15581
- throw new ie(fe.InvalidParams, `Output validation error: Tool ${r} has an output schema but no structured content was provided`);
15581
+ throw new ie(he.InvalidParams, `Output validation error: Tool ${r} has an output schema but no structured content was provided`);
15582
15582
  const s = Xr(t.outputSchema), a = await ai(s, n.structuredContent);
15583
15583
  if (!a.success) {
15584
15584
  const i = "error" in a ? a.error : "Unknown error", o = ii(i);
15585
- throw new ie(fe.InvalidParams, `Output validation error: Invalid structured content for tool ${r}: ${o}`);
15585
+ throw new ie(he.InvalidParams, `Output validation error: Invalid structured content for tool ${r}: ${o}`);
15586
15586
  }
15587
15587
  }
15588
15588
  /**
@@ -15626,7 +15626,7 @@ class vR {
15626
15626
  await new Promise((f) => setTimeout(f, d));
15627
15627
  const l = await r.taskStore.getTask(c);
15628
15628
  if (!l)
15629
- throw new ie(fe.InternalError, `Task ${c} not found during polling`);
15629
+ throw new ie(he.InternalError, `Task ${c} not found during polling`);
15630
15630
  u = l;
15631
15631
  }
15632
15632
  return await r.taskStore.getTaskResult(c);
@@ -15641,16 +15641,16 @@ class vR {
15641
15641
  case "ref/resource":
15642
15642
  return c$(t), this.handleResourceCompletion(t, t.params.ref);
15643
15643
  default:
15644
- throw new ie(fe.InvalidParams, `Invalid completion reference: ${t.params.ref}`);
15644
+ throw new ie(he.InvalidParams, `Invalid completion reference: ${t.params.ref}`);
15645
15645
  }
15646
15646
  }), this._completionHandlerInitialized = !0);
15647
15647
  }
15648
15648
  async handlePromptCompletion(t, n) {
15649
15649
  const r = this._registeredPrompts[n.name];
15650
15650
  if (!r)
15651
- throw new ie(fe.InvalidParams, `Prompt ${n.name} not found`);
15651
+ throw new ie(he.InvalidParams, `Prompt ${n.name} not found`);
15652
15652
  if (!r.enabled)
15653
- throw new ie(fe.InvalidParams, `Prompt ${n.name} disabled`);
15653
+ throw new ie(he.InvalidParams, `Prompt ${n.name} disabled`);
15654
15654
  if (!r.argsSchema)
15655
15655
  return ns;
15656
15656
  const s = As(r.argsSchema), a = s == null ? void 0 : s[t.params.argument.name];
@@ -15667,7 +15667,7 @@ class vR {
15667
15667
  if (!r) {
15668
15668
  if (this._registeredResources[n.uri])
15669
15669
  return ns;
15670
- throw new ie(fe.InvalidParams, `Resource template ${t.params.ref.uri} not found`);
15670
+ throw new ie(he.InvalidParams, `Resource template ${t.params.ref.uri} not found`);
15671
15671
  }
15672
15672
  const s = r.resourceTemplate.completeCallback(t.params.argument.name);
15673
15673
  if (!s)
@@ -15706,7 +15706,7 @@ class vR {
15706
15706
  const r = new URL(t.params.uri), s = this._registeredResources[r.toString()];
15707
15707
  if (s) {
15708
15708
  if (!s.enabled)
15709
- throw new ie(fe.InvalidParams, `Resource ${r} disabled`);
15709
+ throw new ie(he.InvalidParams, `Resource ${r} disabled`);
15710
15710
  return s.readCallback(r, n);
15711
15711
  }
15712
15712
  for (const a of Object.values(this._registeredResourceTemplates)) {
@@ -15714,7 +15714,7 @@ class vR {
15714
15714
  if (i)
15715
15715
  return a.readCallback(r, i, n);
15716
15716
  }
15717
- throw new ie(fe.InvalidParams, `Resource ${r} not found`);
15717
+ throw new ie(he.InvalidParams, `Resource ${r} not found`);
15718
15718
  }), this._resourceHandlersInitialized = !0);
15719
15719
  }
15720
15720
  setPromptRequestHandlers() {
@@ -15732,14 +15732,14 @@ class vR {
15732
15732
  })), this.server.setRequestHandler(Ji, async (t, n) => {
15733
15733
  const r = this._registeredPrompts[t.params.name];
15734
15734
  if (!r)
15735
- throw new ie(fe.InvalidParams, `Prompt ${t.params.name} not found`);
15735
+ throw new ie(he.InvalidParams, `Prompt ${t.params.name} not found`);
15736
15736
  if (!r.enabled)
15737
- throw new ie(fe.InvalidParams, `Prompt ${t.params.name} disabled`);
15737
+ throw new ie(he.InvalidParams, `Prompt ${t.params.name} disabled`);
15738
15738
  if (r.argsSchema) {
15739
15739
  const s = Xr(r.argsSchema), a = await ai(s, t.params.arguments);
15740
15740
  if (!a.success) {
15741
15741
  const c = "error" in a ? a.error : "Unknown error", u = ii(c);
15742
- throw new ie(fe.InvalidParams, `Invalid arguments for prompt ${t.params.name}: ${u}`);
15742
+ throw new ie(he.InvalidParams, `Invalid arguments for prompt ${t.params.name}: ${u}`);
15743
15743
  }
15744
15744
  const i = a.data, o = r.callback;
15745
15745
  return await Promise.resolve(o(i, n));
@@ -16247,7 +16247,7 @@ function Jc(e, t = {}) {
16247
16247
  });
16248
16248
  const _e = or("git", ["rev-parse", "--verify", "--quiet", "refs/remotes/origin/main"], {
16249
16249
  cwd: e
16250
- }).status === 0 ? "origin/main" : "main", be = await ue(L), qe = be ? `${L} already has ${be.done}/${be.total} phases complete on ${be.ref} — this new branch forks from before that work, so it will inherit the stale corpus state. Rebase onto ${be.ref} once created.` : void 0, ye = or("git", ["checkout", "-b", H, "--no-track", _e], { cwd: e });
16250
+ }).status === 0 ? "origin/main" : "main", be = await de(L), qe = be ? `${L} already has ${be.done}/${be.total} phases complete on ${be.ref} — this new branch forks from before that work, so it will inherit the stale corpus state. Rebase onto ${be.ref} once created.` : void 0, ye = or("git", ["checkout", "-b", H, "--no-track", _e], { cwd: e });
16251
16251
  if (ye.status !== 0)
16252
16252
  throw new Error(ye.stderr.toString().trim() || `Unable to create branch ${H}`);
16253
16253
  return qe;
@@ -16351,7 +16351,7 @@ function Jc(e, t = {}) {
16351
16351
  total: q.phases.length
16352
16352
  } : null;
16353
16353
  }
16354
- async function ue(z) {
16354
+ async function de(z) {
16355
16355
  const L = await D(z, "HEAD");
16356
16356
  if (!L) return null;
16357
16357
  for (const H of ["main", "origin/main"]) {
@@ -16384,7 +16384,7 @@ function Jc(e, t = {}) {
16384
16384
  const L = await ps(e);
16385
16385
  return L === void 0 ? Ee() : ((H = L.get(z)) == null ? void 0 : H.state) === "merged";
16386
16386
  }
16387
- async function de() {
16387
+ async function le() {
16388
16388
  I();
16389
16389
  const z = b(), H = (await o()).length > 0;
16390
16390
  if (z === "main" || z === "master")
@@ -16403,7 +16403,7 @@ function Jc(e, t = {}) {
16403
16403
  const L = b().match(/^[a-z]+\/([a-z]+-\d+)-/);
16404
16404
  return L ? L[1].toUpperCase() : null;
16405
16405
  }
16406
- async function he(z, L = 12e3) {
16406
+ async function pe(z, L = 12e3) {
16407
16407
  if (z.length === 0) return "";
16408
16408
  const H = z.find((ye) => Dd.some((De) => De.test(ye)));
16409
16409
  if (H)
@@ -16737,18 +16737,18 @@ ${$n}`);
16737
16737
  getHeadSha: pt,
16738
16738
  getLastCommitFor: F,
16739
16739
  revert: T,
16740
- diff: he,
16740
+ diff: pe,
16741
16741
  getWorkingDiff: Ve,
16742
16742
  ensureBranch: l,
16743
16743
  getPhaseStateAtRef: D,
16744
- findStaleBaseRef: ue,
16744
+ findStaleBaseRef: de,
16745
16745
  getFeatureBranchPlanId: Se,
16746
16746
  getAheadCount: w,
16747
16747
  getBehindCount: g,
16748
16748
  getLiveState: p,
16749
16749
  push: v,
16750
16750
  isMergedIntoMain: Ee,
16751
- getBranchHygieneStatus: de,
16751
+ getBranchHygieneStatus: le,
16752
16752
  hasPendingSyncStash: te,
16753
16753
  getStashes: xe,
16754
16754
  showStash: bn,
@@ -16927,7 +16927,7 @@ function OR(e, t, n) {
16927
16927
  "a done/archived entity is read-only — new work spawns its own fix entity"
16928
16928
  );
16929
16929
  const P = $.phases.map(
16930
- (D, ue) => ue === l ? { ...D, done: f } : D
16930
+ (D, de) => de === l ? { ...D, done: f } : D
16931
16931
  ), I = {
16932
16932
  ...$,
16933
16933
  phases: P,
@@ -16951,7 +16951,7 @@ function OR(e, t, n) {
16951
16951
  outputSchema: rs.shape
16952
16952
  },
16953
16953
  ({ id: d, title: l, content: f, tags: h, type: y }) => a(d, async () => {
16954
- const w = ce(t, "ideas"), { entries: g } = await yt(w), p = g.find((ue) => ue.id === d && ue.kind !== "note");
16954
+ const w = ce(t, "ideas"), { entries: g } = await yt(w), p = g.find((de) => de.id === d && de.kind !== "note");
16955
16955
  if (!p) throw new Error(`entity "${d}" not found`);
16956
16956
  const v = j(w, `${p.id}.md`), b = await ke(v);
16957
16957
  if (!b) throw new Error("entity file not found");
@@ -17790,7 +17790,7 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
17790
17790
  function D(m) {
17791
17791
  b(m, "[superseded] preempted by a newer run for this plan"), I(m, "superseded");
17792
17792
  }
17793
- async function ue(m) {
17793
+ async function de(m) {
17794
17794
  var x, O, J;
17795
17795
  try {
17796
17796
  if (m.taskKind === "extend") {
@@ -17847,7 +17847,7 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
17847
17847
  } else
17848
17848
  await gi(e, m.planId, m.prReviewSha), await yi(e, m.planId), b(m, "pr-review agent exited without a parseable verdict — nothing posted");
17849
17849
  }
17850
- ue(m).then((O) => {
17850
+ de(m).then((O) => {
17851
17851
  O === !1 && b(m, fI(m)), I(m, "done"), m.taskKind === "audit" && m.planId && O === !0 && (t == null || t(m.planId).catch(() => {
17852
17852
  }));
17853
17853
  });
@@ -17860,7 +17860,7 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
17860
17860
  const O = sm(m.phaseAnchor, x);
17861
17861
  O !== m.phaseAnchor && (m.phaseAnchor = O, m.anchorEnteredAt = Date.now());
17862
17862
  }
17863
- function de(m) {
17863
+ function le(m) {
17864
17864
  var J;
17865
17865
  if (!m.proc.stdout) return;
17866
17866
  m.lastStreamAt = Date.now(), Ti({ input: m.proc.stdout }).on("line", (ae) => {
@@ -17884,7 +17884,7 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
17884
17884
  stdio: ["ignore", "pipe", "pipe"]
17885
17885
  });
17886
17886
  }
17887
- function he(m, x, O, J, ae, U = {}) {
17887
+ function pe(m, x, O, J, ae, U = {}) {
17888
17888
  var $t;
17889
17889
  m.errorReason = void 0, m.phaseAnchor = void 0, m.anchorEnteredAt = void 0, m.lastStreamAt = Date.now();
17890
17890
  const Y = Se(
@@ -17903,10 +17903,10 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
17903
17903
  }
17904
17904
  });
17905
17905
  let ct = "";
17906
- return ($t = Y.stderr) == null || $t.on("data", (pe) => {
17907
- ct += pe.toString();
17908
- }), zR(Y, ss).then((pe) => ({
17909
- ...pe,
17906
+ return ($t = Y.stderr) == null || $t.on("data", (ue) => {
17907
+ ct += ue.toString();
17908
+ }), zR(Y, ss).then((ue) => ({
17909
+ ...ue,
17910
17910
  stderr: ct,
17911
17911
  sessionId: Ce,
17912
17912
  usage: Re
@@ -17972,7 +17972,7 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
17972
17972
  proc: ct,
17973
17973
  ...O
17974
17974
  });
17975
- return p($t), de($t), { ok: !0 };
17975
+ return p($t), le($t), { ok: !0 };
17976
17976
  }
17977
17977
  async function E(m) {
17978
17978
  const { entries: x } = await yt(ce(e, "ideas")), O = x.find((J) => J.id === m && J.kind !== "note");
@@ -18090,7 +18090,7 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
18090
18090
  U,
18091
18091
  `Reconciling ${Re.length} entit${Re.length === 1 ? "y" : "ies"}…`
18092
18092
  );
18093
- let ct = 0, $t = 0, pe = 0;
18093
+ let ct = 0, $t = 0, ue = 0;
18094
18094
  const me = Re.length;
18095
18095
  for (const [V, ve] of Re.entries()) {
18096
18096
  if (U.status === "stopping") break;
@@ -18103,7 +18103,7 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
18103
18103
  $t++;
18104
18104
  continue;
18105
18105
  }
18106
- const le = { body: ve.body, phases: ve.phases };
18106
+ const fe = { body: ve.body, phases: ve.phases };
18107
18107
  b(U, `[reconcile] ${ve.id} ${ve.title} (${V + 1}/${me})`);
18108
18108
  const {
18109
18109
  adapter: nt,
@@ -18113,24 +18113,24 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
18113
18113
  ok: In,
18114
18114
  timedOut: On,
18115
18115
  stderr: Ft
18116
- } = await he(U, nt, Bn, Vn, Jn);
18116
+ } = await pe(U, nt, Bn, Vn, Jn);
18117
18117
  if (On) {
18118
- pe++, b(U, `[timeout] ${ve.id} — no progress for ${ss / 6e4}min`);
18118
+ ue++, b(U, `[timeout] ${ve.id} — no progress for ${ss / 6e4}min`);
18119
18119
  continue;
18120
18120
  }
18121
18121
  if (In) {
18122
18122
  let mt = !1;
18123
18123
  try {
18124
18124
  const Gt = await _t(ft, "utf-8"), qt = Yt(Gt), jt = qt.entries[0] ? sn(qt.entries[0]) : void 0;
18125
- mt = jt ? JSON.stringify({ body: jt.body, phases: jt.phases.map((rt) => rt.text) }) !== JSON.stringify({ body: le.body, phases: le.phases.map((rt) => rt.text) }) : !1;
18125
+ mt = jt ? JSON.stringify({ body: jt.body, phases: jt.phases.map((rt) => rt.text) }) !== JSON.stringify({ body: fe.body, phases: fe.phases.map((rt) => rt.text) }) : !1;
18126
18126
  } catch {
18127
18127
  }
18128
- ct++, mt && ((Y = U.reconcileResults) == null || Y.push({ planId: ve.id, title: ve.title, before: le })), b(
18128
+ ct++, mt && ((Y = U.reconcileResults) == null || Y.push({ planId: ve.id, title: ve.title, before: fe })), b(
18129
18129
  U,
18130
18130
  mt ? `[done] ${ve.id} — updated` : `[done] ${ve.id} — no drift found`
18131
18131
  );
18132
18132
  } else
18133
- pe++, Ft.trim() && b(U, Ft.trim()), b(
18133
+ ue++, Ft.trim() && b(U, Ft.trim()), b(
18134
18134
  U,
18135
18135
  U.errorReason ? `[fail] ${ve.id} — ${U.errorReason}` : `[fail] ${ve.id} — agent error`
18136
18136
  );
@@ -18141,8 +18141,8 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
18141
18141
  }
18142
18142
  b(
18143
18143
  U,
18144
- `Reconcile complete — ${ct} reconciled, ${$t} skipped, ${pe} failed`
18145
- ), I(U, pe > 0 ? "error" : "done");
18144
+ `Reconcile complete — ${ct} reconciled, ${$t} skipped, ${ue} failed`
18145
+ ), I(U, ue > 0 ? "error" : "done");
18146
18146
  } catch (Ce) {
18147
18147
  b(U, `Batch reconcile failed: ${Ce.message}`), I(U, "error");
18148
18148
  }
@@ -18166,21 +18166,21 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
18166
18166
  return (async () => {
18167
18167
  var Ce;
18168
18168
  try {
18169
- const { entries: Re } = await Ss(j(e, "papercamp", "ideas")), ct = Re.map((le) => sn(le)), $t = (le) => le.kind !== "note" && le.phases.length === 0 && le.status === "idea", pe = [...new Set(m)].map((le) => Re.find((nt) => nt.id === le)).filter((le) => le !== void 0 && $t(le));
18170
- if (pe.length === 0) {
18169
+ const { entries: Re } = await Ss(j(e, "papercamp", "ideas")), ct = Re.map((fe) => sn(fe)), $t = (fe) => fe.kind !== "note" && fe.phases.length === 0 && fe.status === "idea", ue = [...new Set(m)].map((fe) => Re.find((nt) => nt.id === fe)).filter((fe) => fe !== void 0 && $t(fe));
18170
+ if (ue.length === 0) {
18171
18171
  b(Y, "No ideas selected to draft."), I(Y, "done");
18172
18172
  return;
18173
18173
  }
18174
- b(Y, `Drafting ${pe.length} idea${pe.length === 1 ? "" : "s"}…`);
18174
+ b(Y, `Drafting ${ue.length} idea${ue.length === 1 ? "" : "s"}…`);
18175
18175
  let me = 0, V = 0, ve = 0;
18176
- const ft = pe.length;
18177
- for (const [le, nt] of pe.entries()) {
18176
+ const ft = ue.length;
18177
+ for (const [fe, nt] of ue.entries()) {
18178
18178
  if (Y.status === "stopping") break;
18179
18179
  if (!nt.id) {
18180
18180
  V++;
18181
18181
  continue;
18182
18182
  }
18183
- b(Y, `[draft] ${nt.id} ${nt.title} (${le + 1}/${ft})`);
18183
+ b(Y, `[draft] ${nt.id} ${nt.title} (${fe + 1}/${ft})`);
18184
18184
  const {
18185
18185
  adapter: Vn,
18186
18186
  model: Jn,
@@ -18189,7 +18189,7 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
18189
18189
  ok: mt,
18190
18190
  timedOut: Gt,
18191
18191
  stderr: qt
18192
- } = await he(Y, Vn, Ft, Jn, Bn);
18192
+ } = await pe(Y, Vn, Ft, Jn, Bn);
18193
18193
  if (Gt) {
18194
18194
  ve++, b(
18195
18195
  Y,
@@ -18226,67 +18226,67 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
18226
18226
  }
18227
18227
  function H(m, x, O, J, ae, U, Y, Ce, Re, ct, $t) {
18228
18228
  b(m, `[fix] ${O} — fix attempt ${Ce}/${Re} for failing checks`);
18229
- const pe = uI(x, O, J, ct);
18230
- return he(m, ae, pe, U, Y, {
18229
+ const ue = uI(x, O, J, ct);
18230
+ return pe(m, ae, ue, U, Y, {
18231
18231
  guardSuperseded: !0,
18232
18232
  trackBlocker: !0,
18233
18233
  resume: $t
18234
18234
  }).then(({ ok: me, timedOut: V, stderr: ve, sessionId: ft }) => (!me && !V && ve.trim() && b(m, ve.trim()), { ok: me, timedOut: V, sessionId: ft }));
18235
18235
  }
18236
18236
  async function q(m, x, O, J, ae, U, Y, Ce, Re, ct, $t) {
18237
- let pe = 0, me = 0, V = ct, ve = $t;
18238
- for (const { item: ft, i: le } of J) {
18237
+ let ue = 0, me = 0, V = ct, ve = $t;
18238
+ for (const { item: ft, i: fe } of J) {
18239
18239
  if (f(m) || m.status === "stopping") break;
18240
- O === "phase" ? m.phaseIndex = le : (m.fixIndex = le, m.phaseIndex = void 0), b(m, `[${O} ${le + 1}/${ae}] ${ft.text}`);
18241
- const nt = O === "phase" ? Hd(x, ft, le, [...V]) : dI(x, ft, le, [...V]), Vn = O === "phase" && i ? await i() : [], {
18240
+ O === "phase" ? m.phaseIndex = fe : (m.fixIndex = fe, m.phaseIndex = void 0), b(m, `[${O} ${fe + 1}/${ae}] ${ft.text}`);
18241
+ const nt = O === "phase" ? Hd(x, ft, fe, [...V]) : dI(x, ft, fe, [...V]), Vn = O === "phase" && i ? await i() : [], {
18242
18242
  ok: Jn,
18243
18243
  timedOut: Bn,
18244
18244
  stderr: In,
18245
18245
  sessionId: On,
18246
18246
  usage: Ft
18247
- } = await he(m, U, nt, Y, Ce, {
18247
+ } = await pe(m, U, nt, Y, Ce, {
18248
18248
  guardSuperseded: !0,
18249
18249
  trackBlocker: !0,
18250
18250
  resume: ve
18251
18251
  });
18252
18252
  if (On && (ve = On), f(m))
18253
- return { completed: pe, failed: me, toleratedRed: V, sessionId: ve, exit: "superseded" };
18253
+ return { completed: ue, failed: me, toleratedRed: V, sessionId: ve, exit: "superseded" };
18254
18254
  if (h(m)) break;
18255
18255
  if (m.blocker) {
18256
- me++, m.errorReason ?? (m.errorReason = m.blocker), b(m, `[blocked] ${O} ${le + 1} — agent needs a decision: ${m.blocker}`), await y(
18256
+ me++, m.errorReason ?? (m.errorReason = m.blocker), b(m, `[blocked] ${O} ${fe + 1} — agent needs a decision: ${m.blocker}`), await y(
18257
18257
  m,
18258
18258
  x.id,
18259
- `Run-all parked on ${O} ${le + 1} ("${ft.text}") — the agent needs a decision: ${m.blocker}`
18259
+ `Run-all parked on ${O} ${fe + 1} ("${ft.text}") — the agent needs a decision: ${m.blocker}`
18260
18260
  ), m.blocker = void 0;
18261
18261
  break;
18262
18262
  }
18263
18263
  if (Bn) {
18264
- me++, m.errorReason = `${O} ${le + 1} — no progress for ${ss / 6e4}min`, b(
18264
+ me++, m.errorReason = `${O} ${fe + 1} — no progress for ${ss / 6e4}min`, b(
18265
18265
  m,
18266
- `[timeout] ${O} ${le + 1} — no progress for ${ss / 6e4}min, stopping`
18266
+ `[timeout] ${O} ${fe + 1} — no progress for ${ss / 6e4}min, stopping`
18267
18267
  );
18268
18268
  break;
18269
18269
  }
18270
18270
  if (!Jn) {
18271
- me++, In.trim() && b(m, In.trim()), m.errorReason = m.errorReason ? `${O} ${le + 1} — ${m.errorReason}` : `${O} ${le + 1} — agent error`, b(
18271
+ me++, In.trim() && b(m, In.trim()), m.errorReason = m.errorReason ? `${O} ${fe + 1} — ${m.errorReason}` : `${O} ${fe + 1} — agent error`, b(
18272
18272
  m,
18273
- m.errorReason ? `[fail] ${O} ${le + 1} — ${m.errorReason}, stopping` : `[fail] ${O} ${le + 1} — agent error, stopping`
18273
+ m.errorReason ? `[fail] ${O} ${fe + 1} — ${m.errorReason}, stopping` : `[fail] ${O} ${fe + 1} — agent error, stopping`
18274
18274
  );
18275
18275
  break;
18276
18276
  }
18277
- const mt = await ue(m);
18277
+ const mt = await de(m);
18278
18278
  if (!mt) {
18279
- me++, m.errorReason = mt === null ? `${O} ${le + 1} — could not read plan after run` : `${O} ${le + 1} — ${O} checkbox did not flip`, b(
18279
+ me++, m.errorReason = mt === null ? `${O} ${fe + 1} — could not read plan after run` : `${O} ${fe + 1} — ${O} checkbox did not flip`, b(
18280
18280
  m,
18281
- mt === null ? `[fail] ${O} ${le + 1} — could not read plan after run, stopping` : `[fail] ${O} ${le + 1} — ${O} checkbox did not flip, stopping`
18281
+ mt === null ? `[fail] ${O} ${fe + 1} — could not read plan after run, stopping` : `[fail] ${O} ${fe + 1} — ${O} checkbox did not flip, stopping`
18282
18282
  );
18283
18283
  break;
18284
18284
  }
18285
18285
  if (Re) {
18286
- b(m, `[verify] ${O} ${le + 1} — running lint/format/test`);
18286
+ b(m, `[verify] ${O} ${fe + 1} — running lint/format/test`);
18287
18287
  let Gt = await Re();
18288
18288
  if (f(m))
18289
- return { completed: pe, failed: me, toleratedRed: V, sessionId: ve, exit: "superseded" };
18289
+ return { completed: ue, failed: me, toleratedRed: V, sessionId: ve, exit: "superseded" };
18290
18290
  if (h(m)) break;
18291
18291
  let qt = Gt.filter((Xa) => !V.has(Xa)), jt = qt.length === 0, rt = 0, ir;
18292
18292
  for (; !jt && rt < as && !(f(m) || h(m)); ) {
@@ -18294,7 +18294,7 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
18294
18294
  const { timedOut: Xa, sessionId: eu } = await H(
18295
18295
  m,
18296
18296
  x,
18297
- `${O} ${le + 1}`,
18297
+ `${O} ${fe + 1}`,
18298
18298
  ft.text,
18299
18299
  U,
18300
18300
  Y,
@@ -18305,53 +18305,53 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
18305
18305
  ve
18306
18306
  );
18307
18307
  if (eu && (ve = eu), f(m))
18308
- return { completed: pe, failed: me, toleratedRed: V, sessionId: ve, exit: "superseded" };
18308
+ return { completed: ue, failed: me, toleratedRed: V, sessionId: ve, exit: "superseded" };
18309
18309
  if (m.blocker) {
18310
18310
  ir = m.blocker, m.blocker = void 0;
18311
18311
  break;
18312
18312
  }
18313
18313
  if (Xa && b(
18314
18314
  m,
18315
- `[fix] ${O} ${le + 1} — fix attempt ${rt}/${as} timed out`
18315
+ `[fix] ${O} ${fe + 1} — fix attempt ${rt}/${as} timed out`
18316
18316
  ), b(
18317
18317
  m,
18318
- `[verify] ${O} ${le + 1} — re-running lint/format/test (attempt ${rt}/${as})`
18318
+ `[verify] ${O} ${fe + 1} — re-running lint/format/test (attempt ${rt}/${as})`
18319
18319
  ), Gt = await Re(), f(m))
18320
- return { completed: pe, failed: me, toleratedRed: V, sessionId: ve, exit: "superseded" };
18320
+ return { completed: ue, failed: me, toleratedRed: V, sessionId: ve, exit: "superseded" };
18321
18321
  qt = Gt.filter((Dp) => !V.has(Dp)), jt = qt.length === 0;
18322
18322
  }
18323
18323
  if (m.fixAttempt = void 0, m.fixAttemptCap = void 0, h(m)) break;
18324
18324
  if (ir) {
18325
- me++, m.errorReason ?? (m.errorReason = ir), b(m, `[blocked] ${O} ${le + 1} — agent needs a decision: ${ir}`), await y(
18325
+ me++, m.errorReason ?? (m.errorReason = ir), b(m, `[blocked] ${O} ${fe + 1} — agent needs a decision: ${ir}`), await y(
18326
18326
  m,
18327
18327
  x.id,
18328
- `Run-all parked on ${O} ${le + 1} ("${ft.text}") — the fix pass needs a decision: ${ir}`
18328
+ `Run-all parked on ${O} ${fe + 1} ("${ft.text}") — the fix pass needs a decision: ${ir}`
18329
18329
  );
18330
18330
  break;
18331
18331
  }
18332
18332
  if (!jt) {
18333
- me++, m.errorReason = `${O} ${le + 1} — project checks (${qt.join(", ")}) still failing after ${rt} fix attempt(s)`, b(
18333
+ me++, m.errorReason = `${O} ${fe + 1} — project checks (${qt.join(", ")}) still failing after ${rt} fix attempt(s)`, b(
18334
18334
  m,
18335
- `[blocked] ${O} ${le + 1} — project checks still failing after ${rt} fix attempt(s)`
18335
+ `[blocked] ${O} ${fe + 1} — project checks still failing after ${rt} fix attempt(s)`
18336
18336
  ), await y(
18337
18337
  m,
18338
18338
  x.id,
18339
- `Run-all parked on ${O} ${le + 1} ("${ft.text}") — project checks (${qt.join(", ")}) are still failing after ${rt} fix attempt(s). Reply here with guidance to unblock and resume.`
18339
+ `Run-all parked on ${O} ${fe + 1} ("${ft.text}") — project checks (${qt.join(", ")}) are still failing after ${rt} fix attempt(s). Reply here with guidance to unblock and resume.`
18340
18340
  );
18341
18341
  break;
18342
18342
  }
18343
18343
  V = new Set(Gt);
18344
18344
  }
18345
- pe++, Ft && (m.phaseRuns ?? (m.phaseRuns = []), m.phaseRuns.push({ kind: O, index: le, usage: Ft })), O === "phase" && n ? (b(m, `[commit] ${O} ${le + 1} — ${ft.text}`), await n(
18345
+ ue++, Ft && (m.phaseRuns ?? (m.phaseRuns = []), m.phaseRuns.push({ kind: O, index: fe, usage: Ft })), O === "phase" && n ? (b(m, `[commit] ${O} ${fe + 1} — ${ft.text}`), await n(
18346
18346
  x,
18347
18347
  ft,
18348
- le,
18348
+ fe,
18349
18349
  Vn,
18350
18350
  Ft ? { usage: Ft, kind: O } : void 0
18351
- )) : O === "fix" && a && Ft && x.id && await a(x.id, le, { usage: Ft, kind: O });
18351
+ )) : O === "fix" && a && Ft && x.id && await a(x.id, fe, { usage: Ft, kind: O });
18352
18352
  }
18353
18353
  return {
18354
- completed: pe,
18354
+ completed: ue,
18355
18355
  failed: me,
18356
18356
  toleratedRed: V,
18357
18357
  sessionId: ve,
@@ -18369,7 +18369,7 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
18369
18369
  adapter: Ce,
18370
18370
  model: Re,
18371
18371
  effort: ct
18372
- } = An({ agentId: m.agent, defaultAgents: U, taskKind: "run-all" }), $t = Tt("sh", ["-c", "exit 0"], { cwd: e, stdio: "ignore" }), pe = p(
18372
+ } = An({ agentId: m.agent, defaultAgents: U, taskKind: "run-all" }), $t = Tt("sh", ["-c", "exit 0"], { cwd: e, stdio: "ignore" }), ue = p(
18373
18373
  g({
18374
18374
  taskKind: "run-all",
18375
18375
  planTitle: m.title,
@@ -18381,21 +18381,21 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
18381
18381
  );
18382
18382
  return (async () => {
18383
18383
  try {
18384
- if (s && await s(m), f(pe)) {
18385
- D(pe);
18384
+ if (s && await s(m), f(ue)) {
18385
+ D(ue);
18386
18386
  return;
18387
18387
  }
18388
18388
  let me = new Set(x ? await x() : []);
18389
- if (f(pe)) {
18390
- D(pe);
18389
+ if (f(ue)) {
18390
+ D(ue);
18391
18391
  return;
18392
18392
  }
18393
18393
  me.size > 0 && b(
18394
- pe,
18394
+ ue,
18395
18395
  `[verify] tolerating pre-existing red check(s): ${[...me].join(", ")}`
18396
18396
  );
18397
18397
  const V = await q(
18398
- pe,
18398
+ ue,
18399
18399
  m,
18400
18400
  "phase",
18401
18401
  J,
@@ -18408,11 +18408,11 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
18408
18408
  void 0
18409
18409
  );
18410
18410
  if (me = V.toleratedRed, V.exit === "superseded") {
18411
- D(pe);
18411
+ D(ue);
18412
18412
  return;
18413
18413
  }
18414
18414
  if (V.exit === "stopping") {
18415
- I(pe, "done");
18415
+ I(ue, "done");
18416
18416
  return;
18417
18417
  }
18418
18418
  let ve = {
@@ -18424,7 +18424,7 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
18424
18424
  };
18425
18425
  if (V.failed === 0 && ae.length > 0) {
18426
18426
  if (ve = await q(
18427
- pe,
18427
+ ue,
18428
18428
  m,
18429
18429
  "fix",
18430
18430
  ae,
@@ -18436,34 +18436,34 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
18436
18436
  me,
18437
18437
  V.sessionId
18438
18438
  ), ve.exit === "superseded") {
18439
- D(pe);
18439
+ D(ue);
18440
18440
  return;
18441
18441
  }
18442
18442
  if (ve.exit === "stopping") {
18443
- I(pe, "done");
18443
+ I(ue, "done");
18444
18444
  return;
18445
18445
  }
18446
18446
  }
18447
- const ft = V.failed + ve.failed, le = [
18447
+ const ft = V.failed + ve.failed, fe = [
18448
18448
  J.length > 0 || ae.length === 0 ? `${V.completed} phase(s)` : void 0,
18449
18449
  ae.length > 0 ? `${ve.completed} fix(es)` : void 0
18450
18450
  ].filter(Boolean).join(" and ");
18451
18451
  if (ft > 0)
18452
- b(pe, `Run stopped after ${le} completed, 1 failed`), I(pe, "error");
18452
+ b(ue, `Run stopped after ${fe} completed, 1 failed`), I(ue, "error");
18453
18453
  else {
18454
- if (b(pe, `All ${le} completed`), r)
18454
+ if (b(ue, `All ${fe} completed`), r)
18455
18455
  try {
18456
- b(pe, "[review] setting plan status to review"), await r(m);
18456
+ b(ue, "[review] setting plan status to review"), await r(m);
18457
18457
  } catch (nt) {
18458
18458
  b(
18459
- pe,
18459
+ ue,
18460
18460
  `Warning: could not set plan status to review: ${nt.message}`
18461
18461
  );
18462
18462
  }
18463
- I(pe, "done");
18463
+ I(ue, "done");
18464
18464
  }
18465
18465
  } catch (me) {
18466
- f(pe) ? Ee(pe) || D(pe) : (b(pe, `Run all phases failed: ${me.message}`), I(pe, "error"));
18466
+ f(ue) ? Ee(ue) || D(ue) : (ue.errorReason ?? (ue.errorReason = me.message), b(ue, `Run all phases failed: ${me.message}`), I(ue, "error"));
18467
18467
  }
18468
18468
  })(), { ok: !0 };
18469
18469
  }
@@ -18480,7 +18480,7 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
18480
18480
  defaultAgents: J,
18481
18481
  taskKind: x
18482
18482
  }), Re = ae === "claude-code", ct = Re ? ["-p", "--output-format", "json"] : ["run", "--format", "json"];
18483
- return Y && ct.push(Re ? "--model" : "-m", Y), Ce && ct.push(Re ? "--effort" : "--variant", Ce), new Promise(($t, pe) => {
18483
+ return Y && ct.push(Re ? "--model" : "-m", Y), Ce && ct.push(Re ? "--effort" : "--variant", Ce), new Promise(($t, ue) => {
18484
18484
  var Jn, Bn, In, On, Ft;
18485
18485
  const me = Tt(U.command, ct, {
18486
18486
  cwd: e,
@@ -18488,10 +18488,10 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
18488
18488
  }), V = p(g({ taskKind: x, planTitle: O, agentId: ae, adapter: U, proc: me }));
18489
18489
  let ve = !1;
18490
18490
  const ft = (mt) => {
18491
- ve || (ve = !0, clearTimeout(le), mt());
18492
- }, le = setTimeout(() => {
18491
+ ve || (ve = !0, clearTimeout(fe), mt());
18492
+ }, fe = setTimeout(() => {
18493
18493
  ft(() => {
18494
- b(V, `${O} timed out`), I(V, "error"), io(me), pe(new Error(`${O} timed out`));
18494
+ b(V, `${O} timed out`), I(V, "error"), io(me), ue(new Error(`${O} timed out`));
18495
18495
  });
18496
18496
  }, Ae);
18497
18497
  (Jn = me.stdin) == null || Jn.on("error", () => {
@@ -18519,12 +18519,12 @@ function pI(e, t, n, r, s, a, i, o = hI()) {
18519
18519
  $t(Gt);
18520
18520
  } else {
18521
18521
  const Gt = Vn || `${U.command} exited with code ${mt}`;
18522
- b(V, Gt), I(V, "error"), pe(new Error(Gt));
18522
+ b(V, Gt), I(V, "error"), ue(new Error(Gt));
18523
18523
  }
18524
18524
  });
18525
18525
  }), me.on("error", (mt) => {
18526
18526
  ft(() => {
18527
- b(V, `Failed to spawn agent: ${mt.message}`), I(V, "error"), pe(mt);
18527
+ b(V, `Failed to spawn agent: ${mt.message}`), I(V, "error"), ue(mt);
18528
18528
  });
18529
18529
  });
18530
18530
  });
@@ -18695,9 +18695,7 @@ function yI(e, t) {
18695
18695
  }
18696
18696
  function a(u, d) {
18697
18697
  const l = new Map(u.map((h) => [h.path, h.status]));
18698
- return d.filter((h) => l.get(h.path) !== h.status).flatMap(
18699
- (h) => h.renameSource ? [h.renameSource, h.path] : [h.path]
18700
- );
18698
+ return d.filter((h) => l.get(h.path) !== h.status).map((h) => h.path);
18701
18699
  }
18702
18700
  async function i(u, d, l, f, h) {
18703
18701
  h && u.id && await r(u.id, l, h);
@@ -19914,19 +19912,19 @@ function EO({ root: e, git: t, status: n, agent: r }) {
19914
19912
  );
19915
19913
  let b, $ = v, P;
19916
19914
  try {
19917
- const I = sn({ ...w, thread: v }), D = y.filter((Ke) => Ke.id !== w.id), ue = await aO(
19915
+ const I = sn({ ...w, thread: v }), D = y.filter((Ke) => Ke.id !== w.id), de = await aO(
19918
19916
  I,
19919
19917
  D,
19920
19918
  r.runFeedbackReply,
19921
19919
  f
19922
- ), Ne = ue.edit ? oO(w, ue.edit) : {}, { spawnFix: Ee, ...W } = Ne, de = ue.answersQuestion ? v.map(
19920
+ ), Ne = de.edit ? oO(w, de.edit) : {}, { spawnFix: Ee, ...W } = Ne, le = de.answersQuestion ? v.map(
19923
19921
  (Ke, pt) => pt === v.length - 1 ? { ...Ke, kind: "clarification" } : Ke
19924
- ) : v, Se = ue.answersQuestion ? de.findLastIndex(
19922
+ ) : v, Se = de.answersQuestion ? le.findLastIndex(
19925
19923
  (Ke) => Ke.kind === "question" && (Ke.state ?? "open") === "open"
19926
- ) : -1, he = Se === -1 ? de : de.map(
19924
+ ) : -1, pe = Se === -1 ? le : le.map(
19927
19925
  (Ke, pt) => pt === Se ? { ...Ke, state: "resolved" } : Ke
19928
19926
  );
19929
- let Ve = ue.reply, ht;
19927
+ let Ve = de.reply, ht;
19930
19928
  if (Ee != null && Ee.length) {
19931
19929
  const Ke = j(e, "papercamp", "config.json");
19932
19930
  if (ht = await Cn(Ke), ht) {
@@ -19953,7 +19951,7 @@ function EO({ root: e, git: t, status: n, agent: r }) {
19953
19951
  }
19954
19952
  }
19955
19953
  const Et = cO(w.fixes, W.fixes);
19956
- if (Et && (Ve = `${Ve} (reopened this idea to re-run)`), $ = [...he, jr(Ve, "chat")], await wt(
19954
+ if (Et && (Ve = `${Ve} (reopened this idea to re-run)`), $ = [...pe, jr(Ve, "chat")], await wt(
19957
19955
  e,
19958
19956
  g,
19959
19957
  vt(w, {
@@ -21257,7 +21255,7 @@ function eN({ root: e }) {
21257
21255
  method: "POST",
21258
21256
  path: "/api/config",
21259
21257
  handle: async (t, n) => {
21260
- var I, D, ue, Ne;
21258
+ var I, D, de, Ne;
21261
21259
  const r = j(e, "papercamp", "config.json"), s = await ke(r);
21262
21260
  if (!s) {
21263
21261
  S(n, 404, { error: "config not found" });
@@ -21285,7 +21283,7 @@ function eN({ root: e }) {
21285
21283
  return;
21286
21284
  }
21287
21285
  if (h !== void 0) {
21288
- for (const de of [
21286
+ for (const le of [
21289
21287
  "phase",
21290
21288
  "planDraft",
21291
21289
  "ideaExtend",
@@ -21293,9 +21291,9 @@ function eN({ root: e }) {
21293
21291
  "feedback",
21294
21292
  "codeReview"
21295
21293
  ]) {
21296
- const Se = h[de], he = typeof Se == "string" ? Se : Se == null ? void 0 : Se.agent;
21297
- if (!he || !ks.includes(he)) {
21298
- S(n, 400, { error: `defaultAgents.${de} must be a known agent id` });
21294
+ const Se = h[le], pe = typeof Se == "string" ? Se : Se == null ? void 0 : Se.agent;
21295
+ if (!pe || !ks.includes(pe)) {
21296
+ S(n, 400, { error: `defaultAgents.${le} must be a known agent id` });
21299
21297
  return;
21300
21298
  }
21301
21299
  }
@@ -21323,7 +21321,7 @@ function eN({ root: e }) {
21323
21321
  S(n, 400, { error: "integration.toolbar.allowProduction must be a boolean" });
21324
21322
  return;
21325
21323
  }
21326
- if (((ue = f == null ? void 0 : f.toolbar) == null ? void 0 : ue.segments) !== void 0) {
21324
+ if (((de = f == null ? void 0 : f.toolbar) == null ? void 0 : de.segments) !== void 0) {
21327
21325
  const Ee = f.toolbar.segments;
21328
21326
  if (!Array.isArray(Ee) || !Ee.every((W) => nu.includes(W))) {
21329
21327
  S(n, 400, {
@@ -22557,7 +22555,7 @@ Zt.command("migrate").description(
22557
22555
  const b = [], $ = await mo(p).catch(() => []);
22558
22556
  for (const P of $.filter((I) => I.endsWith(".md") && I !== "index.md")) {
22559
22557
  const { entries: I, warnings: D } = v(await _t(j(p, P), "utf-8"));
22560
- for (const ue of D) console.warn(` warning: ${P}: ${ue.message}`);
22558
+ for (const de of D) console.warn(` warning: ${P}: ${de.message}`);
22561
22559
  b.push(...I);
22562
22560
  }
22563
22561
  return b;
@@ -22703,15 +22701,15 @@ async function aA(e) {
22703
22701
  });
22704
22702
  continue;
22705
22703
  }
22706
- const ue = $.phases.length;
22704
+ const de = $.phases.length;
22707
22705
  if (console.log(` [audit] ${I} ${$.title}`), await sA(e, $, u, { model: d, effort: l })) {
22708
22706
  try {
22709
22707
  await rA(D, $.id);
22710
- } catch (he) {
22711
- console.log(` [fail] ${I} ${$.title} — ${he.message}`), h = !1, f.push({ id: P, title: $.title, status: "failed" });
22708
+ } catch (pe) {
22709
+ console.log(` [fail] ${I} ${$.title} — ${pe.message}`), h = !1, f.push({ id: P, title: $.title, status: "failed" });
22712
22710
  continue;
22713
22711
  }
22714
- const Ee = await _t(D, "utf-8").catch(() => ""), de = ((b = Ni(Ee).entries[0]) == null ? void 0 : b.phases.length) ?? ue, Se = Math.max(0, de - ue);
22712
+ const Ee = await _t(D, "utf-8").catch(() => ""), le = ((b = Ni(Ee).entries[0]) == null ? void 0 : b.phases.length) ?? de, Se = Math.max(0, le - de);
22715
22713
  console.log(` [done] ${I} ${$.title}`), f.push({ id: P, title: $.title, status: "audited", gapPhases: Se });
22716
22714
  } else
22717
22715
  console.log(` [fail] ${I} ${$.title} — agent exited with error`), h = !1, f.push({ id: P, title: $.title, status: "failed" });