@robota-sdk/agent-sdk 3.0.0-beta.32 → 3.0.0-beta.34

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.
Files changed (2) hide show
  1. package/README.md +166 -19
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # @robota-sdk/agent-sdk
2
2
 
3
- Programmatic SDK for building AI agents with Robota. Provides a single `query()` entry point along with Session management, built-in tools, permissions, hooks, streaming, and context loading.
3
+ Programmatic SDK for building AI agents with Robota. Provides a single `query()` entry point along with session management, built-in tools, permissions, hooks, streaming, and context loading.
4
4
 
5
- This is the **assembly layer** of the Robota ecosystem -- it composes lower-level packages (`agent-core`, `agent-tools`, `agent-sessions`) into a cohesive SDK.
5
+ This is the **assembly layer** of the Robota ecosystem it composes lower-level packages (`agent-core`, `agent-tools`, `agent-sessions`, `agent-provider-anthropic`) into a cohesive SDK.
6
+
7
+ **Version**: 3.0.0-beta.33
6
8
 
7
9
  ## Installation
8
10
 
@@ -31,39 +33,184 @@ const response = await query('Analyze the code', {
31
33
 
32
34
  ## Features
33
35
 
34
- - **query()** -- Single entry point for AI agent interactions with streaming support
35
- - **Session** -- Wraps the Robota engine with permission checks, tool wiring, history, and streaming
36
- - **Built-in Tools** -- Bash, Read, Write, Edit, Glob, Grep (from `@robota-sdk/agent-tools`)
37
- - **Agent Tool** -- Sub-agent session creation for multi-agent workflows
38
- - **Permissions** -- 3-step evaluation (deny list, allow list, mode policy) with four modes: `plan`, `default`, `acceptEdits`, `bypassPermissions`
39
- - **Hooks** -- `PreToolUse`, `PostToolUse`, `SessionStart`, `Stop` events with shell command execution
40
- - **Streaming** -- Real-time text delta callbacks via `onTextDelta`
41
- - **Context Loading** -- AGENTS.md / CLAUDE.md walk-up discovery and system prompt assembly
42
- - **Config Loading** -- 3-layer merge (user global, project, local) with `$ENV:VAR` substitution
43
- - **Context Window Management** -- Token tracking, auto-compaction at ~83.5%, manual `session.compact()`
36
+ - **query()** Single entry point for AI agent interactions with streaming support
37
+ - **createSession()** Assembly factory: wires tools, provider, config, and context into a Session
38
+ - **Built-in Tools** Bash, Read, Write, Edit, Glob, Grep (re-exported from `@robota-sdk/agent-tools`)
39
+ - **Agent Tool** Sub-agent session creation for multi-agent workflows
40
+ - **Permissions** 3-step evaluation (deny list, allow list, mode policy) with four modes: `plan`, `default`, `acceptEdits`, `bypassPermissions`
41
+ - **Hooks** `PreToolUse`, `PostToolUse`, `PreCompact`, `PostCompact`, `SessionStart`, `UserPromptSubmit`, `Stop` events with shell command execution
42
+ - **Streaming** Real-time text delta callbacks via `onTextDelta`
43
+ - **Context Loading** AGENTS.md / CLAUDE.md walk-up discovery and system prompt assembly
44
+ - **Config Loading** 6-layer merge (CLI flags, local, project, Claude Code compat, user global, user global Claude Code compat) with `$ENV:VAR` substitution
45
+ - **Context Window Management** Token tracking, auto-compaction at ~83.5%, manual `session.compact()`
46
+ - **Bundle Plugin System** — Install and manage reusable extensions packaged as bundle plugins
44
47
 
45
48
  ## Architecture
46
49
 
47
50
  ```
48
51
  agent-sdk (assembly layer)
49
52
  -> agent-sessions (Session, SessionStore)
50
- -> agent-tools (tool infrastructure + 6 built-in tools)
53
+ -> agent-tools (tool infrastructure + 8 built-in tools)
54
+ -> agent-provider-anthropic (Anthropic LLM provider)
51
55
  -> agent-core (Robota engine, providers, permissions, hooks)
52
56
  ```
53
57
 
54
- `agent-sdk` assembles existing packages -- it does not re-implement functionality that belongs in lower layers.
58
+ `agent-sdk` assembles existing packages it does not re-implement functionality that belongs in lower layers.
59
+
60
+ ## API
55
61
 
56
- ## Session Usage
62
+ ### query()
57
63
 
58
64
  ```typescript
59
- import { Session } from '@robota-sdk/agent-sessions';
65
+ import { query } from '@robota-sdk/agent-sdk';
66
+
67
+ const response = await query('Show me the file list');
60
68
 
61
- const session = new Session({ config, context, terminal, permissionMode });
69
+ const response = await query('Analyze the code', {
70
+ cwd: '/path/to/project',
71
+ permissionMode: 'acceptEdits',
72
+ maxTurns: 10,
73
+ onTextDelta: (delta) => process.stdout.write(delta),
74
+ onCompact: () => console.log('Context compacted'),
75
+ });
76
+ ```
77
+
78
+ ### createSession()
79
+
80
+ ```typescript
81
+ import { createSession, loadConfig, loadContext, detectProject } from '@robota-sdk/agent-sdk';
82
+
83
+ const [config, context, projectInfo] = await Promise.all([
84
+ loadConfig(cwd),
85
+ loadContext(cwd),
86
+ detectProject(cwd),
87
+ ]);
88
+
89
+ const session = createSession({ config, context, terminal, projectInfo, permissionMode });
62
90
  const response = await session.run('Hello');
63
- session.getHistory();
64
- session.clearHistory();
65
91
  ```
66
92
 
93
+ ### Built-in Tools
94
+
95
+ `@robota-sdk/agent-sdk` re-exports 6 of the 8 built-in tools from `@robota-sdk/agent-tools`:
96
+
97
+ ```typescript
98
+ import { bashTool, readTool, writeTool, editTool, globTool, grepTool } from '@robota-sdk/agent-sdk';
99
+ ```
100
+
101
+ `webFetchTool` and `webSearchTool` are **not** re-exported from `@robota-sdk/agent-sdk`. Import them directly from the owning package:
102
+
103
+ ```typescript
104
+ import { webFetchTool, webSearchTool } from '@robota-sdk/agent-tools';
105
+ ```
106
+
107
+ ## Subagent Sessions
108
+
109
+ `createSubagentSession()` creates an isolated child session for delegating subtasks. The subagent receives pre-resolved config and context from the parent — it does not load config files or context from disk.
110
+
111
+ ```typescript
112
+ import { createSubagentSession } from '@robota-sdk/agent-sdk';
113
+
114
+ const subSession = createSubagentSession({
115
+ parentSession: session,
116
+ agentDefinition: 'explore',
117
+ prompt: 'Analyze the test coverage gaps',
118
+ });
119
+ const result = await subSession.run();
120
+ ```
121
+
122
+ ### Agent Definitions
123
+
124
+ `IAgentDefinition` describes a reusable agent configuration (system prompt, allowed tools, permission mode). Custom agents are discovered from `.robota/agents/` (project), `.claude/agents/` (Claude Code compatible), and `~/.robota/agents/` (user). `AgentDefinitionLoader` is an internal class — it is not part of the public API.
125
+
126
+ Built-in agents: `general-purpose` (full tool access), `Explore` (read-only, Haiku model), `Plan` (read-only planning).
127
+
128
+ ### createAgentTool()
129
+
130
+ `createAgentTool()` wraps subagent creation into a tool the AI can invoke directly. The parent session's hooks, permissions, and context are forwarded to the child.
131
+
132
+ ## Hook Executors (SDK-Specific)
133
+
134
+ `agent-sdk` provides two `IHookTypeExecutor` implementations beyond the `command` and `http` executors in `agent-core`:
135
+
136
+ | Executor | Hook Type | Description |
137
+ | ---------------- | --------- | ------------------------------------------------------------------------- |
138
+ | `PromptExecutor` | `prompt` | Injects the hook's prompt text into the session as a system instruction |
139
+ | `AgentExecutor` | `agent` | Creates a sub-agent session to process the hook input and return a result |
140
+
141
+ ## Bundle Plugin System
142
+
143
+ Bundle plugins package reusable extensions (tools, hooks, permissions, system prompt additions) into installable units.
144
+
145
+ ### Types
146
+
147
+ | Type | Description |
148
+ | ----------------------- | --------------------------------------------------------------- |
149
+ | `IBundlePluginManifest` | Plugin metadata: name, version, description, author, keywords |
150
+ | `ILoadedBundlePlugin` | Full bundle: manifest + tools, hooks, permissions, systemPrompt |
151
+
152
+ ### BundlePluginLoader
153
+
154
+ Loads a bundle plugin from a directory path. Reads the manifest, resolves tool/hook definitions, and validates the bundle structure.
155
+
156
+ ### BundlePluginInstaller
157
+
158
+ Manages plugin installation and uninstallation:
159
+
160
+ - Installs bundles to `~/.robota/plugins/` (user) or `.robota/plugins/` (project)
161
+ - Tracks installed plugins in a registry file
162
+ - Handles enable/disable state per plugin
163
+
164
+ ## Configuration
165
+
166
+ Settings are loaded from (highest priority first):
167
+
168
+ | Layer | Path | Scope |
169
+ | ----- | --------------------------------- | ------------------------------------ |
170
+ | 1 | CLI flags / environment variables | Invocation |
171
+ | 2 | `.robota/settings.local.json` | Project (local) |
172
+ | 3 | `.robota/settings.json` | Project |
173
+ | 4 | `.claude/settings.json` | Project (Claude Code compatible) |
174
+ | 5 | `~/.robota/settings.json` | User global |
175
+ | 6 | `~/.claude/settings.json` | User global (Claude Code compatible) |
176
+
177
+ `$ENV:VAR` substitution is applied after merge.
178
+
179
+ ```json
180
+ {
181
+ "defaultMode": "default",
182
+ "provider": {
183
+ "name": "anthropic",
184
+ "model": "claude-sonnet-4-6",
185
+ "apiKey": "$ENV:ANTHROPIC_API_KEY"
186
+ },
187
+ "permissions": {
188
+ "allow": ["Bash(pnpm *)"],
189
+ "deny": ["Bash(rm -rf *)"]
190
+ }
191
+ }
192
+ ```
193
+
194
+ ## Permission Modes
195
+
196
+ | Mode | Read/Glob/Grep | Write/Edit | Bash |
197
+ | ------------------- | :------------: | :--------: | :-----: |
198
+ | `plan` | auto | deny | deny |
199
+ | `default` | auto | approve | approve |
200
+ | `acceptEdits` | auto | auto | approve |
201
+ | `bypassPermissions` | auto | auto | auto |
202
+
203
+ ## Dependencies
204
+
205
+ | Package | Purpose |
206
+ | -------------------------------------- | ------------------------------------- |
207
+ | `@robota-sdk/agent-core` | Engine, providers, permissions, hooks |
208
+ | `@robota-sdk/agent-sessions` | Session, SessionStore |
209
+ | `@robota-sdk/agent-tools` | Tool infrastructure + built-in tools |
210
+ | `@robota-sdk/agent-provider-anthropic` | Anthropic LLM provider |
211
+ | `chalk` | Terminal colors (permission prompt) |
212
+ | `zod` | Settings schema validation |
213
+
67
214
  ## Documentation
68
215
 
69
216
  See [docs/SPEC.md](./docs/SPEC.md) for the full specification, architecture details, and design decisions.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robota-sdk/agent-sdk",
3
- "version": "3.0.0-beta.32",
3
+ "version": "3.0.0-beta.34",
4
4
  "description": "Programmatic SDK for building AI agents with Robota — provides Session, query(), built-in tools, permissions, hooks, and context loading",
5
5
  "type": "module",
6
6
  "main": "dist/node/index.js",
@@ -24,10 +24,10 @@
24
24
  "dependencies": {
25
25
  "chalk": "^5.3.0",
26
26
  "zod": "^3.24.0",
27
- "@robota-sdk/agent-core": "3.0.0-beta.32",
28
- "@robota-sdk/agent-provider-anthropic": "3.0.0-beta.32",
29
- "@robota-sdk/agent-sessions": "3.0.0-beta.32",
30
- "@robota-sdk/agent-tools": "3.0.0-beta.32"
27
+ "@robota-sdk/agent-core": "3.0.0-beta.34",
28
+ "@robota-sdk/agent-sessions": "3.0.0-beta.34",
29
+ "@robota-sdk/agent-provider-anthropic": "3.0.0-beta.34",
30
+ "@robota-sdk/agent-tools": "3.0.0-beta.34"
31
31
  },
32
32
  "devDependencies": {
33
33
  "rimraf": "^5.0.5",