@ampcode/sdk 0.0.0-placeholder → 0.1.0-20260513070248-g548495c

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,575 @@
1
+ /**
2
+ * TypeScript SDK types for Amp CLI
3
+ *
4
+ * These types are compatible with the Amp CLI --stream-json output.
5
+ */
6
+ import { z } from 'zod';
7
+ /** Text content block containing plain text */
8
+ export interface TextContent {
9
+ type: 'text';
10
+ text: string;
11
+ }
12
+ /** Tool use content block representing a tool call request */
13
+ export interface ToolUseContent {
14
+ type: 'tool_use';
15
+ id: string;
16
+ name: string;
17
+ input: Record<string, unknown>;
18
+ }
19
+ /** Tool result content block containing the result of a tool execution */
20
+ export interface ToolResultContent {
21
+ type: 'tool_result';
22
+ tool_use_id: string;
23
+ content: string;
24
+ is_error: boolean;
25
+ }
26
+ /** Token usage information for API calls */
27
+ export interface Usage {
28
+ input_tokens: number;
29
+ cache_creation_input_tokens?: number;
30
+ cache_read_input_tokens?: number;
31
+ output_tokens: number;
32
+ service_tier?: string;
33
+ }
34
+ /** Base interface for all message types */
35
+ interface BaseMessage {
36
+ type: 'system' | 'assistant' | 'user' | 'result';
37
+ session_id: string;
38
+ }
39
+ /** MCP server connection status */
40
+ export type MCPConnectionStatus = 'awaiting-approval' | 'authenticating' | 'connecting' | 'reconnecting' | 'connected' | 'denied' | 'failed' | 'blocked-by-registry';
41
+ /** System initialization message containing session info and available tools */
42
+ export interface SystemMessage extends BaseMessage {
43
+ type: 'system';
44
+ subtype: 'init';
45
+ cwd: string;
46
+ tools: string[];
47
+ mcp_servers: {
48
+ name: string;
49
+ status: MCPConnectionStatus;
50
+ }[];
51
+ }
52
+ /** AI assistant response message with text and tool usage */
53
+ export interface AssistantMessage extends BaseMessage {
54
+ type: 'assistant';
55
+ message: {
56
+ id: string;
57
+ type: 'message';
58
+ role: 'assistant';
59
+ model: string;
60
+ content: Array<TextContent | ToolUseContent>;
61
+ stop_reason: 'end_turn' | 'tool_use' | 'max_tokens' | null;
62
+ stop_sequence: string | null;
63
+ usage?: Usage;
64
+ };
65
+ parent_tool_use_id: string | null;
66
+ }
67
+ /** User input message containing text or tool results */
68
+ export interface UserMessage extends BaseMessage {
69
+ type: 'user';
70
+ message: {
71
+ role: 'user';
72
+ content: Array<TextContent | ToolResultContent>;
73
+ };
74
+ parent_tool_use_id: string | null;
75
+ }
76
+ /** Base interface for result messages */
77
+ interface BaseResultMessage extends BaseMessage {
78
+ type: 'result';
79
+ duration_ms: number;
80
+ num_turns: number;
81
+ usage?: Usage;
82
+ permission_denials?: string[];
83
+ }
84
+ /** Successful execution result message */
85
+ export interface ResultMessage extends BaseResultMessage {
86
+ subtype: 'success';
87
+ is_error: false;
88
+ result: string;
89
+ }
90
+ /** Error result message indicating execution failure */
91
+ export interface ErrorResultMessage extends BaseResultMessage {
92
+ subtype: 'error_during_execution' | 'error_max_turns';
93
+ is_error: true;
94
+ error: string;
95
+ }
96
+ /** Union of all possible stream messages */
97
+ export type StreamMessage = SystemMessage | AssistantMessage | UserMessage | ResultMessage | ErrorResultMessage;
98
+ /** User input message schema */
99
+ export declare const UserInputMessageSchema: z.ZodObject<{
100
+ type: z.ZodLiteral<"user">;
101
+ message: z.ZodObject<{
102
+ role: z.ZodLiteral<"user">;
103
+ content: z.ZodArray<z.ZodObject<{
104
+ type: z.ZodLiteral<"text">;
105
+ text: z.ZodString;
106
+ }, "strip", z.ZodTypeAny, {
107
+ text: string;
108
+ type: "text";
109
+ }, {
110
+ text: string;
111
+ type: "text";
112
+ }>, "many">;
113
+ }, "strip", z.ZodTypeAny, {
114
+ role: "user";
115
+ content: {
116
+ text: string;
117
+ type: "text";
118
+ }[];
119
+ }, {
120
+ role: "user";
121
+ content: {
122
+ text: string;
123
+ type: "text";
124
+ }[];
125
+ }>;
126
+ }, "strip", z.ZodTypeAny, {
127
+ message: {
128
+ role: "user";
129
+ content: {
130
+ text: string;
131
+ type: "text";
132
+ }[];
133
+ };
134
+ type: "user";
135
+ }, {
136
+ message: {
137
+ role: "user";
138
+ content: {
139
+ text: string;
140
+ type: "text";
141
+ }[];
142
+ };
143
+ type: "user";
144
+ }>;
145
+ /** User input message for streaming conversations */
146
+ export type UserInputMessage = z.infer<typeof UserInputMessageSchema>;
147
+ /** Recursive type for permission match conditions */
148
+ export type PermissionMatchCondition = string | PermissionMatchCondition[] | {
149
+ [key in string]: PermissionMatchCondition;
150
+ } | boolean | number | null | undefined;
151
+ /** Permission match condition for tool arguments schema */
152
+ export declare const PermissionMatchConditionSchema: z.ZodType<PermissionMatchCondition>;
153
+ /** Individual permission schema */
154
+ export declare const PermissionSchema: z.ZodEffects<z.ZodObject<{
155
+ tool: z.ZodString;
156
+ matches: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<PermissionMatchCondition, z.ZodTypeDef, PermissionMatchCondition>>>;
157
+ action: z.ZodEnum<["allow", "reject", "ask", "delegate"]>;
158
+ context: z.ZodOptional<z.ZodEnum<["thread", "subagent"]>>;
159
+ to: z.ZodOptional<z.ZodString>;
160
+ }, "strip", z.ZodTypeAny, {
161
+ tool: string;
162
+ action: "allow" | "reject" | "ask" | "delegate";
163
+ matches?: Record<string, PermissionMatchCondition> | undefined;
164
+ context?: "thread" | "subagent" | undefined;
165
+ to?: string | undefined;
166
+ }, {
167
+ tool: string;
168
+ action: "allow" | "reject" | "ask" | "delegate";
169
+ matches?: Record<string, PermissionMatchCondition> | undefined;
170
+ context?: "thread" | "subagent" | undefined;
171
+ to?: string | undefined;
172
+ }>, {
173
+ tool: string;
174
+ action: "allow" | "reject" | "ask" | "delegate";
175
+ matches?: Record<string, PermissionMatchCondition> | undefined;
176
+ context?: "thread" | "subagent" | undefined;
177
+ to?: string | undefined;
178
+ }, {
179
+ tool: string;
180
+ action: "allow" | "reject" | "ask" | "delegate";
181
+ matches?: Record<string, PermissionMatchCondition> | undefined;
182
+ context?: "thread" | "subagent" | undefined;
183
+ to?: string | undefined;
184
+ }>;
185
+ /** Permission */
186
+ export type Permission = z.infer<typeof PermissionSchema>;
187
+ /** Permissions list */
188
+ export type PermissionsList = Permission[];
189
+ /** MCP server configuration schema (stdio or HTTP) */
190
+ export declare const MCPServerSchema: z.ZodUnion<[z.ZodObject<{
191
+ command: z.ZodString;
192
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
193
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
194
+ disabled: z.ZodOptional<z.ZodBoolean>;
195
+ }, "strip", z.ZodTypeAny, {
196
+ command: string;
197
+ args?: string[] | undefined;
198
+ env?: Record<string, string> | undefined;
199
+ disabled?: boolean | undefined;
200
+ }, {
201
+ command: string;
202
+ args?: string[] | undefined;
203
+ env?: Record<string, string> | undefined;
204
+ disabled?: boolean | undefined;
205
+ }>, z.ZodObject<{
206
+ url: z.ZodString;
207
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
208
+ transport: z.ZodOptional<z.ZodString>;
209
+ oauth: z.ZodOptional<z.ZodObject<{
210
+ clientId: z.ZodString;
211
+ clientSecret: z.ZodOptional<z.ZodString>;
212
+ authUrl: z.ZodString;
213
+ tokenUrl: z.ZodString;
214
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
215
+ redirectUrl: z.ZodOptional<z.ZodString>;
216
+ }, "strip", z.ZodTypeAny, {
217
+ clientId: string;
218
+ authUrl: string;
219
+ tokenUrl: string;
220
+ clientSecret?: string | undefined;
221
+ scopes?: string[] | undefined;
222
+ redirectUrl?: string | undefined;
223
+ }, {
224
+ clientId: string;
225
+ authUrl: string;
226
+ tokenUrl: string;
227
+ clientSecret?: string | undefined;
228
+ scopes?: string[] | undefined;
229
+ redirectUrl?: string | undefined;
230
+ }>>;
231
+ disabled: z.ZodOptional<z.ZodBoolean>;
232
+ }, "strip", z.ZodTypeAny, {
233
+ url: string;
234
+ disabled?: boolean | undefined;
235
+ headers?: Record<string, string> | undefined;
236
+ transport?: string | undefined;
237
+ oauth?: {
238
+ clientId: string;
239
+ authUrl: string;
240
+ tokenUrl: string;
241
+ clientSecret?: string | undefined;
242
+ scopes?: string[] | undefined;
243
+ redirectUrl?: string | undefined;
244
+ } | undefined;
245
+ }, {
246
+ url: string;
247
+ disabled?: boolean | undefined;
248
+ headers?: Record<string, string> | undefined;
249
+ transport?: string | undefined;
250
+ oauth?: {
251
+ clientId: string;
252
+ authUrl: string;
253
+ tokenUrl: string;
254
+ clientSecret?: string | undefined;
255
+ scopes?: string[] | undefined;
256
+ redirectUrl?: string | undefined;
257
+ } | undefined;
258
+ }>]>;
259
+ /** MCP configuration schema */
260
+ export declare const MCPConfigSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
261
+ command: z.ZodString;
262
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
263
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
264
+ disabled: z.ZodOptional<z.ZodBoolean>;
265
+ }, "strip", z.ZodTypeAny, {
266
+ command: string;
267
+ args?: string[] | undefined;
268
+ env?: Record<string, string> | undefined;
269
+ disabled?: boolean | undefined;
270
+ }, {
271
+ command: string;
272
+ args?: string[] | undefined;
273
+ env?: Record<string, string> | undefined;
274
+ disabled?: boolean | undefined;
275
+ }>, z.ZodObject<{
276
+ url: z.ZodString;
277
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
278
+ transport: z.ZodOptional<z.ZodString>;
279
+ oauth: z.ZodOptional<z.ZodObject<{
280
+ clientId: z.ZodString;
281
+ clientSecret: z.ZodOptional<z.ZodString>;
282
+ authUrl: z.ZodString;
283
+ tokenUrl: z.ZodString;
284
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
285
+ redirectUrl: z.ZodOptional<z.ZodString>;
286
+ }, "strip", z.ZodTypeAny, {
287
+ clientId: string;
288
+ authUrl: string;
289
+ tokenUrl: string;
290
+ clientSecret?: string | undefined;
291
+ scopes?: string[] | undefined;
292
+ redirectUrl?: string | undefined;
293
+ }, {
294
+ clientId: string;
295
+ authUrl: string;
296
+ tokenUrl: string;
297
+ clientSecret?: string | undefined;
298
+ scopes?: string[] | undefined;
299
+ redirectUrl?: string | undefined;
300
+ }>>;
301
+ disabled: z.ZodOptional<z.ZodBoolean>;
302
+ }, "strip", z.ZodTypeAny, {
303
+ url: string;
304
+ disabled?: boolean | undefined;
305
+ headers?: Record<string, string> | undefined;
306
+ transport?: string | undefined;
307
+ oauth?: {
308
+ clientId: string;
309
+ authUrl: string;
310
+ tokenUrl: string;
311
+ clientSecret?: string | undefined;
312
+ scopes?: string[] | undefined;
313
+ redirectUrl?: string | undefined;
314
+ } | undefined;
315
+ }, {
316
+ url: string;
317
+ disabled?: boolean | undefined;
318
+ headers?: Record<string, string> | undefined;
319
+ transport?: string | undefined;
320
+ oauth?: {
321
+ clientId: string;
322
+ authUrl: string;
323
+ tokenUrl: string;
324
+ clientSecret?: string | undefined;
325
+ scopes?: string[] | undefined;
326
+ redirectUrl?: string | undefined;
327
+ } | undefined;
328
+ }>]>>;
329
+ /** MCP server configuration (stdio or HTTP) */
330
+ export type MCPServer = z.infer<typeof MCPServerSchema>;
331
+ /** MCP configuration object */
332
+ export type MCPConfig = z.infer<typeof MCPConfigSchema>;
333
+ /** Options for creating a new thread schema */
334
+ export declare const ThreadsNewOptionsSchema: z.ZodObject<{
335
+ visibility: z.ZodOptional<z.ZodEnum<["private", "public", "workspace", "group"]>>;
336
+ }, "strip", z.ZodTypeAny, {
337
+ visibility?: "private" | "public" | "workspace" | "group" | undefined;
338
+ }, {
339
+ visibility?: "private" | "public" | "workspace" | "group" | undefined;
340
+ }>;
341
+ /** Options for creating a new thread */
342
+ export type ThreadsNewOptions = z.infer<typeof ThreadsNewOptionsSchema>;
343
+ /** Options for getting thread markdown schema */
344
+ export declare const ThreadsMarkdownOptionsSchema: z.ZodObject<{
345
+ threadId: z.ZodString;
346
+ }, "strip", z.ZodTypeAny, {
347
+ threadId: string;
348
+ }, {
349
+ threadId: string;
350
+ }>;
351
+ /** Options for getting thread markdown */
352
+ export type ThreadsMarkdownOptions = z.infer<typeof ThreadsMarkdownOptionsSchema>;
353
+ /** Configuration options for Amp execution schema */
354
+ export declare const AmpOptionsSchema: z.ZodObject<{
355
+ cwd: z.ZodOptional<z.ZodString>;
356
+ mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<["smart", "rush", "large", "deep"]>>>;
357
+ dangerouslyAllowAll: z.ZodOptional<z.ZodBoolean>;
358
+ archive: z.ZodOptional<z.ZodBoolean>;
359
+ visibility: z.ZodOptional<z.ZodDefault<z.ZodEnum<["private", "public", "workspace", "group"]>>>;
360
+ settingsFile: z.ZodOptional<z.ZodString>;
361
+ logLevel: z.ZodOptional<z.ZodEnum<["debug", "info", "warn", "error", "audit"]>>;
362
+ logFile: z.ZodOptional<z.ZodString>;
363
+ mcpConfig: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
364
+ command: z.ZodString;
365
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
366
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
367
+ disabled: z.ZodOptional<z.ZodBoolean>;
368
+ }, "strip", z.ZodTypeAny, {
369
+ command: string;
370
+ args?: string[] | undefined;
371
+ env?: Record<string, string> | undefined;
372
+ disabled?: boolean | undefined;
373
+ }, {
374
+ command: string;
375
+ args?: string[] | undefined;
376
+ env?: Record<string, string> | undefined;
377
+ disabled?: boolean | undefined;
378
+ }>, z.ZodObject<{
379
+ url: z.ZodString;
380
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
381
+ transport: z.ZodOptional<z.ZodString>;
382
+ oauth: z.ZodOptional<z.ZodObject<{
383
+ clientId: z.ZodString;
384
+ clientSecret: z.ZodOptional<z.ZodString>;
385
+ authUrl: z.ZodString;
386
+ tokenUrl: z.ZodString;
387
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
388
+ redirectUrl: z.ZodOptional<z.ZodString>;
389
+ }, "strip", z.ZodTypeAny, {
390
+ clientId: string;
391
+ authUrl: string;
392
+ tokenUrl: string;
393
+ clientSecret?: string | undefined;
394
+ scopes?: string[] | undefined;
395
+ redirectUrl?: string | undefined;
396
+ }, {
397
+ clientId: string;
398
+ authUrl: string;
399
+ tokenUrl: string;
400
+ clientSecret?: string | undefined;
401
+ scopes?: string[] | undefined;
402
+ redirectUrl?: string | undefined;
403
+ }>>;
404
+ disabled: z.ZodOptional<z.ZodBoolean>;
405
+ }, "strip", z.ZodTypeAny, {
406
+ url: string;
407
+ disabled?: boolean | undefined;
408
+ headers?: Record<string, string> | undefined;
409
+ transport?: string | undefined;
410
+ oauth?: {
411
+ clientId: string;
412
+ authUrl: string;
413
+ tokenUrl: string;
414
+ clientSecret?: string | undefined;
415
+ scopes?: string[] | undefined;
416
+ redirectUrl?: string | undefined;
417
+ } | undefined;
418
+ }, {
419
+ url: string;
420
+ disabled?: boolean | undefined;
421
+ headers?: Record<string, string> | undefined;
422
+ transport?: string | undefined;
423
+ oauth?: {
424
+ clientId: string;
425
+ authUrl: string;
426
+ tokenUrl: string;
427
+ clientSecret?: string | undefined;
428
+ scopes?: string[] | undefined;
429
+ redirectUrl?: string | undefined;
430
+ } | undefined;
431
+ }>]>>]>>;
432
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
433
+ continue: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString]>>;
434
+ toolbox: z.ZodOptional<z.ZodString>;
435
+ skills: z.ZodOptional<z.ZodString>;
436
+ permissions: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
437
+ tool: z.ZodString;
438
+ matches: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<PermissionMatchCondition, z.ZodTypeDef, PermissionMatchCondition>>>;
439
+ action: z.ZodEnum<["allow", "reject", "ask", "delegate"]>;
440
+ context: z.ZodOptional<z.ZodEnum<["thread", "subagent"]>>;
441
+ to: z.ZodOptional<z.ZodString>;
442
+ }, "strip", z.ZodTypeAny, {
443
+ tool: string;
444
+ action: "allow" | "reject" | "ask" | "delegate";
445
+ matches?: Record<string, PermissionMatchCondition> | undefined;
446
+ context?: "thread" | "subagent" | undefined;
447
+ to?: string | undefined;
448
+ }, {
449
+ tool: string;
450
+ action: "allow" | "reject" | "ask" | "delegate";
451
+ matches?: Record<string, PermissionMatchCondition> | undefined;
452
+ context?: "thread" | "subagent" | undefined;
453
+ to?: string | undefined;
454
+ }>, {
455
+ tool: string;
456
+ action: "allow" | "reject" | "ask" | "delegate";
457
+ matches?: Record<string, PermissionMatchCondition> | undefined;
458
+ context?: "thread" | "subagent" | undefined;
459
+ to?: string | undefined;
460
+ }, {
461
+ tool: string;
462
+ action: "allow" | "reject" | "ask" | "delegate";
463
+ matches?: Record<string, PermissionMatchCondition> | undefined;
464
+ context?: "thread" | "subagent" | undefined;
465
+ to?: string | undefined;
466
+ }>, "many">>;
467
+ labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
468
+ enabledTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
469
+ systemPrompt: z.ZodOptional<z.ZodString>;
470
+ thinking: z.ZodOptional<z.ZodBoolean>;
471
+ }, "strict", z.ZodTypeAny, {
472
+ mode: "smart" | "rush" | "large" | "deep";
473
+ env?: Record<string, string> | undefined;
474
+ visibility?: "private" | "public" | "workspace" | "group" | undefined;
475
+ cwd?: string | undefined;
476
+ dangerouslyAllowAll?: boolean | undefined;
477
+ archive?: boolean | undefined;
478
+ settingsFile?: string | undefined;
479
+ logLevel?: "debug" | "info" | "warn" | "error" | "audit" | undefined;
480
+ logFile?: string | undefined;
481
+ mcpConfig?: string | Record<string, {
482
+ command: string;
483
+ args?: string[] | undefined;
484
+ env?: Record<string, string> | undefined;
485
+ disabled?: boolean | undefined;
486
+ } | {
487
+ url: string;
488
+ disabled?: boolean | undefined;
489
+ headers?: Record<string, string> | undefined;
490
+ transport?: string | undefined;
491
+ oauth?: {
492
+ clientId: string;
493
+ authUrl: string;
494
+ tokenUrl: string;
495
+ clientSecret?: string | undefined;
496
+ scopes?: string[] | undefined;
497
+ redirectUrl?: string | undefined;
498
+ } | undefined;
499
+ }> | undefined;
500
+ continue?: string | boolean | undefined;
501
+ toolbox?: string | undefined;
502
+ skills?: string | undefined;
503
+ permissions?: {
504
+ tool: string;
505
+ action: "allow" | "reject" | "ask" | "delegate";
506
+ matches?: Record<string, PermissionMatchCondition> | undefined;
507
+ context?: "thread" | "subagent" | undefined;
508
+ to?: string | undefined;
509
+ }[] | undefined;
510
+ labels?: string[] | undefined;
511
+ enabledTools?: string[] | undefined;
512
+ systemPrompt?: string | undefined;
513
+ thinking?: boolean | undefined;
514
+ }, {
515
+ env?: Record<string, string> | undefined;
516
+ visibility?: "private" | "public" | "workspace" | "group" | undefined;
517
+ cwd?: string | undefined;
518
+ mode?: "smart" | "rush" | "large" | "deep" | undefined;
519
+ dangerouslyAllowAll?: boolean | undefined;
520
+ archive?: boolean | undefined;
521
+ settingsFile?: string | undefined;
522
+ logLevel?: "debug" | "info" | "warn" | "error" | "audit" | undefined;
523
+ logFile?: string | undefined;
524
+ mcpConfig?: string | Record<string, {
525
+ command: string;
526
+ args?: string[] | undefined;
527
+ env?: Record<string, string> | undefined;
528
+ disabled?: boolean | undefined;
529
+ } | {
530
+ url: string;
531
+ disabled?: boolean | undefined;
532
+ headers?: Record<string, string> | undefined;
533
+ transport?: string | undefined;
534
+ oauth?: {
535
+ clientId: string;
536
+ authUrl: string;
537
+ tokenUrl: string;
538
+ clientSecret?: string | undefined;
539
+ scopes?: string[] | undefined;
540
+ redirectUrl?: string | undefined;
541
+ } | undefined;
542
+ }> | undefined;
543
+ continue?: string | boolean | undefined;
544
+ toolbox?: string | undefined;
545
+ skills?: string | undefined;
546
+ permissions?: {
547
+ tool: string;
548
+ action: "allow" | "reject" | "ask" | "delegate";
549
+ matches?: Record<string, PermissionMatchCondition> | undefined;
550
+ context?: "thread" | "subagent" | undefined;
551
+ to?: string | undefined;
552
+ }[] | undefined;
553
+ labels?: string[] | undefined;
554
+ enabledTools?: string[] | undefined;
555
+ systemPrompt?: string | undefined;
556
+ thinking?: boolean | undefined;
557
+ }>;
558
+ /** Configuration options for Amp execution */
559
+ export type AmpOptions = z.input<typeof AmpOptionsSchema>;
560
+ /**
561
+ * Configuration options for Amp execution after schema defaults are applied.
562
+ *
563
+ * Internal SDK helpers use this to work with fully validated options.
564
+ */
565
+ export type ResolvedAmpOptions = z.output<typeof AmpOptionsSchema>;
566
+ /** Input type for prompts - either a string or streaming user messages */
567
+ type PromptInput = string | AsyncIterable<UserInputMessage>;
568
+ /** Options for executing Amp commands */
569
+ export interface ExecuteOptions {
570
+ prompt: PromptInput;
571
+ options?: AmpOptions;
572
+ signal?: AbortSignal;
573
+ }
574
+ export {};
575
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Parse an Amp version string from CLI output.
3
+ */
4
+ export declare function parseAmpVersionFromOutput(output: string): string | null;
5
+ /**
6
+ * Extract the timestamp segment from an Amp CLI version.
7
+ */
8
+ export declare function extractAmpVersionTimestamp(version: string): number | null;
9
+ /**
10
+ * Checks whether an installed version is compatible with a minimum required version.
11
+ *
12
+ * Versions are timestamp-based. When parsing fails (or for dev builds like 0.0.0-dev),
13
+ * this returns true to avoid blocking environments that ship non-release labels.
14
+ */
15
+ export declare function isAmpVersionAtLeast(version: string, minimumVersion: string): boolean;
16
+ /**
17
+ * Reads the SDK's minimum compatible Amp CLI version from package metadata.
18
+ */
19
+ export declare function getMinimumCompatibleAmpVersion(): string | null;
20
+ //# sourceMappingURL=version-compatibility.d.ts.map
package/package.json CHANGED
@@ -1 +1,66 @@
1
- {"name":"@ampcode/sdk","version":"0.0.0-placeholder","description":"Placeholder package for npm configuration.","private":false,"license":"UNLICENSED"}
1
+ {
2
+ "amp": {
3
+ "minimumCliVersion": "latest"
4
+ },
5
+ "author": {
6
+ "name": "The Amp Team",
7
+ "email": "amp-devs@ampcode.com"
8
+ },
9
+ "bin": {
10
+ "amp-sdk": "bin/amp-sdk.js"
11
+ },
12
+ "dependencies": {
13
+ "zod": "^3.23.8"
14
+ },
15
+ "description": "TypeScript SDK for Amp CLI - Build custom AI agents with Amp's capabilities",
16
+ "engines": {
17
+ "node": ">=18"
18
+ },
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.js"
23
+ }
24
+ },
25
+ "files": [
26
+ "bin/amp-sdk.js",
27
+ "dist/**/*.js",
28
+ "dist/**/*.d.ts",
29
+ "!dist/**/*.map",
30
+ "README.md"
31
+ ],
32
+ "homepage": "https://ampcode.com/",
33
+ "keywords": [
34
+ "ai",
35
+ "agent",
36
+ "amp",
37
+ "sourcegraph",
38
+ "cli",
39
+ "typescript",
40
+ "sdk",
41
+ "automation"
42
+ ],
43
+ "license": "Amp Commercial License",
44
+ "main": "dist/index.js",
45
+ "name": "@ampcode/sdk",
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/sourcegraph/amp.git",
49
+ "directory": "sdk/typescript"
50
+ },
51
+ "type": "module",
52
+ "types": "dist/index.d.ts",
53
+ "version": "0.1.0-20260513070248-g548495c",
54
+ "scripts": {
55
+ "build": "bun run scripts/build.ts",
56
+ "dev": "pnpm exec tsc -b --watch",
57
+ "clean": "rm -rf dist tsconfig.tsbuildinfo",
58
+ "cli:install": "node ./bin/amp-sdk.js install",
59
+ "cli:pin-version": "bun run scripts/pin-cli-version.ts",
60
+ "examples": "pnpm run build && bun run examples/execute.ts -- && bun run examples/threads.ts --",
61
+ "test": "vitest run",
62
+ "test:watch": "vitest",
63
+ "test:integration": "vitest run --config vitest.integration.config.js",
64
+ "pin-cli-version": "pnpm run cli:pin-version"
65
+ }
66
+ }