@swmansion/argent 0.32.1-next.10 → 0.32.1-next.11
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/cli-cmds.mjs +467 -432
- package/dist/client.d.ts +5 -0
- package/dist/client.js +26 -9
- package/dist/installer.mjs +2 -0
- package/dist/mcp-server.mjs +21 -8
- package/dist/tool-server.cjs +20254 -20224
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -12,6 +12,11 @@ export interface ArgentToolResult<T = unknown> {
|
|
|
12
12
|
data: T;
|
|
13
13
|
/** Optional advisory note the tool attached to the result. */
|
|
14
14
|
note?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Why the call did not do its job though it returned, such as an e2e test
|
|
17
|
+
* that does not pass. See the tool-server API reference for the list.
|
|
18
|
+
*/
|
|
19
|
+
failure?: string;
|
|
15
20
|
}
|
|
16
21
|
/**
|
|
17
22
|
* A node of the `ui-tree` result. A flag is set only when true; a field named in
|
package/dist/client.js
CHANGED
|
@@ -9025,6 +9025,8 @@ var FAILURE_CODES = {
|
|
|
9025
9025
|
CLI_RUN_ARGS_JSON_INVALID: "CLI_RUN_ARGS_JSON_INVALID",
|
|
9026
9026
|
CLI_RUN_INPUT_VALIDATION_FAILED: "CLI_RUN_INPUT_VALIDATION_FAILED",
|
|
9027
9027
|
CLI_RUN_TOOL_CALL_FAILED: "CLI_RUN_TOOL_CALL_FAILED",
|
|
9028
|
+
// The result carried the tool-server's `failure` field.
|
|
9029
|
+
CLI_RUN_TOOL_RESULT_FAILED: "CLI_RUN_TOOL_RESULT_FAILED",
|
|
9028
9030
|
CLI_RUN_SAVE_IMAGE_FAILED: "CLI_RUN_SAVE_IMAGE_FAILED",
|
|
9029
9031
|
TOOL_CAPABILITY_UNSUPPORTED_OPERATION: "TOOL_CAPABILITY_UNSUPPORTED_OPERATION",
|
|
9030
9032
|
TOOL_PLATFORM_NOT_IMPLEMENTED: "TOOL_PLATFORM_NOT_IMPLEMENTED",
|
|
@@ -10397,7 +10399,8 @@ async function consumeToolStream(name, body, onProgress, signal) {
|
|
|
10397
10399
|
final = {
|
|
10398
10400
|
data: msg.data,
|
|
10399
10401
|
note: msg.note,
|
|
10400
|
-
...msg.profiling === true ? { profiling: true } : {}
|
|
10402
|
+
...msg.profiling === true ? { profiling: true } : {},
|
|
10403
|
+
...typeof msg.failure === "string" ? { failure: msg.failure } : {}
|
|
10401
10404
|
};
|
|
10402
10405
|
} else if (msg.event === "error") {
|
|
10403
10406
|
throw new ToolInvocationError(msg.error ?? "tool invocation failed", {
|
|
@@ -10449,7 +10452,8 @@ async function consumeToolStream(name, body, onProgress, signal) {
|
|
|
10449
10452
|
return {
|
|
10450
10453
|
data: final.data,
|
|
10451
10454
|
note: final.note,
|
|
10452
|
-
...final.profiling ? { profiling: true } : {}
|
|
10455
|
+
...final.profiling ? { profiling: true } : {},
|
|
10456
|
+
...final.failure !== void 0 ? { failure: final.failure } : {}
|
|
10453
10457
|
};
|
|
10454
10458
|
}
|
|
10455
10459
|
function errorBodyMessage(body) {
|
|
@@ -10614,6 +10618,7 @@ function createToolsClient(options = {}) {
|
|
|
10614
10618
|
}
|
|
10615
10619
|
const shadowWarning = await e2eShadowWarningFor(name, args);
|
|
10616
10620
|
const baselineDirs = [];
|
|
10621
|
+
let unwrittenBaselines = [];
|
|
10617
10622
|
if (meta?.fileInputs?.length) {
|
|
10618
10623
|
if (remote) assertRequiredPresent(meta, finalArgs);
|
|
10619
10624
|
finalArgs = await prepareFileInputs(meta.fileInputs, finalArgs ?? {}, {
|
|
@@ -10627,8 +10632,9 @@ function createToolsClient(options = {}) {
|
|
|
10627
10632
|
signal: opts?.signal
|
|
10628
10633
|
});
|
|
10629
10634
|
}
|
|
10630
|
-
const settle = async (
|
|
10631
|
-
const applied = await applyClientFileDirectives(
|
|
10635
|
+
const settle = async (data2) => {
|
|
10636
|
+
const applied = await applyClientFileDirectives(data2, { allowedDirs: baselineDirs });
|
|
10637
|
+
unwrittenBaselines = applied.failed.map((f) => f.path);
|
|
10632
10638
|
for (const { path: file, error } of applied.failed) {
|
|
10633
10639
|
diagnose(`The baseline ${file} was not written on this client: ${error}`);
|
|
10634
10640
|
}
|
|
@@ -10645,6 +10651,7 @@ function createToolsClient(options = {}) {
|
|
|
10645
10651
|
}
|
|
10646
10652
|
return { ...result, warning: shadowWarning };
|
|
10647
10653
|
};
|
|
10654
|
+
const unwrittenFailure = () => unwrittenBaselines.length > 0 ? `Baselines not written on this client: ${unwrittenBaselines.join(", ")}` : void 0;
|
|
10648
10655
|
const stream = opts?.onProgress !== void 0 || carriesMembers(finalArgs);
|
|
10649
10656
|
const sentOnce = carriesUpload(finalArgs);
|
|
10650
10657
|
const forwarded = remote ? await forwardedSecrets(finalArgs) : void 0;
|
|
@@ -10708,11 +10715,14 @@ function createToolsClient(options = {}) {
|
|
|
10708
10715
|
}),
|
|
10709
10716
|
opts?.signal
|
|
10710
10717
|
);
|
|
10718
|
+
const data2 = await settle(streamed.data);
|
|
10719
|
+
const failure2 = streamed.failure ?? unwrittenFailure();
|
|
10711
10720
|
return {
|
|
10712
|
-
data:
|
|
10721
|
+
data: data2,
|
|
10713
10722
|
note: streamed.note,
|
|
10714
10723
|
outputHint: meta?.outputHint,
|
|
10715
|
-
...streamed.profiling ? { profiling: true } : {}
|
|
10724
|
+
...streamed.profiling ? { profiling: true } : {},
|
|
10725
|
+
...failure2 !== void 0 ? { failure: failure2 } : {}
|
|
10716
10726
|
};
|
|
10717
10727
|
}
|
|
10718
10728
|
let json;
|
|
@@ -10748,11 +10758,14 @@ function createToolsClient(options = {}) {
|
|
|
10748
10758
|
});
|
|
10749
10759
|
}
|
|
10750
10760
|
opts?.signal?.throwIfAborted();
|
|
10761
|
+
const data = await settle(json.data);
|
|
10762
|
+
const failure = (typeof json.failure === "string" ? json.failure : void 0) ?? unwrittenFailure();
|
|
10751
10763
|
return {
|
|
10752
|
-
data
|
|
10764
|
+
data,
|
|
10753
10765
|
note: json.note,
|
|
10754
10766
|
outputHint: meta?.outputHint,
|
|
10755
|
-
...json.profiling === true ? { profiling: true } : {}
|
|
10767
|
+
...json.profiling === true ? { profiling: true } : {},
|
|
10768
|
+
...failure !== void 0 ? { failure } : {}
|
|
10756
10769
|
};
|
|
10757
10770
|
}
|
|
10758
10771
|
return { fetchTools, fetchTool, callTool, baseUrl };
|
|
@@ -11162,7 +11175,11 @@ function createArgentClient() {
|
|
|
11162
11175
|
signal: options?.signal
|
|
11163
11176
|
});
|
|
11164
11177
|
options?.signal?.throwIfAborted();
|
|
11165
|
-
return {
|
|
11178
|
+
return {
|
|
11179
|
+
data: result,
|
|
11180
|
+
note: response.note,
|
|
11181
|
+
...response.failure !== void 0 ? { failure: response.failure } : {}
|
|
11182
|
+
};
|
|
11166
11183
|
} catch (err) {
|
|
11167
11184
|
if (err instanceof ToolInvocationError) {
|
|
11168
11185
|
throw new ArgentToolError(err.message, {
|
package/dist/installer.mjs
CHANGED
|
@@ -15789,6 +15789,8 @@ var FAILURE_CODES = {
|
|
|
15789
15789
|
CLI_RUN_ARGS_JSON_INVALID: "CLI_RUN_ARGS_JSON_INVALID",
|
|
15790
15790
|
CLI_RUN_INPUT_VALIDATION_FAILED: "CLI_RUN_INPUT_VALIDATION_FAILED",
|
|
15791
15791
|
CLI_RUN_TOOL_CALL_FAILED: "CLI_RUN_TOOL_CALL_FAILED",
|
|
15792
|
+
// The result carried the tool-server's `failure` field.
|
|
15793
|
+
CLI_RUN_TOOL_RESULT_FAILED: "CLI_RUN_TOOL_RESULT_FAILED",
|
|
15792
15794
|
CLI_RUN_SAVE_IMAGE_FAILED: "CLI_RUN_SAVE_IMAGE_FAILED",
|
|
15793
15795
|
TOOL_CAPABILITY_UNSUPPORTED_OPERATION: "TOOL_CAPABILITY_UNSUPPORTED_OPERATION",
|
|
15794
15796
|
TOOL_PLATFORM_NOT_IMPLEMENTED: "TOOL_PLATFORM_NOT_IMPLEMENTED",
|
package/dist/mcp-server.mjs
CHANGED
|
@@ -25735,6 +25735,8 @@ var FAILURE_CODES = {
|
|
|
25735
25735
|
CLI_RUN_ARGS_JSON_INVALID: "CLI_RUN_ARGS_JSON_INVALID",
|
|
25736
25736
|
CLI_RUN_INPUT_VALIDATION_FAILED: "CLI_RUN_INPUT_VALIDATION_FAILED",
|
|
25737
25737
|
CLI_RUN_TOOL_CALL_FAILED: "CLI_RUN_TOOL_CALL_FAILED",
|
|
25738
|
+
// The result carried the tool-server's `failure` field.
|
|
25739
|
+
CLI_RUN_TOOL_RESULT_FAILED: "CLI_RUN_TOOL_RESULT_FAILED",
|
|
25738
25740
|
CLI_RUN_SAVE_IMAGE_FAILED: "CLI_RUN_SAVE_IMAGE_FAILED",
|
|
25739
25741
|
TOOL_CAPABILITY_UNSUPPORTED_OPERATION: "TOOL_CAPABILITY_UNSUPPORTED_OPERATION",
|
|
25740
25742
|
TOOL_PLATFORM_NOT_IMPLEMENTED: "TOOL_PLATFORM_NOT_IMPLEMENTED",
|
|
@@ -27151,7 +27153,8 @@ async function consumeToolStream(name, body, onProgress, signal) {
|
|
|
27151
27153
|
final = {
|
|
27152
27154
|
data: msg.data,
|
|
27153
27155
|
note: msg.note,
|
|
27154
|
-
...msg.profiling === true ? { profiling: true } : {}
|
|
27156
|
+
...msg.profiling === true ? { profiling: true } : {},
|
|
27157
|
+
...typeof msg.failure === "string" ? { failure: msg.failure } : {}
|
|
27155
27158
|
};
|
|
27156
27159
|
} else if (msg.event === "error") {
|
|
27157
27160
|
throw new ToolInvocationError(msg.error ?? "tool invocation failed", {
|
|
@@ -27203,7 +27206,8 @@ async function consumeToolStream(name, body, onProgress, signal) {
|
|
|
27203
27206
|
return {
|
|
27204
27207
|
data: final.data,
|
|
27205
27208
|
note: final.note,
|
|
27206
|
-
...final.profiling ? { profiling: true } : {}
|
|
27209
|
+
...final.profiling ? { profiling: true } : {},
|
|
27210
|
+
...final.failure !== void 0 ? { failure: final.failure } : {}
|
|
27207
27211
|
};
|
|
27208
27212
|
}
|
|
27209
27213
|
function errorBodyMessage(body) {
|
|
@@ -27368,6 +27372,7 @@ function createToolsClient(options = {}) {
|
|
|
27368
27372
|
}
|
|
27369
27373
|
const shadowWarning = await e2eShadowWarningFor(name, args);
|
|
27370
27374
|
const baselineDirs = [];
|
|
27375
|
+
let unwrittenBaselines = [];
|
|
27371
27376
|
if (meta2?.fileInputs?.length) {
|
|
27372
27377
|
if (remote) assertRequiredPresent(meta2, finalArgs);
|
|
27373
27378
|
finalArgs = await prepareFileInputs(meta2.fileInputs, finalArgs ?? {}, {
|
|
@@ -27381,8 +27386,9 @@ function createToolsClient(options = {}) {
|
|
|
27381
27386
|
signal: opts?.signal
|
|
27382
27387
|
});
|
|
27383
27388
|
}
|
|
27384
|
-
const settle2 = async (
|
|
27385
|
-
const applied = await applyClientFileDirectives(
|
|
27389
|
+
const settle2 = async (data2) => {
|
|
27390
|
+
const applied = await applyClientFileDirectives(data2, { allowedDirs: baselineDirs });
|
|
27391
|
+
unwrittenBaselines = applied.failed.map((f) => f.path);
|
|
27386
27392
|
for (const { path: file, error: error2 } of applied.failed) {
|
|
27387
27393
|
diagnose(`The baseline ${file} was not written on this client: ${error2}`);
|
|
27388
27394
|
}
|
|
@@ -27399,6 +27405,7 @@ function createToolsClient(options = {}) {
|
|
|
27399
27405
|
}
|
|
27400
27406
|
return { ...result, warning: shadowWarning };
|
|
27401
27407
|
};
|
|
27408
|
+
const unwrittenFailure = () => unwrittenBaselines.length > 0 ? `Baselines not written on this client: ${unwrittenBaselines.join(", ")}` : void 0;
|
|
27402
27409
|
const stream = opts?.onProgress !== void 0 || carriesMembers(finalArgs);
|
|
27403
27410
|
const sentOnce = carriesUpload(finalArgs);
|
|
27404
27411
|
const forwarded = remote ? await forwardedSecrets(finalArgs) : void 0;
|
|
@@ -27462,11 +27469,14 @@ function createToolsClient(options = {}) {
|
|
|
27462
27469
|
}),
|
|
27463
27470
|
opts?.signal
|
|
27464
27471
|
);
|
|
27472
|
+
const data2 = await settle2(streamed.data);
|
|
27473
|
+
const failure3 = streamed.failure ?? unwrittenFailure();
|
|
27465
27474
|
return {
|
|
27466
|
-
data:
|
|
27475
|
+
data: data2,
|
|
27467
27476
|
note: streamed.note,
|
|
27468
27477
|
outputHint: meta2?.outputHint,
|
|
27469
|
-
...streamed.profiling ? { profiling: true } : {}
|
|
27478
|
+
...streamed.profiling ? { profiling: true } : {},
|
|
27479
|
+
...failure3 !== void 0 ? { failure: failure3 } : {}
|
|
27470
27480
|
};
|
|
27471
27481
|
}
|
|
27472
27482
|
let json;
|
|
@@ -27502,11 +27512,14 @@ function createToolsClient(options = {}) {
|
|
|
27502
27512
|
});
|
|
27503
27513
|
}
|
|
27504
27514
|
opts?.signal?.throwIfAborted();
|
|
27515
|
+
const data = await settle2(json.data);
|
|
27516
|
+
const failure2 = (typeof json.failure === "string" ? json.failure : void 0) ?? unwrittenFailure();
|
|
27505
27517
|
return {
|
|
27506
|
-
data
|
|
27518
|
+
data,
|
|
27507
27519
|
note: json.note,
|
|
27508
27520
|
outputHint: meta2?.outputHint,
|
|
27509
|
-
...json.profiling === true ? { profiling: true } : {}
|
|
27521
|
+
...json.profiling === true ? { profiling: true } : {},
|
|
27522
|
+
...failure2 !== void 0 ? { failure: failure2 } : {}
|
|
27510
27523
|
};
|
|
27511
27524
|
}
|
|
27512
27525
|
return { fetchTools, fetchTool, callTool, baseUrl };
|