@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/cli.js CHANGED
@@ -645,6 +645,16 @@ import path7 from "node:path";
645
645
  // src/prompt.ts
646
646
  function buildPrompt(input) {
647
647
  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.";
648
+ const progressLines = [
649
+ "Structured plan progress (required when planId is set):",
650
+ "- 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).",
651
+ "- 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.",
652
+ "- 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`).",
653
+ "- 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>`.",
654
+ "- Before the completion report: mark completion-report rows partial with evidence; do not skip report review.",
655
+ "- After implementation: wait for report_reviewer then deep_reviewer confirmation (via MCP/session agents) before follow-up rows close.",
656
+ 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."
657
+ ];
648
658
  return [
649
659
  "You are running under the Kynver AgentOS runtime.",
650
660
  "Immediately state your plan before editing.",
@@ -654,6 +664,8 @@ function buildPrompt(input) {
654
664
  "After each major step, append one JSON line to the heartbeat file with fields: ts, phase, summary, changedFiles, blocker.",
655
665
  "Final response must include files changed, verification commands, and unresolved risks.",
656
666
  "",
667
+ ...progressLines,
668
+ "",
657
669
  "Task:",
658
670
  input.task
659
671
  ].join("\n");
@@ -1495,14 +1507,14 @@ function parseEvidenceArg(raw) {
1495
1507
  return { type: raw.slice(0, idx), value: raw.slice(idx + 1) };
1496
1508
  }
1497
1509
  async function emitPlanProgress(args) {
1498
- const planId = required(args, "plan");
1510
+ const planId = required(args.plan ? String(args.plan) : void 0, "plan");
1499
1511
  const agentOsId = (args.agentOsId ? String(args.agentOsId) : loadUserConfig().agentOsId) || "";
1500
1512
  if (!agentOsId) {
1501
1513
  console.error("requires --agent-os-id or agentOsId in ~/.kynver/config.json");
1502
1514
  process.exit(1);
1503
1515
  }
1504
- const roleLane = required(args, "role");
1505
- const status = required(args, "status");
1516
+ const roleLane = required(args.role ? String(args.role) : void 0, "role");
1517
+ const status = required(args.status ? String(args.status) : void 0, "status");
1506
1518
  const evidence = [];
1507
1519
  const rawEvidence = args.evidence;
1508
1520
  if (Array.isArray(rawEvidence)) {
@@ -1513,6 +1525,8 @@ async function emitPlanProgress(args) {
1513
1525
  const base = resolveBaseUrl(args.baseUrl ? String(args.baseUrl) : void 0);
1514
1526
  const secret = resolveCallbackSecret(args.secret ? String(args.secret) : void 0);
1515
1527
  const url = `${base}/api/agent-os/by-id/${encodeURIComponent(agentOsId)}/plans/${encodeURIComponent(planId)}/progress-events`;
1528
+ const cfg = loadUserConfig();
1529
+ const provider = cfg.workerProvider ? `provider:${cfg.workerProvider}` : void 0;
1516
1530
  const body = {
1517
1531
  rowKey: args.row ? String(args.row) : void 0,
1518
1532
  rowId: args.rowId ? String(args.rowId) : void 0,
@@ -1524,14 +1538,13 @@ async function emitPlanProgress(args) {
1524
1538
  remainingWork: args.remaining ? String(args.remaining) : void 0,
1525
1539
  evidence: evidence.length ? evidence : void 0,
1526
1540
  proposed: args.proposed === true || args.proposed === "true",
1527
- executorRef: args.executorRef ? String(args.executorRef) : void 0
1541
+ executorRef: args.executorRef ? String(args.executorRef) : provider
1528
1542
  };
1529
1543
  const res = await fetch(url, {
1530
1544
  method: "POST",
1531
1545
  headers: {
1532
1546
  "Content-Type": "application/json",
1533
- "X-OpenClaw-Cron-Secret": secret,
1534
- "X-Kynver-Runtime-Secret": secret
1547
+ "X-OpenClaw-Cron-Secret": secret
1535
1548
  },
1536
1549
  body: JSON.stringify(body)
1537
1550
  });
@@ -1549,7 +1562,7 @@ async function emitPlanProgress(args) {
1549
1562
  console.log(JSON.stringify(parsed, null, 2));
1550
1563
  }
1551
1564
  async function verifyPlan(args) {
1552
- const planId = required(args, "plan");
1565
+ const planId = required(args.plan ? String(args.plan) : void 0, "plan");
1553
1566
  const slug = loadUserConfig().agentOsSlug;
1554
1567
  if (!slug) {
1555
1568
  console.error("requires agentOsSlug in ~/.kynver/config.json for verify (session route)");