@simplexai/localmodels-darwin-x64 0.1.0-dev.102 → 0.1.0-dev.104

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 (153) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +126 -0
  3. package/README.md +10 -0
  4. package/bootstrap.identity +1 -1
  5. package/bootstrap.sha256 +139 -121
  6. package/modules/localmodels/__init__.py +1 -1
  7. package/modules/localmodels/__main__.py +3 -1
  8. package/modules/localmodels/catalog.json +435 -127
  9. package/modules/localmodels/catalog.py +7 -3
  10. package/modules/localmodels/catalog_recipes.py +3 -3
  11. package/modules/localmodels/cli_parser.py +7 -3
  12. package/modules/localmodels/component.py +1 -1
  13. package/modules/localmodels/console.py +1 -1
  14. package/modules/localmodels/context_policy.py +6 -5
  15. package/modules/localmodels/debug_cli.py +0 -12
  16. package/modules/localmodels/debug_mode.py +0 -6
  17. package/modules/localmodels/debug_stub_server.py +280 -7
  18. package/modules/localmodels/decode_calibration.json +3 -4
  19. package/modules/localmodels/decode_calibration.py +5 -2
  20. package/modules/localmodels/deployment_lifecycle.py +1 -1
  21. package/modules/localmodels/download-mirrors.json +77 -1
  22. package/modules/localmodels/engine_adapters/base.py +11 -1
  23. package/modules/localmodels/engine_adapters/strata_poly.py +65 -3
  24. package/modules/localmodels/engine_adapters/suite_plan.py +57 -20
  25. package/modules/localmodels/engines-b11583.json +6 -26
  26. package/modules/localmodels/engines-b12588-mix-c0c3de8.json +3 -15
  27. package/modules/localmodels/engines-b12757-mix-ef2df21.json +3 -15
  28. package/modules/localmodels/engines-prism-b12178-03ec600.json +3 -15
  29. package/modules/localmodels/engines-speechcpp-v0.11.3.json +68 -0
  30. package/modules/localmodels/engines-strata-0.1.47.json +1 -5
  31. package/modules/localmodels/engines-strata-0.1.49.2.json +1 -5
  32. package/modules/localmodels/engines-strata-0.1.59.1.json +1 -5
  33. package/modules/localmodels/engines-strata-poly-0.2.20-poly.1.json +6 -30
  34. package/modules/localmodels/engines-strata-poly-0.2.20-poly.9.json +129 -0
  35. package/modules/localmodels/engines-whisper-b5454.json +6 -30
  36. package/modules/localmodels/engines.json +13 -61
  37. package/modules/localmodels/estimator.py +10 -5
  38. package/modules/localmodels/gpu_specs.py +1 -1
  39. package/modules/localmodels/hosts.py +12 -16
  40. package/modules/localmodels/kokoro-tts-0.6.1.txt +1 -1
  41. package/modules/localmodels/library_elastic.py +135 -6
  42. package/modules/localmodels/library_kept.py +9 -1
  43. package/modules/localmodels/library_model.py +28 -1
  44. package/modules/localmodels/library_poly.py +109 -11
  45. package/modules/localmodels/library_pricing.py +12 -3
  46. package/modules/localmodels/library_serve.py +162 -75
  47. package/modules/localmodels/library_smoke.py +63 -5
  48. package/modules/localmodels/library_state.py +3 -2
  49. package/modules/localmodels/library_status.py +8 -1
  50. package/modules/localmodels/llm_rank.py +13 -8
  51. package/modules/localmodels/metal.py +1 -2
  52. package/modules/localmodels/plan_envelope.py +29 -11
  53. package/modules/localmodels/planning/budget.py +14 -12
  54. package/modules/localmodels/planning/memory_pools.py +7 -1
  55. package/modules/localmodels/privacy_acceptance.py +6 -5
  56. package/modules/localmodels/py.typed +0 -0
  57. package/modules/localmodels/quant_formats.py +1 -1
  58. package/modules/localmodels/recommend_cli.py +1 -1
  59. package/modules/localmodels/remote_ops_common.py +12 -2
  60. package/modules/localmodels/remote_ops_launchd.py +8 -1
  61. package/modules/localmodels/runtime_process.py +1 -1
  62. package/modules/localmodels/service_deployment.py +2 -4
  63. package/modules/localmodels/service_probe.py +59 -13
  64. package/modules/localmodels/setup_inspection.py +72 -70
  65. package/modules/localmodels/setup_text.py +7 -56
  66. package/modules/localmodels/sidecar_downloads.py +460 -0
  67. package/modules/localmodels/sidecar_http.py +452 -0
  68. package/modules/localmodels/sidecar_state.py +516 -0
  69. package/modules/localmodels/speech_admission.py +33 -4
  70. package/modules/localmodels/speech_catalog.py +23 -0
  71. package/modules/localmodels/speech_cli.py +10 -2
  72. package/modules/localmodels/speech_jobs.py +120 -384
  73. package/modules/localmodels/speech_server.py +187 -77
  74. package/modules/localmodels/speech_state.py +90 -454
  75. package/modules/localmodels/speech_workers.py +51 -162
  76. package/modules/localmodels/stack.py +18 -0
  77. package/modules/localmodels/stack_args.py +6 -6
  78. package/modules/localmodels/stack_auto.py +1 -1
  79. package/modules/localmodels/stack_aux_gpu.py +1 -1
  80. package/modules/localmodels/stack_cleanup.py +21 -18
  81. package/modules/localmodels/stack_cli.py +6 -2
  82. package/modules/localmodels/stack_compose.py +11 -4
  83. package/modules/localmodels/stack_debug.py +1 -2
  84. package/modules/localmodels/stack_decision.py +4 -4
  85. package/modules/localmodels/stack_doctor.py +2 -2
  86. package/modules/localmodels/stack_down.py +19 -14
  87. package/modules/localmodels/stack_events.py +1 -1
  88. package/modules/localmodels/stack_gpu_memory.py +1 -1
  89. package/modules/localmodels/stack_hardware.py +3 -3
  90. package/modules/localmodels/stack_mcp.py +1 -2
  91. package/modules/localmodels/stack_picks.py +1 -1
  92. package/modules/localmodels/stack_plan.py +9 -9
  93. package/modules/localmodels/stack_ports.py +32 -4
  94. package/modules/localmodels/stack_rollback.py +1 -1
  95. package/modules/localmodels/stack_run.py +1 -1
  96. package/modules/localmodels/stack_suite.py +61 -12
  97. package/modules/localmodels/stack_up.py +51 -1
  98. package/modules/localmodels/stack_view_agent.py +1 -1
  99. package/modules/localmodels/stack_view_serve.py +0 -2
  100. package/modules/localmodels/stack_view_words.py +2 -2
  101. package/modules/localmodels/stack_warm.py +2 -2
  102. package/modules/localmodels/stack_whatif.py +524 -41
  103. package/modules/localmodels/stack_whatif_html.py +903 -0
  104. package/modules/localmodels/startlux-decide-83fe6c7d.txt +2 -2
  105. package/modules/localmodels/{strata-poly-serve-0.2.20-poly.7.txt → strata-poly-serve-0.2.20-poly.9.txt} +1 -1
  106. package/modules/localmodels/strata_poly_server.py +251 -3
  107. package/modules/localmodels/suite.py +137 -5
  108. package/modules/localmodels/tts-moss.txt +321 -0
  109. package/modules/localmodels/tts_admission.py +381 -0
  110. package/modules/localmodels/tts_backend_speechcpp.py +487 -0
  111. package/modules/localmodels/tts_catalog.py +279 -0
  112. package/modules/localmodels/tts_cli.py +352 -0
  113. package/modules/localmodels/tts_http.py +623 -0
  114. package/modules/localmodels/tts_jobs.py +526 -0
  115. package/modules/localmodels/tts_model.py +591 -0
  116. package/modules/localmodels/tts_moss_presets.json +1 -0
  117. package/modules/localmodels/tts_serve.py +451 -0
  118. package/modules/localmodels/tts_server.py +1 -1
  119. package/modules/localmodels/tts_sidecar.py +788 -0
  120. package/modules/localmodels/tts_state.py +400 -0
  121. package/modules/localmodels/tts_worker_kokoro.py +463 -0
  122. package/modules/localmodels/tts_worker_moss.py +748 -0
  123. package/modules/localmodels/tts_workers.py +696 -0
  124. package/modules/localmodels/vision.py +5 -3
  125. package/modules/localmodels/web/view/ASSET-SOURCES.md +4 -7
  126. package/modules/localmodels/web/view/view.css +0 -1
  127. package/modules/localmodels/web/view/view.js +2 -5
  128. package/modules/localmodels/web/whatif/app.js +730 -0
  129. package/modules/localmodels/web/whatif/page.html +1172 -0
  130. package/modules/localmodels/web/whatif/sim.js +303 -0
  131. package/modules/localmodels/windows_job.py +179 -11
  132. package/modules/simplex_localmodels-0.1.0.dev104.dist-info/METADATA +14 -0
  133. package/modules/{simplex_localmodels-0.1.0.dev102.dist-info → simplex_localmodels-0.1.0.dev104.dist-info}/RECORD +132 -109
  134. package/modules/simplex_localmodels-0.1.0.dev104.dist-info/licenses/LICENSE +201 -0
  135. package/modules/simplex_localmodels-0.1.0.dev104.dist-info/licenses/NOTICE +126 -0
  136. package/package.json +11 -2
  137. package/tool.json +1 -1
  138. package/modules/localmodels/engines-strata-poly-0.2.20-poly.7.json +0 -94
  139. package/modules/localmodels/fixtures/stack-research-demo-plan.json +0 -1059
  140. package/modules/localmodels/stack_research.py +0 -716
  141. package/modules/localmodels/stack_research_demo.py +0 -125
  142. package/modules/localmodels/stack_research_plan.py +0 -146
  143. package/modules/localmodels/web/index.html +0 -2605
  144. package/modules/localmodels/web/sizecalc/app.js +0 -1306
  145. package/modules/localmodels/web/sizecalc/calc.js +0 -269
  146. package/modules/localmodels/web/sizecalc/page.html +0 -520
  147. package/modules/localmodels/web/view/logo-claude.svg +0 -3
  148. package/modules/localmodels/web/view/logo-codex.png +0 -0
  149. package/modules/simplex_localmodels-0.1.0.dev102.dist-info/METADATA +0 -9
  150. package/modules/simplex_localmodels-0.1.0.dev102.dist-info/licenses/NOTICE +0 -68
  151. /package/modules/{simplex_localmodels-0.1.0.dev102.dist-info → simplex_localmodels-0.1.0.dev104.dist-info}/WHEEL +0 -0
  152. /package/modules/{simplex_localmodels-0.1.0.dev102.dist-info → simplex_localmodels-0.1.0.dev104.dist-info}/entry_points.txt +0 -0
  153. /package/modules/{simplex_localmodels-0.1.0.dev102.dist-info → simplex_localmodels-0.1.0.dev104.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
@@ -1,125 +0,0 @@
1
- """Create a self-contained synthetic stack research campaign."""
2
-
3
- from __future__ import annotations
4
-
5
- import hashlib
6
- import json
7
- from pathlib import Path
8
- from typing import cast
9
-
10
- from localmodels import approval
11
- from localmodels.stack_research import (
12
- CAMPAIGN_SCHEMA,
13
- OBSERVATION_SCHEMA,
14
- PORTFOLIO_SCHEMA,
15
- REQUIRED_ROLES,
16
- )
17
-
18
-
19
- def create_demo(output: Path) -> None:
20
- output.mkdir(parents=True, exist_ok=False)
21
- fixture = Path(__file__).parent / "fixtures" / "stack-research-demo-plan.json"
22
- template = json.loads(fixture.read_text(encoding="utf-8"))
23
- entries: list[dict[str, str]] = []
24
- plans: dict[str, dict[str, object]] = {}
25
- for candidate_id in ("latency-first", "balanced", "quality-first"):
26
- plan = json.loads(json.dumps(template))
27
- plan["warnings"] = [*plan.get("warnings", []), f"synthetic demo: {candidate_id}"]
28
- plan["plan_id"] = approval.digest(plan)
29
- plan_path = output / f"{candidate_id}.stack-plan.json"
30
- _write_json(plan_path, plan)
31
- plans[candidate_id] = plan
32
- entries.append({"id": candidate_id, "path": plan_path.name, "sha256": _digest(plan_path)})
33
- cohort = {"hardware": "synthetic-24gb", "workload": "synthetic-agent", "evaluator": "demo-v1"}
34
- campaign: dict[str, object] = {
35
- "schema": CAMPAIGN_SCHEMA,
36
- "campaign_id": "synthetic-demo",
37
- "evidence_kind": "synthetic",
38
- "cohort": cohort,
39
- "repetitions": 3,
40
- "seed": 8137,
41
- "candidates": entries,
42
- "objectives": [
43
- {
44
- "metric": "latency_ms",
45
- "unit": "ms",
46
- "direction": "lower",
47
- "reference": 100,
48
- "ideal": 10,
49
- },
50
- {
51
- "metric": "task_score",
52
- "unit": "fraction",
53
- "direction": "higher",
54
- "reference": 0,
55
- "ideal": 1,
56
- },
57
- ],
58
- "constraints": [{"metric": "failures", "unit": "count", "max": 0}],
59
- "preference_order": ["latency_ms", "task_score"],
60
- "max_portfolio_size": 3,
61
- "required_tasks": [],
62
- }
63
- campaign_path = output / "campaign.json"
64
- _write_json(campaign_path, campaign)
65
- fingerprint = _digest(campaign_path)
66
- values = {
67
- "latency-first": (20.0, 0.68),
68
- "balanced": (31.0, 0.88),
69
- "quality-first": (44.0, 0.58),
70
- }
71
- receipt_paths: list[str] = []
72
- acceptance = {
73
- role: True
74
- for role in REQUIRED_ROLES | {aux["endpoint"]["contract"] for aux in template["aux"]}
75
- }
76
- for candidate_id, (latency, quality) in values.items():
77
- plan_id = cast(str, plans[candidate_id]["plan_id"])
78
- for repeat in range(3):
79
- metrics: dict[str, object] = {
80
- "latency_ms": {"value": latency, "unit": "ms", "kind": "synthetic"},
81
- "task_score": {"value": quality, "unit": "fraction", "kind": "synthetic"},
82
- "failures": {"value": 0, "unit": "count", "kind": "synthetic"},
83
- }
84
- source: dict[str, object] = {
85
- "schema": OBSERVATION_SCHEMA,
86
- "campaign_fingerprint": fingerprint,
87
- "cohort": cohort,
88
- "candidate_id": candidate_id,
89
- "plan_id": plan_id,
90
- "repeat": repeat,
91
- "evidence_kind": "synthetic",
92
- "status": "completed",
93
- "acceptance": acceptance,
94
- "final_health": True,
95
- "mixed_load": True,
96
- "metrics": metrics,
97
- }
98
- stem = f"{candidate_id}-repeat-{repeat}"
99
- source_path = output / f"{stem}.evaluator.json"
100
- _write_json(source_path, source)
101
- receipt = {
102
- **source,
103
- "source_refs": [{"path": source_path.name, "sha256": _digest(source_path)}],
104
- }
105
- receipt_path = output / f"{stem}.receipt.json"
106
- _write_json(receipt_path, receipt)
107
- receipt_paths.append(receipt_path.name)
108
- _write_json(
109
- output / "observations.json",
110
- {"schema": "localmodels.stack-observations/v1", "receipts": receipt_paths},
111
- )
112
- _write_json(
113
- output / "portfolio.json",
114
- {"schema": PORTFOLIO_SCHEMA, "candidates": ["latency-first", "balanced"]},
115
- )
116
-
117
-
118
- def _digest(path: Path) -> str:
119
- return hashlib.sha256(path.read_bytes()).hexdigest()
120
-
121
-
122
- def _write_json(path: Path, value: object) -> None:
123
- path.write_text(
124
- json.dumps(value, sort_keys=True, indent=2, allow_nan=False) + "\n", encoding="utf-8"
125
- )
@@ -1,146 +0,0 @@
1
- """Semantic validation of saved plans admitted to offline stack research."""
2
-
3
- from __future__ import annotations
4
-
5
- from typing import cast
6
-
7
- from localmodels import approval
8
- from localmodels.context_policy import AGENT
9
- from localmodels.records import Plan
10
- from localmodels.stack_plan import StackPlan
11
-
12
-
13
- def validate_plan(plan: StackPlan, tasks: set[str], candidate_id: str) -> str:
14
- """Validate a complete experiment plan and return its sole GPU UUID."""
15
- _require(
16
- plan.get("schema") == "localmodels.stack-plan/v1", f"{candidate_id}: invalid plan schema"
17
- )
18
- _require(approval.digest(plan) == plan["plan_id"], f"{candidate_id}: plan digest mismatch")
19
- _require(
20
- plan.get("decision") is not None and plan.get("decision_existing") is None,
21
- f"{candidate_id}: managed decision required",
22
- )
23
- components = {"llm": plan["llm"], "decision": cast(Plan, plan["decision"])}
24
- for aux in plan.get("aux", []):
25
- role = aux["endpoint"].get("contract", "")
26
- _require(
27
- bool(role) and role not in components and role != "decision_front",
28
- f"{candidate_id}: duplicate or reserved component role {role}",
29
- )
30
- components[role] = aux
31
- _require(tasks <= components.keys(), f"{candidate_id}: required component missing")
32
- decision_contract = cast(Plan, plan["decision"])["endpoint"].get("contract")
33
- _require(
34
- decision_contract in {"health", "systemone"},
35
- f"{candidate_id}: unsupported decision contract",
36
- )
37
- front = plan.get("decision_front")
38
- if decision_contract == "health":
39
- _require(front is not None, f"{candidate_id}: health decision requires a front")
40
- all_components = dict(components)
41
- if front is not None:
42
- all_components["decision_front"] = front
43
- llm = plan["llm"]
44
- launch = llm["launch"]
45
- _require(isinstance(launch, dict), f"{candidate_id}: LLM launch is malformed")
46
- window = launch.get("window")
47
- slots = launch.get("slots")
48
- spill_bytes = launch.get("spill_bytes", 0)
49
- _require(
50
- isinstance(window, int) and not isinstance(window, bool),
51
- f"{candidate_id}: LLM window is malformed",
52
- )
53
- _require(
54
- isinstance(slots, int) and not isinstance(slots, bool),
55
- f"{candidate_id}: LLM slots are malformed",
56
- )
57
- _require(
58
- isinstance(spill_bytes, int) and not isinstance(spill_bytes, bool),
59
- f"{candidate_id}: LLM spill bytes are malformed",
60
- )
61
- _require(cast(int, window) >= AGENT.floor, f"{candidate_id}: LLM context below 64K")
62
- _require(cast(int, slots) >= 2, f"{candidate_id}: fewer than two LLM slots")
63
- _require(
64
- launch.get("spilled") is False and spill_bytes == 0,
65
- f"{candidate_id}: LLM spill is not supported",
66
- )
67
- gpu_sets: list[set[str]] = []
68
- for role, component in all_components.items():
69
- placement = component.get("placement")
70
- _require(isinstance(placement, dict), f"{candidate_id}: placement malformed in {role}")
71
- gpus = cast(dict[str, object], placement).get("gpus")
72
- _require(isinstance(gpus, list), f"{candidate_id}: GPU placement malformed in {role}")
73
- gpu_rows = cast(list[dict[str, object]], gpus)
74
- _require(
75
- all(
76
- isinstance(gpu, dict) and isinstance(gpu.get("uuid"), str) and gpu["uuid"]
77
- for gpu in gpu_rows
78
- ),
79
- f"{candidate_id}: GPU UUID malformed in {role}",
80
- )
81
- uuids = {cast(str, gpu["uuid"]) for gpu in gpu_rows}
82
- if uuids:
83
- _require(
84
- component["engine"].get("backend") == "cuda",
85
- f"{candidate_id}: GPU component is not a CUDA build in {role}",
86
- )
87
- if role in {"llm", "decision"}:
88
- _require(bool(uuids), f"{candidate_id}: {role} must use a GPU")
89
- gpu_sets.append(uuids)
90
- elif uuids:
91
- gpu_sets.append(uuids)
92
- if role == "decision":
93
- _require(
94
- bool(
95
- uuids
96
- & {
97
- cast(str, g["uuid"])
98
- for g in cast(list[dict[str, object]], llm["placement"]["gpus"])
99
- }
100
- ),
101
- f"{candidate_id}: decision must share LLM GPU",
102
- )
103
- selected_gpus = set.union(*gpu_sets) if gpu_sets else set()
104
- _require(
105
- len(selected_gpus) == 1,
106
- f"{candidate_id}: GPU components must use one UUID",
107
- )
108
- for role, component in all_components.items():
109
- _validate_artifacts(component, f"{candidate_id}: {role}")
110
- return next(iter(selected_gpus))
111
-
112
-
113
- def _validate_artifacts(component: Plan, label: str) -> None:
114
- files = component["files"]
115
- _require(bool(files), f"{label}: files missing")
116
- for file in files:
117
- _require(_hex_digest(file["revision"], 40), f"{label}: unpinned revision")
118
- _require(_hex_digest(file["sha256"], 64), f"{label}: artifact must have lowercase SHA256")
119
- engine = component["engine"]
120
- _require(
121
- engine["source"] == "release"
122
- and bool(engine.get("build"))
123
- and _hex_digest(engine.get("commit"), 40),
124
- f"{label}: unpinned engine",
125
- )
126
- assets = engine.get("assets")
127
- if not isinstance(assets, list) or not assets:
128
- raise ValueError(f"{label}: engine assets missing")
129
- for asset in assets:
130
- _require(
131
- bool(asset["name"]) and _hex_digest(asset["sha256"], 64),
132
- f"{label}: engine asset is not hash-pinned",
133
- )
134
-
135
-
136
- def _require(condition: bool, message: str) -> None:
137
- if not condition:
138
- raise ValueError(message)
139
-
140
-
141
- def _hex_digest(value: object, length: int) -> bool:
142
- return (
143
- isinstance(value, str)
144
- and len(value) == length
145
- and all(ch in "0123456789abcdef" for ch in value)
146
- )