@qilin-agent/client-ui-permission-presets 0.0.0-stage → 3.1.4
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/README.i18n.yaml +43 -0
- package/README.md +93 -2
- package/README.zh.md +94 -0
- package/lib/client.js +905 -0
- package/lib/index.js +11 -0
- package/lib/types/client/PermissionRow.d.ts +35 -0
- package/lib/types/client/PermissionSelect.d.ts +16 -0
- package/lib/types/client/catalog.d.ts +63 -0
- package/lib/types/client/index.d.ts +38 -0
- package/lib/types/client/locales.d.ts +78 -0
- package/lib/types/client/presentation.d.ts +21 -0
- package/lib/types/client/settings-store.d.ts +76 -0
- package/lib/types/index.d.ts +9 -0
- package/package.json +77 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 kkutysllb
|
|
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/README.i18n.yaml
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
|
|
2
|
+
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
|
|
3
|
+
# After editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write packages/client/ui-permission-presets/README.md
|
|
5
|
+
/:
|
|
6
|
+
en: bef3c4170b3887a8
|
|
7
|
+
zh: eb1b5ac2e6e04f5f
|
|
8
|
+
/qilin-agent-client-ui-permission-presets:
|
|
9
|
+
en: 95fe6bbac7fc8c64
|
|
10
|
+
zh: ca10f6fbcaa233e4
|
|
11
|
+
/qilin-agent-client-ui-permission-presets/summary:
|
|
12
|
+
en: 2591adc4721c0564
|
|
13
|
+
zh: 311292f58621adb6
|
|
14
|
+
/qilin-agent-client-ui-permission-presets/table-of-contents:
|
|
15
|
+
en: d152484eb41ac6b4
|
|
16
|
+
zh: 09388d293f9be9cb
|
|
17
|
+
/qilin-agent-client-ui-permission-presets/use-this-package:
|
|
18
|
+
en: 91606bff7da02253
|
|
19
|
+
zh: ef68e813d64c89be
|
|
20
|
+
/qilin-agent-client-ui-permission-presets/use-this-package/the-picker:
|
|
21
|
+
en: d851eab85fe002bd
|
|
22
|
+
zh: 0fdf6eeb1cbd609b
|
|
23
|
+
/qilin-agent-client-ui-permission-presets/use-this-package/the-settings-row:
|
|
24
|
+
en: 5067f6aa12496225
|
|
25
|
+
zh: cfa6796684f97535
|
|
26
|
+
/qilin-agent-client-ui-permission-presets/understand-the-implementation:
|
|
27
|
+
en: 4089d5bebf3e8bf0
|
|
28
|
+
zh: bc5c3652b0612784
|
|
29
|
+
/qilin-agent-client-ui-permission-presets/further-exploration:
|
|
30
|
+
en: ab801026a7f4d11d
|
|
31
|
+
zh: e97648c649c9d921
|
|
32
|
+
/qilin-agent-client-ui-permission-presets/model-experience:
|
|
33
|
+
en: 114f37b90a58cffa
|
|
34
|
+
zh: dc99a48a72c975e6
|
|
35
|
+
/qilin-agent-client-ui-permission-presets/model-experience/kv-cache-effect:
|
|
36
|
+
en: f25206808c8d84c5
|
|
37
|
+
zh: 4fcbc876952d240d
|
|
38
|
+
/qilin-agent-client-ui-permission-presets/known-limitations-and-deferred-work:
|
|
39
|
+
en: 08cdc0ad196d12c1
|
|
40
|
+
zh: 1b65f5d30e219197
|
|
41
|
+
/qilin-agent-client-ui-permission-presets/known-limitations-and-deferred-work/dev-note:
|
|
42
|
+
en: e67f633dc6fe7773
|
|
43
|
+
zh: 3bb0c20c93f16f98
|
package/README.md
CHANGED
|
@@ -1,3 +1,94 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: "Permission preset surfaces for the Web GUI: the General settings default row and the /permission picker for the current session; for users and maintainers of permission policy."
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
# @qilin-agent/client-ui-permission-presets
|
|
7
|
+
|
|
8
|
+
English | [中文](README.zh.md)
|
|
9
|
+
|
|
10
|
+
## Summary
|
|
11
|
+
|
|
12
|
+
Choose permission presets for the current Web session or future sessions. General settings changes only the future default; the composer and `/permission` pickers switch the current session. Default Web offers Read Only, Workspace Write, and Full access. Explicitly loading the experimental Auto integration adds Auto review with an `EXP` badge to current-session pickers. Visible Full access and Auto selections require their own risk acknowledgement; a complete `/permission <preset>` command executes directly. The host confirms each change through the Session projection.
|
|
13
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Use this package](#use-this-package)
|
|
17
|
+
- [Understand the implementation](#understand-the-implementation)
|
|
18
|
+
- [Further Exploration](#further-exploration)
|
|
19
|
+
- [Model Experience](#model-experience)
|
|
20
|
+
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
|
|
21
|
+
- [Dev Note](#dev-note)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## Use this package
|
|
27
|
+
|
|
28
|
+
Mount this plugin alongside the settings, commands, and conversation packages. General settings receives the future-default row; the composer receives the `conversation.input.permission` control, and bare `/permission` opens the slash picker. Current-session controls require both the Session projection and a complete catalog snapshot. A permission-less composition exposes neither current-session controls nor the Settings row.
|
|
29
|
+
|
|
30
|
+
### The picker
|
|
31
|
+
|
|
32
|
+
A pick submits the `/permission <preset>` command line. The argument-bearing form (`/permission <preset>` typed directly) still switches directly; the decoration replaces only the bare invocation. The built-in labels are `Read Only`, `Workspace Write`, `Full access`, and `Auto review` in English and `仅可查看`, `工作区内修改`, `完全权限`, and `Auto review` in Chinese. Explicit host labels remain unchanged, unknown kebab-case names render in title case, and `auto` carries an `EXP` badge plus an experimental-risk confirmation. `custom` is display state, never a target.
|
|
33
|
+
|
|
34
|
+
When the live catalog withdraws a preset, the composer closes its pending confirmation and shows the Session's current value instead of an unavailable optimistic pick. Every catalog invalidation — the payload-free notification or a connection-generation change — closes an open slash picker or its confirmation without consuming the draft, while publishing the result of a read the picker waits for leaves it open with its failure and retry state; reopening reads the current catalog. A submitted command remains busy until its response settles.
|
|
35
|
+
|
|
36
|
+
### The Settings row
|
|
37
|
+
|
|
38
|
+
The row derives its options from the host's dynamic `defaultPreset` enum, uses the same localized built-in labels as the current-session picker, and writes one settings mutation. Current-session-only contributions such as `auto` are absent. The value applies only when a later session is created; changing it never switches or rewrites the current session.
|
|
39
|
+
|
|
40
|
+
-----
|
|
41
|
+
|
|
42
|
+
<a id="understand-the-implementation"></a>
|
|
43
|
+
## Understand the implementation
|
|
44
|
+
|
|
45
|
+
<details>
|
|
46
|
+
<summary>Implementation internals — click to expand</summary>
|
|
47
|
+
|
|
48
|
+
The General row reads the explicitly exposed `permission` Settings descriptor through `ctx.configForms` and writes one `settings.mutate` path operation with the descriptor revision; its observable rides the slot system's `hooks` compartment, so the renderer owns React hook binding, and a push invalidation refetches the descriptor. The value is read only when a later session is created. The current-session surface is a popupSelect decoration hung on the host `/permission` command (`ctx.commandUi.decorate`): the host command keeps its slash-menu row, argument-bearing form, and durable lifecycle logging, while the decoration replaces only the bare invocation with the picker. One process-scoped directory subscribes to the payload-free catalog notification before its first Remote read and publishes only the latest complete success for the active connection generation. A winning failure or connection reset clears the old snapshot, which hides the composer seat until a later existing trigger retries, while the slash picker stays available and shows the failure with its retry; stale-generation and disposed settlements are ignored. Its public observables are `{ value }` and `invalidations`, one tick per catalog notification or connection-generation change; failures remain internal to imperative loading. Both the slash popup and composer seat consume that shared catalog, while the Session `permissions` projection supplies only `currentValue`. Full access and Auto review each carry localized confirmation copy; Auto also carries the badge rendered by the shared popup shell.
|
|
49
|
+
|
|
50
|
+
</details>
|
|
51
|
+
|
|
52
|
+
-----
|
|
53
|
+
|
|
54
|
+
<a id="further-exploration"></a>
|
|
55
|
+
## Further Exploration
|
|
56
|
+
|
|
57
|
+
Read these pages when the permission surface is not enough. They move from the browser surfaces to the host policy and the command shell.
|
|
58
|
+
|
|
59
|
+
- [qilin-permission-presets](../../interaction/permission-presets/README.md) — the host-side permission preset policy these surfaces write.
|
|
60
|
+
- [ui-commands](../ui-commands/README.md) — the popupSelect shell the `/permission` decoration registers into.
|
|
61
|
+
- [ui-conversation](../ui-conversation/README.md) — the composer seat that joins this shared catalog with the Session's current value.
|
|
62
|
+
- [Client package map](../README.md) — adjacent browser UI packages.
|
|
63
|
+
|
|
64
|
+
-----
|
|
65
|
+
|
|
66
|
+
<a id="model-experience"></a>
|
|
67
|
+
## Model Experience
|
|
68
|
+
|
|
69
|
+
Indirectly, through the permission facts its two surfaces write: the Settings row causes a future session to start with whole-value knob events, while the `/permission` picker appends the selected current-session preset. Sandbox and approval consumers resolve their own knob events; selecting `auto` additionally activates the host Auto integration's independent per-call reviewer.
|
|
70
|
+
|
|
71
|
+
#### KV Cache effect
|
|
72
|
+
|
|
73
|
+
No direct invalidation; the knob consumers own any request-prefix changes.
|
|
74
|
+
|
|
75
|
+
## Known Limitations and Deferred Work
|
|
76
|
+
|
|
77
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
These limits define the current permission surfaces. They are current package constraints, not a general policy comparison or a task backlog.
|
|
81
|
+
|
|
82
|
+
- **The Settings row is Web-only** — non-Web clients may still switch the current session through `/permission`, but do not receive this browser contribution.
|
|
83
|
+
- **Auto review is current-session-only** — the General-settings row intentionally omits it, and only visible picker selection receives the experimental confirmation; an explicitly typed `/permission auto` is already explicit consent.
|
|
84
|
+
- **Preset descriptions come from the host** — localized built-in labels may therefore appear beside a description written in another language.
|
|
85
|
+
|
|
86
|
+
<a id="dev-note"></a>
|
|
87
|
+
### Dev Note
|
|
88
|
+
|
|
89
|
+
<details>
|
|
90
|
+
<summary>Working context for maintainers — click to expand</summary>
|
|
91
|
+
|
|
92
|
+
None.
|
|
93
|
+
|
|
94
|
+
</details>
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Web GUI 的权限预设界面:通用设置中的默认行与切换当前会话的 /permission 选择器;供权限策略的用户与维护者阅读。"
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @qilin-agent/client-ui-permission-presets
|
|
7
|
+
|
|
8
|
+
[English](README.md) | 中文
|
|
9
|
+
|
|
10
|
+
## 概述
|
|
11
|
+
|
|
12
|
+
为当前 Web 会话或未来会话选择权限预设。通用设置行只更改之后创建会话所用的默认值;composer 与 `/permission` 选择器切换当前会话。默认 Web 提供仅可查看、工作区内修改与完全权限。显式加载实验 Auto integration 后,当前会话选择器会增加带 `EXP` 标记的 Auto review。通过可见选项选择完全权限或 Auto 时,需要分别确认对应风险;完整的 `/permission <preset>` 命令直接执行。宿主通过 Session 投影确认每次变更。
|
|
13
|
+
|
|
14
|
+
## 目录
|
|
15
|
+
|
|
16
|
+
- [使用本包](#use-this-package)
|
|
17
|
+
- [理解实现](#understand-the-implementation)
|
|
18
|
+
- [进一步探索](#further-exploration)
|
|
19
|
+
- [模型体验](#model-experience)
|
|
20
|
+
- [已知限制与延期工作](#known-limitations-and-deferred-work)
|
|
21
|
+
- [开发备注](#dev-note)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## 使用本包
|
|
27
|
+
|
|
28
|
+
将本插件与 settings、commands 和 conversation 包一同挂载。通用设置获得未来默认值行;composer 获得 `conversation.input.permission` 控件,裸 `/permission` 打开 slash 选择器。当前会话控件同时要求 Session 投影和完整目录快照。不提供权限功能的装配既不公开当前会话控件,也不公开设置行。
|
|
29
|
+
|
|
30
|
+
### 选择器
|
|
31
|
+
|
|
32
|
+
选中即提交 `/permission <preset>` 命令行。带参形式(直接键入 `/permission <preset>`)仍直接切换;装饰只替换裸调用。内置标签在英文界面中是 `Read Only`、`Workspace Write`、`Full access` 和 `Auto review`,在中文界面中是「仅可查看」「工作区内修改」「完全权限」和 `Auto review`。显式 host 标签保持原样,未知 kebab-case 名称渲染为 Title Case;`auto` 带有 `EXP` badge,并在可见选择时要求实验风险确认。`custom` 只是显示状态,绝非目标。
|
|
33
|
+
|
|
34
|
+
实时目录撤销某个预设时,composer 关闭对应的待确认对话框,并用 Session 的当前值替代已不可用的乐观选择。每次目录失效(无 payload 的通知或连接代际变更)会关闭已打开的 slash 选择器或其确认对话框,不消费草稿;而发布某个 picker 正在等待的读取结果时,该 picker 保持打开并保留失败与重试状态;重新打开时读取当前目录。已经提交的命令在响应结束前继续保持忙碌状态。
|
|
35
|
+
|
|
36
|
+
### 设置行
|
|
37
|
+
|
|
38
|
+
该行从宿主动态的 `defaultPreset` enum 推导选项,使用与当前会话选择器相同的本地化内置标签,并写入一条设置变更操作。`auto` 等仅限当前会话的 contribution 不会出现。该值只在之后创建会话时生效;改变它绝不会切换或改写当前会话。
|
|
39
|
+
|
|
40
|
+
-----
|
|
41
|
+
|
|
42
|
+
<a id="understand-the-implementation"></a>
|
|
43
|
+
## 理解实现
|
|
44
|
+
|
|
45
|
+
<details>
|
|
46
|
+
<summary>实现细节——点击展开</summary>
|
|
47
|
+
|
|
48
|
+
General Settings 行经 `ctx.configForms` 读取显式暴露的 `permission` Settings 描述符,并携带描述符 revision 写入一条 `settings.mutate` 路径操作;其 observable 经 slot 系统的 `hooks` compartment 传递,因此 React 钩子绑定归渲染器,推送失效通知会重新获取描述符。该值只在之后创建会话时读取。当前会话界面是挂在宿主 `/permission` 命令上的 popupSelect 装饰(`ctx.commandUi.decorate`):宿主命令保留斜杠菜单行、带参形式与持久生命周期记账,装饰只把裸调用替换为选择器。一个进程级目录会在首次 Remote 读取前订阅无 payload 的目录通知,并且只发布当前连接代际中最新的完整成功结果。胜出的读取失败或连接 reset 会清空旧快照:composer seat 因此隐藏,直到后续既有触发重试,而 slash 选择器保持可用并在弹窗内显示失败与重试;旧连接代际与 dispose 后才返回的结果会被忽略。它的公共 observable 是 `{ value }` 与 `invalidations`(每次目录通知或连接代际变更打一个点);失败仅供命令式加载内部使用。slash popup 与 composer seat 共用这份目录,而 Session `permissions` 投影只提供 `currentValue`。Full access 与 Auto review 各自携带本地化确认文案;Auto 还携带由共享 popup 外壳渲染的 badge。
|
|
49
|
+
|
|
50
|
+
</details>
|
|
51
|
+
|
|
52
|
+
-----
|
|
53
|
+
|
|
54
|
+
<a id="further-exploration"></a>
|
|
55
|
+
## 进一步探索
|
|
56
|
+
|
|
57
|
+
需要了解权限界面以外的内容时,请阅读以下页面。这些页面从浏览器界面进一步介绍宿主策略与命令外壳。
|
|
58
|
+
|
|
59
|
+
- [qilin-permission-presets](../../interaction/permission-presets/README.zh.md)——这些界面写入的宿主侧权限预设策略。
|
|
60
|
+
- [ui-commands](../ui-commands/README.zh.md)——`/permission` 装饰注册进的 popupSelect 外壳。
|
|
61
|
+
- [ui-conversation](../ui-conversation/README.zh.md)——把这份共享目录与 Session 当前值合并的 composer seat。
|
|
62
|
+
- [客户端包映射](../README.zh.md)——相邻的浏览器 UI 包。
|
|
63
|
+
|
|
64
|
+
-----
|
|
65
|
+
|
|
66
|
+
<a id="model-experience"></a>
|
|
67
|
+
## 模型体验
|
|
68
|
+
|
|
69
|
+
间接影响。它的两个界面写入权限事实:设置行使未来会话带着全量值旋钮事件启动,而 `/permission` 选择器追加选中的当前会话预设。沙箱与审批消费方各自解析自己的旋钮事件;选择 `auto` 还会启用宿主 Auto integration 的独立逐调用 reviewer。
|
|
70
|
+
|
|
71
|
+
#### KV Cache 影响
|
|
72
|
+
|
|
73
|
+
无直接失效;请求前缀的变化由旋钮消费方自行承担。
|
|
74
|
+
|
|
75
|
+
## 已知限制与延期工作
|
|
76
|
+
|
|
77
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
这些限制界定了当前权限界面。它们是当前包约束,不是通用策略对比或任务积压。
|
|
81
|
+
|
|
82
|
+
- **设置行仅限 Web**——非 Web 客户端仍可经 `/permission` 切换当前会话,但不会获得这项浏览器贡献。
|
|
83
|
+
- **Auto review 仅限当前会话**——General Settings 行有意省略它,且只有通过可见选择器选择时才显示实验确认;显式键入 `/permission auto` 已经构成明确同意。
|
|
84
|
+
- **预设描述来自宿主**——本地化的内置标签旁边可能显示另一种语言编写的描述。
|
|
85
|
+
|
|
86
|
+
<a id="dev-note"></a>
|
|
87
|
+
### 开发备注
|
|
88
|
+
|
|
89
|
+
<details>
|
|
90
|
+
<summary>维护者的工作上下文——点击展开</summary>
|
|
91
|
+
|
|
92
|
+
无。
|
|
93
|
+
|
|
94
|
+
</details>
|