@tambo-ai/react 0.75.0 → 1.0.0-rc.4
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.
- package/dist/hoc/with-tambo-interactable.d.ts.map +1 -1
- package/dist/hoc/with-tambo-interactable.js +13 -13
- package/dist/hoc/with-tambo-interactable.js.map +1 -1
- package/dist/hoc/with-tambo-interactable.test.js +3 -3
- package/dist/hoc/with-tambo-interactable.test.js.map +1 -1
- package/dist/index.d.ts +7 -25
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -59
- package/dist/index.js.map +1 -1
- package/dist/mcp/mcp-hooks.js +5 -5
- package/dist/mcp/mcp-hooks.js.map +1 -1
- package/dist/model/component-metadata.d.ts +4 -4
- package/dist/model/component-metadata.js.map +1 -1
- package/dist/providers/tambo-client-provider.d.ts +6 -0
- package/dist/providers/tambo-client-provider.d.ts.map +1 -1
- package/dist/providers/tambo-client-provider.js +4 -2
- package/dist/providers/tambo-client-provider.js.map +1 -1
- package/dist/providers/tambo-interactable-provider.d.ts +1 -1
- package/dist/providers/tambo-interactables-additional-context-edge-cases.test.js +2 -10
- package/dist/providers/tambo-interactables-additional-context-edge-cases.test.js.map +1 -1
- package/dist/providers/tambo-interactables-additional-context.test.js +3 -19
- package/dist/providers/tambo-interactables-additional-context.test.js.map +1 -1
- package/dist/providers/tambo-mcp-token-provider.d.ts +8 -17
- package/dist/providers/tambo-mcp-token-provider.d.ts.map +1 -1
- package/dist/providers/tambo-mcp-token-provider.js +20 -97
- package/dist/providers/tambo-mcp-token-provider.js.map +1 -1
- package/dist/testing/tools.d.ts +3 -3
- package/dist/testing/tools.d.ts.map +1 -1
- package/dist/testing/tools.js.map +1 -1
- package/dist/util/registry-validators.js +1 -1
- package/dist/util/registry-validators.js.map +1 -1
- package/dist/v1/__tests__/v1-interactables.test.js +1 -1
- package/dist/v1/__tests__/v1-interactables.test.js.map +1 -1
- package/dist/v1/components/v1-component-renderer.d.ts +9 -9
- package/dist/v1/components/v1-component-renderer.d.ts.map +1 -1
- package/dist/v1/components/v1-component-renderer.js +13 -13
- package/dist/v1/components/v1-component-renderer.js.map +1 -1
- package/dist/v1/components/v1-component-renderer.test.js +15 -15
- package/dist/v1/components/v1-component-renderer.test.js.map +1 -1
- package/{esm/hooks/use-current-message.d.ts → dist/v1/hooks/use-tambo-current-message.d.ts} +30 -9
- package/dist/v1/hooks/use-tambo-current-message.d.ts.map +1 -0
- package/dist/{hooks/use-current-message.js → v1/hooks/use-tambo-current-message.js} +13 -8
- package/dist/v1/hooks/use-tambo-current-message.js.map +1 -0
- package/dist/v1/hooks/use-tambo-v1-auth-state.d.ts +5 -5
- package/dist/v1/hooks/use-tambo-v1-auth-state.d.ts.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-auth-state.js +8 -8
- package/dist/v1/hooks/use-tambo-v1-auth-state.js.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-auth-state.test.js +12 -12
- package/dist/v1/hooks/use-tambo-v1-auth-state.test.js.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-component-state.d.ts +7 -6
- package/dist/v1/hooks/use-tambo-v1-component-state.d.ts.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-component-state.js +50 -24
- package/dist/v1/hooks/use-tambo-v1-component-state.js.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-component-state.test.js +60 -35
- package/dist/v1/hooks/use-tambo-v1-component-state.test.js.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-messages.d.ts +9 -9
- package/dist/v1/hooks/use-tambo-v1-messages.d.ts.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-messages.js +4 -4
- package/dist/v1/hooks/use-tambo-v1-messages.js.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-messages.test.js +7 -7
- package/dist/v1/hooks/use-tambo-v1-messages.test.js.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-send-message.d.ts +3 -3
- package/dist/v1/hooks/use-tambo-v1-send-message.d.ts.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-send-message.js +20 -22
- package/dist/v1/hooks/use-tambo-v1-send-message.js.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-send-message.test.js +51 -51
- package/dist/v1/hooks/use-tambo-v1-send-message.test.js.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-stream-status.d.ts +5 -5
- package/dist/v1/hooks/use-tambo-v1-stream-status.d.ts.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-stream-status.js +12 -14
- package/dist/v1/hooks/use-tambo-v1-stream-status.js.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-stream-status.test.js +19 -19
- package/dist/v1/hooks/use-tambo-v1-stream-status.test.js.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-suggestions.d.ts +7 -7
- package/dist/v1/hooks/use-tambo-v1-suggestions.d.ts.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-suggestions.js +9 -9
- package/dist/v1/hooks/use-tambo-v1-suggestions.js.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-suggestions.test.js +44 -44
- package/dist/v1/hooks/use-tambo-v1-suggestions.test.js.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-thread-input.d.ts +3 -3
- package/dist/v1/hooks/use-tambo-v1-thread-input.d.ts.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-thread-input.js +4 -4
- package/dist/v1/hooks/use-tambo-v1-thread-input.js.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-thread-input.test.js +29 -29
- package/dist/v1/hooks/use-tambo-v1-thread-input.test.js.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-thread-list.d.ts +4 -4
- package/dist/v1/hooks/use-tambo-v1-thread-list.d.ts.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-thread-list.js +5 -5
- package/dist/v1/hooks/use-tambo-v1-thread-list.js.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-thread-list.test.js +13 -17
- package/dist/v1/hooks/use-tambo-v1-thread-list.test.js.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-thread.d.ts +3 -3
- package/dist/v1/hooks/use-tambo-v1-thread.d.ts.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-thread.js +4 -4
- package/dist/v1/hooks/use-tambo-v1-thread.js.map +1 -1
- package/dist/v1/hooks/use-tambo-v1-thread.test.js +5 -5
- package/dist/v1/hooks/use-tambo-v1-thread.test.js.map +1 -1
- package/dist/v1/hooks/use-tambo-v1.d.ts +16 -7
- package/dist/v1/hooks/use-tambo-v1.d.ts.map +1 -1
- package/dist/v1/hooks/use-tambo-v1.js +41 -10
- package/dist/v1/hooks/use-tambo-v1.js.map +1 -1
- package/dist/v1/hooks/use-tambo-v1.test.js +176 -48
- package/dist/v1/hooks/use-tambo-v1.test.js.map +1 -1
- package/dist/v1/index.d.ts +31 -27
- package/dist/v1/index.d.ts.map +1 -1
- package/dist/v1/index.js +45 -35
- package/dist/v1/index.js.map +1 -1
- package/dist/v1/providers/tambo-v1-provider.d.ts +20 -20
- package/dist/v1/providers/tambo-v1-provider.d.ts.map +1 -1
- package/dist/v1/providers/tambo-v1-provider.js +32 -32
- package/dist/v1/providers/tambo-v1-provider.js.map +1 -1
- package/dist/v1/providers/tambo-v1-provider.test.js +22 -22
- package/dist/v1/providers/tambo-v1-provider.test.js.map +1 -1
- package/dist/v1/providers/tambo-v1-stream-context.d.ts +15 -15
- package/dist/v1/providers/tambo-v1-stream-context.d.ts.map +1 -1
- package/dist/v1/providers/tambo-v1-stream-context.js +17 -17
- package/dist/v1/providers/tambo-v1-stream-context.js.map +1 -1
- package/dist/v1/providers/tambo-v1-stream-context.test.js +9 -9
- package/dist/v1/providers/tambo-v1-stream-context.test.js.map +1 -1
- package/dist/v1/providers/tambo-v1-stub-provider.d.ts +9 -9
- package/dist/v1/providers/tambo-v1-stub-provider.d.ts.map +1 -1
- package/dist/v1/providers/tambo-v1-stub-provider.js +7 -7
- package/dist/v1/providers/tambo-v1-stub-provider.js.map +1 -1
- package/dist/v1/providers/tambo-v1-stub-provider.test.js +25 -25
- package/dist/v1/providers/tambo-v1-stub-provider.test.js.map +1 -1
- package/dist/v1/providers/tambo-v1-thread-input-provider.d.ts +9 -9
- package/dist/v1/providers/tambo-v1-thread-input-provider.d.ts.map +1 -1
- package/dist/v1/providers/tambo-v1-thread-input-provider.js +16 -16
- package/dist/v1/providers/tambo-v1-thread-input-provider.js.map +1 -1
- package/dist/v1/types/auth.d.ts +2 -2
- package/dist/v1/types/auth.d.ts.map +1 -1
- package/dist/v1/types/auth.js.map +1 -1
- package/dist/v1/types/component.d.ts +3 -3
- package/dist/v1/types/component.d.ts.map +1 -1
- package/dist/v1/types/component.js +2 -2
- package/dist/v1/types/component.js.map +1 -1
- package/dist/v1/types/event.d.ts +1 -1
- package/dist/v1/types/event.js +1 -1
- package/dist/v1/types/event.js.map +1 -1
- package/dist/v1/types/message.d.ts +17 -24
- package/dist/v1/types/message.d.ts.map +1 -1
- package/dist/v1/types/message.js +1 -1
- package/dist/v1/types/message.js.map +1 -1
- package/dist/v1/types/thread.d.ts +10 -8
- package/dist/v1/types/thread.d.ts.map +1 -1
- package/dist/v1/types/thread.js +1 -1
- package/dist/v1/types/thread.js.map +1 -1
- package/dist/v1/types/tool-choice.d.ts +1 -1
- package/dist/v1/types/tool-choice.js.map +1 -1
- package/dist/v1/utils/component-renderer.d.ts +11 -5
- package/dist/v1/utils/component-renderer.d.ts.map +1 -1
- package/dist/v1/utils/component-renderer.js +16 -7
- package/dist/v1/utils/component-renderer.js.map +1 -1
- package/dist/v1/utils/component-renderer.test.js +7 -7
- package/dist/v1/utils/component-renderer.test.js.map +1 -1
- package/dist/v1/utils/event-accumulator.d.ts +13 -13
- package/dist/v1/utils/event-accumulator.d.ts.map +1 -1
- package/dist/v1/utils/event-accumulator.js +26 -15
- package/dist/v1/utils/event-accumulator.js.map +1 -1
- package/dist/v1/utils/event-accumulator.test.js +54 -19
- package/dist/v1/utils/event-accumulator.test.js.map +1 -1
- package/dist/v1/utils/registry-conversion.d.ts +18 -18
- package/dist/v1/utils/registry-conversion.js +23 -23
- package/dist/v1/utils/registry-conversion.js.map +1 -1
- package/dist/v1/utils/stream-handler.d.ts +1 -1
- package/dist/v1/utils/stream-handler.js +1 -1
- package/dist/v1/utils/stream-handler.js.map +1 -1
- package/dist/v1/utils/thread-utils.d.ts +2 -2
- package/dist/v1/utils/thread-utils.d.ts.map +1 -1
- package/dist/v1/utils/thread-utils.js.map +1 -1
- package/dist/v1/utils/tool-call-tracker.d.ts +1 -1
- package/dist/v1/utils/tool-call-tracker.js +1 -1
- package/dist/v1/utils/tool-call-tracker.js.map +1 -1
- package/dist/v1/utils/tool-executor.d.ts +1 -1
- package/dist/v1/utils/tool-executor.js +2 -2
- package/dist/v1/utils/tool-executor.js.map +1 -1
- package/esm/hoc/with-tambo-interactable.d.ts.map +1 -1
- package/esm/hoc/with-tambo-interactable.js +13 -13
- package/esm/hoc/with-tambo-interactable.js.map +1 -1
- package/esm/hoc/with-tambo-interactable.test.js +1 -1
- package/esm/hoc/with-tambo-interactable.test.js.map +1 -1
- package/esm/index.d.ts +7 -25
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +7 -21
- package/esm/index.js.map +1 -1
- package/esm/mcp/mcp-hooks.js +1 -1
- package/esm/mcp/mcp-hooks.js.map +1 -1
- package/esm/model/component-metadata.d.ts +4 -4
- package/esm/model/component-metadata.js.map +1 -1
- package/esm/providers/tambo-client-provider.d.ts +6 -0
- package/esm/providers/tambo-client-provider.d.ts.map +1 -1
- package/esm/providers/tambo-client-provider.js +4 -2
- package/esm/providers/tambo-client-provider.js.map +1 -1
- package/esm/providers/tambo-interactable-provider.d.ts +1 -1
- package/esm/providers/tambo-interactables-additional-context-edge-cases.test.js +2 -10
- package/esm/providers/tambo-interactables-additional-context-edge-cases.test.js.map +1 -1
- package/esm/providers/tambo-interactables-additional-context.test.js +3 -19
- package/esm/providers/tambo-interactables-additional-context.test.js.map +1 -1
- package/esm/providers/tambo-mcp-token-provider.d.ts +8 -17
- package/esm/providers/tambo-mcp-token-provider.d.ts.map +1 -1
- package/esm/providers/tambo-mcp-token-provider.js +20 -97
- package/esm/providers/tambo-mcp-token-provider.js.map +1 -1
- package/esm/testing/tools.d.ts +3 -3
- package/esm/testing/tools.d.ts.map +1 -1
- package/esm/testing/tools.js.map +1 -1
- package/esm/util/registry-validators.js +1 -1
- package/esm/util/registry-validators.js.map +1 -1
- package/esm/v1/__tests__/v1-interactables.test.js +1 -1
- package/esm/v1/__tests__/v1-interactables.test.js.map +1 -1
- package/esm/v1/components/v1-component-renderer.d.ts +9 -9
- package/esm/v1/components/v1-component-renderer.d.ts.map +1 -1
- package/esm/v1/components/v1-component-renderer.js +12 -12
- package/esm/v1/components/v1-component-renderer.js.map +1 -1
- package/esm/v1/components/v1-component-renderer.test.js +16 -16
- package/esm/v1/components/v1-component-renderer.test.js.map +1 -1
- package/{dist/hooks/use-current-message.d.ts → esm/v1/hooks/use-tambo-current-message.d.ts} +30 -9
- package/esm/v1/hooks/use-tambo-current-message.d.ts.map +1 -0
- package/esm/{hooks/use-current-message.js → v1/hooks/use-tambo-current-message.js} +13 -8
- package/esm/v1/hooks/use-tambo-current-message.js.map +1 -0
- package/esm/v1/hooks/use-tambo-v1-auth-state.d.ts +5 -5
- package/esm/v1/hooks/use-tambo-v1-auth-state.d.ts.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-auth-state.js +8 -8
- package/esm/v1/hooks/use-tambo-v1-auth-state.js.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-auth-state.test.js +14 -14
- package/esm/v1/hooks/use-tambo-v1-auth-state.test.js.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-component-state.d.ts +7 -6
- package/esm/v1/hooks/use-tambo-v1-component-state.d.ts.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-component-state.js +50 -24
- package/esm/v1/hooks/use-tambo-v1-component-state.js.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-component-state.test.js +62 -37
- package/esm/v1/hooks/use-tambo-v1-component-state.test.js.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-messages.d.ts +9 -9
- package/esm/v1/hooks/use-tambo-v1-messages.d.ts.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-messages.js +3 -3
- package/esm/v1/hooks/use-tambo-v1-messages.js.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-messages.test.js +9 -9
- package/esm/v1/hooks/use-tambo-v1-messages.test.js.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-send-message.d.ts +3 -3
- package/esm/v1/hooks/use-tambo-v1-send-message.d.ts.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-send-message.js +21 -23
- package/esm/v1/hooks/use-tambo-v1-send-message.js.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-send-message.test.js +54 -54
- package/esm/v1/hooks/use-tambo-v1-send-message.test.js.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-stream-status.d.ts +5 -5
- package/esm/v1/hooks/use-tambo-v1-stream-status.d.ts.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-stream-status.js +12 -14
- package/esm/v1/hooks/use-tambo-v1-stream-status.js.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-stream-status.test.js +21 -21
- package/esm/v1/hooks/use-tambo-v1-stream-status.test.js.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-suggestions.d.ts +7 -7
- package/esm/v1/hooks/use-tambo-v1-suggestions.d.ts.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-suggestions.js +11 -11
- package/esm/v1/hooks/use-tambo-v1-suggestions.js.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-suggestions.test.js +48 -48
- package/esm/v1/hooks/use-tambo-v1-suggestions.test.js.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-thread-input.d.ts +3 -3
- package/esm/v1/hooks/use-tambo-v1-thread-input.d.ts.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-thread-input.js +3 -3
- package/esm/v1/hooks/use-tambo-v1-thread-input.js.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-thread-input.test.js +32 -32
- package/esm/v1/hooks/use-tambo-v1-thread-input.test.js.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-thread-list.d.ts +4 -4
- package/esm/v1/hooks/use-tambo-v1-thread-list.d.ts.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-thread-list.js +6 -6
- package/esm/v1/hooks/use-tambo-v1-thread-list.js.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-thread-list.test.js +15 -19
- package/esm/v1/hooks/use-tambo-v1-thread-list.test.js.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-thread.d.ts +3 -3
- package/esm/v1/hooks/use-tambo-v1-thread.d.ts.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-thread.js +4 -4
- package/esm/v1/hooks/use-tambo-v1-thread.js.map +1 -1
- package/esm/v1/hooks/use-tambo-v1-thread.test.js +6 -6
- package/esm/v1/hooks/use-tambo-v1-thread.test.js.map +1 -1
- package/esm/v1/hooks/use-tambo-v1.d.ts +16 -7
- package/esm/v1/hooks/use-tambo-v1.d.ts.map +1 -1
- package/esm/v1/hooks/use-tambo-v1.js +43 -12
- package/esm/v1/hooks/use-tambo-v1.js.map +1 -1
- package/esm/v1/hooks/use-tambo-v1.test.js +178 -50
- package/esm/v1/hooks/use-tambo-v1.test.js.map +1 -1
- package/esm/v1/index.d.ts +31 -27
- package/esm/v1/index.d.ts.map +1 -1
- package/esm/v1/index.js +38 -33
- package/esm/v1/index.js.map +1 -1
- package/esm/v1/providers/tambo-v1-provider.d.ts +20 -20
- package/esm/v1/providers/tambo-v1-provider.d.ts.map +1 -1
- package/esm/v1/providers/tambo-v1-provider.js +32 -32
- package/esm/v1/providers/tambo-v1-provider.js.map +1 -1
- package/esm/v1/providers/tambo-v1-provider.test.js +23 -23
- package/esm/v1/providers/tambo-v1-provider.test.js.map +1 -1
- package/esm/v1/providers/tambo-v1-stream-context.d.ts +15 -15
- package/esm/v1/providers/tambo-v1-stream-context.d.ts.map +1 -1
- package/esm/v1/providers/tambo-v1-stream-context.js +17 -17
- package/esm/v1/providers/tambo-v1-stream-context.js.map +1 -1
- package/esm/v1/providers/tambo-v1-stream-context.test.js +10 -10
- package/esm/v1/providers/tambo-v1-stream-context.test.js.map +1 -1
- package/esm/v1/providers/tambo-v1-stub-provider.d.ts +9 -9
- package/esm/v1/providers/tambo-v1-stub-provider.d.ts.map +1 -1
- package/esm/v1/providers/tambo-v1-stub-provider.js +9 -9
- package/esm/v1/providers/tambo-v1-stub-provider.js.map +1 -1
- package/esm/v1/providers/tambo-v1-stub-provider.test.js +28 -28
- package/esm/v1/providers/tambo-v1-stub-provider.test.js.map +1 -1
- package/esm/v1/providers/tambo-v1-thread-input-provider.d.ts +9 -9
- package/esm/v1/providers/tambo-v1-thread-input-provider.d.ts.map +1 -1
- package/esm/v1/providers/tambo-v1-thread-input-provider.js +15 -15
- package/esm/v1/providers/tambo-v1-thread-input-provider.js.map +1 -1
- package/esm/v1/types/auth.d.ts +2 -2
- package/esm/v1/types/auth.d.ts.map +1 -1
- package/esm/v1/types/auth.js.map +1 -1
- package/esm/v1/types/component.d.ts +3 -3
- package/esm/v1/types/component.d.ts.map +1 -1
- package/esm/v1/types/component.js +2 -2
- package/esm/v1/types/component.js.map +1 -1
- package/esm/v1/types/event.d.ts +1 -1
- package/esm/v1/types/event.js +1 -1
- package/esm/v1/types/event.js.map +1 -1
- package/esm/v1/types/message.d.ts +17 -24
- package/esm/v1/types/message.d.ts.map +1 -1
- package/esm/v1/types/message.js +1 -1
- package/esm/v1/types/message.js.map +1 -1
- package/esm/v1/types/thread.d.ts +10 -8
- package/esm/v1/types/thread.d.ts.map +1 -1
- package/esm/v1/types/thread.js +1 -1
- package/esm/v1/types/thread.js.map +1 -1
- package/esm/v1/types/tool-choice.d.ts +1 -1
- package/esm/v1/types/tool-choice.js.map +1 -1
- package/esm/v1/utils/component-renderer.d.ts +11 -5
- package/esm/v1/utils/component-renderer.d.ts.map +1 -1
- package/esm/v1/utils/component-renderer.js +13 -5
- package/esm/v1/utils/component-renderer.js.map +1 -1
- package/esm/v1/utils/component-renderer.test.js +8 -8
- package/esm/v1/utils/component-renderer.test.js.map +1 -1
- package/esm/v1/utils/event-accumulator.d.ts +13 -13
- package/esm/v1/utils/event-accumulator.d.ts.map +1 -1
- package/esm/v1/utils/event-accumulator.js +26 -15
- package/esm/v1/utils/event-accumulator.js.map +1 -1
- package/esm/v1/utils/event-accumulator.test.js +54 -19
- package/esm/v1/utils/event-accumulator.test.js.map +1 -1
- package/esm/v1/utils/registry-conversion.d.ts +18 -18
- package/esm/v1/utils/registry-conversion.js +23 -23
- package/esm/v1/utils/registry-conversion.js.map +1 -1
- package/esm/v1/utils/stream-handler.d.ts +1 -1
- package/esm/v1/utils/stream-handler.js +1 -1
- package/esm/v1/utils/stream-handler.js.map +1 -1
- package/esm/v1/utils/thread-utils.d.ts +2 -2
- package/esm/v1/utils/thread-utils.d.ts.map +1 -1
- package/esm/v1/utils/thread-utils.js.map +1 -1
- package/esm/v1/utils/tool-call-tracker.d.ts +1 -1
- package/esm/v1/utils/tool-call-tracker.js +1 -1
- package/esm/v1/utils/tool-call-tracker.js.map +1 -1
- package/esm/v1/utils/tool-executor.d.ts +1 -1
- package/esm/v1/utils/tool-executor.js +2 -2
- package/esm/v1/utils/tool-executor.js.map +1 -1
- package/package.json +4 -9
- package/dist/hooks/index.d.ts +0 -9
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js +0 -34
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/use-component-state.d.ts +0 -30
- package/dist/hooks/use-component-state.d.ts.map +0 -1
- package/dist/hooks/use-component-state.js +0 -139
- package/dist/hooks/use-component-state.js.map +0 -1
- package/dist/hooks/use-component-state.test.d.ts +0 -2
- package/dist/hooks/use-component-state.test.d.ts.map +0 -1
- package/dist/hooks/use-component-state.test.js +0 -406
- package/dist/hooks/use-component-state.test.js.map +0 -1
- package/dist/hooks/use-current-message.d.ts.map +0 -1
- package/dist/hooks/use-current-message.js.map +0 -1
- package/dist/hooks/use-current-message.test.d.ts +0 -2
- package/dist/hooks/use-current-message.test.d.ts.map +0 -1
- package/dist/hooks/use-current-message.test.js +0 -269
- package/dist/hooks/use-current-message.test.js.map +0 -1
- package/dist/hooks/use-streaming-props.d.ts +0 -11
- package/dist/hooks/use-streaming-props.d.ts.map +0 -1
- package/dist/hooks/use-streaming-props.js +0 -37
- package/dist/hooks/use-streaming-props.js.map +0 -1
- package/dist/hooks/use-suggestions.d.ts +0 -46
- package/dist/hooks/use-suggestions.d.ts.map +0 -1
- package/dist/hooks/use-suggestions.js +0 -118
- package/dist/hooks/use-suggestions.js.map +0 -1
- package/dist/hooks/use-suggestions.test.d.ts +0 -2
- package/dist/hooks/use-suggestions.test.d.ts.map +0 -1
- package/dist/hooks/use-suggestions.test.js +0 -247
- package/dist/hooks/use-suggestions.test.js.map +0 -1
- package/dist/hooks/use-tambo-stream-status.d.ts +0 -90
- package/dist/hooks/use-tambo-stream-status.d.ts.map +0 -1
- package/dist/hooks/use-tambo-stream-status.js +0 -213
- package/dist/hooks/use-tambo-stream-status.js.map +0 -1
- package/dist/hooks/use-tambo-stream-status.test.d.ts +0 -2
- package/dist/hooks/use-tambo-stream-status.test.d.ts.map +0 -1
- package/dist/hooks/use-tambo-stream-status.test.js +0 -378
- package/dist/hooks/use-tambo-stream-status.test.js.map +0 -1
- package/dist/hooks/use-tambo-threads.d.ts +0 -158
- package/dist/hooks/use-tambo-threads.d.ts.map +0 -1
- package/dist/hooks/use-tambo-threads.js +0 -45
- package/dist/hooks/use-tambo-threads.js.map +0 -1
- package/dist/hooks/use-tambo-threads.test.d.ts +0 -2
- package/dist/hooks/use-tambo-threads.test.d.ts.map +0 -1
- package/dist/hooks/use-tambo-threads.test.js +0 -214
- package/dist/hooks/use-tambo-threads.test.js.map +0 -1
- package/dist/model/generate-component-response.d.ts +0 -37
- package/dist/model/generate-component-response.d.ts.map +0 -1
- package/dist/model/generate-component-response.js +0 -29
- package/dist/model/generate-component-response.js.map +0 -1
- package/dist/model/tambo-thread.d.ts +0 -15
- package/dist/model/tambo-thread.d.ts.map +0 -1
- package/dist/model/tambo-thread.js +0 -3
- package/dist/model/tambo-thread.js.map +0 -1
- package/dist/providers/__tests__/thread-input-resource-resolution.test.d.ts +0 -2
- package/dist/providers/__tests__/thread-input-resource-resolution.test.d.ts.map +0 -1
- package/dist/providers/__tests__/thread-input-resource-resolution.test.js +0 -592
- package/dist/providers/__tests__/thread-input-resource-resolution.test.js.map +0 -1
- package/dist/providers/index.d.ts +0 -13
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/index.js +0 -41
- package/dist/providers/index.js.map +0 -1
- package/dist/providers/tambo-component-provider.d.ts +0 -23
- package/dist/providers/tambo-component-provider.d.ts.map +0 -1
- package/dist/providers/tambo-component-provider.js +0 -88
- package/dist/providers/tambo-component-provider.js.map +0 -1
- package/dist/providers/tambo-prop-stream-provider/index.d.ts +0 -19
- package/dist/providers/tambo-prop-stream-provider/index.d.ts.map +0 -1
- package/dist/providers/tambo-prop-stream-provider/index.js +0 -43
- package/dist/providers/tambo-prop-stream-provider/index.js.map +0 -1
- package/dist/providers/tambo-prop-stream-provider/pending.d.ts +0 -12
- package/dist/providers/tambo-prop-stream-provider/pending.d.ts.map +0 -1
- package/dist/providers/tambo-prop-stream-provider/pending.js +0 -31
- package/dist/providers/tambo-prop-stream-provider/pending.js.map +0 -1
- package/dist/providers/tambo-prop-stream-provider/provider.d.ts +0 -17
- package/dist/providers/tambo-prop-stream-provider/provider.d.ts.map +0 -1
- package/dist/providers/tambo-prop-stream-provider/provider.js +0 -107
- package/dist/providers/tambo-prop-stream-provider/provider.js.map +0 -1
- package/dist/providers/tambo-prop-stream-provider/streaming.d.ts +0 -12
- package/dist/providers/tambo-prop-stream-provider/streaming.d.ts.map +0 -1
- package/dist/providers/tambo-prop-stream-provider/streaming.js +0 -28
- package/dist/providers/tambo-prop-stream-provider/streaming.js.map +0 -1
- package/dist/providers/tambo-prop-stream-provider/success.d.ts +0 -12
- package/dist/providers/tambo-prop-stream-provider/success.d.ts.map +0 -1
- package/dist/providers/tambo-prop-stream-provider/success.js +0 -28
- package/dist/providers/tambo-prop-stream-provider/success.js.map +0 -1
- package/dist/providers/tambo-prop-stream-provider/types.d.ts +0 -25
- package/dist/providers/tambo-prop-stream-provider/types.d.ts.map +0 -1
- package/dist/providers/tambo-prop-stream-provider/types.js +0 -6
- package/dist/providers/tambo-prop-stream-provider/types.js.map +0 -1
- package/dist/providers/tambo-prop-stream-provider.test.d.ts +0 -2
- package/dist/providers/tambo-prop-stream-provider.test.d.ts.map +0 -1
- package/dist/providers/tambo-prop-stream-provider.test.js +0 -275
- package/dist/providers/tambo-prop-stream-provider.test.js.map +0 -1
- package/dist/providers/tambo-provider.d.ts +0 -53
- package/dist/providers/tambo-provider.d.ts.map +0 -1
- package/dist/providers/tambo-provider.js +0 -133
- package/dist/providers/tambo-provider.js.map +0 -1
- package/dist/providers/tambo-stubs.d.ts +0 -89
- package/dist/providers/tambo-stubs.d.ts.map +0 -1
- package/dist/providers/tambo-stubs.js +0 -279
- package/dist/providers/tambo-stubs.js.map +0 -1
- package/dist/providers/tambo-stubs.test.d.ts +0 -2
- package/dist/providers/tambo-stubs.test.d.ts.map +0 -1
- package/dist/providers/tambo-stubs.test.js +0 -97
- package/dist/providers/tambo-stubs.test.js.map +0 -1
- package/dist/providers/tambo-thread-input-provider.d.ts +0 -65
- package/dist/providers/tambo-thread-input-provider.d.ts.map +0 -1
- package/dist/providers/tambo-thread-input-provider.js +0 -179
- package/dist/providers/tambo-thread-input-provider.js.map +0 -1
- package/dist/providers/tambo-thread-provider-initial-messages.test.d.ts +0 -2
- package/dist/providers/tambo-thread-provider-initial-messages.test.d.ts.map +0 -1
- package/dist/providers/tambo-thread-provider-initial-messages.test.js +0 -278
- package/dist/providers/tambo-thread-provider-initial-messages.test.js.map +0 -1
- package/dist/providers/tambo-thread-provider.d.ts +0 -126
- package/dist/providers/tambo-thread-provider.d.ts.map +0 -1
- package/dist/providers/tambo-thread-provider.js +0 -931
- package/dist/providers/tambo-thread-provider.js.map +0 -1
- package/dist/providers/tambo-thread-provider.test.d.ts +0 -2
- package/dist/providers/tambo-thread-provider.test.d.ts.map +0 -1
- package/dist/providers/tambo-thread-provider.test.js +0 -1591
- package/dist/providers/tambo-thread-provider.test.js.map +0 -1
- package/dist/util/generate-component.d.ts +0 -12
- package/dist/util/generate-component.d.ts.map +0 -1
- package/dist/util/generate-component.js +0 -58
- package/dist/util/generate-component.js.map +0 -1
- package/dist/util/generate-component.test.d.ts +0 -2
- package/dist/util/generate-component.test.d.ts.map +0 -1
- package/dist/util/generate-component.test.js +0 -340
- package/dist/util/generate-component.test.js.map +0 -1
- package/esm/hooks/index.d.ts +0 -9
- package/esm/hooks/index.d.ts.map +0 -1
- package/esm/hooks/index.js +0 -10
- package/esm/hooks/index.js.map +0 -1
- package/esm/hooks/use-component-state.d.ts +0 -30
- package/esm/hooks/use-component-state.d.ts.map +0 -1
- package/esm/hooks/use-component-state.js +0 -136
- package/esm/hooks/use-component-state.js.map +0 -1
- package/esm/hooks/use-component-state.test.d.ts +0 -2
- package/esm/hooks/use-component-state.test.d.ts.map +0 -1
- package/esm/hooks/use-component-state.test.js +0 -401
- package/esm/hooks/use-component-state.test.js.map +0 -1
- package/esm/hooks/use-current-message.d.ts.map +0 -1
- package/esm/hooks/use-current-message.js.map +0 -1
- package/esm/hooks/use-current-message.test.d.ts +0 -2
- package/esm/hooks/use-current-message.test.d.ts.map +0 -1
- package/esm/hooks/use-current-message.test.js +0 -264
- package/esm/hooks/use-current-message.test.js.map +0 -1
- package/esm/hooks/use-streaming-props.d.ts +0 -11
- package/esm/hooks/use-streaming-props.d.ts.map +0 -1
- package/esm/hooks/use-streaming-props.js +0 -34
- package/esm/hooks/use-streaming-props.js.map +0 -1
- package/esm/hooks/use-suggestions.d.ts +0 -46
- package/esm/hooks/use-suggestions.d.ts.map +0 -1
- package/esm/hooks/use-suggestions.js +0 -115
- package/esm/hooks/use-suggestions.js.map +0 -1
- package/esm/hooks/use-suggestions.test.d.ts +0 -2
- package/esm/hooks/use-suggestions.test.d.ts.map +0 -1
- package/esm/hooks/use-suggestions.test.js +0 -245
- package/esm/hooks/use-suggestions.test.js.map +0 -1
- package/esm/hooks/use-tambo-stream-status.d.ts +0 -90
- package/esm/hooks/use-tambo-stream-status.d.ts.map +0 -1
- package/esm/hooks/use-tambo-stream-status.js +0 -210
- package/esm/hooks/use-tambo-stream-status.js.map +0 -1
- package/esm/hooks/use-tambo-stream-status.test.d.ts +0 -2
- package/esm/hooks/use-tambo-stream-status.test.d.ts.map +0 -1
- package/esm/hooks/use-tambo-stream-status.test.js +0 -376
- package/esm/hooks/use-tambo-stream-status.test.js.map +0 -1
- package/esm/hooks/use-tambo-threads.d.ts +0 -158
- package/esm/hooks/use-tambo-threads.d.ts.map +0 -1
- package/esm/hooks/use-tambo-threads.js +0 -42
- package/esm/hooks/use-tambo-threads.js.map +0 -1
- package/esm/hooks/use-tambo-threads.test.d.ts +0 -2
- package/esm/hooks/use-tambo-threads.test.d.ts.map +0 -1
- package/esm/hooks/use-tambo-threads.test.js +0 -212
- package/esm/hooks/use-tambo-threads.test.js.map +0 -1
- package/esm/model/generate-component-response.d.ts +0 -37
- package/esm/model/generate-component-response.d.ts.map +0 -1
- package/esm/model/generate-component-response.js +0 -25
- package/esm/model/generate-component-response.js.map +0 -1
- package/esm/model/tambo-thread.d.ts +0 -15
- package/esm/model/tambo-thread.d.ts.map +0 -1
- package/esm/model/tambo-thread.js +0 -2
- package/esm/model/tambo-thread.js.map +0 -1
- package/esm/providers/__tests__/thread-input-resource-resolution.test.d.ts +0 -2
- package/esm/providers/__tests__/thread-input-resource-resolution.test.d.ts.map +0 -1
- package/esm/providers/__tests__/thread-input-resource-resolution.test.js +0 -587
- package/esm/providers/__tests__/thread-input-resource-resolution.test.js.map +0 -1
- package/esm/providers/index.d.ts +0 -13
- package/esm/providers/index.d.ts.map +0 -1
- package/esm/providers/index.js +0 -11
- package/esm/providers/index.js.map +0 -1
- package/esm/providers/tambo-component-provider.d.ts +0 -23
- package/esm/providers/tambo-component-provider.d.ts.map +0 -1
- package/esm/providers/tambo-component-provider.js +0 -50
- package/esm/providers/tambo-component-provider.js.map +0 -1
- package/esm/providers/tambo-prop-stream-provider/index.d.ts +0 -19
- package/esm/providers/tambo-prop-stream-provider/index.d.ts.map +0 -1
- package/esm/providers/tambo-prop-stream-provider/index.js +0 -22
- package/esm/providers/tambo-prop-stream-provider/index.js.map +0 -1
- package/esm/providers/tambo-prop-stream-provider/pending.d.ts +0 -12
- package/esm/providers/tambo-prop-stream-provider/pending.d.ts.map +0 -1
- package/esm/providers/tambo-prop-stream-provider/pending.js +0 -24
- package/esm/providers/tambo-prop-stream-provider/pending.js.map +0 -1
- package/esm/providers/tambo-prop-stream-provider/provider.d.ts +0 -17
- package/esm/providers/tambo-prop-stream-provider/provider.d.ts.map +0 -1
- package/esm/providers/tambo-prop-stream-provider/provider.js +0 -70
- package/esm/providers/tambo-prop-stream-provider/provider.js.map +0 -1
- package/esm/providers/tambo-prop-stream-provider/streaming.d.ts +0 -12
- package/esm/providers/tambo-prop-stream-provider/streaming.d.ts.map +0 -1
- package/esm/providers/tambo-prop-stream-provider/streaming.js +0 -21
- package/esm/providers/tambo-prop-stream-provider/streaming.js.map +0 -1
- package/esm/providers/tambo-prop-stream-provider/success.d.ts +0 -12
- package/esm/providers/tambo-prop-stream-provider/success.d.ts.map +0 -1
- package/esm/providers/tambo-prop-stream-provider/success.js +0 -21
- package/esm/providers/tambo-prop-stream-provider/success.js.map +0 -1
- package/esm/providers/tambo-prop-stream-provider/types.d.ts +0 -25
- package/esm/providers/tambo-prop-stream-provider/types.d.ts.map +0 -1
- package/esm/providers/tambo-prop-stream-provider/types.js +0 -3
- package/esm/providers/tambo-prop-stream-provider/types.js.map +0 -1
- package/esm/providers/tambo-prop-stream-provider.test.d.ts +0 -2
- package/esm/providers/tambo-prop-stream-provider.test.d.ts.map +0 -1
- package/esm/providers/tambo-prop-stream-provider.test.js +0 -270
- package/esm/providers/tambo-prop-stream-provider.test.js.map +0 -1
- package/esm/providers/tambo-provider.d.ts +0 -53
- package/esm/providers/tambo-provider.d.ts.map +0 -1
- package/esm/providers/tambo-provider.js +0 -94
- package/esm/providers/tambo-provider.js.map +0 -1
- package/esm/providers/tambo-stubs.d.ts +0 -89
- package/esm/providers/tambo-stubs.d.ts.map +0 -1
- package/esm/providers/tambo-stubs.js +0 -242
- package/esm/providers/tambo-stubs.js.map +0 -1
- package/esm/providers/tambo-stubs.test.d.ts +0 -2
- package/esm/providers/tambo-stubs.test.d.ts.map +0 -1
- package/esm/providers/tambo-stubs.test.js +0 -62
- package/esm/providers/tambo-stubs.test.js.map +0 -1
- package/esm/providers/tambo-thread-input-provider.d.ts +0 -65
- package/esm/providers/tambo-thread-input-provider.d.ts.map +0 -1
- package/esm/providers/tambo-thread-input-provider.js +0 -141
- package/esm/providers/tambo-thread-input-provider.js.map +0 -1
- package/esm/providers/tambo-thread-provider-initial-messages.test.d.ts +0 -2
- package/esm/providers/tambo-thread-provider-initial-messages.test.d.ts.map +0 -1
- package/esm/providers/tambo-thread-provider-initial-messages.test.js +0 -273
- package/esm/providers/tambo-thread-provider-initial-messages.test.js.map +0 -1
- package/esm/providers/tambo-thread-provider.d.ts +0 -126
- package/esm/providers/tambo-thread-provider.d.ts.map +0 -1
- package/esm/providers/tambo-thread-provider.js +0 -891
- package/esm/providers/tambo-thread-provider.js.map +0 -1
- package/esm/providers/tambo-thread-provider.test.d.ts +0 -2
- package/esm/providers/tambo-thread-provider.test.d.ts.map +0 -1
- package/esm/providers/tambo-thread-provider.test.js +0 -1553
- package/esm/providers/tambo-thread-provider.test.js.map +0 -1
- package/esm/util/generate-component.d.ts +0 -12
- package/esm/util/generate-component.d.ts.map +0 -1
- package/esm/util/generate-component.js +0 -52
- package/esm/util/generate-component.js.map +0 -1
- package/esm/util/generate-component.test.d.ts +0 -2
- package/esm/util/generate-component.test.d.ts.map +0 -1
- package/esm/util/generate-component.test.js +0 -302
- package/esm/util/generate-component.test.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-choice.js","sourceRoot":"","sources":["../../../src/v1/types/tool-choice.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Tool choice type matching the
|
|
1
|
+
{"version":3,"file":"tool-choice.js","sourceRoot":"","sources":["../../../src/v1/types/tool-choice.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Tool choice type matching the API format.\n * Controls how the model selects tools during generation.\n */\nexport type ToolChoice =\n | \"auto\" // Model decides (default)\n | \"required\" // Must use at least one tool\n | \"none\" // Cannot use tools\n | { name: string }; // Must use specific tool\n"]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Component Renderer Utility
|
|
2
|
+
* Component Renderer Utility
|
|
3
3
|
*
|
|
4
4
|
* Provides the component content context for rendered components.
|
|
5
|
-
* Components can use
|
|
5
|
+
* Components can use useComponentContent() to access their context.
|
|
6
6
|
*/
|
|
7
7
|
import React from "react";
|
|
8
8
|
/**
|
|
9
9
|
* Context for component content blocks.
|
|
10
10
|
* Provides access to the component ID and thread ID for component state hooks.
|
|
11
11
|
*/
|
|
12
|
-
export interface
|
|
12
|
+
export interface ComponentContentContext {
|
|
13
13
|
/** Component instance ID */
|
|
14
14
|
componentId: string;
|
|
15
15
|
/** Thread ID the component belongs to */
|
|
@@ -24,7 +24,7 @@ export interface V1ComponentContentContext {
|
|
|
24
24
|
* Wraps rendered components to provide access to component metadata.
|
|
25
25
|
* @returns Provider component with memoized context value
|
|
26
26
|
*/
|
|
27
|
-
export declare function
|
|
27
|
+
export declare function ComponentContentProvider({ children, componentId, threadId, messageId, componentName, }: ComponentContentContext & {
|
|
28
28
|
children: React.ReactNode;
|
|
29
29
|
}): React.JSX.Element;
|
|
30
30
|
/**
|
|
@@ -33,5 +33,11 @@ export declare function V1ComponentContentProvider({ children, componentId, thre
|
|
|
33
33
|
* @returns Component content context
|
|
34
34
|
* @throws {Error} If used outside a rendered component
|
|
35
35
|
*/
|
|
36
|
-
export declare function
|
|
36
|
+
export declare function useComponentContent(): ComponentContentContext;
|
|
37
|
+
/**
|
|
38
|
+
* Hook to optionally access the current component content context.
|
|
39
|
+
* Returns null when used outside a rendered component instead of throwing.
|
|
40
|
+
* @returns Component content context or null if not within a rendered component
|
|
41
|
+
*/
|
|
42
|
+
export declare function useComponentContentOptional(): ComponentContentContext | null;
|
|
37
43
|
//# sourceMappingURL=component-renderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-renderer.d.ts","sourceRoot":"","sources":["../../../src/v1/utils/component-renderer.tsx"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAA6C,MAAM,OAAO,CAAC;AAElE;;;GAGG;AACH,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"component-renderer.d.ts","sourceRoot":"","sources":["../../../src/v1/utils/component-renderer.tsx"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAA6C,MAAM,OAAO,CAAC;AAElE;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,4BAA4B;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB;IACrB,aAAa,EAAE,MAAM,CAAC;CACvB;AAMD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,SAAS,EACT,aAAa,GACd,EAAE,uBAAuB,GAAG;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAYzD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,uBAAuB,CAQ7D;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,IAAI,uBAAuB,GAAG,IAAI,CAE5E"}
|
|
@@ -34,13 +34,14 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
};
|
|
35
35
|
})();
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.
|
|
38
|
-
exports.
|
|
37
|
+
exports.ComponentContentProvider = ComponentContentProvider;
|
|
38
|
+
exports.useComponentContent = useComponentContent;
|
|
39
|
+
exports.useComponentContentOptional = useComponentContentOptional;
|
|
39
40
|
/**
|
|
40
|
-
* Component Renderer Utility
|
|
41
|
+
* Component Renderer Utility
|
|
41
42
|
*
|
|
42
43
|
* Provides the component content context for rendered components.
|
|
43
|
-
* Components can use
|
|
44
|
+
* Components can use useComponentContent() to access their context.
|
|
44
45
|
*/
|
|
45
46
|
const react_1 = __importStar(require("react"));
|
|
46
47
|
const ComponentContentContext = (0, react_1.createContext)(null);
|
|
@@ -49,7 +50,7 @@ const ComponentContentContext = (0, react_1.createContext)(null);
|
|
|
49
50
|
* Wraps rendered components to provide access to component metadata.
|
|
50
51
|
* @returns Provider component with memoized context value
|
|
51
52
|
*/
|
|
52
|
-
function
|
|
53
|
+
function ComponentContentProvider({ children, componentId, threadId, messageId, componentName, }) {
|
|
53
54
|
// Memoize context value to prevent unnecessary re-renders of consumers
|
|
54
55
|
const value = (0, react_1.useMemo)(() => ({ componentId, threadId, messageId, componentName }), [componentId, threadId, messageId, componentName]);
|
|
55
56
|
return (react_1.default.createElement(ComponentContentContext.Provider, { value: value }, children));
|
|
@@ -60,11 +61,19 @@ function V1ComponentContentProvider({ children, componentId, threadId, messageId
|
|
|
60
61
|
* @returns Component content context
|
|
61
62
|
* @throws {Error} If used outside a rendered component
|
|
62
63
|
*/
|
|
63
|
-
function
|
|
64
|
+
function useComponentContent() {
|
|
64
65
|
const context = (0, react_1.useContext)(ComponentContentContext);
|
|
65
66
|
if (!context) {
|
|
66
|
-
throw new Error("
|
|
67
|
+
throw new Error("useComponentContent must be used within a rendered component");
|
|
67
68
|
}
|
|
68
69
|
return context;
|
|
69
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Hook to optionally access the current component content context.
|
|
73
|
+
* Returns null when used outside a rendered component instead of throwing.
|
|
74
|
+
* @returns Component content context or null if not within a rendered component
|
|
75
|
+
*/
|
|
76
|
+
function useComponentContentOptional() {
|
|
77
|
+
return (0, react_1.useContext)(ComponentContentContext);
|
|
78
|
+
}
|
|
70
79
|
//# sourceMappingURL=component-renderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-renderer.js","sourceRoot":"","sources":["../../../src/v1/utils/component-renderer.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCb,
|
|
1
|
+
{"version":3,"file":"component-renderer.js","sourceRoot":"","sources":["../../../src/v1/utils/component-renderer.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCb,4DAkBC;AAQD,kDAQC;AAOD,kEAEC;AA5ED;;;;;GAKG;AAEH,+CAAkE;AAiBlE,MAAM,uBAAuB,GAAG,IAAA,qBAAa,EAC3C,IAAI,CACL,CAAC;AAEF;;;;GAIG;AACH,SAAgB,wBAAwB,CAAC,EACvC,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,SAAS,EACT,aAAa,GAC2C;IACxD,uEAAuE;IACvE,MAAM,KAAK,GAAG,IAAA,eAAO,EACnB,GAAG,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,EAC3D,CAAC,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,CAAC,CAClD,CAAC;IAEF,OAAO,CACL,8BAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IAC3C,QAAQ,CACwB,CACpC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB;IACjC,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,uBAAuB,CAAC,CAAC;IACpD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,SAAgB,2BAA2B;IACzC,OAAO,IAAA,kBAAU,EAAC,uBAAuB,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["\"use client\";\n\n/**\n * Component Renderer Utility\n *\n * Provides the component content context for rendered components.\n * Components can use useComponentContent() to access their context.\n */\n\nimport React, { createContext, useContext, useMemo } from \"react\";\n\n/**\n * Context for component content blocks.\n * Provides access to the component ID and thread ID for component state hooks.\n */\nexport interface ComponentContentContext {\n /** Component instance ID */\n componentId: string;\n /** Thread ID the component belongs to */\n threadId: string;\n /** Message ID the component belongs to */\n messageId: string;\n /** Component name */\n componentName: string;\n}\n\nconst ComponentContentContext = createContext<ComponentContentContext | null>(\n null,\n);\n\n/**\n * Provider for component content context.\n * Wraps rendered components to provide access to component metadata.\n * @returns Provider component with memoized context value\n */\nexport function ComponentContentProvider({\n children,\n componentId,\n threadId,\n messageId,\n componentName,\n}: ComponentContentContext & { children: React.ReactNode }) {\n // Memoize context value to prevent unnecessary re-renders of consumers\n const value = useMemo(\n () => ({ componentId, threadId, messageId, componentName }),\n [componentId, threadId, messageId, componentName],\n );\n\n return (\n <ComponentContentContext.Provider value={value}>\n {children}\n </ComponentContentContext.Provider>\n );\n}\n\n/**\n * Hook to access the current component content context.\n * Must be used within a rendered component.\n * @returns Component content context\n * @throws {Error} If used outside a rendered component\n */\nexport function useComponentContent(): ComponentContentContext {\n const context = useContext(ComponentContentContext);\n if (!context) {\n throw new Error(\n \"useComponentContent must be used within a rendered component\",\n );\n }\n return context;\n}\n\n/**\n * Hook to optionally access the current component content context.\n * Returns null when used outside a rendered component instead of throwing.\n * @returns Component content context or null if not within a rendered component\n */\nexport function useComponentContentOptional(): ComponentContentContext | null {\n return useContext(ComponentContentContext);\n}\n"]}
|
|
@@ -8,16 +8,16 @@ const react_2 = require("@testing-library/react");
|
|
|
8
8
|
const component_renderer_1 = require("./component-renderer");
|
|
9
9
|
// Test component that uses the content context
|
|
10
10
|
const ContextAwareComponent = () => {
|
|
11
|
-
const context = (0, component_renderer_1.
|
|
11
|
+
const context = (0, component_renderer_1.useComponentContent)();
|
|
12
12
|
return (react_1.default.createElement("div", { "data-testid": "context-aware" },
|
|
13
13
|
react_1.default.createElement("span", { "data-testid": "componentId" }, context.componentId),
|
|
14
14
|
react_1.default.createElement("span", { "data-testid": "threadId" }, context.threadId),
|
|
15
15
|
react_1.default.createElement("span", { "data-testid": "messageId" }, context.messageId),
|
|
16
16
|
react_1.default.createElement("span", { "data-testid": "componentName" }, context.componentName)));
|
|
17
17
|
};
|
|
18
|
-
describe("
|
|
18
|
+
describe("ComponentContentProvider", () => {
|
|
19
19
|
it("provides context to child components", () => {
|
|
20
|
-
(0, react_2.render)(react_1.default.createElement(component_renderer_1.
|
|
20
|
+
(0, react_2.render)(react_1.default.createElement(component_renderer_1.ComponentContentProvider, { componentId: "comp_123", threadId: "thread_456", messageId: "msg_789", componentName: "TestComponent" },
|
|
21
21
|
react_1.default.createElement(ContextAwareComponent, null)));
|
|
22
22
|
expect(react_2.screen.getByTestId("componentId")).toHaveTextContent("comp_123");
|
|
23
23
|
expect(react_2.screen.getByTestId("threadId")).toHaveTextContent("thread_456");
|
|
@@ -25,19 +25,19 @@ describe("V1ComponentContentProvider", () => {
|
|
|
25
25
|
expect(react_2.screen.getByTestId("componentName")).toHaveTextContent("TestComponent");
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
|
-
describe("
|
|
28
|
+
describe("useComponentContent", () => {
|
|
29
29
|
it("throws when used outside provider", () => {
|
|
30
30
|
function TestConsumer() {
|
|
31
|
-
(0, component_renderer_1.
|
|
31
|
+
(0, component_renderer_1.useComponentContent)();
|
|
32
32
|
return react_1.default.createElement("div", null, "Should not render");
|
|
33
33
|
}
|
|
34
34
|
// Suppress React error boundary logs
|
|
35
35
|
const consoleSpy = jest.spyOn(console, "error").mockImplementation();
|
|
36
|
-
expect(() => (0, react_2.render)(react_1.default.createElement(TestConsumer, null))).toThrow("
|
|
36
|
+
expect(() => (0, react_2.render)(react_1.default.createElement(TestConsumer, null))).toThrow("useComponentContent must be used within a rendered component");
|
|
37
37
|
consoleSpy.mockRestore();
|
|
38
38
|
});
|
|
39
39
|
it("returns context when used within provider", () => {
|
|
40
|
-
(0, react_2.render)(react_1.default.createElement(component_renderer_1.
|
|
40
|
+
(0, react_2.render)(react_1.default.createElement(component_renderer_1.ComponentContentProvider, { componentId: "comp_test", threadId: "thread_test", messageId: "msg_test", componentName: "TestComp" },
|
|
41
41
|
react_1.default.createElement(ContextAwareComponent, null)));
|
|
42
42
|
expect(react_2.screen.getByTestId("componentId")).toHaveTextContent("comp_test");
|
|
43
43
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-renderer.test.js","sourceRoot":"","sources":["../../../src/v1/utils/component-renderer.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,kDAAwD;AACxD,6DAG8B;AAE9B,+CAA+C;AAC/C,MAAM,qBAAqB,GAAa,GAAG,EAAE;IAC3C,MAAM,OAAO,GAAG,IAAA,
|
|
1
|
+
{"version":3,"file":"component-renderer.test.js","sourceRoot":"","sources":["../../../src/v1/utils/component-renderer.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,kDAAwD;AACxD,6DAG8B;AAE9B,+CAA+C;AAC/C,MAAM,qBAAqB,GAAa,GAAG,EAAE;IAC3C,MAAM,OAAO,GAAG,IAAA,wCAAmB,GAAE,CAAC;IACtC,OAAO,CACL,sDAAiB,eAAe;QAC9B,uDAAkB,aAAa,IAAE,OAAO,CAAC,WAAW,CAAQ;QAC5D,uDAAkB,UAAU,IAAE,OAAO,CAAC,QAAQ,CAAQ;QACtD,uDAAkB,WAAW,IAAE,OAAO,CAAC,SAAS,CAAQ;QACxD,uDAAkB,eAAe,IAAE,OAAO,CAAC,aAAa,CAAQ,CAC5D,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,IAAA,cAAM,EACJ,8BAAC,6CAAwB,IACvB,WAAW,EAAC,UAAU,EACtB,QAAQ,EAAC,YAAY,EACrB,SAAS,EAAC,SAAS,EACnB,aAAa,EAAC,eAAe;YAE7B,8BAAC,qBAAqB,OAAG,CACA,CAC5B,CAAC;QAEF,MAAM,CAAC,cAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACxE,MAAM,CAAC,cAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;QACvE,MAAM,CAAC,cAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QACrE,MAAM,CAAC,cAAM,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,CAAC,iBAAiB,CAC3D,eAAe,CAChB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC3C,SAAS,YAAY;YACnB,IAAA,wCAAmB,GAAE,CAAC;YACtB,OAAO,+DAA4B,CAAC;QACtC,CAAC;QAED,qCAAqC;QACrC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,kBAAkB,EAAE,CAAC;QAErE,MAAM,CAAC,GAAG,EAAE,CAAC,IAAA,cAAM,EAAC,8BAAC,YAAY,OAAG,CAAC,CAAC,CAAC,OAAO,CAC5C,8DAA8D,CAC/D,CAAC;QAEF,UAAU,CAAC,WAAW,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,IAAA,cAAM,EACJ,8BAAC,6CAAwB,IACvB,WAAW,EAAC,WAAW,EACvB,QAAQ,EAAC,aAAa,EACtB,SAAS,EAAC,UAAU,EACpB,aAAa,EAAC,UAAU;YAExB,8BAAC,qBAAqB,OAAG,CACA,CAC5B,CAAC;QAEF,MAAM,CAAC,cAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport { render, screen } from \"@testing-library/react\";\nimport {\n useComponentContent,\n ComponentContentProvider,\n} from \"./component-renderer\";\n\n// Test component that uses the content context\nconst ContextAwareComponent: React.FC = () => {\n const context = useComponentContent();\n return (\n <div data-testid=\"context-aware\">\n <span data-testid=\"componentId\">{context.componentId}</span>\n <span data-testid=\"threadId\">{context.threadId}</span>\n <span data-testid=\"messageId\">{context.messageId}</span>\n <span data-testid=\"componentName\">{context.componentName}</span>\n </div>\n );\n};\n\ndescribe(\"ComponentContentProvider\", () => {\n it(\"provides context to child components\", () => {\n render(\n <ComponentContentProvider\n componentId=\"comp_123\"\n threadId=\"thread_456\"\n messageId=\"msg_789\"\n componentName=\"TestComponent\"\n >\n <ContextAwareComponent />\n </ComponentContentProvider>,\n );\n\n expect(screen.getByTestId(\"componentId\")).toHaveTextContent(\"comp_123\");\n expect(screen.getByTestId(\"threadId\")).toHaveTextContent(\"thread_456\");\n expect(screen.getByTestId(\"messageId\")).toHaveTextContent(\"msg_789\");\n expect(screen.getByTestId(\"componentName\")).toHaveTextContent(\n \"TestComponent\",\n );\n });\n});\n\ndescribe(\"useComponentContent\", () => {\n it(\"throws when used outside provider\", () => {\n function TestConsumer() {\n useComponentContent();\n return <div>Should not render</div>;\n }\n\n // Suppress React error boundary logs\n const consoleSpy = jest.spyOn(console, \"error\").mockImplementation();\n\n expect(() => render(<TestConsumer />)).toThrow(\n \"useComponentContent must be used within a rendered component\",\n );\n\n consoleSpy.mockRestore();\n });\n\n it(\"returns context when used within provider\", () => {\n render(\n <ComponentContentProvider\n componentId=\"comp_test\"\n threadId=\"thread_test\"\n messageId=\"msg_test\"\n componentName=\"TestComp\"\n >\n <ContextAwareComponent />\n </ComponentContentProvider>,\n );\n\n expect(screen.getByTestId(\"componentId\")).toHaveTextContent(\"comp_test\");\n });\n});\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Event Accumulation Logic for
|
|
2
|
+
* Event Accumulation Logic for Streaming API
|
|
3
3
|
*
|
|
4
4
|
* Implements a reducer that transforms AG-UI event streams into React state.
|
|
5
5
|
* Used with useReducer to accumulate events into thread state.
|
|
6
6
|
*/
|
|
7
7
|
import type { AGUIEvent } from "@ag-ui/core";
|
|
8
|
-
import type { InitialInputMessage,
|
|
9
|
-
import type { StreamingState,
|
|
8
|
+
import type { InitialInputMessage, TamboThreadMessage } from "../types/message";
|
|
9
|
+
import type { StreamingState, TamboThread } from "../types/thread";
|
|
10
10
|
/**
|
|
11
11
|
* Error thrown when an unreachable case is reached in a switch statement.
|
|
12
12
|
* This indicates a programming error where not all cases were handled.
|
|
@@ -19,7 +19,7 @@ export declare class UnreachableCaseError extends Error {
|
|
|
19
19
|
* Tracks thread data, streaming status, and accumulating data.
|
|
20
20
|
*/
|
|
21
21
|
export interface ThreadState {
|
|
22
|
-
thread:
|
|
22
|
+
thread: TamboThread;
|
|
23
23
|
streaming: StreamingState;
|
|
24
24
|
/**
|
|
25
25
|
* Accumulating tool call arguments as JSON strings (for streaming).
|
|
@@ -64,7 +64,7 @@ export interface EventAction {
|
|
|
64
64
|
export interface InitThreadAction {
|
|
65
65
|
type: "INIT_THREAD";
|
|
66
66
|
threadId: string;
|
|
67
|
-
initialThread?: Partial<
|
|
67
|
+
initialThread?: Partial<TamboThread>;
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
70
|
* Set current thread action - changes the active thread.
|
|
@@ -80,7 +80,7 @@ export interface SetCurrentThreadAction {
|
|
|
80
80
|
export interface StartNewThreadAction {
|
|
81
81
|
type: "START_NEW_THREAD";
|
|
82
82
|
threadId: string;
|
|
83
|
-
initialThread?: Partial<
|
|
83
|
+
initialThread?: Partial<TamboThread>;
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
86
|
* Load thread messages action - loads messages from API into stream state.
|
|
@@ -89,7 +89,7 @@ export interface StartNewThreadAction {
|
|
|
89
89
|
export interface LoadThreadMessagesAction {
|
|
90
90
|
type: "LOAD_THREAD_MESSAGES";
|
|
91
91
|
threadId: string;
|
|
92
|
-
messages:
|
|
92
|
+
messages: TamboThreadMessage[];
|
|
93
93
|
/**
|
|
94
94
|
* If true, skip loading if the thread is currently streaming.
|
|
95
95
|
* This prevents overwriting in-flight streaming messages.
|
|
@@ -106,18 +106,18 @@ export interface SetLastCompletedRunIdAction {
|
|
|
106
106
|
lastCompletedRunId: string;
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
|
-
* Update thread
|
|
109
|
+
* Update thread name action - sets the name on a thread.
|
|
110
110
|
* Used after auto-generating a thread name via the API.
|
|
111
111
|
*/
|
|
112
|
-
export interface
|
|
113
|
-
type: "
|
|
112
|
+
export interface UpdateThreadNameAction {
|
|
113
|
+
type: "UPDATE_THREAD_NAME";
|
|
114
114
|
threadId: string;
|
|
115
|
-
|
|
115
|
+
name: string;
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
118
|
* Action type for the stream reducer.
|
|
119
119
|
*/
|
|
120
|
-
export type StreamAction = EventAction | InitThreadAction | SetCurrentThreadAction | StartNewThreadAction | LoadThreadMessagesAction | SetLastCompletedRunIdAction |
|
|
120
|
+
export type StreamAction = EventAction | InitThreadAction | SetCurrentThreadAction | StartNewThreadAction | LoadThreadMessagesAction | SetLastCompletedRunIdAction | UpdateThreadNameAction;
|
|
121
121
|
/**
|
|
122
122
|
* Create initial thread state for a new thread.
|
|
123
123
|
* @param threadId - Unique thread identifier
|
|
@@ -143,7 +143,7 @@ export declare function isPlaceholderThreadId(threadId: string | null | undefine
|
|
|
143
143
|
export declare function createInitialState(): StreamState;
|
|
144
144
|
/**
|
|
145
145
|
* Create initial stream state with placeholder thread seeded with initial messages.
|
|
146
|
-
* The messages are converted from InputMessage format to
|
|
146
|
+
* The messages are converted from InputMessage format to TamboThreadMessage format
|
|
147
147
|
* for immediate UI display before any API call.
|
|
148
148
|
* @param initialMessages - Messages to seed the placeholder thread with
|
|
149
149
|
* @returns Initial stream state with messages in the placeholder thread
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-accumulator.d.ts","sourceRoot":"","sources":["../../../src/v1/utils/event-accumulator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,SAAS,EAeV,MAAM,aAAa,CAAC;AAUrB,OAAO,KAAK,EAEV,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"event-accumulator.d.ts","sourceRoot":"","sources":["../../../src/v1/utils/event-accumulator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,SAAS,EAeV,MAAM,aAAa,CAAC;AAUrB,OAAO,KAAK,EAEV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAInE;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,KAAK,EAAE,KAAK;CAIzB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,EAAE,cAAc,CAAC;IAC1B;;;OAGG;IACH,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAEvC;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,qFAAqF;IACrF,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,kBAAkB,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CACtC;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,sBAAsB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAC/B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,2BAA2B,CAAC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,gBAAgB,GAChB,sBAAsB,GACtB,oBAAoB,GACpB,wBAAwB,GACxB,2BAA2B,GAC3B,sBAAsB,CAAC;AAS3B;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CActE;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,gBAAgB,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAClC,OAAO,CAET;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,WAAW,CAOhD;AAED;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAC5C,eAAe,EAAE,mBAAmB,EAAE,GACrC,WAAW,CAyBb;AAuGD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,YAAY,GACnB,WAAW,CAqRb"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Event Accumulation Logic for
|
|
3
|
+
* Event Accumulation Logic for Streaming API
|
|
4
4
|
*
|
|
5
5
|
* Implements a reducer that transforms AG-UI event streams into React state.
|
|
6
6
|
* Used with useReducer to accumulate events into thread state.
|
|
@@ -81,7 +81,7 @@ function createInitialState() {
|
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* Create initial stream state with placeholder thread seeded with initial messages.
|
|
84
|
-
* The messages are converted from InputMessage format to
|
|
84
|
+
* The messages are converted from InputMessage format to TamboThreadMessage format
|
|
85
85
|
* for immediate UI display before any API call.
|
|
86
86
|
* @param initialMessages - Messages to seed the placeholder thread with
|
|
87
87
|
* @returns Initial stream state with messages in the placeholder thread
|
|
@@ -269,7 +269,7 @@ function streamReducer(state, action) {
|
|
|
269
269
|
},
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
|
-
case "
|
|
272
|
+
case "UPDATE_THREAD_NAME": {
|
|
273
273
|
const threadState = state.threadMap[action.threadId];
|
|
274
274
|
if (!threadState) {
|
|
275
275
|
return state;
|
|
@@ -282,7 +282,7 @@ function streamReducer(state, action) {
|
|
|
282
282
|
...threadState,
|
|
283
283
|
thread: {
|
|
284
284
|
...threadState.thread,
|
|
285
|
-
|
|
285
|
+
name: action.name,
|
|
286
286
|
},
|
|
287
287
|
},
|
|
288
288
|
},
|
|
@@ -462,12 +462,12 @@ function handleRunFinished(threadState, event) {
|
|
|
462
462
|
threadState.lastCompletedRunId,
|
|
463
463
|
thread: {
|
|
464
464
|
...threadState.thread,
|
|
465
|
-
status: "
|
|
465
|
+
status: "idle",
|
|
466
466
|
updatedAt: new Date().toISOString(),
|
|
467
467
|
},
|
|
468
468
|
streaming: {
|
|
469
469
|
...threadState.streaming,
|
|
470
|
-
status: "
|
|
470
|
+
status: "idle",
|
|
471
471
|
},
|
|
472
472
|
};
|
|
473
473
|
}
|
|
@@ -484,15 +484,13 @@ function handleRunError(threadState, event) {
|
|
|
484
484
|
...threadState,
|
|
485
485
|
thread: {
|
|
486
486
|
...threadState.thread,
|
|
487
|
-
|
|
488
|
-
status: isCancelled ? "idle" : "error",
|
|
487
|
+
status: "idle",
|
|
489
488
|
updatedAt: new Date().toISOString(),
|
|
490
489
|
lastRunCancelled: isCancelled,
|
|
491
490
|
},
|
|
492
491
|
streaming: {
|
|
493
492
|
...threadState.streaming,
|
|
494
|
-
|
|
495
|
-
status: isCancelled ? "idle" : "error",
|
|
493
|
+
status: "idle",
|
|
496
494
|
error: isCancelled
|
|
497
495
|
? undefined
|
|
498
496
|
: {
|
|
@@ -633,17 +631,30 @@ function handleTextMessageEnd(threadState, event) {
|
|
|
633
631
|
function handleToolCallStart(threadState, event) {
|
|
634
632
|
const messageId = event.parentMessageId;
|
|
635
633
|
const messages = threadState.thread.messages;
|
|
636
|
-
//
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
634
|
+
// Find the parent message for this tool call.
|
|
635
|
+
// If parentMessageId is provided, look it up directly.
|
|
636
|
+
// Otherwise fall back to the last message, but only if it's an assistant message.
|
|
637
|
+
// If the last message isn't assistant (e.g. it's the user message and the LLM
|
|
638
|
+
// didn't produce any text before the tool call), we'll create a synthetic
|
|
639
|
+
// assistant message below.
|
|
640
|
+
let messageIndex;
|
|
641
|
+
if (messageId) {
|
|
642
|
+
messageIndex = messages.findIndex((m) => m.id === messageId);
|
|
643
|
+
}
|
|
644
|
+
else {
|
|
645
|
+
const lastIndex = messages.length - 1;
|
|
646
|
+
messageIndex =
|
|
647
|
+
lastIndex >= 0 && messages[lastIndex].role === "assistant"
|
|
648
|
+
? lastIndex
|
|
649
|
+
: -1;
|
|
650
|
+
}
|
|
640
651
|
const newContent = {
|
|
641
652
|
type: "tool_use",
|
|
642
653
|
id: event.toolCallId,
|
|
643
654
|
name: event.toolCallName,
|
|
644
655
|
input: {},
|
|
645
656
|
};
|
|
646
|
-
// If no message found, create a synthetic
|
|
657
|
+
// If no suitable assistant message found, create a synthetic one for the tool call
|
|
647
658
|
if (messageIndex === -1) {
|
|
648
659
|
const syntheticMessageId = messageId ?? `msg_tool_${event.toolCallId}`;
|
|
649
660
|
const syntheticMessage = {
|