dsh-aimail 0.1.16 → 0.1.18

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 CHANGED
@@ -20,6 +20,7 @@ import { createServer } from 'node:http';
20
20
  import { randomUUID } from 'node:crypto';
21
21
  import { createUserMessage } from '@deepseek-ai/dsh-llm';
22
22
  import { processInboundMail, verifySignature, routeAddressFromHeaders, updateAgentConfig, loadAgentConfig, saveAgentConfig } from '@aimail/mail-core';
23
+ import { ensureBridgeRoutesForSystem, formatBridgeRouteLine, isBridgeRouteWarning } from '@aimail/mail-core';
23
24
  export const name = 'mail-inbound';
24
25
  export const inject = ['mail', 'agents'];
25
26
  function writeJson(res, code, body) {
@@ -56,7 +57,7 @@ export function apply(ctx, config = {}) {
56
57
  const from = path.join(skillSrc, f);
57
58
  const to = path.join(skillDst, f);
58
59
  if (!fs.existsSync(from)) {
59
- // 包内资源缺失 = 打包/物化缺陷: 响亮但不阻断入站处理
60
+ // missing package resources = packaging/materialize defect: loud but must not block inbound handling
60
61
  console.error(`[dsh-aimail] skill resource missing: ${from} ` +
61
62
  '(repo: run scripts/materialize-resources.sh; installed: reinstall the package)');
62
63
  continue;
@@ -204,7 +205,28 @@ export function apply(ctx, config = {}) {
204
205
  writeJson(res, 500, { status: 'error', detail: e instanceof Error ? e.message : String(e) });
205
206
  }
206
207
  });
207
- server.listen(port, host);
208
+ server.listen(port, host, () => {
209
+ // Route side (owner ruling 2026-09-27): the listener is up, so this is the
210
+ // moment to (re-)pair every address of this system. The bridge deletes
211
+ // routes whose target stays unreachable (probe interval x fail_threshold,
212
+ // ~30s x 6 = 180s) and registration-time pushes are too early — the cache of
213
+ // that was a permanently dead inbound after a host restart (production
214
+ // 2026-09-21/09-26). Idempotent, never fatal; the target is each binding's
215
+ // own webhook_url (shared implementation with openclaw/pi).
216
+ void ensureBridgeRoutesForSystem()
217
+ .then((outcomes) => {
218
+ for (const o of outcomes) {
219
+ const line = `[dsh-aimail] ${formatBridgeRouteLine(o)}`;
220
+ if (isBridgeRouteWarning(o))
221
+ console.warn(line);
222
+ else
223
+ console.log(line);
224
+ }
225
+ })
226
+ .catch((e) => {
227
+ console.warn(`[dsh-aimail] route ensure failed: ${e instanceof Error ? e.message : String(e)}`);
228
+ });
229
+ });
208
230
  return () => {
209
231
  server.close();
210
232
  };
@@ -65,7 +65,7 @@ export function apply(ctx, config = {}) {
65
65
  releaseAllSystems(path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'resources', 'board'));
66
66
  }
67
67
  catch (e) {
68
- // 非致命(资源是种子, 可再次显式释放), 但绝不静默
68
+ // non-fatal (resources are seeds, can be re-released explicitly), but never silent
69
69
  console.error(`[dsh-aimail] board resource release failed: ${String(e)}`);
70
70
  }
71
71
  // install readiness: a dsh-only machine ensures its system through the CLI
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.16",
4
+ "version": "0.1.18",
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.16",
55
- "@aimail/mail": "^0.1.16"
54
+ "@aimail/mail-core": "^0.1.18",
55
+ "@aimail/mail": "^0.1.18"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@deepseek-ai/cordis": "^4.0.1",