lalph 0.3.91 → 0.3.92

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/dist/cli.mjs CHANGED
@@ -232437,14 +232437,11 @@ const parseInput = flow(decodeUnknownEffect(Tuple([
232437
232437
  String$1,
232438
232438
  Reasoning
232439
232439
  ])), orDie$2);
232440
- var ClankaModels = class extends Service()("lalph/ClankaModels", {
232441
- dependencies: [ModelServices],
232442
- lookup: fnUntraced(function* (input) {
232443
- const [provider, model, reasoning] = yield* parseInput(input.split("/"));
232444
- const layer = resolve$1(provider, model, reasoning);
232445
- return merge$6(layer, layerSubagentModel(reasoning === "low" ? layer : resolveSubagent(provider, model, reasoning === "medium" ? "low" : "medium")));
232446
- }, unwrap$3)
232447
- }) {};
232440
+ const layerClankaModel = (input) => unwrap$3(gen(function* () {
232441
+ const [provider, model, reasoning] = yield* parseInput(input.split("/"));
232442
+ const layer = resolve$1(provider, model, reasoning);
232443
+ return merge$6(layer, layerSubagentModel(reasoning === "low" ? layer : resolveSubagent(provider, model, reasoning === "medium" ? "low" : "medium")));
232444
+ }));
232448
232445
  const resolve$1 = (provider, model$3, reasoning) => {
232449
232446
  switch (provider) {
232450
232447
  case "openai": return modelWebSocket(model$3, { reasoning: { effort: reasoning } }).pipe(provide$3(layerWebSocketConstructorWS), provide$3(layerClient$1));
@@ -232536,7 +232533,7 @@ const addOrUpdatePreset = fnUntraced(function* (options) {
232536
232533
  });
232537
232534
  if (cliAgent.id === "clanka") {
232538
232535
  yield* log$1("Verifying Clanka model configuration...");
232539
- yield* generateText({ prompt: "say hello" }).pipe(ignore$1, provide$1(ClankaModels.get(preset.extraArgs.join(" "))));
232536
+ yield* generateText({ prompt: "say hello" }).pipe(ignore$1, provide$1(layerClankaModel(preset.extraArgs.join(" ")), { local: true }), provide$1(ModelServices));
232540
232537
  }
232541
232538
  if (id !== CliAgentPreset.defaultId) preset = yield* (yield* IssueSource).updateCliAgentPreset(preset);
232542
232539
  yield* Settings.set(allCliAgentPresets, some$2(options?.existing ? presets.map((p) => p.id === preset.id ? preset : p) : [...presets, preset]));
@@ -240975,7 +240972,7 @@ const runClanka = fnUntraced(function* (options) {
240975
240972
  }, scoped$1, (effect, options) => provide$1(effect, layerLocal({
240976
240973
  directory: options.directory,
240977
240974
  tools: options.mode === "ralph" ? void 0 : options.mode === "choose" ? TaskChooseTools : TaskTools
240978
- }).pipe(merge$6(ClankaModels.get(options.model))), { local: true }), provide$1([layerUndici, TaskToolsHandlers]));
240975
+ }).pipe(merge$6(layerClankaModel(options.model))), { local: true }), provide$1([ModelServices, TaskToolsHandlers]));
240979
240976
  //#endregion
240980
240977
  //#region src/domain/CurrentTask.ts
240981
240978
  const CurrentTask = taggedEnum();
@@ -241992,7 +241989,7 @@ const commandEdit = make$58("edit").pipe(withDescription("Open the selected proj
241992
241989
  const commandSource = make$58("source").pipe(withDescription("Select the issue source to use (e.g. GitHub Issues or Linear). This applies to all projects."), withHandler(() => selectIssueSource), provide(Settings.layer));
241993
241990
  //#endregion
241994
241991
  //#region package.json
241995
- var version = "0.3.91";
241992
+ var version = "0.3.92";
241996
241993
  //#endregion
241997
241994
  //#region src/commands/projects/ls.ts
241998
241995
  const commandProjectsLs = make$58("ls").pipe(withDescription("List configured projects and how they run (enabled state, concurrency, branch, git flow, review agent)."), withHandler(fnUntraced(function* () {
@@ -242138,6 +242135,6 @@ commandRoot.pipe(withSubcommands([
242138
242135
  const logLevel = succeed$4(MinimumLogLevel, "All");
242139
242136
  atomRuntime.addGlobalLayer(logLevel);
242140
242137
  return logLevel;
242141
- }), run$5({ version }), provide$1([ClankaModels.layer, PlatformServices]), provideService$2(CurrentMemoMap, lalphMemoMap), runMain);
242138
+ }), run$5({ version }), provide$1(PlatformServices), provideService$2(CurrentMemoMap, lalphMemoMap), runMain);
242142
242139
  //#endregion
242143
242140
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lalph",
3
3
  "type": "module",
4
- "version": "0.3.91",
4
+ "version": "0.3.92",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
package/src/Clanka.ts CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  Stream,
13
13
  } from "effect"
14
14
  import { TaskChooseTools, TaskTools, TaskToolsHandlers } from "./TaskTools.ts"
15
- import { ClankaModels } from "./ClankaModels.ts"
15
+ import { layerClankaModel, ModelServices } from "./ClankaModels.ts"
16
16
  import { withStallTimeout } from "./shared/stream.ts"
17
17
  import { NodeHttpClient } from "@effect/platform-node"
18
18
  import type { Prompt } from "effect/unstable/ai"
@@ -129,8 +129,8 @@ export const runClanka = Effect.fnUntraced(
129
129
  : options.mode === "choose"
130
130
  ? TaskChooseTools
131
131
  : TaskTools,
132
- }).pipe(Layer.merge(ClankaModels.get(options.model))),
132
+ }).pipe(Layer.merge(layerClankaModel(options.model))),
133
133
  { local: true },
134
134
  ),
135
- Effect.provide([NodeHttpClient.layerUndici, TaskToolsHandlers]),
135
+ Effect.provide([ModelServices, TaskToolsHandlers]),
136
136
  )
@@ -1,7 +1,7 @@
1
1
  // oxlint-disable typescript/no-explicit-any
2
2
  import { NodeHttpClient, NodeSocket } from "@effect/platform-node"
3
3
  import { Agent, Codex, Copilot } from "clanka"
4
- import { Effect, flow, Layer, LayerMap, Schema } from "effect"
4
+ import { Effect, flow, Layer, Schema } from "effect"
5
5
  import { layerKvs } from "./Kvs.ts"
6
6
 
7
7
  export const ModelServices = NodeHttpClient.layerUndici.pipe(
@@ -20,11 +20,9 @@ const parseInput = flow(
20
20
  Effect.orDie,
21
21
  )
22
22
 
23
- export class ClankaModels extends LayerMap.Service<ClankaModels>()(
24
- "lalph/ClankaModels",
25
- {
26
- dependencies: [ModelServices],
27
- lookup: Effect.fnUntraced(function* (input: string) {
23
+ export const layerClankaModel = (input: string) =>
24
+ Layer.unwrap(
25
+ Effect.gen(function* () {
28
26
  const [provider, model, reasoning] = yield* parseInput(input.split("/"))
29
27
  const layer = resolve(provider, model, reasoning)
30
28
  return Layer.merge(
@@ -39,9 +37,8 @@ export class ClankaModels extends LayerMap.Service<ClankaModels>()(
39
37
  ),
40
38
  ),
41
39
  )
42
- }, Layer.unwrap),
43
- },
44
- ) {}
40
+ }),
41
+ )
45
42
 
46
43
  const resolve = (
47
44
  provider: "openai" | "copilot",
package/src/Presets.ts CHANGED
@@ -5,7 +5,7 @@ import { Prompt } from "effect/unstable/cli"
5
5
  import { allCliAgents, type AnyCliAgent } from "./domain/CliAgent.ts"
6
6
  import { parseCommand } from "./shared/child-process.ts"
7
7
  import { IssueSource } from "./IssueSource.ts"
8
- import { ClankaModels } from "./ClankaModels.ts"
8
+ import { layerClankaModel, ModelServices } from "./ClankaModels.ts"
9
9
  import { LanguageModel } from "effect/unstable/ai"
10
10
 
11
11
  export const allCliAgentPresets = new Setting(
@@ -131,9 +131,13 @@ export const addOrUpdatePreset = Effect.fnUntraced(function* (options?: {
131
131
 
132
132
  if (cliAgent.id === "clanka") {
133
133
  yield* Effect.log("Verifying Clanka model configuration...")
134
+ // @effect-diagnostics-next-line multipleEffectProvide:off
134
135
  yield* LanguageModel.generateText({ prompt: "say hello" }).pipe(
135
136
  Effect.ignore,
136
- Effect.provide(ClankaModels.get(preset.extraArgs.join(" "))),
137
+ Effect.provide(layerClankaModel(preset.extraArgs.join(" ")), {
138
+ local: true,
139
+ }),
140
+ Effect.provide(ModelServices),
137
141
  )
138
142
  }
139
143
 
package/src/cli.ts CHANGED
@@ -17,7 +17,6 @@ import { PlatformServices } from "./shared/platform.ts"
17
17
  import { commandProjects } from "./commands/projects.ts"
18
18
  import { commandSh } from "./commands/sh.ts"
19
19
  import { commandAgents } from "./commands/agents.ts"
20
- import { ClankaModels } from "./ClankaModels.ts"
21
20
 
22
21
  commandRoot.pipe(
23
22
  Command.withSubcommands([
@@ -40,7 +39,7 @@ commandRoot.pipe(
40
39
  Command.run({
41
40
  version: PackageJson.version,
42
41
  }),
43
- Effect.provide([ClankaModels.layer, PlatformServices]),
42
+ Effect.provide(PlatformServices),
44
43
  Effect.provideService(Layer.CurrentMemoMap, lalphMemoMap),
45
44
  NodeRuntime.runMain,
46
45
  )
@@ -58,7 +58,6 @@ import { getDefaultCliAgentPreset } from "../Presets.ts"
58
58
  import type { QuitError } from "effect/Terminal"
59
59
  import type { TimeoutError } from "effect/Cause"
60
60
  import type { ChildProcessSpawner } from "effect/unstable/process"
61
- import { ClankaModels } from "../ClankaModels.ts"
62
61
  import type { AiError } from "effect/unstable/ai/AiError"
63
62
  import type { PrdIssue } from "../domain/PrdIssue.ts"
64
63
  import { CurrentTaskRef } from "../TaskTools.ts"
@@ -103,7 +102,6 @@ const run = Effect.fnUntraced(
103
102
  | PromptGen
104
103
  | Prd
105
104
  | Worktree
106
- | ClankaModels
107
105
  | OutputFormatter.Muxer
108
106
  | Scope.Scope
109
107
  > {
@@ -382,7 +380,6 @@ const runRalph = Effect.fnUntraced(
382
380
  | PromptGen
383
381
  | Prd
384
382
  | Worktree
385
- | ClankaModels
386
383
  | OutputFormatter.Muxer
387
384
  | Scope.Scope
388
385
  > {