@langchain/angular 0.1.3 → 0.3.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.
- package/README.md +275 -16
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/decorate.cjs +9 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/decorate.js +9 -0
- package/dist/context.cjs +94 -0
- package/dist/context.cjs.map +1 -0
- package/dist/context.d.cts +130 -0
- package/dist/context.d.cts.map +1 -0
- package/dist/context.d.ts +130 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +91 -0
- package/dist/context.js.map +1 -0
- package/dist/index.cjs +212 -386
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +317 -16
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +317 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +203 -390
- package/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/channels/base.d.cts +83 -0
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/channels/base.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/channels/base.d.ts +83 -0
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/channels/base.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/constants.d.cts +42 -0
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/constants.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/constants.d.ts +42 -0
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/constants.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/graph/zod/index.d.cts +2 -0
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/graph/zod/index.d.ts +2 -0
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/graph/zod/meta.d.cts +109 -0
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/graph/zod/meta.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/graph/zod/meta.d.ts +109 -0
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/graph/zod/meta.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/graph/zod/plugin.d.cts +31 -0
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/graph/zod/plugin.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/graph/zod/plugin.d.ts +31 -0
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/graph/zod/plugin.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/graph/zod/zod-registry.d.cts +49 -0
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/graph/zod/zod-registry.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/graph/zod/zod-registry.d.ts +49 -0
- package/dist/node_modules/.pnpm/@langchain_langgraph@1.2.1_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27._db5dc2b7d473236f1e1bf7d3e1a7ed18/node_modules/@langchain/langgraph/dist/graph/zod/zod-registry.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/ReactAgent.d.cts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/ReactAgent.d.ts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/index.d.cts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/index.d.ts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/contextEditing.d.cts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/contextEditing.d.ts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/dynamicSystemPrompt.d.cts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/dynamicSystemPrompt.d.ts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/hitl.d.cts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/hitl.d.ts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/llmToolSelector.d.cts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/llmToolSelector.d.ts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/modelCallLimit.d.cts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/modelCallLimit.d.ts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/modelFallback.d.cts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/modelFallback.d.ts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/modelRetry.d.cts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/modelRetry.d.ts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/pii.d.cts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/pii.d.ts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/piiRedaction.d.cts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/piiRedaction.d.ts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/provider/anthropic/promptCaching.d.cts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/provider/anthropic/promptCaching.d.ts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/provider/openai/moderation.d.cts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/provider/openai/moderation.d.ts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/summarization.d.cts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/summarization.d.ts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/todoListMiddleware.d.cts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/todoListMiddleware.d.ts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/toolCallLimit.d.cts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/toolCallLimit.d.ts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/toolEmulator.d.cts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/toolEmulator.d.ts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/toolRetry.d.cts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/toolRetry.d.ts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/types.d.cts +2 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware/types.d.ts +2 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware.d.cts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/middleware.d.ts +1 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/types.d.cts +2 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/agents/types.d.ts +2 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/index.d.cts +2 -0
- package/dist/node_modules/.pnpm/langchain@1.2.30_@langchain_core@1.1.31_@opentelemetry_api@1.9.0_openai@6.27.0_ws@8.19._0520fb05d9e85da5f9e061dfe28cdbc8/node_modules/langchain/dist/index.d.ts +2 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/ZodError.d.cts +155 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/ZodError.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/ZodError.d.ts +155 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/ZodError.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/errorUtil.d.cts +13 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/errorUtil.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/errorUtil.d.ts +13 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/errorUtil.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/parseUtil.d.cts +63 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/parseUtil.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/parseUtil.d.ts +63 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/parseUtil.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/typeAliases.d.cts +5 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/typeAliases.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/typeAliases.d.ts +5 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/typeAliases.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/util.d.cts +64 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/util.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/util.d.ts +64 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/util.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/standard-schema.d.cts +106 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/standard-schema.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/standard-schema.d.ts +106 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/standard-schema.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/types.d.cts +291 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/types.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/types.d.ts +291 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/types.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.d.cts +29 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.d.ts +29 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.d.cts +29 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.d.ts +29 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.d.cts +105 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.d.ts +105 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema.d.cts +70 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema.d.ts +70 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.d.cts +24 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.d.ts +24 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.d.cts +97 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.d.ts +97 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/standard-schema.d.cts +79 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/standard-schema.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/standard-schema.d.ts +79 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/standard-schema.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.d.cts +52 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.d.ts +52 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.d.cts +17 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.d.ts +17 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.d.cts +9 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.d.ts +9 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.d.ts.map +1 -0
- package/dist/stream.custom.cjs +54 -137
- package/dist/stream.custom.cjs.map +1 -1
- package/dist/stream.custom.d.cts +45 -0
- package/dist/stream.custom.d.cts.map +1 -0
- package/dist/stream.custom.d.ts +45 -0
- package/dist/stream.custom.d.ts.map +1 -0
- package/dist/stream.custom.js +55 -139
- package/dist/stream.custom.js.map +1 -1
- package/dist/subagent-types.d.cts +15 -0
- package/dist/subagent-types.d.cts.map +1 -0
- package/dist/subagent-types.d.ts +15 -0
- package/dist/subagent-types.d.ts.map +1 -0
- package/package.json +9 -11
package/dist/index.js
CHANGED
|
@@ -1,389 +1,127 @@
|
|
|
1
|
-
import { useStreamCustom } from "./stream.custom.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { injectStreamCustom, useStreamCustom } from "./stream.custom.js";
|
|
2
|
+
import { STREAM_DEFAULTS, STREAM_INSTANCE, provideStream, provideStreamDefaults } from "./context.js";
|
|
3
|
+
import { __decorate } from "./_virtual/_@oxc-project_runtime@0.115.0/helpers/decorate.js";
|
|
4
|
+
import { Injectable, computed, effect, inject, signal } from "@angular/core";
|
|
5
|
+
import { FetchStreamTransport, StreamOrchestrator, SubagentManager, calculateDepthFromNamespace, ensureMessageInstances, extractParentIdFromNamespace, extractToolCallIdFromNamespace, isSubagentNamespace } from "@langchain/langgraph-sdk/ui";
|
|
4
6
|
import { Client } from "@langchain/langgraph-sdk";
|
|
5
|
-
import { getToolCallsWithResults } from "@langchain/langgraph-sdk/utils";
|
|
6
7
|
//#region src/index.ts
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if ("transport" in options) return
|
|
8
|
+
/**
|
|
9
|
+
* @internal Merges DI, LangGraph Platform, and custom transport overloads.
|
|
10
|
+
*/
|
|
11
|
+
function injectStream(options) {
|
|
12
|
+
if (arguments.length === 0) {
|
|
13
|
+
const instance = inject(STREAM_INSTANCE, { optional: true });
|
|
14
|
+
if (instance == null) throw new Error("injectStream() requires an ancestor component to provide a stream via provideStream(). Add provideStream({ assistantId: '...' }) to the providers array of a parent component, or use injectStream(options) directly.");
|
|
15
|
+
return instance;
|
|
16
|
+
}
|
|
17
|
+
if ("transport" in options) return injectStreamCustom(options);
|
|
17
18
|
return useStreamLGP(options);
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use `injectStream` instead. `useStream` will be removed in a
|
|
22
|
+
* future major version. `injectStream` follows Angular's `inject*` naming
|
|
23
|
+
* convention for injection-based patterns.
|
|
24
|
+
*/
|
|
25
|
+
const useStream = injectStream;
|
|
25
26
|
function useStreamLGP(options) {
|
|
26
|
-
const runMetadataStorage = resolveRunMetadataStorage(options.reconnectOnMount);
|
|
27
|
-
const getMessages = (value) => {
|
|
28
|
-
const messagesKey = options.messagesKey ?? "messages";
|
|
29
|
-
return Array.isArray(value[messagesKey]) ? value[messagesKey] : [];
|
|
30
|
-
};
|
|
31
|
-
const setMessages = (current, messages) => {
|
|
32
|
-
const messagesKey = options.messagesKey ?? "messages";
|
|
33
|
-
return {
|
|
34
|
-
...current,
|
|
35
|
-
[messagesKey]: messages
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
const historyLimit = typeof options.fetchStateHistory === "object" && options.fetchStateHistory != null ? options.fetchStateHistory.limit ?? false : options.fetchStateHistory ?? false;
|
|
39
|
-
const threadId = signal(void 0);
|
|
40
|
-
let threadIdPromise = null;
|
|
41
27
|
const client = options.client ?? new Client({ apiUrl: options.apiUrl });
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
mutate: async () => void 0
|
|
47
|
-
});
|
|
48
|
-
async function mutate(mutateId) {
|
|
49
|
-
const tid = mutateId ?? threadId();
|
|
50
|
-
if (!tid) return void 0;
|
|
51
|
-
try {
|
|
52
|
-
const data = await fetchHistory(client, tid, { limit: historyLimit });
|
|
53
|
-
history.set({
|
|
54
|
-
data,
|
|
55
|
-
error: void 0,
|
|
56
|
-
isLoading: false,
|
|
57
|
-
mutate
|
|
58
|
-
});
|
|
59
|
-
return data;
|
|
60
|
-
} catch (err) {
|
|
61
|
-
history.update((prev) => ({
|
|
62
|
-
...prev,
|
|
63
|
-
error: err,
|
|
64
|
-
isLoading: false
|
|
65
|
-
}));
|
|
66
|
-
options.onError?.(err, void 0);
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
history.update((prev) => ({
|
|
71
|
-
...prev,
|
|
72
|
-
mutate
|
|
73
|
-
}));
|
|
74
|
-
const branch = signal("");
|
|
75
|
-
const branchContext = computed(() => getBranchContext(branch(), history().data ?? void 0));
|
|
76
|
-
const messageManager = new MessageTupleManager();
|
|
77
|
-
const stream = new StreamManager(messageManager, {
|
|
78
|
-
throttle: options.throttle ?? false,
|
|
79
|
-
subagentToolNames: options.subagentToolNames,
|
|
80
|
-
filterSubagentMessages: options.filterSubagentMessages,
|
|
81
|
-
toMessage: toMessageClass
|
|
82
|
-
});
|
|
83
|
-
const pendingRuns = new PendingRunsTracker();
|
|
84
|
-
const queueEntries = signal(pendingRuns.entries);
|
|
85
|
-
const queueSize = signal(pendingRuns.size);
|
|
86
|
-
const historyValues = computed(() => branchContext().threadHead?.values ?? options.initialValues ?? {});
|
|
87
|
-
const historyError = computed(() => {
|
|
88
|
-
const error = branchContext().threadHead?.tasks?.at(-1)?.error;
|
|
89
|
-
if (error == null) return void 0;
|
|
90
|
-
try {
|
|
91
|
-
const parsed = JSON.parse(error);
|
|
92
|
-
if (StreamError.isStructuredError(parsed)) return new StreamError(parsed);
|
|
93
|
-
return parsed;
|
|
94
|
-
} catch {}
|
|
95
|
-
return error;
|
|
28
|
+
const orchestrator = new StreamOrchestrator(options, {
|
|
29
|
+
getClient: () => client,
|
|
30
|
+
getAssistantId: () => options.assistantId,
|
|
31
|
+
getMessagesKey: () => options.messagesKey ?? "messages"
|
|
96
32
|
});
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
const isLoading = signal(stream.isLoading);
|
|
100
|
-
const values = computed(() => streamValues() ?? historyValues());
|
|
101
|
-
const error = computed(() => streamError() ?? historyError() ?? history().error);
|
|
102
|
-
const messageMetadata = computed(() => getMessagesMetadataMap({
|
|
103
|
-
initialValues: options.initialValues,
|
|
104
|
-
history: history().data,
|
|
105
|
-
getMessages,
|
|
106
|
-
branchContext: branchContext()
|
|
107
|
-
}));
|
|
33
|
+
orchestrator.initThreadId(options.threadId ?? void 0);
|
|
34
|
+
const version = signal(0);
|
|
108
35
|
const subagentVersion = signal(0);
|
|
109
36
|
effect((onCleanup) => {
|
|
110
|
-
const unsubscribe =
|
|
111
|
-
|
|
112
|
-
streamError.set(stream.error);
|
|
113
|
-
isLoading.set(stream.isLoading);
|
|
37
|
+
const unsubscribe = orchestrator.subscribe(() => {
|
|
38
|
+
version.update((v) => v + 1);
|
|
114
39
|
subagentVersion.update((v) => v + 1);
|
|
115
40
|
});
|
|
116
41
|
onCleanup(() => unsubscribe());
|
|
117
42
|
});
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
43
|
+
effect((onCleanup) => {
|
|
44
|
+
version();
|
|
45
|
+
const hvMessages = orchestrator.messages;
|
|
46
|
+
if (options.filterSubagentMessages && !orchestrator.isLoading && !orchestrator.historyData.isLoading && hvMessages.length > 0) {
|
|
47
|
+
const controller = orchestrator.reconstructSubagentsIfNeeded();
|
|
48
|
+
if (controller) onCleanup(() => controller.abort());
|
|
49
|
+
}
|
|
121
50
|
});
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
51
|
+
const isLoadingForDrain = computed(() => {
|
|
52
|
+
version();
|
|
53
|
+
return orchestrator.isLoading;
|
|
125
54
|
});
|
|
126
|
-
function stop() {
|
|
127
|
-
return stream.stop(historyValues(), { onStop: (args) => {
|
|
128
|
-
if (runMetadataStorage && threadId()) {
|
|
129
|
-
const tid = threadId();
|
|
130
|
-
const runId = runMetadataStorage.getItem(`lg:stream:${tid}`);
|
|
131
|
-
if (runId) client.runs.cancel(tid, runId);
|
|
132
|
-
runMetadataStorage.removeItem(`lg:stream:${tid}`);
|
|
133
|
-
}
|
|
134
|
-
options.onStop?.(args);
|
|
135
|
-
} });
|
|
136
|
-
}
|
|
137
|
-
function setBranch(value) {
|
|
138
|
-
branch.set(value);
|
|
139
|
-
}
|
|
140
|
-
function submitDirect(values, submitOptions) {
|
|
141
|
-
const currentBranchContext = branchContext();
|
|
142
|
-
const checkpointId = submitOptions?.checkpoint?.checkpoint_id;
|
|
143
|
-
branch.set(checkpointId != null ? currentBranchContext.branchByCheckpoint[checkpointId]?.branch ?? "" : "");
|
|
144
|
-
const includeImplicitBranch = historyLimit === true || typeof historyLimit === "number";
|
|
145
|
-
const shouldRefetch = options.onFinish != null || includeImplicitBranch;
|
|
146
|
-
let checkpoint = submitOptions?.checkpoint ?? (includeImplicitBranch ? currentBranchContext.threadHead?.checkpoint : void 0) ?? void 0;
|
|
147
|
-
if (submitOptions?.checkpoint === null) checkpoint = void 0;
|
|
148
|
-
if (checkpoint != null) delete checkpoint.thread_id;
|
|
149
|
-
const streamResumable = submitOptions?.streamResumable ?? !!runMetadataStorage;
|
|
150
|
-
let callbackMeta;
|
|
151
|
-
let rejoinKey;
|
|
152
|
-
let usableThreadId;
|
|
153
|
-
return stream.start(async (signal) => {
|
|
154
|
-
usableThreadId = threadId();
|
|
155
|
-
if (!usableThreadId) {
|
|
156
|
-
const threadPromise = client.threads.create({
|
|
157
|
-
threadId: submitOptions?.threadId,
|
|
158
|
-
metadata: submitOptions?.metadata
|
|
159
|
-
});
|
|
160
|
-
threadIdPromise = threadPromise.then((t) => t.thread_id);
|
|
161
|
-
usableThreadId = (await threadPromise).thread_id;
|
|
162
|
-
threadId.set(usableThreadId);
|
|
163
|
-
options.onThreadId?.(usableThreadId);
|
|
164
|
-
}
|
|
165
|
-
const streamMode = new Set([
|
|
166
|
-
...submitOptions?.streamMode ?? [],
|
|
167
|
-
"values",
|
|
168
|
-
"messages-tuple",
|
|
169
|
-
"updates"
|
|
170
|
-
]);
|
|
171
|
-
if (options.onUpdateEvent) streamMode.add("updates");
|
|
172
|
-
if (options.onCustomEvent) streamMode.add("custom");
|
|
173
|
-
if (options.onCheckpointEvent) streamMode.add("checkpoints");
|
|
174
|
-
if (options.onTaskEvent) streamMode.add("tasks");
|
|
175
|
-
if ("onDebugEvent" in options && options.onDebugEvent) streamMode.add("debug");
|
|
176
|
-
if ("onLangChainEvent" in options && options.onLangChainEvent) streamMode.add("events");
|
|
177
|
-
stream.setStreamValues(() => {
|
|
178
|
-
const prev = {
|
|
179
|
-
...historyValues(),
|
|
180
|
-
...stream.values
|
|
181
|
-
};
|
|
182
|
-
if (submitOptions?.optimisticValues != null) return {
|
|
183
|
-
...prev,
|
|
184
|
-
...typeof submitOptions.optimisticValues === "function" ? submitOptions.optimisticValues(prev) : submitOptions.optimisticValues
|
|
185
|
-
};
|
|
186
|
-
return { ...prev };
|
|
187
|
-
});
|
|
188
|
-
return client.runs.stream(usableThreadId, options.assistantId, {
|
|
189
|
-
input: values,
|
|
190
|
-
config: submitOptions?.config,
|
|
191
|
-
context: submitOptions?.context,
|
|
192
|
-
command: submitOptions?.command,
|
|
193
|
-
interruptBefore: submitOptions?.interruptBefore,
|
|
194
|
-
interruptAfter: submitOptions?.interruptAfter,
|
|
195
|
-
metadata: submitOptions?.metadata,
|
|
196
|
-
multitaskStrategy: submitOptions?.multitaskStrategy,
|
|
197
|
-
onCompletion: submitOptions?.onCompletion,
|
|
198
|
-
onDisconnect: submitOptions?.onDisconnect ?? (streamResumable ? "continue" : "cancel"),
|
|
199
|
-
signal,
|
|
200
|
-
checkpoint,
|
|
201
|
-
streamMode: [...streamMode],
|
|
202
|
-
streamSubgraphs: submitOptions?.streamSubgraphs,
|
|
203
|
-
streamResumable,
|
|
204
|
-
durability: submitOptions?.durability,
|
|
205
|
-
onRunCreated(params) {
|
|
206
|
-
callbackMeta = {
|
|
207
|
-
run_id: params.run_id,
|
|
208
|
-
thread_id: params.thread_id ?? usableThreadId
|
|
209
|
-
};
|
|
210
|
-
if (runMetadataStorage) {
|
|
211
|
-
rejoinKey = `lg:stream:${usableThreadId}`;
|
|
212
|
-
runMetadataStorage.setItem(rejoinKey, callbackMeta.run_id);
|
|
213
|
-
}
|
|
214
|
-
options.onCreated?.(callbackMeta);
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
}, {
|
|
218
|
-
getMessages,
|
|
219
|
-
setMessages,
|
|
220
|
-
initialValues: historyValues(),
|
|
221
|
-
callbacks: options,
|
|
222
|
-
async onSuccess() {
|
|
223
|
-
if (rejoinKey) runMetadataStorage?.removeItem(rejoinKey);
|
|
224
|
-
if (shouldRefetch && usableThreadId) {
|
|
225
|
-
const lastHead = (await mutate(usableThreadId))?.at(0);
|
|
226
|
-
if (lastHead) {
|
|
227
|
-
options.onFinish?.(lastHead, callbackMeta);
|
|
228
|
-
return null;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
onError: (error) => {
|
|
233
|
-
options.onError?.(error, callbackMeta);
|
|
234
|
-
submitOptions?.onError?.(error, callbackMeta);
|
|
235
|
-
},
|
|
236
|
-
onFinish: () => {}
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
let submitting = false;
|
|
240
|
-
function drainQueue() {
|
|
241
|
-
if (!isLoading() && !submitting && pendingRuns.size > 0) {
|
|
242
|
-
const next = pendingRuns.shift();
|
|
243
|
-
if (next) {
|
|
244
|
-
submitting = true;
|
|
245
|
-
joinStream(next.id).finally(() => {
|
|
246
|
-
submitting = false;
|
|
247
|
-
drainQueue();
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
55
|
effect(() => {
|
|
253
|
-
|
|
56
|
+
isLoadingForDrain();
|
|
57
|
+
orchestrator.drainQueue();
|
|
254
58
|
});
|
|
255
|
-
|
|
256
|
-
if (stream.isLoading || submitting) {
|
|
257
|
-
if (submitOptions?.multitaskStrategy === "interrupt" || submitOptions?.multitaskStrategy === "rollback") {
|
|
258
|
-
submitting = true;
|
|
259
|
-
try {
|
|
260
|
-
await submitDirect(values, submitOptions);
|
|
261
|
-
} finally {
|
|
262
|
-
submitting = false;
|
|
263
|
-
}
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
let usableThreadId = threadId();
|
|
267
|
-
if (!usableThreadId && threadIdPromise) usableThreadId = await threadIdPromise;
|
|
268
|
-
if (usableThreadId) {
|
|
269
|
-
try {
|
|
270
|
-
const run = await client.runs.create(usableThreadId, options.assistantId, {
|
|
271
|
-
input: values,
|
|
272
|
-
config: submitOptions?.config,
|
|
273
|
-
context: submitOptions?.context,
|
|
274
|
-
command: submitOptions?.command,
|
|
275
|
-
interruptBefore: submitOptions?.interruptBefore,
|
|
276
|
-
interruptAfter: submitOptions?.interruptAfter,
|
|
277
|
-
metadata: submitOptions?.metadata,
|
|
278
|
-
multitaskStrategy: "enqueue",
|
|
279
|
-
streamResumable: true,
|
|
280
|
-
streamSubgraphs: submitOptions?.streamSubgraphs,
|
|
281
|
-
durability: submitOptions?.durability
|
|
282
|
-
});
|
|
283
|
-
pendingRuns.add({
|
|
284
|
-
id: run.run_id,
|
|
285
|
-
values,
|
|
286
|
-
options: submitOptions,
|
|
287
|
-
createdAt: new Date(run.created_at)
|
|
288
|
-
});
|
|
289
|
-
} catch (error) {
|
|
290
|
-
options.onError?.(error, void 0);
|
|
291
|
-
submitOptions?.onError?.(error, void 0);
|
|
292
|
-
}
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
submitting = true;
|
|
297
|
-
const result = submitDirect(values, submitOptions);
|
|
298
|
-
Promise.resolve(result).finally(() => {
|
|
299
|
-
submitting = false;
|
|
300
|
-
drainQueue();
|
|
301
|
-
});
|
|
302
|
-
return result;
|
|
303
|
-
}
|
|
304
|
-
async function joinStream(runId, lastEventId, joinOptions) {
|
|
305
|
-
lastEventId ??= "-1";
|
|
306
|
-
const tid = threadId();
|
|
307
|
-
if (!tid) return;
|
|
308
|
-
const callbackMeta = {
|
|
309
|
-
thread_id: tid,
|
|
310
|
-
run_id: runId
|
|
311
|
-
};
|
|
312
|
-
await stream.start(async (signal) => {
|
|
313
|
-
const rawStream = client.runs.joinStream(tid, runId, {
|
|
314
|
-
signal,
|
|
315
|
-
lastEventId,
|
|
316
|
-
streamMode: joinOptions?.streamMode
|
|
317
|
-
});
|
|
318
|
-
return joinOptions?.filter != null ? filterStream(rawStream, joinOptions.filter) : rawStream;
|
|
319
|
-
}, {
|
|
320
|
-
getMessages,
|
|
321
|
-
setMessages,
|
|
322
|
-
initialValues: historyValues(),
|
|
323
|
-
callbacks: options,
|
|
324
|
-
async onSuccess() {
|
|
325
|
-
runMetadataStorage?.removeItem(`lg:stream:${tid}`);
|
|
326
|
-
const lastHead = (await mutate(tid))?.at(0);
|
|
327
|
-
if (lastHead) options.onFinish?.(lastHead, callbackMeta);
|
|
328
|
-
},
|
|
329
|
-
onError(error) {
|
|
330
|
-
options.onError?.(error, callbackMeta);
|
|
331
|
-
},
|
|
332
|
-
onFinish() {}
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
const shouldReconnect = !!runMetadataStorage;
|
|
59
|
+
const { shouldReconnect } = orchestrator;
|
|
336
60
|
let hasReconnected = false;
|
|
337
61
|
effect(() => {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
if (
|
|
342
|
-
hasReconnected = true;
|
|
343
|
-
joinStream(runId);
|
|
344
|
-
}
|
|
62
|
+
version();
|
|
63
|
+
const tid = orchestrator.threadId;
|
|
64
|
+
if (!hasReconnected && shouldReconnect && tid && !orchestrator.isLoading) {
|
|
65
|
+
if (orchestrator.tryReconnect()) hasReconnected = true;
|
|
345
66
|
}
|
|
346
67
|
});
|
|
347
|
-
const
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
return
|
|
351
|
-
}
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
68
|
+
const values = computed(() => {
|
|
69
|
+
version();
|
|
70
|
+
orchestrator.trackStreamMode("values");
|
|
71
|
+
return orchestrator.values;
|
|
72
|
+
});
|
|
73
|
+
const error = computed(() => {
|
|
74
|
+
version();
|
|
75
|
+
return orchestrator.error;
|
|
76
|
+
});
|
|
77
|
+
const isLoading = signal(orchestrator.isLoading);
|
|
78
|
+
effect(() => {
|
|
79
|
+
version();
|
|
80
|
+
isLoading.set(orchestrator.isLoading);
|
|
81
|
+
});
|
|
82
|
+
const branch = signal("");
|
|
83
|
+
effect(() => {
|
|
84
|
+
version();
|
|
85
|
+
const b = orchestrator.branch;
|
|
86
|
+
if (branch() !== b) branch.set(b);
|
|
87
|
+
});
|
|
88
|
+
const messages = computed(() => {
|
|
89
|
+
version();
|
|
90
|
+
orchestrator.trackStreamMode("messages-tuple", "values");
|
|
91
|
+
return ensureMessageInstances(orchestrator.messages);
|
|
92
|
+
});
|
|
93
|
+
const toolCalls = computed(() => {
|
|
94
|
+
version();
|
|
95
|
+
orchestrator.trackStreamMode("messages-tuple", "values");
|
|
96
|
+
return orchestrator.toolCalls;
|
|
97
|
+
});
|
|
98
|
+
const interrupt = computed(() => {
|
|
99
|
+
version();
|
|
100
|
+
return orchestrator.interrupt;
|
|
101
|
+
});
|
|
357
102
|
const interrupts = computed(() => {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
const valueInterrupts = vals.__interrupt__;
|
|
361
|
-
if (valueInterrupts.length === 0) return [{ when: "breakpoint" }];
|
|
362
|
-
return valueInterrupts;
|
|
363
|
-
}
|
|
364
|
-
if (isLoading()) return [];
|
|
365
|
-
const allInterrupts = (branchContext().threadHead?.tasks ?? []).flatMap((t) => t.interrupts ?? []);
|
|
366
|
-
if (allInterrupts.length > 0) return allInterrupts;
|
|
367
|
-
if (!(branchContext().threadHead?.next ?? []).length || error() != null) return [];
|
|
368
|
-
return [{ when: "breakpoint" }];
|
|
103
|
+
version();
|
|
104
|
+
return orchestrator.interrupts;
|
|
369
105
|
});
|
|
370
106
|
const historyList = computed(() => {
|
|
371
|
-
|
|
372
|
-
return
|
|
107
|
+
version();
|
|
108
|
+
return orchestrator.flatHistory;
|
|
109
|
+
});
|
|
110
|
+
const isThreadLoading = computed(() => {
|
|
111
|
+
version();
|
|
112
|
+
return orchestrator.isThreadLoading;
|
|
373
113
|
});
|
|
374
|
-
const isThreadLoading = computed(() => history().isLoading && history().data == null);
|
|
375
114
|
const experimentalBranchTree = computed(() => {
|
|
376
|
-
|
|
377
|
-
return
|
|
115
|
+
version();
|
|
116
|
+
return orchestrator.experimental_branchTree;
|
|
117
|
+
});
|
|
118
|
+
const queueEntries = signal(orchestrator.queueEntries);
|
|
119
|
+
const queueSize = signal(orchestrator.queueSize);
|
|
120
|
+
effect(() => {
|
|
121
|
+
version();
|
|
122
|
+
queueEntries.set(orchestrator.queueEntries);
|
|
123
|
+
queueSize.set(orchestrator.queueSize);
|
|
378
124
|
});
|
|
379
|
-
function getMessagesMetadata(message, index) {
|
|
380
|
-
const streamMetadata = messageManager.get(message.id)?.metadata;
|
|
381
|
-
const historyMetadata = messageMetadata().find((m) => m.messageId === (message.id ?? index));
|
|
382
|
-
if (streamMetadata != null || historyMetadata != null) return {
|
|
383
|
-
...historyMetadata,
|
|
384
|
-
streamMetadata
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
125
|
return {
|
|
388
126
|
assistantId: options.assistantId,
|
|
389
127
|
client,
|
|
@@ -391,64 +129,139 @@ function useStreamLGP(options) {
|
|
|
391
129
|
error,
|
|
392
130
|
isLoading,
|
|
393
131
|
branch,
|
|
394
|
-
setBranch
|
|
132
|
+
setBranch(value) {
|
|
133
|
+
orchestrator.setBranch(value);
|
|
134
|
+
},
|
|
395
135
|
messages,
|
|
396
136
|
toolCalls,
|
|
397
|
-
getToolCalls
|
|
137
|
+
getToolCalls(message) {
|
|
138
|
+
return orchestrator.getToolCalls(message);
|
|
139
|
+
},
|
|
398
140
|
interrupt,
|
|
399
141
|
interrupts,
|
|
400
142
|
history: historyList,
|
|
401
143
|
isThreadLoading,
|
|
402
144
|
experimental_branchTree: experimentalBranchTree,
|
|
403
|
-
getMessagesMetadata,
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
145
|
+
getMessagesMetadata(message, index) {
|
|
146
|
+
return orchestrator.getMessagesMetadata(message, index);
|
|
147
|
+
},
|
|
148
|
+
submit: (values, submitOptions) => orchestrator.submit(values, submitOptions),
|
|
149
|
+
stop: () => orchestrator.stop(),
|
|
150
|
+
joinStream: (...args) => orchestrator.joinStream(...args),
|
|
407
151
|
queue: {
|
|
408
152
|
entries: queueEntries,
|
|
409
153
|
size: queueSize,
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
const removed = pendingRuns.remove(id);
|
|
413
|
-
if (removed && tid) await client.runs.cancel(tid, id);
|
|
414
|
-
return removed;
|
|
415
|
-
},
|
|
416
|
-
async clear() {
|
|
417
|
-
const tid = threadId();
|
|
418
|
-
const removed = pendingRuns.removeAll();
|
|
419
|
-
if (tid && removed.length > 0) await Promise.all(removed.map((e) => client.runs.cancel(tid, e.id)));
|
|
420
|
-
}
|
|
154
|
+
cancel: (id) => orchestrator.cancelQueueItem(id),
|
|
155
|
+
clear: () => orchestrator.clearQueue()
|
|
421
156
|
},
|
|
422
157
|
switchThread(newThreadId) {
|
|
423
|
-
|
|
424
|
-
const prevThreadId = threadId();
|
|
425
|
-
threadId.set(newThreadId ?? void 0);
|
|
426
|
-
stream.clear();
|
|
427
|
-
const removed = pendingRuns.removeAll();
|
|
428
|
-
if (prevThreadId && removed.length > 0) Promise.all(removed.map((e) => client.runs.cancel(prevThreadId, e.id)));
|
|
429
|
-
if (newThreadId != null) options.onThreadId?.(newThreadId);
|
|
430
|
-
}
|
|
158
|
+
orchestrator.switchThread(newThreadId);
|
|
431
159
|
},
|
|
432
160
|
get subagents() {
|
|
433
161
|
subagentVersion();
|
|
434
|
-
return
|
|
162
|
+
return orchestrator.subagents;
|
|
435
163
|
},
|
|
436
164
|
get activeSubagents() {
|
|
437
165
|
subagentVersion();
|
|
438
|
-
return
|
|
166
|
+
return orchestrator.activeSubagents;
|
|
439
167
|
},
|
|
440
168
|
getSubagent(toolCallId) {
|
|
441
|
-
return
|
|
169
|
+
return orchestrator.getSubagent(toolCallId);
|
|
442
170
|
},
|
|
443
171
|
getSubagentsByType(type) {
|
|
444
|
-
return
|
|
172
|
+
return orchestrator.getSubagentsByType(type);
|
|
445
173
|
},
|
|
446
174
|
getSubagentsByMessage(messageId) {
|
|
447
|
-
return
|
|
175
|
+
return orchestrator.getSubagentsByMessage(messageId);
|
|
448
176
|
}
|
|
449
177
|
};
|
|
450
178
|
}
|
|
179
|
+
let StreamService = class StreamService {
|
|
180
|
+
_stream;
|
|
181
|
+
constructor(options) {
|
|
182
|
+
this._stream = injectStream(options);
|
|
183
|
+
}
|
|
184
|
+
get values() {
|
|
185
|
+
return this._stream.values;
|
|
186
|
+
}
|
|
187
|
+
get messages() {
|
|
188
|
+
return this._stream.messages;
|
|
189
|
+
}
|
|
190
|
+
get isLoading() {
|
|
191
|
+
return this._stream.isLoading;
|
|
192
|
+
}
|
|
193
|
+
get error() {
|
|
194
|
+
return this._stream.error;
|
|
195
|
+
}
|
|
196
|
+
get branch() {
|
|
197
|
+
return this._stream.branch;
|
|
198
|
+
}
|
|
199
|
+
get interrupt() {
|
|
200
|
+
return this._stream.interrupt;
|
|
201
|
+
}
|
|
202
|
+
get interrupts() {
|
|
203
|
+
return this._stream.interrupts;
|
|
204
|
+
}
|
|
205
|
+
get toolCalls() {
|
|
206
|
+
return this._stream.toolCalls;
|
|
207
|
+
}
|
|
208
|
+
get queue() {
|
|
209
|
+
return this._stream.queue;
|
|
210
|
+
}
|
|
211
|
+
get subagents() {
|
|
212
|
+
return this._stream.subagents;
|
|
213
|
+
}
|
|
214
|
+
get activeSubagents() {
|
|
215
|
+
return this._stream.activeSubagents;
|
|
216
|
+
}
|
|
217
|
+
get history() {
|
|
218
|
+
return this._stream.history;
|
|
219
|
+
}
|
|
220
|
+
get isThreadLoading() {
|
|
221
|
+
return this._stream.isThreadLoading;
|
|
222
|
+
}
|
|
223
|
+
get experimental_branchTree() {
|
|
224
|
+
return this._stream.experimental_branchTree;
|
|
225
|
+
}
|
|
226
|
+
get client() {
|
|
227
|
+
return this._stream.client;
|
|
228
|
+
}
|
|
229
|
+
get assistantId() {
|
|
230
|
+
return this._stream.assistantId;
|
|
231
|
+
}
|
|
232
|
+
submit(values, options) {
|
|
233
|
+
return this._stream.submit(values, options);
|
|
234
|
+
}
|
|
235
|
+
async stop() {
|
|
236
|
+
await this._stream.stop();
|
|
237
|
+
}
|
|
238
|
+
setBranch(value) {
|
|
239
|
+
this._stream.setBranch(value);
|
|
240
|
+
}
|
|
241
|
+
switchThread(newThreadId) {
|
|
242
|
+
this._stream.switchThread(newThreadId);
|
|
243
|
+
}
|
|
244
|
+
joinStream(runId, lastEventId, options) {
|
|
245
|
+
return this._stream.joinStream(runId, lastEventId, options);
|
|
246
|
+
}
|
|
247
|
+
getMessagesMetadata(message, index) {
|
|
248
|
+
return this._stream.getMessagesMetadata(message, index);
|
|
249
|
+
}
|
|
250
|
+
getToolCalls(message) {
|
|
251
|
+
return this._stream.getToolCalls(message);
|
|
252
|
+
}
|
|
253
|
+
getSubagent(toolCallId) {
|
|
254
|
+
return this._stream.getSubagent(toolCallId);
|
|
255
|
+
}
|
|
256
|
+
getSubagentsByType(type) {
|
|
257
|
+
return this._stream.getSubagentsByType(type);
|
|
258
|
+
}
|
|
259
|
+
getSubagentsByMessage(messageId) {
|
|
260
|
+
return this._stream.getSubagentsByMessage(messageId);
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
StreamService = __decorate([Injectable()], StreamService);
|
|
451
264
|
//#endregion
|
|
452
|
-
export { FetchStreamTransport, SubagentManager, calculateDepthFromNamespace, extractParentIdFromNamespace, extractToolCallIdFromNamespace, isSubagentNamespace, useStream, useStreamLGP };
|
|
265
|
+
export { FetchStreamTransport, STREAM_DEFAULTS, STREAM_INSTANCE, StreamService, SubagentManager, calculateDepthFromNamespace, extractParentIdFromNamespace, extractToolCallIdFromNamespace, injectStream, injectStreamCustom, isSubagentNamespace, provideStream, provideStreamDefaults, useStream, useStreamCustom, useStreamLGP };
|
|
453
266
|
|
|
454
267
|
//# sourceMappingURL=index.js.map
|