lalph 0.3.52 → 0.3.54

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lalph",
3
3
  "type": "module",
4
- "version": "0.3.52",
4
+ "version": "0.3.54",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -22,23 +22,23 @@
22
22
  "devDependencies": {
23
23
  "@changesets/changelog-github": "^0.6.0",
24
24
  "@changesets/cli": "^2.30.0",
25
- "@effect/ai-openai": "4.0.0-beta.30",
26
- "@effect/ai-openai-compat": "4.0.0-beta.30",
27
- "@effect/language-service": "^0.79.0",
28
- "@effect/platform-node": "4.0.0-beta.30",
25
+ "@effect/ai-openai": "4.0.0-beta.31",
26
+ "@effect/ai-openai-compat": "4.0.0-beta.31",
27
+ "@effect/language-service": "^0.80.0",
28
+ "@effect/platform-node": "4.0.0-beta.31",
29
29
  "@linear/sdk": "^77.0.0",
30
30
  "@octokit/plugin-rest-endpoint-methods": "^17.0.0",
31
31
  "@octokit/types": "^16.0.0",
32
- "@typescript/native-preview": "7.0.0-dev.20260310.1",
33
- "clanka": "^0.0.26",
32
+ "@typescript/native-preview": "7.0.0-dev.20260312.1",
33
+ "clanka": "^0.1.1",
34
34
  "concurrently": "^9.2.1",
35
- "effect": "4.0.0-beta.30",
35
+ "effect": "4.0.0-beta.31",
36
36
  "husky": "^9.1.7",
37
37
  "lint-staged": "^16.3.3",
38
38
  "octokit": "^5.0.5",
39
- "oxlint": "^1.53.0",
39
+ "oxlint": "^1.55.0",
40
40
  "prettier": "^3.8.1",
41
- "tsdown": "^0.21.1",
41
+ "tsdown": "^0.21.2",
42
42
  "typescript": "^5.9.3",
43
43
  "yaml": "^2.8.2"
44
44
  },
package/src/Clanka.ts CHANGED
@@ -1,13 +1,9 @@
1
1
  import { Agent, OutputFormatter } from "clanka"
2
- import { Duration, Effect, Layer, Stdio, Stream } from "effect"
3
- import {
4
- TaskChooseTools,
5
- TaskTools,
6
- TaskToolsHandlers,
7
- TaskToolsWithChoose,
8
- } from "./TaskTools.ts"
2
+ import { Duration, Effect, Layer, pipe, Stdio, Stream } from "effect"
3
+ import { TaskChooseTools, TaskTools, TaskToolsHandlers } from "./TaskTools.ts"
9
4
  import { ClankaModels, clankaSubagent } from "./ClankaModels.ts"
10
5
  import { withStallTimeout } from "./shared/stream.ts"
6
+ import { NodeHttpClient } from "@effect/platform-node"
11
7
 
12
8
  export const ClankaMuxerLayer = Layer.effectDiscard(
13
9
  Effect.gen(function* () {
@@ -29,20 +25,24 @@ export const runClanka = Effect.fnUntraced(
29
25
  }) {
30
26
  const models = yield* ClankaModels
31
27
  const muxer = yield* OutputFormatter.Muxer
28
+ const agent = yield* Agent.Agent
32
29
 
33
- const agent = yield* Agent.make({
34
- ...options,
35
- tools: (options.withChoose
36
- ? TaskChooseTools
37
- : TaskTools) as unknown as typeof TaskToolsWithChoose,
38
- subagentModel: clankaSubagent(models, options.model),
39
- }).pipe(Effect.provide(models.get(options.model)))
30
+ const output = yield* pipe(
31
+ agent.send({
32
+ prompt: options.prompt,
33
+ system: options.system,
34
+ }),
35
+ Effect.provide([
36
+ models.get(options.model),
37
+ Agent.layerSubagentModel(clankaSubagent(models, options.model)),
38
+ ]),
39
+ )
40
40
 
41
- yield* muxer.add(agent.output)
41
+ yield* muxer.add(output)
42
42
 
43
43
  let stream = options.stallTimeout
44
- ? withStallTimeout(options.stallTimeout)(agent.output)
45
- : agent.output
44
+ ? withStallTimeout(options.stallTimeout)(output)
45
+ : output
46
46
 
47
47
  if (options.steer) {
48
48
  yield* options.steer.pipe(
@@ -63,5 +63,14 @@ export const runClanka = Effect.fnUntraced(
63
63
  )
64
64
  },
65
65
  Effect.scoped,
66
- Effect.provide([Agent.layerServices, TaskToolsHandlers]),
66
+ (effect, options) =>
67
+ Effect.provide(
68
+ effect,
69
+ Agent.layerLocal({
70
+ directory: options.directory,
71
+ tools: options.withChoose ? TaskChooseTools : TaskTools,
72
+ }),
73
+ { local: true },
74
+ ),
75
+ Effect.provide([NodeHttpClient.layerUndici, TaskToolsHandlers]),
67
76
  )
package/src/GitFlow.ts CHANGED
@@ -61,7 +61,7 @@ export const GitFlowPR = Layer.succeed(
61
61
  setupInstructions: ({ githubPrNumber }) =>
62
62
  githubPrNumber
63
63
  ? `The Github PR #${githubPrNumber} has been detected for this task and the branch has been checked out.
64
- - Review feedback in the .lalph/feedback.md file.`
64
+ - **REVIEW FEEDBACK** in the .lalph/feedback.md file.`
65
65
  : `Create a new branch for the task using the format \`{task id}/description\`, using the current HEAD as the base (don't checkout any other branches first).`,
66
66
 
67
67
  commitInstructions: (
package/src/Linear.ts CHANGED
@@ -61,9 +61,9 @@ class Linear extends ServiceMap.Service<Linear>()("lalph/Linear", {
61
61
  readonly schema: S
62
62
  }) => {
63
63
  const decode: (
64
- input: S["Encoded"],
64
+ input: unknown,
65
65
  ) => Effect.Effect<S["Type"], Schema.SchemaError, S["DecodingServices"]> =
66
- Schema.decodeEffect(Schema.toCodecJson(options.schema))
66
+ Schema.decodeUnknownEffect(Schema.toCodecJson(options.schema))
67
67
  return use((c) =>
68
68
  c.client.rawRequest(options.query, options.variables),
69
69
  ).pipe(Effect.flatMap((r) => decode(r.data)))
package/src/Presets.ts CHANGED
@@ -5,6 +5,8 @@ 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"
9
+ import { LanguageModel } from "effect/unstable/ai"
8
10
 
9
11
  export const allCliAgentPresets = new Setting(
10
12
  "cliAgentPresets",
@@ -127,6 +129,14 @@ export const addOrUpdatePreset = Effect.fnUntraced(function* (options?: {
127
129
  sourceMetadata: {},
128
130
  })
129
131
 
132
+ if (cliAgent.id === "clanka") {
133
+ yield* Effect.log("Verifying Clanka model configuration...")
134
+ yield* LanguageModel.generateText({ prompt: "say hello" }).pipe(
135
+ Effect.ignore,
136
+ Effect.provide(ClankaModels.get(preset.extraArgs.join(" "))),
137
+ )
138
+ }
139
+
130
140
  if (id !== CliAgentPreset.defaultId) {
131
141
  const source = yield* IssueSource
132
142
  preset = yield* source.updateCliAgentPreset(preset)
package/src/PromptGen.ts CHANGED
@@ -66,8 +66,9 @@ The following instructions should be done without interaction or asking for perm
66
66
  options.gitFlow.requiresGithubPr
67
67
  ? `
68
68
  - Check if there is an open Github PR for the chosen task. If there is, note the PR number for inclusion in the task.json file.
69
- - Only include "open" PRs that are not yet merged.
70
- - The pull request will contain the task id in the title or description.`
69
+ - If the task mentions a pull request, then use that instead
70
+ - Only include "open" PRs that are not yet merged.
71
+ - The pull request will contain the task id in the title or description.`
71
72
  : ""
72
73
  }
73
74
  - Once you have chosen a task, save its information in a "task.json" file alongside
@@ -100,19 +101,17 @@ Set \`githubPrNumber\` to the PR number if one exists, otherwise use \`null\`.
100
101
  options.gitFlow.requiresGithubPr
101
102
  ? `
102
103
  - Check if there is an open Github PR for the chosen task. If there is, note the PR number for inclusion when calling "chooseTask".
103
- - Only include "open" PRs that are not yet merged.
104
- - The pull request will contain the task id in the title or description.`
104
+ - If the task mentions a pull request, then use that instead
105
+ - Only include "open" PRs that are not yet merged.
106
+ - The pull request will contain the task id in the title or description.`
105
107
  : ""
106
108
  }
107
109
  - Use the "chooseTask" function to select the task you have chosen.
108
- \`\`\`${
109
- options.gitFlow.requiresGithubPr
110
- ? `
111
-
112
- Set \`githubPrNumber\` to the PR number if one exists, otherwise use \`null\`.
113
- `
114
- : "\n\nLeave `githubPrNumber` as null."
115
- }
110
+ ${
111
+ options.gitFlow.requiresGithubPr
112
+ ? `\n - Set \`githubPrNumber\` to the PR number if one exists, otherwise use \`null\`.`
113
+ : "\n Leave `githubPrNumber` as null."
114
+ }
116
115
  `
117
116
 
118
117
  const keyInformation = (options: {
package/src/cli.ts CHANGED
@@ -17,6 +17,7 @@ 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"
20
21
 
21
22
  commandRoot.pipe(
22
23
  Command.withSubcommands([
@@ -39,7 +40,7 @@ commandRoot.pipe(
39
40
  Command.run({
40
41
  version: PackageJson.version,
41
42
  }),
42
- Effect.provide(PlatformServices),
43
+ Effect.provide([ClankaModels.layer, PlatformServices]),
43
44
  Effect.provideService(Layer.CurrentMemoMap, lalphMemoMap),
44
45
  NodeRuntime.runMain,
45
46
  )
@@ -10,7 +10,6 @@ import { commandRoot } from "../root.ts"
10
10
  import { selectCliAgentPreset } from "../../Presets.ts"
11
11
  import { CurrentIssueSource } from "../../CurrentIssueSource.ts"
12
12
  import type { CliAgentPreset } from "../../domain/CliAgentPreset.ts"
13
- import { ClankaModels } from "../../ClankaModels.ts"
14
13
  import { ClankaMuxerLayer } from "../../Clanka.ts"
15
14
 
16
15
  const specificationPath = Argument.path("spec", {
@@ -72,7 +71,6 @@ const generateTasks = Effect.fnUntraced(
72
71
  })
73
72
  },
74
73
  Effect.provide([
75
- ClankaModels.layer,
76
74
  ClankaMuxerLayer,
77
75
  Settings.layer,
78
76
  PromptGen.layer,
@@ -24,7 +24,6 @@ import { selectCliAgentPreset } from "../Presets.ts"
24
24
  import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process"
25
25
  import { parseBranch } from "../shared/git.ts"
26
26
  import type { CliAgentPreset } from "../domain/CliAgentPreset.ts"
27
- import { ClankaModels } from "../ClankaModels.ts"
28
27
  import { ClankaMuxerLayer } from "../Clanka.ts"
29
28
 
30
29
  const dangerous = Flag.boolean("dangerous").pipe(
@@ -99,7 +98,6 @@ export const commandPlan = Command.make("plan", {
99
98
  Effect.provide([
100
99
  Settings.layer,
101
100
  CurrentIssueSource.layer,
102
- ClankaModels.layer,
103
101
  ClankaMuxerLayer,
104
102
  ]),
105
103
  )
@@ -491,7 +491,6 @@ export const commandRoot = Command.make("lalph", {
491
491
  },
492
492
  Effect.scoped,
493
493
  Effect.provide([
494
- ClankaModels.layer,
495
494
  ClankaMuxerLayer,
496
495
  PromptGen.layer,
497
496
  GithubCli.layer,