@dxos/assistant 0.8.4-main.69d29f4 → 0.8.4-main.6fa680abb7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/lib/neutral/chunk-BE6SRJ4N.mjs +193 -0
- package/dist/lib/neutral/chunk-BE6SRJ4N.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/extraction/index.mjs +4 -6
- package/dist/lib/neutral/extraction/index.mjs.map +7 -0
- package/dist/lib/{node-esm → neutral}/index.mjs +546 -69
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/testing/index.mjs +38 -0
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/types/src/conversation/context.d.ts +20 -3
- package/dist/types/src/conversation/context.d.ts.map +1 -1
- package/dist/types/src/conversation/conversation.d.ts +26 -1
- package/dist/types/src/conversation/conversation.d.ts.map +1 -1
- package/dist/types/src/diff.d.ts +3 -1
- package/dist/types/src/diff.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts +13 -5
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction.d.ts +16 -12
- package/dist/types/src/extraction/extraction.d.ts.map +1 -1
- package/dist/types/src/functions/services.d.ts +5 -6
- package/dist/types/src/functions/services.d.ts.map +1 -1
- package/dist/types/src/session/index.d.ts +1 -1
- package/dist/types/src/session/index.d.ts.map +1 -1
- package/dist/types/src/session/observer.d.ts.map +1 -1
- package/dist/types/src/session/session.d.ts +12 -7
- package/dist/types/src/session/session.d.ts.map +1 -1
- package/dist/types/src/session/toolkit.d.ts +6 -2
- package/dist/types/src/session/toolkit.d.ts.map +1 -1
- package/dist/types/src/testing/layer.d.ts +6 -5
- package/dist/types/src/testing/layer.d.ts.map +1 -1
- package/dist/types/src/types/artifact.d.ts +5 -5
- package/dist/types/src/types/artifact.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +32 -33
- package/src/conversation/context.test.ts +1 -1
- package/src/conversation/context.ts +35 -8
- package/src/conversation/conversation.ts +136 -14
- package/src/diff.test.ts +35 -4
- package/src/diff.ts +13 -4
- package/src/execution-graph.test.ts +2 -2
- package/src/execution-graph.ts +2 -2
- package/src/extraction/extraction-llm-function/extraction-llm-function.ts +1 -1
- package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +1 -1
- package/src/extraction/extraction-ner-function/extraction-ner-function.ts +1 -1
- package/src/extraction/extraction.ts +2 -2
- package/src/functions/services.ts +59 -30
- package/src/functions.conversations.json +1 -1
- package/src/functions.test.ts +7 -7
- package/src/session/format.test.ts +2 -2
- package/src/session/index.ts +1 -2
- package/src/session/observer.ts +3 -2
- package/src/session/session.conversations.json +1 -1
- package/src/session/session.test.ts +52 -4
- package/src/session/session.ts +68 -51
- package/src/session/toolkit.ts +12 -7
- package/src/templates/instructions/format.tpl +0 -4
- package/src/testing/layer.ts +24 -17
- package/src/types/artifact.ts +17 -10
- package/dist/lib/browser/chunk-7CDDG6LL.mjs +0 -578
- package/dist/lib/browser/chunk-7CDDG6LL.mjs.map +0 -7
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +0 -10
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +0 -7
- package/dist/lib/browser/extraction/index.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -850
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/testing/index.mjs +0 -32
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CC7ER6Q3.mjs +0 -579
- package/dist/lib/node-esm/chunk-CC7ER6Q3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
- package/dist/lib/node-esm/extraction/index.mjs +0 -226
- package/dist/lib/node-esm/extraction/index.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/testing/index.mjs +0 -33
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/types/src/session/GenericToolkit.d.ts +0 -85
- package/dist/types/src/session/GenericToolkit.d.ts.map +0 -1
- package/src/session/GenericToolkit.ts +0 -131
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"inputs":{"src/conversation/context.ts":{"bytes":31393,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Array","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/blueprints","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/session/artifact-diff.ts":{"bytes":2584,"imports":[{"path":"effect/Context","kind":"import-statement","external":true}],"format":"esm"},"src/session/observer.ts":{"bytes":5545,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Function","kind":"import-statement","external":true}],"format":"esm"},"src/errors.ts":{"bytes":1412,"imports":[{"path":"@dxos/errors","kind":"import-statement","external":true}],"format":"esm"},"src/session/format.ts":{"bytes":16498,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"@dxos/blueprints","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/errors.ts","kind":"import-statement","original":"../errors"},{"path":"src/session/artifact-diff.ts","kind":"import-statement","original":"./artifact-diff"}],"format":"esm"},"src/session/session.ts":{"bytes":25475,"imports":[{"path":"@effect/ai/LanguageModel","kind":"import-statement","external":true},{"path":"effect/Chunk","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true},{"path":"src/session/format.ts","kind":"import-statement","original":"./format"},{"path":"src/session/observer.ts","kind":"import-statement","original":"./observer"},{"path":"node:fs","kind":"require-call","external":true}],"format":"esm"},"src/session/toolkit.ts":{"bytes":4007,"imports":[{"path":"@effect/ai/Toolkit","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/session/version-pin.ts":{"bytes":4167,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true}],"format":"esm"},"src/session/GenericToolkit.ts":{"bytes":7442,"imports":[{"path":"@effect/ai/Toolkit","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Pipeable","kind":"import-statement","external":true}],"format":"esm"},"src/session/index.ts":{"bytes":1024,"imports":[{"path":"src/session/artifact-diff.ts","kind":"import-statement","original":"./artifact-diff"},{"path":"src/session/observer.ts","kind":"import-statement","original":"./observer"},{"path":"src/session/session.ts","kind":"import-statement","original":"./session"},{"path":"src/session/toolkit.ts","kind":"import-statement","original":"./toolkit"},{"path":"src/session/version-pin.ts","kind":"import-statement","original":"./version-pin"},{"path":"src/session/GenericToolkit.ts","kind":"import-statement","original":"./GenericToolkit"}],"format":"esm"},"src/conversation/conversation.ts":{"bytes":11550,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true},{"path":"src/session/index.ts","kind":"import-statement","original":"../session"},{"path":"src/conversation/context.ts","kind":"import-statement","original":"./context"}],"format":"esm"},"src/conversation/index.ts":{"bytes":562,"imports":[{"path":"src/conversation/context.ts","kind":"import-statement","original":"./context"},{"path":"src/conversation/conversation.ts","kind":"import-statement","original":"./conversation"}],"format":"esm"},"src/diff.ts":{"bytes":8784,"imports":[{"path":"@automerge/automerge","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/execution-graph.ts":{"bytes":51089,"imports":[{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/types/artifact.ts":{"bytes":9999,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-protocol","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/types/index.ts":{"bytes":456,"imports":[{"path":"src/types/artifact.ts","kind":"import-statement","original":"./artifact"}],"format":"esm"},"src/functions/services.ts":{"bytes":21955,"imports":[{"path":"@effect/ai/Tool","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Record","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"src/functions/index.ts":{"bytes":460,"imports":[{"path":"src/functions/services.ts","kind":"import-statement","original":"./services"}],"format":"esm"},"raw-loader:/__w/dxos/dxos/packages/core/assistant/src/templates/instructions/format.tpl?raw":{"bytes":1960,"imports":[]},"raw-loader:/__w/dxos/dxos/packages/core/assistant/src/templates/instructions/system.tpl?raw":{"bytes":3351,"imports":[]},"src/templates/system.ts":{"bytes":3189,"imports":[{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"@dxos/blueprints","kind":"import-statement","external":true},{"path":"raw-loader:/__w/dxos/dxos/packages/core/assistant/src/templates/instructions/format.tpl?raw","kind":"import-statement","original":"./instructions/format.tpl?raw"},{"path":"raw-loader:/__w/dxos/dxos/packages/core/assistant/src/templates/instructions/system.tpl?raw","kind":"import-statement","original":"./instructions/system.tpl?raw"}],"format":"esm"},"src/templates/index.ts":{"bytes":458,"imports":[{"path":"src/templates/system.ts","kind":"import-statement","original":"./system"}],"format":"esm"},"src/index.ts":{"bytes":1081,"imports":[{"path":"src/conversation/index.ts","kind":"import-statement","original":"./conversation"},{"path":"src/diff.ts","kind":"import-statement","original":"./diff"},{"path":"src/errors.ts","kind":"import-statement","original":"./errors"},{"path":"src/execution-graph.ts","kind":"import-statement","original":"./execution-graph"},{"path":"src/functions/index.ts","kind":"import-statement","original":"./functions"},{"path":"src/session/index.ts","kind":"import-statement","original":"./session"},{"path":"src/templates/index.ts","kind":"import-statement","original":"./templates"},{"path":"src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"src/extraction/extraction.ts":{"bytes":6865,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true}],"format":"esm"},"src/extraction/extraction-llm-function/extraction-llm-function.ts":{"bytes":6754,"imports":[{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"src/extraction/extraction.ts","kind":"import-statement","original":"../extraction"}],"format":"esm"},"src/extraction/extraction-llm-function/index.ts":{"bytes":524,"imports":[{"path":"src/extraction/extraction-llm-function/extraction-llm-function.ts","kind":"import-statement","original":"./extraction-llm-function"}],"format":"esm"},"src/extraction/extraction-ner-function/extraction-ner-function.ts":{"bytes":6222,"imports":[{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"src/extraction/extraction.ts","kind":"import-statement","original":"../extraction"}],"format":"esm"},"src/extraction/extraction-ner-function/named-entity-recognition.ts":{"bytes":10067,"imports":[{"path":"@xenova/transformers","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/extraction/extraction-ner-function/index.ts":{"bytes":652,"imports":[{"path":"src/extraction/extraction-ner-function/extraction-ner-function.ts","kind":"import-statement","original":"./extraction-ner-function"},{"path":"src/extraction/extraction-ner-function/named-entity-recognition.ts","kind":"import-statement","original":"./named-entity-recognition"}],"format":"esm"},"src/extraction/quotes.ts":{"bytes":7035,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/extraction/index.ts":{"bytes":803,"imports":[{"path":"src/extraction/extraction.ts","kind":"import-statement","original":"./extraction"},{"path":"src/extraction/extraction-llm-function/index.ts","kind":"import-statement","original":"./extraction-llm-function"},{"path":"src/extraction/extraction-ner-function/index.ts","kind":"import-statement","original":"./extraction-ner-function"},{"path":"src/extraction/quotes.ts","kind":"import-statement","original":"./quotes"}],"format":"esm"},"src/testing/layer.ts":{"bytes":8328,"imports":[{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Match","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/ai/testing","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime/testing","kind":"import-statement","external":true},{"path":"src/functions/index.ts","kind":"import-statement","original":"../functions"},{"path":"src/session/index.ts","kind":"import-statement","original":"../session"}],"format":"esm"},"src/testing/index.ts":{"bytes":451,"imports":[{"path":"src/testing/layer.ts","kind":"import-statement","original":"./layer"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":58452},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-CC7ER6Q3.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-HSLMI22Q.mjs","kind":"import-statement"},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Array","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/blueprints","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true},{"path":"@automerge/automerge","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"@dxos/blueprints","kind":"import-statement","external":true}],"exports":["AiAssistantError","AiContextBinder","AiContextService","AiConversation","AiModelError","AiSession","ArtifactDiffResolver","ArtifactId","Bindings","ContextBinding","ExecutionGraph","GenerationObserver","GenericToolkit","RefFromLLM","VersionPin","applyDiffs","computeDiffsWithCursors","createArtifactElement","createSystemPrompt","createToolkit","makeToolExecutionServiceFromFunctions","makeToolResolverFromFunctions","reduceDiffs","templates"],"entryPoint":"src/index.ts","inputs":{"src/conversation/context.ts":{"bytesInOutput":7141},"src/conversation/index.ts":{"bytesInOutput":0},"src/conversation/conversation.ts":{"bytesInOutput":2537},"src/index.ts":{"bytesInOutput":0},"src/diff.ts":{"bytesInOutput":1899},"src/execution-graph.ts":{"bytesInOutput":11999},"src/templates/system.ts":{"bytesInOutput":540},"raw-loader:/__w/dxos/dxos/packages/core/assistant/src/templates/instructions/format.tpl?raw":{"bytesInOutput":2046},"raw-loader:/__w/dxos/dxos/packages/core/assistant/src/templates/instructions/system.tpl?raw":{"bytesInOutput":3424},"src/templates/index.ts":{"bytesInOutput":0}},"bytes":30926},"dist/lib/node-esm/extraction/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":17559},"dist/lib/node-esm/extraction/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-HSLMI22Q.mjs","kind":"import-statement"},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@xenova/transformers","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["ExtractionInput","ExtractionOutput","ReferencedQuotes","combineNerTokens","createTokenGroups","extractFullEntities","extractionAnthropicFunction","extractionNerFunction","findQuotes","getNer","insertReferences","processTranscriptMessage"],"entryPoint":"src/extraction/index.ts","inputs":{"src/extraction/extraction.ts":{"bytesInOutput":1365},"src/extraction/index.ts":{"bytesInOutput":0},"src/extraction/extraction-llm-function/extraction-llm-function.ts":{"bytesInOutput":455},"src/extraction/extraction-llm-function/index.ts":{"bytesInOutput":0},"src/extraction/extraction-ner-function/extraction-ner-function.ts":{"bytesInOutput":431},"src/extraction/extraction-ner-function/index.ts":{"bytesInOutput":0},"src/extraction/extraction-ner-function/named-entity-recognition.ts":{"bytesInOutput":2276},"src/extraction/quotes.ts":{"bytesInOutput":1660}},"bytes":6881},"dist/lib/node-esm/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4758},"dist/lib/node-esm/testing/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-CC7ER6Q3.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-HSLMI22Q.mjs","kind":"import-statement"},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Match","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/ai/testing","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime/testing","kind":"import-statement","external":true}],"exports":["AssistantTestLayer","AssistantTestLayerWithTriggers"],"entryPoint":"src/testing/index.ts","inputs":{"src/testing/layer.ts":{"bytesInOutput":1660},"src/testing/index.ts":{"bytesInOutput":0}},"bytes":2051},"dist/lib/node-esm/chunk-CC7ER6Q3.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":50271},"dist/lib/node-esm/chunk-CC7ER6Q3.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-HSLMI22Q.mjs","kind":"import-statement"},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"@dxos/errors","kind":"import-statement","external":true},{"path":"@effect/ai/LanguageModel","kind":"import-statement","external":true},{"path":"effect/Chunk","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"@dxos/blueprints","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@effect/ai/Toolkit","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@effect/ai/Toolkit","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Pipeable","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-protocol","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@effect/ai/Tool","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Record","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"exports":["AiAssistantError","AiModelError","AiSession","ArtifactDiffResolver","ArtifactId","GenerationObserver","GenericToolkit_exports","RefFromLLM","VersionPin","createArtifactElement","createToolkit","makeToolExecutionServiceFromFunctions","makeToolResolverFromFunctions"],"inputs":{"src/session/artifact-diff.ts":{"bytesInOutput":143},"src/session/observer.ts":{"bytesInOutput":917},"src/errors.ts":{"bytesInOutput":232},"src/session/session.ts":{"bytesInOutput":4582},"src/session/format.ts":{"bytesInOutput":3750},"src/session/toolkit.ts":{"bytesInOutput":693},"src/session/version-pin.ts":{"bytesInOutput":732},"src/session/GenericToolkit.ts":{"bytesInOutput":733},"src/session/index.ts":{"bytesInOutput":0},"src/types/artifact.ts":{"bytesInOutput":1921},"src/types/index.ts":{"bytesInOutput":0},"src/functions/services.ts":{"bytesInOutput":4541},"src/functions/index.ts":{"bytesInOutput":0}},"bytes":19029},"dist/lib/node-esm/chunk-HSLMI22Q.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/node-esm/chunk-HSLMI22Q.mjs":{"imports":[],"exports":["__export"],"inputs":{},"bytes":327}}}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
GenericToolkit_exports,
|
|
4
|
-
makeToolExecutionServiceFromFunctions,
|
|
5
|
-
makeToolResolverFromFunctions
|
|
6
|
-
} from "../chunk-CC7ER6Q3.mjs";
|
|
7
|
-
import "../chunk-HSLMI22Q.mjs";
|
|
8
|
-
|
|
9
|
-
// src/testing/layer.ts
|
|
10
|
-
import * as Layer from "effect/Layer";
|
|
11
|
-
import * as Match from "effect/Match";
|
|
12
|
-
import { AiService } from "@dxos/ai";
|
|
13
|
-
import { TestAiService } from "@dxos/ai/testing";
|
|
14
|
-
import { CredentialsService, TracingService } from "@dxos/functions";
|
|
15
|
-
import { TracingServiceExt, TriggerDispatcher, TriggerStateStore } from "@dxos/functions-runtime";
|
|
16
|
-
import { FunctionInvocationServiceLayerTest, TestDatabaseLayer } from "@dxos/functions-runtime/testing";
|
|
17
|
-
var AssistantTestLayer = ({ aiServicePreset = "direct", model = "@anthropic/claude-opus-4-0", functions = [], toolkits = [], types = [], credentials = [], tracing = "noop" }) => Layer.mergeAll(AiService.model(model), makeToolResolverFromFunctions(functions, GenericToolkit_exports.merge(...toolkits).toolkit), makeToolExecutionServiceFromFunctions(GenericToolkit_exports.merge(...toolkits).toolkit, GenericToolkit_exports.merge(...toolkits).layer)).pipe(Layer.provideMerge(FunctionInvocationServiceLayerTest({
|
|
18
|
-
functions
|
|
19
|
-
})), Layer.provideMerge(Layer.mergeAll(TestAiService({
|
|
20
|
-
preset: aiServicePreset
|
|
21
|
-
}), TestDatabaseLayer({
|
|
22
|
-
spaceKey: "fixed",
|
|
23
|
-
types
|
|
24
|
-
}), CredentialsService.configuredLayer(credentials), Match.value(tracing).pipe(Match.when("noop", () => TracingService.layerNoop), Match.when("console", () => TracingServiceExt.layerLogInfo()), Match.when("pretty", () => TracingServiceExt.layerConsolePrettyPrint()), Match.exhaustive))));
|
|
25
|
-
var AssistantTestLayerWithTriggers = (options) => Layer.mergeAll(AssistantTestLayer(options), TriggerDispatcher.layer({
|
|
26
|
-
timeControl: "manual",
|
|
27
|
-
startingTime: /* @__PURE__ */ new Date("2025-09-05T15:01:00.000Z")
|
|
28
|
-
})).pipe(Layer.provideMerge(TriggerStateStore.layerMemory));
|
|
29
|
-
export {
|
|
30
|
-
AssistantTestLayer,
|
|
31
|
-
AssistantTestLayerWithTriggers
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/testing/layer.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Layer from 'effect/Layer';\nimport * as Match from 'effect/Match';\n\nimport { AiService, type ModelName } from '@dxos/ai';\nimport { TestAiService } from '@dxos/ai/testing';\nimport type { Type } from '@dxos/echo';\nimport { CredentialsService, type FunctionDefinition, type ServiceCredential, TracingService } from '@dxos/functions';\nimport { TracingServiceExt, TriggerDispatcher, TriggerStateStore } from '@dxos/functions-runtime';\nimport { FunctionInvocationServiceLayerTest, TestDatabaseLayer } from '@dxos/functions-runtime/testing';\n\nimport { makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from '../functions';\nimport { GenericToolkit } from '../session';\n\ninterface TestLayerOptions {\n aiServicePreset?: 'direct' | 'edge-local' | 'edge-remote';\n model?: ModelName;\n functions?: FunctionDefinition.Any[];\n toolkits?: GenericToolkit.GenericToolkit[];\n types?: Type.Entity.Any[];\n credentials?: ServiceCredential[];\n /*\n * Tracing configuration.\n * @default 'noop'\n */\n tracing?: 'noop' | 'console' | 'pretty';\n}\n\nexport const AssistantTestLayer = ({\n aiServicePreset = 'direct',\n model = '@anthropic/claude-opus-4-0',\n functions = [],\n toolkits = [],\n types = [],\n credentials = [],\n tracing = 'noop',\n}: TestLayerOptions) =>\n Layer.mergeAll(\n AiService.model(model),\n makeToolResolverFromFunctions(functions, GenericToolkit.merge(...toolkits).toolkit as any),\n makeToolExecutionServiceFromFunctions(\n GenericToolkit.merge(...toolkits).toolkit as any,\n GenericToolkit.merge(...toolkits).layer as any,\n ),\n ).pipe(\n Layer.provideMerge(\n FunctionInvocationServiceLayerTest({\n functions,\n }),\n ),\n Layer.provideMerge(\n Layer.mergeAll(\n TestAiService({ preset: aiServicePreset }),\n TestDatabaseLayer({\n spaceKey: 'fixed',\n types,\n }),\n CredentialsService.configuredLayer(credentials),\n Match.value(tracing).pipe(\n Match.when('noop', () => TracingService.layerNoop),\n Match.when('console', () => TracingServiceExt.layerLogInfo()),\n Match.when('pretty', () => TracingServiceExt.layerConsolePrettyPrint()),\n Match.exhaustive,\n ),\n ),\n ),\n );\n\ninterface TestLayerWithTriggersOptions extends TestLayerOptions {}\n\nexport const AssistantTestLayerWithTriggers = (options: TestLayerWithTriggersOptions) =>\n Layer.mergeAll(\n AssistantTestLayer(options),\n TriggerDispatcher.layer({ timeControl: 'manual', startingTime: new Date('2025-09-05T15:01:00.000Z') }),\n ).pipe(Layer.provideMerge(TriggerStateStore.layerMemory));\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;AAIA,YAAYA,WAAW;AACvB,YAAYC,WAAW;AAEvB,SAASC,iBAAiC;AAC1C,SAASC,qBAAqB;AAE9B,SAASC,oBAAqEC,sBAAsB;AACpG,SAASC,mBAAmBC,mBAAmBC,yBAAyB;AACxE,SAASC,oCAAoCC,yBAAyB;AAmB/D,IAAMC,qBAAqB,CAAC,EACjCC,kBAAkB,UAClBC,QAAQ,8BACRC,YAAY,CAAA,GACZC,WAAW,CAAA,GACXC,QAAQ,CAAA,GACRC,cAAc,CAAA,GACdC,UAAU,OAAM,MAEVC,eACJC,UAAUP,MAAMA,KAAAA,GAChBQ,8BAA8BP,WAAWQ,uBAAeC,MAAK,GAAIR,QAAAA,EAAUS,OAAO,GAClFC,sCACEH,uBAAeC,MAAK,GAAIR,QAAAA,EAAUS,SAClCF,uBAAeC,MAAK,GAAIR,QAAAA,EAAUW,KAAK,CAAA,EAEzCC,KACMC,mBACJC,mCAAmC;EACjCf;AACF,CAAA,CAAA,GAEIc,mBACET,eACJW,cAAc;EAAEC,QAAQnB;AAAgB,CAAA,GACxCoB,kBAAkB;EAChBC,UAAU;EACVjB;AACF,CAAA,GACAkB,mBAAmBC,gBAAgBlB,WAAAA,GAC7BmB,YAAMlB,OAAAA,EAASS,KACbU,WAAK,QAAQ,MAAMC,eAAeC,SAAS,GAC3CF,WAAK,WAAW,MAAMG,kBAAkBC,aAAY,CAAA,GACpDJ,WAAK,UAAU,MAAMG,kBAAkBE,wBAAuB,CAAA,GAC9DC,gBAAU,CAAA,CAAA,CAAA;AAQnB,IAAMC,iCAAiC,CAACC,YACvC1B,eACJR,mBAAmBkC,OAAAA,GACnBC,kBAAkBpB,MAAM;EAAEqB,aAAa;EAAUC,cAAc,oBAAIC,KAAK,0BAAA;AAA4B,CAAA,CAAA,EACpGtB,KAAWC,mBAAasB,kBAAkBC,WAAW,CAAA;",
|
|
6
|
-
"names": ["Layer", "Match", "AiService", "TestAiService", "CredentialsService", "TracingService", "TracingServiceExt", "TriggerDispatcher", "TriggerStateStore", "FunctionInvocationServiceLayerTest", "TestDatabaseLayer", "AssistantTestLayer", "aiServicePreset", "model", "functions", "toolkits", "types", "credentials", "tracing", "mergeAll", "AiService", "makeToolResolverFromFunctions", "GenericToolkit", "merge", "toolkit", "makeToolExecutionServiceFromFunctions", "layer", "pipe", "provideMerge", "FunctionInvocationServiceLayerTest", "TestAiService", "preset", "TestDatabaseLayer", "spaceKey", "CredentialsService", "configuredLayer", "value", "when", "TracingService", "layerNoop", "TracingServiceExt", "layerLogInfo", "layerConsolePrettyPrint", "exhaustive", "AssistantTestLayerWithTriggers", "options", "TriggerDispatcher", "timeControl", "startingTime", "Date", "TriggerStateStore", "layerMemory"]
|
|
7
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import type * as Tool from '@effect/ai/Tool';
|
|
2
|
-
import * as Toolkit from '@effect/ai/Toolkit';
|
|
3
|
-
import * as Effect from 'effect/Effect';
|
|
4
|
-
import * as Layer from 'effect/Layer';
|
|
5
|
-
import * as Pipeable from 'effect/Pipeable';
|
|
6
|
-
import type * as Schema from 'effect/Schema';
|
|
7
|
-
import type * as SchemaAST from 'effect/SchemaAST';
|
|
8
|
-
/**
|
|
9
|
-
* Unique identifier for generic toolkit instances.
|
|
10
|
-
*/
|
|
11
|
-
export declare const TypeId = "~@dxos/assistant/GenericToolkit";
|
|
12
|
-
/**
|
|
13
|
-
* Type-level representation of the generic toolkit identifier.
|
|
14
|
-
*/
|
|
15
|
-
export type TypeId = typeof TypeId;
|
|
16
|
-
/**
|
|
17
|
-
* Type-safe way to define toolkits where we don't know specific types of tools,
|
|
18
|
-
* and we want to bundle definition and handlers together.
|
|
19
|
-
*
|
|
20
|
-
* Usefull for plugin-based systems, where tools are dynamically added.
|
|
21
|
-
*
|
|
22
|
-
* @param TR requirements type to the tool invocation.
|
|
23
|
-
* @param E failure type to the handlers layer.
|
|
24
|
-
* @param R requirements type to the handlers layer.
|
|
25
|
-
*/
|
|
26
|
-
export interface GenericToolkit<TR = never, E = never, R = never> extends Pipeable.Pipeable {
|
|
27
|
-
readonly [TypeId]: TypeId;
|
|
28
|
-
/**
|
|
29
|
-
* Toolkit definition.
|
|
30
|
-
*/
|
|
31
|
-
readonly toolkit: Toolkit.Toolkit<GenericTools<TR>>;
|
|
32
|
-
/**
|
|
33
|
-
* Handlers layer.
|
|
34
|
-
*/
|
|
35
|
-
readonly layer: Layer.Layer<unknown, E, R>;
|
|
36
|
-
/**
|
|
37
|
-
* Handlers effect.
|
|
38
|
-
*/
|
|
39
|
-
readonly handlers: Effect.Effect<Toolkit.WithHandler<GenericTools<TR>>, E, R>;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Generic constraint.
|
|
43
|
-
*
|
|
44
|
-
* NOTE: Only use in place of `T extends PortableToolkit.Any`. Not suitable for standalone use.
|
|
45
|
-
*/
|
|
46
|
-
export interface Any {
|
|
47
|
-
readonly [TypeId]: TypeId;
|
|
48
|
-
readonly toolkit: Toolkit.Toolkit<any>;
|
|
49
|
-
readonly layer: Layer.Layer<unknown, any, any>;
|
|
50
|
-
}
|
|
51
|
-
export type InvocationRequirements<T extends Any> = T extends GenericToolkit<infer TR, infer _E, infer _R> ? TR : never;
|
|
52
|
-
export type Failure<T extends Any> = T extends GenericToolkit<infer _TR, infer E, infer _R> ? E : never;
|
|
53
|
-
export type Requirements<T extends Any> = T extends GenericToolkit<infer _TR, infer _E, infer R> ? R : never;
|
|
54
|
-
/**
|
|
55
|
-
* Creates a portable toolkit from toolkit definition and handlers layer.
|
|
56
|
-
*/
|
|
57
|
-
export declare const make: <Tools extends Record<string, Tool.Any>, E, R>(toolkit: Toolkit.Toolkit<Tools>, layer: Layer.Layer<Tool.HandlersFor<Tools>, E, R>) => GenericToolkit<E, R>;
|
|
58
|
-
/**
|
|
59
|
-
* Merges multiple portable toolkits into a single portable toolkit.
|
|
60
|
-
*/
|
|
61
|
-
export declare const merge: <const Toolkits extends ReadonlyArray<Any>>(
|
|
62
|
-
/**
|
|
63
|
-
* The toolkits to merge together.
|
|
64
|
-
*/
|
|
65
|
-
...toolkits: Toolkits) => GenericToolkit<InvocationRequirements<Toolkits[number]>, Failure<Toolkits[number]>, Requirements<Toolkits[number]>>;
|
|
66
|
-
/**
|
|
67
|
-
* Generic tools type where we cannot statically enumerate individual tools.
|
|
68
|
-
*/
|
|
69
|
-
export type GenericTools<R = never> = Record<string, Tool.Tool<string, {
|
|
70
|
-
readonly parameters: AnyStructSchemaNoContext;
|
|
71
|
-
readonly success: Schema.Schema.AnyNoContext;
|
|
72
|
-
readonly failure: typeof Schema.Never;
|
|
73
|
-
readonly failureMode: Tool.FailureMode;
|
|
74
|
-
}, R>>;
|
|
75
|
-
export interface AnyStructSchemaNoContext extends Pipeable.Pipeable {
|
|
76
|
-
readonly [Schema.TypeId]: any;
|
|
77
|
-
readonly make: any;
|
|
78
|
-
readonly Type: any;
|
|
79
|
-
readonly Encoded: any;
|
|
80
|
-
readonly Context: never;
|
|
81
|
-
readonly ast: SchemaAST.AST;
|
|
82
|
-
readonly fields: Schema.Struct.Fields;
|
|
83
|
-
readonly annotations: any;
|
|
84
|
-
}
|
|
85
|
-
//# sourceMappingURL=GenericToolkit.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GenericToolkit.d.ts","sourceRoot":"","sources":["../../../../src/session/GenericToolkit.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import type * as Tool from '@effect/ai/Tool';
|
|
6
|
-
import * as Toolkit from '@effect/ai/Toolkit';
|
|
7
|
-
import * as Effect from 'effect/Effect';
|
|
8
|
-
import * as Layer from 'effect/Layer';
|
|
9
|
-
import * as Pipeable from 'effect/Pipeable';
|
|
10
|
-
import type * as Schema from 'effect/Schema';
|
|
11
|
-
import type * as SchemaAST from 'effect/SchemaAST';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Unique identifier for generic toolkit instances.
|
|
15
|
-
*/
|
|
16
|
-
export const TypeId = '~@dxos/assistant/GenericToolkit';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Type-level representation of the generic toolkit identifier.
|
|
20
|
-
*/
|
|
21
|
-
export type TypeId = typeof TypeId;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Type-safe way to define toolkits where we don't know specific types of tools,
|
|
25
|
-
* and we want to bundle definition and handlers together.
|
|
26
|
-
*
|
|
27
|
-
* Usefull for plugin-based systems, where tools are dynamically added.
|
|
28
|
-
*
|
|
29
|
-
* @param TR requirements type to the tool invocation.
|
|
30
|
-
* @param E failure type to the handlers layer.
|
|
31
|
-
* @param R requirements type to the handlers layer.
|
|
32
|
-
*/
|
|
33
|
-
export interface GenericToolkit<TR = never, E = never, R = never> extends Pipeable.Pipeable {
|
|
34
|
-
readonly [TypeId]: TypeId;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Toolkit definition.
|
|
38
|
-
*/
|
|
39
|
-
readonly toolkit: Toolkit.Toolkit<GenericTools<TR>>;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Handlers layer.
|
|
43
|
-
*/
|
|
44
|
-
readonly layer: Layer.Layer<unknown, E, R>;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Handlers effect.
|
|
48
|
-
*/
|
|
49
|
-
readonly handlers: Effect.Effect<Toolkit.WithHandler<GenericTools<TR>>, E, R>;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Generic constraint.
|
|
54
|
-
*
|
|
55
|
-
* NOTE: Only use in place of `T extends PortableToolkit.Any`. Not suitable for standalone use.
|
|
56
|
-
*/
|
|
57
|
-
export interface Any {
|
|
58
|
-
readonly [TypeId]: TypeId;
|
|
59
|
-
readonly toolkit: Toolkit.Toolkit<any>;
|
|
60
|
-
readonly layer: Layer.Layer<unknown, any, any>;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export type InvocationRequirements<T extends Any> = T extends GenericToolkit<infer TR, infer _E, infer _R> ? TR : never;
|
|
64
|
-
export type Failure<T extends Any> = T extends GenericToolkit<infer _TR, infer E, infer _R> ? E : never;
|
|
65
|
-
export type Requirements<T extends Any> = T extends GenericToolkit<infer _TR, infer _E, infer R> ? R : never;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Creates a portable toolkit from toolkit definition and handlers layer.
|
|
69
|
-
*/
|
|
70
|
-
export const make = <Tools extends Record<string, Tool.Any>, E, R>(
|
|
71
|
-
toolkit: Toolkit.Toolkit<Tools>,
|
|
72
|
-
layer: Layer.Layer<Tool.HandlersFor<Tools>, E, R>,
|
|
73
|
-
): GenericToolkit<E, R> => {
|
|
74
|
-
return {
|
|
75
|
-
[TypeId]: TypeId,
|
|
76
|
-
toolkit: toolkit as any,
|
|
77
|
-
layer: layer as any,
|
|
78
|
-
handlers: toolkit.pipe(Effect.provide(layer)) as any,
|
|
79
|
-
pipe() {
|
|
80
|
-
// eslint-disable-next-line prefer-rest-params
|
|
81
|
-
return Pipeable.pipeArguments(this, arguments);
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Merges multiple portable toolkits into a single portable toolkit.
|
|
88
|
-
*/
|
|
89
|
-
export const merge = <const Toolkits extends ReadonlyArray<Any>>(
|
|
90
|
-
/**
|
|
91
|
-
* The toolkits to merge together.
|
|
92
|
-
*/
|
|
93
|
-
...toolkits: Toolkits
|
|
94
|
-
): GenericToolkit<
|
|
95
|
-
InvocationRequirements<Toolkits[number]>,
|
|
96
|
-
Failure<Toolkits[number]>,
|
|
97
|
-
Requirements<Toolkits[number]>
|
|
98
|
-
> => {
|
|
99
|
-
return make(
|
|
100
|
-
Toolkit.merge(...toolkits.map((t) => t.toolkit)),
|
|
101
|
-
Layer.mergeAll(...(toolkits.map((t) => t.layer) as any)),
|
|
102
|
-
) as any;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Generic tools type where we cannot statically enumerate individual tools.
|
|
107
|
-
*/
|
|
108
|
-
export type GenericTools<R = never> = Record<
|
|
109
|
-
string,
|
|
110
|
-
Tool.Tool<
|
|
111
|
-
string,
|
|
112
|
-
{
|
|
113
|
-
readonly parameters: AnyStructSchemaNoContext;
|
|
114
|
-
readonly success: Schema.Schema.AnyNoContext;
|
|
115
|
-
readonly failure: typeof Schema.Never;
|
|
116
|
-
readonly failureMode: Tool.FailureMode;
|
|
117
|
-
},
|
|
118
|
-
R
|
|
119
|
-
>
|
|
120
|
-
>;
|
|
121
|
-
|
|
122
|
-
export interface AnyStructSchemaNoContext extends Pipeable.Pipeable {
|
|
123
|
-
readonly [Schema.TypeId]: any;
|
|
124
|
-
readonly make: any;
|
|
125
|
-
readonly Type: any;
|
|
126
|
-
readonly Encoded: any;
|
|
127
|
-
readonly Context: never;
|
|
128
|
-
readonly ast: SchemaAST.AST;
|
|
129
|
-
readonly fields: Schema.Struct.Fields;
|
|
130
|
-
readonly annotations: any;
|
|
131
|
-
}
|