@hyperwindmill/caretaker-cli 0.31.0 → 0.32.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/cli/web/mcp_bridge.d.ts +1 -0
- package/dist/cli/web/mcp_bridge.d.ts.map +1 -1
- package/dist/cli/web/mcp_bridge.js +11 -2
- package/dist/cli/web/scheduler/email_triage.d.ts +63 -0
- package/dist/cli/web/scheduler/email_triage.d.ts.map +1 -0
- package/dist/cli/web/scheduler/email_triage.js +247 -0
- package/dist/cli/web/scheduler/email_triage_agent.d.ts +16 -0
- package/dist/cli/web/scheduler/email_triage_agent.d.ts.map +1 -0
- package/dist/cli/web/scheduler/email_triage_agent.js +93 -0
- package/dist/cli/web/scheduler.d.ts.map +1 -1
- package/dist/cli/web/scheduler.js +2 -0
- package/dist/harness/tools/builtin/email_tools.d.ts +1 -0
- package/dist/harness/tools/builtin/email_tools.d.ts.map +1 -1
- package/dist/harness/tools/builtin/email_tools.js +41 -1
- package/dist/harness/tools/builtin/index.d.ts +2 -2
- package/dist/harness/tools/builtin/index.d.ts.map +1 -1
- package/dist/harness/tools/builtin/index.js +3 -2
- package/dist/lib/email.d.ts +20 -0
- package/dist/lib/email.d.ts.map +1 -1
- package/dist/lib/email.js +106 -33
- package/dist/webview/standalone.js +200 -2
- package/dist/webview/standalone.js.map +4 -4
- package/package.json +3 -3
|
@@ -5,6 +5,7 @@ export declare function issueBridgeToken(agentId?: string, opts?: {
|
|
|
5
5
|
workdir: string;
|
|
6
6
|
};
|
|
7
7
|
execOnly?: boolean;
|
|
8
|
+
only?: string[];
|
|
8
9
|
}): string;
|
|
9
10
|
export declare function revokeBridgeToken(token: string): void;
|
|
10
11
|
export declare function setTaskBridgeUrl(url: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp_bridge.d.ts","sourceRoot":"","sources":["../../../src/cli/web/mcp_bridge.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp_bridge.d.ts","sourceRoot":"","sources":["../../../src/cli/web/mcp_bridge.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAmBjC,wBAAgB,gBAAgB,CAC9B,OAAO,SAAK,EACZ,IAAI,GAAE;IACJ,IAAI,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACZ,GACL,MAAM,CASR;AACD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAErD;AAGD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAElD;AACD,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAEhD;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CA8BlD"}
|
|
@@ -21,7 +21,12 @@ import { loadAgents } from '../../store/json.js';
|
|
|
21
21
|
const activeTokens = new Map();
|
|
22
22
|
export function issueBridgeToken(agentId = '', opts = {}) {
|
|
23
23
|
const token = randomBytes(24).toString('hex');
|
|
24
|
-
activeTokens.set(token, {
|
|
24
|
+
activeTokens.set(token, {
|
|
25
|
+
agentId,
|
|
26
|
+
exec: opts.exec,
|
|
27
|
+
execOnly: opts.execOnly,
|
|
28
|
+
only: opts.only,
|
|
29
|
+
});
|
|
25
30
|
return token;
|
|
26
31
|
}
|
|
27
32
|
export function revokeBridgeToken(token) {
|
|
@@ -50,7 +55,11 @@ export function registerTaskBridge(app) {
|
|
|
50
55
|
? (await loadAgents().catch(() => [])).find((a) => a.id === agentId)
|
|
51
56
|
: undefined;
|
|
52
57
|
const extraTools = tokenInfo.exec ? [makeRunCommandTool(tokenInfo.exec)] : [];
|
|
53
|
-
const tools = tokenInfo.
|
|
58
|
+
const tools = tokenInfo.only
|
|
59
|
+
? builtinMcpTools().filter((t) => tokenInfo.only.includes(t.name))
|
|
60
|
+
: tokenInfo.execOnly
|
|
61
|
+
? extraTools
|
|
62
|
+
: [...builtinMcpTools(), ...extraTools];
|
|
54
63
|
const server = buildBuiltinMcpServer(undefined, { callerAgent, tools });
|
|
55
64
|
const transport = new StreamableHTTPServerTransport({
|
|
56
65
|
sessionIdGenerator: undefined, // stateless
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type EmailAccount, type OutgoingMail, type TriageEnvelope, type listUnseenEnvelopes } from '../../../lib/email.js';
|
|
2
|
+
import type { MessageRecord } from '../../../session/types.js';
|
|
3
|
+
import type { AgentConfig, CaretakerConfig, ProviderConfig, ServiceConfig } from '../../../types.js';
|
|
4
|
+
export declare const TRIAGE_INSTRUCTIONS = "You are triaging an inbox. Classify every unread email below into exactly one bucket:\n\n- IMPORTANT: needs action soon: outages, blocked users or customers, failures, direct requests with a deadline.\n- INFORMATION: worth knowing, no immediate action.\n- TRASH: noise: automated notifications without a decision, time tracking, routine bot chatter. Count only, never list.\n\nYour final message must contain only the report, in exactly this shape, starting with \"## IMPORTANT\". Every bucket header is always present; when a table would be empty, write \"_No important emails._\" or \"_No information emails._\" instead of it.\n\n## IMPORTANT\n| From | Subject | Category | Summary | Suggested Action |\n\n## INFORMATION\n| From | Subject | Category | Summary | Suggested Action |\n\n## TRASH\nN emails classified as trash (not listed).\n\nHeaders, bucket names and the table header row are literal and must never be translated, whatever language the rest of the report is written in.\n\nGuidelines:\n- Work from the envelopes (From, Subject, Date). Open a body with email_read only when the subject is not enough.\n- Cluster related notifications into one row.\n- Other tools you have (for example an issue tracker) may be used to understand a reference in an email.\n- Do not send mail: your final message is delivered automatically.";
|
|
5
|
+
export type TriageStop = 'done' | 'max_turns' | 'aborted';
|
|
6
|
+
export declare function buildTriagePrompt(p: {
|
|
7
|
+
accountName: string;
|
|
8
|
+
extra: string;
|
|
9
|
+
envelopes: TriageEnvelope[];
|
|
10
|
+
}): string;
|
|
11
|
+
/** The report is the last non-empty assistant message, from its `## IMPORTANT`
|
|
12
|
+
* line on. A truncated run (max_turns/aborted) never yields one: its last
|
|
13
|
+
* message may be a half-finished "let me read uid 42". */
|
|
14
|
+
export declare function extractReport(messages: MessageRecord[], stop: TriageStop): string | null;
|
|
15
|
+
export declare function triageSubject(prefix: string, count: number, now: Date): string;
|
|
16
|
+
export declare function parseRecipients(raw: string | undefined): string[];
|
|
17
|
+
/** Preflight: everything that can be checked before touching IMAP. Looks the
|
|
18
|
+
* raw record up first (emailAccounts drops disabled ones) so each failure has
|
|
19
|
+
* its own message. Not `visibleAccounts`: a scoped mailbox is a readable
|
|
20
|
+
* error here, not an invisible one. */
|
|
21
|
+
export declare function resolveTriageAccount(services: ServiceConfig[], service: ServiceConfig, agentId: string): {
|
|
22
|
+
account: EmailAccount;
|
|
23
|
+
} | {
|
|
24
|
+
error: string;
|
|
25
|
+
};
|
|
26
|
+
export type TriageAgentInput = {
|
|
27
|
+
agent: AgentConfig;
|
|
28
|
+
provider: ProviderConfig;
|
|
29
|
+
prompt: string;
|
|
30
|
+
account: EmailAccount;
|
|
31
|
+
workingDir: string;
|
|
32
|
+
signal: AbortSignal;
|
|
33
|
+
};
|
|
34
|
+
export type TriageDeps = {
|
|
35
|
+
load(): Promise<{
|
|
36
|
+
agents: AgentConfig[];
|
|
37
|
+
config: CaretakerConfig;
|
|
38
|
+
}>;
|
|
39
|
+
listEnvelopes(account: EmailAccount, max: number, signal: AbortSignal): ReturnType<typeof listUnseenEnvelopes>;
|
|
40
|
+
runAgent(i: TriageAgentInput): Promise<{
|
|
41
|
+
messages: MessageRecord[];
|
|
42
|
+
stop: TriageStop;
|
|
43
|
+
}>;
|
|
44
|
+
/** No budget signal: a delivery in flight must finish on its own timeout. */
|
|
45
|
+
send(account: EmailAccount, mail: OutgoingMail, signal?: AbortSignal): Promise<string>;
|
|
46
|
+
markSeen(account: EmailAccount, uids: number[], uidValidity: string, signal?: AbortSignal): Promise<'marked' | 'uidvalidity-changed'>;
|
|
47
|
+
saveRun(serviceId: string, run: unknown): Promise<void>;
|
|
48
|
+
now(): Date;
|
|
49
|
+
};
|
|
50
|
+
export type TriageOutcome = {
|
|
51
|
+
kind: 'skipped';
|
|
52
|
+
} | {
|
|
53
|
+
kind: 'failure';
|
|
54
|
+
error: string;
|
|
55
|
+
} | {
|
|
56
|
+
kind: 'success';
|
|
57
|
+
included: number;
|
|
58
|
+
refused: number;
|
|
59
|
+
marked: boolean;
|
|
60
|
+
warning?: string;
|
|
61
|
+
};
|
|
62
|
+
export declare function executeTriageRun(service: ServiceConfig, deps: TriageDeps): Promise<TriageOutcome>;
|
|
63
|
+
//# sourceMappingURL=email_triage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email_triage.d.ts","sourceRoot":"","sources":["../../../../src/cli/web/scheduler/email_triage.ts"],"names":[],"mappings":"AAQA,OAAO,EASL,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAMrG,eAAO,MAAM,mBAAmB,8zCAuBmC,CAAC;AAIpE,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;AAE1D,wBAAgB,iBAAiB,CAAC,CAAC,EAAE;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,cAAc,EAAE,CAAC;CAC7B,GAAG,MAAM,CAST;AAED;;2DAE2D;AAC3D,wBAAgB,aAAa,CAAC,QAAQ,EAAE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,MAAM,CAAC,CAAC;IACvF,QAAQ,CACN,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,MAAM,EAAE,EACd,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,QAAQ,GAAG,qBAAqB,CAAC,CAAC;IAC7C,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,GAAG,IAAI,IAAI,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAoB9F,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,aAAa,CAAC,CA+IxB"}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
// Email triage orchestrator: list unread envelopes, run one agent over them,
|
|
2
|
+
// mail the report, then mark exactly the triaged messages read.
|
|
3
|
+
//
|
|
4
|
+
// Deliberately free of any `harness` import: the real deps (agent runner,
|
|
5
|
+
// store, IMAP/SMTP wiring) and the scheduler strategy live in
|
|
6
|
+
// email_triage_agent.ts, so this file is testable with plain fakes.
|
|
7
|
+
import { randomUUID } from 'node:crypto';
|
|
8
|
+
import { canRead, canSend, MAX_FETCH, MAX_SCAN, clampLimit, emailAccounts, markdownToHtml, parsePatterns, } from '../../../lib/email.js';
|
|
9
|
+
import { runningTasks } from './locks.js';
|
|
10
|
+
import { CLAUDE_CODE_DEFAULT_RUN_SECONDS } from './task_roles.js';
|
|
11
|
+
const DEFAULT_PREFIX = '[Email Triage]';
|
|
12
|
+
export const TRIAGE_INSTRUCTIONS = `You are triaging an inbox. Classify every unread email below into exactly one bucket:
|
|
13
|
+
|
|
14
|
+
- IMPORTANT: needs action soon: outages, blocked users or customers, failures, direct requests with a deadline.
|
|
15
|
+
- INFORMATION: worth knowing, no immediate action.
|
|
16
|
+
- TRASH: noise: automated notifications without a decision, time tracking, routine bot chatter. Count only, never list.
|
|
17
|
+
|
|
18
|
+
Your final message must contain only the report, in exactly this shape, starting with "## IMPORTANT". Every bucket header is always present; when a table would be empty, write "_No important emails._" or "_No information emails._" instead of it.
|
|
19
|
+
|
|
20
|
+
## IMPORTANT
|
|
21
|
+
| From | Subject | Category | Summary | Suggested Action |
|
|
22
|
+
|
|
23
|
+
## INFORMATION
|
|
24
|
+
| From | Subject | Category | Summary | Suggested Action |
|
|
25
|
+
|
|
26
|
+
## TRASH
|
|
27
|
+
N emails classified as trash (not listed).
|
|
28
|
+
|
|
29
|
+
Headers, bucket names and the table header row are literal and must never be translated, whatever language the rest of the report is written in.
|
|
30
|
+
|
|
31
|
+
Guidelines:
|
|
32
|
+
- Work from the envelopes (From, Subject, Date). Open a body with email_read only when the subject is not enough.
|
|
33
|
+
- Cluster related notifications into one row.
|
|
34
|
+
- Other tools you have (for example an issue tracker) may be used to understand a reference in an email.
|
|
35
|
+
- Do not send mail: your final message is delivered automatically.`;
|
|
36
|
+
const UNATTENDED_NOTICE = `[UNATTENDED RUN] Note: You are running as an unattended scheduled task. No human is supervising this execution. Act autonomously and complete the task to the best of your ability.`;
|
|
37
|
+
export function buildTriagePrompt(p) {
|
|
38
|
+
const parts = [UNATTENDED_NOTICE, TRIAGE_INSTRUCTIONS];
|
|
39
|
+
if (p.extra.trim())
|
|
40
|
+
parts.push(p.extra.trim());
|
|
41
|
+
parts.push(`Account: ${p.accountName} — pass it as the account argument of email_read.`);
|
|
42
|
+
parts.push('Unread emails (UID | From | Subject | Date):\n' +
|
|
43
|
+
p.envelopes.map((e) => `- ${e.uid} | ${e.from} | ${e.subject} | ${e.date}`).join('\n'));
|
|
44
|
+
return parts.join('\n\n');
|
|
45
|
+
}
|
|
46
|
+
/** The report is the last non-empty assistant message, from its `## IMPORTANT`
|
|
47
|
+
* line on. A truncated run (max_turns/aborted) never yields one: its last
|
|
48
|
+
* message may be a half-finished "let me read uid 42". */
|
|
49
|
+
export function extractReport(messages, stop) {
|
|
50
|
+
if (stop !== 'done')
|
|
51
|
+
return null;
|
|
52
|
+
const last = [...messages].reverse().find((m) => m.role === 'assistant' && m.content?.trim());
|
|
53
|
+
if (!last)
|
|
54
|
+
return null;
|
|
55
|
+
// ACP emits one record per turn with every text part concatenated in
|
|
56
|
+
// `content` (no separator), so prose before a tool call glues onto the
|
|
57
|
+
// report header. Prefer the text after the last tool_use.
|
|
58
|
+
let text = last.content;
|
|
59
|
+
if (last.parts?.length) {
|
|
60
|
+
const lastTool = last.parts.map((p) => p.type).lastIndexOf('tool_use');
|
|
61
|
+
const tail = last.parts
|
|
62
|
+
.slice(lastTool + 1)
|
|
63
|
+
.map((p) => (p.type === 'text' ? p.text : ''))
|
|
64
|
+
.join('');
|
|
65
|
+
if (tail.trim())
|
|
66
|
+
text = tail;
|
|
67
|
+
}
|
|
68
|
+
const m = /^## IMPORTANT\b.*$/m.exec(text);
|
|
69
|
+
return m ? text.slice(m.index).trim() : null;
|
|
70
|
+
}
|
|
71
|
+
export function triageSubject(prefix, count, now) {
|
|
72
|
+
const p = (n) => String(n).padStart(2, '0');
|
|
73
|
+
const stamp = `${now.getFullYear()}-${p(now.getMonth() + 1)}-${p(now.getDate())} ${p(now.getHours())}:${p(now.getMinutes())}`;
|
|
74
|
+
return `${prefix} ${count} emails triaged — ${stamp}`;
|
|
75
|
+
}
|
|
76
|
+
export function parseRecipients(raw) {
|
|
77
|
+
return parsePatterns(raw);
|
|
78
|
+
}
|
|
79
|
+
/** Preflight: everything that can be checked before touching IMAP. Looks the
|
|
80
|
+
* raw record up first (emailAccounts drops disabled ones) so each failure has
|
|
81
|
+
* its own message. Not `visibleAccounts`: a scoped mailbox is a readable
|
|
82
|
+
* error here, not an invisible one. */
|
|
83
|
+
export function resolveTriageAccount(services, service, agentId) {
|
|
84
|
+
const id = service.triageAccountId;
|
|
85
|
+
const rec = services.find((s) => s.id === id);
|
|
86
|
+
if (!rec)
|
|
87
|
+
return { error: `Email account "${id ?? ''}" not found.` };
|
|
88
|
+
if (rec.type !== 'email')
|
|
89
|
+
return { error: `Service "${rec.name}" is not an email account.` };
|
|
90
|
+
if (!rec.enabled)
|
|
91
|
+
return { error: `Email account "${rec.name}" is disabled.` };
|
|
92
|
+
const account = emailAccounts([rec])[0];
|
|
93
|
+
if (account.allowedAgents.length > 0 && !account.allowedAgents.includes(agentId)) {
|
|
94
|
+
return { error: `Email account "${rec.name}" is restricted to other agents, not the triage agent.` };
|
|
95
|
+
}
|
|
96
|
+
if (!canRead(account))
|
|
97
|
+
return { error: `Email account "${rec.name}" has no IMAP host to read from.` };
|
|
98
|
+
if (!canSend(account))
|
|
99
|
+
return { error: `Email account "${rec.name}" has no SMTP host to send the report through.` };
|
|
100
|
+
if (!account.from)
|
|
101
|
+
return { error: `Email account "${rec.name}" has no From address.` };
|
|
102
|
+
return { account };
|
|
103
|
+
}
|
|
104
|
+
const errText = (e) => (e instanceof Error ? e.message : String(e));
|
|
105
|
+
const toChat = (m) => ({
|
|
106
|
+
id: m.id,
|
|
107
|
+
role: m.role,
|
|
108
|
+
content: m.content,
|
|
109
|
+
parts: m.parts,
|
|
110
|
+
toolCallId: m.toolCallId,
|
|
111
|
+
createdAt: m.createdAt,
|
|
112
|
+
});
|
|
113
|
+
const assistantNote = (content) => ({
|
|
114
|
+
id: randomUUID(),
|
|
115
|
+
role: 'assistant',
|
|
116
|
+
content,
|
|
117
|
+
createdAt: new Date().toISOString(),
|
|
118
|
+
});
|
|
119
|
+
export async function executeTriageRun(service, deps) {
|
|
120
|
+
if (runningTasks.has(service.id)) {
|
|
121
|
+
console.log(`[scheduler] Triage "${service.name}" is already running — skipping.`);
|
|
122
|
+
return { kind: 'skipped' };
|
|
123
|
+
}
|
|
124
|
+
runningTasks.add(service.id);
|
|
125
|
+
const runId = `run_${randomUUID().slice(0, 8)}`;
|
|
126
|
+
const ctrl = new AbortController();
|
|
127
|
+
const timer = setTimeout(() => ctrl.abort(), CLAUDE_CODE_DEFAULT_RUN_SECONDS * 1000);
|
|
128
|
+
const messages = [];
|
|
129
|
+
const fail = async (error) => {
|
|
130
|
+
console.error(`[scheduler] Triage run ${runId} for "${service.name}" failed:`, error);
|
|
131
|
+
await deps.saveRun(service.id, {
|
|
132
|
+
runId,
|
|
133
|
+
timestamp: new Date().toISOString(),
|
|
134
|
+
status: 'failure',
|
|
135
|
+
error,
|
|
136
|
+
messages: [
|
|
137
|
+
...messages,
|
|
138
|
+
assistantNote(`⚠️ Triage run failed:\n\n\`\`\`\n${error}\n\`\`\``),
|
|
139
|
+
],
|
|
140
|
+
});
|
|
141
|
+
return { kind: 'failure', error };
|
|
142
|
+
};
|
|
143
|
+
try {
|
|
144
|
+
const { agents, config } = await deps.load();
|
|
145
|
+
const agent = agents.find((a) => a.id === service.agentId);
|
|
146
|
+
if (!agent)
|
|
147
|
+
return await fail(`Agent with ID "${service.agentId}" not found for "${service.name}"`);
|
|
148
|
+
const provider = config.providers.find((p) => p.name === agent.provider);
|
|
149
|
+
if (!provider)
|
|
150
|
+
return await fail(`Provider "${agent.provider}" not found for agent "${agent.name}"`);
|
|
151
|
+
const resolved = resolveTriageAccount(config.scheduler?.tasks ?? [], service, agent.id);
|
|
152
|
+
if ('error' in resolved)
|
|
153
|
+
return await fail(resolved.error);
|
|
154
|
+
const { account } = resolved;
|
|
155
|
+
const recipients = parseRecipients(service.triageRecipients);
|
|
156
|
+
if (recipients.length === 0)
|
|
157
|
+
return await fail(`Triage service "${service.name}" has no report recipients.`);
|
|
158
|
+
let listing;
|
|
159
|
+
try {
|
|
160
|
+
listing = await deps.listEnvelopes(account, service.triageMaxEmails == null ? MAX_FETCH : clampLimit(service.triageMaxEmails), ctrl.signal);
|
|
161
|
+
}
|
|
162
|
+
catch (e) {
|
|
163
|
+
return await fail(`Listing unread mail failed: ${errText(e)}`);
|
|
164
|
+
}
|
|
165
|
+
const { envelopes, refused, uidValidity, scanTruncated } = listing;
|
|
166
|
+
if (envelopes.length === 0) {
|
|
167
|
+
if (scanTruncated) {
|
|
168
|
+
return await fail(`The oldest ${MAX_SCAN} unread messages are all from senders outside the account's allowedSenders, so triage cannot see newer mail. Read, move or delete them (or widen the allowlist).`);
|
|
169
|
+
}
|
|
170
|
+
return { kind: 'skipped' };
|
|
171
|
+
}
|
|
172
|
+
const prompt = buildTriagePrompt({
|
|
173
|
+
accountName: account.name,
|
|
174
|
+
extra: service.prompt ?? '',
|
|
175
|
+
envelopes,
|
|
176
|
+
});
|
|
177
|
+
messages.push({
|
|
178
|
+
id: randomUUID(),
|
|
179
|
+
role: 'user',
|
|
180
|
+
content: prompt,
|
|
181
|
+
createdAt: new Date().toISOString(),
|
|
182
|
+
});
|
|
183
|
+
let result;
|
|
184
|
+
try {
|
|
185
|
+
result = await deps.runAgent({
|
|
186
|
+
agent,
|
|
187
|
+
provider,
|
|
188
|
+
prompt,
|
|
189
|
+
account,
|
|
190
|
+
workingDir: service.workingDir || agent.workingDir || process.cwd(),
|
|
191
|
+
signal: ctrl.signal,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
catch (e) {
|
|
195
|
+
return await fail(`Agent run failed: ${errText(e)}`);
|
|
196
|
+
}
|
|
197
|
+
messages.push(...result.messages.map(toChat));
|
|
198
|
+
const report = extractReport(result.messages, result.stop);
|
|
199
|
+
if (report === null) {
|
|
200
|
+
return await fail(result.stop !== 'done'
|
|
201
|
+
? `Agent run ended with stop reason "${result.stop}"; no report to send.`
|
|
202
|
+
: 'Agent did not produce a report starting with "## IMPORTANT".');
|
|
203
|
+
}
|
|
204
|
+
const included = envelopes.length;
|
|
205
|
+
try {
|
|
206
|
+
await deps.send(account, {
|
|
207
|
+
to: recipients,
|
|
208
|
+
subject: triageSubject(service.triageSubjectPrefix || DEFAULT_PREFIX, included, deps.now()),
|
|
209
|
+
body: report,
|
|
210
|
+
html: markdownToHtml(report),
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
catch (e) {
|
|
214
|
+
return await fail(`Sending the report failed: ${errText(e)}`);
|
|
215
|
+
}
|
|
216
|
+
// The report is out: from here on a problem is a warning, never a failure.
|
|
217
|
+
let marked = false;
|
|
218
|
+
let warning;
|
|
219
|
+
try {
|
|
220
|
+
const r = await deps.markSeen(account, envelopes.map((e) => e.uid), uidValidity);
|
|
221
|
+
if (r === 'marked')
|
|
222
|
+
marked = true;
|
|
223
|
+
else
|
|
224
|
+
warning = 'mailbox UIDVALIDITY changed since listing; messages left unread';
|
|
225
|
+
}
|
|
226
|
+
catch (e) {
|
|
227
|
+
warning = errText(e);
|
|
228
|
+
}
|
|
229
|
+
messages.push(assistantNote(`Triage: ${included} included, ${refused} refused by sender allowlist, ${marked ? 'marked read' : `not marked read: ${warning}`}${scanTruncated
|
|
230
|
+
? `. Warning: more than ${MAX_SCAN} unread messages; only the oldest ${MAX_SCAN} were scanned, newer mail waits for the next runs.`
|
|
231
|
+
: ''}`));
|
|
232
|
+
await deps.saveRun(service.id, {
|
|
233
|
+
runId,
|
|
234
|
+
timestamp: new Date().toISOString(),
|
|
235
|
+
status: 'success',
|
|
236
|
+
messages,
|
|
237
|
+
});
|
|
238
|
+
return { kind: 'success', included, refused, marked, ...(warning ? { warning } : {}) };
|
|
239
|
+
}
|
|
240
|
+
catch (e) {
|
|
241
|
+
return await fail(errText(e));
|
|
242
|
+
}
|
|
243
|
+
finally {
|
|
244
|
+
clearTimeout(timer);
|
|
245
|
+
runningTasks.delete(service.id);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Tool } from '../../../harness/tools/types.js';
|
|
2
|
+
import type { ToolRegistry } from '../../../harness/tools/registry.js';
|
|
3
|
+
import type { MessageRecord } from '../../../session/types.js';
|
|
4
|
+
import type { AgentConfig } from '../../../types.js';
|
|
5
|
+
import { type TriageAgentInput, type TriageDeps } from './email_triage.js';
|
|
6
|
+
import type { SchedulerStrategy } from './strategy.js';
|
|
7
|
+
/** The agent's own tools plus email_read, which the triage prompt relies on.
|
|
8
|
+
* Nothing is removed: the agent keeps whatever the user gave it. */
|
|
9
|
+
export declare function triageTools(agent: AgentConfig, registry: ToolRegistry): Promise<Tool[]>;
|
|
10
|
+
export declare function runTriageAgent(i: TriageAgentInput): Promise<{
|
|
11
|
+
messages: MessageRecord[];
|
|
12
|
+
stop: 'done' | 'max_turns' | 'aborted';
|
|
13
|
+
}>;
|
|
14
|
+
export declare const realTriageDeps: TriageDeps;
|
|
15
|
+
export declare const EmailTriageStrategy: SchedulerStrategy;
|
|
16
|
+
//# sourceMappingURL=email_triage_agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email_triage_agent.d.ts","sourceRoot":"","sources":["../../../../src/cli/web/scheduler/email_triage_agent.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAoB,KAAK,gBAAgB,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG7F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIvD;qEACqE;AACrE,wBAAsB,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAK7F;AAED,wBAAsB,cAAc,CAClC,CAAC,EAAE,gBAAgB,GAClB,OAAO,CAAC;IAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAA;CAAE,CAAC,CA2ChF;AAED,eAAO,MAAM,cAAc,EAAE,UAW5B,CAAC;AAIF,eAAO,MAAM,mBAAmB,EAAE,iBAWjC,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// Harness-facing half of the email triage service: the agent runner, the real
|
|
2
|
+
// TriageDeps and the scheduler strategy. Kept apart from email_triage.ts so
|
|
3
|
+
// the orchestrator stays testable with plain fakes.
|
|
4
|
+
import * as harness from '../../../harness/index.js';
|
|
5
|
+
import { claudeCodeTaskExtras } from '../../../harness/claude_code_runner.js';
|
|
6
|
+
import { acpTaskExtras } from '../../../harness/acp_policy.js';
|
|
7
|
+
import { listUnseenEnvelopes, markSeen, sendEmail } from '../../../lib/email.js';
|
|
8
|
+
import { loadAgents, loadConfig } from '../../../store/json.js';
|
|
9
|
+
import { getTaskBridgeUrl, issueBridgeToken, revokeBridgeToken } from '../mcp_bridge.js';
|
|
10
|
+
import { executeTriageRun } from './email_triage.js';
|
|
11
|
+
import { matchesCron } from './heartbeat.js';
|
|
12
|
+
import { saveTaskRun } from './logs.js';
|
|
13
|
+
const EMAIL_READ = 'mcp__email__email_read';
|
|
14
|
+
/** The agent's own tools plus email_read, which the triage prompt relies on.
|
|
15
|
+
* Nothing is removed: the agent keeps whatever the user gave it. */
|
|
16
|
+
export async function triageTools(agent, registry) {
|
|
17
|
+
const tools = await harness.resolveAgentTools(agent, registry);
|
|
18
|
+
const read = registry.get(EMAIL_READ);
|
|
19
|
+
if (read && !tools.some((t) => t.name === EMAIL_READ))
|
|
20
|
+
tools.push(read);
|
|
21
|
+
return tools;
|
|
22
|
+
}
|
|
23
|
+
export async function runTriageAgent(i) {
|
|
24
|
+
const tools = await triageTools(i.agent, harness.tools);
|
|
25
|
+
const messages = [];
|
|
26
|
+
let bridgeToken;
|
|
27
|
+
let claudeCode;
|
|
28
|
+
let acp;
|
|
29
|
+
const isClaudeCode = i.provider.type === 'claude-code';
|
|
30
|
+
const isAcp = i.provider.type === 'acp';
|
|
31
|
+
if (isClaudeCode || isAcp) {
|
|
32
|
+
const bridgeUrl = getTaskBridgeUrl();
|
|
33
|
+
// Only email_read is served: the bridge exposes no task state or send tool.
|
|
34
|
+
bridgeToken = bridgeUrl ? issueBridgeToken(i.agent.id, { only: [EMAIL_READ] }) : undefined;
|
|
35
|
+
const bridge = bridgeUrl && bridgeToken ? { url: bridgeUrl, token: bridgeToken } : undefined;
|
|
36
|
+
if (!bridge)
|
|
37
|
+
console.warn('[email-triage] external agent without bridge URL — email_read unavailable this run');
|
|
38
|
+
if (isClaudeCode)
|
|
39
|
+
claudeCode = claudeCodeTaskExtras({ planning: false, sdd: false, bridge });
|
|
40
|
+
else
|
|
41
|
+
acp = acpTaskExtras({ planning: false, sdd: false, bridge });
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
const result = await harness.run({
|
|
45
|
+
agent: { ...i.agent, permissionMode: 'bypassPermissions' },
|
|
46
|
+
provider: i.provider,
|
|
47
|
+
tools,
|
|
48
|
+
prompt: i.prompt,
|
|
49
|
+
history: [],
|
|
50
|
+
workingDir: i.workingDir,
|
|
51
|
+
claudeCode,
|
|
52
|
+
acp,
|
|
53
|
+
signal: i.signal,
|
|
54
|
+
}, {
|
|
55
|
+
onMessage: async (msg) => {
|
|
56
|
+
messages.push(msg);
|
|
57
|
+
},
|
|
58
|
+
confirmTool: async () => 'once', // unattended
|
|
59
|
+
});
|
|
60
|
+
return { messages, stop: result.stop };
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
if (bridgeToken)
|
|
64
|
+
revokeBridgeToken(bridgeToken);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export const realTriageDeps = {
|
|
68
|
+
load: async () => {
|
|
69
|
+
const [agents, config] = await Promise.all([loadAgents(), loadConfig()]);
|
|
70
|
+
return { agents, config };
|
|
71
|
+
},
|
|
72
|
+
listEnvelopes: listUnseenEnvelopes,
|
|
73
|
+
runAgent: runTriageAgent,
|
|
74
|
+
send: sendEmail,
|
|
75
|
+
markSeen,
|
|
76
|
+
saveRun: saveTaskRun,
|
|
77
|
+
now: () => new Date(),
|
|
78
|
+
};
|
|
79
|
+
const lastCheckedMinutes = new Map();
|
|
80
|
+
export const EmailTriageStrategy = {
|
|
81
|
+
type: 'email_triage',
|
|
82
|
+
async tick(service, now) {
|
|
83
|
+
const minute = `${now.getFullYear()}-${now.getMonth()}-${now.getDate()} ${now.getHours()}:${now.getMinutes()}`;
|
|
84
|
+
if (lastCheckedMinutes.get(service.id) === minute)
|
|
85
|
+
return;
|
|
86
|
+
if (!matchesCron(service.cron, now))
|
|
87
|
+
return;
|
|
88
|
+
lastCheckedMinutes.set(service.id, minute);
|
|
89
|
+
void executeTriageRun(service, realTriageDeps).catch((err) => {
|
|
90
|
+
console.error('[scheduler] Email triage run failed to execute:', err);
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../../src/cli/web/scheduler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../../src/cli/web/scheduler.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,EACZ,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAQpD;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CA4BtD;AAKD;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,CAQ/C;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAM9C"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { loadConfig } from '../../store/json.js';
|
|
2
2
|
import { HeartbeatStrategy } from './scheduler/heartbeat.js';
|
|
3
3
|
import { TelegramStrategy } from './scheduler/telegram.js';
|
|
4
|
+
import { EmailTriageStrategy } from './scheduler/email_triage_agent.js';
|
|
4
5
|
import { runTaskHeartbeatTick } from './scheduler/task_strategy.js';
|
|
5
6
|
import { runMemorySweepTick } from './scheduler/memory_sweep.js';
|
|
6
7
|
// Re-exported for backwards compatibility with existing consumers (server.ts, tests).
|
|
@@ -9,6 +10,7 @@ export { runningTasks } from './scheduler/locks.js';
|
|
|
9
10
|
const strategies = new Map([
|
|
10
11
|
[HeartbeatStrategy.type, HeartbeatStrategy],
|
|
11
12
|
[TelegramStrategy.type, TelegramStrategy],
|
|
13
|
+
[EmailTriageStrategy.type, EmailTriageStrategy],
|
|
12
14
|
]);
|
|
13
15
|
/**
|
|
14
16
|
* Evaluates all scheduled tasks and triggers execution loops for matching ones.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email_tools.d.ts","sourceRoot":"","sources":["../../../../src/harness/tools/builtin/email_tools.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"email_tools.d.ts","sourceRoot":"","sources":["../../../../src/harness/tools/builtin/email_tools.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,aAAa,CAAC;AAoCpD,eAAO,MAAM,qBAAqB,EAAE,IAqBnC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,IAiE5B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,IAyC3B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,IAwG3B,CAAC"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// ctx.callerAgent — a scoped account is invisible, not refused);
|
|
10
10
|
// - who an account may send to (`allowedRecipients`, checked before connecting);
|
|
11
11
|
// - whose mail it may read (`allowedSenders`, checked on the envelope pass).
|
|
12
|
-
import { listEmailAccounts, findAccount, matchesAllowlist, bareAddress, sendEmail, fetchInbox, canSend, canRead, clampLimit, markdownToHtml, MAX_FETCH, } from '../../../lib/email.js';
|
|
12
|
+
import { listEmailAccounts, findAccount, matchesAllowlist, bareAddress, sendEmail, fetchInbox, readMessage, canSend, canRead, clampLimit, markdownToHtml, MAX_FETCH, } from '../../../lib/email.js';
|
|
13
13
|
function err(msg) {
|
|
14
14
|
return { content: JSON.stringify({ error: msg }) };
|
|
15
15
|
}
|
|
@@ -112,6 +112,46 @@ export const emailFetchTool = {
|
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
114
|
};
|
|
115
|
+
export const emailReadTool = {
|
|
116
|
+
name: 'mcp__email__email_read',
|
|
117
|
+
description: 'Read one message from an account inbox by its UID, without marking it read. Returns the plain-text body (possibly truncated) and attachment names. A message from a sender outside the account allowlist, or an unknown UID, is reported as "No message".',
|
|
118
|
+
parameters: {
|
|
119
|
+
type: 'object',
|
|
120
|
+
properties: {
|
|
121
|
+
account: { type: 'string', description: 'Account name from email_list_accounts.' },
|
|
122
|
+
uid: { type: 'number', description: 'IMAP UID of the message, as returned by email_fetch.' },
|
|
123
|
+
},
|
|
124
|
+
required: ['account', 'uid'],
|
|
125
|
+
},
|
|
126
|
+
execute: async (args, ctx) => {
|
|
127
|
+
const name = typeof args?.account === 'string' ? args.account : '';
|
|
128
|
+
if (!name.trim())
|
|
129
|
+
return err('account must be a non-empty string');
|
|
130
|
+
const uid = args?.uid;
|
|
131
|
+
if (typeof uid !== 'number' || !Number.isInteger(uid) || uid < 1)
|
|
132
|
+
return err('uid must be a positive integer');
|
|
133
|
+
const accounts = await listEmailAccounts(ctx.callerAgent?.id);
|
|
134
|
+
const account = findAccount(accounts, name);
|
|
135
|
+
if (!account) {
|
|
136
|
+
const available = accounts.filter(canRead).map((a) => a.name);
|
|
137
|
+
return err(available.length
|
|
138
|
+
? `Unknown email account "${name}". Readable accounts: ${available.join(', ')}`
|
|
139
|
+
: `Unknown email account "${name}". No account is configured for reading — an email service needs an IMAP host and must be enabled.`);
|
|
140
|
+
}
|
|
141
|
+
if (!canRead(account)) {
|
|
142
|
+
return err(`Account "${account.name}" has no IMAP host, so it cannot be read.`);
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
const message = await readMessage(account, uid, ctx.signal);
|
|
146
|
+
if (!message)
|
|
147
|
+
return err(`No message with uid ${uid} in "${account.name}".`);
|
|
148
|
+
return { content: JSON.stringify({ account: account.name, message }) };
|
|
149
|
+
}
|
|
150
|
+
catch (e) {
|
|
151
|
+
return err(`IMAP read failed: ${e?.message ?? String(e)}`);
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
};
|
|
115
155
|
export const emailSendTool = {
|
|
116
156
|
name: 'mcp__email__email_send',
|
|
117
157
|
description: 'Send an email through one of the configured accounts. Pick the account by its name from email_list_accounts. `body` is the plain-text version and is always required; for a formatted message write `body` in markdown and set `markdown: true` (converted for you, so you write the content once), or pass your own `html`. No attachments. Recipients outside the account allowlist are refused and nothing is sent.',
|
|
@@ -17,9 +17,9 @@ import { invokeAgentTool } from './invoke_agent.js';
|
|
|
17
17
|
import { listCommandsTool } from './list_commands.js';
|
|
18
18
|
import { invokeCommandTool } from './invoke_command.js';
|
|
19
19
|
import { getAgentContextTool } from './get_agent_context.js';
|
|
20
|
-
import { emailListAccountsTool, emailSendTool, emailFetchTool } from './email_tools.js';
|
|
20
|
+
import { emailListAccountsTool, emailSendTool, emailFetchTool, emailReadTool } from './email_tools.js';
|
|
21
21
|
import { memoryReadTool } from './memory_tools.js';
|
|
22
22
|
import { getTaskStateTool, updateChecklistItemTool, updateChecklistTool, addMessageTool, completeTaskTool, blockTaskTool, yieldTaskTool, projectListTool, taskCreateTool, taskSearchTool, taskUnblockTool, taskActivateTool, taskUnpauseTool, taskDiscardWorktreeTool, taskArchiveTool, taskUnarchiveTool, taskDeleteTool, taskSetAgentTool, submitPlanTool, taskUpdateDetailsTool } from './task_tools.js';
|
|
23
23
|
export declare function registerBuiltins(registry: ToolRegistry): void;
|
|
24
|
-
export { readFileTool, readDocumentTool, readImageTool, readAttachmentTool, writeTool, editTool, multieditTool, globTool, grepTool, fetchTool, bashTool, listSkillsTool, readSkillTool, listAgentsTool, invokeAgentTool, listCommandsTool, invokeCommandTool, getAgentContextTool, getTaskStateTool, updateChecklistItemTool, updateChecklistTool, addMessageTool, completeTaskTool, blockTaskTool, yieldTaskTool, projectListTool, taskCreateTool, taskSearchTool, taskUnblockTool, taskActivateTool, taskUnpauseTool, taskDiscardWorktreeTool, taskArchiveTool, taskUnarchiveTool, taskDeleteTool, taskSetAgentTool, submitPlanTool, taskUpdateDetailsTool, emailListAccountsTool, emailSendTool, emailFetchTool, memoryReadTool, };
|
|
24
|
+
export { readFileTool, readDocumentTool, readImageTool, readAttachmentTool, writeTool, editTool, multieditTool, globTool, grepTool, fetchTool, bashTool, listSkillsTool, readSkillTool, listAgentsTool, invokeAgentTool, listCommandsTool, invokeCommandTool, getAgentContextTool, getTaskStateTool, updateChecklistItemTool, updateChecklistTool, addMessageTool, completeTaskTool, blockTaskTool, yieldTaskTool, projectListTool, taskCreateTool, taskSearchTool, taskUnblockTool, taskActivateTool, taskUnpauseTool, taskDiscardWorktreeTool, taskArchiveTool, taskUnarchiveTool, taskDeleteTool, taskSetAgentTool, submitPlanTool, taskUpdateDetailsTool, emailListAccountsTool, emailSendTool, emailFetchTool, emailReadTool, memoryReadTool, };
|
|
25
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/harness/tools/builtin/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAA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E,YAAY,GAAG,IAAI,CAmE7D;AAED,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,SAAS,EACT,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,cAAc,EACd,aAAa,EACb,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACd,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,aAAa,EACb,cAAc,GACf,CAAC"}
|
|
@@ -22,7 +22,7 @@ import { setWorkspaceTool } from './set_workspace.js';
|
|
|
22
22
|
import { listCommandsTool } from './list_commands.js';
|
|
23
23
|
import { invokeCommandTool } from './invoke_command.js';
|
|
24
24
|
import { getAgentContextTool } from './get_agent_context.js';
|
|
25
|
-
import { emailListAccountsTool, emailSendTool, emailFetchTool } from './email_tools.js';
|
|
25
|
+
import { emailListAccountsTool, emailSendTool, emailFetchTool, emailReadTool } from './email_tools.js';
|
|
26
26
|
import { memoryReadTool } from './memory_tools.js';
|
|
27
27
|
import { getTaskStateTool, updateChecklistItemTool, updateChecklistTool, addMessageTool, completeTaskTool, blockTaskTool, yieldTaskTool, projectListTool, taskCreateTool, taskSearchTool, taskUnblockTool, taskActivateTool, taskUnpauseTool, taskDiscardWorktreeTool, taskArchiveTool, taskUnarchiveTool, taskDeleteTool, taskSetAgentTool, submitPlanTool, taskUpdateDetailsTool, } from './task_tools.js';
|
|
28
28
|
export function registerBuiltins(registry) {
|
|
@@ -86,7 +86,8 @@ export function registerBuiltins(registry) {
|
|
|
86
86
|
registry.register(emailListAccountsTool);
|
|
87
87
|
registry.register(emailSendTool);
|
|
88
88
|
registry.register(emailFetchTool);
|
|
89
|
+
registry.register(emailReadTool);
|
|
89
90
|
// Memory subsystem read path (recall accounting lives in the tool).
|
|
90
91
|
registry.register(memoryReadTool);
|
|
91
92
|
}
|
|
92
|
-
export { readFileTool, readDocumentTool, readImageTool, readAttachmentTool, writeTool, editTool, multieditTool, globTool, grepTool, fetchTool, bashTool, listSkillsTool, readSkillTool, listAgentsTool, invokeAgentTool, listCommandsTool, invokeCommandTool, getAgentContextTool, getTaskStateTool, updateChecklistItemTool, updateChecklistTool, addMessageTool, completeTaskTool, blockTaskTool, yieldTaskTool, projectListTool, taskCreateTool, taskSearchTool, taskUnblockTool, taskActivateTool, taskUnpauseTool, taskDiscardWorktreeTool, taskArchiveTool, taskUnarchiveTool, taskDeleteTool, taskSetAgentTool, submitPlanTool, taskUpdateDetailsTool, emailListAccountsTool, emailSendTool, emailFetchTool, memoryReadTool, };
|
|
93
|
+
export { readFileTool, readDocumentTool, readImageTool, readAttachmentTool, writeTool, editTool, multieditTool, globTool, grepTool, fetchTool, bashTool, listSkillsTool, readSkillTool, listAgentsTool, invokeAgentTool, listCommandsTool, invokeCommandTool, getAgentContextTool, getTaskStateTool, updateChecklistItemTool, updateChecklistTool, addMessageTool, completeTaskTool, blockTaskTool, yieldTaskTool, projectListTool, taskCreateTool, taskSearchTool, taskUnblockTool, taskActivateTool, taskUnpauseTool, taskDiscardWorktreeTool, taskArchiveTool, taskUnarchiveTool, taskDeleteTool, taskSetAgentTool, submitPlanTool, taskUpdateDetailsTool, emailListAccountsTool, emailSendTool, emailFetchTool, emailReadTool, memoryReadTool, };
|