@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,43 @@
|
|
|
1
|
+
/** Coordinates native graph resume requests with persisted waiting state and the invocation scope, preserving continuation failures and thread identity. */
|
|
2
|
+
import { Command } from "@langchain/langgraph";
|
|
3
|
+
import { Effect } from "effect";
|
|
4
|
+
import { type GraphDescriptor } from "./define-graph.js";
|
|
5
|
+
import type { CompiledGraph, GraphConfig } from "./graph-continuation.types.js";
|
|
6
|
+
export type { GraphConfig } from "./graph-continuation.types.js";
|
|
7
|
+
export { validateGraphResumeInput, validateGraphResumeInputEffect, } from "./graph-continuation-validation.js";
|
|
8
|
+
export { waitingInterrupts, waitingInterruptsEffect } from "./graph-continuation-waiting.js";
|
|
9
|
+
/** Builds a persistent graph run configuration.
|
|
10
|
+
* @param descriptor - Graph whose checkpointer determines thread requirements.
|
|
11
|
+
* @param threadId - Optional persistent thread identity.
|
|
12
|
+
* @returns An Effect with configuration or GraphContinuationFailure.
|
|
13
|
+
* @example Effect.runSync(graphConfigEffect(graph, "thread"));
|
|
14
|
+
*/
|
|
15
|
+
export declare const graphConfigEffect: (descriptor: GraphDescriptor<string, import("@relkit/schema").StandardSchemaV1<unknown, unknown>, import("@relkit/schema").StandardSchemaV1<unknown, unknown>, import("@langchain/langgraph").AnyStateSchema, readonly import("./define-graph.types.js").GraphNodeLike[]>, threadId?: string | undefined) => Effect.Effect<GraphConfig, import("./graph-continuation-error.js").GraphContinuationFailure, never>;
|
|
16
|
+
/** Builds graph run configuration for existing synchronous callers.
|
|
17
|
+
* @param descriptor - Graph whose checkpointer determines thread requirements.
|
|
18
|
+
* @param threadId - Optional persistent thread identity.
|
|
19
|
+
* @returns Run configuration.
|
|
20
|
+
* @throws The original missing thread error.
|
|
21
|
+
* @example const config = graphConfig(graph, "thread");
|
|
22
|
+
*/
|
|
23
|
+
export declare function graphConfig(descriptor: GraphDescriptor, threadId?: string): GraphConfig;
|
|
24
|
+
/** Validates a reply and constructs a native LangGraph resume command.
|
|
25
|
+
* @param graph - Compiled graph with the waiting snapshot.
|
|
26
|
+
* @param descriptor - Source graph descriptor.
|
|
27
|
+
* @param config - Persistent thread configuration.
|
|
28
|
+
* @param value - User reply or ordered replies.
|
|
29
|
+
* @returns An Effect with a native command or GraphContinuationFailure.
|
|
30
|
+
* @example Effect.runPromise(resumeCommandEffect(graph, descriptor, config, reply));
|
|
31
|
+
*/
|
|
32
|
+
export declare const resumeCommandEffect: (graph: any, descriptor: GraphDescriptor<string, import("@relkit/schema").StandardSchemaV1<unknown, unknown>, import("@relkit/schema").StandardSchemaV1<unknown, unknown>, import("@langchain/langgraph").AnyStateSchema, readonly import("./define-graph.types.js").GraphNodeLike[]>, config: GraphConfig, value: unknown) => Effect.Effect<Command<unknown, Record<string, unknown>, string>, import("./graph-continuation-error.js").GraphContinuationFailure, never>;
|
|
33
|
+
/** Constructs a native resume command for existing Promise callers.
|
|
34
|
+
* @param graph - Compiled graph with the waiting snapshot.
|
|
35
|
+
* @param descriptor - Source graph descriptor.
|
|
36
|
+
* @param config - Persistent thread configuration.
|
|
37
|
+
* @param value - User reply or ordered replies.
|
|
38
|
+
* @returns A native LangGraph resume command.
|
|
39
|
+
* @throws The original state or continuation validation error.
|
|
40
|
+
* @example await resumeCommand(graph, descriptor, config, reply);
|
|
41
|
+
*/
|
|
42
|
+
export declare function resumeCommand(graph: CompiledGraph, descriptor: GraphDescriptor, config: GraphConfig, value: unknown): Promise<Command>;
|
|
43
|
+
//# sourceMappingURL=graph-continuation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-continuation.d.ts","sourceRoot":"","sources":["../src/graph-continuation.ts"],"names":[],"mappings":"AAAA,4JAA4J;AAE5J,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAKhF,YAAY,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE7F;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,kZAa7B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,CAMvF;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,0cAuB/B,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,aAAa,EACpB,UAAU,EAAE,eAAe,EAC3B,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,OAAO,CAAC,CAMlB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/** Coordinates native graph resume requests with persisted waiting state and the invocation scope, preserving continuation failures and thread identity. */
|
|
2
|
+
import { Command } from "@langchain/langgraph";
|
|
3
|
+
import { Effect } from "effect";
|
|
4
|
+
import { observeAgent } from "@relkit/agents/internal/agent-telemetry";
|
|
5
|
+
import { graphExecution } from "./define-graph.js";
|
|
6
|
+
import { graphContinuationFailure } from "./graph-continuation-error.js";
|
|
7
|
+
import { validateGraphResumeInputEffect } from "./graph-continuation-validation.js";
|
|
8
|
+
import { waitingInterruptsEffect } from "./graph-continuation-waiting.js";
|
|
9
|
+
export { validateGraphResumeInput, validateGraphResumeInputEffect, } from "./graph-continuation-validation.js";
|
|
10
|
+
export { waitingInterrupts, waitingInterruptsEffect } from "./graph-continuation-waiting.js";
|
|
11
|
+
/** Builds a persistent graph run configuration.
|
|
12
|
+
* @param descriptor - Graph whose checkpointer determines thread requirements.
|
|
13
|
+
* @param threadId - Optional persistent thread identity.
|
|
14
|
+
* @returns An Effect with configuration or GraphContinuationFailure.
|
|
15
|
+
* @example Effect.runSync(graphConfigEffect(graph, "thread"));
|
|
16
|
+
*/
|
|
17
|
+
export const graphConfigEffect = Effect.fn("Agents.graph.config")((descriptor, threadId) => Effect.try({
|
|
18
|
+
try: () => {
|
|
19
|
+
const persistent = graphExecution(descriptor).checkpointer !== undefined;
|
|
20
|
+
if (persistent && (typeof threadId !== "string" || threadId.length === 0)) {
|
|
21
|
+
throw new TypeError("Graph execution with a checkpointer requires threadId");
|
|
22
|
+
}
|
|
23
|
+
return threadId === undefined ? {} : { configurable: { thread_id: threadId } };
|
|
24
|
+
},
|
|
25
|
+
catch: graphContinuationFailure,
|
|
26
|
+
}), (effect) => observeAgent("graph.config", effect));
|
|
27
|
+
/** Builds graph run configuration for existing synchronous callers.
|
|
28
|
+
* @param descriptor - Graph whose checkpointer determines thread requirements.
|
|
29
|
+
* @param threadId - Optional persistent thread identity.
|
|
30
|
+
* @returns Run configuration.
|
|
31
|
+
* @throws The original missing thread error.
|
|
32
|
+
* @example const config = graphConfig(graph, "thread");
|
|
33
|
+
*/
|
|
34
|
+
export function graphConfig(descriptor, threadId) {
|
|
35
|
+
return Effect.runSync(graphConfigEffect(descriptor, threadId).pipe(Effect.catchTag("GraphContinuationFailure", (failure) => Effect.fail(failure.cause))));
|
|
36
|
+
}
|
|
37
|
+
/** Validates a reply and constructs a native LangGraph resume command.
|
|
38
|
+
* @param graph - Compiled graph with the waiting snapshot.
|
|
39
|
+
* @param descriptor - Source graph descriptor.
|
|
40
|
+
* @param config - Persistent thread configuration.
|
|
41
|
+
* @param value - User reply or ordered replies.
|
|
42
|
+
* @returns An Effect with a native command or GraphContinuationFailure.
|
|
43
|
+
* @example Effect.runPromise(resumeCommandEffect(graph, descriptor, config, reply));
|
|
44
|
+
*/
|
|
45
|
+
export const resumeCommandEffect = Effect.fn("Agents.graph.resumeCommand")(function* (graph, descriptor, config, value) {
|
|
46
|
+
yield* Effect.try({
|
|
47
|
+
try: () => {
|
|
48
|
+
if (graphExecution(descriptor).checkpointer === undefined) {
|
|
49
|
+
throw new TypeError("Graph resume requires a checkpointer");
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
catch: graphContinuationFailure,
|
|
53
|
+
});
|
|
54
|
+
const requests = yield* waitingInterruptsEffect(graph, descriptor, config);
|
|
55
|
+
const reply = yield* validateGraphResumeInputEffect(descriptor, requests, value);
|
|
56
|
+
return yield* Effect.try({
|
|
57
|
+
try: () => new Command({ resume: nativeResume(requests, reply) }),
|
|
58
|
+
catch: graphContinuationFailure,
|
|
59
|
+
});
|
|
60
|
+
}, (effect) => observeAgent("graph.resume-command", effect));
|
|
61
|
+
/** Constructs a native resume command for existing Promise callers.
|
|
62
|
+
* @param graph - Compiled graph with the waiting snapshot.
|
|
63
|
+
* @param descriptor - Source graph descriptor.
|
|
64
|
+
* @param config - Persistent thread configuration.
|
|
65
|
+
* @param value - User reply or ordered replies.
|
|
66
|
+
* @returns A native LangGraph resume command.
|
|
67
|
+
* @throws The original state or continuation validation error.
|
|
68
|
+
* @example await resumeCommand(graph, descriptor, config, reply);
|
|
69
|
+
*/
|
|
70
|
+
export function resumeCommand(graph, descriptor, config, value) {
|
|
71
|
+
return Effect.runPromise(resumeCommandEffect(graph, descriptor, config, value).pipe(Effect.catchTag("GraphContinuationFailure", (failure) => Effect.fail(failure.cause))));
|
|
72
|
+
}
|
|
73
|
+
function nativeResume(requests, value) {
|
|
74
|
+
const values = requests.length === 1 ? [value] : value;
|
|
75
|
+
const entries = requests.map((request, index) => {
|
|
76
|
+
if (request.id === undefined)
|
|
77
|
+
throw new TypeError("Graph interruption has no native ID");
|
|
78
|
+
return [request.id, values[index]];
|
|
79
|
+
});
|
|
80
|
+
return Object.fromEntries(entries);
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=graph-continuation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-continuation.js","sourceRoot":"","sources":["../src/graph-continuation.ts"],"names":[],"mappings":"AAAA,4JAA4J;AAE5J,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAwB,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAE,8BAA8B,EAAE,MAAM,oCAAoC,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAI1E,OAAO,EACL,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE7F;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,EAAE,CAAC,qBAAqB,CAAC,CAC/D,CAAC,UAA2B,EAAE,QAAiB,EAAE,EAAE,CACjD,MAAM,CAAC,GAAG,CAAC;IACT,GAAG,EAAE,GAAgB,EAAE;QACrB,MAAM,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC,YAAY,KAAK,SAAS,CAAC;QACzE,IAAI,UAAU,IAAI,CAAC,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;YAC1E,MAAM,IAAI,SAAS,CAAC,uDAAuD,CAAC,CAAC;QAC/E,C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coordinates native graph resume requests with persisted waiting state and the invocation scope, preserving continuation failures and thread identity. This companion preserves the native input and output types without starting runtime work. */
|
|
2
|
+
import type { compileGraph } from "./graph-compile.js";
|
|
3
|
+
/** LangGraph run configuration with an optional persistent thread identity. */
|
|
4
|
+
export type GraphConfig = {} | {
|
|
5
|
+
readonly configurable: {
|
|
6
|
+
readonly thread_id: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
/** Compiled graph accepted by continuation helpers. */
|
|
10
|
+
export type CompiledGraph = ReturnType<typeof compileGraph>;
|
|
11
|
+
//# sourceMappingURL=graph-continuation.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-continuation.types.d.ts","sourceRoot":"","sources":["../src/graph-continuation.types.ts"],"names":[],"mappings":"AAAA,sPAAsP;AAEtP,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,+EAA+E;AAC/E,MAAM,MAAM,WAAW,GAAG,EAAE,GAAG;IAAE,QAAQ,CAAC,YAAY,EAAE;QAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAEzF,uDAAuD;AACvD,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Coordinates native graph resume requests with persisted waiting state and the invocation scope, preserving continuation failures and thread identity. This companion preserves the native input and output types without starting runtime work. */
|
|
2
|
+
export {};
|
|
3
|
+
//# sourceMappingURL=graph-continuation.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-continuation.types.js","sourceRoot":"","sources":["../src/graph-continuation.types.ts"],"names":[],"mappings":"AAAA,sPAAsP"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Validates graph structure and resolves authored node identities before native compilation, reporting missing or inconsistent graph definitions. */
|
|
2
|
+
import { type AnyStateSchema } from "@langchain/langgraph";
|
|
3
|
+
import { type StandardSchemaV1 } from "@relkit/schema";
|
|
4
|
+
import { Effect } from "effect";
|
|
5
|
+
import type { GraphNodeLike } from "./define-graph.js";
|
|
6
|
+
import { type GraphEdgeBuilder, type GraphEdgeOperation } from "./graph-edges.js";
|
|
7
|
+
/** Validates graph state, nodes, and edge declarations.
|
|
8
|
+
* @param state - Native graph state schema.
|
|
9
|
+
* @param input - Graph input schema.
|
|
10
|
+
* @param output - Graph output schema.
|
|
11
|
+
* @param sourceNodes - Authored node descriptors.
|
|
12
|
+
* @param edges - Edge builder callback.
|
|
13
|
+
* @returns An Effect with nodes, edges, and state keys or GraphDefinitionFailure.
|
|
14
|
+
* @example Effect.runSync(prepareGraphDefinitionEffect(state, input, output, nodes, edges));
|
|
15
|
+
*/
|
|
16
|
+
export declare const prepareGraphDefinitionEffect: (state: AnyStateSchema, input: StandardSchemaV1<unknown, unknown>, output: StandardSchemaV1<unknown, unknown>, sourceNodes: readonly GraphNodeLike[], edges: (builder: GraphEdgeBuilder<string, any>) => unknown) => Effect.Effect<{
|
|
17
|
+
readonly nodes: readonly GraphNodeLike[];
|
|
18
|
+
readonly operations: readonly GraphEdgeOperation<string, any>[];
|
|
19
|
+
readonly stateKeys: Set<string>;
|
|
20
|
+
}, import("./define-graph-error.js").GraphDefinitionFailure, never>;
|
|
21
|
+
/** Validates graph authoring for existing synchronous callers.
|
|
22
|
+
* @param state - Native graph state schema.
|
|
23
|
+
* @param input - Graph input schema.
|
|
24
|
+
* @param output - Graph output schema.
|
|
25
|
+
* @param sourceNodes - Authored node descriptors.
|
|
26
|
+
* @param edges - Edge builder callback.
|
|
27
|
+
* @returns Frozen nodes, ordered operations, and state keys.
|
|
28
|
+
* @throws The original graph authoring error.
|
|
29
|
+
* @example const prepared = prepareGraphDefinition(state, input, output, nodes, edges);
|
|
30
|
+
*/
|
|
31
|
+
export declare function prepareGraphDefinition(state: AnyStateSchema, input: StandardSchemaV1, output: StandardSchemaV1, sourceNodes: readonly GraphNodeLike[], edges: (builder: GraphEdgeBuilder<string, any>) => unknown): {
|
|
32
|
+
readonly nodes: readonly GraphNodeLike[];
|
|
33
|
+
readonly operations: readonly GraphEdgeOperation<string, any>[];
|
|
34
|
+
readonly stateKeys: Set<string>;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=graph-definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-definition.d.ts","sourceRoot":"","sources":["../src/graph-definition.ts"],"names":[],"mappings":"AAAA,sJAAsJ;AAEtJ,OAAO,EAAe,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAExE,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;AAG1B;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,yKAMpB,gBAAgB,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO;oBA4C5C,SAAS,aAAa,EAAE;yBACnB,SAAS,kBAAkB,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE;wBAC3C,GAAG,CAAC,MAAM,CAAC;mEAvChC,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,gBAAgB,EACxB,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,KAAK,EAAE,CAAC,OAAO,EAAE,gBAAgB,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,GACzD;IACD,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,QAAQ,CAAC,UAAU,EAAE,SAAS,kBAAkB,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;IAChE,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACjC,CAMA"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/** Validates graph structure and resolves authored node identities before native compilation, reporting missing or inconsistent graph definitions. */
|
|
2
|
+
import { StateSchema } from "@langchain/langgraph";
|
|
3
|
+
import { isFunctionGraphNode } from "@relkit/functions";
|
|
4
|
+
import { getJsonSchema } from "@relkit/schema";
|
|
5
|
+
import { Effect } from "effect";
|
|
6
|
+
import { observeAgent } from "@relkit/agents/internal/agent-telemetry";
|
|
7
|
+
import { isRecord } from "@relkit/agents/internal/agent-validation";
|
|
8
|
+
import { assertGraphNodeDestinations, isGraphNodeDescriptor } from "./define-graph-node.js";
|
|
9
|
+
import { graphDefinitionFailure } from "./define-graph-error.js";
|
|
10
|
+
import { createGraphEdgeBuilder, } from "./graph-edges.js";
|
|
11
|
+
import { isSubgraphNode } from "./graph-subgraph.js";
|
|
12
|
+
/** Validates graph state, nodes, and edge declarations.
|
|
13
|
+
* @param state - Native graph state schema.
|
|
14
|
+
* @param input - Graph input schema.
|
|
15
|
+
* @param output - Graph output schema.
|
|
16
|
+
* @param sourceNodes - Authored node descriptors.
|
|
17
|
+
* @param edges - Edge builder callback.
|
|
18
|
+
* @returns An Effect with nodes, edges, and state keys or GraphDefinitionFailure.
|
|
19
|
+
* @example Effect.runSync(prepareGraphDefinitionEffect(state, input, output, nodes, edges));
|
|
20
|
+
*/
|
|
21
|
+
export const prepareGraphDefinitionEffect = Effect.fn("Agents.graph.prepareDefinition")((state, input, output, sourceNodes, edges) => Effect.try({
|
|
22
|
+
try: () => prepareGraphDefinitionCore(state, input, output, sourceNodes, edges),
|
|
23
|
+
catch: graphDefinitionFailure,
|
|
24
|
+
}), (effect) => observeAgent("graph.prepare-definition", effect));
|
|
25
|
+
/** Validates graph authoring for existing synchronous callers.
|
|
26
|
+
* @param state - Native graph state schema.
|
|
27
|
+
* @param input - Graph input schema.
|
|
28
|
+
* @param output - Graph output schema.
|
|
29
|
+
* @param sourceNodes - Authored node descriptors.
|
|
30
|
+
* @param edges - Edge builder callback.
|
|
31
|
+
* @returns Frozen nodes, ordered operations, and state keys.
|
|
32
|
+
* @throws The original graph authoring error.
|
|
33
|
+
* @example const prepared = prepareGraphDefinition(state, input, output, nodes, edges);
|
|
34
|
+
*/
|
|
35
|
+
export function prepareGraphDefinition(state, input, output, sourceNodes, edges) {
|
|
36
|
+
return Effect.runSync(prepareGraphDefinitionEffect(state, input, output, sourceNodes, edges).pipe(Effect.catchTag("GraphDefinitionFailure", (failure) => Effect.fail(failure.cause))));
|
|
37
|
+
}
|
|
38
|
+
function prepareGraphDefinitionCore(state, input, output, sourceNodes, edges) {
|
|
39
|
+
if (!StateSchema.isInstance(state))
|
|
40
|
+
throw new TypeError("Graph state must be a StateSchema");
|
|
41
|
+
if (!Array.isArray(sourceNodes) || sourceNodes.length === 0) {
|
|
42
|
+
throw new TypeError("Graph nodes must be a non-empty array");
|
|
43
|
+
}
|
|
44
|
+
const stateKeys = new Set(Object.keys(state.fields));
|
|
45
|
+
assertSelection(input, stateKeys, "input");
|
|
46
|
+
assertSelection(output, stateKeys, "output");
|
|
47
|
+
const nodes = Object.freeze([...sourceNodes]);
|
|
48
|
+
const nodeIds = new Set();
|
|
49
|
+
for (const node of nodes) {
|
|
50
|
+
if (!isGraphNodeDescriptor(node) && !isFunctionGraphNode(node) && !isSubgraphNode(node)) {
|
|
51
|
+
throw new TypeError("Graph nodes must be graph-node descriptors");
|
|
52
|
+
}
|
|
53
|
+
if (["__start__", "__end__", "__interrupt__"].includes(node.id)) {
|
|
54
|
+
throw new TypeError(`Graph node id "${node.id}" is reserved`);
|
|
55
|
+
}
|
|
56
|
+
if (stateKeys.has(node.id))
|
|
57
|
+
throw new TypeError(`Graph node id "${node.id}" collides with state`);
|
|
58
|
+
if (nodeIds.has(node.id))
|
|
59
|
+
throw new TypeError(`Duplicate graph node "${node.id}"`);
|
|
60
|
+
nodeIds.add(node.id);
|
|
61
|
+
assertSelection(node.input, stateKeys, `node "${node.id}" input`);
|
|
62
|
+
assertSelection(node.output, stateKeys, `node "${node.id}" output`);
|
|
63
|
+
}
|
|
64
|
+
for (const node of nodes) {
|
|
65
|
+
if (isGraphNodeDescriptor(node) || isSubgraphNode(node)) {
|
|
66
|
+
assertGraphNodeDestinations(node, nodeIds);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (typeof edges !== "function")
|
|
70
|
+
throw new TypeError("Graph edges must be a function");
|
|
71
|
+
const recorded = createGraphEdgeBuilder(nodeIds);
|
|
72
|
+
edges(recorded.builder);
|
|
73
|
+
return {
|
|
74
|
+
nodes,
|
|
75
|
+
operations: Object.freeze([...recorded.operations]),
|
|
76
|
+
stateKeys,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function assertSelection(schema, stateKeys, name) {
|
|
80
|
+
const result = getJsonSchema(schema);
|
|
81
|
+
const projected = result.ok ? result.schema : undefined;
|
|
82
|
+
if (projected?.type !== "object" || !isRecord(projected.properties)) {
|
|
83
|
+
throw new TypeError(`Graph ${name} must expose an object JSON Schema`);
|
|
84
|
+
}
|
|
85
|
+
for (const key of Object.keys(projected.properties)) {
|
|
86
|
+
if (!stateKeys.has(key))
|
|
87
|
+
throw new TypeError(`Graph ${name} field "${key}" is not in state`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=graph-definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-definition.js","sourceRoot":"","sources":["../src/graph-definition.ts"],"names":[],"mappings":"AAAA,sJAAsJ;AAEtJ,OAAO,EAAE,WAAW,EAAuB,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAyB,MAAM,gBAAgB,CAAC;AACtE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AAK,QAAQ,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;QACpE,MAAM,IAAI,SAAS,CAAC,SAAS,IAAI,oCAAoC,CAAC,CAAC;IACzE,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;QACpD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,MAAM,IAAI,SAAS,CAAC,SAAS,IAAI,WAAW,GAAG,mBAAmB,CAAC,CAAC;IAC/F,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates native graph endpoints and conditional route results before execution.
|
|
3
|
+
* Mutation builders reuse the same endpoint and duplicate-edge rules.
|
|
4
|
+
*/
|
|
5
|
+
import { END, START } from "@langchain/langgraph";
|
|
6
|
+
import { Effect } from "effect";
|
|
7
|
+
/** Checks native route targets against registered nodes.
|
|
8
|
+
* @param value - One destination or a destination list.
|
|
9
|
+
* @param nodeIds - Registered node identities.
|
|
10
|
+
* @returns An Effect with void or GraphDefinitionFailure.
|
|
11
|
+
* @example Effect.runSync(assertGraphDestinationEffect("next", ids));
|
|
12
|
+
*/
|
|
13
|
+
export declare const assertGraphDestinationEffect: <Id extends string>(value: unknown, nodeIds: ReadonlySet<Id>) => Effect.Effect<void, import("./define-graph-error.js").GraphDefinitionFailure, never>;
|
|
14
|
+
/** Checks native route targets for existing synchronous callers.
|
|
15
|
+
* @param value - One destination or a destination list.
|
|
16
|
+
* @param nodeIds - Registered node identities.
|
|
17
|
+
* @returns Nothing when all destinations are known.
|
|
18
|
+
* @throws The original invalid destination error.
|
|
19
|
+
* @example assertGraphDestination("next", ids);
|
|
20
|
+
*/
|
|
21
|
+
export declare function assertGraphDestination<Id extends string>(value: unknown, nodeIds: ReadonlySet<Id>): void;
|
|
22
|
+
/** Validates dynamic route labels or node destinations.
|
|
23
|
+
* @param value - Route result.
|
|
24
|
+
* @param nodeIds - Registered node identities.
|
|
25
|
+
* @param destinations - Optional label mapping.
|
|
26
|
+
* @returns An Effect with void or GraphDefinitionFailure.
|
|
27
|
+
* @example Effect.runSync(validateGraphRouteEffect("yes", ids, { yes: "next" }));
|
|
28
|
+
*/
|
|
29
|
+
export declare const validateGraphRouteEffect: <Id extends string>(value: unknown, nodeIds: ReadonlySet<Id>, destinations?: Readonly<Record<string, "__end__" | Id>> | undefined) => Effect.Effect<void, import("./define-graph-error.js").GraphDefinitionFailure, never>;
|
|
30
|
+
/** Validates dynamic routes for existing synchronous callers.
|
|
31
|
+
* @param value - Route result.
|
|
32
|
+
* @param nodeIds - Registered node identities.
|
|
33
|
+
* @param destinations - Optional label mapping.
|
|
34
|
+
* @returns Nothing when all route targets are valid.
|
|
35
|
+
* @throws The original invalid route error.
|
|
36
|
+
* @example validateGraphRoute("yes", ids, { yes: "next" });
|
|
37
|
+
*/
|
|
38
|
+
export declare function validateGraphRoute<Id extends string>(value: unknown, nodeIds: ReadonlySet<Id>, destinations?: Readonly<Record<string, Id | typeof END>>): void;
|
|
39
|
+
export declare function copyDestinations<Id extends string>(value: Readonly<Record<string, Id | typeof END>>, nodeIds: ReadonlySet<Id>): Readonly<Record<string, Id | typeof END>>;
|
|
40
|
+
export declare function assertEndpoint<Id extends string>(value: unknown, nodeIds: ReadonlySet<Id>, source: boolean): asserts value is Id | typeof START | typeof END;
|
|
41
|
+
export declare function addUnique(signatures: Set<string>, signature: string): void;
|
|
42
|
+
//# sourceMappingURL=graph-edge-destinations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-edge-destinations.d.ts","sourceRoot":"","sources":["../src/graph-edge-destinations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,GAAG,EAAE,KAAK,EAAQ,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AA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+
* Mutation builders reuse the same endpoint and duplicate-edge rules.
|
|
4
|
+
*/
|
|
5
|
+
import { END, START, Send } from "@langchain/langgraph";
|
|
6
|
+
import { Effect } from "effect";
|
|
7
|
+
import { observeAgent } from "@relkit/agents/internal/agent-telemetry";
|
|
8
|
+
import { graphDefinitionFailure } from "./define-graph-error.js";
|
|
9
|
+
/** Checks native route targets against registered nodes.
|
|
10
|
+
* @param value - One destination or a destination list.
|
|
11
|
+
* @param nodeIds - Registered node identities.
|
|
12
|
+
* @returns An Effect with void or GraphDefinitionFailure.
|
|
13
|
+
* @example Effect.runSync(assertGraphDestinationEffect("next", ids));
|
|
14
|
+
*/
|
|
15
|
+
export const assertGraphDestinationEffect = Effect.fn("Agents.graph.destination")((value, nodeIds) => Effect.try({
|
|
16
|
+
try: () => assertGraphDestinationCore(value, nodeIds),
|
|
17
|
+
catch: graphDefinitionFailure,
|
|
18
|
+
}), (effect) => observeAgent("graph.destination", effect));
|
|
19
|
+
/** Checks native route targets for existing synchronous callers.
|
|
20
|
+
* @param value - One destination or a destination list.
|
|
21
|
+
* @param nodeIds - Registered node identities.
|
|
22
|
+
* @returns Nothing when all destinations are known.
|
|
23
|
+
* @throws The original invalid destination error.
|
|
24
|
+
* @example assertGraphDestination("next", ids);
|
|
25
|
+
*/
|
|
26
|
+
export function assertGraphDestination(value, nodeIds) {
|
|
27
|
+
Effect.runSync(assertGraphDestinationEffect(value, nodeIds).pipe(Effect.catchTag("GraphDefinitionFailure", (failure) => Effect.fail(failure.cause))));
|
|
28
|
+
}
|
|
29
|
+
function assertGraphDestinationCore(value, nodeIds) {
|
|
30
|
+
const values = Array.isArray(value) ? value : [value];
|
|
31
|
+
for (const destination of values) {
|
|
32
|
+
const id = destination instanceof Send ? destination.node : destination;
|
|
33
|
+
assertEndpoint(id, nodeIds, false);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** Validates dynamic route labels or node destinations.
|
|
37
|
+
* @param value - Route result.
|
|
38
|
+
* @param nodeIds - Registered node identities.
|
|
39
|
+
* @param destinations - Optional label mapping.
|
|
40
|
+
* @returns An Effect with void or GraphDefinitionFailure.
|
|
41
|
+
* @example Effect.runSync(validateGraphRouteEffect("yes", ids, { yes: "next" }));
|
|
42
|
+
*/
|
|
43
|
+
export const validateGraphRouteEffect = Effect.fn("Agents.graph.validateRoute")((value, nodeIds, destinations) => Effect.try({
|
|
44
|
+
try: () => validateGraphRouteCore(value, nodeIds, destinations),
|
|
45
|
+
catch: graphDefinitionFailure,
|
|
46
|
+
}), (effect) => observeAgent("graph.validate-route", effect));
|
|
47
|
+
/** Validates dynamic routes for existing synchronous callers.
|
|
48
|
+
* @param value - Route result.
|
|
49
|
+
* @param nodeIds - Registered node identities.
|
|
50
|
+
* @param destinations - Optional label mapping.
|
|
51
|
+
* @returns Nothing when all route targets are valid.
|
|
52
|
+
* @throws The original invalid route error.
|
|
53
|
+
* @example validateGraphRoute("yes", ids, { yes: "next" });
|
|
54
|
+
*/
|
|
55
|
+
export function validateGraphRoute(value, nodeIds, destinations) {
|
|
56
|
+
Effect.runSync(validateGraphRouteEffect(value, nodeIds, destinations).pipe(Effect.catchTag("GraphDefinitionFailure", (failure) => Effect.fail(failure.cause))));
|
|
57
|
+
}
|
|
58
|
+
function validateGraphRouteCore(value, nodeIds, destinations) {
|
|
59
|
+
for (const destination of Array.isArray(value) ? value : [value]) {
|
|
60
|
+
if (destination instanceof Send) {
|
|
61
|
+
assertGraphDestinationCore(destination, nodeIds);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (destinations !== undefined && typeof destination === "string") {
|
|
65
|
+
if (Object.hasOwn(destinations, destination))
|
|
66
|
+
continue;
|
|
67
|
+
throw new TypeError(`Unknown graph route label "${destination}"`);
|
|
68
|
+
}
|
|
69
|
+
assertGraphDestinationCore(destination, nodeIds);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export function copyDestinations(value, nodeIds) {
|
|
73
|
+
const entries = Object.entries(value);
|
|
74
|
+
if (entries.length === 0)
|
|
75
|
+
throw new TypeError("Graph route destinations cannot be empty");
|
|
76
|
+
for (const [, destination] of entries)
|
|
77
|
+
assertEndpoint(destination, nodeIds, false);
|
|
78
|
+
return Object.freeze(Object.fromEntries(entries));
|
|
79
|
+
}
|
|
80
|
+
export function assertEndpoint(value, nodeIds, source) {
|
|
81
|
+
if (value === START) {
|
|
82
|
+
if (!source)
|
|
83
|
+
throw new TypeError("Graph START cannot be an edge destination");
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (value === END) {
|
|
87
|
+
if (source)
|
|
88
|
+
throw new TypeError("Graph END cannot be an edge source");
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (typeof value !== "string" || !nodeIds.has(value)) {
|
|
92
|
+
throw new TypeError(`Unknown graph node "${String(value)}"`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
export function addUnique(signatures, signature) {
|
|
96
|
+
if (signatures.has(signature))
|
|
97
|
+
throw new TypeError("Duplicate graph edge");
|
|
98
|
+
signatures.add(signature);
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=graph-edge-destinations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-edge-destinations.js","sourceRoot":"","sources":["../src/graph-edge-destinations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC,EAAE,CAAC,0BAA0B,CAAC,CAC/E,CAAoB,KAAc,EAAE,OAAwB,EAAE,EAAE,CAC9D,MAAM,CAA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CAAC;IAC1F,KAAK,MAAM,CAAC,EAAE,WAAW,CAAC,IAAI,OAAO;QAAE,cAAc,CAAC,WAAW,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IACnF,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAA8C,CAAC;AACjG,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,KAAc,EACd,OAAwB,EACxB,MAAe;IAEf,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;QACpB,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,SAAS,CAAC,2CAA2C,CAAC,CAAC;QAC9E,OAAO;IACT,CAAC;IACD,IAAI,KAAK,KAAK,GAAG,EAAE,CAAC;QAClB,IAAI,MAAM;YAAE,MAAM,IAAI,SAAS,CAAC,oCAAoC,CAAC,CAAC;QACtE,OAAO;IACT,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAW,CAAC,EAAE,CAAC;QAC3D,MAAM,IAAI,SAAS,CAAC,uBAAuB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,UAAuB,EAAE,SAAiB;IAClE,IAAI,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,sBAAsB,CAAC,CAAC;IAC3E,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applies validated edge mutations to one builder-owned operation log. Factories
|
|
3
|
+
* retain that builder's closure so duplicate checks and mutation order stay local.
|
|
4
|
+
*/
|
|
5
|
+
import { type LangGraphRunnableConfig } from "@langchain/langgraph";
|
|
6
|
+
import type { MaybePromise } from "@relkit/contracts";
|
|
7
|
+
import { Effect } from "effect";
|
|
8
|
+
import type { GraphEdgeMutationContext } from "./graph-edge-mutations.types.js";
|
|
9
|
+
/** Creates conditional mutations sharing one checked operation log.
|
|
10
|
+
* @param context - Registered nodes, duplicate signatures and builder identity.
|
|
11
|
+
* @returns The existing observable conditional mutation operation.
|
|
12
|
+
*/
|
|
13
|
+
export declare function conditionalEdgeMutation<Id extends string, State>(context: GraphEdgeMutationContext<Id, State>): (source: "__start__" | Id, route: (state: State, config: LangGraphRunnableConfig) => MaybePromise<unknown>, destinations?: Readonly<Record<string, "__end__" | Id>> | undefined) => Effect.Effect<import("./graph-edges.types.js").GraphEdgeBuilder<Id, State>, import("./define-graph-error.js").GraphDefinitionFailure, never>;
|
|
14
|
+
/** Creates direct/join mutations sharing the same checked operation log.
|
|
15
|
+
* @param context - Registered nodes, duplicate signatures and builder identity.
|
|
16
|
+
* @returns The existing observable edge mutation operation.
|
|
17
|
+
*/
|
|
18
|
+
export declare function edgeMutation<Id extends string, State>(context: GraphEdgeMutationContext<Id, State>): (start: "__start__" | Id | readonly Id[], end: "__end__" | Id) => Effect.Effect<import("./graph-edges.types.js").GraphEdgeBuilder<Id, State>, import("./define-graph-error.js").GraphDefinitionFailure, never>;
|
|
19
|
+
//# sourceMappingURL=graph-edge-mutations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-edge-mutations.d.ts","sourceRoot":"","sources":["../src/graph-edge-mutations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAc,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEhF;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,SAAS,MAAM,EAAE,KAAK,EAC9D,OAAO,EAAE,wBAAwB,CAAC,EAAE,EAAE,KAAK,CAAC,6CAMzB,KAAK,UAAU,uBAAuB,KAAK,YAAY,CAAC,OAAO,CAAC,uNAwBpF;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,KAAK,EACnD,OAAO,EAAE,wBAAwB,CAAC,EAAE,EAAE,KAAK,CAAC,kNA6B7C"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applies validated edge mutations to one builder-owned operation log. Factories
|
|
3
|
+
* retain that builder's closure so duplicate checks and mutation order stay local.
|
|
4
|
+
*/
|
|
5
|
+
import { END, START } from "@langchain/langgraph";
|
|
6
|
+
import { Effect } from "effect";
|
|
7
|
+
import { observeAgent } from "@relkit/agents/internal/agent-telemetry";
|
|
8
|
+
import { graphDefinitionFailure } from "./define-graph-error.js";
|
|
9
|
+
import { assertEndpoint, copyDestinations, addUnique } from "./graph-edge-destinations.js";
|
|
10
|
+
/** Creates conditional mutations sharing one checked operation log.
|
|
11
|
+
* @param context - Registered nodes, duplicate signatures and builder identity.
|
|
12
|
+
* @returns The existing observable conditional mutation operation.
|
|
13
|
+
*/
|
|
14
|
+
export function conditionalEdgeMutation(context) {
|
|
15
|
+
const { nodeIds, operations, signatures } = context;
|
|
16
|
+
return Effect.fn("Agents.graph.addConditionalEdge")((source, route, destinations) => Effect.try({
|
|
17
|
+
try: () => {
|
|
18
|
+
assertEndpoint(source, nodeIds, true);
|
|
19
|
+
if (typeof route !== "function")
|
|
20
|
+
throw new TypeError("Graph route must be a function");
|
|
21
|
+
const map = destinations === undefined ? undefined : copyDestinations(destinations, nodeIds);
|
|
22
|
+
addUnique(signatures, `conditional:${source}`);
|
|
23
|
+
operations.push(Object.freeze({
|
|
24
|
+
kind: "conditional",
|
|
25
|
+
source,
|
|
26
|
+
route,
|
|
27
|
+
...(map === undefined ? {} : { destinations: map }),
|
|
28
|
+
}));
|
|
29
|
+
return context.builder();
|
|
30
|
+
},
|
|
31
|
+
catch: graphDefinitionFailure,
|
|
32
|
+
}), (effect) => observeAgent("graph.add-conditional-edge", effect));
|
|
33
|
+
}
|
|
34
|
+
/** Creates direct/join mutations sharing the same checked operation log.
|
|
35
|
+
* @param context - Registered nodes, duplicate signatures and builder identity.
|
|
36
|
+
* @returns The existing observable edge mutation operation.
|
|
37
|
+
*/
|
|
38
|
+
export function edgeMutation(context) {
|
|
39
|
+
const { nodeIds, operations, signatures } = context;
|
|
40
|
+
return Effect.fn("Agents.graph.addEdge")((start, end) => Effect.try({
|
|
41
|
+
try: () => {
|
|
42
|
+
const starts = Array.isArray(start) ? start : [start];
|
|
43
|
+
if (starts.length === 0 || new Set(starts).size !== starts.length) {
|
|
44
|
+
throw new TypeError("Graph edge sources must be a non-empty unique list");
|
|
45
|
+
}
|
|
46
|
+
for (const value of starts)
|
|
47
|
+
assertEndpoint(value, nodeIds, true);
|
|
48
|
+
assertEndpoint(end, nodeIds, false);
|
|
49
|
+
if (starts.length > 1 && end === END)
|
|
50
|
+
throw new TypeError("Graph join destination must be a node");
|
|
51
|
+
addUnique(signatures, `edge:${starts.join(",")}->${end}`);
|
|
52
|
+
operations.push(Object.freeze({
|
|
53
|
+
kind: "edge",
|
|
54
|
+
start: Array.isArray(start) ? Object.freeze([...start]) : start,
|
|
55
|
+
end,
|
|
56
|
+
}));
|
|
57
|
+
return context.builder();
|
|
58
|
+
},
|
|
59
|
+
catch: graphDefinitionFailure,
|
|
60
|
+
}), (effect) => observeAgent("graph.add-edge", effect));
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=graph-edge-mutations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-edge-mutations.js","sourceRoot":"","sources":["../src/graph-edge-mutations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,GAAG,EAAE,KAAK,EAAgC,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;A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,CAAkC,CACpC,CAAC;YACF,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;QACD,KAAK,EAAE,sBAAsB;KAC9B,CAAC,EACJ,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,gBAAgB,EAAE,MAAM,CAAC,CACnD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** One graph builder's private ordered mutation authority. */
|
|
2
|
+
import type { GraphEdgeBuilder, GraphEdgeOperation } from "./graph-edges.types.js";
|
|
3
|
+
export interface GraphEdgeMutationContext<Id extends string, State> {
|
|
4
|
+
readonly nodeIds: ReadonlySet<Id>;
|
|
5
|
+
readonly operations: GraphEdgeOperation<Id, State>[];
|
|
6
|
+
readonly signatures: Set<string>;
|
|
7
|
+
readonly builder: () => GraphEdgeBuilder<Id, State>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=graph-edge-mutations.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-edge-mutations.types.d.ts","sourceRoot":"","sources":["../src/graph-edge-mutations.types.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACnF,MAAM,WAAW,wBAAwB,CAAC,EAAE,SAAS,MAAM,EAAE,KAAK;IAChE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC;IACrD,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,gBAAgB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;CACrD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-edge-mutations.types.js","sourceRoot":"","sources":["../src/graph-edge-mutations.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Defines typed native graph edge and routing descriptors whose endpoints are checked during graph assembly and compilation. */
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import type { GraphEdgeBuilder, GraphEdgeOperation } from "./graph-edges.types.js";
|
|
4
|
+
export type * from "./graph-edges.types.js";
|
|
5
|
+
/** Creates an edge builder whose mutations run through Effect.
|
|
6
|
+
* @param nodeIds - Registered node identities.
|
|
7
|
+
* @returns An Effect with a builder and its ordered operation log.
|
|
8
|
+
* @example Effect.runSync(createGraphEdgeBuilderEffect(ids));
|
|
9
|
+
*/
|
|
10
|
+
export declare const createGraphEdgeBuilderEffect: <Id extends string, State>(nodeIds: ReadonlySet<Id>) => Effect.Effect<{
|
|
11
|
+
builder: Readonly<GraphEdgeBuilder<Id, State>>;
|
|
12
|
+
operations: GraphEdgeOperation<Id, State>[];
|
|
13
|
+
}, never, never>;
|
|
14
|
+
/** Creates an edge builder for existing synchronous graph authoring.
|
|
15
|
+
* @param nodeIds - Registered node identities.
|
|
16
|
+
* @returns A builder and its ordered operation log.
|
|
17
|
+
* @example const { builder, operations } = createGraphEdgeBuilder(ids);
|
|
18
|
+
*/
|
|
19
|
+
export declare function createGraphEdgeBuilder<Id extends string, State>(nodeIds: ReadonlySet<Id>): {
|
|
20
|
+
readonly builder: GraphEdgeBuilder<Id, State>;
|
|
21
|
+
readonly operations: readonly GraphEdgeOperation<Id, State>[];
|
|
22
|
+
};
|
|
23
|
+
export { assertGraphDestination, assertGraphDestinationEffect, validateGraphRoute, validateGraphRouteEffect, } from "./graph-edge-destinations.js";
|
|
24
|
+
//# sourceMappingURL=graph-edges.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-edges.d.ts","sourceRoot":"","sources":["../src/graph-edges.ts"],"names":[],"mappings":"AAAA,iIAAiI;AAMjI,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEnF,mBAAmB,wBAAwB,CAAC;AAC5C;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,GACtC,EAAE,SAAS,MAAM,EAAE,KAAK;;;gBA0B1B,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,SAAS,MAAM,EAAE,KAAK,EAC7D,OAAO,EAAE,WAAW,CAAC,EAAE,CAAC,GACvB;IACD,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAC9C,QAAQ,CAAC,UAAU,EAAE,SAAS,kBAAkB,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC;CAC/D,CAEA;AAED,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,8BAA8B,CAAC"}
|