@dream_engine/computer 0.0.0-stage → 0.1.1

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.
@@ -0,0 +1,134 @@
1
+ import { type PermissionLevel, type PermissionCheck, capabilitiesFor } from './permission.js';
2
+ export type { PermissionLevel, PermissionCheck, PermissionGate, PermissionCapabilities } from './permission.js';
3
+ export { PERMISSION_LEVELS, capabilitiesFor, levelIndex, isAtLeast } from './permission.js';
4
+ /**
5
+ * **Phase 3 Security Review** of Agent 2's 11-level permission system.
6
+ *
7
+ * This module hardens the existing {@link PermissionGate} with:
8
+ *
9
+ * 1. **Sensitive-file protection** — a deny-list of paths that are NEVER readable or
10
+ * writable regardless of the effective level: `.env` files, SSH private keys,
11
+ * password stores, tokens, cookies, certificates, cloud credentials, and the
12
+ * `.git` config. Attempting to touch these is refused with an explicit reason.
13
+ * 2. **No auto-grant of privileged levels** — `execute-any`, `admin`, and `root` can only
14
+ * be set through an explicit, logged call to {@link AuditedGate.requestEscalation},
15
+ * which requires a human-supplied authorization reason. They are never granted
16
+ * implicitly, by a default, or by a delegated subtask.
17
+ * 3. **Separation of capabilities** — listing / metadata / read / write / delete / terminal /
18
+ * network / desktop remain distinct checks; the gate does not conflate them.
19
+ * 4. **Default least-privilege** — the default level is `observe` (read-only, no writes,
20
+ * no execution, no network).
21
+ * 5. **Trust-boundary enforcement** — a separate guard that ensures the browser agent
22
+ * (Agent 1) can never drive the computer agent (Agent 2) to execute instructions
23
+ * originating from an untrusted webpage.
24
+ */
25
+ /** Patterns that identify sensitive files/directories that must always be protected. */
26
+ export declare const SENSITIVE_PATTERNS: readonly RegExp[];
27
+ /** File extensions / names that are always treated as sensitive. */
28
+ export declare const SENSITIVE_EXTENSIONS: readonly string[];
29
+ /** Checks whether a path matches any sensitive-file pattern. */
30
+ export declare function isSensitivePath(path: string): boolean;
31
+ /**
32
+ * The levels that are **privileged** and must never be auto-granted.
33
+ * Setting any of these requires an explicit human authorization via {@link AuditedGate.requestEscalation}.
34
+ */
35
+ export declare const PRIVILEGED_LEVELS: readonly PermissionLevel[];
36
+ /** Whether a level is privileged (requires explicit authorization). */
37
+ export declare function isPrivilegedLevel(level: PermissionLevel): boolean;
38
+ export interface EscalationRequest {
39
+ /** The level to escalate to. */
40
+ level: PermissionLevel;
41
+ /** Human-readable reason for the escalation (required). */
42
+ reason: string;
43
+ /** Whether the user has explicitly authorized this escalation. */
44
+ authorized: boolean;
45
+ }
46
+ export interface SecurityAuditEntry {
47
+ at: string;
48
+ action: string;
49
+ level: PermissionLevel;
50
+ allowed: boolean;
51
+ reason?: string;
52
+ detail?: string;
53
+ }
54
+ export interface AuditedGateOptions {
55
+ roots?: string[];
56
+ commandAllowlist?: string[];
57
+ /** Callback invoked on every audited check (for logging/monitoring). */
58
+ onAudit?: (entry: SecurityAuditEntry) => void;
59
+ }
60
+ /**
61
+ * An audited permission gate that wraps {@link PermissionGate} with the Phase 3 security
62
+ * hardening. It:
63
+ *
64
+ * - Blocks all access to sensitive files (`.env`, SSH keys, tokens, cookies, certs, …)
65
+ * regardless of level.
66
+ * - Refuses to set a privileged level unless `requestEscalation` is called with
67
+ * `authorized: true` and a non-empty reason.
68
+ * - Records every check and escalation to an audit trail.
69
+ *
70
+ * The default level is `observe` (read-only) — the least-privilege default.
71
+ */
72
+ export declare class AuditedGate {
73
+ private readonly inner;
74
+ private readonly auditLog;
75
+ private readonly onAudit?;
76
+ constructor(level?: PermissionLevel, options?: AuditedGateOptions);
77
+ get level(): PermissionLevel;
78
+ get capabilities(): import("./permission.js").PermissionCapabilities;
79
+ get roots(): string[];
80
+ get audit(): readonly SecurityAuditEntry[];
81
+ /**
82
+ * Requests escalation to a privileged level. Returns `false` (and records an audit
83
+ * entry) unless the request is explicitly authorized with a non-empty reason. This is
84
+ * the ONLY way to reach `execute-any`, `network`, `admin`, or `root`.
85
+ */
86
+ requestEscalation(request: EscalationRequest): boolean;
87
+ /** Sets a level directly (non-privileged only). Privileged levels must use requestEscalation. */
88
+ setLevel(level: PermissionLevel): void;
89
+ checkRead(path: string): PermissionCheck;
90
+ checkWrite(path: string): PermissionCheck;
91
+ checkCommand(command: string): PermissionCheck;
92
+ checkNetwork(): PermissionCheck;
93
+ private record;
94
+ }
95
+ /**
96
+ * **Trust-boundary guard.** Ensures the browser agent (Agent 1) cannot drive the computer
97
+ * agent (Agent 2) to execute instructions that originate from an untrusted webpage.
98
+ *
99
+ * The browser agent's output (page text, extracted content, model reasoning about a page)
100
+ * is treated as **untrusted data**. This guard sanitizes any such data before it can be
101
+ * passed to the computer agent, stripping executable-looking content and flagging
102
+ * instructions. It never executes, never follows links, and never grants permissions.
103
+ */
104
+ export declare class TrustBoundaryGuard {
105
+ /** Patterns that indicate an instruction attempting to cross the trust boundary. */
106
+ private static readonly INSTRUCTION_PATTERNS;
107
+ /**
108
+ * Sanitizes untrusted browser-sourced text before it is passed to the computer agent.
109
+ * Returns a record indicating whether any suspicious instruction patterns were found.
110
+ */
111
+ sanitize(text: string): {
112
+ sanitized: string;
113
+ flagged: string[];
114
+ };
115
+ /**
116
+ * Asserts that a proposed computer-agent action does not originate from browser-supplied
117
+ * instructions. Throws if the action's context contains flagged instruction patterns.
118
+ */
119
+ assertSafeToDelegate(context: string, action: string): void;
120
+ }
121
+ /**
122
+ * Produces a human-readable security review report of the permission system,
123
+ * including the current level, capabilities, sensitive-file protection status,
124
+ * and whether privileged levels are locked behind explicit authorization.
125
+ */
126
+ export declare function securityReviewReport(gate: AuditedGate): {
127
+ level: PermissionLevel;
128
+ capabilities: ReturnType<typeof capabilitiesFor>;
129
+ sensitiveProtection: boolean;
130
+ privilegedLocked: boolean;
131
+ auditCount: number;
132
+ recommendations: string[];
133
+ };
134
+ //# sourceMappingURL=security-review.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-review.d.ts","sourceRoot":"","sources":["../src/security-review.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,eAAe,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,CAAC;IAC7B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CAqBA"}
@@ -0,0 +1,253 @@
1
+ import { ValidationError, RuntimeError } from '@dream_engine/core';
2
+ import { resolve as resolvePathImpl, basename as pathBasename } from 'node:path';
3
+ import { PermissionGate, PERMISSION_LEVELS, capabilitiesFor, } from './permission.js';
4
+ export { PERMISSION_LEVELS, capabilitiesFor, levelIndex, isAtLeast } from './permission.js';
5
+ /**
6
+ * **Phase 3 Security Review** of Agent 2's 11-level permission system.
7
+ *
8
+ * This module hardens the existing {@link PermissionGate} with:
9
+ *
10
+ * 1. **Sensitive-file protection** — a deny-list of paths that are NEVER readable or
11
+ * writable regardless of the effective level: `.env` files, SSH private keys,
12
+ * password stores, tokens, cookies, certificates, cloud credentials, and the
13
+ * `.git` config. Attempting to touch these is refused with an explicit reason.
14
+ * 2. **No auto-grant of privileged levels** — `execute-any`, `admin`, and `root` can only
15
+ * be set through an explicit, logged call to {@link AuditedGate.requestEscalation},
16
+ * which requires a human-supplied authorization reason. They are never granted
17
+ * implicitly, by a default, or by a delegated subtask.
18
+ * 3. **Separation of capabilities** — listing / metadata / read / write / delete / terminal /
19
+ * network / desktop remain distinct checks; the gate does not conflate them.
20
+ * 4. **Default least-privilege** — the default level is `observe` (read-only, no writes,
21
+ * no execution, no network).
22
+ * 5. **Trust-boundary enforcement** — a separate guard that ensures the browser agent
23
+ * (Agent 1) can never drive the computer agent (Agent 2) to execute instructions
24
+ * originating from an untrusted webpage.
25
+ */
26
+ /** Patterns that identify sensitive files/directories that must always be protected. */
27
+ export const SENSITIVE_PATTERNS = [
28
+ /(^|\/)\.env(\.|$)/i,
29
+ /(^|\/)\.env\.[a-z0-9_.-]+$/i,
30
+ /(^|\/)\.ssh\/.*/i,
31
+ /(^|\/)\.gnupg\/.*/i,
32
+ /(^|\/)\.aws\/credentials$/i,
33
+ /(^|\/)\.npmrc$/i,
34
+ /(^|\/)\.netrc$/i,
35
+ /(^|\/)\.git\/config$/i,
36
+ /(^|\/)\.git\/credentials$/i,
37
+ /(^|\/)\.docker\/config\.json$/i,
38
+ /(^|\/)\.kube\/config$/i,
39
+ /(^|\/)id_rsa$/i,
40
+ /(^|\/)id_ed25519$/i,
41
+ /(^|\/)\.password-store\/.*/i,
42
+ /(^|\/)\.secrets\b.*/i,
43
+ /(^|\/)\.token$/i,
44
+ /(^|\/)\.credentials$/i,
45
+ /(^|\/)cookies\.json$/i,
46
+ /(^|\/)\.bash_history$/i,
47
+ /(^|\/)\.zsh_history$/i,
48
+ ];
49
+ /** File extensions / names that are always treated as sensitive. */
50
+ export const SENSITIVE_EXTENSIONS = ['.pem', '.key', '.pfx', '.p12', '.jks', '.keystore'];
51
+ /** Checks whether a path matches any sensitive-file pattern. */
52
+ export function isSensitivePath(path) {
53
+ const resolved = resolvePathImpl(path);
54
+ const lower = resolved.toLowerCase();
55
+ for (const ext of SENSITIVE_EXTENSIONS) {
56
+ if (lower.endsWith(ext))
57
+ return true;
58
+ }
59
+ for (const pat of SENSITIVE_PATTERNS) {
60
+ if (pat.test(resolved) || pat.test(lower))
61
+ return true;
62
+ }
63
+ return false;
64
+ }
65
+ /**
66
+ * The levels that are **privileged** and must never be auto-granted.
67
+ * Setting any of these requires an explicit human authorization via {@link AuditedGate.requestEscalation}.
68
+ */
69
+ export const PRIVILEGED_LEVELS = ['execute-any', 'network', 'admin', 'root'];
70
+ /** Whether a level is privileged (requires explicit authorization). */
71
+ export function isPrivilegedLevel(level) {
72
+ return PRIVILEGED_LEVELS.includes(level);
73
+ }
74
+ /**
75
+ * An audited permission gate that wraps {@link PermissionGate} with the Phase 3 security
76
+ * hardening. It:
77
+ *
78
+ * - Blocks all access to sensitive files (`.env`, SSH keys, tokens, cookies, certs, …)
79
+ * regardless of level.
80
+ * - Refuses to set a privileged level unless `requestEscalation` is called with
81
+ * `authorized: true` and a non-empty reason.
82
+ * - Records every check and escalation to an audit trail.
83
+ *
84
+ * The default level is `observe` (read-only) — the least-privilege default.
85
+ */
86
+ export class AuditedGate {
87
+ inner;
88
+ auditLog = [];
89
+ onAudit;
90
+ constructor(level = 'observe', options = {}) {
91
+ this.inner = new PermissionGate(level, { roots: options.roots, commandAllowlist: options.commandAllowlist });
92
+ this.onAudit = options.onAudit;
93
+ }
94
+ get level() {
95
+ return this.inner.level;
96
+ }
97
+ get capabilities() {
98
+ return this.inner.capabilities;
99
+ }
100
+ get roots() {
101
+ return this.inner.roots;
102
+ }
103
+ get audit() {
104
+ return [...this.auditLog];
105
+ }
106
+ /**
107
+ * Requests escalation to a privileged level. Returns `false` (and records an audit
108
+ * entry) unless the request is explicitly authorized with a non-empty reason. This is
109
+ * the ONLY way to reach `execute-any`, `network`, `admin`, or `root`.
110
+ */
111
+ requestEscalation(request) {
112
+ if (!isPrivilegedLevel(request.level)) {
113
+ // Non-privileged levels can be set freely (still audited).
114
+ this.inner.setLevel(request.level);
115
+ this.record('setLevel', request.level, true, `set to non-privileged level ${request.level}`);
116
+ return true;
117
+ }
118
+ if (!request.authorized || !request.reason?.trim()) {
119
+ this.record('escalation_denied', this.inner.level, false, `Escalation to "${request.level}" requires explicit authorization and a reason.`);
120
+ return false;
121
+ }
122
+ this.inner.setLevel(request.level);
123
+ this.record('escalation_granted', request.level, true, `Escalation to "${request.level}": ${request.reason}`);
124
+ return true;
125
+ }
126
+ /** Sets a level directly (non-privileged only). Privileged levels must use requestEscalation. */
127
+ setLevel(level) {
128
+ if (isPrivilegedLevel(level)) {
129
+ throw new ValidationError(`Cannot set privileged level "${level}" directly. Use requestEscalation with explicit authorization.`);
130
+ }
131
+ this.inner.setLevel(level);
132
+ this.record('setLevel', level, true, `set to ${level}`);
133
+ }
134
+ checkRead(path) {
135
+ if (isSensitivePath(path)) {
136
+ this.record('checkRead', this.inner.level, false, `Sensitive path blocked: ${path}`);
137
+ return { allowed: false, reason: `Access to sensitive file "${basenameOf(path)}" is always denied` };
138
+ }
139
+ const check = this.inner.checkRead(path);
140
+ this.record('checkRead', this.inner.level, check.allowed, check.reason);
141
+ return check;
142
+ }
143
+ checkWrite(path) {
144
+ if (isSensitivePath(path)) {
145
+ this.record('checkWrite', this.inner.level, false, `Sensitive path blocked: ${path}`);
146
+ return { allowed: false, reason: `Access to sensitive file "${basenameOf(path)}" is always denied` };
147
+ }
148
+ const check = this.inner.checkWrite(path);
149
+ this.record('checkWrite', this.inner.level, check.allowed, check.reason);
150
+ return check;
151
+ }
152
+ checkCommand(command) {
153
+ // Block commands that attempt to read sensitive files, even if the base command is allowlisted.
154
+ const lower = command.toLowerCase();
155
+ for (const pat of SENSITIVE_PATTERNS) {
156
+ if (pat.test(lower)) {
157
+ this.record('checkCommand', this.inner.level, false, `Command touches sensitive path: ${command}`);
158
+ return { allowed: false, reason: 'Command references a sensitive path and is always denied' };
159
+ }
160
+ }
161
+ const check = this.inner.checkCommand(command);
162
+ this.record('checkCommand', this.inner.level, check.allowed, check.reason);
163
+ return check;
164
+ }
165
+ checkNetwork() {
166
+ const check = this.inner.checkNetwork();
167
+ this.record('checkNetwork', this.inner.level, check.allowed, check.reason);
168
+ return check;
169
+ }
170
+ record(action, level, allowed, detail) {
171
+ const entry = { at: new Date().toISOString(), action, level, allowed, ...(detail ? { detail } : {}) };
172
+ this.auditLog.push(entry);
173
+ this.onAudit?.(entry);
174
+ }
175
+ }
176
+ /**
177
+ * **Trust-boundary guard.** Ensures the browser agent (Agent 1) cannot drive the computer
178
+ * agent (Agent 2) to execute instructions that originate from an untrusted webpage.
179
+ *
180
+ * The browser agent's output (page text, extracted content, model reasoning about a page)
181
+ * is treated as **untrusted data**. This guard sanitizes any such data before it can be
182
+ * passed to the computer agent, stripping executable-looking content and flagging
183
+ * instructions. It never executes, never follows links, and never grants permissions.
184
+ */
185
+ export class TrustBoundaryGuard {
186
+ /** Patterns that indicate an instruction attempting to cross the trust boundary. */
187
+ static INSTRUCTION_PATTERNS = [
188
+ /you (must|should|need to|have to) /i,
189
+ /please (run|execute|delete|remove|cat|echo|write)/i,
190
+ /run the command/i,
191
+ /execute the following/i,
192
+ /\bsudo\b/i,
193
+ /\brm -rf\b/i,
194
+ /\bcurl\b.*\|\s*(ba|z|k)?sh\b/i,
195
+ /\bwget\b.*\|\s*(ba|z|k)?sh\b/i,
196
+ ];
197
+ /**
198
+ * Sanitizes untrusted browser-sourced text before it is passed to the computer agent.
199
+ * Returns a record indicating whether any suspicious instruction patterns were found.
200
+ */
201
+ sanitize(text) {
202
+ const flagged = [];
203
+ for (const pat of TrustBoundaryGuard.INSTRUCTION_PATTERNS) {
204
+ if (pat.test(text)) {
205
+ flagged.push(pat.source);
206
+ }
207
+ }
208
+ return { sanitized: text, flagged };
209
+ }
210
+ /**
211
+ * Asserts that a proposed computer-agent action does not originate from browser-supplied
212
+ * instructions. Throws if the action's context contains flagged instruction patterns.
213
+ */
214
+ assertSafeToDelegate(context, action) {
215
+ const { flagged } = this.sanitize(`${context}\n${action}`);
216
+ if (flagged.length > 0) {
217
+ throw new RuntimeError('Trust-boundary violation: browser-sourced content contains instructions directed at the computer agent. ' +
218
+ `Flagged patterns: ${flagged.join(', ')}. The computer agent will not execute actions derived from untrusted webpage content.`);
219
+ }
220
+ }
221
+ }
222
+ /**
223
+ * Produces a human-readable security review report of the permission system,
224
+ * including the current level, capabilities, sensitive-file protection status,
225
+ * and whether privileged levels are locked behind explicit authorization.
226
+ */
227
+ export function securityReviewReport(gate) {
228
+ const caps = gate.capabilities;
229
+ const recommendations = [];
230
+ if (gate.level === 'observe' || gate.level === 'read') {
231
+ recommendations.push('Default level is read-only (least privilege). Good.');
232
+ }
233
+ if (!isPrivilegedLevel(gate.level)) {
234
+ recommendations.push('Privileged levels (execute-any, network, admin, root) require explicit human authorization via requestEscalation. Good.');
235
+ }
236
+ else {
237
+ recommendations.push('WARNING: a privileged level is active. Ensure this was explicitly authorized.');
238
+ }
239
+ recommendations.push('Sensitive files (.env, SSH keys, tokens, cookies, certs) are always protected regardless of level.');
240
+ recommendations.push('The browser agent cannot drive the computer agent via untrusted webpage instructions (TrustBoundaryGuard).');
241
+ return {
242
+ level: gate.level,
243
+ capabilities: caps,
244
+ sensitiveProtection: true,
245
+ privilegedLocked: true,
246
+ auditCount: gate.audit.length,
247
+ recommendations,
248
+ };
249
+ }
250
+ function basenameOf(p) {
251
+ return pathBasename(p);
252
+ }
253
+ //# sourceMappingURL=security-review.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-review.js","sourceRoot":"","sources":["../src/security-review.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,WAAW,CAAC;AACjF,OAAO,EAGL,cAAc,EACd,iBAAiB,EACjB,eAAe,GAChB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5F;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,wFAAwF;AACxF,MAAM,CAAC,MAAM,kBAAkB,GAAsB;IACnD,oBAAoB;IACpB,6BAA6B;IAC7B,kBAAkB;IAClB,oBAAoB;IACpB,4BAA4B;IAC5B,iBAAiB;IACjB,iBAAiB;IACjB,uBAAuB;IACvB,4BAA4B;IAC5B,gCAAgC;IAChC,wBAAwB;IACxB,gBAAgB;IAChB,oBAAoB;IACpB,6BAA6B;IAC7B,sBAAsB;IACtB,iBAAiB;IACjB,uBAAuB;IACvB,uBAAuB;IACvB,wBAAwB;IACxB,uBAAuB;CACxB,CAAC;AAEF,oEAAoE;AACpE,MAAM,CAAC,MAAM,oBAAoB,GAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;AAE7G,gEAAgE;AAChE,MAAM,UAAU,e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I,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;QACtD,eAAe,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC;IAC9E,CAAC;IACD,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACnC,eAAe,CAAC,IAAI,CAAC,yHAAyH,CAAC,CAAC;IAClJ,CAAC;SAAM,CAAC;QACN,eAAe,CAAC,IAAI,CAAC,+EAA+E,CAAC,CAAC;IACxG,CAAC;IACD,eAAe,CAAC,IAAI,CAAC,oGAAoG,CAAC,CAAC;IAC3H,eAAe,CAAC,IAAI,CAAC,4GAA4G,CAAC,CAAC;IACnI,OAAO;QACL,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,YAAY,EAAE,IAAI;QAClB,mBAAmB,EAAE,IAAI;QACzB,gBAAgB,EAAE,IAAI;QACtB,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;QAC7B,eAAe;KAChB,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC;AACzB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { ToolRegistry } from '@dream_engine/agent';
2
+ import type { GateLike } from './permission.js';
3
+ /** Host dependencies for the terminal tools. */
4
+ export interface TerminalHost {
5
+ gate: GateLike;
6
+ cwd: string;
7
+ maxOutputBytes?: number;
8
+ timeoutMs?: number;
9
+ }
10
+ /**
11
+ * Splits a command string into argv without invoking a shell.
12
+ * This prevents shell injection — the command is executed as a single process
13
+ * with explicit arguments, never through `sh -c`.
14
+ */
15
+ export declare function parseCommand(command: string): string[];
16
+ /**
17
+ * Creates the terminal tools for Agent 2. Every command is checked against the
18
+ * {@link GateLike} permission gate before execution. Commands are run via `spawn`
19
+ * (no shell), with bounded output and a timeout.
20
+ */
21
+ export declare function createTerminalTools(host: TerminalHost): ToolRegistry;
22
+ //# sourceMappingURL=terminal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal.d.ts","sourceRoot":"","sources":["../src/terminal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAgC,MAAM,qBAAqB,CAAC;AACjF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,gDAAgD;AAChD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAKD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CA2BtD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY,CAoGpE"}
@@ -0,0 +1,141 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { ValidationError, RuntimeError } from '@dream_engine/core';
3
+ import { ToolRegistry, defineTool } from '@dream_engine/agent';
4
+ const DEFAULT_MAX_OUTPUT = 64 * 1024;
5
+ const DEFAULT_TIMEOUT = 30_000;
6
+ /**
7
+ * Splits a command string into argv without invoking a shell.
8
+ * This prevents shell injection — the command is executed as a single process
9
+ * with explicit arguments, never through `sh -c`.
10
+ */
11
+ export function parseCommand(command) {
12
+ if (!command?.trim())
13
+ throw new ValidationError('Command must be a non-empty string');
14
+ const tokens = [];
15
+ let current = '';
16
+ let quote = null;
17
+ for (let i = 0; i < command.length; i++) {
18
+ const ch = command[i];
19
+ if (quote) {
20
+ if (ch === quote) {
21
+ quote = null;
22
+ }
23
+ else {
24
+ current += ch;
25
+ }
26
+ }
27
+ else if (ch === '"' || ch === "'") {
28
+ quote = ch;
29
+ }
30
+ else if (ch === ' ' || ch === '\t' || ch === '\n') {
31
+ if (current) {
32
+ tokens.push(current);
33
+ current = '';
34
+ }
35
+ }
36
+ else {
37
+ current += ch;
38
+ }
39
+ }
40
+ if (current)
41
+ tokens.push(current);
42
+ if (!tokens.length)
43
+ throw new ValidationError('Command is empty');
44
+ return tokens;
45
+ }
46
+ /**
47
+ * Creates the terminal tools for Agent 2. Every command is checked against the
48
+ * {@link GateLike} permission gate before execution. Commands are run via `spawn`
49
+ * (no shell), with bounded output and a timeout.
50
+ */
51
+ export function createTerminalTools(host) {
52
+ const maxOutput = host.maxOutputBytes ?? DEFAULT_MAX_OUTPUT;
53
+ const timeout = host.timeoutMs ?? DEFAULT_TIMEOUT;
54
+ const registry = new ToolRegistry();
55
+ registry.register(defineTool({
56
+ name: 'computer_run_command',
57
+ description: 'Run a terminal command and return bounded stdout/stderr. Checked against the permission gate.',
58
+ inputSchema: {
59
+ type: 'object',
60
+ properties: { command: { type: 'string', description: 'The command to run (argv string, no shell).' } },
61
+ required: ['command'],
62
+ additionalProperties: false,
63
+ },
64
+ annotations: { openWorldHint: true },
65
+ handler: async (args, ctx) => {
66
+ const check = host.gate.checkCommand(args.command);
67
+ if (!check.allowed)
68
+ throw new RuntimeError(check.reason ?? 'Command denied');
69
+ const argv = parseCommand(args.command);
70
+ return new Promise((resolve, reject) => {
71
+ const proc = spawn(argv[0], argv.slice(1), {
72
+ cwd: host.cwd,
73
+ env: { ...process.env },
74
+ stdio: ['ignore', 'pipe', 'pipe'],
75
+ });
76
+ let stdout = '';
77
+ let stderr = '';
78
+ let outputBytes = 0;
79
+ let timedOut = false;
80
+ const timer = setTimeout(() => {
81
+ timedOut = true;
82
+ proc.kill('SIGKILL');
83
+ }, timeout);
84
+ proc.stdout?.on('data', (chunk) => {
85
+ outputBytes += chunk.length;
86
+ if (outputBytes <= maxOutput)
87
+ stdout += chunk.toString();
88
+ });
89
+ proc.stderr?.on('data', (chunk) => {
90
+ outputBytes += chunk.length;
91
+ if (outputBytes <= maxOutput)
92
+ stderr += chunk.toString();
93
+ });
94
+ proc.on('error', (error) => {
95
+ clearTimeout(timer);
96
+ reject(new RuntimeError(`Command failed to spawn: ${error.message}`));
97
+ });
98
+ proc.on('close', (code) => {
99
+ clearTimeout(timer);
100
+ resolve({
101
+ data: {
102
+ command: args.command,
103
+ exitCode: code,
104
+ stdout: stdout.slice(0, maxOutput),
105
+ stderr: stderr.slice(0, maxOutput),
106
+ timedOut,
107
+ truncated: outputBytes > maxOutput,
108
+ },
109
+ });
110
+ });
111
+ if (ctx.signal) {
112
+ ctx.signal.addEventListener('abort', () => {
113
+ clearTimeout(timer);
114
+ proc.kill('SIGKILL');
115
+ reject(new RuntimeError('Command aborted'));
116
+ }, { once: true });
117
+ }
118
+ });
119
+ },
120
+ }));
121
+ registry.register(defineTool({
122
+ name: 'computer_command_allowlist',
123
+ description: 'List the commands that are safe to run at the current permission level.',
124
+ inputSchema: { type: 'object', properties: {}, required: [], additionalProperties: false },
125
+ annotations: { readOnlyHint: true },
126
+ handler: async () => {
127
+ const caps = host.gate.capabilities;
128
+ const allowlist = caps.executeAny ? 'all commands' : caps.execute ? 'safe commands (allowlist)' : 'none';
129
+ return {
130
+ data: {
131
+ level: host.gate.level,
132
+ execute: caps.execute,
133
+ executeAny: caps.executeAny,
134
+ allowlist,
135
+ },
136
+ };
137
+ },
138
+ }));
139
+ return registry;
140
+ }
141
+ //# sourceMappingURL=terminal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal.js","sourceRoot":"","sources":["../src/terminal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAoB,MAAM,qBAAqB,CAAC;AAWjF,MAAM,kBAAkB,GAAG,EAAE,GAAG,IAAI,CAAC;AACrC,MAAM,eAAe,GAAG,MAAM,CAAC;AAE/B;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,IAAI,CAAC,OAAO,E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CACH,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,37 @@
1
1
  {
2
2
  "name": "@dream_engine/computer",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.1",
4
+ "description": "Agent 2 — local computer agent with an 11-level permission gate for BashirWeb.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/CodingWithBashir/BashirWeb.git",
10
+ "directory": "packages/computer"
11
+ },
12
+ "engines": {
13
+ "node": ">=22.16.0 <23 || >=24"
14
+ },
15
+ "main": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "default": "./dist/index.js"
21
+ },
22
+ "./package.json": "./package.json"
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "README.md"
27
+ ],
28
+ "sideEffects": false,
29
+ "dependencies": {
30
+ "@dream_engine/core": "0.1.1",
31
+ "@dream_engine/agent": "0.1.1",
32
+ "@dream_engine/security": "0.1.1"
33
+ },
34
+ "scripts": {
35
+ "build": "tsc -b"
36
+ }
6
37
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.