zelari-code 1.47.1 → 1.47.2

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.
@@ -2873,15 +2873,90 @@ var init_advancedTools = __esm({
2873
2873
 
2874
2874
  // packages/core/dist/core/tools/zodBridge.js
2875
2875
  function zodToJsonSchema(schema) {
2876
+ let out;
2876
2877
  if (typeof schema.toJSONSchema === "function") {
2877
2878
  const res = schema.toJSONSchema();
2878
2879
  if (res && typeof res === "object") {
2879
2880
  const copy = { ...res };
2880
2881
  delete copy["$schema"];
2881
- return copy;
2882
+ out = copy;
2883
+ } else {
2884
+ out = _convert(schema);
2885
+ }
2886
+ } else {
2887
+ out = _convert(schema);
2888
+ }
2889
+ return ensureRootObjectType(out);
2890
+ }
2891
+ function ensureRootObjectType(schema) {
2892
+ if (schema.type === "object")
2893
+ return schema;
2894
+ const variants = schema.anyOf ?? schema.oneOf;
2895
+ if (!Array.isArray(variants) || variants.length === 0)
2896
+ return schema;
2897
+ const branches = [];
2898
+ for (const v of variants) {
2899
+ if (!v || typeof v !== "object" || Array.isArray(v) || v.type !== "object") {
2900
+ return schema;
2901
+ }
2902
+ branches.push(v);
2903
+ }
2904
+ const distinct = /* @__PURE__ */ new Map();
2905
+ for (const b of branches) {
2906
+ const props = b.properties ?? {};
2907
+ for (const [key, val] of Object.entries(props)) {
2908
+ const list = distinct.get(key) ?? [];
2909
+ if (!list.some((s) => JSON.stringify(s) === JSON.stringify(val)))
2910
+ list.push(val);
2911
+ distinct.set(key, list);
2912
+ }
2913
+ }
2914
+ const properties = {};
2915
+ for (const [key, schemas] of distinct) {
2916
+ if (schemas.length === 1) {
2917
+ properties[key] = schemas[0];
2918
+ continue;
2919
+ }
2920
+ const consts = [];
2921
+ let allConst = true;
2922
+ for (const s of schemas) {
2923
+ if (s && typeof s === "object" && "const" in s) {
2924
+ consts.push(s.const);
2925
+ } else {
2926
+ allConst = false;
2927
+ break;
2928
+ }
2882
2929
  }
2930
+ if (allConst) {
2931
+ const merged2 = { enum: consts };
2932
+ const t = typeof consts[0];
2933
+ if (consts.every((c) => typeof c === t)) {
2934
+ if (t === "string")
2935
+ merged2.type = "string";
2936
+ else if (t === "boolean")
2937
+ merged2.type = "boolean";
2938
+ else if (t === "number")
2939
+ merged2.type = Number.isInteger(consts[0]) ? "integer" : "number";
2940
+ }
2941
+ properties[key] = merged2;
2942
+ } else {
2943
+ properties[key] = { anyOf: schemas };
2944
+ }
2945
+ }
2946
+ let required2;
2947
+ for (const b of branches) {
2948
+ const req = Array.isArray(b.required) ? b.required.filter((k) => typeof k === "string") : [];
2949
+ required2 = required2 === void 0 ? [...req] : required2.filter((k) => req.includes(k));
2883
2950
  }
2884
- return _convert(schema);
2951
+ const merged = {
2952
+ type: "object",
2953
+ properties,
2954
+ required: required2 ?? []
2955
+ };
2956
+ if (branches.every((b) => b.additionalProperties === false)) {
2957
+ merged.additionalProperties = false;
2958
+ }
2959
+ return merged;
2885
2960
  }
2886
2961
  function _convert(schema) {
2887
2962
  const def = schema._def;
@@ -19444,7 +19519,7 @@ var init_web = __esm({
19444
19519
 
19445
19520
  // packages/core/dist/agents/harnessToolBridge.js
19446
19521
  function toEnhanced(tool) {
19447
- const schema = zodToJsonSchema(tool.inputSchema);
19522
+ const schema = tool.jsonSchema ?? zodToJsonSchema(tool.inputSchema);
19448
19523
  return {
19449
19524
  name: tool.name,
19450
19525
  description: tool.description,
@@ -32815,6 +32890,7 @@ function createInspectCommandTool(rootOrDeps) {
32815
32890
  permissions: ["read"],
32816
32891
  timeoutMs: 9e4,
32817
32892
  inputSchema: inspectInputSchema,
32893
+ jsonSchema: inspectJsonSchema,
32818
32894
  execute: async (input, ctx) => {
32819
32895
  const op = input;
32820
32896
  const cwd = ctx?.cwd ?? deps.root;
@@ -32847,7 +32923,7 @@ function createInspectCommandTool(rootOrDeps) {
32847
32923
  };
32848
32924
  return tool;
32849
32925
  }
32850
- var MAX_OUTPUT_CHARS, SPAWN_TIMEOUT_MS, TYPECHECK_TIMEOUT_MS, inspectInputSchema;
32926
+ var MAX_OUTPUT_CHARS, SPAWN_TIMEOUT_MS, TYPECHECK_TIMEOUT_MS, inspectInputSchema, INSPECT_OPERATIONS, inspectJsonSchema;
32851
32927
  var init_inspectCommand = __esm({
32852
32928
  "src/cli/tools/inspectCommand.ts"() {
32853
32929
  "use strict";
@@ -32878,6 +32954,29 @@ var init_inspectCommand = __esm({
32878
32954
  external_exports.object({ operation: external_exports.literal("npm_outdated") }),
32879
32955
  external_exports.object({ operation: external_exports.literal("npm_view"), package: external_exports.string().min(1) })
32880
32956
  ]);
32957
+ INSPECT_OPERATIONS = inspectInputSchema.options.map(
32958
+ (variant) => variant.shape.operation.value
32959
+ );
32960
+ inspectJsonSchema = {
32961
+ type: "object",
32962
+ properties: {
32963
+ operation: {
32964
+ type: "string",
32965
+ enum: INSPECT_OPERATIONS,
32966
+ description: "Inspection to run \u2014 pick from the menu instead of writing a command."
32967
+ },
32968
+ short: { type: "boolean", description: "git_status only: --short form." },
32969
+ limit: { type: "integer", minimum: 1, maximum: 200, description: "git_log only: max commits (default 20)." },
32970
+ oneline: { type: "boolean", description: "git_log only: one line per commit." },
32971
+ staged: { type: "boolean", description: "git_diff only: staged changes." },
32972
+ path: { type: "string", description: "git_diff only: limit the diff to this path." },
32973
+ ref: { type: "string", description: "git_show only (required there): commit or ref to show." },
32974
+ project: { type: "string", description: "typecheck only: subdirectory containing tsconfig.json." },
32975
+ package: { type: "string", description: "npm_view only (required there): package name." }
32976
+ },
32977
+ required: ["operation"],
32978
+ additionalProperties: false
32979
+ };
32881
32980
  }
32882
32981
  });
32883
32982