stitchkit 0.113.1 → 0.113.2

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 (75) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/contract/errors.d.ts +1 -0
  3. package/dist/contract/errors.d.ts.map +1 -1
  4. package/dist/entrypoints/agent-runtime/browser.js +2 -2
  5. package/dist/entrypoints/agent-runtime/coding-tools.js +4 -4
  6. package/dist/entrypoints/agent-runtime/harness.js +5 -5
  7. package/dist/entrypoints/agent-runtime/realtime.js +2 -2
  8. package/dist/entrypoints/agent-runtime/sandbox.js +4 -4
  9. package/dist/entrypoints/agent-runtime/sqlite/bun.js +6 -6
  10. package/dist/entrypoints/agent-runtime/sqlite/node.js +6 -6
  11. package/dist/entrypoints/agent-runtime/testing.js +6 -6
  12. package/dist/entrypoints/agent-runtime.js +11 -11
  13. package/dist/entrypoints/application/grammy.js +1 -1
  14. package/dist/entrypoints/application.js +2 -2
  15. package/dist/entrypoints/cli.js +8 -8
  16. package/dist/entrypoints/contract.js +2 -2
  17. package/dist/entrypoints/files.js +1 -1
  18. package/dist/entrypoints/index.js +5 -5
  19. package/dist/entrypoints/node.js +7 -7
  20. package/dist/entrypoints/observability.js +1 -1
  21. package/dist/entrypoints/realtime.js +3 -3
  22. package/dist/entrypoints/remote.js +1 -1
  23. package/dist/entrypoints/server.js +8 -8
  24. package/dist/entrypoints/testing.js +3 -3
  25. package/dist/entrypoints/tools/connections.js +5 -5
  26. package/dist/entrypoints/tools/invoker.js +5 -5
  27. package/dist/entrypoints/tools/mcp.js +7 -7
  28. package/dist/entrypoints/tools.js +13 -13
  29. package/dist/{index-yjnmac9b.js → index-09dyy94r.js} +1 -1
  30. package/dist/{index-v6mzw27b.js → index-0gbn42hr.js} +3 -3
  31. package/dist/{index-86sxnvpr.js → index-0pfk3c1p.js} +1 -1
  32. package/dist/{index-emrmgq3s.js → index-2s7wv547.js} +3 -3
  33. package/dist/{index-h1spd9kv.js → index-4e36ts8b.js} +1 -1
  34. package/dist/{index-556g5hsh.js → index-5gmrx6sc.js} +1 -1
  35. package/dist/{index-2qymcsq2.js → index-5zxe0f3h.js} +3 -3
  36. package/dist/{index-sjww6myv.js → index-6ez1r4j2.js} +4 -4
  37. package/dist/{index-8asb62xn.js → index-7ysby53h.js} +1 -1
  38. package/dist/{index-mhrtwttb.js → index-8swt2h9y.js} +1 -1
  39. package/dist/{index-tg2q89ps.js → index-a31p9ekx.js} +4 -4
  40. package/dist/{index-k8fbzggr.js → index-awbed0mk.js} +1 -1
  41. package/dist/{index-nk1mh535.js → index-bv51s0f4.js} +1 -1
  42. package/dist/{index-8jjzfts8.js → index-cn7xenet.js} +5 -5
  43. package/dist/{index-fynr93w4.js → index-e40rzw1m.js} +1 -1
  44. package/dist/{index-ykdcnq1f.js → index-grn4brx1.js} +1 -1
  45. package/dist/{index-nn6607y3.js → index-kvga921h.js} +4 -4
  46. package/dist/{index-j9gxbztg.js → index-pd578538.js} +1 -0
  47. package/dist/{index-dsxrcseb.js → index-ptjx84pr.js} +2 -2
  48. package/dist/{index-pvh3z03x.js → index-shg5xc9t.js} +1 -1
  49. package/dist/{index-xmgjtkvr.js → index-sps9s3aj.js} +1 -1
  50. package/dist/{index-jgwqc38k.js → index-vf9c59t3.js} +2 -2
  51. package/dist/{index-pzw0fpek.js → index-vgtzdykw.js} +1 -1
  52. package/dist/{index-fytsnhzj.js → index-xtc8k5n9.js} +170 -115
  53. package/dist/{index-k0zfcxf5.js → index-z8fnfj42.js} +1 -1
  54. package/dist/{index-gz9jf461.js → index-zbs0g0v2.js} +1 -1
  55. package/dist/tools/cli/command-shape.d.ts +4 -0
  56. package/dist/tools/cli/command-shape.d.ts.map +1 -0
  57. package/dist/tools/cli/format.d.ts.map +1 -1
  58. package/dist/tools/cli/help.d.ts.map +1 -1
  59. package/dist/tools/cli/invoke.d.ts +1 -1
  60. package/dist/tools/cli/invoke.d.ts.map +1 -1
  61. package/dist/tools/cli/managed-surface.d.ts +3 -2
  62. package/dist/tools/cli/managed-surface.d.ts.map +1 -1
  63. package/dist/tools/cli/policy.d.ts +2 -0
  64. package/dist/tools/cli/policy.d.ts.map +1 -1
  65. package/dist/tools/cli/run-managed.d.ts.map +1 -1
  66. package/dist/tools/cli/session.d.ts +0 -1
  67. package/dist/tools/cli/session.d.ts.map +1 -1
  68. package/dist/tools/cli/unavailable.d.ts +10 -0
  69. package/dist/tools/cli/unavailable.d.ts.map +1 -0
  70. package/llms/cli.2.txt +1 -1
  71. package/llms/cli.txt +31 -2
  72. package/llms/server.4.txt +1 -1
  73. package/llms-full.txt +33 -4
  74. package/llms.txt +1 -1
  75. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  validateDeclaredOutput
3
- } from "./index-fynr93w4.js";
3
+ } from "./index-e40rzw1m.js";
4
4
  import {
5
5
  jsonSchemaObjectCoercionMembers
6
6
  } from "./index-dsa676h8.js";
@@ -14,15 +14,15 @@ import {
14
14
  objectShapeKeys,
15
15
  assertUniqueToolName,
16
16
  buildToolPresentationSchema
17
- } from "./index-jgwqc38k.js";
17
+ } from "./index-vf9c59t3.js";
18
18
  import {
19
19
  toolResultFromError,
20
20
  toolErrorFromResult
21
- } from "./index-tg2q89ps.js";
21
+ } from "./index-a31p9ekx.js";
22
22
  import {
23
23
  createToolRunner,
24
24
  formatToolError
25
- } from "./index-v6mzw27b.js";
25
+ } from "./index-0gbn42hr.js";
26
26
  import {
27
27
  fetchGuarded,
28
28
  readCapped
@@ -35,7 +35,7 @@ import {
35
35
  } from "./index-eemvahkc.js";
36
36
  import {
37
37
  collectToolSurface
38
- } from "./index-emrmgq3s.js";
38
+ } from "./index-2s7wv547.js";
39
39
  import {
40
40
  isUnsafeKey,
41
41
  safeJsonParse
@@ -43,6 +43,10 @@ import {
43
43
  import {
44
44
  formatZodError2
45
45
  } from "./index-1eeqpadm.js";
46
+ import {
47
+ AppError2,
48
+ STITCH_ERROR_STATUS2
49
+ } from "./index-pd578538.js";
46
50
  import {
47
51
  isRecord
48
52
  } from "./index-9jfdm5tg.js";
@@ -137,6 +141,7 @@ var DEFAULT_EXIT_CODES2 = {
137
141
  CONNECTION_REQUEST_FAILED: 1,
138
142
  UPSTREAM_TOOL_ERROR: 1,
139
143
  WAIT_FAILED: 1,
144
+ CLI_COMMAND_UNAVAILABLE: 1,
140
145
  INTERNAL_SERVER_ERROR: 1
141
146
  };
142
147
  function cliExitCode2(result, exitCodes) {
@@ -653,19 +658,25 @@ async function runNativeCommand(definition, args, config, globals) {
653
658
  written: { ...out !== "" && { stdout: out }, ...err !== "" && { stderr: err } }
654
659
  };
655
660
  }
656
- function buildCliSurface(config, auth, nativeHelp, applicationGlobalNames, assertShape) {
661
+ function buildCliSurface(config, auth, nativeHelp, applicationGlobalNames, shapeIssue) {
657
662
  const services = typeof config.services === "function" ? config.services(auth) : config.services ?? [];
658
663
  const runtimeTools = typeof config.runtimeTools === "function" ? config.runtimeTools(auth) : config.runtimeTools ?? [];
659
664
  const tools = new Map;
660
665
  const help = new Map(nativeHelp);
661
- for (const { mountable } of collectToolSurface({
666
+ for (const { kind, mountable } of collectToolSurface({
662
667
  surface: { services, runtimeTools },
663
668
  transport: "CLI"
664
669
  })) {
665
670
  const descriptor = applyCliPresentationPolicy(mountable.name, managedCliDescriptor(mountable), config);
666
- assertShape?.(mountable.name, descriptor, help.has(mountable.name), config.passthrough?.[mountable.name], applicationGlobalNames);
667
- tools.set(mountable.name, mountable);
668
- help.set(mountable.name, descriptor);
671
+ const issue = shapeIssue?.(mountable.name, descriptor, help.has(mountable.name), config.passthrough?.[mountable.name], applicationGlobalNames);
672
+ if (issue !== undefined) {
673
+ if (kind !== "runtime")
674
+ throw new Error(issue);
675
+ help.set(mountable.name, { ...descriptor, unavailableReason: issue });
676
+ } else {
677
+ tools.set(mountable.name, mountable);
678
+ help.set(mountable.name, descriptor);
679
+ }
669
680
  }
670
681
  assertCliPoliciesResolved(help, config);
671
682
  return { tools, help };
@@ -1765,7 +1776,10 @@ function renderTopHelp(input) {
1765
1776
  ];
1766
1777
  const width = Math.max(0, ...[...commands.keys()].map((key) => key.length));
1767
1778
  for (const [command, descriptor] of commands) {
1768
- lines.push(` ${padRight(command, width)} ${summarize(descriptor.description)}${command === defaultCommand ? " (default)" : ""}`);
1779
+ lines.push(` ${padRight(command, width)} ${summarize(descriptor.description)}${command === defaultCommand ? " (default)" : ""}${descriptor.unavailableReason !== undefined ? " [unavailable]" : ""}`);
1780
+ if (descriptor.unavailableReason !== undefined) {
1781
+ lines.push(` Unavailable: ${descriptor.unavailableReason}`);
1782
+ }
1769
1783
  }
1770
1784
  if (input.unavailable !== undefined) {
1771
1785
  lines.push("", `Managed commands are unavailable: ${input.unavailable}`);
@@ -1809,6 +1823,9 @@ function renderCommandHelp(name, command, descriptor, applicationOptions = []) {
1809
1823
  "[--flags]"
1810
1824
  ].join(" ");
1811
1825
  const lines = [descriptor.description, "", usage, ""];
1826
+ if (descriptor.unavailableReason !== undefined) {
1827
+ lines.push(`Unavailable: ${descriptor.unavailableReason}`, "");
1828
+ }
1812
1829
  if (fields.length > 0) {
1813
1830
  lines.push("Arguments:");
1814
1831
  const labels = new Map(fields.map((field) => {
@@ -1845,115 +1862,25 @@ function renderCommandHelp(name, command, descriptor, applicationOptions = []) {
1845
1862
  `;
1846
1863
  }
1847
1864
 
1848
- // src/tools/cli/session.ts
1849
- function nativeDescriptor(definition) {
1850
- return {
1851
- description: definition.description,
1852
- argumentSchema: definition.input,
1853
- presentationSchema: cliCommandPresentationSchema(definition)
1854
- };
1855
- }
1856
- function assertCommandShape(name, descriptor, exists, passthroughField, applicationGlobals = new Set) {
1865
+ // src/tools/cli/command-shape.ts
1866
+ function commandShapeIssue(name, descriptor, exists, passthroughField, applicationGlobals = new Set) {
1857
1867
  assertUniqueToolName(name, exists, "CLI command");
1858
1868
  if (name === "help" || name === "version") {
1859
1869
  throw new Error(`[stitchkit] CLI command "${name}" is reserved`);
1860
1870
  }
1871
+ if (passthroughField !== undefined && descriptor.aliases.has(passthroughField)) {
1872
+ throw new Error(`[stitchkit] CLI command "${name}" cannot alias passthrough field "${passthroughField}"`);
1873
+ }
1861
1874
  const fieldNames = jsonSchemaFields(descriptor.presentationSchema).map((field) => field.name);
1862
1875
  const conflicting = fieldNames.filter((field) => RESERVED_CLI_OPTIONS.has(field));
1863
1876
  if (conflicting.length > 0) {
1864
- throw new Error(`[stitchkit] CLI command "${name}" declares reserved option field(s): ${conflicting.join(", ")}`);
1877
+ return `[stitchkit] CLI command "${name}" declares reserved option field(s): ${conflicting.join(", ")}`;
1865
1878
  }
1866
1879
  const shadowed = fieldNames.filter((field) => applicationGlobals.has(field));
1867
1880
  if (shadowed.length > 0) {
1868
- throw new Error(`[stitchkit] CLI command "${name}" declares field(s) shadowed by application global options: ${shadowed.join(", ")}`);
1869
- }
1870
- if (passthroughField !== undefined && descriptor.aliases.has(passthroughField)) {
1871
- throw new Error(`[stitchkit] CLI command "${name}" cannot alias passthrough field "${passthroughField}"`);
1881
+ return `[stitchkit] CLI command "${name}" declares field(s) shadowed by application global options: ${shadowed.join(", ")}`;
1872
1882
  }
1873
1883
  }
1874
- function createCliSession(config, io) {
1875
- if (config.auth !== undefined && config.resolveAuth !== undefined) {
1876
- throw new Error("[stitchkit] createCli: use either auth or resolveAuth, not both");
1877
- }
1878
- const applicationOptions = config.globalOptions ? jsonSchemaFields(buildToolPresentationSchema({
1879
- inputSchema: config.globalOptions,
1880
- unrepresentable: "any"
1881
- })) : [];
1882
- const applicationGlobalNames = new Set(applicationOptions.map((field) => field.name));
1883
- for (const name of applicationGlobalNames) {
1884
- if (RESERVED_CLI_OPTIONS.has(name)) {
1885
- throw new Error(`[stitchkit] CLI global option "--${name}" is reserved by the framework`);
1886
- }
1887
- }
1888
- const nativeCommands = new Map;
1889
- const nativeHelp = new Map;
1890
- for (const definition of config.commands ?? []) {
1891
- const descriptor = applyCliPresentationPolicy(definition.name, nativeDescriptor(definition), config);
1892
- assertCommandShape(definition.name, descriptor, nativeCommands.has(definition.name), config.passthrough?.[definition.name], applicationGlobalNames);
1893
- nativeCommands.set(definition.name, definition);
1894
- nativeHelp.set(definition.name, descriptor);
1895
- }
1896
- return {
1897
- config,
1898
- io,
1899
- applicationOptions,
1900
- applicationGlobalNames,
1901
- nativeCommands,
1902
- nativeHelp
1903
- };
1904
- }
1905
- function resolveCliRoute(session, argv) {
1906
- const { config } = session;
1907
- const { stdout, stderr, exit } = session.io;
1908
- let globals;
1909
- let routableArgv;
1910
- try {
1911
- const lifted = extractCliGlobalOptions2(argv, config.globalOptions);
1912
- globals = lifted.globals;
1913
- routableArgv = lifted.argv;
1914
- } catch (error) {
1915
- if (!(error instanceof CliArgumentError2))
1916
- throw error;
1917
- stderr(`${error.message}
1918
- `);
1919
- exit(2);
1920
- return;
1921
- }
1922
- const typedGlobals = globals;
1923
- const route = routeCliArgv2(routableArgv, config.defaultCommand);
1924
- if (route.error) {
1925
- stderr(`${route.error}
1926
- `);
1927
- exit(2);
1928
- return;
1929
- }
1930
- const { command, commandArgv } = route;
1931
- if (route.version || command === "--version" || command === "version") {
1932
- stdout(`${config.name} ${config.version}
1933
- `);
1934
- exit(0);
1935
- return;
1936
- }
1937
- const beforeSeparator = commandArgv.indexOf("--") === -1 ? commandArgv : commandArgv.slice(0, commandArgv.indexOf("--"));
1938
- const helpRequested = beforeSeparator.includes("--help") || beforeSeparator.includes("-h");
1939
- return {
1940
- globals,
1941
- typedGlobals,
1942
- route,
1943
- command,
1944
- commandArgv,
1945
- beforeSeparator,
1946
- helpRequested
1947
- };
1948
- }
1949
- function emitOptionsFor(config, json, toolName) {
1950
- return {
1951
- json,
1952
- toolName,
1953
- errorHint: config.errorHint,
1954
- exitCodes: { ...DEFAULT_EXIT_CODES2, ...config.exitCodes }
1955
- };
1956
- }
1957
1884
 
1958
1885
  // src/tools/cli/managed-surface.ts
1959
1886
  async function buildManagedSurface(session, typedGlobals, forExecution) {
@@ -1979,7 +1906,7 @@ async function buildManagedSurface(session, typedGlobals, forExecution) {
1979
1906
  };
1980
1907
  }
1981
1908
  }
1982
- const { tools, help } = buildCliSurface(config, auth, nativeHelp, applicationGlobalNames, assertCommandShape);
1909
+ const { tools, help } = buildCliSurface(config, auth, nativeHelp, applicationGlobalNames, commandShapeIssue);
1983
1910
  return { resolved: true, auth, help, tools };
1984
1911
  }
1985
1912
 
@@ -2056,6 +1983,128 @@ async function prepareInvocation(command, commandArgv, descriptor, config, readS
2056
1983
  return { ok: true, toolArgs, options };
2057
1984
  }
2058
1985
 
1986
+ // src/tools/cli/session.ts
1987
+ function nativeDescriptor(definition) {
1988
+ return {
1989
+ description: definition.description,
1990
+ argumentSchema: definition.input,
1991
+ presentationSchema: cliCommandPresentationSchema(definition)
1992
+ };
1993
+ }
1994
+ function createCliSession(config, io) {
1995
+ if (config.auth !== undefined && config.resolveAuth !== undefined) {
1996
+ throw new Error("[stitchkit] createCli: use either auth or resolveAuth, not both");
1997
+ }
1998
+ const applicationOptions = config.globalOptions ? jsonSchemaFields(buildToolPresentationSchema({
1999
+ inputSchema: config.globalOptions,
2000
+ unrepresentable: "any"
2001
+ })) : [];
2002
+ const applicationGlobalNames = new Set(applicationOptions.map((field) => field.name));
2003
+ for (const name of applicationGlobalNames) {
2004
+ if (RESERVED_CLI_OPTIONS.has(name)) {
2005
+ throw new Error(`[stitchkit] CLI global option "--${name}" is reserved by the framework`);
2006
+ }
2007
+ }
2008
+ const nativeCommands = new Map;
2009
+ const nativeHelp = new Map;
2010
+ for (const definition of config.commands ?? []) {
2011
+ const descriptor = applyCliPresentationPolicy(definition.name, nativeDescriptor(definition), config);
2012
+ const issue = commandShapeIssue(definition.name, descriptor, nativeCommands.has(definition.name), config.passthrough?.[definition.name], applicationGlobalNames);
2013
+ if (issue !== undefined)
2014
+ throw new Error(issue);
2015
+ nativeCommands.set(definition.name, definition);
2016
+ nativeHelp.set(definition.name, descriptor);
2017
+ }
2018
+ return {
2019
+ config,
2020
+ io,
2021
+ applicationOptions,
2022
+ applicationGlobalNames,
2023
+ nativeCommands,
2024
+ nativeHelp
2025
+ };
2026
+ }
2027
+ function resolveCliRoute(session, argv) {
2028
+ const { config } = session;
2029
+ const { stdout, stderr, exit } = session.io;
2030
+ let globals;
2031
+ let routableArgv;
2032
+ try {
2033
+ const lifted = extractCliGlobalOptions2(argv, config.globalOptions);
2034
+ globals = lifted.globals;
2035
+ routableArgv = lifted.argv;
2036
+ } catch (error) {
2037
+ if (!(error instanceof CliArgumentError2))
2038
+ throw error;
2039
+ stderr(`${error.message}
2040
+ `);
2041
+ exit(2);
2042
+ return;
2043
+ }
2044
+ const typedGlobals = globals;
2045
+ const route = routeCliArgv2(routableArgv, config.defaultCommand);
2046
+ if (route.error) {
2047
+ stderr(`${route.error}
2048
+ `);
2049
+ exit(2);
2050
+ return;
2051
+ }
2052
+ const { command, commandArgv } = route;
2053
+ if (route.version || command === "--version" || command === "version") {
2054
+ stdout(`${config.name} ${config.version}
2055
+ `);
2056
+ exit(0);
2057
+ return;
2058
+ }
2059
+ const beforeSeparator = commandArgv.indexOf("--") === -1 ? commandArgv : commandArgv.slice(0, commandArgv.indexOf("--"));
2060
+ const helpRequested = beforeSeparator.some((token) => {
2061
+ if (token === "--help" || token === "-h")
2062
+ return true;
2063
+ const option = classifyLongOptionToken(token);
2064
+ return option?.name === "help" && option.value !== undefined && isReservedBoolWord(option.value) && parseReservedBool("help", option.value);
2065
+ });
2066
+ return {
2067
+ globals,
2068
+ typedGlobals,
2069
+ route,
2070
+ command,
2071
+ commandArgv,
2072
+ beforeSeparator,
2073
+ helpRequested
2074
+ };
2075
+ }
2076
+ function emitOptionsFor(config, json, toolName) {
2077
+ return {
2078
+ json,
2079
+ toolName,
2080
+ errorHint: config.errorHint,
2081
+ exitCodes: { ...DEFAULT_EXIT_CODES2, ...config.exitCodes }
2082
+ };
2083
+ }
2084
+
2085
+ // src/tools/cli/unavailable.ts
2086
+ function unavailableCommand(reason) {
2087
+ return toolResultFromError(new AppError2("CLI_COMMAND_UNAVAILABLE", {
2088
+ message: reason,
2089
+ status: STITCH_ERROR_STATUS2.CLI_COMMAND_UNAVAILABLE,
2090
+ retryable: false
2091
+ }));
2092
+ }
2093
+ function unavailableCommandJson(argv) {
2094
+ for (let i = 0;i < argv.length; i++) {
2095
+ const token = argv[i];
2096
+ if (token === "--")
2097
+ break;
2098
+ if (token === undefined)
2099
+ continue;
2100
+ const option = classifyLongOptionToken(token);
2101
+ if (option?.name !== "json")
2102
+ continue;
2103
+ return option.value === undefined ? separateBoolValue(argv[i + 1]) ?? true : isReservedBoolWord(option.value) && parseReservedBool("json", option.value);
2104
+ }
2105
+ return false;
2106
+ }
2107
+
2059
2108
  // src/tools/cli/run-managed.ts
2060
2109
  async function runManagedInvocation(session, route) {
2061
2110
  const { config } = session;
@@ -2077,7 +2126,7 @@ function respondTopLevelHelp(session, route, managed) {
2077
2126
  const helpFilter = route.route.helpFilter ?? (command !== undefined ? commandArgv[0] : undefined);
2078
2127
  const filter = helpFilter !== undefined && !helpFilter.startsWith("-") ? helpFilter : undefined;
2079
2128
  if (filter !== undefined && filterCommands(managed.help, filter).size === 0) {
2080
- stderr(`no command matches "${filter}" (${managed.help.size} available)
2129
+ stderr(`no command matches "${filter}" (${[...managed.help.values()].filter((entry) => entry.unavailableReason === undefined).length} available)
2081
2130
  ` + (managed.resolved ? "" : `Managed commands are unavailable: ${managed.reason}
2082
2131
  `));
2083
2132
  const codes = { ...DEFAULT_EXIT_CODES2, ...config.exitCodes };
@@ -2098,19 +2147,22 @@ function respondTopLevelHelp(session, route, managed) {
2098
2147
  async function runManagedCommand(session, route, command, managed) {
2099
2148
  const { config, applicationOptions } = session;
2100
2149
  const { stdout, stderr, exit, readStdin } = session.io;
2101
- const tool = managed.tools.get(command);
2102
- if (!tool) {
2150
+ const descriptor = managed.help.get(command);
2151
+ if (!descriptor) {
2103
2152
  stderr(`Unknown command "${command}". Run "${config.name} --help" for the command list.
2104
2153
  `);
2105
2154
  return exit(1);
2106
2155
  }
2107
- const descriptor = managed.help.get(command);
2108
- if (!descriptor)
2109
- throw new Error("[stitchkit] managed CLI descriptor invariant failed");
2110
2156
  if (route.helpRequested) {
2111
2157
  stdout(renderCommandHelp(config.name, command, descriptor, applicationOptions));
2112
2158
  return exit(0);
2113
2159
  }
2160
+ if (descriptor.unavailableReason !== undefined) {
2161
+ return exit(emitResult2(unavailableCommand(descriptor.unavailableReason), { stdout, stderr }, emitOptionsFor(config, unavailableCommandJson(route.commandArgv), command)));
2162
+ }
2163
+ const tool = managed.tools.get(command);
2164
+ if (!tool)
2165
+ throw new Error("[stitchkit] managed CLI executable invariant failed");
2114
2166
  const prepared = await prepareInvocation(command, route.commandArgv, descriptor, config, readStdin);
2115
2167
  if (!prepared.ok) {
2116
2168
  stderr(`${prepared.message}
@@ -2171,6 +2223,9 @@ async function executeManagedTool(session, route, command, managed, tool, { tool
2171
2223
  initial: result,
2172
2224
  wait: waitConfig,
2173
2225
  call: async (toolName, args) => {
2226
+ const unavailable = managed.help.get(toolName)?.unavailableReason;
2227
+ if (unavailable !== undefined)
2228
+ return unavailableCommand(unavailable);
2174
2229
  const pollTool = managed.tools.get(toolName);
2175
2230
  if (!pollTool) {
2176
2231
  return {
@@ -17,7 +17,7 @@ import {
17
17
  replaceMessage,
18
18
  ArchiveSpillSchema,
19
19
  createAgentRuntimeStore2
20
- } from "./index-yjnmac9b.js";
20
+ } from "./index-09dyy94r.js";
21
21
 
22
22
  // src/agent-runtime/store-memory.ts
23
23
  import { z as z2 } from "zod";
@@ -19,7 +19,7 @@ import {
19
19
  appendEventIn,
20
20
  ArchiveProjectionSchema,
21
21
  createAgentRuntimeStore2
22
- } from "./index-yjnmac9b.js";
22
+ } from "./index-09dyy94r.js";
23
23
  import {
24
24
  AgentConversationPageSchema2,
25
25
  AgentConversationMessagePageSchema2
@@ -0,0 +1,4 @@
1
+ import type { CliCommandPresentation } from './policy.js';
2
+ /** Local configuration faults throw; only argv field conflicts become unavailable. */
3
+ export declare function commandShapeIssue(name: string, descriptor: CliCommandPresentation, exists: boolean, passthroughField?: string, applicationGlobals?: ReadonlySet<string>): string | undefined;
4
+ //# sourceMappingURL=command-shape.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-shape.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/command-shape.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEvD,sFAAsF;AACtF,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,sBAAsB,EAClC,MAAM,EAAE,OAAO,EACf,gBAAgB,CAAC,EAAE,MAAM,EACzB,kBAAkB,GAAE,WAAW,CAAC,MAAM,CAAa,GAClD,MAAM,GAAG,SAAS,CAwBpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,sDAAsD;AACtD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAiBhC,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,WAAW;IAC1B,wEAAwE;IACxE,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,SAAS,CAAC,EAAE,WAAW,CAAC;CACzB;AAED;;;;GAIG;AACH;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,WAAW,GAAG,MAAM,CAY/E;AAED,wBAAgB,UAAU,CACxB,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,WAAW,GAChB,MAAM,CAeR"}
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,sDAAsD;AACtD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAkBhC,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,WAAW;IAC1B,wEAAwE;IACxE,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,SAAS,CAAC,EAAE,WAAW,CAAC;CACzB;AAED;;;;GAIG;AACH;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,WAAW,GAAG,MAAM,CAY/E;AAED,wBAAgB,UAAU,CACxB,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,WAAW,GAChB,MAAM,CAeR"}
@@ -1 +1 @@
1
- {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/help.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KA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AO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,SAAS,eAAe,EAAE,CAAC;IAC/C,wEAAwE;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,MAAM,CAyCT;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,sBAAsB,EAClC,kBAAkB,GAAE,SAAS,eAAe,EAAO,GAClD,MAAM,CA4ER"}
@@ -135,7 +135,7 @@ export declare function createCliInvoker<TAuth = unknown, TContext extends Recor
135
135
  * empty map — the uniqueness and shape checks have to see both halves, or a
136
136
  * managed command could silently shadow a native one.
137
137
  */
138
- export declare function buildCliSurface<TAuth, TContext extends Record<string, unknown>, TGlobals extends ZodObject>(config: CliInvokerConfig<TAuth, TContext, TGlobals>, auth: Awaited<TAuth> | undefined, nativeHelp: Map<string, CliCommandPresentation>, applicationGlobalNames: ReadonlySet<string>, assertShape?: (name: string, descriptor: CliCommandPresentation, exists: boolean, passthroughField: string | undefined, globalNames: ReadonlySet<string>) => void): {
138
+ export declare function buildCliSurface<TAuth, TContext extends Record<string, unknown>, TGlobals extends ZodObject>(config: CliInvokerConfig<TAuth, TContext, TGlobals>, auth: Awaited<TAuth> | undefined, nativeHelp: Map<string, CliCommandPresentation>, applicationGlobalNames: ReadonlySet<string>, shapeIssue?: (name: string, descriptor: CliCommandPresentation, exists: boolean, passthroughField: string | undefined, globalNames: ReadonlySet<string>) => string | undefined): {
139
139
  tools: Map<string, MountableTool>;
140
140
  help: Map<string, CliCommandPresentation>;
141
141
  };
@@ -1 +1 @@
1
- {"version":3,"file":"invoke.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/invoke.ts"],"names":[],"mappings":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IAAI,CAAC,sBAAsB,EAAE,SAAS,GAAG,aAAa,CAAC,CAMzD"}
@@ -2,7 +2,7 @@ import type { ZodObject, z } from 'zod';
2
2
  import { type ToolResult } from '../execute-result.js';
3
3
  import type { MountableTool } from '../mount.js';
4
4
  import type { CliCommandPresentation } from './policy.js';
5
- import { type CliSession } from './session.js';
5
+ import type { CliSession } from './session.js';
6
6
  /**
7
7
  * The managed surface, or the reason there isn't one.
8
8
  *
@@ -11,7 +11,8 @@ import { type CliSession } from './session.js';
11
11
  * and it knows why the rest are missing. Letting the rejection escape printed
12
12
  * neither, and answering `Unknown command` would be a lie: the name is not
13
13
  * unknown, it is unresolvable. Only identity resolution is caught here; a
14
- * configuration fault in the surface itself is still a startup error.
14
+ * local configuration fault is still a startup error; runtime argv field
15
+ * conflicts remain discoverable as unavailable commands.
15
16
  */
16
17
  export type ManagedSurface<TAuth> = {
17
18
  resolved: true;
@@ -1 +1 @@
1
- {"version":3,"file":"managed-surface.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/managed-surface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EAAE,KAAK,UAAU,EAA4C,MAAM,mBAAmB,CAAC;AAC9F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAEhE;;;;;;;;;GASG;AACH,MAAM,MAAM,cAAc,CAAC,KAAK,IAC5B;IACE,QAAQ,EAAE,IAAI,CAAC;IACf,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;IACjC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;IAC1C,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;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AQ,EAAE,KAAK,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC,UAAU,EAAE;QAAE,EAAE,EAAE,KAAK,CAAA;KAAE,CAAC,CAAC;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;CAC3C,CAAC;AAEN,wBAAsB,mBAAmB,CACvC,KAAK,EACL,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxC,QAAQ,SAAS,SAAS,EAE1B,OAAO,EAAE,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAC9C,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAChC,YAAY,EAAE,OAAO,GACpB,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAuChC"}
@@ -9,6 +9,8 @@ export interface CliPresentationPolicyConfig {
9
9
  }
10
10
  export interface CliCommandPresentation {
11
11
  description: string;
12
+ /** An argv field conflict in a runtime catalogue entry; never executable. */
13
+ unavailableReason?: string;
12
14
  argumentSchema: Parameters<typeof describeSchemaFields>[0];
13
15
  presentationSchema: Record<string, unknown>;
14
16
  /** Canonical field name → one short alias. */
@@ -1 +1 @@
1
- {"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/policy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,WAAW,2BAA2B;IAC1C,+DAA+D;IAC/D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+EAA+E;IAC/E,aAAa,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3E,6FAA6F;IAC7F,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAA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,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,8CAA8C;IAC9C,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACjC;AAkFD,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,IAAI,CAAC,sBAAsB,EAAE,SAAS,GAAG,aAAa,CAAC,EACnE,MAAM,EAAE,2BAA2B,GAClC,sBAAsB,CAexB;AAED,wFAAwF;AACxF,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,sBAAsB,CAAC,EACrD,MAAM,EAAE,2BAA2B,GAClC,IAAI,CAWN"}
@@ -1 +1 @@
1
- {"version":3,"file":"run-managed.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/run-managed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAWrC,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAkB,MAAM,WAAW,CAAC;AAO3E,wFAAwF;AACxF,wBAAsB,oBAAoB,CACxC,KAAK,EACL,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxC,QAAQ,SAAS,SAAS,EAC1B,OAAO,EAAE,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAkC1F"}
1
+ {"version":3,"file":"run-managed.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/run-managed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAWrC,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAkB,MAAM,WAAW,CAAC;AAQ3E,wFAAwF;AACxF,wBAAsB,oBAAoB,CACxC,KAAK,EACL,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxC,QAAQ,SAAS,SAAS,EAC1B,OAAO,EAAE,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAkC1F"}
@@ -10,7 +10,6 @@ import type { CliConfig } from './config.js';
10
10
  import { type EmitOptions } from './format.js';
11
11
  import type { CliIo } from './io.js';
12
12
  import { type CliCommandPresentation } from './policy.js';
13
- export declare function assertCommandShape(name: string, descriptor: CliCommandPresentation, exists: boolean, passthroughField?: string, applicationGlobals?: ReadonlySet<string>): void;
14
13
  export interface CliSession<TAuth, TContext extends Record<string, unknown>, TGlobals extends ZodObject> {
15
14
  config: CliConfig<TAuth, TContext, TGlobals>;
16
15
  io: CliIo;
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/session.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EAAE,KAAK,eAAe,EAAoB,MAAM,+BAA+B,CAAC;AAIvF,OAAO,EAAE,KAAK,YAAY,EAAsC,MAAM,cAAc,CAAC;AAErF,OAAO,EAAE,KAAK,oBAAoB,EAAgC,MAAM,WAAW,CAAC;AACpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO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;AAED,qFAAqF;AACrF,wBAAgB,cAAc,CAC5B,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,WAAW,GAAG,WAAW,CAAC,EAClD,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,MAAM,GACf,WAAW,CAOb"}
@@ -0,0 +1,10 @@
1
+ import { type ToolFailure } from '../execute-result.js';
2
+ /** One refusal for direct dispatch and a known, unavailable --wait target. */
3
+ export declare function unavailableCommand(reason: string): ToolFailure;
4
+ /**
5
+ * Choose only the error's format, without admitting arguments of a command that
6
+ * cannot run. Its availability refusal takes precedence over argument errors.
7
+ * Reuse the framework's token/boolean vocabulary; after -- everything is data.
8
+ */
9
+ export declare function unavailableCommandJson(argv: readonly string[]): boolean;
10
+ //# sourceMappingURL=unavailable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unavailable.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/unavailable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAuB,MAAM,mBAAmB,CAAC;AAI1E,8EAA8E;AAC9E,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAQ9D;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAYvE"}
package/llms/cli.2.txt CHANGED
@@ -290,7 +290,7 @@ SDK nor the `ai` peer.
290
290
 
291
291
  | Export | Kind | Summary |
292
292
  |--------|------|---------|
293
- | `createCli` | function | build and run a CLI from contracts — [guide](../guide/cli.md) |
293
+ | `createCli` | function | build and run a CLI from contracts; a runtime catalogue field conflicting with reserved/global argv options disables only that entry, retained in help with its reason; invocation returns `CLI_COMMAND_UNAVAILABLE` before side effects — [guide](../guide/cli.md#when-one-runtime-command-cannot-be-represented-in-argv) |
294
294
  | `defineCliCommand` | function | define one Zod-typed CLI-only executable command with optional validated-result presentation/exit policy |
295
295
  | `parseCliArgs` | function | argv → typed tool args against a schema; inline `--field:=JSON` assigns a whole JSON value, including null, while ordinary string flags remain lexical; named array options together with bare positionals require an explicit `positionals` policy (advanced) |
296
296
  | `routeCliArgv` | function | select the command out of argv without duplicating the global-option grammar (advanced) |
package/llms/cli.txt CHANGED
@@ -490,13 +490,42 @@ command name — validated against the declared schema, and kept out of every
490
490
  operation's arguments: `handoff_read` above receives `{ handoffId: 'u' }` and
491
491
  nothing else. The values reach `resolveAuth(globals)`, `context(auth, globals)`
492
492
  and a native command's `globals`. An invalid value is an argument error naming
493
- the flag; a name that collides with a framework option, or with a field of any
494
- command, is refused at startup rather than shadowing it silently. Past a bare
493
+ the flag. An application global that collides with a framework option is refused
494
+ at startup. Field collisions in authored commands are configuration errors;
495
+ runtime catalogue entries are isolated as described below. Past a bare
495
496
  `--` every token is a literal, so a positional value that reads like a global
496
497
  survives intact.
497
498
 
498
499
  Both help levels list them under `Application options:`.
499
500
 
501
+ ## When one runtime command cannot be represented in argv
502
+
503
+ A `runtimeTools` catalogue can change independently of the CLI application. An
504
+ entry whose input declares a framework option such as `json`, or a field shadowed
505
+ by an application global such as `caller`, cannot receive that field through argv.
506
+ Only that entry becomes unavailable. Other commands still run, and top-level,
507
+ filtered and command-specific help retain the entry and its full reason:
508
+
509
+ ```text
510
+ inspect Inspect an operation [unavailable]
511
+ Unavailable: [stitchkit] CLI command "inspect" declares field(s) shadowed by application global options: caller
512
+ ```
513
+
514
+ Calling it returns `CLI_COMMAND_UNAVAILABLE`, `retryable: false`, and the same
515
+ reason in `details.message` on stderr; the default exit code is 1. `--json`
516
+ compacts the error as usual; `exitCodes` and `errorHint` apply. The refusal precedes
517
+ command argument parsing, stdin, context, hooks and the handler; `--dry-run` cannot
518
+ turn it into success. A known unavailable `--wait` target returns the same refusal;
519
+ an unknown target keeps `NOT_FOUND`.
520
+
521
+ This isolates only reserved/global **field** conflicts in `runtimeTools`.
522
+ Native commands and contract-defined `services` still fail at startup for those
523
+ conflicts. Duplicate or reserved command names and invalid local aliases,
524
+ positionals or passthrough policies remain configuration errors for every entry.
525
+ `createCliInvoker` receives globals and command input separately and has no argv
526
+ projection, so its own `caller` or `json` input stays callable without renaming.
527
+ See [ADR 0273](../decisions/0273-a-runtime-cli-field-conflict-is-one-commands-unavailability.md).
528
+
500
529
  ## When the managed surface cannot resolve
501
530
 
502
531
  A CLI whose commands come from a running server declares them with a factory,
package/llms/server.4.txt CHANGED
@@ -553,7 +553,7 @@ core never models them (ADR 0002). But stitchkit itself emits a set of its own:
553
553
  `FILE_INSPECTION_REJECTED`, `FILE_TOO_LARGE`, `FILE_EXISTS`,
554
554
  `REALTIME_CONTRACT_VIOLATION`, `APPLICATION_NOT_ACCEPTING`, `NOT_IMPLEMENTED`,
555
555
  `WAIT_TIMEOUT`,
556
- `WAIT_FAILED`, `DOWNLOAD_NOT_FOUND`, `VIEW_HTTP_ERROR`,
556
+ `WAIT_FAILED`, `CLI_COMMAND_UNAVAILABLE`, `DOWNLOAD_NOT_FOUND`, `VIEW_HTTP_ERROR`,
557
557
  `CONNECTION_TIMEOUT`, `CONNECTION_RESPONSE_TOO_LARGE`,
558
558
  `CONNECTION_REQUEST_FAILED`, `UPSTREAM_TOOL_ERROR`,
559
559
  `OPERATION_NOT_SUCCEEDED`, `STREAM_ITEM_INVALID`, `STREAM_FRAME_TOO_LARGE`,