dsh-aimail 0.1.13 → 0.1.15

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.
@@ -1,5 +1,5 @@
1
1
  import { resolveByRecipient, resolveByEmail, resolveBySessionId, } from '@aimail/mail';
2
- import { autoBind, emailForAgent, ensureSystem, hasAnySystem, listSystemDirs, readSystemConfig, releaseAllSystems, } from '@aimail/mail-core';
2
+ import { autoBind, emailForAgent, ensureSystem, detectSystemForHome, hasAnySystem, listSystemDirs, readSystemConfig, releaseAllSystems, } from '@aimail/mail-core';
3
3
  import * as os from 'node:os';
4
4
  import * as path from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
@@ -68,7 +68,7 @@ export function apply(ctx, config = {}) {
68
68
  // non-fatal: resources are a seed; explicit release can re-run later
69
69
  }
70
70
  // install readiness: a dsh-only machine ensures its system through the CLI
71
- // reverse-call ABI (`aimail ensure-system`, L1 only — never platform wiring,
71
+ // reverse-call ABI (`aimail install --system-only`, L1 only — never platform wiring,
72
72
  // which is how the install↔plugin call loop stays acyclic). UNCONDITIONAL
73
73
  // reverse-call (ownership short-circuit lives inside ensureSystem): a
74
74
  // multi-platform machine with only ANOTHER platform's systems must still
@@ -79,20 +79,33 @@ export function apply(ctx, config = {}) {
79
79
  const platformHome = process.env.AIMAIL_SYSTEM_HOME?.trim() ||
80
80
  process.env.DSH_HOME?.trim() ||
81
81
  path.join(os.homedir(), '.dsh');
82
- void ensureSystem({ systemHome: platformHome })
82
+ // Bound-machine guard (2026-09-22): if this home already OWNS a system
83
+ // (platform pointer first, then the system_home scan — the same judgement
84
+ // the CLI makes), do not reverse-call at all. A stale activation code left
85
+ // in the environment then can no longer surface as a bogus startup error on
86
+ // a machine that is already bound ("no aimail system yet — Invalid
87
+ // activation code", the 2026-09-21 dsh report).
88
+ // Home-keyed, not "any system exists": another platform's systems do not
89
+ // claim this home, so a multi-platform machine still reaches the CLI
90
+ // (AUDIT-1 P1-7 must stay fixed).
91
+ void detectSystemForHome(platformHome)
92
+ .then((bound) => (bound ? null : ensureSystem({ systemHome: platformHome })))
83
93
  .then((r) => {
94
+ if (!r)
95
+ return;
84
96
  if (r.ok) {
85
97
  if (r.activated) {
86
98
  console.log(`[dsh-aimail] system activated: ${r.systemId}`);
87
99
  }
100
+ return;
88
101
  }
89
- else {
90
- const hint = r.hint ? ` (${r.hint})` : '';
91
- console.warn(`[dsh-aimail] no aimail system yet — ${r.error ?? 'unknown'}` + hint);
92
- }
102
+ // Readable + actionable: say what is missing, then how to fix it.
103
+ const hint = r.hint ? `\n hint: ${r.hint}` : '';
104
+ console.warn(`[dsh-aimail] no AIMail system is bound to this dsh home yet: ${r.error ?? 'unknown'}${hint}` +
105
+ `\n to activate: aimail install --home ${platformHome} -c <activation-code> -m <manager@address>`);
93
106
  })
94
107
  .catch((e) => {
95
- console.warn(`[dsh-aimail] system ensure failed: ${e instanceof Error ? e.message : String(e)}`);
108
+ console.warn(`[dsh-aimail] AIMail system check failed: ${e instanceof Error ? e.message : String(e)}`);
96
109
  });
97
110
  }
98
111
  catch {
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.13",
4
+ "version": "0.1.15",
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.13",
55
- "@aimail/mail": "^0.1.13"
54
+ "@aimail/mail-core": "^0.1.15",
55
+ "@aimail/mail": "^0.1.15"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@deepseek-ai/cordis": "^4.0.1",
@@ -35,6 +35,21 @@ Each inbound email arrives as a JSON message. Key fields:
35
35
  | `thread_summary` | Snapshot of active topics, decisions, and pending actions from previous exchanges. Pre-loaded from the last `set_email_summary` call. |
36
36
  | `attachments` | Local file paths. DOCX/XLSX/HTML/PDF have extracted `.md` versions alongside. Use `read_file` to inspect. |
37
37
 
38
+ ### System Mail (welcome & command confirmations)
39
+
40
+ Two system emails (`noreply@<your-domain>`) carry operational meaning beyond the conversation:
41
+
42
+ - **Welcome** — subject `Welcome to AIMail World, <you>, since <date>!`, sent when your address becomes active. **Reply-all** with exactly these three labelled lines so your manager can review and apply your outbound identity:
43
+
44
+ ```
45
+ persona: <one to three sentences introducing who you are and what you do>
46
+ signature: <your outbound email signature>
47
+ current_time: <the current time when you reply, human-readable, e.g. 2026-09-23 10:30 UTC>
48
+ ```
49
+
50
+ Once your manager applies it, the result is your `my_profile` (your manager is the only party who can change it).
51
+ - **Command confirmations** — subject `[AIMail] Command applied: …` or `[AIMail] Command failed: …`. These acknowledge a command email a manager sent about you (approve persona / add contact / remove contact). No reply, no action.
52
+
38
53
  ---
39
54
 
40
55
  ## Processing Flow