@ory/openclaw 1.9.2 → 1.10.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 +76 -11
- package/dist/cli/assets.d.ts +13 -8
- package/dist/cli/assets.js +26 -73
- package/dist/cli/installer.d.ts +53 -0
- package/dist/cli/installer.js +249 -0
- package/dist/cli/main.d.ts +7 -4
- package/dist/cli/main.js +66 -164
- package/dist/cli/openclaw-config.d.ts +40 -0
- package/dist/cli/openclaw-config.js +125 -0
- package/dist/cli/plugin-config.d.ts +32 -5
- package/dist/cli/plugin-config.js +118 -10
- package/dist/cli/setup.d.ts +4 -2
- package/dist/cli/setup.js +39 -51
- package/dist/plugin.d.ts +10 -0
- package/dist/plugin.js +166 -56
- package/dist/types.d.ts +80 -21
- package/openclaw.plugin.json +5 -2
- package/package.json +13 -2
package/dist/types.d.ts
CHANGED
|
@@ -21,10 +21,11 @@ export interface OpenClawPluginApi {
|
|
|
21
21
|
registerHook<E extends HookEvent>(event: E, handler: HookHandler<E>, opts?: HookRegistrationOpts): void;
|
|
22
22
|
/**
|
|
23
23
|
* Register a typed lifecycle hook. Current OpenClaw dispatches typed names
|
|
24
|
-
* such as `
|
|
24
|
+
* such as `session_start`, `before_agent_run`, `before_tool_call`, and the
|
|
25
|
+
* `subagent_*` hooks only to `api.on` registrations and warns that
|
|
25
26
|
* `registerHook` registrations for them are never invoked
|
|
26
|
-
* (`src/plugins/registry-registrars
|
|
27
|
-
*
|
|
27
|
+
* (`src/plugins/registry-registrars.ts`). Optional so older hosts without it
|
|
28
|
+
* still load the plugin through `registerHook`.
|
|
28
29
|
*/
|
|
29
30
|
on?<K extends TypedHookName>(hookName: K, handler: TypedHookHandler<K>, opts?: TypedHookRegistrationOpts): void;
|
|
30
31
|
}
|
|
@@ -33,8 +34,67 @@ export interface TypedHookRegistrationOpts {
|
|
|
33
34
|
timeoutMs?: number;
|
|
34
35
|
}
|
|
35
36
|
/** Typed hooks this plugin registers through `api.on`. */
|
|
36
|
-
export type TypedHookName = "before_tool_call" | "after_tool_call";
|
|
37
|
-
export type TypedHookHandler<K extends TypedHookName> = K extends "before_tool_call" ? (event: ToolCallEvent, ctx?: ToolHookContext) => Promise<HookResult | void> : K extends "after_tool_call" ? (event: AfterToolCallEvent, ctx?: ToolHookContext) => Promise<void> : never;
|
|
37
|
+
export type TypedHookName = "session_start" | "before_agent_run" | "before_tool_call" | "after_tool_call" | "subagent_spawned" | "subagent_ended";
|
|
38
|
+
export type TypedHookHandler<K extends TypedHookName> = K extends "session_start" ? (event: SessionStartEvent, ctx?: SessionHookContext) => Promise<void> : K extends "before_agent_run" ? (event: BeforeAgentRunEvent, ctx?: AgentHookContext) => Promise<BeforeAgentRunResult | void> : K extends "before_tool_call" ? (event: ToolCallEvent, ctx?: ToolHookContext) => Promise<HookResult | void> : K extends "after_tool_call" ? (event: AfterToolCallEvent, ctx?: ToolHookContext) => Promise<void> : K extends "subagent_spawned" ? (event: SubagentSpawnedEvent, ctx?: SubagentHookContext) => Promise<void> : K extends "subagent_ended" ? (event: SubagentEndedEvent, ctx?: SubagentHookContext) => Promise<void> : never;
|
|
39
|
+
/** Mirrors OpenClaw's `PluginHookSessionStartEvent`. */
|
|
40
|
+
export interface SessionStartEvent {
|
|
41
|
+
sessionId: string;
|
|
42
|
+
sessionKey?: string;
|
|
43
|
+
resumedFrom?: string;
|
|
44
|
+
}
|
|
45
|
+
/** Mirrors OpenClaw's `PluginHookSessionContext`. */
|
|
46
|
+
export interface SessionHookContext {
|
|
47
|
+
agentId?: string;
|
|
48
|
+
sessionId?: string;
|
|
49
|
+
sessionKey?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Mirrors OpenClaw's `PluginHookBeforeAgentRunEvent`. The plugin reads none
|
|
53
|
+
* of the conversation fields; they are listed only to document the shape.
|
|
54
|
+
*/
|
|
55
|
+
export interface BeforeAgentRunEvent {
|
|
56
|
+
prompt?: string;
|
|
57
|
+
messages?: unknown[];
|
|
58
|
+
[key: string]: unknown;
|
|
59
|
+
}
|
|
60
|
+
/** The subset of OpenClaw's `PluginHookAgentContext` this plugin reads. */
|
|
61
|
+
export interface AgentHookContext {
|
|
62
|
+
runId?: string;
|
|
63
|
+
agentId?: string;
|
|
64
|
+
sessionKey?: string;
|
|
65
|
+
sessionId?: string;
|
|
66
|
+
modelId?: string;
|
|
67
|
+
[key: string]: unknown;
|
|
68
|
+
}
|
|
69
|
+
/** Mirrors OpenClaw's `PluginHookSubagentSpawnedEvent`. */
|
|
70
|
+
export interface SubagentSpawnedEvent {
|
|
71
|
+
childSessionKey: string;
|
|
72
|
+
agentId: string;
|
|
73
|
+
label?: string;
|
|
74
|
+
mode?: string;
|
|
75
|
+
requester?: unknown;
|
|
76
|
+
threadRequested?: boolean;
|
|
77
|
+
runId?: string;
|
|
78
|
+
resolvedModel?: string;
|
|
79
|
+
resolvedProvider?: string;
|
|
80
|
+
}
|
|
81
|
+
/** Mirrors OpenClaw's `PluginHookSubagentEndedEvent`. */
|
|
82
|
+
export interface SubagentEndedEvent {
|
|
83
|
+
targetSessionKey: string;
|
|
84
|
+
targetKind?: string;
|
|
85
|
+
reason?: string;
|
|
86
|
+
runId?: string;
|
|
87
|
+
outcome?: string;
|
|
88
|
+
error?: string;
|
|
89
|
+
endedAt?: number;
|
|
90
|
+
}
|
|
91
|
+
/** Mirrors OpenClaw's `PluginHookSubagentContext`. */
|
|
92
|
+
export interface SubagentHookContext {
|
|
93
|
+
runId?: string;
|
|
94
|
+
childSessionKey?: string;
|
|
95
|
+
/** Session key of the parent session that spawned the child. */
|
|
96
|
+
requesterSessionKey?: string;
|
|
97
|
+
}
|
|
38
98
|
/**
|
|
39
99
|
* Mirrors OpenClaw's `PluginHookBeforeToolCallEvent`. Bundle MCP tools are
|
|
40
100
|
* named `<safeServer>__<tool>` (`src/agents/agent-bundle-mcp-names.ts`).
|
|
@@ -72,8 +132,13 @@ export interface HookRegistrationOpts {
|
|
|
72
132
|
name?: string;
|
|
73
133
|
description?: string;
|
|
74
134
|
}
|
|
75
|
-
|
|
76
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Legacy `registerHook` event names, used only on hosts without `api.on`.
|
|
137
|
+
* OpenClaw removed `subagent_spawning` (`legacy-subagent-spawning-hook`);
|
|
138
|
+
* the plugin registers sub-agents at `subagent_spawned` instead.
|
|
139
|
+
*/
|
|
140
|
+
export type HookEvent = "session_start" | "session_end" | "before_tool_call" | "after_tool_call" | "before_agent_start" | "before_agent_run" | "subagent_spawned" | "subagent_ended";
|
|
141
|
+
export type HookHandler<E extends HookEvent> = E extends "before_tool_call" ? (ctx: BeforeToolCallContext) => Promise<HookResult | void> : E extends "after_tool_call" ? (ctx: AfterToolCallContext) => Promise<void> : E extends "session_start" ? (ctx: SessionStartContext) => Promise<void> : E extends "before_agent_start" ? (ctx: BeforeAgentStartContext) => Promise<void> : E extends "before_agent_run" ? (ctx: BeforeAgentRunContext) => Promise<BeforeAgentRunResult | void> : E extends "session_end" ? (ctx: SessionEndContext) => Promise<void> : E extends "subagent_spawned" ? (ctx: SubagentSpawnedContext) => Promise<void> : E extends "subagent_ended" ? (ctx: SubagentEndedContext) => Promise<void> : never;
|
|
77
142
|
/** Legacy `registerHook("before_tool_call")` context, for hosts without `api.on`. */
|
|
78
143
|
export interface BeforeToolCallContext {
|
|
79
144
|
toolId: string;
|
|
@@ -99,6 +164,7 @@ export interface AfterToolCallContext {
|
|
|
99
164
|
}
|
|
100
165
|
export interface SessionStartContext {
|
|
101
166
|
sessionId: string;
|
|
167
|
+
sessionKey?: string;
|
|
102
168
|
model?: string;
|
|
103
169
|
gateway?: {
|
|
104
170
|
version: string;
|
|
@@ -114,9 +180,9 @@ export interface SessionEndContext {
|
|
|
114
180
|
reason?: string;
|
|
115
181
|
}
|
|
116
182
|
/**
|
|
117
|
-
* Context for `before_agent_run` — fires before each model submission
|
|
118
|
-
*
|
|
119
|
-
*
|
|
183
|
+
* Context for `before_agent_run` — fires before each model submission. The
|
|
184
|
+
* hook could hard-block via a `BeforeAgentRunResult`, but this plugin never
|
|
185
|
+
* does: it only refreshes the user credential, and sign-in stays advisory.
|
|
120
186
|
*/
|
|
121
187
|
export interface BeforeAgentRunContext {
|
|
122
188
|
sessionId?: string;
|
|
@@ -133,13 +199,14 @@ export interface BeforeAgentRunContext {
|
|
|
133
199
|
/**
|
|
134
200
|
* Return shape for `before_agent_run`. `outcome: "block"` aborts the
|
|
135
201
|
* run before the model is called. Returning void (or no outcome) lets
|
|
136
|
-
* the run proceed.
|
|
202
|
+
* the run proceed. Modeled for completeness; this plugin always returns void.
|
|
137
203
|
*/
|
|
138
204
|
export interface BeforeAgentRunResult {
|
|
139
205
|
outcome?: "block";
|
|
140
206
|
reason?: string;
|
|
141
207
|
message?: string;
|
|
142
208
|
}
|
|
209
|
+
/** Sub-agent fields shared by the spawned and ended handler contexts. */
|
|
143
210
|
export interface SubagentSpawningContext {
|
|
144
211
|
/** Stable identifier of the child agent definition (e.g. "Explore"). */
|
|
145
212
|
agentId?: string;
|
|
@@ -151,8 +218,8 @@ export interface SubagentSpawningContext {
|
|
|
151
218
|
childSessionKey?: string;
|
|
152
219
|
/** Invocation mode (e.g. "thread"/"foreground"). */
|
|
153
220
|
mode?: string;
|
|
154
|
-
/**
|
|
155
|
-
requester?:
|
|
221
|
+
/** Requester of the spawn (an origin object on current OpenClaw). */
|
|
222
|
+
requester?: unknown;
|
|
156
223
|
/** Whether a separate thread was requested for the child run. */
|
|
157
224
|
threadRequested?: boolean;
|
|
158
225
|
[key: string]: unknown;
|
|
@@ -178,11 +245,3 @@ export interface HookResult {
|
|
|
178
245
|
*/
|
|
179
246
|
blockReason?: string;
|
|
180
247
|
}
|
|
181
|
-
/**
|
|
182
|
-
* Return shape for `subagent_spawning`. Returning `{ status: "error" }`
|
|
183
|
-
* aborts the child run before it starts.
|
|
184
|
-
*/
|
|
185
|
-
export interface SubagentSpawningResult {
|
|
186
|
-
status?: "error";
|
|
187
|
-
error?: string;
|
|
188
|
-
}
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "ory-agent-security",
|
|
3
3
|
"name": "Ory Agent Security",
|
|
4
|
-
"version": "0.1.0",
|
|
5
4
|
"description": "Authentication, authorization, and activity auditing for OpenClaw via Ory",
|
|
6
|
-
"
|
|
5
|
+
"configSchema": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {}
|
|
9
|
+
}
|
|
7
10
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ory/openclaw",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Ory plugin for OpenClaw: scaffolding skills, a local Ory instance, and authentication, authorization, and audit for every tool call",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://ory.com",
|
|
@@ -56,6 +56,17 @@
|
|
|
56
56
|
"default": "./dist/index.js"
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
|
+
"openclaw": {
|
|
60
|
+
"extensions": [
|
|
61
|
+
"./dist/index.js"
|
|
62
|
+
],
|
|
63
|
+
"compat": {
|
|
64
|
+
"pluginApi": ">=2026.11.3"
|
|
65
|
+
},
|
|
66
|
+
"install": {
|
|
67
|
+
"npmSpec": "@ory/openclaw"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
59
70
|
"bin": {
|
|
60
71
|
"openclaw": "dist/cli/main.js",
|
|
61
72
|
"ory-openclaw": "dist/cli/main.js",
|
|
@@ -68,7 +79,7 @@
|
|
|
68
79
|
],
|
|
69
80
|
"dependencies": {
|
|
70
81
|
"reova": "^0.7.0",
|
|
71
|
-
"@ory/argus": "1.
|
|
82
|
+
"@ory/argus": "1.10.0"
|
|
72
83
|
},
|
|
73
84
|
"engines": {
|
|
74
85
|
"node": ">=22"
|