@bluefly/openstandardagents 0.2.5-RC → 0.2.7
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/.github/ISSUE_TEMPLATE/bug_report.yml +63 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +40 -0
- package/.github/workflows/dependabot-comment.yml +34 -0
- package/.github/workflows/pr-comment.yml +33 -0
- package/.husky/pre-commit +5 -0
- package/.kiro/config.json +21 -0
- package/.kiro/settings/mcp.json +61 -0
- package/.kiro/specs/scripts-migration-api-first/design.md +883 -0
- package/.kiro/specs/scripts-migration-api-first/requirements.md +165 -0
- package/.kiro/specs/scripts-migration-api-first/tasks.md +539 -0
- package/.kiro/specs/{website-design-audit → website-brand-identity}/design.md +381 -0
- package/.kiro/specs/{website-design-audit → website-brand-identity}/requirements.md +88 -0
- package/.kiro/specs/website-brand-identity/tasks.md +981 -0
- package/CHANGELOG.md +23 -0
- package/README.md +12 -3
- package/bin/ossa-dev +42 -0
- package/bin/ossa-export +32 -0
- package/bin/ossa-generate +60 -0
- package/bin/ossa-health +40 -0
- package/bin/ossa-init +26 -0
- package/dist/repositories/schema.repository.d.ts.map +1 -1
- package/dist/repositories/schema.repository.js +15 -10
- package/dist/repositories/schema.repository.js.map +1 -1
- package/dist/services/github-sync/github-client.d.ts +14 -0
- package/dist/services/github-sync/github-client.d.ts.map +1 -0
- package/dist/services/github-sync/github-client.js +41 -0
- package/dist/services/github-sync/github-client.js.map +1 -0
- package/dist/services/github-sync/gitlab-client.d.ts +17 -0
- package/dist/services/github-sync/gitlab-client.d.ts.map +1 -0
- package/dist/services/github-sync/gitlab-client.js +42 -0
- package/dist/services/github-sync/gitlab-client.js.map +1 -0
- package/dist/services/github-sync/schemas.d.ts +46 -0
- package/dist/services/github-sync/schemas.d.ts.map +1 -0
- package/dist/services/github-sync/schemas.js +36 -0
- package/dist/services/github-sync/schemas.js.map +1 -0
- package/dist/services/github-sync/sync.service.d.ts +27 -0
- package/dist/services/github-sync/sync.service.d.ts.map +1 -0
- package/dist/services/github-sync/sync.service.js +99 -0
- package/dist/services/github-sync/sync.service.js.map +1 -0
- package/dist/services/runtime/claude/capability-mapper.d.ts +84 -0
- package/dist/services/runtime/claude/capability-mapper.d.ts.map +1 -0
- package/dist/services/runtime/claude/capability-mapper.js +245 -0
- package/dist/services/runtime/claude/capability-mapper.js.map +1 -0
- package/dist/services/runtime/claude/claude-adapter.d.ts +80 -0
- package/dist/services/runtime/claude/claude-adapter.d.ts.map +1 -0
- package/dist/services/runtime/claude/claude-adapter.js +287 -0
- package/dist/services/runtime/claude/claude-adapter.js.map +1 -0
- package/dist/services/runtime/claude/manifest-parser.d.ts +77 -0
- package/dist/services/runtime/claude/manifest-parser.d.ts.map +1 -0
- package/dist/services/runtime/claude/manifest-parser.js +169 -0
- package/dist/services/runtime/claude/manifest-parser.js.map +1 -0
- package/dist/services/runtime/claude/types.d.ts +115 -0
- package/dist/services/runtime/claude/types.d.ts.map +1 -0
- package/dist/services/runtime/claude/types.js +6 -0
- package/dist/services/runtime/claude/types.js.map +1 -0
- package/dist/services/validation.service.d.ts.map +1 -1
- package/dist/services/validation.service.js +12 -1
- package/dist/services/validation.service.js.map +1 -1
- package/dist/spec/v0.2.4/ossa-0.2.4.schema.json +85 -208
- package/dist/spec/v0.2.6/CHANGELOG.md +401 -0
- package/dist/spec/v0.2.6/README.md +72 -0
- package/dist/spec/v0.2.6/migrations/v0.2.3-to-v0.2.4.md +599 -0
- package/dist/spec/v0.2.6/migrations/v0.2.5-RC-to-v0.2.6.md +65 -0
- package/dist/spec/v0.2.6/ossa-0.2.6.schema.json +1786 -0
- package/dist/spec/v0.2.6/ossa-0.2.6.yaml +581 -0
- package/dist/spec/v0.2.6-dev/CHANGELOG.md +164 -0
- package/dist/spec/v0.2.6-dev/README.md +75 -0
- package/dist/spec/v0.2.6-dev/migrations/v0.2.2-to-v0.2.3.md +343 -0
- package/dist/spec/v0.2.6-dev/migrations/v0.2.3-to-v0.2.4.md +599 -0
- package/dist/spec/{v0.2.4/ossa-0.2.4-dev.schema.json → v0.2.6-dev/ossa-0.2.5.schema.json} +9 -9
- package/dist/spec/v0.2.6-dev/ossa-0.2.5.yaml +581 -0
- package/{spec/v0.2.4/ossa-0.2.4-dev.schema.json → dist/spec/v0.2.6-dev/ossa-0.2.6-dev.schema.json} +9 -9
- package/dist/spec/v0.2.6-dev/ossa-0.2.6-dev.yaml +448 -0
- package/dist/spec/v0.2.7/core/agentgraph.md +324 -0
- package/dist/spec/v0.2.7/resources/agentgraph.yaml +135 -0
- package/docs/brand-guide/01-brand-overview.md +37 -0
- package/docs/brand-guide/02-logo-usage.md +43 -0
- package/docs/brand-guide/03-color-palette.md +70 -0
- package/docs/brand-guide/04-typography.md +82 -0
- package/docs/brand-guide/05-voice-and-tone.md +108 -0
- package/docs/brand-guide/06-visual-elements.md +137 -0
- package/docs/brand-guide/07-application-examples.md +153 -0
- package/docs/brand-guide/OssaLogo/OssA_Logo.svg +21 -0
- package/docs/brand-guide/OssaLogo/brand.af +0 -0
- package/docs/brand-guide/README.md +107 -0
- package/docs/comparison.md +315 -0
- package/docs/operations/automation-roadmap.md +245 -0
- package/docs/operations/github-sync-strategy.md +357 -0
- package/examples/anthropic/claude-assistant.ossa.json +5 -4
- package/examples/autogen/multi-agent.ossa.json +6 -4
- package/examples/crewai/research-team.ossa.json +14 -5
- package/examples/cursor/code-review-agent.ossa.json +21 -6
- package/examples/langchain/chain-agent.ossa.json +21 -5
- package/examples/langflow/workflow-agent.ossa.json +2 -3
- package/examples/langgraph/state-machine-agent.ossa.json +2 -3
- package/examples/llamaindex/rag-agent.ossa.json +2 -3
- package/examples/openai/multi-tool-agent.ossa.json +32 -9
- package/examples/openai/swarm-agent.ossa.json +18 -5
- package/examples/vercel/edge-agent.ossa.json +5 -4
- package/openapi/github-sync.yaml +115 -0
- package/package.json +25 -4
- package/scripts/README.md +103 -0
- package/scripts/auto-rebase-mrs.ts +106 -0
- package/scripts/batch-dependabot.sh +57 -0
- package/scripts/configure-gitlab-branch-protection.ts +95 -0
- package/scripts/create-issue-helper.ts +238 -0
- package/scripts/create-milestone-issue.ts +73 -0
- package/scripts/fix-schema-formats.js +82 -0
- package/scripts/generate-agents-catalog.ts +77 -0
- package/scripts/generate-api-docs.ts +218 -0
- package/scripts/generate-cli-docs.ts +410 -0
- package/scripts/generate-config-docs.ts +109 -0
- package/scripts/generate-errors-docs.ts +76 -0
- package/scripts/generate-examples-docs.ts +99 -0
- package/scripts/generate-schema-docs.ts +296 -0
- package/scripts/generate-types-docs.ts +48 -0
- package/scripts/lowercase-docs.ts +43 -0
- package/scripts/manage-milestone-mrs.ts +279 -0
- package/scripts/rebase-all-mrs.sh +75 -0
- package/scripts/sync-github-pr.sh +48 -0
- package/scripts/sync-version.js +40 -0
- package/scripts/sync-wiki.sh +50 -0
- package/scripts/validate-all.js +127 -0
- package/spec/v0.2.4/ossa-0.2.4.schema.json +85 -208
- package/spec/v0.2.6/CHANGELOG.md +401 -0
- package/spec/v0.2.6/README.md +72 -0
- package/spec/v0.2.6/migrations/v0.2.3-to-v0.2.4.md +599 -0
- package/spec/v0.2.6/migrations/v0.2.5-RC-to-v0.2.6.md +65 -0
- package/spec/v0.2.6/ossa-0.2.6.schema.json +1786 -0
- package/spec/v0.2.6/ossa-0.2.6.yaml +581 -0
- package/spec/v0.2.6-dev/CHANGELOG.md +164 -0
- package/spec/v0.2.6-dev/README.md +75 -0
- package/spec/v0.2.6-dev/migrations/v0.2.2-to-v0.2.3.md +343 -0
- package/spec/v0.2.6-dev/migrations/v0.2.3-to-v0.2.4.md +599 -0
- package/spec/v0.2.6-dev/ossa-0.2.5.schema.json +1696 -0
- package/spec/v0.2.6-dev/ossa-0.2.5.yaml +581 -0
- package/spec/v0.2.6-dev/ossa-0.2.6-dev.schema.json +1696 -0
- package/spec/v0.2.6-dev/ossa-0.2.6-dev.yaml +448 -0
- package/spec/v0.2.7/core/agentgraph.md +324 -0
- package/spec/v0.2.7/resources/agentgraph.yaml +135 -0
- package/website/DESIGN_SYSTEM_IMPLEMENTATION.md +445 -0
- package/website/app/about/page.tsx +53 -44
- package/website/app/ecosystem/page.tsx +146 -111
- package/website/app/globals.scss +256 -21
- package/website/app/page.tsx +394 -182
- package/website/app/page.tsx.bak +679 -0
- package/website/app/page.tsx.bak2 +649 -0
- package/website/app/schema/page.tsx +3 -3
- package/website/app/specification/page.tsx +1 -1
- package/website/components/layout/Header.tsx +27 -23
- package/website/components/ui/Badge.tsx +82 -0
- package/website/components/ui/Button.tsx +116 -0
- package/website/components/ui/Card.tsx +167 -0
- package/website/components/ui/Checkbox.tsx +141 -0
- package/website/components/ui/Input.tsx +169 -0
- package/website/components/ui/Radio.tsx +141 -0
- package/website/components/ui/Select.tsx +182 -0
- package/website/components/ui/Tag.tsx +158 -0
- package/website/components/ui/Textarea.tsx +195 -0
- package/website/components/ui/index.ts +11 -0
- package/website/content/docs/{00-HOME.md → 00-home.md} +1 -1
- package/website/content/docs/agents/catalog.md +28 -0
- package/website/content/docs/{AIFlow-Framework-Integration-with-OSSA.md → aiflow-framework-integration-with-ossa.md} +2 -2
- package/website/content/docs/api-reference/index.md +38 -0
- package/website/content/docs/api-reference/ossa-core-api.md +634 -0
- package/website/content/docs/api-reference/ossa-registry-api.md +515 -0
- package/website/content/docs/api-reference/unified-agent-gateway.md +599 -0
- package/website/content/docs/cli-reference/index.md +111 -0
- package/website/content/docs/cli-reference/ossa-agents.md +70 -0
- package/website/content/docs/cli-reference/ossa-export.md +56 -0
- package/website/content/docs/cli-reference/ossa-generate.md +66 -0
- package/website/content/docs/cli-reference/ossa-gitlab-agent.md +57 -0
- package/website/content/docs/cli-reference/ossa-import.md +56 -0
- package/website/content/docs/cli-reference/ossa-init.md +57 -0
- package/website/content/docs/cli-reference/ossa-migrate.md +62 -0
- package/website/content/docs/cli-reference/ossa-run.md +66 -0
- package/website/content/docs/cli-reference/ossa-schema.md +57 -0
- package/website/content/docs/cli-reference/ossa-setup.md +57 -0
- package/website/content/docs/cli-reference/ossa-validate.md +66 -0
- package/website/content/docs/configuration/index.md +97 -0
- package/website/content/docs/deployment/github-mirroring.md +924 -0
- package/website/content/docs/documentation.md +100 -0
- package/website/content/docs/ecosystem/framework-support.md +551 -9
- package/website/content/docs/errors/index.md +10 -0
- package/website/content/docs/examples/{AIFlow-Framework-Integration-with-OSSA.md → aiflow-framework-integration-with-ossa.md} +2 -2
- package/website/content/docs/examples/catalog.md +300 -0
- package/website/content/docs/for-audiences/{Students-Researchers.md → students-researchers.md} +1 -1
- package/website/content/docs/getting-started/{Installation.md → installation.md} +1 -1
- package/website/content/docs/getting-started.md +1 -1
- package/website/content/docs/integrations/aiflow.md +2 -2
- package/website/content/docs/migration-guides/anthropic-mcp-to-ossa.md +5 -5
- package/website/content/docs/migration-guides/crewai-to-ossa.md +3 -3
- package/website/content/docs/migration-guides/drupal-eca-to-ossa.md +7 -7
- package/website/content/docs/migration-guides/langchain-to-ossa.md +4 -4
- package/website/content/docs/openapi-extensions/index.md +1 -1
- package/website/content/docs/ossa-compliant-badge.md +1 -1
- package/website/content/docs/pre-release/index.md +5 -5
- package/website/content/docs/releases/v0.2.6.md +99 -0
- package/website/content/docs/schema-reference/agent-capabilities.md +50 -0
- package/website/content/docs/schema-reference/agent-id.md +52 -0
- package/website/content/docs/schema-reference/agent-name.md +50 -0
- package/website/content/docs/schema-reference/agent-role.md +54 -0
- package/website/content/docs/schema-reference/agent-version.md +50 -0
- package/website/content/docs/schema-reference/index.md +26 -157
- package/website/content/docs/types-reference/index.md +105 -0
- package/website/content/docs/versioning.md +3 -3
- package/website/dev.sh +53 -0
- package/website/docker-compose.dev.yml +36 -0
- package/website/lib/version.ts +1 -1
- package/website/lib/versions.json +45 -20
- package/website/package.json +1 -1
- package/website/styles/_spacing.scss +453 -0
- package/website/styles/_tokens.scss +245 -0
- package/website/styles/_typography.scss +361 -0
- package/website/styles/_variables.scss +270 -19
- package/website/tailwind.config.ts +113 -79
- package/.kiro/specs/agent-buildkit-templates/design.md +0 -495
- package/.kiro/specs/agent-buildkit-templates/requirements.md +0 -165
- package/.kiro/specs/kiro-ide-supercharger/README.md +0 -202
- package/.kiro/specs/kiro-ide-supercharger/design.md +0 -1005
- package/.kiro/specs/kiro-ide-supercharger/requirements.md +0 -141
- package/.kiro/specs/kiro-ide-supercharger/tasks.md +0 -507
- package/docs/issue-19-completion-summary.md +0 -648
- package/docs/issue-19-validation.md +0 -351
- package/website/content/docs/Examples.md +0 -71
- package/website/content/docs/OpenAPI-Extensions.md +0 -934
- package/website/content/docs/core-concepts/Project-Structure.md +0 -348
- package/website/content/docs/examples/Migration-Guides.md +0 -214
- package/website/content/docs/for-audiences/Architects.md +0 -224
- package/website/content/docs/for-audiences/Developers.md +0 -220
- package/website/content/docs/for-audiences/Enterprises.md +0 -256
- package/website/content/docs/getting-started/5-Minute-Overview.md +0 -85
- package/website/content/docs/getting-started/First-Agent.md +0 -196
- package/website/content/docs/getting-started/Hello-World.md +0 -184
- package/website/content/docs/migration-guides/00-INDEX.md +0 -76
- package/website/content/docs/migration-guides/README.md +0 -133
- /package/dist/spec/v0.2.4/{ossa-0.2.4-dev.yaml → ossa-0.2.4.yaml} +0 -0
- /package/spec/v0.2.4/{ossa-0.2.4-dev.yaml → ossa-0.2.4.yaml} +0 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Runtime Adapter
|
|
3
|
+
* Runs OSSA agents using Anthropic's Claude API
|
|
4
|
+
*/
|
|
5
|
+
import Anthropic from '@anthropic-ai/sdk';
|
|
6
|
+
import { ManifestParser } from './manifest-parser.js';
|
|
7
|
+
import { CapabilityMapper } from './capability-mapper.js';
|
|
8
|
+
/**
|
|
9
|
+
* Claude adapter for executing OSSA agents
|
|
10
|
+
*/
|
|
11
|
+
export class ClaudeAdapter {
|
|
12
|
+
client;
|
|
13
|
+
parser;
|
|
14
|
+
mapper;
|
|
15
|
+
messages = [];
|
|
16
|
+
conversationHistory = [];
|
|
17
|
+
constructor(config) {
|
|
18
|
+
// Initialize Anthropic client
|
|
19
|
+
this.client = new Anthropic({
|
|
20
|
+
apiKey: config.apiKey || process.env.ANTHROPIC_API_KEY,
|
|
21
|
+
});
|
|
22
|
+
// Initialize parser and mapper
|
|
23
|
+
this.parser = new ManifestParser(config.manifest);
|
|
24
|
+
this.mapper = new CapabilityMapper();
|
|
25
|
+
// Validate manifest
|
|
26
|
+
const validation = this.parser.validate();
|
|
27
|
+
if (!validation.valid) {
|
|
28
|
+
throw new Error(`Invalid OSSA manifest: ${validation.errors.join(', ')}`);
|
|
29
|
+
}
|
|
30
|
+
// Check if Anthropic integration is enabled
|
|
31
|
+
if (!this.parser.isAnthropicEnabled()) {
|
|
32
|
+
console.warn('Warning: Anthropic extension is disabled in manifest');
|
|
33
|
+
}
|
|
34
|
+
// Initialize tools
|
|
35
|
+
this.initializeTools();
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Initialize tools from manifest
|
|
39
|
+
*/
|
|
40
|
+
initializeTools() {
|
|
41
|
+
// Map Claude extension tools first (highest priority)
|
|
42
|
+
const anthropicExt = this.parser.getAnthropicExtension();
|
|
43
|
+
if (anthropicExt?.tools) {
|
|
44
|
+
this.mapper.mapClaudeTools(anthropicExt.tools);
|
|
45
|
+
}
|
|
46
|
+
// Map OSSA spec tools
|
|
47
|
+
const specTools = this.parser.getSpecTools();
|
|
48
|
+
this.mapper.mapOssaTools(specTools);
|
|
49
|
+
// Map MCP capabilities if any
|
|
50
|
+
for (const tool of specTools) {
|
|
51
|
+
if (tool.type === 'mcp' && tool.capabilities) {
|
|
52
|
+
this.mapper.mapMcpCapabilities(tool.capabilities);
|
|
53
|
+
}
|
|
54
|
+
else if (tool.type === 'http') {
|
|
55
|
+
this.mapper.mapHttpTool(tool);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Register a tool handler
|
|
61
|
+
*/
|
|
62
|
+
registerToolHandler(name, handler) {
|
|
63
|
+
return this.mapper.registerToolHandler(name, handler);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Execute a tool call
|
|
67
|
+
*/
|
|
68
|
+
async executeTool(name, input) {
|
|
69
|
+
const tool = this.mapper.getTool(name);
|
|
70
|
+
if (!tool) {
|
|
71
|
+
return JSON.stringify({
|
|
72
|
+
error: `Tool '${name}' not found`,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
if (tool.handler) {
|
|
76
|
+
try {
|
|
77
|
+
return await tool.handler(input);
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
return JSON.stringify({
|
|
81
|
+
error: `Error executing ${name}: ${error instanceof Error ? error.message : String(error)}`,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
// Default: return placeholder response
|
|
86
|
+
return JSON.stringify({
|
|
87
|
+
message: `Tool '${name}' executed`,
|
|
88
|
+
input,
|
|
89
|
+
note: 'No handler registered for this tool',
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Initialize the conversation
|
|
94
|
+
*/
|
|
95
|
+
initialize() {
|
|
96
|
+
this.messages = [];
|
|
97
|
+
this.conversationHistory = [];
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Send a message and get a response
|
|
101
|
+
*/
|
|
102
|
+
async chat(userMessage, options) {
|
|
103
|
+
// Add user message to history
|
|
104
|
+
this.conversationHistory.push({
|
|
105
|
+
role: 'user',
|
|
106
|
+
content: userMessage,
|
|
107
|
+
});
|
|
108
|
+
const tools = this.mapper.getClaudeTools();
|
|
109
|
+
let turnCount = 0;
|
|
110
|
+
const maxTurns = options?.maxTurns || 10;
|
|
111
|
+
while (turnCount < maxTurns) {
|
|
112
|
+
turnCount++;
|
|
113
|
+
if (options?.verbose) {
|
|
114
|
+
console.log(`\n[Turn ${turnCount}/${maxTurns}]`);
|
|
115
|
+
}
|
|
116
|
+
// Call Claude API
|
|
117
|
+
const response = await this.client.messages.create({
|
|
118
|
+
model: this.parser.getModel(),
|
|
119
|
+
max_tokens: this.parser.getMaxTokens(),
|
|
120
|
+
temperature: this.parser.getTemperature(),
|
|
121
|
+
system: this.parser.getSystemPrompt(),
|
|
122
|
+
messages: this.conversationHistory,
|
|
123
|
+
tools: tools.length > 0 ? tools : undefined,
|
|
124
|
+
stop_sequences: this.parser.getStopSequences(),
|
|
125
|
+
});
|
|
126
|
+
if (options?.verbose) {
|
|
127
|
+
console.log(` Model: ${response.model}, Stop: ${response.stop_reason}`);
|
|
128
|
+
console.log(` Tokens: ${response.usage.input_tokens} in, ${response.usage.output_tokens} out`);
|
|
129
|
+
}
|
|
130
|
+
// Add assistant response to history
|
|
131
|
+
this.conversationHistory.push({
|
|
132
|
+
role: 'assistant',
|
|
133
|
+
content: response.content,
|
|
134
|
+
});
|
|
135
|
+
// Check if we need to execute tools
|
|
136
|
+
const toolUses = response.content.filter((block) => block.type === 'tool_use');
|
|
137
|
+
if (toolUses.length > 0) {
|
|
138
|
+
if (options?.verbose) {
|
|
139
|
+
console.log(` [Executing ${toolUses.length} tool(s)...]`);
|
|
140
|
+
}
|
|
141
|
+
// Execute all tool calls
|
|
142
|
+
const toolResults = [];
|
|
143
|
+
for (const toolUse of toolUses) {
|
|
144
|
+
if (toolUse.type !== 'tool_use')
|
|
145
|
+
continue;
|
|
146
|
+
const { id, name, input } = toolUse;
|
|
147
|
+
if (options?.verbose) {
|
|
148
|
+
console.log(` → ${name}(${JSON.stringify(input).substring(0, 100)}...)`);
|
|
149
|
+
}
|
|
150
|
+
const result = await this.executeTool(name, input);
|
|
151
|
+
if (options?.verbose) {
|
|
152
|
+
console.log(` ← ${result.substring(0, 100)}${result.length > 100 ? '...' : ''}`);
|
|
153
|
+
}
|
|
154
|
+
toolResults.push({
|
|
155
|
+
type: 'tool_result',
|
|
156
|
+
tool_use_id: id,
|
|
157
|
+
content: result,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
// Add tool results to conversation
|
|
161
|
+
this.conversationHistory.push({
|
|
162
|
+
role: 'user',
|
|
163
|
+
content: toolResults,
|
|
164
|
+
});
|
|
165
|
+
// Continue the loop to get final response
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
// Check if we have a text response
|
|
169
|
+
const textBlocks = response.content.filter((block) => block.type === 'text');
|
|
170
|
+
if (textBlocks.length > 0) {
|
|
171
|
+
return textBlocks
|
|
172
|
+
.map((block) => ('text' in block ? block.text : ''))
|
|
173
|
+
.join('\n');
|
|
174
|
+
}
|
|
175
|
+
// No text and no tool calls - unexpected
|
|
176
|
+
if (response.stop_reason === 'end_turn') {
|
|
177
|
+
return '';
|
|
178
|
+
}
|
|
179
|
+
// Max tokens or stop sequence reached
|
|
180
|
+
if (response.stop_reason === 'max_tokens' ||
|
|
181
|
+
response.stop_reason === 'stop_sequence') {
|
|
182
|
+
return '[Response truncated due to length limit]';
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return '[Max turns reached without completion]';
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Stream a response (for future implementation)
|
|
189
|
+
*/
|
|
190
|
+
async chatStream(userMessage, options) {
|
|
191
|
+
// Add user message to history
|
|
192
|
+
this.conversationHistory.push({
|
|
193
|
+
role: 'user',
|
|
194
|
+
content: userMessage,
|
|
195
|
+
});
|
|
196
|
+
const tools = this.mapper.getClaudeTools();
|
|
197
|
+
const stream = await this.client.messages.stream({
|
|
198
|
+
model: this.parser.getModel(),
|
|
199
|
+
max_tokens: this.parser.getMaxTokens(),
|
|
200
|
+
temperature: this.parser.getTemperature(),
|
|
201
|
+
system: this.parser.getSystemPrompt(),
|
|
202
|
+
messages: this.conversationHistory,
|
|
203
|
+
tools: tools.length > 0 ? tools : undefined,
|
|
204
|
+
});
|
|
205
|
+
// Return async generator
|
|
206
|
+
return (async function* () {
|
|
207
|
+
for await (const chunk of stream) {
|
|
208
|
+
if (chunk.type === 'content_block_delta' &&
|
|
209
|
+
chunk.delta.type === 'text_delta') {
|
|
210
|
+
yield chunk.delta.text;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
})();
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Get agent information
|
|
217
|
+
*/
|
|
218
|
+
getAgentInfo() {
|
|
219
|
+
const metadata = this.parser.getMetadata();
|
|
220
|
+
const tools = Array.from(this.mapper.getTools().keys());
|
|
221
|
+
return {
|
|
222
|
+
name: metadata.name,
|
|
223
|
+
model: this.parser.getModel(),
|
|
224
|
+
tools,
|
|
225
|
+
provider: 'anthropic',
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Get conversation history
|
|
230
|
+
*/
|
|
231
|
+
getConversationHistory() {
|
|
232
|
+
return this.conversationHistory;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Clear conversation history
|
|
236
|
+
*/
|
|
237
|
+
clearHistory() {
|
|
238
|
+
this.conversationHistory = [];
|
|
239
|
+
this.messages = [];
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Get available tools
|
|
243
|
+
*/
|
|
244
|
+
getTools() {
|
|
245
|
+
return this.mapper.getClaudeTools();
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Get the Anthropic client (for advanced usage)
|
|
249
|
+
*/
|
|
250
|
+
getClient() {
|
|
251
|
+
return this.client;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Get the manifest parser
|
|
255
|
+
*/
|
|
256
|
+
getParser() {
|
|
257
|
+
return this.parser;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Get the capability mapper
|
|
261
|
+
*/
|
|
262
|
+
getMapper() {
|
|
263
|
+
return this.mapper;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Create a Claude adapter from a manifest file
|
|
267
|
+
*/
|
|
268
|
+
static async fromFile(manifestPath, apiKey) {
|
|
269
|
+
const fs = await import('fs/promises');
|
|
270
|
+
const manifestContent = await fs.readFile(manifestPath, 'utf-8');
|
|
271
|
+
const manifest = JSON.parse(manifestContent);
|
|
272
|
+
return new ClaudeAdapter({
|
|
273
|
+
manifest,
|
|
274
|
+
apiKey,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Create a Claude adapter from a manifest object
|
|
279
|
+
*/
|
|
280
|
+
static fromManifest(manifest, apiKey) {
|
|
281
|
+
return new ClaudeAdapter({
|
|
282
|
+
manifest,
|
|
283
|
+
apiKey,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
//# sourceMappingURL=claude-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-adapter.js","sourceRoot":"","sources":["../../../../src/services/runtime/claude/claude-adapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAW1D;;GAEG;AACH,MAAM,OAAO,aAAa;IAChB,MAAM,CAAY;IAClB,MAAM,CAAiB;IACvB,MAAM,CAAmB;IACzB,QAAQ,GAAoB,EAAE,CAAC;IAC/B,mBAAmB,GAA6B,EAAE,CAAC;IAE3D,YAAY,MAA2B;QACrC,8BAA8B;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,SAAS,CAAC;YAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB;SACvD,CAAC,CAAC;QAEH,+BAA+B;QAC/B,IAAI,CAAC,MAAM,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;QAErC,oBAAoB;QACpB,MA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G;IACH,YAAY;QACV,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC;QAC9B,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,QAAQ,CACnB,YAAoB,EACpB,MAAe;QAEf,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;QACvC,MAAM,eAAe,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACjE,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CACzB,eAAe,CACa,CAAC;QAE/B,OAAO,IAAI,aAAa,CAAC;YACvB,QAAQ;YACR,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,YAAY,CACjB,QAAmC,EACnC,MAAe;QAEf,OAAO,IAAI,aAAa,CAAC;YACvB,QAAQ;YACR,MAAM;SACP,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest Parser for Claude Adapter
|
|
3
|
+
* Parses OSSA manifest files and extracts Claude/Anthropic-specific configuration
|
|
4
|
+
*/
|
|
5
|
+
import type { OssaManifestWithAnthropic, AnthropicExtension } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Parse and validate OSSA manifest for Claude adapter
|
|
8
|
+
*/
|
|
9
|
+
export declare class ManifestParser {
|
|
10
|
+
private manifest;
|
|
11
|
+
constructor(manifest: OssaManifestWithAnthropic);
|
|
12
|
+
/**
|
|
13
|
+
* Get the Claude model to use
|
|
14
|
+
* Priority: extensions.anthropic.model > spec.llm.model > default
|
|
15
|
+
*/
|
|
16
|
+
getModel(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Get system prompt for Claude
|
|
19
|
+
* Priority: extensions.anthropic.system > spec.role > default
|
|
20
|
+
*/
|
|
21
|
+
getSystemPrompt(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Get max tokens configuration
|
|
24
|
+
* Priority: extensions.anthropic.max_tokens > spec.llm.maxTokens > default
|
|
25
|
+
*/
|
|
26
|
+
getMaxTokens(): number;
|
|
27
|
+
/**
|
|
28
|
+
* Get temperature configuration
|
|
29
|
+
* Priority: extensions.anthropic.temperature > spec.llm.temperature > default
|
|
30
|
+
*/
|
|
31
|
+
getTemperature(): number;
|
|
32
|
+
/**
|
|
33
|
+
* Get streaming configuration
|
|
34
|
+
*/
|
|
35
|
+
getStreaming(): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Get stop sequences
|
|
38
|
+
*/
|
|
39
|
+
getStopSequences(): string[] | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Get Anthropic extension configuration
|
|
42
|
+
*/
|
|
43
|
+
getAnthropicExtension(): AnthropicExtension | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Get agent metadata
|
|
46
|
+
*/
|
|
47
|
+
getMetadata(): {
|
|
48
|
+
name: string;
|
|
49
|
+
version?: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Get OSSA spec tools (for mapping to Claude tools)
|
|
54
|
+
*/
|
|
55
|
+
getSpecTools(): Array<{
|
|
56
|
+
type: string;
|
|
57
|
+
name?: string;
|
|
58
|
+
capabilities?: string[];
|
|
59
|
+
config?: Record<string, unknown>;
|
|
60
|
+
}>;
|
|
61
|
+
/**
|
|
62
|
+
* Check if Claude/Anthropic integration is enabled
|
|
63
|
+
*/
|
|
64
|
+
isAnthropicEnabled(): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Validate manifest has required fields
|
|
67
|
+
*/
|
|
68
|
+
validate(): {
|
|
69
|
+
valid: boolean;
|
|
70
|
+
errors: string[];
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Get full manifest
|
|
74
|
+
*/
|
|
75
|
+
getManifest(): OssaManifestWithAnthropic;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=manifest-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-parser.d.ts","sourceRoot":"","sources":["../../../../src/services/runtime/claude/manifest-parser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAA4B;gBAEhC,QAAQ,EAAE,yBAAyB;IAI/C;;;OAGG;IACH,QAAQ,IAAI,MAAM;IAelB;;;OAGG;IACH,eAAe,IAAI,MAAM;IAezB;;;OAGG;IACH,YAAY,IAAI,MAAM;IAetB;;;OAGG;IACH,cAAc,IAAI,MAAM;IAiBxB;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;OAEG;IACH,gBAAgB,IAAI,MAAM,EAAE,GAAG,SAAS;IAIxC;;OAEG;IACH,qBAAqB,IAAI,kBAAkB,GAAG,SAAS;IAIvD;;OAEG;IACH,WAAW,IAAI;QACb,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB;IA0BD;;OAEG;IACH,YAAY,IAAI,KAAK,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;QACxB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAClC,CAAC;IAIF;;OAEG;IACH,kBAAkB,IAAI,OAAO;IAI7B;;OAEG;IACH,QAAQ,IAAI;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE;IAkChD;;OAEG;IACH,WAAW,IAAI,yBAAyB;CAGzC"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest Parser for Claude Adapter
|
|
3
|
+
* Parses OSSA manifest files and extracts Claude/Anthropic-specific configuration
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Parse and validate OSSA manifest for Claude adapter
|
|
7
|
+
*/
|
|
8
|
+
export class ManifestParser {
|
|
9
|
+
manifest;
|
|
10
|
+
constructor(manifest) {
|
|
11
|
+
this.manifest = manifest;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Get the Claude model to use
|
|
15
|
+
* Priority: extensions.anthropic.model > spec.llm.model > default
|
|
16
|
+
*/
|
|
17
|
+
getModel() {
|
|
18
|
+
// Check Anthropic extension first
|
|
19
|
+
if (this.manifest.extensions?.anthropic?.model) {
|
|
20
|
+
return this.manifest.extensions.anthropic.model;
|
|
21
|
+
}
|
|
22
|
+
// Fall back to LLM config
|
|
23
|
+
if (this.manifest.spec?.llm?.model) {
|
|
24
|
+
return this.manifest.spec.llm.model;
|
|
25
|
+
}
|
|
26
|
+
// Default to latest Claude Sonnet
|
|
27
|
+
return 'claude-3-5-sonnet-20241022';
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get system prompt for Claude
|
|
31
|
+
* Priority: extensions.anthropic.system > spec.role > default
|
|
32
|
+
*/
|
|
33
|
+
getSystemPrompt() {
|
|
34
|
+
// Check Anthropic extension first
|
|
35
|
+
if (this.manifest.extensions?.anthropic?.system) {
|
|
36
|
+
return this.manifest.extensions.anthropic.system;
|
|
37
|
+
}
|
|
38
|
+
// Fall back to role
|
|
39
|
+
if (this.manifest.spec?.role) {
|
|
40
|
+
return this.manifest.spec.role;
|
|
41
|
+
}
|
|
42
|
+
// Default system prompt
|
|
43
|
+
return 'You are a helpful AI assistant.';
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Get max tokens configuration
|
|
47
|
+
* Priority: extensions.anthropic.max_tokens > spec.llm.maxTokens > default
|
|
48
|
+
*/
|
|
49
|
+
getMaxTokens() {
|
|
50
|
+
// Check Anthropic extension first
|
|
51
|
+
if (this.manifest.extensions?.anthropic?.max_tokens) {
|
|
52
|
+
return this.manifest.extensions.anthropic.max_tokens;
|
|
53
|
+
}
|
|
54
|
+
// Fall back to LLM config
|
|
55
|
+
if (this.manifest.spec?.llm?.maxTokens) {
|
|
56
|
+
return this.manifest.spec.llm.maxTokens;
|
|
57
|
+
}
|
|
58
|
+
// Default
|
|
59
|
+
return 4096;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get temperature configuration
|
|
63
|
+
* Priority: extensions.anthropic.temperature > spec.llm.temperature > default
|
|
64
|
+
*/
|
|
65
|
+
getTemperature() {
|
|
66
|
+
// Check Anthropic extension first
|
|
67
|
+
if (this.manifest.extensions?.anthropic?.temperature !== undefined) {
|
|
68
|
+
return this.manifest.extensions.anthropic.temperature;
|
|
69
|
+
}
|
|
70
|
+
// Fall back to LLM config
|
|
71
|
+
if (this.manifest.spec?.llm?.temperature !== undefined) {
|
|
72
|
+
return this.manifest.spec.llm.temperature;
|
|
73
|
+
}
|
|
74
|
+
// Default
|
|
75
|
+
return 1.0;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Get streaming configuration
|
|
79
|
+
*/
|
|
80
|
+
getStreaming() {
|
|
81
|
+
return this.manifest.extensions?.anthropic?.streaming ?? false;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Get stop sequences
|
|
85
|
+
*/
|
|
86
|
+
getStopSequences() {
|
|
87
|
+
return this.manifest.extensions?.anthropic?.stop_sequences;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Get Anthropic extension configuration
|
|
91
|
+
*/
|
|
92
|
+
getAnthropicExtension() {
|
|
93
|
+
return this.manifest.extensions?.anthropic;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get agent metadata
|
|
97
|
+
*/
|
|
98
|
+
getMetadata() {
|
|
99
|
+
// v0.2.x format
|
|
100
|
+
if (this.manifest.metadata) {
|
|
101
|
+
return {
|
|
102
|
+
name: this.manifest.metadata.name,
|
|
103
|
+
version: this.manifest.metadata.version,
|
|
104
|
+
description: this.manifest.metadata.description,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
// Legacy format fallback
|
|
108
|
+
if (this.manifest.agent) {
|
|
109
|
+
return {
|
|
110
|
+
name: this.manifest.agent.name,
|
|
111
|
+
version: this.manifest.agent.version,
|
|
112
|
+
description: this.manifest.agent.description,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
// Default
|
|
116
|
+
return {
|
|
117
|
+
name: 'unknown-agent',
|
|
118
|
+
version: '1.0.0',
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Get OSSA spec tools (for mapping to Claude tools)
|
|
123
|
+
*/
|
|
124
|
+
getSpecTools() {
|
|
125
|
+
return this.manifest.spec?.tools ?? [];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Check if Claude/Anthropic integration is enabled
|
|
129
|
+
*/
|
|
130
|
+
isAnthropicEnabled() {
|
|
131
|
+
return this.manifest.extensions?.anthropic?.enabled ?? true;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Validate manifest has required fields
|
|
135
|
+
*/
|
|
136
|
+
validate() {
|
|
137
|
+
const errors = [];
|
|
138
|
+
// Check for metadata
|
|
139
|
+
if (!this.manifest.metadata && !this.manifest.agent) {
|
|
140
|
+
errors.push('Manifest must have metadata or agent field');
|
|
141
|
+
}
|
|
142
|
+
// Check for spec or agent
|
|
143
|
+
if (!this.manifest.spec && !this.manifest.agent) {
|
|
144
|
+
errors.push('Manifest must have spec or agent field');
|
|
145
|
+
}
|
|
146
|
+
// Check API version format
|
|
147
|
+
if (this.manifest.apiVersion) {
|
|
148
|
+
const validVersionPattern = /^ossa\/v(0\.2\.[2-5]|1)/;
|
|
149
|
+
if (!validVersionPattern.test(this.manifest.apiVersion)) {
|
|
150
|
+
errors.push(`Invalid apiVersion: ${this.manifest.apiVersion}. Must match pattern ossa/v0.2.x or ossa/v1`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// Check kind
|
|
154
|
+
if (this.manifest.kind && this.manifest.kind !== 'Agent') {
|
|
155
|
+
errors.push(`Invalid kind: ${this.manifest.kind}. Must be "Agent"`);
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
valid: errors.length === 0,
|
|
159
|
+
errors,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Get full manifest
|
|
164
|
+
*/
|
|
165
|
+
getManifest() {
|
|
166
|
+
return this.manifest;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=manifest-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-parser.js","sourceRoot":"","sources":["../../../../src/services/runtime/claude/manifest-parser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;GAEG;AACH,MAAM,OAAO,cAAc;IACjB,QAAQ,CAA4B;IAE5C,YAAY,QAAmC;QAC7C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACH,QAAQ;QACN,kCAAkC;QAClC,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;YAC/C,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,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,CAAC,iBAAiB,IAAI,CAAC,QAAQ,CAAC,IAAI,mBAAmB,CAAC,CAAC;QACtE,CAAC;QAED,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;YAC1B,MAAM;SACP,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Adapter Types
|
|
3
|
+
* Type definitions for Claude/Anthropic runtime adapter
|
|
4
|
+
*/
|
|
5
|
+
import type { OssaAgent } from '../../../types/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Claude-specific tool definition
|
|
8
|
+
*/
|
|
9
|
+
export interface ClaudeTool {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
input_schema: {
|
|
13
|
+
type: 'object';
|
|
14
|
+
properties: Record<string, unknown>;
|
|
15
|
+
required?: string[];
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Tool handler function type
|
|
20
|
+
*/
|
|
21
|
+
export type ToolHandler = (args: Record<string, unknown>) => Promise<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Tool definition with optional handler
|
|
24
|
+
*/
|
|
25
|
+
export interface ToolDefinition extends ClaudeTool {
|
|
26
|
+
handler?: ToolHandler;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Claude message content types
|
|
30
|
+
*/
|
|
31
|
+
export type ClaudeMessageContent = string | Array<{
|
|
32
|
+
type: 'text' | 'tool_use' | 'tool_result';
|
|
33
|
+
text?: string;
|
|
34
|
+
id?: string;
|
|
35
|
+
name?: string;
|
|
36
|
+
input?: Record<string, unknown>;
|
|
37
|
+
tool_use_id?: string;
|
|
38
|
+
content?: string;
|
|
39
|
+
}>;
|
|
40
|
+
/**
|
|
41
|
+
* Claude message format
|
|
42
|
+
*/
|
|
43
|
+
export interface ClaudeMessage {
|
|
44
|
+
role: 'user' | 'assistant';
|
|
45
|
+
content: ClaudeMessageContent;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Claude API response
|
|
49
|
+
*/
|
|
50
|
+
export interface ClaudeResponse {
|
|
51
|
+
id: string;
|
|
52
|
+
type: 'message';
|
|
53
|
+
role: 'assistant';
|
|
54
|
+
content: Array<{
|
|
55
|
+
type: 'text' | 'tool_use';
|
|
56
|
+
text?: string;
|
|
57
|
+
id?: string;
|
|
58
|
+
name?: string;
|
|
59
|
+
input?: Record<string, unknown>;
|
|
60
|
+
}>;
|
|
61
|
+
model: string;
|
|
62
|
+
stop_reason: 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' | null;
|
|
63
|
+
stop_sequence: string | null;
|
|
64
|
+
usage: {
|
|
65
|
+
input_tokens: number;
|
|
66
|
+
output_tokens: number;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Runtime options for Claude adapter
|
|
71
|
+
*/
|
|
72
|
+
export interface ClaudeRunOptions {
|
|
73
|
+
verbose?: boolean;
|
|
74
|
+
maxTurns?: number;
|
|
75
|
+
streaming?: boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Claude adapter configuration
|
|
79
|
+
*/
|
|
80
|
+
export interface ClaudeAdapterConfig {
|
|
81
|
+
apiKey?: string;
|
|
82
|
+
manifest: OssaAgent;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Agent information returned by adapter
|
|
86
|
+
*/
|
|
87
|
+
export interface AgentInfo {
|
|
88
|
+
name: string;
|
|
89
|
+
model: string;
|
|
90
|
+
tools: string[];
|
|
91
|
+
provider: 'anthropic';
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Anthropic extension from OSSA manifest
|
|
95
|
+
*/
|
|
96
|
+
export interface AnthropicExtension {
|
|
97
|
+
enabled?: boolean;
|
|
98
|
+
model?: string;
|
|
99
|
+
system?: string;
|
|
100
|
+
max_tokens?: number;
|
|
101
|
+
temperature?: number;
|
|
102
|
+
tools?: ClaudeTool[];
|
|
103
|
+
streaming?: boolean;
|
|
104
|
+
stop_sequences?: string[];
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Extended OSSA manifest with Anthropic extension
|
|
108
|
+
*/
|
|
109
|
+
export interface OssaManifestWithAnthropic extends OssaAgent {
|
|
110
|
+
extensions?: {
|
|
111
|
+
anthropic?: AnthropicExtension;
|
|
112
|
+
[key: string]: unknown;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/services/runtime/claude/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAE7E;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAC5B,MAAM,GACN,KAAK,CAAC;IACJ,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,aAAa,CAAC;IAC1C,IAAI,CAAC,EAAE,MAAM,C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