@deepseek-ai/dsh-sdk-jsonrpc-server 0.2.1-alpha.2 → 0.2.1-alpha.3

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 CHANGED
@@ -15,8 +15,8 @@
15
15
  en: d152484eb41ac6b4
16
16
  zh: 09388d293f9be9cb
17
17
  /deepseek-ai-dsh-sdk-jsonrpc-server/use-this-package:
18
- en: ab5b719668e746f2
19
- zh: 971c2fdaa9e7d351
18
+ en: e136ff3a0b42cc22
19
+ zh: f6c4df5bbafa335f
20
20
  /deepseek-ai-dsh-sdk-jsonrpc-server/use-this-package/wiring:
21
21
  en: 47a33e9397e36e15
22
22
  zh: e6d173820f9ea6e5
package/README.md CHANGED
@@ -25,6 +25,8 @@ English | [中文](README.zh.md)
25
25
  <a id="use-this-package"></a>
26
26
  ## Use this package
27
27
 
28
+ `session/resume` accepts a persisted `{ sessionId }` after initialization and returns `{}` once its Agent is ready. It loads history through `agents.resume()`, repairs an interrupted final turn, and preserves the stored origin and effective directory while applying the initialized model route. It sends no new input. Missing, unreadable, incompatible, or occupied sessions reject without creating a replacement. Prompts for an identity currently being restored wait for that restoration; shutdown drains pending restoration and releases its Agent. Historical events are retained in the log rather than streamed again as new notifications.
29
+
28
30
  `session/working-directory/get` accepts `{ sessionId }`; `session/working-directory/set` accepts `{ sessionId, path }`. Both return `{ cwd }` and create an unknown Session without starting a model turn. Reads recover missing directories through the working-directory service; changes preserve origin metadata and permissions, and reach the model through logged user context.
29
31
 
30
32
  Mount this plugin when a runtime must serve SDK clients: add it to a `cordis.yml` that composes the agent service, boot the runtime, and clients connect over stdio. The common path is explicit — the plugin needs the `agents` service; every other capability comes from the surrounding tree.
package/README.zh.md CHANGED
@@ -25,6 +25,8 @@ kind: "package-reference"
25
25
  <a id="use-this-package"></a>
26
26
  ## 使用本包
27
27
 
28
+ `session/resume` 在初始化后接受持久化的 `{ sessionId }`,待其 Agent 就绪后返回 `{}`。它通过 `agents.resume()` 加载历史、修复最后一个被中断的轮次,并保留存储的起始目录和当前有效目录,同时应用初始化时选定的模型路由。它不发送新输入。会话缺失、不可读、不兼容或被占用时,请求失败且不创建替代会话。对正在恢复的标识发送提示词时,会等待恢复完成;shutdown 会等待进行中的恢复并释放其 Agent。历史事件保留在日志中,不会作为新通知重新发送。
29
+
28
30
  `session/working-directory/get` 接收 `{ sessionId }`;`session/working-directory/set` 接收 `{ sessionId, path }`。两者均返回 `{ cwd }`,并可创建未知 Session,而不启动模型轮次。读取通过工作目录服务恢复缺失目录;修改保留起始目录元数据与权限,并通过已记录的用户上下文告知模型。
29
31
 
30
32
  当运行时必须服务 SDK 客户端时挂载本插件:把它加入组合了 agent 服务的 `cordis.yml`,启动运行时,客户端即可通过 stdio 连接。常用路径是显式的——插件需要 `agents` 服务;其余每个能力都来自外围插件树。
package/lib/index.js CHANGED
@@ -164,6 +164,21 @@ var HarnessSdkJsonRpcServer = class {
164
164
  return { messageId: message.id };
165
165
  }
166
166
  /**
167
+ * Restore a persisted session and repair its interrupted final turn without sending input.
168
+ * Uses the initialized model route while preserving the stored session identity and directory.
169
+ * Rejects missing, unreadable, or already owned sessions; never creates a replacement.
170
+ * @param params - persisted session identity in the configured persistence store.
171
+ * @returns an empty result after the Agent is ready for prompts.
172
+ */
173
+ async resume(params) {
174
+ if (!this.initialized) throw new Error("SDK server is not initialized");
175
+ if (this.shuttingDown) throw new Error("SDK server is shutting down");
176
+ const sessionId = params.sessionId;
177
+ if (this.sessions.has(sessionId) || this.sessionCreations.has(sessionId)) throw new Error(`SDK session is already open or opening: ${sessionId}`);
178
+ await this.openSession(sessionId, true);
179
+ return {};
180
+ }
181
+ /**
167
182
  * Wait for an existing owned Agent and its managed descendants to finish.
168
183
  * The response follows all Session notifications emitted during the wait.
169
184
  * Rejects a live Agent failure that has no subsequent durable terminal.
@@ -261,6 +276,11 @@ var HarnessSdkJsonRpcServer = class {
261
276
  switch (method) {
262
277
  case "initialize": return this.initialize(params);
263
278
  case "session/prompt": return this.prompt(params);
279
+ case "session/resume": {
280
+ const sessionId = params?.sessionId;
281
+ if (typeof sessionId !== "string" || sessionId.length === 0) throw new TypeError("session/resume requires a non-empty sessionId string");
282
+ return this.resume({ sessionId });
283
+ }
264
284
  case "session/wait": {
265
285
  const sessionId = params?.sessionId;
266
286
  if (typeof sessionId !== "string") throw new TypeError("session/wait requires a sessionId string");
@@ -285,7 +305,10 @@ var HarnessSdkJsonRpcServer = class {
285
305
  if (existing) return existing;
286
306
  const pending = this.sessionCreations.get(sessionId);
287
307
  if (pending) return pending;
288
- const creation = this.createSession(sessionId);
308
+ return this.openSession(sessionId, false);
309
+ }
310
+ openSession(sessionId, resume) {
311
+ const creation = this.createSession(sessionId, resume);
289
312
  this.sessionCreations.set(sessionId, creation);
290
313
  creation.then(() => {
291
314
  this.sessionCreations.delete(sessionId);
@@ -294,18 +317,22 @@ var HarnessSdkJsonRpcServer = class {
294
317
  });
295
318
  return creation;
296
319
  }
297
- async createSession(sessionId) {
320
+ async createSession(sessionId, resume) {
321
+ const agentOptions = {
322
+ provider: this.provider,
323
+ model: this.model,
324
+ ...this.reasoningEffort === void 0 ? {} : { reasoningEffort: this.reasoningEffort },
325
+ ...this.maxTokens === void 0 ? {} : { maxTokens: this.maxTokens }
326
+ };
298
327
  const rec = {
299
- handle: await this.ctx.agents.create({
328
+ handle: await (resume ? this.ctx.agents.resume({
329
+ resumeSessionId: brandString(sessionId),
330
+ agentOptions
331
+ }) : this.ctx.agents.create({
300
332
  sessionId: brandString(sessionId),
301
333
  meta: { cwd: this.cwd },
302
- agentOptions: {
303
- provider: this.provider,
304
- model: this.model,
305
- ...this.reasoningEffort === void 0 ? {} : { reasoningEffort: this.reasoningEffort },
306
- ...this.maxTokens === void 0 ? {} : { maxTokens: this.maxTokens }
307
- }
308
- }),
334
+ agentOptions
335
+ })),
309
336
  failure: void 0
310
337
  };
311
338
  this.sessions.set(sessionId, rec);
@@ -5,7 +5,7 @@
5
5
  * @module @deepseek-ai/dsh-sdk-jsonrpc-server/server
6
6
  */
7
7
  import type { Context } from '@deepseek-ai/cordis';
8
- import type { InitializeParams, InitializeResult, JsonRpcTransportPeer, SessionPromptParams, SessionPromptResult, SessionWaitParams, SessionWorkingDirectoryParams, SessionWorkingDirectorySetParams, SessionWorkingDirectoryResult } from '@deepseek-ai/dsh-sdk-protocol';
8
+ import type { InitializeParams, InitializeResult, JsonRpcTransportPeer, SessionPromptParams, SessionPromptResult, SessionResumeParams, SessionWaitParams, SessionWorkingDirectoryParams, SessionWorkingDirectorySetParams, SessionWorkingDirectoryResult } from '@deepseek-ai/dsh-sdk-protocol';
9
9
  /** Deployment-specific status mapping for SDK turn and subagent outcomes. */
10
10
  export interface HarnessSdkJsonRpcServerOptions {
11
11
  /** Report max-token termination as an accepted result instead of an infrastructure error. */
@@ -45,6 +45,14 @@ export declare class HarnessSdkJsonRpcServer {
45
45
  * @returns the durable message identity.
46
46
  */
47
47
  prompt(params: SessionPromptParams): Promise<SessionPromptResult>;
48
+ /**
49
+ * Restore a persisted session and repair its interrupted final turn without sending input.
50
+ * Uses the initialized model route while preserving the stored session identity and directory.
51
+ * Rejects missing, unreadable, or already owned sessions; never creates a replacement.
52
+ * @param params - persisted session identity in the configured persistence store.
53
+ * @returns an empty result after the Agent is ready for prompts.
54
+ */
55
+ resume(params: SessionResumeParams): Promise<Record<string, never>>;
48
56
  /**
49
57
  * Wait for an existing owned Agent and its managed descendants to finish.
50
58
  * The response follows all Session notifications emitted during the wait.
@@ -84,6 +92,7 @@ export declare class HarnessSdkJsonRpcServer {
84
92
  */
85
93
  handleRequest(method: string, params: Record<string, unknown> | undefined): Promise<unknown>;
86
94
  private getOrCreateSession;
95
+ private openSession;
87
96
  private createSession;
88
97
  private hasAdapterFor;
89
98
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-sdk-jsonrpc-server",
3
3
  "description": "Stdio JSON-RPC server plugin for out-of-process DeepSeek Harness SDK clients",
4
- "version": "0.2.1-alpha.2",
4
+ "version": "0.2.1-alpha.3",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,36 +27,36 @@
27
27
  ],
28
28
  "license": "MIT",
29
29
  "dependencies": {
30
- "@deepseek-ai/dsh-brand": "0.2.1-alpha.2",
31
- "@deepseek-ai/schemastery": "~3.18.5-alpha.1"
30
+ "@deepseek-ai/dsh-brand": "0.2.1-alpha.3",
31
+ "@deepseek-ai/schemastery": "~3.18.5-alpha.2"
32
32
  },
33
33
  "peerDependencies": {
34
- "@deepseek-ai/cordis": "~4.0.5-alpha.1",
35
- "@deepseek-ai/dsh-agent": "0.2.1-alpha.2",
36
- "@deepseek-ai/dsh-attachment": "0.2.1-alpha.2",
37
- "@deepseek-ai/dsh-llm": "0.2.1-alpha.2",
38
- "@deepseek-ai/dsh-llm-deepseek-api-key": "0.2.1-alpha.2",
39
- "@deepseek-ai/dsh-scope": "0.2.1-alpha.2",
40
- "@deepseek-ai/dsh-sdk-protocol": "0.2.1-alpha.2",
41
- "@deepseek-ai/dsh-session": "0.2.1-alpha.2",
42
- "@deepseek-ai/dsh-subagent": "0.2.1-alpha.2",
43
- "@deepseek-ai/dsh-working-directory": "0.2.1-alpha.2"
34
+ "@deepseek-ai/cordis": "~4.0.5-alpha.2",
35
+ "@deepseek-ai/dsh-agent": "0.2.1-alpha.3",
36
+ "@deepseek-ai/dsh-attachment": "0.2.1-alpha.3",
37
+ "@deepseek-ai/dsh-llm": "0.2.1-alpha.3",
38
+ "@deepseek-ai/dsh-llm-deepseek-api-key": "0.2.1-alpha.3",
39
+ "@deepseek-ai/dsh-scope": "0.2.1-alpha.3",
40
+ "@deepseek-ai/dsh-sdk-protocol": "0.2.1-alpha.3",
41
+ "@deepseek-ai/dsh-session": "0.2.1-alpha.3",
42
+ "@deepseek-ai/dsh-subagent": "0.2.1-alpha.3",
43
+ "@deepseek-ai/dsh-working-directory": "0.2.1-alpha.3"
44
44
  },
45
45
  "devDependencies": {
46
- "@deepseek-ai/cordis": "~4.0.5-alpha.1",
47
- "@deepseek-ai/cordis-plugin-loader": "~1.0.6-alpha.1",
48
- "@deepseek-ai/dsh-agent": "0.2.1-alpha.2",
49
- "@deepseek-ai/dsh-agent-loop": "0.2.1-alpha.2",
50
- "@deepseek-ai/dsh-agent-loop-testkit": "0.2.1-alpha.2",
51
- "@deepseek-ai/dsh-attachment": "0.2.1-alpha.2",
52
- "@deepseek-ai/dsh-llm": "0.2.1-alpha.2",
53
- "@deepseek-ai/dsh-llm-deepseek-api-key": "0.2.1-alpha.2",
54
- "@deepseek-ai/dsh-scope": "0.2.1-alpha.2",
55
- "@deepseek-ai/dsh-sdk-protocol": "0.2.1-alpha.2",
56
- "@deepseek-ai/dsh-session": "0.2.1-alpha.2",
57
- "@deepseek-ai/dsh-session-persistence-jsonl": "0.2.1-alpha.2",
58
- "@deepseek-ai/dsh-session-projection": "0.2.1-alpha.2",
59
- "@deepseek-ai/dsh-subagent": "0.2.1-alpha.2",
60
- "@deepseek-ai/dsh-working-directory": "0.2.1-alpha.2"
46
+ "@deepseek-ai/cordis": "~4.0.5-alpha.2",
47
+ "@deepseek-ai/cordis-plugin-loader": "~1.0.6-alpha.2",
48
+ "@deepseek-ai/dsh-agent": "0.2.1-alpha.3",
49
+ "@deepseek-ai/dsh-agent-loop": "0.2.1-alpha.3",
50
+ "@deepseek-ai/dsh-agent-loop-testkit": "0.2.1-alpha.3",
51
+ "@deepseek-ai/dsh-attachment": "0.2.1-alpha.3",
52
+ "@deepseek-ai/dsh-llm": "0.2.1-alpha.3",
53
+ "@deepseek-ai/dsh-llm-deepseek-api-key": "0.2.1-alpha.3",
54
+ "@deepseek-ai/dsh-scope": "0.2.1-alpha.3",
55
+ "@deepseek-ai/dsh-sdk-protocol": "0.2.1-alpha.3",
56
+ "@deepseek-ai/dsh-session": "0.2.1-alpha.3",
57
+ "@deepseek-ai/dsh-session-persistence-jsonl": "0.2.1-alpha.3",
58
+ "@deepseek-ai/dsh-session-projection": "0.2.1-alpha.3",
59
+ "@deepseek-ai/dsh-subagent": "0.2.1-alpha.3",
60
+ "@deepseek-ai/dsh-working-directory": "0.2.1-alpha.3"
61
61
  }
62
62
  }