@impulselab/hepha 0.2.665 → 0.2.667

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/dist/index.js CHANGED
@@ -1890,6 +1890,10 @@ var HOST_TOOL_NAMES = {
1890
1890
  REPORT_HARNESS_ISSUE: "report_harness_issue",
1891
1891
  REPORT_DEV_SERVER: "report_dev_server",
1892
1892
  RUN_VALIDATION: "run_validation",
1893
+ COLLECT_REVIEW_SNAPSHOT: "collect_review_snapshot",
1894
+ READ_REVIEW_EVIDENCE_SOURCE: "read_review_evidence_source",
1895
+ FIND_REVIEW_EXAMPLES: "find_review_examples",
1896
+ SUBMIT_REVIEW_EVIDENCE: "submit_review_evidence",
1893
1897
  REVIEW_SCOPE: "review_scope",
1894
1898
  FILTER_REVIEW_FINDINGS: "filter_review_findings",
1895
1899
  SUBMIT_REVIEW_SUMMARY: "submit_review_summary",
@@ -2675,6 +2679,49 @@ var browserToolActivityDescribers = [
2675
2679
  ]
2676
2680
  ];
2677
2681
 
2682
+ // ../../packages/agents/src/tool-activity/canonical/tool-execute/mcp-prefix-constants.ts
2683
+ var MCP_ID_PREFIX = "mcp/";
2684
+ var MCP_ENVELOPE_PAIR = /,?"([^"\\]*)":("(?:[^"\\]|\\["\\/bfnrt]|\\u[0-9a-fA-F]{4})*"|true|false|null|-?\d+(?:\.\d+)?)/y;
2685
+ var MCP_ENVELOPE_KEYS = ["server", "reason"];
2686
+
2687
+ // ../../packages/agents/src/tool-activity/canonical/tool-execute/parse-tool-output.ts
2688
+ function parseToolOutput(output) {
2689
+ if (toolInput.isRecord(output)) return output;
2690
+ if (typeof output !== "string") return null;
2691
+ const envelope = {};
2692
+ if (!output.startsWith("{")) return envelope;
2693
+ MCP_ENVELOPE_PAIR.lastIndex = 1;
2694
+ let pair = MCP_ENVELOPE_PAIR.exec(output);
2695
+ while (pair) {
2696
+ const [, key, jsonValue] = pair;
2697
+ const isWantedKey = key !== void 0 && MCP_ENVELOPE_KEYS.includes(key);
2698
+ if (isWantedKey && jsonValue !== void 0 && !(key in envelope)) {
2699
+ envelope[key] = JSON.parse(jsonValue);
2700
+ }
2701
+ pair = MCP_ENVELOPE_PAIR.exec(output);
2702
+ }
2703
+ return envelope;
2704
+ }
2705
+
2706
+ // ../../packages/agents/src/tool-activity/canonical/tool-execute/describe-tool-execute.ts
2707
+ function describeToolExecute(record, output) {
2708
+ const target = toolInput.str(record.tool);
2709
+ if (!target) return labelOnly("Ran an integration tool");
2710
+ if (!target.startsWith(MCP_ID_PREFIX)) {
2711
+ return labelOnly(`Ran ${toolInput.truncate(target, 60)}`);
2712
+ }
2713
+ const rest = target.slice(MCP_ID_PREFIX.length);
2714
+ const tool = rest.slice(rest.indexOf("/") + 1);
2715
+ const result = parseToolOutput(output);
2716
+ const server = toolInput.str(result?.server);
2717
+ const name = toolInput.truncate(tool, 40);
2718
+ const label = server ? `${name} \xB7 ${toolInput.truncate(server, 20)}` : name;
2719
+ if (result?.reason === "mcp_disconnected") {
2720
+ return labelOnly(`${label} failed: MCP disconnected, sign in again`);
2721
+ }
2722
+ return labelOnly(`Ran ${label}`);
2723
+ }
2724
+
2678
2725
  // ../../packages/agents/src/tool-activity/canonical/integration-tool-activity-describers.ts
2679
2726
  var integrationToolActivityDescribers = [
2680
2727
  [
@@ -2703,12 +2750,7 @@ var integrationToolActivityDescribers = [
2703
2750
  ],
2704
2751
  [
2705
2752
  "tool_execute",
2706
- (record) => {
2707
- const target = toolInput.str(record.tool);
2708
- return labelOnly(
2709
- target ? `Ran ${toolInput.truncate(target, 60)}` : "Ran an integration tool"
2710
- );
2711
- }
2753
+ (record, state) => describeToolExecute(record, state.output)
2712
2754
  ]
2713
2755
  ];
2714
2756
 
@@ -3552,6 +3594,7 @@ function toolActivityStateFor(toolName, options) {
3552
3594
  const isRunning = options?.status === "running";
3553
3595
  return {
3554
3596
  isRunning,
3597
+ output: options?.output,
3555
3598
  hasFailed: options?.status === "failed" || !isRunning && (softFailedCapture(toolName, options?.output) || softFailedBrowser(toolName, options?.output) || softFailedGit(toolName, options?.output))
3556
3599
  };
3557
3600
  }