@economic/agents 2.3.1 → 2.3.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 +1 -1
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -103,7 +103,7 @@ declare abstract class Agent<RequestContext extends Record<string, unknown> = Re
|
|
|
103
103
|
* The user context for the session.
|
|
104
104
|
* Define getUserContext to set a user context.
|
|
105
105
|
*/
|
|
106
|
-
|
|
106
|
+
protected userContext?: UserContext;
|
|
107
107
|
/**
|
|
108
108
|
* Returns the identity following verification of the JWT token - getJwtAuthConfig is required.
|
|
109
109
|
* This method should not have side effects - return a single object from it.
|
package/dist/index.mjs
CHANGED
|
@@ -121,7 +121,7 @@ var Agent = class extends Think {
|
|
|
121
121
|
});
|
|
122
122
|
const token = extractTokenFromConnectRequest(ctx.request);
|
|
123
123
|
if (token && this.getUserContext) this._pendingUserContextRequest = this.getUserContext(token).then((userContext) => {
|
|
124
|
-
this.
|
|
124
|
+
this.userContext = userContext;
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
127
|
}
|
|
@@ -148,7 +148,7 @@ var Agent = class extends Think {
|
|
|
148
148
|
if (this._pendingUserContextRequest) await this._pendingUserContextRequest;
|
|
149
149
|
this._toolContextForCurrentTurn = {
|
|
150
150
|
...ctx.body ?? {},
|
|
151
|
-
_userContext: this.
|
|
151
|
+
_userContext: this.userContext
|
|
152
152
|
};
|
|
153
153
|
await this.session.refreshSystemPrompt();
|
|
154
154
|
this._toolsForCurrentTurn = ctx.tools;
|
|
@@ -267,7 +267,7 @@ var Agent = class extends Think {
|
|
|
267
267
|
* The user context for the session.
|
|
268
268
|
* Define getUserContext to set a user context.
|
|
269
269
|
*/
|
|
270
|
-
|
|
270
|
+
userContext;
|
|
271
271
|
/**
|
|
272
272
|
* Self-registers this DO in the global `agent_registry`. Only top-level DOs
|
|
273
273
|
* are registered — facets are enumerable via their parent's own index, so
|