agent-cards 0.5.46 → 0.5.51
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/dist/src/commands/buy-chat.d.ts +7 -9
- package/dist/src/commands/buy-chat.d.ts.map +1 -1
- package/dist/src/commands/buy-chat.js +252 -86
- package/dist/src/commands/buy-chat.js.map +1 -1
- package/dist/src/lib/config.d.ts +8 -0
- package/dist/src/lib/config.d.ts.map +1 -1
- package/dist/src/lib/config.js +28 -0
- package/dist/src/lib/config.js.map +1 -1
- package/package.json +8 -4
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Natural-language `buy` chat.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* response (the loop runs several DoorDash/Anthropic round-trips server-side, so a turn can
|
|
6
|
-
* take 10–30s — we show an `ora` spinner while it runs). No SSE needed.
|
|
2
|
+
* Natural-language `buy` chat. Runs a Vercel AI SDK ToolLoopAgent locally: it connects to the
|
|
3
|
+
* AgentCard MCP server (`/mcp`, authenticated with the stored JWT), loads ALL of its tools, and
|
|
4
|
+
* lets the model use any of them. Model calls go through the backend `/buy/agent/llm` gateway.
|
|
7
5
|
*
|
|
8
|
-
* `seed` is an optional first message auto-sent right after the
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
6
|
+
* `seed` is an optional first message auto-sent right after the banner — this is how
|
|
7
|
+
* `agent-cards buy <free text>` works: the free text becomes the first turn, then the user stays
|
|
8
|
+
* in the interactive loop. The chat is in-memory for the session (no server-stored conversation),
|
|
9
|
+
* so `--resume` is not supported here; it prints a notice and starts fresh.
|
|
12
10
|
*/
|
|
13
11
|
export declare function buyChat(resume?: string, seed?: string): Promise<void>;
|
|
14
12
|
//# sourceMappingURL=buy-chat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buy-chat.d.ts","sourceRoot":"","sources":["../../../src/commands/buy-chat.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buy-chat.d.ts","sourceRoot":"","sources":["../../../src/commands/buy-chat.ts"],"names":[],"mappings":"AAuGA;;;;;;;;;GASG;AACH,wBAAsB,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA+K3E"}
|
|
@@ -2,29 +2,114 @@ import chalk from 'chalk';
|
|
|
2
2
|
import readline from 'readline';
|
|
3
3
|
import ora from 'ora';
|
|
4
4
|
import figlet from 'figlet';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { createMCPClient } from '@ai-sdk/mcp';
|
|
6
|
+
import { createAnthropic } from '@ai-sdk/anthropic';
|
|
7
|
+
import { ToolLoopAgent, stepCountIs } from 'ai';
|
|
8
|
+
import { getJwt, getApiUrl, getMcpUrl } from '../lib/config.js';
|
|
9
|
+
// The buy chat runs the agent loop HERE in the CLI (Vercel AI SDK), connecting to the AgentCard
|
|
10
|
+
// MCP server as a client to get the user's FULL toolset (shopping, cards, wallet, KYC, plan,
|
|
11
|
+
// transactions, support, …). Model calls are proxied through the backend `/buy/agent/llm` gateway
|
|
12
|
+
// so the dedicated Anthropic key stays server-side and never ships in this public npm package.
|
|
13
|
+
// Claude model the loop runs. Must be a `claude-*` id (the gateway allowlists that family).
|
|
14
|
+
// Matches the backend's BUY_AGENT_MODEL default; override with AGENT_CARDS_BUY_MODEL.
|
|
15
|
+
const MODEL_ID = process.env.AGENT_CARDS_BUY_MODEL || 'claude-sonnet-4-6';
|
|
16
|
+
// Hard ceiling on tool round-trips per turn — a backstop against a runaway loop.
|
|
17
|
+
const MAX_STEPS = 30;
|
|
18
|
+
const SYSTEM = [
|
|
19
|
+
'You are the AgentCard agent, operating inside the `agent-cards` command-line tool for a logged-in user.',
|
|
20
|
+
'You have the user\'s full AgentCard toolset over MCP: natural-language shopping + checkout (the `buy` tool),',
|
|
21
|
+
'virtual cards, wallet & funding, KYC, plan/subscription, transactions, connected apps, settings, and support.',
|
|
22
|
+
'',
|
|
23
|
+
'MONEY SAFETY (critical): never place an order, create or fund a card, or move money without the user\'s',
|
|
24
|
+
'explicit confirmation in the conversation. Before any purchase, show the itemized cart and the exact total,',
|
|
25
|
+
'then wait for a clear "yes". The shopping/checkout tools also confirm server-side — never try to bypass that.',
|
|
26
|
+
'',
|
|
27
|
+
'FAITHFUL RELAY (critical): when a tool returns information for the user — saved addresses, store/product',
|
|
28
|
+
'options, cart contents, a balance, transactions, or any list — include the ACTUAL contents in your reply',
|
|
29
|
+
'(e.g. list the actual options or items it returned). NEVER say "here are your options", "I\'ve pulled up X",',
|
|
30
|
+
'or "here are your addresses" unless you are actually showing those contents in that same message. The `buy`',
|
|
31
|
+
'tool is itself a shopping assistant — relay its questions, options, cart, and totals to the user faithfully,',
|
|
32
|
+
'and if it returned nothing to show, say so plainly and ask for what\'s needed rather than pretending.',
|
|
33
|
+
'',
|
|
34
|
+
'SAVED ADDRESSES: the saved delivery-address list is often long, so when you show it list only the FIRST 3',
|
|
35
|
+
'(numbered 1, 2, 3), then state how many more there are and invite the user to see them (e.g. "...and 8 more —',
|
|
36
|
+
'just ask to see them all"). You already have the full list from the tool result, so if they ask for more, show',
|
|
37
|
+
'the rest from what you already retrieved; do NOT call the tool again. This first-3 rule applies only to addresses.',
|
|
38
|
+
'',
|
|
39
|
+
'TERMINAL OUTPUT: your replies print in a plain-text terminal, NOT rendered Markdown. Do NOT use Markdown —',
|
|
40
|
+
'no **bold**, *italics*, `backticks`, # headings, or tables; they show up as literal characters (e.g. "**$24.76**"',
|
|
41
|
+
'would appear to the user with the asterisks). Write plain text: just write $24.76, and use simple "- " bullets',
|
|
42
|
+
'or "1." numbers for lists.',
|
|
43
|
+
'',
|
|
44
|
+
'EFFICIENCY (top priority — speed matters): minimize tool calls and latency. You already have the usage guide',
|
|
45
|
+
'above, so NEVER call get_instructions. Once a merchant is linked and a delivery address is selected, do NOT',
|
|
46
|
+
're-link the merchant or re-set the address on later turns — that state persists server-side. Each turn, do only',
|
|
47
|
+
'the NEXT needed action (search, add to cart, review, check out); never repeat setup you already completed.',
|
|
48
|
+
'',
|
|
49
|
+
'',
|
|
50
|
+
'CONVERSATION THREADING (critical for correctness): the `buy` tool returns a conversation_id',
|
|
51
|
+
'on every call — this id tracks the cart, address, and confirmation snapshot across turns.',
|
|
52
|
+
'You MUST pass that exact conversation_id back as the conversation_id parameter on every',
|
|
53
|
+
'subsequent `buy` call to keep the SAME order alive and avoid losing the cart. Extract it',
|
|
54
|
+
'from the tool result\'s structured data and thread it back immediately. Only omit it (or',
|
|
55
|
+
'pass new_order=true) when the user explicitly says "start over", "new order", or asks',
|
|
56
|
+
'to switch to a different purchase. Omitting conversation_id on follow-ups breaks the order.',
|
|
57
|
+
'Be concise and conversational. Briefly say what you\'re about to do, then do it. When a tool needs information',
|
|
58
|
+
'you don\'t have yet (a delivery address, which card, an amount), ask the user rather than guessing.',
|
|
59
|
+
].join('\n');
|
|
60
|
+
function printYou(text) {
|
|
61
|
+
console.log(`${chalk.cyan('you')} ${text}`);
|
|
9
62
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
63
|
+
/** Animated green ASCII banner (kept from the original chat UX). */
|
|
64
|
+
async function renderBanner() {
|
|
65
|
+
const banner = figlet.textSync('buy', { font: 'Small' });
|
|
66
|
+
const lines = banner.split('\n');
|
|
67
|
+
const totalChars = Math.max(...lines.map((l) => l.length));
|
|
68
|
+
const frames = totalChars + 6;
|
|
69
|
+
const bannerHeight = lines.length;
|
|
70
|
+
console.log();
|
|
71
|
+
for (const line of lines)
|
|
72
|
+
console.log(chalk.dim(line));
|
|
73
|
+
for (let frame = 0; frame < frames; frame++) {
|
|
74
|
+
process.stdout.write(`\x1B[${bannerHeight}A`);
|
|
75
|
+
for (const line of lines) {
|
|
76
|
+
let out = '';
|
|
77
|
+
for (let i = 0; i < line.length; i++) {
|
|
78
|
+
if (i >= frame - 3 && i <= frame)
|
|
79
|
+
out += chalk.green(line[i]);
|
|
80
|
+
else if (i < frame - 3)
|
|
81
|
+
out += chalk.greenBright(line[i]);
|
|
82
|
+
else
|
|
83
|
+
out += chalk.dim(line[i]);
|
|
84
|
+
}
|
|
85
|
+
process.stdout.write('\x1B[2K' + out + '\n');
|
|
86
|
+
}
|
|
87
|
+
await new Promise((r) => setTimeout(r, 12));
|
|
88
|
+
}
|
|
89
|
+
process.stdout.write(`\x1B[${bannerHeight}A`);
|
|
90
|
+
for (const line of lines)
|
|
91
|
+
process.stdout.write('\x1B[2K' + chalk.green(line) + '\n');
|
|
92
|
+
}
|
|
93
|
+
/** Turn an agent/HTTP error into a short, user-facing line. */
|
|
94
|
+
function friendlyError(err) {
|
|
95
|
+
const status = err?.statusCode ?? err?.status ?? err?.data?.error?.status;
|
|
96
|
+
if (status === 401)
|
|
97
|
+
return 'your session expired. run `agent-cards login` and try again.';
|
|
98
|
+
if (status === 429)
|
|
99
|
+
return 'you\'ve hit today\'s usage limit. try again later.';
|
|
100
|
+
if (status === 503)
|
|
101
|
+
return 'buy chat isn\'t available right now. try again in a moment.';
|
|
102
|
+
return `something went wrong: ${err?.message ?? String(err)}`;
|
|
16
103
|
}
|
|
17
104
|
/**
|
|
18
|
-
* Natural-language `buy` chat.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* response (the loop runs several DoorDash/Anthropic round-trips server-side, so a turn can
|
|
22
|
-
* take 10–30s — we show an `ora` spinner while it runs). No SSE needed.
|
|
105
|
+
* Natural-language `buy` chat. Runs a Vercel AI SDK ToolLoopAgent locally: it connects to the
|
|
106
|
+
* AgentCard MCP server (`/mcp`, authenticated with the stored JWT), loads ALL of its tools, and
|
|
107
|
+
* lets the model use any of them. Model calls go through the backend `/buy/agent/llm` gateway.
|
|
23
108
|
*
|
|
24
|
-
* `seed` is an optional first message auto-sent right after the
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
109
|
+
* `seed` is an optional first message auto-sent right after the banner — this is how
|
|
110
|
+
* `agent-cards buy <free text>` works: the free text becomes the first turn, then the user stays
|
|
111
|
+
* in the interactive loop. The chat is in-memory for the session (no server-stored conversation),
|
|
112
|
+
* so `--resume` is not supported here; it prints a notice and starts fresh.
|
|
28
113
|
*/
|
|
29
114
|
export async function buyChat(resume, seed) {
|
|
30
115
|
const jwt = getJwt();
|
|
@@ -35,85 +120,166 @@ export async function buyChat(resume, seed) {
|
|
|
35
120
|
console.log();
|
|
36
121
|
process.exit(1);
|
|
37
122
|
}
|
|
38
|
-
|
|
123
|
+
await renderBanner();
|
|
39
124
|
if (resume) {
|
|
40
|
-
|
|
41
|
-
console.log(chalk.dim(`resuming ${conversationId}\n`));
|
|
42
|
-
const messages = await api(`/buy/agent/conversations/${conversationId}/messages`);
|
|
43
|
-
for (const msg of messages) {
|
|
44
|
-
printMsg(msg.role, msg.body, ts(msg.createdAt));
|
|
45
|
-
}
|
|
46
|
-
console.log();
|
|
125
|
+
console.log(chalk.dim('the buy chat now runs locally and starts fresh each session — --resume isn\'t available.'));
|
|
47
126
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
for (let i = 0; i < line.length; i++) {
|
|
68
|
-
if (i >= frame - 3 && i <= frame) {
|
|
69
|
-
out += chalk.green(line[i]);
|
|
70
|
-
}
|
|
71
|
-
else if (i < frame - 3) {
|
|
72
|
-
out += chalk.greenBright(line[i]);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
out += chalk.dim(line[i]);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
process.stdout.write('\x1B[2K' + out + '\n');
|
|
127
|
+
// Connect to the MCP server and build the agent over its full toolset.
|
|
128
|
+
const connecting = ora({ text: chalk.dim('connecting'), color: 'green', discardStdin: false }).start();
|
|
129
|
+
let mcpClient;
|
|
130
|
+
let agent;
|
|
131
|
+
try {
|
|
132
|
+
mcpClient = await createMCPClient({
|
|
133
|
+
transport: { type: 'http', url: getMcpUrl(), headers: { Authorization: `Bearer ${jwt}` } },
|
|
134
|
+
});
|
|
135
|
+
const tools = (await mcpClient.tools());
|
|
136
|
+
// Pre-load the usage guide ONCE and fold it into the system prompt, then drop get_instructions
|
|
137
|
+
// from the callable toolset. Otherwise the model re-fetches it on EVERY turn (the MCP server's
|
|
138
|
+
// own guidance says "call get_instructions first") — pure latency, since the guide never changes.
|
|
139
|
+
let systemPrompt = SYSTEM;
|
|
140
|
+
if (tools.get_instructions) {
|
|
141
|
+
try {
|
|
142
|
+
const res = await tools.get_instructions.execute({}, { toolCallId: 'init', messages: [] });
|
|
143
|
+
const guide = (res?.content ?? []).filter((c) => c?.type === 'text').map((c) => c.text).join('\n').trim();
|
|
144
|
+
if (guide)
|
|
145
|
+
systemPrompt += `\n\nAGENTCARD USAGE GUIDE (already loaded for you — do NOT call get_instructions):\n${guide}`;
|
|
79
146
|
}
|
|
80
|
-
|
|
147
|
+
catch { /* non-fatal: proceed without the preloaded guide */ }
|
|
148
|
+
delete tools.get_instructions;
|
|
81
149
|
}
|
|
82
|
-
//
|
|
83
|
-
process
|
|
84
|
-
|
|
85
|
-
|
|
150
|
+
// Auto-thread the buy conversation_id across turns. The `buy` tool returns a conversation_id to
|
|
151
|
+
// continue the SAME order, but the MCP server is stateless (a new process per request), so its
|
|
152
|
+
// in-memory fallback is wiped on every call AND the model doesn't reliably thread the id back —
|
|
153
|
+
// so each turn started a NEW backend conversation, losing the cart/address ("let me start
|
|
154
|
+
// fresh!", re-setting the address) and re-running the whole loop (slow). We capture the id from
|
|
155
|
+
// each buy result and inject it into the next call, keeping ONE conversation per shopping session.
|
|
156
|
+
if (tools.buy) {
|
|
157
|
+
const rawBuy = tools.buy;
|
|
158
|
+
let buyConversationId;
|
|
159
|
+
const grabId = (r) => {
|
|
160
|
+
const sc = r?.structuredContent?.conversation_id;
|
|
161
|
+
if (typeof sc === 'string' && sc)
|
|
162
|
+
return sc;
|
|
163
|
+
const text = (r?.content ?? []).filter((c) => c?.type === 'text').map((c) => c.text).join('\n');
|
|
164
|
+
const m = typeof text === 'string' ? text.match(/\[conversation_id:\s*([^\s\]]+)/) : null;
|
|
165
|
+
return m ? m[1] : undefined;
|
|
166
|
+
};
|
|
167
|
+
tools.buy = {
|
|
168
|
+
...rawBuy,
|
|
169
|
+
execute: async (input, opts) => {
|
|
170
|
+
const args = { ...(input ?? {}) };
|
|
171
|
+
if (args.new_order)
|
|
172
|
+
buyConversationId = undefined;
|
|
173
|
+
else if (buyConversationId && !args.conversation_id)
|
|
174
|
+
args.conversation_id = buyConversationId;
|
|
175
|
+
const result = await rawBuy.execute(args, opts);
|
|
176
|
+
const cid = grabId(result);
|
|
177
|
+
if (cid)
|
|
178
|
+
buyConversationId = cid;
|
|
179
|
+
// Strip the internal [conversation_id: …] marker so it never leaks into the user-facing reply.
|
|
180
|
+
for (const c of result?.content ?? []) {
|
|
181
|
+
if (c?.type === 'text' && typeof c.text === 'string') {
|
|
182
|
+
c.text = c.text.replace(/\s*\[conversation_id:[^\]]*\]/g, '').trimEnd();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return result;
|
|
186
|
+
},
|
|
187
|
+
};
|
|
86
188
|
}
|
|
87
|
-
|
|
189
|
+
const anthropic = createAnthropic({
|
|
190
|
+
baseURL: `${getApiUrl()}/buy/agent/llm/v1`, // provider calls `${baseURL}/messages`
|
|
191
|
+
apiKey: 'managed-by-agentcard', // placeholder; the custom fetch below strips it and the gateway injects the real key
|
|
192
|
+
// Authenticate the gateway with the user's JWT (Bearer), and never send a client x-api-key.
|
|
193
|
+
fetch: async (input, init) => {
|
|
194
|
+
const headers = new Headers(init?.headers);
|
|
195
|
+
headers.delete('x-api-key');
|
|
196
|
+
headers.set('authorization', `Bearer ${jwt}`);
|
|
197
|
+
return fetch(input, { ...init, headers });
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
agent = new ToolLoopAgent({
|
|
201
|
+
model: anthropic(MODEL_ID),
|
|
202
|
+
tools,
|
|
203
|
+
instructions: systemPrompt,
|
|
204
|
+
stopWhen: stepCountIs(MAX_STEPS),
|
|
205
|
+
});
|
|
206
|
+
connecting.succeed(chalk.dim(`connected · ${Object.keys(tools).length} tools`));
|
|
88
207
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
// the
|
|
208
|
+
catch (err) {
|
|
209
|
+
connecting.stop();
|
|
210
|
+
console.error(chalk.red(`couldn't connect to AgentCard: ${err?.message ?? String(err)}`));
|
|
211
|
+
process.exit(1);
|
|
212
|
+
}
|
|
213
|
+
console.log(chalk.dim('tell me what to do — e.g. "order a burrito from chipotle on doordash", "show my cards", "what\'s my balance". ctrl+c to exit.\n'));
|
|
214
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout, prompt: chalk.cyan('> ') });
|
|
215
|
+
// Conversation history, fed to the agent each turn (in-memory for this session).
|
|
216
|
+
const messages = [];
|
|
217
|
+
/** Run one turn: stream the assistant's text + tool activity, then persist the new messages. */
|
|
97
218
|
async function sendTurn(text, fromInput) {
|
|
98
219
|
if (fromInput) {
|
|
220
|
+
// Rewrite the line the terminal just echoed into a formatted `you` line.
|
|
99
221
|
readline.moveCursor(process.stdout, 0, -1);
|
|
100
222
|
readline.clearLine(process.stdout, 0);
|
|
101
223
|
readline.cursorTo(process.stdout, 0);
|
|
102
224
|
}
|
|
103
|
-
|
|
104
|
-
|
|
225
|
+
printYou(text);
|
|
226
|
+
messages.push({ role: 'user', content: text });
|
|
105
227
|
const spinner = ora({ text: chalk.dim('thinking'), color: 'green', discardStdin: false }).start();
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
method: 'POST',
|
|
109
|
-
body: { body: text },
|
|
110
|
-
});
|
|
228
|
+
let spinnerOn = true;
|
|
229
|
+
const stopSpinner = () => { if (spinnerOn) {
|
|
111
230
|
spinner.stop();
|
|
112
|
-
|
|
231
|
+
spinnerOn = false;
|
|
232
|
+
} };
|
|
233
|
+
const startSpinner = () => { if (!spinnerOn) {
|
|
234
|
+
spinner.start();
|
|
235
|
+
spinnerOn = true;
|
|
236
|
+
} };
|
|
237
|
+
let printedLabel = false;
|
|
238
|
+
let midText = false;
|
|
239
|
+
try {
|
|
240
|
+
const result = await agent.stream({ messages });
|
|
241
|
+
for await (const chunk of result.fullStream) {
|
|
242
|
+
if (chunk.type === 'text-delta') {
|
|
243
|
+
stopSpinner();
|
|
244
|
+
if (!printedLabel) {
|
|
245
|
+
process.stdout.write(`${chalk.green('buy')} `);
|
|
246
|
+
printedLabel = true;
|
|
247
|
+
}
|
|
248
|
+
process.stdout.write(chunk.text);
|
|
249
|
+
midText = true;
|
|
250
|
+
}
|
|
251
|
+
else if (chunk.type === 'tool-call') {
|
|
252
|
+
// Tools run server-side; show a generic working spinner but NEVER reveal which tool —
|
|
253
|
+
// the user shouldn't see internal tool names. Close any in-progress text line first so
|
|
254
|
+
// the next assistant text starts fresh with its own label.
|
|
255
|
+
if (midText) {
|
|
256
|
+
process.stdout.write('\n');
|
|
257
|
+
midText = false;
|
|
258
|
+
printedLabel = false;
|
|
259
|
+
}
|
|
260
|
+
startSpinner();
|
|
261
|
+
}
|
|
262
|
+
else if (chunk.type === 'error') {
|
|
263
|
+
stopSpinner();
|
|
264
|
+
if (midText) {
|
|
265
|
+
process.stdout.write('\n');
|
|
266
|
+
midText = false;
|
|
267
|
+
}
|
|
268
|
+
console.error(chalk.red(` ${friendlyError(chunk.error)}`));
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
stopSpinner();
|
|
272
|
+
if (midText)
|
|
273
|
+
process.stdout.write('\n');
|
|
274
|
+
// Persist the model's generated messages (assistant text + tool calls/results) so the next
|
|
275
|
+
// turn has full context.
|
|
276
|
+
messages.push(...(await result.response).messages);
|
|
113
277
|
}
|
|
114
278
|
catch (err) {
|
|
115
|
-
|
|
116
|
-
|
|
279
|
+
stopSpinner();
|
|
280
|
+
if (midText)
|
|
281
|
+
process.stdout.write('\n');
|
|
282
|
+
console.error(chalk.red(friendlyError(err)));
|
|
117
283
|
}
|
|
118
284
|
}
|
|
119
285
|
rl.on('line', async (line) => {
|
|
@@ -125,19 +291,19 @@ export async function buyChat(resume, seed) {
|
|
|
125
291
|
await sendTurn(text, true);
|
|
126
292
|
rl.prompt();
|
|
127
293
|
});
|
|
128
|
-
// Auto-send the seeded first message (from `buy <free text>`)
|
|
129
|
-
|
|
130
|
-
if (seed && !resume) {
|
|
294
|
+
// Auto-send the seeded first message (from `buy <free text>`), then continue interactively.
|
|
295
|
+
if (seed) {
|
|
131
296
|
await sendTurn(seed, false);
|
|
132
297
|
}
|
|
133
298
|
rl.prompt();
|
|
134
299
|
function cleanup() {
|
|
300
|
+
void mcpClient.close().catch(() => { });
|
|
135
301
|
rl.close();
|
|
136
302
|
process.exit(0);
|
|
137
303
|
}
|
|
138
304
|
rl.on('close', cleanup);
|
|
139
305
|
process.on('SIGINT', () => {
|
|
140
|
-
console.log(chalk.dim(
|
|
306
|
+
console.log(chalk.dim('\n\nbye.'));
|
|
141
307
|
cleanup();
|
|
142
308
|
});
|
|
143
309
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buy-chat.js","sourceRoot":"","sources":["../../../src/commands/buy-chat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,GAAiB,MAAM,KAAK,CAAC;AACpC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE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,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACxB,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QACxB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;QACnC,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/src/lib/config.d.ts
CHANGED
|
@@ -3,11 +3,19 @@ interface Config {
|
|
|
3
3
|
email?: string;
|
|
4
4
|
jwt?: string;
|
|
5
5
|
apiUrl?: string;
|
|
6
|
+
mcpUrl?: string;
|
|
6
7
|
}
|
|
7
8
|
export declare function readConfig(): Config;
|
|
8
9
|
export declare function writeConfig(data: Partial<Config>): void;
|
|
9
10
|
export declare function getApiUrl(): string;
|
|
10
11
|
export declare function getJwt(): string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* The AgentCard MCP server URL (Streamable HTTP, `/mcp`) the `buy` chat connects to as an MCP
|
|
14
|
+
* client. Resolution order: stored config → AGENT_CARDS_MCP_URL env → derived from the API URL
|
|
15
|
+
* (api.agentcard.sh → mcp.agentcard.sh/mcp) → prod default. Local dev runs the MCP HTTP server on
|
|
16
|
+
* a separate port (`pnpm dev:mcp-http`), so set AGENT_CARDS_MCP_URL=http://localhost:3002/mcp there.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getMcpUrl(): string;
|
|
11
19
|
/** Remove stored auth (email + jwt) so user can log in as someone else. */
|
|
12
20
|
export declare function clearAuth(): void;
|
|
13
21
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/lib/config.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU,QAAkC,CAAC;AAG1D,UAAU,MAAM;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,UAAU,IAAI,MAAM,CAOnC;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAIvD;AAED,wBAAgB,SAAS,IAAI,MAAM,CAGlC;AAED,wBAAgB,MAAM,IAAI,MAAM,GAAG,SAAS,CAE3C;AAED,2EAA2E;AAC3E,wBAAgB,SAAS,IAAI,IAAI,CAQhC"}
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/lib/config.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU,QAAkC,CAAC;AAG1D,UAAU,MAAM;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,UAAU,IAAI,MAAM,CAOnC;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAIvD;AAED,wBAAgB,SAAS,IAAI,MAAM,CAGlC;AAED,wBAAgB,MAAM,IAAI,MAAM,GAAG,SAAS,CAE3C;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAkBlC;AAED,2EAA2E;AAC3E,wBAAgB,SAAS,IAAI,IAAI,CAQhC"}
|
package/dist/src/lib/config.js
CHANGED
|
@@ -25,6 +25,34 @@ export function getApiUrl() {
|
|
|
25
25
|
export function getJwt() {
|
|
26
26
|
return readConfig().jwt ?? process.env.AGENT_CARDS_JWT;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* The AgentCard MCP server URL (Streamable HTTP, `/mcp`) the `buy` chat connects to as an MCP
|
|
30
|
+
* client. Resolution order: stored config → AGENT_CARDS_MCP_URL env → derived from the API URL
|
|
31
|
+
* (api.agentcard.sh → mcp.agentcard.sh/mcp) → prod default. Local dev runs the MCP HTTP server on
|
|
32
|
+
* a separate port (`pnpm dev:mcp-http`), so set AGENT_CARDS_MCP_URL=http://localhost:3002/mcp there.
|
|
33
|
+
*/
|
|
34
|
+
export function getMcpUrl() {
|
|
35
|
+
const cfg = readConfig();
|
|
36
|
+
if (cfg.mcpUrl)
|
|
37
|
+
return cfg.mcpUrl;
|
|
38
|
+
if (process.env.AGENT_CARDS_MCP_URL)
|
|
39
|
+
return process.env.AGENT_CARDS_MCP_URL;
|
|
40
|
+
try {
|
|
41
|
+
const u = new URL(getApiUrl());
|
|
42
|
+
if (u.hostname.startsWith('api.')) {
|
|
43
|
+
u.hostname = `mcp.${u.hostname.slice(4)}`;
|
|
44
|
+
return `${u.origin}/mcp`;
|
|
45
|
+
}
|
|
46
|
+
if (u.hostname.includes('.api.')) {
|
|
47
|
+
u.hostname = u.hostname.replace('.api.', '.mcp.');
|
|
48
|
+
return `${u.origin}/mcp`;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
/* fall through to the prod default */
|
|
53
|
+
}
|
|
54
|
+
return 'https://mcp.agentcard.sh/mcp';
|
|
55
|
+
}
|
|
28
56
|
/** Remove stored auth (email + jwt) so user can log in as someone else. */
|
|
29
57
|
export function clearAuth() {
|
|
30
58
|
const cfg = readConfig();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/lib/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAE7B,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,cAAc,CAAC,CAAC;AAC1D,MAAM,W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AC,IAAI,CAAC,CAAC,6DAA6D;IACvF,SAAS,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3C,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AAC5E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-cards",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.51",
|
|
4
4
|
"description": "CLI for managing virtual debit cards for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"assets"
|
|
12
12
|
],
|
|
13
13
|
"engines": {
|
|
14
|
-
"node": ">=
|
|
14
|
+
"node": ">=22"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"dev": "tsx bin/agent-cards.ts",
|
|
@@ -19,14 +19,18 @@
|
|
|
19
19
|
"prepublishOnly": "pnpm build"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
+
"@ai-sdk/anthropic": "^4.0.1",
|
|
23
|
+
"@ai-sdk/mcp": "^2.0.3",
|
|
24
|
+
"ai": "^7.0.4",
|
|
22
25
|
"chalk": "^5.3.0",
|
|
23
26
|
"cli-table3": "^0.6.3",
|
|
24
27
|
"commander": "^12.0.0",
|
|
25
|
-
"posthog-node": "^4.0.0",
|
|
26
28
|
"figlet": "^1.10.0",
|
|
27
29
|
"inquirer": "^9.2.15",
|
|
28
30
|
"open": "^10.1.0",
|
|
29
|
-
"ora": "^8.2.0"
|
|
31
|
+
"ora": "^8.2.0",
|
|
32
|
+
"posthog-node": "^4.0.0",
|
|
33
|
+
"zod": "^4.4.3"
|
|
30
34
|
},
|
|
31
35
|
"devDependencies": {
|
|
32
36
|
"@types/figlet": "^1.7.0",
|