@langchain/angular 0.4.6 → 1.0.0

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 (208) hide show
  1. package/README.md +79 -584
  2. package/dist/context.cjs +13 -11
  3. package/dist/context.cjs.map +1 -1
  4. package/dist/context.d.cts +7 -76
  5. package/dist/context.d.cts.map +1 -1
  6. package/dist/context.d.ts +7 -76
  7. package/dist/context.d.ts.map +1 -1
  8. package/dist/context.js +13 -11
  9. package/dist/context.js.map +1 -1
  10. package/dist/index.cjs +33 -149
  11. package/dist/index.d.cts +11 -329
  12. package/dist/index.d.ts +11 -329
  13. package/dist/index.js +11 -114
  14. package/dist/inject-media-url.cjs +54 -0
  15. package/dist/inject-media-url.cjs.map +1 -0
  16. package/dist/inject-media-url.d.cts +34 -0
  17. package/dist/inject-media-url.d.cts.map +1 -0
  18. package/dist/inject-media-url.d.ts +34 -0
  19. package/dist/inject-media-url.d.ts.map +1 -0
  20. package/dist/inject-media-url.js +54 -0
  21. package/dist/inject-media-url.js.map +1 -0
  22. package/dist/inject-projection.cjs +74 -0
  23. package/dist/inject-projection.cjs.map +1 -0
  24. package/dist/inject-projection.d.cts +34 -0
  25. package/dist/inject-projection.d.cts.map +1 -0
  26. package/dist/inject-projection.d.ts +34 -0
  27. package/dist/inject-projection.d.ts.map +1 -0
  28. package/dist/inject-projection.js +74 -0
  29. package/dist/inject-projection.js.map +1 -0
  30. package/dist/inject-stream.cjs +27 -0
  31. package/dist/inject-stream.cjs.map +1 -0
  32. package/dist/inject-stream.d.cts +31 -0
  33. package/dist/inject-stream.d.cts.map +1 -0
  34. package/dist/inject-stream.d.ts +31 -0
  35. package/dist/inject-stream.d.ts.map +1 -0
  36. package/dist/inject-stream.js +27 -0
  37. package/dist/inject-stream.js.map +1 -0
  38. package/dist/selectors-metadata.cjs +39 -0
  39. package/dist/selectors-metadata.cjs.map +1 -0
  40. package/dist/selectors-metadata.d.cts +28 -0
  41. package/dist/selectors-metadata.d.cts.map +1 -0
  42. package/dist/selectors-metadata.d.ts +28 -0
  43. package/dist/selectors-metadata.d.ts.map +1 -0
  44. package/dist/selectors-metadata.js +39 -0
  45. package/dist/selectors-metadata.js.map +1 -0
  46. package/dist/selectors-queue.cjs +21 -0
  47. package/dist/selectors-queue.cjs.map +1 -0
  48. package/dist/selectors-queue.d.cts +36 -0
  49. package/dist/selectors-queue.d.cts.map +1 -0
  50. package/dist/selectors-queue.d.ts +36 -0
  51. package/dist/selectors-queue.d.ts.map +1 -0
  52. package/dist/selectors-queue.js +21 -0
  53. package/dist/selectors-queue.js.map +1 -0
  54. package/dist/selectors.cjs +144 -0
  55. package/dist/selectors.cjs.map +1 -0
  56. package/dist/selectors.d.cts +111 -0
  57. package/dist/selectors.d.cts.map +1 -0
  58. package/dist/selectors.d.ts +111 -0
  59. package/dist/selectors.d.ts.map +1 -0
  60. package/dist/selectors.js +136 -0
  61. package/dist/selectors.js.map +1 -0
  62. package/dist/stream-service.cjs +84 -0
  63. package/dist/stream-service.cjs.map +1 -0
  64. package/dist/stream-service.d.cts +67 -0
  65. package/dist/stream-service.d.cts.map +1 -0
  66. package/dist/stream-service.d.ts +67 -0
  67. package/dist/stream-service.d.ts.map +1 -0
  68. package/dist/stream-service.js +79 -0
  69. package/dist/stream-service.js.map +1 -0
  70. package/dist/use-stream.cjs +155 -0
  71. package/dist/use-stream.cjs.map +1 -0
  72. package/dist/use-stream.d.cts +97 -0
  73. package/dist/use-stream.d.cts.map +1 -0
  74. package/dist/use-stream.d.ts +97 -0
  75. package/dist/use-stream.d.ts.map +1 -0
  76. package/dist/use-stream.js +153 -0
  77. package/dist/use-stream.js.map +1 -0
  78. package/package.json +26 -25
  79. package/dist/index.cjs.map +0 -1
  80. package/dist/index.d.cts.map +0 -1
  81. package/dist/index.d.ts.map +0 -1
  82. package/dist/index.js.map +0 -1
  83. package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.6_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33._a807b9e815d3fdb40e51117306822e31/node_modules/@langchain/langgraph/dist/channels/base.d.cts +0 -83
  84. package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.6_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33._a807b9e815d3fdb40e51117306822e31/node_modules/@langchain/langgraph/dist/channels/base.d.cts.map +0 -1
  85. package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.6_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33._a807b9e815d3fdb40e51117306822e31/node_modules/@langchain/langgraph/dist/channels/base.d.ts +0 -83
  86. package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.6_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33._a807b9e815d3fdb40e51117306822e31/node_modules/@langchain/langgraph/dist/channels/base.d.ts.map +0 -1
  87. package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.6_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33._a807b9e815d3fdb40e51117306822e31/node_modules/@langchain/langgraph/dist/constants.d.cts +0 -42
  88. package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.6_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33._a807b9e815d3fdb40e51117306822e31/node_modules/@langchain/langgraph/dist/constants.d.cts.map +0 -1
  89. package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.6_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33._a807b9e815d3fdb40e51117306822e31/node_modules/@langchain/langgraph/dist/constants.d.ts +0 -42
  90. package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.6_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33._a807b9e815d3fdb40e51117306822e31/node_modules/@langchain/langgraph/dist/constants.d.ts.map +0 -1
  91. package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.6_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33._a807b9e815d3fdb40e51117306822e31/node_modules/@langchain/langgraph/dist/graph/zod/index.d.cts +0 -2
  92. package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.6_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33._a807b9e815d3fdb40e51117306822e31/node_modules/@langchain/langgraph/dist/graph/zod/index.d.ts +0 -2
  93. package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.6_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33._a807b9e815d3fdb40e51117306822e31/node_modules/@langchain/langgraph/dist/graph/zod/meta.d.cts +0 -109
  94. package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.6_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33._a807b9e815d3fdb40e51117306822e31/node_modules/@langchain/langgraph/dist/graph/zod/meta.d.cts.map +0 -1
  95. package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.6_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33._a807b9e815d3fdb40e51117306822e31/node_modules/@langchain/langgraph/dist/graph/zod/meta.d.ts +0 -109
  96. package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.6_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33._a807b9e815d3fdb40e51117306822e31/node_modules/@langchain/langgraph/dist/graph/zod/meta.d.ts.map +0 -1
  97. package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.6_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33._a807b9e815d3fdb40e51117306822e31/node_modules/@langchain/langgraph/dist/graph/zod/zod-registry.d.cts +0 -49
  98. package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.6_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33._a807b9e815d3fdb40e51117306822e31/node_modules/@langchain/langgraph/dist/graph/zod/zod-registry.d.cts.map +0 -1
  99. package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.6_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33._a807b9e815d3fdb40e51117306822e31/node_modules/@langchain/langgraph/dist/graph/zod/zod-registry.d.ts +0 -49
  100. package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.6_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33._a807b9e815d3fdb40e51117306822e31/node_modules/@langchain/langgraph/dist/graph/zod/zod-registry.d.ts.map +0 -1
  101. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/ReactAgent.d.cts +0 -1
  102. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/ReactAgent.d.ts +0 -1
  103. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/index.d.cts +0 -1
  104. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/index.d.ts +0 -1
  105. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/contextEditing.d.cts +0 -1
  106. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/contextEditing.d.ts +0 -1
  107. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/dynamicSystemPrompt.d.cts +0 -1
  108. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/dynamicSystemPrompt.d.ts +0 -1
  109. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/hitl.d.cts +0 -1
  110. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/hitl.d.ts +0 -1
  111. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/llmToolSelector.d.cts +0 -1
  112. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/llmToolSelector.d.ts +0 -1
  113. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/modelCallLimit.d.cts +0 -1
  114. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/modelCallLimit.d.ts +0 -1
  115. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/modelFallback.d.cts +0 -1
  116. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/modelFallback.d.ts +0 -1
  117. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/modelRetry.d.cts +0 -1
  118. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/modelRetry.d.ts +0 -1
  119. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/pii.d.cts +0 -1
  120. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/pii.d.ts +0 -1
  121. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/piiRedaction.d.cts +0 -1
  122. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/piiRedaction.d.ts +0 -1
  123. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/provider/anthropic/promptCaching.d.cts +0 -1
  124. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/provider/anthropic/promptCaching.d.ts +0 -1
  125. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/provider/openai/moderation.d.cts +0 -1
  126. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/provider/openai/moderation.d.ts +0 -1
  127. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/summarization.d.cts +0 -1
  128. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/summarization.d.ts +0 -1
  129. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/todoListMiddleware.d.cts +0 -1
  130. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/todoListMiddleware.d.ts +0 -1
  131. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/toolCallLimit.d.cts +0 -1
  132. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/toolCallLimit.d.ts +0 -1
  133. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/toolEmulator.d.cts +0 -1
  134. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/toolEmulator.d.ts +0 -1
  135. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/toolRetry.d.cts +0 -1
  136. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/toolRetry.d.ts +0 -1
  137. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/types.d.cts +0 -2
  138. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware/types.d.ts +0 -2
  139. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware.d.cts +0 -1
  140. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/middleware.d.ts +0 -1
  141. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/types.d.cts +0 -2
  142. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/agents/types.d.ts +0 -2
  143. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/index.d.cts +0 -2
  144. package/dist/node_modules/.pnpm/langchain@1.3.0_@langchain_core@1.1.40_@opentelemetry_api@1.9.0_openai@6.33.0_ws@8.19.0_41511a57baf32de01f36b804226da973/node_modules/langchain/dist/index.d.ts +0 -2
  145. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.d.cts +0 -29
  146. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.d.cts.map +0 -1
  147. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.d.ts +0 -29
  148. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.d.ts.map +0 -1
  149. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.d.cts +0 -29
  150. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.d.cts.map +0 -1
  151. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.d.ts +0 -29
  152. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.d.ts.map +0 -1
  153. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.d.cts +0 -105
  154. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.d.cts.map +0 -1
  155. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.d.ts +0 -105
  156. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.d.ts.map +0 -1
  157. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema.d.cts +0 -70
  158. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema.d.cts.map +0 -1
  159. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema.d.ts +0 -70
  160. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema.d.ts.map +0 -1
  161. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.d.cts +0 -24
  162. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.d.cts.map +0 -1
  163. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.d.ts +0 -24
  164. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.d.ts.map +0 -1
  165. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.d.cts +0 -97
  166. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.d.cts.map +0 -1
  167. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.d.ts +0 -97
  168. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.d.ts.map +0 -1
  169. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/standard-schema.d.cts +0 -79
  170. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/standard-schema.d.cts.map +0 -1
  171. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/standard-schema.d.ts +0 -79
  172. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/standard-schema.d.ts.map +0 -1
  173. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.d.cts +0 -52
  174. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.d.cts.map +0 -1
  175. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.d.ts +0 -52
  176. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.d.ts.map +0 -1
  177. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.d.cts +0 -17
  178. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.d.cts.map +0 -1
  179. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.d.ts +0 -17
  180. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.d.ts.map +0 -1
  181. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.d.cts +0 -9
  182. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.d.cts.map +0 -1
  183. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.d.ts +0 -9
  184. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.d.ts.map +0 -1
  185. package/dist/stream-service-instance.d.cts +0 -70
  186. package/dist/stream-service-instance.d.cts.map +0 -1
  187. package/dist/stream-service-instance.d.ts +0 -70
  188. package/dist/stream-service-instance.d.ts.map +0 -1
  189. package/dist/stream.custom.cjs +0 -117
  190. package/dist/stream.custom.cjs.map +0 -1
  191. package/dist/stream.custom.d.cts +0 -45
  192. package/dist/stream.custom.d.cts.map +0 -1
  193. package/dist/stream.custom.d.ts +0 -45
  194. package/dist/stream.custom.d.ts.map +0 -1
  195. package/dist/stream.custom.js +0 -116
  196. package/dist/stream.custom.js.map +0 -1
  197. package/dist/stream.lgp.cjs +0 -174
  198. package/dist/stream.lgp.cjs.map +0 -1
  199. package/dist/stream.lgp.d.cts +0 -57
  200. package/dist/stream.lgp.d.cts.map +0 -1
  201. package/dist/stream.lgp.d.ts +0 -57
  202. package/dist/stream.lgp.d.ts.map +0 -1
  203. package/dist/stream.lgp.js +0 -174
  204. package/dist/stream.lgp.js.map +0 -1
  205. package/dist/subagents.cjs +0 -76
  206. package/dist/subagents.cjs.map +0 -1
  207. package/dist/subagents.js +0 -76
  208. package/dist/subagents.js.map +0 -1
package/README.md CHANGED
@@ -1,8 +1,17 @@
1
1
  # @langchain/angular
2
2
 
3
- Angular SDK for building AI-powered applications with [Deep Agents](https://docs.langchain.com/oss/javascript/deepagents/overview), [LangChain](https://docs.langchain.com/oss/javascript/langchain/overview) and [LangGraph](https://docs.langchain.com/oss/javascript/langgraph/overview). It provides an `injectStream` function that manages streaming, state, branching, and interrupts using Angular's Signals API.
3
+ Angular SDK for building AI-powered applications with [Deep Agents](https://docs.langchain.com/oss/javascript/deepagents/overview), [LangChain](https://docs.langchain.com/oss/javascript/langchain/overview) and [LangGraph](https://docs.langchain.com/oss/javascript/langgraph/overview).
4
4
 
5
- > **Migration note:** `useStream` has been renamed to `injectStream` to follow Angular's `inject*` naming convention. `useStream` is still available as a deprecated alias for backwards compatibility.
5
+ The package ships a Signals-first API built on top of the v2 streaming
6
+ protocol. `injectStream` returns a small, always-on root handle
7
+ (`values`, `messages`, `isLoading`, `error`, …) and pushes anything
8
+ namespaced (subagents, subgraphs, media, submission queue, per-message
9
+ metadata) behind **ref-counted `inject*` selectors** so components
10
+ only pay for data they actually consume.
11
+
12
+ > **Upgrading from `0.x`?** See [`docs/v1-migration.md`](./docs/v1-migration.md)
13
+ > for the complete matrix of option, return-shape, and transport
14
+ > changes.
6
15
 
7
16
  ## Installation
8
17
 
@@ -10,9 +19,10 @@ Angular SDK for building AI-powered applications with [Deep Agents](https://docs
10
19
  npm install @langchain/angular @langchain/core
11
20
  ```
12
21
 
13
- **Peer dependencies:** `@angular/core` (^18.0.0 - ^21.0.0), `@langchain/core` (^1.0.1)
22
+ **Peer dependencies:** `@angular/core` (^18.0.0 ^21.0.0),
23
+ `@langchain/core` (^1.1.27).
14
24
 
15
- ## Quick Start
25
+ ## Quick start
16
26
 
17
27
  ```typescript
18
28
  import { Component } from "@angular/core";
@@ -36,7 +46,7 @@ import { injectStream } from "@langchain/angular";
36
46
  `,
37
47
  })
38
48
  export class ChatComponent {
39
- stream = injectStream({
49
+ readonly stream = injectStream({
40
50
  assistantId: "agent",
41
51
  apiUrl: "http://localhost:2024",
42
52
  });
@@ -53,588 +63,73 @@ export class ChatComponent {
53
63
  }
54
64
  ```
55
65
 
56
- ## `injectStream` Options
57
-
58
- | Option | Type | Description |
59
- |---|---|---|
60
- | `assistantId` | `string` | **Required.** The assistant/graph ID to stream from. |
61
- | `apiUrl` | `string` | Base URL of the LangGraph API. |
62
- | `client` | `Client` | Pre-configured `Client` instance (alternative to `apiUrl`). |
63
- | `messagesKey` | `string` | State key containing messages. Defaults to `"messages"`. |
64
- | `initialValues` | `StateType` | Initial state values before any stream data arrives. |
65
- | `fetchStateHistory` | `boolean \| { limit: number }` | Fetch thread history on stream completion. Enables branching. |
66
- | `throttle` | `boolean \| number` | Throttle state updates for performance. |
67
- | `onFinish` | `(state, error?) => void` | Called when the stream completes. |
68
- | `onError` | `(error, state?) => void` | Called on stream errors. |
69
- | `onThreadId` | `(threadId) => void` | Called when a new thread is created. |
70
- | `onUpdateEvent` | `(event) => void` | Receive update events from the stream. |
71
- | `onCustomEvent` | `(event) => void` | Receive custom events from the stream. |
72
- | `onStop` | `() => void` | Called when the stream is stopped by the user. |
73
-
74
- ## Return Values
75
-
76
- All reactive properties are Angular `Signal` or `WritableSignal` values.
77
-
78
- | Property | Type | Description |
79
- |---|---|---|
80
- | `values` | `Signal<StateType>` | Current graph state. |
81
- | `messages` | `Signal<Message[]>` | Messages from the current state. |
82
- | `isLoading` | `Signal<boolean>` | Whether a stream is currently active. |
83
- | `error` | `Signal<unknown>` | The most recent error, if any. |
84
- | `interrupt` | `Signal<Interrupt \| undefined>` | Current interrupt requiring user input. |
85
- | `branch` | `WritableSignal<string>` | Active branch identifier. |
86
- | `submit(values, options?)` | `function` | Submit new input to the graph. When called while a stream is active, the run is created on the server with `multitaskStrategy: "enqueue"` and queued automatically. |
87
- | `stop()` | `function` | Cancel the active stream. |
88
- | `setBranch(branch)` | `function` | Switch to a different conversation branch. |
89
- | `getMessagesMetadata(msg, index?)` | `function` | Get branching and checkpoint metadata for a message. |
90
- | `switchThread(id)` | `(id: string \| null) => void` | Switch to a different thread. Pass `null` to start a new thread on next submit. |
91
- | `queue.entries` | `Signal<ReadonlyArray<QueueEntry>>` | Pending server-side runs. Each entry has `id` (server run ID), `values`, `options`, and `createdAt`. |
92
- | `queue.size` | `Signal<number>` | Number of pending runs on the server. |
93
- | `queue.cancel(id)` | `(id: string) => Promise<boolean>` | Cancel a pending run on the server by its run ID. |
94
- | `queue.clear()` | `() => Promise<void>` | Cancel all pending runs on the server. |
95
-
96
- ## Type Safety
97
-
98
- Provide your state type as a generic parameter:
99
-
100
- ```typescript
101
- import type { BaseMessage } from "langchain";
102
-
103
- interface MyState {
104
- messages: BaseMessage[];
105
- context?: string;
106
- }
107
-
108
- @Component({ /* ... */ })
109
- export class ChatComponent {
110
- stream = injectStream<MyState>({
111
- assistantId: "my-graph",
112
- apiUrl: "http://localhost:2024",
113
- });
114
- }
115
- ```
116
-
117
- ### Typed Interrupts
118
-
119
- ```typescript
120
- import type { BaseMessage } from "langchain";
121
-
122
- @Component({ /* ... */ })
123
- export class ChatComponent {
124
- stream = injectStream<
125
- { messages: BaseMessage[] },
126
- { InterruptType: { question: string } }
127
- >({
128
- assistantId: "my-graph",
129
- apiUrl: "http://localhost:2024",
130
- });
131
-
132
- // this.stream.interrupt() is typed as { question: string } | undefined
133
- }
134
- ```
135
-
136
- ## Handling Interrupts
137
-
138
- ```typescript
139
- import { Component } from "@angular/core";
140
- import type { BaseMessage } from "langchain";
141
- import { injectStream } from "@langchain/angular";
142
-
143
- @Component({
144
- standalone: true,
145
- template: `
146
- <div>
147
- @for (msg of stream.messages(); track msg.id ?? $index) {
148
- <div>{{ str(msg.content) }}</div>
149
- }
150
-
151
- @if (stream.interrupt()) {
152
- <div>
153
- <p>{{ stream.interrupt()!.value.question }}</p>
154
- <button (click)="onResume()">Approve</button>
155
- </div>
156
- }
157
-
158
- <button (click)="onSubmit()">Send</button>
159
- </div>
160
- `,
161
- })
162
- export class ChatComponent {
163
- stream = injectStream<
164
- { messages: BaseMessage[] },
165
- { InterruptType: { question: string } }
166
- >({
167
- assistantId: "agent",
168
- apiUrl: "http://localhost:2024",
169
- });
170
-
171
- str(v: unknown) {
172
- return typeof v === "string" ? v : JSON.stringify(v);
173
- }
174
-
175
- onSubmit() {
176
- void this.stream.submit({
177
- messages: [{ type: "human", content: "Hello" }],
178
- });
179
- }
180
-
181
- onResume() {
182
- void this.stream.submit(null, { command: { resume: "Approved" } });
183
- }
184
- }
185
- ```
186
-
187
- ## Branching
188
-
189
- Enable conversation branching with `fetchStateHistory: true`:
190
-
191
- ```typescript
192
- import { Component } from "@angular/core";
193
- import { injectStream } from "@langchain/angular";
194
-
195
- @Component({
196
- standalone: true,
197
- template: `
198
- <div>
199
- @for (msg of stream.messages(); track msg.id ?? $index) {
200
- <div>
201
- <p>{{ str(msg.content) }}</p>
202
-
203
- @if (getBranchNav(msg, $index); as nav) {
204
- <button (click)="onPrev(nav)">Previous</button>
205
- <span>{{ nav.current + 1 }} / {{ nav.total }}</span>
206
- <button (click)="onNext(nav)">Next</button>
207
- }
208
- </div>
209
- }
210
-
211
- <button (click)="onSubmit()">Send</button>
212
- </div>
213
- `,
214
- })
215
- export class ChatComponent {
216
- stream = injectStream({
217
- assistantId: "agent",
218
- apiUrl: "http://localhost:2024",
219
- fetchStateHistory: true,
220
- });
221
-
222
- str(v: unknown) {
223
- return typeof v === "string" ? v : JSON.stringify(v);
224
- }
225
-
226
- getBranchNav(msg: any, index: number) {
227
- const metadata = this.stream.getMessagesMetadata(msg, index);
228
- const options = metadata?.branchOptions;
229
- const branch = metadata?.branch;
230
- if (!options || !branch) return null;
231
- return {
232
- options,
233
- current: options.indexOf(branch),
234
- total: options.length,
235
- };
236
- }
237
-
238
- onPrev(nav: { options: string[]; current: number }) {
239
- const prev = nav.options[nav.current - 1];
240
- if (prev) this.stream.setBranch(prev);
241
- }
242
-
243
- onNext(nav: { options: string[]; current: number }) {
244
- const next = nav.options[nav.current + 1];
245
- if (next) this.stream.setBranch(next);
246
- }
247
-
248
- onSubmit() {
249
- void this.stream.submit({
250
- messages: [{ type: "human", content: "Hello" }],
251
- });
252
- }
253
- }
254
- ```
255
-
256
- ## Server-Side Queuing
257
-
258
- When `submit()` is called while a stream is already active, the SDK automatically creates the run on the server with `multitaskStrategy: "enqueue"`. The pending runs are tracked in `queue` and processed in order as each finishes:
259
-
260
- ```typescript
261
- import { Component } from "@angular/core";
262
- import { injectStream } from "@langchain/angular";
263
-
264
- @Component({
265
- standalone: true,
266
- template: `
267
- <div>
268
- @for (msg of stream.messages(); track msg.id ?? $index) {
269
- <div>{{ str(msg.content) }}</div>
270
- }
271
-
272
- @if (stream.queue.size() > 0) {
273
- <div>
274
- <p>{{ stream.queue.size() }} message(s) queued</p>
275
- <button (click)="onClearQueue()">Clear Queue</button>
276
- </div>
277
- }
278
-
279
- <button
280
- [disabled]="stream.isLoading()"
281
- (click)="onSubmit()"
282
- >
283
- Send
284
- </button>
285
- <button (click)="onNewThread()">New Thread</button>
286
- </div>
287
- `,
288
- })
289
- export class ChatComponent {
290
- stream = injectStream({
291
- assistantId: "agent",
292
- apiUrl: "http://localhost:2024",
293
- });
294
-
295
- str(v: unknown) {
296
- return typeof v === "string" ? v : JSON.stringify(v);
297
- }
298
-
299
- onSubmit() {
300
- void this.stream.submit({
301
- messages: [{ type: "human", content: "Hello!" }],
302
- });
303
- }
304
-
305
- onClearQueue() {
306
- void this.stream.queue.clear();
307
- }
308
-
309
- onNewThread() {
310
- this.stream.switchThread(null);
311
- }
312
- }
313
- ```
314
-
315
- Switching threads via `switchThread()` cancels all pending runs and clears the queue.
316
-
317
- ## Service Pattern
318
-
319
- For projects that prefer Angular's dependency injection, `StreamService` provides an `@Injectable()` base class that wraps `useStream`. Extend it with your own service to enable DI, testability, and shared state across components:
320
-
321
- ```typescript
322
- import { Injectable, Component, inject } from "@angular/core";
323
- import { StreamService } from "@langchain/angular";
324
- import type { BaseMessage } from "langchain";
325
-
326
- interface ChatState {
327
- messages: BaseMessage[];
328
- }
329
-
330
- @Injectable({ providedIn: "root" })
331
- export class ChatService extends StreamService<ChatState> {
332
- constructor() {
333
- super({
334
- assistantId: "agent",
335
- apiUrl: "http://localhost:2024",
336
- });
337
- }
338
- }
339
-
340
- @Component({
341
- standalone: true,
342
- template: `
343
- <div>
344
- @for (msg of chat.messages(); track msg.id ?? $index) {
345
- <div>{{ str(msg.content) }}</div>
346
- }
347
-
348
- <button
349
- [disabled]="chat.isLoading()"
350
- (click)="onSubmit()"
351
- >
352
- Send
353
- </button>
354
- </div>
355
- `,
356
- })
357
- export class ChatComponent {
358
- chat = inject(ChatService);
359
-
360
- str(v: unknown) {
361
- return typeof v === "string" ? v : JSON.stringify(v);
362
- }
363
-
364
- onSubmit() {
365
- void this.chat.submit({
366
- messages: [{ type: "human", content: "Hello!" }],
367
- });
368
- }
369
- }
370
- ```
371
-
372
- The service exposes the same signals and methods as `useStream` (`values`, `messages`, `isLoading`, `submit`, `stop`, etc.).
373
-
374
- ### Shared State Across Components
375
-
376
- Because the service is provided through DI, multiple components can inject the same instance and share stream state:
377
-
378
- ```typescript
379
- @Component({
380
- standalone: true,
381
- selector: "app-message-list",
382
- template: `
383
- @for (msg of chat.messages(); track msg.id ?? $index) {
384
- <div>{{ msg.content }}</div>
385
- }
386
- `,
387
- })
388
- export class MessageListComponent {
389
- chat = inject(ChatService);
390
- }
391
-
392
- @Component({
393
- standalone: true,
394
- imports: [MessageListComponent],
395
- template: `
396
- <app-message-list />
397
- <button (click)="onSubmit()">Send</button>
398
- `,
399
- })
400
- export class ChatPageComponent {
401
- chat = inject(ChatService);
402
-
403
- onSubmit() {
404
- void this.chat.submit({
405
- messages: [{ type: "human", content: "Hello!" }],
406
- });
407
- }
408
- }
409
- ```
410
-
411
- ### Custom Transport with StreamService
412
-
413
- ```typescript
414
- import { Injectable } from "@angular/core";
415
- import { StreamService, FetchStreamTransport } from "@langchain/angular";
416
- import type { BaseMessage } from "langchain";
417
-
418
- @Injectable({ providedIn: "root" })
419
- export class CustomChatService extends StreamService<{
420
- messages: BaseMessage[];
421
- }> {
422
- constructor() {
423
- super({
424
- transport: new FetchStreamTransport({
425
- url: "https://my-api.example.com/stream",
426
- }),
427
- threadId: null,
428
- onThreadId: (id) => console.log("Thread created:", id),
429
- });
430
- }
431
- }
432
- ```
433
-
434
- ### Testing
435
-
436
- Services can be mocked or overridden in tests using Angular's standard DI testing utilities:
437
-
438
- ```typescript
439
- import { TestBed } from "@angular/core/testing";
440
-
441
- const mockService = {
442
- messages: signal([]),
443
- isLoading: signal(false),
444
- submit: vi.fn(),
445
- stop: vi.fn(),
446
- };
447
-
448
- TestBed.configureTestingModule({
449
- providers: [{ provide: ChatService, useValue: mockService }],
450
- });
451
- ```
452
-
453
- ## Custom Transport
454
-
455
- Instead of connecting to a LangGraph API, you can provide your own streaming transport. Pass a `transport` object instead of `assistantId` to use a custom backend:
456
-
457
- ```typescript
458
- import { Component } from "@angular/core";
459
- import { injectStream, FetchStreamTransport } from "@langchain/angular";
460
- import type { BaseMessage } from "langchain";
461
-
462
- @Component({
463
- standalone: true,
464
- template: `
465
- <div>
466
- @for (msg of stream.messages(); track msg.id ?? $index) {
467
- <div>
468
- <p>{{ str(msg.content) }}</p>
469
- @if (getStreamNode(msg, $index); as node) {
470
- <span>Node: {{ node }}</span>
471
- }
472
- </div>
473
- }
474
-
475
- <p>Current branch: {{ stream.branch() }}</p>
476
-
477
- <button
478
- [disabled]="stream.isLoading()"
479
- (click)="onSubmit()"
480
- >
481
- Send
482
- </button>
483
- </div>
484
- `,
485
- })
486
- export class ChatComponent {
487
- stream = injectStream<{ messages: BaseMessage[] }>({
488
- transport: new FetchStreamTransport({
489
- url: "https://my-api.example.com/stream",
490
- }),
491
- threadId: null,
492
- onThreadId: (id) => console.log("Thread created:", id),
493
- });
494
-
495
- str(v: unknown) {
496
- return typeof v === "string" ? v : JSON.stringify(v);
497
- }
498
-
499
- getStreamNode(msg: any, index: number): string | null {
500
- const metadata = this.stream.getMessagesMetadata(msg, index);
501
- return (metadata?.streamMetadata as any)?.langgraph_node ?? null;
502
- }
503
-
504
- onSubmit() {
505
- void this.stream.submit({
506
- messages: [{ type: "human", content: "Hello!" }],
507
- });
508
- }
509
- }
510
- ```
511
-
512
- The custom transport interface returns the same properties as the standard `injectStream` function, including `getMessagesMetadata`, `branch`, `setBranch`, `switchThread`, and all message/interrupt/subagent helpers. When using a custom transport, `getMessagesMetadata` returns stream metadata sent alongside messages during streaming; `branch` and `setBranch` provide local branch state management. `onFinish` is also supported and receives a synthetic `ThreadState` built from the final locally streamed values; the run metadata argument is `undefined`.
513
-
514
- ## Sharing State with `provideStream`
515
-
516
- When multiple components need the same stream (a message list, a header, an input bar), use `provideStream` and `injectStream` to share a single stream instance via Angular's dependency injection:
517
-
518
- ```typescript
519
- import { Component } from "@angular/core";
520
- import { provideStream, injectStream } from "@langchain/angular";
521
-
522
- @Component({
523
- selector: "app-chat-container",
524
- providers: [provideStream({ assistantId: "agent", apiUrl: "http://localhost:2024" })],
525
- template: `
526
- <app-chat-header />
527
- <app-message-list />
528
- <app-message-input />
529
- `,
530
- })
531
- export class ChatContainerComponent {}
532
-
533
- @Component({
534
- selector: "app-chat-header",
535
- template: `
536
- <header>
537
- <h1>Chat</h1>
538
- @if (stream.isLoading()) {
539
- <span>Thinking...</span>
540
- }
541
- @if (stream.error()) {
542
- <span>Error occurred</span>
543
- }
544
- </header>
545
- `,
546
- })
547
- export class ChatHeaderComponent {
548
- stream = injectStream();
549
- }
550
-
551
- @Component({
552
- selector: "app-message-list",
553
- template: `
554
- @for (msg of stream.messages(); track msg.id ?? $index) {
555
- <div>{{ str(msg.content) }}</div>
556
- }
557
- `,
558
- })
559
- export class MessageListComponent {
560
- stream = injectStream();
561
-
562
- str(v: unknown) {
563
- return typeof v === "string" ? v : JSON.stringify(v);
564
- }
565
- }
566
-
567
- @Component({
568
- selector: "app-message-input",
569
- template: `
570
- <button
571
- [disabled]="stream.isLoading()"
572
- (click)="onSubmit()"
573
- >Send</button>
574
- `,
575
- })
576
- export class MessageInputComponent {
577
- stream = injectStream();
578
-
579
- onSubmit() {
580
- void this.stream.submit({
581
- messages: [{ type: "human", content: "Hello!" }],
582
- });
583
- }
584
- }
585
- ```
586
-
587
- ### App-Level Configuration with `provideStreamDefaults`
588
-
589
- Set default configuration for all `useStream` and `injectStream` calls application-wide:
590
-
591
- ```typescript
592
- // app.config.ts
593
- import { ApplicationConfig } from "@angular/core";
594
- import { provideStreamDefaults } from "@langchain/angular";
595
-
596
- export const appConfig: ApplicationConfig = {
597
- providers: [
598
- provideStreamDefaults({
599
- apiUrl: "http://localhost:2024",
600
- }),
601
- ],
602
- };
603
- ```
604
-
605
- Then in components, `apiUrl` is inherited automatically:
606
-
607
- ```typescript
608
- @Component({
609
- providers: [provideStream({ assistantId: "agent" })],
610
- template: `...`,
611
- })
612
- export class ChatComponent {}
613
- ```
614
-
615
- ### Multiple Agents
616
-
617
- Use separate `provideStream` entries on different components — Angular's hierarchical injector ensures each subtree gets its own isolated stream:
618
-
619
- ```typescript
620
- @Component({
621
- selector: "app-research-panel",
622
- providers: [provideStream({ assistantId: "researcher", apiUrl: "http://localhost:2024" })],
623
- template: `<app-message-list /> <app-message-input />`,
624
- })
625
- export class ResearchPanelComponent {}
626
-
627
- @Component({
628
- selector: "app-writer-panel",
629
- providers: [provideStream({ assistantId: "writer", apiUrl: "http://localhost:2024" })],
630
- template: `<app-message-list /> <app-message-input />`,
631
- })
632
- export class WriterPanelComponent {}
633
- ```
66
+ `injectStream` must be called from an **Angular injection context** —
67
+ the host's `DestroyRef` owns the stream, so navigating away destroys
68
+ the controller automatically.
69
+
70
+ ## Features at a glance
71
+
72
+ - **Signals everywhere.** Messages, values, tool calls, interrupts,
73
+ loading/error state all Angular `Signal<T>`s you call as
74
+ functions in templates.
75
+ - **One call, two transports.** Same option bag targets either the
76
+ LangGraph Platform (SSE by default, `transport: "websocket"`
77
+ opt-in) or a custom backend through an `AgentServerAdapter`.
78
+ - **Ref-counted selectors.** `injectMessages`, `injectValues`,
79
+ `injectToolCalls`, media selectors, submission queue the first
80
+ consumer opens a subscription, the last one's `DestroyRef` closes
81
+ it. Components pay only for what they render.
82
+ - **Human-in-the-loop.** Interrupts are first-class signals; resume
83
+ or fork a specific pending interrupt with one call.
84
+ - **Headless tools.** Register browser-side tool implementations;
85
+ the runtime dispatches matching interrupts and auto-resumes with
86
+ the return value.
87
+ - **Subagent & subgraph discovery.** Lightweight snapshots at the
88
+ root; scoped content (messages, tool calls, state) via the same
89
+ selectors, targeted at a snapshot or namespace.
90
+ - **Forking without history preload.** Per-message metadata +
91
+ `submit({ forkFrom })` replaces the legacy `branch` /
92
+ `fetchStateHistory` trio.
93
+ - **DI-native.** `provideStream` for subtree sharing,
94
+ `provideStreamDefaults` for app-wide config, `StreamService` for
95
+ class-based wrappers.
96
+ - **Typed end-to-end.** Pass `typeof agent` as the first generic
97
+ state, tool args, and per-subagent state flow through to every
98
+ selector.
99
+
100
+ ## Public stream types
101
+
102
+ Use `StreamApi<T>` when you need to name the return type of
103
+ `injectStream`, `useStream`, `provideStream`, or `StreamService` in
104
+ Angular code. It is the Angular-facing alias for the Signals-first
105
+ handle.
106
+
107
+ `UseStreamResult<T>` is also exported as a React-compatible alias for
108
+ the same shape. Prefer it only in shared utilities that are designed to
109
+ accept stream handles from multiple framework packages.
110
+
111
+ ## Documentation
112
+
113
+ In-depth guides live under [`docs/`](./docs):
114
+
115
+ - [`inject-stream.md`](./docs/inject-stream.md) — options + return-shape reference
116
+ - [`transports.md`](./docs/transports.md) — SSE, WebSocket, and custom `AgentServerAdapter`
117
+ - [`custom-transport.md`](./docs/custom-transport.md) — implementing `AgentServerAdapter` against your own backend, with a worked walkthrough of [`examples/ui-react-transport`](../../examples/ui-react-transport)
118
+ - [`selectors.md`](./docs/selectors.md) scoped reads (`injectMessages`, `injectValues`, media, channels, …)
119
+ - [`interrupts.md`](./docs/interrupts.md) handling and responding to interrupts
120
+ - [`branching.md`](./docs/branching.md) — forking via `injectMessageMetadata` + `submit({ forkFrom })`
121
+ - [`submission-queue.md`](./docs/submission-queue.md) — `injectSubmissionQueue` and `multitaskStrategy: "enqueue"`
122
+ - [`headless-tools.md`](./docs/headless-tools.md) — browser-side tool implementations
123
+ - [`subagents-subgraphs.md`](./docs/subagents-subgraphs.md) — discovery snapshots and scoped content
124
+ - [`dependency-injection.md`](./docs/dependency-injection.md) — `provideStream`, `provideStreamDefaults`, `StreamService`
125
+ - [`type-safety.md`](./docs/type-safety.md) — generics, agent inference, and public stream aliases
126
+ - [`testing.md`](./docs/testing.md) — `STREAM_INSTANCE` fakes and service overrides
127
+ - [`v1-migration.md`](./docs/v1-migration.md) — migrating from `0.x`
634
128
 
635
129
  ## Playground
636
130
 
637
- For complete end-to-end examples with full agentic UIs, visit the [LangChain UI Playground](https://docs.langchain.com/playground).
131
+ For complete end-to-end examples, visit the
132
+ [LangChain UI Playground](https://docs.langchain.com/playground).
638
133
 
639
134
  ## License
640
135