@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/adapters.d.ts
CHANGED
|
@@ -2,15 +2,18 @@
|
|
|
2
2
|
* Shared adapter primitives for Agent SDK integrations (and harness plugins).
|
|
3
3
|
*
|
|
4
4
|
* These extract the session-start sequencing and the `tool.invoke` / `tool.block` /
|
|
5
|
-
* `tool.complete`
|
|
5
|
+
* `tool.complete` activity boilerplate that each integration would otherwise re-implement, so
|
|
6
6
|
* an SDK binding is a thin translation between the SDK's hook signature and these calls.
|
|
7
7
|
* They are the TypeScript twin of `ory_argus.adapters` in the Python core.
|
|
8
8
|
*
|
|
9
|
+
* - {@link withHookContext} — scope session state to one lifecycle invocation.
|
|
9
10
|
* - {@link sessionStart} — run the user + agent auth gates and write the user→agent
|
|
10
11
|
* delegation tuple; returns whether the session may proceed.
|
|
11
|
-
* - {@link
|
|
12
|
+
* - {@link createSessionStarter} — coalesce concurrent lazy SDK session starts.
|
|
13
|
+
* - {@link decideTool} — normalize native/MCP policy without execution activity.
|
|
14
|
+
* - {@link gate} — resolve the subject, run {@link gateToolCall}, record activity, and
|
|
12
15
|
* return a normalized {@link GateResult}.
|
|
13
|
-
* - {@link complete} — record
|
|
16
|
+
* - {@link complete} / {@link fail} — record safe terminal tool activity.
|
|
14
17
|
* - {@link registerSubagent} — resolve a sub-agent identity + agent→subagent tuple.
|
|
15
18
|
* - {@link wrapTool} — wrap a plain `execute(args)` with gate+complete, for SDKs whose
|
|
16
19
|
* only veto point is the tool boundary (Vercel AI SDK, etc.).
|
|
@@ -20,8 +23,17 @@
|
|
|
20
23
|
import type { OryAgentClient } from "./client.js";
|
|
21
24
|
import { ensureAgentIdentity, ensureSubAgentIdentity } from "./agent-auth.js";
|
|
22
25
|
import { ensureUserAuthenticated } from "./user-login.js";
|
|
23
|
-
import { type PermissionDecision } from "./permissions.js";
|
|
26
|
+
import { type ModeDecision, type PermissionDecision, type PrincipalBlockSubjects } from "./permissions.js";
|
|
27
|
+
import { type DenialContext } from "./denial.js";
|
|
28
|
+
import { type McpToolIdentifier } from "./mcp.js";
|
|
29
|
+
import type { RuntimeCredential } from "./runtime-credential.js";
|
|
24
30
|
export declare function resolveNamespace(): string;
|
|
31
|
+
export interface HookContextOptions {
|
|
32
|
+
sessionId?: string;
|
|
33
|
+
runtimeCredential?: RuntimeCredential;
|
|
34
|
+
}
|
|
35
|
+
/** Scope ambient session state to one lifecycle invocation. */
|
|
36
|
+
export declare function withHookContext<T>(client: OryAgentClient, opts: HookContextOptions, work: () => T): T;
|
|
25
37
|
export interface SessionStartResult {
|
|
26
38
|
proceed: boolean;
|
|
27
39
|
userMode: string;
|
|
@@ -30,68 +42,100 @@ export interface SessionStartResult {
|
|
|
30
42
|
}
|
|
31
43
|
export interface SessionStartOptions {
|
|
32
44
|
harness: string;
|
|
45
|
+
sessionId?: string;
|
|
33
46
|
projectUrl?: string;
|
|
34
47
|
binName?: string;
|
|
35
48
|
/** Injectable gates (tests). */
|
|
36
49
|
userLogin?: typeof ensureUserAuthenticated;
|
|
37
50
|
agentGate?: typeof ensureAgentIdentity;
|
|
51
|
+
/** Small, privacy-safe session metadata supported by the activity API. */
|
|
52
|
+
activityAttributes?: Record<string, unknown>;
|
|
38
53
|
}
|
|
39
54
|
/**
|
|
40
55
|
* Run both auth gates and write the user→agent delegation tuple. The user gate
|
|
41
56
|
* runs every session to establish/refresh the user identity, records the
|
|
42
|
-
|
|
57
|
+
* `user.auth` activity event, and never blocks — enforcement is governed by
|
|
43
58
|
* `permissionMode` at tool-call time. `SessionStartResult.proceed` is therefore
|
|
44
59
|
* always `true`; it is retained only for a stable adapter shape.
|
|
45
60
|
*/
|
|
46
61
|
export declare function sessionStart(client: OryAgentClient, opts: SessionStartOptions): Promise<SessionStartResult>;
|
|
62
|
+
/** Build a concurrency-safe, retryable lazy session-start trigger. */
|
|
63
|
+
export declare function createSessionStarter(client: OryAgentClient, opts: SessionStartOptions): () => Promise<void>;
|
|
47
64
|
/**
|
|
48
|
-
*
|
|
49
|
-
* (see {@link
|
|
50
|
-
* their own session-start sequence (rather than {@link sessionStart})
|
|
51
|
-
* the
|
|
52
|
-
* session.
|
|
65
|
+
* Record the `user → agent` delegation edge through the agent-security broker
|
|
66
|
+
* (see {@link OryAgentClient.recordDelegation}). Exported so harness plugins
|
|
67
|
+
* that run their own session-start sequence (rather than {@link sessionStart})
|
|
68
|
+
* record the edge the same way.
|
|
53
69
|
*
|
|
54
|
-
* The
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
70
|
+
* The plugin supplies only the delegating user identity (resolved from the live
|
|
71
|
+
* principal, else the persisted delegation anchor) plus the harness and host;
|
|
72
|
+
* the broker owns the Keto tuple and its join-key encoding. The node id the
|
|
73
|
+
* broker returns (`agent:<join>`) is persisted so a later sub-agent
|
|
74
|
+
* registration — which may run in a separate subprocess with no live principal
|
|
75
|
+
* — can reference it verbatim as `delegated_by`. Best-effort and fail-open:
|
|
76
|
+
* any failure (including a 404 against the local stack, which has no broker) is
|
|
77
|
+
* logged and swallowed. No-op when Agent Security isn't connected (there is no
|
|
78
|
+
* broker to record against) and when no user identity resolves.
|
|
59
79
|
*/
|
|
60
|
-
export declare function writeUserDelegatesAgent(client: OryAgentClient): Promise<void>;
|
|
80
|
+
export declare function writeUserDelegatesAgent(client: OryAgentClient, harness?: string, sessionId?: string): Promise<void>;
|
|
61
81
|
export interface RegisterSubagentOptions {
|
|
62
82
|
harness: string;
|
|
63
83
|
subAgentType: string;
|
|
64
84
|
projectUrl?: string;
|
|
65
85
|
subAgentGate?: typeof ensureSubAgentIdentity;
|
|
86
|
+
/**
|
|
87
|
+
* Identifier for this individual spawn, where the harness exposes one
|
|
88
|
+
* (Cursor's `subagent_id`, Claude Code's `agent_id`, OpenClaw's `childRunId`).
|
|
89
|
+
* Distinguishes two concurrent sub-agents of the same type; absent on
|
|
90
|
+
* harnesses that expose no such id.
|
|
91
|
+
*/
|
|
92
|
+
perSpawnId?: string;
|
|
93
|
+
sessionId?: string;
|
|
94
|
+
signal?: AbortSignal;
|
|
66
95
|
}
|
|
67
96
|
export declare function registerSubagent(client: OryAgentClient, opts: RegisterSubagentOptions): Promise<void>;
|
|
68
97
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
98
|
+
* Record the `agent → subagent` delegation edge through the agent-security
|
|
99
|
+
* broker. Exported so harness plugins that resolve the sub-agent identity
|
|
100
|
+
* through their own event plumbing (rather than {@link registerSubagent})
|
|
101
|
+
* record the edge the same way.
|
|
102
|
+
*
|
|
103
|
+
* The broker builds the sub-agent node from the parent agent's delegation node
|
|
104
|
+
* (`delegated_by`) and the sub-agent type — so the plugin passes the node id
|
|
105
|
+
* the broker assigned to the `user → agent` edge (persisted at session start),
|
|
106
|
+
* echoed verbatim, and never reconstructs the join-key encoding itself.
|
|
107
|
+
* Best-effort and fail-open. No-op when Agent Security isn't connected and until the
|
|
108
|
+
* `user → agent` edge has been
|
|
109
|
+
* recorded (so the parent node id is available).
|
|
74
110
|
*/
|
|
75
|
-
export declare function writeAgentDelegatesSubagent(client: OryAgentClient, subAgentSubject: string, subAgentType: string
|
|
111
|
+
export declare function writeAgentDelegatesSubagent(client: OryAgentClient, subAgentSubject: string, subAgentType: string, opts?: {
|
|
112
|
+
harness?: string;
|
|
113
|
+
sessionId?: string;
|
|
114
|
+
perSpawnId?: string;
|
|
115
|
+
agentToken?: string;
|
|
116
|
+
runtimeCredential?: RuntimeCredential;
|
|
117
|
+
signal?: AbortSignal;
|
|
118
|
+
}): Promise<void>;
|
|
76
119
|
export interface GateResult {
|
|
77
120
|
/** False only when the tool was hard-denied in enforce mode. */
|
|
78
121
|
proceed: boolean;
|
|
79
122
|
/** True only for that deny (and only when `canBlock`). */
|
|
80
123
|
blocked: boolean;
|
|
81
|
-
/** Discriminator: allow / observe / deny / fail_open / interactive /
|
|
124
|
+
/** Discriminator: allow / observe / deny / fail_open / interactive / not_connected. */
|
|
82
125
|
kind: string;
|
|
83
126
|
decision: ToolGateOutcomeLike;
|
|
84
127
|
subject: string;
|
|
85
128
|
namespace: string;
|
|
86
129
|
denialMessage?: string;
|
|
130
|
+
denialContext?: DenialContext;
|
|
87
131
|
}
|
|
88
132
|
type ToolGateOutcomeLike = {
|
|
89
|
-
kind: "
|
|
90
|
-
|
|
133
|
+
kind: "not_connected";
|
|
134
|
+
activityAttributes: Record<string, unknown>;
|
|
91
135
|
} | {
|
|
92
136
|
kind: "interactive";
|
|
93
|
-
|
|
94
|
-
} | PermissionDecision;
|
|
137
|
+
activityAttributes: Record<string, unknown>;
|
|
138
|
+
} | PermissionDecision | ModeDecision;
|
|
95
139
|
export interface GateOptions {
|
|
96
140
|
harness: string;
|
|
97
141
|
toolName: string;
|
|
@@ -99,20 +143,32 @@ export interface GateOptions {
|
|
|
99
143
|
subjectFallback?: string;
|
|
100
144
|
/** Whether the calling integration can actually stop the tool. */
|
|
101
145
|
canBlock?: boolean;
|
|
102
|
-
|
|
146
|
+
extraActivityAttributes?: Record<string, unknown>;
|
|
147
|
+
/** Normalized MCP identity when this invocation targets an MCP server. */
|
|
148
|
+
mcpTool?: McpToolIdentifier;
|
|
149
|
+
/** Acting sub-agent principal context for explicit machine blocks. */
|
|
150
|
+
principals?: PrincipalBlockSubjects;
|
|
103
151
|
}
|
|
104
152
|
/**
|
|
105
|
-
* Authorize a tool call
|
|
106
|
-
*
|
|
107
|
-
*
|
|
153
|
+
* Authorize a tool call and return a normalized {@link GateResult} without
|
|
154
|
+
* recording execution activity. Permission-ask hooks use this when the harness
|
|
155
|
+
* separately reports actual execution; {@link gate} adds the standard events.
|
|
108
156
|
*/
|
|
157
|
+
export declare function decideTool(client: OryAgentClient, opts: GateOptions): Promise<GateResult>;
|
|
109
158
|
export declare function gate(client: OryAgentClient, opts: GateOptions): Promise<GateResult>;
|
|
110
159
|
export declare function complete(client: OryAgentClient, opts: {
|
|
111
160
|
toolName: string;
|
|
161
|
+
input?: unknown;
|
|
112
162
|
output?: unknown;
|
|
113
|
-
|
|
163
|
+
extraActivityAttributes?: Record<string, unknown>;
|
|
114
164
|
status?: "ok" | "error";
|
|
115
165
|
}): void;
|
|
166
|
+
export declare function fail(client: OryAgentClient, opts: {
|
|
167
|
+
toolName: string;
|
|
168
|
+
input?: unknown;
|
|
169
|
+
error?: unknown;
|
|
170
|
+
extraActivityAttributes?: Record<string, unknown>;
|
|
171
|
+
}): void;
|
|
116
172
|
export interface WrapToolOptions {
|
|
117
173
|
harness: string;
|
|
118
174
|
toolName: string;
|