@codeany/open-agent-sdk 0.2.0 → 0.2.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/dist/agent.d.ts +113 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +446 -0
- package/dist/agent.js.map +1 -0
- package/dist/engine.d.ts +62 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +494 -0
- package/dist/engine.js.map +1 -0
- package/dist/hooks.d.ts +111 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +179 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +133 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/client.d.ts +19 -0
- package/dist/mcp/client.d.ts.map +1 -0
- package/dist/mcp/client.js +126 -0
- package/dist/mcp/client.js.map +1 -0
- package/dist/providers/anthropic.d.ts +17 -0
- package/dist/providers/anthropic.d.ts.map +1 -0
- package/dist/providers/anthropic.js +47 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/index.d.ts +20 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +26 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/openai.d.ts +26 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +212 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/providers/types.d.ts +84 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +11 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/sdk-mcp-server.d.ts +52 -0
- package/dist/sdk-mcp-server.d.ts.map +1 -0
- package/dist/sdk-mcp-server.js +57 -0
- package/dist/sdk-mcp-server.js.map +1 -0
- package/dist/session.d.ts +73 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +159 -0
- package/dist/session.js.map +1 -0
- package/dist/skills/bundled/commit.d.ts +7 -0
- package/dist/skills/bundled/commit.d.ts.map +1 -0
- package/dist/skills/bundled/commit.js +35 -0
- package/dist/skills/bundled/commit.js.map +1 -0
- package/dist/skills/bundled/debug.d.ts +7 -0
- package/dist/skills/bundled/debug.d.ts.map +1 -0
- package/dist/skills/bundled/debug.js +46 -0
- package/dist/skills/bundled/debug.js.map +1 -0
- package/dist/skills/bundled/index.d.ts +11 -0
- package/dist/skills/bundled/index.d.ts.map +1 -0
- package/dist/skills/bundled/index.js +26 -0
- package/dist/skills/bundled/index.js.map +1 -0
- package/dist/skills/bundled/review.d.ts +7 -0
- package/dist/skills/bundled/review.d.ts.map +1 -0
- package/dist/skills/bundled/review.js +38 -0
- package/dist/skills/bundled/review.js.map +1 -0
- package/dist/skills/bundled/simplify.d.ts +8 -0
- package/dist/skills/bundled/simplify.d.ts.map +1 -0
- package/dist/skills/bundled/simplify.js +48 -0
- package/dist/skills/bundled/simplify.js.map +1 -0
- package/dist/skills/bundled/test.d.ts +7 -0
- package/dist/skills/bundled/test.d.ts.map +1 -0
- package/dist/skills/bundled/test.js +40 -0
- package/dist/skills/bundled/test.js.map +1 -0
- package/dist/skills/index.d.ts +7 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +8 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/registry.d.ts +43 -0
- package/dist/skills/registry.d.ts.map +1 -0
- package/dist/skills/registry.js +111 -0
- package/dist/skills/registry.js.map +1 -0
- package/dist/skills/types.d.ts +83 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +8 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/tool-helper.d.ts +73 -0
- package/dist/tool-helper.d.ts.map +1 -0
- package/dist/tool-helper.js +86 -0
- package/dist/tool-helper.js.map +1 -0
- package/dist/tools/agent-tool.d.ts +17 -0
- package/dist/tools/agent-tool.d.ts.map +1 -0
- package/dist/tools/agent-tool.js +146 -0
- package/dist/tools/agent-tool.js.map +1 -0
- package/dist/tools/ask-user.d.ts +18 -0
- package/dist/tools/ask-user.d.ts.map +1 -0
- package/dist/tools/ask-user.js +72 -0
- package/dist/tools/ask-user.js.map +1 -0
- package/dist/tools/bash.d.ts +5 -0
- package/dist/tools/bash.d.ts.map +1 -0
- package/dist/tools/bash.js +67 -0
- package/dist/tools/bash.js.map +1 -0
- package/dist/tools/config-tool.d.ts +20 -0
- package/dist/tools/config-tool.d.ts.map +1 -0
- package/dist/tools/config-tool.js +83 -0
- package/dist/tools/config-tool.js.map +1 -0
- package/dist/tools/cron-tools.d.ts +33 -0
- package/dist/tools/cron-tools.d.ts.map +1 -0
- package/dist/tools/cron-tools.js +128 -0
- package/dist/tools/cron-tools.js.map +1 -0
- package/dist/tools/edit.d.ts +5 -0
- package/dist/tools/edit.d.ts.map +1 -0
- package/dist/tools/edit.js +70 -0
- package/dist/tools/edit.js.map +1 -0
- package/dist/tools/glob.d.ts +5 -0
- package/dist/tools/glob.d.ts.map +1 -0
- package/dist/tools/glob.js +75 -0
- package/dist/tools/glob.js.map +1 -0
- package/dist/tools/grep.d.ts +5 -0
- package/dist/tools/grep.d.ts.map +1 -0
- package/dist/tools/grep.js +168 -0
- package/dist/tools/grep.js.map +1 -0
- package/dist/tools/index.d.ts +45 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +162 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/lsp-tool.d.ts +9 -0
- package/dist/tools/lsp-tool.d.ts.map +1 -0
- package/dist/tools/lsp-tool.js +137 -0
- package/dist/tools/lsp-tool.js.map +1 -0
- package/dist/tools/mcp-resource-tools.d.ts +14 -0
- package/dist/tools/mcp-resource-tools.d.ts.map +1 -0
- package/dist/tools/mcp-resource-tools.js +117 -0
- package/dist/tools/mcp-resource-tools.js.map +1 -0
- package/dist/tools/notebook-edit.d.ts +5 -0
- package/dist/tools/notebook-edit.d.ts.map +1 -0
- package/dist/tools/notebook-edit.js +85 -0
- package/dist/tools/notebook-edit.js.map +1 -0
- package/dist/tools/plan-tools.d.ts +12 -0
- package/dist/tools/plan-tools.d.ts.map +1 -0
- package/dist/tools/plan-tools.js +77 -0
- package/dist/tools/plan-tools.js.map +1 -0
- package/dist/tools/read.d.ts +5 -0
- package/dist/tools/read.d.ts.map +1 -0
- package/dist/tools/read.js +66 -0
- package/dist/tools/read.js.map +1 -0
- package/dist/tools/send-message.d.ts +31 -0
- package/dist/tools/send-message.d.ts.map +1 -0
- package/dist/tools/send-message.js +77 -0
- package/dist/tools/send-message.js.map +1 -0
- package/dist/tools/skill-tool.d.ts +9 -0
- package/dist/tools/skill-tool.d.ts.map +1 -0
- package/dist/tools/skill-tool.js +115 -0
- package/dist/tools/skill-tool.js.map +1 -0
- package/dist/tools/task-tools.d.ts +48 -0
- package/dist/tools/task-tools.d.ts.map +1 -0
- package/dist/tools/task-tools.js +242 -0
- package/dist/tools/task-tools.js.map +1 -0
- package/dist/tools/team-tools.d.ts +34 -0
- package/dist/tools/team-tools.d.ts.map +1 -0
- package/dist/tools/team-tools.js +103 -0
- package/dist/tools/team-tools.js.map +1 -0
- package/dist/tools/todo-tool.d.ts +22 -0
- package/dist/tools/todo-tool.d.ts.map +1 -0
- package/dist/tools/todo-tool.js +93 -0
- package/dist/tools/todo-tool.js.map +1 -0
- package/dist/tools/tool-search.d.ts +13 -0
- package/dist/tools/tool-search.d.ts.map +1 -0
- package/dist/tools/tool-search.js +76 -0
- package/dist/tools/tool-search.js.map +1 -0
- package/dist/tools/types.d.ts +29 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +52 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/web-fetch.d.ts +5 -0
- package/dist/tools/web-fetch.d.ts.map +1 -0
- package/dist/tools/web-fetch.js +60 -0
- package/dist/tools/web-fetch.js.map +1 -0
- package/dist/tools/web-search.d.ts +5 -0
- package/dist/tools/web-search.d.ts.map +1 -0
- package/dist/tools/web-search.js +77 -0
- package/dist/tools/web-search.js.map +1 -0
- package/dist/tools/worktree-tools.d.ts +10 -0
- package/dist/tools/worktree-tools.d.ts.map +1 -0
- package/dist/tools/worktree-tools.js +130 -0
- package/dist/tools/worktree-tools.js.map +1 -0
- package/dist/tools/write.d.ts +5 -0
- package/dist/tools/write.d.ts.map +1 -0
- package/dist/tools/write.js +40 -0
- package/dist/tools/write.js.map +1 -0
- package/dist/types.d.ts +423 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/compact.d.ts +44 -0
- package/dist/utils/compact.d.ts.map +1 -0
- package/dist/utils/compact.js +162 -0
- package/dist/utils/compact.js.map +1 -0
- package/dist/utils/context.d.ts +35 -0
- package/dist/utils/context.d.ts.map +1 -0
- package/dist/utils/context.js +174 -0
- package/dist/utils/context.js.map +1 -0
- package/dist/utils/fileCache.d.ts +64 -0
- package/dist/utils/fileCache.d.ts.map +1 -0
- package/dist/utils/fileCache.js +117 -0
- package/dist/utils/fileCache.js.map +1 -0
- package/dist/utils/messages.d.ts +57 -0
- package/dist/utils/messages.d.ts.map +1 -0
- package/dist/utils/messages.js +152 -0
- package/dist/utils/messages.js.map +1 -0
- package/dist/utils/retry.d.ts +48 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +111 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/utils/tokens.d.ts +57 -0
- package/dist/utils/tokens.d.ts.map +1 -0
- package/dist/utils/tokens.js +134 -0
- package/dist/utils/tokens.js.map +1 -0
- package/package.json +7 -1
- package/.env.example +0 -8
- package/examples/01-simple-query.ts +0 -43
- package/examples/02-multi-tool.ts +0 -44
- package/examples/03-multi-turn.ts +0 -39
- package/examples/04-prompt-api.ts +0 -29
- package/examples/05-custom-system-prompt.ts +0 -26
- package/examples/06-mcp-server.ts +0 -49
- package/examples/07-custom-tools.ts +0 -87
- package/examples/08-official-api-compat.ts +0 -38
- package/examples/09-subagents.ts +0 -48
- package/examples/10-permissions.ts +0 -40
- package/examples/11-custom-mcp-tools.ts +0 -101
- package/examples/12-skills.ts +0 -88
- package/examples/13-hooks.ts +0 -88
- package/examples/14-openai-compat.ts +0 -71
- package/examples/web/index.html +0 -365
- package/examples/web/server.ts +0 -157
- package/tsconfig.json +0 -19
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System & User Context
|
|
3
|
+
*
|
|
4
|
+
* Builds context for the system prompt:
|
|
5
|
+
* - Git status injection (branch, commits, status)
|
|
6
|
+
* - AGENT.md / project context discovery and injection
|
|
7
|
+
* - Working directory info
|
|
8
|
+
* - Date injection
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Get git status info for system prompt.
|
|
12
|
+
* Memoized per cwd (cleared on new session).
|
|
13
|
+
*/
|
|
14
|
+
export declare function getGitStatus(cwd: string): Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Discover project context files (AGENT.md, CLAUDE.md) in the project.
|
|
17
|
+
*/
|
|
18
|
+
export declare function discoverProjectContextFiles(cwd: string): Promise<string[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Read project context file content from discovered files.
|
|
21
|
+
*/
|
|
22
|
+
export declare function readProjectContextContent(cwd: string): Promise<string>;
|
|
23
|
+
/**
|
|
24
|
+
* Get system context for the system prompt.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getSystemContext(cwd: string): Promise<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Get user context (AGENT.md, date, etc).
|
|
29
|
+
*/
|
|
30
|
+
export declare function getUserContext(cwd: string): Promise<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Clear memoized context (call between sessions).
|
|
33
|
+
*/
|
|
34
|
+
export declare function clearContextCache(): void;
|
|
35
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/utils/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH;;;GAGG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAwD/D;AAkBD;;GAEG;AACH,wBAAsB,2BAA2B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CA6BhF;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiB5E;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CASnE;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAajE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAGxC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System & User Context
|
|
3
|
+
*
|
|
4
|
+
* Builds context for the system prompt:
|
|
5
|
+
* - Git status injection (branch, commits, status)
|
|
6
|
+
* - AGENT.md / project context discovery and injection
|
|
7
|
+
* - Working directory info
|
|
8
|
+
* - Date injection
|
|
9
|
+
*/
|
|
10
|
+
import { execSync } from 'child_process';
|
|
11
|
+
import { readFile, stat } from 'fs/promises';
|
|
12
|
+
import { join } from 'path';
|
|
13
|
+
// Memoization cache
|
|
14
|
+
let cachedGitStatus = null;
|
|
15
|
+
let cachedGitStatusCwd = null;
|
|
16
|
+
/**
|
|
17
|
+
* Get git status info for system prompt.
|
|
18
|
+
* Memoized per cwd (cleared on new session).
|
|
19
|
+
*/
|
|
20
|
+
export async function getGitStatus(cwd) {
|
|
21
|
+
if (cachedGitStatus && cachedGitStatusCwd === cwd) {
|
|
22
|
+
return cachedGitStatus;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const parts = [];
|
|
26
|
+
const gitExec = (cmd, timeoutMs = 5000) => {
|
|
27
|
+
try {
|
|
28
|
+
return execSync(cmd, {
|
|
29
|
+
cwd, timeout: timeoutMs, encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'],
|
|
30
|
+
}).trim();
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
// Check if this is a git repo at all
|
|
37
|
+
if (!gitExec('git rev-parse --git-dir'))
|
|
38
|
+
return '';
|
|
39
|
+
// Current branch
|
|
40
|
+
const branch = gitExec('git rev-parse --abbrev-ref HEAD');
|
|
41
|
+
if (branch)
|
|
42
|
+
parts.push(`Current branch: ${branch}`);
|
|
43
|
+
// Main branch detection
|
|
44
|
+
const mainBranch = detectMainBranch(cwd);
|
|
45
|
+
if (mainBranch)
|
|
46
|
+
parts.push(`Main branch: ${mainBranch}`);
|
|
47
|
+
// Git user
|
|
48
|
+
const user = gitExec('git config user.name', 3000);
|
|
49
|
+
if (user)
|
|
50
|
+
parts.push(`Git user: ${user}`);
|
|
51
|
+
// Status (staged + unstaged)
|
|
52
|
+
const status = gitExec('git status --short');
|
|
53
|
+
if (status) {
|
|
54
|
+
const truncated = status.length > 2000
|
|
55
|
+
? status.slice(0, 2000) + '\n...(truncated)'
|
|
56
|
+
: status;
|
|
57
|
+
parts.push(`Status:\n${truncated}`);
|
|
58
|
+
}
|
|
59
|
+
// Recent commits (only if HEAD exists)
|
|
60
|
+
const hasHead = gitExec('git rev-parse HEAD');
|
|
61
|
+
if (hasHead) {
|
|
62
|
+
const log = gitExec('git log --oneline -5 --no-decorate');
|
|
63
|
+
if (log)
|
|
64
|
+
parts.push(`Recent commits:\n${log}`);
|
|
65
|
+
}
|
|
66
|
+
cachedGitStatus = parts.join('\n\n');
|
|
67
|
+
cachedGitStatusCwd = cwd;
|
|
68
|
+
return cachedGitStatus;
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return '';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Detect the main branch name (main or master).
|
|
76
|
+
*/
|
|
77
|
+
function detectMainBranch(cwd) {
|
|
78
|
+
try {
|
|
79
|
+
const branches = execSync('git branch -l main master', {
|
|
80
|
+
cwd, timeout: 3000, encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'],
|
|
81
|
+
}).trim();
|
|
82
|
+
if (branches.includes('main'))
|
|
83
|
+
return 'main';
|
|
84
|
+
if (branches.includes('master'))
|
|
85
|
+
return 'master';
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Discover project context files (AGENT.md, CLAUDE.md) in the project.
|
|
94
|
+
*/
|
|
95
|
+
export async function discoverProjectContextFiles(cwd) {
|
|
96
|
+
const candidates = [
|
|
97
|
+
join(cwd, 'AGENT.md'),
|
|
98
|
+
join(cwd, 'CLAUDE.md'),
|
|
99
|
+
join(cwd, '.claude', 'CLAUDE.md'),
|
|
100
|
+
join(cwd, 'claude.md'),
|
|
101
|
+
];
|
|
102
|
+
// Also check home directory
|
|
103
|
+
const home = process.env.HOME || process.env.USERPROFILE || '';
|
|
104
|
+
if (home) {
|
|
105
|
+
candidates.push(join(home, '.claude', 'CLAUDE.md'));
|
|
106
|
+
}
|
|
107
|
+
const found = [];
|
|
108
|
+
for (const path of candidates) {
|
|
109
|
+
try {
|
|
110
|
+
const s = await stat(path);
|
|
111
|
+
if (s.isFile()) {
|
|
112
|
+
found.push(path);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
// File doesn't exist
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return found;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Read project context file content from discovered files.
|
|
123
|
+
*/
|
|
124
|
+
export async function readProjectContextContent(cwd) {
|
|
125
|
+
const files = await discoverProjectContextFiles(cwd);
|
|
126
|
+
if (files.length === 0)
|
|
127
|
+
return '';
|
|
128
|
+
const parts = [];
|
|
129
|
+
for (const file of files) {
|
|
130
|
+
try {
|
|
131
|
+
const content = await readFile(file, 'utf-8');
|
|
132
|
+
if (content.trim()) {
|
|
133
|
+
parts.push(`# From ${file}:\n${content.trim()}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
// Skip unreadable files
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return parts.join('\n\n');
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Get system context for the system prompt.
|
|
144
|
+
*/
|
|
145
|
+
export async function getSystemContext(cwd) {
|
|
146
|
+
const parts = [];
|
|
147
|
+
const gitStatus = await getGitStatus(cwd);
|
|
148
|
+
if (gitStatus) {
|
|
149
|
+
parts.push(`gitStatus: ${gitStatus}`);
|
|
150
|
+
}
|
|
151
|
+
return parts.join('\n\n');
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Get user context (AGENT.md, date, etc).
|
|
155
|
+
*/
|
|
156
|
+
export async function getUserContext(cwd) {
|
|
157
|
+
const parts = [];
|
|
158
|
+
// Current date
|
|
159
|
+
parts.push(`# currentDate\nToday's date is ${new Date().toISOString().split('T')[0]}.`);
|
|
160
|
+
// Project context files
|
|
161
|
+
const projectCtx = await readProjectContextContent(cwd);
|
|
162
|
+
if (projectCtx) {
|
|
163
|
+
parts.push(projectCtx);
|
|
164
|
+
}
|
|
165
|
+
return parts.join('\n\n');
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Clear memoized context (call between sessions).
|
|
169
|
+
*/
|
|
170
|
+
export function clearContextCache() {
|
|
171
|
+
cachedGitStatus = null;
|
|
172
|
+
cachedGitStatusCwd = null;
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/utils/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH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AC,IAAI,CAAC,UAAU,CAAC,CAAA;IACxB,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,eAAe,GAAG,IAAI,CAAA;IACtB,kBAAkB,GAAG,IAAI,CAAA;AAC3B,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File State LRU Cache
|
|
3
|
+
*
|
|
4
|
+
* Bounded cache for file contents with path normalization.
|
|
5
|
+
* Used to track file states for compaction diffs and
|
|
6
|
+
* avoiding redundant reads.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Cached file state.
|
|
10
|
+
*/
|
|
11
|
+
export interface FileState {
|
|
12
|
+
content: string;
|
|
13
|
+
timestamp: number;
|
|
14
|
+
offset?: number;
|
|
15
|
+
limit?: number;
|
|
16
|
+
isPartialView?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* LRU file state cache with size limits.
|
|
20
|
+
*/
|
|
21
|
+
export declare class FileStateCache {
|
|
22
|
+
private cache;
|
|
23
|
+
private maxEntries;
|
|
24
|
+
private maxSizeBytes;
|
|
25
|
+
private currentSizeBytes;
|
|
26
|
+
constructor(maxEntries?: number, maxSizeBytes?: number);
|
|
27
|
+
/**
|
|
28
|
+
* Normalize a file path for cache lookup.
|
|
29
|
+
*/
|
|
30
|
+
private normalizePath;
|
|
31
|
+
/**
|
|
32
|
+
* Get a cached file state.
|
|
33
|
+
*/
|
|
34
|
+
get(filePath: string): FileState | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Set a cached file state.
|
|
37
|
+
*/
|
|
38
|
+
set(filePath: string, state: FileState): void;
|
|
39
|
+
/**
|
|
40
|
+
* Delete a cached entry.
|
|
41
|
+
*/
|
|
42
|
+
delete(filePath: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Clear all cached entries.
|
|
45
|
+
*/
|
|
46
|
+
clear(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Get the number of cached entries.
|
|
49
|
+
*/
|
|
50
|
+
get size(): number;
|
|
51
|
+
/**
|
|
52
|
+
* Get all cached file paths.
|
|
53
|
+
*/
|
|
54
|
+
keys(): string[];
|
|
55
|
+
/**
|
|
56
|
+
* Clone the cache.
|
|
57
|
+
*/
|
|
58
|
+
clone(): FileStateCache;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Create a file state cache with default limits.
|
|
62
|
+
*/
|
|
63
|
+
export declare function createFileStateCache(maxEntries?: number, maxSizeBytes?: number): FileStateCache;
|
|
64
|
+
//# sourceMappingURL=fileCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileCache.d.ts","sourceRoot":"","sources":["../../src/utils/fileCache.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,gBAAgB,CAAI;gBAEhB,UAAU,GAAE,MAAY,EAAE,YAAY,GAAE,MAAyB;IAK7E;;OAEG;IACH,OAAO,CAAC,aAAa;IAIrB;;OAEG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAW5C;;OAEG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI;IA+B7C;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAWjC;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,IAAI,IAAI,MAAM,EAAE;IAIhB;;OAEG;IACH,KAAK,IAAI,cAAc;CAQxB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,GAAE,MAAY,EACxB,YAAY,GAAE,MAAyB,GACtC,cAAc,CAEhB"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File State LRU Cache
|
|
3
|
+
*
|
|
4
|
+
* Bounded cache for file contents with path normalization.
|
|
5
|
+
* Used to track file states for compaction diffs and
|
|
6
|
+
* avoiding redundant reads.
|
|
7
|
+
*/
|
|
8
|
+
import { normalize, resolve } from 'path';
|
|
9
|
+
/**
|
|
10
|
+
* LRU file state cache with size limits.
|
|
11
|
+
*/
|
|
12
|
+
export class FileStateCache {
|
|
13
|
+
cache = new Map();
|
|
14
|
+
maxEntries;
|
|
15
|
+
maxSizeBytes;
|
|
16
|
+
currentSizeBytes = 0;
|
|
17
|
+
constructor(maxEntries = 100, maxSizeBytes = 25 * 1024 * 1024) {
|
|
18
|
+
this.maxEntries = maxEntries;
|
|
19
|
+
this.maxSizeBytes = maxSizeBytes;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Normalize a file path for cache lookup.
|
|
23
|
+
*/
|
|
24
|
+
normalizePath(filePath) {
|
|
25
|
+
return normalize(resolve(filePath));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get a cached file state.
|
|
29
|
+
*/
|
|
30
|
+
get(filePath) {
|
|
31
|
+
const key = this.normalizePath(filePath);
|
|
32
|
+
const entry = this.cache.get(key);
|
|
33
|
+
if (entry) {
|
|
34
|
+
// Move to end (most recently used)
|
|
35
|
+
this.cache.delete(key);
|
|
36
|
+
this.cache.set(key, entry);
|
|
37
|
+
}
|
|
38
|
+
return entry;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Set a cached file state.
|
|
42
|
+
*/
|
|
43
|
+
set(filePath, state) {
|
|
44
|
+
const key = this.normalizePath(filePath);
|
|
45
|
+
// Remove old entry if exists
|
|
46
|
+
const old = this.cache.get(key);
|
|
47
|
+
if (old) {
|
|
48
|
+
this.currentSizeBytes -= Buffer.byteLength(old.content, 'utf-8');
|
|
49
|
+
this.cache.delete(key);
|
|
50
|
+
}
|
|
51
|
+
const newSize = Buffer.byteLength(state.content, 'utf-8');
|
|
52
|
+
// Evict entries if necessary
|
|
53
|
+
while ((this.cache.size >= this.maxEntries || this.currentSizeBytes + newSize > this.maxSizeBytes) &&
|
|
54
|
+
this.cache.size > 0) {
|
|
55
|
+
const firstKey = this.cache.keys().next().value;
|
|
56
|
+
if (firstKey) {
|
|
57
|
+
const entry = this.cache.get(firstKey);
|
|
58
|
+
if (entry) {
|
|
59
|
+
this.currentSizeBytes -= Buffer.byteLength(entry.content, 'utf-8');
|
|
60
|
+
}
|
|
61
|
+
this.cache.delete(firstKey);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
this.cache.set(key, state);
|
|
65
|
+
this.currentSizeBytes += newSize;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Delete a cached entry.
|
|
69
|
+
*/
|
|
70
|
+
delete(filePath) {
|
|
71
|
+
const key = this.normalizePath(filePath);
|
|
72
|
+
const entry = this.cache.get(key);
|
|
73
|
+
if (entry) {
|
|
74
|
+
this.currentSizeBytes -= Buffer.byteLength(entry.content, 'utf-8');
|
|
75
|
+
this.cache.delete(key);
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Clear all cached entries.
|
|
82
|
+
*/
|
|
83
|
+
clear() {
|
|
84
|
+
this.cache.clear();
|
|
85
|
+
this.currentSizeBytes = 0;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get the number of cached entries.
|
|
89
|
+
*/
|
|
90
|
+
get size() {
|
|
91
|
+
return this.cache.size;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Get all cached file paths.
|
|
95
|
+
*/
|
|
96
|
+
keys() {
|
|
97
|
+
return Array.from(this.cache.keys());
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Clone the cache.
|
|
101
|
+
*/
|
|
102
|
+
clone() {
|
|
103
|
+
const clone = new FileStateCache(this.maxEntries, this.maxSizeBytes);
|
|
104
|
+
for (const [key, value] of this.cache) {
|
|
105
|
+
clone.cache.set(key, { ...value });
|
|
106
|
+
}
|
|
107
|
+
clone.currentSizeBytes = this.currentSizeBytes;
|
|
108
|
+
return clone;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Create a file state cache with default limits.
|
|
113
|
+
*/
|
|
114
|
+
export function createFileStateCache(maxEntries = 100, maxSizeBytes = 25 * 1024 * 1024) {
|
|
115
|
+
return new FileStateCache(maxEntries, maxSizeBytes);
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=fileCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileCache.js","sourceRoot":"","sources":["../../src/utils/fileCache.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAazC;;GAEG;AACH,MAAM,OAAO,cAAc;IACjB,KAAK,GAAG,IAAI,GAAG,EAAqB,CAAA;IACpC,UAAU,CAAQ;IAClB,YAAY,CAAQ;IACpB,gBAAgB,GAAG,CAAC,CAAA;IAE5B,YAAY,aAAqB,GAAG,EAAE,eAAuB,EAAE,GAAG,IAAI,GAAG,IAAI;QAC3E,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;IAClC,CAAC;IAED;;OAEG;IACK,aAAa,C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K,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;IACtC,CAAC;IAED;;OAEG;IACH,KAAK;QACH,MAAM,KAAK,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;QACpE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACtC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,KAAK,EAAE,CAAC,CAAA;QACpC,CAAC;QACD,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAA;QAC9C,OAAO,KAAK,CAAA;IACd,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,aAAqB,GAAG,EACxB,eAAuB,EAAE,GAAG,IAAI,GAAG,IAAI;IAEvC,OAAO,IAAI,cAAc,CAAC,UAAU,EAAE,YAAY,CAAC,CAAA;AACrD,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message Utilities
|
|
3
|
+
*
|
|
4
|
+
* Message creation factories, normalization for API,
|
|
5
|
+
* synthetic placeholders, and content processing.
|
|
6
|
+
*/
|
|
7
|
+
import type { UserMessage, AssistantMessage, TokenUsage } from '../types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Create a user message.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createUserMessage(content: string | any[], options?: {
|
|
12
|
+
uuid?: string;
|
|
13
|
+
isMeta?: boolean;
|
|
14
|
+
toolUseResult?: unknown;
|
|
15
|
+
}): UserMessage;
|
|
16
|
+
/**
|
|
17
|
+
* Create an assistant message.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createAssistantMessage(content: any[], usage?: TokenUsage): AssistantMessage;
|
|
20
|
+
/**
|
|
21
|
+
* Normalize messages for the LLM API.
|
|
22
|
+
* Ensures proper message format, strips internal metadata,
|
|
23
|
+
* and fixes tool result pairing.
|
|
24
|
+
*/
|
|
25
|
+
export declare function normalizeMessagesForAPI(messages: Array<{
|
|
26
|
+
role: string;
|
|
27
|
+
content: any;
|
|
28
|
+
}>): Array<{
|
|
29
|
+
role: string;
|
|
30
|
+
content: any;
|
|
31
|
+
}>;
|
|
32
|
+
/**
|
|
33
|
+
* Strip images from messages (for compaction).
|
|
34
|
+
*/
|
|
35
|
+
export declare function stripImagesFromMessages(messages: Array<{
|
|
36
|
+
role: string;
|
|
37
|
+
content: any;
|
|
38
|
+
}>): Array<{
|
|
39
|
+
role: string;
|
|
40
|
+
content: any;
|
|
41
|
+
}>;
|
|
42
|
+
/**
|
|
43
|
+
* Extract text from message content blocks.
|
|
44
|
+
*/
|
|
45
|
+
export declare function extractTextFromContent(content: any[] | string): string;
|
|
46
|
+
/**
|
|
47
|
+
* Create a system message for compact boundary.
|
|
48
|
+
*/
|
|
49
|
+
export declare function createCompactBoundaryMessage(): {
|
|
50
|
+
role: string;
|
|
51
|
+
content: string;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Truncate text to max length with ellipsis.
|
|
55
|
+
*/
|
|
56
|
+
export declare function truncateText(text: string, maxLength: number): string;
|
|
57
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/utils/messages.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAW,WAAW,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAErF;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,GAAG,GAAG,EAAE,EACvB,OAAO,CAAC,EAAE;IACR,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,GACA,WAAW,CAUb;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,GAAG,EAAE,EACd,KAAK,CAAC,EAAE,UAAU,GACjB,gBAAgB,CAWlB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,GAAG,CAAA;CAAE,CAAC,GAC9C,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,GAAG,CAAA;CAAE,CAAC,CAiCvC;AAoDD;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,GAAG,CAAA;CAAE,CAAC,GAC9C,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,GAAG,CAAA;CAAE,CAAC,CAcvC;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,GAAG,EAAE,GAAG,MAAM,GACtB,MAAM,CAOR;AAED;;GAEG;AACH,wBAAgB,4BAA4B,IAAI;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAKhF;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAIpE"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message Utilities
|
|
3
|
+
*
|
|
4
|
+
* Message creation factories, normalization for API,
|
|
5
|
+
* synthetic placeholders, and content processing.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Create a user message.
|
|
9
|
+
*/
|
|
10
|
+
export function createUserMessage(content, options) {
|
|
11
|
+
return {
|
|
12
|
+
type: 'user',
|
|
13
|
+
message: {
|
|
14
|
+
role: 'user',
|
|
15
|
+
content,
|
|
16
|
+
},
|
|
17
|
+
uuid: options?.uuid || crypto.randomUUID(),
|
|
18
|
+
timestamp: new Date().toISOString(),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create an assistant message.
|
|
23
|
+
*/
|
|
24
|
+
export function createAssistantMessage(content, usage) {
|
|
25
|
+
return {
|
|
26
|
+
type: 'assistant',
|
|
27
|
+
message: {
|
|
28
|
+
role: 'assistant',
|
|
29
|
+
content,
|
|
30
|
+
},
|
|
31
|
+
uuid: crypto.randomUUID(),
|
|
32
|
+
timestamp: new Date().toISOString(),
|
|
33
|
+
usage,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Normalize messages for the LLM API.
|
|
38
|
+
* Ensures proper message format, strips internal metadata,
|
|
39
|
+
* and fixes tool result pairing.
|
|
40
|
+
*/
|
|
41
|
+
export function normalizeMessagesForAPI(messages) {
|
|
42
|
+
const normalized = [];
|
|
43
|
+
for (let i = 0; i < messages.length; i++) {
|
|
44
|
+
const msg = messages[i];
|
|
45
|
+
// Ensure alternating user/assistant messages
|
|
46
|
+
if (normalized.length > 0) {
|
|
47
|
+
const last = normalized[normalized.length - 1];
|
|
48
|
+
if (last.role === msg.role) {
|
|
49
|
+
// Merge same-role messages
|
|
50
|
+
if (msg.role === 'user') {
|
|
51
|
+
// Combine content
|
|
52
|
+
const lastContent = typeof last.content === 'string'
|
|
53
|
+
? [{ type: 'text', text: last.content }]
|
|
54
|
+
: last.content;
|
|
55
|
+
const newContent = typeof msg.content === 'string'
|
|
56
|
+
? [{ type: 'text', text: msg.content }]
|
|
57
|
+
: msg.content;
|
|
58
|
+
normalized[normalized.length - 1] = {
|
|
59
|
+
role: 'user',
|
|
60
|
+
content: [...lastContent, ...newContent],
|
|
61
|
+
};
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
normalized.push({ ...msg });
|
|
67
|
+
}
|
|
68
|
+
// Ensure tool results are properly paired with tool_use
|
|
69
|
+
return fixToolResultPairing(normalized);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Fix tool result pairing: ensure every tool_result has a
|
|
73
|
+
* matching tool_use in the previous assistant message.
|
|
74
|
+
*/
|
|
75
|
+
function fixToolResultPairing(messages) {
|
|
76
|
+
const result = [];
|
|
77
|
+
for (let i = 0; i < messages.length; i++) {
|
|
78
|
+
const msg = messages[i];
|
|
79
|
+
if (msg.role === 'user' && Array.isArray(msg.content)) {
|
|
80
|
+
// Check for tool_result blocks
|
|
81
|
+
const toolResults = msg.content.filter((block) => block.type === 'tool_result');
|
|
82
|
+
if (toolResults.length > 0 && result.length > 0) {
|
|
83
|
+
// Find the previous assistant message
|
|
84
|
+
const prevAssistant = result[result.length - 1];
|
|
85
|
+
if (prevAssistant.role === 'assistant' && Array.isArray(prevAssistant.content)) {
|
|
86
|
+
const toolUseIds = new Set(prevAssistant.content
|
|
87
|
+
.filter((b) => b.type === 'tool_use')
|
|
88
|
+
.map((b) => b.id));
|
|
89
|
+
// Filter out orphaned tool results
|
|
90
|
+
const validContent = msg.content.filter((block) => {
|
|
91
|
+
if (block.type === 'tool_result') {
|
|
92
|
+
return toolUseIds.has(block.tool_use_id);
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
});
|
|
96
|
+
if (validContent.length > 0) {
|
|
97
|
+
result.push({ ...msg, content: validContent });
|
|
98
|
+
}
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
result.push(msg);
|
|
104
|
+
}
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Strip images from messages (for compaction).
|
|
109
|
+
*/
|
|
110
|
+
export function stripImagesFromMessages(messages) {
|
|
111
|
+
return messages.map((msg) => {
|
|
112
|
+
if (typeof msg.content === 'string')
|
|
113
|
+
return msg;
|
|
114
|
+
if (!Array.isArray(msg.content))
|
|
115
|
+
return msg;
|
|
116
|
+
const filtered = msg.content.filter((block) => block.type !== 'image');
|
|
117
|
+
return {
|
|
118
|
+
...msg,
|
|
119
|
+
content: filtered.length > 0 ? filtered : '[content removed]',
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Extract text from message content blocks.
|
|
125
|
+
*/
|
|
126
|
+
export function extractTextFromContent(content) {
|
|
127
|
+
if (typeof content === 'string')
|
|
128
|
+
return content;
|
|
129
|
+
return content
|
|
130
|
+
.filter((b) => b.type === 'text')
|
|
131
|
+
.map((b) => b.text)
|
|
132
|
+
.join('');
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Create a system message for compact boundary.
|
|
136
|
+
*/
|
|
137
|
+
export function createCompactBoundaryMessage() {
|
|
138
|
+
return {
|
|
139
|
+
role: 'user',
|
|
140
|
+
content: '[Previous context has been summarized above. Continuing conversation.]',
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Truncate text to max length with ellipsis.
|
|
145
|
+
*/
|
|
146
|
+
export function truncateText(text, maxLength) {
|
|
147
|
+
if (text.length <= maxLength)
|
|
148
|
+
return text;
|
|
149
|
+
const half = Math.floor(maxLength / 2);
|
|
150
|
+
return text.slice(0, half) + '\n...(truncated)...\n' + text.slice(-half);
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/utils/messages.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAuB,EACvB,OAIC;IAED,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE;YACP,IAAI,EAAE,MAAM;YACZ,OAAO;SACR;QACD,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,MAAM,CAAC,UAA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