diff --git a/packages/cli/src/config/settingsSchema.test.ts b/packages/cli/src/config/settingsSchema.test.ts index e8d0216f33f..78bc1c391d0 100644 --- a/packages/cli/src/config/settingsSchema.test.ts +++ b/packages/cli/src/config/settingsSchema.test.ts @@ -25,6 +25,21 @@ import { describe('SettingsSchema', () => { describe('getSettingsSchema', () => { + it('should describe prompt hooks supported by the runtime', () => { + const hookProperties = + getSettingsSchema().hooks.properties.PreToolUse.items.properties?.[ + 'hooks' + ]?.items?.properties; + + expect(hookProperties?.['type']?.enum).toEqual([ + 'command', + 'http', + 'prompt', + ]); + expect(hookProperties?.['prompt']).toMatchObject({ type: 'string' }); + expect(hookProperties?.['model']).toMatchObject({ type: 'string' }); + }); + it('should contain all expected top-level settings', () => { const expectedSettings: Array = [ 'mcpServers', diff --git a/packages/cli/src/config/settingsSchema.ts b/packages/cli/src/config/settingsSchema.ts index e81a11868ea..f57cb29f799 100644 --- a/packages/cli/src/config/settingsSchema.ts +++ b/packages/cli/src/config/settingsSchema.ts @@ -202,7 +202,7 @@ const HOOK_DEFINITION_ITEMS: SettingItemDefinition = { type: 'string', description: 'The type of hook. Note: "function" type is only available via SDK registration, not settings.json.', - enum: ['command', 'http'], + enum: ['command', 'http', 'prompt'], required: true, }, command: { @@ -215,6 +215,15 @@ const HOOK_DEFINITION_ITEMS: SettingItemDefinition = { description: 'The URL to send the POST request to. Required for "http" type.', }, + prompt: { + type: 'string', + description: + 'The prompt to send to the model. Required for "prompt" type.', + }, + model: { + type: 'string', + description: 'The optional model to use for a "prompt" hook.', + }, headers: { type: 'object', description: diff --git a/packages/vscode-ide-companion/schemas/settings.schema.json b/packages/vscode-ide-companion/schemas/settings.schema.json index e5dd3afa252..670a982e667 100644 --- a/packages/vscode-ide-companion/schemas/settings.schema.json +++ b/packages/vscode-ide-companion/schemas/settings.schema.json @@ -1663,7 +1663,8 @@ "type": "string", "enum": [ "command", - "http" + "http", + "prompt" ] }, "command": { @@ -1674,6 +1675,14 @@ "description": "The URL to send the POST request to. Required for \"http\" type.", "type": "string" }, + "prompt": { + "description": "The prompt to send to the model. Required for \"prompt\" type.", + "type": "string" + }, + "model": { + "description": "The optional model to use for a \"prompt\" hook.", + "type": "string" + }, "headers": { "description": "HTTP headers to include in the request. Supports env var interpolation ($VAR, ${VAR}).", "type": "object", @@ -1766,7 +1775,8 @@ "type": "string", "enum": [ "command", - "http" + "http", + "prompt" ] }, "command": { @@ -1777,6 +1787,14 @@ "description": "The URL to send the POST request to. Required for \"http\" type.", "type": "string" }, + "prompt": { + "description": "The prompt to send to the model. Required for \"prompt\" type.", + "type": "string" + }, + "model": { + "description": "The optional model to use for a \"prompt\" hook.", + "type": "string" + }, "headers": { "description": "HTTP headers to include in the request. Supports env var interpolation ($VAR, ${VAR}).", "type": "object", @@ -1869,7 +1887,8 @@ "type": "string", "enum": [ "command", - "http" + "http", + "prompt" ] }, "command": { @@ -1880,6 +1899,14 @@ "description": "The URL to send the POST request to. Required for \"http\" type.", "type": "string" }, + "prompt": { + "description": "The prompt to send to the model. Required for \"prompt\" type.", + "type": "string" + }, + "model": { + "description": "The optional model to use for a \"prompt\" hook.", + "type": "string" + }, "headers": { "description": "HTTP headers to include in the request. Supports env var interpolation ($VAR, ${VAR}).", "type": "object", @@ -1972,7 +1999,8 @@ "type": "string", "enum": [ "command", - "http" + "http", + "prompt" ] }, "command": { @@ -1983,6 +2011,14 @@ "description": "The URL to send the POST request to. Required for \"http\" type.", "type": "string" }, + "prompt": { + "description": "The prompt to send to the model. Required for \"prompt\" type.", + "type": "string" + }, + "model": { + "description": "The optional model to use for a \"prompt\" hook.", + "type": "string" + }, "headers": { "description": "HTTP headers to include in the request. Supports env var interpolation ($VAR, ${VAR}).", "type": "object", @@ -2075,7 +2111,8 @@ "type": "string", "enum": [ "command", - "http" + "http", + "prompt" ] }, "command": { @@ -2086,6 +2123,14 @@ "description": "The URL to send the POST request to. Required for \"http\" type.", "type": "string" }, + "prompt": { + "description": "The prompt to send to the model. Required for \"prompt\" type.", + "type": "string" + }, + "model": { + "description": "The optional model to use for a \"prompt\" hook.", + "type": "string" + }, "headers": { "description": "HTTP headers to include in the request. Supports env var interpolation ($VAR, ${VAR}).", "type": "object", @@ -2178,7 +2223,8 @@ "type": "string", "enum": [ "command", - "http" + "http", + "prompt" ] }, "command": { @@ -2189,6 +2235,14 @@ "description": "The URL to send the POST request to. Required for \"http\" type.", "type": "string" }, + "prompt": { + "description": "The prompt to send to the model. Required for \"prompt\" type.", + "type": "string" + }, + "model": { + "description": "The optional model to use for a \"prompt\" hook.", + "type": "string" + }, "headers": { "description": "HTTP headers to include in the request. Supports env var interpolation ($VAR, ${VAR}).", "type": "object", @@ -2281,7 +2335,8 @@ "type": "string", "enum": [ "command", - "http" + "http", + "prompt" ] }, "command": { @@ -2292,6 +2347,14 @@ "description": "The URL to send the POST request to. Required for \"http\" type.", "type": "string" }, + "prompt": { + "description": "The prompt to send to the model. Required for \"prompt\" type.", + "type": "string" + }, + "model": { + "description": "The optional model to use for a \"prompt\" hook.", + "type": "string" + }, "headers": { "description": "HTTP headers to include in the request. Supports env var interpolation ($VAR, ${VAR}).", "type": "object", @@ -2384,7 +2447,8 @@ "type": "string", "enum": [ "command", - "http" + "http", + "prompt" ] }, "command": { @@ -2395,6 +2459,14 @@ "description": "The URL to send the POST request to. Required for \"http\" type.", "type": "string" }, + "prompt": { + "description": "The prompt to send to the model. Required for \"prompt\" type.", + "type": "string" + }, + "model": { + "description": "The optional model to use for a \"prompt\" hook.", + "type": "string" + }, "headers": { "description": "HTTP headers to include in the request. Supports env var interpolation ($VAR, ${VAR}).", "type": "object", @@ -2487,7 +2559,8 @@ "type": "string", "enum": [ "command", - "http" + "http", + "prompt" ] }, "command": { @@ -2498,6 +2571,14 @@ "description": "The URL to send the POST request to. Required for \"http\" type.", "type": "string" }, + "prompt": { + "description": "The prompt to send to the model. Required for \"prompt\" type.", + "type": "string" + }, + "model": { + "description": "The optional model to use for a \"prompt\" hook.", + "type": "string" + }, "headers": { "description": "HTTP headers to include in the request. Supports env var interpolation ($VAR, ${VAR}).", "type": "object", @@ -2590,7 +2671,8 @@ "type": "string", "enum": [ "command", - "http" + "http", + "prompt" ] }, "command": { @@ -2601,6 +2683,14 @@ "description": "The URL to send the POST request to. Required for \"http\" type.", "type": "string" }, + "prompt": { + "description": "The prompt to send to the model. Required for \"prompt\" type.", + "type": "string" + }, + "model": { + "description": "The optional model to use for a \"prompt\" hook.", + "type": "string" + }, "headers": { "description": "HTTP headers to include in the request. Supports env var interpolation ($VAR, ${VAR}).", "type": "object", @@ -2693,7 +2783,8 @@ "type": "string", "enum": [ "command", - "http" + "http", + "prompt" ] }, "command": { @@ -2704,6 +2795,14 @@ "description": "The URL to send the POST request to. Required for \"http\" type.", "type": "string" }, + "prompt": { + "description": "The prompt to send to the model. Required for \"prompt\" type.", + "type": "string" + }, + "model": { + "description": "The optional model to use for a \"prompt\" hook.", + "type": "string" + }, "headers": { "description": "HTTP headers to include in the request. Supports env var interpolation ($VAR, ${VAR}).", "type": "object", @@ -2796,7 +2895,8 @@ "type": "string", "enum": [ "command", - "http" + "http", + "prompt" ] }, "command": { @@ -2807,6 +2907,14 @@ "description": "The URL to send the POST request to. Required for \"http\" type.", "type": "string" }, + "prompt": { + "description": "The prompt to send to the model. Required for \"prompt\" type.", + "type": "string" + }, + "model": { + "description": "The optional model to use for a \"prompt\" hook.", + "type": "string" + }, "headers": { "description": "HTTP headers to include in the request. Supports env var interpolation ($VAR, ${VAR}).", "type": "object", @@ -2899,7 +3007,8 @@ "type": "string", "enum": [ "command", - "http" + "http", + "prompt" ] }, "command": { @@ -2910,6 +3019,14 @@ "description": "The URL to send the POST request to. Required for \"http\" type.", "type": "string" }, + "prompt": { + "description": "The prompt to send to the model. Required for \"prompt\" type.", + "type": "string" + }, + "model": { + "description": "The optional model to use for a \"prompt\" hook.", + "type": "string" + }, "headers": { "description": "HTTP headers to include in the request. Supports env var interpolation ($VAR, ${VAR}).", "type": "object", @@ -3002,7 +3119,8 @@ "type": "string", "enum": [ "command", - "http" + "http", + "prompt" ] }, "command": { @@ -3013,6 +3131,14 @@ "description": "The URL to send the POST request to. Required for \"http\" type.", "type": "string" }, + "prompt": { + "description": "The prompt to send to the model. Required for \"prompt\" type.", + "type": "string" + }, + "model": { + "description": "The optional model to use for a \"prompt\" hook.", + "type": "string" + }, "headers": { "description": "HTTP headers to include in the request. Supports env var interpolation ($VAR, ${VAR}).", "type": "object", @@ -3105,7 +3231,8 @@ "type": "string", "enum": [ "command", - "http" + "http", + "prompt" ] }, "command": { @@ -3116,6 +3243,14 @@ "description": "The URL to send the POST request to. Required for \"http\" type.", "type": "string" }, + "prompt": { + "description": "The prompt to send to the model. Required for \"prompt\" type.", + "type": "string" + }, + "model": { + "description": "The optional model to use for a \"prompt\" hook.", + "type": "string" + }, "headers": { "description": "HTTP headers to include in the request. Supports env var interpolation ($VAR, ${VAR}).", "type": "object", @@ -3208,7 +3343,8 @@ "type": "string", "enum": [ "command", - "http" + "http", + "prompt" ] }, "command": { @@ -3219,6 +3355,14 @@ "description": "The URL to send the POST request to. Required for \"http\" type.", "type": "string" }, + "prompt": { + "description": "The prompt to send to the model. Required for \"prompt\" type.", + "type": "string" + }, + "model": { + "description": "The optional model to use for a \"prompt\" hook.", + "type": "string" + }, "headers": { "description": "HTTP headers to include in the request. Supports env var interpolation ($VAR, ${VAR}).", "type": "object", @@ -3311,7 +3455,8 @@ "type": "string", "enum": [ "command", - "http" + "http", + "prompt" ] }, "command": { @@ -3322,6 +3467,14 @@ "description": "The URL to send the POST request to. Required for \"http\" type.", "type": "string" }, + "prompt": { + "description": "The prompt to send to the model. Required for \"prompt\" type.", + "type": "string" + }, + "model": { + "description": "The optional model to use for a \"prompt\" hook.", + "type": "string" + }, "headers": { "description": "HTTP headers to include in the request. Supports env var interpolation ($VAR, ${VAR}).", "type": "object",