@robota-sdk/agent-sdk 3.0.0-beta.59 → 3.0.0-beta.60
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 +8 -21
- package/dist/node/index.cjs +1690 -898
- package/dist/node/index.d.cts +738 -246
- package/dist/node/index.d.ts +738 -246
- package/dist/node/index.js +1487 -805
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -32,18 +32,18 @@ const response = await query('Analyze the code', {
|
|
|
32
32
|
## Features
|
|
33
33
|
|
|
34
34
|
- **InteractiveSession** — Event-driven session wrapper (composition over Session). Central client-facing API for CLI, web, API server, or any other client
|
|
35
|
-
- **SystemCommandExecutor + ISystemCommand** — SDK-level command execution
|
|
35
|
+
- **SystemCommandExecutor + ISystemCommand** — SDK-level command execution infrastructure for product-composed command modules
|
|
36
36
|
- **CommandRegistry, BuiltinCommandSource, SkillCommandSource** — Slash command registry and discovery (owned by SDK; agent-cli re-exports `CommandRegistry` from here)
|
|
37
37
|
- **query()** — Single entry point for one-shot AI agent interactions with streaming support
|
|
38
38
|
- **createSession()** — Assembly factory: wires tools, provider, config, and context into a Session
|
|
39
|
-
- **Built-in Tools** — Bash, Read, Write, Edit, Glob, Grep
|
|
39
|
+
- **Built-in Tools** — Bash, Read, Write, Edit, Glob, Grep, WebFetch, WebSearch are assembled for sessions; six local file/process/search exports are re-exported from `@robota-sdk/agent-tools`
|
|
40
40
|
- **Agent Tool** — Sub-agent session creation for multi-agent workflows
|
|
41
41
|
- **Permissions** — 3-step evaluation (deny list, allow list, mode policy) with four modes: `plan`, `default`, `acceptEdits`, `bypassPermissions`
|
|
42
42
|
- **Hooks** — `PreToolUse`, `PostToolUse`, `PreCompact`, `PostCompact`, `SessionStart`, `UserPromptSubmit`, `Stop` events with shell command execution
|
|
43
43
|
- **Streaming** — Real-time text delta callbacks via `onTextDelta`
|
|
44
44
|
- **Context Loading** — AGENTS.md / CLAUDE.md walk-up discovery and system prompt assembly
|
|
45
45
|
- **Config Loading** — 6-file settings merge with provider profiles, legacy provider compatibility, and `$ENV:VAR` substitution for provider API keys
|
|
46
|
-
- **Context Window Management** — Token tracking, auto-compaction
|
|
46
|
+
- **Context Window Management** — Token tracking, configurable auto-compaction (default ~83.5%), manual `session.compact()`
|
|
47
47
|
- **Background Jobs** — Runtime-managed subagent tasks with transcripts and task snapshots
|
|
48
48
|
- **Agent Batch Jobs** — `Agent({ jobs: [...] })` starts explicit parallel subagent requests deterministically
|
|
49
49
|
- **Edit Checkpoints** — Checkpoint/rewind support for safer edit workflows
|
|
@@ -167,13 +167,12 @@ session.getSession(); // Session
|
|
|
167
167
|
import { SystemCommandExecutor, createSystemCommands } from '@robota-sdk/agent-sdk';
|
|
168
168
|
import type { ICommandResult } from '@robota-sdk/agent-sdk';
|
|
169
169
|
|
|
170
|
-
const executor = new SystemCommandExecutor(); //
|
|
170
|
+
const executor = new SystemCommandExecutor(); // starts empty unless commands are supplied
|
|
171
171
|
|
|
172
172
|
// Execute a command
|
|
173
|
-
const result: ICommandResult | null = await executor.execute('
|
|
173
|
+
const result: ICommandResult | null = await executor.execute('status', session, '');
|
|
174
174
|
if (result) {
|
|
175
|
-
console.log(result.message); // "
|
|
176
|
-
console.log(result.data); // { usedTokens, maxTokens, percentage }
|
|
175
|
+
console.log(result.message); // "OK"
|
|
177
176
|
}
|
|
178
177
|
|
|
179
178
|
// Register a custom command
|
|
@@ -188,20 +187,7 @@ executor.listCommands(); // ISystemCommand[]
|
|
|
188
187
|
executor.hasCommand('mode'); // boolean
|
|
189
188
|
```
|
|
190
189
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
| Command | Description |
|
|
194
|
-
| ------------- | ------------------------------------------------------- |
|
|
195
|
-
| `help` | Show available commands |
|
|
196
|
-
| `clear` | Clear conversation history |
|
|
197
|
-
| `compact` | Compress context window (optional focus instructions) |
|
|
198
|
-
| `mode [m]` | Show or change permission mode |
|
|
199
|
-
| `model <id>` | Change AI model |
|
|
200
|
-
| `language` | Set response language (ko, en, ja, zh) |
|
|
201
|
-
| `cost` | Show session info (session ID, message count) |
|
|
202
|
-
| `context` | Context window token usage |
|
|
203
|
-
| `permissions` | Show current permission mode and session-approved tools |
|
|
204
|
-
| `reset` | Delete settings (caller handles file I/O and exit) |
|
|
190
|
+
Product built-ins are supplied as `agent-command-*` modules. For example, `/help` is owned by `@robota-sdk/agent-command-help`, while `/compact` is owned by `@robota-sdk/agent-command-compact`.
|
|
205
191
|
|
|
206
192
|
### CommandRegistry, BuiltinCommandSource, SkillCommandSource
|
|
207
193
|
|
|
@@ -242,6 +228,7 @@ const response = await query('Analyze the code', {
|
|
|
242
228
|
cwd: '/path/to/project',
|
|
243
229
|
permissionMode: 'acceptEdits',
|
|
244
230
|
maxTurns: 10,
|
|
231
|
+
autoCompactThreshold: 0.75,
|
|
245
232
|
onTextDelta: (delta) => process.stdout.write(delta),
|
|
246
233
|
onCompact: () => console.log('Context compacted'),
|
|
247
234
|
});
|