@agenticmail/core 0.9.1 → 0.9.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.cjs CHANGED
@@ -2006,7 +2006,7 @@ var import_uuid = require("uuid");
2006
2006
  var import_node_crypto = require("crypto");
2007
2007
 
2008
2008
  // src/accounts/types.ts
2009
- var AGENT_ROLES = ["secretary", "assistant", "researcher", "writer", "custom"];
2009
+ var AGENT_ROLES = ["secretary", "assistant", "researcher", "writer", "custom", "bridge"];
2010
2010
  var DEFAULT_AGENT_ROLE = "secretary";
2011
2011
  var DEFAULT_AGENT_NAME = "secretary";
2012
2012
 
@@ -2135,6 +2135,27 @@ var AccountManager = class {
2135
2135
  const result = stmt.run(id);
2136
2136
  return result.changes > 0;
2137
2137
  }
2138
+ /**
2139
+ * Update an agent's role. Used by host-integration installers
2140
+ * (`@agenticmail/claudecode`, `@agenticmail/codex`) to migrate a
2141
+ * pre-existing bridge account from `'assistant'` (the workaround they
2142
+ * used before the `'bridge'` role landed) to the canonical
2143
+ * `'bridge'` role. Returns the updated agent, or null when the id
2144
+ * doesn't exist.
2145
+ *
2146
+ * Caller is responsible for validating the role string against
2147
+ * AGENT_ROLES — this method trusts what it's given.
2148
+ */
2149
+ async updateRole(id, role) {
2150
+ const existing = await this.getById(id);
2151
+ if (!existing) return null;
2152
+ if (existing.role === role) return existing;
2153
+ const stmt = this.db.prepare(`
2154
+ UPDATE agents SET role = ?, updated_at = datetime('now') WHERE id = ?
2155
+ `);
2156
+ stmt.run(role, id);
2157
+ return this.getById(id);
2158
+ }
2138
2159
  async updateMetadata(id, metadata) {
2139
2160
  const existing = await this.getById(id);
2140
2161
  if (!existing) return null;
package/dist/index.d.cts CHANGED
@@ -305,8 +305,19 @@ declare function getDatabase(config: AgenticMailConfig): Database;
305
305
  declare function closeDatabase(): void;
306
306
  declare function createTestDatabase(): Database;
307
307
 
308
- /** Predefined agent roles */
309
- type AgentRole = 'secretary' | 'assistant' | 'researcher' | 'writer' | 'custom';
308
+ /** Predefined agent roles.
309
+ *
310
+ * `bridge` is the host-bridge identity — the account that represents an
311
+ * external LLM host (Claude Code, Codex, Hermes, …) inside AgenticMail.
312
+ * It owns its own inbox + API key like any other account but is logically
313
+ * special: it's not a teammate the user assigns work to, it's the host
314
+ * itself acting on behalf of itself. The web UI / list_agents / wake
315
+ * gating SHOULD treat bridge accounts distinctly (they aren't typically
316
+ * spawned as subagents; they don't show up in coordination team pickers
317
+ * by default). The host-integration packages (@agenticmail/claudecode,
318
+ * @agenticmail/codex) use this role when provisioning their bridge.
319
+ */
320
+ type AgentRole = 'secretary' | 'assistant' | 'researcher' | 'writer' | 'custom' | 'bridge';
310
321
  declare const AGENT_ROLES: readonly AgentRole[];
311
322
  declare const DEFAULT_AGENT_ROLE: AgentRole;
312
323
  declare const DEFAULT_AGENT_NAME = "secretary";
@@ -348,6 +359,18 @@ declare class AccountManager {
348
359
  list(): Promise<Agent[]>;
349
360
  getByRole(role: AgentRole): Promise<Agent[]>;
350
361
  delete(id: string): Promise<boolean>;
362
+ /**
363
+ * Update an agent's role. Used by host-integration installers
364
+ * (`@agenticmail/claudecode`, `@agenticmail/codex`) to migrate a
365
+ * pre-existing bridge account from `'assistant'` (the workaround they
366
+ * used before the `'bridge'` role landed) to the canonical
367
+ * `'bridge'` role. Returns the updated agent, or null when the id
368
+ * doesn't exist.
369
+ *
370
+ * Caller is responsible for validating the role string against
371
+ * AGENT_ROLES — this method trusts what it's given.
372
+ */
373
+ updateRole(id: string, role: AgentRole): Promise<Agent | null>;
351
374
  updateMetadata(id: string, metadata: Record<string, unknown>): Promise<Agent | null>;
352
375
  getCredentials(id: string): Promise<{
353
376
  email: string;
package/dist/index.d.ts CHANGED
@@ -305,8 +305,19 @@ declare function getDatabase(config: AgenticMailConfig): Database;
305
305
  declare function closeDatabase(): void;
306
306
  declare function createTestDatabase(): Database;
307
307
 
308
- /** Predefined agent roles */
309
- type AgentRole = 'secretary' | 'assistant' | 'researcher' | 'writer' | 'custom';
308
+ /** Predefined agent roles.
309
+ *
310
+ * `bridge` is the host-bridge identity — the account that represents an
311
+ * external LLM host (Claude Code, Codex, Hermes, …) inside AgenticMail.
312
+ * It owns its own inbox + API key like any other account but is logically
313
+ * special: it's not a teammate the user assigns work to, it's the host
314
+ * itself acting on behalf of itself. The web UI / list_agents / wake
315
+ * gating SHOULD treat bridge accounts distinctly (they aren't typically
316
+ * spawned as subagents; they don't show up in coordination team pickers
317
+ * by default). The host-integration packages (@agenticmail/claudecode,
318
+ * @agenticmail/codex) use this role when provisioning their bridge.
319
+ */
320
+ type AgentRole = 'secretary' | 'assistant' | 'researcher' | 'writer' | 'custom' | 'bridge';
310
321
  declare const AGENT_ROLES: readonly AgentRole[];
311
322
  declare const DEFAULT_AGENT_ROLE: AgentRole;
312
323
  declare const DEFAULT_AGENT_NAME = "secretary";
@@ -348,6 +359,18 @@ declare class AccountManager {
348
359
  list(): Promise<Agent[]>;
349
360
  getByRole(role: AgentRole): Promise<Agent[]>;
350
361
  delete(id: string): Promise<boolean>;
362
+ /**
363
+ * Update an agent's role. Used by host-integration installers
364
+ * (`@agenticmail/claudecode`, `@agenticmail/codex`) to migrate a
365
+ * pre-existing bridge account from `'assistant'` (the workaround they
366
+ * used before the `'bridge'` role landed) to the canonical
367
+ * `'bridge'` role. Returns the updated agent, or null when the id
368
+ * doesn't exist.
369
+ *
370
+ * Caller is responsible for validating the role string against
371
+ * AGENT_ROLES — this method trusts what it's given.
372
+ */
373
+ updateRole(id: string, role: AgentRole): Promise<Agent | null>;
351
374
  updateMetadata(id: string, metadata: Record<string, unknown>): Promise<Agent | null>;
352
375
  getCredentials(id: string): Promise<{
353
376
  email: string;
package/dist/index.js CHANGED
@@ -1247,7 +1247,7 @@ import { v4 as uuidv4 } from "uuid";
1247
1247
  import { randomBytes } from "crypto";
1248
1248
 
1249
1249
  // src/accounts/types.ts
1250
- var AGENT_ROLES = ["secretary", "assistant", "researcher", "writer", "custom"];
1250
+ var AGENT_ROLES = ["secretary", "assistant", "researcher", "writer", "custom", "bridge"];
1251
1251
  var DEFAULT_AGENT_ROLE = "secretary";
1252
1252
  var DEFAULT_AGENT_NAME = "secretary";
1253
1253
 
@@ -1376,6 +1376,27 @@ var AccountManager = class {
1376
1376
  const result = stmt.run(id);
1377
1377
  return result.changes > 0;
1378
1378
  }
1379
+ /**
1380
+ * Update an agent's role. Used by host-integration installers
1381
+ * (`@agenticmail/claudecode`, `@agenticmail/codex`) to migrate a
1382
+ * pre-existing bridge account from `'assistant'` (the workaround they
1383
+ * used before the `'bridge'` role landed) to the canonical
1384
+ * `'bridge'` role. Returns the updated agent, or null when the id
1385
+ * doesn't exist.
1386
+ *
1387
+ * Caller is responsible for validating the role string against
1388
+ * AGENT_ROLES — this method trusts what it's given.
1389
+ */
1390
+ async updateRole(id, role) {
1391
+ const existing = await this.getById(id);
1392
+ if (!existing) return null;
1393
+ if (existing.role === role) return existing;
1394
+ const stmt = this.db.prepare(`
1395
+ UPDATE agents SET role = ?, updated_at = datetime('now') WHERE id = ?
1396
+ `);
1397
+ stmt.run(role, id);
1398
+ return this.getById(id);
1399
+ }
1379
1400
  async updateMetadata(id, metadata) {
1380
1401
  const existing = await this.getById(id);
1381
1402
  if (!existing) return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticmail/core",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "description": "Core SDK for AgenticMail — email, SMS, and phone number access for AI agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",