@arvo-tools/agentic 0.2.0 → 0.4.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.
- package/dist/Agent/AgentDefaults.d.ts +28 -0
- package/dist/Agent/AgentDefaults.d.ts.map +1 -0
- package/dist/Agent/AgentDefaults.js +154 -0
- package/dist/Agent/AgentDefaults.js.map +1 -0
- package/dist/Agent/agentLoop.d.ts +109 -0
- package/dist/Agent/agentLoop.d.ts.map +1 -0
- package/dist/Agent/agentLoop.js +391 -0
- package/dist/Agent/agentLoop.js.map +1 -0
- package/dist/Agent/agentTool.d.ts +4 -0
- package/dist/Agent/agentTool.d.ts.map +1 -0
- package/dist/Agent/agentTool.js +111 -0
- package/dist/Agent/agentTool.js.map +1 -0
- package/dist/Agent/index.d.ts +18 -0
- package/dist/Agent/index.d.ts.map +1 -0
- package/dist/Agent/index.js +293 -0
- package/dist/Agent/index.js.map +1 -0
- package/dist/Agent/schema.d.ts +363 -0
- package/dist/Agent/schema.d.ts.map +1 -0
- package/dist/Agent/schema.js +51 -0
- package/dist/Agent/schema.js.map +1 -0
- package/dist/Agent/types.d.ts +135 -0
- package/dist/Agent/types.d.ts.map +1 -0
- package/dist/Agent/types.js +3 -0
- package/dist/Agent/types.js.map +1 -0
- package/dist/Agent/utils.d.ts +31 -0
- package/dist/Agent/utils.d.ts.map +1 -0
- package/dist/Agent/utils.js +345 -0
- package/dist/Agent/utils.js.map +1 -0
- package/dist/Integrations/MCPClient.d.ts +80 -0
- package/dist/Integrations/MCPClient.d.ts.map +1 -0
- package/dist/Integrations/MCPClient.js +292 -0
- package/dist/Integrations/MCPClient.js.map +1 -0
- package/dist/Integrations/openai.d.ts +10 -0
- package/dist/Integrations/openai.d.ts.map +1 -0
- package/dist/Integrations/openai.js +353 -0
- package/dist/Integrations/openai.js.map +1 -0
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -3
- package/dist/index.js.map +1 -1
- package/dist/interfaces.mcp.d.ts +26 -0
- package/dist/interfaces.mcp.d.ts.map +1 -0
- package/dist/interfaces.mcp.js +3 -0
- package/dist/interfaces.mcp.js.map +1 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +9 -2
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AgentMessageSchema = exports.AgentMessageContentSchema = exports.AgentToolCallContentSchema = exports.AgentToolResultContentSchema = exports.AgentMediaContentSchema = exports.AgentTextContentSchema = void 0;
|
|
7
|
+
var zod_1 = __importDefault(require("zod"));
|
|
8
|
+
exports.AgentTextContentSchema = zod_1.default.object({
|
|
9
|
+
type: zod_1.default.literal('text'),
|
|
10
|
+
content: zod_1.default.string(),
|
|
11
|
+
});
|
|
12
|
+
exports.AgentMediaContentSchema = zod_1.default.object({
|
|
13
|
+
type: zod_1.default.literal('media'),
|
|
14
|
+
content: zod_1.default.string(),
|
|
15
|
+
contentType: zod_1.default.discriminatedUnion('type', [
|
|
16
|
+
zod_1.default.object({
|
|
17
|
+
filename: zod_1.default.string(),
|
|
18
|
+
filetype: zod_1.default.string(),
|
|
19
|
+
type: zod_1.default.literal('image'),
|
|
20
|
+
format: zod_1.default.enum(['base64']),
|
|
21
|
+
}),
|
|
22
|
+
zod_1.default.object({
|
|
23
|
+
filename: zod_1.default.string(),
|
|
24
|
+
filetype: zod_1.default.string(),
|
|
25
|
+
type: zod_1.default.literal('file'),
|
|
26
|
+
format: zod_1.default.enum(['base64']),
|
|
27
|
+
}),
|
|
28
|
+
]),
|
|
29
|
+
});
|
|
30
|
+
exports.AgentToolResultContentSchema = zod_1.default.object({
|
|
31
|
+
type: zod_1.default.literal('tool_result'),
|
|
32
|
+
toolUseId: zod_1.default.string(),
|
|
33
|
+
content: zod_1.default.string(),
|
|
34
|
+
});
|
|
35
|
+
exports.AgentToolCallContentSchema = zod_1.default.object({
|
|
36
|
+
type: zod_1.default.literal('tool_use'),
|
|
37
|
+
toolUseId: zod_1.default.string(),
|
|
38
|
+
name: zod_1.default.string(),
|
|
39
|
+
input: zod_1.default.record(zod_1.default.string(), zod_1.default.any()),
|
|
40
|
+
});
|
|
41
|
+
exports.AgentMessageContentSchema = zod_1.default.discriminatedUnion('type', [
|
|
42
|
+
exports.AgentTextContentSchema,
|
|
43
|
+
exports.AgentMediaContentSchema,
|
|
44
|
+
exports.AgentToolResultContentSchema,
|
|
45
|
+
exports.AgentToolCallContentSchema,
|
|
46
|
+
]);
|
|
47
|
+
exports.AgentMessageSchema = zod_1.default.object({
|
|
48
|
+
role: zod_1.default.enum(['user', 'assistant']),
|
|
49
|
+
content: exports.AgentMessageContentSchema,
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/Agent/schema.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AAEP,QAAA,sBAAsB,GAAG,aAAC,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,aAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACvB,OAAO,EAAE,aAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAEU,QAAA,uBAAuB,GAAG,aAAC,CAAC,MAAM,CAAC;IAC9C,IAAI,EAAE,aAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACxB,OAAO,EAAE,aAAC,CAAC,MAAM,EAAE;IACnB,WAAW,EAAE,aAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;QACxC,aAAC,CAAC,MAAM,CAAC;YACP,QAAQ,EAAE,aAAC,CAAC,MAAM,EAAE;YACpB,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,CAAC;IACnC,OAAO,EAAE,iCAAyB;CACnC,CAAC,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { Span } from '@opentelemetry/api';
|
|
2
|
+
import type { ArvoContract, ArvoOrchestratorContract, ArvoSemanticVersion, CreateArvoEvent, InferVersionedArvoContract, VersionedArvoContract } from 'arvo-core';
|
|
3
|
+
import type { IMachineMemory } from 'arvo-event-handler';
|
|
4
|
+
import type z from 'zod';
|
|
5
|
+
import type { IMCPClient } from '../interfaces.mcp';
|
|
6
|
+
import type { OtelInfoType } from '../types';
|
|
7
|
+
import type { AgentMediaContentSchema, AgentMessageContentSchema, AgentMessageSchema, AgentTextContentSchema, AgentToolCallContentSchema, AgentToolResultContentSchema } from './schema';
|
|
8
|
+
export type AgentTextContent = z.infer<typeof AgentTextContentSchema>;
|
|
9
|
+
export type AgentMediaContent = z.infer<typeof AgentMediaContentSchema>;
|
|
10
|
+
export type AgentToolResultContent = z.infer<typeof AgentToolResultContentSchema>;
|
|
11
|
+
export type AgentToolCallContent = z.infer<typeof AgentToolCallContentSchema>;
|
|
12
|
+
export type AgentMessageContent = z.infer<typeof AgentMessageContentSchema>;
|
|
13
|
+
export type AgentMessage = z.infer<typeof AgentMessageSchema>;
|
|
14
|
+
export type AnyArvoOrchestratorContract = ArvoOrchestratorContract<any, any>;
|
|
15
|
+
export type AnyArvoContract = ArvoContract<any, any, any>;
|
|
16
|
+
export type NonEmptyArray<T> = [T, ...T[]];
|
|
17
|
+
export type PromiseLike<T> = Promise<T> | T;
|
|
18
|
+
export type AgentServiceContract = {
|
|
19
|
+
contract: VersionedArvoContract<any, any>;
|
|
20
|
+
domains?: NonEmptyArray<string>;
|
|
21
|
+
priority?: number;
|
|
22
|
+
};
|
|
23
|
+
export type AgentToolDefinition<T extends VersionedArvoContract<AnyArvoContract, ArvoSemanticVersion> | AgentInternalTool | null = null> = {
|
|
24
|
+
name: string;
|
|
25
|
+
description: string;
|
|
26
|
+
inputSchema: Record<string, any>;
|
|
27
|
+
serverConfig: {
|
|
28
|
+
kind: 'arvo' | 'mcp' | 'internal';
|
|
29
|
+
name: string;
|
|
30
|
+
contract: T;
|
|
31
|
+
priority: number;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export type AgentLLMContext<TServiceContract extends Record<string, AgentServiceContract> = Record<string, AgentServiceContract>, TTools extends Record<string, AgentInternalTool> = Record<string, AgentInternalTool>> = {
|
|
35
|
+
system: string | null;
|
|
36
|
+
messages: AgentMessage[];
|
|
37
|
+
tools: {
|
|
38
|
+
services: {
|
|
39
|
+
[K in keyof TServiceContract]: AgentToolDefinition<TServiceContract[K]['contract']>;
|
|
40
|
+
};
|
|
41
|
+
mcp: Record<string, AgentToolDefinition<null>>;
|
|
42
|
+
tools: {
|
|
43
|
+
[K in keyof TTools]: AgentToolDefinition<TTools[K]>;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
toolInteractions: {
|
|
47
|
+
max: number;
|
|
48
|
+
current: number;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export type AgentLLMIntegrationParam = {
|
|
52
|
+
lifecycle: 'init' | 'tool_result' | 'output_error_feedback';
|
|
53
|
+
messages: AgentMessage[];
|
|
54
|
+
system: string | null;
|
|
55
|
+
tools: AgentToolDefinition[];
|
|
56
|
+
toolInteractions: AgentLLMContext['toolInteractions'] & {
|
|
57
|
+
exhausted: boolean;
|
|
58
|
+
};
|
|
59
|
+
outputFormat: {
|
|
60
|
+
type: 'text' | 'media';
|
|
61
|
+
} | {
|
|
62
|
+
type: 'json';
|
|
63
|
+
format: z.ZodTypeAny;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export type AgentLLMIntegrationOutput = {
|
|
67
|
+
usage: {
|
|
68
|
+
tokens: {
|
|
69
|
+
prompt: number;
|
|
70
|
+
completion: number;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
executionUnits: number;
|
|
74
|
+
} & ({
|
|
75
|
+
type: 'tool_call';
|
|
76
|
+
toolRequests: Omit<AgentToolCallContent, 'type'>[];
|
|
77
|
+
} | {
|
|
78
|
+
type: 'text';
|
|
79
|
+
content: string;
|
|
80
|
+
} | {
|
|
81
|
+
type: 'json';
|
|
82
|
+
content: string;
|
|
83
|
+
parsedContent: Record<string, unknown> | null;
|
|
84
|
+
});
|
|
85
|
+
export type AgentInternalTool<TInputSchema extends z.ZodTypeAny = any, TOutputSchema extends z.ZodTypeAny = any> = {
|
|
86
|
+
name: string;
|
|
87
|
+
description: string;
|
|
88
|
+
input: TInputSchema;
|
|
89
|
+
output: TOutputSchema;
|
|
90
|
+
priority?: number;
|
|
91
|
+
fn: (input: z.infer<TInputSchema>, config: {
|
|
92
|
+
otelInfo: OtelInfoType;
|
|
93
|
+
}) => PromiseLike<z.infer<TOutputSchema>>;
|
|
94
|
+
};
|
|
95
|
+
export type AgentLLMIntegration = (param: AgentLLMIntegrationParam, config: {
|
|
96
|
+
otelInfo: OtelInfoType;
|
|
97
|
+
}) => Promise<AgentLLMIntegrationOutput>;
|
|
98
|
+
export type AgentContextBuilder<T extends AnyArvoOrchestratorContract = AnyArvoOrchestratorContract, V extends ArvoSemanticVersion = ArvoSemanticVersion, TServiceContract extends Record<string, AgentServiceContract> = Record<string, AgentServiceContract>, TTools extends Record<string, AgentInternalTool> = Record<string, AgentInternalTool>> = (param: {
|
|
99
|
+
lifecycle: AgentLLMIntegrationParam['lifecycle'];
|
|
100
|
+
input: InferVersionedArvoContract<VersionedArvoContract<T, V>>['accepts'];
|
|
101
|
+
tools: AgentLLMContext<TServiceContract, TTools>['tools'];
|
|
102
|
+
span: Span;
|
|
103
|
+
}) => PromiseLike<Partial<Pick<AgentLLMContext<TServiceContract>, 'messages' | 'system'>> | void>;
|
|
104
|
+
export type AgentOutputBuilder<T extends AnyArvoOrchestratorContract = AnyArvoOrchestratorContract, V extends ArvoSemanticVersion = ArvoSemanticVersion> = (param: Extract<AgentLLMIntegrationOutput, {
|
|
105
|
+
type: 'text' | 'json';
|
|
106
|
+
}> & {
|
|
107
|
+
outputFormat: z.ZodTypeAny;
|
|
108
|
+
span: Span;
|
|
109
|
+
}) => PromiseLike<{
|
|
110
|
+
data: InferVersionedArvoContract<VersionedArvoContract<T, V>>['emits'][T['metadata']['completeEventType']]['data'] & {
|
|
111
|
+
__id?: CreateArvoEvent<Record<string, unknown>, string>['id'];
|
|
112
|
+
__executionunits?: CreateArvoEvent<Record<string, unknown>, string>['executionunits'];
|
|
113
|
+
};
|
|
114
|
+
} | {
|
|
115
|
+
error: Error;
|
|
116
|
+
}>;
|
|
117
|
+
export type CreateArvoAgentParam<TSelfContract extends AnyArvoOrchestratorContract = AnyArvoOrchestratorContract, TServiceContract extends Record<string, AgentServiceContract> = Record<string, AgentServiceContract>, TTools extends Record<string, AgentInternalTool> = Record<string, AgentInternalTool>> = {
|
|
118
|
+
contracts: {
|
|
119
|
+
self: TSelfContract;
|
|
120
|
+
services: TServiceContract;
|
|
121
|
+
};
|
|
122
|
+
memory: IMachineMemory<Record<string, unknown>>;
|
|
123
|
+
maxToolInteractions?: number;
|
|
124
|
+
mcp?: IMCPClient;
|
|
125
|
+
tools?: TTools;
|
|
126
|
+
llmResponseType?: AgentLLMIntegrationParam['outputFormat']['type'];
|
|
127
|
+
llm: AgentLLMIntegration;
|
|
128
|
+
handler: {
|
|
129
|
+
[K in keyof TSelfContract['versions'] & ArvoSemanticVersion]: {
|
|
130
|
+
context: AgentContextBuilder<TSelfContract, K, TServiceContract, TTools>;
|
|
131
|
+
output: AgentOutputBuilder<TSelfContract, K>;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/Agent/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EACV,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AE,aAAa,CAAC;QACpB,QAAQ,EAAE,gBAAgB,CAAC;KAC5B,CAAC;IACF,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAChD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,wBAAwB,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;IACnE,GAAG,EAAE,mBAAmB,CAAC;IACzB,OAAO,EAAE;SACN,CAAC,IAAI,MAAM,aAAa,CAAC,UAAU,CAAC,GAAG,mBAAmB,GAAG;YAC5D,OAAO,EAAE,mBAAmB,CAAC,aAAa,EAAE,CAAC,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC;YACzE,MAAM,EAAE,kBAAkB,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;SAC9C;KACF,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/Agent/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Span } from '@opentelemetry/api';
|
|
2
|
+
import type { IMCPClient } from '../interfaces.mcp';
|
|
3
|
+
import type { OtelInfoType } from '../types';
|
|
4
|
+
import type { AgentInternalTool, AgentLLMIntegrationOutput, AgentMessage, AgentServiceContract, AgentToolCallContent, AgentToolDefinition } from './types.js';
|
|
5
|
+
export declare const generateServiceToolDefinitions: <TServiceContract extends Record<string, AgentServiceContract>>(services: TServiceContract) => { [K in keyof TServiceContract]: AgentToolDefinition<TServiceContract[K]["contract"]>; };
|
|
6
|
+
export declare const generateMcpToolDefinitions: (mcp: IMCPClient | null, config: {
|
|
7
|
+
otelInfo: OtelInfoType;
|
|
8
|
+
}) => Promise<Record<string, AgentToolDefinition<null>>>;
|
|
9
|
+
export declare const generateAgentInternalToolDefinitions: <TTools extends Record<string, AgentInternalTool>>(tools: Record<string, AgentInternalTool>) => { [K in keyof TTools]: AgentToolDefinition<TTools[K]>; };
|
|
10
|
+
export declare const clampStr: (s: string, len: number) => string;
|
|
11
|
+
export declare const setOpenInferenceInputAttr: (param: {
|
|
12
|
+
llm: {
|
|
13
|
+
provider: string;
|
|
14
|
+
system: string;
|
|
15
|
+
model: string;
|
|
16
|
+
invocationParam: Record<string, unknown>;
|
|
17
|
+
};
|
|
18
|
+
messages: AgentMessage[];
|
|
19
|
+
system: string | null;
|
|
20
|
+
tools: AgentToolDefinition[];
|
|
21
|
+
}, span: Span) => void;
|
|
22
|
+
export declare const setOpenInferenceToolCallOutputAttr: (param: {
|
|
23
|
+
toolCalls: Omit<AgentToolCallContent, "type">[];
|
|
24
|
+
}, span: Span) => void;
|
|
25
|
+
export declare const setOpenInferenceUsageOutputAttr: (param: AgentLLMIntegrationOutput["usage"], span: Span) => void;
|
|
26
|
+
export declare const setOpenInferenceResponseOutputAttr: (param: {
|
|
27
|
+
response: string;
|
|
28
|
+
}, span: Span) => void;
|
|
29
|
+
export declare const tryParseJson: (str: string) => Record<string, unknown> | null;
|
|
30
|
+
export declare const prioritizeToolCalls: (toolCalls: Omit<AgentToolCallContent, "type">[], nameToToolMap: Record<string, AgentToolDefinition>) => Omit<AgentToolCallContent, "type">[];
|
|
31
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/Agent/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EACV,iBAAiB,EACjB,yBAAyB,EACzB,YAAY,EACZ,oBAAoB,E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yBX,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAC1C,OAAO,yBAAyB,CAAC,OAAO,CAAC,EACzC,MAAM,IAAI,SAUX,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAC7C,OAAO;IACL,QAAQ,EAAE,MAAM,CAAC;CAClB,EACD,MAAM,IAAI,SAUX,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAMpE,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,WAAW,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,EAAE,EAC/C,eAAe,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,KACjD,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,EAWpC,CAAC"}
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
50
|
+
var t = {};
|
|
51
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
52
|
+
t[p] = s[p];
|
|
53
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
54
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
55
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
56
|
+
t[p[i]] = s[p[i]];
|
|
57
|
+
}
|
|
58
|
+
return t;
|
|
59
|
+
};
|
|
60
|
+
var __values = (this && this.__values) || function(o) {
|
|
61
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
62
|
+
if (m) return m.call(o);
|
|
63
|
+
if (o && typeof o.length === "number") return {
|
|
64
|
+
next: function () {
|
|
65
|
+
if (o && i >= o.length) o = void 0;
|
|
66
|
+
return { value: o && o[i++], done: !o };
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
70
|
+
};
|
|
71
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
72
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
73
|
+
if (!m) return o;
|
|
74
|
+
var i = m.call(o), r, ar = [], e;
|
|
75
|
+
try {
|
|
76
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
77
|
+
}
|
|
78
|
+
catch (error) { e = { error: error }; }
|
|
79
|
+
finally {
|
|
80
|
+
try {
|
|
81
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
82
|
+
}
|
|
83
|
+
finally { if (e) throw e.error; }
|
|
84
|
+
}
|
|
85
|
+
return ar;
|
|
86
|
+
};
|
|
87
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88
|
+
exports.prioritizeToolCalls = exports.tryParseJson = exports.setOpenInferenceResponseOutputAttr = exports.setOpenInferenceUsageOutputAttr = exports.setOpenInferenceToolCallOutputAttr = exports.setOpenInferenceInputAttr = exports.clampStr = exports.generateAgentInternalToolDefinitions = exports.generateMcpToolDefinitions = exports.generateServiceToolDefinitions = void 0;
|
|
89
|
+
var openinference_semantic_conventions_1 = require("@arizeai/openinference-semantic-conventions");
|
|
90
|
+
var zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
91
|
+
var generateServiceToolDefinitions = function (services) {
|
|
92
|
+
var e_1, _a;
|
|
93
|
+
var _b, _c, _d;
|
|
94
|
+
var serviceTools = {};
|
|
95
|
+
try {
|
|
96
|
+
for (var _e = __values(Object.entries(services)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
97
|
+
var _g = __read(_f.value, 2), key = _g[0], value = _g[1];
|
|
98
|
+
var inputSchema = value.contract.toJsonSchema().accepts.schema;
|
|
99
|
+
// biome-ignore lint/correctness/noUnusedVariables: the parentSubject$$ is to be removed that is why it is unused
|
|
100
|
+
var _h = inputSchema && 'properties' in inputSchema && inputSchema.properties
|
|
101
|
+
? inputSchema.properties
|
|
102
|
+
: {}, parentSubject$$ = _h.parentSubject$$, cleanedProperties = __rest(_h, ["parentSubject$$"]);
|
|
103
|
+
var cleanedRequired = (inputSchema && 'required' in inputSchema && inputSchema.required ? inputSchema.required : []).filter(function (item) { return item !== 'parentSubject$$'; });
|
|
104
|
+
serviceTools[key] = {
|
|
105
|
+
name: "service_".concat((_b = value.contract.accepts.type) === null || _b === void 0 ? void 0 : _b.replaceAll('.', '_')),
|
|
106
|
+
description: (_c = value.contract.description) !== null && _c !== void 0 ? _c : 'No description available',
|
|
107
|
+
inputSchema: __assign(__assign({}, inputSchema), { properties: cleanedProperties, required: cleanedRequired }),
|
|
108
|
+
serverConfig: {
|
|
109
|
+
name: value.contract.accepts.type,
|
|
110
|
+
kind: 'arvo',
|
|
111
|
+
contract: value.contract,
|
|
112
|
+
priority: (_d = value.priority) !== null && _d !== void 0 ? _d : 0,
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
118
|
+
finally {
|
|
119
|
+
try {
|
|
120
|
+
if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
|
|
121
|
+
}
|
|
122
|
+
finally { if (e_1) throw e_1.error; }
|
|
123
|
+
}
|
|
124
|
+
return serviceTools;
|
|
125
|
+
};
|
|
126
|
+
exports.generateServiceToolDefinitions = generateServiceToolDefinitions;
|
|
127
|
+
var generateMcpToolDefinitions = function (mcp, config) { return __awaiter(void 0, void 0, void 0, function () {
|
|
128
|
+
var mcpToolList, mcpToolPriorityMap;
|
|
129
|
+
var _a, _b;
|
|
130
|
+
return __generator(this, function (_c) {
|
|
131
|
+
switch (_c.label) {
|
|
132
|
+
case 0: return [4 /*yield*/, (mcp === null || mcp === void 0 ? void 0 : mcp.getTools(config))];
|
|
133
|
+
case 1:
|
|
134
|
+
mcpToolList = (_a = (_c.sent())) !== null && _a !== void 0 ? _a : [];
|
|
135
|
+
return [4 /*yield*/, (mcp === null || mcp === void 0 ? void 0 : mcp.getToolPriority(config))];
|
|
136
|
+
case 2:
|
|
137
|
+
mcpToolPriorityMap = (_b = (_c.sent())) !== null && _b !== void 0 ? _b : {};
|
|
138
|
+
return [2 /*return*/, Object.fromEntries(mcpToolList.map(function (item) {
|
|
139
|
+
var _a;
|
|
140
|
+
return [
|
|
141
|
+
item.name,
|
|
142
|
+
{
|
|
143
|
+
name: "mcp_".concat(item.name.replaceAll('.', '_')),
|
|
144
|
+
description: item.description,
|
|
145
|
+
inputSchema: item.inputSchema,
|
|
146
|
+
serverConfig: {
|
|
147
|
+
name: item.name,
|
|
148
|
+
kind: 'mcp',
|
|
149
|
+
contract: null,
|
|
150
|
+
priority: (_a = mcpToolPriorityMap[item.name]) !== null && _a !== void 0 ? _a : 0,
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
];
|
|
154
|
+
}))];
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}); };
|
|
158
|
+
exports.generateMcpToolDefinitions = generateMcpToolDefinitions;
|
|
159
|
+
var generateAgentInternalToolDefinitions = function (tools) {
|
|
160
|
+
var e_2, _a;
|
|
161
|
+
var _b;
|
|
162
|
+
var toolDef = {};
|
|
163
|
+
try {
|
|
164
|
+
for (var _c = __values(Object.entries(tools)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
165
|
+
var _e = __read(_d.value, 2), key = _e[0], tool = _e[1];
|
|
166
|
+
toolDef[key] = {
|
|
167
|
+
name: "internal_".concat(tool.name.replaceAll('.', '_')),
|
|
168
|
+
description: tool.description,
|
|
169
|
+
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(tool.input),
|
|
170
|
+
serverConfig: {
|
|
171
|
+
name: key,
|
|
172
|
+
kind: 'internal',
|
|
173
|
+
contract: tool,
|
|
174
|
+
priority: (_b = tool.priority) !== null && _b !== void 0 ? _b : 0,
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
180
|
+
finally {
|
|
181
|
+
try {
|
|
182
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
183
|
+
}
|
|
184
|
+
finally { if (e_2) throw e_2.error; }
|
|
185
|
+
}
|
|
186
|
+
return toolDef;
|
|
187
|
+
};
|
|
188
|
+
exports.generateAgentInternalToolDefinitions = generateAgentInternalToolDefinitions;
|
|
189
|
+
var clampStr = function (s, len) {
|
|
190
|
+
return s.length > len ? "".concat(s.slice(0, len), "...") : s;
|
|
191
|
+
};
|
|
192
|
+
exports.clampStr = clampStr;
|
|
193
|
+
var setOpenInferenceInputAttr = function (param, span) {
|
|
194
|
+
var _a, e_3, _b, _c, e_4, _d, _e, _f, _g, _h;
|
|
195
|
+
span.setAttributes((_a = {},
|
|
196
|
+
_a[openinference_semantic_conventions_1.SemanticConventions.LLM_PROVIDER] = param.llm.provider,
|
|
197
|
+
_a[openinference_semantic_conventions_1.SemanticConventions.LLM_SYSTEM] = param.llm.system,
|
|
198
|
+
_a[openinference_semantic_conventions_1.SemanticConventions.LLM_MODEL_NAME] = param.llm.model,
|
|
199
|
+
_a[openinference_semantic_conventions_1.SemanticConventions.LLM_INVOCATION_PARAMETERS] = JSON.stringify(param.llm.invocationParam),
|
|
200
|
+
_a));
|
|
201
|
+
try {
|
|
202
|
+
for (var _j = __values(param.tools.entries()), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
203
|
+
var _l = __read(_k.value, 2), index = _l[0], tool = _l[1];
|
|
204
|
+
span.setAttribute("".concat(openinference_semantic_conventions_1.SemanticConventions.LLM_TOOLS, ".").concat(index, ".").concat(openinference_semantic_conventions_1.SemanticConventions.TOOL_JSON_SCHEMA), JSON.stringify(__assign(__assign({}, tool), { serverConfig: __assign(__assign({}, tool.serverConfig), { contract: tool.serverConfig.contract ? 'Not Shown' : null }) })));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
208
|
+
finally {
|
|
209
|
+
try {
|
|
210
|
+
if (_k && !_k.done && (_b = _j.return)) _b.call(_j);
|
|
211
|
+
}
|
|
212
|
+
finally { if (e_3) throw e_3.error; }
|
|
213
|
+
}
|
|
214
|
+
if (param.system) {
|
|
215
|
+
span.setAttributes((_c = {},
|
|
216
|
+
_c["".concat(openinference_semantic_conventions_1.SemanticConventions.LLM_INPUT_MESSAGES, ".0.").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_ROLE)] = 'system',
|
|
217
|
+
_c["".concat(openinference_semantic_conventions_1.SemanticConventions.LLM_INPUT_MESSAGES, ".0.").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_CONTENTS, ".0.").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_CONTENT_TYPE)] = 'text',
|
|
218
|
+
_c["".concat(openinference_semantic_conventions_1.SemanticConventions.LLM_INPUT_MESSAGES, ".0.").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_CONTENTS, ".0.").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_CONTENT_TEXT)] = param.system,
|
|
219
|
+
_c));
|
|
220
|
+
}
|
|
221
|
+
try {
|
|
222
|
+
for (var _m = __values(param.messages.entries()), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
223
|
+
var _p = __read(_o.value, 2), _index = _p[0], item = _p[1];
|
|
224
|
+
var index = param.system ? _index + 1 : _index;
|
|
225
|
+
span.setAttribute("".concat(openinference_semantic_conventions_1.SemanticConventions.LLM_INPUT_MESSAGES, ".").concat(index, ".").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_ROLE), item.role);
|
|
226
|
+
if (item.content.type === 'text') {
|
|
227
|
+
span.setAttributes((_e = {},
|
|
228
|
+
_e["".concat(openinference_semantic_conventions_1.SemanticConventions.LLM_INPUT_MESSAGES, ".").concat(index, ".").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_CONTENTS, ".0.").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_CONTENT_TYPE)] = 'text',
|
|
229
|
+
_e["".concat(openinference_semantic_conventions_1.SemanticConventions.LLM_INPUT_MESSAGES, ".").concat(index, ".").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_CONTENTS, ".0.").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_CONTENT_TEXT)] = item.content.content,
|
|
230
|
+
_e));
|
|
231
|
+
}
|
|
232
|
+
if (item.content.type === 'media' && item.content.contentType.type === 'image') {
|
|
233
|
+
span.setAttributes((_f = {},
|
|
234
|
+
_f["".concat(openinference_semantic_conventions_1.SemanticConventions.LLM_INPUT_MESSAGES, ".").concat(index, ".").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_CONTENTS, ".0.").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_CONTENT_TYPE)] = 'text',
|
|
235
|
+
_f["".concat(openinference_semantic_conventions_1.SemanticConventions.LLM_INPUT_MESSAGES, ".").concat(index, ".").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_CONTENTS, ".0.").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_CONTENT_TEXT)] = "IMAGE: ".concat((0, exports.clampStr)(item.content.content, 100)),
|
|
236
|
+
_f));
|
|
237
|
+
}
|
|
238
|
+
if (item.content.type === 'media' && item.content.contentType.type === 'file') {
|
|
239
|
+
span.setAttributes((_g = {},
|
|
240
|
+
_g["".concat(openinference_semantic_conventions_1.SemanticConventions.LLM_INPUT_MESSAGES, ".").concat(index, ".").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_CONTENTS, ".0.").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_CONTENT_TYPE)] = 'text',
|
|
241
|
+
_g["".concat(openinference_semantic_conventions_1.SemanticConventions.LLM_INPUT_MESSAGES, ".").concat(index, ".").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_CONTENTS, ".0.").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_CONTENT_TEXT)] = "FILE: ".concat((0, exports.clampStr)(item.content.content, 100)),
|
|
242
|
+
_g));
|
|
243
|
+
}
|
|
244
|
+
if (item.content.type === 'tool_use') {
|
|
245
|
+
span.setAttributes((_h = {},
|
|
246
|
+
_h["".concat(openinference_semantic_conventions_1.SemanticConventions.LLM_INPUT_MESSAGES, ".").concat(index, ".").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_TOOL_CALLS, ".0.").concat(openinference_semantic_conventions_1.SemanticConventions.TOOL_CALL_FUNCTION_NAME)] = item.content.name,
|
|
247
|
+
_h["".concat(openinference_semantic_conventions_1.SemanticConventions.LLM_INPUT_MESSAGES, ".").concat(index, ".").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_TOOL_CALLS, ".0.").concat(openinference_semantic_conventions_1.SemanticConventions.TOOL_CALL_FUNCTION_ARGUMENTS_JSON)] = JSON.stringify({
|
|
248
|
+
param: item.content.input,
|
|
249
|
+
tool_use_id: item.content.toolUseId,
|
|
250
|
+
}),
|
|
251
|
+
_h));
|
|
252
|
+
}
|
|
253
|
+
if (item.content.type === 'tool_result') {
|
|
254
|
+
span.setAttribute("".concat(openinference_semantic_conventions_1.SemanticConventions.LLM_INPUT_MESSAGES, ".").concat(index, ".").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_CONTENTS, ".0.").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_CONTENT_TEXT), JSON.stringify({ result: item.content.content, tool_use_id: item.content.toolUseId }));
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
259
|
+
finally {
|
|
260
|
+
try {
|
|
261
|
+
if (_o && !_o.done && (_d = _m.return)) _d.call(_m);
|
|
262
|
+
}
|
|
263
|
+
finally { if (e_4) throw e_4.error; }
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
exports.setOpenInferenceInputAttr = setOpenInferenceInputAttr;
|
|
267
|
+
var setOpenInferenceToolCallOutputAttr = function (param, span) {
|
|
268
|
+
var _a;
|
|
269
|
+
var _b;
|
|
270
|
+
span.setAttributes((_a = {},
|
|
271
|
+
_a["".concat(openinference_semantic_conventions_1.SemanticConventions.LLM_OUTPUT_MESSAGES, ".0.").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_ROLE)] = 'assistant',
|
|
272
|
+
_a));
|
|
273
|
+
if ((_b = param.toolCalls) === null || _b === void 0 ? void 0 : _b.length) {
|
|
274
|
+
span.setAttributes(Object.fromEntries(param.toolCalls.flatMap(function (item, index) { return [
|
|
275
|
+
[
|
|
276
|
+
"".concat(openinference_semantic_conventions_1.SemanticConventions.LLM_OUTPUT_MESSAGES, ".0.").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_TOOL_CALLS, ".").concat(index, ".").concat(openinference_semantic_conventions_1.SemanticConventions.TOOL_CALL_FUNCTION_NAME),
|
|
277
|
+
item.name,
|
|
278
|
+
],
|
|
279
|
+
[
|
|
280
|
+
"".concat(openinference_semantic_conventions_1.SemanticConventions.LLM_OUTPUT_MESSAGES, ".0.").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_TOOL_CALLS, ".").concat(index, ".").concat(openinference_semantic_conventions_1.SemanticConventions.TOOL_CALL_FUNCTION_ARGUMENTS_JSON),
|
|
281
|
+
JSON.stringify({
|
|
282
|
+
param: item.input,
|
|
283
|
+
tool_use_id: item.toolUseId,
|
|
284
|
+
}),
|
|
285
|
+
],
|
|
286
|
+
]; })));
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
exports.setOpenInferenceToolCallOutputAttr = setOpenInferenceToolCallOutputAttr;
|
|
290
|
+
var setOpenInferenceUsageOutputAttr = function (param, span) {
|
|
291
|
+
var _a;
|
|
292
|
+
if (param) {
|
|
293
|
+
span.setAttributes((_a = {},
|
|
294
|
+
_a[openinference_semantic_conventions_1.SemanticConventions.LLM_TOKEN_COUNT_PROMPT] = param.tokens.prompt,
|
|
295
|
+
_a[openinference_semantic_conventions_1.SemanticConventions.LLM_TOKEN_COUNT_COMPLETION] = param.tokens.completion,
|
|
296
|
+
_a[openinference_semantic_conventions_1.SemanticConventions.LLM_TOKEN_COUNT_TOTAL] = param.tokens.completion + param.tokens.prompt,
|
|
297
|
+
_a));
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
exports.setOpenInferenceUsageOutputAttr = setOpenInferenceUsageOutputAttr;
|
|
301
|
+
var setOpenInferenceResponseOutputAttr = function (param, span) {
|
|
302
|
+
var _a, _b;
|
|
303
|
+
span.setAttributes((_a = {},
|
|
304
|
+
_a["".concat(openinference_semantic_conventions_1.SemanticConventions.LLM_OUTPUT_MESSAGES, ".0.").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_ROLE)] = 'assistant',
|
|
305
|
+
_a));
|
|
306
|
+
span.setAttributes((_b = {},
|
|
307
|
+
_b["".concat(openinference_semantic_conventions_1.SemanticConventions.LLM_OUTPUT_MESSAGES, ".0.").concat(openinference_semantic_conventions_1.SemanticConventions.MESSAGE_CONTENT)] = param.response,
|
|
308
|
+
_b));
|
|
309
|
+
};
|
|
310
|
+
exports.setOpenInferenceResponseOutputAttr = setOpenInferenceResponseOutputAttr;
|
|
311
|
+
var tryParseJson = function (str) {
|
|
312
|
+
try {
|
|
313
|
+
return JSON.parse(str);
|
|
314
|
+
}
|
|
315
|
+
catch (_a) {
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
exports.tryParseJson = tryParseJson;
|
|
320
|
+
var prioritizeToolCalls = function (toolCalls, nameToToolMap) {
|
|
321
|
+
var e_5, _a;
|
|
322
|
+
var _b, _c, _d, _e, _f;
|
|
323
|
+
var grouped = new Map();
|
|
324
|
+
try {
|
|
325
|
+
for (var toolCalls_1 = __values(toolCalls), toolCalls_1_1 = toolCalls_1.next(); !toolCalls_1_1.done; toolCalls_1_1 = toolCalls_1.next()) {
|
|
326
|
+
var request = toolCalls_1_1.value;
|
|
327
|
+
var priority = (_c = (_b = nameToToolMap[request.name]) === null || _b === void 0 ? void 0 : _b.serverConfig.priority) !== null && _c !== void 0 ? _c : 0;
|
|
328
|
+
var existing = (_d = grouped.get(priority)) !== null && _d !== void 0 ? _d : [];
|
|
329
|
+
existing.push(request);
|
|
330
|
+
grouped.set(priority, existing);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
334
|
+
finally {
|
|
335
|
+
try {
|
|
336
|
+
if (toolCalls_1_1 && !toolCalls_1_1.done && (_a = toolCalls_1.return)) _a.call(toolCalls_1);
|
|
337
|
+
}
|
|
338
|
+
finally { if (e_5) throw e_5.error; }
|
|
339
|
+
}
|
|
340
|
+
var priorities = Array.from(grouped.keys()).sort(function (a, b) { return b - a; });
|
|
341
|
+
var highestPriority = (_e = priorities[0]) !== null && _e !== void 0 ? _e : 0;
|
|
342
|
+
return (_f = grouped.get(highestPriority)) !== null && _f !== void 0 ? _f : [];
|
|
343
|
+
};
|
|
344
|
+
exports.prioritizeToolCalls = prioritizeToolCalls;
|
|
345
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/Agent/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kGAAsH;AAGtH,yDAAqD;AAa9C,IAAM,8BAA8B,GAAG,UAG5C,QAA0B;;;IAE1B,IAAM,YAAY,GAGd,EAAE,CAAC;;QACP,KAA2B,IAAA,KAAA,SAAA,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA,gBAAA,4BAAE,CAAC;YAA3C,IAAA,KAAA,mBAAY,EAAX,GAAG,QAAA,EAAE,KAAK,QAAA;YACpB,IAAM,WAAW,GAAG,KAAK,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;YACjE,iHAAiH;YACjH,IAAM,KACJ,WAAW,IAAI,YAAY,IAAI,WAAW,IAAI,WAAW,CAAC,UAAU;gBAClE,CAAC,CAAC,WAAW,CAAC,UAAU;gBACxB,CAAC,CAAC,EAAE,EAHA,eAAe,qBAAA,EAAK,iBAAiB,cAAvC,mBAAyC,CAGvC,CAAC;YACT,IAAM,eAAe,GAAG,CACtB,WAAW,IAAI,UAAU,IAAI,WAAW,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,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