@songtonyli/dsh-cli 0.1.86 → 0.1.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) 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/@deepseek-ai/dsh-client-modules/lib/index.js +1 -1
  25. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
  26. package/node_modules/@deepseek-ai/dsh-tui-app/README.i18n.yaml +6 -6
  27. package/node_modules/@deepseek-ai/dsh-tui-app/README.md +3 -2
  28. package/node_modules/@deepseek-ai/dsh-tui-app/README.zh.md +3 -2
  29. package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +243 -25
  30. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/LICENSE +201 -0
  31. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/README.md +9 -0
  32. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-cjs/index.js +859 -0
  33. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/build-abort-error.js +19 -0
  34. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/constants.js +1 -0
  35. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +12 -0
  36. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js +51 -0
  37. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/index.js +3 -0
  38. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +251 -0
  39. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +135 -0
  40. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +46 -0
  41. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +180 -0
  42. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2.js +2 -0
  43. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-https.js +2 -0
  44. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +36 -0
  45. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js +21 -0
  46. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +22 -0
  47. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +23 -0
  48. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/timing.js +4 -0
  49. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +63 -0
  50. package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/package.json +56 -0
  51. package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +13 -37
  52. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +44 -29
  53. package/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +12 -37
  54. package/node_modules/@smithy/core/dist-es/submodules/protocols/AbstractRpcV2Protocol.js +35 -0
  55. package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +4 -1
  56. package/node_modules/@smithy/core/dist-es/submodules/protocols/index.js +1 -0
  57. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/SmithyRpcV2JsonProtocol.js +8 -31
  58. package/node_modules/@smithy/core/package.json +1 -1
  59. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +48 -6
  60. package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +9 -1
  61. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +20 -2
  62. package/node_modules/@smithy/node-http-handler/dist-es/resolve-default-socket-timeout.js +4 -0
  63. package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +16 -3
  64. package/node_modules/@smithy/node-http-handler/package.json +3 -3
  65. package/package.json +3 -3
@@ -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.
@@ -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": {
@@ -5282,9 +5464,9 @@ var FenceMemo = class {
5282
5464
  }
5283
5465
  };
5284
5466
  /**
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()`.
5467
+ * A finished `!` / `!!` run: `$ command` in shellscript colour, then dimmed
5468
+ * output rows or a semantic-colour JSON tree. Re-paints when a grammar lands
5469
+ * because {@link LastDrawn} drops on `invalidate()`.
5288
5470
  */
5289
5471
  var UserShellBlock = class {
5290
5472
  theme;
@@ -5312,8 +5494,16 @@ var UserShellBlock = class {
5312
5494
  */
5313
5495
  render(width) {
5314
5496
  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);
5497
+ const extra = this.rows.slice(1);
5498
+ const tree = extra[0] === void 0 ? void 0 : jsonTreeText(extra[0]);
5499
+ const displayed = tree === void 0 ? extra : [...tree.lines, ...extra.slice(1)];
5500
+ const { lines, code } = shellCommandBody(this.command, displayed);
5501
+ const json = tree === void 0 ? void 0 : [
5502
+ void 0,
5503
+ ...tree.json,
5504
+ ...extra.slice(1).map(() => void 0)
5505
+ ];
5506
+ const painted = paintJsonRows(paintCodeRows(lines, code, this.theme.codeHighlight), json, lines.map((_, index) => index > 0), this.theme.palette);
5317
5507
  const inner = Math.max(1, width);
5318
5508
  const [command = "", ...output] = painted;
5319
5509
  return [
@@ -5936,8 +6126,12 @@ var ToolBlock = class {
5936
6126
  resultLines = [];
5937
6127
  /** The code span behind each result row, for a `read` or `diff` result; absent otherwise. */
5938
6128
  resultCode;
6129
+ /** JSON token ranges behind result rows that form a tree; absent otherwise. */
6130
+ resultJson;
5939
6131
  /** Which result rows are diff additions or removals, for a `diff` result; absent otherwise. */
5940
6132
  resultDiff;
6133
+ /** Whether non-JSON result rows are shell output, dimmed apart from the command. */
6134
+ shellOutput = false;
5941
6135
  /** The facts a folded subagent card draws as one row; absent for every other tool. */
5942
6136
  subagent;
5943
6137
  expanded = false;
@@ -5998,7 +6192,8 @@ var ToolBlock = class {
5998
6192
  } : {
5999
6193
  kind: "call",
6000
6194
  rows: call,
6001
- ...this.call.code === void 0 ? {} : { code: [...title.map(() => void 0), ...this.call.code] }
6195
+ ...this.call.code === void 0 ? {} : { code: [...title.map(() => void 0), ...this.call.code] },
6196
+ ...this.call.json === void 0 ? {} : { json: [...title.map(() => void 0), ...this.call.json] }
6002
6197
  }];
6003
6198
  if (this.status !== "running") parts.push(this.resultLines.length === 0 ? {
6004
6199
  kind: "result",
@@ -6006,7 +6201,9 @@ var ToolBlock = class {
6006
6201
  } : {
6007
6202
  kind: "result",
6008
6203
  rows: this.resultLines,
6009
- ...this.resultCode === void 0 ? {} : { code: this.resultCode }
6204
+ ...this.resultCode === void 0 ? {} : { code: this.resultCode },
6205
+ ...this.resultJson === void 0 ? {} : { json: this.resultJson },
6206
+ ...this.shellOutput ? { shellOutput: true } : {}
6010
6207
  });
6011
6208
  this.sections = {
6012
6209
  revision: this.revision,
@@ -6091,15 +6288,18 @@ var ToolBlock = class {
6091
6288
  * @param isError - whether the tool reported failure.
6092
6289
  * @param code - the span behind each row, for a result the card colours as code.
6093
6290
  * @param diff - which rows are diff additions or removals, for a result the card boxes as a diff.
6291
+ * @param presentation - JSON token ranges and whether the rows are shell output.
6094
6292
  */
6095
- setResult(lines, isError, code, diff) {
6293
+ setResult(lines, isError, code, diff, presentation = {}) {
6096
6294
  if (diff !== void 0 && this.call.diff !== void 0) this.call = {
6097
6295
  title: this.call.title,
6098
6296
  lines: []
6099
6297
  };
6100
6298
  this.resultLines = lines;
6101
6299
  this.resultCode = code;
6300
+ this.resultJson = presentation.json;
6102
6301
  this.resultDiff = diff;
6302
+ this.shellOutput = presentation.shellOutput === true;
6103
6303
  this.status = isError ? "error" : "done";
6104
6304
  this.revision += 1;
6105
6305
  this.measured = false;
@@ -6112,7 +6312,9 @@ var ToolBlock = class {
6112
6312
  setBackground(lines) {
6113
6313
  this.resultLines = lines;
6114
6314
  this.resultCode = void 0;
6315
+ this.resultJson = void 0;
6115
6316
  this.resultDiff = void 0;
6317
+ this.shellOutput = false;
6116
6318
  this.status = "background";
6117
6319
  this.revision += 1;
6118
6320
  this.measured = false;
@@ -6278,9 +6480,16 @@ var ToolBlock = class {
6278
6480
  ...new Array(loading.length).fill(void 0),
6279
6481
  ...this.resultCode ?? new Array(this.resultLines.length).fill(void 0)
6280
6482
  ];
6483
+ const json = this.call.json === void 0 && this.resultJson === void 0 ? void 0 : [
6484
+ ...this.call.json ?? new Array(this.call.lines.length).fill(void 0),
6485
+ ...new Array(loading.length).fill(void 0),
6486
+ ...this.resultJson ?? new Array(this.resultLines.length).fill(void 0)
6487
+ ];
6488
+ const output = body.map((_, index) => this.shellOutput && index >= this.call.lines.length + loading.length);
6281
6489
  const kept = this.expanded ? body : foldRows(body, this.theme.toolPreviewLines, (hidden) => foldMarker(hidden, marked ? "marked" : "transcript"));
6282
6490
  const cut = !this.expanded && body.length > this.theme.toolPreviewLines;
6283
- const painted = paintCodeRows(kept, code, this.theme.codeHighlight);
6491
+ const presentationLength = cut ? kept.length - 1 : kept.length;
6492
+ const painted = paintJsonRows(paintCodeRows(kept, code, this.theme.codeHighlight), json?.slice(0, presentationLength), output.slice(0, presentationLength), palette);
6284
6493
  const shown = cut ? [...painted.slice(0, -1), paintKeys(palette, kept.at(-1), (text) => text)] : painted;
6285
6494
  const callCount = Math.min(this.call.lines.length + loading.length, shown.length);
6286
6495
  const marks = [
@@ -12518,11 +12727,14 @@ const MEASURING = createPalette(false);
12518
12727
  function bodySource(block, part) {
12519
12728
  if (block.blockKind === "tool" && part.kind === "call" && block.title !== "" && part.rows[0] === block.title) return {
12520
12729
  rows: part.rows.slice(1),
12521
- code: part.code?.slice(1)
12730
+ code: part.code?.slice(1),
12731
+ json: part.json?.slice(1)
12522
12732
  };
12523
12733
  return {
12524
12734
  rows: part.rows,
12525
- code: part.code
12735
+ code: part.code,
12736
+ json: part.json,
12737
+ shellOutput: part.shellOutput
12526
12738
  };
12527
12739
  }
12528
12740
  /**
@@ -12643,7 +12855,9 @@ function drawSection(block, part, width, look, header) {
12643
12855
  if (block.blockKind === "assistant" && part.kind === "reply") rows = [header, ...replyRows(part.rows, room, look).map((line) => `${indent}${line}`)];
12644
12856
  else {
12645
12857
  const source = bodySource(block, part);
12646
- rows = [header, ...paintCodeRows(source.rows, source.code, look.highlight).flatMap((row, index) => {
12858
+ const highlighted = paintCodeRows(source.rows, source.code, look.highlight);
12859
+ const output = source.shellOutput === true ? source.rows.map(() => true) : void 0;
12860
+ rows = [header, ...paintJsonRows(highlighted, source.json, output, look.palette).flatMap((row, index) => {
12647
12861
  const tone = rowTone(block, part, source.rows[index]);
12648
12862
  return wrapTextWithAnsi(row, room).map((line) => bodyRow(line, tone, indent, content, look));
12649
12863
  })];
@@ -12722,7 +12936,7 @@ function sectionRowCount(cursor, blocks, width) {
12722
12936
  const { block, part } = found;
12723
12937
  const cache = sectionRowsCache(block, cursor.part);
12724
12938
  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;
12939
+ 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
12940
  const lines = drawSection(block, part, width, {
12727
12941
  palette: MEASURING,
12728
12942
  held: false
@@ -12732,6 +12946,8 @@ function sectionRowCount(cursor, blocks, width) {
12732
12946
  kind: part.kind,
12733
12947
  rows: part.rows,
12734
12948
  code: part.code,
12949
+ json: part.json,
12950
+ shellOutput: part.shellOutput,
12735
12951
  count: lines.length
12736
12952
  };
12737
12953
  return lines.length;
@@ -12751,7 +12967,7 @@ function sectionRows(cursor, blocks, width, look) {
12751
12967
  const header = block.blockKind === "user" ? "" : headerRow(block, part, Math.max(1, width - visibleWidth(GUTTER)), look);
12752
12968
  const cache = sectionRowsCache(block, cursor.part);
12753
12969
  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)) {
12970
+ 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
12971
  drawnSections.delete(known);
12756
12972
  drawnSections.set(known, cache);
12757
12973
  return known.lines;
@@ -12765,6 +12981,8 @@ function sectionRows(cursor, blocks, width, look) {
12765
12981
  header,
12766
12982
  rows: part.rows,
12767
12983
  code: part.code,
12984
+ json: part.json,
12985
+ shellOutput: part.shellOutput,
12768
12986
  lines
12769
12987
  });
12770
12988
  return lines;
@@ -20439,7 +20657,7 @@ var TuiApp = class {
20439
20657
  const moved = isError ? movedJobId(result.content) : void 0;
20440
20658
  if (moved === void 0) {
20441
20659
  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);
20660
+ block.setResult(body.lines, isError, body.code, body.diff, body);
20443
20661
  } else block.setBackground([`◇ moved to the background as ${moved} · /jobs lists it`]);
20444
20662
  this.spinners.delete(block);
20445
20663
  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).