@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 +38 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +37 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -1
- package/dist/providers/copilot.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1644,6 +1644,14 @@ import { createInterface as createInterface3 } from "readline";
|
|
|
1644
1644
|
var SESSION_START = "session.start";
|
|
1645
1645
|
var USER_MESSAGE = "user.message";
|
|
1646
1646
|
var ASSISTANT_MESSAGE = "assistant.message";
|
|
1647
|
+
var TOOL_EXECUTION_COMPLETE = "tool.execution_complete";
|
|
1648
|
+
var PERMISSION_COMPLETED = "permission.completed";
|
|
1649
|
+
var PERMISSION_DECISIONS = {
|
|
1650
|
+
approved: { label: "Approved", isError: false },
|
|
1651
|
+
"approved-for-location": { label: "Approved (and remembered)", isError: false },
|
|
1652
|
+
"denied-interactively-by-user": { label: "Denied", isError: true },
|
|
1653
|
+
cancelled: { label: "Cancelled", isError: true }
|
|
1654
|
+
};
|
|
1647
1655
|
var CopilotProvider = class {
|
|
1648
1656
|
name = COPILOT_PROVIDER;
|
|
1649
1657
|
async discover(roots) {
|
|
@@ -1755,8 +1763,37 @@ function copilotEntryToMessage(entry) {
|
|
|
1755
1763
|
...Object.keys(metadata).length > 0 ? { metadata } : {}
|
|
1756
1764
|
};
|
|
1757
1765
|
}
|
|
1766
|
+
if (entry.type === TOOL_EXECUTION_COMPLETE) {
|
|
1767
|
+
const toolUseId = asString2(data.toolCallId);
|
|
1768
|
+
if (!toolUseId) return null;
|
|
1769
|
+
const result = asRecord(data.result);
|
|
1770
|
+
const output = asString2(result?.content) || asString2(result?.detailedContent);
|
|
1771
|
+
return toolResultMessage(entry, toolUseId, { output }, data.success === false);
|
|
1772
|
+
}
|
|
1773
|
+
if (entry.type === PERMISSION_COMPLETED) {
|
|
1774
|
+
const toolUseId = asString2(data.toolCallId);
|
|
1775
|
+
const result = asRecord(data.result);
|
|
1776
|
+
const kind = asString2(result?.kind);
|
|
1777
|
+
const decision = Object.hasOwn(PERMISSION_DECISIONS, kind) ? PERMISSION_DECISIONS[kind] : null;
|
|
1778
|
+
if (!toolUseId || !decision) return null;
|
|
1779
|
+
const feedback = kind === "denied-interactively-by-user" ? asString2(result?.feedback).trim() : "";
|
|
1780
|
+
const output = feedback ? `${decision.label}: ${feedback}` : decision.label;
|
|
1781
|
+
return toolResultMessage(entry, toolUseId, { output, permission: kind }, decision.isError);
|
|
1782
|
+
}
|
|
1758
1783
|
return null;
|
|
1759
1784
|
}
|
|
1785
|
+
function toolResultMessage(entry, toolUseId, content, isError) {
|
|
1786
|
+
return {
|
|
1787
|
+
role: "user",
|
|
1788
|
+
text: "",
|
|
1789
|
+
timestamp: asString2(entry.timestamp),
|
|
1790
|
+
uuid: asString2(entry.id) || void 0,
|
|
1791
|
+
isToolResult: true,
|
|
1792
|
+
metadata: {
|
|
1793
|
+
toolResults: [{ toolUseId, type: "generic", content, ...isError ? { isError } : {} }]
|
|
1794
|
+
}
|
|
1795
|
+
};
|
|
1796
|
+
}
|
|
1760
1797
|
function parseCopilotJsonlLine(line) {
|
|
1761
1798
|
const trimmed = line.trim();
|
|
1762
1799
|
if (!trimmed) return null;
|