@kynver-app/runtime 0.1.47 → 0.1.48

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
@@ -2099,6 +2099,7 @@ function buildPrompt(input) {
2099
2099
  "Structured final result (recommended): record completion as JSON with summary, laneExpertise { whatChanged, why, files, prUrls, verification, risks, blockers, lessonsLearned, laneGuidance }, and targetPrReconciliation [{ prUrl, outcome: merged|skipped|blocked, mergeCommit?, reason? }] for every target PR on landing-only tasks.",
2100
2100
  "Completion handoff (required): before you stop, ensure the harness records a final result \u2014 summarize outcome in your last message and append a heartbeat line with phase `complete`. If you leave uncommitted changes or committed work without a PR, the orchestrator blocks completion until a GitHub PR exists (or you discard/commit cleanly). Exiting with only dirty files and no PR routes to salvage review, not production review.",
2101
2101
  "PR-ready handoff: for substantial implementation work, commit, push, and open a GitHub PR (draft OK) on your branch before finishing \u2014 or rely on the harness to run `gh pr create` at completion when `gh` is authenticated.",
2102
+ "Expert review / production-review workers (Dalton/Lorentz, plan-review-task, scheduledJob reviewer children): do NOT open new implementation PRs \u2014 review the parent task's existing PR and record reviewVerdict in finalResult; landing-contract targetPrReconciliation does not apply.",
2102
2103
  "Worker resource guard: do not run full monorepo verification (`npm run typecheck`, `npm run build`, or equivalent) from this worker lane unless an operator explicitly requests it. Use targeted checks for touched paths and rely on CI/operator lanes for heavy gates.",
2103
2104
  "npm publish boundary: do not run `npm publish`, do not republish `@kynver-app/*` packages, and do not block on an operator to publish. When you need newer runtime code than npm, use this repo checkout (`npm run kynver:build`, `npm run kynver`) and record evidence: packages/kynver-runtime/package.json version + git ref in your completion report.",
2104
2105
  "If verification fails (including OOM), append a heartbeat line immediately with the last command, failure reason, dirty-file status, commit/PR handoff state, and next action so recovery does not require log spelunking.",
@@ -2340,6 +2341,32 @@ function completionPostSucceeded(summary) {
2340
2341
  return summary.taskAdvanced;
2341
2342
  }
2342
2343
 
2344
+ // src/harness-expert-review.ts
2345
+ var EXPERT_LANE_REVIEW_REF = "expert-lane-pr-review:";
2346
+ var PLAN_REVIEW_EXECUTOR_REF = "plan-review-task";
2347
+ var SCHEDULED_JOB_EXECUTOR_REF = "scheduledjob:";
2348
+ function normalizePersonaSlug(value) {
2349
+ if (!value) return null;
2350
+ const t = value.trim().toLowerCase();
2351
+ return t.length ? t : null;
2352
+ }
2353
+ function isHarnessExpertReviewWorker(worker) {
2354
+ const ref = (worker.executorRef ?? "").toLowerCase();
2355
+ if (ref.startsWith(EXPERT_LANE_REVIEW_REF)) return true;
2356
+ if (ref === PLAN_REVIEW_EXECUTOR_REF || ref.startsWith("daemon-review:")) return true;
2357
+ if (ref.startsWith(SCHEDULED_JOB_EXECUTOR_REF) && worker.parentTaskId) {
2358
+ const persona = normalizePersonaSlug(worker.personaSlug);
2359
+ if (persona === "lorentz" || persona === "dalton") return true;
2360
+ }
2361
+ const title = (worker.title ?? "").toLowerCase();
2362
+ if (title.includes("expert pr review")) return true;
2363
+ if (worker.parentTaskId && (title.startsWith("review:") || title.includes("review required") || title.includes("runtime review"))) {
2364
+ const persona = normalizePersonaSlug(worker.personaSlug);
2365
+ if (persona === "lorentz" || persona === "dalton") return true;
2366
+ }
2367
+ return false;
2368
+ }
2369
+
2343
2370
  // src/pr-handoff/pr-handoff-assess.ts
2344
2371
  var REVIEW_LANE_RULE = /^(lane:)?(review|deep_review|planning|landing)(:|$)/i;
2345
2372
  function trimOrNull4(value) {
@@ -2370,6 +2397,14 @@ function assessPrHandoffRequirement(input) {
2370
2397
  if (!input.dispatched) {
2371
2398
  return { required: false, reason: "not_dispatched" };
2372
2399
  }
2400
+ if (isHarnessExpertReviewWorker({
2401
+ title: input.taskTitle ?? void 0,
2402
+ personaSlug: input.personaSlug,
2403
+ parentTaskId: input.parentTaskId,
2404
+ executorRef: input.executorRef
2405
+ })) {
2406
+ return { required: false, reason: "expert_review_task" };
2407
+ }
2373
2408
  const rule = trimOrNull4(input.routingRule) ?? "";
2374
2409
  if (rule && REVIEW_LANE_RULE.test(rule)) {
2375
2410
  return { required: false, reason: "review_lane" };
@@ -2377,7 +2412,7 @@ function assessPrHandoffRequirement(input) {
2377
2412
  if (trimOrNull4(input.patchPath) || trimOrNull4(input.artifactBundlePath)) {
2378
2413
  return { required: false, reason: "patch_or_bundle" };
2379
2414
  }
2380
- const prUrl = trimOrNull4(input.prUrl) ?? trimOrNull4(input.snapshot.prUrl);
2415
+ const prUrl = trimOrNull4(input.prUrl) ?? trimOrNull4(input.taskPrUrl) ?? trimOrNull4(input.snapshot.prUrl);
2381
2416
  if (prUrl) {
2382
2417
  return { required: false, reason: "already_has_pr" };
2383
2418
  }
@@ -2594,6 +2629,11 @@ function ensurePrReadyHandoff(input, exec = defaultPrHandoffExec) {
2594
2629
  dispatched: input.worker.dispatched,
2595
2630
  routingRule: input.worker.routingRule,
2596
2631
  prUrl: prUrlHint,
2632
+ taskTitle: input.worker.taskTitle,
2633
+ executorRef: input.worker.executorRef,
2634
+ parentTaskId: input.worker.parentTaskId,
2635
+ personaSlug: input.worker.personaSlug,
2636
+ taskPrUrl: input.worker.taskPrUrl,
2597
2637
  snapshot
2598
2638
  });
2599
2639
  if (!requirement.required) {
@@ -3473,6 +3513,10 @@ function spawnWorkerProcess(run, opts) {
3473
3513
  ...!opts.agentOsId || !opts.taskId ? { localOnly: true } : {},
3474
3514
  routingRule: routing.rule,
3475
3515
  ...routing.requestedModel ? { requestedModel: routing.requestedModel } : {},
3516
+ ...opts.executorRef ? { executorRef: String(opts.executorRef) } : {},
3517
+ ...opts.parentTaskId ? { parentTaskId: String(opts.parentTaskId) } : {},
3518
+ ...opts.taskTitle ? { taskTitle: String(opts.taskTitle) } : {},
3519
+ ...opts.taskPrUrl ? { taskPrUrl: String(opts.taskPrUrl) } : {},
3476
3520
  startedAt: (/* @__PURE__ */ new Date()).toISOString()
3477
3521
  };
3478
3522
  saveWorker(run.id, worker);
@@ -4167,7 +4211,7 @@ function readHarnessWorkerContext(decision) {
4167
4211
  personaInjectionReady
4168
4212
  };
4169
4213
  }
4170
- function normalizePersonaSlug(value) {
4214
+ function normalizePersonaSlug2(value) {
4171
4215
  if (typeof value !== "string") return null;
4172
4216
  const trimmed = value.trim().toLowerCase();
4173
4217
  return trimmed.length ? trimmed : null;
@@ -4298,7 +4342,7 @@ async function dispatchRun(args) {
4298
4342
  const task = decision.task;
4299
4343
  const harnessContext = readHarnessWorkerContext(decision);
4300
4344
  const taskId = String(task.id);
4301
- const expectedPersona = normalizePersonaSlug(task.personaSlug);
4345
+ const expectedPersona = normalizePersonaSlug2(task.personaSlug);
4302
4346
  if (expectedPersona && (!harnessContext?.personaInjectionReady || !harnessContext.personaMarkdown)) {
4303
4347
  outcomes.push({
4304
4348
  taskId,
@@ -4342,6 +4386,10 @@ async function dispatchRun(args) {
4342
4386
  agentOsId,
4343
4387
  taskId: String(task.id),
4344
4388
  planId,
4389
+ executorRef: task.executorRef ? String(task.executorRef) : void 0,
4390
+ parentTaskId: task.parentTaskId ? String(task.parentTaskId) : void 0,
4391
+ taskTitle: task.title ? String(task.title) : void 0,
4392
+ taskPrUrl: task.prUrl ? String(task.prUrl) : void 0,
4345
4393
  instructionPolicyMarkdown: harnessContext?.instructionPolicyMarkdown ?? null,
4346
4394
  instructionPolicyFingerprint: harnessContext?.instructionPolicyFingerprint ?? null,
4347
4395
  instructionPolicyEvidence: harnessContext?.instructionPolicyEvidence ?? null,