fix(schedule): narrow persistence error operation
This commit is contained in:
@@ -71,7 +71,7 @@ const PERSISTENCE_ERROR_SCHEMA = {
|
|||||||
properties: {
|
properties: {
|
||||||
code: { type: 'string', required: true, const: 'persistence_uncertain' },
|
code: { type: 'string', required: true, const: 'persistence_uncertain' },
|
||||||
message: { type: 'string', required: true },
|
message: { type: 'string', required: true },
|
||||||
operation: { type: 'string', required: true, enum: ['create', 'list', 'delete', 'dispatch'] },
|
operation: { type: 'string', required: true, enum: ['create', 'list', 'delete'] },
|
||||||
id: { type: 'string' },
|
id: { type: 'string' },
|
||||||
},
|
},
|
||||||
} as const
|
} as const
|
||||||
|
|||||||
@@ -76,8 +76,8 @@ export interface ScheduleReminderPresentation {
|
|||||||
readonly deliveryMode: ScheduleDeliveryMode
|
readonly deliveryMode: ScheduleDeliveryMode
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Operations whose persistence barrier may be uncertain. */
|
/** Management operations whose persistence barrier may be uncertain. */
|
||||||
export type SchedulePersistenceOperation = 'create' | 'list' | 'delete' | 'dispatch'
|
export type SchedulePersistenceOperation = 'create' | 'list' | 'delete'
|
||||||
|
|
||||||
/** Stable error returned for an empty reminder prompt. */
|
/** Stable error returned for an empty reminder prompt. */
|
||||||
export interface InvalidPromptError {
|
export interface InvalidPromptError {
|
||||||
|
|||||||
@@ -103,6 +103,12 @@ describe('Schedule tool protocol', () => {
|
|||||||
const test = await harness()
|
const test = await harness()
|
||||||
expect(['schedule_create', 'schedule_list', 'schedule_delete'].map(name => test.ctx.tools.get(name)?.name))
|
expect(['schedule_create', 'schedule_list', 'schedule_delete'].map(name => test.ctx.tools.get(name)?.name))
|
||||||
.toEqual(['schedule_create', 'schedule_list', 'schedule_delete'])
|
.toEqual(['schedule_create', 'schedule_list', 'schedule_delete'])
|
||||||
|
const outputSchema = test.ctx.tools.get('schedule_create')?.output.schema as {
|
||||||
|
oneOf?: Array<{ properties?: { code?: { const?: string }; operation?: { enum?: string[] } } }>
|
||||||
|
}
|
||||||
|
const persistenceError = outputSchema.oneOf?.find(schema =>
|
||||||
|
schema.properties?.code?.const === 'persistence_uncertain')
|
||||||
|
expect(persistenceError?.properties?.operation?.enum).toEqual(['create', 'list', 'delete'])
|
||||||
for (const name of ['schedule_create', 'schedule_list', 'schedule_delete']) {
|
for (const name of ['schedule_create', 'schedule_list', 'schedule_delete']) {
|
||||||
expect(test.ctx.tools.executionMode({ signal, callId: CallId(name), name, arguments: {}, agent: test.agent }))
|
expect(test.ctx.tools.executionMode({ signal, callId: CallId(name), name, arguments: {}, agent: test.agent }))
|
||||||
.toEqual({ kind: 'exclusive' })
|
.toEqual({ kind: 'exclusive' })
|
||||||
|
|||||||
Reference in New Issue
Block a user