host: Bypass mode is the Harness's full access with no prompts (danger-full-access + never)
This commit is contained in:
1 parent
be885026f9
commit
ac4770f2b1
3 files changed
+17
-12
No files matched your search
@@ -53,12 +53,12 @@ the Harness's own `read-only`, `workspace-write` and `danger-full-access` preset
|
||||
| --- | --- | --- | --- | --- |
|
||||
| Manual (default) | `strata-manual` | `read-only` | `ask` | The sandbox denies every file change, so the agent must request a one-shot widening (`sandbox_permissions`), and that request is the Approve/Deny card. Reads and read-only commands run without a question. |
|
||||
| Plan | `strata-plan` | `read-only` | `never` | Nothing can change. A request to widen is rejected without asking anyone, so no Approve card is ever shown; the card ends "Not allowed in this mode". The agent reads, plans and answers. |
|
||||
| Bypass | `strata-bypass` | `workspace-write` | `never` | Writes and commands inside the workspace (and the Harness's permitted temp areas) run without a question. Anything wider, such as `danger-full-access` or a path outside the workspace, is refused, again without a question. |
|
||||
| Bypass | `strata-bypass` | `danger-full-access` | `never` | The Harness's own full-access, never-ask bundle. Writes and commands anywhere on this computer run without a question. |
|
||||
|
||||
- The mode is read once per turn. Changing the menu during a turn affects the next turn; the running one keeps the permissions it started with.
|
||||
- An unknown or missing value (an older stored `auto` or `accept-edits`) is Manual, never something looser.
|
||||
- The session keeps its preset across host restarts (it is a durable event in the Harness record); the page's choice is stored with the chat.
|
||||
- Nothing in the three presets is `danger-full-access`. If Bypass should mean "also outside the workspace", change `MODE_PRESETS.bypass` in `profile.mjs` to `danger-full-access` + `never`; that is the Harness's own "full access without approval prompts" bundle.
|
||||
- Bypass is the only full-access mode (the pinned Harness's `danger-full-access` preset: sandbox `danger-full-access`, approval `never`). Manual and Plan stay read-only.
|
||||
- Windows: the read-only shell runs PowerShell in Constrained Language Mode. A shell command can fail inside Manual or Plan for reasons that have nothing to do with approvals (the card shows the PowerShell error).
|
||||
|
||||
## Tests
|
||||
|
||||
@@ -29,12 +29,12 @@ export const ASSUMED_API_CONTEXT = 128_000;
|
||||
* sandbox mode plus an approval policy; the Harness switches them with its own `/permission` command.
|
||||
* manual read-only sandbox + ask: any change is denied by the sandbox until the user approves a one-shot widening
|
||||
* plan read-only sandbox + never: nothing can change, and the agent is told not to ask
|
||||
* bypass workspace-write + never: changes inside the workspace without prompts; anything wider is refused
|
||||
* bypass danger-full-access + never: the Harness's own full-access, never-ask bundle (its `danger-full-access` preset)
|
||||
*/
|
||||
export const MODE_PRESETS = Object.freeze({
|
||||
manual: { key: 'strata-manual', sandbox: 'read-only', approval: 'ask', name: 'Manual', description: 'Asks before changing a file or running a command that changes anything.' },
|
||||
plan: { key: 'strata-plan', sandbox: 'read-only', approval: 'never', name: 'Plan', description: 'Read-only. Nothing is changed and no approval prompts appear.' },
|
||||
bypass: { key: 'strata-bypass', sandbox: 'workspace-write', approval: 'never', name: 'Bypass', description: 'Changes inside the workspace without asking. Nothing outside the workspace.' },
|
||||
bypass: { key: 'strata-bypass', sandbox: 'danger-full-access', approval: 'never', name: 'Bypass', description: 'Full access without approval prompts. Files and commands anywhere on this computer run without asking.' },
|
||||
});
|
||||
export const DEFAULT_MODE = 'manual';
|
||||
/** The preset for a chat's stored mode. Anything unknown (older values such as `auto`) gets the strictest ask-first mode. */
|
||||
|
||||
@@ -60,14 +60,14 @@ test('mode mapping: three presets, the strictest by default, unknown values fall
|
||||
assert.deepEqual(Object.keys(MODE_PRESETS), ['manual', 'plan', 'bypass']);
|
||||
assert.deepEqual([MODE_PRESETS.manual.sandbox, MODE_PRESETS.manual.approval], ['read-only', 'ask']);
|
||||
assert.deepEqual([MODE_PRESETS.plan.sandbox, MODE_PRESETS.plan.approval], ['read-only', 'never']);
|
||||
assert.deepEqual([MODE_PRESETS.bypass.sandbox, MODE_PRESETS.bypass.approval], ['workspace-write', 'never']);
|
||||
assert.deepEqual([MODE_PRESETS.bypass.sandbox, MODE_PRESETS.bypass.approval], ['danger-full-access', 'never']);
|
||||
for (const v of ['manual', 'plan', 'bypass']) assert.equal(modeOf(v), v);
|
||||
for (const v of [undefined, null, '', 'auto', 'accept-edits', 'danger-full-access', 'constructor']) assert.equal(modeOf(v), 'manual', String(v));
|
||||
// No preset gives full access to the machine, and the profile names our three and nothing else.
|
||||
// Only Bypass gives full access, and the profile names our three and nothing else.
|
||||
const entry = JSON.parse(buildProfile({ local: [] }).patch.split('\n').slice(1).join('\n')).find(e => e.id === 'permission');
|
||||
assert.deepEqual(Object.keys(entry.config.presets), ['strata-manual', 'strata-plan', 'strata-bypass']);
|
||||
assert.equal(entry.config.defaultPreset, 'strata-manual');
|
||||
assert.ok(!Object.values(entry.config.presets).some(p => p.sandbox === 'danger-full-access'));
|
||||
assert.deepEqual(Object.entries(entry.config.presets).filter(([, p]) => p.sandbox === 'danger-full-access').map(([k]) => k), ['strata-bypass']);
|
||||
});
|
||||
|
||||
test('projection: under "never" no card ever offers Approve; "ask" marks the approved card', () => {
|
||||
@@ -154,7 +154,7 @@ test('MODE Plan: a write is refused with no question, the file never appears, re
|
||||
assert.match(tools(read).at(-1).tool.result, /readable in plan mode/);
|
||||
});
|
||||
|
||||
test('MODE Bypass: an in-workspace write runs without asking, and full access is still refused', { skip }, async t => {
|
||||
test('MODE Bypass is full access: in-workspace and outside writes run without asking', { skip }, async t => {
|
||||
const r = await rig(t);
|
||||
const frames = await r.run('m-bypass', 'SCRIPT:retrywrite free.txt hello', { mode: 'bypass' });
|
||||
assert.ok(!states(frames).includes('proposed'), 'Bypass asks nothing');
|
||||
@@ -167,11 +167,16 @@ test('MODE Bypass: an in-workspace write runs without asking, and full access is
|
||||
assert.ok(!states(shell).includes('proposed'));
|
||||
assert.equal(lines(join(r.ws, 'free-shell.txt')), 1);
|
||||
|
||||
// Bypass does not hand out the machine: a call that asks for danger-full-access is refused without a prompt.
|
||||
// Bypass is the Harness's full access with no prompts: a call that asks for danger-full-access runs, in the workspace or outside it.
|
||||
const wide = await r.run('m-bypass-wide', 'SCRIPT:tool wide.txt x', { mode: 'bypass' });
|
||||
assert.ok(!states(wide).includes('proposed'));
|
||||
assert.equal(existsSync(join(r.ws, 'wide.txt')), false);
|
||||
assert.equal(states(wide).at(-1), 'denied');
|
||||
assert.ok(!states(wide).includes('proposed'), 'full access asks nothing');
|
||||
assert.equal(lines(join(r.ws, 'wide.txt')), 1);
|
||||
assert.equal(states(wide).at(-1), 'done');
|
||||
const outside = join(r.dir, 'outside-workspace.txt');
|
||||
const out = await r.run('m-bypass-outside', `SCRIPT:tool ${outside} y`, { mode: 'bypass' });
|
||||
assert.ok(!states(out).includes('proposed'));
|
||||
assert.equal(lines(outside), 1, 'a path outside the workspace was written');
|
||||
assert.equal(states(out).at(-1), 'done');
|
||||
});
|
||||
|
||||
test('MODE the choice follows the chat: it changes on the next turn, keeps the session, and an unknown value is Manual', { skip }, async t => {
|
||||
|
||||
Reference in new issue
Block a user