@nhtio/adk 0.1.0-master-d3feb810 → 0.1.0-master-445a9ed0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/batteries/llm/openai_chat_completions/adapter.cjs +9 -10
  3. package/batteries/llm/openai_chat_completions/adapter.cjs.map +1 -1
  4. package/batteries/llm/openai_chat_completions/adapter.mjs +8 -8
  5. package/batteries/llm/openai_chat_completions/adapter.mjs.map +1 -1
  6. package/batteries/llm/openai_chat_completions/exceptions.cjs +1 -1
  7. package/batteries/llm/openai_chat_completions/helpers.cjs +16 -16
  8. package/batteries/llm/openai_chat_completions/helpers.cjs.map +1 -1
  9. package/batteries/llm/openai_chat_completions/helpers.d.ts +10 -10
  10. package/batteries/llm/openai_chat_completions/helpers.mjs +16 -16
  11. package/batteries/llm/openai_chat_completions/helpers.mjs.map +1 -1
  12. package/batteries/llm/openai_chat_completions/types.d.ts +26 -6
  13. package/batteries/llm/openai_chat_completions/validation.cjs +3 -1
  14. package/batteries/llm/openai_chat_completions/validation.cjs.map +1 -1
  15. package/batteries/llm/openai_chat_completions/validation.mjs +2 -0
  16. package/batteries/llm/openai_chat_completions/validation.mjs.map +1 -1
  17. package/batteries/llm/webllm_chat_completions/adapter.cjs +9 -10
  18. package/batteries/llm/webllm_chat_completions/adapter.cjs.map +1 -1
  19. package/batteries/llm/webllm_chat_completions/adapter.mjs +8 -8
  20. package/batteries/llm/webllm_chat_completions/adapter.mjs.map +1 -1
  21. package/batteries/llm/webllm_chat_completions/exceptions.cjs +1 -1
  22. package/batteries/llm/webllm_chat_completions/validation.cjs +3 -1
  23. package/batteries/llm/webllm_chat_completions/validation.cjs.map +1 -1
  24. package/batteries/llm/webllm_chat_completions/validation.mjs +2 -0
  25. package/batteries/llm/webllm_chat_completions/validation.mjs.map +1 -1
  26. package/batteries/storage/flydrive/index.d.ts +10 -4
  27. package/batteries/storage/flydrive.cjs +12 -3
  28. package/batteries/storage/flydrive.cjs.map +1 -1
  29. package/batteries/storage/flydrive.mjs +11 -2
  30. package/batteries/storage/flydrive.mjs.map +1 -1
  31. package/batteries/storage/in_memory/index.d.ts +31 -17
  32. package/batteries/storage/in_memory.cjs +89 -30
  33. package/batteries/storage/in_memory.cjs.map +1 -1
  34. package/batteries/storage/in_memory.mjs +89 -30
  35. package/batteries/storage/in_memory.mjs.map +1 -1
  36. package/batteries/storage/opfs/index.d.ts +10 -4
  37. package/batteries/storage/opfs.cjs +55 -5
  38. package/batteries/storage/opfs.cjs.map +1 -1
  39. package/batteries/storage/opfs.mjs +54 -4
  40. package/batteries/storage/opfs.mjs.map +1 -1
  41. package/batteries/tools/color.cjs +3 -3
  42. package/batteries/tools/color.mjs +2 -2
  43. package/batteries/tools/comparison.cjs +3 -4
  44. package/batteries/tools/comparison.cjs.map +1 -1
  45. package/batteries/tools/comparison.mjs +2 -2
  46. package/batteries/tools/data_structure.cjs +3 -4
  47. package/batteries/tools/data_structure.cjs.map +1 -1
  48. package/batteries/tools/data_structure.mjs +2 -2
  49. package/batteries/tools/datetime_extended.cjs +4 -4
  50. package/batteries/tools/datetime_extended.mjs +2 -2
  51. package/batteries/tools/datetime_math.cjs +3 -3
  52. package/batteries/tools/datetime_math.mjs +2 -2
  53. package/batteries/tools/encoding.cjs +3 -4
  54. package/batteries/tools/encoding.cjs.map +1 -1
  55. package/batteries/tools/encoding.mjs +2 -2
  56. package/batteries/tools/formatting.cjs +3 -4
  57. package/batteries/tools/formatting.cjs.map +1 -1
  58. package/batteries/tools/formatting.mjs +2 -2
  59. package/batteries/tools/geo_basics.cjs +3 -3
  60. package/batteries/tools/geo_basics.mjs +2 -2
  61. package/batteries/tools/math.cjs +3 -4
  62. package/batteries/tools/math.cjs.map +1 -1
  63. package/batteries/tools/math.mjs +2 -2
  64. package/batteries/tools/memory.cjs +6 -7
  65. package/batteries/tools/memory.cjs.map +1 -1
  66. package/batteries/tools/memory.mjs +5 -5
  67. package/batteries/tools/parsing.cjs +5 -6
  68. package/batteries/tools/parsing.cjs.map +1 -1
  69. package/batteries/tools/parsing.mjs +3 -3
  70. package/batteries/tools/retrievables.cjs +11 -11
  71. package/batteries/tools/retrievables.cjs.map +1 -1
  72. package/batteries/tools/retrievables.mjs +10 -9
  73. package/batteries/tools/retrievables.mjs.map +1 -1
  74. package/batteries/tools/standing_instructions.cjs +4 -5
  75. package/batteries/tools/standing_instructions.cjs.map +1 -1
  76. package/batteries/tools/standing_instructions.mjs +3 -3
  77. package/batteries/tools/statistics.cjs +4 -5
  78. package/batteries/tools/statistics.cjs.map +1 -1
  79. package/batteries/tools/statistics.mjs +3 -3
  80. package/batteries/tools/string_processing.cjs +3 -4
  81. package/batteries/tools/string_processing.cjs.map +1 -1
  82. package/batteries/tools/string_processing.mjs +2 -2
  83. package/batteries/tools/structured_data.cjs +3 -4
  84. package/batteries/tools/structured_data.cjs.map +1 -1
  85. package/batteries/tools/structured_data.mjs +2 -2
  86. package/batteries/tools/text_analysis.cjs +4 -4
  87. package/batteries/tools/text_analysis.mjs +3 -3
  88. package/batteries/tools/text_comparison.cjs +3 -3
  89. package/batteries/tools/text_comparison.mjs +2 -2
  90. package/batteries/tools/time.cjs +3 -3
  91. package/batteries/tools/time.mjs +2 -2
  92. package/batteries/tools/unit_conversion.cjs +3 -3
  93. package/batteries/tools/unit_conversion.mjs +2 -2
  94. package/batteries/tools.cjs +3 -3
  95. package/batteries/tools.mjs +3 -3
  96. package/batteries.cjs +3 -3
  97. package/batteries.mjs +3 -3
  98. package/{common-Od8edUXU.js → common-BJ6V6dsH.js} +89 -12
  99. package/common-BJ6V6dsH.js.map +1 -0
  100. package/{common-DeZaonK1.mjs → common-aFmr9Oqs.mjs} +76 -10
  101. package/common-aFmr9Oqs.mjs.map +1 -0
  102. package/common.cjs +9 -7
  103. package/common.d.ts +8 -0
  104. package/common.mjs +7 -7
  105. package/{dispatch_runner-CsoH0nld.js → dispatch_runner-BWYNxmnp.js} +37 -6
  106. package/dispatch_runner-BWYNxmnp.js.map +1 -0
  107. package/{dispatch_runner-9j6bXHL3.mjs → dispatch_runner-OimGCkk7.mjs} +34 -2
  108. package/dispatch_runner-OimGCkk7.mjs.map +1 -0
  109. package/dispatch_runner.cjs +1 -1
  110. package/dispatch_runner.mjs +1 -1
  111. package/{exceptions-D5YrO9Vm.js → exceptions-CSqzbL1N.js} +2 -2
  112. package/{exceptions-D5YrO9Vm.js.map → exceptions-CSqzbL1N.js.map} +1 -1
  113. package/exceptions.cjs +2 -2
  114. package/factories.cjs +1 -1
  115. package/forge.cjs +4 -4
  116. package/forge.mjs +3 -3
  117. package/guards.cjs +9 -9
  118. package/guards.mjs +7 -7
  119. package/index.cjs +12 -12
  120. package/index.cjs.map +1 -1
  121. package/index.d.ts +1 -1
  122. package/index.mjs +9 -9
  123. package/index.mjs.map +1 -1
  124. package/lib/classes/retrievable.d.ts +47 -4
  125. package/lib/contracts/byte_store.d.ts +93 -0
  126. package/lib/contracts/dispatch_context.d.ts +44 -0
  127. package/lib/contracts/turn_runner_config.d.ts +5 -1
  128. package/lib/contracts/turn_runner_context.d.ts +25 -0
  129. package/package.json +67 -67
  130. package/{runtime-BJVkrGQe.js → runtime-BUDWyd-R.js} +2 -2
  131. package/{runtime-BJVkrGQe.js.map → runtime-BUDWyd-R.js.map} +1 -1
  132. package/skills/adk-assembly/SKILL.md +2 -2
  133. package/{spooled_artifact-C5ZtGxuJ.mjs → spooled_artifact-B_tVDDdB.mjs} +2 -2
  134. package/{spooled_artifact-C5ZtGxuJ.mjs.map → spooled_artifact-B_tVDDdB.mjs.map} +1 -1
  135. package/{spooled_artifact-Cm9Te22K.js → spooled_artifact-CFstzlqX.js} +5 -6
  136. package/{spooled_artifact-Cm9Te22K.js.map → spooled_artifact-CFstzlqX.js.map} +1 -1
  137. package/spooled_artifact.cjs +2 -2
  138. package/spooled_artifact.mjs +2 -2
  139. package/{spooled_markdown_artifact-RRB113sy.js → spooled_markdown_artifact-DK-T8Hy6.js} +6 -7
  140. package/{spooled_markdown_artifact-RRB113sy.js.map → spooled_markdown_artifact-DK-T8Hy6.js.map} +1 -1
  141. package/{spooled_markdown_artifact-BpUJol0W.mjs → spooled_markdown_artifact-DWWak35I.mjs} +2 -2
  142. package/{spooled_markdown_artifact-BpUJol0W.mjs.map → spooled_markdown_artifact-DWWak35I.mjs.map} +1 -1
  143. package/{thought-CDb457b4.mjs → thought-DDqjQu3m.mjs} +2 -2
  144. package/{thought-CDb457b4.mjs.map → thought-DDqjQu3m.mjs.map} +1 -1
  145. package/{thought-DuN2PgdO.js → thought-DTsFRGdE.js} +5 -6
  146. package/{thought-DuN2PgdO.js.map → thought-DTsFRGdE.js.map} +1 -1
  147. package/{tool-COSeH8I6.js → tool-cwJyEHI9.js} +4 -5
  148. package/{tool-COSeH8I6.js.map → tool-cwJyEHI9.js.map} +1 -1
  149. package/{tool-D2WB1EA1.mjs → tool-q4LskG7K.mjs} +1 -1
  150. package/{tool-D2WB1EA1.mjs.map → tool-q4LskG7K.mjs.map} +1 -1
  151. package/{tool_call-DFgzcVcU.js → tool_call-3T0xTXlD.js} +5 -6
  152. package/{tool_call-DFgzcVcU.js.map → tool_call-3T0xTXlD.js.map} +1 -1
  153. package/{tool_call-BKyyxGaZ.mjs → tool_call-BKIdAAoY.mjs} +2 -2
  154. package/{tool_call-BKyyxGaZ.mjs.map → tool_call-BKIdAAoY.mjs.map} +1 -1
  155. package/{tool_registry-Dkfprsck.js → tool_registry-snPjF0zJ.js} +39 -5
  156. package/{tool_registry-Dkfprsck.js.map → tool_registry-snPjF0zJ.js.map} +1 -1
  157. package/{turn_runner-CMm2BHdX.js → turn_runner-BScT8OgA.js} +10 -7
  158. package/turn_runner-BScT8OgA.js.map +1 -0
  159. package/{turn_runner-y7eyEcJH.mjs → turn_runner-DRBLN2Y_.mjs} +7 -3
  160. package/turn_runner-DRBLN2Y_.mjs.map +1 -0
  161. package/turn_runner.cjs +1 -1
  162. package/turn_runner.mjs +1 -1
  163. package/types.d.ts +2 -2
  164. package/chunk-KmRHZBOW.js +0 -35
  165. package/common-DeZaonK1.mjs.map +0 -1
  166. package/common-Od8edUXU.js.map +0 -1
  167. package/dispatch_runner-9j6bXHL3.mjs.map +0 -1
  168. package/dispatch_runner-CsoH0nld.js.map +0 -1
  169. package/turn_runner-CMm2BHdX.js.map +0 -1
  170. package/turn_runner-y7eyEcJH.mjs.map +0 -1
package/index.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Root convenience barrel for the ADK's core runtime values and public TypeScript contracts.\n *\n * @module @nhtio/adk\n */\n\n/**\n * The current version of the package.\n *\n * @tip This is a constant that is replaced during the build process with the actual version of the package.\n */\nexport const version = __VERSION__\n\n// ── Data primitives (value classes + Raw* types) ──────────────────────────────\n\nexport {\n Tokenizable,\n TokenEncoding,\n Registry,\n Identity,\n Memory,\n Message,\n Retrievable,\n Thought,\n ToolCall,\n Tool,\n ArtifactTool,\n ToolRegistry,\n SpooledArtifact,\n SpooledJsonArtifact,\n SpooledMarkdownArtifact,\n implementsSpoolReader,\n Media,\n isMedia,\n implementsMediaReader,\n mediaReaderSchema,\n inMemoryMediaReader,\n fromFetch,\n fromWebFile,\n} from './common'\n\nexport type {\n RawMedia,\n SerializedMedia,\n MediaKind,\n MediaTrustTier,\n MediaModalityHazard,\n MediaStashEntry,\n MediaReader,\n} from './common'\n\n// ── Runners (the entry points for executing turns and dispatches) ─────────────\n\nexport { TurnRunner } from './turn_runner'\nexport { DispatchRunner } from './dispatch_runner'\n\n// ── Freestanding guards ───────────────────────────────────────────────────────\n\nexport {\n isInstanceOf,\n isError,\n isObject,\n isBaseException,\n isIdentity,\n isMemory,\n isMessage,\n isRegistry,\n isThought,\n isTokenizable,\n isTool,\n isArtifactTool,\n isToolCall,\n isToolRegistry,\n isTurnGate,\n isSpooledArtifact,\n isSpooledArtifactConstructor,\n isSpooledJsonArtifact,\n isSpooledMarkdownArtifact,\n isTurnContext,\n isTurnRunner,\n isDispatchContext,\n isDispatchRunner,\n} from './guards'\n\n// ── Exceptions ────────────────────────────────────────────────────────────────\n\nexport {\n ValidationException,\n E_INVALID_TURN_RUNNER_CONFIG,\n E_INVALID_TURN_CONTEXT,\n E_INPUT_PIPELINE_ERROR,\n E_OUTPUT_PIPELINE_ERROR,\n E_PIPELINE_SHORT_CIRCUITED,\n E_INVALID_INITIAL_REGISTRY_VALUE,\n E_INVALID_INITIAL_MEMORY_VALUE,\n E_INVALID_INITIAL_MESSAGE_VALUE,\n E_INVALID_INITIAL_IDENTITY_VALUE,\n E_INVALID_INITIAL_THOUGHT_VALUE,\n E_INVALID_INITIAL_TURN_GATE_VALUE,\n E_INVALID_TURN_GATE_RESOLUTION,\n E_TURN_GATE_TIMEOUT,\n E_TURN_GATE_ABORTED,\n E_NOT_A_SPOOL_READER,\n E_INVALID_INITIAL_TOOL_CALL_VALUE,\n E_INVALID_INITIAL_TOOL_VALUE,\n E_INVALID_TOOL_ARGS,\n E_TOOL_DOWNSTREAM_ERROR,\n E_TOOL_ALREADY_REGISTERED,\n E_INVALID_LLM_EXECUTION_CONTEXT,\n E_LLM_EXECUTION_GATE_NOT_SUPPORTED,\n E_LLM_EXECUTION_ALREADY_SIGNALLED,\n E_INVALID_LLM_DISPATCH_INPUT,\n E_DISPATCH_PIPELINE_ERROR,\n E_LLM_EXECUTION_EXECUTOR_ERROR,\n} from './exceptions'\n\n// ── Types (re-exported via `export type *` form) ──────────────────────────────\n\nexport type {\n BaseException,\n TurnContext,\n DispatchContext,\n TurnGate,\n RawIdentity,\n RawMemory,\n RawMessage,\n MessageRole,\n RawThought,\n RawToolCall,\n RawTool,\n ToolHandler,\n RawArtifactTool,\n ArtifactToolHandler,\n MergeOptions,\n SpooledArtifactConstructor,\n ToolMethodDescriptor,\n RawTurnGate,\n SpoolReader,\n JsonArtifactFormat,\n MarkdownHeadingEntry,\n MarkdownCodeEntry,\n MarkdownSection,\n RawTurnContext,\n ResolvedTurnContext,\n MemoryRetrievalFn,\n MessageRetrievalFn,\n ThoughtRetrievalFn,\n ToolCallRetrievalFn,\n ToolsRetrievalFn,\n RetrievableRetrievalFn,\n StandingInstructionsRefreshFn,\n StandingInstructionStoreFn,\n StandingInstructionMutateFn,\n StandingInstructionDeleteFn,\n MemoryStoreFn,\n MemoryMutateFn,\n MemoryDeleteFn,\n MessageStoreFn,\n MessageMutateFn,\n MessageDeleteFn,\n ThoughtStoreFn,\n ThoughtMutateFn,\n ThoughtDeleteFn,\n ToolCallStoreFn,\n ToolCallMutateFn,\n ToolCallDeleteFn,\n RetrievableStoreFn,\n RetrievableMutateFn,\n RetrievableDeleteFn,\n TurnRunnerConfig,\n ResolvedTurnRunnerConfig,\n TurnPipelineMiddlewareFn,\n TurnStreamableContent,\n TurnToolCallContent,\n TurnStartEvent,\n TurnEndEvent,\n TurnGateClosedEvent,\n ToolExecutionStartEvent,\n ToolExecutionEndEvent,\n EmitMessageFn,\n EmitThoughtFn,\n EmitToolCallFn,\n EmitToolExecutionStartFn,\n EmitToolExecutionEndFn,\n OpenGateFn,\n TurnEvents,\n TurnEvent,\n TurnEventListener,\n TurnObservabilityEvents,\n TurnObservabilityEvent,\n TurnObservabilityEventListener,\n RawDispatchContext,\n DispatchMemoryRetrievalFn,\n DispatchMessageRetrievalFn,\n DispatchThoughtRetrievalFn,\n DispatchToolCallRetrievalFn,\n DispatchToolsRetrievalFn,\n DispatchStandingInstructionsRefreshFn,\n DispatchStandingInstructionStoreFn,\n DispatchStandingInstructionMutateFn,\n DispatchStandingInstructionDeleteFn,\n DispatchMemoryStoreFn,\n DispatchMemoryMutateFn,\n DispatchMemoryDeleteFn,\n DispatchMessageStoreFn,\n DispatchMessageMutateFn,\n DispatchMessageDeleteFn,\n DispatchThoughtStoreFn,\n DispatchThoughtMutateFn,\n DispatchThoughtDeleteFn,\n DispatchToolCallStoreFn,\n DispatchToolCallMutateFn,\n DispatchToolCallDeleteFn,\n DispatchContextHooks,\n DispatchContextHookRegistrations,\n RawDispatchRunnerInput,\n DispatchPipelineMiddlewareFn,\n DispatchExecutorFn,\n DispatchExecutorHelpers,\n DispatchExecutorLogChannel,\n DispatchExecutorLogEntry,\n DispatchExecutorLogLevel,\n LogEvent,\n DispatchStartEvent,\n DispatchEndEvent,\n IterationStartEvent,\n IterationEndEvent,\n DispatchRunnerFunctionalHooks,\n DispatchRunnerObservabilityHooks,\n DispatchRunnerFunctionalHookRegistrations,\n DispatchRunnerObservabilityHookRegistrations,\n} from './types'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,IAAa,UAAA"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Root convenience barrel for the ADK's core runtime values and public TypeScript contracts.\n *\n * @module @nhtio/adk\n */\n\n/**\n * The current version of the package.\n *\n * @tip This is a constant that is replaced during the build process with the actual version of the package.\n */\nexport const version = __VERSION__\n\n// ── Data primitives (value classes + Raw* types) ──────────────────────────────\n\nexport {\n Tokenizable,\n TokenEncoding,\n Registry,\n Identity,\n Memory,\n Message,\n Retrievable,\n Thought,\n ToolCall,\n Tool,\n ArtifactTool,\n ToolRegistry,\n SpooledArtifact,\n SpooledJsonArtifact,\n SpooledMarkdownArtifact,\n implementsSpoolReader,\n Media,\n isMedia,\n implementsMediaReader,\n mediaReaderSchema,\n inMemoryMediaReader,\n fromFetch,\n fromWebFile,\n} from './common'\n\nexport type {\n RawMedia,\n SerializedMedia,\n MediaKind,\n MediaTrustTier,\n MediaModalityHazard,\n MediaStashEntry,\n MediaReader,\n} from './common'\n\n// ── Runners (the entry points for executing turns and dispatches) ─────────────\n\nexport { TurnRunner } from './turn_runner'\nexport { DispatchRunner } from './dispatch_runner'\n\n// ── Freestanding guards ───────────────────────────────────────────────────────\n\nexport {\n isInstanceOf,\n isError,\n isObject,\n isBaseException,\n isIdentity,\n isMemory,\n isMessage,\n isRegistry,\n isThought,\n isTokenizable,\n isTool,\n isArtifactTool,\n isToolCall,\n isToolRegistry,\n isTurnGate,\n isSpooledArtifact,\n isSpooledArtifactConstructor,\n isSpooledJsonArtifact,\n isSpooledMarkdownArtifact,\n isTurnContext,\n isTurnRunner,\n isDispatchContext,\n isDispatchRunner,\n} from './guards'\n\n// ── Exceptions ────────────────────────────────────────────────────────────────\n\nexport {\n ValidationException,\n E_INVALID_TURN_RUNNER_CONFIG,\n E_INVALID_TURN_CONTEXT,\n E_INPUT_PIPELINE_ERROR,\n E_OUTPUT_PIPELINE_ERROR,\n E_PIPELINE_SHORT_CIRCUITED,\n E_INVALID_INITIAL_REGISTRY_VALUE,\n E_INVALID_INITIAL_MEMORY_VALUE,\n E_INVALID_INITIAL_MESSAGE_VALUE,\n E_INVALID_INITIAL_IDENTITY_VALUE,\n E_INVALID_INITIAL_THOUGHT_VALUE,\n E_INVALID_INITIAL_TURN_GATE_VALUE,\n E_INVALID_TURN_GATE_RESOLUTION,\n E_TURN_GATE_TIMEOUT,\n E_TURN_GATE_ABORTED,\n E_NOT_A_SPOOL_READER,\n E_INVALID_INITIAL_TOOL_CALL_VALUE,\n E_INVALID_INITIAL_TOOL_VALUE,\n E_INVALID_TOOL_ARGS,\n E_TOOL_DOWNSTREAM_ERROR,\n E_TOOL_ALREADY_REGISTERED,\n E_INVALID_LLM_EXECUTION_CONTEXT,\n E_LLM_EXECUTION_GATE_NOT_SUPPORTED,\n E_LLM_EXECUTION_ALREADY_SIGNALLED,\n E_INVALID_LLM_DISPATCH_INPUT,\n E_DISPATCH_PIPELINE_ERROR,\n E_LLM_EXECUTION_EXECUTOR_ERROR,\n} from './exceptions'\n\n// ── Types (re-exported via `export type *` form) ──────────────────────────────\n\nexport type {\n BaseException,\n TurnContext,\n DispatchContext,\n TurnGate,\n RawIdentity,\n RawMemory,\n RawMessage,\n MessageRole,\n RawThought,\n RawToolCall,\n RawTool,\n ToolHandler,\n RawArtifactTool,\n ArtifactToolHandler,\n MergeOptions,\n SpooledArtifactConstructor,\n ToolMethodDescriptor,\n RawTurnGate,\n SpoolReader,\n JsonArtifactFormat,\n MarkdownHeadingEntry,\n MarkdownCodeEntry,\n MarkdownSection,\n RawTurnContext,\n ResolvedTurnContext,\n MemoryRetrievalFn,\n MessageRetrievalFn,\n ThoughtRetrievalFn,\n ToolCallRetrievalFn,\n ToolsRetrievalFn,\n RetrievableRetrievalFn,\n StandingInstructionsRefreshFn,\n StandingInstructionStoreFn,\n StandingInstructionMutateFn,\n StandingInstructionDeleteFn,\n MemoryStoreFn,\n MemoryMutateFn,\n MemoryDeleteFn,\n MessageStoreFn,\n MessageMutateFn,\n MessageDeleteFn,\n ThoughtStoreFn,\n ThoughtMutateFn,\n ThoughtDeleteFn,\n ToolCallStoreFn,\n ToolCallMutateFn,\n ToolCallDeleteFn,\n RetrievableStoreFn,\n RetrievableMutateFn,\n RetrievableDeleteFn,\n MediaBytesStoreFn,\n RetrievableBytesStoreFn,\n TurnRunnerConfig,\n ResolvedTurnRunnerConfig,\n TurnPipelineMiddlewareFn,\n TurnStreamableContent,\n TurnToolCallContent,\n TurnStartEvent,\n TurnEndEvent,\n TurnGateClosedEvent,\n ToolExecutionStartEvent,\n ToolExecutionEndEvent,\n EmitMessageFn,\n EmitThoughtFn,\n EmitToolCallFn,\n EmitToolExecutionStartFn,\n EmitToolExecutionEndFn,\n OpenGateFn,\n TurnEvents,\n TurnEvent,\n TurnEventListener,\n TurnObservabilityEvents,\n TurnObservabilityEvent,\n TurnObservabilityEventListener,\n RawDispatchContext,\n DispatchMemoryRetrievalFn,\n DispatchMessageRetrievalFn,\n DispatchThoughtRetrievalFn,\n DispatchToolCallRetrievalFn,\n DispatchToolsRetrievalFn,\n DispatchStandingInstructionsRefreshFn,\n DispatchStandingInstructionStoreFn,\n DispatchStandingInstructionMutateFn,\n DispatchStandingInstructionDeleteFn,\n DispatchMemoryStoreFn,\n DispatchMemoryMutateFn,\n DispatchMemoryDeleteFn,\n DispatchMessageStoreFn,\n DispatchMessageMutateFn,\n DispatchMessageDeleteFn,\n DispatchThoughtStoreFn,\n DispatchThoughtMutateFn,\n DispatchThoughtDeleteFn,\n DispatchToolCallStoreFn,\n DispatchToolCallMutateFn,\n DispatchToolCallDeleteFn,\n DispatchMediaBytesStoreFn,\n DispatchRetrievableBytesStoreFn,\n ConduitBytes,\n DispatchContextHooks,\n DispatchContextHookRegistrations,\n RawDispatchRunnerInput,\n DispatchPipelineMiddlewareFn,\n DispatchExecutorFn,\n DispatchExecutorHelpers,\n DispatchExecutorLogChannel,\n DispatchExecutorLogEntry,\n DispatchExecutorLogLevel,\n LogEvent,\n DispatchStartEvent,\n DispatchEndEvent,\n IterationStartEvent,\n IterationEndEvent,\n DispatchRunnerFunctionalHooks,\n DispatchRunnerObservabilityHooks,\n DispatchRunnerFunctionalHookRegistrations,\n DispatchRunnerObservabilityHookRegistrations,\n} from './types'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,IAAa,UAAA"}
package/index.d.ts CHANGED
@@ -15,4 +15,4 @@ export { TurnRunner } from "./turn_runner";
15
15
  export { DispatchRunner } from "./dispatch_runner";
16
16
  export { isInstanceOf, isError, isObject, isBaseException, isIdentity, isMemory, isMessage, isRegistry, isThought, isTokenizable, isTool, isArtifactTool, isToolCall, isToolRegistry, isTurnGate, isSpooledArtifact, isSpooledArtifactConstructor, isSpooledJsonArtifact, isSpooledMarkdownArtifact, isTurnContext, isTurnRunner, isDispatchContext, isDispatchRunner, } from "./guards";
17
17
  export { ValidationException, E_INVALID_TURN_RUNNER_CONFIG, E_INVALID_TURN_CONTEXT, E_INPUT_PIPELINE_ERROR, E_OUTPUT_PIPELINE_ERROR, E_PIPELINE_SHORT_CIRCUITED, E_INVALID_INITIAL_REGISTRY_VALUE, E_INVALID_INITIAL_MEMORY_VALUE, E_INVALID_INITIAL_MESSAGE_VALUE, E_INVALID_INITIAL_IDENTITY_VALUE, E_INVALID_INITIAL_THOUGHT_VALUE, E_INVALID_INITIAL_TURN_GATE_VALUE, E_INVALID_TURN_GATE_RESOLUTION, E_TURN_GATE_TIMEOUT, E_TURN_GATE_ABORTED, E_NOT_A_SPOOL_READER, E_INVALID_INITIAL_TOOL_CALL_VALUE, E_INVALID_INITIAL_TOOL_VALUE, E_INVALID_TOOL_ARGS, E_TOOL_DOWNSTREAM_ERROR, E_TOOL_ALREADY_REGISTERED, E_INVALID_LLM_EXECUTION_CONTEXT, E_LLM_EXECUTION_GATE_NOT_SUPPORTED, E_LLM_EXECUTION_ALREADY_SIGNALLED, E_INVALID_LLM_DISPATCH_INPUT, E_DISPATCH_PIPELINE_ERROR, E_LLM_EXECUTION_EXECUTOR_ERROR, } from "./exceptions";
18
- export type { BaseException, TurnContext, DispatchContext, TurnGate, RawIdentity, RawMemory, RawMessage, MessageRole, RawThought, RawToolCall, RawTool, ToolHandler, RawArtifactTool, ArtifactToolHandler, MergeOptions, SpooledArtifactConstructor, ToolMethodDescriptor, RawTurnGate, SpoolReader, JsonArtifactFormat, MarkdownHeadingEntry, MarkdownCodeEntry, MarkdownSection, RawTurnContext, ResolvedTurnContext, MemoryRetrievalFn, MessageRetrievalFn, ThoughtRetrievalFn, ToolCallRetrievalFn, ToolsRetrievalFn, RetrievableRetrievalFn, StandingInstructionsRefreshFn, StandingInstructionStoreFn, StandingInstructionMutateFn, StandingInstructionDeleteFn, MemoryStoreFn, MemoryMutateFn, MemoryDeleteFn, MessageStoreFn, MessageMutateFn, MessageDeleteFn, ThoughtStoreFn, ThoughtMutateFn, ThoughtDeleteFn, ToolCallStoreFn, ToolCallMutateFn, ToolCallDeleteFn, RetrievableStoreFn, RetrievableMutateFn, RetrievableDeleteFn, TurnRunnerConfig, ResolvedTurnRunnerConfig, TurnPipelineMiddlewareFn, TurnStreamableContent, TurnToolCallContent, TurnStartEvent, TurnEndEvent, TurnGateClosedEvent, ToolExecutionStartEvent, ToolExecutionEndEvent, EmitMessageFn, EmitThoughtFn, EmitToolCallFn, EmitToolExecutionStartFn, EmitToolExecutionEndFn, OpenGateFn, TurnEvents, TurnEvent, TurnEventListener, TurnObservabilityEvents, TurnObservabilityEvent, TurnObservabilityEventListener, RawDispatchContext, DispatchMemoryRetrievalFn, DispatchMessageRetrievalFn, DispatchThoughtRetrievalFn, DispatchToolCallRetrievalFn, DispatchToolsRetrievalFn, DispatchStandingInstructionsRefreshFn, DispatchStandingInstructionStoreFn, DispatchStandingInstructionMutateFn, DispatchStandingInstructionDeleteFn, DispatchMemoryStoreFn, DispatchMemoryMutateFn, DispatchMemoryDeleteFn, DispatchMessageStoreFn, DispatchMessageMutateFn, DispatchMessageDeleteFn, DispatchThoughtStoreFn, DispatchThoughtMutateFn, DispatchThoughtDeleteFn, DispatchToolCallStoreFn, DispatchToolCallMutateFn, DispatchToolCallDeleteFn, DispatchContextHooks, DispatchContextHookRegistrations, RawDispatchRunnerInput, DispatchPipelineMiddlewareFn, DispatchExecutorFn, DispatchExecutorHelpers, DispatchExecutorLogChannel, DispatchExecutorLogEntry, DispatchExecutorLogLevel, LogEvent, DispatchStartEvent, DispatchEndEvent, IterationStartEvent, IterationEndEvent, DispatchRunnerFunctionalHooks, DispatchRunnerObservabilityHooks, DispatchRunnerFunctionalHookRegistrations, DispatchRunnerObservabilityHookRegistrations, } from "./types";
18
+ export type { BaseException, TurnContext, DispatchContext, TurnGate, RawIdentity, RawMemory, RawMessage, MessageRole, RawThought, RawToolCall, RawTool, ToolHandler, RawArtifactTool, ArtifactToolHandler, MergeOptions, SpooledArtifactConstructor, ToolMethodDescriptor, RawTurnGate, SpoolReader, JsonArtifactFormat, MarkdownHeadingEntry, MarkdownCodeEntry, MarkdownSection, RawTurnContext, ResolvedTurnContext, MemoryRetrievalFn, MessageRetrievalFn, ThoughtRetrievalFn, ToolCallRetrievalFn, ToolsRetrievalFn, RetrievableRetrievalFn, StandingInstructionsRefreshFn, StandingInstructionStoreFn, StandingInstructionMutateFn, StandingInstructionDeleteFn, MemoryStoreFn, MemoryMutateFn, MemoryDeleteFn, MessageStoreFn, MessageMutateFn, MessageDeleteFn, ThoughtStoreFn, ThoughtMutateFn, ThoughtDeleteFn, ToolCallStoreFn, ToolCallMutateFn, ToolCallDeleteFn, RetrievableStoreFn, RetrievableMutateFn, RetrievableDeleteFn, MediaBytesStoreFn, RetrievableBytesStoreFn, TurnRunnerConfig, ResolvedTurnRunnerConfig, TurnPipelineMiddlewareFn, TurnStreamableContent, TurnToolCallContent, TurnStartEvent, TurnEndEvent, TurnGateClosedEvent, ToolExecutionStartEvent, ToolExecutionEndEvent, EmitMessageFn, EmitThoughtFn, EmitToolCallFn, EmitToolExecutionStartFn, EmitToolExecutionEndFn, OpenGateFn, TurnEvents, TurnEvent, TurnEventListener, TurnObservabilityEvents, TurnObservabilityEvent, TurnObservabilityEventListener, RawDispatchContext, DispatchMemoryRetrievalFn, DispatchMessageRetrievalFn, DispatchThoughtRetrievalFn, DispatchToolCallRetrievalFn, DispatchToolsRetrievalFn, DispatchStandingInstructionsRefreshFn, DispatchStandingInstructionStoreFn, DispatchStandingInstructionMutateFn, DispatchStandingInstructionDeleteFn, DispatchMemoryStoreFn, DispatchMemoryMutateFn, DispatchMemoryDeleteFn, DispatchMessageStoreFn, DispatchMessageMutateFn, DispatchMessageDeleteFn, DispatchThoughtStoreFn, DispatchThoughtMutateFn, DispatchThoughtDeleteFn, DispatchToolCallStoreFn, DispatchToolCallMutateFn, DispatchToolCallDeleteFn, DispatchMediaBytesStoreFn, DispatchRetrievableBytesStoreFn, ConduitBytes, DispatchContextHooks, DispatchContextHookRegistrations, RawDispatchRunnerInput, DispatchPipelineMiddlewareFn, DispatchExecutorFn, DispatchExecutorHelpers, DispatchExecutorLogChannel, DispatchExecutorLogEntry, DispatchExecutorLogLevel, LogEvent, DispatchStartEvent, DispatchEndEvent, IterationStartEvent, IterationEndEvent, DispatchRunnerFunctionalHooks, DispatchRunnerObservabilityHooks, DispatchRunnerFunctionalHookRegistrations, DispatchRunnerObservabilityHookRegistrations, } from "./types";
package/index.mjs CHANGED
@@ -1,16 +1,16 @@
1
1
  import { n as ValidationException } from "./exceptions-NrzIHw_R.mjs";
2
2
  import { a as Tokenizable, c as isObject, i as TokenEncoding, o as isError, r as Registry, s as isInstanceOf, t as ToolRegistry } from "./tool_registry-DqLOyGyG.mjs";
3
3
  import { C as E_NOT_A_SPOOL_READER, D as E_TOOL_DOWNSTREAM_ERROR, E as E_TOOL_ALREADY_REGISTERED, O as E_TURN_GATE_ABORTED, T as E_PIPELINE_SHORT_CIRCUITED, _ as E_INVALID_TURN_GATE_RESOLUTION, a as E_INVALID_INITIAL_MEMORY_VALUE, b as E_LLM_EXECUTION_EXECUTOR_ERROR, d as E_INVALID_INITIAL_TOOL_VALUE, f as E_INVALID_INITIAL_TURN_GATE_VALUE, g as E_INVALID_TURN_CONTEXT, h as E_INVALID_TOOL_ARGS, k as E_TURN_GATE_TIMEOUT, l as E_INVALID_INITIAL_THOUGHT_VALUE, m as E_INVALID_LLM_EXECUTION_CONTEXT, n as E_INPUT_PIPELINE_ERROR, o as E_INVALID_INITIAL_MESSAGE_VALUE, p as E_INVALID_LLM_DISPATCH_INPUT, r as E_INVALID_INITIAL_IDENTITY_VALUE, s as E_INVALID_INITIAL_REGISTRY_VALUE, t as E_DISPATCH_PIPELINE_ERROR, u as E_INVALID_INITIAL_TOOL_CALL_VALUE, v as E_INVALID_TURN_RUNNER_CONFIG, w as E_OUTPUT_PIPELINE_ERROR, x as E_LLM_EXECUTION_GATE_NOT_SUPPORTED, y as E_LLM_EXECUTION_ALREADY_SIGNALLED } from "./runtime-CrEPIFgr.mjs";
4
- import { i as Identity, n as Message, r as Memory, t as Thought } from "./thought-CDb457b4.mjs";
5
- import { i as Retrievable, n as fromWebFile, r as inMemoryMediaReader, t as fromFetch } from "./common-DeZaonK1.mjs";
6
- import { a as mediaReaderSchema, i as implementsMediaReader, n as Media, r as isMedia, t as ToolCall } from "./tool_call-BKyyxGaZ.mjs";
7
- import { t as Tool } from "./tool-D2WB1EA1.mjs";
8
- import { i as ArtifactTool, r as implementsSpoolReader, t as SpooledArtifact } from "./spooled_artifact-C5ZtGxuJ.mjs";
9
- import { n as SpooledJsonArtifact, t as SpooledMarkdownArtifact } from "./spooled_markdown_artifact-BpUJol0W.mjs";
4
+ import { i as Identity, n as Message, r as Memory, t as Thought } from "./thought-DDqjQu3m.mjs";
5
+ import { t as Tool } from "./tool-q4LskG7K.mjs";
6
+ import { i as ArtifactTool, r as implementsSpoolReader, t as SpooledArtifact } from "./spooled_artifact-B_tVDDdB.mjs";
7
+ import { n as fromWebFile, o as Retrievable, r as inMemoryMediaReader, t as fromFetch } from "./common-aFmr9Oqs.mjs";
8
+ import { a as mediaReaderSchema, i as implementsMediaReader, n as Media, r as isMedia, t as ToolCall } from "./tool_call-BKIdAAoY.mjs";
9
+ import { n as SpooledJsonArtifact, t as SpooledMarkdownArtifact } from "./spooled_markdown_artifact-DWWak35I.mjs";
10
10
  import "./exceptions.mjs";
11
- import { t as DispatchRunner } from "./dispatch_runner-9j6bXHL3.mjs";
11
+ import { t as DispatchRunner } from "./dispatch_runner-OimGCkk7.mjs";
12
12
  import "./dispatch_runner.mjs";
13
- import { t as TurnRunner } from "./turn_runner-y7eyEcJH.mjs";
13
+ import { t as TurnRunner } from "./turn_runner-DRBLN2Y_.mjs";
14
14
  import { isArtifactTool, isBaseException, isDispatchContext, isDispatchRunner, isIdentity, isMemory, isMessage, isRegistry, isSpooledArtifact, isSpooledArtifactConstructor, isSpooledJsonArtifact, isSpooledMarkdownArtifact, isThought, isTokenizable, isTool, isToolCall, isToolRegistry, isTurnContext, isTurnGate, isTurnRunner } from "./guards.mjs";
15
15
  import "./turn_runner.mjs";
16
16
  //#region src/index.ts
@@ -24,7 +24,7 @@ import "./turn_runner.mjs";
24
24
  *
25
25
  * @tip This is a constant that is replaced during the build process with the actual version of the package.
26
26
  */
27
- var version = "0.1.0-master-d3feb810";
27
+ var version = "0.1.0-master-445a9ed0";
28
28
  //#endregion
29
29
  export { ArtifactTool, DispatchRunner, E_DISPATCH_PIPELINE_ERROR, E_INPUT_PIPELINE_ERROR, E_INVALID_INITIAL_IDENTITY_VALUE, E_INVALID_INITIAL_MEMORY_VALUE, E_INVALID_INITIAL_MESSAGE_VALUE, E_INVALID_INITIAL_REGISTRY_VALUE, E_INVALID_INITIAL_THOUGHT_VALUE, E_INVALID_INITIAL_TOOL_CALL_VALUE, E_INVALID_INITIAL_TOOL_VALUE, E_INVALID_INITIAL_TURN_GATE_VALUE, E_INVALID_LLM_DISPATCH_INPUT, E_INVALID_LLM_EXECUTION_CONTEXT, E_INVALID_TOOL_ARGS, E_INVALID_TURN_CONTEXT, E_INVALID_TURN_GATE_RESOLUTION, E_INVALID_TURN_RUNNER_CONFIG, E_LLM_EXECUTION_ALREADY_SIGNALLED, E_LLM_EXECUTION_EXECUTOR_ERROR, E_LLM_EXECUTION_GATE_NOT_SUPPORTED, E_NOT_A_SPOOL_READER, E_OUTPUT_PIPELINE_ERROR, E_PIPELINE_SHORT_CIRCUITED, E_TOOL_ALREADY_REGISTERED, E_TOOL_DOWNSTREAM_ERROR, E_TURN_GATE_ABORTED, E_TURN_GATE_TIMEOUT, Identity, Media, Memory, Message, Registry, Retrievable, SpooledArtifact, SpooledJsonArtifact, SpooledMarkdownArtifact, Thought, TokenEncoding, Tokenizable, Tool, ToolCall, ToolRegistry, TurnRunner, ValidationException, fromFetch, fromWebFile, implementsMediaReader, implementsSpoolReader, inMemoryMediaReader, isArtifactTool, isBaseException, isDispatchContext, isDispatchRunner, isError, isIdentity, isInstanceOf, isMedia, isMemory, isMessage, isObject, isRegistry, isSpooledArtifact, isSpooledArtifactConstructor, isSpooledJsonArtifact, isSpooledMarkdownArtifact, isThought, isTokenizable, isTool, isToolCall, isToolRegistry, isTurnContext, isTurnGate, isTurnRunner, mediaReaderSchema, version };
30
30
 
package/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Root convenience barrel for the ADK's core runtime values and public TypeScript contracts.\n *\n * @module @nhtio/adk\n */\n\n/**\n * The current version of the package.\n *\n * @tip This is a constant that is replaced during the build process with the actual version of the package.\n */\nexport const version = __VERSION__\n\n// ── Data primitives (value classes + Raw* types) ──────────────────────────────\n\nexport {\n Tokenizable,\n TokenEncoding,\n Registry,\n Identity,\n Memory,\n Message,\n Retrievable,\n Thought,\n ToolCall,\n Tool,\n ArtifactTool,\n ToolRegistry,\n SpooledArtifact,\n SpooledJsonArtifact,\n SpooledMarkdownArtifact,\n implementsSpoolReader,\n Media,\n isMedia,\n implementsMediaReader,\n mediaReaderSchema,\n inMemoryMediaReader,\n fromFetch,\n fromWebFile,\n} from './common'\n\nexport type {\n RawMedia,\n SerializedMedia,\n MediaKind,\n MediaTrustTier,\n MediaModalityHazard,\n MediaStashEntry,\n MediaReader,\n} from './common'\n\n// ── Runners (the entry points for executing turns and dispatches) ─────────────\n\nexport { TurnRunner } from './turn_runner'\nexport { DispatchRunner } from './dispatch_runner'\n\n// ── Freestanding guards ───────────────────────────────────────────────────────\n\nexport {\n isInstanceOf,\n isError,\n isObject,\n isBaseException,\n isIdentity,\n isMemory,\n isMessage,\n isRegistry,\n isThought,\n isTokenizable,\n isTool,\n isArtifactTool,\n isToolCall,\n isToolRegistry,\n isTurnGate,\n isSpooledArtifact,\n isSpooledArtifactConstructor,\n isSpooledJsonArtifact,\n isSpooledMarkdownArtifact,\n isTurnContext,\n isTurnRunner,\n isDispatchContext,\n isDispatchRunner,\n} from './guards'\n\n// ── Exceptions ────────────────────────────────────────────────────────────────\n\nexport {\n ValidationException,\n E_INVALID_TURN_RUNNER_CONFIG,\n E_INVALID_TURN_CONTEXT,\n E_INPUT_PIPELINE_ERROR,\n E_OUTPUT_PIPELINE_ERROR,\n E_PIPELINE_SHORT_CIRCUITED,\n E_INVALID_INITIAL_REGISTRY_VALUE,\n E_INVALID_INITIAL_MEMORY_VALUE,\n E_INVALID_INITIAL_MESSAGE_VALUE,\n E_INVALID_INITIAL_IDENTITY_VALUE,\n E_INVALID_INITIAL_THOUGHT_VALUE,\n E_INVALID_INITIAL_TURN_GATE_VALUE,\n E_INVALID_TURN_GATE_RESOLUTION,\n E_TURN_GATE_TIMEOUT,\n E_TURN_GATE_ABORTED,\n E_NOT_A_SPOOL_READER,\n E_INVALID_INITIAL_TOOL_CALL_VALUE,\n E_INVALID_INITIAL_TOOL_VALUE,\n E_INVALID_TOOL_ARGS,\n E_TOOL_DOWNSTREAM_ERROR,\n E_TOOL_ALREADY_REGISTERED,\n E_INVALID_LLM_EXECUTION_CONTEXT,\n E_LLM_EXECUTION_GATE_NOT_SUPPORTED,\n E_LLM_EXECUTION_ALREADY_SIGNALLED,\n E_INVALID_LLM_DISPATCH_INPUT,\n E_DISPATCH_PIPELINE_ERROR,\n E_LLM_EXECUTION_EXECUTOR_ERROR,\n} from './exceptions'\n\n// ── Types (re-exported via `export type *` form) ──────────────────────────────\n\nexport type {\n BaseException,\n TurnContext,\n DispatchContext,\n TurnGate,\n RawIdentity,\n RawMemory,\n RawMessage,\n MessageRole,\n RawThought,\n RawToolCall,\n RawTool,\n ToolHandler,\n RawArtifactTool,\n ArtifactToolHandler,\n MergeOptions,\n SpooledArtifactConstructor,\n ToolMethodDescriptor,\n RawTurnGate,\n SpoolReader,\n JsonArtifactFormat,\n MarkdownHeadingEntry,\n MarkdownCodeEntry,\n MarkdownSection,\n RawTurnContext,\n ResolvedTurnContext,\n MemoryRetrievalFn,\n MessageRetrievalFn,\n ThoughtRetrievalFn,\n ToolCallRetrievalFn,\n ToolsRetrievalFn,\n RetrievableRetrievalFn,\n StandingInstructionsRefreshFn,\n StandingInstructionStoreFn,\n StandingInstructionMutateFn,\n StandingInstructionDeleteFn,\n MemoryStoreFn,\n MemoryMutateFn,\n MemoryDeleteFn,\n MessageStoreFn,\n MessageMutateFn,\n MessageDeleteFn,\n ThoughtStoreFn,\n ThoughtMutateFn,\n ThoughtDeleteFn,\n ToolCallStoreFn,\n ToolCallMutateFn,\n ToolCallDeleteFn,\n RetrievableStoreFn,\n RetrievableMutateFn,\n RetrievableDeleteFn,\n TurnRunnerConfig,\n ResolvedTurnRunnerConfig,\n TurnPipelineMiddlewareFn,\n TurnStreamableContent,\n TurnToolCallContent,\n TurnStartEvent,\n TurnEndEvent,\n TurnGateClosedEvent,\n ToolExecutionStartEvent,\n ToolExecutionEndEvent,\n EmitMessageFn,\n EmitThoughtFn,\n EmitToolCallFn,\n EmitToolExecutionStartFn,\n EmitToolExecutionEndFn,\n OpenGateFn,\n TurnEvents,\n TurnEvent,\n TurnEventListener,\n TurnObservabilityEvents,\n TurnObservabilityEvent,\n TurnObservabilityEventListener,\n RawDispatchContext,\n DispatchMemoryRetrievalFn,\n DispatchMessageRetrievalFn,\n DispatchThoughtRetrievalFn,\n DispatchToolCallRetrievalFn,\n DispatchToolsRetrievalFn,\n DispatchStandingInstructionsRefreshFn,\n DispatchStandingInstructionStoreFn,\n DispatchStandingInstructionMutateFn,\n DispatchStandingInstructionDeleteFn,\n DispatchMemoryStoreFn,\n DispatchMemoryMutateFn,\n DispatchMemoryDeleteFn,\n DispatchMessageStoreFn,\n DispatchMessageMutateFn,\n DispatchMessageDeleteFn,\n DispatchThoughtStoreFn,\n DispatchThoughtMutateFn,\n DispatchThoughtDeleteFn,\n DispatchToolCallStoreFn,\n DispatchToolCallMutateFn,\n DispatchToolCallDeleteFn,\n DispatchContextHooks,\n DispatchContextHookRegistrations,\n RawDispatchRunnerInput,\n DispatchPipelineMiddlewareFn,\n DispatchExecutorFn,\n DispatchExecutorHelpers,\n DispatchExecutorLogChannel,\n DispatchExecutorLogEntry,\n DispatchExecutorLogLevel,\n LogEvent,\n DispatchStartEvent,\n DispatchEndEvent,\n IterationStartEvent,\n IterationEndEvent,\n DispatchRunnerFunctionalHooks,\n DispatchRunnerObservabilityHooks,\n DispatchRunnerFunctionalHookRegistrations,\n DispatchRunnerObservabilityHookRegistrations,\n} from './types'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,IAAa,UAAA"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Root convenience barrel for the ADK's core runtime values and public TypeScript contracts.\n *\n * @module @nhtio/adk\n */\n\n/**\n * The current version of the package.\n *\n * @tip This is a constant that is replaced during the build process with the actual version of the package.\n */\nexport const version = __VERSION__\n\n// ── Data primitives (value classes + Raw* types) ──────────────────────────────\n\nexport {\n Tokenizable,\n TokenEncoding,\n Registry,\n Identity,\n Memory,\n Message,\n Retrievable,\n Thought,\n ToolCall,\n Tool,\n ArtifactTool,\n ToolRegistry,\n SpooledArtifact,\n SpooledJsonArtifact,\n SpooledMarkdownArtifact,\n implementsSpoolReader,\n Media,\n isMedia,\n implementsMediaReader,\n mediaReaderSchema,\n inMemoryMediaReader,\n fromFetch,\n fromWebFile,\n} from './common'\n\nexport type {\n RawMedia,\n SerializedMedia,\n MediaKind,\n MediaTrustTier,\n MediaModalityHazard,\n MediaStashEntry,\n MediaReader,\n} from './common'\n\n// ── Runners (the entry points for executing turns and dispatches) ─────────────\n\nexport { TurnRunner } from './turn_runner'\nexport { DispatchRunner } from './dispatch_runner'\n\n// ── Freestanding guards ───────────────────────────────────────────────────────\n\nexport {\n isInstanceOf,\n isError,\n isObject,\n isBaseException,\n isIdentity,\n isMemory,\n isMessage,\n isRegistry,\n isThought,\n isTokenizable,\n isTool,\n isArtifactTool,\n isToolCall,\n isToolRegistry,\n isTurnGate,\n isSpooledArtifact,\n isSpooledArtifactConstructor,\n isSpooledJsonArtifact,\n isSpooledMarkdownArtifact,\n isTurnContext,\n isTurnRunner,\n isDispatchContext,\n isDispatchRunner,\n} from './guards'\n\n// ── Exceptions ────────────────────────────────────────────────────────────────\n\nexport {\n ValidationException,\n E_INVALID_TURN_RUNNER_CONFIG,\n E_INVALID_TURN_CONTEXT,\n E_INPUT_PIPELINE_ERROR,\n E_OUTPUT_PIPELINE_ERROR,\n E_PIPELINE_SHORT_CIRCUITED,\n E_INVALID_INITIAL_REGISTRY_VALUE,\n E_INVALID_INITIAL_MEMORY_VALUE,\n E_INVALID_INITIAL_MESSAGE_VALUE,\n E_INVALID_INITIAL_IDENTITY_VALUE,\n E_INVALID_INITIAL_THOUGHT_VALUE,\n E_INVALID_INITIAL_TURN_GATE_VALUE,\n E_INVALID_TURN_GATE_RESOLUTION,\n E_TURN_GATE_TIMEOUT,\n E_TURN_GATE_ABORTED,\n E_NOT_A_SPOOL_READER,\n E_INVALID_INITIAL_TOOL_CALL_VALUE,\n E_INVALID_INITIAL_TOOL_VALUE,\n E_INVALID_TOOL_ARGS,\n E_TOOL_DOWNSTREAM_ERROR,\n E_TOOL_ALREADY_REGISTERED,\n E_INVALID_LLM_EXECUTION_CONTEXT,\n E_LLM_EXECUTION_GATE_NOT_SUPPORTED,\n E_LLM_EXECUTION_ALREADY_SIGNALLED,\n E_INVALID_LLM_DISPATCH_INPUT,\n E_DISPATCH_PIPELINE_ERROR,\n E_LLM_EXECUTION_EXECUTOR_ERROR,\n} from './exceptions'\n\n// ── Types (re-exported via `export type *` form) ──────────────────────────────\n\nexport type {\n BaseException,\n TurnContext,\n DispatchContext,\n TurnGate,\n RawIdentity,\n RawMemory,\n RawMessage,\n MessageRole,\n RawThought,\n RawToolCall,\n RawTool,\n ToolHandler,\n RawArtifactTool,\n ArtifactToolHandler,\n MergeOptions,\n SpooledArtifactConstructor,\n ToolMethodDescriptor,\n RawTurnGate,\n SpoolReader,\n JsonArtifactFormat,\n MarkdownHeadingEntry,\n MarkdownCodeEntry,\n MarkdownSection,\n RawTurnContext,\n ResolvedTurnContext,\n MemoryRetrievalFn,\n MessageRetrievalFn,\n ThoughtRetrievalFn,\n ToolCallRetrievalFn,\n ToolsRetrievalFn,\n RetrievableRetrievalFn,\n StandingInstructionsRefreshFn,\n StandingInstructionStoreFn,\n StandingInstructionMutateFn,\n StandingInstructionDeleteFn,\n MemoryStoreFn,\n MemoryMutateFn,\n MemoryDeleteFn,\n MessageStoreFn,\n MessageMutateFn,\n MessageDeleteFn,\n ThoughtStoreFn,\n ThoughtMutateFn,\n ThoughtDeleteFn,\n ToolCallStoreFn,\n ToolCallMutateFn,\n ToolCallDeleteFn,\n RetrievableStoreFn,\n RetrievableMutateFn,\n RetrievableDeleteFn,\n MediaBytesStoreFn,\n RetrievableBytesStoreFn,\n TurnRunnerConfig,\n ResolvedTurnRunnerConfig,\n TurnPipelineMiddlewareFn,\n TurnStreamableContent,\n TurnToolCallContent,\n TurnStartEvent,\n TurnEndEvent,\n TurnGateClosedEvent,\n ToolExecutionStartEvent,\n ToolExecutionEndEvent,\n EmitMessageFn,\n EmitThoughtFn,\n EmitToolCallFn,\n EmitToolExecutionStartFn,\n EmitToolExecutionEndFn,\n OpenGateFn,\n TurnEvents,\n TurnEvent,\n TurnEventListener,\n TurnObservabilityEvents,\n TurnObservabilityEvent,\n TurnObservabilityEventListener,\n RawDispatchContext,\n DispatchMemoryRetrievalFn,\n DispatchMessageRetrievalFn,\n DispatchThoughtRetrievalFn,\n DispatchToolCallRetrievalFn,\n DispatchToolsRetrievalFn,\n DispatchStandingInstructionsRefreshFn,\n DispatchStandingInstructionStoreFn,\n DispatchStandingInstructionMutateFn,\n DispatchStandingInstructionDeleteFn,\n DispatchMemoryStoreFn,\n DispatchMemoryMutateFn,\n DispatchMemoryDeleteFn,\n DispatchMessageStoreFn,\n DispatchMessageMutateFn,\n DispatchMessageDeleteFn,\n DispatchThoughtStoreFn,\n DispatchThoughtMutateFn,\n DispatchThoughtDeleteFn,\n DispatchToolCallStoreFn,\n DispatchToolCallMutateFn,\n DispatchToolCallDeleteFn,\n DispatchMediaBytesStoreFn,\n DispatchRetrievableBytesStoreFn,\n ConduitBytes,\n DispatchContextHooks,\n DispatchContextHookRegistrations,\n RawDispatchRunnerInput,\n DispatchPipelineMiddlewareFn,\n DispatchExecutorFn,\n DispatchExecutorHelpers,\n DispatchExecutorLogChannel,\n DispatchExecutorLogEntry,\n DispatchExecutorLogLevel,\n LogEvent,\n DispatchStartEvent,\n DispatchEndEvent,\n IterationStartEvent,\n IterationEndEvent,\n DispatchRunnerFunctionalHooks,\n DispatchRunnerObservabilityHooks,\n DispatchRunnerFunctionalHookRegistrations,\n DispatchRunnerObservabilityHookRegistrations,\n} from './types'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,IAAa,UAAA"}
@@ -1,5 +1,7 @@
1
1
  import { Tokenizable } from "./tokenizable";
2
+ import { SpooledArtifact } from "./spooled_artifact";
2
3
  import type { DateTime } from 'luxon';
4
+ import type { TokenEncoding } from "./tokenizable";
3
5
  /**
4
6
  * Trust-tier discriminator declared by the retrieval middleware at construction time. Drives
5
7
  * which envelope the LLM battery wraps the record in.
@@ -33,8 +35,15 @@ export interface RawRetrievable {
33
35
  * rendered envelope, so it must be unguessable from the payload.
34
36
  */
35
37
  id: string;
36
- /** The retrieved content as a plain string or an existing {@link @nhtio/adk!Tokenizable} instance. */
37
- content: string | Tokenizable;
38
+ /**
39
+ * The retrieved content. A plain `string` or {@link @nhtio/adk!Tokenizable} for small inline text, or a
40
+ * {@link @nhtio/adk!SpooledArtifact} when the extracted text is large and lives in a consumer
41
+ * {@link @nhtio/adk!ByteStore} (persist it via {@link @nhtio/adk!DispatchContext.storeRetrievableBytes}, wrap
42
+ * the returned reader in a `SpooledArtifact`, and pass it here). Reader-backed content keeps the
43
+ * body out of the permanent heap, but token estimation and render still materialise it
44
+ * transiently (see {@link Retrievable.estimateTokens}).
45
+ */
46
+ content: string | Tokenizable | SpooledArtifact;
38
47
  /**
39
48
  * Trust tier declared by the retrieval middleware at construction time. Required — there is
40
49
  * NO default. The decision must be conscious. See {@link RetrievableTrustTier}.
@@ -78,8 +87,13 @@ export declare class Retrievable {
78
87
  static isRetrievable(value: unknown): value is Retrievable;
79
88
  /** Stable unique identifier for this retrieved record. */
80
89
  readonly id: string;
81
- /** The retrieved content as a {@link @nhtio/adk!Tokenizable} for inline token estimation. */
82
- readonly content: Tokenizable;
90
+ /**
91
+ * The retrieved content: a {@link @nhtio/adk!Tokenizable} (inline text) or a
92
+ * {@link @nhtio/adk!SpooledArtifact} (reader-backed, large text living in a consumer store). Use
93
+ * {@link Retrievable.estimateTokens} for budgeting and {@link Retrievable.contentString} to
94
+ * materialise the body at render time.
95
+ */
96
+ readonly content: Tokenizable | SpooledArtifact;
83
97
  /** Trust tier declared by the retrieval middleware. */
84
98
  readonly trustTier: RetrievableTrustTier;
85
99
  /** Optional provenance string. */
@@ -97,4 +111,33 @@ export declare class Retrievable {
97
111
  * @throws {@link @nhtio/adk/exceptions!E_INVALID_INITIAL_RETRIEVABLE_VALUE} when `raw` does not satisfy the schema.
98
112
  */
99
113
  constructor(raw: RawRetrievable);
114
+ /**
115
+ * Estimates the token count of the content under `encoding`.
116
+ *
117
+ * @remarks
118
+ * Delegates to the content's own `estimateTokens`: synchronous for a {@link @nhtio/adk!Tokenizable}
119
+ * (returns `number`), asynchronous for a {@link @nhtio/adk!SpooledArtifact} (returns
120
+ * `Promise<number>`, reading the bytes from the backing store on demand). Both shapes satisfy the
121
+ * adapter's token-budget path, which already awaits estimates.
122
+ *
123
+ * Note: the `SpooledArtifact` branch materialises the full decoded string transiently to count
124
+ * tokens — reader-backing keeps the body off the *permanent* heap, but does not eliminate the
125
+ * transient allocation at budgeting time.
126
+ *
127
+ * @param encoding - The encoding identifier to use for counting.
128
+ * @returns The estimated token count.
129
+ */
130
+ estimateTokens(encoding: TokenEncoding): number | Promise<number>;
131
+ /**
132
+ * Returns the content body as a single string.
133
+ *
134
+ * @remarks
135
+ * For a {@link @nhtio/adk!Tokenizable} this is synchronous in effect (resolved immediately); for a
136
+ * {@link @nhtio/adk!SpooledArtifact} it reads the full body from the backing store via
137
+ * {@link @nhtio/adk!SpooledArtifact.asString}. Always returns a `Promise` so callers have one
138
+ * code path; render helpers `await` it at the point the trust-tier envelope is built.
139
+ *
140
+ * @returns The full content body as a string.
141
+ */
142
+ contentString(): Promise<string>;
100
143
  }
@@ -0,0 +1,93 @@
1
+ import type { SpoolReader } from "./spool_reader";
2
+ import type { MediaReader } from "./media_reader";
3
+ /**
4
+ * Unified "give bytes, get a reader" persistence contract.
5
+ *
6
+ * @remarks
7
+ * For the purposes of storage there is no meaningful distinction between text and binary — bytes
8
+ * are bytes. `ByteStore` is the single low-level shape every ADK storage layer implements: hand it
9
+ * bytes under an `id`, get back a replayable reader `R`; read or delete by the same `id` later. The
10
+ * generic `R` is the reader the store hands out — different reader contracts (line-indexed
11
+ * {@link @nhtio/adk!SpoolReader} vs binary-streamed {@link @nhtio/adk!MediaReader}) are
12
+ * distinguished by the `R` instantiation, not by separate store interfaces. See the {@link SpoolStore}
13
+ * and {@link MediaStore} aliases for the two concrete semantics.
14
+ *
15
+ * `write` accepts a `string`, a `Uint8Array`, or a `ReadableStream<Uint8Array>`. The stream form is
16
+ * the point of the contract: a durable store can persist an arbitrarily large payload straight to
17
+ * disk/object storage without first materializing it in memory. **String input is encoded as
18
+ * UTF-8.** The returned reader is only guaranteed readable once the `write` result has resolved.
19
+ *
20
+ * All three methods may be synchronous or asynchronous so that in-memory implementations are not
21
+ * forced to pay promise overhead while I/O-backed implementations stay async. Note that any
22
+ * implementation accepting a `ReadableStream` must return a `Promise` for that input — draining a
23
+ * stream cannot be synchronous.
24
+ */
25
+ export interface ByteStore<R> {
26
+ /**
27
+ * Persists `bytes` under `id` and returns a reader over them.
28
+ *
29
+ * @remarks
30
+ * Re-writing the same `id` replaces the prior entry. `string` input is encoded as UTF-8;
31
+ * `Uint8Array` and `ReadableStream<Uint8Array>` are stored byte-faithfully. Stream input
32
+ * necessarily resolves asynchronously.
33
+ *
34
+ * @param id - Identifier used to retrieve or delete the bytes later.
35
+ * @param bytes - The payload, as a `string`, `Uint8Array`, or `ReadableStream<Uint8Array>`.
36
+ * @returns A reader over the stored bytes (or a `Promise` of one).
37
+ */
38
+ write(id: string, bytes: string | Uint8Array | ReadableStream<Uint8Array>): R | Promise<R>;
39
+ /**
40
+ * Returns a reader over the bytes previously written under `id`, or `undefined` if no entry
41
+ * exists.
42
+ *
43
+ * @param id - Identifier supplied to a prior {@link ByteStore.write} call.
44
+ * @returns A reader over the stored bytes, `undefined`, or a `Promise` of either.
45
+ */
46
+ read(id: string): R | undefined | Promise<R | undefined>;
47
+ /**
48
+ * Removes the entry under `id`.
49
+ *
50
+ * @param id - Identifier whose entry should be removed.
51
+ * @returns `true` if an entry existed and was removed; `false` otherwise (or a `Promise` of one).
52
+ */
53
+ delete(id: string): boolean | Promise<boolean>;
54
+ }
55
+ /**
56
+ * A {@link ByteStore} that hands out line-indexed text readers ({@link @nhtio/adk!SpoolReader}).
57
+ *
58
+ * @remarks
59
+ * The store backing tool-output artifacts. Stored bytes are decoded as UTF-8 text for line-oriented
60
+ * reads; binary input is stored byte-faithfully but `SpoolReader.readAll()` interprets it as text,
61
+ * so opaque binary belongs in a {@link MediaStore} / `Media`, not here.
62
+ */
63
+ export type SpoolStore = ByteStore<SpoolReader>;
64
+ /**
65
+ * A {@link ByteStore} that hands out binary-streamed readers ({@link @nhtio/adk!MediaReader}).
66
+ *
67
+ * @remarks
68
+ * The store backing persisted media bytes. Stored bytes are opaque and replayable via
69
+ * `MediaReader.stream()`; no text decoding is implied.
70
+ */
71
+ export type MediaStore = ByteStore<MediaReader>;
72
+ /**
73
+ * Validator schema used to validate a {@link ByteStore} value.
74
+ *
75
+ * @remarks
76
+ * Because `ByteStore` is a structural interface with no associated constructor, validation is
77
+ * duck-typed: the value must be non-null with `write`, `read`, and `delete` present as callable
78
+ * properties. Arity is not enforced — implementations may add optional parameters beyond the
79
+ * contract. The reader type `R` cannot be checked structurally here; conformance of the reader is
80
+ * the caller's concern at the point of use.
81
+ */
82
+ export declare const byteStoreSchema: import("@nhtio/validation").AnySchema<any>;
83
+ /**
84
+ * Returns `true` if `value` implements the {@link ByteStore} interface.
85
+ *
86
+ * @remarks
87
+ * Duck-typed: checks that `value` is non-null with `write`, `read`, and `delete` as callable
88
+ * functions. Does not use `instanceof` — there is no `ByteStore` constructor.
89
+ *
90
+ * @param value - The value to test.
91
+ * @returns `true` when `value` conforms to the {@link ByteStore} interface.
92
+ */
93
+ export declare const implementsByteStore: <R = unknown>(value: unknown) => value is ByteStore<R>;
@@ -5,10 +5,14 @@ import type { Tool } from "../classes/tool";
5
5
  import type { Memory } from "../classes/memory";
6
6
  import type { Message } from "../classes/message";
7
7
  import type { Thought } from "../classes/thought";
8
+ import type { SpoolReader } from "./spool_reader";
9
+ import type { MediaReader } from "./media_reader";
8
10
  import type { ToolCall } from "../classes/tool_call";
9
11
  import type { Retrievable } from "../classes/retrievable";
10
12
  import type { DispatchContextHookRegistrations } from "../types/dispatch_context";
11
13
  import type { EmitMessageFn, EmitThoughtFn, EmitToolCallFn, EmitToolExecutionStartFn, EmitToolExecutionEndFn, OpenGateFn } from "../types/turn_runner";
14
+ /** Payload accepted by the byte-persistence conduits — text, raw bytes, or a stream. */
15
+ export type ConduitBytes = string | Uint8Array | ReadableStream<Uint8Array>;
12
16
  /** Retrieves memories for an LLM execution context. */
13
17
  export type DispatchMemoryRetrievalFn = (ctx: DispatchContext) => Memory[] | Promise<Memory[]>;
14
18
  /** Retrieves messages for an LLM execution context. */
@@ -59,6 +63,20 @@ export type DispatchToolCallStoreFn = (ctx: DispatchContext, v: ToolCall) => voi
59
63
  export type DispatchToolCallMutateFn = (ctx: DispatchContext, v: ToolCall) => void | Promise<void>;
60
64
  /** Removes a tool call by ID (LLM execution context variant). */
61
65
  export type DispatchToolCallDeleteFn = (ctx: DispatchContext, id: string) => void | Promise<void>;
66
+ /**
67
+ * Persists tool-generated media bytes into consumer storage and returns a {@link @nhtio/adk!MediaReader}
68
+ * (LLM execution context variant). Unlike the `store*` mutation callbacks this returns a value and
69
+ * does NOT add anything to the turn Sets — the handler builds a {@link @nhtio/adk!Media} from the reader
70
+ * and persists it via `storeMessage`/`storeToolCall` separately.
71
+ */
72
+ export type DispatchMediaBytesStoreFn = (ctx: DispatchContext, id: string, bytes: ConduitBytes) => MediaReader | Promise<MediaReader>;
73
+ /**
74
+ * Persists extracted retrievable text bytes into consumer storage and returns a
75
+ * {@link @nhtio/adk!SpoolReader} (LLM execution context variant). The handler wraps the reader in a
76
+ * {@link @nhtio/adk!SpooledArtifact} for `new Retrievable({ content })` and persists the record via
77
+ * `storeRetrievable` separately. Returns a value; does NOT touch the turn Sets.
78
+ */
79
+ export type DispatchRetrievableBytesStoreFn = (ctx: DispatchContext, id: string, bytes: ConduitBytes) => SpoolReader | Promise<SpoolReader>;
62
80
  /**
63
81
  * Plain input object supplied to {@link DispatchContext} at construction time.
64
82
  *
@@ -139,6 +157,10 @@ export interface RawDispatchContext {
139
157
  mutateToolCall: DispatchToolCallMutateFn;
140
158
  /** Removes a tool call by ID. */
141
159
  deleteToolCall: DispatchToolCallDeleteFn;
160
+ /** Persists tool-generated media bytes; returns a `MediaReader`. */
161
+ storeMediaBytes: DispatchMediaBytesStoreFn;
162
+ /** Persists extracted retrievable text bytes; returns a `SpoolReader`. */
163
+ storeRetrievableBytes: DispatchRetrievableBytesStoreFn;
142
164
  /** Optional hook registrations for emit events. */
143
165
  hooks?: DispatchContextHookRegistrations;
144
166
  /** Optional gate suspension function. When absent, `waitFor` rejects with {@link @nhtio/adk!E_LLM_EXECUTION_GATE_NOT_SUPPORTED}. */
@@ -330,6 +352,28 @@ export declare class DispatchContext {
330
352
  readonly mutateToolCall: (v: ToolCall) => Promise<void>;
331
353
  /** Removes a tool call from the local Set and persistence layer by ID. */
332
354
  readonly deleteToolCall: (id: string) => Promise<void>;
355
+ /**
356
+ * Persists tool-generated media bytes into consumer storage and returns a {@link @nhtio/adk!MediaReader}.
357
+ *
358
+ * @remarks
359
+ * This is a low-level persistence conduit, NOT a mutation: it does not add to `turnMessages`/
360
+ * `turnToolCalls` or fire a `stored*` hook. The handler builds a {@link @nhtio/adk!Media} from the
361
+ * returned reader (`Media.toolGenerated({ reader })`) and stores the owning primitive — a
362
+ * {@link @nhtio/adk!Message} attachment or {@link @nhtio/adk!ToolCall} result — via the relevant
363
+ * `store*` method separately. Persisting bytes without storing the primitive means the framework
364
+ * never sees the media.
365
+ */
366
+ readonly storeMediaBytes: (id: string, bytes: ConduitBytes) => MediaReader | Promise<MediaReader>;
367
+ /**
368
+ * Persists extracted retrievable text bytes into consumer storage and returns a
369
+ * {@link @nhtio/adk!SpoolReader}.
370
+ *
371
+ * @remarks
372
+ * Low-level persistence conduit, same posture as {@link DispatchContext.storeMediaBytes}: returns a
373
+ * value, touches no Sets, fires no hook. Wrap the reader in a {@link @nhtio/adk!SpooledArtifact} and
374
+ * pass it as `Retrievable.content`, then persist the record via {@link DispatchContext.storeRetrievable}.
375
+ */
376
+ readonly storeRetrievableBytes: (id: string, bytes: ConduitBytes) => SpoolReader | Promise<SpoolReader>;
333
377
  /** Emits a `message` hook; fires registered handlers synchronously. */
334
378
  readonly emitMessage: EmitMessageFn;
335
379
  /** Emits a `thought` hook; fires registered handlers synchronously. */
@@ -1,7 +1,7 @@
1
1
  import { Tool } from "../classes/tool";
2
2
  import type { TurnPipelineMiddlewareFn } from "../types/turn_runner";
3
3
  import type { DispatchPipelineMiddlewareFn, DispatchExecutorFn } from "../types/dispatch_runner";
4
- import type { MemoryRetrievalFn, MessageRetrievalFn, ThoughtRetrievalFn, ToolCallRetrievalFn, ToolsRetrievalFn, StandingInstructionsRefreshFn, StandingInstructionStoreFn, StandingInstructionMutateFn, StandingInstructionDeleteFn, MemoryStoreFn, MemoryMutateFn, MemoryDeleteFn, RetrievableRetrievalFn, RetrievableStoreFn, RetrievableMutateFn, RetrievableDeleteFn, MessageStoreFn, MessageMutateFn, MessageDeleteFn, ThoughtStoreFn, ThoughtMutateFn, ThoughtDeleteFn, ToolCallStoreFn, ToolCallMutateFn, ToolCallDeleteFn } from "./turn_runner_context";
4
+ import type { MemoryRetrievalFn, MessageRetrievalFn, ThoughtRetrievalFn, ToolCallRetrievalFn, ToolsRetrievalFn, StandingInstructionsRefreshFn, StandingInstructionStoreFn, StandingInstructionMutateFn, StandingInstructionDeleteFn, MemoryStoreFn, MemoryMutateFn, MemoryDeleteFn, RetrievableRetrievalFn, RetrievableStoreFn, RetrievableMutateFn, RetrievableDeleteFn, MessageStoreFn, MessageMutateFn, MessageDeleteFn, ThoughtStoreFn, ThoughtMutateFn, ThoughtDeleteFn, ToolCallStoreFn, ToolCallMutateFn, ToolCallDeleteFn, MediaBytesStoreFn, RetrievableBytesStoreFn } from "./turn_runner_context";
5
5
  /**
6
6
  * Configuration supplied to {@link @nhtio/adk!TurnRunner} at construction time.
7
7
  *
@@ -69,6 +69,10 @@ export interface TurnRunnerConfig {
69
69
  mutateToolCallCallback: ToolCallMutateFn;
70
70
  /** Removes a tool call from the persistence layer by ID. */
71
71
  deleteToolCallCallback: ToolCallDeleteFn;
72
+ /** Persists tool-generated media bytes into consumer storage; returns a `MediaReader`. */
73
+ storeMediaBytesCallback: MediaBytesStoreFn;
74
+ /** Persists extracted retrievable text bytes into consumer storage; returns a `SpoolReader`. */
75
+ storeRetrievableBytesCallback: RetrievableBytesStoreFn;
72
76
  /** Baseline tools available on every turn. Middleware may trim or extend this per-turn via `ctx.tools`. Defaults to `[]`. */
73
77
  tools?: Tool[];
74
78
  /** Turn-level input middleware, executed in order against the {@link @nhtio/adk!TurnContext} before the LLM dispatch. Defaults to `[]`. */
@@ -4,7 +4,10 @@ import type { Tool } from "../classes/tool";
4
4
  import type { Memory } from "../classes/memory";
5
5
  import type { Message } from "../classes/message";
6
6
  import type { Thought } from "../classes/thought";
7
+ import type { SpoolReader } from "./spool_reader";
8
+ import type { MediaReader } from "./media_reader";
7
9
  import type { ToolCall } from "../classes/tool_call";
10
+ import type { ConduitBytes } from "./dispatch_context";
8
11
  import type { Retrievable } from "../classes/retrievable";
9
12
  import type { ToolRegistry } from "../classes/tool_registry";
10
13
  import type { EmitMessageFn, EmitThoughtFn, EmitToolCallFn, EmitToolExecutionEndFn, EmitToolExecutionStartFn, OpenGateFn } from "../types/turn_runner";
@@ -149,6 +152,16 @@ export type ToolCallStoreFn = (ctx: TurnContext, v: ToolCall) => void | Promise<
149
152
  export type ToolCallMutateFn = (ctx: TurnContext, v: ToolCall) => void | Promise<void>;
150
153
  /** Removes a tool call from the persistence layer by ID. */
151
154
  export type ToolCallDeleteFn = (ctx: TurnContext, id: string) => void | Promise<void>;
155
+ /**
156
+ * Persists tool-generated media bytes into consumer storage and returns a {@link @nhtio/adk!MediaReader}.
157
+ * A byte-persistence conduit, not a mutation — returns a value and touches no turn state.
158
+ */
159
+ export type MediaBytesStoreFn = (ctx: TurnContext, id: string, bytes: ConduitBytes) => MediaReader | Promise<MediaReader>;
160
+ /**
161
+ * Persists extracted retrievable text bytes into consumer storage and returns a
162
+ * {@link @nhtio/adk!SpoolReader}. A byte-persistence conduit, not a mutation.
163
+ */
164
+ export type RetrievableBytesStoreFn = (ctx: TurnContext, id: string, bytes: ConduitBytes) => SpoolReader | Promise<SpoolReader>;
152
165
  /**
153
166
  * The validated, strongly-typed context object threaded through every middleware step in a
154
167
  * single agent turn.
@@ -250,6 +263,18 @@ export declare class TurnContext {
250
263
  readonly mutateToolCall: (v: ToolCall) => void | Promise<void>;
251
264
  /** Removes a tool call from the persistence layer by ID. */
252
265
  readonly deleteToolCall: (id: string) => void | Promise<void>;
266
+ /**
267
+ * Persists tool-generated media bytes into consumer storage and returns a {@link @nhtio/adk!MediaReader}.
268
+ * Low-level conduit — returns a value, touches no turn state; build a {@link @nhtio/adk!Media} from the
269
+ * reader and persist the owning primitive separately.
270
+ */
271
+ readonly storeMediaBytes: (id: string, bytes: ConduitBytes) => MediaReader | Promise<MediaReader>;
272
+ /**
273
+ * Persists extracted retrievable text bytes into consumer storage and returns a
274
+ * {@link @nhtio/adk!SpoolReader}. Wrap it in a {@link @nhtio/adk!SpooledArtifact} for `Retrievable.content`
275
+ * and persist the record via {@link TurnContext.storeRetrievable} separately.
276
+ */
277
+ readonly storeRetrievableBytes: (id: string, bytes: ConduitBytes) => SpoolReader | Promise<SpoolReader>;
253
278
  /** Emits a `message` event on the runner; may be called at any point during the turn. */
254
279
  readonly emitMessage: EmitMessageFn;
255
280
  /** Emits a `thought` event on the runner; may be called at any point during the turn. */