@songtonyli/dsh-cli 0.1.98 → 0.1.100
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/client/index.js +12 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/client/getDefaultSocketTimeout.js +10 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/client/index.browser.js +1 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/client/index.js +1 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/client/index.native.js +1 -0
- package/node_modules/@aws-sdk/core/package.json +1 -1
- package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
- package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-websocket/package.json +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +3 -2
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +3 -2
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +3 -2
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +3 -2
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +3 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/runtimeConfig.js +2 -1
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/runtimeConfig.js +2 -1
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/runtimeConfig.js +2 -1
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/runtimeConfig.js +2 -1
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/runtimeConfig.js +2 -1
- package/node_modules/@aws-sdk/nested-clients/package.json +2 -2
- package/node_modules/@aws-sdk/token-providers/package.json +3 -3
- package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/boot.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/file.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/index.js +3 -0
- package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/from-binary.js +3 -1
- package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/index.js +7 -2
- package/node_modules/@bufbuild/protobuf/dist/cjs/package.json +1 -0
- package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/reflect.js +0 -1
- package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/registry.js +79 -10
- package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/to-json.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/txtpb/to-text.js +4 -9
- package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wire/binary-encoding.js +9 -5
- package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wire/text-encoding.js +7 -3
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/boot.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/file.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/index.js +1 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/from-binary.js +3 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/index.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect.js +0 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/registry.js +77 -10
- package/node_modules/@bufbuild/protobuf/dist/esm/to-json.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/to-text.js +4 -9
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.js +9 -5
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.js +7 -3
- package/node_modules/@bufbuild/protobuf/package.json +70 -267
- 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-tui-app/README.i18n.yaml +8 -8
- package/node_modules/@deepseek-ai/dsh-tui-app/README.md +4 -4
- package/node_modules/@deepseek-ai/dsh-tui-app/README.zh.md +4 -4
- package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +507 -127
- package/node_modules/@eslint-community/regexpp/index.js +3 -3
- package/node_modules/@eslint-community/regexpp/index.mjs +3 -3
- package/node_modules/@eslint-community/regexpp/package.json +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_attributes.cjs +1461 -176
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_attributes.mjs +1363 -171
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_events.cjs +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_events.mjs +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_metrics.cjs +382 -95
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_metrics.mjs +358 -94
- package/node_modules/@opentelemetry/semantic-conventions/dist/index-incubating.cjs +132 -8
- package/node_modules/@opentelemetry/semantic-conventions/dist/index-incubating.mjs +5 -5
- package/node_modules/@opentelemetry/semantic-conventions/dist/index.cjs +8 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/index.mjs +3 -3
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_attributes.cjs +104 -13
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_attributes.mjs +99 -14
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_metrics.cjs +16 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_metrics.mjs +15 -1
- package/node_modules/@opentelemetry/semantic-conventions/package.json +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +1 -0
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.browser.js +33 -5
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js +33 -5
- package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/command.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/retryMiddleware.js +11 -5
- package/node_modules/@smithy/core/dist-es/submodules/retry/util-retry/race.js +22 -0
- package/node_modules/@smithy/core/package.json +2 -2
- package/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +10 -4
- package/node_modules/@smithy/fetch-http-handler/dist-es/fetch-http-handler.js +6 -2
- package/node_modules/@smithy/fetch-http-handler/dist-es/request-timeout.js +4 -2
- package/node_modules/@smithy/fetch-http-handler/package.json +3 -3
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +31 -31
- package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +2 -4
- package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +29 -27
- package/node_modules/@smithy/node-http-handler/package.json +3 -3
- package/node_modules/@smithy/types/package.json +1 -1
- package/node_modules/commander/Readme.md +6 -32
- package/node_modules/commander/index.js +1 -1
- package/node_modules/commander/lib/command.js +22 -9
- package/node_modules/commander/lib/help.js +6 -2
- package/node_modules/commander/lib/option.js +1 -1
- package/node_modules/commander/package.json +2 -1
- package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +3 -2
- package/node_modules/jose/dist/webapi/jwks/remote.js +1 -1
- package/node_modules/jose/dist/webapi/jws/general/verify.js +2 -8
- package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +11 -8
- package/node_modules/jose/dist/webapi/lib/key_management.js +0 -1
- package/node_modules/jose/package.json +1 -1
- package/node_modules/vfile-message/lib/index.js +44 -14
- package/node_modules/vfile-message/package.json +6 -13
- package/node_modules/vfile-message/readme.md +9 -14
- package/package.json +23 -23
- package/node_modules/@bufbuild/protobuf/dist/commonjs/package.json +0 -4
- package/node_modules/@bufbuild/protobuf/dist/esm/package.json +0 -4
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/clone.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/boot.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/enum.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/extension.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/file.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/index.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/message.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/service.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/symbols.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/types.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/embed.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/enum.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/extension.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/message.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/restore-json-names.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/scalar.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/service.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/symbols.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/types.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/create.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/descriptors.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/equals.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/extensions.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/fields.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/from-json.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/is-message.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/json-value.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/merge.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/proto-int64.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/error.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/guard.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/index.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/message.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/names.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/nested-types.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/path.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/reflect-check.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/reflect-types.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/scalar.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/unsafe.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/to-binary.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/txtpb/from-text.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/txtpb/index.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/txtpb/is-group-like.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/txtpb/reader.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/txtpb/writer.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/types.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/unknown-enum.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wire/base64-encoding.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wire/index.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wire/size-delimited.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wire/text-format.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wire/varint.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/any.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/duration.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/any_pb.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/api_pb.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/c_sharp_features_pb.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/compiler/plugin_pb.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/cpp_features_pb.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/cpp_file_options_pb.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/cpp_options_pb.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/descriptor_pb.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/duration_pb.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/empty_pb.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/field_mask_pb.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/go_features_pb.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/java_features_pb.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/json_enumvalue_options_pb.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/json_options_pb.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/source_context_pb.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/struct_pb.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/timestamp_pb.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/type_pb.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/wrappers_pb.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/index.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/json.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/timestamp.js +0 -0
- /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/wrappers.js +0 -0
|
@@ -16,7 +16,7 @@ import { formatSessionReferenceMention } from "@deepseek-ai/dsh-session-referenc
|
|
|
16
16
|
import { AppleContainerSandboxProvider } from "@deepseek-ai/dsh-sandbox-apple-container";
|
|
17
17
|
import { JobId } from "@deepseek-ai/dsh-jobs";
|
|
18
18
|
import { UserQuestionError, planReviewOptions } from "@deepseek-ai/dsh-user-questions";
|
|
19
|
-
import { assertNever } from "@deepseek-ai/dsh-util-values";
|
|
19
|
+
import { PartialArguments, assertNever } from "@deepseek-ai/dsh-util-values";
|
|
20
20
|
import { maskCredentialText } from "@deepseek-ai/dsh-client-ui-secret-mask";
|
|
21
21
|
import { readFile } from "node:fs/promises";
|
|
22
22
|
import { basename, extname, join, resolve } from "node:path";
|
|
@@ -526,19 +526,56 @@ function cursorTo(row) {
|
|
|
526
526
|
//#endregion
|
|
527
527
|
//#region lib/types/columns.js
|
|
528
528
|
/**
|
|
529
|
-
* Cutting a rendered line at several columns in one pass
|
|
529
|
+
* Cutting a rendered line at several columns in one pass, and reading the
|
|
530
|
+
* styling its escape sequences leave in force.
|
|
530
531
|
*
|
|
531
532
|
* pi-tui's `sliceByColumn` walks a line from its first character on every
|
|
532
|
-
* call
|
|
533
|
-
*
|
|
534
|
-
*
|
|
535
|
-
*
|
|
536
|
-
*
|
|
537
|
-
* restores the line's own styling.
|
|
533
|
+
* call and opens each piece with every escape sequence written before it, so
|
|
534
|
+
* a fade that recolors `n` runs of one line reads that line about `2n` times
|
|
535
|
+
* per frame and writes the line's whole styling history once per run.
|
|
536
|
+
* {@link sliceColumns} reads the line once and opens each piece after a cut
|
|
537
|
+
* with only the styling in force at that cut.
|
|
538
538
|
* @module @deepseek-ai/dsh-tui-app/columns
|
|
539
539
|
*/
|
|
540
540
|
/** Grapheme segmenter for the text between escape sequences. */
|
|
541
541
|
const GRAPHEMES$3 = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
542
|
+
/** Control Sequence Introducer. */
|
|
543
|
+
const CSI$3 = "\x1B[";
|
|
544
|
+
/** Opening of an OSC 8 hyperlink sequence, which an empty target closes. */
|
|
545
|
+
const OSC8 = "\x1B]8;";
|
|
546
|
+
/** SGR codes that take a color in the parameters after them: foreground, background, underline color. */
|
|
547
|
+
const EXTENDED_COLOR_CODES = new Set([
|
|
548
|
+
38,
|
|
549
|
+
48,
|
|
550
|
+
58
|
|
551
|
+
]);
|
|
552
|
+
/** SGR codes that restore the terminal's default foreground, background, and underline color. */
|
|
553
|
+
const DEFAULT_COLOR_CODES = new Set([
|
|
554
|
+
39,
|
|
555
|
+
49,
|
|
556
|
+
59
|
|
557
|
+
]);
|
|
558
|
+
/** SGR codes that turn an attribute on, which a cut restores while they stay in force. */
|
|
559
|
+
const ATTRIBUTE_CODES = new Set([
|
|
560
|
+
1,
|
|
561
|
+
2,
|
|
562
|
+
3,
|
|
563
|
+
4,
|
|
564
|
+
5,
|
|
565
|
+
7,
|
|
566
|
+
8,
|
|
567
|
+
9
|
|
568
|
+
]);
|
|
569
|
+
/** SGR codes that turn attributes off, each with the codes whose attributes it ends. */
|
|
570
|
+
const ATTRIBUTE_ENDS = new Map([
|
|
571
|
+
[22, [1, 2]],
|
|
572
|
+
[23, [3]],
|
|
573
|
+
[24, [4]],
|
|
574
|
+
[25, [5]],
|
|
575
|
+
[27, [7]],
|
|
576
|
+
[28, [8]],
|
|
577
|
+
[29, [9]]
|
|
578
|
+
]);
|
|
542
579
|
/**
|
|
543
580
|
* The terminal escape sequence starting at `index`, as pi-tui recognizes one:
|
|
544
581
|
* a CSI sequence ending in `m`, `G`, `K`, `H`, or `J`, or an OSC or APC
|
|
@@ -561,7 +598,181 @@ function escapeLength(line, index) {
|
|
|
561
598
|
return 0;
|
|
562
599
|
}
|
|
563
600
|
/**
|
|
601
|
+
* Split a rendered line into its escape sequences and the text between them.
|
|
602
|
+
* A sequence is a CSI sequence ending in `m`, `G`, `K`, `H`, or `J`, or an OSC
|
|
603
|
+
* or APC sequence ending in BEL or ST, which is what pi-tui steps over when it
|
|
604
|
+
* measures a line; an unterminated sequence is text.
|
|
605
|
+
* @param line - the rendered line.
|
|
606
|
+
* @returns the parts in line order; consecutive text is one part.
|
|
607
|
+
*/
|
|
608
|
+
function* lineParts(line) {
|
|
609
|
+
let index = 0;
|
|
610
|
+
while (index < line.length) {
|
|
611
|
+
const length = escapeLength(line, index);
|
|
612
|
+
if (length > 0) {
|
|
613
|
+
yield {
|
|
614
|
+
text: line.slice(index, index + length),
|
|
615
|
+
sequence: true
|
|
616
|
+
};
|
|
617
|
+
index += length;
|
|
618
|
+
continue;
|
|
619
|
+
}
|
|
620
|
+
let end = index + 1;
|
|
621
|
+
while (end < line.length && escapeLength(line, end) === 0) end += 1;
|
|
622
|
+
yield {
|
|
623
|
+
text: line.slice(index, end),
|
|
624
|
+
sequence: false
|
|
625
|
+
};
|
|
626
|
+
index = end;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Whether one escape sequence is SGR, the sequence that sets text attributes.
|
|
631
|
+
* @param sequence - one escape sequence from {@link lineParts}.
|
|
632
|
+
* @returns true for `ESC[` parameters `m`.
|
|
633
|
+
*/
|
|
634
|
+
function isSgr(sequence) {
|
|
635
|
+
return sequence.startsWith(CSI$3) && sequence.endsWith("m");
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* The attribute changes one SGR sequence makes, in order. A `38`, `48`, or
|
|
639
|
+
* `58` code is one change together with the parameters its color takes:
|
|
640
|
+
* `2;R;G;B`, `5;N`, or the one mode parameter it carries otherwise. Every
|
|
641
|
+
* other parameter is a change of its own. An empty parameter reads as 0, so
|
|
642
|
+
* `ESC[m` and the first slot of `ESC[;1m` are full resets.
|
|
643
|
+
* @param sequence - an SGR sequence, `ESC[` through the final `m`.
|
|
644
|
+
* @returns the changes, each the numeric parameters it consists of; a
|
|
645
|
+
* parameter that is not a number reads as `NaN`.
|
|
646
|
+
*/
|
|
647
|
+
function sgrChanges(sequence) {
|
|
648
|
+
const body = sequence.slice(2, -1);
|
|
649
|
+
const parts = body === "" ? [0] : body.split(";").map((part) => part === "" ? 0 : Number(part));
|
|
650
|
+
const changes = [];
|
|
651
|
+
let index = 0;
|
|
652
|
+
while (index < parts.length) {
|
|
653
|
+
const code = parts[index];
|
|
654
|
+
const length = EXTENDED_COLOR_CODES.has(code) ? extendedColorLength(parts[index + 1]) : 1;
|
|
655
|
+
changes.push(parts.slice(index, index + length));
|
|
656
|
+
index += length;
|
|
657
|
+
}
|
|
658
|
+
return changes;
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* How many parameters an extended color change spans, its own code included.
|
|
662
|
+
* @param mode - the parameter after the `38`, `48`, or `58`.
|
|
663
|
+
* @returns 5 for `2;R;G;B`, 3 for `5;N`, 1 when the sequence ends at the code, and 2 for any other mode.
|
|
664
|
+
*/
|
|
665
|
+
function extendedColorLength(mode) {
|
|
666
|
+
if (mode === 2) return 5;
|
|
667
|
+
if (mode === 5) return 3;
|
|
668
|
+
return mode === void 0 ? 1 : 2;
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Whether one SGR code sets or clears the foreground.
|
|
672
|
+
* @param code - a change's first parameter, from {@link sgrChanges}.
|
|
673
|
+
* @returns true for `30`-`39` and `90`-`97`.
|
|
674
|
+
*/
|
|
675
|
+
function setsForeground(code) {
|
|
676
|
+
return code >= 30 && code <= 39 || code >= 90 && code <= 97;
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* The color slot one SGR code sets or clears.
|
|
680
|
+
* @param code - the change's first parameter.
|
|
681
|
+
* @returns `38` for a foreground code, `48` for a background code, `58` for
|
|
682
|
+
* an underline color code, or undefined for a code that sets no color.
|
|
683
|
+
*/
|
|
684
|
+
function colorSlot(code) {
|
|
685
|
+
if (setsForeground(code)) return 38;
|
|
686
|
+
if (code >= 40 && code <= 49 || code >= 100 && code <= 107) return 48;
|
|
687
|
+
return code === 58 || code === 59 ? 58 : void 0;
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* The styling a line's escape sequences leave in force at one point of a
|
|
691
|
+
* walk: each attribute set since the last full reset and not ended since, the
|
|
692
|
+
* latest foreground, background, and underline color, and the hyperlink an
|
|
693
|
+
* OSC 8 sequence opened and none closed. A code this does not model is not
|
|
694
|
+
* restored.
|
|
695
|
+
*/
|
|
696
|
+
var StylingInForce = class {
|
|
697
|
+
/** Each attribute in force, by the code that set it, as the parameter that set it. */
|
|
698
|
+
attributes = /* @__PURE__ */ new Map();
|
|
699
|
+
/** The background and underline color in force, by slot (`48`, `58`), as the parameters that set each. */
|
|
700
|
+
colors = /* @__PURE__ */ new Map();
|
|
701
|
+
/** The parameters that set the foreground in force; undefined for the terminal default. */
|
|
702
|
+
foreground;
|
|
703
|
+
/** The OSC 8 sequence that opened the hyperlink in force. */
|
|
704
|
+
link;
|
|
705
|
+
/**
|
|
706
|
+
* Take one escape sequence into the styling.
|
|
707
|
+
* @param sequence - one escape sequence of the line, in line order.
|
|
708
|
+
*/
|
|
709
|
+
read(sequence) {
|
|
710
|
+
if (sequence.startsWith(OSC8)) {
|
|
711
|
+
this.link = linkTarget(sequence) === "" ? void 0 : sequence;
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
if (!isSgr(sequence)) return;
|
|
715
|
+
for (const change of sgrChanges(sequence)) this.apply(change);
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* The sequences that restore this styling over the line's own styling: the
|
|
719
|
+
* hyperlink opener, one SGR with every attribute and the background and
|
|
720
|
+
* underline colors, and one SGR with the foreground, each present only when
|
|
721
|
+
* something of it is in force.
|
|
722
|
+
* @returns the restoring sequences; empty when nothing is in force.
|
|
723
|
+
*/
|
|
724
|
+
restore() {
|
|
725
|
+
const rest = [...this.attributes.values(), ...this.colors.values()];
|
|
726
|
+
const others = rest.length === 0 ? "" : `${CSI$3}${rest.join(";")}m`;
|
|
727
|
+
const foreground = this.foreground === void 0 ? "" : `${CSI$3}${this.foreground}m`;
|
|
728
|
+
return `${this.link ?? ""}${others}${foreground}`;
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Apply one change from {@link sgrChanges}.
|
|
732
|
+
* @param change - the change's parameters.
|
|
733
|
+
*/
|
|
734
|
+
apply(change) {
|
|
735
|
+
const code = change[0];
|
|
736
|
+
if (code === 0) {
|
|
737
|
+
this.attributes.clear();
|
|
738
|
+
this.colors.clear();
|
|
739
|
+
this.foreground = void 0;
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
if (ATTRIBUTE_CODES.has(code)) {
|
|
743
|
+
this.attributes.set(code, String(code));
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
const ended = ATTRIBUTE_ENDS.get(code);
|
|
747
|
+
if (ended !== void 0) {
|
|
748
|
+
for (const attribute of ended) this.attributes.delete(attribute);
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
const slot = colorSlot(code);
|
|
752
|
+
if (slot === void 0) return;
|
|
753
|
+
const parameters = DEFAULT_COLOR_CODES.has(code) ? void 0 : change.join(";");
|
|
754
|
+
if (slot === 38) this.foreground = parameters;
|
|
755
|
+
else if (parameters === void 0) this.colors.delete(slot);
|
|
756
|
+
else this.colors.set(slot, parameters);
|
|
757
|
+
}
|
|
758
|
+
};
|
|
759
|
+
/**
|
|
760
|
+
* The target an OSC 8 sequence links to.
|
|
761
|
+
* @param sequence - `ESC]8;params;target` ended by BEL or ST.
|
|
762
|
+
* @returns the target; empty for the sequence that closes a hyperlink.
|
|
763
|
+
*/
|
|
764
|
+
function linkTarget(sequence) {
|
|
765
|
+
const body = sequence.slice(4, sequence.endsWith("\x07") ? -1 : -2);
|
|
766
|
+
return body.slice(body.indexOf(";") + 1);
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
564
769
|
* Cut `line` into the column ranges between consecutive cuts.
|
|
770
|
+
*
|
|
771
|
+
* A piece a grapheme starts in opens with the styling in force at its first
|
|
772
|
+
* column, as {@link StylingInForce} restores it, and never with the sequences
|
|
773
|
+
* that styling was built from. The escape sequences inside a range follow that
|
|
774
|
+
* restore, so a sequence at a cut column styles the range it starts rather
|
|
775
|
+
* than the one before it.
|
|
565
776
|
* @param line - the rendered line, escape sequences included.
|
|
566
777
|
* @param cuts - ascending columns; equal neighbours make an empty range.
|
|
567
778
|
* @returns `cuts.length + 1` pieces: columns `[0, cuts[0])`, then each range
|
|
@@ -573,44 +784,34 @@ function sliceColumns(line, cuts) {
|
|
|
573
784
|
const starts = [0, ...cuts];
|
|
574
785
|
const pieces = starts.map(() => "");
|
|
575
786
|
const drawn = starts.map(() => false);
|
|
576
|
-
const
|
|
577
|
-
|
|
787
|
+
const restores = starts.map(() => "");
|
|
788
|
+
const styling = new StylingInForce();
|
|
578
789
|
let column = 0;
|
|
579
790
|
let range = 0;
|
|
580
791
|
let reached = 1;
|
|
581
792
|
const advance = () => {
|
|
582
793
|
while (range + 1 < starts.length && starts[range + 1] <= column) range += 1;
|
|
583
794
|
while (reached < starts.length && starts[reached] <= column) {
|
|
584
|
-
|
|
795
|
+
restores[reached] = styling.restore();
|
|
585
796
|
reached += 1;
|
|
586
797
|
}
|
|
587
798
|
};
|
|
588
|
-
const append = (text) => {
|
|
589
|
-
pieces[range] = `${pieces[range]}${text}`;
|
|
590
|
-
};
|
|
591
799
|
advance();
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
const sequence = line.slice(index, index + length);
|
|
597
|
-
sequences += sequence;
|
|
598
|
-
append(sequence);
|
|
599
|
-
index += length;
|
|
800
|
+
for (const part of lineParts(line)) {
|
|
801
|
+
if (part.sequence) {
|
|
802
|
+
styling.read(part.text);
|
|
803
|
+
pieces[range] = `${pieces[range]}${part.text}`;
|
|
600
804
|
continue;
|
|
601
805
|
}
|
|
602
|
-
|
|
603
|
-
while (end < line.length && escapeLength(line, end) === 0) end += 1;
|
|
604
|
-
for (const { segment } of GRAPHEMES$3.segment(line.slice(index, end))) {
|
|
806
|
+
for (const { segment } of GRAPHEMES$3.segment(part.text)) {
|
|
605
807
|
if (!drawn[range]) {
|
|
606
808
|
drawn[range] = true;
|
|
607
|
-
|
|
809
|
+
pieces[range] = `${restores[range]}${pieces[range]}`;
|
|
608
810
|
}
|
|
609
|
-
|
|
811
|
+
pieces[range] = `${pieces[range]}${segment}`;
|
|
610
812
|
column += visibleWidth(segment);
|
|
611
813
|
advance();
|
|
612
814
|
}
|
|
613
|
-
index = end;
|
|
614
815
|
}
|
|
615
816
|
return pieces;
|
|
616
817
|
}
|
|
@@ -972,7 +1173,7 @@ function resolveFadeCapability(input) {
|
|
|
972
1173
|
* @param steps - brightness levels; defaults to {@link FADE_STEPS}.
|
|
973
1174
|
* @returns `steps` levels, darkest first.
|
|
974
1175
|
*/
|
|
975
|
-
function buildFadeRamp(bg, fg, steps =
|
|
1176
|
+
function buildFadeRamp(bg, fg, steps = 12) {
|
|
976
1177
|
return Array.from({ length: steps }, (_unused, level) => {
|
|
977
1178
|
if (level === steps - 1) return {
|
|
978
1179
|
r: fg.r,
|
|
@@ -1150,7 +1351,7 @@ function recolorLines(lines, age, style, from = 0) {
|
|
|
1150
1351
|
* level and rises to the color the component drew it in, so text in the
|
|
1151
1352
|
* default foreground, a dim rule, and a colored title each brighten to their
|
|
1152
1353
|
* own settled color. The slice should come from {@link sliceColumns}, which
|
|
1153
|
-
*
|
|
1354
|
+
* opens it with the styling in force at its first column.
|
|
1154
1355
|
* @param slice - the slice's text with its escape sequences.
|
|
1155
1356
|
* @param age - elapsed time in units of `stepMs`; `ramp.length` is t = 1.
|
|
1156
1357
|
* @param style - the capability and the ramp, darkest level first.
|
|
@@ -1364,15 +1565,13 @@ function floatOutSpanSgr(style, age) {
|
|
|
1364
1565
|
return `${RESET_INTENSITY}${encodeMix(style.capability, mixed)}`;
|
|
1365
1566
|
}
|
|
1366
1567
|
/**
|
|
1367
|
-
* Apply one SGR sequence to the
|
|
1568
|
+
* Apply one SGR sequence to the foreground state.
|
|
1368
1569
|
* @param state - the state to update.
|
|
1369
1570
|
* @param sequence - a CSI SGR including the trailing `m`.
|
|
1370
1571
|
*/
|
|
1371
1572
|
function applySgr(state, sequence) {
|
|
1372
|
-
const
|
|
1373
|
-
|
|
1374
|
-
for (let index = 0; index < parts.length; index += 1) {
|
|
1375
|
-
const code = colorParam(parts, index);
|
|
1573
|
+
for (const change of sgrChanges(sequence)) {
|
|
1574
|
+
const code = change[0];
|
|
1376
1575
|
if (code === 0) {
|
|
1377
1576
|
state.color = void 0;
|
|
1378
1577
|
state.dim = false;
|
|
@@ -1381,46 +1580,22 @@ function applySgr(state, sequence) {
|
|
|
1381
1580
|
else if (code === 39) state.color = void 0;
|
|
1382
1581
|
else if (code >= 30 && code <= 37) state.color = ANSI16[code - 30];
|
|
1383
1582
|
else if (code >= 90 && code <= 97) state.color = ANSI16[code - 90 + 8];
|
|
1384
|
-
else if (code === 38)
|
|
1385
|
-
const read = readExtendedColor(parts, index);
|
|
1386
|
-
state.color = read.color;
|
|
1387
|
-
index += read.skip;
|
|
1388
|
-
} else if (code === 48) index += readExtendedColor(parts, index).skip;
|
|
1583
|
+
else if (code === 38) state.color = extendedColor(change);
|
|
1389
1584
|
}
|
|
1390
1585
|
}
|
|
1391
1586
|
/**
|
|
1392
|
-
*
|
|
1393
|
-
* @param
|
|
1394
|
-
* @
|
|
1395
|
-
* @returns the RGB for a foreground read, and how many following parameters were consumed.
|
|
1587
|
+
* Read the color of one ITU T.416 extended color change (`38`/`48` plus `2;R;G;B` or `5;N`).
|
|
1588
|
+
* @param change - the change from {@link sgrChanges}, its code first.
|
|
1589
|
+
* @returns the RGB, with a missing channel or index read as 0, or undefined for any other mode.
|
|
1396
1590
|
*/
|
|
1397
|
-
function
|
|
1398
|
-
const mode =
|
|
1591
|
+
function extendedColor(change) {
|
|
1592
|
+
const mode = change[1];
|
|
1399
1593
|
if (mode === 2) return {
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
b: channel(colorParam(parts, index + 4))
|
|
1404
|
-
},
|
|
1405
|
-
skip: 4
|
|
1406
|
-
};
|
|
1407
|
-
if (mode === 5) return {
|
|
1408
|
-
color: ansi256Rgb(colorParam(parts, index + 2)),
|
|
1409
|
-
skip: 2
|
|
1410
|
-
};
|
|
1411
|
-
return {
|
|
1412
|
-
color: void 0,
|
|
1413
|
-
skip: mode === void 0 ? 0 : 1
|
|
1594
|
+
r: channel(change[2] ?? 0),
|
|
1595
|
+
g: channel(change[3] ?? 0),
|
|
1596
|
+
b: channel(change[4] ?? 0)
|
|
1414
1597
|
};
|
|
1415
|
-
|
|
1416
|
-
/**
|
|
1417
|
-
* Read one SGR numeric parameter, defaulting a missing slot to 0.
|
|
1418
|
-
* @param parts - the SGR parameter list.
|
|
1419
|
-
* @param index - the slot to read.
|
|
1420
|
-
* @returns the parameter, or 0 when it is absent.
|
|
1421
|
-
*/
|
|
1422
|
-
function colorParam(parts, index) {
|
|
1423
|
-
return parts[index] ?? 0;
|
|
1598
|
+
return mode === 5 ? ansi256Rgb(change[2] ?? 0) : void 0;
|
|
1424
1599
|
}
|
|
1425
1600
|
/**
|
|
1426
1601
|
* RGB for one xterm 256-color index.
|
|
@@ -1504,7 +1679,7 @@ var FadeTracker = class {
|
|
|
1504
1679
|
chunks = [];
|
|
1505
1680
|
openChunk = void 0;
|
|
1506
1681
|
constructor(options) {
|
|
1507
|
-
this.steps = options.steps ??
|
|
1682
|
+
this.steps = options.steps ?? 12;
|
|
1508
1683
|
this.stepMs = options.stepMs ?? 16;
|
|
1509
1684
|
this.now = options.now;
|
|
1510
1685
|
}
|
|
@@ -1672,15 +1847,23 @@ var FadeRegistry = class {
|
|
|
1672
1847
|
* there at all - text this tail never reached; that chunk and every older one
|
|
1673
1848
|
* then draw at the foreground, unchanged.
|
|
1674
1849
|
*
|
|
1675
|
-
* Styling inside a recolored run survives.
|
|
1676
|
-
* force at its
|
|
1677
|
-
* enclosing
|
|
1678
|
-
*
|
|
1679
|
-
*
|
|
1680
|
-
*
|
|
1681
|
-
*
|
|
1682
|
-
*
|
|
1683
|
-
*
|
|
1850
|
+
* Styling inside a recolored run survives. Each run opens with the styling in
|
|
1851
|
+
* force at its first column, as {@link sliceColumns} restores it, so an
|
|
1852
|
+
* enclosing bold, italic, background, or hyperlink continues across it, and
|
|
1853
|
+
* keeps every sequence of its own except the ones a fade color replaces. In a
|
|
1854
|
+
* fade-in under `truecolor` or `ansi256`, text under the default foreground
|
|
1855
|
+
* draws at the run's level of the gray ramp, and text under an explicit
|
|
1856
|
+
* foreground, such as a syntax-colored token, draws at the same age's mix from
|
|
1857
|
+
* the ramp's darkest level to that foreground: the exact mix under `truecolor`
|
|
1858
|
+
* and the nearest 256-color index of the mix at the age's whole level under
|
|
1859
|
+
* `ansi256`. A run that crosses a color change takes a fade color for each
|
|
1860
|
+
* color it covers. The two-level mode and float-out open each run with one
|
|
1861
|
+
* sequence, under which an enclosing foreground keeps its color. Each
|
|
1862
|
+
* recolored line ends with `ESC[39m` (or `ESC[22m` in the two-level mode,
|
|
1863
|
+
* which also ends bold) after the line's own closing sequences, so the
|
|
1864
|
+
* recolor never leaks past the line it was applied to. Float-out resets
|
|
1865
|
+
* intensity before the mixed color so a dim wrapper does not stack on the
|
|
1866
|
+
* overlay, and at t >= 1 the original lines come back unchanged.
|
|
1684
1867
|
* @param lines - the rendered lines of the streaming block, newest text last.
|
|
1685
1868
|
* @param spans - the tail from {@link FadeTracker.spans}, oldest first.
|
|
1686
1869
|
* @param style - the capability and the ramp.
|
|
@@ -1694,13 +1877,14 @@ var FadeRegistry = class {
|
|
|
1694
1877
|
*/
|
|
1695
1878
|
function recolorTail(lines, spans, style, from = 0, mode = "in") {
|
|
1696
1879
|
if (spans.length === 0 || lines.length === 0) return [...lines];
|
|
1880
|
+
const mixing = tokenMix(style, mode);
|
|
1697
1881
|
const cells = new CellWalk(cellsFromEnd(lines));
|
|
1698
1882
|
const runs = [];
|
|
1699
1883
|
for (const span of [...spans].reverse()) {
|
|
1700
1884
|
const covered = consumeSpan(cells, span.text);
|
|
1701
1885
|
if (covered === void 0) break;
|
|
1702
1886
|
const sgr = mode === "out" ? floatOutSpanSgr(style, span.age) : fadeSgr(style, span.age);
|
|
1703
|
-
if (sgr !== "") collectRuns(runs, covered, sgr);
|
|
1887
|
+
if (sgr !== "") collectRuns(runs, covered, sgr, mixing === void 0 ? 0 : mixPosition(mixing, style.ramp.length, span.age));
|
|
1704
1888
|
}
|
|
1705
1889
|
const byLine = /* @__PURE__ */ new Map();
|
|
1706
1890
|
for (const run of runs) {
|
|
@@ -1709,12 +1893,44 @@ function recolorTail(lines, spans, style, from = 0, mode = "in") {
|
|
|
1709
1893
|
else known.unshift(run);
|
|
1710
1894
|
}
|
|
1711
1895
|
const restore = restoreFor(style.capability);
|
|
1896
|
+
const paint = mixing === void 0 ? (piece, run) => `${run.sgr}${piece}` : (piece, run) => fadeInRun(piece, run, mixing);
|
|
1712
1897
|
return lines.map((text, index) => {
|
|
1713
1898
|
const lineRuns = index < from ? void 0 : byLine.get(index);
|
|
1714
|
-
return lineRuns === void 0 ? text : paintLine(text, lineRuns, restore);
|
|
1899
|
+
return lineRuns === void 0 ? text : paintLine(text, lineRuns, restore, paint);
|
|
1715
1900
|
});
|
|
1716
1901
|
}
|
|
1717
1902
|
/**
|
|
1903
|
+
* Whether a recolor mixes syntax colors, and with what.
|
|
1904
|
+
* @param style - the capability and the ramp.
|
|
1905
|
+
* @param mode - the recolor's direction.
|
|
1906
|
+
* @returns the encoding and the start color for a fade-in under `truecolor`
|
|
1907
|
+
* or `ansi256` with a ramp; undefined for float-out, the two-level mode, no
|
|
1908
|
+
* capability, and an empty ramp, whose runs each open with one sequence.
|
|
1909
|
+
*/
|
|
1910
|
+
function tokenMix(style, mode) {
|
|
1911
|
+
const start = style.ramp[0];
|
|
1912
|
+
const { capability } = style;
|
|
1913
|
+
if (mode === "out" || start === void 0) return void 0;
|
|
1914
|
+
return capability === "truecolor" || capability === "ansi256" ? {
|
|
1915
|
+
capability,
|
|
1916
|
+
start
|
|
1917
|
+
} : void 0;
|
|
1918
|
+
}
|
|
1919
|
+
/**
|
|
1920
|
+
* How far a syntax-colored chunk of one age has come toward its color. The
|
|
1921
|
+
* position reaches 1 at age `steps - 1`, where default-foreground text reaches
|
|
1922
|
+
* the last ramp level, and the 256-color encoding reads the age's whole level
|
|
1923
|
+
* as {@link fadeSgr} does.
|
|
1924
|
+
* @param mixing - the encoding.
|
|
1925
|
+
* @param steps - the ramp's level count.
|
|
1926
|
+
* @param age - the chunk's age in units of `stepMs`.
|
|
1927
|
+
* @returns the position from the ramp's darkest level to the color, 0 to 1.
|
|
1928
|
+
*/
|
|
1929
|
+
function mixPosition(mixing, steps, age) {
|
|
1930
|
+
const level = mixing.capability === "ansi256" ? Math.floor(age) : age;
|
|
1931
|
+
return Math.min(1, level / Math.max(1, steps - 1));
|
|
1932
|
+
}
|
|
1933
|
+
/**
|
|
1718
1934
|
* Walk the rendered lines backwards, one visible grapheme at a time. Lazy: a
|
|
1719
1935
|
* line is stripped and segmented only once the walk reaches it, so a long
|
|
1720
1936
|
* settled message costs nothing beyond the lines the tail touches.
|
|
@@ -1829,20 +2045,22 @@ function isBlank(grapheme) {
|
|
|
1829
2045
|
}
|
|
1830
2046
|
/**
|
|
1831
2047
|
* Turn covered cells into runs, merging each cell into the run to its right
|
|
1832
|
-
* when they touch on the same line under the same sequence.
|
|
2048
|
+
* when they touch on the same line under the same sequence and mix.
|
|
1833
2049
|
* @param runs - runs collected so far, in the walk's right-to-left order.
|
|
1834
2050
|
* @param covered - the cells one chunk covers.
|
|
1835
2051
|
* @param sgr - the sequence the chunk draws under.
|
|
2052
|
+
* @param mix - the chunk's position toward a syntax color, from {@link mixPosition}.
|
|
1836
2053
|
*/
|
|
1837
|
-
function collectRuns(runs, covered, sgr) {
|
|
2054
|
+
function collectRuns(runs, covered, sgr, mix) {
|
|
1838
2055
|
for (const cell of covered) {
|
|
1839
2056
|
const previous = runs.at(-1);
|
|
1840
|
-
if (previous !== void 0 && previous.line === cell.line && previous.
|
|
2057
|
+
if (previous !== void 0 && previous.line === cell.line && previous.start === cell.column + cell.width && previous.sgr === sgr && previous.mix === mix) previous.start = cell.column;
|
|
1841
2058
|
else runs.push({
|
|
1842
2059
|
line: cell.line,
|
|
1843
2060
|
start: cell.column,
|
|
1844
2061
|
end: cell.column + cell.width,
|
|
1845
|
-
sgr
|
|
2062
|
+
sgr,
|
|
2063
|
+
mix
|
|
1846
2064
|
});
|
|
1847
2065
|
}
|
|
1848
2066
|
}
|
|
@@ -1851,17 +2069,76 @@ function collectRuns(runs, covered, sgr) {
|
|
|
1851
2069
|
* @param text - the rendered line.
|
|
1852
2070
|
* @param runs - the line's runs, in column order.
|
|
1853
2071
|
* @param restore - the sequence that ends the last run.
|
|
1854
|
-
* @
|
|
1855
|
-
*
|
|
2072
|
+
* @param paint - draws one run's piece from {@link sliceColumns} in the run's fade.
|
|
2073
|
+
* @returns the line with each run painted, the text between runs untouched,
|
|
2074
|
+
* and the line's own trailing sequences kept ahead of `restore`.
|
|
1856
2075
|
*/
|
|
1857
|
-
function paintLine(text, runs, restore) {
|
|
2076
|
+
function paintLine(text, runs, restore, paint) {
|
|
1858
2077
|
const pieces = sliceColumns(text, runs.flatMap((run) => [run.start, run.end]));
|
|
1859
2078
|
let out = pieces[0];
|
|
1860
2079
|
runs.forEach((run, index) => {
|
|
1861
|
-
out += `${
|
|
2080
|
+
out += `${paint(pieces[2 * index + 1], run)}${pieces[2 * index + 2]}`;
|
|
1862
2081
|
});
|
|
1863
2082
|
return `${out}${restore}`;
|
|
1864
2083
|
}
|
|
2084
|
+
/**
|
|
2085
|
+
* Draw one fade-in run whose text may sit under several foregrounds. Text
|
|
2086
|
+
* under the default foreground draws in `run.sgr`; text under an explicit
|
|
2087
|
+
* foreground draws at `run.mix` of the way from `mixing.start` to that
|
|
2088
|
+
* foreground. The fade color is written before the run's first text and
|
|
2089
|
+
* again after a sequence that changed the foreground. A sequence that only
|
|
2090
|
+
* sets the foreground is left out when text follows it, since the fade color
|
|
2091
|
+
* takes its place; every other sequence stays where it was.
|
|
2092
|
+
* @param piece - the run's piece from {@link sliceColumns}, which opens with
|
|
2093
|
+
* the styling in force at the run's first column.
|
|
2094
|
+
* @param run - the run.
|
|
2095
|
+
* @param mixing - the encoding and the start color.
|
|
2096
|
+
* @returns the run with its fade colors; the sequences after its last text,
|
|
2097
|
+
* every one of them, as written.
|
|
2098
|
+
*/
|
|
2099
|
+
function fadeInRun(piece, run, mixing) {
|
|
2100
|
+
const state = {
|
|
2101
|
+
color: void 0,
|
|
2102
|
+
dim: false
|
|
2103
|
+
};
|
|
2104
|
+
let out = "";
|
|
2105
|
+
let kept = "";
|
|
2106
|
+
let read = "";
|
|
2107
|
+
let stale = true;
|
|
2108
|
+
for (const part of lineParts(piece)) {
|
|
2109
|
+
if (part.sequence) {
|
|
2110
|
+
read += part.text;
|
|
2111
|
+
const effect = foregroundEffect(part.text);
|
|
2112
|
+
if (effect !== "none") {
|
|
2113
|
+
applySgr(state, part.text);
|
|
2114
|
+
stale = true;
|
|
2115
|
+
}
|
|
2116
|
+
if (effect !== "only") kept += part.text;
|
|
2117
|
+
continue;
|
|
2118
|
+
}
|
|
2119
|
+
out += kept;
|
|
2120
|
+
if (stale) out += state.color === void 0 ? run.sgr : encodeMix(mixing.capability, mixFadeColor(mixing.start, state.color, run.mix));
|
|
2121
|
+
out += part.text;
|
|
2122
|
+
kept = "";
|
|
2123
|
+
read = "";
|
|
2124
|
+
stale = false;
|
|
2125
|
+
}
|
|
2126
|
+
return `${out}${read}`;
|
|
2127
|
+
}
|
|
2128
|
+
/**
|
|
2129
|
+
* What one escape sequence does to the foreground.
|
|
2130
|
+
* @param sequence - one escape sequence from {@link lineParts}.
|
|
2131
|
+
* @returns `only` for an SGR whose every change sets or clears the
|
|
2132
|
+
* foreground, `some` for an SGR with a full reset or a foreground change
|
|
2133
|
+
* among other changes, and `none` for any other sequence.
|
|
2134
|
+
*/
|
|
2135
|
+
function foregroundEffect(sequence) {
|
|
2136
|
+
if (!isSgr(sequence)) return "none";
|
|
2137
|
+
const changes = sgrChanges(sequence);
|
|
2138
|
+
const touching = changes.filter((change) => change[0] === 0 || setsForeground(change[0]));
|
|
2139
|
+
if (touching.length === 0) return "none";
|
|
2140
|
+
return touching.length === changes.length && touching.every((change) => change[0] !== 0) ? "only" : "some";
|
|
2141
|
+
}
|
|
1865
2142
|
//#endregion
|
|
1866
2143
|
//#region lib/types/json-tree.js
|
|
1867
2144
|
/**
|
|
@@ -2279,10 +2556,19 @@ function hunks(lines, context) {
|
|
|
2279
2556
|
//#endregion
|
|
2280
2557
|
//#region lib/types/stream-args.js
|
|
2281
2558
|
/**
|
|
2282
|
-
*
|
|
2283
|
-
*
|
|
2559
|
+
* Rows a tool card draws for its arguments: the raw input of a call whose
|
|
2560
|
+
* presenter supplied no content, and the live rows of a call whose argument
|
|
2561
|
+
* JSON is still streaming. A live path, command, or description appears once
|
|
2562
|
+
* its key is complete; a content key appears as a size that grows while its
|
|
2563
|
+
* text arrives, never as the text.
|
|
2284
2564
|
* @module @deepseek-ai/dsh-tui-app/stream-args
|
|
2285
2565
|
*/
|
|
2566
|
+
/** Keys whose text is shown as a size, not as the text itself. */
|
|
2567
|
+
const SIZED_KEYS = [
|
|
2568
|
+
"content",
|
|
2569
|
+
"old_string",
|
|
2570
|
+
"new_string"
|
|
2571
|
+
];
|
|
2286
2572
|
/**
|
|
2287
2573
|
* Rows for a generic card's raw input when the presenter supplied no content.
|
|
2288
2574
|
* A todo list becomes one status line per item. A string is the program or path.
|
|
@@ -2323,6 +2609,34 @@ function todoLines$1(value) {
|
|
|
2323
2609
|
}
|
|
2324
2610
|
return lines;
|
|
2325
2611
|
}
|
|
2612
|
+
/**
|
|
2613
|
+
* Rows for the arguments of a call that are still streaming: the path
|
|
2614
|
+
* (`file_path`, else `path`), the command, and the first line of the
|
|
2615
|
+
* description, each once its key is complete, then one size row per text key
|
|
2616
|
+
* that holds content (`content`, `old_string`, `new_string`), as in
|
|
2617
|
+
* `content 3 KB`. A size counts the text decoded so far in UTF-16 units,
|
|
2618
|
+
* rounds up to whole kilobytes of 1024, and grows while the text arrives.
|
|
2619
|
+
* @param partial - the live argument parser.
|
|
2620
|
+
* @returns the rows; empty while no key has anything to show.
|
|
2621
|
+
*/
|
|
2622
|
+
function streamedArgumentLines(partial) {
|
|
2623
|
+
const lines = [];
|
|
2624
|
+
const path = partial.complete("file_path") ? partial.text("file_path") : partial.complete("path") ? partial.text("path") : void 0;
|
|
2625
|
+
if (path !== void 0 && path !== "") lines.push(path);
|
|
2626
|
+
const command = partial.complete("command") ? partial.text("command") : void 0;
|
|
2627
|
+
if (command !== void 0 && command !== "") lines.push(command);
|
|
2628
|
+
const description = partial.complete("description") ? partial.text("description") : void 0;
|
|
2629
|
+
if (description !== void 0 && description !== "") {
|
|
2630
|
+
const first = description.split("\n")[0];
|
|
2631
|
+
if (first !== void 0 && first !== "") lines.push(first);
|
|
2632
|
+
}
|
|
2633
|
+
for (const key of SIZED_KEYS) {
|
|
2634
|
+
const length = partial.stringLength(key);
|
|
2635
|
+
if (length === void 0 || length === 0) continue;
|
|
2636
|
+
lines.push(`${key} ${String(Math.max(1, Math.ceil(length / 1024)))} KB`);
|
|
2637
|
+
}
|
|
2638
|
+
return lines;
|
|
2639
|
+
}
|
|
2326
2640
|
//#endregion
|
|
2327
2641
|
//#region lib/types/transcript.js
|
|
2328
2642
|
/**
|
|
@@ -4402,17 +4716,18 @@ const WORKFLOW_SPINNER = [
|
|
|
4402
4716
|
];
|
|
4403
4717
|
/**
|
|
4404
4718
|
* Bloom frames for the live Thinking header, disjoint from every tool
|
|
4405
|
-
* family; completed reasoning keeps its static `✻`.
|
|
4719
|
+
* family; completed reasoning keeps its static `✻`. No frame has the Unicode
|
|
4720
|
+
* `Emoji` property, so a terminal never draws one from a colour emoji font.
|
|
4406
4721
|
*/
|
|
4407
4722
|
const THINKING_SPINNER = [
|
|
4408
4723
|
"☙",
|
|
4409
|
-
"
|
|
4410
|
-
"
|
|
4411
|
-
"
|
|
4724
|
+
"⊛",
|
|
4725
|
+
"✠",
|
|
4726
|
+
"☼",
|
|
4412
4727
|
"※",
|
|
4413
|
-
"
|
|
4728
|
+
"⁜",
|
|
4414
4729
|
"⁂",
|
|
4415
|
-
"
|
|
4730
|
+
"⍟"
|
|
4416
4731
|
];
|
|
4417
4732
|
/** Blank steps between two shimmer passes, so the sweep pauses past the word's end. */
|
|
4418
4733
|
const SHIMMER_GAP = 6;
|
|
@@ -9350,6 +9665,15 @@ const PROVIDER_DEFAULT_LABEL = "Provider default";
|
|
|
9350
9665
|
/** The `/effort` argument that restores the provider default. */
|
|
9351
9666
|
const DEFAULT_ARGUMENT = "default";
|
|
9352
9667
|
/**
|
|
9668
|
+
* The short effort label the status bar, the `/model` row in force, and the
|
|
9669
|
+
* default-model save notice draw.
|
|
9670
|
+
* @param effort - the selection's reasoning effort, or undefined when it leaves reasoning effort to the model.
|
|
9671
|
+
* @returns `effort <id>`, or `effort default` for the model's own default.
|
|
9672
|
+
*/
|
|
9673
|
+
function effortLabel(effort) {
|
|
9674
|
+
return effort === void 0 ? "effort default" : `effort ${effort}`;
|
|
9675
|
+
}
|
|
9676
|
+
/**
|
|
9353
9677
|
* The display name of one effort.
|
|
9354
9678
|
* @param reasoning - what the model declares.
|
|
9355
9679
|
* @param effort - the selected effort, or undefined for the provider default.
|
|
@@ -12071,7 +12395,7 @@ function effortSegment(effort) {
|
|
|
12071
12395
|
const unset = effort === void 0;
|
|
12072
12396
|
return {
|
|
12073
12397
|
id: "effort",
|
|
12074
|
-
label:
|
|
12398
|
+
label: effortLabel(effort),
|
|
12075
12399
|
detail: printed([unset ? "reasoning effort: the model's own default" : `reasoning effort: ${effort}`, "Shift+Tab or /effort opens the effort list"])
|
|
12076
12400
|
};
|
|
12077
12401
|
}
|
|
@@ -15895,8 +16219,16 @@ const ATTACHMENT_FLIGHT_WAIT = "wait for the attachment submission to finish (Es
|
|
|
15895
16219
|
/** The one extra key the model picker answers, stated above its rows. */
|
|
15896
16220
|
const MODEL_PICKER_HINT = "Ctrl+S saves the highlighted model as the default for the next launch";
|
|
15897
16221
|
/**
|
|
16222
|
+
* The model picker row value of one selection.
|
|
16223
|
+
* @param selection - the provider and model; any effort is not part of the value.
|
|
16224
|
+
* @returns `provider/model`.
|
|
16225
|
+
*/
|
|
16226
|
+
function modelValue(selection) {
|
|
16227
|
+
return `${selection.provider}/${selection.model}`;
|
|
16228
|
+
}
|
|
16229
|
+
/**
|
|
15898
16230
|
* Read a picker row value back into a selection.
|
|
15899
|
-
* @param value - `provider/model`, as {@link
|
|
16231
|
+
* @param value - `provider/model`, as {@link modelValue} writes it.
|
|
15900
16232
|
* @returns the provider and model.
|
|
15901
16233
|
*/
|
|
15902
16234
|
function splitModelValue(value) {
|
|
@@ -15906,6 +16238,24 @@ function splitModelValue(value) {
|
|
|
15906
16238
|
model: value.slice(slash + 1)
|
|
15907
16239
|
};
|
|
15908
16240
|
}
|
|
16241
|
+
/**
|
|
16242
|
+
* Name the effort in force on the model picker row in force, ahead of the
|
|
16243
|
+
* model's own description.
|
|
16244
|
+
* @param items - the model picker rows.
|
|
16245
|
+
* @param current - the selection in force.
|
|
16246
|
+
* @returns the rows, the one in force naming its effort.
|
|
16247
|
+
*/
|
|
16248
|
+
function markEffortInForce(items, current) {
|
|
16249
|
+
const value = modelValue(current);
|
|
16250
|
+
return items.map((item) => {
|
|
16251
|
+
if (item.value !== value) return item;
|
|
16252
|
+
const effort = effortLabel(current.reasoningEffort);
|
|
16253
|
+
return {
|
|
16254
|
+
...item,
|
|
16255
|
+
description: item.description === void 0 ? effort : `${effort} · ${item.description}`
|
|
16256
|
+
};
|
|
16257
|
+
});
|
|
16258
|
+
}
|
|
15909
16259
|
/** What the banner and header call an open `/btw` side agent. */
|
|
15910
16260
|
const BTW_VIEW_TITLE = "btw side agent";
|
|
15911
16261
|
/** What the banner calls an open one-shot subagent view, which shows history and takes no input. */
|
|
@@ -15980,6 +16330,15 @@ function assumedForeground(background) {
|
|
|
15980
16330
|
return (.2126 * background.r + .7152 * background.g + .0722 * background.b) / 255 < DARK_BACKGROUND_LUMINANCE ? LIGHT_FOREGROUND : DARK_FOREGROUND;
|
|
15981
16331
|
}
|
|
15982
16332
|
/**
|
|
16333
|
+
* Whether two lists of card rows are the same rows in the same order.
|
|
16334
|
+
* @param rows - the rows a streamed call reads now.
|
|
16335
|
+
* @param drawn - the rows the card last drew.
|
|
16336
|
+
* @returns true when `drawn` holds exactly `rows`.
|
|
16337
|
+
*/
|
|
16338
|
+
function sameRows(rows, drawn) {
|
|
16339
|
+
return drawn.length === rows.length && rows.every((row, index) => row === drawn[index]);
|
|
16340
|
+
}
|
|
16341
|
+
/**
|
|
15983
16342
|
* Where one step along the status bar's segments lands: one either way,
|
|
15984
16343
|
* wrapping at both ends, or straight to an end.
|
|
15985
16344
|
* @param to - which way the key steps.
|
|
@@ -16319,7 +16678,7 @@ var TuiApp = class {
|
|
|
16319
16678
|
/** The global fold action has not chosen a workflow default until the first `Ctrl+O`. */
|
|
16320
16679
|
workflowExpanded;
|
|
16321
16680
|
toolArguments = /* @__PURE__ */ new Map();
|
|
16322
|
-
/**
|
|
16681
|
+
/** The arguments each call streamed so far through `tool-call-delta` chunks, keyed by call id. */
|
|
16323
16682
|
toolStreamArgs = /* @__PURE__ */ new Map();
|
|
16324
16683
|
/** Cards mounted from the live stream that no logged `tool/call` has confirmed yet. */
|
|
16325
16684
|
unconfirmedTools = /* @__PURE__ */ new Map();
|
|
@@ -20094,11 +20453,11 @@ var TuiApp = class {
|
|
|
20094
20453
|
return;
|
|
20095
20454
|
}
|
|
20096
20455
|
const current = this.currentSelection();
|
|
20097
|
-
const picked = await this.showModal(new PickPrompt(this.deps.palette, "Model for the next request", items, {
|
|
20456
|
+
const picked = await this.showModal(new PickPrompt(this.deps.palette, "Model for the next request", markEffortInForce(items, current), {
|
|
20098
20457
|
body: [MODEL_PICKER_HINT],
|
|
20099
|
-
current:
|
|
20458
|
+
current: modelValue(current),
|
|
20100
20459
|
onSave: (item) => {
|
|
20101
|
-
this.saveDefaultModel(splitModelValue(item.value));
|
|
20460
|
+
this.saveDefaultModel(item.value === modelValue(current) ? current : splitModelValue(item.value));
|
|
20102
20461
|
}
|
|
20103
20462
|
}));
|
|
20104
20463
|
if (picked === void 0) return;
|
|
@@ -20116,8 +20475,9 @@ var TuiApp = class {
|
|
|
20116
20475
|
}
|
|
20117
20476
|
/**
|
|
20118
20477
|
* Record `model` as the default every later launch starts from. The
|
|
20119
|
-
* reasoning effort rides along when the selection carries one
|
|
20120
|
-
*
|
|
20478
|
+
* reasoning effort rides along when the selection carries one, and the
|
|
20479
|
+
* notice names the saved effort, `effort default` when there is none.
|
|
20480
|
+
* @param model - the provider, model, and optional effort to save.
|
|
20121
20481
|
*/
|
|
20122
20482
|
async saveDefaultModel(model) {
|
|
20123
20483
|
const defaults = this.deps.ctx.get("agentDefaultModel");
|
|
@@ -20132,7 +20492,7 @@ var TuiApp = class {
|
|
|
20132
20492
|
this.notice(`default model not saved: ${describeFailure(error)}`, "error");
|
|
20133
20493
|
return;
|
|
20134
20494
|
}
|
|
20135
|
-
this.notice(`default model saved: ${model
|
|
20495
|
+
this.notice(`default model saved: ${modelValue(model)} · ${effortLabel(model.reasoningEffort)}`, "success");
|
|
20136
20496
|
}
|
|
20137
20497
|
/**
|
|
20138
20498
|
* Offer the model's reasoning efforts when it declares more than one. The
|
|
@@ -20405,11 +20765,17 @@ var TuiApp = class {
|
|
|
20405
20765
|
this.notice(`${provider.id}: ${describeFailure(error)}`, "error");
|
|
20406
20766
|
continue;
|
|
20407
20767
|
}
|
|
20408
|
-
for (const model of models)
|
|
20409
|
-
value
|
|
20410
|
-
|
|
20411
|
-
|
|
20412
|
-
|
|
20768
|
+
for (const model of models) {
|
|
20769
|
+
const value = modelValue({
|
|
20770
|
+
provider: provider.id,
|
|
20771
|
+
model: model.id
|
|
20772
|
+
});
|
|
20773
|
+
items.push({
|
|
20774
|
+
value,
|
|
20775
|
+
label: value,
|
|
20776
|
+
...model.description === void 0 ? {} : { description: model.description }
|
|
20777
|
+
});
|
|
20778
|
+
}
|
|
20413
20779
|
}
|
|
20414
20780
|
return items.sort((left, right) => left.label.localeCompare(right.label, "en", { numeric: true }));
|
|
20415
20781
|
}
|
|
@@ -21232,7 +21598,7 @@ var TuiApp = class {
|
|
|
21232
21598
|
this.toolStreamArgs.delete(callId);
|
|
21233
21599
|
this.pendingToolNames.set(callId, name);
|
|
21234
21600
|
this.setLoaderActivity(callingActivity(name));
|
|
21235
|
-
this.upsertToolCard(callId, name, argumentsJson
|
|
21601
|
+
this.upsertToolCard(callId, name, argumentsJson);
|
|
21236
21602
|
this.rememberWorkflowCall(callId, this.toolArguments.get(callId));
|
|
21237
21603
|
break;
|
|
21238
21604
|
}
|
|
@@ -21724,17 +22090,27 @@ var TuiApp = class {
|
|
|
21724
22090
|
}
|
|
21725
22091
|
/**
|
|
21726
22092
|
* Mount or refresh a tool card from a stream delta: the name as soon as
|
|
21727
|
-
* the model sends one,
|
|
21728
|
-
*
|
|
22093
|
+
* the model sends one, the rows {@link streamedArgumentLines} reads off the
|
|
22094
|
+
* arguments while their JSON is open, then the presenter headline once it
|
|
22095
|
+
* closes and parses.
|
|
21729
22096
|
* @param chunk - one `tool-call-delta` of the live assistant stream.
|
|
21730
22097
|
*/
|
|
21731
22098
|
onToolCallDelta(chunk) {
|
|
21732
22099
|
const name = this.streamedToolName(chunk);
|
|
21733
22100
|
if (chunk.id === "") return;
|
|
21734
|
-
|
|
21735
|
-
|
|
22101
|
+
let streamed = this.toolStreamArgs.get(chunk.id);
|
|
22102
|
+
if (streamed === void 0) {
|
|
22103
|
+
streamed = {
|
|
22104
|
+
text: "",
|
|
22105
|
+
partial: new PartialArguments(),
|
|
22106
|
+
rows: void 0
|
|
22107
|
+
};
|
|
22108
|
+
this.toolStreamArgs.set(chunk.id, streamed);
|
|
22109
|
+
}
|
|
22110
|
+
streamed.text += chunk.argumentsDelta;
|
|
22111
|
+
streamed.partial.append(chunk.argumentsDelta);
|
|
21736
22112
|
if (name === void 0) return;
|
|
21737
|
-
this.upsertToolCard(chunk.id, name,
|
|
22113
|
+
this.upsertToolCard(chunk.id, name, streamed.text, streamed);
|
|
21738
22114
|
}
|
|
21739
22115
|
/**
|
|
21740
22116
|
* Draw one tool card, creating it on the first sighting and updating the
|
|
@@ -21743,20 +22119,24 @@ var TuiApp = class {
|
|
|
21743
22119
|
* @param callId - the model's call id.
|
|
21744
22120
|
* @param name - the tool name.
|
|
21745
22121
|
* @param argumentsJson - arguments accumulated so far, or the logged string.
|
|
21746
|
-
* @param
|
|
22122
|
+
* @param streamed - a live call's arguments, which are parsed whole only
|
|
22123
|
+
* once their outer object closed; absent for the durable call.
|
|
21747
22124
|
*/
|
|
21748
|
-
upsertToolCard(callId, name, argumentsJson,
|
|
21749
|
-
const args = parseArguments(argumentsJson);
|
|
22125
|
+
upsertToolCard(callId, name, argumentsJson, streamed) {
|
|
22126
|
+
const args = streamed === void 0 || streamed.partial.closed() ? parseArguments(argumentsJson) : void 0;
|
|
21750
22127
|
if (args !== void 0) this.toolArguments.set(callId, args);
|
|
21751
|
-
const
|
|
21752
|
-
title: "",
|
|
21753
|
-
lines: []
|
|
21754
|
-
} : toolCallText(argumentsJson, args === void 0 ? void 0 : this.presentCall(name, args), name);
|
|
22128
|
+
const rows = streamed !== void 0 && args === void 0 ? streamedArgumentLines(streamed.partial) : void 0;
|
|
21755
22129
|
const existing = this.toolBlocks.get(callId);
|
|
22130
|
+
if (existing !== void 0 && rows !== void 0 && streamed?.rows !== void 0 && sameRows(rows, streamed.rows)) return;
|
|
22131
|
+
if (streamed !== void 0) streamed.rows = rows;
|
|
22132
|
+
const call = rows === void 0 ? toolCallText(argumentsJson, args === void 0 ? void 0 : this.presentCall(name, args), name) : {
|
|
22133
|
+
title: "",
|
|
22134
|
+
lines: rows
|
|
22135
|
+
};
|
|
21756
22136
|
if (existing !== void 0) {
|
|
21757
22137
|
existing.setCall(name, call);
|
|
21758
22138
|
if (isSubagentTool(name)) existing.setSubagent(subagentRowFacts(args));
|
|
21759
|
-
if (
|
|
22139
|
+
if (streamed === void 0) this.unconfirmedTools.delete(callId);
|
|
21760
22140
|
this.trackReveal(existing);
|
|
21761
22141
|
return;
|
|
21762
22142
|
}
|
|
@@ -21767,7 +22147,7 @@ var TuiApp = class {
|
|
|
21767
22147
|
this.chat.addChild(block);
|
|
21768
22148
|
this.revealBlock(block);
|
|
21769
22149
|
this.spinBlock(block);
|
|
21770
|
-
if (
|
|
22150
|
+
if (streamed !== void 0) this.unconfirmedTools.set(callId, block);
|
|
21771
22151
|
}
|
|
21772
22152
|
/**
|
|
21773
22153
|
* Take down every card the live stream mounted that no `tool/call` confirmed.
|
|
@@ -21901,7 +22281,7 @@ const Config = z.object({
|
|
|
21901
22281
|
toastMs: z.natural().min(500).default(TOAST_MS),
|
|
21902
22282
|
quitGraceMs: z.natural().min(1e3).default(1e4),
|
|
21903
22283
|
liveRefreshMs: z.natural().min(100).default(1e3),
|
|
21904
|
-
streamFadeSteps: z.natural().min(2).default(
|
|
22284
|
+
streamFadeSteps: z.natural().min(2).default(12),
|
|
21905
22285
|
streamFadeStepMs: z.natural().min(16).default(16),
|
|
21906
22286
|
streamPaceFrames: z.natural().default(8),
|
|
21907
22287
|
toolRevealFrames: z.natural().default(6),
|