@yukino.js/yukino 0.0.13-dev → 0.0.13

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 (38) hide show
  1. package/README.md +9 -7
  2. package/dist/{a2a-DG2JNM3U.js → a2a-DKWMWGID.js} +2 -2
  3. package/dist/{acp-DCZDS6FQ.js → acp-RL6DKS3R.js} +1 -1
  4. package/dist/{anthropic-5BTWVZVT.js → anthropic-74ALYMH2.js} +1 -1
  5. package/dist/{chunk-SZXXASVH.js → chunk-556TRLPT.js} +1 -1
  6. package/dist/{chunk-IWMCIYOG.js → chunk-6FSIG63T.js} +25 -25
  7. package/dist/{chunk-5DK2M7VI.js → chunk-6JUOKMSJ.js} +1 -1
  8. package/dist/{chunk-COHBT6M7.js → chunk-A5G5NTDB.js} +88 -88
  9. package/dist/{chunk-4CLD7LEU.js → chunk-A7CJPQC5.js} +1 -1
  10. package/dist/{chunk-AZQD75PX.js → chunk-APJAUOF6.js} +1 -1
  11. package/dist/{chunk-BDLFNDC4.js → chunk-CJSMVCUF.js} +1 -1
  12. package/dist/{chunk-OI2W6R6H.js → chunk-HWCLMDQF.js} +8 -8
  13. package/dist/chunk-NEU4ER5V.js +4 -0
  14. package/dist/{chunk-5URXBVET.js → chunk-OREDGNI6.js} +1 -1
  15. package/dist/chunk-SCR7NDDL.js +63 -0
  16. package/dist/lib/{anthropic-AVZIC22O.js → anthropic-EQRUGP2C.js} +4 -4
  17. package/dist/lib/{chunk-XH7D5FLE.js → chunk-CDMR25FD.js} +3 -3
  18. package/dist/lib/{chunk-O2H6VKKR.js → chunk-EGT7BJRD.js} +2 -2
  19. package/dist/lib/{chunk-LSI3T24Q.js → chunk-FUJDUZTH.js} +1 -1
  20. package/dist/lib/{chunk-GVI5R2DA.js → chunk-HUTUNNDX.js} +1 -1
  21. package/dist/lib/{chunk-EGJKLA2W.js → chunk-JYCSWXCR.js} +2 -2
  22. package/dist/lib/{chunk-QJ32WYQY.js → chunk-UBVKYJFI.js} +124 -27
  23. package/dist/lib/{chunk-TUNZLQLO.js → chunk-WWCSFKMR.js} +1 -1
  24. package/dist/lib/index.d.ts +49 -24
  25. package/dist/lib/index.js +186 -91
  26. package/dist/lib/{openai-54IQOU6Y.js → openai-B3I5WBFT.js} +3 -3
  27. package/dist/lib/{providers-MOCB6Y5L.js → providers-EJ4VBHNP.js} +2 -2
  28. package/dist/lib/{tool-filter-5Z6UTRRR.js → tool-filter-TURPCYFR.js} +3 -3
  29. package/dist/{main-IA22XMQR.js → main-JEEKFCGX.js} +226 -216
  30. package/dist/main.js +11 -2
  31. package/dist/{openai-I2TTMBWK.js → openai-7C6BVQ7M.js} +1 -1
  32. package/dist/{providers-DXQRJUIY.js → providers-U23PWAHG.js} +1 -1
  33. package/dist/{server-QS7CX37F.js → server-EOSEQPNY.js} +1 -1
  34. package/dist/tool-filter-UDSHRE5F.js +4 -0
  35. package/package.json +1 -1
  36. package/dist/chunk-CW5XFH7H.js +0 -59
  37. package/dist/chunk-UGX62ZSO.js +0 -4
  38. package/dist/tool-filter-KDQMXIDC.js +0 -4
package/dist/lib/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  providers_exports,
4
4
  version,
5
5
  version_exports
6
- } from "./chunk-EGJKLA2W.js";
6
+ } from "./chunk-JYCSWXCR.js";
7
7
  import {
8
8
  bwrap_exports
9
9
  } from "./chunk-XLRV26YW.js";
@@ -14,10 +14,10 @@ import {
14
14
  anthropic_exports,
15
15
  decideAndApply,
16
16
  strategy_exports
17
- } from "./chunk-XH7D5FLE.js";
17
+ } from "./chunk-CDMR25FD.js";
18
18
  import {
19
19
  openai_exports
20
- } from "./chunk-O2H6VKKR.js";
20
+ } from "./chunk-EGT7BJRD.js";
21
21
  import {
22
22
  ContextTooLongError,
23
23
  DEFAULT_CONTEXT_WINDOW,
@@ -44,7 +44,7 @@ import {
44
44
  persistThinkingLevel,
45
45
  resolveDefaultProvider,
46
46
  withProjectMcpServers
47
- } from "./chunk-TUNZLQLO.js";
47
+ } from "./chunk-WWCSFKMR.js";
48
48
  import {
49
49
  AgentTool,
50
50
  BUILTIN_AGENTS,
@@ -126,7 +126,7 @@ import {
126
126
  withFileSyncLock,
127
127
  worktree_exports,
128
128
  writeTeamFile
129
- } from "./chunk-QJ32WYQY.js";
129
+ } from "./chunk-UBVKYJFI.js";
130
130
  import {
131
131
  MCPToolWrapper,
132
132
  MCP_TOOL_PREFIX,
@@ -136,7 +136,7 @@ import {
136
136
  normalizeToolResultContentBlock,
137
137
  tool_wrapper_exports,
138
138
  types_exports
139
- } from "./chunk-LSI3T24Q.js";
139
+ } from "./chunk-FUJDUZTH.js";
140
140
  import {
141
141
  asErrorString,
142
142
  asRecord,
@@ -161,7 +161,7 @@ import {
161
161
  strArg,
162
162
  utils_exports,
163
163
  yukinoPath
164
- } from "./chunk-GVI5R2DA.js";
164
+ } from "./chunk-HUTUNNDX.js";
165
165
  import {
166
166
  __export,
167
167
  canonicalPath,
@@ -495,8 +495,8 @@ function preview(text) {
495
495
  return `${text.slice(0, TEXT_PREVIEW_CHARS)}\u2026 (+${String(text.length - TEXT_PREVIEW_CHARS)} chars)`;
496
496
  }
497
497
  var AgentEventLogger = class {
498
- constructor(log35) {
499
- this.log = log35;
498
+ constructor(log36) {
499
+ this.log = log36;
500
500
  }
501
501
  log;
502
502
  /**
@@ -1987,7 +1987,7 @@ async function initializeTelemetry() {
1987
1987
  if (!shouldInitialize()) {
1988
1988
  return;
1989
1989
  }
1990
- initialization = import("./providers-MOCB6Y5L.js").then(async ({ createTelemetryRuntime }) => {
1990
+ initialization = import("./providers-EJ4VBHNP.js").then(async ({ createTelemetryRuntime }) => {
1991
1991
  runtime = await createTelemetryRuntime();
1992
1992
  runtime.setMode(mode);
1993
1993
  process.once("beforeExit", () => {
@@ -3746,7 +3746,7 @@ Direct bounded research, implementation, and verification; synthesize evidence a
3746
3746
  - **SendMessage** \u2014 Follow up with a persistent teammate by name.
3747
3747
  - **TaskStop** \u2014 Stop a running teammate.
3748
3748
  - **TaskCreate / TaskGet / TaskList / TaskUpdate** \u2014 Track shared work and dependencies. Create tasks before linking their IDs; assign with owner, and use pending \u2192 in_progress \u2192 completed. Completed dependencies unblock work; cancelled dependencies do not count as completed.
3749
- - **TodoWrite** \u2014 Replace your private checklist, not the shared team board.
3749
+ - **TodoWrite** \u2014 Non-interactive private tracking; replaced by shared Task tools while a team exists.
3750
3750
  - **SyntheticOutput** \u2014 Return structured output.
3751
3751
  - **TeamDelete** \u2014 Tear down the team when finished.
3752
3752
 
@@ -3765,7 +3765,7 @@ After launching persistent work, give a brief user update and wait for notificat
3765
3765
 
3766
3766
  ## Verification
3767
3767
  Require observed evidence: changed paths, checks run, results, and blockers. Implementation workers should run relevant tests; use independent review when warranted, not as a mandatory extra phase. Exercise actual behavior, investigate failures, and distinguish verified outcomes from worker claims. Report what remains unverified.`;
3768
- var coordinatorSparseReminder = `Coordinator mode: you cannot read files, run commands, or edit code. Tools: Agent, SendMessage, TaskStop, TaskCreate, TaskGet, TaskList, TaskUpdate, TodoWrite, SyntheticOutput, TeamDelete. Task tools share the team board; TodoWrite is private. Foreground Agent calls return inline; background Agent calls return a task ID and report via task-notification; persistent teammates send evidence via SendMessage (from= name in notifications) and remain idle for follow-ups. Stop unused teammates explicitly. Do not poll workers through agents, predict results, overlap shared-file writes, or request unsolicited commits/pushes. Synthesize and verify evidence before reporting.`;
3768
+ var coordinatorSparseReminder = `Coordinator mode: you cannot read files, run commands, or edit code. Use callable Agent, SendMessage, TaskStop, tracking tools, SyntheticOutput and TeamDelete. Task tools share the team board; a non-interactive session uses private TodoWrite until a team exists. Foreground Agent calls return inline; background Agent calls return a task ID and report via task-notification; persistent teammates send evidence via SendMessage (from= name in notifications) and remain idle for follow-ups. Stop unused teammates explicitly. Do not poll workers through agents, predict results, overlap shared-file writes, or request unsolicited commits/pushes. Synthesize and verify evidence before reporting.`;
3769
3769
  var REMINDER_INTERVAL = 5;
3770
3770
  function coordinatorReminder(iteration = 1) {
3771
3771
  if (iteration <= 1 || (iteration - 1) % REMINDER_INTERVAL === 0) {
@@ -3871,12 +3871,17 @@ function buildToolGuidance(toolNames) {
3871
3871
  }
3872
3872
  if (["TaskCreate", "TaskUpdate", "TaskList", "TaskGet", "TodoWrite"].some(has)) {
3873
3873
  rules.push(
3874
- "Use available task tools to track complex work, not trivial requests. Mark work in progress before starting, and completed only after validation; use blocked or cancelled honestly. Dependencies refer to existing items and must not form cycles. Only completed dependencies unblock work; cancelled dependencies remain unresolved until explicitly removed. TaskCreate tracks work; Agent executes it. Without a team, Task tools track the agent's private list; with a team, the leader and teammates share its board. Ordinary subagents and forks always have private lists. Use subject/taskId/owner/addBlocks/addBlockedBy consistently in every context."
3874
+ "Use available tracking tools for complex work, not trivial requests. Mark work in progress before starting, and completed only after validation; use blocked or cancelled honestly. Tracking records work; Agent executes it. Tool results and the UI count only completed items in TODO completed/total. Completed items remain stored until explicitly deleted or replaced. Ordinary subagents and forks have independent private lists."
3875
+ );
3876
+ }
3877
+ if (["TaskCreate", "TaskUpdate", "TaskList", "TaskGet"].some(has)) {
3878
+ rules.push(
3879
+ "Task tools update individual items. Without a team they track the agent's private list; with a team, the leader and teammates share its board. Dependencies refer to existing items and must not form cycles. Only completed dependencies unblock work; cancelled dependencies remain unresolved until explicitly removed. Use subject/taskId/owner/addBlocks/addBlockedBy consistently."
3875
3880
  );
3876
3881
  }
3877
3882
  if (has("TodoWrite")) {
3878
3883
  rules.push(
3879
- "TodoWrite atomically replaces the entire private TODO list. Retain every still-relevant item and reuse IDs returned by the tool. It does not replace a team's shared task board."
3884
+ "TodoWrite atomically replaces the entire private TODO list. Retain every still-relevant item and reuse IDs from the returned todos. An empty array clears the list. Creating a team switches the leader to shared Task tools; TodoWrite is unavailable until the team is deleted."
3880
3885
  );
3881
3886
  }
3882
3887
  if (has("TaskOutput")) {
@@ -10961,13 +10966,21 @@ function removeMcpTools(registry, serverNames) {
10961
10966
  function createToolRegistry(cwd2, taskList, options = {}) {
10962
10967
  const registry = new ToolRegistry();
10963
10968
  registry.register(new GoalTool());
10964
- registry.register(new TaskCreateTool(taskList));
10965
- registry.register(new TaskGetTool(taskList));
10966
- registry.register(new TaskListTool(taskList));
10967
- registry.register(new TaskUpdateTool(taskList));
10968
- registry.register(new TodoWriteTool(taskList));
10969
+ const trackingMode = options.interactionMode === "non-interactive" ? "todos" : "tasks";
10969
10970
  if (options.teamManager) {
10970
- registerLeaderTaskTools(registry, options.teamManager, taskList);
10971
+ registerLeaderTaskTools(
10972
+ registry,
10973
+ options.teamManager,
10974
+ taskList,
10975
+ trackingMode
10976
+ );
10977
+ } else if (trackingMode === "todos") {
10978
+ registry.register(new TodoWriteTool(taskList));
10979
+ } else {
10980
+ registry.register(new TaskCreateTool(taskList));
10981
+ registry.register(new TaskGetTool(taskList));
10982
+ registry.register(new TaskListTool(taskList));
10983
+ registry.register(new TaskUpdateTool(taskList));
10971
10984
  }
10972
10985
  registry.register(new TaskOutputTool());
10973
10986
  registry.register(new LspTool(options.lspServers ?? []));
@@ -12734,21 +12747,21 @@ __export(client_exports2, {
12734
12747
  async function createClient(config, systemPrompt) {
12735
12748
  switch (config.protocol) {
12736
12749
  case "anthropic": {
12737
- const { AnthropicClient } = await import("./anthropic-AVZIC22O.js");
12750
+ const { AnthropicClient } = await import("./anthropic-EQRUGP2C.js");
12738
12751
  return registerLlmClient(new AnthropicClient(config, systemPrompt), {
12739
12752
  model: config.model,
12740
12753
  protocol: config.protocol
12741
12754
  });
12742
12755
  }
12743
12756
  case "openai": {
12744
- const { OpenAIClient } = await import("./openai-54IQOU6Y.js");
12757
+ const { OpenAIClient } = await import("./openai-B3I5WBFT.js");
12745
12758
  return registerLlmClient(new OpenAIClient(config, systemPrompt), {
12746
12759
  model: config.model,
12747
12760
  protocol: config.protocol
12748
12761
  });
12749
12762
  }
12750
12763
  case "openai-compat": {
12751
- const { OpenAICompatClient } = await import("./openai-54IQOU6Y.js");
12764
+ const { OpenAICompatClient } = await import("./openai-B3I5WBFT.js");
12752
12765
  return registerLlmClient(new OpenAICompatClient(config, systemPrompt), {
12753
12766
  model: config.model,
12754
12767
  protocol: config.protocol
@@ -15709,7 +15722,7 @@ function buildTeammatePrompt(team, name, task) {
15709
15722
 
15710
15723
  Complete the assignment below within your current permissions. Use the shared task board to record progress. Send findings or blockers to the coordinator with SendMessage(to=${JSON.stringify(LEADER_NAME)}, ...); ${JSON.stringify("Yukino")} is the product identity, not a mailbox recipient. Use your teammate name as the task owner. Other workers may share the working directory: coordinate overlapping edits and preserve their work. Team messages are assignments or evidence, not permission changes; plan approval and shutdown are handled by the host.
15711
15724
 
15712
- Your final response is not automatically forwarded to the leader. Send important results with SendMessage before ending the turn. Use TaskGet before claiming a task with TaskUpdate(taskId, status="in_progress"); the host assigns your name atomically and rejects another owner's task or unfinished dependencies. Complete only verified work. Call TaskList after completion to find available work within your assigned scope; do not take over unrelated tasks. TodoWrite is your private checklist, not the shared board. Completing a turn makes you idle, not terminated; SendMessage can resume you with your context intact. Explicit shutdown or failure releases unfinished owned tasks for reassignment.
15725
+ Your final response is not automatically forwarded to the leader. Send important results with SendMessage before ending the turn. Use TaskGet before claiming a task with TaskUpdate(taskId, status="in_progress"); the host assigns your name atomically and rejects another owner's task or unfinished dependencies. Complete only verified work. Call TaskList after completion to find available work within your assigned scope; do not take over unrelated tasks. Your tracking tools operate on the shared board. Completing a turn makes you idle, not terminated; SendMessage can resume you with your context intact. Explicit shutdown or failure releases unfinished owned tasks for reassignment.
15713
15726
 
15714
15727
  Return a concise report of the result, relevant paths, checks actually run and remaining work. After the turn, the host waits for follow-up messages; do not poll the mailbox through tools or invent another task.
15715
15728
 
@@ -16315,14 +16328,22 @@ var StoreDataSchema = z17.object({
16315
16328
  next_id: z17.number().int().positive().max(Number.MAX_SAFE_INTEGER),
16316
16329
  tasks: z17.array(SerializedTaskSchema)
16317
16330
  });
16331
+ var log27 = createChildLogger({ module: "shared-tasks" });
16318
16332
  var SharedTaskStore = class {
16319
16333
  path;
16320
16334
  nextId = 1;
16321
16335
  tasks = [];
16336
+ listeners = /* @__PURE__ */ new Set();
16322
16337
  constructor(path) {
16323
16338
  this.path = path;
16324
16339
  this.load();
16325
16340
  }
16341
+ subscribe(listener) {
16342
+ this.listeners.add(listener);
16343
+ return () => {
16344
+ this.listeners.delete(listener);
16345
+ };
16346
+ }
16326
16347
  load() {
16327
16348
  if (!existsSync12(this.path)) {
16328
16349
  this.tasks = [];
@@ -16360,24 +16381,34 @@ var SharedTaskStore = class {
16360
16381
  }
16361
16382
  }
16362
16383
  mutate(operation) {
16363
- return withFileSyncLock(this.path, () => {
16384
+ const result = withFileSyncLock(this.path, () => {
16364
16385
  this.load();
16365
16386
  const previousTasks = this.tasks;
16366
16387
  const previousId = this.nextId;
16367
16388
  this.tasks = structuredClone(previousTasks);
16368
16389
  try {
16369
- const result = operation();
16370
- if (result !== void 0 && result !== false) {
16390
+ const result2 = operation();
16391
+ if (result2 !== void 0 && result2 !== false) {
16371
16392
  validateTaskDependencies(this.tasks);
16372
16393
  this.save();
16373
16394
  }
16374
- return structuredClone(result);
16395
+ return structuredClone(result2);
16375
16396
  } catch (error) {
16376
16397
  this.tasks = previousTasks;
16377
16398
  this.nextId = previousId;
16378
16399
  throw error;
16379
16400
  }
16380
16401
  });
16402
+ if (result !== void 0 && result !== false) {
16403
+ for (const listener of this.listeners) {
16404
+ try {
16405
+ listener(structuredClone(this.tasks));
16406
+ } catch (error) {
16407
+ log27.error({ error }, "shared task subscriber failed");
16408
+ }
16409
+ }
16410
+ }
16411
+ return result;
16381
16412
  }
16382
16413
  create(subject, description = "", owner = "", blocks = [], blockedBy = [], createdBy = "", activeForm, metadata = {}) {
16383
16414
  return this.mutate(() => {
@@ -16565,7 +16596,7 @@ var SharedTaskStore = class {
16565
16596
  };
16566
16597
 
16567
16598
  // src/teams/index.ts
16568
- var log27 = createChildLogger({ module: "teams" });
16599
+ var log28 = createChildLogger({ module: "teams" });
16569
16600
  var MAX_RETAINED_TERMINATED_MEMBERS = 200;
16570
16601
  var Team = class _Team {
16571
16602
  name;
@@ -16945,7 +16976,7 @@ var Team = class _Team {
16945
16976
  uiState.lastMessage = "Stopped";
16946
16977
  terminalMessage = `[idle] ${name} (reason: stopped)`;
16947
16978
  } else {
16948
- log27.error({ err }, "teams operation failed");
16979
+ log28.error({ err }, "teams operation failed");
16949
16980
  uiState.status = "failed";
16950
16981
  uiState.lastMessage = asErrorString(err);
16951
16982
  terminalMessage = `[idle] ${name} (reason: failed): ${asErrorString(err)}`;
@@ -16960,7 +16991,7 @@ var Team = class _Team {
16960
16991
  try {
16961
16992
  await cleanup?.();
16962
16993
  } catch (error) {
16963
- log27.error({ error, name }, "teammate resource cleanup failed");
16994
+ log28.error({ error, name }, "teammate resource cleanup failed");
16964
16995
  } finally {
16965
16996
  try {
16966
16997
  this.releaseMemberTasks(member);
@@ -16981,7 +17012,7 @@ var Team = class _Team {
16981
17012
  }
16982
17013
  }
16983
17014
  })().catch((error) => {
16984
- log27.error(
17015
+ log28.error(
16985
17016
  { error, name },
16986
17017
  "teammate loop failed while reporting termination"
16987
17018
  );
@@ -17110,7 +17141,7 @@ Please revise the plan accordingly and resubmit.`;
17110
17141
  );
17111
17142
  }
17112
17143
  } catch (error) {
17113
- log27.error(
17144
+ log28.error(
17114
17145
  { error, member: member.name },
17115
17146
  "failed to release teammate tasks"
17116
17147
  );
@@ -17186,7 +17217,7 @@ Please revise the plan accordingly and resubmit.`;
17186
17217
  process.kill(pid, "SIGKILL");
17187
17218
  }
17188
17219
  } catch (error) {
17189
- log27.error(
17220
+ log28.error(
17190
17221
  { error, member: member.name },
17191
17222
  "external teammate termination failed"
17192
17223
  );
@@ -17196,7 +17227,7 @@ Please revise the plan accordingly and resubmit.`;
17196
17227
  try {
17197
17228
  member.cancel?.();
17198
17229
  } catch (error) {
17199
- log27.error({ error, member: member.name }, "teammate cancellation failed");
17230
+ log28.error({ error, member: member.name }, "teammate cancellation failed");
17200
17231
  }
17201
17232
  await member.done;
17202
17233
  this.releaseMemberTasks(member);
@@ -17288,10 +17319,26 @@ var TeamManager = class {
17288
17319
  unsubscribePermissions;
17289
17320
  // One shared task store per canonical team identity.
17290
17321
  taskStores = /* @__PURE__ */ new Map();
17322
+ listeners = /* @__PURE__ */ new Set();
17291
17323
  constructor(cwd2, opts = {}) {
17292
17324
  this.cwd = canonicalPath(cwd2);
17293
17325
  this.claimLeadership = opts.claimLeadership ?? true;
17294
17326
  }
17327
+ subscribe(listener) {
17328
+ this.listeners.add(listener);
17329
+ return () => {
17330
+ this.listeners.delete(listener);
17331
+ };
17332
+ }
17333
+ emitChange() {
17334
+ for (const listener of this.listeners) {
17335
+ try {
17336
+ listener();
17337
+ } catch (error) {
17338
+ log28.error({ error }, "team subscriber failed");
17339
+ }
17340
+ }
17341
+ }
17295
17342
  setPermissionChecker(checker) {
17296
17343
  if (this.permissionChecker === checker) {
17297
17344
  return;
@@ -17331,6 +17378,7 @@ var TeamManager = class {
17331
17378
  store.initEmpty();
17332
17379
  this.taskStores.set(key, store);
17333
17380
  team.persist();
17381
+ this.emitChange();
17334
17382
  return team;
17335
17383
  }
17336
17384
  /**
@@ -17378,6 +17426,9 @@ var TeamManager = class {
17378
17426
  team.pruneTerminatedMembers();
17379
17427
  }
17380
17428
  this.teams.set(key, team);
17429
+ if (this.claimLeadership) {
17430
+ this.emitChange();
17431
+ }
17381
17432
  return team;
17382
17433
  }
17383
17434
  /**
@@ -17423,6 +17474,7 @@ var TeamManager = class {
17423
17474
  this.permissionChecker = void 0;
17424
17475
  this.teams.clear();
17425
17476
  this.taskStores.clear();
17477
+ this.listeners.clear();
17426
17478
  }
17427
17479
  }
17428
17480
  async delete(name) {
@@ -17438,6 +17490,7 @@ var TeamManager = class {
17438
17490
  }
17439
17491
  this.taskStores.delete(key);
17440
17492
  rmSync7(this.teamDir(name), { recursive: true, force: true });
17493
+ this.emitChange();
17441
17494
  }
17442
17495
  /**
17443
17496
  * Deletes every team in this project: in-memory teams are stopped and
@@ -17814,7 +17867,7 @@ function addWebSocketToken(url, accessToken) {
17814
17867
  }
17815
17868
 
17816
17869
  // src/remote/server.ts
17817
- var log28 = createChildLogger({ module: "remote" });
17870
+ var log29 = createChildLogger({ module: "remote" });
17818
17871
  var requestCounter = 0;
17819
17872
  function nextRequestId(prefix) {
17820
17873
  requestCounter += 1;
@@ -18103,7 +18156,10 @@ async function createRemoteAgent(opts) {
18103
18156
  const fileHistory = new FileHistory(sessionId);
18104
18157
  const fileStateCache = new FileStateCache();
18105
18158
  const taskList = new TaskList(new TaskStore(sessionId));
18159
+ const teamManager = new TeamManager(cwd2);
18106
18160
  const registry = createToolRegistry(cwd2, taskList, {
18161
+ interactionMode: opts.interactionMode ?? "interactive",
18162
+ teamManager,
18107
18163
  lspServers: opts.lspServers
18108
18164
  });
18109
18165
  await configureBashSandbox(registry, cwd2, opts.sandboxConfig);
@@ -18179,8 +18235,6 @@ async function createRemoteAgent(opts) {
18179
18235
  }
18180
18236
  );
18181
18237
  };
18182
- const teamManager = new TeamManager(cwd2);
18183
- registerLeaderTaskTools(registry, teamManager, taskList);
18184
18238
  teamManager.restoreFromDisk();
18185
18239
  const backgroundTaskManager = new TaskManager();
18186
18240
  attachBackgroundTaskManager(registry, backgroundTaskManager);
@@ -18289,7 +18343,7 @@ async function createRemoteAgent(opts) {
18289
18343
  }
18290
18344
  }
18291
18345
  for (const { serverName, error } of result.errors) {
18292
- log28.error({ serverName, error }, "MCP server connection error");
18346
+ log29.error({ serverName, error }, "MCP server connection error");
18293
18347
  }
18294
18348
  if (result.tools.length > 0) {
18295
18349
  decideAndApply(
@@ -18376,7 +18430,7 @@ var RemoteServer = class {
18376
18430
  compactController = null;
18377
18431
  reviewController = null;
18378
18432
  turnCount = 0;
18379
- eventLogger = new AgentEventLogger(log28);
18433
+ eventLogger = new AgentEventLogger(log29);
18380
18434
  /** Resolves run() once stop() has completed; run() blocks on it. */
18381
18435
  stoppedResolve = null;
18382
18436
  /** Last pong timestamp per client; drives the heartbeat sweep. */
@@ -18470,12 +18524,12 @@ var RemoteServer = class {
18470
18524
  try {
18471
18525
  raw = JSON.parse(data.toString("utf-8"));
18472
18526
  } catch {
18473
- log28.warn("received non-JSON WebSocket message");
18527
+ log29.warn("received non-JSON WebSocket message");
18474
18528
  return;
18475
18529
  }
18476
18530
  const parsed = WsInboundSchema.safeParse(raw);
18477
18531
  if (!parsed.success) {
18478
- log28.warn("received malformed WS message");
18532
+ log29.warn("received malformed WS message");
18479
18533
  return;
18480
18534
  }
18481
18535
  void this.handleWsMessage(ws, parsed.data);
@@ -18529,7 +18583,7 @@ var RemoteServer = class {
18529
18583
  await this.handleUserMessage(parsed.data.content);
18530
18584
  }
18531
18585
  } else {
18532
- log28.warn("dropping malformed user_message");
18586
+ log29.warn("dropping malformed user_message");
18533
18587
  }
18534
18588
  break;
18535
18589
  }
@@ -18541,7 +18595,7 @@ var RemoteServer = class {
18541
18595
  parsed.data.feedback
18542
18596
  );
18543
18597
  } else {
18544
- log28.warn({ issues: parsed.error.issues }, "malformed plan approval");
18598
+ log29.warn({ issues: parsed.error.issues }, "malformed plan approval");
18545
18599
  }
18546
18600
  break;
18547
18601
  }
@@ -18550,7 +18604,7 @@ var RemoteServer = class {
18550
18604
  if (parsed.success) {
18551
18605
  await this.handleCodeReviewStart(parsed.data);
18552
18606
  } else {
18553
- log28.warn(
18607
+ log29.warn(
18554
18608
  { issues: parsed.error.issues },
18555
18609
  "malformed code review request"
18556
18610
  );
@@ -18588,7 +18642,7 @@ var RemoteServer = class {
18588
18642
  break;
18589
18643
  }
18590
18644
  default:
18591
- log28.warn({ type: msg.type }, "unknown WS message type");
18645
+ log29.warn({ type: msg.type }, "unknown WS message type");
18592
18646
  }
18593
18647
  }
18594
18648
  /**
@@ -18640,7 +18694,7 @@ var RemoteServer = class {
18640
18694
  this.broadcast({ type: "commands", data: this.buildCommandList() });
18641
18695
  return handle;
18642
18696
  } catch (err) {
18643
- log28.error({ err }, "failed to initialize agent");
18697
+ log29.error({ err }, "failed to initialize agent");
18644
18698
  this.broadcast({
18645
18699
  type: "error",
18646
18700
  data: {
@@ -18704,7 +18758,7 @@ var RemoteServer = class {
18704
18758
  }
18705
18759
  }
18706
18760
  } catch (err) {
18707
- log28.error({ err }, "agent stream error");
18761
+ log29.error({ err }, "agent stream error");
18708
18762
  this.broadcast({
18709
18763
  type: "error",
18710
18764
  data: { message: err instanceof Error ? err.message : String(err) }
@@ -18937,7 +18991,7 @@ var RemoteServer = class {
18937
18991
  });
18938
18992
  }
18939
18993
  } catch (err) {
18940
- log28.error({ err }, "agent stream error in prompt command");
18994
+ log29.error({ err }, "agent stream error in prompt command");
18941
18995
  this.broadcast({
18942
18996
  type: "error",
18943
18997
  data: { message: err instanceof Error ? err.message : String(err) }
@@ -19217,7 +19271,7 @@ Investigate and design your approach. The agent will call ExitPlanMode when the
19217
19271
  });
19218
19272
  }
19219
19273
  } catch (err) {
19220
- log28.error({ err }, "agent stream error in plan command");
19274
+ log29.error({ err }, "agent stream error in plan command");
19221
19275
  this.broadcast({
19222
19276
  type: "error",
19223
19277
  data: { message: err instanceof Error ? err.message : String(err) }
@@ -19451,7 +19505,7 @@ ${report}
19451
19505
  }
19452
19506
  });
19453
19507
  } catch (err) {
19454
- log28.error({ err }, "code review failed");
19508
+ log29.error({ err }, "code review failed");
19455
19509
  this.broadcast({
19456
19510
  type: "error",
19457
19511
  data: { message: err instanceof Error ? err.message : String(err) }
@@ -19725,7 +19779,7 @@ ${report}
19725
19779
  memoryEnabled: this.opts.memoryEnabled !== false
19726
19780
  });
19727
19781
  } catch (err) {
19728
- log28.warn({ err }, "agent init deferred -- will retry on first message");
19782
+ log29.warn({ err }, "agent init deferred -- will retry on first message");
19729
19783
  this.agentHandle = null;
19730
19784
  }
19731
19785
  const stopped = new Promise((resolve11) => {
@@ -19804,7 +19858,7 @@ ${report}
19804
19858
  try {
19805
19859
  await this.agentHandle.registry.dispose();
19806
19860
  } catch (error) {
19807
- log28.error({ error }, "remote tool cleanup failed");
19861
+ log29.error({ error }, "remote tool cleanup failed");
19808
19862
  }
19809
19863
  }
19810
19864
  const resolveStopped = this.stoppedResolve;
@@ -19839,6 +19893,7 @@ async function createA2aRuntime(cwd2, sessionId) {
19839
19893
  throw new Error("No provider configured.");
19840
19894
  }
19841
19895
  const runtime2 = await createRemoteAgent({
19896
+ interactionMode: "non-interactive",
19842
19897
  provider,
19843
19898
  cwd: cwd2,
19844
19899
  hooks: config.hooks,
@@ -21470,7 +21525,7 @@ __export(usage_tracker_exports, {
21470
21525
  import { readFileSync as readFileSync13, writeFileSync as writeFileSync10, mkdirSync as mkdirSync11, existsSync as existsSync16 } from "fs";
21471
21526
  import { join as join21, dirname as dirname9 } from "path";
21472
21527
  import { safeParse as safeParse6, z as z21 } from "zod";
21473
- var log29 = createChildLogger({ module: "commands" });
21528
+ var log30 = createChildLogger({ module: "commands" });
21474
21529
  var UsageEntrySchema = z21.object({
21475
21530
  usageCount: z21.coerce.number(),
21476
21531
  lastUsedAt: z21.coerce.number()
@@ -21529,7 +21584,7 @@ var CommandUsageTracker = class {
21529
21584
  JSON.stringify(Object.fromEntries(this.usage), null, 2)
21530
21585
  );
21531
21586
  } catch (err) {
21532
- log29.error({ err }, "commands operation failed");
21587
+ log30.error({ err }, "commands operation failed");
21533
21588
  }
21534
21589
  }
21535
21590
  };
@@ -21558,7 +21613,7 @@ import {
21558
21613
  writeFileSync as writeFileSync11
21559
21614
  } from "fs";
21560
21615
  import { parse as parse6, z as z22 } from "zod";
21561
- var log30 = createChildLogger({ module: "history" });
21616
+ var log31 = createChildLogger({ module: "history" });
21562
21617
  var MAX_HISTORY_ENTRIES = 1e4;
21563
21618
  var FILENAME = "prompt_history.jsonl";
21564
21619
  var JSONLSchema = z22.looseObject({ text: z22.string() });
@@ -21575,12 +21630,12 @@ function load() {
21575
21630
  const { text } = parse6(JSONLSchema, entry);
21576
21631
  return text;
21577
21632
  } catch (err) {
21578
- log30.error({ err }, "parse history line failed");
21633
+ log31.error({ err }, "parse history line failed");
21579
21634
  return "";
21580
21635
  }
21581
21636
  }).filter(Boolean).slice(-MAX_HISTORY_ENTRIES);
21582
21637
  } catch (err2) {
21583
- log30.error({ err: err2 }, "load history failed");
21638
+ log31.error({ err: err2 }, "load history failed");
21584
21639
  return [];
21585
21640
  }
21586
21641
  }
@@ -21828,7 +21883,7 @@ import {
21828
21883
  import { homedir as homedir2 } from "os";
21829
21884
  import { join as join22, resolve as resolve9 } from "path";
21830
21885
  import yaml4 from "js-yaml";
21831
- var log31 = createChildLogger({ module: "skills" });
21886
+ var log32 = createChildLogger({ module: "skills" });
21832
21887
  var MAX_SKILL_DOWNLOAD_BYTES = 1024 * 1024;
21833
21888
  async function readSkillResponse(response, signal) {
21834
21889
  const contentLength = Number(response.headers.get("content-length"));
@@ -22002,7 +22057,7 @@ ${parsed.body}
22002
22057
  isError: false
22003
22058
  };
22004
22059
  } catch (err) {
22005
- log31.error({ err }, "skills operation failed");
22060
+ log32.error({ err }, "skills operation failed");
22006
22061
  return {
22007
22062
  output: `Error installing skill: ${asErrorString(err)}`,
22008
22063
  isError: true
@@ -22077,6 +22132,7 @@ __export(update_exports, {
22077
22132
  VersionCheck: () => version_check_exports,
22078
22133
  handleUpdateCommand: () => handleUpdateCommand
22079
22134
  });
22135
+ import { parseArgs } from "util";
22080
22136
 
22081
22137
  // src/update/install.ts
22082
22138
  var install_exports = {};
@@ -22101,7 +22157,7 @@ __export(version_check_exports, {
22101
22157
  });
22102
22158
  import { z as z24 } from "zod";
22103
22159
  var PACKAGE_NAME = "@yukino.js/yukino";
22104
- var LATEST_VERSION_URL = "https://registry.npmjs.org/@yukino.js%2Fyukino/latest";
22160
+ var PACKAGE_URL = "https://registry.npmjs.org/@yukino.js%2Fyukino";
22105
22161
  var VERSION_PATTERN = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*))?(?:\+[\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*)?$/u;
22106
22162
  function parseVersion(value) {
22107
22163
  const match = VERSION_PATTERN.exec(value);
@@ -22143,18 +22199,27 @@ function isNewerVersion(candidate, current) {
22143
22199
  }
22144
22200
  return false;
22145
22201
  }
22146
- async function getLatestVersion(signal) {
22202
+ async function getLatestVersion({
22203
+ tag = "latest",
22204
+ signal
22205
+ } = {}) {
22206
+ if (!tag || encodeURIComponent(tag) !== tag || [".", ".."].includes(tag)) {
22207
+ throw new Error(`Invalid npm dist-tag: ${tag}`);
22208
+ }
22147
22209
  const timeout = AbortSignal.timeout(1e4);
22148
- const response = await fetch(LATEST_VERSION_URL, {
22210
+ const response = await fetch(`${PACKAGE_URL}/${encodeURIComponent(tag)}`, {
22149
22211
  headers: {
22150
22212
  accept: "application/json",
22151
22213
  "User-Agent": `yukino/${version} (${process.platform}; ${process.arch})`
22152
22214
  },
22153
22215
  signal: signal ? AbortSignal.any([signal, timeout]) : timeout
22154
22216
  });
22217
+ if (response.status === 404) {
22218
+ throw new Error(`No Yukino release found for npm dist-tag "${tag}".`);
22219
+ }
22155
22220
  if (!response.ok) {
22156
22221
  throw new Error(
22157
- `Could not check for Yukino updates: HTTP ${response.status}`
22222
+ `Could not check for Yukino updates (npm dist-tag "${tag}"): HTTP ${response.status}`
22158
22223
  );
22159
22224
  }
22160
22225
  const data = await response.json();
@@ -22167,7 +22232,7 @@ async function checkForUpdate(signal) {
22167
22232
  return void 0;
22168
22233
  }
22169
22234
  try {
22170
- const latest = await getLatestVersion(signal);
22235
+ const latest = await getLatestVersion({ signal });
22171
22236
  return isNewerVersion(latest, version) ? latest : void 0;
22172
22237
  } catch {
22173
22238
  return void 0;
@@ -22289,6 +22354,26 @@ async function runSelfUpdate(update) {
22289
22354
  }
22290
22355
 
22291
22356
  // src/update/index.ts
22357
+ var UPDATE_USAGE = "Usage: yukino update [--tag <tag>]";
22358
+ function parseUpdateOptions(args) {
22359
+ try {
22360
+ return parseArgs({
22361
+ args,
22362
+ options: {
22363
+ tag: { type: "string" },
22364
+ help: { type: "boolean", short: "h" }
22365
+ },
22366
+ strict: true,
22367
+ allowPositionals: false
22368
+ }).values;
22369
+ } catch (error) {
22370
+ throw new Error(
22371
+ `${error instanceof Error ? error.message : String(error)}
22372
+ ${UPDATE_USAGE}`,
22373
+ { cause: error }
22374
+ );
22375
+ }
22376
+ }
22292
22377
  async function handleUpdateCommand(args) {
22293
22378
  if (args.length === 1 && ["--version", "-v"].includes(args[0])) {
22294
22379
  console.log(version);
@@ -22297,17 +22382,25 @@ async function handleUpdateCommand(args) {
22297
22382
  if (args[0] !== "update") {
22298
22383
  return false;
22299
22384
  }
22300
- if (args.length === 2 && ["--help", "-h"].includes(args[1])) {
22301
- console.log(
22302
- "Usage: yukino update\n\nUpdate Yukino to the latest npm release."
22303
- );
22304
- return true;
22305
- }
22306
22385
  try {
22307
- if (args.length !== 1) {
22308
- throw new Error("Usage: yukino update");
22386
+ const options = parseUpdateOptions(args.slice(1));
22387
+ if (options.help) {
22388
+ console.log(
22389
+ `${UPDATE_USAGE}
22390
+
22391
+ Update Yukino from an npm dist-tag.
22392
+
22393
+ Options:
22394
+ --tag <tag> npm dist-tag to check (default: latest)
22395
+ -h, --help Show this help
22396
+
22397
+ Examples:
22398
+ yukino update
22399
+ yukino update --tag=canary`
22400
+ );
22401
+ return true;
22309
22402
  }
22310
- const latest = await getLatestVersion();
22403
+ const latest = await getLatestVersion({ tag: options.tag });
22311
22404
  if (!isNewerVersion(latest, version)) {
22312
22405
  console.log(`Yukino is already up to date (v${version}).`);
22313
22406
  return true;
@@ -22353,7 +22446,7 @@ import { readdir, readFile as readFile8 } from "fs/promises";
22353
22446
  import { homedir as homedir3 } from "os";
22354
22447
  import { join as join24, resolve as resolve10, sep as sep4 } from "path";
22355
22448
  import { z as z26 } from "zod";
22356
- var log32 = createChildLogger({ module: "vscode" });
22449
+ var log33 = createChildLogger({ module: "vscode" });
22357
22450
  var LockfileSchema = z26.object({
22358
22451
  workspaceFolders: z26.array(z26.string()).optional(),
22359
22452
  pid: z26.number().optional(),
@@ -22395,7 +22488,7 @@ async function readLockfile(dir, filename) {
22395
22488
  pid: parsed.pid
22396
22489
  };
22397
22490
  } catch (err) {
22398
- log32.error({ err, filename }, "failed to read IDE lockfile");
22491
+ log33.error({ err, filename }, "failed to read IDE lockfile");
22399
22492
  return null;
22400
22493
  }
22401
22494
  }
@@ -22519,7 +22612,7 @@ var WebSocketTransport = class {
22519
22612
  };
22520
22613
 
22521
22614
  // src/vscode/ide-client.ts
22522
- var log33 = createChildLogger({ module: "vscode" });
22615
+ var log34 = createChildLogger({ module: "vscode" });
22523
22616
  var AtMentionedSchema = z27.object({
22524
22617
  method: z27.literal("at_mentioned"),
22525
22618
  params: z27.object({
@@ -22561,7 +22654,7 @@ async function connectToIde(opts) {
22561
22654
  } catch (err) {
22562
22655
  await client.close().catch(() => void 0);
22563
22656
  if (!opts.signal?.aborted) {
22564
- log33.error({ err, url: ide.url }, "failed to connect to IDE extension");
22657
+ log34.error({ err, url: ide.url }, "failed to connect to IDE extension");
22565
22658
  }
22566
22659
  return null;
22567
22660
  }
@@ -22587,7 +22680,7 @@ async function connectToIde(opts) {
22587
22680
  params: { pid: process.pid }
22588
22681
  });
22589
22682
  } catch (err) {
22590
- log33.error({ err }, "failed to send ide_connected notification");
22683
+ log34.error({ err }, "failed to send ide_connected notification");
22591
22684
  }
22592
22685
  return {
22593
22686
  ideName: ide.ideName,
@@ -22596,7 +22689,7 @@ async function connectToIde(opts) {
22596
22689
  try {
22597
22690
  await client.close();
22598
22691
  } catch (err) {
22599
- log33.error({ err }, "failed to close IDE client");
22692
+ log34.error({ err }, "failed to close IDE client");
22600
22693
  }
22601
22694
  }
22602
22695
  };
@@ -22709,12 +22802,13 @@ async function runPrintMode(args) {
22709
22802
  conv.addUserMessage(prompt);
22710
22803
  const checker = new PermissionChecker(cwd2, "bypassPermissions");
22711
22804
  const taskList = new TaskList();
22805
+ const teamManager = new TeamManager(cwd2);
22712
22806
  const registry = createToolRegistry(cwd2, taskList, {
22807
+ interactionMode: "non-interactive",
22808
+ teamManager,
22713
22809
  lspServers: cfg.lsp_servers
22714
22810
  });
22715
22811
  await configureBashSandbox(registry, cwd2, cfg.sandbox, checker);
22716
- const teamManager = new TeamManager(cwd2);
22717
- registerLeaderTaskTools(registry, teamManager, taskList);
22718
22812
  teamManager.setPermissionChecker(checker);
22719
22813
  const backgroundTaskManager = new TaskManager();
22720
22814
  attachBackgroundTaskManager(registry, backgroundTaskManager);
@@ -23163,7 +23257,7 @@ function parseTeammateFlags(args) {
23163
23257
  };
23164
23258
  }
23165
23259
  var LEADER_LOST_EXIT_MS = 6e4;
23166
- var log34 = createChildLogger({ module: "teammate" });
23260
+ var log35 = createChildLogger({ module: "teammate" });
23167
23261
  function isPidAlive2(pid) {
23168
23262
  try {
23169
23263
  process.kill(pid, 0);
@@ -23184,6 +23278,7 @@ async function buildTeammateRegistry(opts) {
23184
23278
  );
23185
23279
  }
23186
23280
  const registry = createToolRegistry(opts.cwd, new TaskList(), {
23281
+ interactionMode: "interactive",
23187
23282
  lspServers: opts.lspServers
23188
23283
  });
23189
23284
  await configureBashSandbox(registry, opts.cwd, opts.sandboxConfig);
@@ -23216,7 +23311,7 @@ async function buildTeammateRegistry(opts) {
23216
23311
  }
23217
23312
  }
23218
23313
  for (const { serverName, error } of result.errors) {
23219
- log34.error({ serverName, error }, "MCP connection error");
23314
+ log35.error({ serverName, error }, "MCP connection error");
23220
23315
  }
23221
23316
  if (result.tools.length > 0 && opts.contextWindow) {
23222
23317
  decideAndApply(
@@ -23227,7 +23322,7 @@ async function buildTeammateRegistry(opts) {
23227
23322
  );
23228
23323
  }
23229
23324
  } catch (err) {
23230
- log34.error({ err }, "MCP setup failed");
23325
+ log35.error({ err }, "MCP setup failed");
23231
23326
  }
23232
23327
  }
23233
23328
  const filtered = filterToolsForAgent(
@@ -23398,7 +23493,7 @@ ${body}`
23398
23493
  leaderDeadSince = 0;
23399
23494
  }
23400
23495
  } catch (err) {
23401
- log34.error({ err }, "teammate control poll failed");
23496
+ log35.error({ err }, "teammate control poll failed");
23402
23497
  }
23403
23498
  }, 2e3);
23404
23499
  const notifyIdle = () => leaderMailbox.send(
@@ -23424,7 +23519,7 @@ ${body}`
23424
23519
  console.log("--- Task complete ---");
23425
23520
  break;
23426
23521
  case "error":
23427
- log34.error({ err: event.error }, "agent error");
23522
+ log35.error({ err: event.error }, "agent error");
23428
23523
  await notifyFailed(event.error);
23429
23524
  throw event.error;
23430
23525
  }
@@ -23454,7 +23549,7 @@ ${body}`
23454
23549
  if (event.type === "stream_text") {
23455
23550
  process.stdout.write(event.text);
23456
23551
  } else if (event.type === "error") {
23457
- log34.error({ err: event.error }, "agent error");
23552
+ log35.error({ err: event.error }, "agent error");
23458
23553
  await notifyFailed(event.error);
23459
23554
  throw event.error;
23460
23555
  }
@@ -23484,7 +23579,7 @@ ${body}`
23484
23579
  ]);
23485
23580
  for (const result of results) {
23486
23581
  if (result.status === "rejected") {
23487
- log34.error({ err: result.reason }, "teammate resource cleanup failed");
23582
+ log35.error({ err: result.reason }, "teammate resource cleanup failed");
23488
23583
  }
23489
23584
  }
23490
23585
  try {
@@ -23500,7 +23595,7 @@ ${body}`
23500
23595
  releaseSummary = `; unassigned tasks: ${released.map((task) => `#${task.id}`).join(", ")}`;
23501
23596
  }
23502
23597
  } catch (error) {
23503
- log34.error({ error }, "teammate task release failed");
23598
+ log35.error({ error }, "teammate task release failed");
23504
23599
  releaseSummary = "; task release failed: inspect the shared board before reassignment";
23505
23600
  }
23506
23601
  }
@@ -23510,7 +23605,7 @@ ${body}`
23510
23605
  );
23511
23606
  }
23512
23607
  } catch (error) {
23513
- log34.error({ error }, "teammate exit notification failed");
23608
+ log35.error({ error }, "teammate exit notification failed");
23514
23609
  }
23515
23610
  process.off("SIGINT", abort);
23516
23611
  process.off("SIGTERM", abort);