@deepseek-ai/dsh-permission-presets 0.2.2-rc.4 → 0.2.3-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/lib/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Service } from "@deepseek-ai/cordis";
2
- import { CommandDefinitionId } from "@deepseek-ai/dsh-commands/brand";
2
+ import { brandString } from "@deepseek-ai/dsh-brand";
3
3
  import z from "@deepseek-ai/schemastery";
4
4
  import { z as z$1 } from "zod";
5
- import { Remote, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
5
+ import { Remote, RemoteError, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
6
6
  import { SANDBOX_MODES, setSandboxMode } from "@deepseek-ai/dsh-sandbox-policy";
7
7
  import { APPROVAL_POLICIES, setApprovalPolicy } from "@deepseek-ai/dsh-user-approval";
8
8
  //#region lib/types/index.js
@@ -114,10 +114,12 @@ let PermissionPresetService = (() => {
114
114
  let _classSuper = TypertRemoteService;
115
115
  let _instanceExtraInitializers = [];
116
116
  let _catalog_decorators;
117
+ let _setPreset_decorators;
117
118
  return class PermissionPresetService extends _classSuper {
118
119
  static {
119
120
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
120
121
  _catalog_decorators = [Remote("catalog")];
122
+ _setPreset_decorators = [Remote({ name: "set" })];
121
123
  __esDecorate(this, null, _catalog_decorators, {
122
124
  kind: "method",
123
125
  name: "catalog",
@@ -129,6 +131,17 @@ let PermissionPresetService = (() => {
129
131
  },
130
132
  metadata: _metadata
131
133
  }, null, _instanceExtraInitializers);
134
+ __esDecorate(this, null, _setPreset_decorators, {
135
+ kind: "method",
136
+ name: "setPreset",
137
+ static: false,
138
+ private: false,
139
+ access: {
140
+ has: (obj) => "setPreset" in obj,
141
+ get: (obj) => obj.setPreset
142
+ },
143
+ metadata: _metadata
144
+ }, null, _instanceExtraInitializers);
132
145
  if (_metadata) Object.defineProperty(this, Symbol.metadata, {
133
146
  enumerable: true,
134
147
  configurable: true,
@@ -211,7 +224,7 @@ let PermissionPresetService = (() => {
211
224
  for (const agent of ctx.agents.list()) this.pinInitialPermission(agent.session);
212
225
  ctx.inject(["commands"], (commandCtx) => {
213
226
  commandCtx.commands.register({
214
- definitionId: CommandDefinitionId("@deepseek-ai/dsh-permission-presets"),
227
+ definitionId: brandString("@deepseek-ai/dsh-permission-presets"),
215
228
  name: "permission",
216
229
  description: "Switch the permission preset (sandbox mode + approval policy)",
217
230
  input: { hint: "<preset>" },
@@ -256,6 +269,63 @@ let PermissionPresetService = (() => {
256
269
  };
257
270
  }
258
271
  /**
272
+ * Switch one live Session to another preset, opened as a Remote call so a
273
+ * caller's Session access is decided before any preset is resolved or any
274
+ * knob is written. The call's `session` resource is the Session named by
275
+ * `request.sessionId`, per {@link PermissionPresetSetRequest}; the session
276
+ * controller's resolver names it.
277
+ *
278
+ * The switch appends `permission/preset` and the changed knob events to the
279
+ * Session log, so persisted-only Sessions are refused: they have no live log
280
+ * to append to.
281
+ * @param request - live target Session and the preset name to switch to.
282
+ * @returns the Session's current selection after the switch, read the way
283
+ * the client reads it: the recorded preset while its bundle still matches,
284
+ * otherwise the first preset whose bundle matches, otherwise `custom`.
285
+ * @throws {RemoteError} `gateway/bad-request` for an unknown preset name or a
286
+ * Session this process does not hold live; neither call writes.
287
+ */
288
+ setPreset(request) {
289
+ return this.switchPreset(request, (session, policy) => {
290
+ setApprovalPolicy(session, policy);
291
+ });
292
+ }
293
+ /**
294
+ * Apply one preset switch, letting the caller own the approval write.
295
+ *
296
+ * A Remote parameter cannot carry an Agent, so a caller that holds the
297
+ * target's Agent supplies a setter routing the approval knob through the
298
+ * approval service; that caller then keeps the model-visible policy notice
299
+ * its own switch produces. {@link setPreset} writes the knob directly.
300
+ * @param request - live target Session and the preset name to switch to.
301
+ * @param setApproval - writes the approval policy on the resolved Session.
302
+ * @returns the Session's current selection after the switch.
303
+ * @throws {RemoteError} `gateway/bad-request` for an unknown preset name or a
304
+ * Session this process does not hold live; neither call writes.
305
+ */
306
+ switchPreset(request, setApproval) {
307
+ const session = this.callSession(request.sessionId);
308
+ try {
309
+ this.apply(session, request.preset, (policy) => {
310
+ setApproval(session, policy);
311
+ });
312
+ } catch (error) {
313
+ throw new RemoteError("gateway/bad-request", error instanceof Error ? error.message : String(error), {}, { cause: error });
314
+ }
315
+ return { currentValue: this.current(session) };
316
+ }
317
+ /**
318
+ * Read the live Session one Remote call names.
319
+ * @param sessionId - id carried by the request.
320
+ * @returns the live Session.
321
+ * @throws {RemoteError} `gateway/bad-request` when no live Session carries the id.
322
+ */
323
+ callSession(sessionId) {
324
+ const session = this.ctx.sessions.get(sessionId);
325
+ if (session === void 0) throw new RemoteError("gateway/bad-request", `permission: no live session "${sessionId}"`, {});
326
+ return session;
327
+ }
328
+ /**
259
329
  * Publish the fixed current-session Auto preset for the calling
260
330
  * integration's effect lifetime.
261
331
  * @param admit - synchronous gate run before live Auto selection or restore.
@@ -17,6 +17,20 @@ const _deepseek_ai_dsh_permission_presets_permissionPresets_catalog_result$schem
17
17
  })).describe('Configured presets eligible as defaults for future sessions.'),
18
18
  'defaultPreset': z.string().describe('Effective default when the Config field is omitted.'),
19
19
  }))
20
+ let _deepseek_ai_dsh_permission_presets_permissionPresets_set_parameter_0$schema$value
21
+ const _deepseek_ai_dsh_permission_presets_permissionPresets_set_parameter_0$schema = () => (_deepseek_ai_dsh_permission_presets_permissionPresets_set_parameter_0$schema$value ??= z.object({
22
+ 'sessionId': z.string().readonly().describe('Live Session whose knobs the switch writes.'),
23
+ 'preset': z.string().readonly().describe('Preset name to switch to; an unknown name refuses the call without writing.'),
24
+ }))
25
+ let _deepseek_ai_dsh_permission_presets_permissionPresets_set_result$schema$value
26
+ const _deepseek_ai_dsh_permission_presets_permissionPresets_set_result$schema = () => (_deepseek_ai_dsh_permission_presets_permissionPresets_set_result$schema$value ??= z.object({
27
+ 'currentValue': z.string().describe('The effective current value: a configured preset key, `auto`, or `custom`.'),
28
+ }))
29
+ let _deepseek_ai_dsh_permission_presets_permissionPresets_set_parameter_0_strict$schema$value
30
+ const _deepseek_ai_dsh_permission_presets_permissionPresets_set_parameter_0_strict$schema = () => (_deepseek_ai_dsh_permission_presets_permissionPresets_set_parameter_0_strict$schema$value ??= z.strictObject({
31
+ 'sessionId': z.string().readonly().describe('Live Session whose knobs the switch writes.'),
32
+ 'preset': z.string().readonly().describe('Preset name to switch to; an unknown name refuses the call without writing.'),
33
+ }))
20
34
 
21
35
  const $remote = createTypertRemoteInfo({
22
36
  package: '@deepseek-ai/dsh-permission-presets',
@@ -34,7 +48,40 @@ const $remote = createTypertRemoteInfo({
34
48
  description: 'every currently selectable preset in contribution order.',
35
49
  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
50
  },
37
- sourceLocation: {"file":"packages/interaction/permission-presets/src/index.ts","line":292,"column":3},
51
+ sourceLocation: {"file":"packages/interaction/permission-presets/src/index.ts","line":300,"column":3},
52
+ },
53
+ 'permissionPresets/set': {
54
+ service: 'permissionPresets',
55
+ description: 'Switch one live Session to another preset, opened as a Remote call so a caller\'s Session access is decided before any preset is resolved or any knob is written. The call\'s `session` resource is the Session named by `request.sessionId`, per {@link PermissionPresetSetRequest}; the session controller\'s resolver names it. The switch appends `permission/preset` and the changed knob events to the Session log, so persisted-only Sessions are refused: they have no live log to append to.',
56
+ implementation: 'setPreset',
57
+ invocation: { kind: 'direct' },
58
+ parameters: [
59
+ {
60
+ name: 'request',
61
+ description: 'live target Session and the preset name to switch to.',
62
+ source: 'json',
63
+ codec: {
64
+ mode: 'strict',
65
+ typeSymbol: '@deepseek-ai/dsh-permission-presets/client#PermissionPresetSetRequest',
66
+ create: _deepseek_ai_dsh_permission_presets_permissionPresets_set_parameter_0$schema,
67
+ jsonSchema: {"type":"object","properties":{"sessionId":{"type":"string","description":"Live Session whose knobs the switch writes."},"preset":{"type":"string","description":"Preset name to switch to; an unknown name refuses the call without writing."}},"required":["sessionId","preset"],"additionalProperties":true},
68
+ },
69
+ strictCodec: {
70
+ mode: 'strict',
71
+ typeSymbol: '@deepseek-ai/dsh-permission-presets/client#PermissionPresetSetRequest',
72
+ create: _deepseek_ai_dsh_permission_presets_permissionPresets_set_parameter_0_strict$schema,
73
+ jsonSchema: {"type":"object","properties":{"sessionId":{"type":"string","description":"Live Session whose knobs the switch writes."},"preset":{"type":"string","description":"Preset name to switch to; an unknown name refuses the call without writing."}},"required":["sessionId","preset"],"additionalProperties":false},
74
+ },
75
+ },
76
+ ],
77
+ result: {
78
+ mode: 'strict',
79
+ typeSymbol: '@deepseek-ai/dsh-permission-presets/client#PermissionSelection',
80
+ create: _deepseek_ai_dsh_permission_presets_permissionPresets_set_result$schema,
81
+ description: 'the Session\'s current selection after the switch, read the way the client reads it: the recorded preset while its bundle still matches, otherwise the first preset whose bundle matches, otherwise `custom`.',
82
+ jsonSchema: {"type":"object","properties":{"currentValue":{"type":"string","description":"The effective current value: a configured preset key, `auto`, or `custom`."}},"required":["currentValue"],"additionalProperties":true},
83
+ },
84
+ sourceLocation: {"file":"packages/interaction/permission-presets/src/index.ts","line":326,"column":3},
38
85
  },
39
86
  },
40
87
  }, z)
@@ -69,6 +116,13 @@ export const TYPERT = {
69
116
  "summary": "Read the complete process-level catalog exposed to current-session UI.",
70
117
  "jsDoc": "/**\n * Read the complete process-level catalog exposed to current-session UI.\n * @returns every currently selectable preset in contribution order.\n */"
71
118
  },
119
+ {
120
+ "kind": "method",
121
+ "name": "setPreset",
122
+ "signature": "@Remote({ name: 'set' }) setPreset(request: PermissionPresetSetRequest): PermissionSelection",
123
+ "summary": "Switch one live Session to another preset, opened as a Remote call so a caller's Session access is decided before any preset is resolved or any knob is written.",
124
+ "jsDoc": "/**\n * Switch one live Session to another preset, opened as a Remote call so a\n * caller's Session access is decided before any preset is resolved or any\n * knob is written. The call's `session` resource is the Session named by\n * `request.sessionId`, per {@link PermissionPresetSetRequest}; the session\n * controller's resolver names it.\n *\n * The switch appends `permission/preset` and the changed knob events to the\n * Session log, so persisted-only Sessions are refused: they have no live log\n * to append to.\n * @param request - live target Session and the preset name to switch to.\n * @returns the Session's current selection after the switch, read the way\n * the client reads it: the recorded preset while its bundle still matches,\n * otherwise the first preset whose bundle matches, otherwise `custom`.\n * @throws {RemoteError} `gateway/bad-request` for an unknown preset name or a\n * Session this process does not hold live; neither call writes.\n */"
125
+ },
72
126
  {
73
127
  "kind": "method",
74
128
  "name": "registerAuto",
@@ -113,6 +167,18 @@ export const TYPERT = {
113
167
  }
114
168
  ],
115
169
  "types": [
170
+ {
171
+ "name": "ActionCardDecision",
172
+ "declaration": "export interface ActionCardDecision {\n readonly cardId: ActionCardId;\n readonly action: string;\n readonly phase: string;\n readonly data?: ActionCardFields | undefined;\n}"
173
+ },
174
+ {
175
+ "name": "ActionCardFields",
176
+ "declaration": "export type ActionCardFields = Readonly<Record<string, JsonValue>>;"
177
+ },
178
+ {
179
+ "name": "ActionCardId",
180
+ "declaration": "export type ActionCardId = Branded<'ActionCardId'>;"
181
+ },
116
182
  {
117
183
  "name": "AfterScheduleRecord",
118
184
  "declaration": "export interface AfterScheduleRecord {\n readonly id: ScheduleId;\n readonly kind: 'after';\n readonly title: string;\n readonly prompt: string;\n readonly afterSeconds: number;\n readonly scheduledAt: string;\n}"
@@ -319,7 +385,7 @@ export const TYPERT = {
319
385
  },
320
386
  {
321
387
  "name": "JobOutcome",
322
- "declaration": "export interface JobOutcome {\n status: 'completed' | 'killed' | 'failed';\n detail?: string;\n result?: string;\n}"
388
+ "declaration": "export interface JobOutcome {\n status: 'completed' | 'killed' | 'failed';\n detail?: string;\n exitCode?: number;\n result?: string;\n}"
323
389
  },
324
390
  {
325
391
  "name": "JobRegisteredData",
@@ -427,7 +493,7 @@ export const TYPERT = {
427
493
  },
428
494
  {
429
495
  "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 'tool-registry': { kind: 'tool-registry'; };\n 'action-cards': { kind: 'action-cards'; through: SessionSeq; } & ContextFormed;\n 'runtime-context': { kind: 'runtime-context'; } & ContextFormed;\n 'team-message': TeamMessageSource;\n 'working-directory': { kind: 'working-directory'; };\n 'user-approval': { kind: 'user-approval'; } & ContextFormed;\n 'agent-message': AgentMessageSource;\n 'subagent-settled': SubagentSettledMessageSource;\n 'user-rpc': { kind: 'user'; rpcId: SessionRequestId; clientTimeZone?: string; principal?: Principal; };\n 'retry-rpc': { kind: 'retry'; rpcId: SessionRequestId; clientTimeZone?: string; principal?: Principal; };\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 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}"
496
+ "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 'skill-invocation': SkillInvocationSource;\n 'working-directory': { kind: 'working-directory'; };\n 'action-cards': { kind: 'action-cards'; through: SessionSeq; } & ContextFormed;\n 'tool-registry': { kind: 'tool-registry'; };\n 'runtime-context': { kind: 'runtime-context'; } & ContextFormed;\n 'team-message': TeamMessageSource;\n 'user-approval': { kind: 'user-approval'; } & ContextFormed;\n 'agent-message': AgentMessageSource;\n 'subagent-settled': SubagentSettledMessageSource;\n 'user-rpc': { kind: 'user'; rpcId: SessionRequestId; clientTimeZone?: string; principal?: Principal; };\n 'retry-rpc': { kind: 'retry'; rpcId: SessionRequestId; clientTimeZone?: string; principal?: Principal; };\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 'cua-held-inputs': { kind: 'cua-held-inputs'; } & Extract<ContextFormed, { form: 'notice'; }>;\n 'cua-inputs-released': { kind: 'cua-inputs-released'; } & Extract<ContextFormed, { form: 'notice'; }>;\n goal: GoalMessageSource;\n 'plan-mode': { kind: 'plan-mode'; } & ContextFormed;\n schedule: { kind: 'schedule'; } & ContextFormed;\n 'session-reference': SessionReferenceSource;\n 'timeline-priority': { kind: 'timeline-priority'; form: 'notice'; summary: string; };\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
497
  },
432
498
  {
433
499
  "name": "ModelMessageSource",
@@ -453,6 +519,14 @@ export const TYPERT = {
453
519
  "name": "PermissionCatalog",
454
520
  "declaration": "export interface PermissionCatalog {\n options: PresetOption[];\n defaultOptions: PresetOption[];\n defaultPreset: string;\n}"
455
521
  },
522
+ {
523
+ "name": "PermissionPresetSetRequest",
524
+ "declaration": "export interface PermissionPresetSetRequest {\n readonly sessionId: SessionId;\n readonly preset: string;\n}"
525
+ },
526
+ {
527
+ "name": "PermissionSelection",
528
+ "declaration": "export interface PermissionSelection {\n currentValue: string;\n}"
529
+ },
456
530
  {
457
531
  "name": "PresetOption",
458
532
  "declaration": "export interface PresetOption {\n value: string;\n name: string;\n description?: string;\n}"
@@ -543,7 +617,7 @@ export const TYPERT = {
543
617
  },
544
618
  {
545
619
  "name": "SessionEventMap",
546
- "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 'team/mode': { enabled: boolean; };\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 'working-directory/change': { cwd: string; };\n 'image/offload': { targets: ImageOffloadTarget[]; };\n 'session/title': SessionTitleEventData;\n 'todo/write': { todos: TodoItem[]; };\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 '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 'permission/preset': { preset: string; };\n 'subagent/descriptor': SubagentDescriptorData;\n 'subagent/catalog': SubagentCatalogEvent;\n 'job/registered': JobRegisteredData;\n 'job/settled': JobSettledData;\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 'goal/change': GoalChangeMeta;\n 'feedback/message-put': MessageFeedbackPut;\n 'feedback/message-delete': MessageFeedbackDelete;\n 'plan/mode': { active: boolean; };\n 'schedule/change': ScheduleChange;\n 'session-log-deepseek/delivery-accepted': { sessionId: import('@deepseek-ai/dsh-session/types').SessionId; sessionFormatVersion?: number; throughSeq: import('@deepseek-ai/dsh-session/types').SessionSeq; };\n 'subagent/model-selection-policy': { allowedModels: AllowedModelRoute[]; };\n 'workspace/changes': { turn: number; };\n}"
620
+ "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 'working-directory/change': { cwd: string; };\n 'workspace-root/change': { cwd: string; };\n 'sandbox/mode': { mode: SandboxMode; source?: 'delegation'; };\n 'action-cards/decision': ActionCardDecision;\n 'agent-preset/selected': { agentPreset: string; };\n 'team/mode': { enabled: boolean; };\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 'image/offload': { targets: ImageOffloadTarget[]; };\n 'session/title': SessionTitleEventData;\n 'todo/write': { todos: TodoItem[]; };\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 '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 'permission/preset': { preset: string; };\n 'subagent/descriptor': SubagentDescriptorData;\n 'subagent/catalog': SubagentCatalogEvent;\n 'job/registered': JobRegisteredData;\n 'job/settled': JobSettledData;\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 'goal/change': GoalChangeMeta;\n 'feedback/message-put': MessageFeedbackPut;\n 'feedback/message-delete': MessageFeedbackDelete;\n 'plan/mode': { active: boolean; };\n 'schedule/change': ScheduleChange;\n 'session-log-deepseek/delivery-accepted': { sessionId: import('@deepseek-ai/dsh-session/types').SessionId; sessionFormatVersion?: number; throughSeq: import('@deepseek-ai/dsh-session/types').SessionSeq; };\n 'subagent/model-selection-policy': { allowedModels: AllowedModelRoute[]; };\n 'workspace/changes': { turn: number; };\n}"
547
621
  },
548
622
  {
549
623
  "name": "SessionEventType",
@@ -575,7 +649,7 @@ export const TYPERT = {
575
649
  },
576
650
  {
577
651
  "name": "SessionSurface",
578
- "declaration": "export interface SessionSurface {\n readonly nodes: readonly SessionSeq[];\n readonly replaceGeneration: number;\n readonly contentGeneration: number;\n}"
652
+ "declaration": "export interface SessionSurface {\n readonly nodes: readonly SessionSeq[];\n readonly systemNodes: readonly SystemSurfaceNode[];\n readonly replaceGeneration: number;\n readonly contentGeneration: number;\n}"
579
653
  },
580
654
  {
581
655
  "name": "SessionTitleEventData",
@@ -651,12 +725,20 @@ export const TYPERT = {
651
725
  },
652
726
  {
653
727
  "name": "SystemPromptMessageSource",
654
- "declaration": "export interface SystemPromptMessageSource {\n kind: 'system-prompt';\n}"
728
+ "declaration": "export interface SystemPromptMessageSource {\n kind: 'system-prompt';\n readonly complete?: true;\n readonly reset?: true;\n readonly sections?: readonly SystemPromptSectionState[];\n}"
729
+ },
730
+ {
731
+ "name": "SystemPromptSectionState",
732
+ "declaration": "export type SystemPromptSectionState = { readonly name: string; readonly noticeIndex?: readonly number[]; } & ({ readonly state: 'active'; readonly order: number; readonly contentIndex: number; } | { readonly state: 'retired'; readonly contentIndex?: never; });"
655
733
  },
656
734
  {
657
735
  "name": "SystemPromptUpdate",
658
736
  "declaration": "export type SystemPromptUpdate = 'in-history';"
659
737
  },
738
+ {
739
+ "name": "SystemSurfaceNode",
740
+ "declaration": "export interface SystemSurfaceNode {\n readonly seq: SessionSeq;\n readonly isEmpty: boolean;\n}"
741
+ },
660
742
  {
661
743
  "name": "TeamId",
662
744
  "declaration": "export type TeamId = Branded<'TeamId'>;"
@@ -4,14 +4,16 @@ import type {
4
4
  TypertRemoteInfo,
5
5
  TypertRemoteMethod,
6
6
  } from '@deepseek-ai/dsh-typert-protocol'
7
- import type { PermissionCatalog } from '@deepseek-ai/dsh-permission-presets/client'
7
+ import type { PermissionCatalog, PermissionPresetSetRequest, PermissionSelection } from '@deepseek-ai/dsh-permission-presets/client'
8
8
 
9
9
  declare module '@deepseek-ai/dsh-typert-protocol' {
10
10
  interface TypertRemoteNamespace$7065726d697373696f6e50726573657473 {
11
11
  catalog: () => Promise<RemoteResult<PermissionCatalog>>
12
+ set: (request: PermissionPresetSetRequest) => Promise<RemoteResult<PermissionSelection>>
12
13
  }
13
14
  interface TypertRemoteMap {
14
15
  'permissionPresets/catalog': () => Promise<RemoteResult<PermissionCatalog>>
16
+ 'permissionPresets/set': (request: PermissionPresetSetRequest) => Promise<RemoteResult<PermissionSelection>>
15
17
  }
16
18
  interface TypertRemoteNamespaceMap {
17
19
  'permissionPresets': TypertRemoteNamespace$7065726d697373696f6e50726573657473
@@ -20,6 +22,7 @@ declare module '@deepseek-ai/dsh-typert-protocol' {
20
22
 
21
23
  export declare const TYPERT_REMOTE: TypertRemoteInfo<{
22
24
  readonly 'permissionPresets/catalog': TypertRemoteMethod<{ }, PermissionCatalog>
25
+ readonly 'permissionPresets/set': TypertRemoteMethod<{ readonly 'request': PermissionPresetSetRequest }, PermissionSelection>
23
26
  }>
24
27
  export default TYPERT_REMOTE
25
28
  //# sourceMappingURL=typert.remote-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typert.remote-client.d.ts","names":["catalog"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;IAmSEA,O;;;IAAAA,2B","ignoreList":[]}
1
+ {"version":3,"file":"typert.remote-client.d.ts","names":["catalog","set"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;IA2SEA,O;IA0BAC,G;;;IA1BAD,2B;IA0BAC,uB","ignoreList":[]}
@@ -17,6 +17,20 @@ const _deepseek_ai_dsh_permission_presets_permissionPresets_catalog_result$schem
17
17
  })).describe('Configured presets eligible as defaults for future sessions.'),
18
18
  'defaultPreset': z.string().describe('Effective default when the Config field is omitted.'),
19
19
  }))
20
+ let _deepseek_ai_dsh_permission_presets_permissionPresets_set_parameter_0$schema$value
21
+ const _deepseek_ai_dsh_permission_presets_permissionPresets_set_parameter_0$schema = () => (_deepseek_ai_dsh_permission_presets_permissionPresets_set_parameter_0$schema$value ??= z.object({
22
+ 'sessionId': z.string().readonly().describe('Live Session whose knobs the switch writes.'),
23
+ 'preset': z.string().readonly().describe('Preset name to switch to; an unknown name refuses the call without writing.'),
24
+ }))
25
+ let _deepseek_ai_dsh_permission_presets_permissionPresets_set_result$schema$value
26
+ const _deepseek_ai_dsh_permission_presets_permissionPresets_set_result$schema = () => (_deepseek_ai_dsh_permission_presets_permissionPresets_set_result$schema$value ??= z.object({
27
+ 'currentValue': z.string().describe('The effective current value: a configured preset key, `auto`, or `custom`.'),
28
+ }))
29
+ let _deepseek_ai_dsh_permission_presets_permissionPresets_set_parameter_0_strict$schema$value
30
+ const _deepseek_ai_dsh_permission_presets_permissionPresets_set_parameter_0_strict$schema = () => (_deepseek_ai_dsh_permission_presets_permissionPresets_set_parameter_0_strict$schema$value ??= z.strictObject({
31
+ 'sessionId': z.string().readonly().describe('Live Session whose knobs the switch writes.'),
32
+ 'preset': z.string().readonly().describe('Preset name to switch to; an unknown name refuses the call without writing.'),
33
+ }))
20
34
 
21
35
  export const TYPERT_REMOTE = createTypertRemoteInfo({
22
36
  package: '@deepseek-ai/dsh-permission-presets',
@@ -34,7 +48,40 @@ export const TYPERT_REMOTE = createTypertRemoteInfo({
34
48
  description: 'every currently selectable preset in contribution order.',
35
49
  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
50
  },
37
- sourceLocation: {"file":"packages/interaction/permission-presets/src/index.ts","line":292,"column":3},
51
+ sourceLocation: {"file":"packages/interaction/permission-presets/src/index.ts","line":300,"column":3},
52
+ },
53
+ 'permissionPresets/set': {
54
+ service: 'permissionPresets',
55
+ description: 'Switch one live Session to another preset, opened as a Remote call so a caller\'s Session access is decided before any preset is resolved or any knob is written. The call\'s `session` resource is the Session named by `request.sessionId`, per {@link PermissionPresetSetRequest}; the session controller\'s resolver names it. The switch appends `permission/preset` and the changed knob events to the Session log, so persisted-only Sessions are refused: they have no live log to append to.',
56
+ implementation: 'setPreset',
57
+ invocation: { kind: 'direct' },
58
+ parameters: [
59
+ {
60
+ name: 'request',
61
+ description: 'live target Session and the preset name to switch to.',
62
+ source: 'json',
63
+ codec: {
64
+ mode: 'strict',
65
+ typeSymbol: '@deepseek-ai/dsh-permission-presets/client#PermissionPresetSetRequest',
66
+ create: _deepseek_ai_dsh_permission_presets_permissionPresets_set_parameter_0$schema,
67
+ jsonSchema: {"type":"object","properties":{"sessionId":{"type":"string","description":"Live Session whose knobs the switch writes."},"preset":{"type":"string","description":"Preset name to switch to; an unknown name refuses the call without writing."}},"required":["sessionId","preset"],"additionalProperties":true},
68
+ },
69
+ strictCodec: {
70
+ mode: 'strict',
71
+ typeSymbol: '@deepseek-ai/dsh-permission-presets/client#PermissionPresetSetRequest',
72
+ create: _deepseek_ai_dsh_permission_presets_permissionPresets_set_parameter_0_strict$schema,
73
+ jsonSchema: {"type":"object","properties":{"sessionId":{"type":"string","description":"Live Session whose knobs the switch writes."},"preset":{"type":"string","description":"Preset name to switch to; an unknown name refuses the call without writing."}},"required":["sessionId","preset"],"additionalProperties":false},
74
+ },
75
+ },
76
+ ],
77
+ result: {
78
+ mode: 'strict',
79
+ typeSymbol: '@deepseek-ai/dsh-permission-presets/client#PermissionSelection',
80
+ create: _deepseek_ai_dsh_permission_presets_permissionPresets_set_result$schema,
81
+ description: 'the Session\'s current selection after the switch, read the way the client reads it: the recorded preset while its bundle still matches, otherwise the first preset whose bundle matches, otherwise `custom`.',
82
+ jsonSchema: {"type":"object","properties":{"currentValue":{"type":"string","description":"The effective current value: a configured preset key, `auto`, or `custom`."}},"required":["currentValue"],"additionalProperties":true},
83
+ },
84
+ sourceLocation: {"file":"packages/interaction/permission-presets/src/index.ts","line":326,"column":3},
38
85
  },
39
86
  },
40
87
  }, z)
@@ -5,7 +5,7 @@ import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
5
5
  import type { Session } from '@deepseek-ai/dsh-session';
6
6
  import type { SandboxMode } from '@deepseek-ai/dsh-sandbox';
7
7
  import type { ApprovalPolicy } from '@deepseek-ai/dsh-user-approval';
8
- import type { PermissionCatalog, PresetOption } from './types.ts';
8
+ import type { PermissionCatalog, PermissionPresetSetRequest, PermissionSelection, PresetOption } from './types.ts';
9
9
  export type * from './types.ts';
10
10
  declare module '@deepseek-ai/cordis' {
11
11
  interface Context {
@@ -127,6 +127,45 @@ export declare class PermissionPresetService extends TypertRemoteService {
127
127
  * @returns every currently selectable preset in contribution order.
128
128
  */
129
129
  catalog(): PermissionCatalog;
130
+ /**
131
+ * Switch one live Session to another preset, opened as a Remote call so a
132
+ * caller's Session access is decided before any preset is resolved or any
133
+ * knob is written. The call's `session` resource is the Session named by
134
+ * `request.sessionId`, per {@link PermissionPresetSetRequest}; the session
135
+ * controller's resolver names it.
136
+ *
137
+ * The switch appends `permission/preset` and the changed knob events to the
138
+ * Session log, so persisted-only Sessions are refused: they have no live log
139
+ * to append to.
140
+ * @param request - live target Session and the preset name to switch to.
141
+ * @returns the Session's current selection after the switch, read the way
142
+ * the client reads it: the recorded preset while its bundle still matches,
143
+ * otherwise the first preset whose bundle matches, otherwise `custom`.
144
+ * @throws {RemoteError} `gateway/bad-request` for an unknown preset name or a
145
+ * Session this process does not hold live; neither call writes.
146
+ */
147
+ setPreset(request: PermissionPresetSetRequest): PermissionSelection;
148
+ /**
149
+ * Apply one preset switch, letting the caller own the approval write.
150
+ *
151
+ * A Remote parameter cannot carry an Agent, so a caller that holds the
152
+ * target's Agent supplies a setter routing the approval knob through the
153
+ * approval service; that caller then keeps the model-visible policy notice
154
+ * its own switch produces. {@link setPreset} writes the knob directly.
155
+ * @param request - live target Session and the preset name to switch to.
156
+ * @param setApproval - writes the approval policy on the resolved Session.
157
+ * @returns the Session's current selection after the switch.
158
+ * @throws {RemoteError} `gateway/bad-request` for an unknown preset name or a
159
+ * Session this process does not hold live; neither call writes.
160
+ */
161
+ private switchPreset;
162
+ /**
163
+ * Read the live Session one Remote call names.
164
+ * @param sessionId - id carried by the request.
165
+ * @returns the live Session.
166
+ * @throws {RemoteError} `gateway/bad-request` when no live Session carries the id.
167
+ */
168
+ private callSession;
130
169
  /**
131
170
  * Publish the fixed current-session Auto preset for the calling
132
171
  * integration's effect lifetime.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAEnD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAEtD,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAExC,OAAO,EAAU,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AAC9E,OAAO,KAAK,EAA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YAAY,CAAC,KAAK,EAAE,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC;IAYpD;;;;OAIG;IACH,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,OAAO,CAAC,eAAe;IAOvB;;;;;;;;OAQG;IACH,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;IAIjC,kHAAkH;IAClH,OAAO,CAAC,MAAM;IAed;;;;;OAKG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAQjC;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY;IAQpC;;;;;OAKG;IACH,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAIzC,gFAAgF;IAChF,OAAO,CAAC,KAAK;IAiBb;;;;;;;;OAQG;IACH,OAAO,CAAC,oBAAoB;IA8B5B,+DAA+D;IAC/D,OAAO,CAAC,kBAAkB;IAe1B,8EAA8E;IAC9E,OAAO,CAAC,MAAM;CAIf;AAED,eAAe,uBAAuB,CAAA"}
@@ -33,10 +33,10 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
33
33
  done = true;
34
34
  };
35
35
  import { Service } from '@deepseek-ai/cordis';
36
- import { CommandDefinitionId } from '@deepseek-ai/dsh-commands/brand';
36
+ import { brandString } from '@deepseek-ai/dsh-brand';
37
37
  import z from '@deepseek-ai/schemastery';
38
38
  import { z as zod } from 'zod';
39
- import { Remote, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
39
+ import { Remote, RemoteError, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
40
40
  import { SANDBOX_MODES, setSandboxMode } from '@deepseek-ai/dsh-sandbox-policy';
41
41
  import { APPROVAL_POLICIES, setApprovalPolicy } from '@deepseek-ai/dsh-user-approval';
42
42
  /**
@@ -98,11 +98,14 @@ let PermissionPresetService = (() => {
98
98
  let _classSuper = TypertRemoteService;
99
99
  let _instanceExtraInitializers = [];
100
100
  let _catalog_decorators;
101
+ let _setPreset_decorators;
101
102
  return class PermissionPresetService extends _classSuper {
102
103
  static {
103
104
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
104
105
  _catalog_decorators = [Remote('catalog')];
106
+ _setPreset_decorators = [Remote({ name: 'set' })];
105
107
  __esDecorate(this, null, _catalog_decorators, { kind: "method", name: "catalog", static: false, private: false, access: { has: obj => "catalog" in obj, get: obj => obj.catalog }, metadata: _metadata }, null, _instanceExtraInitializers);
108
+ __esDecorate(this, null, _setPreset_decorators, { kind: "method", name: "setPreset", static: false, private: false, access: { has: obj => "setPreset" in obj, get: obj => obj.setPreset }, metadata: _metadata }, null, _instanceExtraInitializers);
106
109
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
107
110
  }
108
111
  // Inline schema call: the config catalog walks `static Config` statically.
@@ -180,7 +183,7 @@ let PermissionPresetService = (() => {
180
183
  // activates only when a command registry is composed.
181
184
  ctx.inject(['commands'], (commandCtx) => {
182
185
  commandCtx.commands.register({
183
- definitionId: CommandDefinitionId('@deepseek-ai/dsh-permission-presets'),
186
+ definitionId: brandString('@deepseek-ai/dsh-permission-presets'),
184
187
  name: 'permission',
185
188
  description: 'Switch the permission preset (sandbox mode + approval policy)',
186
189
  input: { hint: '<preset>' },
@@ -220,6 +223,64 @@ let PermissionPresetService = (() => {
220
223
  defaultPreset: this.defaultSettings().defaultPreset,
221
224
  };
222
225
  }
226
+ /**
227
+ * Switch one live Session to another preset, opened as a Remote call so a
228
+ * caller's Session access is decided before any preset is resolved or any
229
+ * knob is written. The call's `session` resource is the Session named by
230
+ * `request.sessionId`, per {@link PermissionPresetSetRequest}; the session
231
+ * controller's resolver names it.
232
+ *
233
+ * The switch appends `permission/preset` and the changed knob events to the
234
+ * Session log, so persisted-only Sessions are refused: they have no live log
235
+ * to append to.
236
+ * @param request - live target Session and the preset name to switch to.
237
+ * @returns the Session's current selection after the switch, read the way
238
+ * the client reads it: the recorded preset while its bundle still matches,
239
+ * otherwise the first preset whose bundle matches, otherwise `custom`.
240
+ * @throws {RemoteError} `gateway/bad-request` for an unknown preset name or a
241
+ * Session this process does not hold live; neither call writes.
242
+ */
243
+ setPreset(request) {
244
+ return this.switchPreset(request, (session, policy) => { setApprovalPolicy(session, policy); });
245
+ }
246
+ /**
247
+ * Apply one preset switch, letting the caller own the approval write.
248
+ *
249
+ * A Remote parameter cannot carry an Agent, so a caller that holds the
250
+ * target's Agent supplies a setter routing the approval knob through the
251
+ * approval service; that caller then keeps the model-visible policy notice
252
+ * its own switch produces. {@link setPreset} writes the knob directly.
253
+ * @param request - live target Session and the preset name to switch to.
254
+ * @param setApproval - writes the approval policy on the resolved Session.
255
+ * @returns the Session's current selection after the switch.
256
+ * @throws {RemoteError} `gateway/bad-request` for an unknown preset name or a
257
+ * Session this process does not hold live; neither call writes.
258
+ */
259
+ switchPreset(request, setApproval) {
260
+ const session = this.callSession(request.sessionId);
261
+ try {
262
+ this.apply(session, request.preset, (policy) => { setApproval(session, policy); });
263
+ }
264
+ catch (error) {
265
+ /* v8 ignore next -- the setters and the log append only throw Error subclasses, so `String` has nothing to render. */
266
+ const message = error instanceof Error ? error.message : String(error);
267
+ throw new RemoteError('gateway/bad-request', message, {}, { cause: error });
268
+ }
269
+ return { currentValue: this.current(session) };
270
+ }
271
+ /**
272
+ * Read the live Session one Remote call names.
273
+ * @param sessionId - id carried by the request.
274
+ * @returns the live Session.
275
+ * @throws {RemoteError} `gateway/bad-request` when no live Session carries the id.
276
+ */
277
+ callSession(sessionId) {
278
+ const session = this.ctx.sessions.get(sessionId);
279
+ if (session === undefined) {
280
+ throw new RemoteError('gateway/bad-request', `permission: no live session "${sessionId}"`, {});
281
+ }
282
+ return session;
283
+ }
223
284
  /**
224
285
  * Publish the fixed current-session Auto preset for the calling
225
286
  * integration's effect lifetime.
@@ -1 +1 @@
1
- {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ai/dsh-permission-presets/types
10
10
  */
11
+ import type { SessionId } from '@deepseek-ai/dsh-session/types';
11
12
  /** Presentation for an available preset or the derived `custom` current value. */
12
13
  export interface PresetOption {
13
14
  /** Stable option value: a configured preset key, live `auto`, or derived `custom`. */
@@ -34,6 +35,17 @@ export interface PermissionSelection {
34
35
  /** The effective current value: a configured preset key, `auto`, or `custom`. */
35
36
  currentValue: string;
36
37
  }
38
+ /**
39
+ * Request of the `permissionPresets.set` Remote: switch one live Session to
40
+ * another preset. The call's `session` resource is the Session named here, so
41
+ * the Gateway decides access before any preset is resolved or written.
42
+ */
43
+ export interface PermissionPresetSetRequest {
44
+ /** Live Session whose knobs the switch writes. */
45
+ readonly sessionId: SessionId;
46
+ /** Preset name to switch to; an unknown name refuses the call without writing. */
47
+ readonly preset: string;
48
+ }
37
49
  declare module '@deepseek-ai/cordis' {
38
50
  interface Events {
39
51
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,kFAAkF;AAClF,MAAM,WAAW,YAAY;IAC3B,sFAAsF;IACtF,KAAK,EAAE,MAAM,CAAA;IACb,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,qFAAqF;IACrF,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,gEAAgE;IAChE,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,mEAAmE;IACnE,cAAc,EAAE,YAAY,EAAE,CAAA;IAC9B,0DAA0D;IAC1D,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,8EAA8E;AAC9E,MAAM,WAAW,mBAAmB;IAClC,iFAAiF;IACjF,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,MAAM;QACd;;;;WAIG;QACH,oCAAoC,IAAI,IAAI,CAAA;KAC7C;CACF;AAED,OAAO,QAAQ,2CAA2C,CAAC;IACzD,UAAU,oBAAoB;QAC5B;;;;;;WAMG;QACH,WAAW,EAAE,mBAAmB,CAAA;KACjC;CACF"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAE/D,kFAAkF;AAClF,MAAM,WAAW,YAAY;IAC3B,sFAAsF;IACtF,KAAK,EAAE,MAAM,CAAA;IACb,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,qFAAqF;IACrF,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,gEAAgE;IAChE,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,mEAAmE;IACnE,cAAc,EAAE,YAAY,EAAE,CAAA;IAC9B,0DAA0D;IAC1D,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,8EAA8E;AAC9E,MAAM,WAAW,mBAAmB;IAClC,iFAAiF;IACjF,YAAY,EAAE,MAAM,CAAA;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC,kDAAkD;IAClD,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAC7B,kFAAkF;IAClF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,MAAM;QACd;;;;WAIG;QACH,oCAAoC,IAAI,IAAI,CAAA;KAC7C;CACF;AAED,OAAO,QAAQ,2CAA2C,CAAC;IACzD,UAAU,oBAAoB;QAC5B;;;;;;WAMG;QACH,WAAW,EAAE,mBAAmB,CAAA;KACjC;CACF"}
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.2-rc.4",
4
+ "version": "0.2.3-alpha.1",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -54,33 +54,34 @@
54
54
  ],
55
55
  "license": "MIT",
56
56
  "peerDependencies": {
57
- "@deepseek-ai/dsh-agent": "0.2.2-rc.4",
58
- "@deepseek-ai/dsh-shell": "0.2.2-rc.4",
59
- "@deepseek-ai/dsh-commands": "0.2.2-rc.4",
60
- "@deepseek-ai/dsh-sandbox": "0.2.2-rc.4",
61
- "@deepseek-ai/dsh-sandbox-policy": "0.2.2-rc.4",
62
- "@deepseek-ai/dsh-session": "0.2.2-rc.4",
63
- "@deepseek-ai/dsh-session-projection": "0.2.2-rc.4",
64
- "@deepseek-ai/dsh-typert-protocol": "0.2.2-rc.4",
65
- "@deepseek-ai/dsh-user-approval": "0.2.2-rc.4",
57
+ "@deepseek-ai/dsh-agent": "0.2.3-alpha.1",
58
+ "@deepseek-ai/dsh-shell": "0.2.3-alpha.1",
59
+ "@deepseek-ai/dsh-commands": "0.2.3-alpha.1",
60
+ "@deepseek-ai/dsh-sandbox": "0.2.3-alpha.1",
61
+ "@deepseek-ai/dsh-sandbox-policy": "0.2.3-alpha.1",
62
+ "@deepseek-ai/dsh-session": "0.2.3-alpha.1",
63
+ "@deepseek-ai/dsh-session-projection": "0.2.3-alpha.1",
64
+ "@deepseek-ai/dsh-typert-protocol": "0.2.3-alpha.1",
65
+ "@deepseek-ai/dsh-user-approval": "0.2.3-alpha.1",
66
66
  "@deepseek-ai/cordis": "~4.1.0"
67
67
  },
68
68
  "dependencies": {
69
+ "@deepseek-ai/dsh-brand": "0.2.3-alpha.1",
69
70
  "@deepseek-ai/schemastery": "~3.19.0",
70
71
  "zod": "4.6.6"
71
72
  },
72
73
  "devDependencies": {
73
- "@deepseek-ai/dsh-agent": "0.2.2-rc.4",
74
- "@deepseek-ai/dsh-shell": "0.2.2-rc.4",
75
- "@deepseek-ai/dsh-commands": "0.2.2-rc.4",
76
- "@deepseek-ai/dsh-sandbox": "0.2.2-rc.4",
77
- "@deepseek-ai/dsh-sandbox-policy": "0.2.2-rc.4",
78
- "@deepseek-ai/dsh-session": "0.2.2-rc.4",
79
- "@deepseek-ai/dsh-session-projection": "0.2.2-rc.4",
80
- "@deepseek-ai/dsh-typert-protocol": "0.2.2-rc.4",
81
- "@deepseek-ai/dsh-user-approval": "0.2.2-rc.4",
74
+ "@deepseek-ai/dsh-agent": "0.2.3-alpha.1",
75
+ "@deepseek-ai/dsh-shell": "0.2.3-alpha.1",
76
+ "@deepseek-ai/dsh-commands": "0.2.3-alpha.1",
77
+ "@deepseek-ai/dsh-sandbox": "0.2.3-alpha.1",
78
+ "@deepseek-ai/dsh-sandbox-policy": "0.2.3-alpha.1",
79
+ "@deepseek-ai/dsh-session": "0.2.3-alpha.1",
80
+ "@deepseek-ai/dsh-session-projection": "0.2.3-alpha.1",
81
+ "@deepseek-ai/dsh-typert-protocol": "0.2.3-alpha.1",
82
+ "@deepseek-ai/dsh-user-approval": "0.2.3-alpha.1",
82
83
  "@deepseek-ai/cordis": "~4.1.0",
83
- "@deepseek-ai/dsh-settings": "0.2.2-rc.4",
84
- "@deepseek-ai/dsh-agent-loop-testkit": "0.2.2-rc.4"
84
+ "@deepseek-ai/dsh-settings": "0.2.3-alpha.1",
85
+ "@deepseek-ai/dsh-agent-loop-testkit": "0.2.3-alpha.1"
85
86
  }
86
87
  }
package/src/index.ts CHANGED
@@ -7,7 +7,9 @@
7
7
  * publish one fixed, current-session-only preset with a synchronous admission
8
8
  * check; settings defaults remain limited to the configured table. The read
9
9
  * side exposes a process catalog plus the current-value-only `permissions`
10
- * Session projection; the write side ships as the `/permission` command.
10
+ * Session projection; the write side ships as the `/permission` command and
11
+ * the `set` Remote, whose Session resource the session controller's resolver
12
+ * names from `request.sessionId`.
11
13
  *
12
14
  * @module dsh-permission-presets
13
15
  */
@@ -17,10 +19,11 @@ import type {} from '@deepseek-ai/dsh-agent'
17
19
  import type { Volatile } from '@deepseek-ai/cordis'
18
20
 
19
21
  import { Context, Service } from '@deepseek-ai/cordis'
20
- import { CommandDefinitionId } from '@deepseek-ai/dsh-commands/brand'
22
+ import { brandString } from '@deepseek-ai/dsh-brand'
23
+ import type { CommandDefinitionId } from '@deepseek-ai/dsh-commands/types'
21
24
  import z from '@deepseek-ai/schemastery'
22
25
  import { z as zod } from 'zod'
23
- import { Remote, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol'
26
+ import { Remote, RemoteError, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol'
24
27
  import type { Session, SessionEvent } from '@deepseek-ai/dsh-session'
25
28
  import type { SandboxMode } from '@deepseek-ai/dsh-sandbox'
26
29
  import { SANDBOX_MODES, setSandboxMode } from '@deepseek-ai/dsh-sandbox-policy'
@@ -32,7 +35,12 @@ import { APPROVAL_POLICIES, setApprovalPolicy } from '@deepseek-ai/dsh-user-appr
32
35
  // Type-only: resolves the required projection service and optional settings/command children.
33
36
  import type { ProjectionHandle } from '@deepseek-ai/dsh-session-projection'
34
37
  import type {} from '@deepseek-ai/dsh-commands'
35
- import type { PermissionCatalog, PermissionSelection, PresetOption } from './types.ts'
38
+ import type {
39
+ PermissionCatalog,
40
+ PermissionPresetSetRequest,
41
+ PermissionSelection,
42
+ PresetOption,
43
+ } from './types.ts'
36
44
 
37
45
  export type * from './types.ts'
38
46
 
@@ -253,7 +261,7 @@ export class PermissionPresetService extends TypertRemoteService {
253
261
  // activates only when a command registry is composed.
254
262
  ctx.inject(['commands'], (commandCtx) => {
255
263
  commandCtx.commands.register({
256
- definitionId: CommandDefinitionId('@deepseek-ai/dsh-permission-presets'),
264
+ definitionId: brandString<CommandDefinitionId>('@deepseek-ai/dsh-permission-presets'),
257
265
  name: 'permission',
258
266
  description: 'Switch the permission preset (sandbox mode + approval policy)',
259
267
  input: { hint: '<preset>' },
@@ -297,6 +305,70 @@ export class PermissionPresetService extends TypertRemoteService {
297
305
  }
298
306
  }
299
307
 
308
+ /**
309
+ * Switch one live Session to another preset, opened as a Remote call so a
310
+ * caller's Session access is decided before any preset is resolved or any
311
+ * knob is written. The call's `session` resource is the Session named by
312
+ * `request.sessionId`, per {@link PermissionPresetSetRequest}; the session
313
+ * controller's resolver names it.
314
+ *
315
+ * The switch appends `permission/preset` and the changed knob events to the
316
+ * Session log, so persisted-only Sessions are refused: they have no live log
317
+ * to append to.
318
+ * @param request - live target Session and the preset name to switch to.
319
+ * @returns the Session's current selection after the switch, read the way
320
+ * the client reads it: the recorded preset while its bundle still matches,
321
+ * otherwise the first preset whose bundle matches, otherwise `custom`.
322
+ * @throws {RemoteError} `gateway/bad-request` for an unknown preset name or a
323
+ * Session this process does not hold live; neither call writes.
324
+ */
325
+ @Remote({ name: 'set' })
326
+ setPreset(request: PermissionPresetSetRequest): PermissionSelection {
327
+ return this.switchPreset(request, (session, policy) => { setApprovalPolicy(session, policy) })
328
+ }
329
+
330
+ /**
331
+ * Apply one preset switch, letting the caller own the approval write.
332
+ *
333
+ * A Remote parameter cannot carry an Agent, so a caller that holds the
334
+ * target's Agent supplies a setter routing the approval knob through the
335
+ * approval service; that caller then keeps the model-visible policy notice
336
+ * its own switch produces. {@link setPreset} writes the knob directly.
337
+ * @param request - live target Session and the preset name to switch to.
338
+ * @param setApproval - writes the approval policy on the resolved Session.
339
+ * @returns the Session's current selection after the switch.
340
+ * @throws {RemoteError} `gateway/bad-request` for an unknown preset name or a
341
+ * Session this process does not hold live; neither call writes.
342
+ */
343
+ private switchPreset(
344
+ request: PermissionPresetSetRequest,
345
+ setApproval: (session: Session, policy: ApprovalPolicy) => void,
346
+ ): PermissionSelection {
347
+ const session = this.callSession(request.sessionId)
348
+ try {
349
+ this.apply(session, request.preset, (policy) => { setApproval(session, policy) })
350
+ } catch (error: unknown) {
351
+ /* v8 ignore next -- the setters and the log append only throw Error subclasses, so `String` has nothing to render. */
352
+ const message = error instanceof Error ? error.message : String(error)
353
+ throw new RemoteError('gateway/bad-request', message, {}, { cause: error })
354
+ }
355
+ return { currentValue: this.current(session) }
356
+ }
357
+
358
+ /**
359
+ * Read the live Session one Remote call names.
360
+ * @param sessionId - id carried by the request.
361
+ * @returns the live Session.
362
+ * @throws {RemoteError} `gateway/bad-request` when no live Session carries the id.
363
+ */
364
+ private callSession(sessionId: PermissionPresetSetRequest['sessionId']): Session {
365
+ const session = this.ctx.sessions.get(sessionId)
366
+ if (session === undefined) {
367
+ throw new RemoteError('gateway/bad-request', `permission: no live session "${sessionId}"`, {})
368
+ }
369
+ return session
370
+ }
371
+
300
372
  /**
301
373
  * Publish the fixed current-session Auto preset for the calling
302
374
  * integration's effect lifetime.
package/src/types.ts CHANGED
@@ -9,6 +9,8 @@
9
9
  * @module @deepseek-ai/dsh-permission-presets/types
10
10
  */
11
11
 
12
+ import type { SessionId } from '@deepseek-ai/dsh-session/types'
13
+
12
14
  /** Presentation for an available preset or the derived `custom` current value. */
13
15
  export interface PresetOption {
14
16
  /** Stable option value: a configured preset key, live `auto`, or derived `custom`. */
@@ -38,6 +40,18 @@ export interface PermissionSelection {
38
40
  currentValue: string
39
41
  }
40
42
 
43
+ /**
44
+ * Request of the `permissionPresets.set` Remote: switch one live Session to
45
+ * another preset. The call's `session` resource is the Session named here, so
46
+ * the Gateway decides access before any preset is resolved or written.
47
+ */
48
+ export interface PermissionPresetSetRequest {
49
+ /** Live Session whose knobs the switch writes. */
50
+ readonly sessionId: SessionId
51
+ /** Preset name to switch to; an unknown name refuses the call without writing. */
52
+ readonly preset: string
53
+ }
54
+
41
55
  declare module '@deepseek-ai/cordis' {
42
56
  interface Events {
43
57
  /**