source-reference-marker.ts 549 B

123456789101112131415
  1. type MarkerBlock = { readonly type: 'text'; readonly text: string };
  2. // Host-created objects only: tool-provided text/details cannot opt out of the
  3. // output budget by imitating the citation protocol. Never serialize this trust.
  4. const markers = new WeakSet<object>();
  5. export function createSourceReferenceMarkerBlock(text: string): MarkerBlock {
  6. const block: MarkerBlock = { type: 'text', text };
  7. markers.add(block);
  8. return block;
  9. }
  10. export function isSourceReferenceMarkerBlock(block: MarkerBlock): boolean {
  11. return markers.has(block);
  12. }