@dexto/image-local 1.5.7 → 1.6.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/README.md +43 -171
- package/dist/index.cjs +169 -0
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +4 -24
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +161 -72
- package/package.json +16 -10
package/README.md
CHANGED
|
@@ -1,200 +1,72 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@dexto/image-local`
|
|
2
2
|
|
|
3
|
-
Local development
|
|
3
|
+
Local development image for Dexto.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This package default-exports a typed `DextoImage` (no side effects, no registries). Hosts
|
|
6
|
+
(CLI/server/apps) load the image and resolve config → concrete services via `@dexto/agent-config`.
|
|
6
7
|
|
|
7
|
-
|
|
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
|
|
8
|
+
## What’s included
|
|
14
9
|
|
|
15
|
-
|
|
10
|
+
- **Storage factories**: local filesystem blob store, SQLite database, in-memory cache (plus in-memory alternatives; Postgres/Redis factories are included but require optional deps)
|
|
11
|
+
- **Tool factories**: builtin, filesystem, process, todo, plan, agent-spawner
|
|
12
|
+
- **Hooks**: content-policy, response-sanitizer
|
|
13
|
+
- **Compaction**: reactive-overflow, noop
|
|
14
|
+
- **Logger**: core `defaultLoggerFactory`
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
pnpm add @dexto/image-local @dexto/core @dexto/agent-management
|
|
19
|
-
```
|
|
16
|
+
## CLI usage
|
|
20
17
|
|
|
21
|
-
|
|
18
|
+
Install the image into the Dexto image store, then reference it from YAML:
|
|
22
19
|
|
|
23
|
-
|
|
20
|
+
```bash
|
|
21
|
+
dexto image install @dexto/image-local
|
|
22
|
+
```
|
|
24
23
|
|
|
25
24
|
```yaml
|
|
26
25
|
# agents/my-agent.yml
|
|
26
|
+
image: "@dexto/image-local"
|
|
27
|
+
|
|
27
28
|
systemPrompt:
|
|
28
29
|
contributors:
|
|
29
30
|
- type: static
|
|
30
|
-
content:
|
|
31
|
-
You are a helpful AI assistant with filesystem and process capabilities.
|
|
31
|
+
content: You are a helpful assistant.
|
|
32
32
|
|
|
33
33
|
llm:
|
|
34
34
|
provider: anthropic
|
|
35
35
|
model: claude-sonnet-4-5-20250514
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
customTools:
|
|
37
|
+
tools:
|
|
39
38
|
- type: filesystem-tools
|
|
40
|
-
allowedPaths: [
|
|
41
|
-
blockedPaths: [
|
|
39
|
+
allowedPaths: ["."]
|
|
40
|
+
blockedPaths: [".git", "node_modules"]
|
|
42
41
|
- type: process-tools
|
|
43
42
|
securityLevel: moderate
|
|
44
43
|
```
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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:
|
|
45
|
+
Notes:
|
|
46
|
+
- Omit `tools:` to use `image.defaults.tools`.
|
|
47
|
+
- Storage defaults come from `image.defaults.storage` (override with `storage:` in YAML).
|
|
78
48
|
|
|
79
|
-
|
|
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
|
|
49
|
+
## App usage (direct import)
|
|
84
50
|
|
|
85
|
-
|
|
51
|
+
```ts
|
|
52
|
+
import imageLocal from '@dexto/image-local';
|
|
53
|
+
import { DextoAgent } from '@dexto/core';
|
|
54
|
+
import { loadAgentConfig, enrichAgentConfig } from '@dexto/agent-management';
|
|
55
|
+
import {
|
|
56
|
+
AgentConfigSchema,
|
|
57
|
+
applyImageDefaults,
|
|
58
|
+
resolveServicesFromConfig,
|
|
59
|
+
toDextoAgentOptions,
|
|
60
|
+
} from '@dexto/agent-config';
|
|
86
61
|
|
|
87
|
-
|
|
62
|
+
const configPath = './agents/my-agent.yml';
|
|
63
|
+
const raw = await loadAgentConfig(configPath);
|
|
64
|
+
const withDefaults = applyImageDefaults(raw, imageLocal.defaults);
|
|
65
|
+
const enriched = enrichAgentConfig(withDefaults, configPath);
|
|
88
66
|
|
|
89
|
-
|
|
90
|
-
|
|
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
|
-
```
|
|
67
|
+
const config = AgentConfigSchema.parse(enriched);
|
|
68
|
+
const services = await resolveServicesFromConfig(config, imageLocal);
|
|
109
69
|
|
|
110
|
-
|
|
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
|
-
}
|
|
70
|
+
const agent = new DextoAgent(toDextoAgentOptions({ config, services }));
|
|
71
|
+
await agent.start();
|
|
174
72
|
```
|
|
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.cjs
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var index_exports = {};
|
|
20
|
+
__export(index_exports, {
|
|
21
|
+
default: () => index_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(index_exports);
|
|
24
|
+
var import_agent_config = require("@dexto/agent-config");
|
|
25
|
+
var import_module = require("module");
|
|
26
|
+
var import_zod = require("zod");
|
|
27
|
+
var import_core = require("@dexto/core");
|
|
28
|
+
var import_storage = require("@dexto/storage");
|
|
29
|
+
var import_tools_builtins = require("@dexto/tools-builtins");
|
|
30
|
+
var import_tools_filesystem = require("@dexto/tools-filesystem");
|
|
31
|
+
var import_tools_process = require("@dexto/tools-process");
|
|
32
|
+
var import_tools_todo = require("@dexto/tools-todo");
|
|
33
|
+
var import_tools_plan = require("@dexto/tools-plan");
|
|
34
|
+
var import_tools_scheduler = require("@dexto/tools-scheduler");
|
|
35
|
+
var import_tools_lifecycle = require("@dexto/tools-lifecycle");
|
|
36
|
+
var import_agent_management = require("@dexto/agent-management");
|
|
37
|
+
const import_meta = {};
|
|
38
|
+
const require2 = (0, import_module.createRequire)(import_meta.url);
|
|
39
|
+
const packageJson = require2("../package.json");
|
|
40
|
+
const contentPolicyConfigSchema = import_zod.z.object({
|
|
41
|
+
type: import_zod.z.literal("content-policy"),
|
|
42
|
+
maxInputChars: import_zod.z.number().int().positive().optional(),
|
|
43
|
+
redactEmails: import_zod.z.boolean().optional(),
|
|
44
|
+
redactApiKeys: import_zod.z.boolean().optional()
|
|
45
|
+
}).strict();
|
|
46
|
+
const responseSanitizerConfigSchema = import_zod.z.object({
|
|
47
|
+
type: import_zod.z.literal("response-sanitizer"),
|
|
48
|
+
redactEmails: import_zod.z.boolean().optional(),
|
|
49
|
+
redactApiKeys: import_zod.z.boolean().optional(),
|
|
50
|
+
maxResponseLength: import_zod.z.number().int().positive().optional()
|
|
51
|
+
}).strict();
|
|
52
|
+
const contentPolicyFactory = {
|
|
53
|
+
configSchema: contentPolicyConfigSchema,
|
|
54
|
+
create: (_config) => new import_core.ContentPolicyHook()
|
|
55
|
+
};
|
|
56
|
+
const responseSanitizerFactory = {
|
|
57
|
+
configSchema: responseSanitizerConfigSchema,
|
|
58
|
+
create: (_config) => new import_core.ResponseSanitizerHook()
|
|
59
|
+
};
|
|
60
|
+
const noopCompactionFactory = {
|
|
61
|
+
configSchema: import_agent_config.NoOpCompactionConfigSchema,
|
|
62
|
+
create: (config) => new import_core.NoOpCompactionStrategy({
|
|
63
|
+
enabled: config.enabled,
|
|
64
|
+
maxContextTokens: config.maxContextTokens,
|
|
65
|
+
thresholdPercent: config.thresholdPercent
|
|
66
|
+
})
|
|
67
|
+
};
|
|
68
|
+
const reactiveOverflowCompactionFactory = {
|
|
69
|
+
configSchema: import_agent_config.ReactiveOverflowCompactionConfigSchema,
|
|
70
|
+
create: (config) => new import_core.ReactiveOverflowCompactionStrategy({
|
|
71
|
+
enabled: config.enabled,
|
|
72
|
+
maxContextTokens: config.maxContextTokens,
|
|
73
|
+
thresholdPercent: config.thresholdPercent,
|
|
74
|
+
strategy: {
|
|
75
|
+
preserveLastNTurns: config.preserveLastNTurns,
|
|
76
|
+
maxSummaryTokens: config.maxSummaryTokens,
|
|
77
|
+
...config.summaryPrompt !== void 0 && { summaryPrompt: config.summaryPrompt }
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
};
|
|
81
|
+
const imageLocal = {
|
|
82
|
+
metadata: {
|
|
83
|
+
name: packageJson.name ?? "@dexto/image-local",
|
|
84
|
+
version: packageJson.version ?? "0.0.0",
|
|
85
|
+
description: "Local development image with filesystem and process tools",
|
|
86
|
+
target: "local-development",
|
|
87
|
+
constraints: ["filesystem-required", "offline-capable"]
|
|
88
|
+
},
|
|
89
|
+
defaults: {
|
|
90
|
+
storage: {
|
|
91
|
+
blob: { type: "local", storePath: "./data/blobs" },
|
|
92
|
+
database: { type: "sqlite", path: "./data/agent.db" },
|
|
93
|
+
cache: { type: "in-memory" }
|
|
94
|
+
},
|
|
95
|
+
tools: [
|
|
96
|
+
{ type: "builtin-tools" },
|
|
97
|
+
{ type: "filesystem-tools" },
|
|
98
|
+
{ type: "process-tools" },
|
|
99
|
+
{ type: "todo-tools" },
|
|
100
|
+
{ type: "plan-tools" },
|
|
101
|
+
{ type: "scheduler-tools" },
|
|
102
|
+
{ type: "lifecycle-tools" },
|
|
103
|
+
{ type: "agent-spawner" }
|
|
104
|
+
],
|
|
105
|
+
prompts: [
|
|
106
|
+
{
|
|
107
|
+
type: "inline",
|
|
108
|
+
id: "dexto-plan-mode",
|
|
109
|
+
title: "Plan Mode",
|
|
110
|
+
description: "Internal prompt used by the CLI plan mode toggle. This is injected into the first user message when plan mode is enabled.",
|
|
111
|
+
"user-invocable": false,
|
|
112
|
+
"disable-model-invocation": true,
|
|
113
|
+
prompt: [
|
|
114
|
+
"You are in PLAN MODE.",
|
|
115
|
+
"",
|
|
116
|
+
"Goal: produce a concrete implementation plan before making changes.",
|
|
117
|
+
"",
|
|
118
|
+
"Rules:",
|
|
119
|
+
"- Ask clarifying questions only if required to create a correct plan.",
|
|
120
|
+
"- Write a short, ordered checklist in markdown using `- [ ]` items.",
|
|
121
|
+
"- Do not start implementing until the user approves the plan.",
|
|
122
|
+
"",
|
|
123
|
+
"Plan tools:",
|
|
124
|
+
"- Create a plan: `plan_create`",
|
|
125
|
+
"- Update a plan: `plan_update`",
|
|
126
|
+
"- Read the current plan: `plan_read`",
|
|
127
|
+
"- Request user approval: `plan_review`",
|
|
128
|
+
"",
|
|
129
|
+
"After drafting the plan, call `plan_create` (or `plan_update` if it already exists), then call `plan_review`."
|
|
130
|
+
].join("\n")
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
tools: {
|
|
135
|
+
"builtin-tools": import_tools_builtins.builtinToolsFactory,
|
|
136
|
+
"filesystem-tools": import_tools_filesystem.fileSystemToolsFactory,
|
|
137
|
+
"process-tools": import_tools_process.processToolsFactory,
|
|
138
|
+
"todo-tools": import_tools_todo.todoToolsFactory,
|
|
139
|
+
"plan-tools": import_tools_plan.planToolsFactory,
|
|
140
|
+
"scheduler-tools": import_tools_scheduler.schedulerToolsFactory,
|
|
141
|
+
"lifecycle-tools": import_tools_lifecycle.lifecycleToolsFactory,
|
|
142
|
+
"agent-spawner": import_agent_management.agentSpawnerToolsFactory
|
|
143
|
+
},
|
|
144
|
+
storage: {
|
|
145
|
+
blob: {
|
|
146
|
+
local: import_storage.localBlobStoreFactory,
|
|
147
|
+
"in-memory": import_storage.inMemoryBlobStoreFactory
|
|
148
|
+
},
|
|
149
|
+
database: {
|
|
150
|
+
sqlite: import_storage.sqliteDatabaseFactory,
|
|
151
|
+
postgres: import_storage.postgresDatabaseFactory,
|
|
152
|
+
"in-memory": import_storage.inMemoryDatabaseFactory
|
|
153
|
+
},
|
|
154
|
+
cache: {
|
|
155
|
+
"in-memory": import_storage.inMemoryCacheFactory,
|
|
156
|
+
redis: import_storage.redisCacheFactory
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
hooks: {
|
|
160
|
+
"content-policy": contentPolicyFactory,
|
|
161
|
+
"response-sanitizer": responseSanitizerFactory
|
|
162
|
+
},
|
|
163
|
+
compaction: {
|
|
164
|
+
"reactive-overflow": reactiveOverflowCompactionFactory,
|
|
165
|
+
noop: noopCompactionFactory
|
|
166
|
+
},
|
|
167
|
+
logger: import_core.defaultLoggerFactory
|
|
168
|
+
};
|
|
169
|
+
var index_default = imageLocal;
|
package/dist/index.d.cts
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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';
|
|
1
|
+
import { type DextoImage } from '@dexto/agent-config';
|
|
2
|
+
declare const imageLocal: DextoImage;
|
|
3
|
+
export default imageLocal;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,UAAU,EAOlB,MAAM,qBAAqB,CAAC;AAoF7B,QAAA,MAAM,UAAU,EAAE,UAwFjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,76 +1,165 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
import {
|
|
2
|
+
NoOpCompactionConfigSchema,
|
|
3
|
+
ReactiveOverflowCompactionConfigSchema
|
|
4
|
+
} from "@dexto/agent-config";
|
|
5
|
+
import { createRequire } from "module";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import {
|
|
8
|
+
ContentPolicyHook,
|
|
9
|
+
ResponseSanitizerHook,
|
|
10
|
+
defaultLoggerFactory,
|
|
11
|
+
NoOpCompactionStrategy,
|
|
12
|
+
ReactiveOverflowCompactionStrategy
|
|
13
|
+
} from "@dexto/core";
|
|
14
|
+
import {
|
|
15
|
+
localBlobStoreFactory,
|
|
16
|
+
inMemoryBlobStoreFactory,
|
|
17
|
+
sqliteDatabaseFactory,
|
|
18
|
+
postgresDatabaseFactory,
|
|
19
|
+
inMemoryDatabaseFactory,
|
|
20
|
+
inMemoryCacheFactory,
|
|
21
|
+
redisCacheFactory
|
|
22
|
+
} from "@dexto/storage";
|
|
23
|
+
import { builtinToolsFactory } from "@dexto/tools-builtins";
|
|
24
|
+
import { fileSystemToolsFactory } from "@dexto/tools-filesystem";
|
|
25
|
+
import { processToolsFactory } from "@dexto/tools-process";
|
|
26
|
+
import { todoToolsFactory } from "@dexto/tools-todo";
|
|
27
|
+
import { planToolsFactory } from "@dexto/tools-plan";
|
|
28
|
+
import { schedulerToolsFactory } from "@dexto/tools-scheduler";
|
|
29
|
+
import { lifecycleToolsFactory } from "@dexto/tools-lifecycle";
|
|
30
|
+
import { agentSpawnerToolsFactory } from "@dexto/agent-management";
|
|
31
|
+
const require2 = createRequire(import.meta.url);
|
|
32
|
+
const packageJson = require2("../package.json");
|
|
33
|
+
const contentPolicyConfigSchema = z.object({
|
|
34
|
+
type: z.literal("content-policy"),
|
|
35
|
+
maxInputChars: z.number().int().positive().optional(),
|
|
36
|
+
redactEmails: z.boolean().optional(),
|
|
37
|
+
redactApiKeys: z.boolean().optional()
|
|
38
|
+
}).strict();
|
|
39
|
+
const responseSanitizerConfigSchema = z.object({
|
|
40
|
+
type: z.literal("response-sanitizer"),
|
|
41
|
+
redactEmails: z.boolean().optional(),
|
|
42
|
+
redactApiKeys: z.boolean().optional(),
|
|
43
|
+
maxResponseLength: z.number().int().positive().optional()
|
|
44
|
+
}).strict();
|
|
45
|
+
const contentPolicyFactory = {
|
|
46
|
+
configSchema: contentPolicyConfigSchema,
|
|
47
|
+
create: (_config) => new ContentPolicyHook()
|
|
48
|
+
};
|
|
49
|
+
const responseSanitizerFactory = {
|
|
50
|
+
configSchema: responseSanitizerConfigSchema,
|
|
51
|
+
create: (_config) => new ResponseSanitizerHook()
|
|
52
|
+
};
|
|
53
|
+
const noopCompactionFactory = {
|
|
54
|
+
configSchema: NoOpCompactionConfigSchema,
|
|
55
|
+
create: (config) => new NoOpCompactionStrategy({
|
|
56
|
+
enabled: config.enabled,
|
|
57
|
+
maxContextTokens: config.maxContextTokens,
|
|
58
|
+
thresholdPercent: config.thresholdPercent
|
|
59
|
+
})
|
|
60
|
+
};
|
|
61
|
+
const reactiveOverflowCompactionFactory = {
|
|
62
|
+
configSchema: ReactiveOverflowCompactionConfigSchema,
|
|
63
|
+
create: (config) => new ReactiveOverflowCompactionStrategy({
|
|
64
|
+
enabled: config.enabled,
|
|
65
|
+
maxContextTokens: config.maxContextTokens,
|
|
66
|
+
thresholdPercent: config.thresholdPercent,
|
|
67
|
+
strategy: {
|
|
68
|
+
preserveLastNTurns: config.preserveLastNTurns,
|
|
69
|
+
maxSummaryTokens: config.maxSummaryTokens,
|
|
70
|
+
...config.summaryPrompt !== void 0 && { summaryPrompt: config.summaryPrompt }
|
|
30
71
|
}
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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"
|
|
72
|
+
})
|
|
73
|
+
};
|
|
74
|
+
const imageLocal = {
|
|
75
|
+
metadata: {
|
|
76
|
+
name: packageJson.name ?? "@dexto/image-local",
|
|
77
|
+
version: packageJson.version ?? "0.0.0",
|
|
78
|
+
description: "Local development image with filesystem and process tools",
|
|
79
|
+
target: "local-development",
|
|
80
|
+
constraints: ["filesystem-required", "offline-capable"]
|
|
81
|
+
},
|
|
82
|
+
defaults: {
|
|
83
|
+
storage: {
|
|
84
|
+
blob: { type: "local", storePath: "./data/blobs" },
|
|
85
|
+
database: { type: "sqlite", path: "./data/agent.db" },
|
|
86
|
+
cache: { type: "in-memory" }
|
|
87
|
+
},
|
|
88
|
+
tools: [
|
|
89
|
+
{ type: "builtin-tools" },
|
|
90
|
+
{ type: "filesystem-tools" },
|
|
91
|
+
{ type: "process-tools" },
|
|
92
|
+
{ type: "todo-tools" },
|
|
93
|
+
{ type: "plan-tools" },
|
|
94
|
+
{ type: "scheduler-tools" },
|
|
95
|
+
{ type: "lifecycle-tools" },
|
|
96
|
+
{ type: "agent-spawner" }
|
|
70
97
|
],
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"
|
|
98
|
+
prompts: [
|
|
99
|
+
{
|
|
100
|
+
type: "inline",
|
|
101
|
+
id: "dexto-plan-mode",
|
|
102
|
+
title: "Plan Mode",
|
|
103
|
+
description: "Internal prompt used by the CLI plan mode toggle. This is injected into the first user message when plan mode is enabled.",
|
|
104
|
+
"user-invocable": false,
|
|
105
|
+
"disable-model-invocation": true,
|
|
106
|
+
prompt: [
|
|
107
|
+
"You are in PLAN MODE.",
|
|
108
|
+
"",
|
|
109
|
+
"Goal: produce a concrete implementation plan before making changes.",
|
|
110
|
+
"",
|
|
111
|
+
"Rules:",
|
|
112
|
+
"- Ask clarifying questions only if required to create a correct plan.",
|
|
113
|
+
"- Write a short, ordered checklist in markdown using `- [ ]` items.",
|
|
114
|
+
"- Do not start implementing until the user approves the plan.",
|
|
115
|
+
"",
|
|
116
|
+
"Plan tools:",
|
|
117
|
+
"- Create a plan: `plan_create`",
|
|
118
|
+
"- Update a plan: `plan_update`",
|
|
119
|
+
"- Read the current plan: `plan_read`",
|
|
120
|
+
"- Request user approval: `plan_review`",
|
|
121
|
+
"",
|
|
122
|
+
"After drafting the plan, call `plan_create` (or `plan_update` if it already exists), then call `plan_review`."
|
|
123
|
+
].join("\n")
|
|
124
|
+
}
|
|
75
125
|
]
|
|
126
|
+
},
|
|
127
|
+
tools: {
|
|
128
|
+
"builtin-tools": builtinToolsFactory,
|
|
129
|
+
"filesystem-tools": fileSystemToolsFactory,
|
|
130
|
+
"process-tools": processToolsFactory,
|
|
131
|
+
"todo-tools": todoToolsFactory,
|
|
132
|
+
"plan-tools": planToolsFactory,
|
|
133
|
+
"scheduler-tools": schedulerToolsFactory,
|
|
134
|
+
"lifecycle-tools": lifecycleToolsFactory,
|
|
135
|
+
"agent-spawner": agentSpawnerToolsFactory
|
|
136
|
+
},
|
|
137
|
+
storage: {
|
|
138
|
+
blob: {
|
|
139
|
+
local: localBlobStoreFactory,
|
|
140
|
+
"in-memory": inMemoryBlobStoreFactory
|
|
141
|
+
},
|
|
142
|
+
database: {
|
|
143
|
+
sqlite: sqliteDatabaseFactory,
|
|
144
|
+
postgres: postgresDatabaseFactory,
|
|
145
|
+
"in-memory": inMemoryDatabaseFactory
|
|
146
|
+
},
|
|
147
|
+
cache: {
|
|
148
|
+
"in-memory": inMemoryCacheFactory,
|
|
149
|
+
redis: redisCacheFactory
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
hooks: {
|
|
153
|
+
"content-policy": contentPolicyFactory,
|
|
154
|
+
"response-sanitizer": responseSanitizerFactory
|
|
155
|
+
},
|
|
156
|
+
compaction: {
|
|
157
|
+
"reactive-overflow": reactiveOverflowCompactionFactory,
|
|
158
|
+
noop: noopCompactionFactory
|
|
159
|
+
},
|
|
160
|
+
logger: defaultLoggerFactory
|
|
161
|
+
};
|
|
162
|
+
var index_default = imageLocal;
|
|
163
|
+
export {
|
|
164
|
+
index_default as default
|
|
76
165
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexto/image-local",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Local development base image for Dexto agents with filesystem and process tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,23 +20,29 @@
|
|
|
20
20
|
"process"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"
|
|
24
|
-
"@dexto/
|
|
25
|
-
"@dexto/
|
|
26
|
-
"@dexto/
|
|
27
|
-
"@dexto/
|
|
28
|
-
"@dexto/tools-
|
|
23
|
+
"zod": "^3.25.0",
|
|
24
|
+
"@dexto/agent-config": "1.6.0",
|
|
25
|
+
"@dexto/agent-management": "1.6.0",
|
|
26
|
+
"@dexto/core": "1.6.0",
|
|
27
|
+
"@dexto/storage": "1.6.0",
|
|
28
|
+
"@dexto/tools-builtins": "1.6.0",
|
|
29
|
+
"@dexto/tools-filesystem": "1.6.0",
|
|
30
|
+
"@dexto/tools-lifecycle": "1.6.0",
|
|
31
|
+
"@dexto/tools-plan": "1.6.0",
|
|
32
|
+
"@dexto/tools-process": "1.6.0",
|
|
33
|
+
"@dexto/tools-scheduler": "1.6.0",
|
|
34
|
+
"@dexto/tools-todo": "1.6.0"
|
|
29
35
|
},
|
|
30
36
|
"devDependencies": {
|
|
31
|
-
"
|
|
32
|
-
"
|
|
37
|
+
"tsup": "^8.0.0",
|
|
38
|
+
"typescript": "^5.3.3"
|
|
33
39
|
},
|
|
34
40
|
"files": [
|
|
35
41
|
"dist",
|
|
36
42
|
"README.md"
|
|
37
43
|
],
|
|
38
44
|
"scripts": {
|
|
39
|
-
"build": "
|
|
45
|
+
"build": "tsup",
|
|
40
46
|
"test": "vitest run",
|
|
41
47
|
"test:integ": "vitest run",
|
|
42
48
|
"typecheck": "tsc --noEmit",
|