@relkit/langchain 0.0.0-stage → 0.7.11
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/LICENSE +21 -0
- package/README.md +48 -2
- package/dist/client-contract-metadata.d.ts +31 -0
- package/dist/client-contract-metadata.d.ts.map +1 -0
- package/dist/client-contract-metadata.js +129 -0
- package/dist/client-contract-metadata.js.map +1 -0
- package/dist/client-contract-metadata.types.d.ts +59 -0
- package/dist/client-contract-metadata.types.d.ts.map +1 -0
- package/dist/client-contract-metadata.types.js +3 -0
- package/dist/client-contract-metadata.types.js.map +1 -0
- package/dist/client-contract-schema.d.ts +66 -0
- package/dist/client-contract-schema.d.ts.map +1 -0
- package/dist/client-contract-schema.js +153 -0
- package/dist/client-contract-schema.js.map +1 -0
- package/dist/continuation-validation.d.ts +9 -0
- package/dist/continuation-validation.d.ts.map +1 -0
- package/dist/continuation-validation.js +9 -0
- package/dist/continuation-validation.js.map +1 -0
- package/dist/deepagent-bucket-backend.d.ts +33 -0
- package/dist/deepagent-bucket-backend.d.ts.map +1 -0
- package/dist/deepagent-bucket-backend.js +47 -0
- package/dist/deepagent-bucket-backend.js.map +1 -0
- package/dist/deepagent-bucket-backend.types.d.ts +6 -0
- package/dist/deepagent-bucket-backend.types.d.ts.map +1 -0
- package/dist/deepagent-bucket-backend.types.js +2 -0
- package/dist/deepagent-bucket-backend.types.js.map +1 -0
- package/dist/deepagent-bucket-client.types.d.ts +25 -0
- package/dist/deepagent-bucket-client.types.d.ts.map +1 -0
- package/dist/deepagent-bucket-client.types.js +3 -0
- package/dist/deepagent-bucket-client.types.js.map +1 -0
- package/dist/deepagent-bucket-delete.d.ts +28 -0
- package/dist/deepagent-bucket-delete.d.ts.map +1 -0
- package/dist/deepagent-bucket-delete.js +64 -0
- package/dist/deepagent-bucket-delete.js.map +1 -0
- package/dist/deepagent-bucket-error.d.ts +17 -0
- package/dist/deepagent-bucket-error.d.ts.map +1 -0
- package/dist/deepagent-bucket-error.js +17 -0
- package/dist/deepagent-bucket-error.js.map +1 -0
- package/dist/deepagent-bucket-file-data.d.ts +40 -0
- package/dist/deepagent-bucket-file-data.d.ts.map +1 -0
- package/dist/deepagent-bucket-file-data.js +115 -0
- package/dist/deepagent-bucket-file-data.js.map +1 -0
- package/dist/deepagent-bucket-file-index.d.ts +34 -0
- package/dist/deepagent-bucket-file-index.d.ts.map +1 -0
- package/dist/deepagent-bucket-file-index.js +82 -0
- package/dist/deepagent-bucket-file-index.js.map +1 -0
- package/dist/deepagent-bucket-files.d.ts +5 -0
- package/dist/deepagent-bucket-files.d.ts.map +1 -0
- package/dist/deepagent-bucket-files.js +4 -0
- package/dist/deepagent-bucket-files.js.map +1 -0
- package/dist/deepagent-bucket-files.types.d.ts +8 -0
- package/dist/deepagent-bucket-files.types.d.ts.map +1 -0
- package/dist/deepagent-bucket-files.types.js +3 -0
- package/dist/deepagent-bucket-files.types.js.map +1 -0
- package/dist/deepagent-bucket-format.d.ts +59 -0
- package/dist/deepagent-bucket-format.d.ts.map +1 -0
- package/dist/deepagent-bucket-format.js +72 -0
- package/dist/deepagent-bucket-format.js.map +1 -0
- package/dist/deepagent-bucket-glob.d.ts +26 -0
- package/dist/deepagent-bucket-glob.d.ts.map +1 -0
- package/dist/deepagent-bucket-glob.js +66 -0
- package/dist/deepagent-bucket-glob.js.map +1 -0
- package/dist/deepagent-bucket-grep.d.ts +32 -0
- package/dist/deepagent-bucket-grep.d.ts.map +1 -0
- package/dist/deepagent-bucket-grep.js +73 -0
- package/dist/deepagent-bucket-grep.js.map +1 -0
- package/dist/deepagent-bucket-path.d.ts +67 -0
- package/dist/deepagent-bucket-path.d.ts.map +1 -0
- package/dist/deepagent-bucket-path.js +121 -0
- package/dist/deepagent-bucket-path.js.map +1 -0
- package/dist/deepagent-bucket-read.d.ts +65 -0
- package/dist/deepagent-bucket-read.d.ts.map +1 -0
- package/dist/deepagent-bucket-read.js +77 -0
- package/dist/deepagent-bucket-read.js.map +1 -0
- package/dist/deepagent-bucket-scope.d.ts +43 -0
- package/dist/deepagent-bucket-scope.d.ts.map +1 -0
- package/dist/deepagent-bucket-scope.js +40 -0
- package/dist/deepagent-bucket-scope.js.map +1 -0
- package/dist/deepagent-bucket-search.d.ts +22 -0
- package/dist/deepagent-bucket-search.d.ts.map +1 -0
- package/dist/deepagent-bucket-search.js +60 -0
- package/dist/deepagent-bucket-search.js.map +1 -0
- package/dist/deepagent-bucket-service.d.ts +17 -0
- package/dist/deepagent-bucket-service.d.ts.map +1 -0
- package/dist/deepagent-bucket-service.js +16 -0
- package/dist/deepagent-bucket-service.js.map +1 -0
- package/dist/deepagent-bucket-transfer.d.ts +52 -0
- package/dist/deepagent-bucket-transfer.d.ts.map +1 -0
- package/dist/deepagent-bucket-transfer.js +73 -0
- package/dist/deepagent-bucket-transfer.js.map +1 -0
- package/dist/deepagent-bucket-write.d.ts +55 -0
- package/dist/deepagent-bucket-write.d.ts.map +1 -0
- package/dist/deepagent-bucket-write.js +88 -0
- package/dist/deepagent-bucket-write.js.map +1 -0
- package/dist/define-agent-build.d.ts +12 -0
- package/dist/define-agent-build.d.ts.map +1 -0
- package/dist/define-agent-build.js +60 -0
- package/dist/define-agent-build.js.map +1 -0
- package/dist/define-agent-deep.d.ts +30 -0
- package/dist/define-agent-deep.d.ts.map +1 -0
- package/dist/define-agent-deep.js +125 -0
- package/dist/define-agent-deep.js.map +1 -0
- package/dist/define-agent-deep.types.d.ts +23 -0
- package/dist/define-agent-deep.types.d.ts.map +1 -0
- package/dist/define-agent-deep.types.js +3 -0
- package/dist/define-agent-deep.types.js.map +1 -0
- package/dist/define-agent-native-middleware.d.ts +34 -0
- package/dist/define-agent-native-middleware.d.ts.map +1 -0
- package/dist/define-agent-native-middleware.js +83 -0
- package/dist/define-agent-native-middleware.js.map +1 -0
- package/dist/define-agent-native-model.d.ts +16 -0
- package/dist/define-agent-native-model.d.ts.map +1 -0
- package/dist/define-agent-native-model.js +23 -0
- package/dist/define-agent-native-model.js.map +1 -0
- package/dist/define-agent-native-tools.d.ts +30 -0
- package/dist/define-agent-native-tools.d.ts.map +1 -0
- package/dist/define-agent-native-tools.js +72 -0
- package/dist/define-agent-native-tools.js.map +1 -0
- package/dist/define-agent-native.d.ts +6 -0
- package/dist/define-agent-native.d.ts.map +1 -0
- package/dist/define-agent-native.js +5 -0
- package/dist/define-agent-native.js.map +1 -0
- package/dist/define-agent-native.types.d.ts +36 -0
- package/dist/define-agent-native.types.d.ts.map +1 -0
- package/dist/define-agent-native.types.js +3 -0
- package/dist/define-agent-native.types.js.map +1 -0
- package/dist/define-agent-validation.d.ts +45 -0
- package/dist/define-agent-validation.d.ts.map +1 -0
- package/dist/define-agent-validation.js +92 -0
- package/dist/define-agent-validation.js.map +1 -0
- package/dist/define-agent.d.ts +41 -0
- package/dist/define-agent.d.ts.map +1 -0
- package/dist/define-agent.js +59 -0
- package/dist/define-agent.js.map +1 -0
- package/dist/define-agent.types.d.ts +54 -0
- package/dist/define-agent.types.d.ts.map +1 -0
- package/dist/define-agent.types.js +3 -0
- package/dist/define-agent.types.js.map +1 -0
- package/dist/define-graph-build.d.ts +12 -0
- package/dist/define-graph-build.d.ts.map +1 -0
- package/dist/define-graph-build.js +86 -0
- package/dist/define-graph-build.js.map +1 -0
- package/dist/define-graph-error.d.ts +17 -0
- package/dist/define-graph-error.d.ts.map +1 -0
- package/dist/define-graph-error.js +17 -0
- package/dist/define-graph-error.js.map +1 -0
- package/dist/define-graph-node.d.ts +42 -0
- package/dist/define-graph-node.d.ts.map +1 -0
- package/dist/define-graph-node.js +97 -0
- package/dist/define-graph-node.js.map +1 -0
- package/dist/define-graph-node.types.d.ts +38 -0
- package/dist/define-graph-node.types.d.ts.map +1 -0
- package/dist/define-graph-node.types.js +3 -0
- package/dist/define-graph-node.types.js.map +1 -0
- package/dist/define-graph.d.ts +44 -0
- package/dist/define-graph.d.ts.map +1 -0
- package/dist/define-graph.js +72 -0
- package/dist/define-graph.js.map +1 -0
- package/dist/define-graph.types.d.ts +69 -0
- package/dist/define-graph.types.d.ts.map +1 -0
- package/dist/define-graph.types.js +3 -0
- package/dist/define-graph.types.js.map +1 -0
- package/dist/define-persistence-guards.d.ts +32 -0
- package/dist/define-persistence-guards.d.ts.map +1 -0
- package/dist/define-persistence-guards.js +55 -0
- package/dist/define-persistence-guards.js.map +1 -0
- package/dist/define-persistence.d.ts +33 -0
- package/dist/define-persistence.d.ts.map +1 -0
- package/dist/define-persistence.js +112 -0
- package/dist/define-persistence.js.map +1 -0
- package/dist/define-persistence.types.d.ts +30 -0
- package/dist/define-persistence.types.d.ts.map +1 -0
- package/dist/define-persistence.types.js +3 -0
- package/dist/define-persistence.types.js.map +1 -0
- package/dist/graph-compile-error.d.ts +17 -0
- package/dist/graph-compile-error.d.ts.map +1 -0
- package/dist/graph-compile-error.js +17 -0
- package/dist/graph-compile-error.js.map +1 -0
- package/dist/graph-compile.d.ts +32 -0
- package/dist/graph-compile.d.ts.map +1 -0
- package/dist/graph-compile.js +94 -0
- package/dist/graph-compile.js.map +1 -0
- package/dist/graph-continuation-error.d.ts +17 -0
- package/dist/graph-continuation-error.d.ts.map +1 -0
- package/dist/graph-continuation-error.js +17 -0
- package/dist/graph-continuation-error.js.map +1 -0
- package/dist/graph-continuation-validation.d.ts +22 -0
- package/dist/graph-continuation-validation.d.ts.map +1 -0
- package/dist/graph-continuation-validation.js +67 -0
- package/dist/graph-continuation-validation.js.map +1 -0
- package/dist/graph-continuation-waiting.d.ts +23 -0
- package/dist/graph-continuation-waiting.d.ts.map +1 -0
- package/dist/graph-continuation-waiting.js +53 -0
- package/dist/graph-continuation-waiting.js.map +1 -0
- package/dist/graph-continuation.d.ts +43 -0
- package/dist/graph-continuation.d.ts.map +1 -0
- package/dist/graph-continuation.js +82 -0
- package/dist/graph-continuation.js.map +1 -0
- package/dist/graph-continuation.types.d.ts +11 -0
- package/dist/graph-continuation.types.d.ts.map +1 -0
- package/dist/graph-continuation.types.js +3 -0
- package/dist/graph-continuation.types.js.map +1 -0
- package/dist/graph-definition.d.ts +36 -0
- package/dist/graph-definition.d.ts.map +1 -0
- package/dist/graph-definition.js +90 -0
- package/dist/graph-definition.js.map +1 -0
- package/dist/graph-edge-destinations.d.ts +42 -0
- package/dist/graph-edge-destinations.d.ts.map +1 -0
- package/dist/graph-edge-destinations.js +100 -0
- package/dist/graph-edge-destinations.js.map +1 -0
- package/dist/graph-edge-mutations.d.ts +19 -0
- package/dist/graph-edge-mutations.d.ts.map +1 -0
- package/dist/graph-edge-mutations.js +62 -0
- package/dist/graph-edge-mutations.js.map +1 -0
- package/dist/graph-edge-mutations.types.d.ts +9 -0
- package/dist/graph-edge-mutations.types.d.ts.map +1 -0
- package/dist/graph-edge-mutations.types.js +2 -0
- package/dist/graph-edge-mutations.types.js.map +1 -0
- package/dist/graph-edges.d.ts +24 -0
- package/dist/graph-edges.d.ts.map +1 -0
- package/dist/graph-edges.js +37 -0
- package/dist/graph-edges.js.map +1 -0
- package/dist/graph-edges.types.d.ts +47 -0
- package/dist/graph-edges.types.d.ts.map +1 -0
- package/dist/graph-edges.types.js +3 -0
- package/dist/graph-edges.types.js.map +1 -0
- package/dist/graph-execution-symbol.d.ts +3 -0
- package/dist/graph-execution-symbol.d.ts.map +1 -0
- package/dist/graph-execution-symbol.js +3 -0
- package/dist/graph-execution-symbol.js.map +1 -0
- package/dist/graph-interruption.d.ts +84 -0
- package/dist/graph-interruption.d.ts.map +1 -0
- package/dist/graph-interruption.js +119 -0
- package/dist/graph-interruption.js.map +1 -0
- package/dist/graph-interruption.types.d.ts +16 -0
- package/dist/graph-interruption.types.d.ts.map +1 -0
- package/dist/graph-interruption.types.js +3 -0
- package/dist/graph-interruption.types.js.map +1 -0
- package/dist/graph-node-schema-validation.d.ts +9 -0
- package/dist/graph-node-schema-validation.d.ts.map +1 -0
- package/dist/graph-node-schema-validation.js +16 -0
- package/dist/graph-node-schema-validation.js.map +1 -0
- package/dist/graph-node-symbol.d.ts +3 -0
- package/dist/graph-node-symbol.d.ts.map +1 -0
- package/dist/graph-node-symbol.js +3 -0
- package/dist/graph-node-symbol.js.map +1 -0
- package/dist/graph-node-validation-error.d.ts +17 -0
- package/dist/graph-node-validation-error.d.ts.map +1 -0
- package/dist/graph-node-validation-error.js +17 -0
- package/dist/graph-node-validation-error.js.map +1 -0
- package/dist/graph-node-validation-value.d.ts +64 -0
- package/dist/graph-node-validation-value.d.ts.map +1 -0
- package/dist/graph-node-validation-value.js +117 -0
- package/dist/graph-node-validation-value.js.map +1 -0
- package/dist/graph-node-validation.d.ts +65 -0
- package/dist/graph-node-validation.d.ts.map +1 -0
- package/dist/graph-node-validation.js +113 -0
- package/dist/graph-node-validation.js.map +1 -0
- package/dist/graph-persistence-release.d.ts +16 -0
- package/dist/graph-persistence-release.d.ts.map +1 -0
- package/dist/graph-persistence-release.js +43 -0
- package/dist/graph-persistence-release.js.map +1 -0
- package/dist/graph-persistence.d.ts +39 -0
- package/dist/graph-persistence.d.ts.map +1 -0
- package/dist/graph-persistence.js +111 -0
- package/dist/graph-persistence.js.map +1 -0
- package/dist/graph-persistence.types.d.ts +21 -0
- package/dist/graph-persistence.types.d.ts.map +1 -0
- package/dist/graph-persistence.types.js +3 -0
- package/dist/graph-persistence.types.js.map +1 -0
- package/dist/graph-runtime-error.d.ts +17 -0
- package/dist/graph-runtime-error.d.ts.map +1 -0
- package/dist/graph-runtime-error.js +17 -0
- package/dist/graph-runtime-error.js.map +1 -0
- package/dist/graph-runtime-execution.d.ts +28 -0
- package/dist/graph-runtime-execution.d.ts.map +1 -0
- package/dist/graph-runtime-execution.js +69 -0
- package/dist/graph-runtime-execution.js.map +1 -0
- package/dist/graph-runtime-identity.d.ts +15 -0
- package/dist/graph-runtime-identity.d.ts.map +1 -0
- package/dist/graph-runtime-identity.js +14 -0
- package/dist/graph-runtime-identity.js.map +1 -0
- package/dist/graph-runtime-identity.types.d.ts +5 -0
- package/dist/graph-runtime-identity.types.d.ts.map +1 -0
- package/dist/graph-runtime-identity.types.js +2 -0
- package/dist/graph-runtime-identity.types.js.map +1 -0
- package/dist/graph-runtime-stream-state.d.ts +8 -0
- package/dist/graph-runtime-stream-state.d.ts.map +1 -0
- package/dist/graph-runtime-stream-state.js +67 -0
- package/dist/graph-runtime-stream-state.js.map +1 -0
- package/dist/graph-runtime-stream.d.ts +16 -0
- package/dist/graph-runtime-stream.d.ts.map +1 -0
- package/dist/graph-runtime-stream.js +49 -0
- package/dist/graph-runtime-stream.js.map +1 -0
- package/dist/graph-runtime-stream.types.d.ts +13 -0
- package/dist/graph-runtime-stream.types.d.ts.map +1 -0
- package/dist/graph-runtime-stream.types.js +2 -0
- package/dist/graph-runtime-stream.types.js.map +1 -0
- package/dist/graph-runtime.d.ts +21 -0
- package/dist/graph-runtime.d.ts.map +1 -0
- package/dist/graph-runtime.js +74 -0
- package/dist/graph-runtime.js.map +1 -0
- package/dist/graph-runtime.types.d.ts +8 -0
- package/dist/graph-runtime.types.d.ts.map +1 -0
- package/dist/graph-runtime.types.js +3 -0
- package/dist/graph-runtime.types.js.map +1 -0
- package/dist/graph-state-schema.d.ts +35 -0
- package/dist/graph-state-schema.d.ts.map +1 -0
- package/dist/graph-state-schema.js +65 -0
- package/dist/graph-state-schema.js.map +1 -0
- package/dist/graph-subgraph-symbol.d.ts +5 -0
- package/dist/graph-subgraph-symbol.d.ts.map +1 -0
- package/dist/graph-subgraph-symbol.js +5 -0
- package/dist/graph-subgraph-symbol.js.map +1 -0
- package/dist/graph-subgraph.d.ts +46 -0
- package/dist/graph-subgraph.d.ts.map +1 -0
- package/dist/graph-subgraph.js +82 -0
- package/dist/graph-subgraph.js.map +1 -0
- package/dist/graph-subgraph.types.d.ts +20 -0
- package/dist/graph-subgraph.types.d.ts.map +1 -0
- package/dist/graph-subgraph.types.js +3 -0
- package/dist/graph-subgraph.types.js.map +1 -0
- package/dist/graph-workflow-error.d.ts +17 -0
- package/dist/graph-workflow-error.d.ts.map +1 -0
- package/dist/graph-workflow-error.js +17 -0
- package/dist/graph-workflow-error.js.map +1 -0
- package/dist/graph-workflow.d.ts +37 -0
- package/dist/graph-workflow.d.ts.map +1 -0
- package/dist/graph-workflow.js +86 -0
- package/dist/graph-workflow.js.map +1 -0
- package/dist/graph-workflow.types.d.ts +41 -0
- package/dist/graph-workflow.types.d.ts.map +1 -0
- package/dist/graph-workflow.types.js +3 -0
- package/dist/graph-workflow.types.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/native-agent-interruption-error.d.ts +17 -0
- package/dist/native-agent-interruption-error.d.ts.map +1 -0
- package/dist/native-agent-interruption-error.js +17 -0
- package/dist/native-agent-interruption-error.js.map +1 -0
- package/dist/native-agent-interruption-schema.d.ts +66 -0
- package/dist/native-agent-interruption-schema.d.ts.map +1 -0
- package/dist/native-agent-interruption-schema.js +141 -0
- package/dist/native-agent-interruption-schema.js.map +1 -0
- package/dist/native-agent-interruption-schema.types.d.ts +16 -0
- package/dist/native-agent-interruption-schema.types.d.ts.map +1 -0
- package/dist/native-agent-interruption-schema.types.js +3 -0
- package/dist/native-agent-interruption-schema.types.js.map +1 -0
- package/dist/native-agent-interruption-validation.d.ts +19 -0
- package/dist/native-agent-interruption-validation.d.ts.map +1 -0
- package/dist/native-agent-interruption-validation.js +107 -0
- package/dist/native-agent-interruption-validation.js.map +1 -0
- package/dist/native-agent-interruption.d.ts +55 -0
- package/dist/native-agent-interruption.d.ts.map +1 -0
- package/dist/native-agent-interruption.js +85 -0
- package/dist/native-agent-interruption.js.map +1 -0
- package/dist/native-agent-interruption.types.d.ts +5 -0
- package/dist/native-agent-interruption.types.d.ts.map +1 -0
- package/dist/native-agent-interruption.types.js +2 -0
- package/dist/native-agent-interruption.types.js.map +1 -0
- package/dist/persistence-error.d.ts +17 -0
- package/dist/persistence-error.d.ts.map +1 -0
- package/dist/persistence-error.js +17 -0
- package/dist/persistence-error.js.map +1 -0
- package/dist/persistence-symbol.d.ts +3 -0
- package/dist/persistence-symbol.d.ts.map +1 -0
- package/dist/persistence-symbol.js +3 -0
- package/dist/persistence-symbol.js.map +1 -0
- package/dist/runtime-approval-decision.d.ts +13 -0
- package/dist/runtime-approval-decision.d.ts.map +1 -0
- package/dist/runtime-approval-decision.js +21 -0
- package/dist/runtime-approval-decision.js.map +1 -0
- package/dist/runtime-dependencies.d.ts +7 -0
- package/dist/runtime-dependencies.d.ts.map +1 -0
- package/dist/runtime-dependencies.js +10 -0
- package/dist/runtime-dependencies.js.map +1 -0
- package/dist/runtime-effect-error.d.ts +18 -0
- package/dist/runtime-effect-error.d.ts.map +1 -0
- package/dist/runtime-effect-error.js +19 -0
- package/dist/runtime-effect-error.js.map +1 -0
- package/dist/runtime-errors.d.ts +11 -0
- package/dist/runtime-errors.d.ts.map +1 -0
- package/dist/runtime-errors.js +15 -0
- package/dist/runtime-errors.js.map +1 -0
- package/dist/runtime-failure-diagnostics.d.ts +10 -0
- package/dist/runtime-failure-diagnostics.d.ts.map +1 -0
- package/dist/runtime-failure-diagnostics.js +61 -0
- package/dist/runtime-failure-diagnostics.js.map +1 -0
- package/dist/runtime-integration.d.ts +10 -0
- package/dist/runtime-integration.d.ts.map +1 -0
- package/dist/runtime-integration.js +9 -0
- package/dist/runtime-integration.js.map +1 -0
- package/dist/runtime-invoke.d.ts +27 -0
- package/dist/runtime-invoke.d.ts.map +1 -0
- package/dist/runtime-invoke.js +77 -0
- package/dist/runtime-invoke.js.map +1 -0
- package/dist/runtime-loop-context.types.d.ts +22 -0
- package/dist/runtime-loop-context.types.d.ts.map +1 -0
- package/dist/runtime-loop-context.types.js +2 -0
- package/dist/runtime-loop-context.types.js.map +1 -0
- package/dist/runtime-loop-execution.d.ts +4 -0
- package/dist/runtime-loop-execution.d.ts.map +1 -0
- package/dist/runtime-loop-execution.js +61 -0
- package/dist/runtime-loop-execution.js.map +1 -0
- package/dist/runtime-loop-state.d.ts +13 -0
- package/dist/runtime-loop-state.d.ts.map +1 -0
- package/dist/runtime-loop-state.js +57 -0
- package/dist/runtime-loop-state.js.map +1 -0
- package/dist/runtime-loop-telemetry.d.ts +5 -0
- package/dist/runtime-loop-telemetry.d.ts.map +1 -0
- package/dist/runtime-loop-telemetry.js +62 -0
- package/dist/runtime-loop-telemetry.js.map +1 -0
- package/dist/runtime-loop-values.d.ts +52 -0
- package/dist/runtime-loop-values.d.ts.map +1 -0
- package/dist/runtime-loop-values.js +85 -0
- package/dist/runtime-loop-values.js.map +1 -0
- package/dist/runtime-loop.d.ts +36 -0
- package/dist/runtime-loop.d.ts.map +1 -0
- package/dist/runtime-loop.js +45 -0
- package/dist/runtime-loop.js.map +1 -0
- package/dist/runtime-loop.types.d.ts +8 -0
- package/dist/runtime-loop.types.d.ts.map +1 -0
- package/dist/runtime-loop.types.js +3 -0
- package/dist/runtime-loop.types.js.map +1 -0
- package/dist/runtime-model-error.d.ts +17 -0
- package/dist/runtime-model-error.d.ts.map +1 -0
- package/dist/runtime-model-error.js +17 -0
- package/dist/runtime-model-error.js.map +1 -0
- package/dist/runtime-model.d.ts +31 -0
- package/dist/runtime-model.d.ts.map +1 -0
- package/dist/runtime-model.js +126 -0
- package/dist/runtime-model.js.map +1 -0
- package/dist/runtime-model.types.d.ts +22 -0
- package/dist/runtime-model.types.d.ts.map +1 -0
- package/dist/runtime-model.types.js +3 -0
- package/dist/runtime-model.types.js.map +1 -0
- package/dist/runtime-native-agent-build.d.ts +40 -0
- package/dist/runtime-native-agent-build.d.ts.map +1 -0
- package/dist/runtime-native-agent-build.js +77 -0
- package/dist/runtime-native-agent-build.js.map +1 -0
- package/dist/runtime-native-agent.d.ts +30 -0
- package/dist/runtime-native-agent.d.ts.map +1 -0
- package/dist/runtime-native-agent.js +84 -0
- package/dist/runtime-native-agent.js.map +1 -0
- package/dist/runtime-native-agent.types.d.ts +21 -0
- package/dist/runtime-native-agent.types.d.ts.map +1 -0
- package/dist/runtime-native-agent.types.js +3 -0
- package/dist/runtime-native-agent.types.js.map +1 -0
- package/dist/runtime-native-event-tools.d.ts +28 -0
- package/dist/runtime-native-event-tools.d.ts.map +1 -0
- package/dist/runtime-native-event-tools.js +88 -0
- package/dist/runtime-native-event-tools.js.map +1 -0
- package/dist/runtime-native-events-helpers.d.ts +30 -0
- package/dist/runtime-native-events-helpers.d.ts.map +1 -0
- package/dist/runtime-native-events-helpers.js +74 -0
- package/dist/runtime-native-events-helpers.js.map +1 -0
- package/dist/runtime-native-events.d.ts +45 -0
- package/dist/runtime-native-events.d.ts.map +1 -0
- package/dist/runtime-native-events.js +89 -0
- package/dist/runtime-native-events.js.map +1 -0
- package/dist/runtime-native-limits.d.ts +18 -0
- package/dist/runtime-native-limits.d.ts.map +1 -0
- package/dist/runtime-native-limits.js +59 -0
- package/dist/runtime-native-limits.js.map +1 -0
- package/dist/runtime-native-messages.d.ts +24 -0
- package/dist/runtime-native-messages.d.ts.map +1 -0
- package/dist/runtime-native-messages.js +83 -0
- package/dist/runtime-native-messages.js.map +1 -0
- package/dist/runtime-native-messages.types.d.ts +7 -0
- package/dist/runtime-native-messages.types.d.ts.map +1 -0
- package/dist/runtime-native-messages.types.js +2 -0
- package/dist/runtime-native-messages.types.js.map +1 -0
- package/dist/runtime-native-public-state.d.ts +22 -0
- package/dist/runtime-native-public-state.d.ts.map +1 -0
- package/dist/runtime-native-public-state.js +44 -0
- package/dist/runtime-native-public-state.js.map +1 -0
- package/dist/runtime-native-public-tools.d.ts +15 -0
- package/dist/runtime-native-public-tools.d.ts.map +1 -0
- package/dist/runtime-native-public-tools.js +39 -0
- package/dist/runtime-native-public-tools.js.map +1 -0
- package/dist/runtime-native-public.d.ts +28 -0
- package/dist/runtime-native-public.d.ts.map +1 -0
- package/dist/runtime-native-public.js +165 -0
- package/dist/runtime-native-public.js.map +1 -0
- package/dist/runtime-native-public.types.d.ts +5 -0
- package/dist/runtime-native-public.types.d.ts.map +1 -0
- package/dist/runtime-native-public.types.js +3 -0
- package/dist/runtime-native-public.types.js.map +1 -0
- package/dist/runtime-native-response-format.d.ts +15 -0
- package/dist/runtime-native-response-format.d.ts.map +1 -0
- package/dist/runtime-native-response-format.js +46 -0
- package/dist/runtime-native-response-format.js.map +1 -0
- package/dist/runtime-native-subagents.d.ts +47 -0
- package/dist/runtime-native-subagents.d.ts.map +1 -0
- package/dist/runtime-native-subagents.js +50 -0
- package/dist/runtime-native-subagents.js.map +1 -0
- package/dist/runtime-native-subagents.types.d.ts +7 -0
- package/dist/runtime-native-subagents.types.d.ts.map +1 -0
- package/dist/runtime-native-subagents.types.js +2 -0
- package/dist/runtime-native-subagents.types.js.map +1 -0
- package/dist/runtime-native-support.d.ts +67 -0
- package/dist/runtime-native-support.d.ts.map +1 -0
- package/dist/runtime-native-support.js +112 -0
- package/dist/runtime-native-support.js.map +1 -0
- package/dist/runtime-native-support.types.d.ts +9 -0
- package/dist/runtime-native-support.types.d.ts.map +1 -0
- package/dist/runtime-native-support.types.js +2 -0
- package/dist/runtime-native-support.types.js.map +1 -0
- package/dist/runtime-native-tool-build.d.ts +12 -0
- package/dist/runtime-native-tool-build.d.ts.map +1 -0
- package/dist/runtime-native-tool-build.js +81 -0
- package/dist/runtime-native-tool-build.js.map +1 -0
- package/dist/runtime-native-tool-build.types.d.ts +14 -0
- package/dist/runtime-native-tool-build.types.d.ts.map +1 -0
- package/dist/runtime-native-tool-build.types.js +2 -0
- package/dist/runtime-native-tool-build.types.js.map +1 -0
- package/dist/runtime-native-tools-identity.d.ts +15 -0
- package/dist/runtime-native-tools-identity.d.ts.map +1 -0
- package/dist/runtime-native-tools-identity.js +14 -0
- package/dist/runtime-native-tools-identity.js.map +1 -0
- package/dist/runtime-native-tools.d.ts +29 -0
- package/dist/runtime-native-tools.d.ts.map +1 -0
- package/dist/runtime-native-tools.js +65 -0
- package/dist/runtime-native-tools.js.map +1 -0
- package/dist/runtime-native-tools.types.d.ts +21 -0
- package/dist/runtime-native-tools.types.d.ts.map +1 -0
- package/dist/runtime-native-tools.types.js +3 -0
- package/dist/runtime-native-tools.types.js.map +1 -0
- package/dist/runtime-service.d.ts +15 -0
- package/dist/runtime-service.d.ts.map +1 -0
- package/dist/runtime-service.js +20 -0
- package/dist/runtime-service.js.map +1 -0
- package/dist/runtime-service.types.d.ts +12 -0
- package/dist/runtime-service.types.d.ts.map +1 -0
- package/dist/runtime-service.types.js +3 -0
- package/dist/runtime-service.types.js.map +1 -0
- package/dist/runtime-state-schemas.d.ts +19 -0
- package/dist/runtime-state-schemas.d.ts.map +1 -0
- package/dist/runtime-state-schemas.js +58 -0
- package/dist/runtime-state-schemas.js.map +1 -0
- package/dist/runtime-strict-response-schema.d.ts +9 -0
- package/dist/runtime-strict-response-schema.d.ts.map +1 -0
- package/dist/runtime-strict-response-schema.js +67 -0
- package/dist/runtime-strict-response-schema.js.map +1 -0
- package/dist/runtime-tool-adapter.d.ts +34 -0
- package/dist/runtime-tool-adapter.d.ts.map +1 -0
- package/dist/runtime-tool-adapter.js +66 -0
- package/dist/runtime-tool-adapter.js.map +1 -0
- package/dist/runtime-tool-dispatcher.d.ts +32 -0
- package/dist/runtime-tool-dispatcher.d.ts.map +1 -0
- package/dist/runtime-tool-dispatcher.js +67 -0
- package/dist/runtime-tool-dispatcher.js.map +1 -0
- package/dist/runtime-tool-events.d.ts +49 -0
- package/dist/runtime-tool-events.d.ts.map +1 -0
- package/dist/runtime-tool-events.js +106 -0
- package/dist/runtime-tool-events.js.map +1 -0
- package/dist/runtime-tool-events.types.d.ts +8 -0
- package/dist/runtime-tool-events.types.d.ts.map +1 -0
- package/dist/runtime-tool-events.types.js +3 -0
- package/dist/runtime-tool-events.types.js.map +1 -0
- package/dist/runtime-tool-invocation.d.ts +19 -0
- package/dist/runtime-tool-invocation.d.ts.map +1 -0
- package/dist/runtime-tool-invocation.js +74 -0
- package/dist/runtime-tool-invocation.js.map +1 -0
- package/dist/runtime-tool-lookup.d.ts +56 -0
- package/dist/runtime-tool-lookup.d.ts.map +1 -0
- package/dist/runtime-tool-lookup.js +71 -0
- package/dist/runtime-tool-lookup.js.map +1 -0
- package/dist/runtime-tools.d.ts +35 -0
- package/dist/runtime-tools.d.ts.map +1 -0
- package/dist/runtime-tools.js +78 -0
- package/dist/runtime-tools.js.map +1 -0
- package/dist/runtime-tools.types.d.ts +7 -0
- package/dist/runtime-tools.types.d.ts.map +1 -0
- package/dist/runtime-tools.types.js +2 -0
- package/dist/runtime-tools.types.js.map +1 -0
- package/dist/runtime-utils.d.ts +56 -0
- package/dist/runtime-utils.d.ts.map +1 -0
- package/dist/runtime-utils.js +106 -0
- package/dist/runtime-utils.js.map +1 -0
- package/dist/runtime.d.ts +47 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +90 -0
- package/dist/runtime.js.map +1 -0
- package/dist/runtime.types.d.ts +77 -0
- package/dist/runtime.types.d.ts.map +1 -0
- package/dist/runtime.types.js +3 -0
- package/dist/runtime.types.js.map +1 -0
- package/dist/signal-deadline.d.ts +12 -0
- package/dist/signal-deadline.d.ts.map +1 -0
- package/dist/signal-deadline.js +21 -0
- package/dist/signal-deadline.js.map +1 -0
- package/dist/signal.d.ts +64 -0
- package/dist/signal.d.ts.map +1 -0
- package/dist/signal.js +136 -0
- package/dist/signal.js.map +1 -0
- package/dist/signal.types.d.ts +35 -0
- package/dist/signal.types.d.ts.map +1 -0
- package/dist/signal.types.js +3 -0
- package/dist/signal.types.js.map +1 -0
- package/dist/testing/agent-approvals.d.ts +8 -0
- package/dist/testing/agent-approvals.d.ts.map +1 -0
- package/dist/testing/agent-approvals.js +98 -0
- package/dist/testing/agent-approvals.js.map +1 -0
- package/dist/testing/agent-approvals.types.d.ts +24 -0
- package/dist/testing/agent-approvals.types.d.ts.map +1 -0
- package/dist/testing/agent-approvals.types.js +3 -0
- package/dist/testing/agent-approvals.types.js.map +1 -0
- package/dist/testing/agent-harness.types.d.ts +25 -0
- package/dist/testing/agent-harness.types.d.ts.map +1 -0
- package/dist/testing/agent-harness.types.js +3 -0
- package/dist/testing/agent-harness.types.js.map +1 -0
- package/dist/testing/agent-state-invocation.d.ts +4 -0
- package/dist/testing/agent-state-invocation.d.ts.map +1 -0
- package/dist/testing/agent-state-invocation.js +41 -0
- package/dist/testing/agent-state-invocation.js.map +1 -0
- package/dist/testing/agent-state-lifecycle.d.ts +6 -0
- package/dist/testing/agent-state-lifecycle.d.ts.map +1 -0
- package/dist/testing/agent-state-lifecycle.js +36 -0
- package/dist/testing/agent-state-lifecycle.js.map +1 -0
- package/dist/testing/agent-state-setup.d.ts +18 -0
- package/dist/testing/agent-state-setup.d.ts.map +1 -0
- package/dist/testing/agent-state-setup.js +52 -0
- package/dist/testing/agent-state-setup.js.map +1 -0
- package/dist/testing/agent-state.d.ts +12 -0
- package/dist/testing/agent-state.d.ts.map +1 -0
- package/dist/testing/agent-state.js +40 -0
- package/dist/testing/agent-state.js.map +1 -0
- package/dist/testing/agents-model-native.d.ts +37 -0
- package/dist/testing/agents-model-native.d.ts.map +1 -0
- package/dist/testing/agents-model-native.js +111 -0
- package/dist/testing/agents-model-native.js.map +1 -0
- package/dist/testing/agents-model-operations.d.ts +28 -0
- package/dist/testing/agents-model-operations.d.ts.map +1 -0
- package/dist/testing/agents-model-operations.js +91 -0
- package/dist/testing/agents-model-operations.js.map +1 -0
- package/dist/testing/agents-model.d.ts +25 -0
- package/dist/testing/agents-model.d.ts.map +1 -0
- package/dist/testing/agents-model.js +72 -0
- package/dist/testing/agents-model.js.map +1 -0
- package/dist/testing/agents-model.types.d.ts +24 -0
- package/dist/testing/agents-model.types.d.ts.map +1 -0
- package/dist/testing/agents-model.types.js +3 -0
- package/dist/testing/agents-model.types.js.map +1 -0
- package/dist/testing/agents-types.d.ts +3 -0
- package/dist/testing/agents-types.d.ts.map +1 -0
- package/dist/testing/agents-types.js +2 -0
- package/dist/testing/agents-types.js.map +1 -0
- package/dist/testing/agents-utils.d.ts +26 -0
- package/dist/testing/agents-utils.d.ts.map +1 -0
- package/dist/testing/agents-utils.js +79 -0
- package/dist/testing/agents-utils.js.map +1 -0
- package/dist/testing/agents.d.ts +26 -0
- package/dist/testing/agents.d.ts.map +1 -0
- package/dist/testing/agents.js +64 -0
- package/dist/testing/agents.js.map +1 -0
- package/dist/testing/agents.types.d.ts +113 -0
- package/dist/testing/agents.types.d.ts.map +1 -0
- package/dist/testing/agents.types.js +3 -0
- package/dist/testing/agents.types.js.map +1 -0
- package/package.json +191 -4
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Translates native graph execution failures into the RELKIT graph error boundary while preserving their original causes. */
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
/** Tagged graph invocation failure with the original runtime cause. */
|
|
4
|
+
export class GraphInvocationFailure extends Schema.TaggedError()("GraphInvocationFailure", { message: Schema.String, cause: Schema.Unknown }) {
|
|
5
|
+
}
|
|
6
|
+
/** Preserves a graph invocation failure for Effect callers.
|
|
7
|
+
* @param cause - Graph, schema, provider, or cancellation error.
|
|
8
|
+
* @returns A tagged graph invocation failure.
|
|
9
|
+
* @example graphInvocationFailure(new Error("graph failed"));
|
|
10
|
+
*/
|
|
11
|
+
export function graphInvocationFailure(cause) {
|
|
12
|
+
return new GraphInvocationFailure({
|
|
13
|
+
message: cause instanceof Error ? cause.message : String(cause),
|
|
14
|
+
cause,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=graph-runtime-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-runtime-error.js","sourceRoot":"","sources":["../src/graph-runtime-error.ts"],"names":[],"mappings":"AAAA,8HAA8H;AAE9H,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,uEAAuE;AACvE,MAAM,OAAO,sBAAuB,SAAQ,MAAM,CAAC,WAAW,EAA0B,CACtF,wBAAwB,EACxB,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,EAAE,CAClD;CAAG;AAEJ;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAc;IACnD,OAAO,IAAI,sBAAsB,CAAC;QAChC,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;QAC/D,KAAK;KACN,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Runs a compiled graph within the invocation context, coordinating input, continuation and persistence before projecting final output. */
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import { GraphInvocationFailure } from "./graph-runtime-error.js";
|
|
4
|
+
import type { GraphRuntimeOptions } from "./graph-runtime.types.js";
|
|
5
|
+
/** Runs one compiled graph with persistence and a linked invocation scope.
|
|
6
|
+
* @param options - Graph and runtime integrations.
|
|
7
|
+
* @param input - Validated invocation input.
|
|
8
|
+
* @param signal - Invocation cancellation signal.
|
|
9
|
+
* @param invocationId - Stable invocation identity.
|
|
10
|
+
* @param traceId - Trace identity.
|
|
11
|
+
* @param maxOutputBytes - Output byte cap.
|
|
12
|
+
* @returns An Effect with graph output or GraphInvocationFailure.
|
|
13
|
+
* @example await Effect.runPromise(runCompiledGraphEffect(options, input, signal, id, trace, 1024));
|
|
14
|
+
*/
|
|
15
|
+
export declare const runCompiledGraphEffect: (options: GraphRuntimeOptions, input: unknown, signal: AbortSignal, invocationId: string, traceId: string, maxOutputBytes: number) => Effect.Effect<import("@relkit/contracts").JsonValue, GraphInvocationFailure, never>;
|
|
16
|
+
/** Runs a compiled graph for existing Promise callers.
|
|
17
|
+
* @param options - Graph and runtime integrations.
|
|
18
|
+
* @param input - Validated invocation input.
|
|
19
|
+
* @param signal - Invocation cancellation signal.
|
|
20
|
+
* @param invocationId - Stable invocation identity.
|
|
21
|
+
* @param traceId - Trace identity.
|
|
22
|
+
* @param maxOutputBytes - Output byte cap.
|
|
23
|
+
* @returns Validated graph output or a waiting interruption.
|
|
24
|
+
* @throws The original graph, persistence, output, or cancellation error.
|
|
25
|
+
* @example await runCompiledGraph(options, input, signal, id, trace, 1024);
|
|
26
|
+
*/
|
|
27
|
+
export declare function runCompiledGraph(options: GraphRuntimeOptions, input: unknown, signal: AbortSignal, invocationId: string, traceId: string, maxOutputBytes: number): Promise<unknown>;
|
|
28
|
+
//# sourceMappingURL=graph-runtime-execution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-runtime-execution.d.ts","sourceRoot":"","sources":["../src/graph-runtime-execution.ts"],"names":[],"mappings":"AAAA,4IAA4I;AAG5I,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,OAAO,EAAE,sBAAsB,EAA0B,MAAM,0BAA0B,CAAC;AAE1F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAKpE;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,2NAiDlC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,mBAAmB,EAC5B,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,WAAW,EACnB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,OAAO,CAAC,CASlB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/** Runs a compiled graph within the invocation context, coordinating input, continuation and persistence before projecting final output. */
|
|
2
|
+
import { currentInvocationScope, runInInvocationScope } from "@relkit/invocation";
|
|
3
|
+
import { Effect } from "effect";
|
|
4
|
+
import { observeAgent } from "@relkit/agents/internal/agent-telemetry";
|
|
5
|
+
import { compileGraphEffect } from "./graph-compile.js";
|
|
6
|
+
import { graphConfigEffect } from "./graph-continuation.js";
|
|
7
|
+
import { resolveGraphPersistenceEffect } from "./graph-persistence.js";
|
|
8
|
+
import { GraphInvocationFailure, graphInvocationFailure } from "./graph-runtime-error.js";
|
|
9
|
+
import { streamCompiledGraphEffect } from "./graph-runtime-stream.js";
|
|
10
|
+
import { graphWorkflowRequiresPersistenceEffect } from "./graph-workflow.js";
|
|
11
|
+
import { createAgentInvocationDispatcherEffect } from "./runtime-tool-dispatcher.js";
|
|
12
|
+
import { signalFailure } from "./signal.js";
|
|
13
|
+
/** Runs one compiled graph with persistence and a linked invocation scope.
|
|
14
|
+
* @param options - Graph and runtime integrations.
|
|
15
|
+
* @param input - Validated invocation input.
|
|
16
|
+
* @param signal - Invocation cancellation signal.
|
|
17
|
+
* @param invocationId - Stable invocation identity.
|
|
18
|
+
* @param traceId - Trace identity.
|
|
19
|
+
* @param maxOutputBytes - Output byte cap.
|
|
20
|
+
* @returns An Effect with graph output or GraphInvocationFailure.
|
|
21
|
+
* @example await Effect.runPromise(runCompiledGraphEffect(options, input, signal, id, trace, 1024));
|
|
22
|
+
*/
|
|
23
|
+
export const runCompiledGraphEffect = Effect.fn("Agents.graph.runCompiled")(function* (options, input, signal, invocationId, traceId, maxOutputBytes) {
|
|
24
|
+
if (signal.aborted)
|
|
25
|
+
return yield* Effect.fail(graphInvocationFailure(signalFailure(signal)));
|
|
26
|
+
const persistence = yield* runnableGraphPersistenceEffect(options);
|
|
27
|
+
const graph = yield* compileGraphEffect(options.agent, persistence).pipe(Effect.mapError((failure) => graphInvocationFailure(failure.cause)));
|
|
28
|
+
const config = yield* graphConfigEffect(options.agent, options.threadId).pipe(Effect.mapError((failure) => graphInvocationFailure(failure.cause)));
|
|
29
|
+
const current = yield* Effect.sync(() => currentInvocationScope());
|
|
30
|
+
const dispatcher = current?.dispatcher ??
|
|
31
|
+
(yield* createAgentInvocationDispatcherEffect(options.engine, options, invocationId, traceId, options.parentSpanId, signal));
|
|
32
|
+
return yield* Effect.tryPromise({
|
|
33
|
+
try: (effectSignal) => {
|
|
34
|
+
const combined = AbortSignal.any([signal, effectSignal]);
|
|
35
|
+
const scope = current === undefined
|
|
36
|
+
? { dispatcher, parent: { id: invocationId, traceId, signal: combined } }
|
|
37
|
+
: current;
|
|
38
|
+
return Promise.resolve(runInInvocationScope(scope, () => Effect.runPromise(streamCompiledGraphEffect(options, graph, config, input, combined, maxOutputBytes), { signal: combined })));
|
|
39
|
+
},
|
|
40
|
+
catch: (cause) => graphInvocationFailure(cause instanceof GraphInvocationFailure ? cause.cause : cause),
|
|
41
|
+
});
|
|
42
|
+
}, (effect) => observeAgent("graph.run-compiled", effect));
|
|
43
|
+
/** Runs a compiled graph for existing Promise callers.
|
|
44
|
+
* @param options - Graph and runtime integrations.
|
|
45
|
+
* @param input - Validated invocation input.
|
|
46
|
+
* @param signal - Invocation cancellation signal.
|
|
47
|
+
* @param invocationId - Stable invocation identity.
|
|
48
|
+
* @param traceId - Trace identity.
|
|
49
|
+
* @param maxOutputBytes - Output byte cap.
|
|
50
|
+
* @returns Validated graph output or a waiting interruption.
|
|
51
|
+
* @throws The original graph, persistence, output, or cancellation error.
|
|
52
|
+
* @example await runCompiledGraph(options, input, signal, id, trace, 1024);
|
|
53
|
+
*/
|
|
54
|
+
export function runCompiledGraph(options, input, signal, invocationId, traceId, maxOutputBytes) {
|
|
55
|
+
return Effect.runPromise(runCompiledGraphEffect(options, input, signal, invocationId, traceId, maxOutputBytes).pipe(Effect.catchTag("GraphInvocationFailure", (failure) => Effect.fail(signal.aborted ? signalFailure(signal) : failure.cause))), { signal });
|
|
56
|
+
}
|
|
57
|
+
/** Requires a checkpointer when graph nodes declare resumable waiting.
|
|
58
|
+
* @param options - Native graph and environment bindings.
|
|
59
|
+
* @returns Resolved persistence or the original graph failure.
|
|
60
|
+
*/
|
|
61
|
+
const runnableGraphPersistenceEffect = Effect.fn("Agents.graph.runnablePersistence")(function* (options) {
|
|
62
|
+
const persistence = yield* resolveGraphPersistenceEffect(options.agent, options.environment ?? {}).pipe(Effect.mapError((failure) => graphInvocationFailure(failure.cause)));
|
|
63
|
+
if (persistence.checkpointer === undefined &&
|
|
64
|
+
(yield* graphWorkflowRequiresPersistenceEffect(options.agent.workflow))) {
|
|
65
|
+
return yield* Effect.fail(graphInvocationFailure(new TypeError("Graphs with resumable nodes require a checkpointer")));
|
|
66
|
+
}
|
|
67
|
+
return persistence;
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=graph-runtime-execution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-runtime-execution.js","sourceRoot":"","sources":["../src/graph-runtime-execution.ts"],"names":[],"mappings":"AAAA,4IAA4I;AAE5I,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,EAAE,sCAAsC,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,qCAAqC,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,EAAE,CAAC,0BAA0B,CAAC,CACzE,QAAQ,CAAC,EACP,OAA4B,EAC5B,KAAc,EACd,MAAmB,EACnB,YAAoB,EACpB,OAAe,EACf,cAAsB;IAEtB,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC7F,MAAM,WAAW,GAAG,KAAK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IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,sBAAsB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC5E,IACE,WAAW,CAAC,YAAY,KAAK,SAAS;QACtC,CAAC,KAAK,CAAC,CAAC,sCAAsC,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EACvE,CAAC;QACD,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CACvB,sBAAsB,CAAC,IAAI,SAAS,CAAC,oDAAoD,CAAC,CAAC,CAC5F,CAAC;IACJ,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Derives graph invocation, thread and checkpoint identity used consistently by native execution and persisted continuation lookup. */
|
|
2
|
+
import { Context, Layer } from "effect";
|
|
3
|
+
import type { GraphInvocationIdentityService } from "./graph-runtime-identity.types.js";
|
|
4
|
+
declare const GraphInvocationIdentity_base: Context.ServiceClass<GraphInvocationIdentity, "relkit/agents/GraphInvocationIdentity", GraphInvocationIdentityService>;
|
|
5
|
+
/** Substitutable random source for graph invocation IDs.
|
|
6
|
+
* @example Effect.provide(invokeGraphEffect(options), GraphInvocationIdentityLive);
|
|
7
|
+
*/
|
|
8
|
+
export declare class GraphInvocationIdentity extends GraphInvocationIdentity_base {
|
|
9
|
+
}
|
|
10
|
+
/** Live graph invocation identity source.
|
|
11
|
+
* @example Effect.runPromise(Effect.provide(invokeGraphEffect(options), GraphInvocationIdentityLive));
|
|
12
|
+
*/
|
|
13
|
+
export declare const GraphInvocationIdentityLive: Layer.Layer<GraphInvocationIdentity, never, never>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=graph-runtime-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-runtime-identity.d.ts","sourceRoot":"","sources":["../src/graph-runtime-identity.ts"],"names":[],"mappings":"AAAA,wIAAwI;AAExI,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;;AAExF;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,4BAGD;CAAG;AAE/C;;GAEG;AACH,eAAO,MAAM,2BAA2B,oDAEtC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Derives graph invocation, thread and checkpoint identity used consistently by native execution and persisted continuation lookup. */
|
|
2
|
+
import { Context, Layer } from "effect";
|
|
3
|
+
/** Substitutable random source for graph invocation IDs.
|
|
4
|
+
* @example Effect.provide(invokeGraphEffect(options), GraphInvocationIdentityLive);
|
|
5
|
+
*/
|
|
6
|
+
export class GraphInvocationIdentity extends Context.Service()("relkit/agents/GraphInvocationIdentity") {
|
|
7
|
+
}
|
|
8
|
+
/** Live graph invocation identity source.
|
|
9
|
+
* @example Effect.runPromise(Effect.provide(invokeGraphEffect(options), GraphInvocationIdentityLive));
|
|
10
|
+
*/
|
|
11
|
+
export const GraphInvocationIdentityLive = Layer.succeed(GraphInvocationIdentity, {
|
|
12
|
+
randomUUID: () => crypto.randomUUID(),
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=graph-runtime-identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-runtime-identity.js","sourceRoot":"","sources":["../src/graph-runtime-identity.ts"],"names":[],"mappings":"AAAA,wIAAwI;AAExI,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAGxC;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,OAAO,CAAC,OAAO,EAGzD,CAAC,uCAAuC,CAAC;CAAG;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,CAAC,OAAO,CAAC,uBAAuB,EAAE;IAChF,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE;CACtC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-runtime-identity.types.d.ts","sourceRoot":"","sources":["../src/graph-runtime-identity.types.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,UAAU,EAAE,MAAM,MAAM,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-runtime-identity.types.js","sourceRoot":"","sources":["../src/graph-runtime-identity.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { CompiledGraphStreamContext } from "./graph-runtime-stream.types.js";
|
|
3
|
+
/** Collects the original native events before settling public graph state.
|
|
4
|
+
* @param context - Already acquired stream, graph and cancellation owner.
|
|
5
|
+
* @returns Validated output or the same interruption/failure.
|
|
6
|
+
*/
|
|
7
|
+
export declare const collectCompiledGraphStateEffect: (context: CompiledGraphStreamContext) => Effect.Effect<import("@relkit/contracts").JsonValue, import("./graph-runtime-error.js").GraphInvocationFailure, never>;
|
|
8
|
+
//# sourceMappingURL=graph-runtime-stream-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-runtime-stream-state.d.ts","sourceRoot":"","sources":["../src/graph-runtime-stream-state.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAahC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAElF;;;GAGG;AACH,eAAO,MAAM,+BAA+B,iKA2B1C,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collects graph state, waiting requests and validated output from an already
|
|
3
|
+
* acquired native stream. Its caller retains stream abort/finalization ownership.
|
|
4
|
+
*/
|
|
5
|
+
import { isInterrupted } from "@langchain/langgraph";
|
|
6
|
+
import { Effect } from "effect";
|
|
7
|
+
import { graphExecutionEffect } from "./define-graph.js";
|
|
8
|
+
import { waitingInterruptsEffect } from "./graph-continuation.js";
|
|
9
|
+
import { GraphInterruptedError, graphWaitingResponse, publicWaitingRequests, } from "./graph-interruption.js";
|
|
10
|
+
import { graphInvocationFailure } from "./graph-runtime-error.js";
|
|
11
|
+
import { collectNativeEventsEffect } from "./runtime-native-events.js";
|
|
12
|
+
import { selectedStateSchemasEffect } from "./runtime-state-schemas.js";
|
|
13
|
+
import { jsonValueEffect, validateValueEffect } from "./runtime-utils.js";
|
|
14
|
+
import { withSignal } from "./signal.js";
|
|
15
|
+
/** Collects the original native events before settling public graph state.
|
|
16
|
+
* @param context - Already acquired stream, graph and cancellation owner.
|
|
17
|
+
* @returns Validated output or the same interruption/failure.
|
|
18
|
+
*/
|
|
19
|
+
export const collectCompiledGraphStateEffect = Effect.fn("Agents.graph.collectStream")(function* (context) {
|
|
20
|
+
const { options, graph, config, signal, run } = context;
|
|
21
|
+
const execution = yield* graphExecutionEffect(options.agent);
|
|
22
|
+
const stateSchemas = yield* selectedStateSchemasEffect([execution.state], options.agent.client?.state ?? []).pipe(Effect.mapError((failure) => graphInvocationFailure(failure.cause)));
|
|
23
|
+
yield* collectNativeEventsEffect(run, options.contentSink, new Map(), new Set(), signal, options.agent.limits, stateSchemas, () => undefined, undefined, (reason) => run.abort(reason), options.agent.client?.events).pipe(Effect.mapError((failure) => graphInvocationFailure(failure.cause)));
|
|
24
|
+
const state = yield* Effect.tryPromise({
|
|
25
|
+
try: () => withSignal(run.output, signal),
|
|
26
|
+
catch: graphInvocationFailure,
|
|
27
|
+
});
|
|
28
|
+
return yield* settleCompiledGraphStateEffect(context, state);
|
|
29
|
+
});
|
|
30
|
+
/** Emits waiting data or final validated state using the original byte limits.
|
|
31
|
+
* @param context - Existing graph execution owner.
|
|
32
|
+
* @param state - Native final graph state awaiting validation.
|
|
33
|
+
* @returns Validated output or graph interruption.
|
|
34
|
+
*/
|
|
35
|
+
const settleCompiledGraphStateEffect = Effect.fn("Agents.graph.settleStream")(function* (context, state) {
|
|
36
|
+
const { options, signal, maxOutputBytes } = context;
|
|
37
|
+
if (isInterrupted(state))
|
|
38
|
+
return yield* emitCompiledGraphWaitingEffect(context);
|
|
39
|
+
const validated = yield* validateValueEffect(options.agent.output, state, "output").pipe(Effect.mapError((failure) => graphInvocationFailure(failure.cause)));
|
|
40
|
+
const output = yield* jsonValueEffect(validated, maxOutputBytes, "graph output").pipe(Effect.mapError((failure) => graphInvocationFailure(failure.cause)));
|
|
41
|
+
yield* Effect.tryPromise({
|
|
42
|
+
try: () => withSignal(options.contentSink?.emitOutput(output, signal), signal),
|
|
43
|
+
catch: graphInvocationFailure,
|
|
44
|
+
});
|
|
45
|
+
yield* Effect.tryPromise({
|
|
46
|
+
try: () => withSignal(options.contentSink?.finishOutput?.(signal), signal),
|
|
47
|
+
catch: graphInvocationFailure,
|
|
48
|
+
});
|
|
49
|
+
return output;
|
|
50
|
+
});
|
|
51
|
+
/** Publishes interruption requests before returning the original waiting failure.
|
|
52
|
+
* @param context - Existing graph checkpoint identity and sink.
|
|
53
|
+
* @returns The original tagged graph interruption.
|
|
54
|
+
*/
|
|
55
|
+
const emitCompiledGraphWaitingEffect = Effect.fn("Agents.graph.emitWaiting")(function* (context) {
|
|
56
|
+
const { options, graph, config, signal } = context;
|
|
57
|
+
const interrupts = yield* waitingInterruptsEffect(graph, options.agent, config).pipe(Effect.mapError((failure) => graphInvocationFailure(failure.cause)));
|
|
58
|
+
yield* Effect.tryPromise({
|
|
59
|
+
try: () => withSignal(options.contentSink?.emitWaiting?.({
|
|
60
|
+
response: graphWaitingResponse(interrupts),
|
|
61
|
+
requests: publicWaitingRequests(interrupts),
|
|
62
|
+
}, signal), signal),
|
|
63
|
+
catch: graphInvocationFailure,
|
|
64
|
+
});
|
|
65
|
+
return yield* Effect.fail(graphInvocationFailure(new GraphInterruptedError(options.threadId, interrupts)));
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=graph-runtime-stream-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-runtime-stream-state.js","sourceRoot":"","sources":["../src/graph-runtime-stream-state.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC;;;GAGG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,MAAM,CAAC,EAAE,CAAC,4BAA4B,CAAC,CAAC,QAAQ,CAAC,EAC9F,OAAmC;IAEnC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IACxD,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,oBAAoB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC7D,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,0BAA0B,CACpD,CAAC,SAAS,CAAC,KAAK,CAAC,EACjB,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,EAAE,CAClC,CAAC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AC,QAAQ,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,sBAAsB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CACpE,CAAC;IACF,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC;QACvB,GAAG,EAAE,GAAG,EAAE,CACR,UAAU,CACR,OAAO,CAAC,WAAW,EAAE,WAAW,EAAE,CAChC;YACE,QAAQ,EAAE,oBAAoB,CAAC,UAAU,CAAC;YAC1C,QAAQ,EAAE,qBAAqB,CAAC,UAAU,CAAC;SAC5C,EACD,MAAM,CACP,EACD,MAAM,CACP;QACH,KAAK,EAAE,sBAAsB;KAC9B,CAAC,CAAC;IACH,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CACvB,sBAAsB,CAAC,IAAI,qBAAqB,CAAC,OAAO,CAAC,QAAS,EAAE,UAAU,CAAC,CAAC,CACjF,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Consumes native graph streams and publishes RELKIT execution events, finalizing the native iterator before settling the invocation. */
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import type { GraphConfig } from "./graph-continuation.types.js";
|
|
4
|
+
import type { GraphRuntimeOptions } from "./graph-runtime.types.js";
|
|
5
|
+
/** Streams one compiled graph and validates its final public output.
|
|
6
|
+
* @param options - Graph runtime and content sinks.
|
|
7
|
+
* @param graph - Compiled native graph.
|
|
8
|
+
* @param config - Persistent graph configuration.
|
|
9
|
+
* @param input - Validated invocation input.
|
|
10
|
+
* @param signal - Linked invocation cancellation signal.
|
|
11
|
+
* @param maxOutputBytes - Maximum serialized output size.
|
|
12
|
+
* @returns An Effect with graph output or GraphInvocationFailure.
|
|
13
|
+
* @example await Effect.runPromise(streamCompiledGraphEffect(options, graph, config, input, signal, 1024));
|
|
14
|
+
*/
|
|
15
|
+
export declare const streamCompiledGraphEffect: (options: GraphRuntimeOptions, graph: any, config: GraphConfig, input: unknown, signal: AbortSignal, maxOutputBytes: number) => Effect.Effect<import("@relkit/contracts").JsonValue, import("./graph-runtime-error.js").GraphInvocationFailure, never>;
|
|
16
|
+
//# sourceMappingURL=graph-runtime-stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-runtime-stream.d.ts","sourceRoot":"","sources":["../src/graph-runtime-stream.ts"],"names":[],"mappings":"AAAA,0IAA0I;AAI1I,OAAO,EAAE,MAAM,EAAQ,MAAM,QAAQ,CAAC;AAItC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAOjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAOpE;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,wPA0CrC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** Consumes native graph streams and publishes RELKIT execution events, finalizing the native iterator before settling the invocation. */
|
|
2
|
+
import { collectCompiledGraphStateEffect } from "./graph-runtime-stream-state.js";
|
|
3
|
+
import { isInterrupted } from "@langchain/langgraph";
|
|
4
|
+
import { Effect, Exit } from "effect";
|
|
5
|
+
import { observeAgent } from "@relkit/agents/internal/agent-telemetry";
|
|
6
|
+
import { graphExecutionEffect } from "./define-graph.js";
|
|
7
|
+
import { resumeCommandEffect, waitingInterruptsEffect } from "./graph-continuation.js";
|
|
8
|
+
import { GraphInterruptedError, graphWaitingResponse, publicWaitingRequests, } from "./graph-interruption.js";
|
|
9
|
+
import { graphInvocationFailure } from "./graph-runtime-error.js";
|
|
10
|
+
import { collectNativeEventsEffect } from "./runtime-native-events.js";
|
|
11
|
+
import { selectedStateSchemasEffect } from "./runtime-state-schemas.js";
|
|
12
|
+
import { jsonValueEffect, validateValueEffect } from "./runtime-utils.js";
|
|
13
|
+
import { signalFailure, withSignal } from "./signal.js";
|
|
14
|
+
/** Streams one compiled graph and validates its final public output.
|
|
15
|
+
* @param options - Graph runtime and content sinks.
|
|
16
|
+
* @param graph - Compiled native graph.
|
|
17
|
+
* @param config - Persistent graph configuration.
|
|
18
|
+
* @param input - Validated invocation input.
|
|
19
|
+
* @param signal - Linked invocation cancellation signal.
|
|
20
|
+
* @param maxOutputBytes - Maximum serialized output size.
|
|
21
|
+
* @returns An Effect with graph output or GraphInvocationFailure.
|
|
22
|
+
* @example await Effect.runPromise(streamCompiledGraphEffect(options, graph, config, input, signal, 1024));
|
|
23
|
+
*/
|
|
24
|
+
export const streamCompiledGraphEffect = Effect.fn("Agents.graph.streamCompiled")(function* (options, graph, config, input, signal, maxOutputBytes) {
|
|
25
|
+
if (signal.aborted)
|
|
26
|
+
return yield* Effect.fail(graphInvocationFailure(signalFailure(signal)));
|
|
27
|
+
const nativeInput = options.resume
|
|
28
|
+
? yield* resumeCommandEffect(graph, options.agent, config, input).pipe(Effect.mapError((failure) => graphInvocationFailure(failure.cause)))
|
|
29
|
+
: input;
|
|
30
|
+
const run = yield* Effect.tryPromise({
|
|
31
|
+
try: () => withSignal(graph.streamEvents(nativeInput, {
|
|
32
|
+
version: "v3",
|
|
33
|
+
signal,
|
|
34
|
+
recursionLimit: options.agent.limits.maxSteps,
|
|
35
|
+
...config,
|
|
36
|
+
}), signal),
|
|
37
|
+
catch: graphInvocationFailure,
|
|
38
|
+
});
|
|
39
|
+
const context = { options, graph, config, input, signal, maxOutputBytes, run };
|
|
40
|
+
return yield* collectCompiledGraphStateEffect(context).pipe(Effect.onExit((exit) => Exit.isFailure(exit)
|
|
41
|
+
? Effect.sync(() => {
|
|
42
|
+
try {
|
|
43
|
+
run.abort(signalFailure(signal));
|
|
44
|
+
}
|
|
45
|
+
catch { }
|
|
46
|
+
})
|
|
47
|
+
: Effect.void));
|
|
48
|
+
}, (effect) => observeAgent("graph.stream-compiled", effect));
|
|
49
|
+
//# sourceMappingURL=graph-runtime-stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-runtime-stream.js","sourceRoot":"","sources":["../src/graph-runtime-stream.ts"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AI,CAClE,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,sBAAsB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CACpE;QACH,CAAC,CAAC,KAAK,CAAC;IACV,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC;QACnC,GAAG,EAAE,GAAG,EAAE,CACR,UAAU,CACR,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE;YAC9B,OAAO,EAAE,IAAI;YACb,MAAM;YACN,cAAc,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ;YAC7C,GAAG,MAAM;SACV,CAAC,EACF,MAAM,CACP;QACH,KAAK,EAAE,sBAAsB;KAC9B,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC;IAC/E,OAAO,KAAK,CAAC,CAAC,+BAA+B,CAAC,OAAO,CAAC,CAAC,IAAI,CACzD,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CACrB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;QAClB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;YACf,IAAI,CAAC;gBACH,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;YACnC,CAAC;YAAC,MAAM,CAAC,CAAA,CAAC;QACZ,CAAC,CAAC;QACJ,CAAC,CAAC,MAAM,CAAC,IAAI,CAChB,CACF,CAAC;AACJ,CAAC,EACD,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAC1D,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Acquired native stream and public sinks retained by one graph invocation. */
|
|
2
|
+
import type { compileGraph } from "./graph-compile.js";
|
|
3
|
+
import type { GraphConfig } from "./graph-continuation.types.js";
|
|
4
|
+
import type { GraphRuntimeOptions } from "./graph-runtime.types.js";
|
|
5
|
+
export interface CompiledGraphStreamContext {
|
|
6
|
+
readonly options: GraphRuntimeOptions;
|
|
7
|
+
readonly graph: ReturnType<typeof compileGraph>;
|
|
8
|
+
readonly config: GraphConfig;
|
|
9
|
+
readonly signal: AbortSignal;
|
|
10
|
+
readonly maxOutputBytes: number;
|
|
11
|
+
readonly run: Awaited<ReturnType<ReturnType<typeof compileGraph>["streamEvents"]>>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=graph-runtime-stream.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-runtime-stream.types.d.ts","sourceRoot":"","sources":["../src/graph-runtime-stream.types.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;IAChD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;CACpF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-runtime-stream.types.js","sourceRoot":"","sources":["../src/graph-runtime-stream.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Composes graph compilation, scoped persistence and execution into the native invocation entrypoint, retaining stream and continuation behavior. */
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import { GraphInvocationIdentity } from "./graph-runtime-identity.js";
|
|
4
|
+
import type { GraphRuntimeOptions } from "./graph-runtime.types.js";
|
|
5
|
+
export type { GraphRuntimeOptions } from "./graph-runtime.types.js";
|
|
6
|
+
export { GraphInvocationFailure } from "./graph-runtime-error.js";
|
|
7
|
+
export { GraphInvocationIdentity, GraphInvocationIdentityLive } from "./graph-runtime-identity.js";
|
|
8
|
+
/** Invokes a graph with scoped signal cleanup and linked Effect cancellation.
|
|
9
|
+
* @param options - Graph, engine, input, and invocation integrations.
|
|
10
|
+
* @returns An Effect with graph output or GraphInvocationFailure.
|
|
11
|
+
* @example Effect.runPromise(Effect.provide(invokeGraphEffect(options), GraphInvocationIdentityLive));
|
|
12
|
+
*/
|
|
13
|
+
export declare const invokeGraphEffect: (options: GraphRuntimeOptions) => Effect.Effect<unknown, import("./graph-runtime-error.js").GraphInvocationFailure, GraphInvocationIdentity>;
|
|
14
|
+
/** Invokes a graph for existing Promise runtime callers.
|
|
15
|
+
* @param options - Graph, engine, input, and invocation integrations.
|
|
16
|
+
* @returns Validated graph output.
|
|
17
|
+
* @throws The original graph, provider, validation, or cancellation error.
|
|
18
|
+
* @example await invokeGraph(options);
|
|
19
|
+
*/
|
|
20
|
+
export declare function invokeGraph(options: GraphRuntimeOptions): Promise<unknown>;
|
|
21
|
+
//# sourceMappingURL=graph-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-runtime.d.ts","sourceRoot":"","sources":["../src/graph-runtime.ts"],"names":[],"mappings":"AAAA,sJAAsJ;AAItJ,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,OAAO,EAAE,uBAAuB,EAA+B,MAAM,6BAA6B,CAAC;AACnG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAKpE,YAAY,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAEnG;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,8IAmD7B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC,CAO1E"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/** Composes graph compilation, scoped persistence and execution into the native invocation entrypoint, retaining stream and continuation behavior. */
|
|
2
|
+
import { normalizeId } from "@relkit/contracts";
|
|
3
|
+
import { frameworkTrace } from "@relkit/invocation";
|
|
4
|
+
import { Effect } from "effect";
|
|
5
|
+
import { observeAgent } from "@relkit/agents/internal/agent-telemetry";
|
|
6
|
+
import { generatedAgentFunctionId } from "@relkit/agents/internal/generated-function";
|
|
7
|
+
import { graphInvocationFailure } from "./graph-runtime-error.js";
|
|
8
|
+
import { runCompiledGraph } from "./graph-runtime-execution.js";
|
|
9
|
+
import { GraphInvocationIdentity, GraphInvocationIdentityLive } from "./graph-runtime-identity.js";
|
|
10
|
+
import { resolveAgentContentLimitsEffect } from "./runtime-model.js";
|
|
11
|
+
import { signalFailure, validateValue, withSignal } from "./runtime-utils.js";
|
|
12
|
+
import { acquireExecutionSignalEffect, ExecutionSignalClockLive } from "./signal.js";
|
|
13
|
+
export { GraphInvocationFailure } from "./graph-runtime-error.js";
|
|
14
|
+
export { GraphInvocationIdentity, GraphInvocationIdentityLive } from "./graph-runtime-identity.js";
|
|
15
|
+
/** Invokes a graph with scoped signal cleanup and linked Effect cancellation.
|
|
16
|
+
* @param options - Graph, engine, input, and invocation integrations.
|
|
17
|
+
* @returns An Effect with graph output or GraphInvocationFailure.
|
|
18
|
+
* @example Effect.runPromise(Effect.provide(invokeGraphEffect(options), GraphInvocationIdentityLive));
|
|
19
|
+
*/
|
|
20
|
+
export const invokeGraphEffect = Effect.fn("Agents.graph.invoke")(function* (options) {
|
|
21
|
+
const { invocationId, traceId } = yield* graphInvocationIdentityEffect(options);
|
|
22
|
+
const limits = yield* resolveAgentContentLimitsEffect(options).pipe(Effect.mapError((failure) => graphInvocationFailure(failure.cause)));
|
|
23
|
+
return yield* Effect.scoped(Effect.gen(function* () {
|
|
24
|
+
const execution = yield* acquireExecutionSignalEffect(options).pipe(Effect.mapError((failure) => graphInvocationFailure(failure.cause)), Effect.provide(ExecutionSignalClockLive));
|
|
25
|
+
return yield* Effect.tryPromise({
|
|
26
|
+
try: (effectSignal) => {
|
|
27
|
+
const signal = AbortSignal.any([execution.signal, effectSignal]);
|
|
28
|
+
return frameworkTrace.span(`relkit.agent.${options.agent.id}.invoke`, {
|
|
29
|
+
input: options.input,
|
|
30
|
+
attributes: {
|
|
31
|
+
"relkit.agent.id": options.agent.id,
|
|
32
|
+
"relkit.function.id": generatedAgentFunctionId(options.agent.id),
|
|
33
|
+
"relkit.invocation.id": invocationId,
|
|
34
|
+
"relkit.agent.execution": "graph",
|
|
35
|
+
},
|
|
36
|
+
}, async () => {
|
|
37
|
+
if (signal.aborted)
|
|
38
|
+
throw signalFailure(signal);
|
|
39
|
+
const input = options.resume
|
|
40
|
+
? options.input
|
|
41
|
+
: await withSignal(validateValue(options.agent.input, options.input, "input"), signal);
|
|
42
|
+
return runCompiledGraph(options, input, signal, invocationId, traceId, limits.maxOutputBytes);
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
catch: graphInvocationFailure,
|
|
46
|
+
});
|
|
47
|
+
}));
|
|
48
|
+
}, (effect) => observeAgent("graph.invoke", effect));
|
|
49
|
+
/** Invokes a graph for existing Promise runtime callers.
|
|
50
|
+
* @param options - Graph, engine, input, and invocation integrations.
|
|
51
|
+
* @returns Validated graph output.
|
|
52
|
+
* @throws The original graph, provider, validation, or cancellation error.
|
|
53
|
+
* @example await invokeGraph(options);
|
|
54
|
+
*/
|
|
55
|
+
export function invokeGraph(options) {
|
|
56
|
+
return Effect.runPromise(invokeGraphEffect(options).pipe(Effect.catchTag("GraphInvocationFailure", (failure) => Effect.fail(failure.cause)), Effect.provide(GraphInvocationIdentityLive)));
|
|
57
|
+
}
|
|
58
|
+
/** Normalizes graph identities through the replaceable ID service.
|
|
59
|
+
* @param options - Caller identity overrides.
|
|
60
|
+
* @returns Stable invocation and trace IDs.
|
|
61
|
+
*/
|
|
62
|
+
const graphInvocationIdentityEffect = Effect.fn("Agents.graph.invocationIdentity")(function* (options) {
|
|
63
|
+
const identity = yield* GraphInvocationIdentity;
|
|
64
|
+
const invocationId = yield* Effect.try({
|
|
65
|
+
try: () => normalizeId(options.invocationId ?? `agent-${identity.randomUUID()}`),
|
|
66
|
+
catch: graphInvocationFailure,
|
|
67
|
+
});
|
|
68
|
+
const traceId = yield* Effect.try({
|
|
69
|
+
try: () => normalizeId(options.traceId ?? invocationId),
|
|
70
|
+
catch: graphInvocationFailure,
|
|
71
|
+
});
|
|
72
|
+
return { invocationId, traceId };
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=graph-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-runtime.js","sourceRoot":"","sources":["../src/graph-runtime.ts"],"names":[],"mappings":"AAAA,sJAAsJ;AAEtJ,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,M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,MAAM,CAAC,QAAQ,CAAC,wBAAwB,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAClF,MAAM,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAC5C,CACF,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,6BAA6B,GAAG,MAAM,CAAC,EAAE,CAAC,iCAAiC,CAAC,CAAC,QAAQ,CAAC,EAC1F,OAA4B;IAE5B,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,uBAAuB,CAAC;IAChD,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;QACrC,GAAG,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,YAAY,IAAI,SAAS,QAAQ,CAAC,UAAU,EAAE,EAAE,CAAC;QAChF,KAAK,EAAE,sBAAsB;KAC9B,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;QAChC,GAAG,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,IAAI,YAAY,CAAC;QACvD,KAAK,EAAE,sBAAsB;KAC9B,CAAC,CAAC;IACH,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;AACnC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Composes graph compilation, scoped persistence and execution into the native invocation entrypoint, retaining stream and continuation behavior. This companion preserves the native input and output types without starting runtime work. */
|
|
2
|
+
import type { GraphDescriptor } from "./define-graph.js";
|
|
3
|
+
import type { AgentInvocationOptions, AgentRuntimeOptions } from "./runtime.types.js";
|
|
4
|
+
/** Runtime options for invoking a compiled graph descriptor. */
|
|
5
|
+
export type GraphRuntimeOptions = AgentRuntimeOptions & AgentInvocationOptions & {
|
|
6
|
+
readonly agent: GraphDescriptor;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=graph-runtime.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-runtime.types.d.ts","sourceRoot":"","sources":["../src/graph-runtime.types.ts"],"names":[],"mappings":"AAAA,gPAAgP;AAEhP,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEtF,gEAAgE;AAChE,MAAM,MAAM,mBAAmB,GAAG,mBAAmB,GACnD,sBAAsB,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Composes graph compilation, scoped persistence and execution into the native invocation entrypoint, retaining stream and continuation behavior. This companion preserves the native input and output types without starting runtime work. */
|
|
2
|
+
export {};
|
|
3
|
+
//# sourceMappingURL=graph-runtime.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-runtime.types.js","sourceRoot":"","sources":["../src/graph-runtime.types.ts"],"names":[],"mappings":"AAAA,gPAAgP"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Adapts authored state schemas to the native graph state contract and preserves the reducers and validated channel shapes required by compilation. */
|
|
2
|
+
import { StateSchema, type AnyStateSchema } from "@langchain/langgraph";
|
|
3
|
+
import { type StandardSchemaV1 } from "@relkit/schema";
|
|
4
|
+
import { Effect, Schema } from "effect";
|
|
5
|
+
declare const GraphStateSelectionError_base: Schema.Class<GraphStateSelectionError, Schema.TaggedStruct<"GraphStateSelectionError", {
|
|
6
|
+
readonly code: Schema.String;
|
|
7
|
+
readonly message: Schema.String;
|
|
8
|
+
}>, import("effect/Cause").YieldableError>;
|
|
9
|
+
/** Expected graph state projection failure in the Effect error channel. */
|
|
10
|
+
export declare class GraphStateSelectionError extends GraphStateSelectionError_base {
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Projects a graph state to the fields declared by a client selection schema.
|
|
14
|
+
*
|
|
15
|
+
* @param state - LangGraph state definition to project.
|
|
16
|
+
* @param selection - Standard Schema describing the selected fields.
|
|
17
|
+
* @returns An Effect with the selected StateSchema or GraphStateSelectionError.
|
|
18
|
+
* @throws A defect if LangGraph rejects an otherwise valid StateSchema construction.
|
|
19
|
+
* @example
|
|
20
|
+
* const projected = Effect.runSync(selectGraphStateEffect(state, z.object({ answer: z.string() })));
|
|
21
|
+
*/
|
|
22
|
+
export declare const selectGraphStateEffect: (state: AnyStateSchema, selection: StandardSchemaV1<unknown, unknown>) => Effect.Effect<StateSchema<Record<string, any>>, GraphStateSelectionError, never>;
|
|
23
|
+
/**
|
|
24
|
+
* Projects graph state for existing synchronous graph definition callers.
|
|
25
|
+
*
|
|
26
|
+
* @param state - LangGraph state definition to project.
|
|
27
|
+
* @param selection - Schema describing selected fields.
|
|
28
|
+
* @returns A new StateSchema with only those fields.
|
|
29
|
+
* @throws AgentRuntimeError when the selection or one of its fields is unavailable.
|
|
30
|
+
* @example
|
|
31
|
+
* const projected = selectGraphState(state, z.object({ answer: z.string() }));
|
|
32
|
+
*/
|
|
33
|
+
export declare function selectGraphState(state: AnyStateSchema, selection: StandardSchemaV1): AnyStateSchema;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=graph-state-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-state-schema.d.ts","sourceRoot":"","sources":["../src/graph-state-schema.ts"],"names":[],"mappings":"AAAA,wJAAwJ;AAExJ,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,MAAM,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;;;;;AAOhD,2EAA2E;AAC3E,qBAAa,wBAAyB,SAAQ,6BAG7C;CAAG;AAEJ;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,4JA+BlC,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,gBAAgB,GAC1B,cAAc,CAUhB"}
|