@livx.cc/agentx 0.99.12 → 0.99.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.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { a as AgentOptions, H as Hooks, h as RunResult, A as Agent } from './Agent-DYMSg21f.js';
2
2
  export { C as ChatFragment, D as DEFAULT_MUTATING, b as Decision, P as PermissionOptions, c as PermissionPolicy, d as PermissionRule, e as PreToolUseDecision, R as ReasoningEffort, f as RecordingHooks, g as RecordingLifecycle, T as ToolUse, i as ToolUseMeta, j as composeHooks, p as planMode, r as reasoningToChatFragment } from './Agent-DYMSg21f.js';
3
+ export { MODEL_ALIASES, ModelSwitch, ResolveModelSwitchOpts, modelShortLabel, resolveModelAlias, resolveModelSwitch } from './models.js';
3
4
  import { IFilesystem, FileMetadata } from '@livx.cc/wcli/core';
4
5
  export { CommandExecutor, FileMetadata, IFilesystem, IndexedDbFilesystem, MemFilesystem, registerHeadlessCommands } from '@livx.cc/wcli/core';
5
6
  import { BodDB } from '@bod.ee/db';
package/dist/index.js CHANGED
@@ -3894,6 +3894,45 @@ function lastAssistantText(messages) {
3894
3894
  return "";
3895
3895
  }
3896
3896
 
3897
+ // src/models.ts
3898
+ var MODEL_ALIASES = {
3899
+ fable: "claude-fable-5",
3900
+ "fable-5": "claude-fable-5",
3901
+ opus: "claude-opus-4-8",
3902
+ "opus-4-8": "claude-opus-4-8",
3903
+ "opus-4-7": "claude-opus-4-7",
3904
+ "opus-4-6": "claude-opus-4-6",
3905
+ sonnet: "claude-sonnet-4-6",
3906
+ haiku: "claude-haiku-4-5-20251001"
3907
+ };
3908
+ function resolveModelAlias(input) {
3909
+ const slash = input.indexOf("/");
3910
+ const prefix = slash === -1 ? "" : input.slice(0, slash + 1);
3911
+ const rest = slash === -1 ? input : input.slice(slash + 1);
3912
+ return prefix + (MODEL_ALIASES[rest.toLowerCase()] ?? rest);
3913
+ }
3914
+ function modelShortLabel(model) {
3915
+ if (!model) return "default";
3916
+ const id = model.split("/").pop();
3917
+ return id.replace(/^claude-/, "").replace(/-\d.*$/, "");
3918
+ }
3919
+ function resolveModelSwitch(opts) {
3920
+ const { requested, current, prior, allowed } = opts;
3921
+ if (!requested) return { model: current, denied: false };
3922
+ if (allowed && !allowed.some((a) => modelShortLabel(a) === modelShortLabel(requested))) {
3923
+ return { model: current, denied: true };
3924
+ }
3925
+ const fmt = opts.format ?? ((from, to) => `_[switching from ${from} to ${to}]_
3926
+
3927
+ `);
3928
+ const changed = prior !== void 0 && modelShortLabel(prior) !== modelShortLabel(requested);
3929
+ return {
3930
+ model: requested,
3931
+ denied: false,
3932
+ notice: changed ? fmt(modelShortLabel(prior), modelShortLabel(requested)) : void 0
3933
+ };
3934
+ }
3935
+
3897
3936
  // src/index.ts
3898
3937
  init_NodeDiskFilesystem();
3899
3938
 
@@ -7610,6 +7649,7 @@ export {
7610
7649
  JailedFilesystem,
7611
7650
  LessonOptionsDefaults,
7612
7651
  MEMORY_PROMPT,
7652
+ MODEL_ALIASES,
7613
7653
  MemFilesystem3 as MemFilesystem,
7614
7654
  MountFilesystem,
7615
7655
  NodeDiskFilesystem,
@@ -7684,6 +7724,7 @@ export {
7684
7724
  mcpToolToAgentTool,
7685
7725
  mcpToolsToAgentTools,
7686
7726
  mkdirp,
7727
+ modelShortLabel,
7687
7728
  multiEditTool,
7688
7729
  nextCronAfter,
7689
7730
  parseCron,
@@ -7698,6 +7739,8 @@ export {
7698
7739
  repoIndex,
7699
7740
  repoMapTool,
7700
7741
  resolveAuth,
7742
+ resolveModelAlias,
7743
+ resolveModelSwitch,
7701
7744
  rollbackTool,
7702
7745
  sandboxAgentOptions,
7703
7746
  scanCommands,