lighthouse-cli 0.18.0__tar.gz → 0.18.1__tar.gz
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.
- {lighthouse_cli-0.18.0/lighthouse_cli.egg-info → lighthouse_cli-0.18.1}/PKG-INFO +1 -1
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/__init__.py +1 -1
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/commands/verify.py +70 -2
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/locales/ar.json +4 -1
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/locales/de.json +4 -1
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/locales/en.json +4 -1
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/locales/es.json +4 -1
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/locales/fr.json +4 -1
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/locales/ga.json +4 -1
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/locales/it.json +4 -1
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/locales/ja.json +4 -1
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/locales/nl.json +4 -1
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/locales/pt.json +4 -1
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/locales/zh-Hans.json +4 -1
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/locales/zh-Hant.json +4 -1
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1/lighthouse_cli.egg-info}/PKG-INFO +1 -1
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/pyproject.toml +1 -1
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/tests/test_verify.py +70 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/LICENSE +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/NOTICE +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/README.md +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/__main__.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/commands/__init__.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/commands/agents.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/commands/builds.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/commands/collectors.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/commands/connect.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/commands/connections.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/commands/evals.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/commands/kb.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/commands/language.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/commands/limits.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/commands/login.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/commands/models.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/commands/offline.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/commands/runs.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/commands/spend.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/commands/stack.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/commands/terms.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/commands/whoami.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/config.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/credentials.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/device.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/exits.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/flags.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/http.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/i18n.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/main.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/out.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/py.typed +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse/sealing.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse_cli.egg-info/SOURCES.txt +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse_cli.egg-info/dependency_links.txt +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse_cli.egg-info/entry_points.txt +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse_cli.egg-info/requires.txt +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse_cli.egg-info/top_level.txt +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/setup.cfg +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/tests/test_ci_credential.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/tests/test_collectors.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/tests/test_commands.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/tests/test_connect_erp_hr.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/tests/test_connect_finav.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/tests/test_connect_library.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/tests/test_dev_surface.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/tests/test_fixtures.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/tests/test_golden.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/tests/test_i18n.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/tests/test_installers.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/tests/test_offline.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/tests/test_plumbing.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/tests/test_sealing.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/tests/test_stack.py +0 -0
- {lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/tests/test_version.py +0 -0
|
@@ -24,6 +24,13 @@ a portal receipt must verify with LightHouse's key, a deployment receipt
|
|
|
24
24
|
with that deployment's own. `--keys` takes another URL (https only) or a
|
|
25
25
|
saved copy of the keys file, and needs no sign-in.
|
|
26
26
|
|
|
27
|
+
**Versions.** A version 1 receipt (#47, #48) and a version 2 receipt
|
|
28
|
+
(0.18.1, contract 1.41) both verify. Version 2 also signs the display name of
|
|
29
|
+
the model that decided the answer, the tokens, the escalations and the
|
|
30
|
+
recorded cost (US dollars, and euros at the ECB rate of the day it was
|
|
31
|
+
issued), which this command prints. A version 2 receipt without those fields,
|
|
32
|
+
or with one of the wrong type, is refused as malformed.
|
|
33
|
+
|
|
27
34
|
**Rotation.** A receipt verifies while the key that signed it is listed,
|
|
28
35
|
current or retired. A key taken off the list no longer verifies anything.
|
|
29
36
|
|
|
@@ -42,7 +49,9 @@ import argparse
|
|
|
42
49
|
import base64
|
|
43
50
|
import hashlib
|
|
44
51
|
import json
|
|
52
|
+
import re
|
|
45
53
|
import sys
|
|
54
|
+
from decimal import Decimal
|
|
46
55
|
from pathlib import Path
|
|
47
56
|
from typing import Any
|
|
48
57
|
|
|
@@ -59,6 +68,9 @@ ISSUER = "https://ask.atlanticagenticlabs.com"
|
|
|
59
68
|
CLIENT = ("portal", "deployment")
|
|
60
69
|
KEYS_URL = f"{ISSUER}/.well-known/octy-keys.json"
|
|
61
70
|
MAX_BYTES = 1024 * 1024
|
|
71
|
+
V2_FIELDS = ("model", "tokens_in", "tokens_out", "escalations", "cost_usd_nano", "cost_eur_nano", "fx_date")
|
|
72
|
+
_LABEL = re.compile(r"^[^\x00-\x1f\x7f]{1,80}$")
|
|
73
|
+
_DATE = re.compile(r"^\d{4}-\d{2}-\d{2}$")
|
|
62
74
|
|
|
63
75
|
|
|
64
76
|
def _configure(ap: argparse.ArgumentParser) -> None:
|
|
@@ -87,6 +99,39 @@ def canonical(value: Any) -> bytes:
|
|
|
87
99
|
allow_nan=False).encode("utf-8")
|
|
88
100
|
|
|
89
101
|
|
|
102
|
+
def _count(v: Any) -> bool:
|
|
103
|
+
return isinstance(v, int) and not isinstance(v, bool) and v >= 0
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def _well_formed(receipt: dict[str, Any]) -> bool:
|
|
107
|
+
"""Version 1 carries none of version 2's fields; version 2 carries all
|
|
108
|
+
seven with their types (contract 1.41)."""
|
|
109
|
+
v = receipt.get("v")
|
|
110
|
+
if isinstance(v, bool) or v not in (1, 2):
|
|
111
|
+
return False
|
|
112
|
+
if v == 1:
|
|
113
|
+
return not any(k in receipt for k in V2_FIELDS)
|
|
114
|
+
if any(k not in receipt for k in V2_FIELDS):
|
|
115
|
+
return False
|
|
116
|
+
m = receipt["model"]
|
|
117
|
+
if m is not None and not (isinstance(m, dict) and set(m) == {"provider", "name"}
|
|
118
|
+
and all(isinstance(m[k], str) and _LABEL.fullmatch(m[k]) for k in m)):
|
|
119
|
+
return False
|
|
120
|
+
if not all(_count(receipt[k]) for k in ("tokens_in", "tokens_out", "escalations", "cost_usd_nano")):
|
|
121
|
+
return False
|
|
122
|
+
eur, day = receipt["cost_eur_nano"], receipt["fx_date"]
|
|
123
|
+
if eur is None or day is None:
|
|
124
|
+
return eur is None and day is None
|
|
125
|
+
return _count(eur) and isinstance(day, str) and _DATE.fullmatch(day) is not None
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def _amount(nanos: int) -> str:
|
|
129
|
+
"""Billionths as a decimal, trailing zeros trimmed."""
|
|
130
|
+
if nanos == 0:
|
|
131
|
+
return "0"
|
|
132
|
+
return format(Decimal(nanos).scaleb(-9), "f").rstrip("0").rstrip(".")
|
|
133
|
+
|
|
134
|
+
|
|
90
135
|
def _read(ctx: Context, name: str) -> bytes:
|
|
91
136
|
try:
|
|
92
137
|
if name == "-":
|
|
@@ -114,6 +159,8 @@ def _load_receipt(ctx: Context, name: str) -> dict[str, Any]:
|
|
|
114
159
|
if not isinstance(doc, dict) or doc.get("alg") != "Ed25519" or not isinstance(doc.get("sig"), str) \
|
|
115
160
|
or not isinstance(doc.get("kid"), str):
|
|
116
161
|
raise CliError(t("err.receipt_unreadable"), code=USAGE, error="receipt_unreadable")
|
|
162
|
+
if not _well_formed(doc):
|
|
163
|
+
raise CliError(t("err.receipt_malformed"), code=FAILED, error="receipt_malformed")
|
|
117
164
|
return doc
|
|
118
165
|
|
|
119
166
|
|
|
@@ -178,16 +225,25 @@ def verify_answer(ctx: Context) -> dict[str, Any]:
|
|
|
178
225
|
if receipt.get("answer_sha256") not in {hashlib.sha256(c).hexdigest() for c in texts}:
|
|
179
226
|
raise CliError(t("err.receipt_answer_mismatch"), code=FAILED, error="receipt_answer_mismatch")
|
|
180
227
|
answer = "matches"
|
|
181
|
-
|
|
228
|
+
body = {
|
|
182
229
|
"ok": True, "verified": True, "kid": receipt["kid"], "key_status": key.get("status") or "current",
|
|
183
230
|
"keys": source, "keys_url": (ctx.args.keys or KEYS_URL) if source == "url" else None,
|
|
184
231
|
"answer": answer,
|
|
185
|
-
"receipt": {"
|
|
232
|
+
"receipt": {"v": receipt["v"], "id": receipt.get("id"), "issuer": receipt.get("iss"),
|
|
233
|
+
"profile": receipt.get("profile"),
|
|
186
234
|
"kind": receipt.get("kind"), "produced": receipt.get("produced"),
|
|
187
235
|
"issued_at": receipt.get("issued_at"), "passages": len(receipt.get("passages") or []),
|
|
188
236
|
"reads": len(receipt.get("reads") or []), "corpus": receipt.get("corpus"),
|
|
189
237
|
"tenant": receipt.get("tenant"), "deployment": receipt.get("deployment")},
|
|
190
238
|
}
|
|
239
|
+
if receipt["v"] == 2:
|
|
240
|
+
eur = receipt["cost_eur_nano"]
|
|
241
|
+
# Signed with the rest: the model's display name, tokens, escalations and cost.
|
|
242
|
+
body["receipt"].update({
|
|
243
|
+
"model": receipt["model"], "tokens_in": receipt["tokens_in"], "tokens_out": receipt["tokens_out"],
|
|
244
|
+
"escalations": receipt["escalations"], "cost_usd": _amount(receipt["cost_usd_nano"]),
|
|
245
|
+
"cost_eur": _amount(eur) if eur is not None else None, "fx_date": receipt["fx_date"]})
|
|
246
|
+
return body
|
|
191
247
|
|
|
192
248
|
|
|
193
249
|
def _show(out: Out, body: dict[str, Any]) -> None:
|
|
@@ -198,10 +254,22 @@ def _show(out: Out, body: dict[str, Any]) -> None:
|
|
|
198
254
|
("issued", r["issued_at"]),
|
|
199
255
|
("kind", r["kind"]),
|
|
200
256
|
("passages", r["passages"]),
|
|
257
|
+
*(_signed_v2(r) if r.get("v") == 2 else []),
|
|
201
258
|
("signed with key", f"{body['kid']} ({body['key_status']})"),
|
|
202
259
|
("answer", t("verify.answer_matches") if body["answer"] == "matches"
|
|
203
260
|
else t("verify.answer_not_checked"))])
|
|
204
261
|
|
|
205
262
|
|
|
263
|
+
def _signed_v2(r: dict[str, Any]) -> list[tuple[str, Any]]:
|
|
264
|
+
m = r["model"]
|
|
265
|
+
cost = f"US${r['cost_usd']}"
|
|
266
|
+
if r["cost_eur"] is not None:
|
|
267
|
+
cost = f"€{r['cost_eur']} ({cost}, ECB {r['fx_date']})"
|
|
268
|
+
return [("model", f"{m['name']} · {m['provider']}" if m else None),
|
|
269
|
+
("tokens in/out", f"{r['tokens_in']:,} / {r['tokens_out']:,}"),
|
|
270
|
+
("escalations", r["escalations"]),
|
|
271
|
+
("cost", cost)]
|
|
272
|
+
|
|
273
|
+
|
|
206
274
|
COMMANDS = (Command("verify-answer", "check that an answer from Octy was signed by Atlantic Agentic and is unchanged",
|
|
207
275
|
_configure, verify_answer, _show, anonymous=True),)
|
|
@@ -383,5 +383,8 @@
|
|
|
383
383
|
"label.passages": "المقاطع",
|
|
384
384
|
"label.signed_with_key": "موقّع بالمفتاح",
|
|
385
385
|
"label.answer": "الإجابة",
|
|
386
|
-
"verify.verified_deployment": "الإيصال صالح: توقيع Octy صحيح."
|
|
386
|
+
"verify.verified_deployment": "الإيصال صالح: توقيع Octy صحيح.",
|
|
387
|
+
"err.receipt_malformed": "يجب أن يتضمن إيصال الإصدار 2 النموذج والرموز وعدد التصعيدات والتكلفة، كلٌّ بالنوع الصحيح",
|
|
388
|
+
"label.escalations": "التصعيدات",
|
|
389
|
+
"label.cost": "التكلفة"
|
|
387
390
|
}
|
|
@@ -383,5 +383,8 @@
|
|
|
383
383
|
"label.passages": "Passagen",
|
|
384
384
|
"label.signed_with_key": "signiert mit Schlüssel",
|
|
385
385
|
"label.answer": "Antwort",
|
|
386
|
-
"verify.verified_deployment": "Die Quittung ist gültig: Octys Signatur ist korrekt."
|
|
386
|
+
"verify.verified_deployment": "Die Quittung ist gültig: Octys Signatur ist korrekt.",
|
|
387
|
+
"err.receipt_malformed": "ein Beleg der Version 2 muss Modell, Tokens, Eskalationen und Kosten im richtigen Typ enthalten",
|
|
388
|
+
"label.escalations": "Eskalationen",
|
|
389
|
+
"label.cost": "Kosten"
|
|
387
390
|
}
|
|
@@ -383,5 +383,8 @@
|
|
|
383
383
|
"label.passages": "passages",
|
|
384
384
|
"label.signed_with_key": "signed with key",
|
|
385
385
|
"label.answer": "answer",
|
|
386
|
-
"verify.verified_deployment": "The receipt verifies: Octy's signature is valid."
|
|
386
|
+
"verify.verified_deployment": "The receipt verifies: Octy's signature is valid.",
|
|
387
|
+
"err.receipt_malformed": "a version 2 receipt must carry the model, tokens, escalations and cost, each of the right type",
|
|
388
|
+
"label.escalations": "escalations",
|
|
389
|
+
"label.cost": "cost"
|
|
387
390
|
}
|
|
@@ -383,5 +383,8 @@
|
|
|
383
383
|
"label.passages": "pasajes",
|
|
384
384
|
"label.signed_with_key": "firmado con la clave",
|
|
385
385
|
"label.answer": "respuesta",
|
|
386
|
-
"verify.verified_deployment": "El recibo es válido: la firma de Octy es correcta."
|
|
386
|
+
"verify.verified_deployment": "El recibo es válido: la firma de Octy es correcta.",
|
|
387
|
+
"err.receipt_malformed": "un recibo de la versión 2 debe incluir el modelo, los tokens, las escalaciones y el coste, cada uno con el tipo correcto",
|
|
388
|
+
"label.escalations": "escalaciones",
|
|
389
|
+
"label.cost": "coste"
|
|
387
390
|
}
|
|
@@ -383,5 +383,8 @@
|
|
|
383
383
|
"label.passages": "passages",
|
|
384
384
|
"label.signed_with_key": "signé avec la clé",
|
|
385
385
|
"label.answer": "réponse",
|
|
386
|
-
"verify.verified_deployment": "Le reçu est valide : la signature d'Octy est correcte."
|
|
386
|
+
"verify.verified_deployment": "Le reçu est valide : la signature d'Octy est correcte.",
|
|
387
|
+
"err.receipt_malformed": "un reçu de version 2 doit contenir le modèle, les jetons, les escalades et le coût, chacun du bon type",
|
|
388
|
+
"label.escalations": "escalades",
|
|
389
|
+
"label.cost": "coût"
|
|
387
390
|
}
|
|
@@ -383,5 +383,8 @@
|
|
|
383
383
|
"label.passages": "sleachta",
|
|
384
384
|
"label.signed_with_key": "sínithe leis an eochair",
|
|
385
385
|
"label.answer": "freagra",
|
|
386
|
-
"verify.verified_deployment": "Tá an admháil bailí: tá síniú Octy ceart."
|
|
386
|
+
"verify.verified_deployment": "Tá an admháil bailí: tá síniú Octy ceart.",
|
|
387
|
+
"err.receipt_malformed": "caithfidh an tsamhail, na comharthaí, na géaruithe agus an costas a bheith in admháil leagan 2, gach ceann den chineál ceart",
|
|
388
|
+
"label.escalations": "géaruithe",
|
|
389
|
+
"label.cost": "costas"
|
|
387
390
|
}
|
|
@@ -383,5 +383,8 @@
|
|
|
383
383
|
"label.passages": "passaggi",
|
|
384
384
|
"label.signed_with_key": "firmata con la chiave",
|
|
385
385
|
"label.answer": "risposta",
|
|
386
|
-
"verify.verified_deployment": "La ricevuta è valida: la firma di Octy è corretta."
|
|
386
|
+
"verify.verified_deployment": "La ricevuta è valida: la firma di Octy è corretta.",
|
|
387
|
+
"err.receipt_malformed": "una ricevuta della versione 2 deve riportare modello, token, escalation e costo, ciascuno del tipo corretto",
|
|
388
|
+
"label.escalations": "escalation",
|
|
389
|
+
"label.cost": "costo"
|
|
387
390
|
}
|
|
@@ -383,5 +383,8 @@
|
|
|
383
383
|
"label.passages": "パッセージ",
|
|
384
384
|
"label.signed_with_key": "署名鍵",
|
|
385
385
|
"label.answer": "回答",
|
|
386
|
-
"verify.verified_deployment": "レシートは有効です: Octy の署名は正しいです。"
|
|
386
|
+
"verify.verified_deployment": "レシートは有効です: Octy の署名は正しいです。",
|
|
387
|
+
"err.receipt_malformed": "バージョン 2 のレシートには、モデル、トークン、エスカレーション、コストを正しい型で含める必要があります",
|
|
388
|
+
"label.escalations": "エスカレーション",
|
|
389
|
+
"label.cost": "コスト"
|
|
387
390
|
}
|
|
@@ -383,5 +383,8 @@
|
|
|
383
383
|
"label.passages": "passages",
|
|
384
384
|
"label.signed_with_key": "ondertekend met sleutel",
|
|
385
385
|
"label.answer": "antwoord",
|
|
386
|
-
"verify.verified_deployment": "Het ontvangstbewijs is geldig: de handtekening van Octy klopt."
|
|
386
|
+
"verify.verified_deployment": "Het ontvangstbewijs is geldig: de handtekening van Octy klopt.",
|
|
387
|
+
"err.receipt_malformed": "een ontvangstbewijs van versie 2 moet het model, de tokens, de escalaties en de kosten bevatten, elk van het juiste type",
|
|
388
|
+
"label.escalations": "escalaties",
|
|
389
|
+
"label.cost": "kosten"
|
|
387
390
|
}
|
|
@@ -383,5 +383,8 @@
|
|
|
383
383
|
"label.passages": "passagens",
|
|
384
384
|
"label.signed_with_key": "assinado com a chave",
|
|
385
385
|
"label.answer": "resposta",
|
|
386
|
-
"verify.verified_deployment": "O recibo é válido: a assinatura da Octy está correta."
|
|
386
|
+
"verify.verified_deployment": "O recibo é válido: a assinatura da Octy está correta.",
|
|
387
|
+
"err.receipt_malformed": "um recibo da versão 2 tem de incluir o modelo, os tokens, as escalações e o custo, cada um do tipo correto",
|
|
388
|
+
"label.escalations": "escalações",
|
|
389
|
+
"label.cost": "custo"
|
|
387
390
|
}
|
|
@@ -383,5 +383,8 @@
|
|
|
383
383
|
"label.passages": "段落",
|
|
384
384
|
"label.signed_with_key": "签名密钥",
|
|
385
385
|
"label.answer": "回答",
|
|
386
|
-
"verify.verified_deployment": "回执有效:Octy 的签名正确。"
|
|
386
|
+
"verify.verified_deployment": "回执有效:Octy 的签名正确。",
|
|
387
|
+
"err.receipt_malformed": "第 2 版回执必须包含模型、令牌、升级次数和费用,且类型正确",
|
|
388
|
+
"label.escalations": "升级次数",
|
|
389
|
+
"label.cost": "费用"
|
|
387
390
|
}
|
|
@@ -383,5 +383,8 @@
|
|
|
383
383
|
"label.passages": "段落",
|
|
384
384
|
"label.signed_with_key": "簽署金鑰",
|
|
385
385
|
"label.answer": "回答",
|
|
386
|
-
"verify.verified_deployment": "收據有效:Octy 的簽章正確。"
|
|
386
|
+
"verify.verified_deployment": "收據有效:Octy 的簽章正確。",
|
|
387
|
+
"err.receipt_malformed": "第 2 版回執必須包含模型、權杖、升級次數和費用,且類型正確",
|
|
388
|
+
"label.escalations": "升級次數",
|
|
389
|
+
"label.cost": "費用"
|
|
387
390
|
}
|
|
@@ -18,7 +18,7 @@ build-backend = "setuptools.build_meta"
|
|
|
18
18
|
|
|
19
19
|
[project]
|
|
20
20
|
name = "lighthouse-cli"
|
|
21
|
-
version = "0.18.
|
|
21
|
+
version = "0.18.1"
|
|
22
22
|
description = "The LightHouse command line: sign in, connect your estate, deploy agents, watch runs"
|
|
23
23
|
requires-python = ">=3.11"
|
|
24
24
|
license = "Apache-2.0"
|
|
@@ -125,3 +125,73 @@ def test_the_keys_unreachable_is_a_clear_failure(run: Runner):
|
|
|
125
125
|
f.write_text(json.dumps(signed(Ed25519PrivateKey.generate(), "octy-2026-11")))
|
|
126
126
|
r = run("verify-answer", str(f), "--json")
|
|
127
127
|
assert r.code == 1 and "keys_unavailable" in r.stdout + r.stderr
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
# -- receipt version 2 (contract 1.41) -----------------------------------------------------------
|
|
131
|
+
|
|
132
|
+
V2 = json.loads((FIX / "receipt-v2-fixture.json").read_text())
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def _v2_files(tmp: Path, receipt: dict[str, Any] | None = None) -> tuple[Path, Path]:
|
|
136
|
+
r, k = tmp / "v2.json", tmp / "v2-keys.json"
|
|
137
|
+
r.write_text(json.dumps(receipt if receipt is not None else V2["receipt"]))
|
|
138
|
+
k.write_text(json.dumps(V2["keys"]))
|
|
139
|
+
return r, k
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def test_a_v2_receipt_verifies_and_prints_what_it_signs(run: Runner, tmp_path: Path):
|
|
143
|
+
r, k = _v2_files(tmp_path)
|
|
144
|
+
answer = tmp_path / "a.txt"
|
|
145
|
+
answer.write_text(V2["answer"])
|
|
146
|
+
out = run("verify-answer", str(r), "--keys", str(k), "--answer", str(answer), "--json")
|
|
147
|
+
assert out.code == 0, out.stderr
|
|
148
|
+
body = json.loads(out.stdout)["receipt"]
|
|
149
|
+
assert body["v"] == 2 and body["model"] == {"provider": "Amazon Bedrock", "name": "Amazon Nova Micro"}
|
|
150
|
+
assert (body["tokens_in"], body["tokens_out"], body["escalations"]) == (1834, 61, 0)
|
|
151
|
+
assert body["cost_usd"] == "0.00007277" and body["cost_eur"] == "0.000062624" and body["fx_date"] == "2026-11-12"
|
|
152
|
+
human = run("verify-answer", str(r), "--keys", str(k))
|
|
153
|
+
assert human.code == 0
|
|
154
|
+
for shown in ("Amazon Nova Micro · Amazon Bedrock", "1,834 / 61", "€0.000062624", "US$0.00007277",
|
|
155
|
+
"ECB 2026-11-12", "escalations"):
|
|
156
|
+
assert shown in human.stdout, shown
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def test_a_v2_receipt_without_a_model_or_rate_prints_dollars_only(run: Runner, tmp_path: Path):
|
|
160
|
+
key = Ed25519PrivateKey.generate()
|
|
161
|
+
receipt = signed(key, "octy-2026-11", v=2, model=None, tokens_in=0, tokens_out=0, escalations=0,
|
|
162
|
+
cost_usd_nano=0, cost_eur_nano=None, fx_date=None)
|
|
163
|
+
f = tmp_path / "r.json"
|
|
164
|
+
f.write_text(json.dumps(receipt))
|
|
165
|
+
keys = tmp_path / "k.json"
|
|
166
|
+
keys.write_text(json.dumps(jwks(("octy-2026-11", key, "current"))))
|
|
167
|
+
out = run("verify-answer", str(f), "--keys", str(keys))
|
|
168
|
+
assert out.code == 0 and "US$0" in out.stdout and "€" not in out.stdout
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def test_the_v1_receipt_still_verifies_and_prints_no_v2_lines(run: Runner, tmp_path: Path):
|
|
172
|
+
r, k = tmp_path / "v1.json", tmp_path / "v1-keys.json"
|
|
173
|
+
r.write_text(json.dumps(V2["v1_receipt"]))
|
|
174
|
+
k.write_text(json.dumps(V2["v1_keys"]))
|
|
175
|
+
out = run("verify-answer", str(r), "--keys", str(k), "--json")
|
|
176
|
+
assert out.code == 0 and "model" not in json.loads(out.stdout)["receipt"]
|
|
177
|
+
assert "escalations" not in run("verify-answer", str(r), "--keys", str(k)).stdout
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def test_a_tampered_v2_receipt_is_refused(run: Runner, tmp_path: Path):
|
|
181
|
+
r, k = _v2_files(tmp_path, V2["tampered_receipt"])
|
|
182
|
+
out = run("verify-answer", str(r), "--keys", str(k), "--json")
|
|
183
|
+
assert out.code == 1 and "receipt_invalid" in out.stdout + out.stderr
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def test_a_malformed_v2_receipt_is_refused_as_malformed(run: Runner, tmp_path: Path):
|
|
187
|
+
good = V2["receipt"]
|
|
188
|
+
for change in ({"tokens_in": "1834"}, {"cost_eur_nano": None}, {"model": {"name": "x"}}, {"v": 3},
|
|
189
|
+
{k: v for k, v in good.items() if k != "escalations"}):
|
|
190
|
+
bad = {**good, **change} if "id" not in change else change
|
|
191
|
+
r, k = _v2_files(tmp_path, bad)
|
|
192
|
+
out = run("verify-answer", str(r), "--keys", str(k), "--json")
|
|
193
|
+
assert out.code == 1 and "receipt_malformed" in out.stdout + out.stderr, change
|
|
194
|
+
# A version 1 receipt carrying a version 2 field is malformed too.
|
|
195
|
+
r, k = _v2_files(tmp_path, {**V2["v1_receipt"], "tokens_in": 1})
|
|
196
|
+
assert "receipt_malformed" in "".join(
|
|
197
|
+
(lambda o: o.stdout + o.stderr)(run("verify-answer", str(r), "--keys", str(k), "--json")))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lighthouse_cli-0.18.0 → lighthouse_cli-0.18.1}/lighthouse_cli.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|