avantgate 1.4.0 → 1.5.0
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/agent/types.d.ts +1 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/{chunk-DTM2OLCG.mjs → chunk-4XWO3NZW.mjs} +69 -18
- package/dist/index.js +71 -18
- package/dist/index.mjs +6 -2
- package/dist/workflow/define-workflow.d.ts +1 -1
- package/dist/workflow/define-workflow.d.ts.map +1 -1
- package/dist/workflow/engine.d.ts +1 -1
- package/dist/workflow/engine.d.ts.map +1 -1
- package/dist/workflow/errors.d.ts +7 -0
- package/dist/workflow/errors.d.ts.map +1 -1
- package/dist/workflow/index.d.ts +1 -1
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/index.js +73 -20
- package/dist/workflow/index.mjs +7 -3
- package/dist/workflow/types.d.ts +4 -1
- package/dist/workflow/types.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/agent/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { z } from "zod";
|
|
|
2
2
|
/**
|
|
3
3
|
* Lifecycle status for durable agent workflow steps.
|
|
4
4
|
*/
|
|
5
|
-
export type StepStatus = "PENDING" | "RUNNING" | "COMPLETED" | "FAILED" | "WAITING_APPROVAL";
|
|
5
|
+
export type StepStatus = "PENDING" | "RUNNING" | "COMPLETED" | "FAILED" | "WAITING_APPROVAL" | "ABORTED";
|
|
6
6
|
/**
|
|
7
7
|
* Token usage metrics for LLM calls and tool executions.
|
|
8
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agent/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,SAAS,GACT,WAAW,GACX,QAAQ,GACR,kBAAkB,CAAC;
|
|
1
|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AAM,EAAE,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,IAAI,EAAE,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,WAAW,CACT,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,EAAE,WAAW,GACnB,cAAc,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;CACjD"}
|
|
@@ -33,21 +33,35 @@ var WorkflowValidationError = class extends Error {
|
|
|
33
33
|
this.issues = issues;
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
+
var WorkflowAbortSignal = class extends Error {
|
|
37
|
+
__isWorkflowAbort = true;
|
|
38
|
+
reason;
|
|
39
|
+
payload;
|
|
40
|
+
constructor(reason, payload) {
|
|
41
|
+
super(`Workflow aborted: ${reason}`);
|
|
42
|
+
this.name = "WorkflowAbortSignal";
|
|
43
|
+
this.reason = reason;
|
|
44
|
+
this.payload = payload;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var isWorkflowAbortSignal = (value) => {
|
|
48
|
+
return typeof value === "object" && value !== null && value.__isWorkflowAbort === true;
|
|
49
|
+
};
|
|
36
50
|
|
|
37
51
|
// src/workflow/engine.ts
|
|
38
|
-
|
|
52
|
+
var generateRunId = (workflowId) => {
|
|
39
53
|
const timestamp = Date.now();
|
|
40
54
|
const randomSuffix = Math.random().toString(36).substring(2, 9);
|
|
41
55
|
return `run_${workflowId}_${timestamp}_${randomSuffix}`;
|
|
42
|
-
}
|
|
43
|
-
|
|
56
|
+
};
|
|
57
|
+
var validateInput = (config, input) => {
|
|
44
58
|
const parseResult = config.inputSchema.safeParse(input);
|
|
45
59
|
if (!parseResult.success) {
|
|
46
60
|
throw new WorkflowValidationError(config.id, parseResult.error.issues);
|
|
47
61
|
}
|
|
48
62
|
return parseResult.data;
|
|
49
|
-
}
|
|
50
|
-
|
|
63
|
+
};
|
|
64
|
+
var createStepContext = (params) => {
|
|
51
65
|
const { workflowId, stepId, runId, context, stepResults } = params;
|
|
52
66
|
return {
|
|
53
67
|
workflowId,
|
|
@@ -76,10 +90,13 @@ function createStepContext(params) {
|
|
|
76
90
|
});
|
|
77
91
|
}
|
|
78
92
|
throw new StepSuspendedError(stepId, workflowId, options?.prompt);
|
|
93
|
+
},
|
|
94
|
+
abort: (reason, payload) => {
|
|
95
|
+
throw new WorkflowAbortSignal(reason, payload);
|
|
79
96
|
}
|
|
80
97
|
};
|
|
81
|
-
}
|
|
82
|
-
async
|
|
98
|
+
};
|
|
99
|
+
var rollbackSaga = async (params) => {
|
|
83
100
|
const {
|
|
84
101
|
workflowId,
|
|
85
102
|
failedStepId,
|
|
@@ -123,12 +140,38 @@ async function rollbackSaga(params) {
|
|
|
123
140
|
compensatedSteps,
|
|
124
141
|
failedCompensations
|
|
125
142
|
});
|
|
126
|
-
}
|
|
127
|
-
async
|
|
143
|
+
};
|
|
144
|
+
var executeWorkflow = async (config, rawInput, context) => {
|
|
128
145
|
const input = validateInput(config, rawInput);
|
|
129
146
|
const runId = context?.runId ?? generateRunId(config.id);
|
|
130
147
|
const stepResults = {};
|
|
131
148
|
const completedSteps = [];
|
|
149
|
+
const handleAbort = async (stepId, signal) => {
|
|
150
|
+
stepResults[stepId] = {
|
|
151
|
+
aborted: true,
|
|
152
|
+
reason: signal.reason,
|
|
153
|
+
payload: signal.payload
|
|
154
|
+
};
|
|
155
|
+
if (context?.storage) {
|
|
156
|
+
await context.storage.updateStepStatus(config.id, stepId, "ABORTED", {
|
|
157
|
+
result: signal.payload,
|
|
158
|
+
metadata: { abortReason: signal.reason }
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
const abortOutput = signal.payload ?? {
|
|
162
|
+
aborted: true,
|
|
163
|
+
reason: signal.reason
|
|
164
|
+
};
|
|
165
|
+
return {
|
|
166
|
+
workflowId: config.id,
|
|
167
|
+
runId,
|
|
168
|
+
status: "ABORTED",
|
|
169
|
+
stepResults,
|
|
170
|
+
abortReason: signal.reason,
|
|
171
|
+
abortPayload: signal.payload,
|
|
172
|
+
output: abortOutput
|
|
173
|
+
};
|
|
174
|
+
};
|
|
132
175
|
for (const step of config.steps) {
|
|
133
176
|
const stepCtx = createStepContext({
|
|
134
177
|
workflowId: config.id,
|
|
@@ -139,6 +182,9 @@ async function executeWorkflow(config, rawInput, context) {
|
|
|
139
182
|
});
|
|
140
183
|
try {
|
|
141
184
|
const result = await step.execute(input, stepCtx);
|
|
185
|
+
if (isWorkflowAbortSignal(result)) {
|
|
186
|
+
return await handleAbort(step.id, result);
|
|
187
|
+
}
|
|
142
188
|
stepResults[step.id] = result;
|
|
143
189
|
completedSteps.push({ step, result });
|
|
144
190
|
if (context?.storage) {
|
|
@@ -153,6 +199,9 @@ async function executeWorkflow(config, rawInput, context) {
|
|
|
153
199
|
stepResults
|
|
154
200
|
};
|
|
155
201
|
}
|
|
202
|
+
if (isWorkflowAbortSignal(error)) {
|
|
203
|
+
return await handleAbort(step.id, error);
|
|
204
|
+
}
|
|
156
205
|
await rollbackSaga({
|
|
157
206
|
workflowId: config.id,
|
|
158
207
|
failedStepId: step.id,
|
|
@@ -173,22 +222,22 @@ async function executeWorkflow(config, rawInput, context) {
|
|
|
173
222
|
stepResults,
|
|
174
223
|
output: finalOutput
|
|
175
224
|
};
|
|
176
|
-
}
|
|
225
|
+
};
|
|
177
226
|
|
|
178
227
|
// src/workflow/define-workflow.ts
|
|
179
|
-
|
|
228
|
+
var resolveWorkflowImpact = (config, options) => {
|
|
180
229
|
if (options?.impact) {
|
|
181
230
|
return options.impact;
|
|
182
231
|
}
|
|
183
232
|
return config.impact ?? "MUTATIVE";
|
|
184
|
-
}
|
|
185
|
-
|
|
233
|
+
};
|
|
234
|
+
var resolveRequireApproval = (impact, options) => {
|
|
186
235
|
if (options?.requireApproval !== void 0) {
|
|
187
236
|
return options.requireApproval;
|
|
188
237
|
}
|
|
189
238
|
return impact === "DESTRUCTIVE";
|
|
190
|
-
}
|
|
191
|
-
|
|
239
|
+
};
|
|
240
|
+
var buildToolExecutionContext = (options, toolCtx) => {
|
|
192
241
|
const tenantId = typeof toolCtx?.tenantId === "string" ? toolCtx.tenantId : options?.defaultContext?.tenantId;
|
|
193
242
|
const userId = typeof toolCtx?.userId === "string" ? toolCtx.userId : options?.defaultContext?.userId;
|
|
194
243
|
return {
|
|
@@ -197,8 +246,8 @@ function buildToolExecutionContext(options, toolCtx) {
|
|
|
197
246
|
services: options?.defaultContext?.services ?? {},
|
|
198
247
|
storage: options?.storage ?? options?.defaultContext?.storage
|
|
199
248
|
};
|
|
200
|
-
}
|
|
201
|
-
|
|
249
|
+
};
|
|
250
|
+
var defineWorkflow = (config) => {
|
|
202
251
|
const workflowImpact = config.impact ?? "MUTATIVE";
|
|
203
252
|
return {
|
|
204
253
|
id: config.id,
|
|
@@ -242,11 +291,13 @@ function defineWorkflow(config) {
|
|
|
242
291
|
return tool;
|
|
243
292
|
}
|
|
244
293
|
};
|
|
245
|
-
}
|
|
294
|
+
};
|
|
246
295
|
|
|
247
296
|
export {
|
|
248
297
|
WorkflowSagaRollbackError,
|
|
249
298
|
WorkflowValidationError,
|
|
299
|
+
WorkflowAbortSignal,
|
|
300
|
+
isWorkflowAbortSignal,
|
|
250
301
|
executeWorkflow,
|
|
251
302
|
defineWorkflow
|
|
252
303
|
};
|
package/dist/index.js
CHANGED
|
@@ -33,6 +33,7 @@ __export(index_exports, {
|
|
|
33
33
|
PromptRegistry: () => PromptRegistry,
|
|
34
34
|
PromptTemplate: () => PromptTemplate,
|
|
35
35
|
SEED_MODEL_PRICES: () => SEED_MODEL_PRICES,
|
|
36
|
+
WorkflowAbortSignal: () => WorkflowAbortSignal,
|
|
36
37
|
WorkflowSagaRollbackError: () => WorkflowSagaRollbackError,
|
|
37
38
|
WorkflowValidationError: () => WorkflowValidationError,
|
|
38
39
|
ZenLLMControlLayer: () => AvantGateControlLayer,
|
|
@@ -43,6 +44,7 @@ __export(index_exports, {
|
|
|
43
44
|
defineWorkflow: () => defineWorkflow,
|
|
44
45
|
executeWorkflow: () => executeWorkflow,
|
|
45
46
|
extractAndCleanJSON: () => extractAndCleanJSON,
|
|
47
|
+
isWorkflowAbortSignal: () => isWorkflowAbortSignal,
|
|
46
48
|
resolveModelPrice: () => resolveModelPrice,
|
|
47
49
|
resolveModelPriceAsync: () => resolveModelPriceAsync,
|
|
48
50
|
sanitizePII: () => sanitizePII,
|
|
@@ -1893,21 +1895,35 @@ var WorkflowValidationError = class extends Error {
|
|
|
1893
1895
|
this.issues = issues;
|
|
1894
1896
|
}
|
|
1895
1897
|
};
|
|
1898
|
+
var WorkflowAbortSignal = class extends Error {
|
|
1899
|
+
__isWorkflowAbort = true;
|
|
1900
|
+
reason;
|
|
1901
|
+
payload;
|
|
1902
|
+
constructor(reason, payload) {
|
|
1903
|
+
super(`Workflow aborted: ${reason}`);
|
|
1904
|
+
this.name = "WorkflowAbortSignal";
|
|
1905
|
+
this.reason = reason;
|
|
1906
|
+
this.payload = payload;
|
|
1907
|
+
}
|
|
1908
|
+
};
|
|
1909
|
+
var isWorkflowAbortSignal = (value) => {
|
|
1910
|
+
return typeof value === "object" && value !== null && value.__isWorkflowAbort === true;
|
|
1911
|
+
};
|
|
1896
1912
|
|
|
1897
1913
|
// src/workflow/engine.ts
|
|
1898
|
-
|
|
1914
|
+
var generateRunId = (workflowId) => {
|
|
1899
1915
|
const timestamp = Date.now();
|
|
1900
1916
|
const randomSuffix = Math.random().toString(36).substring(2, 9);
|
|
1901
1917
|
return `run_${workflowId}_${timestamp}_${randomSuffix}`;
|
|
1902
|
-
}
|
|
1903
|
-
|
|
1918
|
+
};
|
|
1919
|
+
var validateInput = (config, input) => {
|
|
1904
1920
|
const parseResult = config.inputSchema.safeParse(input);
|
|
1905
1921
|
if (!parseResult.success) {
|
|
1906
1922
|
throw new WorkflowValidationError(config.id, parseResult.error.issues);
|
|
1907
1923
|
}
|
|
1908
1924
|
return parseResult.data;
|
|
1909
|
-
}
|
|
1910
|
-
|
|
1925
|
+
};
|
|
1926
|
+
var createStepContext = (params) => {
|
|
1911
1927
|
const { workflowId, stepId, runId, context, stepResults } = params;
|
|
1912
1928
|
return {
|
|
1913
1929
|
workflowId,
|
|
@@ -1936,10 +1952,13 @@ function createStepContext(params) {
|
|
|
1936
1952
|
});
|
|
1937
1953
|
}
|
|
1938
1954
|
throw new StepSuspendedError(stepId, workflowId, options?.prompt);
|
|
1955
|
+
},
|
|
1956
|
+
abort: (reason, payload) => {
|
|
1957
|
+
throw new WorkflowAbortSignal(reason, payload);
|
|
1939
1958
|
}
|
|
1940
1959
|
};
|
|
1941
|
-
}
|
|
1942
|
-
async
|
|
1960
|
+
};
|
|
1961
|
+
var rollbackSaga = async (params) => {
|
|
1943
1962
|
const {
|
|
1944
1963
|
workflowId,
|
|
1945
1964
|
failedStepId,
|
|
@@ -1983,12 +2002,38 @@ async function rollbackSaga(params) {
|
|
|
1983
2002
|
compensatedSteps,
|
|
1984
2003
|
failedCompensations
|
|
1985
2004
|
});
|
|
1986
|
-
}
|
|
1987
|
-
async
|
|
2005
|
+
};
|
|
2006
|
+
var executeWorkflow = async (config, rawInput, context) => {
|
|
1988
2007
|
const input = validateInput(config, rawInput);
|
|
1989
2008
|
const runId = context?.runId ?? generateRunId(config.id);
|
|
1990
2009
|
const stepResults = {};
|
|
1991
2010
|
const completedSteps = [];
|
|
2011
|
+
const handleAbort = async (stepId, signal) => {
|
|
2012
|
+
stepResults[stepId] = {
|
|
2013
|
+
aborted: true,
|
|
2014
|
+
reason: signal.reason,
|
|
2015
|
+
payload: signal.payload
|
|
2016
|
+
};
|
|
2017
|
+
if (context?.storage) {
|
|
2018
|
+
await context.storage.updateStepStatus(config.id, stepId, "ABORTED", {
|
|
2019
|
+
result: signal.payload,
|
|
2020
|
+
metadata: { abortReason: signal.reason }
|
|
2021
|
+
});
|
|
2022
|
+
}
|
|
2023
|
+
const abortOutput = signal.payload ?? {
|
|
2024
|
+
aborted: true,
|
|
2025
|
+
reason: signal.reason
|
|
2026
|
+
};
|
|
2027
|
+
return {
|
|
2028
|
+
workflowId: config.id,
|
|
2029
|
+
runId,
|
|
2030
|
+
status: "ABORTED",
|
|
2031
|
+
stepResults,
|
|
2032
|
+
abortReason: signal.reason,
|
|
2033
|
+
abortPayload: signal.payload,
|
|
2034
|
+
output: abortOutput
|
|
2035
|
+
};
|
|
2036
|
+
};
|
|
1992
2037
|
for (const step of config.steps) {
|
|
1993
2038
|
const stepCtx = createStepContext({
|
|
1994
2039
|
workflowId: config.id,
|
|
@@ -1999,6 +2044,9 @@ async function executeWorkflow(config, rawInput, context) {
|
|
|
1999
2044
|
});
|
|
2000
2045
|
try {
|
|
2001
2046
|
const result = await step.execute(input, stepCtx);
|
|
2047
|
+
if (isWorkflowAbortSignal(result)) {
|
|
2048
|
+
return await handleAbort(step.id, result);
|
|
2049
|
+
}
|
|
2002
2050
|
stepResults[step.id] = result;
|
|
2003
2051
|
completedSteps.push({ step, result });
|
|
2004
2052
|
if (context?.storage) {
|
|
@@ -2013,6 +2061,9 @@ async function executeWorkflow(config, rawInput, context) {
|
|
|
2013
2061
|
stepResults
|
|
2014
2062
|
};
|
|
2015
2063
|
}
|
|
2064
|
+
if (isWorkflowAbortSignal(error)) {
|
|
2065
|
+
return await handleAbort(step.id, error);
|
|
2066
|
+
}
|
|
2016
2067
|
await rollbackSaga({
|
|
2017
2068
|
workflowId: config.id,
|
|
2018
2069
|
failedStepId: step.id,
|
|
@@ -2033,22 +2084,22 @@ async function executeWorkflow(config, rawInput, context) {
|
|
|
2033
2084
|
stepResults,
|
|
2034
2085
|
output: finalOutput
|
|
2035
2086
|
};
|
|
2036
|
-
}
|
|
2087
|
+
};
|
|
2037
2088
|
|
|
2038
2089
|
// src/workflow/define-workflow.ts
|
|
2039
|
-
|
|
2090
|
+
var resolveWorkflowImpact = (config, options) => {
|
|
2040
2091
|
if (options?.impact) {
|
|
2041
2092
|
return options.impact;
|
|
2042
2093
|
}
|
|
2043
2094
|
return config.impact ?? "MUTATIVE";
|
|
2044
|
-
}
|
|
2045
|
-
|
|
2095
|
+
};
|
|
2096
|
+
var resolveRequireApproval = (impact, options) => {
|
|
2046
2097
|
if (options?.requireApproval !== void 0) {
|
|
2047
2098
|
return options.requireApproval;
|
|
2048
2099
|
}
|
|
2049
2100
|
return impact === "DESTRUCTIVE";
|
|
2050
|
-
}
|
|
2051
|
-
|
|
2101
|
+
};
|
|
2102
|
+
var buildToolExecutionContext = (options, toolCtx) => {
|
|
2052
2103
|
const tenantId = typeof toolCtx?.tenantId === "string" ? toolCtx.tenantId : options?.defaultContext?.tenantId;
|
|
2053
2104
|
const userId = typeof toolCtx?.userId === "string" ? toolCtx.userId : options?.defaultContext?.userId;
|
|
2054
2105
|
return {
|
|
@@ -2057,8 +2108,8 @@ function buildToolExecutionContext(options, toolCtx) {
|
|
|
2057
2108
|
services: options?.defaultContext?.services ?? {},
|
|
2058
2109
|
storage: options?.storage ?? options?.defaultContext?.storage
|
|
2059
2110
|
};
|
|
2060
|
-
}
|
|
2061
|
-
|
|
2111
|
+
};
|
|
2112
|
+
var defineWorkflow = (config) => {
|
|
2062
2113
|
const workflowImpact = config.impact ?? "MUTATIVE";
|
|
2063
2114
|
return {
|
|
2064
2115
|
id: config.id,
|
|
@@ -2102,7 +2153,7 @@ function defineWorkflow(config) {
|
|
|
2102
2153
|
return tool;
|
|
2103
2154
|
}
|
|
2104
2155
|
};
|
|
2105
|
-
}
|
|
2156
|
+
};
|
|
2106
2157
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2107
2158
|
0 && (module.exports = {
|
|
2108
2159
|
AvantGateBudgetExceededError,
|
|
@@ -2118,6 +2169,7 @@ function defineWorkflow(config) {
|
|
|
2118
2169
|
PromptRegistry,
|
|
2119
2170
|
PromptTemplate,
|
|
2120
2171
|
SEED_MODEL_PRICES,
|
|
2172
|
+
WorkflowAbortSignal,
|
|
2121
2173
|
WorkflowSagaRollbackError,
|
|
2122
2174
|
WorkflowValidationError,
|
|
2123
2175
|
ZenLLMControlLayer,
|
|
@@ -2128,6 +2180,7 @@ function defineWorkflow(config) {
|
|
|
2128
2180
|
defineWorkflow,
|
|
2129
2181
|
executeWorkflow,
|
|
2130
2182
|
extractAndCleanJSON,
|
|
2183
|
+
isWorkflowAbortSignal,
|
|
2131
2184
|
resolveModelPrice,
|
|
2132
2185
|
resolveModelPriceAsync,
|
|
2133
2186
|
sanitizePII,
|
package/dist/index.mjs
CHANGED
|
@@ -3,11 +3,13 @@ import {
|
|
|
3
3
|
validateWithZod
|
|
4
4
|
} from "./chunk-CO26LNFD.mjs";
|
|
5
5
|
import {
|
|
6
|
+
WorkflowAbortSignal,
|
|
6
7
|
WorkflowSagaRollbackError,
|
|
7
8
|
WorkflowValidationError,
|
|
8
9
|
defineWorkflow,
|
|
9
|
-
executeWorkflow
|
|
10
|
-
|
|
10
|
+
executeWorkflow,
|
|
11
|
+
isWorkflowAbortSignal
|
|
12
|
+
} from "./chunk-4XWO3NZW.mjs";
|
|
11
13
|
import {
|
|
12
14
|
sanitizePII
|
|
13
15
|
} from "./chunk-5VA3EKPJ.mjs";
|
|
@@ -1049,6 +1051,7 @@ export {
|
|
|
1049
1051
|
PromptRegistry,
|
|
1050
1052
|
PromptTemplate,
|
|
1051
1053
|
SEED_MODEL_PRICES,
|
|
1054
|
+
WorkflowAbortSignal,
|
|
1052
1055
|
WorkflowSagaRollbackError,
|
|
1053
1056
|
WorkflowValidationError,
|
|
1054
1057
|
AvantGateControlLayer as ZenLLMControlLayer,
|
|
@@ -1059,6 +1062,7 @@ export {
|
|
|
1059
1062
|
defineWorkflow,
|
|
1060
1063
|
executeWorkflow,
|
|
1061
1064
|
extractAndCleanJSON,
|
|
1065
|
+
isWorkflowAbortSignal,
|
|
1062
1066
|
resolveModelPrice,
|
|
1063
1067
|
resolveModelPriceAsync,
|
|
1064
1068
|
sanitizePII,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { WorkflowConfig, WorkflowInstance } from "./types";
|
|
2
|
-
export declare
|
|
2
|
+
export declare const defineWorkflow: <TInput = any, TOutput = any>(config: WorkflowConfig<TInput, TOutput>) => WorkflowInstance<TInput, TOutput>;
|
|
3
3
|
//# sourceMappingURL=define-workflow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-workflow.d.ts","sourceRoot":"","sources":["../../src/workflow/define-workflow.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,cAAc,EAGd,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAmCjB,
|
|
1
|
+
{"version":3,"file":"define-workflow.d.ts","sourceRoot":"","sources":["../../src/workflow/define-workflow.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,cAAc,EAGd,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAmCjB,eAAO,MAAM,cAAc,GAAI,MAAM,GAAG,GAAG,EAAE,OAAO,GAAG,GAAG,EACxD,QAAQ,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,KACtC,gBAAgB,CAAC,MAAM,EAAE,OAAO,CA8DlC,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { WorkflowConfig, WorkflowExecutionContext, WorkflowExecutionResult } from "./types";
|
|
2
|
-
export declare
|
|
2
|
+
export declare const executeWorkflow: <TInput, TOutput>(config: WorkflowConfig<TInput, TOutput>, rawInput: TInput, context?: WorkflowExecutionContext) => Promise<WorkflowExecutionResult<TOutput>>;
|
|
3
3
|
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/workflow/engine.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/workflow/engine.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,cAAc,EACd,wBAAwB,EACxB,uBAAuB,EAGxB,MAAM,SAAS,CAAC;AAyHjB,eAAO,MAAM,eAAe,GAAU,MAAM,EAAE,OAAO,EACnD,QAAQ,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,EACvC,UAAU,MAAM,EAChB,UAAU,wBAAwB,KACjC,OAAO,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAmG1C,CAAA"}
|
|
@@ -21,4 +21,11 @@ export declare class WorkflowValidationError extends Error {
|
|
|
21
21
|
readonly issues: unknown[];
|
|
22
22
|
constructor(workflowId: string, issues: unknown[]);
|
|
23
23
|
}
|
|
24
|
+
export declare class WorkflowAbortSignal<TPayload = unknown> extends Error {
|
|
25
|
+
readonly __isWorkflowAbort = true;
|
|
26
|
+
readonly reason: string;
|
|
27
|
+
readonly payload?: TPayload;
|
|
28
|
+
constructor(reason: string, payload?: TPayload);
|
|
29
|
+
}
|
|
30
|
+
export declare const isWorkflowAbortSignal: (value: unknown) => value is WorkflowAbortSignal;
|
|
24
31
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/workflow/errors.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAw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AAC;QACnB,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,EAAE,OAAO,CAAC;QACvB,gBAAgB,EAAE,MAAM,EAAE,CAAC;QAC3B,mBAAmB,CAAC,EAAE,wBAAwB,EAAE,CAAC;KAClD;CAiBF;AAED,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;gBAEf,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE;CAMlD;AAED,qBAAa,mBAAmB,CAAC,QAAQ,GAAG,OAAO,CAAE,SAAQ,KAAK;IAChE,QAAQ,CAAC,iBAAiB,QAAQ;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC;gBAEhB,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ;CAM/C;AAED,eAAO,MAAM,qBAAqB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,mBAM/D,CAAC"}
|
package/dist/workflow/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { defineWorkflow } from "./define-workflow";
|
|
2
2
|
export { executeWorkflow } from "./engine";
|
|
3
|
-
export { WorkflowSagaRollbackError, WorkflowValidationError, type FailedCompensationRecord, } from "./errors";
|
|
3
|
+
export { WorkflowSagaRollbackError, WorkflowValidationError, WorkflowAbortSignal, isWorkflowAbortSignal, type FailedCompensationRecord, } from "./errors";
|
|
4
4
|
export type { WorkflowAsToolOptions, WorkflowConfig, WorkflowExecutionContext, WorkflowExecutionResult, WorkflowInstance, WorkflowStepConfig, WorkflowStepContext, } from "./types";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/workflow/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,KAAK,wBAAwB,GAC9B,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,qBAAqB,EACrB,cAAc,EACd,wBAAwB,EACxB,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/workflow/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,wBAAwB,GAC9B,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,qBAAqB,EACrB,cAAc,EACd,wBAAwB,EACxB,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,SAAS,CAAC"}
|
package/dist/workflow/index.js
CHANGED
|
@@ -20,10 +20,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/workflow/index.ts
|
|
21
21
|
var workflow_exports = {};
|
|
22
22
|
__export(workflow_exports, {
|
|
23
|
+
WorkflowAbortSignal: () => WorkflowAbortSignal,
|
|
23
24
|
WorkflowSagaRollbackError: () => WorkflowSagaRollbackError,
|
|
24
25
|
WorkflowValidationError: () => WorkflowValidationError,
|
|
25
26
|
defineWorkflow: () => defineWorkflow,
|
|
26
|
-
executeWorkflow: () => executeWorkflow
|
|
27
|
+
executeWorkflow: () => executeWorkflow,
|
|
28
|
+
isWorkflowAbortSignal: () => isWorkflowAbortSignal
|
|
27
29
|
});
|
|
28
30
|
module.exports = __toCommonJS(workflow_exports);
|
|
29
31
|
|
|
@@ -339,21 +341,35 @@ var WorkflowValidationError = class extends Error {
|
|
|
339
341
|
this.issues = issues;
|
|
340
342
|
}
|
|
341
343
|
};
|
|
344
|
+
var WorkflowAbortSignal = class extends Error {
|
|
345
|
+
__isWorkflowAbort = true;
|
|
346
|
+
reason;
|
|
347
|
+
payload;
|
|
348
|
+
constructor(reason, payload) {
|
|
349
|
+
super(`Workflow aborted: ${reason}`);
|
|
350
|
+
this.name = "WorkflowAbortSignal";
|
|
351
|
+
this.reason = reason;
|
|
352
|
+
this.payload = payload;
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
var isWorkflowAbortSignal = (value) => {
|
|
356
|
+
return typeof value === "object" && value !== null && value.__isWorkflowAbort === true;
|
|
357
|
+
};
|
|
342
358
|
|
|
343
359
|
// src/workflow/engine.ts
|
|
344
|
-
|
|
360
|
+
var generateRunId = (workflowId) => {
|
|
345
361
|
const timestamp = Date.now();
|
|
346
362
|
const randomSuffix = Math.random().toString(36).substring(2, 9);
|
|
347
363
|
return `run_${workflowId}_${timestamp}_${randomSuffix}`;
|
|
348
|
-
}
|
|
349
|
-
|
|
364
|
+
};
|
|
365
|
+
var validateInput = (config, input) => {
|
|
350
366
|
const parseResult = config.inputSchema.safeParse(input);
|
|
351
367
|
if (!parseResult.success) {
|
|
352
368
|
throw new WorkflowValidationError(config.id, parseResult.error.issues);
|
|
353
369
|
}
|
|
354
370
|
return parseResult.data;
|
|
355
|
-
}
|
|
356
|
-
|
|
371
|
+
};
|
|
372
|
+
var createStepContext = (params) => {
|
|
357
373
|
const { workflowId, stepId, runId, context, stepResults } = params;
|
|
358
374
|
return {
|
|
359
375
|
workflowId,
|
|
@@ -382,10 +398,13 @@ function createStepContext(params) {
|
|
|
382
398
|
});
|
|
383
399
|
}
|
|
384
400
|
throw new StepSuspendedError(stepId, workflowId, options?.prompt);
|
|
401
|
+
},
|
|
402
|
+
abort: (reason, payload) => {
|
|
403
|
+
throw new WorkflowAbortSignal(reason, payload);
|
|
385
404
|
}
|
|
386
405
|
};
|
|
387
|
-
}
|
|
388
|
-
async
|
|
406
|
+
};
|
|
407
|
+
var rollbackSaga = async (params) => {
|
|
389
408
|
const {
|
|
390
409
|
workflowId,
|
|
391
410
|
failedStepId,
|
|
@@ -429,12 +448,38 @@ async function rollbackSaga(params) {
|
|
|
429
448
|
compensatedSteps,
|
|
430
449
|
failedCompensations
|
|
431
450
|
});
|
|
432
|
-
}
|
|
433
|
-
async
|
|
451
|
+
};
|
|
452
|
+
var executeWorkflow = async (config, rawInput, context) => {
|
|
434
453
|
const input = validateInput(config, rawInput);
|
|
435
454
|
const runId = context?.runId ?? generateRunId(config.id);
|
|
436
455
|
const stepResults = {};
|
|
437
456
|
const completedSteps = [];
|
|
457
|
+
const handleAbort = async (stepId, signal) => {
|
|
458
|
+
stepResults[stepId] = {
|
|
459
|
+
aborted: true,
|
|
460
|
+
reason: signal.reason,
|
|
461
|
+
payload: signal.payload
|
|
462
|
+
};
|
|
463
|
+
if (context?.storage) {
|
|
464
|
+
await context.storage.updateStepStatus(config.id, stepId, "ABORTED", {
|
|
465
|
+
result: signal.payload,
|
|
466
|
+
metadata: { abortReason: signal.reason }
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
const abortOutput = signal.payload ?? {
|
|
470
|
+
aborted: true,
|
|
471
|
+
reason: signal.reason
|
|
472
|
+
};
|
|
473
|
+
return {
|
|
474
|
+
workflowId: config.id,
|
|
475
|
+
runId,
|
|
476
|
+
status: "ABORTED",
|
|
477
|
+
stepResults,
|
|
478
|
+
abortReason: signal.reason,
|
|
479
|
+
abortPayload: signal.payload,
|
|
480
|
+
output: abortOutput
|
|
481
|
+
};
|
|
482
|
+
};
|
|
438
483
|
for (const step of config.steps) {
|
|
439
484
|
const stepCtx = createStepContext({
|
|
440
485
|
workflowId: config.id,
|
|
@@ -445,6 +490,9 @@ async function executeWorkflow(config, rawInput, context) {
|
|
|
445
490
|
});
|
|
446
491
|
try {
|
|
447
492
|
const result = await step.execute(input, stepCtx);
|
|
493
|
+
if (isWorkflowAbortSignal(result)) {
|
|
494
|
+
return await handleAbort(step.id, result);
|
|
495
|
+
}
|
|
448
496
|
stepResults[step.id] = result;
|
|
449
497
|
completedSteps.push({ step, result });
|
|
450
498
|
if (context?.storage) {
|
|
@@ -459,6 +507,9 @@ async function executeWorkflow(config, rawInput, context) {
|
|
|
459
507
|
stepResults
|
|
460
508
|
};
|
|
461
509
|
}
|
|
510
|
+
if (isWorkflowAbortSignal(error)) {
|
|
511
|
+
return await handleAbort(step.id, error);
|
|
512
|
+
}
|
|
462
513
|
await rollbackSaga({
|
|
463
514
|
workflowId: config.id,
|
|
464
515
|
failedStepId: step.id,
|
|
@@ -479,22 +530,22 @@ async function executeWorkflow(config, rawInput, context) {
|
|
|
479
530
|
stepResults,
|
|
480
531
|
output: finalOutput
|
|
481
532
|
};
|
|
482
|
-
}
|
|
533
|
+
};
|
|
483
534
|
|
|
484
535
|
// src/workflow/define-workflow.ts
|
|
485
|
-
|
|
536
|
+
var resolveWorkflowImpact = (config, options) => {
|
|
486
537
|
if (options?.impact) {
|
|
487
538
|
return options.impact;
|
|
488
539
|
}
|
|
489
540
|
return config.impact ?? "MUTATIVE";
|
|
490
|
-
}
|
|
491
|
-
|
|
541
|
+
};
|
|
542
|
+
var resolveRequireApproval = (impact, options) => {
|
|
492
543
|
if (options?.requireApproval !== void 0) {
|
|
493
544
|
return options.requireApproval;
|
|
494
545
|
}
|
|
495
546
|
return impact === "DESTRUCTIVE";
|
|
496
|
-
}
|
|
497
|
-
|
|
547
|
+
};
|
|
548
|
+
var buildToolExecutionContext = (options, toolCtx) => {
|
|
498
549
|
const tenantId = typeof toolCtx?.tenantId === "string" ? toolCtx.tenantId : options?.defaultContext?.tenantId;
|
|
499
550
|
const userId = typeof toolCtx?.userId === "string" ? toolCtx.userId : options?.defaultContext?.userId;
|
|
500
551
|
return {
|
|
@@ -503,8 +554,8 @@ function buildToolExecutionContext(options, toolCtx) {
|
|
|
503
554
|
services: options?.defaultContext?.services ?? {},
|
|
504
555
|
storage: options?.storage ?? options?.defaultContext?.storage
|
|
505
556
|
};
|
|
506
|
-
}
|
|
507
|
-
|
|
557
|
+
};
|
|
558
|
+
var defineWorkflow = (config) => {
|
|
508
559
|
const workflowImpact = config.impact ?? "MUTATIVE";
|
|
509
560
|
return {
|
|
510
561
|
id: config.id,
|
|
@@ -548,11 +599,13 @@ function defineWorkflow(config) {
|
|
|
548
599
|
return tool;
|
|
549
600
|
}
|
|
550
601
|
};
|
|
551
|
-
}
|
|
602
|
+
};
|
|
552
603
|
// Annotate the CommonJS export names for ESM import in node:
|
|
553
604
|
0 && (module.exports = {
|
|
605
|
+
WorkflowAbortSignal,
|
|
554
606
|
WorkflowSagaRollbackError,
|
|
555
607
|
WorkflowValidationError,
|
|
556
608
|
defineWorkflow,
|
|
557
|
-
executeWorkflow
|
|
609
|
+
executeWorkflow,
|
|
610
|
+
isWorkflowAbortSignal
|
|
558
611
|
});
|
package/dist/workflow/index.mjs
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
|
+
WorkflowAbortSignal,
|
|
2
3
|
WorkflowSagaRollbackError,
|
|
3
4
|
WorkflowValidationError,
|
|
4
5
|
defineWorkflow,
|
|
5
|
-
executeWorkflow
|
|
6
|
-
|
|
6
|
+
executeWorkflow,
|
|
7
|
+
isWorkflowAbortSignal
|
|
8
|
+
} from "../chunk-4XWO3NZW.mjs";
|
|
7
9
|
import "../chunk-5VA3EKPJ.mjs";
|
|
8
10
|
export {
|
|
11
|
+
WorkflowAbortSignal,
|
|
9
12
|
WorkflowSagaRollbackError,
|
|
10
13
|
WorkflowValidationError,
|
|
11
14
|
defineWorkflow,
|
|
12
|
-
executeWorkflow
|
|
15
|
+
executeWorkflow,
|
|
16
|
+
isWorkflowAbortSignal
|
|
13
17
|
};
|
package/dist/workflow/types.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface WorkflowStepContext {
|
|
|
10
10
|
readonly storage?: StepStorageAdapter;
|
|
11
11
|
getStepResult<T = unknown>(stepId: string): T | undefined;
|
|
12
12
|
waitForApproval<T = unknown>(options?: StepApprovalOptions<T>): Promise<T>;
|
|
13
|
+
abort<TPayload = unknown>(reason: string, payload?: TPayload): never;
|
|
13
14
|
}
|
|
14
15
|
export interface WorkflowStepConfig<TInput = any, TOutput = any> {
|
|
15
16
|
id: string;
|
|
@@ -47,9 +48,11 @@ export interface WorkflowAsToolOptions {
|
|
|
47
48
|
export interface WorkflowExecutionResult<TOutput = any> {
|
|
48
49
|
workflowId: string;
|
|
49
50
|
runId: string;
|
|
50
|
-
status: "COMPLETED" | "FAILED" | "WAITING_APPROVAL";
|
|
51
|
+
status: "COMPLETED" | "FAILED" | "WAITING_APPROVAL" | "ABORTED";
|
|
51
52
|
stepResults: Record<string, any>;
|
|
52
53
|
output?: TOutput;
|
|
54
|
+
abortReason?: string;
|
|
55
|
+
abortPayload?: unknown;
|
|
53
56
|
}
|
|
54
57
|
export interface WorkflowInstance<TInput = any, TOutput = any> {
|
|
55
58
|
readonly id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/workflow/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACnC,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACX,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,C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B,GACjC,OAAO,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC,CAAC;IAC7C,MAAM,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "avantgate",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Zero-infrastructure, in-process AI Application Firewall (AI-WAF) & privacy control plane for TypeScript: real-time prompt guardrails, zero-egress PII redaction, agent tool isolation, anti-IDOR defense, pre-flight token budgets, and multi-model failover.",
|
|
5
5
|
"author": "Antigravity & LexTalk Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"test:prompts": "tsx tests/prompt-builder.test.ts",
|
|
74
74
|
"test:pii": "tsx tests/pii-extended.test.ts",
|
|
75
75
|
"test:agent": "tsx tests/agent/step-runner.test.ts && tsx tests/agent/isolated-tool.test.ts && tsx tests/agent/dto-pattern.test.ts && tsx tests/agent/tool-patterns.test.ts && tsx tests/agent/storage-adapters.test.ts && tsx tests/agent/tool-aliasing.test.ts && tsx tests/agent/tool-chaining.test.ts && tsx tests/agent/tool-storage.test.ts && tsx tests/agent/telemetry-exporter.test.ts && tsx tests/agent/platform-adapter.test.ts && tsx tests/agent/tool-governance.test.ts && tsx tests/agent/tool-impact.test.ts",
|
|
76
|
-
"test:workflow": "tsx tests/workflow/workflow-saga.test.ts",
|
|
76
|
+
"test:workflow": "tsx tests/workflow/workflow-saga.test.ts && tsx tests/workflow/workflow-abort.test.ts",
|
|
77
77
|
"lint": "tsc --noEmit",
|
|
78
78
|
"prepublishOnly": "npm run build && npm test"
|
|
79
79
|
},
|