@effect-agent/pr-review 0.1.0-beta.27 → 0.1.0-beta.29
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/README.md +9 -204
- package/dist/index.d.mts +87 -914
- package/dist/index.mjs +163 -71
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -18
- package/src/index.ts +1 -25
- package/src/review.ts +212 -0
- package/dist/action.d.mts +0 -215
- package/dist/action.mjs +0 -505
- package/dist/action.mjs.map +0 -1
- package/dist/cli.d.mts +0 -1
- package/dist/cli.mjs +0 -106
- package/dist/cli.mjs.map +0 -1
- package/dist/fan-out-C3yG1cx3.d.mts +0 -1526
- package/dist/github-CCuLgyqb.mjs +0 -3437
- package/dist/github-CCuLgyqb.mjs.map +0 -1
- package/dist/logging-Q4j0oub-.mjs +0 -75
- package/dist/logging-Q4j0oub-.mjs.map +0 -1
- package/dist/providers-Br9FRn7j.mjs +0 -1349
- package/dist/providers-Br9FRn7j.mjs.map +0 -1
- package/dist/testing.d.mts +0 -86
- package/dist/testing.mjs +0 -184
- package/dist/testing.mjs.map +0 -1
- package/src/action.ts +0 -906
- package/src/cli.ts +0 -235
- package/src/internal/action-entry.ts +0 -45
- package/src/internal/adjudication.ts +0 -415
- package/src/internal/anchors.ts +0 -20
- package/src/internal/coverage.ts +0 -357
- package/src/internal/diff.ts +0 -193
- package/src/internal/effort.ts +0 -86
- package/src/internal/factory.ts +0 -357
- package/src/internal/fan-out-scripted.ts +0 -77
- package/src/internal/fan-out.ts +0 -1148
- package/src/internal/fingerprint.ts +0 -89
- package/src/internal/fixtures.ts +0 -148
- package/src/internal/github-env.ts +0 -164
- package/src/internal/github.ts +0 -1218
- package/src/internal/ignore.ts +0 -88
- package/src/internal/logging.ts +0 -124
- package/src/internal/profiles.ts +0 -91
- package/src/internal/progress.ts +0 -433
- package/src/internal/providers.ts +0 -133
- package/src/internal/render.ts +0 -819
- package/src/internal/retirement.ts +0 -337
- package/src/internal/review-agent.ts +0 -543
- package/src/internal/review-state.ts +0 -782
- package/src/internal/review-units.ts +0 -493
- package/src/internal/run.ts +0 -611
- package/src/internal/scripted.ts +0 -108
- package/src/internal/source.ts +0 -110
- package/src/testing.ts +0 -8
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { Cause, Config, Effect, Layer, Logger, Predicate, References } from "effect";
|
|
2
|
-
//#region src/internal/logging.ts
|
|
3
|
-
const levelTag = {
|
|
4
|
-
Trace: "trace",
|
|
5
|
-
Debug: "debug",
|
|
6
|
-
Warn: "WARN",
|
|
7
|
-
Error: "ERROR",
|
|
8
|
-
Fatal: "FATAL"
|
|
9
|
-
};
|
|
10
|
-
const asText = (value) => {
|
|
11
|
-
if (Predicate.isString(value)) return value;
|
|
12
|
-
try {
|
|
13
|
-
return JSON.stringify(value) ?? String(value);
|
|
14
|
-
} catch {
|
|
15
|
-
return String(value);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
const annotationText = (annotations) => Object.entries(annotations).filter(([key]) => !key.includes(".")).map(([key, value]) => `${key}=${asText(value).slice(0, 120)}`).join(" ");
|
|
19
|
-
/** Known engine telemetry messages, rendered as short progress lines. */
|
|
20
|
-
const telemetryLine = (message, annotations) => {
|
|
21
|
-
const toolName = asText(annotations["toolName"] ?? "tool");
|
|
22
|
-
switch (message) {
|
|
23
|
-
case "agent tool execution completed": return `✓ tool ${toolName}`;
|
|
24
|
-
case "agent tool execution failed": return `✗ tool ${toolName} failed`;
|
|
25
|
-
case "agent tool handler started":
|
|
26
|
-
case "agent programmatic tool handler started": return `→ tool ${toolName}`;
|
|
27
|
-
case "agent model call started": return `→ model call`;
|
|
28
|
-
case "agent run started": return `→ agent ${asText(annotations["agentId"] ?? "run")} started`;
|
|
29
|
-
default: return;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
/** Render one log record as a single compact console line. */
|
|
33
|
-
const formatCompactLogLine = (record) => {
|
|
34
|
-
const time = record.date.toISOString().slice(11, 19);
|
|
35
|
-
const messages = Array.isArray(record.message) ? record.message : [record.message];
|
|
36
|
-
const messageText = messages.map(asText).join(" ");
|
|
37
|
-
const mapped = messages.length === 1 && Predicate.isString(messages[0]) ? telemetryLine(messages[0], record.annotations) : void 0;
|
|
38
|
-
const tag = levelTag[record.logLevel];
|
|
39
|
-
let line;
|
|
40
|
-
if (mapped !== void 0) line = `[${time}] ${tag === void 0 ? "" : `${tag} `}${mapped}`;
|
|
41
|
-
else {
|
|
42
|
-
const annotations = record.logLevel === "Warn" || record.logLevel === "Error" || record.logLevel === "Fatal" ? annotationText(record.annotations) : "";
|
|
43
|
-
line = `[${time}] ${tag === void 0 ? "" : `${tag} `}${messageText}${annotations === "" ? "" : ` · ${annotations}`}`;
|
|
44
|
-
}
|
|
45
|
-
return record.cause === void 0 ? line : `${line}\n${record.cause}`;
|
|
46
|
-
};
|
|
47
|
-
/** The compact Logger; annotations come from the emitting fiber. */
|
|
48
|
-
const compactReviewLogger = Logger.make((options) => formatCompactLogLine({
|
|
49
|
-
date: options.date,
|
|
50
|
-
logLevel: options.logLevel,
|
|
51
|
-
message: options.message,
|
|
52
|
-
annotations: options.fiber.getRef(References.CurrentLogAnnotations),
|
|
53
|
-
cause: options.cause.reasons.length > 0 ? Cause.pretty(options.cause) : void 0
|
|
54
|
-
}));
|
|
55
|
-
/**
|
|
56
|
-
* Install the compact console logger and the minimum level for one host run.
|
|
57
|
-
* PR_REVIEW_LOG_LEVEL widens visibility (e.g. "Debug" shows the engine's
|
|
58
|
-
* per-turn and per-handler telemetry); an unknown value fails loudly like
|
|
59
|
-
* every other configuration fault.
|
|
60
|
-
*/
|
|
61
|
-
const compactReviewLoggingLayer = Layer.unwrap(Effect.gen(function* () {
|
|
62
|
-
const level = yield* Config.literals([
|
|
63
|
-
"All",
|
|
64
|
-
"Trace",
|
|
65
|
-
"Debug",
|
|
66
|
-
"Info",
|
|
67
|
-
"Warn",
|
|
68
|
-
"Error"
|
|
69
|
-
], "PR_REVIEW_LOG_LEVEL").pipe(Config.withDefault("Info"));
|
|
70
|
-
return Layer.merge(Logger.layer([Logger.withLeveledConsole(compactReviewLogger)]), Layer.succeed(References.MinimumLogLevel, level));
|
|
71
|
-
}));
|
|
72
|
-
//#endregion
|
|
73
|
-
export { compactReviewLoggingLayer as n, formatCompactLogLine as r, compactReviewLogger as t };
|
|
74
|
-
|
|
75
|
-
//# sourceMappingURL=logging-Q4j0oub-.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logging-Q4j0oub-.mjs","names":[],"sources":["../src/internal/logging.ts"],"sourcesContent":["import type { LogLevel } from \"effect\";\nimport { Cause, Config, Effect, Layer, Logger, Predicate, References } from \"effect\";\n\n// ---------------------------------------------------------------------------\n// Compact host logging for CI runs. The engine's telemetry logs carry full\n// OTel-style annotation sets — correct for an exporter, unreadable as an\n// Actions console. This logger renders each record as ONE line: known engine\n// telemetry messages become short progress lines, and everything else keeps\n// its message with annotations compacted (warnings and errors only). It is\n// presentation only — record filtering stays with MinimumLogLevel, and\n// nothing here feeds back into the run.\n// ---------------------------------------------------------------------------\n\n/** Everything one compact line is rendered from; pure and directly testable. */\nexport interface CompactLogRecord {\n readonly date: Date;\n readonly logLevel: LogLevel.LogLevel;\n readonly message: unknown;\n readonly annotations: Readonly<Record<string, unknown>>;\n /** Pretty-rendered Cause, present only when the record carries one. */\n readonly cause?: string | undefined;\n}\n\nconst levelTag: Partial<Record<LogLevel.LogLevel, string>> = {\n Trace: \"trace\",\n Debug: \"debug\",\n Warn: \"WARN\",\n Error: \"ERROR\",\n Fatal: \"FATAL\",\n};\n\nconst asText = (value: unknown): string => {\n if (Predicate.isString(value)) return value;\n try {\n return JSON.stringify(value) ?? String(value);\n } catch {\n return String(value);\n }\n};\n\nconst annotationText = (annotations: Readonly<Record<string, unknown>>): string =>\n Object.entries(annotations)\n // Dotted keys are the OTel-convention duplicates of the camelCase\n // annotations; one copy per line is enough for a human console.\n .filter(([key]) => !key.includes(\".\"))\n .map(([key, value]) => `${key}=${asText(value).slice(0, 120)}`)\n .join(\" \");\n\n/** Known engine telemetry messages, rendered as short progress lines. */\nconst telemetryLine = (\n message: string,\n annotations: Readonly<Record<string, unknown>>,\n): string | undefined => {\n const toolName = asText(annotations[\"toolName\"] ?? \"tool\");\n switch (message) {\n case \"agent tool execution completed\":\n return `✓ tool ${toolName}`;\n case \"agent tool execution failed\":\n return `✗ tool ${toolName} failed`;\n case \"agent tool handler started\":\n case \"agent programmatic tool handler started\":\n return `→ tool ${toolName}`;\n case \"agent model call started\":\n return `→ model call`;\n case \"agent run started\":\n return `→ agent ${asText(annotations[\"agentId\"] ?? \"run\")} started`;\n default:\n return undefined;\n }\n};\n\n/** Render one log record as a single compact console line. */\nexport const formatCompactLogLine = (record: CompactLogRecord): string => {\n const time = record.date.toISOString().slice(11, 19);\n const messages = Array.isArray(record.message) ? record.message : [record.message];\n const messageText = messages.map(asText).join(\" \");\n const mapped =\n messages.length === 1 && Predicate.isString(messages[0])\n ? telemetryLine(messages[0], record.annotations)\n : undefined;\n const tag = levelTag[record.logLevel];\n let line: string;\n if (mapped !== undefined) {\n line = `[${time}] ${tag === undefined ? \"\" : `${tag} `}${mapped}`;\n } else {\n const isSevere =\n record.logLevel === \"Warn\" || record.logLevel === \"Error\" || record.logLevel === \"Fatal\";\n const annotations = isSevere ? annotationText(record.annotations) : \"\";\n line = `[${time}] ${tag === undefined ? \"\" : `${tag} `}${messageText}${\n annotations === \"\" ? \"\" : ` · ${annotations}`\n }`;\n }\n return record.cause === undefined ? line : `${line}\\n${record.cause}`;\n};\n\n/** The compact Logger; annotations come from the emitting fiber. */\nexport const compactReviewLogger: Logger.Logger<unknown, string> = Logger.make((options) =>\n formatCompactLogLine({\n date: options.date,\n logLevel: options.logLevel,\n message: options.message,\n annotations: options.fiber.getRef(References.CurrentLogAnnotations),\n cause: options.cause.reasons.length > 0 ? Cause.pretty(options.cause) : undefined,\n }),\n);\n\n/**\n * Install the compact console logger and the minimum level for one host run.\n * PR_REVIEW_LOG_LEVEL widens visibility (e.g. \"Debug\" shows the engine's\n * per-turn and per-handler telemetry); an unknown value fails loudly like\n * every other configuration fault.\n */\nexport const compactReviewLoggingLayer: Layer.Layer<never, Config.ConfigError> = Layer.unwrap(\n Effect.gen(function* () {\n const level = yield* Config.literals(\n [\"All\", \"Trace\", \"Debug\", \"Info\", \"Warn\", \"Error\"],\n \"PR_REVIEW_LOG_LEVEL\",\n ).pipe(Config.withDefault<LogLevel.LogLevel>(\"Info\"));\n return Layer.merge(\n Logger.layer([Logger.withLeveledConsole(compactReviewLogger)]),\n Layer.succeed(References.MinimumLogLevel, level),\n );\n }),\n);\n"],"mappings":";;AAuBA,MAAM,WAAuD;CAC3D,OAAO;CACP,OAAO;CACP,MAAM;CACN,OAAO;CACP,OAAO;AACT;AAEA,MAAM,UAAU,UAA2B;CACzC,IAAI,UAAU,SAAS,KAAK,GAAG,OAAO;CACtC,IAAI;EACF,OAAO,KAAK,UAAU,KAAK,KAAK,OAAO,KAAK;CAC9C,QAAQ;EACN,OAAO,OAAO,KAAK;CACrB;AACF;AAEA,MAAM,kBAAkB,gBACtB,OAAO,QAAQ,WAAW,CAAC,CAGxB,QAAQ,CAAC,SAAS,CAAC,IAAI,SAAS,GAAG,CAAC,CAAC,CACrC,KAAK,CAAC,KAAK,WAAW,GAAG,IAAI,GAAG,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,GAAG,GAAG,CAAC,CAC9D,KAAK,GAAG;;AAGb,MAAM,iBACJ,SACA,gBACuB;CACvB,MAAM,WAAW,OAAO,YAAY,eAAe,MAAM;CACzD,QAAQ,SAAR;EACE,KAAK,kCACH,OAAO,UAAU;EACnB,KAAK,+BACH,OAAO,UAAU,SAAS;EAC5B,KAAK;EACL,KAAK,2CACH,OAAO,UAAU;EACnB,KAAK,4BACH,OAAO;EACT,KAAK,qBACH,OAAO,WAAW,OAAO,YAAY,cAAc,KAAK,EAAE;EAC5D,SACE;CACJ;AACF;;AAGA,MAAa,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