@threadbase-sh/scanner 0.24.4 → 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 +71 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +70 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +70 -3
- package/dist/index.js.map +1 -1
- package/dist/parser.d.ts +1 -0
- package/dist/parser.d.ts.map +1 -1
- package/dist/persistent/conversation-reducer.d.ts +1 -1
- package/dist/persistent/conversation-reducer.d.ts.map +1 -1
- package/dist/persistent/metadata-reducer.d.ts +1 -1
- package/dist/persistent/metadata-reducer.d.ts.map +1 -1
- package/dist/persistent/migrations.d.ts.map +1 -1
- package/dist/persistent/schema.d.ts +1 -1
- package/dist/persistent/schema.d.ts.map +1 -1
- package/dist/providers/copilot.d.ts.map +1 -1
- package/package.json +1 -1
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.
|
|
8
|
+
var version = "0.24.6";
|
|
9
9
|
|
|
10
10
|
// src/logger.ts
|
|
11
11
|
import pino from "pino";
|
|
@@ -823,7 +823,8 @@ function initialConvState() {
|
|
|
823
823
|
teamInfo: {}
|
|
824
824
|
};
|
|
825
825
|
}
|
|
826
|
-
function reduceConvLine(state,
|
|
826
|
+
function reduceConvLine(state, rawEntry) {
|
|
827
|
+
const entry = asQueuedPromptUserEntry(rawEntry);
|
|
827
828
|
if (entry.cwd && !state.cwd) state.cwd = entry.cwd;
|
|
828
829
|
if (entry.sessionId && !state.sessionId) state.sessionId = entry.sessionId;
|
|
829
830
|
state.nameSlots = applyClaudeNameEntry(state.nameSlots, entry);
|
|
@@ -979,7 +980,8 @@ function initialReducerState() {
|
|
|
979
980
|
turnDurations: []
|
|
980
981
|
};
|
|
981
982
|
}
|
|
982
|
-
function reduceLine(state,
|
|
983
|
+
function reduceLine(state, rawEntry, tier) {
|
|
984
|
+
const entry = asQueuedPromptUserEntry(rawEntry);
|
|
983
985
|
if (entry.cwd && !state.cwd) state.cwd = entry.cwd;
|
|
984
986
|
if (entry.sessionId && !state.sessionId) state.sessionId = entry.sessionId;
|
|
985
987
|
state.nameSlots = applyClaudeNameEntry(state.nameSlots, entry);
|
|
@@ -1088,6 +1090,18 @@ function getShortProjectName(fullPath) {
|
|
|
1088
1090
|
}
|
|
1089
1091
|
|
|
1090
1092
|
// src/parser.ts
|
|
1093
|
+
function asQueuedPromptUserEntry(entry) {
|
|
1094
|
+
if (entry.type !== "attachment") return entry;
|
|
1095
|
+
const att = entry.attachment;
|
|
1096
|
+
if (att?.type !== "queued_command" || att.commandMode !== "prompt") return entry;
|
|
1097
|
+
if (att.origin?.kind !== "human") return entry;
|
|
1098
|
+
return {
|
|
1099
|
+
...entry,
|
|
1100
|
+
type: "user",
|
|
1101
|
+
attachment: void 0,
|
|
1102
|
+
message: { role: "user", content: att.prompt }
|
|
1103
|
+
};
|
|
1104
|
+
}
|
|
1091
1105
|
function turnDurationOf(entry) {
|
|
1092
1106
|
if (entry.type !== "system" || entry.subtype !== "turn_duration" || typeof entry.durationMs !== "number") {
|
|
1093
1107
|
return null;
|
|
@@ -1943,6 +1957,14 @@ import { createInterface as createInterface3 } from "readline";
|
|
|
1943
1957
|
var SESSION_START = "session.start";
|
|
1944
1958
|
var USER_MESSAGE = "user.message";
|
|
1945
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
|
+
};
|
|
1946
1968
|
var CopilotProvider = class {
|
|
1947
1969
|
name = COPILOT_PROVIDER;
|
|
1948
1970
|
async discover(roots) {
|
|
@@ -2054,8 +2076,37 @@ function copilotEntryToMessage(entry) {
|
|
|
2054
2076
|
...Object.keys(metadata).length > 0 ? { metadata } : {}
|
|
2055
2077
|
};
|
|
2056
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
|
+
}
|
|
2057
2096
|
return null;
|
|
2058
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
|
+
}
|
|
2059
2110
|
function parseCopilotJsonlLine(line) {
|
|
2060
2111
|
const trimmed = line.trim();
|
|
2061
2112
|
if (!trimmed) return null;
|
|
@@ -2928,7 +2979,7 @@ import { mkdirSync } from "fs";
|
|
|
2928
2979
|
import { dirname as dirname6 } from "path";
|
|
2929
2980
|
|
|
2930
2981
|
// src/persistent/schema.ts
|
|
2931
|
-
var SCHEMA_VERSION =
|
|
2982
|
+
var SCHEMA_VERSION = 12;
|
|
2932
2983
|
var SCHEMA_SQL = `
|
|
2933
2984
|
CREATE TABLE IF NOT EXISTS conversation_files (
|
|
2934
2985
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
@@ -3260,6 +3311,22 @@ function runMigrations(db) {
|
|
|
3260
3311
|
}
|
|
3261
3312
|
}
|
|
3262
3313
|
}
|
|
3314
|
+
if (current >= 1 && current < 12 && tableExists(db, "conversation_files")) {
|
|
3315
|
+
if (tableExists(db, "message_checkpoints")) db.exec("DELETE FROM message_checkpoints");
|
|
3316
|
+
const assignments = [];
|
|
3317
|
+
if (hasColumn(db, "conversation_files", "last_indexed_offset")) {
|
|
3318
|
+
assignments.push("last_indexed_offset = 0");
|
|
3319
|
+
}
|
|
3320
|
+
if (hasColumn(db, "conversation_files", "last_indexed_line")) {
|
|
3321
|
+
assignments.push("last_indexed_line = 0");
|
|
3322
|
+
}
|
|
3323
|
+
if (hasColumn(db, "conversation_files", "reducer_state")) {
|
|
3324
|
+
assignments.push("reducer_state = NULL");
|
|
3325
|
+
}
|
|
3326
|
+
if (assignments.length > 0) {
|
|
3327
|
+
db.exec(`UPDATE conversation_files SET ${assignments.join(", ")}`);
|
|
3328
|
+
}
|
|
3329
|
+
}
|
|
3263
3330
|
db.exec(SCHEMA_SQL);
|
|
3264
3331
|
db.pragma(`user_version = ${SCHEMA_VERSION}`);
|
|
3265
3332
|
}
|