@remnic/plugin-openclaw 9.69.86 → 9.69.88

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
@@ -8381,6 +8381,27 @@ function sessionKeyFrom(event, ctx) {
8381
8381
  if (typeof fromEvent === "string" && fromEvent.length > 0) return fromEvent;
8382
8382
  return "default";
8383
8383
  }
8384
+ function isSubagentSessionKey(sessionKey) {
8385
+ const raw = typeof sessionKey === "string" ? sessionKey.trim() : "";
8386
+ if (!raw) return false;
8387
+ if (raw.toLowerCase().startsWith("subagent:")) return true;
8388
+ if (raw.slice(0, 6).toLowerCase() !== "agent:") return false;
8389
+ const restStart = raw.indexOf(":", 6);
8390
+ if (restStart === -1) return false;
8391
+ const agentId = raw.slice(6, restStart).trim();
8392
+ const rest = raw.slice(restStart + 1);
8393
+ if (!agentId || !rest || rest.startsWith(":")) return false;
8394
+ return rest.toLowerCase().startsWith("subagent:");
8395
+ }
8396
+ var openClawRoutingModulePromise;
8397
+ function openClawRoutingModule() {
8398
+ openClawRoutingModulePromise ??= import("openclaw/plugin-sdk/routing").catch(() => void 0);
8399
+ return openClawRoutingModulePromise;
8400
+ }
8401
+ async function isSubagentSessionKeyDetected(sessionKey) {
8402
+ const routing = await openClawRoutingModule();
8403
+ return (routing?.isSubagentSessionKey ?? isSubagentSessionKey)(sessionKey);
8404
+ }
8384
8405
  function lifecycleSessionKeyFrom(event, ctx) {
8385
8406
  const fromEvent = event?.sessionKey;
8386
8407
  if (fromEvent !== void 0) {
@@ -8538,6 +8559,10 @@ function registerDelegateRuntime(api, options) {
8538
8559
  const promptDeadline = Date.now() + Math.min(options.hookTimeoutMs, options.recallTimeoutMs);
8539
8560
  const promptRemaining = () => promptDeadline - Date.now();
8540
8561
  try {
8562
+ if (await isSubagentSessionKeyDetected(sessionKey)) {
8563
+ log8.debug(`delegate recall skipped: subagent session ${sessionKey}`);
8564
+ return void 0;
8565
+ }
8541
8566
  if (options.shouldSkipRecall(sessionKey)) {
8542
8567
  log8.debug(`delegate recall skipped: cron policy excludes ${sessionKey}`);
8543
8568
  return void 0;
@@ -11107,6 +11132,12 @@ Keep the reflection grounded in the evidence below.
11107
11132
  `${hookLabel}: cron allowlist match=${matchedPattern ? "yes" : "no"} pattern=${matchedPattern ?? "none"}`
11108
11133
  );
11109
11134
  }
11135
+ if (await isSubagentSessionKeyDetected(sessionKey)) {
11136
+ log9.debug(
11137
+ `${hookLabel}: skip recall for spawned-subagent session ${sessionKey}`
11138
+ );
11139
+ return;
11140
+ }
11110
11141
  if (shouldSkipRecallForSession(sessionKey, cfg)) {
11111
11142
  log9.debug(
11112
11143
  `${hookLabel}: skip recall for cron session ${sessionKey} (mode=${cfg.cronRecallMode})`