@deepseek-ai/dsh-permission-presets 0.2.1-rc.4 → 0.2.2-alpha.2
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/README.i18n.yaml +10 -10
- package/README.md +5 -5
- package/README.zh.md +5 -5
- package/lib/index.js +16 -10
- package/lib/typert.host.js +9 -5
- package/lib/typert.remote-client.js +1 -1
- package/lib/types/index.d.ts +6 -14
- package/lib/types/index.js +19 -13
- package/locale/de.json +6 -0
- package/locale/es.json +6 -0
- package/locale/fr.json +6 -0
- package/locale/ja.json +6 -0
- package/locale/pt.json +6 -0
- package/locale/ru.json +6 -0
- package/package.json +24 -21
package/README.i18n.yaml
CHANGED
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
en: 0b93409c92e2a769
|
|
19
19
|
zh: 4b4e10636760bb15
|
|
20
20
|
/deepseek-ai-dsh-permission-presets/use-this-package/configuring-presets:
|
|
21
|
-
en:
|
|
22
|
-
zh:
|
|
21
|
+
en: c561222e0c816e45
|
|
22
|
+
zh: bdab7b277c9564b7
|
|
23
23
|
/deepseek-ai-dsh-permission-presets/use-this-package/switching-presets:
|
|
24
24
|
en: ede3169d799a7578
|
|
25
25
|
zh: cb88e3ade597e486
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
en: 628a5bdd956e206c
|
|
28
28
|
zh: 172be9a9748d65ce
|
|
29
29
|
/deepseek-ai-dsh-permission-presets/use-this-package/session-defaults:
|
|
30
|
-
en:
|
|
31
|
-
zh:
|
|
30
|
+
en: a7077315c4898bf0
|
|
31
|
+
zh: 3e5f530bb4a8ffa8
|
|
32
32
|
/deepseek-ai-dsh-permission-presets/understand-the-implementation:
|
|
33
33
|
en: f5c37bc882b3f0d1
|
|
34
34
|
zh: 8203bea78976aefc
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
en: b01849a5fa73aae9
|
|
40
40
|
zh: cbd7fcf50117502b
|
|
41
41
|
/deepseek-ai-dsh-permission-presets/understand-the-implementation/read-side-and-custom:
|
|
42
|
-
en:
|
|
43
|
-
zh:
|
|
42
|
+
en: 76deeb5fbcdf7525
|
|
43
|
+
zh: e96ad7e107947c23
|
|
44
44
|
/deepseek-ai-dsh-permission-presets/understand-the-implementation/session-pinning-and-blank-reuse:
|
|
45
|
-
en:
|
|
46
|
-
zh:
|
|
45
|
+
en: 88a6095e3e4a8ec8
|
|
46
|
+
zh: 150ab4dc54292c77
|
|
47
47
|
/deepseek-ai-dsh-permission-presets/understand-the-implementation/catalog-projection-and-optional-command:
|
|
48
|
-
en:
|
|
49
|
-
zh:
|
|
48
|
+
en: 341f80202edd66a3
|
|
49
|
+
zh: bd8ebb9d011b547f
|
|
50
50
|
/deepseek-ai-dsh-permission-presets/further-exploration:
|
|
51
51
|
en: ca27c3e438cffdc5
|
|
52
52
|
zh: ae5d25ae55e5d503
|
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ The plugin config defines the preset table and the default for fresh sessions. E
|
|
|
49
49
|
| `presets` | `workspace-write`, `danger-full-access` | Table of preset name → sandbox/approval bundle |
|
|
50
50
|
| `defaultPreset` | inferred | Preset pinned into fresh sessions; required when composition defaults match no preset |
|
|
51
51
|
|
|
52
|
-
The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-permission-presets) is the exhaustive source for every accepted field and its JSDoc. `custom` is reserved for the derived not-a-preset state, while `auto` is reserved for the Auto review integration. Mounting requires a confining bash executor (one that reports a `sandboxMode`) and the
|
|
52
|
+
The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-permission-presets) is the exhaustive source for every accepted field and its JSDoc. `custom` is reserved for the derived not-a-preset state, while `auto` is reserved for the Auto review integration. Mounting requires a confining bash executor (one that reports a `sandboxMode`), the approval service, and the Agent registry.
|
|
53
53
|
|
|
54
54
|
### Switching presets
|
|
55
55
|
|
|
@@ -61,7 +61,7 @@ Clients render selectable entries from the process catalog: configured presets i
|
|
|
61
61
|
|
|
62
62
|
### Session defaults
|
|
63
63
|
|
|
64
|
-
The `permission` settings namespace holds `defaultPreset` for future sessions and accepts configured presets only.
|
|
64
|
+
The `permission` settings namespace holds `defaultPreset` for future sessions and accepts configured presets only. Agent creation reads it, applies it to the Session's sandbox mode and approval policy, and records the applied preset as a `permission/preset` selection. Later settings changes never alter an existing session. A resumed seed, including an explicitly empty one marked by `session/end-seed`, preserves its effective permission and receives only missing durable facts rather than the latest user default; a persisted `auto` identity requires the live Auto registration and its admission before publication.
|
|
65
65
|
|
|
66
66
|
-----
|
|
67
67
|
|
|
@@ -86,17 +86,17 @@ The observable behavior is covered in [Use this package](#use-this-package); thi
|
|
|
86
86
|
|
|
87
87
|
### Read side and `custom`
|
|
88
88
|
|
|
89
|
-
`current(session)` reads the required `permissions` projection, whose unit folds the three whole-value knob events over the composition defaults (`ctx.shell.sandboxMode` and the approval config). The host state also retains whether `session/end-seed` has occurred, so session pinning distinguishes an explicitly empty restored seed from a genuinely fresh session without rescanning the log. A still-matching last selection wins shared-bundle ties, and a recorded Auto selection also matches the `never` approval policy; otherwise the first configured match wins; otherwise the derived `CUSTOM_PRESET` is returned.
|
|
89
|
+
`current(session)` reads the required `permissions` projection, whose unit folds the three whole-value knob events over the composition defaults (`ctx.shell.sandboxMode` and the approval config). The host state also retains whether `session/end-seed` has occurred, so session pinning distinguishes an explicitly empty restored seed from a genuinely fresh session without rescanning the log. A still-matching last selection wins shared-bundle ties, and a recorded Auto selection also matches the `never` approval policy; otherwise the first configured match wins; otherwise the derived `CUSTOM_PRESET` is returned. The service acquires its state reader during activation.
|
|
90
90
|
|
|
91
91
|
`optionOf(name)` returns a configured entry, the live Auto entry, or the display-only `custom` entry. It throws only when the name matches none of those; a withdrawn Auto entry is unavailable.
|
|
92
92
|
|
|
93
93
|
### Session pinning and blank reuse
|
|
94
94
|
|
|
95
|
-
Mounting pins every live and future
|
|
95
|
+
Mounting pins the Sessions of every live and future Agent: a genuinely fresh session gains the configured default preset and both knob facts, while seeded or partially initialized sessions keep their effective knob values and gain only missing durable facts. The projection-owned seed marker makes this decision from the same incremental state as the knob values. The service installs its `agent/created` listener before starting projection registration, so creation during activation fails instead of skipping pinning. `prepend: true` places pinning before ordinary creation observers, which may read the recorded permission facts. A later listener using `prepend` can run earlier and must not assume pinning has finished. While its reader is not ready, Agent creation rolls back; callers must await plugin activation before creating or restoring Agents. Creating a Session without an Agent does not initialize permissions. A stored `auto` identity fails publication when the Auto integration is absent or rejects admission; the service neither rewrites it nor silently derives Full access.
|
|
96
96
|
|
|
97
97
|
### Catalog, projection, and optional command
|
|
98
98
|
|
|
99
|
-
The service requires `ctx.sessionProjections` and
|
|
99
|
+
The service requires `ctx.sessionProjections` and awaits registration of `permissions`; its client view contains only `currentValue`. Its process-level `catalog()` Remote returns one complete selectable snapshot. Registering or removing Auto emits the payload-free `permission-presets/catalog-changed` notification, so clients subscribe first and then re-read the catalog without appending a Session event, publishing a Session projection frame, or changing Session sequence. The `/permission` command registers only when a `ctx.commands` registry is composed. Calls that derive the current preset or pin an initial selection use the retained projection handle.
|
|
100
100
|
|
|
101
101
|
</details>
|
|
102
102
|
|
package/README.zh.md
CHANGED
|
@@ -49,7 +49,7 @@ kind: "package-reference"
|
|
|
49
49
|
| `presets` | `workspace-write`、`danger-full-access` | 预设名称 → 沙箱/审批捆绑的表 |
|
|
50
50
|
| `defaultPreset` | 推断 | 固定到新会话的预设;组合默认值不匹配任何预设时必填 |
|
|
51
51
|
|
|
52
|
-
生成的[配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-permission-presets)是每个受支持字段及其 JSDoc 的穷尽式真源。`custom` 保留给推导出的非预设状态,`auto` 则保留给 Auto review integration。挂载需要具有约束能力的 bash 执行器(会报告 `sandboxMode`
|
|
52
|
+
生成的[配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-permission-presets)是每个受支持字段及其 JSDoc 的穷尽式真源。`custom` 保留给推导出的非预设状态,`auto` 则保留给 Auto review integration。挂载需要具有约束能力的 bash 执行器(会报告 `sandboxMode` 的执行器)、审批服务和 Agent 注册表。
|
|
53
53
|
|
|
54
54
|
### 切换预设
|
|
55
55
|
|
|
@@ -61,7 +61,7 @@ kind: "package-reference"
|
|
|
61
61
|
|
|
62
62
|
### 会话默认值
|
|
63
63
|
|
|
64
|
-
`permission` 设置命名空间为未来会话持有 `defaultPreset
|
|
64
|
+
`permission` 设置命名空间为未来会话持有 `defaultPreset`,且只接受配置预设。创建 Agent 时读取它,将其应用于 Session 的沙箱模式与审批策略,并把应用的预设记录为一次 `permission/preset` 选择。之后的设置变更绝不会改变现有会话。恢复的 seed(包括由 `session/end-seed` 明确标记的空 seed)会保留其有效权限,并只接收缺失的持久事实,而不会接收最新用户默认值;持久化的 `auto` 身份在发布前必须存在 live Auto 注册并通过准入。
|
|
65
65
|
|
|
66
66
|
-----
|
|
67
67
|
|
|
@@ -86,17 +86,17 @@ kind: "package-reference"
|
|
|
86
86
|
|
|
87
87
|
### 读取侧与 `custom`
|
|
88
88
|
|
|
89
|
-
`current(session)` 读取必需的 `permissions` 投影;该单元在组合默认值(`ctx.shell.sandboxMode` 与审批配置)之上折叠三个全量值旋钮事件。host 状态还会保留 `session/end-seed` 是否已经出现,使会话固定无需重扫日志即可区分显式为空的恢复 seed 与真正的新会话。仍匹配的最近选择在共享捆绑时胜出,已记录的 Auto 选择在 `never` 审批策略下也匹配;否则配置表中的第一个匹配项胜出;否则返回推导出的 `CUSTOM_PRESET
|
|
89
|
+
`current(session)` 读取必需的 `permissions` 投影;该单元在组合默认值(`ctx.shell.sandboxMode` 与审批配置)之上折叠三个全量值旋钮事件。host 状态还会保留 `session/end-seed` 是否已经出现,使会话固定无需重扫日志即可区分显式为空的恢复 seed 与真正的新会话。仍匹配的最近选择在共享捆绑时胜出,已记录的 Auto 选择在 `never` 审批策略下也匹配;否则配置表中的第一个匹配项胜出;否则返回推导出的 `CUSTOM_PRESET`。该服务在激活期间取得状态读取句柄。
|
|
90
90
|
|
|
91
91
|
`optionOf(name)` 返回配置条目、存活的 Auto 条目或仅供显示的 `custom` 条目。只有名称不匹配这三者时才抛错;已撤回的 Auto 条目不可用。
|
|
92
92
|
|
|
93
93
|
### 会话固定与空白复用
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
挂载时会固定所有存活与未来 Agent 的 Session:真正全新的会话获得配置默认预设与两个旋钮事实,而 seed 会话或部分初始化的会话保留其有效旋钮值,只补充缺失的持久事实。投影自有的 seed 标记让该判断与旋钮值共用同一份增量状态。服务在投影注册开始前安装 `agent/created` 监听器,因此激活期间的创建会失败,而不会跳过权限固定。`prepend: true` 使权限固定先于普通创建观察者执行,后者可以读取已记录的权限事实。后来使用 `prepend` 的监听器可能更早执行,不能假定权限已固定。读取句柄尚未就绪时,Agent 创建回滚;调用方必须等待插件激活完成后再创建或恢复 Agent。只创建 Session 而不创建 Agent 时,不会初始化权限。存储的 `auto` 身份在 Auto integration 缺失或拒绝准入时无法发布;服务既不会改写它,也不会静默推导为 Full access。
|
|
96
96
|
|
|
97
97
|
### 目录、投影与可选命令
|
|
98
98
|
|
|
99
|
-
该服务要求 `ctx.sessionProjections
|
|
99
|
+
该服务要求 `ctx.sessionProjections`,并等待 `permissions` 注册完成;其客户端视图只含 `currentValue`。进程级 `catalog()` Remote 返回一份完整的可选快照。注册或移除 Auto 会发出无 payload 的 `permission-presets/catalog-changed` 通知,因此客户端先订阅再重新读取目录;该过程不会追加 Session 事件、发布 Session 投影帧或改变 Session 序列。`/permission` 命令仅在组合了 `ctx.commands` 注册表时注册。派生当前预设或固定初始选择的调用使用保留的投影句柄。
|
|
100
100
|
|
|
101
101
|
</details>
|
|
102
102
|
|
package/lib/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Service } from "@deepseek-ai/cordis";
|
|
1
2
|
import { CommandDefinitionId } from "@deepseek-ai/dsh-commands/brand";
|
|
2
3
|
import z from "@deepseek-ai/schemastery";
|
|
3
4
|
import { z as z$1 } from "zod";
|
|
@@ -161,11 +162,13 @@ let PermissionPresetService = (() => {
|
|
|
161
162
|
"shell",
|
|
162
163
|
"approval",
|
|
163
164
|
"sessions",
|
|
165
|
+
"agents",
|
|
164
166
|
"sessionProjections"
|
|
165
167
|
];
|
|
166
168
|
presets = __runInitializers(this, _instanceExtraInitializers);
|
|
167
169
|
autoAdmit;
|
|
168
170
|
defaultSettings;
|
|
171
|
+
permissionProjectionHandle;
|
|
169
172
|
constructor(ctx, config) {
|
|
170
173
|
super(ctx, "permissionPresets");
|
|
171
174
|
ctx.inject(["settings"], (child) => {
|
|
@@ -184,8 +187,14 @@ let PermissionPresetService = (() => {
|
|
|
184
187
|
if (!Object.hasOwn(this.presets, defaultPreset)) throw new Error(`permission: unknown default preset "${defaultPreset}"`);
|
|
185
188
|
return { defaultPreset };
|
|
186
189
|
};
|
|
190
|
+
}
|
|
191
|
+
async [Service.init]() {
|
|
192
|
+
const ctx = this.ctx;
|
|
193
|
+
ctx.on("agent/created", ({ agent }) => {
|
|
194
|
+
this.pinInitialPermission(agent.session);
|
|
195
|
+
}, { prepend: true });
|
|
187
196
|
const selectionSchema = z$1.object({ currentValue: z$1.string().min(1) });
|
|
188
|
-
ctx.sessionProjections.register({
|
|
197
|
+
this.permissionProjectionHandle = await ctx.sessionProjections.register({
|
|
189
198
|
key: "permissions",
|
|
190
199
|
stateVersion: 2,
|
|
191
200
|
stateSchema: permissionStateSchema,
|
|
@@ -199,10 +208,7 @@ let PermissionPresetService = (() => {
|
|
|
199
208
|
view: (state) => ({ currentValue: this.derive(state) })
|
|
200
209
|
}
|
|
201
210
|
});
|
|
202
|
-
ctx.
|
|
203
|
-
this.pinInitialPermission(session);
|
|
204
|
-
});
|
|
205
|
-
for (const session of ctx.sessions.list()) this.pinInitialPermission(session);
|
|
211
|
+
for (const agent of ctx.agents.list()) this.pinInitialPermission(agent.session);
|
|
206
212
|
ctx.inject(["commands"], (commandCtx) => {
|
|
207
213
|
commandCtx.commands.register({
|
|
208
214
|
definitionId: CommandDefinitionId("@deepseek-ai/dsh-permission-presets"),
|
|
@@ -275,9 +281,8 @@ let PermissionPresetService = (() => {
|
|
|
275
281
|
return this.defaultSettings().defaultPreset;
|
|
276
282
|
}
|
|
277
283
|
permissionState(session) {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
return state;
|
|
284
|
+
if (this.permissionProjectionHandle === void 0) throw new Error("permission: presets are not ready; await plugin activation before creating or restoring a session");
|
|
285
|
+
return this.permissionProjectionHandle.stateOf(session);
|
|
281
286
|
}
|
|
282
287
|
/**
|
|
283
288
|
* Resolve the preset matching the effective knob values. A still-matching
|
|
@@ -360,12 +365,13 @@ let PermissionPresetService = (() => {
|
|
|
360
365
|
updateKnobs();
|
|
361
366
|
}
|
|
362
367
|
/**
|
|
363
|
-
* Fill every missing permission fact
|
|
368
|
+
* Fill every missing permission fact during Agent creation. A
|
|
364
369
|
* genuinely fresh session uses the current user default; seeded or partially
|
|
365
370
|
* initialized sessions preserve their effective knob values and only gain
|
|
366
371
|
* the missing durable facts. A stored Auto identity requires its live
|
|
367
372
|
* integration and passes its admission check before
|
|
368
|
-
*
|
|
373
|
+
* creation completes. Creation while the permission reader is still registering
|
|
374
|
+
* fails so the publishing caller can roll back.
|
|
369
375
|
*/
|
|
370
376
|
pinInitialPermission(session) {
|
|
371
377
|
const state = this.permissionState(session);
|
package/lib/typert.host.js
CHANGED
|
@@ -34,7 +34,7 @@ const $remote = createTypertRemoteInfo({
|
|
|
34
34
|
description: 'every currently selectable preset in contribution order.',
|
|
35
35
|
jsonSchema: {"type":"object","properties":{"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string","description":"Stable option value: a configured preset key, live `auto`, or derived `custom`."},"name":{"type":"string","description":"The display label."},"description":{"type":"string","description":"One user-facing sentence on what the value means; omitted when not configured."}},"required":["value","name"],"additionalProperties":true},"description":"Every currently selectable preset, in contribution order."},"defaultOptions":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string","description":"Stable option value: a configured preset key, live `auto`, or derived `custom`."},"name":{"type":"string","description":"The display label."},"description":{"type":"string","description":"One user-facing sentence on what the value means; omitted when not configured."}},"required":["value","name"],"additionalProperties":true},"description":"Configured presets eligible as defaults for future sessions."},"defaultPreset":{"type":"string","description":"Effective default when the Config field is omitted."}},"required":["options","defaultOptions","defaultPreset"],"additionalProperties":true},
|
|
36
36
|
},
|
|
37
|
-
sourceLocation: {"file":"packages/interaction/permission-presets/src/index.ts","line":
|
|
37
|
+
sourceLocation: {"file":"packages/interaction/permission-presets/src/index.ts","line":292,"column":3},
|
|
38
38
|
},
|
|
39
39
|
},
|
|
40
40
|
}, z)
|
|
@@ -427,7 +427,7 @@ export const TYPERT = {
|
|
|
427
427
|
},
|
|
428
428
|
{
|
|
429
429
|
"name": "MessageSourceMap",
|
|
430
|
-
"declaration": "export interface MessageSourceMap {\n user: { kind: 'user'; };\n model: ModelMessageSource;\n tool: ToolMessageSource;\n 'system-prompt': SystemPromptMessageSource;\n 'model-selection': { kind: 'model-selection'; } & ContextFormed;\n '
|
|
430
|
+
"declaration": "export interface MessageSourceMap {\n user: { kind: 'user'; };\n model: ModelMessageSource;\n tool: ToolMessageSource;\n 'system-prompt': SystemPromptMessageSource;\n 'model-selection': { kind: 'model-selection'; } & ContextFormed;\n 'tool-registry': { kind: 'tool-registry'; };\n 'action-cards': { kind: 'action-cards'; through: SessionSeq; } & ContextFormed;\n 'runtime-context': { kind: 'runtime-context'; } & ContextFormed;\n 'user-rpc': { kind: 'user'; rpcId: SessionRequestId; clientTimeZone?: string; principal?: Principal; };\n 'working-directory': { kind: 'working-directory'; };\n 'user-approval': { kind: 'user-approval'; } & ContextFormed;\n 'agent-message': AgentMessageSource;\n 'subagent-settled': SubagentSettledMessageSource;\n 'skill-invocation': SkillInvocationSource;\n 'ptc-mode': { kind: 'ptc-mode'; };\n 'compact-checkpoint': CompactionCheckpointSource;\n 'cordis-host-runner': { kind: 'cordis-host-runner'; };\n 'user-question-reply': { kind: 'user-question-reply'; callId: ToolCallId; outcome: 'answered'; };\n 'team-message': TeamMessageSource;\n goal: GoalMessageSource;\n 'plan-mode': { kind: 'plan-mode'; } & ContextFormed;\n schedule: { kind: 'schedule'; } & ContextFormed;\n 'session-reference': SessionReferenceSource;\n webhook: { readonly kind: 'webhook'; readonly provider: string; readonly source: WebhookSourceId; readonly deliveryId: WebhookDeliveryId; readonly ruleId: WebhookRuleId; readonly form: 'notice'; readonly summary: string; };\n}"
|
|
431
431
|
},
|
|
432
432
|
{
|
|
433
433
|
"name": "ModelMessageSource",
|
|
@@ -435,7 +435,7 @@ export const TYPERT = {
|
|
|
435
435
|
},
|
|
436
436
|
{
|
|
437
437
|
"name": "ModelSelection",
|
|
438
|
-
"declaration": "export interface ModelSelection {\n
|
|
438
|
+
"declaration": "export interface ModelSelection {\n provider: string;\n model: string;\n reasoningEffort?: ReasoningEffortId;\n}"
|
|
439
439
|
},
|
|
440
440
|
{
|
|
441
441
|
"name": "OneShotScheduleDispatchChange",
|
|
@@ -467,7 +467,7 @@ export const TYPERT = {
|
|
|
467
467
|
},
|
|
468
468
|
{
|
|
469
469
|
"name": "PrincipalMap",
|
|
470
|
-
"declaration": "export interface PrincipalMap {\n owner: { readonly kind: 'owner'; };\n}"
|
|
470
|
+
"declaration": "export interface PrincipalMap {\n owner: { readonly kind: 'owner'; };\n 'share-viewer': ShareViewerPrincipal;\n}"
|
|
471
471
|
},
|
|
472
472
|
{
|
|
473
473
|
"name": "ProviderRequestId",
|
|
@@ -539,7 +539,7 @@ export const TYPERT = {
|
|
|
539
539
|
},
|
|
540
540
|
{
|
|
541
541
|
"name": "SessionEventMap",
|
|
542
|
-
"declaration": "export interface SessionEventMap {\n 'turn/start': { turn: number; };\n 'turn/end': { turn: number; reason: TurnEndReason; };\n 'step/start': { turn: number; step: number; };\n 'step/end': { turn: number; step: number; };\n 'user/message': UserMessage;\n 'developer/message': { turn: number; step: number; message: DeveloperMessage; headerSeq?: SessionSeq; };\n 'system/message': { turn: number; step: number; message: SystemMessage; };\n 'assistant/message': { turn: number; step: number; message: AssistantMessage; stream: AssistantStreamRecord[]; usage?: TokenUsage; interrupted?: true; };\n 'assistant/attempt': { turn: number; step: number; stream: AssistantStreamRecord[]; };\n 'tool/call': { turn: number; step: number; callId: ToolCallId; name: string; arguments: string; };\n 'tool/result': { turn: number; step: number; message: ToolResultMessage; error?: { name: string; code: string; reason?: string; }; meta?: JsonValue; };\n 'request/header': { header: EpochHeader; reason: RequestHeaderReason; startsSeries?: true; };\n 'request/context': RequestContext;\n 'session/end-seed': { inherited?: true; };\n 'agent/inbox/spliced': { target: InboxTarget; start: number; removedCount?: number; inserted: UserMessage[]; outcome?: 'canceled'; };\n '
|
|
542
|
+
"declaration": "export interface SessionEventMap {\n 'turn/start': { turn: number; };\n 'turn/end': { turn: number; reason: TurnEndReason; };\n 'step/start': { turn: number; step: number; };\n 'step/end': { turn: number; step: number; };\n 'user/message': UserMessage;\n 'developer/message': { turn: number; step: number; message: DeveloperMessage; headerSeq?: SessionSeq; };\n 'system/message': { turn: number; step: number; message: SystemMessage; };\n 'assistant/message': { turn: number; step: number; message: AssistantMessage; stream: AssistantStreamRecord[]; usage?: TokenUsage; interrupted?: true; };\n 'assistant/attempt': { turn: number; step: number; stream: AssistantStreamRecord[]; };\n 'tool/call': { turn: number; step: number; callId: ToolCallId; name: string; arguments: string; };\n 'tool/result': { turn: number; step: number; message: ToolResultMessage; error?: { name: string; code: string; reason?: string; }; meta?: JsonValue; };\n 'request/header': { header: EpochHeader; reason: RequestHeaderReason; startsSeries?: true; };\n 'request/context': RequestContext;\n 'session/end-seed': { inherited?: true; };\n 'agent/inbox/spliced': { target: InboxTarget; start: number; removedCount?: number; inserted: UserMessage[]; outcome?: 'canceled'; };\n 'model/selection': ModelSelection;\n 'sandbox/mode': { mode: SandboxMode; source?: 'delegation'; };\n 'agent-preset/selected': { agentPreset: string; };\n 'job/registered': JobRegisteredData;\n 'job/settled': JobSettledData;\n 'command/run': { commandId: CommandId; name: string; args?: string; source: CommandSource; };\n 'command/done': { commandId: CommandId; kind: 'success' | 'error'; text?: string; sourceEventSeq?: import('@deepseek-ai/dsh-session/types').SessionSeq; };\n 'image/offload': { targets: ImageOffloadTarget[]; };\n 'session/title': SessionTitleEventData;\n 'todo/write': { todos: TodoItem[]; };\n 'working-directory/change': { cwd: string; };\n 'approval/asked': { id: ApprovalRequestId; toolName: string; callId?: ToolCallId; reason?: string; };\n 'approval/decided': { id: ApprovalRequestId; outcome: ApprovalOutcome; };\n 'approval/policy': { policy: ApprovalPolicy; source?: 'delegation'; };\n 'permission/preset': { preset: string; };\n 'subagent/descriptor': SubagentDescriptorData;\n 'subagent/catalog': SubagentCatalogEvent;\n 'compaction/start': { compactionId: CompactionId; sourceCommandId?: CommandId; turn: number | null; };\n 'compaction/summary': { compactionId: CompactionId; sourceCommandId?: CommandId; summary: ContentBlock[]; shadowedRange: { start: SessionSeq; end: SessionSeq; }; shadowedSeqs: SessionSeq[]; shadowedTokenCount: number; provider: string; model: string; maxTokens?: number; usage?: TokenUsage; } & ({ rawOutput: ContentBlock[]; llmStreamCall: true; } | { rawOutput?: ContentBlock[]; llmStreamCall?: never; });\n 'compaction/end': { compactionId: CompactionId; sourceCommandId?: CommandId; turn: number | null; error?: string; };\n 'compaction/prune': { shadowedRange: { start: SessionSeq; end: SessionSeq; }; shadowedSeqs: SessionSeq[]; shadowedTokenCount: number; };\n 'tool/ptc-dispatch-start': PtcDispatchStartEventData;\n 'tool/ptc-dispatch': PtcDispatchEventData;\n 'feedback/record': FeedbackRecord;\n 'llm/retry': LlmRetryEventData;\n 'llm/retry-started': LlmRetryStartedEventData;\n 'team/member': { version: 2; teamId: TeamId; member: TeamMemberSnapshot; };\n 'team/task': { version: 2; teamId: TeamId; task: TeamTaskSnapshot; };\n 'team/message/queued': { version: 2; teamId: TeamId; message: TeamMessageSnapshot; };\n 'team/message/delivered': { version: 2; teamId: TeamId; messageId: TeamMessageId; targetId: SessionId; };\n 'goal/change': GoalChangeMeta;\n 'feedback/message-put': MessageFeedbackPut;\n 'feedback/message-delete': MessageFeedbackDelete;\n 'plan/mode': { active: boolean; };\n 'schedule/change': ScheduleChange;\n 'subagent/model-selection-policy': { allowedModels: AllowedModelRoute[]; };\n 'workspace/changes': { turn: number; };\n}"
|
|
543
543
|
},
|
|
544
544
|
{
|
|
545
545
|
"name": "SessionEventType",
|
|
@@ -589,6 +589,10 @@ export const TYPERT = {
|
|
|
589
589
|
"name": "SessionTitleSource",
|
|
590
590
|
"declaration": "export type SessionTitleSource = { readonly kind: 'fallback'; } | { readonly kind: 'provider'; readonly provider: SessionTitleProviderId; readonly model?: SessionTitleModelIdentity; } | { readonly kind: 'user'; };"
|
|
591
591
|
},
|
|
592
|
+
{
|
|
593
|
+
"name": "ShareViewerPrincipal",
|
|
594
|
+
"declaration": "export interface ShareViewerPrincipal {\n readonly kind: 'share-viewer';\n readonly shareId: string;\n readonly actor: { readonly providerId: string; readonly tenantId: string; readonly subjectId: string; readonly displayName?: string; };\n}"
|
|
595
|
+
},
|
|
592
596
|
{
|
|
593
597
|
"name": "SkillInvocationSource",
|
|
594
598
|
"declaration": "export interface SkillInvocationSource {\n readonly kind: 'skill-invocation';\n readonly name: string;\n readonly form: 'instructions';\n}"
|
|
@@ -34,7 +34,7 @@ export const TYPERT_REMOTE = createTypertRemoteInfo({
|
|
|
34
34
|
description: 'every currently selectable preset in contribution order.',
|
|
35
35
|
jsonSchema: {"type":"object","properties":{"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string","description":"Stable option value: a configured preset key, live `auto`, or derived `custom`."},"name":{"type":"string","description":"The display label."},"description":{"type":"string","description":"One user-facing sentence on what the value means; omitted when not configured."}},"required":["value","name"],"additionalProperties":true},"description":"Every currently selectable preset, in contribution order."},"defaultOptions":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string","description":"Stable option value: a configured preset key, live `auto`, or derived `custom`."},"name":{"type":"string","description":"The display label."},"description":{"type":"string","description":"One user-facing sentence on what the value means; omitted when not configured."}},"required":["value","name"],"additionalProperties":true},"description":"Configured presets eligible as defaults for future sessions."},"defaultPreset":{"type":"string","description":"Effective default when the Config field is omitted."}},"required":["options","defaultOptions","defaultPreset"],"additionalProperties":true},
|
|
36
36
|
},
|
|
37
|
-
sourceLocation: {"file":"packages/interaction/permission-presets/src/index.ts","line":
|
|
37
|
+
sourceLocation: {"file":"packages/interaction/permission-presets/src/index.ts","line":292,"column":3},
|
|
38
38
|
},
|
|
39
39
|
},
|
|
40
40
|
}, z)
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Volatile } from '@deepseek-ai/cordis';
|
|
2
|
-
import { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import { Context, Service } from '@deepseek-ai/cordis';
|
|
3
3
|
import z from '@deepseek-ai/schemastery';
|
|
4
4
|
import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
|
|
5
5
|
import type { Session } from '@deepseek-ai/dsh-session';
|
|
@@ -12,12 +12,6 @@ declare module '@deepseek-ai/cordis' {
|
|
|
12
12
|
permissionPresets: PermissionPresetService;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
declare module '@deepseek-ai/dsh-session-projection/types' {
|
|
16
|
-
interface SessionProjectionStateMap {
|
|
17
|
-
/** Latest logged permission overrides and constructor-seed status. */
|
|
18
|
-
permissions: PermissionProjectionState;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
15
|
declare module '@deepseek-ai/dsh-session/types' {
|
|
22
16
|
interface SessionEventMap {
|
|
23
17
|
/**
|
|
@@ -61,11 +55,6 @@ export interface KnobState {
|
|
|
61
55
|
/** Last `approval/policy` payload, or null. */
|
|
62
56
|
approval: ApprovalPolicy | null;
|
|
63
57
|
}
|
|
64
|
-
/** Projection state for permission overrides and constructor-seed status. */
|
|
65
|
-
interface PermissionProjectionState extends KnobState {
|
|
66
|
-
/** Whether the log contains a constructor-seed boundary. */
|
|
67
|
-
seeded: boolean;
|
|
68
|
-
}
|
|
69
58
|
/** User setting resolved when a new session receives its initial permission. */
|
|
70
59
|
export interface PermissionSettings {
|
|
71
60
|
/** Preset pinned into a newly created session. */
|
|
@@ -124,7 +113,9 @@ export declare class PermissionPresetService extends TypertRemoteService {
|
|
|
124
113
|
private readonly presets;
|
|
125
114
|
private autoAdmit;
|
|
126
115
|
private defaultSettings;
|
|
116
|
+
private permissionProjectionHandle;
|
|
127
117
|
constructor(ctx: Context, config: Config);
|
|
118
|
+
protected [Service.init](): Promise<void>;
|
|
128
119
|
/**
|
|
129
120
|
* The advertised preset names: configured entries in declaration order,
|
|
130
121
|
* followed by Auto while its integration is live.
|
|
@@ -187,12 +178,13 @@ export declare class PermissionPresetService extends TypertRemoteService {
|
|
|
187
178
|
/** Apply one preset through its durable identity and canonical knob setters. */
|
|
188
179
|
private apply;
|
|
189
180
|
/**
|
|
190
|
-
* Fill every missing permission fact
|
|
181
|
+
* Fill every missing permission fact during Agent creation. A
|
|
191
182
|
* genuinely fresh session uses the current user default; seeded or partially
|
|
192
183
|
* initialized sessions preserve their effective knob values and only gain
|
|
193
184
|
* the missing durable facts. A stored Auto identity requires its live
|
|
194
185
|
* integration and passes its admission check before
|
|
195
|
-
*
|
|
186
|
+
* creation completes. Creation while the permission reader is still registering
|
|
187
|
+
* fails so the publishing caller can roll back.
|
|
196
188
|
*/
|
|
197
189
|
private pinInitialPermission;
|
|
198
190
|
/** Publish a non-vetoing payload-free catalog invalidation. */
|
package/lib/types/index.js
CHANGED
|
@@ -32,6 +32,7 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
|
|
|
32
32
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
33
|
done = true;
|
|
34
34
|
};
|
|
35
|
+
import { Service } from '@deepseek-ai/cordis';
|
|
35
36
|
import { CommandDefinitionId } from '@deepseek-ai/dsh-commands/brand';
|
|
36
37
|
import z from '@deepseek-ai/schemastery';
|
|
37
38
|
import { z as zod } from 'zod';
|
|
@@ -123,10 +124,11 @@ let PermissionPresetService = (() => {
|
|
|
123
124
|
}),
|
|
124
125
|
defaultPreset: z.string().volatile(),
|
|
125
126
|
});
|
|
126
|
-
static inject = ['shell', 'approval', 'sessions', 'sessionProjections'];
|
|
127
|
+
static inject = ['shell', 'approval', 'sessions', 'agents', 'sessionProjections'];
|
|
127
128
|
presets = __runInitializers(this, _instanceExtraInitializers);
|
|
128
129
|
autoAdmit;
|
|
129
130
|
defaultSettings;
|
|
131
|
+
permissionProjectionHandle;
|
|
130
132
|
constructor(ctx, config) {
|
|
131
133
|
super(ctx, 'permissionPresets');
|
|
132
134
|
ctx.inject(['settings'], (child) => { child.effect(() => child.settings.configure({ auto: false }, ctx.fiber)); });
|
|
@@ -153,10 +155,16 @@ let PermissionPresetService = (() => {
|
|
|
153
155
|
throw new Error(`permission: unknown default preset "${defaultPreset}"`);
|
|
154
156
|
return { defaultPreset };
|
|
155
157
|
};
|
|
158
|
+
}
|
|
159
|
+
async [Service.init]() {
|
|
160
|
+
const ctx = this.ctx;
|
|
161
|
+
ctx.on('agent/created', ({ agent }) => {
|
|
162
|
+
this.pinInitialPermission(agent.session);
|
|
163
|
+
}, { prepend: true });
|
|
156
164
|
const selectionSchema = zod.object({
|
|
157
165
|
currentValue: zod.string().min(1),
|
|
158
166
|
});
|
|
159
|
-
ctx.sessionProjections.register({
|
|
167
|
+
this.permissionProjectionHandle = await ctx.sessionProjections.register({
|
|
160
168
|
key: 'permissions',
|
|
161
169
|
stateVersion: 2,
|
|
162
170
|
stateSchema: permissionStateSchema,
|
|
@@ -164,11 +172,8 @@ let PermissionPresetService = (() => {
|
|
|
164
172
|
apply: applyPermissionEvent,
|
|
165
173
|
wire: { viewSchema: selectionSchema, view: state => ({ currentValue: this.derive(state) }) },
|
|
166
174
|
});
|
|
167
|
-
ctx.
|
|
168
|
-
this.pinInitialPermission(session);
|
|
169
|
-
});
|
|
170
|
-
for (const session of ctx.sessions.list()) {
|
|
171
|
-
this.pinInitialPermission(session);
|
|
175
|
+
for (const agent of ctx.agents.list()) {
|
|
176
|
+
this.pinInitialPermission(agent.session);
|
|
172
177
|
}
|
|
173
178
|
// The /permission command: the one write path a web client uses (the
|
|
174
179
|
// popup contribution submits the picked preset as this line). The child
|
|
@@ -242,10 +247,10 @@ let PermissionPresetService = (() => {
|
|
|
242
247
|
return this.defaultSettings().defaultPreset;
|
|
243
248
|
}
|
|
244
249
|
permissionState(session) {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
return
|
|
250
|
+
if (this.permissionProjectionHandle === undefined) {
|
|
251
|
+
throw new Error('permission: presets are not ready; await plugin activation before creating or restoring a session');
|
|
252
|
+
}
|
|
253
|
+
return this.permissionProjectionHandle.stateOf(session);
|
|
249
254
|
}
|
|
250
255
|
/**
|
|
251
256
|
* Resolve the preset matching the effective knob values. A still-matching
|
|
@@ -333,12 +338,13 @@ let PermissionPresetService = (() => {
|
|
|
333
338
|
updateKnobs();
|
|
334
339
|
}
|
|
335
340
|
/**
|
|
336
|
-
* Fill every missing permission fact
|
|
341
|
+
* Fill every missing permission fact during Agent creation. A
|
|
337
342
|
* genuinely fresh session uses the current user default; seeded or partially
|
|
338
343
|
* initialized sessions preserve their effective knob values and only gain
|
|
339
344
|
* the missing durable facts. A stored Auto identity requires its live
|
|
340
345
|
* integration and passes its admission check before
|
|
341
|
-
*
|
|
346
|
+
* creation completes. Creation while the permission reader is still registering
|
|
347
|
+
* fails so the publishing caller can roll back.
|
|
342
348
|
*/
|
|
343
349
|
pinInitialPermission(session) {
|
|
344
350
|
const state = this.permissionState(session);
|
package/locale/de.json
ADDED
package/locale/es.json
ADDED
package/locale/fr.json
ADDED
package/locale/ja.json
ADDED
package/locale/pt.json
ADDED
package/locale/ru.json
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-permission-presets",
|
|
3
3
|
"description": "User-facing permission presets (ctx.permissionPresets) for the DeepSeek Harness: one product-level Permissions select bundling the sandbox-mode and approval-policy knobs, written through to their own session events",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2-alpha.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -50,30 +50,33 @@
|
|
|
50
50
|
],
|
|
51
51
|
"license": "MIT",
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@deepseek-ai/dsh-
|
|
54
|
-
"@deepseek-ai/dsh-
|
|
55
|
-
"@deepseek-ai/dsh-
|
|
56
|
-
"@deepseek-ai/dsh-sandbox
|
|
57
|
-
"@deepseek-ai/dsh-
|
|
58
|
-
"@deepseek-ai/dsh-session
|
|
59
|
-
"@deepseek-ai/dsh-
|
|
60
|
-
"@deepseek-ai/dsh-
|
|
61
|
-
"@deepseek-ai/
|
|
53
|
+
"@deepseek-ai/dsh-agent": "0.2.2-alpha.2",
|
|
54
|
+
"@deepseek-ai/dsh-shell": "0.2.2-alpha.2",
|
|
55
|
+
"@deepseek-ai/dsh-commands": "0.2.2-alpha.2",
|
|
56
|
+
"@deepseek-ai/dsh-sandbox": "0.2.2-alpha.2",
|
|
57
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.2.2-alpha.2",
|
|
58
|
+
"@deepseek-ai/dsh-session": "0.2.2-alpha.2",
|
|
59
|
+
"@deepseek-ai/dsh-session-projection": "0.2.2-alpha.2",
|
|
60
|
+
"@deepseek-ai/dsh-typert-protocol": "0.2.2-alpha.2",
|
|
61
|
+
"@deepseek-ai/dsh-user-approval": "0.2.2-alpha.2",
|
|
62
|
+
"@deepseek-ai/cordis": "~4.0.6-alpha.1"
|
|
62
63
|
},
|
|
63
64
|
"dependencies": {
|
|
64
|
-
"@deepseek-ai/schemastery": "~3.18.
|
|
65
|
+
"@deepseek-ai/schemastery": "~3.18.6-alpha.1",
|
|
65
66
|
"zod": "4.4.3"
|
|
66
67
|
},
|
|
67
68
|
"devDependencies": {
|
|
68
|
-
"@deepseek-ai/dsh-
|
|
69
|
-
"@deepseek-ai/dsh-
|
|
70
|
-
"@deepseek-ai/dsh-
|
|
71
|
-
"@deepseek-ai/dsh-sandbox
|
|
72
|
-
"@deepseek-ai/dsh-
|
|
73
|
-
"@deepseek-ai/dsh-session
|
|
74
|
-
"@deepseek-ai/dsh-
|
|
75
|
-
"@deepseek-ai/dsh-
|
|
76
|
-
"@deepseek-ai/
|
|
77
|
-
"@deepseek-ai/
|
|
69
|
+
"@deepseek-ai/dsh-agent": "0.2.2-alpha.2",
|
|
70
|
+
"@deepseek-ai/dsh-shell": "0.2.2-alpha.2",
|
|
71
|
+
"@deepseek-ai/dsh-commands": "0.2.2-alpha.2",
|
|
72
|
+
"@deepseek-ai/dsh-sandbox": "0.2.2-alpha.2",
|
|
73
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.2.2-alpha.2",
|
|
74
|
+
"@deepseek-ai/dsh-session": "0.2.2-alpha.2",
|
|
75
|
+
"@deepseek-ai/dsh-session-projection": "0.2.2-alpha.2",
|
|
76
|
+
"@deepseek-ai/dsh-typert-protocol": "0.2.2-alpha.2",
|
|
77
|
+
"@deepseek-ai/dsh-user-approval": "0.2.2-alpha.2",
|
|
78
|
+
"@deepseek-ai/cordis": "~4.0.6-alpha.1",
|
|
79
|
+
"@deepseek-ai/dsh-settings": "0.2.2-alpha.2",
|
|
80
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "0.2.2-alpha.2"
|
|
78
81
|
}
|
|
79
82
|
}
|