nexus-agents 2.107.1 → 2.109.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.
Files changed (27) hide show
  1. package/dist/{chunk-HSFLKLCK.js → chunk-6R5IEZGJ.js} +3 -3
  2. package/dist/{chunk-RIZPD2LX.js → chunk-HBPDYYIT.js} +2 -2
  3. package/dist/{chunk-W3QOKU42.js → chunk-HL22AVD4.js} +4 -4
  4. package/dist/{chunk-EDXT2FPY.js → chunk-ICOKYKLH.js} +8 -8
  5. package/dist/{chunk-2MPLNCGG.js → chunk-N5I4PC3P.js} +98 -21
  6. package/dist/chunk-N5I4PC3P.js.map +1 -0
  7. package/dist/{chunk-OKZTLUKU.js → chunk-RCN76RFJ.js} +106 -3
  8. package/dist/chunk-RCN76RFJ.js.map +1 -0
  9. package/dist/cli.js +6 -6
  10. package/dist/{consensus-vote-A6DOEWEZ.js → consensus-vote-HK5G3DYU.js} +3 -3
  11. package/dist/{expert-bridge-CP6XN5U7.js → expert-bridge-N7PLXYBV.js} +2 -2
  12. package/dist/{factory-AT4YGH24.js → factory-UVXXFLOI.js} +2 -2
  13. package/dist/index.d.ts +13 -4
  14. package/dist/index.js +14 -18
  15. package/dist/index.js.map +1 -1
  16. package/dist/{setup-command-VZ675W23.js → setup-command-BDBPSHZD.js} +4 -4
  17. package/package.json +1 -1
  18. package/dist/chunk-2MPLNCGG.js.map +0 -1
  19. package/dist/chunk-OKZTLUKU.js.map +0 -1
  20. /package/dist/{chunk-HSFLKLCK.js.map → chunk-6R5IEZGJ.js.map} +0 -0
  21. /package/dist/{chunk-RIZPD2LX.js.map → chunk-HBPDYYIT.js.map} +0 -0
  22. /package/dist/{chunk-W3QOKU42.js.map → chunk-HL22AVD4.js.map} +0 -0
  23. /package/dist/{chunk-EDXT2FPY.js.map → chunk-ICOKYKLH.js.map} +0 -0
  24. /package/dist/{consensus-vote-A6DOEWEZ.js.map → consensus-vote-HK5G3DYU.js.map} +0 -0
  25. /package/dist/{expert-bridge-CP6XN5U7.js.map → expert-bridge-N7PLXYBV.js.map} +0 -0
  26. /package/dist/{factory-AT4YGH24.js.map → factory-UVXXFLOI.js.map} +0 -0
  27. /package/dist/{setup-command-VZ675W23.js.map → setup-command-BDBPSHZD.js.map} +0 -0
@@ -8,10 +8,10 @@ import {
8
8
  checkSqlite,
9
9
  defaultConfig,
10
10
  initDataDirectories
11
- } from "./chunk-W3QOKU42.js";
11
+ } from "./chunk-HL22AVD4.js";
12
12
  import {
13
13
  probeAllClis
14
- } from "./chunk-2MPLNCGG.js";
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-HSFLKLCK.js.map
1990
+ //# sourceMappingURL=chunk-6R5IEZGJ.js.map
@@ -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-AT4YGH24.js");
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-RIZPD2LX.js.map
216
+ //# sourceMappingURL=chunk-HBPDYYIT.js.map
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  createAllAdapters,
9
9
  probeCli
10
- } from "./chunk-2MPLNCGG.js";
10
+ } from "./chunk-N5I4PC3P.js";
11
11
  import {
12
12
  DEFAULTS
13
13
  } from "./chunk-ZFDG2CDY.js";
@@ -40,7 +40,7 @@ import {
40
40
  } from "./chunk-CH7QIDHQ.js";
41
41
 
42
42
  // src/version.ts
43
- var VERSION = true ? "2.107.1" : "dev";
43
+ var VERSION = true ? "2.109.0" : "dev";
44
44
 
45
45
  // src/config/schemas-core.ts
46
46
  import { z } from "zod";
@@ -2096,7 +2096,7 @@ async function runDoctorFix(result) {
2096
2096
  writeLine2("\u2500".repeat(40));
2097
2097
  let fixCount = 0;
2098
2098
  if (!result.dataDirectory.rootExists || result.dataDirectory.subdirectories.some((d) => !d.exists || !d.writable)) {
2099
- const { runSetup } = await import("./setup-command-VZ675W23.js");
2099
+ const { runSetup } = await import("./setup-command-BDBPSHZD.js");
2100
2100
  const setupResult = runSetup({
2101
2101
  skipMcp: true,
2102
2102
  skipRules: true,
@@ -2208,4 +2208,4 @@ export {
2208
2208
  startStdioServer,
2209
2209
  closeServer
2210
2210
  };
2211
- //# sourceMappingURL=chunk-W3QOKU42.js.map
2211
+ //# sourceMappingURL=chunk-HL22AVD4.js.map
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-TJUGEDQI.js";
10
10
  import {
11
11
  executeExpert
12
- } from "./chunk-RIZPD2LX.js";
12
+ } from "./chunk-HBPDYYIT.js";
13
13
  import {
14
14
  EventTopics,
15
15
  JobStatusSchema,
@@ -30,7 +30,7 @@ import {
30
30
  writeJobComplete,
31
31
  writeJobFailed,
32
32
  writeJobPending
33
- } from "./chunk-OKZTLUKU.js";
33
+ } from "./chunk-RCN76RFJ.js";
34
34
  import {
35
35
  REGISTRY_PATH,
36
36
  getProjectRoot,
@@ -93,7 +93,7 @@ import {
93
93
  DEFAULT_TASK_TTL_MS,
94
94
  DEFAULT_TOOL_RATE_LIMITS,
95
95
  clampTaskTtl
96
- } from "./chunk-W3QOKU42.js";
96
+ } from "./chunk-HL22AVD4.js";
97
97
  import {
98
98
  resolveInsideRoot
99
99
  } from "./chunk-NUBSJGQZ.js";
@@ -109,7 +109,7 @@ import {
109
109
  getAvailableClis,
110
110
  sleep,
111
111
  withTimeout
112
- } from "./chunk-2MPLNCGG.js";
112
+ } from "./chunk-N5I4PC3P.js";
113
113
  import {
114
114
  DEFAULTS
115
115
  } from "./chunk-ZFDG2CDY.js";
@@ -42859,7 +42859,7 @@ var VALID_TEMPLATES = /* @__PURE__ */ new Set([
42859
42859
  ]);
42860
42860
  async function classifyWithLLM(task) {
42861
42861
  try {
42862
- const { executeExpert: executeExpert2 } = await import("./expert-bridge-CP6XN5U7.js");
42862
+ const { executeExpert: executeExpert2 } = await import("./expert-bridge-N7PLXYBV.js");
42863
42863
  const prompt = [
42864
42864
  "Classify this task into exactly one pipeline template.",
42865
42865
  "Templates: dev (implementation/bug fix/refactor), research (investigate/evaluate/compare),",
@@ -43999,7 +43999,7 @@ ${contextBlock}`;
43999
43999
  const strategy = config.votingStrategy ?? "higher_order";
44000
44000
  await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
44001
44001
  try {
44002
- const { executeVoting } = await import("./consensus-vote-A6DOEWEZ.js");
44002
+ const { executeVoting } = await import("./consensus-vote-HK5G3DYU.js");
44003
44003
  const votingResult = await executeVoting(
44004
44004
  {
44005
44005
  proposal: buildVoteProposal(plan, research),
@@ -46594,7 +46594,7 @@ async function probeSource(source, includeModelIds) {
46594
46594
  }
46595
46595
  }
46596
46596
  async function defaultSources(includeOpenRouter) {
46597
- const { createAllAdapters: createAllAdapters2 } = await import("./factory-AT4YGH24.js");
46597
+ const { createAllAdapters: createAllAdapters2 } = await import("./factory-UVXXFLOI.js");
46598
46598
  const adapters = createAllAdapters2();
46599
46599
  return buildDefaultModelSources(adapters, { includeOpenRouter });
46600
46600
  }
@@ -50920,4 +50920,4 @@ export {
50920
50920
  detectBackend,
50921
50921
  createTaskTracker
50922
50922
  };
50923
- //# sourceMappingURL=chunk-EDXT2FPY.js.map
50923
+ //# sourceMappingURL=chunk-ICOKYKLH.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.responseFormat !== void 0 && request.responseFormat.type !== "text") {
646
- this.logger.warn("responseFormat is not supported by Claude adapter", {
647
- requestedFormat: request.responseFormat.type,
648
- suggestion: "Use tool use or prompt engineering for structured output"
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 result = await sdk.generateText(options);
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-2MPLNCGG.js.map
4768
+ //# sourceMappingURL=chunk-N5I4PC3P.js.map