@ory/argus 0.13.9 → 1.0.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.
Files changed (133) hide show
  1. package/README.md +31 -45
  2. package/assets/commands/temporal-up.md +1 -1
  3. package/assets/skills/auth-setup/SKILL.md +1 -1
  4. package/assets/skills/local-dev/SKILL.md +17 -7
  5. package/assets/skills/ory-build-agent/SKILL.md +43 -97
  6. package/assets/skills/ory-e2b-sandbox/SKILL.md +18 -18
  7. package/assets/skills/ory-temporal-worker/SKILL.md +38 -42
  8. package/assets/skills/permissions-onboarding/SKILL.md +131 -104
  9. package/dist/adapters.d.ts +93 -30
  10. package/dist/adapters.js +464 -136
  11. package/dist/agent-auth.d.ts +258 -68
  12. package/dist/agent-auth.js +998 -202
  13. package/dist/auth-store.d.ts +37 -2
  14. package/dist/auth-store.js +37 -3
  15. package/dist/auth.d.ts +40 -4
  16. package/dist/auth.js +247 -19
  17. package/dist/bash-parser.d.ts +98 -0
  18. package/dist/bash-parser.js +396 -0
  19. package/dist/branding.d.ts +128 -0
  20. package/dist/branding.js +151 -0
  21. package/dist/build-info.json +4 -4
  22. package/dist/cli-invocation.d.ts +1 -1
  23. package/dist/cli-invocation.js +2 -1
  24. package/dist/cli.d.ts +20 -29
  25. package/dist/cli.js +271 -278
  26. package/dist/client.d.ts +175 -138
  27. package/dist/client.js +672 -391
  28. package/dist/config.d.ts +249 -57
  29. package/dist/config.js +486 -62
  30. package/dist/context.d.ts +10 -0
  31. package/dist/context.js +21 -0
  32. package/dist/contract-suite.d.ts +8 -8
  33. package/dist/contract-suite.js +88 -69
  34. package/dist/denial.d.ts +36 -3
  35. package/dist/denial.js +79 -10
  36. package/dist/event-reporter.d.ts +77 -0
  37. package/dist/event-reporter.js +776 -0
  38. package/dist/external-registrations-main.d.ts +10 -0
  39. package/dist/external-registrations-main.js +38 -0
  40. package/dist/external-registrations.d.ts +79 -0
  41. package/dist/external-registrations.js +188 -0
  42. package/dist/help-cli.d.ts +39 -0
  43. package/dist/help-cli.js +55 -0
  44. package/dist/hook-timeout.d.ts +64 -0
  45. package/dist/hook-timeout.js +88 -0
  46. package/dist/index.d.ts +31 -19
  47. package/dist/index.js +182 -31
  48. package/dist/lifecycle.d.ts +3 -3
  49. package/dist/lifecycle.js +38 -6
  50. package/dist/local/cli.js +11 -6
  51. package/dist/local/configs.d.ts +74 -18
  52. package/dist/local/configs.js +291 -84
  53. package/dist/local/health.d.ts +14 -0
  54. package/dist/local/health.js +50 -4
  55. package/dist/local/index.d.ts +2 -2
  56. package/dist/local/index.js +24 -10
  57. package/dist/local/manager.d.ts +20 -1
  58. package/dist/local/manager.js +160 -39
  59. package/dist/local/ports.d.ts +158 -0
  60. package/dist/local/ports.js +443 -0
  61. package/dist/local/seed.d.ts +22 -25
  62. package/dist/local/seed.js +88 -56
  63. package/dist/logger.d.ts +54 -25
  64. package/dist/logger.js +329 -63
  65. package/dist/mcp.d.ts +2 -2
  66. package/dist/mcp.js +10 -5
  67. package/dist/mirror-bootstrap.d.ts +48 -0
  68. package/dist/mirror-bootstrap.js +254 -0
  69. package/dist/opl.d.ts +289 -0
  70. package/dist/opl.js +446 -0
  71. package/dist/permission-mode.d.ts +87 -0
  72. package/dist/permission-mode.js +307 -0
  73. package/dist/permissions-cli.d.ts +13 -49
  74. package/dist/permissions-cli.js +154 -348
  75. package/dist/permissions.d.ts +148 -38
  76. package/dist/permissions.js +591 -45
  77. package/dist/post-install.d.ts +33 -0
  78. package/dist/post-install.js +127 -0
  79. package/dist/read-credential.d.ts +65 -0
  80. package/dist/read-credential.js +86 -0
  81. package/dist/registry/cli.js +5 -2
  82. package/dist/registry/config.d.ts +0 -17
  83. package/dist/registry/config.js +0 -23
  84. package/dist/registry/index.d.ts +1 -1
  85. package/dist/registry/index.js +2 -2
  86. package/dist/registry/manager.d.ts +4 -21
  87. package/dist/registry/manager.js +83 -55
  88. package/dist/runtime-credential.d.ts +140 -0
  89. package/dist/runtime-credential.js +572 -0
  90. package/dist/runtime.d.ts +408 -0
  91. package/dist/runtime.js +748 -0
  92. package/dist/setup.d.ts +23 -28
  93. package/dist/setup.js +57 -84
  94. package/dist/status-cli.d.ts +29 -13
  95. package/dist/status-cli.js +124 -144
  96. package/dist/status-data.d.ts +195 -0
  97. package/dist/status-data.js +333 -0
  98. package/dist/status-system.d.ts +24 -0
  99. package/dist/status-system.js +56 -0
  100. package/dist/subject.d.ts +126 -20
  101. package/dist/subject.js +215 -30
  102. package/dist/testing.d.ts +74 -38
  103. package/dist/testing.js +185 -68
  104. package/dist/tool-catalog.d.ts +53 -11
  105. package/dist/tool-catalog.js +164 -13
  106. package/dist/tool-metadata.d.ts +7 -6
  107. package/dist/tool-metadata.js +6 -5
  108. package/dist/types.d.ts +11 -1
  109. package/dist/uninstall.d.ts +74 -19
  110. package/dist/uninstall.js +224 -49
  111. package/dist/user-login.d.ts +22 -16
  112. package/dist/user-login.js +67 -96
  113. package/dist/watch-cli.d.ts +6 -0
  114. package/dist/watch-cli.js +217 -0
  115. package/package.json +3 -11
  116. package/dist/dev.d.ts +0 -103
  117. package/dist/dev.js +0 -584
  118. package/dist/interactive-setup.d.ts +0 -165
  119. package/dist/interactive-setup.js +0 -1546
  120. package/dist/local/jaeger-main.d.ts +0 -13
  121. package/dist/local/jaeger-main.js +0 -85
  122. package/dist/local/jaeger.d.ts +0 -50
  123. package/dist/local/jaeger.js +0 -162
  124. package/dist/otel/exporter.d.ts +0 -17
  125. package/dist/otel/exporter.js +0 -12
  126. package/dist/otel/index.d.ts +0 -2
  127. package/dist/otel/index.js +0 -8
  128. package/dist/otel/otlp.d.ts +0 -103
  129. package/dist/otel/otlp.js +0 -385
  130. package/dist/tracer.d.ts +0 -190
  131. package/dist/tracer.js +0 -481
  132. package/dist/watch-sandbox.d.ts +0 -9
  133. package/dist/watch-sandbox.js +0 -81
@@ -1,165 +0,0 @@
1
- /**
2
- * Interactive install wizard. Runs after a harness plugin has been
3
- * registered, stepping the user through connecting the plugin to Ory:
4
- *
5
- * 1. Choose a connection: **Ory Network** (browser login / account
6
- * creation) or **local / audit-only** (no project, audit logging only).
7
- * 2. Ory Network branch: shell out to the official `ory` CLI to log in,
8
- * pick a workspace, pick a project (→ `projectUrl`), and create the
9
- * public OAuth2 client the PKCE user login needs (→ `oauth2ClientId`).
10
- * 3. Persist the resolved values to the shared config file and enable the
11
- * interactive user login.
12
- * 4. Best-effort "full setup": run the PKCE user login now (we hold the
13
- * project URL + client id), resolve the agent DCR identity, and let the
14
- * caller bootstrap permissions from the freshly-cached user identity.
15
- *
16
- * The whole wizard is **fail-open and skippable**: on a missing TTY, a
17
- * `--no-configure` flag, an already-configured plugin (without
18
- * `--reconfigure`), a missing `ory` CLI, or any `ory` failure it prints the
19
- * manual `configure` instructions and returns without throwing. Install must
20
- * never crash because setup was declined or the network was unreachable.
21
- *
22
- * The Ory Network integration deliberately reuses the official `ory` CLI
23
- * rather than re-implementing the Console API: the CLI already owns Network
24
- * browser login + account creation, workspace/project listing, and OAuth2
25
- * client creation, and the client it creates is exactly the one the plugin
26
- * READMEs document for manual setup. The one exception is minting the project
27
- * API key that runtime permission checks need — the CLI exposes no command for
28
- * it, so that single step calls the Console API directly, reusing the CLI's
29
- * stored session for auth (see {@link createProjectApiKeyViaConsole}).
30
- */
31
- import { OryAgentClient } from "./client.js";
32
- import { ensureUserAuthenticated } from "./user-login.js";
33
- import { ensureAgentIdentity } from "./agent-auth.js";
34
- import { ensureLocalOryStack, seedLocalEnvironment } from "./local/index.js";
35
- /** Loopback redirect URIs the PKCE user login expects on the OAuth2 client. */
36
- export declare const LOOPBACK_REDIRECT_URIS: readonly string[];
37
- /** Result of running a captured `ory` command. */
38
- export interface OryExecResult {
39
- /** Exit code; `null` when the process could not be spawned (CLI missing). */
40
- status: number | null;
41
- stdout: string;
42
- stderr: string;
43
- }
44
- /**
45
- * Thin, injectable wrapper around the `ory` binary. Tests stub this to drive
46
- * the wizard without a real CLI; the default implementation shells out.
47
- */
48
- export interface OryCliRunner {
49
- /** Run `ory <args>` capturing stdout/stderr. `opts.input` is written to
50
- * the child's stdin (used to feed JSON to `ory create relationships -f -`). */
51
- exec(args: string[], opts?: {
52
- input?: string;
53
- }): OryExecResult;
54
- /** Run `ory <args>` inheriting the terminal (for the browser login). */
55
- execInteractive(args: string[]): number;
56
- }
57
- /**
58
- * Build a runner bound to a specific `ory` binary (a bare command resolved on
59
- * `PATH`, or an absolute path to a plugin-installed binary). {@link defaultRunner}
60
- * uses the bare `"ory"`; {@link installOryCli} returns one bound to the binary
61
- * it just installed.
62
- */
63
- export declare function createOryRunner(oryBin: string): OryCliRunner;
64
- /**
65
- * npm spec for the Ory CLI installed on demand when the `ory` binary isn't on
66
- * `PATH`. `@ory/cli` ships the platform `ory` binary and exposes it as its
67
- * `bin`, so an isolated `npm install` gives us a working CLI without touching
68
- * the user's global environment. Pinned to a major to stay reproducible while
69
- * still picking up patch/minor fixes.
70
- */
71
- export declare const ORY_CLI_NPM_SPEC = "@ory/cli@^1";
72
- export interface InteractiveSetupDeps {
73
- runner?: OryCliRunner;
74
- isTtyAvailableFn?: () => boolean;
75
- promptFn?: (prompt: string) => Promise<string | null>;
76
- clientFactory?: (harness: string) => OryAgentClient;
77
- userLoginFn?: typeof ensureUserAuthenticated;
78
- agentGateFn?: typeof ensureAgentIdentity;
79
- /** Injectable local-stack bring-up (defaults to {@link ensureLocalOryStack}). */
80
- localStackFn?: typeof ensureLocalOryStack;
81
- /** Injectable local-stack seeder (defaults to {@link seedLocalEnvironment}). */
82
- seedFn?: typeof seedLocalEnvironment;
83
- /**
84
- * Injectable Ory-CLI installer used when the `ory` binary isn't on `PATH`.
85
- * Returns a runner bound to the installed binary, or null if the install
86
- * failed. Defaults to a real `npm install` of {@link ORY_CLI_NPM_SPEC}.
87
- */
88
- installOryCliFn?: () => Promise<OryCliRunner | null>;
89
- /**
90
- * Injectable project-API-key minter. Returns the `ory_pat_…` value or null on
91
- * any failure. Defaults to {@link createProjectApiKeyViaConsole} (Ory Console
92
- * API, authenticated with the `ory` CLI's stored session). Tests stub this to
93
- * avoid real HTTP.
94
- */
95
- createProjectApiKeyFn?: (args: CreateProjectApiKeyArgs) => Promise<string | null>;
96
- /**
97
- * Injectable validity probe for an already-stored project API key. Returns
98
- * true when the key still authenticates against Keto, false when it's been
99
- * revoked/deleted (so provisioning re-mints one). Defaults to
100
- * {@link apiKeyAuthenticates}. Tests stub this to avoid real HTTP.
101
- */
102
- validateApiKeyFn?: (apiKey: string, projectUrl: string) => Promise<boolean>;
103
- }
104
- export type InteractiveSetupOutcome = "skipped_flag" | "skipped_no_tty" | "skipped_configured" | "audit_only" | "local_configured" | "network_configured" | "network_fallback";
105
- export interface InteractiveSetupResult {
106
- outcome: InteractiveSetupOutcome;
107
- projectUrl?: string;
108
- oauth2ClientId?: string;
109
- /** Whether a user identity was authenticated during the wizard. */
110
- userAuthenticated?: boolean;
111
- /**
112
- * When true, the caller should NOT run the DCR-token-based
113
- * {@link maybeAutoBootstrap}. The wizard bootstraps permissions itself via
114
- * the admin-authenticated `ory` CLI on the Ory Network path — the runtime
115
- * agent/user tokens can't write relation tuples on a hosted project, so
116
- * running maybeAutoBootstrap there would only produce 403s.
117
- */
118
- skipAutoBootstrap?: boolean;
119
- }
120
- /**
121
- * The shared post-install entry point every harness's `install` command
122
- * calls. Runs the interactive setup wizard, then (using whatever identity the
123
- * wizard cached) bootstraps permissions and prints the onboarding banner.
124
- *
125
- * This is the single seam that centralizes what each harness previously
126
- * open-coded as a local `postInstallPermissions` helper.
127
- */
128
- export declare function runPostInstall(binName: string, harness: string, args?: string[], deps?: InteractiveSetupDeps): Promise<void>;
129
- /**
130
- * Run the interactive setup wizard. Always resolves; never throws.
131
- */
132
- export declare function runInteractiveSetup(binName: string, harness: string, args?: string[], deps?: InteractiveSetupDeps): Promise<InteractiveSetupResult>;
133
- /**
134
- * Derive the canonical Ory Network project SDK/API URL from a project **slug**.
135
- * The subdomain is always the slug — never the project id. A project id (a
136
- * UUID) reaching here means a slug and an id were confused upstream, which
137
- * would build a URL that points nowhere, so we refuse it loudly rather than
138
- * silently misconfigure the plugin.
139
- */
140
- 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
- /**
147
- * Mint an Ory Network **project API key** via the Console API
148
- * (`POST /projects/{id}/tokens`), authenticated with the `ory` CLI session.
149
- * Returns the `ory_pat_…` value, or null on any failure (no session, non-2xx,
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.
155
- */
156
- export declare function createProjectApiKeyViaConsole(args: CreateProjectApiKeyArgs): Promise<string | null>;
157
- /**
158
- * Best-effort check that an already-stored project API key still authenticates
159
- * against Keto. Runs one permission check with the key: if it completes (any
160
- * `allowed` value) the key is valid; an auth rejection (`session_inactive` /
161
- * `forbidden` / `session_aal2_required`) means it was revoked or deleted, so we
162
- * return false and the caller re-provisions. Transient failures (network /
163
- * rate-limit / unknown) return true so we don't re-mint on a blip. Never throws.
164
- */
165
- export declare function apiKeyAuthenticates(apiKey: string, projectUrl: string): Promise<boolean>;