@deepseek-ai/dsh-sdk-client 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-client/use-this-package:
18
- en: 316b142489dd050f
19
- zh: 2b37ae57b2a52b5e
18
+ en: ff421f12a5db28a4
19
+ zh: 2ca9b71a3458b5e0
20
20
  /deepseek-ai-dsh-sdk-client/use-this-package/running-agent-turns-with-deepseekharness:
21
21
  en: 01c58dddd7e62de2
22
22
  zh: 6dbd46e244f3f135
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
+ `await harness.resumeSession(savedId)` restores a persisted session from the configured `dshHome` and returns a `HarnessSession` ready for `run()`. Save the original session id and reuse its home and workspace. Restoration preserves conversation history and its directory, repairs an interrupted final turn, and sends no new input. Missing, unreadable, incompatible, or occupied sessions reject without creating a replacement. `session(id)` remains a lazy handle for an in-process session; it does not request persisted restoration. Shell, browser, and other external processes are not restored by this API.
29
+
28
30
  `HarnessSession.getWorkingDirectory()` reads the effective directory; `setWorkingDirectory(path)` changes it and returns the validated absolute path. Either method creates an unknown Session without starting a model turn. Relative paths use the Session's current directory. Origin metadata, permissions, and existing processes remain unchanged. `HarnessClient` exposes the same methods with a leading `sessionId` argument.
29
31
 
30
32
  Use this client when TypeScript code must drive a complete Harness runtime from another process and you can name the runtime executable explicitly. The common path is minimal: construct a `DeepSeekHarness` with a launch spec, run prompts, and close it so the child process is always reaped.
package/README.zh.md CHANGED
@@ -25,6 +25,8 @@ kind: "package-library"
25
25
  <a id="use-this-package"></a>
26
26
  ## 使用本包
27
27
 
28
+ `await harness.resumeSession(savedId)` 从配置的 `dshHome` 恢复持久化会话,并返回可调用 `run()` 的 `HarnessSession`。请保存原会话 id,并沿用其 home 和工作区。恢复会保留对话历史及其目录、修复最后一个被中断的轮次,且不发送新输入。会话缺失、不可读、不兼容或被占用时,请求失败且不创建替代会话。`session(id)` 仍是当前进程内会话的惰性句柄,不会请求持久化恢复。此 API 不恢复 shell、浏览器或其他外部进程。
29
+
28
30
  `HarnessSession.getWorkingDirectory()` 读取有效目录;`setWorkingDirectory(path)` 修改目录并返回校验后的绝对路径。两个方法都可创建未知 Session,而不启动模型轮次。相对路径以 Session 当前目录解析。起始目录元数据、权限与已有进程保持不变。`HarnessClient` 提供同名方法,并以 `sessionId` 作为首个参数。
29
31
 
30
32
  当 TypeScript 代码需要从另一进程驱动完整 Harness 运行时、且你能显式指名运行时可执行文件时,使用本客户端。常用路径极简:用启动规格构造 `DeepSeekHarness`,运行提示词,然后关闭它,使子进程总能被回收。
package/lib/index.js CHANGED
@@ -441,6 +441,14 @@ var HarnessClient = class {
441
441
  return result.messageId;
442
442
  }
443
443
  /**
444
+ * Restore persisted history without sending a prompt; failures propagate without creating a session.
445
+ * @param sessionId - persisted identity in this runtime's configured persistence store.
446
+ * @returns after the session is ready for prompts.
447
+ */
448
+ async resumeSession(sessionId) {
449
+ await this.request("session/resume", { sessionId });
450
+ }
451
+ /**
444
452
  * Read a Session's effective working directory, recovering it if missing.
445
453
  * @param sessionId - target Session; an unknown id creates it.
446
454
  * @returns the absolute effective directory.
@@ -715,6 +723,17 @@ var DeepSeekHarness = class {
715
723
  return new HarnessSession(this, sessionId ?? `session-${randomUUID().replaceAll("-", "")}`);
716
724
  }
717
725
  /**
726
+ * Start the runtime and restore a persisted session without sending input.
727
+ * The configured Harness home must contain its history; missing or occupied sessions reject.
728
+ * @param sessionId - exact persisted identity to continue.
729
+ * @returns a handle ready to run new prompts on the restored history.
730
+ */
731
+ async resumeSession(sessionId) {
732
+ await this.start();
733
+ await this.client.resumeSession(sessionId);
734
+ return new HarnessSession(this, sessionId);
735
+ }
736
+ /**
718
737
  * Run one prompt on a fresh (or named) session.
719
738
  * @param input - prompt text, or content blocks sent verbatim.
720
739
  * @param options - optional session id and per-notification observer.
@@ -53,6 +53,13 @@ export declare class DeepSeekHarness implements AsyncDisposable {
53
53
  * @returns the session handle.
54
54
  */
55
55
  session(sessionId?: string): HarnessSession;
56
+ /**
57
+ * Start the runtime and restore a persisted session without sending input.
58
+ * The configured Harness home must contain its history; missing or occupied sessions reject.
59
+ * @param sessionId - exact persisted identity to continue.
60
+ * @returns a handle ready to run new prompts on the restored history.
61
+ */
62
+ resumeSession(sessionId: string): Promise<HarnessSession>;
56
63
  /**
57
64
  * Run one prompt on a fresh (or named) session.
58
65
  * @param input - prompt text, or content blocks sent verbatim.
@@ -96,6 +96,12 @@ export declare class HarnessClient {
96
96
  * @returns the queued message id.
97
97
  */
98
98
  prompt(sessionId: string, contentBlocks: SdkPromptContentBlock[]): Promise<string>;
99
+ /**
100
+ * Restore persisted history without sending a prompt; failures propagate without creating a session.
101
+ * @param sessionId - persisted identity in this runtime's configured persistence store.
102
+ * @returns after the session is ready for prompts.
103
+ */
104
+ resumeSession(sessionId: string): Promise<void>;
99
105
  /**
100
106
  * Read a Session's effective working directory, recovering it if missing.
101
107
  * @param sessionId - target Session; an unknown id creates it.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-sdk-client",
3
3
  "description": "TypeScript client SDK for driving a DeepSeek Harness runtime subprocess over stdio JSON-RPC: the DeepSeekHarness high-level turns API and the lower-level HarnessClient",
4
- "version": "0.2.1-alpha.2",
4
+ "version": "0.2.1-alpha.3",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -26,19 +26,19 @@
26
26
  ],
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
- "@deepseek-ai/dsh": "0.2.1-alpha.2"
29
+ "@deepseek-ai/dsh": "0.2.1-alpha.3"
30
30
  },
31
31
  "peerDependencies": {
32
- "@deepseek-ai/dsh-llm": "0.2.1-alpha.2",
33
- "@deepseek-ai/dsh-sdk-protocol": "0.2.1-alpha.2",
34
- "@deepseek-ai/dsh-session": "0.2.1-alpha.2",
35
- "@deepseek-ai/cordis": "~4.0.5-alpha.1"
32
+ "@deepseek-ai/dsh-llm": "0.2.1-alpha.3",
33
+ "@deepseek-ai/dsh-sdk-protocol": "0.2.1-alpha.3",
34
+ "@deepseek-ai/dsh-session": "0.2.1-alpha.3",
35
+ "@deepseek-ai/cordis": "~4.0.5-alpha.2"
36
36
  },
37
37
  "devDependencies": {
38
- "@deepseek-ai/dsh-llm": "0.2.1-alpha.2",
39
- "@deepseek-ai/dsh-sdk-protocol": "0.2.1-alpha.2",
40
- "@deepseek-ai/dsh-session": "0.2.1-alpha.2",
41
- "@deepseek-ai/cordis": "~4.0.5-alpha.1",
42
- "@deepseek-ai/dsh-experimental-translator": "0.2.1-alpha.2"
38
+ "@deepseek-ai/dsh-llm": "0.2.1-alpha.3",
39
+ "@deepseek-ai/dsh-sdk-protocol": "0.2.1-alpha.3",
40
+ "@deepseek-ai/dsh-session": "0.2.1-alpha.3",
41
+ "@deepseek-ai/cordis": "~4.0.5-alpha.2",
42
+ "@deepseek-ai/dsh-experimental-translator": "0.2.1-alpha.3"
43
43
  }
44
44
  }