@kynver-app/runtime 0.1.4 → 0.1.5

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/index.js CHANGED
@@ -638,6 +638,16 @@ import path7 from "node:path";
638
638
  // src/prompt.ts
639
639
  function buildPrompt(input) {
640
640
  const ownership = input.ownedPaths.length ? `Owned paths: ${input.ownedPaths.join(", ")}. Do not edit outside these paths without stopping and reporting why.` : "Owned paths: unrestricted for this worker, but keep edits tightly scoped.";
641
+ const progressLines = [
642
+ "Structured plan progress (required when planId is set):",
643
+ "- Harness checkpoints only: `kynver plan progress --plan <planId> --row <rowKey> --role implementer --status running|partial|blocked` (the by-id harness route rejects `done` and confirm events).",
644
+ "- When a slice is finished, emit `partial` with evidence (`--evidence pr:<url>`, `--evidence path:<file>`, or `--evidence command:<cmd>`). Do not propose or confirm row `done` from the worker CLI.",
645
+ "- Propose/confirm row `done` is MCP/session only: chat agents use `agent_os_plan_progress_event_append` on the slug route (implementer proposes with `proposed: true`; report_reviewer/deep_reviewer confirm with `proposed: false`).",
646
+ "- When blocked on operator/Ghost/runtime review, create a linked review task (MCP `agent_os_plan_review_task_create` or API) and pass `--review-task <taskId>`.",
647
+ "- Before the completion report: mark completion-report rows partial with evidence; do not skip report review.",
648
+ "- After implementation: wait for report_reviewer then deep_reviewer confirmation (via MCP/session agents) before follow-up rows close.",
649
+ input.planId ? `Active planId: ${input.planId}${input.taskId ? ` \xB7 taskId: ${input.taskId}` : ""}` : "No planId on this worker \u2014 still emit progress when you touch plan-scoped work."
650
+ ];
641
651
  return [
642
652
  "You are running under the Kynver AgentOS runtime.",
643
653
  "Immediately state your plan before editing.",
@@ -647,6 +657,8 @@ function buildPrompt(input) {
647
657
  "After each major step, append one JSON line to the heartbeat file with fields: ts, phase, summary, changedFiles, blocker.",
648
658
  "Final response must include files changed, verification commands, and unresolved risks.",
649
659
  "",
660
+ ...progressLines,
661
+ "",
650
662
  "Task:",
651
663
  input.task
652
664
  ].join("\n");
@@ -1520,14 +1532,14 @@ function parseEvidenceArg(raw) {
1520
1532
  return { type: raw.slice(0, idx), value: raw.slice(idx + 1) };
1521
1533
  }
1522
1534
  async function emitPlanProgress(args) {
1523
- const planId = required(args, "plan");
1535
+ const planId = required(args.plan ? String(args.plan) : void 0, "plan");
1524
1536
  const agentOsId = (args.agentOsId ? String(args.agentOsId) : loadUserConfig().agentOsId) || "";
1525
1537
  if (!agentOsId) {
1526
1538
  console.error("requires --agent-os-id or agentOsId in ~/.kynver/config.json");
1527
1539
  process.exit(1);
1528
1540
  }
1529
- const roleLane = required(args, "role");
1530
- const status = required(args, "status");
1541
+ const roleLane = required(args.role ? String(args.role) : void 0, "role");
1542
+ const status = required(args.status ? String(args.status) : void 0, "status");
1531
1543
  const evidence = [];
1532
1544
  const rawEvidence = args.evidence;
1533
1545
  if (Array.isArray(rawEvidence)) {
@@ -1538,6 +1550,8 @@ async function emitPlanProgress(args) {
1538
1550
  const base = resolveBaseUrl(args.baseUrl ? String(args.baseUrl) : void 0);
1539
1551
  const secret = resolveCallbackSecret(args.secret ? String(args.secret) : void 0);
1540
1552
  const url = `${base}/api/agent-os/by-id/${encodeURIComponent(agentOsId)}/plans/${encodeURIComponent(planId)}/progress-events`;
1553
+ const cfg = loadUserConfig();
1554
+ const provider = cfg.workerProvider ? `provider:${cfg.workerProvider}` : void 0;
1541
1555
  const body = {
1542
1556
  rowKey: args.row ? String(args.row) : void 0,
1543
1557
  rowId: args.rowId ? String(args.rowId) : void 0,
@@ -1549,14 +1563,13 @@ async function emitPlanProgress(args) {
1549
1563
  remainingWork: args.remaining ? String(args.remaining) : void 0,
1550
1564
  evidence: evidence.length ? evidence : void 0,
1551
1565
  proposed: args.proposed === true || args.proposed === "true",
1552
- executorRef: args.executorRef ? String(args.executorRef) : void 0
1566
+ executorRef: args.executorRef ? String(args.executorRef) : provider
1553
1567
  };
1554
1568
  const res = await fetch(url, {
1555
1569
  method: "POST",
1556
1570
  headers: {
1557
1571
  "Content-Type": "application/json",
1558
- "X-OpenClaw-Cron-Secret": secret,
1559
- "X-Kynver-Runtime-Secret": secret
1572
+ "X-OpenClaw-Cron-Secret": secret
1560
1573
  },
1561
1574
  body: JSON.stringify(body)
1562
1575
  });
@@ -1574,7 +1587,7 @@ async function emitPlanProgress(args) {
1574
1587
  console.log(JSON.stringify(parsed, null, 2));
1575
1588
  }
1576
1589
  async function verifyPlan(args) {
1577
- const planId = required(args, "plan");
1590
+ const planId = required(args.plan ? String(args.plan) : void 0, "plan");
1578
1591
  const slug = loadUserConfig().agentOsSlug;
1579
1592
  if (!slug) {
1580
1593
  console.error("requires agentOsSlug in ~/.kynver/config.json for verify (session route)");