@crvouga/dev-fleet 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.mise/locks/aws-cdk/2.1146.1/aube-lock.yaml +24 -0
- package/.mise/locks/aws-cdk/2.1146.1/package.json +7 -0
- package/.mise/locks/azure-cli/2.91.0~a837e014/pyproject.toml +5 -0
- package/.mise/locks/azure-cli/2.91.0~a837e014/uv.lock +2794 -0
- package/.mise/locks/gemini/0.66.0~84aac8e6/aube-lock.yaml +123 -0
- package/.mise/locks/gemini/0.66.0~84aac8e6/package.json +12 -0
- package/.mise/locks/npm-devcontainers-cli/0.90.0/aube-lock.yaml +24 -0
- package/.mise/locks/npm-devcontainers-cli/0.90.0/package.json +7 -0
- package/.mise/locks/npm-modelcontextprotocol-inspector/2.13.0~4c109bea/aube-lock.yaml +1432 -0
- package/.mise/locks/npm-modelcontextprotocol-inspector/2.13.0~4c109bea/package.json +7 -0
- package/.mise/locks/npm-vercel/65.8.0/aube-lock.yaml +3595 -0
- package/.mise/locks/npm-vercel/65.8.0/package.json +7 -0
- package/.mise/locks/npm-wrangler/4.156.0/aube-lock.yaml +895 -0
- package/.mise/locks/npm-wrangler/4.156.0/package.json +7 -0
- package/.mise/locks/npm-yarnpkg-cli-dist/4.18.1/aube-lock.yaml +24 -0
- package/.mise/locks/npm-yarnpkg-cli-dist/4.18.1/package.json +7 -0
- package/LICENSE +21 -0
- package/README.md +357 -2
- package/agents/antigravity-proxy.ts +3 -0
- package/agents/audit.md +89 -0
- package/agents/claude-proxy +5 -0
- package/agents/claude-proxy.ts +3 -0
- package/agents/codex-proxy.ts +3 -0
- package/agents/grok-proxy.ts +3 -0
- package/agents/managed-proxy.ts +55 -0
- package/agents/opencode-proxy.ts +3 -0
- package/agents/registry.json +209 -0
- package/agents/registry.schema.json +149 -0
- package/agents/setup.md +158 -0
- package/agents/t3.json +40 -0
- package/ansible/macos/manager.yml +30 -0
- package/ansible/macos/policy.json +9 -0
- package/ansible/monitoring/README.md +215 -0
- package/ansible/monitoring/agent-darwin.yml +198 -0
- package/ansible/monitoring/agent.yml +172 -0
- package/ansible/monitoring/beszel-agent.service +42 -0
- package/ansible/monitoring/compose.yml +74 -0
- package/ansible/monitoring/hub-darwin.yml +102 -0
- package/ansible/monitoring/hub-route-darwin.yml +51 -0
- package/ansible/monitoring/lock.json +16 -0
- package/ansible/net/remote-probe.sh +13 -0
- package/ansible/pyproject.toml +12 -0
- package/ansible/ubuntu/authorize-sudo.sh +51 -0
- package/ansible/ubuntu/baseline.yml +89 -0
- package/ansible/ubuntu/disk-gc.py +336 -0
- package/ansible/ubuntu/disk-guard.py +104 -0
- package/ansible/ubuntu/policy.json +52 -0
- package/ansible/ubuntu/recovery.yml +15 -0
- package/ansible/ubuntu/t3/policy.json +7 -0
- package/ansible/ubuntu/t3-desktop.yml +220 -0
- package/ansible/ubuntu/t3-health.sh +33 -0
- package/ansible/ubuntu/t3-policy.yml +76 -0
- package/ansible/ubuntu/t3-route.yml +28 -0
- package/ansible/ubuntu/tailscale.yml +78 -0
- package/ansible/ubuntu/tasks/credentials.yml +47 -0
- package/ansible/ubuntu/tasks/docker.yml +31 -0
- package/ansible/ubuntu/tasks/packages.yml +56 -0
- package/ansible/ubuntu/tasks/power.yml +51 -0
- package/ansible/ubuntu/tasks/recovery.yml +39 -0
- package/ansible/ubuntu/tasks/resources.yml +312 -0
- package/ansible/ubuntu/tasks/services.yml +31 -0
- package/ansible/ubuntu/tasks/ssh.yml +71 -0
- package/ansible/ubuntu/tasks/user.yml +120 -0
- package/ansible/uv.lock +190 -0
- package/bin/devfleet.mjs +36 -0
- package/bootstrap/bootstrap.ps1 +50 -0
- package/bootstrap/bootstrap.sh +80 -0
- package/bootstrap/devfleet +7 -0
- package/bootstrap/docker-desktop.sh +33 -0
- package/bootstrap/doctor.ts +234 -0
- package/bootstrap/fleet-manager-run.sh +103 -0
- package/bootstrap/fleet-remote-bootstrap.sh +258 -0
- package/bootstrap/global-config.ts +171 -0
- package/bootstrap/install-launcher.sh +10 -0
- package/bootstrap/native-aws.ts +86 -0
- package/bootstrap/native-t3.ts +154 -0
- package/bootstrap/npm.ts +358 -0
- package/bootstrap/release-version.ts +157 -0
- package/bootstrap/setup-status.ts +51 -0
- package/bootstrap/setup.ts +88 -0
- package/bootstrap/shell-path.ts +105 -0
- package/bootstrap/verify-t3-archive.py +49 -0
- package/bootstrap/worker-auth.ts +65 -0
- package/bootstrap/worker-github.ts +47 -0
- package/bootstrap/worker-tools.ts +24 -0
- package/cliproxy/AGENTS.md +11 -0
- package/cliproxy/README.md +269 -0
- package/cliproxy/clients/bootstrap.py +143 -0
- package/cliproxy/clients/launcher.py +57 -0
- package/cliproxy/compose.yaml +90 -0
- package/cliproxy/config.template.yaml +70 -0
- package/cliproxy/docs/cloud-adoption.md +16 -0
- package/cliproxy/docs/deployment.png +0 -0
- package/cliproxy/docs/deployment.svg +109 -0
- package/cliproxy/docs/health-workflow.example.yml +185 -0
- package/cliproxy/docs/migration.md +131 -0
- package/cliproxy/docs/model-health-report.schema.json +364 -0
- package/cliproxy/docs/model-health.md +393 -0
- package/cliproxy/image.lock.json +5 -0
- package/cliproxy/launchd/dev.devfleet.cliproxy-backup-check.plist +38 -0
- package/cliproxy/launchd/dev.devfleet.cliproxy-backup.plist +48 -0
- package/cliproxy/launchd/dev.devfleet.cliproxy-fleet.plist +32 -0
- package/cliproxy/launchd/dev.devfleet.cliproxy-gc.plist +38 -0
- package/cliproxy/launchd/dev.devfleet.cliproxy-monitor.plist +29 -0
- package/cliproxy/launchd/dev.devfleet.cliproxy-vault-renew.plist +31 -0
- package/cliproxy/models.json +1618 -0
- package/cliproxy/requirements.lock +78 -0
- package/cliproxy/scripts/accounts.py +38 -0
- package/cliproxy/scripts/audit.py +123 -0
- package/cliproxy/scripts/backup +234 -0
- package/cliproxy/scripts/check.py +34 -0
- package/cliproxy/scripts/checkpoint.py +226 -0
- package/cliproxy/scripts/cli.py +64 -0
- package/cliproxy/scripts/cliproxy_host.py +257 -0
- package/cliproxy/scripts/cloud_state.py +150 -0
- package/cliproxy/scripts/container-health +6 -0
- package/cliproxy/scripts/docker +24 -0
- package/cliproxy/scripts/external-health.py +79 -0
- package/cliproxy/scripts/fleet_config.py +43 -0
- package/cliproxy/scripts/fleet_sync.py +274 -0
- package/cliproxy/scripts/initialize +84 -0
- package/cliproxy/scripts/install-dependencies +48 -0
- package/cliproxy/scripts/install.py +406 -0
- package/cliproxy/scripts/model_health.py +16 -0
- package/cliproxy/scripts/modelhealth/__init__.py +5 -0
- package/cliproxy/scripts/modelhealth/checks.py +429 -0
- package/cliproxy/scripts/modelhealth/cli.py +117 -0
- package/cliproxy/scripts/modelhealth/config.py +186 -0
- package/cliproxy/scripts/modelhealth/emulator.py +536 -0
- package/cliproxy/scripts/modelhealth/expect.py +88 -0
- package/cliproxy/scripts/modelhealth/findings.py +183 -0
- package/cliproxy/scripts/modelhealth/protocol.py +330 -0
- package/cliproxy/scripts/modelhealth/redact.py +28 -0
- package/cliproxy/scripts/modelhealth/report.py +150 -0
- package/cliproxy/scripts/modelhealth/runner.py +390 -0
- package/cliproxy/scripts/modelhealth/scenario.py +131 -0
- package/cliproxy/scripts/modelhealth/schema.py +63 -0
- package/cliproxy/scripts/modelhealth/simulate.py +111 -0
- package/cliproxy/scripts/modelhealth/transport.py +213 -0
- package/cliproxy/scripts/monitor +68 -0
- package/cliproxy/scripts/ops +527 -0
- package/cliproxy/scripts/public-endpoint +127 -0
- package/cliproxy/scripts/recover_node.py +177 -0
- package/cliproxy/scripts/restore-verify +60 -0
- package/cliproxy/scripts/retention.py +144 -0
- package/cliproxy/scripts/service-start +7 -0
- package/cliproxy/scripts/validate-config +56 -0
- package/cliproxy/scripts/vault-access.py +57 -0
- package/cliproxy/scripts/vault-backup-login +55 -0
- package/cliproxy/scripts/vault-recovery +56 -0
- package/cliproxy/scripts/vault-renew +30 -0
- package/cliproxy/systemd/cliproxy-backup-check.service +10 -0
- package/cliproxy/systemd/cliproxy-backup-check.timer +8 -0
- package/cliproxy/systemd/cliproxy-backup.service +13 -0
- package/cliproxy/systemd/cliproxy-backup.timer +8 -0
- package/cliproxy/systemd/cliproxy-fleet.service +17 -0
- package/cliproxy/systemd/cliproxy-gc.service +13 -0
- package/cliproxy/systemd/cliproxy-gc.timer +8 -0
- package/cliproxy/systemd/cliproxy-monitor.service +8 -0
- package/cliproxy/systemd/cliproxy-monitor.timer +7 -0
- package/cliproxy/systemd/cliproxy-vault-renew.service +8 -0
- package/cliproxy/systemd/cliproxy-vault-renew.timer +7 -0
- package/cliproxy/vendor/LICENSE +22 -0
- package/cliproxy/vendor/config.upstream.yaml +1349 -0
- package/docs/consumer-setup.md +408 -0
- package/docs/declared.md +89 -0
- package/docs/machine-setup.md +399 -0
- package/docs/operations.md +276 -0
- package/docs/releasing.md +103 -0
- package/docs/state.md +254 -0
- package/docs/topology.md +67 -0
- package/docs/ubuntu-sync.md +351 -0
- package/docs/worker-contract.md +67 -0
- package/examples/fleet.json +100 -0
- package/examples/roster.json +13 -0
- package/llms.txt +35 -0
- package/mise.lock +1521 -0
- package/mise.toml +110 -0
- package/package.json +74 -4
- package/schema/fleet.schema.json +420 -0
- package/schema/roster.schema.json +77 -0
- package/src/agents/account-relay.ts +111 -0
- package/src/agents/accounts.ts +85 -0
- package/src/agents/audit.ts +77 -0
- package/src/agents/cli.ts +13 -0
- package/src/agents/command.ts +204 -0
- package/src/agents/converge.ts +123 -0
- package/src/agents/doctor.ts +107 -0
- package/src/agents/errors.ts +2 -0
- package/src/agents/files.ts +73 -0
- package/src/agents/fleet-verify.ts +165 -0
- package/src/agents/launch.ts +290 -0
- package/src/agents/native-verify.ts +371 -0
- package/src/agents/provider-errors.ts +57 -0
- package/src/agents/registry.ts +61 -0
- package/src/agents/render.ts +110 -0
- package/src/agents/round-trip.ts +192 -0
- package/src/agents/secrets.ts +13 -0
- package/src/agents/toolchain.ts +34 -0
- package/src/agents/verify-cache.ts +103 -0
- package/src/agents/verify.ts +127 -0
- package/src/auth-checks.ts +163 -0
- package/src/cli/agent-guide.ts +129 -0
- package/src/cli/app.ts +122 -0
- package/src/cli/cli.ts +28 -0
- package/src/cli/command-index.ts +57 -0
- package/src/cli/contracts.ts +25 -0
- package/src/cli/fleet-reference.ts +17 -0
- package/src/cli/fleet-state.ts +499 -0
- package/src/cli/fleet-sync-checkout.ts +130 -0
- package/src/cli/fleet-sync-enrollment.ts +140 -0
- package/src/cli/fleet-sync-forward.ts +134 -0
- package/src/cli/fleet-sync-manager.ts +249 -0
- package/src/cli/fleet-sync-monitoring.ts +185 -0
- package/src/cli/fleet-sync-output.ts +317 -0
- package/src/cli/fleet-sync-privilege.ts +27 -0
- package/src/cli/fleet-sync-progress.ts +109 -0
- package/src/cli/fleet-sync-remote.ts +242 -0
- package/src/cli/fleet-sync-report.ts +26 -0
- package/src/cli/fleet-sync-schedule.ts +138 -0
- package/src/cli/fleet-sync-state.ts +86 -0
- package/src/cli/fleet-sync-vault.ts +166 -0
- package/src/cli/fleet-sync.ts +375 -0
- package/src/cli/fleet.ts +165 -0
- package/src/cli/managed-health.ts +219 -0
- package/src/cli/node-deployment.ts +34 -0
- package/src/cli/node-sync.ts +121 -0
- package/src/cli/node-t3.ts +31 -0
- package/src/cli/options.ts +141 -0
- package/src/cli/probe-source.ts +7 -0
- package/src/cli/program.ts +185 -0
- package/src/cli/project.ts +51 -0
- package/src/cli/register-fleet.ts +296 -0
- package/src/cli/registry.ts +185 -0
- package/src/cli/repair-apply.ts +67 -0
- package/src/cli/repair-guard.ts +11 -0
- package/src/cli/repair-inspect.ts +150 -0
- package/src/cli/repair-script.ts +76 -0
- package/src/cli/repair.ts +209 -0
- package/src/cli/roster.ts +105 -0
- package/src/cli/search.ts +35 -0
- package/src/cli/settings.ts +67 -0
- package/src/cli/source-operations.ts +102 -0
- package/src/cli/t3/command.ts +90 -0
- package/src/cli/t3/register.ts +55 -0
- package/src/cli/tailnet.ts +127 -0
- package/src/cli/ui-actions.ts +133 -0
- package/src/cli/ui-controller.ts +113 -0
- package/src/cli/ui-data.ts +106 -0
- package/src/cli/ui-execute.ts +163 -0
- package/src/cli/ui-repairs.ts +34 -0
- package/src/cli/ui-reports.ts +211 -0
- package/src/cli/ui-targets.ts +100 -0
- package/src/cli/ui-terminal.ts +109 -0
- package/src/cli/ui-types.ts +49 -0
- package/src/cli/ui-wizard.ts +101 -0
- package/src/cli/ui.ts +9 -0
- package/src/cli/worker-health-output.ts +37 -0
- package/src/config.ts +186 -0
- package/src/configure.ts +255 -0
- package/src/definition.ts +290 -0
- package/src/diagnostics.ts +92 -0
- package/src/doctor-check.ts +10 -0
- package/src/errors.ts +1 -0
- package/src/fingerprint.ts +120 -0
- package/src/fleet-config.ts +174 -0
- package/src/input-hashes.ts +73 -0
- package/src/machine/local-source.ts +52 -0
- package/src/machine/lock-error.ts +2 -0
- package/src/machine/platform.ts +44 -0
- package/src/machine/source.ts +68 -0
- package/src/machine/state.ts +173 -0
- package/src/machine-health.ts +95 -0
- package/src/managed-source.ts +47 -0
- package/src/manager-failure.ts +48 -0
- package/src/manager-sync.ts +405 -0
- package/src/manager.ts +62 -0
- package/src/monitoring/agent-evidence.ts +146 -0
- package/src/monitoring/apply.ts +183 -0
- package/src/monitoring/beszel.ts +198 -0
- package/src/monitoring/enroll.ts +111 -0
- package/src/monitoring/hub-access.ts +114 -0
- package/src/monitoring/hub-backup.ts +121 -0
- package/src/monitoring/hub-viewer.ts +142 -0
- package/src/monitoring/hub.ts +93 -0
- package/src/monitoring/manager-agent.ts +73 -0
- package/src/monitoring/manager-hub.ts +248 -0
- package/src/monitoring/remote.ts +65 -0
- package/src/network-definition.ts +83 -0
- package/src/node-converge-linux.ts +374 -0
- package/src/node-converge-shared.ts +83 -0
- package/src/node-converge.ts +40 -0
- package/src/onboard.ts +35 -0
- package/src/package-info.ts +45 -0
- package/src/platform/ansible-receipt.ts +128 -0
- package/src/platform/ansible.ts +66 -0
- package/src/platform/darwin.ts +203 -0
- package/src/platform/detect.ts +11 -0
- package/src/platform/fallback.ts +110 -0
- package/src/platform/index.ts +38 -0
- package/src/platform/launchd.ts +98 -0
- package/src/platform/linux.ts +139 -0
- package/src/platform/ps.ts +45 -0
- package/src/platform/resource-verify.ts +132 -0
- package/src/platform/systemd-user.ts +95 -0
- package/src/platform/t3-policy.ts +137 -0
- package/src/platform/t3-route.ts +68 -0
- package/src/platform/t3-service.ts +75 -0
- package/src/platform/types.ts +123 -0
- package/src/platform/ubuntu-audit.ts +66 -0
- package/src/platform/ubuntu-verify.ts +105 -0
- package/src/platform/windows.ts +148 -0
- package/src/power-recovery.ts +55 -0
- package/src/probe.ts +51 -0
- package/src/protocol.ts +119 -0
- package/src/proxy-converge.ts +85 -0
- package/src/remote-bootstrap.ts +210 -0
- package/src/remote-entry.ts +89 -0
- package/src/remote-lock.ts +12 -0
- package/src/repair-catalog.ts +206 -0
- package/src/repair-plan.ts +78 -0
- package/src/repair-runner.ts +84 -0
- package/src/report.ts +71 -0
- package/src/runner.ts +104 -0
- package/src/secrets.ts +169 -0
- package/src/service-auth.ts +115 -0
- package/src/ssh.ts +135 -0
- package/src/state/bucket.ts +208 -0
- package/src/state/check.ts +74 -0
- package/src/state/connection.ts +92 -0
- package/src/state/enrollment.ts +45 -0
- package/src/state/legacy.ts +89 -0
- package/src/state/litestream.ts +143 -0
- package/src/state/operator.ts +20 -0
- package/src/state/paths.ts +40 -0
- package/src/state/roster.ts +62 -0
- package/src/state/store.ts +169 -0
- package/src/state/sync.ts +352 -0
- package/src/sync.ts +104 -0
- package/src/t3/accounts.ts +81 -0
- package/src/t3/desired.ts +165 -0
- package/src/t3/files.ts +81 -0
- package/src/t3/names-check.ts +53 -0
- package/src/t3/names.ts +155 -0
- package/src/t3/plan.ts +82 -0
- package/src/t3/providers.ts +74 -0
- package/src/t3/reconcile.ts +123 -0
- package/src/t3-endpoint.ts +104 -0
- package/src/t3-linked-check.ts +123 -0
- package/src/tailnet-health.ts +231 -0
- package/src/tailnet-matching.ts +37 -0
- package/src/tailscale.ts +141 -0
- package/src/toolchain-checks.ts +108 -0
- package/src/topology.ts +24 -0
- package/src/transport.ts +122 -0
- package/src/types.ts +99 -0
- package/src/vault-config.ts +38 -0
- package/src/worker-access-checks.ts +168 -0
- package/src/worker-capacity.ts +34 -0
- package/src/worker-host-checks.ts +181 -0
- package/src/worker-policy.ts +64 -0
- package/src/worker-readiness.ts +64 -0
- package/src/workstation-checks.ts +29 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"""Load and validate the declarative model-health configuration (models.json)."""
|
|
2
|
+
|
|
3
|
+
import copy
|
|
4
|
+
import fnmatch
|
|
5
|
+
import json
|
|
6
|
+
import pathlib
|
|
7
|
+
import re
|
|
8
|
+
import sys
|
|
9
|
+
|
|
10
|
+
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
|
11
|
+
import fleet_config
|
|
12
|
+
|
|
13
|
+
DEFAULT_PATH = pathlib.Path(__file__).resolve().parents[2] / "models.json"
|
|
14
|
+
TIERS = {"light": 1, "full": 2, "manual": 3}
|
|
15
|
+
SEVERITIES = ("critical", "major", "minor")
|
|
16
|
+
KINDS = ("request", "roundtrip", "agent", "cancel_recover", "concurrent", "error_probe")
|
|
17
|
+
SUITES = ("core", "cursor")
|
|
18
|
+
STATES = ("required", "optional", "unsupported")
|
|
19
|
+
VARIABLES = ("model_id", "nonce", "codeword", "marker")
|
|
20
|
+
CATEGORIES = (
|
|
21
|
+
"credentials", "auth", "not_found", "rate_limit", "timeout", "transport", "upstream",
|
|
22
|
+
"protocol", "assertion", "request_rejected", "budget", "aborted", "model_missing", "harness",
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ConfigError(ValueError):
|
|
27
|
+
def __init__(self, problems):
|
|
28
|
+
super().__init__("Invalid model-health configuration:\n- " + "\n- ".join(problems))
|
|
29
|
+
self.problems = problems
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class Case:
|
|
33
|
+
"""One check applied to one protocol; combined with a model it becomes a test."""
|
|
34
|
+
|
|
35
|
+
def __init__(self, check, protocol):
|
|
36
|
+
self.check = check
|
|
37
|
+
self.protocol = protocol
|
|
38
|
+
self.id = protocol + "." + check["id"]
|
|
39
|
+
self.capability = self.id
|
|
40
|
+
tier = check["tier"]
|
|
41
|
+
self.tier = tier[protocol] if isinstance(tier, dict) else tier
|
|
42
|
+
self.severity = check["severity"]
|
|
43
|
+
self.kind = check["kind"]
|
|
44
|
+
self.spends_inference = check.get("spends_inference", True)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class Config:
|
|
48
|
+
def __init__(self, raw):
|
|
49
|
+
self.raw = raw
|
|
50
|
+
self.models = raw["models"]
|
|
51
|
+
self.cases = [Case(check, protocol) for check in raw["checks"] for protocol in check["protocols"]]
|
|
52
|
+
self.capabilities = [case.capability for case in self.cases]
|
|
53
|
+
|
|
54
|
+
def runs(self, name):
|
|
55
|
+
return self.raw["runs"][name]
|
|
56
|
+
|
|
57
|
+
def cases_for(self, suite, max_tier, only=None):
|
|
58
|
+
rank = TIERS[max_tier]
|
|
59
|
+
return [
|
|
60
|
+
case for case in self.cases
|
|
61
|
+
if TIERS[case.tier] <= rank and (suite == "all" or suite in case.check["suites"])
|
|
62
|
+
and (not only or any(fnmatch.fnmatchcase(case.capability, pattern) for pattern in only))
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
def state(self, model, capability):
|
|
66
|
+
"""Declared state: ('required'|'optional'|'unsupported', reason)."""
|
|
67
|
+
profile = self.raw["capability_profiles"][model["profile"]]
|
|
68
|
+
state, reason = profile.get("default", "required"), None
|
|
69
|
+
for pattern in profile.get("optional", []):
|
|
70
|
+
if fnmatch.fnmatchcase(capability, pattern):
|
|
71
|
+
state = "optional"
|
|
72
|
+
for pattern, why in profile.get("unsupported", {}).items():
|
|
73
|
+
if fnmatch.fnmatchcase(capability, pattern):
|
|
74
|
+
state, reason = "unsupported", why
|
|
75
|
+
for pattern, value in model.get("capabilities", {}).items():
|
|
76
|
+
if fnmatch.fnmatchcase(capability, pattern):
|
|
77
|
+
if isinstance(value, dict):
|
|
78
|
+
state, reason = value["state"], value.get("reason")
|
|
79
|
+
else:
|
|
80
|
+
state, reason = value, None
|
|
81
|
+
return state, reason
|
|
82
|
+
|
|
83
|
+
def extra(self, model, protocol):
|
|
84
|
+
profile = self.raw["capability_profiles"][model["profile"]].get("extra", {})
|
|
85
|
+
merged = copy.deepcopy(profile.get(protocol, {}))
|
|
86
|
+
for key, value in model.get("extra", {}).get(protocol, {}).items():
|
|
87
|
+
merged[key] = copy.deepcopy(value)
|
|
88
|
+
return merged
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def validate(raw):
|
|
92
|
+
problems = []
|
|
93
|
+
|
|
94
|
+
def need(condition, message):
|
|
95
|
+
if not condition:
|
|
96
|
+
problems.append(message)
|
|
97
|
+
|
|
98
|
+
need(raw.get("schema") == 1, "schema must be 1")
|
|
99
|
+
endpoint = raw.get("endpoint", {})
|
|
100
|
+
# The proxy origin is the fleet's own: it is never written in this file.
|
|
101
|
+
if isinstance(endpoint, dict) and "base_url" not in endpoint:
|
|
102
|
+
endpoint["base_url"] = fleet_config.endpoint() + "/v1"
|
|
103
|
+
need(str(endpoint.get("base_url", "")).startswith("https://"), "endpoint.base_url must be HTTPS")
|
|
104
|
+
need(bool(endpoint.get("key_env")), "endpoint.key_env is required")
|
|
105
|
+
for name, run in raw.get("runs", {}).items():
|
|
106
|
+
need(bool(run.get("levels")), "run %s needs levels" % name)
|
|
107
|
+
if "e2e" in run.get("levels", []):
|
|
108
|
+
need(run.get("max_tier") in TIERS, "run %s needs max_tier" % name)
|
|
109
|
+
budget = run.get("budget", {})
|
|
110
|
+
for key in ("max_requests", "max_requests_per_model", "max_output_tokens", "concurrency"):
|
|
111
|
+
need(isinstance(budget.get(key), int) and budget[key] > 0, "run %s budget.%s must be a positive integer" % (name, key))
|
|
112
|
+
need(set(raw.get("runs", {})) >= {"liveness", "readiness", "light", "nightly", "manual"}, "runs must define liveness, readiness, light, nightly and manual")
|
|
113
|
+
need(raw.get("retry", {}).get("inference", 1) == 0, "inference retries must be 0 (retries mask persistent failures and multiply cost)")
|
|
114
|
+
for name in ("request_s", "stream_idle_s", "stream_deadline_s", "liveness_s"):
|
|
115
|
+
need(raw.get("timeouts", {}).get(name, 0) > 0, "timeouts.%s must be positive" % name)
|
|
116
|
+
protocols = raw.get("protocols", {})
|
|
117
|
+
need(set(protocols) == {"chat", "responses"}, "protocols must be chat and responses")
|
|
118
|
+
need(raw.get("health", {}).get("rate_limit_backoff_s", 0) > 0, "health.rate_limit_backoff_s must be positive")
|
|
119
|
+
need(raw.get("routing", {}).get("strategy") in ("fill-first", "round-robin", "weighted-round-robin"), "routing.strategy is required")
|
|
120
|
+
|
|
121
|
+
tools = raw.get("tools", {})
|
|
122
|
+
for name, spec in tools.items():
|
|
123
|
+
need(isinstance(spec.get("parameters"), dict) and spec.get("description"), "tool %s needs description and parameters" % name)
|
|
124
|
+
|
|
125
|
+
seen, capabilities = set(), []
|
|
126
|
+
for check in raw.get("checks", []):
|
|
127
|
+
where = "check %s" % check.get("id")
|
|
128
|
+
need(check.get("id") and check["id"] not in seen, where + ": id missing or duplicated")
|
|
129
|
+
seen.add(check.get("id"))
|
|
130
|
+
need(check.get("kind") in KINDS, where + ": unknown kind")
|
|
131
|
+
need(check.get("severity") in SEVERITIES, where + ": invalid severity")
|
|
132
|
+
need(set(check.get("protocols", [])) <= set(protocols) and check.get("protocols"), where + ": invalid protocols")
|
|
133
|
+
tier = check.get("tier")
|
|
134
|
+
tiers = tier.values() if isinstance(tier, dict) else [tier]
|
|
135
|
+
need(all(t in TIERS for t in tiers), where + ": invalid tier")
|
|
136
|
+
if isinstance(tier, dict):
|
|
137
|
+
need(set(tier) == set(check.get("protocols", [])), where + ": tier map must cover exactly its protocols")
|
|
138
|
+
need(check.get("suites") and set(check["suites"]) <= set(SUITES), where + ": invalid suites")
|
|
139
|
+
turn_tools = list(check.get("turn", {}).get("tools", [])) + list(check.get("tools", []))
|
|
140
|
+
need(all(t in tools for t in turn_tools), where + ": references an undefined tool")
|
|
141
|
+
text = json.dumps(check)
|
|
142
|
+
unknown = set(re.findall(r"\{([a-z_]+)\}", text)) - set(VARIABLES)
|
|
143
|
+
need(not unknown, where + ": unknown placeholders " + ", ".join(sorted(unknown)))
|
|
144
|
+
for protocol in check.get("protocols", []):
|
|
145
|
+
capabilities.append(protocol + "." + str(check.get("id")))
|
|
146
|
+
names = {c.get("id") for c in raw.get("models", [])}
|
|
147
|
+
need(len(names) == len(raw.get("models", [])) and None not in names, "model ids must be unique")
|
|
148
|
+
need(bool(raw.get("models")), "at least one model is required")
|
|
149
|
+
profiles = raw.get("capability_profiles", {})
|
|
150
|
+
patterns = []
|
|
151
|
+
for name, profile in profiles.items():
|
|
152
|
+
patterns += [(p, "profile %s" % name) for p in profile.get("optional", [])]
|
|
153
|
+
patterns += [(p, "profile %s" % name) for p in profile.get("unsupported", {})]
|
|
154
|
+
for reason in profile.get("unsupported", {}).values():
|
|
155
|
+
need(bool(reason), "profile %s: unsupported capabilities need a reason" % name)
|
|
156
|
+
for model in raw.get("models", []):
|
|
157
|
+
where = "model %s" % model.get("id")
|
|
158
|
+
need(bool(model.get("id")) and model.get("provider"), where + ": id and provider are required")
|
|
159
|
+
need(model.get("profile") in profiles, where + ": unknown capability profile")
|
|
160
|
+
for pattern, value in model.get("capabilities", {}).items():
|
|
161
|
+
patterns.append((pattern, where))
|
|
162
|
+
state = value.get("state") if isinstance(value, dict) else value
|
|
163
|
+
need(state in STATES, where + ": invalid state for " + pattern)
|
|
164
|
+
if state == "unsupported":
|
|
165
|
+
need(isinstance(value, dict) and value.get("reason"), where + ": unsupported " + pattern + " needs a reason")
|
|
166
|
+
for pattern, owner in patterns:
|
|
167
|
+
need(any(fnmatch.fnmatchcase(c, pattern) for c in capabilities), "%s: pattern %r matches no capability" % (owner, pattern))
|
|
168
|
+
sim_ids, covered = set(), set()
|
|
169
|
+
for sim in raw.get("simulations", []):
|
|
170
|
+
need(sim.get("id") and sim["id"] not in sim_ids, "simulation %s: id missing or duplicated" % sim.get("id"))
|
|
171
|
+
sim_ids.add(sim.get("id"))
|
|
172
|
+
need(sim.get("capability") in raw.get("simulated_capabilities", {}), "simulation %s: unknown capability" % sim.get("id"))
|
|
173
|
+
need(bool(sim.get("accounts")) and bool(sim.get("steps")), "simulation %s: accounts and steps are required" % sim.get("id"))
|
|
174
|
+
covered.add(sim.get("capability"))
|
|
175
|
+
need(covered >= set(raw.get("simulated_capabilities", {})), "simulated capabilities lack a scenario: "
|
|
176
|
+
+ ", ".join(sorted(set(raw.get("simulated_capabilities", {})) - covered)))
|
|
177
|
+
missing = [c for c in CATEGORIES if c not in raw.get("diagnostics", {})]
|
|
178
|
+
need(not missing, "diagnostics lack guidance for: " + ", ".join(missing))
|
|
179
|
+
if problems:
|
|
180
|
+
raise ConfigError(problems)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def load(path=None):
|
|
184
|
+
raw = json.loads(pathlib.Path(path or DEFAULT_PATH).read_text())
|
|
185
|
+
validate(raw)
|
|
186
|
+
return Config(raw)
|