@deepseek-ai/dsh-tool-terminal 0.1.6-alpha.1 → 0.1.7-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
@@ -103,6 +103,40 @@ function renderList(sessions, maxBytes) {
103
103
  }).join("\n"), "", false, maxBytes);
104
104
  }
105
105
  //#endregion
106
+ //#region lib/types/background.js
107
+ /**
108
+ * Generic-job adaptation for background terminal sends: the registry pull
109
+ * source over the backend's consuming send reader.
110
+ *
111
+ * @module @deepseek-ai/dsh-tool-terminal/background
112
+ */
113
+ /**
114
+ * Adapt the backend's consuming send reader to a registry pull source. The
115
+ * reader has no offsets of its own — each call hands over what arrived since
116
+ * the previous one — so the source counts the bytes it delivered to keep the
117
+ * registry's cursor monotonic. It binds lazily because the send starts inside
118
+ * the job starter, after the registry admitted the job; a read before that
119
+ * point delivers nothing.
120
+ * @param operation - the live send, once the starter has begun it.
121
+ * @returns one unlabeled source over the send's bounded delta.
122
+ */
123
+ function sendSource(operation) {
124
+ return { read: (fromByte) => {
125
+ const live = operation();
126
+ if (live === void 0) return {
127
+ text: "",
128
+ nextOffset: fromByte,
129
+ lossy: false
130
+ };
131
+ const text = renderSendRead(live.readOutput());
132
+ return {
133
+ text,
134
+ nextOffset: fromByte + Buffer.byteLength(text),
135
+ lossy: false
136
+ };
137
+ } };
138
+ }
139
+ //#endregion
106
140
  //#region lib/types/index.js
107
141
  /**
108
142
  * Six model-facing persistent terminal tools. Owner identity comes from the exact
@@ -359,28 +393,30 @@ function apply(ctx, config = {}) {
359
393
  const jobs = ctx.get("jobs");
360
394
  if (jobs === void 0) throw new Error("background terminal sends require @deepseek-ai/dsh-jobs and @deepseek-ai/dsh-tool-jobs");
361
395
  let cancelRequested = false;
396
+ let operation;
362
397
  return {
363
398
  kind: "background",
364
399
  jobId: jobs.start({
365
400
  kind: "pty-send",
366
401
  label: `${id}: ${args.text || "(input)"}`,
367
- owner,
402
+ owner: owner.id,
368
403
  outputLimitBytes: maxResultBytes,
404
+ output: [sendSource(() => operation)],
369
405
  run: () => {
370
- const operation = ctx.terminals.startSend(owner, id, request);
406
+ const started = ctx.terminals.startSend(owner, id, request);
407
+ operation = started;
371
408
  return {
372
409
  cancel: () => {
373
410
  cancelRequested = true;
374
- operation.cancel();
411
+ started.cancel();
375
412
  },
376
- done: operation.done.then((result) => ({
413
+ done: started.done.then((result) => ({
377
414
  status: cancelRequested ? "killed" : "completed",
378
415
  detail: sendDetail(result)
379
416
  }), (error) => ({
380
417
  status: "failed",
381
418
  detail: String(error)
382
- })),
383
- readOutput: () => renderSendRead(operation.readOutput())
419
+ }))
384
420
  };
385
421
  }
386
422
  })
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Generic-job adaptation for background terminal sends: the registry pull
3
+ * source over the backend's consuming send reader.
4
+ *
5
+ * @module @deepseek-ai/dsh-tool-terminal/background
6
+ */
7
+ import type { JobOutputSource } from '@deepseek-ai/dsh-jobs';
8
+ import type { TerminalSendOperation } from '@deepseek-ai/dsh-terminal';
9
+ /**
10
+ * Adapt the backend's consuming send reader to a registry pull source. The
11
+ * reader has no offsets of its own — each call hands over what arrived since
12
+ * the previous one — so the source counts the bytes it delivered to keep the
13
+ * registry's cursor monotonic. It binds lazily because the send starts inside
14
+ * the job starter, after the registry admitted the job; a read before that
15
+ * point delivers nothing.
16
+ * @param operation - the live send, once the starter has begun it.
17
+ * @returns one unlabeled source over the send's bounded delta.
18
+ */
19
+ export declare function sendSource(operation: () => TerminalSendOperation | undefined): JobOutputSource;
20
+ //# sourceMappingURL=background.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-tool-terminal",
3
3
  "description": "Six model-facing persistent PTY tools with owner isolation and generic background-job integration",
4
- "version": "0.1.6-alpha.1",
4
+ "version": "0.1.7-alpha.1",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,37 +27,37 @@
27
27
  ],
28
28
  "license": "MIT",
29
29
  "dependencies": {
30
- "@deepseek-ai/schemastery": "^3.18.2"
30
+ "@deepseek-ai/schemastery": "^3.18.3"
31
31
  },
32
32
  "peerDependencies": {
33
- "@deepseek-ai/dsh-agent": "^0.1.6-alpha.1",
34
- "@deepseek-ai/dsh-llm": "^0.1.6-alpha.1",
35
- "@deepseek-ai/dsh-output-retention": "^0.1.6-alpha.1",
36
- "@deepseek-ai/dsh-terminal": "^0.1.6-alpha.1",
37
- "@deepseek-ai/dsh-system-prompt": "^0.1.6-alpha.1",
38
- "@deepseek-ai/dsh-jobs": "^0.1.6-alpha.1",
39
- "@deepseek-ai/dsh-tools": "^0.1.6-alpha.1",
40
- "@deepseek-ai/cordis": "^4.0.2"
33
+ "@deepseek-ai/dsh-agent": "^0.1.7-alpha.1",
34
+ "@deepseek-ai/dsh-llm": "^0.1.7-alpha.1",
35
+ "@deepseek-ai/dsh-terminal": "^0.1.7-alpha.1",
36
+ "@deepseek-ai/dsh-system-prompt": "^0.1.7-alpha.1",
37
+ "@deepseek-ai/dsh-jobs": "^0.1.7-alpha.1",
38
+ "@deepseek-ai/dsh-tools": "^0.1.7-alpha.1",
39
+ "@deepseek-ai/cordis": "^4.0.3",
40
+ "@deepseek-ai/dsh-output-retention": "^0.1.7-alpha.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@deepseek-ai/cordis-plugin-include": "^1.0.7",
44
- "@deepseek-ai/cordis-plugin-loader": "^1.0.3",
45
- "@deepseek-ai/dsh-agent": "^0.1.6-alpha.1",
46
- "@deepseek-ai/dsh-agent-loop-testkit": "^0.1.6-alpha.1",
47
- "@deepseek-ai/dsh-llm": "^0.1.6-alpha.1",
48
- "@deepseek-ai/dsh-terminal-bash": "^0.1.6-alpha.1",
49
- "@deepseek-ai/dsh-terminal": "^0.1.6-alpha.1",
50
- "@deepseek-ai/dsh-output-retention": "^0.1.6-alpha.1",
51
- "@deepseek-ai/dsh-sandbox": "^0.1.6-alpha.1",
52
- "@deepseek-ai/dsh-subprocess-local": "^0.1.6-alpha.1",
53
- "@deepseek-ai/dsh-jobs": "^0.1.6-alpha.1",
54
- "@deepseek-ai/dsh-jobs-local": "^0.1.6-alpha.1",
55
- "@deepseek-ai/dsh-tool-jobs": "^0.1.6-alpha.1",
56
- "@deepseek-ai/dsh-tools": "^0.1.6-alpha.1",
57
- "@deepseek-ai/cordis": "^4.0.2",
58
- "@deepseek-ai/dsh-sandbox-policy": "^0.1.6-alpha.1",
59
- "@deepseek-ai/dsh-session-projection": "^0.1.6-alpha.1",
60
- "@deepseek-ai/dsh-system-prompt": "^0.1.6-alpha.1",
61
- "@deepseek-ai/dsh-session": "^0.1.6-alpha.1"
43
+ "@deepseek-ai/cordis-plugin-loader": "^1.0.4",
44
+ "@deepseek-ai/cordis-plugin-include": "^1.0.8",
45
+ "@deepseek-ai/dsh-agent": "^0.1.7-alpha.1",
46
+ "@deepseek-ai/dsh-agent-loop-testkit": "^0.1.7-alpha.1",
47
+ "@deepseek-ai/dsh-llm": "^0.1.7-alpha.1",
48
+ "@deepseek-ai/dsh-terminal": "^0.1.7-alpha.1",
49
+ "@deepseek-ai/dsh-output-retention": "^0.1.7-alpha.1",
50
+ "@deepseek-ai/dsh-sandbox-policy": "^0.1.7-alpha.1",
51
+ "@deepseek-ai/dsh-sandbox": "^0.1.7-alpha.1",
52
+ "@deepseek-ai/dsh-session": "^0.1.7-alpha.1",
53
+ "@deepseek-ai/dsh-system-prompt": "^0.1.7-alpha.1",
54
+ "@deepseek-ai/dsh-jobs": "^0.1.7-alpha.1",
55
+ "@deepseek-ai/dsh-subprocess-local": "^0.1.7-alpha.1",
56
+ "@deepseek-ai/dsh-jobs-local": "^0.1.7-alpha.1",
57
+ "@deepseek-ai/dsh-tool-jobs": "^0.1.7-alpha.1",
58
+ "@deepseek-ai/dsh-terminal-bash": "^0.1.7-alpha.1",
59
+ "@deepseek-ai/dsh-tools": "^0.1.7-alpha.1",
60
+ "@deepseek-ai/cordis": "^4.0.3",
61
+ "@deepseek-ai/dsh-session-projection": "^0.1.7-alpha.1"
62
62
  }
63
63
  }