@songtonyli/dsh-cli 0.1.80 → 0.1.82
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/core/dist-cjs/submodules/protocols/index.js +94 -1589
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/index.js +1 -7
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +1 -3
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js +1 -3
- package/node_modules/@aws-sdk/core/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-env/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-http/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +10 -10
- package/node_modules/@aws-sdk/credential-provider-login/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-node/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-process/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +4 -4
- package/node_modules/@aws-sdk/eventstream-handler-node/package.json +2 -2
- package/node_modules/@aws-sdk/middleware-eventstream/package.json +2 -2
- package/node_modules/@aws-sdk/middleware-websocket/package.json +3 -3
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/package.json +3 -3
- package/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +37 -19
- package/node_modules/@aws-sdk/token-providers/dist-es/fromSso.js +37 -19
- package/node_modules/@aws-sdk/token-providers/package.json +4 -4
- 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-subprocess-local/README.i18n.yaml +14 -14
- package/node_modules/@deepseek-ai/dsh-subprocess-local/README.md +7 -5
- package/node_modules/@deepseek-ai/dsh-subprocess-local/README.zh.md +7 -5
- package/node_modules/@deepseek-ai/dsh-subprocess-local/lib/index.js +15 -3
- package/node_modules/@deepseek-ai/dsh-subprocess-local/lib/runner-launch-f9xQyTek.js +1669 -0
- package/node_modules/@deepseek-ai/dsh-subprocess-local/lib/runner.js +1 -1
- package/node_modules/@deepseek-ai/dsh-tui-app/README.i18n.yaml +19 -16
- package/node_modules/@deepseek-ai/dsh-tui-app/README.md +30 -13
- package/node_modules/@deepseek-ai/dsh-tui-app/README.zh.md +30 -13
- package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +615 -245
- package/node_modules/execa/lib/convert/duplex.js +8 -4
- package/node_modules/execa/lib/convert/readable.js +3 -8
- package/node_modules/execa/lib/convert/writable.js +6 -5
- package/node_modules/execa/lib/io/input-sync.js +2 -1
- package/node_modules/execa/lib/io/max-buffer.js +2 -1
- package/node_modules/execa/lib/io/output-sync.js +2 -1
- package/node_modules/execa/lib/methods/create.js +7 -0
- package/node_modules/execa/lib/methods/node.js +1 -1
- package/node_modules/execa/lib/methods/script.js +3 -3
- package/node_modules/execa/lib/resolve/all-async.js +2 -1
- package/node_modules/execa/lib/resolve/wait-subprocess.js +6 -0
- package/node_modules/execa/lib/stdio/handle-async.js +3 -2
- package/node_modules/execa/lib/stdio/handle.js +8 -3
- package/node_modules/execa/lib/transform/generator.js +7 -0
- package/node_modules/execa/lib/transform/run-sync.js +17 -5
- package/node_modules/execa/package.json +1 -1
- package/package.json +16 -16
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonSettings.js +0 -1
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonCodec.js +0 -20
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonSettings.js +0 -1
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeDeserializer.js +0 -160
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeSerializer.js +0 -193
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.js +0 -103
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonCodec2.js +0 -20
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.js +0 -200
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeSerializer2.js +0 -519
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/detectBufferParsing.js +0 -18
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReplacer.js +0 -46
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReviver.js +0 -121
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/needsReviver.js +0 -41
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/parseJsonBody.js +0 -89
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import {Duplex} from 'node:stream';
|
|
2
2
|
import {callbackify} from 'node:util';
|
|
3
3
|
import {BINARY_ENCODINGS} from '../arguments/encoding-option.js';
|
|
4
|
+
import {getFromStream, getToStream} from '../arguments/fd-options.js';
|
|
4
5
|
import {copyOptions, checkBooleanOption} from '../utils/options.js';
|
|
6
|
+
import {addConcurrentStream} from './concurrent.js';
|
|
5
7
|
import {
|
|
6
|
-
getSubprocessStdout,
|
|
7
8
|
getReadableOptions,
|
|
8
9
|
getReadableMethods,
|
|
9
10
|
onStdoutFinished,
|
|
10
11
|
onReadableDestroy,
|
|
11
12
|
} from './readable.js';
|
|
12
13
|
import {
|
|
13
|
-
|
|
14
|
+
addWritableConcurrentStreams,
|
|
14
15
|
getWritableMethods,
|
|
15
16
|
onStdinFinished,
|
|
16
17
|
onWritableDestroy,
|
|
@@ -22,8 +23,11 @@ export const createDuplex = ({subprocess, concurrentStreams, encoding}, options)
|
|
|
22
23
|
checkBooleanOption(binaryOption, 'binary');
|
|
23
24
|
checkBooleanOption(preserveNewlines, 'preserveNewlines');
|
|
24
25
|
const binary = binaryOption || BINARY_ENCODINGS.has(encoding);
|
|
25
|
-
|
|
26
|
-
const
|
|
26
|
+
// Validate both directions before registering lifecycle waits, since a thrown option error must not leave a concurrent stream behind.
|
|
27
|
+
const subprocessStdout = getFromStream(subprocess, from);
|
|
28
|
+
const subprocessStdin = getToStream(subprocess, to);
|
|
29
|
+
const waitReadableDestroy = addConcurrentStream(concurrentStreams, subprocessStdout, 'readableDestroy');
|
|
30
|
+
const {waitWritableFinal, waitWritableDestroy} = addWritableConcurrentStreams(concurrentStreams, subprocessStdin);
|
|
27
31
|
const {readableEncoding, readableObjectMode, readableHighWaterMark} = getReadableOptions(subprocessStdout, binary);
|
|
28
32
|
const {read, onStdoutDataDone} = getReadableMethods({
|
|
29
33
|
subprocessStdout,
|
|
@@ -19,7 +19,9 @@ export const createReadable = ({subprocess, concurrentStreams, encoding}, option
|
|
|
19
19
|
checkBooleanOption(binaryOption, 'binary');
|
|
20
20
|
checkBooleanOption(preserveNewlines, 'preserveNewlines');
|
|
21
21
|
const binary = binaryOption || BINARY_ENCODINGS.has(encoding);
|
|
22
|
-
|
|
22
|
+
// Retrieve `stdout` (or other stream depending on `from`)
|
|
23
|
+
const subprocessStdout = getFromStream(subprocess, from);
|
|
24
|
+
const waitReadableDestroy = addConcurrentStream(concurrentStreams, subprocessStdout, 'readableDestroy');
|
|
23
25
|
const {readableEncoding, readableObjectMode, readableHighWaterMark} = getReadableOptions(subprocessStdout, binary);
|
|
24
26
|
const {read, onStdoutDataDone} = getReadableMethods({
|
|
25
27
|
subprocessStdout,
|
|
@@ -44,13 +46,6 @@ export const createReadable = ({subprocess, concurrentStreams, encoding}, option
|
|
|
44
46
|
return readable;
|
|
45
47
|
};
|
|
46
48
|
|
|
47
|
-
// Retrieve `stdout` (or other stream depending on `from`)
|
|
48
|
-
export const getSubprocessStdout = (subprocess, from, concurrentStreams) => {
|
|
49
|
-
const subprocessStdout = getFromStream(subprocess, from);
|
|
50
|
-
const waitReadableDestroy = addConcurrentStream(concurrentStreams, subprocessStdout, 'readableDestroy');
|
|
51
|
-
return {subprocessStdout, waitReadableDestroy};
|
|
52
|
-
};
|
|
53
|
-
|
|
54
49
|
export const getReadableOptions = ({readableEncoding, readableObjectMode, readableHighWaterMark}, binary) => binary
|
|
55
50
|
? {readableEncoding, readableObjectMode, readableHighWaterMark}
|
|
56
51
|
: {readableEncoding, readableObjectMode: true, readableHighWaterMark: DEFAULT_OBJECT_HIGH_WATER_MARK};
|
|
@@ -14,7 +14,9 @@ import {
|
|
|
14
14
|
// Create a `Writable` stream that forwards to `stdin` and awaits the subprocess
|
|
15
15
|
export const createWritable = ({subprocess, concurrentStreams}, options) => {
|
|
16
16
|
const {to} = copyOptions(options);
|
|
17
|
-
|
|
17
|
+
// Retrieve `stdin` (or other stream depending on `to`)
|
|
18
|
+
const subprocessStdin = getToStream(subprocess, to);
|
|
19
|
+
const {waitWritableFinal, waitWritableDestroy} = addWritableConcurrentStreams(concurrentStreams, subprocessStdin);
|
|
18
20
|
const writable = new Writable({
|
|
19
21
|
...getWritableMethods(subprocessStdin, subprocess, waitWritableFinal),
|
|
20
22
|
destroy: callbackify(onWritableDestroy.bind(undefined, {
|
|
@@ -30,12 +32,11 @@ export const createWritable = ({subprocess, concurrentStreams}, options) => {
|
|
|
30
32
|
return writable;
|
|
31
33
|
};
|
|
32
34
|
|
|
33
|
-
//
|
|
34
|
-
export const
|
|
35
|
-
const subprocessStdin = getToStream(subprocess, to);
|
|
35
|
+
// Register both writable lifecycle waits for an already validated stream.
|
|
36
|
+
export const addWritableConcurrentStreams = (concurrentStreams, subprocessStdin) => {
|
|
36
37
|
const waitWritableFinal = addConcurrentStream(concurrentStreams, subprocessStdin, 'writableFinal');
|
|
37
38
|
const waitWritableDestroy = addConcurrentStream(concurrentStreams, subprocessStdin, 'writableDestroy');
|
|
38
|
-
return {
|
|
39
|
+
return {waitWritableFinal, waitWritableDestroy};
|
|
39
40
|
};
|
|
40
41
|
|
|
41
42
|
export const getWritableMethods = (subprocessStdin, subprocess, waitWritableFinal) => ({
|
|
@@ -17,7 +17,8 @@ const getInputFdNumbers = fileDescriptors => new Set(Object.entries(fileDescript
|
|
|
17
17
|
const addInputOptionSync = (fileDescriptors, fdNumber, options) => {
|
|
18
18
|
const {stdioItems} = fileDescriptors[fdNumber];
|
|
19
19
|
const allStdioItems = stdioItems.filter(({contents}) => contents !== undefined);
|
|
20
|
-
|
|
20
|
+
// Even without an input source, generators must run so that `final` can produce input or report errors.
|
|
21
|
+
if (allStdioItems.length === 0 && stdioItems.every(({type}) => type !== 'generator')) {
|
|
21
22
|
return;
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -63,7 +63,8 @@ const getMaxBufferInfo = (error, maxBuffer) => {
|
|
|
63
63
|
// The native `maxBuffer` option passed to `spawnSync()` does not allow differentiating values per file descriptor, so we use `stdout`'s.
|
|
64
64
|
// Since each other file descriptor's own limit is capped by `stdout`'s, this is also the highest one.
|
|
65
65
|
// Node.js applies it to the total output of all piped file descriptors, not to each of them. When it is hit, the subprocess is killed and a `ENOBUFS` error is thrown.
|
|
66
|
-
|
|
66
|
+
// Node.js disables its limit at zero, so use the smallest positive value to reject the first output byte.
|
|
67
|
+
export const getMaxBufferSync = ([, stdoutMaxBuffer]) => stdoutMaxBuffer === 0 ? Number.MIN_VALUE : stdoutMaxBuffer;
|
|
67
68
|
|
|
68
69
|
// File descriptors with a limit lower than `spawnSync()`'s native `maxBuffer` are enforced from the output, after the subprocess exits.
|
|
69
70
|
// Since no native error was thrown, we create the `ENOBUFS` error ourselves.
|
|
@@ -83,7 +83,8 @@ const runOutputGeneratorsSync = (chunks, stdioItems, encoding) => {
|
|
|
83
83
|
// `error` is set, so that a polluted `Object.prototype.error` is not read when destructuring
|
|
84
84
|
return {chunks: runGeneratorsSync(chunks, stdioItems, encoding, false), error: undefined};
|
|
85
85
|
} catch (error) {
|
|
86
|
-
|
|
86
|
+
// Raw output must not bypass a failed transform, which might be filtering sensitive data.
|
|
87
|
+
return {chunks: [], error};
|
|
87
88
|
}
|
|
88
89
|
};
|
|
89
90
|
|
|
@@ -50,6 +50,13 @@ const parseArguments = ({mapArguments, firstArgument, nextArguments, deepOptions
|
|
|
50
50
|
: [firstArgument, ...nextArguments];
|
|
51
51
|
const [initialFile, initialArguments, initialOptions] = normalizeParameters(...callArguments);
|
|
52
52
|
const mergedOptions = mergeOptions(mergeOptions(deepOptions, boundOptions), initialOptions);
|
|
53
|
+
// Explicit `undefined` resets to the method's default, including on pipe destinations.
|
|
54
|
+
for (const [optionName, optionValue] of Object.entries(deepOptions)) {
|
|
55
|
+
if (mergedOptions[optionName] === undefined) {
|
|
56
|
+
mergedOptions[optionName] = optionValue;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
53
60
|
// `mapArguments()` returns a plain object, so its result is read from a null-prototype copy.
|
|
54
61
|
// Otherwise a polluted `Object.prototype` would replace every option, or switch the execution mode.
|
|
55
62
|
const {
|
|
@@ -32,7 +32,7 @@ const getDefaultNodeOptions = () => {
|
|
|
32
32
|
|
|
33
33
|
// Those options are followed by a separate value, which is removed too
|
|
34
34
|
const REMOVED_OPTIONS_WITH_VALUE = new Set(['-e', '--eval', '-p', '--print', '-pe', '--input-type', '--inspect-port']);
|
|
35
|
-
const IGNORED_OPTIONS_REGEXP = /^--(?:inspect|eval=|input-type=)/;
|
|
35
|
+
const IGNORED_OPTIONS_REGEXP = /^--(?:inspect|eval=|print=|input-type=)/;
|
|
36
36
|
|
|
37
37
|
// Applies the `node: true` option, and the related `nodePath`/`nodeOptions` options.
|
|
38
38
|
// Modifies the file commands/arguments to ensure the same Node binary and flags are re-used.
|
|
@@ -11,10 +11,10 @@ export const mapScriptAsync = ({options}) => getScriptOptions(options);
|
|
|
11
11
|
const mapScriptSync = ({options}) => ({...getScriptOptions(options), isSync: true});
|
|
12
12
|
|
|
13
13
|
// `$` is like `execa` but with script-friendly options: `{stdin: 'inherit', preferLocal: true}`
|
|
14
|
-
const getScriptOptions = options => ({options: {__proto__: null, ...
|
|
14
|
+
const getScriptOptions = options => ({options: {__proto__: null, ...options, ...getScriptStdinOption(options)}});
|
|
15
15
|
|
|
16
|
-
const getScriptStdinOption = ({input, inputFile, stdio}) => input === undefined && inputFile === undefined && stdio === undefined
|
|
17
|
-
? {stdin
|
|
16
|
+
const getScriptStdinOption = ({stdin = 'inherit', input, inputFile, stdio}) => input === undefined && inputFile === undefined && stdio === undefined
|
|
17
|
+
? {stdin}
|
|
18
18
|
: {};
|
|
19
19
|
|
|
20
20
|
// When using $(...).pipe(...), most script-friendly options should apply to both commands.
|
|
@@ -32,7 +32,8 @@ export const waitForAllStream = ({subprocess, all, encoding, buffer, maxBuffer,
|
|
|
32
32
|
maxBuffer: maxBuffer[1] + maxBuffer[2],
|
|
33
33
|
lines: lines[1] || lines[2],
|
|
34
34
|
allFds: getAllFds(subprocess, buffer),
|
|
35
|
-
|
|
35
|
+
// A single buffered descriptor keeps its own object mode, even when the merged stream has mixed modes.
|
|
36
|
+
allMixed: stream === all && getAllMixed(subprocess, all),
|
|
36
37
|
stripFinalNewline,
|
|
37
38
|
verboseInfo,
|
|
38
39
|
streamInfo,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {once} from 'node:events';
|
|
2
2
|
import {isStream as isNodeStream} from 'is-stream';
|
|
3
|
+
import {MaxBufferError} from 'get-stream';
|
|
3
4
|
import {throwOnTimeout} from '../terminate/timeout.js';
|
|
4
5
|
import {throwOnCancel} from '../terminate/cancel.js';
|
|
5
6
|
import {throwOnGracefulCancel} from '../terminate/graceful.js';
|
|
@@ -114,6 +115,11 @@ export const waitForSubprocessResult = async ({
|
|
|
114
115
|
]);
|
|
115
116
|
} catch (error) {
|
|
116
117
|
context.terminationReason ??= 'other';
|
|
118
|
+
// Closing the output stream does not stop a subprocess that stays alive without writing again.
|
|
119
|
+
if (error instanceof MaxBufferError) {
|
|
120
|
+
kill();
|
|
121
|
+
}
|
|
122
|
+
|
|
117
123
|
return Promise.all([
|
|
118
124
|
{error},
|
|
119
125
|
exitPromise,
|
|
@@ -68,7 +68,7 @@ const addPropertiesAsync = {
|
|
|
68
68
|
asyncGenerator: generatorToInputStream,
|
|
69
69
|
fileUrl: ({value}) => ({stream: createReadStream(value)}),
|
|
70
70
|
filePath: ({value: {file}}) => ({stream: createReadStream(file)}),
|
|
71
|
-
webStream: ({value}) => ({stream: Readable.fromWeb(value)}),
|
|
71
|
+
webStream: ({value}, options, objectMode) => ({stream: Readable.fromWeb(value, {objectMode})}),
|
|
72
72
|
iterable: ({value, optionName}, options, objectMode) => ({stream: Readable.from(objectMode ? value : validateIterable(value, optionName))}),
|
|
73
73
|
asyncIterable: ({value, optionName}, options, objectMode) => ({stream: Readable.from(objectMode ? value : validateAsyncIterable(value, optionName))}),
|
|
74
74
|
string: ({value}) => ({stream: readableFromChunk(value)}),
|
|
@@ -78,7 +78,8 @@ const addPropertiesAsync = {
|
|
|
78
78
|
...addProperties,
|
|
79
79
|
fileUrl: ({value}) => ({stream: createWriteStream(value)}),
|
|
80
80
|
filePath: ({value: {file, append}}) => ({stream: createWriteStream(file, append ? {flags: 'a'} : {})}),
|
|
81
|
-
|
|
81
|
+
// Web writers accept arbitrary chunks, including when a shared writer receives both bytes and objects.
|
|
82
|
+
webStream: ({value}) => ({stream: Writable.fromWeb(value, {objectMode: true})}),
|
|
82
83
|
iterable: forbiddenIfAsync,
|
|
83
84
|
asyncIterable: forbiddenIfAsync,
|
|
84
85
|
string: forbiddenIfAsync,
|
|
@@ -142,10 +142,15 @@ const validateStreams = (stdioItems, isStdioArray) => {
|
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
144
|
|
|
145
|
-
//
|
|
145
|
+
// File descriptors can be passed as numbers or native objects with an `fd` property. Invalid descriptors can make `node:child_process` abort the current process with a fatal assertion instead of throwing.
|
|
146
146
|
const validateFileDescriptorStdio = ({type, value, optionName}) => {
|
|
147
|
-
if (type
|
|
148
|
-
|
|
147
|
+
if (type !== 'native') {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const fileDescriptor = typeof value === 'number' ? value : value?.fd;
|
|
152
|
+
if (typeof fileDescriptor === 'number' && (!Number.isInteger(fileDescriptor) || fileDescriptor < 0 || fileDescriptor > MAX_FILE_DESCRIPTOR)) {
|
|
153
|
+
throw new TypeError(`The \`${optionName}\` option must be a non-negative 32-bit integer: got ${fileDescriptor}.`);
|
|
149
154
|
}
|
|
150
155
|
};
|
|
151
156
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {Transform, getDefaultHighWaterMark} from 'node:stream';
|
|
2
|
+
import {Buffer} from 'node:buffer';
|
|
2
3
|
import {getStringEncoding} from '../arguments/encoding-option.js';
|
|
3
4
|
import {isAsyncGenerator} from '../stdio/type.js';
|
|
4
5
|
import {getSplitLinesGenerator, getAppendNewlineGenerator} from './split.js';
|
|
@@ -86,6 +87,12 @@ export const runGeneratorsSync = (chunks, stdioItems, encoding, isInput) => {
|
|
|
86
87
|
const reversedGenerators = isInput ? generators.reverse() : generators;
|
|
87
88
|
|
|
88
89
|
for (const {value, optionName} of reversedGenerators) {
|
|
90
|
+
// Byte-mode transforms encode strings before decoding them, like Transform's `decodeStrings` option.
|
|
91
|
+
if (!value.writableObjectMode) {
|
|
92
|
+
const stringEncoding = getStringEncoding(value.binary, encoding);
|
|
93
|
+
chunks = chunks.map(chunk => typeof chunk === 'string' ? Buffer.from(chunk, stringEncoding) : chunk);
|
|
94
|
+
}
|
|
95
|
+
|
|
89
96
|
const generators = addInternalGenerators(value, encoding, optionName);
|
|
90
97
|
chunks = runTransformSync(generators, chunks);
|
|
91
98
|
}
|
|
@@ -7,15 +7,27 @@ export const pushChunksSync = (getChunksSync, getChunksArguments, transformStrea
|
|
|
7
7
|
|
|
8
8
|
done();
|
|
9
9
|
} catch (error) {
|
|
10
|
-
done(error);
|
|
10
|
+
done(normalizeTransformError(error));
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
// Match `util.callbackify()` so falsy exceptions cannot be mistaken for callback success or missing errors.
|
|
15
|
+
const normalizeTransformError = error => error || Object.assign(new Error('Promise was rejected with falsy value'), {
|
|
16
|
+
code: 'ERR_FALSY_VALUE_REJECTION',
|
|
17
|
+
reason: error,
|
|
18
|
+
});
|
|
19
|
+
|
|
14
20
|
// Run synchronous generators with `execaSync()`
|
|
15
|
-
export const runTransformSync = (generators, chunks) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
]
|
|
21
|
+
export const runTransformSync = (generators, chunks) => {
|
|
22
|
+
try {
|
|
23
|
+
return [
|
|
24
|
+
...chunks.flatMap(chunk => [...transformChunkSync(chunk, generators, 0)]),
|
|
25
|
+
...finalChunksSync(generators),
|
|
26
|
+
];
|
|
27
|
+
} catch (error) {
|
|
28
|
+
throw normalizeTransformError(error);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
19
31
|
|
|
20
32
|
export const transformChunkSync = function * (chunk, generators, index) {
|
|
21
33
|
if (index === generators.length) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@songtonyli/dsh-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.82",
|
|
4
4
|
"description": "The dsh terminal agent: an interactive TUI over the DeepSeek Harness, with its whole Node runtime bundled in one install.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -17,21 +17,21 @@
|
|
|
17
17
|
"@agentclientprotocol/sdk": "1.4.0",
|
|
18
18
|
"@anthropic-ai/sdk": "0.129.0",
|
|
19
19
|
"@aws-sdk/client-bedrock-runtime": "3.1127.0",
|
|
20
|
-
"@aws-sdk/core": "3.978.
|
|
21
|
-
"@aws-sdk/credential-provider-env": "3.972.
|
|
22
|
-
"@aws-sdk/credential-provider-http": "3.972.
|
|
23
|
-
"@aws-sdk/credential-provider-ini": "3.973.
|
|
24
|
-
"@aws-sdk/credential-provider-login": "3.972.
|
|
25
|
-
"@aws-sdk/credential-provider-node": "3.972.
|
|
26
|
-
"@aws-sdk/credential-provider-process": "3.972.
|
|
27
|
-
"@aws-sdk/credential-provider-sso": "3.973.
|
|
28
|
-
"@aws-sdk/credential-provider-web-identity": "3.972.
|
|
29
|
-
"@aws-sdk/eventstream-handler-node": "3.972.
|
|
30
|
-
"@aws-sdk/middleware-eventstream": "3.972.
|
|
31
|
-
"@aws-sdk/middleware-websocket": "3.972.
|
|
32
|
-
"@aws-sdk/nested-clients": "3.997.
|
|
20
|
+
"@aws-sdk/core": "3.978.4",
|
|
21
|
+
"@aws-sdk/credential-provider-env": "3.972.75",
|
|
22
|
+
"@aws-sdk/credential-provider-http": "3.972.77",
|
|
23
|
+
"@aws-sdk/credential-provider-ini": "3.973.20",
|
|
24
|
+
"@aws-sdk/credential-provider-login": "3.972.82",
|
|
25
|
+
"@aws-sdk/credential-provider-node": "3.972.87",
|
|
26
|
+
"@aws-sdk/credential-provider-process": "3.972.75",
|
|
27
|
+
"@aws-sdk/credential-provider-sso": "3.973.19",
|
|
28
|
+
"@aws-sdk/credential-provider-web-identity": "3.972.81",
|
|
29
|
+
"@aws-sdk/eventstream-handler-node": "3.972.37",
|
|
30
|
+
"@aws-sdk/middleware-eventstream": "3.972.32",
|
|
31
|
+
"@aws-sdk/middleware-websocket": "3.972.57",
|
|
32
|
+
"@aws-sdk/nested-clients": "3.997.49",
|
|
33
33
|
"@aws-sdk/signature-v4-multi-region": "3.996.48",
|
|
34
|
-
"@aws-sdk/token-providers": "3.
|
|
34
|
+
"@aws-sdk/token-providers": "3.1153.0",
|
|
35
35
|
"@aws-sdk/types": "3.974.6",
|
|
36
36
|
"@aws-sdk/xml-builder": "3.972.41",
|
|
37
37
|
"@aws/lambda-invoke-store": "0.3.0",
|
|
@@ -457,7 +457,7 @@
|
|
|
457
457
|
"etag": "1.8.1",
|
|
458
458
|
"eventsource": "3.0.7",
|
|
459
459
|
"eventsource-parser": "3.1.1",
|
|
460
|
-
"execa": "10.
|
|
460
|
+
"execa": "10.2.0",
|
|
461
461
|
"extend": "3.0.2",
|
|
462
462
|
"fast-deep-equal": "3.1.3",
|
|
463
463
|
"fast-sha256": "1.3.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
|
|
2
|
-
import { JsonShapeDeserializer } from "./JsonShapeDeserializer";
|
|
3
|
-
import { JsonShapeSerializer } from "./JsonShapeSerializer";
|
|
4
|
-
export class JsonCodec extends SerdeContextConfig {
|
|
5
|
-
settings;
|
|
6
|
-
constructor(settings) {
|
|
7
|
-
super();
|
|
8
|
-
this.settings = settings;
|
|
9
|
-
}
|
|
10
|
-
createSerializer() {
|
|
11
|
-
const serializer = new JsonShapeSerializer(this.settings);
|
|
12
|
-
serializer.setSerdeContext(this.serdeContext);
|
|
13
|
-
return serializer;
|
|
14
|
-
}
|
|
15
|
-
createDeserializer() {
|
|
16
|
-
const deserializer = new JsonShapeDeserializer(this.settings);
|
|
17
|
-
deserializer.setSerdeContext(this.serdeContext);
|
|
18
|
-
return deserializer;
|
|
19
|
-
}
|
|
20
|
-
}
|
package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonSettings.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { determineTimestampFormat } from "@smithy/core/protocols";
|
|
2
|
-
import { NormalizedSchema } from "@smithy/core/schema";
|
|
3
|
-
import { LazyJsonString, NumericValue, parseEpochTimestamp, parseRfc3339DateTimeWithOffset, parseRfc7231DateTime, } from "@smithy/core/serde";
|
|
4
|
-
import { fromBase64 } from "@smithy/core/serde";
|
|
5
|
-
import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
|
|
6
|
-
import { UnionSerde } from "../../UnionSerde";
|
|
7
|
-
import { jsonReviver } from "../jsonReviver";
|
|
8
|
-
import { needsReviver } from "../needsReviver";
|
|
9
|
-
import { parseJsonBody } from "../parseJsonBody";
|
|
10
|
-
import { writeKey } from "../../writeKey";
|
|
11
|
-
export class JsonShapeDeserializer extends SerdeContextConfig {
|
|
12
|
-
settings;
|
|
13
|
-
constructor(settings) {
|
|
14
|
-
super();
|
|
15
|
-
this.settings = settings;
|
|
16
|
-
}
|
|
17
|
-
async read(schema, data) {
|
|
18
|
-
const reviver = needsReviver(schema) ? jsonReviver : undefined;
|
|
19
|
-
return this._read(schema, typeof data === "string" ? JSON.parse(data, reviver) : await parseJsonBody(data, this.serdeContext, schema));
|
|
20
|
-
}
|
|
21
|
-
readObject(schema, data) {
|
|
22
|
-
return this._read(schema, data);
|
|
23
|
-
}
|
|
24
|
-
_read(schema, value) {
|
|
25
|
-
const isObject = value !== null && typeof value === "object";
|
|
26
|
-
const ns = NormalizedSchema.of(schema);
|
|
27
|
-
if (isObject) {
|
|
28
|
-
if (ns.isStructSchema()) {
|
|
29
|
-
const record = value;
|
|
30
|
-
const union = ns.isUnionSchema();
|
|
31
|
-
const out = {};
|
|
32
|
-
let nameMap = void 0;
|
|
33
|
-
const { jsonName } = this.settings;
|
|
34
|
-
if (jsonName) {
|
|
35
|
-
nameMap = {};
|
|
36
|
-
}
|
|
37
|
-
let unionSerde;
|
|
38
|
-
if (union) {
|
|
39
|
-
unionSerde = new UnionSerde(record, out);
|
|
40
|
-
}
|
|
41
|
-
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
42
|
-
let fromKey = memberName;
|
|
43
|
-
if (jsonName) {
|
|
44
|
-
fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
|
|
45
|
-
nameMap[fromKey] = memberName;
|
|
46
|
-
}
|
|
47
|
-
if (union) {
|
|
48
|
-
unionSerde.mark(fromKey);
|
|
49
|
-
}
|
|
50
|
-
if (record[fromKey] != null) {
|
|
51
|
-
out[memberName] = this._read(memberSchema, record[fromKey]);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
if (union) {
|
|
55
|
-
unionSerde.writeUnknown();
|
|
56
|
-
}
|
|
57
|
-
else if (typeof record.__type === "string") {
|
|
58
|
-
for (const k in record) {
|
|
59
|
-
const v = record[k];
|
|
60
|
-
const t = jsonName ? (nameMap[k] ?? k) : k;
|
|
61
|
-
if (!(t in out)) {
|
|
62
|
-
out[t] = v;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return out;
|
|
67
|
-
}
|
|
68
|
-
if (Array.isArray(value) && ns.isListSchema()) {
|
|
69
|
-
const listMember = ns.getValueSchema();
|
|
70
|
-
const out = [];
|
|
71
|
-
for (const item of value) {
|
|
72
|
-
out.push(this._read(listMember, item));
|
|
73
|
-
}
|
|
74
|
-
return out;
|
|
75
|
-
}
|
|
76
|
-
if (ns.isMapSchema()) {
|
|
77
|
-
const mapMember = ns.getValueSchema();
|
|
78
|
-
const out = {};
|
|
79
|
-
for (const _k in value) {
|
|
80
|
-
if (_k === "__proto__") {
|
|
81
|
-
writeKey(out);
|
|
82
|
-
}
|
|
83
|
-
out[_k] = this._read(mapMember, value[_k]);
|
|
84
|
-
}
|
|
85
|
-
return out;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
if (ns.isBlobSchema() && typeof value === "string") {
|
|
89
|
-
return fromBase64(value);
|
|
90
|
-
}
|
|
91
|
-
const mediaType = ns.getMergedTraits().mediaType;
|
|
92
|
-
if (ns.isStringSchema() && typeof value === "string" && mediaType) {
|
|
93
|
-
const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
|
|
94
|
-
if (isJson) {
|
|
95
|
-
return LazyJsonString.from(value);
|
|
96
|
-
}
|
|
97
|
-
return value;
|
|
98
|
-
}
|
|
99
|
-
if (ns.isTimestampSchema() && value != null) {
|
|
100
|
-
const format = determineTimestampFormat(ns, this.settings);
|
|
101
|
-
switch (format) {
|
|
102
|
-
case 5:
|
|
103
|
-
return parseRfc3339DateTimeWithOffset(value);
|
|
104
|
-
case 6:
|
|
105
|
-
return parseRfc7231DateTime(value);
|
|
106
|
-
case 7:
|
|
107
|
-
return parseEpochTimestamp(value);
|
|
108
|
-
default:
|
|
109
|
-
console.warn("Missing timestamp format, parsing value with Date constructor:", value);
|
|
110
|
-
return new Date(value);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
if (ns.isBigIntegerSchema() && (typeof value === "number" || typeof value === "string")) {
|
|
114
|
-
return BigInt(value);
|
|
115
|
-
}
|
|
116
|
-
if (ns.isBigDecimalSchema() && value != undefined) {
|
|
117
|
-
if (value instanceof NumericValue) {
|
|
118
|
-
return value;
|
|
119
|
-
}
|
|
120
|
-
const untyped = value;
|
|
121
|
-
if (untyped.type === "bigDecimal" && "string" in untyped) {
|
|
122
|
-
return new NumericValue(untyped.string, untyped.type);
|
|
123
|
-
}
|
|
124
|
-
return new NumericValue(String(value), "bigDecimal");
|
|
125
|
-
}
|
|
126
|
-
if (ns.isNumericSchema() && typeof value === "string") {
|
|
127
|
-
switch (value) {
|
|
128
|
-
case "Infinity":
|
|
129
|
-
return Infinity;
|
|
130
|
-
case "-Infinity":
|
|
131
|
-
return -Infinity;
|
|
132
|
-
case "NaN":
|
|
133
|
-
return NaN;
|
|
134
|
-
}
|
|
135
|
-
return value;
|
|
136
|
-
}
|
|
137
|
-
if (ns.isDocumentSchema()) {
|
|
138
|
-
if (isObject) {
|
|
139
|
-
const out = Array.isArray(value) ? [] : {};
|
|
140
|
-
for (const k in value) {
|
|
141
|
-
if (k === "__proto__") {
|
|
142
|
-
writeKey(out);
|
|
143
|
-
}
|
|
144
|
-
const v = value[k];
|
|
145
|
-
if (v instanceof NumericValue) {
|
|
146
|
-
out[k] = v;
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
out[k] = this._read(ns, v);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return out;
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
return structuredClone(value);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
return value;
|
|
159
|
-
}
|
|
160
|
-
}
|