@sparkelf/dsh-patch-approval-allow-policy 0.0.0-stage → 0.2.1-alpha.13
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/LICENSE +21 -0
- package/package.json +34 -4
- package/patches/approval-allow-policy.patch +76 -0
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DeepSeek
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
{
|
|
2
|
+
"description": "Data-only exact official-source patch adding an 'allow' approval policy that admits what 'never' refused",
|
|
3
|
+
"dshPatch": {
|
|
4
|
+
"formatVersion": 1,
|
|
5
|
+
"variants": [
|
|
6
|
+
{
|
|
7
|
+
"dsh": ">=0.2.0-rc.2",
|
|
8
|
+
"file": "./patches/approval-allow-policy.patch",
|
|
9
|
+
"id": "approval-allow-policy",
|
|
10
|
+
"target": {
|
|
11
|
+
"baseRevision": "5badb15009ae1756c3afe0ae0cef1faafc290ccc",
|
|
12
|
+
"kind": "dsh-source",
|
|
13
|
+
"paths": [
|
|
14
|
+
"packages/interaction/user-approval/",
|
|
15
|
+
"packages/bundle/base/"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"patches/*.patch"
|
|
23
|
+
],
|
|
24
|
+
"license": "MIT",
|
|
2
25
|
"name": "@sparkelf/dsh-patch-approval-allow-policy",
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"directory": "patches/npm/approval-allow-policy",
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/SparkElf/deepseek-harness-plus.git"
|
|
33
|
+
},
|
|
34
|
+
"type": "module",
|
|
35
|
+
"version": "0.2.1-alpha.13"
|
|
36
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
diff --git a/packages/bundle/base/cordis.patch.yml b/packages/bundle/base/cordis.patch.yml
|
|
2
|
+
index 9c35ebf5c2..c62ddf9ad8 100644
|
|
3
|
+
--- a/packages/bundle/base/cordis.patch.yml
|
|
4
|
+
+++ b/packages/bundle/base/cordis.patch.yml
|
|
5
|
+
@@ -245,7 +245,7 @@
|
|
6
|
+
- id: approval
|
|
7
|
+
name: '@deepseek-ai/dsh-user-approval'
|
|
8
|
+
config:
|
|
9
|
+
- policy: !!js "(process.env.DSH_PERMISSION_MODE ?? 'workspace-write') === 'danger-full-access' ? 'never' : 'ask'"
|
|
10
|
+
+ policy: !!js "(process.env.DSH_PERMISSION_MODE ?? 'workspace-write') === 'danger-full-access' ? 'allow' : 'ask'"
|
|
11
|
+
|
|
12
|
+
- id: permission
|
|
13
|
+
name: '@deepseek-ai/dsh-permission-presets'
|
|
14
|
+
@@ -259,7 +259,7 @@
|
|
15
|
+
approval: ask
|
|
16
|
+
danger-full-access:
|
|
17
|
+
sandbox: danger-full-access
|
|
18
|
+
- approval: never
|
|
19
|
+
+ approval: allow
|
|
20
|
+
|
|
21
|
+
- id: shell-env
|
|
22
|
+
name: '@deepseek-ai/dsh-shell-env'
|
|
23
|
+
diff --git a/packages/interaction/user-approval/src/index.ts b/packages/interaction/user-approval/src/index.ts
|
|
24
|
+
index 9a14f04d0b..58f4eaf876 100644
|
|
25
|
+
--- a/packages/interaction/user-approval/src/index.ts
|
|
26
|
+
+++ b/packages/interaction/user-approval/src/index.ts
|
|
27
|
+
@@ -64,14 +64,17 @@ const OUTCOMES: readonly ApprovalOutcome[] = ['allowed-once', 'rejected', 'cance
|
|
28
|
+
* deterministically. The strict headless stance (CI, unattended runs) and
|
|
29
|
+
* the policy whose outcome is knowable without asking.
|
|
30
|
+
*/
|
|
31
|
+
-export type ApprovalPolicy = 'ask' | 'never'
|
|
32
|
+
+export type ApprovalPolicy = 'ask' | 'never' | 'allow'
|
|
33
|
+
|
|
34
|
+
/** Every {@link ApprovalPolicy}, for option advertisement and runtime validation of untrusted policy strings. */
|
|
35
|
+
-export const APPROVAL_POLICIES: readonly ApprovalPolicy[] = ['ask', 'never']
|
|
36
|
+
+export const APPROVAL_POLICIES: readonly ApprovalPolicy[] = ['ask', 'never', 'allow']
|
|
37
|
+
|
|
38
|
+
/** Model-facing statement for the deterministic `'never'` policy. */
|
|
39
|
+
const NEVER_SENTENCE = 'Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`).'
|
|
40
|
+
/** Model-facing statement for an interactive policy that may still fail closed. */
|
|
41
|
+
+/** Model-facing statement for the deterministic `'allow'` policy. */
|
|
42
|
+
+const ALLOW_SENTENCE = 'Approval policy: allow. Operations that require approval are approved automatically; no prompt is shown and sandbox escalation is permitted.'
|
|
43
|
+
+/** Model-facing statement for an interactive policy that may still fail closed. */
|
|
44
|
+
const ASK_SENTENCE = 'Approval policy: ask. Operations that require approval may ask through the configured answerers; without an available answerer, the request fails closed.'
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
@@ -149,7 +152,7 @@ export interface Config {
|
|
48
|
+
*/
|
|
49
|
+
export class ApprovalService extends Service {
|
|
50
|
+
static Config: z<Config> = z.object({
|
|
51
|
+
- policy: z.union(['ask', 'never'] as const).default('ask'),
|
|
52
|
+
+ policy: z.union(['ask', 'never', 'allow'] as const).default('ask'),
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
constructor(ctx: Context, public config: Config) {
|
|
56
|
+
@@ -168,7 +171,8 @@ export class ApprovalService extends Service {
|
|
57
|
+
// A bare assemble() (tests, diagnostics) has no session to state.
|
|
58
|
+
if (agent === undefined) return ''
|
|
59
|
+
const policy = effective(agent)
|
|
60
|
+
- return policy === 'never' ? NEVER_SENTENCE : ASK_SENTENCE
|
|
61
|
+
+ if (policy === 'never') return NEVER_SENTENCE
|
|
62
|
+
+ return policy === 'allow' ? ALLOW_SENTENCE : ASK_SENTENCE
|
|
63
|
+
},
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
@@ -273,6 +277,10 @@ export class ApprovalService extends Service {
|
|
67
|
+
// documented promise that 'never' rejects deterministically regardless
|
|
68
|
+
// of registration order — only the service's own request path can.
|
|
69
|
+
if (this.effectivePolicy(session) === 'never') return 'rejected'
|
|
70
|
+
+ // 'allow' is the mirror of 'never' and is decided at the same point for the same
|
|
71
|
+
+ // reason: the outcome must not depend on which answerers happen to be composed or on
|
|
72
|
+
+ // listener registration order.
|
|
73
|
+
+ if (this.effectivePolicy(session) === 'allow') return 'allowed-once'
|
|
74
|
+
// Enter the promise chain BEFORE dispatching: a listener that throws
|
|
75
|
+
// SYNCHRONOUSLY (before its first await) must land in the same rejection
|
|
76
|
+
// path as an async one — `Promise.resolve(call())` would let it escape
|
package/README.md
DELETED