@agenticmail/enterprise 0.5.319 → 0.5.320
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/README.md +118 -38
- package/dist/agent-heartbeat-3FWNHZFX.js +510 -0
- package/dist/agent-heartbeat-4RWHZR7H.js +510 -0
- package/dist/agent-heartbeat-6ZGB5ILY.js +510 -0
- package/dist/agent-heartbeat-BIVHLKFM.js +510 -0
- package/dist/agent-heartbeat-HRKVFK2T.js +510 -0
- package/dist/agent-heartbeat-JC5GWVXD.js +510 -0
- package/dist/agent-heartbeat-K6A4HMHB.js +510 -0
- package/dist/agent-heartbeat-LCDXWFVB.js +510 -0
- package/dist/agent-heartbeat-P7HZCZAQ.js +510 -0
- package/dist/agent-heartbeat-PUIRSNIO.js +510 -0
- package/dist/agent-heartbeat-SN5ILQ6Y.js +510 -0
- package/dist/agent-heartbeat-TW5YTDYC.js +510 -0
- package/dist/agent-heartbeat-Z2QQXROL.js +510 -0
- package/dist/agent-notify-OEQBCZLN.js +43 -0
- package/dist/{agent-tools-263HM5QU.js → agent-tools-3W7XLUYA.js} +1 -1
- package/dist/agent-tools-4QK7LLNP.js +9 -0
- package/dist/agent-tools-54VZGT6L.js +9 -0
- package/dist/{agent-tools-AT4D276V.js → agent-tools-AYYDPO27.js} +7 -7
- package/dist/{agent-tools-MSTAPX2I.js → agent-tools-F2X47FKF.js} +7 -7
- package/dist/{agent-tools-FA26SY5O.js → agent-tools-O6W3QAZL.js} +11 -6
- package/dist/agent-tools-OAWVZBMW.js +9 -0
- package/dist/agent-tools-QCCU74PN.js +13949 -0
- package/dist/chunk-2LHUARN6.js +4929 -0
- package/dist/chunk-2WVCNCYC.js +5087 -0
- package/dist/{chunk-6PWDS7KY.js → chunk-3FM6YQUK.js} +20 -20
- package/dist/chunk-3UAFHUEC.js +212 -0
- package/dist/{chunk-WJO57PMO.js → chunk-46GOWZT4.js} +20 -20
- package/dist/{chunk-BNRE7TSX.js → chunk-5KYJAUZV.js} +3 -3
- package/dist/chunk-6C5PKREN.js +467 -0
- package/dist/{chunk-447MTPZF.js → chunk-6ZMLNEHB.js} +3 -3
- package/dist/chunk-BPZQT5N5.js +25652 -0
- package/dist/chunk-BQM7MBPS.js +1380 -0
- package/dist/{chunk-ZRFKGPIU.js → chunk-C52OQNNY.js} +20 -20
- package/dist/chunk-C7HGQF4Y.js +25652 -0
- package/dist/chunk-CAHNZGGK.js +25656 -0
- package/dist/{chunk-FL3CH3ET.js → chunk-CK7R6UHE.js} +51 -27
- package/dist/chunk-D36RPWB7.js +25652 -0
- package/dist/{chunk-36NM2B4C.js → chunk-DJK2UPFH.js} +63 -93
- package/dist/chunk-DM7FTF7W.js +4929 -0
- package/dist/chunk-DMD24UFZ.js +5101 -0
- package/dist/{chunk-36XNMIHA.js → chunk-DXZGPUAF.js} +20 -20
- package/dist/chunk-F46WB5IL.js +5087 -0
- package/dist/chunk-F5QG5SQH.js +5087 -0
- package/dist/{chunk-JGEVQZDR.js → chunk-FLQ5FLHW.js} +13 -16
- package/dist/chunk-H7GP733U.js +5087 -0
- package/dist/{chunk-OZSQLOV6.js → chunk-HHBXWB5U.js} +415 -19
- package/dist/{chunk-D24JY75H.js → chunk-IMXS4N6W.js} +3 -3
- package/dist/{chunk-6PVBV6ZP.js → chunk-JNMDD7JY.js} +3 -3
- package/dist/chunk-JTV5LA47.js +1519 -0
- package/dist/chunk-KV6G7NZX.js +1519 -0
- package/dist/chunk-MU5MEBIK.js +1519 -0
- package/dist/chunk-NLT5MC7X.js +465 -0
- package/dist/{chunk-GTFZZUXX.js → chunk-NVLYIM4J.js} +51 -27
- package/dist/{chunk-6G5SXLXC.js → chunk-NZY2BIZH.js} +63 -93
- package/dist/chunk-O42L6G67.js +1519 -0
- package/dist/chunk-OCNERGGM.js +4891 -0
- package/dist/chunk-OJSNHONE.js +1519 -0
- package/dist/{chunk-2TAZJWJN.js → chunk-OWL3QVH7.js} +18 -0
- package/dist/{chunk-P3HVY2HS.js → chunk-OWTLNV4Q.js} +382 -7
- package/dist/chunk-PCNYEP6T.js +4891 -0
- package/dist/{chunk-YL3Z5KPR.js → chunk-PI4AQ4Z6.js} +438 -15
- package/dist/chunk-PN3EGTCA.js +194 -0
- package/dist/chunk-Q37UKNRC.js +1519 -0
- package/dist/chunk-QXTC6J7H.js +5087 -0
- package/dist/{chunk-SPBQVNDI.js → chunk-RKERL5LZ.js} +25 -21
- package/dist/chunk-RVBK2IOX.js +25652 -0
- package/dist/chunk-SAKODCZ5.js +4891 -0
- package/dist/{chunk-XV4TU65E.js → chunk-SALGFC5L.js} +51 -27
- package/dist/chunk-STGWZ2MS.js +1519 -0
- package/dist/chunk-UY3ZVQDP.js +25652 -0
- package/dist/chunk-V6OSD62M.js +5087 -0
- package/dist/chunk-VP6YAHX4.js +1519 -0
- package/dist/chunk-WDYJOEAI.js +5087 -0
- package/dist/chunk-WEAFQNOS.js +195 -0
- package/dist/chunk-XKUSAZGP.js +5087 -0
- package/dist/chunk-Z6K5FKAB.js +548 -0
- package/dist/chunk-ZGE3XAXY.js +1519 -0
- package/dist/chunk-ZGYVXYQQ.js +3296 -0
- package/dist/cli-agent-7TB2BWS6.js +2370 -0
- package/dist/cli-agent-AKXFFST2.js +2370 -0
- package/dist/cli-agent-DZTKLITB.js +2357 -0
- package/dist/cli-agent-FOF7PFEP.js +2357 -0
- package/dist/cli-agent-H74M2ZYN.js +2357 -0
- package/dist/cli-agent-HORWVPHB.js +2370 -0
- package/dist/cli-agent-HSZT6SKF.js +2423 -0
- package/dist/cli-agent-JLUQ4ZU6.js +2424 -0
- package/dist/cli-agent-MVCDH4HV.js +2370 -0
- package/dist/cli-agent-NZXOEPJ2.js +2357 -0
- package/dist/cli-agent-PADN3QRC.js +2357 -0
- package/dist/cli-agent-QAYEX3BE.js +2441 -0
- package/dist/cli-agent-QT64DT5J.js +2370 -0
- package/dist/cli-agent-TFL2M6UK.js +2424 -0
- package/dist/cli-agent-UIKXATTD.js +2357 -0
- package/dist/cli-agent-UJN6FYTO.js +2370 -0
- package/dist/cli-agent-VIQAYVY4.js +2357 -0
- package/dist/cli-agent-WNWFVOFM.js +2370 -0
- package/dist/cli-agent-XBQX67VJ.js +2423 -0
- package/dist/cli-agent-ZLSC6FF4.js +2357 -0
- package/dist/cli-serve-2IL5DTEY.js +153 -0
- package/dist/cli-serve-47N5UKKW.js +153 -0
- package/dist/cli-serve-4XGZFUV2.js +140 -0
- package/dist/cli-serve-6OT3UEAN.js +140 -0
- package/dist/cli-serve-7L6EY5UH.js +153 -0
- package/dist/cli-serve-BDGOOOKQ.js +260 -0
- package/dist/cli-serve-BFNIW2LF.js +153 -0
- package/dist/cli-serve-C7MN6U5Q.js +153 -0
- package/dist/cli-serve-CR3OY3IM.js +153 -0
- package/dist/cli-serve-DAJFRWQ7.js +153 -0
- package/dist/cli-serve-FW6FHFW4.js +153 -0
- package/dist/cli-serve-GEEOQS77.js +153 -0
- package/dist/cli-serve-H562I3ZK.js +153 -0
- package/dist/cli-serve-HDQZF4C4.js +153 -0
- package/dist/cli-serve-LICAOMEB.js +140 -0
- package/dist/cli-serve-LLGYLWFS.js +153 -0
- package/dist/cli-serve-N3OISDNB.js +153 -0
- package/dist/cli-serve-TIZ27EVR.js +153 -0
- package/dist/cli-serve-TUNI2RCN.js +153 -0
- package/dist/cli-serve-WNOZMAWD.js +153 -0
- package/dist/cli-validate-Z726VJCN.js +150 -0
- package/dist/cli.js +4 -4
- package/dist/connection-manager-KAWEUWUR.js +9 -0
- package/dist/dashboard/app.js +9 -3
- package/dist/dashboard/components/knowledge-link.js +15 -0
- package/dist/dashboard/components/settings-help.js +4 -2
- package/dist/dashboard/docs/agent-deployment.html +33 -1
- package/dist/dashboard/docs/settings-network.html +321 -0
- package/dist/dashboard/docs/settings-security.html +347 -0
- package/dist/dashboard/docs/settings-tool-security.html +176 -0
- package/dist/dashboard/docs/settings.html +36 -16
- package/dist/dashboard/pages/agent-detail/deployment.js +39 -6
- package/dist/dashboard/pages/agent-detail/tools.js +10 -0
- package/dist/dashboard/pages/database-access.js +4 -3
- package/dist/dashboard/pages/settings.js +174 -37
- package/dist/dashboard/pages/task-pipeline.js +400 -843
- package/dist/db-adapter-2T56ORSD.js +7 -0
- package/dist/db-adapter-IRHOUMVC.js +7 -0
- package/dist/index.js +41 -41
- package/dist/microsoft-VREAZ7M2.js +3955 -0
- package/dist/routes-3MMLQTB6.js +90 -0
- package/dist/routes-4ZUIJ4HE.js +90 -0
- package/dist/routes-5MXHKKH4.js +90 -0
- package/dist/routes-64NJFK3B.js +90 -0
- package/dist/routes-6AKQ2LBV.js +90 -0
- package/dist/routes-CRRBUDO4.js +90 -0
- package/dist/routes-DIAF3MC3.js +90 -0
- package/dist/routes-KMUNU6CY.js +90 -0
- package/dist/routes-LRRLXIZR.js +90 -0
- package/dist/routes-N647AJYG.js +90 -0
- package/dist/routes-SSSELAAR.js +90 -0
- package/dist/routes-STERVGKJ.js +90 -0
- package/dist/routes-ZEZZACZP.js +90 -0
- package/dist/runtime-5EQN4GFM.js +45 -0
- package/dist/runtime-5LP7PUD4.js +45 -0
- package/dist/runtime-6BULDBR3.js +45 -0
- package/dist/runtime-6YEENDN3.js +45 -0
- package/dist/runtime-7LQFRG3B.js +45 -0
- package/dist/runtime-AMXJU2MB.js +45 -0
- package/dist/runtime-D6WSE7FG.js +45 -0
- package/dist/runtime-EYVN7NFJ.js +45 -0
- package/dist/runtime-F6RPWQVW.js +45 -0
- package/dist/runtime-FYMJURFC.js +45 -0
- package/dist/runtime-JRNBL4O4.js +45 -0
- package/dist/runtime-OM2NIBMI.js +45 -0
- package/dist/runtime-QWPVD7CY.js +45 -0
- package/dist/runtime-YLIIPTE4.js +45 -0
- package/dist/runtime-YU6P22CG.js +45 -0
- package/dist/screen-unlock-4RPZBHOI.js +118 -0
- package/dist/server-AMCSXINC.js +28 -0
- package/dist/server-CU6LVQS4.js +28 -0
- package/dist/server-DFYGH2CV.js +28 -0
- package/dist/server-EELWOC3X.js +28 -0
- package/dist/server-EN5E2OWQ.js +28 -0
- package/dist/server-GW2HYJYI.js +28 -0
- package/dist/server-J25NCRWJ.js +28 -0
- package/dist/server-JDGNOTFV.js +28 -0
- package/dist/server-NE5HD5DJ.js +28 -0
- package/dist/server-NQOT7W77.js +28 -0
- package/dist/server-PWE5PQTR.js +28 -0
- package/dist/server-Q2Q32H2B.js +28 -0
- package/dist/server-Q77ME7TL.js +28 -0
- package/dist/server-WLLH4WST.js +28 -0
- package/dist/server-WTUJ2O3F.js +28 -0
- package/dist/server-X4CJTHHF.js +28 -0
- package/dist/server-XK3ILCJC.js +28 -0
- package/dist/server-ZRD3NDJE.js +28 -0
- package/dist/setup-44VBAO4J.js +20 -0
- package/dist/setup-4ONNQBWB.js +20 -0
- package/dist/setup-4OSBXSCL.js +20 -0
- package/dist/setup-4QFGRBLZ.js +20 -0
- package/dist/setup-6766SGAR.js +20 -0
- package/dist/setup-AYY24DKM.js +20 -0
- package/dist/setup-B34N4HPU.js +20 -0
- package/dist/setup-E2YLC2EY.js +20 -0
- package/dist/setup-ER6NXTY5.js +20 -0
- package/dist/setup-H2AGCBW5.js +20 -0
- package/dist/setup-ICOZRKCX.js +20 -0
- package/dist/setup-JFTJH7UF.js +20 -0
- package/dist/setup-PRFNI6YW.js +20 -0
- package/dist/setup-RAHBMYHE.js +20 -0
- package/dist/setup-TXPR5UQX.js +20 -0
- package/dist/setup-XCJMELVU.js +20 -0
- package/dist/setup-XIYEIFVK.js +20 -0
- package/dist/setup-Z4PZSHBI.js +20 -0
- package/dist/skills-FR7I5V7H.js +16 -0
- package/dist/skills-HCVBA6PK.js +16 -0
- package/dist/system-prompts-TM7OA32C.js +913 -0
- package/dist/task-queue-O7IVZYUO.js +9 -0
- package/dist/transport-encryption-2T7PIXKG.js +25 -0
- package/ecosystem.config.cjs +120 -0
- package/logs/cloudflared-error.log +61 -0
- package/logs/cloudflared-out.log +0 -0
- package/logs/enterprise-error.log +0 -0
- package/logs/enterprise-out.log +3 -0
- package/logs/fola-error.log +0 -0
- package/logs/fola-out.log +0 -0
- package/logs/john-error.log +8 -0
- package/logs/john-out.log +0 -0
- package/package.json +1 -1
- package/src/agent-tools/tool-resolver.ts +50 -61
- package/src/agent-tools/tools/enterprise-database.ts +5 -5
- package/src/agent-tools/tools/local/dependency-manager.ts +2 -2
- package/src/agent-tools/tools/microsoft/graph-api.ts +137 -26
- package/src/agent-tools/tools/microsoft/outlook-mail.ts +392 -100
- package/src/agent-tools/tools/microsoft/teams.ts +267 -48
- package/src/auth/routes.ts +4 -4
- package/src/cli-agent.ts +108 -8
- package/src/cli-serve.ts +140 -0
- package/src/dashboard/app.js +9 -3
- package/src/dashboard/components/knowledge-link.js +15 -0
- package/src/dashboard/components/settings-help.js +4 -2
- package/src/dashboard/docs/agent-deployment.html +33 -1
- package/src/dashboard/docs/settings-network.html +321 -0
- package/src/dashboard/docs/settings-security.html +347 -0
- package/src/dashboard/docs/settings-tool-security.html +176 -0
- package/src/dashboard/docs/settings.html +36 -16
- package/src/dashboard/pages/agent-detail/deployment.js +39 -6
- package/src/dashboard/pages/agent-detail/tools.js +10 -0
- package/src/dashboard/pages/database-access.js +4 -3
- package/src/dashboard/pages/settings.js +174 -37
- package/src/dashboard/pages/task-pipeline.js +400 -843
- package/src/database-access/agent-tools.ts +78 -63
- package/src/database-access/connection-manager.ts +13 -2
- package/src/database-access/routes.ts +13 -1
- package/src/db/adapter.ts +1 -0
- package/src/engine/agent-memory.ts +2 -1
- package/src/engine/agent-notify.ts +50 -0
- package/src/engine/agent-routes.ts +257 -4
- package/src/engine/db-adapter.ts +16 -0
- package/src/engine/lifecycle.ts +4 -0
- package/src/engine/routes.ts +4 -3
- package/src/engine/screen-unlock.ts +136 -0
- package/src/engine/skills/database-access.ts +78 -0
- package/src/engine/skills/index.ts +3 -2
- package/src/engine/skills.ts +2 -0
- package/src/engine/task-queue-routes.ts +18 -0
- package/src/engine/task-queue.ts +15 -2
- package/src/middleware/transport-encryption.ts +1 -4
- package/src/runtime/agent-loop.ts +4 -0
- package/src/runtime/index.ts +15 -6
- package/src/server.ts +14 -1
- package/src/system-prompts/google/index.ts +1 -2
- package/src/system-prompts/index.ts +1 -1
- package/src/system-prompts/microsoft/contacts.ts +34 -0
- package/src/system-prompts/microsoft/excel.ts +52 -0
- package/src/system-prompts/microsoft/index.ts +31 -0
- package/src/system-prompts/microsoft/onedrive.ts +41 -0
- package/src/system-prompts/microsoft/onenote.ts +36 -0
- package/src/system-prompts/microsoft/outlook-calendar.ts +37 -0
- package/src/system-prompts/microsoft/outlook-mail.ts +46 -0
- package/src/system-prompts/microsoft/planner.ts +37 -0
- package/src/system-prompts/microsoft/powerbi.ts +38 -0
- package/src/system-prompts/microsoft/powerpoint.ts +35 -0
- package/src/system-prompts/microsoft/sharepoint.ts +44 -0
- package/src/system-prompts/microsoft/teams.ts +49 -0
- package/src/system-prompts/microsoft/todo.ts +37 -0
- package/src/types/hono-env.ts +4 -0
- package/dist/agent-tools-LRA7PPXG.js +0 -13922
- package/dist/agent-tools-VAU5DOQB.js +0 -13910
- package/dist/agent-tools-VWV7OWXU.js +0 -13922
- package/dist/chunk-2Z7MWTCX.js +0 -4977
- package/dist/chunk-3T4XU3VV.js +0 -5010
- package/dist/chunk-445QM4NX.js +0 -5061
- package/dist/chunk-5TW3Y7DJ.js +0 -1519
- package/dist/chunk-6I7VY3LT.js +0 -5060
- package/dist/chunk-6W5EK3UP.js +0 -4977
- package/dist/chunk-AQMSHJQT.js +0 -5069
- package/dist/chunk-ASSQW7HX.js +0 -5051
- package/dist/chunk-CIN27FGC.js +0 -5037
- package/dist/chunk-CMXY3NUB.js +0 -4977
- package/dist/chunk-DRLMRUDP.js +0 -5052
- package/dist/chunk-EHI7Z446.js +0 -1519
- package/dist/chunk-FEAILFAQ.js +0 -1519
- package/dist/chunk-GA3PYBZL.js +0 -1519
- package/dist/chunk-GWX63G5J.js +0 -1519
- package/dist/chunk-HHMZ4UY6.js +0 -1519
- package/dist/chunk-HVQMNF7E.js +0 -4921
- package/dist/chunk-HXM7F3YN.js +0 -1519
- package/dist/chunk-K6NGOUXG.js +0 -5060
- package/dist/chunk-KPG5WINJ.js +0 -4977
- package/dist/chunk-LBCUBYDL.js +0 -1519
- package/dist/chunk-LIRQSWLR.js +0 -5014
- package/dist/chunk-LRCKO5KE.js +0 -1519
- package/dist/chunk-M7XL3DJD.js +0 -5069
- package/dist/chunk-MHJULEIQ.js +0 -1519
- package/dist/chunk-MJGGW6MC.js +0 -106
- package/dist/chunk-MMYBDHDB.js +0 -4921
- package/dist/chunk-MQT5FXKD.js +0 -1519
- package/dist/chunk-OIMPEQF5.js +0 -4977
- package/dist/chunk-OOU7JUYE.js +0 -542
- package/dist/chunk-OW4GLBHP.js +0 -1519
- package/dist/chunk-Q4K4MMLU.js +0 -4977
- package/dist/chunk-RUK4CRPF.js +0 -1519
- package/dist/chunk-T7H65XQY.js +0 -1519
- package/dist/chunk-TQVFWG57.js +0 -5064
- package/dist/chunk-UEPK3IMC.js +0 -1519
- package/dist/chunk-VUWTXJH6.js +0 -1519
- package/dist/chunk-WCPGGSAD.js +0 -1519
- package/dist/chunk-WO63NZOJ.js +0 -1519
- package/dist/chunk-YPJDRVUM.js +0 -5064
- package/dist/chunk-ZROMH5DL.js +0 -4921
package/src/engine/task-queue.ts
CHANGED
|
@@ -91,9 +91,10 @@ export interface TaskRecord {
|
|
|
91
91
|
// Activity log (micro-events within a task)
|
|
92
92
|
activityLog: Array<{
|
|
93
93
|
ts: string;
|
|
94
|
-
type: string; // 'created' | 'assigned' | 'started' | 'delegated' | 'returned' | 'progress' | 'completed' | 'failed' | 'note'
|
|
94
|
+
type: string; // 'created' | 'assigned' | 'started' | 'delegated' | 'returned' | 'progress' | 'completed' | 'failed' | 'note' | 'crash'
|
|
95
95
|
agent: string;
|
|
96
96
|
detail: string;
|
|
97
|
+
[key: string]: any; // Allow extra fields (previousStatus, retryCount, sessionId, etc.)
|
|
97
98
|
}>;
|
|
98
99
|
}
|
|
99
100
|
|
|
@@ -357,7 +358,7 @@ export class TaskQueueManager {
|
|
|
357
358
|
return chain.sort((a, b) => (a.chainSeq || 0) - (b.chainSeq || 0));
|
|
358
359
|
}
|
|
359
360
|
|
|
360
|
-
async updateTask(taskId: string, updates: Partial<Pick<TaskRecord, 'status' | 'progress' | 'result' | 'error' | 'modelUsed' | 'tokensUsed' | 'costUsd' | 'sessionId' | 'title' | 'description' | 'priority' | 'activityLog'>>): Promise<TaskRecord | null> {
|
|
361
|
+
async updateTask(taskId: string, updates: Partial<Pick<TaskRecord, 'status' | 'progress' | 'result' | 'error' | 'modelUsed' | 'tokensUsed' | 'costUsd' | 'sessionId' | 'title' | 'description' | 'priority' | 'activityLog' | 'startedAt'>>): Promise<TaskRecord | null> {
|
|
361
362
|
await this.init();
|
|
362
363
|
const task = this.tasks.get(taskId);
|
|
363
364
|
if (!task) return null;
|
|
@@ -552,10 +553,22 @@ export class TaskQueueManager {
|
|
|
552
553
|
return () => { this.listeners.delete(listener); };
|
|
553
554
|
}
|
|
554
555
|
|
|
556
|
+
/** URL to notify when tasks change (for standalone agents → enterprise SSE relay) */
|
|
557
|
+
webhookUrl: string | null = null;
|
|
558
|
+
|
|
555
559
|
private emit(event: TaskEvent): void {
|
|
556
560
|
for (const l of this.listeners) {
|
|
557
561
|
try { l(event); } catch { /* ignore */ }
|
|
558
562
|
}
|
|
563
|
+
// Notify enterprise server for SSE relay (fire-and-forget)
|
|
564
|
+
if (this.webhookUrl) {
|
|
565
|
+
fetch(this.webhookUrl, {
|
|
566
|
+
method: 'POST',
|
|
567
|
+
headers: { 'Content-Type': 'application/json' },
|
|
568
|
+
body: JSON.stringify(event),
|
|
569
|
+
signal: AbortSignal.timeout(3000),
|
|
570
|
+
}).catch(() => {});
|
|
571
|
+
}
|
|
559
572
|
}
|
|
560
573
|
|
|
561
574
|
// ─── Persistence ──────────────────────────────────────
|
|
@@ -389,10 +389,7 @@ export function transportEncryptionMiddleware() {
|
|
|
389
389
|
headers: newHeaders,
|
|
390
390
|
});
|
|
391
391
|
} catch (e: any) {
|
|
392
|
-
// Encryption failed —
|
|
393
|
-
if (originalBody) {
|
|
394
|
-
c.res = new Response(originalBody, { status: response.status, headers: response.headers });
|
|
395
|
-
}
|
|
392
|
+
// Encryption failed — pass through original response
|
|
396
393
|
}
|
|
397
394
|
}
|
|
398
395
|
};
|
|
@@ -167,6 +167,10 @@ export interface AgentLoopOptions {
|
|
|
167
167
|
retryConfig?: { maxRetryDurationMs?: number; maxRetries?: number; baseDelayMs?: number; maxDelayMs?: number };
|
|
168
168
|
/** Runtime reference for tool access */
|
|
169
169
|
runtime?: any;
|
|
170
|
+
/** Fallback models to try if primary model fails */
|
|
171
|
+
fallbackModels?: string[];
|
|
172
|
+
/** Resolve API key for a provider dynamically */
|
|
173
|
+
resolveApiKey?: (provider: string) => Promise<string | undefined>;
|
|
170
174
|
}
|
|
171
175
|
|
|
172
176
|
export interface AgentLoopResult {
|
package/src/runtime/index.ts
CHANGED
|
@@ -356,7 +356,10 @@ export class AgentRuntime {
|
|
|
356
356
|
}
|
|
357
357
|
var _agentCfg = this.config.getAgentConfig ? this.config.getAgentConfig(agentId) : null;
|
|
358
358
|
var _agentIdentity = _agentCfg?.identity || null;
|
|
359
|
-
|
|
359
|
+
// Get database connections for this agent
|
|
360
|
+
var _dbConnections: string[] = [];
|
|
361
|
+
try { if (this.config.databaseManager) _dbConnections = this.config.databaseManager.getAgentConnectionSummary(agentId); } catch {}
|
|
362
|
+
var systemPrompt = opts.systemPrompt || buildDefaultSystemPrompt(agentId, memoryContext, hierarchyContext, _agentIdentity, _dbConnections);
|
|
360
363
|
|
|
361
364
|
// Detect session context for dynamic tool loading
|
|
362
365
|
var sessionContext = detectSessionContext({
|
|
@@ -468,7 +471,9 @@ export class AgentRuntime {
|
|
|
468
471
|
try { _hierarchyCtx = await this.config.hierarchyManager.buildManagerPrompt(session.agentId) || ''; } catch {}
|
|
469
472
|
}
|
|
470
473
|
var _aCfg2 = this.config.getAgentConfig ? this.config.getAgentConfig(session.agentId) : null;
|
|
471
|
-
var
|
|
474
|
+
var _dbConns2: string[] = [];
|
|
475
|
+
try { if (this.config.databaseManager) _dbConns2 = this.config.databaseManager.getAgentConnectionSummary(session.agentId); } catch {}
|
|
476
|
+
var _systemPrompt = buildDefaultSystemPrompt(session.agentId, memoryContext, _hierarchyCtx, _aCfg2?.identity, _dbConns2);
|
|
472
477
|
|
|
473
478
|
// Context-aware tool loading — reuses session tool state (preserves dynamically loaded sets)
|
|
474
479
|
// Don't re-detect context for keep-alive sessions (meetings) — they stay in their original context
|
|
@@ -918,7 +923,9 @@ export class AgentRuntime {
|
|
|
918
923
|
try { _hc = await this.config.hierarchyManager.buildManagerPrompt(session.agentId) || ''; } catch {}
|
|
919
924
|
}
|
|
920
925
|
var _rCfg = this.config.getAgentConfig ? this.config.getAgentConfig(session.agentId) : null;
|
|
921
|
-
var
|
|
926
|
+
var _dbC3: string[] = [];
|
|
927
|
+
try { if (this.config.databaseManager) _dbC3 = this.config.databaseManager.getAgentConnectionSummary(session.agentId); } catch {}
|
|
928
|
+
var _resumePrompt = buildDefaultSystemPrompt(session.agentId, mc, _hc, _rCfg?.identity, _dbC3);
|
|
922
929
|
var _resumeCtx = detectSessionContext({
|
|
923
930
|
systemPrompt: _resumePrompt,
|
|
924
931
|
isKeepAlive: this.keepAliveSessions.has(session.id),
|
|
@@ -1035,7 +1042,7 @@ export function createAgentRuntime(config: RuntimeConfig): AgentRuntime {
|
|
|
1035
1042
|
|
|
1036
1043
|
// ─── Default System Prompt ───────────────────────────────
|
|
1037
1044
|
|
|
1038
|
-
function buildDefaultSystemPrompt(agentId: string, memoryContext?: string, hierarchyContext?: string, agentIdentity?: any): string {
|
|
1045
|
+
function buildDefaultSystemPrompt(agentId: string, memoryContext?: string, hierarchyContext?: string, agentIdentity?: any, dbConnections?: string[]): string {
|
|
1039
1046
|
var base = `You are an AI agent managed by AgenticMail Enterprise (agent: ${agentId}).
|
|
1040
1047
|
|
|
1041
1048
|
You have access to a comprehensive set of tools for completing tasks. Use them effectively.
|
|
@@ -1053,8 +1060,10 @@ Guidelines:
|
|
|
1053
1060
|
- Your memory persists across conversations — it's how you grow as an expert
|
|
1054
1061
|
|
|
1055
1062
|
Database Tools:
|
|
1056
|
-
- ent_db_* tools
|
|
1057
|
-
- db_* tools (db_query, db_list_connections, db_list_tables, db_describe_table): For
|
|
1063
|
+
- ent_db_* tools: For LOCAL databases — SQLite files in the workspace. Read-only inspection.
|
|
1064
|
+
- db_* tools (db_query, db_list_connections, db_list_tables, db_describe_table): For EXTERNAL databases granted to you by your admin.
|
|
1065
|
+
IMPORTANT: When asked about any database by name, ALWAYS use db_* tools first. Start with db_list_connections.
|
|
1066
|
+
${dbConnections && dbConnections.length > 0 ? `\nYour External Database Access:\n${dbConnections.map(c => ' - ' + c).join('\n')}\nUse db_query with the connection name to query these databases.` : ''}
|
|
1058
1067
|
|
|
1059
1068
|
Current time: ${new Date().toISOString()}`;
|
|
1060
1069
|
|
package/src/server.ts
CHANGED
|
@@ -13,6 +13,19 @@ import { serve } from '@hono/node-server';
|
|
|
13
13
|
import { readFileSync, existsSync } from 'fs';
|
|
14
14
|
import { homedir } from 'os';
|
|
15
15
|
import { fileURLToPath } from 'url';
|
|
16
|
+
|
|
17
|
+
// ─── Production Log Level Filter ─────────────────────────
|
|
18
|
+
const _LOG_LEVEL = (process.env.LOG_LEVEL || 'info').toLowerCase();
|
|
19
|
+
const _LOG_LEVELS: Record<string, number> = { debug: 0, info: 1, warn: 2, error: 3 };
|
|
20
|
+
const _LOG_THRESHOLD = _LOG_LEVELS[_LOG_LEVEL] ?? 1;
|
|
21
|
+
if (_LOG_THRESHOLD > 1) {
|
|
22
|
+
const _origLog = console.log.bind(console);
|
|
23
|
+
console.log = function(...args: any[]) {
|
|
24
|
+
const first = typeof args[0] === 'string' ? args[0] : '';
|
|
25
|
+
if (first.includes('[error]') || first.includes('[fatal]') || first.includes('ERROR')) _origLog(...args);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (_LOG_THRESHOLD > 2) { console.warn = function() {}; }
|
|
16
29
|
import { dirname, join } from 'path';
|
|
17
30
|
import { createRequire } from 'module';
|
|
18
31
|
|
|
@@ -237,7 +250,7 @@ export function createServer(config: ServerConfig): ServerInstance {
|
|
|
237
250
|
|
|
238
251
|
// Skip auth for agent status (internal communication + dashboard SSE)
|
|
239
252
|
// Skip auth for internal service-to-service calls (localhost only)
|
|
240
|
-
if (c.req.path.includes('/engine/agent-status') || (c.req.path.includes('/whatsapp/proxy-send') && (c.req.header('host') || '').startsWith('localhost'))) {
|
|
253
|
+
if (c.req.path.includes('/engine/agent-status') || c.req.path.includes('/engine/task-pipeline/webhook') || (c.req.path.includes('/whatsapp/proxy-send') && (c.req.header('host') || '').startsWith('localhost'))) {
|
|
241
254
|
return next();
|
|
242
255
|
}
|
|
243
256
|
|
|
@@ -20,5 +20,4 @@ export { buildGoogleTasksPrompt, type TasksContext } from './tasks.js';
|
|
|
20
20
|
export { buildContactsPrompt, type ContactsContext } from './contacts.js';
|
|
21
21
|
export { buildFormsPrompt, type FormsContext } from './forms.js';
|
|
22
22
|
|
|
23
|
-
//
|
|
24
|
-
export { buildScheduleInfo, buildScheduleBlock, type ScheduleInfo, type AgentIdentity, type PromptContext } from '../index.js';
|
|
23
|
+
// Shared utilities available from '../index.js' — not re-exported here to avoid circular imports
|
|
@@ -79,7 +79,7 @@ export function buildScheduleInfo(
|
|
|
79
79
|
|
|
80
80
|
// Provider-specific prompts (partitioned by integration)
|
|
81
81
|
export * from './google/index.js';
|
|
82
|
-
|
|
82
|
+
export * from './microsoft/index.js';
|
|
83
83
|
|
|
84
84
|
// Generic prompts (provider-agnostic)
|
|
85
85
|
export { buildTaskPrompt, type TaskContext } from './task.js';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Microsoft Contacts — system prompt for contact management.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { buildScheduleBlock, type PromptContext } from '../index.js';
|
|
6
|
+
import { NO_AI_DISCLOSURE } from '../shared-blocks.js';
|
|
7
|
+
|
|
8
|
+
export interface MSContactsContext extends PromptContext {
|
|
9
|
+
action: 'search' | 'create' | 'update' | 'list';
|
|
10
|
+
details?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function buildMSContactsPrompt(ctx: MSContactsContext): string {
|
|
14
|
+
return `You are ${ctx.agent.name}${ctx.agent.role ? `, a ${ctx.agent.role}` : ''}.
|
|
15
|
+
${NO_AI_DISCLOSURE}
|
|
16
|
+
${buildScheduleBlock(ctx.schedule)}
|
|
17
|
+
|
|
18
|
+
## Contacts Task (Microsoft 365)
|
|
19
|
+
Action: ${ctx.action}
|
|
20
|
+
${ctx.details ? `Details: ${ctx.details}` : ''}
|
|
21
|
+
|
|
22
|
+
## Available Tools
|
|
23
|
+
- ms_contacts_list — list contacts (with pagination)
|
|
24
|
+
- ms_contacts_create — create a new contact
|
|
25
|
+
- ms_contacts_update — update contact details
|
|
26
|
+
- ms_contacts_delete — remove a contact
|
|
27
|
+
- ms_contacts_people — search people directory (includes org directory + frequent contacts)
|
|
28
|
+
|
|
29
|
+
## Guidelines
|
|
30
|
+
- ms_contacts_people is best for finding people by name — searches across the org
|
|
31
|
+
- Contacts support multiple email addresses, phone numbers, and addresses
|
|
32
|
+
- Use people search for "who is..." type queries
|
|
33
|
+
`;
|
|
34
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Excel — system prompt for spreadsheet operations via Microsoft 365.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { buildScheduleBlock, type PromptContext } from '../index.js';
|
|
6
|
+
import { NO_AI_DISCLOSURE } from '../shared-blocks.js';
|
|
7
|
+
|
|
8
|
+
export interface ExcelContext extends PromptContext {
|
|
9
|
+
action: 'read' | 'write' | 'analyze' | 'create';
|
|
10
|
+
workbookPath?: string;
|
|
11
|
+
details?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function buildExcelPrompt(ctx: ExcelContext): string {
|
|
15
|
+
return `You are ${ctx.agent.name}${ctx.agent.role ? `, a ${ctx.agent.role}` : ''}.
|
|
16
|
+
${NO_AI_DISCLOSURE}
|
|
17
|
+
${buildScheduleBlock(ctx.schedule)}
|
|
18
|
+
|
|
19
|
+
## Spreadsheet Task (Excel Online)
|
|
20
|
+
Action: ${ctx.action}
|
|
21
|
+
${ctx.workbookPath ? `Workbook: ${ctx.workbookPath}` : ''}
|
|
22
|
+
${ctx.details ? `Details: ${ctx.details}` : ''}
|
|
23
|
+
|
|
24
|
+
## Available Tools
|
|
25
|
+
Basic:
|
|
26
|
+
- excel_list_worksheets — list sheets in a workbook
|
|
27
|
+
- excel_read_range — read cell ranges (e.g. "A1:D10")
|
|
28
|
+
- excel_write_range — write data to cell ranges
|
|
29
|
+
- excel_add_row — append rows to tables
|
|
30
|
+
- excel_list_tables — list structured tables
|
|
31
|
+
- excel_read_table — read full table data with headers
|
|
32
|
+
- excel_create_worksheet — add new sheets
|
|
33
|
+
|
|
34
|
+
Advanced:
|
|
35
|
+
- excel_create_session — start a calculation session for batch operations
|
|
36
|
+
- excel_close_session — end a session (saves changes)
|
|
37
|
+
- excel_evaluate_formula — evaluate formulas without writing to cells
|
|
38
|
+
- excel_named_ranges — list named ranges
|
|
39
|
+
- excel_read_named_range — read data from named ranges
|
|
40
|
+
- excel_list_charts — list charts in a worksheet
|
|
41
|
+
- excel_chart_image — export chart as image
|
|
42
|
+
- excel_pivot_refresh — refresh PivotTable data
|
|
43
|
+
- excel_set_cell_format — format cells (number format, font, colors, borders)
|
|
44
|
+
|
|
45
|
+
## Guidelines
|
|
46
|
+
- Use sessions for batch operations (multiple reads/writes) to avoid conflicts
|
|
47
|
+
- Use tables (excel_list_tables) when data has headers — more reliable than raw ranges
|
|
48
|
+
- Named ranges are preferred for well-known data locations
|
|
49
|
+
- Excel addresses use A1 notation: "Sheet1!A1:C10"
|
|
50
|
+
- Works with both OneDrive and SharePoint files (use driveId for SharePoint)
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Microsoft 365 Integration — System prompts for all Microsoft services.
|
|
3
|
+
*
|
|
4
|
+
* Each service has its own prompt file, mirroring the Google pattern.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Communication
|
|
8
|
+
export { buildOutlookMailPrompt, type OutlookMailContext } from './outlook-mail.js';
|
|
9
|
+
export { buildOutlookCalendarPrompt, type OutlookCalendarContext } from './outlook-calendar.js';
|
|
10
|
+
export { buildTeamsPrompt, type TeamsContext } from './teams.js';
|
|
11
|
+
|
|
12
|
+
// Files & Storage
|
|
13
|
+
export { buildOneDrivePrompt, type OneDriveContext } from './onedrive.js';
|
|
14
|
+
export { buildSharePointPrompt, type SharePointContext } from './sharepoint.js';
|
|
15
|
+
|
|
16
|
+
// Productivity
|
|
17
|
+
export { buildExcelPrompt, type ExcelContext } from './excel.js';
|
|
18
|
+
export { buildOneNotePrompt, type OneNoteContext } from './onenote.js';
|
|
19
|
+
export { buildPowerPointPrompt, type PowerPointContext } from './powerpoint.js';
|
|
20
|
+
|
|
21
|
+
// Task Management
|
|
22
|
+
export { buildTodoPrompt, type TodoContext } from './todo.js';
|
|
23
|
+
export { buildPlannerPrompt, type PlannerContext } from './planner.js';
|
|
24
|
+
|
|
25
|
+
// Business Intelligence
|
|
26
|
+
export { buildPowerBIPrompt, type PowerBIContext } from './powerbi.js';
|
|
27
|
+
|
|
28
|
+
// Contacts
|
|
29
|
+
export { buildMSContactsPrompt, type MSContactsContext } from './contacts.js';
|
|
30
|
+
|
|
31
|
+
// Shared utilities available from '../index.js' — not re-exported here to avoid circular imports
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OneDrive — system prompt for file management via Microsoft 365.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { buildScheduleBlock, type PromptContext } from '../index.js';
|
|
6
|
+
import { NO_AI_DISCLOSURE } from '../shared-blocks.js';
|
|
7
|
+
|
|
8
|
+
export interface OneDriveContext extends PromptContext {
|
|
9
|
+
action: 'upload' | 'download' | 'search' | 'organize' | 'share';
|
|
10
|
+
details?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function buildOneDrivePrompt(ctx: OneDriveContext): string {
|
|
14
|
+
return `You are ${ctx.agent.name}${ctx.agent.role ? `, a ${ctx.agent.role}` : ''}.
|
|
15
|
+
${NO_AI_DISCLOSURE}
|
|
16
|
+
${buildScheduleBlock(ctx.schedule)}
|
|
17
|
+
|
|
18
|
+
## File Task (OneDrive)
|
|
19
|
+
Action: ${ctx.action}
|
|
20
|
+
${ctx.details ? `Details: ${ctx.details}` : ''}
|
|
21
|
+
|
|
22
|
+
## Available Tools
|
|
23
|
+
- onedrive_list — browse folders and files
|
|
24
|
+
- onedrive_search — find files by name or content
|
|
25
|
+
- onedrive_read — download/read file contents
|
|
26
|
+
- onedrive_upload — upload files (supports up to 4MB inline, larger via session)
|
|
27
|
+
- onedrive_create_folder — organize files into folders
|
|
28
|
+
- onedrive_delete — remove files or folders
|
|
29
|
+
- onedrive_share — create sharing links with permission controls
|
|
30
|
+
- onedrive_move — move or rename files
|
|
31
|
+
- onedrive_copy — copy files to another location
|
|
32
|
+
- onedrive_versions — view file version history
|
|
33
|
+
- onedrive_recent — list recently accessed files
|
|
34
|
+
- onedrive_permissions — manage file/folder permissions
|
|
35
|
+
|
|
36
|
+
## Guidelines
|
|
37
|
+
- Use onedrive_search before creating duplicates
|
|
38
|
+
- Set appropriate sharing permissions (view vs edit)
|
|
39
|
+
- Organize files into logical folder structures
|
|
40
|
+
`;
|
|
41
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OneNote — system prompt for note-taking via Microsoft 365.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { buildScheduleBlock, type PromptContext } from '../index.js';
|
|
6
|
+
import { NO_AI_DISCLOSURE } from '../shared-blocks.js';
|
|
7
|
+
|
|
8
|
+
export interface OneNoteContext extends PromptContext {
|
|
9
|
+
action: 'read' | 'create' | 'update' | 'search';
|
|
10
|
+
details?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function buildOneNotePrompt(ctx: OneNoteContext): string {
|
|
14
|
+
return `You are ${ctx.agent.name}${ctx.agent.role ? `, a ${ctx.agent.role}` : ''}.
|
|
15
|
+
${NO_AI_DISCLOSURE}
|
|
16
|
+
${buildScheduleBlock(ctx.schedule)}
|
|
17
|
+
|
|
18
|
+
## OneNote Task
|
|
19
|
+
Action: ${ctx.action}
|
|
20
|
+
${ctx.details ? `Details: ${ctx.details}` : ''}
|
|
21
|
+
|
|
22
|
+
## Available Tools
|
|
23
|
+
- onenote_list_notebooks — list all notebooks
|
|
24
|
+
- onenote_list_sections — list sections in a notebook
|
|
25
|
+
- onenote_list_pages — list pages in a section
|
|
26
|
+
- onenote_read_page — read page content (returns HTML)
|
|
27
|
+
- onenote_create_page — create a new page (accepts HTML content)
|
|
28
|
+
- onenote_update_page — update page content (append, replace, prepend)
|
|
29
|
+
|
|
30
|
+
## Guidelines
|
|
31
|
+
- OneNote content is HTML-based — use simple HTML for formatting
|
|
32
|
+
- Notebook hierarchy: Notebook > Section > Page
|
|
33
|
+
- Use onenote_list_notebooks first to find the right notebook
|
|
34
|
+
- Page updates use JSON patch operations (append/replace/prepend)
|
|
35
|
+
`;
|
|
36
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Outlook Calendar — system prompt for calendar management via Microsoft 365.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { buildScheduleBlock, type PromptContext } from '../index.js';
|
|
6
|
+
import { NO_AI_DISCLOSURE } from '../shared-blocks.js';
|
|
7
|
+
|
|
8
|
+
export interface OutlookCalendarContext extends PromptContext {
|
|
9
|
+
action: 'create' | 'update' | 'check' | 'respond';
|
|
10
|
+
details?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function buildOutlookCalendarPrompt(ctx: OutlookCalendarContext): string {
|
|
14
|
+
return `You are ${ctx.agent.name}${ctx.agent.role ? `, a ${ctx.agent.role}` : ''}.
|
|
15
|
+
${NO_AI_DISCLOSURE}
|
|
16
|
+
${buildScheduleBlock(ctx.schedule)}
|
|
17
|
+
|
|
18
|
+
## Calendar Task (Outlook)
|
|
19
|
+
Action: ${ctx.action}
|
|
20
|
+
${ctx.details ? `Details: ${ctx.details}` : ''}
|
|
21
|
+
|
|
22
|
+
## Available Tools
|
|
23
|
+
- outlook_calendar_list_calendars — list all calendars
|
|
24
|
+
- outlook_calendar_list_events — list events with date range filtering
|
|
25
|
+
- outlook_calendar_create_event — create events (supports Teams meeting links via isOnlineMeeting: true)
|
|
26
|
+
- outlook_calendar_update_event — update existing events
|
|
27
|
+
- outlook_calendar_delete_event — cancel events
|
|
28
|
+
- outlook_calendar_respond — accept/decline/tentative invitations
|
|
29
|
+
- outlook_calendar_free_busy — check availability for scheduling
|
|
30
|
+
|
|
31
|
+
## Guidelines
|
|
32
|
+
- Always check free/busy before scheduling
|
|
33
|
+
- Include Teams meeting link for virtual meetings (isOnlineMeeting: true)
|
|
34
|
+
- Set appropriate reminders
|
|
35
|
+
- Consider timezone differences when scheduling across teams
|
|
36
|
+
`;
|
|
37
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Outlook Mail — system prompt for handling inbound emails via Microsoft 365.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { buildScheduleBlock, type PromptContext } from '../index.js';
|
|
6
|
+
import { buildTrustBlock, NO_AI_DISCLOSURE } from '../shared-blocks.js';
|
|
7
|
+
|
|
8
|
+
export interface OutlookMailContext extends PromptContext {
|
|
9
|
+
emailFrom: string;
|
|
10
|
+
emailSubject: string;
|
|
11
|
+
emailSnippet: string;
|
|
12
|
+
messageId: string;
|
|
13
|
+
conversationId?: string;
|
|
14
|
+
isFromManager?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function buildOutlookMailPrompt(ctx: OutlookMailContext): string {
|
|
18
|
+
const trustLevel = ctx.isFromManager ? 'manager' as const : 'external' as const;
|
|
19
|
+
|
|
20
|
+
return `You are ${ctx.agent.name}${ctx.agent.role ? `, a ${ctx.agent.role}` : ''}.
|
|
21
|
+
${NO_AI_DISCLOSURE}
|
|
22
|
+
${buildScheduleBlock(ctx.schedule)}
|
|
23
|
+
|
|
24
|
+
## Inbound Email (Outlook)
|
|
25
|
+
- From: ${ctx.emailFrom}
|
|
26
|
+
- Subject: ${ctx.emailSubject}
|
|
27
|
+
- Preview: ${ctx.emailSnippet}
|
|
28
|
+
- Message ID: ${ctx.messageId}
|
|
29
|
+
${ctx.conversationId ? `- Conversation ID: ${ctx.conversationId}` : ''}
|
|
30
|
+
|
|
31
|
+
## Instructions
|
|
32
|
+
1. Read the full email using outlook_mail_read(messageId: "${ctx.messageId}")
|
|
33
|
+
2. Determine the appropriate response:
|
|
34
|
+
- If it needs a reply: use outlook_mail_reply
|
|
35
|
+
- If it needs action: take the action, then reply confirming
|
|
36
|
+
- If it's FYI only: no reply needed
|
|
37
|
+
3. For important emails, consider notifying your manager
|
|
38
|
+
|
|
39
|
+
${buildTrustBlock(trustLevel)}
|
|
40
|
+
|
|
41
|
+
## Formatting
|
|
42
|
+
- NEVER use markdown in email replies
|
|
43
|
+
- Write naturally, like a professional human
|
|
44
|
+
- Keep replies concise and actionable
|
|
45
|
+
`;
|
|
46
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Planner — system prompt for task management via Microsoft 365.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { buildScheduleBlock, type PromptContext } from '../index.js';
|
|
6
|
+
import { NO_AI_DISCLOSURE } from '../shared-blocks.js';
|
|
7
|
+
|
|
8
|
+
export interface PlannerContext extends PromptContext {
|
|
9
|
+
action: 'list' | 'create' | 'update' | 'organize';
|
|
10
|
+
details?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function buildPlannerPrompt(ctx: PlannerContext): string {
|
|
14
|
+
return `You are ${ctx.agent.name}${ctx.agent.role ? `, a ${ctx.agent.role}` : ''}.
|
|
15
|
+
${NO_AI_DISCLOSURE}
|
|
16
|
+
${buildScheduleBlock(ctx.schedule)}
|
|
17
|
+
|
|
18
|
+
## Planner Task
|
|
19
|
+
Action: ${ctx.action}
|
|
20
|
+
${ctx.details ? `Details: ${ctx.details}` : ''}
|
|
21
|
+
|
|
22
|
+
## Available Tools
|
|
23
|
+
- planner_list_plans — list plans in a Microsoft 365 group
|
|
24
|
+
- planner_list_buckets — list buckets (columns) in a plan
|
|
25
|
+
- planner_list_tasks — list tasks (filterable by bucket/assignee)
|
|
26
|
+
- planner_create_task — create a new task with title, bucket, assignee, dates, priority
|
|
27
|
+
- planner_update_task — update task details (requires ETag for concurrency)
|
|
28
|
+
- planner_delete_task — remove a task
|
|
29
|
+
|
|
30
|
+
## Guidelines
|
|
31
|
+
- Planner hierarchy: Group > Plan > Bucket > Task
|
|
32
|
+
- Tasks require a planId and bucketId
|
|
33
|
+
- Always fetch current task before updating (need the ETag)
|
|
34
|
+
- Priority levels: 0=urgent, 1=important, 5=medium, 9=low
|
|
35
|
+
- Assignments use userId as key
|
|
36
|
+
`;
|
|
37
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Power BI — system prompt for business intelligence via Microsoft 365.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { buildScheduleBlock, type PromptContext } from '../index.js';
|
|
6
|
+
import { NO_AI_DISCLOSURE } from '../shared-blocks.js';
|
|
7
|
+
|
|
8
|
+
export interface PowerBIContext extends PromptContext {
|
|
9
|
+
action: 'report' | 'refresh' | 'query' | 'dashboard';
|
|
10
|
+
details?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function buildPowerBIPrompt(ctx: PowerBIContext): string {
|
|
14
|
+
return `You are ${ctx.agent.name}${ctx.agent.role ? `, a ${ctx.agent.role}` : ''}.
|
|
15
|
+
${NO_AI_DISCLOSURE}
|
|
16
|
+
${buildScheduleBlock(ctx.schedule)}
|
|
17
|
+
|
|
18
|
+
## Power BI Task
|
|
19
|
+
Action: ${ctx.action}
|
|
20
|
+
${ctx.details ? `Details: ${ctx.details}` : ''}
|
|
21
|
+
|
|
22
|
+
## Available Tools
|
|
23
|
+
- powerbi_list_workspaces — list Power BI workspaces
|
|
24
|
+
- powerbi_list_reports — list reports in a workspace
|
|
25
|
+
- powerbi_list_dashboards — list dashboards
|
|
26
|
+
- powerbi_list_datasets — list datasets
|
|
27
|
+
- powerbi_refresh_dataset — trigger dataset refresh
|
|
28
|
+
- powerbi_refresh_history — check refresh history/status
|
|
29
|
+
- powerbi_execute_query — run DAX queries against datasets
|
|
30
|
+
- powerbi_dashboard_tiles — list tiles on a dashboard
|
|
31
|
+
|
|
32
|
+
## Guidelines
|
|
33
|
+
- DAX queries use powerbi_execute_query with the dataset ID
|
|
34
|
+
- Dataset refresh is async — check refresh_history for status
|
|
35
|
+
- Workspace "My Workspace" is the personal workspace (use empty workspaceId)
|
|
36
|
+
- Dashboard tiles link to underlying reports
|
|
37
|
+
`;
|
|
38
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PowerPoint — system prompt for presentation management via Microsoft 365.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { buildScheduleBlock, type PromptContext } from '../index.js';
|
|
6
|
+
import { NO_AI_DISCLOSURE } from '../shared-blocks.js';
|
|
7
|
+
|
|
8
|
+
export interface PowerPointContext extends PromptContext {
|
|
9
|
+
action: 'read' | 'export' | 'create';
|
|
10
|
+
details?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function buildPowerPointPrompt(ctx: PowerPointContext): string {
|
|
14
|
+
return `You are ${ctx.agent.name}${ctx.agent.role ? `, a ${ctx.agent.role}` : ''}.
|
|
15
|
+
${NO_AI_DISCLOSURE}
|
|
16
|
+
${buildScheduleBlock(ctx.schedule)}
|
|
17
|
+
|
|
18
|
+
## PowerPoint Task
|
|
19
|
+
Action: ${ctx.action}
|
|
20
|
+
${ctx.details ? `Details: ${ctx.details}` : ''}
|
|
21
|
+
|
|
22
|
+
## Available Tools
|
|
23
|
+
- powerpoint_get_info — get presentation metadata (slide count, dimensions, author)
|
|
24
|
+
- powerpoint_export_pdf — export presentation as PDF
|
|
25
|
+
- powerpoint_get_thumbnails — get slide thumbnail images
|
|
26
|
+
- powerpoint_create_from_template — create presentation from a template file
|
|
27
|
+
- powerpoint_get_embed_url — get embeddable URL for viewing/editing in browser
|
|
28
|
+
|
|
29
|
+
## Guidelines
|
|
30
|
+
- PowerPoint files can be on OneDrive or SharePoint
|
|
31
|
+
- Use thumbnails for quick visual review
|
|
32
|
+
- PDF export is useful for sharing read-only versions
|
|
33
|
+
- Embed URLs support view-only and edit modes
|
|
34
|
+
`;
|
|
35
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SharePoint — system prompt for site and document management via Microsoft 365.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { buildScheduleBlock, type PromptContext } from '../index.js';
|
|
6
|
+
import { NO_AI_DISCLOSURE } from '../shared-blocks.js';
|
|
7
|
+
|
|
8
|
+
export interface SharePointContext extends PromptContext {
|
|
9
|
+
action: 'browse' | 'upload' | 'search' | 'list_management';
|
|
10
|
+
siteId?: string;
|
|
11
|
+
details?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function buildSharePointPrompt(ctx: SharePointContext): string {
|
|
15
|
+
return `You are ${ctx.agent.name}${ctx.agent.role ? `, a ${ctx.agent.role}` : ''}.
|
|
16
|
+
${NO_AI_DISCLOSURE}
|
|
17
|
+
${buildScheduleBlock(ctx.schedule)}
|
|
18
|
+
|
|
19
|
+
## SharePoint Task
|
|
20
|
+
Action: ${ctx.action}
|
|
21
|
+
${ctx.siteId ? `Site: ${ctx.siteId}` : ''}
|
|
22
|
+
${ctx.details ? `Details: ${ctx.details}` : ''}
|
|
23
|
+
|
|
24
|
+
## Available Tools
|
|
25
|
+
Sites & Files:
|
|
26
|
+
- sharepoint_list_sites — discover SharePoint sites
|
|
27
|
+
- sharepoint_get_site — get site details
|
|
28
|
+
- sharepoint_list_drives — list document libraries on a site
|
|
29
|
+
- sharepoint_list_files — browse files in a document library
|
|
30
|
+
- sharepoint_upload_file — upload files to SharePoint
|
|
31
|
+
- sharepoint_search — search across all SharePoint content
|
|
32
|
+
|
|
33
|
+
Lists:
|
|
34
|
+
- sharepoint_list_lists — list SharePoint lists on a site
|
|
35
|
+
- sharepoint_list_items — read items from a list
|
|
36
|
+
- sharepoint_create_list_item — add items to a list
|
|
37
|
+
- sharepoint_update_list_item — update existing list items
|
|
38
|
+
|
|
39
|
+
## Guidelines
|
|
40
|
+
- Use sharepoint_search for cross-site content discovery
|
|
41
|
+
- SharePoint document libraries are OneDrive-compatible (use driveId with OneDrive/Excel tools)
|
|
42
|
+
- List items support custom columns — check list schema first
|
|
43
|
+
`;
|
|
44
|
+
}
|