@agenticmail/enterprise 0.5.252 → 0.5.254
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-heartbeat-RFXB2ADO.js +510 -0
- package/dist/agent-tools-3YCGMXCE.js +13871 -0
- package/dist/chunk-4IUA4QZE.js +4488 -0
- package/dist/chunk-BIPFPIDH.js +468 -0
- package/dist/chunk-J6QPL5WN.js +1224 -0
- package/dist/chunk-WXXG3LYY.js +3778 -0
- package/dist/cli-agent-3KZRZBZG.js +1768 -0
- package/dist/cli-serve-44IKCXDO.js +114 -0
- package/dist/cli.js +3 -3
- package/dist/dashboard/pages/task-pipeline.js +89 -18
- package/dist/index.js +17 -17
- package/dist/routes-GKC2Q6WI.js +13510 -0
- package/dist/runtime-NTCIQSJM.js +45 -0
- package/dist/server-Q4KBC33A.js +15 -0
- package/dist/setup-3XCPXDZE.js +20 -0
- package/dist/task-queue-QNWKF4GG.js +7 -0
- package/package.json +1 -1
- package/src/cli-agent.ts +39 -2
- package/src/dashboard/pages/task-pipeline.js +89 -18
- package/src/runtime/hooks.ts +22 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentRuntime,
|
|
3
|
+
EmailChannel,
|
|
4
|
+
FollowUpScheduler,
|
|
5
|
+
SessionManager,
|
|
6
|
+
SubAgentManager,
|
|
7
|
+
ToolRegistry,
|
|
8
|
+
callLLM,
|
|
9
|
+
createAgentRuntime,
|
|
10
|
+
createNoopHooks,
|
|
11
|
+
createRuntimeHooks,
|
|
12
|
+
estimateMessageTokens,
|
|
13
|
+
estimateTokens,
|
|
14
|
+
executeTool,
|
|
15
|
+
runAgentLoop,
|
|
16
|
+
toolsToDefinitions
|
|
17
|
+
} from "./chunk-4IUA4QZE.js";
|
|
18
|
+
import {
|
|
19
|
+
PROVIDER_REGISTRY,
|
|
20
|
+
listAllProviders,
|
|
21
|
+
resolveApiKeyForProvider,
|
|
22
|
+
resolveProvider
|
|
23
|
+
} from "./chunk-UF3ZJMJO.js";
|
|
24
|
+
import "./chunk-KFQGP6VL.js";
|
|
25
|
+
export {
|
|
26
|
+
AgentRuntime,
|
|
27
|
+
EmailChannel,
|
|
28
|
+
FollowUpScheduler,
|
|
29
|
+
PROVIDER_REGISTRY,
|
|
30
|
+
SessionManager,
|
|
31
|
+
SubAgentManager,
|
|
32
|
+
ToolRegistry,
|
|
33
|
+
callLLM,
|
|
34
|
+
createAgentRuntime,
|
|
35
|
+
createNoopHooks,
|
|
36
|
+
createRuntimeHooks,
|
|
37
|
+
estimateMessageTokens,
|
|
38
|
+
estimateTokens,
|
|
39
|
+
executeTool,
|
|
40
|
+
listAllProviders,
|
|
41
|
+
resolveApiKeyForProvider,
|
|
42
|
+
resolveProvider,
|
|
43
|
+
runAgentLoop,
|
|
44
|
+
toolsToDefinitions
|
|
45
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createServer
|
|
3
|
+
} from "./chunk-WXXG3LYY.js";
|
|
4
|
+
import "./chunk-OF4MUWWS.js";
|
|
5
|
+
import "./chunk-UF3ZJMJO.js";
|
|
6
|
+
import "./chunk-3OC6RH7W.js";
|
|
7
|
+
import "./chunk-2DDKGTD6.js";
|
|
8
|
+
import "./chunk-YVK6F5OD.js";
|
|
9
|
+
import "./chunk-MKRNEM5A.js";
|
|
10
|
+
import "./chunk-DRXMYYKN.js";
|
|
11
|
+
import "./chunk-6WSX7QXF.js";
|
|
12
|
+
import "./chunk-KFQGP6VL.js";
|
|
13
|
+
export {
|
|
14
|
+
createServer
|
|
15
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
promptCompanyInfo,
|
|
3
|
+
promptDatabase,
|
|
4
|
+
promptDeployment,
|
|
5
|
+
promptDomain,
|
|
6
|
+
promptRegistration,
|
|
7
|
+
provision,
|
|
8
|
+
runSetupWizard
|
|
9
|
+
} from "./chunk-J6QPL5WN.js";
|
|
10
|
+
import "./chunk-ULRBF2T7.js";
|
|
11
|
+
import "./chunk-KFQGP6VL.js";
|
|
12
|
+
export {
|
|
13
|
+
promptCompanyInfo,
|
|
14
|
+
promptDatabase,
|
|
15
|
+
promptDeployment,
|
|
16
|
+
promptDomain,
|
|
17
|
+
promptRegistration,
|
|
18
|
+
provision,
|
|
19
|
+
runSetupWizard
|
|
20
|
+
};
|
package/package.json
CHANGED
package/src/cli-agent.ts
CHANGED
|
@@ -675,6 +675,23 @@ export async function runAgent(_args: string[]) {
|
|
|
675
675
|
const identity = agent.config?.identity || {};
|
|
676
676
|
|
|
677
677
|
const { buildTaskPrompt, buildScheduleInfo } = await import('./system-prompts/index.js');
|
|
678
|
+
|
|
679
|
+
// Record task in pipeline BEFORE spawning
|
|
680
|
+
let pipelineTaskId: string | undefined;
|
|
681
|
+
try {
|
|
682
|
+
pipelineTaskId = await beforeSpawn(taskQueue, {
|
|
683
|
+
orgId: agent.org_id || '',
|
|
684
|
+
agentId: agentId,
|
|
685
|
+
agentName: agentName,
|
|
686
|
+
createdBy: 'api',
|
|
687
|
+
createdByName: 'API Task',
|
|
688
|
+
task: body.task,
|
|
689
|
+
model: (config.model ? `${config.model.provider}/${config.model.modelId}` : undefined) || process.env.AGENTICMAIL_MODEL,
|
|
690
|
+
sessionId: undefined,
|
|
691
|
+
source: 'api',
|
|
692
|
+
});
|
|
693
|
+
} catch (e: any) { /* non-fatal */ }
|
|
694
|
+
|
|
678
695
|
const session = await runtime.spawnSession({
|
|
679
696
|
agentId: agentId,
|
|
680
697
|
message: body.task,
|
|
@@ -686,8 +703,28 @@ export async function runAgent(_args: string[]) {
|
|
|
686
703
|
}),
|
|
687
704
|
});
|
|
688
705
|
|
|
689
|
-
|
|
690
|
-
|
|
706
|
+
// Mark task as in progress
|
|
707
|
+
if (pipelineTaskId) {
|
|
708
|
+
markInProgress(taskQueue, pipelineTaskId, { sessionId: session.id }).catch(() => {});
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
// Record task completion when session finishes
|
|
712
|
+
if (pipelineTaskId) {
|
|
713
|
+
runtime.onSessionComplete(session.id, async (result: any) => {
|
|
714
|
+
const usage = result?.usage || {};
|
|
715
|
+
afterSpawn(taskQueue, {
|
|
716
|
+
taskId: pipelineTaskId!,
|
|
717
|
+
status: result?.error ? 'failed' : 'completed',
|
|
718
|
+
error: result?.error?.message || result?.error,
|
|
719
|
+
modelUsed: result?.model || config.model,
|
|
720
|
+
tokensUsed: (usage.inputTokens || 0) + (usage.outputTokens || 0),
|
|
721
|
+
costUsd: usage.costUsd || usage.cost || 0,
|
|
722
|
+
}).catch(() => {});
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
console.log(`[task] Session ${session.id} created for task: "${body.task.slice(0, 80)}"${pipelineTaskId ? ` (pipeline: ${pipelineTaskId.slice(0, 8)})` : ''}`);
|
|
727
|
+
return c.json({ ok: true, sessionId: session.id, taskId: body.taskId || pipelineTaskId });
|
|
691
728
|
} catch (err: any) {
|
|
692
729
|
console.error(`[task] Error: ${err.message}`);
|
|
693
730
|
return c.json({ error: err.message }, 500);
|
|
@@ -208,6 +208,88 @@ function CustomerBadge(props) {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
// ─── Task Detail Modal ───────────────────────────────────
|
|
211
|
+
// ─── Activity Log Component ──────────────────────────────
|
|
212
|
+
var ACTIVITY_PAGE_SIZE = 10;
|
|
213
|
+
var ACTIVITY_TYPE_COLORS = {
|
|
214
|
+
created: '#6366f1', assigned: '#f59e0b', started: '#06b6d4', in_progress: '#06b6d4',
|
|
215
|
+
completed: '#15803d', failed: '#ef4444', cancelled: '#6b7394', delegated: '#a855f7',
|
|
216
|
+
compaction: '#8b5cf6', error: '#ef4444',
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
function ActivityLog(props) {
|
|
220
|
+
var entries = props.entries || [];
|
|
221
|
+
var _search = useState(''); var search = _search[0]; var setSearch = _search[1];
|
|
222
|
+
var _typeFilter = useState('all'); var typeFilter = _typeFilter[0]; var setTypeFilter = _typeFilter[1];
|
|
223
|
+
var _page = useState(0); var page = _page[0]; var setPage = _page[1];
|
|
224
|
+
|
|
225
|
+
// Get unique types for filter dropdown
|
|
226
|
+
var types = [];
|
|
227
|
+
var seen = {};
|
|
228
|
+
entries.forEach(function(e) { if (e.type && !seen[e.type]) { seen[e.type] = true; types.push(e.type); } });
|
|
229
|
+
|
|
230
|
+
// Filter
|
|
231
|
+
var filtered = entries.filter(function(e) {
|
|
232
|
+
if (typeFilter !== 'all' && e.type !== typeFilter) return false;
|
|
233
|
+
if (search) {
|
|
234
|
+
var q = search.toLowerCase();
|
|
235
|
+
return (e.type || '').toLowerCase().includes(q) || (e.detail || '').toLowerCase().includes(q) || (e.agent || '').toLowerCase().includes(q);
|
|
236
|
+
}
|
|
237
|
+
return true;
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
var totalPages = Math.max(1, Math.ceil(filtered.length / ACTIVITY_PAGE_SIZE));
|
|
241
|
+
if (page >= totalPages) page = totalPages - 1;
|
|
242
|
+
var pageEntries = filtered.slice(page * ACTIVITY_PAGE_SIZE, (page + 1) * ACTIVITY_PAGE_SIZE);
|
|
243
|
+
|
|
244
|
+
return h('div', { style: { marginBottom: 16 } },
|
|
245
|
+
h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 8, gap: 8, flexWrap: 'wrap' } },
|
|
246
|
+
h('div', { style: { fontSize: 12, fontWeight: 600, color: 'var(--text-muted)' } }, 'ACTIVITY LOG (' + filtered.length + ')'),
|
|
247
|
+
h('div', { style: { display: 'flex', gap: 6, alignItems: 'center' } },
|
|
248
|
+
h('input', {
|
|
249
|
+
placeholder: 'Search...', value: search,
|
|
250
|
+
onChange: function(e) { setSearch(e.target.value); setPage(0); },
|
|
251
|
+
style: { padding: '3px 8px', fontSize: 11, borderRadius: 6, border: '1px solid var(--border)', background: 'var(--bg-secondary)', color: 'var(--text-primary)', width: 120, outline: 'none' }
|
|
252
|
+
}),
|
|
253
|
+
h('select', {
|
|
254
|
+
value: typeFilter,
|
|
255
|
+
onChange: function(e) { setTypeFilter(e.target.value); setPage(0); },
|
|
256
|
+
style: { padding: '3px 8px', fontSize: 11, borderRadius: 6, border: '1px solid var(--border)', background: 'var(--bg-secondary)', color: 'var(--text-primary)', outline: 'none' }
|
|
257
|
+
},
|
|
258
|
+
h('option', { value: 'all' }, 'All types'),
|
|
259
|
+
types.map(function(t) { return h('option', { key: t, value: t }, t); })
|
|
260
|
+
)
|
|
261
|
+
)
|
|
262
|
+
),
|
|
263
|
+
h('div', { style: { border: '1px solid var(--border)', borderRadius: 'var(--radius)', overflow: 'hidden' } },
|
|
264
|
+
pageEntries.map(function(entry, i) {
|
|
265
|
+
var tc = ACTIVITY_TYPE_COLORS[entry.type] || 'var(--text-muted)';
|
|
266
|
+
return h('div', { key: page * ACTIVITY_PAGE_SIZE + i, style: { display: 'flex', gap: 8, padding: '6px 10px', borderBottom: i < pageEntries.length - 1 ? '1px solid var(--border)' : 'none', fontSize: 11, alignItems: 'flex-start' } },
|
|
267
|
+
h('span', { style: { color: 'var(--text-muted)', flexShrink: 0, fontFamily: 'var(--font-mono)', fontSize: 10, minWidth: 65 } }, entry.ts ? new Date(entry.ts).toLocaleTimeString() : ''),
|
|
268
|
+
h('span', { style: { fontWeight: 600, flexShrink: 0, minWidth: 70, color: tc, padding: '0 4px', borderRadius: 4, background: tc + '15' } }, entry.type),
|
|
269
|
+
h('span', { style: { color: 'var(--text-secondary)', wordBreak: 'break-word' } }, entry.detail)
|
|
270
|
+
);
|
|
271
|
+
}),
|
|
272
|
+
pageEntries.length === 0 && h('div', { style: { padding: '12px 10px', fontSize: 11, color: 'var(--text-muted)', textAlign: 'center' } }, 'No matching entries')
|
|
273
|
+
),
|
|
274
|
+
// Pagination
|
|
275
|
+
totalPages > 1 && h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginTop: 6, fontSize: 11 } },
|
|
276
|
+
h('span', { style: { color: 'var(--text-muted)' } }, 'Page ' + (page + 1) + ' of ' + totalPages),
|
|
277
|
+
h('div', { style: { display: 'flex', gap: 4 } },
|
|
278
|
+
h('button', {
|
|
279
|
+
disabled: page === 0,
|
|
280
|
+
onClick: function() { setPage(page - 1); },
|
|
281
|
+
style: { padding: '2px 8px', fontSize: 11, borderRadius: 4, border: '1px solid var(--border)', background: 'var(--bg-secondary)', color: page === 0 ? 'var(--text-muted)' : 'var(--text-primary)', cursor: page === 0 ? 'default' : 'pointer' }
|
|
282
|
+
}, 'Prev'),
|
|
283
|
+
h('button', {
|
|
284
|
+
disabled: page >= totalPages - 1,
|
|
285
|
+
onClick: function() { setPage(page + 1); },
|
|
286
|
+
style: { padding: '2px 8px', fontSize: 11, borderRadius: 4, border: '1px solid var(--border)', background: 'var(--bg-secondary)', color: page >= totalPages - 1 ? 'var(--text-muted)' : 'var(--text-primary)', cursor: page >= totalPages - 1 ? 'default' : 'pointer' }
|
|
287
|
+
}, 'Next')
|
|
288
|
+
)
|
|
289
|
+
)
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
|
|
211
293
|
function TaskDetail(props) {
|
|
212
294
|
var task = props.task;
|
|
213
295
|
var chain = props.chain;
|
|
@@ -279,9 +361,9 @@ function TaskDetail(props) {
|
|
|
279
361
|
),
|
|
280
362
|
h('div', { style: {
|
|
281
363
|
padding: '6px 10px', borderRadius: 8, fontSize: 11, flexShrink: 0,
|
|
282
|
-
background: isMe ? sc + '22' : '
|
|
283
|
-
border: '1px solid ' + (isMe ? sc : '
|
|
284
|
-
fontWeight: isMe ? 700 : 400, color: isMe ? sc : '
|
|
364
|
+
background: isMe ? sc + '22' : 'var(--tp-card)',
|
|
365
|
+
border: '1px solid ' + (isMe ? sc : 'var(--tp-border)'),
|
|
366
|
+
fontWeight: isMe ? 700 : 400, color: isMe ? sc : 'var(--tp-text-dim)',
|
|
285
367
|
} },
|
|
286
368
|
h('div', { style: { fontWeight: 600 } }, ct.assignedToName || ct.assignedTo),
|
|
287
369
|
h('div', { style: { fontSize: 9, marginTop: 2, opacity: 0.6 } }, ct.status.replace('_', ' '))
|
|
@@ -291,19 +373,8 @@ function TaskDetail(props) {
|
|
|
291
373
|
)
|
|
292
374
|
),
|
|
293
375
|
|
|
294
|
-
// Activity log
|
|
295
|
-
task.activityLog && task.activityLog.length > 0 && h(
|
|
296
|
-
h('div', { style: { fontSize: 12, fontWeight: 600, color: 'var(--text-muted)', marginBottom: 8 } }, 'ACTIVITY LOG'),
|
|
297
|
-
h('div', { style: { maxHeight: 180, overflow: 'auto', border: '1px solid var(--border)', borderRadius: 'var(--radius)' } },
|
|
298
|
-
task.activityLog.map(function(entry, i) {
|
|
299
|
-
return h('div', { key: i, style: { display: 'flex', gap: 8, padding: '6px 10px', borderBottom: '1px solid var(--border)', fontSize: 11 } },
|
|
300
|
-
h('span', { style: { color: 'var(--text-muted)', flexShrink: 0, fontFamily: 'var(--font-mono)', fontSize: 10 } }, entry.ts ? new Date(entry.ts).toLocaleTimeString() : ''),
|
|
301
|
-
h('span', { style: { fontWeight: 600, flexShrink: 0, minWidth: 60 } }, entry.type),
|
|
302
|
-
h('span', { style: { color: 'var(--text-secondary)' } }, entry.detail)
|
|
303
|
-
);
|
|
304
|
-
})
|
|
305
|
-
)
|
|
306
|
-
),
|
|
376
|
+
// Activity log — paginated with filter + search
|
|
377
|
+
task.activityLog && task.activityLog.length > 0 && h(ActivityLog, { entries: task.activityLog }),
|
|
307
378
|
|
|
308
379
|
task.error && h('div', { style: { padding: 12, background: 'rgba(239,68,68,0.1)', border: '1px solid rgba(239,68,68,0.3)', borderRadius: 'var(--radius)', marginBottom: 16, fontSize: 13, color: '#ef4444' } }, h('strong', null, 'Error: '), task.error),
|
|
309
380
|
|
|
@@ -895,8 +966,8 @@ export function TaskPipelinePage() {
|
|
|
895
966
|
// Hover tooltip
|
|
896
967
|
hoveredNode && hoveredNode.task && h('div', { style: {
|
|
897
968
|
position: 'fixed', left: mousePos.x + 16, top: mousePos.y - 10,
|
|
898
|
-
background: '
|
|
899
|
-
border: '1px solid rgba(
|
|
969
|
+
background: 'var(--bg-secondary)', backdropFilter: 'blur(12px)',
|
|
970
|
+
border: '1px solid var(--tp-border)', borderRadius: 10, boxShadow: '0 8px 32px rgba(0,0,0,0.2)',
|
|
900
971
|
padding: '10px 14px', pointerEvents: 'none', zIndex: 1000, minWidth: 180, maxWidth: 280,
|
|
901
972
|
}},
|
|
902
973
|
hoveredNode.task.customerContext && h(CustomerBadge, { customer: hoveredNode.task.customerContext }),
|
package/src/runtime/hooks.ts
CHANGED
|
@@ -522,6 +522,28 @@ export function createRuntimeHooks(deps: HookDependencies): RuntimeHooks {
|
|
|
522
522
|
} catch (err: any) {
|
|
523
523
|
console.warn(`[hooks] Failed to persist compaction summary: ${err?.message}`);
|
|
524
524
|
}
|
|
525
|
+
|
|
526
|
+
// Link compaction to task pipeline — update task progress with compaction event
|
|
527
|
+
try {
|
|
528
|
+
var { TaskQueueManager } = await import('../engine/task-queue.js');
|
|
529
|
+
var tq = new TaskQueueManager();
|
|
530
|
+
(tq as any).db = deps.engineDb;
|
|
531
|
+
await tq.init();
|
|
532
|
+
// Find active task for this session
|
|
533
|
+
var tasks = await tq.listTasks({ orgId: deps.orgId, status: 'in_progress' });
|
|
534
|
+
var sessionTask = tasks.find(function(t: any) { return t.sessionId === sessionId; });
|
|
535
|
+
if (sessionTask) {
|
|
536
|
+
await tq.updateTask(sessionTask.id, {
|
|
537
|
+
activityLog: [...(sessionTask.activityLog || []), {
|
|
538
|
+
ts: new Date().toISOString(),
|
|
539
|
+
type: 'compaction',
|
|
540
|
+
agent: agentId,
|
|
541
|
+
detail: `Context compacted (${summary.length} chars summary). Agent continues from compacted state.`,
|
|
542
|
+
}],
|
|
543
|
+
});
|
|
544
|
+
console.log(`[hooks] Task ${sessionTask.id.slice(0, 8)} updated with compaction event`);
|
|
545
|
+
}
|
|
546
|
+
} catch { /* non-fatal */ }
|
|
525
547
|
},
|
|
526
548
|
};
|
|
527
549
|
}
|