@struktoai/mirage-dsh 0.0.1 → 0.0.6
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/cordis.patch.yml +49 -0
- package/dist/{chunk-CATVBGGR.js → chunk-2F2PJ7D7.js} +66 -4
- package/dist/{chunk-CATVBGGR.js.map → chunk-2F2PJ7D7.js.map} +1 -1
- package/dist/chunk-4CZV24HW.js +196 -0
- package/dist/chunk-4CZV24HW.js.map +1 -0
- package/dist/{chunk-C67TSSYB.js → chunk-M4JOF35U.js} +108 -15
- package/dist/chunk-M4JOF35U.js.map +1 -0
- package/dist/chunk-QTBMLMKT.js +698 -0
- package/dist/chunk-QTBMLMKT.js.map +1 -0
- package/dist/fs-B3Zi9oo6.d.ts +104 -0
- package/dist/index.d.ts +137 -5
- package/dist/index.js +14 -6
- package/dist/plugin/fs.d.ts +1 -1
- package/dist/plugin/fs.js +2 -2
- package/dist/plugin/service.d.ts +3 -2
- package/dist/plugin/service.js +1 -1
- package/dist/plugin/shell.d.ts +1 -1
- package/dist/plugin/shell.js +2 -2
- package/dist/{service-CxFYAvoV.d.ts → service-BK6NR_RX.d.ts} +51 -1
- package/dist/shell-BTf2wsDy.d.ts +258 -0
- package/package.json +10 -7
- package/dist/chunk-C67TSSYB.js.map +0 -1
- package/dist/chunk-J6F4OX6Z.js +0 -102
- package/dist/chunk-J6F4OX6Z.js.map +0 -1
- package/dist/chunk-ZSZVHBSL.js +0 -455
- package/dist/chunk-ZSZVHBSL.js.map +0 -1
- package/dist/fs-CuiUEA7A.d.ts +0 -54
- package/dist/shell-B0N_jppN.d.ts +0 -108
package/dist/shell-B0N_jppN.d.ts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { Context } from '@deepseek-ai/cordis';
|
|
2
|
-
import { ShellExecutor, ShellExecRequest, ShellExecSpec, ShellRunResult, ShellProcess } from '@deepseek-ai/dsh-shell';
|
|
3
|
-
|
|
4
|
-
/** Configuration for the mirage shell executor. */
|
|
5
|
-
interface MirageShellConfig {
|
|
6
|
-
/**
|
|
7
|
-
* Default working directory for commands. Defaults to `/`. With
|
|
8
|
-
* `sessionId` it instead seeds the bound session's initial cwd, and the
|
|
9
|
-
* session's own cwd is the default from then on.
|
|
10
|
-
*/
|
|
11
|
-
workdir?: string;
|
|
12
|
-
/** Default foreground timeout in milliseconds. Defaults to 120000. */
|
|
13
|
-
defaultTimeoutMs?: number;
|
|
14
|
-
/** Upper cap on any requested timeout. Defaults to 600000. */
|
|
15
|
-
maxTimeoutMs?: number;
|
|
16
|
-
/** Default stdout capture budget in bytes. Defaults to 200000. */
|
|
17
|
-
stdoutMaxBytes?: number;
|
|
18
|
-
/** stderr capture budget in bytes. Defaults to 64000. */
|
|
19
|
-
stderrMaxBytes?: number;
|
|
20
|
-
/**
|
|
21
|
-
* Bind every command to this named workspace session. By default each
|
|
22
|
-
* command runs in an ephemeral fork of the workspace's default session,
|
|
23
|
-
* so nothing persists between calls, which is the one-shot contract of
|
|
24
|
-
* dsh's bash tool. With a session bound, `cd`, `export`, and function
|
|
25
|
-
* definitions persist across calls, the persistent-shell contract. The
|
|
26
|
-
* session is created on first use if the workspace does not have it; an
|
|
27
|
-
* existing session is adopted as is. A spec carrying an explicit
|
|
28
|
-
* `workdir` or `env` still runs as a one-call subshell of the bound
|
|
29
|
-
* session, per mirage's `ExecuteOptions` semantics.
|
|
30
|
-
*/
|
|
31
|
-
sessionId?: string;
|
|
32
|
-
/**
|
|
33
|
-
* When set, a background command whose streamed output overruns its
|
|
34
|
-
* delta budget spills its full stdout and stderr to files under this
|
|
35
|
-
* workspace directory, and `readOutput()` points at them so a reader
|
|
36
|
-
* can recover what the delta dropped. The directory is a workspace
|
|
37
|
-
* path (e.g. `/tmp` on a ram mount), so the agent reads the spill
|
|
38
|
-
* through the same VFS as everything else; the writes go through the
|
|
39
|
-
* workspace, so they appear in history like any other write. Unset
|
|
40
|
-
* (the default) means no spill: output that overruns is simply
|
|
41
|
-
* flagged `lossy`, the honest "no safe path available" answer.
|
|
42
|
-
*/
|
|
43
|
-
spillDir?: string;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Mirage-backed implementation of `ctx.shell`: `run` executes the command
|
|
47
|
-
* line with mirage's own shell (coreutils-faithful commands, installed
|
|
48
|
-
* CLIs, the policy layer) against the shared `ctx.mirage` workspace, so a
|
|
49
|
-
* path from `ctx.fs` means the same file here. There is no OS process
|
|
50
|
-
* behind a command: `signal` in results is a compatibility value for kills,
|
|
51
|
-
* and abort/timeout act cooperatively at the executor's own boundaries.
|
|
52
|
-
*
|
|
53
|
-
* Every command runs in an ephemeral fork of the workspace's default
|
|
54
|
-
* session, so no shell state survives from one call to the next, matching
|
|
55
|
-
* the one-shot contract of dsh's bash tool. Configuring a `sessionId`
|
|
56
|
-
* binds all commands to one named session instead, whose cwd, exports,
|
|
57
|
-
* and functions persist across calls.
|
|
58
|
-
*/
|
|
59
|
-
declare class MirageShellExecutor extends ShellExecutor {
|
|
60
|
-
static readonly inject: string[];
|
|
61
|
-
private readonly workdir;
|
|
62
|
-
private readonly defaultTimeoutMs;
|
|
63
|
-
private readonly maxTimeoutMs;
|
|
64
|
-
private readonly stdoutMaxBytes;
|
|
65
|
-
private readonly stderrMaxBytes;
|
|
66
|
-
private readonly sessionId;
|
|
67
|
-
private readonly spillDir;
|
|
68
|
-
private sessionReady;
|
|
69
|
-
constructor(ctx: Context, config?: MirageShellConfig);
|
|
70
|
-
private workspace;
|
|
71
|
-
private newSpill;
|
|
72
|
-
/**
|
|
73
|
-
* With every runtime in the world reaching only the vfs
|
|
74
|
-
* (`ctx.mirage.vfsOnly`), the workspace dispatch is the single gate
|
|
75
|
-
* for anything a command can do, so this executor behaves like a
|
|
76
|
-
* workspace-write sandbox: reads and writes land only where mounts
|
|
77
|
-
* (and their modes) allow. Declaring it lets sandbox-aware plugins
|
|
78
|
-
* (dsh's permission presets) compose over this executor. A world
|
|
79
|
-
* holding a runtime with doors around the gate (the host `local`
|
|
80
|
-
* python, a remote sandbox) voids that claim, so this answers
|
|
81
|
-
* undefined then (the base contract's "does not sandbox") and those
|
|
82
|
-
* plugins refuse to compose instead of trusting a lie.
|
|
83
|
-
*/
|
|
84
|
-
get sandboxMode(): ShellExecutor['sandboxMode'];
|
|
85
|
-
/**
|
|
86
|
-
* The sandbox facts to stamp on this run's result and process handle,
|
|
87
|
-
* or undefined when the world is not fully workspace-bound (no claim).
|
|
88
|
-
*
|
|
89
|
-
* `enforcement` is 'full': when every runtime reaches only the vfs, the
|
|
90
|
-
* workspace gate cannot be bypassed, so unlike an OS sandbox on an older
|
|
91
|
-
* kernel there is no promised effect it fails to govern. `denied` is
|
|
92
|
-
* false because mirage has no out-of-band denial channel: a refused write
|
|
93
|
-
* (a read-only mount) fails in-band as an ordinary command error with a
|
|
94
|
-
* nonzero exit, the way EROFS would, not as a separate sandbox verdict,
|
|
95
|
-
* so there is nothing here to distinguish from the command's own failure.
|
|
96
|
-
* `runnerFailed` is false because the workspace executor is the runner
|
|
97
|
-
* and a failure to run surfaces as a rejected/aborted execution, not a
|
|
98
|
-
* runner that never started.
|
|
99
|
-
*/
|
|
100
|
-
private sandboxInfo;
|
|
101
|
-
resolve(request: ShellExecRequest): ShellExecSpec;
|
|
102
|
-
private ensureSession;
|
|
103
|
-
private provisionSession;
|
|
104
|
-
run(spec: ShellExecSpec): Promise<ShellRunResult>;
|
|
105
|
-
start(spec: ShellExecSpec): ShellProcess;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export { type MirageShellConfig as M, MirageShellExecutor as a };
|