@drakon-systems/multi-clawd 1.9.4 → 1.9.5

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
@@ -375,7 +375,7 @@ openclaw plugins install (Get-Location).Path
375
375
  **Or let your agent install it.** Running an OpenClaw assistant or Claude
376
376
  Code on the target machine already? Paste it this and go make coffee:
377
377
 
378
- > Read https://raw.githubusercontent.com/Drakon-Systems-Ltd/multi-clawd/v1.9.4/SETUP-AGENT.md
378
+ > Read https://raw.githubusercontent.com/Drakon-Systems-Ltd/multi-clawd/v1.9.5/SETUP-AGENT.md
379
379
  > and follow it to set up multi-clawd on this machine. I own a second
380
380
  > Claude account — ask me when you need me to log in.
381
381
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "multi-clawd",
3
3
  "name": "multi-clawd",
4
- "version": "1.9.4",
4
+ "version": "1.9.5",
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": "1.9.4",
3
+ "version": "1.9.5",
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",
@@ -1,91 +0,0 @@
1
- export const IDENTITY_PROFILE_SUFFIX = "multi-clawd-identity";
2
- export const HISTORY_IDENTITY_CONFIG_KEY = "historyIdentity";
3
- export function identityProfileId(backendId) {
4
- return `${backendId}:${IDENTITY_PROFILE_SUFFIX}`;
5
- }
6
- export function identityAccountId(backendId) {
7
- return `multi-clawd:${backendId}`;
8
- }
9
- export function buildIdentityCredential(backendId) {
10
- return {
11
- type: "oauth",
12
- provider: backendId,
13
- accountId: identityAccountId(backendId),
14
- displayName: `multi-clawd history identity for ${backendId} (a name, not a credential)`,
15
- access: "",
16
- refresh: "",
17
- expires: 1,
18
- };
19
- }
20
- export function hasIdentity(existing, wanted) {
21
- if (!existing || typeof existing !== "object")
22
- return false;
23
- const cred = existing;
24
- return (cred.type === "oauth" &&
25
- cred.provider === wanted.provider &&
26
- cred.accountId === wanted.accountId &&
27
- cred.email === undefined &&
28
- cred.clientId === undefined &&
29
- cred.enterpriseUrl === undefined &&
30
- cred.projectId === undefined);
31
- }
32
- export async function ensureIdentityProfiles(backendIds, sdk) {
33
- const result = { written: [], kept: [], failed: [] };
34
- let profiles;
35
- try {
36
- profiles = sdk.ensureAuthProfileStore(undefined, { readOnly: true }).profiles;
37
- }
38
- catch (err) {
39
- for (const id of backendIds) {
40
- result.failed.push({ profileId: identityProfileId(id), reason: `store read failed: ${errorName(err)}` });
41
- }
42
- return result;
43
- }
44
- for (const id of backendIds) {
45
- const profileId = identityProfileId(id);
46
- const wanted = buildIdentityCredential(id);
47
- if (hasIdentity(profiles[profileId], wanted)) {
48
- result.kept.push(profileId);
49
- continue;
50
- }
51
- try {
52
- await sdk.upsertAuthProfileWithLock({ profileId, credential: wanted });
53
- result.written.push(profileId);
54
- }
55
- catch (err) {
56
- result.failed.push({ profileId, reason: `write failed: ${errorName(err)}` });
57
- }
58
- }
59
- return result;
60
- }
61
- export function describeEnsureResult(result) {
62
- const parts = [];
63
- if (result.written.length)
64
- parts.push(`stored ${result.written.join(", ")}`);
65
- if (result.kept.length)
66
- parts.push(`kept ${result.kept.join(", ")}`);
67
- for (const f of result.failed)
68
- parts.push(`${f.profileId}: ${f.reason}`);
69
- return parts.join("; ") || "nothing to do";
70
- }
71
- function errorName(err) {
72
- if (err instanceof Error)
73
- return `${err.name}: ${err.message}`.slice(0, 200);
74
- return String(err).slice(0, 200);
75
- }
76
- export async function loadProviderAuthSdk() {
77
- try {
78
- const mod = (await import("openclaw/plugin-sdk/provider-auth"));
79
- if (typeof mod.ensureAuthProfileStore !== "function" ||
80
- typeof mod.upsertAuthProfileWithLock !== "function") {
81
- return undefined;
82
- }
83
- return {
84
- ensureAuthProfileStore: mod.ensureAuthProfileStore,
85
- upsertAuthProfileWithLock: mod.upsertAuthProfileWithLock,
86
- };
87
- }
88
- catch {
89
- return undefined;
90
- }
91
- }