@astrale-os/cli 1.0.0-beta.0 → 1.0.0-beta.10
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 +23 -12
- package/dist/astrale.js +51494 -56307
- package/dist/public/connect-core.js +2028 -26846
- package/dist/public/keys/index.js +1755 -40694
- package/dist/public/paths/index.js +859 -39518
- package/dist/types/admin/binding.d.ts +19 -0
- package/dist/types/admin/instance/client.d.ts +22 -0
- package/dist/types/admin/instance/index.d.ts +2 -0
- package/dist/types/admin/instance/model.d.ts +5 -12
- package/dist/types/connection/auth.d.ts +3 -0
- package/dist/types/connection/call.d.ts +3 -0
- package/dist/types/connection/command.d.ts +27 -0
- package/dist/types/connection/credential.d.ts +14 -0
- package/dist/types/connection/errors.d.ts +1 -0
- package/dist/types/connection/exchange.d.ts +9 -0
- package/dist/types/connection/failure/classify.d.ts +2 -0
- package/dist/types/connection/failure/index.d.ts +5 -0
- package/dist/types/connection/failure/model.d.ts +25 -0
- package/dist/types/connection/failure/render.d.ts +3 -0
- package/dist/types/connection/index.d.ts +8 -0
- package/dist/types/connection/reasons.d.ts +37 -0
- package/dist/types/connection/self.d.ts +37 -0
- package/dist/types/connection/session.d.ts +31 -0
- package/dist/types/connection/target.d.ts +38 -0
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/lib/admin-instance.d.ts +17 -0
- package/dist/types/lib/admin-target.d.ts +6 -2
- package/dist/types/lib/failure-debug.d.ts +1 -0
- package/dist/types/lib/idp.d.ts +7 -0
- package/dist/types/lib/instance-target.d.ts +1 -1
- package/dist/types/lib/instance.d.ts +10 -2
- package/dist/types/lib/log.d.ts +5 -3
- package/dist/types/lib/meta.d.ts +2 -2
- package/dist/types/lib/proc.d.ts +43 -0
- package/dist/types/lib/self.d.ts +9 -0
- package/dist/types/lib/update.d.ts +131 -0
- package/package.json +8 -10
- package/src/__tests__/fixtures/publication.ts +20 -0
- package/src/admin/__tests__/binding.test.ts +31 -0
- package/src/admin/__tests__/fixture.ts +101 -0
- package/src/admin/binding.ts +98 -0
- package/src/admin/catalog/.spec/api.d.ts +2 -2
- package/src/admin/catalog/__tests__/client.test.ts +20 -49
- package/src/admin/catalog/client.ts +36 -32
- package/src/admin/catalog/model.ts +3 -4
- package/src/admin/graph/.spec/api.d.ts +4 -10
- package/src/admin/graph/nodes.ts +1 -1
- package/src/admin/instance/.spec/api.d.ts +2 -2
- package/src/admin/instance/__tests__/client.test.ts +40 -163
- package/src/admin/instance/client.ts +35 -137
- package/src/admin/instance/index.ts +1 -2
- package/src/admin/instance/model.ts +11 -20
- package/src/commands/__tests__/admin-instance.test.ts +11 -8
- package/src/commands/__tests__/auth-login.test.ts +54 -1
- package/src/commands/__tests__/call-describe.test.ts +46 -33
- package/src/commands/__tests__/call.test.ts +5 -1
- package/src/commands/__tests__/domain-install-operation.test.ts +12 -7
- package/src/commands/__tests__/domain-install-owned.test.ts +6 -2
- package/src/commands/__tests__/domain-list.test.ts +63 -4
- package/src/commands/__tests__/install-identity-override.test.ts +19 -19
- package/src/commands/__tests__/instance-list-rows.test.ts +1 -1
- package/src/commands/__tests__/instance-status.test.ts +139 -0
- package/src/commands/__tests__/read-commands.test.ts +35 -10
- package/src/commands/__tests__/studio-descriptor.test.ts +22 -0
- package/src/commands/__tests__/update.test.ts +95 -0
- package/src/commands/call-describe.ts +60 -68
- package/src/commands/call.ts +43 -56
- package/src/commands/domain/install.ts +13 -17
- package/src/commands/domain/list.ts +18 -13
- package/src/commands/domain/publish.ts +14 -11
- package/src/commands/domain/uninstall.ts +2 -2
- package/src/commands/get.ts +14 -15
- package/src/commands/identity/__tests__/register.test.ts +3 -3
- package/src/commands/identity/register.ts +5 -4
- package/src/commands/instance/create.ts +8 -16
- package/src/commands/instance/delete.ts +12 -9
- package/src/commands/instance/list.ts +2 -2
- package/src/commands/instance/status.ts +66 -20
- package/src/commands/instance/use.ts +16 -12
- package/src/commands/introspect.ts +9 -16
- package/src/commands/logs.ts +24 -25
- package/src/commands/mutate.ts +6 -5
- package/src/commands/query.ts +27 -30
- package/src/commands/studio.ts +20 -0
- package/src/commands/token.ts +8 -7
- package/src/commands/update.ts +68 -22
- package/src/commands/view.ts +7 -6
- package/src/connection/.spec/api.d.ts +7 -8
- package/src/connection/.spec/architecture.md +5 -4
- package/src/connection/.spec/flows/session.ts +2 -2
- package/src/connection/.spec/laws/connection.ts +6 -2
- package/src/connection/.spec/layout.ts +1 -0
- package/src/connection/__tests__/credential.test.ts +20 -1
- package/src/connection/__tests__/errors.test.ts +43 -32
- package/src/connection/__tests__/exchange.test.ts +36 -6
- package/src/connection/__tests__/failure-fixtures.ts +39 -0
- package/src/connection/__tests__/failure-safety.test.ts +75 -0
- package/src/connection/__tests__/self.test.ts +31 -11
- package/src/connection/__tests__/session.test.ts +3 -3
- package/src/connection/__tests__/target.test.ts +1 -0
- package/src/connection/auth.ts +13 -0
- package/src/connection/call.ts +1 -1
- package/src/connection/credential.ts +2 -2
- package/src/connection/errors.ts +1 -355
- package/src/connection/exchange.ts +52 -27
- package/src/connection/failure/classify.ts +110 -0
- package/src/connection/failure/index.ts +18 -0
- package/src/connection/failure/model.ts +28 -0
- package/src/connection/failure/render.ts +116 -0
- package/src/connection/reasons.ts +16 -0
- package/src/connection/self.ts +39 -21
- package/src/connection/session.ts +19 -8
- package/src/errors.ts +3 -2
- package/src/graph/.spec/api.d.ts +12 -5
- package/src/graph/.spec/layout.ts +9 -1
- package/src/graph/__tests__/mutation.test.ts +2 -2
- package/src/graph/__tests__/query.test.ts +25 -6
- package/src/graph/class.ts +30 -0
- package/src/graph/index.ts +1 -0
- package/src/graph/query.ts +21 -32
- package/src/identity/.spec/api.d.ts +2 -2
- package/src/identity/__tests__/registration.test.ts +1 -1
- package/src/identity/registration.ts +3 -3
- package/src/keys/__tests__/keys.test.ts +4 -0
- package/src/keys/credential.ts +1 -0
- package/src/lib/__tests__/admin-target.test.ts +12 -0
- package/src/lib/__tests__/command-dx.test.ts +1 -1
- package/src/lib/__tests__/domain-publication.test.ts +138 -0
- package/src/lib/__tests__/idp-session.test.ts +22 -0
- package/src/lib/__tests__/idp.test.ts +36 -4
- package/src/lib/__tests__/instance-candidates.test.ts +1 -3
- package/src/lib/__tests__/instance-target.test.ts +7 -39
- package/src/lib/__tests__/instance.test.ts +6 -0
- package/src/lib/__tests__/log-errors.test.ts +64 -0
- package/src/lib/__tests__/studio-server-deps.test.ts +53 -16
- package/src/lib/__tests__/update.test.ts +113 -8
- package/src/lib/__tests__/view-open-intent.test.ts +0 -2
- package/src/lib/__tests__/view-server.test.ts +1 -1
- package/src/lib/__tests__/view-session.test.ts +1 -1
- package/src/lib/admin-instance.ts +14 -8
- package/src/lib/admin-target.ts +21 -2
- package/src/lib/command-dx.ts +9 -9
- package/src/lib/domain-publication.ts +104 -0
- package/src/lib/failure-debug.ts +26 -0
- package/src/lib/idp.ts +39 -4
- package/src/lib/instance-candidates.ts +2 -2
- package/src/lib/instance-target.ts +3 -14
- package/src/lib/instance.ts +22 -12
- package/src/lib/log.ts +16 -9
- package/src/lib/login-flow.ts +13 -3
- package/src/lib/meta.ts +2 -2
- package/src/lib/provision-instance.ts +34 -57
- package/src/lib/update.ts +124 -30
- package/src/lib/validation.ts +2 -2
- package/src/lib/view/resolve.ts +1 -1
- package/src/program/__tests__/program.test.ts +20 -4
- package/src/program/build.ts +2 -2
- package/src/setup/__tests__/instance-step.test.ts +27 -10
- package/src/setup/steps/instance.ts +22 -15
- package/studio/client/dist/assets/{elk-api-D2xgMJvi.js → elk-api-ByzoDZWH.js} +1 -1
- package/studio/client/dist/assets/index-B0RCgUOT.js +8 -0
- package/studio/client/dist/assets/index-BiGR8Oo9.css +1 -0
- package/studio/client/dist/assets/index-N8J8EKlB.js +81 -0
- package/studio/client/dist/index.html +2 -2
- package/studio/package.json +5 -10
- package/studio/server/agent/ask.test.ts +1 -1
- package/studio/server/agent/bridge/grant.test.ts +1 -1
- package/studio/server/agent/bridge/routes.test.ts +1 -1
- package/studio/server/agent/bridge/stdio.ts +8 -1
- package/studio/server/agent/conversation.test.ts +10 -5
- package/studio/server/agent/conversation.ts +56 -8
- package/studio/server/agent/harness/claude/adapter.test.ts +15 -5
- package/studio/server/agent/harness/codex/loadout.ts +18 -21
- package/studio/server/agent/harness/gateway/config.ts +20 -18
- package/studio/server/agent/harness/selection.ts +9 -1
- package/studio/server/agent/prompts/anchors.test.ts +32 -36
- package/studio/server/agent/prompts/anchors.ts +20 -49
- package/studio/server/agent/prompts/system.test.ts +3 -2
- package/studio/server/agent/prompts/system.ts +6 -5
- package/studio/server/agent/prompts/turn.ts +13 -4
- package/studio/server/agent/routes.test.ts +1 -1
- package/studio/server/agent/run/completion.ts +2 -2
- package/studio/server/agent/run/coordinator.test.ts +1 -1
- package/studio/server/agent/run/preparation.ts +6 -5
- package/studio/server/agent/run/transcript.test.ts +35 -1
- package/studio/server/agent/run/transcript.ts +169 -3
- package/studio/server/agent/run/usage.test.ts +24 -0
- package/studio/server/agent/run/usage.ts +26 -1
- package/studio/server/api/canvas.ts +43 -0
- package/studio/server/api/comments.ts +85 -0
- package/studio/server/api/context.ts +61 -0
- package/studio/server/api/deployment.ts +39 -0
- package/studio/server/api/documents.ts +55 -0
- package/studio/server/api/domain.ts +59 -0
- package/studio/server/api/http.ts +45 -0
- package/studio/server/api/project.ts +57 -0
- package/studio/server/api/schema.ts +12 -0
- package/studio/server/api/views.ts +57 -0
- package/studio/server/api/workspace.ts +60 -0
- package/studio/server/api-agent-loadout.test.ts +1 -1
- package/studio/server/api.test.ts +147 -0
- package/studio/server/api.ts +20 -422
- package/studio/server/cache.test.ts +122 -0
- package/studio/server/cache.ts +162 -11
- package/studio/server/cli-consumers.test.ts +494 -0
- package/studio/server/cli.test.ts +88 -0
- package/studio/server/cli.ts +240 -0
- package/studio/server/client-package.ts +25 -1
- package/studio/server/domain.test.ts +50 -40
- package/studio/server/domain.ts +83 -52
- package/studio/server/environment/dotenv-preview.test.ts +39 -0
- package/studio/server/environment/dotenv-preview.ts +27 -0
- package/studio/server/environment/files.test.ts +53 -0
- package/studio/server/{state/env.ts → environment/files.ts} +7 -48
- package/studio/server/{state → handoff}/copy.ts +21 -6
- package/studio/server/handoff/service.test.ts +22 -0
- package/studio/server/{state/handoff.ts → handoff/service.ts} +21 -14
- package/studio/server/index.ts +1 -1
- package/studio/server/instances/active.ts +72 -0
- package/studio/server/instances/deploy-record.test.ts +31 -0
- package/studio/server/instances/deploy-record.ts +37 -0
- package/studio/server/instances/deploy.ts +56 -0
- package/studio/server/{state/instance.test.ts → instances/probe.test.ts} +25 -21
- package/studio/server/instances/probe.ts +67 -0
- package/studio/server/instances/status.test.ts +12 -0
- package/studio/server/instances/status.ts +49 -0
- package/studio/server/introspect/anatomy/client-tree.ts +57 -0
- package/studio/server/introspect/anatomy/env-fields.ts +66 -0
- package/studio/server/introspect/anatomy/schema-definition.ts +53 -0
- package/studio/server/introspect/anatomy/source.ts +181 -0
- package/studio/server/introspect/anatomy/views/routes.ts +114 -0
- package/studio/server/introspect/anatomy/views.ts +53 -0
- package/studio/server/introspect/anatomy-extras.test.ts +106 -35
- package/studio/server/introspect/anatomy-extras.ts +7 -726
- package/studio/server/introspect/anatomy.test.ts +22 -14
- package/studio/server/introspect/anatomy.ts +52 -28
- package/studio/server/introspect/bundle.ts +15 -9
- package/studio/server/introspect/canonical-schema.test.ts +93 -309
- package/studio/server/introspect/canonical-schema.ts +257 -425
- package/studio/server/introspect/config-preview.test.ts +32 -0
- package/studio/server/introspect/config-preview.ts +119 -0
- package/studio/server/introspect/core-extractor.ts +18 -127
- package/studio/server/introspect/core.ts +1 -2
- package/studio/server/introspect/diff.test.ts +18 -18
- package/studio/server/introspect/diff.ts +44 -90
- package/studio/server/introspect/extractor.ts +23 -116
- package/studio/server/introspect/hash.ts +5 -2
- package/studio/server/introspect/overlay-tsmorph.test.ts +119 -240
- package/studio/server/introspect/overlay-tsmorph.ts +7 -1305
- package/studio/server/introspect/overlay.test.ts +26 -54
- package/studio/server/introspect/overlay.ts +10 -37
- package/studio/server/introspect/revision.test.ts +54 -0
- package/studio/server/introspect/revision.ts +49 -0
- package/studio/server/introspect/runtime.test.ts +83 -143
- package/studio/server/introspect/runtime.ts +40 -11
- package/studio/server/introspect/schema-ir-json.test.ts +70 -0
- package/studio/server/introspect/schema-ir-json.ts +151 -0
- package/studio/server/introspect/schema-refs.test.ts +43 -88
- package/studio/server/introspect/schema-refs.ts +14 -49
- package/studio/server/introspect/source-overlay/annotations.ts +14 -0
- package/studio/server/introspect/source-overlay/handlers.ts +161 -0
- package/studio/server/introspect/source-overlay/kernel-calls.ts +46 -0
- package/studio/server/introspect/source-overlay/project.ts +248 -0
- package/studio/server/introspect/source-overlay/spans.ts +330 -0
- package/studio/server/json.ts +46 -0
- package/studio/server/lifecycle.ts +5 -1
- package/studio/server/sse.test.ts +26 -0
- package/studio/server/sse.ts +4 -1
- package/studio/server/state/baseline.test.ts +223 -7
- package/studio/server/state/baseline.ts +148 -34
- package/studio/server/state/comments.test.ts +66 -1
- package/studio/server/state/comments.ts +173 -10
- package/studio/server/state/context.ts +34 -2
- package/studio/server/state/documents.ts +42 -1
- package/studio/server/state/integrations.ts +27 -1
- package/studio/server/state/layout.test.ts +34 -0
- package/studio/server/state/layout.ts +44 -17
- package/studio/server/state/settings.ts +29 -22
- package/studio/server/state/store.test.ts +122 -0
- package/studio/server/state/store.ts +66 -17
- package/studio/server/state/visibility.ts +22 -11
- package/studio/server/views/model.test.ts +57 -0
- package/studio/server/views/model.ts +66 -0
- package/studio/server/views/runtime.ts +40 -0
- package/studio/server/views/selection-repository.test.ts +31 -0
- package/studio/server/views/selection-repository.ts +60 -0
- package/studio/server/views/session.test.ts +73 -0
- package/studio/server/views/session.ts +166 -0
- package/studio/server/views/target.test.ts +78 -0
- package/studio/server/views/target.ts +222 -0
- package/studio/server/watch.test.ts +11 -11
- package/studio/server/watch.ts +9 -5
- package/studio/server/workspace/catalog.test.ts +17 -0
- package/studio/server/workspace/catalog.ts +43 -0
- package/studio/server/{state → workspace}/create.test.ts +1 -1
- package/studio/server/{state → workspace}/create.ts +1 -1
- package/studio/server/{state → workspace}/git.ts +1 -1
- package/studio/server/workspace/updates.ts +83 -0
- package/studio/server/workspace-state.ts +1 -1
- package/studio/server/workspace-watch.ts +2 -2
- package/studio/shared/contracts/README.md +16 -0
- package/studio/shared/contracts/agent.ts +270 -0
- package/studio/shared/contracts/runtime.ts +50 -0
- package/studio/shared/contracts/schema.ts +393 -0
- package/studio/shared/contracts/surface.test.ts +317 -0
- package/studio/shared/contracts/workspace.ts +265 -0
- package/studio/shared/layout.test.ts +116 -0
- package/studio/shared/schema/identity.test.ts +34 -0
- package/studio/shared/schema/identity.ts +68 -0
- package/studio/shared/types.ts +11 -1099
- package/studio/tsconfig.json +1 -1
- package/viewer/dist/main.js +40 -61
- package/.check-workspace.cjs +0 -40
- package/src/commands/__tests__/instance-create-hosts.test.ts +0 -29
- package/studio/client/dist/assets/index-BMdnsIJA.css +0 -1
- package/studio/client/dist/assets/index-D-vRV8w7.js +0 -8
- package/studio/client/dist/assets/index-LGSWRrk8.js +0 -81
- package/studio/server/state/catalog.ts +0 -117
- package/studio/server/state/instance.ts +0 -280
- package/studio/server/state/updates.ts +0 -63
- package/studio/server/state/views.test.ts +0 -286
- package/studio/server/state/views.ts +0 -535
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Input } from '@astrale-os/sdk/client';
|
|
2
|
+
import type { ClientSession } from '@astrale-os/sdk/client/session';
|
|
3
|
+
import type { ResolvedClass, ResolvedProperty } from '@astrale-os/sdk/schema';
|
|
4
|
+
import type { DomainBinding } from '@astrale-os/shell';
|
|
5
|
+
import { Path } from '@astrale-os/sdk/graph/path';
|
|
6
|
+
export type AdminBinding = DomainBinding;
|
|
7
|
+
/** Bind the exact Admin revision installed on this source Kernel. */
|
|
8
|
+
export declare function bindAdmin(session: ClientSession): Promise<AdminBinding>;
|
|
9
|
+
/** Admit an injected dynamic binding as the Admin Domain. */
|
|
10
|
+
export declare function requireAdminBinding(binding: AdminBinding): AdminBinding;
|
|
11
|
+
/** Resolve one required Admin Class without rebuilding its schema contract. */
|
|
12
|
+
export declare function requireAdminClass(binding: AdminBinding, name: string, kind: 'node'): ResolvedClass<'node'>;
|
|
13
|
+
export declare function requireAdminClass(binding: AdminBinding, name: string, kind: 'edge'): ResolvedClass<'edge'>;
|
|
14
|
+
/** Resolve one required Admin Core Node as its canonical projection Path. */
|
|
15
|
+
export declare function requireAdminCore(binding: AdminBinding, name: string): Path;
|
|
16
|
+
/** Resolve one effective Property by unambiguous member name. */
|
|
17
|
+
export declare function requireAdminProperty(owner: ResolvedClass, name: string): ResolvedProperty<unknown>;
|
|
18
|
+
/** Invoke one resolved executable instance Method through Kernel Client. */
|
|
19
|
+
export declare function invokeAdminMethod(session: ClientSession, binding: AdminBinding, owner: ResolvedClass<'node'>, name: string, receiver: Path, input: Input): Promise<unknown>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ClientSession } from '@astrale-os/sdk/client/session';
|
|
2
|
+
import { type AdminBinding } from '../binding';
|
|
3
|
+
import { type DomainInstallReceipt, type InstanceInfo, type OwnedInstanceInfo } from './model';
|
|
4
|
+
export interface AdminInstanceContext {
|
|
5
|
+
readonly session: ClientSession;
|
|
6
|
+
}
|
|
7
|
+
export interface AdminInstanceApi {
|
|
8
|
+
list(): Promise<OwnedInstanceInfo[]>;
|
|
9
|
+
create(slug: string): Promise<InstanceInfo>;
|
|
10
|
+
status(identifier: string): Promise<InstanceInfo>;
|
|
11
|
+
delete(identifier: string): Promise<InstanceInfo>;
|
|
12
|
+
installDomain(identifier: string, domain: string): Promise<DomainInstallReceipt>;
|
|
13
|
+
}
|
|
14
|
+
export interface AdminInstanceDependencies {
|
|
15
|
+
readonly bind?: (session: ClientSession) => Promise<AdminBinding>;
|
|
16
|
+
readonly operationId?: (kind: 'create' | 'status' | 'delete' | 'install-domain') => string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Bind one discovered Admin root revision and expose only the public Instance
|
|
20
|
+
* product journey. No Host lifecycle method is present on this capability.
|
|
21
|
+
*/
|
|
22
|
+
export declare function connectAdminInstances(context: AdminInstanceContext, dependencies?: AdminInstanceDependencies): Promise<AdminInstanceApi>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { connectAdminInstances, type AdminInstanceApi, type AdminInstanceContext, type AdminInstanceDependencies, } from './client';
|
|
2
|
+
export { AdminInstanceNotFoundError, findOwnedInstance, formatInstanceState, type DomainInstallReceipt, type InstanceInfo, type InstanceState, type OwnedInstanceInfo, } from './model';
|
|
@@ -4,9 +4,7 @@ export interface InstanceInfo {
|
|
|
4
4
|
readonly id: string;
|
|
5
5
|
readonly slug: string;
|
|
6
6
|
readonly url: string;
|
|
7
|
-
readonly
|
|
8
|
-
readonly region?: string;
|
|
9
|
-
readonly state?: InstanceState;
|
|
7
|
+
readonly state: InstanceState;
|
|
10
8
|
readonly phase?: string;
|
|
11
9
|
readonly error?: string | null;
|
|
12
10
|
readonly createdAt?: string;
|
|
@@ -24,17 +22,12 @@ export interface DomainInstallReceipt {
|
|
|
24
22
|
readonly installedRevision?: string;
|
|
25
23
|
readonly error?: string;
|
|
26
24
|
}
|
|
27
|
-
export declare class AdminInstanceNotFoundError extends
|
|
28
|
-
readonly identifier: string;
|
|
29
|
-
readonly name = "NotFoundError";
|
|
30
|
-
constructor(identifier: string);
|
|
31
|
-
}
|
|
32
|
-
export declare class AdminHostNotFoundError extends Error {
|
|
25
|
+
export declare class AdminInstanceNotFoundError extends AstraleError {
|
|
33
26
|
readonly identifier: string;
|
|
34
|
-
readonly name = "NotFoundError";
|
|
35
27
|
constructor(identifier: string);
|
|
36
28
|
}
|
|
37
29
|
/** Match an owner-scoped Instance by slug, canonical Node Path, or bare Node id. */
|
|
38
30
|
export declare function findOwnedInstance(instances: readonly OwnedInstanceInfo[], identifier: string): OwnedInstanceInfo | undefined;
|
|
39
|
-
/** Human-readable
|
|
40
|
-
export declare function
|
|
31
|
+
/** Human-readable non-ready lifecycle state for one Instance. */
|
|
32
|
+
export declare function formatInstanceState(info: InstanceInfo): string;
|
|
33
|
+
import { AstraleError } from '../../errors';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AstraleConfig } from '../lib/config';
|
|
2
|
+
import type { ConnectionOptions, ConnectionTarget } from './target';
|
|
2
3
|
import { type Identity } from '../identity/registry';
|
|
3
4
|
import { IdpAudienceMismatchError } from '../lib/idp';
|
|
4
5
|
import { IdpSessionNoRefreshTokenError } from '../lib/idp-session';
|
|
@@ -7,6 +8,8 @@ export type KeyIdentityAuthOptions = {
|
|
|
7
8
|
subject?: string;
|
|
8
9
|
audience: string;
|
|
9
10
|
};
|
|
11
|
+
/** Pin the local identity label before a session performs any authenticated effect. */
|
|
12
|
+
export declare function bindCredentialIdentity<Options extends ConnectionOptions>(options: Options, target: ConnectionTarget): Promise<Options>;
|
|
10
13
|
/**
|
|
11
14
|
* Resolve a signed JWT credential from CLI options.
|
|
12
15
|
*
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ConnectionContext } from './session';
|
|
2
|
+
import type { ConnectionOptions } from './target';
|
|
3
|
+
export interface KernelCommandOpts extends ConnectionOptions {
|
|
4
|
+
readonly raw?: boolean;
|
|
5
|
+
readonly json?: boolean;
|
|
6
|
+
readonly format?: 'yaml' | 'json';
|
|
7
|
+
readonly debug?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface OperationRecovery {
|
|
10
|
+
readonly operation: string;
|
|
11
|
+
readonly retry: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Encapsulates the standard kernel command lifecycle:
|
|
15
|
+
* spinner → connect → call → timing → output → error handling.
|
|
16
|
+
*
|
|
17
|
+
* Commands provide a `fn` that does the actual work and an optional
|
|
18
|
+
* `format` callback for custom output. If `format` is omitted, the
|
|
19
|
+
* result is passed to the standard `output()` function.
|
|
20
|
+
*/
|
|
21
|
+
export declare function runKernelCommand<T>(input: {
|
|
22
|
+
readonly opts: KernelCommandOpts;
|
|
23
|
+
readonly label: string;
|
|
24
|
+
readonly recovery?: OperationRecovery;
|
|
25
|
+
readonly fn: (context: ConnectionContext) => Promise<T>;
|
|
26
|
+
readonly format?: (result: T, options: KernelCommandOpts, machine: boolean) => void | Promise<void>;
|
|
27
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Fetch } from '@astrale-os/sdk/client';
|
|
2
|
+
import type { SessionAuth } from '@astrale-os/sdk/client/session';
|
|
3
|
+
import { type IssuerId } from '@astrale-os/sdk/auth';
|
|
4
|
+
import type { AstraleConfig } from '../lib/config';
|
|
5
|
+
import type { ConnectionOptions, ConnectionTarget } from './target';
|
|
6
|
+
export interface SourceCredentialResolver {
|
|
7
|
+
resolve(audience: IssuerId, signal: AbortSignal): Promise<string>;
|
|
8
|
+
}
|
|
9
|
+
/** Resolve source authority; an omitted Session delegation preserves exact current authority. */
|
|
10
|
+
export declare function createConnectionCredential(expectedSourceIssuer: IssuerId, source: SourceCredentialResolver): SessionAuth;
|
|
11
|
+
/** Bind CLI identity state and Core Auth delegation to one Session auth capability. */
|
|
12
|
+
export declare function createCliCredential(target: ConnectionTarget, options: ConnectionOptions, config: AstraleConfig, fetch?: Fetch, timeoutMs?: number): SessionAuth | undefined;
|
|
13
|
+
/** Reject contradictory explicit credential selections before identity or network access. */
|
|
14
|
+
export declare function validateCredentialSelection(options: ConnectionOptions): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { formatKernelError, functionInputIssues, schemaUpgradeHint } from './failure';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IssuerId } from '@astrale-os/sdk/auth';
|
|
2
|
+
import type { Fetch } from '@astrale-os/sdk/client';
|
|
3
|
+
import type { SourceCredentialResolver } from './credential';
|
|
4
|
+
import type { ConnectionTarget } from './target';
|
|
5
|
+
import { ExchangeCredentialCache } from '../state/exchange-credentials';
|
|
6
|
+
/** Exchange exact authenticated User authority for a Domain bearer bound to this Kernel. */
|
|
7
|
+
export declare function createExchangeCredentialResolver(target: ConnectionTarget & {
|
|
8
|
+
readonly domainIssuer: IssuerId;
|
|
9
|
+
}, source: SourceCredentialResolver, fetch: Fetch, timeoutMs: number, cache?: ExchangeCredentialCache): SourceCredentialResolver;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { OperationRecovery } from '../command';
|
|
2
|
+
export { functionInputIssues, schemaUpgradeHint } from '../reasons';
|
|
3
|
+
export declare function formatKernelError(error: unknown, machine: boolean, urlArg?: string, debug?: boolean, options?: {
|
|
4
|
+
recovery?: OperationRecovery;
|
|
5
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type TransportDiagnosticContext = {
|
|
2
|
+
readonly kind: 'acquisition';
|
|
3
|
+
readonly resource: 'publication' | 'bundle';
|
|
4
|
+
} | {
|
|
5
|
+
readonly kind: 'invocation';
|
|
6
|
+
readonly delivery: 'not-sent' | 'unknown';
|
|
7
|
+
readonly invocation?: unknown;
|
|
8
|
+
};
|
|
9
|
+
export type FailureDiagnostic = {
|
|
10
|
+
readonly kind: 'simple';
|
|
11
|
+
readonly code: string;
|
|
12
|
+
readonly message: string;
|
|
13
|
+
readonly hint?: string;
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: 'response';
|
|
16
|
+
readonly code: number;
|
|
17
|
+
readonly message: string;
|
|
18
|
+
readonly reason?: unknown;
|
|
19
|
+
} | {
|
|
20
|
+
readonly kind: 'transport';
|
|
21
|
+
readonly code: 'CONNECTION_ERROR' | 'DISCONNECTED' | 'TIMEOUT' | 'TRANSPORT_ERROR';
|
|
22
|
+
readonly message: string;
|
|
23
|
+
readonly phase: string;
|
|
24
|
+
readonly context: TransportDiagnosticContext;
|
|
25
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { createPathCall } from './call';
|
|
2
|
+
export { runKernelCommand } from './command';
|
|
3
|
+
export type { KernelCommandOpts, OperationRecovery } from './command';
|
|
4
|
+
export { expandSelfInCall, expandSelfInPath, withSelfHint } from './self';
|
|
5
|
+
export type { SelfExpansionMeta } from './self';
|
|
6
|
+
export { withAdminClientSession, withClientSession, type ConnectionContext } from './session';
|
|
7
|
+
export { registrationKeyForTarget } from './target';
|
|
8
|
+
export type { AdminConnectionOptions, ConnectionOptions, ConnectionTarget } from './target';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type FunctionInputIssue = Readonly<{
|
|
2
|
+
code: string;
|
|
3
|
+
path?: string;
|
|
4
|
+
message: string;
|
|
5
|
+
}>;
|
|
6
|
+
export type QueryInputRepair = Readonly<{
|
|
7
|
+
phase: 'decode' | 'input';
|
|
8
|
+
path: string;
|
|
9
|
+
}> | Readonly<{
|
|
10
|
+
phase: 'plan';
|
|
11
|
+
issue: string;
|
|
12
|
+
path?: string;
|
|
13
|
+
}> | Readonly<{
|
|
14
|
+
phase: 'limit';
|
|
15
|
+
limit: string;
|
|
16
|
+
maximum: number;
|
|
17
|
+
actual: number;
|
|
18
|
+
path?: string;
|
|
19
|
+
}>;
|
|
20
|
+
export type SchemaUpgradeDetails = {
|
|
21
|
+
readonly origin?: string;
|
|
22
|
+
readonly issue?: undefined;
|
|
23
|
+
} | {
|
|
24
|
+
readonly origin: string;
|
|
25
|
+
readonly issue: 'issuer-changed';
|
|
26
|
+
readonly installedIssuer: string;
|
|
27
|
+
readonly replacementIssuer: string;
|
|
28
|
+
};
|
|
29
|
+
export declare function reasonCode(reason: unknown): string | undefined;
|
|
30
|
+
/** Admit only bounded caller-safe Function input issues established by the Kernel. */
|
|
31
|
+
export declare function functionInputIssues(reason: unknown): readonly FunctionInputIssue[];
|
|
32
|
+
/** Admit only public Query-input repair variants; unknown details remain machine-only. */
|
|
33
|
+
export declare function queryInputRepair(reason: unknown): QueryInputRepair | undefined;
|
|
34
|
+
/** Decode bounded recovery guidance while preserving the admitted reason itself elsewhere. */
|
|
35
|
+
export declare function schemaUpgradeDetails(reason: unknown): SchemaUpgradeDetails | undefined;
|
|
36
|
+
export declare function schemaUpgradeHint(details: SchemaUpgradeDetails): string;
|
|
37
|
+
export declare function schemaDataRemovalHint(reason: unknown): string | undefined;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ConnectionContext } from './session';
|
|
2
|
+
/** Metadata attached to errors after an authenticated caller-authored @self expansion. */
|
|
3
|
+
export interface SelfExpansionMeta {
|
|
4
|
+
readonly original: string;
|
|
5
|
+
readonly expanded: string;
|
|
6
|
+
readonly selfId: string;
|
|
7
|
+
readonly slug?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Run `action`; if it throws NodeUnavailableError, retain the authenticated
|
|
11
|
+
* expansion for precise diagnostics. The error is re-thrown either way.
|
|
12
|
+
*/
|
|
13
|
+
export declare function withSelfHint<T>(action: () => Promise<T>, meta: SelfExpansionMeta | undefined): Promise<T>;
|
|
14
|
+
type AuthenticatedSelf = {
|
|
15
|
+
readonly id?: unknown;
|
|
16
|
+
readonly slug?: string;
|
|
17
|
+
};
|
|
18
|
+
export type ResolveSelfIdDependencies = {
|
|
19
|
+
readonly whoami?: (context: ConnectionContext) => Promise<AuthenticatedSelf>;
|
|
20
|
+
};
|
|
21
|
+
/** Resolve @self only from the effective principal authenticated by the selected Kernel. */
|
|
22
|
+
export declare function resolveSelfIdAuthenticated(context: ConnectionContext, dependencies?: ResolveSelfIdDependencies): Promise<{
|
|
23
|
+
readonly id: string;
|
|
24
|
+
readonly slug?: string;
|
|
25
|
+
}>;
|
|
26
|
+
/** Expand @self in path-like commands and return metadata for NotFound diagnostics. */
|
|
27
|
+
export declare function expandSelfInPath(path: string, context: ConnectionContext): Promise<{
|
|
28
|
+
readonly path: string;
|
|
29
|
+
readonly meta?: SelfExpansionMeta;
|
|
30
|
+
}>;
|
|
31
|
+
/** Expand @self once across one Call path and its CLI-authored string parameters. */
|
|
32
|
+
export declare function expandSelfInCall(path: string, parameters: Readonly<Record<string, unknown>>, context: ConnectionContext): Promise<{
|
|
33
|
+
readonly path: string;
|
|
34
|
+
readonly parameters: Readonly<Record<string, unknown>>;
|
|
35
|
+
readonly meta?: SelfExpansionMeta;
|
|
36
|
+
}>;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { AuthApi } from '@astrale-os/sdk/auth';
|
|
2
|
+
import type { GraphApi } from '@astrale-os/sdk/client';
|
|
3
|
+
import type { ClientSessionOptions, SessionAuth } from '@astrale-os/sdk/client/session';
|
|
4
|
+
import { ClientSession } from '@astrale-os/sdk/client/session';
|
|
5
|
+
import type { AstraleConfig } from '../lib/config';
|
|
6
|
+
import type { AdminConnectionOptions, ConnectionOptions, ConnectionTarget } from './target';
|
|
7
|
+
import { connectAdminInstances, type InstanceInfo } from '../admin/instance';
|
|
8
|
+
export interface ConnectionContext {
|
|
9
|
+
readonly session: ClientSession;
|
|
10
|
+
readonly graph: GraphApi;
|
|
11
|
+
readonly auth: AuthApi;
|
|
12
|
+
readonly target: ConnectionTarget;
|
|
13
|
+
/** Local identity label selected for this session; absent for raw credentials or anonymous use. */
|
|
14
|
+
readonly identity?: string;
|
|
15
|
+
}
|
|
16
|
+
interface OwnedConnection {
|
|
17
|
+
readonly context: ConnectionContext;
|
|
18
|
+
close(): void;
|
|
19
|
+
}
|
|
20
|
+
export type ConnectionFactory = (target: ConnectionTarget, timeoutMs: number, options: ConnectionOptions, config: AstraleConfig) => OwnedConnection;
|
|
21
|
+
/** Resolve one ordinary target, run a command action, then close terminally. */
|
|
22
|
+
export declare function withClientSession<Value>(options: ConnectionOptions, action: (context: ConnectionContext) => Promise<Value>): Promise<Value>;
|
|
23
|
+
/** Resolve the configured Admin Domain target under the same terminal lifecycle. */
|
|
24
|
+
export declare function withAdminClientSession<Value>(options: AdminConnectionOptions, action: (context: ConnectionContext) => Promise<Value>): Promise<Value>;
|
|
25
|
+
/** Owner-private seam used to prove validation order and cleanup without network I/O. */
|
|
26
|
+
export declare function withResolvedClientSession<Value>(target: ConnectionTarget, options: ConnectionOptions, config: AstraleConfig, action: (context: ConnectionContext) => Promise<Value>, open?: ConnectionFactory): Promise<Value>;
|
|
27
|
+
export declare function resolveTimeoutMs(raw: string | undefined): number;
|
|
28
|
+
/** Owner-private construction seam proving that transport and source identity stay distinct. */
|
|
29
|
+
export declare function createClientSessionOptions(target: ConnectionTarget, fetch: NonNullable<ClientSessionOptions['fetch']>, auth: SessionAuth | undefined, timeoutMs: number): ClientSessionOptions;
|
|
30
|
+
export declare function lookupManagedInstance(slug: string, options: ConnectionOptions, openAdmin?: typeof withAdminClientSession, connect?: typeof connectAdminInstances): Promise<InstanceInfo>;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { IssuerId } from '@astrale-os/sdk/auth';
|
|
2
|
+
import type { InstanceInfo } from '../lib/admin-instance';
|
|
3
|
+
import type { AdminTargetCommandOpts } from '../lib/admin-target';
|
|
4
|
+
import type { AstraleConfig } from '../lib/config';
|
|
5
|
+
import type { InstanceStore } from '../lib/instance';
|
|
6
|
+
export interface ConnectionOptions {
|
|
7
|
+
readonly url?: string;
|
|
8
|
+
readonly instance?: string;
|
|
9
|
+
readonly timeout?: string;
|
|
10
|
+
readonly as?: string;
|
|
11
|
+
readonly creds?: string;
|
|
12
|
+
readonly anonymous?: boolean;
|
|
13
|
+
readonly ci?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface AdminConnectionOptions extends ConnectionOptions {
|
|
16
|
+
readonly admin?: string;
|
|
17
|
+
readonly adminUrl?: string;
|
|
18
|
+
readonly domainIssuer?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ConnectionTarget {
|
|
21
|
+
readonly url: string;
|
|
22
|
+
readonly kernelIssuer: IssuerId;
|
|
23
|
+
readonly domainIssuer?: IssuerId;
|
|
24
|
+
readonly slug?: string;
|
|
25
|
+
readonly defaultIdentity?: string;
|
|
26
|
+
readonly caFile?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface TargetDependencies {
|
|
29
|
+
readonly instances?: InstanceStore;
|
|
30
|
+
readonly managed?: (slug: string) => Promise<InstanceInfo>;
|
|
31
|
+
}
|
|
32
|
+
/** Stable local identity-registration key for the exact selected source Kernel. */
|
|
33
|
+
export declare function registrationKeyForTarget(target: ConnectionTarget): string;
|
|
34
|
+
/** Resolve the existing URL / instance / active precedence into one exact source Kernel. */
|
|
35
|
+
export declare function resolveConnectionTarget(options: ConnectionOptions, config: AstraleConfig, dependencies?: TargetDependencies): Promise<ConnectionTarget>;
|
|
36
|
+
/** Resolve the configured Admin Domain target without entering managed-instance discovery. */
|
|
37
|
+
export declare function resolveAdminConnectionTarget(options: AdminConnectionOptions, config: AstraleConfig, instances?: InstanceStore): Promise<ConnectionTarget>;
|
|
38
|
+
export declare function adminLookupOptions(options: AdminConnectionOptions): AdminTargetCommandOpts;
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare class AstraleError extends Error {
|
|
2
2
|
code: string;
|
|
3
3
|
hint?: string;
|
|
4
|
-
constructor(code: string, message: string, hint?: string);
|
|
4
|
+
constructor(code: string, message: string, hint?: string, options?: ErrorOptions);
|
|
5
5
|
}
|
|
6
6
|
export declare class AuthError extends AstraleError {
|
|
7
7
|
constructor(message: string, hint?: string);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AdminConnectionOptions, ConnectionContext } from '../connection';
|
|
2
|
+
export { AdminInstanceNotFoundError, findOwnedInstance, formatInstanceState, type InstanceInfo, type InstanceState, type OwnedInstanceInfo, } from '../admin/instance';
|
|
3
|
+
/** Resolve the Admin target and read only the caller-visible Instance inventory. */
|
|
4
|
+
export declare function listOwnedInstances(options: AdminConnectionOptions): Promise<import("./admin-instance").OwnedInstanceInfo[]>;
|
|
5
|
+
/** Read caller-visible inventory together with the exact local identity used for the Admin call. */
|
|
6
|
+
export declare function listOwnedInstancesWithIdentity(options: AdminConnectionOptions): Promise<Readonly<{
|
|
7
|
+
instances: import("./admin-instance").OwnedInstanceInfo[];
|
|
8
|
+
identity?: string | undefined;
|
|
9
|
+
}>>;
|
|
10
|
+
/** Reuse an already-open Admin session for a caller-visible Instance inventory. */
|
|
11
|
+
export declare function listOwnedInstancesInContext(context: ConnectionContext): Promise<import("./admin-instance").OwnedInstanceInfo[]>;
|
|
12
|
+
/** Request one managed Instance; Admin owns infrastructure placement. */
|
|
13
|
+
export declare function createOwnedInstance(options: AdminConnectionOptions, slug: string): Promise<import("./admin-instance").InstanceInfo>;
|
|
14
|
+
/** Refresh one exact caller-visible Instance through its V2 receiver Method. */
|
|
15
|
+
export declare function statusOwnedInstance(options: AdminConnectionOptions, identifier: string): Promise<import("./admin-instance").InstanceInfo>;
|
|
16
|
+
/** Delete one exact caller-visible Instance through its V2 receiver Method. */
|
|
17
|
+
export declare function deleteOwnedInstance(options: AdminConnectionOptions, identifier: string): Promise<import("./admin-instance").InstanceInfo>;
|
|
@@ -2,8 +2,12 @@ import { z } from 'zod';
|
|
|
2
2
|
import type { AstraleConfig } from './config';
|
|
3
3
|
import type { InstanceStore } from './instance';
|
|
4
4
|
export declare const DEFAULT_ADMIN_TARGET_NAME = "admin";
|
|
5
|
-
export declare
|
|
6
|
-
|
|
5
|
+
export declare function defaultAdminTargetForChannel(channel: string): {
|
|
6
|
+
readonly url: string;
|
|
7
|
+
readonly domainIssuer: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const DEFAULT_ADMIN_TARGET_URL: string;
|
|
10
|
+
export declare const DEFAULT_ADMIN_DOMAIN_ISSUER: string;
|
|
7
11
|
export declare const DEFAULT_ADMIN_TARGET_CONFIG: {
|
|
8
12
|
name: string;
|
|
9
13
|
url: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function printFailureDebug(error: unknown, url: string): void;
|
package/dist/types/lib/idp.d.ts
CHANGED
|
@@ -162,6 +162,8 @@ export declare const IdpSessionSchema: z.ZodObject<{
|
|
|
162
162
|
idp: z.ZodString;
|
|
163
163
|
issuer: z.ZodString;
|
|
164
164
|
subject: z.ZodString;
|
|
165
|
+
/** OAuth client that issued this session's refresh token. */
|
|
166
|
+
clientId: z.ZodOptional<z.ZodString>;
|
|
165
167
|
audience: z.ZodOptional<z.ZodString>;
|
|
166
168
|
organizationId: z.ZodOptional<z.ZodString>;
|
|
167
169
|
access_token: z.ZodString;
|
|
@@ -194,6 +196,8 @@ export declare const IdpSessionSchema: z.ZodObject<{
|
|
|
194
196
|
idp: z.ZodString;
|
|
195
197
|
issuer: z.ZodString;
|
|
196
198
|
subject: z.ZodString;
|
|
199
|
+
/** OAuth client that issued this session's refresh token. */
|
|
200
|
+
clientId: z.ZodOptional<z.ZodString>;
|
|
197
201
|
audience: z.ZodOptional<z.ZodString>;
|
|
198
202
|
organizationId: z.ZodOptional<z.ZodString>;
|
|
199
203
|
access_token: z.ZodString;
|
|
@@ -226,6 +230,8 @@ export declare const IdpSessionSchema: z.ZodObject<{
|
|
|
226
230
|
idp: z.ZodString;
|
|
227
231
|
issuer: z.ZodString;
|
|
228
232
|
subject: z.ZodString;
|
|
233
|
+
/** OAuth client that issued this session's refresh token. */
|
|
234
|
+
clientId: z.ZodOptional<z.ZodString>;
|
|
229
235
|
audience: z.ZodOptional<z.ZodString>;
|
|
230
236
|
organizationId: z.ZodOptional<z.ZodString>;
|
|
231
237
|
access_token: z.ZodString;
|
|
@@ -316,6 +322,7 @@ export declare function fetchOidcMetadata(issuer: string): Promise<OidcMetadata>
|
|
|
316
322
|
export declare function workosAuthKitMetadata(apiHost?: string, clientId?: string): OidcMetadata;
|
|
317
323
|
export declare function builtinIdpConfig(name: string, clientIdOverride?: string, env?: NodeJS.ProcessEnv): IdpConfig | null;
|
|
318
324
|
export declare function workosClientIdFromEnv(env?: NodeJS.ProcessEnv): string | undefined;
|
|
325
|
+
export declare function legacyBuiltinWorkosReplacement(existing: IdpConfig, clientIdOverride?: string, env?: NodeJS.ProcessEnv): IdpConfig | undefined;
|
|
319
326
|
export declare function postForm(url: string, params: URLSearchParams): Promise<TokenResponse>;
|
|
320
327
|
export declare function postJson(url: string, bodyInput: Record<string, string>): Promise<TokenResponse>;
|
|
321
328
|
export declare function tokenExpiresAt(token: TokenResponse): string | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { InstanceInfo } from '../admin/instance/model';
|
|
2
1
|
import type { AstraleConfig } from './config';
|
|
2
|
+
import { type InstanceInfo } from '../admin/instance/model';
|
|
3
3
|
import { type AdminTargetCommandOpts, type ResolvedAdminTarget } from './admin-target';
|
|
4
4
|
import { type InstanceStore } from './instance';
|
|
5
5
|
export type InstanceTargetRequest = {
|
|
@@ -172,7 +172,13 @@ export declare function upsertInstance(key: string, opts?: AddInstanceOpts): Pro
|
|
|
172
172
|
* normalized kernel URL). Reports the previous URL when an existing
|
|
173
173
|
* bookmark was repointed to a different kernel so callers can warn.
|
|
174
174
|
*/
|
|
175
|
-
export declare function upsertManagedBookmark(
|
|
175
|
+
export declare function upsertManagedBookmark(input: Readonly<{
|
|
176
|
+
key: string;
|
|
177
|
+
slug: string;
|
|
178
|
+
url: string;
|
|
179
|
+
organizationId?: string;
|
|
180
|
+
defaultIdentity?: string;
|
|
181
|
+
}>): Promise<{
|
|
176
182
|
entry: InstanceEntry;
|
|
177
183
|
repointedFrom?: string;
|
|
178
184
|
}>;
|
|
@@ -182,7 +188,9 @@ export declare function clearActive(identifier: string): Promise<void>;
|
|
|
182
188
|
export declare function getActive(config?: AstraleConfig): Promise<InstanceEntry & {
|
|
183
189
|
name: string;
|
|
184
190
|
}>;
|
|
185
|
-
export declare function resolveInstance(identifier: string, config?: AstraleConfig
|
|
191
|
+
export declare function resolveInstance(identifier: string, config?: AstraleConfig, opts?: {
|
|
192
|
+
persist?: boolean;
|
|
193
|
+
}): Promise<ResolvedInstance>;
|
|
186
194
|
export declare function resolveKernelUrl(opts: {
|
|
187
195
|
url?: string;
|
|
188
196
|
instance?: string;
|
package/dist/types/lib/log.d.ts
CHANGED
|
@@ -10,9 +10,11 @@ export declare const log: {
|
|
|
10
10
|
};
|
|
11
11
|
/** Report an error with hint (when present) and exit. `--json` / `--ci` / a
|
|
12
12
|
* non-TTY stdout always get one structured JSON line on stderr. */
|
|
13
|
-
export declare function fatal(e: unknown, opts?: MachineOpts
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
export declare function fatal(e: unknown, opts?: MachineOpts & {
|
|
14
|
+
readonly debug?: boolean;
|
|
15
|
+
}): never;
|
|
16
|
+
/** Project only a caller-authored admission failure into the CLI input family. */
|
|
17
|
+
export declare function failInput(error: unknown, opts?: MachineOpts): never;
|
|
16
18
|
/** Shortcut for stub commands that aren't wired in v1 (§15). */
|
|
17
19
|
export declare function fatalNotImplemented(feature: string, hint?: string): never;
|
|
18
20
|
/**
|
package/dist/types/lib/meta.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* `jwks_uri`) and JWKS at `/.well-known/jwks.json`. These helpers probe
|
|
7
7
|
* both to verify the issuer is alive and publishes at least one key.
|
|
8
8
|
*
|
|
9
|
-
* Domain
|
|
10
|
-
* outside this
|
|
9
|
+
* Domain deployment readiness uses the canonical Domain Publication; that is
|
|
10
|
+
* outside this issuer-connectivity helper.
|
|
11
11
|
*/
|
|
12
12
|
type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
13
13
|
export type DiscoveryDocument = {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ChildProcess, type StdioOptions } from 'node:child_process';
|
|
2
|
+
export type RunResult = {
|
|
3
|
+
/** Exit code, or -1 when the process was killed by a signal. */
|
|
4
|
+
code: number;
|
|
5
|
+
stdout: string;
|
|
6
|
+
stderr: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Spawn a child process and capture stdout/stderr as UTF-8 text.
|
|
10
|
+
*
|
|
11
|
+
* Uses `node:child_process` rather than `Bun.spawn` so the exact same code runs
|
|
12
|
+
* under both the Bun-compiled standalone binary (Linux/macOS) and the Node/npm
|
|
13
|
+
* build (Windows and any Node user). The promise rejects only when the process
|
|
14
|
+
* fails to spawn (e.g. ENOENT); a non-zero exit resolves with that `code` so
|
|
15
|
+
* callers can branch on it.
|
|
16
|
+
*/
|
|
17
|
+
export declare function run(file: string, args?: string[], opts?: {
|
|
18
|
+
cwd?: string;
|
|
19
|
+
}): Promise<RunResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Spawn a child process with inherited stdio so its output streams live to the
|
|
22
|
+
* user's terminal. Used for hand-held installs (npm / npx) where progress
|
|
23
|
+
* matters and the output is for the human, not for parsing. Resolves with the
|
|
24
|
+
* exit code; rejects only when the process fails to spawn (e.g. ENOENT).
|
|
25
|
+
*/
|
|
26
|
+
export declare function runInherit(file: string, args?: string[], opts?: {
|
|
27
|
+
cwd?: string;
|
|
28
|
+
}): Promise<number>;
|
|
29
|
+
/**
|
|
30
|
+
* Spawn a LONG-LIVED child and return the handle immediately so the caller can
|
|
31
|
+
* supervise it (wait for exit, forward signals, tear down siblings). Unlike
|
|
32
|
+
* run()/runInherit() — which resolve only once the child closes — this is for
|
|
33
|
+
* servers the command keeps attached to (e.g. `astrale studio`'s Bun server and
|
|
34
|
+
* Vite dev process). Same node:child_process basis (cross-runtime) and bare
|
|
35
|
+
* PATH-name lookup convention. Default stdio streams stdout/stderr live but
|
|
36
|
+
* ignores stdin, so two supervised children never contend for the TTY.
|
|
37
|
+
*/
|
|
38
|
+
export declare function spawnHandle(file: string, args?: string[], opts?: {
|
|
39
|
+
cwd?: string;
|
|
40
|
+
env?: NodeJS.ProcessEnv;
|
|
41
|
+
stdio?: StdioOptions;
|
|
42
|
+
detached?: boolean;
|
|
43
|
+
}): ChildProcess;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lexical `@self` helpers. Effective-principal resolution is deliberately not
|
|
3
|
+
* local: connection/self.ts asks the authenticated target Kernel through
|
|
4
|
+
* Identity.whoami before replacing any reference.
|
|
5
|
+
*/
|
|
6
|
+
/** Cheap pre-check before invoking authenticated principal resolution. */
|
|
7
|
+
export declare function containsSelfRef(input: string): boolean;
|
|
8
|
+
/** Replace every admitted `@self` token with one authenticated NodeId. */
|
|
9
|
+
export declare function expandSelfReferences(input: string, selfId: string): string;
|