@kynver-app/openclaw-agent-os 0.1.14 → 0.1.16

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
@@ -7,7 +7,7 @@ identity, goals, projects, contacts, sessions, daily logs, and long-term memory.
7
7
 
8
8
  ## What It Provides
9
9
 
10
- - 25 explicit `agent_os_*` tools in the OpenClaw tool namespace.
10
+ - Explicit `agent_os_*` tools in the OpenClaw tool namespace covering identity, goals, projects, contacts, sessions, memory, skills, the durable task board, and first-class plans with version history.
11
11
  - Direct Kynver HTTP transport for low-latency calls, with primary-slug auto-resolution via `GET /api/agent-os` so installs work without hardcoding a persona.
12
12
  - `mcporter` fallback for compatibility with existing MCP setups.
13
13
  - Optional OpenClaw session lifecycle hooks that automatically open/close AgentOS sessions.
@@ -136,6 +136,27 @@ native Codex dynamic-tool bridge issue.
136
136
  - `agent_os_get_contacts`
137
137
  - `agent_os_create_contact`
138
138
  - `agent_os_update_contact`
139
+ - `agent_os_plan_create`
140
+ - `agent_os_plan_list`
141
+ - `agent_os_plan_get`
142
+ - `agent_os_plan_update`
143
+ - `agent_os_plan_add_version`
144
+ - `agent_os_plan_mark_current`
145
+ - `agent_os_plan_add_link`
146
+ - `agent_os_plan_list_links`
147
+ - `agent_os_plan_list_versions`
148
+
149
+ Plan tools manage first-class AgentOS plans — versioned operational artifacts
150
+ distinct from goals/projects/tasks. Each `AgentPlan` owns a chain of immutable
151
+ `AgentPlanVersion` snapshots (one stamped current at a time) and typed
152
+ `AgentPlanLink` rows pointing at goals, projects, tasks, memories, sessions,
153
+ plans, or remote refs (repo/branch/commit/PR/URL/markdown). The plan body is
154
+ immutable — to record a new snapshot call `agent_os_plan_add_version`, which
155
+ appends a version and (by default) advances `currentVersionId` atomically. To
156
+ attach a plan to its own stable slug within the workspace, pass `planSlug`
157
+ (the workspace `slug` argument is reserved for the AgentOS slug). All
158
+ workspace-owned link targets are validated against the same AgentOS workspace
159
+ server-side; remote refs carry metadata only and are not resolved.
139
160
 
140
161
  `agent_os_write_memory` and `agent_os_update_memory` are the OpenClaw
141
162
  memory-writer surface. They accept `sourceRefs` plus `memoryType`, `confidence`,
package/dist/index.js CHANGED
@@ -372,6 +372,12 @@ function directRequestForTool(toolName, params, resolvedSlug) {
372
372
  switch (toolName) {
373
373
  case "agent_os_get_context":
374
374
  return { slug, method: "GET", path: "/stats" };
375
+ case "agent_os_context_envelope":
376
+ return {
377
+ slug,
378
+ method: "GET",
379
+ path: "/context-envelope" + queryString(params, ["anchorType", "anchorId", "memoryQuery", "memoryLimit", "sessionLimit"])
380
+ };
375
381
  case "agent_os_open_session":
376
382
  return { slug, method: "POST", path: "/sessions", body: withoutSlug };
377
383
  case "agent_os_close_session": {
@@ -570,10 +576,83 @@ function directRequestForTool(toolName, params, resolvedSlug) {
570
576
  const taskId = requiredString(params.taskId, "taskId");
571
577
  return { slug, method: "POST", path: `/tasks/${encodeURIComponent(taskId)}/renew-lease`, body: stripKeys(params, ["slug", "taskId"]) };
572
578
  }
579
+ case "agent_os_plan_create": {
580
+ const body = renamePlanSlug(stripKeys(params, ["slug"]));
581
+ return { slug, method: "POST", path: "/plans", body };
582
+ }
583
+ case "agent_os_plan_list":
584
+ return {
585
+ slug,
586
+ method: "GET",
587
+ path: `/plans${queryString(params, ["status", "projectId", "goalId", "canonicalKey", "limit"])}`
588
+ };
589
+ case "agent_os_plan_get": {
590
+ const planId = requiredString(params.planId, "planId");
591
+ return { slug, method: "GET", path: `/plans/${encodeURIComponent(planId)}` };
592
+ }
593
+ case "agent_os_plan_update": {
594
+ const planId = requiredString(params.planId, "planId");
595
+ const body = renamePlanSlug(stripKeys(params, ["slug", "planId"]));
596
+ return {
597
+ slug,
598
+ method: "PATCH",
599
+ path: `/plans/${encodeURIComponent(planId)}`,
600
+ body
601
+ };
602
+ }
603
+ case "agent_os_plan_add_version": {
604
+ const planId = requiredString(params.planId, "planId");
605
+ return {
606
+ slug,
607
+ method: "POST",
608
+ path: `/plans/${encodeURIComponent(planId)}/versions`,
609
+ body: stripKeys(params, ["slug", "planId"])
610
+ };
611
+ }
612
+ case "agent_os_plan_mark_current": {
613
+ const planId = requiredString(params.planId, "planId");
614
+ const versionId = requiredString(params.versionId, "versionId");
615
+ return {
616
+ slug,
617
+ method: "POST",
618
+ path: `/plans/${encodeURIComponent(planId)}/versions`,
619
+ body: { action: "mark_current", versionId }
620
+ };
621
+ }
622
+ case "agent_os_plan_list_versions": {
623
+ const planId = requiredString(params.planId, "planId");
624
+ return {
625
+ slug,
626
+ method: "GET",
627
+ path: `/plans/${encodeURIComponent(planId)}/versions`
628
+ };
629
+ }
630
+ case "agent_os_plan_add_link": {
631
+ const planId = requiredString(params.planId, "planId");
632
+ return {
633
+ slug,
634
+ method: "POST",
635
+ path: `/plans/${encodeURIComponent(planId)}/links`,
636
+ body: stripKeys(params, ["slug", "planId"])
637
+ };
638
+ }
639
+ case "agent_os_plan_list_links": {
640
+ const planId = requiredString(params.planId, "planId");
641
+ return {
642
+ slug,
643
+ method: "GET",
644
+ path: `/plans/${encodeURIComponent(planId)}/links`
645
+ };
646
+ }
573
647
  default:
574
648
  throw new Error(`Unsupported AgentOS direct tool: ${toolName}`);
575
649
  }
576
650
  }
651
+ function renamePlanSlug(body) {
652
+ if (!("planSlug" in body)) return body;
653
+ const { planSlug, ...rest } = body;
654
+ return planSlug === void 0 ? rest : { ...rest, slug: planSlug };
655
+ }
577
656
  function requiredString(value, name) {
578
657
  const stringValue2 = stringParam(value);
579
658
  if (!stringValue2) throw new Error(`${name} is required`);
@@ -867,10 +946,10 @@ function formatRuntimeSkillManifestContext(cached, maxSkills) {
867
946
  for (const skill of skills) {
868
947
  const description = skill.description ? " - " + singleLine(skill.description) : "";
869
948
  const trigger = skill.triggerRules ? " Trigger: " + singleLine(skill.triggerRules) : "";
870
- const category = skill.category ? " category=" + skill.category : "";
949
+ const category = skill.category ? " category=" + singleLine(skill.category) : "";
871
950
  const priority = typeof skill.priority === "number" ? " priority=" + skill.priority : "";
872
951
  const autoInvoke = skill.autoInvoke === true ? " autoInvoke=requested-by-binding" : "";
873
- lines.push("- " + skill.slug + " (" + skill.source + ") " + skill.name + description + "." + category + priority + autoInvoke + trigger);
952
+ lines.push("- " + singleLine(skill.slug) + " (" + skill.source + ") " + singleLine(skill.name) + description + "." + category + priority + autoInvoke + trigger);
874
953
  }
875
954
  if (manifest.skills.length > skills.length) {
876
955
  lines.push("- " + (manifest.skills.length - skills.length) + " additional enabled skills omitted by runtimeSkillManifestMaxSkills.");
@@ -978,6 +1057,39 @@ var getContextSchema = {
978
1057
  additionalProperties: false,
979
1058
  $schema: "http://json-schema.org/draft-07/schema#"
980
1059
  };
1060
+ var contextEnvelopeSchema = {
1061
+ type: "object",
1062
+ required: ["anchorType", "anchorId"],
1063
+ properties: {
1064
+ anchorType: {
1065
+ type: "string",
1066
+ enum: ["plan", "task", "goal", "project", "session"],
1067
+ description: "Kind of anchor to load context around."
1068
+ },
1069
+ anchorId: {
1070
+ type: "string",
1071
+ description: "Id of the anchor row within this workspace."
1072
+ },
1073
+ memoryQuery: {
1074
+ type: "string",
1075
+ description: "Override the memory search query. Defaults to a query derived from the anchor's title/summary."
1076
+ },
1077
+ memoryLimit: {
1078
+ type: "number",
1079
+ description: "Max memory hits (default 5, max 20). Set 0 to skip memory recall."
1080
+ },
1081
+ sessionLimit: {
1082
+ type: "number",
1083
+ description: "Max recent sessions (default 1, max 5). Set 0 to skip."
1084
+ },
1085
+ slug: {
1086
+ type: "string",
1087
+ description: "AgentOS slug. Omit to use the account's primary AgentOS workspace."
1088
+ }
1089
+ },
1090
+ additionalProperties: false,
1091
+ $schema: "http://json-schema.org/draft-07/schema#"
1092
+ };
981
1093
 
982
1094
  // src/tools/context.ts
983
1095
  function createContextTools(config) {
@@ -998,6 +1110,23 @@ function createContextTools(config) {
998
1110
  agentOsSlug: config.agentOsSlug,
999
1111
  enableDirectHttp: config.enableDirectHttp
1000
1112
  })
1113
+ },
1114
+ {
1115
+ name: "agent_os_context_envelope",
1116
+ label: "AgentOS Context Envelope",
1117
+ description: "Compact context envelope for one anchor (plan | task | goal | project | session): the resolved anchor, its goal + current plan version + most-relevant task + recent session + top related memories, with deduplicated source refs. Use instead of reading giant docs.",
1118
+ parameters: contextEnvelopeSchema,
1119
+ execute: (_toolCallId, params) => callAgentOsTool({
1120
+ serverName: config.agentOsServer,
1121
+ toolName: "agent_os_context_envelope",
1122
+ params,
1123
+ timeoutMs: config.timeoutMs,
1124
+ mcporterConfigPath: config.mcporterConfigPath,
1125
+ kynverApiUrl: config.kynverApiUrl,
1126
+ kynverApiKey: config.kynverApiKey,
1127
+ agentOsSlug: config.agentOsSlug,
1128
+ enableDirectHttp: config.enableDirectHttp
1129
+ })
1001
1130
  }
1002
1131
  ];
1003
1132
  }
@@ -1345,6 +1474,286 @@ function createMemoryTools(config) {
1345
1474
  ];
1346
1475
  }
1347
1476
 
1477
+ // src/schemas/plans.ts
1478
+ var planStatusValues = [
1479
+ "draft",
1480
+ "active",
1481
+ "blocked",
1482
+ "complete",
1483
+ "archived",
1484
+ "superseded"
1485
+ ];
1486
+ var planPriorityValues = ["low", "normal", "high", "critical"];
1487
+ var planLinkTargetValues = [
1488
+ "goal",
1489
+ "project",
1490
+ "task",
1491
+ "memory",
1492
+ "session",
1493
+ "repo",
1494
+ "branch",
1495
+ "commit",
1496
+ "pr",
1497
+ "url",
1498
+ "markdown",
1499
+ "plan"
1500
+ ];
1501
+ var planStatus = { type: "string", enum: planStatusValues };
1502
+ var planPriority = { type: "string", enum: planPriorityValues };
1503
+ var planLinkTarget = { type: "string", enum: planLinkTargetValues };
1504
+ var initialVersion = {
1505
+ type: "object",
1506
+ properties: {
1507
+ title: { type: "string" },
1508
+ body: { type: "string", description: "Full plan body (markdown)." },
1509
+ summary: { type: "string" },
1510
+ changeSummary: { type: "string" },
1511
+ author: { type: "string" },
1512
+ sourceRefs: {},
1513
+ metadata: looseObject
1514
+ },
1515
+ required: ["body"],
1516
+ additionalProperties: false
1517
+ };
1518
+ var planCreateSchema = {
1519
+ type: "object",
1520
+ properties: {
1521
+ title: { type: "string", description: "Human-readable plan title." },
1522
+ summary: { type: "string" },
1523
+ planSlug: {
1524
+ type: "string",
1525
+ description: "Optional stable slug for the plan within the AgentOS workspace."
1526
+ },
1527
+ status: planStatus,
1528
+ priority: planPriority,
1529
+ owner: { type: "string" },
1530
+ projectId: {
1531
+ type: "string",
1532
+ description: "AgentOS project id this plan belongs to."
1533
+ },
1534
+ goalId: {
1535
+ type: "string",
1536
+ description: "AgentOS goal id this plan supports."
1537
+ },
1538
+ canonicalKey: {
1539
+ type: "string",
1540
+ description: "Optional canonical key for deduping plans that describe the same artifact."
1541
+ },
1542
+ metadata: looseObject,
1543
+ sourceRefs: {},
1544
+ initialVersion: {
1545
+ ...initialVersion,
1546
+ description: "First version snapshot (required). Becomes the plan's current version."
1547
+ },
1548
+ slug: {
1549
+ type: "string",
1550
+ description: "AgentOS workspace slug. Omit to use the primary workspace."
1551
+ }
1552
+ },
1553
+ required: ["title", "initialVersion"],
1554
+ additionalProperties: false,
1555
+ $schema: "http://json-schema.org/draft-07/schema#"
1556
+ };
1557
+ var planListSchema = {
1558
+ type: "object",
1559
+ properties: {
1560
+ status: planStatus,
1561
+ projectId: { type: "string" },
1562
+ goalId: { type: "string" },
1563
+ canonicalKey: { type: "string" },
1564
+ limit: { type: "number", description: "Max rows (default 50, max 200)." },
1565
+ slug: { type: "string" }
1566
+ },
1567
+ additionalProperties: false,
1568
+ $schema: "http://json-schema.org/draft-07/schema#"
1569
+ };
1570
+ var planGetSchema = {
1571
+ type: "object",
1572
+ properties: {
1573
+ planId: { type: "string" },
1574
+ slug: { type: "string" }
1575
+ },
1576
+ required: ["planId"],
1577
+ additionalProperties: false,
1578
+ $schema: "http://json-schema.org/draft-07/schema#"
1579
+ };
1580
+ var planUpdateSchema = {
1581
+ type: "object",
1582
+ properties: {
1583
+ planId: { type: "string" },
1584
+ title: { type: "string" },
1585
+ summary: { type: "string" },
1586
+ planSlug: {
1587
+ type: "string",
1588
+ description: "Optional stable slug for the plan within the AgentOS workspace."
1589
+ },
1590
+ status: planStatus,
1591
+ priority: planPriority,
1592
+ owner: { type: "string" },
1593
+ projectId: { type: "string" },
1594
+ goalId: { type: "string" },
1595
+ canonicalKey: { type: "string" },
1596
+ metadata: looseObject,
1597
+ sourceRefs: {},
1598
+ slug: { type: "string" }
1599
+ },
1600
+ required: ["planId"],
1601
+ additionalProperties: false,
1602
+ $schema: "http://json-schema.org/draft-07/schema#"
1603
+ };
1604
+ var planAddVersionSchema = {
1605
+ type: "object",
1606
+ properties: {
1607
+ planId: { type: "string" },
1608
+ title: { type: "string" },
1609
+ body: { type: "string", description: "Full new version body (markdown)." },
1610
+ summary: { type: "string" },
1611
+ changeSummary: { type: "string" },
1612
+ author: { type: "string" },
1613
+ sourceRefs: {},
1614
+ metadata: looseObject,
1615
+ markCurrent: {
1616
+ type: "boolean",
1617
+ description: "When true (default), the new version becomes the plan's current version."
1618
+ },
1619
+ slug: { type: "string" }
1620
+ },
1621
+ required: ["planId", "body"],
1622
+ additionalProperties: false,
1623
+ $schema: "http://json-schema.org/draft-07/schema#"
1624
+ };
1625
+ var planMarkCurrentSchema = {
1626
+ type: "object",
1627
+ properties: {
1628
+ planId: { type: "string" },
1629
+ versionId: {
1630
+ type: "string",
1631
+ description: "Existing version id to promote to current."
1632
+ },
1633
+ slug: { type: "string" }
1634
+ },
1635
+ required: ["planId", "versionId"],
1636
+ additionalProperties: false,
1637
+ $schema: "http://json-schema.org/draft-07/schema#"
1638
+ };
1639
+ var planAddLinkSchema = {
1640
+ type: "object",
1641
+ properties: {
1642
+ planId: { type: "string" },
1643
+ planVersionId: {
1644
+ type: "string",
1645
+ description: "Optional version id when the link applies to a specific snapshot."
1646
+ },
1647
+ targetType: planLinkTarget,
1648
+ targetId: {
1649
+ type: "string",
1650
+ description: "AgentOS-owned target id (goal/project/task/memory/session/plan). Required for workspace-owned link types."
1651
+ },
1652
+ targetUrl: {
1653
+ type: "string",
1654
+ description: "URL for remote refs (repo/branch/commit/pr/url/markdown). Either targetId or targetUrl is required."
1655
+ },
1656
+ label: { type: "string" },
1657
+ relation: {
1658
+ type: "string",
1659
+ description: "Optional free-form relation label (e.g. 'derived_from', 'supersedes')."
1660
+ },
1661
+ metadata: looseObject,
1662
+ slug: { type: "string" }
1663
+ },
1664
+ required: ["planId", "targetType"],
1665
+ additionalProperties: false,
1666
+ $schema: "http://json-schema.org/draft-07/schema#"
1667
+ };
1668
+ var planListLinksSchema = {
1669
+ type: "object",
1670
+ properties: {
1671
+ planId: { type: "string" },
1672
+ slug: { type: "string" }
1673
+ },
1674
+ required: ["planId"],
1675
+ additionalProperties: false,
1676
+ $schema: "http://json-schema.org/draft-07/schema#"
1677
+ };
1678
+ var planListVersionsSchema = {
1679
+ type: "object",
1680
+ properties: {
1681
+ planId: { type: "string" },
1682
+ slug: { type: "string" }
1683
+ },
1684
+ required: ["planId"],
1685
+ additionalProperties: false,
1686
+ $schema: "http://json-schema.org/draft-07/schema#"
1687
+ };
1688
+
1689
+ // src/tools/plans.ts
1690
+ function createPlanTools(config) {
1691
+ const mk = (name, description, parameters) => ({
1692
+ name,
1693
+ label: name,
1694
+ description,
1695
+ parameters,
1696
+ execute: (_toolCallId, params) => callAgentOsTool({
1697
+ serverName: config.agentOsServer,
1698
+ toolName: name,
1699
+ params,
1700
+ timeoutMs: config.timeoutMs,
1701
+ mcporterConfigPath: config.mcporterConfigPath,
1702
+ kynverApiUrl: config.kynverApiUrl,
1703
+ kynverApiKey: config.kynverApiKey,
1704
+ agentOsSlug: config.agentOsSlug,
1705
+ enableDirectHttp: config.enableDirectHttp
1706
+ })
1707
+ });
1708
+ return [
1709
+ mk(
1710
+ "agent_os_plan_create",
1711
+ "Create a first-class AgentOS plan with an initial version. Plans are versioned operational artifacts (separate from goals/projects/tasks) \u2014 the initial version body is required and becomes the plan's current version.",
1712
+ planCreateSchema
1713
+ ),
1714
+ mk(
1715
+ "agent_os_plan_list",
1716
+ "List AgentOS plans, optionally filtered by status, projectId, goalId, or canonicalKey.",
1717
+ planListSchema
1718
+ ),
1719
+ mk(
1720
+ "agent_os_plan_get",
1721
+ "Fetch one AgentOS plan with its full version history, current version pointer, and typed links.",
1722
+ planGetSchema
1723
+ ),
1724
+ mk(
1725
+ "agent_os_plan_update",
1726
+ "Patch an AgentOS plan's metadata (title, summary, status, priority, owner, project/goal links, canonicalKey). The plan body itself is immutable \u2014 use agent_os_plan_add_version to record a new snapshot.",
1727
+ planUpdateSchema
1728
+ ),
1729
+ mk(
1730
+ "agent_os_plan_add_version",
1731
+ "Append an immutable version snapshot to a plan. The new version's versionNumber is one greater than the latest, and (when markCurrent is true, the default) the plan's currentVersionId pointer advances atomically.",
1732
+ planAddVersionSchema
1733
+ ),
1734
+ mk(
1735
+ "agent_os_plan_mark_current",
1736
+ "Promote an existing version of a plan to be the current version. The version must already belong to the plan.",
1737
+ planMarkCurrentSchema
1738
+ ),
1739
+ mk(
1740
+ "agent_os_plan_add_link",
1741
+ "Add a typed link from a plan (and optionally a specific version) to a related goal, project, task, memory, session, repo, branch, commit, PR, URL, markdown file, or other plan. Workspace-owned targets are validated against the same AgentOS workspace server-side; remote refs (url/repo/branch/commit/pr/markdown) carry metadata only.",
1742
+ planAddLinkSchema
1743
+ ),
1744
+ mk(
1745
+ "agent_os_plan_list_links",
1746
+ "List the typed links attached to a plan.",
1747
+ planListLinksSchema
1748
+ ),
1749
+ mk(
1750
+ "agent_os_plan_list_versions",
1751
+ "List the version history of a plan in ascending order by versionNumber. agent_os_plan_get already returns versions; use this when you only need the version list.",
1752
+ planListVersionsSchema
1753
+ )
1754
+ ];
1755
+ }
1756
+
1348
1757
  // src/schemas/projects.ts
1349
1758
  var getProjectsSchema = {
1350
1759
  type: "object",
@@ -1922,7 +2331,8 @@ function createAllTools(config) {
1922
2331
  ...createMemoryTools(config),
1923
2332
  ...createSkillTools(config),
1924
2333
  ...createContactTools(config),
1925
- ...createTaskTools(config)
2334
+ ...createTaskTools(config),
2335
+ ...createPlanTools(config)
1926
2336
  ];
1927
2337
  }
1928
2338