@songtonyli/dsh-cli 0.1.85 → 0.1.87
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/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/LICENSE +201 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/README.md +9 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-cjs/index.js +859 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/build-abort-error.js +19 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/constants.js +1 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +12 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js +51 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/index.js +3 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +251 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +135 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +46 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +180 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/node-http2.js +2 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/node-https.js +2 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +36 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js +21 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +22 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +23 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/timing.js +4 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +63 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/package.json +56 -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-llm-pi-ai/lib/index.js +39 -52
- package/node_modules/@deepseek-ai/dsh-tui-app/README.i18n.yaml +6 -6
- package/node_modules/@deepseek-ai/dsh-tui-app/README.md +3 -2
- package/node_modules/@deepseek-ai/dsh-tui-app/README.zh.md +3 -2
- package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +243 -25
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/LICENSE +201 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/README.md +9 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-cjs/index.js +859 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/build-abort-error.js +19 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/constants.js +1 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +12 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js +51 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/index.js +3 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +251 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +135 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +46 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +180 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2.js +2 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-https.js +2 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +36 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js +21 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +22 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +23 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/timing.js +4 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +63 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/package.json +56 -0
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +13 -37
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +44 -29
- package/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +12 -37
- package/node_modules/@smithy/core/dist-es/submodules/protocols/AbstractRpcV2Protocol.js +35 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +4 -1
- package/node_modules/@smithy/core/dist-es/submodules/protocols/index.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/json/SmithyRpcV2JsonProtocol.js +8 -31
- package/node_modules/@smithy/core/package.json +1 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +48 -6
- package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +9 -1
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +20 -2
- package/node_modules/@smithy/node-http-handler/dist-es/resolve-default-socket-timeout.js +4 -0
- package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +16 -3
- package/node_modules/@smithy/node-http-handler/package.json +3 -3
- package/node_modules/execa/package.json +1 -1
- package/node_modules/unist-util-visit/lib/index.js +173 -161
- package/node_modules/unist-util-visit/license +1 -1
- package/node_modules/unist-util-visit/package.json +46 -56
- package/node_modules/unist-util-visit/readme.md +87 -27
- package/node_modules/unist-util-visit-parents/lib/color.js +4 -0
- package/node_modules/unist-util-visit-parents/lib/color.node.js +4 -0
- package/node_modules/unist-util-visit-parents/lib/index.js +235 -52
- package/node_modules/unist-util-visit-parents/license +1 -1
- package/node_modules/unist-util-visit-parents/package.json +44 -54
- package/node_modules/unist-util-visit-parents/readme.md +185 -74
- package/package.json +6 -6
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { HttpResponse, buildQueryString } from "@smithy/core/protocols";
|
|
2
|
+
import { buildAbortError } from "./build-abort-error";
|
|
3
|
+
import { getTransformedHeaders } from "./get-transformed-headers";
|
|
4
|
+
import { node_http2 } from "./node-http2";
|
|
5
|
+
import { NodeHttp2ConnectionManager } from "./node-http2-connection-manager";
|
|
6
|
+
import { writeRequestBody } from "./write-request-body";
|
|
7
|
+
const { constants } = node_http2;
|
|
8
|
+
export class NodeHttp2Handler {
|
|
9
|
+
config;
|
|
10
|
+
configProvider;
|
|
11
|
+
metadata = { handlerProtocol: "h2" };
|
|
12
|
+
connectionManager = new NodeHttp2ConnectionManager({});
|
|
13
|
+
static create(instanceOrOptions) {
|
|
14
|
+
if (typeof instanceOrOptions?.handle === "function") {
|
|
15
|
+
return instanceOrOptions;
|
|
16
|
+
}
|
|
17
|
+
return new NodeHttp2Handler(instanceOrOptions);
|
|
18
|
+
}
|
|
19
|
+
constructor(options) {
|
|
20
|
+
this.configProvider = new Promise((resolve, reject) => {
|
|
21
|
+
if (typeof options === "function") {
|
|
22
|
+
options()
|
|
23
|
+
.then((opts) => {
|
|
24
|
+
resolve(opts || {});
|
|
25
|
+
})
|
|
26
|
+
.catch(reject);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
resolve(options || {});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
destroy() {
|
|
34
|
+
this.connectionManager.destroy();
|
|
35
|
+
}
|
|
36
|
+
async handle(request, { abortSignal, requestTimeout, isEventStream } = {}) {
|
|
37
|
+
if (!this.config) {
|
|
38
|
+
this.config = await this.configProvider;
|
|
39
|
+
const { disableConcurrentStreams, maxConcurrentStreams, nodeHttp2ConnectOptions } = this.config;
|
|
40
|
+
this.connectionManager.setDisableConcurrentStreams(disableConcurrentStreams ?? false);
|
|
41
|
+
if (maxConcurrentStreams) {
|
|
42
|
+
this.connectionManager.setMaxConcurrentStreams(maxConcurrentStreams);
|
|
43
|
+
}
|
|
44
|
+
if (nodeHttp2ConnectOptions) {
|
|
45
|
+
this.connectionManager.setNodeHttp2ConnectOptions(nodeHttp2ConnectOptions);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const { requestTimeout: configRequestTimeout, disableConcurrentStreams } = this.config;
|
|
49
|
+
const useIsolatedSession = disableConcurrentStreams || isEventStream;
|
|
50
|
+
const effectiveRequestTimeout = requestTimeout ?? configRequestTimeout;
|
|
51
|
+
return new Promise((_resolve, _reject) => {
|
|
52
|
+
let fulfilled = false;
|
|
53
|
+
let writeRequestBodyPromise = undefined;
|
|
54
|
+
const resolve = async (arg) => {
|
|
55
|
+
await writeRequestBodyPromise;
|
|
56
|
+
_resolve(arg);
|
|
57
|
+
};
|
|
58
|
+
const reject = async (arg) => {
|
|
59
|
+
await writeRequestBodyPromise;
|
|
60
|
+
_reject(arg);
|
|
61
|
+
};
|
|
62
|
+
if (abortSignal?.aborted) {
|
|
63
|
+
fulfilled = true;
|
|
64
|
+
const abortError = buildAbortError(abortSignal);
|
|
65
|
+
reject(abortError);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const { hostname, method, port, protocol, query } = request;
|
|
69
|
+
let auth = "";
|
|
70
|
+
if (request.username != null || request.password != null) {
|
|
71
|
+
const username = request.username ?? "";
|
|
72
|
+
const password = request.password ?? "";
|
|
73
|
+
auth = `${username}:${password}@`;
|
|
74
|
+
}
|
|
75
|
+
const authority = `${protocol}//${auth}${hostname}${port ? `:${port}` : ""}`;
|
|
76
|
+
const requestContext = { destination: new URL(authority) };
|
|
77
|
+
const connectConfig = {
|
|
78
|
+
requestTimeout: this.config?.sessionTimeout,
|
|
79
|
+
isEventStream,
|
|
80
|
+
};
|
|
81
|
+
const ref = useIsolatedSession
|
|
82
|
+
? this.connectionManager.createIsolatedSession(requestContext, connectConfig)
|
|
83
|
+
: this.connectionManager.lease(requestContext, connectConfig);
|
|
84
|
+
const session = ref.deref();
|
|
85
|
+
const rejectWithDestroy = (err) => {
|
|
86
|
+
if (useIsolatedSession) {
|
|
87
|
+
ref.destroy();
|
|
88
|
+
}
|
|
89
|
+
fulfilled = true;
|
|
90
|
+
reject(err);
|
|
91
|
+
};
|
|
92
|
+
const queryString = query ? buildQueryString(query) : "";
|
|
93
|
+
let path = request.path;
|
|
94
|
+
if (queryString) {
|
|
95
|
+
path += `?${queryString}`;
|
|
96
|
+
}
|
|
97
|
+
if (request.fragment) {
|
|
98
|
+
path += `#${request.fragment}`;
|
|
99
|
+
}
|
|
100
|
+
const clientHttp2Stream = session.request({
|
|
101
|
+
...request.headers,
|
|
102
|
+
[constants.HTTP2_HEADER_PATH]: path,
|
|
103
|
+
[constants.HTTP2_HEADER_METHOD]: method,
|
|
104
|
+
});
|
|
105
|
+
if (effectiveRequestTimeout) {
|
|
106
|
+
clientHttp2Stream.setTimeout(effectiveRequestTimeout, () => {
|
|
107
|
+
clientHttp2Stream.close();
|
|
108
|
+
const timeoutError = new Error(`Stream timed out because of no activity for ${effectiveRequestTimeout} ms`);
|
|
109
|
+
timeoutError.name = "TimeoutError";
|
|
110
|
+
rejectWithDestroy(timeoutError);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
if (abortSignal) {
|
|
114
|
+
const onAbort = () => {
|
|
115
|
+
clientHttp2Stream.close();
|
|
116
|
+
const abortError = buildAbortError(abortSignal);
|
|
117
|
+
rejectWithDestroy(abortError);
|
|
118
|
+
};
|
|
119
|
+
if (typeof abortSignal.addEventListener === "function") {
|
|
120
|
+
const signal = abortSignal;
|
|
121
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
122
|
+
clientHttp2Stream.once("close", () => signal.removeEventListener("abort", onAbort));
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
abortSignal.onabort = onAbort;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
clientHttp2Stream.on("frameError", (type, code, id) => {
|
|
129
|
+
rejectWithDestroy(new Error(`Frame type id ${type} in stream id ${id} has failed with code ${code}.`));
|
|
130
|
+
});
|
|
131
|
+
clientHttp2Stream.on("error", rejectWithDestroy);
|
|
132
|
+
clientHttp2Stream.on("aborted", () => {
|
|
133
|
+
rejectWithDestroy(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${clientHttp2Stream.rstCode}.`));
|
|
134
|
+
});
|
|
135
|
+
clientHttp2Stream.on("response", (headers) => {
|
|
136
|
+
const httpResponse = new HttpResponse({
|
|
137
|
+
statusCode: headers[":status"] ?? -1,
|
|
138
|
+
headers: getTransformedHeaders(headers),
|
|
139
|
+
body: clientHttp2Stream,
|
|
140
|
+
});
|
|
141
|
+
fulfilled = true;
|
|
142
|
+
resolve({ response: httpResponse });
|
|
143
|
+
if (useIsolatedSession) {
|
|
144
|
+
session.close();
|
|
145
|
+
clientHttp2Stream.on("end", () => {
|
|
146
|
+
ref.destroy();
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
clientHttp2Stream.on("close", () => {
|
|
151
|
+
if (useIsolatedSession) {
|
|
152
|
+
ref.destroy();
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
this.connectionManager.release(requestContext, ref);
|
|
156
|
+
}
|
|
157
|
+
if (!fulfilled) {
|
|
158
|
+
const error = new Error("Unexpected error: http2 request did not get a response");
|
|
159
|
+
if (session.destroyed) {
|
|
160
|
+
error.name = "TimeoutError";
|
|
161
|
+
}
|
|
162
|
+
rejectWithDestroy(error);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
writeRequestBodyPromise = writeRequestBody(clientHttp2Stream, request, effectiveRequestTimeout);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
updateHttpClientConfig(key, value) {
|
|
169
|
+
this.config = undefined;
|
|
170
|
+
this.configProvider = this.configProvider.then((config) => {
|
|
171
|
+
return {
|
|
172
|
+
...config,
|
|
173
|
+
[key]: value,
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
httpHandlerConfigs() {
|
|
178
|
+
return this.config ?? {};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { timing } from "./timing";
|
|
2
|
+
const DEFER_EVENT_LISTENER_TIME = 1000;
|
|
3
|
+
export const setConnectionTimeout = (request, reject, timeoutInMs = 0) => {
|
|
4
|
+
if (!timeoutInMs) {
|
|
5
|
+
return -1;
|
|
6
|
+
}
|
|
7
|
+
const registerTimeout = (offset) => {
|
|
8
|
+
const timeoutId = timing.setTimeout(() => {
|
|
9
|
+
request.destroy();
|
|
10
|
+
reject(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${timeoutInMs} ms.`), {
|
|
11
|
+
name: "TimeoutError",
|
|
12
|
+
}));
|
|
13
|
+
}, timeoutInMs - offset);
|
|
14
|
+
const doWithSocket = (socket) => {
|
|
15
|
+
if (socket?.connecting) {
|
|
16
|
+
socket.on("connect", () => {
|
|
17
|
+
timing.clearTimeout(timeoutId);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
timing.clearTimeout(timeoutId);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
if (request.socket) {
|
|
25
|
+
doWithSocket(request.socket);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
request.on("socket", doWithSocket);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
if (timeoutInMs < 2000) {
|
|
32
|
+
registerTimeout(0);
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
return timing.setTimeout(registerTimeout.bind(null, DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
|
|
36
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { timing } from "./timing";
|
|
2
|
+
export const setRequestTimeout = (req, reject, timeoutInMs = 0, throwOnRequestTimeout, logger) => {
|
|
3
|
+
if (timeoutInMs) {
|
|
4
|
+
return timing.setTimeout(() => {
|
|
5
|
+
let msg = `@smithy/node-http-handler - [${throwOnRequestTimeout ? "ERROR" : "WARN"}] a request has exceeded the configured ${timeoutInMs} ms requestTimeout.`;
|
|
6
|
+
if (throwOnRequestTimeout) {
|
|
7
|
+
const error = Object.assign(new Error(msg), {
|
|
8
|
+
name: "TimeoutError",
|
|
9
|
+
code: "ETIMEDOUT",
|
|
10
|
+
});
|
|
11
|
+
req.destroy(error);
|
|
12
|
+
reject(error);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
msg += ` Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.`;
|
|
16
|
+
logger?.warn?.(msg);
|
|
17
|
+
}
|
|
18
|
+
}, timeoutInMs);
|
|
19
|
+
}
|
|
20
|
+
return -1;
|
|
21
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { timing } from "./timing";
|
|
2
|
+
const DEFER_EVENT_LISTENER_TIME = 3000;
|
|
3
|
+
export const setSocketKeepAlive = (request, { keepAlive, keepAliveMsecs }, deferTimeMs = DEFER_EVENT_LISTENER_TIME) => {
|
|
4
|
+
if (keepAlive !== true) {
|
|
5
|
+
return -1;
|
|
6
|
+
}
|
|
7
|
+
const registerListener = () => {
|
|
8
|
+
if (request.socket) {
|
|
9
|
+
request.socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
request.on("socket", (socket) => {
|
|
13
|
+
socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
if (deferTimeMs === 0) {
|
|
18
|
+
registerListener();
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
return timing.setTimeout(registerListener, deferTimeMs);
|
|
22
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { timing } from "./timing";
|
|
2
|
+
const DEFER_EVENT_LISTENER_TIME = 3000;
|
|
3
|
+
export const setSocketTimeout = (request, reject, timeoutInMs = 0) => {
|
|
4
|
+
const registerTimeout = (offset) => {
|
|
5
|
+
const timeout = timeoutInMs - offset;
|
|
6
|
+
const onTimeout = () => {
|
|
7
|
+
request.destroy();
|
|
8
|
+
reject(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${timeoutInMs} ms of inactivity (configured by client requestHandler).`), { name: "TimeoutError" }));
|
|
9
|
+
};
|
|
10
|
+
if (request.socket) {
|
|
11
|
+
request.socket.setTimeout(timeout, onTimeout);
|
|
12
|
+
request.on("close", () => request.socket?.removeListener("timeout", onTimeout));
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
request.setTimeout(timeout, onTimeout);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
if (0 < timeoutInMs && timeoutInMs < 6000) {
|
|
19
|
+
registerTimeout(0);
|
|
20
|
+
return 0;
|
|
21
|
+
}
|
|
22
|
+
return timing.setTimeout(registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
|
|
23
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Readable } from "node:stream";
|
|
2
|
+
import { timing } from "./timing";
|
|
3
|
+
const MIN_WAIT_TIME = 6_000;
|
|
4
|
+
export async function writeRequestBody(httpRequest, request, maxContinueTimeoutMs = MIN_WAIT_TIME, externalAgent = false) {
|
|
5
|
+
const headers = request.headers;
|
|
6
|
+
const expect = headers ? headers.Expect || headers.expect : undefined;
|
|
7
|
+
let timeoutId = -1;
|
|
8
|
+
let sendBody = true;
|
|
9
|
+
if (!externalAgent && expect === "100-continue") {
|
|
10
|
+
sendBody = await Promise.race([
|
|
11
|
+
new Promise((resolve) => {
|
|
12
|
+
timeoutId = Number(timing.setTimeout(() => resolve(true), Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs)));
|
|
13
|
+
}),
|
|
14
|
+
new Promise((resolve) => {
|
|
15
|
+
httpRequest.on("continue", () => {
|
|
16
|
+
timing.clearTimeout(timeoutId);
|
|
17
|
+
resolve(true);
|
|
18
|
+
});
|
|
19
|
+
httpRequest.on("response", () => {
|
|
20
|
+
timing.clearTimeout(timeoutId);
|
|
21
|
+
resolve(false);
|
|
22
|
+
});
|
|
23
|
+
httpRequest.on("error", () => {
|
|
24
|
+
timing.clearTimeout(timeoutId);
|
|
25
|
+
resolve(false);
|
|
26
|
+
});
|
|
27
|
+
}),
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
if (sendBody) {
|
|
31
|
+
writeBody(httpRequest, request.body);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function writeBody(httpRequest, body) {
|
|
35
|
+
if (body instanceof Readable) {
|
|
36
|
+
body.pipe(httpRequest);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (body) {
|
|
40
|
+
const isBuffer = Buffer.isBuffer(body);
|
|
41
|
+
const isString = typeof body === "string";
|
|
42
|
+
if (isBuffer || isString) {
|
|
43
|
+
if (isBuffer && body.byteLength === 0) {
|
|
44
|
+
httpRequest.end();
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
httpRequest.end(body);
|
|
48
|
+
}
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const uint8 = body;
|
|
52
|
+
if (typeof uint8 === "object" &&
|
|
53
|
+
uint8.buffer &&
|
|
54
|
+
typeof uint8.byteOffset === "number" &&
|
|
55
|
+
typeof uint8.byteLength === "number") {
|
|
56
|
+
httpRequest.end(Buffer.from(uint8.buffer, uint8.byteOffset, uint8.byteLength));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
httpRequest.end(Buffer.from(body));
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
httpRequest.end();
|
|
63
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@smithy/node-http-handler",
|
|
3
|
+
"version": "4.12.1",
|
|
4
|
+
"description": "Provides a way to make requests",
|
|
5
|
+
"homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/node-http-handler",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "AWS SDK for JavaScript Team",
|
|
9
|
+
"email": "",
|
|
10
|
+
"url": "https://aws.amazon.com/sdk-for-javascript/"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/smithy-lang/smithy-typescript.git",
|
|
15
|
+
"directory": "packages/node-http-handler"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist-*/**"
|
|
19
|
+
],
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"main": "./dist-cjs/index.js",
|
|
22
|
+
"module": "./dist-es/index.js",
|
|
23
|
+
"types": "./dist-types/index.d.ts",
|
|
24
|
+
"typesVersions": {
|
|
25
|
+
"<4.5": {
|
|
26
|
+
"dist-types/*": [
|
|
27
|
+
"dist-types/ts3.4/*"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
|
|
33
|
+
"build:es:cjs": "node ../../scripts/compilation/es_cjs.js",
|
|
34
|
+
"build:types": "premove dist-types && yarn g:tsc -p tsconfig.types.json",
|
|
35
|
+
"build:types:downlevel": "premove dist-types/ts3.4 && downlevel-dts dist-types dist-types/ts3.4",
|
|
36
|
+
"clean": "premove dist-cjs dist-es dist-types",
|
|
37
|
+
"extract:docs": "api-extractor run --local",
|
|
38
|
+
"test": "yarn g:vitest run",
|
|
39
|
+
"test:watch": "yarn g:vitest watch"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@smithy/core": "^3.33.3",
|
|
43
|
+
"@smithy/types": "^4.18.0",
|
|
44
|
+
"tslib": "^2.6.2"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@smithy/abort-controller": "^4.4.2",
|
|
48
|
+
"@types/node": "^18.11.9",
|
|
49
|
+
"concurrently": "7.0.0",
|
|
50
|
+
"downlevel-dts": "0.10.1",
|
|
51
|
+
"premove": "4.0.0"
|
|
52
|
+
},
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=18.0.0"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -592,7 +592,7 @@ var ClientModuleRegistry = class extends Service {
|
|
|
592
592
|
constructor(ctx) {
|
|
593
593
|
super(ctx, "clientModules");
|
|
594
594
|
const { version } = createRequire(import.meta.url)("../package.json");
|
|
595
|
-
const commit = "
|
|
595
|
+
const commit = "0e304d9";
|
|
596
596
|
this.release = {
|
|
597
597
|
version,
|
|
598
598
|
commit
|
|
@@ -195,7 +195,7 @@ window.__ModuleLoader__.load({
|
|
|
195
195
|
const SCROLLBAR_LINGER_MS = 2e3;
|
|
196
196
|
/** Format complete-build metadata for the local brand badge. */
|
|
197
197
|
function localBuildVersion() {
|
|
198
|
-
return `0.2.1-rc.3-
|
|
198
|
+
return `0.2.1-rc.3-0e304d9` + ({}.DSH_CLIENT_GIT_DIRTY === "true" ? "-dirty" : "");
|
|
199
199
|
}
|
|
200
200
|
/** Analytics category of an official panel; other panels are never reported. */
|
|
201
201
|
function officialEntry(id) {
|
|
@@ -264,75 +264,62 @@ function toPiAssistant(message, onDegrade) {
|
|
|
264
264
|
* @module dsh-llm-pi-ai/catalog-supplement
|
|
265
265
|
*/
|
|
266
266
|
/** One provider route's supplemental models, keyed by model id. */
|
|
267
|
-
const SUPPLEMENT = {
|
|
268
|
-
|
|
269
|
-
id: "
|
|
270
|
-
name: "
|
|
271
|
-
api: "
|
|
272
|
-
provider: "
|
|
273
|
-
baseUrl: "https://api
|
|
267
|
+
const SUPPLEMENT = { openrouter: {
|
|
268
|
+
"deepseek/deepseek-v4.1-flash-1017": {
|
|
269
|
+
id: "deepseek/deepseek-v4.1-flash-1017",
|
|
270
|
+
name: "DeepSeek: DeepSeek V4.1 Flash (1017)",
|
|
271
|
+
api: "openai-completions",
|
|
272
|
+
provider: "openrouter",
|
|
273
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
274
274
|
reasoning: true,
|
|
275
275
|
input: ["text", "image"],
|
|
276
276
|
cost: {
|
|
277
|
-
input: .
|
|
278
|
-
output: .
|
|
279
|
-
cacheRead: .
|
|
280
|
-
cacheWrite:
|
|
281
|
-
tiers: [{
|
|
282
|
-
inputTokensAbove: 1e5,
|
|
283
|
-
input: .5,
|
|
284
|
-
output: 2.5,
|
|
285
|
-
cacheRead: .05,
|
|
286
|
-
cacheWrite: .625
|
|
287
|
-
}]
|
|
277
|
+
input: .05,
|
|
278
|
+
output: .6,
|
|
279
|
+
cacheRead: .006,
|
|
280
|
+
cacheWrite: 0
|
|
288
281
|
},
|
|
289
282
|
contextWindow: 1e6,
|
|
290
|
-
maxTokens:
|
|
283
|
+
maxTokens: 943718,
|
|
291
284
|
compat: {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
285
|
+
supportsDeveloperRole: false,
|
|
286
|
+
thinkingFormat: "openrouter",
|
|
287
|
+
supportsStrictMode: true,
|
|
288
|
+
sendSessionAffinityHeaders: true,
|
|
289
|
+
requiresReasoningContentOnAssistantMessages: true
|
|
297
290
|
},
|
|
298
291
|
thinkingLevelMap: {
|
|
299
|
-
off:
|
|
300
|
-
|
|
292
|
+
off: "none",
|
|
293
|
+
minimal: null,
|
|
294
|
+
low: "low",
|
|
295
|
+
medium: null,
|
|
296
|
+
high: "high",
|
|
297
|
+
xhigh: null,
|
|
301
298
|
max: "max"
|
|
302
299
|
},
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
images: {
|
|
310
|
-
maxPerRequest: 600,
|
|
311
|
-
resize: {
|
|
312
|
-
maxWidth: 2e3,
|
|
313
|
-
maxHeight: 2e3,
|
|
314
|
-
maxBytes: 4718592,
|
|
315
|
-
jpegQuality: 80
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
},
|
|
300
|
+
inputLimits: { images: { resize: {
|
|
301
|
+
maxWidth: 2e3,
|
|
302
|
+
maxHeight: 2e3,
|
|
303
|
+
maxBytes: 4718592,
|
|
304
|
+
jpegQuality: 80
|
|
305
|
+
} } },
|
|
319
306
|
type: "chat"
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
id: "
|
|
323
|
-
name: "
|
|
307
|
+
},
|
|
308
|
+
"moonshotai/kimi-k3.1-pro": {
|
|
309
|
+
id: "moonshotai/kimi-k3.1-pro",
|
|
310
|
+
name: "MoonshotAI: Kimi K3.1 Pro",
|
|
324
311
|
api: "openai-completions",
|
|
325
312
|
provider: "openrouter",
|
|
326
313
|
baseUrl: "https://openrouter.ai/api/v1",
|
|
327
314
|
reasoning: true,
|
|
328
315
|
input: ["text", "image"],
|
|
329
316
|
cost: {
|
|
330
|
-
input:
|
|
331
|
-
output:
|
|
332
|
-
cacheRead: .
|
|
317
|
+
input: 2,
|
|
318
|
+
output: 10,
|
|
319
|
+
cacheRead: .2,
|
|
333
320
|
cacheWrite: 0
|
|
334
321
|
},
|
|
335
|
-
contextWindow:
|
|
322
|
+
contextWindow: 1048576,
|
|
336
323
|
maxTokens: 943718,
|
|
337
324
|
compat: {
|
|
338
325
|
supportsDeveloperRole: false,
|
|
@@ -357,8 +344,8 @@ const SUPPLEMENT = {
|
|
|
357
344
|
jpegQuality: 80
|
|
358
345
|
} } },
|
|
359
346
|
type: "chat"
|
|
360
|
-
}
|
|
361
|
-
};
|
|
347
|
+
}
|
|
348
|
+
} };
|
|
362
349
|
/**
|
|
363
350
|
* Supplemental catalog models for one pi-ai provider route.
|
|
364
351
|
* @param provider - provider route key.
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
en: 312d9a3ea1cbb673
|
|
22
22
|
zh: 937ff76d6bdcca22
|
|
23
23
|
/deepseek-ai-dsh-tui-app/use-this-package/the-screen:
|
|
24
|
-
en:
|
|
25
|
-
zh:
|
|
24
|
+
en: 1155765ad37935b7
|
|
25
|
+
zh: e360ed61ff7a0c3f
|
|
26
26
|
/deepseek-ai-dsh-tui-app/use-this-package/keys-and-commands:
|
|
27
|
-
en:
|
|
28
|
-
zh:
|
|
27
|
+
en: 263974603b2a6475
|
|
28
|
+
zh: db75b82e1ba5a739
|
|
29
29
|
/deepseek-ai-dsh-tui-app/use-this-package/background-tool-calls:
|
|
30
30
|
en: 322ae3c6d76383ec
|
|
31
31
|
zh: 8c38eee4b57ed8dd
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
en: 142f04bf29e981dd
|
|
58
58
|
zh: a1689297b06c9ca6
|
|
59
59
|
/deepseek-ai-dsh-tui-app/understand-the-implementation/source-map:
|
|
60
|
-
en:
|
|
61
|
-
zh:
|
|
60
|
+
en: a57dca95a7bb2911
|
|
61
|
+
zh: bd1960aff88d2df4
|
|
62
62
|
/deepseek-ai-dsh-tui-app/understand-the-implementation/invariant-ownership:
|
|
63
63
|
en: 0ddf6de8928026d5
|
|
64
64
|
zh: 24feedcbb9e9d676
|
|
@@ -40,7 +40,7 @@ Once a quit has saved the session, the app prints `dsh: session <id> saved; resu
|
|
|
40
40
|
|
|
41
41
|
### The screen
|
|
42
42
|
|
|
43
|
-
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. 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.
|
|
43
|
+
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, 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.
|
|
44
44
|
|
|
45
45
|
Below the transcript sit a spinner while the agent works — `thinking`, `writing`, `calling <tool>`, a retry, or `compacting`, each beside its own braille animation: circling dots, filling lines, an orbiting dot, a sliding bar, or a settling cell — with a bright highlight sweeping across the word, plus live `↑` send and `↓` receive tokens for the current model call, as compact `k` / `M` / `B` counts, growing as the stream arrives and settling on the provider usage chunk — any open prompt, a boxed follow-ups list while messages wait, an activity board of the open turn's todos and one row per subagent while either has a row — completed todo content scratched out and status glyphs colored green, yellow, or blue, the in-progress one a spinner, at most four todo rows then `+<n> more`, each subagent row its spinner or `✓` / `✗`, its task label — `<name> · <role>` for an Agent Teams teammate — and the last sentence of what it said it was doing, cut to one terminal line, running subagents first and at most three then `+<n> more subagents`, not a focus region, gone on `turn/end` and bind — the editor, the subagent panel, and the footer: a status bar that, unfocused, is one line built from both ends inward. The editor's caret is the terminal's own blinking bar: the app asks for that shape at start, gives your default back on quit, and draws no caret at all while the status bar or the panel holds the keyboard. The model is purple and the entry keys magenta; live turn, context, and todo facts use yellow, magenta, and green. The model is anchored at the left edge and is never dropped — past 20 columns it falls back to the bare model name, and only a label still too wide for that is ellipsized — and the two keys that leave the input are anchored at the right edge as `Shift+↑ read · Shift+↓ status`, or `Shift+↑ select · Shift+↓ status` while follow-ups wait, narrowing to `Shift+↑↓ nav` and dropped below 40 columns. The key facts fill whatever middle is left, in bar order: effort (`effort default` when the selection leaves reasoning to the model), the running turn's elapsed time, the context window percentage, the todo counts, and the workspace path (shortened with `~` and `…/` when long). Every segment that middle cannot hold folds into a trailing `+N`, together with the segments the unfocused line never draws — the permission preset, token usage (session totals plus the in-flight call), the goal and plan-mode markers from the projection seam, and the count of pending attachments. Model-request retries appear as notices, the same facts the browser's markers carry.
|
|
46
46
|
|
|
@@ -169,7 +169,7 @@ Every other key reaching the reader is consumed, and closing it opens the same 7
|
|
|
169
169
|
|
|
170
170
|
Every focused segment expands its most important facts on the second line. `Enter` prints those facts into the transcript for every segment except `todo`, stating what they are and what changes them: the model segment names `/model`, the effort segment names the picker shared by `Shift+Tab` and `/effort`, and the permission segment names its preset and the `/permission` picker, the `turn` segment — drawn as `turn <elapsed>` between the permission and usage segments, and only while a turn runs — gives the turn number, its start time, its elapsed time, and the queued-message counts, while the usage, context, goal, and plan segments print the matching sections of the `/status` report, the workspace segment the full path, and the attachments segment the pending attachments. The `todo` segment expands the counts by status and the item being worked on, or the next pending item when none is in progress, and `Enter` opens the agent's todo list, the same list `/todos` opens.
|
|
171
171
|
|
|
172
|
-
Typing `/` at the start of the editor completes the terminal's own commands and the shared registry's; `@` anywhere completes references. A nonempty `!command` or `!!command` line runs through `ctx.shell` in the session cwd at `danger-full-access`; the draft and the transcript `$ command` row use syntax colours, and the transcript shows
|
|
172
|
+
Typing `/` at the start of the editor completes the terminal's own commands and the shared registry's; `@` anywhere completes references. A nonempty `!command` or `!!command` line runs through `ctx.shell` in the session cwd at `danger-full-access`; the draft and the transcript `$ command` row use syntax colours, and the transcript shows dimmed output or the JSON tree under that row. `!` injects a plugin notice for the next admitted step; `!!` does not. A lone `!` is an ordinary prompt. The editor border turns warning-coloured while the draft starts with `!`.
|
|
173
173
|
|
|
174
174
|
| Command | Effect |
|
|
175
175
|
|---|---|
|
|
@@ -336,6 +336,7 @@ The patch rides over `dsh-base`: it sets the coding persona prefix and cwd suffi
|
|
|
336
336
|
| [`src/toast.ts`](src/toast.ts) | The transient key-feedback line: its overlay, its clock, and the lines it carries |
|
|
337
337
|
| [`src/pinned-prompt.ts`](src/pinned-prompt.ts) | The prompt row the reader pins over a scrolled turn: the glyph, the prompt collapsed to one line, and the band |
|
|
338
338
|
| [`src/transcript.ts`](src/transcript.ts) | Pure text folding of presentation views, usage, and turn-end reasons, the `$ command` span, and the one fold grammar every marker is written in |
|
|
339
|
+
| [`src/json-tree.ts`](src/json-tree.ts) | Complete JSON objects and arrays as tree rows, their semantic token ranges, and the distinction between shell commands and dimmed output |
|
|
339
340
|
| [`src/diff.ts`](src/diff.ts) | Line diff, hunk selection, and the addition and removal marks diff cards box |
|
|
340
341
|
| [`src/style.ts`](src/style.ts) | The palette: the Tokyo Night hues as truecolor or 256-color SGR, the semantic roles drawn in them — including the heading and link hues a Markdown reply uses and the tool-name, call-subject, and model hues — the strikethrough role completed todo content uses, the background band a prompt is drawn on and the darker one a steered or injected prompt is drawn on, the green and red fills and sign colours of a diff card's changed rows, whether key chips are clickable, and the derived pi-tui themes |
|
|
341
342
|
| [`src/highlight.ts`](src/highlight.ts) | Syntax colour for fenced code, file rows, and shell commands: the grammars a block may load, the theme the background picks, and the SGR one token is drawn with |
|