@t2000/engine 0.28.3 → 0.28.5

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/index.js CHANGED
@@ -2193,6 +2193,51 @@ var createInvoiceTool = buildTool({
2193
2193
  }
2194
2194
  }
2195
2195
  });
2196
+ var cancelPaymentLinkTool = buildTool({
2197
+ name: "cancel_payment_link",
2198
+ description: 'Cancel an active payment link so it can no longer be used. Use when the user says "cancel my payment link", "delete my payment link", or "remove the link [slug/label]". Ask for the slug if ambiguous \u2014 use list_payment_links first to find it.',
2199
+ inputSchema: z.object({
2200
+ slug: z.string().describe('The slug of the payment link to cancel (e.g. "LzLawhY7")')
2201
+ }),
2202
+ jsonSchema: {
2203
+ type: "object",
2204
+ properties: {
2205
+ slug: { type: "string", description: "The slug of the payment link to cancel" }
2206
+ },
2207
+ required: ["slug"]
2208
+ },
2209
+ isReadOnly: true,
2210
+ async call(input, context) {
2211
+ const apiUrl = context.env?.ALLOWANCE_API_URL;
2212
+ const internalKey = context.env?.AUDRIC_INTERNAL_KEY;
2213
+ if (!apiUrl || !context.walletAddress) {
2214
+ return { data: null, displayText: "Payment link cancellation is not available." };
2215
+ }
2216
+ try {
2217
+ const res = await fetch(`${apiUrl}/api/internal/payment-links`, {
2218
+ method: "PATCH",
2219
+ signal: context.signal,
2220
+ headers: {
2221
+ "Content-Type": "application/json",
2222
+ "x-sui-address": context.walletAddress,
2223
+ ...internalKey ? { "x-internal-key": internalKey } : {}
2224
+ },
2225
+ body: JSON.stringify({ slug: input.slug, action: "cancel" })
2226
+ });
2227
+ if (!res.ok) {
2228
+ const err = await res.json().catch(() => ({}));
2229
+ return { data: null, displayText: err.error ?? "Failed to cancel payment link." };
2230
+ }
2231
+ const result = await res.json();
2232
+ return {
2233
+ data: result,
2234
+ displayText: `Payment link ${result.slug} cancelled.`
2235
+ };
2236
+ } catch {
2237
+ return { data: null, displayText: "Failed to cancel payment link." };
2238
+ }
2239
+ }
2240
+ });
2196
2241
  var listInvoicesTool = buildTool({
2197
2242
  name: "list_invoices",
2198
2243
  description: `List the user's invoices \u2014 pending, overdue, paid, and cancelled. Use when the user asks "show my invoices", "what invoices do I have", or wants to check invoice status.`,
@@ -2530,6 +2575,7 @@ var READ_TOOLS = [
2530
2575
  defillamaSuiProtocolsTool,
2531
2576
  allowanceStatusTool,
2532
2577
  listPaymentLinksTool,
2578
+ cancelPaymentLinkTool,
2533
2579
  listInvoicesTool,
2534
2580
  createPaymentLinkTool,
2535
2581
  createInvoiceTool