@dsh-cc/command-permissions 0.5.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/LICENSE +201 -0
- package/lib/client/index.d.ts +22 -0
- package/lib/client/index.d.ts.map +1 -0
- package/lib/client/index.js +50 -0
- package/lib/client/index.js.map +1 -0
- package/lib/client.js +97 -0
- package/lib/client.js.map +1 -0
- package/lib/index.d.ts +51 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +165 -0
- package/lib/index.js.map +1 -0
- package/lib/invariant.d.ts +16 -0
- package/lib/invariant.d.ts.map +1 -0
- package/lib/invariant.js +23 -0
- package/lib/invariant.js.map +1 -0
- package/lib/modes.d.ts +33 -0
- package/lib/modes.d.ts.map +1 -0
- package/lib/modes.js +33 -0
- package/lib/modes.js.map +1 -0
- package/lib/permissions.d.ts +28 -0
- package/lib/permissions.d.ts.map +1 -0
- package/lib/permissions.js +51 -0
- package/lib/permissions.js.map +1 -0
- package/lib/plan-phase.d.ts +42 -0
- package/lib/plan-phase.d.ts.map +1 -0
- package/lib/plan-phase.js +31 -0
- package/lib/plan-phase.js.map +1 -0
- package/package.json +70 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser half of `@dsh-cc/command-permissions`. Hangs a popupSelect
|
|
3
|
+
* DECORATION on the host `/permissions` command. The decoration owns only the
|
|
4
|
+
* bare invocation; the host command keeps its catalog row, the argued path
|
|
5
|
+
* (`/permissions <mode>` still switches directly), and the lifecycle logging.
|
|
6
|
+
* A pick submits `/permissions ${id}` so both surfaces write through one path.
|
|
7
|
+
*
|
|
8
|
+
* `/permission` (host, sandbox+approval presets) is hidden from the CC
|
|
9
|
+
* slash catalog by the host half wrapping `commands.list`; this decoration
|
|
10
|
+
* only covers `/permissions`. The composer chip still executes
|
|
11
|
+
* `/permission <preset>` against the global handler.
|
|
12
|
+
*
|
|
13
|
+
* @module @dsh-cc/command-permissions/client
|
|
14
|
+
*/
|
|
15
|
+
import type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client';
|
|
16
|
+
export declare const inject: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Register the `/permissions` bare-invocation popup over the host command.
|
|
19
|
+
* @param ctx - client root context.
|
|
20
|
+
*/
|
|
21
|
+
export declare function apply(ctx: ClientContext): void;
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,aAAa,EAA0B,MAAM,wCAAwC,CAAA;AAKnG,eAAO,MAAM,MAAM,UAA4B,CAAA;AAuB/C;;;GAGG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAoB9C"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { BYPASS_CONFIRMATION, BYPASS_MODE, PERMISSION_MODE_OPTIONS } from "../modes.js";
|
|
2
|
+
export const inject = ['commandUi', 'sessions'];
|
|
3
|
+
/**
|
|
4
|
+
* Resolve the live session face for a popup session scope (undefined = not
|
|
5
|
+
* materialized). `ctx.sessions` reads the client sessions face; some shared
|
|
6
|
+
* node packages over-declare the same key as their own store, so narrow it to
|
|
7
|
+
* the client contract here.
|
|
8
|
+
*/
|
|
9
|
+
function sessionFor(ctx, session) {
|
|
10
|
+
const sessions = ctx.sessions;
|
|
11
|
+
return sessions.binding(session.sessionId)?.session;
|
|
12
|
+
}
|
|
13
|
+
/** Flatten the shareable mode rows into popup options; bypassPermissions carries the risk gate. */
|
|
14
|
+
function optionsOf() {
|
|
15
|
+
return PERMISSION_MODE_OPTIONS.map(option => ({
|
|
16
|
+
id: option.id,
|
|
17
|
+
label: option.label,
|
|
18
|
+
detail: option.detail,
|
|
19
|
+
...(option.id === BYPASS_MODE ? { confirmation: { ...BYPASS_CONFIRMATION } } : {}),
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Register the `/permissions` bare-invocation popup over the host command.
|
|
24
|
+
* @param ctx - client root context.
|
|
25
|
+
*/
|
|
26
|
+
export function apply(ctx) {
|
|
27
|
+
const command = ctx.get('commandUi');
|
|
28
|
+
ctx.effect(() => command.decorate({
|
|
29
|
+
name: 'permissions',
|
|
30
|
+
// The host catalog already hides `/permissions` from non-CC sessions
|
|
31
|
+
// (`commands.list` wrap). A missing host row means this decoration is a
|
|
32
|
+
// no-op — it never manufactures a command.
|
|
33
|
+
available: () => true,
|
|
34
|
+
ui: {
|
|
35
|
+
kind: 'popupSelect',
|
|
36
|
+
options: () => Promise.resolve(optionsOf()),
|
|
37
|
+
onSelect: async (option, session) => {
|
|
38
|
+
const live = sessionFor(ctx, session);
|
|
39
|
+
if (live === undefined)
|
|
40
|
+
throw new Error('this session is not materialized yet');
|
|
41
|
+
const result = await live.command(`/permissions ${option.id}`);
|
|
42
|
+
if (!result.ok)
|
|
43
|
+
throw new Error(`permission mode switch failed: ${result.error.code}: ${result.error.message}`);
|
|
44
|
+
if (!result.value.matched)
|
|
45
|
+
throw new Error('the host offers no /permissions command');
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
}), 'command-permissions: /permissions decoration');
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceR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AE,MAAM,EAAE,OAAO,EAAE,EAAE;gBAClC,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;gBACrC,IAAI,IAAI,KAAK,SAAS;oBAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;gBAC/E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,gBAAgB,MAAM,CAAC,EAAE,EAAE,CAAC,CAAA;gBAC9D,IAAI,CAAC,MAAM,CAAC,EAAE;oBAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;gBAC/G,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO;oBAAE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAA;YACvF,CAAC;SACF;KACF,CAAC,EAAE,8CAA8C,CAAC,CAAA;AACrD,CAAC"}
|
package/lib/client.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "@dsh-cc/command-permissions",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
+
//#region src/modes.ts
|
|
8
|
+
/** The popup rows, in display order. */
|
|
9
|
+
const PERMISSION_MODE_OPTIONS = [
|
|
10
|
+
{
|
|
11
|
+
id: "default",
|
|
12
|
+
label: "Default",
|
|
13
|
+
detail: "Follow allow/deny/ask rules; unmatched calls pass through."
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: "acceptEdits",
|
|
17
|
+
label: "Accept edits",
|
|
18
|
+
detail: "File edits are auto-allowed; other calls follow the rules."
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: "plan",
|
|
22
|
+
label: "Plan",
|
|
23
|
+
detail: "Read-only until the plan is submitted via exit_plan_mode."
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: "auto",
|
|
27
|
+
label: "Auto",
|
|
28
|
+
detail: "Low-risk approval prompts are auto-allowed; medium-risk prompts still ask."
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "bypassPermissions",
|
|
32
|
+
label: "Bypass permissions",
|
|
33
|
+
detail: "Skip permission prompts and pin the sandbox to full access. Bypass-immune and catastrophic commands stay denied."
|
|
34
|
+
}
|
|
35
|
+
];
|
|
36
|
+
/**
|
|
37
|
+
* Explicit risk gate on the bypassPermissions row, shared by the browser
|
|
38
|
+
* popupSelect confirmation and the TUI picker overlay.
|
|
39
|
+
*/
|
|
40
|
+
const BYPASS_CONFIRMATION = {
|
|
41
|
+
title: "Enable Bypass permissions?",
|
|
42
|
+
description: "Bypass permissions skips approval prompts and pins this session's sandbox to full access. Bypass-immune paths and catastrophic commands stay denied. Only use it when you trust the current task.",
|
|
43
|
+
acknowledgeLabel: "I understand the risks and want to continue",
|
|
44
|
+
cancelLabel: "Cancel",
|
|
45
|
+
confirmLabel: "Enable Bypass permissions"
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/client/index.ts
|
|
49
|
+
const inject = ["commandUi", "sessions"];
|
|
50
|
+
/**
|
|
51
|
+
* Resolve the live session face for a popup session scope (undefined = not
|
|
52
|
+
* materialized). `ctx.sessions` reads the client sessions face; some shared
|
|
53
|
+
* node packages over-declare the same key as their own store, so narrow it to
|
|
54
|
+
* the client contract here.
|
|
55
|
+
*/
|
|
56
|
+
function sessionFor(ctx, session) {
|
|
57
|
+
return ctx.sessions.binding(session.sessionId)?.session;
|
|
58
|
+
}
|
|
59
|
+
/** Flatten the shareable mode rows into popup options; bypassPermissions carries the risk gate. */
|
|
60
|
+
function optionsOf() {
|
|
61
|
+
return PERMISSION_MODE_OPTIONS.map((option) => ({
|
|
62
|
+
id: option.id,
|
|
63
|
+
label: option.label,
|
|
64
|
+
detail: option.detail,
|
|
65
|
+
...option.id === "bypassPermissions" ? { confirmation: { ...BYPASS_CONFIRMATION } } : {}
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Register the `/permissions` bare-invocation popup over the host command.
|
|
70
|
+
* @param ctx - client root context.
|
|
71
|
+
*/
|
|
72
|
+
function apply(ctx) {
|
|
73
|
+
const command = ctx.get("commandUi");
|
|
74
|
+
ctx.effect(() => command.decorate({
|
|
75
|
+
name: "permissions",
|
|
76
|
+
available: () => true,
|
|
77
|
+
ui: {
|
|
78
|
+
kind: "popupSelect",
|
|
79
|
+
options: () => Promise.resolve(optionsOf()),
|
|
80
|
+
onSelect: async (option, session) => {
|
|
81
|
+
const live = sessionFor(ctx, session);
|
|
82
|
+
if (live === void 0) throw new Error("this session is not materialized yet");
|
|
83
|
+
const result = await live.command(`/permissions ${option.id}`);
|
|
84
|
+
if (!result.ok) throw new Error(`permission mode switch failed: ${result.error.code}: ${result.error.message}`);
|
|
85
|
+
if (!result.value.matched) throw new Error("the host offers no /permissions command");
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}), "command-permissions: /permissions decoration");
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
exports.apply = apply;
|
|
92
|
+
exports.inject = inject;
|
|
93
|
+
return module.exports;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","names":[],"sources":["../src/modes.ts","../src/client/index.ts"],"sourcesContent":["/**\n * The single source of truth for the `/permissions` rule-engine modes. Pure\n * and browser-safe (no cordis/session imports) so the host command (the write\n * path), the client popupSelect decoration (a pick submits `/permissions\n * <id>`), and the TUI picker overlay all render from the same lists and\n * cannot drift.\n */\n\n/** The available CC rule-engine modes, shared by the switch list and the popup. */\nexport const PERMISSION_COMMAND_MODES = [\n 'default', 'acceptEdits', 'plan', 'auto', 'bypassPermissions',\n] as const\n/** A union of the rule-engine mode ids. */\nexport type PermissionCommandMode = (typeof PERMISSION_COMMAND_MODES)[number]\n\n/** One popup row: its switch id plus human-facing label and detail. */\nexport interface PermissionModeOption {\n readonly id: PermissionCommandMode\n readonly label: string\n readonly detail: string\n}\n\n/** The popup rows, in display order. */\nexport const PERMISSION_MODE_OPTIONS: readonly PermissionModeOption[] = [\n { id: 'default', label: 'Default', detail: 'Follow allow/deny/ask rules; unmatched calls pass through.' },\n { id: 'acceptEdits', label: 'Accept edits', detail: 'File edits are auto-allowed; other calls follow the rules.' },\n { id: 'plan', label: 'Plan', detail: 'Read-only until the plan is submitted via exit_plan_mode.' },\n { id: 'auto', label: 'Auto', detail: 'Low-risk approval prompts are auto-allowed; medium-risk prompts still ask.' },\n { id: 'bypassPermissions', label: 'Bypass permissions', detail: 'Skip permission prompts and pin the sandbox to full access. Bypass-immune and catastrophic commands stay denied.' },\n]\n\n/** The mode that carries the explicit risk gate (mirrors `/permission` Full access). */\nexport const BYPASS_MODE = 'bypassPermissions' as const\n\n/**\n * Explicit risk gate on the bypassPermissions row, shared by the browser\n * popupSelect confirmation and the TUI picker overlay.\n */\nexport const BYPASS_CONFIRMATION = {\n title: 'Enable Bypass permissions?',\n description: 'Bypass permissions skips approval prompts and pins this session\\'s sandbox to full access. Bypass-immune paths and catastrophic commands stay denied. Only use it when you trust the current task.',\n acknowledgeLabel: 'I understand the risks and want to continue',\n cancelLabel: 'Cancel',\n confirmLabel: 'Enable Bypass permissions',\n} as const\n","/**\n * Browser half of `@dsh-cc/command-permissions`. Hangs a popupSelect\n * DECORATION on the host `/permissions` command. The decoration owns only the\n * bare invocation; the host command keeps its catalog row, the argued path\n * (`/permissions <mode>` still switches directly), and the lifecycle logging.\n * A pick submits `/permissions ${id}` so both surfaces write through one path.\n *\n * `/permission` (host, sandbox+approval presets) is hidden from the CC\n * slash catalog by the host half wrapping `commands.list`; this decoration\n * only covers `/permissions`. The composer chip still executes\n * `/permission <preset>` against the global handler.\n *\n * @module @dsh-cc/command-permissions/client\n */\nimport type { ClientContext, ISessions, SessionFace } from '@deepseek-ai/dsh-client-runtime/client'\nimport type { CommandUiContract, SelectOption } from '@deepseek-ai/dsh-client-ui-commands/client'\nimport type { ClientSessionContext } from '@deepseek-ai/dsh-client-ui-input-trigger/client'\nimport { BYPASS_CONFIRMATION, BYPASS_MODE, PERMISSION_MODE_OPTIONS } from '../modes.ts'\n\nexport const inject = ['commandUi', 'sessions']\n\n/**\n * Resolve the live session face for a popup session scope (undefined = not\n * materialized). `ctx.sessions` reads the client sessions face; some shared\n * node packages over-declare the same key as their own store, so narrow it to\n * the client contract here.\n */\nfunction sessionFor(ctx: ClientContext, session: ClientSessionContext): SessionFace | undefined {\n const sessions = ctx.sessions as unknown as ISessions\n return sessions.binding(session.sessionId)?.session\n}\n\n/** Flatten the shareable mode rows into popup options; bypassPermissions carries the risk gate. */\nfunction optionsOf(): SelectOption[] {\n return PERMISSION_MODE_OPTIONS.map(option => ({\n id: option.id,\n label: option.label,\n detail: option.detail,\n ...(option.id === BYPASS_MODE ? { confirmation: { ...BYPASS_CONFIRMATION } } : {}),\n }))\n}\n\n/**\n * Register the `/permissions` bare-invocation popup over the host command.\n * @param ctx - client root context.\n */\nexport function apply(ctx: ClientContext): void {\n const command = ctx.get('commandUi') as CommandUiContract\n ctx.effect(() => command.decorate({\n name: 'permissions',\n // The host catalog already hides `/permissions` from non-CC sessions\n // (`commands.list` wrap). A missing host row means this decoration is a\n // no-op — it never manufactures a command.\n available: () => true,\n ui: {\n kind: 'popupSelect',\n options: () => Promise.resolve(optionsOf()),\n onSelect: async (option, session) => {\n const live = sessionFor(ctx, session)\n if (live === undefined) throw new Error('this session is not materialized yet')\n const result = await live.command(`/permissions ${option.id}`)\n if (!result.ok) throw new Error(`permission mode switch failed: ${result.error.code}: ${result.error.message}`)\n if (!result.value.matched) throw new Error('the host offers no /permissions command')\n },\n },\n }),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MAAM,SAAS;MAC9G,IAAI,CAAC,OAAO,MAAM,SAAS,MAAM,IAAI,MAAM,yCAAyC;KACtF;IACF;GACF,CAAC,GAAG,8CAA8C;EACpD"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Human-facing `/permissions` command: render the effective permission rule
|
|
3
|
+
* state (allow/deny/ask counts per source), or switch the session's permission
|
|
4
|
+
* mode with `/permissions <mode>`. Switching is durable — engine modes route
|
|
5
|
+
* through the permission-rules engine's `setMode`; `plan` routes through the
|
|
6
|
+
* `/plan` command channel, the only cross-plane write seam plan-mode exposes
|
|
7
|
+
* (its `planMode` service lives inside the preset's isolate realm, invisible
|
|
8
|
+
* to `ctx.get` from here). See docs/plan-mode-command-channel.md.
|
|
9
|
+
*
|
|
10
|
+
* The host command remains the write path. A client decoration (see
|
|
11
|
+
* `./client`) hangs the same popupSelect on the BARE invocation, mirroring the
|
|
12
|
+
* `/permission` preset pattern — a pick submits `/permissions <mode>` through
|
|
13
|
+
* here, so both surfaces write through one path. The TUI intercepts the same
|
|
14
|
+
* bare invocation and opens an overlay that also submits `/permissions
|
|
15
|
+
* <mode>` through here.
|
|
16
|
+
*
|
|
17
|
+
* `/permission` (host, sandbox+approval presets) and `/permissions` (this
|
|
18
|
+
* package, CC rule-engine modes) drive different knobs. A CC session's slash
|
|
19
|
+
* menu should show only `/permissions`: `commands.list` drops the host
|
|
20
|
+
* `/permission` row when the session's selected agent preset is `cc`, while
|
|
21
|
+
* `find`/`execute` stay on the global handler so the composer chip can still
|
|
22
|
+
* switch sandbox presets.
|
|
23
|
+
*
|
|
24
|
+
* This package is mounted twice: the host-plane row (cc-permissions bundle)
|
|
25
|
+
* exists so `dsh-client-modules` can discover the `dsh.client` browser half
|
|
26
|
+
* (preset rows never appear in `ctx.loader.entries()`); that host apply is a
|
|
27
|
+
* no-op besides the catalog wrap. The CC preset row registers the command.
|
|
28
|
+
* @module @dsh-cc/command-permissions
|
|
29
|
+
*/
|
|
30
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
31
|
+
export { BYPASS_CONFIRMATION, BYPASS_MODE, PERMISSION_COMMAND_MODES, PERMISSION_MODE_OPTIONS, type PermissionCommandMode, type PermissionModeOption, } from './modes.ts';
|
|
32
|
+
export { planPhaseOf, type PlanPhase, type PlanUnitStateLike } from './plan-phase.ts';
|
|
33
|
+
export declare const name = "command-permissions";
|
|
34
|
+
/**
|
|
35
|
+
* `commands` is required; the `permissionRules` engine and `planMode` are read
|
|
36
|
+
* optionally via `ctx.get` so the command loads (and reports a friendly message)
|
|
37
|
+
* even when the engine is not composed, mirroring `/status`'s optional
|
|
38
|
+
* permission-preset read.
|
|
39
|
+
*/
|
|
40
|
+
export declare const inject: string[];
|
|
41
|
+
/**
|
|
42
|
+
* Register `/permissions`. The host-plane mount (`ctx.agent` unset, the
|
|
43
|
+
* cc-permissions bundle row) also wraps `commands.list` so a CC session
|
|
44
|
+
* hides `/permission` and a non-CC session hides `/permissions`. That host
|
|
45
|
+
* fiber is what `dsh-client-modules` scans for `dsh.client`. A preset-scoped
|
|
46
|
+
* mount only registers the command (so a composition without the host row
|
|
47
|
+
* still works; the wrap is already on the service from the host row).
|
|
48
|
+
* @param ctx - context carrying the command registry and permission engine.
|
|
49
|
+
*/
|
|
50
|
+
export declare function apply(ctx: Context): void;
|
|
51
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAQlD,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAErF,eAAO,MAAM,IAAI,wBAAwB,CAAA;AACzC;;;;;GAKG;AACH,eAAO,MAAM,MAAM,UAAe,CAAA;AAqHlC;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAQxC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Human-facing `/permissions` command: render the effective permission rule
|
|
3
|
+
* state (allow/deny/ask counts per source), or switch the session's permission
|
|
4
|
+
* mode with `/permissions <mode>`. Switching is durable — engine modes route
|
|
5
|
+
* through the permission-rules engine's `setMode`; `plan` routes through the
|
|
6
|
+
* `/plan` command channel, the only cross-plane write seam plan-mode exposes
|
|
7
|
+
* (its `planMode` service lives inside the preset's isolate realm, invisible
|
|
8
|
+
* to `ctx.get` from here). See docs/plan-mode-command-channel.md.
|
|
9
|
+
*
|
|
10
|
+
* The host command remains the write path. A client decoration (see
|
|
11
|
+
* `./client`) hangs the same popupSelect on the BARE invocation, mirroring the
|
|
12
|
+
* `/permission` preset pattern — a pick submits `/permissions <mode>` through
|
|
13
|
+
* here, so both surfaces write through one path. The TUI intercepts the same
|
|
14
|
+
* bare invocation and opens an overlay that also submits `/permissions
|
|
15
|
+
* <mode>` through here.
|
|
16
|
+
*
|
|
17
|
+
* `/permission` (host, sandbox+approval presets) and `/permissions` (this
|
|
18
|
+
* package, CC rule-engine modes) drive different knobs. A CC session's slash
|
|
19
|
+
* menu should show only `/permissions`: `commands.list` drops the host
|
|
20
|
+
* `/permission` row when the session's selected agent preset is `cc`, while
|
|
21
|
+
* `find`/`execute` stay on the global handler so the composer chip can still
|
|
22
|
+
* switch sandbox presets.
|
|
23
|
+
*
|
|
24
|
+
* This package is mounted twice: the host-plane row (cc-permissions bundle)
|
|
25
|
+
* exists so `dsh-client-modules` can discover the `dsh.client` browser half
|
|
26
|
+
* (preset rows never appear in `ctx.loader.entries()`); that host apply is a
|
|
27
|
+
* no-op besides the catalog wrap. The CC preset row registers the command.
|
|
28
|
+
* @module @dsh-cc/command-permissions
|
|
29
|
+
*/
|
|
30
|
+
import { PERMISSION_COMMAND_MODES } from "./modes.js";
|
|
31
|
+
import { planPhaseOf } from "./plan-phase.js";
|
|
32
|
+
import { renderPermissions } from "./permissions.js";
|
|
33
|
+
export { BYPASS_CONFIRMATION, BYPASS_MODE, PERMISSION_COMMAND_MODES, PERMISSION_MODE_OPTIONS, } from "./modes.js";
|
|
34
|
+
export { planPhaseOf } from "./plan-phase.js";
|
|
35
|
+
export const name = 'command-permissions';
|
|
36
|
+
/**
|
|
37
|
+
* `commands` is required; the `permissionRules` engine and `planMode` are read
|
|
38
|
+
* optionally via `ctx.get` so the command loads (and reports a friendly message)
|
|
39
|
+
* even when the engine is not composed, mirroring `/status`'s optional
|
|
40
|
+
* permission-preset read.
|
|
41
|
+
*/
|
|
42
|
+
export const inject = ['commands'];
|
|
43
|
+
/** The shared modes list — the switch list and the client popup both read it. */
|
|
44
|
+
const MODES = PERMISSION_COMMAND_MODES;
|
|
45
|
+
/** Render the current rule state from a mounted engine. */
|
|
46
|
+
function renderState(service) {
|
|
47
|
+
return {
|
|
48
|
+
kind: 'success',
|
|
49
|
+
text: renderPermissions(service.ruleSet, service.ruleSet.bypassImmune.length),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Resolve the pending-aware plan phase for the invocation's agent. The plan
|
|
54
|
+
* projection (host-plane registry) sees queued intent; without it the fold
|
|
55
|
+
* sees only committed `plan/mode` events.
|
|
56
|
+
*/
|
|
57
|
+
function planPhaseFor(ctx, agent) {
|
|
58
|
+
const projections = ctx.get('sessionProjections');
|
|
59
|
+
const planState = projections?.stateOf(agent.session, 'plan');
|
|
60
|
+
return planPhaseOf(agent.session.events, planState);
|
|
61
|
+
}
|
|
62
|
+
/** Execute `/permissions` against the mounted permission-rules engine. */
|
|
63
|
+
async function executePermissions(ctx, invocation) {
|
|
64
|
+
const service = ctx.get('permissionRules');
|
|
65
|
+
const raw = invocation.rawInput.trim();
|
|
66
|
+
if (raw === '') {
|
|
67
|
+
if (service === undefined) {
|
|
68
|
+
return { kind: 'success', text: 'The permission-rules engine is not mounted in this composition.' };
|
|
69
|
+
}
|
|
70
|
+
return renderState(service);
|
|
71
|
+
}
|
|
72
|
+
if (service === undefined) {
|
|
73
|
+
return { kind: 'error', text: 'The permission-rules engine is not mounted in this composition.' };
|
|
74
|
+
}
|
|
75
|
+
const [mode = ''] = raw.split(/\s+/);
|
|
76
|
+
if (!MODES.includes(mode)) {
|
|
77
|
+
return { kind: 'error', text: `unknown permission mode "${mode}"; available: ${MODES.join(', ')}` };
|
|
78
|
+
}
|
|
79
|
+
const agent = invocation.agent;
|
|
80
|
+
try {
|
|
81
|
+
// `plan` is owned by plan-mode, never the engine's setMode. The write
|
|
82
|
+
// goes through the /plan command channel — the only cross-plane seam —
|
|
83
|
+
// dispatched bare ('/plan', never '/plan on'): the upstream handler
|
|
84
|
+
// steers any non-'off' argument into the conversation as a user message.
|
|
85
|
+
if (mode === 'plan') {
|
|
86
|
+
if (planPhaseFor(ctx, agent) === 'on') {
|
|
87
|
+
return { kind: 'success', text: 'Permission mode is now "plan".' };
|
|
88
|
+
}
|
|
89
|
+
const execution = await ctx.commands.execute(agent, '/plan', [], invocation.signal);
|
|
90
|
+
if (execution === undefined) {
|
|
91
|
+
return { kind: 'error', text: 'plan mode is not mounted in this composition' };
|
|
92
|
+
}
|
|
93
|
+
return execution.result;
|
|
94
|
+
}
|
|
95
|
+
// Leave plan first: the engine overlays plan over every other mode at
|
|
96
|
+
// evaluation time, so switching underneath an active (or queued) plan is
|
|
97
|
+
// invisible work at best. A failed or unmatched exit aborts the switch.
|
|
98
|
+
if (planPhaseFor(ctx, agent) !== 'off') {
|
|
99
|
+
const execution = await ctx.commands.execute(agent, '/plan off', [], invocation.signal);
|
|
100
|
+
if (execution === undefined) {
|
|
101
|
+
return { kind: 'error', text: 'plan mode is not mounted in this composition' };
|
|
102
|
+
}
|
|
103
|
+
if (execution.result.kind === 'error')
|
|
104
|
+
return execution.result;
|
|
105
|
+
}
|
|
106
|
+
service.setMode(agent, mode);
|
|
107
|
+
return { kind: 'success', text: `Permission mode is now "${mode}".` };
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
return { kind: 'error', text: error instanceof Error ? error.message : String(error) };
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/** Whether this session selected the CC agent preset (last `agent-preset/selected` wins, else the creation header). */
|
|
114
|
+
function isCcSession(agent) {
|
|
115
|
+
const events = agent.session.events;
|
|
116
|
+
for (let index = events.length - 1; index >= 0; index -= 1) {
|
|
117
|
+
const event = events[index];
|
|
118
|
+
if (event.type === 'agent-preset/selected') {
|
|
119
|
+
return event.data?.agentPreset === 'cc';
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const header = agent.session.header;
|
|
123
|
+
return header.agentPreset === 'cc';
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Hide the host `/permission` row from `commands.list` for CC sessions.
|
|
127
|
+
* Installed once on the host-plane mount (`ctx.agent` unset). Preset mounts
|
|
128
|
+
* skip this so a session-scoped apply cannot stack wraps on the same service.
|
|
129
|
+
* `find`/`execute` are not wrapped, so `/permission workspace-write` and the
|
|
130
|
+
* composer chip keep driving the sandbox-preset switcher.
|
|
131
|
+
*/
|
|
132
|
+
function installCatalogWrap(ctx) {
|
|
133
|
+
const commands = ctx.commands;
|
|
134
|
+
const originalList = commands.list;
|
|
135
|
+
const wrappedList = function list(agent) {
|
|
136
|
+
const listed = originalList.call(this, agent);
|
|
137
|
+
const hidden = isCcSession(agent) ? 'permission' : 'permissions';
|
|
138
|
+
const filtered = listed.filter(entry => entry.name !== hidden);
|
|
139
|
+
return filtered.length === listed.length ? listed : Object.freeze(filtered);
|
|
140
|
+
};
|
|
141
|
+
commands.list = wrappedList;
|
|
142
|
+
ctx.effect(() => () => {
|
|
143
|
+
commands.list = originalList;
|
|
144
|
+
}, 'command-permissions: hide /permission from the CC catalog');
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Register `/permissions`. The host-plane mount (`ctx.agent` unset, the
|
|
148
|
+
* cc-permissions bundle row) also wraps `commands.list` so a CC session
|
|
149
|
+
* hides `/permission` and a non-CC session hides `/permissions`. That host
|
|
150
|
+
* fiber is what `dsh-client-modules` scans for `dsh.client`. A preset-scoped
|
|
151
|
+
* mount only registers the command (so a composition without the host row
|
|
152
|
+
* still works; the wrap is already on the service from the host row).
|
|
153
|
+
* @param ctx - context carrying the command registry and permission engine.
|
|
154
|
+
*/
|
|
155
|
+
export function apply(ctx) {
|
|
156
|
+
ctx.commands.register({
|
|
157
|
+
name: 'permissions',
|
|
158
|
+
description: 'show or switch the permission mode (default|acceptEdits|plan|auto|bypassPermissions)',
|
|
159
|
+
input: { hint: '[mode]' },
|
|
160
|
+
handler: (invocation) => executePermissions(ctx, invocation),
|
|
161
|
+
});
|
|
162
|
+
if (ctx.agent === undefined)
|
|
163
|
+
installCatalogWrap(ctx);
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAMH,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AACrD,OAAO,EAAE,WAAW,EAA0C,MAAM,iBAAiB,CAAA;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAEpD,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,wBAAwB,EACxB,uBAAuB,GAGxB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,WAAW,EAA0C,MAAM,iBAAiB,C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cc/command-permissions`.
|
|
3
|
+
* @module @dsh-cc/command-permissions/invariant
|
|
4
|
+
*/
|
|
5
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
6
|
+
/** Cordis companion plugin name. */
|
|
7
|
+
export declare const name = "command-permissions-invariant";
|
|
8
|
+
/** Service required before the companion can reserve package ownership. */
|
|
9
|
+
export declare const inject: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Register this package's invariant companion.
|
|
12
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
13
|
+
* @returns the installed registration's disposer after setup succeeds.
|
|
14
|
+
*/
|
|
15
|
+
export declare const apply: (ctx: Context) => Promise<() => void>;
|
|
16
|
+
//# sourceMappingURL=invariant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invariant.d.ts","sourceRoot":"","sources":["../src/invariant.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAKlD,oCAAoC;AACpC,eAAO,MAAM,IAAI,kCAAkC,CAAA;AACnD,2EAA2E;AAC3E,eAAO,MAAM,MAAM,UAAiB,CAAA;AASpC;;;;GAIG;AACH,eAAO,MAAM,KAAK,GAAI,KAAK,OAAO,KAAG,OAAO,CAAC,MAAM,IAAI,CACU,CAAA"}
|
package/lib/invariant.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package-owned invariant companion for `@dsh-cc/command-permissions`.
|
|
3
|
+
* @module @dsh-cc/command-permissions/invariant
|
|
4
|
+
*/
|
|
5
|
+
const PACKAGE_NAME = '@dsh-cc/command-permissions';
|
|
6
|
+
/** Cordis companion plugin name. */
|
|
7
|
+
export const name = 'command-permissions-invariant';
|
|
8
|
+
/** Service required before the companion can reserve package ownership. */
|
|
9
|
+
export const inject = ['invariants'];
|
|
10
|
+
/**
|
|
11
|
+
* No runtime invariant: this command adapter owns no event stream or state projection; permissions
|
|
12
|
+
* behavior is a pure read/render over composed services, and the command registry owns
|
|
13
|
+
* registration and dispatch lifecycle.
|
|
14
|
+
*/
|
|
15
|
+
const install = () => { };
|
|
16
|
+
/**
|
|
17
|
+
* Register this package's invariant companion.
|
|
18
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
19
|
+
* @returns the installed registration's disposer after setup succeeds.
|
|
20
|
+
*/
|
|
21
|
+
export const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
22
|
+
/* jscpd:ignore-end */
|
|
23
|
+
//# sourceMappingURL=invariant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invariant.js","sourceRoot":"","sources":["../src/invariant.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,YAAY,GAAG,6BAA6B,CAAA;AAElD,oCAAoC;AACpC,MAAM,CAAC,MAAM,IAAI,GAAG,+BAA+B,CAAA;AACnD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,YAAY,CAAC,CAAA;AAEpC;;;;GAIG;AACH,MAAM,OAAO,GAAuB,GAAG,EAAE,GAAE,CAAC,CAAA;AAE5C;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,GAAY,EAAuB,EAAE,CACzD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAA;AACjE,sBAAsB"}
|
package/lib/modes.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single source of truth for the `/permissions` rule-engine modes. Pure
|
|
3
|
+
* and browser-safe (no cordis/session imports) so the host command (the write
|
|
4
|
+
* path), the client popupSelect decoration (a pick submits `/permissions
|
|
5
|
+
* <id>`), and the TUI picker overlay all render from the same lists and
|
|
6
|
+
* cannot drift.
|
|
7
|
+
*/
|
|
8
|
+
/** The available CC rule-engine modes, shared by the switch list and the popup. */
|
|
9
|
+
export declare const PERMISSION_COMMAND_MODES: readonly ["default", "acceptEdits", "plan", "auto", "bypassPermissions"];
|
|
10
|
+
/** A union of the rule-engine mode ids. */
|
|
11
|
+
export type PermissionCommandMode = (typeof PERMISSION_COMMAND_MODES)[number];
|
|
12
|
+
/** One popup row: its switch id plus human-facing label and detail. */
|
|
13
|
+
export interface PermissionModeOption {
|
|
14
|
+
readonly id: PermissionCommandMode;
|
|
15
|
+
readonly label: string;
|
|
16
|
+
readonly detail: string;
|
|
17
|
+
}
|
|
18
|
+
/** The popup rows, in display order. */
|
|
19
|
+
export declare const PERMISSION_MODE_OPTIONS: readonly PermissionModeOption[];
|
|
20
|
+
/** The mode that carries the explicit risk gate (mirrors `/permission` Full access). */
|
|
21
|
+
export declare const BYPASS_MODE: "bypassPermissions";
|
|
22
|
+
/**
|
|
23
|
+
* Explicit risk gate on the bypassPermissions row, shared by the browser
|
|
24
|
+
* popupSelect confirmation and the TUI picker overlay.
|
|
25
|
+
*/
|
|
26
|
+
export declare const BYPASS_CONFIRMATION: {
|
|
27
|
+
readonly title: "Enable Bypass permissions?";
|
|
28
|
+
readonly description: "Bypass permissions skips approval prompts and pins this session's sandbox to full access. Bypass-immune paths and catastrophic commands stay denied. Only use it when you trust the current task.";
|
|
29
|
+
readonly acknowledgeLabel: "I understand the risks and want to continue";
|
|
30
|
+
readonly cancelLabel: "Cancel";
|
|
31
|
+
readonly confirmLabel: "Enable Bypass permissions";
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=modes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modes.d.ts","sourceRoot":"","sources":["../src/modes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,mFAAmF;AACnF,eAAO,MAAM,wBAAwB,0EAE3B,CAAA;AACV,2CAA2C;AAC3C,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE7E,uEAAuE;AACvE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,EAAE,qBAAqB,CAAA;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED,wCAAwC;AACxC,eAAO,MAAM,uBAAuB,EAAE,SAAS,oBAAoB,EAMlE,CAAA;AAED,wFAAwF;AACxF,eAAO,MAAM,WAAW,EAAG,mBAA4B,CAAA;AAEvD;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;CAMtB,CAAA"}
|
package/lib/modes.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single source of truth for the `/permissions` rule-engine modes. Pure
|
|
3
|
+
* and browser-safe (no cordis/session imports) so the host command (the write
|
|
4
|
+
* path), the client popupSelect decoration (a pick submits `/permissions
|
|
5
|
+
* <id>`), and the TUI picker overlay all render from the same lists and
|
|
6
|
+
* cannot drift.
|
|
7
|
+
*/
|
|
8
|
+
/** The available CC rule-engine modes, shared by the switch list and the popup. */
|
|
9
|
+
export const PERMISSION_COMMAND_MODES = [
|
|
10
|
+
'default', 'acceptEdits', 'plan', 'auto', 'bypassPermissions',
|
|
11
|
+
];
|
|
12
|
+
/** The popup rows, in display order. */
|
|
13
|
+
export const PERMISSION_MODE_OPTIONS = [
|
|
14
|
+
{ id: 'default', label: 'Default', detail: 'Follow allow/deny/ask rules; unmatched calls pass through.' },
|
|
15
|
+
{ id: 'acceptEdits', label: 'Accept edits', detail: 'File edits are auto-allowed; other calls follow the rules.' },
|
|
16
|
+
{ id: 'plan', label: 'Plan', detail: 'Read-only until the plan is submitted via exit_plan_mode.' },
|
|
17
|
+
{ id: 'auto', label: 'Auto', detail: 'Low-risk approval prompts are auto-allowed; medium-risk prompts still ask.' },
|
|
18
|
+
{ id: 'bypassPermissions', label: 'Bypass permissions', detail: 'Skip permission prompts and pin the sandbox to full access. Bypass-immune and catastrophic commands stay denied.' },
|
|
19
|
+
];
|
|
20
|
+
/** The mode that carries the explicit risk gate (mirrors `/permission` Full access). */
|
|
21
|
+
export const BYPASS_MODE = 'bypassPermissions';
|
|
22
|
+
/**
|
|
23
|
+
* Explicit risk gate on the bypassPermissions row, shared by the browser
|
|
24
|
+
* popupSelect confirmation and the TUI picker overlay.
|
|
25
|
+
*/
|
|
26
|
+
export const BYPASS_CONFIRMATION = {
|
|
27
|
+
title: 'Enable Bypass permissions?',
|
|
28
|
+
description: 'Bypass permissions skips approval prompts and pins this session\'s sandbox to full access. Bypass-immune paths and catastrophic commands stay denied. Only use it when you trust the current task.',
|
|
29
|
+
acknowledgeLabel: 'I understand the risks and want to continue',
|
|
30
|
+
cancelLabel: 'Cancel',
|
|
31
|
+
confirmLabel: 'Enable Bypass permissions',
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=modes.js.map
|
package/lib/modes.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modes.js","sourceRoot":"","sources":["../src/modes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,mFAAmF;AACnF,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB;CACrD,CAAA;AAWV,wCAAwC;AACxC,MAAM,CAAC,MAAM,uBAAuB,GAAoC;IACtE,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,4DAA4D,EAAE;IACzG,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,4DAA4D,EAAE;IAClH,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,2DAA2D,EAAE;IAClG,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,4EAA4E,EAAE;IACnH,EAAE,EAAE,EAAE,mBAAmB,EAAE,KAAK,EAAE,oBAAoB,EAAE,MAAM,EAAE,kHAAkH,EAAE;CACrL,CAAA;AAED,wFAAwF;AACxF,MAAM,CAAC,MAAM,WAAW,GAAG,mBAA4B,CAAA;AAEvD;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,KAAK,EAAE,4BAA4B;IACnC,WAAW,EAAE,oMAAoM;IACjN,gBAAgB,EAAE,6CAA6C;IAC/D,WAAW,EAAE,QAAQ;IACrB,YAAY,EAAE,2BAA2B;CACjC,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure `/permissions` rendering: aggregate a permission rule set into counts
|
|
3
|
+
* per source and behavior. READ-ONLY — no mode switch is performed here.
|
|
4
|
+
* @module @dsh-cc/command-permissions/permissions
|
|
5
|
+
*/
|
|
6
|
+
import { type PermissionRuleSet } from '@dsh-cc/permission-rules/types';
|
|
7
|
+
/** Aggregated counts for one rule source. */
|
|
8
|
+
export interface SourceCounts {
|
|
9
|
+
allow: number;
|
|
10
|
+
deny: number;
|
|
11
|
+
ask: number;
|
|
12
|
+
bypassImmune: number;
|
|
13
|
+
}
|
|
14
|
+
/** A totals row across all sources. */
|
|
15
|
+
export interface Totals {
|
|
16
|
+
allow: number;
|
|
17
|
+
deny: number;
|
|
18
|
+
ask: number;
|
|
19
|
+
bypassImmune: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Render the effective permission rule state from a rule set.
|
|
23
|
+
* @param rules - the merged rule set (the engine's `ruleSet`).
|
|
24
|
+
* @param bypassImmune - bypass-immune rule count (deny, guard-enforced).
|
|
25
|
+
* @returns a read-only report of rule counts per source and in total.
|
|
26
|
+
*/
|
|
27
|
+
export declare function renderPermissions(rules: PermissionRuleSet, bypassImmune: number): string;
|
|
28
|
+
//# sourceMappingURL=permissions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,gCAAgC,CAAA;AAEvC,6CAA6C;AAC7C,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,uCAAuC;AACvC,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,YAAY,EAAE,MAAM,CAAA;CACrB;AAqBD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAcxF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure `/permissions` rendering: aggregate a permission rule set into counts
|
|
3
|
+
* per source and behavior. READ-ONLY — no mode switch is performed here.
|
|
4
|
+
* @module @dsh-cc/command-permissions/permissions
|
|
5
|
+
*/
|
|
6
|
+
import { SOURCE_PRIORITY, } from '@dsh-cc/permission-rules/types';
|
|
7
|
+
/** Count how many rules of one source fall into each behavior. */
|
|
8
|
+
function countsFor(source, rules) {
|
|
9
|
+
const out = { allow: 0, deny: 0, ask: 0, bypassImmune: 0 };
|
|
10
|
+
for (const rule of rules) {
|
|
11
|
+
if (rule.source !== source)
|
|
12
|
+
continue;
|
|
13
|
+
if (rule.behavior === 'allow')
|
|
14
|
+
out.allow += 1;
|
|
15
|
+
else if (rule.behavior === 'deny')
|
|
16
|
+
out.deny += 1;
|
|
17
|
+
else if (rule.behavior === 'ask')
|
|
18
|
+
out.ask += 1;
|
|
19
|
+
}
|
|
20
|
+
return out;
|
|
21
|
+
}
|
|
22
|
+
/** Sum a per-source aggregate into a grand total. */
|
|
23
|
+
function addTotals(total, counts) {
|
|
24
|
+
total.allow += counts.allow;
|
|
25
|
+
total.deny += counts.deny;
|
|
26
|
+
total.ask += counts.ask;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Render the effective permission rule state from a rule set.
|
|
30
|
+
* @param rules - the merged rule set (the engine's `ruleSet`).
|
|
31
|
+
* @param bypassImmune - bypass-immune rule count (deny, guard-enforced).
|
|
32
|
+
* @returns a read-only report of rule counts per source and in total.
|
|
33
|
+
*/
|
|
34
|
+
export function renderPermissions(rules, bypassImmune) {
|
|
35
|
+
const lines = ['Permission rules (read-only)'];
|
|
36
|
+
const total = { allow: 0, deny: 0, ask: 0, bypassImmune };
|
|
37
|
+
let any = false;
|
|
38
|
+
for (const source of SOURCE_PRIORITY) {
|
|
39
|
+
const counts = countsFor(source, [...rules.allow, ...rules.deny, ...rules.ask]);
|
|
40
|
+
if (counts.allow === 0 && counts.deny === 0 && counts.ask === 0)
|
|
41
|
+
continue;
|
|
42
|
+
any = true;
|
|
43
|
+
addTotals(total, counts);
|
|
44
|
+
lines.push(` ${source}: allow=${counts.allow} deny=${counts.deny} ask=${counts.ask}`);
|
|
45
|
+
}
|
|
46
|
+
if (!any)
|
|
47
|
+
lines.push(' (no rules configured)');
|
|
48
|
+
lines.push(`Total: allow=${total.allow} deny=${total.deny} ask=${total.ask} (bypassImmune=${bypassImmune})`);
|
|
49
|
+
return lines.join('\n');
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=permissions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,GAGhB,MAAM,gCAAgC,CAAA;AAkBvC,kEAAkE;AAClE,SAAS,SAAS,CAAC,MAAc,EAAE,KAAgC;IACjE,MAAM,GAAG,GAAiB,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CA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,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,MAAM,CAAC,GAAG,KAAK,CAAC;YAAE,SAAQ;QACzE,GAAG,GAAG,IAAI,CAAA;QACV,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;QACxB,KAAK,CAAC,IAAI,CAAC,KAAK,MAAM,WAAW,MAAM,CAAC,KAAK,SAAS,MAAM,CAAC,IAAI,QAAQ,MAAM,CAAC,GAAG,EAAE,CAAC,CAAA;IACxF,CAAC;IACD,IAAI,CAAC,GAAG;QAAE,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAA;IAC/C,KAAK,CAAC,IAAI,CAAC,gBAAgB,KAAK,CAAC,KAAK,SAAS,KAAK,CAAC,IAAI,QAAQ,KAAK,CAAC,GAAG,kBAAkB,YAAY,GAAG,CAAC,CAAA;IAC5G,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pending-aware plan lifecycle phase. plan-mode owns plan state inside the
|
|
3
|
+
* preset realm and folds it into the session-projection unit keyed `'plan'`
|
|
4
|
+
* (state `{active, wanted, running}`, stateVersion 2); its wire view defines
|
|
5
|
+
* pending as `(running?.wanted ?? wanted) !== null && !== active`. This
|
|
6
|
+
* module lifts that derivation into a single predicate every mode-switch
|
|
7
|
+
* surface needs, with a session-log fold fallback for compositions without
|
|
8
|
+
* the projection registry. Pure and browser-safe.
|
|
9
|
+
* @module @dsh-cc/command-permissions/plan-phase
|
|
10
|
+
*/
|
|
11
|
+
import type { SessionEvent } from '@deepseek-ai/dsh-session';
|
|
12
|
+
/**
|
|
13
|
+
* The plan lifecycle as mode switches see it:
|
|
14
|
+
* - `off` — no committed plan, no queued intent; entering dispatches `/plan`.
|
|
15
|
+
* - `entering` — a queued entry is in flight (applies from the next step).
|
|
16
|
+
* - `on` — plan committed, nothing queued; entering again is a no-op.
|
|
17
|
+
* - `leaving` — a queued exit is in flight.
|
|
18
|
+
*/
|
|
19
|
+
export type PlanPhase = 'off' | 'entering' | 'on' | 'leaving';
|
|
20
|
+
/**
|
|
21
|
+
* Structural minimum of plan-mode's projection unit state — re-declared so
|
|
22
|
+
* this package never imports upstream internals.
|
|
23
|
+
*/
|
|
24
|
+
export interface PlanUnitStateLike {
|
|
25
|
+
readonly active: boolean;
|
|
26
|
+
readonly wanted: boolean | null;
|
|
27
|
+
readonly running: {
|
|
28
|
+
readonly wanted: boolean;
|
|
29
|
+
} | null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Resolve the plan phase from the projection state, falling back to the
|
|
33
|
+
* session-log fold when the projection registry is not composed (custom
|
|
34
|
+
* minimal assemblies; both shipped profiles mount it). The projection, when
|
|
35
|
+
* present, is authoritative — it folds the same log plus replayed
|
|
36
|
+
* `command/run` pairs, so only it sees queued intent.
|
|
37
|
+
* @param events - the session event log (fold fallback).
|
|
38
|
+
* @param planState - the `'plan'` projection unit state, or undefined.
|
|
39
|
+
* @returns the current plan phase.
|
|
40
|
+
*/
|
|
41
|
+
export declare function planPhaseOf(events: readonly SessionEvent[], planState: PlanUnitStateLike | undefined): PlanPhase;
|
|
42
|
+
//# sourceMappingURL=plan-phase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-phase.d.ts","sourceRoot":"","sources":["../src/plan-phase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAG5D;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,UAAU,GAAG,IAAI,GAAG,SAAS,CAAA;AAE7D;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAA;IAC/B,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAA;CACtD;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,SAAS,YAAY,EAAE,EAC/B,SAAS,EAAE,iBAAiB,GAAG,SAAS,GACvC,SAAS,CAMX"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pending-aware plan lifecycle phase. plan-mode owns plan state inside the
|
|
3
|
+
* preset realm and folds it into the session-projection unit keyed `'plan'`
|
|
4
|
+
* (state `{active, wanted, running}`, stateVersion 2); its wire view defines
|
|
5
|
+
* pending as `(running?.wanted ?? wanted) !== null && !== active`. This
|
|
6
|
+
* module lifts that derivation into a single predicate every mode-switch
|
|
7
|
+
* surface needs, with a session-log fold fallback for compositions without
|
|
8
|
+
* the projection registry. Pure and browser-safe.
|
|
9
|
+
* @module @dsh-cc/command-permissions/plan-phase
|
|
10
|
+
*/
|
|
11
|
+
import { foldPlanMode } from '@deepseek-ai/dsh-plan-mode';
|
|
12
|
+
/**
|
|
13
|
+
* Resolve the plan phase from the projection state, falling back to the
|
|
14
|
+
* session-log fold when the projection registry is not composed (custom
|
|
15
|
+
* minimal assemblies; both shipped profiles mount it). The projection, when
|
|
16
|
+
* present, is authoritative — it folds the same log plus replayed
|
|
17
|
+
* `command/run` pairs, so only it sees queued intent.
|
|
18
|
+
* @param events - the session event log (fold fallback).
|
|
19
|
+
* @param planState - the `'plan'` projection unit state, or undefined.
|
|
20
|
+
* @returns the current plan phase.
|
|
21
|
+
*/
|
|
22
|
+
export function planPhaseOf(events, planState) {
|
|
23
|
+
if (planState === undefined)
|
|
24
|
+
return foldPlanMode(events) ? 'on' : 'off';
|
|
25
|
+
const raw = planState.running?.wanted ?? planState.wanted;
|
|
26
|
+
const pending = raw !== null && raw !== undefined && raw !== planState.active ? raw : null;
|
|
27
|
+
if (!planState.active)
|
|
28
|
+
return pending === true ? 'entering' : 'off';
|
|
29
|
+
return pending === false ? 'leaving' : 'on';
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=plan-phase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-phase.js","sourceRoot":"","sources":["../src/plan-phase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAqBzD;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CACzB,MAA+B,EAC/B,SAAwC;IAExC,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAA;IACvE,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,EAAE,MAAM,IAAI,SAAS,CAAC,MAAM,CAAA;IACzD,MAAM,OAAO,GAAG,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAA;IAC1F,IAAI,CAAC,SAAS,CAAC,MAAM;QAAE,OAAO,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAA;IACnE,OAAO,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAA;AAC7C,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dsh-cc/command-permissions",
|
|
3
|
+
"description": "Human-facing /permissions command (CC rule-engine modes) plus a popupSelect decoration (and TUI overlay) for the bare invocation",
|
|
4
|
+
"version": "0.5.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/dsh-cc/dsh-cc.git",
|
|
8
|
+
"directory": "packages/interaction/command-permissions"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./lib/index.d.ts",
|
|
14
|
+
"default": "./lib/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./invariant": {
|
|
17
|
+
"types": "./lib/invariant.d.ts",
|
|
18
|
+
"default": "./lib/invariant.js"
|
|
19
|
+
},
|
|
20
|
+
"./client": {
|
|
21
|
+
"types": "./lib/client/index.d.ts",
|
|
22
|
+
"default": "./lib/client.js"
|
|
23
|
+
},
|
|
24
|
+
"./src/*": "./src/*",
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"lib"
|
|
29
|
+
],
|
|
30
|
+
"license": "Apache-2.0",
|
|
31
|
+
"dsh": {
|
|
32
|
+
"client": {
|
|
33
|
+
"inject": [
|
|
34
|
+
"@deepseek-ai/dsh-client-runtime",
|
|
35
|
+
"@deepseek-ai/dsh-client-ui-commands"
|
|
36
|
+
],
|
|
37
|
+
"platform": "web"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@deepseek-ai/cordis": ">=0.1.1-rc.2",
|
|
42
|
+
"@deepseek-ai/dsh-client-runtime": ">=0.1.1-rc.2",
|
|
43
|
+
"@deepseek-ai/dsh-client-ui-commands": ">=0.1.1-rc.2",
|
|
44
|
+
"@deepseek-ai/dsh-client-ui-input-trigger": ">=0.1.1-rc.2",
|
|
45
|
+
"@deepseek-ai/dsh-commands": ">=0.1.1-rc.2",
|
|
46
|
+
"@deepseek-ai/dsh-invariants": ">=0.1.1-rc.2",
|
|
47
|
+
"@deepseek-ai/dsh-plan-mode": ">=0.1.1-rc.2"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@deepseek-ai/cordis": "link:../../../../deepseek-harness/vendor/cordis",
|
|
51
|
+
"@deepseek-ai/cordis-plugin-loader": "link:../../../../deepseek-harness/vendor/loader",
|
|
52
|
+
"@deepseek-ai/dsh-agent": "link:../../../../deepseek-harness/packages/core/agent",
|
|
53
|
+
"@deepseek-ai/dsh-client-runtime": "link:../../../../deepseek-harness/packages/client/runtime",
|
|
54
|
+
"@deepseek-ai/dsh-client-ui-commands": "link:../../../../deepseek-harness/packages/client/ui-commands",
|
|
55
|
+
"@deepseek-ai/dsh-client-ui-input-trigger": "link:../../../../deepseek-harness/packages/client/ui-input-trigger",
|
|
56
|
+
"@deepseek-ai/dsh-commands": "link:../../../../deepseek-harness/packages/interaction/commands",
|
|
57
|
+
"@deepseek-ai/dsh-invariants": "link:../../../../deepseek-harness/packages/runtime-diagnostics/invariants",
|
|
58
|
+
"@deepseek-ai/dsh-plan-mode": "link:../../../../deepseek-harness/packages/plan/plan-mode",
|
|
59
|
+
"@deepseek-ai/dsh-session": "link:../../../../deepseek-harness/packages/core/session",
|
|
60
|
+
"@deepseek-ai/dsh-system-prompt": "link:../../../../deepseek-harness/packages/core/system-prompt",
|
|
61
|
+
"@deepseek-ai/dsh-tools": "link:../../../../deepseek-harness/packages/core/tools",
|
|
62
|
+
"tsdown": "0.22.2"
|
|
63
|
+
},
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"access": "public"
|
|
66
|
+
},
|
|
67
|
+
"scripts": {
|
|
68
|
+
"bundle": "tsdown"
|
|
69
|
+
}
|
|
70
|
+
}
|