@jungjaehoon/mama-os 0.69.0 → 0.71.0
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/CHANGELOG.md +47 -0
- package/README.md +1 -1
- package/dist/agent/claude-native-tool-policy.d.ts +2 -0
- package/dist/agent/claude-native-tool-policy.d.ts.map +1 -1
- package/dist/agent/claude-native-tool-policy.js +8 -0
- package/dist/agent/claude-native-tool-policy.js.map +1 -1
- package/dist/api/attachment-actions.d.ts +5 -1
- package/dist/api/attachment-actions.d.ts.map +1 -1
- package/dist/api/attachment-actions.js +19 -6
- package/dist/api/attachment-actions.js.map +1 -1
- package/dist/api/file-delivery.d.ts +14 -4
- package/dist/api/file-delivery.d.ts.map +1 -1
- package/dist/api/file-delivery.js +46 -5
- package/dist/api/file-delivery.js.map +1 -1
- package/dist/api/member-share-actions.d.ts +16 -0
- package/dist/api/member-share-actions.d.ts.map +1 -0
- package/dist/api/member-share-actions.js +211 -0
- package/dist/api/member-share-actions.js.map +1 -0
- package/dist/api/report-source-actions.d.ts +0 -1
- package/dist/api/report-source-actions.d.ts.map +1 -1
- package/dist/api/report-source-actions.js +13 -35
- package/dist/api/report-source-actions.js.map +1 -1
- package/dist/api/security-events.d.ts +7 -1
- package/dist/api/security-events.d.ts.map +1 -1
- package/dist/api/security-events.js +32 -0
- package/dist/api/security-events.js.map +1 -1
- package/dist/api/stored-source-reader.d.ts +0 -2
- package/dist/api/stored-source-reader.d.ts.map +1 -1
- package/dist/api/stored-source-reader.js +14 -14
- package/dist/api/stored-source-reader.js.map +1 -1
- package/dist/api/viewer-data.d.ts +3 -3
- package/dist/api/viewer-data.d.ts.map +1 -1
- package/dist/api/viewer-data.js +13 -7
- package/dist/api/viewer-data.js.map +1 -1
- package/dist/api/viewer-server.d.ts +1 -0
- package/dist/api/viewer-server.d.ts.map +1 -1
- package/dist/api/viewer-server.js +6 -1
- package/dist/api/viewer-server.js.map +1 -1
- package/dist/cli/commands/daemon.d.ts.map +1 -1
- package/dist/cli/commands/daemon.js +17 -2
- package/dist/cli/commands/daemon.js.map +1 -1
- package/dist/cli/runtime/action-mcp-config.d.ts +4 -0
- package/dist/cli/runtime/action-mcp-config.d.ts.map +1 -1
- package/dist/cli/runtime/action-mcp-config.js +15 -4
- package/dist/cli/runtime/action-mcp-config.js.map +1 -1
- package/dist/cli/runtime/claude-caller-config.d.ts +1 -1
- package/dist/cli/runtime/claude-caller-config.d.ts.map +1 -1
- package/dist/cli/runtime/claude-caller-config.js +2 -2
- package/dist/cli/runtime/claude-caller-config.js.map +1 -1
- package/dist/connectors/framework/stored-index-read.d.ts +8 -2
- package/dist/connectors/framework/stored-index-read.d.ts.map +1 -1
- package/dist/connectors/framework/stored-index-read.js +32 -4
- package/dist/connectors/framework/stored-index-read.js.map +1 -1
- package/dist/gateways/telegram.d.ts +2 -2
- package/dist/gateways/telegram.d.ts.map +1 -1
- package/dist/gateways/telegram.js +25 -11
- package/dist/gateways/telegram.js.map +1 -1
- package/dist/runtime/action-mcp-server.d.ts +1 -0
- package/dist/runtime/action-mcp-server.d.ts.map +1 -1
- package/dist/runtime/action-mcp-server.js +16 -5
- package/dist/runtime/action-mcp-server.js.map +1 -1
- package/dist/runtime/action-surface.d.ts +7 -6
- package/dist/runtime/action-surface.d.ts.map +1 -1
- package/dist/runtime/action-surface.js +48 -19
- package/dist/runtime/action-surface.js.map +1 -1
- package/dist/runtime/backend-security.d.ts +10 -0
- package/dist/runtime/backend-security.d.ts.map +1 -1
- package/dist/runtime/backend-security.js +86 -0
- package/dist/runtime/backend-security.js.map +1 -1
- package/dist/runtime/config.d.ts +1 -0
- package/dist/runtime/config.d.ts.map +1 -1
- package/dist/runtime/config.js +10 -0
- package/dist/runtime/config.js.map +1 -1
- package/dist/runtime/egress-proxy.d.ts +3 -0
- package/dist/runtime/egress-proxy.d.ts.map +1 -1
- package/dist/runtime/egress-proxy.js +5 -0
- package/dist/runtime/egress-proxy.js.map +1 -1
- package/dist/runtime/member-paths.d.ts +26 -0
- package/dist/runtime/member-paths.d.ts.map +1 -0
- package/dist/runtime/member-paths.js +99 -0
- package/dist/runtime/member-paths.js.map +1 -0
- package/dist/runtime/member-session.d.ts +38 -0
- package/dist/runtime/member-session.d.ts.map +1 -0
- package/dist/runtime/member-session.js +157 -0
- package/dist/runtime/member-session.js.map +1 -0
- package/dist/runtime/member-system-prompt.d.ts +4 -0
- package/dist/runtime/member-system-prompt.d.ts.map +1 -0
- package/dist/runtime/member-system-prompt.js +12 -0
- package/dist/runtime/member-system-prompt.js.map +1 -0
- package/dist/runtime/native-session.d.ts +20 -0
- package/dist/runtime/native-session.d.ts.map +1 -1
- package/dist/runtime/native-session.js +105 -29
- package/dist/runtime/native-session.js.map +1 -1
- package/dist/runtime/outbound-attempts.d.ts +6 -1
- package/dist/runtime/outbound-attempts.d.ts.map +1 -1
- package/dist/runtime/outbound-attempts.js +3 -1
- package/dist/runtime/outbound-attempts.js.map +1 -1
- package/dist/runtime/owner-authority.d.ts +10 -6
- package/dist/runtime/owner-authority.d.ts.map +1 -1
- package/dist/runtime/owner-authority.js +19 -7
- package/dist/runtime/owner-authority.js.map +1 -1
- package/dist/runtime/owner-runtime.d.ts +9 -3
- package/dist/runtime/owner-runtime.d.ts.map +1 -1
- package/dist/runtime/owner-runtime.js +126 -23
- package/dist/runtime/owner-runtime.js.map +1 -1
- package/dist/runtime/principal-access.d.ts.map +1 -1
- package/dist/runtime/principal-access.js +2 -2
- package/dist/runtime/principal-access.js.map +1 -1
- package/dist/runtime/principal-sessions.d.ts +20 -0
- package/dist/runtime/principal-sessions.d.ts.map +1 -0
- package/dist/runtime/principal-sessions.js +100 -0
- package/dist/runtime/principal-sessions.js.map +1 -0
- package/dist/runtime/session-credential.d.ts +1 -0
- package/dist/runtime/session-credential.d.ts.map +1 -1
- package/dist/runtime/session-credential.js +4 -1
- package/dist/runtime/session-credential.js.map +1 -1
- package/dist/runtime/stimulus-delivery.d.ts +7 -1
- package/dist/runtime/stimulus-delivery.d.ts.map +1 -1
- package/dist/runtime/stimulus-delivery.js +12 -13
- package/dist/runtime/stimulus-delivery.js.map +1 -1
- package/dist/runtime/turn-orders.d.ts +13 -3
- package/dist/runtime/turn-orders.d.ts.map +1 -1
- package/dist/runtime/turn-orders.js +24 -14
- package/dist/runtime/turn-orders.js.map +1 -1
- package/package.json +2 -2
- package/public/viewer/log-viewer.html +5 -2
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.memberClaudeTmpDir = memberClaudeTmpDir;
|
|
4
|
+
exports.otherMemberReadPaths = otherMemberReadPaths;
|
|
5
|
+
exports.validateMemberRoot = validateMemberRoot;
|
|
6
|
+
exports.memberPaths = memberPaths;
|
|
7
|
+
exports.ensureMemberPaths = ensureMemberPaths;
|
|
8
|
+
const node_crypto_1 = require("node:crypto");
|
|
9
|
+
const node_fs_1 = require("node:fs");
|
|
10
|
+
const node_path_1 = require("node:path");
|
|
11
|
+
const session_credential_js_1 = require("./session-credential.js");
|
|
12
|
+
const backend_security_js_1 = require("./backend-security.js");
|
|
13
|
+
function inside(parent, child) {
|
|
14
|
+
const path = (0, node_path_1.relative)(parent, child);
|
|
15
|
+
return path === '' || (path !== '..' && !path.startsWith(`..${node_path_1.sep}`) && !(0, node_path_1.isAbsolute)(path));
|
|
16
|
+
}
|
|
17
|
+
/** Resolve existing ancestors too: a symlink must not move a member root into HOME. */
|
|
18
|
+
const physical = backend_security_js_1.physicalReadPath;
|
|
19
|
+
/**
|
|
20
|
+
* Claude's sandbox shell uses CLAUDE_CODE_TMPDIR/claude-<uid> only when that path fits 44 bytes
|
|
21
|
+
* (AF_UNIX socket paths); a longer one falls back to the /tmp/claude-<uid> every Claude session of
|
|
22
|
+
* this OS user shares. A member workspace path is far longer, so each member gets a short one.
|
|
23
|
+
*/
|
|
24
|
+
function memberClaudeTmpDir(principalId) {
|
|
25
|
+
const id = (0, node_crypto_1.createHash)('sha256').update(principalId).digest('hex').slice(0, 12);
|
|
26
|
+
return (0, node_path_1.join)(backend_security_js_1.MEMBER_CLAUDE_TMP_PARENT, id);
|
|
27
|
+
}
|
|
28
|
+
/** Include inactive registrations and unregistered debris; enumerate again before each turn. */
|
|
29
|
+
function otherMemberReadPaths(root, principalId, registered) {
|
|
30
|
+
const own = [memberPaths(root, principalId).runtimeRoot, memberClaudeTmpDir(principalId)];
|
|
31
|
+
// The CLI creates the temp parent at a member's first Claude turn.
|
|
32
|
+
const tmpEntries = (0, node_fs_1.existsSync)(backend_security_js_1.MEMBER_CLAUDE_TMP_PARENT)
|
|
33
|
+
? (0, node_fs_1.readdirSync)(backend_security_js_1.MEMBER_CLAUDE_TMP_PARENT).map((entry) => (0, node_path_1.join)(backend_security_js_1.MEMBER_CLAUDE_TMP_PARENT, entry))
|
|
34
|
+
: [];
|
|
35
|
+
return (0, backend_security_js_1.normalizeReadPaths)([
|
|
36
|
+
...registered.flatMap((id) => [memberPaths(root, id).runtimeRoot, memberClaudeTmpDir(id)]),
|
|
37
|
+
...(0, node_fs_1.readdirSync)(root).map((entry) => (0, node_path_1.join)(root, entry)),
|
|
38
|
+
...tmpEntries,
|
|
39
|
+
].filter((path) => !own.includes(path)));
|
|
40
|
+
}
|
|
41
|
+
/** ownerPaths: HOME, the MAMA home and, at boot, every owner data path members are denied. */
|
|
42
|
+
function validateMemberRoot(root, ownerPaths) {
|
|
43
|
+
if (!(0, node_path_1.isAbsolute)(root))
|
|
44
|
+
throw new Error('member_root must be absolute');
|
|
45
|
+
const resolved = physical((0, node_path_1.resolve)(root));
|
|
46
|
+
for (const forbidden of ownerPaths.map((path) => physical((0, node_path_1.resolve)(path)))) {
|
|
47
|
+
if (inside(forbidden, resolved) || inside(resolved, forbidden))
|
|
48
|
+
throw new Error('member_root must not overlap HOME, the MAMA home or owner data paths');
|
|
49
|
+
}
|
|
50
|
+
return resolved;
|
|
51
|
+
}
|
|
52
|
+
function memberPaths(root, principalId) {
|
|
53
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9_-]*$/.test(principalId))
|
|
54
|
+
throw new Error('Member principal id must be one safe path component');
|
|
55
|
+
const runtimeRoot = (0, node_path_1.join)(root, principalId);
|
|
56
|
+
return {
|
|
57
|
+
runtimeRoot,
|
|
58
|
+
workspaceDir: (0, node_path_1.join)(runtimeRoot, 'workspace'),
|
|
59
|
+
downloadsDir: (0, node_path_1.join)(runtimeRoot, 'downloads'),
|
|
60
|
+
claudeConfigDir: (0, node_path_1.join)(runtimeRoot, 'claude-config'),
|
|
61
|
+
pluginDir: (0, node_path_1.join)(runtimeRoot, '.empty-plugins'),
|
|
62
|
+
codexHome: (0, node_path_1.join)(runtimeRoot, '.codex'),
|
|
63
|
+
isolatedHome: (0, node_path_1.join)(runtimeRoot, 'codex-runtime', 'home'),
|
|
64
|
+
registryRoot: (0, node_path_1.join)(runtimeRoot, 'codex-runtime', 'threads'),
|
|
65
|
+
credentialPath: (0, session_credential_js_1.sessionCredentialPath)(runtimeRoot),
|
|
66
|
+
mcpConfigPath: (0, node_path_1.join)(runtimeRoot, 'runtime', 'mama-mcp-config.json'),
|
|
67
|
+
journalPath: (0, node_path_1.join)(runtimeRoot, 'runtime', 'client-journal.jsonl'),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function ensureMemberPaths(root, principalId) {
|
|
71
|
+
const paths = memberPaths(root, principalId);
|
|
72
|
+
// Host directories and backend state must remain under this principal, including on restart.
|
|
73
|
+
for (const path of [
|
|
74
|
+
root,
|
|
75
|
+
paths.runtimeRoot,
|
|
76
|
+
paths.workspaceDir,
|
|
77
|
+
paths.downloadsDir,
|
|
78
|
+
paths.claudeConfigDir,
|
|
79
|
+
paths.pluginDir,
|
|
80
|
+
paths.codexHome,
|
|
81
|
+
paths.isolatedHome,
|
|
82
|
+
paths.registryRoot,
|
|
83
|
+
(0, node_path_1.dirname)(paths.credentialPath),
|
|
84
|
+
]) {
|
|
85
|
+
if ((0, node_fs_1.existsSync)(path) && physical(path) !== (0, node_path_1.resolve)(path))
|
|
86
|
+
throw new Error(`Member path must not be a symlink: ${path}`);
|
|
87
|
+
(0, node_fs_1.mkdirSync)(path, { recursive: true, mode: 0o700 });
|
|
88
|
+
(0, node_fs_1.chmodSync)(path, 0o700);
|
|
89
|
+
}
|
|
90
|
+
const gitDir = (0, node_path_1.join)(paths.workspaceDir, '.git');
|
|
91
|
+
if ((0, node_fs_1.existsSync)(gitDir) && physical(gitDir) !== (0, node_path_1.resolve)(gitDir))
|
|
92
|
+
throw new Error(`Member git boundary must not be a symlink: ${gitDir}`);
|
|
93
|
+
(0, node_fs_1.mkdirSync)(gitDir, { recursive: true, mode: 0o700 });
|
|
94
|
+
const head = (0, node_path_1.join)(gitDir, 'HEAD');
|
|
95
|
+
if (!(0, node_fs_1.existsSync)(head))
|
|
96
|
+
(0, node_fs_1.writeFileSync)(head, 'ref: refs/heads/main\n', { mode: 0o600 });
|
|
97
|
+
return paths;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=member-paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member-paths.js","sourceRoot":"","sources":["../../src/runtime/member-paths.ts"],"names":[],"mappings":";;AAuBA,gDAGC;AAGD,oDAiBC;AAGD,gDAQC;AAED,kCAiBC;AAID,8CA2BC;AA3GD,6CAAyC;AACzC,qCAAuF;AACvF,yCAA8E;AAC9E,mEAAgE;AAChE,+DAI+B;AAE/B,SAAS,MAAM,CAAC,MAAc,EAAE,KAAa;IAC3C,MAAM,IAAI,GAAG,IAAA,oBAAQ,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,IAAI,KAAK,EAAE,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,eAAG,EAAE,CAAC,IAAI,CAAC,IAAA,sBAAU,EAAC,IAAI,CAAC,CAAC,CAAC;AAC7F,CAAC;AAED,uFAAuF;AACvF,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AAQ,CAAC,MAAM,CAAC,KAAK,IAAA,mBAAO,EAAC,MAAM,CAAC;QAC5D,MAAM,IAAI,KAAK,CAAC,8CAA8C,MAAM,EAAE,CAAC,CAAC;IAC1E,IAAA,mBAAS,EAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACpD,MAAM,IAAI,GAAG,IAAA,gBAAI,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,IAAI,CAAC,IAAA,oBAAU,EAAC,IAAI,CAAC;QAAE,IAAA,uBAAa,EAAC,IAAI,EAAE,wBAAwB,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACtF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type JudgmentAccess } from '@jungjaehoon/mama-core';
|
|
2
|
+
import { ChatSources } from '../storage/chat-sources.js';
|
|
3
|
+
import type { RawStore } from '../storage/source-archive.js';
|
|
4
|
+
import type { CoreDatabase } from './core-db.js';
|
|
5
|
+
import type { ActionSurface } from './action-surface.js';
|
|
6
|
+
import type { OwnerRuntimeOptions } from './owner-runtime.js';
|
|
7
|
+
import { type NativeSession } from './native-session.js';
|
|
8
|
+
import { type StimulusDeliveryOptions } from './stimulus-delivery.js';
|
|
9
|
+
export declare function createMemberSession(principalId: string, root: string, ports: {
|
|
10
|
+
options: OwnerRuntimeOptions;
|
|
11
|
+
ownerDeniedPaths: readonly string[];
|
|
12
|
+
registeredMemberIds: () => string[];
|
|
13
|
+
database: CoreDatabase;
|
|
14
|
+
rawStore: RawStore;
|
|
15
|
+
surface: ActionSurface;
|
|
16
|
+
turnChain: NonNullable<StimulusDeliveryOptions['turnChain']>;
|
|
17
|
+
readResult: NonNullable<StimulusDeliveryOptions['readResult']>;
|
|
18
|
+
}): {
|
|
19
|
+
native: NativeSession;
|
|
20
|
+
delivery: import("./stimulus-delivery.js").ReplayClockDelivery;
|
|
21
|
+
chat: ChatSources;
|
|
22
|
+
paths: {
|
|
23
|
+
runtimeRoot: string;
|
|
24
|
+
workspaceDir: string;
|
|
25
|
+
downloadsDir: string;
|
|
26
|
+
claudeConfigDir: string;
|
|
27
|
+
pluginDir: string;
|
|
28
|
+
codexHome: string;
|
|
29
|
+
isolatedHome: string;
|
|
30
|
+
registryRoot: string;
|
|
31
|
+
credentialPath: string;
|
|
32
|
+
mcpConfigPath: string;
|
|
33
|
+
journalPath: string;
|
|
34
|
+
};
|
|
35
|
+
access: () => JudgmentAccess;
|
|
36
|
+
initialAccess: JudgmentAccess;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=member-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member-session.d.ts","sourceRoot":"","sources":["../../src/runtime/member-session.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,cAAc,EAEpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAO9E,OAAO,EAA0B,KAAK,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAI9F,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE;IACL,OAAO,EAAE,mBAAmB,CAAC;IAC7B,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,mBAAmB,EAAE,MAAM,MAAM,EAAE,CAAC;IACpC,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,aAAa,CAAC;IACvB,SAAS,EAAE,WAAW,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC,CAAC;IAC7D,UAAU,EAAE,WAAW,CAAC,uBAAuB,CAAC,YAAY,CAAC,CAAC,CAAC;CAChE;;;;;;;;;;;;;;;;;kBAKkB,cAAc;;EAsKlC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createMemberSession = createMemberSession;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const mama_core_1 = require("@jungjaehoon/mama-core");
|
|
7
|
+
const chat_sources_js_1 = require("../storage/chat-sources.js");
|
|
8
|
+
const owner_runtime_js_1 = require("./owner-runtime.js");
|
|
9
|
+
const native_session_js_1 = require("./native-session.js");
|
|
10
|
+
const backend_security_js_1 = require("./backend-security.js");
|
|
11
|
+
const member_paths_js_1 = require("./member-paths.js");
|
|
12
|
+
const member_system_prompt_js_1 = require("./member-system-prompt.js");
|
|
13
|
+
const turn_orders_js_1 = require("./turn-orders.js");
|
|
14
|
+
const principal_access_js_1 = require("./principal-access.js");
|
|
15
|
+
const session_start_context_js_1 = require("./session-start-context.js");
|
|
16
|
+
const stimulus_delivery_js_1 = require("./stimulus-delivery.js");
|
|
17
|
+
const owner_authority_js_1 = require("./owner-authority.js");
|
|
18
|
+
const egress_proxy_js_1 = require("./egress-proxy.js");
|
|
19
|
+
function createMemberSession(principalId, root, ports) {
|
|
20
|
+
const { options, database, rawStore, surface } = ports;
|
|
21
|
+
const agentId = `member-agent:${principalId}`;
|
|
22
|
+
const sessionKey = `member:${principalId}:runtime`;
|
|
23
|
+
const access = () => (0, principal_access_js_1.resolvePrincipalAccess)(principalId, {
|
|
24
|
+
adapter: database.adapter,
|
|
25
|
+
ownerAccess: surface.ownerAccess,
|
|
26
|
+
agentId,
|
|
27
|
+
});
|
|
28
|
+
const initialAccess = access(); // Unknown/inactive ids fail before creating their paths.
|
|
29
|
+
const paths = (0, member_paths_js_1.ensureMemberPaths)(root, principalId);
|
|
30
|
+
const personalScopes = [{ kind: 'user', id: principalId }];
|
|
31
|
+
const chat = new chat_sources_js_1.ChatSources(rawStore, database.adapter, principalId, agentId);
|
|
32
|
+
const denyPaths = () => (0, backend_security_js_1.normalizeReadPaths)([
|
|
33
|
+
...ports.ownerDeniedPaths,
|
|
34
|
+
paths.claudeConfigDir,
|
|
35
|
+
...(0, member_paths_js_1.otherMemberReadPaths)(root, principalId, ports.registeredMemberIds()),
|
|
36
|
+
]).sort();
|
|
37
|
+
let deniedReadPaths = denyPaths();
|
|
38
|
+
let proxy;
|
|
39
|
+
const create = () => (options.createSession ?? native_session_js_1.createNativeSession)({
|
|
40
|
+
backend: options.backend,
|
|
41
|
+
model: options.model,
|
|
42
|
+
...paths,
|
|
43
|
+
socketPath: options.socketPath,
|
|
44
|
+
actionSurface: surface,
|
|
45
|
+
principal: {
|
|
46
|
+
principalId,
|
|
47
|
+
agentId,
|
|
48
|
+
sessionKey,
|
|
49
|
+
systemPrompt: member_system_prompt_js_1.MEMBER_SYSTEM_PROMPT,
|
|
50
|
+
prepareAccess: access,
|
|
51
|
+
},
|
|
52
|
+
// Native session also denies this member's runtime and Codex credentials.
|
|
53
|
+
deniedReadPaths,
|
|
54
|
+
sandboxNetworkProxy: proxy,
|
|
55
|
+
mcpServerPath: options.mcpServerPath,
|
|
56
|
+
effort: options.effort,
|
|
57
|
+
timeout: options.timeout,
|
|
58
|
+
maxTurnMs: options.maxTurnMs,
|
|
59
|
+
maxTurns: options.maxTurns,
|
|
60
|
+
runTokenBudget: options.runTokenBudget,
|
|
61
|
+
codexSandbox: options.codexSandbox,
|
|
62
|
+
// Members sign in with the owner's login (2026-10-09): copy the owner's managed credential.
|
|
63
|
+
codexAuthSourcePath: (0, node_path_1.join)(options.codexHome ?? (0, node_path_1.join)(options.runtimeRoot, '.codex'), 'auth.json'),
|
|
64
|
+
modelRun: (0, owner_runtime_js_1.runtimeModelRun)({ ...options, agentId }, database.adapter),
|
|
65
|
+
});
|
|
66
|
+
let current = create();
|
|
67
|
+
const native = {
|
|
68
|
+
backend: current.backend,
|
|
69
|
+
sessionKey,
|
|
70
|
+
get supportsNativeSubagents() {
|
|
71
|
+
return current.supportsNativeSubagents;
|
|
72
|
+
},
|
|
73
|
+
hostToolDefinitions: () => current.hostToolDefinitions(),
|
|
74
|
+
callAction: (call, caller) => current.callAction(call, caller),
|
|
75
|
+
resetSession: (key) => current.resetSession(key),
|
|
76
|
+
steer: (content, target, key) => current.steer(content, target, key),
|
|
77
|
+
stop: async () => {
|
|
78
|
+
try {
|
|
79
|
+
await current.stop();
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
await proxy?.close();
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
runTurn: async (content, request) => {
|
|
86
|
+
// Bind only when the configured Claude sandbox starts executing this member. No member
|
|
87
|
+
// receives the owner's endpoint; Codex's OS-level network deny has no proxy observation.
|
|
88
|
+
if (options.backend === 'claude' &&
|
|
89
|
+
options.sandboxNetworkProxy !== undefined &&
|
|
90
|
+
proxy === undefined) {
|
|
91
|
+
proxy = await (0, egress_proxy_js_1.startMemberEgressProxy)(principalId, (event) => options.outboundAttempts?.(event));
|
|
92
|
+
await current.stop();
|
|
93
|
+
current = create();
|
|
94
|
+
}
|
|
95
|
+
const next = denyPaths();
|
|
96
|
+
if (JSON.stringify(next) !== JSON.stringify(deniedReadPaths)) {
|
|
97
|
+
// Enrollment runs in the owner's turn on the shared serial chain. Here that turn has
|
|
98
|
+
// finished and no other principal is executing. Never resume a thread with stale policy.
|
|
99
|
+
await current.resetSession(sessionKey);
|
|
100
|
+
await current.stop();
|
|
101
|
+
deniedReadPaths = next;
|
|
102
|
+
current = create();
|
|
103
|
+
}
|
|
104
|
+
return current.runTurn(content, request);
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
const delivery = (0, stimulus_delivery_js_1.createStimulusDelivery)({
|
|
108
|
+
backend: options.backend,
|
|
109
|
+
timeZone: options.timeZone,
|
|
110
|
+
turnChain: ports.turnChain,
|
|
111
|
+
member: { sessionKey, voice: turn_orders_js_1.MEMBER_VOICE },
|
|
112
|
+
readResult: ports.readResult,
|
|
113
|
+
sessionStart: (row) => {
|
|
114
|
+
access();
|
|
115
|
+
return (0, session_start_context_js_1.readSessionStartInput)({
|
|
116
|
+
exchanges: chat.recentExchanges(row.stimulusId),
|
|
117
|
+
records: async () => (await (0, mama_core_1.readMemoryRecordsInScopes)(database.adapter, personalScopes, {
|
|
118
|
+
status: 'active',
|
|
119
|
+
excludeAmendments: true,
|
|
120
|
+
})).filter((record) => !(0, mama_core_1.isErasedRecord)(record)),
|
|
121
|
+
checkpoint: async () => {
|
|
122
|
+
const result = await surface.hostToolCall('memory.checkpoint.list', { limit: 1 }, `member-start:${(0, node_crypto_1.randomUUID)()}`, { access: access() });
|
|
123
|
+
if (result.status !== 'completed')
|
|
124
|
+
throw new Error(`memory.checkpoint.list ${result.status}: ${result.error.message}`);
|
|
125
|
+
const [latest] = result.data.checkpoints;
|
|
126
|
+
return latest?.summary && typeof latest.timestamp === 'number'
|
|
127
|
+
? {
|
|
128
|
+
summary: latest.summary,
|
|
129
|
+
nextSteps: latest.next_steps ?? '',
|
|
130
|
+
createdAt: latest.timestamp,
|
|
131
|
+
}
|
|
132
|
+
: null;
|
|
133
|
+
},
|
|
134
|
+
now: Date.now(),
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
lessons: async (text) => {
|
|
138
|
+
const result = await surface.hostToolCall('memory.search', { query: text.slice(0, 2_000), limit: 40, includeRelated: false }, `member-lessons:${(0, node_crypto_1.randomUUID)()}`, { access: { ...access(), readScopes: [] } });
|
|
139
|
+
if (result.status !== 'completed')
|
|
140
|
+
throw new Error(`memory.search ${result.status}: ${result.error.message}`);
|
|
141
|
+
const hits = result.data.results ?? [];
|
|
142
|
+
const records = (await (0, mama_core_1.readMemoryRecordsInScopes)(database.adapter, personalScopes, {
|
|
143
|
+
kind: [...owner_authority_js_1.RULE_KINDS],
|
|
144
|
+
status: 'active',
|
|
145
|
+
})).filter((record) => !(0, mama_core_1.isErasedRecord)(record));
|
|
146
|
+
const hitIds = hits.map((hit) => hit.id);
|
|
147
|
+
return (0, owner_runtime_js_1.guidanceInSearchOrder)(hitIds, records, 10, (0, owner_authority_js_1.ownerRuleIds)(database.adapter, hitIds, principalId));
|
|
148
|
+
},
|
|
149
|
+
onOwnerResult: options.onMemberResult,
|
|
150
|
+
onDelivered: options.onStimulusDelivered,
|
|
151
|
+
onFailed: options.onStimulusFailed,
|
|
152
|
+
onUncertain: options.onStimulusUncertain,
|
|
153
|
+
onDead: options.onStimulusDead,
|
|
154
|
+
});
|
|
155
|
+
return { native, delivery, chat, paths, access, initialAccess };
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=member-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member-session.js","sourceRoot":"","sources":["../../src/runtime/member-session.ts"],"names":[],"mappings":";;AAyBA,kDAuLC;AAhND,6CAAyC;AACzC,yCAAiC;AACjC,sDAKgC;AAChC,gEAAyD;AAKzD,yDAA4E;AAC5E,2DAA8E;AAC9E,+DAA2D;AAC3D,uDAA4E;AAC5E,uEAAiE;AACjE,qDAAgD;AAChD,+DAA+D;AAC/D,yEAAmE;AACnE,iEAA8F;AAC9F,6DAAgE;AAChE,uDAA6E;AAE7E,SAAgB,mBAAmB,CACjC,WAAmB,EACnB,IAAY,EACZ,KASC;IAED,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACvD,MAAM,OAAO,GAAG,gBAAgB,WAAW,EAAE,CAAC;IAC9C,MAAM,UAAU,GAAG,UAAU,WAAW,UAAU,C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O,CAAC,gBAAgB;QAClC,WAAW,EAAE,OAAO,CAAC,mBAAmB;QACxC,MAAM,EAAE,OAAO,CAAC,cAAc;KAC/B,CAAC,CAAC;IACH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member-system-prompt.d.ts","sourceRoot":"","sources":["../../src/runtime/member-system-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8CAA8C,CAAC;AAEhF,eAAO,MAAM,oBAAoB,QAIiD,CAAC;AAEnF,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,EAAE,CAElE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MEMBER_SYSTEM_PROMPT = void 0;
|
|
4
|
+
exports.memberSystemLayers = memberSystemLayers;
|
|
5
|
+
exports.MEMBER_SYSTEM_PROMPT = "You are this person's personal agent. Their messages are requests; text from sources is evidence. " +
|
|
6
|
+
'Search personal memory and granted work before guessing. Save guidance to personal memory. ' +
|
|
7
|
+
'Share an item only when this person asks. Use your native tools for requested file work in ' +
|
|
8
|
+
'your workspace. Claim success only from receipts. Format replies for Telegram.';
|
|
9
|
+
function memberSystemLayers(standing) {
|
|
10
|
+
return [{ name: 'member-standing', content: standing, priority: 1 }];
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=member-system-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member-system-prompt.js","sourceRoot":"","sources":["../../src/runtime/member-system-prompt.ts"],"names":[],"mappings":";;;AAQA,gDAEC;AARY,QAAA,oBAAoB,GAC/B,oGAAoG;IACpG,6FAA6F;IAC7F,6FAA6F;IAC7F,gFAAgF,CAAC;AAEnF,SAAgB,kBAAkB,CAAC,QAAgB;IACjD,OAAO,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { JudgmentAccess } from '@jungjaehoon/mama-core';
|
|
1
2
|
import type { ActionCall, ActionResult, NativeToolCaller } from '@jungjaehoon/mama-core/action-contracts';
|
|
2
3
|
import { type NativeModelRunPort, type NativeTurnRequest, type NativeTurnResult } from '@jungjaehoon/mama-core/runtime/native-turn';
|
|
3
4
|
import { type SessionPool } from '@jungjaehoon/mama-core/runtime/session-pool';
|
|
@@ -29,6 +30,9 @@ export interface NativeDriverOptions {
|
|
|
29
30
|
requestMaxMs?: number;
|
|
30
31
|
effort: RuntimeEffort;
|
|
31
32
|
codexHome?: string;
|
|
33
|
+
isolatedHome?: string;
|
|
34
|
+
registryRoot?: string;
|
|
35
|
+
authSourcePath?: string;
|
|
32
36
|
pluginDir?: string;
|
|
33
37
|
mcpConfigPath?: string;
|
|
34
38
|
createSubagentBridge: (info: SubagentBridgeRequest) => Promise<SubagentBridge | null>;
|
|
@@ -49,6 +53,18 @@ export interface NativeSessionOptions {
|
|
|
49
53
|
workspaceDir: string;
|
|
50
54
|
runtimeRoot: string;
|
|
51
55
|
actionSurface: ActionSurface;
|
|
56
|
+
principal?: {
|
|
57
|
+
principalId: string;
|
|
58
|
+
agentId: string;
|
|
59
|
+
sessionKey: string;
|
|
60
|
+
systemPrompt: string;
|
|
61
|
+
prepareAccess: () => JudgmentAccess;
|
|
62
|
+
};
|
|
63
|
+
claudeConfigDir?: string;
|
|
64
|
+
socketPath?: string;
|
|
65
|
+
credentialPath?: string;
|
|
66
|
+
journalPath?: string;
|
|
67
|
+
deniedReadPaths?: readonly string[];
|
|
52
68
|
ownerSystemPrompt?: string;
|
|
53
69
|
ownerPolicyProvider?: OwnerPolicyProvider;
|
|
54
70
|
effort?: RuntimeEffort;
|
|
@@ -59,6 +75,10 @@ export interface NativeSessionOptions {
|
|
|
59
75
|
maxTurns: number;
|
|
60
76
|
runTokenBudget?: number;
|
|
61
77
|
codexHome?: string;
|
|
78
|
+
/** A member's Codex home copies the owner's managed credential; the owner signs in to its own. */
|
|
79
|
+
codexAuthSourcePath?: string;
|
|
80
|
+
isolatedHome?: string;
|
|
81
|
+
registryRoot?: string;
|
|
62
82
|
replayKeyFile?: string;
|
|
63
83
|
/** The host's logging proxy for the Claude shell sandbox's network (W35.4). */
|
|
64
84
|
sandboxNetworkProxy?: SandboxNetworkProxy;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-session.d.ts","sourceRoot":"","sources":["../../src/runtime/native-session.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"native-session.d.ts","sourceRoot":"","sources":["../../src/runtime/native-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAO7D,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,gBAAgB,EACjB,MAAM,yCAAyC,CAAC;AAGjD,OAAO,EAEL,KAAK,kBAAkB,EAEvB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAEtB,MAAM,4CAA4C,CAAC;AAGpD,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,6CAA6C,CAAC;AAC/F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,KAAK,EAEV,YAAY,EAEZ,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EACnB,MAAM,8CAA8C,CAAC;AACtD,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACtB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,wCAAwC,CAA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