@intella/sdk 0.0.1 → 0.0.2
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-manager.d.ts +47 -0
- package/dist/agent-manager.d.ts.map +1 -0
- package/dist/agent-manager.js +90 -0
- package/dist/agent-manager.js.map +1 -0
- package/dist/agents/base-agent.d.ts +41 -0
- package/dist/agents/base-agent.d.ts.map +1 -0
- package/dist/agents/base-agent.js +139 -0
- package/dist/agents/base-agent.js.map +1 -0
- package/dist/agents/claude-agent.d.ts +24 -0
- package/dist/agents/claude-agent.d.ts.map +1 -0
- package/dist/agents/claude-agent.js +65 -0
- package/dist/agents/claude-agent.js.map +1 -0
- package/dist/agents/codex-agent.d.ts +25 -0
- package/dist/agents/codex-agent.d.ts.map +1 -0
- package/dist/agents/codex-agent.js +62 -0
- package/dist/agents/codex-agent.js.map +1 -0
- package/dist/agents/intella-lite-agent.d.ts +21 -0
- package/dist/agents/intella-lite-agent.d.ts.map +1 -0
- package/dist/agents/intella-lite-agent.js +43 -0
- package/dist/agents/intella-lite-agent.js.map +1 -0
- package/dist/agents/opencode-agent.d.ts +20 -0
- package/dist/agents/opencode-agent.d.ts.map +1 -0
- package/dist/agents/opencode-agent.js +36 -0
- package/dist/agents/opencode-agent.js.map +1 -0
- package/dist/filesystem/agentfs-provider.d.ts +42 -0
- package/dist/filesystem/agentfs-provider.d.ts.map +1 -0
- package/dist/filesystem/agentfs-provider.js +308 -0
- package/dist/filesystem/agentfs-provider.js.map +1 -0
- package/dist/filesystem/base-provider.d.ts +55 -0
- package/dist/filesystem/base-provider.d.ts.map +1 -0
- package/dist/filesystem/base-provider.js +44 -0
- package/dist/filesystem/base-provider.js.map +1 -0
- package/dist/filesystem/index.d.ts +4 -0
- package/dist/filesystem/index.d.ts.map +1 -0
- package/{src/filesystem/index.ts → dist/filesystem/index.js} +1 -1
- package/dist/filesystem/index.js.map +1 -0
- package/dist/filesystem/memory-provider.d.ts +44 -0
- package/dist/filesystem/memory-provider.d.ts.map +1 -0
- package/dist/filesystem/memory-provider.js +227 -0
- package/dist/filesystem/memory-provider.js.map +1 -0
- package/dist/filesystem-manager.d.ts +75 -0
- package/dist/filesystem-manager.d.ts.map +1 -0
- package/dist/filesystem-manager.js +164 -0
- package/dist/filesystem-manager.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/{src/index.ts → dist/index.js} +3 -46
- package/dist/index.js.map +1 -0
- package/dist/orchestrator.d.ts +32 -0
- package/dist/orchestrator.d.ts.map +1 -0
- package/dist/orchestrator.js +136 -0
- package/dist/orchestrator.js.map +1 -0
- package/dist/sandbox/base-provider.d.ts +106 -0
- package/dist/sandbox/base-provider.d.ts.map +1 -0
- package/dist/sandbox/base-provider.js +73 -0
- package/dist/sandbox/base-provider.js.map +1 -0
- package/dist/sandbox/daytona-provider.d.ts +93 -0
- package/dist/sandbox/daytona-provider.d.ts.map +1 -0
- package/dist/sandbox/daytona-provider.js +378 -0
- package/dist/sandbox/daytona-provider.js.map +1 -0
- package/dist/sandbox/e2b-provider.d.ts +85 -0
- package/dist/sandbox/e2b-provider.d.ts.map +1 -0
- package/dist/sandbox/e2b-provider.js +342 -0
- package/dist/sandbox/e2b-provider.js.map +1 -0
- package/dist/sandbox/modal-provider.d.ts +92 -0
- package/dist/sandbox/modal-provider.d.ts.map +1 -0
- package/dist/sandbox/modal-provider.js +516 -0
- package/dist/sandbox/modal-provider.js.map +1 -0
- package/dist/sandbox-manager.d.ts +59 -0
- package/dist/sandbox-manager.d.ts.map +1 -0
- package/dist/sandbox-manager.js +141 -0
- package/dist/sandbox-manager.js.map +1 -0
- package/dist/sdk.d.ts +173 -0
- package/dist/sdk.d.ts.map +1 -0
- package/dist/sdk.js +273 -0
- package/dist/sdk.js.map +1 -0
- package/dist/types.d.ts +419 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/code-extractor.d.ts +103 -0
- package/dist/utils/code-extractor.d.ts.map +1 -0
- package/dist/utils/code-extractor.js +133 -0
- package/dist/utils/code-extractor.js.map +1 -0
- package/package.json +6 -1
- package/examples/claude-code/README.md +0 -178
- package/examples/claude-code/advanced-config.ts +0 -55
- package/examples/claude-code/basic-usage.ts +0 -56
- package/examples/claude-code/model-comparison.ts +0 -50
- package/examples/claude-code/orchestration.ts +0 -70
- package/examples/claude-code/streaming.ts +0 -69
- package/examples/claude-code/tsconfig.json +0 -19
- package/examples/code-extractor/README.md +0 -77
- package/examples/code-extractor/example.ts +0 -145
- package/examples/filesystem/basic-usage.ts +0 -84
- package/examples/integrated-task/README.md +0 -68
- package/examples/integrated-task/integrated-usage.ts +0 -193
- package/examples/integrated-task/simple-example.ts +0 -51
- package/examples/integrated-task/tsconfig.json +0 -19
- package/examples/sandbox/basic-usage.ts +0 -173
- package/src/agent-manager.ts +0 -104
- package/src/agents/base-agent.ts +0 -166
- package/src/agents/claude-agent.ts +0 -77
- package/src/agents/codex-agent.ts +0 -72
- package/src/agents/intella-lite-agent.ts +0 -55
- package/src/agents/opencode-agent.ts +0 -45
- package/src/filesystem/agentfs-provider.ts +0 -328
- package/src/filesystem/base-provider.ts +0 -98
- package/src/filesystem/memory-provider.ts +0 -267
- package/src/filesystem-manager.ts +0 -213
- package/src/orchestrator.ts +0 -177
- package/src/sandbox/base-provider.ts +0 -184
- package/src/sandbox/daytona-provider.ts +0 -462
- package/src/sandbox/e2b-provider.ts +0 -419
- package/src/sandbox/modal-provider.ts +0 -597
- package/src/sandbox-manager.ts +0 -175
- package/src/sdk.ts +0 -401
- package/src/types.ts +0 -451
- package/src/utils/code-extractor.ts +0 -194
- package/tsconfig.json +0 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intella/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Agent orchestrator SDK for managing tasks across multiple AI agents using AI SDK v6",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -11,9 +11,14 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
14
18
|
"scripts": {
|
|
15
19
|
"build": "tsc",
|
|
16
20
|
"dev": "tsc --watch",
|
|
21
|
+
"prepublishOnly": "pnpm run build",
|
|
17
22
|
"clean": "rm -rf dist",
|
|
18
23
|
"example:basic": "tsx examples/claude-code/basic-usage.ts",
|
|
19
24
|
"example:streaming": "tsx examples/claude-code/streaming.ts",
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
# Claude Code Agent Examples
|
|
2
|
-
|
|
3
|
-
This folder contains examples demonstrating how to use the Claude Code agent through the Intella SDK.
|
|
4
|
-
|
|
5
|
-
## Prerequisites
|
|
6
|
-
|
|
7
|
-
1. **Install dependencies:**
|
|
8
|
-
```bash
|
|
9
|
-
npm install @intella/sdk ai ai-sdk-provider-claude-code
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
2. **Install Claude Code CLI:**
|
|
13
|
-
```bash
|
|
14
|
-
npm install -g @anthropic-ai/claude-code
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
3. **Authenticate:**
|
|
18
|
-
```bash
|
|
19
|
-
claude login
|
|
20
|
-
```
|
|
21
|
-
This will open a browser window for authentication. You need a Claude Pro or Max subscription.
|
|
22
|
-
|
|
23
|
-
## Examples
|
|
24
|
-
|
|
25
|
-
### 1. Basic Usage (`basic-usage.ts`)
|
|
26
|
-
|
|
27
|
-
Demonstrates the simplest way to use the Claude Code agent:
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
npx tsx examples/claude-code/basic-usage.ts
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
**Features:**
|
|
34
|
-
- Basic agent configuration
|
|
35
|
-
- Simple task execution
|
|
36
|
-
- Response handling
|
|
37
|
-
|
|
38
|
-
### 2. Advanced Configuration (`advanced-config.ts`)
|
|
39
|
-
|
|
40
|
-
Shows how to configure the Claude Code agent with advanced options:
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
npx tsx examples/claude-code/advanced-config.ts
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
**Features:**
|
|
47
|
-
- Tool permissions (allowedTools, disallowedTools)
|
|
48
|
-
- Permission modes
|
|
49
|
-
- MCP server configuration
|
|
50
|
-
- Custom working directory
|
|
51
|
-
- Verbose logging
|
|
52
|
-
|
|
53
|
-
### 3. Streaming (`streaming.ts`)
|
|
54
|
-
|
|
55
|
-
Demonstrates streaming responses from the Claude Code agent:
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
npx tsx examples/claude-code/streaming.ts
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
**Features:**
|
|
62
|
-
- Real-time response streaming
|
|
63
|
-
- Chunk-by-chunk output
|
|
64
|
-
- Completion detection
|
|
65
|
-
|
|
66
|
-
### 4. Orchestration (`orchestration.ts`)
|
|
67
|
-
|
|
68
|
-
Shows how to orchestrate multiple agents including Claude Code:
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
npx tsx examples/claude-code/orchestration.ts
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
**Features:**
|
|
75
|
-
- Sequential orchestration (agents work in sequence)
|
|
76
|
-
- Parallel orchestration (agents work simultaneously)
|
|
77
|
-
- Result combination strategies
|
|
78
|
-
|
|
79
|
-
### 5. Model Comparison (`model-comparison.ts`)
|
|
80
|
-
|
|
81
|
-
Compares different Claude models (Opus, Sonnet, Haiku) on the same task:
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
npx tsx examples/claude-code/model-comparison.ts
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
**Features:**
|
|
88
|
-
- Model performance comparison
|
|
89
|
-
- Response time analysis
|
|
90
|
-
- Token usage tracking
|
|
91
|
-
|
|
92
|
-
## Claude Code Models
|
|
93
|
-
|
|
94
|
-
The Claude Code provider supports three model shortcuts:
|
|
95
|
-
|
|
96
|
-
- **`opus`**: Claude Opus - Most capable model, best for complex reasoning
|
|
97
|
-
- **`sonnet`**: Claude Sonnet - Balanced performance and capability (default)
|
|
98
|
-
- **`haiku`**: Claude Haiku - Fastest model, good for simple tasks
|
|
99
|
-
|
|
100
|
-
You can also use full model identifiers:
|
|
101
|
-
- `claude-opus-4-5`
|
|
102
|
-
- `claude-sonnet-4-5-20250929`
|
|
103
|
-
- `claude-haiku-4-5`
|
|
104
|
-
|
|
105
|
-
## Configuration Options
|
|
106
|
-
|
|
107
|
-
### Basic Configuration
|
|
108
|
-
|
|
109
|
-
```typescript
|
|
110
|
-
sdk.configureAgent('claude', {
|
|
111
|
-
model: 'sonnet', // Model shortcut or full ID
|
|
112
|
-
});
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### Advanced Configuration
|
|
116
|
-
|
|
117
|
-
```typescript
|
|
118
|
-
sdk.configureAgent('claude', {
|
|
119
|
-
model: 'opus',
|
|
120
|
-
allowedTools: ['Read', 'Write', 'Edit'],
|
|
121
|
-
disallowedTools: ['Bash'],
|
|
122
|
-
permissionMode: 'default',
|
|
123
|
-
maxTurns: 10,
|
|
124
|
-
cwd: process.cwd(),
|
|
125
|
-
verbose: true,
|
|
126
|
-
});
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
## Tool Permissions
|
|
130
|
-
|
|
131
|
-
Claude Code has built-in tools (Bash, Edit, Read, Write, etc.) that execute autonomously. You can control which tools are available:
|
|
132
|
-
|
|
133
|
-
- **`allowedTools`**: Array of tool names to allow (whitelist)
|
|
134
|
-
- **`disallowedTools`**: Array of tool names to disallow (blacklist)
|
|
135
|
-
- **`permissionMode`**: How to handle tool permissions
|
|
136
|
-
- `'default'`: Standard permission handling
|
|
137
|
-
- `'acceptEdits'`: Automatically accept file edits
|
|
138
|
-
- `'bypassPermissions'`: Skip permission prompts
|
|
139
|
-
- `'plan'`: Show plan before execution
|
|
140
|
-
|
|
141
|
-
## MCP Servers
|
|
142
|
-
|
|
143
|
-
You can configure Model Context Protocol (MCP) servers for extended functionality:
|
|
144
|
-
|
|
145
|
-
```typescript
|
|
146
|
-
sdk.configureAgent('claude', {
|
|
147
|
-
mcpServers: {
|
|
148
|
-
'my-server': {
|
|
149
|
-
command: 'node',
|
|
150
|
-
args: ['server.js'],
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
});
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
## Authentication
|
|
157
|
-
|
|
158
|
-
Claude Code uses CLI authentication. After running `claude login`, your Claude Pro or Max subscription is automatically used. No API keys are needed in your code.
|
|
159
|
-
|
|
160
|
-
## More Information
|
|
161
|
-
|
|
162
|
-
- [Claude Code Provider Documentation](https://ai-sdk.dev/providers/community-providers/claude-code)
|
|
163
|
-
- [Intella SDK Documentation](../../README.md)
|
|
164
|
-
- [Claude Code CLI Documentation](https://github.com/anthropics/claude-code)
|
|
165
|
-
|
|
166
|
-
## Running Examples
|
|
167
|
-
|
|
168
|
-
Make sure you have TypeScript execution support. You can use:
|
|
169
|
-
|
|
170
|
-
- `tsx` (recommended): `npm install -g tsx`
|
|
171
|
-
- `ts-node`: `npm install -g ts-node`
|
|
172
|
-
- Or compile first: `tsc` then `node dist/example.js`
|
|
173
|
-
|
|
174
|
-
Example:
|
|
175
|
-
```bash
|
|
176
|
-
npx tsx examples/claude-code/basic-usage.ts
|
|
177
|
-
```
|
|
178
|
-
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Advanced Claude Code Agent Configuration
|
|
3
|
-
*
|
|
4
|
-
* This example demonstrates advanced configuration options for the Claude Code agent,
|
|
5
|
-
* including tool permissions, MCP servers, and custom settings.
|
|
6
|
-
*
|
|
7
|
-
* Prerequisites:
|
|
8
|
-
* 1. Install dependencies: npm install @intella/sdk ai ai-sdk-provider-claude-code
|
|
9
|
-
* 2. Install Claude Code CLI: npm install -g @anthropic-ai/claude-code
|
|
10
|
-
* 3. Authenticate: claude login
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { IntellaSDK } from '../../src/index';
|
|
14
|
-
|
|
15
|
-
async function main() {
|
|
16
|
-
const sdk = new IntellaSDK();
|
|
17
|
-
|
|
18
|
-
// Select and configure Claude agent with advanced options
|
|
19
|
-
sdk.selectAgent('claude', {
|
|
20
|
-
model: 'opus', // Most capable model
|
|
21
|
-
|
|
22
|
-
// Tool permissions
|
|
23
|
-
allowedTools: ['Read', 'Write', 'Edit'], // Only allow these tools
|
|
24
|
-
disallowedTools: ['Bash'], // Explicitly disallow Bash
|
|
25
|
-
|
|
26
|
-
// Permission mode
|
|
27
|
-
permissionMode: 'default', // Options: 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan'
|
|
28
|
-
|
|
29
|
-
// MCP server configuration (optional)
|
|
30
|
-
// mcpServers: {
|
|
31
|
-
// 'my-server': {
|
|
32
|
-
// command: 'node',
|
|
33
|
-
// args: ['server.js'],
|
|
34
|
-
// },
|
|
35
|
-
// },
|
|
36
|
-
|
|
37
|
-
// Other options
|
|
38
|
-
maxTurns: 10, // Maximum conversation turns
|
|
39
|
-
cwd: process.cwd(), // Working directory
|
|
40
|
-
verbose: true, // Enable debug logging
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
console.log('Claude agent configured with advanced settings\n');
|
|
44
|
-
|
|
45
|
-
// Execute a task that might use tools
|
|
46
|
-
const response = await sdk.executeTask({
|
|
47
|
-
prompt: 'Read the package.json file and summarize the dependencies.',
|
|
48
|
-
systemPrompt: 'You are a helpful coding assistant.',
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
console.log('Response:', response.text);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
main().catch(console.error);
|
|
55
|
-
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Basic Claude Code Agent Usage
|
|
3
|
-
*
|
|
4
|
-
* This example demonstrates basic usage of the Claude Code agent
|
|
5
|
-
* through the Intella SDK.
|
|
6
|
-
*
|
|
7
|
-
* Prerequisites:
|
|
8
|
-
* 1. Install dependencies: npm install @intella/sdk ai ai-sdk-provider-claude-code
|
|
9
|
-
* 2. Install Claude Code CLI: npm install -g @anthropic-ai/claude-code
|
|
10
|
-
* 3. Authenticate: claude login
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { IntellaSDK } from '../../src/index';
|
|
14
|
-
|
|
15
|
-
async function main() {
|
|
16
|
-
const sdk = new IntellaSDK();
|
|
17
|
-
|
|
18
|
-
// Verify default agent before selection
|
|
19
|
-
console.log('Default agent before selection:', sdk.getDefaultAgentType());
|
|
20
|
-
console.log('Available agents:', sdk.listAgents());
|
|
21
|
-
console.log('');
|
|
22
|
-
|
|
23
|
-
// Select and configure Claude agent as default
|
|
24
|
-
// Claude Code uses CLI authentication (claude login)
|
|
25
|
-
sdk.selectAgent('claude', {
|
|
26
|
-
model: 'sonnet', // Options: 'opus', 'sonnet', 'haiku'
|
|
27
|
-
verbose: true, // Enable verbose logging to see Claude Code in action
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// Verify agent selection
|
|
31
|
-
console.log('Default agent after selection:', sdk.getDefaultAgentType());
|
|
32
|
-
console.log('Claude agent config:', sdk.getAgentConfig('claude'));
|
|
33
|
-
console.log('');
|
|
34
|
-
|
|
35
|
-
// Execute a simple task (will use Claude as it's now the default)
|
|
36
|
-
console.log('Executing task with Claude Code agent...\n');
|
|
37
|
-
const response = await sdk.executeTask(
|
|
38
|
-
'Write a brief explanation of quantum computing in 2-3 sentences.'
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
console.log('\n=== Response ===');
|
|
42
|
-
console.log('Agent Type:', response.agentType);
|
|
43
|
-
console.log('Response:', response.text);
|
|
44
|
-
console.log('\n=== Metadata ===');
|
|
45
|
-
console.log(JSON.stringify(response.metadata, null, 2));
|
|
46
|
-
|
|
47
|
-
// Final verification
|
|
48
|
-
if (response.agentType === 'claude') {
|
|
49
|
-
console.log('\n✅ SUCCESS: Claude Code agent was used!');
|
|
50
|
-
} else {
|
|
51
|
-
console.log(`\n❌ WARNING: Expected 'claude' but got '${response.agentType}'`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
main().catch(console.error);
|
|
56
|
-
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Claude Code Model Comparison
|
|
3
|
-
*
|
|
4
|
-
* This example demonstrates using different Claude models (Opus, Sonnet, Haiku)
|
|
5
|
-
* to compare their responses to the same prompt.
|
|
6
|
-
*
|
|
7
|
-
* Prerequisites:
|
|
8
|
-
* 1. Install dependencies: npm install @intella/sdk ai ai-sdk-provider-claude-code
|
|
9
|
-
* 2. Install Claude Code CLI: npm install -g @anthropic-ai/claude-code
|
|
10
|
-
* 3. Authenticate: claude login
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { IntellaSDK } from '../../src/index';
|
|
14
|
-
|
|
15
|
-
async function main() {
|
|
16
|
-
const sdk = new IntellaSDK();
|
|
17
|
-
|
|
18
|
-
const prompt = 'Explain the concept of recursion in programming with a simple example.';
|
|
19
|
-
const models = ['haiku', 'sonnet', 'opus'] as const;
|
|
20
|
-
|
|
21
|
-
console.log('Comparing Claude models on the same prompt...\n');
|
|
22
|
-
console.log('Prompt:', prompt);
|
|
23
|
-
console.log('='.repeat(80) + '\n');
|
|
24
|
-
|
|
25
|
-
for (const model of models) {
|
|
26
|
-
console.log(`\n${model.toUpperCase()} Model:`);
|
|
27
|
-
console.log('-'.repeat(80));
|
|
28
|
-
|
|
29
|
-
// Select agent with specific model
|
|
30
|
-
sdk.selectAgent('claude', { model });
|
|
31
|
-
|
|
32
|
-
const startTime = Date.now();
|
|
33
|
-
const response = await sdk.executeTask(prompt);
|
|
34
|
-
const duration = Date.now() - startTime;
|
|
35
|
-
|
|
36
|
-
console.log(response.text);
|
|
37
|
-
console.log(`\nResponse time: ${duration}ms`);
|
|
38
|
-
console.log(`Tokens: ${response.metadata?.usage?.totalTokens || 'N/A'}`);
|
|
39
|
-
console.log('='.repeat(80));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
console.log('\nComparison complete!');
|
|
43
|
-
console.log('\nModel characteristics:');
|
|
44
|
-
console.log('- Haiku: Fastest, good for simple tasks');
|
|
45
|
-
console.log('- Sonnet: Balanced performance and capability');
|
|
46
|
-
console.log('- Opus: Most capable, best for complex reasoning');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
main().catch(console.error);
|
|
50
|
-
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Multi-Agent Orchestration with Claude Code
|
|
3
|
-
*
|
|
4
|
-
* This example demonstrates orchestrating multiple agents including Claude Code
|
|
5
|
-
* for complex tasks that benefit from multiple AI perspectives.
|
|
6
|
-
*
|
|
7
|
-
* Prerequisites:
|
|
8
|
-
* 1. Install dependencies: npm install @intella/sdk ai ai-sdk-provider-claude-code
|
|
9
|
-
* 2. Install Claude Code CLI: npm install -g @anthropic-ai/claude-code
|
|
10
|
-
* 3. Authenticate: claude login
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { IntellaSDK } from '../../src/index';
|
|
14
|
-
|
|
15
|
-
async function main() {
|
|
16
|
-
const sdk = new IntellaSDK();
|
|
17
|
-
|
|
18
|
-
// Configure multiple agents
|
|
19
|
-
sdk.configureAgent('claude', {
|
|
20
|
-
model: 'sonnet',
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
sdk.configureAgent('intella-lite', {
|
|
24
|
-
apiKey: process.env.OPENAI_API_KEY,
|
|
25
|
-
model: 'gpt-4o-mini',
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
console.log('Orchestrating task across multiple agents...\n');
|
|
29
|
-
|
|
30
|
-
// Sequential orchestration: Claude analyzes, then Intella Lite refines
|
|
31
|
-
const sequentialResult = await sdk.orchestrateTask(
|
|
32
|
-
{
|
|
33
|
-
prompt: 'Analyze the pros and cons of microservices architecture, then create a summary.',
|
|
34
|
-
systemPrompt: 'You are a software architecture expert.',
|
|
35
|
-
},
|
|
36
|
-
['claude', 'intella-lite'],
|
|
37
|
-
'sequential',
|
|
38
|
-
{
|
|
39
|
-
passResults: true, // Pass Claude's analysis to Intella Lite for summarization
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
console.log('Sequential Orchestration Result:');
|
|
44
|
-
console.log('='.repeat(50));
|
|
45
|
-
console.log(sequentialResult.result);
|
|
46
|
-
console.log('\nAgent Responses:');
|
|
47
|
-
sequentialResult.agentResponses.forEach((agentResponse, index) => {
|
|
48
|
-
console.log(`\n${index + 1}. ${agentResponse.agentType}:`);
|
|
49
|
-
console.log(agentResponse.response.substring(0, 200) + '...');
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
console.log('\n\n' + '='.repeat(50) + '\n');
|
|
53
|
-
|
|
54
|
-
// Parallel orchestration: Get multiple perspectives simultaneously
|
|
55
|
-
const parallelResult = await sdk.orchestrateTask(
|
|
56
|
-
'What are the key considerations when choosing a database for a new project?',
|
|
57
|
-
['claude', 'intella-lite'],
|
|
58
|
-
'parallel',
|
|
59
|
-
{
|
|
60
|
-
combineStrategy: 'merge', // Combine all responses
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
console.log('Parallel Orchestration Result:');
|
|
65
|
-
console.log('='.repeat(50));
|
|
66
|
-
console.log(parallelResult.result);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
main().catch(console.error);
|
|
70
|
-
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Streaming with Claude Code Agent
|
|
3
|
-
*
|
|
4
|
-
* This example demonstrates how to stream responses from the Claude Code agent.
|
|
5
|
-
*
|
|
6
|
-
* Prerequisites:
|
|
7
|
-
* 1. Install dependencies: npm install @intella/sdk ai ai-sdk-provider-claude-code
|
|
8
|
-
* 2. Install Claude Code CLI: npm install -g @anthropic-ai/claude-code
|
|
9
|
-
* 3. Authenticate: claude login
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { IntellaSDK, extractCodeBlock } from '../../src/index';
|
|
13
|
-
|
|
14
|
-
async function main() {
|
|
15
|
-
const sdk = new IntellaSDK();
|
|
16
|
-
|
|
17
|
-
// Select and configure Claude agent
|
|
18
|
-
sdk.selectAgent('intella-lite', {
|
|
19
|
-
model: 'gpt-4o-mini',
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
console.log('Streaming response from Claude Code agent...\n');
|
|
23
|
-
|
|
24
|
-
let code = ''
|
|
25
|
-
|
|
26
|
-
let chunks = []
|
|
27
|
-
|
|
28
|
-
// Stream the response
|
|
29
|
-
for await (const chunk of sdk.streamTask(
|
|
30
|
-
'Write a python script to generate ascii art of a cat'
|
|
31
|
-
)) {
|
|
32
|
-
// Write each chunk as it arrives
|
|
33
|
-
process.stdout.write(chunk.text);
|
|
34
|
-
chunks.push(chunk.text);
|
|
35
|
-
|
|
36
|
-
if (chunk.isDone) {
|
|
37
|
-
console.log('\n\nStreaming complete!');
|
|
38
|
-
console.log('Agent Type:', chunk.agentType);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
let response = chunks.join('');
|
|
43
|
-
|
|
44
|
-
console.log('Response:', response);
|
|
45
|
-
|
|
46
|
-
// Extract the code from the response
|
|
47
|
-
|
|
48
|
-
const codeBlock = extractCodeBlock(response, 'python');
|
|
49
|
-
if (!codeBlock) {
|
|
50
|
-
throw new Error('No python code block found');
|
|
51
|
-
}
|
|
52
|
-
code = codeBlock.code;
|
|
53
|
-
|
|
54
|
-
// Execute the code
|
|
55
|
-
|
|
56
|
-
console.log('Code:', code);
|
|
57
|
-
|
|
58
|
-
const sandbox = await sdk.initializeSandbox('e2b', {
|
|
59
|
-
templateId: 'base',
|
|
60
|
-
});
|
|
61
|
-
const result = await sandbox.runCode(code, {
|
|
62
|
-
language: 'python',
|
|
63
|
-
});
|
|
64
|
-
console.log('Result:', result);
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
main().catch(console.error);
|
|
69
|
-
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "./dist",
|
|
5
|
-
"rootDir": "../..",
|
|
6
|
-
"moduleResolution": "node",
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
"types": ["node"],
|
|
10
|
-
"lib": ["ES2020"],
|
|
11
|
-
"baseUrl": "../..",
|
|
12
|
-
"paths": {
|
|
13
|
-
"@intella/sdk": ["./src/index.ts"]
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"include": ["*.ts", "../../src/**/*.ts"],
|
|
17
|
-
"exclude": ["node_modules", "dist"]
|
|
18
|
-
}
|
|
19
|
-
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
# Code Extractor Utility Example
|
|
2
|
-
|
|
3
|
-
This example demonstrates how to use the code extractor utility functions to extract code blocks from LLM responses in markdown format.
|
|
4
|
-
|
|
5
|
-
## Functions
|
|
6
|
-
|
|
7
|
-
### `extractCodeBlocks(text, options?)`
|
|
8
|
-
|
|
9
|
-
Extracts all code blocks from markdown text. Returns an array of `CodeBlock` objects or code strings.
|
|
10
|
-
|
|
11
|
-
**Options:**
|
|
12
|
-
- `languages?: string[]` - Filter by specific language(s) (case-insensitive)
|
|
13
|
-
- `codeOnly?: boolean` - Return only code strings instead of full objects
|
|
14
|
-
- `includeFullMatch?: boolean` - Include the full match including fences
|
|
15
|
-
- `customWrapper?: { start: string; end: string }` - Use custom wrapper strings instead of default ``` markers
|
|
16
|
-
|
|
17
|
-
### `extractCodeBlock(text, language?)`
|
|
18
|
-
|
|
19
|
-
Extracts the first code block from markdown text. Optionally filter by language.
|
|
20
|
-
|
|
21
|
-
### `extractCode(text, language?)`
|
|
22
|
-
|
|
23
|
-
Extracts the code content from the first code block as a string. Optionally filter by language.
|
|
24
|
-
|
|
25
|
-
## Usage Examples
|
|
26
|
-
|
|
27
|
-
```typescript
|
|
28
|
-
import { extractCodeBlocks, extractCodeBlock, extractCode } from '@intella/sdk';
|
|
29
|
-
|
|
30
|
-
const markdown = `
|
|
31
|
-
Here's some code:
|
|
32
|
-
\`\`\`typescript
|
|
33
|
-
const x = 1;
|
|
34
|
-
\`\`\`
|
|
35
|
-
|
|
36
|
-
And a command:
|
|
37
|
-
\`\`\`bash
|
|
38
|
-
npm install
|
|
39
|
-
\`\`\`
|
|
40
|
-
`;
|
|
41
|
-
|
|
42
|
-
// Extract all code blocks
|
|
43
|
-
const blocks = extractCodeBlocks(markdown);
|
|
44
|
-
// Returns: [
|
|
45
|
-
// { language: 'typescript', code: 'const x = 1;' },
|
|
46
|
-
// { language: 'bash', code: 'npm install' }
|
|
47
|
-
// ]
|
|
48
|
-
|
|
49
|
-
// Extract only TypeScript blocks
|
|
50
|
-
const tsBlocks = extractCodeBlocks(markdown, { languages: ['typescript'] });
|
|
51
|
-
|
|
52
|
-
// Extract only code strings
|
|
53
|
-
const codeStrings = extractCodeBlocks(markdown, { codeOnly: true });
|
|
54
|
-
// Returns: ['const x = 1;', 'npm install']
|
|
55
|
-
|
|
56
|
-
// Extract first block
|
|
57
|
-
const firstBlock = extractCodeBlock(markdown);
|
|
58
|
-
// Returns: { language: 'typescript', code: 'const x = 1;' }
|
|
59
|
-
|
|
60
|
-
// Extract code string only
|
|
61
|
-
const code = extractCode(markdown, 'bash');
|
|
62
|
-
// Returns: 'npm install'
|
|
63
|
-
|
|
64
|
-
// Using custom wrapper
|
|
65
|
-
const customMarkdown = '<code>typescript\nconst x = 1;\n</code>';
|
|
66
|
-
const customBlocks = extractCodeBlocks(customMarkdown, {
|
|
67
|
-
customWrapper: { start: '<code>', end: '</code>' }
|
|
68
|
-
});
|
|
69
|
-
// Returns: [{ language: 'typescript', code: 'const x = 1;' }]
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
## Running the Example
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
# From the SDK root directory
|
|
76
|
-
npx tsx examples/code-extractor/example.ts
|
|
77
|
-
```
|