@makefinks/daemon 0.9.0 → 0.9.1
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/package.json +11 -3
- package/src/ai/daemon-ai.ts +3 -3
- package/src/ai/memory/memory-manager.ts +5 -1
- package/src/ai/tools/fetch-urls.ts +20 -7
- package/src/components/tool-layouts/layouts/url-tools.ts +3 -1
- package/src/utils/derive-url-menu-items.ts +1 -0
- package/src/utils/tool-output-preview.ts +7 -2
package/package.json
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"module": "src/index.tsx",
|
|
30
30
|
"type": "module",
|
|
31
|
-
"version": "0.9.
|
|
31
|
+
"version": "0.9.1",
|
|
32
32
|
"bin": {
|
|
33
33
|
"daemon": "dist/cli.js"
|
|
34
34
|
},
|
|
@@ -77,13 +77,21 @@
|
|
|
77
77
|
"@ai-sdk/openai": "^3.0.0",
|
|
78
78
|
"@openrouter/ai-sdk-provider": "^2.1.0",
|
|
79
79
|
"@opentui-ui/toast": "^0.0.3",
|
|
80
|
-
"@opentui/core": "
|
|
81
|
-
"@opentui/react": "
|
|
80
|
+
"@opentui/core": "0.1.75",
|
|
81
|
+
"@opentui/react": "0.1.75",
|
|
82
82
|
"ai": "^6.0.0",
|
|
83
83
|
"exa-js": "^2.0.12",
|
|
84
84
|
"mem0ai": "^2.2.1",
|
|
85
85
|
"openai": "^6.16.0",
|
|
86
86
|
"opentui-spinner": "^0.0.6",
|
|
87
87
|
"react": "^19.2.3"
|
|
88
|
+
},
|
|
89
|
+
"optionalDependencies": {
|
|
90
|
+
"@opentui/core-win32-x64": "0.1.75",
|
|
91
|
+
"@opentui/core-win32-arm64": "0.1.75",
|
|
92
|
+
"@opentui/core-darwin-x64": "0.1.75",
|
|
93
|
+
"@opentui/core-darwin-arm64": "0.1.75",
|
|
94
|
+
"@opentui/core-linux-x64": "0.1.75",
|
|
95
|
+
"@opentui/core-linux-arm64": "0.1.75"
|
|
88
96
|
}
|
|
89
97
|
}
|
package/src/ai/daemon-ai.ts
CHANGED
|
@@ -15,14 +15,14 @@ import {
|
|
|
15
15
|
import { getDaemonManager } from "../state/daemon-state";
|
|
16
16
|
import { getRuntimeContext } from "../state/runtime-context";
|
|
17
17
|
import type {
|
|
18
|
+
MemoryToastOperation,
|
|
19
|
+
MemoryToastPreview,
|
|
18
20
|
ReasoningEffort,
|
|
19
21
|
StreamCallbacks,
|
|
20
22
|
TokenUsage,
|
|
21
23
|
ToolApprovalRequest,
|
|
22
24
|
ToolApprovalResponse,
|
|
23
25
|
TranscriptionResult,
|
|
24
|
-
MemoryToastPreview,
|
|
25
|
-
MemoryToastOperation,
|
|
26
26
|
} from "../types";
|
|
27
27
|
import { debug, toolDebug } from "../utils/debug-logger";
|
|
28
28
|
import { getOpenRouterReportedCost } from "../utils/openrouter-reported-cost";
|
|
@@ -321,7 +321,7 @@ export async function generateResponse(
|
|
|
321
321
|
async function persistConversationMemory(
|
|
322
322
|
userMessage: string,
|
|
323
323
|
assistantMessage: string
|
|
324
|
-
): Promise<
|
|
324
|
+
): Promise<MemoryToastPreview | null> {
|
|
325
325
|
const userTextForMemory = userMessage.trim();
|
|
326
326
|
const assistantTextForMemory = assistantMessage.trim();
|
|
327
327
|
|
|
@@ -302,9 +302,13 @@ Rules:
|
|
|
302
302
|
})) as Mem0RawAddResult;
|
|
303
303
|
|
|
304
304
|
const extracted = result.results.map((r) => {
|
|
305
|
-
const
|
|
305
|
+
const rawEvent =
|
|
306
306
|
(r as unknown as { metadata?: { event?: string } }).metadata?.event ??
|
|
307
307
|
(r as { event?: string }).event;
|
|
308
|
+
const validEvents = ["ADD", "UPDATE", "DELETE", "NONE"] as const;
|
|
309
|
+
const event = validEvents.includes(rawEvent as (typeof validEvents)[number])
|
|
310
|
+
? (rawEvent as (typeof validEvents)[number])
|
|
311
|
+
: "NONE";
|
|
308
312
|
return {
|
|
309
313
|
id: r.id,
|
|
310
314
|
memory: r.memory,
|
|
@@ -63,15 +63,28 @@ export const fetchUrls = tool({
|
|
|
63
63
|
return `<fetchUrls error="${escapeXmlAttribute(exaClientResult.error)}" />`;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
interface NormalizedRequest {
|
|
67
|
+
url: string;
|
|
68
|
+
lineOffset?: number;
|
|
69
|
+
lineLimit?: number;
|
|
70
|
+
invalidPagination: boolean;
|
|
71
|
+
effectiveLineOffset: number;
|
|
72
|
+
effectiveLineLimit: number;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const normalizedRequests = requests.map((request): NormalizedRequest => {
|
|
76
|
+
const lineOffset = request.lineOffset;
|
|
77
|
+
const lineLimit = request.lineLimit;
|
|
78
|
+
const hasLineOffset = typeof lineOffset === "number";
|
|
79
|
+
const hasLineLimit = typeof lineLimit === "number";
|
|
80
|
+
const invalidPagination = hasLineOffset && !hasLineLimit && (lineOffset ?? 0) > 0;
|
|
70
81
|
return {
|
|
71
|
-
|
|
82
|
+
url: request.url,
|
|
83
|
+
lineOffset,
|
|
84
|
+
lineLimit,
|
|
72
85
|
invalidPagination,
|
|
73
|
-
effectiveLineOffset: hasLineOffset ?
|
|
74
|
-
effectiveLineLimit: hasLineLimit ?
|
|
86
|
+
effectiveLineOffset: hasLineOffset ? lineOffset : 0,
|
|
87
|
+
effectiveLineLimit: hasLineLimit ? lineLimit : DEFAULT_LINE_LIMIT,
|
|
75
88
|
};
|
|
76
89
|
});
|
|
77
90
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { ToolLayoutConfig, ToolHeader } from "../types";
|
|
2
1
|
import { COLORS } from "../../../ui/constants";
|
|
3
2
|
import { registerToolLayout } from "../registry";
|
|
3
|
+
import type { ToolBody } from "../types";
|
|
4
|
+
import type { ToolHeader, ToolLayoutConfig } from "../types";
|
|
4
5
|
|
|
5
6
|
type UnknownRecord = Record<string, unknown>;
|
|
6
7
|
|
|
@@ -106,6 +107,7 @@ type ExaLikeItem = {
|
|
|
106
107
|
remainingLines?: unknown;
|
|
107
108
|
totalLines?: unknown;
|
|
108
109
|
error?: unknown;
|
|
110
|
+
success?: unknown;
|
|
109
111
|
};
|
|
110
112
|
|
|
111
113
|
function formatExaItemLabel(item: ExaLikeItem): string {
|
|
@@ -53,6 +53,7 @@ function parseFetchUrlsXml(result: string): {
|
|
|
53
53
|
const attrs: Record<string, string> = {};
|
|
54
54
|
for (const attr of attrText.matchAll(/(\w+)="([^"]*)"/g)) {
|
|
55
55
|
const key = attr[1];
|
|
56
|
+
if (!key) continue;
|
|
56
57
|
const value = attr[2] ?? "";
|
|
57
58
|
attrs[key] = unescapeXmlAttribute(value);
|
|
58
59
|
}
|
|
@@ -65,6 +65,10 @@ type ExaLikeItem = {
|
|
|
65
65
|
text?: unknown;
|
|
66
66
|
lineOffset?: unknown;
|
|
67
67
|
lineLimit?: unknown;
|
|
68
|
+
success?: unknown;
|
|
69
|
+
error?: unknown;
|
|
70
|
+
remainingLines?: unknown;
|
|
71
|
+
totalLines?: unknown;
|
|
68
72
|
};
|
|
69
73
|
|
|
70
74
|
function extractExaItems(data: unknown): ExaLikeItem[] | null {
|
|
@@ -146,8 +150,9 @@ function formatExaFetchResult(result: unknown): string | null {
|
|
|
146
150
|
if (headerLine) lines.push(headerLine);
|
|
147
151
|
if (normalLines[0]) lines.push(normalLines[0]);
|
|
148
152
|
|
|
149
|
-
|
|
150
|
-
|
|
153
|
+
const firstErrorLine = errorLines[0];
|
|
154
|
+
if (firstErrorLine) {
|
|
155
|
+
lines.push(firstErrorLine);
|
|
151
156
|
} else if (contentLine) {
|
|
152
157
|
lines.push(contentLine);
|
|
153
158
|
}
|