@economic/agents 2.3.12 → 2.3.14

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.
Files changed (2) hide show
  1. package/dist/index.mjs +17 -2
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -49,6 +49,12 @@ function sendAgentType(connection, agentType) {
49
49
  agentType
50
50
  }));
51
51
  }
52
+ function sendSubAgentName(connection, subAgentName) {
53
+ connection.send(JSON.stringify({
54
+ type: "sub_agent_name",
55
+ subAgentName
56
+ }));
57
+ }
52
58
  //#endregion
53
59
  //#region src/server/agents/Agent.ts
54
60
  var Agent = class extends Think {
@@ -387,9 +393,17 @@ function getChatRetentionMs(days) {
387
393
  //#endregion
388
394
  //#region src/server/features/migration.ts
389
395
  async function listLegacyConversations(db, userId) {
390
- const { results } = await db.prepare(`SELECT durable_object_name, title, summary, created_at, updated_at
396
+ try {
397
+ const { results } = await db.prepare(`SELECT durable_object_name, title, summary, created_at, updated_at
391
398
  FROM conversations WHERE durable_object_name LIKE ? ORDER BY updated_at ASC`).bind(`${userId}:%`).all();
392
- return results ?? [];
399
+ return results ?? [];
400
+ } catch (error) {
401
+ if (error instanceof Error && error.message.includes(`no such table: conversations`)) {
402
+ console.warn("[Migration] Legacy conversations table missing; skipping v1 migration", { userId });
403
+ return [];
404
+ }
405
+ throw error;
406
+ }
393
407
  }
394
408
  async function listLegacyFeedback(db, durableObjectName) {
395
409
  const { results } = await db.prepare(`SELECT message_id, rating, comment FROM message_ratings WHERE durable_object_name = ?`).bind(durableObjectName).all();
@@ -626,6 +640,7 @@ var Assistant = class extends Agent$1 {
626
640
  }
627
641
  async onConnect(connection, ctx) {
628
642
  sendAgentType(connection, "assistant");
643
+ sendSubAgentName(connection, this.agent.name);
629
644
  sendConnectionStatus(connection, "connecting");
630
645
  const getJwtAuthConfig = this.agent.getJwtAuthConfig;
631
646
  if (getJwtAuthConfig) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@economic/agents",
3
- "version": "2.3.12",
3
+ "version": "2.3.14",
4
4
  "description": "A starter for creating a TypeScript package.",
5
5
  "license": "MIT",
6
6
  "files": [