@redocly/replay 0.28.0-next.1 → 0.28.0-next.10

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 (82) hide show
  1. package/dist/replay-AiChatProvider-BWL86hXh.js +6 -0
  2. package/dist/{replay-AiChatProvider-COJYrrQ6.js → replay-AiChatProvider-CY3b_ggu.js} +376 -376
  3. package/dist/{replay-AiChatSqliteDBStorage-BenAoLmM.js → replay-AiChatSqliteDBStorage-BtV53vvj.js} +1 -1
  4. package/dist/{replay-AiChatSqliteDBStorage-CBeRerfX.js → replay-AiChatSqliteDBStorage-CjzLqUwK.js} +6 -6
  5. package/dist/{replay-AiPanel-BN1uduZr.js → replay-AiPanel-B3HBaMPh.js} +712 -715
  6. package/dist/replay-AiPanel-BzaoPsXZ.js +742 -0
  7. package/dist/replay-FileWatcher-BFtAqsmL.js +1 -0
  8. package/dist/replay-FileWatcher-d1_qKRfS.js +364 -0
  9. package/dist/{replay-HistorySqliteDBStorage-CtF6-vY8.js → replay-HistorySqliteDBStorage-Bi5vBQ2T.js} +2 -2
  10. package/dist/replay-SemanticSearchService-CTWesmRy.js +1 -0
  11. package/dist/{replay-SemanticSearchService-OutwGWqD.js → replay-SemanticSearchService-DcR4Q6w6.js} +27 -31
  12. package/dist/{replay-SqliteDBStorage-CrB-WSIX.js → replay-SqliteDBStorage-BeDAsnlF.js} +1 -1
  13. package/dist/{replay-SqliteDBStorage-Cn8L_KB1.js → replay-SqliteDBStorage-BlVDbZhU.js} +49 -49
  14. package/dist/{replay-StepContextSqliteDBStorage-BfAAKDwA.js → replay-StepContextSqliteDBStorage-BkB2NM27.js} +2 -2
  15. package/dist/replay-TauriFileSystemAdapter-B_VaAUfL.js +1 -0
  16. package/dist/replay-TauriFileSystemAdapter-Cu-Q6QS_.js +108 -0
  17. package/dist/replay-TauriRootStorage-Cidjagk-.js +1 -0
  18. package/dist/{replay-TauriRootStorage-DHVdmo5Z.js → replay-TauriRootStorage-DVeU3RvV.js} +213 -212
  19. package/dist/{replay-agent-loop-vzQUCpCA.js → replay-agent-loop-B42P9R-q.js} +1 -1
  20. package/dist/{replay-agent-loop-cbxVIXnO.js → replay-agent-loop-DweKWrQp.js} +11 -11
  21. package/dist/{replay-ai-chat-mappers-pb8lpkUD.js → replay-ai-chat-mappers-Cno0s3T8.js} +1 -1
  22. package/dist/{replay-ai-chat-mappers-BnAf2rpg.js → replay-ai-chat-mappers-DusPRQPG.js} +3 -3
  23. package/dist/{replay-ai-message-parts.schema-E9u9-nqr.js → replay-ai-message-parts.schema-DKLf0SiG.js} +1 -1
  24. package/dist/{replay-create-model-Dr80k74P.js → replay-create-model-CeSlm24x.js} +4 -4
  25. package/dist/{replay-create-model-CqA612v0.js → replay-create-model-DdPq1CIm.js} +3 -3
  26. package/dist/{replay-db-Bq7IGfIa.js → replay-db-Bj8Qpvpw.js} +1 -1
  27. package/dist/{replay-db-C8RC-t2R.js → replay-db-he8XQjrM.js} +1 -1
  28. package/dist/{replay-external-resolver-D6WP4NJY.js → replay-external-resolver-BRs5F07f.js} +7 -7
  29. package/dist/{replay-external-resolver-Bw7R-LTs.js → replay-external-resolver-gQ0egbx7.js} +1 -1
  30. package/dist/{replay-history.schema-5ce6X0R1.js → replay-history.schema-B0lLwmdG.js} +3 -3
  31. package/dist/replay-index-B1qPs-GR.js +4 -0
  32. package/dist/replay-index-C2b91LJZ.js +7013 -0
  33. package/dist/{replay-index-CI5L8ebr.js → replay-index-CA6OI1Qg.js} +1 -1
  34. package/dist/replay-index-CYphcClc.js +1 -0
  35. package/dist/{replay-index-BizzVzWT.js → replay-index-DRb3mixV.js} +65435 -63900
  36. package/dist/replay-index-Dtxwps1s.js +574 -0
  37. package/dist/replay-index-NgGicGfR.js +1 -0
  38. package/dist/{replay-index-BFdS3tY7.js → replay-index-uF3nFq_Y.js} +1 -1
  39. package/dist/{replay-indexes-CfsvVMi_.js → replay-indexes-B3PJtgeh.js} +43 -43
  40. package/dist/replay-lint-C2hyYWRS.js +177 -0
  41. package/dist/{replay-lint-q7b2-PPR.js → replay-lint-gY_wyYPJ.js} +17581 -21140
  42. package/dist/{replay-lint-graphql-CYl9hbRz.js → replay-lint-graphql-BA9t8-Ua.js} +1 -1
  43. package/dist/{replay-lint-graphql-C_f79j2l.js → replay-lint-graphql-DDrnrINc.js} +1 -1
  44. package/dist/replay-periodic-revalidation-BbAt74oL.js +21 -0
  45. package/dist/replay-periodic-revalidation-kmD2RQn1.js +1 -0
  46. package/dist/replay-resolve-BJ_AY-Mn.js +47 -0
  47. package/dist/{replay-resolve-Km_DObpf.js → replay-resolve-_V8uYdTK.js} +470 -468
  48. package/dist/replay-respect-run-CLLZoRh1.js +8392 -0
  49. package/dist/replay-respect-run-qOz91QPQ.js +82 -0
  50. package/dist/replay-step-context.schema-BOprzd6Z.js +21 -0
  51. package/dist/{replay-tauri-path-BrtMOZvF.js → replay-tauri-path-lH8t5rdX.js} +1 -1
  52. package/dist/replay-tauri-path-twTA2lKs.js +22 -0
  53. package/dist/replay-useAiChatQueries-BIqM2KQW.js +215 -0
  54. package/dist/{replay-useAiChatQueries-BR1eEjUB.js → replay-useAiChatQueries-yCsYY1j2.js} +1583 -1371
  55. package/dist/{replay-validate-key-CZSwxFid.js → replay-validate-key-Bh41yY9h.js} +2 -2
  56. package/dist/{replay-validate-key-Cox-cRT6.js → replay-validate-key-_oaOw5Jy.js} +1 -1
  57. package/dist/replay.cjs +1 -1
  58. package/dist/replay.d.ts +10 -3
  59. package/dist/replay.js +14 -14
  60. package/package.json +20 -13
  61. package/dist/replay-AiChatProvider-DjEmmTbN.js +0 -6
  62. package/dist/replay-AiPanel-FAJJA4QT.js +0 -742
  63. package/dist/replay-FileWatcher-DDlINC06.js +0 -1
  64. package/dist/replay-FileWatcher-paEMsDuu.js +0 -352
  65. package/dist/replay-SemanticSearchService-DwIcsNYC.js +0 -1
  66. package/dist/replay-TauriFileSystemAdapter-CocGBrH_.js +0 -99
  67. package/dist/replay-TauriFileSystemAdapter-q89YsNXx.js +0 -1
  68. package/dist/replay-TauriRootStorage-CZXVp2Zw.js +0 -1
  69. package/dist/replay-index-B3sCvU48.js +0 -1
  70. package/dist/replay-index-D3evrr0U.js +0 -6982
  71. package/dist/replay-index-DZwTSW3m.js +0 -25
  72. package/dist/replay-index-DsAn0c_r.js +0 -1
  73. package/dist/replay-index-bspotqBs.js +0 -504
  74. package/dist/replay-lint-D5d7AeDU.js +0 -184
  75. package/dist/replay-periodic-revalidation-BoyLQHtg.js +0 -1
  76. package/dist/replay-periodic-revalidation-Dsp-n7ui.js +0 -21
  77. package/dist/replay-resolve-CftMmcPx.js +0 -47
  78. package/dist/replay-respect-run-CfbJ-uak.js +0 -8200
  79. package/dist/replay-respect-run-DBe6ZUcc.js +0 -78
  80. package/dist/replay-step-context.schema-DBk4jufr.js +0 -21
  81. package/dist/replay-tauri-path-Ek8BSAa0.js +0 -22
  82. package/dist/replay-useAiChatQueries-DjjzEorX.js +0 -215
@@ -1,15 +1,15 @@
1
- import { useContext as Et, createContext as $t } from "react";
2
- import { H as _t, X as ae, ak as H, al as Rt, am as qt, an as Pt, j as O, ac as D, ao as Je, ap as ue, ab as pe, aq as Qe, ar as fe, as as me, at as Nt, au as j, av as X, aw as Xe, ax as Ze, n as he, ay as Ut, az as Dt, aA as Lt, I as Wt, aB as Mt, aC as et, aD as tt, aE as Ft, a6 as Z, aF as jt, T as ot, a5 as nt, aG as Bt, a9 as g, aH as Oe, aI as Yt, aJ as Ae, aK as zt, aL as Ht, aM as Gt, A as rt, h as st } from "./replay-index-BizzVzWT.js";
3
- import { b as k, f as at, a as it, c as ct, d as ee, e as lt, i as xe, h as Ie, R as L, j as Vt, k as Kt, p as Jt, s as Ee, l as Qt } from "./replay-db-C8RC-t2R.js";
4
- import { b as Xt, o as Zt, d as eo, e as p, u as te, f as i, h as E, j as T, n as S, k as U, m as I, q as b, r as we, t as B, v as oe, Z as W, w as to, x as $e, c as oo, s as no, y as ro } from "./replay-create-model-Dr80k74P.js";
5
- import { g as so, c as _e, d as ao, f as io, h as Re, i as co, j as lo } from "./replay-SemanticSearchService-OutwGWqD.js";
6
- import { useInfiniteQuery as uo, useQuery as po } from "@tanstack/react-query";
7
- const G = {
1
+ import { useContext as Ht, createContext as Gt } from "react";
2
+ import { R as Vt, A as be, aJ as re, aK as Kt, aL as Jt, aM as Qt, a4 as x, a as de, az as Y, aN as mt, aO as Oe, ay as Ee, aP as ht, aQ as ue, aR as Z, c as b, aS as Xt, af as G, ad as V, aT as It, aU as pe, ae as $e, aV as Zt, aW as eo, aX as to, aY as oo, aZ as no, a_ as ro, a$ as so, a7 as K, b0 as ao, a8 as ee, a2 as io, b1 as co, b2 as lo, b3 as wt, b4 as yt, b5 as uo, b6 as vt, b7 as xe, b8 as Ae, aa as J, b9 as po, a3 as gt, ba as _e, at as bt, bb as fo, bc as mo, S as k, bd as Be, be as ho, bf as Ye, bg as Io, bh as wo, bi as yo, a1 as kt, a0 as St } from "./replay-index-DRb3mixV.js";
3
+ import { b as C, f as Tt, a as Ct, c as Ot, d as fe, e as At, i as ze, h as Re, R as z, j as vo, k as go, p as bo, s as He, l as ko } from "./replay-db-he8XQjrM.js";
4
+ import { b as So, o as To, d as Co, e as p, u as me, f as i, h as R, j as E, n as A, k as B, m as I, q as T, r as Pe, t as te, v as he, Z as H, w as Oo, x as Ge, c as Ao, s as Eo, y as $o } from "./replay-create-model-CeSlm24x.js";
5
+ import { g as xo, e as Ve, a as _o, b as Ro, c as Ke, d as Po, f as qo } from "./replay-SemanticSearchService-DcR4Q6w6.js";
6
+ import { useInfiniteQuery as No, useQuery as Uo } from "@tanstack/react-query";
7
+ const se = {
8
8
  path: "pathParameters",
9
9
  query: "queryParameters",
10
10
  header: "headers",
11
11
  cookie: "cookies"
12
- }, Ni = {
12
+ }, lc = {
13
13
  run_request: {
14
14
  approveLabel: "Run",
15
15
  denyLabel: "Skip"
@@ -22,7 +22,7 @@ const G = {
22
22
  approveLabel: "Apply",
23
23
  denyLabel: "Dismiss"
24
24
  }
25
- }, Ui = {
25
+ }, dc = {
26
26
  set_active_environment: { approveLabel: "Switch", denyLabel: "Cancel" },
27
27
  add_environment: { approveLabel: "Add", denyLabel: "Cancel" },
28
28
  upsert_input: { approveLabel: "Set", denyLabel: "Cancel" },
@@ -37,29 +37,29 @@ const G = {
37
37
  delete_workflow: { approveLabel: "Delete", denyLabel: "Cancel" },
38
38
  delete_step: { approveLabel: "Delete", denyLabel: "Cancel" },
39
39
  save_tab_to_collection: { approveLabel: "Save", denyLabel: "Cancel" }
40
- }, Di = {
40
+ }, uc = {
41
41
  CHAT: "chat",
42
42
  HISTORY: "history"
43
- }, fo = "report_status", mo = "run_workflow", z = {
43
+ }, Do = "report_status", Wo = "run_workflow", oe = {
44
44
  WEB_SEARCH: "web_search"
45
45
  };
46
- function ho(e) {
46
+ function Lo(e) {
47
47
  switch (e.provider) {
48
- case ae.GEMINI:
48
+ case be.GEMINI:
49
49
  return {
50
- [z.WEB_SEARCH]: eo.tools.googleSearch({})
50
+ [oe.WEB_SEARCH]: Co.tools.googleSearch({})
51
51
  };
52
- case ae.OPENAI:
52
+ case be.OPENAI:
53
53
  return {
54
- [z.WEB_SEARCH]: Zt.tools.webSearch({})
54
+ [oe.WEB_SEARCH]: To.tools.webSearch({})
55
55
  };
56
- case ae.ANTHROPIC:
56
+ case be.ANTHROPIC:
57
57
  return {
58
- [z.WEB_SEARCH]: Xt.tools.webFetch_20250910()
58
+ [oe.WEB_SEARCH]: So.tools.webFetch_20250910()
59
59
  };
60
- case _t:
60
+ case Vt:
61
61
  return {
62
- [z.WEB_SEARCH]: {
62
+ [oe.WEB_SEARCH]: {
63
63
  type: "provider",
64
64
  id: "reunite.web_search",
65
65
  name: "web_search",
@@ -70,52 +70,52 @@ function ho(e) {
70
70
  return {};
71
71
  }
72
72
  }
73
- const Io = ["info", "workflows", "sourceDescriptions"];
74
- function wo(e) {
73
+ const Mo = ["info", "workflows", "sourceDescriptions"];
74
+ function Fo(e) {
75
75
  const t = [];
76
- return e.collectionId && t.push(`Collection ID: ${e.collectionId}`), e.collection?.info?.title && t.push(`Title: ${e.collection.info.title}`), e.collection?.info?.summary && t.push(`Summary: ${e.collection.info.summary}`), e.collection?.info?.description && t.push(`Description: ${e.collection.info.description}`), k(t, `
76
+ return e.collectionId && t.push(`Collection ID: ${e.collectionId}`), e.collection?.info?.title && t.push(`Title: ${e.collection.info.title}`), e.collection?.info?.summary && t.push(`Summary: ${e.collection.info.summary}`), e.collection?.info?.description && t.push(`Description: ${e.collection.info.description}`), C(t, `
77
77
  `);
78
78
  }
79
- function yo(e) {
79
+ function jo(e) {
80
80
  const t = [];
81
81
  if (e.collection?.workflows?.length) {
82
82
  t.push("Workflows:");
83
83
  for (const o of e.collection.workflows)
84
84
  t.push(` workflowId=${o.workflowId} ${o.summary ?? ""}`);
85
85
  }
86
- return k(t, `
86
+ return C(t, `
87
87
  `);
88
88
  }
89
- function vo(e) {
89
+ function Bo(e) {
90
90
  const t = [];
91
91
  if (e.collection?.sourceDescriptions?.length) {
92
92
  t.push("Source descriptions:");
93
93
  for (const o of e.collection.sourceDescriptions)
94
94
  t.push(` name=${o.name} url=${o.url}`);
95
95
  }
96
- return k(t, `
96
+ return C(t, `
97
97
  `);
98
98
  }
99
- function go(e, t) {
99
+ function Yo(e, t) {
100
100
  const o = ["Current tab (collection)"];
101
101
  for (const n of t)
102
102
  switch (n) {
103
103
  case "info":
104
- o.push(wo(e));
104
+ o.push(Fo(e));
105
105
  break;
106
106
  case "workflows":
107
- o.push(yo(e));
107
+ o.push(jo(e));
108
108
  break;
109
109
  case "sourceDescriptions":
110
- o.push(vo(e));
110
+ o.push(Bo(e));
111
111
  break;
112
112
  }
113
- return k(o, `
113
+ return C(o, `
114
114
 
115
115
  `);
116
116
  }
117
- function bo(e, t) {
118
- return k(
117
+ function zo(e, t) {
118
+ return C(
119
119
  [
120
120
  e.collectionId ? `Collection ID: ${e.collectionId}` : null,
121
121
  t.includes("title") && e.title ? `Title: ${e.title}` : null,
@@ -125,8 +125,8 @@ function bo(e, t) {
125
125
  `
126
126
  );
127
127
  }
128
- function ko(e, t) {
129
- return k(
128
+ function Ho(e, t) {
129
+ return C(
130
130
  [
131
131
  t.includes("title") ? e.title : null,
132
132
  e.apiId ? `API ID: ${e.apiId}` : null,
@@ -135,16 +135,16 @@ function ko(e, t) {
135
135
  t.includes("method") && e.method ? `Method: ${e.method}` : null,
136
136
  t.includes("operationId") && e.operationId ? `Operation ID: ${e.operationId}` : null,
137
137
  t.includes("requestBody") && e.requestBodySchema ? `Request body schema: ${e.requestBodySchema}` : null,
138
- t.includes("parameters") && e.parameterDetails ? `Parameter details: ${at(e.parameterDetails)}` : null,
139
- t.includes("security") && e.relatedSecuritySchemes ? `Security schemes: ${it(e.relatedSecuritySchemes)}` : null,
138
+ t.includes("parameters") && e.parameterDetails ? `Parameter details: ${Tt(e.parameterDetails)}` : null,
139
+ t.includes("security") && e.relatedSecuritySchemes ? `Security schemes: ${Ct(e.relatedSecuritySchemes)}` : null,
140
140
  t.includes("tags") && e.tags ? `Tags: ${e.tags.join("; ")}` : null,
141
- t.includes("responses") && e.responseSchemas ? `Responses: ${ct(e.responseSchemas)}` : null
141
+ t.includes("responses") && e.responseSchemas ? `Responses: ${Ot(e.responseSchemas)}` : null
142
142
  ],
143
143
  `
144
144
  `
145
145
  );
146
146
  }
147
- const So = [
147
+ const Go = [
148
148
  "info",
149
149
  "inputs",
150
150
  "parameters",
@@ -153,79 +153,77 @@ const So = [
153
153
  "steps",
154
154
  "wiring"
155
155
  ];
156
- function To(e) {
156
+ function Vo(e) {
157
157
  return !e.inputs || Object.keys(e.inputs).length === 0 ? null : `Workflow inputs (JSON Schema):
158
158
  ${JSON.stringify(e.inputs, null, 2)}`;
159
159
  }
160
- function Co(e) {
160
+ function Ko(e) {
161
161
  return e.outputs?.length ? `Workflow outputs:
162
162
  ${e.outputs.map(
163
163
  (t) => ` id=${t.id} key=${t.key} value=${t.value} active=${t.active}`
164
164
  ).join(`
165
165
  `)}` : null;
166
166
  }
167
- function dt(e) {
167
+ function Et(e) {
168
168
  return e.operation ? ` apiId=${e.operation.apiId} method=${e.operation.method} path=${e.operation.path}` : e.xOperation ? ` method=${e.xOperation.method} path=${e.xOperation.url}` : "";
169
169
  }
170
- function Oo(e) {
170
+ function Jo(e) {
171
171
  return e.steps?.length ? `Steps:
172
- ${e.steps.map(
173
- (t) => ` stepId=${t.stepId} ${dt(t)}`
174
- ).join(`
172
+ ${e.steps.map((t) => ` stepId=${t.stepId} ${Et(t)}`).join(`
175
173
  `)}` : null;
176
174
  }
177
- function Ao(e) {
175
+ function Qo(e) {
178
176
  return e.steps?.length ? `Step wiring (security + outputs per step):
179
177
  ${e.steps.map((o) => {
180
- const n = [` stepId=${o.stepId}${dt(o)}`], r = ee(o.security);
181
- r && n.push(xe(r, " "));
182
- const s = Ie(o.outputs);
183
- return s && n.push(xe(s, " ")), n.join(`
178
+ const n = [` stepId=${o.stepId}${Et(o)}`], r = fe(o.security);
179
+ r && n.push(ze(r, " "));
180
+ const s = Re(o.outputs);
181
+ return s && n.push(ze(s, " ")), n.join(`
184
182
  `);
185
183
  }).join(`
186
184
  `)}` : null;
187
185
  }
188
- function xo(e, t) {
186
+ function Xo(e, t) {
189
187
  switch (t) {
190
188
  case "inputs":
191
- return To(e);
189
+ return Vo(e);
192
190
  case "parameters":
193
- return lt(e.parameters);
191
+ return At(e.parameters);
194
192
  case "security":
195
- return ee(e.security);
193
+ return fe(e.security);
196
194
  case "outputs":
197
- return Co(e);
195
+ return Ko(e);
198
196
  case "steps":
199
- return Oo(e);
197
+ return Jo(e);
200
198
  case "wiring":
201
- return Ao(e);
199
+ return Qo(e);
202
200
  default:
203
201
  return null;
204
202
  }
205
203
  }
206
- function Eo(e) {
204
+ function Zo(e) {
207
205
  const t = [];
208
- return e.collectionId && t.push(`Collection ID: ${e.collectionId}`), e.workflowId && t.push(`Workflow ID: ${e.workflowId}`), e.workflow?.summary && t.push(`Summary: ${e.workflow.summary}`), e.workflow?.description && t.push(`Description: ${e.workflow.description}`), k(t, `
206
+ return e.collectionId && t.push(`Collection ID: ${e.collectionId}`), e.workflowId && t.push(`Workflow ID: ${e.workflowId}`), e.workflow?.summary && t.push(`Summary: ${e.workflow.summary}`), e.workflow?.description && t.push(`Description: ${e.workflow.description}`), C(t, `
209
207
  `);
210
208
  }
211
- function $o(e, t) {
209
+ function en(e, t) {
212
210
  const o = ["Current tab (workflow)"], n = e.workflow;
213
211
  for (const r of t) {
214
212
  if (r === "info") {
215
- o.push(Eo(e));
213
+ o.push(Zo(e));
216
214
  continue;
217
215
  }
218
216
  if (!n)
219
217
  continue;
220
- const s = xo(n, r);
218
+ const s = Xo(n, r);
221
219
  s && o.push(s);
222
220
  }
223
- return k(o, `
221
+ return C(o, `
224
222
 
225
223
  `);
226
224
  }
227
- function _o(e, t) {
228
- return k(
225
+ function tn(e, t) {
226
+ return C(
229
227
  [
230
228
  e.collectionId ? `Collection ID: ${e.collectionId}` : null,
231
229
  e.workflowId ? `Workflow ID: ${e.workflowId}` : null,
@@ -236,7 +234,7 @@ function _o(e, t) {
236
234
  `
237
235
  );
238
236
  }
239
- const Ro = [
237
+ const on = [
240
238
  "info",
241
239
  "parameters",
242
240
  "requestBody",
@@ -245,64 +243,64 @@ const Ro = [
245
243
  "successCriteria",
246
244
  "response"
247
245
  ];
248
- function qo(e) {
246
+ function nn(e) {
249
247
  const t = [
250
248
  `apiId: ${e.apiId}`,
251
249
  `method: ${e.method}`,
252
250
  `path: ${e.path}`,
253
251
  e.operationId ? `operationId: ${e.operationId}` : null
254
252
  ];
255
- return `Step is connected to API (${k(t, ", ")})`;
253
+ return `Step is connected to API (${C(t, ", ")})`;
256
254
  }
257
- function Po(e) {
255
+ function rn(e) {
258
256
  const t = [`method: ${e.method}`, `url: ${e.url}`];
259
- return `Step is not connected to API (${k(t, ", ")})`;
257
+ return `Step is not connected to API (${C(t, ", ")})`;
260
258
  }
261
- function No(e) {
259
+ function sn(e) {
262
260
  return e.description?.trim() ? `Description:
263
261
  ${e.description}` : null;
264
262
  }
265
- function Uo(e, t) {
263
+ function an(e, t) {
266
264
  switch (t) {
267
265
  case "parameters":
268
- return lt(e.parameters) || null;
266
+ return At(e.parameters) || null;
269
267
  case "requestBody":
270
- return Kt(e.requestBody) || null;
268
+ return go(e.requestBody) || null;
271
269
  case "security":
272
- return ee(e.security) || null;
270
+ return fe(e.security) || null;
273
271
  case "outputs":
274
- return Ie(e.outputs) || null;
272
+ return Re(e.outputs) || null;
275
273
  case "successCriteria":
276
- return Vt(e.successCriteria) || null;
274
+ return vo(e.successCriteria) || null;
277
275
  default:
278
276
  return null;
279
277
  }
280
278
  }
281
- function Do(e) {
279
+ function cn(e) {
282
280
  const t = [];
283
281
  e.collectionId && t.push(`Collection ID: ${e.collectionId}`), e.workflowId && t.push(`Workflow ID: ${e.workflowId}`), e.stepId && t.push(`Step ID: ${e.stepId}`), t.push(`Saved in collection: ${e.step ? "yes" : "no"}`);
284
282
  const o = e.draftStep ?? e.step;
285
283
  if (o) {
286
- if (t.push(No(o)), o.operation) {
284
+ if (t.push(sn(o)), o.operation) {
287
285
  const n = o.operation;
288
- t.push(qo(n));
286
+ t.push(nn(n));
289
287
  } else if (o.xOperation) {
290
288
  const n = o.xOperation;
291
- t.push(Po(n));
289
+ t.push(rn(n));
292
290
  }
293
291
  }
294
292
  return e.response && t.push(
295
293
  `Last response: status=${e.response.status} durationMs=${e.response.duration} size=${e.response.size}`
296
- ), e.requestError && t.push(`Request error: ${e.requestError}`), k(t, `
294
+ ), e.requestError && t.push(`Request error: ${e.requestError}`), C(t, `
297
295
  `);
298
296
  }
299
- function Lo(e) {
297
+ function ln(e) {
300
298
  if (!e.response) return null;
301
299
  const t = e.response, o = t.headers?.length ? t.headers.map((s) => ` ${s[0]}: ${s[1]}`) : [];
302
300
  let n = "";
303
301
  t.bodyNotStored ? n = " (body not stored)" : t.body && (n = `
304
302
  Body:
305
- ${t.body.length > L ? `${t.body.slice(0, L)}…` : t.body}`);
303
+ ${t.body.length > z ? `${t.body.slice(0, z)}…` : t.body}`);
306
304
  const r = [
307
305
  "Last response (full)",
308
306
  `status: ${t.status}`,
@@ -310,33 +308,33 @@ ${t.body.length > L ? `${t.body.slice(0, L)}…` : t.body}`);
310
308
  `durationMs: ${t.duration}`,
311
309
  `size: ${t.size}`,
312
310
  o.length > 0 ? `Headers:
313
- ${k(o, `
311
+ ${C(o, `
314
312
  `)}` : null,
315
313
  n || null
316
314
  ];
317
- return k(r, `
315
+ return C(r, `
318
316
  `);
319
317
  }
320
- function qe(e, t) {
318
+ function Je(e, t) {
321
319
  const o = [];
322
320
  for (const n of t) {
323
- const r = Uo(e, n);
321
+ const r = an(e, n);
324
322
  r && o.push(r);
325
323
  }
326
324
  return o.length ? o.filter(Boolean).join(`
327
325
  `) : "";
328
326
  }
329
- function Wo(e, t) {
327
+ function dn(e, t) {
330
328
  const o = ["Current tab (step)"];
331
- return t.length === 0 ? null : (t.includes("info") && o.push(Do(e)), e.draftStep ? o.push(qe(e.draftStep, t)) : e.step && o.push(qe(e.step, t)), t.includes("response") && o.push(Lo(e)), k(o, `
329
+ return t.length === 0 ? null : (t.includes("info") && o.push(cn(e)), e.draftStep ? o.push(Je(e.draftStep, t)) : e.step && o.push(Je(e.step, t)), t.includes("response") && o.push(ln(e)), C(o, `
332
330
 
333
331
  `));
334
332
  }
335
- function Mo(e) {
333
+ function un(e) {
336
334
  return e?.trim() ? `Description:
337
335
  ${e}` : null;
338
336
  }
339
- function Fo(e, t) {
337
+ function pn(e, t) {
340
338
  if (e.apiId && e.path && e.method) {
341
339
  const o = [
342
340
  `apiId: ${e.apiId}`,
@@ -344,171 +342,171 @@ function Fo(e, t) {
344
342
  t.includes("path") ? `path: ${e.path}` : null,
345
343
  t.includes("operationId") && e.operationId ? `operationId: ${e.operationId}` : null
346
344
  ];
347
- return `Step is connected to API (${k(o, ", ")})`;
345
+ return `Step is connected to API (${C(o, ", ")})`;
348
346
  }
349
347
  if (e.path || e.method) {
350
348
  const o = [
351
349
  t.includes("method") && e.method ? `method: ${e.method}` : null,
352
350
  t.includes("path") && e.path ? `url: ${e.path}` : null
353
351
  ];
354
- return `Step is not connected to API (${k(o, ", ")})`;
352
+ return `Step is not connected to API (${C(o, ", ")})`;
355
353
  }
356
354
  return null;
357
355
  }
358
- function jo(e, t) {
359
- return k(
356
+ function fn(e, t) {
357
+ return C(
360
358
  [
361
359
  e.collectionId ? `Collection ID: ${e.collectionId}` : null,
362
360
  e.workflowId ? `Workflow ID: ${e.workflowId}` : null,
363
361
  e.stepId ? `Step ID: ${e.stepId}` : null,
364
- t.includes("description") ? Mo(e.description) : null,
365
- Fo(e, t),
362
+ t.includes("description") ? un(e.description) : null,
363
+ pn(e, t),
366
364
  t.includes("requestBody") && e.requestBodySchema ? `Request body schema: ${e.requestBodySchema}` : null,
367
- t.includes("parameters") && e.parameterDetails ? `Parameter details: ${at(e.parameterDetails)}` : null,
365
+ t.includes("parameters") && e.parameterDetails ? `Parameter details: ${Tt(e.parameterDetails)}` : null,
368
366
  t.includes("successCriteria") && e.successCriteria?.length ? `Success criteria: ${e.successCriteria.join("; ")}` : null,
369
367
  t.includes("tags") && e.tags ? `Tags: ${e.tags.join("; ")}` : null,
370
- t.includes("security") && e.relatedSecuritySchemes ? `Security schemes: ${it(e.relatedSecuritySchemes)}` : null,
371
- t.includes("responses") && e.responseSchemas ? `Responses: ${ct(e.responseSchemas)}` : null
368
+ t.includes("security") && e.relatedSecuritySchemes ? `Security schemes: ${Ct(e.relatedSecuritySchemes)}` : null,
369
+ t.includes("responses") && e.responseSchemas ? `Responses: ${Ot(e.responseSchemas)}` : null
372
370
  ],
373
371
  `
374
372
  `
375
373
  );
376
374
  }
377
- function Bo(e, t) {
378
- return e.type === "collection" ? bo(e, t) : e.type === "workflow" ? _o(e, t) : e.type === "step" ? jo(e, t) : ko(e, t);
375
+ function mn(e, t) {
376
+ return e.type === "collection" ? zo(e, t) : e.type === "workflow" ? tn(e, t) : e.type === "step" ? fn(e, t) : Ho(e, t);
379
377
  }
380
- function Yo(e, t) {
381
- return e.map((o) => Bo(o, t));
378
+ function hn(e, t) {
379
+ return e.map((o) => mn(o, t));
382
380
  }
383
- const zo = ["info", "result", "severity"], Ho = 500, Go = L * 2;
384
- function Vo(e) {
381
+ const In = ["info", "result", "severity"], wn = 500, yn = z * 2;
382
+ function vn(e) {
385
383
  const t = [];
386
- return e.collectionId && t.push(`Collection ID: ${e.collectionId}`), e.workflowId && t.push(`Workflow ID: ${e.workflowId}`), e.workflow?.summary && t.push(`Summary: ${e.workflow.summary}`), e.workflow?.description && t.push(`Description: ${e.workflow.description}`), e.runDate && t.push(`Run date: ${new Date(e.runDate).toISOString()}`), k(t, `
384
+ return e.collectionId && t.push(`Collection ID: ${e.collectionId}`), e.workflowId && t.push(`Workflow ID: ${e.workflowId}`), e.workflow?.summary && t.push(`Summary: ${e.workflow.summary}`), e.workflow?.description && t.push(`Description: ${e.workflow.description}`), e.runDate && t.push(`Run date: ${new Date(e.runDate).toISOString()}`), C(t, `
387
385
  `);
388
386
  }
389
- function Ko(e) {
387
+ function gn(e) {
390
388
  return `Severity settings:
391
389
  ${JSON.stringify(e.severitySettings, null, 2)}`;
392
390
  }
393
- function Jo(e, t) {
391
+ function bn(e, t) {
394
392
  return e.length > t ? `${e.slice(0, t)}…` : e;
395
393
  }
396
- function Pe(e, t, o, n = !1) {
394
+ function Qe(e, t, o, n = !1) {
397
395
  if (e == null || e === "") return "(empty)";
398
396
  const r = typeof e == "string" ? e : n ? JSON.stringify(e, null, 2) : JSON.stringify(e);
399
- return Jo(H(r, t), o);
397
+ return bn(re(r, t), o);
400
398
  }
401
- function Qo(e, t) {
399
+ function kn(e, t) {
402
400
  const o = e.request?.method || e["x-operation"]?.method, n = e.verboseLog ? `${e.verboseLog.host}${e.verboseLog.path}` : e.request?.url || e["x-operation"]?.url, r = e.response?.statusCode, s = [`${e.stepId}:`];
403
401
  (o || n) && s.push(
404
- [o?.toUpperCase(), n ? H(n, t) : null].filter(Boolean).join(" "),
402
+ [o?.toUpperCase(), n ? re(n, t) : null].filter(Boolean).join(" "),
405
403
  "->"
406
- ), s.push(`status=${r ?? "n/a"}`, qt(e) ? "passed" : "failed");
407
- const a = e.checks ? Pt(e.checks) : [];
404
+ ), s.push(`status=${r ?? "n/a"}`, Jt(e) ? "passed" : "failed");
405
+ const a = e.checks ? Qt(e.checks) : [];
408
406
  if (a.length > 0) {
409
407
  const l = a.map(
410
- (c) => c.message ? `${c.name}: ${H(c.message, t)}` : c.name
408
+ (c) => c.message ? `${c.name}: ${re(c.message, t)}` : c.name
411
409
  );
412
410
  s.push(`(${l.join("; ")})`);
413
411
  }
414
412
  return s.join(" ");
415
413
  }
416
- function Xo(e, t, o) {
417
- const { steps: n, totalSteps: r, passedSteps: s, succeeded: a, timedOut: l } = Rt(e), u = [`Run status: ${a ? "SUCCEEDED" : "FAILED"} (${s}/${r} steps passed, ${e.totalTimeMs}ms total${l ? ", global timeout reached" : ""})`];
414
+ function Sn(e, t, o) {
415
+ const { steps: n, totalSteps: r, passedSteps: s, succeeded: a, timedOut: l } = Kt(e), d = [`Run status: ${a ? "SUCCEEDED" : "FAILED"} (${s}/${r} steps passed, ${e.totalTimeMs}ms total${l ? ", global timeout reached" : ""})`];
418
416
  if (n.length > 0) {
419
- const d = [];
420
- let m = Go, f = 0;
421
- for (const { step: y } of n) {
422
- if (d.push(` ${Qo(y, t)}`), m <= 0) {
423
- f++;
417
+ const u = [];
418
+ let f = yn, m = 0;
419
+ for (const { step: g } of n) {
420
+ if (u.push(` ${kn(g, t)}`), f <= 0) {
421
+ m++;
424
422
  continue;
425
423
  }
426
- const v = Pe(y.response?.body, t, Ho);
427
- m -= v.length, d.push(` body: ${v}`);
424
+ const v = Qe(g.response?.body, t, wn);
425
+ f -= v.length, u.push(` body: ${v}`);
428
426
  }
429
- f > 0 && d.push(
430
- ` (${f} step body previews omitted to save space; request them via stepIds)`
431
- ), u.push(`Steps:
432
- ${d.join(`
427
+ m > 0 && u.push(
428
+ ` (${m} step body previews omitted to save space; request them via stepIds)`
429
+ ), d.push(`Steps:
430
+ ${u.join(`
433
431
  `)}`);
434
432
  }
435
- for (const d of o ?? []) {
436
- const m = n.find((f) => f.step.stepId === d);
437
- u.push(
438
- m ? `Full response body for step ${d}:
439
- ${Pe(
440
- m.step.response?.body,
433
+ for (const u of o ?? []) {
434
+ const f = n.find((m) => m.step.stepId === u);
435
+ d.push(
436
+ f ? `Full response body for step ${u}:
437
+ ${Qe(
438
+ f.step.response?.body,
441
439
  t,
442
- L,
440
+ z,
443
441
  !0
444
- )}` : `Full response body for step ${d}: step not found in this run.`
442
+ )}` : `Full response body for step ${u}: step not found in this run.`
445
443
  );
446
444
  }
447
- return k(u, `
445
+ return C(d, `
448
446
  `);
449
447
  }
450
- function Zo(e, t) {
448
+ function Tn(e, t) {
451
449
  const o = e.secretValues ? [...e.secretValues] : void 0;
452
450
  if (e.runStatus === "running")
453
451
  return "Run status: RUNNING - the workflow is still executing; re-read this section to get the outcome, which will be reported as SUCCEEDED or FAILED once the run finishes.";
454
452
  if (e.runStatus === "error") {
455
- const n = `Run status: FAILED - execution error: ${H(
453
+ const n = `Run status: FAILED - execution error: ${re(
456
454
  e.runError || "unknown error",
457
455
  o
458
456
  )}`;
459
457
  return e.result ? `${n}
460
458
  (the stored result is from an earlier run and is omitted as stale)` : n;
461
459
  }
462
- return e.result ? Xo(e.result, o, t?.stepIds) : "Run status: NOT STARTED - no run has executed on this tab yet.";
460
+ return e.result ? Sn(e.result, o, t?.stepIds) : "Run status: NOT STARTED - no run has executed on this tab yet.";
463
461
  }
464
- function en(e, t, o) {
462
+ function Cn(e, t, o) {
465
463
  const n = ["Current tab (workflow run)"];
466
464
  for (const r of t)
467
465
  switch (r) {
468
466
  case "info":
469
- n.push(Vo(e));
467
+ n.push(vn(e));
470
468
  break;
471
469
  case "severity":
472
- n.push(Ko(e));
470
+ n.push(gn(e));
473
471
  break;
474
472
  case "result":
475
- n.push(Zo(e, o));
473
+ n.push(Tn(e, o));
476
474
  break;
477
475
  }
478
- return k(n, `
476
+ return C(n, `
479
477
 
480
478
  `);
481
479
  }
482
- function tn(e, t = ["info"], o) {
480
+ function On(e, t = ["info"], o) {
483
481
  if (!e)
484
482
  return null;
485
483
  switch (e.type) {
486
- case O.Step:
487
- return Wo(e, t);
488
- case O.Workflow:
489
- return $o(e, t);
490
- case O.Collection:
491
- return go(e, t);
492
- case O.WorkflowRun:
493
- return en(e, t, o);
484
+ case x.Step:
485
+ return dn(e, t);
486
+ case x.Workflow:
487
+ return en(e, t);
488
+ case x.Collection:
489
+ return Yo(e, t);
490
+ case x.WorkflowRun:
491
+ return Cn(e, t, o);
494
492
  }
495
493
  }
496
- function on(e) {
494
+ function An(e) {
497
495
  switch (e.type) {
498
- case O.Collection:
499
- return Io;
500
- case O.Workflow:
501
- return So;
502
- case O.Step:
503
- return Ro;
504
- case O.WorkflowRun:
505
- return zo;
496
+ case x.Collection:
497
+ return Mo;
498
+ case x.Workflow:
499
+ return Go;
500
+ case x.Step:
501
+ return on;
502
+ case x.WorkflowRun:
503
+ return In;
506
504
  }
507
505
  }
508
- function ut(e) {
506
+ function $t(e) {
509
507
  return e.trim().replace(/\s+/g, " ").replace(/[.!?:;,…]+$/, "").toLowerCase();
510
508
  }
511
- function nn(e, t) {
509
+ function En(e, t) {
512
510
  const o = [];
513
511
  let n = 0;
514
512
  for (const r of e ?? [])
@@ -517,7 +515,7 @@ function nn(e, t) {
517
515
  s.type === "tool-call" && (s.toolName === t ? (n += 1, o.push(s.input)) : n = 0);
518
516
  return { priorInputs: o, consecutiveCalls: n };
519
517
  }
520
- function rn(e, t, o) {
518
+ function $n(e, t, o) {
521
519
  const n = [];
522
520
  let r = !1;
523
521
  for (const s of e) {
@@ -526,22 +524,22 @@ function rn(e, t, o) {
526
524
  }
527
525
  return { blocked: r, notes: n };
528
526
  }
529
- function pt(e) {
527
+ function xt(e) {
530
528
  const t = e.warn !== void 0 ? "warn" : "block", o = e.warn !== void 0 ? e.warn : e.block;
531
529
  return (n, r) => {
532
- const s = Ne(e.key, n);
533
- return s === null ? null : r.priorInputs.some((l) => Ne(e.key, l) === s) ? { action: t, message: o } : null;
530
+ const s = Xe(e.key, n);
531
+ return s === null ? null : r.priorInputs.some((l) => Xe(e.key, l) === s) ? { action: t, message: o } : null;
534
532
  };
535
533
  }
536
- function Ne(e, t) {
534
+ function Xe(e, t) {
537
535
  try {
538
536
  return e(t);
539
537
  } catch {
540
538
  return null;
541
539
  }
542
540
  }
543
- function sn(e) {
544
- const t = Ue("warn", e.warnAfter, e.warnMessage), o = Ue("block", e.blockAfter, e.blockMessage);
541
+ function xn(e) {
542
+ const t = Ze("warn", e.warnAfter, e.warnMessage), o = Ze("block", e.blockAfter, e.blockMessage);
545
543
  if (!t && !o)
546
544
  throw new Error("consecutiveCallsRule requires at least warnAfter or blockAfter");
547
545
  if (t && o && o.after <= t.after)
@@ -551,7 +549,7 @@ function sn(e) {
551
549
  return o && s >= o.after ? { action: "block", message: o.message(s) } : t && s >= t.after ? { action: "warn", message: t.message(s) } : null;
552
550
  };
553
551
  }
554
- function Ue(e, t, o) {
552
+ function Ze(e, t, o) {
555
553
  if (!(t === void 0 && o === void 0)) {
556
554
  if (t === void 0 || o === void 0)
557
555
  throw new Error(`consecutiveCallsRule requires ${e}After and ${e}Message together`);
@@ -560,7 +558,7 @@ function Ue(e, t, o) {
560
558
  return { after: t, message: o };
561
559
  }
562
560
  }
563
- function an(e) {
561
+ function _n(e) {
564
562
  if (!e || typeof e.safeParse != "function")
565
563
  return;
566
564
  const t = e;
@@ -569,37 +567,37 @@ function an(e) {
569
567
  return n.success ? n.data : null;
570
568
  };
571
569
  }
572
- function cn(e, t, o, n) {
570
+ function Rn(e, t, o, n) {
573
571
  return !t || t.length === 0 ? o : async (r, s) => {
574
- const a = nn(s?.messages, e), l = {
572
+ const a = En(s?.messages, e), l = {
575
573
  consecutiveCalls: a.consecutiveCalls,
576
- priorInputs: n ? a.priorInputs.map(n).filter((d) => d !== null) : a.priorInputs
577
- }, c = rn(t, r, l);
574
+ priorInputs: n ? a.priorInputs.map(n).filter((u) => u !== null) : a.priorInputs
575
+ }, c = $n(t, r, l);
578
576
  if (c.blocked)
579
577
  return { isError: !1, blocked: !0, note: c.notes.join(" ") };
580
- const u = await o(r, s);
581
- return c.notes.length === 0 || !ln(u) ? u : {
582
- ...u,
583
- note: [u.note, ...c.notes].filter(Boolean).join(" ")
578
+ const d = await o(r, s);
579
+ return c.notes.length === 0 || !Pn(d) ? d : {
580
+ ...d,
581
+ note: [d.note, ...c.notes].filter(Boolean).join(" ")
584
582
  };
585
583
  };
586
584
  }
587
- function ln(e) {
585
+ function Pn(e) {
588
586
  return e !== null && typeof e == "object" && e.isError === !1;
589
587
  }
590
- function dn(e, t) {
588
+ function qn(e, t) {
591
589
  return {
592
590
  name: e.name,
593
591
  definition: e.definition,
594
- execute: cn(
592
+ execute: Rn(
595
593
  e.name,
596
594
  e.guards,
597
595
  e.createExecutor(t),
598
- an(e.definition.inputSchema)
596
+ _n(e.definition.inputSchema)
599
597
  )
600
598
  };
601
599
  }
602
- const un = {
600
+ const Nn = {
603
601
  messages: [],
604
602
  isStreaming: !1,
605
603
  sendMessage: async () => {
@@ -612,62 +610,56 @@ const un = {
612
610
  },
613
611
  chatStatus: "ready",
614
612
  chatError: void 0
615
- }, pn = $t(
616
- un
613
+ }, Un = Gt(
614
+ Nn
617
615
  );
618
- function Li() {
619
- return Et(pn);
616
+ function pc() {
617
+ return Ht(Un);
620
618
  }
621
- const fn = p({
619
+ const Dn = p({
622
620
  message: i(),
623
- details: te().optional()
624
- });
625
- p({
626
- collectionId: i().min(1).describe("Target collection id."),
627
- workflowId: i().min(1).describe("Target workflow id."),
628
- stepId: i().min(1).describe("Target step id.")
629
- });
630
- const ye = p({
631
- action: T(["add", "update", "remove"]).describe('Action to perform: "add", "update" or "remove".'),
632
- approved: E().default(!0)
633
- }), R = ye.extend({
621
+ details: me().optional()
622
+ }), qe = p({
623
+ action: E(["add", "update", "remove"]).describe('Action to perform: "add", "update" or "remove".'),
624
+ approved: R().default(!0)
625
+ }), L = qe.extend({
634
626
  id: i().optional().describe("Existing item id. Required for update/remove actions.")
635
- }), mn = ye.extend({
636
- index: S().int().min(0).optional().describe("Existing item index. Required for update/remove actions.")
637
- }), hn = p({
627
+ }), Wn = qe.extend({
628
+ index: A().int().min(0).optional().describe("Existing item index. Required for update/remove actions.")
629
+ }), Ln = p({
638
630
  isError: I(!1),
639
631
  blocked: I(!0),
640
632
  note: i(),
641
- data: U().optional(),
642
- error: U().optional()
633
+ data: B().optional(),
634
+ error: B().optional()
643
635
  });
644
- function $(e) {
645
- return we([
636
+ function P(e) {
637
+ return Pe([
646
638
  p({
647
639
  isError: I(!0),
648
- error: fn,
649
- data: U().optional(),
650
- blocked: U().optional()
640
+ error: Dn,
641
+ data: B().optional(),
642
+ blocked: B().optional()
651
643
  }),
652
644
  p({
653
645
  isError: I(!1),
654
646
  data: e,
655
- error: U().optional(),
647
+ error: B().optional(),
656
648
  note: i().optional(),
657
- blocked: U().optional()
649
+ blocked: B().optional()
658
650
  }),
659
- hn
651
+ Ln
660
652
  ]);
661
653
  }
662
- const In = p({
663
- status: T(["applied", "failed"]),
654
+ const Mn = p({
655
+ status: E(["applied", "failed"]),
664
656
  summary: i().optional()
665
- }), wn = p({
666
- totalChanges: S().int().min(0),
667
- approvedChanges: S().int().min(0),
668
- applied: b(In),
657
+ }), Fn = p({
658
+ totalChanges: A().int().min(0),
659
+ approvedChanges: A().int().min(0),
660
+ applied: T(Mn),
669
661
  resultingState: i().optional().describe("Resulting state of the mutated fields after all changes were applied.")
670
- }), ft = $(wn), yn = "Read structured state from the **active** Replay tab.\n\n**What it does**\n- Returns structured data for the active tab.\n- Read-only: does not open/switch tabs and does not mutate saved or unsaved content.\n- Returns UI-facing tab data (editable fields, configured values, responses/results), not a full OpenAPI schema dump.\n\n**Use when**\n- You need to verify UI state in the active tab after an action (edit, save, execute, rerun, tab switch).\n- You need to inspect request/response/result content as rendered in Replay UI.\n\n**Never use when**\n- You are gathering **initial schema/context** for a request from project assets (OpenAPI/Arazzo); use project-asset lookup with exact ids/coordinates.\n- You need IDs or operation/workflow coordinates from project assets; resolve them via project-asset lookup, not active-tab UI reads.\n- You need a different tab; this tool never changes focus.\n- You need to run a request or change any saved/unsaved tab content; this tool is strictly read-only.\n\n**Input guidance**\n- Treat IDs from `info` as canonical for follow-up actions.\n- Request only needed sections and combine them in one call.\n- Prefer including `info` unless you need only one slice.\n- Sections by tab type:\n - Collection tab: `info`, `workflows`, `sourceDescriptions`.\n - Workflow tab: `info`, `inputs`, `parameters`, `security`, `outputs`, `steps`, `wiring` (every step's security bindings + outputs in one call - inspect or verify multi-step wiring without opening step tabs).\n - Step tab: `info`, `parameters`, `requestBody`, `security`, `outputs`, `successCriteria`, `response`.\n - Workflow run tab: `info`, `result` (status, per-step outcomes, masked bodies; `stepIds` fetches full ones), `severity`.\n- Invalid sections are skipped; if none apply, response falls back to `info`.\n\n**Loop/budget guidance**\n- Read each needed section once per turn.\n- Re-read only after mutation/save, or when you need to inspect new output.\n- If `result` is RUNNING, re-read until the run finishes.", vn = T([
662
+ }), _t = P(Fn), jn = "Read structured state from the **active** Replay tab.\n\n**What it does**\n- Returns structured data for the active tab.\n- Read-only: does not open/switch tabs and does not mutate saved or unsaved content.\n- Returns UI-facing tab data (editable fields, configured values, responses/results), not a full OpenAPI schema dump.\n\n**Use when**\n- You need to verify UI state in the active tab after an action (edit, save, execute, rerun, tab switch).\n- You need to inspect request/response/result content as rendered in Replay UI.\n\n**Never use when**\n- You are gathering **initial schema/context** for a request from project assets (OpenAPI/Arazzo); use project-asset lookup with exact ids/coordinates.\n- You need IDs or operation/workflow coordinates from project assets; resolve them via project-asset lookup, not active-tab UI reads.\n- You need a different tab; this tool never changes focus.\n- You need to run a request or change any saved/unsaved tab content; this tool is strictly read-only.\n\n**Input guidance**\n- Treat IDs from `info` as canonical for follow-up actions.\n- Request only needed sections and combine them in one call.\n- Prefer including `info` unless you need only one slice.\n- Sections by tab type:\n - Collection tab: `info`, `workflows`, `sourceDescriptions`.\n - Workflow tab: `info`, `inputs`, `parameters`, `security`, `outputs`, `steps`, `wiring` (every step's security bindings + outputs in one call - inspect or verify multi-step wiring without opening step tabs).\n - Step tab: `info`, `parameters`, `requestBody`, `security`, `outputs`, `successCriteria`, `response`.\n - Workflow run tab: `info`, `result` (status, per-step outcomes, masked bodies; `stepIds` fetches full ones), `severity`.\n- Invalid sections are skipped; if none apply, response falls back to `info`.\n\n**Loop/budget guidance**\n- Read each needed section once per turn.\n- Re-read only after mutation/save, or when you need to inspect new output.\n- If `result` is RUNNING, re-read until the run finishes.", Bn = E([
671
663
  "info",
672
664
  "workflows",
673
665
  "sourceDescriptions",
@@ -682,19 +674,19 @@ const In = p({
682
674
  "response",
683
675
  "result",
684
676
  "severity"
685
- ]), gn = B({
686
- sections: b(vn).min(1).describe(
677
+ ]), Yn = te({
678
+ sections: T(Bn).min(1).describe(
687
679
  "Content blocks to include in the response. Use tab-type-specific sections from the tool description; invalid sections for the current tab are ignored."
688
680
  ),
689
- stepIds: b(i()).min(1).optional().describe(
681
+ stepIds: T(i()).min(1).optional().describe(
690
682
  "Workflow run tabs only, together with the `result` section: executed step ids to return the full (secret-masked) response body for. Use after the per-step preview proves insufficient."
691
683
  )
692
- }), bn = p({
684
+ }), zn = p({
693
685
  message: i()
694
- }), kn = $(bn), Sn = {
695
- description: yn,
696
- inputSchema: gn,
697
- outputSchema: kn,
686
+ }), Hn = P(zn), Gn = {
687
+ description: jn,
688
+ inputSchema: Yn,
689
+ outputSchema: Hn,
698
690
  needsApproval: !1
699
691
  };
700
692
  function h(e, t) {
@@ -703,22 +695,22 @@ function h(e, t) {
703
695
  error: { message: e, details: t }
704
696
  };
705
697
  }
706
- function Tn(e, t) {
707
- const o = on(e), n = [], r = [];
698
+ function Vn(e, t) {
699
+ const o = An(e), n = [], r = [];
708
700
  for (const s of t)
709
701
  o.includes(s) ? n.push(s) : r.push(s);
710
702
  return { sections: n, skipped: r };
711
703
  }
712
- function Cn(e) {
704
+ function Kn(e) {
713
705
  return async (t, o) => {
714
706
  const n = e();
715
707
  if (!n)
716
708
  return h("No active tab data available.");
717
- const { sections: r, skipped: s } = Tn(n, t.sections), a = r.length > 0 ? r : ["info"];
718
- let c = tn(n, a, { stepIds: t.stepIds }) ?? "Unable to build a summary for the active tab.";
709
+ const { sections: r, skipped: s } = Vn(n, t.sections), a = r.length > 0 ? r : ["info"];
710
+ let c = On(n, a, { stepIds: t.stepIds }) ?? "Unable to build a summary for the active tab.";
719
711
  return s.length > 0 && (c += `
720
712
 
721
- (Sections not applicable for this tab type were omitted: ${s.join(", ")}.)`), r.length === 0 && t.sections.length > 0 && (c += "\n\n(No requested sections applied to this tab type; showing `info` instead.)"), t.stepIds?.length && (n.type !== O.WorkflowRun ? c += `
713
+ (Sections not applicable for this tab type were omitted: ${s.join(", ")}.)`), r.length === 0 && t.sections.length > 0 && (c += "\n\n(No requested sections applied to this tab type; showing `info` instead.)"), t.stepIds?.length && (n.type !== x.WorkflowRun ? c += `
722
714
 
723
715
  (stepIds applies only to workflow run tabs.)` : a.includes("result") || (c += "\n\n(stepIds requires the `result` section.)")), {
724
716
  isError: !1,
@@ -726,11 +718,11 @@ function Cn(e) {
726
718
  };
727
719
  };
728
720
  }
729
- const On = {
721
+ const Jn = {
730
722
  name: "get_current_tab",
731
- definition: Sn,
732
- createExecutor: (e) => Cn(e.getActiveTabDetailedData)
733
- }, An = `Read top-level metadata of a loaded OpenAPI document in the current Replay project.
723
+ definition: Gn,
724
+ createExecutor: (e) => Kn(e.getActiveTabDetailedData)
725
+ }, Qn = `Read top-level metadata of a loaded OpenAPI document in the current Replay project.
734
726
 
735
727
  **What it does**
736
728
  - Scan: omit \`field\` to list the metadata fields present in the document, each with its shape (and item count for lists/maps).
@@ -745,7 +737,7 @@ const On = {
745
737
 
746
738
  **Input guidance**
747
739
  - \`apiId\` is required (the loaded API's id, the same identifier the search tool uses).
748
- - Read one \`field\` at a time; use \`cursor\` only to continue a section you already started.`, xn = B({
740
+ - Read one \`field\` at a time; use \`cursor\` only to continue a section you already started.`, Xn = te({
749
741
  apiId: i().describe(
750
742
  "ID of the loaded API document to read (the API URI, the same identifier used by the search tool)."
751
743
  ),
@@ -755,98 +747,98 @@ const On = {
755
747
  cursor: i().optional().describe(
756
748
  "Opaque cursor to continue a previously truncated section. Only meaningful together with `field`."
757
749
  )
758
- }), En = p({
750
+ }), Zn = p({
759
751
  name: i(),
760
- kind: T(["scalar", "object", "array"]),
761
- count: S().int().nonnegative().optional()
762
- }), $n = p({
752
+ kind: E(["scalar", "object", "array"]),
753
+ count: A().int().nonnegative().optional()
754
+ }), er = p({
763
755
  name: i(),
764
756
  hint: i()
765
- }), _n = p({
766
- available: b(En),
767
- blocked: b($n)
768
- }), Rn = p({
757
+ }), tr = p({
758
+ available: T(Zn),
759
+ blocked: T(er)
760
+ }), or = p({
769
761
  field: i(),
770
- value: te(),
771
- start: S().int().nonnegative().optional(),
772
- end: S().int().nonnegative().optional(),
773
- total: S().int().nonnegative().optional(),
774
- truncated: E(),
762
+ value: me(),
763
+ start: A().int().nonnegative().optional(),
764
+ end: A().int().nonnegative().optional(),
765
+ total: A().int().nonnegative().optional(),
766
+ truncated: R(),
775
767
  nextCursor: i().nullable()
776
- }), qn = we([_n, Rn]), Pn = $(qn), Nn = {
777
- description: An,
778
- inputSchema: xn,
779
- outputSchema: Pn,
768
+ }), nr = Pe([tr, or]), rr = P(nr), sr = {
769
+ description: Qn,
770
+ inputSchema: Xn,
771
+ outputSchema: rr,
780
772
  needsApproval: !1
781
- }, V = {
773
+ }, ae = {
782
774
  paths: "Use the search tool to read endpoints and operations.",
783
775
  webhooks: "Use the search tool to read webhook operations.",
784
776
  components: "Use the search tool to read reusable components such as schemas and responses.",
785
777
  definitions: "Use the search tool to read reusable schemas.",
786
778
  parameters: "Use the search tool to read reusable parameters.",
787
779
  responses: "Use the search tool to read reusable responses."
788
- }, mt = ["id", "srcType", "fileDependencies"], ne = [
780
+ }, Rt = ["id", "srcType", "fileDependencies"], Ie = [
789
781
  {
790
782
  name: "securitySchemes",
791
783
  sources: ["components.securitySchemes", "securityDefinitions"]
792
784
  }
793
- ], Un = 10, De = 500;
794
- function ht(e, t) {
785
+ ], ar = 10, et = 500;
786
+ function Pt(e, t) {
795
787
  for (const o of t.sources) {
796
- const n = Dn(e, o);
797
- if (Ln(n)) return n;
788
+ const n = ir(e, o);
789
+ if (cr(n)) return n;
798
790
  }
799
791
  return null;
800
792
  }
801
- function Dn(e, t) {
802
- return t.split(".").reduce((o, n) => M(o) ? o[n] : void 0, e);
793
+ function ir(e, t) {
794
+ return t.split(".").reduce((o, n) => Q(o) ? o[n] : void 0, e);
803
795
  }
804
- function Ln(e) {
805
- return e == null ? !1 : Array.isArray(e) ? e.length > 0 : M(e) ? Object.keys(e).length > 0 : !0;
796
+ function cr(e) {
797
+ return e == null ? !1 : Array.isArray(e) ? e.length > 0 : Q(e) ? Object.keys(e).length > 0 : !0;
806
798
  }
807
- function M(e) {
799
+ function Q(e) {
808
800
  return !(e === null || typeof e != "object" || Array.isArray(e));
809
801
  }
810
- const Wn = new Set(
811
- ne.flatMap((e) => e.sources.map((t) => t.split(".")[0]))
802
+ const lr = new Set(
803
+ Ie.flatMap((e) => e.sources.map((t) => t.split(".")[0]))
812
804
  );
813
- function Le(e) {
805
+ function tt(e) {
814
806
  const t = [], o = [];
815
807
  for (const [n, r] of Object.entries(e)) {
816
- if (n in V) {
817
- o.push({ name: n, hint: V[n] });
808
+ if (n in ae) {
809
+ o.push({ name: n, hint: ae[n] });
818
810
  continue;
819
811
  }
820
- mt.includes(n) || Wn.has(n) || t.push(We(n, r));
812
+ Rt.includes(n) || lr.has(n) || t.push(ot(n, r));
821
813
  }
822
- for (const n of ne) {
823
- const r = ht(e, n);
824
- r !== null && t.push(We(n.name, r));
814
+ for (const n of Ie) {
815
+ const r = Pt(e, n);
816
+ r !== null && t.push(ot(n.name, r));
825
817
  }
826
818
  return { available: t, blocked: o };
827
819
  }
828
- function We(e, t) {
829
- const o = { name: e, kind: Mn(t) };
830
- return Array.isArray(t) ? o.count = t.length : M(t) && (o.count = Object.keys(t).length), o;
820
+ function ot(e, t) {
821
+ const o = { name: e, kind: dr(t) };
822
+ return Array.isArray(t) ? o.count = t.length : Q(t) && (o.count = Object.keys(t).length), o;
831
823
  }
832
- function Mn(e) {
833
- return Array.isArray(e) ? "array" : M(e) ? "object" : "scalar";
824
+ function dr(e) {
825
+ return Array.isArray(e) ? "array" : Q(e) ? "object" : "scalar";
834
826
  }
835
- function Fn(e, t, o) {
827
+ function ur(e, t, o) {
836
828
  if (Array.isArray(t))
837
- return Me(e, t, o, (n) => n);
838
- if (M(t)) {
829
+ return nt(e, t, o, (n) => n);
830
+ if (Q(t)) {
839
831
  const n = Object.keys(t).sort().map((r) => [r, t[r]]);
840
- return Me(e, n, o, (r) => Object.fromEntries(r));
832
+ return nt(e, n, o, (r) => Object.fromEntries(r));
841
833
  }
842
834
  return {
843
835
  field: e,
844
- value: K(t),
836
+ value: ie(t),
845
837
  truncated: !1,
846
838
  nextCursor: null
847
839
  };
848
840
  }
849
- function jn(e, t) {
841
+ function pr(e, t) {
850
842
  if (!e) return 0;
851
843
  let o;
852
844
  try {
@@ -859,79 +851,79 @@ function jn(e, t) {
859
851
  const s = Number(o.slice(n + 1));
860
852
  return !Number.isInteger(s) || s < 0 ? null : s;
861
853
  }
862
- function Me(e, t, o, n) {
863
- const r = Math.min(Math.max(o, 0), t.length), s = Math.min(r + Un, t.length), a = s < t.length;
854
+ function nt(e, t, o, n) {
855
+ const r = Math.min(Math.max(o, 0), t.length), s = Math.min(r + ar, t.length), a = s < t.length;
864
856
  return {
865
857
  field: e,
866
- value: K(n(t.slice(r, s))),
858
+ value: ie(n(t.slice(r, s))),
867
859
  truncated: a,
868
860
  start: r,
869
861
  end: s,
870
862
  total: t.length,
871
- nextCursor: a ? Bn(e, s) : null
863
+ nextCursor: a ? fr(e, s) : null
872
864
  };
873
865
  }
874
- function K(e) {
866
+ function ie(e) {
875
867
  if (typeof e == "string")
876
- return e.length > De ? `${e.slice(0, De)}…` : e;
868
+ return e.length > et ? `${e.slice(0, et)}…` : e;
877
869
  if (Array.isArray(e))
878
- return e.map(K);
879
- if (M(e)) {
870
+ return e.map(ie);
871
+ if (Q(e)) {
880
872
  const t = {};
881
873
  for (const [o, n] of Object.entries(e))
882
- t[o] = K(n);
874
+ t[o] = ie(n);
883
875
  return t;
884
876
  }
885
877
  return e;
886
878
  }
887
- function Bn(e, t) {
879
+ function fr(e, t) {
888
880
  return btoa(`${e}:${t}`);
889
881
  }
890
- const Yn = new Map(
891
- ne.flatMap(
882
+ const mr = new Map(
883
+ Ie.flatMap(
892
884
  (e) => e.sources.map((t) => [t.split(".")[0], e.name])
893
885
  )
894
886
  );
895
- function zn(e, t, o) {
896
- const n = ne.find((a) => a.name === t);
887
+ function hr(e, t, o) {
888
+ const n = Ie.find((a) => a.name === t);
897
889
  if (n) {
898
- const a = ht(e, n);
899
- return a === null ? je(t) : Fe(t, a, o);
890
+ const a = Pt(e, n);
891
+ return a === null ? st(t) : rt(t, a, o);
900
892
  }
901
- if (t in V)
893
+ if (t in ae)
902
894
  return h(
903
- `"${t}" is not available from this tool. ${V[t]}`,
895
+ `"${t}" is not available from this tool. ${ae[t]}`,
904
896
  { field: t }
905
897
  );
906
- if (mt.includes(t))
898
+ if (Rt.includes(t))
907
899
  return h(`"${t}" is not an OpenAPI metadata field.`, { field: t });
908
- const r = Yn.get(t);
900
+ const r = mr.get(t);
909
901
  if (r !== void 0)
910
902
  return h(`"${t}" is not a valid field name. Use "${r}" instead.`, {
911
903
  field: t
912
904
  });
913
905
  const s = e[t];
914
- return s == null ? je(t) : Fe(t, s, o);
906
+ return s == null ? st(t) : rt(t, s, o);
915
907
  }
916
- function Fe(e, t, o) {
917
- const n = jn(o, e);
908
+ function rt(e, t, o) {
909
+ const n = pr(o, e);
918
910
  return n === null ? h(
919
911
  `The provided cursor is not valid for field "${e}". Omit the cursor to start from the first page.`,
920
912
  { field: e }
921
913
  ) : {
922
914
  isError: !1,
923
- data: Fn(e, t, n)
915
+ data: ur(e, t, n)
924
916
  };
925
917
  }
926
- function je(e) {
918
+ function st(e) {
927
919
  return h(
928
920
  `"${e}" is not present in this API. Call this tool without a "field" to scan the available metadata fields.`,
929
921
  { field: e }
930
922
  );
931
923
  }
932
- function Hn(e) {
924
+ function Ir(e) {
933
925
  return async (t) => {
934
- const o = e.apis.get({ noproxy: !0 }) ?? [], n = o.find((s) => s.id === t.apiId);
926
+ const o = e.get(de), n = o.find((s) => s.id === t.apiId);
935
927
  if (!n)
936
928
  return h(`API "${t.apiId}" is not loaded.`, {
937
929
  availableApiIds: o.map((s) => s.id)
@@ -940,48 +932,48 @@ function Hn(e) {
940
932
  return t.field == null && t.cursor !== void 0 ? h(
941
933
  "`cursor` requires `field` to be set — omit `cursor` and pass `field` to read a specific section, or omit both to scan. Returning scan results.",
942
934
  {
943
- data: Le(r)
935
+ data: tt(r)
944
936
  }
945
- ) : t.field !== void 0 ? zn(r, t.field, t.cursor) : {
937
+ ) : t.field !== void 0 ? hr(r, t.field, t.cursor) : {
946
938
  isError: !1,
947
- data: Le(r)
939
+ data: tt(r)
948
940
  };
949
941
  };
950
942
  }
951
- const Gn = {
943
+ const wr = {
952
944
  name: "get_api_metadata",
953
- definition: Nn,
954
- createExecutor: (e) => Hn(e.store)
955
- }, Vn = "Manage Replay collections and YAML-backed Arazzo workflows/steps.\n\n**What it does**\n- Creates or deletes collections, workflows, and steps.\n- Can copy the focused step tab into another workflow as a new step.\n- Returns a summary plus created/affected IDs when available.\n\n**Use when**\n- You need structural changes to collection/workflow/step hierarchy.\n- Create a step from an OpenAPI operation, ad-hoc request, or blank step.\n- Persist the focused step tab into a target collection/workflow.\n\n**Never use when**\n- Only editing fields on an existing step, no structural change needed.\n- Required target ids are unknown or ambiguous.\n- You are not sure destructive deletes are intended.\n\n**Input guidance**\n- Provide `payload` with one `action` from:\n - `create_collection`, `delete_collection`\n - `create_workflow`, `delete_workflow`\n - `create_step`, `delete_step`, `move_step`\n - `save_tab_to_collection`\n- Resolve missing `collectionId`, `workflowId`, and `stepId` before mutation.\n- `create_collection`: `title` is display name and derives file ID.\n- `create_step`: choose one source shape:\n - `operation` for OpenAPI link (`apiId`, `path`, `method`, optional `operationId`)\n - `xOperation` for ad-hoc HTTP (`method` + `url`)\n - omit both for a blank step\n- `create_step` optional initial fields: `description`, `parameters`, `body`, `outputs`, `successCriteria`.\n- `create_step` optional `index` inserts at that 0-based position (default: append). `move_step` moves a step to `toIndex` (0-based); indices clamp to the valid range.\n- `save_tab_to_collection`: provide `targetCollectionId`, `targetWorkflowId`, and `newStepName`.\n\n**Loop/budget guidance**\n- Prefer batching related structure setup in minimal calls per workflow.\n- Track returned `stepId` values; names may be uniquified on collisions.\n- Define outputs on producer steps; reference via `$steps.<stepId>.outputs.<name>` downstream.\n- Add `successCriteria` on created steps so workflow runs fail on unexpected responses.", Kn = p({
945
+ definition: sr,
946
+ createExecutor: (e) => Ir(e.store)
947
+ }, yr = "Manage Replay collections and YAML-backed Arazzo workflows/steps.\n\n**What it does**\n- Creates or deletes collections, workflows, and steps.\n- Can copy the focused step tab into another workflow as a new step.\n- Returns a summary plus created/affected IDs when available.\n\n**Use when**\n- You need structural changes to collection/workflow/step hierarchy.\n- Create a step from an OpenAPI operation, ad-hoc request, or blank step.\n- Persist the focused step tab into a target collection/workflow.\n\n**Never use when**\n- Only editing fields on an existing step, no structural change needed.\n- Required target ids are unknown or ambiguous.\n- You are not sure destructive deletes are intended.\n\n**Input guidance**\n- Provide `payload` with one `action` from:\n - `create_collection`, `delete_collection`\n - `create_workflow`, `delete_workflow`\n - `create_step`, `delete_step`, `move_step`\n - `save_tab_to_collection`\n- Resolve missing `collectionId`, `workflowId`, and `stepId` before mutation.\n- `create_collection`: `title` is display name and derives file ID.\n- `create_step`: choose one source shape:\n - `operation` for OpenAPI link (`apiId`, `path`, `method`, optional `operationId`)\n - `xOperation` for ad-hoc HTTP (`method` + `url`)\n - omit both for a blank step\n- `create_step` optional initial fields: `description`, `parameters`, `body`, `outputs`, `successCriteria`.\n- `create_step` optional `index` inserts at that 0-based position (default: append). `move_step` moves a step to `toIndex` (0-based); indices clamp to the valid range.\n- `save_tab_to_collection`: provide `targetCollectionId`, `targetWorkflowId`, and `newStepName`.\n\n**Loop/budget guidance**\n- Prefer batching related structure setup in minimal calls per workflow.\n- Track returned `stepId` values; names may be uniquified on collisions.\n- Define outputs on producer steps; reference via `$steps.<stepId>.outputs.<name>` downstream.\n- Add `successCriteria` on created steps so workflow runs fail on unexpected responses.", vr = p({
956
948
  action: I("create_collection"),
957
949
  title: i().min(1).describe("Collection display title (also used to derive the file id).")
958
- }).strict(), Jn = p({
950
+ }).strict(), gr = p({
959
951
  action: I("delete_collection"),
960
952
  collectionId: i().min(1).describe("Target collection id.")
961
- }).strict(), Qn = p({
953
+ }).strict(), br = p({
962
954
  action: I("create_workflow"),
963
955
  collectionId: i().min(1).describe("Parent collection id."),
964
956
  name: i().min(1).describe("Workflow summary / display name.")
965
- }).strict(), Xn = p({
957
+ }).strict(), kr = p({
966
958
  action: I("delete_workflow"),
967
959
  collectionId: i().min(1),
968
960
  workflowId: i().min(1)
969
- }).strict(), Zn = [
970
- D.Text,
971
- D.JSON,
972
- D.XML
973
- ], er = p({
961
+ }).strict(), Sr = [
962
+ Y.Text,
963
+ Y.JSON,
964
+ Y.XML
965
+ ], Tr = p({
974
966
  name: i().min(1),
975
- in: T(["path", "query", "header", "cookie"]),
967
+ in: E(["path", "query", "header", "cookie"]),
976
968
  value: i()
977
- }).strict(), tr = p({
969
+ }).strict(), Cr = p({
978
970
  name: i().min(1).describe("Output name."),
979
971
  expression: i().min(1).describe("Output expression.")
980
- }).strict(), or = p({
972
+ }).strict(), Or = p({
981
973
  condition: i().min(1),
982
974
  context: i().optional(),
983
- type: T(["simple", "regex", "jsonpath", "xpath"]).optional()
984
- }).strict(), nr = p({
975
+ type: E(["simple", "regex", "jsonpath", "xpath"]).optional()
976
+ }).strict(), Ar = p({
985
977
  action: I("create_step"),
986
978
  collectionId: i().min(1),
987
979
  workflowId: i().min(1),
@@ -989,13 +981,13 @@ const Gn = {
989
981
  'Label used verbatim as the stepId, so pass a single camelCase token such as "updateUser", reusing the source operationId when there is one. Put prose in `description` instead (default: "New Step").'
990
982
  ),
991
983
  description: i().min(1).optional().describe("Step description text (overrides default derived from stepName)."),
992
- parameters: b(er).optional().describe("Initial request parameters (path, query, header, cookie)."),
984
+ parameters: T(Tr).optional().describe("Initial request parameters (path, query, header, cookie)."),
993
985
  body: p({
994
986
  content: i().describe("Request body content as string."),
995
- contentType: T(Zn).optional().describe("Request body content type.")
987
+ contentType: E(Sr).optional().describe("Request body content type.")
996
988
  }).strict().optional().describe("Initial request body."),
997
- outputs: b(tr).optional().describe("Initial step outputs (mappings for later steps)."),
998
- successCriteria: b(or).optional().describe("Initial success criteria rows."),
989
+ outputs: T(Cr).optional().describe("Initial step outputs (mappings for later steps)."),
990
+ successCriteria: T(Or).optional().describe("Initial success criteria rows."),
999
991
  operation: p({
1000
992
  apiId: i().min(1).describe("API id."),
1001
993
  path: i().min(1).describe("Request path."),
@@ -1008,69 +1000,69 @@ const Gn = {
1008
1000
  method: i().min(1).describe("HTTP method."),
1009
1001
  url: i().min(1).describe("Request URL.")
1010
1002
  }).optional().describe("Ad-hoc HTTP request (method + URL). Omit if using operation or a blank step."),
1011
- index: S().int().min(0).optional().describe(
1003
+ index: A().int().min(0).optional().describe(
1012
1004
  "0-based position to insert the new step at within the workflow. Omit to append at the end. Out-of-range values clamp to the nearest valid position."
1013
1005
  )
1014
- }).strict(), rr = p({
1006
+ }).strict(), Er = p({
1015
1007
  action: I("delete_step"),
1016
1008
  collectionId: i().min(1),
1017
1009
  workflowId: i().min(1),
1018
1010
  stepId: i().min(1)
1019
- }).strict(), sr = p({
1011
+ }).strict(), $r = p({
1020
1012
  action: I("move_step"),
1021
1013
  collectionId: i().min(1),
1022
1014
  workflowId: i().min(1),
1023
1015
  stepId: i().min(1).describe("Id of the existing step to move."),
1024
- toIndex: S().int().min(0).describe(
1016
+ toIndex: A().int().min(0).describe(
1025
1017
  "0-based target position for the step within the same workflow. Out-of-range values clamp to the nearest valid position."
1026
1018
  )
1027
- }).strict(), ar = p({
1019
+ }).strict(), xr = p({
1028
1020
  action: I("save_tab_to_collection"),
1029
1021
  targetCollectionId: i().min(1),
1030
1022
  targetWorkflowId: i().min(1),
1031
1023
  newStepName: i().min(1).describe(
1032
1024
  'Step id / label for the new step, used verbatim, so pass a single camelCase token such as "updateUser".'
1033
1025
  )
1034
- }).strict(), ir = p({
1035
- payload: oe("action", [
1036
- Kn,
1037
- Jn,
1038
- Qn,
1039
- Xn,
1040
- nr,
1041
- rr,
1042
- sr,
1043
- ar
1026
+ }).strict(), _r = p({
1027
+ payload: he("action", [
1028
+ vr,
1029
+ gr,
1030
+ br,
1031
+ kr,
1032
+ Ar,
1033
+ Er,
1034
+ $r,
1035
+ xr
1044
1036
  ])
1045
1037
  }).superRefine((e, t) => {
1046
1038
  e.payload.action === "create_step" && e.payload.operation && e.payload.xOperation && t.addIssue({
1047
- code: W.custom,
1039
+ code: H.custom,
1048
1040
  message: "Only one of `operation` or `xOperation` may be specified."
1049
1041
  });
1050
- }), cr = p({
1042
+ }), Rr = p({
1051
1043
  summary: i(),
1052
1044
  collectionId: i().optional(),
1053
1045
  workflowId: i().optional(),
1054
1046
  stepId: i().optional()
1055
- }), lr = $(cr), dr = {
1056
- description: Vn,
1057
- inputSchema: ir,
1058
- outputSchema: lr,
1047
+ }), Pr = P(Rr), qr = {
1048
+ description: yr,
1049
+ inputSchema: _r,
1050
+ outputSchema: Pr,
1059
1051
  needsApproval: (e) => e.payload.action === "delete_collection" || e.payload.action === "delete_workflow" || e.payload.action === "delete_step" || e.payload.action === "save_tab_to_collection"
1060
1052
  };
1061
- function Be(e, t, o) {
1062
- return { ...Qe(e), key: t, value: o, active: !0 };
1053
+ function at(e, t, o) {
1054
+ return { ...ht(e), key: t, value: o, active: !0 };
1063
1055
  }
1064
- function ur(e, t, o) {
1056
+ function Nr(e, t, o) {
1065
1057
  const n = /* @__PURE__ */ new Map();
1066
1058
  for (const s of o)
1067
1059
  n.set(s.name, s.value);
1068
1060
  const r = [];
1069
1061
  for (const s of e) {
1070
- if (pe(s) && s.key && n.has(s.key)) {
1062
+ if (Ee(s) && s.key && n.has(s.key)) {
1071
1063
  const a = n.get(s.key);
1072
1064
  n.delete(s.key), r.push({
1073
- ...Be(t, s.key, a),
1065
+ ...at(t, s.key, a),
1074
1066
  id: s.id,
1075
1067
  ...s.allowReserved !== void 0 && { allowReserved: s.allowReserved }
1076
1068
  });
@@ -1079,10 +1071,10 @@ function ur(e, t, o) {
1079
1071
  r.push(s);
1080
1072
  }
1081
1073
  for (const s of o)
1082
- n.has(s.name) && (r.push(Be(t, s.name, n.get(s.name))), n.delete(s.name));
1074
+ n.has(s.name) && (r.push(at(t, s.name, n.get(s.name))), n.delete(s.name));
1083
1075
  return r;
1084
1076
  }
1085
- function pr(e, t) {
1077
+ function Ur(e, t) {
1086
1078
  if (t.description !== void 0 && (e.description = t.description), t.body && (e.requestBody = {
1087
1079
  ...e.requestBody,
1088
1080
  content: t.body.content,
@@ -1093,12 +1085,12 @@ function pr(e, t) {
1093
1085
  const r = o.get(n.in) ?? [];
1094
1086
  r.push(n), o.set(n.in, r);
1095
1087
  }
1096
- for (const n of Object.keys(G)) {
1088
+ for (const n of Object.keys(se)) {
1097
1089
  const r = o.get(n);
1098
1090
  if (!r?.length)
1099
1091
  continue;
1100
- const s = G[n];
1101
- e.parameters[s] = ur(
1092
+ const s = se[n];
1093
+ e.parameters[s] = Nr(
1102
1094
  e.parameters[s],
1103
1095
  n,
1104
1096
  r
@@ -1119,8 +1111,8 @@ function pr(e, t) {
1119
1111
  }
1120
1112
  if (t.successCriteria?.length)
1121
1113
  for (const o of t.successCriteria) {
1122
- const n = Je(
1123
- o.type ?? ue.SIMPLE
1114
+ const n = mt(
1115
+ o.type ?? Oe.SIMPLE
1124
1116
  );
1125
1117
  e.successCriteria.push({
1126
1118
  ...n,
@@ -1130,34 +1122,34 @@ function pr(e, t) {
1130
1122
  }
1131
1123
  return e;
1132
1124
  }
1133
- function fr(e) {
1125
+ function Dr(e) {
1134
1126
  return async (t) => {
1135
1127
  switch (t.payload.action) {
1136
1128
  case "create_collection":
1137
- return mr(t.payload, e);
1129
+ return Wr(t.payload, e);
1138
1130
  case "delete_collection":
1139
- return hr(t.payload, e);
1131
+ return Lr(t.payload, e);
1140
1132
  case "create_workflow":
1141
- return Ir(t.payload, e);
1133
+ return Mr(t.payload, e);
1142
1134
  case "delete_workflow":
1143
- return wr(t.payload, e);
1135
+ return Fr(t.payload, e);
1144
1136
  case "create_step":
1145
- return yr(t.payload, e);
1137
+ return jr(t.payload, e);
1146
1138
  case "delete_step":
1147
- return gr(t.payload, e);
1139
+ return Yr(t.payload, e);
1148
1140
  case "move_step":
1149
- return br(t.payload, e);
1141
+ return zr(t.payload, e);
1150
1142
  case "save_tab_to_collection":
1151
- return kr(t.payload, e);
1143
+ return Hr(t.payload, e);
1152
1144
  }
1153
1145
  };
1154
1146
  }
1155
- function mr(e, { store: t }) {
1156
- const o = Lt({
1147
+ function Wr(e, { store: t }) {
1148
+ const o = so({
1157
1149
  name: e.title.trim(),
1158
- collections: t.collections
1150
+ collections: t.get(b)
1159
1151
  });
1160
- return t.collections.merge([o]), {
1152
+ return t.set(b, (n) => [...n, o]), {
1161
1153
  isError: !1,
1162
1154
  data: {
1163
1155
  summary: `Created collection "${o.info.title}" (${o.id}).`,
@@ -1165,12 +1157,12 @@ function mr(e, { store: t }) {
1165
1157
  }
1166
1158
  };
1167
1159
  }
1168
- function hr(e, { store: t, handleCloseByDataId: o }) {
1169
- const n = j(t, e.collectionId);
1160
+ function Lr(e, { store: t, handleCloseByDataId: o }) {
1161
+ const n = G(t.get(b), e.collectionId);
1170
1162
  if (!n)
1171
1163
  return h("Collection not found.", { collectionId: e.collectionId });
1172
- const r = n.info.title.get();
1173
- return J(n, o), n.set(he), {
1164
+ const r = n.info.title;
1165
+ return ce(n, o), t.set(b, (s) => ro(s, e.collectionId)), {
1174
1166
  isError: !1,
1175
1167
  data: {
1176
1168
  summary: `Deleted collection "${r}" (${e.collectionId}).`,
@@ -1178,15 +1170,18 @@ function hr(e, { store: t, handleCloseByDataId: o }) {
1178
1170
  }
1179
1171
  };
1180
1172
  }
1181
- function Ir(e, { store: t }) {
1182
- const o = j(t, e.collectionId);
1173
+ function Mr(e, { store: t }) {
1174
+ const o = G(t.get(b), e.collectionId);
1183
1175
  if (!o)
1184
1176
  return h("Collection not found.", { collectionId: e.collectionId });
1185
- const n = Dt({
1186
- name: e.name.trim(),
1187
- collection: o
1188
- });
1189
- return o.workflows.merge([n]), {
1177
+ const n = oo({ name: e.name.trim(), collection: o });
1178
+ return t.set(
1179
+ b,
1180
+ (r) => no(r, e.collectionId, (s) => ({
1181
+ ...s,
1182
+ workflows: [...s.workflows, n]
1183
+ }))
1184
+ ), {
1190
1185
  isError: !1,
1191
1186
  data: {
1192
1187
  summary: `Created workflow "${n.summary ?? n.workflowId}" in collection ${e.collectionId}.`,
@@ -1195,17 +1190,24 @@ function Ir(e, { store: t }) {
1195
1190
  }
1196
1191
  };
1197
1192
  }
1198
- function wr(e, { store: t, handleCloseByDataId: o }) {
1199
- if (!j(t, e.collectionId))
1193
+ function Fr(e, { store: t, handleCloseByDataId: o }) {
1194
+ const n = t.get(b);
1195
+ if (!G(n, e.collectionId))
1200
1196
  return h("Collection not found.", { collectionId: e.collectionId });
1201
- const r = X(t, {
1197
+ const s = V(n, {
1202
1198
  collectionId: e.collectionId,
1203
1199
  workflowId: e.workflowId
1204
1200
  });
1205
- return r ? (J(r, o, {
1201
+ return s ? (ce(s, o, {
1206
1202
  collectionId: e.collectionId,
1207
1203
  workflowId: null
1208
- }), r.set(he), {
1204
+ }), t.set(
1205
+ b,
1206
+ (a) => to(a, {
1207
+ collectionId: e.collectionId,
1208
+ workflowId: e.workflowId
1209
+ })
1210
+ ), {
1209
1211
  isError: !1,
1210
1212
  data: {
1211
1213
  summary: `Deleted workflow ${e.workflowId} from collection ${e.collectionId}.`,
@@ -1217,76 +1219,88 @@ function wr(e, { store: t, handleCloseByDataId: o }) {
1217
1219
  workflowId: e.workflowId
1218
1220
  });
1219
1221
  }
1220
- async function yr(e, { store: t, attachApiToCollection: o, convertOperationToReplayValue: n }) {
1221
- if (!j(t, e.collectionId))
1222
+ async function jr(e, { store: t, attachApiToCollection: o, convertOperationToReplayValue: n }) {
1223
+ const r = t.get(b);
1224
+ if (!G(r, e.collectionId))
1222
1225
  return h("Collection not found.", { collectionId: e.collectionId });
1223
- const s = X(t, {
1226
+ const a = V(r, {
1224
1227
  collectionId: e.collectionId,
1225
1228
  workflowId: e.workflowId
1226
1229
  });
1227
- if (!s)
1230
+ if (!a)
1228
1231
  return h("Workflow not found.", {
1229
1232
  collectionId: e.collectionId,
1230
1233
  workflowId: e.workflowId
1231
1234
  });
1232
- const a = e.operation ? {
1235
+ const l = e.operation ? {
1233
1236
  apiId: e.operation.apiId,
1234
1237
  path: e.operation.path.replace(/\{\{/g, "{").replace(/\}\}/g, "}"),
1235
1238
  method: e.operation.method.toLowerCase(),
1236
1239
  operationId: e.operation.operationId,
1237
1240
  isAdditionalOperation: !1
1238
- } : void 0, l = e.xOperation ? {
1241
+ } : void 0, c = e.xOperation ? {
1239
1242
  method: e.xOperation.method,
1240
1243
  url: e.xOperation.url
1241
1244
  } : void 0;
1242
- let c;
1243
- a && (c = Ut(t.apis, a, n), c && await o({
1245
+ let d;
1246
+ l && (d = eo(
1247
+ t.get(de),
1248
+ l,
1249
+ n
1250
+ ), d && await o({
1244
1251
  collectionId: e.collectionId,
1245
- apiId: a.apiId
1252
+ apiId: l.apiId
1246
1253
  }));
1247
- const u = Xe({
1254
+ const u = It({
1248
1255
  name: e.stepName?.trim() || "New Step",
1249
- workflow: s,
1250
- operation: a,
1251
- xOperation: l,
1252
- apiOperation: c
1256
+ workflow: a,
1257
+ operation: l,
1258
+ xOperation: c,
1259
+ apiOperation: d
1253
1260
  });
1254
- pr(u, {
1261
+ Ur(u, {
1255
1262
  description: e.description,
1256
1263
  parameters: e.parameters,
1257
1264
  body: e.body,
1258
1265
  outputs: e.outputs,
1259
1266
  successCriteria: e.successCriteria
1260
1267
  });
1261
- const d = vr(s, u, e.index);
1268
+ const f = Br(
1269
+ t,
1270
+ { collectionId: e.collectionId, workflowId: e.workflowId },
1271
+ u,
1272
+ e.index
1273
+ );
1262
1274
  return {
1263
1275
  isError: !1,
1264
1276
  data: {
1265
- summary: `Created step ${u.stepId} at position ${d} in workflow ${e.workflowId}.`,
1277
+ summary: `Created step ${u.stepId} at position ${f} in workflow ${e.workflowId}.`,
1266
1278
  collectionId: e.collectionId,
1267
1279
  workflowId: e.workflowId,
1268
1280
  stepId: u.stepId
1269
1281
  }
1270
1282
  };
1271
1283
  }
1272
- function It(e, t) {
1284
+ function qt(e, t) {
1273
1285
  return Math.min(Math.max(e, 0), t);
1274
1286
  }
1275
- function vr(e, t, o) {
1276
- const n = e.steps.length, r = o === void 0 ? n : It(o, n);
1277
- return e.steps.set((s) => (s.splice(r, 0, t), s)), r;
1287
+ function Br(e, t, o, n) {
1288
+ const r = V(e.get(b), t)?.steps.length ?? 0, s = n === void 0 ? r : qt(n, r);
1289
+ return e.set(
1290
+ b,
1291
+ (a) => pe(a, t, (l) => {
1292
+ const c = [...l.steps];
1293
+ return c.splice(s, 0, o), { ...l, steps: c };
1294
+ })
1295
+ ), s;
1278
1296
  }
1279
- function gr(e, { store: t, handleCloseByDataId: o }) {
1280
- const n = Ze(t, {
1281
- collectionId: e.collectionId,
1282
- workflowId: e.workflowId,
1283
- stepId: e.stepId
1284
- });
1285
- return n ? (o({
1297
+ function Yr(e, { store: t, handleCloseByDataId: o }) {
1298
+ const n = {
1286
1299
  collectionId: e.collectionId,
1287
1300
  workflowId: e.workflowId,
1288
1301
  stepId: e.stepId
1289
- }), n.set(he), {
1302
+ };
1303
+ return $e(t.get(b), n) ? (o(n), t.set(b, (s) => Zt(s, n)), {
1290
1304
  isError: !1,
1291
1305
  data: {
1292
1306
  summary: `Deleted step ${e.stepId} from workflow ${e.workflowId}.`,
@@ -1300,116 +1314,124 @@ function gr(e, { store: t, handleCloseByDataId: o }) {
1300
1314
  stepId: e.stepId
1301
1315
  });
1302
1316
  }
1303
- function br(e, { store: t }) {
1304
- const o = X(t, {
1317
+ function zr(e, { store: t }) {
1318
+ const o = {
1305
1319
  collectionId: e.collectionId,
1306
1320
  workflowId: e.workflowId
1307
- });
1308
- if (!o)
1321
+ }, n = V(t.get(b), o);
1322
+ if (!n)
1309
1323
  return h("Workflow not found.", {
1310
1324
  collectionId: e.collectionId,
1311
1325
  workflowId: e.workflowId
1312
1326
  });
1313
- const n = o.steps.get({ noproxy: !0 }), r = n.findIndex((a) => a.stepId === e.stepId);
1314
- if (r === -1)
1327
+ const r = n.steps, s = r.findIndex((l) => l.stepId === e.stepId);
1328
+ if (s === -1)
1315
1329
  return h("Step not found.", {
1316
1330
  collectionId: e.collectionId,
1317
1331
  workflowId: e.workflowId,
1318
1332
  stepId: e.stepId
1319
1333
  });
1320
- const s = It(e.toIndex, n.length - 1);
1321
- return o.steps.set((a) => {
1322
- const [l] = a.splice(r, 1);
1323
- return a.splice(s, 0, l), a;
1324
- }), {
1334
+ const a = qt(e.toIndex, r.length - 1);
1335
+ return t.set(
1336
+ b,
1337
+ (l) => pe(l, o, (c) => {
1338
+ const d = [...c.steps], [u] = d.splice(s, 1);
1339
+ return d.splice(a, 0, u), { ...c, steps: d };
1340
+ })
1341
+ ), {
1325
1342
  isError: !1,
1326
1343
  data: {
1327
- summary: `Moved step ${e.stepId} to position ${s} in workflow ${e.workflowId}.`,
1344
+ summary: `Moved step ${e.stepId} to position ${a} in workflow ${e.workflowId}.`,
1328
1345
  collectionId: e.collectionId,
1329
1346
  workflowId: e.workflowId,
1330
1347
  stepId: e.stepId
1331
1348
  }
1332
1349
  };
1333
1350
  }
1334
- async function kr(e, { store: t, attachApiToCollection: o }) {
1335
- const n = fe(t);
1351
+ async function Hr(e, { store: t, attachApiToCollection: o }) {
1352
+ const n = ue(t);
1336
1353
  if (!n)
1337
1354
  return h("No active tab.");
1338
- if (!me(n))
1355
+ if (!Z(n))
1339
1356
  return h("Active tab is not a step tab.", {
1340
- tabType: n.data.type.get()
1357
+ tabType: n.data.type
1341
1358
  });
1342
- const r = Nt(t, n);
1343
- if (!r)
1359
+ const r = t.get(b), s = Xt(r, n.data);
1360
+ if (!s)
1344
1361
  return h("No step data available on the active tab.");
1345
- if (!j(t, e.targetCollectionId))
1362
+ if (!G(r, e.targetCollectionId))
1346
1363
  return h("Target collection not found.", {
1347
1364
  collectionId: e.targetCollectionId
1348
1365
  });
1349
- const a = X(t, {
1366
+ const l = {
1350
1367
  collectionId: e.targetCollectionId,
1351
1368
  workflowId: e.targetWorkflowId
1352
- });
1353
- if (!a)
1369
+ }, c = V(r, l);
1370
+ if (!c)
1354
1371
  return h("Target workflow not found.", {
1355
1372
  collectionId: e.targetCollectionId,
1356
1373
  workflowId: e.targetWorkflowId
1357
1374
  });
1358
- const l = Xe({
1375
+ const d = It({
1359
1376
  name: e.newStepName.trim(),
1360
- workflow: a,
1361
- fromStep: r
1377
+ workflow: c,
1378
+ fromStep: s
1362
1379
  });
1363
- return a.steps.merge([l]), l.operation?.apiId && await o({
1380
+ return t.set(
1381
+ b,
1382
+ (u) => pe(u, l, (f) => ({
1383
+ ...f,
1384
+ steps: [...f.steps, d]
1385
+ }))
1386
+ ), d.operation?.apiId && await o({
1364
1387
  collectionId: e.targetCollectionId,
1365
- apiId: l.operation.apiId
1388
+ apiId: d.operation.apiId
1366
1389
  }), {
1367
1390
  isError: !1,
1368
1391
  data: {
1369
- summary: `Added step ${l.stepId} to workflow ${e.targetWorkflowId}.`,
1392
+ summary: `Added step ${d.stepId} to workflow ${e.targetWorkflowId}.`,
1370
1393
  collectionId: e.targetCollectionId,
1371
1394
  workflowId: e.targetWorkflowId,
1372
- stepId: l.stepId
1395
+ stepId: d.stepId
1373
1396
  }
1374
1397
  };
1375
1398
  }
1376
- function J(e, t, o) {
1399
+ function ce(e, t, o) {
1377
1400
  if ("workflows" in e) {
1378
- const r = e.id.get();
1401
+ const n = e.id;
1379
1402
  e.workflows.forEach(
1380
- (s) => J(s, t, {
1381
- collectionId: r,
1403
+ (r) => ce(r, t, {
1404
+ collectionId: n,
1382
1405
  workflowId: null
1383
1406
  })
1384
- ), t({ collectionId: r, workflowId: null, stepId: null });
1407
+ ), t({ collectionId: n, workflowId: null, stepId: null });
1385
1408
  return;
1386
1409
  }
1387
1410
  if ("steps" in e) {
1388
- const r = e.workflowId.get();
1411
+ const n = e.workflowId;
1389
1412
  e.steps.forEach(
1390
- (s) => J(s, t, {
1413
+ (r) => ce(r, t, {
1391
1414
  collectionId: o?.collectionId,
1392
- workflowId: r
1415
+ workflowId: n
1393
1416
  })
1394
1417
  ), t({
1395
1418
  collectionId: o?.collectionId,
1396
- workflowId: r,
1419
+ workflowId: n,
1397
1420
  stepId: null
1398
1421
  });
1399
1422
  return;
1400
1423
  }
1401
- const n = e.stepId.get();
1402
1424
  t({
1403
1425
  collectionId: o?.collectionId,
1404
1426
  workflowId: o?.workflowId,
1405
- stepId: n
1427
+ stepId: e.stepId
1406
1428
  });
1407
1429
  }
1408
- const Sr = {
1430
+ const Gr = {
1409
1431
  name: "manage_collection",
1410
- definition: dr,
1411
- createExecutor: (e) => fr(e)
1412
- }, Tr = `Read, add, or change Replay environments (inputs and server mappings).
1432
+ definition: qr,
1433
+ createExecutor: (e) => Dr(e)
1434
+ }, Vr = `Read, add, or change Replay environments (inputs and server mappings).
1413
1435
 
1414
1436
  **What it does**
1415
1437
  - Manages Replay project environments: inputs (values and secrecy) and per-\`apiId\` server URLs/variables.
@@ -1433,136 +1455,136 @@ const Sr = {
1433
1455
  **Loop/budget guidance**
1434
1456
  - Re-read environment/input data when decisions depend on up-to-date values.
1435
1457
  - Batch related input/server changes for the same environment when practical.
1436
- - After changing the active environment, re-check assumptions that depended on the previous one.`, q = i().min(1).optional().describe("Environment name. Omit to use the active environment."), Cr = p({
1458
+ - After changing the active environment, re-check assumptions that depended on the previous one.`, M = i().min(1).optional().describe("Environment name. Omit to use the active environment."), Kr = p({
1437
1459
  action: I("get_environments")
1438
- }).strict(), Or = p({
1460
+ }).strict(), Jr = p({
1439
1461
  action: I("get_active_environment")
1440
- }).strict(), Ar = p({
1462
+ }).strict(), Qr = p({
1441
1463
  action: I("get_inputs"),
1442
- environment: q
1443
- }).strict(), xr = p({
1464
+ environment: M
1465
+ }).strict(), Xr = p({
1444
1466
  action: I("get_servers"),
1445
- environment: q
1446
- }).strict(), Er = p({
1467
+ environment: M
1468
+ }).strict(), Zr = p({
1447
1469
  action: I("get_input"),
1448
- environment: q,
1470
+ environment: M,
1449
1471
  inputName: i().min(1)
1450
- }).strict(), $r = p({
1472
+ }).strict(), es = p({
1451
1473
  action: I("upsert_input"),
1452
- environment: q,
1474
+ environment: M,
1453
1475
  name: i().min(1),
1454
1476
  value: i(),
1455
- isSecret: E().optional().describe(
1477
+ isSecret: R().optional().describe(
1456
1478
  "Only when creating a new input name: whether the value is secret (default false). Ignored when the name already exists."
1457
1479
  )
1458
- }).strict(), _r = p({
1480
+ }).strict(), ts = p({
1459
1481
  action: I("remove_input"),
1460
- environment: q,
1482
+ environment: M,
1461
1483
  inputName: i().min(1)
1462
- }).strict(), ve = p({
1484
+ }).strict(), Ne = p({
1463
1485
  name: i().min(1),
1464
1486
  value: i()
1465
- }).strict(), Rr = p({
1487
+ }).strict(), os = p({
1466
1488
  action: I("upsert_server"),
1467
- environment: q,
1489
+ environment: M,
1468
1490
  apiId: i().min(1),
1469
1491
  value: i(),
1470
- variables: b(ve).optional()
1471
- }).strict(), qr = p({
1492
+ variables: T(Ne).optional()
1493
+ }).strict(), ns = p({
1472
1494
  name: i().min(1),
1473
1495
  value: i(),
1474
- isSecret: E().optional().describe("Defaults to false when omitted.")
1475
- }).strict(), Pr = p({
1496
+ isSecret: R().optional().describe("Defaults to false when omitted.")
1497
+ }).strict(), rs = p({
1476
1498
  apiId: i().min(1),
1477
1499
  value: i(),
1478
- variables: b(ve).optional()
1479
- }).strict(), Nr = p({
1500
+ variables: T(Ne).optional()
1501
+ }).strict(), ss = p({
1480
1502
  action: I("add_environment"),
1481
1503
  environment: i().min(1).describe("Name of a new environment to create."),
1482
- inputs: b(qr).optional().describe("Optional initial inputs for the new environment."),
1483
- servers: b(Pr).optional().describe("Optional initial server mappings for the new environment."),
1484
- setActive: E().optional().describe("When true, also set the new environment as active.")
1485
- }).strict(), Ur = p({
1504
+ inputs: T(ns).optional().describe("Optional initial inputs for the new environment."),
1505
+ servers: T(rs).optional().describe("Optional initial server mappings for the new environment."),
1506
+ setActive: R().optional().describe("When true, also set the new environment as active.")
1507
+ }).strict(), as = p({
1486
1508
  action: I("remove_server"),
1487
- environment: q,
1509
+ environment: M,
1488
1510
  apiId: i().min(1)
1489
- }).strict(), Dr = p({
1511
+ }).strict(), is = p({
1490
1512
  action: I("set_active_environment"),
1491
1513
  environment: i().min(1).describe("Name of the environment to activate.")
1492
- }).strict(), Lr = p({
1493
- payload: oe("action", [
1494
- Cr,
1495
- Nr,
1496
- Or,
1497
- Ar,
1498
- xr,
1499
- Er,
1500
- $r,
1501
- _r,
1502
- Rr,
1503
- Ur,
1504
- Dr
1514
+ }).strict(), cs = p({
1515
+ payload: he("action", [
1516
+ Kr,
1517
+ ss,
1518
+ Jr,
1519
+ Qr,
1520
+ Xr,
1521
+ Zr,
1522
+ es,
1523
+ ts,
1524
+ os,
1525
+ as,
1526
+ is
1505
1527
  ])
1506
- }), Wr = p({
1528
+ }), ls = p({
1507
1529
  summary: i(),
1508
- environmentNames: b(i()).optional(),
1509
- inputs: b(
1530
+ environmentNames: T(i()).optional(),
1531
+ inputs: T(
1510
1532
  p({
1511
1533
  name: i(),
1512
- isSecret: E(),
1534
+ isSecret: R(),
1513
1535
  value: i()
1514
1536
  })
1515
1537
  ).optional(),
1516
- servers: b(
1538
+ servers: T(
1517
1539
  p({
1518
1540
  apiId: i(),
1519
1541
  value: i(),
1520
- variables: b(ve)
1542
+ variables: T(Ne)
1521
1543
  })
1522
1544
  ).optional(),
1523
1545
  input: p({
1524
1546
  name: i(),
1525
- isSecret: E(),
1547
+ isSecret: R(),
1526
1548
  value: i()
1527
1549
  }).optional(),
1528
1550
  environment: i().optional(),
1529
1551
  apiId: i().optional()
1530
- }), Mr = $(Wr), Fr = {
1531
- description: Tr,
1532
- inputSchema: Lr,
1533
- outputSchema: Mr,
1552
+ }), ds = P(ls), us = {
1553
+ description: Vr,
1554
+ inputSchema: cs,
1555
+ outputSchema: ds,
1534
1556
  needsApproval: (e) => e.payload.action === "add_environment" || e.payload.action === "set_active_environment" || e.payload.action === "upsert_input" || e.payload.action === "remove_input" || e.payload.action === "upsert_server" || e.payload.action === "remove_server"
1535
1557
  };
1536
- function jr(e) {
1558
+ function ps(e) {
1537
1559
  return async (t, o) => {
1538
1560
  switch (t.payload.action) {
1539
1561
  case "get_environments":
1540
- return Br(e);
1562
+ return fs(e);
1541
1563
  case "add_environment":
1542
- return Yr(e, t.payload);
1564
+ return ms(e, t.payload);
1543
1565
  case "get_active_environment":
1544
- return zr(e);
1566
+ return hs(e);
1545
1567
  case "set_active_environment":
1546
- return Zr(e, t.payload);
1568
+ return Ss(e, t.payload);
1547
1569
  case "get_inputs":
1548
- return Hr(e, t.payload);
1570
+ return Is(e, t.payload);
1549
1571
  case "get_servers":
1550
- return Gr(e, t.payload);
1572
+ return ws(e, t.payload);
1551
1573
  case "get_input":
1552
- return Vr(e, t.payload);
1574
+ return ys(e, t.payload);
1553
1575
  case "upsert_input":
1554
- return Kr(e, t.payload);
1576
+ return vs(e, t.payload);
1555
1577
  case "remove_input":
1556
- return Jr(e, t.payload);
1578
+ return gs(e, t.payload);
1557
1579
  case "upsert_server":
1558
- return Qr(e, t.payload);
1580
+ return bs(e, t.payload);
1559
1581
  case "remove_server":
1560
- return Xr(e, t.payload);
1582
+ return ks(e, t.payload);
1561
1583
  }
1562
1584
  };
1563
1585
  }
1564
- function Br(e) {
1565
- const t = e.activeEnvironmentId.get(), o = e.environments.map((n) => n.name.get());
1586
+ function fs(e) {
1587
+ const t = e.get(K), o = e.get(ee).map((n) => n.name);
1566
1588
  return {
1567
1589
  isError: !1,
1568
1590
  data: {
@@ -1571,38 +1593,46 @@ function Br(e) {
1571
1593
  }
1572
1594
  };
1573
1595
  }
1574
- function Yr(e, t) {
1575
- if (re(e, t.environment))
1596
+ function ms(e, t) {
1597
+ if (we(e, t.environment))
1576
1598
  return h("Environment already exists.", {
1577
1599
  environment: t.environment
1578
1600
  });
1579
- const n = (t.inputs ?? []).map((s) => ({
1580
- name: s.name,
1581
- value: s.value,
1582
- isSecret: s.isSecret ?? !1
1583
- })), r = (t.servers ?? []).map((s) => ({
1584
- apiId: s.apiId,
1585
- value: s.value,
1586
- variables: s.variables ?? []
1587
- }));
1588
- return e.environments.merge([
1601
+ const n = ao(t.environment, /* @__PURE__ */ new Set());
1602
+ if (n)
1603
+ return h(n, {
1604
+ environment: t.environment
1605
+ });
1606
+ const r = (t.inputs ?? []).map((l) => ({
1607
+ name: l.name,
1608
+ value: l.value,
1609
+ isSecret: l.isSecret ?? !1
1610
+ })), s = (t.servers ?? []).map((l) => ({
1611
+ apiId: l.apiId,
1612
+ value: l.value,
1613
+ variables: l.variables ?? []
1614
+ })), a = As(r, s);
1615
+ return a ? h(a, {
1616
+ environment: t.environment
1617
+ }) : (e.set(ee, (l) => [
1618
+ ...l,
1589
1619
  {
1590
1620
  name: t.environment,
1591
- inputs: n,
1592
- servers: r,
1593
- state: Wt.Normal
1621
+ inputs: r,
1622
+ servers: s,
1623
+ state: io.Normal
1594
1624
  }
1595
- ]), t.setActive && e.activeEnvironmentId.set(t.environment), {
1625
+ ]), t.setActive && e.set(K, t.environment), {
1596
1626
  isError: !1,
1597
1627
  data: {
1598
1628
  summary: t.setActive ? `Added environment "${t.environment}" and set it active.` : `Added environment "${t.environment}".`,
1599
1629
  environment: t.environment
1600
1630
  }
1601
- };
1631
+ });
1602
1632
  }
1603
- function zr(e) {
1604
- const t = e.activeEnvironmentId.get();
1605
- return re(e, t) ? {
1633
+ function hs(e) {
1634
+ const t = e.get(K);
1635
+ return we(e, t) ? {
1606
1636
  isError: !1,
1607
1637
  data: {
1608
1638
  summary: `Active environment is "${t}".`,
@@ -1612,11 +1642,11 @@ function zr(e) {
1612
1642
  environment: t
1613
1643
  });
1614
1644
  }
1615
- function Hr(e, t) {
1616
- const o = P(e, t.environment);
1645
+ function Is(e, t) {
1646
+ const o = F(e, t.environment);
1617
1647
  if (!o.ok)
1618
1648
  return o.result;
1619
- const { name: n, env: r } = o, s = ts(r.get());
1649
+ const { name: n, env: r } = o, s = Cs(r);
1620
1650
  return {
1621
1651
  isError: !1,
1622
1652
  data: {
@@ -1626,11 +1656,11 @@ function Hr(e, t) {
1626
1656
  }
1627
1657
  };
1628
1658
  }
1629
- function Gr(e, t) {
1630
- const o = P(e, t.environment);
1659
+ function ws(e, t) {
1660
+ const o = F(e, t.environment);
1631
1661
  if (!o.ok)
1632
1662
  return o.result;
1633
- const { name: n, env: r } = o, s = os(r.get());
1663
+ const { name: n, env: r } = o, s = Os(r);
1634
1664
  return {
1635
1665
  isError: !1,
1636
1666
  data: {
@@ -1640,17 +1670,17 @@ function Gr(e, t) {
1640
1670
  }
1641
1671
  };
1642
1672
  }
1643
- function Vr(e, t) {
1644
- const o = P(e, t.environment);
1673
+ function ys(e, t) {
1674
+ const o = F(e, t.environment);
1645
1675
  if (!o.ok)
1646
1676
  return o.result;
1647
- const { name: n, env: r } = o, s = r.inputs.find((u) => u.name.get() === t.inputName);
1677
+ const { name: n, env: r } = o, s = r.inputs.find((d) => d.name === t.inputName);
1648
1678
  if (!s)
1649
1679
  return h("Input not found.", {
1650
1680
  environment: n,
1651
1681
  inputName: t.inputName
1652
1682
  });
1653
- const { name: a, isSecret: l, value: c } = s.get();
1683
+ const { name: a, isSecret: l, value: c } = s;
1654
1684
  return {
1655
1685
  isError: !1,
1656
1686
  data: {
@@ -1659,20 +1689,29 @@ function Vr(e, t) {
1659
1689
  input: {
1660
1690
  name: a,
1661
1691
  isSecret: l,
1662
- value: wt(l, c)
1692
+ value: Nt(l, c)
1663
1693
  }
1664
1694
  }
1665
1695
  };
1666
1696
  }
1667
- function Kr(e, t) {
1668
- const o = P(e, t.environment);
1697
+ function vs(e, t) {
1698
+ const o = F(e, t.environment);
1669
1699
  if (!o.ok)
1670
1700
  return o.result;
1671
- const { name: n, env: r } = o, a = r.inputs.get().find((c) => c.name === t.name), l = a ? a.isSecret : t.isSecret ?? !1;
1672
- return r.inputs.set((c) => [
1673
- ...c.filter((u) => u.name !== t.name),
1674
- { name: t.name, value: t.value, isSecret: l }
1675
- ]), {
1701
+ const { name: n, env: r } = o, s = Ue(t.name, "Input names");
1702
+ if (s)
1703
+ return h(s, {
1704
+ environment: n,
1705
+ inputName: t.name
1706
+ });
1707
+ const a = r.inputs.find((c) => c.name === t.name), l = a ? a.isSecret : t.isSecret ?? !1;
1708
+ return ye(e, n, (c) => ({
1709
+ ...c,
1710
+ inputs: [
1711
+ ...c.inputs.filter((d) => d.name !== t.name),
1712
+ { name: t.name, value: t.value, isSecret: l }
1713
+ ]
1714
+ })), {
1676
1715
  isError: !1,
1677
1716
  data: {
1678
1717
  summary: `Upserted input "${t.name}" in "${n}" (${l ? "secret" : "plain"}).`,
@@ -1680,34 +1719,43 @@ function Kr(e, t) {
1680
1719
  }
1681
1720
  };
1682
1721
  }
1683
- function Jr(e, t) {
1684
- const o = P(e, t.environment);
1722
+ function gs(e, t) {
1723
+ const o = F(e, t.environment);
1685
1724
  if (!o.ok)
1686
1725
  return o.result;
1687
- const { name: n, env: r } = o, s = r.inputs.get(), a = s.filter((l) => l.name !== t.inputName);
1688
- return a.length === s.length ? h("Input not found.", {
1689
- environment: n,
1690
- inputName: t.inputName
1691
- }) : (r.inputs.set(a), {
1726
+ const { name: n, env: r } = o;
1727
+ return r.inputs.some((s) => s.name === t.inputName) ? (ye(e, n, (s) => ({
1728
+ ...s,
1729
+ inputs: s.inputs.filter((a) => a.name !== t.inputName)
1730
+ })), {
1692
1731
  isError: !1,
1693
1732
  data: {
1694
1733
  summary: `Removed input "${t.inputName}" from "${n}".`,
1695
1734
  environment: n
1696
1735
  }
1736
+ }) : h("Input not found.", {
1737
+ environment: n,
1738
+ inputName: t.inputName
1697
1739
  });
1698
1740
  }
1699
- function Qr(e, t) {
1700
- const o = P(e, t.environment);
1741
+ function bs(e, t) {
1742
+ const o = F(e, t.environment);
1701
1743
  if (!o.ok)
1702
1744
  return o.result;
1703
- const { name: n, env: r } = o;
1704
- return r.servers.set((s) => {
1705
- const a = s.findIndex((u) => u.apiId === t.apiId), l = a >= 0 && t.variables === void 0 ? s[a].variables : t.variables ?? [], c = {
1745
+ const { name: n } = o, r = Ue(t.apiId, "Server apiIds") ?? ne(
1746
+ (t.variables ?? []).map((s) => s.name),
1747
+ "Variable names"
1748
+ );
1749
+ return r ? h(r, { environment: n, apiId: t.apiId }) : (ye(e, n, (s) => {
1750
+ const a = s.servers, l = a.findIndex((u) => u.apiId === t.apiId), c = l >= 0 && t.variables === void 0 ? a[l].variables : t.variables ?? [], d = {
1706
1751
  apiId: t.apiId,
1707
1752
  value: t.value,
1708
- variables: l
1753
+ variables: c
1754
+ };
1755
+ return {
1756
+ ...s,
1757
+ servers: l >= 0 ? a.toSpliced(l, 1, d) : [d, ...a]
1709
1758
  };
1710
- return a >= 0 ? s.toSpliced(a, 1, c) : [c, ...s];
1711
1759
  }), {
1712
1760
  isError: !1,
1713
1761
  data: {
@@ -1715,38 +1763,41 @@ function Qr(e, t) {
1715
1763
  environment: n,
1716
1764
  apiId: t.apiId
1717
1765
  }
1718
- };
1766
+ });
1719
1767
  }
1720
- function Xr(e, t) {
1721
- const o = P(e, t.environment);
1768
+ function ks(e, t) {
1769
+ const o = F(e, t.environment);
1722
1770
  if (!o.ok)
1723
1771
  return o.result;
1724
- const { name: n, env: r } = o, s = r.servers.get(), a = s.filter((l) => l.apiId !== t.apiId);
1725
- return a.length === s.length ? h("Server not found.", {
1726
- environment: n,
1727
- apiId: t.apiId
1728
- }) : (r.servers.set(a), {
1772
+ const { name: n, env: r } = o;
1773
+ return r.servers.some((s) => s.apiId === t.apiId) ? (ye(e, n, (s) => ({
1774
+ ...s,
1775
+ servers: s.servers.filter((a) => a.apiId !== t.apiId)
1776
+ })), {
1729
1777
  isError: !1,
1730
1778
  data: {
1731
1779
  summary: `Removed server "${t.apiId}" from "${n}".`,
1732
1780
  environment: n,
1733
1781
  apiId: t.apiId
1734
1782
  }
1783
+ }) : h("Server not found.", {
1784
+ environment: n,
1785
+ apiId: t.apiId
1735
1786
  });
1736
1787
  }
1737
- function Zr(e, t) {
1738
- return re(e, t.environment) ? (e.activeEnvironmentId.set(t.environment), {
1788
+ function Ss(e, t) {
1789
+ return we(e, t.environment) ? (e.set(K, t.environment), {
1739
1790
  isError: !1,
1740
1791
  data: {
1741
1792
  summary: `Active environment is now "${t.environment}".`
1742
1793
  }
1743
1794
  }) : h("Environment not found.", { environment: t.environment });
1744
1795
  }
1745
- function es(e, t) {
1746
- return t ?? e.activeEnvironmentId.get();
1796
+ function Ts(e, t) {
1797
+ return t ?? e.get(K);
1747
1798
  }
1748
- function P(e, t) {
1749
- const o = es(e, t), n = re(e, o);
1799
+ function F(e, t) {
1800
+ const o = Ts(e, t), n = we(e, o);
1750
1801
  return n ? { ok: !0, name: o, env: n } : {
1751
1802
  ok: !1,
1752
1803
  result: h(
@@ -1755,42 +1806,86 @@ function P(e, t) {
1755
1806
  )
1756
1807
  };
1757
1808
  }
1758
- function re(e, t) {
1759
- return e.environments.find((o) => o.name.get() === t);
1809
+ function we(e, t) {
1810
+ return e.get(ee).find((o) => o.name === t);
1811
+ }
1812
+ function ye(e, t, o) {
1813
+ e.set(
1814
+ ee,
1815
+ (n) => n.map((r) => r.name === t ? o(r) : r)
1816
+ );
1760
1817
  }
1761
- function ts(e) {
1818
+ function Cs(e) {
1762
1819
  return e.inputs.map((t) => ({
1763
1820
  name: t.name,
1764
1821
  isSecret: t.isSecret,
1765
- value: wt(t.isSecret, t.value)
1822
+ value: Nt(t.isSecret, t.value)
1766
1823
  }));
1767
1824
  }
1768
- function os(e) {
1825
+ function Os(e) {
1769
1826
  return e.servers.map((t) => ({
1770
1827
  apiId: t.apiId,
1771
1828
  value: t.value,
1772
1829
  variables: t.variables.map((o) => ({ name: o.name, value: o.value }))
1773
1830
  }));
1774
1831
  }
1775
- function wt(e, t) {
1776
- return e ? Mt : t;
1832
+ function Nt(e, t) {
1833
+ return e ? lo : t;
1834
+ }
1835
+ function As(e, t) {
1836
+ return ne(
1837
+ e.map((o) => o.name),
1838
+ "Input names"
1839
+ ) ?? ne(
1840
+ t.map((o) => o.apiId),
1841
+ "Server apiIds"
1842
+ ) ?? Ut(
1843
+ t,
1844
+ (o) => ne(
1845
+ o.variables.map((n) => n.name),
1846
+ "Variable names",
1847
+ ` in server "${o.apiId}"`
1848
+ )
1849
+ );
1850
+ }
1851
+ function ne(e, t, o = "") {
1852
+ const n = Es(e);
1853
+ return n ? `${t}${o} must be unique; "${n}" appears more than once.` : Ut(e, (r) => Ue(r, t));
1854
+ }
1855
+ function Ue(e, t) {
1856
+ return e.trim() ? co(e) ? `${t} cannot use the reserved key "${e}".` : null : `${t} cannot be blank.`;
1857
+ }
1858
+ function Ut(e, t) {
1859
+ for (const o of e) {
1860
+ const n = t(o);
1861
+ if (n) return n;
1862
+ }
1863
+ return null;
1777
1864
  }
1778
- const ns = {
1865
+ function Es(e) {
1866
+ const t = /* @__PURE__ */ new Set();
1867
+ for (const o of e) {
1868
+ if (t.has(o)) return o;
1869
+ t.add(o);
1870
+ }
1871
+ return null;
1872
+ }
1873
+ const $s = {
1779
1874
  name: "manage_environment",
1780
- definition: Fr,
1781
- createExecutor: (e) => jr(e.store)
1782
- }, rs = et, ss = "Open or focus a tab in Replay.\n\n**What it does**\n- Opens or focuses tabs only (navigation/state change).\n- Does not execute requests and does not create/update/delete saved assets.\n\n**Use when**\n- You need to open a request, operation, collection, workflow, or step tab.\n- You need to bring an already open tab into focus.\n\n**Never use when**\n- You need to execute an HTTP request.\n- You need to run a workflow — use `run_workflow`; it runs headlessly and returns the run's `historyId`.\n- You need to create or edit saved workflow content.\n- You are re-opening the same target only to re-verify unchanged state.\n\n**Input guidance**\n- Use ids exactly as stored in Replay (same spelling and casing).\n- Choose action by intent:\n - `open_new_request`: one-off HTTP call; blank tab when `requestUrl` is omitted, prefilled ad-hoc request when provided (`requestMethod` defaults to GET).\n - `open_operation`: open a spec operation by `operationId` in an unsaved request tab.\n - `open_collection` / `open_workflow` / `open_step`: open saved entities by their required ids.\n - `focus_tab`: focus an already open tab by zero-based `tabIndex`.\n\n**Loop/budget guidance**\n- Open or focus each target once per task unless state changed.\n- Prefer `focus_tab` for already open tabs instead of repeatedly opening the same target.", as = T([
1875
+ definition: us,
1876
+ createExecutor: (e) => ps(e.store)
1877
+ }, xs = wt, _s = "Open or focus a tab in Replay.\n\n**What it does**\n- Opens or focuses tabs only (navigation/state change).\n- Does not execute requests and does not create/update/delete saved assets.\n\n**Use when**\n- You need to open a request, operation, collection, workflow, or step tab.\n- You need to bring an already open tab into focus.\n\n**Never use when**\n- You need to execute an HTTP request.\n- You need to run a workflow — use `run_workflow`; it runs headlessly and returns the run's `historyId`.\n- You need to create or edit saved workflow content.\n- You are re-opening the same target only to re-verify unchanged state.\n\n**Input guidance**\n- Use ids exactly as stored in Replay (same spelling and casing).\n- Choose action by intent:\n - `open_new_request`: one-off HTTP call; blank tab when `requestUrl` is omitted, prefilled ad-hoc request when provided (`requestMethod` defaults to GET).\n - `open_operation`: open a spec operation by `operationId` in an unsaved request tab.\n - `open_collection` / `open_workflow` / `open_step`: open saved entities by their required ids.\n - `focus_tab`: focus an already open tab by zero-based `tabIndex`.\n\n**Loop/budget guidance**\n- Open or focus each target once per task unless state changed.\n- Prefer `focus_tab` for already open tabs instead of repeatedly opening the same target.", Rs = E([
1783
1878
  "focus_tab",
1784
1879
  "open_operation",
1785
1880
  "open_collection",
1786
1881
  "open_workflow",
1787
1882
  "open_step",
1788
1883
  "open_new_request"
1789
- ]), is = B({
1790
- action: as.describe(
1884
+ ]), Ps = te({
1885
+ action: Rs.describe(
1791
1886
  "Tab to open or focus; see tool description for unsaved vs collection actions."
1792
1887
  ),
1793
- tabIndex: S().optional().describe("focus_tab only: zero-based index of an already open tab."),
1888
+ tabIndex: A().optional().describe("focus_tab only: zero-based index of an already open tab."),
1794
1889
  collectionId: i().optional().describe("open_collection, open_workflow, or open_step."),
1795
1890
  workflowId: i().optional().describe("open_workflow or open_step."),
1796
1891
  stepId: i().optional().describe("open_step only."),
@@ -1800,30 +1895,30 @@ const ns = {
1800
1895
  requestUrl: i().optional().describe(
1801
1896
  "open_new_request only: absolute or host URL for an unsaved ad-hoc request (e.g. https://example.com/api). Omit for a blank tab."
1802
1897
  ),
1803
- requestMethod: T(rs).optional().describe("open_new_request with requestUrl: HTTP method; defaults to GET if omitted.")
1898
+ requestMethod: E(xs).optional().describe("open_new_request with requestUrl: HTTP method; defaults to GET if omitted.")
1804
1899
  }).superRefine((e, t) => {
1805
1900
  const n = (e.requestUrl?.trim() ?? "").length > 0, r = e.requestMethod !== void 0;
1806
1901
  (n || r) && e.action !== "open_new_request" && t.addIssue({
1807
- code: W.custom,
1902
+ code: H.custom,
1808
1903
  message: "requestUrl and requestMethod are only valid with action open_new_request.",
1809
1904
  path: ["requestUrl"]
1810
1905
  }), r && !n && t.addIssue({
1811
- code: W.custom,
1906
+ code: H.custom,
1812
1907
  message: "requestMethod requires a non-empty requestUrl.",
1813
1908
  path: ["requestMethod"]
1814
1909
  });
1815
- }), cs = p({
1816
- outcome: T(["focused", "opened"]),
1817
- activeTabIndex: S().int().nonnegative(),
1910
+ }), qs = p({
1911
+ outcome: E(["focused", "opened"]),
1912
+ activeTabIndex: A().int().nonnegative(),
1818
1913
  tabId: i(),
1819
- tabType: to(O)
1820
- }), ls = $(cs), ds = {
1821
- description: ss,
1822
- inputSchema: is,
1823
- outputSchema: ls,
1914
+ tabType: Oo(x)
1915
+ }), Ns = P(qs), Us = {
1916
+ description: _s,
1917
+ inputSchema: Ps,
1918
+ outputSchema: Ns,
1824
1919
  needsApproval: !1
1825
1920
  };
1826
- function se({
1921
+ function ve({
1827
1922
  items: e,
1828
1923
  id: t,
1829
1924
  messages: o,
@@ -1840,19 +1935,19 @@ function se({
1840
1935
  details: { matches: l.map(r) }
1841
1936
  } : { ok: !1, message: o.notFound, details: s(a) };
1842
1937
  }
1843
- function yt(e, t) {
1844
- const o = se({
1845
- items: e.collections,
1938
+ function Dt(e, t) {
1939
+ const o = ve({
1940
+ items: e,
1846
1941
  id: t,
1847
1942
  messages: {
1848
1943
  empty: "Collection id is empty.",
1849
1944
  ambiguous: "Multiple collections share that id; ids must be unique.",
1850
1945
  notFound: "No collection found with that id."
1851
1946
  },
1852
- getItemId: (r) => r.id.get(),
1947
+ getItemId: (r) => r.id,
1853
1948
  formatAmbiguousMatch: (r) => ({
1854
- id: r.id.get(),
1855
- title: r.info.title.get()
1949
+ id: r.id,
1950
+ title: r.info.title
1856
1951
  }),
1857
1952
  buildNotFoundDetails: (r) => ({ collectionId: r })
1858
1953
  });
@@ -1860,13 +1955,13 @@ function yt(e, t) {
1860
1955
  const n = o.value;
1861
1956
  return {
1862
1957
  ok: !0,
1863
- value: { collectionId: n.id.get(), collection: n }
1958
+ value: { collectionId: n.id, collection: n }
1864
1959
  };
1865
1960
  }
1866
- function ge(e, t, o) {
1867
- const n = yt(e, t);
1961
+ function De(e, t, o) {
1962
+ const n = Dt(e, t);
1868
1963
  if (!n.ok) return n;
1869
- const r = se({
1964
+ const r = ve({
1870
1965
  items: n.value.collection.workflows,
1871
1966
  id: o,
1872
1967
  messages: {
@@ -1874,10 +1969,10 @@ function ge(e, t, o) {
1874
1969
  ambiguous: "Multiple workflows share that id in this collection; ids must be unique.",
1875
1970
  notFound: "No workflow found with that id in the given collection."
1876
1971
  },
1877
- getItemId: (a) => a.workflowId.get(),
1972
+ getItemId: (a) => a.workflowId,
1878
1973
  formatAmbiguousMatch: (a) => ({
1879
- workflowId: a.workflowId.get(),
1880
- summary: a.summary?.get()
1974
+ workflowId: a.workflowId,
1975
+ summary: a.summary
1881
1976
  }),
1882
1977
  buildNotFoundDetails: (a) => ({
1883
1978
  collectionId: n.value.collectionId,
@@ -1890,15 +1985,15 @@ function ge(e, t, o) {
1890
1985
  ok: !0,
1891
1986
  value: {
1892
1987
  collectionId: n.value.collectionId,
1893
- workflowId: s.workflowId.get(),
1988
+ workflowId: s.workflowId,
1894
1989
  workflow: s
1895
1990
  }
1896
1991
  };
1897
1992
  }
1898
- function vt(e, t, o, n) {
1899
- const r = ge(e, t, o);
1993
+ function Wt(e, t, o, n) {
1994
+ const r = De(e, t, o);
1900
1995
  if (!r.ok) return r;
1901
- const s = se({
1996
+ const s = ve({
1902
1997
  items: r.value.workflow.steps,
1903
1998
  id: n,
1904
1999
  messages: {
@@ -1906,10 +2001,10 @@ function vt(e, t, o, n) {
1906
2001
  ambiguous: "Multiple steps share that id in this workflow; ids must be unique.",
1907
2002
  notFound: "No step found with that id in the given workflow."
1908
2003
  },
1909
- getItemId: (l) => l.stepId.get(),
2004
+ getItemId: (l) => l.stepId,
1910
2005
  formatAmbiguousMatch: (l) => ({
1911
- stepId: l.stepId.get(),
1912
- description: l.description?.get()
2006
+ stepId: l.stepId,
2007
+ description: l.description
1913
2008
  }),
1914
2009
  buildNotFoundDetails: (l) => ({
1915
2010
  collectionId: r.value.collectionId,
@@ -1924,13 +2019,13 @@ function vt(e, t, o, n) {
1924
2019
  value: {
1925
2020
  collectionId: r.value.collectionId,
1926
2021
  workflowId: r.value.workflowId,
1927
- stepId: a.stepId.get(),
2022
+ stepId: a.stepId,
1928
2023
  step: a
1929
2024
  }
1930
2025
  };
1931
2026
  }
1932
- function us(e, t) {
1933
- const o = Ft(e.apis).filter(
2027
+ function Ds(e, t) {
2028
+ const o = uo(e).filter(
1934
2029
  (r) => r.operationId != null && r.operationId !== ""
1935
2030
  );
1936
2031
  if (!o.length)
@@ -1938,7 +2033,7 @@ function us(e, t) {
1938
2033
  ok: !1,
1939
2034
  message: "No operations with operationId in loaded APIs."
1940
2035
  };
1941
- const n = se({
2036
+ const n = ve({
1942
2037
  items: o,
1943
2038
  id: t,
1944
2039
  messages: {
@@ -1956,38 +2051,85 @@ function us(e, t) {
1956
2051
  });
1957
2052
  return n.ok ? { ok: !0, value: n.value } : n;
1958
2053
  }
1959
- function gt(e, t, o, n) {
1960
- t = t.trim(), o = o.trim(), n = n.trim();
1961
- const r = !t && !o && !n, s = !!(t && o && n);
1962
- if (!r && !s)
2054
+ function Ws(e, t, o, n, r) {
2055
+ o = o.trim(), n = n.trim(), r = r.trim();
2056
+ const s = !o && !n && !r, a = !!(o && n && r);
2057
+ if (!s && !a)
1963
2058
  return {
1964
2059
  ok: !1,
1965
2060
  message: "Provide all three ids for a saved step, or three empty strings for the focused unsaved request tab."
1966
2061
  };
1967
- if (s) {
1968
- const m = vt(e, t, o, n);
1969
- return m.ok ? { ok: !0, value: m.value.step } : m;
2062
+ if (a) {
2063
+ const f = Wt(e, o, n, r);
2064
+ return f.ok ? {
2065
+ ok: !0,
2066
+ value: {
2067
+ step: f.value.step,
2068
+ source: { kind: "saved", collectionId: o, workflowId: n, stepId: r }
2069
+ }
2070
+ } : f;
1970
2071
  }
1971
- const a = fe(e);
1972
- if (!a || !me(a))
2072
+ if (!t || !Z(t))
1973
2073
  return {
1974
2074
  ok: !1,
1975
2075
  message: "Active tab is not a step tab.",
1976
- details: { tabType: a?.data?.type?.get() }
2076
+ details: { tabType: t?.data?.type }
1977
2077
  };
1978
- const l = a.data.collectionId.get(), c = a.data.workflowId.get(), u = a.data.stepId.get();
1979
- if (!tt(l, c, u, "", "", ""))
2078
+ const {
2079
+ collectionId: l,
2080
+ workflowId: c,
2081
+ stepId: d
2082
+ } = t.data;
2083
+ if (!yt(l, c, d, "", "", ""))
1980
2084
  return {
1981
2085
  ok: !1,
1982
2086
  message: "Active tab does not match unsaved draft target. Open the unsaved request tab first, or pass collection/workflow/step ids for a saved step.",
1983
2087
  details: {
1984
- activeTab: { collectionId: l, workflowId: c, stepId: u }
2088
+ activeTab: { collectionId: l, workflowId: c, stepId: d }
2089
+ }
2090
+ };
2091
+ const u = t.data.draftStep;
2092
+ return u ? { ok: !0, value: { step: u, source: { kind: "draft" } } } : { ok: !1, message: "No draft step on the active tab." };
2093
+ }
2094
+ function Lt(e, t, o, n) {
2095
+ const r = Ws(
2096
+ e.get(b),
2097
+ ue(e) ?? null,
2098
+ t,
2099
+ o,
2100
+ n
2101
+ );
2102
+ if (!r.ok) return r;
2103
+ const { step: s, source: a } = r.value;
2104
+ if (a.kind === "saved") {
2105
+ const c = a;
2106
+ return {
2107
+ ok: !0,
2108
+ value: {
2109
+ step: s,
2110
+ readStep: () => $e(e.get(b), c) ?? s,
2111
+ updateStep: (d) => e.set(b, (u) => vt(u, c, d))
1985
2112
  }
1986
2113
  };
1987
- const d = a.data.draftStep.ornull;
1988
- return d ? { ok: !0, value: d } : { ok: !1, message: "No draft step on the active tab." };
2114
+ }
2115
+ const l = xe(e);
2116
+ return {
2117
+ ok: !0,
2118
+ value: {
2119
+ step: s,
2120
+ readStep: () => Ls(e, l) ?? s,
2121
+ updateStep: (c) => Ae(e, l, (d) => ({
2122
+ ...d,
2123
+ draftStep: d.draftStep ? c(d.draftStep) : d.draftStep
2124
+ }))
2125
+ }
2126
+ };
1989
2127
  }
1990
- function ps(e) {
2128
+ function Ls(e, t) {
2129
+ const o = e.get(J)[t];
2130
+ return o && Z(o) ? o.data.draftStep : null;
2131
+ }
2132
+ function Ms(e) {
1991
2133
  return {
1992
2134
  apiId: e.apiId,
1993
2135
  path: e.path,
@@ -1996,196 +2138,209 @@ function ps(e) {
1996
2138
  isAdditionalOperation: e.isAdditionalOperation
1997
2139
  };
1998
2140
  }
1999
- function fs(e, t, o) {
2000
- const n = o.getApiOperation(t), s = e.tabsState.tabs.get({ noproxy: !0 }).findIndex((l) => {
2001
- const c = l.data;
2002
- return Z(c, O.Step) && c.draftStep?.operation?.apiId === t.apiId && c.draftStep?.operation?.path === t.path && c.draftStep?.operation?.method === t.method;
2003
- });
2004
- if (s !== -1)
2005
- return o.handleTabChange(s), "focused";
2006
- const a = jt(t, n);
2007
- return o.addNewTab({ ...a, state: ot.Normal }), "opened";
2141
+ function Fs(e, t) {
2142
+ if (t.focusOperationTab(e))
2143
+ return "focused";
2144
+ const o = t.getApiOperation(e), n = po(e, o);
2145
+ return t.addNewTab({ ...n, state: gt.Normal }), "opened";
2008
2146
  }
2009
- function ms(e, t) {
2147
+ function js(e, t) {
2010
2148
  return (o, n) => {
2011
2149
  try {
2012
2150
  switch (o.action) {
2013
2151
  case "focus_tab":
2014
- return hs(e, t, o.tabIndex);
2152
+ return Bs(e, t, o.tabIndex);
2015
2153
  case "open_operation":
2016
- return Is(e, t, o.operationId);
2154
+ return Ys(e, t, o.operationId);
2017
2155
  case "open_collection":
2018
- return ws(e, t, o.collectionId);
2156
+ return zs(e, e.get(b), t, o.collectionId);
2019
2157
  case "open_workflow":
2020
- return ys(e, t, o.collectionId, o.workflowId);
2158
+ return Hs(
2159
+ e,
2160
+ e.get(b),
2161
+ t,
2162
+ o.collectionId,
2163
+ o.workflowId
2164
+ );
2021
2165
  case "open_step":
2022
- return vs(e, t, o.collectionId, o.workflowId, o.stepId);
2166
+ return Gs(
2167
+ e,
2168
+ e.get(b),
2169
+ t,
2170
+ o.collectionId,
2171
+ o.workflowId,
2172
+ o.stepId
2173
+ );
2023
2174
  case "open_new_request":
2024
- return gs(e, t, o.requestUrl, o.requestMethod);
2175
+ return Vs(e, t, o.requestUrl, o.requestMethod);
2025
2176
  default: {
2026
2177
  const r = o.action;
2027
- return C("Unsupported open_tab action.", { action: r });
2178
+ return $("Unsupported open_tab action.", { action: r });
2028
2179
  }
2029
2180
  }
2030
2181
  } catch (r) {
2031
- return C("Failed to open or focus tab.", {
2182
+ return $("Failed to open or focus tab.", {
2032
2183
  cause: r instanceof Error ? r.message : String(r)
2033
2184
  });
2034
2185
  }
2035
2186
  };
2036
2187
  }
2037
- function hs(e, t, o) {
2188
+ function Bs(e, t, o) {
2038
2189
  if (o === void 0)
2039
- return C("tabIndex is required when action is focus_tab");
2040
- const n = e.tabsState.tabs.get({ noproxy: !0 });
2041
- return o < 0 || o >= n.length ? C("Invalid tab index.", {
2190
+ return $("tabIndex is required when action is focus_tab");
2191
+ const n = e.get(J);
2192
+ return o < 0 || o >= n.length ? $("Invalid tab index.", {
2042
2193
  tabIndex: o,
2043
2194
  tabCount: n.length
2044
- }) : (t.handleTabChange(o), F(e, "focused"));
2195
+ }) : (t.handleTabChange(o), X(e, "focused"));
2045
2196
  }
2046
- function Is(e, t, o) {
2197
+ function Ys(e, t, o) {
2047
2198
  const n = o?.trim();
2048
2199
  if (!n)
2049
- return C("operationId is required when action is open_operation");
2050
- const r = us(e, n);
2200
+ return $("operationId is required when action is open_operation");
2201
+ const r = Ds(e.get(de), n);
2051
2202
  if (!r.ok)
2052
- return C(r.message, r.details);
2053
- const s = fs(
2054
- e,
2055
- ps(r.value),
2203
+ return $(r.message, r.details);
2204
+ const s = Fs(
2205
+ Ms(r.value),
2056
2206
  t
2057
2207
  );
2058
- return F(e, s);
2208
+ return X(e, s);
2059
2209
  }
2060
- function ws(e, t, o) {
2061
- const n = o?.trim();
2062
- if (!n)
2063
- return C("collectionId is required when action is open_collection");
2064
- const r = yt(e, n);
2065
- if (!r.ok)
2066
- return C(r.message, r.details);
2067
- const { collectionId: s } = r.value, a = e.tabsState.tabs.findIndex((l) => {
2068
- const c = l.data.get();
2069
- return Z(c, O.Collection) && c.collectionId === s;
2210
+ function zs(e, t, o, n) {
2211
+ const r = n?.trim();
2212
+ if (!r)
2213
+ return $("collectionId is required when action is open_collection");
2214
+ const s = Dt(t, r);
2215
+ if (!s.ok)
2216
+ return $(s.message, s.details);
2217
+ const { collectionId: a } = s.value, l = e.get(J).findIndex((c) => {
2218
+ const d = c.data;
2219
+ return _e(d, x.Collection) && d.collectionId === a;
2070
2220
  }) !== -1;
2071
- return t.openCollectionTab({
2072
- collectionId: s,
2073
- activeTabName: nt.COLLECTION_SETTINGS
2074
- }), F(e, a ? "focused" : "opened");
2221
+ return o.openCollectionTab({
2222
+ collectionId: a,
2223
+ activeTabName: bt.COLLECTION_SETTINGS
2224
+ }), X(e, l ? "focused" : "opened");
2075
2225
  }
2076
- function ys(e, t, o, n) {
2077
- const r = o?.trim(), s = n?.trim();
2078
- if (!r)
2079
- return C("collectionId is required when action is open_workflow");
2226
+ function Hs(e, t, o, n, r) {
2227
+ const s = n?.trim(), a = r?.trim();
2080
2228
  if (!s)
2081
- return C("workflowId is required when action is open_workflow");
2082
- const a = ge(e, r, s);
2083
- if (!a.ok)
2084
- return C(a.message, a.details);
2085
- const { collectionId: l, workflowId: c } = a.value, u = e.tabsState.tabs.findIndex((d) => {
2086
- const m = d.data.get();
2087
- return Z(m, O.Workflow) && m.workflowId === c && m.collectionId === l;
2229
+ return $("collectionId is required when action is open_workflow");
2230
+ if (!a)
2231
+ return $("workflowId is required when action is open_workflow");
2232
+ const l = De(t, s, a);
2233
+ if (!l.ok)
2234
+ return $(l.message, l.details);
2235
+ const { collectionId: c, workflowId: d } = l.value, u = e.get(J).findIndex((f) => {
2236
+ const m = f.data;
2237
+ return _e(m, x.Workflow) && m.workflowId === d && m.collectionId === c;
2088
2238
  }) !== -1;
2089
- return t.openWorkflowTab({
2090
- collectionId: l,
2091
- workflowId: c,
2092
- activeTabName: nt.WORKFLOW_SETTINGS
2093
- }), F(e, u ? "focused" : "opened");
2239
+ return o.openWorkflowTab({
2240
+ collectionId: c,
2241
+ workflowId: d,
2242
+ activeTabName: bt.WORKFLOW_SETTINGS
2243
+ }), X(e, u ? "focused" : "opened");
2094
2244
  }
2095
- function vs(e, t, o, n, r) {
2096
- const s = o?.trim(), a = n?.trim(), l = r?.trim();
2097
- if (!s)
2098
- return C("collectionId is required when action is open_step");
2245
+ function Gs(e, t, o, n, r, s) {
2246
+ const a = n?.trim(), l = r?.trim(), c = s?.trim();
2099
2247
  if (!a)
2100
- return C("workflowId is required when action is open_step");
2248
+ return $("collectionId is required when action is open_step");
2101
2249
  if (!l)
2102
- return C("stepId is required when action is open_step");
2103
- const c = vt(e, s, a, l);
2104
- if (!c.ok)
2105
- return C(c.message, c.details);
2250
+ return $("workflowId is required when action is open_step");
2251
+ if (!c)
2252
+ return $("stepId is required when action is open_step");
2253
+ const d = Wt(
2254
+ t,
2255
+ a,
2256
+ l,
2257
+ c
2258
+ );
2259
+ if (!d.ok)
2260
+ return $(d.message, d.details);
2106
2261
  const {
2107
2262
  collectionId: u,
2108
- workflowId: d,
2263
+ workflowId: f,
2109
2264
  stepId: m
2110
- } = c.value, f = e.tabsState.tabs.get().find(({ data: y }) => Z(y, O.Step) && y.collectionId === u && y.workflowId === d && y.stepId === m && y.historyId === null) !== void 0;
2111
- return t.openStepTabFromCollection({
2265
+ } = d.value, g = e.get(J).find(({ data: v }) => _e(v, x.Step) && v.collectionId === u && v.workflowId === f && v.stepId === m && v.historyId === null) !== void 0;
2266
+ return o.openStepTabFromCollection({
2112
2267
  collectionId: u,
2113
- workflowId: d,
2268
+ workflowId: f,
2114
2269
  stepId: m,
2115
- state: ot.Normal
2116
- }), F(e, f ? "focused" : "opened");
2270
+ state: gt.Normal
2271
+ }), X(e, g ? "focused" : "opened");
2117
2272
  }
2118
- function gs(e, t, o, n) {
2273
+ function Vs(e, t, o, n) {
2119
2274
  return o ? t.openStepTabFromXOperation({
2120
2275
  method: n ?? "GET",
2121
2276
  url: o
2122
- }) : t.handleNewTabOpen(), F(e, "opened");
2277
+ }) : t.handleNewTabOpen(), X(e, "opened");
2123
2278
  }
2124
- function F(e, t) {
2125
- const o = e.tabsState.activeTabIdx.get(), n = e.tabsState.tabs.get({ noproxy: !0 })[o];
2126
- return n ? bs(t, o, n.id, n.data.type) : C("No active tab after navigation.", { activeTabIndex: o });
2279
+ function X(e, t) {
2280
+ const o = xe(e), n = ue(e);
2281
+ return n ? Ks(t, o, n.id, n.data.type) : $("No active tab after navigation.", { activeTabIndex: o });
2127
2282
  }
2128
- function C(e, t) {
2283
+ function $(e, t) {
2129
2284
  return {
2130
2285
  isError: !0,
2131
2286
  error: { message: e, ...t !== void 0 ? { details: t } : {} }
2132
2287
  };
2133
2288
  }
2134
- function bs(e, t, o, n) {
2289
+ function Ks(e, t, o, n) {
2135
2290
  return { isError: !1, data: { outcome: e, activeTabIndex: t, tabId: o, tabType: n } };
2136
2291
  }
2137
- const ks = {
2292
+ const Js = {
2138
2293
  name: "open_tab",
2139
- definition: ds,
2140
- createExecutor: (e) => ms(e.store, e.context)
2141
- }, Ss = `Report a short milestone status for the current task. UI-only: shows a one-line status above the next action; performs no workflow action and returns only acknowledgment.
2294
+ definition: Us,
2295
+ createExecutor: (e) => js(e.store, e.context)
2296
+ }, Qs = `Report a short milestone status for the current task. UI-only: shows a one-line status above the next action; performs no workflow action and returns only acknowledgment.
2142
2297
 
2143
2298
  Use when: starting a multi-step task after deciding the plan; crossing a major phase boundary (planning -> creating -> wiring -> verifying); starting a new debug attempt; or pivoting to a different approach.
2144
2299
 
2145
2300
  Report at most one status per phase and only a few per task. Do not narrate routine tool calls, repeat the previous status, or use it in place of the final assistant response. Make the message concrete and user-facing: plain text, no markdown; name the relevant Arazzo object; describe milestone intent, not internal reasoning or tool names.
2146
2301
 
2147
- Duplicates of earlier statuses and statuses reported back-to-back with no action in between add no value; when detected, the acknowledgment includes a corrective note - act on it instead of reporting another status. Too many statuses in a row are blocked instead of acknowledged.`, Ts = B({
2302
+ Duplicates of earlier statuses and statuses reported back-to-back with no action in between add no value; when detected, the acknowledgment includes a corrective note - act on it instead of reporting another status. Too many statuses in a row are blocked instead of acknowledged.`, Xs = te({
2148
2303
  message: i().trim().min(1).max(220).regex(/^[^\r\n]+$/, "must be a single line").describe(
2149
2304
  "Short status line for a milestone (plan start, phase boundary, new debug attempt, pivot). Plain text, no markdown. Do not narrate every tool call."
2150
2305
  )
2151
- }), Cs = p({
2306
+ }), Zs = p({
2152
2307
  acknowledged: I(!0)
2153
- }), Os = $(Cs), As = {
2154
- description: Ss,
2155
- inputSchema: Ts,
2156
- outputSchema: Os,
2308
+ }), ea = P(Zs), ta = {
2309
+ description: Qs,
2310
+ inputSchema: Xs,
2311
+ outputSchema: ea,
2157
2312
  needsApproval: !1
2158
2313
  };
2159
- function xs() {
2314
+ function oa() {
2160
2315
  return async () => ({
2161
2316
  isError: !1,
2162
2317
  data: { acknowledged: !0 }
2163
2318
  });
2164
2319
  }
2165
- const Es = "Duplicate of a previous status - it adds nothing for the user. Do not repeat statuses; take a concrete action instead.";
2166
- function $s(e) {
2320
+ const na = "Duplicate of a previous status - it adds nothing for the user. Do not repeat statuses; take a concrete action instead.";
2321
+ function ra(e) {
2167
2322
  return `You have reported ${e} statuses in a row with no action between them. Stop reporting status; take a concrete action (edit, run, or read) now.`;
2168
2323
  }
2169
- function _s(e) {
2324
+ function sa(e) {
2170
2325
  return `STOP: ${e} status messages in a row with no action taken. Reporting status is not progress. Do NOT call report_status again until you have made a change or run a request. Take the next concrete action now, or if you are blocked, say so in your final answer.`;
2171
2326
  }
2172
- const Rs = [
2173
- pt({
2174
- key: (e) => ut(e.message),
2175
- warn: Es
2327
+ const aa = [
2328
+ xt({
2329
+ key: (e) => $t(e.message),
2330
+ warn: na
2176
2331
  }),
2177
- sn({
2332
+ xn({
2178
2333
  warnAfter: 2,
2179
- warnMessage: $s,
2334
+ warnMessage: ra,
2180
2335
  blockAfter: 4,
2181
- blockMessage: _s
2336
+ blockMessage: sa
2182
2337
  })
2183
- ], qs = {
2338
+ ], ia = {
2184
2339
  name: "report_status",
2185
- definition: As,
2186
- guards: Rs,
2187
- createExecutor: (e) => xs()
2188
- }, Ps = `Send the HTTP request for the **currently focused** Replay step tab and return the live response.
2340
+ definition: ta,
2341
+ guards: aa,
2342
+ createExecutor: (e) => oa()
2343
+ }, ca = `Send the HTTP request for the **currently focused** Replay step tab and return the live response.
2189
2344
 
2190
2345
  **What it does**
2191
2346
  - Executes the request from the active step context (saved step or focused draft step).
@@ -2214,7 +2369,7 @@ const Rs = [
2214
2369
  - Execute when you need new runtime evidence, not by default after every edit.
2215
2370
  - Re-run after meaningful request/config changes or when validating a fix/hypothesis.
2216
2371
  - Avoid rapid duplicate runs with unchanged inputs when prior output already answers the question.
2217
- - For endpoint exploration, treat one run per endpoint as default budget unless inputs changed or rerun is explicitly needed.`, Ns = p({
2372
+ - For endpoint exploration, treat one run per endpoint as default budget unless inputs changed or rerun is explicitly needed.`, la = p({
2218
2373
  collectionId: i().describe(
2219
2374
  "Saved step: collection id. Unsaved draft tab on focus: empty string (with empty workflowId and stepId)."
2220
2375
  ),
@@ -2227,91 +2382,127 @@ const Rs = [
2227
2382
  }).strict().superRefine((e, t) => {
2228
2383
  const o = e.collectionId.trim(), n = e.workflowId.trim(), r = e.stepId.trim();
2229
2384
  !(o && n && r) && !(!o && !n && !r) && t.addIssue({
2230
- code: W.custom,
2385
+ code: H.custom,
2231
2386
  message: "Provide all three ids for a saved step, or three empty strings for the focused unsaved request tab.",
2232
2387
  path: ["collectionId"]
2233
2388
  });
2234
- }), Us = p({
2235
- status: S().optional().describe("HTTP status code."),
2236
- headers: b($e([i(), i()])).optional().describe("Response headers as key-value pairs."),
2237
- cookies: b($e([i(), i()])).optional().describe("Response cookies as key-value pairs."),
2389
+ }), da = p({
2390
+ status: A().optional().describe("HTTP status code."),
2391
+ headers: T(Ge([i(), i()])).optional().describe("Response headers as key-value pairs."),
2392
+ cookies: T(Ge([i(), i()])).optional().describe("Response cookies as key-value pairs."),
2238
2393
  body: i().optional().describe("Response body, truncated if too large."),
2239
2394
  url: i().optional().describe("Final response URL."),
2240
- duration: S().optional().describe("Request duration in milliseconds."),
2241
- size: S().optional().describe("Response size in bytes.")
2242
- }), Ds = $(Us), Ls = {
2243
- description: Ps,
2244
- inputSchema: Ns,
2245
- outputSchema: Ds,
2395
+ duration: A().optional().describe("Request duration in milliseconds."),
2396
+ size: A().optional().describe("Response size in bytes.")
2397
+ }), ua = P(da), pa = {
2398
+ description: ca,
2399
+ inputSchema: la,
2400
+ outputSchema: ua,
2246
2401
  needsApproval: () => !0
2247
2402
  };
2248
- function Ws(e, t) {
2403
+ function fa(e, t) {
2249
2404
  return async (n, r) => {
2250
- const s = fe(e);
2251
- if (!s || !me(s))
2405
+ const s = xe(t), a = ue(t);
2406
+ if (!a || !Z(a))
2252
2407
  return h("Active tab is not a step tab", {
2253
- tabType: s?.data?.type?.get()
2408
+ tabType: a?.data?.type
2254
2409
  });
2255
- const a = s.data.collectionId.get(), l = s.data.workflowId.get(), c = s.data.stepId.get(), u = n.collectionId.trim(), d = n.workflowId.trim(), m = n.stepId.trim();
2256
- if (!tt(
2257
- a,
2410
+ const {
2411
+ collectionId: l,
2412
+ workflowId: c,
2413
+ stepId: d
2414
+ } = a.data, u = n.collectionId.trim(), f = n.workflowId.trim(), m = n.stepId.trim();
2415
+ if (!yt(
2258
2416
  l,
2259
2417
  c,
2260
- u,
2261
2418
  d,
2419
+ u,
2420
+ f,
2262
2421
  m
2263
2422
  ))
2264
2423
  return h(
2265
2424
  "Active tab does not match the target step. Open the target tab first using open_tab.",
2266
2425
  {
2267
2426
  activeTab: {
2268
- collectionId: a,
2269
- workflowId: l,
2270
- stepId: c
2427
+ collectionId: l,
2428
+ workflowId: c,
2429
+ stepId: d
2271
2430
  },
2272
- hint: a === null && l === null && c === null ? "Focused tab is an unsaved request; pass empty strings for collectionId, workflowId, and stepId." : void 0
2431
+ hint: l === null && c === null && d === null ? "Focused tab is an unsaved request; pass empty strings for collectionId, workflowId, and stepId." : void 0
2273
2432
  }
2274
2433
  );
2275
- const y = Ze(e, {
2434
+ const v = t.get(b), w = {
2276
2435
  collectionId: u || null,
2277
- workflowId: d || null,
2436
+ workflowId: f || null,
2278
2437
  stepId: m || null
2279
- }) ?? s.data.draftStep.ornull;
2280
- if (!y)
2438
+ }, O = $e(v, w), S = a.data.draftStep;
2439
+ let q;
2440
+ if (O)
2441
+ q = {
2442
+ step: O,
2443
+ onStepChange: ((W) => t.set(
2444
+ b,
2445
+ (U) => vt(U, w, W)
2446
+ ))
2447
+ };
2448
+ else if (S)
2449
+ q = {
2450
+ step: S,
2451
+ onStepChange: ((W) => Ae(t, s, (U) => ({
2452
+ ...U,
2453
+ draftStep: U.draftStep ? W(U.draftStep) : U.draftStep
2454
+ })))
2455
+ };
2456
+ else
2281
2457
  return h("No step available for the active tab.");
2282
- await Bt(e, y, t);
2283
- const v = s.data.response.get();
2284
- return v ? {
2458
+ const ge = V(v, w);
2459
+ await fo(
2460
+ {
2461
+ tabId: a.id,
2462
+ updateData: (W) => Ae(t, s, W)
2463
+ },
2464
+ {
2465
+ ...q,
2466
+ workflow: ge,
2467
+ onWorkflowChange: (W) => t.set(b, (U) => pe(U, w, W)),
2468
+ collection: G(v, w.collectionId),
2469
+ collections: v
2470
+ },
2471
+ e,
2472
+ mo(t.get(ee), t.get(K))
2473
+ );
2474
+ const N = t.get(J)[s], je = N && Z(N) ? N.data.response : null;
2475
+ return je ? {
2285
2476
  isError: !1,
2286
- data: Ms(v)
2477
+ data: ma(je)
2287
2478
  } : h("Request did not produce a response.");
2288
2479
  };
2289
2480
  }
2290
- function Ms(e) {
2481
+ function ma(e) {
2291
2482
  return {
2292
2483
  status: e.status,
2293
- headers: Ye(e.headers),
2294
- cookies: Ye(e.cookies),
2295
- body: Fs(e.body ?? ""),
2484
+ headers: it(e.headers),
2485
+ cookies: it(e.cookies),
2486
+ body: ha(e.body ?? ""),
2296
2487
  url: e.url ?? "",
2297
2488
  duration: e.duration,
2298
2489
  size: e.size
2299
2490
  };
2300
2491
  }
2301
- function Ye(e) {
2492
+ function it(e) {
2302
2493
  const t = [];
2303
2494
  for (const o of e)
2304
2495
  t.push([String(o[0]), String(o[1])]);
2305
2496
  return t;
2306
2497
  }
2307
- function Fs(e) {
2308
- return e.length <= L ? e : `${e.slice(0, L)}… (truncated, total ${e.length} chars)`;
2498
+ function ha(e) {
2499
+ return e.length <= z ? e : `${e.slice(0, z)}… (truncated, total ${e.length} chars)`;
2309
2500
  }
2310
- const js = {
2501
+ const Ia = {
2311
2502
  name: "run_request",
2312
- definition: Ls,
2313
- createExecutor: (e) => Ws(e.store, e.settingsState)
2314
- }, Bs = `Run an Arazzo workflow and return its result.
2503
+ definition: pa,
2504
+ createExecutor: (e) => fa(e.settings, e.store)
2505
+ }, wa = `Run an Arazzo workflow and return its result.
2315
2506
 
2316
2507
  **What it does**
2317
2508
  - Executes the whole workflow (all steps, with cross-step \`$steps.*\` resolution) and waits for it to finish.
@@ -2334,52 +2525,52 @@ const js = {
2334
2525
  **After the run**
2335
2526
  - Report the outcome from this tool's result; do not re-read it with other tools.
2336
2527
  - When \`historyId\` is non-null, link to the run: \`[label](replay://workflow-run?collectionId=...&workflowId=...&historyId=...)\`. That link reopens this exact run; it never starts a new one. When it is null, say the run was not saved instead of building a link; never put the literal text null in the url.
2337
- - Each call starts a NEW run. Call it again only when the user wants another run.`, Ys = B({
2528
+ - Each call starts a NEW run. Call it again only when the user wants another run.`, ya = te({
2338
2529
  collectionId: i().describe("Id of the collection that holds the workflow."),
2339
2530
  workflowId: i().describe("Id of the workflow to run.")
2340
- }), zs = p({
2531
+ }), va = p({
2341
2532
  stepId: i(),
2342
- statusCode: S().int().nullable(),
2343
- passed: E()
2344
- }), Hs = p({
2533
+ statusCode: A().int().nullable(),
2534
+ passed: R()
2535
+ }), ga = p({
2345
2536
  collectionId: i().describe("Resolved id of the collection that was run."),
2346
2537
  workflowId: i().describe("Resolved id of the workflow that was run."),
2347
2538
  historyId: i().nullable().describe(
2348
2539
  "Id of this saved run. Put it in the workflow-run link as &historyId=... so the user can reopen this exact run. Null when history is not persisted."
2349
2540
  ),
2350
- success: E().describe(
2541
+ success: R().describe(
2351
2542
  "Overall verdict from the execution engine. False when a step failed a non-warn check or the run hit the global timeout. Can be false even when passedSteps equals totalSteps: a step that failed and then passed on retry is not counted as failed here."
2352
2543
  ),
2353
- timedOut: E().describe(
2544
+ timedOut: R().describe(
2354
2545
  "True when the run hit the global execution timeout. Then success is false even if every listed step passed; report that the run timed out rather than blaming a step."
2355
2546
  ),
2356
- durationMs: S().describe("Total run time in milliseconds."),
2357
- totalSteps: S().int().nonnegative(),
2358
- passedSteps: S().int().nonnegative(),
2359
- steps: b(zs).describe(
2547
+ durationMs: A().describe("Total run time in milliseconds."),
2548
+ totalSteps: A().int().nonnegative(),
2549
+ passedSteps: A().int().nonnegative(),
2550
+ steps: T(va).describe(
2360
2551
  "Per-step outcome, in execution order: stepId, HTTP statusCode, and pass/fail only — no check name or failure message."
2361
2552
  )
2362
- }), Gs = $(Hs), Vs = {
2363
- description: Bs,
2364
- inputSchema: Ys,
2365
- outputSchema: Gs,
2553
+ }), ba = P(ga), ka = {
2554
+ description: wa,
2555
+ inputSchema: ya,
2556
+ outputSchema: ba,
2366
2557
  needsApproval: !1
2367
2558
  };
2368
- function Ks(e, t) {
2559
+ function Sa(e, t) {
2369
2560
  return async (o, n) => {
2370
2561
  const r = o.collectionId.trim(), s = o.workflowId.trim();
2371
2562
  if (!r)
2372
2563
  return h("collectionId is required.");
2373
2564
  if (!s)
2374
2565
  return h("workflowId is required.");
2375
- const a = ge(e, r, s);
2566
+ const a = De(e.get(b), r, s);
2376
2567
  if (!a.ok)
2377
2568
  return h(
2378
2569
  a.message,
2379
2570
  a.details
2380
2571
  );
2381
2572
  try {
2382
- const { workflowResult: l, historyId: c, verdict: u } = await t({
2573
+ const { workflowResult: l, historyId: c, verdict: d } = await t({
2383
2574
  collectionId: a.value.collectionId,
2384
2575
  workflowId: a.value.workflowId
2385
2576
  });
@@ -2389,15 +2580,15 @@ function Ks(e, t) {
2389
2580
  collectionId: a.value.collectionId,
2390
2581
  workflowId: a.value.workflowId,
2391
2582
  historyId: c,
2392
- success: u.succeeded,
2393
- timedOut: u.timedOut,
2583
+ success: d.succeeded,
2584
+ timedOut: d.timedOut,
2394
2585
  durationMs: l.totalTimeMs,
2395
- totalSteps: u.totalSteps,
2396
- passedSteps: u.passedSteps,
2397
- steps: u.steps.map(({ step: d, passed: m }) => ({
2398
- stepId: d.stepId,
2399
- statusCode: d.response?.statusCode ?? null,
2400
- passed: m
2586
+ totalSteps: d.totalSteps,
2587
+ passedSteps: d.passedSteps,
2588
+ steps: d.steps.map(({ step: u, passed: f }) => ({
2589
+ stepId: u.stepId,
2590
+ statusCode: u.response?.statusCode ?? null,
2591
+ passed: f
2401
2592
  }))
2402
2593
  }
2403
2594
  };
@@ -2408,18 +2599,18 @@ function Ks(e, t) {
2408
2599
  }
2409
2600
  };
2410
2601
  }
2411
- const Js = {
2602
+ const Ta = {
2412
2603
  name: "run_workflow",
2413
- definition: Vs,
2414
- createExecutor: (e) => Ks(e.store, e.runWorkflow)
2415
- }, Qs = 25, Xs = 'RAG semantic search over OpenAPI specs and Arazzo assets in the current Replay project.\n\n**What it does**\n- Finds OpenAPI and Arazzo entities via natural-language query (scoped by `type`), returning up to `count` matches with detail via `include`.\n\n**Use when**\n- You need **initial schema/context** or request schema details from project assets.\n- You need canonical IDs/coordinates for an API, collection, workflow, or step.\n- You need to find operations/workflows/steps by natural language when IDs are unknown.\n\n**Never use when**\n- You are only verifying post-action UI changes in the active tab.\n- You already have exact IDs and only need active-tab state.\n- You are about to repeat an identical no-result query.\n\n**Input guidance**\n- Rewording the same query rarely helps; change `type`, `query`, or intent instead.\n- "Collection" is ambiguous (Arazzo entity vs API requests by tags/path/criteria). For request lists, use `type: api_operation` with query/filters—not Arazzo `collection`.\n- Pass all known filters (`apiId`, `path`, `method`, `operationId`, `collectionId`, `workflowId`, `stepId`); `query + filters` is most precise.\n- If semantic search returns no matches, ID filters enable direct lookup (see pairing on each filter field).\n- Phrase `query` like indexed text: titles/descriptions for collections/workflows; `step: …`; `operationId: …`; path/method/tags for endpoints.\n- If results are empty and lookup needs missing IDs, the tool may ask for them.\n', Zs = p({
2604
+ definition: ka,
2605
+ createExecutor: (e) => Sa(e.store, e.runWorkflow)
2606
+ }, Ca = 25, Oa = 'RAG semantic search over OpenAPI specs and Arazzo assets in the current Replay project.\n\n**What it does**\n- Finds OpenAPI and Arazzo entities via natural-language query (scoped by `type`), returning up to `count` matches with detail via `include`.\n\n**Use when**\n- You need **initial schema/context** or request schema details from project assets.\n- You need canonical IDs/coordinates for an API, collection, workflow, or step.\n- You need to find operations/workflows/steps by natural language when IDs are unknown.\n\n**Never use when**\n- You are only verifying post-action UI changes in the active tab.\n- You already have exact IDs and only need active-tab state.\n- You are about to repeat an identical no-result query.\n\n**Input guidance**\n- Rewording the same query rarely helps; change `type`, `query`, or intent instead.\n- "Collection" is ambiguous (Arazzo entity vs API requests by tags/path/criteria). For request lists, use `type: api_operation` with query/filters—not Arazzo `collection`.\n- Pass all known filters (`apiId`, `path`, `method`, `operationId`, `collectionId`, `workflowId`, `stepId`); `query + filters` is most precise.\n- If semantic search returns no matches, ID filters enable direct lookup (see pairing on each filter field).\n- Phrase `query` like indexed text: titles/descriptions for collections/workflows; `step: …`; `operationId: …`; path/method/tags for endpoints.\n- If results are empty and lookup needs missing IDs, the tool may ask for them.\n', Aa = p({
2416
2607
  query: i().optional().describe("Natural language search query."),
2417
- count: S().positive().max(Qs).optional().default(10),
2418
- type: T(["api_operation", "api", "collection", "workflow", "step"]).describe(
2608
+ count: A().positive().max(Ca).optional().default(10),
2609
+ type: E(["api_operation", "api", "collection", "workflow", "step"]).describe(
2419
2610
  "Scope results to this item type. api = OpenAPI spec; api_operation = API endpoint; collection = Arazzo collection; workflow = Arazzo workflow; step = Arazzo workflow step."
2420
2611
  ),
2421
- include: b(
2422
- T([
2612
+ include: T(
2613
+ E([
2423
2614
  "description",
2424
2615
  "path",
2425
2616
  "method",
@@ -2446,15 +2637,15 @@ const Js = {
2446
2637
  collectionId: i().optional().describe("Arazzo collection ID."),
2447
2638
  workflowId: i().optional().describe("Workflow ID within the collection. Requires collectionId."),
2448
2639
  stepId: i().optional().describe("Step ID within a workflow. Requires collectionId and workflowId.")
2449
- }).strict(), ea = te(), ta = {
2450
- description: Xs,
2451
- inputSchema: Zs,
2452
- outputSchema: ea,
2640
+ }).strict(), Ea = me(), $a = {
2641
+ description: Oa,
2642
+ inputSchema: Aa,
2643
+ outputSchema: Ea,
2453
2644
  needsApproval: !1
2454
- }, oa = ["get", "put", "post", "delete", "options", "head", "patch", "trace"], na = ["query", "x-query"];
2455
- function ra(e) {
2645
+ }, xa = ["get", "put", "post", "delete", "options", "head", "patch", "trace"], _a = ["query", "x-query"];
2646
+ function Ra(e) {
2456
2647
  return async (t, o) => {
2457
- const n = so(), r = {
2648
+ const n = xo(), r = {
2458
2649
  type: t.type,
2459
2650
  apiId: t.apiId,
2460
2651
  operationId: t.operationId,
@@ -2465,21 +2656,21 @@ function ra(e) {
2465
2656
  stepId: t.stepId
2466
2657
  }, s = t.query ?? "";
2467
2658
  let a = await n.search(s, t.count, r);
2468
- return a.length === 0 && (a = la(e, r)), a.length === 0 ? {
2659
+ return a.length === 0 && (a = Da(e, r)), a.length === 0 ? {
2469
2660
  isError: !1,
2470
2661
  data: {
2471
- message: `No results found. ${sa(t)}`
2662
+ message: `No results found. ${Pa(t)}`
2472
2663
  }
2473
2664
  } : {
2474
2665
  isError: !1,
2475
2666
  data: {
2476
- message: da(a, t.include)
2667
+ message: Wa(a, t.include)
2477
2668
  }
2478
2669
  };
2479
2670
  };
2480
2671
  }
2481
- function sa(e) {
2482
- const t = [], { type: o, apiId: n, path: r, method: s, operationId: a, collectionId: l, workflowId: c, stepId: u, query: d } = e;
2672
+ function Pa(e) {
2673
+ const t = [], { type: o, apiId: n, path: r, method: s, operationId: a, collectionId: l, workflowId: c, stepId: d, query: u } = e;
2483
2674
  switch (o) {
2484
2675
  case "api":
2485
2676
  n || t.push("apiId");
@@ -2489,8 +2680,8 @@ function sa(e) {
2489
2680
  t.push("apiId");
2490
2681
  break;
2491
2682
  }
2492
- const v = a != null && a !== "", A = r != null && r !== "" && s != null && s !== "";
2493
- !v && !A && t.push("operationId", "path", "method");
2683
+ const v = a != null && a !== "", w = r != null && r !== "" && s != null && s !== "";
2684
+ !v && !w && t.push("operationId", "path", "method");
2494
2685
  break;
2495
2686
  }
2496
2687
  case "collection":
@@ -2500,111 +2691,111 @@ function sa(e) {
2500
2691
  l ? c || t.push("workflowId") : t.push("collectionId");
2501
2692
  break;
2502
2693
  case "step":
2503
- l ? c ? u || t.push("stepId") : t.push("workflowId") : t.push("collectionId");
2694
+ l ? c ? d || t.push("stepId") : t.push("workflowId") : t.push("collectionId");
2504
2695
  break;
2505
2696
  default:
2506
- if (l != null && l !== "" && (c ? u || t.push("stepId") : t.push("workflowId")), n != null && n !== "") {
2507
- const v = a != null && a !== "", A = r != null && r !== "" && s != null && s !== "";
2508
- !v && !A && t.push("operationId", "path", "method");
2697
+ if (l != null && l !== "" && (c ? d || t.push("stepId") : t.push("workflowId")), n != null && n !== "") {
2698
+ const v = a != null && a !== "", w = r != null && r !== "" && s != null && s !== "";
2699
+ !v && !w && t.push("operationId", "path", "method");
2509
2700
  }
2510
2701
  }
2511
- d != null && d.trim() !== "" || t.push("query");
2512
- const f = [...new Set(t)];
2513
- let y;
2514
- return f.length === 0 ? y = "You already pass strong filters. Try a more specific natural-language query, or confirm IDs and paths match the project." : y = `To improve results, prefer adding (in order): ${f.slice(0, 5).join(", ")}. When names are known but IDs are not, phrase query like indexed text: collection/workflow titles and descriptions; step: …; operationId: …; path/method/summary/tags for endpoints.`, y;
2702
+ u != null && u.trim() !== "" || t.push("query");
2703
+ const m = [...new Set(t)];
2704
+ let g;
2705
+ return m.length === 0 ? g = "You already pass strong filters. Try a more specific natural-language query, or confirm IDs and paths match the project." : g = `To improve results, prefer adding (in order): ${m.slice(0, 5).join(", ")}. When names are known but IDs are not, phrase query like indexed text: collection/workflow titles and descriptions; step: …; operationId: …; path/method/summary/tags for endpoints.`, g;
2515
2706
  }
2516
- function aa(e, t) {
2707
+ function qa(e, t) {
2517
2708
  const o = e.paths ?? {};
2518
2709
  for (const [n, r] of Object.entries(o)) {
2519
2710
  if (!r || typeof r != "object") continue;
2520
2711
  const s = r, a = [
2521
- ...oa.filter((c) => c in r),
2522
- ...na.filter((c) => c in r)
2712
+ ...xa.filter((c) => c in r),
2713
+ ..._a.filter((c) => c in r)
2523
2714
  ];
2524
2715
  for (const c of a) {
2525
- const u = r[c];
2526
- if (!u || typeof u != "object") continue;
2527
- const d = u;
2528
- if (!(t.operationId && (d.operationId ?? "") !== t.operationId) && !(t.path && n !== t.path) && !(t.method && c.toUpperCase() !== t.method.toUpperCase()))
2529
- return { path: n, method: c, op: d, pathItem: s };
2716
+ const d = r[c];
2717
+ if (!d || typeof d != "object") continue;
2718
+ const u = d;
2719
+ if (!(t.operationId && (u.operationId ?? "") !== t.operationId) && !(t.path && n !== t.path) && !(t.method && c.toUpperCase() !== t.method.toUpperCase()))
2720
+ return { path: n, method: c, op: u, pathItem: s };
2530
2721
  }
2531
2722
  const l = s.additionalOperations;
2532
2723
  if (l && typeof l == "object")
2533
- for (const [c, u] of Object.entries(l)) {
2534
- if (!u || typeof u != "object") continue;
2535
- const d = u;
2536
- if (!(t.operationId && (d.operationId ?? "") !== t.operationId) && !(t.path && n !== t.path) && !(t.method && c.toUpperCase() !== t.method.toUpperCase()))
2537
- return { path: n, method: c, op: d, pathItem: s };
2724
+ for (const [c, d] of Object.entries(l)) {
2725
+ if (!d || typeof d != "object") continue;
2726
+ const u = d;
2727
+ if (!(t.operationId && (u.operationId ?? "") !== t.operationId) && !(t.path && n !== t.path) && !(t.method && c.toUpperCase() !== t.method.toUpperCase()))
2728
+ return { path: n, method: c, op: u, pathItem: s };
2538
2729
  }
2539
2730
  }
2540
2731
  return null;
2541
2732
  }
2542
- function ia(e, t) {
2733
+ function Na(e, t) {
2543
2734
  const { type: o, apiId: n, operationId: r, path: s, method: a } = t;
2544
2735
  if (!n) return [];
2545
- const l = e.find((y) => y.id === n);
2736
+ const l = e.find((g) => g.id === n);
2546
2737
  if (!l) return [];
2547
2738
  if (o === "api")
2548
- return [{ ..._e(l).payload, score: 1 }];
2549
- const c = r != null && r !== "", u = s != null && s !== "" && a != null && a !== "";
2550
- if (!(o === "api_operation" || c || u || o == null && (c || u)))
2551
- return o == null ? [{ ..._e(l).payload, score: 1 }] : [];
2552
- const m = aa(l, { operationId: r, path: s, method: a });
2553
- return m ? [{ ...ao({
2739
+ return [{ ...Ve(l).payload, score: 1 }];
2740
+ const c = r != null && r !== "", d = s != null && s !== "" && a != null && a !== "";
2741
+ if (!(o === "api_operation" || c || d || o == null && (c || d)))
2742
+ return o == null ? [{ ...Ve(l).payload, score: 1 }] : [];
2743
+ const f = qa(l, { operationId: r, path: s, method: a });
2744
+ return f ? [{ ..._o({
2554
2745
  apiId: l.id,
2555
2746
  apiTitle: l.info?.title ?? "Untitled API",
2556
- path: m.path,
2557
- method: m.method,
2558
- op: m.op,
2559
- pathItem: m.pathItem,
2560
- globalSchemes: io(l),
2747
+ path: f.path,
2748
+ method: f.method,
2749
+ op: f.op,
2750
+ pathItem: f.pathItem,
2751
+ globalSchemes: Ro(l),
2561
2752
  apiSecurity: l.security
2562
2753
  }).payload, score: 1 }] : [];
2563
2754
  }
2564
- function ca(e, t) {
2755
+ function Ua(e, t) {
2565
2756
  const { type: o, collectionId: n, workflowId: r, stepId: s } = t;
2566
2757
  if (!n) return [];
2567
- const a = e.find((d) => d.id === n);
2758
+ const a = e.find((u) => u.id === n);
2568
2759
  if (!a) return [];
2569
2760
  const l = a.info?.title ?? "Untitled Collection";
2570
2761
  if (o === "collection")
2571
- return [{ ...Re(a).payload, score: 1 }];
2762
+ return [{ ...Ke(a).payload, score: 1 }];
2572
2763
  const c = () => {
2573
2764
  if (!r || !s) return [];
2574
- const d = a.workflows?.find((f) => (f.workflowId ?? "") === r);
2575
- if (!d) return [];
2576
- const m = d.steps?.find((f) => (f.stepId ?? "") === s);
2577
- return m ? [
2765
+ const u = a.workflows?.find((m) => (m.workflowId ?? "") === r);
2766
+ if (!u) return [];
2767
+ const f = u.steps?.find((m) => (m.stepId ?? "") === s);
2768
+ return f ? [
2578
2769
  {
2579
- ...co({
2770
+ ...Po({
2580
2771
  collectionId: n,
2581
2772
  collectionTitle: l,
2582
2773
  workflowId: r,
2583
- workflowTitle: d.summary ?? r,
2584
- step: m
2774
+ workflowTitle: u.summary ?? r,
2775
+ step: f
2585
2776
  }).payload,
2586
2777
  score: 1
2587
2778
  }
2588
2779
  ] : [];
2589
- }, u = () => {
2780
+ }, d = () => {
2590
2781
  if (!r) return [];
2591
- const d = a.workflows?.find((m) => (m.workflowId ?? "") === r);
2592
- return d ? [
2782
+ const u = a.workflows?.find((f) => (f.workflowId ?? "") === r);
2783
+ return u ? [
2593
2784
  {
2594
- ...lo({ collectionId: n, collectionTitle: l, workflow: d }).payload,
2785
+ ...qo({ collectionId: n, collectionTitle: l, workflow: u }).payload,
2595
2786
  score: 1
2596
2787
  }
2597
2788
  ] : [];
2598
2789
  };
2599
- return o === "step" ? c() : o === "workflow" ? u() : o == null ? s && r ? c() : r ? u() : [{ ...Re(a).payload, score: 1 }] : [];
2790
+ return o === "step" ? c() : o === "workflow" ? d() : o == null ? s && r ? c() : r ? d() : [{ ...Ke(a).payload, score: 1 }] : [];
2600
2791
  }
2601
- function la(e, t) {
2602
- const o = e.apis.get(), n = e.collections.get(), { type: r } = t;
2603
- return r === "api" || r === "api_operation" ? ia(o, t) : r === "collection" || r === "workflow" || r === "step" ? ca(n, t) : [];
2792
+ function Da(e, t) {
2793
+ const o = e.get(de), n = e.get(b), { type: r } = t;
2794
+ return r === "api" || r === "api_operation" ? Na(o, t) : r === "collection" || r === "workflow" || r === "step" ? Ua(n, t) : [];
2604
2795
  }
2605
- function da(e, t) {
2796
+ function Wa(e, t) {
2606
2797
  return [
2607
- Yo(e, t).join(`
2798
+ hn(e, t).join(`
2608
2799
 
2609
2800
  `)
2610
2801
  // ... other parts
@@ -2612,51 +2803,51 @@ function da(e, t) {
2612
2803
 
2613
2804
  `);
2614
2805
  }
2615
- const ua = "You already ran this exact search earlier in this conversation. If nothing has changed since then, reuse those results instead of repeating. If you expect different results (for example after an edit), do not just repeat the same search - change the query, the type, or the filters, or read the current state another way.", pa = 10;
2616
- function fa(e) {
2806
+ const La = "You already ran this exact search earlier in this conversation. If nothing has changed since then, reuse those results instead of repeating. If you expect different results (for example after an edit), do not just repeat the same search - change the query, the type, or the filters, or read the current state another way.", Ma = 10;
2807
+ function Fa(e) {
2617
2808
  const t = [
2618
2809
  e.type,
2619
- _(e.query),
2620
- _(e.apiId),
2621
- _(e.operationId),
2622
- _(e.path),
2623
- _(e.method)?.toLowerCase(),
2624
- _(e.collectionId),
2625
- _(e.workflowId),
2626
- _(e.stepId)
2810
+ D(e.query),
2811
+ D(e.apiId),
2812
+ D(e.operationId),
2813
+ D(e.path),
2814
+ D(e.method)?.toLowerCase(),
2815
+ D(e.collectionId),
2816
+ D(e.workflowId),
2817
+ D(e.stepId)
2627
2818
  ];
2628
- return t.every((o) => o == null) ? null : JSON.stringify([...t, ma(e), ha(e)]);
2819
+ return t.every((o) => o == null) ? null : JSON.stringify([...t, ja(e), Ba(e)]);
2629
2820
  }
2630
- function ma(e) {
2631
- return typeof e?.count == "number" ? e.count : pa;
2821
+ function ja(e) {
2822
+ return typeof e?.count == "number" ? e.count : Ma;
2632
2823
  }
2633
- function ha(e) {
2824
+ function Ba(e) {
2634
2825
  return Array.isArray(e?.include) ? [...new Set(e.include)].sort() : [];
2635
2826
  }
2636
- function _(e) {
2827
+ function D(e) {
2637
2828
  if (typeof e != "string") return null;
2638
- const t = ut(e);
2829
+ const t = $t(e);
2639
2830
  return t === "" ? null : t;
2640
2831
  }
2641
- const Ia = [
2642
- pt({
2643
- key: fa,
2644
- warn: ua
2832
+ const Ya = [
2833
+ xt({
2834
+ key: Fa,
2835
+ warn: La
2645
2836
  })
2646
- ], wa = {
2837
+ ], za = {
2647
2838
  name: "search",
2648
- definition: ta,
2649
- guards: Ia,
2650
- createExecutor: (e) => ra(e.store)
2651
- }, ya = "Update security (x-security) for one or more Replay steps.\n\n**What it does**\n- Applies atomic add/update/remove changes to step security entries.\n- `add` UPSERTS by scheme identity: an existing entry with the same `schemeId` (or same `type` when `schemeId` is omitted) - including the auto-seeded entry created when the step was linked to its operation - is updated in place, never duplicated. Repeated identical wiring converges.\n- The result echoes each affected step's resulting security in `resultingState`; confirm from it, do NOT re-read tabs after mutation.\n- Empty security list falls back to No Auth.\n\n**Targeting**\n- Saved step: `collectionId` + `workflowId` + `stepId`.\n- Multi-step batch: set `changes[].stepId` per change (top-level `stepId` is the default and may be empty); wire a whole chain in ONE call.\n- Unsaved draft tab on focus: all three ids empty strings, no per-change stepId.\n\n**Choosing the type (match the OpenAPI scheme)**\n- http bearer -> `JWT` (`data.token`). A plain bearer token is NOT OAuth 2.0.\n- http basic -> `Basic Auth`, http digest -> `Digest Auth` (`data.username`, `data.password`).\n- apiKey -> `API key` (`data.name`, `data.key`, `data.location`); keep `data.key`'s `$inputs.<name>` segment identical to `data.name`.\n- oauth2 (grant-based flows only) -> `OAuth 2.0`; `data.grantType` is REQUIRED with flow values (`accessToken`, `clientId`, ...): `clientCredentials`, `clientCredentialsWithJwtAssertion`, `authorizationCode`, `authorizationCodeWithPkce`, `implicit`, `password`.\n- openIdConnect -> `OpenID Connect` (`data.openIdConnectUrl` plus OAuth2 fields).\n- `add` with a `schemeId` existing under a different type is rejected; use `update` at that index only to intentionally change a type.\n\n**Change shapes**\n- add/update: `{ action, stepId?, index?, type, schemeId?, data? }`; pass `schemeId` whenever known (it is the upsert identity), `index` is required for update.\n- remove: `{ action: \"remove\", stepId?, index }`.", va = [
2839
+ definition: $a,
2840
+ guards: Ya,
2841
+ createExecutor: (e) => Ra(e.store)
2842
+ }, Ha = "Update security (x-security) for one or more Replay steps.\n\n**What it does**\n- Applies atomic add/update/remove changes to step security entries.\n- `add` UPSERTS by scheme identity: an existing entry with the same `schemeId` (or same `type` when `schemeId` is omitted) - including the auto-seeded entry created when the step was linked to its operation - is updated in place, never duplicated. Repeated identical wiring converges.\n- The result echoes each affected step's resulting security in `resultingState`; confirm from it, do NOT re-read tabs after mutation.\n- Empty security list falls back to No Auth.\n\n**Targeting**\n- Saved step: `collectionId` + `workflowId` + `stepId`.\n- Multi-step batch: set `changes[].stepId` per change (top-level `stepId` is the default and may be empty); wire a whole chain in ONE call.\n- Unsaved draft tab on focus: all three ids empty strings, no per-change stepId.\n\n**Choosing the type (match the OpenAPI scheme)**\n- http bearer -> `JWT` (`data.token`). A plain bearer token is NOT OAuth 2.0.\n- http basic -> `Basic Auth`, http digest -> `Digest Auth` (`data.username`, `data.password`).\n- apiKey -> `API key` (`data.name`, `data.key`, `data.location`); keep `data.key`'s `$inputs.<name>` segment identical to `data.name`.\n- oauth2 (grant-based flows only) -> `OAuth 2.0`; `data.grantType` is REQUIRED with flow values (`accessToken`, `clientId`, ...): `clientCredentials`, `clientCredentialsWithJwtAssertion`, `authorizationCode`, `authorizationCodeWithPkce`, `implicit`, `password`.\n- openIdConnect -> `OpenID Connect` (`data.openIdConnectUrl` plus OAuth2 fields).\n- `add` with a `schemeId` existing under a different type is rejected; use `update` at that index only to intentionally change a type.\n\n**Change shapes**\n- add/update: `{ action, stepId?, index?, type, schemeId?, data? }`; pass `schemeId` whenever known (it is the upsert identity), `index` is required for update.\n- remove: `{ action: \"remove\", stepId?, index }`.", Ga = [
2652
2843
  "clientCredentials",
2653
2844
  "clientCredentialsWithJwtAssertion",
2654
2845
  "authorizationCode",
2655
2846
  "authorizationCodeWithPkce",
2656
2847
  "implicit",
2657
2848
  "password"
2658
- ], ga = {
2659
- grantType: T(va).optional().describe("OAuth2 grant type."),
2849
+ ], Va = {
2850
+ grantType: E(Ga).optional().describe("OAuth2 grant type."),
2660
2851
  clientId: i().optional(),
2661
2852
  clientSecret: i().optional(),
2662
2853
  tokenUrl: i().optional(),
@@ -2665,65 +2856,65 @@ const Ia = [
2665
2856
  accessToken: i().optional(),
2666
2857
  username: i().optional().describe("For password grant type."),
2667
2858
  password: i().optional().describe("For password grant type.")
2668
- }, ba = p({
2859
+ }, Ka = p({
2669
2860
  username: i().optional(),
2670
2861
  password: i().optional()
2671
- }).strict(), ka = p({
2862
+ }).strict(), Ja = p({
2672
2863
  username: i().optional(),
2673
2864
  password: i().optional()
2674
- }).strict(), Sa = p({
2865
+ }).strict(), Qa = p({
2675
2866
  token: i().optional()
2676
- }).strict(), Ta = p({
2677
- location: T(["header", "query", "cookie"]).optional(),
2867
+ }).strict(), Xa = p({
2868
+ location: E(["header", "query", "cookie"]).optional(),
2678
2869
  name: i().optional().describe(
2679
2870
  "Must match the OpenAPI security scheme `name` (header/query/cookie parameter name). Not the scheme component ref id (e.g. UserCookie)."
2680
2871
  ),
2681
2872
  key: i().optional().describe(
2682
2873
  "Secret value or `$inputs.<name>` / `{$inputs.<name>}`. The `<name>` segment must be identical to `data.name` (OpenAPI apiKey `name`, e.g. accessToken). Wrong example: `data.name` accessToken but key `$inputs.UserCookie` (UserCookie is the securitySchemes ref, not the cookie name)."
2683
2874
  )
2684
- }).strict(), bt = p({
2685
- ...ga
2686
- }).strict(), Ca = bt.extend({
2875
+ }).strict(), Mt = p({
2876
+ ...Va
2877
+ }).strict(), Za = Mt.extend({
2687
2878
  openIdConnectUrl: i().optional(),
2688
2879
  userInfoUrl: i().optional()
2689
- }).strict(), kt = i().optional().describe(
2880
+ }).strict(), Ft = i().optional().describe(
2690
2881
  "Target step id for this change. Overrides the top-level stepId; use to batch changes for several steps of the same workflow in one call."
2691
- ), N = mn.extend({
2692
- action: T(["add", "update"]),
2882
+ ), j = Wn.extend({
2883
+ action: E(["add", "update"]),
2693
2884
  schemeId: i().optional(),
2694
- stepId: kt
2695
- }), Oa = oe("type", [
2696
- N.extend({
2697
- type: I(g.BasicAuth),
2698
- data: ba.optional()
2885
+ stepId: Ft
2886
+ }), ei = he("type", [
2887
+ j.extend({
2888
+ type: I(k.BasicAuth),
2889
+ data: Ka.optional()
2699
2890
  }).strict(),
2700
- N.extend({
2701
- type: I(g.DigestAuth),
2702
- data: ka.optional()
2891
+ j.extend({
2892
+ type: I(k.DigestAuth),
2893
+ data: Ja.optional()
2703
2894
  }).strict(),
2704
- N.extend({
2705
- type: I(g.JWT),
2706
- data: Sa.optional()
2895
+ j.extend({
2896
+ type: I(k.JWT),
2897
+ data: Qa.optional()
2707
2898
  }).strict(),
2708
- N.extend({
2709
- type: I(g.APIKey),
2710
- data: Ta.optional()
2899
+ j.extend({
2900
+ type: I(k.APIKey),
2901
+ data: Xa.optional()
2711
2902
  }).strict(),
2712
- N.extend({
2713
- type: I(g.OAuth2),
2714
- data: bt.optional()
2903
+ j.extend({
2904
+ type: I(k.OAuth2),
2905
+ data: Mt.optional()
2715
2906
  }).strict(),
2716
- N.extend({
2717
- type: I(g.OpenIDConnect),
2718
- data: Ca.optional()
2907
+ j.extend({
2908
+ type: I(k.OpenIDConnect),
2909
+ data: Za.optional()
2719
2910
  }).strict()
2720
- ]), Aa = ye.extend({
2911
+ ]), ti = qe.extend({
2721
2912
  action: I("remove"),
2722
- index: S().int().min(0).describe(
2913
+ index: A().int().min(0).describe(
2723
2914
  "0-based position of the entry in the step's current security list; every index in one call refers to that same list. Position, not schemeId, identifies the entry - a step can list the same scheme more than once."
2724
2915
  ),
2725
- stepId: kt
2726
- }).strict(), xa = we([Oa, Aa]), Ea = p({
2916
+ stepId: Ft
2917
+ }).strict(), oi = Pe([ei, ti]), ni = p({
2727
2918
  collectionId: i().describe(
2728
2919
  "Saved step: collection id. Unsaved draft tab on focus: empty string (with empty workflowId and stepId)."
2729
2920
  ),
@@ -2733,31 +2924,31 @@ const Ia = [
2733
2924
  stepId: i().describe(
2734
2925
  "Saved step: step id (default target for changes without their own stepId; may be empty when every change sets one). Unsaved draft tab: empty string (with empty collectionId and workflowId)."
2735
2926
  ),
2736
- changes: b(xa).min(1).describe("List of security changes to apply.")
2927
+ changes: T(oi).min(1).describe("List of security changes to apply.")
2737
2928
  }).strict().superRefine((e, t) => {
2738
- const o = e.collectionId.trim(), n = e.workflowId.trim(), r = e.stepId.trim(), s = e.changes.map((d) => d.stepId?.trim()), a = s.every(Boolean), l = s.some(Boolean);
2929
+ const o = e.collectionId.trim(), n = e.workflowId.trim(), r = e.stepId.trim(), s = e.changes.map((u) => u.stepId?.trim()), a = s.every(Boolean), l = s.some(Boolean);
2739
2930
  !(o && n && (r || a)) && !(!o && !n && !r && !l) && t.addIssue({
2740
- code: W.custom,
2931
+ code: H.custom,
2741
2932
  message: "Provide collectionId and workflowId plus a stepId for every change (top-level or per-change), or all empty ids for the focused unsaved request tab.",
2742
2933
  path: ["collectionId"]
2743
2934
  });
2744
- }), $a = ft, _a = {
2745
- description: ya,
2746
- inputSchema: Ea,
2747
- outputSchema: $a,
2935
+ }), ri = _t, si = {
2936
+ description: Ha,
2937
+ inputSchema: ni,
2938
+ outputSchema: ri,
2748
2939
  needsApproval: () => !0
2749
- }, x = {
2940
+ }, _ = {
2750
2941
  ADD: "add",
2751
2942
  UPDATE: "update",
2752
2943
  REMOVE: "remove"
2753
2944
  };
2754
- function w(e, t) {
2945
+ function y(e, t) {
2755
2946
  return {
2756
2947
  status: e,
2757
2948
  ...t !== void 0 && { summary: t }
2758
2949
  };
2759
2950
  }
2760
- function St(e) {
2951
+ function jt(e) {
2761
2952
  if (!e || typeof e != "object" || !("meta" in e))
2762
2953
  return {};
2763
2954
  const { meta: t } = e;
@@ -2766,120 +2957,120 @@ function St(e) {
2766
2957
  const o = "totalChanges" in t && typeof t.totalChanges == "number" ? t.totalChanges : void 0, n = "approvedChanges" in t && typeof t.approvedChanges == "number" ? t.approvedChanges : void 0;
2767
2958
  return { totalChanges: o, approvedChanges: n };
2768
2959
  }
2769
- function Ra(e, t) {
2960
+ function ai(e, t) {
2770
2961
  return !Number.isInteger(t.index) || t.index < 0 || t.index >= e.length ? {
2771
2962
  ok: !1,
2772
2963
  message: `Index ${t.index} out of bounds. Step has ${e.length} security entries.`
2773
2964
  } : { ok: !0, entry: e[t.index] };
2774
2965
  }
2775
- const qa = /* @__PURE__ */ new Set(["grantType", "openIdConnectUrl", "userInfoUrl"]);
2776
- function Pa(e) {
2777
- return e.type === g.OAuth2 || e.type === g.OpenIDConnect;
2966
+ const ii = /* @__PURE__ */ new Set(["grantType", "openIdConnectUrl", "userInfoUrl"]);
2967
+ function ci(e) {
2968
+ return e.type === k.OAuth2 || e.type === k.OpenIDConnect;
2778
2969
  }
2779
- function ze(e, t) {
2970
+ function ct(e, t) {
2780
2971
  const o = e;
2781
2972
  for (const [n, r] of Object.entries(t))
2782
2973
  r !== void 0 && n in o && (o[n] = r);
2783
2974
  }
2784
- function He(e, t) {
2975
+ function lt(e, t) {
2785
2976
  const o = Object.entries(t);
2786
2977
  for (const [s, a] of o)
2787
- s === "grantType" && typeof a == "string" && Ae[a] && (e.grantType = Ae[a]);
2788
- const n = e[e.grantType], r = new Set(Object.keys(zt[e.grantType]));
2978
+ s === "grantType" && typeof a == "string" && Ye[a] && (e.grantType = Ye[a]);
2979
+ const n = e[e.grantType], r = new Set(Object.keys(Io[e.grantType]));
2789
2980
  for (const [s, a] of o)
2790
2981
  s !== "grantType" && a !== void 0 && r.has(s) && (n[s] = a);
2791
2982
  }
2792
- function Tt(e) {
2793
- return e.securityType === g.NoAuth ? null : e[e.securityType]?.schemeName ?? null;
2983
+ function Bt(e) {
2984
+ return e.securityType === k.NoAuth ? null : e[e.securityType]?.schemeName ?? null;
2794
2985
  }
2795
- function Na(e, t) {
2796
- !t || e.securityType === g.NoAuth || (e.securitySchemeId = t, e[e.securityType].schemeName = t);
2986
+ function li(e, t) {
2987
+ !t || e.securityType === k.NoAuth || (e.securitySchemeId = t, e[e.securityType].schemeName = t);
2797
2988
  }
2798
- function ie(e, t) {
2799
- if (e.securityType = t.type, Na(e, t.schemeId), !t.data) return e;
2989
+ function ke(e, t) {
2990
+ if (e.securityType = t.type, li(e, t.schemeId), !t.data) return e;
2800
2991
  switch (t.type) {
2801
- case g.BasicAuth:
2802
- case g.DigestAuth:
2803
- case g.JWT:
2804
- ze(e[t.type], t.data);
2992
+ case k.BasicAuth:
2993
+ case k.DigestAuth:
2994
+ case k.JWT:
2995
+ ct(e[t.type], t.data);
2805
2996
  break;
2806
- case g.APIKey: {
2997
+ case k.APIKey: {
2807
2998
  const { location: o, ...n } = t.data;
2808
- ze(e[g.APIKey], n), o && (e[g.APIKey].location = Yt(o));
2999
+ ct(e[k.APIKey], n), o && (e[k.APIKey].location = ho(o));
2809
3000
  break;
2810
3001
  }
2811
- case g.OAuth2:
2812
- He(e[g.OAuth2], t.data);
3002
+ case k.OAuth2:
3003
+ lt(e[k.OAuth2], t.data);
2813
3004
  break;
2814
- case g.OpenIDConnect: {
3005
+ case k.OpenIDConnect: {
2815
3006
  const { openIdConnectUrl: o, userInfoUrl: n, ...r } = t.data;
2816
- He(e[g.OpenIDConnect], r), o !== void 0 && (e[g.OpenIDConnect].openIdConnectUrl = o), n !== void 0 && (e[g.OpenIDConnect].userInfoUrl = n);
3007
+ lt(e[k.OpenIDConnect], r), o !== void 0 && (e[k.OpenIDConnect].openIdConnectUrl = o), n !== void 0 && (e[k.OpenIDConnect].userInfoUrl = n);
2817
3008
  break;
2818
3009
  }
2819
3010
  }
2820
3011
  return e;
2821
3012
  }
2822
- function Ua(e, t) {
3013
+ function di(e, t) {
2823
3014
  return t.schemeId ? e.findIndex(
2824
- (o) => o.securitySchemeId === t.schemeId || Tt(o) === t.schemeId
3015
+ (o) => o.securitySchemeId === t.schemeId || Bt(o) === t.schemeId
2825
3016
  ) : e.findIndex((o) => o.securityType === t.type);
2826
3017
  }
2827
- function Da(e) {
3018
+ function ui(e) {
2828
3019
  return e.data ? Object.entries(e.data).some(
2829
- ([t, o]) => o !== void 0 && !qa.has(t)
3020
+ ([t, o]) => o !== void 0 && !ii.has(t)
2830
3021
  ) : !1;
2831
3022
  }
2832
- function La(e) {
3023
+ function pi(e) {
2833
3024
  return e.schemeId ? `${e.type} (scheme '${e.schemeId}')` : e.type;
2834
3025
  }
2835
- function Ge(e, t, o, n) {
3026
+ function dt(e, t, o, n) {
2836
3027
  return e.has(t) ? {
2837
3028
  ok: !1,
2838
3029
  message: `The security entry at index ${o} is targeted by both a mutation and a remove${n}; issue only one action for it.`
2839
3030
  } : null;
2840
3031
  }
2841
- function Wa(e, t, o) {
3032
+ function fi(e, t, o) {
2842
3033
  let n = e;
2843
3034
  const r = [], s = t.filter(
2844
- (c) => c.action !== x.REMOVE
3035
+ (c) => c.action !== _.REMOVE
2845
3036
  ), a = t.filter(
2846
- (c) => c.action === x.REMOVE
3037
+ (c) => c.action === _.REMOVE
2847
3038
  ), l = /* @__PURE__ */ new Set();
2848
3039
  for (const c of a) {
2849
- const u = Ra(e, c);
2850
- if (!u.ok) return { ok: !1, message: u.message };
2851
- l.add(u.entry);
3040
+ const d = ai(e, c);
3041
+ if (!d.ok) return { ok: !1, message: d.message };
3042
+ l.add(d.entry);
2852
3043
  }
2853
3044
  for (const c of s) {
2854
- if (c.action === x.ADD) {
2855
- const m = n.length === 1 && n[0].securityType === g.NoAuth, f = m ? -1 : Ua(n, c);
2856
- if (f >= 0) {
2857
- const v = n[f], A = Ge(l, v, f, o);
2858
- if (A) return A;
3045
+ if (c.action === _.ADD) {
3046
+ const f = n.length === 1 && n[0].securityType === k.NoAuth, m = f ? -1 : di(n, c);
3047
+ if (m >= 0) {
3048
+ const v = n[m], w = dt(l, v, m, o);
3049
+ if (w) return w;
2859
3050
  if (v.securityType !== c.type)
2860
3051
  return {
2861
3052
  ok: !1,
2862
- message: `Scheme '${c.schemeId}' already exists${o} as ${v.securityType}, not ${c.type}. Match the documented scheme type (plain http/bearer -> JWT with data.token; OAuth 2.0 only for grant-based flows), or use action "update" at index ${f} to intentionally change the type.`
3053
+ message: `Scheme '${c.schemeId}' already exists${o} as ${v.securityType}, not ${c.type}. Match the documented scheme type (plain http/bearer -> JWT with data.token; OAuth 2.0 only for grant-based flows), or use action "update" at index ${m} to intentionally change the type.`
2863
3054
  };
2864
- n = [...n], n[f] = ie(
3055
+ n = [...n], n[m] = ke(
2865
3056
  structuredClone(v),
2866
3057
  c
2867
3058
  ), r.push(
2868
- w(
3059
+ y(
2869
3060
  "applied",
2870
- `Updated existing ${La(c)} in place (index: ${f})${o}`
3061
+ `Updated existing ${pi(c)} in place (index: ${m})${o}`
2871
3062
  )
2872
3063
  );
2873
3064
  continue;
2874
3065
  }
2875
- if (Pa(c) && Da(c) && !c.data?.grantType)
3066
+ if (ci(c) && ui(c) && !c.data?.grantType)
2876
3067
  return {
2877
3068
  ok: !1,
2878
- message: `grantType is required when adding ${c.type} security with flow values${o}. For a plain http/bearer token use type "${g.JWT}" with data.token instead.`
3069
+ message: `grantType is required when adding ${c.type} security with flow values${o}. For a plain http/bearer token use type "${k.JWT}" with data.token instead.`
2879
3070
  };
2880
- const y = ie(Oe(), c);
2881
- n = m ? [y] : [...n, y], r.push(
2882
- w(
3071
+ const g = ke(Be(), c);
3072
+ n = f ? [g] : [...n, g], r.push(
3073
+ y(
2883
3074
  "applied",
2884
3075
  `Added ${c.type} security (index: ${n.length - 1})${o}`
2885
3076
  )
@@ -2893,50 +3084,48 @@ function Wa(e, t, o) {
2893
3084
  ok: !1,
2894
3085
  message: `Index ${c.index} out of bounds. Step has ${n.length} security entries.`
2895
3086
  };
2896
- const u = n[c.index], d = Ge(l, u, c.index, o);
2897
- if (d) return d;
2898
- if (u.securitySchemeId) {
2899
- const m = Tt(u);
2900
- if (c.schemeId && m !== c.schemeId)
3087
+ const d = n[c.index], u = dt(l, d, c.index, o);
3088
+ if (u) return u;
3089
+ if (d.securitySchemeId) {
3090
+ const f = Bt(d);
3091
+ if (c.schemeId && f !== c.schemeId)
2901
3092
  return {
2902
3093
  ok: !1,
2903
- message: `schemeId mismatch at index ${c.index}. Expected ${m ?? "none"}.`
3094
+ message: `schemeId mismatch at index ${c.index}. Expected ${f ?? "none"}.`
2904
3095
  };
2905
3096
  }
2906
- n = [...n], n[c.index] = ie(structuredClone(u), c), r.push(
2907
- w("applied", `Updated ${c.type} at index ${c.index}${o}`)
3097
+ n = [...n], n[c.index] = ke(structuredClone(d), c), r.push(
3098
+ y("applied", `Updated ${c.type} at index ${c.index}${o}`)
2908
3099
  );
2909
3100
  }
2910
3101
  if (l.size > 0) {
2911
- const c = n.filter((d) => !l.has(d)), u = n.length - c.length;
3102
+ const c = n.filter((u) => !l.has(u)), d = n.length - c.length;
2912
3103
  n = c;
2913
- for (let d = 0; d < u; d++)
2914
- r.push(w("applied"));
3104
+ for (let u = 0; u < d; u++)
3105
+ r.push(y("applied"));
2915
3106
  }
2916
- return n.length === 0 && (n = [Oe()]), { ok: !0, security: n, applied: r };
3107
+ return n.length === 0 && (n = [Be()]), { ok: !0, security: n, applied: r };
2917
3108
  }
2918
- function Ma(e) {
3109
+ function mi(e) {
2919
3110
  return async (t) => {
2920
- const { changes: o, collectionId: n, workflowId: r, stepId: s } = t, a = St(t), l = s.trim(), c = /* @__PURE__ */ new Map();
2921
- for (const f of o) {
2922
- const y = f.stepId?.trim() || l, v = c.get(y);
2923
- v ? v.push(f) : c.set(y, [f]);
3111
+ const { changes: o, collectionId: n, workflowId: r, stepId: s } = t, a = jt(t), l = s.trim(), c = /* @__PURE__ */ new Map();
3112
+ for (const m of o) {
3113
+ const g = m.stepId?.trim() || l, v = c.get(g);
3114
+ v ? v.push(m) : c.set(g, [m]);
2924
3115
  }
2925
- const u = [], d = [];
2926
- for (const [f, y] of c) {
2927
- const v = gt(e, n, r, f);
3116
+ const d = [], u = [];
3117
+ for (const [m, g] of c) {
3118
+ const v = Lt(e, n, r, m);
2928
3119
  if (!v.ok)
2929
3120
  return h(v.message, v.details);
2930
- const A = v.value, Ce = f || A.stepId.get(), At = c.size > 1 ? ` for step '${Ce}'` : "", xt = Array.from(
2931
- A.security.get({ noproxy: !0 })
2932
- ), Y = Wa(xt, y, At);
2933
- if (!Y.ok) return h(Y.message);
2934
- u.push(...Y.applied), d.push({ step: A, security: Y.security, label: Ce });
3121
+ const { readStep: w, updateStep: O } = v.value, S = m || v.value.step.stepId, q = c.size > 1 ? ` for step '${S}'` : "", ge = Array.from(w().security), N = fi(ge, g, q);
3122
+ if (!N.ok) return h(N.message);
3123
+ d.push(...N.applied), u.push({ updateStep: O, security: N.security, label: S });
2935
3124
  }
2936
- for (const f of d)
2937
- f.step.security.set(f.security);
2938
- const m = d.map((f) => `stepId=${f.label}
2939
- ${ee(f.security)}`).join(`
3125
+ for (const m of u)
3126
+ m.updateStep((g) => ({ ...g, security: m.security }));
3127
+ const f = u.map((m) => `stepId=${m.label}
3128
+ ${fe(m.security)}`).join(`
2940
3129
 
2941
3130
  `);
2942
3131
  return {
@@ -2944,17 +3133,17 @@ ${ee(f.security)}`).join(`
2944
3133
  data: {
2945
3134
  totalChanges: a.totalChanges ?? o.length,
2946
3135
  approvedChanges: a.approvedChanges ?? o.length,
2947
- applied: u,
2948
- resultingState: m
3136
+ applied: d,
3137
+ resultingState: f
2949
3138
  }
2950
3139
  };
2951
3140
  };
2952
3141
  }
2953
- const Fa = {
3142
+ const hi = {
2954
3143
  name: "update_security",
2955
- definition: _a,
2956
- createExecutor: (e) => Ma(e.store)
2957
- }, ja = `Update an existing Replay step with atomic changes.
3144
+ definition: si,
3145
+ createExecutor: (e) => mi(e.store)
3146
+ }, Ii = `Update an existing Replay step with atomic changes.
2958
3147
 
2959
3148
  **What it does**
2960
3149
  - Mutates an existing step only (no create/delete).
@@ -2977,7 +3166,7 @@ const Fa = {
2977
3166
  - Data shapes:
2978
3167
  - \`url\`: string
2979
3168
  - \`description\`: string
2980
- - \`method\`: one of ${et.join(", ")}
3169
+ - \`method\`: one of ${wt.join(", ")}
2981
3170
  - \`parameters\`: \`{ name, in: path|query|header|cookie, value }\`
2982
3171
  - \`outputs\`: \`{ name, expression }\`
2983
3172
  - \`successCriteria\`: \`{ condition, context?, type? }\`
@@ -2988,58 +3177,58 @@ const Fa = {
2988
3177
  - Batch related edits in one call; include all known edits up front.
2989
3178
  - For OpenAPI-linked steps, avoid method/url changes.
2990
3179
  - After changing path/query parameters, decide whether to add a separate URL change.
2991
- `, Ba = ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"], Ya = [
2992
- D.Text,
2993
- D.JSON,
2994
- D.XML
2995
- ], za = p({
3180
+ `, wi = ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"], yi = [
3181
+ Y.Text,
3182
+ Y.JSON,
3183
+ Y.XML
3184
+ ], vi = p({
2996
3185
  name: i().min(1),
2997
- in: T(["path", "query", "header", "cookie"]),
3186
+ in: E(["path", "query", "header", "cookie"]),
2998
3187
  value: i()
2999
- }).strict(), Ha = p({
3188
+ }).strict(), gi = p({
3000
3189
  condition: i().min(1),
3001
3190
  context: i().optional().describe("Context for the expression."),
3002
- type: T(["simple", "regex", "jsonpath", "xpath"]).optional()
3003
- }).strict(), Ga = R.extend({
3191
+ type: E(["simple", "regex", "jsonpath", "xpath"]).optional()
3192
+ }).strict(), bi = L.extend({
3004
3193
  field: I("url"),
3005
3194
  data: i().min(1).describe("New request URL for step.")
3006
- }).strict(), Va = R.extend({
3195
+ }).strict(), ki = L.extend({
3007
3196
  field: I("description"),
3008
3197
  data: i().describe("New step description text.")
3009
- }).strict(), Ka = R.extend({
3198
+ }).strict(), Si = L.extend({
3010
3199
  field: I("method"),
3011
- data: T(Ba).describe("New HTTP method for x-operation step.")
3012
- }).strict(), Ja = R.extend({
3200
+ data: E(wi).describe("New HTTP method for x-operation step.")
3201
+ }).strict(), Ti = L.extend({
3013
3202
  field: I("parameters"),
3014
- data: za.optional().describe("Parameter data. Required for add/update actions.")
3015
- }).strict(), Qa = R.extend({
3203
+ data: vi.optional().describe("Parameter data. Required for add/update actions.")
3204
+ }).strict(), Ci = L.extend({
3016
3205
  field: I("outputs"),
3017
3206
  data: p({
3018
3207
  name: i().min(1).describe("Output name."),
3019
3208
  expression: i().min(1).describe("Output expression.")
3020
3209
  }).strict().optional().describe("Output mapping. Required for add/update actions.")
3021
- }).strict(), Xa = R.extend({
3210
+ }).strict(), Oi = L.extend({
3022
3211
  field: I("successCriteria"),
3023
- data: Ha.optional().describe(
3212
+ data: gi.optional().describe(
3024
3213
  "Success criterion. Required for add/update actions."
3025
3214
  )
3026
- }).strict(), Za = R.extend({
3215
+ }).strict(), Ai = L.extend({
3027
3216
  field: I("body"),
3028
3217
  data: p({
3029
- contentType: T(Ya).optional().describe(
3218
+ contentType: E(yi).optional().describe(
3030
3219
  "Request body content type. Allowed: text/plain, application/json, application/xml."
3031
3220
  ),
3032
3221
  content: i().describe("Request body content as string.")
3033
3222
  }).strict().describe("Request body content and optional content type.")
3034
- }).strict(), ei = oe("field", [
3035
- Ga,
3036
- Va,
3037
- Ka,
3038
- Ja,
3039
- Qa,
3040
- Xa,
3041
- Za
3042
- ]), ti = p({
3223
+ }).strict(), Ei = he("field", [
3224
+ bi,
3225
+ ki,
3226
+ Si,
3227
+ Ti,
3228
+ Ci,
3229
+ Oi,
3230
+ Ai
3231
+ ]), $i = p({
3043
3232
  collectionId: i().describe(
3044
3233
  "Saved step: collection id. Unsaved draft tab on focus: empty string (with empty workflowId and stepId)."
3045
3234
  ),
@@ -3049,260 +3238,283 @@ const Fa = {
3049
3238
  stepId: i().describe(
3050
3239
  "Saved step: step id. Unsaved draft tab: empty string (with empty collectionId and workflowId)."
3051
3240
  ),
3052
- changes: b(ei).min(1).describe("List of individual changes to apply to the step.")
3241
+ changes: T(Ei).min(1).describe("List of individual changes to apply to the step.")
3053
3242
  }).strict().superRefine((e, t) => {
3054
3243
  const o = e.collectionId.trim(), n = e.workflowId.trim(), r = e.stepId.trim();
3055
3244
  !(o && n && r) && !(!o && !n && !r) && t.addIssue({
3056
- code: W.custom,
3245
+ code: H.custom,
3057
3246
  message: "Provide all three ids for a saved step, or three empty strings for the focused unsaved request tab.",
3058
3247
  path: ["collectionId"]
3059
3248
  });
3060
- }), oi = ft, ni = {
3061
- description: ja,
3062
- inputSchema: ti,
3063
- outputSchema: oi,
3249
+ }), xi = _t, _i = {
3250
+ description: Ii,
3251
+ inputSchema: $i,
3252
+ outputSchema: xi,
3064
3253
  needsApproval: () => !0
3065
3254
  };
3066
- function ri(e) {
3255
+ function Ri(e) {
3067
3256
  return e.replace(/\{\{([^{}\s]+)\}\}/g, "{$1}");
3068
3257
  }
3069
- function ce(e) {
3070
- return G[e];
3258
+ function Se(e) {
3259
+ return se[e];
3071
3260
  }
3072
- function le(e, t) {
3261
+ function Te(e, t) {
3073
3262
  return e.id === t;
3074
3263
  }
3075
- function Ve(e, t) {
3264
+ function ut(e, t) {
3076
3265
  return e.condition === t;
3077
3266
  }
3078
- function de(e, t) {
3079
- return pe(e) && e.id === t;
3267
+ function Ce(e, t) {
3268
+ return Ee(e) && e.id === t;
3080
3269
  }
3081
- function Ke(e, t, o) {
3082
- return { ...Qe(e), key: t, value: o, active: !0 };
3270
+ function pt(e, t, o) {
3271
+ return { ...ht(e), key: t, value: o, active: !0 };
3083
3272
  }
3084
- function be(e, t) {
3085
- e.set((o) => [...o, ...t]);
3273
+ function We(e, t) {
3274
+ e((o) => [...o, ...t]);
3086
3275
  }
3087
- function Q(e, t, o) {
3276
+ function le(e, t, o) {
3088
3277
  let n = !1;
3089
- return e.set((r) => {
3278
+ return e((r) => {
3090
3279
  const s = r.findIndex((l) => o.find(l, t));
3091
3280
  if (s < 0) return r;
3092
3281
  const a = [...r];
3093
3282
  return a[s] = o.produce(r[s]), n = !0, a;
3094
3283
  }), n;
3095
3284
  }
3096
- function ke(e, t, o) {
3285
+ function Le(e, t, o) {
3097
3286
  let n = !1;
3098
- return e.set((r) => {
3287
+ return e((r) => {
3099
3288
  const s = r.filter((a) => !o(a, t));
3100
3289
  return n = s.length < r.length, s;
3101
3290
  }), n;
3102
3291
  }
3103
- function si(e, t) {
3292
+ function Pi(e, { readStep: t, updateParameters: o }) {
3104
3293
  switch (e.action) {
3105
- case x.ADD: {
3294
+ case _.ADD: {
3106
3295
  if (!e.data)
3107
- return w("failed", "Failed parameter add because data is missing.");
3108
- const { in: o, name: n, value: r } = e.data, s = ce(o), a = Ke(o, n, r);
3109
- return be(t.parameters[s], [a]), w(
3296
+ return y("failed", "Failed parameter add because data is missing.");
3297
+ const { in: n, name: r, value: s } = e.data, a = Se(n), l = pt(n, r, s);
3298
+ return We(o(a), [l]), y(
3110
3299
  "applied",
3111
- `Added ${o} parameter '${n}' (id: ${a.id})`
3300
+ `Added ${n} parameter '${r}' (id: ${l.id})`
3112
3301
  );
3113
3302
  }
3114
- case x.UPDATE: {
3303
+ case _.UPDATE: {
3115
3304
  if (!e.id)
3116
- return w("failed", "Failed parameter update because id is missing.");
3305
+ return y("failed", "Failed parameter update because id is missing.");
3117
3306
  if (!e.data)
3118
- return w("failed", "Failed parameter update because data is missing.");
3119
- const { in: o, name: n, value: r } = e.data, s = ce(o);
3120
- return Q(t.parameters[s], e.id, {
3121
- find: de,
3122
- produce: (l) => pe(l) ? {
3123
- ...Ke(o, n, r),
3124
- id: l.id,
3125
- ...l.allowReserved !== void 0 && { allowReserved: l.allowReserved }
3126
- } : l
3127
- }) ? w("applied") : w("failed", `Parameter with id '${e.id}' not found.`);
3307
+ return y("failed", "Failed parameter update because data is missing.");
3308
+ const { in: n, name: r, value: s } = e.data, a = Se(n);
3309
+ return le(o(a), e.id, {
3310
+ find: Ce,
3311
+ produce: (c) => Ee(c) ? {
3312
+ ...pt(n, r, s),
3313
+ id: c.id,
3314
+ ...c.allowReserved !== void 0 && { allowReserved: c.allowReserved }
3315
+ } : c
3316
+ }) ? y("applied") : y("failed", `Parameter with id '${e.id}' not found.`);
3128
3317
  }
3129
- case x.REMOVE: {
3318
+ case _.REMOVE: {
3130
3319
  if (!e.id)
3131
- return w("failed", "Failed parameter remove because id is missing.");
3132
- const o = e.id, n = e.data?.in, r = n ? [ce(n)] : Object.values(G);
3133
- let s = !1;
3134
- for (const a of r)
3135
- if (t.parameters[a].get({ noproxy: !0 }).some((c) => de(c, o))) {
3136
- s = ke(t.parameters[a], o, de);
3320
+ return y("failed", "Failed parameter remove because id is missing.");
3321
+ const n = e.id, r = e.data?.in, s = r ? [Se(r)] : Object.values(se);
3322
+ let a = !1;
3323
+ for (const l of s)
3324
+ if (t().parameters[l].some((d) => Ce(d, n))) {
3325
+ a = Le(o(l), n, Ce);
3137
3326
  break;
3138
3327
  }
3139
- return s ? w("applied") : w("failed", `Parameter with id '${o}' not found.`);
3328
+ return a ? y("applied") : y("failed", `Parameter with id '${n}' not found.`);
3140
3329
  }
3141
3330
  }
3142
3331
  }
3143
- function ai(e, t) {
3332
+ function qi(e, { readStep: t, updateOutputs: o }) {
3144
3333
  switch (e.action) {
3145
- case x.ADD: {
3334
+ case _.ADD: {
3146
3335
  if (!e.data)
3147
- return w("failed", "Failed output add because data is missing.");
3148
- const { name: o, expression: n } = e.data, r = t.outputs.get({ noproxy: !0 }).find((a) => a.key === o);
3149
- if (r)
3150
- return Q(t.outputs, r.id, {
3151
- find: le,
3152
- produce: (a) => ({ ...a, key: o, value: n, active: !0 })
3153
- }), w(
3336
+ return y("failed", "Failed output add because data is missing.");
3337
+ const { name: n, expression: r } = e.data, s = t().outputs.find((l) => l.key === n);
3338
+ if (s)
3339
+ return le(o, s.id, {
3340
+ find: Te,
3341
+ produce: (l) => ({ ...l, key: n, value: r, active: !0 })
3342
+ }), y(
3154
3343
  "applied",
3155
- `Updated existing output '${o}' in place (id: ${r.id})`
3344
+ `Updated existing output '${n}' in place (id: ${s.id})`
3156
3345
  );
3157
- const s = crypto.randomUUID();
3158
- return be(t.outputs, [{ id: s, key: o, value: n, active: !0 }]), w("applied", `Added output '${o}' (id: ${s})`);
3346
+ const a = crypto.randomUUID();
3347
+ return We(o, [{ id: a, key: n, value: r, active: !0 }]), y("applied", `Added output '${n}' (id: ${a})`);
3159
3348
  }
3160
- case x.UPDATE: {
3349
+ case _.UPDATE: {
3161
3350
  if (!e.id)
3162
- return w("failed", "Failed output update because id is missing.");
3351
+ return y("failed", "Failed output update because id is missing.");
3163
3352
  if (!e.data)
3164
- return w("failed", "Failed output update because data is missing.");
3165
- const { name: o, expression: n } = e.data;
3166
- return Q(t.outputs, e.id, {
3167
- find: le,
3168
- produce: (s) => ({ ...s, key: o, value: n, active: !0 })
3169
- }) ? w("applied") : w("failed", `Output with id '${e.id}' not found.`);
3353
+ return y("failed", "Failed output update because data is missing.");
3354
+ const { name: n, expression: r } = e.data;
3355
+ return le(o, e.id, {
3356
+ find: Te,
3357
+ produce: (a) => ({ ...a, key: n, value: r, active: !0 })
3358
+ }) ? y("applied") : y("failed", `Output with id '${e.id}' not found.`);
3170
3359
  }
3171
- case x.REMOVE:
3172
- return e.id ? ke(t.outputs, e.id, le) ? w("applied") : w("failed", `Output with id '${e.id}' not found.`) : w("failed", "Failed output remove because id is missing.");
3360
+ case _.REMOVE:
3361
+ return e.id ? Le(o, e.id, Te) ? y("applied") : y("failed", `Output with id '${e.id}' not found.`) : y("failed", "Failed output remove because id is missing.");
3173
3362
  }
3174
3363
  }
3175
- function ii(e, t) {
3364
+ function Ni(e, { updateSuccessCriteria: t }) {
3176
3365
  switch (e.action) {
3177
- case x.ADD: {
3366
+ case _.ADD: {
3178
3367
  if (!e.data)
3179
- return w("failed", "Failed success criteria add because data is missing.");
3180
- const { condition: o, context: n, type: r } = e.data, s = Je(
3181
- r ?? ue.SIMPLE
3368
+ return y("failed", "Failed success criteria add because data is missing.");
3369
+ const { condition: o, context: n, type: r } = e.data, s = mt(
3370
+ r ?? Oe.SIMPLE
3182
3371
  );
3183
- return be(t.successCriteria, [
3372
+ return We(t, [
3184
3373
  {
3185
3374
  ...s,
3186
3375
  condition: o,
3187
3376
  ...n !== void 0 && { context: n }
3188
3377
  }
3189
- ]), w("applied");
3378
+ ]), y("applied");
3190
3379
  }
3191
- case x.UPDATE: {
3380
+ case _.UPDATE: {
3192
3381
  if (typeof e.id != "string")
3193
- return w(
3382
+ return y(
3194
3383
  "failed",
3195
3384
  "Failed success criteria update because id is missing."
3196
3385
  );
3197
3386
  if (!e.data)
3198
- return w(
3387
+ return y(
3199
3388
  "failed",
3200
3389
  "Failed success criteria update because data is missing."
3201
3390
  );
3202
3391
  const { condition: o, context: n, type: r } = e.data;
3203
- return Q(t.successCriteria, e.id, {
3204
- find: Ve,
3392
+ return le(t, e.id, {
3393
+ find: ut,
3205
3394
  produce: (a) => ({
3206
3395
  ...a,
3207
3396
  id: a.id || crypto.randomUUID(),
3208
3397
  condition: o,
3209
3398
  context: n ?? a.context,
3210
- type: r ?? a.type ?? ue.SIMPLE
3399
+ type: r ?? a.type ?? Oe.SIMPLE
3211
3400
  })
3212
- }) ? w("applied") : w(
3401
+ }) ? y("applied") : y(
3213
3402
  "failed",
3214
3403
  `Success criterion with condition '${e.id}' not found.`
3215
3404
  );
3216
3405
  }
3217
- case x.REMOVE:
3218
- return typeof e.id != "string" ? w(
3406
+ case _.REMOVE:
3407
+ return typeof e.id != "string" ? y(
3219
3408
  "failed",
3220
3409
  "Failed success criteria remove because id is missing."
3221
- ) : ke(
3222
- t.successCriteria,
3410
+ ) : Le(
3411
+ t,
3223
3412
  e.id,
3224
- Ve
3225
- ) ? w("applied") : w(
3413
+ ut
3414
+ ) ? y("applied") : y(
3226
3415
  "failed",
3227
3416
  `Success criterion with condition '${e.id}' not found.`
3228
3417
  );
3229
3418
  }
3230
3419
  }
3231
- function ci(e) {
3420
+ const ft = { method: "GET", url: "" };
3421
+ function Ui(e) {
3232
3422
  return async (t) => {
3233
- const { changes: o, collectionId: n, workflowId: r, stepId: s } = t, a = St(t), l = gt(e, n, r, s);
3423
+ const { changes: o, collectionId: n, workflowId: r, stepId: s } = t, a = jt(t), l = Lt(e, n, r, s);
3234
3424
  if (!l.ok)
3235
3425
  return h(l.message, l.details);
3236
- const c = l.value;
3426
+ const { step: c, readStep: d, updateStep: u } = l.value, f = {
3427
+ readStep: d,
3428
+ updateParameters: (w) => (O) => u((S) => ({
3429
+ ...S,
3430
+ parameters: { ...S.parameters, [w]: O(S.parameters[w]) }
3431
+ })),
3432
+ updateOutputs: (w) => u((O) => ({ ...O, outputs: w(O.outputs) })),
3433
+ updateSuccessCriteria: (w) => u((O) => ({
3434
+ ...O,
3435
+ successCriteria: w(O.successCriteria)
3436
+ }))
3437
+ };
3237
3438
  if (o.some(
3238
- (f) => f.field === "method" || f.field === "url"
3239
- ) && c.operation.ornull !== null)
3439
+ (w) => w.field === "method" || w.field === "url"
3440
+ ) && c.operation !== null)
3240
3441
  return h(
3241
3442
  "Cannot update method or url for a step linked to an OpenAPI operation."
3242
3443
  );
3243
- const d = [];
3244
- for (const f of o)
3245
- switch (f.field) {
3444
+ const g = [];
3445
+ for (const w of o)
3446
+ switch (w.field) {
3246
3447
  case "method":
3247
3448
  case "url": {
3248
- c.xOperation.ornull === null && c.xOperation.set({ method: "GET", url: "" });
3249
- const y = c.xOperation.ornull;
3250
- if (!y)
3251
- return h("Step xOperation state is unavailable.");
3252
- if (f.field === "method")
3253
- y.method.set(f.data);
3254
- else {
3255
- const v = ri(f.data);
3256
- y.url.set(v);
3257
- const A = c.parameters.queryParameters.get({ noproxy: !0 });
3258
- c.parameters.queryParameters.set(
3259
- Ht(
3260
- Gt(v),
3261
- A
3262
- )
3263
- );
3449
+ if (w.field === "method") {
3450
+ const O = w.data;
3451
+ u((S) => ({
3452
+ ...S,
3453
+ xOperation: { ...S.xOperation ?? ft, method: O }
3454
+ }));
3455
+ } else {
3456
+ const O = Ri(w.data);
3457
+ u((S) => ({
3458
+ ...S,
3459
+ xOperation: { ...S.xOperation ?? ft, url: O },
3460
+ parameters: {
3461
+ ...S.parameters,
3462
+ queryParameters: wo(
3463
+ yo(O),
3464
+ S.parameters.queryParameters
3465
+ )
3466
+ }
3467
+ }));
3264
3468
  }
3265
- d.push(w("applied"));
3469
+ g.push(y("applied"));
3266
3470
  break;
3267
3471
  }
3268
- case "description":
3269
- c.description.set(f.data), d.push(w("applied"));
3472
+ case "description": {
3473
+ const O = w.data;
3474
+ u((S) => ({ ...S, description: O })), g.push(y("applied"));
3270
3475
  break;
3271
- case "body":
3272
- c.requestBody.merge({
3273
- content: f.data.content,
3274
- ...f.data.contentType !== void 0 && { type: f.data.contentType }
3275
- }), d.push(w("applied"));
3476
+ }
3477
+ case "body": {
3478
+ const { content: O, contentType: S } = w.data;
3479
+ u((q) => ({
3480
+ ...q,
3481
+ requestBody: {
3482
+ ...q.requestBody,
3483
+ content: O,
3484
+ ...S !== void 0 && { type: S }
3485
+ }
3486
+ })), g.push(y("applied"));
3276
3487
  break;
3488
+ }
3277
3489
  case "parameters":
3278
- d.push(si(f, c));
3490
+ g.push(Pi(w, f));
3279
3491
  break;
3280
3492
  case "outputs":
3281
- d.push(ai(f, c));
3493
+ g.push(qi(w, f));
3282
3494
  break;
3283
3495
  case "successCriteria":
3284
- d.push(ii(f, c));
3496
+ g.push(Ni(w, f));
3285
3497
  break;
3286
3498
  }
3287
- const m = o.some((f) => f.field === "outputs");
3499
+ const v = o.some((w) => w.field === "outputs");
3288
3500
  return {
3289
3501
  isError: !1,
3290
3502
  data: {
3291
3503
  totalChanges: a.totalChanges ?? o.length,
3292
3504
  approvedChanges: a.approvedChanges ?? o.length,
3293
- applied: d,
3294
- ...m && {
3295
- resultingState: Ie(c.outputs.get({ noproxy: !0 })) || "Outputs: (none)"
3505
+ applied: g,
3506
+ ...v && {
3507
+ resultingState: Re(d().outputs) || "Outputs: (none)"
3296
3508
  }
3297
3509
  }
3298
3510
  };
3299
3511
  };
3300
3512
  }
3301
- const li = {
3513
+ const Di = {
3302
3514
  name: "update_step",
3303
- definition: ni,
3304
- createExecutor: (e) => ci(e.store)
3305
- }, di = `Search the public web via a nested agent and return a consolidated summary.
3515
+ definition: _i,
3516
+ createExecutor: (e) => Ui(e.store)
3517
+ }, Wi = `Search the public web via a nested agent and return a consolidated summary.
3306
3518
 
3307
3519
  **What it does**
3308
3520
  - Runs provider web search (results depend on the active model provider) and synthesizes findings for the parent agent.
@@ -3319,21 +3531,21 @@ const li = {
3319
3531
 
3320
3532
  **Input guidance**
3321
3533
  - State a clear, self-contained query: what to look up and what to return (facts, links, version numbers, etc.).
3322
- - Prefer one web search call per distinct lookup; do not nest web search calls.`, ui = p({
3534
+ - Prefer one web search call per distinct lookup; do not nest web search calls.`, Li = p({
3323
3535
  task: i().describe("What to search for on the web and what to return"),
3324
3536
  url: i().describe("The URL to execute search on")
3325
- }), pi = te(), fi = {
3326
- description: di,
3327
- inputSchema: ui,
3328
- outputSchema: pi,
3537
+ }), Mi = me(), Fi = {
3538
+ description: Wi,
3539
+ inputSchema: Li,
3540
+ outputSchema: Mi,
3329
3541
  needsApproval: !0
3330
- }, mi = `
3542
+ }, ji = `
3331
3543
  You are a web search subagent inside Replay, invoked by the parent agent to complete a single lookup task.
3332
3544
 
3333
3545
  Your job is to search the public web and return verified findings for the parent agent to act on. You do not communicate with the end user directly.
3334
3546
 
3335
3547
  You must use the provider web search tool to gather information. You cannot access the Replay project, UI, workflows, internal state, or any tools other than the web search tool.
3336
- `, hi = `
3548
+ `, Bi = `
3337
3549
  - Never hallucinate or invent an answer when the information is not available from the web search.
3338
3550
  - Do not use general knowledge, assumptions, prior training data, or speculation as evidence. Only make claims that are explicitly supported by the web search results.
3339
3551
  - If the web search results do not contain enough information to answer the question, clearly state that the information could not be found or verified.
@@ -3342,28 +3554,28 @@ You must use the provider web search tool to gather information. You cannot acce
3342
3554
  - Include source URLs for all claims that are material to the parent agent's next steps.
3343
3555
  - Clearly distinguish between verified findings, inferred conclusions, and information that could not be verified.
3344
3556
  - When sources conflict, report the conflict and cite the competing sources rather than selecting a winner without evidence.
3345
- `, Ii = Jt(
3557
+ `, Yi = bo(
3346
3558
  //
3347
- Ee("role", mi),
3348
- Ee("output", hi)
3559
+ He("role", ji),
3560
+ He("output", Bi)
3349
3561
  );
3350
- function wi() {
3351
- return [Qt(Ii)];
3562
+ function zi() {
3563
+ return [ko(Yi)];
3352
3564
  }
3353
- function yi(e) {
3354
- const t = ho(e), o = oo(e);
3565
+ function Hi(e) {
3566
+ const t = Lo(e), o = Ao(e);
3355
3567
  return async (n, r) => {
3356
3568
  try {
3357
3569
  return {
3358
3570
  isError: !1,
3359
3571
  data: {
3360
- message: await no({
3572
+ message: await Eo({
3361
3573
  model: o,
3362
- system: wi(),
3363
- prompt: vi(n),
3574
+ system: zi(),
3575
+ prompt: Gi(n),
3364
3576
  tools: t,
3365
3577
  toolChoice: "required",
3366
- stopWhen: ro("web_search"),
3578
+ stopWhen: $o("web_search"),
3367
3579
  temperature: 0,
3368
3580
  abortSignal: r.abortSignal
3369
3581
  }).text
@@ -3377,8 +3589,8 @@ function yi(e) {
3377
3589
  }
3378
3590
  };
3379
3591
  }
3380
- function vi(e) {
3381
- return k([
3592
+ function Gi(e) {
3593
+ return C([
3382
3594
  //
3383
3595
  "[URL]",
3384
3596
  e.url,
@@ -3387,71 +3599,71 @@ function vi(e) {
3387
3599
  e.task
3388
3600
  ]);
3389
3601
  }
3390
- const gi = {
3602
+ const Vi = {
3391
3603
  name: "web_search",
3392
- definition: fi,
3393
- createExecutor: (e) => yi(e.model)
3394
- }, Ct = [
3395
- ks,
3396
- qs,
3397
- js,
3604
+ definition: Fi,
3605
+ createExecutor: (e) => Hi(e.model)
3606
+ }, Yt = [
3398
3607
  Js,
3399
- wa,
3400
- Fa,
3401
- li,
3402
- On,
3403
- Sr,
3404
- ns,
3405
- gi,
3406
- Gn
3608
+ ia,
3609
+ Ia,
3610
+ Ta,
3611
+ za,
3612
+ hi,
3613
+ Di,
3614
+ Jn,
3615
+ Gr,
3616
+ $s,
3617
+ Vi,
3618
+ wr
3407
3619
  ];
3408
- function bi(e) {
3409
- return Ct.some((t) => t.name === e);
3620
+ function Ki(e) {
3621
+ return Yt.some((t) => t.name === e);
3410
3622
  }
3411
- function Wi(e, t) {
3412
- for (const o of Ct)
3623
+ function fc(e, t) {
3624
+ for (const o of Yt)
3413
3625
  e.register(
3414
- dn(
3626
+ qn(
3415
3627
  o,
3416
3628
  t[o.name]
3417
3629
  )
3418
3630
  );
3419
3631
  }
3420
- function ki(e) {
3632
+ function Ji(e) {
3421
3633
  const t = e.startsWith("tool-") ? e.slice(5) : e;
3422
- return bi(t) ? t : void 0;
3634
+ return Ki(t) ? t : void 0;
3423
3635
  }
3424
- function Si(e, t) {
3636
+ function Qi(e, t) {
3425
3637
  return `${e}::${t}`;
3426
3638
  }
3427
- function Se(e) {
3639
+ function Me(e) {
3428
3640
  return typeof e == "object" && e !== null && "type" in e && typeof e.type == "string" && e.type.startsWith("tool-") && "toolCallId" in e;
3429
3641
  }
3430
- function Te(e) {
3642
+ function Fe(e) {
3431
3643
  return e.state === "approval-requested" && e.approval?.id != null;
3432
3644
  }
3433
- function Ti(e) {
3645
+ function Xi(e) {
3434
3646
  return e.state === "output-denied" ? !0 : e.state === "output-available" && e.approval != null;
3435
3647
  }
3436
- function Ot(e) {
3437
- return e.parts.some((t) => Se(t) && Te(t));
3648
+ function zt(e) {
3649
+ return e.parts.some((t) => Me(t) && Fe(t));
3438
3650
  }
3439
- function Mi(e) {
3440
- return e.some(Ot);
3651
+ function mc(e) {
3652
+ return e.some(zt);
3441
3653
  }
3442
- function Fi(e) {
3654
+ function hc(e) {
3443
3655
  return e.map(
3444
- (t) => Ot(t) ? { ...t, parts: t.parts.map(Ci) } : t
3656
+ (t) => zt(t) ? { ...t, parts: t.parts.map(Zi) } : t
3445
3657
  );
3446
3658
  }
3447
- function Ci(e) {
3448
- return !Se(e) || !Te(e) ? e : {
3659
+ function Zi(e) {
3660
+ return !Me(e) || !Fe(e) ? e : {
3449
3661
  ...e,
3450
3662
  state: "output-denied",
3451
3663
  approval: { id: e.approval.id, approved: !1 }
3452
3664
  };
3453
3665
  }
3454
- function ji(e) {
3666
+ function Ic(e) {
3455
3667
  const t = [], o = [];
3456
3668
  let n = 0;
3457
3669
  const r = {}, s = () => {
@@ -3464,8 +3676,8 @@ function ji(e) {
3464
3676
  const c = l.trim();
3465
3677
  if (c.length === 0)
3466
3678
  return;
3467
- const u = o[o.length - 1];
3468
- u?.kind === "action" && u.text === c || o.push({ kind: "action", text: c });
3679
+ const d = o[o.length - 1];
3680
+ d?.kind === "action" && d.text === c || o.push({ kind: "action", text: c });
3469
3681
  };
3470
3682
  for (let l = 0; l < e.length; l++) {
3471
3683
  const c = e[l];
@@ -3473,40 +3685,40 @@ function ji(e) {
3473
3685
  continue;
3474
3686
  if (c.type === "text") {
3475
3687
  s();
3476
- const d = c.text ?? "";
3477
- d.length > 0 && t.push({
3688
+ const u = c.text ?? "";
3689
+ u.length > 0 && t.push({
3478
3690
  kind: "text",
3479
- text: d,
3691
+ text: u,
3480
3692
  key: `text-${l}`,
3481
3693
  workflowRunHistoryIds: Object.fromEntries(
3482
- Object.entries(r).map(([m, f]) => [m, [...f]])
3694
+ Object.entries(r).map(([f, m]) => [f, [...m]])
3483
3695
  )
3484
3696
  });
3485
3697
  continue;
3486
3698
  }
3487
- if (!Se(c))
3699
+ if (!Me(c))
3488
3700
  continue;
3489
- const u = ki(c.type);
3490
- if (u === mo) {
3491
- const d = Ai(c);
3492
- if (d) {
3493
- const m = Si(d.collectionId, d.workflowId), f = r[m] ??= [];
3494
- f.includes(d.historyId) || f.push(d.historyId);
3701
+ const d = Ji(c.type);
3702
+ if (d === Wo) {
3703
+ const u = tc(c);
3704
+ if (u) {
3705
+ const f = Qi(u.collectionId, u.workflowId), m = r[f] ??= [];
3706
+ m.includes(u.historyId) || m.push(u.historyId);
3495
3707
  }
3496
3708
  }
3497
- if (u === fo) {
3498
- const d = xi(c.input);
3499
- d && a(d);
3709
+ if (d === Do) {
3710
+ const u = oc(c.input);
3711
+ u && a(u);
3500
3712
  continue;
3501
3713
  }
3502
- if (Te(c) || Ti(c)) {
3714
+ if (Fe(c) || Xi(c)) {
3503
3715
  s(), t.push({ kind: "tool", part: c, key: `tool-${l}` });
3504
3716
  continue;
3505
3717
  }
3506
3718
  }
3507
3719
  return s(), t;
3508
3720
  }
3509
- const Oi = p({
3721
+ const ec = p({
3510
3722
  isError: I(!1),
3511
3723
  data: p({
3512
3724
  collectionId: i().min(1),
@@ -3514,13 +3726,13 @@ const Oi = p({
3514
3726
  historyId: i().min(1)
3515
3727
  })
3516
3728
  });
3517
- function Ai(e) {
3729
+ function tc(e) {
3518
3730
  if (e.state !== "output-available")
3519
3731
  return;
3520
- const t = Oi.safeParse(e.output);
3732
+ const t = ec.safeParse(e.output);
3521
3733
  return t.success ? t.data.data : void 0;
3522
3734
  }
3523
- function xi(e) {
3735
+ function oc(e) {
3524
3736
  if (e == null || typeof e != "object")
3525
3737
  return;
3526
3738
  const t = e.message;
@@ -3529,21 +3741,21 @@ function xi(e) {
3529
3741
  const o = t.trim();
3530
3742
  return o.length > 0 ? o : void 0;
3531
3743
  }
3532
- function Bi(e) {
3744
+ function wc(e) {
3533
3745
  return e.filter((t) => t.type === "text").map((t) => t.text ?? "").join("");
3534
3746
  }
3535
- function Yi(e) {
3536
- return po({
3537
- queryKey: st.detail(e ?? ""),
3538
- queryFn: async () => e ? await rt.getInstance().findOne(e) ?? null : null,
3747
+ function yc(e) {
3748
+ return Uo({
3749
+ queryKey: St.detail(e ?? ""),
3750
+ queryFn: async () => e ? await kt.getInstance().findOne(e) ?? null : null,
3539
3751
  enabled: !!e
3540
3752
  });
3541
3753
  }
3542
- function zi(e) {
3543
- return uo({
3544
- queryKey: st.infiniteHistory(e),
3754
+ function vc(e) {
3755
+ return No({
3756
+ queryKey: St.infiniteHistory(e),
3545
3757
  initialPageParam: 0,
3546
- queryFn: async ({ pageParam: t }) => rt.getInstance().findRecentChatsPage({
3758
+ queryFn: async ({ pageParam: t }) => kt.getInstance().findRecentChatsPage({
3547
3759
  offset: t,
3548
3760
  limit: e
3549
3761
  }),
@@ -3551,40 +3763,40 @@ function zi(e) {
3551
3763
  });
3552
3764
  }
3553
3765
  export {
3554
- pn as A,
3555
- Li as B,
3556
- x as C,
3557
- ki as D,
3558
- Ti as E,
3559
- ji as F,
3560
- zi as G,
3561
- Di as H,
3562
- G as L,
3563
- Ui as T,
3564
- On as a,
3565
- Sr as b,
3566
- Fa as c,
3567
- Js as d,
3568
- js as e,
3569
- qs as f,
3570
- Gn as g,
3571
- Mi as h,
3572
- Fi as i,
3573
- Bi as j,
3574
- Yi as k,
3575
- us as l,
3576
- ns as m,
3577
- fs as n,
3578
- ks as o,
3579
- ps as p,
3580
- Si as q,
3581
- Wi as r,
3582
- wa as s,
3583
- Ni as t,
3584
- li as u,
3585
- Se as v,
3586
- gi as w,
3587
- Te as x,
3588
- Ra as y,
3589
- gt as z
3766
+ Un as A,
3767
+ pc as B,
3768
+ _ as C,
3769
+ Ji as D,
3770
+ Xi as E,
3771
+ Ic as F,
3772
+ vc as G,
3773
+ uc as H,
3774
+ se as L,
3775
+ dc as T,
3776
+ Jn as a,
3777
+ Gr as b,
3778
+ hi as c,
3779
+ Ta as d,
3780
+ Ia as e,
3781
+ ia as f,
3782
+ wr as g,
3783
+ mc as h,
3784
+ hc as i,
3785
+ wc as j,
3786
+ yc as k,
3787
+ Ds as l,
3788
+ $s as m,
3789
+ Fs as n,
3790
+ Js as o,
3791
+ Ms as p,
3792
+ Qi as q,
3793
+ fc as r,
3794
+ za as s,
3795
+ lc as t,
3796
+ Di as u,
3797
+ Me as v,
3798
+ Vi as w,
3799
+ Fe as x,
3800
+ ai as y,
3801
+ Ws as z
3590
3802
  };