nexus-agents 2.107.1 → 2.109.1
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/{chunk-RIZPD2LX.js → chunk-HBPDYYIT.js} +2 -2
- package/dist/{chunk-HSFLKLCK.js → chunk-IUDSDQIF.js} +3 -3
- package/dist/{chunk-2MPLNCGG.js → chunk-N5I4PC3P.js} +98 -21
- package/dist/chunk-N5I4PC3P.js.map +1 -0
- package/dist/{chunk-EDXT2FPY.js → chunk-O737ZOZ6.js} +8 -8
- package/dist/{chunk-OKZTLUKU.js → chunk-RCN76RFJ.js} +106 -3
- package/dist/chunk-RCN76RFJ.js.map +1 -0
- package/dist/{chunk-W3QOKU42.js → chunk-SAR5IO7V.js} +4 -4
- package/dist/cli.js +6 -6
- package/dist/{consensus-vote-A6DOEWEZ.js → consensus-vote-HK5G3DYU.js} +3 -3
- package/dist/{expert-bridge-CP6XN5U7.js → expert-bridge-N7PLXYBV.js} +2 -2
- package/dist/{factory-AT4YGH24.js → factory-UVXXFLOI.js} +2 -2
- package/dist/index.d.ts +13 -4
- package/dist/index.js +14 -18
- package/dist/index.js.map +1 -1
- package/dist/{setup-command-VZ675W23.js → setup-command-O4BGMJIC.js} +4 -4
- package/package.json +1 -1
- package/dist/chunk-2MPLNCGG.js.map +0 -1
- package/dist/chunk-OKZTLUKU.js.map +0 -1
- /package/dist/{chunk-RIZPD2LX.js.map → chunk-HBPDYYIT.js.map} +0 -0
- /package/dist/{chunk-HSFLKLCK.js.map → chunk-IUDSDQIF.js.map} +0 -0
- /package/dist/{chunk-EDXT2FPY.js.map → chunk-O737ZOZ6.js.map} +0 -0
- /package/dist/{chunk-W3QOKU42.js.map → chunk-SAR5IO7V.js.map} +0 -0
- /package/dist/{consensus-vote-A6DOEWEZ.js.map → consensus-vote-HK5G3DYU.js.map} +0 -0
- /package/dist/{expert-bridge-CP6XN5U7.js.map → expert-bridge-N7PLXYBV.js.map} +0 -0
- /package/dist/{factory-AT4YGH24.js.map → factory-UVXXFLOI.js.map} +0 -0
- /package/dist/{setup-command-VZ675W23.js.map → setup-command-O4BGMJIC.js.map} +0 -0
|
@@ -93,7 +93,7 @@ var routerInitPromise = null;
|
|
|
93
93
|
async function getRouter() {
|
|
94
94
|
if (cachedRouter !== null) return cachedRouter;
|
|
95
95
|
routerInitPromise ??= (async () => {
|
|
96
|
-
const { createAllAdapters } = await import("./factory-
|
|
96
|
+
const { createAllAdapters } = await import("./factory-UVXXFLOI.js");
|
|
97
97
|
const { createCompositeRouter } = await import("./composite-router-QJRU2JU5.js");
|
|
98
98
|
const adapters = createAllAdapters();
|
|
99
99
|
if (adapters.size === 0) {
|
|
@@ -213,4 +213,4 @@ export {
|
|
|
213
213
|
tokenSplitFromUsage,
|
|
214
214
|
executeExpert
|
|
215
215
|
};
|
|
216
|
-
//# sourceMappingURL=chunk-
|
|
216
|
+
//# sourceMappingURL=chunk-HBPDYYIT.js.map
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
checkSqlite,
|
|
9
9
|
defaultConfig,
|
|
10
10
|
initDataDirectories
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-SAR5IO7V.js";
|
|
12
12
|
import {
|
|
13
13
|
probeAllClis
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-N5I4PC3P.js";
|
|
15
15
|
import {
|
|
16
16
|
BUILT_IN_EXPERTS
|
|
17
17
|
} from "./chunk-ZM4O442V.js";
|
|
@@ -1987,4 +1987,4 @@ export {
|
|
|
1987
1987
|
setupCommand,
|
|
1988
1988
|
setupCommandAsync
|
|
1989
1989
|
};
|
|
1990
|
-
//# sourceMappingURL=chunk-
|
|
1990
|
+
//# sourceMappingURL=chunk-IUDSDQIF.js.map
|
|
@@ -344,6 +344,7 @@ var DEFAULT_MAX_TOKENS = 4096;
|
|
|
344
344
|
|
|
345
345
|
// src/adapters/claude-adapter-helpers.ts
|
|
346
346
|
import "@anthropic-ai/sdk";
|
|
347
|
+
var RESPOND_TOOL_NAME = "respond";
|
|
347
348
|
function mapStopReason(anthropicReason) {
|
|
348
349
|
switch (anthropicReason) {
|
|
349
350
|
case "end_turn":
|
|
@@ -415,6 +416,26 @@ function mapTool(tool) {
|
|
|
415
416
|
input_schema: tool.inputSchema
|
|
416
417
|
};
|
|
417
418
|
}
|
|
419
|
+
function forcesResponseTool(request) {
|
|
420
|
+
return request.responseFormat !== void 0 && request.responseFormat.type !== "text";
|
|
421
|
+
}
|
|
422
|
+
function buildRespondTool(format) {
|
|
423
|
+
const inputSchema = format?.type === "json_schema" ? format.schema : { type: "object" };
|
|
424
|
+
return mapTool({
|
|
425
|
+
name: RESPOND_TOOL_NAME,
|
|
426
|
+
description: "Return the structured response for this request. Call this tool exactly once with the full answer as its arguments.",
|
|
427
|
+
inputSchema
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
function mapResponseWithRespondTool(blocks) {
|
|
431
|
+
const respondBlock = blocks.find(
|
|
432
|
+
(block) => block.type === "tool_use" && block.name === RESPOND_TOOL_NAME
|
|
433
|
+
);
|
|
434
|
+
if (respondBlock?.type === "tool_use") {
|
|
435
|
+
return [{ type: "text", text: JSON.stringify(respondBlock.input) }];
|
|
436
|
+
}
|
|
437
|
+
return blocks.map(mapContentBlock);
|
|
438
|
+
}
|
|
418
439
|
function resolveModelId(modelId) {
|
|
419
440
|
const registryId = resolveCliAlias(modelId);
|
|
420
441
|
if (registryId !== void 0) return getCliModelName(registryId);
|
|
@@ -591,7 +612,7 @@ var ClaudeAdapter = class extends BaseAdapter {
|
|
|
591
612
|
async executeCompletion(request) {
|
|
592
613
|
const params = this.buildRequestParams(request);
|
|
593
614
|
const response = request.signal !== void 0 ? await this.client.messages.create(params, { signal: request.signal }) : await this.client.messages.create(params);
|
|
594
|
-
return this.mapResponse(response);
|
|
615
|
+
return this.mapResponse(response, forcesResponseTool(request));
|
|
595
616
|
}
|
|
596
617
|
/**
|
|
597
618
|
* Executes streaming completion and pushes chunks to the controller.
|
|
@@ -642,18 +663,17 @@ var ClaudeAdapter = class extends BaseAdapter {
|
|
|
642
663
|
if (request.tools !== void 0 && request.tools.length > 0) {
|
|
643
664
|
params.tools = request.tools.map(mapTool);
|
|
644
665
|
}
|
|
645
|
-
if (request
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
});
|
|
666
|
+
if (forcesResponseTool(request)) {
|
|
667
|
+
const respondTool = buildRespondTool(request.responseFormat);
|
|
668
|
+
params.tools = [...params.tools ?? [], respondTool];
|
|
669
|
+
params.tool_choice = { type: "tool", name: RESPOND_TOOL_NAME };
|
|
650
670
|
}
|
|
651
671
|
}
|
|
652
672
|
/**
|
|
653
673
|
* Maps Anthropic API response to our CompletionResponse format.
|
|
654
674
|
*/
|
|
655
|
-
mapResponse(response) {
|
|
656
|
-
const content = response.content.map(mapContentBlock);
|
|
675
|
+
mapResponse(response, surfaceRespondTool = false) {
|
|
676
|
+
const content = surfaceRespondTool ? mapResponseWithRespondTool(response.content) : response.content.map(mapContentBlock);
|
|
657
677
|
const usage = {
|
|
658
678
|
inputTokens: response.usage.input_tokens,
|
|
659
679
|
outputTokens: response.usage.output_tokens,
|
|
@@ -802,17 +822,39 @@ function extractProviderFactory(mod, factoryName) {
|
|
|
802
822
|
function extractAiSdkFunctions(mod) {
|
|
803
823
|
const generateText = mod["generateText"];
|
|
804
824
|
const streamText = mod["streamText"];
|
|
825
|
+
const generateObject = mod["generateObject"];
|
|
826
|
+
const jsonSchema = mod["jsonSchema"];
|
|
805
827
|
if (typeof generateText !== "function") {
|
|
806
828
|
throw new Error("AI SDK module missing expected export: 'generateText'");
|
|
807
829
|
}
|
|
808
830
|
if (typeof streamText !== "function") {
|
|
809
831
|
throw new Error("AI SDK module missing expected export: 'streamText'");
|
|
810
832
|
}
|
|
833
|
+
if (typeof generateObject !== "function") {
|
|
834
|
+
throw new Error("AI SDK module missing expected export: 'generateObject'");
|
|
835
|
+
}
|
|
836
|
+
if (typeof jsonSchema !== "function") {
|
|
837
|
+
throw new Error("AI SDK module missing expected export: 'jsonSchema'");
|
|
838
|
+
}
|
|
811
839
|
return {
|
|
812
840
|
generateText,
|
|
813
|
-
streamText
|
|
841
|
+
streamText,
|
|
842
|
+
generateObject,
|
|
843
|
+
jsonSchema
|
|
814
844
|
};
|
|
815
845
|
}
|
|
846
|
+
function isGenerateObjectResult(value) {
|
|
847
|
+
if (typeof value !== "object" || value === null) return false;
|
|
848
|
+
const record = value;
|
|
849
|
+
if (!("object" in record)) return false;
|
|
850
|
+
if (typeof record["finishReason"] !== "string") return false;
|
|
851
|
+
const usage = record["usage"];
|
|
852
|
+
if (typeof usage !== "object" || usage === null) return false;
|
|
853
|
+
const response = record["response"];
|
|
854
|
+
if (typeof response !== "object" || response === null) return false;
|
|
855
|
+
if (typeof response["modelId"] !== "string") return false;
|
|
856
|
+
return true;
|
|
857
|
+
}
|
|
816
858
|
function resolveApiKey(providerId, configKey) {
|
|
817
859
|
if (configKey !== void 0) return configKey;
|
|
818
860
|
const envVar = PROVIDER_ENV_KEYS[providerId];
|
|
@@ -970,6 +1012,50 @@ var SdkAdapter = class extends BaseAdapter {
|
|
|
970
1012
|
}
|
|
971
1013
|
return options;
|
|
972
1014
|
}
|
|
1015
|
+
/**
|
|
1016
|
+
* generateText path (text / absent responseFormat) — unchanged behavior.
|
|
1017
|
+
*/
|
|
1018
|
+
async completeText(sdk, options) {
|
|
1019
|
+
const result = await sdk.generateText(options);
|
|
1020
|
+
return {
|
|
1021
|
+
content: [{ type: "text", text: result.text }],
|
|
1022
|
+
usage: {
|
|
1023
|
+
inputTokens: result.usage.inputTokens ?? 0,
|
|
1024
|
+
outputTokens: result.usage.outputTokens ?? 0,
|
|
1025
|
+
totalTokens: result.usage.totalTokens ?? 0
|
|
1026
|
+
},
|
|
1027
|
+
stopReason: mapFinishReason(result.finishReason),
|
|
1028
|
+
model: result.response.modelId
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
/**
|
|
1032
|
+
* generateObject path (#3433) — json_object / json_schema responseFormat.
|
|
1033
|
+
*
|
|
1034
|
+
* Uses the AI SDK `jsonSchema` helper to build the schema handle
|
|
1035
|
+
* (permissive `{ type: 'object' }` for json_object), then stringifies the
|
|
1036
|
+
* returned object into a text content block so downstream parsers /
|
|
1037
|
+
* extractTextFromResponse keep working unchanged.
|
|
1038
|
+
*/
|
|
1039
|
+
async completeStructured(sdk, options, responseFormat) {
|
|
1040
|
+
const rawSchema = responseFormat.type === "json_schema" ? responseFormat.schema : { type: "object" };
|
|
1041
|
+
const schema = sdk.jsonSchema(rawSchema);
|
|
1042
|
+
const result = await sdk.generateObject({ ...options, schema });
|
|
1043
|
+
if (!isGenerateObjectResult(result)) {
|
|
1044
|
+
throw new Error(
|
|
1045
|
+
"AI SDK generateObject returned an unexpected result shape (missing object/usage/finishReason/response.modelId)"
|
|
1046
|
+
);
|
|
1047
|
+
}
|
|
1048
|
+
return {
|
|
1049
|
+
content: [{ type: "text", text: JSON.stringify(result.object) }],
|
|
1050
|
+
usage: {
|
|
1051
|
+
inputTokens: result.usage.inputTokens ?? 0,
|
|
1052
|
+
outputTokens: result.usage.outputTokens ?? 0,
|
|
1053
|
+
totalTokens: result.usage.totalTokens ?? 0
|
|
1054
|
+
},
|
|
1055
|
+
stopReason: mapFinishReason(result.finishReason),
|
|
1056
|
+
model: result.response.modelId
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
973
1059
|
async complete(request) {
|
|
974
1060
|
try {
|
|
975
1061
|
await this.ensureInitialized();
|
|
@@ -981,17 +1067,8 @@ var SdkAdapter = class extends BaseAdapter {
|
|
|
981
1067
|
);
|
|
982
1068
|
}
|
|
983
1069
|
const options = this.buildSdkOptions(request);
|
|
984
|
-
const
|
|
985
|
-
const response =
|
|
986
|
-
content: [{ type: "text", text: result.text }],
|
|
987
|
-
usage: {
|
|
988
|
-
inputTokens: result.usage.inputTokens ?? 0,
|
|
989
|
-
outputTokens: result.usage.outputTokens ?? 0,
|
|
990
|
-
totalTokens: result.usage.totalTokens ?? 0
|
|
991
|
-
},
|
|
992
|
-
stopReason: mapFinishReason(result.finishReason),
|
|
993
|
-
model: result.response.modelId
|
|
994
|
-
};
|
|
1070
|
+
const responseFormat = request.responseFormat;
|
|
1071
|
+
const response = responseFormat !== void 0 && responseFormat.type !== "text" ? await this.completeStructured(sdk, options, responseFormat) : await this.completeText(sdk, options);
|
|
995
1072
|
this.logResponse(response);
|
|
996
1073
|
return ok(response);
|
|
997
1074
|
} catch (error) {
|
|
@@ -4688,4 +4765,4 @@ export {
|
|
|
4688
4765
|
SdkAdapter,
|
|
4689
4766
|
createAutoAdapter
|
|
4690
4767
|
};
|
|
4691
|
-
//# sourceMappingURL=chunk-
|
|
4768
|
+
//# sourceMappingURL=chunk-N5I4PC3P.js.map
|