@simplexai/localmodels-win32-x64 0.1.0-dev.103 → 0.1.0-dev.105

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 (172) hide show
  1. package/LICENSE +201 -0
  2. package/{modules/simplex_localmodels-0.1.0.dev103.dist-info/licenses/NOTICE → NOTICE} +42 -13
  3. package/README.md +10 -0
  4. package/bootstrap.identity +1 -1
  5. package/bootstrap.sha256 +159 -158
  6. package/modules/localmodels/__init__.py +1 -1
  7. package/modules/localmodels/__main__.py +204 -86
  8. package/modules/localmodels/apple_sensors.py +23 -0
  9. package/modules/localmodels/approval.py +25 -2
  10. package/modules/localmodels/catalog.json +584 -158
  11. package/modules/localmodels/catalog.py +18 -3
  12. package/modules/localmodels/catalog_recipes.py +64 -6
  13. package/modules/localmodels/cli_help.py +10 -0
  14. package/modules/localmodels/cli_parser.py +313 -230
  15. package/modules/localmodels/component.py +21 -3
  16. package/modules/localmodels/console.py +1 -1
  17. package/modules/localmodels/context_policy.py +6 -5
  18. package/modules/localmodels/custom_probe.py +4 -2
  19. package/modules/localmodels/debug_cli.py +0 -12
  20. package/modules/localmodels/debug_mode.py +0 -6
  21. package/modules/localmodels/decode_calibration.json +3 -4
  22. package/modules/localmodels/decode_calibration.py +5 -2
  23. package/modules/localmodels/deploy.py +11 -1
  24. package/modules/localmodels/deployment_lifecycle.py +1 -1
  25. package/modules/localmodels/download-mirrors.json +1 -1
  26. package/modules/localmodels/engine_adapters/base.py +11 -1
  27. package/modules/localmodels/engine_adapters/strata_poly.py +65 -3
  28. package/modules/localmodels/engine_adapters/suite_plan.py +61 -24
  29. package/modules/localmodels/engines-b11583.json +6 -26
  30. package/modules/localmodels/engines-b12588-mix-c0c3de8.json +3 -15
  31. package/modules/localmodels/engines-b12757-mix-ef2df21.json +3 -15
  32. package/modules/localmodels/engines-prism-b12178-03ec600.json +3 -15
  33. package/modules/localmodels/engines-speechcpp-v0.11.3.json +4 -20
  34. package/modules/localmodels/engines-strata-0.1.47.json +1 -5
  35. package/modules/localmodels/engines-strata-0.1.49.2.json +1 -5
  36. package/modules/localmodels/engines-strata-0.1.59.1.json +1 -5
  37. package/modules/localmodels/engines-strata-poly-0.2.20-poly.1.json +6 -30
  38. package/modules/localmodels/engines-strata-poly-0.2.20-poly.9.json +129 -0
  39. package/modules/localmodels/engines-whisper-b5454.json +6 -30
  40. package/modules/localmodels/engines.json +13 -61
  41. package/modules/localmodels/estimator.py +10 -5
  42. package/modules/localmodels/gpu_specs.py +1 -1
  43. package/modules/localmodels/host_sensors.py +25 -2
  44. package/modules/localmodels/hosts.py +38 -21
  45. package/modules/localmodels/kokoro-tts-0.6.1.txt +1 -1
  46. package/modules/localmodels/library_cli.py +34 -16
  47. package/modules/localmodels/library_custom.py +9 -1
  48. package/modules/localmodels/library_direct.py +41 -1
  49. package/modules/localmodels/library_elastic.py +135 -6
  50. package/modules/localmodels/library_jobs.py +23 -4
  51. package/modules/localmodels/library_kept.py +9 -1
  52. package/modules/localmodels/library_model.py +174 -2
  53. package/modules/localmodels/library_order.py +175 -69
  54. package/modules/localmodels/library_poly.py +150 -21
  55. package/modules/localmodels/library_presentation.py +485 -0
  56. package/modules/localmodels/library_pricing.py +15 -4
  57. package/modules/localmodels/library_serve.py +342 -70
  58. package/modules/localmodels/library_smoke.py +63 -5
  59. package/modules/localmodels/library_state.py +48 -10
  60. package/modules/localmodels/library_status.py +37 -17
  61. package/modules/localmodels/llm_rank.py +22 -11
  62. package/modules/localmodels/metal.py +1 -2
  63. package/modules/localmodels/plan_envelope.py +40 -13
  64. package/modules/localmodels/planning/budget.py +14 -12
  65. package/modules/localmodels/planning/memory_pools.py +7 -1
  66. package/modules/localmodels/privacy_acceptance.py +6 -5
  67. package/modules/localmodels/probe.py +34 -7
  68. package/modules/localmodels/py.typed +0 -0
  69. package/modules/localmodels/quant_formats.py +10 -3
  70. package/modules/localmodels/recommend_cli.py +1 -1
  71. package/modules/localmodels/records.py +19 -2
  72. package/modules/localmodels/remote_ops_launchd.py +8 -1
  73. package/modules/localmodels/remote_ops_verify.py +91 -24
  74. package/modules/localmodels/runtime_index.py +303 -0
  75. package/modules/localmodels/runtime_process.py +1 -1
  76. package/modules/localmodels/service_deployment.py +2 -4
  77. package/modules/localmodels/service_probe.py +59 -13
  78. package/modules/localmodels/setup_inspection.py +94 -73
  79. package/modules/localmodels/setup_text.py +7 -56
  80. package/modules/localmodels/sidecar_downloads.py +34 -0
  81. package/modules/localmodels/sidecar_http.py +61 -5
  82. package/modules/localmodels/sidecar_state.py +52 -2
  83. package/modules/localmodels/speech_admission.py +20 -4
  84. package/modules/localmodels/speech_catalog.py +23 -0
  85. package/modules/localmodels/speech_cli.py +30 -16
  86. package/modules/localmodels/speech_jobs.py +42 -17
  87. package/modules/localmodels/speech_serve.py +9 -2
  88. package/modules/localmodels/speech_server.py +185 -81
  89. package/modules/localmodels/speech_state.py +4 -1
  90. package/modules/localmodels/speech_workers.py +11 -0
  91. package/modules/localmodels/stack.py +1 -1
  92. package/modules/localmodels/stack_args.py +276 -145
  93. package/modules/localmodels/stack_auto.py +91 -6
  94. package/modules/localmodels/stack_aux_gpu.py +1 -1
  95. package/modules/localmodels/stack_cleanup.py +21 -18
  96. package/modules/localmodels/stack_cli.py +120 -115
  97. package/modules/localmodels/stack_compose.py +16 -5
  98. package/modules/localmodels/stack_debug.py +15 -6
  99. package/modules/localmodels/stack_decision.py +4 -4
  100. package/modules/localmodels/stack_doctor.py +2 -2
  101. package/modules/localmodels/stack_down.py +2 -0
  102. package/modules/localmodels/stack_events.py +1 -1
  103. package/modules/localmodels/stack_gpu_memory.py +1 -1
  104. package/modules/localmodels/stack_hardware.py +17 -15
  105. package/modules/localmodels/stack_mcp.py +1 -2
  106. package/modules/localmodels/stack_mlx.py +8 -1
  107. package/modules/localmodels/stack_picks.py +20 -21
  108. package/modules/localmodels/stack_plan.py +12 -11
  109. package/modules/localmodels/stack_ports.py +31 -4
  110. package/modules/localmodels/stack_review.py +28 -7
  111. package/modules/localmodels/stack_rollback.py +1 -1
  112. package/modules/localmodels/stack_run.py +1 -1
  113. package/modules/localmodels/stack_suite.py +72 -21
  114. package/modules/localmodels/stack_up.py +2 -0
  115. package/modules/localmodels/stack_view.py +180 -35
  116. package/modules/localmodels/stack_view_agent.py +1 -1
  117. package/modules/localmodels/stack_view_demo.py +2 -0
  118. package/modules/localmodels/stack_view_gpu.py +36 -2
  119. package/modules/localmodels/stack_view_schema.py +26 -3
  120. package/modules/localmodels/stack_view_serve.py +0 -2
  121. package/modules/localmodels/stack_view_slots.py +3 -1
  122. package/modules/localmodels/stack_view_telemetry.py +90 -4
  123. package/modules/localmodels/stack_view_tick.py +246 -40
  124. package/modules/localmodels/stack_view_words.py +9 -2
  125. package/modules/localmodels/stack_warm.py +2 -2
  126. package/modules/localmodels/stack_whatif.py +524 -41
  127. package/modules/localmodels/stack_whatif_html.py +900 -0
  128. package/modules/localmodels/startlux-decide-83fe6c7d.txt +2 -2
  129. package/modules/localmodels/{strata-poly-serve-0.2.20-poly.7.txt → strata-poly-serve-0.2.20-poly.9.txt} +1 -1
  130. package/modules/localmodels/strata_poly_server.py +114 -3
  131. package/modules/localmodels/suite.py +265 -6
  132. package/modules/localmodels/telemetry_math.py +458 -18
  133. package/modules/localmodels/transport.py +8 -1
  134. package/modules/localmodels/tts_admission.py +2 -17
  135. package/modules/localmodels/tts_catalog.py +29 -1
  136. package/modules/localmodels/tts_cli.py +45 -22
  137. package/modules/localmodels/tts_http.py +10 -4
  138. package/modules/localmodels/tts_jobs.py +49 -19
  139. package/modules/localmodels/tts_serve.py +9 -2
  140. package/modules/localmodels/tts_server.py +1 -1
  141. package/modules/localmodels/tts_sidecar.py +69 -28
  142. package/modules/localmodels/tts_state.py +7 -2
  143. package/modules/localmodels/vision.py +5 -3
  144. package/modules/localmodels/web/view/ASSET-SOURCES.md +4 -7
  145. package/modules/localmodels/web/view/view.css +0 -1
  146. package/modules/localmodels/web/view/view.js +2 -5
  147. package/modules/localmodels/web/whatif/app.js +730 -0
  148. package/modules/localmodels/web/whatif/page.html +1172 -0
  149. package/modules/localmodels/web/whatif/sim.js +297 -0
  150. package/modules/localmodels/win_probe.py +89 -16
  151. package/modules/localmodels/windows_job.py +179 -11
  152. package/modules/simplex_localmodels-0.1.0.dev105.dist-info/METADATA +14 -0
  153. package/modules/{simplex_localmodels-0.1.0.dev103.dist-info → simplex_localmodels-0.1.0.dev105.dist-info}/RECORD +151 -145
  154. package/modules/simplex_localmodels-0.1.0.dev105.dist-info/licenses/LICENSE +201 -0
  155. package/modules/simplex_localmodels-0.1.0.dev105.dist-info/licenses/NOTICE +126 -0
  156. package/package.json +11 -2
  157. package/tool.json +1 -1
  158. package/modules/localmodels/engines-strata-poly-0.2.20-poly.7.json +0 -94
  159. package/modules/localmodels/fixtures/stack-research-demo-plan.json +0 -1059
  160. package/modules/localmodels/stack_research.py +0 -716
  161. package/modules/localmodels/stack_research_demo.py +0 -125
  162. package/modules/localmodels/stack_research_plan.py +0 -146
  163. package/modules/localmodels/web/index.html +0 -2605
  164. package/modules/localmodels/web/sizecalc/app.js +0 -1306
  165. package/modules/localmodels/web/sizecalc/calc.js +0 -269
  166. package/modules/localmodels/web/sizecalc/page.html +0 -520
  167. package/modules/localmodels/web/view/logo-claude.svg +0 -3
  168. package/modules/localmodels/web/view/logo-codex.png +0 -0
  169. package/modules/simplex_localmodels-0.1.0.dev103.dist-info/METADATA +0 -9
  170. /package/modules/{simplex_localmodels-0.1.0.dev103.dist-info → simplex_localmodels-0.1.0.dev105.dist-info}/WHEEL +0 -0
  171. /package/modules/{simplex_localmodels-0.1.0.dev103.dist-info → simplex_localmodels-0.1.0.dev105.dist-info}/entry_points.txt +0 -0
  172. /package/modules/{simplex_localmodels-0.1.0.dev103.dist-info → simplex_localmodels-0.1.0.dev105.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
@@ -3,32 +3,57 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import argparse
6
+ import importlib
6
7
  from typing import TypeAlias
7
8
 
8
- from localmodels import (
9
- __version__,
10
- catalog_add,
11
- cli_help,
12
- debug_cli,
13
- deploy,
14
- guard,
15
- hosts,
16
- install,
17
- library_cli,
18
- memcalc_cli,
19
- runtime_args,
20
- services_cli,
21
- setup_inspection,
22
- sizecalc_cli,
23
- speech_cli,
24
- stack_args,
25
- stack_lifecycle,
26
- tts_cli,
27
- )
28
- from localmodels.stack_plan import command
9
+ from localmodels import __version__, cli_help
29
10
 
30
11
  Parsers: TypeAlias = "argparse._SubParsersAction[argparse.ArgumentParser]"
31
12
 
13
+ COMMAND_HELPS: dict[str, str] = {
14
+ "discover": "find candidate devices: ssh_config, Tailscale, mDNS",
15
+ "desktop-snapshot": "the native workbench summary as JSON; --refresh probes",
16
+ "devices": "registered devices; `devices remove ID` forgets one",
17
+ "models": "catalog LLMs and task components, status and license",
18
+ "probe": "read-only hardware probe; prints the facts JSON",
19
+ "recommend": "what fits a host: default stack, model fits",
20
+ "catalog": "maintain the model catalog (`add` drafts an entry from a GGUF)",
21
+ "install": "guided install: plan, confirm, apply with live progress",
22
+ "services": "a host's deployment records",
23
+ "plan": "one model's deployment plan for a host (read-only)",
24
+ "deploy": "deploy one model: print and save the plan; --approve ID runs it",
25
+ "service": "start, stop, status or remove one deployed service",
26
+ "serve": "the local settings page and JSON API",
27
+ "tui": "terminal UI over these commands (needs a terminal)",
28
+ "commands": "every command and option, as text or JSON",
29
+ "completion": "shell completion script (bash, zsh)",
30
+ "guard": "optional CPU privacy profile; never rewires services",
31
+ "stack": "the local agent stack: plan, install, operate, remove",
32
+ "memcalc": "memory per context length for any model (read-only)",
33
+ "sizecalc": "weight file, memory and device class from params and quant (offline)",
34
+ "harness": "inspect and install native agent runtimes (Codex, Claude Code, pi)",
35
+ "setup": "read-only hardware and local-model setup inspection for installers (JSON)",
36
+ "foundations": "background decision, embedding and reranker services",
37
+ "library": "download, load, unload and remove single models (JSON)",
38
+ "speech": "manage local speech-to-text models and runtime preferences (JSON)",
39
+ "tts": "manage local text-to-speech models, voices, and runtime preferences (JSON)",
40
+ "debug": "toggle simulate or tiny debug mode for fast testing and E2E",
41
+ }
42
+ _MODULE_PARSERS: dict[str, str] = {
43
+ "catalog": "catalog_add",
44
+ "install": "install",
45
+ "guard": "guard",
46
+ "memcalc": "memcalc_cli",
47
+ "sizecalc": "sizecalc_cli",
48
+ "harness": "runtime_args",
49
+ "setup": "setup_inspection",
50
+ "foundations": "services_cli",
51
+ "library": "library_cli",
52
+ "speech": "speech_cli",
53
+ "tts": "tts_cli",
54
+ "debug": "debug_cli",
55
+ }
56
+
32
57
  DESCRIPTION = """\
33
58
  Detect this computer's hardware and existing installs, recommend one proven local model
34
59
  stack, and install and verify it after you approve the plan.
@@ -99,223 +124,290 @@ SECTIONS = (
99
124
  def _host(p: argparse.ArgumentParser, *, optional: bool = True) -> None:
100
125
  help_text = "local (default), a registered device id, or an SSH target"
101
126
  if optional:
102
- p.add_argument("host", nargs="?", default=hosts.LOCAL_ID, metavar="HOST", help=help_text)
127
+ p.add_argument("host", nargs="?", default=cli_help.LOCAL_ID, metavar="HOST", help=help_text)
103
128
  else:
104
129
  p.add_argument("host", metavar="HOST", help=help_text.replace(" (default)", ""))
105
130
 
106
131
 
107
- def _devices(sub: Parsers) -> None:
108
- found = sub.add_parser("discover", help="find candidate devices: ssh_config, Tailscale, mDNS")
109
- cli_help.document(
110
- found,
111
- "List devices this computer can reach, from ~/.ssh/config, Tailscale and mDNS. "
112
- "Read-only; nothing is registered.",
113
- examples=[("%(prog)s", "")],
114
- )
115
- snapshot = sub.add_parser(
116
- "desktop-snapshot", help="the native workbench summary as JSON; --refresh probes"
117
- )
118
- snapshot.add_argument(
119
- "--refresh", action="store_true", help="run the existing read-only local host probe"
120
- )
121
- cli_help.document(
122
- snapshot,
123
- "Print the developer workbench summary as JSON. Exit 1 when no local snapshot exists.",
124
- )
125
- devices = sub.add_parser("devices", help="registered devices; `devices remove ID` forgets one")
126
- devices_sub = devices.add_subparsers(dest="devices_command", metavar="COMMAND")
127
- listed = devices_sub.add_parser("list", help="list devices (the default)")
128
- cli_help.document(listed, "List registered devices: id, label, target and last probe.")
129
- remove = devices_sub.add_parser("remove", help="forget a registered device")
130
- remove.add_argument("id", metavar="ID", help="device id to remove")
131
- cli_help.document(
132
- remove,
133
- "Forget a registered device. Its cached facts and deployment records stay in the state "
134
- "directory; nothing on the device changes. `local` cannot be removed.",
135
- examples=[("%(prog)s lab-241", "")],
136
- )
137
- cli_help.document(
138
- devices,
139
- "List registered devices with their last probe. `remove ID` forgets a device; its "
140
- "cached facts and deployment records stay in the state directory.",
141
- examples=[("%(prog)s", ""), ("%(prog)s remove lab-241", "")],
142
- )
143
-
144
-
145
- def _inspect(sub: Parsers) -> None:
146
- models = sub.add_parser("models", help="catalog LLMs and task components, status and license")
147
- cli_help.document(
148
- models,
149
- "List the catalog: LLMs (their id is what `plan`, `deploy` and `stack plan --llm` "
150
- "take) and the task components the stack installs, with status and license.",
151
- examples=[("%(prog)s", "")],
152
- )
153
- probe = sub.add_parser("probe", help="read-only hardware probe; prints the facts JSON")
154
- _host(probe)
155
- probe.add_argument(
156
- "--measure-bandwidth",
157
- action="store_true",
158
- help="also time a ~1 s single-thread host-memory copy (256 MiB, no GPU) and "
159
- "record facts.memory_bandwidth",
160
- )
161
- cli_help.document(
162
- probe,
163
- "Probe a host read-only (GPUs, RAM, disk, engines, services, ports) and print the facts "
164
- "JSON; the facts are cached for `recommend` and plans. SSH targets are registered on "
165
- "their first successful probe.",
166
- examples=[("%(prog)s", "this computer"), ("%(prog)s lab-241", "an SSH host")],
167
- )
168
- recommend = sub.add_parser("recommend", help="what fits a host: default stack, model fits")
169
- _host(recommend)
170
- recommend.add_argument(
171
- "--refresh", action="store_true", help="probe fresh host facts before recommending"
172
- )
173
- recommend.add_argument(
174
- "--all",
175
- action="store_true",
176
- dest="all_models",
177
- help="also show the full catalog, alternatives and detailed evidence",
178
- )
179
- cli_help.document(
180
- recommend,
181
- "Read-only: the default stack for this hardware snapshot and why; --all adds how every "
182
- "catalog LLM fits, the alternatives and the detailed evidence. Uses cached facts unless "
183
- "--refresh. Estimates, not measurements; `stack plan` re-checks everything.",
184
- examples=[
185
- ("%(prog)s", "the default stack, briefly"),
186
- ("%(prog)s --refresh", "probe first"),
187
- ("%(prog)s --all", "plus the full catalog, alternatives and evidence"),
188
- ],
189
- )
132
+ def _devices(sub: Parsers, only: str | None = None) -> None:
133
+ if only in (None, "discover"):
134
+ found = sub.add_parser("discover", help=COMMAND_HELPS["discover"])
135
+ cli_help.document(
136
+ found,
137
+ "List devices this computer can reach, from ~/.ssh/config, Tailscale and mDNS. "
138
+ "Read-only; nothing is registered.",
139
+ examples=[("%(prog)s", "")],
140
+ )
141
+ if only in (None, "desktop-snapshot"):
142
+ snapshot = sub.add_parser("desktop-snapshot", help=COMMAND_HELPS["desktop-snapshot"])
143
+ snapshot.add_argument(
144
+ "--refresh", action="store_true", help="run the existing read-only local host probe"
145
+ )
146
+ cli_help.document(
147
+ snapshot,
148
+ "Print the developer workbench summary as JSON. Exit 1 when no local snapshot exists.",
149
+ )
150
+ if only in (None, "devices"):
151
+ devices = sub.add_parser("devices", help=COMMAND_HELPS["devices"])
152
+ devices_sub = devices.add_subparsers(dest="devices_command", metavar="COMMAND")
153
+ listed = devices_sub.add_parser("list", help="list devices (the default)")
154
+ cli_help.document(listed, "List registered devices: id, label, target and last probe.")
155
+ remove = devices_sub.add_parser("remove", help="forget a registered device")
156
+ remove.add_argument("id", metavar="ID", help="device id to remove")
157
+ cli_help.document(
158
+ remove,
159
+ "Forget a registered device. Its cached facts and deployment records stay in the state "
160
+ "directory; nothing on the device changes. `local` cannot be removed.",
161
+ examples=[("%(prog)s gpu-host", "")],
162
+ )
163
+ cli_help.document(
164
+ devices,
165
+ "List registered devices with their last probe. `remove ID` forgets a device; its "
166
+ "cached facts and deployment records stay in the state directory.",
167
+ examples=[("%(prog)s", ""), ("%(prog)s remove gpu-host", "")],
168
+ )
190
169
 
191
170
 
192
- def _single(sub: Parsers) -> None:
193
- services = sub.add_parser("services", help="a host's deployment records")
194
- _host(services)
195
- cli_help.document(services, "List a host's deployment records: name, model, URL, result.")
196
- for name in ("plan", "deploy"):
197
- p = sub.add_parser(
198
- name,
199
- help="one model's deployment plan for a host (read-only)"
200
- if name == "plan"
201
- else "deploy one model: print and save the plan; --approve ID runs it",
171
+ def _inspect(sub: Parsers, only: str | None = None) -> None:
172
+ if only in (None, "models"):
173
+ models = sub.add_parser("models", help=COMMAND_HELPS["models"])
174
+ cli_help.document(
175
+ models,
176
+ "List the catalog: LLMs (their id is what `plan`, `deploy` and `stack plan --llm` "
177
+ "take) and the task components the stack installs, with status and license.",
178
+ examples=[("%(prog)s", "")],
202
179
  )
203
- _host(p, optional=False)
204
- p.add_argument("model_id", metavar="MODEL", help="catalog model id; see `models`")
205
- p.add_argument(
206
- "--placement",
207
- default="auto",
208
- metavar="ID",
209
- help="auto, cpu (single-model RAM budget), or a GPU placement id from `recommend`",
180
+ if only in (None, "probe"):
181
+ probe = sub.add_parser("probe", help=COMMAND_HELPS["probe"])
182
+ _host(probe)
183
+ probe.add_argument(
184
+ "--measure-bandwidth",
185
+ action="store_true",
186
+ help="also time a ~1 s single-thread host-memory copy (256 MiB, no GPU) and "
187
+ "record facts.memory_bandwidth",
210
188
  )
211
- p.add_argument(
212
- "--port",
213
- type=int,
214
- default=deploy.DEFAULT_PORT,
215
- metavar="PORT",
216
- help="port the model serves on (default %(default)s)",
189
+ cli_help.document(
190
+ probe,
191
+ "Probe a host read-only (GPUs, RAM, disk, engines, services, ports) and print the facts "
192
+ "JSON; the facts are cached for `recommend` and plans. SSH targets are registered on "
193
+ "their first successful probe.",
194
+ examples=[("%(prog)s", "this computer"), ("%(prog)s gpu-host", "an SSH host")],
217
195
  )
218
- p.add_argument(
219
- "--bind", default="127.0.0.1", metavar="ADDR", help="listen address (default 127.0.0.1)"
196
+ if only in (None, "recommend"):
197
+ recommend = sub.add_parser("recommend", help=COMMAND_HELPS["recommend"])
198
+ _host(recommend)
199
+ recommend.add_argument(
200
+ "--refresh", action="store_true", help="probe fresh host facts before recommending"
220
201
  )
221
- p.add_argument(
222
- "--hf-endpoint",
223
- default=deploy.hf_endpoint(),
224
- metavar="URL",
225
- help="where the host downloads weights from (default: $HF_ENDPOINT, else Hugging "
226
- "Face); other sources of the same pinned files are still tried, China-first in "
227
- "download region cn",
202
+ recommend.add_argument(
203
+ "--all",
204
+ action="store_true",
205
+ dest="all_models",
206
+ help="also show the full catalog, alternatives and detailed evidence",
228
207
  )
229
- p.add_argument(
230
- "--engine-path", metavar="PATH", help="reuse a llama-server already on the host"
208
+ cli_help.document(
209
+ recommend,
210
+ "Read-only: the default stack for this hardware snapshot and why; --all adds how every "
211
+ "catalog LLM fits, the alternatives and the detailed evidence. Uses cached facts unless "
212
+ "--refresh. Estimates, not measurements; `stack plan` re-checks everything.",
213
+ examples=[
214
+ ("%(prog)s", "the default stack, briefly"),
215
+ ("%(prog)s --refresh", "probe first"),
216
+ ("%(prog)s --all", "plus the full catalog, alternatives and evidence"),
217
+ ],
231
218
  )
232
- if name == "plan":
219
+
220
+
221
+ def _single(sub: Parsers, only: str | None = None) -> None:
222
+ if only in (None, "services"):
223
+ services = sub.add_parser("services", help=COMMAND_HELPS["services"])
224
+ _host(services)
225
+ cli_help.document(services, "List a host's deployment records: name, model, URL, result.")
226
+ plan_names = [n for n in ("plan", "deploy") if only in (None, n)]
227
+ if plan_names:
228
+ from localmodels import deploy
229
+
230
+ for name in plan_names:
231
+ p = sub.add_parser(name, help=COMMAND_HELPS[name])
232
+ _host(p, optional=False)
233
+ p.add_argument("model_id", metavar="MODEL", help="catalog model id; see `models`")
234
+ p.add_argument(
235
+ "--placement",
236
+ default="auto",
237
+ metavar="ID",
238
+ help="auto, cpu (single-model RAM budget), or a GPU placement id from `recommend`",
239
+ )
240
+ p.add_argument(
241
+ "--port",
242
+ type=int,
243
+ default=deploy.DEFAULT_PORT,
244
+ metavar="PORT",
245
+ help="port the model serves on (default %(default)s)",
246
+ )
247
+ p.add_argument(
248
+ "--bind",
249
+ default="127.0.0.1",
250
+ metavar="ADDR",
251
+ help="listen address (default 127.0.0.1)",
252
+ )
253
+ p.add_argument(
254
+ "--hf-endpoint",
255
+ default=deploy.hf_endpoint(),
256
+ metavar="URL",
257
+ help="where the host downloads weights from (default: $HF_ENDPOINT, else Hugging "
258
+ "Face); other sources of the same pinned files are still tried, China-first in "
259
+ "download region cn",
260
+ )
261
+ p.add_argument(
262
+ "--engine-path", metavar="PATH", help="reuse a llama-server already on the host"
263
+ )
264
+ if name == "plan":
265
+ cli_help.document(
266
+ p,
267
+ "Build one model's deployment plan for HOST and print it as JSON. Read-only.",
268
+ examples=[("%(prog)s local qwen3.8-27b", "")],
269
+ )
270
+ continue
271
+ p.add_argument(
272
+ "--approve",
273
+ metavar="ID",
274
+ help="execute the saved plan with this id once a re-probe still matches it",
275
+ )
276
+ p.add_argument(
277
+ "--share-gpu",
278
+ action="store_true",
279
+ help="the plan's GPU already runs another program; share it",
280
+ )
281
+ p.add_argument(
282
+ "--yes",
283
+ action="store_true",
284
+ help="deprecated: plan again and execute at once; use --approve",
285
+ )
233
286
  cli_help.document(
234
287
  p,
235
- "Build one model's deployment plan for HOST and print it as JSON. Read-only.",
236
- examples=[("%(prog)s local qwen3.8-27b", "")],
288
+ "Without --approve: print and save the plan, then the exact command that runs it. "
289
+ "With --approve ID: re-probe, refuse if the plan changed, then download, install, "
290
+ "start and verify with live progress on a terminal.",
291
+ examples=[
292
+ ("%(prog)s local qwen3.8-27b", "print and save the plan"),
293
+ ("%(prog)s local qwen3.8-27b --approve ID", "run that plan"),
294
+ ],
295
+ sections=[("exit status", "0 planned or deployed · 1 failed or refused")],
237
296
  )
238
- continue
239
- p.add_argument(
240
- "--approve",
241
- metavar="ID",
242
- help="execute the saved plan with this id once a re-probe still matches it",
297
+ if only in (None, "service"):
298
+ from localmodels import stack_lifecycle
299
+
300
+ service = sub.add_parser("service", help=COMMAND_HELPS["service"])
301
+ _host(service, optional=False)
302
+ service.add_argument("name", metavar="NAME", help="deployment name; see `services`")
303
+ service.add_argument(
304
+ "action", choices=("start", "stop", "status", "remove"), help="what to do with it"
243
305
  )
244
- p.add_argument(
245
- "--share-gpu",
246
- action="store_true",
247
- help="the plan's GPU already runs another program; share it",
306
+ stack_lifecycle.add_purge_flags(service)
307
+ cli_help.document(
308
+ service,
309
+ "Act on one deployment by name. remove keeps model files unless --purge.",
310
+ examples=[
311
+ ("%(prog)s local NAME status", ""),
312
+ ("%(prog)s local NAME remove --purge", ""),
313
+ ],
248
314
  )
249
- p.add_argument(
250
- "--yes",
251
- action="store_true",
252
- help="deprecated: plan again and execute at once; use --approve",
315
+
316
+
317
+ def _interfaces(sub: Parsers, only: str | None = None) -> None:
318
+ if only in (None, "serve"):
319
+ serve = sub.add_parser("serve", help=COMMAND_HELPS["serve"])
320
+ serve.add_argument(
321
+ "--port",
322
+ type=int,
323
+ default=8765,
324
+ metavar="PORT",
325
+ help="port on 127.0.0.1 (default 8765)",
326
+ )
327
+ cli_help.document(serve, "Serve the settings page and JSON API on 127.0.0.1.")
328
+ if only in (None, "tui"):
329
+ tui = sub.add_parser("tui", help=COMMAND_HELPS["tui"])
330
+ cli_help.document(tui, "Full-screen terminal UI over the same plans and approval gate.")
331
+ if only in (None, "commands"):
332
+ listing = sub.add_parser("commands", help=COMMAND_HELPS["commands"])
333
+ listing.add_argument(
334
+ "--json", action="store_true", help="the tree as localmodels.cli-commands/v1"
335
+ )
336
+ listing.add_argument(
337
+ "path", nargs="*", metavar="COMMAND", help="only this command's subtree, e.g. stack"
253
338
  )
254
339
  cli_help.document(
255
- p,
256
- "Without --approve: print and save the plan, then the exact command that runs it. "
257
- "With --approve ID: re-probe, refuse if the plan changed, then download, install, "
258
- "start and verify with live progress on a terminal.",
340
+ listing,
341
+ "List every runnable command with its summary. --json adds usage, each option (flags, "
342
+ "value, default, choices, help) and the examples: one call to learn the whole CLI.",
259
343
  examples=[
260
- ("%(prog)s local qwen3.8-27b", "print and save the plan"),
261
- ("%(prog)s local qwen3.8-27b --approve ID", "run that plan"),
344
+ ("%(prog)s", ""),
345
+ ("%(prog)s stack", "only the stack subtree"),
346
+ ("%(prog)s --json", f"{cli_help.SCHEMA}"),
347
+ ],
348
+ )
349
+ if only in (None, "completion"):
350
+ shells = sub.add_parser("completion", help=COMMAND_HELPS["completion"])
351
+ shells.add_argument("shell", choices=("bash", "zsh"), help="the shell to complete for")
352
+ cli_help.document(
353
+ shells,
354
+ "Print a completion script for commands, options and option choices, generated from "
355
+ "this version's command tree. Add the eval line to ~/.bashrc or ~/.zshrc.",
356
+ examples=[
357
+ ('eval "$(localmodels completion bash)"', "this shell, now"),
358
+ ("localmodels completion zsh >> ~/.zshrc", "every new zsh"),
262
359
  ],
263
- sections=[("exit status", "0 planned or deployed · 1 failed or refused")],
264
360
  )
265
- service = sub.add_parser("service", help="start, stop, status or remove one deployed service")
266
- _host(service, optional=False)
267
- service.add_argument("name", metavar="NAME", help="deployment name; see `services`")
268
- service.add_argument(
269
- "action", choices=("start", "stop", "status", "remove"), help="what to do with it"
270
- )
271
- stack_lifecycle.add_purge_flags(service)
272
- cli_help.document(
273
- service,
274
- "Act on one deployment by name. remove keeps model files unless --purge.",
275
- examples=[("%(prog)s local NAME status", ""), ("%(prog)s local NAME remove --purge", "")],
276
- )
277
361
 
278
362
 
279
- def _interfaces(sub: Parsers) -> None:
280
- serve = sub.add_parser("serve", help="the local settings page and JSON API")
281
- serve.add_argument(
282
- "--port", type=int, default=8765, metavar="PORT", help="port on 127.0.0.1 (default 8765)"
283
- )
284
- cli_help.document(serve, "Serve the settings page and JSON API on 127.0.0.1.")
285
- tui = sub.add_parser("tui", help="terminal UI over these commands (needs a terminal)")
286
- cli_help.document(tui, "Full-screen terminal UI over the same plans and approval gate.")
287
- listing = sub.add_parser("commands", help="every command and option, as text or JSON")
288
- listing.add_argument(
289
- "--json", action="store_true", help="the tree as localmodels.cli-commands/v1"
290
- )
291
- listing.add_argument(
292
- "path", nargs="*", metavar="COMMAND", help="only this command's subtree, e.g. stack"
293
- )
294
- shells = sub.add_parser("completion", help="shell completion script (bash, zsh)")
295
- shells.add_argument("shell", choices=("bash", "zsh"), help="the shell to complete for")
296
- cli_help.document(
297
- shells,
298
- "Print a completion script for commands, options and option choices, generated from "
299
- "this version's command tree. Add the eval line to ~/.bashrc or ~/.zshrc.",
300
- examples=[
301
- ('eval "$(localmodels completion bash)"', "this shell, now"),
302
- ("localmodels completion zsh >> ~/.zshrc", "every new zsh"),
303
- ],
304
- )
305
- cli_help.document(
306
- listing,
307
- "List every runnable command with its summary. --json adds usage, each option (flags, "
308
- "value, default, choices, help) and the examples: one call to learn the whole CLI.",
309
- examples=[
310
- ("%(prog)s", ""),
311
- ("%(prog)s stack", "only the stack subtree"),
312
- ("%(prog)s --json", f"{cli_help.SCHEMA}"),
313
- ],
314
- )
363
+ def _register_full(sub: Parsers) -> None:
364
+ _devices(sub)
365
+ _inspect(sub)
366
+ importlib.import_module("localmodels.catalog_add").add_parser(sub)
367
+ importlib.import_module("localmodels.install").add_parser(sub)
368
+ _single(sub)
369
+ _interfaces(sub)
370
+ importlib.import_module("localmodels.guard").add_parser(sub)
371
+ importlib.import_module("localmodels.stack_args").add_parser(sub)
372
+ for name in (
373
+ "memcalc",
374
+ "sizecalc",
375
+ "harness",
376
+ "setup",
377
+ "foundations",
378
+ "library",
379
+ "speech",
380
+ "tts",
381
+ "debug",
382
+ ):
383
+ importlib.import_module(f"localmodels.{_MODULE_PARSERS[name]}").add_parser(sub)
384
+
315
385
 
386
+ def _register_one(sub: Parsers, command_name: str, subcommand: str | None) -> None:
387
+ if command_name in ("discover", "desktop-snapshot", "devices"):
388
+ _devices(sub, only=command_name)
389
+ elif command_name in ("models", "probe", "recommend"):
390
+ _inspect(sub, only=command_name)
391
+ elif command_name in ("services", "plan", "deploy", "service"):
392
+ _single(sub, only=command_name)
393
+ elif command_name in ("serve", "tui", "commands", "completion"):
394
+ _interfaces(sub, only=command_name)
395
+ elif command_name == "stack":
396
+ from localmodels import stack_args
316
397
 
317
- def argument_parser() -> argparse.ArgumentParser:
318
- parser: argparse.ArgumentParser = cli_help.Parser(prog=command(), description=DESCRIPTION)
398
+ stack_args.add_parser(sub, only=subcommand)
399
+ elif (mod_name := _MODULE_PARSERS.get(command_name)) is not None:
400
+ importlib.import_module(f"localmodels.{mod_name}").add_parser(sub)
401
+
402
+
403
+ def argument_parser(
404
+ only: str | None = None,
405
+ *,
406
+ subcommand: str | None = None,
407
+ ) -> argparse.ArgumentParser:
408
+ parser: argparse.ArgumentParser = cli_help.Parser(
409
+ prog=cli_help.command(), description=DESCRIPTION
410
+ )
319
411
  parser.add_argument(
320
412
  "--version",
321
413
  action="version",
@@ -330,25 +422,16 @@ def argument_parser() -> argparse.ArgumentParser:
330
422
  "(default: $SIMPLEX_REGION, else the saved or probed region)",
331
423
  )
332
424
  sub = parser.add_subparsers(dest="command", required=True, metavar="COMMAND")
333
- _devices(sub)
334
- _inspect(sub)
335
- catalog_add.add_parser(sub)
336
- install.add_parser(sub)
337
- _single(sub)
338
- _interfaces(sub)
339
- guard.add_parser(sub)
340
- stack_args.add_parser(sub)
341
- memcalc_cli.add_parser(sub)
342
- sizecalc_cli.add_parser(sub)
343
- runtime_args.add_parser(sub)
344
- setup_inspection.add_parser(sub)
345
- services_cli.add_parser(sub)
346
- library_cli.add_parser(sub)
347
- speech_cli.add_parser(sub)
348
- tts_cli.add_parser(sub)
349
- debug_cli.add_parser(sub)
425
+ if only == "__help__":
426
+ for name, help_text in COMMAND_HELPS.items():
427
+ sub.add_parser(name, help=help_text)
428
+ elif only is not None and only in COMMAND_HELPS:
429
+ _register_one(sub, only, subcommand)
430
+ else:
431
+ _register_full(sub)
350
432
  for name, summary in SUMMARIES.items():
351
- cli_help.summarize(sub, name, summary)
433
+ if name in sub.choices:
434
+ cli_help.summarize(sub, name, summary)
352
435
  cli_help.document(parser, DESCRIPTION, sections=SECTIONS)
353
436
  cli_help.group_commands(parser, GROUPS)
354
437
  return parser
@@ -1,6 +1,6 @@
1
1
  """llama-server plans for Jev-like decision models (catalog components with task "decision").
2
2
 
3
- A decision model shares the LLM's card (AGENTS.md: on a CPU one request takes seconds instead of
3
+ A decision model shares the LLM's card (on a CPU one request takes seconds instead of
4
4
  tens of milliseconds, which forfeits the System One role). ``gpu_plan`` is that deployment; the CPU
5
5
  ``build_plan`` remains for the offline QA run on a computer without a GPU, which no command-line
6
6
  option reaches. A StartLux Instant model is two plans: llama-server reading the non-causal GGUF on
@@ -166,7 +166,14 @@ def build_plan(host_id: str, facts: HostFacts, options: ComponentOptions) -> Pla
166
166
  "LD_LIBRARY_PATH": engine.get("dir") or engine["binary"].rsplit("/", 1)[0],
167
167
  },
168
168
  },
169
- endpoint={"model": recipe["alias"], "contract": recipe["contract"]},
169
+ endpoint={
170
+ "model": recipe["alias"],
171
+ "contract": recipe["contract"],
172
+ "health_path": "/health",
173
+ "slots_path": None,
174
+ "metrics_path": "/metrics",
175
+ "metrics_requires_auth": True,
176
+ },
170
177
  warnings=warnings,
171
178
  )
172
179
 
@@ -380,6 +387,10 @@ def gpu_plan(
380
387
  endpoint={
381
388
  "model": recipe["alias"],
382
389
  "contract": "health" if fronted else recipe["contract"],
390
+ "health_path": "/health",
391
+ "slots_path": None,
392
+ "metrics_path": "/metrics",
393
+ "metrics_requires_auth": not fronted,
383
394
  },
384
395
  warnings=warnings,
385
396
  )
@@ -495,6 +506,13 @@ def front_plan(
495
506
  # per-request bidirectional prompt, which a stock llama-server rejects.
496
507
  "env": {"CUDA_VISIBLE_DEVICES": "", "STARTLUX_LLAMACPP_BIDIR": "server"},
497
508
  },
498
- endpoint={"model": recipe["alias"], "contract": "systemone"},
509
+ endpoint={
510
+ "model": recipe["alias"],
511
+ "contract": "systemone",
512
+ "health_path": "/health",
513
+ "slots_path": None,
514
+ "metrics_path": None,
515
+ "metrics_requires_auth": False,
516
+ },
499
517
  warnings=[],
500
518
  )