lalph 0.3.69 → 0.3.71

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.69",
4
+ "version": "0.3.71",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -19,20 +19,32 @@
19
19
  "type": "git",
20
20
  "url": "https://github.com/tim-smart/lalph.git"
21
21
  },
22
+ "dependencies": {
23
+ "better-sqlite3": "^12.8.0"
24
+ },
25
+ "optionalDependencies": {
26
+ "@sqliteai/sqlite-vector-darwin-arm64": "0.9.93",
27
+ "@sqliteai/sqlite-vector-darwin-x86_64": "0.9.93",
28
+ "@sqliteai/sqlite-vector-linux-arm64": "0.9.93",
29
+ "@sqliteai/sqlite-vector-linux-arm64-musl": "0.9.93",
30
+ "@sqliteai/sqlite-vector-linux-x86_64": "0.9.93",
31
+ "@sqliteai/sqlite-vector-linux-x86_64-musl": "0.9.93",
32
+ "@sqliteai/sqlite-vector-win32-x86_64": "0.9.93"
33
+ },
22
34
  "devDependencies": {
23
35
  "@changesets/changelog-github": "^0.6.0",
24
36
  "@changesets/cli": "^2.30.0",
25
- "@effect/ai-openai": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/ai-openai@fe407c2",
26
- "@effect/ai-openai-compat": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/ai-openai-compat@fe407c2",
37
+ "@effect/ai-openai": "4.0.0-beta.34",
38
+ "@effect/ai-openai-compat": "4.0.0-beta.34",
27
39
  "@effect/language-service": "^0.80.0",
28
- "@effect/platform-node": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/platform-node@fe407c2",
29
- "@linear/sdk": "^77.0.0",
40
+ "@effect/platform-node": "4.0.0-beta.34",
41
+ "@linear/sdk": "^78.0.0",
30
42
  "@octokit/plugin-rest-endpoint-methods": "^17.0.0",
31
43
  "@octokit/types": "^16.0.0",
32
- "@typescript/native-preview": "7.0.0-dev.20260316.1",
33
- "clanka": "^0.1.18",
44
+ "@typescript/native-preview": "7.0.0-dev.20260317.1",
45
+ "clanka": "^0.1.22",
34
46
  "concurrently": "^9.2.1",
35
- "effect": "https://pkg.pr.new/Effect-TS/effect-smol/effect@fe407c2",
47
+ "effect": "4.0.0-beta.34",
36
48
  "husky": "^9.1.7",
37
49
  "lint-staged": "^16.4.0",
38
50
  "octokit": "^5.0.5",
package/src/Clanka.ts CHANGED
@@ -1,10 +1,20 @@
1
- import { Agent, OutputFormatter } from "clanka"
2
- import { Duration, Effect, Layer, Stdio, Stream } from "effect"
1
+ import { Agent, OutputFormatter, SemanticSearch } from "clanka"
2
+ import {
3
+ Config,
4
+ Duration,
5
+ Effect,
6
+ Layer,
7
+ Option,
8
+ Path,
9
+ Stdio,
10
+ Stream,
11
+ } from "effect"
3
12
  import { TaskChooseTools, TaskTools, TaskToolsHandlers } from "./TaskTools.ts"
4
13
  import { ClankaModels } from "./ClankaModels.ts"
5
14
  import { withStallTimeout } from "./shared/stream.ts"
6
15
  import { NodeHttpClient } from "@effect/platform-node"
7
16
  import type { Prompt } from "effect/unstable/ai"
17
+ import { OpenAiClient, OpenAiEmbeddingModel } from "@effect/ai-openai"
8
18
 
9
19
  export const ClankaMuxerLayer = Layer.effectDiscard(
10
20
  Effect.gen(function* () {
@@ -14,6 +24,44 @@ export const ClankaMuxerLayer = Layer.effectDiscard(
14
24
  }),
15
25
  ).pipe(Layer.provideMerge(OutputFormatter.layerMuxer(OutputFormatter.pretty)))
16
26
 
27
+ const Search = (directory: string) =>
28
+ Layer.unwrap(
29
+ Effect.gen(function* () {
30
+ const pathService = yield* Path.Path
31
+ const apiKey = yield* Config.redacted("LALPH_OPENAI_API_KEY").pipe(
32
+ Config.option,
33
+ )
34
+ if (Option.isNone(apiKey)) {
35
+ return Layer.empty
36
+ }
37
+ return SemanticSearch.layer({
38
+ directory,
39
+ database: pathService.join(
40
+ directory,
41
+ ".lalph",
42
+ "shared",
43
+ "search.sqlite",
44
+ ),
45
+ }).pipe(
46
+ Layer.orDie,
47
+ Layer.provide(
48
+ OpenAiEmbeddingModel.model("text-embedding-3-small", {
49
+ dimensions: 1536,
50
+ }),
51
+ ),
52
+ Layer.provide(
53
+ OpenAiClient.layer({
54
+ apiKey: apiKey.value,
55
+ }),
56
+ ),
57
+ Layer.tapCause((cause) =>
58
+ Effect.logWarning(`Failed to create SemanticSearch layer`, cause),
59
+ ),
60
+ Layer.catchCause(() => Layer.empty),
61
+ )
62
+ }).pipe(Effect.orDie),
63
+ )
64
+
17
65
  export const runClanka = Effect.fnUntraced(
18
66
  function* (options: {
19
67
  readonly directory: string
@@ -64,7 +112,10 @@ export const runClanka = Effect.fnUntraced(
64
112
  Agent.layerLocal({
65
113
  directory: options.directory,
66
114
  tools: options.withChoose ? TaskChooseTools : TaskTools,
67
- }).pipe(Layer.merge(ClankaModels.get(options.model))),
115
+ }).pipe(
116
+ Layer.provide(Search(options.directory)),
117
+ Layer.merge(ClankaModels.get(options.model)),
118
+ ),
68
119
  ),
69
120
  Effect.provide([NodeHttpClient.layerUndici, TaskToolsHandlers]),
70
121
  )
package/src/Worktree.ts CHANGED
@@ -129,6 +129,13 @@ const setupWorktree = Effect.fnUntraced(function* (options: {
129
129
  }
130
130
  }
131
131
 
132
+ const shared = pathService.resolve(".lalph", "shared")
133
+ yield* fs.makeDirectory(shared, { recursive: true })
134
+ yield* fs.symlink(
135
+ shared,
136
+ pathService.join(options.directory, ".lalph", "shared"),
137
+ )
138
+
132
139
  const cwdSetupPath = pathService.resolve("scripts", "worktree-setup.sh")
133
140
  const worktreeSetupPath = pathService.join(
134
141
  options.directory,
@@ -268,6 +268,12 @@ const run = Effect.fnUntraced(
268
268
  // -----------------------
269
269
 
270
270
  if (options.review) {
271
+ yield* source.updateIssue({
272
+ projectId,
273
+ issueId: taskId,
274
+ state: "in-progress",
275
+ })
276
+
271
277
  registry.update(currentWorker.state, (s) =>
272
278
  s.transitionTo(WorkerStatus.Reviewing({ issueId: taskId })),
273
279
  )
@@ -278,6 +284,12 @@ const run = Effect.fnUntraced(
278
284
  preset: taskPreset,
279
285
  instructions,
280
286
  }).pipe(catchStallInReview, Effect.withSpan("Main.agentReviewer"))
287
+
288
+ yield* source.updateIssue({
289
+ projectId,
290
+ issueId: taskId,
291
+ state: "in-review",
292
+ })
281
293
  }
282
294
  }).pipe(
283
295
  Effect.timeout(options.runTimeout),