@monoes/monomindcli 2.10.29 → 2.10.31
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/.claude/helpers/graphify-freshen.cjs +11 -12
- package/.claude/helpers/handlers/capture-handler.cjs +1 -1
- package/dist/src/commands/analyze-diff.d.ts.map +1 -1
- package/dist/src/commands/analyze-diff.js +6 -0
- package/dist/src/commands/analyze-diff.js.map +1 -1
- package/dist/src/commands/doctor-project-checks.d.ts.map +1 -1
- package/dist/src/commands/doctor-project-checks.js +73 -2
- package/dist/src/commands/doctor-project-checks.js.map +1 -1
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/mcp.d.ts.map +1 -1
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/org-observe.d.ts +15 -7
- package/dist/src/commands/org-observe.d.ts.map +1 -1
- package/dist/src/commands/org-observe.js +208 -63
- package/dist/src/commands/org-observe.js.map +1 -1
- package/dist/src/commands/org.d.ts.map +1 -1
- package/dist/src/commands/org.js +57 -4
- package/dist/src/commands/org.js.map +1 -1
- package/dist/src/commands/status.d.ts.map +1 -1
- package/dist/src/commands/status.js +11 -2
- package/dist/src/commands/status.js.map +1 -1
- package/dist/src/mcp-tools/system-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/system-tools.js.map +1 -1
- package/dist/src/memory/memory-kg.d.ts.map +1 -1
- package/dist/src/memory/memory-kg.js +10 -2
- package/dist/src/memory/memory-kg.js.map +1 -1
- package/dist/src/orgrt/agent-exec.d.ts.map +1 -1
- package/dist/src/orgrt/agent-exec.js +18 -9
- package/dist/src/orgrt/agent-exec.js.map +1 -1
- package/dist/src/orgrt/antigravity-runner.d.ts.map +1 -1
- package/dist/src/orgrt/antigravity-runner.js +32 -7
- package/dist/src/orgrt/antigravity-runner.js.map +1 -1
- package/dist/src/orgrt/approvals.d.ts +15 -1
- package/dist/src/orgrt/approvals.d.ts.map +1 -1
- package/dist/src/orgrt/approvals.js +76 -11
- package/dist/src/orgrt/approvals.js.map +1 -1
- package/dist/src/orgrt/broker.d.ts +10 -2
- package/dist/src/orgrt/broker.d.ts.map +1 -1
- package/dist/src/orgrt/broker.js +20 -5
- package/dist/src/orgrt/broker.js.map +1 -1
- package/dist/src/orgrt/checkpoint.d.ts.map +1 -1
- package/dist/src/orgrt/checkpoint.js.map +1 -1
- package/dist/src/orgrt/cross-org.d.ts +15 -2
- package/dist/src/orgrt/cross-org.d.ts.map +1 -1
- package/dist/src/orgrt/cross-org.js +169 -16
- package/dist/src/orgrt/cross-org.js.map +1 -1
- package/dist/src/orgrt/daemon.d.ts +39 -4
- package/dist/src/orgrt/daemon.d.ts.map +1 -1
- package/dist/src/orgrt/daemon.js +135 -21
- package/dist/src/orgrt/daemon.js.map +1 -1
- package/dist/src/orgrt/decisions.d.ts.map +1 -1
- package/dist/src/orgrt/decisions.js +13 -1
- package/dist/src/orgrt/decisions.js.map +1 -1
- package/dist/src/orgrt/endpoint-roles.d.ts +86 -0
- package/dist/src/orgrt/endpoint-roles.d.ts.map +1 -0
- package/dist/src/orgrt/endpoint-roles.js +364 -0
- package/dist/src/orgrt/endpoint-roles.js.map +1 -0
- package/dist/src/orgrt/hermes-runner.d.ts +17 -0
- package/dist/src/orgrt/hermes-runner.d.ts.map +1 -0
- package/dist/src/orgrt/hermes-runner.js +324 -0
- package/dist/src/orgrt/hermes-runner.js.map +1 -0
- package/dist/src/orgrt/inbox.d.ts +18 -0
- package/dist/src/orgrt/inbox.d.ts.map +1 -1
- package/dist/src/orgrt/inbox.js +73 -0
- package/dist/src/orgrt/inbox.js.map +1 -1
- package/dist/src/orgrt/migrate.d.ts.map +1 -1
- package/dist/src/orgrt/migrate.js +3 -0
- package/dist/src/orgrt/migrate.js.map +1 -1
- package/dist/src/orgrt/opencode-runner.d.ts.map +1 -1
- package/dist/src/orgrt/opencode-runner.js +24 -8
- package/dist/src/orgrt/opencode-runner.js.map +1 -1
- package/dist/src/orgrt/pi-rpc-runner.d.ts.map +1 -1
- package/dist/src/orgrt/pi-rpc-runner.js +145 -10
- package/dist/src/orgrt/pi-rpc-runner.js.map +1 -1
- package/dist/src/orgrt/policy.d.ts +22 -1
- package/dist/src/orgrt/policy.d.ts.map +1 -1
- package/dist/src/orgrt/policy.js +36 -4
- package/dist/src/orgrt/policy.js.map +1 -1
- package/dist/src/orgrt/questions.d.ts +3 -1
- package/dist/src/orgrt/questions.d.ts.map +1 -1
- package/dist/src/orgrt/questions.js +19 -3
- package/dist/src/orgrt/questions.js.map +1 -1
- package/dist/src/orgrt/qwen-rpc-runner.d.ts.map +1 -1
- package/dist/src/orgrt/qwen-rpc-runner.js +22 -8
- package/dist/src/orgrt/qwen-rpc-runner.js.map +1 -1
- package/dist/src/orgrt/role-slot.d.ts +1 -2
- package/dist/src/orgrt/role-slot.d.ts.map +1 -1
- package/dist/src/orgrt/role-slot.js +3 -1
- package/dist/src/orgrt/role-slot.js.map +1 -1
- package/dist/src/orgrt/runner-registry.d.ts.map +1 -1
- package/dist/src/orgrt/runner-registry.js +45 -9
- package/dist/src/orgrt/runner-registry.js.map +1 -1
- package/dist/src/orgrt/scheduler-integration.d.ts.map +1 -1
- package/dist/src/orgrt/scheduler-integration.js +8 -1
- package/dist/src/orgrt/scheduler-integration.js.map +1 -1
- package/dist/src/orgrt/server.d.ts.map +1 -1
- package/dist/src/orgrt/server.js +43 -8
- package/dist/src/orgrt/server.js.map +1 -1
- package/dist/src/orgrt/session.d.ts +12 -1
- package/dist/src/orgrt/session.d.ts.map +1 -1
- package/dist/src/orgrt/session.js +20 -3
- package/dist/src/orgrt/session.js.map +1 -1
- package/dist/src/orgrt/tool-providers.d.ts +110 -0
- package/dist/src/orgrt/tool-providers.d.ts.map +1 -0
- package/dist/src/orgrt/tool-providers.js +617 -0
- package/dist/src/orgrt/tool-providers.js.map +1 -0
- package/dist/src/orgrt/types.d.ts +75 -0
- package/dist/src/orgrt/types.d.ts.map +1 -1
- package/dist/src/orgrt/types.js +58 -0
- package/dist/src/orgrt/types.js.map +1 -1
- package/dist/src/protocol-capabilities.d.ts +7 -1
- package/dist/src/protocol-capabilities.d.ts.map +1 -1
- package/dist/src/protocol-capabilities.js +15 -1
- package/dist/src/protocol-capabilities.js.map +1 -1
- package/dist/src/ui/routes-org.mjs +9 -7
- package/dist/src/utils/native-error.d.ts +12 -0
- package/dist/src/utils/native-error.d.ts.map +1 -1
- package/dist/src/utils/native-error.js +30 -6
- package/dist/src/utils/native-error.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/src/orgrt/broker.js
CHANGED
|
@@ -2,9 +2,19 @@
|
|
|
2
2
|
// monolean: file-based local broker for cross-process org discovery (different
|
|
3
3
|
// `monomind org` processes / project directories, same machine). Upgrade path:
|
|
4
4
|
// a real network registry when cross-machine discovery is needed.
|
|
5
|
-
import { mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
5
|
+
import { mkdirSync, readFileSync, realpathSync, renameSync, unlinkSync, writeFileSync, } from 'node:fs';
|
|
6
6
|
import { homedir } from 'node:os';
|
|
7
|
-
import { join } from 'node:path';
|
|
7
|
+
import { join, resolve } from 'node:path';
|
|
8
|
+
/** M4: canonical form of a project root for trust-domain comparison. */
|
|
9
|
+
export function normalizeRoot(root) {
|
|
10
|
+
const abs = resolve(root);
|
|
11
|
+
try {
|
|
12
|
+
return realpathSync(abs);
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return abs;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
8
18
|
// DNS label limits: 1-63 chars, must start alphanumerically (RFC 1034 + RFC 1123)
|
|
9
19
|
// Requires at least 2 chars total (backward compatibility with original regex)
|
|
10
20
|
const SAFE_NAME = /^[a-z0-9][a-z0-9_-]{1,63}$/i;
|
|
@@ -68,7 +78,7 @@ export function removeOperatorCredential(name, dir = defaultOperatorDir()) {
|
|
|
68
78
|
/** Publish that this process hosts org `name`, reachable via `url`. Call again periodically (heartbeat) — see BrokerLease.
|
|
69
79
|
* Writes via tmp+rename (same-directory rename is atomic on POSIX/NTFS) so a concurrent lookupOrg() never observes a
|
|
70
80
|
* partially-written entry — this file is rewritten every heartbeat (default 20s) while other processes may read it. */
|
|
71
|
-
export function registerOrg(name, url, dir = defaultRegistryDir(), credential) {
|
|
81
|
+
export function registerOrg(name, url, dir = defaultRegistryDir(), credential, root) {
|
|
72
82
|
mkdirSync(dir, { recursive: true });
|
|
73
83
|
const normalizedCred = normalizeCredential(credential);
|
|
74
84
|
const entry = {
|
|
@@ -76,6 +86,7 @@ export function registerOrg(name, url, dir = defaultRegistryDir(), credential) {
|
|
|
76
86
|
pid: process.pid,
|
|
77
87
|
updatedAt: Date.now(),
|
|
78
88
|
...(normalizedCred ? { credential: normalizedCred } : {}),
|
|
89
|
+
...(root ? { root: normalizeRoot(root) } : {}),
|
|
79
90
|
};
|
|
80
91
|
// SEC: the entry carries this org's agent credential in plaintext —
|
|
81
92
|
// restrict to owner-only so other local users can't read it off disk.
|
|
@@ -113,17 +124,21 @@ export class BrokerLease {
|
|
|
113
124
|
intervalMs;
|
|
114
125
|
credential;
|
|
115
126
|
operator;
|
|
127
|
+
root;
|
|
116
128
|
timer = null;
|
|
117
|
-
constructor(name, url, dir = defaultRegistryDir(), intervalMs = 20_000, credential, operator
|
|
129
|
+
constructor(name, url, dir = defaultRegistryDir(), intervalMs = 20_000, credential, operator,
|
|
130
|
+
/** M4: the daemon's project root, published in the registry entry. */
|
|
131
|
+
root) {
|
|
118
132
|
this.name = name;
|
|
119
133
|
this.url = url;
|
|
120
134
|
this.dir = dir;
|
|
121
135
|
this.intervalMs = intervalMs;
|
|
122
136
|
this.credential = credential;
|
|
123
137
|
this.operator = operator;
|
|
138
|
+
this.root = root;
|
|
124
139
|
}
|
|
125
140
|
publish() {
|
|
126
|
-
registerOrg(this.name, this.url, this.dir, this.credential);
|
|
141
|
+
registerOrg(this.name, this.url, this.dir, this.credential, this.root);
|
|
127
142
|
if (this.operator)
|
|
128
143
|
writeOperatorCredential(this.name, this.operator.credential, this.operator.dir);
|
|
129
144
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"broker.js","sourceRoot":"","sources":["../../../src/orgrt/broker.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,+EAA+E;AAC/E,+EAA+E;AAC/E,kEAAkE;AAClE,OAAO,
|
|
1
|
+
{"version":3,"file":"broker.js","sourceRoot":"","sources":["../../../src/orgrt/broker.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,+EAA+E;AAC/E,+EAA+E;AAC/E,kEAAkE;AAClE,OAAO,EACL,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAW1C,wEAAwE;AACxE,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC;AAED,kFAAkF;AAClF,+EAA+E;AAC/E,MAAM,SAAS,GAAG,6BAA6B,CAAC;AAChD,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEhC,4EAA4E;AAC5E,MAAM,UAAU,mBAAmB,CAAC,IAAwB;IAC1D,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAC1D,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,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AAC,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,GAAG,MAAM,CAG/E;AAeD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAIhF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,UAAU,EACf,UAAU,EAAE,aAAa,EACzB,gBAAgB,GAAE,OAAc,EAChC,aAAa,GAAE,OAAc,GAC5B,IAAI,CAwCN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint.js","sourceRoot":"","sources":["../../../src/orgrt/checkpoint.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,kFAAkF;AAElF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAgExD;;;wEAGwE;AACxE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAEpC,4BAA4B;AAC5B,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,mBAAmB;AAEzE;;;yEAGyE;AACzE,SAAS,iBAAiB,CACxB,
|
|
1
|
+
{"version":3,"file":"checkpoint.js","sourceRoot":"","sources":["../../../src/orgrt/checkpoint.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,kFAAkF;AAElF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAgExD;;;wEAGwE;AACxE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAEpC,4BAA4B;AAC5B,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,mBAAmB;AAEzE;;;yEAGyE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ACvE,qEAAqE;QACrE,qCAAqC;QACrC,IACE,SAAS,CAAC,aAAa;YACvB,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ;YACzB,CAAC,wBAAwB,CAAC,SAAS,CAAC,kBAAkB,CAAC,EACvD,CAAC;YACD,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;QACtD,CAAC;QAED,gCAAgC;QAChC,IAAI,aAAa,IAAI,SAAS,CAAC,UAAU,GAAG,CAAC,EAAE,CAAC;YAC9C,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;YAC1C,MAAM,IAAI,GAAG,SAAS,CAAC,UAAU,GAAG,YAAY,CAAC;YACjD,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;gBACb,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;QAED,mBAAmB;QACnB,OAAO,CAAC,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC;QAC5C,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,aAAa,CAAC;QAChD,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;QAClC,IAAI,SAAS,CAAC,KAAK;YAAE,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC;IACvD,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type OrgDaemon, type RunningOrg } from './daemon.js';
|
|
2
|
+
/** `federation.allow_*` membership: absent list = unrestricted, '*' = any. */
|
|
3
|
+
export declare function federationAllows(list: string[] | undefined, org: string): boolean;
|
|
2
4
|
/**
|
|
3
5
|
* Resolves an org_send `to` address ("role" for same-org, "org:role" for
|
|
4
6
|
* cross-org) into its parts. Centralizes the one addressing rule that
|
|
@@ -25,11 +27,22 @@ export declare function mailBody(root: string, orgName: string, org: RunningOrg
|
|
|
25
27
|
* emitted the audit event) or the recipient can't take mail. */
|
|
26
28
|
export declare function pushMessage(daemon: OrgDaemon, orgName: string, org: RunningOrg, toRole: string, from: string, subject: string, body: string, id: string): Promise<boolean>;
|
|
27
29
|
/** Route a message. to = "role" (same org) or "org:role" (cross-org). Returns a receipt string. */
|
|
28
|
-
export declare function deliver(daemon: OrgDaemon, fromOrg: string, fromRole: string, to: string, subject: string, body: string
|
|
30
|
+
export declare function deliver(daemon: OrgDaemon, fromOrg: string, fromRole: string, to: string, subject: string, body: string, opts?: {
|
|
31
|
+
messageId?: string;
|
|
32
|
+
}): Promise<string>;
|
|
33
|
+
export interface ReceiveRemoteOpts {
|
|
34
|
+
/** The caller presented the OPERATOR credential: skip the broker sender
|
|
35
|
+
* identity check and trust `fromQualified` as given (M3). */
|
|
36
|
+
operator?: boolean;
|
|
37
|
+
/** Origin message id (M3) — generated here when the sender sent none. */
|
|
38
|
+
messageId?: string;
|
|
39
|
+
/** M4: the sending daemon's project root (xdeliver body `fromRoot`). */
|
|
40
|
+
fromRoot?: string;
|
|
41
|
+
}
|
|
29
42
|
/** Inbound handler for cross-process delivery — called by the server's POST /api/xdeliver route
|
|
30
43
|
* when ANOTHER process's deliverRemote() reaches this daemon. Pushes straight into the target
|
|
31
44
|
* agent's mailbox; the agent picks it up on its own next turn (see Mailbox — never interrupts). */
|
|
32
|
-
export declare function receiveRemote(daemon: OrgDaemon, toOrg: string, toRole: string, fromQualified: string, subject: string, body: string, fromCredential?: string): Promise<{
|
|
45
|
+
export declare function receiveRemote(daemon: OrgDaemon, toOrg: string, toRole: string, fromQualified: string, subject: string, body: string, fromCredential?: string, opts?: ReceiveRemoteOpts): Promise<{
|
|
33
46
|
ok: true;
|
|
34
47
|
receipt: string;
|
|
35
48
|
} | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cross-org.d.ts","sourceRoot":"","sources":["../../../src/orgrt/cross-org.ts"],"names":[],"mappings":"AAOA,OAAO,EAAmB,KAAK,SAAS,EAAE,KA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EAAE,MAAM,CAAA;CAAO,GAChC,OAAO,CAAC,MAAM,CAAC,CA6RjB;AAwMD,MAAM,WAAW,iBAAiB;IAChC;kEAC8D;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;oGAEoG;AACpG,wBAAsB,aAAa,CACjC,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,cAAc,CAAC,EAAE,MAAM,EACvB,IAAI,GAAE,iBAAsB,GAC3B,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CA6NvE"}
|
|
@@ -1,14 +1,40 @@
|
|
|
1
1
|
// packages/@monomind/cli/src/orgrt/cross-org.ts
|
|
2
2
|
// Extracted from daemon.ts — message delivery, cross-org routing, remote delivery.
|
|
3
3
|
import { timingSafeEqual } from 'node:crypto';
|
|
4
|
-
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
5
5
|
import { join } from 'node:path';
|
|
6
6
|
import { checkResources, waitForCapacity } from '../utils/resource-governor.js';
|
|
7
|
-
import { lookupOrg } from './broker.js';
|
|
7
|
+
import { lookupOrg, normalizeRoot } from './broker.js';
|
|
8
8
|
import { activeRoleCount } from './daemon.js';
|
|
9
|
+
import { clearEndpointWait, deliverToEndpoint, findEndpointRole } from './endpoint-roles.js';
|
|
9
10
|
import { scanMessage } from './fence.js';
|
|
10
|
-
import { queueMessage } from './inbox.js';
|
|
11
|
+
import { newMessageId, queueMessage } from './inbox.js';
|
|
12
|
+
import { parseTraceLine } from './tool-providers.js';
|
|
11
13
|
import { ORG_DIR } from './types.js';
|
|
14
|
+
// ── M4 federation ───────────────────────────────────────────────────────
|
|
15
|
+
/** `federation.allow_*` membership: absent list = unrestricted, '*' = any. */
|
|
16
|
+
export function federationAllows(list, org) {
|
|
17
|
+
if (list === undefined)
|
|
18
|
+
return true;
|
|
19
|
+
return list.includes('*') || list.includes(org);
|
|
20
|
+
}
|
|
21
|
+
/** The org def for federation checks: the running def, else the one on disk. */
|
|
22
|
+
function federationDef(daemon, org) {
|
|
23
|
+
const running = daemon.orgs.get(org);
|
|
24
|
+
if (running)
|
|
25
|
+
return running.def;
|
|
26
|
+
if (!daemon.hasOrgDef(org))
|
|
27
|
+
return undefined;
|
|
28
|
+
const path = join(daemon.root, ORG_DIR, `${org}.json`);
|
|
29
|
+
try {
|
|
30
|
+
if (!existsSync(path))
|
|
31
|
+
return undefined;
|
|
32
|
+
return JSON.parse(readFileSync(path, 'utf8'));
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
12
38
|
/** Bodies larger than this are digested to a .mail file (see mailBody). */
|
|
13
39
|
const MAIL_BODY_MAX = 4096;
|
|
14
40
|
/** How much of an oversized body stays inline in the digest. */
|
|
@@ -112,19 +138,49 @@ export async function pushMessage(daemon, orgName, org, toRole, from, subject, b
|
|
|
112
138
|
const slot = org.roleSlots?.get(toRole);
|
|
113
139
|
if (slot?.phase === 'draining') {
|
|
114
140
|
slot.queuedDuringSwap.push(mail);
|
|
141
|
+
recordTrace(org, toRole, body);
|
|
142
|
+
clearEndpointWait(org, orgName, from);
|
|
115
143
|
return true;
|
|
116
144
|
}
|
|
117
145
|
const agent = org.agents.get(toRole);
|
|
118
146
|
if (!agent || agent.mailbox.isClosed)
|
|
119
147
|
return false;
|
|
120
148
|
agent.mailbox.push(mail);
|
|
149
|
+
recordTrace(org, toRole, body);
|
|
150
|
+
clearEndpointWait(org, orgName, from);
|
|
121
151
|
return true;
|
|
122
152
|
}
|
|
153
|
+
/** M1: remember the chain trace of the latest traced message a role got. */
|
|
154
|
+
function recordTrace(org, toRole, body) {
|
|
155
|
+
const trace = parseTraceLine(body);
|
|
156
|
+
if (!trace)
|
|
157
|
+
return;
|
|
158
|
+
if (!org.traces)
|
|
159
|
+
org.traces = new Map();
|
|
160
|
+
org.traces.set(toRole, trace);
|
|
161
|
+
}
|
|
123
162
|
/** Route a message. to = "role" (same org) or "org:role" (cross-org). Returns a receipt string. */
|
|
124
|
-
export async function deliver(daemon, fromOrg, fromRole, to, subject, body) {
|
|
163
|
+
export async function deliver(daemon, fromOrg, fromRole, to, subject, body, opts = {}) {
|
|
164
|
+
// M3: one id per logical message, stamped on every bus copy and queue entry.
|
|
165
|
+
const messageId = opts.messageId ?? newMessageId();
|
|
125
166
|
const { cross, orgName: targetOrgName, role: targetRole, qualified: toQualified, } = resolveAddress(fromOrg, to);
|
|
126
167
|
const targetOrg = daemon.orgs.get(targetOrgName);
|
|
127
168
|
const src = daemon.orgs.get(fromOrg);
|
|
169
|
+
// M2: an endpoint role has no mailbox — POST to its endpoint instead.
|
|
170
|
+
const endpointRole = targetOrg ? findEndpointRole(targetOrg.def, targetRole) : undefined;
|
|
171
|
+
if (targetOrg && endpointRole) {
|
|
172
|
+
return deliverToEndpoint(daemon, {
|
|
173
|
+
orgName: targetOrgName,
|
|
174
|
+
org: targetOrg,
|
|
175
|
+
role: endpointRole,
|
|
176
|
+
from: cross ? `${fromOrg}:${fromRole}` : fromRole,
|
|
177
|
+
subject,
|
|
178
|
+
body,
|
|
179
|
+
messageId,
|
|
180
|
+
src,
|
|
181
|
+
eventTo: toQualified,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
128
184
|
// Lazy spawn: if the role is pending (not yet spawned), spawn it now.
|
|
129
185
|
// ATOMIC GUARD: Check spawning Set to prevent duplicate spawns from concurrent messages
|
|
130
186
|
const spawning = daemon.spawning.get(targetOrgName) ?? new Set();
|
|
@@ -155,6 +211,7 @@ export async function deliver(daemon, fromOrg, fromRole, to, subject, body) {
|
|
|
155
211
|
subject,
|
|
156
212
|
body,
|
|
157
213
|
ts: Date.now(),
|
|
214
|
+
messageId,
|
|
158
215
|
});
|
|
159
216
|
if (!queued) {
|
|
160
217
|
src?.bus.emit({
|
|
@@ -190,6 +247,7 @@ export async function deliver(daemon, fromOrg, fromRole, to, subject, body) {
|
|
|
190
247
|
subject,
|
|
191
248
|
body,
|
|
192
249
|
ts: Date.now(),
|
|
250
|
+
messageId,
|
|
193
251
|
});
|
|
194
252
|
if (!queued) {
|
|
195
253
|
src?.bus.emit({
|
|
@@ -216,7 +274,7 @@ export async function deliver(daemon, fromOrg, fromRole, to, subject, body) {
|
|
|
216
274
|
}
|
|
217
275
|
if (!targetOrg?.agents.has(targetRole)) {
|
|
218
276
|
if (cross && daemon.opts.crossProcess)
|
|
219
|
-
return deliverRemote(daemon, fromOrg, fromRole, targetOrgName, targetRole, toQualified, subject, body, src);
|
|
277
|
+
return deliverRemote(daemon, fromOrg, fromRole, targetOrgName, targetRole, toQualified, subject, body, src, messageId);
|
|
220
278
|
// Queue + auto-wake: if the org definition exists locally but isn't running, spool the message and start it
|
|
221
279
|
if (cross && daemon.hasOrgDef(targetOrgName)) {
|
|
222
280
|
const queued = queueMessage(daemon.root, targetOrgName, {
|
|
@@ -225,6 +283,7 @@ export async function deliver(daemon, fromOrg, fromRole, to, subject, body) {
|
|
|
225
283
|
subject,
|
|
226
284
|
body,
|
|
227
285
|
ts: Date.now(),
|
|
286
|
+
messageId,
|
|
228
287
|
});
|
|
229
288
|
if (!queued) {
|
|
230
289
|
src?.bus.emit({
|
|
@@ -242,7 +301,7 @@ export async function deliver(daemon, fromOrg, fromRole, to, subject, body) {
|
|
|
242
301
|
to: toQualified,
|
|
243
302
|
subject,
|
|
244
303
|
msg: body,
|
|
245
|
-
data: { queued: true },
|
|
304
|
+
data: { queued: true, messageId },
|
|
246
305
|
});
|
|
247
306
|
daemon.autoWake(targetOrgName);
|
|
248
307
|
return `queued for ${toQualified} (org starting)`;
|
|
@@ -258,6 +317,7 @@ export async function deliver(daemon, fromOrg, fromRole, to, subject, body) {
|
|
|
258
317
|
subject,
|
|
259
318
|
body,
|
|
260
319
|
ts: Date.now(),
|
|
320
|
+
messageId,
|
|
261
321
|
});
|
|
262
322
|
if (!queued) {
|
|
263
323
|
src?.bus.emit({
|
|
@@ -315,6 +375,7 @@ export async function deliver(daemon, fromOrg, fromRole, to, subject, body) {
|
|
|
315
375
|
subject,
|
|
316
376
|
body,
|
|
317
377
|
ts: Date.now(),
|
|
378
|
+
messageId,
|
|
318
379
|
});
|
|
319
380
|
src?.bus.emit({
|
|
320
381
|
type: 'audit',
|
|
@@ -334,6 +395,7 @@ export async function deliver(daemon, fromOrg, fromRole, to, subject, body) {
|
|
|
334
395
|
subject,
|
|
335
396
|
msg: body,
|
|
336
397
|
parentId,
|
|
398
|
+
data: { messageId },
|
|
337
399
|
};
|
|
338
400
|
const emitted = src?.bus.emit({ type: cross ? 'xorg' : 'message', ...evt });
|
|
339
401
|
if (cross && targetOrg !== src)
|
|
@@ -361,9 +423,26 @@ export async function deliver(daemon, fromOrg, fromRole, to, subject, body) {
|
|
|
361
423
|
}
|
|
362
424
|
return `delivered to ${toQualified}`;
|
|
363
425
|
}
|
|
426
|
+
/** M4: the sender's allow_to check for a cross-root delivery. Returns the
|
|
427
|
+
* ERROR receipt when denied (and emits the audit event), else undefined. */
|
|
428
|
+
function federationDenied(daemon, fromOrg, fromRole, targetOrgName, to, subject, src) {
|
|
429
|
+
const allowTo = (src?.def ?? federationDef(daemon, fromOrg))?.federation?.allow_to;
|
|
430
|
+
if (federationAllows(allowTo, targetOrgName))
|
|
431
|
+
return undefined;
|
|
432
|
+
const from = `${fromOrg}:${fromRole}`;
|
|
433
|
+
src?.bus.emit({
|
|
434
|
+
type: 'audit',
|
|
435
|
+
from: fromRole,
|
|
436
|
+
to,
|
|
437
|
+
reason: 'federation-denied',
|
|
438
|
+
msg: `federation: ${from} may not send to ${to} (${subject})`,
|
|
439
|
+
data: { direction: 'to', from, to },
|
|
440
|
+
});
|
|
441
|
+
return `ERROR: federation: ${from} may not send to ${to}`;
|
|
442
|
+
}
|
|
364
443
|
/** Cross-process leg of deliver(): ask the machine-local broker who hosts targetOrgName, then POST over HTTP.
|
|
365
444
|
* `to` here is always the fully-qualified "org:role" display form (resolveAddress already normalized it). */
|
|
366
|
-
async function deliverRemote(daemon, fromOrg, fromRole, targetOrgName, targetRole, to, subject, body, src) {
|
|
445
|
+
async function deliverRemote(daemon, fromOrg, fromRole, targetOrgName, targetRole, to, subject, body, src, messageId) {
|
|
367
446
|
const remote = lookupOrg(targetOrgName, daemon.opts.brokerDir);
|
|
368
447
|
if (!remote) {
|
|
369
448
|
// No remote host either — queue + auto-wake if the org def exists locally
|
|
@@ -374,6 +453,7 @@ async function deliverRemote(daemon, fromOrg, fromRole, targetOrgName, targetRol
|
|
|
374
453
|
subject,
|
|
375
454
|
body,
|
|
376
455
|
ts: Date.now(),
|
|
456
|
+
messageId,
|
|
377
457
|
});
|
|
378
458
|
if (!queued) {
|
|
379
459
|
src?.bus.emit({
|
|
@@ -391,7 +471,7 @@ async function deliverRemote(daemon, fromOrg, fromRole, targetOrgName, targetRol
|
|
|
391
471
|
to,
|
|
392
472
|
subject,
|
|
393
473
|
msg: body,
|
|
394
|
-
data: { queued: true },
|
|
474
|
+
data: { queued: true, messageId },
|
|
395
475
|
});
|
|
396
476
|
daemon.autoWake(targetOrgName);
|
|
397
477
|
return `queued for ${to} (org starting)`;
|
|
@@ -401,6 +481,10 @@ async function deliverRemote(daemon, fromOrg, fromRole, targetOrgName, targetRol
|
|
|
401
481
|
const { lookupRemoteOrg, deliverRemote: sshDeliver } = await import('./remote.js');
|
|
402
482
|
const remoteHost = lookupRemoteOrg(targetOrgName, daemon.root);
|
|
403
483
|
if (remoteHost) {
|
|
484
|
+
// M4: another host is always another trust domain.
|
|
485
|
+
const denied = federationDenied(daemon, fromOrg, fromRole, targetOrgName, to, subject, src);
|
|
486
|
+
if (denied)
|
|
487
|
+
return denied;
|
|
404
488
|
const result = await sshDeliver(targetOrgName, `${fromOrg}:${fromRole}`, subject, body, remoteHost);
|
|
405
489
|
if (result.ok) {
|
|
406
490
|
src?.bus.emit({
|
|
@@ -409,7 +493,7 @@ async function deliverRemote(daemon, fromOrg, fromRole, targetOrgName, targetRol
|
|
|
409
493
|
to,
|
|
410
494
|
subject,
|
|
411
495
|
msg: body,
|
|
412
|
-
data: { remote: 'ssh', host: remoteHost.host },
|
|
496
|
+
data: { remote: 'ssh', host: remoteHost.host, messageId },
|
|
413
497
|
});
|
|
414
498
|
return `delivered to ${to} via SSH (${remoteHost.host})`;
|
|
415
499
|
}
|
|
@@ -435,6 +519,13 @@ async function deliverRemote(daemon, fromOrg, fromRole, targetOrgName, targetRol
|
|
|
435
519
|
});
|
|
436
520
|
return `ERROR: unknown recipient "${to}" (no local org, no process on this machine, and no SSH remote configured for "${targetOrgName}")`;
|
|
437
521
|
}
|
|
522
|
+
// M4: a target under a different project root is another trust domain —
|
|
523
|
+
// honour the sender's federation.allow_to. Same root is never restricted.
|
|
524
|
+
if (remote.root !== normalizeRoot(daemon.root)) {
|
|
525
|
+
const denied = federationDenied(daemon, fromOrg, fromRole, targetOrgName, to, subject, src);
|
|
526
|
+
if (denied)
|
|
527
|
+
return denied;
|
|
528
|
+
}
|
|
438
529
|
try {
|
|
439
530
|
// BUG 2 FIX: attach fromOrg's OWN registered credential as proof of
|
|
440
531
|
// sender identity — separate from the `x-monomind-cred` header above,
|
|
@@ -452,16 +543,25 @@ async function deliverRemote(daemon, fromOrg, fromRole, targetOrgName, targetRol
|
|
|
452
543
|
fromOrg,
|
|
453
544
|
fromRole,
|
|
454
545
|
fromCredential: fromEntry?.credential,
|
|
546
|
+
fromRoot: normalizeRoot(daemon.root),
|
|
455
547
|
toOrg: targetOrgName,
|
|
456
548
|
toRole: targetRole,
|
|
457
549
|
subject,
|
|
458
550
|
body,
|
|
551
|
+
messageId,
|
|
459
552
|
}),
|
|
460
553
|
signal: AbortSignal.timeout(10_000),
|
|
461
554
|
});
|
|
462
555
|
const data = (await res.json().catch(() => ({})));
|
|
463
556
|
if (res.ok && data.ok) {
|
|
464
|
-
src?.bus.emit({
|
|
557
|
+
src?.bus.emit({
|
|
558
|
+
type: 'xorg',
|
|
559
|
+
from: `${fromOrg}:${fromRole}`,
|
|
560
|
+
to,
|
|
561
|
+
subject,
|
|
562
|
+
msg: body,
|
|
563
|
+
data: { messageId },
|
|
564
|
+
});
|
|
465
565
|
return data.receipt ?? `delivered to ${to} (remote)`;
|
|
466
566
|
}
|
|
467
567
|
src?.bus.emit({
|
|
@@ -498,20 +598,48 @@ function credentialMatches(supplied, expected) {
|
|
|
498
598
|
/** Inbound handler for cross-process delivery — called by the server's POST /api/xdeliver route
|
|
499
599
|
* when ANOTHER process's deliverRemote() reaches this daemon. Pushes straight into the target
|
|
500
600
|
* agent's mailbox; the agent picks it up on its own next turn (see Mailbox — never interrupts). */
|
|
501
|
-
export async function receiveRemote(daemon, toOrg, toRole, fromQualified, subject, body, fromCredential) {
|
|
601
|
+
export async function receiveRemote(daemon, toOrg, toRole, fromQualified, subject, body, fromCredential, opts = {}) {
|
|
602
|
+
const messageId = opts.messageId ?? newMessageId();
|
|
502
603
|
// BUG 2 FIX: the HTTP auth gate in server.ts only proves the caller knows a
|
|
503
604
|
// credential this daemon accepts (the target org's, or the operator's) — it
|
|
504
605
|
// says nothing about who the caller claims to be. Verify the claimed sender
|
|
505
606
|
// actually owns the credential registered for it in the broker before
|
|
506
607
|
// trusting anything else. Credentials are per-org, so a sibling org hosted
|
|
507
608
|
// by the same daemon can't reuse its own to pass as `fromOrg`.
|
|
609
|
+
//
|
|
610
|
+
// M3: an OPERATOR-authenticated call (server.ts saw the operator credential)
|
|
611
|
+
// carries human authority and may speak as any sender — the org need not be
|
|
612
|
+
// registered (e.g. `workflow:<exec>` or an automation role's reply).
|
|
508
613
|
const claimedFromOrg = fromQualified.split(':', 1)[0];
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
614
|
+
if (!opts.operator) {
|
|
615
|
+
const fromEntry = lookupOrg(claimedFromOrg, daemon.opts.brokerDir);
|
|
616
|
+
if (!fromEntry?.credential || !credentialMatches(fromCredential, fromEntry.credential)) {
|
|
617
|
+
return {
|
|
618
|
+
ok: false,
|
|
619
|
+
error: `sender "${claimedFromOrg}" failed identity verification (unregistered or credential mismatch)`,
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
// M4 federation (operator-authenticated calls are exempt).
|
|
623
|
+
const fromRoot = opts.fromRoot ? normalizeRoot(opts.fromRoot) : undefined;
|
|
624
|
+
const reject = (error) => {
|
|
625
|
+
daemon.orgs.get(toOrg)?.bus.emit({
|
|
626
|
+
type: 'audit',
|
|
627
|
+
from: toRole,
|
|
628
|
+
reason: 'federation-denied',
|
|
629
|
+
msg: `${error} (from ${fromQualified})`,
|
|
630
|
+
data: { direction: 'from', from: fromQualified, fromRoot: fromRoot ?? null },
|
|
631
|
+
});
|
|
632
|
+
return { ok: false, error };
|
|
514
633
|
};
|
|
634
|
+
// A sender that states no root (an older daemon, a hand-rolled client)
|
|
635
|
+
// is not a mismatch — it is simply treated as another root below.
|
|
636
|
+
if (fromEntry.root && fromRoot !== undefined && fromRoot !== fromEntry.root)
|
|
637
|
+
return reject('federation: root mismatch');
|
|
638
|
+
if (fromRoot !== normalizeRoot(daemon.root)) {
|
|
639
|
+
const allowFrom = federationDef(daemon, toOrg)?.federation?.allow_from;
|
|
640
|
+
if (!federationAllows(allowFrom, claimedFromOrg))
|
|
641
|
+
return reject('federation: sender not allowed');
|
|
642
|
+
}
|
|
515
643
|
}
|
|
516
644
|
const org = daemon.orgs.get(toOrg);
|
|
517
645
|
if (!org) {
|
|
@@ -523,6 +651,7 @@ export async function receiveRemote(daemon, toOrg, toRole, fromQualified, subjec
|
|
|
523
651
|
subject,
|
|
524
652
|
body,
|
|
525
653
|
ts: Date.now(),
|
|
654
|
+
messageId,
|
|
526
655
|
});
|
|
527
656
|
if (!queued) {
|
|
528
657
|
return {
|
|
@@ -535,6 +664,26 @@ export async function receiveRemote(daemon, toOrg, toRole, fromQualified, subjec
|
|
|
535
664
|
}
|
|
536
665
|
return { ok: false, error: `org "${toOrg}" not hosted here` };
|
|
537
666
|
}
|
|
667
|
+
// M2: an endpoint role has no mailbox — POST to its endpoint instead.
|
|
668
|
+
const endpointRole = findEndpointRole(org.def, toRole);
|
|
669
|
+
if (endpointRole) {
|
|
670
|
+
const from = fromQualified.startsWith(`${toOrg}:`)
|
|
671
|
+
? fromQualified.slice(toOrg.length + 1)
|
|
672
|
+
: fromQualified;
|
|
673
|
+
const receipt = await deliverToEndpoint(daemon, {
|
|
674
|
+
orgName: toOrg,
|
|
675
|
+
org,
|
|
676
|
+
role: endpointRole,
|
|
677
|
+
from,
|
|
678
|
+
subject,
|
|
679
|
+
body,
|
|
680
|
+
messageId,
|
|
681
|
+
eventTo: `${toOrg}:${toRole}`,
|
|
682
|
+
});
|
|
683
|
+
return receipt.startsWith('ERROR:')
|
|
684
|
+
? { ok: false, error: receipt.slice('ERROR: '.length) }
|
|
685
|
+
: { ok: true, receipt };
|
|
686
|
+
}
|
|
538
687
|
// Lazy-spawn pending roles on cross-process delivery (matches deliver/answerQuestion)
|
|
539
688
|
// ATOMIC GUARD: Check spawning Set to prevent duplicate spawns from concurrent messages
|
|
540
689
|
const spawning = daemon.spawning.get(toOrg) ?? new Set();
|
|
@@ -561,6 +710,7 @@ export async function receiveRemote(daemon, toOrg, toRole, fromQualified, subjec
|
|
|
561
710
|
subject,
|
|
562
711
|
body,
|
|
563
712
|
ts: Date.now(),
|
|
713
|
+
messageId,
|
|
564
714
|
});
|
|
565
715
|
if (!queued) {
|
|
566
716
|
return {
|
|
@@ -592,6 +742,7 @@ export async function receiveRemote(daemon, toOrg, toRole, fromQualified, subjec
|
|
|
592
742
|
subject,
|
|
593
743
|
body,
|
|
594
744
|
ts: Date.now(),
|
|
745
|
+
messageId,
|
|
595
746
|
});
|
|
596
747
|
if (!queued) {
|
|
597
748
|
return {
|
|
@@ -624,6 +775,7 @@ export async function receiveRemote(daemon, toOrg, toRole, fromQualified, subjec
|
|
|
624
775
|
subject,
|
|
625
776
|
body,
|
|
626
777
|
ts: Date.now(),
|
|
778
|
+
messageId,
|
|
627
779
|
});
|
|
628
780
|
if (!queued) {
|
|
629
781
|
return {
|
|
@@ -652,6 +804,7 @@ export async function receiveRemote(daemon, toOrg, toRole, fromQualified, subjec
|
|
|
652
804
|
to: `${toOrg}:${toRole}`,
|
|
653
805
|
subject,
|
|
654
806
|
msg: body,
|
|
807
|
+
data: { messageId },
|
|
655
808
|
});
|
|
656
809
|
agent.lastMessageId = messageEvent.id; // Track last message ID for response threading
|
|
657
810
|
const pushed = await pushMessage(daemon, toOrg, org, toRole, fromQualified, subject, body, messageEvent.id);
|