lalph 0.3.73 → 0.3.75

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
@@ -181199,7 +181199,7 @@ var ji = Bt, Ii = Object.assign(Qe, { sync: Bt }), zi = Ut, Bi = Object.assign(e
181199
181199
  });
181200
181200
  Ze.glob = Ze;
181201
181201
  //#endregion
181202
- //#region node_modules/.pnpm/clanka@0.2.0_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_eb2d2d405b4b82a47d844a8a6523d5fc/node_modules/clanka/dist/ApplyPatch.js
181202
+ //#region node_modules/.pnpm/clanka@0.2.3_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_ea22d31788a744583664e944d95c19f7/node_modules/clanka/dist/ApplyPatch.js
181203
181203
  /**
181204
181204
  * @since 1.0.0
181205
181205
  */
@@ -196072,7 +196072,7 @@ var StreamableHTTPClientTransport = class {
196072
196072
  }
196073
196073
  };
196074
196074
  //#endregion
196075
- //#region node_modules/.pnpm/clanka@0.2.0_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_eb2d2d405b4b82a47d844a8a6523d5fc/node_modules/clanka/dist/McpClient.js
196075
+ //#region node_modules/.pnpm/clanka@0.2.3_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_ea22d31788a744583664e944d95c19f7/node_modules/clanka/dist/McpClient.js
196076
196076
  /**
196077
196077
  * @since 1.0.0
196078
196078
  */
@@ -196117,7 +196117,7 @@ const layer$13 = effect$1(McpClient, gen(function* () {
196117
196117
  });
196118
196118
  }));
196119
196119
  //#endregion
196120
- //#region node_modules/.pnpm/clanka@0.2.0_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_eb2d2d405b4b82a47d844a8a6523d5fc/node_modules/clanka/dist/ExaSearch.js
196120
+ //#region node_modules/.pnpm/clanka@0.2.3_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_ea22d31788a744583664e944d95c19f7/node_modules/clanka/dist/ExaSearch.js
196121
196121
  /**
196122
196122
  * @since 1.0.0
196123
196123
  */
@@ -211067,7 +211067,7 @@ var require_lib = /* @__PURE__ */ __commonJSMin$1(((exports) => {
211067
211067
  exports.impl = impl;
211068
211068
  }));
211069
211069
  //#endregion
211070
- //#region node_modules/.pnpm/clanka@0.2.0_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_eb2d2d405b4b82a47d844a8a6523d5fc/node_modules/clanka/dist/WebToMarkdown.js
211070
+ //#region node_modules/.pnpm/clanka@0.2.3_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_ea22d31788a744583664e944d95c19f7/node_modules/clanka/dist/WebToMarkdown.js
211071
211071
  /**
211072
211072
  * @since 1.0.0
211073
211073
  */
@@ -214684,7 +214684,7 @@ const mapProviderResults = (inputLength, results) => {
214684
214684
  return succeed$3(embeddings);
214685
214685
  };
214686
214686
  //#endregion
214687
- //#region node_modules/.pnpm/clanka@0.2.0_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_eb2d2d405b4b82a47d844a8a6523d5fc/node_modules/clanka/dist/ChunkRepo.js
214687
+ //#region node_modules/.pnpm/clanka@0.2.3_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_ea22d31788a744583664e944d95c19f7/node_modules/clanka/dist/ChunkRepo.js
214688
214688
  /**
214689
214689
  * @since 1.0.0
214690
214690
  * @category Models
@@ -214812,7 +214812,7 @@ const layer$10 = effect$1(ChunkRepo, gen(function* () {
214812
214812
  });
214813
214813
  }));
214814
214814
  //#endregion
214815
- //#region node_modules/.pnpm/clanka@0.2.0_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_eb2d2d405b4b82a47d844a8a6523d5fc/node_modules/clanka/dist/CodeChunker.js
214815
+ //#region node_modules/.pnpm/clanka@0.2.3_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_ea22d31788a744583664e944d95c19f7/node_modules/clanka/dist/CodeChunker.js
214816
214816
  /**
214817
214817
  * @since 1.0.0
214818
214818
  */
@@ -215190,7 +215190,7 @@ const run$1 = /* @__PURE__ */ make$25({});
215190
215190
  */
215191
215191
  const layer$7 = (options) => effectDiscard(run$1(options));
215192
215192
  //#endregion
215193
- //#region node_modules/.pnpm/clanka@0.2.0_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_eb2d2d405b4b82a47d844a8a6523d5fc/node_modules/clanka/dist/internal/sqlite-vector.js
215193
+ //#region node_modules/.pnpm/clanka@0.2.3_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_ea22d31788a744583664e944d95c19f7/node_modules/clanka/dist/internal/sqlite-vector.js
215194
215194
  /**
215195
215195
  * Binary extension for each platform
215196
215196
  */
@@ -215307,7 +215307,7 @@ function getExtensionPath() {
215307
215307
  throw new ExtensionNotFoundError(`SQLite Vector extension not found for platform: ${getCurrentPlatform()}\n\nThe platform-specific package "${getPlatformPackageName()}" is not installed.\nThis usually happens when:\n 1. Your platform is not supported\n 2. npm failed to install optional dependencies\n 3. You're installing with --no-optional flag\n\nTry running: npm install --force`);
215308
215308
  }
215309
215309
  //#endregion
215310
- //#region node_modules/.pnpm/clanka@0.2.0_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_eb2d2d405b4b82a47d844a8a6523d5fc/node_modules/clanka/dist/Sqlite.js
215310
+ //#region node_modules/.pnpm/clanka@0.2.3_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_ea22d31788a744583664e944d95c19f7/node_modules/clanka/dist/Sqlite.js
215311
215311
  /**
215312
215312
  * @since 1.0.0
215313
215313
  */
@@ -215337,7 +215337,7 @@ const SqliteLayer = (database) => layer$7({ loader: fromRecord({ "0001_create_ch
215337
215337
  yield* fs.makeDirectory(directory, { recursive: true });
215338
215338
  }))));
215339
215339
  //#endregion
215340
- //#region node_modules/.pnpm/clanka@0.2.0_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_eb2d2d405b4b82a47d844a8a6523d5fc/node_modules/clanka/dist/SemanticSearch.js
215340
+ //#region node_modules/.pnpm/clanka@0.2.3_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_ea22d31788a744583664e944d95c19f7/node_modules/clanka/dist/SemanticSearch.js
215341
215341
  /**
215342
215342
  * @since 1.0.0
215343
215343
  */
@@ -215470,7 +215470,7 @@ const maybeRemoveFile = (path) => serviceOption(SemanticSearch).pipe(flatMap$4(m
215470
215470
  onSome: (service) => service.removeFile(path)
215471
215471
  })));
215472
215472
  //#endregion
215473
- //#region node_modules/.pnpm/clanka@0.2.0_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_eb2d2d405b4b82a47d844a8a6523d5fc/node_modules/clanka/dist/AgentTools.js
215473
+ //#region node_modules/.pnpm/clanka@0.2.3_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_ea22d31788a744583664e944d95c19f7/node_modules/clanka/dist/AgentTools.js
215474
215474
  /**
215475
215475
  * @since 1.0.0
215476
215476
  */
@@ -215522,6 +215522,11 @@ const AgentTools = make$14(make$13("readFile", {
215522
215522
  parameters: String$1.annotate({ identifier: "pattern" }),
215523
215523
  success: Array$1(String$1),
215524
215524
  dependencies: [CurrentDirectory]
215525
+ }), make$13("gh", {
215526
+ description: "Use the GitHub CLI to run a command - use this instead of the bash tool.",
215527
+ parameters: Array$1(String$1).annotate({ identifier: "args" }),
215528
+ success: String$1,
215529
+ dependencies: [CurrentDirectory]
215525
215530
  }), make$13("bash", {
215526
215531
  description: "Run a bash command and return the output",
215527
215532
  parameters: Struct$2({
@@ -215562,11 +215567,6 @@ const AgentTools = make$14(make$13("readFile", {
215562
215567
  parameters: String$1.annotate({ identifier: "directory" }),
215563
215568
  success: Array$1(String$1),
215564
215569
  dependencies: [CurrentDirectory]
215565
- }), make$13("gh", {
215566
- description: "Use the GitHub CLI to run a command and return the output",
215567
- parameters: Array$1(String$1).annotate({ identifier: "args" }),
215568
- success: String$1,
215569
- dependencies: [CurrentDirectory]
215570
215570
  }), make$13("webSearch", {
215571
215571
  description: "Search the web for recent information.",
215572
215572
  parameters: ExaSearchOptions,
@@ -215590,7 +215590,7 @@ const AgentTools = make$14(make$13("readFile", {
215590
215590
  const AgentToolsWithSearch = merge$1(make$14(make$13("search", {
215591
215591
  description: "Semantic code search",
215592
215592
  parameters: Struct$2({
215593
- query: String$1,
215593
+ query: String$1.annotate({ documentation: "Describe what you are looking for" }),
215594
215594
  limit: optional$3(Finite).annotate({ documentation: "Number of results (defaults to 5, max 10)" })
215595
215595
  }),
215596
215596
  success: String$1,
@@ -215833,7 +215833,7 @@ const AgentToolHandlers = AgentToolHandlersNoDeps.pipe(provide$3([layer$12, laye
215833
215833
  AgentToolHandlersNoDeps.pipe(provide$3([mock(ExaSearch)({}), mock(WebToMarkdown)({})]));
215834
215834
  var ApplyPatchError = class extends TaggedClass$2("ApplyPatchError") {};
215835
215835
  //#endregion
215836
- //#region node_modules/.pnpm/clanka@0.2.0_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_eb2d2d405b4b82a47d844a8a6523d5fc/node_modules/clanka/dist/TypeBuilder.js
215836
+ //#region node_modules/.pnpm/clanka@0.2.3_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_ea22d31788a744583664e944d95c19f7/node_modules/clanka/dist/TypeBuilder.js
215837
215837
  const resolveDocumentation = resolveAt("documentation");
215838
215838
  const identifierPattern = /^[$A-Z_a-z][$0-9A-Z_a-z]*$/u;
215839
215839
  const Precedence = {
@@ -216106,7 +216106,7 @@ const render = (schema, options) => {
216106
216106
  return printNode({ text: documentation === void 0 ? rendered.text : `${renderJsDoc(documentation, 0, printerOptions)}${printerOptions.newLine}${rendered.text}` }, printerOptions);
216107
216107
  };
216108
216108
  //#endregion
216109
- //#region node_modules/.pnpm/clanka@0.2.0_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_eb2d2d405b4b82a47d844a8a6523d5fc/node_modules/clanka/dist/ToolkitRenderer.js
216109
+ //#region node_modules/.pnpm/clanka@0.2.3_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_ea22d31788a744583664e944d95c19f7/node_modules/clanka/dist/ToolkitRenderer.js
216110
216110
  /**
216111
216111
  * @since 1.0.0
216112
216112
  */
@@ -216128,7 +216128,7 @@ declare function ${name}(${params}): Promise<${render(tool.successSchema)}>`);
216128
216128
  }) });
216129
216129
  };
216130
216130
  //#endregion
216131
- //#region node_modules/.pnpm/clanka@0.2.0_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_eb2d2d405b4b82a47d844a8a6523d5fc/node_modules/clanka/dist/AgentExecutor.js
216131
+ //#region node_modules/.pnpm/clanka@0.2.3_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_ea22d31788a744583664e944d95c19f7/node_modules/clanka/dist/AgentExecutor.js
216132
216132
  /**
216133
216133
  * @since 1.0.0
216134
216134
  */
@@ -216173,7 +216173,7 @@ const makeLocal = fnUntraced(function* (options) {
216173
216173
  const console = yield* makeConsole(output);
216174
216174
  const handlerScope = makeUnsafe$13("parallel");
216175
216175
  const trackFiber = runIn(handlerScope);
216176
- const taskServices = mutate$4(empty$16(), flow(add$3(TaskCompleter, opts.onTaskComplete), add$3(CurrentDirectory, options.directory), add$3(SubagentExecutor, opts.onSubagent), add$3(Console$1, console), isSome(search) ? add$3(SemanticSearch, search.value) : identity));
216176
+ const taskServices = mutate$4(empty$16(), flow(add$3(TaskCompleter, opts.onTaskComplete), add$3(CurrentDirectory, options.directory), add$3(SubagentExecutor, opts.onSubagent), add$3(Console$1, console), add$3(CurrentLogAnnotations, {}), isSome(search) ? add$3(SemanticSearch, search.value) : identity));
216177
216177
  yield* gen(function* () {
216178
216178
  const console = yield* Console$1;
216179
216179
  let running = 0;
@@ -216297,7 +216297,7 @@ var QueueWriteStream = class extends Writable {
216297
216297
  }
216298
216298
  };
216299
216299
  //#endregion
216300
- //#region node_modules/.pnpm/clanka@0.2.0_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_eb2d2d405b4b82a47d844a8a6523d5fc/node_modules/clanka/dist/ScriptExtraction.js
216300
+ //#region node_modules/.pnpm/clanka@0.2.3_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_ea22d31788a744583664e944d95c19f7/node_modules/clanka/dist/ScriptExtraction.js
216301
216301
  const stripWrappingCodeFence = (script) => {
216302
216302
  const lines = script.split(/\r?\n/);
216303
216303
  if (lines.length < 2) return script;
@@ -217830,7 +217830,7 @@ const applySpanTransformer = (transformer, response, options) => {
217830
217830
  });
217831
217831
  };
217832
217832
  //#endregion
217833
- //#region node_modules/.pnpm/clanka@0.2.0_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_eb2d2d405b4b82a47d844a8a6523d5fc/node_modules/clanka/dist/Agent.js
217833
+ //#region node_modules/.pnpm/clanka@0.2.3_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_ea22d31788a744583664e944d95c19f7/node_modules/clanka/dist/Agent.js
217834
217834
  /**
217835
217835
  * @since 1.0.0
217836
217836
  */
@@ -217874,6 +217874,7 @@ ${content}
217874
217874
  const modelConfig = yield* AgentModelConfig;
217875
217875
  let finalSummary = none$4();
217876
217876
  const output = yield* make$73();
217877
+ let inputTokens = 0;
217877
217878
  let outputTokens = 0;
217878
217879
  const prompt = opts.disableHistory ? make$75(empty) : history;
217879
217880
  update(prompt, concat(opts.prompt));
@@ -218035,13 +218036,17 @@ ${content}
218035
218036
  case "finish":
218036
218037
  const usage = part.usage;
218037
218038
  if (usage.outputTokens.total !== void 0) outputTokens += usage.outputTokens.total;
218038
- if (usage.inputTokens.total !== void 0) maybeSend({
218039
- agentId,
218040
- part: new Usage({
218041
- inputTokens: usage.inputTokens.total,
218042
- outputTokens
218043
- })
218044
- });
218039
+ if (usage.inputTokens.total !== void 0) {
218040
+ inputTokens += usage.inputTokens.total;
218041
+ maybeSend({
218042
+ agentId,
218043
+ part: new Usage({
218044
+ contextTokens: usage.inputTokens.total,
218045
+ inputTokens,
218046
+ outputTokens
218047
+ })
218048
+ });
218049
+ }
218045
218050
  break;
218046
218051
  }
218047
218052
  return void_$2;
@@ -218113,17 +218118,18 @@ const generateSystemTools = (capabilities) => `**YOU ONLY HAVE ACCESS TO ONE TOO
218113
218118
 
218114
218119
  - Use \`console.log\` to print any output you need.
218115
218120
  - Top level await is supported.${capabilities.supportsSearch ? `
218116
- - AVOID USING the "rg" function and instead use "search", unless you are targeting specific files or need regex.` : ""}
218117
- - AVOID passing scripts into the "bash" function, and instead write javascript.
218121
+ - AVOID USING the "rg" function and instead use "search", unless you are targeting specific files or patterns.` : ""}
218118
218122
  - Do as much work as possible in a single script, using \`Promise.all\` to run multiple functions in parallel.
218119
- - Variables **are not shared** between executions, so you must include all necessary code in each script you execute.
218120
- - Use the "delegate" function to assign complex jobs to another software engineer.
218123
+ - AVOID passing scripts into the "bash" function, and instead write javascript.
218124
+ - **Variables are not shared** between executions, so you must include all necessary code in each script you execute.
218125
+ - Use the "delegate" function to assign jobs to another software engineer.
218126
+ - Make sure to escape strings correctly when calling functions.
218121
218127
 
218122
- **When you have fully completed your task**, call the "taskComplete" function with the final output.
218128
+ When you have fully completed your task, call the "taskComplete" function with the final output.
218123
218129
  DO NOT output the final result without wrapping it with "taskComplete".
218124
218130
  Make sure every detail of the task is done before calling "taskComplete".
218125
218131
 
218126
- Apart from standard javascript apis, **you only have** the following functions available to you:
218132
+ Apart from standard javascript apis, **you only have the following** functions available to you:
218127
218133
 
218128
218134
  \`\`\`ts
218129
218135
  ${capabilities.toolsDts}
@@ -218244,6 +218250,7 @@ var ScriptEnd = class extends TaggedClass()("ScriptEnd", {}) {};
218244
218250
  * @category Output
218245
218251
  */
218246
218252
  var Usage = class extends TaggedClass()("Usage", {
218253
+ contextTokens: Number$1,
218247
218254
  inputTokens: Number$1,
218248
218255
  outputTokens: Number$1
218249
218256
  }) {};
@@ -218494,7 +218501,7 @@ var Retry = class Retry extends TaggedClass$2("Retry") {
218494
218501
  }
218495
218502
  };
218496
218503
  //#endregion
218497
- //#region node_modules/.pnpm/@effect+ai-openai@4.0.0-beta.34_effect@4.0.0-beta.34/node_modules/@effect/ai-openai/dist/Generated.js
218504
+ //#region node_modules/.pnpm/@effect+ai-openai@https+++pkg.pr.new+Effect-TS+effect-smol+@effect+ai-openai@720d238_ef_5260e37a8a271da0467d5e5ba8e26136/node_modules/@effect/ai-openai/dist/Generated.js
218498
218505
  /**
218499
218506
  * @since 1.0.0
218500
218507
  */ const AdminApiKey = /* @__PURE__ */ Struct$2({
@@ -226562,7 +226569,7 @@ const OpenAiClientError = (tag, cause, response) => new OpenAiClientErrorImpl({
226562
226569
  request: response.request
226563
226570
  });
226564
226571
  //#endregion
226565
- //#region node_modules/.pnpm/@effect+ai-openai@4.0.0-beta.34_effect@4.0.0-beta.34/node_modules/@effect/ai-openai/dist/internal/errors.js
226572
+ //#region node_modules/.pnpm/@effect+ai-openai@https+++pkg.pr.new+Effect-TS+effect-smol+@effect+ai-openai@720d238_ef_5260e37a8a271da0467d5e5ba8e26136/node_modules/@effect/ai-openai/dist/internal/errors.js
226566
226573
  /** @internal */
226567
226574
  const OpenAiErrorBody$1 = /* @__PURE__ */ Struct$2({ error: /* @__PURE__ */ Struct$2({
226568
226575
  message: String$1,
@@ -226775,7 +226782,7 @@ const mapStatusCodeToReason$1 = ({ status, headers, message, metadata, http }) =
226775
226782
  }
226776
226783
  };
226777
226784
  //#endregion
226778
- //#region node_modules/.pnpm/@effect+ai-openai@4.0.0-beta.34_effect@4.0.0-beta.34/node_modules/@effect/ai-openai/dist/OpenAiConfig.js
226785
+ //#region node_modules/.pnpm/@effect+ai-openai@https+++pkg.pr.new+Effect-TS+effect-smol+@effect+ai-openai@720d238_ef_5260e37a8a271da0467d5e5ba8e26136/node_modules/@effect/ai-openai/dist/OpenAiConfig.js
226779
226786
  /**
226780
226787
  * @since 1.0.0
226781
226788
  */
@@ -226790,7 +226797,7 @@ var OpenAiConfig$1 = class OpenAiConfig$1 extends Service$1()("@effect/ai-openai
226790
226797
  static getOrUndefined = /* @__PURE__ */ map$9(/* @__PURE__ */ services(), (context) => context.mapUnsafe.get(OpenAiConfig$1.key));
226791
226798
  };
226792
226799
  //#endregion
226793
- //#region node_modules/.pnpm/@effect+ai-openai@4.0.0-beta.34_effect@4.0.0-beta.34/node_modules/@effect/ai-openai/dist/OpenAiClient.js
226800
+ //#region node_modules/.pnpm/@effect+ai-openai@https+++pkg.pr.new+Effect-TS+effect-smol+@effect+ai-openai@720d238_ef_5260e37a8a271da0467d5e5ba8e26136/node_modules/@effect/ai-openai/dist/OpenAiClient.js
226794
226801
  /**
226795
226802
  * OpenAI Client module for interacting with OpenAI's API.
226796
226803
  *
@@ -226913,17 +226920,28 @@ const makeSocket = /* @__PURE__ */ gen(function* () {
226913
226920
  try {
226914
226921
  const event = decodeEvent(text);
226915
226922
  if (event.type === "error") tracker.clearUnsafe();
226916
- if (event.type === "error" && "status" in event) return fail$4(currentQueue, make$15({
226917
- module: "OpenAiClient",
226918
- method: "createResponseStream",
226919
- reason: reasonFromHttpStatus({
226920
- status: event.status,
226921
- metadata: {
226922
- ...event.error,
226923
- description: event.error.message
226924
- }
226925
- })
226926
- }));
226923
+ if (event.type === "error" && "status" in event) {
226924
+ const json = JSON.stringify(event.error);
226925
+ return fail$4(currentQueue, make$15({
226926
+ module: "OpenAiClient",
226927
+ method: "createResponseStream",
226928
+ reason: reasonFromHttpStatus({
226929
+ description: json,
226930
+ status: event.status,
226931
+ metadata: event.error,
226932
+ http: {
226933
+ body: json,
226934
+ request: {
226935
+ method: "POST",
226936
+ url: request.url,
226937
+ urlParams: [],
226938
+ hash: void 0,
226939
+ headers: request.headers
226940
+ }
226941
+ }
226942
+ })
226943
+ }));
226944
+ }
226927
226945
  offerUnsafe(currentQueue, event);
226928
226946
  } catch {}
226929
226947
  }).pipe(catchCause$1((cause) => {
@@ -226996,7 +227014,7 @@ const decodeEvent = /* @__PURE__ */ decodeUnknownSync(/* @__PURE__ */ fromJsonSt
226996
227014
  */
226997
227015
  const layerWebSocketMode = /* @__PURE__ */ effectServices(makeSocket);
226998
227016
  //#endregion
226999
- //#region node_modules/.pnpm/@effect+ai-openai@4.0.0-beta.34_effect@4.0.0-beta.34/node_modules/@effect/ai-openai/dist/OpenAiEmbeddingModel.js
227017
+ //#region node_modules/.pnpm/@effect+ai-openai@https+++pkg.pr.new+Effect-TS+effect-smol+@effect+ai-openai@720d238_ef_5260e37a8a271da0467d5e5ba8e26136/node_modules/@effect/ai-openai/dist/OpenAiEmbeddingModel.js
227000
227018
  /**
227001
227019
  * OpenAI Embedding Model implementation.
227002
227020
  *
@@ -227381,7 +227399,7 @@ const formats = [
227381
227399
  "uuid"
227382
227400
  ];
227383
227401
  //#endregion
227384
- //#region node_modules/.pnpm/@effect+ai-openai@4.0.0-beta.34_effect@4.0.0-beta.34/node_modules/@effect/ai-openai/dist/internal/utilities.js
227402
+ //#region node_modules/.pnpm/@effect+ai-openai@https+++pkg.pr.new+Effect-TS+effect-smol+@effect+ai-openai@720d238_ef_5260e37a8a271da0467d5e5ba8e26136/node_modules/@effect/ai-openai/dist/internal/utilities.js
227385
227403
  const finishReasonMap$1 = {
227386
227404
  content_filter: "content-filter",
227387
227405
  function_call: "tool-calls",
@@ -227399,7 +227417,7 @@ const resolveFinishReason$1 = (finishReason, hasToolCalls) => {
227399
227417
  return reason;
227400
227418
  };
227401
227419
  //#endregion
227402
- //#region node_modules/.pnpm/@effect+ai-openai@4.0.0-beta.34_effect@4.0.0-beta.34/node_modules/@effect/ai-openai/dist/OpenAiTelemetry.js
227420
+ //#region node_modules/.pnpm/@effect+ai-openai@https+++pkg.pr.new+Effect-TS+effect-smol+@effect+ai-openai@720d238_ef_5260e37a8a271da0467d5e5ba8e26136/node_modules/@effect/ai-openai/dist/OpenAiTelemetry.js
227403
227421
  /**
227404
227422
  * OpenAI telemetry attributes for OpenTelemetry integration.
227405
227423
  *
@@ -227428,7 +227446,7 @@ const addGenAIAnnotations$1 = /* @__PURE__ */ dual(2, (span, options) => {
227428
227446
  }
227429
227447
  });
227430
227448
  //#endregion
227431
- //#region node_modules/.pnpm/@effect+ai-openai@4.0.0-beta.34_effect@4.0.0-beta.34/node_modules/@effect/ai-openai/dist/OpenAiLanguageModel.js
227449
+ //#region node_modules/.pnpm/@effect+ai-openai@https+++pkg.pr.new+Effect-TS+effect-smol+@effect+ai-openai@720d238_ef_5260e37a8a271da0467d5e5ba8e26136/node_modules/@effect/ai-openai/dist/OpenAiLanguageModel.js
227432
227450
  /**
227433
227451
  * OpenAI Language Model implementation.
227434
227452
  *
@@ -229143,7 +229161,7 @@ const transformToolCallParams = /* @__PURE__ */ fnUntraced(function* (tools, too
229143
229161
  })));
229144
229162
  });
229145
229163
  //#endregion
229146
- //#region node_modules/.pnpm/clanka@0.2.0_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_eb2d2d405b4b82a47d844a8a6523d5fc/node_modules/clanka/dist/CodexAuth.js
229164
+ //#region node_modules/.pnpm/clanka@0.2.3_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_ea22d31788a744583664e944d95c19f7/node_modules/clanka/dist/CodexAuth.js
229147
229165
  /**
229148
229166
  * @since 1.0.0
229149
229167
  */
@@ -229363,7 +229381,7 @@ var CodexAuth = class CodexAuth extends Service$1()("clanka/CodexAuth") {
229363
229381
  static layerClient = this.layerClientNoDeps.pipe(provide$3(CodexAuth.layer));
229364
229382
  };
229365
229383
  //#endregion
229366
- //#region node_modules/.pnpm/clanka@0.2.0_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_eb2d2d405b4b82a47d844a8a6523d5fc/node_modules/clanka/dist/Codex.js
229384
+ //#region node_modules/.pnpm/clanka@0.2.3_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_ea22d31788a744583664e944d95c19f7/node_modules/clanka/dist/Codex.js
229367
229385
  /**
229368
229386
  * @since 1.0.0
229369
229387
  */
@@ -230675,7 +230693,7 @@ const getUsageDetailNumber = (details, field) => {
230675
230693
  return typeof value === "number" ? value : void 0;
230676
230694
  };
230677
230695
  //#endregion
230678
- //#region node_modules/.pnpm/clanka@0.2.0_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_eb2d2d405b4b82a47d844a8a6523d5fc/node_modules/clanka/dist/CopilotAuth.js
230696
+ //#region node_modules/.pnpm/clanka@0.2.3_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_ea22d31788a744583664e944d95c19f7/node_modules/clanka/dist/CopilotAuth.js
230679
230697
  /**
230680
230698
  * @since 1.0.0
230681
230699
  */
@@ -230866,7 +230884,7 @@ var GithubCopilotAuth = class GithubCopilotAuth extends Service$1()("clanka/Gith
230866
230884
  static layerClient = this.layerClientNoDeps.pipe(provide$3(GithubCopilotAuth.layer));
230867
230885
  };
230868
230886
  //#endregion
230869
- //#region node_modules/.pnpm/clanka@0.2.0_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_eb2d2d405b4b82a47d844a8a6523d5fc/node_modules/clanka/dist/Copilot.js
230887
+ //#region node_modules/.pnpm/clanka@0.2.3_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_ea22d31788a744583664e944d95c19f7/node_modules/clanka/dist/Copilot.js
230870
230888
  /**
230871
230889
  * @since 1.0.0
230872
230890
  */
@@ -231286,7 +231304,7 @@ Object.defineProperties(createChalk.prototype, styles);
231286
231304
  const chalk = createChalk();
231287
231305
  createChalk({ level: stderrColor ? stderrColor.level : 0 });
231288
231306
  //#endregion
231289
- //#region node_modules/.pnpm/clanka@0.2.0_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_eb2d2d405b4b82a47d844a8a6523d5fc/node_modules/clanka/dist/OutputFormatter.js
231307
+ //#region node_modules/.pnpm/clanka@0.2.3_@effect+ai-openai-compat@4.0.0-beta.34_effect@4.0.0-beta.34__@effect+ai-op_ea22d31788a744583664e944d95c19f7/node_modules/clanka/dist/OutputFormatter.js
231290
231308
  /**
231291
231309
  * @since 1.0.0
231292
231310
  */
@@ -231320,7 +231338,7 @@ ${output.summary}\n\n`;
231320
231338
  return `${prefix}${chalkScriptHeading(`${scriptIcon} Script output`)}\n\n${chalk.dim(truncated)}\n\n`;
231321
231339
  }
231322
231340
  case "ErrorRetry": return `${prefix}${chalk.red(`Error: ${output.error.reason._tag}. Retrying...`)}\n\n${chalk.dim(pretty$1(fail$7(output.error)))}\n\n`;
231323
- case "Usage": return `${prefix}${chalkInfoHeading(`${infoIcon} Usage:`)} ${numberFormat.format(output.inputTokens)} input / ${numberFormat.format(output.outputTokens)} output\n\n`;
231341
+ case "Usage": return `${prefix}${chalkInfoHeading(`${infoIcon} Usage:`)} ${numberFormat.format(output.contextTokens)} context / ${numberFormat.format(output.inputTokens)} input / ${numberFormat.format(output.outputTokens)} output\n\n`;
231324
231342
  }
231325
231343
  }), catchTag("AgentFinished", (finished) => succeed$1(`\n${chalk.bold.green(`${doneIcon} Task complete:`)}\n\n${finished.summary}`)));
231326
231344
  const promptToString = (prompt) => {
@@ -231406,13 +231424,20 @@ var ClankaModels = class extends Service()("lalph/ClankaModels", {
231406
231424
  lookup: fnUntraced(function* (input) {
231407
231425
  const [provider, model, reasoning] = yield* parseInput(input.split("/"));
231408
231426
  const layer = resolve$1(provider, model, reasoning);
231409
- return merge$6(layer, layerSubagentModel(reasoning === "low" ? layer : resolve$1(provider, model, reasoning === "medium" ? "low" : "medium")));
231427
+ return merge$6(layer, layerSubagentModel(reasoning === "low" ? layer : resolveSubagent(provider, model, reasoning === "medium" ? "low" : "medium")));
231410
231428
  }, unwrap$3)
231411
231429
  }) {};
231412
- const resolve$1 = (provider, model$2, reasoning) => {
231430
+ const resolve$1 = (provider, model$3, reasoning) => {
231431
+ switch (provider) {
231432
+ case "openai": return modelWebSocket(model$3, { reasoning: { effort: reasoning } }).pipe(provide$3(layerWebSocketConstructorWS), provide$3(layerClient$1));
231433
+ case "copilot": return model(model$3, { ...reasoningToCopilotConfig(model$3, reasoning) }).pipe(provide$3(layerClient));
231434
+ }
231435
+ };
231436
+ const resolveSubagent = (provider, model$2, reasoning) => {
231437
+ const flooredReasoning = reasoning === "medium" ? "low" : "medium";
231413
231438
  switch (provider) {
231414
- case "openai": return modelWebSocket(model$2, { reasoning: { effort: reasoning } }).pipe(provide$3(layerWebSocketConstructorWS), provide$3(layerClient$1));
231415
- case "copilot": return model(model$2, { ...reasoningToCopilotConfig(model$2, reasoning) }).pipe(provide$3(layerClient));
231439
+ case "openai": return modelWebSocket("gpt-5.4-mini", { reasoning: { effort: "high" } }).pipe(provide$3(layerWebSocketConstructorWS), provide$3(layerClient$1));
231440
+ case "copilot": return model(model$2, { ...reasoningToCopilotConfig(model$2, flooredReasoning) }).pipe(provide$3(layerClient));
231416
231441
  }
231417
231442
  };
231418
231443
  const reasoningToCopilotConfig = (model, reasoning) => {
@@ -239847,14 +239872,15 @@ const ClankaMuxerLayer = effectDiscard(gen(function* () {
239847
239872
  const stdio = yield* Stdio;
239848
239873
  yield* muxer.output.pipe(run$8(stdio.stdout()), forkScoped);
239849
239874
  })).pipe(provideMerge(layerMuxer(pretty)));
239850
- const Search = (directory) => unwrap$3(gen(function* () {
239875
+ const SemanticSearchLayer = unwrap$3(gen(function* () {
239876
+ const worktree = yield* Worktree;
239851
239877
  const pathService = yield* Path$1;
239852
239878
  const apiKey = yield* redacted("LALPH_OPENAI_API_KEY").pipe(option);
239853
239879
  if (isNone(apiKey)) return empty$15;
239854
239880
  return layer$6({
239855
- directory,
239856
- database: pathService.join(directory, ".lalph", "shared", "search.sqlite")
239857
- }).pipe(orDie$3, provide$3(model$1("text-embedding-3-small", { dimensions: 1536 })), provide$3(layer$4({ apiKey: apiKey.value })), tapCause$1((cause) => logWarning(`Failed to create SemanticSearch layer`, cause)), catchCause$2(() => empty$15));
239881
+ directory: worktree.directory,
239882
+ database: pathService.join(worktree.directory, ".lalph", "shared", "search.sqlite")
239883
+ }).pipe(orDie$3, provide$3(model$1("text-embedding-3-small", { dimensions: 1536 })), provide$3(layer$4({ apiKey: apiKey.value }).pipe(provide$3(layerUndici))), tapCause$1((cause) => logWarning(`Failed to create SemanticSearch layer`, cause)), catchCause$2(() => empty$15));
239858
239884
  }).pipe(orDie$2));
239859
239885
  const runClanka = fnUntraced(function* (options) {
239860
239886
  const muxer = yield* Muxer;
@@ -239873,7 +239899,7 @@ const runClanka = fnUntraced(function* (options) {
239873
239899
  }, scoped$1, (effect, options) => provide$1(effect, layerLocal({
239874
239900
  directory: options.directory,
239875
239901
  tools: options.withChoose ? TaskChooseTools : TaskTools
239876
- }).pipe(provide$3(Search(options.directory)), merge$6(ClankaModels.get(options.model)))), provide$1([layerUndici, TaskToolsHandlers]));
239902
+ }).pipe(merge$6(ClankaModels.get(options.model)))), provide$1([layerUndici, TaskToolsHandlers]));
239877
239903
  //#endregion
239878
239904
  //#region src/Agents/worker.ts
239879
239905
  const agentWorker = fnUntraced(function* (options) {
@@ -240287,7 +240313,7 @@ const run = fnUntraced(function* (options) {
240287
240313
  worktree
240288
240314
  });
240289
240315
  else yield* prd.maybeRevertIssue({ issueId: taskId });
240290
- }, scoped$1, provide$1(Prd.layer, { local: true }));
240316
+ }, scoped$1, provide$1(SemanticSearchLayer.pipe(provideMerge(Prd.layer)), { local: true }));
240291
240317
  const runProject = fnUntraced(function* (options) {
240292
240318
  const isFinite = Number.isFinite(options.iterations);
240293
240319
  const iterationsDisplay = isFinite ? options.iterations : "unlimited";
@@ -240664,7 +240690,7 @@ const commandEdit = make$58("edit").pipe(withDescription("Open the selected proj
240664
240690
  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));
240665
240691
  //#endregion
240666
240692
  //#region package.json
240667
- var version = "0.3.73";
240693
+ var version = "0.3.75";
240668
240694
  //#endregion
240669
240695
  //#region src/commands/projects/ls.ts
240670
240696
  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* () {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lalph",
3
3
  "type": "module",
4
- "version": "0.3.73",
4
+ "version": "0.3.75",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -34,7 +34,7 @@
34
34
  "devDependencies": {
35
35
  "@changesets/changelog-github": "^0.6.0",
36
36
  "@changesets/cli": "^2.30.0",
37
- "@effect/ai-openai": "4.0.0-beta.34",
37
+ "@effect/ai-openai": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/ai-openai@720d238",
38
38
  "@effect/ai-openai-compat": "4.0.0-beta.34",
39
39
  "@effect/language-service": "^0.80.0",
40
40
  "@effect/platform-node": "4.0.0-beta.34",
@@ -42,7 +42,7 @@
42
42
  "@octokit/plugin-rest-endpoint-methods": "^17.0.0",
43
43
  "@octokit/types": "^16.0.0",
44
44
  "@typescript/native-preview": "7.0.0-dev.20260317.1",
45
- "clanka": "^0.2.0",
45
+ "clanka": "^0.2.3",
46
46
  "concurrently": "^9.2.1",
47
47
  "effect": "4.0.0-beta.34",
48
48
  "husky": "^9.1.7",
package/src/Clanka.ts CHANGED
@@ -15,6 +15,7 @@ import { withStallTimeout } from "./shared/stream.ts"
15
15
  import { NodeHttpClient } from "@effect/platform-node"
16
16
  import type { Prompt } from "effect/unstable/ai"
17
17
  import { OpenAiClient, OpenAiEmbeddingModel } from "@effect/ai-openai"
18
+ import { Worktree } from "./Worktree.ts"
18
19
 
19
20
  export const ClankaMuxerLayer = Layer.effectDiscard(
20
21
  Effect.gen(function* () {
@@ -24,43 +25,43 @@ export const ClankaMuxerLayer = Layer.effectDiscard(
24
25
  }),
25
26
  ).pipe(Layer.provideMerge(OutputFormatter.layerMuxer(OutputFormatter.pretty)))
26
27
 
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
- )
28
+ export const SemanticSearchLayer = Layer.unwrap(
29
+ Effect.gen(function* () {
30
+ const worktree = yield* Worktree
31
+ const pathService = yield* Path.Path
32
+ const apiKey = yield* Config.redacted("LALPH_OPENAI_API_KEY").pipe(
33
+ Config.option,
34
+ )
35
+ if (Option.isNone(apiKey)) {
36
+ return Layer.empty
37
+ }
38
+ return SemanticSearch.layer({
39
+ directory: worktree.directory,
40
+ database: pathService.join(
41
+ worktree.directory,
42
+ ".lalph",
43
+ "shared",
44
+ "search.sqlite",
45
+ ),
46
+ }).pipe(
47
+ Layer.orDie,
48
+ Layer.provide(
49
+ OpenAiEmbeddingModel.model("text-embedding-3-small", {
50
+ dimensions: 1536,
51
+ }),
52
+ ),
53
+ Layer.provide(
54
+ OpenAiClient.layer({
55
+ apiKey: apiKey.value,
56
+ }).pipe(Layer.provide(NodeHttpClient.layerUndici)),
57
+ ),
58
+ Layer.tapCause((cause) =>
59
+ Effect.logWarning(`Failed to create SemanticSearch layer`, cause),
60
+ ),
61
+ Layer.catchCause(() => Layer.empty),
62
+ )
63
+ }).pipe(Effect.orDie),
64
+ )
64
65
 
65
66
  export const runClanka = Effect.fnUntraced(
66
67
  function* (options: {
@@ -112,10 +113,7 @@ export const runClanka = Effect.fnUntraced(
112
113
  Agent.layerLocal({
113
114
  directory: options.directory,
114
115
  tools: options.withChoose ? TaskChooseTools : TaskTools,
115
- }).pipe(
116
- Layer.provide(Search(options.directory)),
117
- Layer.merge(ClankaModels.get(options.model)),
118
- ),
116
+ }).pipe(Layer.merge(ClankaModels.get(options.model))),
119
117
  ),
120
118
  Effect.provide([NodeHttpClient.layerUndici, TaskToolsHandlers]),
121
119
  )
@@ -32,7 +32,7 @@ export class ClankaModels extends LayerMap.Service<ClankaModels>()(
32
32
  Agent.layerSubagentModel(
33
33
  reasoning === "low"
34
34
  ? layer
35
- : resolve(
35
+ : resolveSubagent(
36
36
  provider,
37
37
  model,
38
38
  reasoning === "medium" ? "low" : "medium",
@@ -67,6 +67,31 @@ const resolve = (
67
67
  }
68
68
  }
69
69
 
70
+ const resolveSubagent = (
71
+ provider: "openai" | "copilot",
72
+ model: string,
73
+ reasoning: typeof Reasoning.Type,
74
+ ) => {
75
+ const flooredReasoning = reasoning === "medium" ? "low" : "medium"
76
+ switch (provider) {
77
+ case "openai": {
78
+ return Codex.modelWebSocket("gpt-5.4-mini", {
79
+ reasoning: {
80
+ effort: "high",
81
+ },
82
+ }).pipe(
83
+ Layer.provide(NodeSocket.layerWebSocketConstructorWS),
84
+ Layer.provide(Codex.layerClient),
85
+ )
86
+ }
87
+ case "copilot": {
88
+ return Copilot.model(model, {
89
+ ...reasoningToCopilotConfig(model, flooredReasoning),
90
+ }).pipe(Layer.provide(Copilot.layerClient))
91
+ }
92
+ }
93
+ }
94
+
70
95
  const reasoningToCopilotConfig = (
71
96
  model: string,
72
97
  reasoning: typeof Reasoning.Type,
@@ -6,6 +6,7 @@ import {
6
6
  FiberSet,
7
7
  FileSystem,
8
8
  Iterable,
9
+ Layer,
9
10
  MutableRef,
10
11
  Option,
11
12
  Path,
@@ -54,7 +55,7 @@ import type { AiError } from "effect/unstable/ai/AiError"
54
55
  import type { PrdIssue } from "../domain/PrdIssue.ts"
55
56
  import { CurrentTaskRef } from "../TaskTools.ts"
56
57
  import type { OutputFormatter } from "clanka"
57
- import { ClankaMuxerLayer } from "../Clanka.ts"
58
+ import { ClankaMuxerLayer, SemanticSearchLayer } from "../Clanka.ts"
58
59
  import { agentResearcher } from "../Agents/researcher.ts"
59
60
 
60
61
  // Main iteration run logic
@@ -330,7 +331,9 @@ const run = Effect.fnUntraced(
330
331
  }
331
332
  },
332
333
  Effect.scoped,
333
- Effect.provide(Prd.layer, { local: true }),
334
+ Effect.provide(SemanticSearchLayer.pipe(Layer.provideMerge(Prd.layer)), {
335
+ local: true,
336
+ }),
334
337
  )
335
338
 
336
339
  const runProject = Effect.fnUntraced(