@sourcegraph/amp-sdk 0.1.0-20260116201008-g7bc0455 → 0.1.0-20260117003624-gea1dd82
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 +20 -8
- package/dist/types.d.ts +6 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4051,7 +4051,9 @@ 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
|
-
permissions: exports_external.array(PermissionSchema).describe("Permission rules for tool usage").optional()
|
|
4054
|
+
permissions: exports_external.array(PermissionSchema).describe("Permission rules for tool usage").optional(),
|
|
4055
|
+
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
|
+
systemPrompt: exports_external.string().describe("Custom system prompt text to append to the base system prompt for integration-specific customizations").optional()
|
|
4055
4057
|
}).strict();
|
|
4056
4058
|
|
|
4057
4059
|
// src/index.ts
|
|
@@ -4113,7 +4115,7 @@ function generateSessionId() {
|
|
|
4113
4115
|
return `sdk-${Date.now()}-${randomHex}`;
|
|
4114
4116
|
}
|
|
4115
4117
|
async function buildSettingsFile(options, sessionId) {
|
|
4116
|
-
if (!options.permissions && !options.mode) {
|
|
4118
|
+
if (!options.permissions && !options.mode && !options.enabledTools && !options.systemPrompt) {
|
|
4117
4119
|
return {
|
|
4118
4120
|
settingsFilePath: null,
|
|
4119
4121
|
cleanupTempFile: async () => {}
|
|
@@ -4125,20 +4127,30 @@ async function buildSettingsFile(options, sessionId) {
|
|
|
4125
4127
|
let mergedSettings = {};
|
|
4126
4128
|
if (options.settingsFile) {
|
|
4127
4129
|
try {
|
|
4128
|
-
const
|
|
4129
|
-
mergedSettings = JSON.parse(
|
|
4130
|
+
const settingsContent2 = await readFile(options.settingsFile, "utf-8");
|
|
4131
|
+
mergedSettings = JSON.parse(settingsContent2);
|
|
4130
4132
|
} catch (error) {
|
|
4131
4133
|
if (error.code !== "ENOENT") {
|
|
4132
4134
|
throw new Error(`Failed to read settings file ${options.settingsFile}: ${error instanceof Error ? error.message : String(error)}`);
|
|
4133
4135
|
}
|
|
4134
4136
|
}
|
|
4135
4137
|
}
|
|
4136
|
-
|
|
4138
|
+
if (options.permissions) {
|
|
4139
|
+
mergedSettings["amp.permissions"] = options.permissions;
|
|
4140
|
+
}
|
|
4141
|
+
if (options.enabledTools) {
|
|
4142
|
+
mergedSettings["amp.tools.enable"] = options.enabledTools;
|
|
4143
|
+
}
|
|
4144
|
+
if (options.systemPrompt) {
|
|
4145
|
+
mergedSettings["amp.systemPrompt"] = options.systemPrompt;
|
|
4146
|
+
}
|
|
4137
4147
|
if (options.mode === "large") {
|
|
4138
4148
|
mergedSettings["amp.internal.visibleModes"] = (mergedSettings["amp.internal.visibleModes"] ?? []).concat("large");
|
|
4139
4149
|
}
|
|
4140
4150
|
await mkdir(tempDir, { recursive: true });
|
|
4141
|
-
|
|
4151
|
+
const settingsContent = JSON.stringify(mergedSettings, null, 2);
|
|
4152
|
+
console.log("[SDK] Writing settings file:", tempSettingsPath, settingsContent);
|
|
4153
|
+
await writeFile(tempSettingsPath, settingsContent, "utf-8");
|
|
4142
4154
|
return {
|
|
4143
4155
|
settingsFilePath: tempSettingsPath,
|
|
4144
4156
|
cleanupTempFile: async () => {
|
|
@@ -4158,7 +4170,7 @@ function buildEnvironmentVariables(options) {
|
|
|
4158
4170
|
if (options.env) {
|
|
4159
4171
|
Object.assign(env, options.env);
|
|
4160
4172
|
}
|
|
4161
|
-
env.AMP_SDK_VERSION = "0.1.0-
|
|
4173
|
+
env.AMP_SDK_VERSION = "0.1.0-20260117003624-gea1dd82";
|
|
4162
4174
|
return env;
|
|
4163
4175
|
}
|
|
4164
4176
|
function spawnAmpCli(args, options) {
|
|
@@ -4362,4 +4374,4 @@ export {
|
|
|
4362
4374
|
AmpOptionsSchema
|
|
4363
4375
|
};
|
|
4364
4376
|
|
|
4365
|
-
//# debugId=
|
|
4377
|
+
//# debugId=035CE63CA011199E64756E2164756E21
|
package/dist/types.d.ts
CHANGED
|
@@ -281,6 +281,8 @@ export declare const AmpOptionsSchema: z.ZodObject<{
|
|
|
281
281
|
context?: "thread" | "subagent" | undefined;
|
|
282
282
|
to?: string | undefined;
|
|
283
283
|
}>, "many">>;
|
|
284
|
+
enabledTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
285
|
+
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
284
286
|
}, "strict", z.ZodTypeAny, {
|
|
285
287
|
env?: Record<string, string> | undefined;
|
|
286
288
|
cwd?: string | undefined;
|
|
@@ -305,6 +307,8 @@ export declare const AmpOptionsSchema: z.ZodObject<{
|
|
|
305
307
|
context?: "thread" | "subagent" | undefined;
|
|
306
308
|
to?: string | undefined;
|
|
307
309
|
}[] | undefined;
|
|
310
|
+
enabledTools?: string[] | undefined;
|
|
311
|
+
systemPrompt?: string | undefined;
|
|
308
312
|
}, {
|
|
309
313
|
env?: Record<string, string> | undefined;
|
|
310
314
|
cwd?: string | undefined;
|
|
@@ -329,6 +333,8 @@ export declare const AmpOptionsSchema: z.ZodObject<{
|
|
|
329
333
|
context?: "thread" | "subagent" | undefined;
|
|
330
334
|
to?: string | undefined;
|
|
331
335
|
}[] | undefined;
|
|
336
|
+
enabledTools?: string[] | undefined;
|
|
337
|
+
systemPrompt?: string | undefined;
|
|
332
338
|
}>;
|
|
333
339
|
/** Configuration options for Amp execution */
|
|
334
340
|
export type AmpOptions = z.infer<typeof AmpOptionsSchema>;
|
package/package.json
CHANGED