@demicodes/shell 0.11.0 → 0.13.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/README.md
CHANGED
|
@@ -5,10 +5,13 @@ A sandboxable bash engine for Demi. Commands run through a `Host` abstraction
|
|
|
5
5
|
same agent can target local, container, remote, or in-memory backends.
|
|
6
6
|
|
|
7
7
|
- `BashEnvironment` — long-running shell sessions with `exec` / `status` / `write`
|
|
8
|
-
/ `abort`
|
|
8
|
+
/ `abort` returning `ShellCommandStatus`, plus a `/@` virtual filesystem of
|
|
9
|
+
command artifacts.
|
|
9
10
|
- `Host` contract (see [Implement a Host](../../docs/guides/implement-a-host.md)).
|
|
10
|
-
- Built on a
|
|
11
|
+
- Built on a forked `just-bash` workspace package.
|
|
11
12
|
|
|
12
13
|
Subpaths: `@demicodes/shell/storage`, `@demicodes/shell/host-fs`.
|
|
14
|
+
See [docs/shell-yield-control-plan.md](../../docs/shell-yield-control-plan.md) for
|
|
15
|
+
the model-facing control surface and yield wakeups.
|
|
13
16
|
|
|
14
17
|
Part of [Demi](../../README.md). Apache-2.0.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as HostProcess, c as HostSpawnHandle, i as HostFileSystem, l as HostSpawnParams, n as HostDirent, o as HostProcessOutputChunk, r as HostFileStat, s as HostSpawnExit, t as Host, u as HostStore } from "./host-DIg4RxcL.mjs";
|
|
2
2
|
import { HostBackedFileSystem, VirtualFileSystemNode, VirtualFileSystemProvider, virtualDirectory, virtualFile } from "./host-fs.mjs";
|
|
3
|
-
import { _ as runRegisteredCommand, a as CommandIO, c as CommandRegistry, d as CommandStdin, f as CommandStorage, g as renderCommandHelp, h as parseCommandInput, i as CommandExecutionContext, l as CommandRunContext, m as emptyStdin, n as COMMAND_HELP_DEFAULTS, o as CommandInputSpec, p as ParsedCommandInput, r as Command, s as CommandOutputSpec, t as AgentSessionCommandStorage, u as CommandRunResult } from "./storage-
|
|
3
|
+
import { _ as runRegisteredCommand, a as CommandIO, c as CommandRegistry, d as CommandStdin, f as CommandStorage, g as renderCommandHelp, h as parseCommandInput, i as CommandExecutionContext, l as CommandRunContext, m as emptyStdin, n as COMMAND_HELP_DEFAULTS, o as CommandInputSpec, p as ParsedCommandInput, r as Command, s as CommandOutputSpec, t as AgentSessionCommandStorage, u as CommandRunResult } from "./storage-ylShLr2v.mjs";
|
|
4
4
|
import { CommandName } from "@demicodes/just-bash/commands";
|
|
5
5
|
import { Interpreter, InterpreterState } from "@demicodes/just-bash/interpreter";
|
|
6
6
|
import { CommandRegistry as CommandRegistry$1, ExecResult } from "@demicodes/just-bash/types";
|
package/dist/index.mjs
CHANGED
|
@@ -121,8 +121,7 @@ const EXECUTION_ONLY_FIELDS = [
|
|
|
121
121
|
"input",
|
|
122
122
|
"positionals",
|
|
123
123
|
"stdinField",
|
|
124
|
-
"output"
|
|
125
|
-
"examples"
|
|
124
|
+
"output"
|
|
126
125
|
];
|
|
127
126
|
const COMMAND_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
|
|
128
127
|
var CommandRegistry = class {
|
|
@@ -292,11 +291,6 @@ function renderCommandHelp(command, parentPath = "") {
|
|
|
292
291
|
if (command.stdinField) lines.push(` stdin/heredoc: ${command.stdinField}`);
|
|
293
292
|
if (command.output?.json) lines.push(" --json: emits machine-readable JSON for this command");
|
|
294
293
|
else lines.push(" --json: accepted only when this command defines JSON output");
|
|
295
|
-
const examples = command.examples ?? [];
|
|
296
|
-
if (examples.length > 0) {
|
|
297
|
-
lines.push(" Examples:");
|
|
298
|
-
for (const example of examples) lines.push(indent(example, 6));
|
|
299
|
-
}
|
|
300
294
|
}
|
|
301
295
|
const children = command.subcommands ?? [];
|
|
302
296
|
if (children.length > 0) {
|
|
@@ -312,9 +306,9 @@ function validateCommandTree(command, path) {
|
|
|
312
306
|
const hasRun = typeof command.run === "function";
|
|
313
307
|
const children = command.subcommands ?? [];
|
|
314
308
|
if (!hasRun && children.length === 0) throw new Error(`CommandRegistry: "${path}" must have run() and/or subcommands`);
|
|
315
|
-
if (hasRun) {
|
|
316
|
-
if (
|
|
317
|
-
}
|
|
309
|
+
if (!hasRun) {
|
|
310
|
+
for (const field of EXECUTION_ONLY_FIELDS) if (command[field] !== void 0) throw new Error(`CommandRegistry: "${path}" sets ${field} without run()`);
|
|
311
|
+
}
|
|
318
312
|
if (hasRun) {
|
|
319
313
|
const input = command.input ?? {};
|
|
320
314
|
if (command.stdinField && !(command.stdinField in input)) throw new Error(`CommandRegistry: "${path}" stdinField "${command.stdinField}" is not in input`);
|
|
@@ -364,10 +358,6 @@ function coerceValue(schema, value) {
|
|
|
364
358
|
function formatField(field, schema, positional, stdin) {
|
|
365
359
|
return `${positional ? `<${field}>` : `--${field}`}${stdin ? " (from stdin/heredoc)" : ""}${schema.description ? ` - ${schema.description}` : ""}`;
|
|
366
360
|
}
|
|
367
|
-
function indent(text, spaces) {
|
|
368
|
-
const prefix = " ".repeat(spaces);
|
|
369
|
-
return text.split("\n").map((line) => `${prefix}${line}`).join("\n");
|
|
370
|
-
}
|
|
371
361
|
function isArraySchema(schema) {
|
|
372
362
|
const unwrapped = unwrapSchema(schema);
|
|
373
363
|
return zodTypeName(unwrapped) === "array" || zodTypeName(unwrapped) === "ZodArray";
|
package/dist/storage.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as AgentSessionCommandStorage } from "./storage-
|
|
1
|
+
import { t as AgentSessionCommandStorage } from "./storage-ylShLr2v.mjs";
|
|
2
2
|
export { AgentSessionCommandStorage };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@demicodes/shell",
|
|
3
3
|
"description": "Sandboxable bash engine and Host contract for Demi.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.13.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@demicodes/just-bash": "^3.0.1-demi.5",
|
|
23
|
-
"@demicodes/utils": "^0.
|
|
23
|
+
"@demicodes/utils": "^0.13.0",
|
|
24
24
|
"zod": "^4.0.0"
|
|
25
25
|
},
|
|
26
26
|
"license": "Apache-2.0",
|