@hheei/pi-ext-ui 0.4.1 → 0.4.2

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.
@@ -167,6 +167,7 @@ export class NestedCallsView {
167
167
  : context.toolCallId;
168
168
  return {
169
169
  ...context,
170
+ lastComponent: undefined,
170
171
  args: "args" in call ? call.args : undefined,
171
172
  toolCallId,
172
173
  durationMs: call.durationMs,
package/dist/renderer.js CHANGED
@@ -53,7 +53,8 @@ function resolveToolCallSummary(params) {
53
53
  // Tier 1: Host Native RenderCall Delegation
54
54
  if (originalRenderCall !== undefined) {
55
55
  try {
56
- const upstreamLines = originalRenderCall(args, theme, context).render(120);
56
+ const upstreamContext = { ...context, lastComponent: undefined };
57
+ const upstreamLines = originalRenderCall(args, theme, upstreamContext).render(120);
57
58
  const firstNonEmpty = upstreamLines
58
59
  .map((line) => stripTerminalSequences(line).trim())
59
60
  .find((line) => line !== "");
@@ -143,9 +144,6 @@ export function isMcpTool(toolName) {
143
144
  toolName === "list_mcp_resource_templates");
144
145
  }
145
146
  function shouldInterceptTool(toolName, options) {
146
- if (options?.catchAll === true) {
147
- return options.match !== undefined ? options.match(toolName) : true;
148
- }
149
147
  if (options?.match?.(toolName)) {
150
148
  return true;
151
149
  }
@@ -153,7 +151,10 @@ function shouldInterceptTool(toolName, options) {
153
151
  if (toolList !== undefined) {
154
152
  return toolList.includes(toolName);
155
153
  }
156
- return SPECIALIZED_TOOL_SET.has(toolName) || isMcpTool(toolName);
154
+ if (options?.catchAll === false) {
155
+ return SPECIALIZED_TOOL_SET.has(toolName) || isMcpTool(toolName);
156
+ }
157
+ return true;
157
158
  }
158
159
  function renderGenericResult(params) {
159
160
  const { toolName, theme, context, result, renderOptions, defaultLevel, originalRenderCall, originalRenderResult, resolvePresentation, resolveNativeRenderer, options, } = params;
@@ -305,9 +306,21 @@ function renderGenericResult(params) {
305
306
  ...renderOptions,
306
307
  expanded: effectiveExpanded,
307
308
  };
309
+ let lastUpstreamComponent;
308
310
  const lazyUpstreamComponent = {
309
311
  render(w) {
310
- return originalRenderResult(result, effectiveOptions, theme, context).render(w);
312
+ try {
313
+ const upstreamContext = {
314
+ ...context,
315
+ lastComponent: lastUpstreamComponent,
316
+ };
317
+ const comp = originalRenderResult(result, effectiveOptions, theme, upstreamContext);
318
+ lastUpstreamComponent = comp;
319
+ return comp.render(w);
320
+ }
321
+ catch {
322
+ return rawOutput !== "" ? rawOutput.split("\n") : [];
323
+ }
311
324
  },
312
325
  invalidate() { },
313
326
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hheei/pi-ext-ui",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Collapsible tool rendering frame and tool renderer pilot for Pi.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",