@ory/argus 0.13.8 → 0.14.0
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 +2 -1
- package/assets/commands/dashboard.md +34 -0
- package/assets/skills/ory-build-agent/SKILL.md +11 -13
- package/assets/skills/ory-e2b-sandbox/SKILL.md +0 -1
- package/assets/skills/ory-temporal-worker/SKILL.md +8 -10
- package/assets/skills/permissions-onboarding/SKILL.md +3 -3
- package/dist/adapters.d.ts +27 -4
- package/dist/adapters.js +132 -32
- package/dist/agent-auth.d.ts +34 -3
- package/dist/agent-auth.js +58 -8
- package/dist/auth.d.ts +7 -0
- package/dist/auth.js +90 -5
- package/dist/branding.d.ts +67 -0
- package/dist/branding.js +81 -0
- package/dist/build-info.json +4 -4
- package/dist/cli.d.ts +3 -3
- package/dist/cli.js +13 -52
- package/dist/client.d.ts +31 -0
- package/dist/client.js +58 -0
- package/dist/config.d.ts +48 -19
- package/dist/config.js +31 -26
- package/dist/contract-suite.d.ts +5 -3
- package/dist/contract-suite.js +13 -22
- package/dist/dashboard-cli.d.ts +8 -0
- package/dist/dashboard-cli.js +70 -0
- package/dist/dev.js +3 -4
- package/dist/index.d.ts +12 -5
- package/dist/index.js +41 -3
- package/dist/interactive-setup.d.ts +144 -23
- package/dist/interactive-setup.js +412 -224
- package/dist/local/health.d.ts +14 -0
- package/dist/local/health.js +46 -0
- package/dist/local/manager.js +1 -3
- package/dist/local/seed.d.ts +9 -20
- package/dist/local/seed.js +26 -18
- package/dist/permissions-cli.js +12 -4
- package/dist/project-api-key.d.ts +69 -0
- package/dist/project-api-key.js +147 -0
- package/dist/registry/manager.js +62 -18
- package/dist/setup-actions.d.ts +232 -0
- package/dist/setup-actions.js +507 -0
- package/dist/setup.d.ts +19 -0
- package/dist/setup.js +44 -14
- package/dist/skills.js +7 -0
- package/dist/status-cli.d.ts +2 -2
- package/dist/status-cli.js +4 -30
- package/dist/status-data.d.ts +96 -0
- package/dist/status-data.js +250 -0
- package/dist/status-system.d.ts +24 -0
- package/dist/status-system.js +56 -0
- package/dist/testing.d.ts +8 -0
- package/dist/testing.js +20 -1
- package/dist/uninstall.d.ts +33 -15
- package/dist/uninstall.js +65 -22
- package/dist/user-login.d.ts +16 -9
- package/dist/user-login.js +18 -28
- package/dist/web/api.d.ts +33 -0
- package/dist/web/api.js +294 -0
- package/dist/web/launch.d.ts +11 -0
- package/dist/web/launch.js +96 -0
- package/dist/web/server.d.ts +20 -0
- package/dist/web/server.js +233 -0
- package/dist/web/types.d.ts +65 -0
- package/dist/web/types.js +2 -0
- package/dist/webapp/assets/index-Wucl4SZs.css +1 -0
- package/dist/webapp/assets/index-m-GtEdq0.js +49 -0
- package/dist/webapp/favicon.ico +0 -0
- package/dist/webapp/index.html +15 -0
- package/package.json +17 -2
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
* caller bootstrap permissions from the freshly-cached user identity.
|
|
15
15
|
*
|
|
16
16
|
* The whole wizard is **fail-open and skippable**: on a missing TTY, a
|
|
17
|
-
* `--no-configure` flag, an already-configured
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
17
|
+
* `--no-configure` flag, a declined reconfigure prompt on an already-configured
|
|
18
|
+
* plugin, a missing `ory` CLI, or any `ory` failure it prints the manual
|
|
19
|
+
* `configure` instructions and returns without throwing. Install must never
|
|
20
|
+
* crash because setup was declined or the network was unreachable.
|
|
21
21
|
*
|
|
22
22
|
* The Ory Network integration deliberately reuses the official `ory` CLI
|
|
23
23
|
* rather than re-implementing the Console API: the CLI already owns Network
|
|
@@ -32,6 +32,7 @@ import { OryAgentClient } from "./client.js";
|
|
|
32
32
|
import { ensureUserAuthenticated } from "./user-login.js";
|
|
33
33
|
import { ensureAgentIdentity } from "./agent-auth.js";
|
|
34
34
|
import { ensureLocalOryStack, seedLocalEnvironment } from "./local/index.js";
|
|
35
|
+
import { type CreateProjectApiKeyArgs, type ProjectApiKeyResult } from "./project-api-key.js";
|
|
35
36
|
/** Loopback redirect URIs the PKCE user login expects on the OAuth2 client. */
|
|
36
37
|
export declare const LOOPBACK_REDIRECT_URIS: readonly string[];
|
|
37
38
|
/** Result of running a captured `ory` command. */
|
|
@@ -53,6 +54,14 @@ export interface OryCliRunner {
|
|
|
53
54
|
}): OryExecResult;
|
|
54
55
|
/** Run `ory <args>` inheriting the terminal (for the browser login). */
|
|
55
56
|
execInteractive(args: string[]): number;
|
|
57
|
+
/**
|
|
58
|
+
* The resolved `ory` binary this runner invokes (a bare command on `PATH`, or
|
|
59
|
+
* an absolute path to a plugin-installed binary). Exposed so the web installer
|
|
60
|
+
* can spawn the interactive browser sign-in (`ory auth`) as a detached child
|
|
61
|
+
* without blocking the HTTP server's event loop the way `exec` (spawnSync)
|
|
62
|
+
* would. Absent on stub runners injected by tests.
|
|
63
|
+
*/
|
|
64
|
+
bin?: string;
|
|
56
65
|
}
|
|
57
66
|
/**
|
|
58
67
|
* Build a runner bound to a specific `ory` binary (a bare command resolved on
|
|
@@ -69,6 +78,13 @@ export declare function createOryRunner(oryBin: string): OryCliRunner;
|
|
|
69
78
|
* still picking up patch/minor fixes.
|
|
70
79
|
*/
|
|
71
80
|
export declare const ORY_CLI_NPM_SPEC = "@ory/cli@^1";
|
|
81
|
+
/**
|
|
82
|
+
* Best-effort install of the Ory CLI into a plugin-managed directory under the
|
|
83
|
+
* shared data dir, returning a runner bound to the installed binary (or null
|
|
84
|
+
* on any failure). Uses `npm install --prefix` so nothing global is modified;
|
|
85
|
+
* the binary lands at `<dataDir>/cli/node_modules/.bin/ory`. Never throws.
|
|
86
|
+
*/
|
|
87
|
+
export declare function installOryCli(): Promise<OryCliRunner | null>;
|
|
72
88
|
export interface InteractiveSetupDeps {
|
|
73
89
|
runner?: OryCliRunner;
|
|
74
90
|
isTtyAvailableFn?: () => boolean;
|
|
@@ -87,12 +103,12 @@ export interface InteractiveSetupDeps {
|
|
|
87
103
|
*/
|
|
88
104
|
installOryCliFn?: () => Promise<OryCliRunner | null>;
|
|
89
105
|
/**
|
|
90
|
-
* Injectable project-API-key minter. Returns the `
|
|
91
|
-
* any failure. Defaults to {@link createProjectApiKeyViaConsole} (Ory
|
|
92
|
-
* API, authenticated with the `ory` CLI's stored session). Tests stub
|
|
93
|
-
* avoid real HTTP.
|
|
106
|
+
* Injectable project-API-key minter. Returns the minted `{ value, id }` or
|
|
107
|
+
* null on any failure. Defaults to {@link createProjectApiKeyViaConsole} (Ory
|
|
108
|
+
* Console API, authenticated with the `ory` CLI's stored session). Tests stub
|
|
109
|
+
* this to avoid real HTTP.
|
|
94
110
|
*/
|
|
95
|
-
createProjectApiKeyFn?: (args: CreateProjectApiKeyArgs) => Promise<
|
|
111
|
+
createProjectApiKeyFn?: (args: CreateProjectApiKeyArgs) => Promise<ProjectApiKeyResult | null>;
|
|
96
112
|
/**
|
|
97
113
|
* Injectable validity probe for an already-stored project API key. Returns
|
|
98
114
|
* true when the key still authenticates against Keto, false when it's been
|
|
@@ -126,10 +142,125 @@ export interface InteractiveSetupResult {
|
|
|
126
142
|
* open-coded as a local `postInstallPermissions` helper.
|
|
127
143
|
*/
|
|
128
144
|
export declare function runPostInstall(binName: string, harness: string, args?: string[], deps?: InteractiveSetupDeps): Promise<void>;
|
|
145
|
+
export interface OryWorkspace {
|
|
146
|
+
id: string;
|
|
147
|
+
name?: string;
|
|
148
|
+
}
|
|
149
|
+
export interface OryProject {
|
|
150
|
+
id: string;
|
|
151
|
+
name?: string;
|
|
152
|
+
slug?: string;
|
|
153
|
+
}
|
|
129
154
|
/**
|
|
130
155
|
* Run the interactive setup wizard. Always resolves; never throws.
|
|
131
156
|
*/
|
|
132
157
|
export declare function runInteractiveSetup(binName: string, harness: string, args?: string[], deps?: InteractiveSetupDeps): Promise<InteractiveSetupResult>;
|
|
158
|
+
/**
|
|
159
|
+
* How the project's permission model relates to the namespace we need:
|
|
160
|
+
*
|
|
161
|
+
* - `present` — the namespace is already defined; grant directly.
|
|
162
|
+
* - `empty` — the project has no model at all (a fresh Ory Network project
|
|
163
|
+
* reports this as `null`, an absent key, an empty list, or an
|
|
164
|
+
* empty `location`); provisioning a minimal model is safe.
|
|
165
|
+
* - `merge` — a model exists and its OPL *source* was fetched (carries it
|
|
166
|
+
* in `opl`), but doesn't define our namespace; we append the
|
|
167
|
+
* namespace to that source and re-upload it, leaving the other
|
|
168
|
+
* namespaces intact.
|
|
169
|
+
* - `blocked` — a model provably exists but its source couldn't be retrieved
|
|
170
|
+
* (fetch failed, or only compiled namespace *names* are exposed
|
|
171
|
+
* with no source), so we can't merge and mustn't overwrite.
|
|
172
|
+
* - `unknown` — the config couldn't be read/parsed at all; treated as `empty`
|
|
173
|
+
* by the caller (provision a fresh minimal model, prompted).
|
|
174
|
+
*/
|
|
175
|
+
export type PermissionModel = {
|
|
176
|
+
kind: "present";
|
|
177
|
+
} | {
|
|
178
|
+
kind: "empty";
|
|
179
|
+
} | {
|
|
180
|
+
kind: "merge";
|
|
181
|
+
opl: string;
|
|
182
|
+
} | {
|
|
183
|
+
kind: "blocked";
|
|
184
|
+
} | {
|
|
185
|
+
kind: "unknown";
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* Inspect the project's permission model. Ory Network reports the config in one
|
|
189
|
+
* of two shapes: `{ namespaces: [] }` (or `null`) for a project with no model,
|
|
190
|
+
* and `{ namespaces: { location: "https://….txt" } }` for an OPL-configured
|
|
191
|
+
* one — where the `.txt` is the full OPL *source*. We fetch that source so a
|
|
192
|
+
* missing namespace can be merged in rather than clobbering the whole model.
|
|
193
|
+
*/
|
|
194
|
+
export declare function inspectPermissionModel(runner: OryCliRunner, projectId: string, namespace: string): Promise<PermissionModel>;
|
|
195
|
+
/**
|
|
196
|
+
* Provision a permission model that defines `<namespace>` with a `use`
|
|
197
|
+
* relation, via `ory update opl`. The namespace becomes an OPL class, so it
|
|
198
|
+
* must be a valid identifier; if not, we bail (caller guides instead).
|
|
199
|
+
*
|
|
200
|
+
* When `existingOpl` is given, the namespace is appended to that source
|
|
201
|
+
* (preserving the model's other namespaces); otherwise a fresh minimal model
|
|
202
|
+
* is generated. Writes the OPL to a temp file because `ory update opl` reads
|
|
203
|
+
* `--file` only (no stdin). Returns true on success.
|
|
204
|
+
*/
|
|
205
|
+
export declare function provisionPermissionModel(runner: OryCliRunner, projectId: string, namespace: string, existingOpl?: string): boolean;
|
|
206
|
+
export declare function oryCliPresent(runner: OryCliRunner): boolean;
|
|
207
|
+
export declare function listProjects(runner: OryCliRunner, workspaceId: string): OryProject[] | null;
|
|
208
|
+
/**
|
|
209
|
+
* Read the project's current DCR state via `ory get oauth2-config`.
|
|
210
|
+
* Returns `true`/`false` when the value is known, or `null` when it can't be
|
|
211
|
+
* determined (CLI error, unparseable output) so the caller falls open and
|
|
212
|
+
* prompts anyway rather than assuming a state.
|
|
213
|
+
*/
|
|
214
|
+
export declare function dcrEnabled(runner: OryCliRunner, projectId: string): boolean | null;
|
|
215
|
+
/**
|
|
216
|
+
* Patch the project's oauth2-config to enable Dynamic Client Registration.
|
|
217
|
+
* Prompt-free; returns true on success. Shared by the TTY wizard's
|
|
218
|
+
* {@link maybeEnableDcr} and the web installer API.
|
|
219
|
+
*/
|
|
220
|
+
export declare function enableDcr(runner: OryCliRunner, projectId: string): boolean;
|
|
221
|
+
/** How a project's browser-login UI (across both configs) is currently wired. */
|
|
222
|
+
export type LoginUiState = "managed" | "loopback" | "custom_external" | "unknown";
|
|
223
|
+
/**
|
|
224
|
+
* Classify the project's browser-login UI across the identity-config
|
|
225
|
+
* (self-service) and oauth2-config (login/consent) URLs:
|
|
226
|
+
* - `loopback` — at least one URL points at a `localhost` sample (needs fixing).
|
|
227
|
+
* - `custom_external` — a deliberate custom UI is set and none are loopback.
|
|
228
|
+
* - `managed` — everything is empty / relative / on the managed AX.
|
|
229
|
+
* - `unknown` — neither config could be read.
|
|
230
|
+
*/
|
|
231
|
+
export declare function projectLoginUiState(runner: OryCliRunner, projectId: string): LoginUiState;
|
|
232
|
+
/**
|
|
233
|
+
* Point the project's browser-login UI at the Ory Managed Account Experience by
|
|
234
|
+
* clearing any loopback (localhost sample) URLs in *both* the identity-config
|
|
235
|
+
* (self-service flows) and the oauth2-config (login/consent). Clearing a UI URL
|
|
236
|
+
* makes Ory Network fall back to the managed AX. Best-effort; returns true when
|
|
237
|
+
* the patches succeeded (or there was nothing to clear). Never touches a
|
|
238
|
+
* deliberate non-loopback custom UI.
|
|
239
|
+
*/
|
|
240
|
+
export declare function useManagedAccountExperience(runner: OryCliRunner, projectId: string): boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Enable OAuth2 Dynamic Client Registration on the project so the agent
|
|
243
|
+
* identity can self-register (RFC 7591) at runtime. First probes the project's
|
|
244
|
+
* current DCR state and skips silently when it's already enabled. Otherwise
|
|
245
|
+
* prompts (default yes) since it changes project-wide config; best-effort and
|
|
246
|
+
* fail-open — a decline or failure just prints the manual command and continues.
|
|
247
|
+
*/
|
|
248
|
+
/**
|
|
249
|
+
* Look for an already-provisioned public PKCE client on the project so a
|
|
250
|
+
* re-run — or another user installing against the same shared project — reuses
|
|
251
|
+
* the one client instead of minting a duplicate. Matches the current
|
|
252
|
+
* {@link USER_LOGIN_CLIENT_NAME} *and* any legacy name an older install may
|
|
253
|
+
* have used, so a rename never orphans a still-valid client. Best-effort: any
|
|
254
|
+
* CLI or parse failure returns null and the caller falls back to creating one.
|
|
255
|
+
*/
|
|
256
|
+
export declare function findExistingOAuth2Client(runner: OryCliRunner, projectId: string): string | null;
|
|
257
|
+
export declare function createOAuth2Client(runner: OryCliRunner, projectId: string): string | null;
|
|
258
|
+
/**
|
|
259
|
+
* Parse a JSON list from `ory --format json` output. Tolerates both a bare
|
|
260
|
+
* array and the `{ <key>: [...] }` envelope the Console list endpoints use.
|
|
261
|
+
*/
|
|
262
|
+
export declare function parseList<T>(stdout: string, key: string): T[] | null;
|
|
263
|
+
export declare function parseObject<T>(stdout: string): T | null;
|
|
133
264
|
/**
|
|
134
265
|
* Derive the canonical Ory Network project SDK/API URL from a project **slug**.
|
|
135
266
|
* The subdomain is always the slug — never the project id. A project id (a
|
|
@@ -138,22 +269,12 @@ export declare function runInteractiveSetup(binName: string, harness: string, ar
|
|
|
138
269
|
* silently misconfigure the plugin.
|
|
139
270
|
*/
|
|
140
271
|
export declare function projectUrlFromSlug(slug: string): string;
|
|
141
|
-
export interface CreateProjectApiKeyArgs {
|
|
142
|
-
projectId: string;
|
|
143
|
-
/** Human-readable label shown in the Console's API-keys list. */
|
|
144
|
-
name: string;
|
|
145
|
-
}
|
|
146
272
|
/**
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
* missing value). Never throws — provisioning is best-effort.
|
|
151
|
-
*
|
|
152
|
-
* This is the one place the wizard reaches past the `ory` CLI to the Console
|
|
153
|
-
* API: the CLI (as of v1.3) exposes no project-API-key command, and Keto
|
|
154
|
-
* permission checks can't authenticate without one.
|
|
273
|
+
* A project URL on a loopback host is the self-hosted local stack (the dev
|
|
274
|
+
* launcher's gateway on localhost), not a hosted Ory Network project — so the
|
|
275
|
+
* "Mode" summary should read "local stack" for it.
|
|
155
276
|
*/
|
|
156
|
-
export declare function
|
|
277
|
+
export declare function isLocalProjectUrl(url: string | undefined): boolean;
|
|
157
278
|
/**
|
|
158
279
|
* Best-effort check that an already-stored project API key still authenticates
|
|
159
280
|
* against Keto. Runs one permission check with the key: if it completes (any
|