clanka 0.12.3 → 0.13.0

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.
Files changed (78) hide show
  1. package/dist/Acp.d.ts +9 -0
  2. package/dist/Acp.d.ts.map +1 -1
  3. package/dist/Acp.js +20 -9
  4. package/dist/Acp.js.map +1 -1
  5. package/dist/Acp.test.js +15 -1
  6. package/dist/Acp.test.js.map +1 -1
  7. package/dist/Codex.d.ts +12 -2
  8. package/dist/Codex.d.ts.map +1 -1
  9. package/dist/Codex.js +7 -5
  10. package/dist/Codex.js.map +1 -1
  11. package/dist/Codex.test.d.ts +2 -0
  12. package/dist/Codex.test.d.ts.map +1 -0
  13. package/dist/Codex.test.js +37 -0
  14. package/dist/Codex.test.js.map +1 -0
  15. package/dist/Copilot.d.ts.map +1 -1
  16. package/dist/Copilot.js +4 -4
  17. package/dist/Copilot.js.map +1 -1
  18. package/dist/Copilot.test.d.ts +2 -0
  19. package/dist/Copilot.test.d.ts.map +1 -0
  20. package/dist/Copilot.test.js +32 -0
  21. package/dist/Copilot.test.js.map +1 -0
  22. package/dist/ModelLayer.d.ts +64 -0
  23. package/dist/ModelLayer.d.ts.map +1 -0
  24. package/dist/ModelLayer.js +96 -0
  25. package/dist/ModelLayer.js.map +1 -0
  26. package/dist/ModelLayer.test.d.ts +2 -0
  27. package/dist/ModelLayer.test.d.ts.map +1 -0
  28. package/dist/ModelLayer.test.js +83 -0
  29. package/dist/ModelLayer.test.js.map +1 -0
  30. package/dist/ModelsRepo.d.ts +80 -0
  31. package/dist/ModelsRepo.d.ts.map +1 -0
  32. package/dist/ModelsRepo.js +162 -0
  33. package/dist/ModelsRepo.js.map +1 -0
  34. package/dist/ModelsRepo.test.d.ts +2 -0
  35. package/dist/ModelsRepo.test.d.ts.map +1 -0
  36. package/dist/ModelsRepo.test.js +168 -0
  37. package/dist/ModelsRepo.test.js.map +1 -0
  38. package/dist/Xai.d.ts +12 -2
  39. package/dist/Xai.d.ts.map +1 -1
  40. package/dist/Xai.js +8 -2
  41. package/dist/Xai.js.map +1 -1
  42. package/dist/Xai.test.js +38 -7
  43. package/dist/Xai.test.js.map +1 -1
  44. package/dist/bin/{Effect-DuThyCJ1.mjs → Effect-4B1lzxy4.mjs} +2 -2
  45. package/dist/bin/{Effect-DuThyCJ1.mjs.map → Effect-4B1lzxy4.mjs.map} +1 -1
  46. package/dist/bin/{McpClient-CIiPyMDJ.mjs → McpClient-DMfHHEx3.mjs} +3 -3
  47. package/dist/bin/{McpClient-CIiPyMDJ.mjs.map → McpClient-DMfHHEx3.mjs.map} +1 -1
  48. package/dist/bin/{OutputFormatter-BvIjvUmT.mjs → OutputFormatter-DRycCEdr.mjs} +3 -3
  49. package/dist/bin/{OutputFormatter-BvIjvUmT.mjs.map → OutputFormatter-DRycCEdr.mjs.map} +1 -1
  50. package/dist/bin/{Schema-DcXUXpRg.mjs → Schema-D4fxUgEU.mjs} +3 -3
  51. package/dist/bin/{Schema-DcXUXpRg.mjs.map → Schema-D4fxUgEU.mjs.map} +1 -1
  52. package/dist/bin/{SemanticSearch-CdGA4CIC.mjs → SemanticSearch-BcLFv9qz.mjs} +4 -4
  53. package/dist/bin/{SemanticSearch-CdGA4CIC.mjs.map → SemanticSearch-BcLFv9qz.mjs.map} +1 -1
  54. package/dist/bin/{Stream-I9SRMlLj.mjs → Stream-i37nF1ep.mjs} +2 -2
  55. package/dist/bin/{Stream-I9SRMlLj.mjs.map → Stream-i37nF1ep.mjs.map} +1 -1
  56. package/dist/bin/cli.mjs +756 -419
  57. package/dist/bin/cli.mjs.map +1 -1
  58. package/dist/cli.js +59 -46
  59. package/dist/cli.js.map +1 -1
  60. package/dist/index.d.ts +4 -0
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +4 -0
  63. package/dist/index.js.map +1 -1
  64. package/package.json +1 -1
  65. package/src/Acp.test.ts +27 -0
  66. package/src/Acp.ts +31 -11
  67. package/src/Codex.test.ts +60 -0
  68. package/src/Codex.ts +26 -14
  69. package/src/Copilot.test.ts +55 -0
  70. package/src/Copilot.ts +7 -4
  71. package/src/ModelLayer.test.ts +122 -0
  72. package/src/ModelLayer.ts +149 -0
  73. package/src/ModelsRepo.test.ts +206 -0
  74. package/src/ModelsRepo.ts +260 -0
  75. package/src/Xai.test.ts +62 -7
  76. package/src/Xai.ts +27 -8
  77. package/src/cli.ts +74 -81
  78. package/src/index.ts +5 -0
package/dist/Copilot.js CHANGED
@@ -21,10 +21,10 @@ export const layerClient = OpenAiClient.layer({
21
21
  */
22
22
  export const model = (model, options) => Model.make("openai", model, Layer.mergeAll(OpenAiLanguageModel.layer({
23
23
  model,
24
- config: Struct.omit(options ?? {}, [
25
- "systemPromptTransform",
26
- "supportsImages",
27
- ]),
24
+ // `reasoning: null` asks for no reasoning options.
25
+ config: Struct.omit(options ?? {}, options?.reasoning === null
26
+ ? ["reasoning", "systemPromptTransform", "supportsImages"]
27
+ : ["systemPromptTransform", "supportsImages"]),
28
28
  }), AgentModelConfig.layer({
29
29
  systemPromptTransform: options?.systemPromptTransform,
30
30
  supportsImages: options?.supportsImages,
@@ -1 +1 @@
1
- {"version":3,"file":"Copilot.js","sourceRoot":"","sources":["../src/Copilot.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC5E,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,KAAK,MAAM,iBAAiB,CAAA;AAGxC;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC,KAAK,CAAC;IAC5C,MAAM,EA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M,WAAW,GAAG,YAAY,CAAC,KAAK,CAAC;IAC5C,MAAM,EAAE,OAAO;CAChB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAA;AAErD;;;GAGG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,KAAa,EACb,OAEa,EAKb,EAAE,CACF,KAAK,CAAC,IAAI,CACR,QAAQ,EACR,KAAK,EACL,KAAK,CAAC,QAAQ,CACZ,mBAAmB,CAAC,KAAK,CAAC;IACxB,KAAK;IACL,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC,IAAI,CACjB,OAAO,IAAI,EAAE,EACb,OAAO,EAAE,SAAS,KAAK,IAAI;QACzB,CAAC,CAAC,CAAC,WAAW,EAAE,uBAAuB,EAAE,gBAAgB,CAAC;QAC1D,CAAC,CAAC,CAAC,uBAAuB,EAAE,gBAAgB,CAAC,CAChD;CACF,CAAC,EACF,gBAAgB,CAAC,KAAK,CAAC;IACrB,qBAAqB,EAAE,OAAO,EAAE,qBAAqB;IACrD,cAAc,EAAE,OAAO,EAAE,cAAc;CACxC,CAAC;AACF,+DAA+D;AAC/D,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC,MAAM,EAAE,EAAE,CACvD,mBAAmB,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC7C,iBAAiB,EAAE,UAAU,CAAC,yBAAyB;CACxD,CAAC,CACH,CACF,CACF,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Copilot.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Copilot.test.d.ts","sourceRoot":"","sources":["../src/Copilot.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,32 @@
1
+ import { OpenAiClient } from "@effect/ai-openai-compat";
2
+ import { assert, describe, it } from "@effect/vitest";
3
+ import * as Effect from "effect/Effect";
4
+ import * as Layer from "effect/Layer";
5
+ import * as Stream from "effect/Stream";
6
+ import * as LanguageModel from "effect/ai/LanguageModel";
7
+ import * as HttpClient from "effect/http/HttpClient";
8
+ import * as HttpClientResponse from "effect/http/HttpClientResponse";
9
+ import * as Copilot from "./Copilot.js";
10
+ const requestBody = Effect.fnUntraced(function* (options) {
11
+ const requests = [];
12
+ const client = HttpClient.make((request) => Effect.sync(() => {
13
+ requests.push(request);
14
+ return HttpClientResponse.fromWeb(request, new Response(null, { status: 400 }));
15
+ }));
16
+ yield* Effect.gen(function* () {
17
+ const ai = yield* LanguageModel.LanguageModel;
18
+ yield* ai.streamText({ prompt: "hello" }).pipe(Stream.runDrain, Effect.exit);
19
+ }).pipe(Effect.provide(Copilot.model("gpt-6-astra", options).pipe(Layer.provide(OpenAiClient.layer({ apiUrl: "https://copilot.test" })), Layer.provide(Layer.succeed(HttpClient.HttpClient, client)))));
20
+ assert.lengthOf(requests, 1);
21
+ const body = requests[0].body;
22
+ if (body._tag !== "Uint8Array")
23
+ throw new Error("Expected JSON body");
24
+ return JSON.parse(new TextDecoder().decode(body.body));
25
+ });
26
+ describe("Copilot.model", () => {
27
+ it.effect("sends the given reasoning effort, and none when it is null", () => Effect.gen(function* () {
28
+ assert.deepStrictEqual((yield* requestBody({ reasoning: { effort: "high" } })).reasoning, { effort: "high" });
29
+ assert.isFalse("reasoning" in (yield* requestBody({ reasoning: null })));
30
+ }));
31
+ });
32
+ //# sourceMappingURL=Copilot.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Copilot.test.js","sourceRoot":"","sources":["../src/Copilot.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,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C5D,CACF,CACF,CAAA;IACD,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;IAC5B,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAE,CAAC,IAAI,CAAA;IAC9B,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY;QAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAA;IACrE,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAGpD,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,MAAM,CAAC,4DAA4D,EAAE,GAAG,EAAE,CAC3E,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAClB,MAAM,CAAC,eAAe,CACpB,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EACjE,EAAE,MAAM,EAAE,MAAM,EAAE,CACnB,CAAA;QACD,MAAM,CAAC,OAAO,CAAC,WAAW,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;IAC1E,CAAC,CAAC,CACH,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Builds the model layers the `clanka` CLI runs, for the interactive prompt
3
+ * and for `clanka acp`.
4
+ *
5
+ * @since 1.0.0
6
+ */
7
+ import { OpenAiClient } from "@effect/ai-openai";
8
+ import type * as LanguageModel from "effect/ai/LanguageModel";
9
+ import type * as Model from "effect/ai/Model";
10
+ import * as Effect from "effect/Effect";
11
+ import * as Layer from "effect/Layer";
12
+ import * as Option from "effect/Option";
13
+ import { ThoughtLevel } from "./Acp.ts";
14
+ import * as Agent from "./Agent.ts";
15
+ import * as ModelsRepo from "./ModelsRepo.ts";
16
+ /**
17
+ * The model layer for a provider and model id. `effort` is `null` for models
18
+ * that take no reasoning effort, and `undefined` to keep the provider's
19
+ * default effort.
20
+ *
21
+ * @since 1.0.0
22
+ * @category Layers
23
+ */
24
+ export declare const make: (provider: ModelsRepo.Provider, model: string, effort: string | null | undefined, openai: OpenAiClient.Options) => Layer.Layer<LanguageModel.LanguageModel | Model.ModelName | Model.ProviderName | Agent.SubagentModel, never, import("./DeviceCodeHandler.ts").DeviceCodeHandler | import("effect/http/HttpClient").HttpClient | import("effect/persistence/KeyValueStore").KeyValueStore | import("effect/socket/Socket").WebSocketConstructor>;
25
+ /**
26
+ * Parses a `<provider>:<model>` id as advertised over ACP.
27
+ *
28
+ * @since 1.0.0
29
+ * @category Parsing
30
+ */
31
+ export declare const parseAcpModelId: (modelId: string) => Option.None<{
32
+ provider: "copilot" | "openai" | "xai";
33
+ model: string;
34
+ }> | Option.Some<{
35
+ provider: "copilot" | "openai" | "xai";
36
+ model: string;
37
+ }>;
38
+ /**
39
+ * The catalog as ACP `availableModels`, with `<provider>:<id>` ids. The
40
+ * provider is part of the name because providers share model names.
41
+ *
42
+ * @since 1.0.0
43
+ * @category ACP
44
+ */
45
+ export declare const acpModels: (models: ReadonlyArray<ModelsRepo.ModelInfo>) => {
46
+ modelId: string;
47
+ name: string;
48
+ }[];
49
+ /**
50
+ * An `Acp.Options.makeModel` callback. Ids that do not parse as
51
+ * `<provider>:<model>` are unknown models. A model the catalog lists without
52
+ * efforts runs with no reasoning options, whatever the session thought level.
53
+ * A listed model that does not support the session thought level runs at the
54
+ * supported effort nearest to it in `ThoughtLevel` order, the higher one on a
55
+ * tie. Unlisted models run at the session thought level.
56
+ *
57
+ * @since 1.0.0
58
+ * @category ACP
59
+ */
60
+ export declare const makeAcp: (options: {
61
+ readonly models: Effect.Effect<ReadonlyArray<ModelsRepo.ModelInfo>>;
62
+ readonly openai: OpenAiClient.Options;
63
+ }) => (modelId: string, thoughtLevel: ThoughtLevel) => Option.Option<Layer.Layer<LanguageModel.LanguageModel | Model.ModelName | Model.ProviderName | Agent.SubagentModel, never, import("./DeviceCodeHandler.ts").DeviceCodeHandler | import("effect/http/HttpClient").HttpClient | import("effect/persistence/KeyValueStore").KeyValueStore | import("effect/socket/Socket").WebSocketConstructor>>;
64
+ //# sourceMappingURL=ModelLayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModelLayer.d.ts","sourceRoot":"","sources":["../src/ModelLayer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,KAAK,aAAa,MAAM,yBAAyB,CAAA;AAC7D,OAAO,KAAK,KAAK,KAAK,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAGnC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAW7C;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI,aACL,UAAU,CAAC,QAAQ,SACtB,MAAM,UACL,MAAM,GAAG,IAAI,GAAG,SAAS,UACzB,YAAY,CAAC,OAAO,oUAqB7B,CAAA;AAID;;;;;GAKG;AACH,eAAO,MAAM,eAAe,YAAa,MAAM;;;;;;EAK9C,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,WAAY,aAAa,CAAC,UAAU,CAAC,SAAS,CAAC;;;GAIhE,CAAA;AA0BL;;;;;;;;;;GAUG;AACH,eAAO,MAAM,OAAO,YACR;IACR,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAA;IACnE,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC,OAAO,CAAA;CACtC,eACS,MAAM,gBAAgB,YAAY,mVAiBzC,CAAA"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Builds the model layers the `clanka` CLI runs, for the interactive prompt
3
+ * and for `clanka acp`.
4
+ *
5
+ * @since 1.0.0
6
+ */
7
+ import { OpenAiClient } from "@effect/ai-openai";
8
+ import * as Effect from "effect/Effect";
9
+ import * as Layer from "effect/Layer";
10
+ import * as Option from "effect/Option";
11
+ import * as Schema from "effect/Schema";
12
+ import { ThoughtLevel } from "./Acp.js";
13
+ import * as Agent from "./Agent.js";
14
+ import * as Codex from "./Codex.js";
15
+ import * as Copilot from "./Copilot.js";
16
+ import * as ModelsRepo from "./ModelsRepo.js";
17
+ import * as Xai from "./Xai.js";
18
+ const withSubagentModel = (model) => Layer.merge(model, Agent.layerSubagentModel(model));
19
+ /**
20
+ * The model layer for a provider and model id. `effort` is `null` for models
21
+ * that take no reasoning effort, and `undefined` to keep the provider's
22
+ * default effort.
23
+ *
24
+ * @since 1.0.0
25
+ * @category Layers
26
+ */
27
+ export const make = (provider, model, effort, openai) => {
28
+ const options = effort === undefined
29
+ ? undefined
30
+ : { reasoning: effort === null ? null : { effort: effort } };
31
+ return provider === "openai"
32
+ ? openai.apiKey !== undefined
33
+ ? withSubagentModel(Codex.model(model, options)).pipe(Layer.provide(OpenAiClient.layer(openai)))
34
+ : withSubagentModel(Codex.modelWebSocket(model, options)).pipe(Layer.provide(Codex.layerClient))
35
+ : provider === "xai"
36
+ ? withSubagentModel(Xai.modelWebSocket(model, options)).pipe(Layer.provide(Xai.layerClient))
37
+ : withSubagentModel(Copilot.model(model, options)).pipe(Layer.provide(Copilot.layerClient));
38
+ };
39
+ const isProvider = Schema.is(ModelsRepo.Provider);
40
+ /**
41
+ * Parses a `<provider>:<model>` id as advertised over ACP.
42
+ *
43
+ * @since 1.0.0
44
+ * @category Parsing
45
+ */
46
+ export const parseAcpModelId = (modelId) => {
47
+ const [provider, model, ...rest] = modelId.split(":");
48
+ return isProvider(provider) && model !== undefined && rest.length === 0
49
+ ? Option.some({ provider, model })
50
+ : Option.none();
51
+ };
52
+ /**
53
+ * The catalog as ACP `availableModels`, with `<provider>:<id>` ids. The
54
+ * provider is part of the name because providers share model names.
55
+ *
56
+ * @since 1.0.0
57
+ * @category ACP
58
+ */
59
+ export const acpModels = (models) => models.map((model) => ({
60
+ modelId: `${model.provider}:${model.id}`,
61
+ name: `${model.name} (${model.provider})`,
62
+ }));
63
+ const rank = (level) => ThoughtLevel.literals.indexOf(level);
64
+ // The effort a catalog model with `efforts` runs at for a session
65
+ // `thoughtLevel`: `null` for no efforts, else the nearest supported effort,
66
+ // breaking ties upward.
67
+ const resolveEffort = (efforts, thoughtLevel) => {
68
+ const distance = (level) => Math.abs(rank(level) - rank(thoughtLevel));
69
+ let resolved = null;
70
+ for (const effort of efforts) {
71
+ if (resolved === null ||
72
+ distance(effort) < distance(resolved) ||
73
+ (distance(effort) === distance(resolved) && rank(effort) > rank(resolved))) {
74
+ resolved = effort;
75
+ }
76
+ }
77
+ return resolved;
78
+ };
79
+ /**
80
+ * An `Acp.Options.makeModel` callback. Ids that do not parse as
81
+ * `<provider>:<model>` are unknown models. A model the catalog lists without
82
+ * efforts runs with no reasoning options, whatever the session thought level.
83
+ * A listed model that does not support the session thought level runs at the
84
+ * supported effort nearest to it in `ThoughtLevel` order, the higher one on a
85
+ * tie. Unlisted models run at the session thought level.
86
+ *
87
+ * @since 1.0.0
88
+ * @category ACP
89
+ */
90
+ export const makeAcp = (options) => (modelId, thoughtLevel) => Option.map(parseAcpModelId(modelId), ({ provider, model }) => Layer.unwrap(Effect.map(options.models, (catalog) => {
91
+ const info = catalog.find((entry) => entry.provider === provider && entry.id === model);
92
+ return make(provider, model, info === undefined
93
+ ? thoughtLevel
94
+ : resolveEffort(info.efforts, thoughtLevel), options.openai);
95
+ })));
96
+ //# sourceMappingUR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AAE,EAAE,EAAE,CAC3D,KAAK,CAAC,MAAM,CACV,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;IACrC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CACvB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,KAAK,QAAQ,IAAI,KAAK,CAAC,EAAE,KAAK,KAAK,CAC7D,CAAA;IACD,OAAO,IAAI,CACT,QAAQ,EACR,KAAK,EACL,IAAI,KAAK,SAAS;QAChB,CAAC,CAAC,YAAY;QACd,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,EAC7C,OAAO,CAAC,MAAM,CACf,CAAA;AACH,CAAC,CAAC,CACH,CACF,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ModelLayer.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModelLayer.test.d.ts","sourceRoot":"","sources":["../src/ModelLayer.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,83 @@
1
+ import { assert, describe, it } from "@effect/vitest";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Layer from "effect/Layer";
4
+ import * as Option from "effect/Option";
5
+ import * as Redacted from "effect/Redacted";
6
+ import * as Stream from "effect/Stream";
7
+ import * as LanguageModel from "effect/ai/LanguageModel";
8
+ import * as HttpClient from "effect/http/HttpClient";
9
+ import * as HttpClientResponse from "effect/http/HttpClientResponse";
10
+ import * as KeyValueStore from "effect/persistence/KeyValueStore";
11
+ import * as Socket from "effect/socket/Socket";
12
+ import { DeviceCodeHandler } from "./DeviceCodeHandler.js";
13
+ import * as ModelLayer from "./ModelLayer.js";
14
+ import * as ModelsRepo from "./ModelsRepo.js";
15
+ const makeModel = ModelLayer.makeAcp({
16
+ models: Effect.succeed([
17
+ new ModelsRepo.ModelInfo({
18
+ provider: "openai",
19
+ id: "gpt-4.1",
20
+ name: "GPT-4.1",
21
+ efforts: [],
22
+ }),
23
+ new ModelsRepo.ModelInfo({
24
+ provider: "openai",
25
+ id: "gpt-6-astra",
26
+ name: "GPT-6 Astra",
27
+ efforts: ["low", "high"],
28
+ }),
29
+ new ModelsRepo.ModelInfo({
30
+ provider: "openai",
31
+ id: "gpt-5-pro",
32
+ name: "GPT-5 Pro",
33
+ efforts: ["high"],
34
+ }),
35
+ ]),
36
+ openai: {
37
+ apiKey: Redacted.make("test-key"),
38
+ apiUrl: "https://codex.test",
39
+ },
40
+ });
41
+ // The other providers' login and socket services, which the API-key openai
42
+ // path must not use.
43
+ const unused = Layer.mergeAll(KeyValueStore.layerMemory, Layer.succeed(DeviceCodeHandler, {
44
+ onCode: () => Effect.die("The API-key path must not log in"),
45
+ }), Layer.succeed(Socket.WebSocketConstructor, () => {
46
+ throw new Error("Unexpected live WebSocket");
47
+ }));
48
+ // The request body the model for `modelId` sends at session thought level
49
+ // `thoughtLevel`.
50
+ const requestBody = Effect.fnUntraced(function* (modelId, thoughtLevel = "high") {
51
+ const requests = [];
52
+ const client = HttpClient.make((request) => Effect.sync(() => {
53
+ requests.push(request);
54
+ return HttpClientResponse.fromWeb(request, new Response(null, { status: 400 }));
55
+ }));
56
+ const model = Option.getOrThrow(makeModel(modelId, thoughtLevel));
57
+ yield* Effect.gen(function* () {
58
+ const ai = yield* LanguageModel.LanguageModel;
59
+ yield* ai.streamText({ prompt: "hello" }).pipe(Stream.runDrain, Effect.exit);
60
+ }).pipe(Effect.provide(model.pipe(Layer.provide([Layer.succeed(HttpClient.HttpClient, client), unused]))));
61
+ assert.lengthOf(requests, 1);
62
+ const body = requests[0].body;
63
+ if (body._tag !== "Uint8Array")
64
+ throw new Error("Expected JSON body");
65
+ return JSON.parse(new TextDecoder().decode(body.body));
66
+ });
67
+ describe("ModelLayer.makeAcp", () => {
68
+ it.effect("sends no reasoning for a catalog model without efforts", () => Effect.gen(function* () {
69
+ assert.isFalse("reasoning" in (yield* requestBody("openai:gpt-4.1")));
70
+ }));
71
+ for (const modelId of ["openai:gpt-6-astra", "openai:gpt-unlisted"]) {
72
+ it.effect("sends the session effort for " + modelId, () => Effect.gen(function* () {
73
+ assert.strictEqual((yield* requestBody(modelId)).reasoning?.effort, "high");
74
+ }));
75
+ }
76
+ it.effect("sends a supported effort when the catalog model lacks the session effort", () => Effect.gen(function* () {
77
+ assert.strictEqual((yield* requestBody("openai:gpt-5-pro", "medium")).reasoning?.effort, "high");
78
+ }));
79
+ it("rejects ids that are not <provider>:<model>", () => {
80
+ assert.isTrue(Option.isNone(makeModel("nope", "high")));
81
+ });
82
+ });
83
+ //# sourceMappingURL=ModelLayer.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModelLayer.test.js","sourceRoot":"","sources":["../src/ModelLayer.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,aAAa,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAA;AAEpD,OAAO,KAAK,kBAAkB,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,aAAa,MAAM,kCAAkC,CAAA;AACjE,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAA;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAE7C,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC;IACnC,MAAM,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EF,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,MAAM,CAAC,wDAAwD,EAAE,GAAG,EAAE,CACvE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAClB,MAAM,CAAC,OAAO,CAAC,WAAW,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAA;IACvE,CAAC,CAAC,CACH,CAAA;IAED,KAAK,MAAM,OAAO,IAAI,CAAC,oBAAoB,EAAE,qBAAqB,CAAC,EAAE,CAAC;QACpE,EAAE,CAAC,MAAM,CAAC,+BAA+B,GAAG,OAAO,EAAE,GAAG,EAAE,CACxD,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;YAClB,MAAM,CAAC,WAAW,CAChB,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,MAAM,EAC/C,MAAM,CACP,CAAA;QACH,CAAC,CAAC,CACH,CAAA;IACH,CAAC;IAED,EAAE,CAAC,MAAM,CACP,0EAA0E,EAC1E,GAAG,EAAE,CACH,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAClB,MAAM,CAAC,WAAW,CAChB,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,EAAE,MAAM,EACpE,MAAM,CACP,CAAA;IACH,CAAC,CAAC,CACL,CAAA;IAED,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAA;IACzD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,80 @@
1
+ import * as Context from "effect/Context";
2
+ import * as Duration from "effect/Duration";
3
+ import * as Effect from "effect/Effect";
4
+ import * as HttpClient from "effect/http/HttpClient";
5
+ import * as Layer from "effect/Layer";
6
+ import * as KeyValueStore from "effect/persistence/KeyValueStore";
7
+ import * as Schema from "effect/Schema";
8
+ /**
9
+ * A clanka provider, as `--provider` takes it.
10
+ *
11
+ * @since 1.0.0
12
+ * @category Models
13
+ */
14
+ export declare const Provider: Schema.Literals<readonly ["openai", "copilot", "xai"]>;
15
+ /**
16
+ * @since 1.0.0
17
+ * @category Models
18
+ */
19
+ export type Provider = typeof Provider.Type;
20
+ declare const ModelInfo_base: Schema.Class<ModelInfo, Schema.Struct<{
21
+ readonly provider: Schema.Literals<readonly ["openai", "copilot", "xai"]>;
22
+ /**
23
+ * The model id as the provider API expects it, e.g. `gpt-6-astra`.
24
+ */
25
+ readonly id: Schema.String;
26
+ readonly name: Schema.String;
27
+ /**
28
+ * Reasoning efforts the model accepts; empty when it takes none.
29
+ */
30
+ readonly efforts: Schema.$Array<Schema.Literals<readonly ["none", "minimal", "low", "medium", "high", "xhigh", "max"]>>;
31
+ }>, {}>;
32
+ /**
33
+ * @since 1.0.0
34
+ * @category Models
35
+ */
36
+ export declare class ModelInfo extends ModelInfo_base {
37
+ }
38
+ /**
39
+ * The built-in catalog, served when neither models.dev nor a cached catalog
40
+ * is available.
41
+ *
42
+ * @since 1.0.0
43
+ * @category Models
44
+ */
45
+ export declare const fallback: ReadonlyArray<ModelInfo>;
46
+ declare const ModelsRepo_base: Context.ServiceClass<ModelsRepo, "clanka/ModelsRepo", {
47
+ /**
48
+ * Every chat model clanka can run, in catalog order. Never fails: an
49
+ * implementation that cannot reach its source serves what it has.
50
+ */
51
+ readonly models: Effect.Effect<ReadonlyArray<ModelInfo>>;
52
+ }>;
53
+ /**
54
+ * @since 1.0.0
55
+ * @category Services
56
+ */
57
+ export declare class ModelsRepo extends ModelsRepo_base {
58
+ /**
59
+ * A fixed catalog.
60
+ *
61
+ * @since 1.0.0
62
+ * @category Layers
63
+ */
64
+ static readonly layer: (models: ReadonlyArray<ModelInfo>) => Layer.Layer<ModelsRepo>;
65
+ /**
66
+ * The catalog built from `https://models.dev/api.json`: the `openai`,
67
+ * `github-copilot` and `xai` text models that are not deprecated and accept
68
+ * tool calls, cached in the `KeyValueStore` for `ttl` (default 24 hours).
69
+ * Serves the cached catalog when the fetch fails, then `fallback`.
70
+ *
71
+ * @since 1.0.0
72
+ * @category Layers
73
+ */
74
+ static readonly layerModelsDev: (options?: {
75
+ readonly url?: string | undefined;
76
+ readonly ttl?: Duration.Input | undefined;
77
+ } | undefined) => Layer.Layer<ModelsRepo, never, HttpClient.HttpClient | KeyValueStore.KeyValueStore>;
78
+ }
79
+ export {};
80
+ //# sourceMappingURL=ModelsRepo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModelsRepo.d.ts","sourceRoot":"","sources":["../src/ModelsRepo.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAA;AAEpD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,KAAK,aAAa,MAAM,kCAAkC,CAAA;AACjE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,wDAAgD,CAAA;AAErE;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAA;;;IAUzC;;OAEG;;;IAGH;;OAEG;;;AAfL;;;GAGG;AACH,qBAAa,SAAU,SAAQ,cAa7B;CAAG;AAEL;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,EAAE,aAAa,CAAC,SAAS,CAmB7C,CAAA;;IAgFG;;;OAGG;qBACc,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;;AAX5D;;;GAGG;AACH,qBAAa,UAAW,SAAQ,eASR;IACtB;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,KAAK,WACX,aAAa,CAAC,SAAS,CAAC,KAC/B,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CACoD;IAE9E;;;;;;;;OAQG;IACH,MAAM,CAAC,QAAQ,CAAC,cAAc,aAExB;QACE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;QACjC,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAA;KAC1C,GACD,SAAS,KACZ,KAAK,CAAC,KAAK,CACZ,UAAU,EACV,KAAK,EACL,UAAU,CAAC,UAAU,GAAG,aAAa,CAAC,aAAa,CACpD,CA8DE;CACJ"}
@@ -0,0 +1,162 @@
1
+ /**
2
+ * The catalog of chat models clanka can run, and a models.dev implementation.
3
+ *
4
+ * See `.specs/models-repo.md`.
5
+ *
6
+ * @since 1.0.0
7
+ */
8
+ import * as Clock from "effect/Clock";
9
+ import * as Context from "effect/Context";
10
+ import * as Duration from "effect/Duration";
11
+ import * as Effect from "effect/Effect";
12
+ import * as HttpClient from "effect/http/HttpClient";
13
+ import * as HttpClientResponse from "effect/http/HttpClientResponse";
14
+ import * as Layer from "effect/Layer";
15
+ import * as Option from "effect/Option";
16
+ import * as KeyValueStore from "effect/persistence/KeyValueStore";
17
+ import * as Schema from "effect/Schema";
18
+ import { ThoughtLevel } from "./Acp.js";
19
+ /**
20
+ * A clanka provider, as `--provider` takes it.
21
+ *
22
+ * @since 1.0.0
23
+ * @category Models
24
+ */
25
+ export const Provider = Schema.Literals(["openai", "copilot", "xai"]);
26
+ /**
27
+ * @since 1.0.0
28
+ * @category Models
29
+ */
30
+ export class ModelInfo extends Schema.Class("clanka/ModelsRepo/ModelInfo")({
31
+ provider: Provider,
32
+ /**
33
+ * The model id as the provider API expects it, e.g. `gpt-6-astra`.
34
+ */
35
+ id: Schema.String,
36
+ name: Schema.String,
37
+ /**
38
+ * Reasoning efforts the model accepts; empty when it takes none.
39
+ */
40
+ efforts: Schema.Array(ThoughtLevel),
41
+ }) {
42
+ }
43
+ /**
44
+ * The built-in catalog, served when neither models.dev nor a cached catalog
45
+ * is available.
46
+ *
47
+ * @since 1.0.0
48
+ * @category Models
49
+ */
50
+ export const fallback = [
51
+ new ModelInfo({
52
+ provider: "openai",
53
+ id: "gpt-6-astra",
54
+ name: "GPT-6 Astra",
55
+ efforts: ["low", "medium", "high", "xhigh", "max"],
56
+ }),
57
+ new ModelInfo({
58
+ provider: "copilot",
59
+ id: "gpt-6-astra",
60
+ name: "GPT-6 Astra",
61
+ efforts: ["low", "medium", "high", "xhigh", "max"],
62
+ }),
63
+ new ModelInfo({
64
+ provider: "xai",
65
+ id: "grok-4.6",
66
+ name: "Grok 4.6",
67
+ efforts: ["low", "medium", "high", "xhigh"],
68
+ }),
69
+ ];
70
+ // The fields of a models.dev model entry the catalog reads. Entries are
71
+ // decoded one by one, so a malformed entry drops that model only.
72
+ const ModelsDevModel = Schema.Struct({
73
+ id: Schema.String,
74
+ name: Schema.String,
75
+ type: Schema.optionalKey(Schema.String),
76
+ status: Schema.optionalKey(Schema.String),
77
+ tool_call: Schema.optionalKey(Schema.Boolean),
78
+ reasoning_options: Schema.optionalKey(Schema.Array(Schema.Struct({
79
+ type: Schema.String,
80
+ values: Schema.optionalKey(Schema.Array(Schema.Unknown)),
81
+ }))),
82
+ });
83
+ const ModelsDevProvider = Schema.Struct({
84
+ models: Schema.Record(Schema.String, Schema.Unknown),
85
+ });
86
+ // models.dev provider id to clanka provider, in catalog order.
87
+ const providerIds = [
88
+ ["openai", "openai"],
89
+ ["github-copilot", "copilot"],
90
+ ["xai", "xai"],
91
+ ];
92
+ const ModelsDevApi = Schema.Struct(Object.fromEntries(providerIds.map(([id]) => [id, Schema.optionalKey(ModelsDevProvider)])));
93
+ const decodeModel = Schema.decodeUnknownOption(ModelsDevModel);
94
+ const isThoughtLevel = Schema.is(ThoughtLevel);
95
+ const toCatalog = (api) => providerIds.flatMap(([id, provider]) => Object.values(api[id]?.models ?? {}).flatMap((entry) => {
96
+ const model = Option.getOrUndefined(decodeModel(entry));
97
+ if (model === undefined ||
98
+ model.type !== undefined ||
99
+ model.status === "deprecated" ||
100
+ model.tool_call !== true) {
101
+ return [];
102
+ }
103
+ const effort = model.reasoning_options?.find((option) => option.type === "effort");
104
+ return [
105
+ new ModelInfo({
106
+ provider,
107
+ id: model.id,
108
+ name: model.name,
109
+ efforts: (effort?.values ?? []).filter(isThoughtLevel),
110
+ }),
111
+ ];
112
+ }));
113
+ class CachedCatalog extends Schema.Class("clanka/ModelsRepo/CachedCatalog")({
114
+ fetchedAt: Schema.Finite,
115
+ models: Schema.Array(ModelInfo),
116
+ }) {
117
+ }
118
+ /**
119
+ * @since 1.0.0
120
+ * @category Services
121
+ */
122
+ export class ModelsRepo extends Context.Service()("clanka/ModelsRepo") {
123
+ /**
124
+ * A fixed catalog.
125
+ *
126
+ * @since 1.0.0
127
+ * @category Layers
128
+ */
129
+ static layer = (models) => Layer.succeed(ModelsRepo, ModelsRepo.of({ models: Effect.succeed(models) }));
130
+ /**
131
+ * The catalog built from `https://models.dev/api.json`: the `openai`,
132
+ * `github-copilot` and `xai` text models that are not deprecated and accept
133
+ * tool calls, cached in the `KeyValueStore` for `ttl` (default 24 hours).
134
+ * Serves the cached catalog when the fetch fails, then `fallback`.
135
+ *
136
+ * @since 1.0.0
137
+ * @category Layers
138
+ */
139
+ static layerModelsDev = (options) => Layer.effect(ModelsRepo, Effect.gen(function* () {
140
+ const url = options?.url ?? "https://models.dev/api.json";
141
+ const ttl = Duration.toMillis(Duration.fromInputUnsafe(options?.ttl ?? Duration.hours(24)));
142
+ const store = KeyValueStore.toSchemaStore(KeyValueStore.prefix(yield* KeyValueStore.KeyValueStore, "models-dev/"), CachedCatalog);
143
+ const httpClient = (yield* HttpClient.HttpClient).pipe(HttpClient.filterStatusOk);
144
+ const fetchCatalog = httpClient
145
+ .get(url)
146
+ .pipe(Effect.flatMap(HttpClientResponse.schemaBodyJson(ModelsDevApi)), Effect.map(toCatalog), Effect.timeout("15 seconds"));
147
+ const load = Effect.gen(function* () {
148
+ const cached = yield* store.get(url).pipe(Effect.map(Option.getOrUndefined), Effect.catch(() => Effect.undefined));
149
+ const now = yield* Clock.currentTimeMillis;
150
+ if (cached !== undefined && now - cached.fetchedAt < ttl) {
151
+ return cached.models;
152
+ }
153
+ return yield* fetchCatalog.pipe(Effect.tap((models) => store
154
+ .set(url, new CachedCatalog({ fetchedAt: now, models }))
155
+ .pipe(Effect.catch((error) => Effect.logWarning("Failed to cache the models.dev catalog", error)))), Effect.catch((error) => Effect.logWarning(cached !== undefined
156
+ ? "Failed to refresh the models.dev catalog, using the cached catalog"
157
+ : "Failed to fetch the models.dev catalog, using the built-in catalog", error).pipe(Effect.as(cached?.models ?? fallback))));
158
+ });
159
+ return ModelsRepo.of({ models: yield* Effect.cached(load) });
160
+ }));
161
+ }
162
+ //# sourceMappingURL=ModelsRepo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModelsRepo.js","sourceRoot":"","sources":["../src/ModelsRepo.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,kBAAkB,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,aAAa,MAAM,kCAAkC,CAAA;AACjE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC;;;;;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G,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAA;YAC1C,IAAI,MAAM,KAAK,SAAS,IAAI,GAAG,GAAG,MAAM,CAAC,SAAS,GAAG,GAAG,EAAE,CAAC;gBACzD,OAAO,MAAM,CAAC,MAAM,CAAA;YACtB,CAAC;YACD,OAAO,KAAK,CAAC,CAAC,YAAY,CAAC,IAAI,CAC7B,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACpB,KAAK;iBACF,GAAG,CAAC,GAAG,EAAE,IAAI,aAAa,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;iBACvD,IAAI,CACH,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CACrB,MAAM,CAAC,UAAU,CACf,wCAAwC,EACxC,KAAK,CACN,CACF,CACF,CACJ,EACD,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CACrB,MAAM,CAAC,UAAU,CACf,MAAM,KAAK,SAAS;gBAClB,CAAC,CAAC,oEAAoE;gBACtE,CAAC,CAAC,oEAAoE,EACxE,KAAK,CACN,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,IAAI,QAAQ,CAAC,CAAC,CAC9C,CACF,CAAA;QACH,CAAC,CAAC,CAAA;QAEF,OAAO,UAAU,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC9D,CAAC,CAAC,CACH,CAAA;CACJ"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ModelsRepo.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModelsRepo.test.d.ts","sourceRoot":"","sources":["../src/ModelsRepo.test.ts"],"names":[],"mappings":""}