@drakon-systems/multi-clawd 2.1.1 → 2.1.2

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
@@ -385,7 +385,7 @@ openclaw plugins install (Get-Location).Path
385
385
  **Or let your agent install it.** Running an OpenClaw assistant or Claude
386
386
  Code on the target machine already? Paste it this and go make coffee:
387
387
 
388
- > Read https://raw.githubusercontent.com/Drakon-Systems-Ltd/multi-clawd/v2.1.1/SETUP-AGENT.md
388
+ > Read https://raw.githubusercontent.com/Drakon-Systems-Ltd/multi-clawd/v2.1.2/SETUP-AGENT.md
389
389
  > and follow it to set up multi-clawd on this machine. I own a second
390
390
  > Claude account — ask me when you need me to log in.
391
391
 
@@ -1,4 +1,4 @@
1
- import { ACCESS_TOKEN_EXPIRY_SKEW_MS, CLAUDE_KEYCHAIN_SERVICE, assessAccountCredential, keychainServiceForConfigDir, } from "./login-health.js";
1
+ import { ACCESS_TOKEN_EXPIRY_SKEW_MS, AUTH_PROOF_FRESH_MS, CLAUDE_KEYCHAIN_SERVICE, assessAccountCredential, keychainServiceForConfigDir, } from "./login-health.js";
2
2
  export const RUNTIME_AUTH_MARKER_PREFIX = "oauth:";
3
3
  export const LOGIN_AUTH_CACHE_TTL_MS = 30 * 1000;
4
4
  export function runtimeAuthMarker(providerId) {
@@ -61,10 +61,20 @@ export function createLoginAuthCache(options) {
61
61
  const tokenBound = check.status === "ok" && check.expiresAt !== undefined
62
62
  ? check.expiresAt - ACCESS_TOKEN_EXPIRY_SKEW_MS
63
63
  : undefined;
64
- const hardUntil = tokenBound !== undefined && tokenBound > nowMs ? tokenBound : nowMs + ttlMs;
64
+ let hardUntil = nowMs + ttlMs;
65
+ if (tokenBound !== undefined && tokenBound > nowMs) {
66
+ hardUntil = tokenBound;
67
+ }
68
+ else if (check.status === "ok") {
69
+ const lastSuccessAt = health(accountId).lastSuccessAt;
70
+ if (lastSuccessAt !== undefined) {
71
+ hardUntil = Math.min(nowMs + 2 * ttlMs, lastSuccessAt + AUTH_PROOF_FRESH_MS);
72
+ }
73
+ }
65
74
  cache.set(accountId, { check, freshUntil: nowMs + ttlMs, hardUntil });
66
75
  };
67
76
  const judge = async (account, nowMs) => {
77
+ await Promise.resolve();
68
78
  let io = options.io;
69
79
  if (io.platform === "darwin" && options.readKeychainItemAsync) {
70
80
  const dir = account.native ? "~/.claude" : account.configDir;
@@ -103,7 +113,7 @@ export function createLoginAuthCache(options) {
103
113
  if (health(account.id).failed)
104
114
  return undefined;
105
115
  const hit = cache.get(account.id);
106
- if (!hit || hit.freshUntil <= nowMs)
116
+ if (!hit || hit.freshUntil <= nowMs || hit.hardUntil <= nowMs)
107
117
  void refresh(account, nowMs);
108
118
  if (!hit || hit.hardUntil <= nowMs)
109
119
  return undefined;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "multi-clawd",
3
3
  "name": "multi-clawd",
4
- "version": "2.1.1",
4
+ "version": "2.1.2",
5
5
  "description": "Register additional Claude Code logins (Max/Pro accounts) as first-class OpenClaw CLI backends for cross-account failover, keeping the full skills/MCP harness on every account.",
6
6
  "cliBackends": [
7
7
  "claw1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drakon-systems/multi-clawd",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "Multi-account Claude Code failover for OpenClaw — register additional Claude (Max/Pro) logins as first-class CLI backends and keep the full skills/MCP harness across every account. Also imports those accounts' setup tokens into Hermes Agent's Anthropic credential pool.",
5
5
  "type": "module",
6
6
  "license": "MIT",