@langchain/angular 0.4.7 → 1.0.1
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/README.md +79 -584
- package/dist/context.cjs +13 -11
- package/dist/context.cjs.map +1 -1
- package/dist/context.d.cts +7 -76
- package/dist/context.d.cts.map +1 -1
- package/dist/context.d.ts +7 -76
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +13 -11
- package/dist/context.js.map +1 -1
- package/dist/index.cjs +33 -149
- package/dist/index.d.cts +11 -329
- package/dist/index.d.ts +11 -329
- package/dist/index.js +11 -114
- package/dist/inject-media-url.cjs +54 -0
- package/dist/inject-media-url.cjs.map +1 -0
- package/dist/inject-media-url.d.cts +34 -0
- package/dist/inject-media-url.d.cts.map +1 -0
- package/dist/inject-media-url.d.ts +34 -0
- package/dist/inject-media-url.d.ts.map +1 -0
- package/dist/inject-media-url.js +54 -0
- package/dist/inject-media-url.js.map +1 -0
- package/dist/inject-projection.cjs +74 -0
- package/dist/inject-projection.cjs.map +1 -0
- package/dist/inject-projection.d.cts +34 -0
- package/dist/inject-projection.d.cts.map +1 -0
- package/dist/inject-projection.d.ts +34 -0
- package/dist/inject-projection.d.ts.map +1 -0
- package/dist/inject-projection.js +74 -0
- package/dist/inject-projection.js.map +1 -0
- package/dist/inject-stream.cjs +27 -0
- package/dist/inject-stream.cjs.map +1 -0
- package/dist/inject-stream.d.cts +31 -0
- package/dist/inject-stream.d.cts.map +1 -0
- package/dist/inject-stream.d.ts +31 -0
- package/dist/inject-stream.d.ts.map +1 -0
- package/dist/inject-stream.js +27 -0
- package/dist/inject-stream.js.map +1 -0
- package/dist/selectors-metadata.cjs +39 -0
- package/dist/selectors-metadata.cjs.map +1 -0
- package/dist/selectors-metadata.d.cts +28 -0
- package/dist/selectors-metadata.d.cts.map +1 -0
- package/dist/selectors-metadata.d.ts +28 -0
- package/dist/selectors-metadata.d.ts.map +1 -0
- package/dist/selectors-metadata.js +39 -0
- package/dist/selectors-metadata.js.map +1 -0
- package/dist/selectors-queue.cjs +21 -0
- package/dist/selectors-queue.cjs.map +1 -0
- package/dist/selectors-queue.d.cts +36 -0
- package/dist/selectors-queue.d.cts.map +1 -0
- package/dist/selectors-queue.d.ts +36 -0
- package/dist/selectors-queue.d.ts.map +1 -0
- package/dist/selectors-queue.js +21 -0
- package/dist/selectors-queue.js.map +1 -0
- package/dist/selectors.cjs +144 -0
- package/dist/selectors.cjs.map +1 -0
- package/dist/selectors.d.cts +111 -0
- package/dist/selectors.d.cts.map +1 -0
- package/dist/selectors.d.ts +111 -0
- package/dist/selectors.d.ts.map +1 -0
- package/dist/selectors.js +136 -0
- package/dist/selectors.js.map +1 -0
- package/dist/stream-service.cjs +84 -0
- package/dist/stream-service.cjs.map +1 -0
- package/dist/stream-service.d.cts +67 -0
- package/dist/stream-service.d.cts.map +1 -0
- package/dist/stream-service.d.ts +67 -0
- package/dist/stream-service.d.ts.map +1 -0
- package/dist/stream-service.js +79 -0
- package/dist/stream-service.js.map +1 -0
- package/dist/use-stream.cjs +155 -0
- package/dist/use-stream.cjs.map +1 -0
- package/dist/use-stream.d.cts +97 -0
- package/dist/use-stream.d.cts.map +1 -0
- package/dist/use-stream.d.ts +97 -0
- package/dist/use-stream.d.ts.map +1 -0
- package/dist/use-stream.js +153 -0
- package/dist/use-stream.js.map +1 -0
- package/package.json +26 -25
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.d.cts +0 -29
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.d.cts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.d.ts +0 -29
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.d.ts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.d.cts +0 -29
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.d.cts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.d.ts +0 -29
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.d.ts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.d.cts +0 -105
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.d.cts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.d.ts +0 -105
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.d.ts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema.d.cts +0 -70
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema.d.cts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema.d.ts +0 -70
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema.d.ts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.d.cts +0 -24
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.d.cts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.d.ts +0 -24
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.d.ts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.d.cts +0 -97
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.d.cts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.d.ts +0 -97
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.d.ts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/standard-schema.d.cts +0 -79
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/standard-schema.d.cts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/standard-schema.d.ts +0 -79
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/standard-schema.d.ts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.d.cts +0 -52
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.d.cts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.d.ts +0 -52
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.d.ts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.d.cts +0 -17
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.d.cts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.d.ts +0 -17
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.d.ts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.d.cts +0 -9
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.d.cts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.d.ts +0 -9
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.d.ts.map +0 -1
- package/dist/stream-service-instance.d.cts +0 -70
- package/dist/stream-service-instance.d.cts.map +0 -1
- package/dist/stream-service-instance.d.ts +0 -70
- package/dist/stream-service-instance.d.ts.map +0 -1
- package/dist/stream.custom.cjs +0 -117
- package/dist/stream.custom.cjs.map +0 -1
- package/dist/stream.custom.d.cts +0 -45
- package/dist/stream.custom.d.cts.map +0 -1
- package/dist/stream.custom.d.ts +0 -45
- package/dist/stream.custom.d.ts.map +0 -1
- package/dist/stream.custom.js +0 -116
- package/dist/stream.custom.js.map +0 -1
- package/dist/stream.lgp.cjs +0 -174
- package/dist/stream.lgp.cjs.map +0 -1
- package/dist/stream.lgp.d.cts +0 -57
- package/dist/stream.lgp.d.cts.map +0 -1
- package/dist/stream.lgp.d.ts +0 -57
- package/dist/stream.lgp.d.ts.map +0 -1
- package/dist/stream.lgp.js +0 -174
- package/dist/stream.lgp.js.map +0 -1
- package/dist/subagents.cjs +0 -76
- package/dist/subagents.cjs.map +0 -1
- package/dist/subagents.js +0 -76
- 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).
|
|
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
|
-
|
|
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
|
|
22
|
+
**Peer dependencies:** `@angular/core` (^18.0.0 – ^21.0.0),
|
|
23
|
+
`@langchain/core` (^1.1.27).
|
|
14
24
|
|
|
15
|
-
## Quick
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
|
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
|
|