@deepseek-ai/dsh-permission-presets 0.2.0-rc.2 → 0.2.1-alpha.1
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 +4 -4
- package/README.md +1 -2
- package/README.zh.md +1 -2
- package/lib/typert.host.js +14 -2
- package/package.json +21 -28
- package/lib/invariant.js +0 -29
- package/lib/types/invariant.d.ts +0 -13
- package/lib/types/invariant.js +0 -36
package/README.i18n.yaml
CHANGED
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
en: f5c37bc882b3f0d1
|
|
34
34
|
zh: 8203bea78976aefc
|
|
35
35
|
/deepseek-ai-dsh-permission-presets/understand-the-implementation/source-map:
|
|
36
|
-
en:
|
|
37
|
-
zh:
|
|
36
|
+
en: 172f5c8af5705ada
|
|
37
|
+
zh: b424834e38adb25d
|
|
38
38
|
/deepseek-ai-dsh-permission-presets/understand-the-implementation/write-path:
|
|
39
39
|
en: b01849a5fa73aae9
|
|
40
40
|
zh: cbd7fcf50117502b
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
en: 2e79bec74274b054
|
|
49
49
|
zh: 256526ab1b4b55e9
|
|
50
50
|
/deepseek-ai-dsh-permission-presets/further-exploration:
|
|
51
|
-
en:
|
|
52
|
-
zh:
|
|
51
|
+
en: ca27c3e438cffdc5
|
|
52
|
+
zh: ae5d25ae55e5d503
|
|
53
53
|
/deepseek-ai-dsh-permission-presets/model-experience:
|
|
54
54
|
en: e57a5ed554b4e882
|
|
55
55
|
zh: 6a464902171cb659
|
package/README.md
CHANGED
|
@@ -79,7 +79,6 @@ The observable behavior is covered in [Use this package](#use-this-package); thi
|
|
|
79
79
|
|---|---|
|
|
80
80
|
| [`src/index.ts`](src/index.ts) | `PermissionPresetService`: configured table, fixed Auto registration, write path, settings namespace, session pinning, children |
|
|
81
81
|
| [`src/types.ts`](src/types.ts) | Process catalog, catalog-change event, and `permissions` current-selection types |
|
|
82
|
-
| [`src/invariant.ts`](src/invariant.ts) | Invariant companion validating configured preset names; Auto restore is checked before publication |
|
|
83
82
|
|
|
84
83
|
### Write path
|
|
85
84
|
|
|
@@ -109,7 +108,7 @@ The service requires `ctx.sessionProjections` and registers a `permissions` proj
|
|
|
109
108
|
Read these pages when the package-level contract is not enough. They move from the preset vocabulary to the enforcement knobs and the design rationale.
|
|
110
109
|
|
|
111
110
|
- [Permission presets subsystem reference](../../../docs/subsystems/permission-presets.md) — the preset table, process catalog, current selection, and `ctx.permissionPresets` Cordis API.
|
|
112
|
-
- [Sandbox switching design Agent Note](../../../.agents/notes/
|
|
111
|
+
- [historical Sandbox switching design Agent Note](../../../.agents/notes/archived/feature/2026-07-06-sandbox.md) — how sandbox mode and approval policy compose and switch.
|
|
113
112
|
- [Approval subsystem reference](../../../docs/subsystems/approval.md) — the approval policy knob this service bundles.
|
|
114
113
|
- [Interaction group map](../README.md) — adjacent command, approval, and question packages.
|
|
115
114
|
|
package/README.zh.md
CHANGED
|
@@ -79,7 +79,6 @@ kind: "package-reference"
|
|
|
79
79
|
|---|---|
|
|
80
80
|
| [`src/index.ts`](src/index.ts) | `PermissionPresetService`:配置表、固定 Auto 注册、写入路径、设置命名空间、会话固定、子功能 |
|
|
81
81
|
| [`src/types.ts`](src/types.ts) | 进程级目录、目录变化事件与 `permissions` 当前选择类型 |
|
|
82
|
-
| [`src/invariant.ts`](src/invariant.ts) | 不变式伴生插件:校验配置预设名称;Auto 恢复在发布前另行检查 |
|
|
83
82
|
|
|
84
83
|
### 写入路径
|
|
85
84
|
|
|
@@ -109,7 +108,7 @@ kind: "package-reference"
|
|
|
109
108
|
当包级约定不够用时阅读以下页面。它们从预设词汇逐步进入执行旋钮与设计依据。
|
|
110
109
|
|
|
111
110
|
- [权限预设子系统参考](../../../docs/subsystems/permission-presets.zh.md)——预设表、进程级目录、当前选择与 `ctx.permissionPresets` Cordis API。
|
|
112
|
-
- [
|
|
111
|
+
- [历史沙箱切换设计 Agent Note](../../../.agents/notes/archived/feature/2026-07-06-sandbox.md)——沙箱模式与审批策略如何组合与切换。
|
|
113
112
|
- [审批子系统参考](../../../docs/subsystems/approval.zh.md)——此服务捆绑的审批策略旋钮。
|
|
114
113
|
- [交互组映射](../README.zh.md)——相邻的命令、审批与问答包。
|
|
115
114
|
|
package/lib/typert.host.js
CHANGED
|
@@ -338,6 +338,14 @@ export const TYPERT = {
|
|
|
338
338
|
"name": "LlmFailure",
|
|
339
339
|
"declaration": "export interface LlmFailure {\n readonly message: string;\n readonly code: string;\n readonly status?: number;\n readonly providerRetryAfterMs?: number;\n readonly requestId?: ProviderRequestId;\n readonly offloadImages?: number;\n}"
|
|
340
340
|
},
|
|
341
|
+
{
|
|
342
|
+
"name": "LlmRetryEventData",
|
|
343
|
+
"declaration": "export type LlmRetryEventData = { retryId: RetryId; turn: number; step: number; provider: string; mode: 'normal'; policyKey: string; retry: number; maxRetries: number; delayMs: number; failure: LlmFailure; } | { retryId: RetryId; turn: number; step: number; provider: string; mode: 'always'; policyKey: string; retry: number; delayMs: number; failure: LlmFailure; };"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
"name": "LlmRetryStartedEventData",
|
|
347
|
+
"declaration": "export interface LlmRetryStartedEventData {\n retryId: RetryId;\n turn: number;\n step: number;\n retry: number;\n}"
|
|
348
|
+
},
|
|
341
349
|
{
|
|
342
350
|
"name": "Message",
|
|
343
351
|
"declaration": "export type Message = MessageRoleMap[keyof MessageRoleMap];"
|
|
@@ -380,7 +388,7 @@ export const TYPERT = {
|
|
|
380
388
|
},
|
|
381
389
|
{
|
|
382
390
|
"name": "MessageSourceMap",
|
|
383
|
-
"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 'user-approval': { kind: 'user-approval'; } & ContextFormed;\n 'ptc-mode': { kind: 'ptc-mode'; };\n 'tool-registry': { kind: 'tool-registry'; };\n 'user-rpc': { kind: 'user'; rpcId: SessionRequestId; clientTimeZone?: string; };\n 'agent-message': AgentMessageSource;\n 'subagent-settled': SubagentSettledMessageSource;\n 'skill-invocation': SkillInvocationSource;\n 'cordis-host-runner': { kind: 'cordis-host-runner'; };\n
|
|
391
|
+
"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 'user-approval': { kind: 'user-approval'; } & ContextFormed;\n 'ptc-mode': { kind: 'ptc-mode'; };\n 'tool-registry': { kind: 'tool-registry'; };\n 'user-rpc': { kind: 'user'; rpcId: SessionRequestId; clientTimeZone?: string; };\n 'agent-message': AgentMessageSource;\n 'subagent-settled': SubagentSettledMessageSource;\n 'skill-invocation': SkillInvocationSource;\n 'cordis-host-runner': { kind: 'cordis-host-runner'; };\n 'compact-checkpoint': CompactionCheckpointSource;\n 'user-question-reply': { kind: 'user-question-reply'; callId: ToolCallId; outcome: 'answered'; };\n goal: GoalMessageSource;\n schedule: { kind: 'schedule'; } & ContextFormed;\n 'session-reference': SessionReferenceSource;\n}"
|
|
384
392
|
},
|
|
385
393
|
{
|
|
386
394
|
"name": "ModelMessageSource",
|
|
@@ -446,6 +454,10 @@ export const TYPERT = {
|
|
|
446
454
|
"name": "RequestHeaderReason",
|
|
447
455
|
"declaration": "export type RequestHeaderReason = 'initial' | 'resume' | 'change' | 'series';"
|
|
448
456
|
},
|
|
457
|
+
{
|
|
458
|
+
"name": "RetryId",
|
|
459
|
+
"declaration": "export type RetryId = Branded<'RetryId'>;"
|
|
460
|
+
},
|
|
449
461
|
{
|
|
450
462
|
"name": "SandboxMode",
|
|
451
463
|
"declaration": "export type SandboxMode = 'read-only' | 'workspace-write' | 'danger-full-access';"
|
|
@@ -480,7 +492,7 @@ export const TYPERT = {
|
|
|
480
492
|
},
|
|
481
493
|
{
|
|
482
494
|
"name": "SessionEventMap",
|
|
483
|
-
"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 'sandbox/mode': { mode: SandboxMode; source?: 'delegation'; };\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 'tool/ptc-dispatch-start': PtcDispatchStartEventData;\n 'tool/ptc-dispatch': PtcDispatchEventData;\n 'agent-preset/selected': { agentPreset: string; };\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 'model/selection': ModelSelection;\n 'subagent/descriptor': SubagentDescriptorData;\n 'permission/preset': { preset: string; };\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 'feedback/record': FeedbackRecord;\n 'goal/change': GoalChangeMeta;\n 'feedback/message-put': MessageFeedbackPut;\n 'feedback/message-delete': MessageFeedbackDelete;\n 'schedule/change': ScheduleChange;\n}"
|
|
495
|
+
"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 'sandbox/mode': { mode: SandboxMode; source?: 'delegation'; };\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 'tool/ptc-dispatch-start': PtcDispatchStartEventData;\n 'tool/ptc-dispatch': PtcDispatchEventData;\n 'agent-preset/selected': { agentPreset: string; };\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 'model/selection': ModelSelection;\n 'subagent/descriptor': SubagentDescriptorData;\n 'permission/preset': { preset: string; };\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 'feedback/record': FeedbackRecord;\n 'llm/retry': LlmRetryEventData;\n 'llm/retry-started': LlmRetryStartedEventData;\n 'goal/change': GoalChangeMeta;\n 'feedback/message-put': MessageFeedbackPut;\n 'feedback/message-delete': MessageFeedbackDelete;\n 'schedule/change': ScheduleChange;\n}"
|
|
484
496
|
},
|
|
485
497
|
{
|
|
486
498
|
"name": "SessionEventType",
|
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.1-alpha.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -18,10 +18,6 @@
|
|
|
18
18
|
"types": "./lib/types/index.d.ts",
|
|
19
19
|
"default": "./lib/index.js"
|
|
20
20
|
},
|
|
21
|
-
"./invariant": {
|
|
22
|
-
"types": "./lib/types/invariant.d.ts",
|
|
23
|
-
"default": "./lib/invariant.js"
|
|
24
|
-
},
|
|
25
21
|
"./types": {
|
|
26
22
|
"types": "./lib/types/types.d.ts",
|
|
27
23
|
"default": "./lib/types/types.js"
|
|
@@ -43,7 +39,6 @@
|
|
|
43
39
|
},
|
|
44
40
|
"files": [
|
|
45
41
|
"lib/index.js",
|
|
46
|
-
"lib/invariant.js",
|
|
47
42
|
"lib/types/**/*.js",
|
|
48
43
|
"lib/types/**/*.d.ts",
|
|
49
44
|
"lib/typert.host.js",
|
|
@@ -53,32 +48,30 @@
|
|
|
53
48
|
],
|
|
54
49
|
"license": "MIT",
|
|
55
50
|
"peerDependencies": {
|
|
56
|
-
"@deepseek-ai/dsh-shell": "0.2.
|
|
57
|
-
"@deepseek-ai/dsh-commands": "0.2.
|
|
58
|
-
"@deepseek-ai/dsh-
|
|
59
|
-
"@deepseek-ai/dsh-
|
|
60
|
-
"@deepseek-ai/dsh-
|
|
61
|
-
"@deepseek-ai/dsh-
|
|
62
|
-
"@deepseek-ai/dsh-
|
|
63
|
-
"@deepseek-ai/dsh-
|
|
64
|
-
"@deepseek-ai/
|
|
65
|
-
"@deepseek-ai/cordis": "~4.0.4"
|
|
51
|
+
"@deepseek-ai/dsh-shell": "0.2.1-alpha.1",
|
|
52
|
+
"@deepseek-ai/dsh-commands": "0.2.1-alpha.1",
|
|
53
|
+
"@deepseek-ai/dsh-sandbox": "0.2.1-alpha.1",
|
|
54
|
+
"@deepseek-ai/dsh-session": "0.2.1-alpha.1",
|
|
55
|
+
"@deepseek-ai/dsh-session-projection": "0.2.1-alpha.1",
|
|
56
|
+
"@deepseek-ai/dsh-typert-protocol": "0.2.1-alpha.1",
|
|
57
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.2.1-alpha.1",
|
|
58
|
+
"@deepseek-ai/dsh-user-approval": "0.2.1-alpha.1",
|
|
59
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.1"
|
|
66
60
|
},
|
|
67
61
|
"dependencies": {
|
|
68
62
|
"zod": "^4.4.3",
|
|
69
|
-
"@deepseek-ai/schemastery": "~3.18.
|
|
63
|
+
"@deepseek-ai/schemastery": "~3.18.5-alpha.1"
|
|
70
64
|
},
|
|
71
65
|
"devDependencies": {
|
|
72
|
-
"@deepseek-ai/dsh-
|
|
73
|
-
"@deepseek-ai/dsh-
|
|
74
|
-
"@deepseek-ai/dsh-
|
|
75
|
-
"@deepseek-ai/dsh-
|
|
76
|
-
"@deepseek-ai/dsh-sandbox-policy": "0.2.
|
|
77
|
-
"@deepseek-ai/dsh-
|
|
78
|
-
"@deepseek-ai/dsh-typert-protocol": "0.2.
|
|
79
|
-
"@deepseek-ai/cordis": "~4.0.
|
|
80
|
-
"@deepseek-ai/dsh-settings": "0.2.
|
|
81
|
-
"@deepseek-ai/dsh-session": "0.2.
|
|
82
|
-
"@deepseek-ai/dsh-user-approval": "0.2.0-rc.2"
|
|
66
|
+
"@deepseek-ai/dsh-shell": "0.2.1-alpha.1",
|
|
67
|
+
"@deepseek-ai/dsh-commands": "0.2.1-alpha.1",
|
|
68
|
+
"@deepseek-ai/dsh-sandbox": "0.2.1-alpha.1",
|
|
69
|
+
"@deepseek-ai/dsh-session": "0.2.1-alpha.1",
|
|
70
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.2.1-alpha.1",
|
|
71
|
+
"@deepseek-ai/dsh-user-approval": "0.2.1-alpha.1",
|
|
72
|
+
"@deepseek-ai/dsh-typert-protocol": "0.2.1-alpha.1",
|
|
73
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.1",
|
|
74
|
+
"@deepseek-ai/dsh-settings": "0.2.1-alpha.1",
|
|
75
|
+
"@deepseek-ai/dsh-session-projection": "0.2.1-alpha.1"
|
|
83
76
|
}
|
|
84
77
|
}
|
package/lib/invariant.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import "./index.js";
|
|
2
|
-
//#region lib/types/invariant.js
|
|
3
|
-
/** Package-owned permission-preset event invariants. @module @deepseek-ai/dsh-permission-presets/invariant */
|
|
4
|
-
const PACKAGE_NAME = "@deepseek-ai/dsh-permission-presets";
|
|
5
|
-
/** Cordis companion plugin name. */
|
|
6
|
-
const name = "permission-presets-invariant";
|
|
7
|
-
/** Service required before the companion can reserve package ownership. */
|
|
8
|
-
const inject = ["invariants"];
|
|
9
|
-
/** Validate the package-owned event fields and ignore unrelated events. */
|
|
10
|
-
function validateEvent(ctx, event, fail) {
|
|
11
|
-
if (event.type === "permission/preset" && event.data.preset !== "auto" && !ctx.permissionPresets.names.includes(event.data.preset)) fail(`permission/preset names unknown preset ${JSON.stringify(event.data.preset)}`);
|
|
12
|
-
}
|
|
13
|
-
/** Install validation that loaded and newly appended preset events remain resolvable. */
|
|
14
|
-
const install = Object.assign((ctx, fail) => {
|
|
15
|
-
for (const session of ctx.sessions.list()) for (const event of session.snapshotEvents()) validateEvent(ctx, event, fail);
|
|
16
|
-
ctx.on("internal/dispatch", (_mode, eventName, args) => {
|
|
17
|
-
if (eventName !== "session/event") return;
|
|
18
|
-
const event = args[1];
|
|
19
|
-
validateEvent(ctx, event, fail);
|
|
20
|
-
}, { global: true });
|
|
21
|
-
}, { inject: ["permissionPresets", "sessions"] });
|
|
22
|
-
/**
|
|
23
|
-
* Register the permission invariant companion.
|
|
24
|
-
* @param ctx - Cordis context carrying the invariant service.
|
|
25
|
-
* @returns the installed registration's disposer after setup succeeds.
|
|
26
|
-
*/
|
|
27
|
-
const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
28
|
-
//#endregion
|
|
29
|
-
export { apply, inject, name };
|
package/lib/types/invariant.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/** Package-owned permission-preset event invariants. @module @deepseek-ai/dsh-permission-presets/invariant */
|
|
2
|
-
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
-
/** Cordis companion plugin name. */
|
|
4
|
-
export declare const name = "permission-presets-invariant";
|
|
5
|
-
/** Service required before the companion can reserve package ownership. */
|
|
6
|
-
export declare const inject: string[];
|
|
7
|
-
/**
|
|
8
|
-
* Register the permission invariant companion.
|
|
9
|
-
* @param ctx - Cordis context carrying the invariant service.
|
|
10
|
-
* @returns the installed registration's disposer after setup succeeds.
|
|
11
|
-
*/
|
|
12
|
-
export declare const apply: (ctx: Context) => Promise<() => void>;
|
|
13
|
-
//# sourceMappingURL=invariant.d.ts.map
|
package/lib/types/invariant.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/** Package-owned permission-preset event invariants. @module @deepseek-ai/dsh-permission-presets/invariant */
|
|
2
|
-
import { AUTO_PRESET } from "./index.js";
|
|
3
|
-
const PACKAGE_NAME = '@deepseek-ai/dsh-permission-presets';
|
|
4
|
-
/** Cordis companion plugin name. */
|
|
5
|
-
export const name = 'permission-presets-invariant';
|
|
6
|
-
/** Service required before the companion can reserve package ownership. */
|
|
7
|
-
export const inject = ['invariants'];
|
|
8
|
-
/** Validate the package-owned event fields and ignore unrelated events. */
|
|
9
|
-
function validateEvent(ctx, event, fail) {
|
|
10
|
-
if (event.type === 'permission/preset'
|
|
11
|
-
&& event.data.preset !== AUTO_PRESET
|
|
12
|
-
&& !ctx.permissionPresets.names.includes(event.data.preset)) {
|
|
13
|
-
fail(`permission/preset names unknown preset ${JSON.stringify(event.data.preset)}`);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
/** Install validation that loaded and newly appended preset events remain resolvable. */
|
|
17
|
-
const install = Object.assign((ctx, fail) => {
|
|
18
|
-
for (const session of ctx.sessions.list()) {
|
|
19
|
-
// oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
|
|
20
|
-
for (const event of session.snapshotEvents())
|
|
21
|
-
validateEvent(ctx, event, fail);
|
|
22
|
-
}
|
|
23
|
-
ctx.on('internal/dispatch', (_mode, eventName, args) => {
|
|
24
|
-
if (eventName !== 'session/event')
|
|
25
|
-
return;
|
|
26
|
-
const event = args[1];
|
|
27
|
-
validateEvent(ctx, event, fail);
|
|
28
|
-
}, { global: true });
|
|
29
|
-
}, { inject: ['permissionPresets', 'sessions'] });
|
|
30
|
-
/**
|
|
31
|
-
* Register the permission invariant companion.
|
|
32
|
-
* @param ctx - Cordis context carrying the invariant service.
|
|
33
|
-
* @returns the installed registration's disposer after setup succeeds.
|
|
34
|
-
*/
|
|
35
|
-
export const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
36
|
-
//# sourceMappingURL=invariant.js.map
|