liminal 0.4.1 → 0.5.2
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/Action.ts +29 -0
- package/Agent.ts +10 -0
- package/CHANGELOG.md +20 -0
- package/Exec.ts +51 -0
- package/L.ts +24 -0
- package/LiminalAssertionError.ts +3 -0
- package/LiminalConfig.ts +7 -0
- package/Message.ts +94 -0
- package/Model.ts +26 -0
- package/PathLike.ts +17 -0
- package/Scope.ts +152 -0
- package/Spec.ts +29 -0
- package/Tool.ts +58 -0
- package/_.ts +11 -0
- package/actions/abort.ts +23 -0
- package/actions/actions_common/updateModels.ts +23 -0
- package/actions/actions_derived/__snapshots__/declareModel.test.ts.snap +89 -0
- package/actions/actions_derived/clear.ts +6 -0
- package/actions/actions_derived/declareModel.test.ts +36 -0
- package/actions/actions_derived/declareModel.ts +9 -0
- package/actions/actions_derived/declareModel.type-test.ts +70 -0
- package/actions/actions_derived/messages.test.ts +88 -0
- package/actions/actions_derived/messages.ts +18 -0
- package/actions/actions_derived/metatype.ts +9 -0
- package/actions/actions_derived/readers_derived.ts +15 -0
- package/actions/appendMessage.ts +54 -0
- package/actions/await.ts +13 -0
- package/actions/branch.ts +106 -0
- package/actions/catch.ts +42 -0
- package/actions/declareArg.ts +14 -0
- package/actions/disableTool.ts +26 -0
- package/actions/embed.ts +29 -0
- package/actions/emit.ts +21 -0
- package/actions/enableTool.ts +75 -0
- package/actions/enableTool.type-test.ts +118 -0
- package/actions/infer.ts +49 -0
- package/actions/messages.ts +62 -0
- package/actions/pushModel.ts +52 -0
- package/actions/scope.ts +13 -0
- package/actions/section.ts +105 -0
- package/actions/throw.ts +18 -0
- package/cli/WriteHandler.ts +35 -0
- package/cli/cli_common.ts +4 -0
- package/cli/main.ts +24 -0
- package/cli/runExec.ts +72 -0
- package/dist/Action.d.ts +15 -0
- package/dist/Action.js +13 -0
- package/dist/Action.js.map +1 -0
- package/dist/Agent.d.ts +7 -0
- package/dist/Agent.js +2 -0
- package/dist/Agent.js.map +1 -0
- package/dist/Exec.d.ts +25 -0
- package/dist/Exec.js +19 -0
- package/dist/Exec.js.map +1 -0
- package/dist/L.d.ts +23 -0
- package/dist/L.js +24 -0
- package/dist/L.js.map +1 -0
- package/dist/LiminalAssertionError.d.ts +3 -0
- package/dist/LiminalAssertionError.js +4 -0
- package/dist/LiminalAssertionError.js.map +1 -0
- package/dist/LiminalConfig.d.ts +6 -0
- package/dist/LiminalConfig.js +2 -0
- package/dist/LiminalConfig.js.map +1 -0
- package/dist/Message.d.ts +82 -0
- package/dist/Message.js +2 -0
- package/dist/Message.js.map +1 -0
- package/dist/Model.d.ts +21 -0
- package/dist/Model.js +2 -0
- package/dist/Model.js.map +1 -0
- package/dist/PathLike.d.ts +11 -0
- package/dist/PathLike.js +2 -0
- package/dist/PathLike.js.map +1 -0
- package/dist/Scope.d.ts +42 -0
- package/dist/Scope.js +93 -0
- package/dist/Scope.js.map +1 -0
- package/dist/Spec.d.ts +20 -0
- package/dist/Spec.js +2 -0
- package/dist/Spec.js.map +1 -0
- package/dist/Tool.d.ts +21 -0
- package/dist/Tool.js +32 -0
- package/dist/Tool.js.map +1 -0
- package/dist/_.d.ts +5 -0
- package/dist/_.js +7 -0
- package/dist/_.js.map +1 -0
- package/dist/actions/abort.d.ts +9 -0
- package/dist/actions/abort.js +15 -0
- package/dist/actions/abort.js.map +1 -0
- package/dist/actions/actions_common/updateModels.d.ts +3 -0
- package/dist/actions/actions_common/updateModels.js +17 -0
- package/dist/actions/actions_common/updateModels.js.map +1 -0
- package/dist/actions/actions_derived/clear.d.ts +8 -0
- package/dist/actions/actions_derived/clear.js +5 -0
- package/dist/actions/actions_derived/clear.js.map +1 -0
- package/dist/actions/actions_derived/declareModel.d.ts +5 -0
- package/dist/actions/actions_derived/declareModel.js +7 -0
- package/dist/actions/actions_derived/declareModel.js.map +1 -0
- package/dist/actions/actions_derived/declareModel.test.d.ts +1 -0
- package/dist/actions/actions_derived/declareModel.test.js +35 -0
- package/dist/actions/actions_derived/declareModel.test.js.map +1 -0
- package/dist/actions/actions_derived/declareModel.type-test.d.ts +1 -0
- package/dist/actions/actions_derived/declareModel.type-test.js +66 -0
- package/dist/actions/actions_derived/declareModel.type-test.js.map +1 -0
- package/dist/actions/actions_derived/messages.d.ts +6 -0
- package/dist/actions/actions_derived/messages.js +15 -0
- package/dist/actions/actions_derived/messages.js.map +1 -0
- package/dist/actions/actions_derived/messages.test.d.ts +1 -0
- package/dist/actions/actions_derived/messages.test.js +72 -0
- package/dist/actions/actions_derived/messages.test.js.map +1 -0
- package/dist/actions/actions_derived/metatype.d.ts +9 -0
- package/dist/actions/actions_derived/metatype.js +7 -0
- package/dist/actions/actions_derived/metatype.js.map +1 -0
- package/dist/actions/actions_derived/readers_derived.d.ts +6 -0
- package/dist/actions/actions_derived/readers_derived.js +14 -0
- package/dist/actions/actions_derived/readers_derived.js.map +1 -0
- package/dist/actions/appendMessage.d.ts +14 -0
- package/dist/actions/appendMessage.js +41 -0
- package/dist/actions/appendMessage.js.map +1 -0
- package/dist/actions/await.d.ts +5 -0
- package/dist/actions/await.js +10 -0
- package/dist/actions/await.js.map +1 -0
- package/dist/actions/branch.d.ts +39 -0
- package/dist/actions/branch.js +40 -0
- package/dist/actions/branch.js.map +1 -0
- package/dist/actions/catch.d.ts +10 -0
- package/dist/actions/catch.js +27 -0
- package/dist/actions/catch.js.map +1 -0
- package/dist/actions/declareArg.d.ts +8 -0
- package/dist/actions/declareArg.js +10 -0
- package/dist/actions/declareArg.js.map +1 -0
- package/dist/actions/disableTool.d.ts +10 -0
- package/dist/actions/disableTool.js +17 -0
- package/dist/actions/disableTool.js.map +1 -0
- package/dist/actions/embed.d.ts +9 -0
- package/dist/actions/embed.js +24 -0
- package/dist/actions/embed.js.map +1 -0
- package/dist/actions/emit.d.ts +9 -0
- package/dist/actions/emit.js +14 -0
- package/dist/actions/emit.js.map +1 -0
- package/dist/actions/enableTool.d.ts +20 -0
- package/dist/actions/enableTool.js +26 -0
- package/dist/actions/enableTool.js.map +1 -0
- package/dist/actions/enableTool.type-test.d.ts +1 -0
- package/dist/actions/enableTool.type-test.js +30 -0
- package/dist/actions/enableTool.type-test.js.map +1 -0
- package/dist/actions/infer.d.ts +15 -0
- package/dist/actions/infer.js +29 -0
- package/dist/actions/infer.js.map +1 -0
- package/dist/actions/messages.d.ts +24 -0
- package/dist/actions/messages.js +35 -0
- package/dist/actions/messages.js.map +1 -0
- package/dist/actions/pushModel.d.ts +15 -0
- package/dist/actions/pushModel.js +36 -0
- package/dist/actions/pushModel.js.map +1 -0
- package/dist/actions/scope.d.ts +7 -0
- package/dist/actions/scope.js +10 -0
- package/dist/actions/scope.js.map +1 -0
- package/dist/actions/section.d.ts +23 -0
- package/dist/actions/section.js +64 -0
- package/dist/actions/section.js.map +1 -0
- package/dist/actions/throw.d.ts +9 -0
- package/dist/actions/throw.js +13 -0
- package/dist/actions/throw.js.map +1 -0
- package/dist/cli/WriteHandler.d.ts +9 -0
- package/dist/cli/WriteHandler.js +24 -0
- package/dist/cli/WriteHandler.js.map +1 -0
- package/dist/cli/cli_common.d.ts +4 -0
- package/dist/cli/cli_common.js +2 -0
- package/dist/cli/cli_common.js.map +1 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +20 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/runExec.d.ts +2 -0
- package/dist/cli/runExec.js +74 -0
- package/dist/cli/runExec.js.map +1 -0
- package/dist/events/Aborted.d.ts +4 -0
- package/dist/events/Aborted.js +2 -0
- package/dist/events/Aborted.js.map +1 -0
- package/dist/events/Embedded.d.ts +5 -0
- package/dist/events/Embedded.js +2 -0
- package/dist/events/Embedded.js.map +1 -0
- package/dist/events/EmbeddingRequested.d.ts +4 -0
- package/dist/events/EmbeddingRequested.js +2 -0
- package/dist/events/EmbeddingRequested.js.map +1 -0
- package/dist/events/Emitted.d.ts +4 -0
- package/dist/events/Emitted.js +2 -0
- package/dist/events/Emitted.js.map +1 -0
- package/dist/events/EventBase.d.ts +3 -0
- package/dist/events/EventBase.js +2 -0
- package/dist/events/EventBase.js.map +1 -0
- package/dist/events/EventHandler.d.ts +2 -0
- package/dist/events/EventHandler.js +2 -0
- package/dist/events/EventHandler.js.map +1 -0
- package/dist/events/EventResolved.d.ts +19 -0
- package/dist/events/EventResolved.js +2 -0
- package/dist/events/EventResolved.js.map +1 -0
- package/dist/events/Forked.d.ts +3 -0
- package/dist/events/Forked.js +2 -0
- package/dist/events/Forked.js.map +1 -0
- package/dist/events/InferenceRequested.d.ts +3 -0
- package/dist/events/InferenceRequested.js +2 -0
- package/dist/events/InferenceRequested.js.map +1 -0
- package/dist/events/Inferred.d.ts +5 -0
- package/dist/events/Inferred.js +2 -0
- package/dist/events/Inferred.js.map +1 -0
- package/dist/events/LEvent.d.ts +20 -0
- package/dist/events/LEvent.js +2 -0
- package/dist/events/LEvent.js.map +1 -0
- package/dist/events/MessageAppended.d.ts +5 -0
- package/dist/events/MessageAppended.js +2 -0
- package/dist/events/MessageAppended.js.map +1 -0
- package/dist/events/MessageRemoved.d.ts +5 -0
- package/dist/events/MessageRemoved.js +2 -0
- package/dist/events/MessageRemoved.js.map +1 -0
- package/dist/events/MessagesSet.d.ts +5 -0
- package/dist/events/MessagesSet.js +2 -0
- package/dist/events/MessagesSet.js.map +1 -0
- package/dist/events/ModelPushed.d.ts +7 -0
- package/dist/events/ModelPushed.js +2 -0
- package/dist/events/ModelPushed.js.map +1 -0
- package/dist/events/ModelRemoved.d.ts +7 -0
- package/dist/events/ModelRemoved.js +2 -0
- package/dist/events/ModelRemoved.js.map +1 -0
- package/dist/events/Returned.d.ts +4 -0
- package/dist/events/Returned.js +2 -0
- package/dist/events/Returned.js.map +1 -0
- package/dist/events/SectionCleared.d.ts +5 -0
- package/dist/events/SectionCleared.js +2 -0
- package/dist/events/SectionCleared.js.map +1 -0
- package/dist/events/Sectioned.d.ts +5 -0
- package/dist/events/Sectioned.js +2 -0
- package/dist/events/Sectioned.js.map +1 -0
- package/dist/events/Threw.d.ts +4 -0
- package/dist/events/Threw.js +2 -0
- package/dist/events/Threw.js.map +1 -0
- package/dist/events/ToolCalled.d.ts +6 -0
- package/dist/events/ToolCalled.js +2 -0
- package/dist/events/ToolCalled.js.map +1 -0
- package/dist/events/ToolDisabled.d.ts +5 -0
- package/dist/events/ToolDisabled.js +2 -0
- package/dist/events/ToolDisabled.js.map +1 -0
- package/dist/events/ToolEnabled.d.ts +7 -0
- package/dist/events/ToolEnabled.js +2 -0
- package/dist/events/ToolEnabled.js.map +1 -0
- package/dist/events/isScopeChildEvent.d.ts +6 -0
- package/dist/events/isScopeChildEvent.js +9 -0
- package/dist/events/isScopeChildEvent.js.map +1 -0
- package/dist/events/isScopeDescendantEvent.d.ts +14 -0
- package/dist/events/isScopeDescendantEvent.js +12 -0
- package/dist/events/isScopeDescendantEvent.js.map +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/testing/AgentAssertions.d.ts +9 -0
- package/dist/testing/AgentAssertions.js +6 -0
- package/dist/testing/AgentAssertions.js.map +1 -0
- package/dist/testing/TestEmbeddingModel.d.ts +6 -0
- package/dist/testing/TestEmbeddingModel.js +11 -0
- package/dist/testing/TestEmbeddingModel.js.map +1 -0
- package/dist/testing/TestLanguageModel.d.ts +8 -0
- package/dist/testing/TestLanguageModel.js +22 -0
- package/dist/testing/TestLanguageModel.js.map +1 -0
- package/dist/testing/index.d.ts +4 -0
- package/dist/testing/index.js +5 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/takeFirstAction.d.ts +3 -0
- package/dist/testing/takeFirstAction.js +6 -0
- package/dist/testing/takeFirstAction.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/AssertDiagnostics.d.ts +18 -0
- package/dist/types/AssertDiagnostics.js +152 -0
- package/dist/types/AssertDiagnostics.js.map +1 -0
- package/dist/types/JSONRootType.d.ts +6 -0
- package/dist/types/JSONRootType.js +2 -0
- package/dist/types/JSONRootType.js.map +1 -0
- package/dist/types/JSONType.d.ts +16 -0
- package/dist/types/JSONType.js +2 -0
- package/dist/types/JSONType.js.map +1 -0
- package/dist/types/JSONTypeBase.d.ts +3 -0
- package/dist/types/JSONTypeBase.js +2 -0
- package/dist/types/JSONTypeBase.js.map +1 -0
- package/dist/types/Metatype/MetatypeDescriptor.d.ts +41 -0
- package/dist/types/Metatype/MetatypeDescriptor.js +38 -0
- package/dist/types/Metatype/MetatypeDescriptor.js.map +1 -0
- package/dist/types/Metatype/fromMetatypeDescriptor.d.ts +6 -0
- package/dist/types/Metatype/fromMetatypeDescriptor.js +43 -0
- package/dist/types/Metatype/fromMetatypeDescriptor.js.map +1 -0
- package/dist/types/Type.d.ts +31 -0
- package/dist/types/Type.js +5 -0
- package/dist/types/Type.js.map +1 -0
- package/dist/types/TypeContext.d.ts +7 -0
- package/dist/types/TypeContext.js +17 -0
- package/dist/types/TypeContext.js.map +1 -0
- package/dist/types/TypeLike.d.ts +23 -0
- package/dist/types/TypeLike.js +23 -0
- package/dist/types/TypeLike.js.map +1 -0
- package/dist/types/TypeVisitor.d.ts +14 -0
- package/dist/types/TypeVisitor.js +12 -0
- package/dist/types/TypeVisitor.js.map +1 -0
- package/dist/types/array.d.ts +10 -0
- package/dist/types/array.js +9 -0
- package/dist/types/array.js.map +1 -0
- package/dist/types/boolean.d.ts +6 -0
- package/dist/types/boolean.js +3 -0
- package/dist/types/boolean.js.map +1 -0
- package/dist/types/const.d.ts +8 -0
- package/dist/types/const.js +7 -0
- package/dist/types/const.js.map +1 -0
- package/dist/types/enum.d.ts +8 -0
- package/dist/types/enum.js +7 -0
- package/dist/types/enum.js.map +1 -0
- package/dist/types/factories.d.ts +8 -0
- package/dist/types/factories.js +9 -0
- package/dist/types/factories.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/integer.d.ts +6 -0
- package/dist/types/integer.js +3 -0
- package/dist/types/integer.js.map +1 -0
- package/dist/types/intrinsics.d.ts +11 -0
- package/dist/types/intrinsics.js +12 -0
- package/dist/types/intrinsics.js.map +1 -0
- package/dist/types/makeType.d.ts +2 -0
- package/dist/types/makeType.js +58 -0
- package/dist/types/makeType.js.map +1 -0
- package/dist/types/match.d.ts +3 -0
- package/dist/types/match.js +11 -0
- package/dist/types/match.js.map +1 -0
- package/dist/types/non_factories.d.ts +21 -0
- package/dist/types/non_factories.js +9 -0
- package/dist/types/non_factories.js.map +1 -0
- package/dist/types/null.d.ts +7 -0
- package/dist/types/null.js +4 -0
- package/dist/types/null.js.map +1 -0
- package/dist/types/number.d.ts +6 -0
- package/dist/types/number.js +3 -0
- package/dist/types/number.js.map +1 -0
- package/dist/types/object.d.ts +16 -0
- package/dist/types/object.js +10 -0
- package/dist/types/object.js.map +1 -0
- package/dist/types/ref.d.ts +7 -0
- package/dist/types/ref.js +5 -0
- package/dist/types/ref.js.map +1 -0
- package/dist/types/string.d.ts +6 -0
- package/dist/types/string.js +3 -0
- package/dist/types/string.js.map +1 -0
- package/dist/types/toJSON.d.ts +5 -0
- package/dist/types/toJSON.js +97 -0
- package/dist/types/toJSON.js.map +1 -0
- package/dist/types/type_common.d.ts +10 -0
- package/dist/types/type_common.js +12 -0
- package/dist/types/type_common.js.map +1 -0
- package/dist/types/types_derived/option.d.ts +5 -0
- package/dist/types/types_derived/option.js +6 -0
- package/dist/types/types_derived/option.js.map +1 -0
- package/dist/types/types_derived/taggedUnion.d.ts +19 -0
- package/dist/types/types_derived/taggedUnion.js +8 -0
- package/dist/types/types_derived/taggedUnion.js.map +1 -0
- package/dist/types/types_derived/wrapper.d.ts +8 -0
- package/dist/types/types_derived/wrapper.js +5 -0
- package/dist/types/types_derived/wrapper.js.map +1 -0
- package/dist/types/union.d.ts +9 -0
- package/dist/types/union.js +9 -0
- package/dist/types/union.js.map +1 -0
- package/dist/util/ArrayOfLength.d.ts +1 -0
- package/dist/util/ArrayOfLength.js +2 -0
- package/dist/util/ArrayOfLength.js.map +1 -0
- package/dist/util/DeferredOr.d.ts +1 -0
- package/dist/util/DeferredOr.js +2 -0
- package/dist/util/DeferredOr.js.map +1 -0
- package/dist/util/EnsureNarrow.d.ts +2 -0
- package/dist/util/EnsureNarrow.js +2 -0
- package/dist/util/EnsureNarrow.js.map +1 -0
- package/dist/util/EnsureRecord.d.ts +2 -0
- package/dist/util/EnsureRecord.js +2 -0
- package/dist/util/EnsureRecord.js.map +1 -0
- package/dist/util/Expand.d.ts +3 -0
- package/dist/util/Expand.js +2 -0
- package/dist/util/Expand.js.map +1 -0
- package/dist/util/Falsy.d.ts +1 -0
- package/dist/util/Falsy.js +2 -0
- package/dist/util/Falsy.js.map +1 -0
- package/dist/util/FromEntries.d.ts +3 -0
- package/dist/util/FromEntries.js +2 -0
- package/dist/util/FromEntries.js.map +1 -0
- package/dist/util/IteratorLike.d.ts +1 -0
- package/dist/util/IteratorLike.js +2 -0
- package/dist/util/IteratorLike.js.map +1 -0
- package/dist/util/JSONEntry.d.ts +2 -0
- package/dist/util/JSONEntry.js +2 -0
- package/dist/util/JSONEntry.js.map +1 -0
- package/dist/util/JSONKey.d.ts +1 -0
- package/dist/util/JSONKey.js +2 -0
- package/dist/util/JSONKey.js.map +1 -0
- package/dist/util/JSONObject.d.ts +5 -0
- package/dist/util/JSONObject.js +2 -0
- package/dist/util/JSONObject.js.map +1 -0
- package/dist/util/JSONSchemaMemo.d.ts +2 -0
- package/dist/util/JSONSchemaMemo.js +13 -0
- package/dist/util/JSONSchemaMemo.js.map +1 -0
- package/dist/util/JSONValue.d.ts +2 -0
- package/dist/util/JSONValue.js +2 -0
- package/dist/util/JSONValue.js.map +1 -0
- package/dist/util/PromiseOr.d.ts +1 -0
- package/dist/util/PromiseOr.js +2 -0
- package/dist/util/PromiseOr.js.map +1 -0
- package/dist/util/Result.d.ts +7 -0
- package/dist/util/Result.js +2 -0
- package/dist/util/Result.js.map +1 -0
- package/dist/util/Taggable.d.ts +9 -0
- package/dist/util/Taggable.js +8 -0
- package/dist/util/Taggable.js.map +1 -0
- package/dist/util/TupleToRecord.d.ts +5 -0
- package/dist/util/TupleToRecord.js +2 -0
- package/dist/util/TupleToRecord.js.map +1 -0
- package/dist/util/assert.d.ts +1 -0
- package/dist/util/assert.js +7 -0
- package/dist/util/assert.js.map +1 -0
- package/dist/util/dedent.d.ts +1 -0
- package/dist/util/dedent.js +5 -0
- package/dist/util/dedent.js.map +1 -0
- package/dist/util/fixTemplateStrings.d.ts +11 -0
- package/dist/util/fixTemplateStrings.js +83 -0
- package/dist/util/fixTemplateStrings.js.map +1 -0
- package/dist/util/fixTemplateStrings.test.d.ts +1 -0
- package/dist/util/fixTemplateStrings.test.js +221 -0
- package/dist/util/fixTemplateStrings.test.js.map +1 -0
- package/dist/util/isAsyncIterator.d.ts +1 -0
- package/dist/util/isAsyncIterator.js +7 -0
- package/dist/util/isAsyncIterator.js.map +1 -0
- package/dist/util/isIterator.d.ts +1 -0
- package/dist/util/isIterator.js +7 -0
- package/dist/util/isIterator.js.map +1 -0
- package/dist/util/isJSONValue.d.ts +2 -0
- package/dist/util/isJSONValue.js +16 -0
- package/dist/util/isJSONValue.js.map +1 -0
- package/dist/util/isPropertyKey.d.ts +1 -0
- package/dist/util/isPropertyKey.js +4 -0
- package/dist/util/isPropertyKey.js.map +1 -0
- package/dist/util/isTemplateStringsArray.d.ts +1 -0
- package/dist/util/isTemplateStringsArray.js +4 -0
- package/dist/util/isTemplateStringsArray.js.map +1 -0
- package/dist/util/jsonEquals.d.ts +2 -0
- package/dist/util/jsonEquals.js +33 -0
- package/dist/util/jsonEquals.js.map +1 -0
- package/dist/util/nullaryMemo.d.ts +1 -0
- package/dist/util/nullaryMemo.js +12 -0
- package/dist/util/nullaryMemo.js.map +1 -0
- package/dist/util/peekLast.d.ts +1 -0
- package/dist/util/peekLast.js +4 -0
- package/dist/util/peekLast.js.map +1 -0
- package/dist/util/unimplemented.d.ts +1 -0
- package/dist/util/unimplemented.js +5 -0
- package/dist/util/unimplemented.js.map +1 -0
- package/dist/util/unreachable.d.ts +1 -0
- package/dist/util/unreachable.js +5 -0
- package/dist/util/unreachable.js.map +1 -0
- package/dist/util/unwrapDeferred.d.ts +2 -0
- package/dist/util/unwrapDeferred.js +4 -0
- package/dist/util/unwrapDeferred.js.map +1 -0
- package/dist/util/util.d.ts +10 -0
- package/dist/util/util.js +11 -0
- package/dist/util/util.js.map +1 -0
- package/events/Aborted.ts +5 -0
- package/events/Embedded.ts +6 -0
- package/events/EmbeddingRequested.ts +5 -0
- package/events/Emitted.ts +5 -0
- package/events/EventBase.ts +3 -0
- package/events/EventHandler.ts +3 -0
- package/events/EventResolved.ts +30 -0
- package/events/Forked.ts +3 -0
- package/events/InferenceRequested.ts +3 -0
- package/events/Inferred.ts +6 -0
- package/events/LEvent.ts +40 -0
- package/events/MessageAppended.ts +6 -0
- package/events/MessageRemoved.ts +6 -0
- package/events/MessagesSet.ts +6 -0
- package/events/ModelPushed.ts +10 -0
- package/events/ModelRemoved.ts +10 -0
- package/events/Returned.ts +5 -0
- package/events/SectionCleared.ts +6 -0
- package/events/Sectioned.ts +6 -0
- package/events/Threw.ts +5 -0
- package/events/ToolCalled.ts +7 -0
- package/events/ToolDisabled.ts +6 -0
- package/events/ToolEnabled.ts +8 -0
- package/events/isScopeChildEvent.ts +15 -0
- package/events/isScopeDescendantEvent.ts +30 -0
- package/index.ts +41 -0
- package/package.json +32 -9
- package/testing/AgentAssertions.ts +17 -0
- package/testing/TestEmbeddingModel.ts +19 -0
- package/testing/TestLanguageModel.ts +33 -0
- package/testing/index.ts +4 -0
- package/testing/takeFirstAction.ts +8 -0
- package/tsconfig.json +8 -0
- package/types/AssertDiagnostics.ts +183 -0
- package/types/JSONRootType.ts +8 -0
- package/types/JSONType.ts +27 -0
- package/types/JSONTypeBase.ts +3 -0
- package/types/Metatype/MetatypeDescriptor.ts +80 -0
- package/types/Metatype/fromMetatypeDescriptor.ts +52 -0
- package/types/Type.ts +47 -0
- package/types/TypeContext.ts +19 -0
- package/types/TypeLike.ts +60 -0
- package/types/TypeVisitor.ts +49 -0
- package/types/array.ts +20 -0
- package/types/boolean.ts +9 -0
- package/types/const.ts +17 -0
- package/types/enum.ts +14 -0
- package/types/factories.ts +8 -0
- package/types/index.ts +2 -0
- package/types/integer.ts +9 -0
- package/types/intrinsics.ts +11 -0
- package/types/makeType.ts +72 -0
- package/types/match.ts +13 -0
- package/types/non_factories.ts +26 -0
- package/types/null.ts +10 -0
- package/types/number.ts +9 -0
- package/types/object.ts +27 -0
- package/types/ref.ts +12 -0
- package/types/string.ts +9 -0
- package/types/toJSON.ts +111 -0
- package/types/type_common.ts +21 -0
- package/types/types_derived/option.ts +10 -0
- package/types/types_derived/taggedUnion.ts +30 -0
- package/types/types_derived/wrapper.ts +10 -0
- package/types/union.ts +19 -0
- package/util/ArrayOfLength.ts +5 -0
- package/util/DeferredOr.ts +1 -0
- package/util/EnsureNarrow.ts +5 -0
- package/util/EnsureRecord.ts +3 -0
- package/util/Expand.ts +1 -0
- package/util/Falsy.ts +1 -0
- package/util/FromEntries.ts +3 -0
- package/util/IteratorLike.ts +1 -0
- package/util/JSONEntry.ts +3 -0
- package/util/JSONKey.ts +1 -0
- package/util/JSONObject.ts +6 -0
- package/util/JSONSchemaMemo.ts +15 -0
- package/util/JSONValue.ts +3 -0
- package/util/PromiseOr.ts +1 -0
- package/util/Result.ts +7 -0
- package/util/Taggable.ts +18 -0
- package/util/TupleToRecord.ts +5 -0
- package/util/assert.ts +7 -0
- package/util/dedent.ts +5 -0
- package/util/fixTemplateStrings.test.ts +250 -0
- package/util/fixTemplateStrings.ts +99 -0
- package/util/isAsyncIterator.ts +6 -0
- package/util/isIterator.ts +6 -0
- package/util/isJSONValue.ts +20 -0
- package/util/isPropertyKey.ts +3 -0
- package/util/isTemplateStringsArray.ts +3 -0
- package/util/jsonEquals.ts +41 -0
- package/util/nullaryMemo.ts +11 -0
- package/util/peekLast.ts +3 -0
- package/util/unimplemented.ts +5 -0
- package/util/unreachable.ts +5 -0
- package/util/unwrapDeferred.ts +5 -0
- package/util/util.ts +10 -0
- package/lib/index.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enableTool.js","sourceRoot":"","sources":["../../actions/enableTool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAKrC,OAAO,EAAE,IAAI,EAA4C,MAAM,YAAY,CAAA;AAG3E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAsC9C,MAAM,SAAS,CAAC,CAAC,UAAU,CACzB,GAAY,EACZ,WAAmB,EACnB,MAAyC,EACzC,cAAkC;IAElC,OAAO,MAAM,MAAM,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QACjD,KAAK,CAAC,KAAK,CAAC;YACV,IAAI,EAAE,cAAc;YACpB,WAAW;YACX,MAAM,EAAE,MAAM,cAAc,CAAC,MAAM,CAAC;YACpC,IAAI,EAAE,GAAG;SACV,CAAC,CAAA;QACF,MAAM,IAAI,GAAG,IAAI,CAAC;YAChB,OAAO,EAAE,GAAG;YACZ,WAAW;YACX,MAAM;YACN,cAAc;SACf,CAAC,CAAA;QACF,OAAO;YACL,GAAG,KAAK;YACR,KAAK,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YACtC,OAAO,EAAE,WAAW,CAAC,IAAI,CAAC;SAC3B,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as L from "../L.js";
|
|
2
|
+
import { AgentAssertions } from "../testing/AgentAssertions.js";
|
|
3
|
+
import { emit } from "./emit.js";
|
|
4
|
+
import { enableTool } from "./enableTool.js";
|
|
5
|
+
const P = L.object({
|
|
6
|
+
a: L.string,
|
|
7
|
+
b: L.string,
|
|
8
|
+
});
|
|
9
|
+
const arrowTool = L.enableTool("Tool", "", P, (params) => {
|
|
10
|
+
});
|
|
11
|
+
AgentAssertions(arrowTool).assertSpec();
|
|
12
|
+
function* _0() {
|
|
13
|
+
const detach = yield* arrowTool;
|
|
14
|
+
AgentAssertions(detach).assertSpec();
|
|
15
|
+
}
|
|
16
|
+
const genTool = enableTool("tool-key", "", P, function* (params) {
|
|
17
|
+
yield* emit("Test");
|
|
18
|
+
return "";
|
|
19
|
+
});
|
|
20
|
+
AgentAssertions(genTool).assertSpec();
|
|
21
|
+
function* parent() {
|
|
22
|
+
yield* L.enableTool("parent-tool", "", P, () => { });
|
|
23
|
+
yield* L.branch("fork-key", {
|
|
24
|
+
*"arm-key"() {
|
|
25
|
+
yield* arrowTool;
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
AgentAssertions(parent).assertSpec();
|
|
30
|
+
//# sourceMappingURL=enableTool.type-test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enableTool.type-test.js","sourceRoot":"","sources":["../../actions/enableTool.type-test.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAG5C,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;IACjB,CAAC,EAAE,CAAC,CAAC,MAAM;IACX,CAAC,EAAE,CAAC,CAAC,MAAM;CACZ,CAAC,CAAA;AAEF,MAAM,SAAS,GAAG,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE;AAEzD,CAAC,CAAC,CAAA;AAEF,eAAe,CAAC,SAAS,CAAC,CAAC,UAAU,EAWjC,CAAA;AAEJ,QAAQ,CAAC,CAAC,EAAE;IACV,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,SAAS,CAAA;IAC/B,eAAe,CAAC,MAAM,CAAC,CAAC,UAAU,EAM9B,CAAA;AACN,CAAC;AAED,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,EAAE,EAAE,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAC,MAAM;IAE5D,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACnB,OAAO,EAAE,CAAA;AACX,CAAC,CAAC,CAAA;AAEF,eAAe,CAAC,OAAO,CAAC,CAAC,UAAU,EAiB/B,CAAA;AAEJ,QAAQ,CAAC,CAAC,MAAM;IACd,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;IACnD,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE;QAC1B,CAAC,SAAS;YACR,KAAK,CAAC,CAAC,SAAS,CAAA;QAClB,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AAID,eAAe,CAAC,MAAM,CAAC,CAAC,UAAU,EAoC/B,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from "@standard-schema/spec";
|
|
2
|
+
import { Action } from "../Action.ts";
|
|
3
|
+
import type { InferenceRequested } from "../events/InferenceRequested.ts";
|
|
4
|
+
import type { Inferred } from "../events/Inferred.ts";
|
|
5
|
+
import type { Spec } from "../Spec.ts";
|
|
6
|
+
import type { JSONObject } from "../util/JSONObject.ts";
|
|
7
|
+
import type { JSONValue } from "../util/JSONValue.ts";
|
|
8
|
+
export { infer_ as infer };
|
|
9
|
+
interface infer_<_T> extends Action<"infer", Spec.Make<{
|
|
10
|
+
Event: InferenceRequested | Inferred;
|
|
11
|
+
}>> {
|
|
12
|
+
}
|
|
13
|
+
declare const infer_: (<T extends JSONValue>(type: StandardSchemaV1<JSONObject, T>) => Generator<infer_<T>, T>) & {
|
|
14
|
+
[Symbol.iterator](): Iterator<infer_<string>, string>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Action } from "../Action.js";
|
|
2
|
+
import { peekLast } from "../util/peekLast.js";
|
|
3
|
+
export { infer_ as infer };
|
|
4
|
+
const infer_ = Object.assign(function* infer_(type) {
|
|
5
|
+
return yield* impl(type);
|
|
6
|
+
}, {
|
|
7
|
+
*[Symbol.iterator]() {
|
|
8
|
+
return yield* impl();
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(infer_, "name", { value: "infer" });
|
|
12
|
+
function* impl(type) {
|
|
13
|
+
return yield Action("infer", async (scope) => {
|
|
14
|
+
scope.event({
|
|
15
|
+
type: "inference_requested",
|
|
16
|
+
});
|
|
17
|
+
const model = peekLast(scope.languageModels);
|
|
18
|
+
scope = await scope.reduce(model.infer(type));
|
|
19
|
+
scope.event({
|
|
20
|
+
type: "inferred",
|
|
21
|
+
value: scope.value,
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
...scope,
|
|
25
|
+
nextArg: scope.value,
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=infer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infer.js","sourceRoot":"","sources":["../../actions/infer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAMrC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE9C,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE,CAAA;AAW1B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAC1B,QAAQ,CAAC,CAAC,MAAM,CAAsB,IAAqC;IACzE,OAAO,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC1B,CAAC,EACD;IACE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,OAAO,KAAK,CAAC,CAAC,IAAI,EAAE,CAAA;IACtB,CAAC;CACF,CACF,CAAA;AACD,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;AAEzD,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAwC;IACrD,OAAO,MAAM,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QAC3C,KAAK,CAAC,KAAK,CAAC;YACV,IAAI,EAAE,qBAAqB;SAC5B,CAAC,CAAA;QACF,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAE,CAAA;QAC7C,KAAK,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;QAC7C,KAAK,CAAC,KAAK,CAAC;YACV,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,KAAK,CAAC,KAAK;SACnB,CAAC,CAAA;QACF,OAAO;YACL,GAAG,KAAK;YACR,OAAO,EAAE,KAAK,CAAC,KAAK;SACrB,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Action } from "../Action.ts";
|
|
2
|
+
import type { Agent } from "../Agent.ts";
|
|
3
|
+
import type { MessagesSet } from "../events/MessagesSet.ts";
|
|
4
|
+
import type { Message } from "../Message.ts";
|
|
5
|
+
import type { Spec } from "../Spec.ts";
|
|
6
|
+
import type { JSONKey } from "../util/JSONKey.ts";
|
|
7
|
+
import type { PromiseOr } from "../util/PromiseOr.ts";
|
|
8
|
+
import { type getScope } from "./scope.ts";
|
|
9
|
+
interface messages extends Iterable<getScope, Set<Message>> {
|
|
10
|
+
(messages: Array<Message>): Generator<Action<"set_messages", Spec.Make<{
|
|
11
|
+
Event: MessagesSet;
|
|
12
|
+
}>>, Array<Message>>;
|
|
13
|
+
(setter: (messages: Array<Message>) => PromiseOr<Array<Message>>): Generator<Action<"set_messages", Spec.Make<{
|
|
14
|
+
Event: MessagesSet;
|
|
15
|
+
}>>, Array<Message>>;
|
|
16
|
+
<K extends JSONKey, Y extends Action>(key: K, setter: (messages: Array<Message>) => Agent<Y, void>): Generator<Action<"set_messages", Spec.Make<{
|
|
17
|
+
Event: MessagesSet;
|
|
18
|
+
Child: [K, Y[""]];
|
|
19
|
+
Entry: Y[""]["Entry"];
|
|
20
|
+
Value: Array<Message>;
|
|
21
|
+
}>>, Array<Message>>;
|
|
22
|
+
}
|
|
23
|
+
export declare const messages: messages;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Action } from "../Action.js";
|
|
2
|
+
import { isPropertyKey } from "../util/isPropertyKey.js";
|
|
3
|
+
import { scope } from "./scope.js";
|
|
4
|
+
export const messages = Object.assign(messages_, {
|
|
5
|
+
*[Symbol.iterator]() {
|
|
6
|
+
const scope_ = yield* scope;
|
|
7
|
+
return scope_.messages;
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
function* messages_(setterOrKey, maybeSetter) {
|
|
11
|
+
return yield Action("set_messages", async (scope) => {
|
|
12
|
+
if (isPropertyKey(setterOrKey)) {
|
|
13
|
+
const setterScope = scope.fork("set_messages", [setterOrKey]);
|
|
14
|
+
const reduced = await setterScope.reduce(maybeSetter([...scope.messages]));
|
|
15
|
+
const { messages } = reduced;
|
|
16
|
+
setterScope.event({
|
|
17
|
+
type: "messages_set",
|
|
18
|
+
messages: [...messages],
|
|
19
|
+
});
|
|
20
|
+
return {
|
|
21
|
+
...scope,
|
|
22
|
+
messages,
|
|
23
|
+
nextArg: scope.messages,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const messages = new Set(Array.isArray(setterOrKey) ? setterOrKey : await setterOrKey([...scope.messages]));
|
|
27
|
+
return {
|
|
28
|
+
...scope,
|
|
29
|
+
messages,
|
|
30
|
+
nextArg: scope.messages,
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
Object.defineProperty(messages_, "name", { value: "messages" });
|
|
35
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../actions/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAKrC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAGxD,OAAO,EAAiB,KAAK,EAAE,MAAM,YAAY,CAAA;AAmBjD,MAAM,CAAC,MAAM,QAAQ,GAAa,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE;IACzD,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,KAAK,CAAA;QAC3B,OAAO,MAAM,CAAC,QAAQ,CAAA;IACxB,CAAC;CACF,CAAU,CAAA;AAEX,QAAQ,CAAC,CAAC,SAAS,CACjB,WAAgF,EAChF,WAA+D;IAE/D,OAAO,MAAM,MAAM,CAAC,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QAClD,IAAI,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC;YAC/B,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA;YAC7D,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,WAAY,CAAC,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;YAC3E,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;YAC5B,WAAW,CAAC,KAAK,CAAC;gBAChB,IAAI,EAAE,cAAc;gBACpB,QAAQ,EAAE,CAAC,GAAG,QAAQ,CAAC;aACxB,CAAC,CAAA;YACF,OAAO;gBACL,GAAG,KAAK;gBACR,QAAQ;gBACR,OAAO,EAAE,KAAK,CAAC,QAAQ;aACxB,CAAA;QACH,CAAC;QACD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,WAAW,CAAC,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;QAC3G,OAAO;YACL,GAAG,KAAK;YACR,QAAQ;YACR,OAAO,EAAE,KAAK,CAAC,QAAQ;SACxB,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AACD,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Action } from "../Action.ts";
|
|
2
|
+
import type { ModelPushed } from "../events/ModelPushed.ts";
|
|
3
|
+
import type { ModelRemoved } from "../events/ModelRemoved.ts";
|
|
4
|
+
import type { Model, ModelType } from "../Model.ts";
|
|
5
|
+
import type { Spec } from "../Spec.ts";
|
|
6
|
+
import type { JSONKey } from "../util/JSONKey.ts";
|
|
7
|
+
export interface pushModel<K extends JSONKey, M extends ModelType> extends Action<"remove_model", Spec.Make<{
|
|
8
|
+
Event: ModelPushed<K, M>;
|
|
9
|
+
}>> {
|
|
10
|
+
}
|
|
11
|
+
export interface removeModel<K extends JSONKey, M extends ModelType> extends Action<"remove_model", Spec.Make<{
|
|
12
|
+
Event: ModelRemoved<K, M>;
|
|
13
|
+
}>> {
|
|
14
|
+
}
|
|
15
|
+
export declare function pushModel<K extends JSONKey, M extends Model>(modelKey: K, model: M): Generator<pushModel<K, M["type"]>, Generator<removeModel<K, M["type"]>, void>>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Action } from "../Action.js";
|
|
2
|
+
import { applyToModels } from "./actions_common/updateModels.js";
|
|
3
|
+
export function* pushModel(modelKey, model) {
|
|
4
|
+
return yield Action("remove_model", (scope) => {
|
|
5
|
+
scope.event({
|
|
6
|
+
type: "model_pushed",
|
|
7
|
+
modelKey,
|
|
8
|
+
modelType: model.type,
|
|
9
|
+
});
|
|
10
|
+
return {
|
|
11
|
+
...scope,
|
|
12
|
+
...applyToModels(scope, model, (models) => {
|
|
13
|
+
models.add(model);
|
|
14
|
+
return models;
|
|
15
|
+
}),
|
|
16
|
+
nextArg: (function* () {
|
|
17
|
+
yield Action("remove_model", (scope) => {
|
|
18
|
+
scope.event({
|
|
19
|
+
type: "model_removed",
|
|
20
|
+
modelKey,
|
|
21
|
+
modelType: model.type,
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
...scope,
|
|
25
|
+
...applyToModels(scope, model, (models) => {
|
|
26
|
+
models.delete(model);
|
|
27
|
+
return models;
|
|
28
|
+
}),
|
|
29
|
+
nextArg: undefined,
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
})(),
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=pushModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pushModel.js","sourceRoot":"","sources":["../../actions/pushModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAMrC,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAA;AAUhE,MAAM,SAAS,CAAC,CAAC,SAAS,CACxB,QAAW,EACX,KAAQ;IAER,OAAO,MAAM,MAAM,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,EAAE;QAC5C,KAAK,CAAC,KAAK,CAAC;YACV,IAAI,EAAE,cAAc;YACpB,QAAQ;YACR,SAAS,EAAE,KAAK,CAAC,IAAI;SACtB,CAAC,CAAA;QACF,OAAO;YACL,GAAG,KAAK;YACR,GAAG,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE;gBACxC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;gBACjB,OAAO,MAAM,CAAA;YACf,CAAC,CAAC;YACF,OAAO,EAAE,CAAC,QAAQ,CAAC;gBACjB,MAAM,MAAM,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,EAAE;oBACrC,KAAK,CAAC,KAAK,CAAC;wBACV,IAAI,EAAE,eAAe;wBACrB,QAAQ;wBACR,SAAS,EAAE,KAAK,CAAC,IAAI;qBACtB,CAAC,CAAA;oBACF,OAAO;wBACL,GAAG,KAAK;wBACR,GAAG,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE;4BACxC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;4BACpB,OAAO,MAAM,CAAA;wBACf,CAAC,CAAC;wBACF,OAAO,EAAE,SAAS;qBACnB,CAAA;gBACH,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,EAAE;SACL,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../actions/scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAKrC,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,OAAO,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC3C,GAAG,KAAK;YACR,OAAO,EAAE,KAAK;SACf,CAAC,CAAC,CAAA;IACL,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Action } from "../Action.ts";
|
|
2
|
+
import type { AgentLike } from "../Agent.ts";
|
|
3
|
+
import type { SectionCleared } from "../events/SectionCleared.ts";
|
|
4
|
+
import type { Sectioned } from "../events/Sectioned.ts";
|
|
5
|
+
import type { Message } from "../Message.ts";
|
|
6
|
+
import type { Spec } from "../Spec.ts";
|
|
7
|
+
import type { JSONKey } from "../util/JSONKey.ts";
|
|
8
|
+
export interface section<K extends JSONKey> extends Action<"section", Spec.Make<{
|
|
9
|
+
Event: Sectioned<K>;
|
|
10
|
+
}>> {
|
|
11
|
+
}
|
|
12
|
+
export interface SectionHandle<K extends JSONKey> {
|
|
13
|
+
clear: Generator<Action<"clear_section", Spec.Make<{
|
|
14
|
+
Event: SectionCleared<K>;
|
|
15
|
+
}>>, void>;
|
|
16
|
+
getMessages: () => Generator<Action<"get_section_messages", never>, Set<Message>>;
|
|
17
|
+
<L extends JSONKey, Y extends Action, T>(key: L, agentLike: AgentLike<Y, T>): Generator<Action<"run_section", Spec.Make<{
|
|
18
|
+
Child: [L, Y[""]];
|
|
19
|
+
Entry: Y[""]["Entry"];
|
|
20
|
+
Value: T;
|
|
21
|
+
}>>, T>;
|
|
22
|
+
}
|
|
23
|
+
export declare function section<K extends JSONKey>(sectionKey: K): Generator<section<K>, SectionHandle<K>>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Action } from "../Action.js";
|
|
2
|
+
import { unwrapDeferred } from "../util/unwrapDeferred.js";
|
|
3
|
+
export function* section(sectionKey) {
|
|
4
|
+
return yield Action("section", (scope) => {
|
|
5
|
+
scope.event({
|
|
6
|
+
type: "sectioned",
|
|
7
|
+
sectionKey,
|
|
8
|
+
});
|
|
9
|
+
const section = {
|
|
10
|
+
sectionKey,
|
|
11
|
+
messages: new Set(),
|
|
12
|
+
};
|
|
13
|
+
scope.sections.add(section);
|
|
14
|
+
return {
|
|
15
|
+
...scope,
|
|
16
|
+
nextArg: Object.assign(function* (key, agentLike) {
|
|
17
|
+
return yield Action("run_section", async (scope) => {
|
|
18
|
+
const sectionScope = scope.fork("run_section", [key], {
|
|
19
|
+
messages: new Set(section.messages),
|
|
20
|
+
});
|
|
21
|
+
const reduced = await sectionScope.reduce(unwrapDeferred(agentLike));
|
|
22
|
+
const { value } = reduced;
|
|
23
|
+
sectionScope.event({
|
|
24
|
+
type: "returned",
|
|
25
|
+
value,
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
...scope,
|
|
29
|
+
nextArg: value,
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
}, {
|
|
33
|
+
getMessages: (function* () {
|
|
34
|
+
return yield Action("get_section_messages", (scope) => ({
|
|
35
|
+
...scope,
|
|
36
|
+
nextArg: new Set(section.messages),
|
|
37
|
+
}));
|
|
38
|
+
})(),
|
|
39
|
+
}, {
|
|
40
|
+
clear: (function* () {
|
|
41
|
+
return yield Action("clear_section", (scope) => {
|
|
42
|
+
const sections = new Set(scope.sections);
|
|
43
|
+
sections.delete(section);
|
|
44
|
+
const messages = new Set(scope.messages);
|
|
45
|
+
section.messages.forEach((message) => {
|
|
46
|
+
messages.delete(message);
|
|
47
|
+
});
|
|
48
|
+
scope.event({
|
|
49
|
+
type: "section_cleared",
|
|
50
|
+
sectionKey,
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
...scope,
|
|
54
|
+
nextArg: messages,
|
|
55
|
+
sections,
|
|
56
|
+
messages,
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
})(),
|
|
60
|
+
}),
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=section.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section.js","sourceRoot":"","sources":["../../actions/section.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAQrC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAqB1D,MAAM,SAAS,CAAC,CAAC,OAAO,CAAoB,UAAa;IACvD,OAAO,MAAM,MAAM,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;QACvC,KAAK,CAAC,KAAK,CAAC;YACV,IAAI,EAAE,WAAW;YACjB,UAAU;SACX,CAAC,CAAA;QACF,MAAM,OAAO,GAAY;YACvB,UAAU;YACV,QAAQ,EAAE,IAAI,GAAG,EAAE;SACpB,CAAA;QACD,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QAC3B,OAAO;YACL,GAAG,KAAK;YACR,OAAO,EAAE,MAAM,CAAC,MAAM,CACpB,QAAQ,CAAC,EAAyC,GAAM,EAAE,SAA0B;gBAWlF,OAAO,MAAM,MAAM,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;oBACjD,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,GAAG,CAAC,EAAE;wBACpD,QAAQ,EAAE,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;qBACpC,CAAC,CAAA;oBACF,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAA;oBACpE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAA;oBACzB,YAAY,CAAC,KAAK,CAAC;wBACjB,IAAI,EAAE,UAAU;wBAChB,KAAK;qBACN,CAAC,CAAA;oBACF,OAAO;wBACL,GAAG,KAAK;wBACR,OAAO,EAAE,KAAK;qBACf,CAAA;gBACH,CAAC,CAAC,CAAA;YACJ,CAAC,EACD;gBACE,WAAW,EAAE,CAAC,QAAQ,CAAC;oBACrB,OAAO,MAAM,MAAM,CAAC,sBAAsB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;wBACtD,GAAG,KAAK;wBACR,OAAO,EAAE,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;qBACnC,CAAC,CAAC,CAAA;gBACL,CAAC,CAAC,EAAE;aACL,EACD;gBACE,KAAK,EACH,CAAC,QAAQ,CAAC;oBACR,OAAO,MAAM,MAAM,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE;wBAC7C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;wBACxC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;wBACxB,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;wBACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;4BACnC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;wBAC1B,CAAC,CAAC,CAAA;wBACF,KAAK,CAAC,KAAK,CAAC;4BACV,IAAI,EAAE,iBAAiB;4BACvB,UAAU;yBACX,CAAC,CAAA;wBACF,OAAO;4BACL,GAAG,KAAK;4BACR,OAAO,EAAE,QAAQ;4BACjB,QAAQ;4BACR,QAAQ;yBACT,CAAA;oBACH,CAAC,CAAC,CAAA;gBACJ,CAAC,CAAC,EAAE;aACP,CACF;SACF,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Action } from "../Action.ts";
|
|
2
|
+
import type { Spec } from "../Spec.ts";
|
|
3
|
+
import type { EnsureNarrow } from "../util/EnsureNarrow.ts";
|
|
4
|
+
export { throw_ as throw };
|
|
5
|
+
interface throw_<V> extends Action<"throw", Spec.Make<{
|
|
6
|
+
Throw: V;
|
|
7
|
+
}>> {
|
|
8
|
+
}
|
|
9
|
+
declare function throw_<V>(value: V, ...[_error]: EnsureNarrow<V>): Generator<throw_<V>, never>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Action } from "../Action.js";
|
|
2
|
+
export { throw_ as throw };
|
|
3
|
+
function* throw_(value, ...[_error]) {
|
|
4
|
+
return (yield Action("throw", (scope) => {
|
|
5
|
+
return {
|
|
6
|
+
...scope,
|
|
7
|
+
thrown: value,
|
|
8
|
+
nextArg: undefined,
|
|
9
|
+
};
|
|
10
|
+
}));
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(throw_, "name", { value: "throw" });
|
|
13
|
+
//# sourceMappingURL=throw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throw.js","sourceRoot":"","sources":["../../actions/throw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAIrC,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE,CAAA;AAI1B,QAAQ,CAAC,CAAC,MAAM,CAAI,KAAQ,EAAE,GAAG,CAAC,MAAM,CAAkB;IACxD,OAAO,CAAC,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;QACtC,OAAO;YACL,GAAG,KAAK;YACR,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,SAAS;SACnB,CAAA;IACH,CAAC,CAAC,CAAU,CAAA;AACd,CAAC;AACD,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ParsedPath } from "node:path";
|
|
2
|
+
import type { EventResolved } from "../events/EventResolved.ts";
|
|
3
|
+
export declare function WriteHandler({ stateDir, parsedPath, configDir, startTime, }: {
|
|
4
|
+
stateDir: string;
|
|
5
|
+
execId: string | undefined;
|
|
6
|
+
parsedPath: ParsedPath;
|
|
7
|
+
startTime: number;
|
|
8
|
+
configDir: string;
|
|
9
|
+
}): Promise<(event: EventResolved) => Promise<void>>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
2
|
+
import { relative, resolve } from "node:path";
|
|
3
|
+
export async function WriteHandler({ stateDir, parsedPath, configDir, startTime, }) {
|
|
4
|
+
const destDir = resolve(stateDir, relative(configDir, parsedPath.dir), parsedPath.name, startTime.toString());
|
|
5
|
+
let ensureDir;
|
|
6
|
+
let i = 0;
|
|
7
|
+
return async (event) => {
|
|
8
|
+
if (!ensureDir) {
|
|
9
|
+
ensureDir = Promise.withResolvers();
|
|
10
|
+
(async () => {
|
|
11
|
+
try {
|
|
12
|
+
await mkdir(destDir, { recursive: true });
|
|
13
|
+
}
|
|
14
|
+
catch (_e) { }
|
|
15
|
+
ensureDir.resolve();
|
|
16
|
+
})();
|
|
17
|
+
}
|
|
18
|
+
await ensureDir.promise;
|
|
19
|
+
const key = `${i++}__${event.scope.join("__")}__${event.type}.json`;
|
|
20
|
+
const destPath = resolve(destDir, key);
|
|
21
|
+
await writeFile(destPath, JSON.stringify(event, null, 2), "utf-8");
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=WriteHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WriteHandler.js","sourceRoot":"","sources":["../../cli/WriteHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAmB,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAG9D,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,EACjC,QAAQ,EACR,UAAU,EACV,SAAS,EACT,SAAS,GAOV;IACC,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAA;IAC7G,IAAI,SAAiD,CAAA;IACrD,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,OAAO,KAAK,EAAE,KAAK,EAAE,EAAE;QACrB,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,SAAS,GAAG,OAAO,CAAC,aAAa,EAAE,CAClC;YAAA,CAAC,KAAK,IAAI,EAAE;gBACX,IAAI,CAAC;oBACH,MAAM,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;gBAC3C,CAAC;gBAAC,OAAO,EAAW,EAAE,CAAC,CAAA,CAAC;gBACxB,SAAS,CAAC,OAAO,EAAE,CAAA;YACrB,CAAC,CAAC,EAAE,CAAA;QACN,CAAC;QACD,MAAM,SAAS,CAAC,OAAO,CAAA;QACvB,MAAM,GAAG,GAAG,GAAG,CAAC,EAAE,KAAK,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,OAAO,CAAA;QACnE,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;QACtC,MAAM,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;IACpE,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli_common.js","sourceRoot":"","sources":["../../cli/cli_common.ts"],"names":[],"mappings":""}
|
package/dist/cli/main.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import process from "node:process";
|
|
3
|
+
import { L } from "../index.js";
|
|
4
|
+
import { runExec } from "./runExec.js";
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
const command = L.enum("exec").assert(args.shift());
|
|
7
|
+
const ctl = new AbortController();
|
|
8
|
+
const cliCtx = {
|
|
9
|
+
ctl,
|
|
10
|
+
error(message) {
|
|
11
|
+
throw new Error(message);
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
switch (command) {
|
|
15
|
+
case "exec": {
|
|
16
|
+
await runExec(cliCtx, args);
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../cli/main.ts"],"names":[],"mappings":";AAEA,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAA;AAE/B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAClC,MAAM,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAA;AACnD,MAAM,GAAG,GAAG,IAAI,eAAe,EAAE,CAAA;AAEjC,MAAM,MAAM,GAAW;IACrB,GAAG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAA;IAC1B,CAAC;CACF,CAAA;AAED,QAAQ,OAAO,EAAE,CAAC;IAChB,KAAK,MAAM,CAAC,CAAC,CAAC;QACZ,MAAM,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAC3B,MAAK;IACP,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
import { dirname, isAbsolute, parse, resolve } from "node:path";
|
|
10
|
+
import { parseArgs } from "node:util";
|
|
11
|
+
import { exec, L } from "../index.js";
|
|
12
|
+
import { WriteHandler } from "./WriteHandler.js";
|
|
13
|
+
const options = {
|
|
14
|
+
config: {
|
|
15
|
+
type: "string",
|
|
16
|
+
default: "liminal.ts",
|
|
17
|
+
short: "c",
|
|
18
|
+
},
|
|
19
|
+
execId: {
|
|
20
|
+
type: "string",
|
|
21
|
+
short: "i",
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
export async function runExec(ctx, args) {
|
|
25
|
+
let { values: { config: configPath, execId, }, positionals, } = parseArgs({
|
|
26
|
+
args,
|
|
27
|
+
strict: true,
|
|
28
|
+
allowPositionals: true,
|
|
29
|
+
options,
|
|
30
|
+
});
|
|
31
|
+
const configPathResolved = resolve(configPath);
|
|
32
|
+
const configDir = dirname(configPathResolved);
|
|
33
|
+
const config = await import(__rewriteRelativeImportExtension(configPathResolved)).then(({ default: default_ }) => default_);
|
|
34
|
+
const agentPathInitial = L.string.assert(positionals[0]);
|
|
35
|
+
let agentPathResolved;
|
|
36
|
+
if (isAbsolute(agentPathInitial)) {
|
|
37
|
+
agentPathResolved = agentPathInitial;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
agentPathResolved = resolve(configDir, ...config.agents ? [config.agents] : [], agentPathInitial);
|
|
41
|
+
}
|
|
42
|
+
if (!agentPathResolved.endsWith(".ts")) {
|
|
43
|
+
agentPathResolved = `${agentPathResolved}.ts`;
|
|
44
|
+
}
|
|
45
|
+
const parsedPath = parse(agentPathResolved);
|
|
46
|
+
let agentLike;
|
|
47
|
+
try {
|
|
48
|
+
agentLike = await import(__rewriteRelativeImportExtension(agentPathResolved)).then(({ default: default_ }) => default_);
|
|
49
|
+
}
|
|
50
|
+
catch (_e) {
|
|
51
|
+
ctx.error(`Could not fine agent file at "${agentPathResolved}".`);
|
|
52
|
+
}
|
|
53
|
+
const startTime = Date.now();
|
|
54
|
+
const writeHandlerOrNoop = config.write
|
|
55
|
+
? await WriteHandler({
|
|
56
|
+
configDir,
|
|
57
|
+
parsedPath,
|
|
58
|
+
execId,
|
|
59
|
+
startTime,
|
|
60
|
+
stateDir: typeof config.write === "string" ? config.write : ".liminal",
|
|
61
|
+
})
|
|
62
|
+
: undefined;
|
|
63
|
+
const printHandlerOrNoop = config.silent ? undefined : (event) => console.log(event);
|
|
64
|
+
await exec(agentLike, {
|
|
65
|
+
default: config.default,
|
|
66
|
+
args: config.args,
|
|
67
|
+
handler(event) {
|
|
68
|
+
printHandlerOrNoop?.(event);
|
|
69
|
+
writeHandlerOrNoop?.(event);
|
|
70
|
+
},
|
|
71
|
+
signal: ctx.ctl.signal,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=runExec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runExec.js","sourceRoot":"","sources":["../../cli/runExec.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Aborted.js","sourceRoot":"","sources":["../../events/Aborted.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Embedded.js","sourceRoot":"","sources":["../../events/Embedded.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmbeddingRequested.js","sourceRoot":"","sources":["../../events/EmbeddingRequested.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Emitted.js","sourceRoot":"","sources":["../../events/Emitted.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventBase.js","sourceRoot":"","sources":["../../events/EventBase.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventHandler.js","sourceRoot":"","sources":["../../events/EventHandler.ts"],"names":[],"mappings":""}
|