@cognipeer/agent-sdk 0.8.9 → 0.8.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/index.cjs +297 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +81 -6
- package/dist/index.d.ts +81 -6
- package/dist/index.mjs +296 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2014,6 +2014,177 @@ function extractMessageText2(message) {
|
|
|
2014
2014
|
return "";
|
|
2015
2015
|
}
|
|
2016
2016
|
|
|
2017
|
+
// src/smart/toolArgCoercion.ts
|
|
2018
|
+
var PLACEHOLDER_TEXT = /* @__PURE__ */ new Set(["", "null", "undefined", "none", "nil", "n/a", "na"]);
|
|
2019
|
+
var ENVELOPE_KEYS = ["input", "args", "arguments", "params", "parameters", "payload"];
|
|
2020
|
+
function defOf(schema) {
|
|
2021
|
+
const def = schema?._def;
|
|
2022
|
+
return def && typeof def === "object" ? def : null;
|
|
2023
|
+
}
|
|
2024
|
+
function isPlaceholder(value) {
|
|
2025
|
+
return typeof value === "string" && PLACEHOLDER_TEXT.has(value.trim().toLowerCase());
|
|
2026
|
+
}
|
|
2027
|
+
function parseJsonish(value) {
|
|
2028
|
+
const text = value.trim();
|
|
2029
|
+
if (!text.startsWith("{") && !text.startsWith("[")) return { ok: false };
|
|
2030
|
+
try {
|
|
2031
|
+
return { ok: true, value: JSON.parse(text) };
|
|
2032
|
+
} catch {
|
|
2033
|
+
return { ok: false };
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
function safeParses(schema, value) {
|
|
2037
|
+
try {
|
|
2038
|
+
return schema.safeParse(value).success === true;
|
|
2039
|
+
} catch {
|
|
2040
|
+
return false;
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
function coerceToolArgs(schema, value) {
|
|
2044
|
+
try {
|
|
2045
|
+
return coerceNode(schema, value, 0);
|
|
2046
|
+
} catch {
|
|
2047
|
+
return value;
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
function coerceNode(schema, value, depth) {
|
|
2051
|
+
if (depth > 12) return value;
|
|
2052
|
+
const def = defOf(schema);
|
|
2053
|
+
if (!def) return value;
|
|
2054
|
+
switch (def.typeName) {
|
|
2055
|
+
case "ZodOptional":
|
|
2056
|
+
case "ZodNullable": {
|
|
2057
|
+
if (value === void 0 || value === null) return value;
|
|
2058
|
+
if (isPlaceholder(value)) return void 0;
|
|
2059
|
+
return coerceNode(def.innerType, value, depth + 1);
|
|
2060
|
+
}
|
|
2061
|
+
case "ZodDefault":
|
|
2062
|
+
case "ZodCatch":
|
|
2063
|
+
case "ZodReadonly":
|
|
2064
|
+
case "ZodBranded":
|
|
2065
|
+
return coerceNode(def.innerType, value, depth + 1);
|
|
2066
|
+
case "ZodEffects":
|
|
2067
|
+
return coerceNode(def.schema, value, depth + 1);
|
|
2068
|
+
case "ZodPipeline":
|
|
2069
|
+
return coerceNode(def.in, value, depth + 1);
|
|
2070
|
+
case "ZodLazy":
|
|
2071
|
+
return coerceNode(def.getter(), value, depth + 1);
|
|
2072
|
+
case "ZodObject":
|
|
2073
|
+
return coerceObject(def, value, depth);
|
|
2074
|
+
case "ZodRecord": {
|
|
2075
|
+
const unwrapped = unwrapJsonString(value);
|
|
2076
|
+
if (!unwrapped || typeof unwrapped !== "object" || Array.isArray(unwrapped)) return unwrapped ?? value;
|
|
2077
|
+
const out = {};
|
|
2078
|
+
for (const [key, entry] of Object.entries(unwrapped)) {
|
|
2079
|
+
out[key] = def.valueType ? coerceNode(def.valueType, entry, depth + 1) : entry;
|
|
2080
|
+
}
|
|
2081
|
+
return out;
|
|
2082
|
+
}
|
|
2083
|
+
case "ZodArray": {
|
|
2084
|
+
const unwrapped = unwrapJsonString(value);
|
|
2085
|
+
const items = Array.isArray(unwrapped) ? unwrapped : unwrapped === void 0 || unwrapped === null ? unwrapped : [unwrapped];
|
|
2086
|
+
if (!Array.isArray(items)) return items;
|
|
2087
|
+
return items.map((item) => coerceNode(def.type, item, depth + 1));
|
|
2088
|
+
}
|
|
2089
|
+
case "ZodTuple": {
|
|
2090
|
+
const unwrapped = unwrapJsonString(value);
|
|
2091
|
+
if (!Array.isArray(unwrapped)) return unwrapped ?? value;
|
|
2092
|
+
const items = def.items ?? [];
|
|
2093
|
+
return unwrapped.map((item, index) => items[index] ? coerceNode(items[index], item, depth + 1) : item);
|
|
2094
|
+
}
|
|
2095
|
+
case "ZodNumber": {
|
|
2096
|
+
if (typeof value === "number") return value;
|
|
2097
|
+
if (typeof value === "string" && value.trim() !== "") {
|
|
2098
|
+
const parsed = Number(value.trim());
|
|
2099
|
+
if (Number.isFinite(parsed)) return parsed;
|
|
2100
|
+
}
|
|
2101
|
+
if (typeof value === "boolean") return value ? 1 : 0;
|
|
2102
|
+
return value;
|
|
2103
|
+
}
|
|
2104
|
+
case "ZodBoolean": {
|
|
2105
|
+
if (typeof value === "boolean") return value;
|
|
2106
|
+
if (typeof value === "string") {
|
|
2107
|
+
const text = value.trim().toLowerCase();
|
|
2108
|
+
if (text === "true" || text === "yes" || text === "1") return true;
|
|
2109
|
+
if (text === "false" || text === "no" || text === "0") return false;
|
|
2110
|
+
}
|
|
2111
|
+
if (value === 1) return true;
|
|
2112
|
+
if (value === 0) return false;
|
|
2113
|
+
return value;
|
|
2114
|
+
}
|
|
2115
|
+
case "ZodString": {
|
|
2116
|
+
if (typeof value === "string") return value;
|
|
2117
|
+
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
2118
|
+
if (value && typeof value === "object") {
|
|
2119
|
+
try {
|
|
2120
|
+
return JSON.stringify(value);
|
|
2121
|
+
} catch {
|
|
2122
|
+
return value;
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
return value;
|
|
2126
|
+
}
|
|
2127
|
+
case "ZodEnum": {
|
|
2128
|
+
if (typeof value !== "string") return value;
|
|
2129
|
+
const values = def.values ?? [];
|
|
2130
|
+
if (values.includes(value)) return value;
|
|
2131
|
+
const match = values.find((option) => option.toLowerCase() === value.trim().toLowerCase());
|
|
2132
|
+
return match ?? value;
|
|
2133
|
+
}
|
|
2134
|
+
case "ZodNativeEnum": {
|
|
2135
|
+
if (typeof value !== "string") return value;
|
|
2136
|
+
const values = Object.values(def.values ?? {}).filter((option) => typeof option === "string");
|
|
2137
|
+
if (values.includes(value)) return value;
|
|
2138
|
+
return values.find((option) => option.toLowerCase() === value.trim().toLowerCase()) ?? value;
|
|
2139
|
+
}
|
|
2140
|
+
case "ZodUnion":
|
|
2141
|
+
case "ZodDiscriminatedUnion": {
|
|
2142
|
+
const options = def.options ? Array.isArray(def.options) ? def.options : Array.from(def.options.values()) : [];
|
|
2143
|
+
for (const option of options) {
|
|
2144
|
+
const candidate = coerceNode(option, value, depth + 1);
|
|
2145
|
+
if (safeParses(option, candidate)) return candidate;
|
|
2146
|
+
}
|
|
2147
|
+
return value;
|
|
2148
|
+
}
|
|
2149
|
+
default:
|
|
2150
|
+
return value;
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2153
|
+
function unwrapJsonString(value) {
|
|
2154
|
+
if (typeof value !== "string") return value;
|
|
2155
|
+
if (isPlaceholder(value)) return void 0;
|
|
2156
|
+
const parsed = parseJsonish(value);
|
|
2157
|
+
return parsed.ok ? parsed.value : value;
|
|
2158
|
+
}
|
|
2159
|
+
function coerceObject(def, value, depth) {
|
|
2160
|
+
const unwrapped = unwrapJsonString(value);
|
|
2161
|
+
if (!unwrapped || typeof unwrapped !== "object" || Array.isArray(unwrapped)) return unwrapped ?? value;
|
|
2162
|
+
const shape = typeof def.shape === "function" ? def.shape() : def.shape ?? {};
|
|
2163
|
+
const shapeKeys = Object.keys(shape);
|
|
2164
|
+
let source = unwrapped;
|
|
2165
|
+
if (depth === 0 && shapeKeys.length > 0) {
|
|
2166
|
+
const keys = Object.keys(source);
|
|
2167
|
+
if (keys.length === 1 && !shapeKeys.includes(keys[0]) && ENVELOPE_KEYS.includes(keys[0].toLowerCase())) {
|
|
2168
|
+
const inner = unwrapJsonString(source[keys[0]]);
|
|
2169
|
+
if (inner && typeof inner === "object" && !Array.isArray(inner)) {
|
|
2170
|
+
source = inner;
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
const out = {};
|
|
2175
|
+
for (const [key, entry] of Object.entries(source)) {
|
|
2176
|
+
const field = shape[key];
|
|
2177
|
+
if (!field) {
|
|
2178
|
+
out[key] = entry;
|
|
2179
|
+
continue;
|
|
2180
|
+
}
|
|
2181
|
+
const coerced = coerceNode(field, entry, depth + 1);
|
|
2182
|
+
if (coerced === void 0) continue;
|
|
2183
|
+
out[key] = coerced;
|
|
2184
|
+
}
|
|
2185
|
+
return out;
|
|
2186
|
+
}
|
|
2187
|
+
|
|
2017
2188
|
// src/smart/toolResponses.ts
|
|
2018
2189
|
var CONTROL_PLANE_TOOL_NAMES = [
|
|
2019
2190
|
"response",
|
|
@@ -2216,17 +2387,60 @@ Use get_tool_response with executionId "${refId}" only if you must recover the o
|
|
|
2216
2387
|
}
|
|
2217
2388
|
function validateToolArgs(tool, args) {
|
|
2218
2389
|
const schema = tool.schema;
|
|
2219
|
-
if (!schema || typeof schema.
|
|
2390
|
+
if (!schema || typeof schema.safeParse !== "function") {
|
|
2220
2391
|
return { ok: true, value: args };
|
|
2221
2392
|
}
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
}
|
|
2229
|
-
|
|
2393
|
+
const direct = schema.safeParse(args);
|
|
2394
|
+
if (direct.success) {
|
|
2395
|
+
return { ok: true, value: direct.data };
|
|
2396
|
+
}
|
|
2397
|
+
const repaired = schema.safeParse(coerceToolArgs(schema, args));
|
|
2398
|
+
if (repaired.success) {
|
|
2399
|
+
return { ok: true, value: repaired.data, coerced: true };
|
|
2400
|
+
}
|
|
2401
|
+
const error = direct.error;
|
|
2402
|
+
if (error instanceof ZodError) {
|
|
2403
|
+
const issues = error.issues.map((issue) => `${issue.path.join(".") || "root"}: ${issue.message}`).join("; ");
|
|
2404
|
+
const expected = describeExpectedArgs(schema);
|
|
2405
|
+
return { ok: false, message: expected ? `${issues}. Expected arguments: ${expected}` : issues };
|
|
2406
|
+
}
|
|
2407
|
+
return { ok: false, message: error instanceof Error ? error.message : String(error) };
|
|
2408
|
+
}
|
|
2409
|
+
function describeExpectedArgs(schema) {
|
|
2410
|
+
const shape = typeof schema?._def?.shape === "function" ? schema._def.shape() : schema?._def?.shape;
|
|
2411
|
+
if (!shape || typeof shape !== "object") return null;
|
|
2412
|
+
const parts = Object.entries(shape).map(([key, field]) => {
|
|
2413
|
+
const { typeName, optional } = describeField(field);
|
|
2414
|
+
return `${key}${optional ? "?" : ""}: ${typeName}`;
|
|
2415
|
+
});
|
|
2416
|
+
return parts.length > 0 ? parts.join(", ") : null;
|
|
2417
|
+
}
|
|
2418
|
+
function describeField(field, depth = 0) {
|
|
2419
|
+
const def = field?._def;
|
|
2420
|
+
if (!def || depth > 6) return { typeName: "value", optional: false };
|
|
2421
|
+
switch (def.typeName) {
|
|
2422
|
+
case "ZodOptional":
|
|
2423
|
+
case "ZodNullable":
|
|
2424
|
+
case "ZodDefault":
|
|
2425
|
+
return { typeName: describeField(def.innerType, depth + 1).typeName, optional: true };
|
|
2426
|
+
case "ZodEffects":
|
|
2427
|
+
return { ...describeField(def.schema, depth + 1), optional: describeField(def.schema, depth + 1).optional };
|
|
2428
|
+
case "ZodObject":
|
|
2429
|
+
return { typeName: "object", optional: false };
|
|
2430
|
+
case "ZodArray":
|
|
2431
|
+
return { typeName: `array of ${describeField(def.type, depth + 1).typeName}`, optional: false };
|
|
2432
|
+
case "ZodRecord":
|
|
2433
|
+
return { typeName: "object", optional: false };
|
|
2434
|
+
case "ZodString":
|
|
2435
|
+
return { typeName: "string", optional: false };
|
|
2436
|
+
case "ZodNumber":
|
|
2437
|
+
return { typeName: "number", optional: false };
|
|
2438
|
+
case "ZodBoolean":
|
|
2439
|
+
return { typeName: "boolean", optional: false };
|
|
2440
|
+
case "ZodEnum":
|
|
2441
|
+
return { typeName: `one of ${(def.values ?? []).join("|")}`, optional: false };
|
|
2442
|
+
default:
|
|
2443
|
+
return { typeName: "value", optional: false };
|
|
2230
2444
|
}
|
|
2231
2445
|
}
|
|
2232
2446
|
|
|
@@ -4289,7 +4503,7 @@ var LEVEL_DEFAULTS = {
|
|
|
4289
4503
|
};
|
|
4290
4504
|
var VALID_LEVELS = ["minimal", "low", "medium", "high"];
|
|
4291
4505
|
var VALID_CADENCES = ["off", "every_turn", "after_tool", "on_branch", "initial_then_after_tool"];
|
|
4292
|
-
var VALID_EFFORTS = ["minimal", "low", "medium", "high"];
|
|
4506
|
+
var VALID_EFFORTS = ["none", "minimal", "low", "medium", "high"];
|
|
4293
4507
|
function validateReasoningConfig(input) {
|
|
4294
4508
|
if (!input) return;
|
|
4295
4509
|
if (input.level !== void 0 && !VALID_LEVELS.includes(input.level)) {
|
|
@@ -8783,12 +8997,19 @@ function parseSSEBlock(block) {
|
|
|
8783
8997
|
|
|
8784
8998
|
// src/providers/utils/reasoning.ts
|
|
8785
8999
|
var ANTHROPIC_EFFORT_BUDGET = {
|
|
9000
|
+
// 0 = off. `applyAnthropicReasoning` bails on a falsy budget and emits no
|
|
9001
|
+
// thinking block, which on Anthropic IS off — thinking there is opt-in.
|
|
9002
|
+
none: 0,
|
|
8786
9003
|
minimal: 1024,
|
|
8787
9004
|
low: 2048,
|
|
8788
9005
|
medium: 8192,
|
|
8789
9006
|
high: 16384
|
|
8790
9007
|
};
|
|
8791
9008
|
var GEMINI_EFFORT_BUDGET = {
|
|
9009
|
+
// 0 is Gemini's own documented spelling for "do not think", and unlike
|
|
9010
|
+
// Anthropic it has to be SENT — hence `applyGeminiReasoning` testing for null
|
|
9011
|
+
// rather than falsiness.
|
|
9012
|
+
none: 0,
|
|
8792
9013
|
minimal: 512,
|
|
8793
9014
|
low: 1024,
|
|
8794
9015
|
medium: 4096,
|
|
@@ -8864,14 +9085,15 @@ function clampBudget(budget, maxTokens) {
|
|
|
8864
9085
|
}
|
|
8865
9086
|
function normalizeEffort(effort) {
|
|
8866
9087
|
if (!effort) return void 0;
|
|
8867
|
-
const allowed = ["minimal", "low", "medium", "high"];
|
|
9088
|
+
const allowed = ["none", "minimal", "low", "medium", "high"];
|
|
8868
9089
|
return allowed.includes(effort) ? effort : void 0;
|
|
8869
9090
|
}
|
|
8870
9091
|
function resolveBudget(reasoning, effortBudget) {
|
|
9092
|
+
const effort = normalizeEffort(reasoning.effort);
|
|
9093
|
+
if (effort === "none") return 0;
|
|
8871
9094
|
if (typeof reasoning.budgetTokens === "number" && reasoning.budgetTokens > 0) {
|
|
8872
9095
|
return Math.floor(reasoning.budgetTokens);
|
|
8873
9096
|
}
|
|
8874
|
-
const effort = normalizeEffort(reasoning.effort);
|
|
8875
9097
|
if (effort && effortBudget[effort]) return effortBudget[effort];
|
|
8876
9098
|
return void 0;
|
|
8877
9099
|
}
|
|
@@ -8960,12 +9182,21 @@ var OpenAIProvider = class extends BaseProvider {
|
|
|
8960
9182
|
...config.defaultHeaders,
|
|
8961
9183
|
...config.organization ? { "OpenAI-Organization": config.organization } : {}
|
|
8962
9184
|
};
|
|
9185
|
+
this.responsesApi = config.responsesApi ?? "auto";
|
|
8963
9186
|
if (config.retry) this.retryPolicy = { ...this.retryPolicy, ...config.retry };
|
|
8964
9187
|
}
|
|
8965
|
-
/** True when
|
|
8966
|
-
*
|
|
8967
|
-
*
|
|
9188
|
+
/** True when this request should go to the Responses API rather than Chat
|
|
9189
|
+
* Completions — which exposes `reasoning.effort` and reasoning summaries that
|
|
9190
|
+
* Chat Completions silently drops.
|
|
9191
|
+
*
|
|
9192
|
+
* `auto` (the default) keeps the historical rule: only when the request
|
|
9193
|
+
* carries a reasoning config AND the model name looks like an o-series/gpt-5
|
|
9194
|
+
* model. `never`/`always` let a caller state the answer instead, because the
|
|
9195
|
+
* name check is a guess and the two APIs differ in far more than reasoning —
|
|
9196
|
+
* see `responsesApi` in OpenAIProviderConfig. */
|
|
8968
9197
|
useResponsesApi(request) {
|
|
9198
|
+
if (this.responsesApi === "never") return false;
|
|
9199
|
+
if (this.responsesApi === "always") return true;
|
|
8969
9200
|
if (!request.reasoning) return false;
|
|
8970
9201
|
return isReasoningModel(request.model || this.defaultModel);
|
|
8971
9202
|
}
|
|
@@ -10828,7 +11059,7 @@ function fromNativeProvider(provider, options) {
|
|
|
10828
11059
|
if (tools?.length) req.tools = tools;
|
|
10829
11060
|
if (opts?.extra) req.extra = opts.extra;
|
|
10830
11061
|
const reasoningOverride = invokeOptions?.reasoning;
|
|
10831
|
-
const reasoningCfg =
|
|
11062
|
+
const reasoningCfg = mergeReasoning(opts?.reasoning, reasoningOverride);
|
|
10832
11063
|
if (reasoningCfg) req.reasoning = reasoningCfg;
|
|
10833
11064
|
const tc = invokeOptions?.tool_choice ?? invokeOptions?.toolChoice;
|
|
10834
11065
|
if (tc && tools?.length) {
|
|
@@ -10857,6 +11088,15 @@ function fromNativeProvider(provider, options) {
|
|
|
10857
11088
|
return req;
|
|
10858
11089
|
}
|
|
10859
11090
|
}
|
|
11091
|
+
function mergeReasoning(base, override) {
|
|
11092
|
+
if (!base) return override;
|
|
11093
|
+
if (!override) return base;
|
|
11094
|
+
const merged = { ...base, ...override };
|
|
11095
|
+
if (base.providerExtras || override.providerExtras) {
|
|
11096
|
+
merged.providerExtras = { ...base.providerExtras, ...override.providerExtras };
|
|
11097
|
+
}
|
|
11098
|
+
return merged;
|
|
11099
|
+
}
|
|
10860
11100
|
function toUnifiedMessage(msg) {
|
|
10861
11101
|
const unified = {
|
|
10862
11102
|
role: msg.role,
|
|
@@ -11023,6 +11263,43 @@ function convertToJsonSchema(schema, strict = false) {
|
|
|
11023
11263
|
}
|
|
11024
11264
|
return converted;
|
|
11025
11265
|
}
|
|
11266
|
+
function simplifyOptionalNullableUnions(schema, required = null) {
|
|
11267
|
+
if (!schema || typeof schema !== "object") return schema;
|
|
11268
|
+
const clone2 = { ...schema };
|
|
11269
|
+
if (clone2.properties && typeof clone2.properties === "object") {
|
|
11270
|
+
const requiredKeys = new Set(Array.isArray(clone2.required) ? clone2.required : []);
|
|
11271
|
+
const properties = {};
|
|
11272
|
+
for (const [key, value] of Object.entries(clone2.properties)) {
|
|
11273
|
+
const child = simplifyOptionalNullableUnions(value, requiredKeys);
|
|
11274
|
+
properties[key] = requiredKeys.has(key) ? child : dropNullBranch(child);
|
|
11275
|
+
}
|
|
11276
|
+
clone2.properties = properties;
|
|
11277
|
+
}
|
|
11278
|
+
if (clone2.items) clone2.items = simplifyOptionalNullableUnions(clone2.items, required);
|
|
11279
|
+
for (const key of ["anyOf", "oneOf", "allOf"]) {
|
|
11280
|
+
if (Array.isArray(clone2[key])) {
|
|
11281
|
+
clone2[key] = clone2[key].map((entry) => simplifyOptionalNullableUnions(entry, required));
|
|
11282
|
+
}
|
|
11283
|
+
}
|
|
11284
|
+
return clone2;
|
|
11285
|
+
}
|
|
11286
|
+
function dropNullBranch(schema) {
|
|
11287
|
+
if (!schema || typeof schema !== "object") return schema;
|
|
11288
|
+
if (Array.isArray(schema.type) && schema.type.includes("null") && schema.type.length === 2) {
|
|
11289
|
+
return { ...schema, type: schema.type.find((entry) => entry !== "null") };
|
|
11290
|
+
}
|
|
11291
|
+
if (Array.isArray(schema.anyOf)) {
|
|
11292
|
+
const branches = schema.anyOf.filter((entry) => entry?.type !== "null");
|
|
11293
|
+
if (branches.length === 1 && branches.length !== schema.anyOf.length) {
|
|
11294
|
+
const { anyOf, ...rest } = schema;
|
|
11295
|
+
return { ...branches[0], ...rest };
|
|
11296
|
+
}
|
|
11297
|
+
if (branches.length !== schema.anyOf.length && branches.length > 1) {
|
|
11298
|
+
return { ...schema, anyOf: branches };
|
|
11299
|
+
}
|
|
11300
|
+
}
|
|
11301
|
+
return schema;
|
|
11302
|
+
}
|
|
11026
11303
|
function normalizeStrictSchema(schema) {
|
|
11027
11304
|
if (!schema || typeof schema !== "object") return schema;
|
|
11028
11305
|
const clone2 = { ...schema };
|
|
@@ -11087,6 +11364,8 @@ function toToolDefinition(tool, strict) {
|
|
|
11087
11364
|
parameters = convertToJsonSchema(rawSchema, useStrict);
|
|
11088
11365
|
if (useStrict) {
|
|
11089
11366
|
parameters = normalizeStrictSchema(parameters);
|
|
11367
|
+
} else {
|
|
11368
|
+
parameters = simplifyOptionalNullableUnions(parameters);
|
|
11090
11369
|
}
|
|
11091
11370
|
return { name, description, parameters, ...useStrict ? { strict: true } : {} };
|
|
11092
11371
|
}
|
|
@@ -11223,6 +11502,6 @@ function createProvider(config) {
|
|
|
11223
11502
|
}
|
|
11224
11503
|
}
|
|
11225
11504
|
|
|
11226
|
-
export { ASK_USER_TOOL_NAME, AnthropicProvider, AzureProvider, BaseProvider, BedrockProvider, CCRStore, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_TOOL_NAMES, DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS, DELEGATION_TOOL_NAMES, DedupTracker, GuardrailPhase, InMemoryMemoryStore, NativeJsonSchemaStrategy, OpenAICompatibleProvider, OpenAIProvider, ProviderError, SMALL_TIER_SKILL_POLICY, StructuredOutputManager, TOOL_INPUT_DIGEST_KEY, ToolBasedStrategy, VertexProvider, agentVerdictRule, appendBoundTools, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, canOpenSkill, canSpawn, captureSnapshot, codePresenceRule, cognipeerSink, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createJsonGuardrail, createManageTodoTool, createOpenSkillTool, createParallelTool, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customSink, dedupeToolsByName, defaultTokenCounter, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, emptyUsage, evaluateGuardrails, extractLatestUserQuery, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasToolResponseRecoveryReference, httpSink, isSmartModel, jsonSchemaRule, loadSkillsFromDisk, normalizeSmartAgentOptions, otlpSink, parseSkillFrontmatter, readMemoryFacts, regexRule, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, restoreSnapshot, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, setTokenCounter, startStreamingSession, summarizeObject, tokenize, traceSessionToOtlp, validateReasoningConfig, withTools, withinDepth, writeSummaryFactsToMemory };
|
|
11505
|
+
export { ASK_USER_TOOL_NAME, AnthropicProvider, AzureProvider, BaseProvider, BedrockProvider, CCRStore, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_TOOL_NAMES, DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS, DELEGATION_TOOL_NAMES, DedupTracker, GuardrailPhase, InMemoryMemoryStore, NativeJsonSchemaStrategy, OpenAICompatibleProvider, OpenAIProvider, ProviderError, SMALL_TIER_SKILL_POLICY, StructuredOutputManager, TOOL_INPUT_DIGEST_KEY, ToolBasedStrategy, VertexProvider, agentVerdictRule, appendBoundTools, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, canOpenSkill, canSpawn, captureSnapshot, codePresenceRule, coerceToolArgs, cognipeerSink, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createJsonGuardrail, createManageTodoTool, createOpenSkillTool, createParallelTool, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customSink, dedupeToolsByName, defaultTokenCounter, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, emptyUsage, evaluateGuardrails, extractLatestUserQuery, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasToolResponseRecoveryReference, httpSink, isSmartModel, jsonSchemaRule, loadSkillsFromDisk, normalizeSmartAgentOptions, otlpSink, parseSkillFrontmatter, readMemoryFacts, regexRule, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, restoreSnapshot, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, setTokenCounter, startStreamingSession, summarizeObject, tokenize, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, withTools, withinDepth, writeSummaryFactsToMemory };
|
|
11227
11506
|
//# sourceMappingURL=index.mjs.map
|
|
11228
11507
|
//# sourceMappingURL=index.mjs.map
|