@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.
- package/dist/{replay-AiChatProvider-BtDAvnSq.js → replay-AiChatProvider-Bj2P_hdU.js} +371 -369
- package/dist/replay-AiChatProvider-GeumgtIo.js +6 -0
- package/dist/{replay-AiChatSqliteDBStorage-CjD_0sid.js → replay-AiChatSqliteDBStorage-0M2Ejnzu.js} +1 -1
- package/dist/{replay-AiChatSqliteDBStorage-DYTBtCdW.js → replay-AiChatSqliteDBStorage-BWJl1qdO.js} +1 -1
- package/dist/{replay-AiPanel-Wn4vI4q5.js → replay-AiPanel-DfOpKMDQ.js} +709 -712
- package/dist/replay-AiPanel-ON_QfwBN.js +742 -0
- package/dist/replay-FileWatcher-04GlEkra.js +360 -0
- package/dist/replay-FileWatcher-B-T0jz_R.js +1 -0
- package/dist/{replay-SemanticSearchService-Dn-s19V3.js → replay-SemanticSearchService-BQgdj2wy.js} +1 -1
- package/dist/{replay-SemanticSearchService-B1_4MZ3a.js → replay-SemanticSearchService-CPIb_cUk.js} +7 -7
- package/dist/{replay-SqliteDBStorage-BqOim0Il.js → replay-SqliteDBStorage-Bt2xXqei.js} +1 -1
- package/dist/{replay-SqliteDBStorage-CRZ9Yx8K.js → replay-SqliteDBStorage-vehgvWXZ.js} +1 -1
- package/dist/{replay-TauriFileSystemAdapter-Bf-9oAkV.js → replay-TauriFileSystemAdapter-D2yxrS6Q.js} +1 -1
- package/dist/{replay-TauriFileSystemAdapter-GrD1Q2jS.js → replay-TauriFileSystemAdapter-YLdtT-Xp.js} +1 -1
- package/dist/{replay-TauriRootStorage-Cnd9-u0R.js → replay-TauriRootStorage-BE6RmQfE.js} +162 -165
- package/dist/replay-TauriRootStorage-DcENVsBJ.js +1 -0
- package/dist/{replay-agent-loop-DcduWdVY.js → replay-agent-loop-CvopOugZ.js} +13 -13
- package/dist/{replay-agent-loop-phR7X6HJ.js → replay-agent-loop-UwDSVh-4.js} +1 -1
- package/dist/{replay-ai-chat-mappers-f7OYwce2.js → replay-ai-chat-mappers-B7fm-v_w.js} +1 -1
- package/dist/{replay-ai-chat-mappers-DMgobD7q.js → replay-ai-chat-mappers-yKBypIXh.js} +1 -1
- package/dist/{replay-create-model-B9_RKhPf.js → replay-create-model-CHahxEJy.js} +3 -3
- package/dist/{replay-create-model-WcGwy1Px.js → replay-create-model-CyBZMAWB.js} +4 -4
- package/dist/{replay-db-BB9biJ4Q.js → replay-db-CifZMdnr.js} +5 -5
- package/dist/{replay-db-DcpyTo8s.js → replay-db-EWL-uAt-.js} +1 -1
- package/dist/{replay-external-resolver-TFD8mr_P.js → replay-external-resolver-D5fSfJEm.js} +1 -1
- package/dist/{replay-external-resolver-CKJWptWf.js → replay-external-resolver-G11iwLVZ.js} +2 -2
- package/dist/{replay-index-DuIF4QBl.js → replay-index-B2NUTBd8.js} +1 -1
- package/dist/{replay-index-DF6wNUHn.js → replay-index-B3MQaIS-.js} +1 -1
- package/dist/replay-index-Coy4kD_x.js +7009 -0
- package/dist/{replay-index-DofofQ3T.js → replay-index-CqRiEj9e.js} +1 -1
- package/dist/{replay-index-D38KWo5d.js → replay-index-D0mbH_TN.js} +1 -1
- package/dist/{replay-index-UbqSETNf.js → replay-index-DDqKE6bs.js} +5 -5
- package/dist/{replay-index-qMSGJKzU.js → replay-index-DrI9ZFwH.js} +2 -2
- package/dist/{replay-index-CFhkrdmJ.js → replay-index-Dx8O3ZoA.js} +62045 -61139
- package/dist/{replay-lint-BaFfhDsl.js → replay-lint-BiOcDIDr.js} +3 -3
- package/dist/{replay-lint-j1iYeM_X.js → replay-lint-CAo2fuiZ.js} +3 -3
- package/dist/{replay-lint-graphql-DXko1yrv.js → replay-lint-graphql-DAa8UNRg.js} +1 -1
- package/dist/{replay-lint-graphql-zL0ESnHi.js → replay-lint-graphql-DzI2rUbR.js} +1 -1
- package/dist/replay-periodic-revalidation-D18ihfUc.js +1 -0
- package/dist/replay-periodic-revalidation-w7mrtjYg.js +22 -0
- package/dist/{replay-resolve-DxQZdksO.js → replay-resolve-CojDRP37.js} +1 -1
- package/dist/{replay-resolve-B-AmJx0p.js → replay-resolve-DgAthAfi.js} +1 -1
- package/dist/{replay-respect-run-BAuRPVQY.js → replay-respect-run-3ukV7LMg.js} +1 -1
- package/dist/{replay-respect-run-CPQGLg0r.js → replay-respect-run-DNvB8rLX.js} +3 -3
- package/dist/replay-tauri-path-DM8PdMK8.js +22 -0
- package/dist/{replay-tauri-path-Cj6Zgicf.js → replay-tauri-path-kr9DtxLs.js} +1 -1
- package/dist/{replay-useAiChatQueries-pptRWb9k.js → replay-useAiChatQueries-BULoKr4E.js} +1564 -1395
- package/dist/replay-useAiChatQueries-BdjsFz1P.js +215 -0
- package/dist/{replay-validate-key-D4j7fXFM.js → replay-validate-key-CGmguj5X.js} +1 -1
- package/dist/{replay-validate-key-DjGy6Q75.js → replay-validate-key-DzseOR5a.js} +2 -2
- package/dist/replay.cjs +1 -1
- package/dist/replay.d.ts +3 -3
- package/dist/replay.js +10 -10
- package/package.json +3 -5
- package/dist/replay-AiChatProvider-DiHC9TUm.js +0 -6
- package/dist/replay-AiPanel-CFbxD8SJ.js +0 -742
- package/dist/replay-FileWatcher-Boh7I024.js +0 -352
- package/dist/replay-FileWatcher-Cq4DUrxe.js +0 -1
- package/dist/replay-TauriRootStorage-BkPcSPgu.js +0 -1
- package/dist/replay-index-PZuRF5JU.js +0 -6982
- package/dist/replay-periodic-revalidation-BoyLQHtg.js +0 -1
- package/dist/replay-periodic-revalidation-Dsp-n7ui.js +0 -21
- package/dist/replay-tauri-path-D82YK1cm.js +0 -22
- package/dist/replay-useAiChatQueries-CH48wBvJ.js +0 -215
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { useContext as
|
|
2
|
-
import {
|
|
3
|
-
import { b as
|
|
4
|
-
import { b as
|
|
5
|
-
import { g as
|
|
6
|
-
import { useInfiniteQuery as
|
|
7
|
-
const
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
40
|
+
}, sc = {
|
|
41
41
|
CHAT: "chat",
|
|
42
42
|
HISTORY: "history"
|
|
43
|
-
},
|
|
43
|
+
}, qo = "report_status", Po = "run_workflow", oe = {
|
|
44
44
|
WEB_SEARCH: "web_search"
|
|
45
45
|
};
|
|
46
|
-
function
|
|
46
|
+
function No(e) {
|
|
47
47
|
switch (e.provider) {
|
|
48
|
-
case
|
|
48
|
+
case ge.GEMINI:
|
|
49
49
|
return {
|
|
50
|
-
[
|
|
50
|
+
[oe.WEB_SEARCH]: bo.tools.googleSearch({})
|
|
51
51
|
};
|
|
52
|
-
case
|
|
52
|
+
case ge.OPENAI:
|
|
53
53
|
return {
|
|
54
|
-
[
|
|
54
|
+
[oe.WEB_SEARCH]: go.tools.webSearch({})
|
|
55
55
|
};
|
|
56
|
-
case
|
|
56
|
+
case ge.ANTHROPIC:
|
|
57
57
|
return {
|
|
58
|
-
[
|
|
58
|
+
[oe.WEB_SEARCH]: vo.tools.webFetch_20250910()
|
|
59
59
|
};
|
|
60
|
-
case
|
|
60
|
+
case zt:
|
|
61
61
|
return {
|
|
62
|
-
[
|
|
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
|
|
74
|
-
function
|
|
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}`),
|
|
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
|
|
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
|
|
86
|
+
return C(t, `
|
|
87
87
|
`);
|
|
88
88
|
}
|
|
89
|
-
function
|
|
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
|
|
96
|
+
return C(t, `
|
|
97
97
|
`);
|
|
98
98
|
}
|
|
99
|
-
function
|
|
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(
|
|
104
|
+
o.push(Do(e));
|
|
105
105
|
break;
|
|
106
106
|
case "workflows":
|
|
107
|
-
o.push(
|
|
107
|
+
o.push(Wo(e));
|
|
108
108
|
break;
|
|
109
109
|
case "sourceDescriptions":
|
|
110
|
-
o.push(
|
|
110
|
+
o.push(Lo(e));
|
|
111
111
|
break;
|
|
112
112
|
}
|
|
113
|
-
return
|
|
113
|
+
return C(o, `
|
|
114
114
|
|
|
115
115
|
`);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
return
|
|
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
|
|
129
|
-
return
|
|
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: ${
|
|
139
|
-
t.includes("security") && e.relatedSecuritySchemes ? `Security schemes: ${
|
|
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: ${
|
|
141
|
+
t.includes("responses") && e.responseSchemas ? `Responses: ${Tt(e.responseSchemas)}` : null
|
|
142
142
|
],
|
|
143
143
|
`
|
|
144
144
|
`
|
|
145
145
|
);
|
|
146
146
|
}
|
|
147
|
-
const
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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}${
|
|
181
|
-
r && n.push(
|
|
182
|
-
const s =
|
|
183
|
-
return s && n.push(
|
|
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
|
|
186
|
+
function Vo(e, t) {
|
|
189
187
|
switch (t) {
|
|
190
188
|
case "inputs":
|
|
191
|
-
return
|
|
189
|
+
return Yo(e);
|
|
192
190
|
case "parameters":
|
|
193
|
-
return
|
|
191
|
+
return Ct(e.parameters);
|
|
194
192
|
case "security":
|
|
195
|
-
return
|
|
193
|
+
return pe(e.security);
|
|
196
194
|
case "outputs":
|
|
197
|
-
return
|
|
195
|
+
return zo(e);
|
|
198
196
|
case "steps":
|
|
199
|
-
return
|
|
197
|
+
return Ho(e);
|
|
200
198
|
case "wiring":
|
|
201
|
-
return
|
|
199
|
+
return Go(e);
|
|
202
200
|
default:
|
|
203
201
|
return null;
|
|
204
202
|
}
|
|
205
203
|
}
|
|
206
|
-
function
|
|
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}`),
|
|
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
|
|
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(
|
|
213
|
+
o.push(Ko(e));
|
|
216
214
|
continue;
|
|
217
215
|
}
|
|
218
216
|
if (!n)
|
|
219
217
|
continue;
|
|
220
|
-
const s =
|
|
218
|
+
const s = Vo(n, r);
|
|
221
219
|
s && o.push(s);
|
|
222
220
|
}
|
|
223
|
-
return
|
|
221
|
+
return C(o, `
|
|
224
222
|
|
|
225
223
|
`);
|
|
226
224
|
}
|
|
227
|
-
function
|
|
228
|
-
return
|
|
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
|
|
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
|
|
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 (${
|
|
253
|
+
return `Step is connected to API (${C(t, ", ")})`;
|
|
256
254
|
}
|
|
257
|
-
function
|
|
255
|
+
function en(e) {
|
|
258
256
|
const t = [`method: ${e.method}`, `url: ${e.url}`];
|
|
259
|
-
return `Step is not connected to API (${
|
|
257
|
+
return `Step is not connected to API (${C(t, ", ")})`;
|
|
260
258
|
}
|
|
261
|
-
function
|
|
259
|
+
function tn(e) {
|
|
262
260
|
return e.description?.trim() ? `Description:
|
|
263
261
|
${e.description}` : null;
|
|
264
262
|
}
|
|
265
|
-
function
|
|
263
|
+
function on(e, t) {
|
|
266
264
|
switch (t) {
|
|
267
265
|
case "parameters":
|
|
268
|
-
return
|
|
266
|
+
return Ct(e.parameters) || null;
|
|
269
267
|
case "requestBody":
|
|
270
|
-
return
|
|
268
|
+
return wo(e.requestBody) || null;
|
|
271
269
|
case "security":
|
|
272
|
-
return
|
|
270
|
+
return pe(e.security) || null;
|
|
273
271
|
case "outputs":
|
|
274
|
-
return
|
|
272
|
+
return _e(e.outputs) || null;
|
|
275
273
|
case "successCriteria":
|
|
276
|
-
return
|
|
274
|
+
return ho(e.successCriteria) || null;
|
|
277
275
|
default:
|
|
278
276
|
return null;
|
|
279
277
|
}
|
|
280
278
|
}
|
|
281
|
-
function
|
|
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(
|
|
284
|
+
if (t.push(tn(o)), o.operation) {
|
|
287
285
|
const n = o.operation;
|
|
288
|
-
t.push(
|
|
286
|
+
t.push(Zo(n));
|
|
289
287
|
} else if (o.xOperation) {
|
|
290
288
|
const n = o.xOperation;
|
|
291
|
-
t.push(
|
|
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}`),
|
|
294
|
+
), e.requestError && t.push(`Request error: ${e.requestError}`), C(t, `
|
|
297
295
|
`);
|
|
298
296
|
}
|
|
299
|
-
function
|
|
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 >
|
|
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
|
-
${
|
|
311
|
+
${C(o, `
|
|
314
312
|
`)}` : null,
|
|
315
313
|
n || null
|
|
316
314
|
];
|
|
317
|
-
return
|
|
315
|
+
return C(r, `
|
|
318
316
|
`);
|
|
319
317
|
}
|
|
320
|
-
function
|
|
318
|
+
function Ve(e, t) {
|
|
321
319
|
const o = [];
|
|
322
320
|
for (const n of t) {
|
|
323
|
-
const r =
|
|
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
|
|
327
|
+
function sn(e, t) {
|
|
330
328
|
const o = ["Current tab (step)"];
|
|
331
|
-
return t.length === 0 ? null : (t.includes("info") && o.push(
|
|
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
|
|
333
|
+
function an(e) {
|
|
336
334
|
return e?.trim() ? `Description:
|
|
337
335
|
${e}` : null;
|
|
338
336
|
}
|
|
339
|
-
function
|
|
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 (${
|
|
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 (${
|
|
352
|
+
return `Step is not connected to API (${C(o, ", ")})`;
|
|
355
353
|
}
|
|
356
354
|
return null;
|
|
357
355
|
}
|
|
358
|
-
function
|
|
359
|
-
return
|
|
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") ?
|
|
365
|
-
|
|
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: ${
|
|
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: ${
|
|
371
|
-
t.includes("responses") && e.responseSchemas ? `Responses: ${
|
|
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
|
|
378
|
-
return e.type === "collection" ?
|
|
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
|
|
381
|
-
return e.map((o) =>
|
|
378
|
+
function un(e, t) {
|
|
379
|
+
return e.map((o) => dn(o, t));
|
|
382
380
|
}
|
|
383
|
-
const
|
|
384
|
-
function
|
|
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()}`),
|
|
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
|
|
387
|
+
function wn(e) {
|
|
390
388
|
return `Severity settings:
|
|
391
389
|
${JSON.stringify(e.severitySettings, null, 2)}`;
|
|
392
390
|
}
|
|
393
|
-
function
|
|
391
|
+
function In(e, t) {
|
|
394
392
|
return e.length > t ? `${e.slice(0, t)}…` : e;
|
|
395
393
|
}
|
|
396
|
-
function
|
|
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
|
|
397
|
+
return In(ne(r, t), o);
|
|
400
398
|
}
|
|
401
|
-
function
|
|
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 ?
|
|
402
|
+
[o?.toUpperCase(), n ? ne(n, t) : null].filter(Boolean).join(" "),
|
|
405
403
|
"->"
|
|
406
|
-
), s.push(`status=${r ?? "n/a"}`,
|
|
407
|
-
const a = 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}: ${
|
|
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
|
|
417
|
-
const { steps: n, totalSteps: r, passedSteps: s, succeeded: a, timedOut: l } =
|
|
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
|
|
420
|
-
let
|
|
421
|
-
for (const { step:
|
|
422
|
-
if (
|
|
423
|
-
|
|
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 =
|
|
427
|
-
|
|
424
|
+
const v = Ke(g.response?.body, t, fn);
|
|
425
|
+
f -= v.length, u.push(` body: ${v}`);
|
|
428
426
|
}
|
|
429
|
-
|
|
430
|
-
` (${
|
|
431
|
-
),
|
|
432
|
-
${
|
|
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
|
|
436
|
-
const
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
${
|
|
440
|
-
|
|
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
|
-
|
|
440
|
+
z,
|
|
443
441
|
!0
|
|
444
|
-
)}` : `Full response body for step ${
|
|
442
|
+
)}` : `Full response body for step ${u}: step not found in this run.`
|
|
445
443
|
);
|
|
446
444
|
}
|
|
447
|
-
return
|
|
445
|
+
return C(d, `
|
|
448
446
|
`);
|
|
449
447
|
}
|
|
450
|
-
function
|
|
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: ${
|
|
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 ?
|
|
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
|
|
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(
|
|
467
|
+
n.push(hn(e));
|
|
470
468
|
break;
|
|
471
469
|
case "severity":
|
|
472
|
-
n.push(
|
|
470
|
+
n.push(wn(e));
|
|
473
471
|
break;
|
|
474
472
|
case "result":
|
|
475
|
-
n.push(
|
|
473
|
+
n.push(gn(e, o));
|
|
476
474
|
break;
|
|
477
475
|
}
|
|
478
|
-
return
|
|
476
|
+
return C(n, `
|
|
479
477
|
|
|
480
478
|
`);
|
|
481
479
|
}
|
|
482
|
-
function
|
|
480
|
+
function kn(e, t = ["info"], o) {
|
|
483
481
|
if (!e)
|
|
484
482
|
return null;
|
|
485
483
|
switch (e.type) {
|
|
486
|
-
case
|
|
487
|
-
return
|
|
488
|
-
case
|
|
489
|
-
return
|
|
490
|
-
case
|
|
491
|
-
return
|
|
492
|
-
case
|
|
493
|
-
return
|
|
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
|
|
494
|
+
function Sn(e) {
|
|
497
495
|
switch (e.type) {
|
|
498
|
-
case
|
|
499
|
-
return
|
|
500
|
-
case
|
|
501
|
-
return
|
|
502
|
-
case
|
|
503
|
-
return
|
|
504
|
-
case
|
|
505
|
-
return
|
|
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
|
|
506
|
+
function At(e) {
|
|
509
507
|
return e.trim().replace(/\s+/g, " ").replace(/[.!?:;,…]+$/, "").toLowerCase();
|
|
510
508
|
}
|
|
511
|
-
function
|
|
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
|
|
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
|
|
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 =
|
|
533
|
-
return s === null ? null : r.priorInputs.some((l) =>
|
|
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
|
|
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
|
|
544
|
-
const t =
|
|
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
|
|
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
|
|
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
|
|
570
|
+
function En(e, t, o, n) {
|
|
573
571
|
return !t || t.length === 0 ? o : async (r, s) => {
|
|
574
|
-
const a =
|
|
572
|
+
const a = Tn(s?.messages, e), l = {
|
|
575
573
|
consecutiveCalls: a.consecutiveCalls,
|
|
576
|
-
priorInputs: n ? a.priorInputs.map(n).filter((
|
|
577
|
-
}, c =
|
|
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
|
|
581
|
-
return c.notes.length === 0 || !
|
|
582
|
-
...
|
|
583
|
-
note: [
|
|
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
|
|
585
|
+
function xn(e) {
|
|
588
586
|
return e !== null && typeof e == "object" && e.isError === !1;
|
|
589
587
|
}
|
|
590
|
-
function
|
|
588
|
+
function $n(e, t) {
|
|
591
589
|
return {
|
|
592
590
|
name: e.name,
|
|
593
591
|
definition: e.definition,
|
|
594
|
-
execute:
|
|
592
|
+
execute: En(
|
|
595
593
|
e.name,
|
|
596
594
|
e.guards,
|
|
597
595
|
e.createExecutor(t),
|
|
598
|
-
|
|
596
|
+
An(e.definition.inputSchema)
|
|
599
597
|
)
|
|
600
598
|
};
|
|
601
599
|
}
|
|
602
|
-
const
|
|
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
|
-
},
|
|
616
|
-
|
|
613
|
+
}, Rn = Yt(
|
|
614
|
+
_n
|
|
617
615
|
);
|
|
618
|
-
function
|
|
619
|
-
return
|
|
616
|
+
function ac() {
|
|
617
|
+
return Ft(Rn);
|
|
620
618
|
}
|
|
621
|
-
const
|
|
619
|
+
const qn = p({
|
|
622
620
|
message: i(),
|
|
623
|
-
details:
|
|
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
|
|
631
|
-
action:
|
|
632
|
-
approved:
|
|
633
|
-
}),
|
|
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
|
-
}),
|
|
636
|
-
index:
|
|
637
|
-
}),
|
|
638
|
-
isError:
|
|
639
|
-
blocked:
|
|
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:
|
|
642
|
-
error:
|
|
639
|
+
data: F().optional(),
|
|
640
|
+
error: F().optional()
|
|
643
641
|
});
|
|
644
|
-
function
|
|
645
|
-
return
|
|
642
|
+
function q(e) {
|
|
643
|
+
return Re([
|
|
646
644
|
p({
|
|
647
|
-
isError:
|
|
648
|
-
error:
|
|
649
|
-
data:
|
|
650
|
-
blocked:
|
|
645
|
+
isError: w(!0),
|
|
646
|
+
error: qn,
|
|
647
|
+
data: F().optional(),
|
|
648
|
+
blocked: F().optional()
|
|
651
649
|
}),
|
|
652
650
|
p({
|
|
653
|
-
isError:
|
|
651
|
+
isError: w(!1),
|
|
654
652
|
data: e,
|
|
655
|
-
error:
|
|
653
|
+
error: F().optional(),
|
|
656
654
|
note: i().optional(),
|
|
657
|
-
blocked:
|
|
655
|
+
blocked: F().optional()
|
|
658
656
|
}),
|
|
659
|
-
|
|
657
|
+
Nn
|
|
660
658
|
]);
|
|
661
659
|
}
|
|
662
|
-
const
|
|
663
|
-
status:
|
|
660
|
+
const Un = p({
|
|
661
|
+
status: E(["applied", "failed"]),
|
|
664
662
|
summary: i().optional()
|
|
665
|
-
}),
|
|
666
|
-
totalChanges:
|
|
667
|
-
approvedChanges:
|
|
668
|
-
applied:
|
|
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
|
-
}),
|
|
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
|
-
]),
|
|
686
|
-
sections:
|
|
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:
|
|
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
|
-
}),
|
|
690
|
+
}), jn = p({
|
|
693
691
|
message: i()
|
|
694
|
-
}),
|
|
695
|
-
description:
|
|
696
|
-
inputSchema:
|
|
697
|
-
outputSchema:
|
|
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
|
|
707
|
-
const o =
|
|
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
|
|
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 } =
|
|
718
|
-
let c =
|
|
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 !==
|
|
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
|
|
727
|
+
const Hn = {
|
|
730
728
|
name: "get_current_tab",
|
|
731
|
-
definition:
|
|
732
|
-
createExecutor: (e) =>
|
|
733
|
-
},
|
|
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.`,
|
|
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
|
-
}),
|
|
756
|
+
}), Kn = p({
|
|
759
757
|
name: i(),
|
|
760
|
-
kind:
|
|
761
|
-
count:
|
|
762
|
-
}),
|
|
758
|
+
kind: E(["scalar", "object", "array"]),
|
|
759
|
+
count: A().int().nonnegative().optional()
|
|
760
|
+
}), Jn = p({
|
|
763
761
|
name: i(),
|
|
764
762
|
hint: i()
|
|
765
|
-
}),
|
|
766
|
-
available:
|
|
767
|
-
blocked:
|
|
768
|
-
}),
|
|
763
|
+
}), Qn = p({
|
|
764
|
+
available: T(Kn),
|
|
765
|
+
blocked: T(Jn)
|
|
766
|
+
}), Xn = p({
|
|
769
767
|
field: i(),
|
|
770
|
-
value:
|
|
771
|
-
start:
|
|
772
|
-
end:
|
|
773
|
-
total:
|
|
774
|
-
truncated:
|
|
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
|
-
}),
|
|
777
|
-
description:
|
|
778
|
-
inputSchema:
|
|
779
|
-
outputSchema:
|
|
774
|
+
}), Zn = Re([Qn, Xn]), er = q(Zn), tr = {
|
|
775
|
+
description: Gn,
|
|
776
|
+
inputSchema: Vn,
|
|
777
|
+
outputSchema: er,
|
|
780
778
|
needsApproval: !1
|
|
781
|
-
},
|
|
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
|
-
},
|
|
786
|
+
}, $t = ["id", "srcType", "fileDependencies"], he = [
|
|
789
787
|
{
|
|
790
788
|
name: "securitySchemes",
|
|
791
789
|
sources: ["components.securitySchemes", "securityDefinitions"]
|
|
792
790
|
}
|
|
793
|
-
],
|
|
794
|
-
function
|
|
791
|
+
], or = 10, Xe = 500;
|
|
792
|
+
function _t(e, t) {
|
|
795
793
|
for (const o of t.sources) {
|
|
796
|
-
const n =
|
|
797
|
-
if (
|
|
794
|
+
const n = nr(e, o);
|
|
795
|
+
if (rr(n)) return n;
|
|
798
796
|
}
|
|
799
797
|
return null;
|
|
800
798
|
}
|
|
801
|
-
function
|
|
802
|
-
return t.split(".").reduce((o, n) =>
|
|
799
|
+
function nr(e, t) {
|
|
800
|
+
return t.split(".").reduce((o, n) => Q(o) ? o[n] : void 0, e);
|
|
803
801
|
}
|
|
804
|
-
function
|
|
805
|
-
return e == null ? !1 : Array.isArray(e) ? e.length > 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
|
|
805
|
+
function Q(e) {
|
|
808
806
|
return !(e === null || typeof e != "object" || Array.isArray(e));
|
|
809
807
|
}
|
|
810
|
-
const
|
|
811
|
-
|
|
808
|
+
const sr = new Set(
|
|
809
|
+
he.flatMap((e) => e.sources.map((t) => t.split(".")[0]))
|
|
812
810
|
);
|
|
813
|
-
function
|
|
811
|
+
function Ze(e) {
|
|
814
812
|
const t = [], o = [];
|
|
815
813
|
for (const [n, r] of Object.entries(e)) {
|
|
816
|
-
if (n in
|
|
817
|
-
o.push({ name: n, hint:
|
|
814
|
+
if (n in se) {
|
|
815
|
+
o.push({ name: n, hint: se[n] });
|
|
818
816
|
continue;
|
|
819
817
|
}
|
|
820
|
-
|
|
818
|
+
$t.includes(n) || sr.has(n) || t.push(et(n, r));
|
|
821
819
|
}
|
|
822
|
-
for (const n of
|
|
823
|
-
const r =
|
|
824
|
-
r !== null && t.push(
|
|
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
|
|
829
|
-
const o = { name: e, kind:
|
|
830
|
-
return Array.isArray(t) ? o.count = t.length :
|
|
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
|
|
833
|
-
return Array.isArray(e) ? "array" :
|
|
830
|
+
function ar(e) {
|
|
831
|
+
return Array.isArray(e) ? "array" : Q(e) ? "object" : "scalar";
|
|
834
832
|
}
|
|
835
|
-
function
|
|
833
|
+
function ir(e, t, o) {
|
|
836
834
|
if (Array.isArray(t))
|
|
837
|
-
return
|
|
838
|
-
if (
|
|
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
|
|
838
|
+
return tt(e, n, o, (r) => Object.fromEntries(r));
|
|
841
839
|
}
|
|
842
840
|
return {
|
|
843
841
|
field: e,
|
|
844
|
-
value:
|
|
842
|
+
value: ae(t),
|
|
845
843
|
truncated: !1,
|
|
846
844
|
nextCursor: null
|
|
847
845
|
};
|
|
848
846
|
}
|
|
849
|
-
function
|
|
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
|
|
863
|
-
const r = Math.min(Math.max(o, 0), t.length), s = Math.min(r +
|
|
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:
|
|
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 ?
|
|
869
|
+
nextCursor: a ? lr(e, s) : null
|
|
872
870
|
};
|
|
873
871
|
}
|
|
874
|
-
function
|
|
872
|
+
function ae(e) {
|
|
875
873
|
if (typeof e == "string")
|
|
876
|
-
return e.length >
|
|
874
|
+
return e.length > Xe ? `${e.slice(0, Xe)}…` : e;
|
|
877
875
|
if (Array.isArray(e))
|
|
878
|
-
return e.map(
|
|
879
|
-
if (
|
|
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] =
|
|
880
|
+
t[o] = ae(n);
|
|
883
881
|
return t;
|
|
884
882
|
}
|
|
885
883
|
return e;
|
|
886
884
|
}
|
|
887
|
-
function
|
|
885
|
+
function lr(e, t) {
|
|
888
886
|
return btoa(`${e}:${t}`);
|
|
889
887
|
}
|
|
890
|
-
const
|
|
891
|
-
|
|
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
|
|
896
|
-
const n =
|
|
893
|
+
function ur(e, t, o) {
|
|
894
|
+
const n = he.find((a) => a.name === t);
|
|
897
895
|
if (n) {
|
|
898
|
-
const a =
|
|
899
|
-
return a === null ?
|
|
896
|
+
const a = _t(e, n);
|
|
897
|
+
return a === null ? nt(t) : ot(t, a, o);
|
|
900
898
|
}
|
|
901
|
-
if (t in
|
|
899
|
+
if (t in se)
|
|
902
900
|
return h(
|
|
903
|
-
`"${t}" is not available from this tool. ${
|
|
901
|
+
`"${t}" is not available from this tool. ${se[t]}`,
|
|
904
902
|
{ field: t }
|
|
905
903
|
);
|
|
906
|
-
if (
|
|
904
|
+
if ($t.includes(t))
|
|
907
905
|
return h(`"${t}" is not an OpenAPI metadata field.`, { field: t });
|
|
908
|
-
const r =
|
|
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 ?
|
|
912
|
+
return s == null ? nt(t) : ot(t, s, o);
|
|
915
913
|
}
|
|
916
|
-
function
|
|
917
|
-
const n =
|
|
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:
|
|
921
|
+
data: ir(e, t, n)
|
|
924
922
|
};
|
|
925
923
|
}
|
|
926
|
-
function
|
|
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
|
|
930
|
+
function pr(e) {
|
|
933
931
|
return async (t) => {
|
|
934
|
-
const o = e.
|
|
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:
|
|
941
|
+
data: Ze(r)
|
|
944
942
|
}
|
|
945
|
-
) : t.field !== void 0 ?
|
|
943
|
+
) : t.field !== void 0 ? ur(r, t.field, t.cursor) : {
|
|
946
944
|
isError: !1,
|
|
947
|
-
data:
|
|
945
|
+
data: Ze(r)
|
|
948
946
|
};
|
|
949
947
|
};
|
|
950
948
|
}
|
|
951
|
-
const
|
|
949
|
+
const fr = {
|
|
952
950
|
name: "get_api_metadata",
|
|
953
|
-
definition:
|
|
954
|
-
createExecutor: (e) =>
|
|
955
|
-
},
|
|
956
|
-
action:
|
|
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(),
|
|
959
|
-
action:
|
|
956
|
+
}).strict(), wr = p({
|
|
957
|
+
action: w("delete_collection"),
|
|
960
958
|
collectionId: i().min(1).describe("Target collection id.")
|
|
961
|
-
}).strict(),
|
|
962
|
-
action:
|
|
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(),
|
|
966
|
-
action:
|
|
963
|
+
}).strict(), yr = p({
|
|
964
|
+
action: w("delete_workflow"),
|
|
967
965
|
collectionId: i().min(1),
|
|
968
966
|
workflowId: i().min(1)
|
|
969
|
-
}).strict(),
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
],
|
|
967
|
+
}).strict(), vr = [
|
|
968
|
+
Y.Text,
|
|
969
|
+
Y.JSON,
|
|
970
|
+
Y.XML
|
|
971
|
+
], gr = p({
|
|
974
972
|
name: i().min(1),
|
|
975
|
-
in:
|
|
973
|
+
in: E(["path", "query", "header", "cookie"]),
|
|
976
974
|
value: i()
|
|
977
|
-
}).strict(),
|
|
975
|
+
}).strict(), br = p({
|
|
978
976
|
name: i().min(1).describe("Output name."),
|
|
979
977
|
expression: i().min(1).describe("Output expression.")
|
|
980
|
-
}).strict(),
|
|
978
|
+
}).strict(), kr = p({
|
|
981
979
|
condition: i().min(1),
|
|
982
980
|
context: i().optional(),
|
|
983
|
-
type:
|
|
984
|
-
}).strict(),
|
|
985
|
-
action:
|
|
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:
|
|
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:
|
|
993
|
+
contentType: E(vr).optional().describe("Request body content type.")
|
|
996
994
|
}).strict().optional().describe("Initial request body."),
|
|
997
|
-
outputs:
|
|
998
|
-
successCriteria:
|
|
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:
|
|
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(),
|
|
1015
|
-
action:
|
|
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(),
|
|
1020
|
-
action:
|
|
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:
|
|
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(),
|
|
1028
|
-
action:
|
|
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(),
|
|
1035
|
-
payload:
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
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:
|
|
1045
|
+
code: H.custom,
|
|
1048
1046
|
message: "Only one of `operation` or `xOperation` may be specified."
|
|
1049
1047
|
});
|
|
1050
|
-
}),
|
|
1048
|
+
}), Er = p({
|
|
1051
1049
|
summary: i(),
|
|
1052
1050
|
collectionId: i().optional(),
|
|
1053
1051
|
workflowId: i().optional(),
|
|
1054
1052
|
stepId: i().optional()
|
|
1055
|
-
}),
|
|
1056
|
-
description:
|
|
1057
|
-
inputSchema:
|
|
1058
|
-
outputSchema:
|
|
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
|
|
1062
|
-
return { ...
|
|
1059
|
+
function rt(e, t, o) {
|
|
1060
|
+
return { ...ft(e), key: t, value: o, active: !0 };
|
|
1063
1061
|
}
|
|
1064
|
-
function
|
|
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 (
|
|
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
|
-
...
|
|
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(
|
|
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
|
|
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(
|
|
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 =
|
|
1101
|
-
e.parameters[s] =
|
|
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 =
|
|
1123
|
-
o.type ??
|
|
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
|
|
1131
|
+
function qr(e) {
|
|
1134
1132
|
return async (t) => {
|
|
1135
1133
|
switch (t.payload.action) {
|
|
1136
1134
|
case "create_collection":
|
|
1137
|
-
return
|
|
1135
|
+
return Pr(t.payload, e);
|
|
1138
1136
|
case "delete_collection":
|
|
1139
|
-
return
|
|
1137
|
+
return Nr(t.payload, e);
|
|
1140
1138
|
case "create_workflow":
|
|
1141
|
-
return
|
|
1139
|
+
return Ur(t.payload, e);
|
|
1142
1140
|
case "delete_workflow":
|
|
1143
|
-
return
|
|
1141
|
+
return Dr(t.payload, e);
|
|
1144
1142
|
case "create_step":
|
|
1145
|
-
return
|
|
1143
|
+
return Wr(t.payload, e);
|
|
1146
1144
|
case "delete_step":
|
|
1147
|
-
return
|
|
1145
|
+
return Mr(t.payload, e);
|
|
1148
1146
|
case "move_step":
|
|
1149
|
-
return
|
|
1147
|
+
return jr(t.payload, e);
|
|
1150
1148
|
case "save_tab_to_collection":
|
|
1151
|
-
return
|
|
1149
|
+
return Br(t.payload, e);
|
|
1152
1150
|
}
|
|
1153
1151
|
};
|
|
1154
1152
|
}
|
|
1155
|
-
function
|
|
1156
|
-
const o =
|
|
1153
|
+
function Pr(e, { store: t }) {
|
|
1154
|
+
const o = oo({
|
|
1157
1155
|
name: e.title.trim(),
|
|
1158
|
-
collections: t.
|
|
1156
|
+
collections: t.get(b)
|
|
1159
1157
|
});
|
|
1160
|
-
return t.
|
|
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
|
|
1169
|
-
const n =
|
|
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
|
|
1173
|
-
return
|
|
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
|
|
1182
|
-
const o =
|
|
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 =
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
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
|
|
1199
|
-
|
|
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
|
|
1203
|
+
const s = V(n, {
|
|
1202
1204
|
collectionId: e.collectionId,
|
|
1203
1205
|
workflowId: e.workflowId
|
|
1204
1206
|
});
|
|
1205
|
-
return
|
|
1207
|
+
return s ? (ie(s, o, {
|
|
1206
1208
|
collectionId: e.collectionId,
|
|
1207
1209
|
workflowId: null
|
|
1208
|
-
}),
|
|
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
|
|
1221
|
-
|
|
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
|
|
1232
|
+
const a = V(r, {
|
|
1224
1233
|
collectionId: e.collectionId,
|
|
1225
1234
|
workflowId: e.workflowId
|
|
1226
1235
|
});
|
|
1227
|
-
if (!
|
|
1236
|
+
if (!a)
|
|
1228
1237
|
return h("Workflow not found.", {
|
|
1229
1238
|
collectionId: e.collectionId,
|
|
1230
1239
|
workflowId: e.workflowId
|
|
1231
1240
|
});
|
|
1232
|
-
const
|
|
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,
|
|
1247
|
+
} : void 0, c = e.xOperation ? {
|
|
1239
1248
|
method: e.xOperation.method,
|
|
1240
1249
|
url: e.xOperation.url
|
|
1241
1250
|
} : void 0;
|
|
1242
|
-
let
|
|
1243
|
-
|
|
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:
|
|
1258
|
+
apiId: l.apiId
|
|
1246
1259
|
}));
|
|
1247
|
-
const u =
|
|
1260
|
+
const u = mt({
|
|
1248
1261
|
name: e.stepName?.trim() || "New Step",
|
|
1249
|
-
workflow:
|
|
1250
|
-
operation:
|
|
1251
|
-
xOperation:
|
|
1252
|
-
apiOperation:
|
|
1262
|
+
workflow: a,
|
|
1263
|
+
operation: l,
|
|
1264
|
+
xOperation: c,
|
|
1265
|
+
apiOperation: d
|
|
1253
1266
|
});
|
|
1254
|
-
|
|
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
|
|
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 ${
|
|
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
|
|
1290
|
+
function Rt(e, t) {
|
|
1273
1291
|
return Math.min(Math.max(e, 0), t);
|
|
1274
1292
|
}
|
|
1275
|
-
function
|
|
1276
|
-
const
|
|
1277
|
-
return e.
|
|
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
|
|
1280
|
-
const n =
|
|
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
|
-
}
|
|
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
|
|
1304
|
-
const o =
|
|
1323
|
+
function jr(e, { store: t }) {
|
|
1324
|
+
const o = {
|
|
1305
1325
|
collectionId: e.collectionId,
|
|
1306
1326
|
workflowId: e.workflowId
|
|
1307
|
-
});
|
|
1308
|
-
if (!
|
|
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
|
|
1314
|
-
if (
|
|
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
|
|
1321
|
-
return
|
|
1322
|
-
|
|
1323
|
-
|
|
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 ${
|
|
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
|
|
1335
|
-
const n =
|
|
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 (!
|
|
1361
|
+
if (!Z(n))
|
|
1339
1362
|
return h("Active tab is not a step tab.", {
|
|
1340
|
-
tabType: n.data.type
|
|
1363
|
+
tabType: n.data.type
|
|
1341
1364
|
});
|
|
1342
|
-
const r =
|
|
1343
|
-
if (!
|
|
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 (!
|
|
1368
|
+
if (!G(r, e.targetCollectionId))
|
|
1346
1369
|
return h("Target collection not found.", {
|
|
1347
1370
|
collectionId: e.targetCollectionId
|
|
1348
1371
|
});
|
|
1349
|
-
const
|
|
1372
|
+
const l = {
|
|
1350
1373
|
collectionId: e.targetCollectionId,
|
|
1351
1374
|
workflowId: e.targetWorkflowId
|
|
1352
|
-
});
|
|
1353
|
-
if (!
|
|
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
|
|
1381
|
+
const d = mt({
|
|
1359
1382
|
name: e.newStepName.trim(),
|
|
1360
|
-
workflow:
|
|
1361
|
-
fromStep:
|
|
1383
|
+
workflow: c,
|
|
1384
|
+
fromStep: s
|
|
1362
1385
|
});
|
|
1363
|
-
return
|
|
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:
|
|
1394
|
+
apiId: d.operation.apiId
|
|
1366
1395
|
}), {
|
|
1367
1396
|
isError: !1,
|
|
1368
1397
|
data: {
|
|
1369
|
-
summary: `Added step ${
|
|
1398
|
+
summary: `Added step ${d.stepId} to workflow ${e.targetWorkflowId}.`,
|
|
1370
1399
|
collectionId: e.targetCollectionId,
|
|
1371
1400
|
workflowId: e.targetWorkflowId,
|
|
1372
|
-
stepId:
|
|
1401
|
+
stepId: d.stepId
|
|
1373
1402
|
}
|
|
1374
1403
|
};
|
|
1375
1404
|
}
|
|
1376
|
-
function
|
|
1405
|
+
function ie(e, t, o) {
|
|
1377
1406
|
if ("workflows" in e) {
|
|
1378
|
-
const
|
|
1407
|
+
const n = e.id;
|
|
1379
1408
|
e.workflows.forEach(
|
|
1380
|
-
(
|
|
1381
|
-
collectionId:
|
|
1409
|
+
(r) => ie(r, t, {
|
|
1410
|
+
collectionId: n,
|
|
1382
1411
|
workflowId: null
|
|
1383
1412
|
})
|
|
1384
|
-
), t({ collectionId:
|
|
1413
|
+
), t({ collectionId: n, workflowId: null, stepId: null });
|
|
1385
1414
|
return;
|
|
1386
1415
|
}
|
|
1387
1416
|
if ("steps" in e) {
|
|
1388
|
-
const
|
|
1417
|
+
const n = e.workflowId;
|
|
1389
1418
|
e.steps.forEach(
|
|
1390
|
-
(
|
|
1419
|
+
(r) => ie(r, t, {
|
|
1391
1420
|
collectionId: o?.collectionId,
|
|
1392
|
-
workflowId:
|
|
1421
|
+
workflowId: n
|
|
1393
1422
|
})
|
|
1394
1423
|
), t({
|
|
1395
1424
|
collectionId: o?.collectionId,
|
|
1396
|
-
workflowId:
|
|
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:
|
|
1433
|
+
stepId: e.stepId
|
|
1406
1434
|
});
|
|
1407
1435
|
}
|
|
1408
|
-
const
|
|
1436
|
+
const Fr = {
|
|
1409
1437
|
name: "manage_collection",
|
|
1410
|
-
definition:
|
|
1411
|
-
createExecutor: (e) =>
|
|
1412
|
-
},
|
|
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.`,
|
|
1437
|
-
action:
|
|
1438
|
-
}).strict(),
|
|
1439
|
-
action:
|
|
1440
|
-
}).strict(),
|
|
1441
|
-
action:
|
|
1442
|
-
environment:
|
|
1443
|
-
}).strict(),
|
|
1444
|
-
action:
|
|
1445
|
-
environment:
|
|
1446
|
-
}).strict(),
|
|
1447
|
-
action:
|
|
1448
|
-
environment:
|
|
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(),
|
|
1451
|
-
action:
|
|
1452
|
-
environment:
|
|
1478
|
+
}).strict(), Jr = p({
|
|
1479
|
+
action: w("upsert_input"),
|
|
1480
|
+
environment: M,
|
|
1453
1481
|
name: i().min(1),
|
|
1454
1482
|
value: i(),
|
|
1455
|
-
isSecret:
|
|
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(),
|
|
1459
|
-
action:
|
|
1460
|
-
environment:
|
|
1486
|
+
}).strict(), Qr = p({
|
|
1487
|
+
action: w("remove_input"),
|
|
1488
|
+
environment: M,
|
|
1461
1489
|
inputName: i().min(1)
|
|
1462
|
-
}).strict(),
|
|
1490
|
+
}).strict(), Pe = p({
|
|
1463
1491
|
name: i().min(1),
|
|
1464
1492
|
value: i()
|
|
1465
|
-
}).strict(),
|
|
1466
|
-
action:
|
|
1467
|
-
environment:
|
|
1493
|
+
}).strict(), Xr = p({
|
|
1494
|
+
action: w("upsert_server"),
|
|
1495
|
+
environment: M,
|
|
1468
1496
|
apiId: i().min(1),
|
|
1469
1497
|
value: i(),
|
|
1470
|
-
variables:
|
|
1471
|
-
}).strict(),
|
|
1498
|
+
variables: T(Pe).optional()
|
|
1499
|
+
}).strict(), Zr = p({
|
|
1472
1500
|
name: i().min(1),
|
|
1473
1501
|
value: i(),
|
|
1474
|
-
isSecret:
|
|
1475
|
-
}).strict(),
|
|
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:
|
|
1479
|
-
}).strict(),
|
|
1480
|
-
action:
|
|
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:
|
|
1483
|
-
servers:
|
|
1484
|
-
setActive:
|
|
1485
|
-
}).strict(),
|
|
1486
|
-
action:
|
|
1487
|
-
environment:
|
|
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(),
|
|
1490
|
-
action:
|
|
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(),
|
|
1493
|
-
payload:
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
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
|
-
}),
|
|
1534
|
+
}), ss = p({
|
|
1507
1535
|
summary: i(),
|
|
1508
|
-
environmentNames:
|
|
1509
|
-
inputs:
|
|
1536
|
+
environmentNames: T(i()).optional(),
|
|
1537
|
+
inputs: T(
|
|
1510
1538
|
p({
|
|
1511
1539
|
name: i(),
|
|
1512
|
-
isSecret:
|
|
1540
|
+
isSecret: R(),
|
|
1513
1541
|
value: i()
|
|
1514
1542
|
})
|
|
1515
1543
|
).optional(),
|
|
1516
|
-
servers:
|
|
1544
|
+
servers: T(
|
|
1517
1545
|
p({
|
|
1518
1546
|
apiId: i(),
|
|
1519
1547
|
value: i(),
|
|
1520
|
-
variables:
|
|
1548
|
+
variables: T(Pe)
|
|
1521
1549
|
})
|
|
1522
1550
|
).optional(),
|
|
1523
1551
|
input: p({
|
|
1524
1552
|
name: i(),
|
|
1525
|
-
isSecret:
|
|
1553
|
+
isSecret: R(),
|
|
1526
1554
|
value: i()
|
|
1527
1555
|
}).optional(),
|
|
1528
1556
|
environment: i().optional(),
|
|
1529
1557
|
apiId: i().optional()
|
|
1530
|
-
}),
|
|
1531
|
-
description:
|
|
1532
|
-
inputSchema:
|
|
1533
|
-
outputSchema:
|
|
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
|
|
1564
|
+
function cs(e) {
|
|
1537
1565
|
return async (t, o) => {
|
|
1538
1566
|
switch (t.payload.action) {
|
|
1539
1567
|
case "get_environments":
|
|
1540
|
-
return
|
|
1568
|
+
return ls(e);
|
|
1541
1569
|
case "add_environment":
|
|
1542
|
-
return
|
|
1570
|
+
return ds(e, t.payload);
|
|
1543
1571
|
case "get_active_environment":
|
|
1544
|
-
return
|
|
1572
|
+
return us(e);
|
|
1545
1573
|
case "set_active_environment":
|
|
1546
|
-
return
|
|
1574
|
+
return vs(e, t.payload);
|
|
1547
1575
|
case "get_inputs":
|
|
1548
|
-
return
|
|
1576
|
+
return ps(e, t.payload);
|
|
1549
1577
|
case "get_servers":
|
|
1550
|
-
return
|
|
1578
|
+
return fs(e, t.payload);
|
|
1551
1579
|
case "get_input":
|
|
1552
|
-
return
|
|
1580
|
+
return ms(e, t.payload);
|
|
1553
1581
|
case "upsert_input":
|
|
1554
|
-
return
|
|
1582
|
+
return hs(e, t.payload);
|
|
1555
1583
|
case "remove_input":
|
|
1556
|
-
return
|
|
1584
|
+
return ws(e, t.payload);
|
|
1557
1585
|
case "upsert_server":
|
|
1558
|
-
return
|
|
1586
|
+
return Is(e, t.payload);
|
|
1559
1587
|
case "remove_server":
|
|
1560
|
-
return
|
|
1588
|
+
return ys(e, t.payload);
|
|
1561
1589
|
}
|
|
1562
1590
|
};
|
|
1563
1591
|
}
|
|
1564
|
-
function
|
|
1565
|
-
const t = e.
|
|
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
|
|
1575
|
-
if (
|
|
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.
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
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.
|
|
1621
|
+
return e.set(ee, (a) => [
|
|
1622
|
+
...a,
|
|
1589
1623
|
{
|
|
1590
1624
|
name: t.environment,
|
|
1591
|
-
inputs:
|
|
1592
|
-
servers:
|
|
1593
|
-
state:
|
|
1625
|
+
inputs: r,
|
|
1626
|
+
servers: s,
|
|
1627
|
+
state: ro.Normal
|
|
1594
1628
|
}
|
|
1595
|
-
]), t.setActive && e.
|
|
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
|
|
1604
|
-
const t = e.
|
|
1605
|
-
return
|
|
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
|
|
1616
|
-
const o =
|
|
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 =
|
|
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
|
|
1630
|
-
const o =
|
|
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 =
|
|
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
|
|
1644
|
-
const o =
|
|
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((
|
|
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
|
|
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:
|
|
1696
|
+
value: qt(l, c)
|
|
1663
1697
|
}
|
|
1664
1698
|
}
|
|
1665
1699
|
};
|
|
1666
1700
|
}
|
|
1667
|
-
function
|
|
1668
|
-
const o =
|
|
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,
|
|
1672
|
-
return
|
|
1673
|
-
...
|
|
1674
|
-
|
|
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}" (${
|
|
1715
|
+
summary: `Upserted input "${t.name}" in "${n}" (${a ? "secret" : "plain"}).`,
|
|
1679
1716
|
environment: n
|
|
1680
1717
|
}
|
|
1681
1718
|
};
|
|
1682
1719
|
}
|
|
1683
|
-
function
|
|
1684
|
-
const o =
|
|
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
|
|
1688
|
-
return
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
})
|
|
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
|
|
1700
|
-
const o =
|
|
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
|
|
1704
|
-
return
|
|
1705
|
-
const a = s.findIndex((
|
|
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
|
|
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
|
|
1721
|
-
const o =
|
|
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
|
|
1725
|
-
return
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
})
|
|
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
|
|
1738
|
-
return
|
|
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
|
|
1746
|
-
return t ?? e.
|
|
1791
|
+
function gs(e, t) {
|
|
1792
|
+
return t ?? e.get(K);
|
|
1747
1793
|
}
|
|
1748
|
-
function
|
|
1749
|
-
const 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
|
|
1759
|
-
return e.
|
|
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
|
|
1813
|
+
function bs(e) {
|
|
1762
1814
|
return e.inputs.map((t) => ({
|
|
1763
1815
|
name: t.name,
|
|
1764
1816
|
isSecret: t.isSecret,
|
|
1765
|
-
value:
|
|
1817
|
+
value: qt(t.isSecret, t.value)
|
|
1766
1818
|
}));
|
|
1767
1819
|
}
|
|
1768
|
-
function
|
|
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
|
|
1776
|
-
return e ?
|
|
1827
|
+
function qt(e, t) {
|
|
1828
|
+
return e ? so : t;
|
|
1777
1829
|
}
|
|
1778
|
-
const
|
|
1830
|
+
const Ss = {
|
|
1779
1831
|
name: "manage_environment",
|
|
1780
|
-
definition:
|
|
1781
|
-
createExecutor: (e) =>
|
|
1782
|
-
},
|
|
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
|
-
]),
|
|
1790
|
-
action:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
1863
|
+
code: H.custom,
|
|
1812
1864
|
message: "requestMethod requires a non-empty requestUrl.",
|
|
1813
1865
|
path: ["requestMethod"]
|
|
1814
1866
|
});
|
|
1815
|
-
}),
|
|
1816
|
-
outcome:
|
|
1817
|
-
activeTabIndex:
|
|
1867
|
+
}), Es = p({
|
|
1868
|
+
outcome: E(["focused", "opened"]),
|
|
1869
|
+
activeTabIndex: A().int().nonnegative(),
|
|
1818
1870
|
tabId: i(),
|
|
1819
|
-
tabType:
|
|
1820
|
-
}),
|
|
1821
|
-
description:
|
|
1822
|
-
inputSchema:
|
|
1823
|
-
outputSchema:
|
|
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
|
|
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
|
|
1844
|
-
const o =
|
|
1845
|
-
items: e
|
|
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
|
|
1904
|
+
getItemId: (r) => r.id,
|
|
1853
1905
|
formatAmbiguousMatch: (r) => ({
|
|
1854
|
-
id: r.id
|
|
1855
|
-
title: r.info.title
|
|
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
|
|
1915
|
+
value: { collectionId: n.id, collection: n }
|
|
1864
1916
|
};
|
|
1865
1917
|
}
|
|
1866
|
-
function
|
|
1867
|
-
const n =
|
|
1918
|
+
function Ne(e, t, o) {
|
|
1919
|
+
const n = Pt(e, t);
|
|
1868
1920
|
if (!n.ok) return n;
|
|
1869
|
-
const r =
|
|
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
|
|
1929
|
+
getItemId: (a) => a.workflowId,
|
|
1878
1930
|
formatAmbiguousMatch: (a) => ({
|
|
1879
|
-
workflowId: a.workflowId
|
|
1880
|
-
summary: a.summary
|
|
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
|
|
1945
|
+
workflowId: s.workflowId,
|
|
1894
1946
|
workflow: s
|
|
1895
1947
|
}
|
|
1896
1948
|
};
|
|
1897
1949
|
}
|
|
1898
|
-
function
|
|
1899
|
-
const r =
|
|
1950
|
+
function Nt(e, t, o, n) {
|
|
1951
|
+
const r = Ne(e, t, o);
|
|
1900
1952
|
if (!r.ok) return r;
|
|
1901
|
-
const s =
|
|
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
|
|
1961
|
+
getItemId: (l) => l.stepId,
|
|
1910
1962
|
formatAmbiguousMatch: (l) => ({
|
|
1911
|
-
stepId: l.stepId
|
|
1912
|
-
description: l.description
|
|
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
|
|
1979
|
+
stepId: a.stepId,
|
|
1928
1980
|
step: a
|
|
1929
1981
|
}
|
|
1930
1982
|
};
|
|
1931
1983
|
}
|
|
1932
|
-
function
|
|
1933
|
-
const o =
|
|
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 =
|
|
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
|
|
1960
|
-
|
|
1961
|
-
const
|
|
1962
|
-
if (!
|
|
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 (
|
|
1968
|
-
const
|
|
1969
|
-
return
|
|
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
|
-
|
|
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:
|
|
2033
|
+
details: { tabType: t?.data?.type }
|
|
1977
2034
|
};
|
|
1978
|
-
const
|
|
1979
|
-
|
|
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:
|
|
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
|
-
|
|
1988
|
-
|
|
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
|
|
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
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
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
|
|
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
|
|
2109
|
+
return Ds(e, t, o.tabIndex);
|
|
2015
2110
|
case "open_operation":
|
|
2016
|
-
return
|
|
2111
|
+
return Ws(e, t, o.operationId);
|
|
2017
2112
|
case "open_collection":
|
|
2018
|
-
return
|
|
2113
|
+
return Ls(e, e.get(b), t, o.collectionId);
|
|
2019
2114
|
case "open_workflow":
|
|
2020
|
-
return
|
|
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
|
|
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
|
|
2132
|
+
return Bs(e, t, o.requestUrl, o.requestMethod);
|
|
2025
2133
|
default: {
|
|
2026
2134
|
const r = o.action;
|
|
2027
|
-
return
|
|
2135
|
+
return x("Unsupported open_tab action.", { action: r });
|
|
2028
2136
|
}
|
|
2029
2137
|
}
|
|
2030
2138
|
} catch (r) {
|
|
2031
|
-
return
|
|
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
|
|
2145
|
+
function Ds(e, t, o) {
|
|
2038
2146
|
if (o === void 0)
|
|
2039
|
-
return
|
|
2040
|
-
const n = e.
|
|
2041
|
-
return o < 0 || o >= n.length ?
|
|
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),
|
|
2152
|
+
}) : (t.handleTabChange(o), X(e, "focused"));
|
|
2045
2153
|
}
|
|
2046
|
-
function
|
|
2154
|
+
function Ws(e, t, o) {
|
|
2047
2155
|
const n = o?.trim();
|
|
2048
2156
|
if (!n)
|
|
2049
|
-
return
|
|
2050
|
-
const r =
|
|
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
|
|
2053
|
-
const s =
|
|
2054
|
-
|
|
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
|
|
2165
|
+
return X(e, s);
|
|
2059
2166
|
}
|
|
2060
|
-
function
|
|
2061
|
-
const
|
|
2062
|
-
if (!
|
|
2063
|
-
return
|
|
2064
|
-
const
|
|
2065
|
-
if (!
|
|
2066
|
-
return
|
|
2067
|
-
const { collectionId:
|
|
2068
|
-
const
|
|
2069
|
-
return
|
|
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
|
|
2072
|
-
collectionId:
|
|
2073
|
-
activeTabName:
|
|
2074
|
-
}),
|
|
2178
|
+
return o.openCollectionTab({
|
|
2179
|
+
collectionId: a,
|
|
2180
|
+
activeTabName: vt.COLLECTION_SETTINGS
|
|
2181
|
+
}), X(e, l ? "focused" : "opened");
|
|
2075
2182
|
}
|
|
2076
|
-
function
|
|
2077
|
-
const
|
|
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
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
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
|
|
2090
|
-
collectionId:
|
|
2091
|
-
workflowId:
|
|
2092
|
-
activeTabName:
|
|
2093
|
-
}),
|
|
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
|
|
2096
|
-
const
|
|
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
|
|
2205
|
+
return x("collectionId is required when action is open_step");
|
|
2101
2206
|
if (!l)
|
|
2102
|
-
return
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
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:
|
|
2220
|
+
workflowId: f,
|
|
2109
2221
|
stepId: m
|
|
2110
|
-
} =
|
|
2111
|
-
return
|
|
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:
|
|
2225
|
+
workflowId: f,
|
|
2114
2226
|
stepId: m,
|
|
2115
|
-
state:
|
|
2116
|
-
}),
|
|
2227
|
+
state: yt.Normal
|
|
2228
|
+
}), X(e, g ? "focused" : "opened");
|
|
2117
2229
|
}
|
|
2118
|
-
function
|
|
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(),
|
|
2234
|
+
}) : t.handleNewTabOpen(), X(e, "opened");
|
|
2123
2235
|
}
|
|
2124
|
-
function
|
|
2125
|
-
const o = e
|
|
2126
|
-
return n ?
|
|
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
|
|
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
|
|
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
|
|
2249
|
+
const Ys = {
|
|
2138
2250
|
name: "open_tab",
|
|
2139
|
-
definition:
|
|
2140
|
-
createExecutor: (e) =>
|
|
2141
|
-
},
|
|
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.`,
|
|
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
|
-
}),
|
|
2152
|
-
acknowledged:
|
|
2153
|
-
}),
|
|
2154
|
-
description:
|
|
2155
|
-
inputSchema:
|
|
2156
|
-
outputSchema:
|
|
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
|
|
2271
|
+
function Js() {
|
|
2160
2272
|
return async () => ({
|
|
2161
2273
|
isError: !1,
|
|
2162
2274
|
data: { acknowledged: !0 }
|
|
2163
2275
|
});
|
|
2164
2276
|
}
|
|
2165
|
-
const
|
|
2166
|
-
function
|
|
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
|
|
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
|
|
2173
|
-
|
|
2174
|
-
key: (e) =>
|
|
2175
|
-
warn:
|
|
2284
|
+
const ea = [
|
|
2285
|
+
Et({
|
|
2286
|
+
key: (e) => At(e.message),
|
|
2287
|
+
warn: Qs
|
|
2176
2288
|
}),
|
|
2177
|
-
|
|
2289
|
+
On({
|
|
2178
2290
|
warnAfter: 2,
|
|
2179
|
-
warnMessage:
|
|
2291
|
+
warnMessage: Xs,
|
|
2180
2292
|
blockAfter: 4,
|
|
2181
|
-
blockMessage:
|
|
2293
|
+
blockMessage: Zs
|
|
2182
2294
|
})
|
|
2183
|
-
],
|
|
2295
|
+
], ta = {
|
|
2184
2296
|
name: "report_status",
|
|
2185
|
-
definition:
|
|
2186
|
-
guards:
|
|
2187
|
-
createExecutor: (e) =>
|
|
2188
|
-
},
|
|
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.`,
|
|
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:
|
|
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
|
-
}),
|
|
2235
|
-
status:
|
|
2236
|
-
headers:
|
|
2237
|
-
cookies:
|
|
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:
|
|
2241
|
-
size:
|
|
2242
|
-
}),
|
|
2243
|
-
description:
|
|
2244
|
-
inputSchema:
|
|
2245
|
-
outputSchema:
|
|
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
|
|
2360
|
+
function ia(e, t) {
|
|
2249
2361
|
return async (n, r) => {
|
|
2250
|
-
const s =
|
|
2251
|
-
if (!
|
|
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:
|
|
2365
|
+
tabType: a?.data?.type
|
|
2254
2366
|
});
|
|
2255
|
-
const
|
|
2256
|
-
|
|
2257
|
-
|
|
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:
|
|
2269
|
-
workflowId:
|
|
2270
|
-
stepId:
|
|
2384
|
+
collectionId: l,
|
|
2385
|
+
workflowId: c,
|
|
2386
|
+
stepId: d
|
|
2271
2387
|
},
|
|
2272
|
-
hint:
|
|
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
|
|
2391
|
+
const v = t.get(b), I = {
|
|
2276
2392
|
collectionId: u || null,
|
|
2277
|
-
workflowId:
|
|
2393
|
+
workflowId: f || null,
|
|
2278
2394
|
stepId: m || null
|
|
2279
|
-
})
|
|
2280
|
-
|
|
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
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
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:
|
|
2434
|
+
data: ca(Me)
|
|
2287
2435
|
} : h("Request did not produce a response.");
|
|
2288
2436
|
};
|
|
2289
2437
|
}
|
|
2290
|
-
function
|
|
2438
|
+
function ca(e) {
|
|
2291
2439
|
return {
|
|
2292
2440
|
status: e.status,
|
|
2293
|
-
headers:
|
|
2294
|
-
cookies:
|
|
2295
|
-
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
|
|
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
|
|
2308
|
-
return e.length <=
|
|
2455
|
+
function la(e) {
|
|
2456
|
+
return e.length <= z ? e : `${e.slice(0, z)}… (truncated, total ${e.length} chars)`;
|
|
2309
2457
|
}
|
|
2310
|
-
const
|
|
2458
|
+
const da = {
|
|
2311
2459
|
name: "run_request",
|
|
2312
|
-
definition:
|
|
2313
|
-
createExecutor: (e) =>
|
|
2314
|
-
},
|
|
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.`,
|
|
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
|
-
}),
|
|
2488
|
+
}), fa = p({
|
|
2341
2489
|
stepId: i(),
|
|
2342
|
-
statusCode:
|
|
2343
|
-
passed:
|
|
2344
|
-
}),
|
|
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:
|
|
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:
|
|
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:
|
|
2357
|
-
totalSteps:
|
|
2358
|
-
passedSteps:
|
|
2359
|
-
steps:
|
|
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
|
-
}),
|
|
2363
|
-
description:
|
|
2364
|
-
inputSchema:
|
|
2365
|
-
outputSchema:
|
|
2510
|
+
}), ha = q(ma), wa = {
|
|
2511
|
+
description: ua,
|
|
2512
|
+
inputSchema: pa,
|
|
2513
|
+
outputSchema: ha,
|
|
2366
2514
|
needsApproval: !1
|
|
2367
2515
|
};
|
|
2368
|
-
function
|
|
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 =
|
|
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:
|
|
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:
|
|
2393
|
-
timedOut:
|
|
2540
|
+
success: d.succeeded,
|
|
2541
|
+
timedOut: d.timedOut,
|
|
2394
2542
|
durationMs: l.totalTimeMs,
|
|
2395
|
-
totalSteps:
|
|
2396
|
-
passedSteps:
|
|
2397
|
-
steps:
|
|
2398
|
-
stepId:
|
|
2399
|
-
statusCode:
|
|
2400
|
-
passed:
|
|
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
|
|
2559
|
+
const ya = {
|
|
2412
2560
|
name: "run_workflow",
|
|
2413
|
-
definition:
|
|
2414
|
-
createExecutor: (e) =>
|
|
2415
|
-
},
|
|
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:
|
|
2418
|
-
type:
|
|
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:
|
|
2422
|
-
|
|
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(),
|
|
2450
|
-
description:
|
|
2451
|
-
inputSchema:
|
|
2452
|
-
outputSchema:
|
|
2597
|
+
}).strict(), ka = fe(), Sa = {
|
|
2598
|
+
description: ga,
|
|
2599
|
+
inputSchema: ba,
|
|
2600
|
+
outputSchema: ka,
|
|
2453
2601
|
needsApproval: !1
|
|
2454
|
-
},
|
|
2455
|
-
function
|
|
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 =
|
|
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 =
|
|
2616
|
+
return a.length === 0 && (a = _a(e, r)), a.length === 0 ? {
|
|
2469
2617
|
isError: !1,
|
|
2470
2618
|
data: {
|
|
2471
|
-
message: `No results found. ${
|
|
2619
|
+
message: `No results found. ${Aa(t)}`
|
|
2472
2620
|
}
|
|
2473
2621
|
} : {
|
|
2474
2622
|
isError: !1,
|
|
2475
2623
|
data: {
|
|
2476
|
-
message:
|
|
2624
|
+
message: Ra(a, t.include)
|
|
2477
2625
|
}
|
|
2478
2626
|
};
|
|
2479
2627
|
};
|
|
2480
2628
|
}
|
|
2481
|
-
function
|
|
2482
|
-
const t = [], { type: o, apiId: n, path: r, method: s, operationId: a, collectionId: l, workflowId: c, stepId:
|
|
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 !== "",
|
|
2493
|
-
!v && !
|
|
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 ?
|
|
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 ?
|
|
2507
|
-
const v = a != null && a !== "",
|
|
2508
|
-
!v && !
|
|
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
|
-
|
|
2512
|
-
const
|
|
2513
|
-
let
|
|
2514
|
-
return
|
|
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
|
|
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
|
-
...
|
|
2522
|
-
...
|
|
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
|
|
2526
|
-
if (!
|
|
2527
|
-
const
|
|
2528
|
-
if (!(t.operationId && (
|
|
2529
|
-
return { path: n, method: c, op:
|
|
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,
|
|
2534
|
-
if (!
|
|
2535
|
-
const
|
|
2536
|
-
if (!(t.operationId && (
|
|
2537
|
-
return { path: n, method: c, op:
|
|
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
|
|
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((
|
|
2693
|
+
const l = e.find((g) => g.id === n);
|
|
2546
2694
|
if (!l) return [];
|
|
2547
2695
|
if (o === "api")
|
|
2548
|
-
return [{ ...
|
|
2549
|
-
const c = r != null && r !== "",
|
|
2550
|
-
if (!(o === "api_operation" || c ||
|
|
2551
|
-
return o == null ? [{ ...
|
|
2552
|
-
const
|
|
2553
|
-
return
|
|
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:
|
|
2557
|
-
method:
|
|
2558
|
-
op:
|
|
2559
|
-
pathItem:
|
|
2560
|
-
globalSchemes:
|
|
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
|
|
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((
|
|
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 [{ ...
|
|
2719
|
+
return [{ ...Ge(a).payload, score: 1 }];
|
|
2572
2720
|
const c = () => {
|
|
2573
2721
|
if (!r || !s) return [];
|
|
2574
|
-
const
|
|
2575
|
-
if (!
|
|
2576
|
-
const
|
|
2577
|
-
return
|
|
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
|
-
...
|
|
2727
|
+
...xo({
|
|
2580
2728
|
collectionId: n,
|
|
2581
2729
|
collectionTitle: l,
|
|
2582
2730
|
workflowId: r,
|
|
2583
|
-
workflowTitle:
|
|
2584
|
-
step:
|
|
2731
|
+
workflowTitle: u.summary ?? r,
|
|
2732
|
+
step: f
|
|
2585
2733
|
}).payload,
|
|
2586
2734
|
score: 1
|
|
2587
2735
|
}
|
|
2588
2736
|
] : [];
|
|
2589
|
-
},
|
|
2737
|
+
}, d = () => {
|
|
2590
2738
|
if (!r) return [];
|
|
2591
|
-
const
|
|
2592
|
-
return
|
|
2739
|
+
const u = a.workflows?.find((f) => (f.workflowId ?? "") === r);
|
|
2740
|
+
return u ? [
|
|
2593
2741
|
{
|
|
2594
|
-
|
|
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" ?
|
|
2747
|
+
return o === "step" ? c() : o === "workflow" ? d() : o == null ? s && r ? c() : r ? d() : [{ ...Ge(a).payload, score: 1 }] : [];
|
|
2600
2748
|
}
|
|
2601
|
-
function
|
|
2602
|
-
const o = e.
|
|
2603
|
-
return r === "api" || r === "api_operation" ?
|
|
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
|
|
2753
|
+
function Ra(e, t) {
|
|
2606
2754
|
return [
|
|
2607
|
-
|
|
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
|
|
2616
|
-
function
|
|
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
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
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,
|
|
2776
|
+
return t.every((o) => o == null) ? null : JSON.stringify([...t, Ua(e), Da(e)]);
|
|
2629
2777
|
}
|
|
2630
|
-
function
|
|
2631
|
-
return typeof e?.count == "number" ? e.count :
|
|
2778
|
+
function Ua(e) {
|
|
2779
|
+
return typeof e?.count == "number" ? e.count : Pa;
|
|
2632
2780
|
}
|
|
2633
|
-
function
|
|
2781
|
+
function Da(e) {
|
|
2634
2782
|
return Array.isArray(e?.include) ? [...new Set(e.include)].sort() : [];
|
|
2635
2783
|
}
|
|
2636
|
-
function
|
|
2784
|
+
function D(e) {
|
|
2637
2785
|
if (typeof e != "string") return null;
|
|
2638
|
-
const t =
|
|
2786
|
+
const t = At(e);
|
|
2639
2787
|
return t === "" ? null : t;
|
|
2640
2788
|
}
|
|
2641
|
-
const
|
|
2642
|
-
|
|
2643
|
-
key:
|
|
2644
|
-
warn:
|
|
2789
|
+
const Wa = [
|
|
2790
|
+
Et({
|
|
2791
|
+
key: Na,
|
|
2792
|
+
warn: qa
|
|
2645
2793
|
})
|
|
2646
|
-
],
|
|
2794
|
+
], La = {
|
|
2647
2795
|
name: "search",
|
|
2648
|
-
definition:
|
|
2649
|
-
guards:
|
|
2650
|
-
createExecutor: (e) =>
|
|
2651
|
-
},
|
|
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
|
-
],
|
|
2659
|
-
grantType:
|
|
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
|
-
},
|
|
2816
|
+
}, Fa = p({
|
|
2669
2817
|
username: i().optional(),
|
|
2670
2818
|
password: i().optional()
|
|
2671
|
-
}).strict(),
|
|
2819
|
+
}).strict(), Ya = p({
|
|
2672
2820
|
username: i().optional(),
|
|
2673
2821
|
password: i().optional()
|
|
2674
|
-
}).strict(),
|
|
2822
|
+
}).strict(), za = p({
|
|
2675
2823
|
token: i().optional()
|
|
2676
|
-
}).strict(),
|
|
2677
|
-
location:
|
|
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(),
|
|
2685
|
-
...
|
|
2686
|
-
}).strict(),
|
|
2832
|
+
}).strict(), Dt = p({
|
|
2833
|
+
...Ba
|
|
2834
|
+
}).strict(), Ga = Dt.extend({
|
|
2687
2835
|
openIdConnectUrl: i().optional(),
|
|
2688
2836
|
userInfoUrl: i().optional()
|
|
2689
|
-
}).strict(),
|
|
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
|
-
),
|
|
2692
|
-
action:
|
|
2839
|
+
), B = Pn.extend({
|
|
2840
|
+
action: E(["add", "update"]),
|
|
2693
2841
|
schemeId: i().optional(),
|
|
2694
|
-
stepId:
|
|
2695
|
-
}),
|
|
2696
|
-
|
|
2697
|
-
type:
|
|
2698
|
-
data:
|
|
2842
|
+
stepId: Wt
|
|
2843
|
+
}), Va = me("type", [
|
|
2844
|
+
B.extend({
|
|
2845
|
+
type: w(k.BasicAuth),
|
|
2846
|
+
data: Fa.optional()
|
|
2699
2847
|
}).strict(),
|
|
2700
|
-
|
|
2701
|
-
type:
|
|
2702
|
-
data:
|
|
2848
|
+
B.extend({
|
|
2849
|
+
type: w(k.DigestAuth),
|
|
2850
|
+
data: Ya.optional()
|
|
2703
2851
|
}).strict(),
|
|
2704
|
-
|
|
2705
|
-
type:
|
|
2706
|
-
data:
|
|
2852
|
+
B.extend({
|
|
2853
|
+
type: w(k.JWT),
|
|
2854
|
+
data: za.optional()
|
|
2707
2855
|
}).strict(),
|
|
2708
|
-
|
|
2709
|
-
type:
|
|
2710
|
-
data:
|
|
2856
|
+
B.extend({
|
|
2857
|
+
type: w(k.APIKey),
|
|
2858
|
+
data: Ha.optional()
|
|
2711
2859
|
}).strict(),
|
|
2712
|
-
|
|
2713
|
-
type:
|
|
2714
|
-
data:
|
|
2860
|
+
B.extend({
|
|
2861
|
+
type: w(k.OAuth2),
|
|
2862
|
+
data: Dt.optional()
|
|
2715
2863
|
}).strict(),
|
|
2716
|
-
|
|
2717
|
-
type:
|
|
2718
|
-
data:
|
|
2864
|
+
B.extend({
|
|
2865
|
+
type: w(k.OpenIDConnect),
|
|
2866
|
+
data: Ga.optional()
|
|
2719
2867
|
}).strict()
|
|
2720
|
-
]),
|
|
2721
|
-
action:
|
|
2722
|
-
index:
|
|
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:
|
|
2726
|
-
}).strict(),
|
|
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:
|
|
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((
|
|
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:
|
|
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
|
-
}),
|
|
2745
|
-
description:
|
|
2746
|
-
inputSchema:
|
|
2747
|
-
outputSchema:
|
|
2892
|
+
}), Xa = xt, Za = {
|
|
2893
|
+
description: Ma,
|
|
2894
|
+
inputSchema: Qa,
|
|
2895
|
+
outputSchema: Xa,
|
|
2748
2896
|
needsApproval: () => !0
|
|
2749
|
-
},
|
|
2897
|
+
}, _ = {
|
|
2750
2898
|
ADD: "add",
|
|
2751
2899
|
UPDATE: "update",
|
|
2752
2900
|
REMOVE: "remove"
|
|
2753
2901
|
};
|
|
2754
|
-
function
|
|
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
|
|
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
|
|
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
|
|
2776
|
-
function
|
|
2777
|
-
return e.type ===
|
|
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
|
|
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
|
|
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" &&
|
|
2788
|
-
const n = e[e.grantType], r = new Set(Object.keys(
|
|
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
|
|
2793
|
-
return e.securityType ===
|
|
2940
|
+
function Mt(e) {
|
|
2941
|
+
return e.securityType === k.NoAuth ? null : e[e.securityType]?.schemeName ?? null;
|
|
2794
2942
|
}
|
|
2795
|
-
function
|
|
2796
|
-
!t || e.securityType ===
|
|
2943
|
+
function ni(e, t) {
|
|
2944
|
+
!t || e.securityType === k.NoAuth || (e.securitySchemeId = t, e[e.securityType].schemeName = t);
|
|
2797
2945
|
}
|
|
2798
|
-
function
|
|
2799
|
-
if (e.securityType = t.type,
|
|
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
|
|
2802
|
-
case
|
|
2803
|
-
case
|
|
2804
|
-
|
|
2949
|
+
case k.BasicAuth:
|
|
2950
|
+
case k.DigestAuth:
|
|
2951
|
+
case k.JWT:
|
|
2952
|
+
at(e[t.type], t.data);
|
|
2805
2953
|
break;
|
|
2806
|
-
case
|
|
2954
|
+
case k.APIKey: {
|
|
2807
2955
|
const { location: o, ...n } = t.data;
|
|
2808
|
-
|
|
2956
|
+
at(e[k.APIKey], n), o && (e[k.APIKey].location = uo(o));
|
|
2809
2957
|
break;
|
|
2810
2958
|
}
|
|
2811
|
-
case
|
|
2812
|
-
|
|
2959
|
+
case k.OAuth2:
|
|
2960
|
+
it(e[k.OAuth2], t.data);
|
|
2813
2961
|
break;
|
|
2814
|
-
case
|
|
2962
|
+
case k.OpenIDConnect: {
|
|
2815
2963
|
const { openIdConnectUrl: o, userInfoUrl: n, ...r } = t.data;
|
|
2816
|
-
|
|
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
|
|
2970
|
+
function ri(e, t) {
|
|
2823
2971
|
return t.schemeId ? e.findIndex(
|
|
2824
|
-
(o) => o.securitySchemeId === 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
|
|
2975
|
+
function si(e) {
|
|
2828
2976
|
return e.data ? Object.entries(e.data).some(
|
|
2829
|
-
([t, o]) => o !== void 0 && !
|
|
2977
|
+
([t, o]) => o !== void 0 && !ti.has(t)
|
|
2830
2978
|
) : !1;
|
|
2831
2979
|
}
|
|
2832
|
-
function
|
|
2980
|
+
function ai(e) {
|
|
2833
2981
|
return e.schemeId ? `${e.type} (scheme '${e.schemeId}')` : e.type;
|
|
2834
2982
|
}
|
|
2835
|
-
function
|
|
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
|
|
2989
|
+
function ii(e, t, o) {
|
|
2842
2990
|
let n = e;
|
|
2843
2991
|
const r = [], s = t.filter(
|
|
2844
|
-
(c) => c.action !==
|
|
2992
|
+
(c) => c.action !== _.REMOVE
|
|
2845
2993
|
), a = t.filter(
|
|
2846
|
-
(c) => c.action ===
|
|
2994
|
+
(c) => c.action === _.REMOVE
|
|
2847
2995
|
), l = /* @__PURE__ */ new Set();
|
|
2848
2996
|
for (const c of a) {
|
|
2849
|
-
const
|
|
2850
|
-
if (!
|
|
2851
|
-
l.add(
|
|
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 ===
|
|
2855
|
-
const
|
|
2856
|
-
if (
|
|
2857
|
-
const v = n[
|
|
2858
|
-
if (
|
|
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 ${
|
|
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[
|
|
3012
|
+
n = [...n], n[m] = be(
|
|
2865
3013
|
structuredClone(v),
|
|
2866
3014
|
c
|
|
2867
3015
|
), r.push(
|
|
2868
|
-
|
|
3016
|
+
y(
|
|
2869
3017
|
"applied",
|
|
2870
|
-
`Updated existing ${
|
|
3018
|
+
`Updated existing ${ai(c)} in place (index: ${m})${o}`
|
|
2871
3019
|
)
|
|
2872
3020
|
);
|
|
2873
3021
|
continue;
|
|
2874
3022
|
}
|
|
2875
|
-
if (
|
|
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 "${
|
|
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
|
|
2881
|
-
n =
|
|
2882
|
-
|
|
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
|
|
2897
|
-
if (
|
|
2898
|
-
if (
|
|
2899
|
-
const
|
|
2900
|
-
if (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 ${
|
|
3051
|
+
message: `schemeId mismatch at index ${c.index}. Expected ${f ?? "none"}.`
|
|
2904
3052
|
};
|
|
2905
3053
|
}
|
|
2906
|
-
n = [...n], n[c.index] =
|
|
2907
|
-
|
|
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((
|
|
3059
|
+
const c = n.filter((u) => !l.has(u)), d = n.length - c.length;
|
|
2912
3060
|
n = c;
|
|
2913
|
-
for (let
|
|
2914
|
-
r.push(
|
|
3061
|
+
for (let u = 0; u < d; u++)
|
|
3062
|
+
r.push(y("applied"));
|
|
2915
3063
|
}
|
|
2916
|
-
return n.length === 0 && (n = [
|
|
3064
|
+
return n.length === 0 && (n = [je()]), { ok: !0, security: n, applied: r };
|
|
2917
3065
|
}
|
|
2918
|
-
function
|
|
3066
|
+
function ci(e) {
|
|
2919
3067
|
return async (t) => {
|
|
2920
|
-
const { changes: o, collectionId: n, workflowId: r, stepId: s } = t, a =
|
|
2921
|
-
for (const
|
|
2922
|
-
const
|
|
2923
|
-
v ? v.push(
|
|
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
|
|
2926
|
-
for (const [
|
|
2927
|
-
const v =
|
|
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
|
|
2931
|
-
|
|
2932
|
-
),
|
|
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
|
|
2937
|
-
|
|
2938
|
-
const
|
|
2939
|
-
${
|
|
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:
|
|
2948
|
-
resultingState:
|
|
3093
|
+
applied: d,
|
|
3094
|
+
resultingState: f
|
|
2949
3095
|
}
|
|
2950
3096
|
};
|
|
2951
3097
|
};
|
|
2952
3098
|
}
|
|
2953
|
-
const
|
|
3099
|
+
const li = {
|
|
2954
3100
|
name: "update_security",
|
|
2955
|
-
definition:
|
|
2956
|
-
createExecutor: (e) =>
|
|
2957
|
-
},
|
|
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 ${
|
|
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
|
-
`,
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
],
|
|
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:
|
|
3143
|
+
in: E(["path", "query", "header", "cookie"]),
|
|
2998
3144
|
value: i()
|
|
2999
|
-
}).strict(),
|
|
3145
|
+
}).strict(), mi = p({
|
|
3000
3146
|
condition: i().min(1),
|
|
3001
3147
|
context: i().optional().describe("Context for the expression."),
|
|
3002
|
-
type:
|
|
3003
|
-
}).strict(),
|
|
3004
|
-
field:
|
|
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(),
|
|
3007
|
-
field:
|
|
3152
|
+
}).strict(), wi = L.extend({
|
|
3153
|
+
field: w("description"),
|
|
3008
3154
|
data: i().describe("New step description text.")
|
|
3009
|
-
}).strict(),
|
|
3010
|
-
field:
|
|
3011
|
-
data:
|
|
3012
|
-
}).strict(),
|
|
3013
|
-
field:
|
|
3014
|
-
data:
|
|
3015
|
-
}).strict(),
|
|
3016
|
-
field:
|
|
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(),
|
|
3022
|
-
field:
|
|
3023
|
-
data:
|
|
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(),
|
|
3027
|
-
field:
|
|
3172
|
+
}).strict(), bi = L.extend({
|
|
3173
|
+
field: w("body"),
|
|
3028
3174
|
data: p({
|
|
3029
|
-
contentType:
|
|
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(),
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
]),
|
|
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:
|
|
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:
|
|
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
|
-
}),
|
|
3061
|
-
description:
|
|
3062
|
-
inputSchema:
|
|
3063
|
-
outputSchema:
|
|
3206
|
+
}), Ti = xt, Ci = {
|
|
3207
|
+
description: di,
|
|
3208
|
+
inputSchema: Si,
|
|
3209
|
+
outputSchema: Ti,
|
|
3064
3210
|
needsApproval: () => !0
|
|
3065
3211
|
};
|
|
3066
|
-
function
|
|
3212
|
+
function Oi(e) {
|
|
3067
3213
|
return e.replace(/\{\{([^{}\s]+)\}\}/g, "{$1}");
|
|
3068
3214
|
}
|
|
3069
|
-
function
|
|
3070
|
-
return
|
|
3215
|
+
function ke(e) {
|
|
3216
|
+
return re[e];
|
|
3071
3217
|
}
|
|
3072
|
-
function
|
|
3218
|
+
function Se(e, t) {
|
|
3073
3219
|
return e.id === t;
|
|
3074
3220
|
}
|
|
3075
|
-
function
|
|
3221
|
+
function lt(e, t) {
|
|
3076
3222
|
return e.condition === t;
|
|
3077
3223
|
}
|
|
3078
|
-
function
|
|
3079
|
-
return
|
|
3224
|
+
function Te(e, t) {
|
|
3225
|
+
return Ae(e) && e.id === t;
|
|
3080
3226
|
}
|
|
3081
|
-
function
|
|
3082
|
-
return { ...
|
|
3227
|
+
function dt(e, t, o) {
|
|
3228
|
+
return { ...ft(e), key: t, value: o, active: !0 };
|
|
3083
3229
|
}
|
|
3084
|
-
function
|
|
3085
|
-
e
|
|
3230
|
+
function Ue(e, t) {
|
|
3231
|
+
e((o) => [...o, ...t]);
|
|
3086
3232
|
}
|
|
3087
|
-
function
|
|
3233
|
+
function ce(e, t, o) {
|
|
3088
3234
|
let n = !1;
|
|
3089
|
-
return e
|
|
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
|
|
3242
|
+
function De(e, t, o) {
|
|
3097
3243
|
let n = !1;
|
|
3098
|
-
return e
|
|
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
|
|
3249
|
+
function Ai(e, { readStep: t, updateParameters: o }) {
|
|
3104
3250
|
switch (e.action) {
|
|
3105
|
-
case
|
|
3251
|
+
case _.ADD: {
|
|
3106
3252
|
if (!e.data)
|
|
3107
|
-
return
|
|
3108
|
-
const { in:
|
|
3109
|
-
return
|
|
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 ${
|
|
3257
|
+
`Added ${n} parameter '${r}' (id: ${l.id})`
|
|
3112
3258
|
);
|
|
3113
3259
|
}
|
|
3114
|
-
case
|
|
3260
|
+
case _.UPDATE: {
|
|
3115
3261
|
if (!e.id)
|
|
3116
|
-
return
|
|
3262
|
+
return y("failed", "Failed parameter update because id is missing.");
|
|
3117
3263
|
if (!e.data)
|
|
3118
|
-
return
|
|
3119
|
-
const { in:
|
|
3120
|
-
return
|
|
3121
|
-
find:
|
|
3122
|
-
produce: (
|
|
3123
|
-
...
|
|
3124
|
-
id:
|
|
3125
|
-
...
|
|
3126
|
-
} :
|
|
3127
|
-
}) ?
|
|
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
|
|
3275
|
+
case _.REMOVE: {
|
|
3130
3276
|
if (!e.id)
|
|
3131
|
-
return
|
|
3132
|
-
const
|
|
3133
|
-
let
|
|
3134
|
-
for (const
|
|
3135
|
-
if (t.parameters[
|
|
3136
|
-
|
|
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
|
|
3285
|
+
return a ? y("applied") : y("failed", `Parameter with id '${n}' not found.`);
|
|
3140
3286
|
}
|
|
3141
3287
|
}
|
|
3142
3288
|
}
|
|
3143
|
-
function
|
|
3289
|
+
function Ei(e, { readStep: t, updateOutputs: o }) {
|
|
3144
3290
|
switch (e.action) {
|
|
3145
|
-
case
|
|
3291
|
+
case _.ADD: {
|
|
3146
3292
|
if (!e.data)
|
|
3147
|
-
return
|
|
3148
|
-
const { name:
|
|
3149
|
-
if (
|
|
3150
|
-
return
|
|
3151
|
-
find:
|
|
3152
|
-
produce: (
|
|
3153
|
-
}),
|
|
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 '${
|
|
3301
|
+
`Updated existing output '${n}' in place (id: ${s.id})`
|
|
3156
3302
|
);
|
|
3157
|
-
const
|
|
3158
|
-
return
|
|
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
|
|
3306
|
+
case _.UPDATE: {
|
|
3161
3307
|
if (!e.id)
|
|
3162
|
-
return
|
|
3308
|
+
return y("failed", "Failed output update because id is missing.");
|
|
3163
3309
|
if (!e.data)
|
|
3164
|
-
return
|
|
3165
|
-
const { name:
|
|
3166
|
-
return
|
|
3167
|
-
find:
|
|
3168
|
-
produce: (
|
|
3169
|
-
}) ?
|
|
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
|
|
3172
|
-
return e.id ?
|
|
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
|
|
3321
|
+
function xi(e, { updateSuccessCriteria: t }) {
|
|
3176
3322
|
switch (e.action) {
|
|
3177
|
-
case
|
|
3323
|
+
case _.ADD: {
|
|
3178
3324
|
if (!e.data)
|
|
3179
|
-
return
|
|
3180
|
-
const { condition: o, context: n, type: r } = e.data, s =
|
|
3181
|
-
r ??
|
|
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
|
|
3329
|
+
return Ue(t, [
|
|
3184
3330
|
{
|
|
3185
3331
|
...s,
|
|
3186
3332
|
condition: o,
|
|
3187
3333
|
...n !== void 0 && { context: n }
|
|
3188
3334
|
}
|
|
3189
|
-
]),
|
|
3335
|
+
]), y("applied");
|
|
3190
3336
|
}
|
|
3191
|
-
case
|
|
3337
|
+
case _.UPDATE: {
|
|
3192
3338
|
if (typeof e.id != "string")
|
|
3193
|
-
return
|
|
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
|
|
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
|
|
3204
|
-
find:
|
|
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 ??
|
|
3356
|
+
type: r ?? a.type ?? Ce.SIMPLE
|
|
3211
3357
|
})
|
|
3212
|
-
}) ?
|
|
3358
|
+
}) ? y("applied") : y(
|
|
3213
3359
|
"failed",
|
|
3214
3360
|
`Success criterion with condition '${e.id}' not found.`
|
|
3215
3361
|
);
|
|
3216
3362
|
}
|
|
3217
|
-
case
|
|
3218
|
-
return typeof e.id != "string" ?
|
|
3363
|
+
case _.REMOVE:
|
|
3364
|
+
return typeof e.id != "string" ? y(
|
|
3219
3365
|
"failed",
|
|
3220
3366
|
"Failed success criteria remove because id is missing."
|
|
3221
|
-
) :
|
|
3222
|
-
t
|
|
3367
|
+
) : De(
|
|
3368
|
+
t,
|
|
3223
3369
|
e.id,
|
|
3224
|
-
|
|
3225
|
-
) ?
|
|
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
|
-
|
|
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 =
|
|
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
|
-
(
|
|
3239
|
-
) && c.operation
|
|
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
|
|
3244
|
-
for (const
|
|
3245
|
-
switch (
|
|
3401
|
+
const g = [];
|
|
3402
|
+
for (const I of o)
|
|
3403
|
+
switch (I.field) {
|
|
3246
3404
|
case "method":
|
|
3247
3405
|
case "url": {
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
else {
|
|
3255
|
-
const
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
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
|
-
|
|
3426
|
+
g.push(y("applied"));
|
|
3266
3427
|
break;
|
|
3267
3428
|
}
|
|
3268
|
-
case "description":
|
|
3269
|
-
|
|
3429
|
+
case "description": {
|
|
3430
|
+
const O = I.data;
|
|
3431
|
+
u((S) => ({ ...S, description: O })), g.push(y("applied"));
|
|
3270
3432
|
break;
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
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
|
-
|
|
3447
|
+
g.push(Ai(I, f));
|
|
3279
3448
|
break;
|
|
3280
3449
|
case "outputs":
|
|
3281
|
-
|
|
3450
|
+
g.push(Ei(I, f));
|
|
3282
3451
|
break;
|
|
3283
3452
|
case "successCriteria":
|
|
3284
|
-
|
|
3453
|
+
g.push(xi(I, f));
|
|
3285
3454
|
break;
|
|
3286
3455
|
}
|
|
3287
|
-
const
|
|
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:
|
|
3294
|
-
...
|
|
3295
|
-
resultingState:
|
|
3462
|
+
applied: g,
|
|
3463
|
+
...v && {
|
|
3464
|
+
resultingState: _e(d().outputs) || "Outputs: (none)"
|
|
3296
3465
|
}
|
|
3297
3466
|
}
|
|
3298
3467
|
};
|
|
3299
3468
|
};
|
|
3300
3469
|
}
|
|
3301
|
-
const
|
|
3470
|
+
const _i = {
|
|
3302
3471
|
name: "update_step",
|
|
3303
|
-
definition:
|
|
3304
|
-
createExecutor: (e) =>
|
|
3305
|
-
},
|
|
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.`,
|
|
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
|
-
}),
|
|
3326
|
-
description:
|
|
3327
|
-
inputSchema:
|
|
3328
|
-
outputSchema:
|
|
3494
|
+
}), Pi = fe(), Ni = {
|
|
3495
|
+
description: Ri,
|
|
3496
|
+
inputSchema: qi,
|
|
3497
|
+
outputSchema: Pi,
|
|
3329
3498
|
needsApproval: !0
|
|
3330
|
-
},
|
|
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
|
-
`,
|
|
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
|
-
`,
|
|
3514
|
+
`, Wi = Io(
|
|
3346
3515
|
//
|
|
3347
|
-
|
|
3348
|
-
|
|
3516
|
+
Ye("role", Ui),
|
|
3517
|
+
Ye("output", Di)
|
|
3349
3518
|
);
|
|
3350
|
-
function
|
|
3351
|
-
return [
|
|
3519
|
+
function Li() {
|
|
3520
|
+
return [yo(Wi)];
|
|
3352
3521
|
}
|
|
3353
|
-
function
|
|
3354
|
-
const t =
|
|
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
|
|
3529
|
+
message: await To({
|
|
3361
3530
|
model: o,
|
|
3362
|
-
system:
|
|
3363
|
-
prompt:
|
|
3531
|
+
system: Li(),
|
|
3532
|
+
prompt: ji(n),
|
|
3364
3533
|
tools: t,
|
|
3365
3534
|
toolChoice: "required",
|
|
3366
|
-
stopWhen:
|
|
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
|
|
3381
|
-
return
|
|
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
|
|
3559
|
+
const Bi = {
|
|
3391
3560
|
name: "web_search",
|
|
3392
|
-
definition:
|
|
3393
|
-
createExecutor: (e) =>
|
|
3394
|
-
},
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
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
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3570
|
+
_i,
|
|
3571
|
+
Hn,
|
|
3572
|
+
Fr,
|
|
3573
|
+
Ss,
|
|
3574
|
+
Bi,
|
|
3575
|
+
fr
|
|
3407
3576
|
];
|
|
3408
|
-
function
|
|
3409
|
-
return
|
|
3577
|
+
function Fi(e) {
|
|
3578
|
+
return jt.some((t) => t.name === e);
|
|
3410
3579
|
}
|
|
3411
|
-
function
|
|
3412
|
-
for (const o of
|
|
3580
|
+
function ic(e, t) {
|
|
3581
|
+
for (const o of jt)
|
|
3413
3582
|
e.register(
|
|
3414
|
-
|
|
3583
|
+
$n(
|
|
3415
3584
|
o,
|
|
3416
3585
|
t[o.name]
|
|
3417
3586
|
)
|
|
3418
3587
|
);
|
|
3419
3588
|
}
|
|
3420
|
-
function
|
|
3589
|
+
function Yi(e) {
|
|
3421
3590
|
const t = e.startsWith("tool-") ? e.slice(5) : e;
|
|
3422
|
-
return
|
|
3591
|
+
return Fi(t) ? t : void 0;
|
|
3423
3592
|
}
|
|
3424
|
-
function
|
|
3593
|
+
function zi(e, t) {
|
|
3425
3594
|
return `${e}::${t}`;
|
|
3426
3595
|
}
|
|
3427
|
-
function
|
|
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
|
|
3599
|
+
function Le(e) {
|
|
3431
3600
|
return e.state === "approval-requested" && e.approval?.id != null;
|
|
3432
3601
|
}
|
|
3433
|
-
function
|
|
3602
|
+
function Hi(e) {
|
|
3434
3603
|
return e.state === "output-denied" ? !0 : e.state === "output-available" && e.approval != null;
|
|
3435
3604
|
}
|
|
3436
|
-
function
|
|
3437
|
-
return e.parts.some((t) =>
|
|
3605
|
+
function Bt(e) {
|
|
3606
|
+
return e.parts.some((t) => We(t) && Le(t));
|
|
3438
3607
|
}
|
|
3439
|
-
function
|
|
3440
|
-
return e.some(
|
|
3608
|
+
function cc(e) {
|
|
3609
|
+
return e.some(Bt);
|
|
3441
3610
|
}
|
|
3442
|
-
function
|
|
3611
|
+
function lc(e) {
|
|
3443
3612
|
return e.map(
|
|
3444
|
-
(t) =>
|
|
3613
|
+
(t) => Bt(t) ? { ...t, parts: t.parts.map(Gi) } : t
|
|
3445
3614
|
);
|
|
3446
3615
|
}
|
|
3447
|
-
function
|
|
3448
|
-
return !
|
|
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
|
|
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
|
|
3468
|
-
|
|
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
|
|
3477
|
-
|
|
3645
|
+
const u = c.text ?? "";
|
|
3646
|
+
u.length > 0 && t.push({
|
|
3478
3647
|
kind: "text",
|
|
3479
|
-
text:
|
|
3648
|
+
text: u,
|
|
3480
3649
|
key: `text-${l}`,
|
|
3481
3650
|
workflowRunHistoryIds: Object.fromEntries(
|
|
3482
|
-
Object.entries(r).map(([
|
|
3651
|
+
Object.entries(r).map(([f, m]) => [f, [...m]])
|
|
3483
3652
|
)
|
|
3484
3653
|
});
|
|
3485
3654
|
continue;
|
|
3486
3655
|
}
|
|
3487
|
-
if (!
|
|
3656
|
+
if (!We(c))
|
|
3488
3657
|
continue;
|
|
3489
|
-
const
|
|
3490
|
-
if (
|
|
3491
|
-
const
|
|
3492
|
-
if (
|
|
3493
|
-
const
|
|
3494
|
-
|
|
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 (
|
|
3498
|
-
const
|
|
3499
|
-
|
|
3666
|
+
if (d === qo) {
|
|
3667
|
+
const u = Ji(c.input);
|
|
3668
|
+
u && a(u);
|
|
3500
3669
|
continue;
|
|
3501
3670
|
}
|
|
3502
|
-
if (
|
|
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
|
|
3510
|
-
isError:
|
|
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
|
|
3686
|
+
function Ki(e) {
|
|
3518
3687
|
if (e.state !== "output-available")
|
|
3519
3688
|
return;
|
|
3520
|
-
const t =
|
|
3689
|
+
const t = Vi.safeParse(e.output);
|
|
3521
3690
|
return t.success ? t.data.data : void 0;
|
|
3522
3691
|
}
|
|
3523
|
-
function
|
|
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
|
|
3701
|
+
function uc(e) {
|
|
3533
3702
|
return e.filter((t) => t.type === "text").map((t) => t.text ?? "").join("");
|
|
3534
3703
|
}
|
|
3535
|
-
function
|
|
3536
|
-
return
|
|
3537
|
-
queryKey:
|
|
3538
|
-
queryFn: async () => e ? await
|
|
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
|
|
3543
|
-
return
|
|
3544
|
-
queryKey:
|
|
3711
|
+
function fc(e) {
|
|
3712
|
+
return _o({
|
|
3713
|
+
queryKey: bt.infiniteHistory(e),
|
|
3545
3714
|
initialPageParam: 0,
|
|
3546
|
-
queryFn: async ({ pageParam: t }) =>
|
|
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
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
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
|
};
|