@economic/agents 1.7.0 → 1.7.2
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/dist/index.d.mts +2 -1
- package/dist/index.mjs +9 -3
- package/package.json +1 -3
package/dist/index.d.mts
CHANGED
|
@@ -206,9 +206,10 @@ declare abstract class ChatAgent<Env extends Cloudflare.Env = Cloudflare.Env, TJ
|
|
|
206
206
|
* The identity associated with the session.
|
|
207
207
|
* Define getIdentity to return the identity from the request.
|
|
208
208
|
*/
|
|
209
|
-
protected jwtIdentity: TJwtIdentity;
|
|
209
|
+
protected get jwtIdentity(): TJwtIdentity;
|
|
210
210
|
/**
|
|
211
211
|
* Returns the identity following verification of the JWT token - getJwtAuthConfig is required.
|
|
212
|
+
* This method should not have side effects - return a single object from it.
|
|
212
213
|
* @returns The identity from the request.
|
|
213
214
|
* @param token - The token from the request.
|
|
214
215
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Output, convertToModelMessages, generateText, jsonSchema, stepCountIs, streamText, tool } from "ai";
|
|
2
|
-
import { Agent as Agent$1, callable, routeAgentRequest as routeAgentRequest$1 } from "agents";
|
|
2
|
+
import { Agent as Agent$1, callable, getCurrentAgent, routeAgentRequest as routeAgentRequest$1 } from "agents";
|
|
3
3
|
import { AIChatAgent } from "@cloudflare/ai-chat";
|
|
4
4
|
import { createRemoteJWKSet, decodeJwt, errors, jwtVerify } from "jose";
|
|
5
5
|
//#region src/server/shared/features/skills/index.ts
|
|
@@ -865,7 +865,10 @@ var ChatAgent = class extends AIChatAgent {
|
|
|
865
865
|
* The identity associated with the session.
|
|
866
866
|
* Define getIdentity to return the identity from the request.
|
|
867
867
|
*/
|
|
868
|
-
jwtIdentity
|
|
868
|
+
get jwtIdentity() {
|
|
869
|
+
const { connection } = getCurrentAgent();
|
|
870
|
+
return (connection?.state)?.jwtIdentity ?? {};
|
|
871
|
+
}
|
|
869
872
|
/**
|
|
870
873
|
* Returns the user ID from the durable object name.
|
|
871
874
|
*/
|
|
@@ -900,7 +903,10 @@ var ChatAgent = class extends AIChatAgent {
|
|
|
900
903
|
}
|
|
901
904
|
}
|
|
902
905
|
const token = extractTokenFromConnectRequest(ctx.request);
|
|
903
|
-
if (token)
|
|
906
|
+
if (token) {
|
|
907
|
+
const jwtIdentity = await this.getJwtIdentity?.(token);
|
|
908
|
+
if (jwtIdentity) connection.setState({ jwtIdentity });
|
|
909
|
+
}
|
|
904
910
|
}
|
|
905
911
|
return super.onConnect(connection, ctx);
|
|
906
912
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@economic/agents",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "A starter for creating a TypeScript package.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@cloudflare/ai-chat": "^0.6.2",
|
|
32
|
-
"@cloudflare/think": "^0.5.3",
|
|
33
32
|
"@cloudflare/workers-types": "^4.20260430.1",
|
|
34
33
|
"@types/node": "^25.6.0",
|
|
35
34
|
"@typescript/native-preview": "7.0.0-dev.20260412.1",
|
|
@@ -42,7 +41,6 @@
|
|
|
42
41
|
},
|
|
43
42
|
"peerDependencies": {
|
|
44
43
|
"@cloudflare/ai-chat": ">=0.6.0 <1.0.0",
|
|
45
|
-
"@cloudflare/think": ">=0.5.0 <1.0.0",
|
|
46
44
|
"agents": ">=0.12.0 <1.0.0",
|
|
47
45
|
"ai": "^6.0.0",
|
|
48
46
|
"jose": "^6.0.0"
|