@0perator/operator 0.1.222 → 0.1.261
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/README.md +6 -5
- package/dashboard/server.mjs +1 -1
- package/dist/acp/agent.js +320 -53
- package/dist/acp/auth.js +44 -0
- package/dist/acp/config-options.js +34 -0
- package/dist/acp/prompt.js +41 -0
- package/dist/acp/run.js +116 -10
- package/dist/acp/tool-map.js +48 -0
- package/dist/auth/byo.js +125 -0
- package/dist/auth/client.js +12 -6
- package/dist/auth/commands.js +71 -3
- package/dist/auth/identity.js +136 -0
- package/dist/auth/store.js +7 -5
- package/dist/autonomy/board.js +3 -2
- package/dist/autonomy/cron.js +332 -0
- package/dist/autonomy/delegate.js +168 -0
- package/dist/autonomy/dream.js +1 -1
- package/dist/autonomy/index.js +16 -2
- package/dist/autonomy/media-robot.js +137 -0
- package/dist/autonomy/profile.js +77 -0
- package/dist/autonomy/routines.js +5 -4
- package/dist/autonomy/session-factory.js +19 -10
- package/dist/background/index.js +8 -1
- package/dist/browser/cdp.js +266 -0
- package/dist/browser/session.js +286 -0
- package/dist/cli.js +207 -106
- package/dist/compose/client.js +56 -0
- package/dist/config/brand.js +3 -3
- package/dist/config/home.js +70 -0
- package/dist/config/managed.js +230 -0
- package/dist/config/persona.js +243 -21
- package/dist/config/scaffold.js +142 -0
- package/dist/config/settings.js +87 -20
- package/dist/config/skills-index.js +175 -0
- package/dist/consolidation/scheduler.js +10 -7
- package/dist/consolidation/sleep.js +17 -3
- package/dist/engine/agent.js +231 -21
- package/dist/engine/aurora.js +79 -14
- package/dist/engine/batch-scheduler.js +128 -0
- package/dist/engine/compaction.js +129 -2
- package/dist/engine/computer-event.js +139 -0
- package/dist/engine/continuation.js +55 -0
- package/dist/engine/contract.js +3 -1
- package/dist/engine/grandmaster.js +13 -3
- package/dist/engine/json-repair.js +105 -0
- package/dist/engine/messages.js +52 -5
- package/dist/engine/redact.js +25 -0
- package/dist/engine/rolling-summary.js +28 -11
- package/dist/engine/router-adapter.js +2 -0
- package/dist/engine/unrestricted.js +51 -0
- package/dist/engine/verify-gate.js +6 -0
- package/dist/enterprise/cli.js +137 -0
- package/dist/flywheel/processor.js +30 -2
- package/dist/flywheel/secret-gate.js +123 -0
- package/dist/index.browser.js +4 -0
- package/dist/index.js +4 -0
- package/dist/mcp/index.js +18 -24
- package/dist/memory/index.js +0 -0
- package/dist/memory/session-index.js +324 -0
- package/dist/memory/session-rewind.js +92 -0
- package/dist/memory/state-maintenance.js +441 -0
- package/dist/observability/index.js +3 -3
- package/dist/permissions/audit.js +4 -1
- package/dist/permissions/index.js +24 -12
- package/dist/permissions/policy.js +4 -3
- package/dist/permissions/tier.js +31 -14
- package/dist/remote/host.js +9 -2
- package/dist/router/models.js +62 -2
- package/dist/selfimprove/index.js +9 -7
- package/dist/session.js +129 -42
- package/dist/skills/catalogue.js +167 -0
- package/dist/telemetry/audit-verify.js +94 -0
- package/dist/telemetry/events.js +92 -7
- package/dist/telemetry/lifecycle.js +18 -0
- package/dist/tools/computer.js +1 -1
- package/dist/tools/deferred.js +117 -0
- package/dist/tools/executor.js +27 -23
- package/dist/tools/memory.js +117 -0
- package/dist/tools/mutating.js +6 -0
- package/dist/tools/registry.js +1022 -46
- package/dist/tools/sandbox.js +63 -17
- package/dist/tools/searxng.js +2 -2
- package/dist/tools/shell-session.js +36 -1
- package/dist/tools/tool-output-spill.js +4 -4
- package/dist/ui/ActivitySpinner.js +17 -6
- package/dist/ui/App.js +36 -14
- package/dist/ui/ArtifactPicker.js +109 -0
- package/dist/ui/Composer.js +39 -8
- package/dist/ui/Markdown.js +5 -3
- package/dist/ui/MouseProvider.js +99 -19
- package/dist/ui/QuestionPrompt.js +24 -3
- package/dist/ui/ThinkingSpinner.js +9 -5
- package/dist/ui/ToolStep.js +17 -12
- package/dist/ui/Transcript.js +28 -9
- package/dist/ui/capabilities.js +0 -9
- package/dist/ui/listhit.js +23 -0
- package/dist/ui/mouse.js +22 -0
- package/dist/ui/osc.js +7 -4
- package/dist/ui/progressbar.js +46 -0
- package/dist/ui/shimmer.js +43 -0
- package/dist/ui/theme.js +2 -0
- package/dist/ui/tick.js +48 -0
- package/dist/ui/toolicons.js +69 -0
- package/dist/ui/useInputHistory.js +3 -3
- package/dist/util/slash.js +1 -0
- package/dist/vault/cli.js +48 -0
- package/dist/vault/store.js +157 -0
- package/dist/vault/tool.js +50 -0
- package/package.json +3 -5
- package/CHANGELOG.md +0 -1629
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Browser-safe home resolution: NO static `node:` imports — this module is reachable from the engine
|
|
2
|
+
// bundle (src/engine/rolling-summary.ts), and index.browser.ts must stay node-free (the esbuild
|
|
3
|
+
// --platform=neutral purity gate fails on any node builtin leak). Uses process.getBuiltinModule at
|
|
4
|
+
// call time, with env-only / relative fallbacks when node builtins are unavailable (JSCore/browser).
|
|
5
|
+
function builtins() {
|
|
6
|
+
try {
|
|
7
|
+
const proc = globalThis.process;
|
|
8
|
+
const os = proc?.getBuiltinModule?.("node:os");
|
|
9
|
+
const path = proc?.getBuiltinModule?.("node:path");
|
|
10
|
+
if (!os || !path)
|
|
11
|
+
return null;
|
|
12
|
+
return { os, path };
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Resolve the operator home directory. Precedence:
|
|
20
|
+
* 1. `$KODE_HOME` when set — explicit override, wins over everything;
|
|
21
|
+
* 2. `$KODE_PROFILE` when set AND a valid profile name ([A-Za-z0-9_-]{1,64}) —
|
|
22
|
+
* resolves to `<defaultHome>/profiles/<name>` (an invalid name is IGNORED, not an error);
|
|
23
|
+
* 3. the default home `~/.axe/operator`.
|
|
24
|
+
*/
|
|
25
|
+
export function get_operator_home() {
|
|
26
|
+
const env = globalThis.process?.env;
|
|
27
|
+
if (env?.KODE_HOME)
|
|
28
|
+
return env.KODE_HOME;
|
|
29
|
+
const b = builtins();
|
|
30
|
+
const defaultHome = b ? b.path.join(b.os.homedir(), ".axe", "operator") : ".axe/operator"; // node-less fallback: best-effort relative path
|
|
31
|
+
const profile = env?.KODE_PROFILE;
|
|
32
|
+
if (profile && /^[A-Za-z0-9_-]{1,64}$/.test(profile)) {
|
|
33
|
+
return b ? b.path.join(defaultHome, "profiles", profile) : `${defaultHome}/profiles/${profile}`;
|
|
34
|
+
}
|
|
35
|
+
return defaultHome;
|
|
36
|
+
}
|
|
37
|
+
/** Join one or more path segments under the operator home. */
|
|
38
|
+
export function operatorPath(...parts) {
|
|
39
|
+
const home = get_operator_home();
|
|
40
|
+
const b = builtins();
|
|
41
|
+
return b ? b.path.join(home, ...parts) : [home, ...parts].join("/");
|
|
42
|
+
}
|
|
43
|
+
/** The managed owner-CLI toolkit's single PATH addition (operator-home-v2 phase 5): every tool
|
|
44
|
+
* toolkit-verify.sh materializes lands here as a symlink. */
|
|
45
|
+
export function toolsBinPath() {
|
|
46
|
+
return operatorPath("tools", "bin");
|
|
47
|
+
}
|
|
48
|
+
/** Prepend `bin` to a PATH-style string. Delimiter-aware, idempotent (no-op when already present),
|
|
49
|
+
* and never emits an empty segment. Exported pure for tests. */
|
|
50
|
+
export function prependPath(pathValue, bin, sep) {
|
|
51
|
+
if (!pathValue)
|
|
52
|
+
return bin;
|
|
53
|
+
const parts = pathValue.split(sep);
|
|
54
|
+
return parts.includes(bin) ? pathValue : [bin, ...parts].join(sep);
|
|
55
|
+
}
|
|
56
|
+
/** Project `$KODE_HOME/tools/bin` onto the front of this process's PATH, once and idempotently
|
|
57
|
+
* (operator-home-v2 phase 5). Called at CLI startup so EVERY child — the persistent bash, the
|
|
58
|
+
* exec-file tools, and in-process cron/headless sessions — inherits the toolkit without touching
|
|
59
|
+
* anything else. Windows convention (`Path` key) is honored when `PATH` is absent. Browser/JSCore
|
|
60
|
+
* contexts have no process.env here: silent no-op, engine purity unaffected. */
|
|
61
|
+
export function applyToolsBinPath(env) {
|
|
62
|
+
const proc = globalThis.process;
|
|
63
|
+
const target = env ?? proc?.env;
|
|
64
|
+
if (!target)
|
|
65
|
+
return;
|
|
66
|
+
const sep = builtins()?.path.delimiter ?? (proc?.platform === "win32" ? ";" : ":");
|
|
67
|
+
const bin = toolsBinPath();
|
|
68
|
+
const key = target.PATH !== undefined || target.Path === undefined ? "PATH" : "Path";
|
|
69
|
+
target[key] = prependPath(target[key], bin, sep);
|
|
70
|
+
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
// Managed policy — the org-deployed, user-proof layer of the settings stack. Until now every control an
|
|
2
|
+
// enterprise cares about (tier, permission mode, sandbox, computer control, the training flywheel) lived in
|
|
3
|
+
// the user's own ~/.axe/operator/settings.json or an env var, i.e. a seat could un-narrow itself by deleting a
|
|
4
|
+
// line. A managed policy is a root-owned file outside the user's home that is applied LAST — over defaults,
|
|
5
|
+
// user settings and env — so it can only be changed by whoever can write /etc or /Library.
|
|
6
|
+
//
|
|
7
|
+
// macOS /Library/Application Support/Operator/managed-settings.json
|
|
8
|
+
// Linux /etc/operator/managed-settings.json
|
|
9
|
+
// Windows %ProgramData%\Operator\managed-settings.json
|
|
10
|
+
// dev/test $KODE_MANAGED_SETTINGS — honoured ONLY when no system file exists, so setting the variable can
|
|
11
|
+
// never switch a deployed policy off.
|
|
12
|
+
//
|
|
13
|
+
// Fail CLOSED: a policy that exists but cannot be trusted (unparseable, wrong types, group/world-writable,
|
|
14
|
+
// not root-owned) does not silently fall back to "no policy" — the seat runs read-only/gated until it is
|
|
15
|
+
// fixed, loudly. Absent file = no managed policy = nothing changes (the owner's local experience).
|
|
16
|
+
import { createHash } from "node:crypto";
|
|
17
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
18
|
+
const TIER_NAMES = ["admin", "enterprise", "readonly"];
|
|
19
|
+
const MODE_NAMES = ["bypass", "audit", "gated"];
|
|
20
|
+
const RULE_NAMES = ["allow", "ask", "deny"];
|
|
21
|
+
const SANDBOX_NAMES = ["off", "workspace", "strict"];
|
|
22
|
+
export const LOCKDOWN = {
|
|
23
|
+
permissions: { mode: "gated", tier: "readonly" },
|
|
24
|
+
sandbox: { mode: "workspace" },
|
|
25
|
+
computer: { enabled: false },
|
|
26
|
+
mcp: false,
|
|
27
|
+
selfImprove: { flywheel: false },
|
|
28
|
+
};
|
|
29
|
+
export function systemManagedPaths(plat = process.platform, env = process.env) {
|
|
30
|
+
if (plat === "darwin")
|
|
31
|
+
return ["/Library/Application Support/Operator/managed-settings.json"];
|
|
32
|
+
if (plat === "win32")
|
|
33
|
+
return [`${env.ProgramData ?? "C:\\ProgramData"}\\Operator\\managed-settings.json`];
|
|
34
|
+
return ["/etc/operator/managed-settings.json"];
|
|
35
|
+
}
|
|
36
|
+
const isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
37
|
+
const isPosNum = (v) => typeof v === "number" && Number.isFinite(v) && v > 0;
|
|
38
|
+
function validateAuth(raw, errors) {
|
|
39
|
+
if (raw === undefined)
|
|
40
|
+
return undefined;
|
|
41
|
+
if (!isObj(raw)) {
|
|
42
|
+
errors.push("auth must be an object");
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
const out = {};
|
|
46
|
+
if (raw.requireSignIn !== undefined) {
|
|
47
|
+
if (typeof raw.requireSignIn === "boolean")
|
|
48
|
+
out.requireSignIn = raw.requireSignIn;
|
|
49
|
+
else
|
|
50
|
+
errors.push("auth.requireSignIn must be a boolean");
|
|
51
|
+
}
|
|
52
|
+
if (raw.maxTokenAgeHours !== undefined) {
|
|
53
|
+
if (isPosNum(raw.maxTokenAgeHours))
|
|
54
|
+
out.maxTokenAgeHours = raw.maxTokenAgeHours;
|
|
55
|
+
else
|
|
56
|
+
errors.push("auth.maxTokenAgeHours must be a positive number");
|
|
57
|
+
}
|
|
58
|
+
if (raw.offlineGraceHours !== undefined) {
|
|
59
|
+
if (isPosNum(raw.offlineGraceHours))
|
|
60
|
+
out.offlineGraceHours = raw.offlineGraceHours;
|
|
61
|
+
else
|
|
62
|
+
errors.push("auth.offlineGraceHours must be a positive number");
|
|
63
|
+
}
|
|
64
|
+
if (raw.allowedEmailDomains !== undefined) {
|
|
65
|
+
if (Array.isArray(raw.allowedEmailDomains) && raw.allowedEmailDomains.length > 0 && raw.allowedEmailDomains.every((d) => typeof d === "string" && d.length > 0)) {
|
|
66
|
+
out.allowedEmailDomains = raw.allowedEmailDomains.map((d) => d.toLowerCase().replace(/^@/, ""));
|
|
67
|
+
}
|
|
68
|
+
else
|
|
69
|
+
errors.push("auth.allowedEmailDomains must be a non-empty array of strings");
|
|
70
|
+
}
|
|
71
|
+
if (raw.roleTiers !== undefined) {
|
|
72
|
+
if (isObj(raw.roleTiers) && Object.values(raw.roleTiers).every((t) => typeof t === "string" && TIER_NAMES.includes(t)))
|
|
73
|
+
out.roleTiers = raw.roleTiers;
|
|
74
|
+
else
|
|
75
|
+
errors.push("auth.roleTiers must map role names to admin|enterprise|readonly");
|
|
76
|
+
}
|
|
77
|
+
if (raw.defaultTier !== undefined) {
|
|
78
|
+
if (typeof raw.defaultTier === "string" && TIER_NAMES.includes(raw.defaultTier))
|
|
79
|
+
out.defaultTier = raw.defaultTier;
|
|
80
|
+
else
|
|
81
|
+
errors.push("auth.defaultTier must be admin|enterprise|readonly");
|
|
82
|
+
}
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
/** Strict validation: every present key must have the right type/value, or it is an error (=> lockdown). Unknown
|
|
86
|
+
* top-level keys are reported but ignored — a newer policy file must not brick an older engine. */
|
|
87
|
+
export function validateManagedPolicy(raw) {
|
|
88
|
+
const errors = [];
|
|
89
|
+
const policy = {};
|
|
90
|
+
if (!isObj(raw))
|
|
91
|
+
return { policy, errors: ["policy must be a JSON object"], unknown: [] };
|
|
92
|
+
const known = new Set(["permissions", "sandbox", "computer", "mcp", "selfImprove", "unrestricted", "auth", "$schema", "_comment"]);
|
|
93
|
+
const unknown = Object.keys(raw).filter((k) => !known.has(k));
|
|
94
|
+
if (raw.permissions !== undefined) {
|
|
95
|
+
if (!isObj(raw.permissions))
|
|
96
|
+
errors.push("permissions must be an object");
|
|
97
|
+
else {
|
|
98
|
+
const p = {};
|
|
99
|
+
const { mode, tier, rules } = raw.permissions;
|
|
100
|
+
if (mode !== undefined) {
|
|
101
|
+
if (typeof mode === "string" && MODE_NAMES.includes(mode))
|
|
102
|
+
p.mode = mode;
|
|
103
|
+
else
|
|
104
|
+
errors.push("permissions.mode must be bypass|audit|gated");
|
|
105
|
+
}
|
|
106
|
+
if (tier !== undefined) {
|
|
107
|
+
if (typeof tier === "string" && TIER_NAMES.includes(tier))
|
|
108
|
+
p.tier = tier;
|
|
109
|
+
else
|
|
110
|
+
errors.push("permissions.tier must be admin|enterprise|readonly");
|
|
111
|
+
}
|
|
112
|
+
if (rules !== undefined) {
|
|
113
|
+
if (isObj(rules) && Object.values(rules).every((r) => typeof r === "string" && RULE_NAMES.includes(r)))
|
|
114
|
+
p.rules = rules;
|
|
115
|
+
else
|
|
116
|
+
errors.push("permissions.rules must map tool names to allow|ask|deny");
|
|
117
|
+
}
|
|
118
|
+
policy.permissions = p;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (raw.sandbox !== undefined) {
|
|
122
|
+
if (isObj(raw.sandbox) && typeof raw.sandbox.mode === "string" && SANDBOX_NAMES.includes(raw.sandbox.mode))
|
|
123
|
+
policy.sandbox = { mode: raw.sandbox.mode };
|
|
124
|
+
else
|
|
125
|
+
errors.push("sandbox.mode must be off|workspace|strict");
|
|
126
|
+
}
|
|
127
|
+
if (raw.computer !== undefined) {
|
|
128
|
+
if (isObj(raw.computer) && raw.computer.enabled === false)
|
|
129
|
+
policy.computer = { enabled: false };
|
|
130
|
+
else
|
|
131
|
+
errors.push("computer.enabled may only be set to false (a policy can disable computer control, never grant it)");
|
|
132
|
+
}
|
|
133
|
+
if (raw.mcp !== undefined) {
|
|
134
|
+
if (typeof raw.mcp === "boolean")
|
|
135
|
+
policy.mcp = raw.mcp;
|
|
136
|
+
else
|
|
137
|
+
errors.push("mcp must be a boolean");
|
|
138
|
+
}
|
|
139
|
+
if (raw.selfImprove !== undefined) {
|
|
140
|
+
if (isObj(raw.selfImprove) && typeof raw.selfImprove.flywheel === "boolean")
|
|
141
|
+
policy.selfImprove = { flywheel: raw.selfImprove.flywheel };
|
|
142
|
+
else
|
|
143
|
+
errors.push("selfImprove.flywheel must be a boolean");
|
|
144
|
+
}
|
|
145
|
+
if (raw.unrestricted !== undefined) {
|
|
146
|
+
if (typeof raw.unrestricted === "boolean")
|
|
147
|
+
policy.unrestricted = raw.unrestricted;
|
|
148
|
+
else
|
|
149
|
+
errors.push("unrestricted must be a boolean");
|
|
150
|
+
}
|
|
151
|
+
const auth = validateAuth(raw.auth, errors);
|
|
152
|
+
if (auth)
|
|
153
|
+
policy.auth = auth;
|
|
154
|
+
return { policy, errors, unknown };
|
|
155
|
+
}
|
|
156
|
+
function trustProblem(path, system) {
|
|
157
|
+
if (process.platform === "win32")
|
|
158
|
+
return null; // ACLs are not representable in a mode word
|
|
159
|
+
const st = statSync(path);
|
|
160
|
+
if (!st.isFile())
|
|
161
|
+
return "not a regular file";
|
|
162
|
+
if ((st.mode & 0o022) !== 0)
|
|
163
|
+
return `writable by group/other (mode ${(st.mode & 0o777).toString(8)})`;
|
|
164
|
+
if (system && st.uid !== 0)
|
|
165
|
+
return `not owned by root (uid ${st.uid}) — the user it belongs to could edit their own policy`;
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
export function loadManagedPolicy(opts = {}) {
|
|
169
|
+
const systemPaths = opts.systemPaths ?? systemManagedPaths();
|
|
170
|
+
const envPath = "envPath" in opts ? opts.envPath : process.env.KODE_MANAGED_SETTINGS;
|
|
171
|
+
const sys = systemPaths.find((p) => existsSync(p));
|
|
172
|
+
const path = sys ?? (envPath && existsSync(envPath) ? envPath : undefined);
|
|
173
|
+
if (!path)
|
|
174
|
+
return { info: { status: "none", errors: [] } };
|
|
175
|
+
const system = sys !== undefined;
|
|
176
|
+
const bad = (errors) => ({ info: { status: "invalid", path, errors }, policy: LOCKDOWN });
|
|
177
|
+
let raw;
|
|
178
|
+
try {
|
|
179
|
+
const problem = trustProblem(path, system);
|
|
180
|
+
if (problem)
|
|
181
|
+
return bad([`untrusted policy file: ${problem}`]);
|
|
182
|
+
raw = readFileSync(path, "utf8");
|
|
183
|
+
}
|
|
184
|
+
catch (e) {
|
|
185
|
+
return bad([`cannot read policy file: ${e instanceof Error ? e.message : String(e)}`]);
|
|
186
|
+
}
|
|
187
|
+
let parsed;
|
|
188
|
+
try {
|
|
189
|
+
parsed = JSON.parse(raw);
|
|
190
|
+
}
|
|
191
|
+
catch (e) {
|
|
192
|
+
return bad([`policy is not valid JSON: ${e instanceof Error ? e.message : String(e)}`]);
|
|
193
|
+
}
|
|
194
|
+
const { policy, errors } = validateManagedPolicy(parsed);
|
|
195
|
+
if (errors.length)
|
|
196
|
+
return bad(errors);
|
|
197
|
+
const id = createHash("sha256").update(raw).digest("hex").slice(0, 12);
|
|
198
|
+
return { info: { status: "ok", path, id, errors: [], auth: policy.auth }, policy };
|
|
199
|
+
}
|
|
200
|
+
/** Overlay a policy on already-resolved settings (defaults <- user file <- env <- THIS). Pure. */
|
|
201
|
+
export function applyManagedPolicy(s, load) {
|
|
202
|
+
const out = { ...s, managed: load.info };
|
|
203
|
+
const p = load.policy;
|
|
204
|
+
if (!p)
|
|
205
|
+
return out;
|
|
206
|
+
if (p.permissions) {
|
|
207
|
+
const perms = { ...s.permissions };
|
|
208
|
+
if (p.permissions.mode)
|
|
209
|
+
perms.mode = p.permissions.mode;
|
|
210
|
+
if (p.permissions.tier)
|
|
211
|
+
perms.tier = p.permissions.tier;
|
|
212
|
+
// Under a managed enforcing mode a user's own `allow` rule must not pre-approve what the org gates —
|
|
213
|
+
// users may still TIGHTEN (ask/deny); the org's own rules win every conflict.
|
|
214
|
+
const enforcing = (p.permissions.mode ?? perms.mode) !== "bypass";
|
|
215
|
+
const userRules = Object.fromEntries(Object.entries(s.permissions.rules ?? {}).filter(([, r]) => !enforcing || r !== "allow"));
|
|
216
|
+
const rules = { ...userRules, ...(p.permissions.rules ?? {}) };
|
|
217
|
+
out.permissions = { ...perms, ...(Object.keys(rules).length ? { rules } : {}) };
|
|
218
|
+
}
|
|
219
|
+
if (p.sandbox)
|
|
220
|
+
out.sandbox = { ...s.sandbox, mode: p.sandbox.mode };
|
|
221
|
+
if (p.computer?.enabled === false)
|
|
222
|
+
out.computer = { ...s.computer, enabled: false };
|
|
223
|
+
if (typeof p.mcp === "boolean")
|
|
224
|
+
out.mcp = p.mcp;
|
|
225
|
+
if (p.selfImprove)
|
|
226
|
+
out.selfImprove = { ...s.selfImprove, flywheel: p.selfImprove.flywheel };
|
|
227
|
+
if (p.unrestricted === false)
|
|
228
|
+
out.unrestricted = false;
|
|
229
|
+
return out;
|
|
230
|
+
}
|