@@ -2,10 +2,7 @@ import assert from 'node:assert/strict';
22import { test } from 'vitest' ;
33import type { AgentDeviceClient } from '../../client/client-types.ts' ;
44import { createCommandToolExecutor , listCommandTools } from '../command-tools.ts' ;
5- import {
6- commandSupportsSettleObservation ,
7- resolveCommandRecordsSessionAction ,
8- } from '../../core/command-descriptor/registry.ts' ;
5+ import { resolveCommandRecordsSessionAction } from '../../core/command-descriptor/registry.ts' ;
96import { COMMAND_OUTPUT_SCHEMAS } from '../command-output-schemas.ts' ;
107import { AppError } from '@agent-device/kernel/errors' ;
118import { validateAgainstSchema } from './output-schema-validator.ts' ;
@@ -447,84 +444,6 @@ test('MCP tv remote outputSchema advertises button values', () => {
447444 ) ;
448445} ) ;
449446
450- // The closed dispatch shape each navigation command's runtime returns
451- // (packages/contracts/src/navigation.ts). `back` is the settle-capable one, so
452- // its published schema is this shape PLUS the opt-in `--settle` observation and
453- // nothing else; the other four must match verbatim.
454- const NAVIGATION_DISPATCH_SHAPES : Readonly <
455- Record < string , { properties : Record < string , unknown > ; required : readonly string [ ] } >
456- > = {
457- back : {
458- properties : {
459- action : { type : 'string' , const : 'back' } ,
460- mode : { type : 'string' , enum : [ 'in-app' , 'system' ] } ,
461- message : { type : 'string' } ,
462- } ,
463- required : [ 'action' , 'mode' , 'message' ] ,
464- } ,
465- home : {
466- properties : {
467- action : { type : 'string' , const : 'home' } ,
468- message : { type : 'string' } ,
469- } ,
470- required : [ 'action' , 'message' ] ,
471- } ,
472- orientation : {
473- properties : {
474- action : { type : 'string' , const : 'orientation' } ,
475- orientation : {
476- type : 'string' ,
477- enum : [ 'portrait' , 'portrait-upside-down' , 'landscape-left' , 'landscape-right' ] ,
478- } ,
479- message : { type : 'string' } ,
480- } ,
481- required : [ 'action' , 'orientation' , 'message' ] ,
482- } ,
483- 'app-switcher' : {
484- properties : {
485- action : { type : 'string' , const : 'app-switcher' } ,
486- message : { type : 'string' } ,
487- } ,
488- required : [ 'action' , 'message' ] ,
489- } ,
490- 'tv-remote' : {
491- properties : {
492- action : { type : 'string' , const : 'tv-remote' } ,
493- button : {
494- type : 'string' ,
495- enum : [ 'up' , 'down' , 'left' , 'right' , 'select' , 'menu' , 'home' , 'back' ] ,
496- } ,
497- durationMs : { type : 'number' } ,
498- message : { type : 'string' } ,
499- } ,
500- required : [ 'action' , 'button' , 'message' ] ,
501- } ,
502- } ;
503-
504- test ( 'MCP navigation output schemas advertise the closed dispatch shapes' , ( ) => {
505- for ( const [ name , dispatchShape ] of Object . entries ( NAVIGATION_DISPATCH_SHAPES ) ) {
506- const schema = COMMAND_OUTPUT_SCHEMAS [ name as keyof typeof COMMAND_OUTPUT_SCHEMAS ] as {
507- type ?: unknown ;
508- properties ?: Record < string , unknown > ;
509- required ?: unknown ;
510- } ;
511- assert . deepEqual (
512- Object . keys ( schema ) . sort ( ) ,
513- [ 'properties' , 'required' , 'type' ] ,
514- `${ name } : must advertise exactly type/properties/required at the top level` ,
515- ) ;
516- assert . equal ( schema . type , 'object' , `${ name } : must advertise an object schema` ) ;
517- const { settle, ...dispatchProperties } = schema . properties ?? { } ;
518- assert . equal (
519- Boolean ( settle ) ,
520- commandSupportsSettleObservation ( name ) ,
521- `${ name } : settle property must track the post-action observation trait` ,
522- ) ;
523- assert . deepEqual ( dispatchProperties , dispatchShape . properties ) ;
524- assert . deepEqual ( schema . required , dispatchShape . required ) ;
525- }
526- } ) ;
527-
528447test ( 'MCP newly typed outputSchemas advertise public contract keys' , ( ) => {
529448 const tools = listCommandTools ( ) ;
530449
0 commit comments