clanka 0.14.0 → 0.15.1

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/bin/cli.mjs CHANGED
@@ -6652,6 +6652,14 @@ const withSubcommands = dual(2, (self, subcommands) => {
6652
6652
  handle
6653
6653
  });
6654
6654
  });
6655
+ const withGlobalFlags = dual(2, (self, globalFlags) => {
6656
+ const impl = toImpl(self);
6657
+ const next = Array.from(new Set([...impl.globalFlags, ...globalFlags]));
6658
+ return makeCommand({
6659
+ ...impl,
6660
+ globalFlags: next
6661
+ });
6662
+ });
6655
6663
  const withDescription = dual(2, (self, description) => makeCommand({
6656
6664
  ...toImpl(self),
6657
6665
  description
@@ -11191,18 +11199,19 @@ var Skill = class extends Class$1("Skill")({
11191
11199
  location: String$6,
11192
11200
  source: SkillSource
11193
11201
  }) {};
11202
+ const skillsRoots = (path, directory) => [path.resolve(directory, ".agents", "skills"), path.resolve(directory, ".kiro", "skills")];
11194
11203
  const discover$1 = fnUntraced(function* (options) {
11195
11204
  const path = yield* Path$3;
11196
- const roots = [{
11197
- root: path.resolve(options.directory, ".agents", "skills"),
11205
+ const roots = skillsRoots(path, options.directory).map((root) => ({
11206
+ root,
11198
11207
  source: "project"
11199
- }];
11208
+ }));
11200
11209
  if (options.hermesHome && isSome(options.hermesHome) && options.hermesHome.value !== "") roots.push({
11201
11210
  root: path.resolve(options.hermesHome.value, "skills"),
11202
11211
  source: "user"
11203
11212
  });
11204
- if (isSome(options.homeDirectory)) roots.push({
11205
- root: path.resolve(options.homeDirectory.value, ".agents", "skills"),
11213
+ if (isSome(options.homeDirectory)) for (const root of skillsRoots(path, options.homeDirectory.value)) roots.push({
11214
+ root,
11206
11215
  source: "user"
11207
11216
  });
11208
11217
  const byName = new Map();
@@ -11211,7 +11220,9 @@ const discover$1 = fnUntraced(function* (options) {
11211
11220
  });
11212
11221
  const discoverProject = fnUntraced(function* (directory) {
11213
11222
  const path = yield* Path$3;
11214
- return yield* scan(path.resolve(directory, ".agents", "skills"), "project");
11223
+ const byName = new Map();
11224
+ for (const root of skillsRoots(path, directory)) for (const skill of yield* scan(root, "project")) if (!byName.has(skill.name)) byName.set(skill.name, skill);
11225
+ return Array.from(byName.values());
11215
11226
  });
11216
11227
  const scan = fnUntraced(function* (skillsDir, source) {
11217
11228
  const fs = yield* FileSystem;
@@ -32664,6 +32675,10 @@ const mcpServerEntries = fnUntraced(function* (servers, cwd) {
32664
32675
  return entries;
32665
32676
  });
32666
32677
  const SessionIdParams = Struct({ sessionId: String$6 });
32678
+ const SteerParams = Struct({
32679
+ sessionId: String$6,
32680
+ message: String$6
32681
+ });
32667
32682
  const SetModelParams = Struct({
32668
32683
  sessionId: String$6,
32669
32684
  modelId: String$6
@@ -32871,6 +32886,7 @@ const make$8 = fnUntraced(function* (options) {
32871
32886
  fastMode: record.fastMode ?? false,
32872
32887
  agent,
32873
32888
  running: void 0,
32889
+ steers: void 0,
32874
32890
  toolCalls: 0,
32875
32891
  announcedSubagents: new Set(),
32876
32892
  scope: sessionScope,
@@ -33048,6 +33064,33 @@ const make$8 = fnUntraced(function* (options) {
33048
33064
  content: textContent(finished.summary)
33049
33065
  })));
33050
33066
  });
33067
+ const withdrawSteers = fnUntraced(function* (session) {
33068
+ const unread = (session.steers ?? []).filter(({ fiber }) => fiber.pollUnsafe() === void 0);
33069
+ session.steers = [];
33070
+ yield* interruptAll(unread.map(({ fiber }) => fiber));
33071
+ return unread.filter(({ fiber }) => {
33072
+ const exit = fiber.pollUnsafe();
33073
+ return exit === void 0 || !isSuccess(exit);
33074
+ }).map(({ message }) => message);
33075
+ });
33076
+ const runPrompt = fnUntraced(function* (session, prompt) {
33077
+ yield* scoped(runTurn(session, prompt));
33078
+ while (true) {
33079
+ if (session.steers.every(({ fiber }) => fiber.pollUnsafe() !== void 0)) {
33080
+ session.steers = void 0;
33081
+ return;
33082
+ }
33083
+ const messages = yield* withdrawSteers(session);
33084
+ if (messages.length > 0) yield* scoped(runTurn(session, messages.map((content) => ({
33085
+ role: "user",
33086
+ content
33087
+ }))));
33088
+ }
33089
+ }, (effect, session) => effect.pipe(onExit(() => {
33090
+ const steers = session.steers ?? [];
33091
+ session.steers = void 0;
33092
+ return interruptAll(steers.map(({ fiber }) => fiber));
33093
+ })));
33051
33094
  const initialize = succeed$1({
33052
33095
  protocolVersion: 1,
33053
33096
  agentCapabilities: {
@@ -33155,7 +33198,8 @@ const make$8 = fnUntraced(function* (options) {
33155
33198
  });
33156
33199
  session.mcpFailures = void 0;
33157
33200
  }
33158
- session.running = yield* runTurn(session, input).pipe(provide$1(model), scoped, forkChild);
33201
+ session.steers = [];
33202
+ session.running = yield* runPrompt(session, input).pipe(provide$1(model), forkChild);
33159
33203
  const exit$1 = yield* exit(join$2(session.running));
33160
33204
  session.running = void 0;
33161
33205
  yield* persist(session);
@@ -33163,6 +33207,17 @@ const make$8 = fnUntraced(function* (options) {
33163
33207
  if (hasInterruptsOnly(exit$1.cause)) return { stopReason: "cancelled" };
33164
33208
  return yield* toRpcError(exit$1.cause);
33165
33209
  });
33210
+ const steer = fnUntraced(function* (params) {
33211
+ const { sessionId, message } = yield* decodeParams(SteerParams, params);
33212
+ const session = sessions.get(sessionId);
33213
+ if (session?.steers === void 0) return { queued: false };
33214
+ const fiber = yield* session.agent.steer(message).pipe(forkIn(session.scope, { startImmediately: true }));
33215
+ session.steers.push({
33216
+ message,
33217
+ fiber
33218
+ });
33219
+ return { queued: true };
33220
+ });
33166
33221
  const closeSession = fnUntraced(function* (params) {
33167
33222
  const { sessionId } = yield* decodeParams(SessionIdParams, params);
33168
33223
  const session = yield* getSession(sessionId);
@@ -33188,6 +33243,7 @@ const make$8 = fnUntraced(function* (options) {
33188
33243
  case "session/close": return closeSession(params);
33189
33244
  case "session/set_model": return setModel(params);
33190
33245
  case "session/prompt": return prompt(params);
33246
+ case "_session/steer": return steer(params);
33191
33247
  default: return fail$1(new RpcError({
33192
33248
  code: -32601,
33193
33249
  message: `Method not found: ${method}`
@@ -41499,10 +41555,18 @@ const makeAcp = (options) => (modelId, thoughtLevel, fastMode = false) => map$8(
41499
41555
  const LogToStderr = LogToStderr$1;
41500
41556
  //#endregion
41501
41557
  //#region package.json
41502
- var version$1 = "0.14.0";
41558
+ var version$1 = "0.15.1";
41503
41559
  //#endregion
41504
41560
  //#region src/cli.ts
41505
- const version = version$1;
41561
+ const ReportedVersion = Setting("reported-version")({ flag: String$1("reported-version").pipe(withDescription$1("Report this version instead of clanka's own, for --version and to ACP clients"), optional$1) });
41562
+ const reportedVersion = (args) => {
41563
+ for (const [index, arg] of args.entries()) {
41564
+ if (arg === "--") return void 0;
41565
+ if (arg === "--reported-version") return args[index + 1];
41566
+ if (arg.startsWith("--reported-version=")) return arg.slice(19);
41567
+ }
41568
+ };
41569
+ const version = reportedVersion(process.argv.slice(2)) ?? version$1;
41506
41570
  const HttpClientLive = layerNodeHttpNoAgent.pipe(provide$3(layerAgentOptions({ keepAlive: true })));
41507
41571
  const providers = Provider.literals;
41508
41572
  const selectModel = fnUntraced(function* (provider) {
@@ -41590,8 +41654,10 @@ const Search = (directory) => unwrap$1(gen(function* () {
41590
41654
  }).pipe(provide$3(model$3("text-embedding-3-small", { dimensions: 1536 })), provide$3(layer$4({ apiKey: apiKey.value })));
41591
41655
  })).pipe(provide$3([layer$9, HttpClientLive]));
41592
41656
  const acpModel = String$1("model").pipe(withAlias("m"), withDescription$1("Default model as <provider>/<model>/<effort>, e.g. openai/gpt-6-astra/medium"), withSchema(ModelId), withDefault("openai/gpt-6-astra/medium"), map$1((modelId) => getOrThrow(parseModelId(modelId))));
41657
+ const trustAllTools = Boolean$1("trust-all-tools").pipe(withDescription$1("Accepted for kiro-cli compatibility. Has no effect: clanka runs every tool call without asking."), withDefault(false));
41593
41658
  const acp = make$30("acp", {
41594
41659
  model: acpModel,
41660
+ trustAllTools,
41595
41661
  fast,
41596
41662
  compaction,
41597
41663
  apiKey,
@@ -41664,7 +41730,7 @@ make$30("clanka", {
41664
41730
  onNone: () => empty$7,
41665
41731
  onSome: Search
41666
41732
  })), provideMerge(layer$6(mcpServers))), Model]));
41667
- })), provide(({ prompt, compaction }) => mergeAll(ConversationMode.layer(isNone(prompt)), CompactionConfig.layer({ enabled: compaction }))), withSubcommands([acp]), run$1({ version }), provide$1([
41733
+ })), provide(({ prompt, compaction }) => mergeAll(ConversationMode.layer(isNone(prompt)), CompactionConfig.layer({ enabled: compaction }))), withSubcommands([acp]), withGlobalFlags([ReportedVersion]), run$1({ version }), provide$1([
41668
41734
  layer$9,
41669
41735
  ModelsRepo.layerModelsDev().pipe(provideMerge([Kvs, HttpClientLive])),
41670
41736
  layerWebSocketConstructor,