@yukino.js/yukino 0.0.6 → 0.0.7

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.
@@ -4,8 +4,8 @@ import {
4
4
  markLastUserTailForCache,
5
5
  markToolsForCache,
6
6
  needsToolSearchBeta
7
- } from "./chunk-D3SXNTPZ.js";
8
- import "./chunk-3ONNRNKQ.js";
7
+ } from "./chunk-EO23VPDZ.js";
8
+ import "./chunk-HE4RUUZP.js";
9
9
  import "./chunk-MLKGABMK.js";
10
10
  export {
11
11
  AnthropicClient,
@@ -22,7 +22,7 @@ import {
22
22
  thinkingBudgetForLevel,
23
23
  toAnthropicThinkingEffort,
24
24
  toReasoningEffort
25
- } from "./chunk-3ONNRNKQ.js";
25
+ } from "./chunk-HE4RUUZP.js";
26
26
  import {
27
27
  __export
28
28
  } from "./chunk-MLKGABMK.js";
@@ -658,6 +658,7 @@ var provider_login_exports = {};
658
658
  __export(provider_login_exports, {
659
659
  ProviderLoginSchema: () => ProviderLoginSchema,
660
660
  persistDefaultProvider: () => persistDefaultProvider,
661
+ persistModel: () => persistModel,
661
662
  persistThinkingLevel: () => persistThinkingLevel,
662
663
  saveProvider: () => saveProvider
663
664
  });
@@ -757,7 +758,7 @@ function saveProvider(input, available) {
757
758
  writeConfigAtomic(path, { ...config, providers: stored });
758
759
  return { provider, providers, replaced, path };
759
760
  }
760
- function persistThinkingLevel(baseUrl, level) {
761
+ function persistProviderField(baseUrl, field, value) {
761
762
  const path = globalConfigPath();
762
763
  const config = readConfigRaw(path);
763
764
  const providers = z2.array(z2.record(z2.string(), z2.unknown())).parse(config.providers ?? []);
@@ -767,15 +768,21 @@ function persistThinkingLevel(baseUrl, level) {
767
768
  `Provider with base URL "${baseUrl}" not found in ${path}.`
768
769
  );
769
770
  }
770
- const changed = targets.filter((entry) => entry.thinking !== level);
771
+ const changed = targets.filter((entry) => entry[field] !== value);
771
772
  if (changed.length === 0) {
772
773
  return;
773
774
  }
774
775
  for (const entry of changed) {
775
- entry.thinking = level;
776
+ entry[field] = value;
776
777
  }
777
778
  writeConfigAtomic(path, { ...config, providers });
778
779
  }
780
+ function persistThinkingLevel(baseUrl, level) {
781
+ persistProviderField(baseUrl, "thinking", level);
782
+ }
783
+ function persistModel(baseUrl, model) {
784
+ persistProviderField(baseUrl, "model", model);
785
+ }
779
786
  function persistDefaultProvider(index) {
780
787
  const path = globalConfigPath();
781
788
  const config = readConfigRaw(path);
@@ -19,7 +19,7 @@ import {
19
19
  resolveAPIKey,
20
20
  strArg,
21
21
  toReasoningEffort
22
- } from "./chunk-3ONNRNKQ.js";
22
+ } from "./chunk-HE4RUUZP.js";
23
23
  import {
24
24
  __export
25
25
  } from "./chunk-MLKGABMK.js";
@@ -52,7 +52,7 @@ var PackageJsonSchema = z.object({
52
52
  });
53
53
  function resolveVersion() {
54
54
  if (true) {
55
- return "0.0.6";
55
+ return "0.0.7";
56
56
  }
57
57
  const here = path.dirname(fileURLToPath(import.meta.url));
58
58
  for (const levels of ["..", "../.."]) {
@@ -1626,12 +1626,10 @@ declare function saveProvider(input: unknown, available: ProviderConfig[]): {
1626
1626
  replaced: boolean;
1627
1627
  path: string;
1628
1628
  };
1629
- /**
1630
- * Persist a provider's thinking level to the global config. `base_url` is the
1631
- * provider identity, so every entry for that endpoint is updated. Throws when
1632
- * the endpoint is absent so callers can surface a clear error.
1633
- */
1629
+ /** Persist a provider's thinking level to the global config. */
1634
1630
  declare function persistThinkingLevel(baseUrl: string, level: ThinkingLevel): void;
1631
+ /** Persist the active model of a provider without touching any other field. */
1632
+ declare function persistModel(baseUrl: string, model: string): void;
1635
1633
  /**
1636
1634
  * Persist the index (into the config's providers array) of the provider the
1637
1635
  * user selected last, so the next start selects it directly instead of showing
@@ -1642,10 +1640,11 @@ declare function persistDefaultProvider(index: number): void;
1642
1640
 
1643
1641
  declare const providerLogin_ProviderLoginSchema: typeof ProviderLoginSchema;
1644
1642
  declare const providerLogin_persistDefaultProvider: typeof persistDefaultProvider;
1643
+ declare const providerLogin_persistModel: typeof persistModel;
1645
1644
  declare const providerLogin_persistThinkingLevel: typeof persistThinkingLevel;
1646
1645
  declare const providerLogin_saveProvider: typeof saveProvider;
1647
1646
  declare namespace providerLogin {
1648
- export { providerLogin_ProviderLoginSchema as ProviderLoginSchema, providerLogin_persistDefaultProvider as persistDefaultProvider, providerLogin_persistThinkingLevel as persistThinkingLevel, providerLogin_saveProvider as saveProvider };
1647
+ export { providerLogin_ProviderLoginSchema as ProviderLoginSchema, providerLogin_persistDefaultProvider as persistDefaultProvider, providerLogin_persistModel as persistModel, providerLogin_persistThinkingLevel as persistThinkingLevel, providerLogin_saveProvider as saveProvider };
1649
1648
  }
1650
1649
 
1651
1650
  /**
@@ -2715,7 +2714,14 @@ declare namespace exitCleanup {
2715
2714
  */
2716
2715
  interface InteractionSummary {
2717
2716
  agentActiveMs: number;
2717
+ /** Prompt tokens written to the provider's cache. */
2718
+ cacheCreationTokens: number;
2719
+ /** Prompt tokens served from the provider's cache. */
2720
+ cacheReadTokens: number;
2718
2721
  failedToolCalls: number;
2722
+ /** Uncached prompt tokens; the cached prefix is counted separately. */
2723
+ inputTokens: number;
2724
+ outputTokens: number;
2719
2725
  sessionId: string;
2720
2726
  startedAt: number;
2721
2727
  successfulToolCalls: number;
package/dist/lib/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  providers_exports,
3
3
  version,
4
4
  version_exports
5
- } from "./chunk-CBBSDV2D.js";
5
+ } from "./chunk-TKCJSTWI.js";
6
6
  import {
7
7
  MCPToolWrapper,
8
8
  MCP_TOOL_PREFIX,
@@ -16,10 +16,10 @@ import {
16
16
  strategy_exports,
17
17
  tool_wrapper_exports,
18
18
  types_exports
19
- } from "./chunk-D3SXNTPZ.js";
19
+ } from "./chunk-EO23VPDZ.js";
20
20
  import {
21
21
  openai_exports
22
- } from "./chunk-RVSLQCZ5.js";
22
+ } from "./chunk-PEV5NGQ2.js";
23
23
  import {
24
24
  ContextTooLongError,
25
25
  DEFAULT_CONTEXT_WINDOW,
@@ -61,7 +61,7 @@ import {
61
61
  strList,
62
62
  utils_exports,
63
63
  withProjectMcpServers
64
- } from "./chunk-3ONNRNKQ.js";
64
+ } from "./chunk-HE4RUUZP.js";
65
65
  import {
66
66
  ToolRegistry,
67
67
  cloneRegistryForTeammate,
@@ -1741,7 +1741,7 @@ async function initializeTelemetry() {
1741
1741
  if (!shouldInitialize()) {
1742
1742
  return;
1743
1743
  }
1744
- initialization = import("./providers-YHVXG3PP.js").then(async ({ createTelemetryRuntime }) => {
1744
+ initialization = import("./providers-2X5JB2JX.js").then(async ({ createTelemetryRuntime }) => {
1745
1745
  runtime = await createTelemetryRuntime();
1746
1746
  runtime.setMode(mode);
1747
1747
  process.once("beforeExit", () => {
@@ -12232,21 +12232,21 @@ __export(client_exports, {
12232
12232
  async function createClient(config, systemPrompt) {
12233
12233
  switch (config.protocol) {
12234
12234
  case "anthropic": {
12235
- const { AnthropicClient } = await import("./anthropic-GAD2PGEN.js");
12235
+ const { AnthropicClient } = await import("./anthropic-CDPTNR5L.js");
12236
12236
  return registerLlmClient(new AnthropicClient(config, systemPrompt), {
12237
12237
  model: config.model,
12238
12238
  protocol: config.protocol
12239
12239
  });
12240
12240
  }
12241
12241
  case "openai": {
12242
- const { OpenAIClient } = await import("./openai-BYOGAZU5.js");
12242
+ const { OpenAIClient } = await import("./openai-TEFKPV7T.js");
12243
12243
  return registerLlmClient(new OpenAIClient(config, systemPrompt), {
12244
12244
  model: config.model,
12245
12245
  protocol: config.protocol
12246
12246
  });
12247
12247
  }
12248
12248
  case "openai-compat": {
12249
- const { OpenAICompatClient } = await import("./openai-BYOGAZU5.js");
12249
+ const { OpenAICompatClient } = await import("./openai-TEFKPV7T.js");
12250
12250
  return registerLlmClient(new OpenAICompatClient(config, systemPrompt), {
12251
12251
  model: config.model,
12252
12252
  protocol: config.protocol
@@ -12744,6 +12744,12 @@ function createDefaultRegistry() {
12744
12744
  description: "Configure, save, and activate LLM provider",
12745
12745
  handler: () => "login"
12746
12746
  });
12747
+ registry.register({
12748
+ name: "model",
12749
+ type: "local_ui",
12750
+ description: "Switch the model of the current provider",
12751
+ handler: () => "model"
12752
+ });
12747
12753
  registry.register({
12748
12754
  name: "help",
12749
12755
  type: "local",
@@ -19464,6 +19470,15 @@ var RemoteServer = class {
19464
19470
  });
19465
19471
  this.broadcast({ type: "command_done", data: null });
19466
19472
  break;
19473
+ case "model":
19474
+ this.broadcast({
19475
+ type: "system",
19476
+ data: {
19477
+ message: "Model selection is only available in terminal mode. The remote server keeps the model it was started with."
19478
+ }
19479
+ });
19480
+ this.broadcast({ type: "command_done", data: null });
19481
+ break;
19467
19482
  case "resume":
19468
19483
  this.handleResume(args);
19469
19484
  break;
@@ -20795,6 +20810,16 @@ function formatDuration(milliseconds) {
20795
20810
  const remainder = seconds % 60;
20796
20811
  return `${String(minutes)}m ${String(remainder)}s`;
20797
20812
  }
20813
+ function formatTokens2(value) {
20814
+ const tokens = Math.max(0, Math.round(value));
20815
+ if (tokens < 1e3) {
20816
+ return String(tokens);
20817
+ }
20818
+ if (tokens < 1e6) {
20819
+ return `${(tokens / 1e3).toFixed(tokens >= 1e4 ? 0 : 1)}k`;
20820
+ }
20821
+ return `${(tokens / 1e6).toFixed(1)}M`;
20822
+ }
20798
20823
  function percentage(value, total) {
20799
20824
  return `${(total > 0 ? value / total * 100 : 0).toFixed(1)}%`;
20800
20825
  }
@@ -20805,6 +20830,8 @@ function formatInteractionSummary(summary, endedAt = Date.now()) {
20805
20830
  const totalToolCalls = summary.successfulToolCalls + summary.failedToolCalls;
20806
20831
  const apiTimeMs = Math.max(0, summary.agentActiveMs - summary.toolTimeMs);
20807
20832
  const successRate = totalToolCalls > 0 ? summary.successfulToolCalls / totalToolCalls * 100 : 0;
20833
+ const promptTokens = summary.inputTokens + summary.cacheReadTokens + summary.cacheCreationTokens;
20834
+ const cacheHitRate = percentage(summary.cacheReadTokens, promptTokens);
20808
20835
  return [
20809
20836
  " Interaction Summary",
20810
20837
  field("Session ID", summary.sessionId),
@@ -20826,6 +20853,16 @@ function formatInteractionSummary(summary, endedAt = Date.now()) {
20826
20853
  `${formatDuration(summary.toolTimeMs)} (${percentage(summary.toolTimeMs, summary.agentActiveMs)})`
20827
20854
  ),
20828
20855
  "",
20856
+ " Tokens",
20857
+ field("Input", formatTokens2(summary.inputTokens)),
20858
+ field(" > Cache Read", formatTokens2(summary.cacheReadTokens)),
20859
+ field(" > Cache Write", formatTokens2(summary.cacheCreationTokens)),
20860
+ field("Output", formatTokens2(summary.outputTokens)),
20861
+ field(
20862
+ "Cache Hit",
20863
+ `${cacheHitRate} (${formatTokens2(summary.cacheReadTokens)} of ${formatTokens2(promptTokens)} prompt)`
20864
+ ),
20865
+ "",
20829
20866
  ` To resume this session: yukino --resume ${summary.sessionId}`
20830
20867
  ].join("\n");
20831
20868
  }
@@ -3,8 +3,8 @@ import {
3
3
  OpenAICompatClient,
4
4
  buildChatCompletionMessages,
5
5
  buildOpenAIInput
6
- } from "./chunk-RVSLQCZ5.js";
7
- import "./chunk-3ONNRNKQ.js";
6
+ } from "./chunk-PEV5NGQ2.js";
7
+ import "./chunk-HE4RUUZP.js";
8
8
  import "./chunk-MLKGABMK.js";
9
9
  export {
10
10
  OpenAIClient,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createTelemetryRuntime,
3
3
  parseExporterTypes
4
- } from "./chunk-CBBSDV2D.js";
4
+ } from "./chunk-TKCJSTWI.js";
5
5
  import "./chunk-MLKGABMK.js";
6
6
  export {
7
7
  createTelemetryRuntime,