@ory/argus 0.14.0 → 1.0.1

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 (150) hide show
  1. package/README.md +31 -46
  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 +39 -91
  6. package/assets/skills/ory-e2b-sandbox/SKILL.md +18 -17
  7. package/assets/skills/ory-temporal-worker/SKILL.md +31 -33
  8. package/assets/skills/permissions-onboarding/SKILL.md +131 -104
  9. package/dist/adapters.d.ts +88 -32
  10. package/dist/adapters.js +443 -164
  11. package/dist/agent-auth.d.ts +226 -67
  12. package/dist/agent-auth.js +951 -205
  13. package/dist/auth-store.d.ts +37 -2
  14. package/dist/auth-store.js +37 -3
  15. package/dist/auth.d.ts +33 -4
  16. package/dist/auth.js +163 -20
  17. package/dist/bash-parser.d.ts +98 -0
  18. package/dist/bash-parser.js +396 -0
  19. package/dist/branding.d.ts +77 -16
  20. package/dist/branding.js +93 -23
  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 -239
  26. package/dist/client.d.ts +175 -138
  27. package/dist/client.js +672 -391
  28. package/dist/config.d.ts +217 -54
  29. package/dist/config.js +461 -42
  30. package/dist/context.d.ts +10 -0
  31. package/dist/context.js +21 -0
  32. package/dist/contract-suite.d.ts +3 -5
  33. package/dist/contract-suite.js +75 -47
  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 +28 -23
  47. package/dist/index.js +173 -58
  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.js +7 -7
  54. package/dist/local/index.d.ts +2 -2
  55. package/dist/local/index.js +24 -10
  56. package/dist/local/manager.d.ts +20 -1
  57. package/dist/local/manager.js +159 -36
  58. package/dist/local/ports.d.ts +158 -0
  59. package/dist/local/ports.js +443 -0
  60. package/dist/local/seed.d.ts +13 -5
  61. package/dist/local/seed.js +62 -38
  62. package/dist/logger.d.ts +54 -25
  63. package/dist/logger.js +329 -63
  64. package/dist/mcp.d.ts +2 -2
  65. package/dist/mcp.js +10 -5
  66. package/dist/mirror-bootstrap.d.ts +48 -0
  67. package/dist/mirror-bootstrap.js +254 -0
  68. package/dist/opl.d.ts +289 -0
  69. package/dist/opl.js +446 -0
  70. package/dist/permission-mode.d.ts +87 -0
  71. package/dist/permission-mode.js +307 -0
  72. package/dist/permissions-cli.d.ts +13 -49
  73. package/dist/permissions-cli.js +154 -348
  74. package/dist/permissions.d.ts +148 -38
  75. package/dist/permissions.js +591 -45
  76. package/dist/post-install.d.ts +33 -0
  77. package/dist/post-install.js +127 -0
  78. package/dist/read-credential.d.ts +65 -0
  79. package/dist/read-credential.js +86 -0
  80. package/dist/registry/cli.js +5 -2
  81. package/dist/registry/config.d.ts +0 -17
  82. package/dist/registry/config.js +0 -23
  83. package/dist/registry/index.d.ts +1 -1
  84. package/dist/registry/index.js +2 -2
  85. package/dist/registry/manager.d.ts +4 -21
  86. package/dist/registry/manager.js +21 -37
  87. package/dist/runtime-credential.d.ts +140 -0
  88. package/dist/runtime-credential.js +572 -0
  89. package/dist/runtime.d.ts +413 -0
  90. package/dist/runtime.js +825 -0
  91. package/dist/setup.d.ts +23 -47
  92. package/dist/setup.js +59 -116
  93. package/dist/skills.js +0 -7
  94. package/dist/status-cli.d.ts +27 -11
  95. package/dist/status-cli.js +121 -115
  96. package/dist/status-data.d.ts +116 -17
  97. package/dist/status-data.js +121 -38
  98. package/dist/subject.d.ts +126 -20
  99. package/dist/subject.js +215 -30
  100. package/dist/testing.d.ts +74 -38
  101. package/dist/testing.js +185 -68
  102. package/dist/tool-catalog.d.ts +53 -11
  103. package/dist/tool-catalog.js +164 -13
  104. package/dist/tool-metadata.d.ts +7 -6
  105. package/dist/tool-metadata.js +6 -5
  106. package/dist/types.d.ts +11 -1
  107. package/dist/uninstall.d.ts +71 -34
  108. package/dist/uninstall.js +217 -85
  109. package/dist/user-login.d.ts +9 -10
  110. package/dist/user-login.js +56 -75
  111. package/dist/watch-cli.d.ts +6 -0
  112. package/dist/watch-cli.js +217 -0
  113. package/package.json +4 -27
  114. package/assets/commands/dashboard.md +0 -34
  115. package/dist/dashboard-cli.d.ts +0 -8
  116. package/dist/dashboard-cli.js +0 -70
  117. package/dist/dev.d.ts +0 -103
  118. package/dist/dev.js +0 -583
  119. package/dist/interactive-setup.d.ts +0 -286
  120. package/dist/interactive-setup.js +0 -1734
  121. package/dist/local/jaeger-main.d.ts +0 -13
  122. package/dist/local/jaeger-main.js +0 -85
  123. package/dist/local/jaeger.d.ts +0 -50
  124. package/dist/local/jaeger.js +0 -162
  125. package/dist/otel/exporter.d.ts +0 -17
  126. package/dist/otel/exporter.js +0 -12
  127. package/dist/otel/index.d.ts +0 -2
  128. package/dist/otel/index.js +0 -8
  129. package/dist/otel/otlp.d.ts +0 -103
  130. package/dist/otel/otlp.js +0 -385
  131. package/dist/project-api-key.d.ts +0 -69
  132. package/dist/project-api-key.js +0 -147
  133. package/dist/setup-actions.d.ts +0 -232
  134. package/dist/setup-actions.js +0 -507
  135. package/dist/tracer.d.ts +0 -190
  136. package/dist/tracer.js +0 -481
  137. package/dist/watch-sandbox.d.ts +0 -9
  138. package/dist/watch-sandbox.js +0 -81
  139. package/dist/web/api.d.ts +0 -33
  140. package/dist/web/api.js +0 -294
  141. package/dist/web/launch.d.ts +0 -11
  142. package/dist/web/launch.js +0 -96
  143. package/dist/web/server.d.ts +0 -20
  144. package/dist/web/server.js +0 -233
  145. package/dist/web/types.d.ts +0 -65
  146. package/dist/web/types.js +0 -2
  147. package/dist/webapp/assets/index-Wucl4SZs.css +0 -1
  148. package/dist/webapp/assets/index-m-GtEdq0.js +0 -49
  149. package/dist/webapp/favicon.ico +0 -0
  150. package/dist/webapp/index.html +0 -15
package/dist/config.d.ts CHANGED
@@ -12,11 +12,13 @@ export interface OryOAuth2Tokens {
12
12
  expiresAt: number;
13
13
  /** Subject (sub claim) the token was issued for. */
14
14
  subject?: string;
15
- /** Client ID the token was issued under. */
15
+ /** Client ID the token was issued under. In-memory only. */
16
16
  clientId?: string;
17
- /** Optional id_token (OpenID Connect). */
17
+ /** @deprecated Accepted in memory for older callers; never persisted. */
18
18
  idToken?: string;
19
- /** Scope string returned by the token endpoint. */
19
+ /** Bounded display claim extracted before the ID token is discarded. In-memory only. */
20
+ displayName?: string;
21
+ /** Scope string returned by the token endpoint. In-memory only. */
20
22
  scope?: string;
21
23
  }
22
24
  /** Credentials for the human user principal (interactive login). */
@@ -26,18 +28,16 @@ export interface OryUserCredentials {
26
28
  }
27
29
  /**
28
30
  * Credentials returned by an OAuth2 Dynamic Client Registration flow
29
- * (RFC 7591). Persisted so that subsequent dev launches and process
30
- * restarts re-use the same agent identity instead of re-registering on
31
- * every session.
31
+ * (RFC 7591). Persisted by harness and session so separate hook processes in
32
+ * one session reuse its identity without sharing it with another session.
32
33
  */
33
34
  /**
34
35
  * The delegation edge recorded on a dynamically-registered OAuth2 client's
35
36
  * `metadata` at registration time (see {@link OryAgentDynamicCredentials.delegation}).
36
37
  *
37
- * This is the **integrity anchor** for the delegation chain: it is bound to
38
- * the OAuth2 client identity durably owned by Hydra / Ory Network and mirrored
39
- * into local config, so the delegator can be resolved and the derived Keto
40
- * tuple rebuilt — even if the tuple is lost, corrupted, or never written.
38
+ * This compact local binding lets later processes validate which principal
39
+ * registered the credential and recover the delegator when no live principal
40
+ * is available. Ory's public DCR endpoint does not accept arbitrary metadata.
41
41
  */
42
42
  export interface OryDelegationRecord {
43
43
  /** The delegator, as a namespaced subject: `user:<sub>` or `agent:<sub>`. */
@@ -66,6 +66,13 @@ export interface OryAgentDynamicCredentials {
66
66
  projectUrl: string;
67
67
  /** Harness name baked into the client_name (audit aid). */
68
68
  harness?: string;
69
+ /**
70
+ * The human-readable OAuth2 `client_name` this registration was issued
71
+ * under (e.g. `"Ory Agent Security · agent · claude-code @ host"`). Kept only
72
+ * on a fresh registration response for immediate display; never persisted.
73
+ * Later callers reconstruct a best-effort name from the outer harness key.
74
+ */
75
+ clientName?: string;
69
76
  /**
70
77
  * The delegation edge recorded for this client at registration. Persisted
71
78
  * here in local config only — Ory's public DCR endpoint rejects a `metadata`
@@ -74,33 +81,99 @@ export interface OryAgentDynamicCredentials {
74
81
  * initial access token with no user/agent principal).
75
82
  */
76
83
  delegation?: OryDelegationRecord;
84
+ /**
85
+ * The delegation node ids the agent-security broker returned for this agent's
86
+ * `user → agent` edge, **keyed by session**.
87
+ *
88
+ * Persisted at session start so a later sub-agent registration — which may run
89
+ * in a separate subprocess with no live agent principal — can pass the node id
90
+ * verbatim as `delegated_by` when recording the `agent → subagent` edge,
91
+ * without the plugin re-deriving the server's join-key encoding.
92
+ *
93
+ * Kept as a map for compatibility with credentials written by the earlier
94
+ * install-scoped model. A session-scoped credential normally contains only
95
+ * its own entry.
96
+ *
97
+ * Server-assigned and opaque to the plugin — never parsed, only echoed.
98
+ */
99
+ delegationNodeIds?: Record<string, string>;
77
100
  }
78
- /** Credentials for the AI agent principal (machine identity). */
101
+ /**
102
+ * How many sessions' delegation node ids to keep per credential. Only the
103
+ * current session's is ever read; the rest are kept as a small audit tail and
104
+ * bounded so a long-lived install's config doesn't grow without limit.
105
+ */
106
+ export declare const DELEGATION_NODE_HISTORY = 10;
107
+ /**
108
+ * Credentials for the AI agent principal (machine identity). Every harness
109
+ * session owns a distinct DCR client, and every typed sub-agent in that session
110
+ * owns a distinct child client.
111
+ */
79
112
  export interface OryAgentCredentialsBlock {
80
- /** Per-install credentials issued via dynamic client registration. */
81
- dynamic?: OryAgentDynamicCredentials;
82
113
  /**
83
- * Per-sub-agent dynamic client registrations, keyed by sub-agent type
84
- * (e.g. `"Explore"`, `"general-purpose"`). Each entry is a distinct
85
- * OAuth2 client registered via RFC 7591 so the audit trail can
86
- * attribute actions to a specific sub-agent identity. Reused across
87
- * sessions for the same `(projectUrl, subAgentType)` pair.
114
+ * Agent credentials keyed by harness then session.
115
+ */
116
+ dynamic?: Record<string, Record<string, OryAgentDynamicCredentials>>;
117
+ /**
118
+ * Sub-agent registrations keyed by harness, session, then type.
88
119
  */
89
- subAgents?: Record<string, OryAgentDynamicCredentials>;
120
+ subAgents?: Record<string, Record<string, Record<string, OryAgentDynamicCredentials>>>;
121
+ /**
122
+ * Aged-out or superseded registrations queued for best-effort RFC 7592
123
+ * revocation. Failed revocations remain here for a later session to retry.
124
+ */
125
+ retired?: OryAgentDynamicCredentials[];
90
126
  }
127
+ /**
128
+ * Key used when a credential record carries no harness of its own — only
129
+ * reachable by migrating a config written before credentials were keyed by
130
+ * harness, where the `harness` field had never been persisted. Such a record
131
+ * is never re-used (no harness matches it), but it stays addressable so
132
+ * uninstall can still revoke the server-side client rather than orphaning it.
133
+ */
134
+ export declare const UNKNOWN_HARNESS_KEY = "unknown";
135
+ /**
136
+ * Session key for a caller with no session concept — an Agent SDK integration
137
+ * embedded in a long-running service, or a one-off script. Such a caller gets
138
+ * one stable identity under this key rather than a new client per call, which
139
+ * is the only sensible reading of "per session" when there are no sessions.
140
+ * Credentials migrated from a config written before session keying also land
141
+ * here: the session they belonged to is not recoverable, but the record stays
142
+ * addressable so uninstall can revoke it.
143
+ */
144
+ export declare const SESSIONLESS_KEY = "sessionless";
91
145
  /**
92
146
  * What the plugin does when a permission check returns deny.
93
147
  *
94
- * - `observe` — log the denial, emit a `permission.observe_deny` span,
148
+ * - `observe` — log the denial, emit a `permission.observe_deny` activity event,
95
149
  * allow the tool through. The onboarding default: first-time users
96
150
  * see what Ory would block, without being blocked.
97
151
  * - `enforce` — block the tool. The production posture.
98
152
  *
99
- * Orthogonal to {@link OryPluginConfig.auditOnly}, which is a kill-switch
100
- * that disables Ory entirely (no auth, no permission checks). `auditOnly`
101
- * dominates: when set, `permissionMode` is irrelevant.
153
+ * Only meaningful while Agent Security is connected (see
154
+ * {@link resolveConfig}); with no project URL no checks run at all, so there is
155
+ * no deny to have a posture about.
102
156
  */
103
157
  export type PermissionMode = "observe" | "enforce";
158
+ /**
159
+ * The last permission mode read from the server, cached locally so the
160
+ * synchronous config read reflects it across process restarts and survives a
161
+ * temporary loss of connectivity. Written only by the server-read path (see
162
+ * `permission-mode.ts`); never set by hand — the mode is admin-controlled on the
163
+ * Ory project, not locally.
164
+ */
165
+ export interface PermissionModeCache {
166
+ mode: PermissionMode;
167
+ /** Unix epoch ms when this value was last read from the server. */
168
+ fetchedAt: number;
169
+ /** Project this posture was read from. Absent only on legacy scalar caches. */
170
+ projectUrl?: string;
171
+ /** Per-project/principal values used to avoid applying one scope's fallback to another. */
172
+ scopes?: Record<string, {
173
+ mode: PermissionMode;
174
+ fetchedAt: number;
175
+ }>;
176
+ }
104
177
  export interface OryPluginConfig {
105
178
  /**
106
179
  * Ory project API URL — the SDK base path all API calls target. The Ory
@@ -108,6 +181,12 @@ export interface OryPluginConfig {
108
181
  * name is accepted as an alias for `ORY_PROJECT_URL` (see {@link resolveConfig}).
109
182
  */
110
183
  projectUrl?: string;
184
+ /**
185
+ * Canonical Ory Agent Security broker URL. Broker calls resolve this value
186
+ * independently from {@link projectUrl}, which remains the OAuth2/DCR origin.
187
+ * Older configs fall back to `projectUrl` until this key is persisted.
188
+ */
189
+ agentSecurityUrl?: string;
111
190
  /**
112
191
  * Ory project UUID — the other half of the Console "Get Started" pair
113
192
  * (`ORY_PROJECT_ID`). Persisted by the interactive installer because the
@@ -124,43 +203,46 @@ export interface OryPluginConfig {
124
203
  */
125
204
  projectName?: string;
126
205
  workspaceName?: string;
127
- apiKey?: string;
128
- /**
129
- * Token id of the project API key stored in {@link apiKey}, captured when the
130
- * installer mints the key via the Ory Console API. Ory only returns a key's
131
- * secret at creation and deletion addresses the token by id (not by its
132
- * secret value), so the id is persisted here purely so `uninstall` can delete
133
- * the key server-side. Absent for keys minted before id-tracking, or supplied
134
- * by hand via `configure --api-key`.
135
- */
136
- apiKeyId?: string;
206
+ /** Opaque broker node ids keyed by harness and session. Contains no credentials. */
207
+ delegationAnchors?: Record<string, Record<string, string>>;
137
208
  /**
138
209
  * Public OAuth2 client id used by the user PKCE browser flow when
139
210
  * the interactive user login runs (every session). The client must be registered ahead of time
140
211
  * in the Ory project with all four loopback redirect URIs
141
212
  * (`http://127.0.0.1:47823..47826/callback`) and
142
213
  * `token_endpoint_auth_method=none`. The local stack provisions one
143
- * automatically; against a hosted project the operator registers it
144
- * once and supplies the id here (or via `ORY_OAUTH2_CLIENT_ID`).
214
+ * automatically; hosted Agent Security uses the reserved
215
+ * `ory-agent-security-login` client by default. Custom deployments can
216
+ * override the id here or through `ORY_OAUTH2_CLIENT_ID`.
145
217
  */
146
218
  oauth2ClientId?: string;
147
- /** When true, only audit logging is enabled — no auth or permission checks. */
148
- auditOnly?: boolean;
149
219
  /**
150
- * How to handle permission denies when checks *are* running. Defaults
151
- * to `observe` for frictionless first-run; flip to `enforce` once the
152
- * tuple set is correct. See {@link PermissionMode}.
220
+ * The last permission mode read from the Ory project, cached locally. The
221
+ * mode itself is admin-controlled server-side (a Keto permission see
222
+ * `permission-mode.ts`); this is only a cache so the value survives restarts
223
+ * and brief loss of connectivity. Not user-settable.
153
224
  */
154
- permissionMode?: PermissionMode;
225
+ permissionModeCache?: PermissionModeCache;
155
226
  /**
156
- * Permission-check subject namespace for the human user. When set, the
157
- * user is addressed as a SubjectSet `<namespace>:<subject>` in permission
158
- * checks instead of a direct SubjectID this must match how the tuples
159
- * were written in Keto. The local stack seeds tuples as `User:<id>`, so the
160
- * local-stack install path persists `"User"` here to make enforce mode work
161
- * out of the box. The `ORY_USER_SUBJECT_NAMESPACE` env var overrides this.
227
+ * Overrides the namespace the human user is addressed under in permission
228
+ * checks. Users are always addressed as a SubjectSet `<namespace>:<subject>`;
229
+ * this only changes the namespace (default `User`) and must match how the
230
+ * tuples were written in Keto. The local stack seeds tuples as `User:<id>`,
231
+ * so the local-stack install path persists `"User"` here explicitly. The
232
+ * `ORY_USER_SUBJECT_NAMESPACE` env var overrides this. Unset ⇒ the `User`
233
+ * default.
162
234
  */
163
235
  userSubjectNamespace?: string;
236
+ /**
237
+ * Harness plugins currently installed against this shared config, e.g.
238
+ * `["claude-code", "codex"]`. Written by the install path (see
239
+ * `wireRuntime`) and pruned by `uninstall`, so uninstalling one plugin can
240
+ * tell whether it is the *last* consumer of the shared configuration — and
241
+ * therefore whether wiping it is safe. Absent on configs written before the
242
+ * registry existed; the uninstall path falls back to the harnesses evidenced
243
+ * by the runtime manifest and the persisted credentials.
244
+ */
245
+ installedHarnesses?: string[];
164
246
  /** Credentials for the human user (interactive PKCE login). */
165
247
  user?: OryUserCredentials;
166
248
  /** Credentials for the AI agent process (machine identity). */
@@ -196,6 +278,26 @@ export declare function getConfigPath(): string;
196
278
  * does not exist or is invalid.
197
279
  */
198
280
  export declare function loadConfig(): OryPluginConfig;
281
+ /**
282
+ * The harness plugins recorded as installed against this shared config.
283
+ * Returns an empty array when nothing has been registered yet (which, on a
284
+ * config written before the registry existed, is not the same as "nothing is
285
+ * installed" — callers that must not over-read that should reconcile against
286
+ * the runtime manifest and persisted credentials; see
287
+ * `resolveInstalledHarnesses` in `uninstall.ts`).
288
+ */
289
+ export declare function listInstalledHarnesses(): string[];
290
+ /**
291
+ * Record a harness plugin as installed. Idempotent — installing twice leaves
292
+ * one entry. Returns the full list after the addition.
293
+ */
294
+ export declare function registerInstalledHarness(harness: string): string[];
295
+ /**
296
+ * Forget a harness plugin. Returns the harnesses still installed afterwards —
297
+ * what the uninstall path uses to decide whether the shared config is now
298
+ * unreferenced and safe to wipe.
299
+ */
300
+ export declare function unregisterInstalledHarness(harness: string): string[];
199
301
  /**
200
302
  * Save config to the config file. Merges with existing values — only
201
303
  * provided fields are overwritten. Concurrent processes serialize via a
@@ -214,7 +316,7 @@ export declare function saveConfig(update: Partial<{
214
316
  * Concurrent processes serialize on the lock; the write itself is
215
317
  * atomic via write-temp + rename.
216
318
  */
217
- export declare function mutateConfig(mutator: (current: OryPluginConfig) => OryPluginConfig): void;
319
+ export declare function mutateConfig(mutator: (current: OryPluginConfig) => OryPluginConfig | undefined): void;
218
320
  /**
219
321
  * True when `value` looks like an Ory project **id** (a UUID) rather than a
220
322
  * project **slug**. Project slugs are human-readable tokens (e.g.
@@ -226,6 +328,49 @@ export declare function mutateConfig(mutator: (current: OryPluginConfig) => OryP
226
328
  * base URL.
227
329
  */
228
330
  export declare function looksLikeProjectId(value: string): boolean;
331
+ /**
332
+ * The values Agent Security needs, and whether all are present.
333
+ *
334
+ * This is the *only* thing that decides whether the security half of a plugin
335
+ * runs. There is no stored on/off flag and no env override: a plugin is
336
+ * connected exactly when it can address a project (`projectUrl`), reach the
337
+ * canonical broker (`agentSecurityUrl`, with a legacy project URL fallback),
338
+ * and complete the user's browser sign-in (`oauth2ClientId`). Anything less and the
339
+ * authentication gates, permission checks, and delegation recording all no-op.
340
+ *
341
+ * The developer-experience half — skills, commands, the local Ory stack, the
342
+ * MCP server, and local activity logging — is installed unconditionally and never
343
+ * consults this.
344
+ */
345
+ export interface SecurityConnection {
346
+ /** True when all required values resolve (including the legacy broker fallback). */
347
+ connected: boolean;
348
+ /**
349
+ * Which required values are missing, in the order a user should supply them.
350
+ * Empty when {@link connected} is true. Drives every "not connected because…"
351
+ * message so the reason is never guessed at the call site.
352
+ */
353
+ missing: Array<"projectUrl" | "agentSecurityUrl" | "oauth2ClientId">;
354
+ }
355
+ /** Reserved public PKCE client provisioned by Ory Agent Security setup. */
356
+ export declare const DEFAULT_OAUTH2_CLIENT_ID = "ory-agent-security-login";
357
+ export declare const DEFAULT_AGENT_SECURITY_URL = "https://agents.console.ory.com";
358
+ export declare const LOCAL_AGENT_SECURITY_URL = "https://agents.console.ory:8080";
359
+ /**
360
+ * The one predicate the gates ask: is Agent Security connected?
361
+ *
362
+ * Shorthand for `resolveConfig().security.connected`, provided so the many
363
+ * call sites that only need the boolean read as a single question rather than
364
+ * a property walk. When this is false the plugin still runs — it just logs activity
365
+ * locally and gates nothing.
366
+ */
367
+ export declare function isSecurityConnected(): boolean;
368
+ /**
369
+ * Render why Agent Security isn't running, e.g.
370
+ * `"missing --oauth2-client-id (ORY_OAUTH2_CLIENT_ID)"`. Returns undefined when
371
+ * it *is* connected, so callers can `?? "connected"` at the display site.
372
+ */
373
+ export declare function describeSecurityGap(security?: SecurityConnection): string | undefined;
229
374
  /**
230
375
  * Resolve config by checking environment variables first, then the config file.
231
376
  * Returns the merged result with the source of each value.
@@ -237,22 +382,40 @@ export declare function looksLikeProjectId(value: string): boolean;
237
382
  */
238
383
  export declare function resolveConfig(): {
239
384
  projectUrl?: string;
385
+ agentSecurityUrl?: string;
240
386
  projectId?: string;
241
387
  projectName?: string;
242
388
  workspaceName?: string;
243
- apiKey?: string;
244
389
  oauth2ClientId?: string;
245
- auditOnly: boolean;
390
+ /**
391
+ * Whether Agent Security runs, derived from the project and broker URLs. The
392
+ * OAuth2 client always resolves through an override or the reserved default.
393
+ * See {@link SecurityConnection}.
394
+ */
395
+ security: SecurityConnection;
396
+ /**
397
+ * The permission mode as last read from the server and cached locally
398
+ * (`observe` when nothing is cached). The authoritative, live value is
399
+ * resolved per-check by `resolvePermissionMode`; this synchronous value is the
400
+ * cached fallback used by display surfaces and the MCP `applyPermissionMode`
401
+ * path.
402
+ */
246
403
  permissionMode: PermissionMode;
247
- permissionModeSource: "env" | "config" | "default";
404
+ permissionModeSource: "server" | "cache" | "default";
405
+ /** The raw cache entry, exposing `fetchedAt` for freshness display. */
406
+ permissionModeCache?: PermissionModeCache;
248
407
  userSubjectNamespace?: string;
249
408
  userSubjectNamespaceSource: "env" | "config" | "none";
250
409
  projectUrlSource: "env" | "config" | "none";
410
+ agentSecurityUrlSource: "env" | "config" | "projectUrl" | "default";
251
411
  projectIdSource: "env" | "config" | "none";
252
- apiKeySource: "env" | "config" | "none";
253
- oauth2ClientIdSource: "env" | "config" | "none";
412
+ oauth2ClientIdSource: "env" | "config" | "default";
254
413
  };
255
414
  /**
256
- * Build the "not configured" prompt message for a given harness CLI bin name.
415
+ * Build the "Agent Security is not connected" message for a harness CLI.
416
+ *
417
+ * Deliberately does not frame this as a degraded mode: the plugin is fully
418
+ * installed and its developer-experience half is working. The message states
419
+ * the one thing that is off and the values that turn it on.
257
420
  */
258
421
  export declare function configPromptMessage(binName: string): string;