@remnic/plugin-openclaw 9.69.78 → 9.69.80

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
@@ -6169,11 +6169,24 @@ function probeDaemonSync(options) {
6169
6169
  }
6170
6170
  function checkDaemonHealthSync(host, port, timeoutMs = DEFAULT_DAEMON_HEALTH_TIMEOUT_MS) {
6171
6171
  assertProbeBudget(timeoutMs);
6172
- return probeDaemonSync({
6172
+ const deadline = Date.now() + timeoutMs;
6173
+ const anonymous = probeDaemonSync({
6173
6174
  host,
6174
6175
  port,
6175
6176
  timeoutMs,
6176
6177
  path: LIVENESS_PATH,
6178
+ fallbackPath: LEGACY_HEALTH_PATH,
6179
+ authToken: ""
6180
+ });
6181
+ if (anonymous.ok || anonymous.rejectedAuth === true) return true;
6182
+ if (anonymous.failure === "network") return false;
6183
+ const remaining = deadline - Date.now();
6184
+ if (remaining <= 0) return false;
6185
+ return probeDaemonSync({
6186
+ host,
6187
+ port,
6188
+ timeoutMs: remaining,
6189
+ path: LIVENESS_PATH,
6177
6190
  fallbackPath: LEGACY_HEALTH_PATH
6178
6191
  }).ok;
6179
6192
  }
@@ -8647,7 +8660,7 @@ function registerDelegateRuntime(api, options) {
8647
8660
  return;
8648
8661
  }
8649
8662
  const observe = async () => {
8650
- const observeDeadline = Date.now() + Math.min(options.observeTimeoutMs, options.flushTimeoutMs / 2);
8663
+ const observeDeadline = Date.now() + Math.max(1, options.observeTimeoutMs);
8651
8664
  const observeRemaining = () => observeDeadline - Date.now();
8652
8665
  try {
8653
8666
  await postJson(
@@ -8877,7 +8890,13 @@ var delegateActiveServiceIds = /* @__PURE__ */ new Set();
8877
8890
  var delegateEmbeddedFallbackApis = /* @__PURE__ */ new WeakSet();
8878
8891
  var delegateBoundApis = /* @__PURE__ */ new WeakSet();
8879
8892
  var delegateAuthorizationPreflightServices = /* @__PURE__ */ new WeakMap();
8880
- function maybeRegisterDelegateRuntime(api, options, deps = { checkHealth: checkDaemonHealthSync }) {
8893
+ function maybeRegisterDelegateRuntime(api, options, deps = {
8894
+ checkHealth: checkDaemonHealthSync,
8895
+ checkCorpus: (host, port, timeoutMs, memoryDir, configPath) => {
8896
+ const probe = readDaemonMemoryDirSync(host, port, timeoutMs, configPath);
8897
+ return probe.healthy === true && probe.memoryDir !== void 0 && daemonServesCorpus(memoryDir, probe.memoryDir);
8898
+ }
8899
+ }) {
8881
8900
  const boundServices = delegateHookApiServices.get(api);
8882
8901
  if (boundServices?.has(options.serviceId)) {
8883
8902
  log8.debug(
@@ -8932,7 +8951,14 @@ function maybeRegisterDelegateRuntime(api, options, deps = { checkHealth: checkD
8932
8951
  const preflightDeadline = Date.now() + bridgeHealthTimeoutMs;
8933
8952
  const healthyHost = hosts.find((host, index) => {
8934
8953
  const remaining = index === 0 ? bridgeHealthTimeoutMs : preflightDeadline - Date.now();
8935
- return remaining > 0 && deps.checkHealth(host, bridge.daemonPort, remaining);
8954
+ if (!(remaining > 0 && deps.checkHealth(host, bridge.daemonPort, remaining))) return false;
8955
+ if (index === 0 && hosts.length > 1 && deps.checkCorpus !== void 0) {
8956
+ const corpusRemaining = preflightDeadline - Date.now();
8957
+ if (corpusRemaining <= 0 || !deps.checkCorpus(host, bridge.daemonPort, corpusRemaining, options.memoryDir, bridge.daemonConfigPath)) {
8958
+ return false;
8959
+ }
8960
+ }
8961
+ return true;
8936
8962
  });
8937
8963
  if (healthyHost !== void 0 && healthyHost !== bridge.daemonHost) {
8938
8964
  log8.info(