@sentry/junior 0.169.0 → 0.171.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/{agent-hooks-YGKANST4.js → agent-hooks-UXIRPATC.js} +16 -11
- package/dist/api.js +33 -32
- package/dist/app.js +35 -35
- package/dist/catalog-runtime-PQCGQUXA.js +16 -0
- package/dist/chat/conversations/sql/store.d.ts +7 -0
- package/dist/chat/conversations/store.d.ts +14 -0
- package/dist/chat/sandbox/snapshot/store.d.ts +28 -0
- package/dist/chat/slack/channel.d.ts +0 -13
- package/dist/chat/slack/ids.d.ts +7 -1
- package/dist/chat/slack/tool-support/channel-target.d.ts +6 -5
- package/dist/chat/workspaces/store.d.ts +1 -10
- package/dist/chat/workspaces/types.d.ts +14 -1
- package/dist/{chunk-Q62IHFIH.js → chunk-2AYWP7PZ.js} +6 -270
- package/dist/{chunk-VRMPMOAT.js → chunk-3AX2WCFV.js} +2 -2
- package/dist/{chunk-OU2DMDUI.js → chunk-4TKPTFSO.js} +1 -1
- package/dist/{chunk-MKEHLCSM.js → chunk-5GF7HQOP.js} +70 -11
- package/dist/{chunk-S6JDUILF.js → chunk-5ML752HJ.js} +8 -8
- package/dist/{chunk-2VK3CYSL.js → chunk-5TZ2DKVU.js} +1 -1
- package/dist/{chunk-EEKFF74Y.js → chunk-62WK6FLT.js} +183 -69
- package/dist/{chunk-FSH6HT5C.js → chunk-6RRTVWAD.js} +1 -1
- package/dist/{chunk-7MA4HV4W.js → chunk-6ZWRNC4D.js} +1 -1
- package/dist/{chunk-ELOZI777.js → chunk-AOAOBZJQ.js} +18 -18
- package/dist/{chunk-BDUENQD3.js → chunk-CGA4ERJ5.js} +1 -1
- package/dist/chunk-CVHKLS7B.js +399 -0
- package/dist/{chunk-HWXQZCKV.js → chunk-CWTWZKWH.js} +7 -7
- package/dist/{chunk-23IKSW3E.js → chunk-FI5A2RF6.js} +1 -1
- package/dist/{chunk-FIMO3IDW.js → chunk-HKWEMKK4.js} +32 -4
- package/dist/{chunk-65QX23BY.js → chunk-HWXXFINO.js} +13 -13
- package/dist/{chunk-7RIHHVFN.js → chunk-IZSMYLCS.js} +11 -11
- package/dist/{chunk-URM4KBIU.js → chunk-JNYIJHFF.js} +1 -1
- package/dist/{chunk-JNK444WM.js → chunk-KUYIW4BD.js} +2 -2
- package/dist/{chunk-WYNLAO2K.js → chunk-M5QJJMFK.js} +4 -4
- package/dist/{chunk-V7YE4WCP.js → chunk-M63DETLL.js} +7 -4
- package/dist/{chunk-BOZCSRAR.js → chunk-MFFU45QO.js} +1 -1
- package/dist/{chunk-73XNLM4O.js → chunk-O2SUZKWU.js} +5 -5
- package/dist/{chunk-WF3WTELH.js → chunk-POF7HORW.js} +6 -6
- package/dist/{chunk-5Z7QQYHV.js → chunk-QHBHUCDS.js} +7 -7
- package/dist/{chunk-TMZOUVEP.js → chunk-SIOO3CCL.js} +1 -1
- package/dist/{chunk-MPLBAWGP.js → chunk-UC35XHGT.js} +2 -2
- package/dist/{chunk-VVQYG2GD.js → chunk-UTG3IY2C.js} +63 -100
- package/dist/{chunk-JJUZK6P2.js → chunk-VGWC4KG2.js} +5 -9
- package/dist/{chunk-YTVYU5IF.js → chunk-WCWPRFHZ.js} +1 -1
- package/dist/{chunk-ECBD46QI.js → chunk-WIUGVE66.js} +6 -6
- package/dist/{chunk-EPXPE5Y5.js → chunk-XHBYNJNZ.js} +2 -2
- package/dist/{chunk-ZXCVYSTS.js → chunk-Y5RRKS67.js} +5 -5
- package/dist/{chunk-5OUQCD2J.js → chunk-Y6DW6AVG.js} +1 -1
- package/dist/{chunk-N7V2WPZV.js → chunk-YURMXTZF.js} +1 -1
- package/dist/cli/chat.js +34 -34
- package/dist/cli/check.js +8 -8
- package/dist/cli/plugins.js +15 -15
- package/dist/cli/snapshot-create.js +14 -13
- package/dist/cli/upgrade.js +9 -9
- package/dist/db/schema/snapshots.d.ts +254 -0
- package/dist/db/schema/workspaces.d.ts +0 -68
- package/dist/db/schema.d.ts +251 -69
- package/dist/{db-CA3AJ2BU.js → db-EHCO5WGL.js} +8 -8
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-JVWWSDT5.js → oauth-callback-server-O7CH6FOJ.js} +25 -25
- package/dist/{runner-CMDQJDCH.js → runner-3D5AGGUD.js} +19 -15
- package/dist/{sandbox-egress-signals-U3ZX7C5W.js → sandbox-egress-signals-DXOOBSBI.js} +3 -3
- package/dist/{skills-GYJ4MBNQ.js → skills-6IW3DDW2.js} +8 -8
- package/dist/spawn-5LKOLABU.js +37 -0
- package/dist/{validation-55EBPZHH.js → validation-RCLP4EU4.js} +8 -8
- package/dist/version.js +1 -1
- package/dist/{work-N7CBTARL.js → work-L54N7O65.js} +21 -21
- package/dist/worker-VJCSXI5L.js +24 -0
- package/migrations/0032_workspace_snapshots_table.sql +69 -0
- package/migrations/meta/0032_snapshot.json +2892 -0
- package/migrations/meta/_journal.json +8 -1
- package/package.json +5 -5
- package/dist/catalog-runtime-BFDMFZV4.js +0 -16
- package/dist/chunk-BVREIWBD.js +0 -131
- package/dist/spawn-KSP4DKK6.js +0 -37
- package/dist/worker-CGMUVQ2Q.js +0 -24
|
@@ -2,37 +2,39 @@ import {
|
|
|
2
2
|
getConversationEventStore,
|
|
3
3
|
getDb,
|
|
4
4
|
getSqlExecutor
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HKWEMKK4.js";
|
|
6
6
|
import {
|
|
7
7
|
juniorConversationAnnotations,
|
|
8
8
|
juniorConversationEvents,
|
|
9
9
|
juniorIdentities,
|
|
10
|
+
juniorSnapshots,
|
|
10
11
|
juniorUsers,
|
|
11
12
|
juniorWorkspaceRepos,
|
|
12
13
|
juniorWorkspaces
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-5GF7HQOP.js";
|
|
14
15
|
import {
|
|
15
16
|
SANDBOX_WORKSPACE_ROOT,
|
|
17
|
+
hash,
|
|
16
18
|
runNonInteractiveCommand,
|
|
17
19
|
sleep
|
|
18
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-CVHKLS7B.js";
|
|
19
21
|
import {
|
|
20
22
|
getStateAdapter
|
|
21
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-YURMXTZF.js";
|
|
22
24
|
import {
|
|
23
25
|
botConfig,
|
|
24
26
|
completeObject,
|
|
25
27
|
embedTexts,
|
|
26
28
|
getSlackBotToken,
|
|
27
29
|
standardModelId
|
|
28
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-UC35XHGT.js";
|
|
29
31
|
import {
|
|
30
32
|
isActorUserId,
|
|
31
33
|
parseActorUserId,
|
|
32
34
|
parseSlackChannelReferenceId,
|
|
33
35
|
parseSlackMessageTs,
|
|
34
36
|
parseSlackTeamId
|
|
35
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-M63DETLL.js";
|
|
36
38
|
import {
|
|
37
39
|
logException,
|
|
38
40
|
logInfo,
|
|
@@ -41,7 +43,7 @@ import {
|
|
|
41
43
|
setSpanAttributes,
|
|
42
44
|
setSpanStatus,
|
|
43
45
|
withSpan
|
|
44
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-6RRTVWAD.js";
|
|
45
47
|
|
|
46
48
|
// src/chat/plugins/agent-hooks.ts
|
|
47
49
|
import {
|
|
@@ -1218,8 +1220,146 @@ function workspaceRepoCheckoutPath(repo) {
|
|
|
1218
1220
|
}
|
|
1219
1221
|
|
|
1220
1222
|
// src/chat/workspaces/store.ts
|
|
1223
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
1224
|
+
import { and as and5, asc as asc2, eq as eq5, sql as sql2 } from "drizzle-orm";
|
|
1225
|
+
|
|
1226
|
+
// src/chat/sandbox/snapshot/runtime.ts
|
|
1227
|
+
var SANDBOX_RUNTIME = "node22";
|
|
1228
|
+
|
|
1229
|
+
// src/chat/sandbox/snapshot/store.ts
|
|
1221
1230
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
1222
|
-
import { and as and4,
|
|
1231
|
+
import { and as and4, desc as desc2, eq as eq4, ne } from "drizzle-orm";
|
|
1232
|
+
function snapshotFromRow(row) {
|
|
1233
|
+
if (row.status !== "ready" || !row.snapshotId || !row.generatedAt || row.buildDurationMs == null) {
|
|
1234
|
+
throw new Error(`Invalid ready Workspace snapshot row: ${row.id}`);
|
|
1235
|
+
}
|
|
1236
|
+
return {
|
|
1237
|
+
id: row.snapshotId,
|
|
1238
|
+
generatedAt: row.generatedAt,
|
|
1239
|
+
buildDurationMs: row.buildDurationMs,
|
|
1240
|
+
profileHash: row.profileHash
|
|
1241
|
+
};
|
|
1242
|
+
}
|
|
1243
|
+
function snapshotBuildFromRow(row) {
|
|
1244
|
+
if (row.status === "ready" || !row.buildStartedAt || !row.buildPhase) {
|
|
1245
|
+
throw new Error(`Invalid Workspace snapshot build row: ${row.id}`);
|
|
1246
|
+
}
|
|
1247
|
+
return {
|
|
1248
|
+
status: row.status,
|
|
1249
|
+
phase: row.buildPhase,
|
|
1250
|
+
profileHash: row.profileHash,
|
|
1251
|
+
startedAt: row.buildStartedAt,
|
|
1252
|
+
sandboxName: row.buildSandboxName,
|
|
1253
|
+
commandId: row.buildCommandId,
|
|
1254
|
+
error: row.buildError
|
|
1255
|
+
};
|
|
1256
|
+
}
|
|
1257
|
+
async function loadSnapshotsForProfile(db, workspaceId, profileHash) {
|
|
1258
|
+
const profile = and4(
|
|
1259
|
+
eq4(juniorSnapshots.workspaceId, workspaceId),
|
|
1260
|
+
eq4(juniorSnapshots.profileHash, profileHash)
|
|
1261
|
+
);
|
|
1262
|
+
const order = [
|
|
1263
|
+
desc2(juniorSnapshots.updatedAt),
|
|
1264
|
+
desc2(juniorSnapshots.createdAt),
|
|
1265
|
+
desc2(juniorSnapshots.id)
|
|
1266
|
+
];
|
|
1267
|
+
const [readyRows, buildRows] = await Promise.all([
|
|
1268
|
+
db.select().from(juniorSnapshots).where(and4(profile, eq4(juniorSnapshots.status, "ready"))).orderBy(...order).limit(1),
|
|
1269
|
+
db.select().from(juniorSnapshots).where(and4(profile, ne(juniorSnapshots.status, "ready"))).orderBy(...order).limit(1)
|
|
1270
|
+
]);
|
|
1271
|
+
return {
|
|
1272
|
+
ready: readyRows[0] ? snapshotFromRow(readyRows[0]) : null,
|
|
1273
|
+
build: buildRows[0] ? snapshotBuildFromRow(buildRows[0]) : null
|
|
1274
|
+
};
|
|
1275
|
+
}
|
|
1276
|
+
async function clearNonReadySnapshots(db, workspaceId) {
|
|
1277
|
+
const deleted = await db.delete(juniorSnapshots).where(
|
|
1278
|
+
and4(
|
|
1279
|
+
eq4(juniorSnapshots.workspaceId, workspaceId),
|
|
1280
|
+
ne(juniorSnapshots.status, "ready")
|
|
1281
|
+
)
|
|
1282
|
+
).returning({
|
|
1283
|
+
sandboxName: juniorSnapshots.buildSandboxName
|
|
1284
|
+
});
|
|
1285
|
+
return deleted.map((row) => row.sandboxName).filter((name) => Boolean(name));
|
|
1286
|
+
}
|
|
1287
|
+
async function setWorkspaceSnapshot(workspaceId, snapshot) {
|
|
1288
|
+
const executor = getSqlExecutor();
|
|
1289
|
+
await executor.transaction(async () => {
|
|
1290
|
+
const db = executor.db();
|
|
1291
|
+
const workspaceRows = await db.select({ id: juniorWorkspaces.id }).from(juniorWorkspaces).where(eq4(juniorWorkspaces.id, workspaceId)).limit(1);
|
|
1292
|
+
if (!workspaceRows[0]) return;
|
|
1293
|
+
const now = /* @__PURE__ */ new Date();
|
|
1294
|
+
const existing = await db.select().from(juniorSnapshots).where(
|
|
1295
|
+
and4(
|
|
1296
|
+
eq4(juniorSnapshots.workspaceId, workspaceId),
|
|
1297
|
+
eq4(juniorSnapshots.profileHash, snapshot.profileHash)
|
|
1298
|
+
)
|
|
1299
|
+
).orderBy(desc2(juniorSnapshots.updatedAt), desc2(juniorSnapshots.createdAt)).limit(1);
|
|
1300
|
+
const current = existing[0];
|
|
1301
|
+
if (current && current.status !== "ready") {
|
|
1302
|
+
await db.update(juniorSnapshots).set({
|
|
1303
|
+
status: "ready",
|
|
1304
|
+
snapshotId: snapshot.id,
|
|
1305
|
+
buildDurationMs: snapshot.buildDurationMs,
|
|
1306
|
+
generatedAt: snapshot.generatedAt,
|
|
1307
|
+
buildStartedAt: null,
|
|
1308
|
+
buildPhase: null,
|
|
1309
|
+
buildSandboxName: null,
|
|
1310
|
+
buildCommandId: null,
|
|
1311
|
+
buildError: null,
|
|
1312
|
+
updatedAt: now
|
|
1313
|
+
}).where(eq4(juniorSnapshots.id, current.id));
|
|
1314
|
+
return;
|
|
1315
|
+
}
|
|
1316
|
+
if (current && current.status === "ready" && current.snapshotId === snapshot.id) {
|
|
1317
|
+
await db.update(juniorSnapshots).set({
|
|
1318
|
+
buildDurationMs: snapshot.buildDurationMs,
|
|
1319
|
+
generatedAt: snapshot.generatedAt,
|
|
1320
|
+
buildStartedAt: null,
|
|
1321
|
+
buildPhase: null,
|
|
1322
|
+
buildSandboxName: null,
|
|
1323
|
+
buildCommandId: null,
|
|
1324
|
+
buildError: null,
|
|
1325
|
+
updatedAt: now
|
|
1326
|
+
}).where(eq4(juniorSnapshots.id, current.id));
|
|
1327
|
+
return;
|
|
1328
|
+
}
|
|
1329
|
+
await db.insert(juniorSnapshots).values({
|
|
1330
|
+
id: randomUUID2(),
|
|
1331
|
+
workspaceId,
|
|
1332
|
+
profileHash: snapshot.profileHash,
|
|
1333
|
+
status: "ready",
|
|
1334
|
+
snapshotId: snapshot.id,
|
|
1335
|
+
buildDurationMs: snapshot.buildDurationMs,
|
|
1336
|
+
generatedAt: snapshot.generatedAt,
|
|
1337
|
+
buildStartedAt: null,
|
|
1338
|
+
buildSandboxName: null,
|
|
1339
|
+
buildCommandId: null,
|
|
1340
|
+
buildError: null,
|
|
1341
|
+
createdAt: now,
|
|
1342
|
+
updatedAt: now
|
|
1343
|
+
});
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
async function recordResolvedWorkspaceSnapshot(workspaceId, snapshot) {
|
|
1347
|
+
if (!snapshot.snapshotId || !snapshot.profileHash || snapshot.createdAtMs == null || snapshot.buildDurationMs == null) {
|
|
1348
|
+
return;
|
|
1349
|
+
}
|
|
1350
|
+
try {
|
|
1351
|
+
await setWorkspaceSnapshot(workspaceId, {
|
|
1352
|
+
id: snapshot.snapshotId,
|
|
1353
|
+
generatedAt: new Date(snapshot.createdAtMs),
|
|
1354
|
+
buildDurationMs: snapshot.buildDurationMs,
|
|
1355
|
+
profileHash: snapshot.profileHash
|
|
1356
|
+
});
|
|
1357
|
+
} catch (error) {
|
|
1358
|
+
logException(error, "sandbox.workspace_snapshot.persist.failed", {
|
|
1359
|
+
"app.workspace.id": workspaceId
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1223
1363
|
|
|
1224
1364
|
// src/chat/workspaces/validation.ts
|
|
1225
1365
|
var WORKSPACE_NAME_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;
|
|
@@ -1305,18 +1445,7 @@ function normalizeWorkspaceRecipe(input) {
|
|
|
1305
1445
|
}
|
|
1306
1446
|
|
|
1307
1447
|
// src/chat/workspaces/store.ts
|
|
1308
|
-
function
|
|
1309
|
-
if (!row.snapshotId || !row.snapshotGeneratedAt || row.snapshotBuildDurationMs == null || !row.snapshotProfileHash) {
|
|
1310
|
-
return null;
|
|
1311
|
-
}
|
|
1312
|
-
return {
|
|
1313
|
-
id: row.snapshotId,
|
|
1314
|
-
generatedAt: row.snapshotGeneratedAt,
|
|
1315
|
-
buildDurationMs: row.snapshotBuildDurationMs,
|
|
1316
|
-
profileHash: row.snapshotProfileHash
|
|
1317
|
-
};
|
|
1318
|
-
}
|
|
1319
|
-
function workspaceFromRows(row, repos) {
|
|
1448
|
+
function workspaceFromRows(row, repos, snapshot) {
|
|
1320
1449
|
return {
|
|
1321
1450
|
id: row.id,
|
|
1322
1451
|
name: row.name,
|
|
@@ -1325,17 +1454,28 @@ function workspaceFromRows(row, repos) {
|
|
|
1325
1454
|
provider: repo.provider,
|
|
1326
1455
|
repo: repo.repo
|
|
1327
1456
|
})),
|
|
1328
|
-
snapshot
|
|
1457
|
+
snapshot
|
|
1329
1458
|
};
|
|
1330
1459
|
}
|
|
1460
|
+
async function workspaceWithSnapshot(db, row, repos) {
|
|
1461
|
+
const workspace = workspaceFromRows(row, repos, null);
|
|
1462
|
+
const profileHash = hash(SANDBOX_RUNTIME, workspace);
|
|
1463
|
+
if (!profileHash) return workspace;
|
|
1464
|
+
const snapshots = await loadSnapshotsForProfile(
|
|
1465
|
+
db,
|
|
1466
|
+
workspace.id,
|
|
1467
|
+
profileHash
|
|
1468
|
+
);
|
|
1469
|
+
return { ...workspace, snapshot: snapshots.ready };
|
|
1470
|
+
}
|
|
1331
1471
|
async function loadWorkspaceRepos(db, workspaceId) {
|
|
1332
|
-
return await db.select().from(juniorWorkspaceRepos).where(
|
|
1472
|
+
return await db.select().from(juniorWorkspaceRepos).where(eq5(juniorWorkspaceRepos.workspaceId, workspaceId)).orderBy(
|
|
1333
1473
|
asc2(juniorWorkspaceRepos.provider),
|
|
1334
1474
|
asc2(juniorWorkspaceRepos.repo)
|
|
1335
1475
|
);
|
|
1336
1476
|
}
|
|
1337
1477
|
async function replaceWorkspaceRepos(db, workspaceId, repos) {
|
|
1338
|
-
await db.delete(juniorWorkspaceRepos).where(
|
|
1478
|
+
await db.delete(juniorWorkspaceRepos).where(eq5(juniorWorkspaceRepos.workspaceId, workspaceId));
|
|
1339
1479
|
if (repos.length === 0) return;
|
|
1340
1480
|
await db.insert(juniorWorkspaceRepos).values(
|
|
1341
1481
|
repos.map((repo) => ({
|
|
@@ -1374,7 +1514,8 @@ async function listWorkspaces(db) {
|
|
|
1374
1514
|
return workspaces.map(
|
|
1375
1515
|
(workspace) => workspaceFromRows(
|
|
1376
1516
|
workspace,
|
|
1377
|
-
repos.filter((repo) => repo.workspaceId === workspace.id)
|
|
1517
|
+
repos.filter((repo) => repo.workspaceId === workspace.id),
|
|
1518
|
+
null
|
|
1378
1519
|
)
|
|
1379
1520
|
);
|
|
1380
1521
|
}
|
|
@@ -1383,10 +1524,10 @@ async function listWorkspaceNamesByRepository(db, input) {
|
|
|
1383
1524
|
const repo = input.repo.trim();
|
|
1384
1525
|
const rows = await db.select({ name: juniorWorkspaces.name }).from(juniorWorkspaceRepos).innerJoin(
|
|
1385
1526
|
juniorWorkspaces,
|
|
1386
|
-
|
|
1527
|
+
eq5(juniorWorkspaces.id, juniorWorkspaceRepos.workspaceId)
|
|
1387
1528
|
).where(
|
|
1388
|
-
|
|
1389
|
-
|
|
1529
|
+
and5(
|
|
1530
|
+
eq5(juniorWorkspaceRepos.provider, provider),
|
|
1390
1531
|
// Recipes store the provided repo casing; identity is case-insensitive.
|
|
1391
1532
|
sql2`lower(${juniorWorkspaceRepos.repo}) = lower(${repo})`
|
|
1392
1533
|
)
|
|
@@ -1394,19 +1535,21 @@ async function listWorkspaceNamesByRepository(db, input) {
|
|
|
1394
1535
|
return rows.map((row) => row.name);
|
|
1395
1536
|
}
|
|
1396
1537
|
async function getWorkspaceByName(db, name) {
|
|
1397
|
-
const rows = await db.select().from(juniorWorkspaces).where(
|
|
1538
|
+
const rows = await db.select().from(juniorWorkspaces).where(eq5(juniorWorkspaces.name, name)).limit(1);
|
|
1398
1539
|
const workspace = rows[0];
|
|
1399
1540
|
if (!workspace) return void 0;
|
|
1400
|
-
return
|
|
1541
|
+
return await workspaceWithSnapshot(
|
|
1542
|
+
db,
|
|
1401
1543
|
workspace,
|
|
1402
1544
|
await loadWorkspaceRepos(db, workspace.id)
|
|
1403
1545
|
);
|
|
1404
1546
|
}
|
|
1405
1547
|
async function getWorkspace(db, id) {
|
|
1406
|
-
const rows = await db.select().from(juniorWorkspaces).where(
|
|
1548
|
+
const rows = await db.select().from(juniorWorkspaces).where(eq5(juniorWorkspaces.id, id)).limit(1);
|
|
1407
1549
|
const workspace = rows[0];
|
|
1408
1550
|
if (!workspace) return void 0;
|
|
1409
|
-
return
|
|
1551
|
+
return await workspaceWithSnapshot(
|
|
1552
|
+
db,
|
|
1410
1553
|
workspace,
|
|
1411
1554
|
await loadWorkspaceRepos(db, workspace.id)
|
|
1412
1555
|
);
|
|
@@ -1415,7 +1558,7 @@ async function createWorkspace(input) {
|
|
|
1415
1558
|
const recipe = normalizeWorkspaceRecipe(input);
|
|
1416
1559
|
const executor = getSqlExecutor();
|
|
1417
1560
|
const now = /* @__PURE__ */ new Date();
|
|
1418
|
-
const id =
|
|
1561
|
+
const id = randomUUID3();
|
|
1419
1562
|
try {
|
|
1420
1563
|
await executor.transaction(async () => {
|
|
1421
1564
|
const db = executor.db();
|
|
@@ -1445,7 +1588,7 @@ async function updateWorkspace(id, input) {
|
|
|
1445
1588
|
try {
|
|
1446
1589
|
const updated = await executor.transaction(async () => {
|
|
1447
1590
|
const db = executor.db();
|
|
1448
|
-
const existingRows = await db.select().from(juniorWorkspaces).where(
|
|
1591
|
+
const existingRows = await db.select().from(juniorWorkspaces).where(eq5(juniorWorkspaces.id, id)).limit(1);
|
|
1449
1592
|
const existing = existingRows[0];
|
|
1450
1593
|
if (!existing) return void 0;
|
|
1451
1594
|
const existingRepos = await loadWorkspaceRepos(db, id);
|
|
@@ -1453,15 +1596,12 @@ async function updateWorkspace(id, input) {
|
|
|
1453
1596
|
const rows = await db.update(juniorWorkspaces).set({
|
|
1454
1597
|
name: recipe.name,
|
|
1455
1598
|
setupScript: recipe.setupScript,
|
|
1456
|
-
...snapshotChanged ? {
|
|
1457
|
-
snapshotId: null,
|
|
1458
|
-
snapshotGeneratedAt: null,
|
|
1459
|
-
snapshotBuildDurationMs: null,
|
|
1460
|
-
snapshotProfileHash: null
|
|
1461
|
-
} : {},
|
|
1462
1599
|
updatedAt: now
|
|
1463
|
-
}).where(
|
|
1600
|
+
}).where(eq5(juniorWorkspaces.id, id)).returning();
|
|
1464
1601
|
await replaceWorkspaceRepos(db, id, recipe.repos);
|
|
1602
|
+
if (snapshotChanged) {
|
|
1603
|
+
await clearNonReadySnapshots(db, id);
|
|
1604
|
+
}
|
|
1465
1605
|
return rows[0];
|
|
1466
1606
|
});
|
|
1467
1607
|
if (!updated) return void 0;
|
|
@@ -1478,37 +1618,10 @@ async function updateWorkspace(id, input) {
|
|
|
1478
1618
|
async function deleteWorkspace(id) {
|
|
1479
1619
|
const executor = getSqlExecutor();
|
|
1480
1620
|
return await executor.transaction(async () => {
|
|
1481
|
-
const rows = await executor.db().delete(juniorWorkspaces).where(
|
|
1621
|
+
const rows = await executor.db().delete(juniorWorkspaces).where(eq5(juniorWorkspaces.id, id)).returning({ id: juniorWorkspaces.id });
|
|
1482
1622
|
return rows.length > 0;
|
|
1483
1623
|
});
|
|
1484
1624
|
}
|
|
1485
|
-
async function setWorkspaceSnapshot(workspaceId, snapshot) {
|
|
1486
|
-
const executor = getSqlExecutor();
|
|
1487
|
-
await executor.db().update(juniorWorkspaces).set({
|
|
1488
|
-
snapshotId: snapshot.id,
|
|
1489
|
-
snapshotGeneratedAt: snapshot.generatedAt,
|
|
1490
|
-
snapshotBuildDurationMs: snapshot.buildDurationMs,
|
|
1491
|
-
snapshotProfileHash: snapshot.profileHash,
|
|
1492
|
-
updatedAt: /* @__PURE__ */ new Date()
|
|
1493
|
-
}).where(eq4(juniorWorkspaces.id, workspaceId));
|
|
1494
|
-
}
|
|
1495
|
-
async function recordResolvedWorkspaceSnapshot(workspaceId, snapshot) {
|
|
1496
|
-
if (!snapshot.snapshotId || !snapshot.profileHash || snapshot.createdAtMs == null || snapshot.buildDurationMs == null) {
|
|
1497
|
-
return;
|
|
1498
|
-
}
|
|
1499
|
-
try {
|
|
1500
|
-
await setWorkspaceSnapshot(workspaceId, {
|
|
1501
|
-
id: snapshot.snapshotId,
|
|
1502
|
-
generatedAt: new Date(snapshot.createdAtMs),
|
|
1503
|
-
buildDurationMs: snapshot.buildDurationMs,
|
|
1504
|
-
profileHash: snapshot.profileHash
|
|
1505
|
-
});
|
|
1506
|
-
} catch (error) {
|
|
1507
|
-
logException(error, "sandbox.workspace_snapshot.persist.failed", {
|
|
1508
|
-
"app.workspace.id": workspaceId
|
|
1509
|
-
});
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
1625
|
|
|
1513
1626
|
// src/chat/plugins/agent-hooks.ts
|
|
1514
1627
|
var PluginHookDeniedError = class extends Error {
|
|
@@ -2734,6 +2847,8 @@ export {
|
|
|
2734
2847
|
resolveChannelCapabilities,
|
|
2735
2848
|
tryWorkspaceRepoCheckoutPath,
|
|
2736
2849
|
workspaceRepoCheckoutPath,
|
|
2850
|
+
SANDBOX_RUNTIME,
|
|
2851
|
+
recordResolvedWorkspaceSnapshot,
|
|
2737
2852
|
WorkspaceValidationError,
|
|
2738
2853
|
listWorkspaces,
|
|
2739
2854
|
getWorkspaceByName,
|
|
@@ -2741,7 +2856,6 @@ export {
|
|
|
2741
2856
|
createWorkspace,
|
|
2742
2857
|
updateWorkspace,
|
|
2743
2858
|
deleteWorkspace,
|
|
2744
|
-
recordResolvedWorkspaceSnapshot,
|
|
2745
2859
|
PluginHookDeniedError,
|
|
2746
2860
|
validatePlugins,
|
|
2747
2861
|
setPlugins,
|
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
} from "./chunk-FA6POGLH.js";
|
|
4
4
|
import {
|
|
5
5
|
getTurnRequestDeadline
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4TKPTFSO.js";
|
|
7
7
|
import {
|
|
8
8
|
buildSentryConversationUrl,
|
|
9
9
|
deleteWebAuthorization
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MFFU45QO.js";
|
|
11
11
|
import {
|
|
12
12
|
ensureConversationWake,
|
|
13
13
|
requestConversationWork
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-Y5RRKS67.js";
|
|
15
15
|
import {
|
|
16
16
|
buildDeliveredTurnStatePatch,
|
|
17
17
|
finalizeFailedTurnReplyWithEvent,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
requireTurnFailureEventId,
|
|
25
25
|
resolveTurnSessionRouting,
|
|
26
26
|
scheduleSessionCompletedPluginTasks
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-IZSMYLCS.js";
|
|
28
28
|
import {
|
|
29
29
|
ConversationTurnLifecycleService,
|
|
30
30
|
coerceThreadConversationState,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
getPersistedSandboxState,
|
|
34
34
|
getPersistedThreadState,
|
|
35
35
|
persistThreadStateById
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-O2SUZKWU.js";
|
|
37
37
|
import {
|
|
38
38
|
getVercelConversationWorkQueue
|
|
39
39
|
} from "./chunk-WR76IVA5.js";
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
lookupSlackUserProfile,
|
|
48
48
|
resolvePluginOAuthAccount,
|
|
49
49
|
runAgentWithTimeout
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-5ML752HJ.js";
|
|
51
51
|
import {
|
|
52
52
|
RetryableDeliveryError
|
|
53
53
|
} from "./chunk-RF6J3DIO.js";
|
|
@@ -63,13 +63,13 @@ import {
|
|
|
63
63
|
removeReactionFromMessage,
|
|
64
64
|
resolveBaseUrl,
|
|
65
65
|
truncateStatusText
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-CWTWZKWH.js";
|
|
67
67
|
import {
|
|
68
68
|
parseSlackThreadId,
|
|
69
69
|
readSlackRawMessageContext,
|
|
70
70
|
resolveSlackChannelIdFromMessage,
|
|
71
71
|
resolveSlackChannelIdFromThreadId
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-XHBYNJNZ.js";
|
|
73
73
|
import {
|
|
74
74
|
CooperativeTurnYieldError,
|
|
75
75
|
TurnSliceLimitExceededError,
|
|
@@ -96,7 +96,7 @@ import {
|
|
|
96
96
|
recordTurnSummary,
|
|
97
97
|
saveTurnCheckpoint,
|
|
98
98
|
turnHasReply
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-WIUGVE66.js";
|
|
100
100
|
import {
|
|
101
101
|
SlackActionError,
|
|
102
102
|
getDashboardConversationLink,
|
|
@@ -105,18 +105,18 @@ import {
|
|
|
105
105
|
getSlackClient,
|
|
106
106
|
isDmChannel,
|
|
107
107
|
normalizeSlackConversationId
|
|
108
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-62WK6FLT.js";
|
|
109
109
|
import {
|
|
110
110
|
getConversationEventStore,
|
|
111
111
|
getSqlExecutor,
|
|
112
112
|
requireSlackDestination,
|
|
113
113
|
upsertIdentity,
|
|
114
114
|
upsertLinkedIdentity
|
|
115
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-HKWEMKK4.js";
|
|
116
116
|
import {
|
|
117
117
|
acquireActiveLock,
|
|
118
118
|
getStateAdapter
|
|
119
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-YURMXTZF.js";
|
|
120
120
|
import {
|
|
121
121
|
botConfig,
|
|
122
122
|
escapeXml,
|
|
@@ -124,24 +124,24 @@ import {
|
|
|
124
124
|
getRuntimeMetadata,
|
|
125
125
|
normalizeSlackEmojiName,
|
|
126
126
|
standardModelId
|
|
127
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-UC35XHGT.js";
|
|
128
128
|
import {
|
|
129
129
|
discoverSkills
|
|
130
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-3AX2WCFV.js";
|
|
131
131
|
import {
|
|
132
132
|
pluginCatalogRuntime
|
|
133
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-SIOO3CCL.js";
|
|
134
134
|
import {
|
|
135
135
|
buildOAuthTokenRequest,
|
|
136
136
|
hasRequiredOAuthScope,
|
|
137
137
|
parseOAuthTokenResponse
|
|
138
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-KUYIW4BD.js";
|
|
139
139
|
import {
|
|
140
140
|
createSlackResumeActor,
|
|
141
141
|
isUserActor,
|
|
142
142
|
parseSlackMessageTs,
|
|
143
143
|
parseSlackUserId
|
|
144
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-M63DETLL.js";
|
|
145
145
|
import {
|
|
146
146
|
buildTurnFailureResponse,
|
|
147
147
|
logException,
|
|
@@ -151,7 +151,7 @@ import {
|
|
|
151
151
|
setTags,
|
|
152
152
|
toOptionalString,
|
|
153
153
|
withLogContext
|
|
154
|
-
} from "./chunk-
|
|
154
|
+
} from "./chunk-6RRTVWAD.js";
|
|
155
155
|
import {
|
|
156
156
|
homeDir
|
|
157
157
|
} from "./chunk-H4HBKISO.js";
|