@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/cli.js CHANGED
@@ -5,7 +5,7 @@ import { Command } from "commander";
5
5
  import pino2 from "pino";
6
6
 
7
7
  // package.json
8
- var version = "0.24.5";
8
+ var version = "0.24.6";
9
9
 
10
10
  // src/logger.ts
11
11
  import pino from "pino";
@@ -1957,6 +1957,14 @@ import { createInterface as createInterface3 } from "readline";
1957
1957
  var SESSION_START = "session.start";
1958
1958
  var USER_MESSAGE = "user.message";
1959
1959
  var ASSISTANT_MESSAGE = "assistant.message";
1960
+ var TOOL_EXECUTION_COMPLETE = "tool.execution_complete";
1961
+ var PERMISSION_COMPLETED = "permission.completed";
1962
+ var PERMISSION_DECISIONS = {
1963
+ approved: { label: "Approved", isError: false },
1964
+ "approved-for-location": { label: "Approved (and remembered)", isError: false },
1965
+ "denied-interactively-by-user": { label: "Denied", isError: true },
1966
+ cancelled: { label: "Cancelled", isError: true }
1967
+ };
1960
1968
  var CopilotProvider = class {
1961
1969
  name = COPILOT_PROVIDER;
1962
1970
  async discover(roots) {
@@ -2068,8 +2076,37 @@ function copilotEntryToMessage(entry) {
2068
2076
  ...Object.keys(metadata).length > 0 ? { metadata } : {}
2069
2077
  };
2070
2078
  }
2079
+ if (entry.type === TOOL_EXECUTION_COMPLETE) {
2080
+ const toolUseId = asString2(data.toolCallId);
2081
+ if (!toolUseId) return null;
2082
+ const result = asRecord(data.result);
2083
+ const output = asString2(result?.content) || asString2(result?.detailedContent);
2084
+ return toolResultMessage(entry, toolUseId, { output }, data.success === false);
2085
+ }
2086
+ if (entry.type === PERMISSION_COMPLETED) {
2087
+ const toolUseId = asString2(data.toolCallId);
2088
+ const result = asRecord(data.result);
2089
+ const kind = asString2(result?.kind);
2090
+ const decision = Object.hasOwn(PERMISSION_DECISIONS, kind) ? PERMISSION_DECISIONS[kind] : null;
2091
+ if (!toolUseId || !decision) return null;
2092
+ const feedback = kind === "denied-interactively-by-user" ? asString2(result?.feedback).trim() : "";
2093
+ const output = feedback ? `${decision.label}: ${feedback}` : decision.label;
2094
+ return toolResultMessage(entry, toolUseId, { output, permission: kind }, decision.isError);
2095
+ }
2071
2096
  return null;
2072
2097
  }
2098
+ function toolResultMessage(entry, toolUseId, content, isError) {
2099
+ return {
2100
+ role: "user",
2101
+ text: "",
2102
+ timestamp: asString2(entry.timestamp),
2103
+ uuid: asString2(entry.id) || void 0,
2104
+ isToolResult: true,
2105
+ metadata: {
2106
+ toolResults: [{ toolUseId, type: "generic", content, ...isError ? { isError } : {} }]
2107
+ }
2108
+ };
2109
+ }
2073
2110
  function parseCopilotJsonlLine(line) {
2074
2111
  const trimmed = line.trim();
2075
2112
  if (!trimmed) return null;