@standardagents/builder 0.27.1 → 0.27.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/built-in-routes.js +1 -1
- package/dist/index.js +119 -9
- package/dist/index.js.map +1 -1
- package/dist/runtime.js +119 -9
- package/dist/runtime.js.map +1 -1
- package/package.json +5 -5
package/dist/built-in-routes.js
CHANGED
|
@@ -66175,7 +66175,7 @@ var config_get_default = defineController2(async ({ config, env: env2, req }) =>
|
|
|
66175
66175
|
});
|
|
66176
66176
|
|
|
66177
66177
|
// src/version.ts
|
|
66178
|
-
var BUILDER_VERSION = "0.27.
|
|
66178
|
+
var BUILDER_VERSION = "0.27.2".length > 0 ? "0.27.2" : "dev";
|
|
66179
66179
|
|
|
66180
66180
|
// src/api/diagnostics.get.ts
|
|
66181
66181
|
init_LLMRequest();
|
package/dist/index.js
CHANGED
|
@@ -25587,9 +25587,9 @@ var DurableThread = class _DurableThread extends DurableObject {
|
|
|
25587
25587
|
* Each migration is run in order, starting from the current version + 1.
|
|
25588
25588
|
*/
|
|
25589
25589
|
async runMigrations(fromVersion) {
|
|
25590
|
-
for (const
|
|
25591
|
-
if (
|
|
25592
|
-
await
|
|
25590
|
+
for (const migration47 of migrations) {
|
|
25591
|
+
if (migration47.version > fromVersion) {
|
|
25592
|
+
await migration47.up(this.ctx.storage.sql);
|
|
25593
25593
|
}
|
|
25594
25594
|
}
|
|
25595
25595
|
}
|
|
@@ -30291,9 +30291,119 @@ var migration45 = {
|
|
|
30291
30291
|
}
|
|
30292
30292
|
};
|
|
30293
30293
|
|
|
30294
|
+
// src/durable-objects/agentbuilder-migrations/0012_allow_api_instance_role.ts
|
|
30295
|
+
var migration46 = {
|
|
30296
|
+
version: 12,
|
|
30297
|
+
async up(sql) {
|
|
30298
|
+
sql.exec(`CREATE TABLE oauth_accounts_0012_backup AS SELECT * FROM oauth_accounts`);
|
|
30299
|
+
sql.exec(`CREATE TABLE api_keys_0012_backup AS SELECT * FROM api_keys`);
|
|
30300
|
+
sql.exec(`CREATE TABLE sessions_0012_backup AS SELECT * FROM sessions`);
|
|
30301
|
+
sql.exec(`DROP TABLE oauth_accounts`);
|
|
30302
|
+
sql.exec(`DROP TABLE api_keys`);
|
|
30303
|
+
sql.exec(`DROP TABLE sessions`);
|
|
30304
|
+
sql.exec(`ALTER TABLE users RENAME TO users_0012_old`);
|
|
30305
|
+
sql.exec(`
|
|
30306
|
+
CREATE TABLE users (
|
|
30307
|
+
id TEXT PRIMARY KEY NOT NULL,
|
|
30308
|
+
username TEXT UNIQUE NOT NULL,
|
|
30309
|
+
password_hash TEXT NOT NULL,
|
|
30310
|
+
role TEXT NOT NULL DEFAULT 'admin' CHECK (role IN ('admin')),
|
|
30311
|
+
created_at INTEGER DEFAULT (strftime('%s', 'now')),
|
|
30312
|
+
updated_at INTEGER DEFAULT (strftime('%s', 'now')),
|
|
30313
|
+
platform_user_id TEXT,
|
|
30314
|
+
email TEXT,
|
|
30315
|
+
display_name TEXT,
|
|
30316
|
+
avatar_url TEXT,
|
|
30317
|
+
instance_role TEXT NOT NULL DEFAULT 'admin' CHECK (instance_role IN ('admin', 'user', 'api')),
|
|
30318
|
+
source TEXT NOT NULL DEFAULT 'local' CHECK (source IN ('local', 'standard_agents')),
|
|
30319
|
+
replica_active INTEGER NOT NULL DEFAULT 1,
|
|
30320
|
+
replica_updated_at INTEGER,
|
|
30321
|
+
deleted_at INTEGER,
|
|
30322
|
+
permissions TEXT
|
|
30323
|
+
)
|
|
30324
|
+
`);
|
|
30325
|
+
sql.exec(`
|
|
30326
|
+
INSERT INTO users (
|
|
30327
|
+
id, username, password_hash, role, created_at, updated_at,
|
|
30328
|
+
platform_user_id, email, display_name, avatar_url, instance_role,
|
|
30329
|
+
source, replica_active, replica_updated_at, deleted_at, permissions
|
|
30330
|
+
)
|
|
30331
|
+
SELECT
|
|
30332
|
+
id, username, password_hash, role, created_at, updated_at,
|
|
30333
|
+
platform_user_id, email, display_name, avatar_url, instance_role,
|
|
30334
|
+
source, replica_active, replica_updated_at, deleted_at, permissions
|
|
30335
|
+
FROM users_0012_old
|
|
30336
|
+
`);
|
|
30337
|
+
sql.exec(`DROP TABLE users_0012_old`);
|
|
30338
|
+
sql.exec(`CREATE INDEX idx_users_username ON users(username)`);
|
|
30339
|
+
sql.exec(`CREATE INDEX idx_users_role ON users(role)`);
|
|
30340
|
+
sql.exec(`CREATE INDEX idx_users_platform_user_id ON users(platform_user_id)`);
|
|
30341
|
+
sql.exec(`CREATE INDEX idx_users_replica_active ON users(replica_active)`);
|
|
30342
|
+
sql.exec(`CREATE INDEX idx_users_instance_role ON users(instance_role)`);
|
|
30343
|
+
sql.exec(`
|
|
30344
|
+
CREATE TABLE oauth_accounts (
|
|
30345
|
+
id TEXT PRIMARY KEY NOT NULL,
|
|
30346
|
+
user_id TEXT NOT NULL,
|
|
30347
|
+
provider TEXT NOT NULL CHECK (provider IN ('github', 'google')),
|
|
30348
|
+
provider_user_id TEXT NOT NULL,
|
|
30349
|
+
provider_username TEXT,
|
|
30350
|
+
created_at INTEGER DEFAULT (strftime('%s', 'now')),
|
|
30351
|
+
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
|
30352
|
+
)
|
|
30353
|
+
`);
|
|
30354
|
+
sql.exec(`INSERT INTO oauth_accounts SELECT * FROM oauth_accounts_0012_backup`);
|
|
30355
|
+
sql.exec(`CREATE UNIQUE INDEX idx_oauth_accounts_provider ON oauth_accounts(provider, provider_user_id)`);
|
|
30356
|
+
sql.exec(`CREATE INDEX idx_oauth_accounts_user_id ON oauth_accounts(user_id)`);
|
|
30357
|
+
sql.exec(`
|
|
30358
|
+
CREATE TABLE api_keys (
|
|
30359
|
+
id TEXT PRIMARY KEY NOT NULL,
|
|
30360
|
+
name TEXT NOT NULL,
|
|
30361
|
+
key_hash TEXT NOT NULL,
|
|
30362
|
+
key_prefix TEXT NOT NULL,
|
|
30363
|
+
last_five TEXT NOT NULL,
|
|
30364
|
+
user_id TEXT NOT NULL,
|
|
30365
|
+
created_at INTEGER DEFAULT (strftime('%s', 'now')),
|
|
30366
|
+
last_used_at INTEGER,
|
|
30367
|
+
platform_key_id TEXT,
|
|
30368
|
+
scope TEXT,
|
|
30369
|
+
source TEXT NOT NULL DEFAULT 'local' CHECK (source IN ('local', 'standard_agents')),
|
|
30370
|
+
replica_active INTEGER NOT NULL DEFAULT 1,
|
|
30371
|
+
replica_updated_at INTEGER,
|
|
30372
|
+
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
|
30373
|
+
)
|
|
30374
|
+
`);
|
|
30375
|
+
sql.exec(`INSERT INTO api_keys SELECT * FROM api_keys_0012_backup`);
|
|
30376
|
+
sql.exec(`CREATE INDEX idx_api_keys_key_hash ON api_keys(key_hash)`);
|
|
30377
|
+
sql.exec(`CREATE INDEX idx_api_keys_user_id ON api_keys(user_id)`);
|
|
30378
|
+
sql.exec(`CREATE INDEX idx_api_keys_key_prefix ON api_keys(key_prefix)`);
|
|
30379
|
+
sql.exec(`CREATE INDEX idx_api_keys_platform_key_id ON api_keys(platform_key_id)`);
|
|
30380
|
+
sql.exec(`CREATE INDEX idx_api_keys_replica_active ON api_keys(replica_active)`);
|
|
30381
|
+
sql.exec(`
|
|
30382
|
+
CREATE TABLE sessions (
|
|
30383
|
+
id TEXT PRIMARY KEY NOT NULL,
|
|
30384
|
+
user_id TEXT NOT NULL,
|
|
30385
|
+
token_hash TEXT NOT NULL,
|
|
30386
|
+
expires_at INTEGER NOT NULL,
|
|
30387
|
+
created_at INTEGER DEFAULT (strftime('%s', 'now')),
|
|
30388
|
+
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
|
30389
|
+
)
|
|
30390
|
+
`);
|
|
30391
|
+
sql.exec(`INSERT INTO sessions SELECT * FROM sessions_0012_backup`);
|
|
30392
|
+
sql.exec(`CREATE INDEX idx_sessions_token_hash ON sessions(token_hash)`);
|
|
30393
|
+
sql.exec(`CREATE INDEX idx_sessions_user_id ON sessions(user_id)`);
|
|
30394
|
+
sql.exec(`CREATE INDEX idx_sessions_expires_at ON sessions(expires_at)`);
|
|
30395
|
+
sql.exec(`DROP TABLE oauth_accounts_0012_backup`);
|
|
30396
|
+
sql.exec(`DROP TABLE api_keys_0012_backup`);
|
|
30397
|
+
sql.exec(`DROP TABLE sessions_0012_backup`);
|
|
30398
|
+
sql.exec(`
|
|
30399
|
+
INSERT OR REPLACE INTO _metadata (key, value) VALUES ('schema_version', '12')
|
|
30400
|
+
`);
|
|
30401
|
+
}
|
|
30402
|
+
};
|
|
30403
|
+
|
|
30294
30404
|
// src/durable-objects/agentbuilder-migrations/index.ts
|
|
30295
|
-
var migrations2 = [migration35, migration36, migration37, migration38, migration39, migration40, migration41, migration42, migration43, migration44, migration45];
|
|
30296
|
-
var LATEST_SCHEMA_VERSION2 =
|
|
30405
|
+
var migrations2 = [migration35, migration36, migration37, migration38, migration39, migration40, migration41, migration42, migration43, migration44, migration45, migration46];
|
|
30406
|
+
var LATEST_SCHEMA_VERSION2 = 12;
|
|
30297
30407
|
|
|
30298
30408
|
// src/utils/crypto.ts
|
|
30299
30409
|
var CryptoUtil = class {
|
|
@@ -31055,9 +31165,9 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
|
|
|
31055
31165
|
}
|
|
31056
31166
|
}
|
|
31057
31167
|
async runMigrations(fromVersion) {
|
|
31058
|
-
for (const
|
|
31059
|
-
if (
|
|
31060
|
-
await
|
|
31168
|
+
for (const migration47 of migrations2) {
|
|
31169
|
+
if (migration47.version > fromVersion) {
|
|
31170
|
+
await migration47.up(this.ctx.storage.sql);
|
|
31061
31171
|
}
|
|
31062
31172
|
}
|
|
31063
31173
|
}
|
|
@@ -32412,7 +32522,7 @@ ${result ?? error ?? "No result content."}${attachmentSummary}`;
|
|
|
32412
32522
|
return cursor.toArray().map((row) => ({
|
|
32413
32523
|
id: row.id,
|
|
32414
32524
|
username: row.username,
|
|
32415
|
-
role: row.role === "user" ? "user" : "admin",
|
|
32525
|
+
role: row.role === "user" ? "user" : row.role === "api" ? "api" : "admin",
|
|
32416
32526
|
platform_user_id: row.platform_user_id ?? null,
|
|
32417
32527
|
email: row.email ?? null,
|
|
32418
32528
|
display_name: row.display_name ?? null,
|