@standardagents/builder 0.17.3 → 0.18.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/dist/built-in-routes.js +442 -358
- package/dist/built-in-routes.js.map +1 -1
- package/dist/client/LoginView.js +1 -1
- package/dist/client/index.js +3 -3
- package/dist/index.js +461 -47
- package/dist/index.js.map +1 -1
- package/dist/plugin.js +70 -2
- package/dist/plugin.js.map +1 -1
- package/dist/runtime.d.ts +72 -4
- package/dist/runtime.js +391 -45
- package/dist/runtime.js.map +1 -1
- package/package.json +4 -4
package/dist/runtime.d.ts
CHANGED
|
@@ -105,6 +105,10 @@ interface AuthUser {
|
|
|
105
105
|
id: string;
|
|
106
106
|
username: string;
|
|
107
107
|
role: string;
|
|
108
|
+
platform_user_id?: string | null;
|
|
109
|
+
email?: string | null;
|
|
110
|
+
display_name?: string | null;
|
|
111
|
+
avatar_url?: string | null;
|
|
108
112
|
}
|
|
109
113
|
interface AuthContext {
|
|
110
114
|
user: AuthUser;
|
|
@@ -1308,14 +1312,43 @@ interface UpdateThreadParams {
|
|
|
1308
1312
|
/**
|
|
1309
1313
|
* User record.
|
|
1310
1314
|
*/
|
|
1315
|
+
type InstanceRole = 'admin' | 'user';
|
|
1311
1316
|
interface User {
|
|
1312
1317
|
id: string;
|
|
1313
1318
|
username: string;
|
|
1314
1319
|
password_hash: string;
|
|
1315
|
-
role:
|
|
1320
|
+
role: InstanceRole;
|
|
1321
|
+
platform_user_id?: string | null;
|
|
1322
|
+
email?: string | null;
|
|
1323
|
+
display_name?: string | null;
|
|
1324
|
+
avatar_url?: string | null;
|
|
1325
|
+
source?: 'local' | 'standard_agents';
|
|
1326
|
+
replica_active?: number;
|
|
1316
1327
|
created_at: number;
|
|
1317
1328
|
updated_at: number;
|
|
1318
1329
|
}
|
|
1330
|
+
interface PlatformReplicaUser {
|
|
1331
|
+
platform_user_id: string;
|
|
1332
|
+
username?: string | null;
|
|
1333
|
+
email?: string | null;
|
|
1334
|
+
display_name?: string | null;
|
|
1335
|
+
avatar_url?: string | null;
|
|
1336
|
+
role: InstanceRole;
|
|
1337
|
+
}
|
|
1338
|
+
interface PlatformReplicaApiKey {
|
|
1339
|
+
id: string;
|
|
1340
|
+
name?: string | null;
|
|
1341
|
+
key_hash: string;
|
|
1342
|
+
key_prefix: string;
|
|
1343
|
+
last_five?: string | null;
|
|
1344
|
+
user_platform_id?: string | null;
|
|
1345
|
+
scope?: string | null;
|
|
1346
|
+
created_at?: number | null;
|
|
1347
|
+
}
|
|
1348
|
+
interface PlatformReplicaSnapshot {
|
|
1349
|
+
users: PlatformReplicaUser[];
|
|
1350
|
+
api_keys?: PlatformReplicaApiKey[];
|
|
1351
|
+
}
|
|
1319
1352
|
interface ScopedEnvEntry {
|
|
1320
1353
|
name: string;
|
|
1321
1354
|
value: string;
|
|
@@ -1553,6 +1586,9 @@ declare class DurableAgentBuilder<Env extends AgentBuilderEnv = AgentBuilderEnv>
|
|
|
1553
1586
|
* Delete a provider.
|
|
1554
1587
|
*/
|
|
1555
1588
|
deleteProvider(name: string): Promise<boolean>;
|
|
1589
|
+
private normalizeReplicaUsername;
|
|
1590
|
+
private availableReplicaUsername;
|
|
1591
|
+
private userFromRow;
|
|
1556
1592
|
/**
|
|
1557
1593
|
* Get a user by username.
|
|
1558
1594
|
*/
|
|
@@ -1567,7 +1603,12 @@ declare class DurableAgentBuilder<Env extends AgentBuilderEnv = AgentBuilderEnv>
|
|
|
1567
1603
|
createUser(params: {
|
|
1568
1604
|
username: string;
|
|
1569
1605
|
password_hash: string;
|
|
1570
|
-
role?:
|
|
1606
|
+
role?: InstanceRole;
|
|
1607
|
+
platform_user_id?: string | null;
|
|
1608
|
+
email?: string | null;
|
|
1609
|
+
display_name?: string | null;
|
|
1610
|
+
avatar_url?: string | null;
|
|
1611
|
+
source?: 'local' | 'standard_agents';
|
|
1571
1612
|
}): Promise<User>;
|
|
1572
1613
|
/**
|
|
1573
1614
|
* Check if any users exist (for first-time setup).
|
|
@@ -1579,7 +1620,13 @@ declare class DurableAgentBuilder<Env extends AgentBuilderEnv = AgentBuilderEnv>
|
|
|
1579
1620
|
listUsers(): Promise<Array<{
|
|
1580
1621
|
id: string;
|
|
1581
1622
|
username: string;
|
|
1582
|
-
role:
|
|
1623
|
+
role: InstanceRole;
|
|
1624
|
+
platform_user_id: string | null;
|
|
1625
|
+
email: string | null;
|
|
1626
|
+
display_name: string | null;
|
|
1627
|
+
avatar_url: string | null;
|
|
1628
|
+
source: 'local' | 'standard_agents';
|
|
1629
|
+
replica_active: number;
|
|
1583
1630
|
created_at: number;
|
|
1584
1631
|
updated_at: number;
|
|
1585
1632
|
}>>;
|
|
@@ -1589,12 +1636,32 @@ declare class DurableAgentBuilder<Env extends AgentBuilderEnv = AgentBuilderEnv>
|
|
|
1589
1636
|
updateUser(id: string, params: {
|
|
1590
1637
|
username?: string;
|
|
1591
1638
|
password_hash?: string;
|
|
1592
|
-
role?:
|
|
1639
|
+
role?: InstanceRole;
|
|
1640
|
+
platform_user_id?: string | null;
|
|
1641
|
+
email?: string | null;
|
|
1642
|
+
display_name?: string | null;
|
|
1643
|
+
avatar_url?: string | null;
|
|
1644
|
+
source?: 'local' | 'standard_agents';
|
|
1645
|
+
replica_active?: number;
|
|
1593
1646
|
}): Promise<User | null>;
|
|
1594
1647
|
/**
|
|
1595
1648
|
* Delete a user.
|
|
1596
1649
|
*/
|
|
1597
1650
|
deleteUser(id: string): Promise<boolean>;
|
|
1651
|
+
/**
|
|
1652
|
+
* Upsert a platform-replicated identity and return the local user row.
|
|
1653
|
+
*/
|
|
1654
|
+
upsertPlatformReplicaUser(replica: PlatformReplicaUser): Promise<User>;
|
|
1655
|
+
/**
|
|
1656
|
+
* Apply a full platform read-replica snapshot for this instance.
|
|
1657
|
+
*/
|
|
1658
|
+
applyPlatformReplicaSnapshot(snapshot: PlatformReplicaSnapshot): Promise<{
|
|
1659
|
+
users: number;
|
|
1660
|
+
api_keys: number;
|
|
1661
|
+
}>;
|
|
1662
|
+
getUserByPlatformUserId(platformUserId: string): Promise<User | null>;
|
|
1663
|
+
private getFirstReplicaAdminUser;
|
|
1664
|
+
private upsertPlatformReplicaApiKey;
|
|
1598
1665
|
/**
|
|
1599
1666
|
* Create a new session.
|
|
1600
1667
|
*/
|
|
@@ -1643,6 +1710,7 @@ declare class DurableAgentBuilder<Env extends AgentBuilderEnv = AgentBuilderEnv>
|
|
|
1643
1710
|
name: string;
|
|
1644
1711
|
key_prefix: string;
|
|
1645
1712
|
last_five: string;
|
|
1713
|
+
source: 'local' | 'standard_agents';
|
|
1646
1714
|
created_at: number;
|
|
1647
1715
|
last_used_at: number | null;
|
|
1648
1716
|
}>>;
|