clanka 0.2.50 → 0.2.52

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 (80) hide show
  1. package/dist/Agent.d.ts +20 -20
  2. package/dist/Agent.d.ts.map +1 -1
  3. package/dist/Agent.js +9 -9
  4. package/dist/Agent.js.map +1 -1
  5. package/dist/AgentExecutor.d.ts +45 -99
  6. package/dist/AgentExecutor.d.ts.map +1 -1
  7. package/dist/AgentExecutor.js +8 -8
  8. package/dist/AgentExecutor.js.map +1 -1
  9. package/dist/AgentTools.d.ts +6 -6
  10. package/dist/AgentTools.d.ts.map +1 -1
  11. package/dist/AgentTools.js +5 -5
  12. package/dist/AgentTools.js.map +1 -1
  13. package/dist/ApplyPatch.test.js +3 -3
  14. package/dist/ApplyPatch.test.js.map +1 -1
  15. package/dist/ChunkRepo.d.ts +16 -16
  16. package/dist/ChunkRepo.d.ts.map +1 -1
  17. package/dist/ChunkRepo.js +7 -6
  18. package/dist/ChunkRepo.js.map +1 -1
  19. package/dist/CodeChunker.d.ts +2 -2
  20. package/dist/CodeChunker.d.ts.map +1 -1
  21. package/dist/CodeChunker.js +2 -2
  22. package/dist/CodeChunker.js.map +1 -1
  23. package/dist/CodexAuth.d.ts +4 -4
  24. package/dist/CodexAuth.d.ts.map +1 -1
  25. package/dist/CodexAuth.js +2 -2
  26. package/dist/CodexAuth.js.map +1 -1
  27. package/dist/CopilotAuth.d.ts +4 -4
  28. package/dist/CopilotAuth.d.ts.map +1 -1
  29. package/dist/CopilotAuth.js +2 -2
  30. package/dist/CopilotAuth.js.map +1 -1
  31. package/dist/DeviceCodeHandler.d.ts +2 -2
  32. package/dist/DeviceCodeHandler.d.ts.map +1 -1
  33. package/dist/DeviceCodeHandler.js +2 -2
  34. package/dist/DeviceCodeHandler.js.map +1 -1
  35. package/dist/ExaSearch.d.ts +3 -3
  36. package/dist/ExaSearch.d.ts.map +1 -1
  37. package/dist/ExaSearch.js +2 -2
  38. package/dist/ExaSearch.js.map +1 -1
  39. package/dist/McpClient.d.ts +3 -3
  40. package/dist/McpClient.d.ts.map +1 -1
  41. package/dist/McpClient.js +2 -2
  42. package/dist/McpClient.js.map +1 -1
  43. package/dist/OutputFormatter.d.ts +2 -2
  44. package/dist/OutputFormatter.d.ts.map +1 -1
  45. package/dist/OutputFormatter.js +2 -2
  46. package/dist/OutputFormatter.js.map +1 -1
  47. package/dist/SemanticSearch/Service.d.ts +2 -2
  48. package/dist/SemanticSearch/Service.d.ts.map +1 -1
  49. package/dist/SemanticSearch/Service.js +2 -2
  50. package/dist/SemanticSearch/Service.js.map +1 -1
  51. package/dist/SemanticSearch.js +3 -3
  52. package/dist/SemanticSearch.js.map +1 -1
  53. package/dist/ToolkitRenderer.d.ts +2 -2
  54. package/dist/ToolkitRenderer.d.ts.map +1 -1
  55. package/dist/ToolkitRenderer.js +2 -2
  56. package/dist/ToolkitRenderer.js.map +1 -1
  57. package/dist/WebToMarkdown.d.ts +2 -2
  58. package/dist/WebToMarkdown.d.ts.map +1 -1
  59. package/dist/WebToMarkdown.js +2 -2
  60. package/dist/WebToMarkdown.js.map +1 -1
  61. package/package.json +11 -9
  62. package/src/Agent.ts +9 -9
  63. package/src/AgentExecutor.ts +14 -14
  64. package/src/AgentTools.ts +7 -7
  65. package/src/ApplyPatch.test.ts +3 -3
  66. package/src/ChunkRepo.ts +8 -6
  67. package/src/CodeChunker.ts +2 -2
  68. package/src/CodexAuth.ts +2 -2
  69. package/src/CopilotAuth.ts +2 -2
  70. package/src/DeviceCodeHandler.ts +2 -2
  71. package/src/ExaSearch.ts +2 -2
  72. package/src/McpClient.ts +2 -2
  73. package/src/OutputFormatter.ts +2 -2
  74. package/src/SemanticSearch/Service.ts +2 -2
  75. package/src/SemanticSearch.ts +3 -3
  76. package/src/ToolkitRenderer.ts +2 -2
  77. package/src/WebToMarkdown.ts +2 -2
  78. package/src/fixtures/fiber.txt +9 -9
  79. package/src/fixtures/patch18-broken.txt +5 -5
  80. package/src/fixtures/patch18-fixed.txt +5 -5
@@ -3,14 +3,14 @@
3
3
  */
4
4
  import * as Effect from "effect/Effect";
5
5
  import * as Layer from "effect/Layer";
6
- import * as ServiceMap from "effect/ServiceMap";
6
+ import * as Context from "effect/Context";
7
7
  import * as HttpClient from "effect/unstable/http/HttpClient";
8
8
  import TurndownService from "turndown";
9
9
  /**
10
10
  * @since 1.0.0
11
11
  * @category Services
12
12
  */
13
- export class WebToMarkdown extends ServiceMap.Service()("clanka/WebToMarkdown") {
13
+ export class WebToMarkdown extends Context.Service()("clanka/WebToMarkdown") {
14
14
  }
15
15
  /**
16
16
  * @since 1.0.0
@@ -1 +1 @@
1
- {"version":3,"file":"WebToMarkdown.js","sourceRoot":"","sources":["../src/WebToMarkdown.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,UAAU,MAAM,iCAAiC,CAAA;AAE7D,OAAO,eAAe,MAAM,UAAU,CAAA;AAEtC;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,UAAU,CAAC,OAAO,EAQlD,CAAC,sBAAsB,CAAC;CAAG;AAE9B;;;GAGG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAC/B,aAAa,EACb,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,IAAI,CAChD,UAAU,CAAC,eAAe,EAAE,EAC5B,UAAU,CAAC,cAAc,EACzB,UAAU,CAAC,cAAc,CAAC;QACxB,KAAK,EAAE,CAAC;KACT,CAAC,CACH,CAAA;IAED,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC;QACvB,MAAM;QACN,QAAQ;QACR,QAAQ;Q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,WAAW,GAAG,MAAM,CAAC,EAAE,CAAC,2BAA2B,CAAC,CAAC,CAAC,IAAY,EAAE,EAAE,CAC1E,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAC3C,CAAA;IAED,OAAO,aAAa,CAAC,EAAE,CAAC;QACtB,WAAW;QACX,UAAU,EAAE,MAAM,CAAC,EAAE,CAAC,0BAA0B,CAAC,CAAC,QAAQ,CAAC,EAAE,GAAG;YAC9D,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YACvC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAA;YACjC,OAAO,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;QAChC,CAAC,CAAC;KACH,CAAC,CAAA;AACJ,CAAC,CAAC,CACH,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "clanka",
3
3
  "type": "module",
4
- "version": "0.2.50",
4
+ "version": "0.2.52",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -25,9 +25,6 @@
25
25
  "url": "https://github.com/Effectful-Tech/clanka.git"
26
26
  },
27
27
  "dependencies": {
28
- "@effect/ai-openai": "4.0.0-beta.43",
29
- "@effect/platform-node": "4.0.0-beta.43",
30
- "@effect/sql-sqlite-node": "4.0.0-beta.43",
31
28
  "@modelcontextprotocol/sdk": "^1.27.1",
32
29
  "@vscode/ripgrep": "^1.17.1",
33
30
  "chalk": "^5.6.2",
@@ -47,20 +44,25 @@
47
44
  "@sqliteai/sqlite-vector-win32-x86_64": "0.9.93"
48
45
  },
49
46
  "peerDependencies": {
50
- "@effect/ai-openai": "4.0.0-beta.43",
51
- "@effect/ai-openai-compat": "4.0.0-beta.43",
52
- "effect": "4.0.0-beta.43"
47
+ "@effect/platform-node": "*",
48
+ "@effect/sql-sqlite-node": "*",
49
+ "@effect/ai-openai": "*",
50
+ "@effect/ai-openai-compat": "*",
51
+ "effect": "*"
53
52
  },
54
53
  "devDependencies": {
55
54
  "@changesets/changelog-github": "^0.6.0",
56
55
  "@changesets/cli": "^2.29.8",
57
- "@effect/ai-openai-compat": "4.0.0-beta.43",
56
+ "@effect/platform-node": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/platform-node@acc7fff",
57
+ "@effect/sql-sqlite-node": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/sql-sqlite-node@acc7fff",
58
+ "@effect/ai-openai": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/ai-openai@acc7fff",
59
+ "@effect/ai-openai-compat": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/ai-openai-compat@acc7fff",
58
60
  "@effect/language-service": "^0.83.1",
59
61
  "@effect/vitest": "4.0.0-beta.43",
60
62
  "@types/node": "^25.5.0",
61
63
  "@types/turndown": "^5.0.6",
62
64
  "@typescript/native-preview": "7.0.0-dev.20260324.1",
63
- "effect": "4.0.0-beta.43",
65
+ "effect": "https://pkg.pr.new/Effect-TS/effect-smol/effect@acc7fff",
64
66
  "husky": "^9.1.7",
65
67
  "lint-staged": "^16.4.0",
66
68
  "oxlint": "^1.57.0",
package/src/Agent.ts CHANGED
@@ -20,7 +20,7 @@ import * as Stream from "effect/Stream"
20
20
  import type * as Scope from "effect/Scope"
21
21
  import * as LanguageModel from "effect/unstable/ai/LanguageModel"
22
22
  import * as AiError from "effect/unstable/ai/AiError"
23
- import * as ServiceMap from "effect/ServiceMap"
23
+ import * as Context from "effect/Context"
24
24
  import * as Option from "effect/Option"
25
25
  import { identity, pipe } from "effect/Function"
26
26
  import * as MutableRef from "effect/MutableRef"
@@ -102,7 +102,7 @@ export interface Agent {
102
102
  * @since 1.0.0
103
103
  * @category Service
104
104
  */
105
- export const Agent = ServiceMap.Service<Agent>("clanka/Agent")
105
+ export const Agent = Context.Service<Agent>("clanka/Agent")
106
106
 
107
107
  /**
108
108
  * @since 1.0.0
@@ -607,7 +607,7 @@ ${capabilities.toolsDts}
607
607
  declare const fetch: typeof globalThis.fetch
608
608
  \`\`\``
609
609
 
610
- class ScriptExecutor extends ServiceMap.Service<
610
+ class ScriptExecutor extends Context.Service<
611
611
  ScriptExecutor,
612
612
  (script: string) => Effect.Effect<string>
613
613
  >()("clanka/Agent/ScriptExecutor") {}
@@ -664,7 +664,7 @@ export const layerLocal = <Toolkit extends Toolkit.Any = never>(options: {
664
664
  * @since 1.0.0
665
665
  * @category Subagent model
666
666
  */
667
- export class SubagentModel extends ServiceMap.Service<
667
+ export class SubagentModel extends Context.Service<
668
668
  SubagentModel,
669
669
  Layer.Layer<
670
670
  LanguageModel.LanguageModel | Model.ProviderName | Model.ModelName
@@ -685,9 +685,9 @@ export const layerSubagentModel = <E, R>(
685
685
  Layer.effect(
686
686
  SubagentModel,
687
687
  Effect.gen(function* () {
688
- const services = yield* Effect.services<R>()
688
+ const services = yield* Effect.context<R>()
689
689
  return Layer.orDie(layer).pipe(
690
- Layer.provide(Layer.succeedServices(services)),
690
+ Layer.provide(Layer.succeedContext(services)),
691
691
  )
692
692
  }),
693
693
  )
@@ -696,7 +696,7 @@ export const layerSubagentModel = <E, R>(
696
696
  * @since 1.0.0
697
697
  * @category Conversation mode
698
698
  */
699
- export class ConversationMode extends ServiceMap.Reference<boolean>(
699
+ export class ConversationMode extends Context.Reference<boolean>(
700
700
  "clanka/Agent/ConversationMode",
701
701
  {
702
702
  defaultValue: () => false,
@@ -712,7 +712,7 @@ export class ConversationMode extends ServiceMap.Reference<boolean>(
712
712
  * @since 1.0.0
713
713
  * @category Turn timeout
714
714
  */
715
- export class TurnTimeout extends ServiceMap.Reference<Duration.Duration>(
715
+ export class TurnTimeout extends Context.Reference<Duration.Duration>(
716
716
  "clanka/Agent/TurnTimeout",
717
717
  {
718
718
  defaultValue: () => Duration.minutes(5),
@@ -726,7 +726,7 @@ export class TurnTimeout extends ServiceMap.Reference<Duration.Duration>(
726
726
  * @since 1.0.0
727
727
  * @category System prompts
728
728
  */
729
- export class AgentModelConfig extends ServiceMap.Reference<{
729
+ export class AgentModelConfig extends Context.Reference<{
730
730
  readonly systemPromptTransform?:
731
731
  | (<A, E, R>(
732
732
  system: string,
@@ -15,7 +15,7 @@ import {
15
15
  import { ToolkitRenderer } from "./ToolkitRenderer.ts"
16
16
  import type * as ChildProcessSpawner from "effect/unstable/process/ChildProcessSpawner"
17
17
  import type * as HttpClient from "effect/unstable/http/HttpClient"
18
- import * as ServiceMap from "effect/ServiceMap"
18
+ import * as Context from "effect/Context"
19
19
  import * as Effect from "effect/Effect"
20
20
  import * as Option from "effect/Option"
21
21
  import * as Stream from "effect/Stream"
@@ -45,7 +45,7 @@ import * as References from "effect/References"
45
45
  * @since 1.0.0
46
46
  * @category Services
47
47
  */
48
- export class AgentExecutor extends ServiceMap.Service<
48
+ export class AgentExecutor extends Context.Service<
49
49
  AgentExecutor,
50
50
  {
51
51
  readonly capabilities: Effect.Effect<Capabilities>
@@ -106,13 +106,13 @@ export const makeLocal = Effect.fnUntraced(function* <
106
106
  const tools = yield* AllTools
107
107
  const toolsDts = renderer.render(AllTools)
108
108
 
109
- const services = yield* Effect.services()
109
+ const services = yield* Effect.context()
110
110
 
111
111
  const toolEntries = Object.entries(tools.tools).map(([name, tool]) => {
112
112
  const handler = services.mapUnsafe.get(tool.id) as Tool.Handler<string>
113
113
  return {
114
114
  name,
115
- services: ServiceMap.merge(services, handler.services),
115
+ services: Context.merge(services, handler.context),
116
116
  handler: handler.handler,
117
117
  }
118
118
  })
@@ -131,16 +131,16 @@ export const makeLocal = Effect.fnUntraced(function* <
131
131
  const handlerScope = Scope.makeUnsafe("parallel")
132
132
  const trackFiber = Fiber.runIn(handlerScope)
133
133
 
134
- const taskServices = ServiceMap.mutate(
135
- ServiceMap.empty(),
134
+ const taskServices = Context.mutate(
135
+ Context.empty(),
136
136
  flow(
137
- ServiceMap.add(TaskCompleter, opts.onTaskComplete),
138
- ServiceMap.add(CurrentDirectory, options.directory),
139
- ServiceMap.add(SubagentExecutor, opts.onSubagent),
140
- ServiceMap.add(Console.Console, console),
141
- ServiceMap.add(References.CurrentLogAnnotations, {}),
137
+ Context.add(TaskCompleter, opts.onTaskComplete),
138
+ Context.add(CurrentDirectory, options.directory),
139
+ Context.add(SubagentExecutor, opts.onSubagent),
140
+ Context.add(Console.Console, console),
141
+ Context.add(References.CurrentLogAnnotations, {}),
142
142
  Option.isSome(search)
143
- ? ServiceMap.add(SemanticSearch, search.value)
143
+ ? Context.add(SemanticSearch, search.value)
144
144
  : identity,
145
145
  ),
146
146
  )
@@ -160,7 +160,7 @@ export const makeLocal = Effect.fnUntraced(function* <
160
160
  for (let i = 0; i < toolEntries.length; i++) {
161
161
  const { name, handler, services } = toolEntries[i]!
162
162
  const runFork = Effect.runForkWith(
163
- ServiceMap.merge(services, taskServices),
163
+ Context.merge(services, taskServices),
164
164
  )
165
165
 
166
166
  // oxlint-disable-next-line typescript/no-explicit-any
@@ -223,7 +223,7 @@ export const makeLocal = Effect.fnUntraced(function* <
223
223
  return pipe(
224
224
  handler.handler(opts.params, {}),
225
225
  Effect.flatMap(encodeSuccess),
226
- Effect.provideServices(handler.services),
226
+ Effect.provideContext(handler.context),
227
227
  Effect.orDie,
228
228
  ) as Effect.Effect<Schema.Json>
229
229
  },
package/src/AgentTools.ts CHANGED
@@ -6,7 +6,7 @@ import { parsePatch, patchChunks } from "./ApplyPatch.ts"
6
6
  import * as ExaSearch from "./ExaSearch.ts"
7
7
  import * as WebToMarkdown from "./WebToMarkdown.ts"
8
8
  import type * as HttpClient from "effect/unstable/http/HttpClient"
9
- import * as ServiceMap from "effect/ServiceMap"
9
+ import * as Context from "effect/Context"
10
10
  import * as Effect from "effect/Effect"
11
11
  import * as Toolkit from "effect/unstable/ai/Toolkit"
12
12
  import * as Tool from "effect/unstable/ai/Tool"
@@ -26,7 +26,7 @@ import * as SemanticSearch from "./SemanticSearch/Service.ts"
26
26
  * @since 1.0.0
27
27
  * @category Context
28
28
  */
29
- export class CurrentDirectory extends ServiceMap.Service<
29
+ export class CurrentDirectory extends Context.Service<
30
30
  CurrentDirectory,
31
31
  string
32
32
  >()("clanka/AgentTools/CurrentDirectory") {}
@@ -35,7 +35,7 @@ export class CurrentDirectory extends ServiceMap.Service<
35
35
  * @since 1.0.0
36
36
  * @category Context
37
37
  */
38
- export class TaskCompleter extends ServiceMap.Service<
38
+ export class TaskCompleter extends Context.Service<
39
39
  TaskCompleter,
40
40
  (output: string) => Effect.Effect<void>
41
41
  >()("clanka/AgentTools/TaskCompleter") {}
@@ -44,7 +44,7 @@ export class TaskCompleter extends ServiceMap.Service<
44
44
  * @since 1.0.0
45
45
  * @category Context
46
46
  */
47
- export class SubagentExecutor extends ServiceMap.Service<
47
+ export class SubagentExecutor extends Context.Service<
48
48
  SubagentExecutor,
49
49
  (prompt: string) => Effect.Effect<string>
50
50
  >()("clanka/AgentTools/SubagentExecutor") {}
@@ -54,9 +54,9 @@ export class SubagentExecutor extends ServiceMap.Service<
54
54
  * @category Context
55
55
  */
56
56
  export const makeContextNoop = (cwd?: string) =>
57
- SubagentExecutor.serviceMap(() => Effect.die("Not implemented")).pipe(
58
- ServiceMap.add(CurrentDirectory, cwd ?? "/"),
59
- ServiceMap.add(TaskCompleter, () => Effect.void),
57
+ SubagentExecutor.context(() => Effect.die("Not implemented")).pipe(
58
+ Context.add(CurrentDirectory, cwd ?? "/"),
59
+ Context.add(TaskCompleter, () => Effect.void),
60
60
  )
61
61
 
62
62
  class TodoItem extends Schema.Opaque<TodoItem>()(
@@ -35,7 +35,7 @@ describe("patchContent", () => {
35
35
  "*** Begin Patch",
36
36
  "*** Update File: src/ExaSearch.ts",
37
37
  "@@",
38
- " export class ExaSearch extends ServiceMap.Service<",
38
+ " export class ExaSearch extends Context.Service<",
39
39
  " ExaSearch,",
40
40
  " {",
41
41
  "- search(query: string): Effect.Effect<Array<SearchResponse<{}>>, ExaError>",
@@ -51,7 +51,7 @@ describe("patchContent", () => {
51
51
  chunks: [
52
52
  {
53
53
  old: [
54
- "export class ExaSearch extends ServiceMap.Service<",
54
+ "export class ExaSearch extends Context.Service<",
55
55
  " ExaSearch,",
56
56
  " {",
57
57
  " search(query: string): Effect.Effect<Array<SearchResponse<{}>>, ExaError>",
@@ -59,7 +59,7 @@ describe("patchContent", () => {
59
59
  '>()("clanka/ExaSearch") {}',
60
60
  ],
61
61
  next: [
62
- "export class ExaSearch extends ServiceMap.Service<",
62
+ "export class ExaSearch extends Context.Service<",
63
63
  " ExaSearch,",
64
64
  " {",
65
65
  " search(query: string): Effect.Effect<SearchResponse<{}>, ExaError>",
package/src/ChunkRepo.ts CHANGED
@@ -2,7 +2,7 @@ import * as Effect from "effect/Effect"
2
2
  import * as Layer from "effect/Layer"
3
3
  import * as Schema from "effect/Schema"
4
4
  import * as SchemaTransformation from "effect/SchemaTransformation"
5
- import * as ServiceMap from "effect/ServiceMap"
5
+ import * as Context from "effect/Context"
6
6
  import * as Model from "effect/unstable/schema/Model"
7
7
  import * as SqlClient from "effect/unstable/sql/SqlClient"
8
8
  import * as SqlError from "effect/unstable/sql/SqlError"
@@ -87,7 +87,7 @@ export class Chunk extends Model.Class<Chunk>("Chunk")({
87
87
  * @since 1.0.0
88
88
  * @category Services
89
89
  */
90
- export class ChunkRepo extends ServiceMap.Service<
90
+ export class ChunkRepo extends Context.Service<
91
91
  ChunkRepo,
92
92
  {
93
93
  insert(
@@ -139,10 +139,9 @@ export const layer = Layer.effect(
139
139
  Effect.gen(function* () {
140
140
  const sql = yield* SqlClient.SqlClient
141
141
  const dimensions = yield* EmbeddingModel.Dimensions
142
- const loaders = yield* SqlModel.makeDataLoaders(Chunk, {
142
+ const loaders = yield* SqlModel.makeResolvers(Chunk, {
143
143
  tableName: "chunks",
144
144
  idColumn: "id",
145
- window: 10,
146
145
  spanPrefix: "ChunkRepo",
147
146
  })
148
147
 
@@ -185,10 +184,13 @@ export const layer = Layer.effect(
185
184
  sql`select id, hash from chunks where ${sql.in("hash", hashes)}`,
186
185
  }).pipe(RequestResolver.setDelay(5))
187
186
 
187
+ const insertResolver = loaders.insert.pipe(RequestResolver.setDelay(5))
188
+ const findByIdResolver = loaders.findById.pipe(RequestResolver.setDelay(5))
189
+
188
190
  return ChunkRepo.of({
189
191
  insert: (insert) => {
190
192
  needsQuantization = true
191
- return loaders.insert(insert).pipe(
193
+ return SqlResolver.request(insert, insertResolver).pipe(
192
194
  Effect.catchTags({
193
195
  SqlError: (reason) => Effect.fail(new ChunkRepoError({ reason })),
194
196
  SchemaError: Effect.die,
@@ -196,7 +198,7 @@ export const layer = Layer.effect(
196
198
  )
197
199
  },
198
200
  findById: (id) =>
199
- loaders.findById(id).pipe(
201
+ SqlResolver.request(id, findByIdResolver).pipe(
200
202
  Effect.catchTags({
201
203
  SchemaError: Effect.die,
202
204
  }),
@@ -7,7 +7,7 @@ import * as FileSystem from "effect/FileSystem"
7
7
  import { pipe } from "effect/Function"
8
8
  import * as Layer from "effect/Layer"
9
9
  import * as Path from "effect/Path"
10
- import * as ServiceMap from "effect/ServiceMap"
10
+ import * as Context from "effect/Context"
11
11
  import * as Stream from "effect/Stream"
12
12
  import * as ChildProcess from "effect/unstable/process/ChildProcess"
13
13
  import * as ChildProcessSpawner from "effect/unstable/process/ChildProcessSpawner"
@@ -47,7 +47,7 @@ export type ChunkType =
47
47
  * @since 1.0.0
48
48
  * @category Services
49
49
  */
50
- export class CodeChunker extends ServiceMap.Service<
50
+ export class CodeChunker extends Context.Service<
51
51
  CodeChunker,
52
52
  {
53
53
  listFiles(options: {
package/src/CodexAuth.ts CHANGED
@@ -10,7 +10,7 @@ import * as Result from "effect/Result"
10
10
  import * as Schedule from "effect/Schedule"
11
11
  import * as Schema from "effect/Schema"
12
12
  import * as Semaphore from "effect/Semaphore"
13
- import * as ServiceMap from "effect/ServiceMap"
13
+ import * as Context from "effect/Context"
14
14
  import * as HttpClient from "effect/unstable/http/HttpClient"
15
15
  import * as HttpClientRequest from "effect/unstable/http/HttpClientRequest"
16
16
  import * as HttpClientResponse from "effect/unstable/http/HttpClientResponse"
@@ -284,7 +284,7 @@ export const toCodexAuthKeyValueStore = (store: KeyValueStore.KeyValueStore) =>
284
284
  export const toTokenStore = (store: KeyValueStore.KeyValueStore) =>
285
285
  KeyValueStore.toSchemaStore(toCodexAuthKeyValueStore(store), TokenData)
286
286
 
287
- export class CodexAuth extends ServiceMap.Service<
287
+ export class CodexAuth extends Context.Service<
288
288
  CodexAuth,
289
289
  {
290
290
  readonly verifyUrl: string
@@ -8,7 +8,7 @@ import * as Option from "effect/Option"
8
8
  import * as Schedule from "effect/Schedule"
9
9
  import * as Schema from "effect/Schema"
10
10
  import * as Semaphore from "effect/Semaphore"
11
- import * as ServiceMap from "effect/ServiceMap"
11
+ import * as Context from "effect/Context"
12
12
  import * as HttpClient from "effect/unstable/http/HttpClient"
13
13
  import * as HttpClientRequest from "effect/unstable/http/HttpClientRequest"
14
14
  import * as HttpClientResponse from "effect/unstable/http/HttpClientResponse"
@@ -213,7 +213,7 @@ export const toTokenStore = (store: KeyValueStore.KeyValueStore) =>
213
213
  TokenData,
214
214
  )
215
215
 
216
- export class GithubCopilotAuth extends ServiceMap.Service<
216
+ export class GithubCopilotAuth extends Context.Service<
217
217
  GithubCopilotAuth,
218
218
  {
219
219
  readonly verifyUrl: string
@@ -1,9 +1,9 @@
1
1
  import * as Console from "effect/Console"
2
2
  import type * as Effect from "effect/Effect"
3
3
  import * as Layer from "effect/Layer"
4
- import * as ServiceMap from "effect/ServiceMap"
4
+ import * as Context from "effect/Context"
5
5
 
6
- export class DeviceCodeHandler extends ServiceMap.Service<
6
+ export class DeviceCodeHandler extends Context.Service<
7
7
  DeviceCodeHandler,
8
8
  {
9
9
  onCode(options: {
package/src/ExaSearch.ts CHANGED
@@ -5,14 +5,14 @@ import * as Effect from "effect/Effect"
5
5
  import { pipe } from "effect/Function"
6
6
  import * as Layer from "effect/Layer"
7
7
  import * as Schema from "effect/Schema"
8
- import * as ServiceMap from "effect/ServiceMap"
8
+ import * as Context from "effect/Context"
9
9
  import * as McpClient from "./McpClient.ts"
10
10
 
11
11
  /**
12
12
  * @since 1.0.0
13
13
  * @category Services
14
14
  */
15
- export class ExaSearch extends ServiceMap.Service<
15
+ export class ExaSearch extends Context.Service<
16
16
  ExaSearch,
17
17
  {
18
18
  search(
package/src/McpClient.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  import * as Effect from "effect/Effect"
5
5
  import * as Layer from "effect/Layer"
6
6
  import * as Schema from "effect/Schema"
7
- import * as ServiceMap from "effect/ServiceMap"
7
+ import * as Context from "effect/Context"
8
8
  import { Client } from "@modelcontextprotocol/sdk/client"
9
9
  import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
10
10
  import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js"
@@ -13,7 +13,7 @@ import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js"
13
13
  * @since 1.0.0
14
14
  * @category Services
15
15
  */
16
- export class McpClient extends ServiceMap.Service<
16
+ export class McpClient extends Context.Service<
17
17
  McpClient,
18
18
  {
19
19
  connect(options: {
@@ -5,7 +5,7 @@ import * as Effect from "effect/Effect"
5
5
  import * as Layer from "effect/Layer"
6
6
  import * as PubSub from "effect/PubSub"
7
7
  import * as Semaphore from "effect/Semaphore"
8
- import * as ServiceMap from "effect/ServiceMap"
8
+ import * as Context from "effect/Context"
9
9
  import * as Stream from "effect/Stream"
10
10
  import type { AgentFinished, Output } from "./Agent.ts"
11
11
  import chalk from "chalk"
@@ -138,7 +138,7 @@ const infoIcon = "\u{f05a}"
138
138
  * @since 1.0.0
139
139
  * @category Muxer
140
140
  */
141
- export class Muxer extends ServiceMap.Service<
141
+ export class Muxer extends Context.Service<
142
142
  Muxer,
143
143
  {
144
144
  add<E, R>(
@@ -3,13 +3,13 @@
3
3
  */
4
4
  import * as Effect from "effect/Effect"
5
5
  import * as Option from "effect/Option"
6
- import * as ServiceMap from "effect/ServiceMap"
6
+ import * as Context from "effect/Context"
7
7
 
8
8
  /**
9
9
  * @since 1.0.0
10
10
  * @category Services
11
11
  */
12
- export class SemanticSearch extends ServiceMap.Service<
12
+ export class SemanticSearch extends Context.Service<
13
13
  SemanticSearch,
14
14
  {
15
15
  search(options: {
@@ -157,7 +157,7 @@ export const layer = (options: {
157
157
  )
158
158
  const vector = new Float32Array(result.vector)
159
159
  yield* repo.insert(
160
- ChunkRepo.Chunk.insert.makeUnsafe({
160
+ ChunkRepo.Chunk.insert.make({
161
161
  path: options.chunk.path,
162
162
  hash,
163
163
  content: input,
@@ -177,7 +177,7 @@ export const layer = (options: {
177
177
  )
178
178
 
179
179
  const index = Effect.gen(function* () {
180
- const syncId = ChunkRepo.SyncId.makeUnsafe(crypto.randomUUID())
180
+ const syncId = ChunkRepo.SyncId.make(crypto.randomUUID())
181
181
  yield* Effect.logInfo("Starting SemanticSearch index")
182
182
 
183
183
  yield* pipe(
@@ -246,7 +246,7 @@ export const layer = (options: {
246
246
  return
247
247
  }
248
248
 
249
- const syncId = ChunkRepo.SyncId.makeUnsafe(crypto.randomUUID())
249
+ const syncId = ChunkRepo.SyncId.make(crypto.randomUUID())
250
250
 
251
251
  yield* pipe(
252
252
  Stream.fromArray(chunks),
@@ -4,7 +4,7 @@
4
4
  import * as Array from "effect/Array"
5
5
  import * as Layer from "effect/Layer"
6
6
  import * as SchemaAST from "effect/SchemaAST"
7
- import * as ServiceMap from "effect/ServiceMap"
7
+ import * as Context from "effect/Context"
8
8
  import type * as Tool from "effect/unstable/ai/Tool"
9
9
  import type * as Toolkit from "effect/unstable/ai/Toolkit"
10
10
  import * as TypeBuilder from "./TypeBuilder.ts"
@@ -14,7 +14,7 @@ import * as Function from "effect/Function"
14
14
  * @since 1.0.0
15
15
  * @category Services
16
16
  */
17
- export class ToolkitRenderer extends ServiceMap.Service<
17
+ export class ToolkitRenderer extends Context.Service<
18
18
  ToolkitRenderer,
19
19
  {
20
20
  render<Tools extends Record<string, Tool.Any>>(
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import * as Effect from "effect/Effect"
5
5
  import * as Layer from "effect/Layer"
6
- import * as ServiceMap from "effect/ServiceMap"
6
+ import * as Context from "effect/Context"
7
7
  import * as HttpClient from "effect/unstable/http/HttpClient"
8
8
  import type * as HttpClientError from "effect/unstable/http/HttpClientError"
9
9
  import TurndownService from "turndown"
@@ -12,7 +12,7 @@ import TurndownService from "turndown"
12
12
  * @since 1.0.0
13
13
  * @category Services
14
14
  */
15
- export class WebToMarkdown extends ServiceMap.Service<
15
+ export class WebToMarkdown extends Context.Service<
16
16
  WebToMarkdown,
17
17
  {
18
18
  convertHtml(html: string): Effect.Effect<string>
@@ -19,7 +19,7 @@ export const getCurrentFiber = (): Fiber.Fiber<any, any> | undefined =>
19
19
  /** @internal */
20
20
  export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
21
21
  constructor(
22
- services: ServiceMap.ServiceMap<never>,
22
+ services: Context.Context<never>,
23
23
  interruptible: boolean = true,
24
24
  ) {
25
25
  this[FiberTypeId] = fiberVariance as any
@@ -51,7 +51,7 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
51
51
  _yielded: Exit.Exit<any, any> | (() => void) | undefined
52
52
 
53
53
  // set in setServices
54
- services!: ServiceMap.ServiceMap<never>
54
+ services!: Context.Context<never>
55
55
  currentScheduler!: Scheduler.Scheduler
56
56
  currentTracerContext: Tracer.Tracer["context"]
57
57
  currentSpan: Tracer.AnySpan | undefined
@@ -67,8 +67,8 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
67
67
  return (this._dispatcher ??= this.currentScheduler.makeDispatcher())
68
68
  }
69
69
 
70
- getRef<X>(ref: ServiceMap.Reference<X>): X {
71
- return ServiceMap.getReferenceUnsafe(this.services, ref)
70
+ getRef<X>(ref: Context.Reference<X>): X {
71
+ return Context.getReferenceUnsafe(this.services, ref)
72
72
  }
73
73
  addObserver(cb: (exit: Exit.Exit<A, E>) => void): () => void {
74
74
  if (this._exit) {
@@ -85,7 +85,7 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
85
85
  }
86
86
  interruptUnsafe(
87
87
  fiberId?: number | undefined,
88
- annotations?: ServiceMap.ServiceMap<never> | undefined,
88
+ annotations?: Context.Context<never> | undefined,
89
89
  ): void {
90
90
  if (this._exit) {
91
91
  return
@@ -94,7 +94,7 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
94
94
  if (this.currentStackFrame) {
95
95
  cause = causeAnnotate(
96
96
  cause,
97
- ServiceMap.make(CauseStackTrace, this.currentStackFrame),
97
+ Context.make(CauseStackTrace, this.currentStackFrame),
98
98
  )
99
99
  }
100
100
  if (annotations) {
@@ -208,7 +208,7 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
208
208
  pipe() {
209
209
  return pipeArguments(this, arguments)
210
210
  }
211
- setServices(services: ServiceMap.ServiceMap<never>): void {
211
+ setServices(services: Context.Context<never>): void {
212
212
  this.services = services
213
213
  const scheduler = this.getRef(Scheduler.Scheduler)
214
214
  if (scheduler !== this.currentScheduler) {
@@ -244,7 +244,7 @@ const fiberStackAnnotations = (fiber: Fiber.Fiber<any, any>) => {
244
244
  if (!fiber.currentStackFrame) return undefined
245
245
  const annotations = new Map<string, unknown>()
246
246
  annotations.set(CauseStackTrace.key, fiber.currentStackFrame)
247
- return ServiceMap.makeUnsafe(annotations)
247
+ return Context.makeUnsafe(annotations)
248
248
  }
249
249
 
250
250
  const fiberInterruptChildren = (fiber: FiberImpl) => {
@@ -252,4 +252,4 @@ const fiberInterruptChildren = (fiber: FiberImpl) => {
252
252
  return undefined
253
253
  }
254
254
  return fiberInterruptAll(fiber._children)
255
- }
255
+ }