@songtonyli/dsh-cli 0.1.86 → 0.1.88

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.
Files changed (97) hide show
  1. package/README.md +1 -1
  2. package/bin/dsh.mjs +1 -1
  3. package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/LICENSE +201 -0
  4. package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/README.md +9 -0
  5. package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-cjs/index.js +859 -0
  6. package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/build-abort-error.js +19 -0
  7. package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/constants.js +1 -0
  8. package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +12 -0
  9. package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js +51 -0
  10. package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/index.js +3 -0
  11. package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +251 -0
  12. package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +135 -0
  13. package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +46 -0
  14. package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +180 -0
  15. package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/node-http2.js +2 -0
  16. package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/node-https.js +2 -0
  17. package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +36 -0
  18. package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js +21 -0
  19. package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +22 -0
  20. package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +23 -0
  21. package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/timing.js +4 -0
  22. package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +63 -0
  23. package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/package.json +56 -0
  24. package/node_modules/@aws-sdk/core/package.json +2 -2
  25. package/node_modules/@aws-sdk/credential-provider-env/package.json +3 -3
  26. package/node_modules/@aws-sdk/credential-provider-http/package.json +4 -4
  27. package/node_modules/@aws-sdk/credential-provider-ini/package.json +10 -10
  28. package/node_modules/@aws-sdk/credential-provider-login/package.json +4 -4
  29. package/node_modules/@aws-sdk/credential-provider-node/package.json +8 -8
  30. package/node_modules/@aws-sdk/credential-provider-process/package.json +3 -3
  31. package/node_modules/@aws-sdk/credential-provider-sso/package.json +5 -5
  32. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +4 -4
  33. package/node_modules/@aws-sdk/eventstream-handler-node/package.json +2 -2
  34. package/node_modules/@aws-sdk/middleware-eventstream/package.json +2 -2
  35. package/node_modules/@aws-sdk/middleware-websocket/package.json +3 -3
  36. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
  37. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
  38. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
  39. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
  40. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
  41. package/node_modules/@aws-sdk/nested-clients/package.json +4 -4
  42. package/node_modules/@aws-sdk/token-providers/package.json +4 -4
  43. package/node_modules/@deepseek-ai/dsh-client-modules/lib/index.js +1 -1
  44. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
  45. package/node_modules/@deepseek-ai/dsh-tui-app/README.i18n.yaml +6 -6
  46. package/node_modules/@deepseek-ai/dsh-tui-app/README.md +3 -2
  47. package/node_modules/@deepseek-ai/dsh-tui-app/README.zh.md +3 -2
  48. package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +256 -32
  49. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/LICENSE +201 -0
  50. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/README.md +9 -0
  51. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-cjs/index.js +859 -0
  52. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/build-abort-error.js +19 -0
  53. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/constants.js +1 -0
  54. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +12 -0
  55. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js +51 -0
  56. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/index.js +3 -0
  57. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +251 -0
  58. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +135 -0
  59. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +46 -0
  60. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +180 -0
  61. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2.js +2 -0
  62. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-https.js +2 -0
  63. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +36 -0
  64. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js +21 -0
  65. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +22 -0
  66. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +23 -0
  67. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/timing.js +4 -0
  68. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +63 -0
  69. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/package.json +56 -0
  70. package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +13 -37
  71. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +44 -29
  72. package/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +12 -37
  73. package/node_modules/@smithy/core/dist-es/submodules/protocols/AbstractRpcV2Protocol.js +35 -0
  74. package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +4 -1
  75. package/node_modules/@smithy/core/dist-es/submodules/protocols/index.js +1 -0
  76. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/SmithyRpcV2JsonProtocol.js +8 -31
  77. package/node_modules/@smithy/core/package.json +1 -1
  78. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +48 -6
  79. package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +9 -1
  80. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +20 -2
  81. package/node_modules/@smithy/node-http-handler/dist-es/resolve-default-socket-timeout.js +4 -0
  82. package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +16 -3
  83. package/node_modules/@smithy/node-http-handler/package.json +3 -3
  84. package/node_modules/bowser/README.md +26 -3
  85. package/node_modules/bowser/bowser.mjs +2225 -0
  86. package/node_modules/bowser/bundled.js +14 -1
  87. package/node_modules/bowser/es5.js +14 -1
  88. package/node_modules/bowser/package.json +84 -27
  89. package/node_modules/bowser/src/bowser.js +9 -1
  90. package/node_modules/bowser/src/constants.js +7 -0
  91. package/node_modules/bowser/src/parser-browsers.js +73 -7
  92. package/node_modules/bowser/src/parser-engines.js +12 -0
  93. package/node_modules/bowser/src/parser-os.js +3 -1
  94. package/node_modules/bowser/src/parser-platforms.js +3 -1
  95. package/node_modules/bowser/src/parser.js +22 -5
  96. package/node_modules/bowser/src/utils.js +16 -0
  97. package/package.json +18 -18
@@ -2100,6 +2100,168 @@ function hunks(lines, context) {
2100
2100
  return out;
2101
2101
  }
2102
2102
  //#endregion
2103
+ //#region lib/types/json-tree.js
2104
+ /**
2105
+ * Structured JSON output for terminal cards. Valid JSON objects and arrays
2106
+ * become tree rows with token ranges; the palette colors those ranges without
2107
+ * changing the plain rows used for wrapping and navigation.
2108
+ * @module @deepseek-ai/dsh-tui-app/json-tree
2109
+ */
2110
+ /** Build one plain row and its token ranges from ordered segments. */
2111
+ function row(segments) {
2112
+ let text = "";
2113
+ const spans = [];
2114
+ for (const segment of segments) {
2115
+ const start = text.length;
2116
+ text += segment.text;
2117
+ if (segment.tone !== void 0) spans.push({
2118
+ start,
2119
+ end: text.length,
2120
+ tone: segment.tone
2121
+ });
2122
+ }
2123
+ return {
2124
+ text,
2125
+ style: { spans }
2126
+ };
2127
+ }
2128
+ /** The indentation a nested value's children continue from its branch. */
2129
+ function childPrefix(prefix, connector) {
2130
+ return connector === "├─ " ? `${prefix}│ ` : `${prefix} `;
2131
+ }
2132
+ /** Entries and container kind of an object or array. */
2133
+ function containerEntries(value) {
2134
+ const array = Array.isArray(value);
2135
+ return {
2136
+ array,
2137
+ entries: array ? value.map((item, index) => [String(index), item]) : Object.entries(value)
2138
+ };
2139
+ }
2140
+ /** Append one labeled value and, for a nonempty container, its descendants. */
2141
+ function appendNested(rows, value, label, prefix, connector) {
2142
+ const guide = `${prefix}${connector}`;
2143
+ const labelSegment = [{
2144
+ text: label.text,
2145
+ tone: label.tone
2146
+ }, { text: ":" }];
2147
+ if (typeof value === "object" && value !== null) {
2148
+ const { array, entries } = containerEntries(value);
2149
+ if (entries.length === 0) {
2150
+ const empty = array ? "(empty array)" : "(empty object)";
2151
+ rows.push(row([
2152
+ {
2153
+ text: guide,
2154
+ tone: "guide"
2155
+ },
2156
+ ...labelSegment,
2157
+ { text: " " },
2158
+ {
2159
+ text: empty,
2160
+ tone: "empty"
2161
+ }
2162
+ ]));
2163
+ return;
2164
+ }
2165
+ rows.push(row([{
2166
+ text: guide,
2167
+ tone: "guide"
2168
+ }, ...labelSegment]));
2169
+ const nested = childPrefix(prefix, connector);
2170
+ entries.forEach(([key, item], index) => {
2171
+ appendNested(rows, item, {
2172
+ text: array ? `[${key}]` : key,
2173
+ tone: array ? "index" : "key"
2174
+ }, nested, index === entries.length - 1 ? "╰─ " : "├─ ");
2175
+ });
2176
+ return;
2177
+ }
2178
+ const text = typeof value === "string" ? JSON.stringify(value) : String(value);
2179
+ const tone = typeof value === "string" ? "string" : typeof value === "number" ? "number" : typeof value === "boolean" ? "boolean" : "null";
2180
+ rows.push(row([
2181
+ {
2182
+ text: guide,
2183
+ tone: "guide"
2184
+ },
2185
+ ...labelSegment,
2186
+ { text: " " },
2187
+ {
2188
+ text,
2189
+ tone
2190
+ }
2191
+ ]));
2192
+ }
2193
+ /**
2194
+ * Format a complete JSON object or array as a tree without object and array
2195
+ * braces. Strings remain JSON-quoted and escaped; empty containers name their
2196
+ * type. Other JSON values, malformed JSON, and mixed text return undefined.
2197
+ * @param text - the complete output text to parse.
2198
+ * @returns aligned plain rows and token ranges, or undefined to keep the original output.
2199
+ */
2200
+ function jsonTreeText(text) {
2201
+ let value;
2202
+ try {
2203
+ value = JSON.parse(text);
2204
+ } catch {
2205
+ return;
2206
+ }
2207
+ if (typeof value !== "object" || value === null) return void 0;
2208
+ const { array, entries } = containerEntries(value);
2209
+ if (entries.length === 0) {
2210
+ const empty = row([{
2211
+ text: array ? "(empty array)" : "(empty object)",
2212
+ tone: "empty"
2213
+ }]);
2214
+ return {
2215
+ lines: [empty.text],
2216
+ json: [empty.style]
2217
+ };
2218
+ }
2219
+ const rows = [];
2220
+ entries.forEach(([key, item], index) => {
2221
+ appendNested(rows, item, {
2222
+ text: array ? `[${key}]` : key,
2223
+ tone: array ? "index" : "key"
2224
+ }, "", index === entries.length - 1 ? "╰─ " : "├─ ");
2225
+ });
2226
+ return {
2227
+ lines: rows.map((item) => item.text),
2228
+ json: rows.map((item) => item.style)
2229
+ };
2230
+ }
2231
+ /**
2232
+ * Color JSON token ranges and dim non-JSON shell-output rows. JSON tree rows
2233
+ * carry no code spans, so their ranges always refer to unstyled plain text.
2234
+ * @param rows - rows to paint.
2235
+ * @param json - JSON token ranges aligned with `rows`; absent entries are not JSON.
2236
+ * @param shellOutput - whether each non-JSON row is shell output to dim.
2237
+ * @param palette - active terminal palette.
2238
+ * @returns styled rows, with input rows left unchanged when no role applies.
2239
+ */
2240
+ function paintJsonRows(rows, json, shellOutput, palette) {
2241
+ const tone = {
2242
+ guide: palette.dim,
2243
+ key: palette.tool,
2244
+ index: palette.heading,
2245
+ string: palette.success,
2246
+ number: palette.warning,
2247
+ boolean: palette.link,
2248
+ null: palette.dim,
2249
+ empty: palette.dim
2250
+ };
2251
+ return rows.map((rowText, index) => {
2252
+ const spans = json?.[index]?.spans;
2253
+ if (spans === void 0) return shellOutput?.[index] === true ? palette.dim(rowText) : rowText;
2254
+ let painted = "";
2255
+ let offset = 0;
2256
+ for (const span of spans) {
2257
+ painted += rowText.slice(offset, span.start);
2258
+ painted += tone[span.tone](rowText.slice(span.start, span.end));
2259
+ offset = span.end;
2260
+ }
2261
+ return painted + rowText.slice(offset);
2262
+ });
2263
+ }
2264
+ //#endregion
2103
2265
  //#region lib/types/stream-args.js
2104
2266
  /**
2105
2267
  * Lines for a generic card's raw input when the presenter supplied no content.
@@ -2321,8 +2483,8 @@ function describeFailure(error) {
2321
2483
  }
2322
2484
  /**
2323
2485
  * The transcript row for one shell command, with the prompt outside the source.
2324
- * @param command - the command text, one logical line or the first of several.
2325
- * @returns `$ ${command}`.
2486
+ * @param command - the command text, which may hold several lines.
2487
+ * @returns `$ ${command}`, still one row: the prompt leads the first line only.
2326
2488
  */
2327
2489
  function shellCommandRow(command) {
2328
2490
  return `\$ ${command}`;
@@ -2549,23 +2711,43 @@ function toolCallText(argumentsJson, view, toolName) {
2549
2711
  default: return assertNever(view, "tui tool call view");
2550
2712
  }
2551
2713
  }
2714
+ /** Plain text or a structured tree when the complete result is a JSON object or array. */
2715
+ function contentResultBody(content) {
2716
+ const text = contentText(content);
2717
+ const tree = jsonTreeText(text);
2718
+ if (tree !== void 0) return tree;
2719
+ return { lines: text.split("\n").filter((line) => line !== "") };
2720
+ }
2552
2721
  /**
2553
- * {@link toolResultLines} with the code span behind each row of a `read` or
2554
- * `diff` card, so the card draws the file's own language in colour.
2722
+ * {@link toolResultLines} with code spans for `read` and `diff` cards, JSON
2723
+ * token ranges for complete object or array output, and the shell-output
2724
+ * marker for terminal cards.
2555
2725
  * @param view - the tool's `presentResult` view, when it has one.
2556
2726
  * @param content - the model-facing result content.
2557
- * @returns the rows and, for the two code cards, their spans.
2727
+ * @returns the rows and their aligned presentation metadata.
2558
2728
  */
2559
2729
  function toolResultBody(view, content) {
2560
- if (view === void 0) return { lines: contentText(content).split("\n").filter((line) => line !== "") };
2730
+ if (view === void 0) return contentResultBody(content);
2561
2731
  switch (view.card) {
2562
- case "generic": return { lines: contentText(view.content ?? content).split("\n").filter((line) => line !== "") };
2732
+ case "generic": return contentResultBody(view.content ?? content);
2563
2733
  case "terminal": {
2564
- const lines = (view.output ?? "").split("\n");
2565
- while (lines.length > 0 && lines.at(-1) === "") lines.pop();
2566
- if (view.exitCode !== void 0 && view.exitCode !== 0) lines.push(`exit ${String(view.exitCode)}`);
2567
- if (view.signal !== void 0) lines.push(`signal ${view.signal}`);
2568
- return { lines };
2734
+ const tree = jsonTreeText(view.output ?? "");
2735
+ const lines = tree?.lines ?? (view.output ?? "").split("\n");
2736
+ const json = tree === void 0 ? void 0 : [...tree.json];
2737
+ while (tree === void 0 && lines.length > 0 && lines.at(-1) === "") lines.pop();
2738
+ if (view.exitCode !== void 0 && view.exitCode !== 0) {
2739
+ lines.push(`exit ${String(view.exitCode)}`);
2740
+ json?.push(void 0);
2741
+ }
2742
+ if (view.signal !== void 0) {
2743
+ lines.push(`signal ${view.signal}`);
2744
+ json?.push(void 0);
2745
+ }
2746
+ return {
2747
+ lines,
2748
+ shellOutput: true,
2749
+ ...json === void 0 ? {} : { json }
2750
+ };
2569
2751
  }
2570
2752
  case "diff": return diffsBody(view.diffs);
2571
2753
  case "search": {
@@ -2600,8 +2782,8 @@ function toolResultBody(view, content) {
2600
2782
  * Draw card rows in syntax colour where a highlighter and a span allow it.
2601
2783
  * Consecutive spans of one language are coloured as one block, so a comment
2602
2784
  * or string that spans rows keeps its colour; a group the highlighter cannot
2603
- * colour yet, or colours to a different row count, draws plain and is drawn
2604
- * again once its grammar lands.
2785
+ * colour yet, or colours to a different number of lines than its sources
2786
+ * hold, draws plain and is drawn again once its grammar lands.
2605
2787
  * @param lines - the plain rows.
2606
2788
  * @param code - the span behind each row, aligned by index; absent rows draw plain.
2607
2789
  * @param highlight - the highlighter; absent draws every row plain.
@@ -2620,10 +2802,16 @@ function paintCodeRows(lines, code, highlight) {
2620
2802
  let end = index + 1;
2621
2803
  while (end < lines.length && code[end]?.lang === span.lang) end += 1;
2622
2804
  const group = code.slice(index, end);
2805
+ const heights = group.map((row) => row.source.split("\n").length);
2623
2806
  const coloured = highlight.lines(group.map((row) => row.source).join("\n"), span.lang);
2624
- if (coloured !== void 0 && coloured.length === group.length) coloured.forEach((text, offset) => {
2625
- out[index + offset] = `${group[offset].prefix}${text}`;
2626
- });
2807
+ if (coloured !== void 0 && coloured.length === heights.reduce((total, height) => total + height, 0)) {
2808
+ let taken = 0;
2809
+ for (const [offset, row] of group.entries()) {
2810
+ const height = heights[offset];
2811
+ out[index + offset] = `${row.prefix}${coloured.slice(taken, taken + height).join("\n")}`;
2812
+ taken += height;
2813
+ }
2814
+ }
2627
2815
  index = end;
2628
2816
  }
2629
2817
  return out;
@@ -5282,9 +5470,9 @@ var FenceMemo = class {
5282
5470
  }
5283
5471
  };
5284
5472
  /**
5285
- * A finished `!` / `!!` run: `$ command` in shellscript colour, then the
5286
- * output rows. Re-paints when a grammar lands because {@link LastDrawn}
5287
- * drops on `invalidate()`.
5473
+ * A finished `!` / `!!` run: `$ command` in shellscript colour, then dimmed
5474
+ * output rows or a semantic-colour JSON tree. Re-paints when a grammar lands
5475
+ * because {@link LastDrawn} drops on `invalidate()`.
5288
5476
  */
5289
5477
  var UserShellBlock = class {
5290
5478
  theme;
@@ -5312,8 +5500,16 @@ var UserShellBlock = class {
5312
5500
  */
5313
5501
  render(width) {
5314
5502
  return this.drawn.get(String(width), () => {
5315
- const { lines, code } = shellCommandBody(this.command, this.rows.slice(1));
5316
- const painted = paintCodeRows(lines, code, this.theme.codeHighlight);
5503
+ const extra = this.rows.slice(1);
5504
+ const tree = extra[0] === void 0 ? void 0 : jsonTreeText(extra[0]);
5505
+ const displayed = tree === void 0 ? extra : [...tree.lines, ...extra.slice(1)];
5506
+ const { lines, code } = shellCommandBody(this.command, displayed);
5507
+ const json = tree === void 0 ? void 0 : [
5508
+ void 0,
5509
+ ...tree.json,
5510
+ ...extra.slice(1).map(() => void 0)
5511
+ ];
5512
+ const painted = paintJsonRows(paintCodeRows(lines, code, this.theme.codeHighlight), json, lines.map((_, index) => index > 0), this.theme.palette);
5317
5513
  const inner = Math.max(1, width);
5318
5514
  const [command = "", ...output] = painted;
5319
5515
  return [
@@ -5936,8 +6132,12 @@ var ToolBlock = class {
5936
6132
  resultLines = [];
5937
6133
  /** The code span behind each result row, for a `read` or `diff` result; absent otherwise. */
5938
6134
  resultCode;
6135
+ /** JSON token ranges behind result rows that form a tree; absent otherwise. */
6136
+ resultJson;
5939
6137
  /** Which result rows are diff additions or removals, for a `diff` result; absent otherwise. */
5940
6138
  resultDiff;
6139
+ /** Whether non-JSON result rows are shell output, dimmed apart from the command. */
6140
+ shellOutput = false;
5941
6141
  /** The facts a folded subagent card draws as one row; absent for every other tool. */
5942
6142
  subagent;
5943
6143
  expanded = false;
@@ -5998,7 +6198,8 @@ var ToolBlock = class {
5998
6198
  } : {
5999
6199
  kind: "call",
6000
6200
  rows: call,
6001
- ...this.call.code === void 0 ? {} : { code: [...title.map(() => void 0), ...this.call.code] }
6201
+ ...this.call.code === void 0 ? {} : { code: [...title.map(() => void 0), ...this.call.code] },
6202
+ ...this.call.json === void 0 ? {} : { json: [...title.map(() => void 0), ...this.call.json] }
6002
6203
  }];
6003
6204
  if (this.status !== "running") parts.push(this.resultLines.length === 0 ? {
6004
6205
  kind: "result",
@@ -6006,7 +6207,9 @@ var ToolBlock = class {
6006
6207
  } : {
6007
6208
  kind: "result",
6008
6209
  rows: this.resultLines,
6009
- ...this.resultCode === void 0 ? {} : { code: this.resultCode }
6210
+ ...this.resultCode === void 0 ? {} : { code: this.resultCode },
6211
+ ...this.resultJson === void 0 ? {} : { json: this.resultJson },
6212
+ ...this.shellOutput ? { shellOutput: true } : {}
6010
6213
  });
6011
6214
  this.sections = {
6012
6215
  revision: this.revision,
@@ -6091,15 +6294,18 @@ var ToolBlock = class {
6091
6294
  * @param isError - whether the tool reported failure.
6092
6295
  * @param code - the span behind each row, for a result the card colours as code.
6093
6296
  * @param diff - which rows are diff additions or removals, for a result the card boxes as a diff.
6297
+ * @param presentation - JSON token ranges and whether the rows are shell output.
6094
6298
  */
6095
- setResult(lines, isError, code, diff) {
6299
+ setResult(lines, isError, code, diff, presentation = {}) {
6096
6300
  if (diff !== void 0 && this.call.diff !== void 0) this.call = {
6097
6301
  title: this.call.title,
6098
6302
  lines: []
6099
6303
  };
6100
6304
  this.resultLines = lines;
6101
6305
  this.resultCode = code;
6306
+ this.resultJson = presentation.json;
6102
6307
  this.resultDiff = diff;
6308
+ this.shellOutput = presentation.shellOutput === true;
6103
6309
  this.status = isError ? "error" : "done";
6104
6310
  this.revision += 1;
6105
6311
  this.measured = false;
@@ -6112,7 +6318,9 @@ var ToolBlock = class {
6112
6318
  setBackground(lines) {
6113
6319
  this.resultLines = lines;
6114
6320
  this.resultCode = void 0;
6321
+ this.resultJson = void 0;
6115
6322
  this.resultDiff = void 0;
6323
+ this.shellOutput = false;
6116
6324
  this.status = "background";
6117
6325
  this.revision += 1;
6118
6326
  this.measured = false;
@@ -6278,9 +6486,16 @@ var ToolBlock = class {
6278
6486
  ...new Array(loading.length).fill(void 0),
6279
6487
  ...this.resultCode ?? new Array(this.resultLines.length).fill(void 0)
6280
6488
  ];
6489
+ const json = this.call.json === void 0 && this.resultJson === void 0 ? void 0 : [
6490
+ ...this.call.json ?? new Array(this.call.lines.length).fill(void 0),
6491
+ ...new Array(loading.length).fill(void 0),
6492
+ ...this.resultJson ?? new Array(this.resultLines.length).fill(void 0)
6493
+ ];
6494
+ const output = body.map((_, index) => this.shellOutput && index >= this.call.lines.length + loading.length);
6281
6495
  const kept = this.expanded ? body : foldRows(body, this.theme.toolPreviewLines, (hidden) => foldMarker(hidden, marked ? "marked" : "transcript"));
6282
6496
  const cut = !this.expanded && body.length > this.theme.toolPreviewLines;
6283
- const painted = paintCodeRows(kept, code, this.theme.codeHighlight);
6497
+ const presentationLength = cut ? kept.length - 1 : kept.length;
6498
+ const painted = paintJsonRows(paintCodeRows(kept, code, this.theme.codeHighlight), json?.slice(0, presentationLength), output.slice(0, presentationLength), palette);
6284
6499
  const shown = cut ? [...painted.slice(0, -1), paintKeys(palette, kept.at(-1), (text) => text)] : painted;
6285
6500
  const callCount = Math.min(this.call.lines.length + loading.length, shown.length);
6286
6501
  const marks = [
@@ -12518,11 +12733,14 @@ const MEASURING = createPalette(false);
12518
12733
  function bodySource(block, part) {
12519
12734
  if (block.blockKind === "tool" && part.kind === "call" && block.title !== "" && part.rows[0] === block.title) return {
12520
12735
  rows: part.rows.slice(1),
12521
- code: part.code?.slice(1)
12736
+ code: part.code?.slice(1),
12737
+ json: part.json?.slice(1)
12522
12738
  };
12523
12739
  return {
12524
12740
  rows: part.rows,
12525
- code: part.code
12741
+ code: part.code,
12742
+ json: part.json,
12743
+ shellOutput: part.shellOutput
12526
12744
  };
12527
12745
  }
12528
12746
  /**
@@ -12643,7 +12861,9 @@ function drawSection(block, part, width, look, header) {
12643
12861
  if (block.blockKind === "assistant" && part.kind === "reply") rows = [header, ...replyRows(part.rows, room, look).map((line) => `${indent}${line}`)];
12644
12862
  else {
12645
12863
  const source = bodySource(block, part);
12646
- rows = [header, ...paintCodeRows(source.rows, source.code, look.highlight).flatMap((row, index) => {
12864
+ const highlighted = paintCodeRows(source.rows, source.code, look.highlight);
12865
+ const output = source.shellOutput === true ? source.rows.map(() => true) : void 0;
12866
+ rows = [header, ...paintJsonRows(highlighted, source.json, output, look.palette).flatMap((row, index) => {
12647
12867
  const tone = rowTone(block, part, source.rows[index]);
12648
12868
  return wrapTextWithAnsi(row, room).map((line) => bodyRow(line, tone, indent, content, look));
12649
12869
  })];
@@ -12722,7 +12942,7 @@ function sectionRowCount(cursor, blocks, width) {
12722
12942
  const { block, part } = found;
12723
12943
  const cache = sectionRowsCache(block, cursor.part);
12724
12944
  const known = cache.measured;
12725
- if (known !== void 0 && known.width === width && known.kind === part.kind && sameEntries(known.rows, part.rows) && sameEntries(known.code, part.code)) return known.count;
12945
+ if (known !== void 0 && known.width === width && known.kind === part.kind && sameEntries(known.rows, part.rows) && sameEntries(known.code, part.code) && sameEntries(known.json, part.json) && known.shellOutput === part.shellOutput) return known.count;
12726
12946
  const lines = drawSection(block, part, width, {
12727
12947
  palette: MEASURING,
12728
12948
  held: false
@@ -12732,6 +12952,8 @@ function sectionRowCount(cursor, blocks, width) {
12732
12952
  kind: part.kind,
12733
12953
  rows: part.rows,
12734
12954
  code: part.code,
12955
+ json: part.json,
12956
+ shellOutput: part.shellOutput,
12735
12957
  count: lines.length
12736
12958
  };
12737
12959
  return lines.length;
@@ -12751,7 +12973,7 @@ function sectionRows(cursor, blocks, width, look) {
12751
12973
  const header = block.blockKind === "user" ? "" : headerRow(block, part, Math.max(1, width - visibleWidth(GUTTER)), look);
12752
12974
  const cache = sectionRowsCache(block, cursor.part);
12753
12975
  const known = cache.drawn;
12754
- if (known !== void 0 && known.width === width && known.kind === part.kind && known.header === header && known.look.palette === look.palette && known.look.tints === look.tints && known.look.highlight === look.highlight && known.highlightRevision === look.highlight?.revision && known.look.held === look.held && sameEntries(known.rows, part.rows) && sameEntries(known.code, part.code)) {
12976
+ if (known !== void 0 && known.width === width && known.kind === part.kind && known.header === header && known.look.palette === look.palette && known.look.tints === look.tints && known.look.highlight === look.highlight && known.highlightRevision === look.highlight?.revision && known.look.held === look.held && sameEntries(known.rows, part.rows) && sameEntries(known.code, part.code) && sameEntries(known.json, part.json) && known.shellOutput === part.shellOutput) {
12755
12977
  drawnSections.delete(known);
12756
12978
  drawnSections.set(known, cache);
12757
12979
  return known.lines;
@@ -12765,6 +12987,8 @@ function sectionRows(cursor, blocks, width, look) {
12765
12987
  header,
12766
12988
  rows: part.rows,
12767
12989
  code: part.code,
12990
+ json: part.json,
12991
+ shellOutput: part.shellOutput,
12768
12992
  lines
12769
12993
  });
12770
12994
  return lines;
@@ -20439,7 +20663,7 @@ var TuiApp = class {
20439
20663
  const moved = isError ? movedJobId(result.content) : void 0;
20440
20664
  if (moved === void 0) {
20441
20665
  const body = toolResultBody(this.presentResult(block.name, this.toolArguments.get(result.toolCallId), result.content, isError, event.data.meta), result.content);
20442
- block.setResult(body.lines, isError, body.code, body.diff);
20666
+ block.setResult(body.lines, isError, body.code, body.diff, body);
20443
20667
  } else block.setBackground([`◇ moved to the background as ${moved} · /jobs lists it`]);
20444
20668
  this.spinners.delete(block);
20445
20669
  this.updateSpinTicker();
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,9 @@
1
+ # @smithy/node-http-handler
2
+
3
+ [![NPM version](https://img.shields.io/npm/v/@smithy/node-http-handler/latest.svg)](https://www.npmjs.com/package/@smithy/node-http-handler)
4
+ [![NPM downloads](https://img.shields.io/npm/dm/@smithy/node-http-handler.svg)](https://www.npmjs.com/package/@smithy/node-http-handler)
5
+
6
+ This package implements the default `requestHandler` for Node.js using `node:http`, `node:https`, and `node:http2`.
7
+
8
+ For an example on how `requestHandler`s are used by Smithy generated SDK clients, refer to
9
+ the [AWS SDK for JavaScript (v3) supplemental docs](https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md#request-handler-requesthandler).