@dexto/image-local 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +44 -0
- package/README.md +200 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +73 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Elastic License 2.0 (ELv2)
|
|
2
|
+
|
|
3
|
+
**Acceptance**
|
|
4
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
5
|
+
|
|
6
|
+
**Copyright License**
|
|
7
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below
|
|
8
|
+
|
|
9
|
+
**Limitations**
|
|
10
|
+
You may not provide the software to third parties as a hosted or managed service, where the service provides users with access to any substantial set of the features or functionality of the software.
|
|
11
|
+
|
|
12
|
+
You may not move, change, disable, or circumvent the license key functionality in the software, and you may not remove or obscure any functionality in the software that is protected by the license key.
|
|
13
|
+
|
|
14
|
+
You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
|
|
15
|
+
|
|
16
|
+
**Patents**
|
|
17
|
+
The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
18
|
+
|
|
19
|
+
**Notices**
|
|
20
|
+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
|
|
21
|
+
|
|
22
|
+
If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
|
|
23
|
+
|
|
24
|
+
**No Other Rights**
|
|
25
|
+
These terms do not imply any licenses other than those expressly granted in these terms.
|
|
26
|
+
|
|
27
|
+
**Termination**
|
|
28
|
+
If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
|
|
29
|
+
|
|
30
|
+
**No Liability**
|
|
31
|
+
As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.
|
|
32
|
+
|
|
33
|
+
**Definitions**
|
|
34
|
+
The _licensor_ is the entity offering these terms, and the _software_ is the software the licensor makes available under these terms, including any portion of it.
|
|
35
|
+
|
|
36
|
+
_you_ refers to the individual or entity agreeing to these terms.
|
|
37
|
+
|
|
38
|
+
_your company_ is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. _control_ means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
39
|
+
|
|
40
|
+
_your licenses_ are all the licenses granted to you for the software under these terms.
|
|
41
|
+
|
|
42
|
+
_use_ means anything you do with the software requiring one of your licenses.
|
|
43
|
+
|
|
44
|
+
_trademark_ means trademarks, service marks, and similar rights.
|
package/README.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# @dexto/image-local
|
|
2
|
+
|
|
3
|
+
Local development base image for Dexto agents with filesystem and process tools.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **SQLite database** - Persistent, local data storage
|
|
8
|
+
- **Local filesystem blob storage** - Store blobs on local disk
|
|
9
|
+
- **In-memory caching** - Fast temporary storage
|
|
10
|
+
- **FileSystem tools** - read, write, edit, glob, grep operations
|
|
11
|
+
- **Process tools** - bash exec, output, kill operations
|
|
12
|
+
- **Offline-capable** - No external dependencies required
|
|
13
|
+
- **Zero configuration** - Sensible defaults for local development
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm add @dexto/image-local @dexto/core @dexto/agent-management
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
### 1. Create Agent Config
|
|
24
|
+
|
|
25
|
+
```yaml
|
|
26
|
+
# agents/my-agent.yml
|
|
27
|
+
systemPrompt:
|
|
28
|
+
contributors:
|
|
29
|
+
- type: static
|
|
30
|
+
content: |
|
|
31
|
+
You are a helpful AI assistant with filesystem and process capabilities.
|
|
32
|
+
|
|
33
|
+
llm:
|
|
34
|
+
provider: anthropic
|
|
35
|
+
model: claude-sonnet-4-5-20250514
|
|
36
|
+
|
|
37
|
+
# Enable filesystem and process tools
|
|
38
|
+
customTools:
|
|
39
|
+
- type: filesystem-tools
|
|
40
|
+
allowedPaths: ['.']
|
|
41
|
+
blockedPaths: ['.git', 'node_modules']
|
|
42
|
+
- type: process-tools
|
|
43
|
+
securityLevel: moderate
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 2. Create Your App
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
// index.ts
|
|
50
|
+
import { createAgent } from '@dexto/image-local';
|
|
51
|
+
import { loadAgentConfig } from '@dexto/agent-management';
|
|
52
|
+
|
|
53
|
+
const config = await loadAgentConfig('./agents/my-agent.yml');
|
|
54
|
+
|
|
55
|
+
// Providers already registered! Just create and use.
|
|
56
|
+
const agent = createAgent(config, './agents/my-agent.yml');
|
|
57
|
+
await agent.start();
|
|
58
|
+
|
|
59
|
+
// Agent now has filesystem and process tools available
|
|
60
|
+
const response = await agent.run('List the files in the current directory');
|
|
61
|
+
console.log(response.content);
|
|
62
|
+
|
|
63
|
+
await agent.shutdown();
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Important**: When using an image, only import from the image package (`@dexto/image-local`). Do not import from `@dexto/core` directly - the image provides everything you need.
|
|
67
|
+
|
|
68
|
+
## What's Included
|
|
69
|
+
|
|
70
|
+
### Registered Providers
|
|
71
|
+
|
|
72
|
+
- **Blob Storage**: `local`, `in-memory`
|
|
73
|
+
- **Custom Tools**: `filesystem-tools`, `process-tools`
|
|
74
|
+
|
|
75
|
+
### FileSystem Tools
|
|
76
|
+
|
|
77
|
+
When `filesystem-tools` is enabled in your config:
|
|
78
|
+
|
|
79
|
+
- `read_file` - Read file contents with pagination
|
|
80
|
+
- `write_file` - Write or overwrite files
|
|
81
|
+
- `edit_file` - Edit files with search/replace operations
|
|
82
|
+
- `glob_files` - Find files matching glob patterns
|
|
83
|
+
- `grep_content` - Search file contents using regex
|
|
84
|
+
|
|
85
|
+
### Process Tools
|
|
86
|
+
|
|
87
|
+
When `process-tools` is enabled in your config:
|
|
88
|
+
|
|
89
|
+
- `bash_exec` - Execute bash commands (foreground or background)
|
|
90
|
+
- `bash_output` - Retrieve output from background processes
|
|
91
|
+
- `kill_process` - Terminate background processes
|
|
92
|
+
|
|
93
|
+
## Configuration
|
|
94
|
+
|
|
95
|
+
### FileSystem Tools Config
|
|
96
|
+
|
|
97
|
+
```yaml
|
|
98
|
+
customTools:
|
|
99
|
+
- type: filesystem-tools
|
|
100
|
+
allowedPaths: ['.', '/tmp']
|
|
101
|
+
blockedPaths: ['.git', 'node_modules', '.env']
|
|
102
|
+
blockedExtensions: ['.exe', '.dll']
|
|
103
|
+
maxFileSize: 10485760 # 10MB
|
|
104
|
+
workingDirectory: /path/to/project
|
|
105
|
+
enableBackups: true
|
|
106
|
+
backupPath: ./backups
|
|
107
|
+
backupRetentionDays: 7
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Process Tools Config
|
|
111
|
+
|
|
112
|
+
```yaml
|
|
113
|
+
customTools:
|
|
114
|
+
- type: process-tools
|
|
115
|
+
securityLevel: moderate # strict | moderate | permissive
|
|
116
|
+
workingDirectory: /path/to/project
|
|
117
|
+
maxTimeout: 30000 # milliseconds
|
|
118
|
+
maxConcurrentProcesses: 5
|
|
119
|
+
maxOutputBuffer: 1048576 # 1MB
|
|
120
|
+
allowedCommands: ['ls', 'cat', 'grep'] # strict mode only
|
|
121
|
+
blockedCommands: ['rm -rf', 'sudo']
|
|
122
|
+
environment:
|
|
123
|
+
MY_VAR: value
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Architecture
|
|
127
|
+
|
|
128
|
+
### On-Demand Service Initialization
|
|
129
|
+
|
|
130
|
+
Services are initialized only when needed:
|
|
131
|
+
|
|
132
|
+
- **FileSystemService** is created when `filesystem-tools` provider is used
|
|
133
|
+
- **ProcessService** is created when `process-tools` provider is used
|
|
134
|
+
- No overhead if tools aren't configured
|
|
135
|
+
|
|
136
|
+
### Provider Registration
|
|
137
|
+
|
|
138
|
+
The image uses **side-effect registration** - providers are registered automatically when you import from the package:
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
import { createAgent } from '@dexto/image-local';
|
|
142
|
+
// Providers registered as side-effect! ✓
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
All exports from the image (`createAgent`, registries, etc.) trigger provider registration on first import.
|
|
146
|
+
|
|
147
|
+
## Default Configuration
|
|
148
|
+
|
|
149
|
+
The image provides sensible defaults:
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
{
|
|
153
|
+
storage: {
|
|
154
|
+
blob: { type: 'local', storePath: './data/blobs' },
|
|
155
|
+
database: { type: 'sqlite', path: './data/agent.db' },
|
|
156
|
+
cache: { type: 'in-memory' }
|
|
157
|
+
},
|
|
158
|
+
logging: {
|
|
159
|
+
level: 'info',
|
|
160
|
+
fileLogging: true
|
|
161
|
+
},
|
|
162
|
+
customTools: [
|
|
163
|
+
{
|
|
164
|
+
type: 'filesystem-tools',
|
|
165
|
+
allowedPaths: ['.'],
|
|
166
|
+
blockedPaths: ['.git', 'node_modules/.bin', '.env']
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
type: 'process-tools',
|
|
170
|
+
securityLevel: 'moderate'
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Security
|
|
177
|
+
|
|
178
|
+
### FileSystem Tools
|
|
179
|
+
|
|
180
|
+
- Path validation prevents directory traversal
|
|
181
|
+
- Blocked paths and extensions prevent access to sensitive files
|
|
182
|
+
- File size limits prevent memory exhaustion
|
|
183
|
+
- Optional backups protect against data loss
|
|
184
|
+
|
|
185
|
+
### Process Tools
|
|
186
|
+
|
|
187
|
+
- Command validation blocks dangerous patterns
|
|
188
|
+
- Injection detection prevents command injection
|
|
189
|
+
- Configurable security levels (strict/moderate/permissive)
|
|
190
|
+
- Process limits prevent resource exhaustion
|
|
191
|
+
|
|
192
|
+
## See Also
|
|
193
|
+
|
|
194
|
+
- [@dexto/core](../core) - Core agent framework
|
|
195
|
+
- [@dexto/bundler](../bundler) - Image bundler
|
|
196
|
+
- [Image Tutorial](../../docs/docs/tutorials/images/) - Learn about images
|
|
197
|
+
|
|
198
|
+
## License
|
|
199
|
+
|
|
200
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// AUTO-GENERATED TypeScript definitions
|
|
2
|
+
// Do not edit this file directly
|
|
3
|
+
|
|
4
|
+
import type { DextoAgent, AgentConfig, ImageMetadata } from '@dexto/core';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Create a Dexto agent using this image's registered providers.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createAgent(config: AgentConfig, configPath?: string): DextoAgent;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Image metadata
|
|
13
|
+
*/
|
|
14
|
+
export declare const imageMetadata: ImageMetadata;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Re-exported registries for runtime customization
|
|
18
|
+
*/
|
|
19
|
+
export {
|
|
20
|
+
customToolRegistry,
|
|
21
|
+
pluginRegistry,
|
|
22
|
+
compactionRegistry,
|
|
23
|
+
blobStoreRegistry,
|
|
24
|
+
} from '@dexto/core';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// AUTO-GENERATED by @dexto/bundler
|
|
2
|
+
// Do not edit this file directly. Edit dexto.image.ts instead.
|
|
3
|
+
|
|
4
|
+
import { DextoAgent } from '@dexto/core';
|
|
5
|
+
import { customToolRegistry, pluginRegistry, compactionRegistry, blobStoreRegistry } from '@dexto/core';
|
|
6
|
+
|
|
7
|
+
// SIDE EFFECT: Register providers on import
|
|
8
|
+
|
|
9
|
+
// Register blobStore via custom function (from dexto.image.ts)
|
|
10
|
+
await (async () => {
|
|
11
|
+
try {
|
|
12
|
+
const{localBlobStoreProvider,inMemoryBlobStoreProvider}=await import("@dexto/core").then(s=>{const e="default";return s[e]&&typeof s[e]=="object"&&"__esModule"in s[e]?s[e]:s});const{blobStoreRegistry}=await import("@dexto/core").then(s=>{const e="default";return s[e]&&typeof s[e]=="object"&&"__esModule"in s[e]?s[e]:s});blobStoreRegistry.register(localBlobStoreProvider);blobStoreRegistry.register(inMemoryBlobStoreProvider);console.log("\u2713 Registered blob storage providers: local, in-memory")
|
|
13
|
+
} catch (err) {
|
|
14
|
+
// Ignore duplicate registration errors
|
|
15
|
+
if (!err.message?.includes('already registered')) {
|
|
16
|
+
throw err;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
})();
|
|
20
|
+
|
|
21
|
+
// Register customTools via custom function (from dexto.image.ts)
|
|
22
|
+
await (async () => {
|
|
23
|
+
try {
|
|
24
|
+
const{fileSystemToolsProvider}=await import("@dexto/tools-filesystem").then(s=>{const e="default";return s[e]&&typeof s[e]=="object"&&"__esModule"in s[e]?s[e]:s});const{processToolsProvider}=await import("@dexto/tools-process").then(s=>{const e="default";return s[e]&&typeof s[e]=="object"&&"__esModule"in s[e]?s[e]:s});const{customToolRegistry}=await import("@dexto/core").then(s=>{const e="default";return s[e]&&typeof s[e]=="object"&&"__esModule"in s[e]?s[e]:s});customToolRegistry.register(fileSystemToolsProvider);customToolRegistry.register(processToolsProvider);console.log("\u2713 Registered tool providers: filesystem-tools, process-tools")
|
|
25
|
+
} catch (err) {
|
|
26
|
+
// Ignore duplicate registration errors
|
|
27
|
+
if (!err.message?.includes('already registered')) {
|
|
28
|
+
throw err;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
})();
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Create a Dexto agent using this image's registered providers.
|
|
36
|
+
*
|
|
37
|
+
* @param config - Agent configuration
|
|
38
|
+
* @param configPath - Optional path to config file
|
|
39
|
+
* @returns DextoAgent instance with providers already registered
|
|
40
|
+
*/
|
|
41
|
+
export function createAgent(config, configPath) {
|
|
42
|
+
return new DextoAgent(config, configPath);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Re-export registries for runtime customization.
|
|
47
|
+
* This allows apps to add custom providers without depending on @dexto/core directly.
|
|
48
|
+
*/
|
|
49
|
+
export {
|
|
50
|
+
customToolRegistry,
|
|
51
|
+
pluginRegistry,
|
|
52
|
+
compactionRegistry,
|
|
53
|
+
blobStoreRegistry,
|
|
54
|
+
} from '@dexto/core';
|
|
55
|
+
|
|
56
|
+
// No utilities or exports defined for this image
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Image metadata
|
|
60
|
+
* Generated at build time
|
|
61
|
+
*/
|
|
62
|
+
export const imageMetadata = {
|
|
63
|
+
"name": "image-local",
|
|
64
|
+
"version": "1.0.0",
|
|
65
|
+
"description": "Local development image with filesystem and process tools",
|
|
66
|
+
"target": "local-development",
|
|
67
|
+
"constraints": [
|
|
68
|
+
"filesystem-required",
|
|
69
|
+
"offline-capable"
|
|
70
|
+
],
|
|
71
|
+
"builtAt": "2026-01-14T09:09:40.678Z",
|
|
72
|
+
"coreVersion": "1.5.0"
|
|
73
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dexto/image-local",
|
|
3
|
+
"version": "1.5.0",
|
|
4
|
+
"description": "Local development base image for Dexto agents with filesystem and process tools",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"dexto",
|
|
16
|
+
"image",
|
|
17
|
+
"local-development",
|
|
18
|
+
"base-image",
|
|
19
|
+
"filesystem",
|
|
20
|
+
"process"
|
|
21
|
+
],
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@dexto/core": "1.5.0",
|
|
24
|
+
"@dexto/tools-filesystem": "1.5.0",
|
|
25
|
+
"@dexto/tools-process": "1.5.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"typescript": "^5.3.3",
|
|
29
|
+
"@dexto/image-bundler": "1.5.0"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"README.md"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsx ../image-bundler/dist/cli.js build",
|
|
37
|
+
"test": "vitest run",
|
|
38
|
+
"test:integ": "vitest run",
|
|
39
|
+
"typecheck": "tsc --noEmit",
|
|
40
|
+
"clean": "rm -rf dist"
|
|
41
|
+
}
|
|
42
|
+
}
|