@madh-io/alfred-ai 0.3.4 → 0.3.7
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/bundle/index.js +33 -19
- package/package.json +1 -1
package/bundle/index.js
CHANGED
|
@@ -1667,18 +1667,25 @@ var init_prompt_builder = __esm({
|
|
|
1667
1667
|
const homeDir = process.env["HOME"] || process.env["USERPROFILE"] || "~";
|
|
1668
1668
|
let prompt = `You are Alfred, a personal AI assistant. You run on ${os} (home: ${homeDir}).
|
|
1669
1669
|
|
|
1670
|
-
##
|
|
1671
|
-
-
|
|
1672
|
-
-
|
|
1673
|
-
-
|
|
1674
|
-
- If
|
|
1675
|
-
- If the user asks for the date/time: use system_info with category "datetime".
|
|
1676
|
-
- If the user asks you to remember something: use the memory tool immediately.
|
|
1677
|
-
- If a tool fails or is denied, explain why and suggest alternatives.
|
|
1678
|
-
- Be concise but thorough. Respond in the same language the user writes in.
|
|
1670
|
+
## Core principles
|
|
1671
|
+
- ACT, don't just talk. When the user asks you to do something, USE YOUR TOOLS immediately. Never say "I could do X" \u2014 just do X.
|
|
1672
|
+
- Respond in the same language the user writes in.
|
|
1673
|
+
- Be concise. No filler text, no unnecessary explanations.
|
|
1674
|
+
- If a tool fails or is denied, explain why and try an alternative approach.
|
|
1679
1675
|
|
|
1680
|
-
##
|
|
1681
|
-
|
|
1676
|
+
## Multi-step reasoning
|
|
1677
|
+
For complex tasks, work through multiple steps:
|
|
1678
|
+
1. **Understand** what the user wants.
|
|
1679
|
+
2. **Execute** using the right tools \u2014 chain multiple tool calls if needed.
|
|
1680
|
+
3. **Continue** after each tool result. If the task isn't done, use the next tool. Don't stop after one call.
|
|
1681
|
+
4. **Summarize** the final result clearly.
|
|
1682
|
+
|
|
1683
|
+
## Environment
|
|
1684
|
+
- OS: ${os}
|
|
1685
|
+
- Home: ${homeDir}
|
|
1686
|
+
- Documents: ${homeDir}/Documents
|
|
1687
|
+
- Desktop: ${homeDir}/Desktop
|
|
1688
|
+
- Downloads: ${homeDir}/Downloads`;
|
|
1682
1689
|
if (skills && skills.length > 0) {
|
|
1683
1690
|
prompt += "\n\n## Available tools\n";
|
|
1684
1691
|
for (const s of skills) {
|
|
@@ -2184,7 +2191,7 @@ var init_calculator = __esm({
|
|
|
2184
2191
|
CalculatorSkill = class extends Skill {
|
|
2185
2192
|
metadata = {
|
|
2186
2193
|
name: "calculator",
|
|
2187
|
-
description: "Evaluate mathematical expressions
|
|
2194
|
+
description: "Evaluate mathematical expressions. Use for any calculation, unit conversion, or math question the user asks.",
|
|
2188
2195
|
riskLevel: "read",
|
|
2189
2196
|
version: "1.0.0",
|
|
2190
2197
|
inputSchema: {
|
|
@@ -2253,7 +2260,7 @@ var init_system_info = __esm({
|
|
|
2253
2260
|
SystemInfoSkill = class extends Skill {
|
|
2254
2261
|
metadata = {
|
|
2255
2262
|
name: "system_info",
|
|
2256
|
-
description:
|
|
2263
|
+
description: 'Get system information: current date/time (datetime), system stats (general), memory usage (memory), or uptime (uptime). Use "datetime" when the user asks what day/time it is.',
|
|
2257
2264
|
riskLevel: "read",
|
|
2258
2265
|
version: "1.0.0",
|
|
2259
2266
|
inputSchema: {
|
|
@@ -2357,7 +2364,7 @@ var init_web_search = __esm({
|
|
|
2357
2364
|
config;
|
|
2358
2365
|
metadata = {
|
|
2359
2366
|
name: "web_search",
|
|
2360
|
-
description: "Search the
|
|
2367
|
+
description: "Search the internet for current information, news, facts, or anything the user asks about that you don't know. Use this whenever you need up-to-date information.",
|
|
2361
2368
|
riskLevel: "read",
|
|
2362
2369
|
version: "1.1.0",
|
|
2363
2370
|
inputSchema: {
|
|
@@ -2575,7 +2582,7 @@ var init_reminder = __esm({
|
|
|
2575
2582
|
reminderRepo;
|
|
2576
2583
|
metadata = {
|
|
2577
2584
|
name: "reminder",
|
|
2578
|
-
description: "
|
|
2585
|
+
description: 'Set timed reminders that notify the user later. Use when the user says "remind me", "erinnere mich", or asks to be notified about something at a specific time.',
|
|
2579
2586
|
riskLevel: "write",
|
|
2580
2587
|
version: "2.0.0",
|
|
2581
2588
|
inputSchema: {
|
|
@@ -2694,7 +2701,7 @@ var init_note = __esm({
|
|
|
2694
2701
|
NoteSkill = class extends Skill {
|
|
2695
2702
|
metadata = {
|
|
2696
2703
|
name: "note",
|
|
2697
|
-
description: "Save, list, search, or delete notes",
|
|
2704
|
+
description: "Save, list, search, or delete persistent notes. Use when the user wants to write down or retrieve text notes, lists, or ideas.",
|
|
2698
2705
|
riskLevel: "write",
|
|
2699
2706
|
version: "1.0.0",
|
|
2700
2707
|
inputSchema: {
|
|
@@ -3182,7 +3189,7 @@ var init_shell = __esm({
|
|
|
3182
3189
|
ShellSkill = class extends Skill {
|
|
3183
3190
|
metadata = {
|
|
3184
3191
|
name: "shell",
|
|
3185
|
-
description: "Execute shell commands on the host system
|
|
3192
|
+
description: "Execute shell commands on the host system. Use this for ANY task involving files, folders, system operations, or running programs: ls, cat, find, file, du, mkdir, cp, mv, grep, etc. When the user asks about their documents, files, or anything on disk \u2014 use this tool.",
|
|
3186
3193
|
riskLevel: "admin",
|
|
3187
3194
|
version: "1.0.0",
|
|
3188
3195
|
inputSchema: {
|
|
@@ -3499,7 +3506,7 @@ var init_email = __esm({
|
|
|
3499
3506
|
config;
|
|
3500
3507
|
metadata = {
|
|
3501
3508
|
name: "email",
|
|
3502
|
-
description: "
|
|
3509
|
+
description: "Access the user's email: check inbox, read messages, search emails, or send new emails. Use when the user asks about their emails or wants to send one.",
|
|
3503
3510
|
riskLevel: "write",
|
|
3504
3511
|
version: "1.0.0",
|
|
3505
3512
|
inputSchema: {
|
|
@@ -3957,10 +3964,17 @@ var init_message_pipeline = __esm({
|
|
|
3957
3964
|
is_error: result.isError
|
|
3958
3965
|
});
|
|
3959
3966
|
}
|
|
3967
|
+
const toolCallSummary = response.toolCalls.map((tc) => `[Used ${tc.name}: ${JSON.stringify(tc.input)}]`).join("\n");
|
|
3968
|
+
const toolResultSummary = toolResultBlocks.map((tr) => {
|
|
3969
|
+
const output2 = tr.type === "tool_result" ? String(tr.content).slice(0, 1e3) : "";
|
|
3970
|
+
return `[Result: ${output2}]`;
|
|
3971
|
+
}).join("\n");
|
|
3972
|
+
this.conversationManager.addMessage(conversation.id, "assistant", `${response.content ? response.content + "\n" : ""}${toolCallSummary}`, JSON.stringify(response.toolCalls));
|
|
3973
|
+
this.conversationManager.addMessage(conversation.id, "user", toolResultSummary);
|
|
3960
3974
|
messages.push({ role: "user", content: toolResultBlocks });
|
|
3961
3975
|
}
|
|
3962
3976
|
const responseText = response.content || "(no response)";
|
|
3963
|
-
this.conversationManager.addMessage(conversation.id, "assistant", responseText
|
|
3977
|
+
this.conversationManager.addMessage(conversation.id, "assistant", responseText);
|
|
3964
3978
|
const duration = Date.now() - startTime;
|
|
3965
3979
|
this.logger.info({ duration, tokens: response.usage, stopReason: response.stopReason, toolIterations: iteration }, "Message processed");
|
|
3966
3980
|
return responseText;
|