@economic/agents 1.6.7 → 1.7.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 +2 -0
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +7 -7
- package/package.json +12 -11
- package/bin/cli.mjs +0 -2
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -45,7 +45,7 @@ type BuildLLMParamsConfig = Omit<LLMParams, "prompt"> & {
|
|
|
45
45
|
*/
|
|
46
46
|
declare function buildLLMParams(config: BuildLLMParamsConfig): LLMParams;
|
|
47
47
|
//#endregion
|
|
48
|
-
//#region src/server/types.d.ts
|
|
48
|
+
//#region src/server/v1/types.d.ts
|
|
49
49
|
/**
|
|
50
50
|
* The context object available throughout an agent's lifetime — passed via
|
|
51
51
|
* `experimental_context` to tool `execute` functions. Contains the typed
|
|
@@ -66,7 +66,7 @@ interface AgentEnv {
|
|
|
66
66
|
}
|
|
67
67
|
interface ChatAgentEnv extends AgentEnv {}
|
|
68
68
|
//#endregion
|
|
69
|
-
//#region src/server/route-agent-request.d.ts
|
|
69
|
+
//#region src/server/v1/route-agent-request.d.ts
|
|
70
70
|
declare function routeAgentRequest<Env>(request: Request, env: Env, options?: AgentOptions<Env>): Promise<Response | null>;
|
|
71
71
|
//#endregion
|
|
72
72
|
//#region src/server/shared/features/auth/index.d.ts
|
|
@@ -84,7 +84,7 @@ interface JwtAuthConfig<TClaims extends Record<string, unknown> = Record<string,
|
|
|
84
84
|
getClaims: (payload: JWTPayload) => TClaims;
|
|
85
85
|
}
|
|
86
86
|
//#endregion
|
|
87
|
-
//#region src/server/agent/Agent.d.ts
|
|
87
|
+
//#region src/server/v1/agent/Agent.d.ts
|
|
88
88
|
/**
|
|
89
89
|
* Base agent for Cloudflare Agents SDK Durable Objects with lazy skill loading,
|
|
90
90
|
* audit logging, and `buildLLMParams` wiring.
|
|
@@ -140,13 +140,13 @@ declare abstract class Agent<Env extends Cloudflare.Env = Cloudflare.Env, TJwtId
|
|
|
140
140
|
}): Promise<LLMParams>;
|
|
141
141
|
}
|
|
142
142
|
//#endregion
|
|
143
|
-
//#region src/server/agent-chat/features/conversations/rating.d.ts
|
|
143
|
+
//#region src/server/v1/agent-chat/features/conversations/rating.d.ts
|
|
144
144
|
interface MessageRating {
|
|
145
145
|
rating: number;
|
|
146
146
|
comment?: string;
|
|
147
147
|
}
|
|
148
148
|
//#endregion
|
|
149
|
-
//#region src/server/agent-chat/ChatAgent.d.ts
|
|
149
|
+
//#region src/server/v1/agent-chat/ChatAgent.d.ts
|
|
150
150
|
/**
|
|
151
151
|
* Chat agent for Cloudflare Agents SDK: lazy skill loading, audit logging,
|
|
152
152
|
* message persistence, compaction, and conversation metadata in D1.
|
|
@@ -254,7 +254,7 @@ declare abstract class ChatAgent<Env extends Cloudflare.Env = Cloudflare.Env, TJ
|
|
|
254
254
|
private scheduleConversationForAutoDeletion;
|
|
255
255
|
}
|
|
256
256
|
//#endregion
|
|
257
|
-
//#region src/server/agent-chat/ChatAgentHarness.d.ts
|
|
257
|
+
//#region src/server/v1/agent-chat/ChatAgentHarness.d.ts
|
|
258
258
|
declare abstract class ChatAgentHarness<Env extends Cloudflare.Env, RequestBody extends Record<string, unknown> = Record<string, unknown>, SessionIdentity extends Record<string, unknown> = Record<string, unknown>> extends ChatAgent<Env, SessionIdentity> {
|
|
259
259
|
get binding(): {
|
|
260
260
|
getByName(name: string): {
|
package/dist/index.mjs
CHANGED
|
@@ -256,7 +256,7 @@ function buildLLMParams(config) {
|
|
|
256
256
|
};
|
|
257
257
|
}
|
|
258
258
|
//#endregion
|
|
259
|
-
//#region src/server/route-agent-request.ts
|
|
259
|
+
//#region src/server/v1/route-agent-request.ts
|
|
260
260
|
async function routeAgentRequest(request, env, options) {
|
|
261
261
|
const response = await routeAgentRequest$1(request, env, options);
|
|
262
262
|
if (!response) return null;
|
|
@@ -461,7 +461,7 @@ async function verifyJwt(request, config) {
|
|
|
461
461
|
};
|
|
462
462
|
}
|
|
463
463
|
//#endregion
|
|
464
|
-
//#region src/server/agent/Agent.ts
|
|
464
|
+
//#region src/server/v1/agent/Agent.ts
|
|
465
465
|
/**
|
|
466
466
|
* Base agent for Cloudflare Agents SDK Durable Objects with lazy skill loading,
|
|
467
467
|
* audit logging, and `buildLLMParams` wiring.
|
|
@@ -661,7 +661,7 @@ async function compactIfNeeded(messages, model, tailSize) {
|
|
|
661
661
|
return compactMessages(messages, model, tailSize);
|
|
662
662
|
}
|
|
663
663
|
//#endregion
|
|
664
|
-
//#region src/server/agent-chat/features/conversations/conversations.ts
|
|
664
|
+
//#region src/server/v1/agent-chat/features/conversations/conversations.ts
|
|
665
665
|
/**
|
|
666
666
|
* Renders only the user- and assistant-visible text parts of a message
|
|
667
667
|
* array for conversation title/summary generation.
|
|
@@ -791,7 +791,7 @@ async function generateConversationSummary(db, durableObjectName, messages, mode
|
|
|
791
791
|
};
|
|
792
792
|
}
|
|
793
793
|
//#endregion
|
|
794
|
-
//#region src/server/agent-chat/features/conversations/retention.ts
|
|
794
|
+
//#region src/server/v1/agent-chat/features/conversations/retention.ts
|
|
795
795
|
const DELETE_CONVERSATION_CALLBACK = "deleteConversationCallback";
|
|
796
796
|
const CONVERSATION_EXPIRED_CLOSE_CODE = 3001;
|
|
797
797
|
const CONVERSATION_EXPIRED_CLOSE_REASON = "Conversation expired due to inactivity.";
|
|
@@ -816,7 +816,7 @@ function filterEphemeralMessages(messages) {
|
|
|
816
816
|
});
|
|
817
817
|
}
|
|
818
818
|
//#endregion
|
|
819
|
-
//#region src/server/agent-chat/features/conversations/rating.ts
|
|
819
|
+
//#region src/server/v1/agent-chat/features/conversations/rating.ts
|
|
820
820
|
async function rateMessage(db, durableObjectName, messageId, rating, comment) {
|
|
821
821
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
822
822
|
await db.prepare(`INSERT INTO message_ratings (message_id, durable_object_name, rating, comment, created_at, updated_at)
|
|
@@ -834,7 +834,7 @@ async function getMessageRatings(db, durableObjectName) {
|
|
|
834
834
|
}]));
|
|
835
835
|
}
|
|
836
836
|
//#endregion
|
|
837
|
-
//#region src/server/agent-chat/ChatAgent.ts
|
|
837
|
+
//#region src/server/v1/agent-chat/ChatAgent.ts
|
|
838
838
|
/**
|
|
839
839
|
* Chat agent for Cloudflare Agents SDK: lazy skill loading, audit logging,
|
|
840
840
|
* message persistence, compaction, and conversation metadata in D1.
|
|
@@ -1023,7 +1023,7 @@ var ChatAgent = class extends AIChatAgent {
|
|
|
1023
1023
|
}
|
|
1024
1024
|
};
|
|
1025
1025
|
//#endregion
|
|
1026
|
-
//#region src/server/agent-chat/ChatAgentHarness.ts
|
|
1026
|
+
//#region src/server/v1/agent-chat/ChatAgentHarness.ts
|
|
1027
1027
|
var ChatAgentHarness = class extends ChatAgent {
|
|
1028
1028
|
get binding() {
|
|
1029
1029
|
const className = this.constructor.name;
|
package/package.json
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@economic/agents",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "A starter for creating a TypeScript package.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
7
|
-
"economic-agents": "./
|
|
7
|
+
"economic-agents": "./dist/cli.mjs"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
|
-
"schema"
|
|
12
|
-
"bin"
|
|
11
|
+
"schema"
|
|
13
12
|
],
|
|
14
13
|
"type": "module",
|
|
15
14
|
"types": "./dist/index.d.mts",
|
|
@@ -29,20 +28,22 @@
|
|
|
29
28
|
"@clack/prompts": "^1.2.0"
|
|
30
29
|
},
|
|
31
30
|
"devDependencies": {
|
|
32
|
-
"@cloudflare/ai-chat": "^0.
|
|
33
|
-
"@cloudflare/
|
|
31
|
+
"@cloudflare/ai-chat": "^0.6.2",
|
|
32
|
+
"@cloudflare/think": "^0.5.3",
|
|
33
|
+
"@cloudflare/workers-types": "^4.20260430.1",
|
|
34
34
|
"@types/node": "^25.6.0",
|
|
35
35
|
"@typescript/native-preview": "7.0.0-dev.20260412.1",
|
|
36
|
-
"agents": "^0.
|
|
37
|
-
"ai": "^6.0.
|
|
36
|
+
"agents": "^0.12.3",
|
|
37
|
+
"ai": "^6.0.175",
|
|
38
38
|
"jose": "^6.2.2",
|
|
39
|
-
"tsdown": "^0.
|
|
39
|
+
"tsdown": "^0.22.0",
|
|
40
40
|
"typescript": "^6.0.2",
|
|
41
41
|
"vitest": "^4.1.4"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@cloudflare/ai-chat": ">=0.
|
|
45
|
-
"
|
|
44
|
+
"@cloudflare/ai-chat": ">=0.6.0 <1.0.0",
|
|
45
|
+
"@cloudflare/think": ">=0.5.0 <1.0.0",
|
|
46
|
+
"agents": ">=0.12.0 <1.0.0",
|
|
46
47
|
"ai": "^6.0.0",
|
|
47
48
|
"jose": "^6.0.0"
|
|
48
49
|
},
|
package/bin/cli.mjs
DELETED