You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: register new tools + deprecate legacy reporting
Register kya_web_fetch and kya_getHeaders in index.ts.
Deprecate kya_reportBadgeOutcome and kya_reportBadgeNotPresented
to no-ops — outcomes tracked server-side via verify endpoint,
not-presented event no longer scored. Both log once-per-session
stderr warning. Remove unused imports.
Update kya_reportBadgePresented description to stop referencing
the now-deprecated kya_reportBadgeOutcome.
Part of: KYA-55
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
`Report that you presented your Badge to a merchant. Call this immediately after merging the checkoutPatch into a checkout payload. Required for kyaLabs to record the trip.
67
67
68
-
When Extended Auth is enabled, kyaLabs checks back 7 seconds later. Otherwise, call kya_reportBadgeOutcome when you know the result.`,
68
+
When Extended Auth is enabled, kyaLabs checks back 7 seconds later to record the outcome automatically.`,
69
69
{
70
70
verification_token: z.string().describe(
71
71
"The verification_token returned by kya_getAgentIdentity"
@@ -100,11 +100,13 @@ When Extended Auth is enabled, kyaLabs checks back 7 seconds later. Otherwise, c
100
100
}
101
101
);
102
102
103
+
let_warnedOutcome=false;
104
+
103
105
server.tool(
104
106
"kya_reportBadgeOutcome",
105
-
`Report how the merchant responded when you presented your Badge.
107
+
`[DEPRECATED — outcomes are now tracked automatically via the verify endpoint. This tool will be removed in a future version.]
106
108
107
-
Call this after kya_reportBadgePresented when you know whether the merchant accepted or denied you. Use when Extended Auth is disabled, or to report earlier than the 7-second check.`,
109
+
Report how the merchant responded when you presented your Badge.`,
108
110
{
109
111
verification_token: z.string().describe(
110
112
"The verification_token returned by kya_getAgentIdentity"
@@ -121,22 +123,27 @@ Call this after kya_reportBadgePresented when you know whether the merchant acce
121
123
"Trip ID from kya_getAgentIdentity — links events in this shopping session"
process.stderr.write("[badge] WARNING: kya_reportBadgeNotPresented is deprecated.\n");
164
+
_warnedNotPresented=true;
165
+
}
156
166
return{
157
167
content: [{
158
168
type: "text",
159
-
text: `✓ Notpresented recorded at ${merchant} (${reason})`,
169
+
text: `Not-presented acknowledged at ${merchant} (${reason}) (deprecated).`,
160
170
}],
161
171
};
162
172
}
163
173
);
164
174
175
+
server.tool(
176
+
"kya_web_fetch",
177
+
`Fetch a web page with your Badge identity attached. Your Kya-Token header is injected automatically — merchants see you as an authorized actor, not a bot. Your visit is automatically recorded in your shopping journal.
178
+
179
+
Call kya_getAgentIdentity first. Then use this instead of web_fetch when shopping at merchant sites. HTTPS only. Returns status, headers, and body (5MB max, 30s timeout). Redirects are not followed — check the Location header if you receive a 3xx status.`,
180
+
{
181
+
url: z.string().max(2000).describe(
182
+
"The HTTPS URL to fetch (e.g., 'https://etsy.com/products')"
`Get identity headers for your own HTTP requests. Returns a Kya-Token header you can attach to requests made through Playwright, browser extensions, or any HTTP client you control.
208
+
209
+
Call kya_getAgentIdentity first to establish your identity. Then pass these headers to page.setExtraHTTPHeaders() for browser automation, or set as a cookie via document.cookie for Chrome extensions.`,
0 commit comments