@agenticmail/enterprise 0.5.252 → 0.5.253
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/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/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);
|
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
|
}
|