@kynver-app/openclaw-agent-os 0.1.17 → 0.1.19

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/README.md CHANGED
@@ -145,6 +145,22 @@ native Codex dynamic-tool bridge issue.
145
145
  - `agent_os_plan_add_link`
146
146
  - `agent_os_plan_list_links`
147
147
  - `agent_os_plan_list_versions`
148
+ - `agent_os_command_center_get`
149
+ - `agent_os_task_next_action`
150
+ - `agent_os_plan_progress_rows_list`
151
+ - `agent_os_plan_progress_rows_upsert`
152
+ - `agent_os_plan_progress_event_append`
153
+
154
+ `agent_os_command_center_get` returns the same unified Command Center rollup the
155
+ browser operator console uses (plan rollups, project hierarchy, action-required,
156
+ DQ inbox, goals, review lanes, harness summaries). It calls the by-id HTTP
157
+ surface and resolves `agentOsId` from the workspace slug when omitted.
158
+
159
+ `agent_os_task_next_action` posts harness completion signals to the deterministic
160
+ next-action router (review/fix/landing dispatch, close, or await-human).
161
+
162
+ Plan progress tools mirror the AgentOS MCP plan-progress surface for structured
163
+ checklist rows and role-lane events.
148
164
 
149
165
  Plan tools manage first-class AgentOS plans — versioned operational artifacts
150
166
  distinct from goals/projects/tasks. Each `AgentPlan` owns a chain of immutable
package/dist/index.js CHANGED
@@ -301,6 +301,36 @@ function directConfigFromEnv(agentOsSlug, kynverApiKey) {
301
301
  };
302
302
  }
303
303
  var primarySlugCache = /* @__PURE__ */ new Map();
304
+ var agentOsIdCache = /* @__PURE__ */ new Map();
305
+ async function resolveAgentOsId(config, slug, timeoutMs) {
306
+ const cacheKey = `${config.apiUrl}|${config.apiKey || ""}|${slug}`;
307
+ const cached = agentOsIdCache.get(cacheKey);
308
+ if (cached) return cached;
309
+ const controller = new AbortController();
310
+ const timer = setTimeout(() => controller.abort(), Math.max(1e3, Math.min(timeoutMs, 1e4)));
311
+ try {
312
+ const res = await fetch(`${config.apiUrl}/api/agent-os/${encodeURIComponent(slug)}`, {
313
+ method: "GET",
314
+ headers: {
315
+ Accept: "application/json",
316
+ ...config.apiKey ? { Authorization: `Bearer ${config.apiKey}` } : {}
317
+ },
318
+ signal: controller.signal
319
+ });
320
+ if (!res.ok) return void 0;
321
+ const text = await res.text();
322
+ const payload = text ? safeJson(text) : null;
323
+ if (!payload || typeof payload !== "object") return void 0;
324
+ const id = typeof payload.id === "string" ? payload.id.trim() : "";
325
+ if (!id) return void 0;
326
+ agentOsIdCache.set(cacheKey, id);
327
+ return id;
328
+ } catch {
329
+ return void 0;
330
+ } finally {
331
+ clearTimeout(timer);
332
+ }
333
+ }
304
334
  async function resolvePrimarySlug(config, timeoutMs) {
305
335
  const cacheKey = `${config.apiUrl}|${config.apiKey || ""}`;
306
336
  const cached = primarySlugCache.get(cacheKey);
@@ -350,14 +380,25 @@ async function callAgentOsApiDirect(toolName2, params, timeoutMs, config) {
350
380
  "AgentOS slug could not be resolved. Set agentOsSlug in plugin config, or ensure the account has a primary AgentOS workspace at GET /api/agent-os."
351
381
  );
352
382
  }
353
- const { slug, path: path3, method, body } = directRequestForTool(toolName2, params, resolvedSlug);
383
+ const request = directRequestForTool(toolName2, params, resolvedSlug);
384
+ const { slug, path: path3, method, body } = request;
354
385
  if (!slug) {
355
386
  throw new Error("AgentOS slug could not be resolved.");
356
387
  }
388
+ let url = `${config.apiUrl}/api/agent-os/${encodeURIComponent(slug)}${path3}`;
389
+ if (request.route === "by-id") {
390
+ const agentOsId = request.agentOsId || stringParam(params.agentOsId) || await resolveAgentOsId(config, slug, timeoutMs);
391
+ if (!agentOsId) {
392
+ throw new Error(
393
+ "AgentOS id could not be resolved for by-id Command Center routes. Pass agentOsId or ensure GET /api/agent-os/{slug} returns id."
394
+ );
395
+ }
396
+ url = `${config.apiUrl}/api/agent-os/by-id/${encodeURIComponent(agentOsId)}${path3}`;
397
+ }
357
398
  const controller = new AbortController();
358
399
  const timer = setTimeout(() => controller.abort(), timeoutMs);
359
400
  try {
360
- const res = await fetch(`${config.apiUrl}/api/agent-os/${encodeURIComponent(slug)}${path3}`, {
401
+ const res = await fetch(url, {
361
402
  method,
362
403
  headers: {
363
404
  "Content-Type": "application/json",
@@ -379,7 +420,7 @@ async function callAgentOsApiDirect(toolName2, params, timeoutMs, config) {
379
420
  }
380
421
  function directRequestForTool(toolName2, params, resolvedSlug) {
381
422
  const slug = stringParam(params.slug) || resolvedSlug;
382
- const withoutSlug = stripKeys(params, ["slug"]);
423
+ const withoutSlug = stripKeys(params, ["slug", "agentOsId"]);
383
424
  switch (toolName2) {
384
425
  case "agent_os_get_context":
385
426
  return { slug, method: "GET", path: "/stats" };
@@ -655,6 +696,51 @@ function directRequestForTool(toolName2, params, resolvedSlug) {
655
696
  path: `/plans/${encodeURIComponent(planId)}/links`
656
697
  };
657
698
  }
699
+ case "agent_os_command_center_get":
700
+ return {
701
+ route: "by-id",
702
+ agentOsId: stringParam(params.agentOsId),
703
+ slug,
704
+ method: "GET",
705
+ path: `/command-center${queryString(params, ["since", "limit", "harnessLimit"])}`
706
+ };
707
+ case "agent_os_task_next_action": {
708
+ const taskId = requiredString(params.taskId, "taskId");
709
+ return {
710
+ slug,
711
+ method: "POST",
712
+ path: `/tasks/${encodeURIComponent(taskId)}/next-action`,
713
+ body: stripKeys(params, ["slug", "taskId"])
714
+ };
715
+ }
716
+ case "agent_os_plan_progress_rows_list": {
717
+ const planId = requiredString(params.planId, "planId");
718
+ return {
719
+ slug,
720
+ method: "GET",
721
+ path: `/plans/${encodeURIComponent(planId)}/progress-rows`
722
+ };
723
+ }
724
+ case "agent_os_plan_progress_rows_upsert": {
725
+ const planId = requiredString(params.planId, "planId");
726
+ return {
727
+ slug,
728
+ method: "POST",
729
+ path: `/plans/${encodeURIComponent(planId)}/progress-rows`,
730
+ body: { rows: params.rows }
731
+ };
732
+ }
733
+ case "agent_os_plan_progress_event_append": {
734
+ const planId = requiredString(params.planId, "planId");
735
+ const body = stripKeys(params, ["slug", "planId", "remainingWork"]);
736
+ const remainingWork = stringParam(params.remainingWork);
737
+ return {
738
+ slug,
739
+ method: "POST",
740
+ path: `/plans/${encodeURIComponent(planId)}/progress-events`,
741
+ body: remainingWork === void 0 ? body : { ...body, remaining: remainingWork }
742
+ };
743
+ }
658
744
  default:
659
745
  throw new Error(`Unsupported AgentOS direct tool: ${toolName2}`);
660
746
  }
@@ -806,7 +892,17 @@ function buildAgentOsContinuityGuidanceContext(config) {
806
892
  "",
807
893
  "Local markdown memory (CLAUDE.md, AGENTS.md, /memory, scratch notes) is a fallback and a cache. Use it when AgentOS is unreachable or for in-conversation scratch; do not treat it as authoritative when AgentOS is available.",
808
894
  "Privacy: AgentOS context is personal to the signed-in account. Do not expose AgentOS identity, goals, projects, contacts, or memory excerpts in shared, broadcast, group, or multi-tenant contexts unless the user explicitly asks for it. If you cannot determine the channel scope, withhold AgentOS specifics by default.",
809
- "If an AgentOS call fails or returns unavailable, say so explicitly, fall back to local markdown or conversation memory for that turn, and ask the user before persisting anything that would normally go to AgentOS."
895
+ "If an AgentOS call fails or returns unavailable, say so explicitly, fall back to local markdown or conversation memory for that turn, and ask the user before persisting anything that would normally go to AgentOS.",
896
+ "",
897
+ "Command Center (operational control plane):",
898
+ "- For the same unified rollup the browser Command Center uses (projects, plans, action-required, DQ inbox, harness summaries), call agent_os_command_center_get. Omit slug to resolve the account primary workspace; pass agentOsId when you already have it from a prior identity fetch.",
899
+ "",
900
+ "Plan execution progress (Agentic OS operational flow):",
901
+ "- Workers (`kynver plan progress`, harness/by-id route): emit checkpoints only \u2014 `running`, `partial`, or `blocked` as implementer with evidence and `executorRef`. The harness route rejects `status: done` and confirm events; never propose or confirm row closure from the worker CLI.",
902
+ "- Chat agents / orchestrators (MCP `agent_os_plan_progress_event_append` on the slug route): propose row done (`proposed: true`, `status: done`, evidence) and confirm (`proposed: false`, reviewer lanes). Split implementer vs reviewer across models when possible.",
903
+ "- Discovery that needs the operator, runtime, or another reviewer: create a linked review/decision AgentTask via `agent_os_plan_review_task_create` (or `agent_os_ask_human` for human decisions), link it on the progress row, and mark the row blocked until resolved.",
904
+ "- Respect review ordering: completion-report review before deep implementation review; deep review before follow-up-for-completion closure.",
905
+ "- Runtime verification (`kynver plan verify` or operator Verify plan in Command Center) is required before plan closure \u2014 worker completion alone is not sufficient."
810
906
  ];
811
907
  return lines.join("\n");
812
908
  }
@@ -2340,8 +2436,8 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
2340
2436
  var require2 = createRequire(import.meta.url);
2341
2437
  function resolveRuntimeCli() {
2342
2438
  try {
2343
- const pkgJson = require2.resolve("@kynver-app/runtime/package.json");
2344
- const cli = path2.join(path2.dirname(pkgJson), "dist", "cli.js");
2439
+ const entry = require2.resolve("@kynver-app/runtime");
2440
+ const cli = path2.join(path2.dirname(entry), "cli.js");
2345
2441
  if (existsSync2(cli)) return cli;
2346
2442
  } catch {
2347
2443
  }
@@ -2430,6 +2526,186 @@ function createHarnessTools(config) {
2430
2526
  }));
2431
2527
  }
2432
2528
 
2529
+ // src/schemas/command-center.ts
2530
+ var slugField = {
2531
+ type: "string",
2532
+ description: "AgentOS workspace slug. Omit to use the account's primary AgentOS workspace."
2533
+ };
2534
+ var commandCenterGetSchema = {
2535
+ type: "object",
2536
+ properties: {
2537
+ slug: slugField,
2538
+ agentOsId: {
2539
+ type: "string",
2540
+ description: "Optional AgentOS row id. When omitted, resolved from slug via GET /api/agent-os/{slug}."
2541
+ },
2542
+ since: {
2543
+ type: "string",
2544
+ description: "ISO timestamp \u2014 only include tasks updated after this instant."
2545
+ },
2546
+ limit: {
2547
+ type: "number",
2548
+ description: "Max tasks to load (server cap 10000, default operator console uses 10000)."
2549
+ },
2550
+ harnessLimit: {
2551
+ type: "number",
2552
+ description: "Max harness runs in the rollup (server cap 200)."
2553
+ }
2554
+ },
2555
+ additionalProperties: false,
2556
+ $schema: "http://json-schema.org/draft-07/schema#"
2557
+ };
2558
+ var taskNextActionSchema = {
2559
+ type: "object",
2560
+ properties: {
2561
+ taskId: { type: "string", description: "Subject AgentTask id." },
2562
+ lane: {
2563
+ type: "string",
2564
+ enum: ["worker", "reviewer", "landing"],
2565
+ description: "Which harness lane just finished and is handing control to the router."
2566
+ },
2567
+ verdict: {
2568
+ type: "string",
2569
+ enum: ["pass", "changes_requested", "needs_input", "blocked", "in_progress"]
2570
+ },
2571
+ landingSucceeded: { type: "boolean" },
2572
+ blockerText: { type: "string" },
2573
+ sourceId: { type: "string" },
2574
+ runId: { type: "string", description: "Required when lane is worker." },
2575
+ workerName: { type: "string", description: "Required when lane is worker." },
2576
+ startedAt: { type: "string" },
2577
+ finishedAt: { type: "string" },
2578
+ lastActivityAt: { type: "string" },
2579
+ payload: { type: "object", additionalProperties: true },
2580
+ slug: slugField
2581
+ },
2582
+ required: ["taskId", "lane"],
2583
+ additionalProperties: false,
2584
+ $schema: "http://json-schema.org/draft-07/schema#"
2585
+ };
2586
+ var progressStatus = {
2587
+ type: "string",
2588
+ enum: ["todo", "running", "partial", "blocked", "done"]
2589
+ };
2590
+ var roleLane = {
2591
+ type: "string",
2592
+ enum: [
2593
+ "plan_author",
2594
+ "plan_reviewer",
2595
+ "implementer",
2596
+ "report_reviewer",
2597
+ "deep_reviewer",
2598
+ "repair_implementer",
2599
+ "runtime_verifier",
2600
+ "user",
2601
+ "system"
2602
+ ]
2603
+ };
2604
+ var progressRow = {
2605
+ type: "object",
2606
+ properties: {
2607
+ rowKey: { type: "string" },
2608
+ title: { type: "string" },
2609
+ description: { type: "string" },
2610
+ ordinal: { type: "number" },
2611
+ stageId: { type: "string" },
2612
+ ownerLane: roleLane,
2613
+ taskId: { type: "string" }
2614
+ },
2615
+ required: ["rowKey", "title", "ordinal"],
2616
+ additionalProperties: false
2617
+ };
2618
+ var planProgressRowsListSchema = {
2619
+ type: "object",
2620
+ properties: {
2621
+ planId: { type: "string" },
2622
+ slug: slugField
2623
+ },
2624
+ required: ["planId"],
2625
+ additionalProperties: false,
2626
+ $schema: "http://json-schema.org/draft-07/schema#"
2627
+ };
2628
+ var planProgressRowsUpsertSchema = {
2629
+ type: "object",
2630
+ properties: {
2631
+ planId: { type: "string" },
2632
+ rows: { type: "array", items: progressRow },
2633
+ slug: slugField
2634
+ },
2635
+ required: ["planId", "rows"],
2636
+ additionalProperties: false,
2637
+ $schema: "http://json-schema.org/draft-07/schema#"
2638
+ };
2639
+ var planProgressEventAppendSchema = {
2640
+ type: "object",
2641
+ properties: {
2642
+ planId: { type: "string" },
2643
+ rowKey: { type: "string" },
2644
+ rowId: { type: "string" },
2645
+ taskId: { type: "string" },
2646
+ reviewTaskId: { type: "string" },
2647
+ roleLane,
2648
+ status: progressStatus,
2649
+ note: { type: "string" },
2650
+ remainingWork: { type: "string" },
2651
+ evidence: { type: "array", items: { type: "object", additionalProperties: true } },
2652
+ proposed: { type: "boolean" },
2653
+ executorRef: { type: "string" },
2654
+ slug: slugField
2655
+ },
2656
+ required: ["planId", "roleLane", "status"],
2657
+ additionalProperties: false,
2658
+ $schema: "http://json-schema.org/draft-07/schema#"
2659
+ };
2660
+
2661
+ // src/tools/command-center.ts
2662
+ function createCommandCenterTools(config) {
2663
+ const mk = (name, description, parameters) => ({
2664
+ name,
2665
+ label: name,
2666
+ description,
2667
+ parameters,
2668
+ execute: (_toolCallId, params) => callAgentOsTool({
2669
+ serverName: config.agentOsServer,
2670
+ toolName: name,
2671
+ params,
2672
+ timeoutMs: config.timeoutMs,
2673
+ mcporterConfigPath: config.mcporterConfigPath,
2674
+ kynverApiUrl: config.kynverApiUrl,
2675
+ kynverApiKey: config.kynverApiKey,
2676
+ agentOsSlug: config.agentOsSlug,
2677
+ enableDirectHttp: config.enableDirectHttp
2678
+ })
2679
+ });
2680
+ return [
2681
+ mk(
2682
+ "agent_os_command_center_get",
2683
+ "Fetch the unified Command Center rollup for the AgentOS workspace: plan rollups, project hierarchy, action-required items, DQ inbox, goals, review lanes, and harness summaries \u2014 the same aggregate the browser Command Center uses.",
2684
+ commandCenterGetSchema
2685
+ ),
2686
+ mk(
2687
+ "agent_os_task_next_action",
2688
+ "Route the deterministic next harness action after a worker, reviewer, or landing lane completes (dispatch review/fix/landing, close, or await human). Same POST surface as the production harness completion hook.",
2689
+ taskNextActionSchema
2690
+ ),
2691
+ mk(
2692
+ "agent_os_plan_progress_rows_list",
2693
+ "List structured plan progress rows (canonical checklist state) for one plan.",
2694
+ planProgressRowsListSchema
2695
+ ),
2696
+ mk(
2697
+ "agent_os_plan_progress_rows_upsert",
2698
+ "Seed or update structured plan progress rows for one plan.",
2699
+ planProgressRowsUpsertSchema
2700
+ ),
2701
+ mk(
2702
+ "agent_os_plan_progress_event_append",
2703
+ "Append a role-lane progress event and apply allowed row transition rules for one plan.",
2704
+ planProgressEventAppendSchema
2705
+ )
2706
+ ];
2707
+ }
2708
+
2433
2709
  // src/tools/index.ts
2434
2710
  function createAllTools(config) {
2435
2711
  return [
@@ -2443,6 +2719,7 @@ function createAllTools(config) {
2443
2719
  ...createContactTools(config),
2444
2720
  ...createTaskTools(config),
2445
2721
  ...createPlanTools(config),
2722
+ ...createCommandCenterTools(config),
2446
2723
  ...createHarnessTools(config)
2447
2724
  ];
2448
2725
  }