@economic/agents 2.8.1 → 2.8.3
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 -2
- package/dist/index.mjs +18 -4
- package/dist/{route-agent-request-DLlW8kZo.d.mts → route-agent-request-9vqbi1bt.d.mts} +2 -1
- package/dist/{route-agent-request-CYclS_5Q.mjs → route-agent-request-J98VlcOj.mjs} +4 -1
- package/dist/v1.d.mts +1 -1
- package/dist/v1.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as JwtAuthConfig, t as routeAgentRequest } from "./route-agent-request-
|
|
1
|
+
import { n as JwtAuthConfig, r as createJwtAuthConfig, t as routeAgentRequest } from "./route-agent-request-9vqbi1bt.mjs";
|
|
2
2
|
import { Agent as Agent$1, Connection, ConnectionContext, SubAgentClass } from "agents";
|
|
3
3
|
import { ChatResponseResult, PrepareStepContext, Session, Think, ToolCallContext, ToolCallDecision, TurnConfig, TurnContext, skills } from "@cloudflare/think";
|
|
4
4
|
import { JSONValue, LanguageModel, ModelMessage, Tool as Tool$1, UIMessage } from "ai";
|
|
@@ -372,4 +372,4 @@ declare function skill<Context extends Record<string, unknown> = Record<string,
|
|
|
372
372
|
//#region src/server/index.d.ts
|
|
373
373
|
declare function getCurrentToolContext(): any;
|
|
374
374
|
//#endregion
|
|
375
|
-
export { Agent, type AgentConnectionStatus, type AgentConnectionType, type AgentEnv, Assistant, ChatAgent, type ExchangedToken, type Skill, type SkillSource, type TokenExchangeConfig, type TokenExchangeResult, type Tool, type ToolContext, type ToolSet, type TurnSnapshot, exchangeToken, getCurrentToolContext, routeAgentRequest, skill, tool };
|
|
375
|
+
export { Agent, type AgentConnectionStatus, type AgentConnectionType, type AgentEnv, Assistant, ChatAgent, type ExchangedToken, type JwtAuthConfig, type Skill, type SkillSource, type TokenExchangeConfig, type TokenExchangeResult, type Tool, type ToolContext, type ToolSet, type TurnSnapshot, createJwtAuthConfig, exchangeToken, getCurrentToolContext, routeAgentRequest, skill, tool };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as extractTokenFromConnectRequest, c as verifyJwt, i as createJwtAuthConfig, n as createAgentTracer, o as getTargetActorId, r as recordFeedbackAnalytics, s as isJwtActorAuthorized, t as routeAgentRequest } from "./route-agent-request-J98VlcOj.mjs";
|
|
2
2
|
import { Agent as Agent$1, callable, getCurrentAgent } from "agents";
|
|
3
3
|
import { Think, skills } from "@cloudflare/think";
|
|
4
4
|
import { Output, convertToModelMessages, generateText, jsonSchema, pruneMessages, tool as tool$1 } from "ai";
|
|
@@ -364,7 +364,14 @@ var Agent = class extends Think {
|
|
|
364
364
|
parentPath: this.parentPath
|
|
365
365
|
})) {
|
|
366
366
|
sendConnectionStatus(connection, "unauthorized");
|
|
367
|
-
console.error("[Agent]
|
|
367
|
+
console.error("[Agent] Authenticated actor does not own the requested agent", {
|
|
368
|
+
authenticatedActorId: config.getActorId(result.claims),
|
|
369
|
+
requiredActorId: getTargetActorId({
|
|
370
|
+
durableObjectName: this.name,
|
|
371
|
+
parentPath: this.parentPath
|
|
372
|
+
}),
|
|
373
|
+
durableObjectName: this.name
|
|
374
|
+
});
|
|
368
375
|
connection.close(4003, "Forbidden");
|
|
369
376
|
return;
|
|
370
377
|
}
|
|
@@ -1056,7 +1063,14 @@ var Assistant = class extends Agent$1 {
|
|
|
1056
1063
|
parentPath: this.parentPath
|
|
1057
1064
|
})) {
|
|
1058
1065
|
sendConnectionStatus(connection, "unauthorized");
|
|
1059
|
-
console.error("[Assistant]
|
|
1066
|
+
console.error("[Assistant] Authenticated actor does not own the requested assistant", {
|
|
1067
|
+
authenticatedActorId: config.getActorId(result.claims),
|
|
1068
|
+
requiredActorId: getTargetActorId({
|
|
1069
|
+
durableObjectName: this.name,
|
|
1070
|
+
parentPath: this.parentPath
|
|
1071
|
+
}),
|
|
1072
|
+
durableObjectName: this.name
|
|
1073
|
+
});
|
|
1060
1074
|
connection.close(4003, "Forbidden");
|
|
1061
1075
|
return;
|
|
1062
1076
|
}
|
|
@@ -1450,4 +1464,4 @@ function getCurrentToolContext() {
|
|
|
1450
1464
|
return getCurrentAgent().agent._lastBody;
|
|
1451
1465
|
}
|
|
1452
1466
|
//#endregion
|
|
1453
|
-
export { Agent, Assistant, ChatAgent, exchangeToken, getCurrentToolContext, routeAgentRequest, skill, tool };
|
|
1467
|
+
export { Agent, Assistant, ChatAgent, createJwtAuthConfig, exchangeToken, getCurrentToolContext, routeAgentRequest, skill, tool };
|
|
@@ -16,8 +16,9 @@ interface JwtAuthConfig<TClaims extends Record<string, unknown> = Record<string,
|
|
|
16
16
|
/** Derive the actor ID represented by the verified claims. */
|
|
17
17
|
getActorId(claims: TClaims): string;
|
|
18
18
|
}
|
|
19
|
+
declare function createJwtAuthConfig<TClaims extends Record<string, unknown>>(config: JwtAuthConfig<TClaims>): JwtAuthConfig<TClaims>;
|
|
19
20
|
//#endregion
|
|
20
21
|
//#region src/server/route-agent-request.d.ts
|
|
21
22
|
declare function routeAgentRequest$1<Env>(request: Request, env: Env, options?: AgentOptions<Env>): Promise<Response | null>;
|
|
22
23
|
//#endregion
|
|
23
|
-
export { JwtAuthConfig as n, routeAgentRequest$1 as t };
|
|
24
|
+
export { JwtAuthConfig as n, createJwtAuthConfig as r, routeAgentRequest$1 as t };
|
|
@@ -2,6 +2,9 @@ import { routeAgentRequest } from "agents";
|
|
|
2
2
|
import { createRemoteJWKSet, decodeJwt, errors, jwtVerify } from "jose";
|
|
3
3
|
import { BasicTracerProvider, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
4
4
|
//#region src/server/features/auth/index.ts
|
|
5
|
+
function createJwtAuthConfig(config) {
|
|
6
|
+
return config;
|
|
7
|
+
}
|
|
5
8
|
const jwksByIssuer = /* @__PURE__ */ new Map();
|
|
6
9
|
/** Returns the actor portion of a top-level or parent-scoped agent name. */
|
|
7
10
|
function getTargetActorId(target) {
|
|
@@ -477,4 +480,4 @@ async function routeAgentRequest$1(request, env, options) {
|
|
|
477
480
|
return response;
|
|
478
481
|
}
|
|
479
482
|
//#endregion
|
|
480
|
-
export {
|
|
483
|
+
export { extractTokenFromConnectRequest as a, verifyJwt as c, createJwtAuthConfig as i, createAgentTracer as n, getTargetActorId as o, recordFeedbackAnalytics as r, isJwtActorAuthorized as s, routeAgentRequest$1 as t };
|
package/dist/v1.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as JwtAuthConfig, t as routeAgentRequest } from "./route-agent-request-
|
|
1
|
+
import { n as JwtAuthConfig, t as routeAgentRequest } from "./route-agent-request-9vqbi1bt.mjs";
|
|
2
2
|
import { Agent as Agent$1, Connection, ConnectionContext } from "agents";
|
|
3
3
|
import { LanguageModel, StreamTextOnFinishCallback, ToolSet, UIMessage, generateText, streamText } from "ai";
|
|
4
4
|
import { AIChatAgent, ChatResponseResult, OnChatMessageOptions } from "@cloudflare/ai-chat";
|
package/dist/v1.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as extractTokenFromConnectRequest, c as verifyJwt, n as createAgentTracer, s as isJwtActorAuthorized, t as routeAgentRequest } from "./route-agent-request-J98VlcOj.mjs";
|
|
2
2
|
import { Agent as Agent$1, callable, getCurrentAgent } from "agents";
|
|
3
3
|
import { Output, convertToModelMessages, generateText, jsonSchema, stepCountIs, streamText, tool } from "ai";
|
|
4
4
|
import { AIChatAgent } from "@cloudflare/ai-chat";
|