@songtonyli/dsh-cli 0.1.95 → 0.1.97
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.md +1 -1
- package/bin/dsh.mjs +1 -1
- package/node_modules/@deepseek-ai/dsh-agent-preset/skills/cordis-composition-reference/references/packages.md +1 -0
- package/node_modules/@deepseek-ai/dsh-client-modules/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-cordis-client-runner/lib/client.js +0 -4
- package/node_modules/@deepseek-ai/dsh-ptc-runtime-node/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-ptc-runtime-node/README.md +1 -1
- package/node_modules/@deepseek-ai/dsh-ptc-runtime-node/README.zh.md +1 -1
- package/node_modules/@deepseek-ai/dsh-ptc-runtime-node/lib/index.js +41 -16
- package/node_modules/@deepseek-ai/dsh-sandbox/README.i18n.yaml +5 -2
- package/node_modules/@deepseek-ai/dsh-sandbox/README.md +4 -0
- package/node_modules/@deepseek-ai/dsh-sandbox/README.zh.md +4 -0
- package/node_modules/@deepseek-ai/dsh-sandbox/lib/index.js +23 -3
- package/node_modules/@deepseek-ai/dsh-sandbox-apple-container/README.i18n.yaml +17 -14
- package/node_modules/@deepseek-ai/dsh-sandbox-apple-container/README.md +12 -6
- package/node_modules/@deepseek-ai/dsh-sandbox-apple-container/README.zh.md +12 -6
- package/node_modules/@deepseek-ai/dsh-sandbox-apple-container/lib/exec-shim.js +3 -1
- package/node_modules/@deepseek-ai/dsh-sandbox-apple-container/lib/index.js +54 -9
- package/node_modules/@deepseek-ai/dsh-sandbox-local/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-sandbox-local/README.md +2 -0
- package/node_modules/@deepseek-ai/dsh-sandbox-local/README.zh.md +2 -0
- package/node_modules/@deepseek-ai/dsh-sandbox-local/lib/index.js +74 -18
- package/node_modules/@deepseek-ai/dsh-session-continuation/README.i18n.yaml +15 -6
- package/node_modules/@deepseek-ai/dsh-session-continuation/README.md +10 -2
- package/node_modules/@deepseek-ai/dsh-session-continuation/README.zh.md +11 -3
- package/node_modules/@deepseek-ai/dsh-session-continuation/lib/index.js +4 -1
- package/node_modules/@deepseek-ai/dsh-session-continuation/lib/types/index.js +5 -2
- package/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/api-catalog.js +11 -1
- package/node_modules/@deepseek-ai/dsh-tui-app/README.i18n.yaml +10 -10
- package/node_modules/@deepseek-ai/dsh-tui-app/README.md +9 -3
- package/node_modules/@deepseek-ai/dsh-tui-app/README.zh.md +9 -3
- package/node_modules/@deepseek-ai/dsh-tui-app/cordis.patch.yml +0 -5
- package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +38 -9
- package/node_modules/@swc/helpers/cjs/_ts_add_disposable_resource.cjs +41 -1
- package/node_modules/@swc/helpers/cjs/_ts_decorate.cjs +15 -1
- package/node_modules/@swc/helpers/cjs/_ts_dispose_resources.cjs +44 -1
- package/node_modules/@swc/helpers/cjs/_ts_metadata.cjs +7 -1
- package/node_modules/@swc/helpers/cjs/_ts_param.cjs +7 -1
- package/node_modules/@swc/helpers/cjs/_ts_rewrite_relative_import_extension.cjs +10 -1
- package/node_modules/@swc/helpers/cjs/_ts_values.cjs +19 -1
- package/node_modules/@swc/helpers/cjs/_unsupported_iterable_to_array.cjs +1 -1
- package/node_modules/@swc/helpers/cjs/index.cjs +0 -4
- package/node_modules/@swc/helpers/esm/_ts_add_disposable_resource.js +41 -1
- package/node_modules/@swc/helpers/esm/_ts_decorate.js +15 -1
- package/node_modules/@swc/helpers/esm/_ts_dispose_resources.js +44 -1
- package/node_modules/@swc/helpers/esm/_ts_metadata.js +7 -1
- package/node_modules/@swc/helpers/esm/_ts_param.js +7 -1
- package/node_modules/@swc/helpers/esm/_ts_rewrite_relative_import_extension.js +10 -1
- package/node_modules/@swc/helpers/esm/_ts_values.js +19 -1
- package/node_modules/@swc/helpers/esm/_unsupported_iterable_to_array.js +1 -1
- package/node_modules/@swc/helpers/esm/index.js +0 -1
- package/node_modules/@swc/helpers/package.json +2 -11
- package/node_modules/@swc/helpers/scripts/ast_grep.js +5 -25
- package/node_modules/@swc/helpers/scripts/build.js +2 -1
- package/node_modules/turndown/dist/turndown.js +18 -15
- package/node_modules/turndown/lib/turndown.browser.cjs.js +18 -15
- package/node_modules/turndown/lib/turndown.browser.es.js +18 -15
- package/node_modules/turndown/lib/turndown.browser.umd.js +18 -15
- package/node_modules/turndown/lib/turndown.cjs.js +18 -15
- package/node_modules/turndown/lib/turndown.es.js +18 -15
- package/node_modules/turndown/lib/turndown.umd.js +18 -15
- package/node_modules/turndown/package.json +4 -3
- package/package.json +3 -3
- package/node_modules/@swc/helpers/_/_jsx/package.json +0 -4
- package/node_modules/@swc/helpers/cjs/_jsx.cjs +0 -28
- package/node_modules/@swc/helpers/esm/_jsx.js +0 -26
- package/node_modules/@swc/helpers/src/_jsx.mjs +0 -1
|
@@ -6,7 +6,7 @@ import { Service } from "@deepseek-ai/cordis";
|
|
|
6
6
|
import z from "@deepseek-ai/schemastery";
|
|
7
7
|
import { z as z$1 } from "zod";
|
|
8
8
|
import { CommandDefinitionId } from "@deepseek-ai/dsh-commands/brand";
|
|
9
|
-
import { SandboxUnavailableError, canonicalPath, nameGlobMatcher } from "@deepseek-ai/dsh-sandbox";
|
|
9
|
+
import { SandboxUnavailableError, canonicalPath, nameGlobMatcher, writableRoots } from "@deepseek-ai/dsh-sandbox";
|
|
10
10
|
import { LocalSandboxProvider } from "@deepseek-ai/dsh-sandbox-local";
|
|
11
11
|
import { createHash } from "node:crypto";
|
|
12
12
|
import { mkdir, readdir, rm } from "node:fs/promises";
|
|
@@ -450,7 +450,9 @@ function setSandboxBackend(session, backend) {
|
|
|
450
450
|
* local platform chain, while `container` runs the argv through an exec shim
|
|
451
451
|
* inside a Linux container VM that bind-mounts the workspace at its own
|
|
452
452
|
* absolute path (read-only under `read-only`). Host file effects stay inside
|
|
453
|
-
* the workspace, and the guest cannot read unmounted host paths.
|
|
453
|
+
* the workspace, and the guest cannot read unmounted host paths. A host-bound
|
|
454
|
+
* execution, which the guest cannot run, confines in place under the local
|
|
455
|
+
* Seatbelt chain with a read fence instead.
|
|
454
456
|
*
|
|
455
457
|
* Each session's backend is the last `sandbox/backend` event in its log,
|
|
456
458
|
* otherwise the configured default; the shared `/sandbox` command reports and
|
|
@@ -506,6 +508,11 @@ const DEFAULT_HIDDEN_FILES = [
|
|
|
506
508
|
".netrc",
|
|
507
509
|
".git-credentials"
|
|
508
510
|
];
|
|
511
|
+
/**
|
|
512
|
+
* Host directories whose file contents host-bound executions of container
|
|
513
|
+
* sessions cannot read by default: user homes and attached volumes.
|
|
514
|
+
*/
|
|
515
|
+
const DEFAULT_HOST_BOUND_UNREADABLE_ROOTS = ["/Users", "/Volumes"];
|
|
509
516
|
/** Stderr text of a write the read-only workspace mount refused. */
|
|
510
517
|
const CONTAINER_DENIAL_SIGNATURES = ["read-only file system"];
|
|
511
518
|
/** The shim's own failure line, emitted only when the command never started. */
|
|
@@ -571,7 +578,8 @@ var AppleContainerSandboxProvider = class extends LocalSandboxProvider {
|
|
|
571
578
|
protectedPaths: z.array(z.string()).default([".git"]),
|
|
572
579
|
hiddenFiles: z.array(z.string()).default([...DEFAULT_HIDDEN_FILES]),
|
|
573
580
|
hiddenFilesMaxDepth: z.natural().default(8),
|
|
574
|
-
hiddenFilesSkipDirs: z.array(z.string()).default(["node_modules", ".git"])
|
|
581
|
+
hiddenFilesSkipDirs: z.array(z.string()).default(["node_modules", ".git"]),
|
|
582
|
+
hostBoundUnreadableRoots: z.array(z.string()).default([...DEFAULT_HOST_BOUND_UNREADABLE_ROOTS])
|
|
575
583
|
})]);
|
|
576
584
|
static inject = ["sessions", "sessionProjections"];
|
|
577
585
|
/** The backend for sessions without a recorded choice, after `auto` resolution. */
|
|
@@ -583,6 +591,7 @@ var AppleContainerSandboxProvider = class extends LocalSandboxProvider {
|
|
|
583
591
|
envDenylist;
|
|
584
592
|
readOnlyMounts;
|
|
585
593
|
hiddenFiles;
|
|
594
|
+
hostBoundUnreadableRoots;
|
|
586
595
|
runtime;
|
|
587
596
|
pool;
|
|
588
597
|
/** Reader for the `sandboxBackend` projection, registered during activation. */
|
|
@@ -615,6 +624,9 @@ var AppleContainerSandboxProvider = class extends LocalSandboxProvider {
|
|
|
615
624
|
const protectedPaths = config.protectedPaths;
|
|
616
625
|
if (protectedPaths.some((path) => path === "" || isAbsolute(path) || path.includes(",") || path.split(/[\\/]/u).includes(".."))) throw new Error("sandbox-apple-container: protectedPaths entries must be workspace-relative paths without `..` or a comma");
|
|
617
626
|
this.hiddenFiles = config.hiddenFiles;
|
|
627
|
+
const unreadable = config.hostBoundUnreadableRoots;
|
|
628
|
+
if (unreadable.some((path) => !isAbsolute(path))) throw new Error("sandbox-apple-container: hostBoundUnreadableRoots entries must be absolute paths");
|
|
629
|
+
this.hostBoundUnreadableRoots = [...new Set(unreadable.map(canonicalPath))];
|
|
618
630
|
this.runtime = new ContainerRuntime({
|
|
619
631
|
executable: this.executable,
|
|
620
632
|
image: this.image,
|
|
@@ -727,6 +739,35 @@ var AppleContainerSandboxProvider = class extends LocalSandboxProvider {
|
|
|
727
739
|
};
|
|
728
740
|
}
|
|
729
741
|
/**
|
|
742
|
+
* Confine a host-bound execution in place. The local backend wraps it like
|
|
743
|
+
* any other call. The container guest cannot run host executables or receive
|
|
744
|
+
* descriptors beyond stdio, so the container backend confines it with the
|
|
745
|
+
* local Seatbelt chain under the policy's write rules and a read fence: file
|
|
746
|
+
* contents under `hostBoundUnreadableRoots` stay unreadable except the read
|
|
747
|
+
* scope, the policy's writable roots, and the runtime paths, and hidden files
|
|
748
|
+
* stay unreadable everywhere. Host paths outside those roots stay readable.
|
|
749
|
+
* @param argv - the exact argv the caller is about to spawn.
|
|
750
|
+
* @param policy - the file-effect policy this execution runs under.
|
|
751
|
+
* @param execution - the runtime paths the process must read.
|
|
752
|
+
* @param signal - cancellation before policy resolution.
|
|
753
|
+
* @returns the wrapped argv; a container session whose local chain is not
|
|
754
|
+
* Seatbelt fails closed with `SANDBOX_UNSUPPORTED_POLICY`.
|
|
755
|
+
*/
|
|
756
|
+
async confineHostBound(argv, policy, execution, signal) {
|
|
757
|
+
signal?.throwIfAborted();
|
|
758
|
+
if (this.policyBackend(policy) === "local") return super.confine(argv, policy, signal);
|
|
759
|
+
const readable = [
|
|
760
|
+
...this.containerReadRoots(policy),
|
|
761
|
+
...writableRoots(policy),
|
|
762
|
+
...execution.runtimePaths
|
|
763
|
+
];
|
|
764
|
+
return this.confineWithReadFence(argv, policy, {
|
|
765
|
+
deniedRoots: this.hostBoundUnreadableRoots,
|
|
766
|
+
readableRoots: [...new Set(readable.map(canonicalPath))],
|
|
767
|
+
hiddenNames: this.hiddenFiles
|
|
768
|
+
}, signal);
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
730
771
|
* Tells the user that `danger-full-access` leaves the container.
|
|
731
772
|
* @param policy - the calling session's resolved policy.
|
|
732
773
|
* @param target - the wider mode the call asks for.
|
|
@@ -749,14 +790,18 @@ var AppleContainerSandboxProvider = class extends LocalSandboxProvider {
|
|
|
749
790
|
readScope(policy) {
|
|
750
791
|
if (policy.mode === "danger-full-access" || this.policyBackend(policy) === "local") return void 0;
|
|
751
792
|
return {
|
|
752
|
-
roots:
|
|
753
|
-
policy.workspaceRoot,
|
|
754
|
-
canonicalPath(policy.workspaceRoot),
|
|
755
|
-
...this.readOnlyMounts
|
|
756
|
-
])],
|
|
793
|
+
roots: this.containerReadRoots(policy),
|
|
757
794
|
hiddenNames: this.hiddenFiles
|
|
758
795
|
};
|
|
759
796
|
}
|
|
797
|
+
/** The host directories a container session's guest can read: the workspace as spelled and canonical, and the extra mounts. */
|
|
798
|
+
containerReadRoots(policy) {
|
|
799
|
+
return [...new Set([
|
|
800
|
+
policy.workspaceRoot,
|
|
801
|
+
canonicalPath(policy.workspaceRoot),
|
|
802
|
+
...this.readOnlyMounts
|
|
803
|
+
])];
|
|
804
|
+
}
|
|
760
805
|
/** The backend of the session a policy names; agentless and unknown sessions use the default. */
|
|
761
806
|
policyBackend(policy) {
|
|
762
807
|
return this.backendFor(policy.sessionId === void 0 ? void 0 : this.ctx.sessions.get(policy.sessionId));
|
|
@@ -780,4 +825,4 @@ var AppleContainerSandboxProvider = class extends LocalSandboxProvider {
|
|
|
780
825
|
}
|
|
781
826
|
};
|
|
782
827
|
//#endregion
|
|
783
|
-
export { AppleContainerSandboxProvider, AppleContainerSandboxProvider as default, DEFAULT_ENV_DENYLIST, DEFAULT_HIDDEN_FILES, SANDBOX_BACKENDS, containerSupported, executableResolves, isSandboxBackend, resolveBackend, setSandboxBackend, shimInvocation };
|
|
828
|
+
export { AppleContainerSandboxProvider, AppleContainerSandboxProvider as default, DEFAULT_ENV_DENYLIST, DEFAULT_HIDDEN_FILES, DEFAULT_HOST_BOUND_UNREADABLE_ROOTS, SANDBOX_BACKENDS, containerSupported, executableResolves, isSandboxBackend, resolveBackend, setSandboxBackend, shimInvocation };
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
en: f0c44248c2ca6acc
|
|
37
37
|
zh: 554e9f706671d222
|
|
38
38
|
/deepseek-ai-dsh-sandbox-local/understand-the-implementation/platform-profiles:
|
|
39
|
-
en:
|
|
40
|
-
zh:
|
|
39
|
+
en: ed15f305683568b8
|
|
40
|
+
zh: 6f34d5433a2fa9c5
|
|
41
41
|
/deepseek-ai-dsh-sandbox-local/understand-the-implementation/denial-and-runner-failure-dialects:
|
|
42
42
|
en: 62adfc9229c656cc
|
|
43
43
|
zh: 11b1534b6d61e5de
|
|
@@ -80,6 +80,8 @@ The `@deepseek-ai/node-addon-system/landlock-run` API supplies the platform laun
|
|
|
80
80
|
|
|
81
81
|
The Seatbelt profile is allow-default with `(deny file-write*)` plus write allow-lists derived from the shared `writableRoots` helper, so exactly the mode's promised file effects are governed; every root is canonicalized because Seatbelt matches resolved paths (`/tmp` IS `/private/tmp`).
|
|
82
82
|
|
|
83
|
+
A subclass can add a read fence through the protected `confineWithReadFence`: the profile then denies `file-read-data` under the fence's denied roots, allows it again under its readable roots, and denies it for files whose name matches a hidden-name glob. Seatbelt applies the last matching rule, so the forms follow that order. Metadata reads stay allowed. Resolved-path matching keeps symlinks and firmlinked `/System/Volumes/Data` spellings inside the fence, and Seatbelt refuses a new hard link to a file the fence denies. Only the Seatbelt rung expresses a fence; another selected runner or a configured `runnerCommand` fails closed with `SANDBOX_UNSUPPORTED_POLICY`. The [Apple container backend](../sandbox-apple-container/README.md) uses it for host-bound executions.
|
|
84
|
+
|
|
83
85
|
The Windows rung keeps one deterministic write SID and standing ACE per workspace, while every live session/workspace pair gets a random private temp directory with a distinct SID and revocable ACE — sessions sharing a workspace share its intended write authority without inheriting one another's temp authority. A fresh provider always chooses a new temp path and SID, so crash residue cannot block or authorize a resumed session. The rung reports `partial` enforcement because NTFS hard links alias one file object across paths, reads stay unconfined, and a tree another AppContainer tool has ACL'd with a package SID is unreadable to the Low-integrity child.
|
|
84
86
|
|
|
85
87
|
With the built-in Windows runner and a skill registry, this provider registers the [ACL diagnosis skill](../sandbox-windows-acl/README.md#failures-and-recovery). An operator-supplied `runnerCommand` does not register it; provider disposal removes the skill and its extracted resources.
|
|
@@ -80,6 +80,8 @@ bwrap profile 组合只读宿主根目录、全新 `/dev` 与私有 PID 命名
|
|
|
80
80
|
|
|
81
81
|
Seatbelt profile 默认允许,带 `(deny file-write*)` 与来自共享 `writableRoots` 辅助函数的写入 allow-list,因此恰好管辖模式承诺的文件操作;每个根目录都经过规范化,因为 Seatbelt 匹配解析后的路径(`/tmp` 就是 `/private/tmp`)。
|
|
82
82
|
|
|
83
|
+
子类可以通过受保护的 `confineWithReadFence` 添加读取围栏:profile 随后在围栏的拒绝根目录下拒绝 `file-read-data`,在其可读根目录下重新允许,并对名称匹配隐藏名 glob 的文件拒绝读取。Seatbelt 采用最后一条匹配规则,因此这些形式按此顺序排列。元数据读取仍然允许。按解析后路径匹配,使符号链接以及经 firmlink 的 `/System/Volumes/Data` 写法都留在围栏之内,Seatbelt 也会拒绝为围栏所拒绝的文件新建硬链接。只有 Seatbelt 档能表达围栏;选中的其他 runner 或配置的 `runnerCommand` 会以 `SANDBOX_UNSUPPORTED_POLICY` 故障关闭。[Apple container 后端](../sandbox-apple-container/README.zh.md)用它处理宿主机绑定执行。
|
|
84
|
+
|
|
83
85
|
Windows 档为每个工作区保留一个确定性写入 SID 和常驻 ACE,同时为每个活跃的会话/工作区对分配一个随机私有临时目录,以及不同的 SID 和可撤销 ACE——共享工作区的会话共享其预期写权限,却不会继承彼此的临时目录权限。新的提供方总会选择新的临时路径和 SID,因此崩溃残留既无法阻止恢复的会话,也无法向其授权。该档报告 `partial` 强制执行,因为 NTFS 硬链接会把同一文件对象别名为多个路径、读取仍不受限,且被其他 AppContainer 工具以包 SID 标记过的目录树对 Low 完整性子进程不可读。
|
|
84
86
|
|
|
85
87
|
当内置 Windows runner 与技能注册表同时可用时,此提供方会注册 [ACL 诊断技能](../sandbox-windows-acl/README.zh.md#failures-and-recovery)。自定义 `runnerCommand` 不注册该技能;提供方释放时移除技能及其提取的资源。
|
|
@@ -50,9 +50,41 @@ function landlockProfileArgs(policy) {
|
|
|
50
50
|
readWrite
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
/** Quote one path as an SBPL string literal. */
|
|
54
|
-
function sbplString(
|
|
55
|
-
return `"${
|
|
53
|
+
/** Quote one path or regular expression as an SBPL string literal. */
|
|
54
|
+
function sbplString(text) {
|
|
55
|
+
return `"${text.replaceAll("\\", String.raw`\\`).replaceAll("\"", String.raw`\"`)}"`;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Translate a file-name glob into an SBPL regular expression for the last
|
|
59
|
+
* path component, matching `nameGlobMatcher` for ASCII names. An empty glob
|
|
60
|
+
* or one containing `/` matches no file name and yields no expression.
|
|
61
|
+
* @param glob - one hidden-name glob.
|
|
62
|
+
* @returns the expression, or `undefined` when the glob cannot match a name.
|
|
63
|
+
*/
|
|
64
|
+
function hiddenNameRegex(glob) {
|
|
65
|
+
if (glob === "" || glob.includes("/")) return void 0;
|
|
66
|
+
let body = "";
|
|
67
|
+
for (const char of glob) if (char === "*") body += "[^/]*";
|
|
68
|
+
else if (/^[A-Za-z]$/u.test(char)) body += `[${char.toLowerCase()}${char.toUpperCase()}]`;
|
|
69
|
+
else if (char === "^" || char === "\\") body += `[\\${char}]`;
|
|
70
|
+
else body += `[${char}]`;
|
|
71
|
+
return `/${body}$`;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The SBPL forms of one read fence, in the order Seatbelt's last-match rule
|
|
75
|
+
* needs: the denial, the readable exceptions, then hidden names.
|
|
76
|
+
* @param fence - the restriction to express.
|
|
77
|
+
* @returns forms appended after the write rules.
|
|
78
|
+
*/
|
|
79
|
+
function readFenceForms(fence) {
|
|
80
|
+
const forms = [];
|
|
81
|
+
if (fence.deniedRoots.length > 0) {
|
|
82
|
+
forms.push(`(deny file-read-data ${fence.deniedRoots.map((root) => `(subpath ${sbplString(root)})`).join(" ")})`);
|
|
83
|
+
if (fence.readableRoots.length > 0) forms.push(`(allow file-read-data ${fence.readableRoots.map((root) => `(subpath ${sbplString(root)})`).join(" ")})`);
|
|
84
|
+
}
|
|
85
|
+
const hidden = fence.hiddenNames.map(hiddenNameRegex).filter((regex) => regex !== void 0);
|
|
86
|
+
if (hidden.length > 0) forms.push(`(deny file-read-data ${hidden.map((regex) => `(regex ${sbplString(regex)})`).join(" ")})`);
|
|
87
|
+
return forms;
|
|
56
88
|
}
|
|
57
89
|
/**
|
|
58
90
|
* Build the sandbox-exec arguments and SBPL profile for one policy. The
|
|
@@ -62,9 +94,10 @@ function sbplString(path) {
|
|
|
62
94
|
* (`@deepseek-ai/dsh-fs-sandbox`) can never drift apart; the helper adds the
|
|
63
95
|
* documented Seatbelt temp areas.
|
|
64
96
|
* @param policy - file-effect policy to express as an SBPL profile.
|
|
97
|
+
* @param fence - optional read restriction appended after the write rules.
|
|
65
98
|
* @returns sandbox-exec arguments before the trailing separator and command argv.
|
|
66
99
|
*/
|
|
67
|
-
function seatbeltProfileArgs(policy) {
|
|
100
|
+
function seatbeltProfileArgs(policy, fence) {
|
|
68
101
|
const forms = [
|
|
69
102
|
"(version 1)",
|
|
70
103
|
"(allow default)",
|
|
@@ -73,6 +106,7 @@ function seatbeltProfileArgs(policy) {
|
|
|
73
106
|
];
|
|
74
107
|
const roots = writableRoots(policy);
|
|
75
108
|
if (roots.length > 0) forms.push(`(allow file-write* ${roots.map((root) => `(subpath ${sbplString(root)})`).join(" ")})`);
|
|
109
|
+
if (fence !== void 0) forms.push(...readFenceForms(fence));
|
|
76
110
|
return ["-p", forms.join(" ")];
|
|
77
111
|
}
|
|
78
112
|
//#endregion
|
|
@@ -305,24 +339,46 @@ var LocalSandboxProvider = class extends SandboxProvider {
|
|
|
305
339
|
* `SANDBOX_UNAVAILABLE` error when the platform has no usable runner.
|
|
306
340
|
*/
|
|
307
341
|
async confine(argv, policy, signal) {
|
|
342
|
+
return this.wrap(argv, policy, void 0, signal);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Wrap `argv` like {@link confine} and add a read fence to the profile. Only
|
|
346
|
+
* the Seatbelt rung expresses a read fence; another selected runner or a
|
|
347
|
+
* configured `runnerCommand` fails closed with `SANDBOX_UNSUPPORTED_POLICY`.
|
|
348
|
+
* @param argv - the exact argv the caller is about to spawn.
|
|
349
|
+
* @param policy - the file-effect policy this execution runs under.
|
|
350
|
+
* @param fence - the read restriction, with canonical paths.
|
|
351
|
+
* @param signal - cancellation before policy resolution.
|
|
352
|
+
* @returns the wrapped argv plus the Seatbelt rung's enforcement, denial
|
|
353
|
+
* signatures, and runner-failure rules.
|
|
354
|
+
*/
|
|
355
|
+
async confineWithReadFence(argv, policy, fence, signal) {
|
|
356
|
+
return this.wrap(argv, policy, fence, signal);
|
|
357
|
+
}
|
|
358
|
+
/** The shared wrap of {@link confine} and {@link confineWithReadFence}. */
|
|
359
|
+
wrap(argv, policy, fence, signal) {
|
|
308
360
|
signal?.throwIfAborted();
|
|
309
361
|
policy = {
|
|
310
362
|
...policy,
|
|
311
363
|
workspaceRoot: canonicalPath(policy.workspaceRoot)
|
|
312
364
|
};
|
|
313
|
-
if (this.runnerCommand !== void 0)
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
365
|
+
if (this.runnerCommand !== void 0) {
|
|
366
|
+
if (fence !== void 0) throw new SandboxUnsupportedPolicyError("sandbox-local: a configured runnerCommand cannot restrict reads");
|
|
367
|
+
return Promise.resolve({
|
|
368
|
+
argv: [
|
|
369
|
+
...this.runnerCommand,
|
|
370
|
+
...bwrapProfileArgs(policy),
|
|
371
|
+
"--",
|
|
372
|
+
...argv
|
|
373
|
+
],
|
|
374
|
+
enforcement: "full",
|
|
375
|
+
denialSignatures: DENIAL_SIGNATURES.runnerCommand,
|
|
376
|
+
runnerFailureRules: [{ fatalSignatures: this.configuredRunnerFailureSignatures }]
|
|
377
|
+
});
|
|
378
|
+
}
|
|
324
379
|
const selected = this.selectRunner(policy.mode);
|
|
325
|
-
|
|
380
|
+
if (fence !== void 0 && selected.runner !== "seatbelt") throw new SandboxUnsupportedPolicyError(`sandbox-local: the ${selected.runner} runner cannot restrict reads`);
|
|
381
|
+
const runnerArgv = this.runnerArgv(selected.runner, policy, fence);
|
|
326
382
|
return Promise.resolve({
|
|
327
383
|
argv: [
|
|
328
384
|
...runnerArgv,
|
|
@@ -335,11 +391,11 @@ var LocalSandboxProvider = class extends SandboxProvider {
|
|
|
335
391
|
});
|
|
336
392
|
}
|
|
337
393
|
/** The selected rung's runner invocation (program + profile arguments) for one policy. */
|
|
338
|
-
runnerArgv(runner, policy) {
|
|
394
|
+
runnerArgv(runner, policy, fence) {
|
|
339
395
|
switch (runner) {
|
|
340
396
|
case "bwrap": return ["bwrap", ...bwrapProfileArgs(policy)];
|
|
341
397
|
case "landlock": return [this.landlockLauncher(), ...landlockProfileArgs(policy)];
|
|
342
|
-
case "seatbelt": return [this.seatbeltExec(), ...seatbeltProfileArgs(policy)];
|
|
398
|
+
case "seatbelt": return [this.seatbeltExec(), ...seatbeltProfileArgs(policy, fence)];
|
|
343
399
|
case "windows-acl": return this.windowsAclRunnerArgv(policy);
|
|
344
400
|
default: return assertNever(runner);
|
|
345
401
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
zh: 15a5430f49098011
|
|
11
11
|
/deepseek-ai-dsh-session-continuation/summary:
|
|
12
12
|
en: 46c5ffad72f35e54
|
|
13
|
-
zh:
|
|
13
|
+
zh: fd8cd9ac30905477
|
|
14
14
|
/deepseek-ai-dsh-session-continuation/table-of-contents:
|
|
15
15
|
en: d152484eb41ac6b4
|
|
16
16
|
zh: 2fbbd3dd3430b19e
|
|
@@ -24,11 +24,20 @@
|
|
|
24
24
|
en: 0418e52ddba1089f
|
|
25
25
|
zh: 308479157587ac1b
|
|
26
26
|
/deepseek-ai-dsh-session-continuation/model-experience:
|
|
27
|
-
en:
|
|
28
|
-
zh:
|
|
29
|
-
/deepseek-ai-dsh-session-continuation/model-experience/
|
|
30
|
-
en:
|
|
31
|
-
zh:
|
|
27
|
+
en: 215e7ba838619b7b
|
|
28
|
+
zh: a311da3843709f90
|
|
29
|
+
/deepseek-ai-dsh-session-continuation/model-experience/accepted-retry:
|
|
30
|
+
en: 9767fa834a1d6fa4
|
|
31
|
+
zh: 05510b8ca5812d4b
|
|
32
|
+
/deepseek-ai-dsh-session-continuation/model-experience/accepted-retry/what-the-model-sees:
|
|
33
|
+
en: 2f9258cf95618523
|
|
34
|
+
zh: 9177d10a660492e9
|
|
35
|
+
/deepseek-ai-dsh-session-continuation/model-experience/accepted-retry/token-effect:
|
|
36
|
+
en: f8b1dc7bcbf9c0c1
|
|
37
|
+
zh: 65233da2af81d21b
|
|
38
|
+
/deepseek-ai-dsh-session-continuation/model-experience/accepted-retry/kv-cache-effect:
|
|
39
|
+
en: 4b999358127340f2
|
|
40
|
+
zh: 5e25de8e23b58e61
|
|
32
41
|
/deepseek-ai-dsh-session-continuation/known-limitations-and-deferred-work:
|
|
33
42
|
en: 39368dac7142e7bb
|
|
34
43
|
zh: 847fc8ad68d85fd2
|
|
@@ -61,11 +61,19 @@ The [service entry](src/index.ts) provides admission, the [projection](src/proje
|
|
|
61
61
|
<a id="model-experience"></a>
|
|
62
62
|
## Model Experience
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
### Accepted retry
|
|
65
|
+
|
|
66
|
+
#### What the model sees
|
|
67
|
+
|
|
68
|
+
An accepted retry appends one user message with empty `content`. The next request includes that empty user turn, the retained history, and any queued non-waking context. The message adds no instruction text.
|
|
69
|
+
|
|
70
|
+
#### Token effect
|
|
71
|
+
|
|
72
|
+
The retry message contributes no instruction tokens. Tokens in the new request come from the retained history, queued context, and the provider framing of the empty user turn.
|
|
65
73
|
|
|
66
74
|
#### KV Cache effect
|
|
67
75
|
|
|
68
|
-
The empty
|
|
76
|
+
The empty user turn is appended after the retained history and does not replace earlier tokens. Queued context delivered with the new request extends the suffix. A refused retry adds no message.
|
|
69
77
|
|
|
70
78
|
## Known Limitations and Deferred Work
|
|
71
79
|
|
|
@@ -7,7 +7,7 @@ kind: "package-reference"
|
|
|
7
7
|
|
|
8
8
|
[English](README.md) | 中文
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## 概述
|
|
11
11
|
|
|
12
12
|
在不向对话添加指令文本的情况下继续符合条件的失败模型工作。重试会开始新轮次,并在 Session 日志中保留失败轮次。待处理的用户输入或正在运行的 Agent 工作会阻止接纳。
|
|
13
13
|
|
|
@@ -61,11 +61,19 @@ Agent 维护锁将条件检查、收件箱检查和接纳操作保护为一个
|
|
|
61
61
|
<a id="model-experience"></a>
|
|
62
62
|
## 模型体验
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
### 已接纳的重试
|
|
65
|
+
|
|
66
|
+
#### 模型看到什么
|
|
67
|
+
|
|
68
|
+
已接纳的重试追加一条 `content` 为空的用户消息。下一次请求包含该空用户回合、保留的历史,以及队列中不唤醒 Agent 的上下文。该消息不添加指令文本。
|
|
69
|
+
|
|
70
|
+
#### Token 影响
|
|
71
|
+
|
|
72
|
+
重试消息不贡献指令 token。新请求中的 token 来自保留的历史、已排队的上下文,以及提供方对空用户回合的消息封装。
|
|
65
73
|
|
|
66
74
|
#### KV Cache 影响
|
|
67
75
|
|
|
68
|
-
|
|
76
|
+
空用户回合追加在保留历史之后,不会替换先前的 token。随新请求交付的已排队上下文会延长后缀。被拒绝的重试不添加消息。
|
|
69
77
|
|
|
70
78
|
## 已知限制与延期工作
|
|
71
79
|
|
|
@@ -65,6 +65,7 @@ const continuationProjectionDefinition = {
|
|
|
65
65
|
/** The Agent already owns a turn or maintenance operation; retry after that work settles. */
|
|
66
66
|
var SessionContinuationBusyError = class extends Error {
|
|
67
67
|
name = "SessionContinuationBusyError";
|
|
68
|
+
/** Machine-readable code for a retry refused because the Agent is not idle. */
|
|
68
69
|
code = "AGENT_BUSY";
|
|
69
70
|
constructor(cause) {
|
|
70
71
|
super("generation continuation requires an idle agent", { cause });
|
|
@@ -90,8 +91,9 @@ var SessionContinuation = class extends Service {
|
|
|
90
91
|
* @throws if reading the projection or queuing the retry fails.
|
|
91
92
|
*/
|
|
92
93
|
async retry(agent, source) {
|
|
94
|
+
let admitted;
|
|
93
95
|
try {
|
|
94
|
-
|
|
96
|
+
admitted = agent.runMaintenance(() => {
|
|
95
97
|
const inbox = agent.inbox;
|
|
96
98
|
if (this.projection.stateOf(agent.session).ending === null || inbox.nextTurn.length > 0 || inbox.nextStep.some((message) => message.source.kind === "user")) return Promise.resolve("unavailable");
|
|
97
99
|
agent.followup(createUserMessage({
|
|
@@ -103,6 +105,7 @@ var SessionContinuation = class extends Service {
|
|
|
103
105
|
} catch (cause) {
|
|
104
106
|
throw new SessionContinuationBusyError(cause);
|
|
105
107
|
}
|
|
108
|
+
return admitted;
|
|
106
109
|
}
|
|
107
110
|
};
|
|
108
111
|
//#endregion
|
|
@@ -5,6 +5,7 @@ import { continuationProjectionDefinition } from "./projection.js";
|
|
|
5
5
|
/** The Agent already owns a turn or maintenance operation; retry after that work settles. */
|
|
6
6
|
export class SessionContinuationBusyError extends Error {
|
|
7
7
|
name = 'SessionContinuationBusyError';
|
|
8
|
+
/** Machine-readable code for a retry refused because the Agent is not idle. */
|
|
8
9
|
code = 'AGENT_BUSY';
|
|
9
10
|
constructor(cause) {
|
|
10
11
|
super('generation continuation requires an idle agent', { cause });
|
|
@@ -30,8 +31,10 @@ export class SessionContinuation extends Service {
|
|
|
30
31
|
* @throws if reading the projection or queuing the retry fails.
|
|
31
32
|
*/
|
|
32
33
|
async retry(agent, source) {
|
|
34
|
+
// Catch only the synchronous busy rejection. Admission failures stay on the returned promise.
|
|
35
|
+
let admitted;
|
|
33
36
|
try {
|
|
34
|
-
|
|
37
|
+
admitted = agent.runMaintenance(() => {
|
|
35
38
|
const inbox = agent.inbox;
|
|
36
39
|
if (this.projection.stateOf(agent.session).ending === null
|
|
37
40
|
|| inbox.nextTurn.length > 0 || inbox.nextStep.some(message => message.source.kind === 'user')) {
|
|
@@ -42,9 +45,9 @@ export class SessionContinuation extends Service {
|
|
|
42
45
|
});
|
|
43
46
|
}
|
|
44
47
|
catch (cause) {
|
|
45
|
-
// runMaintenance throws synchronously only when another activity owns the Agent.
|
|
46
48
|
throw new SessionContinuationBusyError(cause);
|
|
47
49
|
}
|
|
50
|
+
return admitted;
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
export default SessionContinuation;
|
|
@@ -2542,9 +2542,15 @@ export const SERVICE_API = [
|
|
|
2542
2542
|
parameters: [{ name: 'argv', description: 'the exact argv the caller is about to spawn (program plus arguments), NOT a shell string — a shell-shaped consumer passes `[\'bash\', \'-c\', command]`.' }, { name: 'policy', description: 'the file-effect policy this execution runs under, carried per call (see {@link SandboxPolicy}).' }, { name: 'signal', description: 'cancellation while the provider resolves the policy and runner.' }],
|
|
2543
2543
|
returns: 'the argv to spawn instead, plus the enforcement completeness the selected backend achieves for it.',
|
|
2544
2544
|
},
|
|
2545
|
+
{
|
|
2546
|
+
signature: 'confineHostBound( argv: readonly string[], policy: SandboxPolicy, _execution: HostBoundExecution, signal?: AbortSignal, ): Promise<ConfinedArgv>',
|
|
2547
|
+
description: 'Wrap `argv` for a host-bound execution: one that must run in the subprocess provider\'s own execution world because its executable or runtime files are paths there outside the shared workspace, or because it inherits descriptors beyond stdin, stdout, and stderr. The base implementation is confine, which already confines in that world. A provider whose `confine` relocates execution, such as the Apple container backend, overrides this to confine in place under a read restriction it documents, or fails closed.',
|
|
2548
|
+
parameters: [{ name: 'argv', description: 'the exact argv the caller is about to spawn.' }, { name: 'policy', description: 'the file-effect policy this execution runs under.' }, { name: '_execution', description: 'the runtime paths the process must read.' }, { name: 'signal', description: 'cancellation while the provider resolves the policy and runner.' }],
|
|
2549
|
+
returns: 'the argv to spawn instead, plus the enforcement completeness the selected backend achieves for it.',
|
|
2550
|
+
},
|
|
2545
2551
|
{
|
|
2546
2552
|
signature: 'readScope(_policy: SandboxExecutionPolicy): SandboxReadScope | undefined',
|
|
2547
|
-
description: 'What a process
|
|
2553
|
+
description: 'What a process wrapped by confine under `policy` can read on the host, or `undefined` when this backend does not confine reads. Model-facing tools that read the host for the same session must refuse paths outside the scope, so their view never exceeds the confined processes\'. The base implementation confines no reads.',
|
|
2548
2554
|
parameters: [{ name: '_policy', description: 'the file-effect policy of the calling session.' }],
|
|
2549
2555
|
returns: 'the read scope, or `undefined` for unconfined reads.',
|
|
2550
2556
|
},
|
|
@@ -6760,6 +6766,10 @@ export const TYPE_API = [
|
|
|
6760
6766
|
name: 'HookRegistration',
|
|
6761
6767
|
declaration: 'export interface HookRegistration {\n catch(handler: AnyHook): void;\n}',
|
|
6762
6768
|
},
|
|
6769
|
+
{
|
|
6770
|
+
name: 'HostBoundExecution',
|
|
6771
|
+
declaration: 'export interface HostBoundExecution {\n readonly runtimePaths: readonly string[];\n}',
|
|
6772
|
+
},
|
|
6763
6773
|
{
|
|
6764
6774
|
name: 'HostConnectionFetch',
|
|
6765
6775
|
declaration: 'export interface HostConnectionFetch {\n register(route: ConnectionFetchRoute): () => Promise<void>;\n}',
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
en: 192bbbb187278f91
|
|
19
19
|
zh: 1f7e5632c15bdcf7
|
|
20
20
|
/deepseek-ai-dsh-tui-app/use-this-package/starting-and-resuming:
|
|
21
|
-
en:
|
|
22
|
-
zh:
|
|
21
|
+
en: d0ede2f3fc62912b
|
|
22
|
+
zh: d177b8f16b58828f
|
|
23
23
|
/deepseek-ai-dsh-tui-app/use-this-package/the-screen:
|
|
24
24
|
en: 8798852e763b4558
|
|
25
25
|
zh: 6bb6768ee7186709
|
|
26
26
|
/deepseek-ai-dsh-tui-app/use-this-package/keys-and-commands:
|
|
27
|
-
en:
|
|
28
|
-
zh:
|
|
27
|
+
en: d2122e0739be9cb2
|
|
28
|
+
zh: cca31f6569716a8c
|
|
29
29
|
/deepseek-ai-dsh-tui-app/use-this-package/background-tool-calls:
|
|
30
30
|
en: 322ae3c6d76383ec
|
|
31
31
|
zh: 8c38eee4b57ed8dd
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
en: 1354f4f002a282eb
|
|
43
43
|
zh: 98ce0fa0ef7e3156
|
|
44
44
|
/deepseek-ai-dsh-tui-app/use-this-package/configuration:
|
|
45
|
-
en:
|
|
46
|
-
zh:
|
|
45
|
+
en: 5476d8ed57b808c6
|
|
46
|
+
zh: ccd70bd708b38629
|
|
47
47
|
/deepseek-ai-dsh-tui-app/understand-the-implementation:
|
|
48
48
|
en: f124d406565fef39
|
|
49
49
|
zh: 90344b5eec319cad
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
en: e6c3923481cbf9e6
|
|
52
52
|
zh: 0bca6c917dd26cbc
|
|
53
53
|
/deepseek-ai-dsh-tui-app/understand-the-implementation/rendering-model:
|
|
54
|
-
en:
|
|
55
|
-
zh:
|
|
54
|
+
en: ecbcecfd325fddfc
|
|
55
|
+
zh: ba726f23145a86d7
|
|
56
56
|
/deepseek-ai-dsh-tui-app/understand-the-implementation/patch-surface-over-base:
|
|
57
|
-
en:
|
|
58
|
-
zh:
|
|
57
|
+
en: 5fcf3240081b9540
|
|
58
|
+
zh: 6fafe10c4adf654f
|
|
59
59
|
/deepseek-ai-dsh-tui-app/understand-the-implementation/source-map:
|
|
60
60
|
en: cb2a9fb8623dac76
|
|
61
61
|
zh: 1cd89366da059886
|
|
@@ -38,6 +38,8 @@ dsh tui --no-open # print sign-in URLs without opening a
|
|
|
38
38
|
|
|
39
39
|
Once a quit has saved the session, the app prints `dsh: session <id> saved; resume with: dsh --profile tui --resume <id>` on stderr for the root session bound at that moment; [Quitting](#quitting) lists every line a quit prints. A resumed session redraws its persisted history before accepting input and continues with that session's last model, or the launch default when the log has no request header; inside the terminal, `/resume` and `/sessions` open the same picker over persisted root sessions other than the current session, newest first, and resume the selected previous session, `/new` starts a fresh empty session with the launch default model, while `/clear` starts a fresh empty session that retains the current model and reasoning effort; the previous session stays on disk for `/resume`, and `/fork` copies the current session up to its last completed turn into a new one, the same cut the browser's fork takes. Switching releases the previous Agent and redraws the transcript of the next.
|
|
40
40
|
|
|
41
|
+
Failed attempts retain their saved text and reasoning after a resume or session switch. These diagnostic entries do not enter model history, add unexecuted tool cards, or contribute to committed token totals.
|
|
42
|
+
|
|
41
43
|
### The screen
|
|
42
44
|
|
|
43
45
|
Every frame is drawn one column in from each edge of the terminal, so no line of the conversation or of the docked chrome touches either side. The header names the session by its title once one is generated or set, with the id beside it. The transcript grows in the terminal's own scrollback: your prompts start with `❯` on a tinted full-width band while colour is on (attachments listed under them), and a prompt steered or injected into a turn that already had a model step draws dim on a darker band so it recedes behind the turn it joined, assistant reasoning is dim italic under a `✻ Thinking` header above the Markdown reply, a bloom spinning beside `Thinking` while it streams, and each tool call is a card with a status glyph — a yellow spinner of that tool family's flowers, blooms, and stars while it runs, a green `◆` once done, a red `◆` on failure — the tool name in bold cyan, the presenter headline in teal — without the tool name a presenter repeated, so `Read src/app.ts` draws as `read src/app.ts`, and for a shell card the call's own summary, never the command, which the card draws once as its `$` row — a loading row while it runs, and a body folded to `toolPreviewLines` rows. Shell output is dimmed apart from the syntax-colored command; a complete JSON object or array result draws as a tree with dim guides, cyan keys, orange array indices, and type-colored scalar values instead of braces, and so does a call's JSON object or array input unless its presenter supplies its own rows, while malformed or mixed output stays unchanged. A top-level workflow call also draws its own run beside that card: the name, member count, status, and a ten-cell member progress bar with the settled count, then each phase and the members that started. While a live run runs, its `◇` pulses through a diamond animation and each running member's `○` spins in the subagent family's flowers, one phase ahead of the member before it; a run drawn from a replayed log spins only while its background job is still live, and reduced motion draws the static glyphs. Running groups and groups with a failed, cancelled, or interrupted member open; a clean completion stays closed. Space or Enter on a run or phase folds that level, and Enter on a running member opens its child only while that child is a live direct child of this session. The card appears when the model starts the call and flows out row after row, each row left to right, at one pace whatever the card holds: a full-width row takes `toolRevealFrames` frames, a shorter row proportionally less, and the columns just drawn brighten from the terminal background to their own colors. The result rows flow out the same way when the tool answers, behind whatever the card is still drawing; neither the call nor the result waits for the animation. An `edit` or `write` diff card fills each added row edge to edge with a green background and each removed row with a red one, the removed rows above the added ones, and paints the `+` and `-` in their own lighter colour so each sign reads against the fill rather than in it; a wrapped row carries the fill on without a second sign; once the tool applied the change, the applied hunks replace the diff the call carried and lead every row with its file line number, the new file's for added and unchanged rows and the old file's for removed rows. A `subagent` or `subagent_*` card draws folded as one row behind the same status glyph, spinning while it runs and a dim `◆` for a child handed to the background: while it runs, the tool name, the task description, and the requested model and `background` when the call names them; once settled, the description dimmed with `[done]`, `[started]` for a child handed to the background, or `[failed]` at the right edge. `Space` on the marked row, or `Ctrl+O`, unfolds the full card. A nonempty system prompt and each injected context — instructions, catalogs, snapshots, notices, relays, and recalls — draw as a dim `⬡` title over the first `contextPreviewLines` rows of their model-facing text, with each snapshot contribution named above its own rows; an empty system prompt is omitted. A compaction, from `/compact` or automatic, draws as one context block whose accent `⬡` title names its origin and the estimated tokens it replaced and its summary costs, as in `context compacted by /compact · ~6.4k → ~0.9k tokens` or `context compacted automatically in turn 12 · …`; under the title, `compressed` names the item count and turns the summary replaced, each prompt among them (five at most, one row each), and a count of the replies, tool results by tool, context blocks, and earlier summaries, and `preserved` names the system prompt and what each later turn still holds verbatim; both stay drawn while the summary under them folds to `contextPreviewLines` rows like any context block. The checkpoint message itself is not drawn again. A `/compact` attempt the log closes with an error prints `/compact failed · <error>` when the session is redrawn, since the live command reports its own failure; a failed automatic attempt changes nothing and draws nothing, as in the browser. A tool card and a context block that carry more rows than they draw end on one marker: `… <n> more rows · Space expands` while the conversation's focus holds that block, and `… <n> more rows · Ctrl+O expands` otherwise. Fenced code in a reply, the file rows of a `read` card, the changed rows of an `edit` or `write` diff card — with `+` additions marked green, `-` removals red, and source text behind those signs drawn in the language the file's extension names — and the shell command of a `!` / `!!` draft, a `$ command` user-shell row (its `$` in the accent colour), and a terminal tool card, use syntax colours from a theme the terminal's own background picks, light or dark; the grammar of a language loads on the first block that asks for it, so that block draws plain and is repainted in colour a moment later, and a language with no grammar here, a terminal that reports neither 24-bit nor 256 colours, and `codeHighlight: false` each draw every block plain. Headings and list markers use orange, links and inline code use magenta, and quotes stay dim. Every hue is a Tokyo Night (Night) color, drawn exactly when `COLORTERM` declares `truecolor` or `24bit` and as the nearest of the 256 indexed colors otherwise; the background bands keep their 256-color greys and diff tints. Streamed reasoning, reply text, and tool arguments are queued as they arrive and drawn a share per frame, about 60 frames per second by default, so a network burst spreads over `streamPaceFrames` frames instead of landing at once, and the queue never holds the model call back. Streamed reply text fades in and every word keeps its own clock: a word enters near the terminal's background color and brightens to the color it settles in over `streamFadeSteps` ticks of `streamFadeStepMs` each, so a fast stream leaves a longer trail of brightening words rather than a darker one. Streamed reasoning floats out over the same duration: it appears at a lifted color and recedes to the dim italic it settles in. Each column of a tool card brightens over it from the terminal background to the palette color it settles in; a card redrawn from persisted history carries no flow or fade, and text that has settled is never dimmed again.
|
|
@@ -66,6 +68,8 @@ The conversation, input, subagent panel, and status bar form the vertical arrow-
|
|
|
66
68
|
|
|
67
69
|
Every key the screen names is drawn as a chip, italic in the accent color apart from the words around it: in the status bar, the region legends, the pickers and prompts, the transient line, fold markers, notices, `/help`, and the reader. With `mouse: true`, a left click on a chip presses that key exactly as typing it would, so `Shift+↓` in the status bar walks to the bar, `Esc` on the armed-stop line stops the turn, and each arrow of a pair such as `↑↓` presses its own key. Turning it on turns the terminal's mouse reports on: the wheel opens the full-screen reader at the newest section and scrolls it up or down, but does nothing while an approval or question is open. The wheel and plain click-drag reach the application instead of scrolling the terminal's scrollback or selecting text; most terminals still scroll and select with `Shift` held (`Option` in iTerm2).
|
|
68
70
|
|
|
71
|
+
The input colors its leading `/command` token with the accent color and leaves arguments plain; `NO_COLOR` disables this styling.
|
|
72
|
+
|
|
69
73
|
While the input has the keyboard:
|
|
70
74
|
|
|
71
75
|
| Key | Effect |
|
|
@@ -188,7 +192,7 @@ Typing `/` at the start of the editor completes the terminal's own commands and
|
|
|
188
192
|
| `/attach <path>` | Attach an image or file to the next prompt or a shared command that accepts attachments; `/attach` lists them and `/attach clear` drops them |
|
|
189
193
|
| `/queue` | Show the messages queued for the next turn and step; `/queue clear` drops them, and the rows above the editor with them |
|
|
190
194
|
| `/retry` | Continue an eligible failed turn without a new prompt; pending human input or active work prevents admission, and staged attachments remain pending |
|
|
191
|
-
| `/skills` | List
|
|
195
|
+
| `/skills` | List skills available to the current agent and working directory, including global skills |
|
|
192
196
|
| `/signin` | Sign in to a provider through its notices and prompts; `/signin <key>` skips the picker |
|
|
193
197
|
| `/login` | Sign in with a provider subscription (hides key-collecting logins); `/login <key>` skips the picker |
|
|
194
198
|
| `/export [dir]` | Write this session's log ZIP (sub-sessions and attachments included) into `dir`, default the workspace |
|
|
@@ -255,6 +259,8 @@ The exit code is 130 when `Ctrl+C` ended the wait, 129 when the terminal closed,
|
|
|
255
259
|
|
|
256
260
|
### Configuration
|
|
257
261
|
|
|
262
|
+
The TUI inherits native tool execution from `dsh-base` and ignores `DSH_TOOLS_MODE`. Select PTC through an explicit executor patch; see the [TUI executor migration](../../../docs/upgrade-guide/v0.2.2-rc.1/tui-tool-executor-selection/guide.md).
|
|
263
|
+
|
|
258
264
|
| Field | Default | Meaning |
|
|
259
265
|
|---|---|---|
|
|
260
266
|
| `prompt` | none | A first prompt submitted when the terminal is up |
|
|
@@ -296,11 +302,11 @@ The runner awaits the complete application (`ctx.get('loader')?.await()`) and bu
|
|
|
296
302
|
|
|
297
303
|
### Rendering model
|
|
298
304
|
|
|
299
|
-
Durable facts come from the session log: `system/message` (a nonempty prompt draws in full; an empty rendering is omitted), `user/message` (own submissions are drawn once and their echo skipped by message id; injected context — instructions, catalogs, snapshots, notices, relays, recalls, and undeclared forms — draws in full as a dim `⬡` row, a snapshot as one named contribution per part; compaction checkpoints and tool or model sources are omitted), `compaction/start`, `compaction/summary`, the checkpoint replacement, and `compaction/end` (a mirror of the surface kept from each event's `surfaceOp` names the replaced and remaining nodes, and the closing marker draws the compaction block or a failed `/compact` notice; a turn-owned `compaction/start` relabels the running spinner), `assistant/message` (which replaces the streamed block with the committed text and folds usage into the footer), `tool/call` and `tool/result` (drawn through the tool's `presentCall` and `presentResult` views when it declares them, with a raw-argument and raw-result fallback), `turn/end` notices, `workspace/changes` (one notice with the turn's file and line counts while the Host still holds the summary), `session/title` (header), `permission/preset` (footer), and `todo/write` under the enclosing `turn/start` (the turns one todo item's page reports; the list carries no per-item identity, so a reworded item counts as a new one; the same write refreshes the activity board from the `todos` projection). A descendant `turn/start`, `assistant/message`, or `turn/end`, and a `subagent/start` or `subagent/end` for the bound parent, update that child's own board row — the last sentence of the message's text blocks, never reasoning, tool calls, or tool results, and the stop word once the turn settles; a child that has not spoken draws its label alone; `turn/end` on the bound session and bind clear the board. Live incrementality comes from `agent/assistant-stream` text, reasoning, tool-call, and usage deltas: a card is mounted when the model names the tool, and the working spinner follows that stream plus durable `tool/call` / `tool/result` so it says `thinking`, `writing`, or `calling <tool>` with live `↑` send and `↓` receive for that call. Session facts outside the log come from the same services the browser reads: `sessionTitle`, `permissionPresets`, `sessionQuery` for the picker identities, the live or cached `title` projection for picker titles, `/deliverables`, and subagent details, `sessionProjections` for the footer, `/status`, `/context`, `/todos`, and `/outline`, `tokenMeter` for `/context`, `fileReferences` and `sessionReferenceResolver` for `@` completion, `attachments`, `skills`, `authorization`, `settings`, `subagents`, and the Loader's entries for `/plugins`. Modal prompts are process-local presentation and are never logged.
|
|
305
|
+
Durable facts come from the session log: `system/message` (a nonempty prompt draws in full; an empty rendering is omitted), `user/message` (own submissions are drawn once and their echo skipped by message id; injected context — instructions, catalogs, snapshots, notices, relays, recalls, and undeclared forms — draws in full as a dim `⬡` row, a snapshot as one named contribution per part; compaction checkpoints and tool or model sources are omitted), `compaction/start`, `compaction/summary`, the checkpoint replacement, and `compaction/end` (a mirror of the surface kept from each event's `surfaceOp` names the replaced and remaining nodes, and the closing marker draws the compaction block or a failed `/compact` notice; a turn-owned `compaction/start` relabels the running spinner), `assistant/attempt` (diagnostic text and reasoning settled from the embedded stream), `assistant/message` (which replaces the streamed block with the committed text and folds usage into the footer), `tool/call` and `tool/result` (drawn through the tool's `presentCall` and `presentResult` views when it declares them, with a raw-argument and raw-result fallback), `turn/end` notices, `workspace/changes` (one notice with the turn's file and line counts while the Host still holds the summary), `session/title` (header), `permission/preset` (footer), and `todo/write` under the enclosing `turn/start` (the turns one todo item's page reports; the list carries no per-item identity, so a reworded item counts as a new one; the same write refreshes the activity board from the `todos` projection). A descendant `turn/start`, `assistant/message`, or `turn/end`, and a `subagent/start` or `subagent/end` for the bound parent, update that child's own board row — the last sentence of the message's text blocks, never reasoning, tool calls, or tool results, and the stop word once the turn settles; a child that has not spoken draws its label alone; `turn/end` on the bound session and bind clear the board. Live incrementality comes from `agent/assistant-stream` text, reasoning, tool-call, and usage deltas: a card is mounted when the model names the tool, and the working spinner follows that stream plus durable `tool/call` / `tool/result` so it says `thinking`, `writing`, or `calling <tool>` with live `↑` send and `↓` receive for that call. Session facts outside the log come from the same services the browser reads: `sessionTitle`, `permissionPresets`, `sessionQuery` for the picker identities, the live or cached `title` projection for picker titles, `/deliverables`, and subagent details, `sessionProjections` for the footer, `/status`, `/context`, `/todos`, and `/outline`, `tokenMeter` for `/context`, `fileReferences` and `sessionReferenceResolver` for `@` completion, `attachments`, `skills`, `authorization`, `settings`, `subagents`, and the Loader's entries for `/plugins`. Modal prompts are process-local presentation and are never logged.
|
|
300
306
|
|
|
301
307
|
### Patch surface over base
|
|
302
308
|
|
|
303
|
-
The patch rides over `dsh-base`: it sets the coding persona prefix
|
|
309
|
+
The patch rides over `dsh-base`: it sets the coding persona prefix on the base `system-prompt` row, inherits the base tool executors and PTC runtime, mounts the model-facing `ask_user_question` tool whose questions the terminal answers, mounts the same `@`-reference resolvers (`file-reference-local`, `session-reference`) and the `present` deliverable tool the browser composes, adds the `session-turn-outline` and `session-stats` projection rows behind `/outline` and `/status`, and mounts the startup provider and the runner. The base agent-plane rows (bash, filesystem, skills, goals, compaction, subagents) stay enabled because the terminal composes its Agents process-wide.
|
|
304
310
|
|
|
305
311
|
### Source map
|
|
306
312
|
|