Browse Source

refactor(schedule): derive marker section text type

pku-xht 2 months ago
parent
commit
d8a85dcafd

+ 0 - 1
packages/context/time-context/src/invariant.ts

@@ -107,7 +107,6 @@ function validateReading(
     || section === undefined
     || section === undefined
     || Object.keys(section).length !== 2
     || Object.keys(section).length !== 2
     || section.name !== SOURCE_NAME
     || section.name !== SOURCE_NAME
-    || typeof section.text !== 'string'
     || section.text !== blockText) {
     || section.text !== blockText) {
     fail('time-context source must carry only the exact snapshot text, not request authority')
     fail('time-context source must carry only the exact snapshot text, not request authority')
   }
   }

+ 0 - 6
packages/context/time-context/tests/invariant.spec.ts

@@ -208,12 +208,6 @@ describe('time-context invariants', () => {
       [{ name: 'time-context', text: reading() }],
       [{ name: 'time-context', text: reading() }],
       /must contain exactly one text block/,
       /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',
       'an extra section field',
       { type: 'text', text: reading() },
       { type: 'text', text: reading() },

+ 0 - 1
packages/schedule/tool-schedule/src/tools.ts

@@ -245,7 +245,6 @@ function isTimeContextReading(event: SessionEvent): boolean {
     && section !== undefined
     && section !== undefined
     && Object.keys(section).length === 2
     && Object.keys(section).length === 2
     && section.name === 'time-context'
     && section.name === 'time-context'
-    && typeof section.text === 'string'
     && section.text === block.text
     && section.text === block.text
 }
 }
 
 

+ 0 - 1
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' }]],
     ['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 }]],
     ['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' }]],
     ['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 }]],
     ['extra section field', { type: 'text', text: 'time context' }, [{ name: 'time-context', text: 'time context', extra: true }]],
   ] as const)(
   ] as const)(
     'does not let snapshot provenance with %s authorize an implicit local at',
     'does not let snapshot provenance with %s authorize an implicit local at',