@agnt-sdk/studio 0.0.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/README.md +162 -0
- package/dist/AgntExecutor.d.ts +56 -0
- package/dist/AgntExecutor.d.ts.map +1 -0
- package/dist/AgntExecutor.js +117 -0
- package/dist/AgntExecutor.js.map +1 -0
- package/dist/BaseExecutor.d.ts +69 -0
- package/dist/BaseExecutor.d.ts.map +1 -0
- package/dist/BaseExecutor.js +528 -0
- package/dist/BaseExecutor.js.map +1 -0
- package/dist/ImageCache.d.ts +94 -0
- package/dist/ImageCache.d.ts.map +1 -0
- package/dist/ImageCache.js +232 -0
- package/dist/ImageCache.js.map +1 -0
- package/dist/cli/commands/init.d.ts +5 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +47 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/pull.d.ts +10 -0
- package/dist/cli/commands/pull.d.ts.map +1 -0
- package/dist/cli/commands/pull.js +82 -0
- package/dist/cli/commands/pull.js.map +1 -0
- package/dist/cli/index.d.ts +6 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +28 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/utils/api.d.ts +38 -0
- package/dist/cli/utils/api.d.ts.map +1 -0
- package/dist/cli/utils/api.js +44 -0
- package/dist/cli/utils/api.js.map +1 -0
- package/dist/cli/utils/config.d.ts +5 -0
- package/dist/cli/utils/config.d.ts.map +1 -0
- package/dist/cli/utils/config.js +5 -0
- package/dist/cli/utils/config.js.map +1 -0
- package/dist/conditions.d.ts +14 -0
- package/dist/conditions.d.ts.map +1 -0
- package/dist/conditions.js +59 -0
- package/dist/conditions.js.map +1 -0
- package/dist/executorFactory.d.ts +10 -0
- package/dist/executorFactory.d.ts.map +1 -0
- package/dist/executorFactory.js +45 -0
- package/dist/executorFactory.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/anthropic.d.ts +22 -0
- package/dist/providers/anthropic.d.ts.map +1 -0
- package/dist/providers/anthropic.js +280 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/bedrock.d.ts +23 -0
- package/dist/providers/bedrock.d.ts.map +1 -0
- package/dist/providers/bedrock.js +281 -0
- package/dist/providers/bedrock.js.map +1 -0
- package/dist/providers/deepseek.d.ts +22 -0
- package/dist/providers/deepseek.d.ts.map +1 -0
- package/dist/providers/deepseek.js +193 -0
- package/dist/providers/deepseek.js.map +1 -0
- package/dist/providers/google.d.ts +22 -0
- package/dist/providers/google.d.ts.map +1 -0
- package/dist/providers/google.js +357 -0
- package/dist/providers/google.js.map +1 -0
- package/dist/providers/openai.d.ts +22 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +194 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/systemTools.d.ts +6 -0
- package/dist/systemTools.d.ts.map +1 -0
- package/dist/systemTools.js +15 -0
- package/dist/systemTools.js.map +1 -0
- package/dist/tracing.d.ts +32 -0
- package/dist/tracing.d.ts.map +1 -0
- package/dist/tracing.js +38 -0
- package/dist/tracing.js.map +1 -0
- package/dist/types.d.ts +280 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditions.js","sourceRoot":"","sources":["../src/conditions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,SAAS,UAAU,CAAC,CAAY;IAC9B,OAAO,UAAU,IAAI,CAAC,CAAC;AACzB,CAAC;AAED;;;GAGG;AACH,SAAS,mBAAmB,CAAC,IAAY,EAAE,SAA8B;IACvE,IAAI,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAClC,OAAO,SAAS,CAAC,IAAI,CAAC,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AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,SAAuC,EACvC,SAA8B;IAE9B,IAAI,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAE5B,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC1B,QAAQ,SAAS,CAAC,QAAQ,EAAE,CAAC;YAC3B,KAAK,KAAK,CAAC,CAAC,OAAO,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;YAC/E,KAAK,IAAI,CAAC,CAAE,OAAO,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;YAC9E,KAAK,KAAK,CAAC,CAAC,OAAO,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;YACnG,OAAO,CAAC,CAAI,OAAO,KAAK,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC,SAA0B,EAAE,SAAS,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Executor Factory
|
|
3
|
+
*
|
|
4
|
+
* Creates provider-specific executor instances from a v2 PromptManifest.
|
|
5
|
+
* Supports: anthropic, openai, bedrock, deepseek, google
|
|
6
|
+
*/
|
|
7
|
+
import type { BaseExecutorConfig } from './types.js';
|
|
8
|
+
import type BaseExecutor from './BaseExecutor.js';
|
|
9
|
+
export declare function createExecutor(config: BaseExecutorConfig): Promise<BaseExecutor>;
|
|
10
|
+
//# sourceMappingURL=executorFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executorFactory.d.ts","sourceRoot":"","sources":["../src/executorFactory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAElD,wBAAsB,cAAc,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CAwCtF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Executor Factory
|
|
3
|
+
*
|
|
4
|
+
* Creates provider-specific executor instances from a v2 PromptManifest.
|
|
5
|
+
* Supports: anthropic, openai, bedrock, deepseek, google
|
|
6
|
+
*/
|
|
7
|
+
import AnthropicExecutor from './providers/anthropic.js';
|
|
8
|
+
import OpenAIExecutor from './providers/openai.js';
|
|
9
|
+
import BedrockExecutor from './providers/bedrock.js';
|
|
10
|
+
import DeepSeekExecutor from './providers/deepseek.js';
|
|
11
|
+
import GoogleExecutor from './providers/google.js';
|
|
12
|
+
export async function createExecutor(config) {
|
|
13
|
+
const { manifest, log = console.log } = config;
|
|
14
|
+
if (!manifest)
|
|
15
|
+
throw new Error('[executorFactory] manifest is required');
|
|
16
|
+
const spec = manifest.spec;
|
|
17
|
+
if (!spec?.models || spec.models.length === 0) {
|
|
18
|
+
throw new Error('[executorFactory] manifest.spec.models is required');
|
|
19
|
+
}
|
|
20
|
+
const primaryModel = spec.models[0];
|
|
21
|
+
const provider = primaryModel.provider;
|
|
22
|
+
if (!provider)
|
|
23
|
+
throw new Error('[executorFactory] manifest.spec.models[0].provider is required');
|
|
24
|
+
const configWithFactory = { ...config, executorFactory: createExecutor };
|
|
25
|
+
switch (provider.toLowerCase()) {
|
|
26
|
+
case 'anthropic':
|
|
27
|
+
log(`[executorFactory] Creating Anthropic executor: ${primaryModel.model}`);
|
|
28
|
+
return new AnthropicExecutor(configWithFactory);
|
|
29
|
+
case 'openai':
|
|
30
|
+
log(`[executorFactory] Creating OpenAI executor: ${primaryModel.model}`);
|
|
31
|
+
return new OpenAIExecutor(configWithFactory);
|
|
32
|
+
case 'bedrock':
|
|
33
|
+
log(`[executorFactory] Creating Bedrock executor: ${primaryModel.model}`);
|
|
34
|
+
return new BedrockExecutor(configWithFactory);
|
|
35
|
+
case 'deepseek':
|
|
36
|
+
log(`[executorFactory] Creating DeepSeek executor: ${primaryModel.model}`);
|
|
37
|
+
return new DeepSeekExecutor(configWithFactory);
|
|
38
|
+
case 'google':
|
|
39
|
+
log(`[executorFactory] Creating Google executor: ${primaryModel.model}`);
|
|
40
|
+
return new GoogleExecutor(configWithFactory);
|
|
41
|
+
default:
|
|
42
|
+
throw new Error(`[executorFactory] Unsupported provider: ${provider}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=executorFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executorFactory.js","sourceRoot":"","sources":["../src/executorFactory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,iBAAiB,MAAM,0BAA0B,CAAC;AACzD,OAAO,cAAc,MAAM,uBAAuB,CAAC;AACnD,OAAO,eAAe,MAAM,wBAAwB,CAAC;AACrD,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AACvD,OAAO,cAAc,MAAM,uBAAuB,CAAC;AAInD,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAA0B;IAC7D,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC;IAE/C,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAEzE,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;IAC3B,IAAI,CAAC,IAAI,EAAE,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACx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Agnt prompts.
|
|
5
|
+
* Supports Anthropic, OpenAI, Bedrock, DeepSeek, Google Gemini.
|
|
6
|
+
*/
|
|
7
|
+
export { AgntExecutor, type AgntExecutorConfig, type AgntExecuteOptions } from './AgntExecutor.js';
|
|
8
|
+
export { createExecutor } from './executorFactory.js';
|
|
9
|
+
export { default as BaseExecutor } from './BaseExecutor.js';
|
|
10
|
+
export { default as ImageCache } from './ImageCache.js';
|
|
11
|
+
export { default as AnthropicExecutor } from './providers/anthropic.js';
|
|
12
|
+
export { default as OpenAIExecutor } from './providers/openai.js';
|
|
13
|
+
export { default as BedrockExecutor } from './providers/bedrock.js';
|
|
14
|
+
export { default as DeepSeekExecutor } from './providers/deepseek.js';
|
|
15
|
+
export { default as GoogleExecutor } from './providers/google.js';
|
|
16
|
+
export { evaluateCondition } from './conditions.js';
|
|
17
|
+
export { SYSTEM_TOOL_NAMES } from './systemTools.js';
|
|
18
|
+
export { AgntApiClient, type AgntApiOptions, type PulledPrompt } from './cli/utils/api.js';
|
|
19
|
+
export { loadConfig } from './cli/utils/config.js';
|
|
20
|
+
export type { PromptManifestV2, V2Metadata, V2Spec, V2VariableDef, V2PromptFile, PromptBlock, V2ToolDef, V2ModelConfig, DependencyRef, Condition, LeafCondition, CompoundCondition, ResolvedDependencies, ResolvedComponent, ResolvedAssistant, ResolvedSkill, ResolvedScenario, ProviderCredentials, ToolRouter, ToolHandler, ToolCallCallback, ExecutionResult, Usage, Message, ToolCall, ToolResult, ToolDefinition, BaseExecutorConfig, TracingConfig, ModelPricing, AgntConfig } from './types.js';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGnG,OAAO,EAAE,cAA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|
+
*
|
|
4
|
+
* V2 manifest-based LLM executor for Agnt prompts.
|
|
5
|
+
* Supports Anthropic, OpenAI, Bedrock, DeepSeek, Google Gemini.
|
|
6
|
+
*/
|
|
7
|
+
// ── Main executor (recommended) ──────────────────────────────────────────────
|
|
8
|
+
export { AgntExecutor } from './AgntExecutor.js';
|
|
9
|
+
// ── Lower-level APIs ─────────────────────────────────────────────────────────
|
|
10
|
+
export { createExecutor } from './executorFactory.js';
|
|
11
|
+
export { default as BaseExecutor } from './BaseExecutor.js';
|
|
12
|
+
export { default as ImageCache } from './ImageCache.js';
|
|
13
|
+
// ── Provider adapters ─────────────────────────────────────────────────────────
|
|
14
|
+
export { default as AnthropicExecutor } from './providers/anthropic.js';
|
|
15
|
+
export { default as OpenAIExecutor } from './providers/openai.js';
|
|
16
|
+
export { default as BedrockExecutor } from './providers/bedrock.js';
|
|
17
|
+
export { default as DeepSeekExecutor } from './providers/deepseek.js';
|
|
18
|
+
export { default as GoogleExecutor } from './providers/google.js';
|
|
19
|
+
// ── Condition evaluation ──────────────────────────────────────────────────────
|
|
20
|
+
export { evaluateCondition } from './conditions.js';
|
|
21
|
+
// ── System tool registry ──────────────────────────────────────────────────────
|
|
22
|
+
export { SYSTEM_TOOL_NAMES } from './systemTools.js';
|
|
23
|
+
// ── API Client & Config ───────────────────────────────────────────────────────
|
|
24
|
+
export { AgntApiClient } from './cli/utils/api.js';
|
|
25
|
+
export { loadConfig } from './cli/utils/config.js';
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,gFAAgF;AAChF,OAAO,EAAE,YAAY,EAAoD,MAAM,mBAAmB,CAAC;AAEnG,gFAAgF;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAExD,iFAAiF;AACjF,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAElE,iFAAiF;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,iFAAiF;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,iFAAiF;AACjF,OAAO,EAAE,aAAa,EAA0C,MAAM,oBAAoB,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AnthropicExecutor - Provider adapter for Anthropic models
|
|
3
|
+
*
|
|
4
|
+
* Uses native @anthropic-ai/sdk (not LangChain)
|
|
5
|
+
*/
|
|
6
|
+
import BaseExecutor from '../BaseExecutor.js';
|
|
7
|
+
import type { BaseExecutorConfig, Message, InvokeOptions, InvokeResult } from '../types.js';
|
|
8
|
+
export default class AnthropicExecutor extends BaseExecutor {
|
|
9
|
+
#private;
|
|
10
|
+
private client;
|
|
11
|
+
constructor(config: BaseExecutorConfig);
|
|
12
|
+
/**
|
|
13
|
+
* Invoke Anthropic API
|
|
14
|
+
* Returns: { message: { role, content, tool_calls }, usage: { input_tokens, output_tokens } }
|
|
15
|
+
*/
|
|
16
|
+
invoke(messages: Message[], options?: InvokeOptions): Promise<InvokeResult>;
|
|
17
|
+
/**
|
|
18
|
+
* Check if message has tool calls
|
|
19
|
+
*/
|
|
20
|
+
hasToolCalls(message: Message): boolean;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=anthropic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE5F,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,YAAY;;IACzD,OAAO,CAAC,MAAM,CAAY;gBAEd,MAAM,EAAE,kBAAkB;IAqBtC;;;OAGG;IACG,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,YAAY,CAAC;IAmDrF;;OAEG;IACH,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO;CAyOxC"}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AnthropicExecutor - Provider adapter for Anthropic models
|
|
3
|
+
*
|
|
4
|
+
* Uses native @anthropic-ai/sdk (not LangChain)
|
|
5
|
+
*/
|
|
6
|
+
import Anthropic from '@anthropic-ai/sdk';
|
|
7
|
+
import BaseExecutor from '../BaseExecutor.js';
|
|
8
|
+
export default class AnthropicExecutor extends BaseExecutor {
|
|
9
|
+
client;
|
|
10
|
+
constructor(config) {
|
|
11
|
+
super(config);
|
|
12
|
+
// Get Anthropic credentials
|
|
13
|
+
const anthropicCreds = this.credentials.anthropic;
|
|
14
|
+
if (!anthropicCreds) {
|
|
15
|
+
throw new Error('[AnthropicExecutor] credentials.anthropic is required');
|
|
16
|
+
}
|
|
17
|
+
if (!anthropicCreds.apiKey) {
|
|
18
|
+
throw new Error('[AnthropicExecutor] credentials.anthropic.apiKey is required');
|
|
19
|
+
}
|
|
20
|
+
// Initialize Anthropic client
|
|
21
|
+
this.client = new Anthropic({
|
|
22
|
+
apiKey: anthropicCreds.apiKey,
|
|
23
|
+
dangerouslyAllowBrowser: anthropicCreds.dangerouslyAllowBrowser
|
|
24
|
+
});
|
|
25
|
+
this.log(`[AnthropicExecutor] Initialized with model: ${this.model}`);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Invoke Anthropic API
|
|
29
|
+
* Returns: { message: { role, content, tool_calls }, usage: { input_tokens, output_tokens } }
|
|
30
|
+
*/
|
|
31
|
+
async invoke(messages, options = {}) {
|
|
32
|
+
// Extract provider-specific parameters from model config
|
|
33
|
+
const providerParams = this.#extractProviderParams();
|
|
34
|
+
// Extract system messages (Anthropic requires separate system parameter)
|
|
35
|
+
const systemMessages = messages.filter(m => m.role === 'system');
|
|
36
|
+
const systemContent = systemMessages.map(m => m.content).join('\n\n');
|
|
37
|
+
// Build request parameters
|
|
38
|
+
const params = {
|
|
39
|
+
model: this.model,
|
|
40
|
+
max_tokens: providerParams.max_tokens || providerParams.maxTokens || 4096,
|
|
41
|
+
messages: this.#formatMessages(messages),
|
|
42
|
+
...providerParams // Spread all provider-specific params
|
|
43
|
+
};
|
|
44
|
+
// Add system parameter if we have system messages
|
|
45
|
+
if (systemContent) {
|
|
46
|
+
params.system = systemContent;
|
|
47
|
+
}
|
|
48
|
+
// Add tools if provided
|
|
49
|
+
if (options.tools && options.tools.length > 0) {
|
|
50
|
+
params.tools = options.tools.map((t) => {
|
|
51
|
+
return this.#formatTool(t);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
// Add tool_choice if specified
|
|
55
|
+
if (options.tool_choice && options.tool_choice !== 'auto') {
|
|
56
|
+
params.tool_choice = this.#formatToolChoice(options.tool_choice);
|
|
57
|
+
}
|
|
58
|
+
// Call Anthropic API
|
|
59
|
+
this.debug(`[AnthropicExecutor] Final messages payload:\n${JSON.stringify({ system: params.system, messages: params.messages }, null, 2)}`);
|
|
60
|
+
const response = await this.client.messages.create(params);
|
|
61
|
+
// Format response to match expected structure
|
|
62
|
+
return {
|
|
63
|
+
message: {
|
|
64
|
+
role: 'assistant',
|
|
65
|
+
content: this.#extractTextContent(response.content),
|
|
66
|
+
tool_calls: this.#extractToolCalls(response.content)
|
|
67
|
+
},
|
|
68
|
+
usage: {
|
|
69
|
+
input_tokens: response.usage.input_tokens,
|
|
70
|
+
output_tokens: response.usage.output_tokens
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Check if message has tool calls
|
|
76
|
+
*/
|
|
77
|
+
hasToolCalls(message) {
|
|
78
|
+
return Boolean(message?.tool_calls && message.tool_calls.length > 0);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Format messages for Anthropic API
|
|
82
|
+
* Converts from standard format to Anthropic format
|
|
83
|
+
*/
|
|
84
|
+
#formatMessages(messages) {
|
|
85
|
+
const formatted = [];
|
|
86
|
+
for (const msg of messages) {
|
|
87
|
+
// Skip system messages (handled separately in Anthropic)
|
|
88
|
+
if (msg.role === 'system') {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
// Handle tool messages
|
|
92
|
+
if (msg.role === 'tool') {
|
|
93
|
+
formatted.push({
|
|
94
|
+
role: 'user',
|
|
95
|
+
content: [
|
|
96
|
+
{
|
|
97
|
+
type: 'tool_result',
|
|
98
|
+
tool_use_id: msg.tool_call_id,
|
|
99
|
+
content: msg.content
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
});
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
// Handle assistant messages with tool_calls
|
|
106
|
+
if (msg.role === 'assistant' && msg.tool_calls && msg.tool_calls.length > 0) {
|
|
107
|
+
const content = [];
|
|
108
|
+
// Add text content if present
|
|
109
|
+
if (msg.content) {
|
|
110
|
+
content.push({
|
|
111
|
+
type: 'text',
|
|
112
|
+
text: typeof msg.content === 'string' ? msg.content : JSON.stringify(msg.content)
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
// Add tool_use blocks
|
|
116
|
+
for (const toolCall of msg.tool_calls) {
|
|
117
|
+
content.push({
|
|
118
|
+
type: 'tool_use',
|
|
119
|
+
id: toolCall.id,
|
|
120
|
+
name: toolCall.name,
|
|
121
|
+
input: toolCall.args
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
formatted.push({
|
|
125
|
+
role: 'assistant',
|
|
126
|
+
content
|
|
127
|
+
});
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
// Handle user/assistant messages without tool calls
|
|
131
|
+
formatted.push({
|
|
132
|
+
role: msg.role,
|
|
133
|
+
content: typeof msg.content === 'string'
|
|
134
|
+
? msg.content
|
|
135
|
+
: this.#formatContent(msg.content)
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return formatted;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Format content blocks (for images, etc.)
|
|
142
|
+
*/
|
|
143
|
+
#formatContent(content) {
|
|
144
|
+
if (typeof content === 'string') {
|
|
145
|
+
return content;
|
|
146
|
+
}
|
|
147
|
+
if (Array.isArray(content)) {
|
|
148
|
+
return content.map(item => {
|
|
149
|
+
if (item.type === 'text') {
|
|
150
|
+
return { type: 'text', text: item.text };
|
|
151
|
+
}
|
|
152
|
+
if (item.type === 'image_url') {
|
|
153
|
+
// Extract image data
|
|
154
|
+
const imageUrl = typeof item.image_url === 'string'
|
|
155
|
+
? item.image_url
|
|
156
|
+
: item.image_url?.url;
|
|
157
|
+
// If it's a data URL, extract base64 and media type
|
|
158
|
+
if (imageUrl && imageUrl.startsWith('data:')) {
|
|
159
|
+
const match = imageUrl.match(/^data:([^;]+);base64,(.+)$/);
|
|
160
|
+
if (match) {
|
|
161
|
+
const mediaType = match[1];
|
|
162
|
+
const data = match[2];
|
|
163
|
+
return {
|
|
164
|
+
type: 'image',
|
|
165
|
+
source: {
|
|
166
|
+
type: 'base64',
|
|
167
|
+
media_type: mediaType,
|
|
168
|
+
data
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
// If it's a URL, Anthropic expects it to be converted to base64
|
|
174
|
+
// This should be handled by ImageCache before getting here
|
|
175
|
+
this.log('[AnthropicExecutor] Warning: Image URL should be converted to base64 before invoking');
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
return item;
|
|
179
|
+
}).filter(Boolean);
|
|
180
|
+
}
|
|
181
|
+
return content;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Format tool definition for Anthropic
|
|
185
|
+
*/
|
|
186
|
+
#formatTool(tool) {
|
|
187
|
+
// Priority order:
|
|
188
|
+
// 1. Studio format: { name, description, parameters, metadata? } - PRIMARY from Studio API
|
|
189
|
+
// 2. Anthropic format: { name, description, input_schema } - for compatibility
|
|
190
|
+
// 3. OpenAI format: { type: "function", function: { name, description, parameters } } - for compatibility
|
|
191
|
+
// Studio format (PRIMARY): { name, description, parameters, metadata? }
|
|
192
|
+
// Check for parameters first since that's what Studio sends
|
|
193
|
+
if (tool.name && tool.parameters && !tool.function && !tool.input_schema) {
|
|
194
|
+
return {
|
|
195
|
+
name: tool.name,
|
|
196
|
+
description: tool.description || '',
|
|
197
|
+
input_schema: tool.parameters
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
// Anthropic format: { name, description, input_schema }
|
|
201
|
+
if (tool.name && tool.input_schema && !tool.function) {
|
|
202
|
+
return {
|
|
203
|
+
name: tool.name,
|
|
204
|
+
description: tool.description || '',
|
|
205
|
+
input_schema: tool.input_schema
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
// OpenAI format: { type: "function", function: { name, description, parameters } }
|
|
209
|
+
if (tool.function) {
|
|
210
|
+
return {
|
|
211
|
+
name: tool.function.name,
|
|
212
|
+
description: tool.function.description || '',
|
|
213
|
+
input_schema: tool.function.parameters || { type: 'object', properties: {} }
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
// Fallback: try to salvage
|
|
217
|
+
return {
|
|
218
|
+
name: tool.name || 'unknown',
|
|
219
|
+
description: tool.description || '',
|
|
220
|
+
input_schema: tool.input_schema || tool.parameters || { type: 'object', properties: {} }
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Format tool_choice for Anthropic
|
|
225
|
+
*/
|
|
226
|
+
#formatToolChoice(toolChoice) {
|
|
227
|
+
if (typeof toolChoice === 'string') {
|
|
228
|
+
if (toolChoice === 'required' || toolChoice === 'any') {
|
|
229
|
+
return { type: 'any', disable_parallel_tool_use: true };
|
|
230
|
+
}
|
|
231
|
+
return { type: 'auto' };
|
|
232
|
+
}
|
|
233
|
+
if (toolChoice.type === 'function' && toolChoice.function?.name) {
|
|
234
|
+
return { type: 'tool', name: toolChoice.function.name };
|
|
235
|
+
}
|
|
236
|
+
return toolChoice;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Extract text content from response
|
|
240
|
+
*/
|
|
241
|
+
#extractTextContent(content) {
|
|
242
|
+
if (!content || content.length === 0) {
|
|
243
|
+
return '';
|
|
244
|
+
}
|
|
245
|
+
// Find text blocks
|
|
246
|
+
const textBlocks = content.filter(block => block.type === 'text');
|
|
247
|
+
if (textBlocks.length === 0) {
|
|
248
|
+
return '';
|
|
249
|
+
}
|
|
250
|
+
return textBlocks.map(block => block.text).join('\n');
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Extract tool calls from response
|
|
254
|
+
*/
|
|
255
|
+
#extractToolCalls(content) {
|
|
256
|
+
if (!content || content.length === 0) {
|
|
257
|
+
return [];
|
|
258
|
+
}
|
|
259
|
+
// Find tool_use blocks
|
|
260
|
+
const toolUseBlocks = content.filter(block => block.type === 'tool_use');
|
|
261
|
+
if (toolUseBlocks.length === 0) {
|
|
262
|
+
return [];
|
|
263
|
+
}
|
|
264
|
+
return toolUseBlocks.map(block => ({
|
|
265
|
+
id: block.id,
|
|
266
|
+
name: block.name,
|
|
267
|
+
args: block.input
|
|
268
|
+
}));
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Extract provider-specific parameters from model config
|
|
272
|
+
* Excludes displayName, passes rest to Anthropic API
|
|
273
|
+
*/
|
|
274
|
+
#extractProviderParams() {
|
|
275
|
+
const metadata = this.primaryModelConfig.metadata || {};
|
|
276
|
+
const { displayName, ...providerParams } = metadata;
|
|
277
|
+
return providerParams;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=anthropic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAG9C,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,YAAY;IACjD,MAAM,CAAY;IAE1B,YAAY,MAA0B;QACpC,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,4BAA4B;QAC5B,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC;QAClD,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;QAC3E,CAAC;QACD,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;QAClF,CAAC;QAED,8BAA8B;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,SAAS,CAAC;YAC1B,MAAM,EAAE,cAAc,CAAC,MAAM;YAC7B,uBAAuB,EAAE,cAAc,CAAC,uBAAuB;SAChE,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,+CAA+C,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IACxE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IAED;;OAEG;IACH,iBAAiB,CAAC,OAAc;QAC9B,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrC,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,uBAAuB;QACvB,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;QACzE,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/B,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACjC,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,IAAI,EAAE,KAAK,CAAC,KAAK;SAClB,CAAC,CAAC,CAAC;IACN,CAAC;IAED;;;OAGG;IACH,sBAAsB;QACpB,MAAM,QAAQ,GAAI,IAAI,CAAC,kBAA0B,CAAC,QAAQ,IAAI,EAAE,CAAC;QACjE,MAAM,EAAE,WAAW,EAAE,GAAG,cAAc,EAAE,GAAG,QAAQ,CAAC;QACpD,OAAO,cAAc,CAAC;IACxB,CAAC;CACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BedrockExecutor - Provider adapter for AWS Bedrock models
|
|
3
|
+
*
|
|
4
|
+
* Uses native @aws-sdk/client-bedrock-runtime (not LangChain)
|
|
5
|
+
*/
|
|
6
|
+
import BaseExecutor from '../BaseExecutor.js';
|
|
7
|
+
import type { BaseExecutorConfig, Message, InvokeOptions, InvokeResult } from '../types.js';
|
|
8
|
+
export default class BedrockExecutor extends BaseExecutor {
|
|
9
|
+
#private;
|
|
10
|
+
private client;
|
|
11
|
+
private region;
|
|
12
|
+
constructor(config: BaseExecutorConfig);
|
|
13
|
+
/**
|
|
14
|
+
* Invoke Bedrock Converse API
|
|
15
|
+
* Returns: { message: { role, content, tool_calls }, usage: { input_tokens, output_tokens } }
|
|
16
|
+
*/
|
|
17
|
+
invoke(messages: Message[], options?: InvokeOptions): Promise<InvokeResult>;
|
|
18
|
+
/**
|
|
19
|
+
* Check if message has tool calls
|
|
20
|
+
*/
|
|
21
|
+
hasToolCalls(message: Message): boolean;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=bedrock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bedrock.d.ts","sourceRoot":"","sources":["../../src/providers/bedrock.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE5F,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,YAAY;;IACvD,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,kBAAkB;IA6BtC;;;OAGG;IACG,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,YAAY,CAAC;IAwErF;;OAEG;IACH,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO;CA2MxC"}
|