@threadbase-sh/scanner 0.24.5 → 0.24.6

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.cjs CHANGED
@@ -1734,6 +1734,14 @@ var import_readline3 = require("readline");
1734
1734
  var SESSION_START = "session.start";
1735
1735
  var USER_MESSAGE = "user.message";
1736
1736
  var ASSISTANT_MESSAGE = "assistant.message";
1737
+ var TOOL_EXECUTION_COMPLETE = "tool.execution_complete";
1738
+ var PERMISSION_COMPLETED = "permission.completed";
1739
+ var PERMISSION_DECISIONS = {
1740
+ approved: { label: "Approved", isError: false },
1741
+ "approved-for-location": { label: "Approved (and remembered)", isError: false },
1742
+ "denied-interactively-by-user": { label: "Denied", isError: true },
1743
+ cancelled: { label: "Cancelled", isError: true }
1744
+ };
1737
1745
  var CopilotProvider = class {
1738
1746
  name = COPILOT_PROVIDER;
1739
1747
  async discover(roots) {
@@ -1845,8 +1853,37 @@ function copilotEntryToMessage(entry) {
1845
1853
  ...Object.keys(metadata).length > 0 ? { metadata } : {}
1846
1854
  };
1847
1855
  }
1856
+ if (entry.type === TOOL_EXECUTION_COMPLETE) {
1857
+ const toolUseId = asString2(data.toolCallId);
1858
+ if (!toolUseId) return null;
1859
+ const result = asRecord(data.result);
1860
+ const output = asString2(result?.content) || asString2(result?.detailedContent);
1861
+ return toolResultMessage(entry, toolUseId, { output }, data.success === false);
1862
+ }
1863
+ if (entry.type === PERMISSION_COMPLETED) {
1864
+ const toolUseId = asString2(data.toolCallId);
1865
+ const result = asRecord(data.result);
1866
+ const kind = asString2(result?.kind);
1867
+ const decision = Object.hasOwn(PERMISSION_DECISIONS, kind) ? PERMISSION_DECISIONS[kind] : null;
1868
+ if (!toolUseId || !decision) return null;
1869
+ const feedback = kind === "denied-interactively-by-user" ? asString2(result?.feedback).trim() : "";
1870
+ const output = feedback ? `${decision.label}: ${feedback}` : decision.label;
1871
+ return toolResultMessage(entry, toolUseId, { output, permission: kind }, decision.isError);
1872
+ }
1848
1873
  return null;
1849
1874
  }
1875
+ function toolResultMessage(entry, toolUseId, content, isError) {
1876
+ return {
1877
+ role: "user",
1878
+ text: "",
1879
+ timestamp: asString2(entry.timestamp),
1880
+ uuid: asString2(entry.id) || void 0,
1881
+ isToolResult: true,
1882
+ metadata: {
1883
+ toolResults: [{ toolUseId, type: "generic", content, ...isError ? { isError } : {} }]
1884
+ }
1885
+ };
1886
+ }
1850
1887
  function parseCopilotJsonlLine(line) {
1851
1888
  const trimmed = line.trim();
1852
1889
  if (!trimmed) return null;