@astrale-os/cli 0.8.0-alpha.0 → 0.8.1-alpha.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 +4 -1
- package/dist/astrale.js +62968 -41240
- package/dist/public/connect-core.js +55030 -0
- package/dist/public/keys/index.js +45631 -0
- package/dist/public/paths/index.js +43990 -0
- package/dist/types/admin/instance/model.d.ts +40 -0
- package/dist/types/connect-core.d.ts +22 -0
- package/dist/types/connection/auth.d.ts +33 -0
- package/dist/types/errors.d.ts +23 -0
- package/dist/types/identity/registry.d.ts +25 -0
- package/dist/types/keys/algorithm.d.ts +6 -0
- package/dist/types/keys/credential.d.ts +21 -0
- package/dist/types/keys/index.d.ts +4 -0
- package/dist/types/keys/pair.d.ts +34 -0
- package/dist/types/lib/admin-target.d.ts +74 -0
- package/dist/types/lib/ca-fetch.d.ts +2 -0
- package/dist/types/lib/config.d.ts +71 -0
- package/dist/types/lib/format.d.ts +1 -0
- package/dist/types/lib/idp-session.d.ts +33 -0
- package/dist/types/lib/idp.d.ts +397 -0
- package/dist/types/lib/instance-target.d.ts +36 -0
- package/dist/types/lib/instance.d.ts +186 -0
- package/dist/types/lib/log.d.ts +30 -0
- package/dist/types/lib/login-flow.d.ts +49 -0
- package/dist/types/lib/meta.d.ts +36 -0
- package/dist/types/lib/output.d.ts +83 -0
- package/dist/types/lib/table.d.ts +18 -0
- package/dist/types/lib/validation.d.ts +11 -0
- package/dist/types/paths/index.d.ts +2 -0
- package/dist/types/state/exchange-credentials.d.ts +25 -0
- package/dist/types/state/files.d.ts +9 -0
- package/dist/types/state/identities.d.ts +42 -0
- package/dist/types/state/index.d.ts +8 -0
- package/dist/types/state/paths.d.ts +32 -0
- package/package.json +30 -8
- package/src/admin/.spec/api.d.ts +3 -0
- package/src/admin/.spec/architecture.md +15 -0
- package/src/admin/.spec/icon.svg +3 -0
- package/src/admin/.spec/layout.ts +6 -0
- package/src/admin/catalog/.spec/api.d.ts +65 -0
- package/src/admin/catalog/.spec/architecture.md +6 -0
- package/src/admin/catalog/.spec/icon.svg +3 -0
- package/src/admin/catalog/.spec/layout.ts +6 -0
- package/src/admin/catalog/__tests__/client.test.ts +171 -0
- package/src/admin/catalog/client.ts +214 -0
- package/src/admin/catalog/index.ts +13 -0
- package/src/admin/catalog/model.ts +42 -0
- package/src/admin/catalog/tsconfig.json +8 -0
- package/src/admin/graph/.spec/api.d.ts +28 -0
- package/src/admin/graph/.spec/architecture.md +5 -0
- package/src/admin/graph/.spec/icon.svg +3 -0
- package/src/admin/graph/.spec/layout.ts +3 -0
- package/src/admin/graph/index.ts +6 -0
- package/src/admin/graph/nodes.ts +56 -0
- package/src/admin/index.ts +2 -0
- package/src/admin/instance/.spec/api.d.ts +66 -0
- package/src/admin/instance/.spec/architecture.md +10 -0
- package/src/admin/instance/.spec/icon.svg +3 -0
- package/src/admin/instance/.spec/layout.ts +6 -0
- package/src/admin/instance/__tests__/client.test.ts +289 -0
- package/src/admin/instance/client.ts +298 -0
- package/src/admin/instance/index.ts +16 -0
- package/src/admin/instance/model.ts +65 -0
- package/src/admin/instance/tsconfig.json +8 -0
- package/src/commands/__tests__/admin-instance.test.ts +3 -36
- package/src/commands/__tests__/call.test.ts +21 -68
- package/src/commands/__tests__/domain-install-owned.test.ts +26 -27
- package/src/commands/__tests__/domain-list.test.ts +2 -6
- package/src/commands/__tests__/logs.test.ts +50 -98
- package/src/commands/__tests__/ls.test.ts +21 -17
- package/src/commands/__tests__/read-commands.test.ts +171 -101
- package/src/commands/__tests__/view.test.ts +100 -51
- package/src/commands/admin/status.ts +3 -3
- package/src/commands/admin/use.ts +29 -6
- package/src/commands/auth/login.ts +1 -1
- package/src/commands/auth/logout.ts +4 -2
- package/src/commands/auth/status.ts +2 -2
- package/src/commands/auth/token.ts +2 -2
- package/src/commands/browser.ts +1 -1
- package/src/commands/call.ts +55 -91
- package/src/commands/describe.ts +52 -147
- package/src/commands/domain/install.ts +81 -50
- package/src/commands/domain/list.ts +4 -8
- package/src/commands/domain/publish.ts +9 -31
- package/src/commands/get.ts +32 -65
- package/src/commands/identity/__tests__/register.test.ts +93 -0
- package/src/commands/identity/create.ts +2 -2
- package/src/commands/identity/delete.ts +2 -2
- package/src/commands/identity/export.ts +7 -33
- package/src/commands/identity/import.ts +21 -70
- package/src/commands/identity/list.ts +2 -2
- package/src/commands/identity/register.ts +148 -117
- package/src/commands/identity/sync.ts +2 -2
- package/src/commands/identity/unsync.ts +2 -2
- package/src/commands/identity/use.ts +2 -2
- package/src/commands/identity/whoami.ts +2 -2
- package/src/commands/idp/add.ts +1 -1
- package/src/commands/idp/list.ts +1 -1
- package/src/commands/idp/refresh.ts +1 -1
- package/src/commands/idp/remove.ts +2 -2
- package/src/commands/idp/show.ts +1 -1
- package/src/commands/instance/active.ts +2 -2
- package/src/commands/instance/bookmark.ts +8 -2
- package/src/commands/instance/create.ts +1 -1
- package/src/commands/instance/delete.ts +4 -10
- package/src/commands/instance/forget.ts +1 -1
- package/src/commands/instance/list.ts +3 -3
- package/src/commands/instance/status.ts +5 -7
- package/src/commands/instance/use.ts +3 -3
- package/src/commands/logs.ts +152 -279
- package/src/commands/ls.ts +78 -204
- package/src/commands/mutate.ts +70 -139
- package/src/commands/query.ts +100 -278
- package/src/commands/session/analyze.ts +1 -1
- package/src/commands/session/list.ts +1 -1
- package/src/commands/setup.ts +1 -1
- package/src/commands/status.ts +1 -1
- package/src/commands/studio.ts +1 -1
- package/src/commands/token.ts +26 -21
- package/src/commands/update.ts +1 -1
- package/src/commands/use.ts +2 -3
- package/src/commands/view-serve.ts +1 -1
- package/src/commands/view.ts +67 -109
- package/src/connect-core.test.ts +38 -0
- package/src/connect-core.ts +42 -0
- package/src/connection/.spec/api.d.ts +111 -0
- package/src/connection/.spec/architecture.md +41 -0
- package/src/connection/.spec/capabilities/connection.ts +13 -0
- package/src/connection/.spec/examples/call.ts +7 -0
- package/src/connection/.spec/flows/command.ts +20 -0
- package/src/connection/.spec/flows/session.ts +61 -0
- package/src/connection/.spec/laws/connection.ts +181 -0
- package/src/connection/.spec/layout.ts +19 -0
- package/src/{kernel → connection}/__tests__/auth.test.ts +26 -2
- package/src/connection/__tests__/ca-fetch.test.ts +53 -0
- package/src/connection/__tests__/call.test.ts +17 -0
- package/src/connection/__tests__/credential.test.ts +109 -0
- package/src/connection/__tests__/errors.test.ts +96 -0
- package/src/connection/__tests__/exchange.test.ts +224 -0
- package/src/connection/__tests__/fixtures/localhost-cert.pem +19 -0
- package/src/connection/__tests__/fixtures/localhost-key.base64 +1 -0
- package/src/connection/__tests__/managed.test.ts +39 -0
- package/src/connection/__tests__/self.test.ts +51 -0
- package/src/connection/__tests__/session.test.ts +140 -0
- package/src/connection/__tests__/target.test.ts +93 -0
- package/src/{kernel → connection}/auth.ts +8 -8
- package/src/connection/call.ts +7 -0
- package/src/{kernel/run.ts → connection/command.ts} +22 -13
- package/src/connection/credential.ts +114 -0
- package/src/{kernel → connection}/errors.ts +32 -9
- package/src/connection/exchange.ts +274 -0
- package/src/connection/index.ts +8 -0
- package/src/connection/self.ts +120 -0
- package/src/connection/session.ts +176 -0
- package/src/connection/target.ts +111 -0
- package/src/connection/tsconfig.json +6 -0
- package/src/graph/.spec/api.d.ts +34 -0
- package/src/graph/.spec/laws/documents.ts +24 -0
- package/src/graph/.spec/laws/projection.ts +13 -0
- package/src/graph/.spec/layout.ts +6 -0
- package/src/graph/__tests__/mutation.test.ts +43 -0
- package/src/graph/__tests__/projection.test.ts +22 -0
- package/src/graph/__tests__/query.test.ts +154 -0
- package/src/graph/index.ts +3 -0
- package/src/graph/mutation.ts +18 -0
- package/src/graph/projection.ts +21 -0
- package/src/graph/query.ts +108 -0
- package/src/graph/tsconfig.json +6 -0
- package/src/identity/.history/ard/bootstrap-root-transfer.md +57 -0
- package/src/identity/.history/ard/domain-mediated-registration.md +36 -0
- package/src/identity/.spec/api.d.ts +124 -0
- package/src/identity/.spec/architecture.md +33 -0
- package/src/identity/.spec/capabilities/identity.ts +7 -0
- package/src/identity/.spec/flows/bootstrap-root.ts +79 -0
- package/src/identity/.spec/flows/domain-mediated-registration.ts +51 -0
- package/src/identity/.spec/flows/import.ts +29 -0
- package/src/identity/.spec/laws/identity.ts +56 -0
- package/src/identity/.spec/layout.ts +13 -0
- package/src/identity/.spec/schemas/identity-export-v1.schema.json +25 -0
- package/src/identity/__tests__/fixtures/registry-journey.ts +53 -0
- package/src/identity/__tests__/registration.test.ts +64 -0
- package/src/identity/__tests__/registry.test.ts +70 -0
- package/src/identity/__tests__/transfer.test.ts +198 -0
- package/src/identity/index.ts +23 -0
- package/src/identity/registration.ts +72 -0
- package/src/identity/registry.ts +172 -0
- package/src/identity/transfer.ts +187 -0
- package/src/identity/tsconfig.json +6 -0
- package/src/index.ts +1 -0
- package/src/keys/.spec/api.d.ts +74 -0
- package/src/keys/.spec/architecture.md +13 -0
- package/src/keys/.spec/laws/keys.ts +43 -0
- package/src/keys/.spec/layout.ts +6 -0
- package/src/keys/__tests__/algorithm.test.ts +39 -0
- package/src/keys/__tests__/keys.test.ts +168 -0
- package/src/keys/algorithm.ts +33 -0
- package/src/keys/credential.ts +112 -0
- package/src/keys/index.ts +14 -0
- package/src/keys/pair.ts +219 -0
- package/src/keys/tsconfig.json +6 -0
- package/src/lib/__tests__/admin-target.test.ts +67 -7
- package/src/lib/__tests__/binary.test.ts +2 -3
- package/src/lib/__tests__/command-dx.test.ts +2 -2
- package/src/lib/__tests__/config.test.ts +3 -2
- package/src/lib/__tests__/idp.test.ts +4 -6
- package/src/lib/__tests__/instance-target.test.ts +7 -4
- package/src/lib/__tests__/local-status.test.ts +1 -1
- package/src/lib/__tests__/log.test.ts +31 -0
- package/src/lib/__tests__/meta.test.ts +55 -0
- package/src/lib/__tests__/sdk-deps.test.ts +1 -1
- package/src/lib/__tests__/self.test.ts +8 -230
- package/src/lib/__tests__/use-target.test.ts +1 -1
- package/src/lib/__tests__/view-open-intent.test.ts +78 -104
- package/src/lib/__tests__/view-session.test.ts +99 -0
- package/src/lib/admin-domain.ts +39 -25
- package/src/lib/admin-instance.ts +38 -43
- package/src/lib/admin-target.ts +67 -13
- package/src/lib/binary.ts +13 -34
- package/src/lib/browser.ts +1 -1
- package/src/{kernel → lib}/ca-fetch.ts +35 -27
- package/src/lib/config.ts +1 -1
- package/src/lib/idp-session.ts +1 -1
- package/src/lib/idp.ts +3 -8
- package/src/lib/instance-target.ts +12 -8
- package/src/lib/instance.ts +34 -2
- package/src/lib/local-status.ts +2 -2
- package/src/lib/log.ts +3 -1
- package/src/lib/login-flow.ts +32 -5
- package/src/lib/meta.ts +15 -11
- package/src/lib/provision-instance.ts +4 -12
- package/src/lib/self.ts +5 -147
- package/src/lib/update.ts +1 -1
- package/src/lib/use-target.ts +1 -1
- package/src/lib/validation.ts +2 -2
- package/src/lib/view/open-intent.ts +7 -37
- package/src/lib/view/port-allocation.ts +1 -1
- package/src/lib/view/resolve.ts +52 -45
- package/src/lib/view/server.ts +16 -33
- package/src/lib/view/session.ts +51 -22
- package/src/paths/.spec/api.d.ts +13 -0
- package/src/paths/.spec/architecture.md +5 -0
- package/src/paths/.spec/layout.ts +3 -0
- package/src/paths/index.ts +13 -0
- package/src/program/.spec/api.d.ts +42 -0
- package/src/program/.spec/architecture.md +18 -0
- package/src/program/.spec/laws/program.ts +29 -0
- package/src/program/.spec/layout.ts +14 -0
- package/src/program/__tests__/program.test.ts +359 -0
- package/src/program/build.ts +190 -0
- package/src/program/command.ts +42 -0
- package/src/program/index.ts +2 -0
- package/src/program/options.ts +40 -0
- package/src/{registry.ts → program/registry.ts} +5 -1
- package/src/program/tsconfig.json +6 -0
- package/src/setup/steps/admin.ts +18 -3
- package/src/setup/steps/instance.ts +1 -1
- package/src/state/.spec/api.d.ts +133 -0
- package/src/state/.spec/architecture.md +31 -0
- package/src/state/.spec/capabilities/state.ts +7 -0
- package/src/state/.spec/flows/identity-update.ts +22 -0
- package/src/state/.spec/laws/state.ts +73 -0
- package/src/state/.spec/layout.ts +14 -0
- package/src/state/__tests__/exchange-credentials.test.ts +188 -0
- package/src/state/__tests__/files.test.ts +113 -0
- package/src/state/__tests__/fixtures/identity-transition.ts +37 -0
- package/src/state/__tests__/identities.test.ts +142 -0
- package/src/state/__tests__/paths.test.ts +27 -0
- package/src/state/exchange-credentials.ts +219 -0
- package/src/state/files.ts +129 -0
- package/src/state/identities.ts +236 -0
- package/src/state/index.ts +29 -0
- package/src/state/paths.ts +61 -0
- package/src/state/tsconfig.json +6 -0
- package/src/telemetry/__tests__/redact.test.ts +3 -3
- package/src/telemetry/__tests__/trigger.test.ts +1 -1
- package/src/telemetry/settings.ts +1 -1
- package/src/telemetry/store.ts +1 -1
- package/src/test-utils.ts +1 -1
- package/studio/client/dist/assets/elk-api-D0cBetPW.js +1 -0
- package/studio/client/dist/assets/elk-worker.min-C9JGDOE-.js +6312 -0
- package/studio/client/dist/assets/index-BQnJ5sgd.css +1 -0
- package/studio/client/dist/assets/index-ChOr3yP0.css +1 -0
- package/studio/client/dist/assets/index-Dspir4w7.js +81 -0
- package/studio/client/dist/assets/index-bVD2KJgz.js +8 -0
- package/studio/client/dist/index.html +2 -2
- package/studio/package.json +10 -1
- package/studio/server/introspect/extractor.ts +1 -1
- package/studio/server/state/views.test.ts +3 -7
- package/studio/server/state/views.ts +23 -30
- package/studio/tsconfig.json +23 -0
- package/tsconfig.json +1 -1
- package/viewer/dist/main.js +65 -39
- package/viewer/tsconfig.json +13 -0
- package/src/command.ts +0 -42
- package/src/commands/__tests__/help-contract.test.ts +0 -164
- package/src/kernel/__tests__/client-owned-lookup.test.ts +0 -51
- package/src/kernel/__tests__/errors.test.ts +0 -43
- package/src/kernel/__tests__/expand.test.ts +0 -123
- package/src/kernel/client.ts +0 -214
- package/src/kernel/expand.ts +0 -192
- package/src/kernel/graph.ts +0 -96
- package/src/kernel/index.ts +0 -29
- package/src/kernel/options.ts +0 -22
- package/src/kernel/types.ts +0 -14
- package/src/lib/__tests__/domain-identity.test.ts +0 -60
- package/src/lib/__tests__/fs-atomic.test.ts +0 -104
- package/src/lib/__tests__/identity.test.ts +0 -79
- package/src/lib/__tests__/keys.test.ts +0 -129
- package/src/lib/domain-identity.ts +0 -49
- package/src/lib/env.ts +0 -49
- package/src/lib/fs-atomic.ts +0 -126
- package/src/lib/identity.ts +0 -256
- package/src/lib/keys.ts +0 -294
- package/src/lib/paths.ts +0 -11
- package/src/program.ts +0 -213
- package/studio/client/dist/assets/index-BaqEuIQJ.js +0 -109
- package/studio/client/dist/assets/index-jRdExahh.css +0 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** CLI-stable projection of one caller-visible Admin Instance. */
|
|
2
|
+
export type InstanceState = 'provisioning' | 'ready' | 'deleting' | 'failed' | 'deleted';
|
|
3
|
+
export interface InstanceInfo {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly slug: string;
|
|
6
|
+
readonly url: string;
|
|
7
|
+
readonly hostId?: string;
|
|
8
|
+
readonly region?: string;
|
|
9
|
+
readonly state?: InstanceState;
|
|
10
|
+
readonly phase?: string;
|
|
11
|
+
readonly error?: string | null;
|
|
12
|
+
readonly createdAt?: string;
|
|
13
|
+
readonly organizationId?: string;
|
|
14
|
+
}
|
|
15
|
+
/** An Instance returned through the caller-scoped Admin graph inventory. */
|
|
16
|
+
export interface OwnedInstanceInfo extends InstanceInfo {
|
|
17
|
+
readonly state: InstanceState;
|
|
18
|
+
}
|
|
19
|
+
export interface DomainInstallReceipt {
|
|
20
|
+
readonly domain: string;
|
|
21
|
+
readonly instance: string;
|
|
22
|
+
readonly origin: string;
|
|
23
|
+
readonly ok: boolean;
|
|
24
|
+
readonly installedRevision?: string;
|
|
25
|
+
readonly error?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare class AdminInstanceNotFoundError extends Error {
|
|
28
|
+
readonly identifier: string;
|
|
29
|
+
readonly name = "NotFoundError";
|
|
30
|
+
constructor(identifier: string);
|
|
31
|
+
}
|
|
32
|
+
export declare class AdminHostNotFoundError extends Error {
|
|
33
|
+
readonly identifier: string;
|
|
34
|
+
readonly name = "NotFoundError";
|
|
35
|
+
constructor(identifier: string);
|
|
36
|
+
}
|
|
37
|
+
/** Match an owner-scoped Instance by slug, canonical Node Path, or bare Node id. */
|
|
38
|
+
export declare function findOwnedInstance(instances: readonly OwnedInstanceInfo[], identifier: string): OwnedInstanceInfo | undefined;
|
|
39
|
+
/** Human-readable location of an Instance (state, region, and Host Path). */
|
|
40
|
+
export declare function formatInstanceLocation(info: InstanceInfo): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Temporary compatibility surface for the observed `@astrale-os/connect-host`
|
|
3
|
+
* consumer. Keep this file as re-exports only: CLI state and connection owners
|
|
4
|
+
* remain authoritative, and no Kernel Client implementation type is exposed.
|
|
5
|
+
*/
|
|
6
|
+
export { getDefault, getIdentity, readIdentities } from './identity/registry';
|
|
7
|
+
export type { Identity, IdentityStore } from './identity/registry';
|
|
8
|
+
export { listIdentityKeys, signAs } from './keys/index';
|
|
9
|
+
export { normalizeInstanceKernelUrl, orgIdForAudience, readInstances, resetInstancesMemo, resolveInstance, } from './lib/instance';
|
|
10
|
+
export type { InstanceEntry, InstanceStore, ResolvedInstance } from './lib/instance';
|
|
11
|
+
export { resolveInstanceTarget } from './lib/instance-target';
|
|
12
|
+
export type { ResolvedInstanceTarget } from './lib/instance-target';
|
|
13
|
+
export { readConfig } from './lib/config';
|
|
14
|
+
export type { AstraleConfig } from './lib/config';
|
|
15
|
+
export { IdpOrgMembershipError, IdpRefreshTransientError, resolveCredential, } from './connection/auth';
|
|
16
|
+
export { loginViaIdp, resolveIdpName } from './lib/login-flow';
|
|
17
|
+
export type { DeviceVerification, LoginFlowOpts, LoginResult } from './lib/login-flow';
|
|
18
|
+
export { isSessionExpired, readIdpSession } from './lib/idp';
|
|
19
|
+
export type { IdpSession } from './lib/idp';
|
|
20
|
+
export { AuthError } from './errors';
|
|
21
|
+
export { fetchWithCaFile } from './lib/ca-fetch';
|
|
22
|
+
export { createPaths, paths } from './state/index';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AstraleConfig } from '../lib/config';
|
|
2
|
+
import { type Identity } from '../identity/registry';
|
|
3
|
+
export type KeyIdentityAuthOptions = {
|
|
4
|
+
issuer: string;
|
|
5
|
+
subject?: string;
|
|
6
|
+
audience: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Resolve a signed JWT credential from CLI options.
|
|
10
|
+
*
|
|
11
|
+
* The **audience** is passed in explicitly by the caller because transport URL
|
|
12
|
+
* and kernel issuer can differ for remote deployments.
|
|
13
|
+
*
|
|
14
|
+
* Three cases, in order of priority:
|
|
15
|
+
* 1. `opts.creds` — pre-signed credential, returned as-is.
|
|
16
|
+
* 2. `opts.as` — sign as a named local identity.
|
|
17
|
+
* 3. Default — sign as the active local identity. If the identity has a
|
|
18
|
+
* registration for the target instance, use that target-issued `(iss, sub)`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveCredential(opts: {
|
|
21
|
+
as?: string;
|
|
22
|
+
creds?: string;
|
|
23
|
+
defaultIdentity?: string;
|
|
24
|
+
}, config: AstraleConfig, audience?: string, registrationKey?: string): Promise<string>;
|
|
25
|
+
export declare function resolveKeyIdentityAuthOptions(identity: Identity, config: AstraleConfig, audience?: string, registrationKey?: string): KeyIdentityAuthOptions;
|
|
26
|
+
/** A refresh attempt failed for a reason that re-login will NOT fix. */
|
|
27
|
+
export declare class IdpRefreshTransientError extends Error {
|
|
28
|
+
constructor(message: string);
|
|
29
|
+
}
|
|
30
|
+
/** The IdP refused to scope the session to the target's organization. */
|
|
31
|
+
export declare class IdpOrgMembershipError extends Error {
|
|
32
|
+
constructor(message: string);
|
|
33
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare class AstraleError extends Error {
|
|
2
|
+
code: string;
|
|
3
|
+
hint?: string;
|
|
4
|
+
constructor(code: string, message: string, hint?: string);
|
|
5
|
+
}
|
|
6
|
+
export declare class AuthError extends AstraleError {
|
|
7
|
+
constructor(message: string, hint?: string);
|
|
8
|
+
}
|
|
9
|
+
export declare class IssuerUnreachableError extends AstraleError {
|
|
10
|
+
constructor(url: string, hint?: string);
|
|
11
|
+
}
|
|
12
|
+
export declare class ReservedSlugError extends AstraleError {
|
|
13
|
+
constructor(slug: string);
|
|
14
|
+
}
|
|
15
|
+
export declare class IdentifierCollisionError extends AstraleError {
|
|
16
|
+
constructor(identifier: string, existingEntity: string);
|
|
17
|
+
}
|
|
18
|
+
export declare class IdentityKeyMissingError extends AstraleError {
|
|
19
|
+
constructor(subject: string);
|
|
20
|
+
}
|
|
21
|
+
export declare class NotImplementedError extends AstraleError {
|
|
22
|
+
constructor(feature: string, hint?: string);
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Identity, type IdentityMode, type IdentityStore, type Registration } from '../state/index';
|
|
2
|
+
export type { Identity, IdentityStore, Registration } from '../state/index';
|
|
3
|
+
export declare function readIdentities(): Promise<IdentityStore>;
|
|
4
|
+
export declare function createIdentity(name: string, options?: {
|
|
5
|
+
readonly subject?: string;
|
|
6
|
+
readonly mode?: IdentityMode;
|
|
7
|
+
readonly issuer?: string;
|
|
8
|
+
readonly kid?: string;
|
|
9
|
+
}): Promise<Identity>;
|
|
10
|
+
export declare function deleteIdentity(name: string): Promise<void>;
|
|
11
|
+
export declare function setDefault(name: string): Promise<void>;
|
|
12
|
+
export declare function getDefault(): Promise<Identity & {
|
|
13
|
+
readonly name: string;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function getIdentity(name: string): Promise<Identity>;
|
|
16
|
+
export declare function upsertIdpIdentity(name: string, options: {
|
|
17
|
+
readonly subject: string;
|
|
18
|
+
readonly idp: string;
|
|
19
|
+
readonly issuer: string;
|
|
20
|
+
readonly audience?: string;
|
|
21
|
+
readonly claims?: Readonly<Record<string, unknown>>;
|
|
22
|
+
readonly use?: boolean;
|
|
23
|
+
}): Promise<Identity>;
|
|
24
|
+
export declare function setRegistration(name: string, instanceSlug: string, registration: Registration): Promise<void>;
|
|
25
|
+
export declare function setIdentityMode(name: string, mode: IdentityMode): Promise<void>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the JOSE algorithm to use with this key. Prefers `privateJwk.alg`
|
|
3
|
+
* when present, falls back to inferring from `crv`/`kty` so keys generated
|
|
4
|
+
* by older CLIs that did not stamp `alg`. Throws when neither form resolves.
|
|
5
|
+
*/
|
|
6
|
+
export declare function inferAlg(privateJwk: Record<string, unknown>, keyPath?: string): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type JWK } from 'jose';
|
|
2
|
+
type AuthOptions = {
|
|
3
|
+
readonly issuer?: string;
|
|
4
|
+
readonly subject?: string;
|
|
5
|
+
readonly kid?: string;
|
|
6
|
+
};
|
|
7
|
+
export type AuthBinding = {
|
|
8
|
+
readonly credential: string;
|
|
9
|
+
readonly publicKey: {
|
|
10
|
+
readonly jwk: JWK;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare function persistAuth(keysDir?: string, opts?: AuthOptions): Promise<AuthBinding>;
|
|
14
|
+
export declare function loadAuth(keysDir?: string, opts?: AuthOptions): Promise<AuthBinding>;
|
|
15
|
+
export declare function resolveAuth(keysDir?: string, opts?: AuthOptions): Promise<AuthBinding>;
|
|
16
|
+
export declare function signAs(subject: string, keysDir?: string, opts?: {
|
|
17
|
+
readonly issuer?: string;
|
|
18
|
+
readonly audience?: string;
|
|
19
|
+
readonly subject?: string;
|
|
20
|
+
}): Promise<string>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { acceptKeypair, fileExists, generateEd25519Jwk, importKeypair, keypairPaths, listIdentityKeys, persistKeypair, readKeypair, removeKeypair, } from './pair';
|
|
2
|
+
export { loadAuth, persistAuth, resolveAuth, signAs } from './credential';
|
|
3
|
+
export type { Keypair, KeypairInput, KeypairPaths } from './pair';
|
|
4
|
+
export type { AuthBinding } from './credential';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type JWK } from 'jose';
|
|
2
|
+
export type KeypairPaths = {
|
|
3
|
+
readonly privatePath: string;
|
|
4
|
+
readonly publicPath: string;
|
|
5
|
+
};
|
|
6
|
+
export interface Keypair {
|
|
7
|
+
readonly privateJwk: JWK;
|
|
8
|
+
readonly publicJwk: JWK;
|
|
9
|
+
readonly kid?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface KeypairInput {
|
|
12
|
+
readonly privateJwk: unknown;
|
|
13
|
+
readonly publicJwk: unknown;
|
|
14
|
+
}
|
|
15
|
+
/** Preserve manager filenames and confine every subject file to the selected key directory. */
|
|
16
|
+
export declare function keypairPaths(subject: string, keysDir?: string): KeypairPaths;
|
|
17
|
+
export declare function acceptKeypair(input: KeypairInput): Promise<Keypair>;
|
|
18
|
+
export declare function fileExists(path: string): Promise<boolean>;
|
|
19
|
+
export declare function listIdentityKeys(keysDir?: string): Promise<string[]>;
|
|
20
|
+
export declare function generateEd25519Jwk(kid: string): Promise<{
|
|
21
|
+
readonly privateJwk: JWK;
|
|
22
|
+
readonly publicJwk: JWK;
|
|
23
|
+
}>;
|
|
24
|
+
export declare function persistKeypair(subject: string, opts?: {
|
|
25
|
+
readonly keysDir?: string;
|
|
26
|
+
readonly kid?: string;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
readonly publicJwk: JWK;
|
|
29
|
+
readonly privateJwk: JWK;
|
|
30
|
+
readonly kid: string;
|
|
31
|
+
}>;
|
|
32
|
+
export declare function readKeypair(subject: string, keysDir?: string): Promise<Keypair>;
|
|
33
|
+
export declare function importKeypair(subject: string, input: KeypairInput, keysDir?: string): Promise<Keypair>;
|
|
34
|
+
export declare function removeKeypair(subject: string, keysDir?: string): Promise<void>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { AstraleConfig } from './config';
|
|
3
|
+
import type { InstanceStore } from './instance';
|
|
4
|
+
export declare const DEFAULT_ADMIN_TARGET_NAME = "admin";
|
|
5
|
+
export declare const DEFAULT_ADMIN_TARGET_URL = "https://admin.eu.astrale.ai/api";
|
|
6
|
+
export declare const DEFAULT_ADMIN_DOMAIN_ISSUER = "https://admin.beta.astrale.ai";
|
|
7
|
+
export declare const DEFAULT_ADMIN_TARGET_CONFIG: {
|
|
8
|
+
name: string;
|
|
9
|
+
url: string;
|
|
10
|
+
kernelIssuer: string;
|
|
11
|
+
domainIssuer: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const AdminTargetConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
14
|
+
/** Friendly name / auth registration slug for direct URL admin targets. */
|
|
15
|
+
name: z.ZodOptional<z.ZodString>;
|
|
16
|
+
/** Direct admin kernel URL. */
|
|
17
|
+
url: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
18
|
+
/** Kernel issuer / JWT audience when different from url. */
|
|
19
|
+
kernelIssuer: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
20
|
+
/** Exact native Admin Domain issuer used by the standard token exchange. */
|
|
21
|
+
domainIssuer: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
22
|
+
/** Bookmark name for the admin kernel. */
|
|
23
|
+
instance: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
name?: string | undefined;
|
|
26
|
+
url?: string | undefined;
|
|
27
|
+
kernelIssuer?: string | undefined;
|
|
28
|
+
domainIssuer?: string | undefined;
|
|
29
|
+
instance?: string | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
name?: string | undefined;
|
|
32
|
+
url?: string | undefined;
|
|
33
|
+
kernelIssuer?: string | undefined;
|
|
34
|
+
domainIssuer?: string | undefined;
|
|
35
|
+
instance?: string | undefined;
|
|
36
|
+
}>, {
|
|
37
|
+
name?: string | undefined;
|
|
38
|
+
url?: string | undefined;
|
|
39
|
+
kernelIssuer?: string | undefined;
|
|
40
|
+
domainIssuer?: string | undefined;
|
|
41
|
+
instance?: string | undefined;
|
|
42
|
+
}, {
|
|
43
|
+
name?: string | undefined;
|
|
44
|
+
url?: string | undefined;
|
|
45
|
+
kernelIssuer?: string | undefined;
|
|
46
|
+
domainIssuer?: string | undefined;
|
|
47
|
+
instance?: string | undefined;
|
|
48
|
+
}>;
|
|
49
|
+
export type AdminTargetConfig = z.infer<typeof AdminTargetConfigSchema>;
|
|
50
|
+
export type AdminTargetCommandOpts = {
|
|
51
|
+
admin?: string;
|
|
52
|
+
adminUrl?: string;
|
|
53
|
+
domainIssuer?: string;
|
|
54
|
+
instance?: string;
|
|
55
|
+
url?: string;
|
|
56
|
+
};
|
|
57
|
+
export type AdminTargetSource = 'admin-url' | 'admin' | 'config-instance' | 'config-url' | 'default';
|
|
58
|
+
export type ResolvedAdminTarget = {
|
|
59
|
+
name: string;
|
|
60
|
+
url: string;
|
|
61
|
+
kernelIssuer: string;
|
|
62
|
+
domainIssuer: string;
|
|
63
|
+
defaultIdentity?: string;
|
|
64
|
+
caFile?: string;
|
|
65
|
+
source: AdminTargetSource;
|
|
66
|
+
configured: boolean;
|
|
67
|
+
registrationSlug: string;
|
|
68
|
+
};
|
|
69
|
+
export declare const ADMIN_TARGET_OPTIONS: {
|
|
70
|
+
flags: string;
|
|
71
|
+
description: string;
|
|
72
|
+
}[];
|
|
73
|
+
export declare function resolveAdminTarget(opts: AdminTargetCommandOpts, config: AstraleConfig, store?: InstanceStore): Promise<ResolvedAdminTarget>;
|
|
74
|
+
export declare function resolveAdminTargetFromStore(opts: AdminTargetCommandOpts, config: AstraleConfig, store: InstanceStore): ResolvedAdminTarget;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Create a Fetch capability whose HTTPS requests trust one CLI-selected CA file. */
|
|
2
|
+
export declare function fetchWithCaFile(caFile: string, fallback?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>): (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const AstraleConfigSchema: z.ZodObject<{
|
|
3
|
+
issuer: z.ZodDefault<z.ZodString>;
|
|
4
|
+
admin: z.ZodDefault<z.ZodEffects<z.ZodObject<{
|
|
5
|
+
name: z.ZodOptional<z.ZodString>;
|
|
6
|
+
url: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
7
|
+
kernelIssuer: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
8
|
+
domainIssuer: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
9
|
+
instance: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
name?: string | undefined;
|
|
12
|
+
url?: string | undefined;
|
|
13
|
+
kernelIssuer?: string | undefined;
|
|
14
|
+
domainIssuer?: string | undefined;
|
|
15
|
+
instance?: string | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
name?: string | undefined;
|
|
18
|
+
url?: string | undefined;
|
|
19
|
+
kernelIssuer?: string | undefined;
|
|
20
|
+
domainIssuer?: string | undefined;
|
|
21
|
+
instance?: string | undefined;
|
|
22
|
+
}>, {
|
|
23
|
+
name?: string | undefined;
|
|
24
|
+
url?: string | undefined;
|
|
25
|
+
kernelIssuer?: string | undefined;
|
|
26
|
+
domainIssuer?: string | undefined;
|
|
27
|
+
instance?: string | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
name?: string | undefined;
|
|
30
|
+
url?: string | undefined;
|
|
31
|
+
kernelIssuer?: string | undefined;
|
|
32
|
+
domainIssuer?: string | undefined;
|
|
33
|
+
instance?: string | undefined;
|
|
34
|
+
}>>;
|
|
35
|
+
telemetry: z.ZodDefault<z.ZodObject<{
|
|
36
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
}, {
|
|
40
|
+
enabled?: boolean | undefined;
|
|
41
|
+
}>>;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
issuer: string;
|
|
44
|
+
admin: {
|
|
45
|
+
name?: string | undefined;
|
|
46
|
+
url?: string | undefined;
|
|
47
|
+
kernelIssuer?: string | undefined;
|
|
48
|
+
domainIssuer?: string | undefined;
|
|
49
|
+
instance?: string | undefined;
|
|
50
|
+
};
|
|
51
|
+
telemetry: {
|
|
52
|
+
enabled: boolean;
|
|
53
|
+
};
|
|
54
|
+
}, {
|
|
55
|
+
issuer?: string | undefined;
|
|
56
|
+
admin?: {
|
|
57
|
+
name?: string | undefined;
|
|
58
|
+
url?: string | undefined;
|
|
59
|
+
kernelIssuer?: string | undefined;
|
|
60
|
+
domainIssuer?: string | undefined;
|
|
61
|
+
instance?: string | undefined;
|
|
62
|
+
} | undefined;
|
|
63
|
+
telemetry?: {
|
|
64
|
+
enabled?: boolean | undefined;
|
|
65
|
+
} | undefined;
|
|
66
|
+
}>;
|
|
67
|
+
export type AstraleConfig = z.infer<typeof AstraleConfigSchema>;
|
|
68
|
+
export declare const DEFAULT_CONFIG: AstraleConfig;
|
|
69
|
+
export declare function readConfig(): Promise<AstraleConfig>;
|
|
70
|
+
export declare function writeConfig(config: AstraleConfig): Promise<void>;
|
|
71
|
+
export declare function configExists(): Promise<boolean>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatElapsed(ms: number): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type IdpSession } from './idp';
|
|
2
|
+
/** No cached session file exists for the identity — only a login creates one. */
|
|
3
|
+
export declare class IdpSessionMissingError extends Error {
|
|
4
|
+
readonly identityName: string;
|
|
5
|
+
constructor(identityName: string);
|
|
6
|
+
}
|
|
7
|
+
/** The session needs a refresh but never received a refresh token. */
|
|
8
|
+
export declare class IdpSessionNoRefreshTokenError extends Error {
|
|
9
|
+
readonly identityName: string;
|
|
10
|
+
constructor(identityName: string);
|
|
11
|
+
}
|
|
12
|
+
export type EnsureFreshSessionOptions = {
|
|
13
|
+
audience?: string;
|
|
14
|
+
organizationId?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Org-hint resolver, consulted only when a refresh actually happens.
|
|
17
|
+
* Defaults to `fetchOrgHint`; injectable for tests.
|
|
18
|
+
*/
|
|
19
|
+
resolveOrganizationId?: (audience: string) => Promise<string | undefined>;
|
|
20
|
+
};
|
|
21
|
+
export declare function idpSessionLockPath(identityName: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Return a session holding a fresh access token for `audience`, refreshing it
|
|
24
|
+
* if needed. This is the ONLY correct way to refresh: WorkOS refresh tokens
|
|
25
|
+
* are single-use, so two processes refreshing concurrently burn the same
|
|
26
|
+
* token — the loser's `invalid_grant` can revoke the whole upstream session.
|
|
27
|
+
* All refreshes therefore serialize on a per-identity file lock, and waiters
|
|
28
|
+
* re-read the rotated session instead of re-exchanging.
|
|
29
|
+
*
|
|
30
|
+
* `IdpAudienceMismatchError` propagates verbatim (the session is healthy; the
|
|
31
|
+
* IdP just won't mint that audience).
|
|
32
|
+
*/
|
|
33
|
+
export declare function ensureFreshSession(identityName: string, opts?: EnsureFreshSessionOptions): Promise<IdpSession>;
|