@phnx-labs/agents-cli 1.22.84 → 1.22.85
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/CHANGELOG.md +57 -0
- package/README.md +80 -53
- package/dist/bootstrap.d.ts +7 -6
- package/dist/bootstrap.js +20 -27
- package/dist/cli/command-registry.js +5 -1
- package/dist/commands/accounts.d.ts +6 -13
- package/dist/commands/accounts.js +330 -143
- package/dist/commands/apply.js +1 -1
- package/dist/commands/auth-mint.d.ts +7 -3
- package/dist/commands/auth-mint.js +21 -9
- package/dist/commands/auth.js +2 -3
- package/dist/commands/browser.js +10 -10
- package/dist/commands/daemon.d.ts +7 -3
- package/dist/commands/daemon.js +40 -25
- package/dist/commands/doctor.js +28 -2
- package/dist/commands/exec.js +87 -39
- package/dist/commands/fleet-capture.js +21 -2
- package/dist/commands/harness-wizard.js +2 -2
- package/dist/commands/lease.js +7 -12
- package/dist/commands/profiles.d.ts +2 -2
- package/dist/commands/profiles.js +20 -13
- package/dist/commands/repo.js +3 -3
- package/dist/commands/run-account-picker.d.ts +3 -3
- package/dist/commands/run-account-picker.js +29 -30
- package/dist/commands/secrets-passthrough.d.ts +20 -0
- package/dist/commands/secrets-passthrough.js +43 -0
- package/dist/commands/setup-accounts.d.ts +3 -2
- package/dist/commands/setup-accounts.js +4 -4
- package/dist/commands/setup-secrets.d.ts +16 -21
- package/dist/commands/setup-secrets.js +43 -224
- package/dist/commands/ssh.js +2 -2
- package/dist/commands/sync.js +1 -1
- package/dist/commands/update.d.ts +10 -0
- package/dist/commands/update.js +43 -40
- package/dist/commands/versions.d.ts +11 -11
- package/dist/commands/versions.js +131 -83
- package/dist/commands/view.d.ts +1 -9
- package/dist/commands/view.js +41 -55
- package/dist/commands/webhook.js +5 -5
- package/dist/commands/workflows.js +2 -1
- package/dist/index.d.ts +12 -12
- package/dist/index.js +13 -42
- package/dist/lib/account-capabilities.d.ts +1 -1
- package/dist/lib/account-capabilities.js +1 -1
- package/dist/lib/account-catalog.d.ts +121 -6
- package/dist/lib/account-catalog.js +421 -7
- package/dist/lib/account-registry.d.ts +8 -30
- package/dist/lib/account-registry.js +36 -79
- package/dist/lib/account-schema.d.ts +1 -1
- package/dist/lib/account-schema.js +1 -1
- package/dist/lib/accounting/account-pool-collect.js +16 -4
- package/dist/lib/accounting/rotate.d.ts +20 -7
- package/dist/lib/accounting/rotate.js +89 -13
- package/dist/lib/accounting/usage.js +11 -16
- package/dist/lib/accounts/add.d.ts +138 -0
- package/dist/lib/accounts/add.js +651 -0
- package/dist/lib/accounts/migrate.d.ts +117 -0
- package/dist/lib/accounts/migrate.js +536 -0
- package/dist/lib/accounts/slots.d.ts +13 -0
- package/dist/lib/accounts/slots.js +100 -0
- package/dist/lib/agent-spec/agents.d.ts +16 -0
- package/dist/lib/agent-spec/agents.js +32 -4
- package/dist/lib/app-bundle-install.js +5 -4
- package/dist/lib/auth-health.d.ts +3 -0
- package/dist/lib/auth-health.js +11 -0
- package/dist/lib/auth-mint.d.ts +52 -16
- package/dist/lib/auth-mint.js +117 -39
- package/dist/lib/browser/chrome.d.ts +1 -1
- package/dist/lib/browser/chrome.js +5 -5
- package/dist/lib/byok-usage.js +3 -3
- package/dist/lib/claude-account-token.d.ts +47 -3
- package/dist/lib/claude-account-token.js +172 -50
- package/dist/lib/cloud/antigravity.js +4 -4
- package/dist/lib/cloud/cursor.js +4 -4
- package/dist/lib/crabbox/cli.d.ts +1 -1
- package/dist/lib/crabbox/cli.js +6 -6
- package/dist/lib/crabbox/runtimes.d.ts +3 -3
- package/dist/lib/crabbox/runtimes.js +5 -5
- package/dist/lib/daemon/account-state-daemon-service.d.ts +37 -1
- package/dist/lib/daemon/account-state-daemon-service.js +199 -3
- package/dist/lib/daemon/auth-sync-service.js +28 -1
- package/dist/lib/daemon/daemon.d.ts +6 -16
- package/dist/lib/daemon/daemon.js +52 -97
- package/dist/lib/daemon/daemon.test-fixture.d.ts +7 -9
- package/dist/lib/daemon/daemon.test-fixture.js +22 -40
- package/dist/lib/daemon/harness-update-service.d.ts +1 -1
- package/dist/lib/daemon/harness-update-service.js +1 -1
- package/dist/lib/daemon/runner.d.ts +15 -3
- package/dist/lib/daemon/runner.js +49 -24
- package/dist/lib/daemon-health.d.ts +1 -2
- package/dist/lib/daemon-health.js +7 -6
- package/dist/lib/daemon-services.d.ts +1 -1
- package/dist/lib/daemon-services.js +1 -11
- package/dist/lib/daemon-webhooks.d.ts +8 -7
- package/dist/lib/daemon-webhooks.js +10 -9
- package/dist/lib/device-config.js +1 -1
- package/dist/lib/devices/doctor-findings.d.ts +1 -1
- package/dist/lib/devices/harness-inventory.d.ts +39 -0
- package/dist/lib/devices/harness-inventory.js +126 -4
- package/dist/lib/doctor-diff.js +2 -1
- package/dist/lib/exec-account-home.d.ts +38 -0
- package/dist/lib/exec-account-home.js +164 -0
- package/dist/lib/exec.d.ts +30 -0
- package/dist/lib/exec.js +101 -31
- package/dist/lib/fleet/apply.d.ts +2 -2
- package/dist/lib/fleet/apply.js +4 -4
- package/dist/lib/fleet/auth-sync.js +4 -3
- package/dist/lib/fleet-shared-repo-sync.js +6 -9
- package/dist/lib/harness/adapter.d.ts +7 -7
- package/dist/lib/harness/adapter.js +10 -6
- package/dist/lib/harness/adapters/grok.js +8 -3
- package/dist/lib/harness/adapters/muse.js +1 -1
- package/dist/lib/harness/adapters/opencode.js +12 -3
- package/dist/lib/harness-auth-capabilities.d.ts +61 -0
- package/dist/lib/harness-auth-capabilities.js +52 -0
- package/dist/lib/helper-versions.d.ts +6 -4
- package/dist/lib/helper-versions.js +5 -4
- package/dist/lib/hosts/credential-transport.d.ts +10 -0
- package/dist/lib/hosts/credential-transport.js +37 -0
- package/dist/lib/hosts/dispatch.d.ts +7 -0
- package/dist/lib/hosts/dispatch.js +13 -6
- package/dist/lib/identity/client.d.ts +3 -3
- package/dist/lib/identity/client.js +3 -3
- package/dist/lib/installations/index.d.ts +1 -1
- package/dist/lib/installations/index.js +1 -1
- package/dist/lib/installations/migrate.js +9 -0
- package/dist/lib/installations/resolve.js +1 -1
- package/dist/lib/installations/shims.d.ts +15 -0
- package/dist/lib/installations/shims.js +69 -0
- package/dist/lib/installations/store.d.ts +43 -0
- package/dist/lib/installations/store.js +75 -7
- package/dist/lib/installations/versions.js +1 -1
- package/dist/lib/menubar/install-menubar.d.ts +3 -3
- package/dist/lib/menubar/install-menubar.js +3 -3
- package/dist/lib/native-accounts.d.ts +35 -0
- package/dist/lib/native-accounts.js +41 -0
- package/dist/lib/net-close.d.ts +11 -0
- package/dist/lib/net-close.js +25 -0
- package/dist/lib/openclaw-keychain.js +27 -1
- package/dist/lib/profiles.js +22 -9
- package/dist/lib/project-resources.js +1 -1
- package/dist/lib/reserved-stores.d.ts +53 -0
- package/dist/lib/reserved-stores.js +120 -0
- package/dist/lib/secrets-client.d.ts +191 -0
- package/dist/lib/secrets-client.js +710 -0
- package/dist/lib/secrets-policy.d.ts +222 -0
- package/dist/lib/secrets-policy.js +483 -0
- package/dist/lib/secrets-types.d.ts +188 -0
- package/dist/lib/secrets-types.js +24 -0
- package/dist/lib/service-manifest.js +3 -4
- package/dist/lib/session/db.d.ts +18 -0
- package/dist/lib/session/db.js +47 -14
- package/dist/lib/session/sync/config.js +2 -2
- package/dist/lib/sha256-asset.d.ts +11 -16
- package/dist/lib/sha256-asset.js +11 -16
- package/dist/lib/share/config.js +14 -5
- package/dist/lib/signin-badge.d.ts +26 -0
- package/dist/lib/signin-badge.js +42 -0
- package/dist/lib/staleness/detectors/workflows.js +3 -105
- package/dist/lib/staleness/writers/workflows.js +2 -1
- package/dist/lib/state.d.ts +7 -4
- package/dist/lib/state.js +18 -7
- package/dist/lib/sync-umbrella.js +2 -2
- package/dist/lib/teams/agents.js +1 -1
- package/dist/lib/types.d.ts +74 -33
- package/dist/lib/view-types.d.ts +6 -3
- package/dist/lib/workflows-registry.d.ts +71 -0
- package/dist/lib/workflows-registry.js +280 -0
- package/dist/lib/workflows.d.ts +21 -21
- package/dist/lib/workflows.js +12 -327
- package/package.json +2 -3
- package/scripts/postinstall.js +4 -29
- package/dist/commands/secrets-import.d.ts +0 -18
- package/dist/commands/secrets-import.js +0 -74
- package/dist/commands/secrets-migrate.d.ts +0 -25
- package/dist/commands/secrets-migrate.js +0 -334
- package/dist/commands/secrets-rotate-passphrase.d.ts +0 -17
- package/dist/commands/secrets-rotate-passphrase.js +0 -96
- package/dist/commands/secrets-sync.d.ts +0 -11
- package/dist/commands/secrets-sync.js +0 -153
- package/dist/commands/secrets-vault.d.ts +0 -10
- package/dist/commands/secrets-vault.js +0 -130
- package/dist/commands/secrets.d.ts +0 -212
- package/dist/commands/secrets.js +0 -3030
- package/dist/lib/accounts/connect.d.ts +0 -176
- package/dist/lib/accounts/connect.js +0 -453
- package/dist/lib/daemon/keychain-reap-service.d.ts +0 -17
- package/dist/lib/daemon/keychain-reap-service.js +0 -32
- package/dist/lib/daemon/secrets-broker-service.d.ts +0 -21
- package/dist/lib/daemon/secrets-broker-service.js +0 -51
- package/dist/lib/secrets/agent.d.ts +0 -358
- package/dist/lib/secrets/agent.js +0 -1291
- package/dist/lib/secrets/audit.d.ts +0 -46
- package/dist/lib/secrets/audit.js +0 -101
- package/dist/lib/secrets/bundles.d.ts +0 -290
- package/dist/lib/secrets/bundles.js +0 -1547
- package/dist/lib/secrets/download-keychain.d.ts +0 -47
- package/dist/lib/secrets/download-keychain.js +0 -70
- package/dist/lib/secrets/drivers/rush.d.ts +0 -14
- package/dist/lib/secrets/drivers/rush.js +0 -90
- package/dist/lib/secrets/fallback.d.ts +0 -48
- package/dist/lib/secrets/fallback.js +0 -48
- package/dist/lib/secrets/filestore.d.ts +0 -222
- package/dist/lib/secrets/filestore.js +0 -1099
- package/dist/lib/secrets/headless.d.ts +0 -43
- package/dist/lib/secrets/headless.js +0 -56
- package/dist/lib/secrets/icloud-import.d.ts +0 -79
- package/dist/lib/secrets/icloud-import.js +0 -206
- package/dist/lib/secrets/index.d.ts +0 -451
- package/dist/lib/secrets/index.js +0 -1568
- package/dist/lib/secrets/install-helper.d.ts +0 -72
- package/dist/lib/secrets/install-helper.js +0 -245
- package/dist/lib/secrets/lease.d.ts +0 -25
- package/dist/lib/secrets/lease.js +0 -44
- package/dist/lib/secrets/linux.d.ts +0 -77
- package/dist/lib/secrets/linux.js +0 -393
- package/dist/lib/secrets/list-filter.d.ts +0 -109
- package/dist/lib/secrets/list-filter.js +0 -261
- package/dist/lib/secrets/mcp.d.ts +0 -93
- package/dist/lib/secrets/mcp.js +0 -211
- package/dist/lib/secrets/profiles.d.ts +0 -10
- package/dist/lib/secrets/profiles.js +0 -13
- package/dist/lib/secrets/push.d.ts +0 -133
- package/dist/lib/secrets/push.js +0 -273
- package/dist/lib/secrets/rc-hygiene.d.ts +0 -63
- package/dist/lib/secrets/rc-hygiene.js +0 -143
- package/dist/lib/secrets/read-backoff.d.ts +0 -27
- package/dist/lib/secrets/read-backoff.js +0 -64
- package/dist/lib/secrets/reaper.d.ts +0 -90
- package/dist/lib/secrets/reaper.js +0 -243
- package/dist/lib/secrets/remote.d.ts +0 -152
- package/dist/lib/secrets/remote.js +0 -344
- package/dist/lib/secrets/reserved-sync.d.ts +0 -66
- package/dist/lib/secrets/reserved-sync.js +0 -147
- package/dist/lib/secrets/scope.d.ts +0 -26
- package/dist/lib/secrets/scope.js +0 -29
- package/dist/lib/secrets/session-store.d.ts +0 -107
- package/dist/lib/secrets/session-store.js +0 -342
- package/dist/lib/secrets/sync-backend.d.ts +0 -48
- package/dist/lib/secrets/sync-backend.js +0 -13
- package/dist/lib/secrets/sync-commands.d.ts +0 -21
- package/dist/lib/secrets/sync-commands.js +0 -21
- package/dist/lib/secrets/sync.d.ts +0 -48
- package/dist/lib/secrets/sync.js +0 -237
- package/dist/lib/secrets/unlock-hints.d.ts +0 -27
- package/dist/lib/secrets/unlock-hints.js +0 -36
- package/dist/lib/secrets/usage-db.d.ts +0 -46
- package/dist/lib/secrets/usage-db.js +0 -96
- package/dist/lib/secrets/vault-age-helper.d.ts +0 -1
- package/dist/lib/secrets/vault-age-helper.js +0 -34
- package/dist/lib/secrets/vault.d.ts +0 -49
- package/dist/lib/secrets/vault.js +0 -399
- package/dist/lib/secrets/windows.d.ts +0 -81
- package/dist/lib/secrets/windows.js +0 -556
- package/scripts/install-helper.js +0 -97
- /package/dist/lib/{secrets/sync-passphrase.d.ts → sync-passphrase.d.ts} +0 -0
- /package/dist/lib/{secrets/sync-passphrase.js → sync-passphrase.js} +0 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { type SecretsContext } from './secrets-client.js';
|
|
2
|
+
import type { PushBundleResult } from './secrets-types.js';
|
|
3
|
+
import type { AgentId, Meta, NativeAccountRecord } from './types.js';
|
|
4
|
+
import { type DeviceProfile } from './devices/registry.js';
|
|
5
|
+
import { type SharedAuthStatus } from './fleet-shared-state.js';
|
|
6
|
+
import { selfConfiguredDeviceRole } from './device-config.js';
|
|
7
|
+
import { AUTH_STORE_ALIAS, AUTH_BUNDLE_NAME, AUTH_BUNDLE_BACKEND, RESERVED_BUNDLE_NAMES, isReservedBundleName, ReservedBundleWrongBackendError, assertReservedAuthBackend, isReservedBundleBackendError, RESERVED_STORES, reservedStoreName, isReservedStoreName, assertStorableCredentialKind, inspectReservedAuthBundle, type StorableCredentialKind } from './reserved-stores.js';
|
|
8
|
+
export { AUTH_STORE_ALIAS, AUTH_BUNDLE_NAME, AUTH_BUNDLE_BACKEND, RESERVED_BUNDLE_NAMES, isReservedBundleName, ReservedBundleWrongBackendError, assertReservedAuthBackend, isReservedBundleBackendError, RESERVED_STORES, reservedStoreName, isReservedStoreName, assertStorableCredentialKind, inspectReservedAuthBundle, type StorableCredentialKind, };
|
|
9
|
+
/** Filter `names` down to the ones the active resource profile allows for `secrets`. */
|
|
10
|
+
export declare function filterBundleNamesForActiveProfile(names: string[]): string[];
|
|
11
|
+
/**
|
|
12
|
+
* `SecretsContext.allowedBundles` for the active resource profile, or
|
|
13
|
+
* `undefined` when no profile is active (full trust — the client's default).
|
|
14
|
+
* `allNames` is the caller's already-fetched full bundle listing (e.g. from
|
|
15
|
+
* `listBundlesSync()`), so this stays a pure filter with no extra round trip.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveAllowedBundlesForActiveProfile(allNames: string[]): string[] | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* The `SecretsContext` a run should pass to every bundle resolution it makes:
|
|
20
|
+
* the run's harness as the opaque `scope`, plus `allowedBundles` computed from
|
|
21
|
+
* a fresh full bundle listing when a resource profile is active (a stale
|
|
22
|
+
* listing could exclude a bundle created after the profile was set). No
|
|
23
|
+
* profile active means full trust and no extra round trip.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveSecretsContextForRun(scope?: string): Promise<SecretsContext | undefined>;
|
|
26
|
+
/** Parse a `--secrets` flag value into its bundle name and optional `@host`. */
|
|
27
|
+
export declare function splitBundleRef(ref: string): {
|
|
28
|
+
bundle: string;
|
|
29
|
+
host?: string;
|
|
30
|
+
};
|
|
31
|
+
/** A remote (bundle@host) reference does not yet support key-subset or expiry overrides. */
|
|
32
|
+
export declare function assertRemoteBundleFlagsUnsupported(bundleName: string, host: string, opts: {
|
|
33
|
+
keys?: string[];
|
|
34
|
+
allowExpired?: boolean;
|
|
35
|
+
}, flagLabels: {
|
|
36
|
+
keysFlag: string;
|
|
37
|
+
allowExpiredFlag: string;
|
|
38
|
+
}): void;
|
|
39
|
+
/** Each import/read-back SSH operation gets this deadline plus the SSH hard-kill grace. */
|
|
40
|
+
export declare const AUTH_SYNC_PUSH_DEADLINE_MS = 20000;
|
|
41
|
+
export interface AuthSyncDevice {
|
|
42
|
+
name: string;
|
|
43
|
+
reachable: boolean;
|
|
44
|
+
pinned: boolean;
|
|
45
|
+
remoteAuth: SharedAuthStatus | 'unknown';
|
|
46
|
+
}
|
|
47
|
+
export type AuthSyncPlanItem = {
|
|
48
|
+
action: 'push';
|
|
49
|
+
device: string;
|
|
50
|
+
} | {
|
|
51
|
+
action: 'skip';
|
|
52
|
+
device: string;
|
|
53
|
+
reason: string;
|
|
54
|
+
};
|
|
55
|
+
export declare function planAuthBundlePush(localAuthOk: boolean, localIsPublisher: boolean, devices: AuthSyncDevice[]): AuthSyncPlanItem[];
|
|
56
|
+
export interface AuthSyncResult {
|
|
57
|
+
publisher: string | null;
|
|
58
|
+
stateChanged: boolean;
|
|
59
|
+
pushed: string[];
|
|
60
|
+
skipped: Array<{
|
|
61
|
+
device: string;
|
|
62
|
+
reason: string;
|
|
63
|
+
}>;
|
|
64
|
+
errors: Array<{
|
|
65
|
+
device: string;
|
|
66
|
+
message: string;
|
|
67
|
+
}>;
|
|
68
|
+
}
|
|
69
|
+
export interface AuthSyncDeps {
|
|
70
|
+
inspectLocal?: () => {
|
|
71
|
+
exists: boolean;
|
|
72
|
+
ok: boolean;
|
|
73
|
+
};
|
|
74
|
+
listDevices?: () => DeviceProfile[];
|
|
75
|
+
localName?: string;
|
|
76
|
+
userAgentsDir?: string;
|
|
77
|
+
isPinned?: (name: string) => boolean;
|
|
78
|
+
push?: (bundle: string, host: string) => Promise<PushBundleResult>;
|
|
79
|
+
sshTarget?: (device: DeviceProfile) => string;
|
|
80
|
+
}
|
|
81
|
+
export interface PublishAuthVerdictOptions {
|
|
82
|
+
inspectLocal?: () => {
|
|
83
|
+
exists: boolean;
|
|
84
|
+
ok: boolean;
|
|
85
|
+
};
|
|
86
|
+
localName?: string;
|
|
87
|
+
userAgentsDir?: string;
|
|
88
|
+
}
|
|
89
|
+
export interface PublishAuthVerdictResult {
|
|
90
|
+
device: string;
|
|
91
|
+
status: SharedAuthStatus;
|
|
92
|
+
changed: boolean;
|
|
93
|
+
error: string | null;
|
|
94
|
+
}
|
|
95
|
+
/** Publish only safe readiness metadata; useful immediately before a repo push. */
|
|
96
|
+
export declare function publishReservedAuthVerdict(options?: PublishAuthVerdictOptions): Promise<PublishAuthVerdictResult>;
|
|
97
|
+
/**
|
|
98
|
+
* Publish local readiness, elect one ready source, then asynchronously provision
|
|
99
|
+
* only peers whose shared verdict says the bundle is missing.
|
|
100
|
+
*/
|
|
101
|
+
export declare function syncReservedAuthBundle(deps?: AuthSyncDeps): Promise<AuthSyncResult>;
|
|
102
|
+
/** One account's durable worker credential, resolved to (bundle, key). */
|
|
103
|
+
export interface ReservedSyncAccount {
|
|
104
|
+
accountId: string;
|
|
105
|
+
harness: AgentId;
|
|
106
|
+
/** Reserved store `__<harness>__`, or the legacy `auth` alias for a pre-T1 claude row. */
|
|
107
|
+
bundle: string;
|
|
108
|
+
/** Storage key `<ENV>_<accountId>` (or the legacy email-keyed claude key). */
|
|
109
|
+
key: string;
|
|
110
|
+
/**
|
|
111
|
+
* `workerCredential.mintedAt` -- a re-mint bumps it, so a delivered-memo hit on
|
|
112
|
+
* the old value re-pushes. `'legacy'` for a pre-T1 claude row with no field.
|
|
113
|
+
*/
|
|
114
|
+
fingerprint: string;
|
|
115
|
+
}
|
|
116
|
+
/** A peer as the plan sees it: its role, reachability, and the keys it is KNOWN to hold. */
|
|
117
|
+
export interface ReservedSyncPeer {
|
|
118
|
+
name: string;
|
|
119
|
+
/** `personal`/`desktop` -- receives the account row, never a durable key. */
|
|
120
|
+
headed: boolean;
|
|
121
|
+
reachable: boolean;
|
|
122
|
+
pinned: boolean;
|
|
123
|
+
/** bundle -> keys the peer already holds at the current fingerprint. Absent ⇒ none known. */
|
|
124
|
+
presentKeys: Record<string, ReadonlySet<string>>;
|
|
125
|
+
}
|
|
126
|
+
export type ReservedSyncPlanItem = {
|
|
127
|
+
action: 'push';
|
|
128
|
+
device: string;
|
|
129
|
+
bundle: string;
|
|
130
|
+
keys: string[];
|
|
131
|
+
} | {
|
|
132
|
+
action: 'skip';
|
|
133
|
+
device: string;
|
|
134
|
+
reason: string;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Pure plan: for each worker peer, push each bundle it is missing at least one
|
|
138
|
+
* key of. Deterministic (peers and bundles sorted) so it pins exactly in tests.
|
|
139
|
+
* A headed peer is skipped BEFORE any key comparison -- it never receives a key.
|
|
140
|
+
*/
|
|
141
|
+
export declare function planReservedStoreSync(accounts: ReservedSyncAccount[], peers: ReservedSyncPeer[]): ReservedSyncPlanItem[];
|
|
142
|
+
/**
|
|
143
|
+
* Every portable account's durable worker credential, resolved to (bundle, key).
|
|
144
|
+
* A T1 row carries `workerCredential`; a claude row predating T1 has none, so it
|
|
145
|
+
* falls back to the legacy `auth` bundle keyed by the account email -- the
|
|
146
|
+
* legacy fallback for claude rows that predate T1. An account with no derivable
|
|
147
|
+
* durable credential (per-device harness, or a non-claude row with no
|
|
148
|
+
* `workerCredential`) is not a sync target.
|
|
149
|
+
*/
|
|
150
|
+
export declare function reservedSyncTargets(meta: Pick<Meta, 'accounts' | 'deviceAccounts'>): ReservedSyncAccount[];
|
|
151
|
+
export declare function readDeliveryMemo(root?: string): Record<string, string>;
|
|
152
|
+
/**
|
|
153
|
+
* The keys a peer is KNOWN to hold, per bundle, from what we have delivered to it
|
|
154
|
+
* (memo, matched by fingerprint) plus the coarse legacy-`auth` verdict: a peer
|
|
155
|
+
* reporting `auth.status === 'ready'` is known to hold every legacy `auth` key.
|
|
156
|
+
* Reserved `__<harness>__` bundles have no coarse verdict, so their presence comes
|
|
157
|
+
* from the memo alone -- which is what makes a newly-added reserved account push.
|
|
158
|
+
*/
|
|
159
|
+
export declare function peerPresentKeys(peer: string, accounts: ReservedSyncAccount[], memo: Record<string, string>, legacyAuthReady: boolean): Record<string, ReadonlySet<string>>;
|
|
160
|
+
export interface ReservedStoreSyncResult {
|
|
161
|
+
publisher: string | null;
|
|
162
|
+
pushed: Array<{
|
|
163
|
+
device: string;
|
|
164
|
+
bundle: string;
|
|
165
|
+
keys: string[];
|
|
166
|
+
}>;
|
|
167
|
+
skipped: Array<{
|
|
168
|
+
device: string;
|
|
169
|
+
reason: string;
|
|
170
|
+
}>;
|
|
171
|
+
errors: Array<{
|
|
172
|
+
device: string;
|
|
173
|
+
message: string;
|
|
174
|
+
}>;
|
|
175
|
+
}
|
|
176
|
+
export interface ReservedStoreSyncDeps {
|
|
177
|
+
listDevices?: () => DeviceProfile[];
|
|
178
|
+
localName?: string;
|
|
179
|
+
userAgentsDir?: string;
|
|
180
|
+
cacheDir?: string;
|
|
181
|
+
readMetaFn?: () => Pick<Meta, 'accounts' | 'deviceAccounts'>;
|
|
182
|
+
isPinned?: (name: string) => boolean;
|
|
183
|
+
peerRole?: (name: string) => ReturnType<typeof selfConfiguredDeviceRole>;
|
|
184
|
+
localReady?: boolean;
|
|
185
|
+
/** Does THIS publisher hold (bundle, key) to push? Defaults to a local bundle read. */
|
|
186
|
+
hasLocalKey?: (bundle: string, key: string) => boolean;
|
|
187
|
+
push?: (bundle: string, host: string) => Promise<PushBundleResult>;
|
|
188
|
+
sshTarget?: (device: DeviceProfile) => string;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Push every portable account's reserved store to the worker peers that are
|
|
192
|
+
* missing it, per key and per role. Reuses the same election as
|
|
193
|
+
* {@link syncReservedAuthBundle} (one deterministic ready publisher pushes) so
|
|
194
|
+
* there is no second scheduler. The daemon runs this each tick.
|
|
195
|
+
*/
|
|
196
|
+
export declare function syncReservedStores(deps?: ReservedStoreSyncDeps): Promise<ReservedStoreSyncResult>;
|
|
197
|
+
export interface ReconcileWorkerSlotsResult {
|
|
198
|
+
provisioned: string[];
|
|
199
|
+
skipped: Array<{
|
|
200
|
+
accountId: string;
|
|
201
|
+
reason: string;
|
|
202
|
+
}>;
|
|
203
|
+
errors: Array<{
|
|
204
|
+
accountId: string;
|
|
205
|
+
message: string;
|
|
206
|
+
}>;
|
|
207
|
+
}
|
|
208
|
+
export interface ReconcileWorkerSlotsDeps {
|
|
209
|
+
selfRole?: ReturnType<typeof selfConfiguredDeviceRole>;
|
|
210
|
+
readMetaFn?: () => Pick<Meta, 'accounts' | 'deviceAccounts'>;
|
|
211
|
+
hasLocalKey?: (bundle: string, key: string) => boolean;
|
|
212
|
+
provision?: (account: NativeAccountRecord) => void;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Worker-side: after a durable key lands, materialize a slot for each portable
|
|
216
|
+
* account whose credential is now present locally. Runs only on a NON-headed
|
|
217
|
+
* (worker or unmarked) device -- a headed device provisions its slots from an
|
|
218
|
+
* interactive native login (`accounts add`), never from an injected durable key
|
|
219
|
+
* (invariant 7). Idempotent: an account already backed by a `durable` slot is
|
|
220
|
+
* skipped.
|
|
221
|
+
*/
|
|
222
|
+
export declare function reconcileLocalWorkerSlots(deps?: ReconcileWorkerSlotsDeps): ReconcileWorkerSlotsResult;
|