@dexto/core 1.12.1 → 1.13.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/agent/DextoAgent.cjs +7 -0
- package/dist/agent/DextoAgent.d.ts +2 -5
- package/dist/agent/DextoAgent.d.ts.map +1 -1
- package/dist/agent/DextoAgent.js +7 -0
- package/dist/approval/index.cjs +4 -2
- package/dist/approval/index.d.ts +1 -1
- package/dist/approval/index.d.ts.map +1 -1
- package/dist/approval/index.js +3 -2
- package/dist/approval/manager.cjs +23 -4
- package/dist/approval/manager.d.ts +3 -2
- package/dist/approval/manager.d.ts.map +1 -1
- package/dist/approval/manager.js +21 -3
- package/dist/approval/schemas.cjs +5 -0
- package/dist/approval/schemas.d.ts +8 -0
- package/dist/approval/schemas.d.ts.map +1 -1
- package/dist/approval/schemas.js +5 -0
- package/dist/approval/types.d.ts +2 -2
- package/dist/approval/types.d.ts.map +1 -1
- package/dist/context/manager.cjs +34 -31
- package/dist/context/manager.d.ts +5 -6
- package/dist/context/manager.d.ts.map +1 -1
- package/dist/context/manager.js +36 -32
- package/dist/context/utils.cjs +6 -17
- package/dist/context/utils.d.ts +2 -0
- package/dist/context/utils.d.ts.map +1 -1
- package/dist/context/utils.js +5 -17
- package/dist/events/index.cjs +8 -0
- package/dist/events/index.d.ts +18 -5
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +8 -0
- package/dist/llm/executor/repeated-pruned-tool-calls.cjs +69 -0
- package/dist/llm/executor/repeated-pruned-tool-calls.d.ts +17 -0
- package/dist/llm/executor/repeated-pruned-tool-calls.d.ts.map +1 -0
- package/dist/llm/executor/repeated-pruned-tool-calls.js +46 -0
- package/dist/llm/executor/tool-output-spill.cjs +92 -0
- package/dist/llm/executor/tool-output-spill.d.ts +24 -0
- package/dist/llm/executor/tool-output-spill.d.ts.map +1 -0
- package/dist/llm/executor/tool-output-spill.js +65 -0
- package/dist/llm/executor/turn-executor.cjs +116 -35
- package/dist/llm/executor/turn-executor.d.ts +21 -5
- package/dist/llm/executor/turn-executor.d.ts.map +1 -1
- package/dist/llm/executor/turn-executor.js +122 -35
- package/dist/llm/services/factory.cjs +2 -1
- package/dist/llm/services/factory.d.ts +2 -1
- package/dist/llm/services/factory.d.ts.map +1 -1
- package/dist/llm/services/factory.js +2 -1
- package/dist/llm/services/vercel.cjs +2 -1
- package/dist/llm/services/vercel.d.ts +2 -1
- package/dist/llm/services/vercel.d.ts.map +1 -1
- package/dist/llm/services/vercel.js +2 -1
- package/dist/mcp/errors.cjs +9 -0
- package/dist/mcp/errors.d.ts +4 -0
- package/dist/mcp/errors.d.ts.map +1 -1
- package/dist/mcp/errors.js +9 -0
- package/dist/mcp/manager.cjs +79 -3
- package/dist/mcp/manager.d.ts +14 -7
- package/dist/mcp/manager.d.ts.map +1 -1
- package/dist/mcp/manager.js +79 -3
- package/dist/mcp/mcp-client.cjs +52 -62
- package/dist/mcp/mcp-client.d.ts.map +1 -1
- package/dist/mcp/mcp-client.js +54 -63
- package/dist/session/chat-session.cjs +1 -0
- package/dist/session/chat-session.d.ts +2 -0
- package/dist/session/chat-session.d.ts.map +1 -1
- package/dist/session/chat-session.js +1 -0
- package/dist/session/session-manager.cjs +16 -2
- package/dist/session/session-manager.d.ts +2 -0
- package/dist/session/session-manager.d.ts.map +1 -1
- package/dist/session/session-manager.js +16 -2
- package/dist/storage/index.cjs +2 -0
- package/dist/storage/index.d.ts +2 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +2 -0
- package/dist/storage/stores/backend.cjs +26 -0
- package/dist/storage/stores/backend.d.ts +20 -0
- package/dist/storage/stores/backend.d.ts.map +1 -1
- package/dist/storage/stores/backend.js +25 -0
- package/dist/storage/stores/in-memory.cjs +20 -3
- package/dist/storage/stores/in-memory.d.ts +16 -0
- package/dist/storage/stores/in-memory.d.ts.map +1 -1
- package/dist/storage/stores/in-memory.js +18 -2
- package/dist/storage/stores/types.d.ts +3 -0
- package/dist/storage/stores/types.d.ts.map +1 -1
- package/dist/storage/tool-executions/types.cjs +12 -8
- package/dist/storage/tool-executions/types.d.ts +11 -2
- package/dist/storage/tool-executions/types.d.ts.map +1 -1
- package/dist/storage/tool-executions/types.js +12 -8
- package/dist/storage/tool-outputs/types.cjs +16 -0
- package/dist/storage/tool-outputs/types.d.ts +19 -0
- package/dist/storage/tool-outputs/types.d.ts.map +1 -0
- package/dist/storage/tool-outputs/types.js +0 -0
- package/dist/telemetry/decorators.cjs +47 -23
- package/dist/telemetry/decorators.d.ts +6 -0
- package/dist/telemetry/decorators.d.ts.map +1 -1
- package/dist/telemetry/decorators.js +47 -23
- package/dist/telemetry/operation-span.cjs +5 -2
- package/dist/telemetry/operation-span.d.ts +3 -0
- package/dist/telemetry/operation-span.d.ts.map +1 -1
- package/dist/telemetry/operation-span.js +5 -2
- package/dist/tools/activity.cjs +8 -0
- package/dist/tools/activity.d.ts +1 -0
- package/dist/tools/activity.d.ts.map +1 -1
- package/dist/tools/activity.js +8 -0
- package/dist/tools/approval/tool-approval-policy.cjs +11 -1
- package/dist/tools/approval/tool-approval-policy.d.ts +2 -2
- package/dist/tools/approval/tool-approval-policy.d.ts.map +1 -1
- package/dist/tools/approval/tool-approval-policy.js +11 -1
- package/dist/tools/identity.cjs +36 -0
- package/dist/tools/identity.d.ts +6 -0
- package/dist/tools/identity.d.ts.map +1 -0
- package/dist/tools/identity.js +13 -0
- package/dist/tools/index.cjs +2 -0
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +4 -1
- package/dist/tools/presentation/tool-presentation.d.ts +5 -0
- package/dist/tools/presentation/tool-presentation.d.ts.map +1 -1
- package/dist/tools/schema-fingerprint.cjs +48 -0
- package/dist/tools/schema-fingerprint.d.ts +4 -0
- package/dist/tools/schema-fingerprint.d.ts.map +1 -0
- package/dist/tools/schema-fingerprint.js +25 -0
- package/dist/tools/schemas.cjs +3 -0
- package/dist/tools/schemas.d.ts +1 -0
- package/dist/tools/schemas.d.ts.map +1 -1
- package/dist/tools/schemas.js +2 -0
- package/dist/tools/tool-manager.cjs +199 -48
- package/dist/tools/tool-manager.d.ts +25 -11
- package/dist/tools/tool-manager.d.ts.map +1 -1
- package/dist/tools/tool-manager.js +199 -48
- package/dist/tools/tool-output-read.cjs +129 -0
- package/dist/tools/tool-output-read.d.ts +19 -0
- package/dist/tools/tool-output-read.d.ts.map +1 -0
- package/dist/tools/tool-output-read.js +106 -0
- package/dist/tools/types.d.ts +55 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils/schema.cjs +2 -2
- package/dist/utils/schema.d.ts +1 -1
- package/dist/utils/schema.d.ts.map +1 -1
- package/dist/utils/schema.js +2 -2
- package/dist/utils/service-initializer.cjs +4 -0
- package/dist/utils/service-initializer.d.ts +2 -0
- package/dist/utils/service-initializer.d.ts.map +1 -1
- package/dist/utils/service-initializer.js +4 -0
- package/dist/utils/stable-fingerprint.cjs +32 -0
- package/dist/utils/stable-fingerprint.d.ts +3 -0
- package/dist/utils/stable-fingerprint.d.ts.map +1 -0
- package/dist/utils/stable-fingerprint.js +9 -0
- package/package.json +9 -2
- package/dist/llm/executor/tool-output-truncator.cjs +0 -75
- package/dist/llm/executor/tool-output-truncator.d.ts +0 -27
- package/dist/llm/executor/tool-output-truncator.d.ts.map +0 -1
- package/dist/llm/executor/tool-output-truncator.js +0 -48
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Full text of tool results that were too large to keep inline in model history. Hosts scope it
|
|
3
|
+
* to a session; the model reads it back with the core `tool_output_read` tool.
|
|
4
|
+
*/
|
|
5
|
+
export interface ToolOutputStore {
|
|
6
|
+
save(input: {
|
|
7
|
+
sessionId: string;
|
|
8
|
+
toolCallId: string;
|
|
9
|
+
text: string;
|
|
10
|
+
}): Promise<void>;
|
|
11
|
+
load(input: {
|
|
12
|
+
sessionId: string;
|
|
13
|
+
toolCallId: string;
|
|
14
|
+
}): Promise<string | undefined>;
|
|
15
|
+
deleteSession(input: {
|
|
16
|
+
sessionId: string;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/storage/tool-outputs/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC5B,IAAI,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpF,IAAI,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACpF,aAAa,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9D"}
|
|
File without changes
|
|
@@ -27,6 +27,9 @@ var import_utils = require("./utils.js");
|
|
|
27
27
|
var import_safe_stringify = require("../utils/safe-stringify.js");
|
|
28
28
|
var import_runtime = require("../runtime/index.js");
|
|
29
29
|
function withSpan(options) {
|
|
30
|
+
const captureArguments = options.captureArguments ?? true;
|
|
31
|
+
const captureErrors = options.captureErrors ?? true;
|
|
32
|
+
const captureResult = options.captureResult ?? true;
|
|
30
33
|
return function(_target, propertyKey, descriptor) {
|
|
31
34
|
if (!descriptor || typeof descriptor === "number") return;
|
|
32
35
|
const originalMethod = descriptor.value;
|
|
@@ -63,9 +66,14 @@ function withSpan(options) {
|
|
|
63
66
|
const effectiveHostRuntime = hostRuntime;
|
|
64
67
|
const effectiveRunId = effectiveHostRuntime?.ids?.runId ?? runId;
|
|
65
68
|
const applySpanAttributes = (span) => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
if (captureArguments) {
|
|
70
|
+
args.forEach((arg, index) => {
|
|
71
|
+
span.setAttribute(
|
|
72
|
+
`${spanName}.argument.${index}`,
|
|
73
|
+
(0, import_safe_stringify.safeStringify)(arg, 8192)
|
|
74
|
+
);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
69
77
|
if (sessionId) {
|
|
70
78
|
span.setAttribute("sessionId", sessionId);
|
|
71
79
|
span.setAttribute("baggage.sessionId", sessionId);
|
|
@@ -159,36 +167,49 @@ function withSpan(options) {
|
|
|
159
167
|
result = originalMethod.apply(this, args);
|
|
160
168
|
if (result instanceof Promise) {
|
|
161
169
|
return result.then((resolvedValue) => {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
170
|
+
if (captureResult) {
|
|
171
|
+
span.setAttribute(
|
|
172
|
+
`${spanName}.result`,
|
|
173
|
+
(0, import_safe_stringify.safeStringify)(resolvedValue, 8192)
|
|
174
|
+
);
|
|
175
|
+
}
|
|
166
176
|
return resolvedValue;
|
|
167
177
|
}).catch((error) => {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
178
|
+
if (captureErrors) {
|
|
179
|
+
span.recordException(error);
|
|
180
|
+
span.setStatus({
|
|
181
|
+
code: import_api.SpanStatusCode.ERROR,
|
|
182
|
+
message: error?.toString()
|
|
183
|
+
});
|
|
184
|
+
} else {
|
|
185
|
+
span.setStatus({ code: import_api.SpanStatusCode.ERROR });
|
|
186
|
+
}
|
|
173
187
|
throw error;
|
|
174
188
|
}).finally(() => {
|
|
175
189
|
span.end();
|
|
176
190
|
});
|
|
177
191
|
}
|
|
178
|
-
|
|
192
|
+
if (captureResult) {
|
|
193
|
+
span.setAttribute(`${spanName}.result`, (0, import_safe_stringify.safeStringify)(result, 8192));
|
|
194
|
+
}
|
|
179
195
|
return result;
|
|
180
196
|
} catch (error) {
|
|
181
197
|
const logger2 = this?.logger;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
198
|
+
if (captureErrors) {
|
|
199
|
+
logger2?.error(
|
|
200
|
+
`withSpan: Error in method '${methodName}': ${error instanceof Error ? error.message : String(error)}`,
|
|
201
|
+
{ error }
|
|
202
|
+
);
|
|
203
|
+
span.setStatus({
|
|
204
|
+
code: import_api.SpanStatusCode.ERROR,
|
|
205
|
+
message: error instanceof Error ? error.message : "Unknown error"
|
|
206
|
+
});
|
|
207
|
+
if (error instanceof Error) {
|
|
208
|
+
span.recordException(error);
|
|
209
|
+
}
|
|
210
|
+
} else {
|
|
211
|
+
logger2?.error(`withSpan: Error in method '${methodName}'`);
|
|
212
|
+
span.setStatus({ code: import_api.SpanStatusCode.ERROR });
|
|
192
213
|
}
|
|
193
214
|
throw error;
|
|
194
215
|
} finally {
|
|
@@ -215,6 +236,9 @@ function InstrumentClass(options) {
|
|
|
215
236
|
target.prototype,
|
|
216
237
|
method,
|
|
217
238
|
withSpan({
|
|
239
|
+
captureArguments: options?.captureArguments ?? true,
|
|
240
|
+
captureErrors: options?.captureErrors ?? true,
|
|
241
|
+
captureResult: options?.captureResult ?? true,
|
|
218
242
|
spanName: options?.prefix ? `${options.prefix}.${method}` : method,
|
|
219
243
|
skipIfNoTelemetry: true,
|
|
220
244
|
spanKind: options?.spanKind || import_api.SpanKind.INTERNAL,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { SpanKind } from '@opentelemetry/api';
|
|
2
2
|
export declare function withSpan(options: {
|
|
3
|
+
captureArguments?: boolean;
|
|
4
|
+
captureErrors?: boolean;
|
|
5
|
+
captureResult?: boolean;
|
|
3
6
|
spanName?: string;
|
|
4
7
|
componentName?: string;
|
|
5
8
|
skipIfNoTelemetry?: boolean;
|
|
@@ -7,6 +10,9 @@ export declare function withSpan(options: {
|
|
|
7
10
|
tracerName?: string;
|
|
8
11
|
}): any;
|
|
9
12
|
export declare function InstrumentClass(options?: {
|
|
13
|
+
captureArguments?: boolean;
|
|
14
|
+
captureErrors?: boolean;
|
|
15
|
+
captureResult?: boolean;
|
|
10
16
|
prefix?: string;
|
|
11
17
|
componentName?: string;
|
|
12
18
|
spanKind?: SpanKind;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../src/telemetry/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,QAAQ,EAKX,MAAM,oBAAoB,CAAC;AAO5B,wBAAgB,QAAQ,CAAC,OAAO,EAAE;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,GAAG,
|
|
1
|
+
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../src/telemetry/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,QAAQ,EAKX,MAAM,oBAAoB,CAAC;AAO5B,wBAAgB,QAAQ,CAAC,OAAO,EAAE;IAC9B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,GAAG,CAuPN;AAGD,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE;IACtC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,IACoB,CAAC,SAAS;IAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAA;CAAE,EAAE,QAAQ,CAAC,OAgCrE"}
|
|
@@ -10,6 +10,9 @@ import { hasActiveTelemetry, getBaggageValues } from "./utils.js";
|
|
|
10
10
|
import { safeStringify } from "../utils/safe-stringify.js";
|
|
11
11
|
import { getHostRuntimeAttributes, getHostRuntimeBaggageEntries } from "../runtime/index.js";
|
|
12
12
|
function withSpan(options) {
|
|
13
|
+
const captureArguments = options.captureArguments ?? true;
|
|
14
|
+
const captureErrors = options.captureErrors ?? true;
|
|
15
|
+
const captureResult = options.captureResult ?? true;
|
|
13
16
|
return function(_target, propertyKey, descriptor) {
|
|
14
17
|
if (!descriptor || typeof descriptor === "number") return;
|
|
15
18
|
const originalMethod = descriptor.value;
|
|
@@ -46,9 +49,14 @@ function withSpan(options) {
|
|
|
46
49
|
const effectiveHostRuntime = hostRuntime;
|
|
47
50
|
const effectiveRunId = effectiveHostRuntime?.ids?.runId ?? runId;
|
|
48
51
|
const applySpanAttributes = (span) => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
if (captureArguments) {
|
|
53
|
+
args.forEach((arg, index) => {
|
|
54
|
+
span.setAttribute(
|
|
55
|
+
`${spanName}.argument.${index}`,
|
|
56
|
+
safeStringify(arg, 8192)
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
52
60
|
if (sessionId) {
|
|
53
61
|
span.setAttribute("sessionId", sessionId);
|
|
54
62
|
span.setAttribute("baggage.sessionId", sessionId);
|
|
@@ -142,36 +150,49 @@ function withSpan(options) {
|
|
|
142
150
|
result = originalMethod.apply(this, args);
|
|
143
151
|
if (result instanceof Promise) {
|
|
144
152
|
return result.then((resolvedValue) => {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
153
|
+
if (captureResult) {
|
|
154
|
+
span.setAttribute(
|
|
155
|
+
`${spanName}.result`,
|
|
156
|
+
safeStringify(resolvedValue, 8192)
|
|
157
|
+
);
|
|
158
|
+
}
|
|
149
159
|
return resolvedValue;
|
|
150
160
|
}).catch((error) => {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
161
|
+
if (captureErrors) {
|
|
162
|
+
span.recordException(error);
|
|
163
|
+
span.setStatus({
|
|
164
|
+
code: SpanStatusCode.ERROR,
|
|
165
|
+
message: error?.toString()
|
|
166
|
+
});
|
|
167
|
+
} else {
|
|
168
|
+
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
169
|
+
}
|
|
156
170
|
throw error;
|
|
157
171
|
}).finally(() => {
|
|
158
172
|
span.end();
|
|
159
173
|
});
|
|
160
174
|
}
|
|
161
|
-
|
|
175
|
+
if (captureResult) {
|
|
176
|
+
span.setAttribute(`${spanName}.result`, safeStringify(result, 8192));
|
|
177
|
+
}
|
|
162
178
|
return result;
|
|
163
179
|
} catch (error) {
|
|
164
180
|
const logger2 = this?.logger;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
181
|
+
if (captureErrors) {
|
|
182
|
+
logger2?.error(
|
|
183
|
+
`withSpan: Error in method '${methodName}': ${error instanceof Error ? error.message : String(error)}`,
|
|
184
|
+
{ error }
|
|
185
|
+
);
|
|
186
|
+
span.setStatus({
|
|
187
|
+
code: SpanStatusCode.ERROR,
|
|
188
|
+
message: error instanceof Error ? error.message : "Unknown error"
|
|
189
|
+
});
|
|
190
|
+
if (error instanceof Error) {
|
|
191
|
+
span.recordException(error);
|
|
192
|
+
}
|
|
193
|
+
} else {
|
|
194
|
+
logger2?.error(`withSpan: Error in method '${methodName}'`);
|
|
195
|
+
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
175
196
|
}
|
|
176
197
|
throw error;
|
|
177
198
|
} finally {
|
|
@@ -198,6 +219,9 @@ function InstrumentClass(options) {
|
|
|
198
219
|
target.prototype,
|
|
199
220
|
method,
|
|
200
221
|
withSpan({
|
|
222
|
+
captureArguments: options?.captureArguments ?? true,
|
|
223
|
+
captureErrors: options?.captureErrors ?? true,
|
|
224
|
+
captureResult: options?.captureResult ?? true,
|
|
201
225
|
spanName: options?.prefix ? `${options.prefix}.${method}` : method,
|
|
202
226
|
skipIfNoTelemetry: true,
|
|
203
227
|
spanKind: options?.spanKind || SpanKind.INTERNAL,
|
|
@@ -28,7 +28,8 @@ async function recordOperationSpan(options, operation, logger) {
|
|
|
28
28
|
if (skipIfNoTelemetry && !(0, import_utils.hasActiveTelemetry)(logger)) {
|
|
29
29
|
return operation();
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
const spanKind = options.spanKind ?? import_api.SpanKind.INTERNAL;
|
|
32
|
+
return import_api.trace.getTracer(options.tracerName ?? "dexto").startActiveSpan(options.name, { kind: spanKind }, async (span) => {
|
|
32
33
|
const spanContext = import_api.trace.setSpan(import_api.context.active(), span);
|
|
33
34
|
(0, import_utils.addBaggageAttributesToSpan)(span, spanContext, logger);
|
|
34
35
|
if (options.componentName !== void 0) {
|
|
@@ -48,7 +49,9 @@ async function recordOperationSpan(options, operation, logger) {
|
|
|
48
49
|
span.setStatus({ code: import_api.SpanStatusCode.OK });
|
|
49
50
|
return result;
|
|
50
51
|
} catch (error) {
|
|
51
|
-
if (
|
|
52
|
+
if (!(options.captureErrors ?? true)) {
|
|
53
|
+
span.setStatus({ code: import_api.SpanStatusCode.ERROR });
|
|
54
|
+
} else if (error instanceof Error) {
|
|
52
55
|
span.recordException(error);
|
|
53
56
|
span.setStatus({ code: import_api.SpanStatusCode.ERROR, message: error.message });
|
|
54
57
|
} else {
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { SpanKind } from '@opentelemetry/api';
|
|
1
2
|
import type { Logger } from '../logger/v2/types.js';
|
|
2
3
|
type OperationSpanAttributes = Record<string, string | number | boolean>;
|
|
3
4
|
export type OperationSpanOptions<T> = {
|
|
4
5
|
attributes?: OperationSpanAttributes;
|
|
6
|
+
captureErrors?: boolean;
|
|
5
7
|
componentName?: string;
|
|
6
8
|
name: string;
|
|
7
9
|
resultAttributes?: (result: T) => OperationSpanAttributes | undefined;
|
|
8
10
|
skipIfNoTelemetry?: boolean;
|
|
11
|
+
spanKind?: SpanKind;
|
|
9
12
|
tracerName?: string;
|
|
10
13
|
};
|
|
11
14
|
export declare function recordOperationSpan<T>(options: OperationSpanOptions<T>, operation: () => T | Promise<T>, logger?: Logger): Promise<T>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-span.d.ts","sourceRoot":"","sources":["../../src/telemetry/operation-span.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"operation-span.d.ts","sourceRoot":"","sources":["../../src/telemetry/operation-span.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,QAAQ,EAAyB,MAAM,oBAAoB,CAAC;AAE9E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAGpD,KAAK,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;AAEzE,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI;IAClC,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,uBAAuB,GAAG,SAAS,CAAC;IACtE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,wBAAsB,mBAAmB,CAAC,CAAC,EACvC,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAChC,SAAS,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAC/B,MAAM,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,CAAC,CAAC,CA6CZ"}
|
|
@@ -6,7 +6,8 @@ async function recordOperationSpan(options, operation, logger) {
|
|
|
6
6
|
if (skipIfNoTelemetry && !hasActiveTelemetry(logger)) {
|
|
7
7
|
return operation();
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
const spanKind = options.spanKind ?? SpanKind.INTERNAL;
|
|
10
|
+
return trace.getTracer(options.tracerName ?? "dexto").startActiveSpan(options.name, { kind: spanKind }, async (span) => {
|
|
10
11
|
const spanContext = trace.setSpan(context.active(), span);
|
|
11
12
|
addBaggageAttributesToSpan(span, spanContext, logger);
|
|
12
13
|
if (options.componentName !== void 0) {
|
|
@@ -26,7 +27,9 @@ async function recordOperationSpan(options, operation, logger) {
|
|
|
26
27
|
span.setStatus({ code: SpanStatusCode.OK });
|
|
27
28
|
return result;
|
|
28
29
|
} catch (error) {
|
|
29
|
-
if (
|
|
30
|
+
if (!(options.captureErrors ?? true)) {
|
|
31
|
+
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
32
|
+
} else if (error instanceof Error) {
|
|
30
33
|
span.recordException(error);
|
|
31
34
|
span.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
|
|
32
35
|
} else {
|
package/dist/tools/activity.cjs
CHANGED
|
@@ -122,6 +122,14 @@ const TOOL_ACTIVITY = {
|
|
|
122
122
|
"a skill search",
|
|
123
123
|
"skill searches"
|
|
124
124
|
),
|
|
125
|
+
readToolOutput: activity(
|
|
126
|
+
"tool-output",
|
|
127
|
+
"Reading earlier output",
|
|
128
|
+
"Read earlier output",
|
|
129
|
+
"Read",
|
|
130
|
+
"an earlier output",
|
|
131
|
+
"earlier outputs"
|
|
132
|
+
),
|
|
125
133
|
readResource: activity(
|
|
126
134
|
"resource",
|
|
127
135
|
"Reading resource",
|
package/dist/tools/activity.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export declare const TOOL_ACTIVITY: {
|
|
|
36
36
|
readonly updateSkill: ToolActivityPresentation;
|
|
37
37
|
readonly refreshSkill: ToolActivityPresentation;
|
|
38
38
|
readonly searchSkills: ToolActivityPresentation;
|
|
39
|
+
readonly readToolOutput: ToolActivityPresentation;
|
|
39
40
|
readonly readResource: ToolActivityPresentation;
|
|
40
41
|
readonly listResources: ToolActivityPresentation;
|
|
41
42
|
readonly requestHttp: ToolActivityPresentation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../src/tools/activity.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACnC,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,KAAK,EAAE;QACH,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,OAAO,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;KAClB,CAAC;CACL,CAAC;AAiBF,8FAA8F;AAC9F,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../src/tools/activity.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACnC,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,KAAK,EAAE;QACH,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,OAAO,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;KAClB,CAAC;CACL,CAAC;AAiBF,8FAA8F;AAC9F,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0TmC,CAAC"}
|
package/dist/tools/activity.js
CHANGED
|
@@ -100,6 +100,14 @@ const TOOL_ACTIVITY = {
|
|
|
100
100
|
"a skill search",
|
|
101
101
|
"skill searches"
|
|
102
102
|
),
|
|
103
|
+
readToolOutput: activity(
|
|
104
|
+
"tool-output",
|
|
105
|
+
"Reading earlier output",
|
|
106
|
+
"Read earlier output",
|
|
107
|
+
"Read",
|
|
108
|
+
"an earlier output",
|
|
109
|
+
"earlier outputs"
|
|
110
|
+
),
|
|
103
111
|
readResource: activity(
|
|
104
112
|
"resource",
|
|
105
113
|
"Reading resource",
|
|
@@ -52,10 +52,20 @@ class ToolApprovalPolicy {
|
|
|
52
52
|
kind: "approval-required"
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
+
if (input.identity.type === "mcp") {
|
|
56
|
+
const approvalKey = `mcp:${encodeURIComponent(input.identity.connectionId)}:${encodeURIComponent(input.identity.toolName)}`;
|
|
57
|
+
if (this.deps.isApprovalKeySessionApproved({
|
|
58
|
+
approvalKey,
|
|
59
|
+
...input.sessionId !== void 0 ? { sessionId: input.sessionId } : {}
|
|
60
|
+
})) {
|
|
61
|
+
return { kind: "ready" };
|
|
62
|
+
}
|
|
63
|
+
return { approvalKey, kind: "approval-required" };
|
|
64
|
+
}
|
|
55
65
|
return { kind: "approval-required" };
|
|
56
66
|
}
|
|
57
67
|
async resolveAuthoredPolicy(input) {
|
|
58
|
-
if (input.
|
|
68
|
+
if (input.identity.type !== "local") {
|
|
59
69
|
return { kind: "none" };
|
|
60
70
|
}
|
|
61
71
|
const needsApproval = this.deps.getLocalTool(input.toolName)?.needsApproval;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Tool, ToolExecutionContext } from '../types.js';
|
|
1
|
+
import type { Tool, ToolExecutionContext, ToolIdentity } from '../types.js';
|
|
2
2
|
export type ToolApprovalGate = {
|
|
3
3
|
kind: 'ready';
|
|
4
4
|
} | {
|
|
@@ -8,8 +8,8 @@ export type ToolApprovalGate = {
|
|
|
8
8
|
export type ToolApprovalPolicyInput = {
|
|
9
9
|
args: Record<string, unknown>;
|
|
10
10
|
getContext: () => ToolExecutionContext;
|
|
11
|
+
identity: ToolIdentity;
|
|
11
12
|
sessionId?: string | undefined;
|
|
12
|
-
source: 'local' | 'mcp';
|
|
13
13
|
toolName: string;
|
|
14
14
|
};
|
|
15
15
|
export type ToolApprovalPolicyDeps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-approval-policy.d.ts","sourceRoot":"","sources":["../../../src/tools/approval/tool-approval-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAwB,oBAAoB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-approval-policy.d.ts","sourceRoot":"","sources":["../../../src/tools/approval/tool-approval-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAwB,oBAAoB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGlG,MAAM,MAAM,gBAAgB,GACtB;IACI,IAAI,EAAE,OAAO,CAAC;CACjB,GACD;IACI,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,IAAI,EAAE,mBAAmB,CAAC;CAC7B,CAAC;AAcR,MAAM,MAAM,uBAAuB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,UAAU,EAAE,MAAM,oBAAoB,CAAC;IACvC,QAAQ,EAAE,YAAY,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACjC,eAAe,IAAI,QAAQ,GAAG,cAAc,CAAC;IAC7C,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACjD,4BAA4B,CAAC,KAAK,EAAE;QAChC,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAClC,GAAG,OAAO,CAAC;IACZ,uBAAuB,CAAC,KAAK,EAAE;QAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC/B,QAAQ,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;CAClC,CAAC;AAEF,qBAAa,kBAAkB;IACf,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,sBAAsB;IAEnD,OAAO,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC;YAsD1D,qBAAqB;IA8BnC,OAAO,CAAC,wBAAwB;CASnC"}
|
|
@@ -30,10 +30,20 @@ class ToolApprovalPolicy {
|
|
|
30
30
|
kind: "approval-required"
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
+
if (input.identity.type === "mcp") {
|
|
34
|
+
const approvalKey = `mcp:${encodeURIComponent(input.identity.connectionId)}:${encodeURIComponent(input.identity.toolName)}`;
|
|
35
|
+
if (this.deps.isApprovalKeySessionApproved({
|
|
36
|
+
approvalKey,
|
|
37
|
+
...input.sessionId !== void 0 ? { sessionId: input.sessionId } : {}
|
|
38
|
+
})) {
|
|
39
|
+
return { kind: "ready" };
|
|
40
|
+
}
|
|
41
|
+
return { approvalKey, kind: "approval-required" };
|
|
42
|
+
}
|
|
33
43
|
return { kind: "approval-required" };
|
|
34
44
|
}
|
|
35
45
|
async resolveAuthoredPolicy(input) {
|
|
36
|
-
if (input.
|
|
46
|
+
if (input.identity.type !== "local") {
|
|
37
47
|
return { kind: "none" };
|
|
38
48
|
}
|
|
39
49
|
const needsApproval = this.deps.getLocalTool(input.toolName)?.needsApproval;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var identity_exports = {};
|
|
20
|
+
__export(identity_exports, {
|
|
21
|
+
ToolIdentitySchema: () => ToolIdentitySchema
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(identity_exports);
|
|
24
|
+
var import_zod = require("zod");
|
|
25
|
+
const ToolIdentitySchema = import_zod.z.discriminatedUnion("type", [
|
|
26
|
+
import_zod.z.object({ type: import_zod.z.literal("local"), toolId: import_zod.z.string() }).strict(),
|
|
27
|
+
import_zod.z.object({
|
|
28
|
+
type: import_zod.z.literal("mcp"),
|
|
29
|
+
connectionId: import_zod.z.string(),
|
|
30
|
+
toolName: import_zod.z.string()
|
|
31
|
+
}).strict()
|
|
32
|
+
]);
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
ToolIdentitySchema
|
|
36
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolIdentity } from './types.js';
|
|
3
|
+
/** Browser-safe schema for the canonical identity of one local or MCP tool. */
|
|
4
|
+
export declare const ToolIdentitySchema: z.ZodType<ToolIdentity>;
|
|
5
|
+
export type { ToolIdentity } from './types.js';
|
|
6
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/tools/identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,+EAA+E;AAC/E,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CASrD,CAAC;AAEH,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import "../chunk-C6A6W6XS.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const ToolIdentitySchema = z.discriminatedUnion("type", [
|
|
4
|
+
z.object({ type: z.literal("local"), toolId: z.string() }).strict(),
|
|
5
|
+
z.object({
|
|
6
|
+
type: z.literal("mcp"),
|
|
7
|
+
connectionId: z.string(),
|
|
8
|
+
toolName: z.string()
|
|
9
|
+
}).strict()
|
|
10
|
+
]);
|
|
11
|
+
export {
|
|
12
|
+
ToolIdentitySchema
|
|
13
|
+
};
|
package/dist/tools/index.cjs
CHANGED
|
@@ -36,6 +36,7 @@ __reExport(tools_exports, require("./display-types.js"), module.exports);
|
|
|
36
36
|
__reExport(tools_exports, require("./activity.js"), module.exports);
|
|
37
37
|
var import_presentation_schema = require("./presentation-schema.js");
|
|
38
38
|
__reExport(tools_exports, require("./schemas.js"), module.exports);
|
|
39
|
+
__reExport(tools_exports, require("./schema-fingerprint.js"), module.exports);
|
|
39
40
|
__reExport(tools_exports, require("./presentation.js"), module.exports);
|
|
40
41
|
var import_errors = require("./errors.js");
|
|
41
42
|
var import_error_codes = require("./error-codes.js");
|
|
@@ -54,5 +55,6 @@ var import_tool_manager = require("./tool-manager.js");
|
|
|
54
55
|
...require("./display-types.js"),
|
|
55
56
|
...require("./activity.js"),
|
|
56
57
|
...require("./schemas.js"),
|
|
58
|
+
...require("./schema-fingerprint.js"),
|
|
57
59
|
...require("./presentation.js")
|
|
58
60
|
});
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -13,10 +13,11 @@ export * from './activity.js';
|
|
|
13
13
|
export { isToolPresentationSnapshotV1, ToolPresentationSnapshotV1Schema, } from './presentation-schema.js';
|
|
14
14
|
export type { ToolPresentationSnapshotV1 } from './presentation-schema.js';
|
|
15
15
|
export * from './schemas.js';
|
|
16
|
+
export * from './schema-fingerprint.js';
|
|
16
17
|
export * from './presentation.js';
|
|
17
18
|
export type { ToolCallMetadata, ToolCallMetaWrapper } from './tool-call-metadata.js';
|
|
18
19
|
export { ToolError } from './errors.js';
|
|
19
20
|
export { ToolErrorCode } from './error-codes.js';
|
|
20
|
-
export { ToolManager, type ToolExecutionContextFactory } from './tool-manager.js';
|
|
21
|
+
export { ToolManager, type ToolExecutionContextFactory, type ToolExecutionInvocation, } from './tool-manager.js';
|
|
21
22
|
export type { ExecutableToolCall, RecordedToolApproval, ToolApprovalDecisionApplication, ToolApprovalRecordIdentity, ApprovalRequiredPreparedToolCall, PreparedToolCall, PrepareToolCallInput, } from './tool-manager.js';
|
|
22
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,YAAY,CAAC;AAG3B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACH,4BAA4B,EAC5B,2BAA2B,GAC9B,MAAM,qCAAqC,CAAC;AAC7C,YAAY,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAGlF,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,OAAO,EACH,4BAA4B,EAC5B,gCAAgC,GACnC,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAG3E,cAAc,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,YAAY,CAAC;AAG3B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACH,4BAA4B,EAC5B,2BAA2B,GAC9B,MAAM,qCAAqC,CAAC;AAC7C,YAAY,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAGlF,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,OAAO,EACH,4BAA4B,EAC5B,gCAAgC,GACnC,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAG3E,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AAGxC,cAAc,mBAAmB,CAAC;AAClC,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAGrF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EACH,WAAW,EACX,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,GAC/B,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACR,kBAAkB,EAClB,oBAAoB,EACpB,+BAA+B,EAC/B,0BAA0B,EAC1B,gCAAgC,EAChC,gBAAgB,EAChB,oBAAoB,GACvB,MAAM,mBAAmB,CAAC"}
|
package/dist/tools/index.js
CHANGED
|
@@ -12,10 +12,13 @@ import {
|
|
|
12
12
|
ToolPresentationSnapshotV1Schema
|
|
13
13
|
} from "./presentation-schema.js";
|
|
14
14
|
export * from "./schemas.js";
|
|
15
|
+
export * from "./schema-fingerprint.js";
|
|
15
16
|
export * from "./presentation.js";
|
|
16
17
|
import { ToolError } from "./errors.js";
|
|
17
18
|
import { ToolErrorCode } from "./error-codes.js";
|
|
18
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
ToolManager
|
|
21
|
+
} from "./tool-manager.js";
|
|
19
22
|
export {
|
|
20
23
|
SessionToolPreferencesSchema,
|
|
21
24
|
SessionToolPreferencesStore,
|
|
@@ -5,6 +5,7 @@ import { type ToolDisplayData } from '../display-types.js';
|
|
|
5
5
|
type BuildToolExecutionContext = (options: {
|
|
6
6
|
sessionId?: string | undefined;
|
|
7
7
|
toolCallId?: string | undefined;
|
|
8
|
+
parentToolCallId?: string | undefined;
|
|
8
9
|
runContext?: AgentRunContext | undefined;
|
|
9
10
|
}) => ToolExecutionContext;
|
|
10
11
|
export declare class ToolPresentation {
|
|
@@ -18,6 +19,7 @@ export declare class ToolPresentation {
|
|
|
18
19
|
toolName: string;
|
|
19
20
|
args: Record<string, unknown>;
|
|
20
21
|
toolCallId: string;
|
|
22
|
+
parentToolCallId?: string | undefined;
|
|
21
23
|
sessionId?: string | undefined;
|
|
22
24
|
runContext?: AgentRunContext | undefined;
|
|
23
25
|
}): ToolPresentationSnapshotV1;
|
|
@@ -25,6 +27,7 @@ export declare class ToolPresentation {
|
|
|
25
27
|
toolName: string;
|
|
26
28
|
args: Record<string, unknown>;
|
|
27
29
|
toolCallId: string;
|
|
30
|
+
parentToolCallId?: string | undefined;
|
|
28
31
|
sessionId?: string | undefined;
|
|
29
32
|
runContext?: AgentRunContext | undefined;
|
|
30
33
|
}): Promise<ToolPresentationSnapshotV1>;
|
|
@@ -34,6 +37,7 @@ export declare class ToolPresentation {
|
|
|
34
37
|
result: unknown;
|
|
35
38
|
args: Record<string, unknown>;
|
|
36
39
|
toolCallId: string;
|
|
40
|
+
parentToolCallId?: string | undefined;
|
|
37
41
|
sessionId?: string | undefined;
|
|
38
42
|
runContext?: AgentRunContext | undefined;
|
|
39
43
|
}): Promise<ToolPresentationSnapshotV1>;
|
|
@@ -51,6 +55,7 @@ export declare class ToolPresentation {
|
|
|
51
55
|
toolName: string;
|
|
52
56
|
args: Record<string, unknown>;
|
|
53
57
|
toolCallId: string;
|
|
58
|
+
parentToolCallId?: string | undefined;
|
|
54
59
|
sessionId?: string | undefined;
|
|
55
60
|
runContext?: AgentRunContext | undefined;
|
|
56
61
|
}): Promise<ToolDisplayData | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-presentation.d.ts","sourceRoot":"","sources":["../../../src/tools/presentation/tool-presentation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,KAAK,EACR,IAAI,EACJ,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAI/E,KAAK,yBAAyB,GAAG,CAAC,OAAO,EAAE;IACvC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM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