kifaru 1.0.165 → 1.0.168
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.
|
@@ -66,8 +66,11 @@ export default function (pi: ExtensionAPI) {
|
|
|
66
66
|
pi.on("session_start", async (_event, ctx: ExtensionContext) => {
|
|
67
67
|
cells = []
|
|
68
68
|
for (const entry of ctx.sessionManager.getEntries()) {
|
|
69
|
-
if (entry.type === "custom" && entry.customType === "kifaru-coverage"
|
|
70
|
-
|
|
69
|
+
if (entry.type === "custom" && (entry as any).customType === "kifaru-coverage") {
|
|
70
|
+
const data = (entry as any).data as { cells?: unknown } | undefined
|
|
71
|
+
if (Array.isArray(data?.cells)) {
|
|
72
|
+
cells = data.cells as CoverageCell[]
|
|
73
|
+
}
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
76
|
})
|
|
@@ -132,7 +135,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
132
135
|
description: "Show the coverage ledger (list|open)",
|
|
133
136
|
handler: async (args, ctx) => {
|
|
134
137
|
const onlyOpen = args?.trim()?.toLowerCase() === "open" || args?.trim()?.toLowerCase() === ""
|
|
135
|
-
pi.sendMessage({ content: render(onlyOpen), display: true, details: {} })
|
|
138
|
+
pi.sendMessage({ customType: "kifaru-coverage", content: render(onlyOpen), display: true, details: {} })
|
|
136
139
|
},
|
|
137
140
|
})
|
|
138
141
|
}
|
|
@@ -86,7 +86,12 @@ export default function (pi: ExtensionAPI) {
|
|
|
86
86
|
}
|
|
87
87
|
const local = cveVersionCheck(cveId, "")
|
|
88
88
|
const remote = await fetchRemoteCve(cveId)
|
|
89
|
-
pi.sendMessage({
|
|
89
|
+
pi.sendMessage({
|
|
90
|
+
customType: "kifaru-cve",
|
|
91
|
+
content: [local.reason, remote ?? ""].filter(Boolean).join("\n"),
|
|
92
|
+
display: true,
|
|
93
|
+
details: {},
|
|
94
|
+
})
|
|
90
95
|
},
|
|
91
96
|
})
|
|
92
97
|
}
|
|
@@ -239,7 +239,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
239
239
|
async execute(
|
|
240
240
|
_toolCallId,
|
|
241
241
|
params: { action: "load" | "update" | "list"; target?: string; observations?: string[]; findings?: string[] },
|
|
242
|
-
) {
|
|
242
|
+
): Promise<{ content: Array<{ type: "text"; text: string }>; details: Record<string, unknown> }> {
|
|
243
243
|
if (params.action === "list") {
|
|
244
244
|
const targets = await listTargets()
|
|
245
245
|
const lines = targets.length
|
|
@@ -300,6 +300,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
300
300
|
}
|
|
301
301
|
const dossier = await loadDossier(target)
|
|
302
302
|
pi.sendMessage({
|
|
303
|
+
customType: "kifaru-dossier",
|
|
303
304
|
content: `Bound target: ${target}\nObservations: ${dossier.observations.length}\nFindings: ${dossier.findings.length}\nUpdated: ${new Date(dossier.lastUpdated).toISOString()}`,
|
|
304
305
|
display: true,
|
|
305
306
|
details: {},
|
|
@@ -329,7 +330,12 @@ export default function (pi: ExtensionAPI) {
|
|
|
329
330
|
const body = targets.length
|
|
330
331
|
? targets.map((t) => `- ${t.slug} (${t.observations} obs, ${t.findings} findings)`).join("\n")
|
|
331
332
|
: "No dossiers yet."
|
|
332
|
-
pi.sendMessage({
|
|
333
|
+
pi.sendMessage({
|
|
334
|
+
customType: "kifaru-dossier",
|
|
335
|
+
content: `Target dossiers:\n${body}`,
|
|
336
|
+
display: true,
|
|
337
|
+
details: {},
|
|
338
|
+
})
|
|
333
339
|
return
|
|
334
340
|
}
|
|
335
341
|
const dossier = await loadDossier(arg)
|
|
@@ -341,7 +347,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
341
347
|
...dossier.findings.map((f) => ` - ${f}`),
|
|
342
348
|
`Last updated: ${new Date(dossier.lastUpdated).toISOString()}`,
|
|
343
349
|
].join("\n")
|
|
344
|
-
pi.sendMessage({ content: body, display: true, details: {} })
|
|
350
|
+
pi.sendMessage({ customType: "kifaru-dossier", content: body, display: true, details: {} })
|
|
345
351
|
},
|
|
346
352
|
})
|
|
347
353
|
}
|
|
@@ -230,7 +230,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
230
230
|
description: "Lint text (report draft) against the Kifaru claim discipline",
|
|
231
231
|
handler: async (args, ctx) => {
|
|
232
232
|
const target = args && args.trim().length > 0 ? args.trim() : ctx.ui.getEditorText()
|
|
233
|
-
pi.sendMessage({ content: runLint(target), display: true, details: {} })
|
|
233
|
+
pi.sendMessage({ customType: "kifaru-lint", content: runLint(target), display: true, details: {} })
|
|
234
234
|
ctx.ui.notify("lint result posted", "info")
|
|
235
235
|
},
|
|
236
236
|
})
|
|
@@ -64,7 +64,8 @@ export function sessionFile(): string {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
export function gatewayOrigin(): string {
|
|
67
|
-
|
|
67
|
+
if (process.env.KIFARU_AUTH_BASE_URL) return process.env.KIFARU_AUTH_BASE_URL.replace(/\/+$/, "")
|
|
68
|
+
return "http://127.0.0.1:38413"
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
export async function readSession(): Promise<StoredKifaruSession | null> {
|
|
@@ -331,14 +332,14 @@ export default function (pi: ExtensionAPI) {
|
|
|
331
332
|
return
|
|
332
333
|
}
|
|
333
334
|
const result = await runSessionAction({ action: "login", token })
|
|
334
|
-
pi.sendMessage({ content: result.text, display: true, details: {} })
|
|
335
|
+
pi.sendMessage({ customType: "kifaru-session", content: result.text, display: true, details: {} })
|
|
335
336
|
return
|
|
336
337
|
}
|
|
337
338
|
case "env":
|
|
338
339
|
case "status":
|
|
339
340
|
case "logout": {
|
|
340
341
|
const result = await runSessionAction({ action: verb.toLowerCase() as "env" | "status" | "logout" })
|
|
341
|
-
pi.sendMessage({ content: result.text, display: true, details: {} })
|
|
342
|
+
pi.sendMessage({ customType: "kifaru-session", content: result.text, display: true, details: {} })
|
|
342
343
|
return
|
|
343
344
|
}
|
|
344
345
|
default:
|