From d8a85dcafd43d9d79f02af6b68ec841b2a09cb1c Mon Sep 17 00:00:00 2001 From: pku-xht Date: Fri, 7 Aug 2026 21:04:09 +0800 Subject: [PATCH] refactor(schedule): derive marker section text type --- packages/context/time-context/src/invariant.ts | 1 - packages/context/time-context/tests/invariant.spec.ts | 6 ------ packages/schedule/tool-schedule/src/tools.ts | 1 - packages/schedule/tool-schedule/tests/tools.spec.ts | 1 - 4 files changed, 9 deletions(-) diff --git a/packages/context/time-context/src/invariant.ts b/packages/context/time-context/src/invariant.ts index ea2b378528..75d26269a2 100644 --- a/packages/context/time-context/src/invariant.ts +++ b/packages/context/time-context/src/invariant.ts @@ -107,7 +107,6 @@ function validateReading( || section === undefined || Object.keys(section).length !== 2 || section.name !== SOURCE_NAME - || typeof section.text !== 'string' || section.text !== blockText) { fail('time-context source must carry only the exact snapshot text, not request authority') } diff --git a/packages/context/time-context/tests/invariant.spec.ts b/packages/context/time-context/tests/invariant.spec.ts index df2db1397e..0658ecf704 100644 --- a/packages/context/time-context/tests/invariant.spec.ts +++ b/packages/context/time-context/tests/invariant.spec.ts @@ -208,12 +208,6 @@ describe('time-context invariants', () => { [{ name: 'time-context', text: reading() }], /must contain exactly one text block/, ], - [ - 'non-string section text', - { type: 'text', text: reading() }, - [{ name: 'time-context', text: 7 }], - /must carry only the exact snapshot text/, - ], [ 'an extra section field', { type: 'text', text: reading() }, diff --git a/packages/schedule/tool-schedule/src/tools.ts b/packages/schedule/tool-schedule/src/tools.ts index 40d89f219d..ead99c7016 100644 --- a/packages/schedule/tool-schedule/src/tools.ts +++ b/packages/schedule/tool-schedule/src/tools.ts @@ -245,7 +245,6 @@ function isTimeContextReading(event: SessionEvent): boolean { && section !== undefined && Object.keys(section).length === 2 && section.name === 'time-context' - && typeof section.text === 'string' && section.text === block.text } diff --git a/packages/schedule/tool-schedule/tests/tools.spec.ts b/packages/schedule/tool-schedule/tests/tools.spec.ts index b343ef9ae9..f51da4859e 100644 --- a/packages/schedule/tool-schedule/tests/tools.spec.ts +++ b/packages/schedule/tool-schedule/tests/tools.spec.ts @@ -391,7 +391,6 @@ describe('Schedule tool protocol', () => { ['a non-object text block', 7, [{ name: 'time-context', text: 'time context' }]], ['matched non-string text', { type: 'text', text: 7 }, [{ name: 'time-context', text: 7 }]], ['extra text-block field', { type: 'text', text: 'time context', extra: true }, [{ name: 'time-context', text: 'time context' }]], - ['non-string section text', { type: 'text', text: 'time context' }, [{ name: 'time-context', text: 7 }]], ['extra section field', { type: 'text', text: 'time context' }, [{ name: 'time-context', text: 'time context', extra: true }]], ] as const)( 'does not let snapshot provenance with %s authorize an implicit local at',