Skip to content

Commit 3a61740

Browse files
Fix Nostr tag name: l402_endpoint → l402 to match NIP draft
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9d7c44a commit 3a61740

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/le_agent_sdk/models/agreement.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def from_nostr_event(cls, event: dict[str, Any]) -> AgentServiceAgreement:
6363
agr.agreed_price_sats = int(tag[1])
6464
except (ValueError, TypeError):
6565
agr.agreed_price_sats = 0
66-
elif key == "l402_endpoint" and len(tag) > 1:
66+
elif key == "l402" and len(tag) > 1:
6767
agr.l402_endpoint = tag[1]
6868
elif key == "terms" and len(tag) > 1:
6969
agr.terms = tag[1]
@@ -135,7 +135,7 @@ def to_nostr_tags(self) -> list[list[str]]:
135135
tags.append(["price", str(self.agreed_price_sats)])
136136

137137
if self.l402_endpoint:
138-
tags.append(["l402_endpoint", self.l402_endpoint])
138+
tags.append(["l402", self.l402_endpoint])
139139

140140
if self.terms:
141141
tags.append(["terms", self.terms])

src/le_agent_sdk/models/capability.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def from_nostr_event(cls, event: dict[str, Any]) -> AgentCapability:
7373
cap.categories.append(tag[1])
7474
elif key == "price" and len(tag) > 1:
7575
cap.pricing.append(AgentPricing.from_tag(tag))
76-
elif key == "l402_endpoint" and len(tag) > 1:
76+
elif key == "l402" and len(tag) > 1:
7777
cap.l402_endpoint = tag[1]
7878
elif key == "api_endpoint" and len(tag) > 1:
7979
cap.api_endpoint = tag[1]
@@ -100,7 +100,7 @@ def to_nostr_tags(self) -> list[list[str]]:
100100
tags.append(p.to_tag())
101101

102102
if self.l402_endpoint:
103-
tags.append(["l402_endpoint", self.l402_endpoint])
103+
tags.append(["l402", self.l402_endpoint])
104104

105105
if self.api_endpoint:
106106
tags.append(["api_endpoint", self.api_endpoint])

tests/test_models.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def _sample_event(self) -> dict:
6060
["s", "translation"],
6161
["price", "10", "sats", "per-request"],
6262
["price", "1", "sats", "per-token"],
63-
["l402_endpoint", "https://api.example.com/l402/translate"],
63+
["l402", "https://api.example.com/l402/translate"],
6464
["api_endpoint", "https://api.example.com/translate"],
6565
["api_method", "POST"],
6666
["schema", "https://api.example.com/schema.json"],
@@ -102,7 +102,7 @@ def test_to_nostr_tags(self):
102102
assert ["d", "test-svc"] in tags
103103
assert ["s", "ai"] in tags
104104
assert ["price", "5", "sats", "per-request"] in tags
105-
assert ["l402_endpoint", "https://example.com/l402"] in tags
105+
assert ["l402", "https://example.com/l402"] in tags
106106
assert ["t", "test"] in tags
107107

108108
def test_roundtrip(self):
@@ -242,7 +242,7 @@ def _sample_event(self) -> dict:
242242
["p", "provider_pub"],
243243
["p", "requester_pub"],
244244
["price", "100"],
245-
["l402_endpoint", "https://api.example.com/l402/service"],
245+
["l402", "https://api.example.com/l402/service"],
246246
["terms", "Max 10 requests per minute"],
247247
["expiration", "1700100000"],
248248
],
@@ -281,7 +281,7 @@ def test_to_nostr_tags(self):
281281
assert len(e_tags) == 2
282282
assert len(p_tags) == 2
283283
assert ["price", "50"] in tags
284-
assert ["l402_endpoint", "https://example.com/l402"] in tags
284+
assert ["l402", "https://example.com/l402"] in tags
285285
assert ["terms", "Terms here"] in tags
286286
assert ["expiration", "1800000000"] in tags
287287

0 commit comments

Comments
 (0)