llm-relay 0.68.7 → 0.69.0

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 (52) hide show
  1. package/dist/accounting-store.d.ts +18 -1
  2. package/dist/accounting-store.js +130 -224
  3. package/dist/accounting-store.js.map +1 -1
  4. package/dist/backend.d.ts +11 -0
  5. package/dist/backend.js +7 -1
  6. package/dist/backend.js.map +1 -1
  7. package/dist/candidate-runner.d.ts +2 -2
  8. package/dist/candidate-runner.js +47 -21
  9. package/dist/candidate-runner.js.map +1 -1
  10. package/dist/cli.d.ts +15 -0
  11. package/dist/cli.js +77 -47
  12. package/dist/cli.js.map +1 -1
  13. package/dist/config.d.ts +2 -0
  14. package/dist/config.js +4 -0
  15. package/dist/config.js.map +1 -1
  16. package/dist/dispatch.d.ts +15 -0
  17. package/dist/dispatch.js +20 -0
  18. package/dist/dispatch.js.map +1 -1
  19. package/dist/dynamic-pools.d.ts +1 -1
  20. package/dist/dynamic-pools.js +2 -2
  21. package/dist/dynamic-pools.js.map +1 -1
  22. package/dist/mcp/lane-runner.d.ts +102 -2
  23. package/dist/mcp/lane-runner.js +49 -6
  24. package/dist/mcp/lane-runner.js.map +1 -1
  25. package/dist/mcp/server.d.ts +37 -1
  26. package/dist/mcp/server.js +183 -14
  27. package/dist/mcp/server.js.map +1 -1
  28. package/dist/routes/admin.js +2 -1
  29. package/dist/routes/admin.js.map +1 -1
  30. package/dist/routes/messages.d.ts +11 -0
  31. package/dist/routes/messages.js +7 -25
  32. package/dist/routes/messages.js.map +1 -1
  33. package/dist/routes/openai-front.js +5 -23
  34. package/dist/routes/openai-front.js.map +1 -1
  35. package/dist/server.d.ts +24 -1
  36. package/dist/server.js +31 -17
  37. package/dist/server.js.map +1 -1
  38. package/dist/setup-claude.d.ts +22 -0
  39. package/dist/setup-claude.js +91 -5
  40. package/dist/setup-claude.js.map +1 -1
  41. package/dist/stream-pipeline.d.ts +11 -0
  42. package/dist/stream-pipeline.js +2 -11
  43. package/dist/stream-pipeline.js.map +1 -1
  44. package/dist/target-facts.d.ts +10 -0
  45. package/dist/target-facts.js +11 -0
  46. package/dist/target-facts.js.map +1 -1
  47. package/package.json +1 -1
  48. package/skills/llm-relay/SKILL.md +13 -0
  49. package/skills/llm-relay/references/dispatch-lanes.md +26 -0
  50. package/dist/accounting-store-io.d.ts +0 -132
  51. package/dist/accounting-store-io.js +0 -1087
  52. package/dist/accounting-store-io.js.map +0 -1
package/dist/cli.d.ts CHANGED
@@ -6,6 +6,18 @@ import type { DispatchedQuotaReport } from "./mcp/lane-runner.js";
6
6
  import { ModelCatalog } from "./catalog.js";
7
7
  import { type CommandEffect } from "./self-update.js";
8
8
  import { type KeysCliDependencies } from "./keys-cli.js";
9
+ /**
10
+ * Canonical flag to short aliases mapping.
11
+ *
12
+ * Single-dash long aliases (`-task` for `--task`) are expanded automatically by
13
+ * `expandFlagAliases`. This table declares the explicit short aliases advertised
14
+ * by help and accepted by the CLI parser.
15
+ */
16
+ export declare const FLAG_ALIASES: Readonly<Record<string, readonly string[]>>;
17
+ export declare const CLI_FLAG_ALIASES: Readonly<Record<string, readonly string[]>>;
18
+ export declare function expandFlagAliases(flags: readonly string[]): Set<string>;
19
+ export declare const CANONICAL_VALUE_FLAGS: readonly ["--config", "--provider", "--default", "--mode", "--listen", "--task", "--exhausted", "--outcome", "--retry-after-ms", "--after", "--lane", "--tier", "--host", "--client", "--scope", "--credential", "--include", "--window", "--by", "--effort", "--shell", "--class", "--members", "--cost-class", "--rationale", "--reset-field", "--reset-ms", "--sig", "--import", "--label", "--env-name", "--out", "--repo"];
20
+ export declare const VALUE_FLAGS: Set<string>;
9
21
  export declare function argValue(...flags: string[]): string | undefined;
10
22
  export declare function hasFlag(...flags: string[]): boolean;
11
23
  /** Extract non-flag positional arguments from an argv array, skipping flags and their values. */
@@ -171,6 +183,9 @@ export declare const CLI_COMMAND_NAMES: ReadonlySet<string>;
171
183
  export declare const ARITY_EXEMPT: ReadonlySet<string>;
172
184
  /** The commands this guard bounds — exported for the drift test, not for dispatch. */
173
185
  export declare const ARITY_GUARDED_COMMANDS: readonly string[];
186
+ type CliOptionSpec = Readonly<Record<string, readonly string[]>>;
187
+ export declare const CLI_OPTIONS: CliOptionSpec;
188
+ export declare const ACTION_OPTIONS: Readonly<Record<string, CliOptionSpec>>;
174
189
  /** Return a bounded, value-free diagnostic for an option not accepted by this command/action. */
175
190
  export declare function commandOptionError(argv: readonly string[]): string | null;
176
191
  export declare function commandArityError(positionals: readonly string[]): string | null;
package/dist/cli.js CHANGED
@@ -45,41 +45,76 @@ const CONTEXT_WINDOW_SOURCE_LABEL = {
45
45
  snapshot: "synced snapshot, same model id on another host",
46
46
  provider: "published by the serving provider",
47
47
  };
48
- const VALUE_FLAGS = new Set([
49
- "--config", "-config", "-c",
50
- "--provider", "-provider", "-p",
51
- "--default", "-default", "-d",
52
- "--mode", "-mode", "-m",
53
- "--listen", "-listen", "-l",
54
- "--task", "-task", "-t",
55
- "--exhausted", "-exhausted", "-x",
56
- "--outcome", "-outcome",
57
- "--retry-after-ms", "-retry-after-ms",
58
- "--after", "-after",
59
- "--lane", "-lane",
60
- "--tier", "-tier",
61
- "--host", "-host",
62
- "--client", "-client",
63
- "--scope", "-scope",
64
- "--credential", "-credential",
65
- "--include", "-include",
66
- "--window", "-window",
67
- "--by", "-by",
68
- "--effort", "-effort",
69
- "--shell", "-shell",
70
- "--class", "-class",
71
- "--members", "-members",
72
- "--cost-class", "-cost-class",
73
- "--rationale", "-rationale",
74
- "--reset-field", "-reset-field",
75
- "--reset-ms", "-reset-ms",
76
- "--sig", "-sig",
77
- "--import", "-import",
78
- "--label", "-label",
79
- "--env-name", "-env-name",
80
- "--out", "-out",
81
- "--repo", "-repo",
82
- ]);
48
+ export const FLAG_ALIASES = {
49
+ "--config": ["-c"],
50
+ "--provider": ["-p"],
51
+ "--default": ["-d"],
52
+ "--mode": ["-m"],
53
+ "--listen": ["-l"],
54
+ "--task": ["-t"],
55
+ "--exhausted": ["-x"],
56
+ "--refresh": ["-r"],
57
+ "--help": ["-h"],
58
+ "--version": ["-v"],
59
+ };
60
+ export const CLI_FLAG_ALIASES = FLAG_ALIASES;
61
+ const SHORT_TO_CANONICAL = Object.fromEntries(Object.entries(FLAG_ALIASES).flatMap(([canonical, aliases]) => aliases.map((alias) => [alias, canonical])));
62
+ export function expandFlagAliases(flags) {
63
+ const aliases = new Set();
64
+ for (const flag of flags) {
65
+ aliases.add(flag);
66
+ const canonical = SHORT_TO_CANONICAL[flag] ?? (flag.startsWith("--") ? flag : `-${flag}`);
67
+ if (canonical !== flag && (canonical.startsWith("--") || FLAG_ALIASES[canonical])) {
68
+ aliases.add(canonical);
69
+ }
70
+ if (canonical.startsWith("--")) {
71
+ aliases.add(canonical.slice(1));
72
+ }
73
+ const shortAliases = FLAG_ALIASES[canonical] ?? FLAG_ALIASES[flag];
74
+ if (shortAliases !== undefined) {
75
+ for (const alias of shortAliases) {
76
+ aliases.add(alias);
77
+ }
78
+ }
79
+ }
80
+ return aliases;
81
+ }
82
+ export const CANONICAL_VALUE_FLAGS = [
83
+ "--config",
84
+ "--provider",
85
+ "--default",
86
+ "--mode",
87
+ "--listen",
88
+ "--task",
89
+ "--exhausted",
90
+ "--outcome",
91
+ "--retry-after-ms",
92
+ "--after",
93
+ "--lane",
94
+ "--tier",
95
+ "--host",
96
+ "--client",
97
+ "--scope",
98
+ "--credential",
99
+ "--include",
100
+ "--window",
101
+ "--by",
102
+ "--effort",
103
+ "--shell",
104
+ "--class",
105
+ "--members",
106
+ "--cost-class",
107
+ "--rationale",
108
+ "--reset-field",
109
+ "--reset-ms",
110
+ "--sig",
111
+ "--import",
112
+ "--label",
113
+ "--env-name",
114
+ "--out",
115
+ "--repo",
116
+ ];
117
+ export const VALUE_FLAGS = new Set(expandFlagAliases(CANONICAL_VALUE_FLAGS));
83
118
  let cachedArgv;
84
119
  let cachedParsedArgs;
85
120
  function parseCliArgs(argv) {
@@ -118,15 +153,6 @@ function parseCliArgs(argv) {
118
153
  cachedParsedArgs = { flags, values, positionals };
119
154
  return cachedParsedArgs;
120
155
  }
121
- function expandFlagAliases(flags) {
122
- const aliases = new Set();
123
- for (const flag of flags) {
124
- aliases.add(flag);
125
- if (flag.startsWith("--"))
126
- aliases.add(flag.slice(1));
127
- }
128
- return aliases;
129
- }
130
156
  export function argValue(...flags) {
131
157
  const aliases = expandFlagAliases(flags);
132
158
  return parseCliArgs(process.argv).values.find(({ flag }) => aliases.has(flag))?.value;
@@ -871,7 +897,7 @@ const COMMAND_ARITY = {
871
897
  };
872
898
  export const ARITY_EXEMPT = new Set(["keys", "cooldowns", "help", "version"]);
873
899
  export const ARITY_GUARDED_COMMANDS = Object.keys(COMMAND_ARITY);
874
- const CLI_OPTIONS = {
900
+ export const CLI_OPTIONS = {
875
901
  proxy: ["--config", "--default", "--mode", "--listen", "--ping"],
876
902
  onboard: ["--config", "--import", "--force"],
877
903
  setup: [],
@@ -893,7 +919,7 @@ const CLI_OPTIONS = {
893
919
  "delegate-gate": ["--repo", "--fix"],
894
920
  mcp: ["--config"],
895
921
  };
896
- const ACTION_OPTIONS = {
922
+ export const ACTION_OPTIONS = {
897
923
  offload: { on: ["--config", "--scope"], off: ["--config", "--scope"], enable: ["--config", "--scope"], disable: ["--config", "--scope"], status: ["--config"] },
898
924
  pools: {
899
925
  list: ["--config", "--json", "--probe"], show: ["--config", "--json"],
@@ -2805,9 +2831,13 @@ export function main() {
2805
2831
  if (target === "claude-desktop" || target === "desktop") {
2806
2832
  const res = setupClaudeDesktop();
2807
2833
  process.stdout.write(`${res.message}\n`);
2834
+ if (!res.success)
2835
+ process.exit(1);
2808
2836
  }
2809
2837
  else if (target === undefined || target === "claude-cli" || target === "cli" || target === "claude") {
2810
- setupClaudeCli();
2838
+ const res = setupClaudeCli();
2839
+ if (!res.success)
2840
+ process.exit(1);
2811
2841
  }
2812
2842
  else {
2813
2843
  configCommandError(`setup: unknown target "${target}" (targets: claude-cli, claude-desktop)`);