@kynver-app/openclaw-agent-os 0.1.27 → 0.1.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/dist/index.js CHANGED
@@ -1,3 +1,17 @@
1
+ // src/version.ts
2
+ import { readFileSync } from "node:fs";
3
+ import { dirname, join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ function readOwnPackageVersion() {
6
+ const pkgPath = join(dirname(fileURLToPath(import.meta.url)), "..", "package.json");
7
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
8
+ if (typeof pkg.version !== "string" || !pkg.version.trim()) {
9
+ throw new Error(`Missing package.json version at ${pkgPath}`);
10
+ }
11
+ return pkg.version;
12
+ }
13
+ var VERSION = readOwnPackageVersion();
14
+
1
15
  // src/config.ts
2
16
  var pluginConfigSchema = {
3
17
  type: "object",
@@ -102,10 +116,10 @@ function resolvePluginConfig(rawEntry) {
102
116
 
103
117
  // src/mcporter-client.ts
104
118
  import { execFile } from "node:child_process";
105
- import { existsSync, readFileSync } from "node:fs";
119
+ import { existsSync, readFileSync as readFileSync2 } from "node:fs";
106
120
  import os from "node:os";
107
121
  import path from "node:path";
108
- import { fileURLToPath } from "node:url";
122
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
109
123
  import { promisify } from "node:util";
110
124
 
111
125
  // src/result.ts
@@ -278,7 +292,7 @@ function resolveDirectAgentOsConfig({
278
292
  const envConfig = directConfigFromEnv(agentOsSlug, kynverApiKey);
279
293
  if (envConfig) return envConfig;
280
294
  try {
281
- const parsed = JSON.parse(readFileSync(configPath, "utf8"));
295
+ const parsed = JSON.parse(readFileSync2(configPath, "utf8"));
282
296
  const server = parsed?.mcpServers?.[serverName];
283
297
  const env = server?.env;
284
298
  const apiUrl = typeof env?.KYNVER_API_URL === "string" ? env.KYNVER_API_URL.trim() : "";
@@ -839,7 +853,7 @@ function extractApiErrorMessage(payload, status) {
839
853
  return `HTTP ${status}`;
840
854
  }
841
855
  function resolveMcporterConfigPath(configuredPath) {
842
- const here = fileURLToPath(new URL(".", import.meta.url));
856
+ const here = fileURLToPath2(new URL(".", import.meta.url));
843
857
  const homeDir = os.homedir();
844
858
  const candidates = [
845
859
  configuredPath,
@@ -935,7 +949,12 @@ function buildAgentOsContinuityGuidanceContext(config) {
935
949
  "- Open a GitHub PR on a feature branch before substantial plan drafting under docs/superpowers/plans/; iterate all plan revisions on that branch (push after meaningful edits).",
936
950
  "- Link prUrl on the planning AgentTask and plan progress evidence (type pr); update Lane B active state with the canonical plan PR.",
937
951
  "- Never treat a harness worktree as the sole home for a plan \u2014 Will and reviewers must reach the artifact via GitHub.",
938
- "- Full checklist: docs/superpowers/plans/2026-05-25-pr-first-plan-artifact-preservation.md"
952
+ "- Full checklist: docs/superpowers/plans/2026-05-25-pr-first-plan-artifact-preservation.md",
953
+ "",
954
+ "PR landing contract:",
955
+ "- Landing tasks are merge-only. Do not edit files, rebase, resolve conflicts, change package versions, or perform implementation work from a landing lane.",
956
+ "- Land PRs only through the repo's narrow landing wrapper: `node scripts/agent-os-land-pr.mjs <pr-number-or-url>`. The wrapper performs live GitHub readiness checks, squash-merges exactly that PR, deletes the branch, and verifies merged state.",
957
+ "- If the wrapper rejects a PR as draft, conflicted, non-green, pending checks, or missing an exact PR target, mark the landing task blocked with the exact reason instead of improvising a merge path."
939
958
  ];
940
959
  return lines.join("\n");
941
960
  }
@@ -2493,9 +2512,9 @@ function createTaskTools(config) {
2493
2512
  // src/harness-client.ts
2494
2513
  import { createRequire } from "node:module";
2495
2514
  import path2 from "node:path";
2496
- import { spawnSync } from "node:child_process";
2515
+ import { spawn } from "node:child_process";
2497
2516
  import { existsSync as existsSync2 } from "node:fs";
2498
- import { fileURLToPath as fileURLToPath2 } from "node:url";
2517
+ import { fileURLToPath as fileURLToPath3 } from "node:url";
2499
2518
  var require2 = createRequire(import.meta.url);
2500
2519
  function resolveRuntimeCli() {
2501
2520
  try {
@@ -2505,7 +2524,7 @@ function resolveRuntimeCli() {
2505
2524
  } catch {
2506
2525
  }
2507
2526
  const monorepoCli = path2.join(
2508
- fileURLToPath2(new URL(".", import.meta.url)),
2527
+ fileURLToPath3(new URL(".", import.meta.url)),
2509
2528
  "..",
2510
2529
  "..",
2511
2530
  "kynver-runtime",
@@ -2527,9 +2546,17 @@ function flagArgs(args) {
2527
2546
  }
2528
2547
  return out;
2529
2548
  }
2530
- async function runHarnessCommand(config, command, args) {
2549
+ var DEFAULT_HARNESS_TIMEOUT_MS = 6e4;
2550
+ var SIGKILL_GRACE_MS = 2e3;
2551
+ async function runHarnessCommand(config, command, args, options = {}) {
2531
2552
  if (!config.harnessRepo) {
2532
- return { ok: false, error: "harnessRepo / KYNVER_HARNESS_REPO is required when enableHarnessTools is on" };
2553
+ return {
2554
+ ok: false,
2555
+ exitCode: null,
2556
+ stdout: "",
2557
+ stderr: "",
2558
+ error: "harnessRepo / KYNVER_HARNESS_REPO is required when enableHarnessTools is on"
2559
+ };
2533
2560
  }
2534
2561
  const merged = { repo: config.harnessRepo, ...args };
2535
2562
  const runtimeCli = resolveRuntimeCli();
@@ -2538,16 +2565,55 @@ async function runHarnessCommand(config, command, args) {
2538
2565
  ...config.kynverApiUrl ? { KYNVER_API_URL: config.kynverApiUrl } : {},
2539
2566
  ...config.kynverApiKey ? { KYNVER_API_KEY: config.kynverApiKey } : {}
2540
2567
  };
2541
- const res = spawnSync(process.execPath, [runtimeCli, ...command, ...flagArgs(merged)], {
2542
- encoding: "utf8",
2543
- env
2568
+ const timeoutMs = Math.max(1e3, options.timeoutMs ?? DEFAULT_HARNESS_TIMEOUT_MS);
2569
+ return new Promise((resolve) => {
2570
+ const child = spawn(process.execPath, [runtimeCli, ...command, ...flagArgs(merged)], { env });
2571
+ let stdout = "";
2572
+ let stderr = "";
2573
+ let timedOut = false;
2574
+ let settled = false;
2575
+ let killGraceTimer;
2576
+ child.stdout?.setEncoding("utf8");
2577
+ child.stderr?.setEncoding("utf8");
2578
+ child.stdout?.on("data", (chunk) => {
2579
+ stdout += chunk;
2580
+ });
2581
+ child.stderr?.on("data", (chunk) => {
2582
+ stderr += chunk;
2583
+ });
2584
+ const settle = (result) => {
2585
+ if (settled) return;
2586
+ settled = true;
2587
+ clearTimeout(killTimer);
2588
+ if (killGraceTimer) clearTimeout(killGraceTimer);
2589
+ resolve(result);
2590
+ };
2591
+ const killTimer = setTimeout(() => {
2592
+ timedOut = true;
2593
+ child.kill("SIGTERM");
2594
+ killGraceTimer = setTimeout(() => {
2595
+ if (!child.killed) child.kill("SIGKILL");
2596
+ }, SIGKILL_GRACE_MS);
2597
+ }, timeoutMs);
2598
+ child.on("error", (err) => {
2599
+ settle({
2600
+ ok: false,
2601
+ exitCode: null,
2602
+ stdout,
2603
+ stderr,
2604
+ error: err.message
2605
+ });
2606
+ });
2607
+ child.on("close", (code) => {
2608
+ settle({
2609
+ ok: code === 0 && !timedOut,
2610
+ exitCode: code,
2611
+ stdout,
2612
+ stderr,
2613
+ ...timedOut ? { timedOut: true, error: `harness command timed out after ${timeoutMs}ms` } : {}
2614
+ });
2615
+ });
2544
2616
  });
2545
- return {
2546
- ok: res.status === 0,
2547
- exitCode: res.status,
2548
- stdout: res.stdout,
2549
- stderr: res.stderr
2550
- };
2551
2617
  }
2552
2618
 
2553
2619
  // src/tools/harness.ts
@@ -2870,6 +2936,7 @@ var plugin = {
2870
2936
  };
2871
2937
  var index_default = plugin;
2872
2938
  export {
2939
+ VERSION,
2873
2940
  index_default as default
2874
2941
  };
2875
2942
  //# sourceMappingURL=index.js.map