@omniralph/agent 0.3.1 → 0.3.2

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 CHANGED
@@ -885,6 +885,12 @@ var RalphPullRequestAction = z10.object({
885
885
  title: z10.string().trim().min(1).max(500).optional(),
886
886
  body: z10.string().trim().min(1).max(6e4).optional()
887
887
  });
888
+ var RALPH_FINDING_OUTCOMES = ["fixed", "skipped"];
889
+ var RalphFindingOutcome = z10.object({
890
+ findingId: z10.uuid(),
891
+ outcome: z10.enum(RALPH_FINDING_OUTCOMES),
892
+ comment: z10.string().trim().min(1).max(2e3)
893
+ });
888
894
  var RalphRequestResult = z10.object({
889
895
  /** For the Linear thread: what the session did, or why it couldn't (`error`). */
890
896
  summary: z10.string().max(2e4),
@@ -893,6 +899,8 @@ var RalphRequestResult = z10.object({
893
899
  /** The Claude session, resumed by the lane's next request on the same agent. */
894
900
  sessionId: z10.string().min(1).max(200).nullable(),
895
901
  pullRequest: RalphPullRequestAction.optional(),
902
+ /** The review findings the session fixed or skipped. */
903
+ findings: z10.array(RalphFindingOutcome).max(50).optional(),
896
904
  /** What the session left uncommitted, stashed. */
897
905
  stashSha: CommitSha.optional(),
898
906
  usage: TokenUsage,
@@ -3273,7 +3281,7 @@ var RALPH_TOOL_POLICY = {
3273
3281
  disallowedTools: [],
3274
3282
  fileScope: "cwd",
3275
3283
  permissionMode: "bypassPermissions",
3276
- settingSources: ["project", "local"],
3284
+ settingSources: ["user", "project", "local"],
3277
3285
  writable: true
3278
3286
  };
3279
3287
  var DESCRIBE_PR_GIT_COMMANDS = [
@@ -3516,21 +3524,43 @@ var RequestAgentOutput = z11.object({
3516
3524
  body: z11.string().optional().describe("The markdown description (open, update).")
3517
3525
  }).optional().describe(
3518
3526
  "A change to the branch's pull/merge request for the orchestrator to make; push the branch first."
3527
+ ),
3528
+ findings: z11.array(
3529
+ z11.object({
3530
+ id: z11.string().describe("The finding's ID, as given in the request."),
3531
+ outcome: z11.enum(["fixed", "skipped"]).describe("fixed: you changed the code for it. skipped: it's wrong or not worth it."),
3532
+ comment: z11.string().describe(
3533
+ "Posted in the finding's thread: one or two sentences on the change, or on why you skipped it."
3534
+ )
3535
+ })
3536
+ ).optional().describe(
3537
+ "What you did with each review finding the request lists by ID. Omniralph replies in the threads and resolves the fixed ones."
3519
3538
  )
3520
3539
  });
3521
3540
  var REQUEST_OUTPUT_SCHEMA = jsonSchema(RequestAgentOutput);
3541
+ var MAX_FINDING_OUTCOMES = 50;
3542
+ var MAX_FINDING_COMMENT = 2e3;
3543
+ var FindingId = z11.uuid();
3522
3544
  function readRequestResult(structured) {
3523
3545
  const parsed = structured === void 0 ? void 0 : RequestAgentOutput.safeParse(structured);
3524
3546
  if (!parsed?.success) return { problem: problemWith(parsed?.error) };
3525
3547
  const { pullRequest } = parsed.data;
3526
3548
  const title = pullRequest?.title?.replace(/\s+/g, " ").trim();
3527
3549
  const body = pullRequest?.body?.trim();
3550
+ const findings = [];
3551
+ for (const f of parsed.data.findings ?? []) {
3552
+ const id = f.id.trim().toLowerCase();
3553
+ const comment = f.comment.trim();
3554
+ if (!comment || !FindingId.safeParse(id).success || findings.some((x) => x.id === id)) continue;
3555
+ findings.push({ id, outcome: f.outcome, comment: comment.slice(0, MAX_FINDING_COMMENT) });
3556
+ }
3528
3557
  return {
3529
3558
  result: {
3530
3559
  summary: parsed.data.summary.trim(),
3531
3560
  ...pullRequest && {
3532
3561
  pullRequest: { action: pullRequest.action, ...title && { title }, ...body && { body } }
3533
- }
3562
+ },
3563
+ ...findings.length > 0 && { findings: findings.slice(0, MAX_FINDING_OUTCOMES) }
3534
3564
  }
3535
3565
  };
3536
3566
  }
@@ -5494,7 +5524,13 @@ async function runRequest(job, ctx, options = {}) {
5494
5524
  error: clip3(why)
5495
5525
  };
5496
5526
  }
5497
- log.info({ pullRequest: read.result.pullRequest?.action ?? null }, "request done");
5527
+ log.info(
5528
+ {
5529
+ pullRequest: read.result.pullRequest?.action ?? null,
5530
+ findings: read.result.findings?.length ?? 0
5531
+ },
5532
+ "request done"
5533
+ );
5498
5534
  return {
5499
5535
  ...base,
5500
5536
  summary: clip3(read.result.summary),
@@ -5509,6 +5545,13 @@ async function runRequest(job, ctx, options = {}) {
5509
5545
  body: clip3(read.result.pullRequest.body, 6e4)
5510
5546
  }
5511
5547
  }
5548
+ },
5549
+ ...read.result.findings && {
5550
+ findings: read.result.findings.map((f) => ({
5551
+ findingId: f.id,
5552
+ outcome: f.outcome,
5553
+ comment: f.comment
5554
+ }))
5512
5555
  }
5513
5556
  };
5514
5557
  } catch (error) {