@miosa/cli 1.0.63 → 1.0.65
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 +20 -0
- package/dist/bin/miosa.js +1 -0
- package/dist/bin/miosa.js.map +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +21 -2
- package/dist/client.js.map +1 -1
- package/dist/commands/capabilities.d.ts.map +1 -1
- package/dist/commands/capabilities.js +54 -0
- package/dist/commands/capabilities.js.map +1 -1
- package/dist/commands/{machines.d.ts → devices.d.ts} +1 -1
- package/dist/commands/devices.d.ts.map +1 -0
- package/dist/commands/devices.js +283 -0
- package/dist/commands/devices.js.map +1 -0
- package/dist/commands/sandbox.d.ts.map +1 -1
- package/dist/commands/sandbox.js +37 -6
- package/dist/commands/sandbox.js.map +1 -1
- package/package.json +1 -1
- package/dist/commands/machines.d.ts.map +0 -1
- package/dist/commands/machines.js +0 -29
- package/dist/commands/machines.js.map +0 -1
- package/dist/miosa-linux-x64 +0 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { apiPath, client, unwrap } from "./enterprise-util.js";
|
|
3
|
+
import { isJsonMode } from "../cli-env.js";
|
|
4
|
+
import { renderTable } from "../ui/table.js";
|
|
5
|
+
import { handleError } from "./util.js";
|
|
6
|
+
const DEVICE_CATALOG = [
|
|
7
|
+
{
|
|
8
|
+
kind: "sandbox_worker",
|
|
9
|
+
label: "Sandbox Worker",
|
|
10
|
+
purpose: "Isolated Linux workspace for agents to create files, run code, preview apps, snapshot, fork, and publish.",
|
|
11
|
+
lifecycle: "Persistent by default. Stop snapshots state; resume/fork continues from saved filesystem when backend snapshots are available.",
|
|
12
|
+
persistence: "Use --timeout 1h or sandbox extend during active work. Use snapshot/checkpoint/fork for durable recovery points.",
|
|
13
|
+
primary_commands: [
|
|
14
|
+
"miosa sandbox create --template nextjs --timeout 1h --wait --json",
|
|
15
|
+
"miosa sandbox prompt <id> --provider codex --json -- <task>",
|
|
16
|
+
"miosa sandbox exec <id> -- sh -lc '<command>'",
|
|
17
|
+
"miosa sandbox write-file <id> /workspace/file ./file --json",
|
|
18
|
+
"miosa sandbox publish <id> --wait --json",
|
|
19
|
+
],
|
|
20
|
+
use_when: [
|
|
21
|
+
"Coding agents should build inside the remote workspace.",
|
|
22
|
+
"You need filesystem, command execution, package installs, preview ports, artifacts, or app publish.",
|
|
23
|
+
"You want Polsia/Nebula-style virtual device behavior without a GUI desktop.",
|
|
24
|
+
],
|
|
25
|
+
avoid_when: [
|
|
26
|
+
"The task requires a full desktop browser session with VNC/CUA.",
|
|
27
|
+
"You need a long-lived production app; publish it after preview is ready.",
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
kind: "computer",
|
|
32
|
+
label: "Computer",
|
|
33
|
+
purpose: "Durable VM/desktop device for browser automation, CUA sessions, SSH, tunnels, and persistent agent control.",
|
|
34
|
+
lifecycle: "Managed as a Computer. It is the correct target for GUI/browser-heavy work and remote operator sessions.",
|
|
35
|
+
persistence: "Use computer checkpoints, volumes, tunnels, and agent sessions for long-lived desktop workflows.",
|
|
36
|
+
primary_commands: [
|
|
37
|
+
"miosa computers list --json",
|
|
38
|
+
"miosa up --computer --json",
|
|
39
|
+
"miosa agent <computer-id> '<task>'",
|
|
40
|
+
"miosa desktop open <computer-id>",
|
|
41
|
+
"miosa tunnel open <computer-id> --port 3000",
|
|
42
|
+
],
|
|
43
|
+
use_when: [
|
|
44
|
+
"The agent must use Chromium or a full desktop.",
|
|
45
|
+
"The workflow needs login to dashboards, form filling, screenshots, or CUA-style control.",
|
|
46
|
+
"A human and agent need to share the same persistent machine state.",
|
|
47
|
+
],
|
|
48
|
+
avoid_when: [
|
|
49
|
+
"Simple code generation/build/test work fits a cheaper sandbox worker.",
|
|
50
|
+
"The output is a production deployment; use Docker Deploy or standard deploy after build.",
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
kind: "local_device",
|
|
55
|
+
label: "Local Device",
|
|
56
|
+
purpose: "A developer-owned machine connected through MIOSA CLI/MCP for local files, diagnostics, and private tools.",
|
|
57
|
+
lifecycle: "Not hosted by MIOSA. The user owns uptime, filesystem state, and local credentials.",
|
|
58
|
+
persistence: "State is whatever exists on the developer machine; do not assume cloud resume semantics.",
|
|
59
|
+
primary_commands: [
|
|
60
|
+
"miosa mcp install --client claude --scope user",
|
|
61
|
+
"miosa doctor --json",
|
|
62
|
+
"miosa status --json",
|
|
63
|
+
],
|
|
64
|
+
use_when: [
|
|
65
|
+
"The user wants to connect an existing local coding environment.",
|
|
66
|
+
"The agent needs local repository context before creating a cloud device.",
|
|
67
|
+
],
|
|
68
|
+
avoid_when: [
|
|
69
|
+
"Customer code must stay isolated in MIOSA-hosted infrastructure.",
|
|
70
|
+
"The workflow needs reproducible shared cloud state.",
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
kind: "docker_deploy_host",
|
|
75
|
+
label: "Docker Deploy Host",
|
|
76
|
+
purpose: "Workspace appliance VM that runs Docker containers for durable apps published from sandboxes.",
|
|
77
|
+
lifecycle: "Always-on deployment capacity. Apps are versioned releases, not interactive coding workspaces.",
|
|
78
|
+
persistence: "App releases and routing are durable; use sandbox workers for edits, then publish to the host.",
|
|
79
|
+
primary_commands: [
|
|
80
|
+
"miosa docker-deploy hosts list --json",
|
|
81
|
+
"miosa sandbox publish <id> --docker-deploy --wait --json",
|
|
82
|
+
"miosa deploy --docker-deploy --wait --json",
|
|
83
|
+
],
|
|
84
|
+
use_when: [
|
|
85
|
+
"You need many small apps, APIs, funnels, or client sites in one workspace appliance.",
|
|
86
|
+
"You want stable public URLs backed by Docker containers.",
|
|
87
|
+
],
|
|
88
|
+
avoid_when: [
|
|
89
|
+
"Interactive agent work is still happening; finish in a sandbox first.",
|
|
90
|
+
"The app needs the standard MIOSA Deploy runtime instead of Docker Deploy.",
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
];
|
|
94
|
+
const ROUTING = {
|
|
95
|
+
build_code: "Use sandbox_worker. Run the coding agent inside it with sandbox prompt/exec and publish after HTTP 200.",
|
|
96
|
+
browser_automation: "Use computer. It has the desktop/browser/CUA surface needed for dashboards, clicks, and visual inspection.",
|
|
97
|
+
durable_app: "Use docker_deploy_host after the app is ready. Publish from the sandbox into a versioned deployment.",
|
|
98
|
+
local_private_context: "Use local_device only for local discovery or user-owned files, then move execution into a sandbox/computer.",
|
|
99
|
+
massive_parallel_agents: "Use one sandbox_worker per isolated code/task shard, computers only where GUI/browser state is required, and Docker Deploy for durable outputs.",
|
|
100
|
+
};
|
|
101
|
+
export function register(program) {
|
|
102
|
+
const devices = program
|
|
103
|
+
.command("devices")
|
|
104
|
+
.alias("device")
|
|
105
|
+
.description("Inspect MIOSA device types: sandboxes, computers, local devices, and Docker Deploy hosts");
|
|
106
|
+
devices
|
|
107
|
+
.command("catalog")
|
|
108
|
+
.description("Print the MIOSA device catalog and routing guidance")
|
|
109
|
+
.option("--json", "Output as JSON")
|
|
110
|
+
.action((opts) => runDeviceAction(async () => {
|
|
111
|
+
const output = { devices: DEVICE_CATALOG, routing: ROUTING };
|
|
112
|
+
if (isJsonMode(opts)) {
|
|
113
|
+
console.log(JSON.stringify(output, null, 2));
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
console.log(chalk.bold("MIOSA devices"));
|
|
117
|
+
console.log();
|
|
118
|
+
renderTable(DEVICE_CATALOG, [
|
|
119
|
+
{ header: "KIND", key: (row) => row.kind },
|
|
120
|
+
{ header: "LABEL", key: (row) => row.label },
|
|
121
|
+
{ header: "PURPOSE", key: (row) => row.purpose, width: 72 },
|
|
122
|
+
]);
|
|
123
|
+
console.log();
|
|
124
|
+
console.log(chalk.bold("Routing"));
|
|
125
|
+
for (const [job, guidance] of Object.entries(ROUTING)) {
|
|
126
|
+
console.log(`${chalk.cyan(job.padEnd(24))} ${guidance}`);
|
|
127
|
+
}
|
|
128
|
+
}));
|
|
129
|
+
devices
|
|
130
|
+
.command("list")
|
|
131
|
+
.description("List active hosted devices from sandboxes and computers")
|
|
132
|
+
.option("--type <kind>", "Filter: all, sandbox_worker, sandbox, computer", "all")
|
|
133
|
+
.option("--json", "Output as JSON")
|
|
134
|
+
.action((opts) => runDeviceAction(async () => {
|
|
135
|
+
const filter = normalizeKindFilter(opts.type ?? "all");
|
|
136
|
+
const { devices: records, errors } = await listDevices(filter);
|
|
137
|
+
const output = { devices: records, errors };
|
|
138
|
+
if (isJsonMode(opts)) {
|
|
139
|
+
console.log(JSON.stringify(output, null, 2));
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (records.length === 0) {
|
|
143
|
+
console.log(chalk.dim("No hosted devices found."));
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
renderTable(records, [
|
|
147
|
+
{ header: "ID", key: (row) => row.id, width: 12 },
|
|
148
|
+
{ header: "KIND", key: (row) => row.kind },
|
|
149
|
+
{ header: "NAME", key: (row) => row.name ?? "—" },
|
|
150
|
+
{ header: "STATE", key: (row) => row.state ?? "—" },
|
|
151
|
+
{
|
|
152
|
+
header: "READY",
|
|
153
|
+
key: (row) => row.ready == null ? "—" : row.ready ? "yes" : "no",
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
header: "PERSISTENT",
|
|
157
|
+
key: (row) => row.persistent == null
|
|
158
|
+
? "—"
|
|
159
|
+
: row.persistent
|
|
160
|
+
? "yes"
|
|
161
|
+
: "no",
|
|
162
|
+
},
|
|
163
|
+
{ header: "PREVIEW", key: (row) => row.preview_url ?? "—" },
|
|
164
|
+
]);
|
|
165
|
+
}
|
|
166
|
+
if (errors.length > 0) {
|
|
167
|
+
console.log();
|
|
168
|
+
console.log(chalk.yellow("Partial inventory errors:"));
|
|
169
|
+
for (const error of errors) {
|
|
170
|
+
console.log(`- ${error.source}: ${error.message}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}));
|
|
174
|
+
}
|
|
175
|
+
async function listDevices(filter) {
|
|
176
|
+
const records = [];
|
|
177
|
+
const errors = [];
|
|
178
|
+
if (filter === "all" || filter === "sandbox_worker") {
|
|
179
|
+
try {
|
|
180
|
+
const sandboxes = unwrapList(await client().apiGet(apiPath("/sandboxes")), ["sandboxes"]);
|
|
181
|
+
records.push(...sandboxes.map(normalizeSandbox));
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
errors.push(deviceListError("sandboxes", err));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (filter === "all" || filter === "computer") {
|
|
188
|
+
try {
|
|
189
|
+
const computers = unwrapList(await client().apiGet(apiPath("/computers")), ["computers"]);
|
|
190
|
+
records.push(...computers.map(normalizeComputer));
|
|
191
|
+
}
|
|
192
|
+
catch (err) {
|
|
193
|
+
errors.push(deviceListError("computers", err));
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return { devices: records, errors };
|
|
197
|
+
}
|
|
198
|
+
function normalizeKindFilter(value) {
|
|
199
|
+
const normalized = value.trim().toLowerCase().replaceAll("-", "_");
|
|
200
|
+
if (normalized === "all")
|
|
201
|
+
return "all";
|
|
202
|
+
if (normalized === "sandbox")
|
|
203
|
+
return "sandbox_worker";
|
|
204
|
+
if (normalized === "sandbox_worker")
|
|
205
|
+
return "sandbox_worker";
|
|
206
|
+
if (normalized === "computer")
|
|
207
|
+
return "computer";
|
|
208
|
+
throw new Error(`Unsupported device type "${value}". Use: all, sandbox_worker, sandbox, computer`);
|
|
209
|
+
}
|
|
210
|
+
function normalizeSandbox(row) {
|
|
211
|
+
return {
|
|
212
|
+
id: stringField(row, "id"),
|
|
213
|
+
kind: "sandbox_worker",
|
|
214
|
+
source: "sandboxes",
|
|
215
|
+
name: optionalString(row, "name"),
|
|
216
|
+
state: optionalString(row, "state") ?? optionalString(row, "status"),
|
|
217
|
+
ready: optionalBoolean(row, "ready"),
|
|
218
|
+
persistent: optionalBoolean(row, "persistent"),
|
|
219
|
+
always_on: optionalBoolean(row, "always_on"),
|
|
220
|
+
template: optionalString(row, "template_id") ?? optionalString(row, "template"),
|
|
221
|
+
preview_url: optionalString(row, "preview_url"),
|
|
222
|
+
timeout_remaining_ms: optionalNumber(row, "timeout_remaining_ms"),
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
function normalizeComputer(row) {
|
|
226
|
+
return {
|
|
227
|
+
id: stringField(row, "id"),
|
|
228
|
+
kind: "computer",
|
|
229
|
+
source: "computers",
|
|
230
|
+
name: optionalString(row, "name"),
|
|
231
|
+
state: optionalString(row, "status") ?? optionalString(row, "state"),
|
|
232
|
+
ready: optionalBoolean(row, "ready"),
|
|
233
|
+
region: optionalString(row, "region"),
|
|
234
|
+
template: optionalString(row, "template_type") ?? optionalString(row, "template"),
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function unwrapList(payload, keys) {
|
|
238
|
+
const value = unwrap(payload);
|
|
239
|
+
if (Array.isArray(value))
|
|
240
|
+
return value.filter(isRecord);
|
|
241
|
+
if (isRecord(value)) {
|
|
242
|
+
for (const key of keys) {
|
|
243
|
+
const nested = value[key];
|
|
244
|
+
if (Array.isArray(nested))
|
|
245
|
+
return nested.filter(isRecord);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return [];
|
|
249
|
+
}
|
|
250
|
+
function deviceListError(source, err) {
|
|
251
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
252
|
+
return {
|
|
253
|
+
source,
|
|
254
|
+
message,
|
|
255
|
+
retryable: /fetch failed|ECONNRESET|HTTP 502|other side closed|socket hang up|bad gateway/i.test(message),
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
function stringField(row, key) {
|
|
259
|
+
const value = row[key];
|
|
260
|
+
return typeof value === "string" ? value : String(value ?? "");
|
|
261
|
+
}
|
|
262
|
+
function optionalString(row, key) {
|
|
263
|
+
const value = row[key];
|
|
264
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
265
|
+
}
|
|
266
|
+
function optionalBoolean(row, key) {
|
|
267
|
+
return typeof row[key] === "boolean" ? row[key] : undefined;
|
|
268
|
+
}
|
|
269
|
+
function optionalNumber(row, key) {
|
|
270
|
+
return typeof row[key] === "number" ? row[key] : undefined;
|
|
271
|
+
}
|
|
272
|
+
function isRecord(value) {
|
|
273
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
274
|
+
}
|
|
275
|
+
async function runDeviceAction(fn) {
|
|
276
|
+
try {
|
|
277
|
+
await fn();
|
|
278
|
+
}
|
|
279
|
+
catch (err) {
|
|
280
|
+
handleError(err);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=devices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devices.js","sourceRoot":"","sources":["../../src/commands/devices.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAoB,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AA0CxC,MAAM,cAAc,GAAyB;IAC3C;QACE,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,gBAAgB;QACvB,OAAO,EACL,2GAA2G;QAC7G,SAAS,EACP,gIAAgI;QAClI,WAAW,EACT,kHAAkH;QACpH,gBAAgB,EAAE;YAChB,mEAAmE;YACnE,6DAA6D;YAC7D,+CAA+C;YAC/C,6DAA6D;YAC7D,0CAA0C;SAC3C;QACD,QAAQ,EAAE;YACR,yDAAyD;YACzD,qGAAqG;YACrG,6EAA6E;SAC9E;QACD,UAAU,EAAE;YACV,gEAAgE;YAChE,0EAA0E;SAC3E;KACF;IACD;QACE,IAAI,EAAE,UAAU;QACh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AAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../src/commands/sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2DzC,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA2sE/C"}
|
package/dist/commands/sandbox.js
CHANGED
|
@@ -362,11 +362,12 @@ export function register(program) {
|
|
|
362
362
|
}));
|
|
363
363
|
registerSandboxConnectorCommands(sandbox);
|
|
364
364
|
// prompt — invoke an in-Sandbox AI agent CLI (mirrors `box prompt`).
|
|
365
|
-
// Implemented as
|
|
365
|
+
// Implemented as sandbox exec so agents work inside the remote filesystem.
|
|
366
366
|
sandbox
|
|
367
367
|
.command("prompt <sandbox-id> <instruction...>")
|
|
368
|
-
.description("Run an in-Sandbox AI agent
|
|
369
|
-
.option("--provider <name>", "
|
|
368
|
+
.description("Run an in-Sandbox AI agent runtime with the given instruction")
|
|
369
|
+
.option("--provider <name>", "Agent runtime: claude (default), claude-code, codex, pi, hermes, osa, custom")
|
|
370
|
+
.option("--runtime-command <command>", "Executable command for --provider custom, e.g. 'hermes-agent run'")
|
|
370
371
|
.option("--model <name>", "Provider-specific model name")
|
|
371
372
|
.option("--connector <uid>", "MIOSA Connect connector UID to preflight before running the agent")
|
|
372
373
|
.option("--preflight", "Verify the Sandbox has the requested provider connector before exec")
|
|
@@ -375,8 +376,9 @@ export function register(program) {
|
|
|
375
376
|
.option("--json", "Output as JSON")
|
|
376
377
|
.action((id, words, opts) => runAction(async () => {
|
|
377
378
|
const provider = opts.provider ?? "claude";
|
|
378
|
-
const
|
|
379
|
-
if (!
|
|
379
|
+
const runtimeCommand = runtimeCommandForProvider(provider, opts.runtimeCommand);
|
|
380
|
+
if (!runtimeCommand) {
|
|
381
|
+
const allowedProviders = supportedPromptProviders();
|
|
380
382
|
throw new Error(`Unsupported provider "${provider}". Use: ${allowedProviders.join(", ")}`);
|
|
381
383
|
}
|
|
382
384
|
if (opts.connector || opts.preflight) {
|
|
@@ -391,7 +393,7 @@ export function register(program) {
|
|
|
391
393
|
const modelFlag = opts.model
|
|
392
394
|
? ` --model ${`'${opts.model.replace(/'/g, "'\\''")}'`}`
|
|
393
395
|
: "";
|
|
394
|
-
const command = commandInCwd(`${
|
|
396
|
+
const command = commandInCwd(`${runtimeCommand}${modelFlag} ${shellQuote(instruction)}`, opts.cwd);
|
|
395
397
|
const body = { command };
|
|
396
398
|
if (opts.cwd) {
|
|
397
399
|
body["cwd"] = opts.cwd;
|
|
@@ -3027,6 +3029,35 @@ function commandInCwd(command, cwd) {
|
|
|
3027
3029
|
return command;
|
|
3028
3030
|
return `cd ${shellQuote(cwd)} && ${command}`;
|
|
3029
3031
|
}
|
|
3032
|
+
function supportedPromptProviders() {
|
|
3033
|
+
return [
|
|
3034
|
+
"claude",
|
|
3035
|
+
"claude-code",
|
|
3036
|
+
"codex",
|
|
3037
|
+
"pi",
|
|
3038
|
+
"hermes",
|
|
3039
|
+
"osa",
|
|
3040
|
+
"custom",
|
|
3041
|
+
];
|
|
3042
|
+
}
|
|
3043
|
+
function runtimeCommandForProvider(provider, runtimeCommand) {
|
|
3044
|
+
const normalized = provider.trim().toLowerCase();
|
|
3045
|
+
if (normalized === "custom") {
|
|
3046
|
+
if (!runtimeCommand?.trim()) {
|
|
3047
|
+
throw new Error("--provider custom requires --runtime-command, e.g. --runtime-command 'hermes-agent run'");
|
|
3048
|
+
}
|
|
3049
|
+
return runtimeCommand.trim();
|
|
3050
|
+
}
|
|
3051
|
+
const builtIns = {
|
|
3052
|
+
claude: "claude",
|
|
3053
|
+
"claude-code": "claude",
|
|
3054
|
+
codex: "codex",
|
|
3055
|
+
pi: "pi",
|
|
3056
|
+
hermes: "hermes",
|
|
3057
|
+
osa: "osa",
|
|
3058
|
+
};
|
|
3059
|
+
return builtIns[normalized] ?? null;
|
|
3060
|
+
}
|
|
3030
3061
|
function backgroundCommand(command) {
|
|
3031
3062
|
if (!command.trim())
|
|
3032
3063
|
return command;
|