@t2000/engine 0.37.1 → 0.38.0

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
@@ -206,12 +206,9 @@ var TOOL_FLAGS = {
206
206
  pay_api: { mutating: true, requiresBalance: true, costAware: true, producesArtifact: true, maxRetries: 1 },
207
207
  // Write tools — lightweight (no financial guards)
208
208
  save_contact: {},
209
- create_schedule: { mutating: true },
210
- cancel_schedule: { mutating: true },
211
- // Allowance tools API mutations disguised as reads
212
- toggle_allowance: { mutating: true },
213
- update_daily_limit: { mutating: true },
214
- update_permissions: { mutating: true },
209
+ // [SIMPLIFICATION DAY 7] Removed flag entries for deleted tools:
210
+ // create_schedule, cancel_schedule (DCA schedules retired)
211
+ // toggle_allowance, update_daily_limit, update_permissions (allowance dormant)
215
212
  // Receive tools — create/cancel mutate server state
216
213
  create_payment_link: { mutating: true },
217
214
  cancel_payment_link: { mutating: true },
@@ -2201,181 +2198,6 @@ Risks: ${riskFactors.join("; ")}`
2201
2198
  };
2202
2199
  }
2203
2200
  });
2204
- async function patchAllowance(apiUrl, walletAddress, internalKey, body, signal) {
2205
- const res = await fetch(`${apiUrl}/api/allowance/${walletAddress}`, {
2206
- method: "PATCH",
2207
- headers: {
2208
- "Content-Type": "application/json",
2209
- "x-internal-key": internalKey ?? "",
2210
- "x-sui-address": walletAddress
2211
- },
2212
- body: JSON.stringify(body),
2213
- signal
2214
- });
2215
- if (!res.ok) return null;
2216
- return res.json();
2217
- }
2218
- var allowanceStatusTool = buildTool({
2219
- name: "allowance_status",
2220
- description: "Check the agent spending allowance status: whether it is enabled, the daily USDC limit, amount spent today, remaining budget, which service categories are permitted, and when the budget resets. Use this when the user asks about their agent budget, spending limits, or autonomous transaction permissions.",
2221
- inputSchema: z.object({}),
2222
- jsonSchema: { type: "object", properties: {}, required: [] },
2223
- isReadOnly: true,
2224
- async call(_input, context) {
2225
- if (!context.env?.ALLOWANCE_API_URL || !context.walletAddress) {
2226
- return {
2227
- data: {
2228
- enabled: false,
2229
- dailyLimit: 0,
2230
- spent: 0,
2231
- remaining: 0,
2232
- permissions: [],
2233
- resetsAt: null
2234
- },
2235
- displayText: "Agent allowance is not configured."
2236
- };
2237
- }
2238
- const disabledResult = {
2239
- data: {
2240
- enabled: false,
2241
- dailyLimit: 0,
2242
- spent: 0,
2243
- remaining: 0,
2244
- permissions: [],
2245
- resetsAt: null
2246
- },
2247
- displayText: "Unable to fetch allowance status."
2248
- };
2249
- let allowance;
2250
- try {
2251
- const url = `${context.env.ALLOWANCE_API_URL}/api/allowance/${context.walletAddress}`;
2252
- const res = await fetch(url, {
2253
- signal: context.signal,
2254
- headers: context.env.AUDRIC_INTERNAL_KEY ? { "x-internal-key": context.env.AUDRIC_INTERNAL_KEY } : void 0
2255
- });
2256
- if (!res.ok) return disabledResult;
2257
- allowance = await res.json();
2258
- } catch {
2259
- return disabledResult;
2260
- }
2261
- const statusText = allowance.enabled ? `Allowance active: $${allowance.spent.toFixed(2)} / $${allowance.dailyLimit.toFixed(2)} used today. ${allowance.permissions.length} service categories enabled.` : "Agent allowance is disabled.";
2262
- return {
2263
- data: allowance,
2264
- displayText: statusText
2265
- };
2266
- }
2267
- });
2268
- var toggleAllowanceTool = buildTool({
2269
- name: "toggle_allowance",
2270
- description: 'Pause or resume the agent spending allowance. Use when the user says "pause my agent", "disable autonomous spending", "resume my agent", or similar. ALWAYS confirm with the user before calling \u2014 e.g. "Pause agent spending? Your daily limit will be suspended." Only call after explicit confirmation.',
2271
- inputSchema: z.object({
2272
- enabled: z.boolean().describe("true to enable agent spending, false to pause it")
2273
- }),
2274
- jsonSchema: {
2275
- type: "object",
2276
- properties: {
2277
- enabled: { type: "boolean", description: "true to enable, false to pause" }
2278
- },
2279
- required: ["enabled"]
2280
- },
2281
- isReadOnly: true,
2282
- async call(input, context) {
2283
- const apiUrl = context.env?.ALLOWANCE_API_URL;
2284
- const internalKey = context.env?.AUDRIC_INTERNAL_KEY;
2285
- if (!apiUrl || !context.walletAddress) {
2286
- return { data: null, displayText: "Allowance management is not available." };
2287
- }
2288
- try {
2289
- const result = await patchAllowance(apiUrl, context.walletAddress, internalKey, {
2290
- action: "toggle",
2291
- enabled: input.enabled
2292
- }, context.signal);
2293
- if (!result) return { data: null, displayText: "Failed to update allowance." };
2294
- const action = input.enabled ? "enabled" : "paused";
2295
- return {
2296
- data: result,
2297
- displayText: `Agent spending ${action}.`
2298
- };
2299
- } catch {
2300
- return { data: null, displayText: "Failed to update allowance." };
2301
- }
2302
- }
2303
- });
2304
- var updateDailyLimitTool = buildTool({
2305
- name: "update_daily_limit",
2306
- description: `Update the agent's daily spending limit in USDC. Use when the user says "set my daily limit to $X", "change my spending cap", or similar. ALWAYS confirm with the user before calling \u2014 show the current limit and the new limit. Only call after explicit confirmation.`,
2307
- inputSchema: z.object({
2308
- dailyLimitUsdc: z.number().min(0).max(1e4).describe("New daily limit in USDC (0\u201310000)")
2309
- }),
2310
- jsonSchema: {
2311
- type: "object",
2312
- properties: {
2313
- dailyLimitUsdc: { type: "number", description: "New daily spending limit in USDC (0\u201310000)" }
2314
- },
2315
- required: ["dailyLimitUsdc"]
2316
- },
2317
- isReadOnly: true,
2318
- async call(input, context) {
2319
- const apiUrl = context.env?.ALLOWANCE_API_URL;
2320
- const internalKey = context.env?.AUDRIC_INTERNAL_KEY;
2321
- if (!apiUrl || !context.walletAddress) {
2322
- return { data: null, displayText: "Allowance management is not available." };
2323
- }
2324
- try {
2325
- const result = await patchAllowance(apiUrl, context.walletAddress, internalKey, {
2326
- action: "setLimit",
2327
- dailyLimitUsdc: input.dailyLimitUsdc
2328
- }, context.signal);
2329
- if (!result) return { data: null, displayText: "Failed to update daily limit." };
2330
- return {
2331
- data: result,
2332
- displayText: `Daily limit updated to $${input.dailyLimitUsdc.toFixed(2)} USDC.`
2333
- };
2334
- } catch {
2335
- return { data: null, displayText: "Failed to update daily limit." };
2336
- }
2337
- }
2338
- });
2339
- var updatePermissionsTool = buildTool({
2340
- name: "update_permissions",
2341
- description: 'Update which service categories the agent is allowed to act on autonomously. Valid permissions: savings, send, pay, credit, swap, stake. Use when the user says "disable sends", "only allow savings", "enable all services", or similar. ALWAYS show the current permissions and the new permissions before calling. Only call after explicit confirmation.',
2342
- inputSchema: z.object({
2343
- permissions: z.array(z.enum(["savings", "send", "pay", "credit", "swap", "stake"])).describe("Full list of enabled permission categories")
2344
- }),
2345
- jsonSchema: {
2346
- type: "object",
2347
- properties: {
2348
- permissions: {
2349
- type: "array",
2350
- items: { type: "string", enum: ["savings", "send", "pay", "credit", "swap", "stake"] },
2351
- description: "Full list of enabled permission categories"
2352
- }
2353
- },
2354
- required: ["permissions"]
2355
- },
2356
- isReadOnly: true,
2357
- async call(input, context) {
2358
- const apiUrl = context.env?.ALLOWANCE_API_URL;
2359
- const internalKey = context.env?.AUDRIC_INTERNAL_KEY;
2360
- if (!apiUrl || !context.walletAddress) {
2361
- return { data: null, displayText: "Allowance management is not available." };
2362
- }
2363
- try {
2364
- const result = await patchAllowance(apiUrl, context.walletAddress, internalKey, {
2365
- action: "setPermissions",
2366
- permissions: input.permissions
2367
- }, context.signal);
2368
- if (!result) return { data: null, displayText: "Failed to update permissions." };
2369
- const list = input.permissions.length > 0 ? input.permissions.join(", ") : "none";
2370
- return {
2371
- data: result,
2372
- displayText: `Permissions updated: ${list}.`
2373
- };
2374
- } catch {
2375
- return { data: null, displayText: "Failed to update permissions." };
2376
- }
2377
- }
2378
- });
2379
2201
  var PaymentLinkSchema = z.object({
2380
2202
  amount: z.number().positive().describe("Amount in USDC (required). Ask the user if not specified."),
2381
2203
  label: z.string().optional().describe('Human-readable label e.g. "Consulting fee March"'),
@@ -2994,338 +2816,6 @@ var activitySummaryTool = buildTool({
2994
2816
  }
2995
2817
  }
2996
2818
  });
2997
- function getApiConfig(context) {
2998
- const apiUrl = context.env?.ALLOWANCE_API_URL;
2999
- const internalKey = context.env?.AUDRIC_INTERNAL_KEY;
3000
- const address = context.walletAddress;
3001
- return { apiUrl, internalKey, address };
3002
- }
3003
- function parseCronFromDescription(input) {
3004
- const lower = input.toLowerCase().trim();
3005
- if (/^\d+\s/.test(lower) || lower.startsWith("*")) return lower;
3006
- if (/every\s*day|daily/.test(lower)) {
3007
- const hourMatch = lower.match(/at\s*(\d{1,2})\s*(am|pm)?/i);
3008
- let hour = 9;
3009
- if (hourMatch) {
3010
- hour = parseInt(hourMatch[1], 10);
3011
- if (hourMatch[2]?.toLowerCase() === "pm" && hour < 12) hour += 12;
3012
- if (hourMatch[2]?.toLowerCase() === "am" && hour === 12) hour = 0;
3013
- }
3014
- return `0 ${hour} * * *`;
3015
- }
3016
- const dayMap = {
3017
- sunday: 0,
3018
- monday: 1,
3019
- tuesday: 2,
3020
- wednesday: 3,
3021
- thursday: 4,
3022
- friday: 5,
3023
- saturday: 6,
3024
- sun: 0,
3025
- mon: 1,
3026
- tue: 2,
3027
- wed: 3,
3028
- thu: 4,
3029
- fri: 5,
3030
- sat: 6
3031
- };
3032
- for (const [name, num] of Object.entries(dayMap)) {
3033
- if (lower.includes(name)) {
3034
- const hourMatch = lower.match(/at\s*(\d{1,2})\s*(am|pm)?/i);
3035
- let hour = 9;
3036
- if (hourMatch) {
3037
- hour = parseInt(hourMatch[1], 10);
3038
- if (hourMatch[2]?.toLowerCase() === "pm" && hour < 12) hour += 12;
3039
- if (hourMatch[2]?.toLowerCase() === "am" && hour === 12) hour = 0;
3040
- }
3041
- return `0 ${hour} * * ${num}`;
3042
- }
3043
- }
3044
- if (/weekly/.test(lower)) return "0 9 * * 1";
3045
- if (/monthly/.test(lower)) return "0 9 1 * *";
3046
- if (/biweekly|bi-weekly|every\s*two\s*weeks/.test(lower)) return "0 9 1,15 * *";
3047
- throw new Error(`Could not parse schedule: "${input}". Try "every friday at 9am", "daily", "weekly", or a cron expression like "0 9 * * 5".`);
3048
- }
3049
- var createScheduleTool = buildTool({
3050
- name: "create_schedule",
3051
- description: 'Create a recurring scheduled action (DCA). Supports: save, swap, repay. User says "save $50 every Friday" or "DCA $100 into savings weekly". First 5 executions require user confirmation (trust ladder), then becomes autonomous.',
3052
- inputSchema: z.object({
3053
- actionType: z.enum(["save", "swap", "repay"]).describe("Action type: save, swap, or repay"),
3054
- amount: z.number().positive().describe("Amount in USD for each execution"),
3055
- schedule: z.string().describe('Schedule description: "every friday", "daily at 9am", "weekly", or a cron expression'),
3056
- asset: z.string().optional().describe("Source asset (default: USDC)"),
3057
- targetAsset: z.string().optional().describe("Target asset for swaps (e.g. SUI)")
3058
- }),
3059
- jsonSchema: {
3060
- type: "object",
3061
- properties: {
3062
- actionType: { type: "string", enum: ["save", "swap", "repay"], description: "Action type" },
3063
- amount: { type: "number", description: "Amount in USD per execution" },
3064
- schedule: { type: "string", description: 'Schedule: "every friday", "daily at 9am", "weekly", or cron' },
3065
- asset: { type: "string", description: "Source asset (default: USDC)" },
3066
- targetAsset: { type: "string", description: "Target asset for swaps" }
3067
- },
3068
- required: ["actionType", "amount", "schedule"]
3069
- },
3070
- isReadOnly: true,
3071
- async call(input, context) {
3072
- const { apiUrl, internalKey, address } = getApiConfig(context);
3073
- if (!apiUrl || !address) {
3074
- return { data: null, displayText: "Scheduled actions are not available \u2014 missing wallet or API configuration." };
3075
- }
3076
- let cronExpr;
3077
- try {
3078
- cronExpr = parseCronFromDescription(input.schedule);
3079
- } catch (err) {
3080
- return { data: null, displayText: err instanceof Error ? err.message : "Invalid schedule format." };
3081
- }
3082
- try {
3083
- const res = await fetch(`${apiUrl}/api/scheduled-actions`, {
3084
- method: "POST",
3085
- headers: {
3086
- "Content-Type": "application/json",
3087
- ...internalKey ? { "x-internal-key": internalKey } : {}
3088
- },
3089
- body: JSON.stringify({
3090
- address,
3091
- actionType: input.actionType,
3092
- amount: input.amount,
3093
- asset: input.asset ?? "USDC",
3094
- targetAsset: input.targetAsset,
3095
- cronExpr
3096
- })
3097
- });
3098
- if (!res.ok) {
3099
- const err = await res.json().catch(() => ({}));
3100
- return { data: null, displayText: `Failed to create schedule: ${err.error ?? res.statusText}` };
3101
- }
3102
- const { action } = await res.json();
3103
- const nextRun = new Date(action.nextRunAt);
3104
- const nextRunLabel = nextRun.toLocaleDateString("en-US", { weekday: "short", month: "short", day: "numeric" });
3105
- const verb = input.actionType === "save" ? "save" : input.actionType === "swap" ? "swap" : "repay";
3106
- return {
3107
- data: { id: action.id, actionType: input.actionType, amount: input.amount, cronExpr, nextRun: action.nextRunAt },
3108
- displayText: `Scheduled: ${verb} $${input.amount.toFixed(2)} ${input.asset ?? "USDC"} ${input.schedule}. Next run: ${nextRunLabel}. First 5 executions require your confirmation.`
3109
- };
3110
- } catch (err) {
3111
- return { data: null, displayText: `Schedule creation failed: ${err instanceof Error ? err.message : "unknown error"}` };
3112
- }
3113
- }
3114
- });
3115
- var listSchedulesTool = buildTool({
3116
- name: "list_schedules",
3117
- description: "List all scheduled/recurring actions (DCA, auto-save, auto-repay) for the user.",
3118
- inputSchema: z.object({}),
3119
- jsonSchema: { type: "object", properties: {}, required: [] },
3120
- isReadOnly: true,
3121
- permissionLevel: "auto",
3122
- async call(_input, context) {
3123
- const { apiUrl, internalKey, address } = getApiConfig(context);
3124
- if (!apiUrl || !address) {
3125
- return { data: null, displayText: "Scheduled actions are not available." };
3126
- }
3127
- try {
3128
- const res = await fetch(`${apiUrl}/api/scheduled-actions?address=${address}`, {
3129
- headers: {
3130
- ...internalKey ? { "x-internal-key": internalKey } : {}
3131
- }
3132
- });
3133
- if (!res.ok) {
3134
- return { data: null, displayText: "Failed to fetch schedules." };
3135
- }
3136
- const { actions } = await res.json();
3137
- if (actions.length === 0) {
3138
- return { data: { actions: [] }, displayText: "No scheduled actions found." };
3139
- }
3140
- const lines = actions.map((a) => {
3141
- const status = !a.enabled ? "paused" : a.confirmationsCompleted >= a.confirmationsRequired ? "autonomous" : `${a.confirmationsCompleted}/${a.confirmationsRequired} confirmed`;
3142
- const next = new Date(a.nextRunAt).toLocaleDateString("en-US", { weekday: "short", month: "short", day: "numeric" });
3143
- return `\u2022 ${a.actionType} $${a.amount.toFixed(2)} ${a.asset} \u2014 ${status} \u2014 next: ${next} \u2014 total: $${a.totalAmountUsdc.toFixed(2)} over ${a.totalExecutions} runs`;
3144
- });
3145
- return {
3146
- data: { actions },
3147
- displayText: `Found ${actions.length} scheduled action(s):
3148
- ${lines.join("\n")}`
3149
- };
3150
- } catch (err) {
3151
- return { data: null, displayText: `Failed to list schedules: ${err instanceof Error ? err.message : "unknown error"}` };
3152
- }
3153
- }
3154
- });
3155
- var cancelScheduleTool = buildTool({
3156
- name: "cancel_schedule",
3157
- description: "Cancel or pause a scheduled action. Provide the schedule ID or describe which one to cancel.",
3158
- inputSchema: z.object({
3159
- scheduleId: z.string().describe("The ID of the scheduled action to cancel/pause"),
3160
- action: z.enum(["delete", "pause", "resume"]).optional().describe("delete (default), pause, or resume")
3161
- }),
3162
- jsonSchema: {
3163
- type: "object",
3164
- properties: {
3165
- scheduleId: { type: "string", description: "Schedule ID" },
3166
- action: { type: "string", enum: ["delete", "pause", "resume"], description: "delete, pause, or resume" }
3167
- },
3168
- required: ["scheduleId"]
3169
- },
3170
- isReadOnly: true,
3171
- async call(input, context) {
3172
- const { apiUrl, internalKey, address } = getApiConfig(context);
3173
- if (!apiUrl || !address) {
3174
- return { data: null, displayText: "Scheduled actions are not available." };
3175
- }
3176
- const actionType = input.action ?? "delete";
3177
- try {
3178
- const res = await fetch(`${apiUrl}/api/scheduled-actions/${input.scheduleId}`, {
3179
- method: "PATCH",
3180
- headers: {
3181
- "Content-Type": "application/json",
3182
- ...internalKey ? { "x-internal-key": internalKey } : {}
3183
- },
3184
- body: JSON.stringify({
3185
- address,
3186
- action: actionType,
3187
- ...actionType === "pause" ? { enabled: false } : {},
3188
- ...actionType === "resume" ? { enabled: true } : {}
3189
- })
3190
- });
3191
- if (!res.ok) {
3192
- const err = await res.json().catch(() => ({}));
3193
- return { data: null, displayText: `Failed to ${actionType} schedule: ${err.error ?? res.statusText}` };
3194
- }
3195
- const label = actionType === "delete" ? "Cancelled" : actionType === "pause" ? "Paused" : "Resumed";
3196
- return {
3197
- data: { id: input.scheduleId, action: actionType },
3198
- displayText: `${label} scheduled action ${input.scheduleId.slice(0, 8)}\u2026`
3199
- };
3200
- } catch (err) {
3201
- return { data: null, displayText: `Failed: ${err instanceof Error ? err.message : "unknown error"}` };
3202
- }
3203
- }
3204
- });
3205
- var STAGE_LABELS = {
3206
- 0: "Detected",
3207
- 1: "Proposed",
3208
- 2: "Confirmed (notifies)",
3209
- 3: "Fully autonomous"
3210
- };
3211
- var PATTERN_LABELS = {
3212
- recurring_save: "Recurring Save",
3213
- yield_reinvestment: "Yield Reinvestment",
3214
- debt_discipline: "Debt Discipline",
3215
- idle_usdc_tolerance: "Idle USDC Sweep",
3216
- swap_pattern: "Regular Swap"
3217
- };
3218
- function getApiConfig2(context) {
3219
- const apiUrl = context.env?.ALLOWANCE_API_URL;
3220
- const internalKey = context.env?.AUDRIC_INTERNAL_KEY;
3221
- const address = context.walletAddress;
3222
- return { apiUrl, internalKey, address };
3223
- }
3224
- var patternStatusTool = buildTool({
3225
- name: "pattern_status",
3226
- description: "Show all detected behavioral patterns and autonomous automations for this user. Includes pattern type, trust stage, execution count, and next scheduled run.",
3227
- inputSchema: z.object({}),
3228
- jsonSchema: { type: "object", properties: {}, required: [] },
3229
- isReadOnly: true,
3230
- permissionLevel: "auto",
3231
- async call(_input, context) {
3232
- const { apiUrl, internalKey, address } = getApiConfig2(context);
3233
- if (!apiUrl || !address) {
3234
- return { data: null, displayText: "Pattern status is not available." };
3235
- }
3236
- try {
3237
- const res = await fetch(`${apiUrl}/api/scheduled-actions?address=${address}`, {
3238
- headers: {
3239
- ...internalKey ? { "x-internal-key": internalKey } : {}
3240
- }
3241
- });
3242
- if (!res.ok) {
3243
- return { data: null, displayText: "Failed to fetch pattern status." };
3244
- }
3245
- const { actions } = await res.json();
3246
- const patterns = actions.filter((a) => a.source === "behavior_detected");
3247
- const userCreated = actions.filter((a) => a.source !== "behavior_detected");
3248
- if (patterns.length === 0 && userCreated.length === 0) {
3249
- return {
3250
- data: { patterns: [], userCreated: [] },
3251
- displayText: "No automations or detected patterns yet. As you use Audric, I'll learn your financial patterns and suggest automations."
3252
- };
3253
- }
3254
- const lines = [];
3255
- if (patterns.length > 0) {
3256
- lines.push("**Detected Patterns:**");
3257
- for (const p of patterns) {
3258
- const label = PATTERN_LABELS[p.patternType ?? ""] ?? p.patternType ?? "Unknown";
3259
- const stage = STAGE_LABELS[p.stage] ?? `Stage ${p.stage}`;
3260
- const status = p.pausedAt ? "Paused" : !p.enabled ? "Disabled" : stage;
3261
- const next = p.enabled && !p.pausedAt ? new Date(p.nextRunAt).toLocaleDateString("en-US", { weekday: "short", month: "short", day: "numeric" }) : "\u2014";
3262
- lines.push(`\u2022 ${label}: auto-${p.actionType} $${p.amount} ${p.asset} \u2014 ${status} \u2014 ${p.totalExecutions} runs \u2014 next: ${next}`);
3263
- }
3264
- }
3265
- if (userCreated.length > 0) {
3266
- lines.push("");
3267
- lines.push("**User-Created Schedules:**");
3268
- for (const a of userCreated) {
3269
- const status = !a.enabled ? "paused" : a.confirmationsCompleted >= a.confirmationsRequired ? "autonomous" : `${a.confirmationsCompleted}/${a.confirmationsRequired} confirmed`;
3270
- const next = new Date(a.nextRunAt).toLocaleDateString("en-US", { weekday: "short", month: "short", day: "numeric" });
3271
- lines.push(`\u2022 ${a.actionType} $${a.amount} ${a.asset} \u2014 ${status} \u2014 next: ${next}`);
3272
- }
3273
- }
3274
- return {
3275
- data: { patterns, userCreated },
3276
- displayText: lines.join("\n")
3277
- };
3278
- } catch (err) {
3279
- return { data: null, displayText: `Failed: ${err instanceof Error ? err.message : "unknown error"}` };
3280
- }
3281
- }
3282
- });
3283
- var pausePatternTool = buildTool({
3284
- name: "pause_pattern",
3285
- description: "Pause, resume, or permanently disable a behavioral pattern automation. Requires user confirmation.",
3286
- inputSchema: z.object({
3287
- patternId: z.string().describe("ID of the pattern/scheduled action to modify"),
3288
- action: z.enum(["pause", "resume", "disable"]).describe("pause, resume, or disable")
3289
- }),
3290
- jsonSchema: {
3291
- type: "object",
3292
- properties: {
3293
- patternId: { type: "string", description: "Pattern ID" },
3294
- action: { type: "string", enum: ["pause", "resume", "disable"], description: "pause, resume, or disable" }
3295
- },
3296
- required: ["patternId", "action"]
3297
- },
3298
- isReadOnly: false,
3299
- permissionLevel: "confirm",
3300
- async call(input, context) {
3301
- const { apiUrl, internalKey, address } = getApiConfig2(context);
3302
- if (!apiUrl || !address) {
3303
- return { data: null, displayText: "Pattern management is not available." };
3304
- }
3305
- const patchAction = input.action === "pause" ? "pause_pattern" : input.action === "resume" ? "resume_pattern" : "delete";
3306
- try {
3307
- const res = await fetch(`${apiUrl}/api/scheduled-actions/${input.patternId}`, {
3308
- method: "PATCH",
3309
- headers: {
3310
- "Content-Type": "application/json",
3311
- ...internalKey ? { "x-internal-key": internalKey } : {}
3312
- },
3313
- body: JSON.stringify({ address, action: patchAction })
3314
- });
3315
- if (!res.ok) {
3316
- const err = await res.json().catch(() => ({}));
3317
- return { data: null, displayText: `Failed to ${input.action}: ${err.error ?? res.statusText}` };
3318
- }
3319
- const label = input.action === "pause" ? "Paused" : input.action === "resume" ? "Resumed" : "Disabled";
3320
- return {
3321
- data: { id: input.patternId, action: input.action },
3322
- displayText: `${label} pattern ${input.patternId.slice(0, 8)}\u2026`
3323
- };
3324
- } catch (err) {
3325
- return { data: null, displayText: `Failed: ${err instanceof Error ? err.message : "unknown error"}` };
3326
- }
3327
- }
3328
- });
3329
2819
  var LLAMA_API2 = "https://api.llama.fi";
3330
2820
  var YIELDS_API2 = "https://yields.llama.fi";
3331
2821
  var COINS_API = "https://coins.llama.fi";
@@ -3632,10 +3122,6 @@ var READ_TOOLS = [
3632
3122
  defillamaChainTvlTool,
3633
3123
  defillamaProtocolFeesTool,
3634
3124
  defillamaSuiProtocolsTool,
3635
- allowanceStatusTool,
3636
- toggleAllowanceTool,
3637
- updateDailyLimitTool,
3638
- updatePermissionsTool,
3639
3125
  listPaymentLinksTool,
3640
3126
  cancelPaymentLinkTool,
3641
3127
  listInvoicesTool,
@@ -3644,11 +3130,7 @@ var READ_TOOLS = [
3644
3130
  createInvoiceTool,
3645
3131
  spendingAnalyticsTool,
3646
3132
  yieldSummaryTool,
3647
- activitySummaryTool,
3648
- listSchedulesTool,
3649
- createScheduleTool,
3650
- cancelScheduleTool,
3651
- patternStatusTool
3133
+ activitySummaryTool
3652
3134
  ];
3653
3135
  var WRITE_TOOLS = [
3654
3136
  saveDepositTool,
@@ -3661,8 +3143,7 @@ var WRITE_TOOLS = [
3661
3143
  swapExecuteTool,
3662
3144
  voloStakeTool,
3663
3145
  voloUnstakeTool,
3664
- saveContactTool,
3665
- pausePatternTool
3146
+ saveContactTool
3666
3147
  ];
3667
3148
  function getDefaultTools() {
3668
3149
  return applyToolFlags([...READ_TOOLS, ...WRITE_TOOLS]);
@@ -6189,6 +5670,6 @@ function sanitizeAnthropicMessages(messages) {
6189
5670
  return merged;
6190
5671
  }
6191
5672
 
6192
- export { AnthropicProvider, BalanceTracker, CANVAS_TEMPLATES, ContextBudget, CostTracker, DEFAULT_GUARD_CONFIG, DEFAULT_PERMISSION_CONFIG, DEFAULT_SYSTEM_PROMPT, EarlyToolDispatcher, McpClientManager, McpResponseCache, MemorySessionStore, NAVI_MCP_CONFIG, NAVI_MCP_URL, NAVI_SERVER_NAME, NaviTools, PERMISSION_PRESETS, QueryEngine, READ_TOOLS, RecipeRegistry, RetryTracker, TOOL_FLAGS, TxMutex, WRITE_TOOLS, activitySummaryTool, adaptAllMcpTools, adaptAllServerTools, adaptMcpTool, applyToolFlags, balanceCheckTool, borrowTool, budgetToolResult, buildCachedSystemPrompt, buildMcpTools, buildProactivenessInstructions, buildProfileContext, buildSelfEvaluationInstruction, buildStateContext, buildTool, claimRewardsTool, classifyEffort, clearPriceCache, compactMessages, createGuardRunnerState, defillamaChainTvlTool, defillamaPriceChangeTool, defillamaProtocolFeesTool, defillamaProtocolInfoTool, defillamaSuiProtocolsTool, defillamaTokenPricesTool, defillamaYieldPoolsTool, engineToSSE, estimateTokens, explainTxTool, extractConversationText, extractMcpText, fetchAvailableRewards, fetchBalance, fetchHealthFactor, fetchPositions, fetchProtocolStats, fetchRates, fetchSavings, fetchTokenPrices, fetchWalletCoins, findTool, getDefaultTools, getMcpManager, getToolFlags, getWalletAddress, guardArtifactPreview, guardStaleData, hasNaviMcp, healthCheckTool, loadRecipes, microcompact, mppServicesTool, parseMcpJson, parseRecipe, parseSSE, patternStatusTool, pausePatternTool, payApiTool, portfolioAnalysisTool, protocolDeepDiveTool, ratesInfoTool, registerEngineTools, renderCanvasTool, repayDebtTool, requireAgent, resolvePermissionTier, resolveUsdValue, runGuards, runTools, saveContactTool, saveDepositTool, savingsInfoTool, sendTransferTool, serializeSSE, spendingAnalyticsTool, swapExecuteTool, swapQuoteTool, toolNameToOperation, toolsToDefinitions, transactionHistoryTool, transformBalance, transformHealthFactor, transformPositions, transformRates, transformRewards, transformSavings, updateGuardStateAfterToolResult, validateHistory, voloStakeTool, voloStatsTool, voloUnstakeTool, webSearchTool, withdrawTool, yieldSummaryTool };
5673
+ export { AnthropicProvider, BalanceTracker, CANVAS_TEMPLATES, ContextBudget, CostTracker, DEFAULT_GUARD_CONFIG, DEFAULT_PERMISSION_CONFIG, DEFAULT_SYSTEM_PROMPT, EarlyToolDispatcher, McpClientManager, McpResponseCache, MemorySessionStore, NAVI_MCP_CONFIG, NAVI_MCP_URL, NAVI_SERVER_NAME, NaviTools, PERMISSION_PRESETS, QueryEngine, READ_TOOLS, RecipeRegistry, RetryTracker, TOOL_FLAGS, TxMutex, WRITE_TOOLS, activitySummaryTool, adaptAllMcpTools, adaptAllServerTools, adaptMcpTool, applyToolFlags, balanceCheckTool, borrowTool, budgetToolResult, buildCachedSystemPrompt, buildMcpTools, buildProactivenessInstructions, buildProfileContext, buildSelfEvaluationInstruction, buildStateContext, buildTool, claimRewardsTool, classifyEffort, clearPriceCache, compactMessages, createGuardRunnerState, defillamaChainTvlTool, defillamaPriceChangeTool, defillamaProtocolFeesTool, defillamaProtocolInfoTool, defillamaSuiProtocolsTool, defillamaTokenPricesTool, defillamaYieldPoolsTool, engineToSSE, estimateTokens, explainTxTool, extractConversationText, extractMcpText, fetchAvailableRewards, fetchBalance, fetchHealthFactor, fetchPositions, fetchProtocolStats, fetchRates, fetchSavings, fetchTokenPrices, fetchWalletCoins, findTool, getDefaultTools, getMcpManager, getToolFlags, getWalletAddress, guardArtifactPreview, guardStaleData, hasNaviMcp, healthCheckTool, loadRecipes, microcompact, mppServicesTool, parseMcpJson, parseRecipe, parseSSE, payApiTool, portfolioAnalysisTool, protocolDeepDiveTool, ratesInfoTool, registerEngineTools, renderCanvasTool, repayDebtTool, requireAgent, resolvePermissionTier, resolveUsdValue, runGuards, runTools, saveContactTool, saveDepositTool, savingsInfoTool, sendTransferTool, serializeSSE, spendingAnalyticsTool, swapExecuteTool, swapQuoteTool, toolNameToOperation, toolsToDefinitions, transactionHistoryTool, transformBalance, transformHealthFactor, transformPositions, transformRates, transformRewards, transformSavings, updateGuardStateAfterToolResult, validateHistory, voloStakeTool, voloStatsTool, voloUnstakeTool, webSearchTool, withdrawTool, yieldSummaryTool };
6193
5674
  //# sourceMappingURL=index.js.map
6194
5675
  //# sourceMappingURL=index.js.map