@robota-sdk/agent-sdk 3.0.0-beta.1

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.
@@ -0,0 +1,294 @@
1
+ import { TPermissionMode, IAIProvider, TToolArgs, TTrustLevel } from '@robota-sdk/agent-core';
2
+ export { IContextTokenUsage, IContextWindowState, IHookInput, IPermissionLists, THookEvent, THooksConfig, TPermissionDecision, TPermissionMode, TRUST_TO_MODE, TToolArgs, TTrustLevel, evaluatePermission, runHooks } from '@robota-sdk/agent-core';
3
+ import * as _robota_sdk_agent_tools from '@robota-sdk/agent-tools';
4
+ export { TToolResult, bashTool, editTool, globTool, grepTool, readTool, writeTool } from '@robota-sdk/agent-tools';
5
+ import { ITerminalOutput, IResolvedConfig as IResolvedConfig$1, ILoadedContext as ILoadedContext$1, IProjectInfo as IProjectInfo$1 } from '@robota-sdk/agent-sessions';
6
+ export { ISessionOptions, ISessionRecord, ISpinner, ITerminalOutput, Session, SessionStore, TPermissionHandler } from '@robota-sdk/agent-sessions';
7
+ import { z } from 'zod';
8
+
9
+ /**
10
+ * query() — single entry point for running an AI agent conversation.
11
+ * Automatically loads config, context, and project info.
12
+ */
13
+
14
+ interface IQueryOptions {
15
+ cwd?: string;
16
+ permissionMode?: TPermissionMode;
17
+ maxTurns?: number;
18
+ provider?: IAIProvider;
19
+ permissionHandler?: (toolName: string, toolArgs: TToolArgs) => Promise<boolean>;
20
+ onTextDelta?: (delta: string) => void;
21
+ /** Callback when context is compacted */
22
+ onCompact?: (summary: string) => void;
23
+ }
24
+ /**
25
+ * query() — single entry point for running an AI agent conversation.
26
+ * Equivalent to Claude Agent SDK's query() function.
27
+ * Automatically loads config, context, and project info.
28
+ */
29
+ declare function query(prompt: string, options?: IQueryOptions): Promise<string>;
30
+
31
+ /**
32
+ * Zod schemas and TypeScript types for Robota CLI settings
33
+ */
34
+
35
+ declare const HooksSchema: z.ZodOptional<z.ZodObject<{
36
+ PreToolUse: z.ZodOptional<z.ZodArray<z.ZodObject<{
37
+ matcher: z.ZodString;
38
+ hooks: z.ZodArray<z.ZodObject<{
39
+ type: z.ZodLiteral<"command">;
40
+ command: z.ZodString;
41
+ }, "strip", z.ZodTypeAny, {
42
+ type: "command";
43
+ command: string;
44
+ }, {
45
+ type: "command";
46
+ command: string;
47
+ }>, "many">;
48
+ }, "strip", z.ZodTypeAny, {
49
+ matcher: string;
50
+ hooks: {
51
+ type: "command";
52
+ command: string;
53
+ }[];
54
+ }, {
55
+ matcher: string;
56
+ hooks: {
57
+ type: "command";
58
+ command: string;
59
+ }[];
60
+ }>, "many">>;
61
+ PostToolUse: z.ZodOptional<z.ZodArray<z.ZodObject<{
62
+ matcher: z.ZodString;
63
+ hooks: z.ZodArray<z.ZodObject<{
64
+ type: z.ZodLiteral<"command">;
65
+ command: z.ZodString;
66
+ }, "strip", z.ZodTypeAny, {
67
+ type: "command";
68
+ command: string;
69
+ }, {
70
+ type: "command";
71
+ command: string;
72
+ }>, "many">;
73
+ }, "strip", z.ZodTypeAny, {
74
+ matcher: string;
75
+ hooks: {
76
+ type: "command";
77
+ command: string;
78
+ }[];
79
+ }, {
80
+ matcher: string;
81
+ hooks: {
82
+ type: "command";
83
+ command: string;
84
+ }[];
85
+ }>, "many">>;
86
+ SessionStart: z.ZodOptional<z.ZodArray<z.ZodObject<{
87
+ matcher: z.ZodString;
88
+ hooks: z.ZodArray<z.ZodObject<{
89
+ type: z.ZodLiteral<"command">;
90
+ command: z.ZodString;
91
+ }, "strip", z.ZodTypeAny, {
92
+ type: "command";
93
+ command: string;
94
+ }, {
95
+ type: "command";
96
+ command: string;
97
+ }>, "many">;
98
+ }, "strip", z.ZodTypeAny, {
99
+ matcher: string;
100
+ hooks: {
101
+ type: "command";
102
+ command: string;
103
+ }[];
104
+ }, {
105
+ matcher: string;
106
+ hooks: {
107
+ type: "command";
108
+ command: string;
109
+ }[];
110
+ }>, "many">>;
111
+ Stop: z.ZodOptional<z.ZodArray<z.ZodObject<{
112
+ matcher: z.ZodString;
113
+ hooks: z.ZodArray<z.ZodObject<{
114
+ type: z.ZodLiteral<"command">;
115
+ command: z.ZodString;
116
+ }, "strip", z.ZodTypeAny, {
117
+ type: "command";
118
+ command: string;
119
+ }, {
120
+ type: "command";
121
+ command: string;
122
+ }>, "many">;
123
+ }, "strip", z.ZodTypeAny, {
124
+ matcher: string;
125
+ hooks: {
126
+ type: "command";
127
+ command: string;
128
+ }[];
129
+ }, {
130
+ matcher: string;
131
+ hooks: {
132
+ type: "command";
133
+ command: string;
134
+ }[];
135
+ }>, "many">>;
136
+ }, "strip", z.ZodTypeAny, {
137
+ PreToolUse?: {
138
+ matcher: string;
139
+ hooks: {
140
+ type: "command";
141
+ command: string;
142
+ }[];
143
+ }[] | undefined;
144
+ PostToolUse?: {
145
+ matcher: string;
146
+ hooks: {
147
+ type: "command";
148
+ command: string;
149
+ }[];
150
+ }[] | undefined;
151
+ SessionStart?: {
152
+ matcher: string;
153
+ hooks: {
154
+ type: "command";
155
+ command: string;
156
+ }[];
157
+ }[] | undefined;
158
+ Stop?: {
159
+ matcher: string;
160
+ hooks: {
161
+ type: "command";
162
+ command: string;
163
+ }[];
164
+ }[] | undefined;
165
+ }, {
166
+ PreToolUse?: {
167
+ matcher: string;
168
+ hooks: {
169
+ type: "command";
170
+ command: string;
171
+ }[];
172
+ }[] | undefined;
173
+ PostToolUse?: {
174
+ matcher: string;
175
+ hooks: {
176
+ type: "command";
177
+ command: string;
178
+ }[];
179
+ }[] | undefined;
180
+ SessionStart?: {
181
+ matcher: string;
182
+ hooks: {
183
+ type: "command";
184
+ command: string;
185
+ }[];
186
+ }[] | undefined;
187
+ Stop?: {
188
+ matcher: string;
189
+ hooks: {
190
+ type: "command";
191
+ command: string;
192
+ }[];
193
+ }[] | undefined;
194
+ }>>;
195
+ /**
196
+ * Fully resolved config after merging all settings files and applying defaults.
197
+ */
198
+ interface IResolvedConfig {
199
+ defaultTrustLevel: 'safe' | 'moderate' | 'full';
200
+ provider: {
201
+ name: string;
202
+ model: string;
203
+ apiKey: string | undefined;
204
+ };
205
+ permissions: {
206
+ allow: string[];
207
+ deny: string[];
208
+ };
209
+ env: Record<string, string>;
210
+ hooks?: z.infer<typeof HooksSchema>;
211
+ }
212
+
213
+ /**
214
+ * Load and merge all settings files, validate with Zod, return resolved config.
215
+ *
216
+ * @param cwd - The working directory (project root) to search for .robota/
217
+ */
218
+ declare function loadConfig(cwd: string): Promise<IResolvedConfig>;
219
+
220
+ interface ILoadedContext {
221
+ /** Concatenated content of all AGENTS.md files found (root-first) */
222
+ agentsMd: string;
223
+ /** Concatenated content of all CLAUDE.md files found (root-first) */
224
+ claudeMd: string;
225
+ /** Extracted "Compact Instructions" section from CLAUDE.md, if present */
226
+ compactInstructions?: string;
227
+ }
228
+ /**
229
+ * Load all AGENTS.md and CLAUDE.md files found by walking up from `cwd`.
230
+ * Files from higher directories appear before files from lower directories.
231
+ *
232
+ * @param cwd - Starting directory for the walk-up search
233
+ */
234
+ declare function loadContext(cwd: string): Promise<ILoadedContext>;
235
+
236
+ type TProjectType = 'node' | 'python' | 'rust' | 'go' | 'unknown';
237
+ type TPackageManager = 'pnpm' | 'yarn' | 'npm' | 'bun';
238
+ type TLanguage = 'typescript' | 'javascript' | 'python' | 'rust' | 'go' | 'unknown';
239
+ interface IProjectInfo {
240
+ type: TProjectType;
241
+ name?: string;
242
+ packageManager?: TPackageManager;
243
+ language: TLanguage;
244
+ }
245
+ /**
246
+ * Detect the project type, language, name, and package manager from `cwd`.
247
+ */
248
+ declare function detectProject(cwd: string): Promise<IProjectInfo>;
249
+
250
+ /**
251
+ * System prompt builder — assembles the system message sent to the AI model
252
+ * from base role, project context, AGENTS.md/CLAUDE.md, tool list, and
253
+ * permission trust level.
254
+ */
255
+
256
+ interface ISystemPromptParams {
257
+ /** Concatenated AGENTS.md content (may be empty string) */
258
+ agentsMd: string;
259
+ /** Concatenated CLAUDE.md content (may be empty string) */
260
+ claudeMd: string;
261
+ /** Human-readable tool descriptions, one per entry */
262
+ toolDescriptions: string[];
263
+ /** Active trust level governing permission checks */
264
+ trustLevel: TTrustLevel;
265
+ /** Detected project metadata */
266
+ projectInfo: IProjectInfo;
267
+ }
268
+ /**
269
+ * Assemble the full system prompt string from the provided parameters.
270
+ */
271
+ declare function buildSystemPrompt(params: ISystemPromptParams): string;
272
+
273
+ /**
274
+ * Permission prompt — this is now CLI-specific.
275
+ * Re-exported here for backward compatibility.
276
+ * The canonical implementation lives in @robota-sdk/agent-cli.
277
+ */
278
+
279
+ /**
280
+ * Prompt the user for approval before running a tool.
281
+ */
282
+ declare function promptForApproval(terminal: ITerminalOutput, toolName: string, toolArgs: TToolArgs): Promise<boolean>;
283
+
284
+ /** Dependencies injected at registration time */
285
+ interface IAgentToolDeps {
286
+ config: IResolvedConfig$1;
287
+ context: ILoadedContext$1;
288
+ projectInfo?: IProjectInfo$1;
289
+ }
290
+ /** Set dependencies for the agent tool. Must be called before tool is used. */
291
+ declare function setAgentToolDeps(deps: IAgentToolDeps): void;
292
+ declare const agentTool: _robota_sdk_agent_tools.FunctionTool;
293
+
294
+ export { type ILoadedContext, type IProjectInfo, type IQueryOptions, type IResolvedConfig, type ISystemPromptParams, agentTool, buildSystemPrompt, detectProject, loadConfig, loadContext, promptForApproval, query, setAgentToolDeps };
@@ -0,0 +1,294 @@
1
+ import { TPermissionMode, IAIProvider, TToolArgs, TTrustLevel } from '@robota-sdk/agent-core';
2
+ export { IContextTokenUsage, IContextWindowState, IHookInput, IPermissionLists, THookEvent, THooksConfig, TPermissionDecision, TPermissionMode, TRUST_TO_MODE, TToolArgs, TTrustLevel, evaluatePermission, runHooks } from '@robota-sdk/agent-core';
3
+ import * as _robota_sdk_agent_tools from '@robota-sdk/agent-tools';
4
+ export { TToolResult, bashTool, editTool, globTool, grepTool, readTool, writeTool } from '@robota-sdk/agent-tools';
5
+ import { ITerminalOutput, IResolvedConfig as IResolvedConfig$1, ILoadedContext as ILoadedContext$1, IProjectInfo as IProjectInfo$1 } from '@robota-sdk/agent-sessions';
6
+ export { ISessionOptions, ISessionRecord, ISpinner, ITerminalOutput, Session, SessionStore, TPermissionHandler } from '@robota-sdk/agent-sessions';
7
+ import { z } from 'zod';
8
+
9
+ /**
10
+ * query() — single entry point for running an AI agent conversation.
11
+ * Automatically loads config, context, and project info.
12
+ */
13
+
14
+ interface IQueryOptions {
15
+ cwd?: string;
16
+ permissionMode?: TPermissionMode;
17
+ maxTurns?: number;
18
+ provider?: IAIProvider;
19
+ permissionHandler?: (toolName: string, toolArgs: TToolArgs) => Promise<boolean>;
20
+ onTextDelta?: (delta: string) => void;
21
+ /** Callback when context is compacted */
22
+ onCompact?: (summary: string) => void;
23
+ }
24
+ /**
25
+ * query() — single entry point for running an AI agent conversation.
26
+ * Equivalent to Claude Agent SDK's query() function.
27
+ * Automatically loads config, context, and project info.
28
+ */
29
+ declare function query(prompt: string, options?: IQueryOptions): Promise<string>;
30
+
31
+ /**
32
+ * Zod schemas and TypeScript types for Robota CLI settings
33
+ */
34
+
35
+ declare const HooksSchema: z.ZodOptional<z.ZodObject<{
36
+ PreToolUse: z.ZodOptional<z.ZodArray<z.ZodObject<{
37
+ matcher: z.ZodString;
38
+ hooks: z.ZodArray<z.ZodObject<{
39
+ type: z.ZodLiteral<"command">;
40
+ command: z.ZodString;
41
+ }, "strip", z.ZodTypeAny, {
42
+ type: "command";
43
+ command: string;
44
+ }, {
45
+ type: "command";
46
+ command: string;
47
+ }>, "many">;
48
+ }, "strip", z.ZodTypeAny, {
49
+ matcher: string;
50
+ hooks: {
51
+ type: "command";
52
+ command: string;
53
+ }[];
54
+ }, {
55
+ matcher: string;
56
+ hooks: {
57
+ type: "command";
58
+ command: string;
59
+ }[];
60
+ }>, "many">>;
61
+ PostToolUse: z.ZodOptional<z.ZodArray<z.ZodObject<{
62
+ matcher: z.ZodString;
63
+ hooks: z.ZodArray<z.ZodObject<{
64
+ type: z.ZodLiteral<"command">;
65
+ command: z.ZodString;
66
+ }, "strip", z.ZodTypeAny, {
67
+ type: "command";
68
+ command: string;
69
+ }, {
70
+ type: "command";
71
+ command: string;
72
+ }>, "many">;
73
+ }, "strip", z.ZodTypeAny, {
74
+ matcher: string;
75
+ hooks: {
76
+ type: "command";
77
+ command: string;
78
+ }[];
79
+ }, {
80
+ matcher: string;
81
+ hooks: {
82
+ type: "command";
83
+ command: string;
84
+ }[];
85
+ }>, "many">>;
86
+ SessionStart: z.ZodOptional<z.ZodArray<z.ZodObject<{
87
+ matcher: z.ZodString;
88
+ hooks: z.ZodArray<z.ZodObject<{
89
+ type: z.ZodLiteral<"command">;
90
+ command: z.ZodString;
91
+ }, "strip", z.ZodTypeAny, {
92
+ type: "command";
93
+ command: string;
94
+ }, {
95
+ type: "command";
96
+ command: string;
97
+ }>, "many">;
98
+ }, "strip", z.ZodTypeAny, {
99
+ matcher: string;
100
+ hooks: {
101
+ type: "command";
102
+ command: string;
103
+ }[];
104
+ }, {
105
+ matcher: string;
106
+ hooks: {
107
+ type: "command";
108
+ command: string;
109
+ }[];
110
+ }>, "many">>;
111
+ Stop: z.ZodOptional<z.ZodArray<z.ZodObject<{
112
+ matcher: z.ZodString;
113
+ hooks: z.ZodArray<z.ZodObject<{
114
+ type: z.ZodLiteral<"command">;
115
+ command: z.ZodString;
116
+ }, "strip", z.ZodTypeAny, {
117
+ type: "command";
118
+ command: string;
119
+ }, {
120
+ type: "command";
121
+ command: string;
122
+ }>, "many">;
123
+ }, "strip", z.ZodTypeAny, {
124
+ matcher: string;
125
+ hooks: {
126
+ type: "command";
127
+ command: string;
128
+ }[];
129
+ }, {
130
+ matcher: string;
131
+ hooks: {
132
+ type: "command";
133
+ command: string;
134
+ }[];
135
+ }>, "many">>;
136
+ }, "strip", z.ZodTypeAny, {
137
+ PreToolUse?: {
138
+ matcher: string;
139
+ hooks: {
140
+ type: "command";
141
+ command: string;
142
+ }[];
143
+ }[] | undefined;
144
+ PostToolUse?: {
145
+ matcher: string;
146
+ hooks: {
147
+ type: "command";
148
+ command: string;
149
+ }[];
150
+ }[] | undefined;
151
+ SessionStart?: {
152
+ matcher: string;
153
+ hooks: {
154
+ type: "command";
155
+ command: string;
156
+ }[];
157
+ }[] | undefined;
158
+ Stop?: {
159
+ matcher: string;
160
+ hooks: {
161
+ type: "command";
162
+ command: string;
163
+ }[];
164
+ }[] | undefined;
165
+ }, {
166
+ PreToolUse?: {
167
+ matcher: string;
168
+ hooks: {
169
+ type: "command";
170
+ command: string;
171
+ }[];
172
+ }[] | undefined;
173
+ PostToolUse?: {
174
+ matcher: string;
175
+ hooks: {
176
+ type: "command";
177
+ command: string;
178
+ }[];
179
+ }[] | undefined;
180
+ SessionStart?: {
181
+ matcher: string;
182
+ hooks: {
183
+ type: "command";
184
+ command: string;
185
+ }[];
186
+ }[] | undefined;
187
+ Stop?: {
188
+ matcher: string;
189
+ hooks: {
190
+ type: "command";
191
+ command: string;
192
+ }[];
193
+ }[] | undefined;
194
+ }>>;
195
+ /**
196
+ * Fully resolved config after merging all settings files and applying defaults.
197
+ */
198
+ interface IResolvedConfig {
199
+ defaultTrustLevel: 'safe' | 'moderate' | 'full';
200
+ provider: {
201
+ name: string;
202
+ model: string;
203
+ apiKey: string | undefined;
204
+ };
205
+ permissions: {
206
+ allow: string[];
207
+ deny: string[];
208
+ };
209
+ env: Record<string, string>;
210
+ hooks?: z.infer<typeof HooksSchema>;
211
+ }
212
+
213
+ /**
214
+ * Load and merge all settings files, validate with Zod, return resolved config.
215
+ *
216
+ * @param cwd - The working directory (project root) to search for .robota/
217
+ */
218
+ declare function loadConfig(cwd: string): Promise<IResolvedConfig>;
219
+
220
+ interface ILoadedContext {
221
+ /** Concatenated content of all AGENTS.md files found (root-first) */
222
+ agentsMd: string;
223
+ /** Concatenated content of all CLAUDE.md files found (root-first) */
224
+ claudeMd: string;
225
+ /** Extracted "Compact Instructions" section from CLAUDE.md, if present */
226
+ compactInstructions?: string;
227
+ }
228
+ /**
229
+ * Load all AGENTS.md and CLAUDE.md files found by walking up from `cwd`.
230
+ * Files from higher directories appear before files from lower directories.
231
+ *
232
+ * @param cwd - Starting directory for the walk-up search
233
+ */
234
+ declare function loadContext(cwd: string): Promise<ILoadedContext>;
235
+
236
+ type TProjectType = 'node' | 'python' | 'rust' | 'go' | 'unknown';
237
+ type TPackageManager = 'pnpm' | 'yarn' | 'npm' | 'bun';
238
+ type TLanguage = 'typescript' | 'javascript' | 'python' | 'rust' | 'go' | 'unknown';
239
+ interface IProjectInfo {
240
+ type: TProjectType;
241
+ name?: string;
242
+ packageManager?: TPackageManager;
243
+ language: TLanguage;
244
+ }
245
+ /**
246
+ * Detect the project type, language, name, and package manager from `cwd`.
247
+ */
248
+ declare function detectProject(cwd: string): Promise<IProjectInfo>;
249
+
250
+ /**
251
+ * System prompt builder — assembles the system message sent to the AI model
252
+ * from base role, project context, AGENTS.md/CLAUDE.md, tool list, and
253
+ * permission trust level.
254
+ */
255
+
256
+ interface ISystemPromptParams {
257
+ /** Concatenated AGENTS.md content (may be empty string) */
258
+ agentsMd: string;
259
+ /** Concatenated CLAUDE.md content (may be empty string) */
260
+ claudeMd: string;
261
+ /** Human-readable tool descriptions, one per entry */
262
+ toolDescriptions: string[];
263
+ /** Active trust level governing permission checks */
264
+ trustLevel: TTrustLevel;
265
+ /** Detected project metadata */
266
+ projectInfo: IProjectInfo;
267
+ }
268
+ /**
269
+ * Assemble the full system prompt string from the provided parameters.
270
+ */
271
+ declare function buildSystemPrompt(params: ISystemPromptParams): string;
272
+
273
+ /**
274
+ * Permission prompt — this is now CLI-specific.
275
+ * Re-exported here for backward compatibility.
276
+ * The canonical implementation lives in @robota-sdk/agent-cli.
277
+ */
278
+
279
+ /**
280
+ * Prompt the user for approval before running a tool.
281
+ */
282
+ declare function promptForApproval(terminal: ITerminalOutput, toolName: string, toolArgs: TToolArgs): Promise<boolean>;
283
+
284
+ /** Dependencies injected at registration time */
285
+ interface IAgentToolDeps {
286
+ config: IResolvedConfig$1;
287
+ context: ILoadedContext$1;
288
+ projectInfo?: IProjectInfo$1;
289
+ }
290
+ /** Set dependencies for the agent tool. Must be called before tool is used. */
291
+ declare function setAgentToolDeps(deps: IAgentToolDeps): void;
292
+ declare const agentTool: _robota_sdk_agent_tools.FunctionTool;
293
+
294
+ export { type ILoadedContext, type IProjectInfo, type IQueryOptions, type IResolvedConfig, type ISystemPromptParams, agentTool, buildSystemPrompt, detectProject, loadConfig, loadContext, promptForApproval, query, setAgentToolDeps };