@redocly/replay 0.28.0-next.5 → 0.28.0-next.6

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 (64) hide show
  1. package/dist/{replay-AiChatProvider-BtDAvnSq.js → replay-AiChatProvider-Bj2P_hdU.js} +371 -369
  2. package/dist/replay-AiChatProvider-GeumgtIo.js +6 -0
  3. package/dist/{replay-AiChatSqliteDBStorage-CjD_0sid.js → replay-AiChatSqliteDBStorage-0M2Ejnzu.js} +1 -1
  4. package/dist/{replay-AiChatSqliteDBStorage-DYTBtCdW.js → replay-AiChatSqliteDBStorage-BWJl1qdO.js} +1 -1
  5. package/dist/{replay-AiPanel-Wn4vI4q5.js → replay-AiPanel-DfOpKMDQ.js} +709 -712
  6. package/dist/replay-AiPanel-ON_QfwBN.js +742 -0
  7. package/dist/replay-FileWatcher-04GlEkra.js +360 -0
  8. package/dist/replay-FileWatcher-B-T0jz_R.js +1 -0
  9. package/dist/{replay-SemanticSearchService-Dn-s19V3.js → replay-SemanticSearchService-BQgdj2wy.js} +1 -1
  10. package/dist/{replay-SemanticSearchService-B1_4MZ3a.js → replay-SemanticSearchService-CPIb_cUk.js} +7 -7
  11. package/dist/{replay-SqliteDBStorage-BqOim0Il.js → replay-SqliteDBStorage-Bt2xXqei.js} +1 -1
  12. package/dist/{replay-SqliteDBStorage-CRZ9Yx8K.js → replay-SqliteDBStorage-vehgvWXZ.js} +1 -1
  13. package/dist/{replay-TauriFileSystemAdapter-Bf-9oAkV.js → replay-TauriFileSystemAdapter-D2yxrS6Q.js} +1 -1
  14. package/dist/{replay-TauriFileSystemAdapter-GrD1Q2jS.js → replay-TauriFileSystemAdapter-YLdtT-Xp.js} +1 -1
  15. package/dist/{replay-TauriRootStorage-Cnd9-u0R.js → replay-TauriRootStorage-BE6RmQfE.js} +162 -165
  16. package/dist/replay-TauriRootStorage-DcENVsBJ.js +1 -0
  17. package/dist/{replay-agent-loop-DcduWdVY.js → replay-agent-loop-CvopOugZ.js} +13 -13
  18. package/dist/{replay-agent-loop-phR7X6HJ.js → replay-agent-loop-UwDSVh-4.js} +1 -1
  19. package/dist/{replay-ai-chat-mappers-f7OYwce2.js → replay-ai-chat-mappers-B7fm-v_w.js} +1 -1
  20. package/dist/{replay-ai-chat-mappers-DMgobD7q.js → replay-ai-chat-mappers-yKBypIXh.js} +1 -1
  21. package/dist/{replay-create-model-B9_RKhPf.js → replay-create-model-CHahxEJy.js} +3 -3
  22. package/dist/{replay-create-model-WcGwy1Px.js → replay-create-model-CyBZMAWB.js} +4 -4
  23. package/dist/{replay-db-BB9biJ4Q.js → replay-db-CifZMdnr.js} +5 -5
  24. package/dist/{replay-db-DcpyTo8s.js → replay-db-EWL-uAt-.js} +1 -1
  25. package/dist/{replay-external-resolver-TFD8mr_P.js → replay-external-resolver-D5fSfJEm.js} +1 -1
  26. package/dist/{replay-external-resolver-CKJWptWf.js → replay-external-resolver-G11iwLVZ.js} +2 -2
  27. package/dist/{replay-index-DuIF4QBl.js → replay-index-B2NUTBd8.js} +1 -1
  28. package/dist/{replay-index-DF6wNUHn.js → replay-index-B3MQaIS-.js} +1 -1
  29. package/dist/replay-index-Coy4kD_x.js +7009 -0
  30. package/dist/{replay-index-DofofQ3T.js → replay-index-CqRiEj9e.js} +1 -1
  31. package/dist/{replay-index-D38KWo5d.js → replay-index-D0mbH_TN.js} +1 -1
  32. package/dist/{replay-index-UbqSETNf.js → replay-index-DDqKE6bs.js} +5 -5
  33. package/dist/{replay-index-qMSGJKzU.js → replay-index-DrI9ZFwH.js} +2 -2
  34. package/dist/{replay-index-CFhkrdmJ.js → replay-index-Dx8O3ZoA.js} +62045 -61139
  35. package/dist/{replay-lint-BaFfhDsl.js → replay-lint-BiOcDIDr.js} +3 -3
  36. package/dist/{replay-lint-j1iYeM_X.js → replay-lint-CAo2fuiZ.js} +3 -3
  37. package/dist/{replay-lint-graphql-DXko1yrv.js → replay-lint-graphql-DAa8UNRg.js} +1 -1
  38. package/dist/{replay-lint-graphql-zL0ESnHi.js → replay-lint-graphql-DzI2rUbR.js} +1 -1
  39. package/dist/replay-periodic-revalidation-D18ihfUc.js +1 -0
  40. package/dist/replay-periodic-revalidation-w7mrtjYg.js +22 -0
  41. package/dist/{replay-resolve-DxQZdksO.js → replay-resolve-CojDRP37.js} +1 -1
  42. package/dist/{replay-resolve-B-AmJx0p.js → replay-resolve-DgAthAfi.js} +1 -1
  43. package/dist/{replay-respect-run-BAuRPVQY.js → replay-respect-run-3ukV7LMg.js} +1 -1
  44. package/dist/{replay-respect-run-CPQGLg0r.js → replay-respect-run-DNvB8rLX.js} +3 -3
  45. package/dist/replay-tauri-path-DM8PdMK8.js +22 -0
  46. package/dist/{replay-tauri-path-Cj6Zgicf.js → replay-tauri-path-kr9DtxLs.js} +1 -1
  47. package/dist/{replay-useAiChatQueries-pptRWb9k.js → replay-useAiChatQueries-BULoKr4E.js} +1564 -1395
  48. package/dist/replay-useAiChatQueries-BdjsFz1P.js +215 -0
  49. package/dist/{replay-validate-key-D4j7fXFM.js → replay-validate-key-CGmguj5X.js} +1 -1
  50. package/dist/{replay-validate-key-DjGy6Q75.js → replay-validate-key-DzseOR5a.js} +2 -2
  51. package/dist/replay.cjs +1 -1
  52. package/dist/replay.d.ts +3 -3
  53. package/dist/replay.js +10 -10
  54. package/package.json +3 -5
  55. package/dist/replay-AiChatProvider-DiHC9TUm.js +0 -6
  56. package/dist/replay-AiPanel-CFbxD8SJ.js +0 -742
  57. package/dist/replay-FileWatcher-Boh7I024.js +0 -352
  58. package/dist/replay-FileWatcher-Cq4DUrxe.js +0 -1
  59. package/dist/replay-TauriRootStorage-BkPcSPgu.js +0 -1
  60. package/dist/replay-index-PZuRF5JU.js +0 -6982
  61. package/dist/replay-periodic-revalidation-BoyLQHtg.js +0 -1
  62. package/dist/replay-periodic-revalidation-Dsp-n7ui.js +0 -21
  63. package/dist/replay-tauri-path-D82YK1cm.js +0 -22
  64. package/dist/replay-useAiChatQueries-CH48wBvJ.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-CFhkrdmJ.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-BB9biJ4Q.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-WcGwy1Px.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-B1_4MZ3a.js";
6
- import { useInfiniteQuery as uo, useQuery as po } from "@tanstack/react-query";
7
- const G = {
1
+ import { useContext as Ft, createContext as Yt } from "react";
2
+ import { U as zt, a2 as ge, au as ne, av as Ht, aw as Gt, ax as Vt, m as $, j as le, ak as Y, ay as pt, az as Ce, aj as Ae, aA as ft, aB as de, aC as Z, h as b, aD as Kt, B as G, x as V, aE as mt, aF as ue, z as Ee, aG as Jt, aH as Qt, aI as Xt, aJ as Zt, aK as eo, aL as to, aM as oo, p as K, aN as no, q as ee, I as ro, aO as so, aP as ht, aQ as wt, aR as ao, aS as It, aT as xe, aU as Oe, u as J, aV as io, T as yt, aW as $e, ac as vt, aX as co, aY as lo, ah as k, aZ as je, a_ as uo, a$ as Be, b0 as po, b1 as fo, b2 as mo, A as gt, k as bt } from "./replay-index-Dx8O3ZoA.js";
3
+ import { b as C, f as kt, a as St, c as Tt, d as pe, e as Ct, i as Fe, h as _e, R as z, j as ho, k as wo, p as Io, s as Ye, l as yo } from "./replay-db-CifZMdnr.js";
4
+ import { b as vo, o as go, d as bo, e as p, u as fe, f as i, h as R, j as E, n as A, k as F, m as w, q as T, r as Re, t as te, v as me, Z as H, w as ko, x as ze, c as So, s as To, y as Co } from "./replay-create-model-CyBZMAWB.js";
5
+ import { g as Oo, c as He, d as Ao, f as Eo, h as Ge, i as xo, j as $o } from "./replay-SemanticSearchService-CPIb_cUk.js";
6
+ import { useInfiniteQuery as _o, useQuery as Ro } from "@tanstack/react-query";
7
+ const re = {
8
8
  path: "pathParameters",
9
9
  query: "queryParameters",
10
10
  header: "headers",
11
11
  cookie: "cookies"
12
- }, Ni = {
12
+ }, nc = {
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
+ }, rc = {
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
+ }, sc = {
41
41
  CHAT: "chat",
42
42
  HISTORY: "history"
43
- }, fo = "report_status", mo = "run_workflow", z = {
43
+ }, qo = "report_status", Po = "run_workflow", oe = {
44
44
  WEB_SEARCH: "web_search"
45
45
  };
46
- function ho(e) {
46
+ function No(e) {
47
47
  switch (e.provider) {
48
- case ae.GEMINI:
48
+ case ge.GEMINI:
49
49
  return {
50
- [z.WEB_SEARCH]: eo.tools.googleSearch({})
50
+ [oe.WEB_SEARCH]: bo.tools.googleSearch({})
51
51
  };
52
- case ae.OPENAI:
52
+ case ge.OPENAI:
53
53
  return {
54
- [z.WEB_SEARCH]: Zt.tools.webSearch({})
54
+ [oe.WEB_SEARCH]: go.tools.webSearch({})
55
55
  };
56
- case ae.ANTHROPIC:
56
+ case ge.ANTHROPIC:
57
57
  return {
58
- [z.WEB_SEARCH]: Xt.tools.webFetch_20250910()
58
+ [oe.WEB_SEARCH]: vo.tools.webFetch_20250910()
59
59
  };
60
- case _t:
60
+ case zt:
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 Uo = ["info", "workflows", "sourceDescriptions"];
74
+ function Do(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 Wo(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 Lo(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 Mo(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(Do(e));
105
105
  break;
106
106
  case "workflows":
107
- o.push(yo(e));
107
+ o.push(Wo(e));
108
108
  break;
109
109
  case "sourceDescriptions":
110
- o.push(vo(e));
110
+ o.push(Lo(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 jo(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 Bo(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: ${kt(e.parameterDetails)}` : null,
139
+ t.includes("security") && e.relatedSecuritySchemes ? `Security schemes: ${St(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: ${Tt(e.responseSchemas)}` : null
142
142
  ],
143
143
  `
144
144
  `
145
145
  );
146
146
  }
147
- const So = [
147
+ const Fo = [
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 Yo(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 zo(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 Ot(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 Ho(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} ${Ot(t)}`).join(`
175
173
  `)}` : null;
176
174
  }
177
- function Ao(e) {
175
+ function Go(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}${Ot(o)}`], r = pe(o.security);
179
+ r && n.push(Fe(r, " "));
180
+ const s = _e(o.outputs);
181
+ return s && n.push(Fe(s, " ")), n.join(`
184
182
  `);
185
183
  }).join(`
186
184
  `)}` : null;
187
185
  }
188
- function xo(e, t) {
186
+ function Vo(e, t) {
189
187
  switch (t) {
190
188
  case "inputs":
191
- return To(e);
189
+ return Yo(e);
192
190
  case "parameters":
193
- return lt(e.parameters);
191
+ return Ct(e.parameters);
194
192
  case "security":
195
- return ee(e.security);
193
+ return pe(e.security);
196
194
  case "outputs":
197
- return Co(e);
195
+ return zo(e);
198
196
  case "steps":
199
- return Oo(e);
197
+ return Ho(e);
200
198
  case "wiring":
201
- return Ao(e);
199
+ return Go(e);
202
200
  default:
203
201
  return null;
204
202
  }
205
203
  }
206
- function Eo(e) {
204
+ function Ko(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 Jo(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(Ko(e));
216
214
  continue;
217
215
  }
218
216
  if (!n)
219
217
  continue;
220
- const s = xo(n, r);
218
+ const s = Vo(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 Qo(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 Xo = [
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 Zo(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 en(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 tn(e) {
262
260
  return e.description?.trim() ? `Description:
263
261
  ${e.description}` : null;
264
262
  }
265
- function Uo(e, t) {
263
+ function on(e, t) {
266
264
  switch (t) {
267
265
  case "parameters":
268
- return lt(e.parameters) || null;
266
+ return Ct(e.parameters) || null;
269
267
  case "requestBody":
270
- return Kt(e.requestBody) || null;
268
+ return wo(e.requestBody) || null;
271
269
  case "security":
272
- return ee(e.security) || null;
270
+ return pe(e.security) || null;
273
271
  case "outputs":
274
- return Ie(e.outputs) || null;
272
+ return _e(e.outputs) || null;
275
273
  case "successCriteria":
276
- return Vt(e.successCriteria) || null;
274
+ return ho(e.successCriteria) || null;
277
275
  default:
278
276
  return null;
279
277
  }
280
278
  }
281
- function Do(e) {
279
+ function nn(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(tn(o)), o.operation) {
287
285
  const n = o.operation;
288
- t.push(qo(n));
286
+ t.push(Zo(n));
289
287
  } else if (o.xOperation) {
290
288
  const n = o.xOperation;
291
- t.push(Po(n));
289
+ t.push(en(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 rn(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 Ve(e, t) {
321
319
  const o = [];
322
320
  for (const n of t) {
323
- const r = Uo(e, n);
321
+ const r = on(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 sn(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(nn(e)), e.draftStep ? o.push(Ve(e.draftStep, t)) : e.step && o.push(Ve(e.step, t)), t.includes("response") && o.push(rn(e)), C(o, `
332
330
 
333
331
  `));
334
332
  }
335
- function Mo(e) {
333
+ function an(e) {
336
334
  return e?.trim() ? `Description:
337
335
  ${e}` : null;
338
336
  }
339
- function Fo(e, t) {
337
+ function cn(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 ln(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") ? an(e.description) : null,
363
+ cn(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: ${kt(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: ${St(e.relatedSecuritySchemes)}` : null,
369
+ t.includes("responses") && e.responseSchemas ? `Responses: ${Tt(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 dn(e, t) {
376
+ return e.type === "collection" ? jo(e, t) : e.type === "workflow" ? Qo(e, t) : e.type === "step" ? ln(e, t) : Bo(e, t);
379
377
  }
380
- function Yo(e, t) {
381
- return e.map((o) => Bo(o, t));
378
+ function un(e, t) {
379
+ return e.map((o) => dn(o, t));
382
380
  }
383
- const zo = ["info", "result", "severity"], Ho = 500, Go = L * 2;
384
- function Vo(e) {
381
+ const pn = ["info", "result", "severity"], fn = 500, mn = z * 2;
382
+ function hn(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 wn(e) {
390
388
  return `Severity settings:
391
389
  ${JSON.stringify(e.severitySettings, null, 2)}`;
392
390
  }
393
- function Jo(e, t) {
391
+ function In(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 Ke(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 In(ne(r, t), o);
400
398
  }
401
- function Qo(e, t) {
399
+ function yn(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 ? ne(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"}`, Gt(e) ? "passed" : "failed");
405
+ const a = e.checks ? Vt(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}: ${ne(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 vn(e, t, o) {
415
+ const { steps: n, totalSteps: r, passedSteps: s, succeeded: a, timedOut: l } = Ht(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 = mn, m = 0;
419
+ for (const { step: g } of n) {
420
+ if (u.push(` ${yn(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 = Ke(g.response?.body, t, fn);
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
+ ${Ke(
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 gn(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: ${ne(
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 ? vn(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 bn(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(hn(e));
470
468
  break;
471
469
  case "severity":
472
- n.push(Ko(e));
470
+ n.push(wn(e));
473
471
  break;
474
472
  case "result":
475
- n.push(Zo(e, o));
473
+ n.push(gn(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 kn(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 $.Step:
485
+ return sn(e, t);
486
+ case $.Workflow:
487
+ return Jo(e, t);
488
+ case $.Collection:
489
+ return Mo(e, t);
490
+ case $.WorkflowRun:
491
+ return bn(e, t, o);
494
492
  }
495
493
  }
496
- function on(e) {
494
+ function Sn(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 $.Collection:
497
+ return Uo;
498
+ case $.Workflow:
499
+ return Fo;
500
+ case $.Step:
501
+ return Xo;
502
+ case $.WorkflowRun:
503
+ return pn;
506
504
  }
507
505
  }
508
- function ut(e) {
506
+ function At(e) {
509
507
  return e.trim().replace(/\s+/g, " ").replace(/[.!?:;,…]+$/, "").toLowerCase();
510
508
  }
511
- function nn(e, t) {
509
+ function Tn(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 Cn(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 Et(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 = Je(e.key, n);
531
+ return s === null ? null : r.priorInputs.some((l) => Je(e.key, l) === s) ? { action: t, message: o } : null;
534
532
  };
535
533
  }
536
- function Ne(e, t) {
534
+ function Je(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 On(e) {
542
+ const t = Qe("warn", e.warnAfter, e.warnMessage), o = Qe("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 Qe(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 An(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 En(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 = Tn(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 = Cn(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 || !xn(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 xn(e) {
588
586
  return e !== null && typeof e == "object" && e.isError === !1;
589
587
  }
590
- function dn(e, t) {
588
+ function $n(e, t) {
591
589
  return {
592
590
  name: e.name,
593
591
  definition: e.definition,
594
- execute: cn(
592
+ execute: En(
595
593
  e.name,
596
594
  e.guards,
597
595
  e.createExecutor(t),
598
- an(e.definition.inputSchema)
596
+ An(e.definition.inputSchema)
599
597
  )
600
598
  };
601
599
  }
602
- const un = {
600
+ const _n = {
603
601
  messages: [],
604
602
  isStreaming: !1,
605
603
  sendMessage: async () => {
@@ -612,62 +610,62 @@ const un = {
612
610
  },
613
611
  chatStatus: "ready",
614
612
  chatError: void 0
615
- }, pn = $t(
616
- un
613
+ }, Rn = Yt(
614
+ _n
617
615
  );
618
- function Li() {
619
- return Et(pn);
616
+ function ac() {
617
+ return Ft(Rn);
620
618
  }
621
- const fn = p({
619
+ const qn = p({
622
620
  message: i(),
623
- details: te().optional()
621
+ details: fe().optional()
624
622
  });
625
623
  p({
626
624
  collectionId: i().min(1).describe("Target collection id."),
627
625
  workflowId: i().min(1).describe("Target workflow id."),
628
626
  stepId: i().min(1).describe("Target step id.")
629
627
  });
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({
628
+ const qe = p({
629
+ action: E(["add", "update", "remove"]).describe('Action to perform: "add", "update" or "remove".'),
630
+ approved: R().default(!0)
631
+ }), L = qe.extend({
634
632
  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({
638
- isError: I(!1),
639
- blocked: I(!0),
633
+ }), Pn = qe.extend({
634
+ index: A().int().min(0).optional().describe("Existing item index. Required for update/remove actions.")
635
+ }), Nn = p({
636
+ isError: w(!1),
637
+ blocked: w(!0),
640
638
  note: i(),
641
- data: U().optional(),
642
- error: U().optional()
639
+ data: F().optional(),
640
+ error: F().optional()
643
641
  });
644
- function $(e) {
645
- return we([
642
+ function q(e) {
643
+ return Re([
646
644
  p({
647
- isError: I(!0),
648
- error: fn,
649
- data: U().optional(),
650
- blocked: U().optional()
645
+ isError: w(!0),
646
+ error: qn,
647
+ data: F().optional(),
648
+ blocked: F().optional()
651
649
  }),
652
650
  p({
653
- isError: I(!1),
651
+ isError: w(!1),
654
652
  data: e,
655
- error: U().optional(),
653
+ error: F().optional(),
656
654
  note: i().optional(),
657
- blocked: U().optional()
655
+ blocked: F().optional()
658
656
  }),
659
- hn
657
+ Nn
660
658
  ]);
661
659
  }
662
- const In = p({
663
- status: T(["applied", "failed"]),
660
+ const Un = p({
661
+ status: E(["applied", "failed"]),
664
662
  summary: i().optional()
665
- }), wn = p({
666
- totalChanges: S().int().min(0),
667
- approvedChanges: S().int().min(0),
668
- applied: b(In),
663
+ }), Dn = p({
664
+ totalChanges: A().int().min(0),
665
+ approvedChanges: A().int().min(0),
666
+ applied: T(Un),
669
667
  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([
668
+ }), xt = q(Dn), Wn = "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.", Ln = E([
671
669
  "info",
672
670
  "workflows",
673
671
  "sourceDescriptions",
@@ -682,19 +680,19 @@ const In = p({
682
680
  "response",
683
681
  "result",
684
682
  "severity"
685
- ]), gn = B({
686
- sections: b(vn).min(1).describe(
683
+ ]), Mn = te({
684
+ sections: T(Ln).min(1).describe(
687
685
  "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
686
  ),
689
- stepIds: b(i()).min(1).optional().describe(
687
+ stepIds: T(i()).min(1).optional().describe(
690
688
  "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
689
  )
692
- }), bn = p({
690
+ }), jn = p({
693
691
  message: i()
694
- }), kn = $(bn), Sn = {
695
- description: yn,
696
- inputSchema: gn,
697
- outputSchema: kn,
692
+ }), Bn = q(jn), Fn = {
693
+ description: Wn,
694
+ inputSchema: Mn,
695
+ outputSchema: Bn,
698
696
  needsApproval: !1
699
697
  };
700
698
  function h(e, t) {
@@ -703,22 +701,22 @@ function h(e, t) {
703
701
  error: { message: e, details: t }
704
702
  };
705
703
  }
706
- function Tn(e, t) {
707
- const o = on(e), n = [], r = [];
704
+ function Yn(e, t) {
705
+ const o = Sn(e), n = [], r = [];
708
706
  for (const s of t)
709
707
  o.includes(s) ? n.push(s) : r.push(s);
710
708
  return { sections: n, skipped: r };
711
709
  }
712
- function Cn(e) {
710
+ function zn(e) {
713
711
  return async (t, o) => {
714
712
  const n = e();
715
713
  if (!n)
716
714
  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.";
715
+ const { sections: r, skipped: s } = Yn(n, t.sections), a = r.length > 0 ? r : ["info"];
716
+ let c = kn(n, a, { stepIds: t.stepIds }) ?? "Unable to build a summary for the active tab.";
719
717
  return s.length > 0 && (c += `
720
718
 
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 += `
719
+ (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 !== $.WorkflowRun ? c += `
722
720
 
723
721
  (stepIds applies only to workflow run tabs.)` : a.includes("result") || (c += "\n\n(stepIds requires the `result` section.)")), {
724
722
  isError: !1,
@@ -726,11 +724,11 @@ function Cn(e) {
726
724
  };
727
725
  };
728
726
  }
729
- const On = {
727
+ const Hn = {
730
728
  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.
729
+ definition: Fn,
730
+ createExecutor: (e) => zn(e.getActiveTabDetailedData)
731
+ }, Gn = `Read top-level metadata of a loaded OpenAPI document in the current Replay project.
734
732
 
735
733
  **What it does**
736
734
  - Scan: omit \`field\` to list the metadata fields present in the document, each with its shape (and item count for lists/maps).
@@ -745,7 +743,7 @@ const On = {
745
743
 
746
744
  **Input guidance**
747
745
  - \`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({
746
+ - Read one \`field\` at a time; use \`cursor\` only to continue a section you already started.`, Vn = te({
749
747
  apiId: i().describe(
750
748
  "ID of the loaded API document to read (the API URI, the same identifier used by the search tool)."
751
749
  ),
@@ -755,98 +753,98 @@ const On = {
755
753
  cursor: i().optional().describe(
756
754
  "Opaque cursor to continue a previously truncated section. Only meaningful together with `field`."
757
755
  )
758
- }), En = p({
756
+ }), Kn = p({
759
757
  name: i(),
760
- kind: T(["scalar", "object", "array"]),
761
- count: S().int().nonnegative().optional()
762
- }), $n = p({
758
+ kind: E(["scalar", "object", "array"]),
759
+ count: A().int().nonnegative().optional()
760
+ }), Jn = p({
763
761
  name: i(),
764
762
  hint: i()
765
- }), _n = p({
766
- available: b(En),
767
- blocked: b($n)
768
- }), Rn = p({
763
+ }), Qn = p({
764
+ available: T(Kn),
765
+ blocked: T(Jn)
766
+ }), Xn = p({
769
767
  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(),
768
+ value: fe(),
769
+ start: A().int().nonnegative().optional(),
770
+ end: A().int().nonnegative().optional(),
771
+ total: A().int().nonnegative().optional(),
772
+ truncated: R(),
775
773
  nextCursor: i().nullable()
776
- }), qn = we([_n, Rn]), Pn = $(qn), Nn = {
777
- description: An,
778
- inputSchema: xn,
779
- outputSchema: Pn,
774
+ }), Zn = Re([Qn, Xn]), er = q(Zn), tr = {
775
+ description: Gn,
776
+ inputSchema: Vn,
777
+ outputSchema: er,
780
778
  needsApproval: !1
781
- }, V = {
779
+ }, se = {
782
780
  paths: "Use the search tool to read endpoints and operations.",
783
781
  webhooks: "Use the search tool to read webhook operations.",
784
782
  components: "Use the search tool to read reusable components such as schemas and responses.",
785
783
  definitions: "Use the search tool to read reusable schemas.",
786
784
  parameters: "Use the search tool to read reusable parameters.",
787
785
  responses: "Use the search tool to read reusable responses."
788
- }, mt = ["id", "srcType", "fileDependencies"], ne = [
786
+ }, $t = ["id", "srcType", "fileDependencies"], he = [
789
787
  {
790
788
  name: "securitySchemes",
791
789
  sources: ["components.securitySchemes", "securityDefinitions"]
792
790
  }
793
- ], Un = 10, De = 500;
794
- function ht(e, t) {
791
+ ], or = 10, Xe = 500;
792
+ function _t(e, t) {
795
793
  for (const o of t.sources) {
796
- const n = Dn(e, o);
797
- if (Ln(n)) return n;
794
+ const n = nr(e, o);
795
+ if (rr(n)) return n;
798
796
  }
799
797
  return null;
800
798
  }
801
- function Dn(e, t) {
802
- return t.split(".").reduce((o, n) => M(o) ? o[n] : void 0, e);
799
+ function nr(e, t) {
800
+ return t.split(".").reduce((o, n) => Q(o) ? o[n] : void 0, e);
803
801
  }
804
- function Ln(e) {
805
- return e == null ? !1 : Array.isArray(e) ? e.length > 0 : M(e) ? Object.keys(e).length > 0 : !0;
802
+ function rr(e) {
803
+ return e == null ? !1 : Array.isArray(e) ? e.length > 0 : Q(e) ? Object.keys(e).length > 0 : !0;
806
804
  }
807
- function M(e) {
805
+ function Q(e) {
808
806
  return !(e === null || typeof e != "object" || Array.isArray(e));
809
807
  }
810
- const Wn = new Set(
811
- ne.flatMap((e) => e.sources.map((t) => t.split(".")[0]))
808
+ const sr = new Set(
809
+ he.flatMap((e) => e.sources.map((t) => t.split(".")[0]))
812
810
  );
813
- function Le(e) {
811
+ function Ze(e) {
814
812
  const t = [], o = [];
815
813
  for (const [n, r] of Object.entries(e)) {
816
- if (n in V) {
817
- o.push({ name: n, hint: V[n] });
814
+ if (n in se) {
815
+ o.push({ name: n, hint: se[n] });
818
816
  continue;
819
817
  }
820
- mt.includes(n) || Wn.has(n) || t.push(We(n, r));
818
+ $t.includes(n) || sr.has(n) || t.push(et(n, r));
821
819
  }
822
- for (const n of ne) {
823
- const r = ht(e, n);
824
- r !== null && t.push(We(n.name, r));
820
+ for (const n of he) {
821
+ const r = _t(e, n);
822
+ r !== null && t.push(et(n.name, r));
825
823
  }
826
824
  return { available: t, blocked: o };
827
825
  }
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;
826
+ function et(e, t) {
827
+ const o = { name: e, kind: ar(t) };
828
+ return Array.isArray(t) ? o.count = t.length : Q(t) && (o.count = Object.keys(t).length), o;
831
829
  }
832
- function Mn(e) {
833
- return Array.isArray(e) ? "array" : M(e) ? "object" : "scalar";
830
+ function ar(e) {
831
+ return Array.isArray(e) ? "array" : Q(e) ? "object" : "scalar";
834
832
  }
835
- function Fn(e, t, o) {
833
+ function ir(e, t, o) {
836
834
  if (Array.isArray(t))
837
- return Me(e, t, o, (n) => n);
838
- if (M(t)) {
835
+ return tt(e, t, o, (n) => n);
836
+ if (Q(t)) {
839
837
  const n = Object.keys(t).sort().map((r) => [r, t[r]]);
840
- return Me(e, n, o, (r) => Object.fromEntries(r));
838
+ return tt(e, n, o, (r) => Object.fromEntries(r));
841
839
  }
842
840
  return {
843
841
  field: e,
844
- value: K(t),
842
+ value: ae(t),
845
843
  truncated: !1,
846
844
  nextCursor: null
847
845
  };
848
846
  }
849
- function jn(e, t) {
847
+ function cr(e, t) {
850
848
  if (!e) return 0;
851
849
  let o;
852
850
  try {
@@ -859,79 +857,79 @@ function jn(e, t) {
859
857
  const s = Number(o.slice(n + 1));
860
858
  return !Number.isInteger(s) || s < 0 ? null : s;
861
859
  }
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;
860
+ function tt(e, t, o, n) {
861
+ const r = Math.min(Math.max(o, 0), t.length), s = Math.min(r + or, t.length), a = s < t.length;
864
862
  return {
865
863
  field: e,
866
- value: K(n(t.slice(r, s))),
864
+ value: ae(n(t.slice(r, s))),
867
865
  truncated: a,
868
866
  start: r,
869
867
  end: s,
870
868
  total: t.length,
871
- nextCursor: a ? Bn(e, s) : null
869
+ nextCursor: a ? lr(e, s) : null
872
870
  };
873
871
  }
874
- function K(e) {
872
+ function ae(e) {
875
873
  if (typeof e == "string")
876
- return e.length > De ? `${e.slice(0, De)}…` : e;
874
+ return e.length > Xe ? `${e.slice(0, Xe)}…` : e;
877
875
  if (Array.isArray(e))
878
- return e.map(K);
879
- if (M(e)) {
876
+ return e.map(ae);
877
+ if (Q(e)) {
880
878
  const t = {};
881
879
  for (const [o, n] of Object.entries(e))
882
- t[o] = K(n);
880
+ t[o] = ae(n);
883
881
  return t;
884
882
  }
885
883
  return e;
886
884
  }
887
- function Bn(e, t) {
885
+ function lr(e, t) {
888
886
  return btoa(`${e}:${t}`);
889
887
  }
890
- const Yn = new Map(
891
- ne.flatMap(
888
+ const dr = new Map(
889
+ he.flatMap(
892
890
  (e) => e.sources.map((t) => [t.split(".")[0], e.name])
893
891
  )
894
892
  );
895
- function zn(e, t, o) {
896
- const n = ne.find((a) => a.name === t);
893
+ function ur(e, t, o) {
894
+ const n = he.find((a) => a.name === t);
897
895
  if (n) {
898
- const a = ht(e, n);
899
- return a === null ? je(t) : Fe(t, a, o);
896
+ const a = _t(e, n);
897
+ return a === null ? nt(t) : ot(t, a, o);
900
898
  }
901
- if (t in V)
899
+ if (t in se)
902
900
  return h(
903
- `"${t}" is not available from this tool. ${V[t]}`,
901
+ `"${t}" is not available from this tool. ${se[t]}`,
904
902
  { field: t }
905
903
  );
906
- if (mt.includes(t))
904
+ if ($t.includes(t))
907
905
  return h(`"${t}" is not an OpenAPI metadata field.`, { field: t });
908
- const r = Yn.get(t);
906
+ const r = dr.get(t);
909
907
  if (r !== void 0)
910
908
  return h(`"${t}" is not a valid field name. Use "${r}" instead.`, {
911
909
  field: t
912
910
  });
913
911
  const s = e[t];
914
- return s == null ? je(t) : Fe(t, s, o);
912
+ return s == null ? nt(t) : ot(t, s, o);
915
913
  }
916
- function Fe(e, t, o) {
917
- const n = jn(o, e);
914
+ function ot(e, t, o) {
915
+ const n = cr(o, e);
918
916
  return n === null ? h(
919
917
  `The provided cursor is not valid for field "${e}". Omit the cursor to start from the first page.`,
920
918
  { field: e }
921
919
  ) : {
922
920
  isError: !1,
923
- data: Fn(e, t, n)
921
+ data: ir(e, t, n)
924
922
  };
925
923
  }
926
- function je(e) {
924
+ function nt(e) {
927
925
  return h(
928
926
  `"${e}" is not present in this API. Call this tool without a "field" to scan the available metadata fields.`,
929
927
  { field: e }
930
928
  );
931
929
  }
932
- function Hn(e) {
930
+ function pr(e) {
933
931
  return async (t) => {
934
- const o = e.apis.get({ noproxy: !0 }) ?? [], n = o.find((s) => s.id === t.apiId);
932
+ const o = e.get(le), n = o.find((s) => s.id === t.apiId);
935
933
  if (!n)
936
934
  return h(`API "${t.apiId}" is not loaded.`, {
937
935
  availableApiIds: o.map((s) => s.id)
@@ -940,62 +938,62 @@ function Hn(e) {
940
938
  return t.field == null && t.cursor !== void 0 ? h(
941
939
  "`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
940
  {
943
- data: Le(r)
941
+ data: Ze(r)
944
942
  }
945
- ) : t.field !== void 0 ? zn(r, t.field, t.cursor) : {
943
+ ) : t.field !== void 0 ? ur(r, t.field, t.cursor) : {
946
944
  isError: !1,
947
- data: Le(r)
945
+ data: Ze(r)
948
946
  };
949
947
  };
950
948
  }
951
- const Gn = {
949
+ const fr = {
952
950
  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({
956
- action: I("create_collection"),
951
+ definition: tr,
952
+ createExecutor: (e) => pr(e.store)
953
+ }, mr = "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.", hr = p({
954
+ action: w("create_collection"),
957
955
  title: i().min(1).describe("Collection display title (also used to derive the file id).")
958
- }).strict(), Jn = p({
959
- action: I("delete_collection"),
956
+ }).strict(), wr = p({
957
+ action: w("delete_collection"),
960
958
  collectionId: i().min(1).describe("Target collection id.")
961
- }).strict(), Qn = p({
962
- action: I("create_workflow"),
959
+ }).strict(), Ir = p({
960
+ action: w("create_workflow"),
963
961
  collectionId: i().min(1).describe("Parent collection id."),
964
962
  name: i().min(1).describe("Workflow summary / display name.")
965
- }).strict(), Xn = p({
966
- action: I("delete_workflow"),
963
+ }).strict(), yr = p({
964
+ action: w("delete_workflow"),
967
965
  collectionId: i().min(1),
968
966
  workflowId: i().min(1)
969
- }).strict(), Zn = [
970
- D.Text,
971
- D.JSON,
972
- D.XML
973
- ], er = p({
967
+ }).strict(), vr = [
968
+ Y.Text,
969
+ Y.JSON,
970
+ Y.XML
971
+ ], gr = p({
974
972
  name: i().min(1),
975
- in: T(["path", "query", "header", "cookie"]),
973
+ in: E(["path", "query", "header", "cookie"]),
976
974
  value: i()
977
- }).strict(), tr = p({
975
+ }).strict(), br = p({
978
976
  name: i().min(1).describe("Output name."),
979
977
  expression: i().min(1).describe("Output expression.")
980
- }).strict(), or = p({
978
+ }).strict(), kr = p({
981
979
  condition: i().min(1),
982
980
  context: i().optional(),
983
- type: T(["simple", "regex", "jsonpath", "xpath"]).optional()
984
- }).strict(), nr = p({
985
- action: I("create_step"),
981
+ type: E(["simple", "regex", "jsonpath", "xpath"]).optional()
982
+ }).strict(), Sr = p({
983
+ action: w("create_step"),
986
984
  collectionId: i().min(1),
987
985
  workflowId: i().min(1),
988
986
  stepName: i().min(1).optional().describe(
989
987
  '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
988
  ),
991
989
  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)."),
990
+ parameters: T(gr).optional().describe("Initial request parameters (path, query, header, cookie)."),
993
991
  body: p({
994
992
  content: i().describe("Request body content as string."),
995
- contentType: T(Zn).optional().describe("Request body content type.")
993
+ contentType: E(vr).optional().describe("Request body content type.")
996
994
  }).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."),
995
+ outputs: T(br).optional().describe("Initial step outputs (mappings for later steps)."),
996
+ successCriteria: T(kr).optional().describe("Initial success criteria rows."),
999
997
  operation: p({
1000
998
  apiId: i().min(1).describe("API id."),
1001
999
  path: i().min(1).describe("Request path."),
@@ -1008,69 +1006,69 @@ const Gn = {
1008
1006
  method: i().min(1).describe("HTTP method."),
1009
1007
  url: i().min(1).describe("Request URL.")
1010
1008
  }).optional().describe("Ad-hoc HTTP request (method + URL). Omit if using operation or a blank step."),
1011
- index: S().int().min(0).optional().describe(
1009
+ index: A().int().min(0).optional().describe(
1012
1010
  "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
1011
  )
1014
- }).strict(), rr = p({
1015
- action: I("delete_step"),
1012
+ }).strict(), Tr = p({
1013
+ action: w("delete_step"),
1016
1014
  collectionId: i().min(1),
1017
1015
  workflowId: i().min(1),
1018
1016
  stepId: i().min(1)
1019
- }).strict(), sr = p({
1020
- action: I("move_step"),
1017
+ }).strict(), Cr = p({
1018
+ action: w("move_step"),
1021
1019
  collectionId: i().min(1),
1022
1020
  workflowId: i().min(1),
1023
1021
  stepId: i().min(1).describe("Id of the existing step to move."),
1024
- toIndex: S().int().min(0).describe(
1022
+ toIndex: A().int().min(0).describe(
1025
1023
  "0-based target position for the step within the same workflow. Out-of-range values clamp to the nearest valid position."
1026
1024
  )
1027
- }).strict(), ar = p({
1028
- action: I("save_tab_to_collection"),
1025
+ }).strict(), Or = p({
1026
+ action: w("save_tab_to_collection"),
1029
1027
  targetCollectionId: i().min(1),
1030
1028
  targetWorkflowId: i().min(1),
1031
1029
  newStepName: i().min(1).describe(
1032
1030
  'Step id / label for the new step, used verbatim, so pass a single camelCase token such as "updateUser".'
1033
1031
  )
1034
- }).strict(), ir = p({
1035
- payload: oe("action", [
1036
- Kn,
1037
- Jn,
1038
- Qn,
1039
- Xn,
1040
- nr,
1041
- rr,
1042
- sr,
1043
- ar
1032
+ }).strict(), Ar = p({
1033
+ payload: me("action", [
1034
+ hr,
1035
+ wr,
1036
+ Ir,
1037
+ yr,
1038
+ Sr,
1039
+ Tr,
1040
+ Cr,
1041
+ Or
1044
1042
  ])
1045
1043
  }).superRefine((e, t) => {
1046
1044
  e.payload.action === "create_step" && e.payload.operation && e.payload.xOperation && t.addIssue({
1047
- code: W.custom,
1045
+ code: H.custom,
1048
1046
  message: "Only one of `operation` or `xOperation` may be specified."
1049
1047
  });
1050
- }), cr = p({
1048
+ }), Er = p({
1051
1049
  summary: i(),
1052
1050
  collectionId: i().optional(),
1053
1051
  workflowId: i().optional(),
1054
1052
  stepId: i().optional()
1055
- }), lr = $(cr), dr = {
1056
- description: Vn,
1057
- inputSchema: ir,
1058
- outputSchema: lr,
1053
+ }), xr = q(Er), $r = {
1054
+ description: mr,
1055
+ inputSchema: Ar,
1056
+ outputSchema: xr,
1059
1057
  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
1058
  };
1061
- function Be(e, t, o) {
1062
- return { ...Qe(e), key: t, value: o, active: !0 };
1059
+ function rt(e, t, o) {
1060
+ return { ...ft(e), key: t, value: o, active: !0 };
1063
1061
  }
1064
- function ur(e, t, o) {
1062
+ function _r(e, t, o) {
1065
1063
  const n = /* @__PURE__ */ new Map();
1066
1064
  for (const s of o)
1067
1065
  n.set(s.name, s.value);
1068
1066
  const r = [];
1069
1067
  for (const s of e) {
1070
- if (pe(s) && s.key && n.has(s.key)) {
1068
+ if (Ae(s) && s.key && n.has(s.key)) {
1071
1069
  const a = n.get(s.key);
1072
1070
  n.delete(s.key), r.push({
1073
- ...Be(t, s.key, a),
1071
+ ...rt(t, s.key, a),
1074
1072
  id: s.id,
1075
1073
  ...s.allowReserved !== void 0 && { allowReserved: s.allowReserved }
1076
1074
  });
@@ -1079,10 +1077,10 @@ function ur(e, t, o) {
1079
1077
  r.push(s);
1080
1078
  }
1081
1079
  for (const s of o)
1082
- n.has(s.name) && (r.push(Be(t, s.name, n.get(s.name))), n.delete(s.name));
1080
+ n.has(s.name) && (r.push(rt(t, s.name, n.get(s.name))), n.delete(s.name));
1083
1081
  return r;
1084
1082
  }
1085
- function pr(e, t) {
1083
+ function Rr(e, t) {
1086
1084
  if (t.description !== void 0 && (e.description = t.description), t.body && (e.requestBody = {
1087
1085
  ...e.requestBody,
1088
1086
  content: t.body.content,
@@ -1093,12 +1091,12 @@ function pr(e, t) {
1093
1091
  const r = o.get(n.in) ?? [];
1094
1092
  r.push(n), o.set(n.in, r);
1095
1093
  }
1096
- for (const n of Object.keys(G)) {
1094
+ for (const n of Object.keys(re)) {
1097
1095
  const r = o.get(n);
1098
1096
  if (!r?.length)
1099
1097
  continue;
1100
- const s = G[n];
1101
- e.parameters[s] = ur(
1098
+ const s = re[n];
1099
+ e.parameters[s] = _r(
1102
1100
  e.parameters[s],
1103
1101
  n,
1104
1102
  r
@@ -1119,8 +1117,8 @@ function pr(e, t) {
1119
1117
  }
1120
1118
  if (t.successCriteria?.length)
1121
1119
  for (const o of t.successCriteria) {
1122
- const n = Je(
1123
- o.type ?? ue.SIMPLE
1120
+ const n = pt(
1121
+ o.type ?? Ce.SIMPLE
1124
1122
  );
1125
1123
  e.successCriteria.push({
1126
1124
  ...n,
@@ -1130,34 +1128,34 @@ function pr(e, t) {
1130
1128
  }
1131
1129
  return e;
1132
1130
  }
1133
- function fr(e) {
1131
+ function qr(e) {
1134
1132
  return async (t) => {
1135
1133
  switch (t.payload.action) {
1136
1134
  case "create_collection":
1137
- return mr(t.payload, e);
1135
+ return Pr(t.payload, e);
1138
1136
  case "delete_collection":
1139
- return hr(t.payload, e);
1137
+ return Nr(t.payload, e);
1140
1138
  case "create_workflow":
1141
- return Ir(t.payload, e);
1139
+ return Ur(t.payload, e);
1142
1140
  case "delete_workflow":
1143
- return wr(t.payload, e);
1141
+ return Dr(t.payload, e);
1144
1142
  case "create_step":
1145
- return yr(t.payload, e);
1143
+ return Wr(t.payload, e);
1146
1144
  case "delete_step":
1147
- return gr(t.payload, e);
1145
+ return Mr(t.payload, e);
1148
1146
  case "move_step":
1149
- return br(t.payload, e);
1147
+ return jr(t.payload, e);
1150
1148
  case "save_tab_to_collection":
1151
- return kr(t.payload, e);
1149
+ return Br(t.payload, e);
1152
1150
  }
1153
1151
  };
1154
1152
  }
1155
- function mr(e, { store: t }) {
1156
- const o = Lt({
1153
+ function Pr(e, { store: t }) {
1154
+ const o = oo({
1157
1155
  name: e.title.trim(),
1158
- collections: t.collections
1156
+ collections: t.get(b)
1159
1157
  });
1160
- return t.collections.merge([o]), {
1158
+ return t.set(b, (n) => [...n, o]), {
1161
1159
  isError: !1,
1162
1160
  data: {
1163
1161
  summary: `Created collection "${o.info.title}" (${o.id}).`,
@@ -1165,12 +1163,12 @@ function mr(e, { store: t }) {
1165
1163
  }
1166
1164
  };
1167
1165
  }
1168
- function hr(e, { store: t, handleCloseByDataId: o }) {
1169
- const n = j(t, e.collectionId);
1166
+ function Nr(e, { store: t, handleCloseByDataId: o }) {
1167
+ const n = G(t.get(b), e.collectionId);
1170
1168
  if (!n)
1171
1169
  return h("Collection not found.", { collectionId: e.collectionId });
1172
- const r = n.info.title.get();
1173
- return J(n, o), n.set(he), {
1170
+ const r = n.info.title;
1171
+ return ie(n, o), t.set(b, (s) => to(s, e.collectionId)), {
1174
1172
  isError: !1,
1175
1173
  data: {
1176
1174
  summary: `Deleted collection "${r}" (${e.collectionId}).`,
@@ -1178,15 +1176,18 @@ function hr(e, { store: t, handleCloseByDataId: o }) {
1178
1176
  }
1179
1177
  };
1180
1178
  }
1181
- function Ir(e, { store: t }) {
1182
- const o = j(t, e.collectionId);
1179
+ function Ur(e, { store: t }) {
1180
+ const o = G(t.get(b), e.collectionId);
1183
1181
  if (!o)
1184
1182
  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]), {
1183
+ const n = Zt({ name: e.name.trim(), collection: o });
1184
+ return t.set(
1185
+ b,
1186
+ (r) => eo(r, e.collectionId, (s) => ({
1187
+ ...s,
1188
+ workflows: [...s.workflows, n]
1189
+ }))
1190
+ ), {
1190
1191
  isError: !1,
1191
1192
  data: {
1192
1193
  summary: `Created workflow "${n.summary ?? n.workflowId}" in collection ${e.collectionId}.`,
@@ -1195,17 +1196,24 @@ function Ir(e, { store: t }) {
1195
1196
  }
1196
1197
  };
1197
1198
  }
1198
- function wr(e, { store: t, handleCloseByDataId: o }) {
1199
- if (!j(t, e.collectionId))
1199
+ function Dr(e, { store: t, handleCloseByDataId: o }) {
1200
+ const n = t.get(b);
1201
+ if (!G(n, e.collectionId))
1200
1202
  return h("Collection not found.", { collectionId: e.collectionId });
1201
- const r = X(t, {
1203
+ const s = V(n, {
1202
1204
  collectionId: e.collectionId,
1203
1205
  workflowId: e.workflowId
1204
1206
  });
1205
- return r ? (J(r, o, {
1207
+ return s ? (ie(s, o, {
1206
1208
  collectionId: e.collectionId,
1207
1209
  workflowId: null
1208
- }), r.set(he), {
1210
+ }), t.set(
1211
+ b,
1212
+ (a) => Xt(a, {
1213
+ collectionId: e.collectionId,
1214
+ workflowId: e.workflowId
1215
+ })
1216
+ ), {
1209
1217
  isError: !1,
1210
1218
  data: {
1211
1219
  summary: `Deleted workflow ${e.workflowId} from collection ${e.collectionId}.`,
@@ -1217,76 +1225,88 @@ function wr(e, { store: t, handleCloseByDataId: o }) {
1217
1225
  workflowId: e.workflowId
1218
1226
  });
1219
1227
  }
1220
- async function yr(e, { store: t, attachApiToCollection: o, convertOperationToReplayValue: n }) {
1221
- if (!j(t, e.collectionId))
1228
+ async function Wr(e, { store: t, attachApiToCollection: o, convertOperationToReplayValue: n }) {
1229
+ const r = t.get(b);
1230
+ if (!G(r, e.collectionId))
1222
1231
  return h("Collection not found.", { collectionId: e.collectionId });
1223
- const s = X(t, {
1232
+ const a = V(r, {
1224
1233
  collectionId: e.collectionId,
1225
1234
  workflowId: e.workflowId
1226
1235
  });
1227
- if (!s)
1236
+ if (!a)
1228
1237
  return h("Workflow not found.", {
1229
1238
  collectionId: e.collectionId,
1230
1239
  workflowId: e.workflowId
1231
1240
  });
1232
- const a = e.operation ? {
1241
+ const l = e.operation ? {
1233
1242
  apiId: e.operation.apiId,
1234
1243
  path: e.operation.path.replace(/\{\{/g, "{").replace(/\}\}/g, "}"),
1235
1244
  method: e.operation.method.toLowerCase(),
1236
1245
  operationId: e.operation.operationId,
1237
1246
  isAdditionalOperation: !1
1238
- } : void 0, l = e.xOperation ? {
1247
+ } : void 0, c = e.xOperation ? {
1239
1248
  method: e.xOperation.method,
1240
1249
  url: e.xOperation.url
1241
1250
  } : void 0;
1242
- let c;
1243
- a && (c = Ut(t.apis, a, n), c && await o({
1251
+ let d;
1252
+ l && (d = Qt(
1253
+ t.get(le),
1254
+ l,
1255
+ n
1256
+ ), d && await o({
1244
1257
  collectionId: e.collectionId,
1245
- apiId: a.apiId
1258
+ apiId: l.apiId
1246
1259
  }));
1247
- const u = Xe({
1260
+ const u = mt({
1248
1261
  name: e.stepName?.trim() || "New Step",
1249
- workflow: s,
1250
- operation: a,
1251
- xOperation: l,
1252
- apiOperation: c
1262
+ workflow: a,
1263
+ operation: l,
1264
+ xOperation: c,
1265
+ apiOperation: d
1253
1266
  });
1254
- pr(u, {
1267
+ Rr(u, {
1255
1268
  description: e.description,
1256
1269
  parameters: e.parameters,
1257
1270
  body: e.body,
1258
1271
  outputs: e.outputs,
1259
1272
  successCriteria: e.successCriteria
1260
1273
  });
1261
- const d = vr(s, u, e.index);
1274
+ const f = Lr(
1275
+ t,
1276
+ { collectionId: e.collectionId, workflowId: e.workflowId },
1277
+ u,
1278
+ e.index
1279
+ );
1262
1280
  return {
1263
1281
  isError: !1,
1264
1282
  data: {
1265
- summary: `Created step ${u.stepId} at position ${d} in workflow ${e.workflowId}.`,
1283
+ summary: `Created step ${u.stepId} at position ${f} in workflow ${e.workflowId}.`,
1266
1284
  collectionId: e.collectionId,
1267
1285
  workflowId: e.workflowId,
1268
1286
  stepId: u.stepId
1269
1287
  }
1270
1288
  };
1271
1289
  }
1272
- function It(e, t) {
1290
+ function Rt(e, t) {
1273
1291
  return Math.min(Math.max(e, 0), t);
1274
1292
  }
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;
1293
+ function Lr(e, t, o, n) {
1294
+ const r = V(e.get(b), t)?.steps.length ?? 0, s = n === void 0 ? r : Rt(n, r);
1295
+ return e.set(
1296
+ b,
1297
+ (a) => ue(a, t, (l) => {
1298
+ const c = [...l.steps];
1299
+ return c.splice(s, 0, o), { ...l, steps: c };
1300
+ })
1301
+ ), s;
1278
1302
  }
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({
1303
+ function Mr(e, { store: t, handleCloseByDataId: o }) {
1304
+ const n = {
1286
1305
  collectionId: e.collectionId,
1287
1306
  workflowId: e.workflowId,
1288
1307
  stepId: e.stepId
1289
- }), n.set(he), {
1308
+ };
1309
+ return Ee(t.get(b), n) ? (o(n), t.set(b, (s) => Jt(s, n)), {
1290
1310
  isError: !1,
1291
1311
  data: {
1292
1312
  summary: `Deleted step ${e.stepId} from workflow ${e.workflowId}.`,
@@ -1300,116 +1320,124 @@ function gr(e, { store: t, handleCloseByDataId: o }) {
1300
1320
  stepId: e.stepId
1301
1321
  });
1302
1322
  }
1303
- function br(e, { store: t }) {
1304
- const o = X(t, {
1323
+ function jr(e, { store: t }) {
1324
+ const o = {
1305
1325
  collectionId: e.collectionId,
1306
1326
  workflowId: e.workflowId
1307
- });
1308
- if (!o)
1327
+ }, n = V(t.get(b), o);
1328
+ if (!n)
1309
1329
  return h("Workflow not found.", {
1310
1330
  collectionId: e.collectionId,
1311
1331
  workflowId: e.workflowId
1312
1332
  });
1313
- const n = o.steps.get({ noproxy: !0 }), r = n.findIndex((a) => a.stepId === e.stepId);
1314
- if (r === -1)
1333
+ const r = n.steps, s = r.findIndex((l) => l.stepId === e.stepId);
1334
+ if (s === -1)
1315
1335
  return h("Step not found.", {
1316
1336
  collectionId: e.collectionId,
1317
1337
  workflowId: e.workflowId,
1318
1338
  stepId: e.stepId
1319
1339
  });
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
- }), {
1340
+ const a = Rt(e.toIndex, r.length - 1);
1341
+ return t.set(
1342
+ b,
1343
+ (l) => ue(l, o, (c) => {
1344
+ const d = [...c.steps], [u] = d.splice(s, 1);
1345
+ return d.splice(a, 0, u), { ...c, steps: d };
1346
+ })
1347
+ ), {
1325
1348
  isError: !1,
1326
1349
  data: {
1327
- summary: `Moved step ${e.stepId} to position ${s} in workflow ${e.workflowId}.`,
1350
+ summary: `Moved step ${e.stepId} to position ${a} in workflow ${e.workflowId}.`,
1328
1351
  collectionId: e.collectionId,
1329
1352
  workflowId: e.workflowId,
1330
1353
  stepId: e.stepId
1331
1354
  }
1332
1355
  };
1333
1356
  }
1334
- async function kr(e, { store: t, attachApiToCollection: o }) {
1335
- const n = fe(t);
1357
+ async function Br(e, { store: t, attachApiToCollection: o }) {
1358
+ const n = de(t);
1336
1359
  if (!n)
1337
1360
  return h("No active tab.");
1338
- if (!me(n))
1361
+ if (!Z(n))
1339
1362
  return h("Active tab is not a step tab.", {
1340
- tabType: n.data.type.get()
1363
+ tabType: n.data.type
1341
1364
  });
1342
- const r = Nt(t, n);
1343
- if (!r)
1365
+ const r = t.get(b), s = Kt(r, n.data);
1366
+ if (!s)
1344
1367
  return h("No step data available on the active tab.");
1345
- if (!j(t, e.targetCollectionId))
1368
+ if (!G(r, e.targetCollectionId))
1346
1369
  return h("Target collection not found.", {
1347
1370
  collectionId: e.targetCollectionId
1348
1371
  });
1349
- const a = X(t, {
1372
+ const l = {
1350
1373
  collectionId: e.targetCollectionId,
1351
1374
  workflowId: e.targetWorkflowId
1352
- });
1353
- if (!a)
1375
+ }, c = V(r, l);
1376
+ if (!c)
1354
1377
  return h("Target workflow not found.", {
1355
1378
  collectionId: e.targetCollectionId,
1356
1379
  workflowId: e.targetWorkflowId
1357
1380
  });
1358
- const l = Xe({
1381
+ const d = mt({
1359
1382
  name: e.newStepName.trim(),
1360
- workflow: a,
1361
- fromStep: r
1383
+ workflow: c,
1384
+ fromStep: s
1362
1385
  });
1363
- return a.steps.merge([l]), l.operation?.apiId && await o({
1386
+ return t.set(
1387
+ b,
1388
+ (u) => ue(u, l, (f) => ({
1389
+ ...f,
1390
+ steps: [...f.steps, d]
1391
+ }))
1392
+ ), d.operation?.apiId && await o({
1364
1393
  collectionId: e.targetCollectionId,
1365
- apiId: l.operation.apiId
1394
+ apiId: d.operation.apiId
1366
1395
  }), {
1367
1396
  isError: !1,
1368
1397
  data: {
1369
- summary: `Added step ${l.stepId} to workflow ${e.targetWorkflowId}.`,
1398
+ summary: `Added step ${d.stepId} to workflow ${e.targetWorkflowId}.`,
1370
1399
  collectionId: e.targetCollectionId,
1371
1400
  workflowId: e.targetWorkflowId,
1372
- stepId: l.stepId
1401
+ stepId: d.stepId
1373
1402
  }
1374
1403
  };
1375
1404
  }
1376
- function J(e, t, o) {
1405
+ function ie(e, t, o) {
1377
1406
  if ("workflows" in e) {
1378
- const r = e.id.get();
1407
+ const n = e.id;
1379
1408
  e.workflows.forEach(
1380
- (s) => J(s, t, {
1381
- collectionId: r,
1409
+ (r) => ie(r, t, {
1410
+ collectionId: n,
1382
1411
  workflowId: null
1383
1412
  })
1384
- ), t({ collectionId: r, workflowId: null, stepId: null });
1413
+ ), t({ collectionId: n, workflowId: null, stepId: null });
1385
1414
  return;
1386
1415
  }
1387
1416
  if ("steps" in e) {
1388
- const r = e.workflowId.get();
1417
+ const n = e.workflowId;
1389
1418
  e.steps.forEach(
1390
- (s) => J(s, t, {
1419
+ (r) => ie(r, t, {
1391
1420
  collectionId: o?.collectionId,
1392
- workflowId: r
1421
+ workflowId: n
1393
1422
  })
1394
1423
  ), t({
1395
1424
  collectionId: o?.collectionId,
1396
- workflowId: r,
1425
+ workflowId: n,
1397
1426
  stepId: null
1398
1427
  });
1399
1428
  return;
1400
1429
  }
1401
- const n = e.stepId.get();
1402
1430
  t({
1403
1431
  collectionId: o?.collectionId,
1404
1432
  workflowId: o?.workflowId,
1405
- stepId: n
1433
+ stepId: e.stepId
1406
1434
  });
1407
1435
  }
1408
- const Sr = {
1436
+ const Fr = {
1409
1437
  name: "manage_collection",
1410
- definition: dr,
1411
- createExecutor: (e) => fr(e)
1412
- }, Tr = `Read, add, or change Replay environments (inputs and server mappings).
1438
+ definition: $r,
1439
+ createExecutor: (e) => qr(e)
1440
+ }, Yr = `Read, add, or change Replay environments (inputs and server mappings).
1413
1441
 
1414
1442
  **What it does**
1415
1443
  - Manages Replay project environments: inputs (values and secrecy) and per-\`apiId\` server URLs/variables.
@@ -1433,136 +1461,136 @@ const Sr = {
1433
1461
  **Loop/budget guidance**
1434
1462
  - Re-read environment/input data when decisions depend on up-to-date values.
1435
1463
  - 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({
1437
- action: I("get_environments")
1438
- }).strict(), Or = p({
1439
- action: I("get_active_environment")
1440
- }).strict(), Ar = p({
1441
- action: I("get_inputs"),
1442
- environment: q
1443
- }).strict(), xr = p({
1444
- action: I("get_servers"),
1445
- environment: q
1446
- }).strict(), Er = p({
1447
- action: I("get_input"),
1448
- environment: q,
1464
+ - 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."), zr = p({
1465
+ action: w("get_environments")
1466
+ }).strict(), Hr = p({
1467
+ action: w("get_active_environment")
1468
+ }).strict(), Gr = p({
1469
+ action: w("get_inputs"),
1470
+ environment: M
1471
+ }).strict(), Vr = p({
1472
+ action: w("get_servers"),
1473
+ environment: M
1474
+ }).strict(), Kr = p({
1475
+ action: w("get_input"),
1476
+ environment: M,
1449
1477
  inputName: i().min(1)
1450
- }).strict(), $r = p({
1451
- action: I("upsert_input"),
1452
- environment: q,
1478
+ }).strict(), Jr = p({
1479
+ action: w("upsert_input"),
1480
+ environment: M,
1453
1481
  name: i().min(1),
1454
1482
  value: i(),
1455
- isSecret: E().optional().describe(
1483
+ isSecret: R().optional().describe(
1456
1484
  "Only when creating a new input name: whether the value is secret (default false). Ignored when the name already exists."
1457
1485
  )
1458
- }).strict(), _r = p({
1459
- action: I("remove_input"),
1460
- environment: q,
1486
+ }).strict(), Qr = p({
1487
+ action: w("remove_input"),
1488
+ environment: M,
1461
1489
  inputName: i().min(1)
1462
- }).strict(), ve = p({
1490
+ }).strict(), Pe = p({
1463
1491
  name: i().min(1),
1464
1492
  value: i()
1465
- }).strict(), Rr = p({
1466
- action: I("upsert_server"),
1467
- environment: q,
1493
+ }).strict(), Xr = p({
1494
+ action: w("upsert_server"),
1495
+ environment: M,
1468
1496
  apiId: i().min(1),
1469
1497
  value: i(),
1470
- variables: b(ve).optional()
1471
- }).strict(), qr = p({
1498
+ variables: T(Pe).optional()
1499
+ }).strict(), Zr = p({
1472
1500
  name: i().min(1),
1473
1501
  value: i(),
1474
- isSecret: E().optional().describe("Defaults to false when omitted.")
1475
- }).strict(), Pr = p({
1502
+ isSecret: R().optional().describe("Defaults to false when omitted.")
1503
+ }).strict(), es = p({
1476
1504
  apiId: i().min(1),
1477
1505
  value: i(),
1478
- variables: b(ve).optional()
1479
- }).strict(), Nr = p({
1480
- action: I("add_environment"),
1506
+ variables: T(Pe).optional()
1507
+ }).strict(), ts = p({
1508
+ action: w("add_environment"),
1481
1509
  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({
1486
- action: I("remove_server"),
1487
- environment: q,
1510
+ inputs: T(Zr).optional().describe("Optional initial inputs for the new environment."),
1511
+ servers: T(es).optional().describe("Optional initial server mappings for the new environment."),
1512
+ setActive: R().optional().describe("When true, also set the new environment as active.")
1513
+ }).strict(), os = p({
1514
+ action: w("remove_server"),
1515
+ environment: M,
1488
1516
  apiId: i().min(1)
1489
- }).strict(), Dr = p({
1490
- action: I("set_active_environment"),
1517
+ }).strict(), ns = p({
1518
+ action: w("set_active_environment"),
1491
1519
  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
1520
+ }).strict(), rs = p({
1521
+ payload: me("action", [
1522
+ zr,
1523
+ ts,
1524
+ Hr,
1525
+ Gr,
1526
+ Vr,
1527
+ Kr,
1528
+ Jr,
1529
+ Qr,
1530
+ Xr,
1531
+ os,
1532
+ ns
1505
1533
  ])
1506
- }), Wr = p({
1534
+ }), ss = p({
1507
1535
  summary: i(),
1508
- environmentNames: b(i()).optional(),
1509
- inputs: b(
1536
+ environmentNames: T(i()).optional(),
1537
+ inputs: T(
1510
1538
  p({
1511
1539
  name: i(),
1512
- isSecret: E(),
1540
+ isSecret: R(),
1513
1541
  value: i()
1514
1542
  })
1515
1543
  ).optional(),
1516
- servers: b(
1544
+ servers: T(
1517
1545
  p({
1518
1546
  apiId: i(),
1519
1547
  value: i(),
1520
- variables: b(ve)
1548
+ variables: T(Pe)
1521
1549
  })
1522
1550
  ).optional(),
1523
1551
  input: p({
1524
1552
  name: i(),
1525
- isSecret: E(),
1553
+ isSecret: R(),
1526
1554
  value: i()
1527
1555
  }).optional(),
1528
1556
  environment: i().optional(),
1529
1557
  apiId: i().optional()
1530
- }), Mr = $(Wr), Fr = {
1531
- description: Tr,
1532
- inputSchema: Lr,
1533
- outputSchema: Mr,
1558
+ }), as = q(ss), is = {
1559
+ description: Yr,
1560
+ inputSchema: rs,
1561
+ outputSchema: as,
1534
1562
  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
1563
  };
1536
- function jr(e) {
1564
+ function cs(e) {
1537
1565
  return async (t, o) => {
1538
1566
  switch (t.payload.action) {
1539
1567
  case "get_environments":
1540
- return Br(e);
1568
+ return ls(e);
1541
1569
  case "add_environment":
1542
- return Yr(e, t.payload);
1570
+ return ds(e, t.payload);
1543
1571
  case "get_active_environment":
1544
- return zr(e);
1572
+ return us(e);
1545
1573
  case "set_active_environment":
1546
- return Zr(e, t.payload);
1574
+ return vs(e, t.payload);
1547
1575
  case "get_inputs":
1548
- return Hr(e, t.payload);
1576
+ return ps(e, t.payload);
1549
1577
  case "get_servers":
1550
- return Gr(e, t.payload);
1578
+ return fs(e, t.payload);
1551
1579
  case "get_input":
1552
- return Vr(e, t.payload);
1580
+ return ms(e, t.payload);
1553
1581
  case "upsert_input":
1554
- return Kr(e, t.payload);
1582
+ return hs(e, t.payload);
1555
1583
  case "remove_input":
1556
- return Jr(e, t.payload);
1584
+ return ws(e, t.payload);
1557
1585
  case "upsert_server":
1558
- return Qr(e, t.payload);
1586
+ return Is(e, t.payload);
1559
1587
  case "remove_server":
1560
- return Xr(e, t.payload);
1588
+ return ys(e, t.payload);
1561
1589
  }
1562
1590
  };
1563
1591
  }
1564
- function Br(e) {
1565
- const t = e.activeEnvironmentId.get(), o = e.environments.map((n) => n.name.get());
1592
+ function ls(e) {
1593
+ const t = e.get(K), o = e.get(ee).map((n) => n.name);
1566
1594
  return {
1567
1595
  isError: !1,
1568
1596
  data: {
@@ -1571,28 +1599,34 @@ function Br(e) {
1571
1599
  }
1572
1600
  };
1573
1601
  }
1574
- function Yr(e, t) {
1575
- if (re(e, t.environment))
1602
+ function ds(e, t) {
1603
+ if (we(e, t.environment))
1576
1604
  return h("Environment already exists.", {
1577
1605
  environment: t.environment
1578
1606
  });
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 ?? []
1607
+ const n = no(t.environment, /* @__PURE__ */ new Set());
1608
+ if (n)
1609
+ return h(n, {
1610
+ environment: t.environment
1611
+ });
1612
+ const r = (t.inputs ?? []).map((a) => ({
1613
+ name: a.name,
1614
+ value: a.value,
1615
+ isSecret: a.isSecret ?? !1
1616
+ })), s = (t.servers ?? []).map((a) => ({
1617
+ apiId: a.apiId,
1618
+ value: a.value,
1619
+ variables: a.variables ?? []
1587
1620
  }));
1588
- return e.environments.merge([
1621
+ return e.set(ee, (a) => [
1622
+ ...a,
1589
1623
  {
1590
1624
  name: t.environment,
1591
- inputs: n,
1592
- servers: r,
1593
- state: Wt.Normal
1625
+ inputs: r,
1626
+ servers: s,
1627
+ state: ro.Normal
1594
1628
  }
1595
- ]), t.setActive && e.activeEnvironmentId.set(t.environment), {
1629
+ ]), t.setActive && e.set(K, t.environment), {
1596
1630
  isError: !1,
1597
1631
  data: {
1598
1632
  summary: t.setActive ? `Added environment "${t.environment}" and set it active.` : `Added environment "${t.environment}".`,
@@ -1600,9 +1634,9 @@ function Yr(e, t) {
1600
1634
  }
1601
1635
  };
1602
1636
  }
1603
- function zr(e) {
1604
- const t = e.activeEnvironmentId.get();
1605
- return re(e, t) ? {
1637
+ function us(e) {
1638
+ const t = e.get(K);
1639
+ return we(e, t) ? {
1606
1640
  isError: !1,
1607
1641
  data: {
1608
1642
  summary: `Active environment is "${t}".`,
@@ -1612,11 +1646,11 @@ function zr(e) {
1612
1646
  environment: t
1613
1647
  });
1614
1648
  }
1615
- function Hr(e, t) {
1616
- const o = P(e, t.environment);
1649
+ function ps(e, t) {
1650
+ const o = j(e, t.environment);
1617
1651
  if (!o.ok)
1618
1652
  return o.result;
1619
- const { name: n, env: r } = o, s = ts(r.get());
1653
+ const { name: n, env: r } = o, s = bs(r);
1620
1654
  return {
1621
1655
  isError: !1,
1622
1656
  data: {
@@ -1626,11 +1660,11 @@ function Hr(e, t) {
1626
1660
  }
1627
1661
  };
1628
1662
  }
1629
- function Gr(e, t) {
1630
- const o = P(e, t.environment);
1663
+ function fs(e, t) {
1664
+ const o = j(e, t.environment);
1631
1665
  if (!o.ok)
1632
1666
  return o.result;
1633
- const { name: n, env: r } = o, s = os(r.get());
1667
+ const { name: n, env: r } = o, s = ks(r);
1634
1668
  return {
1635
1669
  isError: !1,
1636
1670
  data: {
@@ -1640,17 +1674,17 @@ function Gr(e, t) {
1640
1674
  }
1641
1675
  };
1642
1676
  }
1643
- function Vr(e, t) {
1644
- const o = P(e, t.environment);
1677
+ function ms(e, t) {
1678
+ const o = j(e, t.environment);
1645
1679
  if (!o.ok)
1646
1680
  return o.result;
1647
- const { name: n, env: r } = o, s = r.inputs.find((u) => u.name.get() === t.inputName);
1681
+ const { name: n, env: r } = o, s = r.inputs.find((d) => d.name === t.inputName);
1648
1682
  if (!s)
1649
1683
  return h("Input not found.", {
1650
1684
  environment: n,
1651
1685
  inputName: t.inputName
1652
1686
  });
1653
- const { name: a, isSecret: l, value: c } = s.get();
1687
+ const { name: a, isSecret: l, value: c } = s;
1654
1688
  return {
1655
1689
  isError: !1,
1656
1690
  data: {
@@ -1659,55 +1693,64 @@ function Vr(e, t) {
1659
1693
  input: {
1660
1694
  name: a,
1661
1695
  isSecret: l,
1662
- value: wt(l, c)
1696
+ value: qt(l, c)
1663
1697
  }
1664
1698
  }
1665
1699
  };
1666
1700
  }
1667
- function Kr(e, t) {
1668
- const o = P(e, t.environment);
1701
+ function hs(e, t) {
1702
+ const o = j(e, t.environment);
1669
1703
  if (!o.ok)
1670
1704
  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
- ]), {
1705
+ const { name: n, env: r } = o, s = r.inputs.find((l) => l.name === t.name), a = s ? s.isSecret : t.isSecret ?? !1;
1706
+ return Ie(e, n, (l) => ({
1707
+ ...l,
1708
+ inputs: [
1709
+ ...l.inputs.filter((c) => c.name !== t.name),
1710
+ { name: t.name, value: t.value, isSecret: a }
1711
+ ]
1712
+ })), {
1676
1713
  isError: !1,
1677
1714
  data: {
1678
- summary: `Upserted input "${t.name}" in "${n}" (${l ? "secret" : "plain"}).`,
1715
+ summary: `Upserted input "${t.name}" in "${n}" (${a ? "secret" : "plain"}).`,
1679
1716
  environment: n
1680
1717
  }
1681
1718
  };
1682
1719
  }
1683
- function Jr(e, t) {
1684
- const o = P(e, t.environment);
1720
+ function ws(e, t) {
1721
+ const o = j(e, t.environment);
1685
1722
  if (!o.ok)
1686
1723
  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), {
1724
+ const { name: n, env: r } = o;
1725
+ return r.inputs.some((s) => s.name === t.inputName) ? (Ie(e, n, (s) => ({
1726
+ ...s,
1727
+ inputs: s.inputs.filter((a) => a.name !== t.inputName)
1728
+ })), {
1692
1729
  isError: !1,
1693
1730
  data: {
1694
1731
  summary: `Removed input "${t.inputName}" from "${n}".`,
1695
1732
  environment: n
1696
1733
  }
1734
+ }) : h("Input not found.", {
1735
+ environment: n,
1736
+ inputName: t.inputName
1697
1737
  });
1698
1738
  }
1699
- function Qr(e, t) {
1700
- const o = P(e, t.environment);
1739
+ function Is(e, t) {
1740
+ const o = j(e, t.environment);
1701
1741
  if (!o.ok)
1702
1742
  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 = {
1743
+ const { name: n } = o;
1744
+ return Ie(e, n, (r) => {
1745
+ const s = r.servers, a = s.findIndex((d) => d.apiId === t.apiId), l = a >= 0 && t.variables === void 0 ? s[a].variables : t.variables ?? [], c = {
1706
1746
  apiId: t.apiId,
1707
1747
  value: t.value,
1708
1748
  variables: l
1709
1749
  };
1710
- return a >= 0 ? s.toSpliced(a, 1, c) : [c, ...s];
1750
+ return {
1751
+ ...r,
1752
+ servers: a >= 0 ? s.toSpliced(a, 1, c) : [c, ...s]
1753
+ };
1711
1754
  }), {
1712
1755
  isError: !1,
1713
1756
  data: {
@@ -1717,36 +1760,39 @@ function Qr(e, t) {
1717
1760
  }
1718
1761
  };
1719
1762
  }
1720
- function Xr(e, t) {
1721
- const o = P(e, t.environment);
1763
+ function ys(e, t) {
1764
+ const o = j(e, t.environment);
1722
1765
  if (!o.ok)
1723
1766
  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), {
1767
+ const { name: n, env: r } = o;
1768
+ return r.servers.some((s) => s.apiId === t.apiId) ? (Ie(e, n, (s) => ({
1769
+ ...s,
1770
+ servers: s.servers.filter((a) => a.apiId !== t.apiId)
1771
+ })), {
1729
1772
  isError: !1,
1730
1773
  data: {
1731
1774
  summary: `Removed server "${t.apiId}" from "${n}".`,
1732
1775
  environment: n,
1733
1776
  apiId: t.apiId
1734
1777
  }
1778
+ }) : h("Server not found.", {
1779
+ environment: n,
1780
+ apiId: t.apiId
1735
1781
  });
1736
1782
  }
1737
- function Zr(e, t) {
1738
- return re(e, t.environment) ? (e.activeEnvironmentId.set(t.environment), {
1783
+ function vs(e, t) {
1784
+ return we(e, t.environment) ? (e.set(K, t.environment), {
1739
1785
  isError: !1,
1740
1786
  data: {
1741
1787
  summary: `Active environment is now "${t.environment}".`
1742
1788
  }
1743
1789
  }) : h("Environment not found.", { environment: t.environment });
1744
1790
  }
1745
- function es(e, t) {
1746
- return t ?? e.activeEnvironmentId.get();
1791
+ function gs(e, t) {
1792
+ return t ?? e.get(K);
1747
1793
  }
1748
- function P(e, t) {
1749
- const o = es(e, t), n = re(e, o);
1794
+ function j(e, t) {
1795
+ const o = gs(e, t), n = we(e, o);
1750
1796
  return n ? { ok: !0, name: o, env: n } : {
1751
1797
  ok: !1,
1752
1798
  result: h(
@@ -1755,42 +1801,48 @@ function P(e, t) {
1755
1801
  )
1756
1802
  };
1757
1803
  }
1758
- function re(e, t) {
1759
- return e.environments.find((o) => o.name.get() === t);
1804
+ function we(e, t) {
1805
+ return e.get(ee).find((o) => o.name === t);
1806
+ }
1807
+ function Ie(e, t, o) {
1808
+ e.set(
1809
+ ee,
1810
+ (n) => n.map((r) => r.name === t ? o(r) : r)
1811
+ );
1760
1812
  }
1761
- function ts(e) {
1813
+ function bs(e) {
1762
1814
  return e.inputs.map((t) => ({
1763
1815
  name: t.name,
1764
1816
  isSecret: t.isSecret,
1765
- value: wt(t.isSecret, t.value)
1817
+ value: qt(t.isSecret, t.value)
1766
1818
  }));
1767
1819
  }
1768
- function os(e) {
1820
+ function ks(e) {
1769
1821
  return e.servers.map((t) => ({
1770
1822
  apiId: t.apiId,
1771
1823
  value: t.value,
1772
1824
  variables: t.variables.map((o) => ({ name: o.name, value: o.value }))
1773
1825
  }));
1774
1826
  }
1775
- function wt(e, t) {
1776
- return e ? Mt : t;
1827
+ function qt(e, t) {
1828
+ return e ? so : t;
1777
1829
  }
1778
- const ns = {
1830
+ const Ss = {
1779
1831
  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([
1832
+ definition: is,
1833
+ createExecutor: (e) => cs(e.store)
1834
+ }, Ts = ht, Cs = "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.", Os = E([
1783
1835
  "focus_tab",
1784
1836
  "open_operation",
1785
1837
  "open_collection",
1786
1838
  "open_workflow",
1787
1839
  "open_step",
1788
1840
  "open_new_request"
1789
- ]), is = B({
1790
- action: as.describe(
1841
+ ]), As = te({
1842
+ action: Os.describe(
1791
1843
  "Tab to open or focus; see tool description for unsaved vs collection actions."
1792
1844
  ),
1793
- tabIndex: S().optional().describe("focus_tab only: zero-based index of an already open tab."),
1845
+ tabIndex: A().optional().describe("focus_tab only: zero-based index of an already open tab."),
1794
1846
  collectionId: i().optional().describe("open_collection, open_workflow, or open_step."),
1795
1847
  workflowId: i().optional().describe("open_workflow or open_step."),
1796
1848
  stepId: i().optional().describe("open_step only."),
@@ -1800,30 +1852,30 @@ const ns = {
1800
1852
  requestUrl: i().optional().describe(
1801
1853
  "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
1854
  ),
1803
- requestMethod: T(rs).optional().describe("open_new_request with requestUrl: HTTP method; defaults to GET if omitted.")
1855
+ requestMethod: E(Ts).optional().describe("open_new_request with requestUrl: HTTP method; defaults to GET if omitted.")
1804
1856
  }).superRefine((e, t) => {
1805
1857
  const n = (e.requestUrl?.trim() ?? "").length > 0, r = e.requestMethod !== void 0;
1806
1858
  (n || r) && e.action !== "open_new_request" && t.addIssue({
1807
- code: W.custom,
1859
+ code: H.custom,
1808
1860
  message: "requestUrl and requestMethod are only valid with action open_new_request.",
1809
1861
  path: ["requestUrl"]
1810
1862
  }), r && !n && t.addIssue({
1811
- code: W.custom,
1863
+ code: H.custom,
1812
1864
  message: "requestMethod requires a non-empty requestUrl.",
1813
1865
  path: ["requestMethod"]
1814
1866
  });
1815
- }), cs = p({
1816
- outcome: T(["focused", "opened"]),
1817
- activeTabIndex: S().int().nonnegative(),
1867
+ }), Es = p({
1868
+ outcome: E(["focused", "opened"]),
1869
+ activeTabIndex: A().int().nonnegative(),
1818
1870
  tabId: i(),
1819
- tabType: to(O)
1820
- }), ls = $(cs), ds = {
1821
- description: ss,
1822
- inputSchema: is,
1823
- outputSchema: ls,
1871
+ tabType: ko($)
1872
+ }), xs = q(Es), $s = {
1873
+ description: Cs,
1874
+ inputSchema: As,
1875
+ outputSchema: xs,
1824
1876
  needsApproval: !1
1825
1877
  };
1826
- function se({
1878
+ function ye({
1827
1879
  items: e,
1828
1880
  id: t,
1829
1881
  messages: o,
@@ -1840,19 +1892,19 @@ function se({
1840
1892
  details: { matches: l.map(r) }
1841
1893
  } : { ok: !1, message: o.notFound, details: s(a) };
1842
1894
  }
1843
- function yt(e, t) {
1844
- const o = se({
1845
- items: e.collections,
1895
+ function Pt(e, t) {
1896
+ const o = ye({
1897
+ items: e,
1846
1898
  id: t,
1847
1899
  messages: {
1848
1900
  empty: "Collection id is empty.",
1849
1901
  ambiguous: "Multiple collections share that id; ids must be unique.",
1850
1902
  notFound: "No collection found with that id."
1851
1903
  },
1852
- getItemId: (r) => r.id.get(),
1904
+ getItemId: (r) => r.id,
1853
1905
  formatAmbiguousMatch: (r) => ({
1854
- id: r.id.get(),
1855
- title: r.info.title.get()
1906
+ id: r.id,
1907
+ title: r.info.title
1856
1908
  }),
1857
1909
  buildNotFoundDetails: (r) => ({ collectionId: r })
1858
1910
  });
@@ -1860,13 +1912,13 @@ function yt(e, t) {
1860
1912
  const n = o.value;
1861
1913
  return {
1862
1914
  ok: !0,
1863
- value: { collectionId: n.id.get(), collection: n }
1915
+ value: { collectionId: n.id, collection: n }
1864
1916
  };
1865
1917
  }
1866
- function ge(e, t, o) {
1867
- const n = yt(e, t);
1918
+ function Ne(e, t, o) {
1919
+ const n = Pt(e, t);
1868
1920
  if (!n.ok) return n;
1869
- const r = se({
1921
+ const r = ye({
1870
1922
  items: n.value.collection.workflows,
1871
1923
  id: o,
1872
1924
  messages: {
@@ -1874,10 +1926,10 @@ function ge(e, t, o) {
1874
1926
  ambiguous: "Multiple workflows share that id in this collection; ids must be unique.",
1875
1927
  notFound: "No workflow found with that id in the given collection."
1876
1928
  },
1877
- getItemId: (a) => a.workflowId.get(),
1929
+ getItemId: (a) => a.workflowId,
1878
1930
  formatAmbiguousMatch: (a) => ({
1879
- workflowId: a.workflowId.get(),
1880
- summary: a.summary?.get()
1931
+ workflowId: a.workflowId,
1932
+ summary: a.summary
1881
1933
  }),
1882
1934
  buildNotFoundDetails: (a) => ({
1883
1935
  collectionId: n.value.collectionId,
@@ -1890,15 +1942,15 @@ function ge(e, t, o) {
1890
1942
  ok: !0,
1891
1943
  value: {
1892
1944
  collectionId: n.value.collectionId,
1893
- workflowId: s.workflowId.get(),
1945
+ workflowId: s.workflowId,
1894
1946
  workflow: s
1895
1947
  }
1896
1948
  };
1897
1949
  }
1898
- function vt(e, t, o, n) {
1899
- const r = ge(e, t, o);
1950
+ function Nt(e, t, o, n) {
1951
+ const r = Ne(e, t, o);
1900
1952
  if (!r.ok) return r;
1901
- const s = se({
1953
+ const s = ye({
1902
1954
  items: r.value.workflow.steps,
1903
1955
  id: n,
1904
1956
  messages: {
@@ -1906,10 +1958,10 @@ function vt(e, t, o, n) {
1906
1958
  ambiguous: "Multiple steps share that id in this workflow; ids must be unique.",
1907
1959
  notFound: "No step found with that id in the given workflow."
1908
1960
  },
1909
- getItemId: (l) => l.stepId.get(),
1961
+ getItemId: (l) => l.stepId,
1910
1962
  formatAmbiguousMatch: (l) => ({
1911
- stepId: l.stepId.get(),
1912
- description: l.description?.get()
1963
+ stepId: l.stepId,
1964
+ description: l.description
1913
1965
  }),
1914
1966
  buildNotFoundDetails: (l) => ({
1915
1967
  collectionId: r.value.collectionId,
@@ -1924,13 +1976,13 @@ function vt(e, t, o, n) {
1924
1976
  value: {
1925
1977
  collectionId: r.value.collectionId,
1926
1978
  workflowId: r.value.workflowId,
1927
- stepId: a.stepId.get(),
1979
+ stepId: a.stepId,
1928
1980
  step: a
1929
1981
  }
1930
1982
  };
1931
1983
  }
1932
- function us(e, t) {
1933
- const o = Ft(e.apis).filter(
1984
+ function _s(e, t) {
1985
+ const o = ao(e).filter(
1934
1986
  (r) => r.operationId != null && r.operationId !== ""
1935
1987
  );
1936
1988
  if (!o.length)
@@ -1938,7 +1990,7 @@ function us(e, t) {
1938
1990
  ok: !1,
1939
1991
  message: "No operations with operationId in loaded APIs."
1940
1992
  };
1941
- const n = se({
1993
+ const n = ye({
1942
1994
  items: o,
1943
1995
  id: t,
1944
1996
  messages: {
@@ -1956,38 +2008,85 @@ function us(e, t) {
1956
2008
  });
1957
2009
  return n.ok ? { ok: !0, value: n.value } : n;
1958
2010
  }
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)
2011
+ function Rs(e, t, o, n, r) {
2012
+ o = o.trim(), n = n.trim(), r = r.trim();
2013
+ const s = !o && !n && !r, a = !!(o && n && r);
2014
+ if (!s && !a)
1963
2015
  return {
1964
2016
  ok: !1,
1965
2017
  message: "Provide all three ids for a saved step, or three empty strings for the focused unsaved request tab."
1966
2018
  };
1967
- if (s) {
1968
- const m = vt(e, t, o, n);
1969
- return m.ok ? { ok: !0, value: m.value.step } : m;
2019
+ if (a) {
2020
+ const f = Nt(e, o, n, r);
2021
+ return f.ok ? {
2022
+ ok: !0,
2023
+ value: {
2024
+ step: f.value.step,
2025
+ source: { kind: "saved", collectionId: o, workflowId: n, stepId: r }
2026
+ }
2027
+ } : f;
1970
2028
  }
1971
- const a = fe(e);
1972
- if (!a || !me(a))
2029
+ if (!t || !Z(t))
1973
2030
  return {
1974
2031
  ok: !1,
1975
2032
  message: "Active tab is not a step tab.",
1976
- details: { tabType: a?.data?.type?.get() }
2033
+ details: { tabType: t?.data?.type }
1977
2034
  };
1978
- const l = a.data.collectionId.get(), c = a.data.workflowId.get(), u = a.data.stepId.get();
1979
- if (!tt(l, c, u, "", "", ""))
2035
+ const {
2036
+ collectionId: l,
2037
+ workflowId: c,
2038
+ stepId: d
2039
+ } = t.data;
2040
+ if (!wt(l, c, d, "", "", ""))
1980
2041
  return {
1981
2042
  ok: !1,
1982
2043
  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
2044
  details: {
1984
- activeTab: { collectionId: l, workflowId: c, stepId: u }
2045
+ activeTab: { collectionId: l, workflowId: c, stepId: d }
2046
+ }
2047
+ };
2048
+ const u = t.data.draftStep;
2049
+ return u ? { ok: !0, value: { step: u, source: { kind: "draft" } } } : { ok: !1, message: "No draft step on the active tab." };
2050
+ }
2051
+ function Ut(e, t, o, n) {
2052
+ const r = Rs(
2053
+ e.get(b),
2054
+ de(e) ?? null,
2055
+ t,
2056
+ o,
2057
+ n
2058
+ );
2059
+ if (!r.ok) return r;
2060
+ const { step: s, source: a } = r.value;
2061
+ if (a.kind === "saved") {
2062
+ const c = a;
2063
+ return {
2064
+ ok: !0,
2065
+ value: {
2066
+ step: s,
2067
+ readStep: () => Ee(e.get(b), c) ?? s,
2068
+ updateStep: (d) => e.set(b, (u) => It(u, c, d))
1985
2069
  }
1986
2070
  };
1987
- const d = a.data.draftStep.ornull;
1988
- return d ? { ok: !0, value: d } : { ok: !1, message: "No draft step on the active tab." };
2071
+ }
2072
+ const l = xe(e);
2073
+ return {
2074
+ ok: !0,
2075
+ value: {
2076
+ step: s,
2077
+ readStep: () => qs(e, l) ?? s,
2078
+ updateStep: (c) => Oe(e, l, (d) => ({
2079
+ ...d,
2080
+ draftStep: d.draftStep ? c(d.draftStep) : d.draftStep
2081
+ }))
2082
+ }
2083
+ };
2084
+ }
2085
+ function qs(e, t) {
2086
+ const o = e.get(J)[t];
2087
+ return o && Z(o) ? o.data.draftStep : null;
1989
2088
  }
1990
- function ps(e) {
2089
+ function Ps(e) {
1991
2090
  return {
1992
2091
  apiId: e.apiId,
1993
2092
  path: e.path,
@@ -1996,196 +2095,209 @@ function ps(e) {
1996
2095
  isAdditionalOperation: e.isAdditionalOperation
1997
2096
  };
1998
2097
  }
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";
2098
+ function Ns(e, t) {
2099
+ if (t.focusOperationTab(e))
2100
+ return "focused";
2101
+ const o = t.getApiOperation(e), n = io(e, o);
2102
+ return t.addNewTab({ ...n, state: yt.Normal }), "opened";
2008
2103
  }
2009
- function ms(e, t) {
2104
+ function Us(e, t) {
2010
2105
  return (o, n) => {
2011
2106
  try {
2012
2107
  switch (o.action) {
2013
2108
  case "focus_tab":
2014
- return hs(e, t, o.tabIndex);
2109
+ return Ds(e, t, o.tabIndex);
2015
2110
  case "open_operation":
2016
- return Is(e, t, o.operationId);
2111
+ return Ws(e, t, o.operationId);
2017
2112
  case "open_collection":
2018
- return ws(e, t, o.collectionId);
2113
+ return Ls(e, e.get(b), t, o.collectionId);
2019
2114
  case "open_workflow":
2020
- return ys(e, t, o.collectionId, o.workflowId);
2115
+ return Ms(
2116
+ e,
2117
+ e.get(b),
2118
+ t,
2119
+ o.collectionId,
2120
+ o.workflowId
2121
+ );
2021
2122
  case "open_step":
2022
- return vs(e, t, o.collectionId, o.workflowId, o.stepId);
2123
+ return js(
2124
+ e,
2125
+ e.get(b),
2126
+ t,
2127
+ o.collectionId,
2128
+ o.workflowId,
2129
+ o.stepId
2130
+ );
2023
2131
  case "open_new_request":
2024
- return gs(e, t, o.requestUrl, o.requestMethod);
2132
+ return Bs(e, t, o.requestUrl, o.requestMethod);
2025
2133
  default: {
2026
2134
  const r = o.action;
2027
- return C("Unsupported open_tab action.", { action: r });
2135
+ return x("Unsupported open_tab action.", { action: r });
2028
2136
  }
2029
2137
  }
2030
2138
  } catch (r) {
2031
- return C("Failed to open or focus tab.", {
2139
+ return x("Failed to open or focus tab.", {
2032
2140
  cause: r instanceof Error ? r.message : String(r)
2033
2141
  });
2034
2142
  }
2035
2143
  };
2036
2144
  }
2037
- function hs(e, t, o) {
2145
+ function Ds(e, t, o) {
2038
2146
  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.", {
2147
+ return x("tabIndex is required when action is focus_tab");
2148
+ const n = e.get(J);
2149
+ return o < 0 || o >= n.length ? x("Invalid tab index.", {
2042
2150
  tabIndex: o,
2043
2151
  tabCount: n.length
2044
- }) : (t.handleTabChange(o), F(e, "focused"));
2152
+ }) : (t.handleTabChange(o), X(e, "focused"));
2045
2153
  }
2046
- function Is(e, t, o) {
2154
+ function Ws(e, t, o) {
2047
2155
  const n = o?.trim();
2048
2156
  if (!n)
2049
- return C("operationId is required when action is open_operation");
2050
- const r = us(e, n);
2157
+ return x("operationId is required when action is open_operation");
2158
+ const r = _s(e.get(le), n);
2051
2159
  if (!r.ok)
2052
- return C(r.message, r.details);
2053
- const s = fs(
2054
- e,
2055
- ps(r.value),
2160
+ return x(r.message, r.details);
2161
+ const s = Ns(
2162
+ Ps(r.value),
2056
2163
  t
2057
2164
  );
2058
- return F(e, s);
2165
+ return X(e, s);
2059
2166
  }
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;
2167
+ function Ls(e, t, o, n) {
2168
+ const r = n?.trim();
2169
+ if (!r)
2170
+ return x("collectionId is required when action is open_collection");
2171
+ const s = Pt(t, r);
2172
+ if (!s.ok)
2173
+ return x(s.message, s.details);
2174
+ const { collectionId: a } = s.value, l = e.get(J).findIndex((c) => {
2175
+ const d = c.data;
2176
+ return $e(d, $.Collection) && d.collectionId === a;
2070
2177
  }) !== -1;
2071
- return t.openCollectionTab({
2072
- collectionId: s,
2073
- activeTabName: nt.COLLECTION_SETTINGS
2074
- }), F(e, a ? "focused" : "opened");
2178
+ return o.openCollectionTab({
2179
+ collectionId: a,
2180
+ activeTabName: vt.COLLECTION_SETTINGS
2181
+ }), X(e, l ? "focused" : "opened");
2075
2182
  }
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");
2183
+ function Ms(e, t, o, n, r) {
2184
+ const s = n?.trim(), a = r?.trim();
2080
2185
  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;
2186
+ return x("collectionId is required when action is open_workflow");
2187
+ if (!a)
2188
+ return x("workflowId is required when action is open_workflow");
2189
+ const l = Ne(t, s, a);
2190
+ if (!l.ok)
2191
+ return x(l.message, l.details);
2192
+ const { collectionId: c, workflowId: d } = l.value, u = e.get(J).findIndex((f) => {
2193
+ const m = f.data;
2194
+ return $e(m, $.Workflow) && m.workflowId === d && m.collectionId === c;
2088
2195
  }) !== -1;
2089
- return t.openWorkflowTab({
2090
- collectionId: l,
2091
- workflowId: c,
2092
- activeTabName: nt.WORKFLOW_SETTINGS
2093
- }), F(e, u ? "focused" : "opened");
2196
+ return o.openWorkflowTab({
2197
+ collectionId: c,
2198
+ workflowId: d,
2199
+ activeTabName: vt.WORKFLOW_SETTINGS
2200
+ }), X(e, u ? "focused" : "opened");
2094
2201
  }
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");
2202
+ function js(e, t, o, n, r, s) {
2203
+ const a = n?.trim(), l = r?.trim(), c = s?.trim();
2099
2204
  if (!a)
2100
- return C("workflowId is required when action is open_step");
2205
+ return x("collectionId is required when action is open_step");
2101
2206
  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);
2207
+ return x("workflowId is required when action is open_step");
2208
+ if (!c)
2209
+ return x("stepId is required when action is open_step");
2210
+ const d = Nt(
2211
+ t,
2212
+ a,
2213
+ l,
2214
+ c
2215
+ );
2216
+ if (!d.ok)
2217
+ return x(d.message, d.details);
2106
2218
  const {
2107
2219
  collectionId: u,
2108
- workflowId: d,
2220
+ workflowId: f,
2109
2221
  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({
2222
+ } = d.value, g = e.get(J).find(({ data: v }) => $e(v, $.Step) && v.collectionId === u && v.workflowId === f && v.stepId === m && v.historyId === null) !== void 0;
2223
+ return o.openStepTabFromCollection({
2112
2224
  collectionId: u,
2113
- workflowId: d,
2225
+ workflowId: f,
2114
2226
  stepId: m,
2115
- state: ot.Normal
2116
- }), F(e, f ? "focused" : "opened");
2227
+ state: yt.Normal
2228
+ }), X(e, g ? "focused" : "opened");
2117
2229
  }
2118
- function gs(e, t, o, n) {
2230
+ function Bs(e, t, o, n) {
2119
2231
  return o ? t.openStepTabFromXOperation({
2120
2232
  method: n ?? "GET",
2121
2233
  url: o
2122
- }) : t.handleNewTabOpen(), F(e, "opened");
2234
+ }) : t.handleNewTabOpen(), X(e, "opened");
2123
2235
  }
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 });
2236
+ function X(e, t) {
2237
+ const o = xe(e), n = de(e);
2238
+ return n ? Fs(t, o, n.id, n.data.type) : x("No active tab after navigation.", { activeTabIndex: o });
2127
2239
  }
2128
- function C(e, t) {
2240
+ function x(e, t) {
2129
2241
  return {
2130
2242
  isError: !0,
2131
2243
  error: { message: e, ...t !== void 0 ? { details: t } : {} }
2132
2244
  };
2133
2245
  }
2134
- function bs(e, t, o, n) {
2246
+ function Fs(e, t, o, n) {
2135
2247
  return { isError: !1, data: { outcome: e, activeTabIndex: t, tabId: o, tabType: n } };
2136
2248
  }
2137
- const ks = {
2249
+ const Ys = {
2138
2250
  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.
2251
+ definition: $s,
2252
+ createExecutor: (e) => Us(e.store, e.context)
2253
+ }, zs = `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
2254
 
2143
2255
  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
2256
 
2145
2257
  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
2258
 
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({
2259
+ 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.`, Hs = te({
2148
2260
  message: i().trim().min(1).max(220).regex(/^[^\r\n]+$/, "must be a single line").describe(
2149
2261
  "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
2262
  )
2151
- }), Cs = p({
2152
- acknowledged: I(!0)
2153
- }), Os = $(Cs), As = {
2154
- description: Ss,
2155
- inputSchema: Ts,
2156
- outputSchema: Os,
2263
+ }), Gs = p({
2264
+ acknowledged: w(!0)
2265
+ }), Vs = q(Gs), Ks = {
2266
+ description: zs,
2267
+ inputSchema: Hs,
2268
+ outputSchema: Vs,
2157
2269
  needsApproval: !1
2158
2270
  };
2159
- function xs() {
2271
+ function Js() {
2160
2272
  return async () => ({
2161
2273
  isError: !1,
2162
2274
  data: { acknowledged: !0 }
2163
2275
  });
2164
2276
  }
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) {
2277
+ const Qs = "Duplicate of a previous status - it adds nothing for the user. Do not repeat statuses; take a concrete action instead.";
2278
+ function Xs(e) {
2167
2279
  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
2280
  }
2169
- function _s(e) {
2281
+ function Zs(e) {
2170
2282
  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
2283
  }
2172
- const Rs = [
2173
- pt({
2174
- key: (e) => ut(e.message),
2175
- warn: Es
2284
+ const ea = [
2285
+ Et({
2286
+ key: (e) => At(e.message),
2287
+ warn: Qs
2176
2288
  }),
2177
- sn({
2289
+ On({
2178
2290
  warnAfter: 2,
2179
- warnMessage: $s,
2291
+ warnMessage: Xs,
2180
2292
  blockAfter: 4,
2181
- blockMessage: _s
2293
+ blockMessage: Zs
2182
2294
  })
2183
- ], qs = {
2295
+ ], ta = {
2184
2296
  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.
2297
+ definition: Ks,
2298
+ guards: ea,
2299
+ createExecutor: (e) => Js()
2300
+ }, oa = `Send the HTTP request for the **currently focused** Replay step tab and return the live response.
2189
2301
 
2190
2302
  **What it does**
2191
2303
  - Executes the request from the active step context (saved step or focused draft step).
@@ -2214,7 +2326,7 @@ const Rs = [
2214
2326
  - Execute when you need new runtime evidence, not by default after every edit.
2215
2327
  - Re-run after meaningful request/config changes or when validating a fix/hypothesis.
2216
2328
  - 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({
2329
+ - For endpoint exploration, treat one run per endpoint as default budget unless inputs changed or rerun is explicitly needed.`, na = p({
2218
2330
  collectionId: i().describe(
2219
2331
  "Saved step: collection id. Unsaved draft tab on focus: empty string (with empty workflowId and stepId)."
2220
2332
  ),
@@ -2227,91 +2339,127 @@ const Rs = [
2227
2339
  }).strict().superRefine((e, t) => {
2228
2340
  const o = e.collectionId.trim(), n = e.workflowId.trim(), r = e.stepId.trim();
2229
2341
  !(o && n && r) && !(!o && !n && !r) && t.addIssue({
2230
- code: W.custom,
2342
+ code: H.custom,
2231
2343
  message: "Provide all three ids for a saved step, or three empty strings for the focused unsaved request tab.",
2232
2344
  path: ["collectionId"]
2233
2345
  });
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."),
2346
+ }), ra = p({
2347
+ status: A().optional().describe("HTTP status code."),
2348
+ headers: T(ze([i(), i()])).optional().describe("Response headers as key-value pairs."),
2349
+ cookies: T(ze([i(), i()])).optional().describe("Response cookies as key-value pairs."),
2238
2350
  body: i().optional().describe("Response body, truncated if too large."),
2239
2351
  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,
2352
+ duration: A().optional().describe("Request duration in milliseconds."),
2353
+ size: A().optional().describe("Response size in bytes.")
2354
+ }), sa = q(ra), aa = {
2355
+ description: oa,
2356
+ inputSchema: na,
2357
+ outputSchema: sa,
2246
2358
  needsApproval: () => !0
2247
2359
  };
2248
- function Ws(e, t) {
2360
+ function ia(e, t) {
2249
2361
  return async (n, r) => {
2250
- const s = fe(e);
2251
- if (!s || !me(s))
2362
+ const s = xe(t), a = de(t);
2363
+ if (!a || !Z(a))
2252
2364
  return h("Active tab is not a step tab", {
2253
- tabType: s?.data?.type?.get()
2365
+ tabType: a?.data?.type
2254
2366
  });
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,
2367
+ const {
2368
+ collectionId: l,
2369
+ workflowId: c,
2370
+ stepId: d
2371
+ } = a.data, u = n.collectionId.trim(), f = n.workflowId.trim(), m = n.stepId.trim();
2372
+ if (!wt(
2258
2373
  l,
2259
2374
  c,
2260
- u,
2261
2375
  d,
2376
+ u,
2377
+ f,
2262
2378
  m
2263
2379
  ))
2264
2380
  return h(
2265
2381
  "Active tab does not match the target step. Open the target tab first using open_tab.",
2266
2382
  {
2267
2383
  activeTab: {
2268
- collectionId: a,
2269
- workflowId: l,
2270
- stepId: c
2384
+ collectionId: l,
2385
+ workflowId: c,
2386
+ stepId: d
2271
2387
  },
2272
- hint: a === null && l === null && c === null ? "Focused tab is an unsaved request; pass empty strings for collectionId, workflowId, and stepId." : void 0
2388
+ hint: l === null && c === null && d === null ? "Focused tab is an unsaved request; pass empty strings for collectionId, workflowId, and stepId." : void 0
2273
2389
  }
2274
2390
  );
2275
- const y = Ze(e, {
2391
+ const v = t.get(b), I = {
2276
2392
  collectionId: u || null,
2277
- workflowId: d || null,
2393
+ workflowId: f || null,
2278
2394
  stepId: m || null
2279
- }) ?? s.data.draftStep.ornull;
2280
- if (!y)
2395
+ }, O = Ee(v, I), S = a.data.draftStep;
2396
+ let P;
2397
+ if (O)
2398
+ P = {
2399
+ step: O,
2400
+ onStepChange: ((W) => t.set(
2401
+ b,
2402
+ (U) => It(U, I, W)
2403
+ ))
2404
+ };
2405
+ else if (S)
2406
+ P = {
2407
+ step: S,
2408
+ onStepChange: ((W) => Oe(t, s, (U) => ({
2409
+ ...U,
2410
+ draftStep: U.draftStep ? W(U.draftStep) : U.draftStep
2411
+ })))
2412
+ };
2413
+ else
2281
2414
  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 ? {
2415
+ const ve = V(v, I);
2416
+ await co(
2417
+ {
2418
+ tabId: a.id,
2419
+ updateData: (W) => Oe(t, s, W)
2420
+ },
2421
+ {
2422
+ ...P,
2423
+ workflow: ve,
2424
+ onWorkflowChange: (W) => t.set(b, (U) => ue(U, I, W)),
2425
+ collection: G(v, I.collectionId),
2426
+ collections: v
2427
+ },
2428
+ e,
2429
+ lo(t.get(ee), t.get(K))
2430
+ );
2431
+ const N = t.get(J)[s], Me = N && Z(N) ? N.data.response : null;
2432
+ return Me ? {
2285
2433
  isError: !1,
2286
- data: Ms(v)
2434
+ data: ca(Me)
2287
2435
  } : h("Request did not produce a response.");
2288
2436
  };
2289
2437
  }
2290
- function Ms(e) {
2438
+ function ca(e) {
2291
2439
  return {
2292
2440
  status: e.status,
2293
- headers: Ye(e.headers),
2294
- cookies: Ye(e.cookies),
2295
- body: Fs(e.body ?? ""),
2441
+ headers: st(e.headers),
2442
+ cookies: st(e.cookies),
2443
+ body: la(e.body ?? ""),
2296
2444
  url: e.url ?? "",
2297
2445
  duration: e.duration,
2298
2446
  size: e.size
2299
2447
  };
2300
2448
  }
2301
- function Ye(e) {
2449
+ function st(e) {
2302
2450
  const t = [];
2303
2451
  for (const o of e)
2304
2452
  t.push([String(o[0]), String(o[1])]);
2305
2453
  return t;
2306
2454
  }
2307
- function Fs(e) {
2308
- return e.length <= L ? e : `${e.slice(0, L)}… (truncated, total ${e.length} chars)`;
2455
+ function la(e) {
2456
+ return e.length <= z ? e : `${e.slice(0, z)}… (truncated, total ${e.length} chars)`;
2309
2457
  }
2310
- const js = {
2458
+ const da = {
2311
2459
  name: "run_request",
2312
- definition: Ls,
2313
- createExecutor: (e) => Ws(e.store, e.settingsState)
2314
- }, Bs = `Run an Arazzo workflow and return its result.
2460
+ definition: aa,
2461
+ createExecutor: (e) => ia(e.settings, e.store)
2462
+ }, ua = `Run an Arazzo workflow and return its result.
2315
2463
 
2316
2464
  **What it does**
2317
2465
  - Executes the whole workflow (all steps, with cross-step \`$steps.*\` resolution) and waits for it to finish.
@@ -2334,52 +2482,52 @@ const js = {
2334
2482
  **After the run**
2335
2483
  - Report the outcome from this tool's result; do not re-read it with other tools.
2336
2484
  - 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({
2485
+ - Each call starts a NEW run. Call it again only when the user wants another run.`, pa = te({
2338
2486
  collectionId: i().describe("Id of the collection that holds the workflow."),
2339
2487
  workflowId: i().describe("Id of the workflow to run.")
2340
- }), zs = p({
2488
+ }), fa = p({
2341
2489
  stepId: i(),
2342
- statusCode: S().int().nullable(),
2343
- passed: E()
2344
- }), Hs = p({
2490
+ statusCode: A().int().nullable(),
2491
+ passed: R()
2492
+ }), ma = p({
2345
2493
  collectionId: i().describe("Resolved id of the collection that was run."),
2346
2494
  workflowId: i().describe("Resolved id of the workflow that was run."),
2347
2495
  historyId: i().nullable().describe(
2348
2496
  "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
2497
  ),
2350
- success: E().describe(
2498
+ success: R().describe(
2351
2499
  "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
2500
  ),
2353
- timedOut: E().describe(
2501
+ timedOut: R().describe(
2354
2502
  "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
2503
  ),
2356
- durationMs: S().describe("Total run time in milliseconds."),
2357
- totalSteps: S().int().nonnegative(),
2358
- passedSteps: S().int().nonnegative(),
2359
- steps: b(zs).describe(
2504
+ durationMs: A().describe("Total run time in milliseconds."),
2505
+ totalSteps: A().int().nonnegative(),
2506
+ passedSteps: A().int().nonnegative(),
2507
+ steps: T(fa).describe(
2360
2508
  "Per-step outcome, in execution order: stepId, HTTP statusCode, and pass/fail only — no check name or failure message."
2361
2509
  )
2362
- }), Gs = $(Hs), Vs = {
2363
- description: Bs,
2364
- inputSchema: Ys,
2365
- outputSchema: Gs,
2510
+ }), ha = q(ma), wa = {
2511
+ description: ua,
2512
+ inputSchema: pa,
2513
+ outputSchema: ha,
2366
2514
  needsApproval: !1
2367
2515
  };
2368
- function Ks(e, t) {
2516
+ function Ia(e, t) {
2369
2517
  return async (o, n) => {
2370
2518
  const r = o.collectionId.trim(), s = o.workflowId.trim();
2371
2519
  if (!r)
2372
2520
  return h("collectionId is required.");
2373
2521
  if (!s)
2374
2522
  return h("workflowId is required.");
2375
- const a = ge(e, r, s);
2523
+ const a = Ne(e.get(b), r, s);
2376
2524
  if (!a.ok)
2377
2525
  return h(
2378
2526
  a.message,
2379
2527
  a.details
2380
2528
  );
2381
2529
  try {
2382
- const { workflowResult: l, historyId: c, verdict: u } = await t({
2530
+ const { workflowResult: l, historyId: c, verdict: d } = await t({
2383
2531
  collectionId: a.value.collectionId,
2384
2532
  workflowId: a.value.workflowId
2385
2533
  });
@@ -2389,15 +2537,15 @@ function Ks(e, t) {
2389
2537
  collectionId: a.value.collectionId,
2390
2538
  workflowId: a.value.workflowId,
2391
2539
  historyId: c,
2392
- success: u.succeeded,
2393
- timedOut: u.timedOut,
2540
+ success: d.succeeded,
2541
+ timedOut: d.timedOut,
2394
2542
  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
2543
+ totalSteps: d.totalSteps,
2544
+ passedSteps: d.passedSteps,
2545
+ steps: d.steps.map(({ step: u, passed: f }) => ({
2546
+ stepId: u.stepId,
2547
+ statusCode: u.response?.statusCode ?? null,
2548
+ passed: f
2401
2549
  }))
2402
2550
  }
2403
2551
  };
@@ -2408,18 +2556,18 @@ function Ks(e, t) {
2408
2556
  }
2409
2557
  };
2410
2558
  }
2411
- const Js = {
2559
+ const ya = {
2412
2560
  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({
2561
+ definition: wa,
2562
+ createExecutor: (e) => Ia(e.store, e.runWorkflow)
2563
+ }, va = 25, ga = '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', ba = p({
2416
2564
  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(
2565
+ count: A().positive().max(va).optional().default(10),
2566
+ type: E(["api_operation", "api", "collection", "workflow", "step"]).describe(
2419
2567
  "Scope results to this item type. api = OpenAPI spec; api_operation = API endpoint; collection = Arazzo collection; workflow = Arazzo workflow; step = Arazzo workflow step."
2420
2568
  ),
2421
- include: b(
2422
- T([
2569
+ include: T(
2570
+ E([
2423
2571
  "description",
2424
2572
  "path",
2425
2573
  "method",
@@ -2446,15 +2594,15 @@ const Js = {
2446
2594
  collectionId: i().optional().describe("Arazzo collection ID."),
2447
2595
  workflowId: i().optional().describe("Workflow ID within the collection. Requires collectionId."),
2448
2596
  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,
2597
+ }).strict(), ka = fe(), Sa = {
2598
+ description: ga,
2599
+ inputSchema: ba,
2600
+ outputSchema: ka,
2453
2601
  needsApproval: !1
2454
- }, oa = ["get", "put", "post", "delete", "options", "head", "patch", "trace"], na = ["query", "x-query"];
2455
- function ra(e) {
2602
+ }, Ta = ["get", "put", "post", "delete", "options", "head", "patch", "trace"], Ca = ["query", "x-query"];
2603
+ function Oa(e) {
2456
2604
  return async (t, o) => {
2457
- const n = so(), r = {
2605
+ const n = Oo(), r = {
2458
2606
  type: t.type,
2459
2607
  apiId: t.apiId,
2460
2608
  operationId: t.operationId,
@@ -2465,21 +2613,21 @@ function ra(e) {
2465
2613
  stepId: t.stepId
2466
2614
  }, s = t.query ?? "";
2467
2615
  let a = await n.search(s, t.count, r);
2468
- return a.length === 0 && (a = la(e, r)), a.length === 0 ? {
2616
+ return a.length === 0 && (a = _a(e, r)), a.length === 0 ? {
2469
2617
  isError: !1,
2470
2618
  data: {
2471
- message: `No results found. ${sa(t)}`
2619
+ message: `No results found. ${Aa(t)}`
2472
2620
  }
2473
2621
  } : {
2474
2622
  isError: !1,
2475
2623
  data: {
2476
- message: da(a, t.include)
2624
+ message: Ra(a, t.include)
2477
2625
  }
2478
2626
  };
2479
2627
  };
2480
2628
  }
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;
2629
+ function Aa(e) {
2630
+ const t = [], { type: o, apiId: n, path: r, method: s, operationId: a, collectionId: l, workflowId: c, stepId: d, query: u } = e;
2483
2631
  switch (o) {
2484
2632
  case "api":
2485
2633
  n || t.push("apiId");
@@ -2489,8 +2637,8 @@ function sa(e) {
2489
2637
  t.push("apiId");
2490
2638
  break;
2491
2639
  }
2492
- const v = a != null && a !== "", A = r != null && r !== "" && s != null && s !== "";
2493
- !v && !A && t.push("operationId", "path", "method");
2640
+ const v = a != null && a !== "", I = r != null && r !== "" && s != null && s !== "";
2641
+ !v && !I && t.push("operationId", "path", "method");
2494
2642
  break;
2495
2643
  }
2496
2644
  case "collection":
@@ -2500,111 +2648,111 @@ function sa(e) {
2500
2648
  l ? c || t.push("workflowId") : t.push("collectionId");
2501
2649
  break;
2502
2650
  case "step":
2503
- l ? c ? u || t.push("stepId") : t.push("workflowId") : t.push("collectionId");
2651
+ l ? c ? d || t.push("stepId") : t.push("workflowId") : t.push("collectionId");
2504
2652
  break;
2505
2653
  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");
2654
+ if (l != null && l !== "" && (c ? d || t.push("stepId") : t.push("workflowId")), n != null && n !== "") {
2655
+ const v = a != null && a !== "", I = r != null && r !== "" && s != null && s !== "";
2656
+ !v && !I && t.push("operationId", "path", "method");
2509
2657
  }
2510
2658
  }
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;
2659
+ u != null && u.trim() !== "" || t.push("query");
2660
+ const m = [...new Set(t)];
2661
+ let g;
2662
+ 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
2663
  }
2516
- function aa(e, t) {
2664
+ function Ea(e, t) {
2517
2665
  const o = e.paths ?? {};
2518
2666
  for (const [n, r] of Object.entries(o)) {
2519
2667
  if (!r || typeof r != "object") continue;
2520
2668
  const s = r, a = [
2521
- ...oa.filter((c) => c in r),
2522
- ...na.filter((c) => c in r)
2669
+ ...Ta.filter((c) => c in r),
2670
+ ...Ca.filter((c) => c in r)
2523
2671
  ];
2524
2672
  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 };
2673
+ const d = r[c];
2674
+ if (!d || typeof d != "object") continue;
2675
+ const u = d;
2676
+ if (!(t.operationId && (u.operationId ?? "") !== t.operationId) && !(t.path && n !== t.path) && !(t.method && c.toUpperCase() !== t.method.toUpperCase()))
2677
+ return { path: n, method: c, op: u, pathItem: s };
2530
2678
  }
2531
2679
  const l = s.additionalOperations;
2532
2680
  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 };
2681
+ for (const [c, d] of Object.entries(l)) {
2682
+ if (!d || typeof d != "object") continue;
2683
+ const u = d;
2684
+ if (!(t.operationId && (u.operationId ?? "") !== t.operationId) && !(t.path && n !== t.path) && !(t.method && c.toUpperCase() !== t.method.toUpperCase()))
2685
+ return { path: n, method: c, op: u, pathItem: s };
2538
2686
  }
2539
2687
  }
2540
2688
  return null;
2541
2689
  }
2542
- function ia(e, t) {
2690
+ function xa(e, t) {
2543
2691
  const { type: o, apiId: n, operationId: r, path: s, method: a } = t;
2544
2692
  if (!n) return [];
2545
- const l = e.find((y) => y.id === n);
2693
+ const l = e.find((g) => g.id === n);
2546
2694
  if (!l) return [];
2547
2695
  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({
2696
+ return [{ ...He(l).payload, score: 1 }];
2697
+ const c = r != null && r !== "", d = s != null && s !== "" && a != null && a !== "";
2698
+ if (!(o === "api_operation" || c || d || o == null && (c || d)))
2699
+ return o == null ? [{ ...He(l).payload, score: 1 }] : [];
2700
+ const f = Ea(l, { operationId: r, path: s, method: a });
2701
+ return f ? [{ ...Ao({
2554
2702
  apiId: l.id,
2555
2703
  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),
2704
+ path: f.path,
2705
+ method: f.method,
2706
+ op: f.op,
2707
+ pathItem: f.pathItem,
2708
+ globalSchemes: Eo(l),
2561
2709
  apiSecurity: l.security
2562
2710
  }).payload, score: 1 }] : [];
2563
2711
  }
2564
- function ca(e, t) {
2712
+ function $a(e, t) {
2565
2713
  const { type: o, collectionId: n, workflowId: r, stepId: s } = t;
2566
2714
  if (!n) return [];
2567
- const a = e.find((d) => d.id === n);
2715
+ const a = e.find((u) => u.id === n);
2568
2716
  if (!a) return [];
2569
2717
  const l = a.info?.title ?? "Untitled Collection";
2570
2718
  if (o === "collection")
2571
- return [{ ...Re(a).payload, score: 1 }];
2719
+ return [{ ...Ge(a).payload, score: 1 }];
2572
2720
  const c = () => {
2573
2721
  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 ? [
2722
+ const u = a.workflows?.find((m) => (m.workflowId ?? "") === r);
2723
+ if (!u) return [];
2724
+ const f = u.steps?.find((m) => (m.stepId ?? "") === s);
2725
+ return f ? [
2578
2726
  {
2579
- ...co({
2727
+ ...xo({
2580
2728
  collectionId: n,
2581
2729
  collectionTitle: l,
2582
2730
  workflowId: r,
2583
- workflowTitle: d.summary ?? r,
2584
- step: m
2731
+ workflowTitle: u.summary ?? r,
2732
+ step: f
2585
2733
  }).payload,
2586
2734
  score: 1
2587
2735
  }
2588
2736
  ] : [];
2589
- }, u = () => {
2737
+ }, d = () => {
2590
2738
  if (!r) return [];
2591
- const d = a.workflows?.find((m) => (m.workflowId ?? "") === r);
2592
- return d ? [
2739
+ const u = a.workflows?.find((f) => (f.workflowId ?? "") === r);
2740
+ return u ? [
2593
2741
  {
2594
- ...lo({ collectionId: n, collectionTitle: l, workflow: d }).payload,
2742
+ ...$o({ collectionId: n, collectionTitle: l, workflow: u }).payload,
2595
2743
  score: 1
2596
2744
  }
2597
2745
  ] : [];
2598
2746
  };
2599
- return o === "step" ? c() : o === "workflow" ? u() : o == null ? s && r ? c() : r ? u() : [{ ...Re(a).payload, score: 1 }] : [];
2747
+ return o === "step" ? c() : o === "workflow" ? d() : o == null ? s && r ? c() : r ? d() : [{ ...Ge(a).payload, score: 1 }] : [];
2600
2748
  }
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) : [];
2749
+ function _a(e, t) {
2750
+ const o = e.get(le), n = e.get(b), { type: r } = t;
2751
+ return r === "api" || r === "api_operation" ? xa(o, t) : r === "collection" || r === "workflow" || r === "step" ? $a(n, t) : [];
2604
2752
  }
2605
- function da(e, t) {
2753
+ function Ra(e, t) {
2606
2754
  return [
2607
- Yo(e, t).join(`
2755
+ un(e, t).join(`
2608
2756
 
2609
2757
  `)
2610
2758
  // ... other parts
@@ -2612,51 +2760,51 @@ function da(e, t) {
2612
2760
 
2613
2761
  `);
2614
2762
  }
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) {
2763
+ const qa = "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;
2764
+ function Na(e) {
2617
2765
  const t = [
2618
2766
  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)
2767
+ D(e.query),
2768
+ D(e.apiId),
2769
+ D(e.operationId),
2770
+ D(e.path),
2771
+ D(e.method)?.toLowerCase(),
2772
+ D(e.collectionId),
2773
+ D(e.workflowId),
2774
+ D(e.stepId)
2627
2775
  ];
2628
- return t.every((o) => o == null) ? null : JSON.stringify([...t, ma(e), ha(e)]);
2776
+ return t.every((o) => o == null) ? null : JSON.stringify([...t, Ua(e), Da(e)]);
2629
2777
  }
2630
- function ma(e) {
2631
- return typeof e?.count == "number" ? e.count : pa;
2778
+ function Ua(e) {
2779
+ return typeof e?.count == "number" ? e.count : Pa;
2632
2780
  }
2633
- function ha(e) {
2781
+ function Da(e) {
2634
2782
  return Array.isArray(e?.include) ? [...new Set(e.include)].sort() : [];
2635
2783
  }
2636
- function _(e) {
2784
+ function D(e) {
2637
2785
  if (typeof e != "string") return null;
2638
- const t = ut(e);
2786
+ const t = At(e);
2639
2787
  return t === "" ? null : t;
2640
2788
  }
2641
- const Ia = [
2642
- pt({
2643
- key: fa,
2644
- warn: ua
2789
+ const Wa = [
2790
+ Et({
2791
+ key: Na,
2792
+ warn: qa
2645
2793
  })
2646
- ], wa = {
2794
+ ], La = {
2647
2795
  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 = [
2796
+ definition: Sa,
2797
+ guards: Wa,
2798
+ createExecutor: (e) => Oa(e.store)
2799
+ }, Ma = "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 }`.", ja = [
2652
2800
  "clientCredentials",
2653
2801
  "clientCredentialsWithJwtAssertion",
2654
2802
  "authorizationCode",
2655
2803
  "authorizationCodeWithPkce",
2656
2804
  "implicit",
2657
2805
  "password"
2658
- ], ga = {
2659
- grantType: T(va).optional().describe("OAuth2 grant type."),
2806
+ ], Ba = {
2807
+ grantType: E(ja).optional().describe("OAuth2 grant type."),
2660
2808
  clientId: i().optional(),
2661
2809
  clientSecret: i().optional(),
2662
2810
  tokenUrl: i().optional(),
@@ -2665,65 +2813,65 @@ const Ia = [
2665
2813
  accessToken: i().optional(),
2666
2814
  username: i().optional().describe("For password grant type."),
2667
2815
  password: i().optional().describe("For password grant type.")
2668
- }, ba = p({
2816
+ }, Fa = p({
2669
2817
  username: i().optional(),
2670
2818
  password: i().optional()
2671
- }).strict(), ka = p({
2819
+ }).strict(), Ya = p({
2672
2820
  username: i().optional(),
2673
2821
  password: i().optional()
2674
- }).strict(), Sa = p({
2822
+ }).strict(), za = p({
2675
2823
  token: i().optional()
2676
- }).strict(), Ta = p({
2677
- location: T(["header", "query", "cookie"]).optional(),
2824
+ }).strict(), Ha = p({
2825
+ location: E(["header", "query", "cookie"]).optional(),
2678
2826
  name: i().optional().describe(
2679
2827
  "Must match the OpenAPI security scheme `name` (header/query/cookie parameter name). Not the scheme component ref id (e.g. UserCookie)."
2680
2828
  ),
2681
2829
  key: i().optional().describe(
2682
2830
  "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
2831
  )
2684
- }).strict(), bt = p({
2685
- ...ga
2686
- }).strict(), Ca = bt.extend({
2832
+ }).strict(), Dt = p({
2833
+ ...Ba
2834
+ }).strict(), Ga = Dt.extend({
2687
2835
  openIdConnectUrl: i().optional(),
2688
2836
  userInfoUrl: i().optional()
2689
- }).strict(), kt = i().optional().describe(
2837
+ }).strict(), Wt = i().optional().describe(
2690
2838
  "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"]),
2839
+ ), B = Pn.extend({
2840
+ action: E(["add", "update"]),
2693
2841
  schemeId: i().optional(),
2694
- stepId: kt
2695
- }), Oa = oe("type", [
2696
- N.extend({
2697
- type: I(g.BasicAuth),
2698
- data: ba.optional()
2842
+ stepId: Wt
2843
+ }), Va = me("type", [
2844
+ B.extend({
2845
+ type: w(k.BasicAuth),
2846
+ data: Fa.optional()
2699
2847
  }).strict(),
2700
- N.extend({
2701
- type: I(g.DigestAuth),
2702
- data: ka.optional()
2848
+ B.extend({
2849
+ type: w(k.DigestAuth),
2850
+ data: Ya.optional()
2703
2851
  }).strict(),
2704
- N.extend({
2705
- type: I(g.JWT),
2706
- data: Sa.optional()
2852
+ B.extend({
2853
+ type: w(k.JWT),
2854
+ data: za.optional()
2707
2855
  }).strict(),
2708
- N.extend({
2709
- type: I(g.APIKey),
2710
- data: Ta.optional()
2856
+ B.extend({
2857
+ type: w(k.APIKey),
2858
+ data: Ha.optional()
2711
2859
  }).strict(),
2712
- N.extend({
2713
- type: I(g.OAuth2),
2714
- data: bt.optional()
2860
+ B.extend({
2861
+ type: w(k.OAuth2),
2862
+ data: Dt.optional()
2715
2863
  }).strict(),
2716
- N.extend({
2717
- type: I(g.OpenIDConnect),
2718
- data: Ca.optional()
2864
+ B.extend({
2865
+ type: w(k.OpenIDConnect),
2866
+ data: Ga.optional()
2719
2867
  }).strict()
2720
- ]), Aa = ye.extend({
2721
- action: I("remove"),
2722
- index: S().int().min(0).describe(
2868
+ ]), Ka = qe.extend({
2869
+ action: w("remove"),
2870
+ index: A().int().min(0).describe(
2723
2871
  "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
2872
  ),
2725
- stepId: kt
2726
- }).strict(), xa = we([Oa, Aa]), Ea = p({
2873
+ stepId: Wt
2874
+ }).strict(), Ja = Re([Va, Ka]), Qa = p({
2727
2875
  collectionId: i().describe(
2728
2876
  "Saved step: collection id. Unsaved draft tab on focus: empty string (with empty workflowId and stepId)."
2729
2877
  ),
@@ -2733,31 +2881,31 @@ const Ia = [
2733
2881
  stepId: i().describe(
2734
2882
  "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
2883
  ),
2736
- changes: b(xa).min(1).describe("List of security changes to apply.")
2884
+ changes: T(Ja).min(1).describe("List of security changes to apply.")
2737
2885
  }).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);
2886
+ 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
2887
  !(o && n && (r || a)) && !(!o && !n && !r && !l) && t.addIssue({
2740
- code: W.custom,
2888
+ code: H.custom,
2741
2889
  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
2890
  path: ["collectionId"]
2743
2891
  });
2744
- }), $a = ft, _a = {
2745
- description: ya,
2746
- inputSchema: Ea,
2747
- outputSchema: $a,
2892
+ }), Xa = xt, Za = {
2893
+ description: Ma,
2894
+ inputSchema: Qa,
2895
+ outputSchema: Xa,
2748
2896
  needsApproval: () => !0
2749
- }, x = {
2897
+ }, _ = {
2750
2898
  ADD: "add",
2751
2899
  UPDATE: "update",
2752
2900
  REMOVE: "remove"
2753
2901
  };
2754
- function w(e, t) {
2902
+ function y(e, t) {
2755
2903
  return {
2756
2904
  status: e,
2757
2905
  ...t !== void 0 && { summary: t }
2758
2906
  };
2759
2907
  }
2760
- function St(e) {
2908
+ function Lt(e) {
2761
2909
  if (!e || typeof e != "object" || !("meta" in e))
2762
2910
  return {};
2763
2911
  const { meta: t } = e;
@@ -2766,120 +2914,120 @@ function St(e) {
2766
2914
  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
2915
  return { totalChanges: o, approvedChanges: n };
2768
2916
  }
2769
- function Ra(e, t) {
2917
+ function ei(e, t) {
2770
2918
  return !Number.isInteger(t.index) || t.index < 0 || t.index >= e.length ? {
2771
2919
  ok: !1,
2772
2920
  message: `Index ${t.index} out of bounds. Step has ${e.length} security entries.`
2773
2921
  } : { ok: !0, entry: e[t.index] };
2774
2922
  }
2775
- const qa = /* @__PURE__ */ new Set(["grantType", "openIdConnectUrl", "userInfoUrl"]);
2776
- function Pa(e) {
2777
- return e.type === g.OAuth2 || e.type === g.OpenIDConnect;
2923
+ const ti = /* @__PURE__ */ new Set(["grantType", "openIdConnectUrl", "userInfoUrl"]);
2924
+ function oi(e) {
2925
+ return e.type === k.OAuth2 || e.type === k.OpenIDConnect;
2778
2926
  }
2779
- function ze(e, t) {
2927
+ function at(e, t) {
2780
2928
  const o = e;
2781
2929
  for (const [n, r] of Object.entries(t))
2782
2930
  r !== void 0 && n in o && (o[n] = r);
2783
2931
  }
2784
- function He(e, t) {
2932
+ function it(e, t) {
2785
2933
  const o = Object.entries(t);
2786
2934
  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]));
2935
+ s === "grantType" && typeof a == "string" && Be[a] && (e.grantType = Be[a]);
2936
+ const n = e[e.grantType], r = new Set(Object.keys(po[e.grantType]));
2789
2937
  for (const [s, a] of o)
2790
2938
  s !== "grantType" && a !== void 0 && r.has(s) && (n[s] = a);
2791
2939
  }
2792
- function Tt(e) {
2793
- return e.securityType === g.NoAuth ? null : e[e.securityType]?.schemeName ?? null;
2940
+ function Mt(e) {
2941
+ return e.securityType === k.NoAuth ? null : e[e.securityType]?.schemeName ?? null;
2794
2942
  }
2795
- function Na(e, t) {
2796
- !t || e.securityType === g.NoAuth || (e.securitySchemeId = t, e[e.securityType].schemeName = t);
2943
+ function ni(e, t) {
2944
+ !t || e.securityType === k.NoAuth || (e.securitySchemeId = t, e[e.securityType].schemeName = t);
2797
2945
  }
2798
- function ie(e, t) {
2799
- if (e.securityType = t.type, Na(e, t.schemeId), !t.data) return e;
2946
+ function be(e, t) {
2947
+ if (e.securityType = t.type, ni(e, t.schemeId), !t.data) return e;
2800
2948
  switch (t.type) {
2801
- case g.BasicAuth:
2802
- case g.DigestAuth:
2803
- case g.JWT:
2804
- ze(e[t.type], t.data);
2949
+ case k.BasicAuth:
2950
+ case k.DigestAuth:
2951
+ case k.JWT:
2952
+ at(e[t.type], t.data);
2805
2953
  break;
2806
- case g.APIKey: {
2954
+ case k.APIKey: {
2807
2955
  const { location: o, ...n } = t.data;
2808
- ze(e[g.APIKey], n), o && (e[g.APIKey].location = Yt(o));
2956
+ at(e[k.APIKey], n), o && (e[k.APIKey].location = uo(o));
2809
2957
  break;
2810
2958
  }
2811
- case g.OAuth2:
2812
- He(e[g.OAuth2], t.data);
2959
+ case k.OAuth2:
2960
+ it(e[k.OAuth2], t.data);
2813
2961
  break;
2814
- case g.OpenIDConnect: {
2962
+ case k.OpenIDConnect: {
2815
2963
  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);
2964
+ it(e[k.OpenIDConnect], r), o !== void 0 && (e[k.OpenIDConnect].openIdConnectUrl = o), n !== void 0 && (e[k.OpenIDConnect].userInfoUrl = n);
2817
2965
  break;
2818
2966
  }
2819
2967
  }
2820
2968
  return e;
2821
2969
  }
2822
- function Ua(e, t) {
2970
+ function ri(e, t) {
2823
2971
  return t.schemeId ? e.findIndex(
2824
- (o) => o.securitySchemeId === t.schemeId || Tt(o) === t.schemeId
2972
+ (o) => o.securitySchemeId === t.schemeId || Mt(o) === t.schemeId
2825
2973
  ) : e.findIndex((o) => o.securityType === t.type);
2826
2974
  }
2827
- function Da(e) {
2975
+ function si(e) {
2828
2976
  return e.data ? Object.entries(e.data).some(
2829
- ([t, o]) => o !== void 0 && !qa.has(t)
2977
+ ([t, o]) => o !== void 0 && !ti.has(t)
2830
2978
  ) : !1;
2831
2979
  }
2832
- function La(e) {
2980
+ function ai(e) {
2833
2981
  return e.schemeId ? `${e.type} (scheme '${e.schemeId}')` : e.type;
2834
2982
  }
2835
- function Ge(e, t, o, n) {
2983
+ function ct(e, t, o, n) {
2836
2984
  return e.has(t) ? {
2837
2985
  ok: !1,
2838
2986
  message: `The security entry at index ${o} is targeted by both a mutation and a remove${n}; issue only one action for it.`
2839
2987
  } : null;
2840
2988
  }
2841
- function Wa(e, t, o) {
2989
+ function ii(e, t, o) {
2842
2990
  let n = e;
2843
2991
  const r = [], s = t.filter(
2844
- (c) => c.action !== x.REMOVE
2992
+ (c) => c.action !== _.REMOVE
2845
2993
  ), a = t.filter(
2846
- (c) => c.action === x.REMOVE
2994
+ (c) => c.action === _.REMOVE
2847
2995
  ), l = /* @__PURE__ */ new Set();
2848
2996
  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);
2997
+ const d = ei(e, c);
2998
+ if (!d.ok) return { ok: !1, message: d.message };
2999
+ l.add(d.entry);
2852
3000
  }
2853
3001
  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;
3002
+ if (c.action === _.ADD) {
3003
+ const f = n.length === 1 && n[0].securityType === k.NoAuth, m = f ? -1 : ri(n, c);
3004
+ if (m >= 0) {
3005
+ const v = n[m], I = ct(l, v, m, o);
3006
+ if (I) return I;
2859
3007
  if (v.securityType !== c.type)
2860
3008
  return {
2861
3009
  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.`
3010
+ 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
3011
  };
2864
- n = [...n], n[f] = ie(
3012
+ n = [...n], n[m] = be(
2865
3013
  structuredClone(v),
2866
3014
  c
2867
3015
  ), r.push(
2868
- w(
3016
+ y(
2869
3017
  "applied",
2870
- `Updated existing ${La(c)} in place (index: ${f})${o}`
3018
+ `Updated existing ${ai(c)} in place (index: ${m})${o}`
2871
3019
  )
2872
3020
  );
2873
3021
  continue;
2874
3022
  }
2875
- if (Pa(c) && Da(c) && !c.data?.grantType)
3023
+ if (oi(c) && si(c) && !c.data?.grantType)
2876
3024
  return {
2877
3025
  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.`
3026
+ 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
3027
  };
2880
- const y = ie(Oe(), c);
2881
- n = m ? [y] : [...n, y], r.push(
2882
- w(
3028
+ const g = be(je(), c);
3029
+ n = f ? [g] : [...n, g], r.push(
3030
+ y(
2883
3031
  "applied",
2884
3032
  `Added ${c.type} security (index: ${n.length - 1})${o}`
2885
3033
  )
@@ -2893,50 +3041,48 @@ function Wa(e, t, o) {
2893
3041
  ok: !1,
2894
3042
  message: `Index ${c.index} out of bounds. Step has ${n.length} security entries.`
2895
3043
  };
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)
3044
+ const d = n[c.index], u = ct(l, d, c.index, o);
3045
+ if (u) return u;
3046
+ if (d.securitySchemeId) {
3047
+ const f = Mt(d);
3048
+ if (c.schemeId && f !== c.schemeId)
2901
3049
  return {
2902
3050
  ok: !1,
2903
- message: `schemeId mismatch at index ${c.index}. Expected ${m ?? "none"}.`
3051
+ message: `schemeId mismatch at index ${c.index}. Expected ${f ?? "none"}.`
2904
3052
  };
2905
3053
  }
2906
- n = [...n], n[c.index] = ie(structuredClone(u), c), r.push(
2907
- w("applied", `Updated ${c.type} at index ${c.index}${o}`)
3054
+ n = [...n], n[c.index] = be(structuredClone(d), c), r.push(
3055
+ y("applied", `Updated ${c.type} at index ${c.index}${o}`)
2908
3056
  );
2909
3057
  }
2910
3058
  if (l.size > 0) {
2911
- const c = n.filter((d) => !l.has(d)), u = n.length - c.length;
3059
+ const c = n.filter((u) => !l.has(u)), d = n.length - c.length;
2912
3060
  n = c;
2913
- for (let d = 0; d < u; d++)
2914
- r.push(w("applied"));
3061
+ for (let u = 0; u < d; u++)
3062
+ r.push(y("applied"));
2915
3063
  }
2916
- return n.length === 0 && (n = [Oe()]), { ok: !0, security: n, applied: r };
3064
+ return n.length === 0 && (n = [je()]), { ok: !0, security: n, applied: r };
2917
3065
  }
2918
- function Ma(e) {
3066
+ function ci(e) {
2919
3067
  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]);
3068
+ const { changes: o, collectionId: n, workflowId: r, stepId: s } = t, a = Lt(t), l = s.trim(), c = /* @__PURE__ */ new Map();
3069
+ for (const m of o) {
3070
+ const g = m.stepId?.trim() || l, v = c.get(g);
3071
+ v ? v.push(m) : c.set(g, [m]);
2924
3072
  }
2925
- const u = [], d = [];
2926
- for (const [f, y] of c) {
2927
- const v = gt(e, n, r, f);
3073
+ const d = [], u = [];
3074
+ for (const [m, g] of c) {
3075
+ const v = Ut(e, n, r, m);
2928
3076
  if (!v.ok)
2929
3077
  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 });
3078
+ const { readStep: I, updateStep: O } = v.value, S = m || v.value.step.stepId, P = c.size > 1 ? ` for step '${S}'` : "", ve = Array.from(I().security), N = ii(ve, g, P);
3079
+ if (!N.ok) return h(N.message);
3080
+ d.push(...N.applied), u.push({ updateStep: O, security: N.security, label: S });
2935
3081
  }
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(`
3082
+ for (const m of u)
3083
+ m.updateStep((g) => ({ ...g, security: m.security }));
3084
+ const f = u.map((m) => `stepId=${m.label}
3085
+ ${pe(m.security)}`).join(`
2940
3086
 
2941
3087
  `);
2942
3088
  return {
@@ -2944,17 +3090,17 @@ ${ee(f.security)}`).join(`
2944
3090
  data: {
2945
3091
  totalChanges: a.totalChanges ?? o.length,
2946
3092
  approvedChanges: a.approvedChanges ?? o.length,
2947
- applied: u,
2948
- resultingState: m
3093
+ applied: d,
3094
+ resultingState: f
2949
3095
  }
2950
3096
  };
2951
3097
  };
2952
3098
  }
2953
- const Fa = {
3099
+ const li = {
2954
3100
  name: "update_security",
2955
- definition: _a,
2956
- createExecutor: (e) => Ma(e.store)
2957
- }, ja = `Update an existing Replay step with atomic changes.
3101
+ definition: Za,
3102
+ createExecutor: (e) => ci(e.store)
3103
+ }, di = `Update an existing Replay step with atomic changes.
2958
3104
 
2959
3105
  **What it does**
2960
3106
  - Mutates an existing step only (no create/delete).
@@ -2977,7 +3123,7 @@ const Fa = {
2977
3123
  - Data shapes:
2978
3124
  - \`url\`: string
2979
3125
  - \`description\`: string
2980
- - \`method\`: one of ${et.join(", ")}
3126
+ - \`method\`: one of ${ht.join(", ")}
2981
3127
  - \`parameters\`: \`{ name, in: path|query|header|cookie, value }\`
2982
3128
  - \`outputs\`: \`{ name, expression }\`
2983
3129
  - \`successCriteria\`: \`{ condition, context?, type? }\`
@@ -2988,58 +3134,58 @@ const Fa = {
2988
3134
  - Batch related edits in one call; include all known edits up front.
2989
3135
  - For OpenAPI-linked steps, avoid method/url changes.
2990
3136
  - 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({
3137
+ `, ui = ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"], pi = [
3138
+ Y.Text,
3139
+ Y.JSON,
3140
+ Y.XML
3141
+ ], fi = p({
2996
3142
  name: i().min(1),
2997
- in: T(["path", "query", "header", "cookie"]),
3143
+ in: E(["path", "query", "header", "cookie"]),
2998
3144
  value: i()
2999
- }).strict(), Ha = p({
3145
+ }).strict(), mi = p({
3000
3146
  condition: i().min(1),
3001
3147
  context: i().optional().describe("Context for the expression."),
3002
- type: T(["simple", "regex", "jsonpath", "xpath"]).optional()
3003
- }).strict(), Ga = R.extend({
3004
- field: I("url"),
3148
+ type: E(["simple", "regex", "jsonpath", "xpath"]).optional()
3149
+ }).strict(), hi = L.extend({
3150
+ field: w("url"),
3005
3151
  data: i().min(1).describe("New request URL for step.")
3006
- }).strict(), Va = R.extend({
3007
- field: I("description"),
3152
+ }).strict(), wi = L.extend({
3153
+ field: w("description"),
3008
3154
  data: i().describe("New step description text.")
3009
- }).strict(), Ka = R.extend({
3010
- field: I("method"),
3011
- data: T(Ba).describe("New HTTP method for x-operation step.")
3012
- }).strict(), Ja = R.extend({
3013
- field: I("parameters"),
3014
- data: za.optional().describe("Parameter data. Required for add/update actions.")
3015
- }).strict(), Qa = R.extend({
3016
- field: I("outputs"),
3155
+ }).strict(), Ii = L.extend({
3156
+ field: w("method"),
3157
+ data: E(ui).describe("New HTTP method for x-operation step.")
3158
+ }).strict(), yi = L.extend({
3159
+ field: w("parameters"),
3160
+ data: fi.optional().describe("Parameter data. Required for add/update actions.")
3161
+ }).strict(), vi = L.extend({
3162
+ field: w("outputs"),
3017
3163
  data: p({
3018
3164
  name: i().min(1).describe("Output name."),
3019
3165
  expression: i().min(1).describe("Output expression.")
3020
3166
  }).strict().optional().describe("Output mapping. Required for add/update actions.")
3021
- }).strict(), Xa = R.extend({
3022
- field: I("successCriteria"),
3023
- data: Ha.optional().describe(
3167
+ }).strict(), gi = L.extend({
3168
+ field: w("successCriteria"),
3169
+ data: mi.optional().describe(
3024
3170
  "Success criterion. Required for add/update actions."
3025
3171
  )
3026
- }).strict(), Za = R.extend({
3027
- field: I("body"),
3172
+ }).strict(), bi = L.extend({
3173
+ field: w("body"),
3028
3174
  data: p({
3029
- contentType: T(Ya).optional().describe(
3175
+ contentType: E(pi).optional().describe(
3030
3176
  "Request body content type. Allowed: text/plain, application/json, application/xml."
3031
3177
  ),
3032
3178
  content: i().describe("Request body content as string.")
3033
3179
  }).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({
3180
+ }).strict(), ki = me("field", [
3181
+ hi,
3182
+ wi,
3183
+ Ii,
3184
+ yi,
3185
+ vi,
3186
+ gi,
3187
+ bi
3188
+ ]), Si = p({
3043
3189
  collectionId: i().describe(
3044
3190
  "Saved step: collection id. Unsaved draft tab on focus: empty string (with empty workflowId and stepId)."
3045
3191
  ),
@@ -3049,260 +3195,283 @@ const Fa = {
3049
3195
  stepId: i().describe(
3050
3196
  "Saved step: step id. Unsaved draft tab: empty string (with empty collectionId and workflowId)."
3051
3197
  ),
3052
- changes: b(ei).min(1).describe("List of individual changes to apply to the step.")
3198
+ changes: T(ki).min(1).describe("List of individual changes to apply to the step.")
3053
3199
  }).strict().superRefine((e, t) => {
3054
3200
  const o = e.collectionId.trim(), n = e.workflowId.trim(), r = e.stepId.trim();
3055
3201
  !(o && n && r) && !(!o && !n && !r) && t.addIssue({
3056
- code: W.custom,
3202
+ code: H.custom,
3057
3203
  message: "Provide all three ids for a saved step, or three empty strings for the focused unsaved request tab.",
3058
3204
  path: ["collectionId"]
3059
3205
  });
3060
- }), oi = ft, ni = {
3061
- description: ja,
3062
- inputSchema: ti,
3063
- outputSchema: oi,
3206
+ }), Ti = xt, Ci = {
3207
+ description: di,
3208
+ inputSchema: Si,
3209
+ outputSchema: Ti,
3064
3210
  needsApproval: () => !0
3065
3211
  };
3066
- function ri(e) {
3212
+ function Oi(e) {
3067
3213
  return e.replace(/\{\{([^{}\s]+)\}\}/g, "{$1}");
3068
3214
  }
3069
- function ce(e) {
3070
- return G[e];
3215
+ function ke(e) {
3216
+ return re[e];
3071
3217
  }
3072
- function le(e, t) {
3218
+ function Se(e, t) {
3073
3219
  return e.id === t;
3074
3220
  }
3075
- function Ve(e, t) {
3221
+ function lt(e, t) {
3076
3222
  return e.condition === t;
3077
3223
  }
3078
- function de(e, t) {
3079
- return pe(e) && e.id === t;
3224
+ function Te(e, t) {
3225
+ return Ae(e) && e.id === t;
3080
3226
  }
3081
- function Ke(e, t, o) {
3082
- return { ...Qe(e), key: t, value: o, active: !0 };
3227
+ function dt(e, t, o) {
3228
+ return { ...ft(e), key: t, value: o, active: !0 };
3083
3229
  }
3084
- function be(e, t) {
3085
- e.set((o) => [...o, ...t]);
3230
+ function Ue(e, t) {
3231
+ e((o) => [...o, ...t]);
3086
3232
  }
3087
- function Q(e, t, o) {
3233
+ function ce(e, t, o) {
3088
3234
  let n = !1;
3089
- return e.set((r) => {
3235
+ return e((r) => {
3090
3236
  const s = r.findIndex((l) => o.find(l, t));
3091
3237
  if (s < 0) return r;
3092
3238
  const a = [...r];
3093
3239
  return a[s] = o.produce(r[s]), n = !0, a;
3094
3240
  }), n;
3095
3241
  }
3096
- function ke(e, t, o) {
3242
+ function De(e, t, o) {
3097
3243
  let n = !1;
3098
- return e.set((r) => {
3244
+ return e((r) => {
3099
3245
  const s = r.filter((a) => !o(a, t));
3100
3246
  return n = s.length < r.length, s;
3101
3247
  }), n;
3102
3248
  }
3103
- function si(e, t) {
3249
+ function Ai(e, { readStep: t, updateParameters: o }) {
3104
3250
  switch (e.action) {
3105
- case x.ADD: {
3251
+ case _.ADD: {
3106
3252
  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(
3253
+ return y("failed", "Failed parameter add because data is missing.");
3254
+ const { in: n, name: r, value: s } = e.data, a = ke(n), l = dt(n, r, s);
3255
+ return Ue(o(a), [l]), y(
3110
3256
  "applied",
3111
- `Added ${o} parameter '${n}' (id: ${a.id})`
3257
+ `Added ${n} parameter '${r}' (id: ${l.id})`
3112
3258
  );
3113
3259
  }
3114
- case x.UPDATE: {
3260
+ case _.UPDATE: {
3115
3261
  if (!e.id)
3116
- return w("failed", "Failed parameter update because id is missing.");
3262
+ return y("failed", "Failed parameter update because id is missing.");
3117
3263
  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.`);
3264
+ return y("failed", "Failed parameter update because data is missing.");
3265
+ const { in: n, name: r, value: s } = e.data, a = ke(n);
3266
+ return ce(o(a), e.id, {
3267
+ find: Te,
3268
+ produce: (c) => Ae(c) ? {
3269
+ ...dt(n, r, s),
3270
+ id: c.id,
3271
+ ...c.allowReserved !== void 0 && { allowReserved: c.allowReserved }
3272
+ } : c
3273
+ }) ? y("applied") : y("failed", `Parameter with id '${e.id}' not found.`);
3128
3274
  }
3129
- case x.REMOVE: {
3275
+ case _.REMOVE: {
3130
3276
  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);
3277
+ return y("failed", "Failed parameter remove because id is missing.");
3278
+ const n = e.id, r = e.data?.in, s = r ? [ke(r)] : Object.values(re);
3279
+ let a = !1;
3280
+ for (const l of s)
3281
+ if (t().parameters[l].some((d) => Te(d, n))) {
3282
+ a = De(o(l), n, Te);
3137
3283
  break;
3138
3284
  }
3139
- return s ? w("applied") : w("failed", `Parameter with id '${o}' not found.`);
3285
+ return a ? y("applied") : y("failed", `Parameter with id '${n}' not found.`);
3140
3286
  }
3141
3287
  }
3142
3288
  }
3143
- function ai(e, t) {
3289
+ function Ei(e, { readStep: t, updateOutputs: o }) {
3144
3290
  switch (e.action) {
3145
- case x.ADD: {
3291
+ case _.ADD: {
3146
3292
  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(
3293
+ return y("failed", "Failed output add because data is missing.");
3294
+ const { name: n, expression: r } = e.data, s = t().outputs.find((l) => l.key === n);
3295
+ if (s)
3296
+ return ce(o, s.id, {
3297
+ find: Se,
3298
+ produce: (l) => ({ ...l, key: n, value: r, active: !0 })
3299
+ }), y(
3154
3300
  "applied",
3155
- `Updated existing output '${o}' in place (id: ${r.id})`
3301
+ `Updated existing output '${n}' in place (id: ${s.id})`
3156
3302
  );
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})`);
3303
+ const a = crypto.randomUUID();
3304
+ return Ue(o, [{ id: a, key: n, value: r, active: !0 }]), y("applied", `Added output '${n}' (id: ${a})`);
3159
3305
  }
3160
- case x.UPDATE: {
3306
+ case _.UPDATE: {
3161
3307
  if (!e.id)
3162
- return w("failed", "Failed output update because id is missing.");
3308
+ return y("failed", "Failed output update because id is missing.");
3163
3309
  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.`);
3310
+ return y("failed", "Failed output update because data is missing.");
3311
+ const { name: n, expression: r } = e.data;
3312
+ return ce(o, e.id, {
3313
+ find: Se,
3314
+ produce: (a) => ({ ...a, key: n, value: r, active: !0 })
3315
+ }) ? y("applied") : y("failed", `Output with id '${e.id}' not found.`);
3170
3316
  }
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.");
3317
+ case _.REMOVE:
3318
+ return e.id ? De(o, e.id, Se) ? y("applied") : y("failed", `Output with id '${e.id}' not found.`) : y("failed", "Failed output remove because id is missing.");
3173
3319
  }
3174
3320
  }
3175
- function ii(e, t) {
3321
+ function xi(e, { updateSuccessCriteria: t }) {
3176
3322
  switch (e.action) {
3177
- case x.ADD: {
3323
+ case _.ADD: {
3178
3324
  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
3325
+ return y("failed", "Failed success criteria add because data is missing.");
3326
+ const { condition: o, context: n, type: r } = e.data, s = pt(
3327
+ r ?? Ce.SIMPLE
3182
3328
  );
3183
- return be(t.successCriteria, [
3329
+ return Ue(t, [
3184
3330
  {
3185
3331
  ...s,
3186
3332
  condition: o,
3187
3333
  ...n !== void 0 && { context: n }
3188
3334
  }
3189
- ]), w("applied");
3335
+ ]), y("applied");
3190
3336
  }
3191
- case x.UPDATE: {
3337
+ case _.UPDATE: {
3192
3338
  if (typeof e.id != "string")
3193
- return w(
3339
+ return y(
3194
3340
  "failed",
3195
3341
  "Failed success criteria update because id is missing."
3196
3342
  );
3197
3343
  if (!e.data)
3198
- return w(
3344
+ return y(
3199
3345
  "failed",
3200
3346
  "Failed success criteria update because data is missing."
3201
3347
  );
3202
3348
  const { condition: o, context: n, type: r } = e.data;
3203
- return Q(t.successCriteria, e.id, {
3204
- find: Ve,
3349
+ return ce(t, e.id, {
3350
+ find: lt,
3205
3351
  produce: (a) => ({
3206
3352
  ...a,
3207
3353
  id: a.id || crypto.randomUUID(),
3208
3354
  condition: o,
3209
3355
  context: n ?? a.context,
3210
- type: r ?? a.type ?? ue.SIMPLE
3356
+ type: r ?? a.type ?? Ce.SIMPLE
3211
3357
  })
3212
- }) ? w("applied") : w(
3358
+ }) ? y("applied") : y(
3213
3359
  "failed",
3214
3360
  `Success criterion with condition '${e.id}' not found.`
3215
3361
  );
3216
3362
  }
3217
- case x.REMOVE:
3218
- return typeof e.id != "string" ? w(
3363
+ case _.REMOVE:
3364
+ return typeof e.id != "string" ? y(
3219
3365
  "failed",
3220
3366
  "Failed success criteria remove because id is missing."
3221
- ) : ke(
3222
- t.successCriteria,
3367
+ ) : De(
3368
+ t,
3223
3369
  e.id,
3224
- Ve
3225
- ) ? w("applied") : w(
3370
+ lt
3371
+ ) ? y("applied") : y(
3226
3372
  "failed",
3227
3373
  `Success criterion with condition '${e.id}' not found.`
3228
3374
  );
3229
3375
  }
3230
3376
  }
3231
- function ci(e) {
3377
+ const ut = { method: "GET", url: "" };
3378
+ function $i(e) {
3232
3379
  return async (t) => {
3233
- const { changes: o, collectionId: n, workflowId: r, stepId: s } = t, a = St(t), l = gt(e, n, r, s);
3380
+ const { changes: o, collectionId: n, workflowId: r, stepId: s } = t, a = Lt(t), l = Ut(e, n, r, s);
3234
3381
  if (!l.ok)
3235
3382
  return h(l.message, l.details);
3236
- const c = l.value;
3383
+ const { step: c, readStep: d, updateStep: u } = l.value, f = {
3384
+ readStep: d,
3385
+ updateParameters: (I) => (O) => u((S) => ({
3386
+ ...S,
3387
+ parameters: { ...S.parameters, [I]: O(S.parameters[I]) }
3388
+ })),
3389
+ updateOutputs: (I) => u((O) => ({ ...O, outputs: I(O.outputs) })),
3390
+ updateSuccessCriteria: (I) => u((O) => ({
3391
+ ...O,
3392
+ successCriteria: I(O.successCriteria)
3393
+ }))
3394
+ };
3237
3395
  if (o.some(
3238
- (f) => f.field === "method" || f.field === "url"
3239
- ) && c.operation.ornull !== null)
3396
+ (I) => I.field === "method" || I.field === "url"
3397
+ ) && c.operation !== null)
3240
3398
  return h(
3241
3399
  "Cannot update method or url for a step linked to an OpenAPI operation."
3242
3400
  );
3243
- const d = [];
3244
- for (const f of o)
3245
- switch (f.field) {
3401
+ const g = [];
3402
+ for (const I of o)
3403
+ switch (I.field) {
3246
3404
  case "method":
3247
3405
  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
- );
3406
+ if (I.field === "method") {
3407
+ const O = I.data;
3408
+ u((S) => ({
3409
+ ...S,
3410
+ xOperation: { ...S.xOperation ?? ut, method: O }
3411
+ }));
3412
+ } else {
3413
+ const O = Oi(I.data);
3414
+ u((S) => ({
3415
+ ...S,
3416
+ xOperation: { ...S.xOperation ?? ut, url: O },
3417
+ parameters: {
3418
+ ...S.parameters,
3419
+ queryParameters: fo(
3420
+ mo(O),
3421
+ S.parameters.queryParameters
3422
+ )
3423
+ }
3424
+ }));
3264
3425
  }
3265
- d.push(w("applied"));
3426
+ g.push(y("applied"));
3266
3427
  break;
3267
3428
  }
3268
- case "description":
3269
- c.description.set(f.data), d.push(w("applied"));
3429
+ case "description": {
3430
+ const O = I.data;
3431
+ u((S) => ({ ...S, description: O })), g.push(y("applied"));
3270
3432
  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"));
3433
+ }
3434
+ case "body": {
3435
+ const { content: O, contentType: S } = I.data;
3436
+ u((P) => ({
3437
+ ...P,
3438
+ requestBody: {
3439
+ ...P.requestBody,
3440
+ content: O,
3441
+ ...S !== void 0 && { type: S }
3442
+ }
3443
+ })), g.push(y("applied"));
3276
3444
  break;
3445
+ }
3277
3446
  case "parameters":
3278
- d.push(si(f, c));
3447
+ g.push(Ai(I, f));
3279
3448
  break;
3280
3449
  case "outputs":
3281
- d.push(ai(f, c));
3450
+ g.push(Ei(I, f));
3282
3451
  break;
3283
3452
  case "successCriteria":
3284
- d.push(ii(f, c));
3453
+ g.push(xi(I, f));
3285
3454
  break;
3286
3455
  }
3287
- const m = o.some((f) => f.field === "outputs");
3456
+ const v = o.some((I) => I.field === "outputs");
3288
3457
  return {
3289
3458
  isError: !1,
3290
3459
  data: {
3291
3460
  totalChanges: a.totalChanges ?? o.length,
3292
3461
  approvedChanges: a.approvedChanges ?? o.length,
3293
- applied: d,
3294
- ...m && {
3295
- resultingState: Ie(c.outputs.get({ noproxy: !0 })) || "Outputs: (none)"
3462
+ applied: g,
3463
+ ...v && {
3464
+ resultingState: _e(d().outputs) || "Outputs: (none)"
3296
3465
  }
3297
3466
  }
3298
3467
  };
3299
3468
  };
3300
3469
  }
3301
- const li = {
3470
+ const _i = {
3302
3471
  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.
3472
+ definition: Ci,
3473
+ createExecutor: (e) => $i(e.store)
3474
+ }, Ri = `Search the public web via a nested agent and return a consolidated summary.
3306
3475
 
3307
3476
  **What it does**
3308
3477
  - Runs provider web search (results depend on the active model provider) and synthesizes findings for the parent agent.
@@ -3319,21 +3488,21 @@ const li = {
3319
3488
 
3320
3489
  **Input guidance**
3321
3490
  - 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({
3491
+ - Prefer one web search call per distinct lookup; do not nest web search calls.`, qi = p({
3323
3492
  task: i().describe("What to search for on the web and what to return"),
3324
3493
  url: i().describe("The URL to execute search on")
3325
- }), pi = te(), fi = {
3326
- description: di,
3327
- inputSchema: ui,
3328
- outputSchema: pi,
3494
+ }), Pi = fe(), Ni = {
3495
+ description: Ri,
3496
+ inputSchema: qi,
3497
+ outputSchema: Pi,
3329
3498
  needsApproval: !0
3330
- }, mi = `
3499
+ }, Ui = `
3331
3500
  You are a web search subagent inside Replay, invoked by the parent agent to complete a single lookup task.
3332
3501
 
3333
3502
  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
3503
 
3335
3504
  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 = `
3505
+ `, Di = `
3337
3506
  - Never hallucinate or invent an answer when the information is not available from the web search.
3338
3507
  - 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
3508
  - 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 +3511,28 @@ You must use the provider web search tool to gather information. You cannot acce
3342
3511
  - Include source URLs for all claims that are material to the parent agent's next steps.
3343
3512
  - Clearly distinguish between verified findings, inferred conclusions, and information that could not be verified.
3344
3513
  - When sources conflict, report the conflict and cite the competing sources rather than selecting a winner without evidence.
3345
- `, Ii = Jt(
3514
+ `, Wi = Io(
3346
3515
  //
3347
- Ee("role", mi),
3348
- Ee("output", hi)
3516
+ Ye("role", Ui),
3517
+ Ye("output", Di)
3349
3518
  );
3350
- function wi() {
3351
- return [Qt(Ii)];
3519
+ function Li() {
3520
+ return [yo(Wi)];
3352
3521
  }
3353
- function yi(e) {
3354
- const t = ho(e), o = oo(e);
3522
+ function Mi(e) {
3523
+ const t = No(e), o = So(e);
3355
3524
  return async (n, r) => {
3356
3525
  try {
3357
3526
  return {
3358
3527
  isError: !1,
3359
3528
  data: {
3360
- message: await no({
3529
+ message: await To({
3361
3530
  model: o,
3362
- system: wi(),
3363
- prompt: vi(n),
3531
+ system: Li(),
3532
+ prompt: ji(n),
3364
3533
  tools: t,
3365
3534
  toolChoice: "required",
3366
- stopWhen: ro("web_search"),
3535
+ stopWhen: Co("web_search"),
3367
3536
  temperature: 0,
3368
3537
  abortSignal: r.abortSignal
3369
3538
  }).text
@@ -3377,8 +3546,8 @@ function yi(e) {
3377
3546
  }
3378
3547
  };
3379
3548
  }
3380
- function vi(e) {
3381
- return k([
3549
+ function ji(e) {
3550
+ return C([
3382
3551
  //
3383
3552
  "[URL]",
3384
3553
  e.url,
@@ -3387,71 +3556,71 @@ function vi(e) {
3387
3556
  e.task
3388
3557
  ]);
3389
3558
  }
3390
- const gi = {
3559
+ const Bi = {
3391
3560
  name: "web_search",
3392
- definition: fi,
3393
- createExecutor: (e) => yi(e.model)
3394
- }, Ct = [
3395
- ks,
3396
- qs,
3397
- js,
3398
- Js,
3399
- wa,
3400
- Fa,
3561
+ definition: Ni,
3562
+ createExecutor: (e) => Mi(e.model)
3563
+ }, jt = [
3564
+ Ys,
3565
+ ta,
3566
+ da,
3567
+ ya,
3568
+ La,
3401
3569
  li,
3402
- On,
3403
- Sr,
3404
- ns,
3405
- gi,
3406
- Gn
3570
+ _i,
3571
+ Hn,
3572
+ Fr,
3573
+ Ss,
3574
+ Bi,
3575
+ fr
3407
3576
  ];
3408
- function bi(e) {
3409
- return Ct.some((t) => t.name === e);
3577
+ function Fi(e) {
3578
+ return jt.some((t) => t.name === e);
3410
3579
  }
3411
- function Wi(e, t) {
3412
- for (const o of Ct)
3580
+ function ic(e, t) {
3581
+ for (const o of jt)
3413
3582
  e.register(
3414
- dn(
3583
+ $n(
3415
3584
  o,
3416
3585
  t[o.name]
3417
3586
  )
3418
3587
  );
3419
3588
  }
3420
- function ki(e) {
3589
+ function Yi(e) {
3421
3590
  const t = e.startsWith("tool-") ? e.slice(5) : e;
3422
- return bi(t) ? t : void 0;
3591
+ return Fi(t) ? t : void 0;
3423
3592
  }
3424
- function Si(e, t) {
3593
+ function zi(e, t) {
3425
3594
  return `${e}::${t}`;
3426
3595
  }
3427
- function Se(e) {
3596
+ function We(e) {
3428
3597
  return typeof e == "object" && e !== null && "type" in e && typeof e.type == "string" && e.type.startsWith("tool-") && "toolCallId" in e;
3429
3598
  }
3430
- function Te(e) {
3599
+ function Le(e) {
3431
3600
  return e.state === "approval-requested" && e.approval?.id != null;
3432
3601
  }
3433
- function Ti(e) {
3602
+ function Hi(e) {
3434
3603
  return e.state === "output-denied" ? !0 : e.state === "output-available" && e.approval != null;
3435
3604
  }
3436
- function Ot(e) {
3437
- return e.parts.some((t) => Se(t) && Te(t));
3605
+ function Bt(e) {
3606
+ return e.parts.some((t) => We(t) && Le(t));
3438
3607
  }
3439
- function Mi(e) {
3440
- return e.some(Ot);
3608
+ function cc(e) {
3609
+ return e.some(Bt);
3441
3610
  }
3442
- function Fi(e) {
3611
+ function lc(e) {
3443
3612
  return e.map(
3444
- (t) => Ot(t) ? { ...t, parts: t.parts.map(Ci) } : t
3613
+ (t) => Bt(t) ? { ...t, parts: t.parts.map(Gi) } : t
3445
3614
  );
3446
3615
  }
3447
- function Ci(e) {
3448
- return !Se(e) || !Te(e) ? e : {
3616
+ function Gi(e) {
3617
+ return !We(e) || !Le(e) ? e : {
3449
3618
  ...e,
3450
3619
  state: "output-denied",
3451
3620
  approval: { id: e.approval.id, approved: !1 }
3452
3621
  };
3453
3622
  }
3454
- function ji(e) {
3623
+ function dc(e) {
3455
3624
  const t = [], o = [];
3456
3625
  let n = 0;
3457
3626
  const r = {}, s = () => {
@@ -3464,8 +3633,8 @@ function ji(e) {
3464
3633
  const c = l.trim();
3465
3634
  if (c.length === 0)
3466
3635
  return;
3467
- const u = o[o.length - 1];
3468
- u?.kind === "action" && u.text === c || o.push({ kind: "action", text: c });
3636
+ const d = o[o.length - 1];
3637
+ d?.kind === "action" && d.text === c || o.push({ kind: "action", text: c });
3469
3638
  };
3470
3639
  for (let l = 0; l < e.length; l++) {
3471
3640
  const c = e[l];
@@ -3473,54 +3642,54 @@ function ji(e) {
3473
3642
  continue;
3474
3643
  if (c.type === "text") {
3475
3644
  s();
3476
- const d = c.text ?? "";
3477
- d.length > 0 && t.push({
3645
+ const u = c.text ?? "";
3646
+ u.length > 0 && t.push({
3478
3647
  kind: "text",
3479
- text: d,
3648
+ text: u,
3480
3649
  key: `text-${l}`,
3481
3650
  workflowRunHistoryIds: Object.fromEntries(
3482
- Object.entries(r).map(([m, f]) => [m, [...f]])
3651
+ Object.entries(r).map(([f, m]) => [f, [...m]])
3483
3652
  )
3484
3653
  });
3485
3654
  continue;
3486
3655
  }
3487
- if (!Se(c))
3656
+ if (!We(c))
3488
3657
  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);
3658
+ const d = Yi(c.type);
3659
+ if (d === Po) {
3660
+ const u = Ki(c);
3661
+ if (u) {
3662
+ const f = zi(u.collectionId, u.workflowId), m = r[f] ??= [];
3663
+ m.includes(u.historyId) || m.push(u.historyId);
3495
3664
  }
3496
3665
  }
3497
- if (u === fo) {
3498
- const d = xi(c.input);
3499
- d && a(d);
3666
+ if (d === qo) {
3667
+ const u = Ji(c.input);
3668
+ u && a(u);
3500
3669
  continue;
3501
3670
  }
3502
- if (Te(c) || Ti(c)) {
3671
+ if (Le(c) || Hi(c)) {
3503
3672
  s(), t.push({ kind: "tool", part: c, key: `tool-${l}` });
3504
3673
  continue;
3505
3674
  }
3506
3675
  }
3507
3676
  return s(), t;
3508
3677
  }
3509
- const Oi = p({
3510
- isError: I(!1),
3678
+ const Vi = p({
3679
+ isError: w(!1),
3511
3680
  data: p({
3512
3681
  collectionId: i().min(1),
3513
3682
  workflowId: i().min(1),
3514
3683
  historyId: i().min(1)
3515
3684
  })
3516
3685
  });
3517
- function Ai(e) {
3686
+ function Ki(e) {
3518
3687
  if (e.state !== "output-available")
3519
3688
  return;
3520
- const t = Oi.safeParse(e.output);
3689
+ const t = Vi.safeParse(e.output);
3521
3690
  return t.success ? t.data.data : void 0;
3522
3691
  }
3523
- function xi(e) {
3692
+ function Ji(e) {
3524
3693
  if (e == null || typeof e != "object")
3525
3694
  return;
3526
3695
  const t = e.message;
@@ -3529,21 +3698,21 @@ function xi(e) {
3529
3698
  const o = t.trim();
3530
3699
  return o.length > 0 ? o : void 0;
3531
3700
  }
3532
- function Bi(e) {
3701
+ function uc(e) {
3533
3702
  return e.filter((t) => t.type === "text").map((t) => t.text ?? "").join("");
3534
3703
  }
3535
- function Yi(e) {
3536
- return po({
3537
- queryKey: st.detail(e ?? ""),
3538
- queryFn: async () => e ? await rt.getInstance().findOne(e) ?? null : null,
3704
+ function pc(e) {
3705
+ return Ro({
3706
+ queryKey: bt.detail(e ?? ""),
3707
+ queryFn: async () => e ? await gt.getInstance().findOne(e) ?? null : null,
3539
3708
  enabled: !!e
3540
3709
  });
3541
3710
  }
3542
- function zi(e) {
3543
- return uo({
3544
- queryKey: st.infiniteHistory(e),
3711
+ function fc(e) {
3712
+ return _o({
3713
+ queryKey: bt.infiniteHistory(e),
3545
3714
  initialPageParam: 0,
3546
- queryFn: async ({ pageParam: t }) => rt.getInstance().findRecentChatsPage({
3715
+ queryFn: async ({ pageParam: t }) => gt.getInstance().findRecentChatsPage({
3547
3716
  offset: t,
3548
3717
  limit: e
3549
3718
  }),
@@ -3551,40 +3720,40 @@ function zi(e) {
3551
3720
  });
3552
3721
  }
3553
3722
  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
3723
+ Rn as A,
3724
+ ac as B,
3725
+ _ as C,
3726
+ Yi as D,
3727
+ Hi as E,
3728
+ dc as F,
3729
+ fc as G,
3730
+ sc as H,
3731
+ re as L,
3732
+ rc as T,
3733
+ Hn as a,
3734
+ Fr as b,
3735
+ li as c,
3736
+ ya as d,
3737
+ da as e,
3738
+ ta as f,
3739
+ fr as g,
3740
+ cc as h,
3741
+ lc as i,
3742
+ uc as j,
3743
+ pc as k,
3744
+ _s as l,
3745
+ Ss as m,
3746
+ Ns as n,
3747
+ Ys as o,
3748
+ Ps as p,
3749
+ zi as q,
3750
+ ic as r,
3751
+ La as s,
3752
+ nc as t,
3753
+ _i as u,
3754
+ We as v,
3755
+ Bi as w,
3756
+ Le as x,
3757
+ ei as y,
3758
+ Rs as z
3590
3759
  };