@economic/agents 2.3.23 → 2.3.24
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 +1 -1
- package/dist/index.mjs +5 -4
- package/package.json +9 -9
package/dist/index.d.mts
CHANGED
|
@@ -128,7 +128,7 @@ declare abstract class Agent<RequestContext extends Record<string, unknown> = Re
|
|
|
128
128
|
* `updated_at`, so instances can be ordered by recency of activity.
|
|
129
129
|
* Best-effort and non-blocking — never allowed to interfere with a turn.
|
|
130
130
|
*/
|
|
131
|
-
protected
|
|
131
|
+
protected registerInstanceActivity(): Promise<void>;
|
|
132
132
|
/**
|
|
133
133
|
* Resolves the analytics/telemetry agent name to the entry-point agent: the
|
|
134
134
|
* top-level DO registered in the `agent` catalog table.
|
package/dist/index.mjs
CHANGED
|
@@ -170,7 +170,7 @@ var Agent = class extends Think {
|
|
|
170
170
|
return;
|
|
171
171
|
}
|
|
172
172
|
const token = extractTokenFromConnectRequest(ctx.request);
|
|
173
|
-
if (token && this.getUserContext)
|
|
173
|
+
if (token && this.getUserContext) connection.setState({ userContext: await this.getUserContext(token) });
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
sendConnectionStatus(connection, "connected");
|
|
@@ -178,9 +178,10 @@ var Agent = class extends Think {
|
|
|
178
178
|
_toolsForCurrentTurn = {};
|
|
179
179
|
_toolContextForCurrentTurn;
|
|
180
180
|
getToolContextForCurrentTurn(requestContext = {}) {
|
|
181
|
+
const connectionState = getCurrentAgent().connection?.state;
|
|
181
182
|
return {
|
|
182
183
|
...requestContext,
|
|
183
|
-
_userContext:
|
|
184
|
+
_userContext: connectionState?.userContext
|
|
184
185
|
};
|
|
185
186
|
}
|
|
186
187
|
/**
|
|
@@ -191,7 +192,7 @@ var Agent = class extends Think {
|
|
|
191
192
|
* `returned.tools` into your own `TurnConfig.tools` if you return tools.
|
|
192
193
|
*/
|
|
193
194
|
async beforeTurn(ctx) {
|
|
194
|
-
this.
|
|
195
|
+
this.registerInstanceActivity();
|
|
195
196
|
this._toolContextForCurrentTurn = this.getToolContextForCurrentTurn(ctx.body);
|
|
196
197
|
this._toolsForCurrentTurn = ctx.tools;
|
|
197
198
|
const activeSkillName = this._getLastActivatedSkillName(ctx.messages);
|
|
@@ -348,7 +349,7 @@ var Agent = class extends Think {
|
|
|
348
349
|
* `updated_at`, so instances can be ordered by recency of activity.
|
|
349
350
|
* Best-effort and non-blocking — never allowed to interfere with a turn.
|
|
350
351
|
*/
|
|
351
|
-
async
|
|
352
|
+
async registerInstanceActivity() {
|
|
352
353
|
try {
|
|
353
354
|
await touchAgentInstance(this.env.AGENTS_DB, {
|
|
354
355
|
...this.getRegisteredInstanceKey(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@economic/agents",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.24",
|
|
4
4
|
"description": "A starter for creating a TypeScript package.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@ai-sdk/anthropic": "^3.0.77",
|
|
27
27
|
"@ai-sdk/google": "^3.0.73",
|
|
28
|
-
"@cloudflare/ai-chat": "^0.
|
|
29
|
-
"@cloudflare/think": "
|
|
28
|
+
"@cloudflare/ai-chat": "^0.9.3",
|
|
29
|
+
"@cloudflare/think": "^0.12.1",
|
|
30
30
|
"@opentelemetry/sdk-trace-base": "^2.8.0",
|
|
31
|
-
"agents": "
|
|
31
|
+
"agents": "^0.17.3",
|
|
32
32
|
"ai": "^6.0.197",
|
|
33
33
|
"jose": "^6.2.3",
|
|
34
34
|
"nanoid": "^5.1.11"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@babel/core": "^7.29.7",
|
|
38
38
|
"@babel/plugin-proposal-decorators": "^7.29.7",
|
|
39
|
-
"@cloudflare/workers-types": "^4.
|
|
39
|
+
"@cloudflare/workers-types": "^4.20260701.1",
|
|
40
40
|
"@rolldown/plugin-babel": "^0.2.3",
|
|
41
41
|
"@types/node": "^25.6.0",
|
|
42
42
|
"@typescript/native-preview": "7.0.0-dev.20260412.1",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"vitest": "^4.1.4"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@cloudflare/think": "
|
|
49
|
-
"@cloudflare/vite-plugin": "^1.42.
|
|
50
|
-
"@cloudflare/worker-bundler": "
|
|
51
|
-
"agents": "
|
|
48
|
+
"@cloudflare/think": "^0.12.1",
|
|
49
|
+
"@cloudflare/vite-plugin": "^1.42.4",
|
|
50
|
+
"@cloudflare/worker-bundler": "^0.2.1",
|
|
51
|
+
"agents": "^0.17.3",
|
|
52
52
|
"vite": ">=8.0.0"
|
|
53
53
|
}
|
|
54
54
|
}
|