lalph 0.3.54 → 0.3.55
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 +22 -21
- package/package.json +1 -1
- package/src/Clanka.ts +2 -5
- package/src/ClankaModels.ts +29 -22
package/dist/cli.mjs
CHANGED
|
@@ -17455,12 +17455,12 @@ function set$10(self, key, value) {
|
|
|
17455
17455
|
//#endregion
|
|
17456
17456
|
//#region node_modules/.pnpm/effect@4.0.0-beta.31/node_modules/effect/dist/internal/schema/annotations.js
|
|
17457
17457
|
/** @internal */
|
|
17458
|
-
function resolve$
|
|
17458
|
+
function resolve$4(ast) {
|
|
17459
17459
|
return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
|
|
17460
17460
|
}
|
|
17461
17461
|
/** @internal */
|
|
17462
17462
|
function resolveAt$1(key) {
|
|
17463
|
-
return (ast) => resolve$
|
|
17463
|
+
return (ast) => resolve$4(ast)?.[key];
|
|
17464
17464
|
}
|
|
17465
17465
|
/** @internal */
|
|
17466
17466
|
const resolveIdentifier$1 = /* @__PURE__ */ resolveAt$1("identifier");
|
|
@@ -31552,7 +31552,7 @@ function fromFileUrl$1(url) {
|
|
|
31552
31552
|
}
|
|
31553
31553
|
return succeed$3(decodeURIComponent(pathname));
|
|
31554
31554
|
}
|
|
31555
|
-
const resolve$
|
|
31555
|
+
const resolve$2 = function resolve() {
|
|
31556
31556
|
let resolvedPath = "";
|
|
31557
31557
|
let resolvedAbsolute = false;
|
|
31558
31558
|
let cwd = void 0;
|
|
@@ -31577,7 +31577,7 @@ const resolve$1 = function resolve() {
|
|
|
31577
31577
|
const CHAR_FORWARD_SLASH = 47;
|
|
31578
31578
|
function toFileUrl$1(filepath) {
|
|
31579
31579
|
const outURL = new URL("file://");
|
|
31580
|
-
let resolved = resolve$
|
|
31580
|
+
let resolved = resolve$2(filepath);
|
|
31581
31581
|
if (filepath.charCodeAt(filepath.length - 1) === CHAR_FORWARD_SLASH && resolved[resolved.length - 1] !== "/") resolved += "/";
|
|
31582
31582
|
outURL.pathname = encodePathChars(resolved);
|
|
31583
31583
|
return succeed$3(outURL);
|
|
@@ -31597,7 +31597,7 @@ function encodePathChars(filepath) {
|
|
|
31597
31597
|
}
|
|
31598
31598
|
const posixImpl = /* @__PURE__ */ Path$1.of({
|
|
31599
31599
|
[TypeId$44]: TypeId$44,
|
|
31600
|
-
resolve: resolve$
|
|
31600
|
+
resolve: resolve$2,
|
|
31601
31601
|
normalize(path) {
|
|
31602
31602
|
if (path.length === 0) return ".";
|
|
31603
31603
|
const isAbsolute = path.charCodeAt(0) === 47;
|
|
@@ -32947,11 +32947,11 @@ const recur$1 = /* @__PURE__ */ memoize((ast) => {
|
|
|
32947
32947
|
let parser;
|
|
32948
32948
|
if (!ast.context && !ast.encoding && !ast.checks) return (ou, options) => {
|
|
32949
32949
|
parser ??= ast.getParser(recur$1);
|
|
32950
|
-
return parser(ou, resolve$
|
|
32950
|
+
return parser(ou, resolve$4(ast)?.["parseOptions"] ?? options);
|
|
32951
32951
|
};
|
|
32952
32952
|
const isStructural = isArrays(ast) || isObjects(ast) || isDeclaration(ast) && ast.typeParameters.length > 0;
|
|
32953
32953
|
return (ou, options) => {
|
|
32954
|
-
options = resolve$
|
|
32954
|
+
options = resolve$4(ast)?.["parseOptions"] ?? options;
|
|
32955
32955
|
const encoding = ast.encoding;
|
|
32956
32956
|
let srou;
|
|
32957
32957
|
if (encoding) {
|
|
@@ -76481,7 +76481,7 @@ var require_snapshot_utils = /* @__PURE__ */ __commonJSMin$1(((exports, module)
|
|
|
76481
76481
|
//#region node_modules/.pnpm/undici@7.22.0/node_modules/undici/lib/mock/snapshot-recorder.js
|
|
76482
76482
|
var require_snapshot_recorder = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
76483
76483
|
const { writeFile, readFile, mkdir } = __require("node:fs/promises");
|
|
76484
|
-
const { dirname, resolve } = __require("node:path");
|
|
76484
|
+
const { dirname, resolve: resolve$1 } = __require("node:path");
|
|
76485
76485
|
const { setTimeout: setTimeout$1, clearTimeout: clearTimeout$1 } = __require("node:timers");
|
|
76486
76486
|
const { InvalidArgumentError, UndiciError } = require_errors$1();
|
|
76487
76487
|
const { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
|
|
@@ -76746,7 +76746,7 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJSMin$1(((exports, modul
|
|
|
76746
76746
|
const path = filePath || this.#snapshotPath;
|
|
76747
76747
|
if (!path) throw new InvalidArgumentError("Snapshot path is required");
|
|
76748
76748
|
try {
|
|
76749
|
-
const data = await readFile(resolve(path), "utf8");
|
|
76749
|
+
const data = await readFile(resolve$1(path), "utf8");
|
|
76750
76750
|
const parsed = JSON.parse(data);
|
|
76751
76751
|
if (Array.isArray(parsed)) {
|
|
76752
76752
|
this.#snapshots.clear();
|
|
@@ -76766,7 +76766,7 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJSMin$1(((exports, modul
|
|
|
76766
76766
|
async saveSnapshots(filePath) {
|
|
76767
76767
|
const path = filePath || this.#snapshotPath;
|
|
76768
76768
|
if (!path) throw new InvalidArgumentError("Snapshot path is required");
|
|
76769
|
-
const resolvedPath = resolve(path);
|
|
76769
|
+
const resolvedPath = resolve$1(path);
|
|
76770
76770
|
await mkdir(dirname(resolvedPath), { recursive: true });
|
|
76771
76771
|
const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
|
|
76772
76772
|
hash,
|
|
@@ -225446,20 +225446,21 @@ const parseInput = flow(decodeUnknownEffect(Tuple([
|
|
|
225446
225446
|
String$1,
|
|
225447
225447
|
Reasoning
|
|
225448
225448
|
])), orDie$2);
|
|
225449
|
-
const clankaSubagent = fnUntraced(function* (models, input) {
|
|
225450
|
-
const [provider, model] = yield* parseInput(input.split("/"));
|
|
225451
|
-
return models.get(`${provider}/${model}/low`);
|
|
225452
|
-
}, unwrap$3);
|
|
225453
225449
|
var ClankaModels = class extends Service()("lalph/ClankaModels", {
|
|
225454
225450
|
dependencies: [ModelServices],
|
|
225455
225451
|
lookup: fnUntraced(function* (input) {
|
|
225456
|
-
const [provider, model
|
|
225457
|
-
|
|
225458
|
-
|
|
225459
|
-
|
|
225460
|
-
}
|
|
225452
|
+
const [provider, model, reasoning] = yield* parseInput(input.split("/"));
|
|
225453
|
+
const layer = resolve(provider, model, reasoning);
|
|
225454
|
+
if (reasoning === "low" || reasoning === "medium") return layer;
|
|
225455
|
+
return merge$6(layer, layerSubagentModel(resolve(provider, model, "medium")));
|
|
225461
225456
|
}, unwrap$3)
|
|
225462
225457
|
}) {};
|
|
225458
|
+
const resolve = (provider, model$2, reasoning) => {
|
|
225459
|
+
switch (provider) {
|
|
225460
|
+
case "openai": return model$1(model$2, { reasoning: { effort: reasoning } });
|
|
225461
|
+
case "copilot": return model(model$2, { ...reasoningToCopilotConfig(model$2, reasoning) });
|
|
225462
|
+
}
|
|
225463
|
+
};
|
|
225463
225464
|
const reasoningToCopilotConfig = (model, reasoning) => {
|
|
225464
225465
|
if (model.startsWith("claude")) switch (reasoning) {
|
|
225465
225466
|
case "low": return {};
|
|
@@ -233867,7 +233868,7 @@ const runClanka = fnUntraced(function* (options) {
|
|
|
233867
233868
|
const output = yield* pipe$1(agent.send({
|
|
233868
233869
|
prompt: options.prompt,
|
|
233869
233870
|
system: options.system
|
|
233870
|
-
}), provide$1(
|
|
233871
|
+
}), provide$1(models.get(options.model)));
|
|
233871
233872
|
yield* muxer.add(output);
|
|
233872
233873
|
let stream = options.stallTimeout ? withStallTimeout(options.stallTimeout)(output) : output;
|
|
233873
233874
|
if (options.steer) yield* options.steer.pipe(switchMap(fnUntraced(function* (message) {
|
|
@@ -234627,7 +234628,7 @@ const commandEdit = make$46("edit").pipe(withDescription("Open the selected proj
|
|
|
234627
234628
|
const commandSource = make$46("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));
|
|
234628
234629
|
//#endregion
|
|
234629
234630
|
//#region package.json
|
|
234630
|
-
var version = "0.3.
|
|
234631
|
+
var version = "0.3.55";
|
|
234631
234632
|
//#endregion
|
|
234632
234633
|
//#region src/commands/projects/ls.ts
|
|
234633
234634
|
const commandProjectsLs = make$46("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
package/src/Clanka.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Agent, OutputFormatter } from "clanka"
|
|
2
2
|
import { Duration, Effect, Layer, pipe, Stdio, Stream } from "effect"
|
|
3
3
|
import { TaskChooseTools, TaskTools, TaskToolsHandlers } from "./TaskTools.ts"
|
|
4
|
-
import { ClankaModels
|
|
4
|
+
import { ClankaModels } from "./ClankaModels.ts"
|
|
5
5
|
import { withStallTimeout } from "./shared/stream.ts"
|
|
6
6
|
import { NodeHttpClient } from "@effect/platform-node"
|
|
7
7
|
|
|
@@ -32,10 +32,7 @@ export const runClanka = Effect.fnUntraced(
|
|
|
32
32
|
prompt: options.prompt,
|
|
33
33
|
system: options.system,
|
|
34
34
|
}),
|
|
35
|
-
Effect.provide(
|
|
36
|
-
models.get(options.model),
|
|
37
|
-
Agent.layerSubagentModel(clankaSubagent(models, options.model)),
|
|
38
|
-
]),
|
|
35
|
+
Effect.provide(models.get(options.model)),
|
|
39
36
|
)
|
|
40
37
|
|
|
41
38
|
yield* muxer.add(output)
|
package/src/ClankaModels.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// oxlint-disable typescript/no-explicit-any
|
|
2
2
|
import { NodeHttpClient } from "@effect/platform-node"
|
|
3
|
-
import { Codex, Copilot } from "clanka"
|
|
3
|
+
import { Agent, Codex, Copilot } from "clanka"
|
|
4
4
|
import { Effect, flow, Layer, LayerMap, Schema } from "effect"
|
|
5
5
|
import { layerKvs } from "./Kvs.ts"
|
|
6
6
|
|
|
@@ -20,38 +20,45 @@ const parseInput = flow(
|
|
|
20
20
|
Effect.orDie,
|
|
21
21
|
)
|
|
22
22
|
|
|
23
|
-
export const clankaSubagent = Effect.fnUntraced(function* (
|
|
24
|
-
models: ClankaModels["Service"],
|
|
25
|
-
input: string,
|
|
26
|
-
) {
|
|
27
|
-
const [provider, model] = yield* parseInput(input.split("/"))
|
|
28
|
-
return models.get(`${provider}/${model}/low`)
|
|
29
|
-
}, Layer.unwrap)
|
|
30
|
-
|
|
31
23
|
export class ClankaModels extends LayerMap.Service<ClankaModels>()(
|
|
32
24
|
"lalph/ClankaModels",
|
|
33
25
|
{
|
|
34
26
|
dependencies: [ModelServices],
|
|
35
27
|
lookup: Effect.fnUntraced(function* (input: string) {
|
|
36
28
|
const [provider, model, reasoning] = yield* parseInput(input.split("/"))
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
reasoning: {
|
|
41
|
-
effort: reasoning,
|
|
42
|
-
},
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
case "copilot": {
|
|
46
|
-
return Copilot.model(model, {
|
|
47
|
-
...reasoningToCopilotConfig(model, reasoning),
|
|
48
|
-
})
|
|
49
|
-
}
|
|
29
|
+
const layer = resolve(provider, model, reasoning)
|
|
30
|
+
if (reasoning === "low" || reasoning === "medium") {
|
|
31
|
+
return layer
|
|
50
32
|
}
|
|
33
|
+
return Layer.merge(
|
|
34
|
+
layer,
|
|
35
|
+
Agent.layerSubagentModel(resolve(provider, model, "medium")),
|
|
36
|
+
)
|
|
51
37
|
}, Layer.unwrap),
|
|
52
38
|
},
|
|
53
39
|
) {}
|
|
54
40
|
|
|
41
|
+
const resolve = (
|
|
42
|
+
provider: "openai" | "copilot",
|
|
43
|
+
model: string,
|
|
44
|
+
reasoning: typeof Reasoning.Type,
|
|
45
|
+
) => {
|
|
46
|
+
switch (provider) {
|
|
47
|
+
case "openai": {
|
|
48
|
+
return Codex.model(model, {
|
|
49
|
+
reasoning: {
|
|
50
|
+
effort: reasoning,
|
|
51
|
+
},
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
case "copilot": {
|
|
55
|
+
return Copilot.model(model, {
|
|
56
|
+
...reasoningToCopilotConfig(model, reasoning),
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
55
62
|
const reasoningToCopilotConfig = (
|
|
56
63
|
model: string,
|
|
57
64
|
reasoning: typeof Reasoning.Type,
|