@sourcegraph/amp-sdk 0.1.0-20251020161918-gf8ab86d → 0.1.0-20251022202704-gd85048a
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/dist/index.js +4289 -338
- package/dist/types.d.ts +12 -1
- package/package.json +2 -2
- package/dist/types.js +0 -127
package/dist/types.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export interface SystemMessage extends BaseMessage {
|
|
|
44
44
|
tools: string[];
|
|
45
45
|
mcp_servers: {
|
|
46
46
|
name: string;
|
|
47
|
-
status: 'connected' | 'connecting' | 'connection-failed';
|
|
47
|
+
status: 'connected' | 'connecting' | 'connection-failed' | 'disabled';
|
|
48
48
|
}[];
|
|
49
49
|
}
|
|
50
50
|
/** AI assistant response message with text and tool usage */
|
|
@@ -189,12 +189,15 @@ export declare const MCPServerSchema: z.ZodObject<{
|
|
|
189
189
|
command: z.ZodString;
|
|
190
190
|
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
191
191
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
192
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
192
193
|
}, "strip", z.ZodTypeAny, {
|
|
193
194
|
command: string;
|
|
195
|
+
disabled?: boolean | undefined;
|
|
194
196
|
args?: string[] | undefined;
|
|
195
197
|
env?: Record<string, string> | undefined;
|
|
196
198
|
}, {
|
|
197
199
|
command: string;
|
|
200
|
+
disabled?: boolean | undefined;
|
|
198
201
|
args?: string[] | undefined;
|
|
199
202
|
env?: Record<string, string> | undefined;
|
|
200
203
|
}>;
|
|
@@ -203,12 +206,15 @@ export declare const MCPConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
203
206
|
command: z.ZodString;
|
|
204
207
|
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
205
208
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
209
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
206
210
|
}, "strip", z.ZodTypeAny, {
|
|
207
211
|
command: string;
|
|
212
|
+
disabled?: boolean | undefined;
|
|
208
213
|
args?: string[] | undefined;
|
|
209
214
|
env?: Record<string, string> | undefined;
|
|
210
215
|
}, {
|
|
211
216
|
command: string;
|
|
217
|
+
disabled?: boolean | undefined;
|
|
212
218
|
args?: string[] | undefined;
|
|
213
219
|
env?: Record<string, string> | undefined;
|
|
214
220
|
}>>;
|
|
@@ -228,12 +234,15 @@ export declare const AmpOptionsSchema: z.ZodObject<{
|
|
|
228
234
|
command: z.ZodString;
|
|
229
235
|
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
230
236
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
237
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
231
238
|
}, "strip", z.ZodTypeAny, {
|
|
232
239
|
command: string;
|
|
240
|
+
disabled?: boolean | undefined;
|
|
233
241
|
args?: string[] | undefined;
|
|
234
242
|
env?: Record<string, string> | undefined;
|
|
235
243
|
}, {
|
|
236
244
|
command: string;
|
|
245
|
+
disabled?: boolean | undefined;
|
|
237
246
|
args?: string[] | undefined;
|
|
238
247
|
env?: Record<string, string> | undefined;
|
|
239
248
|
}>>]>>;
|
|
@@ -281,6 +290,7 @@ export declare const AmpOptionsSchema: z.ZodObject<{
|
|
|
281
290
|
logFile?: string | undefined;
|
|
282
291
|
mcpConfig?: string | Record<string, {
|
|
283
292
|
command: string;
|
|
293
|
+
disabled?: boolean | undefined;
|
|
284
294
|
args?: string[] | undefined;
|
|
285
295
|
env?: Record<string, string> | undefined;
|
|
286
296
|
}> | undefined;
|
|
@@ -303,6 +313,7 @@ export declare const AmpOptionsSchema: z.ZodObject<{
|
|
|
303
313
|
logFile?: string | undefined;
|
|
304
314
|
mcpConfig?: string | Record<string, {
|
|
305
315
|
command: string;
|
|
316
|
+
disabled?: boolean | undefined;
|
|
306
317
|
args?: string[] | undefined;
|
|
307
318
|
env?: Record<string, string> | undefined;
|
|
308
319
|
}> | undefined;
|
package/package.json
CHANGED
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
},
|
|
45
45
|
"type": "module",
|
|
46
46
|
"types": "dist/index.d.ts",
|
|
47
|
-
"version": "0.1.0-
|
|
47
|
+
"version": "0.1.0-20251022202704-gd85048a",
|
|
48
48
|
"scripts": {
|
|
49
|
-
"build": "
|
|
49
|
+
"build": "bun run scripts/build.ts",
|
|
50
50
|
"dev": "pnpm exec tsc -b --watch",
|
|
51
51
|
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
52
52
|
"examples:basic": "pnpm run build && bun run examples/basic.ts",
|
package/dist/types.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
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
|
-
// ============================================================================
|
|
8
|
-
// User Message Schemas & Types
|
|
9
|
-
// ============================================================================
|
|
10
|
-
/** User input message schema */
|
|
11
|
-
export const UserInputMessageSchema = z.object({
|
|
12
|
-
type: z.literal('user'),
|
|
13
|
-
message: z.object({
|
|
14
|
-
role: z.literal('user'),
|
|
15
|
-
content: z.array(z.object({
|
|
16
|
-
type: z.literal('text'),
|
|
17
|
-
text: z.string(),
|
|
18
|
-
})),
|
|
19
|
-
}),
|
|
20
|
-
});
|
|
21
|
-
/** Permission match condition for tool arguments schema */
|
|
22
|
-
export const PermissionMatchConditionSchema = z.lazy(() => z.union([
|
|
23
|
-
z.string().describe('Pattern match where "*" matches any number of any characters'),
|
|
24
|
-
z.array(PermissionMatchConditionSchema).min(1).describe('OR match of each entry'),
|
|
25
|
-
z.boolean().describe('A literal boolean match'),
|
|
26
|
-
z.number().describe('A literal number match'),
|
|
27
|
-
z.null().describe('A literal null match'),
|
|
28
|
-
z.undefined().describe('A literal undefined match'),
|
|
29
|
-
z
|
|
30
|
-
.record(z.string(), PermissionMatchConditionSchema)
|
|
31
|
-
.describe('Matching individual keys of an object'),
|
|
32
|
-
]));
|
|
33
|
-
/** Individual permission schema */
|
|
34
|
-
export const PermissionSchema = z
|
|
35
|
-
.object({
|
|
36
|
-
tool: z.string().min(1).describe('The name of the tool to which this entry applies'),
|
|
37
|
-
matches: z
|
|
38
|
-
.record(z.string(), PermissionMatchConditionSchema)
|
|
39
|
-
.optional()
|
|
40
|
-
.describe('Maps tool inputs to conditions'),
|
|
41
|
-
action: z
|
|
42
|
-
.enum(['allow', 'reject', 'ask', 'delegate'])
|
|
43
|
-
.describe('How Amp should proceed in case of a match'),
|
|
44
|
-
context: z
|
|
45
|
-
.enum(['thread', 'subagent'])
|
|
46
|
-
.optional()
|
|
47
|
-
.describe('Only apply this entry in this context'),
|
|
48
|
-
to: z
|
|
49
|
-
.string()
|
|
50
|
-
.min(1)
|
|
51
|
-
.optional()
|
|
52
|
-
.describe('Command to delegate to when action is "delegate"'),
|
|
53
|
-
})
|
|
54
|
-
.superRefine((data, ctx) => {
|
|
55
|
-
if (data.action === 'delegate' && !data.to) {
|
|
56
|
-
ctx.addIssue({
|
|
57
|
-
code: z.ZodIssueCode.custom,
|
|
58
|
-
message: 'delegate action requires "to" field',
|
|
59
|
-
path: ['to'],
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
if (data.action !== 'delegate' && data.to) {
|
|
63
|
-
ctx.addIssue({
|
|
64
|
-
code: z.ZodIssueCode.custom,
|
|
65
|
-
message: '"to" field only allowed with delegate action',
|
|
66
|
-
path: ['to'],
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
// ============================================================================
|
|
71
|
-
// MCP Schemas & Types
|
|
72
|
-
// ============================================================================
|
|
73
|
-
/** MCP server configuration schema */
|
|
74
|
-
export const MCPServerSchema = z.object({
|
|
75
|
-
command: z.string().describe('Command to run the MCP server'),
|
|
76
|
-
args: z.array(z.string()).describe('Arguments for the MCP server command').optional(),
|
|
77
|
-
env: z
|
|
78
|
-
.record(z.string(), z.string())
|
|
79
|
-
.describe('Environment variables for the server')
|
|
80
|
-
.optional(),
|
|
81
|
-
});
|
|
82
|
-
/** MCP configuration schema */
|
|
83
|
-
export const MCPConfigSchema = z
|
|
84
|
-
.record(z.string(), MCPServerSchema)
|
|
85
|
-
.describe('MCP server configurations keyed by server name');
|
|
86
|
-
// ============================================================================
|
|
87
|
-
// Execute Schemas & Types
|
|
88
|
-
// ============================================================================
|
|
89
|
-
/** Configuration options for Amp execution schema */
|
|
90
|
-
export const AmpOptionsSchema = z
|
|
91
|
-
.object({
|
|
92
|
-
cwd: z.string().describe('Current working directory').optional(),
|
|
93
|
-
dangerouslyAllowAll: z
|
|
94
|
-
.boolean()
|
|
95
|
-
.describe('Allow all tool usage without asking for permission')
|
|
96
|
-
.optional(),
|
|
97
|
-
visibility: z
|
|
98
|
-
.enum(['private', 'public', 'workspace', 'group'])
|
|
99
|
-
.describe('Visibility level for new threads')
|
|
100
|
-
.default('workspace')
|
|
101
|
-
.optional(),
|
|
102
|
-
settingsFile: z.string().describe('Settings file path').optional(),
|
|
103
|
-
logLevel: z
|
|
104
|
-
.enum(['debug', 'info', 'warn', 'error', 'audit'])
|
|
105
|
-
.describe('Log level')
|
|
106
|
-
.optional(),
|
|
107
|
-
logFile: z.string().describe('Log file path').optional(),
|
|
108
|
-
mcpConfig: z
|
|
109
|
-
.union([z.string(), MCPConfigSchema])
|
|
110
|
-
.describe('MCP server configuration as JSON string, path to JSON file, or config object')
|
|
111
|
-
.optional(),
|
|
112
|
-
env: z
|
|
113
|
-
.record(z.string(), z.string())
|
|
114
|
-
.describe('Additional environment variables')
|
|
115
|
-
.optional(),
|
|
116
|
-
continue: z
|
|
117
|
-
.union([z.boolean(), z.string()])
|
|
118
|
-
.describe('Continue the most recent thread (true) or a specific thread by ID (string)')
|
|
119
|
-
.optional(),
|
|
120
|
-
toolbox: z.string().describe('Folder path with toolbox scripts').optional(),
|
|
121
|
-
permissions: z
|
|
122
|
-
.array(PermissionSchema)
|
|
123
|
-
.describe('Permission rules for tool usage')
|
|
124
|
-
.optional(),
|
|
125
|
-
})
|
|
126
|
-
.strict();
|
|
127
|
-
//# sourceMappingURL=types.js.map
|