@dexto/core 1.8.3 → 1.8.4
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/agent/DextoAgent.cjs +3 -1
- package/dist/agent/DextoAgent.d.ts +2 -0
- package/dist/agent/DextoAgent.d.ts.map +1 -1
- package/dist/agent/DextoAgent.js +7 -2
- package/dist/events/index.d.ts +3 -0
- package/dist/events/index.d.ts.map +1 -1
- package/dist/index.browser.cjs +6 -0
- package/dist/index.browser.d.ts +2 -0
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +4 -0
- package/dist/llm/executor/provider-error.cjs +214 -0
- package/dist/llm/executor/provider-error.d.ts +26 -0
- package/dist/llm/executor/provider-error.d.ts.map +1 -0
- package/dist/llm/executor/provider-error.js +190 -0
- package/dist/llm/executor/stream-processor.cjs +34 -5
- package/dist/llm/executor/stream-processor.d.ts +4 -1
- package/dist/llm/executor/stream-processor.d.ts.map +1 -1
- package/dist/llm/executor/stream-processor.js +34 -5
- package/dist/llm/executor/turn-executor.cjs +185 -124
- package/dist/llm/executor/turn-executor.d.ts +5 -5
- package/dist/llm/executor/turn-executor.d.ts.map +1 -1
- package/dist/llm/executor/turn-executor.js +184 -120
- package/dist/session/title-generator.cjs +19 -2
- package/dist/session/title-generator.d.ts +8 -0
- package/dist/session/title-generator.d.ts.map +1 -1
- package/dist/session/title-generator.js +19 -2
- package/dist/systemPrompt/contributors.cjs +10 -1
- package/dist/systemPrompt/contributors.d.ts.map +1 -1
- package/dist/systemPrompt/contributors.js +10 -1
- package/dist/telemetry/browser.cjs +138 -0
- package/dist/telemetry/browser.d.ts +30 -0
- package/dist/telemetry/browser.d.ts.map +1 -0
- package/dist/telemetry/browser.js +115 -0
- package/dist/telemetry/index.cjs +5 -2
- package/dist/telemetry/index.d.ts +1 -0
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +3 -1
- package/dist/telemetry/operation-span.cjs +73 -0
- package/dist/telemetry/operation-span.d.ts +13 -0
- package/dist/telemetry/operation-span.d.ts.map +1 -0
- package/dist/telemetry/operation-span.js +50 -0
- package/dist/telemetry/telemetry.cjs +2 -3
- package/dist/telemetry/telemetry.d.ts.map +1 -1
- package/dist/telemetry/telemetry.js +2 -3
- package/dist/telemetry/utils.cjs +11 -12
- package/dist/telemetry/utils.d.ts.map +1 -1
- package/dist/telemetry/utils.js +11 -12
- package/dist/tools/tool-call-metadata.cjs +118 -6
- package/dist/tools/tool-call-metadata.d.ts.map +1 -1
- package/dist/tools/tool-call-metadata.js +118 -6
- package/package.json +2 -2
|
@@ -22,17 +22,129 @@ const META_SCHEMA = {
|
|
|
22
22
|
additionalProperties: true
|
|
23
23
|
};
|
|
24
24
|
const META_KEY = "__meta";
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const FORBIDDEN_TOP_LEVEL_SCHEMA_KEYS = ["oneOf", "anyOf", "allOf", "enum", "not"];
|
|
26
|
+
function hasForbiddenTopLevelSchemaKey(parameters) {
|
|
27
|
+
return FORBIDDEN_TOP_LEVEL_SCHEMA_KEYS.some((key) => key in parameters);
|
|
28
|
+
}
|
|
29
|
+
function readObjectAlternatives(parameters) {
|
|
30
|
+
const alternatives = parameters.oneOf ?? parameters.anyOf;
|
|
31
|
+
if (!Array.isArray(alternatives)) {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
return alternatives.filter(
|
|
35
|
+
(alternative) => alternative !== true && alternative !== false && alternative.type === "object"
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
function readRequiredPropertyNames(schema) {
|
|
39
|
+
return new Set(
|
|
40
|
+
Array.isArray(schema.required) ? schema.required.filter((propertyName) => typeof propertyName === "string") : []
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
function intersectRequiredProperties(alternatives) {
|
|
44
|
+
if (alternatives.length === 0) {
|
|
45
|
+
return void 0;
|
|
46
|
+
}
|
|
47
|
+
const requiredSets = alternatives.map(readRequiredPropertyNames);
|
|
48
|
+
const first = requiredSets[0];
|
|
49
|
+
if (first === void 0) {
|
|
50
|
+
return void 0;
|
|
51
|
+
}
|
|
52
|
+
const rest = requiredSets.slice(1);
|
|
53
|
+
const required = [...first].filter(
|
|
54
|
+
(propertyName) => rest.every((requiredProperties) => requiredProperties.has(propertyName))
|
|
55
|
+
);
|
|
56
|
+
return required.length === 0 ? void 0 : required;
|
|
57
|
+
}
|
|
58
|
+
function valuesEqual(left, right) {
|
|
59
|
+
return JSON.stringify(left) === JSON.stringify(right);
|
|
60
|
+
}
|
|
61
|
+
function mergeEnumValues(values) {
|
|
62
|
+
const merged = [];
|
|
63
|
+
for (const value of values) {
|
|
64
|
+
if (!merged.some((existing) => valuesEqual(existing, value))) {
|
|
65
|
+
merged.push(value);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return merged;
|
|
69
|
+
}
|
|
70
|
+
function readEnumValues(schema) {
|
|
71
|
+
if (schema.const !== void 0) {
|
|
72
|
+
return [schema.const];
|
|
73
|
+
}
|
|
74
|
+
return Array.isArray(schema.enum) ? schema.enum : void 0;
|
|
75
|
+
}
|
|
76
|
+
function mergePropertySchema(current, next) {
|
|
77
|
+
if (current === void 0 || current === false) {
|
|
78
|
+
return next;
|
|
79
|
+
}
|
|
80
|
+
if (current === true || next === true) {
|
|
81
|
+
return {};
|
|
82
|
+
}
|
|
83
|
+
if (next === false) {
|
|
84
|
+
return current;
|
|
28
85
|
}
|
|
29
|
-
if (
|
|
86
|
+
if (valuesEqual(current, next)) {
|
|
87
|
+
return current;
|
|
88
|
+
}
|
|
89
|
+
const currentEnum = readEnumValues(current);
|
|
90
|
+
const nextEnum = readEnumValues(next);
|
|
91
|
+
if (currentEnum !== void 0 && nextEnum !== void 0) {
|
|
92
|
+
return { enum: mergeEnumValues([...currentEnum, ...nextEnum]) };
|
|
93
|
+
}
|
|
94
|
+
if (current.type !== void 0 && valuesEqual(current.type, next.type)) {
|
|
95
|
+
return { type: current.type };
|
|
96
|
+
}
|
|
97
|
+
return {};
|
|
98
|
+
}
|
|
99
|
+
function flattenObjectUnionSchema(parameters) {
|
|
100
|
+
const alternatives = readObjectAlternatives(parameters);
|
|
101
|
+
if (alternatives.length === 0) {
|
|
102
|
+
return void 0;
|
|
103
|
+
}
|
|
104
|
+
const properties = {};
|
|
105
|
+
const required = intersectRequiredProperties(alternatives);
|
|
106
|
+
for (const alternative of alternatives) {
|
|
107
|
+
const alternativeProperties = alternative.properties ?? {};
|
|
108
|
+
for (const [propertyName, propertySchema] of Object.entries(alternativeProperties)) {
|
|
109
|
+
properties[propertyName] = mergePropertySchema(
|
|
110
|
+
properties[propertyName],
|
|
111
|
+
propertySchema
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
...parameters.description === void 0 ? {} : { description: parameters.description },
|
|
117
|
+
type: "object",
|
|
118
|
+
properties,
|
|
119
|
+
...required === void 0 ? {} : { required },
|
|
120
|
+
additionalProperties: true
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function normalizeToolParametersSchema(parameters) {
|
|
124
|
+
if (parameters.type === "object" && !hasForbiddenTopLevelSchemaKey(parameters)) {
|
|
30
125
|
return parameters;
|
|
31
126
|
}
|
|
127
|
+
const flattened = flattenObjectUnionSchema(parameters);
|
|
128
|
+
if (flattened !== void 0) {
|
|
129
|
+
return flattened;
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
type: "object",
|
|
133
|
+
additionalProperties: true
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function wrapToolParametersSchema(parameters) {
|
|
137
|
+
const normalized = normalizeToolParametersSchema(parameters);
|
|
138
|
+
if (!normalized.properties) {
|
|
139
|
+
return normalized;
|
|
140
|
+
}
|
|
141
|
+
if (META_KEY in normalized.properties) {
|
|
142
|
+
return normalized;
|
|
143
|
+
}
|
|
32
144
|
return {
|
|
33
|
-
...
|
|
145
|
+
...normalized,
|
|
34
146
|
properties: {
|
|
35
|
-
...
|
|
147
|
+
...normalized.properties,
|
|
36
148
|
[META_KEY]: META_SCHEMA
|
|
37
149
|
}
|
|
38
150
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexto/core",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
"nanoid": "^5.1.6",
|
|
158
158
|
"winston": "^3.17.0",
|
|
159
159
|
"yaml": "^2.8.3",
|
|
160
|
-
"@dexto/llm": "1.8.
|
|
160
|
+
"@dexto/llm": "1.8.4"
|
|
161
161
|
},
|
|
162
162
|
"devDependencies": {
|
|
163
163
|
"@opentelemetry/instrumentation-http": "^0.210.0",
|