refactor(tools): return complete analysis results inline

This commit is contained in:
morluto
2026-09-29 14:53:50 +08:00
parent c34efca4cd
commit 2a6eb41147
156 changed files with 2529 additions and 1891 deletions
+20 -22
View File
@@ -14,7 +14,7 @@ const ACTION_TIMEOUT_MS = 5_000;
const hookEventSchema = z.strictObject({
sequence: z.number().int().min(1),
correlation_id: z.string().max(256).nullable(),
correlation_id: z.string().nullable(),
kind: z.enum([
"main-handler-invocation",
"main-event-invocation",
@@ -40,10 +40,9 @@ const hookEventSchema = z.strictObject({
"updater",
"error",
]),
event: z.string().max(128).nullable(),
event: z.string().nullable(),
phase: z.enum(["attempted", "completed", "blocked", "failed", "observed"]),
channel: z.string().max(1_024).nullable(),
channel_truncated: z.boolean().default(false),
channel: z.string().nullable(),
direction: z
.enum([
"renderer-to-main",
@@ -52,17 +51,16 @@ const hookEventSchema = z.strictObject({
"utility-to-main",
])
.nullable(),
sender: z.string().max(256).nullable(),
receiver: z.string().max(256).nullable(),
frame: z.string().max(256).nullable(),
target: z.string().max(256).nullable(),
argument_shapes: z.array(z.string().max(64)).max(32),
argument_shapes_truncated: z.boolean().default(false),
result_shape: z.string().max(64).nullable(),
process_type: z.string().max(128).nullable(),
source: z.string().max(64),
sender: z.string().nullable(),
receiver: z.string().nullable(),
frame: z.string().nullable(),
target: z.string().nullable(),
argument_shapes: z.array(z.string()),
result_shape: z.string().nullable(),
process_type: z.string().nullable(),
source: z.string(),
capture_method: z.enum(["api-wrapper", "event-emitter", "process-hook"]),
artifact_path: z.string().max(16_384).nullable(),
artifact_path: z.string().nullable(),
artifact_sha256: z
.string()
.regex(/^[a-f0-9]{64}$/u)
@@ -80,14 +78,14 @@ const hookSnapshotSchema = z.strictObject({
const metricSchema = z.strictObject({
pid: z.number().int().min(1),
type: z.string().min(1).max(128),
name: z.string().max(256).nullable(),
service_name: z.string().max(256).nullable(),
type: z.string().min(1),
name: z.string().nullable(),
service_name: z.string().nullable(),
});
const windowMetadataSchema = z.strictObject({
window_id: z.string().max(256),
web_contents_id: z.string().max(256),
window_id: z.string(),
web_contents_id: z.string(),
visible: z.boolean().nullable(),
destroyed: z.boolean(),
});
@@ -341,8 +339,8 @@ export const readApplicationState = async (
pages.map(
async (page: Page, index): Promise<ElectronPageSnapshot> => ({
index,
url: page.url().slice(0, 65_536),
title: (await page.title()).slice(0, 16_384),
url: page.url(),
title: await page.title(),
}),
),
);
@@ -481,5 +479,5 @@ const safeActionErrorMessage = (
.sort((left, right) => right.length - left.length);
for (const value of inputValues)
message = message.split(value).join("<redacted-input>");
return redactSensitiveText(message).slice(0, 1_024);
return redactSensitiveText(message);
};