@ory/cloudflare-agents 1.2.3 → 1.3.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 +13 -5
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -12,11 +12,12 @@ npm install @ory/cloudflare-agents
|
|
|
12
12
|
|
|
13
13
|
## Usage on Workers
|
|
14
14
|
|
|
15
|
-
The Workers runtime has no
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
The Workers runtime has no native OS credential store, so it cannot use desktop
|
|
16
|
+
Talos enrollment persistence. Construct `OryAgentClient` explicitly and provide
|
|
17
|
+
`runtimeRequestAuthenticator` from the Worker's bindings or workload identity;
|
|
18
|
+
the authenticator signs each Agent Security request without exposing key material
|
|
19
|
+
to Argus. Inject that client through the `client` option. Do not use legacy OAuth
|
|
20
|
+
client credentials or DCR as the Worker runtime path.
|
|
20
21
|
|
|
21
22
|
Instantiate the client and the wrapped tool set **once per agent instance** (or at module
|
|
22
23
|
scope), never inside `onChatMessage` — a fresh wrapper per message would re-run the Ory
|
|
@@ -39,7 +40,14 @@ export class MyAgent extends AIChatAgent<Env> {
|
|
|
39
40
|
// One client + wrapped tool set per agent instance — not per message.
|
|
40
41
|
ory = new OryAgentClient({
|
|
41
42
|
projectUrl: this.env.ORY_PROJECT_URL,
|
|
43
|
+
agentSecurityUrl: this.env.ORY_AGENT_SECURITY_URL,
|
|
42
44
|
harness: "cloudflare-agents",
|
|
45
|
+
runtimeSubject: this.env.ORY_AGENT_SUBJECT_ID,
|
|
46
|
+
runtimeRequestAuthenticator: async ({ url, init, authorizationHeader, fetch }) => {
|
|
47
|
+
const headers = new Headers(init.headers);
|
|
48
|
+
headers.set(authorizationHeader, `Bearer ${this.env.ORY_AGENT_API_KEY}`);
|
|
49
|
+
return fetch(url, { ...init, headers });
|
|
50
|
+
},
|
|
43
51
|
});
|
|
44
52
|
tools = withOry({ getWeather }, { client: this.ory });
|
|
45
53
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ory/cloudflare-agents",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Ory Agent Security for the Cloudflare Agents SDK — per-tool authorization, activity auditing, and identity propagation by wrapping the AI SDK tools passed to streamText. Built on @ory/argus.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -35,11 +35,10 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"reova": "^0.7.0",
|
|
38
|
-
"@ory/argus": "1.
|
|
38
|
+
"@ory/argus": "1.3.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"typescript": "^6.0.2"
|
|
42
|
-
"vitest": "4.1.4"
|
|
41
|
+
"typescript": "^6.0.2"
|
|
43
42
|
},
|
|
44
43
|
"scripts": {
|
|
45
44
|
"build": "tsc",
|