@sourcegraph/amp-sdk 0.1.0-20251126160117-g66ad0bc → 0.1.0-20251210024534-g1cd2680
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 +23 -0
- package/dist/index.js +10 -3
- package/dist/types.d.ts +3 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -189,6 +189,27 @@ for await (const message of execute({
|
|
|
189
189
|
}
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
+
### Agent Mode
|
|
193
|
+
|
|
194
|
+
Select which agent mode to use. The mode controls the model, system prompt, and tool selection:
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
for await (const message of execute({
|
|
198
|
+
prompt: 'Quickly fix this typo',
|
|
199
|
+
options: {
|
|
200
|
+
mode: 'rush', // Use rush mode for faster responses
|
|
201
|
+
},
|
|
202
|
+
})) {
|
|
203
|
+
// Process messages
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Available modes:
|
|
208
|
+
|
|
209
|
+
- **smart** (default): Balanced mode with full capabilities
|
|
210
|
+
- **rush**: Faster responses with streamlined tool usage
|
|
211
|
+
- **large**: Extended context for complex tasks
|
|
212
|
+
|
|
192
213
|
### Tool Permissions
|
|
193
214
|
|
|
194
215
|
Control which tools Amp can use with fine-grained permissions:
|
|
@@ -548,6 +569,7 @@ Configuration options that map to Amp CLI flags.
|
|
|
548
569
|
```typescript
|
|
549
570
|
interface AmpOptions {
|
|
550
571
|
cwd?: string
|
|
572
|
+
mode?: 'smart' | 'rush' | 'large'
|
|
551
573
|
dangerouslyAllowAll?: boolean
|
|
552
574
|
visibility?: 'public' | 'private' | 'workspace' | 'group'
|
|
553
575
|
settingsFile?: string
|
|
@@ -566,6 +588,7 @@ interface AmpOptions {
|
|
|
566
588
|
| Property | Type | Default | Description |
|
|
567
589
|
| --------------------- | --------------------------------------------------- | --------------- | ------------------------------------------------------------------------ |
|
|
568
590
|
| `cwd` | `string` | `process.cwd()` | Current working directory for execution |
|
|
591
|
+
| `mode` | `'smart' \| 'rush' \| 'large'` | `'smart'` | Agent mode - controls model, system prompt, and tool selection |
|
|
569
592
|
| `dangerouslyAllowAll` | `boolean` | `false` | Allow all tool usage without permission prompts |
|
|
570
593
|
| `visibility` | `'public' \| 'private' \| 'workspace' \| 'group'` | `'workspace'` | Thread visibility level |
|
|
571
594
|
| `settingsFile` | `string` | - | Path to custom settings file |
|
package/dist/index.js
CHANGED
|
@@ -4041,6 +4041,7 @@ var MCPServerSchema = exports_external.object({
|
|
|
4041
4041
|
var MCPConfigSchema = exports_external.record(exports_external.string(), MCPServerSchema).describe("MCP server configurations keyed by server name");
|
|
4042
4042
|
var AmpOptionsSchema = exports_external.object({
|
|
4043
4043
|
cwd: exports_external.string().describe("Current working directory").optional(),
|
|
4044
|
+
mode: exports_external.enum(["smart", "rush", "large"]).describe("Agent mode - controls the model, system prompt, and tool selection").default("smart").optional(),
|
|
4044
4045
|
dangerouslyAllowAll: exports_external.boolean().describe("Allow all tool usage without asking for permission").optional(),
|
|
4045
4046
|
visibility: exports_external.enum(["private", "public", "workspace", "group"]).describe("Visibility level for new threads").default("workspace").optional(),
|
|
4046
4047
|
settingsFile: exports_external.string().describe("Settings file path").optional(),
|
|
@@ -4112,7 +4113,7 @@ function generateSessionId() {
|
|
|
4112
4113
|
return `sdk-${Date.now()}-${randomHex}`;
|
|
4113
4114
|
}
|
|
4114
4115
|
async function buildSettingsFile(options, sessionId) {
|
|
4115
|
-
if (!options.permissions) {
|
|
4116
|
+
if (!options.permissions && !options.mode) {
|
|
4116
4117
|
return {
|
|
4117
4118
|
settingsFilePath: null,
|
|
4118
4119
|
cleanupTempFile: async () => {}
|
|
@@ -4133,6 +4134,9 @@ async function buildSettingsFile(options, sessionId) {
|
|
|
4133
4134
|
}
|
|
4134
4135
|
}
|
|
4135
4136
|
mergedSettings["amp.permissions"] = options.permissions;
|
|
4137
|
+
if (options.mode === "large") {
|
|
4138
|
+
mergedSettings["amp.internal.visibleModes"] = (mergedSettings["amp.internal.visibleModes"] ?? []).concat("large");
|
|
4139
|
+
}
|
|
4136
4140
|
await mkdir(tempDir, { recursive: true });
|
|
4137
4141
|
await writeFile(tempSettingsPath, JSON.stringify(mergedSettings, null, 2), "utf-8");
|
|
4138
4142
|
return {
|
|
@@ -4154,7 +4158,7 @@ function buildEnvironmentVariables(options) {
|
|
|
4154
4158
|
if (options.env) {
|
|
4155
4159
|
Object.assign(env, options.env);
|
|
4156
4160
|
}
|
|
4157
|
-
env.AMP_SDK_VERSION = "0.1.0-
|
|
4161
|
+
env.AMP_SDK_VERSION = "0.1.0-20251210024534-g1cd2680";
|
|
4158
4162
|
return env;
|
|
4159
4163
|
}
|
|
4160
4164
|
function spawnAmpCli(args, options) {
|
|
@@ -4217,6 +4221,9 @@ function buildCliArgs(options) {
|
|
|
4217
4221
|
const mcpConfigValue = typeof options.mcpConfig === "string" ? options.mcpConfig : JSON.stringify(options.mcpConfig);
|
|
4218
4222
|
args.push("--mcp-config", mcpConfigValue);
|
|
4219
4223
|
}
|
|
4224
|
+
if (options.mode) {
|
|
4225
|
+
args.push("--mode", options.mode);
|
|
4226
|
+
}
|
|
4220
4227
|
return args;
|
|
4221
4228
|
}
|
|
4222
4229
|
async function* processOutputStream(stdout) {
|
|
@@ -4355,4 +4362,4 @@ export {
|
|
|
4355
4362
|
AmpOptionsSchema
|
|
4356
4363
|
};
|
|
4357
4364
|
|
|
4358
|
-
//# debugId=
|
|
4365
|
+
//# debugId=C82A9EDD95F7E62564756E2164756E21
|
package/dist/types.d.ts
CHANGED
|
@@ -225,6 +225,7 @@ export type MCPConfig = z.infer<typeof MCPConfigSchema>;
|
|
|
225
225
|
/** Configuration options for Amp execution schema */
|
|
226
226
|
export declare const AmpOptionsSchema: z.ZodObject<{
|
|
227
227
|
cwd: z.ZodOptional<z.ZodString>;
|
|
228
|
+
mode: z.ZodOptional<z.ZodDefault<z.ZodEnum<["smart", "rush", "large"]>>>;
|
|
228
229
|
dangerouslyAllowAll: z.ZodOptional<z.ZodBoolean>;
|
|
229
230
|
visibility: z.ZodOptional<z.ZodDefault<z.ZodEnum<["private", "public", "workspace", "group"]>>>;
|
|
230
231
|
settingsFile: z.ZodOptional<z.ZodString>;
|
|
@@ -283,6 +284,7 @@ export declare const AmpOptionsSchema: z.ZodObject<{
|
|
|
283
284
|
}, "strict", z.ZodTypeAny, {
|
|
284
285
|
env?: Record<string, string> | undefined;
|
|
285
286
|
cwd?: string | undefined;
|
|
287
|
+
mode?: "smart" | "rush" | "large" | undefined;
|
|
286
288
|
dangerouslyAllowAll?: boolean | undefined;
|
|
287
289
|
visibility?: "private" | "public" | "workspace" | "group" | undefined;
|
|
288
290
|
settingsFile?: string | undefined;
|
|
@@ -306,6 +308,7 @@ export declare const AmpOptionsSchema: z.ZodObject<{
|
|
|
306
308
|
}, {
|
|
307
309
|
env?: Record<string, string> | undefined;
|
|
308
310
|
cwd?: string | undefined;
|
|
311
|
+
mode?: "smart" | "rush" | "large" | undefined;
|
|
309
312
|
dangerouslyAllowAll?: boolean | undefined;
|
|
310
313
|
visibility?: "private" | "public" | "workspace" | "group" | undefined;
|
|
311
314
|
settingsFile?: string | undefined;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": {
|
|
3
|
-
"name": "The Amp Team
|
|
4
|
-
"email": "amp-devs@
|
|
3
|
+
"name": "The Amp Team",
|
|
4
|
+
"email": "amp-devs@ampcode.com"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@sourcegraph/amp": "latest",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"sdk",
|
|
35
35
|
"automation"
|
|
36
36
|
],
|
|
37
|
-
"license": "
|
|
37
|
+
"license": "Amp Commercial License",
|
|
38
38
|
"main": "dist/index.js",
|
|
39
39
|
"name": "@sourcegraph/amp-sdk",
|
|
40
40
|
"repository": {
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
},
|
|
45
45
|
"type": "module",
|
|
46
46
|
"types": "dist/index.d.ts",
|
|
47
|
-
"version": "0.1.0-
|
|
47
|
+
"version": "0.1.0-20251210024534-g1cd2680",
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "bun run scripts/build.ts",
|
|
50
50
|
"dev": "pnpm exec tsc -b --watch",
|
|
51
51
|
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
52
|
-
"examples:basic": "pnpm run build && bun run examples/basic.ts",
|
|
52
|
+
"examples:basic": "pnpm run build && bun run examples/basic.ts --",
|
|
53
53
|
"test": "vitest run",
|
|
54
54
|
"test:watch": "vitest",
|
|
55
55
|
"test:integration": "vitest run --config vitest.integration.config.js",
|