@sourcegraph/amp-sdk 0.1.0-20260119121704-g1d8d764 → 0.1.0-20260119163454-ge1dfc84

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 CHANGED
@@ -12,7 +12,7 @@ The Amp TypeScript SDK brings the Amp agent directly into your applications with
12
12
  - **Thread Continuity**: Continue an existing thread (latest or by ID) to build stateful agent workflows
13
13
  - **Programmatic Settings**: Configure working directories, settings, and tools without user prompts — ideal for automation
14
14
  - **MCP Integration**: Extend Amp with custom Model Context Protocol servers and tools
15
- - **Custom Tools**: Define and use custom tools to extend Amp's functionality with Toolboxes
15
+ - **Custom Skills**: Define and use custom agent skills to extend Amp's functionality
16
16
 
17
17
  ## What can you build?
18
18
 
@@ -416,6 +416,23 @@ for await (const message of execute({
416
416
 
417
417
  To find out more about Amp Toolboxes, see the [Toolboxes](https://ampcode.com/manual#toolboxes) section of the Amp documentation.
418
418
 
419
+ ### Custom Skills
420
+
421
+ Load custom skills from a specified directory:
422
+
423
+ ```typescript
424
+ for await (const message of execute({
425
+ prompt: 'Use my custom deployment skill',
426
+ options: {
427
+ skills: './my-skills', // Path to custom skills directory
428
+ },
429
+ })) {
430
+ // Process messages
431
+ }
432
+ ```
433
+
434
+ To learn more about creating custom skills, see the [Agent Skills](https://ampcode.com/manual#agent-skills) section of the Amp documentation.
435
+
419
436
  ## Functions
420
437
 
421
438
  ### execute()
@@ -578,6 +595,7 @@ interface AmpOptions {
578
595
  env?: Record<string, string>
579
596
  continue?: boolean | string
580
597
  toolbox?: string
598
+ skills?: string
581
599
  permissions?: Permission[]
582
600
  }
583
601
  ```
@@ -597,6 +615,7 @@ interface AmpOptions {
597
615
  | `mcpConfig` | `string \| MCPConfig` | - | MCP server configuration as JSON string, or config object |
598
616
  | `env` | `Record<string, string>` | - | Additional environment variables |
599
617
  | `toolbox` | `string` | - | Folder path with toolbox scripts |
618
+ | `skills` | `string` | - | Folder path with custom skills |
600
619
  | `permissions` | [`Permission[]`](#permission) | - | Permission rules for tool usage |
601
620
 
602
621
  ## Message Types
package/dist/index.js CHANGED
@@ -4051,6 +4051,7 @@ var AmpOptionsSchema = exports_external.object({
4051
4051
  env: exports_external.record(exports_external.string(), exports_external.string()).describe("Additional environment variables").optional(),
4052
4052
  continue: exports_external.union([exports_external.boolean(), exports_external.string()]).describe("Continue the most recent thread (true) or a specific thread by ID (string)").optional(),
4053
4053
  toolbox: exports_external.string().describe("Folder path with toolbox scripts").optional(),
4054
+ skills: exports_external.string().describe("Folder path with custom skills").optional(),
4054
4055
  permissions: exports_external.array(PermissionSchema).describe("Permission rules for tool usage").optional(),
4055
4056
  enabledTools: exports_external.array(exports_external.string()).describe('Array of tool name patterns to enable. Supports glob patterns (e.g., "mcp__metabase__*"). If not provided, all tools are enabled. If provided, only matching tools are enabled.').optional(),
4056
4057
  systemPrompt: exports_external.string().describe("Custom system prompt text to append to the base system prompt for integration-specific customizations").optional()
@@ -4115,7 +4116,14 @@ function generateSessionId() {
4115
4116
  return `sdk-${Date.now()}-${randomHex}`;
4116
4117
  }
4117
4118
  async function buildSettingsFile(options, sessionId) {
4118
- if (!options.permissions && !options.mode && !options.enabledTools && !options.systemPrompt) {
4119
+ const settingsFields = [
4120
+ options.permissions,
4121
+ options.mode,
4122
+ options.skills,
4123
+ options.enabledTools,
4124
+ options.systemPrompt
4125
+ ];
4126
+ if (!settingsFields.some(Boolean)) {
4119
4127
  return {
4120
4128
  settingsFilePath: null,
4121
4129
  cleanupTempFile: async () => {}
@@ -4127,8 +4135,8 @@ async function buildSettingsFile(options, sessionId) {
4127
4135
  let mergedSettings = {};
4128
4136
  if (options.settingsFile) {
4129
4137
  try {
4130
- const settingsContent2 = await readFile(options.settingsFile, "utf-8");
4131
- mergedSettings = JSON.parse(settingsContent2);
4138
+ const settingsContent = await readFile(options.settingsFile, "utf-8");
4139
+ mergedSettings = JSON.parse(settingsContent);
4132
4140
  } catch (error) {
4133
4141
  if (error.code !== "ENOENT") {
4134
4142
  throw new Error(`Failed to read settings file ${options.settingsFile}: ${error instanceof Error ? error.message : String(error)}`);
@@ -4147,10 +4155,12 @@ async function buildSettingsFile(options, sessionId) {
4147
4155
  if (options.mode === "large") {
4148
4156
  mergedSettings["amp.internal.visibleModes"] = (mergedSettings["amp.internal.visibleModes"] ?? []).concat("large");
4149
4157
  }
4158
+ if (options.skills) {
4159
+ mergedSettings["amp.skills.path"] = options.skills;
4160
+ }
4150
4161
  await mkdir(tempDir, { recursive: true });
4151
- const settingsContent = JSON.stringify(mergedSettings, null, 2);
4152
- console.log("[SDK] Writing settings file:", tempSettingsPath, settingsContent);
4153
- await writeFile(tempSettingsPath, settingsContent, "utf-8");
4162
+ console.log("[SDK] Writing settings file:", tempSettingsPath, mergedSettings);
4163
+ await writeFile(tempSettingsPath, JSON.stringify(mergedSettings, null, 2), "utf-8");
4154
4164
  return {
4155
4165
  settingsFilePath: tempSettingsPath,
4156
4166
  cleanupTempFile: async () => {
@@ -4170,7 +4180,7 @@ function buildEnvironmentVariables(options) {
4170
4180
  if (options.env) {
4171
4181
  Object.assign(env, options.env);
4172
4182
  }
4173
- env.AMP_SDK_VERSION = "0.1.0-20260119121704-g1d8d764";
4183
+ env.AMP_SDK_VERSION = "0.1.0-20260119163454-ge1dfc84";
4174
4184
  return env;
4175
4185
  }
4176
4186
  function spawnAmpCli(args, options) {
@@ -4374,4 +4384,4 @@ export {
4374
4384
  AmpOptionsSchema
4375
4385
  };
4376
4386
 
4377
- //# debugId=C85BB482A02216E864756E2164756E21
4387
+ //# debugId=C0C631A5086DC23F64756E2164756E21
package/dist/types.d.ts CHANGED
@@ -250,6 +250,7 @@ export declare const AmpOptionsSchema: z.ZodObject<{
250
250
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
251
251
  continue: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString]>>;
252
252
  toolbox: z.ZodOptional<z.ZodString>;
253
+ skills: z.ZodOptional<z.ZodString>;
253
254
  permissions: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
254
255
  tool: z.ZodString;
255
256
  matches: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<PermissionMatchCondition, z.ZodTypeDef, PermissionMatchCondition>>>;
@@ -300,6 +301,7 @@ export declare const AmpOptionsSchema: z.ZodObject<{
300
301
  }> | undefined;
301
302
  continue?: string | boolean | undefined;
302
303
  toolbox?: string | undefined;
304
+ skills?: string | undefined;
303
305
  permissions?: {
304
306
  tool: string;
305
307
  action: "allow" | "reject" | "ask" | "delegate";
@@ -326,6 +328,7 @@ export declare const AmpOptionsSchema: z.ZodObject<{
326
328
  }> | undefined;
327
329
  continue?: string | boolean | undefined;
328
330
  toolbox?: string | undefined;
331
+ skills?: string | undefined;
329
332
  permissions?: {
330
333
  tool: string;
331
334
  action: "allow" | "reject" | "ask" | "delegate";
package/package.json CHANGED
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "type": "module",
46
46
  "types": "dist/index.d.ts",
47
- "version": "0.1.0-20260119121704-g1d8d764",
47
+ "version": "0.1.0-20260119163454-ge1dfc84",
48
48
  "scripts": {
49
49
  "build": "bun run scripts/build.ts",
50
50
  "dev": "pnpm exec tsc -b --watch",