liminal 0.5.2 → 0.5.4
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/Agent.ts +25 -7
- package/CHANGELOG.md +19 -0
- package/EventBase.ts +13 -0
- package/Fiber.ts +67 -0
- package/Globals.ts +10 -0
- package/Handler.ts +0 -0
- package/L/L.ts +12 -0
- package/L/_infer.ts +40 -0
- package/L/_message.ts +16 -0
- package/L/all.ts +11 -0
- package/L/assistant.ts +27 -0
- package/L/branch.ts +51 -0
- package/L/emit.ts +10 -0
- package/L/fork.ts +20 -0
- package/L/join.ts +9 -0
- package/L/model.ts +12 -0
- package/L/namespace.ts +11 -0
- package/L/rune.ts +19 -0
- package/L/self.ts +13 -0
- package/L/system.ts +13 -0
- package/L/user.ts +13 -0
- package/LEvent.ts +58 -0
- package/Message.ts +11 -90
- package/Model.ts +10 -23
- package/Rune.ts +17 -0
- package/Runic.ts +22 -0
- package/cli/main.ts +1 -24
- package/dist/Agent.d.ts +12 -7
- package/dist/Agent.js +14 -1
- package/dist/Agent.js.map +1 -1
- package/dist/EventBase.d.ts +7 -0
- package/dist/EventBase.js +14 -0
- package/dist/EventBase.js.map +1 -0
- package/dist/Fiber.d.ts +24 -0
- package/dist/Fiber.js +37 -0
- package/dist/Fiber.js.map +1 -0
- package/dist/Globals.d.ts +6 -0
- package/dist/Globals.js +2 -0
- package/dist/Globals.js.map +1 -0
- package/dist/Handler.js +2 -0
- package/dist/Handler.js.map +1 -0
- package/dist/L/L.d.ts +12 -0
- package/dist/L/L.js +13 -0
- package/dist/L/L.js.map +1 -0
- package/dist/L/_infer.d.ts +4 -0
- package/dist/L/_infer.js +32 -0
- package/dist/L/_infer.js.map +1 -0
- package/dist/L/_message.d.ts +6 -0
- package/dist/L/_message.js +12 -0
- package/dist/L/_message.js.map +1 -0
- package/dist/L/all.d.ts +7 -0
- package/dist/L/all.js +5 -0
- package/dist/L/all.js.map +1 -0
- package/dist/L/assistant.d.ts +7 -0
- package/dist/L/assistant.js +18 -0
- package/dist/L/assistant.js.map +1 -0
- package/dist/L/branch.d.ts +11 -0
- package/dist/L/branch.js +41 -0
- package/dist/L/branch.js.map +1 -0
- package/dist/L/emit.d.ts +5 -0
- package/dist/L/emit.js +6 -0
- package/dist/L/emit.js.map +1 -0
- package/dist/L/fork.js +20 -0
- package/dist/L/fork.js.map +1 -0
- package/dist/L/join.d.ts +5 -0
- package/dist/L/join.js +5 -0
- package/dist/L/join.js.map +1 -0
- package/dist/L/model.d.ts +5 -0
- package/dist/L/model.js +8 -0
- package/dist/L/model.js.map +1 -0
- package/dist/L/namespace.js +12 -0
- package/dist/L/namespace.js.map +1 -0
- package/dist/L/rune.d.ts +6 -0
- package/dist/L/rune.js +11 -0
- package/dist/L/rune.js.map +1 -0
- package/dist/L/self.d.ts +6 -0
- package/dist/L/self.js +7 -0
- package/dist/L/self.js.map +1 -0
- package/dist/L/system.d.ts +6 -0
- package/dist/L/system.js +7 -0
- package/dist/L/system.js.map +1 -0
- package/dist/L/user.d.ts +6 -0
- package/dist/L/user.js +7 -0
- package/dist/L/user.js.map +1 -0
- package/dist/LEvent.d.ts +31 -0
- package/dist/LEvent.js +49 -0
- package/dist/LEvent.js.map +1 -0
- package/dist/Message.d.ts +12 -81
- package/dist/Model.d.ts +4 -20
- package/dist/Model.js +6 -0
- package/dist/Model.js.map +1 -1
- package/dist/Rune.d.ts +11 -0
- package/dist/Rune.js +5 -0
- package/dist/Rune.js.map +1 -0
- package/dist/Runic.d.ts +9 -0
- package/dist/Runic.js +18 -0
- package/dist/Runic.js.map +1 -0
- package/dist/cli/main.d.ts +0 -1
- package/dist/cli/main.js +2 -19
- package/dist/cli/main.js.map +1 -1
- package/dist/index.d.ts +10 -38
- package/dist/index.js +10 -38
- package/dist/index.js.map +1 -1
- package/dist/run.d.ts +3 -0
- package/dist/run.js +35 -0
- package/dist/run.js.map +1 -0
- package/dist/state/Context.d.ts +8 -0
- package/dist/state/Context.js +17 -0
- package/dist/state/Context.js.map +1 -0
- package/dist/state/MessageRegistry.d.ts +8 -0
- package/dist/state/MessageRegistry.js +17 -0
- package/dist/state/MessageRegistry.js.map +1 -0
- package/dist/state/ModelConfig.d.ts +49 -0
- package/dist/state/ModelConfig.js +18 -0
- package/dist/state/ModelConfig.js.map +1 -0
- package/dist/state/ModelRegistry.d.ts +16 -0
- package/dist/state/ModelRegistry.js +52 -0
- package/dist/state/ModelRegistry.js.map +1 -0
- package/dist/state/StateMap.d.ts +8 -0
- package/dist/state/StateMap.js +18 -0
- package/dist/state/StateMap.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/index.ts +10 -38
- package/package.json +6 -10
- package/run.ts +39 -0
- package/state/Context.ts +19 -0
- package/state/MessageRegistry.ts +21 -0
- package/state/ModelConfig.ts +49 -0
- package/state/ModelRegistry.ts +65 -0
- package/state/StateMap.ts +24 -0
- package/tsconfig.json +5 -1
- package/Action.ts +0 -29
- package/Exec.ts +0 -51
- package/L.ts +0 -24
- package/LiminalAssertionError.ts +0 -3
- package/LiminalConfig.ts +0 -7
- package/PathLike.ts +0 -17
- package/Scope.ts +0 -152
- package/Spec.ts +0 -29
- package/Tool.ts +0 -58
- package/_.ts +0 -11
- package/actions/abort.ts +0 -23
- package/actions/actions_common/updateModels.ts +0 -23
- package/actions/actions_derived/__snapshots__/declareModel.test.ts.snap +0 -89
- package/actions/actions_derived/clear.ts +0 -6
- package/actions/actions_derived/declareModel.test.ts +0 -36
- package/actions/actions_derived/declareModel.ts +0 -9
- package/actions/actions_derived/declareModel.type-test.ts +0 -70
- package/actions/actions_derived/messages.test.ts +0 -88
- package/actions/actions_derived/messages.ts +0 -18
- package/actions/actions_derived/metatype.ts +0 -9
- package/actions/actions_derived/readers_derived.ts +0 -15
- package/actions/appendMessage.ts +0 -54
- package/actions/await.ts +0 -13
- package/actions/branch.ts +0 -106
- package/actions/catch.ts +0 -42
- package/actions/declareArg.ts +0 -14
- package/actions/disableTool.ts +0 -26
- package/actions/embed.ts +0 -29
- package/actions/emit.ts +0 -21
- package/actions/enableTool.ts +0 -75
- package/actions/enableTool.type-test.ts +0 -118
- package/actions/infer.ts +0 -49
- package/actions/messages.ts +0 -62
- package/actions/pushModel.ts +0 -52
- package/actions/scope.ts +0 -13
- package/actions/section.ts +0 -105
- package/actions/throw.ts +0 -18
- package/cli/WriteHandler.ts +0 -35
- package/cli/cli_common.ts +0 -4
- package/cli/runExec.ts +0 -72
- package/dist/Action.d.ts +0 -15
- package/dist/Action.js +0 -13
- package/dist/Action.js.map +0 -1
- package/dist/Exec.d.ts +0 -25
- package/dist/Exec.js +0 -19
- package/dist/Exec.js.map +0 -1
- package/dist/L.d.ts +0 -23
- package/dist/L.js +0 -24
- package/dist/L.js.map +0 -1
- package/dist/LiminalAssertionError.d.ts +0 -3
- package/dist/LiminalAssertionError.js +0 -4
- package/dist/LiminalAssertionError.js.map +0 -1
- package/dist/LiminalConfig.d.ts +0 -6
- package/dist/LiminalConfig.js +0 -2
- package/dist/LiminalConfig.js.map +0 -1
- package/dist/PathLike.d.ts +0 -11
- package/dist/PathLike.js +0 -2
- package/dist/PathLike.js.map +0 -1
- package/dist/Scope.d.ts +0 -42
- package/dist/Scope.js +0 -93
- package/dist/Scope.js.map +0 -1
- package/dist/Spec.d.ts +0 -20
- package/dist/Spec.js +0 -2
- package/dist/Spec.js.map +0 -1
- package/dist/Tool.d.ts +0 -21
- package/dist/Tool.js +0 -32
- package/dist/Tool.js.map +0 -1
- package/dist/_.d.ts +0 -5
- package/dist/_.js +0 -7
- package/dist/_.js.map +0 -1
- package/dist/actions/abort.d.ts +0 -9
- package/dist/actions/abort.js +0 -15
- package/dist/actions/abort.js.map +0 -1
- package/dist/actions/actions_common/updateModels.d.ts +0 -3
- package/dist/actions/actions_common/updateModels.js +0 -17
- package/dist/actions/actions_common/updateModels.js.map +0 -1
- package/dist/actions/actions_derived/clear.d.ts +0 -8
- package/dist/actions/actions_derived/clear.js +0 -5
- package/dist/actions/actions_derived/clear.js.map +0 -1
- package/dist/actions/actions_derived/declareModel.d.ts +0 -5
- package/dist/actions/actions_derived/declareModel.js +0 -7
- package/dist/actions/actions_derived/declareModel.js.map +0 -1
- package/dist/actions/actions_derived/declareModel.test.js +0 -35
- package/dist/actions/actions_derived/declareModel.test.js.map +0 -1
- package/dist/actions/actions_derived/declareModel.type-test.js +0 -66
- package/dist/actions/actions_derived/declareModel.type-test.js.map +0 -1
- package/dist/actions/actions_derived/messages.d.ts +0 -6
- package/dist/actions/actions_derived/messages.js +0 -15
- package/dist/actions/actions_derived/messages.js.map +0 -1
- package/dist/actions/actions_derived/messages.test.js +0 -72
- package/dist/actions/actions_derived/messages.test.js.map +0 -1
- package/dist/actions/actions_derived/metatype.d.ts +0 -9
- package/dist/actions/actions_derived/metatype.js +0 -7
- package/dist/actions/actions_derived/metatype.js.map +0 -1
- package/dist/actions/actions_derived/readers_derived.d.ts +0 -6
- package/dist/actions/actions_derived/readers_derived.js +0 -14
- package/dist/actions/actions_derived/readers_derived.js.map +0 -1
- package/dist/actions/appendMessage.d.ts +0 -14
- package/dist/actions/appendMessage.js +0 -41
- package/dist/actions/appendMessage.js.map +0 -1
- package/dist/actions/await.d.ts +0 -5
- package/dist/actions/await.js +0 -10
- package/dist/actions/await.js.map +0 -1
- package/dist/actions/branch.d.ts +0 -39
- package/dist/actions/branch.js +0 -40
- package/dist/actions/branch.js.map +0 -1
- package/dist/actions/catch.d.ts +0 -10
- package/dist/actions/catch.js +0 -27
- package/dist/actions/catch.js.map +0 -1
- package/dist/actions/declareArg.d.ts +0 -8
- package/dist/actions/declareArg.js +0 -10
- package/dist/actions/declareArg.js.map +0 -1
- package/dist/actions/disableTool.d.ts +0 -10
- package/dist/actions/disableTool.js +0 -17
- package/dist/actions/disableTool.js.map +0 -1
- package/dist/actions/embed.d.ts +0 -9
- package/dist/actions/embed.js +0 -24
- package/dist/actions/embed.js.map +0 -1
- package/dist/actions/emit.d.ts +0 -9
- package/dist/actions/emit.js +0 -14
- package/dist/actions/emit.js.map +0 -1
- package/dist/actions/enableTool.d.ts +0 -20
- package/dist/actions/enableTool.js +0 -26
- package/dist/actions/enableTool.js.map +0 -1
- package/dist/actions/enableTool.type-test.d.ts +0 -1
- package/dist/actions/enableTool.type-test.js +0 -30
- package/dist/actions/enableTool.type-test.js.map +0 -1
- package/dist/actions/infer.d.ts +0 -15
- package/dist/actions/infer.js +0 -29
- package/dist/actions/infer.js.map +0 -1
- package/dist/actions/messages.d.ts +0 -24
- package/dist/actions/messages.js +0 -35
- package/dist/actions/messages.js.map +0 -1
- package/dist/actions/pushModel.d.ts +0 -15
- package/dist/actions/pushModel.js +0 -36
- package/dist/actions/pushModel.js.map +0 -1
- package/dist/actions/scope.d.ts +0 -7
- package/dist/actions/scope.js +0 -10
- package/dist/actions/scope.js.map +0 -1
- package/dist/actions/section.d.ts +0 -23
- package/dist/actions/section.js +0 -64
- package/dist/actions/section.js.map +0 -1
- package/dist/actions/throw.d.ts +0 -9
- package/dist/actions/throw.js +0 -13
- package/dist/actions/throw.js.map +0 -1
- package/dist/cli/WriteHandler.d.ts +0 -9
- package/dist/cli/WriteHandler.js +0 -24
- package/dist/cli/WriteHandler.js.map +0 -1
- package/dist/cli/cli_common.d.ts +0 -4
- package/dist/cli/cli_common.js +0 -2
- package/dist/cli/cli_common.js.map +0 -1
- package/dist/cli/runExec.d.ts +0 -2
- package/dist/cli/runExec.js +0 -74
- package/dist/cli/runExec.js.map +0 -1
- package/dist/events/Aborted.d.ts +0 -4
- package/dist/events/Aborted.js +0 -2
- package/dist/events/Aborted.js.map +0 -1
- package/dist/events/Embedded.d.ts +0 -5
- package/dist/events/Embedded.js +0 -2
- package/dist/events/Embedded.js.map +0 -1
- package/dist/events/EmbeddingRequested.d.ts +0 -4
- package/dist/events/EmbeddingRequested.js +0 -2
- package/dist/events/EmbeddingRequested.js.map +0 -1
- package/dist/events/Emitted.d.ts +0 -4
- package/dist/events/Emitted.js +0 -2
- package/dist/events/Emitted.js.map +0 -1
- package/dist/events/EventBase.d.ts +0 -3
- package/dist/events/EventBase.js +0 -2
- package/dist/events/EventBase.js.map +0 -1
- package/dist/events/EventHandler.d.ts +0 -2
- package/dist/events/EventHandler.js +0 -2
- package/dist/events/EventHandler.js.map +0 -1
- package/dist/events/EventResolved.d.ts +0 -19
- package/dist/events/EventResolved.js +0 -2
- package/dist/events/EventResolved.js.map +0 -1
- package/dist/events/Forked.d.ts +0 -3
- package/dist/events/Forked.js +0 -2
- package/dist/events/Forked.js.map +0 -1
- package/dist/events/InferenceRequested.d.ts +0 -3
- package/dist/events/InferenceRequested.js +0 -2
- package/dist/events/InferenceRequested.js.map +0 -1
- package/dist/events/Inferred.d.ts +0 -5
- package/dist/events/Inferred.js +0 -2
- package/dist/events/Inferred.js.map +0 -1
- package/dist/events/LEvent.d.ts +0 -20
- package/dist/events/LEvent.js +0 -2
- package/dist/events/LEvent.js.map +0 -1
- package/dist/events/MessageAppended.d.ts +0 -5
- package/dist/events/MessageAppended.js +0 -2
- package/dist/events/MessageAppended.js.map +0 -1
- package/dist/events/MessageRemoved.d.ts +0 -5
- package/dist/events/MessageRemoved.js +0 -2
- package/dist/events/MessageRemoved.js.map +0 -1
- package/dist/events/MessagesSet.d.ts +0 -5
- package/dist/events/MessagesSet.js +0 -2
- package/dist/events/MessagesSet.js.map +0 -1
- package/dist/events/ModelPushed.d.ts +0 -7
- package/dist/events/ModelPushed.js +0 -2
- package/dist/events/ModelPushed.js.map +0 -1
- package/dist/events/ModelRemoved.d.ts +0 -7
- package/dist/events/ModelRemoved.js +0 -2
- package/dist/events/ModelRemoved.js.map +0 -1
- package/dist/events/Returned.d.ts +0 -4
- package/dist/events/Returned.js +0 -2
- package/dist/events/Returned.js.map +0 -1
- package/dist/events/SectionCleared.d.ts +0 -5
- package/dist/events/SectionCleared.js +0 -2
- package/dist/events/SectionCleared.js.map +0 -1
- package/dist/events/Sectioned.d.ts +0 -5
- package/dist/events/Sectioned.js +0 -2
- package/dist/events/Sectioned.js.map +0 -1
- package/dist/events/Threw.d.ts +0 -4
- package/dist/events/Threw.js +0 -2
- package/dist/events/Threw.js.map +0 -1
- package/dist/events/ToolCalled.d.ts +0 -6
- package/dist/events/ToolCalled.js +0 -2
- package/dist/events/ToolCalled.js.map +0 -1
- package/dist/events/ToolDisabled.d.ts +0 -5
- package/dist/events/ToolDisabled.js +0 -2
- package/dist/events/ToolDisabled.js.map +0 -1
- package/dist/events/ToolEnabled.d.ts +0 -7
- package/dist/events/ToolEnabled.js +0 -2
- package/dist/events/ToolEnabled.js.map +0 -1
- package/dist/events/isScopeChildEvent.d.ts +0 -6
- package/dist/events/isScopeChildEvent.js +0 -9
- package/dist/events/isScopeChildEvent.js.map +0 -1
- package/dist/events/isScopeDescendantEvent.d.ts +0 -14
- package/dist/events/isScopeDescendantEvent.js +0 -12
- package/dist/events/isScopeDescendantEvent.js.map +0 -1
- package/dist/testing/AgentAssertions.d.ts +0 -9
- package/dist/testing/AgentAssertions.js +0 -6
- package/dist/testing/AgentAssertions.js.map +0 -1
- package/dist/testing/TestEmbeddingModel.d.ts +0 -6
- package/dist/testing/TestEmbeddingModel.js +0 -11
- package/dist/testing/TestEmbeddingModel.js.map +0 -1
- package/dist/testing/TestLanguageModel.d.ts +0 -8
- package/dist/testing/TestLanguageModel.js +0 -22
- package/dist/testing/TestLanguageModel.js.map +0 -1
- package/dist/testing/index.d.ts +0 -4
- package/dist/testing/index.js +0 -5
- package/dist/testing/index.js.map +0 -1
- package/dist/testing/takeFirstAction.d.ts +0 -3
- package/dist/testing/takeFirstAction.js +0 -6
- package/dist/testing/takeFirstAction.js.map +0 -1
- package/dist/types/AssertDiagnostics.d.ts +0 -18
- package/dist/types/AssertDiagnostics.js +0 -152
- package/dist/types/AssertDiagnostics.js.map +0 -1
- package/dist/types/JSONRootType.d.ts +0 -6
- package/dist/types/JSONRootType.js +0 -2
- package/dist/types/JSONRootType.js.map +0 -1
- package/dist/types/JSONType.d.ts +0 -16
- package/dist/types/JSONType.js +0 -2
- package/dist/types/JSONType.js.map +0 -1
- package/dist/types/JSONTypeBase.d.ts +0 -3
- package/dist/types/JSONTypeBase.js +0 -2
- package/dist/types/JSONTypeBase.js.map +0 -1
- package/dist/types/Metatype/MetatypeDescriptor.d.ts +0 -41
- package/dist/types/Metatype/MetatypeDescriptor.js +0 -38
- package/dist/types/Metatype/MetatypeDescriptor.js.map +0 -1
- package/dist/types/Metatype/fromMetatypeDescriptor.d.ts +0 -6
- package/dist/types/Metatype/fromMetatypeDescriptor.js +0 -43
- package/dist/types/Metatype/fromMetatypeDescriptor.js.map +0 -1
- package/dist/types/Type.d.ts +0 -31
- package/dist/types/Type.js +0 -5
- package/dist/types/Type.js.map +0 -1
- package/dist/types/TypeContext.d.ts +0 -7
- package/dist/types/TypeContext.js +0 -17
- package/dist/types/TypeContext.js.map +0 -1
- package/dist/types/TypeLike.d.ts +0 -23
- package/dist/types/TypeLike.js +0 -23
- package/dist/types/TypeLike.js.map +0 -1
- package/dist/types/TypeVisitor.d.ts +0 -14
- package/dist/types/TypeVisitor.js +0 -12
- package/dist/types/TypeVisitor.js.map +0 -1
- package/dist/types/array.d.ts +0 -10
- package/dist/types/array.js +0 -9
- package/dist/types/array.js.map +0 -1
- package/dist/types/boolean.d.ts +0 -6
- package/dist/types/boolean.js +0 -3
- package/dist/types/boolean.js.map +0 -1
- package/dist/types/const.d.ts +0 -8
- package/dist/types/const.js +0 -7
- package/dist/types/const.js.map +0 -1
- package/dist/types/enum.d.ts +0 -8
- package/dist/types/enum.js +0 -7
- package/dist/types/enum.js.map +0 -1
- package/dist/types/factories.d.ts +0 -8
- package/dist/types/factories.js +0 -9
- package/dist/types/factories.js.map +0 -1
- package/dist/types/index.d.ts +0 -2
- package/dist/types/index.js +0 -3
- package/dist/types/index.js.map +0 -1
- package/dist/types/integer.d.ts +0 -6
- package/dist/types/integer.js +0 -3
- package/dist/types/integer.js.map +0 -1
- package/dist/types/intrinsics.d.ts +0 -11
- package/dist/types/intrinsics.js +0 -12
- package/dist/types/intrinsics.js.map +0 -1
- package/dist/types/makeType.d.ts +0 -2
- package/dist/types/makeType.js +0 -58
- package/dist/types/makeType.js.map +0 -1
- package/dist/types/match.d.ts +0 -3
- package/dist/types/match.js +0 -11
- package/dist/types/match.js.map +0 -1
- package/dist/types/non_factories.d.ts +0 -21
- package/dist/types/non_factories.js +0 -9
- package/dist/types/non_factories.js.map +0 -1
- package/dist/types/null.d.ts +0 -7
- package/dist/types/null.js +0 -4
- package/dist/types/null.js.map +0 -1
- package/dist/types/number.d.ts +0 -6
- package/dist/types/number.js +0 -3
- package/dist/types/number.js.map +0 -1
- package/dist/types/object.d.ts +0 -16
- package/dist/types/object.js +0 -10
- package/dist/types/object.js.map +0 -1
- package/dist/types/ref.d.ts +0 -7
- package/dist/types/ref.js +0 -5
- package/dist/types/ref.js.map +0 -1
- package/dist/types/string.d.ts +0 -6
- package/dist/types/string.js +0 -3
- package/dist/types/string.js.map +0 -1
- package/dist/types/toJSON.d.ts +0 -5
- package/dist/types/toJSON.js +0 -97
- package/dist/types/toJSON.js.map +0 -1
- package/dist/types/type_common.d.ts +0 -10
- package/dist/types/type_common.js +0 -12
- package/dist/types/type_common.js.map +0 -1
- package/dist/types/types_derived/option.d.ts +0 -5
- package/dist/types/types_derived/option.js +0 -6
- package/dist/types/types_derived/option.js.map +0 -1
- package/dist/types/types_derived/taggedUnion.d.ts +0 -19
- package/dist/types/types_derived/taggedUnion.js +0 -8
- package/dist/types/types_derived/taggedUnion.js.map +0 -1
- package/dist/types/types_derived/wrapper.d.ts +0 -8
- package/dist/types/types_derived/wrapper.js +0 -5
- package/dist/types/types_derived/wrapper.js.map +0 -1
- package/dist/types/union.d.ts +0 -9
- package/dist/types/union.js +0 -9
- package/dist/types/union.js.map +0 -1
- package/dist/util/ArrayOfLength.d.ts +0 -1
- package/dist/util/ArrayOfLength.js +0 -2
- package/dist/util/ArrayOfLength.js.map +0 -1
- package/dist/util/DeferredOr.d.ts +0 -1
- package/dist/util/DeferredOr.js +0 -2
- package/dist/util/DeferredOr.js.map +0 -1
- package/dist/util/EnsureNarrow.d.ts +0 -2
- package/dist/util/EnsureNarrow.js +0 -2
- package/dist/util/EnsureNarrow.js.map +0 -1
- package/dist/util/EnsureRecord.d.ts +0 -2
- package/dist/util/EnsureRecord.js +0 -2
- package/dist/util/EnsureRecord.js.map +0 -1
- package/dist/util/Expand.d.ts +0 -3
- package/dist/util/Expand.js +0 -2
- package/dist/util/Expand.js.map +0 -1
- package/dist/util/Falsy.d.ts +0 -1
- package/dist/util/Falsy.js +0 -2
- package/dist/util/Falsy.js.map +0 -1
- package/dist/util/FromEntries.d.ts +0 -3
- package/dist/util/FromEntries.js +0 -2
- package/dist/util/FromEntries.js.map +0 -1
- package/dist/util/IteratorLike.d.ts +0 -1
- package/dist/util/IteratorLike.js +0 -2
- package/dist/util/IteratorLike.js.map +0 -1
- package/dist/util/JSONEntry.d.ts +0 -2
- package/dist/util/JSONEntry.js +0 -2
- package/dist/util/JSONEntry.js.map +0 -1
- package/dist/util/JSONKey.d.ts +0 -1
- package/dist/util/JSONKey.js +0 -2
- package/dist/util/JSONKey.js.map +0 -1
- package/dist/util/JSONObject.d.ts +0 -5
- package/dist/util/JSONObject.js +0 -2
- package/dist/util/JSONObject.js.map +0 -1
- package/dist/util/JSONSchemaMemo.d.ts +0 -2
- package/dist/util/JSONSchemaMemo.js +0 -13
- package/dist/util/JSONSchemaMemo.js.map +0 -1
- package/dist/util/JSONValue.d.ts +0 -2
- package/dist/util/JSONValue.js +0 -2
- package/dist/util/JSONValue.js.map +0 -1
- package/dist/util/PromiseOr.d.ts +0 -1
- package/dist/util/PromiseOr.js +0 -2
- package/dist/util/PromiseOr.js.map +0 -1
- package/dist/util/Result.d.ts +0 -7
- package/dist/util/Result.js +0 -2
- package/dist/util/Result.js.map +0 -1
- package/dist/util/Taggable.d.ts +0 -9
- package/dist/util/Taggable.js +0 -8
- package/dist/util/Taggable.js.map +0 -1
- package/dist/util/TupleToRecord.d.ts +0 -5
- package/dist/util/TupleToRecord.js +0 -2
- package/dist/util/TupleToRecord.js.map +0 -1
- package/dist/util/assert.d.ts +0 -1
- package/dist/util/assert.js +0 -7
- package/dist/util/assert.js.map +0 -1
- package/dist/util/dedent.d.ts +0 -1
- package/dist/util/dedent.js +0 -5
- package/dist/util/dedent.js.map +0 -1
- package/dist/util/fixTemplateStrings.d.ts +0 -11
- package/dist/util/fixTemplateStrings.js +0 -83
- package/dist/util/fixTemplateStrings.js.map +0 -1
- package/dist/util/fixTemplateStrings.test.d.ts +0 -1
- package/dist/util/fixTemplateStrings.test.js +0 -221
- package/dist/util/fixTemplateStrings.test.js.map +0 -1
- package/dist/util/isAsyncIterator.d.ts +0 -1
- package/dist/util/isAsyncIterator.js +0 -7
- package/dist/util/isAsyncIterator.js.map +0 -1
- package/dist/util/isIterator.d.ts +0 -1
- package/dist/util/isIterator.js +0 -7
- package/dist/util/isIterator.js.map +0 -1
- package/dist/util/isJSONValue.d.ts +0 -2
- package/dist/util/isJSONValue.js +0 -16
- package/dist/util/isJSONValue.js.map +0 -1
- package/dist/util/isPropertyKey.d.ts +0 -1
- package/dist/util/isPropertyKey.js +0 -4
- package/dist/util/isPropertyKey.js.map +0 -1
- package/dist/util/isTemplateStringsArray.d.ts +0 -1
- package/dist/util/isTemplateStringsArray.js +0 -4
- package/dist/util/isTemplateStringsArray.js.map +0 -1
- package/dist/util/jsonEquals.d.ts +0 -2
- package/dist/util/jsonEquals.js +0 -33
- package/dist/util/jsonEquals.js.map +0 -1
- package/dist/util/nullaryMemo.d.ts +0 -1
- package/dist/util/nullaryMemo.js +0 -12
- package/dist/util/nullaryMemo.js.map +0 -1
- package/dist/util/peekLast.d.ts +0 -1
- package/dist/util/peekLast.js +0 -4
- package/dist/util/peekLast.js.map +0 -1
- package/dist/util/unimplemented.d.ts +0 -1
- package/dist/util/unimplemented.js +0 -5
- package/dist/util/unimplemented.js.map +0 -1
- package/dist/util/unreachable.d.ts +0 -1
- package/dist/util/unreachable.js +0 -5
- package/dist/util/unreachable.js.map +0 -1
- package/dist/util/unwrapDeferred.d.ts +0 -2
- package/dist/util/unwrapDeferred.js +0 -4
- package/dist/util/unwrapDeferred.js.map +0 -1
- package/dist/util/util.d.ts +0 -10
- package/dist/util/util.js +0 -11
- package/dist/util/util.js.map +0 -1
- package/events/Aborted.ts +0 -5
- package/events/Embedded.ts +0 -6
- package/events/EmbeddingRequested.ts +0 -5
- package/events/Emitted.ts +0 -5
- package/events/EventBase.ts +0 -3
- package/events/EventHandler.ts +0 -3
- package/events/EventResolved.ts +0 -30
- package/events/Forked.ts +0 -3
- package/events/InferenceRequested.ts +0 -3
- package/events/Inferred.ts +0 -6
- package/events/LEvent.ts +0 -40
- package/events/MessageAppended.ts +0 -6
- package/events/MessageRemoved.ts +0 -6
- package/events/MessagesSet.ts +0 -6
- package/events/ModelPushed.ts +0 -10
- package/events/ModelRemoved.ts +0 -10
- package/events/Returned.ts +0 -5
- package/events/SectionCleared.ts +0 -6
- package/events/Sectioned.ts +0 -6
- package/events/Threw.ts +0 -5
- package/events/ToolCalled.ts +0 -7
- package/events/ToolDisabled.ts +0 -6
- package/events/ToolEnabled.ts +0 -8
- package/events/isScopeChildEvent.ts +0 -15
- package/events/isScopeDescendantEvent.ts +0 -30
- package/testing/AgentAssertions.ts +0 -17
- package/testing/TestEmbeddingModel.ts +0 -19
- package/testing/TestLanguageModel.ts +0 -33
- package/testing/index.ts +0 -4
- package/testing/takeFirstAction.ts +0 -8
- package/types/AssertDiagnostics.ts +0 -183
- package/types/JSONRootType.ts +0 -8
- package/types/JSONType.ts +0 -27
- package/types/JSONTypeBase.ts +0 -3
- package/types/Metatype/MetatypeDescriptor.ts +0 -80
- package/types/Metatype/fromMetatypeDescriptor.ts +0 -52
- package/types/Type.ts +0 -47
- package/types/TypeContext.ts +0 -19
- package/types/TypeLike.ts +0 -60
- package/types/TypeVisitor.ts +0 -49
- package/types/array.ts +0 -20
- package/types/boolean.ts +0 -9
- package/types/const.ts +0 -17
- package/types/enum.ts +0 -14
- package/types/factories.ts +0 -8
- package/types/index.ts +0 -2
- package/types/integer.ts +0 -9
- package/types/intrinsics.ts +0 -11
- package/types/makeType.ts +0 -72
- package/types/match.ts +0 -13
- package/types/non_factories.ts +0 -26
- package/types/null.ts +0 -10
- package/types/number.ts +0 -9
- package/types/object.ts +0 -27
- package/types/ref.ts +0 -12
- package/types/string.ts +0 -9
- package/types/toJSON.ts +0 -111
- package/types/type_common.ts +0 -21
- package/types/types_derived/option.ts +0 -10
- package/types/types_derived/taggedUnion.ts +0 -30
- package/types/types_derived/wrapper.ts +0 -10
- package/types/union.ts +0 -19
- package/util/ArrayOfLength.ts +0 -5
- package/util/DeferredOr.ts +0 -1
- package/util/EnsureNarrow.ts +0 -5
- package/util/EnsureRecord.ts +0 -3
- package/util/Expand.ts +0 -1
- package/util/Falsy.ts +0 -1
- package/util/FromEntries.ts +0 -3
- package/util/IteratorLike.ts +0 -1
- package/util/JSONEntry.ts +0 -3
- package/util/JSONKey.ts +0 -1
- package/util/JSONObject.ts +0 -6
- package/util/JSONSchemaMemo.ts +0 -15
- package/util/JSONValue.ts +0 -3
- package/util/PromiseOr.ts +0 -1
- package/util/Result.ts +0 -7
- package/util/Taggable.ts +0 -18
- package/util/TupleToRecord.ts +0 -5
- package/util/assert.ts +0 -7
- package/util/dedent.ts +0 -5
- package/util/fixTemplateStrings.test.ts +0 -250
- package/util/fixTemplateStrings.ts +0 -99
- package/util/isAsyncIterator.ts +0 -6
- package/util/isIterator.ts +0 -6
- package/util/isJSONValue.ts +0 -20
- package/util/isPropertyKey.ts +0 -3
- package/util/isTemplateStringsArray.ts +0 -3
- package/util/jsonEquals.ts +0 -41
- package/util/nullaryMemo.ts +0 -11
- package/util/peekLast.ts +0 -3
- package/util/unimplemented.ts +0 -5
- package/util/unreachable.ts +0 -5
- package/util/unwrapDeferred.ts +0 -5
- package/util/util.ts +0 -10
- /package/dist/{actions/actions_derived/declareModel.test.d.ts → Handler.d.ts} +0 -0
- /package/dist/{actions/actions_derived/declareModel.type-test.d.ts → L/fork.d.ts} +0 -0
- /package/dist/{actions/actions_derived/messages.test.d.ts → L/namespace.d.ts} +0 -0
package/actions/catch.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Action } from "../Action.ts"
|
|
2
|
-
import type { AgentLike } from "../Agent.ts"
|
|
3
|
-
import type { Spec } from "../Spec.ts"
|
|
4
|
-
import type { JSONKey } from "../util/JSONKey.ts"
|
|
5
|
-
import type { Result } from "../util/Result.ts"
|
|
6
|
-
import { unwrapDeferred } from "../util/unwrapDeferred.ts"
|
|
7
|
-
|
|
8
|
-
export { catch_ as catch }
|
|
9
|
-
function* catch_<K extends JSONKey, Y extends Action, T>(
|
|
10
|
-
key: K,
|
|
11
|
-
agentLike: AgentLike<Y, T>,
|
|
12
|
-
): Generator<
|
|
13
|
-
Action<
|
|
14
|
-
"catch",
|
|
15
|
-
Spec.Make<{
|
|
16
|
-
Child: [K, Y[""]]
|
|
17
|
-
Value: T
|
|
18
|
-
}>
|
|
19
|
-
>,
|
|
20
|
-
Result<T, Y[""]["Throw"]>
|
|
21
|
-
> {
|
|
22
|
-
return yield Action("catch", async (scope) => {
|
|
23
|
-
const catchScope = scope.fork("catch", [key])
|
|
24
|
-
try {
|
|
25
|
-
const { value } = await catchScope.reduce(unwrapDeferred(agentLike))
|
|
26
|
-
catchScope.event({
|
|
27
|
-
type: "returned",
|
|
28
|
-
value,
|
|
29
|
-
})
|
|
30
|
-
return {
|
|
31
|
-
...scope,
|
|
32
|
-
nextArg: { value },
|
|
33
|
-
}
|
|
34
|
-
} catch (thrown: unknown) {
|
|
35
|
-
return {
|
|
36
|
-
...scope,
|
|
37
|
-
nextArg: { thrown },
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
Object.defineProperty(catch_, "name", { value: "catch" })
|
package/actions/declareArg.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Action } from "../Action.ts"
|
|
2
|
-
import type { Spec } from "../Spec.ts"
|
|
3
|
-
import type { JSONKey } from "../util/JSONKey.ts"
|
|
4
|
-
|
|
5
|
-
export interface declareArg<K extends JSONKey, T> extends Action<"declare_arg", Spec.Make<{ Entry: [K, T] }>> {}
|
|
6
|
-
|
|
7
|
-
export function declareArg<K extends JSONKey>(key: K): <T>() => Generator<declareArg<K, T>, T> {
|
|
8
|
-
return function*() {
|
|
9
|
-
return yield Action("declare_arg", (scope) => ({
|
|
10
|
-
...scope,
|
|
11
|
-
nextArg: scope.args?.[key],
|
|
12
|
-
}))
|
|
13
|
-
}
|
|
14
|
-
}
|
package/actions/disableTool.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Action } from "../Action.ts"
|
|
2
|
-
import type { ToolDisabled } from "../events/ToolDisabled.ts"
|
|
3
|
-
import type { Spec } from "../Spec.ts"
|
|
4
|
-
import type { Tool } from "../Tool.ts"
|
|
5
|
-
import type { JSONKey } from "../util/JSONKey.ts"
|
|
6
|
-
|
|
7
|
-
export interface disableTool<K extends JSONKey> extends Action<"disable_tool", Spec.Make<{ Event: ToolDisabled<K> }>> {}
|
|
8
|
-
|
|
9
|
-
export function* disableTool<K extends JSONKey>(tool: Tool<K>): Generator<
|
|
10
|
-
disableTool<K>,
|
|
11
|
-
void
|
|
12
|
-
> {
|
|
13
|
-
yield Action("disable_tool", (scope) => {
|
|
14
|
-
scope.event({
|
|
15
|
-
type: "tool_disabled",
|
|
16
|
-
tool: tool.toolKey,
|
|
17
|
-
})
|
|
18
|
-
const tools = new Set(scope.tools)
|
|
19
|
-
tools.delete(tool)
|
|
20
|
-
return {
|
|
21
|
-
...scope,
|
|
22
|
-
tools,
|
|
23
|
-
nextArg: undefined,
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
}
|
package/actions/embed.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Action } from "../Action.ts"
|
|
2
|
-
import type { Embedded } from "../events/Embedded.ts"
|
|
3
|
-
import type { EmbeddingRequested } from "../events/EmbeddingRequested.ts"
|
|
4
|
-
import type { Spec } from "../Spec.ts"
|
|
5
|
-
import { assert } from "../util/assert.ts"
|
|
6
|
-
import { peekLast } from "../util/peekLast.ts"
|
|
7
|
-
|
|
8
|
-
export interface embed extends Action<"embed", Spec.Make<{ Event: EmbeddingRequested | Embedded }>> {}
|
|
9
|
-
|
|
10
|
-
export function* embed(value: string): Generator<embed, Array<number>> {
|
|
11
|
-
return yield Action("embed", async (scope) => {
|
|
12
|
-
const model = peekLast(scope.embeddingModels)
|
|
13
|
-
assert(model)
|
|
14
|
-
scope.event({
|
|
15
|
-
type: "embedding_requested",
|
|
16
|
-
value,
|
|
17
|
-
})
|
|
18
|
-
const embedding = await model.embed(value)
|
|
19
|
-
scope.event({
|
|
20
|
-
type: "embedded",
|
|
21
|
-
value,
|
|
22
|
-
embedding,
|
|
23
|
-
})
|
|
24
|
-
return {
|
|
25
|
-
...scope,
|
|
26
|
-
nextArg: scope.value,
|
|
27
|
-
}
|
|
28
|
-
})
|
|
29
|
-
}
|
package/actions/emit.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Action } from "../Action.ts"
|
|
2
|
-
import type { Emitted } from "../events/Emitted.ts"
|
|
3
|
-
import type { Spec } from "../Spec.ts"
|
|
4
|
-
import type { JSONValue } from "../util/JSONValue.ts"
|
|
5
|
-
|
|
6
|
-
export interface emit<V extends JSONValue> extends Action<"emit", Spec.Make<{ Event: Emitted<V> }>> {}
|
|
7
|
-
|
|
8
|
-
export function* emit<V extends JSONValue = never>(
|
|
9
|
-
value: V = undefined as never,
|
|
10
|
-
): Generator<emit<V>, void> {
|
|
11
|
-
return yield Action("emit", (scope) => {
|
|
12
|
-
scope.event({
|
|
13
|
-
type: "emitted",
|
|
14
|
-
value,
|
|
15
|
-
})
|
|
16
|
-
return {
|
|
17
|
-
...scope,
|
|
18
|
-
nextArg: undefined,
|
|
19
|
-
}
|
|
20
|
-
}) as never
|
|
21
|
-
}
|
package/actions/enableTool.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import type { StandardSchemaV1 } from "@standard-schema/spec"
|
|
2
|
-
import { Action } from "../Action.ts"
|
|
3
|
-
import type { Agent } from "../Agent.ts"
|
|
4
|
-
import type { ToolCalled } from "../events/ToolCalled.ts"
|
|
5
|
-
import type { ToolEnabled } from "../events/ToolEnabled.ts"
|
|
6
|
-
import type { Spec } from "../Spec.ts"
|
|
7
|
-
import { Tool, type ToolImplementation, type ToolResult } from "../Tool.ts"
|
|
8
|
-
import type { JSONKey } from "../util/JSONKey.ts"
|
|
9
|
-
import type { JSONObject } from "../util/JSONObject.ts"
|
|
10
|
-
import { JSONSchemaMemo } from "../util/JSONSchemaMemo.ts"
|
|
11
|
-
import type { PromiseOr } from "../util/PromiseOr.ts"
|
|
12
|
-
import { disableTool } from "./disableTool.ts"
|
|
13
|
-
|
|
14
|
-
export function enableTool<K extends JSONKey, A>(
|
|
15
|
-
key: K,
|
|
16
|
-
description: string,
|
|
17
|
-
params: StandardSchemaV1<JSONObject, A>,
|
|
18
|
-
implementation: (params: A) => PromiseOr<ToolResult>,
|
|
19
|
-
): Generator<
|
|
20
|
-
Action<
|
|
21
|
-
"enable_tool",
|
|
22
|
-
Spec.Make<{
|
|
23
|
-
Event: ToolEnabled<K> | ToolCalled<K, A>
|
|
24
|
-
}>
|
|
25
|
-
>,
|
|
26
|
-
Generator<disableTool<K>, void>
|
|
27
|
-
>
|
|
28
|
-
export function enableTool<
|
|
29
|
-
K extends JSONKey,
|
|
30
|
-
A,
|
|
31
|
-
Y extends Action,
|
|
32
|
-
T extends ToolResult,
|
|
33
|
-
>(
|
|
34
|
-
key: K,
|
|
35
|
-
description: string,
|
|
36
|
-
params: StandardSchemaV1<JSONObject, A>,
|
|
37
|
-
implementation: (params: A) => Agent<Y, T>,
|
|
38
|
-
): Generator<
|
|
39
|
-
Action<
|
|
40
|
-
"enable_tool",
|
|
41
|
-
Spec.Make<{
|
|
42
|
-
Event: ToolEnabled<K> | ToolCalled<K, A>
|
|
43
|
-
Child: [K, Y[""]]
|
|
44
|
-
Entry: Y[""]["Entry"]
|
|
45
|
-
Value: T
|
|
46
|
-
}>
|
|
47
|
-
>,
|
|
48
|
-
Generator<disableTool<K>, void>
|
|
49
|
-
>
|
|
50
|
-
export function* enableTool(
|
|
51
|
-
key: JSONKey,
|
|
52
|
-
description: string,
|
|
53
|
-
params: StandardSchemaV1<JSONObject, any>,
|
|
54
|
-
implementation: ToolImplementation,
|
|
55
|
-
): Generator<Action<"enable_tool">, Generator<Action<"disable_tool">, void>> {
|
|
56
|
-
return yield Action("enable_tool", async (scope) => {
|
|
57
|
-
scope.event({
|
|
58
|
-
type: "tool_enabled",
|
|
59
|
-
description,
|
|
60
|
-
schema: await JSONSchemaMemo(params),
|
|
61
|
-
tool: key,
|
|
62
|
-
})
|
|
63
|
-
const tool = Tool({
|
|
64
|
-
toolKey: key,
|
|
65
|
-
description,
|
|
66
|
-
params,
|
|
67
|
-
implementation,
|
|
68
|
-
})
|
|
69
|
-
return {
|
|
70
|
-
...scope,
|
|
71
|
-
tools: new Set([...scope.tools, tool]),
|
|
72
|
-
nextArg: disableTool(tool),
|
|
73
|
-
}
|
|
74
|
-
})
|
|
75
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import type { AssertTrue, IsExact } from "conditional-type-checks"
|
|
2
|
-
import type { AgentLike } from "../Agent.ts"
|
|
3
|
-
import type { Emitted } from "../events/Emitted.ts"
|
|
4
|
-
import type { ToolCalled } from "../events/ToolCalled.ts"
|
|
5
|
-
import type { ToolDisabled } from "../events/ToolDisabled.ts"
|
|
6
|
-
import type { ToolEnabled } from "../events/ToolEnabled.ts"
|
|
7
|
-
import * as L from "../L.ts"
|
|
8
|
-
import { AgentAssertions } from "../testing/AgentAssertions.ts"
|
|
9
|
-
import { emit } from "./emit.ts"
|
|
10
|
-
import { enableTool } from "./enableTool.ts"
|
|
11
|
-
|
|
12
|
-
type P = typeof P["T"]
|
|
13
|
-
const P = L.object({
|
|
14
|
-
a: L.string,
|
|
15
|
-
b: L.string,
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
const arrowTool = L.enableTool("Tool", "", P, (params) => {
|
|
19
|
-
type _ = [AssertTrue<IsExact<typeof params, P>>]
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
AgentAssertions(arrowTool).assertSpec<{
|
|
23
|
-
Event:
|
|
24
|
-
| ToolEnabled<"Tool">
|
|
25
|
-
| ToolCalled<"Tool", {
|
|
26
|
-
a: string
|
|
27
|
-
b: string
|
|
28
|
-
}>
|
|
29
|
-
Child: never
|
|
30
|
-
Throw: never
|
|
31
|
-
Entry: never
|
|
32
|
-
Value: never
|
|
33
|
-
}>()
|
|
34
|
-
|
|
35
|
-
function* _0() {
|
|
36
|
-
const detach = yield* arrowTool
|
|
37
|
-
AgentAssertions(detach).assertSpec<{
|
|
38
|
-
Event: ToolDisabled<"Tool">
|
|
39
|
-
Child: never
|
|
40
|
-
Throw: never
|
|
41
|
-
Entry: never
|
|
42
|
-
Value: never
|
|
43
|
-
}>()
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const genTool = enableTool("tool-key", "", P, function*(params) {
|
|
47
|
-
type _ = [AssertTrue<IsExact<typeof params, P>>]
|
|
48
|
-
yield* emit("Test")
|
|
49
|
-
return ""
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
AgentAssertions(genTool).assertSpec<{
|
|
53
|
-
Event:
|
|
54
|
-
| ToolEnabled<"tool-key">
|
|
55
|
-
| ToolCalled<"tool-key", {
|
|
56
|
-
a: string
|
|
57
|
-
b: string
|
|
58
|
-
}>
|
|
59
|
-
Child: ["tool-key", {
|
|
60
|
-
Event: Emitted<"Test">
|
|
61
|
-
Child: never
|
|
62
|
-
Throw: never
|
|
63
|
-
Entry: never
|
|
64
|
-
Value: never
|
|
65
|
-
}]
|
|
66
|
-
Throw: never
|
|
67
|
-
Entry: never
|
|
68
|
-
Value: string
|
|
69
|
-
}>()
|
|
70
|
-
|
|
71
|
-
function* parent() {
|
|
72
|
-
yield* L.enableTool("parent-tool", "", P, () => {})
|
|
73
|
-
yield* L.branch("fork-key", {
|
|
74
|
-
*"arm-key"() {
|
|
75
|
-
yield* arrowTool
|
|
76
|
-
},
|
|
77
|
-
})
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
type g = typeof parent extends AgentLike<infer Y> ? Y[""] : never
|
|
81
|
-
|
|
82
|
-
AgentAssertions(parent).assertSpec<
|
|
83
|
-
{
|
|
84
|
-
Event:
|
|
85
|
-
| ToolEnabled<"parent-tool">
|
|
86
|
-
| ToolCalled<"parent-tool", {
|
|
87
|
-
a: string
|
|
88
|
-
b: string
|
|
89
|
-
}>
|
|
90
|
-
Child: never
|
|
91
|
-
Throw: never
|
|
92
|
-
Entry: never
|
|
93
|
-
Value: never
|
|
94
|
-
} | {
|
|
95
|
-
Event: never
|
|
96
|
-
Child: ["fork-key", {
|
|
97
|
-
Event: never
|
|
98
|
-
Child: ["arm-key", {
|
|
99
|
-
Event:
|
|
100
|
-
| ToolEnabled<"Tool">
|
|
101
|
-
| ToolCalled<"Tool", {
|
|
102
|
-
a: string
|
|
103
|
-
b: string
|
|
104
|
-
}>
|
|
105
|
-
Child: never
|
|
106
|
-
Throw: never
|
|
107
|
-
Entry: never
|
|
108
|
-
Value: never
|
|
109
|
-
}]
|
|
110
|
-
Throw: never
|
|
111
|
-
Entry: never
|
|
112
|
-
Value: void
|
|
113
|
-
}]
|
|
114
|
-
Throw: never
|
|
115
|
-
Entry: never
|
|
116
|
-
Value: never
|
|
117
|
-
}
|
|
118
|
-
>()
|
package/actions/infer.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
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
|
-
import { peekLast } from "../util/peekLast.ts"
|
|
9
|
-
|
|
10
|
-
export { infer_ as infer }
|
|
11
|
-
|
|
12
|
-
interface infer_<_T> extends
|
|
13
|
-
Action<
|
|
14
|
-
"infer",
|
|
15
|
-
Spec.Make<{
|
|
16
|
-
Event: InferenceRequested | Inferred
|
|
17
|
-
}>
|
|
18
|
-
>
|
|
19
|
-
{}
|
|
20
|
-
|
|
21
|
-
const infer_ = Object.assign(
|
|
22
|
-
function* infer_<T extends JSONValue>(type: StandardSchemaV1<JSONObject, T>): Generator<infer_<T>, T> {
|
|
23
|
-
return yield* impl(type)
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
*[Symbol.iterator](): Iterator<infer_<string>, string> {
|
|
27
|
-
return yield* impl()
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
)
|
|
31
|
-
Object.defineProperty(infer_, "name", { value: "infer" })
|
|
32
|
-
|
|
33
|
-
function* impl(type?: StandardSchemaV1<JSONObject, any>): Generator<infer_<any>, any> {
|
|
34
|
-
return yield Action("infer", async (scope) => {
|
|
35
|
-
scope.event({
|
|
36
|
-
type: "inference_requested",
|
|
37
|
-
})
|
|
38
|
-
const model = peekLast(scope.languageModels)!
|
|
39
|
-
scope = await scope.reduce(model.infer(type))
|
|
40
|
-
scope.event({
|
|
41
|
-
type: "inferred",
|
|
42
|
-
value: scope.value,
|
|
43
|
-
})
|
|
44
|
-
return {
|
|
45
|
-
...scope,
|
|
46
|
-
nextArg: scope.value,
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
}
|
package/actions/messages.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
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 { isPropertyKey } from "../util/isPropertyKey.ts"
|
|
7
|
-
import type { JSONKey } from "../util/JSONKey.ts"
|
|
8
|
-
import type { PromiseOr } from "../util/PromiseOr.ts"
|
|
9
|
-
import { type getScope, scope } from "./scope.ts"
|
|
10
|
-
|
|
11
|
-
interface messages extends Iterable<getScope, Set<Message>> {
|
|
12
|
-
(messages: Array<Message>): Generator<Action<"set_messages", Spec.Make<{ Event: MessagesSet }>>, Array<Message>>
|
|
13
|
-
(
|
|
14
|
-
setter: (messages: Array<Message>) => PromiseOr<Array<Message>>,
|
|
15
|
-
): Generator<Action<"set_messages", Spec.Make<{ Event: MessagesSet }>>, Array<Message>>
|
|
16
|
-
<K extends JSONKey, Y extends Action>(
|
|
17
|
-
key: K,
|
|
18
|
-
setter: (messages: Array<Message>) => Agent<Y, void>,
|
|
19
|
-
): Generator<
|
|
20
|
-
Action<
|
|
21
|
-
"set_messages",
|
|
22
|
-
Spec.Make<{ Event: MessagesSet; Child: [K, Y[""]]; Entry: Y[""]["Entry"]; Value: Array<Message> }>
|
|
23
|
-
>,
|
|
24
|
-
Array<Message>
|
|
25
|
-
>
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const messages: messages = Object.assign(messages_, {
|
|
29
|
-
*[Symbol.iterator]() {
|
|
30
|
-
const scope_ = yield* scope
|
|
31
|
-
return scope_.messages
|
|
32
|
-
},
|
|
33
|
-
}) as never
|
|
34
|
-
|
|
35
|
-
function* messages_(
|
|
36
|
-
setterOrKey: JSONKey | ((messages: Array<Message>) => PromiseOr<Array<Message>>),
|
|
37
|
-
maybeSetter?: (messages: Array<Message>) => Agent<Action, void>,
|
|
38
|
-
): Generator<Action<"set_messages">, Array<Message>> {
|
|
39
|
-
return yield Action("set_messages", async (scope) => {
|
|
40
|
-
if (isPropertyKey(setterOrKey)) {
|
|
41
|
-
const setterScope = scope.fork("set_messages", [setterOrKey])
|
|
42
|
-
const reduced = await setterScope.reduce(maybeSetter!([...scope.messages]))
|
|
43
|
-
const { messages } = reduced
|
|
44
|
-
setterScope.event({
|
|
45
|
-
type: "messages_set",
|
|
46
|
-
messages: [...messages],
|
|
47
|
-
})
|
|
48
|
-
return {
|
|
49
|
-
...scope,
|
|
50
|
-
messages,
|
|
51
|
-
nextArg: scope.messages,
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
const messages = new Set(Array.isArray(setterOrKey) ? setterOrKey : await setterOrKey([...scope.messages]))
|
|
55
|
-
return {
|
|
56
|
-
...scope,
|
|
57
|
-
messages,
|
|
58
|
-
nextArg: scope.messages,
|
|
59
|
-
}
|
|
60
|
-
})
|
|
61
|
-
}
|
|
62
|
-
Object.defineProperty(messages_, "name", { value: "messages" })
|
package/actions/pushModel.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
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
|
-
import { applyToModels } from "./actions_common/updateModels.ts"
|
|
8
|
-
|
|
9
|
-
export interface pushModel<K extends JSONKey, M extends ModelType>
|
|
10
|
-
extends Action<"remove_model", Spec.Make<{ Event: ModelPushed<K, M> }>>
|
|
11
|
-
{}
|
|
12
|
-
|
|
13
|
-
export interface removeModel<K extends JSONKey, M extends ModelType>
|
|
14
|
-
extends Action<"remove_model", Spec.Make<{ Event: ModelRemoved<K, M> }>>
|
|
15
|
-
{}
|
|
16
|
-
|
|
17
|
-
export function* pushModel<K extends JSONKey, M extends Model>(
|
|
18
|
-
modelKey: K,
|
|
19
|
-
model: M,
|
|
20
|
-
): Generator<pushModel<K, M["type"]>, Generator<removeModel<K, M["type"]>, void>> {
|
|
21
|
-
return yield Action("remove_model", (scope) => {
|
|
22
|
-
scope.event({
|
|
23
|
-
type: "model_pushed",
|
|
24
|
-
modelKey,
|
|
25
|
-
modelType: model.type,
|
|
26
|
-
})
|
|
27
|
-
return {
|
|
28
|
-
...scope,
|
|
29
|
-
...applyToModels(scope, model, (models) => {
|
|
30
|
-
models.add(model)
|
|
31
|
-
return models
|
|
32
|
-
}),
|
|
33
|
-
nextArg: (function*(): Generator<removeModel<K, M["type"]>, void> {
|
|
34
|
-
yield Action("remove_model", (scope) => {
|
|
35
|
-
scope.event({
|
|
36
|
-
type: "model_removed",
|
|
37
|
-
modelKey,
|
|
38
|
-
modelType: model.type,
|
|
39
|
-
})
|
|
40
|
-
return {
|
|
41
|
-
...scope,
|
|
42
|
-
...applyToModels(scope, model, (models) => {
|
|
43
|
-
models.delete(model)
|
|
44
|
-
return models
|
|
45
|
-
}),
|
|
46
|
-
nextArg: undefined,
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
})(),
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
}
|
package/actions/scope.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Action } from "../Action.ts"
|
|
2
|
-
import type { Scope } from "../Scope.ts"
|
|
3
|
-
|
|
4
|
-
export interface getScope extends Action<"get_scope", never> {}
|
|
5
|
-
|
|
6
|
-
export const scope = {
|
|
7
|
-
*[Symbol.iterator](): Iterator<getScope, Scope> {
|
|
8
|
-
return yield Action("get_scope", (scope) => ({
|
|
9
|
-
...scope,
|
|
10
|
-
nextArg: scope,
|
|
11
|
-
}))
|
|
12
|
-
},
|
|
13
|
-
}
|
package/actions/section.ts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { Action } from "../Action.ts"
|
|
2
|
-
import type { Agent, 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 { Section } from "../Scope.ts"
|
|
7
|
-
import type { Spec } from "../Spec.ts"
|
|
8
|
-
import type { JSONKey } from "../util/JSONKey.ts"
|
|
9
|
-
import { unwrapDeferred } from "../util/unwrapDeferred.ts"
|
|
10
|
-
|
|
11
|
-
export interface section<K extends JSONKey> extends Action<"section", Spec.Make<{ Event: Sectioned<K> }>> {}
|
|
12
|
-
|
|
13
|
-
export interface SectionHandle<K extends JSONKey> {
|
|
14
|
-
clear: Generator<Action<"clear_section", Spec.Make<{ Event: SectionCleared<K> }>>, void>
|
|
15
|
-
getMessages: () => Generator<Action<"get_section_messages", never>, Set<Message>>
|
|
16
|
-
|
|
17
|
-
<L extends JSONKey, Y extends Action, T>(key: L, agentLike: AgentLike<Y, T>): Generator<
|
|
18
|
-
Action<
|
|
19
|
-
"run_section",
|
|
20
|
-
Spec.Make<{
|
|
21
|
-
Child: [L, Y[""]]
|
|
22
|
-
Entry: Y[""]["Entry"]
|
|
23
|
-
Value: T
|
|
24
|
-
}>
|
|
25
|
-
>,
|
|
26
|
-
T
|
|
27
|
-
>
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function* section<K extends JSONKey>(sectionKey: K): Generator<section<K>, SectionHandle<K>> {
|
|
31
|
-
return yield Action("section", (scope) => {
|
|
32
|
-
scope.event({
|
|
33
|
-
type: "sectioned",
|
|
34
|
-
sectionKey,
|
|
35
|
-
})
|
|
36
|
-
const section: Section = {
|
|
37
|
-
sectionKey,
|
|
38
|
-
messages: new Set(),
|
|
39
|
-
}
|
|
40
|
-
scope.sections.add(section)
|
|
41
|
-
return {
|
|
42
|
-
...scope,
|
|
43
|
-
nextArg: Object.assign(
|
|
44
|
-
function*<L extends JSONKey, Y extends Action, T>(key: L, agentLike: AgentLike<Y, T>): Generator<
|
|
45
|
-
Action<
|
|
46
|
-
"run_section",
|
|
47
|
-
Spec.Make<{
|
|
48
|
-
Child: [L, Y[""]]
|
|
49
|
-
Entry: Y[""]["Entry"]
|
|
50
|
-
Value: T
|
|
51
|
-
}>
|
|
52
|
-
>,
|
|
53
|
-
T
|
|
54
|
-
> {
|
|
55
|
-
return yield Action("run_section", async (scope) => {
|
|
56
|
-
const sectionScope = scope.fork("run_section", [key], {
|
|
57
|
-
messages: new Set(section.messages),
|
|
58
|
-
})
|
|
59
|
-
const reduced = await sectionScope.reduce(unwrapDeferred(agentLike))
|
|
60
|
-
const { value } = reduced
|
|
61
|
-
sectionScope.event({
|
|
62
|
-
type: "returned",
|
|
63
|
-
value,
|
|
64
|
-
})
|
|
65
|
-
return {
|
|
66
|
-
...scope,
|
|
67
|
-
nextArg: value,
|
|
68
|
-
}
|
|
69
|
-
})
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
getMessages: (function*(): Generator<Action<"get_section_messages", never>, Set<Message>> {
|
|
73
|
-
return yield Action("get_section_messages", (scope) => ({
|
|
74
|
-
...scope,
|
|
75
|
-
nextArg: new Set(section.messages),
|
|
76
|
-
}))
|
|
77
|
-
})(),
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
clear:
|
|
81
|
-
(function*(): Generator<Action<"clear_section", Spec.Make<{ Event: SectionCleared<K> }>>, Set<Message>> {
|
|
82
|
-
return yield Action("clear_section", (scope) => {
|
|
83
|
-
const sections = new Set(scope.sections)
|
|
84
|
-
sections.delete(section)
|
|
85
|
-
const messages = new Set(scope.messages)
|
|
86
|
-
section.messages.forEach((message) => {
|
|
87
|
-
messages.delete(message)
|
|
88
|
-
})
|
|
89
|
-
scope.event({
|
|
90
|
-
type: "section_cleared",
|
|
91
|
-
sectionKey,
|
|
92
|
-
})
|
|
93
|
-
return {
|
|
94
|
-
...scope,
|
|
95
|
-
nextArg: messages,
|
|
96
|
-
sections,
|
|
97
|
-
messages,
|
|
98
|
-
}
|
|
99
|
-
})
|
|
100
|
-
})(),
|
|
101
|
-
},
|
|
102
|
-
),
|
|
103
|
-
}
|
|
104
|
-
})
|
|
105
|
-
}
|
package/actions/throw.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Action } from "../Action.ts"
|
|
2
|
-
import type { Spec } from "../Spec.ts"
|
|
3
|
-
import type { EnsureNarrow } from "../util/EnsureNarrow.ts"
|
|
4
|
-
|
|
5
|
-
export { throw_ as throw }
|
|
6
|
-
|
|
7
|
-
interface throw_<V> extends Action<"throw", Spec.Make<{ Throw: V }>> {}
|
|
8
|
-
|
|
9
|
-
function* throw_<V>(value: V, ...[_error]: EnsureNarrow<V>): Generator<throw_<V>, never> {
|
|
10
|
-
return (yield Action("throw", (scope) => {
|
|
11
|
-
return {
|
|
12
|
-
...scope,
|
|
13
|
-
thrown: value,
|
|
14
|
-
nextArg: undefined,
|
|
15
|
-
}
|
|
16
|
-
})) as never
|
|
17
|
-
}
|
|
18
|
-
Object.defineProperty(throw_, "name", { value: "throw" })
|
package/cli/WriteHandler.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { mkdir, writeFile } from "node:fs/promises"
|
|
2
|
-
import { type ParsedPath, relative, resolve } from "node:path"
|
|
3
|
-
import type { EventResolved } from "../events/EventResolved.ts"
|
|
4
|
-
|
|
5
|
-
export async function WriteHandler({
|
|
6
|
-
stateDir,
|
|
7
|
-
parsedPath,
|
|
8
|
-
configDir,
|
|
9
|
-
startTime,
|
|
10
|
-
}: {
|
|
11
|
-
stateDir: string
|
|
12
|
-
execId: string | undefined
|
|
13
|
-
parsedPath: ParsedPath
|
|
14
|
-
startTime: number
|
|
15
|
-
configDir: string
|
|
16
|
-
}): Promise<(event: EventResolved) => Promise<void>> {
|
|
17
|
-
const destDir = resolve(stateDir, relative(configDir, parsedPath.dir), parsedPath.name, startTime.toString())
|
|
18
|
-
let ensureDir: undefined | PromiseWithResolvers<void>
|
|
19
|
-
let i = 0
|
|
20
|
-
return async (event) => {
|
|
21
|
-
if (!ensureDir) {
|
|
22
|
-
ensureDir = Promise.withResolvers()
|
|
23
|
-
;(async () => {
|
|
24
|
-
try {
|
|
25
|
-
await mkdir(destDir, { recursive: true })
|
|
26
|
-
} catch (_e: unknown) {}
|
|
27
|
-
ensureDir.resolve()
|
|
28
|
-
})()
|
|
29
|
-
}
|
|
30
|
-
await ensureDir.promise
|
|
31
|
-
const key = `${i++}__${event.scope.join("__")}__${event.type}.json`
|
|
32
|
-
const destPath = resolve(destDir, key)
|
|
33
|
-
await writeFile(destPath, JSON.stringify(event, null, 2), "utf-8")
|
|
34
|
-
}
|
|
35
|
-
}
|
package/cli/cli_common.ts
DELETED