dsh-aimail 0.1.11 → 0.1.12-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/inbound.js +29 -0
- package/package.json +3 -3
package/lib/inbound.js
CHANGED
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
* continuity is aimail's (local meta threading), not the session's.
|
|
13
13
|
* 200 ack on delivery; 503 on session-create failure (bridge retries).
|
|
14
14
|
*/
|
|
15
|
+
import * as fs from 'node:fs';
|
|
16
|
+
import * as os from 'node:os';
|
|
17
|
+
import * as path from 'node:path';
|
|
18
|
+
import { fileURLToPath } from 'node:url';
|
|
15
19
|
import { createServer } from 'node:http';
|
|
16
20
|
import { randomUUID } from 'node:crypto';
|
|
17
21
|
import { createUserMessage } from '@deepseek-ai/dsh-llm';
|
|
@@ -36,6 +40,31 @@ export function apply(ctx, config = {}) {
|
|
|
36
40
|
if (mail === undefined) {
|
|
37
41
|
throw new Error('mail-inbound requires the mail service: mount dsh-aimail/mail-service first');
|
|
38
42
|
}
|
|
43
|
+
// SDK-shipped skill → <dshHome>/skills/agentmail/ (idempotent;
|
|
44
|
+
// identical-content skip; dshHome resolution mirrors mail-service).
|
|
45
|
+
// SKILL.md owns the inbound-message protocol (6-step flow) — a
|
|
46
|
+
// different category from tool registration (tool usage). Symmetric
|
|
47
|
+
// across openclaw/dsh/pi.
|
|
48
|
+
try {
|
|
49
|
+
const dshHome = process.env.AIMAIL_SYSTEM_HOME?.trim() ||
|
|
50
|
+
process.env.DSH_HOME?.trim() ||
|
|
51
|
+
path.join(os.homedir(), '.dsh');
|
|
52
|
+
const skillSrc = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'resources', 'skills');
|
|
53
|
+
const skillDst = path.join(dshHome, 'skills', 'agentmail');
|
|
54
|
+
fs.mkdirSync(skillDst, { recursive: true });
|
|
55
|
+
for (const f of ['SKILL.md', 'DESCRIPTION.md']) {
|
|
56
|
+
const from = path.join(skillSrc, f);
|
|
57
|
+
const to = path.join(skillDst, f);
|
|
58
|
+
if (!fs.existsSync(from))
|
|
59
|
+
continue;
|
|
60
|
+
if (fs.existsSync(to) && fs.readFileSync(from).equals(fs.readFileSync(to)))
|
|
61
|
+
continue;
|
|
62
|
+
fs.copyFileSync(from, to);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
// non-fatal; retried on next plugin start
|
|
67
|
+
}
|
|
39
68
|
const host = config.host ?? '127.0.0.1';
|
|
40
69
|
const port = config.port ?? Number(process.env.AIMAIL_INBOUND_PORT ?? 9099);
|
|
41
70
|
const deliverPath = config.path ?? '/aimail/inbound';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-aimail",
|
|
3
3
|
"description": "AIMail plugin for dsh — install via: dsh plugin --profile web add dsh-aimail",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.12-rc.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"provenance": true
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"@deepseek-ai/dsh-tools": "^0.0.1-rc.1"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@aimail/mail-core": "^0.1.
|
|
55
|
-
"@aimail/mail": "^0.1.
|
|
54
|
+
"@aimail/mail-core": "^0.1.12-rc.1",
|
|
55
|
+
"@aimail/mail": "^0.1.12-rc.1"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@deepseek-ai/cordis": "^4.0.1",
|