@ory/argus 0.14.0 → 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.
- package/README.md +31 -46
- package/assets/commands/temporal-up.md +1 -1
- package/assets/skills/auth-setup/SKILL.md +1 -1
- package/assets/skills/local-dev/SKILL.md +17 -7
- package/assets/skills/ory-build-agent/SKILL.md +39 -91
- package/assets/skills/ory-e2b-sandbox/SKILL.md +18 -17
- package/assets/skills/ory-temporal-worker/SKILL.md +31 -33
- package/assets/skills/permissions-onboarding/SKILL.md +131 -104
- package/dist/adapters.d.ts +88 -32
- package/dist/adapters.js +443 -164
- package/dist/agent-auth.d.ts +226 -67
- package/dist/agent-auth.js +951 -205
- package/dist/auth-store.d.ts +37 -2
- package/dist/auth-store.js +37 -3
- package/dist/auth.d.ts +33 -4
- package/dist/auth.js +163 -20
- package/dist/bash-parser.d.ts +98 -0
- package/dist/bash-parser.js +396 -0
- package/dist/branding.d.ts +77 -16
- package/dist/branding.js +93 -23
- package/dist/build-info.json +4 -4
- package/dist/cli-invocation.d.ts +1 -1
- package/dist/cli-invocation.js +2 -1
- package/dist/cli.d.ts +20 -29
- package/dist/cli.js +271 -239
- package/dist/client.d.ts +175 -138
- package/dist/client.js +672 -391
- package/dist/config.d.ts +217 -54
- package/dist/config.js +461 -42
- package/dist/context.d.ts +10 -0
- package/dist/context.js +21 -0
- package/dist/contract-suite.d.ts +3 -5
- package/dist/contract-suite.js +75 -47
- package/dist/denial.d.ts +36 -3
- package/dist/denial.js +79 -10
- package/dist/event-reporter.d.ts +77 -0
- package/dist/event-reporter.js +776 -0
- package/dist/external-registrations-main.d.ts +10 -0
- package/dist/external-registrations-main.js +38 -0
- package/dist/external-registrations.d.ts +79 -0
- package/dist/external-registrations.js +188 -0
- package/dist/help-cli.d.ts +39 -0
- package/dist/help-cli.js +55 -0
- package/dist/hook-timeout.d.ts +64 -0
- package/dist/hook-timeout.js +88 -0
- package/dist/index.d.ts +28 -23
- package/dist/index.js +173 -58
- package/dist/lifecycle.d.ts +3 -3
- package/dist/lifecycle.js +38 -6
- package/dist/local/cli.js +11 -6
- package/dist/local/configs.d.ts +74 -18
- package/dist/local/configs.js +291 -84
- package/dist/local/health.js +7 -7
- package/dist/local/index.d.ts +2 -2
- package/dist/local/index.js +24 -10
- package/dist/local/manager.d.ts +20 -1
- package/dist/local/manager.js +159 -36
- package/dist/local/ports.d.ts +158 -0
- package/dist/local/ports.js +443 -0
- package/dist/local/seed.d.ts +13 -5
- package/dist/local/seed.js +62 -38
- package/dist/logger.d.ts +54 -25
- package/dist/logger.js +329 -63
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +10 -5
- package/dist/mirror-bootstrap.d.ts +48 -0
- package/dist/mirror-bootstrap.js +254 -0
- package/dist/opl.d.ts +289 -0
- package/dist/opl.js +446 -0
- package/dist/permission-mode.d.ts +87 -0
- package/dist/permission-mode.js +307 -0
- package/dist/permissions-cli.d.ts +13 -49
- package/dist/permissions-cli.js +154 -348
- package/dist/permissions.d.ts +148 -38
- package/dist/permissions.js +591 -45
- package/dist/post-install.d.ts +33 -0
- package/dist/post-install.js +127 -0
- package/dist/read-credential.d.ts +65 -0
- package/dist/read-credential.js +86 -0
- package/dist/registry/cli.js +5 -2
- package/dist/registry/config.d.ts +0 -17
- package/dist/registry/config.js +0 -23
- package/dist/registry/index.d.ts +1 -1
- package/dist/registry/index.js +2 -2
- package/dist/registry/manager.d.ts +4 -21
- package/dist/registry/manager.js +21 -37
- package/dist/runtime-credential.d.ts +140 -0
- package/dist/runtime-credential.js +572 -0
- package/dist/runtime.d.ts +408 -0
- package/dist/runtime.js +748 -0
- package/dist/setup.d.ts +23 -47
- package/dist/setup.js +59 -116
- package/dist/skills.js +0 -7
- package/dist/status-cli.d.ts +27 -11
- package/dist/status-cli.js +121 -115
- package/dist/status-data.d.ts +116 -17
- package/dist/status-data.js +121 -38
- package/dist/subject.d.ts +126 -20
- package/dist/subject.js +215 -30
- package/dist/testing.d.ts +74 -38
- package/dist/testing.js +185 -68
- package/dist/tool-catalog.d.ts +53 -11
- package/dist/tool-catalog.js +164 -13
- package/dist/tool-metadata.d.ts +7 -6
- package/dist/tool-metadata.js +6 -5
- package/dist/types.d.ts +11 -1
- package/dist/uninstall.d.ts +71 -34
- package/dist/uninstall.js +217 -85
- package/dist/user-login.d.ts +9 -10
- package/dist/user-login.js +56 -75
- package/dist/watch-cli.d.ts +6 -0
- package/dist/watch-cli.js +217 -0
- package/package.json +4 -27
- package/assets/commands/dashboard.md +0 -34
- package/dist/dashboard-cli.d.ts +0 -8
- package/dist/dashboard-cli.js +0 -70
- package/dist/dev.d.ts +0 -103
- package/dist/dev.js +0 -583
- package/dist/interactive-setup.d.ts +0 -286
- package/dist/interactive-setup.js +0 -1734
- package/dist/local/jaeger-main.d.ts +0 -13
- package/dist/local/jaeger-main.js +0 -85
- package/dist/local/jaeger.d.ts +0 -50
- package/dist/local/jaeger.js +0 -162
- package/dist/otel/exporter.d.ts +0 -17
- package/dist/otel/exporter.js +0 -12
- package/dist/otel/index.d.ts +0 -2
- package/dist/otel/index.js +0 -8
- package/dist/otel/otlp.d.ts +0 -103
- package/dist/otel/otlp.js +0 -385
- package/dist/project-api-key.d.ts +0 -69
- package/dist/project-api-key.js +0 -147
- package/dist/setup-actions.d.ts +0 -232
- package/dist/setup-actions.js +0 -507
- package/dist/tracer.d.ts +0 -190
- package/dist/tracer.js +0 -481
- package/dist/watch-sandbox.d.ts +0 -9
- package/dist/watch-sandbox.js +0 -81
- package/dist/web/api.d.ts +0 -33
- package/dist/web/api.js +0 -294
- package/dist/web/launch.d.ts +0 -11
- package/dist/web/launch.js +0 -96
- package/dist/web/server.d.ts +0 -20
- package/dist/web/server.js +0 -233
- package/dist/web/types.d.ts +0 -65
- package/dist/web/types.js +0 -2
- package/dist/webapp/assets/index-Wucl4SZs.css +0 -1
- package/dist/webapp/assets/index-m-GtEdq0.js +0 -49
- package/dist/webapp/favicon.ico +0 -0
- package/dist/webapp/index.html +0 -15
package/dist/agent-auth.d.ts
CHANGED
|
@@ -3,31 +3,17 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The "agent" is the AI process making calls on behalf of the human
|
|
5
5
|
* user. Unlike the user, the agent never authenticates interactively.
|
|
6
|
-
* The
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* (or an out-of-band initial access token), and persists the issued
|
|
10
|
-
* credentials so subsequent runs reuse them.
|
|
6
|
+
* The normal path resolves a noninteractive runtime credential: an injected
|
|
7
|
+
* request authenticator, `ORY_AGENT_API_KEY`, or a Talos key enrolled with the
|
|
8
|
+
* already-authenticated user. Enrolled keys remain process-local.
|
|
11
9
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* 2. ORY_AGENT_CLIENT_ID +
|
|
16
|
-
* ORY_AGENT_CLIENT_SECRET — explicit static client_credentials
|
|
17
|
-
* 3. Persisted dynamic credentials — reuse a prior DCR registration
|
|
18
|
-
* 4. Fresh dynamic registration — POST /oauth2/register using the
|
|
19
|
-
* user's bearer or
|
|
20
|
-
* ORY_AGENT_REGISTRATION_TOKEN
|
|
21
|
-
* 5. ORY_API_KEY (deprecated) — alias for ORY_AGENT_API_KEY
|
|
22
|
-
* 6. <none> — fail-open; plugin runs without
|
|
23
|
-
* agent identity in audit logs
|
|
24
|
-
*
|
|
25
|
-
* Token-exchange (RFC 8693) — deriving an agent token whose `sub` is
|
|
26
|
-
* the user with an `act` claim showing the agent — is intentionally
|
|
27
|
-
* deferred.
|
|
10
|
+
* Legacy DCR and client-credentials helpers remain exported temporarily so the
|
|
11
|
+
* monorepo and existing consumers compile, but the normal gates do not select
|
|
12
|
+
* them.
|
|
28
13
|
*/
|
|
29
14
|
import { type OryAgentDynamicCredentials, type OryDelegationRecord } from "./config.js";
|
|
30
15
|
import { OryAgentClient } from "./client.js";
|
|
16
|
+
import { enrollTalosChildRuntimeCredential, enrollTalosRuntimeCredential, type RuntimeCredential, type RuntimeRequestAuthenticator, type TalosCredentialStore } from "./runtime-credential.js";
|
|
31
17
|
/**
|
|
32
18
|
* Delegation context handed to {@link registerAgentClient} so the freshly
|
|
33
19
|
* minted OAuth2 client is stamped with its delegator at the identity layer.
|
|
@@ -39,11 +25,13 @@ export interface DelegationInput {
|
|
|
39
25
|
delegationType: OryDelegationRecord["delegationType"];
|
|
40
26
|
subAgentType?: string;
|
|
41
27
|
}
|
|
42
|
-
export type AgentCredentialKind = "
|
|
28
|
+
export type AgentCredentialKind = "talos" | "injected" | "client_credentials" | "dynamic" | "none";
|
|
43
29
|
export interface AgentCredentials {
|
|
44
30
|
kind: AgentCredentialKind;
|
|
45
31
|
/** Bearer token to attach to outgoing Ory API calls. */
|
|
46
32
|
token?: string;
|
|
33
|
+
/** Request-level credential used by Agent Security broker transports. */
|
|
34
|
+
runtimeCredential?: RuntimeCredential;
|
|
47
35
|
/** Subject (sub) the token represents — usually the client_id. */
|
|
48
36
|
subject?: string;
|
|
49
37
|
/** Unix epoch seconds at which the token expires (client_credentials only). */
|
|
@@ -55,8 +43,8 @@ export interface AgentCredentials {
|
|
|
55
43
|
*/
|
|
56
44
|
reason: string;
|
|
57
45
|
/**
|
|
58
|
-
* Diagnostic warnings raised during resolution (e.g.
|
|
59
|
-
*
|
|
46
|
+
* Diagnostic warnings raised during resolution (e.g. a client_credentials
|
|
47
|
+
* grant that had to be retried). Never blocks resolution.
|
|
60
48
|
*/
|
|
61
49
|
warnings: string[];
|
|
62
50
|
/**
|
|
@@ -84,6 +72,17 @@ export interface ResolveAgentCredentialsOptions {
|
|
|
84
72
|
userSubject?: string;
|
|
85
73
|
/** Harness identifier — baked into the registered client_name. */
|
|
86
74
|
harness?: string;
|
|
75
|
+
/**
|
|
76
|
+
* The harness session this resolution belongs to. Each session gets its own
|
|
77
|
+
* OAuth2 identity, so this is part of the credential key and of the
|
|
78
|
+
* registered `client_name`. Omitted ⇒ the caller has no session concept and
|
|
79
|
+
* gets the single {@link SESSIONLESS_KEY} identity.
|
|
80
|
+
*/
|
|
81
|
+
sessionId?: string;
|
|
82
|
+
/** Abort network work owned by this resolution attempt. */
|
|
83
|
+
signal?: AbortSignal;
|
|
84
|
+
/** Skip fresh DCR when a caller may only recover an existing identity. */
|
|
85
|
+
allowRegistration?: boolean;
|
|
87
86
|
/** Inject the client_credentials token-grant function for tests. */
|
|
88
87
|
fetchClientCredentialsTokenFn?: typeof fetchClientCredentialsToken;
|
|
89
88
|
/** Inject the DCR registration call for tests. */
|
|
@@ -92,9 +91,28 @@ export interface ResolveAgentCredentialsOptions {
|
|
|
92
91
|
loadDynamicFn?: typeof loadAgentDynamicCredentials;
|
|
93
92
|
saveDynamicFn?: typeof saveAgentDynamicCredentials;
|
|
94
93
|
clearDynamicFn?: typeof clearAgentDynamicCredentials;
|
|
95
|
-
/**
|
|
94
|
+
/** Inject the RFC 7592 revoke used to clean up a lost registration race. */
|
|
95
|
+
revokeFn?: typeof revokeAgentDynamicClient;
|
|
96
|
+
/** Bypass the in-memory token cache (tests). */
|
|
96
97
|
skipCache?: boolean;
|
|
97
98
|
}
|
|
99
|
+
export interface ResolveRuntimeAgentCredentialsOptions {
|
|
100
|
+
env?: NodeJS.ProcessEnv;
|
|
101
|
+
subject?: string;
|
|
102
|
+
projectUrl?: string;
|
|
103
|
+
runtimeCredential?: RuntimeCredential;
|
|
104
|
+
requestAuthenticator?: RuntimeRequestAuthenticator;
|
|
105
|
+
credentialStore?: TalosCredentialStore;
|
|
106
|
+
fetchImpl?: typeof fetch;
|
|
107
|
+
signal?: AbortSignal;
|
|
108
|
+
harness?: string;
|
|
109
|
+
sessionId?: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Resolve the runtime credential used by the normal Agent Security path.
|
|
113
|
+
* This intentionally does not inspect OAuth client credentials or persisted DCR.
|
|
114
|
+
*/
|
|
115
|
+
export declare function resolveRuntimeAgentCredentials(options?: ResolveRuntimeAgentCredentialsOptions): Promise<AgentCredentials>;
|
|
98
116
|
/**
|
|
99
117
|
* Skew window before nominal expiry at which a cached client_credentials
|
|
100
118
|
* token is considered stale. Matches the user-token skew in auth-store.
|
|
@@ -102,18 +120,118 @@ export interface ResolveAgentCredentialsOptions {
|
|
|
102
120
|
export declare const AGENT_TOKEN_EXPIRY_SKEW_SEC = 60;
|
|
103
121
|
/** Drop all cached agent client_credentials tokens. Tests only. */
|
|
104
122
|
export declare function _resetAgentCredentialsCache(): void;
|
|
105
|
-
/**
|
|
106
|
-
export declare function
|
|
107
|
-
/**
|
|
108
|
-
export declare function
|
|
109
|
-
/**
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
export declare function
|
|
115
|
-
/**
|
|
116
|
-
|
|
123
|
+
/** Evict a bearer rejected by Agent Security without disturbing other sessions. */
|
|
124
|
+
export declare function invalidateAgentAccessToken(rejectedToken: string): void;
|
|
125
|
+
/** Load persisted sub-agent DCR credentials for one harness + type. */
|
|
126
|
+
export declare function loadSubAgentDynamicCredentials(harness: string, sessionOrType: string, subAgentType?: string): OryAgentDynamicCredentials | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* Load one harness's persisted sub-agent registrations, keyed by sub-agent type.
|
|
129
|
+
* Returns an empty object when none have been registered. Used by the status
|
|
130
|
+
* report to enumerate the sub-agent kinds this harness has resolved.
|
|
131
|
+
*/
|
|
132
|
+
export declare function loadAllSubAgentDynamicCredentials(harness: string, sessionKey?: string): Record<string, OryAgentDynamicCredentials>;
|
|
133
|
+
/**
|
|
134
|
+
* Every persisted sub-agent registration, keyed by harness, session, then type. Used by
|
|
135
|
+
* teardown and reporting paths that must reach beyond the harness they run under.
|
|
136
|
+
*/
|
|
137
|
+
export declare function loadSubAgentDynamicCredentialsByHarness(): Record<string, Record<string, Record<string, OryAgentDynamicCredentials>>>;
|
|
138
|
+
/** Persist sub-agent DCR credentials under the given harness + session + type. */
|
|
139
|
+
export declare function saveSubAgentDynamicCredentials(harness: string, subAgentType: string, creds: OryAgentDynamicCredentials): void;
|
|
140
|
+
export declare function saveSubAgentDynamicCredentials(harness: string, sessionKey: string, subAgentType: string, creds: OryAgentDynamicCredentials): void;
|
|
141
|
+
/** Remove persisted sub-agent DCR credentials for one harness + type. */
|
|
142
|
+
export declare function clearSubAgentDynamicCredentials(harness: string, sessionOrType: string, subAgentType?: string): void;
|
|
143
|
+
/** Remove every persisted sub-agent registration for one harness. */
|
|
144
|
+
export declare function clearSubAgentDynamicCredentialsForHarness(harness: string): void;
|
|
145
|
+
/** Load persisted DCR credentials for one harness session. */
|
|
146
|
+
export declare function loadAgentDynamicCredentials(harness: string, sessionKey?: string): OryAgentDynamicCredentials | undefined;
|
|
147
|
+
/**
|
|
148
|
+
* Every persisted agent registration, keyed by harness then session.
|
|
149
|
+
* reporting paths that must reach beyond the harness they run under.
|
|
150
|
+
*/
|
|
151
|
+
export declare function loadAgentDynamicCredentialsByHarness(): Record<string, Record<string, OryAgentDynamicCredentials>>;
|
|
152
|
+
/**
|
|
153
|
+
* Persist DCR credentials for one harness install. Other harnesses are left
|
|
154
|
+
* untouched.
|
|
155
|
+
*/
|
|
156
|
+
export declare function saveAgentDynamicCredentials(harness: string, creds: OryAgentDynamicCredentials): void;
|
|
157
|
+
export declare function saveAgentDynamicCredentials(harness: string, sessionKey: string, creds: OryAgentDynamicCredentials): void;
|
|
158
|
+
/** Remove one session, or every session when no session key is supplied. */
|
|
159
|
+
export declare function clearAgentDynamicCredentials(harness: string, sessionKey?: string): void;
|
|
160
|
+
/** Most recently registered agent session for status/reporting. */
|
|
161
|
+
export declare function latestAgentRegistration(harness: string): {
|
|
162
|
+
sessionKey: string;
|
|
163
|
+
credentials: OryAgentDynamicCredentials;
|
|
164
|
+
} | undefined;
|
|
165
|
+
/** Newest session containing at least one sub-agent registration. */
|
|
166
|
+
export declare function latestSubAgentSession(harness: string): string | undefined;
|
|
167
|
+
export declare function countAgentSessions(harness: string): number;
|
|
168
|
+
/**
|
|
169
|
+
* The delegation node the broker assigned to this harness's `user → agent` edge
|
|
170
|
+
* for one session, or `undefined` if that session hasn't recorded one yet.
|
|
171
|
+
*
|
|
172
|
+
* Read by the sub-agent edge to pass as `delegated_by` — which is why it is
|
|
173
|
+
* looked up by session and not just by harness: the credential is shared across
|
|
174
|
+
* sessions but the node is not, so a sub-agent must hang off *its own* run's
|
|
175
|
+
* agent node.
|
|
176
|
+
*/
|
|
177
|
+
export declare function loadDelegationNodeId(harness: string, sessionKey: string): string | undefined;
|
|
178
|
+
/**
|
|
179
|
+
* Record the broker-assigned delegation node for `(harness, session)`, trimming
|
|
180
|
+
* the map to the most recent {@link DELEGATION_NODE_HISTORY} entries.
|
|
181
|
+
*
|
|
182
|
+
* The anchor is not a credential and is safe to persist independently. A
|
|
183
|
+
* repeated idempotent edge does not rewrite the config file.
|
|
184
|
+
*/
|
|
185
|
+
export declare function saveDelegationNodeId(harness: string, sessionKey: string, nodeId: string): void;
|
|
186
|
+
/** Registrations queued for best-effort revocation. */
|
|
187
|
+
export declare function loadRetiredCredentials(): OryAgentDynamicCredentials[];
|
|
188
|
+
/**
|
|
189
|
+
* Remove `clientIds` from the drain queue. Called with the ones that were
|
|
190
|
+
* actually revoked; anything left stays queued for the next run, so a transient
|
|
191
|
+
* failure retries instead of orphaning the client.
|
|
192
|
+
*/
|
|
193
|
+
export declare function clearRetiredCredentials(clientIds: readonly string[]): void;
|
|
194
|
+
/** Automatic retirement is opt-in because age alone cannot prove a session ended. */
|
|
195
|
+
export declare const DEFAULT_SESSION_RETENTION = 0;
|
|
196
|
+
/** `0` disables automatic retirement. */
|
|
197
|
+
export declare function sessionRetention(env?: NodeJS.ProcessEnv): number;
|
|
198
|
+
/**
|
|
199
|
+
* Move aged-out agent sessions and all of their child credentials to the
|
|
200
|
+
* retirement queue atomically. They remain addressable until RFC 7592 cleanup
|
|
201
|
+
* succeeds, avoiding the orphaning behavior of the original pruning path.
|
|
202
|
+
*/
|
|
203
|
+
export declare function retireAgentSessions(harness: string, opts: {
|
|
204
|
+
keep: number;
|
|
205
|
+
protect?: string;
|
|
206
|
+
}): number;
|
|
207
|
+
/**
|
|
208
|
+
* The credentials a cold-starting session ends up with after registering, and
|
|
209
|
+
* whether a concurrent peer beat it to the slot.
|
|
210
|
+
*/
|
|
211
|
+
export interface AgentRegistrationClaim {
|
|
212
|
+
/** The credentials now persisted for this key — ours, or the peer's. */
|
|
213
|
+
credentials: OryAgentDynamicCredentials;
|
|
214
|
+
/**
|
|
215
|
+
* True when a peer registration was already persisted for this key, so the
|
|
216
|
+
* freshly minted client was *not* stored. The caller should revoke it
|
|
217
|
+
* (RFC 7592) rather than leave an orphan on the project.
|
|
218
|
+
*/
|
|
219
|
+
peer: boolean;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Persist a freshly registered agent client, unless a concurrent peer already
|
|
223
|
+
* claimed the `(projectUrl, harness)` slot.
|
|
224
|
+
*
|
|
225
|
+
* Keying credentials by harness removes the cold-start collision *between*
|
|
226
|
+
* harnesses, but two instances of the *same* harness starting at once still
|
|
227
|
+
* target one key. Both POST `/oauth2/register`, and a plain last-writer-wins
|
|
228
|
+
* save would leave one client orphaned server-side (and its delegation edge
|
|
229
|
+
* dangling). The read and the write happen inside a single `mutateConfig`, so
|
|
230
|
+
* the loser sees the winner's registration and reports it back to be revoked.
|
|
231
|
+
*/
|
|
232
|
+
export declare function claimAgentDynamicCredentials(harness: string, sessionKey: string, registered: OryAgentDynamicCredentials): AgentRegistrationClaim;
|
|
233
|
+
/** {@link claimAgentDynamicCredentials} for a `(harness, subAgentType)` slot. */
|
|
234
|
+
export declare function claimSubAgentDynamicCredentials(harness: string, sessionKey: string, subAgentType: string, registered: OryAgentDynamicCredentials): AgentRegistrationClaim;
|
|
117
235
|
/** Outcome of a best-effort RFC 7592 client revocation. */
|
|
118
236
|
export interface RevokeAgentClientResult {
|
|
119
237
|
/**
|
|
@@ -145,6 +263,10 @@ export interface RegisterAgentClientArgs {
|
|
|
145
263
|
harness?: string;
|
|
146
264
|
/** When set, names the client as a sub-agent of the given type. */
|
|
147
265
|
subAgentType?: string;
|
|
266
|
+
/** Session owning this DCR client; included in its display name. */
|
|
267
|
+
sessionId?: string;
|
|
268
|
+
/** Abort the registration request when its owning operation expires. */
|
|
269
|
+
signal?: AbortSignal;
|
|
148
270
|
/**
|
|
149
271
|
* Delegation edge recorded for this client. When present, the issued
|
|
150
272
|
* credentials carry a durable record of who delegated to the agent — the
|
|
@@ -164,15 +286,14 @@ export interface RegisterAgentClientArgs {
|
|
|
164
286
|
* either by the user's interactive token (the natural bootstrap) or by
|
|
165
287
|
* a pre-issued initial access token (`ORY_AGENT_REGISTRATION_TOKEN`).
|
|
166
288
|
* Throws on any non-2xx response so callers can decide whether to
|
|
167
|
-
* retry, fall back, or surface the error in
|
|
289
|
+
* retry, fall back, or surface the error in audit activity. The
|
|
168
290
|
* `HTTP <status>` error message shape is preserved so callers and tests
|
|
169
291
|
* can pattern-match on it regardless of the underlying transport.
|
|
170
292
|
*/
|
|
171
293
|
export declare function registerAgentClient(args: RegisterAgentClientArgs): Promise<OryAgentDynamicCredentials>;
|
|
172
294
|
/**
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* so the caller can fail open.
|
|
295
|
+
* Legacy OAuth/DCR resolver retained for source compatibility. Normal runtime
|
|
296
|
+
* gates use {@link resolveRuntimeAgentCredentials} instead.
|
|
176
297
|
*/
|
|
177
298
|
export declare function resolveAgentCredentials(options?: ResolveAgentCredentialsOptions): Promise<AgentCredentials>;
|
|
178
299
|
interface ClientCredentialsTokenArgs {
|
|
@@ -181,6 +302,7 @@ interface ClientCredentialsTokenArgs {
|
|
|
181
302
|
clientSecret: string;
|
|
182
303
|
audience?: string;
|
|
183
304
|
scope?: string;
|
|
305
|
+
signal?: AbortSignal;
|
|
184
306
|
}
|
|
185
307
|
interface ClientCredentialsTokenResult {
|
|
186
308
|
accessToken: string;
|
|
@@ -190,20 +312,47 @@ interface ClientCredentialsTokenResult {
|
|
|
190
312
|
/** POST /oauth2/token with grant_type=client_credentials. */
|
|
191
313
|
export declare function fetchClientCredentialsToken(args: ClientCredentialsTokenArgs): Promise<ClientCredentialsTokenResult>;
|
|
192
314
|
export interface EnsureAgentIdentityOptions {
|
|
193
|
-
/**
|
|
315
|
+
/** Retained for source compatibility; runtime resolution uses the connected client. */
|
|
194
316
|
projectUrl?: string;
|
|
195
|
-
/**
|
|
317
|
+
/** Retained for source compatibility and activity attribution. */
|
|
196
318
|
harness?: string;
|
|
319
|
+
/**
|
|
320
|
+
* Session this identity acts in. Selects the persisted DCR slot and defaults
|
|
321
|
+
* to the client's ambient session.
|
|
322
|
+
*/
|
|
323
|
+
sessionId?: string;
|
|
324
|
+
/** Abort network work when a bounded caller, such as hook shutdown, expires. */
|
|
325
|
+
signal?: AbortSignal;
|
|
326
|
+
/** @deprecated Runtime resolution never uses DCR. */
|
|
327
|
+
allowRegistration?: boolean;
|
|
328
|
+
/** Inject the RFC 7592 revoke used when draining retired credentials. */
|
|
329
|
+
revokeFn?: typeof revokeAgentDynamicClient;
|
|
197
330
|
/** Env override (defaults to process.env). */
|
|
198
331
|
env?: NodeJS.ProcessEnv;
|
|
199
332
|
/** Inject resolver for tests. */
|
|
200
|
-
resolveFn?:
|
|
333
|
+
resolveFn?: (options: ResolveRuntimeAgentCredentialsOptions & ResolveAgentCredentialsOptions) => Promise<AgentCredentials>;
|
|
334
|
+
/** Inject OS-backed persistence for tests or embedded runtimes. */
|
|
335
|
+
credentialStore?: TalosCredentialStore;
|
|
336
|
+
/** Inject Talos enrollment for tests. */
|
|
337
|
+
enrollFn?: typeof enrollTalosRuntimeCredential;
|
|
338
|
+
/** Inject random idempotency-key generation for tests. */
|
|
339
|
+
createIdempotencyKey?: () => string;
|
|
340
|
+
/**
|
|
341
|
+
* @deprecated Normal runtime resolution never processes OAuth registrations.
|
|
342
|
+
*/
|
|
343
|
+
drainRetired?: boolean;
|
|
344
|
+
/**
|
|
345
|
+
* What prompted this resolution, recorded on the `agent.auth` activity event. Absent for
|
|
346
|
+
* the session-start gate; `read_credential` when the tool gate resolved the
|
|
347
|
+
* identity because it needed a credential to authenticate a permission read.
|
|
348
|
+
*/
|
|
349
|
+
trigger?: string;
|
|
201
350
|
}
|
|
202
351
|
/**
|
|
203
352
|
* Resolve the agent's credentials and attach them to the client.
|
|
204
353
|
*
|
|
205
354
|
* Always returns the resolved credentials; never throws and never blocks.
|
|
206
|
-
* Emits exactly one `agent.auth`
|
|
355
|
+
* Emits exactly one `agent.auth` activity event so the audit trail records whether
|
|
207
356
|
* the agent identity was available for the session.
|
|
208
357
|
*/
|
|
209
358
|
export declare function ensureAgentIdentity(client: OryAgentClient, options?: EnsureAgentIdentityOptions): Promise<AgentCredentials>;
|
|
@@ -211,19 +360,22 @@ export declare function ensureAgentIdentity(client: OryAgentClient, options?: En
|
|
|
211
360
|
* Resolved identity for a sub-agent (a typed worker that the parent
|
|
212
361
|
* agent delegates to, e.g. Claude Code's `Task` tool launching an
|
|
213
362
|
* `Explore` sub-agent). The shape mirrors AgentCredentials but the
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
* into the harness's child process.
|
|
363
|
+
* harness integration reloads the child runtime credential for hooks that
|
|
364
|
+
* execute inside that child; the secret is never injected into the child process.
|
|
217
365
|
*/
|
|
218
366
|
export interface SubAgentIdentity {
|
|
219
|
-
/**
|
|
220
|
-
kind: "dynamic" | "none";
|
|
367
|
+
/** `runtime` in normal use; `dynamic` remains for injected legacy callers. */
|
|
368
|
+
kind: "runtime" | "dynamic" | "none";
|
|
221
369
|
/** Sub-agent type as reported by the harness (e.g. "Explore"). */
|
|
222
370
|
subAgentType: string;
|
|
223
371
|
/** Issued client_id — also used as the audit subject for this sub-agent. */
|
|
224
372
|
subject?: string;
|
|
373
|
+
/** Access token proving the reported sub-agent client id to the broker. */
|
|
374
|
+
token?: string;
|
|
225
375
|
/** Persisted credentials returned by registration (or reloaded). */
|
|
226
376
|
credentials?: OryAgentDynamicCredentials;
|
|
377
|
+
/** Child-owned credential used for delegation and subsequent child calls. */
|
|
378
|
+
runtimeCredential?: RuntimeCredential;
|
|
227
379
|
/** One-line reason suitable for telemetry. */
|
|
228
380
|
reason: string;
|
|
229
381
|
/** Diagnostic warnings raised during resolution. */
|
|
@@ -232,35 +384,42 @@ export interface SubAgentIdentity {
|
|
|
232
384
|
export interface EnsureSubAgentIdentityOptions {
|
|
233
385
|
/** Sub-agent type identifier (e.g. "Explore", "general-purpose"). */
|
|
234
386
|
subAgentType: string;
|
|
235
|
-
/**
|
|
387
|
+
/** Retained for source compatibility; no DCR request is made. */
|
|
236
388
|
projectUrl?: string;
|
|
237
|
-
/** Harness identifier
|
|
389
|
+
/** Harness identifier used for activity and delegation context. */
|
|
238
390
|
harness?: string;
|
|
391
|
+
/** Session this sub-agent belongs to. Defaults to the client's ambient session. */
|
|
392
|
+
sessionId?: string;
|
|
393
|
+
/** Stable identifier for this individual child spawn. */
|
|
394
|
+
perSpawnId?: string;
|
|
395
|
+
/** Abort network work owned by this resolution attempt. */
|
|
396
|
+
signal?: AbortSignal;
|
|
397
|
+
/** Let an adapter emit authentication after selecting the Sub-Agent bearer. */
|
|
398
|
+
emitActivity?: boolean;
|
|
239
399
|
/**
|
|
240
|
-
*
|
|
241
|
-
* parent agent's token (when populated) so the audit trail shows the
|
|
242
|
-
* agent registering its sub-agent. Falls back to the user's token,
|
|
243
|
-
* then `ORY_AGENT_REGISTRATION_TOKEN`.
|
|
400
|
+
* @deprecated Runtime sub-agent resolution never registers OAuth clients.
|
|
244
401
|
*/
|
|
245
402
|
iat?: string;
|
|
246
403
|
/** Env override (defaults to process.env). */
|
|
247
404
|
env?: NodeJS.ProcessEnv;
|
|
248
|
-
/**
|
|
405
|
+
/** @deprecated Retained for source compatibility and never called. */
|
|
249
406
|
registerAgentClientFn?: typeof registerAgentClient;
|
|
250
|
-
/**
|
|
407
|
+
/** @deprecated Retained for source compatibility and never called. */
|
|
251
408
|
loadFn?: typeof loadSubAgentDynamicCredentials;
|
|
252
409
|
saveFn?: typeof saveSubAgentDynamicCredentials;
|
|
410
|
+
/** @deprecated Retained for source compatibility and never called. */
|
|
411
|
+
revokeFn?: typeof revokeAgentDynamicClient;
|
|
412
|
+
/** @deprecated Retained for source compatibility and never called. */
|
|
413
|
+
fetchClientCredentialsTokenFn?: typeof fetchClientCredentialsToken;
|
|
414
|
+
credentialStore?: TalosCredentialStore;
|
|
415
|
+
enrollFn?: typeof enrollTalosChildRuntimeCredential;
|
|
416
|
+
createIdempotencyKey?: () => string;
|
|
417
|
+
allowEnrollment?: boolean;
|
|
253
418
|
}
|
|
254
419
|
/**
|
|
255
|
-
* Resolve a sub-agent
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
* pair matches; otherwise registers a fresh client named
|
|
259
|
-
* `Ory Agent Security · sub-agent · <harness>/<type> @ <host>` and persists the result.
|
|
260
|
-
* Never throws and never blocks — on any failure the identity collapses
|
|
261
|
-
* to `kind: "none"` and the plugin continues without it. Emits exactly
|
|
262
|
-
* one `agent.auth` span so the audit trail records each sub-agent
|
|
263
|
-
* resolution.
|
|
420
|
+
* Resolve a sub-agent against the process runtime credential. The broker's
|
|
421
|
+
* `type_name` supplies sub-agent attribution; no separate OAuth identity is
|
|
422
|
+
* registered, loaded, minted, or persisted.
|
|
264
423
|
*/
|
|
265
424
|
export declare function ensureSubAgentIdentity(client: OryAgentClient, options: EnsureSubAgentIdentityOptions): Promise<SubAgentIdentity>;
|
|
266
425
|
export {};
|