mirror of
https://github.com/angular/angular.git
synced 2026-11-23 07:05:14 -05:00
refactor(forms): set WebMCP annotation debugging: false
UI forms are necessarily for end users and not fit for debugging use cases. There might be some developer-only panels which include signal forms where this annotation might be appropriate, but we're keeping it simple for now and can expand if/when such use cases arise. See: https://groups.google.com/a/chromium.org/g/chrome-ai-dev-preview/c/8tQWCpY6gVA/m/nNy_31okEgAJ
This commit is contained in:
@@ -62,40 +62,6 @@ describe('declareExperimentalWebMcpTool', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should pass tool annotations to registerTool', async () => {
|
||||
const execute = jasmine.createSpy<Execute<JsonSchemaForInference>>('execute');
|
||||
const modelContext = (globalThis.document as any).modelContext;
|
||||
const registerSpy = spyOn(modelContext, 'registerTool').and.callThrough();
|
||||
|
||||
await declareExperimentalWebMcpTool(
|
||||
{
|
||||
name: 'annotatedTool',
|
||||
description: 'A tool with annotations',
|
||||
inputSchema: {type: 'object', properties: {}},
|
||||
execute,
|
||||
annotations: {
|
||||
readOnlyHint: true,
|
||||
untrustedContentHint: true,
|
||||
consequentialHint: true,
|
||||
debugging: true,
|
||||
},
|
||||
},
|
||||
Injector.create({providers: []}),
|
||||
);
|
||||
|
||||
expect(registerSpy).toHaveBeenCalledWith(
|
||||
jasmine.objectContaining({
|
||||
annotations: {
|
||||
readOnlyHint: true,
|
||||
untrustedContentHint: true,
|
||||
consequentialHint: true,
|
||||
debugging: true,
|
||||
},
|
||||
}),
|
||||
jasmine.anything(),
|
||||
);
|
||||
});
|
||||
|
||||
it('should throw if the tool is already registered', async () => {
|
||||
const injector = Injector.create({providers: []});
|
||||
|
||||
|
||||
@@ -74,8 +74,8 @@ export interface FormOptions<TModel> {
|
||||
* Set of configuration values extending the core tool behavior.
|
||||
*/
|
||||
annotations?: {
|
||||
// `readOnlyHint` and `untrustedContentHint` are intentionally omitted as they have
|
||||
// hard-coded values.
|
||||
// `readOnlyHint`, `untrustedContentHint`, and `debugging` are intentionally omitted as they
|
||||
// have hard-coded values.
|
||||
|
||||
/**
|
||||
* A hint that the tool will have consequential effects like mutating state or interacting
|
||||
|
||||
@@ -65,6 +65,9 @@ async function initWebMcpForm(
|
||||
// Response text is currently hard-coded by the framework and trusted or derived from application
|
||||
// errors which are considered trusted.
|
||||
untrustedContentHint: false,
|
||||
|
||||
// Forms are end-user UI elements, not developer-facing debugging tools.
|
||||
debugging: false,
|
||||
},
|
||||
execute: async (args: Record<string, unknown> | unknown[]) => {
|
||||
// Populate the form with changes from the agent.
|
||||
|
||||
@@ -64,6 +64,7 @@ describe('Signal Forms WebMCP Integration', () => {
|
||||
annotations: {
|
||||
readOnlyHint: false,
|
||||
untrustedContentHint: false,
|
||||
debugging: false,
|
||||
},
|
||||
}),
|
||||
jasmine.anything(),
|
||||
|
||||
Reference in New Issue
Block a user