@kynver-app/openclaw-agent-os 0.1.38 → 0.1.40

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
@@ -95,7 +95,7 @@ var pluginConfigSchema = {
95
95
  enableTelegramToolErrorFilter: {
96
96
  type: "boolean",
97
97
  default: true,
98
- description: "When true, suppress raw failed exec/tool/worktree lines on Telegram and webchat direct chat (OpenClaw message_sending hook)."
98
+ description: "When true, suppress raw exec/tool progress and failure lines on Telegram and webchat direct chat (OpenClaw message_sending hook)."
99
99
  }
100
100
  }
101
101
  };
@@ -450,7 +450,14 @@ function directRequestForTool(toolName2, params, resolvedSlug) {
450
450
  const withoutSlug = stripKeys(params, ["slug", "agentOsId"]);
451
451
  switch (toolName2) {
452
452
  case "agent_os_get_context":
453
- return { slug, method: "GET", path: "/stats" };
453
+ return {
454
+ slug,
455
+ method: "GET",
456
+ path: "/stats" + queryStringFromEntries({
457
+ projection: stringParam(params.projection) || "brief",
458
+ agentContext: stringParam(params.agentContext)
459
+ })
460
+ };
454
461
  case "agent_os_context_envelope":
455
462
  return {
456
463
  slug,
@@ -733,22 +740,30 @@ function directRequestForTool(toolName2, params, resolvedSlug) {
733
740
  path: `/plans/${encodeURIComponent(planId)}/links`
734
741
  };
735
742
  }
736
- case "agent_os_command_center_get":
743
+ case "agent_os_command_center_get": {
744
+ const qs = queryString(params, ["since", "limit", "harnessLimit"]);
745
+ const projection = typeof params.projection === "string" && params.projection.trim() ? params.projection.trim() : "compact";
746
+ const suffix = qs ? `${qs}&projection=${encodeURIComponent(projection)}` : `?projection=${encodeURIComponent(projection)}`;
737
747
  return {
738
748
  route: "by-id",
739
749
  agentOsId: stringParam(params.agentOsId),
740
750
  slug,
741
751
  method: "GET",
742
- path: `/command-center${queryString(params, ["since", "limit", "harnessLimit"])}`
752
+ path: `/command-center${suffix}`
743
753
  };
744
- case "agent_os_command_center_dashboard_contract_get":
754
+ }
755
+ case "agent_os_command_center_dashboard_contract_get": {
756
+ const qs = queryString(params, ["since", "limit"]);
757
+ const projection = typeof params.projection === "string" && params.projection.trim() ? params.projection.trim() : "mcp";
758
+ const suffix = qs ? `${qs}&projection=${encodeURIComponent(projection)}` : `?projection=${encodeURIComponent(projection)}`;
745
759
  return {
746
760
  route: "by-id",
747
761
  agentOsId: stringParam(params.agentOsId),
748
762
  slug,
749
763
  method: "GET",
750
- path: `/command-center/dashboard-contract${queryString(params, ["since", "limit"])}`
764
+ path: `/command-center/dashboard-contract${suffix}`
751
765
  };
766
+ }
752
767
  case "agent_os_task_next_action": {
753
768
  const taskId = requiredString(params.taskId, "taskId");
754
769
  return {
@@ -940,11 +955,13 @@ function buildAgentOsContinuityGuidanceContext(config) {
940
955
  "Treat it as the primary source of continuity across sessions, not local markdown files.",
941
956
  "AgentOS workspace: " + slugHint + ".",
942
957
  "",
943
- "On session start or whenever you need user identity, goals, projects, contacts, recent sessions, or memory stats, call agent_os_get_context before answering. Prefer omitting the slug so the account's primary AgentOS workspace resolves automatically.",
958
+ "On session start or whenever you need user identity, goals, projects, contacts, recent sessions, or memory stats, call agent_os_get_context with the default brief projection before answering. The brief is the compact identity/Soul-equivalent map plus current-work pointers and follow-up hints. Prefer omitting the slug so the account's primary AgentOS workspace resolves automatically. Use projection=full only for explicit admin/debug work because it can be large and truncation-prone.",
959
+ "When multiple personal/runtime personas share one AgentOS workspace, keep workspace slug and active identity separate: `slug` selects the workspace, while `agentContext` selects the active persona/runtime inside it (for example `primary-agent`, `specialist-agent`, or `runtime-specialist`). Use `agentContext` when the runtime provides one; do not pass a persona/call-sign as the AgentOS workspace slug.",
960
+ "When you know the relevant task, plan, goal, project, or session id, prefer agent_os_context_envelope anchored on that id for deeper context. The envelope is the focused follow-up path: it returns the anchor, related goal/plan/task/session context, persona block when applicable, related memories, and source refs.",
944
961
  "For recall of prior work, people, preferences, decisions, or follow-ups, call agent_os_search_memory before relying on conversational memory or local files. Use a short natural-language query.",
945
962
  "agent_os_search_memory returns hits in three authority-ordered lanes: Lane A operating rules & preferences, Lane B active project state (PR/branch/deployment current truth), then Lane C historical context. Each hit carries a `lane` field. When lanes conflict, prefer a Lane A/B hit over a higher-scored Lane C hit \u2014 semantic similarity is not authority.",
946
963
  "Before you answer with any mutable fact \u2014 PR ownership/state/checks, branch freshness, deployment status \u2014 consult the matching Lane B active-state hit. If its `verificationState` is `unverified` or `stale_verification`, or it carries a `laneWarning`, you MUST first re-run the live check (GitHub API/CLI, git, deploy metadata) and answer from that, or else explicitly tell the user the state is unverified/stale and needs a re-check. Never present an unverified or stale active-state fact as current truth, and never let a topically similar historical memory stand in for live state.",
947
- "Worker personas (lane experts). Some tasks are attributed to a worker persona \u2014 e.g. Dalton (implementation / landing scoped code changes with verification evidence), Lorentz (deep review, risk analysis, validation gates). When you are running a persona-attributed task, call agent_os_context_envelope anchored on your current task (or agent_os_get_context) and read the `persona` block: it carries your lane-expert identity (`slug`, `displayName`, `description`) and your persona-scoped operating rules. Treat persona operating rules as Lane A authority scoped to your lane \u2014 they are strictly additive and refine HOW you work, but they NEVER override global Lane A operating rules or Lane B active project state. If a persona rule conflicts with a global rule or with a live active-state fact, the global rule / live fact wins. When you persist a durable rule that applies only to your lane, set `personaSlug`; leave it unset for rules every worker should follow. Persona scope only ADDS rules, it never hides global rules or active project state.",
964
+ "Worker personas (lane experts). Some tasks are attributed to a worker persona \u2014 e.g. Dalton (implementation / landing scoped code changes with verification evidence), Lorentz (deep review, risk analysis, validation gates). When you are running a persona-attributed task, call agent_os_context_envelope anchored on your current task and read the `persona` block: it carries your lane-expert identity (`slug`, `displayName`, `description`) and your persona-scoped operating rules. If you do not know the task id yet, use agent_os_get_context brief or Command Center to find the anchor, then call the envelope. Treat persona operating rules as Lane A authority scoped to your lane \u2014 they are strictly additive and refine HOW you work, but they NEVER override global Lane A operating rules or Lane B active project state. If a persona rule conflicts with a global rule or with a live active-state fact, the global rule / live fact wins. When you persist a durable rule that applies only to your lane, set `personaSlug`; leave it unset for rules every worker should follow. Persona scope only ADDS rules, it never hides global rules or active project state.",
948
965
  "When you learn a durable fact, decision, preference, project update, or lesson, persist it: agent_os_write_memory for new entries, agent_os_update_memory for revisions. Include sourceRefs plus memoryType/confidence/reviewStatus when you can; use reviewStatus=needs_review for uncertain or user-correctable memories.",
949
966
  "For project/goal status changes, use agent_os_update_project / agent_os_update_goal so the structured record stays in sync with what you write to memory.",
950
967
  "Use agent_os_open_session at the start of a substantive session and agent_os_log_session_event for meaningful topics, decisions, files, commits, and follow-ups. Close with agent_os_close_session (or agent_os_log_session for ad-hoc daily-log entries).",
@@ -988,7 +1005,9 @@ function buildAgentOsContinuityGuidanceContext(config) {
988
1005
  "- For chat-visible PR check polling, prefer `node scripts/agent-os-pr-checks-soft.mjs <pr-number-or-url> --repo <owner/repo>` over raw `gh pr checks`. Raw `gh pr checks` exits nonzero for pending checks and creates false failed-tool alerts in Telegram; the soft wrapper exits nonzero only for real failed checks unless `--fail-on-pending` is explicitly requested.",
989
1006
  "- For repo text search, do not pass a single filename (e.g. `package.json`) as ripgrep's path argument \u2014 that is a file, not a directory. Search from the repo root with a glob (`rg -g package.json <pattern> .`) or use `node scripts/agent-os-repo-search.mjs normalize -- '<command>'` before exec. Searching only `package.json` for `agent-os-land-pr` should use `node scripts/agent-os-land-pr.mjs <pr-url>` directly.",
990
1007
  "- 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.",
991
- "- 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."
1008
+ "- 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.",
1009
+ "- Do not land unmanaged PRs. A PR must carry a hard AgentTask reference in the PR body and the AgentTask must carry `prUrl`; if either side is missing, block it as unmanaged and repair the link before merge.",
1010
+ "- Any PR update sent to Telegram, AgentOS events, or Command Center summaries must include a direct PR link and a plain-English purpose, not just a PR number, task id, branch, or terse title."
992
1011
  ];
993
1012
  return lines.join("\n");
994
1013
  }
@@ -1328,8 +1347,15 @@ function registerTelegramReplyContextHooks({
1328
1347
  var DIRECT_CHAT_CHANNEL_IDS = /* @__PURE__ */ new Set(["telegram", "webchat"]);
1329
1348
  var RAW_TOOL_ERROR_WARNING_RE = /^⚠️\s*🛠️\s*.+\bfailed\b/ui;
1330
1349
  var INTERNAL_TRACE_LINE_RE = /^(?:>\s*)?(?:📊|🛠️|📖|📝|🔍|🔎|⚙️)\s*(?:Session Status|Exec|Read|Edit|Write|Patch|Search|Open|Click|Find|Screenshot|Update Plan|Tool Call|Tool Result|Function Call|Shell|Command)\s*:/i;
1350
+ var INTERNAL_CHANNEL_LINE_RE = /^(?:>\s*)?(?:analysis|commentary|tool[-_ ]?call|tool[-_ ]?result|function[-_ ]?call|thinking|reasoning)\s*[:=]/i;
1331
1351
  var COMPACT_TOOL_COMMAND_LINE_RE = /^(?:>\s*)?🛠️\s*(?:(?:(?:elevated|pty)\b\s*(?:·|,)\s*)+)?(?:`{1,2}\s*\S|(?:run|check|fetch|pull|push|view|show|list|switch|create|merge|rebase|stage|restore|reset|stash|search|find|print|copy|move|remove|install|start|cd|git|worktree|pnpm|npm|yarn|bun|node|python|python3|bash|sh)\b)/i;
1352
+ var BARE_TOOL_STATUS_LINE_RE = /^(?:`{1,2}\s*)?🛠️\s*(?:Exec|Read|Edit|Write|Patch|Search|Open|Click|Find|Screenshot|Update Plan|Shell|Command)(?:\s*\([^)]*\))?\s*`{0,2}$/iu;
1353
+ var PLAIN_TOOL_PROGRESS_LINE_RE = /^print lines \d+(?:-\d+)?(?:\s+from\s+\S.*)?$/i;
1354
+ var CODEX_SEARCH_SCAFFOLD_LINE_RE = /^(?:search\s+)?<{4,}\|={4,}\|/i;
1332
1355
  var TOOL_AGENT_SCOPE_RE = /\(in\s+[~\/]|\(agent\)/i;
1356
+ function normalizeLineForToolFilter(line) {
1357
+ return line.trim().replace(/^`+|`+$/g, "").trim();
1358
+ }
1333
1359
  function isDirectChatChannel(channelId) {
1334
1360
  if (!channelId) return false;
1335
1361
  const normalized = channelId.trim().toLowerCase();
@@ -1338,15 +1364,18 @@ function isDirectChatChannel(channelId) {
1338
1364
  function isRawInternalToolFailureLine(line) {
1339
1365
  const trimmed = line.trim();
1340
1366
  if (!trimmed) return false;
1367
+ const normalized = normalizeLineForToolFilter(trimmed);
1341
1368
  if (RAW_TOOL_ERROR_WARNING_RE.test(trimmed)) return true;
1342
- if (INTERNAL_TRACE_LINE_RE.test(trimmed)) return true;
1343
- if (COMPACT_TOOL_COMMAND_LINE_RE.test(trimmed)) {
1344
- if (/\bfailed\b/i.test(trimmed)) return true;
1345
- if (TOOL_AGENT_SCOPE_RE.test(trimmed)) return true;
1346
- }
1347
- if (/^🛠️\s+/u.test(trimmed) && /\bfailed\b/i.test(trimmed) && TOOL_AGENT_SCOPE_RE.test(trimmed)) {
1369
+ if (INTERNAL_TRACE_LINE_RE.test(trimmed) || INTERNAL_TRACE_LINE_RE.test(normalized)) return true;
1370
+ if (INTERNAL_CHANNEL_LINE_RE.test(trimmed)) return true;
1371
+ if (COMPACT_TOOL_COMMAND_LINE_RE.test(trimmed) || COMPACT_TOOL_COMMAND_LINE_RE.test(normalized)) {
1348
1372
  return true;
1349
1373
  }
1374
+ if (BARE_TOOL_STATUS_LINE_RE.test(trimmed) || BARE_TOOL_STATUS_LINE_RE.test(normalized)) return true;
1375
+ if (PLAIN_TOOL_PROGRESS_LINE_RE.test(trimmed)) return true;
1376
+ if (CODEX_SEARCH_SCAFFOLD_LINE_RE.test(trimmed)) return true;
1377
+ if (/^🛠️\s+/u.test(normalized) && /\bfailed\b/i.test(normalized)) return true;
1378
+ if (/^(?:>\s*)?🛠️/u.test(trimmed) && TOOL_AGENT_SCOPE_RE.test(trimmed)) return true;
1350
1379
  return false;
1351
1380
  }
1352
1381
  function filterDirectChatOutboundContent(content) {
@@ -1479,9 +1508,18 @@ function createContactTools(config) {
1479
1508
  var getContextSchema = {
1480
1509
  type: "object",
1481
1510
  properties: {
1511
+ projection: {
1512
+ type: "string",
1513
+ enum: ["brief", "full"],
1514
+ description: "Response shape. Default brief returns compact identity/current-work context with follow-up hints. full returns the legacy broad stats payload and can be large/truncation-prone."
1515
+ },
1482
1516
  slug: {
1483
1517
  type: "string",
1484
1518
  description: "AgentOS slug. Omit to use the account's primary AgentOS workspace."
1519
+ },
1520
+ agentContext: {
1521
+ type: "string",
1522
+ description: "Active agent/runtime/persona context within the AgentOS workspace, e.g. ghost, forge, or hermes-forge. Keeps shared workspace state available while scoping identity and recent-session current work."
1485
1523
  }
1486
1524
  },
1487
1525
  additionalProperties: false,
@@ -1527,7 +1565,7 @@ function createContextTools(config) {
1527
1565
  {
1528
1566
  name: "agent_os_get_context",
1529
1567
  label: "AgentOS Get Context",
1530
- description: "Get the agent's full AgentOS state in one call: identity, goals, projects, contacts, sessions, and memory stats.",
1568
+ description: "Get compact startup context: identity/Soul-equivalent, key preferences, current-work pointers, memory stats, and follow-up instructions. Default brief stays small; projection=full returns the legacy broad stats payload.",
1531
1569
  parameters: getContextSchema,
1532
1570
  execute: (_toolCallId, params) => callAgentOsTool({
1533
1571
  serverName: config.agentOsServer,
@@ -2980,7 +3018,7 @@ var commandCenterDashboardContractSchema = {
2980
3018
  projection: {
2981
3019
  type: "string",
2982
3020
  enum: ["mcp", "slim"],
2983
- description: "mcp (default) \u2014 agentReadable + resultContract + dashboard fields. slim \u2014 legacy dashboard DTO only."
3021
+ description: "mcp (default) \u2014 tiny brief flight-board (<12k). slim \u2014 full dashboard verification DTO (large)."
2984
3022
  }
2985
3023
  },
2986
3024
  additionalProperties: false,
@@ -3009,7 +3047,7 @@ var commandCenterGetSchema = {
3009
3047
  projection: {
3010
3048
  type: "string",
3011
3049
  enum: ["compact", "full"],
3012
- description: "Response shape. Default compact \u2014 agentReadable summary, countSnapshot, capped previews; omits graph/hierarchy."
3050
+ description: "Response shape. Default compact \u2014 tiny brief flight-board (<12k). full \u2014 expensive admin/debug rollup."
3013
3051
  }
3014
3052
  },
3015
3053
  additionalProperties: false,
@@ -3145,7 +3183,7 @@ function createCommandCenterTools(config) {
3145
3183
  ),
3146
3184
  mk(
3147
3185
  "agent_os_command_center_dashboard_contract_get",
3148
- "Slim dashboard contract for runtime verification: countSnapshot, packageVersionHealth, runtime capacity, activePlanRollups, blockerSlo \u2014 no graph/hierarchy.",
3186
+ "Command Center dashboard MCP brief (default): heads-up counts, running tasks, next actions, follow-up tool hints (<12k). Use projection=slim for full verification DTO.",
3149
3187
  commandCenterDashboardContractSchema
3150
3188
  ),
3151
3189
  mk(