swarm-mail 0.2.1 → 0.3.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/{beads → hive}/adapter.d.ts +10 -10
- package/dist/hive/adapter.d.ts.map +1 -0
- package/dist/{beads → hive}/blocked-cache.d.ts +1 -1
- package/dist/hive/blocked-cache.d.ts.map +1 -0
- package/dist/{beads → hive}/comments.d.ts +3 -3
- package/dist/hive/comments.d.ts.map +1 -0
- package/dist/{beads → hive}/dependencies.d.ts +6 -6
- package/dist/hive/dependencies.d.ts.map +1 -0
- package/dist/hive/events.d.ts +163 -0
- package/dist/hive/events.d.ts.map +1 -0
- package/dist/{beads → hive}/flush-manager.d.ts +3 -3
- package/dist/hive/flush-manager.d.ts.map +1 -0
- package/dist/hive/index.d.ts +26 -0
- package/dist/hive/index.d.ts.map +1 -0
- package/dist/{beads → hive}/jsonl.d.ts +14 -14
- package/dist/hive/jsonl.d.ts.map +1 -0
- package/dist/{beads → hive}/labels.d.ts +2 -2
- package/dist/hive/labels.d.ts.map +1 -0
- package/dist/{beads → hive}/merge.d.ts +5 -5
- package/dist/hive/merge.d.ts.map +1 -0
- package/dist/hive/migrations.d.ts.map +1 -0
- package/dist/hive/operations.d.ts +56 -0
- package/dist/hive/operations.d.ts.map +1 -0
- package/dist/{beads → hive}/projections.d.ts +19 -19
- package/dist/hive/projections.d.ts.map +1 -0
- package/dist/{beads → hive}/queries.d.ts +10 -10
- package/dist/hive/queries.d.ts.map +1 -0
- package/dist/{beads → hive}/store.d.ts +9 -9
- package/dist/hive/store.d.ts.map +1 -0
- package/dist/{beads → hive}/validation.d.ts +7 -7
- package/dist/hive/validation.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +379 -378
- package/dist/types/{beads-adapter.d.ts → hive-adapter.d.ts} +155 -103
- package/dist/types/hive-adapter.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/beads/adapter.d.ts.map +0 -1
- package/dist/beads/blocked-cache.d.ts.map +0 -1
- package/dist/beads/comments.d.ts.map +0 -1
- package/dist/beads/dependencies.d.ts.map +0 -1
- package/dist/beads/events.d.ts +0 -163
- package/dist/beads/events.d.ts.map +0 -1
- package/dist/beads/flush-manager.d.ts.map +0 -1
- package/dist/beads/index.d.ts +0 -25
- package/dist/beads/index.d.ts.map +0 -1
- package/dist/beads/jsonl.d.ts.map +0 -1
- package/dist/beads/labels.d.ts.map +0 -1
- package/dist/beads/merge.d.ts.map +0 -1
- package/dist/beads/migrations.d.ts.map +0 -1
- package/dist/beads/operations.d.ts +0 -56
- package/dist/beads/operations.d.ts.map +0 -1
- package/dist/beads/projections.d.ts.map +0 -1
- package/dist/beads/queries.d.ts.map +0 -1
- package/dist/beads/store.d.ts.map +0 -1
- package/dist/beads/validation.d.ts.map +0 -1
- package/dist/types/beads-adapter.d.ts.map +0 -1
- /package/dist/{beads → hive}/migrations.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -18229,7 +18229,7 @@ var init_store = __esm(() => {
|
|
|
18229
18229
|
TIMESTAMP_SAFE_UNTIL = new Date("2286-01-01").getTime();
|
|
18230
18230
|
});
|
|
18231
18231
|
|
|
18232
|
-
// src/
|
|
18232
|
+
// src/hive/dependencies.ts
|
|
18233
18233
|
var exports_dependencies = {};
|
|
18234
18234
|
__export(exports_dependencies, {
|
|
18235
18235
|
wouldCreateCycle: () => wouldCreateCycle,
|
|
@@ -18238,82 +18238,82 @@ __export(exports_dependencies, {
|
|
|
18238
18238
|
invalidateBlockedCache: () => invalidateBlockedCache,
|
|
18239
18239
|
getOpenBlockers: () => getOpenBlockers
|
|
18240
18240
|
});
|
|
18241
|
-
async function wouldCreateCycle(db,
|
|
18241
|
+
async function wouldCreateCycle(db, cellId, dependsOnId) {
|
|
18242
18242
|
const result = await db.query(`WITH RECURSIVE paths AS (
|
|
18243
18243
|
-- Start from the target (what we want to depend on)
|
|
18244
18244
|
SELECT
|
|
18245
|
-
|
|
18245
|
+
cell_id,
|
|
18246
18246
|
depends_on_id,
|
|
18247
18247
|
1 as depth
|
|
18248
18248
|
FROM bead_dependencies
|
|
18249
|
-
WHERE
|
|
18249
|
+
WHERE cell_id = $2
|
|
18250
18250
|
|
|
18251
18251
|
UNION
|
|
18252
18252
|
|
|
18253
18253
|
-- Follow dependencies transitively
|
|
18254
18254
|
SELECT
|
|
18255
|
-
bd.
|
|
18255
|
+
bd.cell_id,
|
|
18256
18256
|
bd.depends_on_id,
|
|
18257
18257
|
p.depth + 1
|
|
18258
18258
|
FROM bead_dependencies bd
|
|
18259
|
-
JOIN paths p ON bd.
|
|
18259
|
+
JOIN paths p ON bd.cell_id = p.depends_on_id
|
|
18260
18260
|
WHERE p.depth < $3
|
|
18261
18261
|
)
|
|
18262
18262
|
SELECT EXISTS(
|
|
18263
18263
|
SELECT 1 FROM paths WHERE depends_on_id = $1
|
|
18264
|
-
) as exists`, [
|
|
18264
|
+
) as exists`, [cellId, dependsOnId, MAX_DEPENDENCY_DEPTH]);
|
|
18265
18265
|
return result.rows[0]?.exists ?? false;
|
|
18266
18266
|
}
|
|
18267
|
-
async function getOpenBlockers(db, projectKey,
|
|
18267
|
+
async function getOpenBlockers(db, projectKey, cellId) {
|
|
18268
18268
|
const result = await db.query(`WITH RECURSIVE blockers AS (
|
|
18269
18269
|
-- Direct blockers
|
|
18270
18270
|
SELECT depends_on_id as blocker_id, 1 as depth
|
|
18271
18271
|
FROM bead_dependencies
|
|
18272
|
-
WHERE
|
|
18272
|
+
WHERE cell_id = $1 AND relationship = 'blocks'
|
|
18273
18273
|
|
|
18274
18274
|
UNION
|
|
18275
18275
|
|
|
18276
18276
|
-- Transitive blockers
|
|
18277
18277
|
SELECT bd.depends_on_id, b.depth + 1
|
|
18278
18278
|
FROM bead_dependencies bd
|
|
18279
|
-
JOIN blockers b ON bd.
|
|
18279
|
+
JOIN blockers b ON bd.cell_id = b.blocker_id
|
|
18280
18280
|
WHERE bd.relationship = 'blocks' AND b.depth < $3
|
|
18281
18281
|
)
|
|
18282
18282
|
SELECT DISTINCT b.blocker_id
|
|
18283
18283
|
FROM blockers b
|
|
18284
18284
|
JOIN beads bead ON b.blocker_id = bead.id
|
|
18285
|
-
WHERE bead.project_key = $2 AND bead.status != 'closed' AND bead.deleted_at IS NULL`, [
|
|
18285
|
+
WHERE bead.project_key = $2 AND bead.status != 'closed' AND bead.deleted_at IS NULL`, [cellId, projectKey, MAX_DEPENDENCY_DEPTH]);
|
|
18286
18286
|
return result.rows.map((r) => r.blocker_id);
|
|
18287
18287
|
}
|
|
18288
|
-
async function rebuildBeadBlockedCache(db, projectKey,
|
|
18289
|
-
const blockerIds = await getOpenBlockers(db, projectKey,
|
|
18288
|
+
async function rebuildBeadBlockedCache(db, projectKey, cellId) {
|
|
18289
|
+
const blockerIds = await getOpenBlockers(db, projectKey, cellId);
|
|
18290
18290
|
if (blockerIds.length > 0) {
|
|
18291
|
-
await db.query(`INSERT INTO blocked_beads_cache (
|
|
18291
|
+
await db.query(`INSERT INTO blocked_beads_cache (cell_id, blocker_ids, updated_at)
|
|
18292
18292
|
VALUES ($1, $2, $3)
|
|
18293
|
-
ON CONFLICT (
|
|
18294
|
-
DO UPDATE SET blocker_ids = $2, updated_at = $3`, [
|
|
18293
|
+
ON CONFLICT (cell_id)
|
|
18294
|
+
DO UPDATE SET blocker_ids = $2, updated_at = $3`, [cellId, blockerIds, Date.now()]);
|
|
18295
18295
|
} else {
|
|
18296
|
-
await db.query(`DELETE FROM blocked_beads_cache WHERE
|
|
18296
|
+
await db.query(`DELETE FROM blocked_beads_cache WHERE cell_id = $1`, [cellId]);
|
|
18297
18297
|
}
|
|
18298
18298
|
}
|
|
18299
18299
|
async function rebuildAllBlockedCaches(db, projectKey) {
|
|
18300
18300
|
const result = await db.query(`SELECT DISTINCT b.id FROM beads b
|
|
18301
|
-
JOIN bead_dependencies bd ON b.id = bd.
|
|
18301
|
+
JOIN bead_dependencies bd ON b.id = bd.cell_id
|
|
18302
18302
|
WHERE b.project_key = $1 AND bd.relationship = 'blocks' AND b.deleted_at IS NULL`, [projectKey]);
|
|
18303
18303
|
for (const row of result.rows) {
|
|
18304
18304
|
await rebuildBeadBlockedCache(db, projectKey, row.id);
|
|
18305
18305
|
}
|
|
18306
18306
|
}
|
|
18307
|
-
async function invalidateBlockedCache(db, projectKey,
|
|
18308
|
-
await rebuildBeadBlockedCache(db, projectKey,
|
|
18309
|
-
const dependents = await db.query(`SELECT
|
|
18307
|
+
async function invalidateBlockedCache(db, projectKey, cellId) {
|
|
18308
|
+
await rebuildBeadBlockedCache(db, projectKey, cellId);
|
|
18309
|
+
const dependents = await db.query(`SELECT cell_id FROM bead_dependencies WHERE depends_on_id = $1`, [cellId]);
|
|
18310
18310
|
for (const row of dependents.rows) {
|
|
18311
|
-
await rebuildBeadBlockedCache(db, projectKey, row.
|
|
18311
|
+
await rebuildBeadBlockedCache(db, projectKey, row.cell_id);
|
|
18312
18312
|
}
|
|
18313
18313
|
}
|
|
18314
18314
|
var MAX_DEPENDENCY_DEPTH = 100;
|
|
18315
18315
|
|
|
18316
|
-
// src/
|
|
18316
|
+
// src/hive/migrations.ts
|
|
18317
18317
|
var exports_migrations2 = {};
|
|
18318
18318
|
__export(exports_migrations2, {
|
|
18319
18319
|
beadsMigrations: () => beadsMigrations,
|
|
@@ -18363,15 +18363,15 @@ var init_migrations2 = __esm(() => {
|
|
|
18363
18363
|
-- Dependencies Table
|
|
18364
18364
|
-- ========================================================================
|
|
18365
18365
|
CREATE TABLE IF NOT EXISTS bead_dependencies (
|
|
18366
|
-
|
|
18366
|
+
cell_id TEXT NOT NULL REFERENCES beads(id) ON DELETE CASCADE,
|
|
18367
18367
|
depends_on_id TEXT NOT NULL REFERENCES beads(id) ON DELETE CASCADE,
|
|
18368
18368
|
relationship TEXT NOT NULL CHECK (relationship IN ('blocks', 'related', 'parent-child', 'discovered-from', 'replies-to', 'relates-to', 'duplicates', 'supersedes')),
|
|
18369
18369
|
created_at BIGINT NOT NULL,
|
|
18370
18370
|
created_by TEXT,
|
|
18371
|
-
PRIMARY KEY (
|
|
18371
|
+
PRIMARY KEY (cell_id, depends_on_id, relationship)
|
|
18372
18372
|
);
|
|
18373
18373
|
|
|
18374
|
-
CREATE INDEX IF NOT EXISTS idx_bead_deps_bead ON bead_dependencies(
|
|
18374
|
+
CREATE INDEX IF NOT EXISTS idx_bead_deps_bead ON bead_dependencies(cell_id);
|
|
18375
18375
|
CREATE INDEX IF NOT EXISTS idx_bead_deps_depends_on ON bead_dependencies(depends_on_id);
|
|
18376
18376
|
CREATE INDEX IF NOT EXISTS idx_bead_deps_relationship ON bead_dependencies(relationship);
|
|
18377
18377
|
|
|
@@ -18379,10 +18379,10 @@ var init_migrations2 = __esm(() => {
|
|
|
18379
18379
|
-- Labels Table
|
|
18380
18380
|
-- ========================================================================
|
|
18381
18381
|
CREATE TABLE IF NOT EXISTS bead_labels (
|
|
18382
|
-
|
|
18382
|
+
cell_id TEXT NOT NULL REFERENCES beads(id) ON DELETE CASCADE,
|
|
18383
18383
|
label TEXT NOT NULL,
|
|
18384
18384
|
created_at BIGINT NOT NULL,
|
|
18385
|
-
PRIMARY KEY (
|
|
18385
|
+
PRIMARY KEY (cell_id, label)
|
|
18386
18386
|
);
|
|
18387
18387
|
|
|
18388
18388
|
CREATE INDEX IF NOT EXISTS idx_bead_labels_label ON bead_labels(label);
|
|
@@ -18392,7 +18392,7 @@ var init_migrations2 = __esm(() => {
|
|
|
18392
18392
|
-- ========================================================================
|
|
18393
18393
|
CREATE TABLE IF NOT EXISTS bead_comments (
|
|
18394
18394
|
id SERIAL PRIMARY KEY,
|
|
18395
|
-
|
|
18395
|
+
cell_id TEXT NOT NULL REFERENCES beads(id) ON DELETE CASCADE,
|
|
18396
18396
|
author TEXT NOT NULL,
|
|
18397
18397
|
body TEXT NOT NULL,
|
|
18398
18398
|
parent_id INTEGER REFERENCES bead_comments(id) ON DELETE CASCADE,
|
|
@@ -18400,7 +18400,7 @@ var init_migrations2 = __esm(() => {
|
|
|
18400
18400
|
updated_at BIGINT
|
|
18401
18401
|
);
|
|
18402
18402
|
|
|
18403
|
-
CREATE INDEX IF NOT EXISTS idx_bead_comments_bead ON bead_comments(
|
|
18403
|
+
CREATE INDEX IF NOT EXISTS idx_bead_comments_bead ON bead_comments(cell_id);
|
|
18404
18404
|
CREATE INDEX IF NOT EXISTS idx_bead_comments_author ON bead_comments(author);
|
|
18405
18405
|
CREATE INDEX IF NOT EXISTS idx_bead_comments_created ON bead_comments(created_at);
|
|
18406
18406
|
|
|
@@ -18410,7 +18410,7 @@ var init_migrations2 = __esm(() => {
|
|
|
18410
18410
|
-- Materialized view for fast blocked queries
|
|
18411
18411
|
-- Updated by projections when dependencies change
|
|
18412
18412
|
CREATE TABLE IF NOT EXISTS blocked_beads_cache (
|
|
18413
|
-
|
|
18413
|
+
cell_id TEXT PRIMARY KEY REFERENCES beads(id) ON DELETE CASCADE,
|
|
18414
18414
|
blocker_ids TEXT[] NOT NULL,
|
|
18415
18415
|
updated_at BIGINT NOT NULL
|
|
18416
18416
|
);
|
|
@@ -18422,7 +18422,7 @@ var init_migrations2 = __esm(() => {
|
|
|
18422
18422
|
-- ========================================================================
|
|
18423
18423
|
-- Tracks beads that need JSONL export (incremental sync)
|
|
18424
18424
|
CREATE TABLE IF NOT EXISTS dirty_beads (
|
|
18425
|
-
|
|
18425
|
+
cell_id TEXT PRIMARY KEY REFERENCES beads(id) ON DELETE CASCADE,
|
|
18426
18426
|
marked_at BIGINT NOT NULL
|
|
18427
18427
|
);
|
|
18428
18428
|
|
|
@@ -18912,74 +18912,74 @@ async function closeAllSwarmMail() {
|
|
|
18912
18912
|
// src/index.ts
|
|
18913
18913
|
init_streams();
|
|
18914
18914
|
|
|
18915
|
-
// src/
|
|
18915
|
+
// src/hive/store.ts
|
|
18916
18916
|
init_streams();
|
|
18917
18917
|
|
|
18918
|
-
// src/
|
|
18918
|
+
// src/hive/projections.ts
|
|
18919
18919
|
async function updateProjections(db, event) {
|
|
18920
18920
|
switch (event.type) {
|
|
18921
|
-
case "
|
|
18921
|
+
case "cell_created":
|
|
18922
18922
|
await handleBeadCreated(db, event);
|
|
18923
18923
|
break;
|
|
18924
|
-
case "
|
|
18924
|
+
case "cell_updated":
|
|
18925
18925
|
await handleBeadUpdated(db, event);
|
|
18926
18926
|
break;
|
|
18927
|
-
case "
|
|
18928
|
-
await
|
|
18927
|
+
case "cell_status_changed":
|
|
18928
|
+
await handleCellStatusChanged(db, event);
|
|
18929
18929
|
break;
|
|
18930
|
-
case "
|
|
18930
|
+
case "cell_closed":
|
|
18931
18931
|
await handleBeadClosed(db, event);
|
|
18932
18932
|
break;
|
|
18933
|
-
case "
|
|
18933
|
+
case "cell_reopened":
|
|
18934
18934
|
await handleBeadReopened(db, event);
|
|
18935
18935
|
break;
|
|
18936
|
-
case "
|
|
18936
|
+
case "cell_deleted":
|
|
18937
18937
|
await handleBeadDeleted(db, event);
|
|
18938
18938
|
break;
|
|
18939
|
-
case "
|
|
18939
|
+
case "cell_dependency_added":
|
|
18940
18940
|
await handleDependencyAdded(db, event);
|
|
18941
18941
|
break;
|
|
18942
|
-
case "
|
|
18942
|
+
case "cell_dependency_removed":
|
|
18943
18943
|
await handleDependencyRemoved(db, event);
|
|
18944
18944
|
break;
|
|
18945
|
-
case "
|
|
18945
|
+
case "cell_label_added":
|
|
18946
18946
|
await handleLabelAdded(db, event);
|
|
18947
18947
|
break;
|
|
18948
|
-
case "
|
|
18948
|
+
case "cell_label_removed":
|
|
18949
18949
|
await handleLabelRemoved(db, event);
|
|
18950
18950
|
break;
|
|
18951
|
-
case "
|
|
18951
|
+
case "cell_comment_added":
|
|
18952
18952
|
await handleCommentAdded(db, event);
|
|
18953
18953
|
break;
|
|
18954
|
-
case "
|
|
18954
|
+
case "cell_comment_updated":
|
|
18955
18955
|
await handleCommentUpdated(db, event);
|
|
18956
18956
|
break;
|
|
18957
|
-
case "
|
|
18957
|
+
case "cell_comment_deleted":
|
|
18958
18958
|
await handleCommentDeleted(db, event);
|
|
18959
18959
|
break;
|
|
18960
|
-
case "
|
|
18960
|
+
case "cell_epic_child_added":
|
|
18961
18961
|
await handleEpicChildAdded(db, event);
|
|
18962
18962
|
break;
|
|
18963
|
-
case "
|
|
18963
|
+
case "cell_epic_child_removed":
|
|
18964
18964
|
await handleEpicChildRemoved(db, event);
|
|
18965
18965
|
break;
|
|
18966
|
-
case "
|
|
18966
|
+
case "cell_assigned":
|
|
18967
18967
|
await handleBeadAssigned(db, event);
|
|
18968
18968
|
break;
|
|
18969
|
-
case "
|
|
18969
|
+
case "cell_work_started":
|
|
18970
18970
|
await handleWorkStarted(db, event);
|
|
18971
18971
|
break;
|
|
18972
18972
|
default:
|
|
18973
18973
|
console.warn(`[beads/projections] Unknown event type: ${event.type}`);
|
|
18974
18974
|
}
|
|
18975
|
-
await markBeadDirty(db, event.project_key, event.
|
|
18975
|
+
await markBeadDirty(db, event.project_key, event.cell_id);
|
|
18976
18976
|
}
|
|
18977
18977
|
async function handleBeadCreated(db, event) {
|
|
18978
18978
|
await db.query(`INSERT INTO beads (
|
|
18979
18979
|
id, project_key, type, status, title, description, priority,
|
|
18980
18980
|
parent_id, assignee, created_at, updated_at, created_by
|
|
18981
18981
|
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)`, [
|
|
18982
|
-
event.
|
|
18982
|
+
event.cell_id,
|
|
18983
18983
|
event.project_key,
|
|
18984
18984
|
event.issue_type,
|
|
18985
18985
|
"open",
|
|
@@ -19017,12 +19017,12 @@ async function handleBeadUpdated(db, event) {
|
|
|
19017
19017
|
if (updates.length > 0) {
|
|
19018
19018
|
updates.push(`updated_at = $${paramIndex++}`);
|
|
19019
19019
|
params.push(event.timestamp);
|
|
19020
|
-
params.push(event.
|
|
19020
|
+
params.push(event.cell_id);
|
|
19021
19021
|
await db.query(`UPDATE beads SET ${updates.join(", ")} WHERE id = $${paramIndex}`, params);
|
|
19022
19022
|
}
|
|
19023
19023
|
}
|
|
19024
|
-
async function
|
|
19025
|
-
await db.query(`UPDATE beads SET status = $1, updated_at = $2 WHERE id = $3`, [event.to_status, event.timestamp, event.
|
|
19024
|
+
async function handleCellStatusChanged(db, event) {
|
|
19025
|
+
await db.query(`UPDATE beads SET status = $1, updated_at = $2 WHERE id = $3`, [event.to_status, event.timestamp, event.cell_id]);
|
|
19026
19026
|
}
|
|
19027
19027
|
async function handleBeadClosed(db, event) {
|
|
19028
19028
|
await db.query(`UPDATE beads SET
|
|
@@ -19030,9 +19030,9 @@ async function handleBeadClosed(db, event) {
|
|
|
19030
19030
|
closed_at = $1,
|
|
19031
19031
|
closed_reason = $2,
|
|
19032
19032
|
updated_at = $3
|
|
19033
|
-
WHERE id = $4`, [event.timestamp, event.reason, event.timestamp, event.
|
|
19033
|
+
WHERE id = $4`, [event.timestamp, event.reason, event.timestamp, event.cell_id]);
|
|
19034
19034
|
const { invalidateBlockedCache: invalidateBlockedCache2 } = await Promise.resolve().then(() => exports_dependencies);
|
|
19035
|
-
await invalidateBlockedCache2(db, event.project_key, event.
|
|
19035
|
+
await invalidateBlockedCache2(db, event.project_key, event.cell_id);
|
|
19036
19036
|
}
|
|
19037
19037
|
async function handleBeadReopened(db, event) {
|
|
19038
19038
|
await db.query(`UPDATE beads SET
|
|
@@ -19040,7 +19040,7 @@ async function handleBeadReopened(db, event) {
|
|
|
19040
19040
|
closed_at = NULL,
|
|
19041
19041
|
closed_reason = NULL,
|
|
19042
19042
|
updated_at = $1
|
|
19043
|
-
WHERE id = $2`, [event.timestamp, event.
|
|
19043
|
+
WHERE id = $2`, [event.timestamp, event.cell_id]);
|
|
19044
19044
|
}
|
|
19045
19045
|
async function handleBeadDeleted(db, event) {
|
|
19046
19046
|
await db.query(`UPDATE beads SET
|
|
@@ -19048,34 +19048,34 @@ async function handleBeadDeleted(db, event) {
|
|
|
19048
19048
|
deleted_by = $2,
|
|
19049
19049
|
delete_reason = $3,
|
|
19050
19050
|
updated_at = $4
|
|
19051
|
-
WHERE id = $5`, [event.timestamp, event.deleted_by || null, event.reason || null, event.timestamp, event.
|
|
19051
|
+
WHERE id = $5`, [event.timestamp, event.deleted_by || null, event.reason || null, event.timestamp, event.cell_id]);
|
|
19052
19052
|
}
|
|
19053
19053
|
async function handleDependencyAdded(db, event) {
|
|
19054
19054
|
const dep = event.dependency;
|
|
19055
|
-
await db.query(`INSERT INTO bead_dependencies (
|
|
19055
|
+
await db.query(`INSERT INTO bead_dependencies (cell_id, depends_on_id, relationship, created_at, created_by)
|
|
19056
19056
|
VALUES ($1, $2, $3, $4, $5)
|
|
19057
|
-
ON CONFLICT (
|
|
19057
|
+
ON CONFLICT (cell_id, depends_on_id, relationship) DO NOTHING`, [event.cell_id, dep.target, dep.type, event.timestamp, event.added_by || null]);
|
|
19058
19058
|
const { invalidateBlockedCache: invalidate } = await Promise.resolve().then(() => exports_dependencies);
|
|
19059
|
-
await invalidate(db, event.project_key, event.
|
|
19059
|
+
await invalidate(db, event.project_key, event.cell_id);
|
|
19060
19060
|
}
|
|
19061
19061
|
async function handleDependencyRemoved(db, event) {
|
|
19062
19062
|
const dep = event.dependency;
|
|
19063
19063
|
await db.query(`DELETE FROM bead_dependencies
|
|
19064
|
-
WHERE
|
|
19064
|
+
WHERE cell_id = $1 AND depends_on_id = $2 AND relationship = $3`, [event.cell_id, dep.target, dep.type]);
|
|
19065
19065
|
const { invalidateBlockedCache: invalidate } = await Promise.resolve().then(() => exports_dependencies);
|
|
19066
|
-
await invalidate(db, event.project_key, event.
|
|
19066
|
+
await invalidate(db, event.project_key, event.cell_id);
|
|
19067
19067
|
}
|
|
19068
19068
|
async function handleLabelAdded(db, event) {
|
|
19069
|
-
await db.query(`INSERT INTO bead_labels (
|
|
19069
|
+
await db.query(`INSERT INTO bead_labels (cell_id, label, created_at)
|
|
19070
19070
|
VALUES ($1, $2, $3)
|
|
19071
|
-
ON CONFLICT (
|
|
19071
|
+
ON CONFLICT (cell_id, label) DO NOTHING`, [event.cell_id, event.label, event.timestamp]);
|
|
19072
19072
|
}
|
|
19073
19073
|
async function handleLabelRemoved(db, event) {
|
|
19074
|
-
await db.query(`DELETE FROM bead_labels WHERE
|
|
19074
|
+
await db.query(`DELETE FROM bead_labels WHERE cell_id = $1 AND label = $2`, [event.cell_id, event.label]);
|
|
19075
19075
|
}
|
|
19076
19076
|
async function handleCommentAdded(db, event) {
|
|
19077
|
-
await db.query(`INSERT INTO bead_comments (
|
|
19078
|
-
VALUES ($1, $2, $3, $4, $5)`, [event.
|
|
19077
|
+
await db.query(`INSERT INTO bead_comments (cell_id, author, body, parent_id, created_at)
|
|
19078
|
+
VALUES ($1, $2, $3, $4, $5)`, [event.cell_id, event.author, event.body, event.parent_comment_id || null, event.timestamp]);
|
|
19079
19079
|
}
|
|
19080
19080
|
async function handleCommentUpdated(db, event) {
|
|
19081
19081
|
await db.query(`UPDATE bead_comments SET body = $1, updated_at = $2 WHERE id = $3`, [event.new_body, event.timestamp, event.comment_id]);
|
|
@@ -19084,22 +19084,22 @@ async function handleCommentDeleted(db, event) {
|
|
|
19084
19084
|
await db.query(`DELETE FROM bead_comments WHERE id = $1`, [event.comment_id]);
|
|
19085
19085
|
}
|
|
19086
19086
|
async function handleEpicChildAdded(db, event) {
|
|
19087
|
-
await db.query(`UPDATE beads SET parent_id = $1, updated_at = $2 WHERE id = $3`, [event.
|
|
19087
|
+
await db.query(`UPDATE beads SET parent_id = $1, updated_at = $2 WHERE id = $3`, [event.cell_id, event.timestamp, event.child_id]);
|
|
19088
19088
|
}
|
|
19089
19089
|
async function handleEpicChildRemoved(db, event) {
|
|
19090
19090
|
await db.query(`UPDATE beads SET parent_id = NULL, updated_at = $1 WHERE id = $2`, [event.timestamp, event.child_id]);
|
|
19091
19091
|
}
|
|
19092
19092
|
async function handleBeadAssigned(db, event) {
|
|
19093
|
-
await db.query(`UPDATE beads SET assignee = $1, updated_at = $2 WHERE id = $3`, [event.assignee, event.timestamp, event.
|
|
19093
|
+
await db.query(`UPDATE beads SET assignee = $1, updated_at = $2 WHERE id = $3`, [event.assignee, event.timestamp, event.cell_id]);
|
|
19094
19094
|
}
|
|
19095
19095
|
async function handleWorkStarted(db, event) {
|
|
19096
|
-
await db.query(`UPDATE beads SET status = 'in_progress', updated_at = $1 WHERE id = $2`, [event.timestamp, event.
|
|
19096
|
+
await db.query(`UPDATE beads SET status = 'in_progress', updated_at = $1 WHERE id = $2`, [event.timestamp, event.cell_id]);
|
|
19097
19097
|
}
|
|
19098
|
-
async function
|
|
19099
|
-
const result = await db.query(`SELECT * FROM beads WHERE project_key = $1 AND id = $2 AND deleted_at IS NULL`, [projectKey,
|
|
19098
|
+
async function getCell(db, projectKey, cellId) {
|
|
19099
|
+
const result = await db.query(`SELECT * FROM beads WHERE project_key = $1 AND id = $2 AND deleted_at IS NULL`, [projectKey, cellId]);
|
|
19100
19100
|
return result.rows[0] ?? null;
|
|
19101
19101
|
}
|
|
19102
|
-
async function
|
|
19102
|
+
async function queryCells(db, projectKey, options = {}) {
|
|
19103
19103
|
const conditions = ["project_key = $1"];
|
|
19104
19104
|
const params = [projectKey];
|
|
19105
19105
|
let paramIndex = 2;
|
|
@@ -19136,81 +19136,81 @@ async function queryBeads(db, projectKey, options = {}) {
|
|
|
19136
19136
|
const result = await db.query(query, params);
|
|
19137
19137
|
return result.rows;
|
|
19138
19138
|
}
|
|
19139
|
-
async function getDependencies(db, projectKey,
|
|
19140
|
-
const result = await db.query(`SELECT * FROM bead_dependencies WHERE
|
|
19139
|
+
async function getDependencies(db, projectKey, cellId) {
|
|
19140
|
+
const result = await db.query(`SELECT * FROM bead_dependencies WHERE cell_id = $1`, [cellId]);
|
|
19141
19141
|
return result.rows;
|
|
19142
19142
|
}
|
|
19143
|
-
async function getDependents(db, projectKey,
|
|
19144
|
-
const result = await db.query(`SELECT * FROM bead_dependencies WHERE depends_on_id = $1`, [
|
|
19143
|
+
async function getDependents(db, projectKey, cellId) {
|
|
19144
|
+
const result = await db.query(`SELECT * FROM bead_dependencies WHERE depends_on_id = $1`, [cellId]);
|
|
19145
19145
|
return result.rows;
|
|
19146
19146
|
}
|
|
19147
|
-
async function isBlocked(db, projectKey,
|
|
19148
|
-
const result = await db.query(`SELECT EXISTS(SELECT 1 FROM blocked_beads_cache WHERE
|
|
19147
|
+
async function isBlocked(db, projectKey, cellId) {
|
|
19148
|
+
const result = await db.query(`SELECT EXISTS(SELECT 1 FROM blocked_beads_cache WHERE cell_id = $1) as exists`, [cellId]);
|
|
19149
19149
|
return result.rows[0]?.exists ?? false;
|
|
19150
19150
|
}
|
|
19151
|
-
async function getBlockers(db, projectKey,
|
|
19152
|
-
const result = await db.query(`SELECT blocker_ids FROM blocked_beads_cache WHERE
|
|
19151
|
+
async function getBlockers(db, projectKey, cellId) {
|
|
19152
|
+
const result = await db.query(`SELECT blocker_ids FROM blocked_beads_cache WHERE cell_id = $1`, [cellId]);
|
|
19153
19153
|
return result.rows[0]?.blocker_ids ?? [];
|
|
19154
19154
|
}
|
|
19155
|
-
async function getLabels(db, projectKey,
|
|
19156
|
-
const result = await db.query(`SELECT label FROM bead_labels WHERE
|
|
19155
|
+
async function getLabels(db, projectKey, cellId) {
|
|
19156
|
+
const result = await db.query(`SELECT label FROM bead_labels WHERE cell_id = $1 ORDER BY label`, [cellId]);
|
|
19157
19157
|
return result.rows.map((r) => r.label);
|
|
19158
19158
|
}
|
|
19159
|
-
async function getComments(db, projectKey,
|
|
19160
|
-
const result = await db.query(`SELECT * FROM bead_comments WHERE
|
|
19159
|
+
async function getComments(db, projectKey, cellId) {
|
|
19160
|
+
const result = await db.query(`SELECT * FROM bead_comments WHERE cell_id = $1 ORDER BY created_at ASC`, [cellId]);
|
|
19161
19161
|
return result.rows;
|
|
19162
19162
|
}
|
|
19163
|
-
async function
|
|
19163
|
+
async function getNextReadyCell(db, projectKey) {
|
|
19164
19164
|
const result = await db.query(`SELECT b.* FROM beads b
|
|
19165
19165
|
WHERE b.project_key = $1
|
|
19166
19166
|
AND b.status = 'open'
|
|
19167
19167
|
AND b.deleted_at IS NULL
|
|
19168
19168
|
AND NOT EXISTS (
|
|
19169
|
-
SELECT 1 FROM blocked_beads_cache bbc WHERE bbc.
|
|
19169
|
+
SELECT 1 FROM blocked_beads_cache bbc WHERE bbc.cell_id = b.id
|
|
19170
19170
|
)
|
|
19171
19171
|
ORDER BY b.priority DESC, b.created_at ASC
|
|
19172
19172
|
LIMIT 1`, [projectKey]);
|
|
19173
19173
|
return result.rows[0] ?? null;
|
|
19174
19174
|
}
|
|
19175
|
-
async function
|
|
19175
|
+
async function getInProgressCells(db, projectKey) {
|
|
19176
19176
|
const result = await db.query(`SELECT * FROM beads
|
|
19177
19177
|
WHERE project_key = $1 AND status = 'in_progress' AND deleted_at IS NULL
|
|
19178
19178
|
ORDER BY priority DESC, created_at ASC`, [projectKey]);
|
|
19179
19179
|
return result.rows;
|
|
19180
19180
|
}
|
|
19181
|
-
async function
|
|
19181
|
+
async function getBlockedCells(db, projectKey) {
|
|
19182
19182
|
const result = await db.query(`SELECT b.*, bbc.blocker_ids
|
|
19183
19183
|
FROM beads b
|
|
19184
|
-
JOIN blocked_beads_cache bbc ON b.id =
|
|
19184
|
+
JOIN blocked_beads_cache bbc ON b.id = bcc.cell_id
|
|
19185
19185
|
WHERE b.project_key = $1 AND b.deleted_at IS NULL
|
|
19186
19186
|
ORDER BY b.priority DESC, b.created_at ASC`, [projectKey]);
|
|
19187
19187
|
return result.rows.map((r) => {
|
|
19188
|
-
const { blocker_ids, ...
|
|
19189
|
-
return {
|
|
19188
|
+
const { blocker_ids, ...cellData } = r;
|
|
19189
|
+
return { cell: cellData, blockers: blocker_ids };
|
|
19190
19190
|
});
|
|
19191
19191
|
}
|
|
19192
|
-
async function markBeadDirty(db, projectKey,
|
|
19193
|
-
await db.query(`INSERT INTO dirty_beads (
|
|
19192
|
+
async function markBeadDirty(db, projectKey, cellId) {
|
|
19193
|
+
await db.query(`INSERT INTO dirty_beads (cell_id, marked_at)
|
|
19194
19194
|
VALUES ($1, $2)
|
|
19195
|
-
ON CONFLICT (
|
|
19195
|
+
ON CONFLICT (cell_id) DO UPDATE SET marked_at = $2`, [cellId, Date.now()]);
|
|
19196
19196
|
}
|
|
19197
|
-
async function
|
|
19198
|
-
const result = await db.query(`SELECT db.
|
|
19199
|
-
JOIN beads b ON db.
|
|
19197
|
+
async function getDirtyCells(db, projectKey) {
|
|
19198
|
+
const result = await db.query(`SELECT db.cell_id FROM dirty_beads db
|
|
19199
|
+
JOIN beads b ON db.cell_id = b.id
|
|
19200
19200
|
WHERE b.project_key = $1
|
|
19201
19201
|
ORDER BY db.marked_at ASC`, [projectKey]);
|
|
19202
|
-
return result.rows.map((r) => r.
|
|
19202
|
+
return result.rows.map((r) => r.cell_id);
|
|
19203
19203
|
}
|
|
19204
|
-
async function clearDirtyBead(db, projectKey,
|
|
19205
|
-
await db.query(`DELETE FROM dirty_beads WHERE
|
|
19204
|
+
async function clearDirtyBead(db, projectKey, cellId) {
|
|
19205
|
+
await db.query(`DELETE FROM dirty_beads WHERE cell_id = $1`, [cellId]);
|
|
19206
19206
|
}
|
|
19207
19207
|
async function clearAllDirtyBeads(db, projectKey) {
|
|
19208
|
-
await db.query(`DELETE FROM dirty_beads WHERE
|
|
19208
|
+
await db.query(`DELETE FROM dirty_beads WHERE cell_id IN (
|
|
19209
19209
|
SELECT id FROM beads WHERE project_key = $1
|
|
19210
19210
|
)`, [projectKey]);
|
|
19211
19211
|
}
|
|
19212
19212
|
|
|
19213
|
-
// src/
|
|
19213
|
+
// src/hive/store.ts
|
|
19214
19214
|
function parseTimestamp2(timestamp) {
|
|
19215
19215
|
const ts = parseInt(timestamp, 10);
|
|
19216
19216
|
if (Number.isNaN(ts)) {
|
|
@@ -19221,7 +19221,7 @@ function parseTimestamp2(timestamp) {
|
|
|
19221
19221
|
}
|
|
19222
19222
|
return ts;
|
|
19223
19223
|
}
|
|
19224
|
-
async function
|
|
19224
|
+
async function appendCellEvent(event, projectPath, dbOverride) {
|
|
19225
19225
|
const db = dbOverride ?? await getDatabase(projectPath);
|
|
19226
19226
|
const { type, project_key, timestamp, ...rest } = event;
|
|
19227
19227
|
const result = await db.query(`INSERT INTO events (type, project_key, timestamp, data)
|
|
@@ -19235,20 +19235,20 @@ async function appendBeadEvent(event, projectPath, dbOverride) {
|
|
|
19235
19235
|
await updateProjections(db, { ...event, id, sequence });
|
|
19236
19236
|
return { ...event, id, sequence };
|
|
19237
19237
|
}
|
|
19238
|
-
async function
|
|
19239
|
-
return withTiming("
|
|
19238
|
+
async function readCellEvents(options = {}, projectPath, dbOverride) {
|
|
19239
|
+
return withTiming("readCellEvents", async () => {
|
|
19240
19240
|
const db = dbOverride ?? await getDatabase(projectPath);
|
|
19241
19241
|
const conditions = [];
|
|
19242
19242
|
const params = [];
|
|
19243
19243
|
let paramIndex = 1;
|
|
19244
|
-
conditions.push(`type LIKE '
|
|
19244
|
+
conditions.push(`type LIKE 'cell_%'`);
|
|
19245
19245
|
if (options.projectKey) {
|
|
19246
19246
|
conditions.push(`project_key = $${paramIndex++}`);
|
|
19247
19247
|
params.push(options.projectKey);
|
|
19248
19248
|
}
|
|
19249
|
-
if (options.
|
|
19250
|
-
conditions.push(`data->>'
|
|
19251
|
-
params.push(options.
|
|
19249
|
+
if (options.cellId) {
|
|
19250
|
+
conditions.push(`data->>'cell_id' = $${paramIndex++}`);
|
|
19251
|
+
params.push(options.cellId);
|
|
19252
19252
|
}
|
|
19253
19253
|
if (options.types && options.types.length > 0) {
|
|
19254
19254
|
conditions.push(`type = ANY($${paramIndex++})`);
|
|
@@ -19295,25 +19295,25 @@ async function readBeadEvents(options = {}, projectPath, dbOverride) {
|
|
|
19295
19295
|
});
|
|
19296
19296
|
});
|
|
19297
19297
|
}
|
|
19298
|
-
async function
|
|
19299
|
-
return withTiming("
|
|
19298
|
+
async function replayCellEvents(options = {}, projectPath, dbOverride) {
|
|
19299
|
+
return withTiming("replayCellEvents", async () => {
|
|
19300
19300
|
const startTime = Date.now();
|
|
19301
19301
|
const db = dbOverride ?? await getDatabase(projectPath);
|
|
19302
19302
|
if (options.clearViews) {
|
|
19303
19303
|
if (options.projectKey) {
|
|
19304
|
-
await db.query(`DELETE FROM bead_comments WHERE
|
|
19304
|
+
await db.query(`DELETE FROM bead_comments WHERE cell_id IN (
|
|
19305
19305
|
SELECT id FROM beads WHERE project_key = $1
|
|
19306
19306
|
)`, [options.projectKey]);
|
|
19307
|
-
await db.query(`DELETE FROM bead_labels WHERE
|
|
19307
|
+
await db.query(`DELETE FROM bead_labels WHERE cell_id IN (
|
|
19308
19308
|
SELECT id FROM beads WHERE project_key = $1
|
|
19309
19309
|
)`, [options.projectKey]);
|
|
19310
|
-
await db.query(`DELETE FROM bead_dependencies WHERE
|
|
19310
|
+
await db.query(`DELETE FROM bead_dependencies WHERE cell_id IN (
|
|
19311
19311
|
SELECT id FROM beads WHERE project_key = $1
|
|
19312
19312
|
)`, [options.projectKey]);
|
|
19313
|
-
await db.query(`DELETE FROM blocked_beads_cache WHERE
|
|
19313
|
+
await db.query(`DELETE FROM blocked_beads_cache WHERE cell_id IN (
|
|
19314
19314
|
SELECT id FROM beads WHERE project_key = $1
|
|
19315
19315
|
)`, [options.projectKey]);
|
|
19316
|
-
await db.query(`DELETE FROM dirty_beads WHERE
|
|
19316
|
+
await db.query(`DELETE FROM dirty_beads WHERE cell_id IN (
|
|
19317
19317
|
SELECT id FROM beads WHERE project_key = $1
|
|
19318
19318
|
)`, [options.projectKey]);
|
|
19319
19319
|
await db.query(`DELETE FROM beads WHERE project_key = $1`, [
|
|
@@ -19330,7 +19330,7 @@ async function replayBeadEvents(options = {}, projectPath, dbOverride) {
|
|
|
19330
19330
|
`);
|
|
19331
19331
|
}
|
|
19332
19332
|
}
|
|
19333
|
-
const events2 = await
|
|
19333
|
+
const events2 = await readCellEvents({
|
|
19334
19334
|
projectKey: options.projectKey,
|
|
19335
19335
|
afterSequence: options.fromSequence
|
|
19336
19336
|
}, projectPath, dbOverride);
|
|
@@ -19344,14 +19344,14 @@ async function replayBeadEvents(options = {}, projectPath, dbOverride) {
|
|
|
19344
19344
|
});
|
|
19345
19345
|
}
|
|
19346
19346
|
|
|
19347
|
-
// src/
|
|
19348
|
-
function
|
|
19347
|
+
// src/hive/adapter.ts
|
|
19348
|
+
function createHiveAdapter(db, projectKey) {
|
|
19349
19349
|
return {
|
|
19350
|
-
async
|
|
19350
|
+
async createCell(projectKeyParam, options, projectPath) {
|
|
19351
19351
|
const event = {
|
|
19352
|
-
type: "
|
|
19352
|
+
type: "cell_created",
|
|
19353
19353
|
project_key: projectKeyParam,
|
|
19354
|
-
|
|
19354
|
+
cell_id: generateBeadId(projectKeyParam),
|
|
19355
19355
|
timestamp: Date.now(),
|
|
19356
19356
|
title: options.title,
|
|
19357
19357
|
description: options.description || null,
|
|
@@ -19361,34 +19361,34 @@ function createBeadsAdapter(db, projectKey) {
|
|
|
19361
19361
|
created_by: options.created_by || null,
|
|
19362
19362
|
metadata: options.metadata || null
|
|
19363
19363
|
};
|
|
19364
|
-
await
|
|
19364
|
+
await appendCellEvent(event, projectPath, db);
|
|
19365
19365
|
if (options.assignee) {
|
|
19366
19366
|
const assignEvent = {
|
|
19367
|
-
type: "
|
|
19367
|
+
type: "cell_assigned",
|
|
19368
19368
|
project_key: projectKeyParam,
|
|
19369
|
-
|
|
19369
|
+
cell_id: event.cell_id,
|
|
19370
19370
|
timestamp: Date.now(),
|
|
19371
19371
|
assignee: options.assignee,
|
|
19372
19372
|
assigned_by: options.created_by || null
|
|
19373
19373
|
};
|
|
19374
|
-
await
|
|
19374
|
+
await appendCellEvent(assignEvent, projectPath, db);
|
|
19375
19375
|
}
|
|
19376
|
-
const bead = await
|
|
19376
|
+
const bead = await getCell(db, projectKeyParam, event.cell_id);
|
|
19377
19377
|
if (!bead) {
|
|
19378
|
-
throw new Error(`[
|
|
19378
|
+
throw new Error(`[HiveAdapter] Failed to create bead - not found after insert`);
|
|
19379
19379
|
}
|
|
19380
19380
|
return bead;
|
|
19381
19381
|
},
|
|
19382
|
-
async
|
|
19383
|
-
return
|
|
19382
|
+
async getCell(projectKeyParam, cellId, projectPath) {
|
|
19383
|
+
return getCell(db, projectKeyParam, cellId);
|
|
19384
19384
|
},
|
|
19385
|
-
async
|
|
19386
|
-
return
|
|
19385
|
+
async queryCells(projectKeyParam, options, projectPath) {
|
|
19386
|
+
return queryCells(db, projectKeyParam, options);
|
|
19387
19387
|
},
|
|
19388
|
-
async
|
|
19389
|
-
const existingBead = await
|
|
19388
|
+
async updateCell(projectKeyParam, cellId, options, projectPath) {
|
|
19389
|
+
const existingBead = await getCell(db, projectKeyParam, cellId);
|
|
19390
19390
|
if (!existingBead) {
|
|
19391
|
-
throw new Error(`[
|
|
19391
|
+
throw new Error(`[HiveAdapter] Bead not found: ${cellId}`);
|
|
19392
19392
|
}
|
|
19393
19393
|
const changes = {};
|
|
19394
19394
|
if (options.title && options.title !== existingBead.title) {
|
|
@@ -19407,120 +19407,120 @@ function createBeadsAdapter(db, projectKey) {
|
|
|
19407
19407
|
return existingBead;
|
|
19408
19408
|
}
|
|
19409
19409
|
const event = {
|
|
19410
|
-
type: "
|
|
19410
|
+
type: "cell_updated",
|
|
19411
19411
|
project_key: projectKeyParam,
|
|
19412
|
-
|
|
19412
|
+
cell_id: cellId,
|
|
19413
19413
|
timestamp: Date.now(),
|
|
19414
19414
|
changes,
|
|
19415
19415
|
updated_by: options.updated_by || null
|
|
19416
19416
|
};
|
|
19417
|
-
await
|
|
19418
|
-
const updated = await
|
|
19417
|
+
await appendCellEvent(event, projectPath, db);
|
|
19418
|
+
const updated = await getCell(db, projectKeyParam, cellId);
|
|
19419
19419
|
if (!updated) {
|
|
19420
|
-
throw new Error(`[
|
|
19420
|
+
throw new Error(`[HiveAdapter] Bead disappeared after update: ${cellId}`);
|
|
19421
19421
|
}
|
|
19422
19422
|
return updated;
|
|
19423
19423
|
},
|
|
19424
|
-
async
|
|
19425
|
-
const existingBead = await
|
|
19424
|
+
async changeCellStatus(projectKeyParam, cellId, toStatus, options, projectPath) {
|
|
19425
|
+
const existingBead = await getCell(db, projectKeyParam, cellId);
|
|
19426
19426
|
if (!existingBead) {
|
|
19427
|
-
throw new Error(`[
|
|
19427
|
+
throw new Error(`[HiveAdapter] Bead not found: ${cellId}`);
|
|
19428
19428
|
}
|
|
19429
19429
|
const event = {
|
|
19430
|
-
type: "
|
|
19430
|
+
type: "cell_status_changed",
|
|
19431
19431
|
project_key: projectKeyParam,
|
|
19432
|
-
|
|
19432
|
+
cell_id: cellId,
|
|
19433
19433
|
timestamp: Date.now(),
|
|
19434
19434
|
from_status: existingBead.status,
|
|
19435
19435
|
to_status: toStatus,
|
|
19436
19436
|
reason: options?.reason || null,
|
|
19437
19437
|
changed_by: options?.changed_by || null
|
|
19438
19438
|
};
|
|
19439
|
-
await
|
|
19440
|
-
const updated = await
|
|
19439
|
+
await appendCellEvent(event, projectPath, db);
|
|
19440
|
+
const updated = await getCell(db, projectKeyParam, cellId);
|
|
19441
19441
|
if (!updated) {
|
|
19442
|
-
throw new Error(`[
|
|
19442
|
+
throw new Error(`[HiveAdapter] Bead disappeared after status change: ${cellId}`);
|
|
19443
19443
|
}
|
|
19444
19444
|
return updated;
|
|
19445
19445
|
},
|
|
19446
|
-
async
|
|
19447
|
-
const existingBead = await
|
|
19446
|
+
async closeCell(projectKeyParam, cellId, reason, options, projectPath) {
|
|
19447
|
+
const existingBead = await getCell(db, projectKeyParam, cellId);
|
|
19448
19448
|
if (!existingBead) {
|
|
19449
|
-
throw new Error(`[
|
|
19449
|
+
throw new Error(`[HiveAdapter] Bead not found: ${cellId}`);
|
|
19450
19450
|
}
|
|
19451
19451
|
const event = {
|
|
19452
|
-
type: "
|
|
19452
|
+
type: "cell_closed",
|
|
19453
19453
|
project_key: projectKeyParam,
|
|
19454
|
-
|
|
19454
|
+
cell_id: cellId,
|
|
19455
19455
|
timestamp: Date.now(),
|
|
19456
19456
|
reason,
|
|
19457
19457
|
closed_by: options?.closed_by || null,
|
|
19458
19458
|
files_touched: options?.files_touched || null,
|
|
19459
19459
|
duration_ms: options?.duration_ms || null
|
|
19460
19460
|
};
|
|
19461
|
-
await
|
|
19462
|
-
const updated = await
|
|
19461
|
+
await appendCellEvent(event, projectPath, db);
|
|
19462
|
+
const updated = await getCell(db, projectKeyParam, cellId);
|
|
19463
19463
|
if (!updated) {
|
|
19464
|
-
throw new Error(`[
|
|
19464
|
+
throw new Error(`[HiveAdapter] Bead disappeared after close: ${cellId}`);
|
|
19465
19465
|
}
|
|
19466
19466
|
return updated;
|
|
19467
19467
|
},
|
|
19468
|
-
async
|
|
19469
|
-
const existingBead = await
|
|
19468
|
+
async reopenCell(projectKeyParam, cellId, options, projectPath) {
|
|
19469
|
+
const existingBead = await getCell(db, projectKeyParam, cellId);
|
|
19470
19470
|
if (!existingBead) {
|
|
19471
|
-
throw new Error(`[
|
|
19471
|
+
throw new Error(`[HiveAdapter] Bead not found: ${cellId}`);
|
|
19472
19472
|
}
|
|
19473
19473
|
const event = {
|
|
19474
|
-
type: "
|
|
19474
|
+
type: "cell_reopened",
|
|
19475
19475
|
project_key: projectKeyParam,
|
|
19476
|
-
|
|
19476
|
+
cell_id: cellId,
|
|
19477
19477
|
timestamp: Date.now(),
|
|
19478
19478
|
reason: options?.reason || null,
|
|
19479
19479
|
reopened_by: options?.reopened_by || null
|
|
19480
19480
|
};
|
|
19481
|
-
await
|
|
19482
|
-
const updated = await
|
|
19481
|
+
await appendCellEvent(event, projectPath, db);
|
|
19482
|
+
const updated = await getCell(db, projectKeyParam, cellId);
|
|
19483
19483
|
if (!updated) {
|
|
19484
|
-
throw new Error(`[
|
|
19484
|
+
throw new Error(`[HiveAdapter] Bead disappeared after reopen: ${cellId}`);
|
|
19485
19485
|
}
|
|
19486
19486
|
return updated;
|
|
19487
19487
|
},
|
|
19488
|
-
async
|
|
19489
|
-
const existingBead = await
|
|
19488
|
+
async deleteCell(projectKeyParam, cellId, options, projectPath) {
|
|
19489
|
+
const existingBead = await getCell(db, projectKeyParam, cellId);
|
|
19490
19490
|
if (!existingBead) {
|
|
19491
|
-
throw new Error(`[
|
|
19491
|
+
throw new Error(`[HiveAdapter] Bead not found: ${cellId}`);
|
|
19492
19492
|
}
|
|
19493
19493
|
const event = {
|
|
19494
|
-
type: "
|
|
19494
|
+
type: "cell_deleted",
|
|
19495
19495
|
project_key: projectKeyParam,
|
|
19496
|
-
|
|
19496
|
+
cell_id: cellId,
|
|
19497
19497
|
timestamp: Date.now(),
|
|
19498
19498
|
reason: options?.reason || null,
|
|
19499
19499
|
deleted_by: options?.deleted_by || null
|
|
19500
19500
|
};
|
|
19501
|
-
await
|
|
19501
|
+
await appendCellEvent(event, projectPath, db);
|
|
19502
19502
|
},
|
|
19503
|
-
async addDependency(projectKeyParam,
|
|
19504
|
-
const sourceBead = await
|
|
19503
|
+
async addDependency(projectKeyParam, cellId, dependsOnId, relationship, options, projectPath) {
|
|
19504
|
+
const sourceBead = await getCell(db, projectKeyParam, cellId);
|
|
19505
19505
|
if (!sourceBead) {
|
|
19506
|
-
throw new Error(`[
|
|
19506
|
+
throw new Error(`[HiveAdapter] Bead not found: ${cellId}`);
|
|
19507
19507
|
}
|
|
19508
|
-
const
|
|
19509
|
-
if (!
|
|
19510
|
-
throw new Error(`[
|
|
19508
|
+
const targetCell = await getCell(db, projectKeyParam, dependsOnId);
|
|
19509
|
+
if (!targetCell) {
|
|
19510
|
+
throw new Error(`[HiveAdapter] Target bead not found: ${dependsOnId}`);
|
|
19511
19511
|
}
|
|
19512
|
-
if (
|
|
19513
|
-
throw new Error(`[
|
|
19512
|
+
if (cellId === dependsOnId) {
|
|
19513
|
+
throw new Error(`[HiveAdapter] Bead cannot depend on itself`);
|
|
19514
19514
|
}
|
|
19515
19515
|
const { wouldCreateCycle: wouldCreateCycle2 } = await Promise.resolve().then(() => exports_dependencies);
|
|
19516
|
-
const hasCycle = await wouldCreateCycle2(db,
|
|
19516
|
+
const hasCycle = await wouldCreateCycle2(db, cellId, dependsOnId);
|
|
19517
19517
|
if (hasCycle) {
|
|
19518
|
-
throw new Error(`[
|
|
19518
|
+
throw new Error(`[HiveAdapter] Adding dependency would create a cycle`);
|
|
19519
19519
|
}
|
|
19520
19520
|
const event = {
|
|
19521
|
-
type: "
|
|
19521
|
+
type: "cell_dependency_added",
|
|
19522
19522
|
project_key: projectKeyParam,
|
|
19523
|
-
|
|
19523
|
+
cell_id: cellId,
|
|
19524
19524
|
timestamp: Date.now(),
|
|
19525
19525
|
dependency: {
|
|
19526
19526
|
target: dependsOnId,
|
|
@@ -19529,19 +19529,19 @@ function createBeadsAdapter(db, projectKey) {
|
|
|
19529
19529
|
reason: options?.reason || null,
|
|
19530
19530
|
added_by: options?.added_by || null
|
|
19531
19531
|
};
|
|
19532
|
-
await
|
|
19533
|
-
const deps = await getDependencies(db, projectKeyParam,
|
|
19532
|
+
await appendCellEvent(event, projectPath, db);
|
|
19533
|
+
const deps = await getDependencies(db, projectKeyParam, cellId);
|
|
19534
19534
|
const dep = deps.find((d) => d.depends_on_id === dependsOnId && d.relationship === relationship);
|
|
19535
19535
|
if (!dep) {
|
|
19536
|
-
throw new Error(`[
|
|
19536
|
+
throw new Error(`[HiveAdapter] Dependency not found after insert`);
|
|
19537
19537
|
}
|
|
19538
19538
|
return dep;
|
|
19539
19539
|
},
|
|
19540
|
-
async removeDependency(projectKeyParam,
|
|
19540
|
+
async removeDependency(projectKeyParam, cellId, dependsOnId, relationship, options, projectPath) {
|
|
19541
19541
|
const event = {
|
|
19542
|
-
type: "
|
|
19542
|
+
type: "cell_dependency_removed",
|
|
19543
19543
|
project_key: projectKeyParam,
|
|
19544
|
-
|
|
19544
|
+
cell_id: cellId,
|
|
19545
19545
|
timestamp: Date.now(),
|
|
19546
19546
|
dependency: {
|
|
19547
19547
|
target: dependsOnId,
|
|
@@ -19550,86 +19550,86 @@ function createBeadsAdapter(db, projectKey) {
|
|
|
19550
19550
|
reason: options?.reason || null,
|
|
19551
19551
|
removed_by: options?.removed_by || null
|
|
19552
19552
|
};
|
|
19553
|
-
await
|
|
19553
|
+
await appendCellEvent(event, projectPath, db);
|
|
19554
19554
|
},
|
|
19555
|
-
async getDependencies(projectKeyParam,
|
|
19556
|
-
return getDependencies(db, projectKeyParam,
|
|
19555
|
+
async getDependencies(projectKeyParam, cellId, projectPath) {
|
|
19556
|
+
return getDependencies(db, projectKeyParam, cellId);
|
|
19557
19557
|
},
|
|
19558
|
-
async getDependents(projectKeyParam,
|
|
19559
|
-
return getDependents(db, projectKeyParam,
|
|
19558
|
+
async getDependents(projectKeyParam, cellId, projectPath) {
|
|
19559
|
+
return getDependents(db, projectKeyParam, cellId);
|
|
19560
19560
|
},
|
|
19561
|
-
async isBlocked(projectKeyParam,
|
|
19562
|
-
return isBlocked(db, projectKeyParam,
|
|
19561
|
+
async isBlocked(projectKeyParam, cellId, projectPath) {
|
|
19562
|
+
return isBlocked(db, projectKeyParam, cellId);
|
|
19563
19563
|
},
|
|
19564
|
-
async getBlockers(projectKeyParam,
|
|
19565
|
-
return getBlockers(db, projectKeyParam,
|
|
19564
|
+
async getBlockers(projectKeyParam, cellId, projectPath) {
|
|
19565
|
+
return getBlockers(db, projectKeyParam, cellId);
|
|
19566
19566
|
},
|
|
19567
|
-
async addLabel(projectKeyParam,
|
|
19567
|
+
async addLabel(projectKeyParam, cellId, label, options, projectPath) {
|
|
19568
19568
|
const event = {
|
|
19569
|
-
type: "
|
|
19569
|
+
type: "cell_label_added",
|
|
19570
19570
|
project_key: projectKeyParam,
|
|
19571
|
-
|
|
19571
|
+
cell_id: cellId,
|
|
19572
19572
|
timestamp: Date.now(),
|
|
19573
19573
|
label,
|
|
19574
19574
|
added_by: options?.added_by || null
|
|
19575
19575
|
};
|
|
19576
|
-
await
|
|
19576
|
+
await appendCellEvent(event, projectPath, db);
|
|
19577
19577
|
return {
|
|
19578
|
-
|
|
19578
|
+
cell_id: cellId,
|
|
19579
19579
|
label,
|
|
19580
19580
|
created_at: event.timestamp
|
|
19581
19581
|
};
|
|
19582
19582
|
},
|
|
19583
|
-
async removeLabel(projectKeyParam,
|
|
19583
|
+
async removeLabel(projectKeyParam, cellId, label, options, projectPath) {
|
|
19584
19584
|
const event = {
|
|
19585
|
-
type: "
|
|
19585
|
+
type: "cell_label_removed",
|
|
19586
19586
|
project_key: projectKeyParam,
|
|
19587
|
-
|
|
19587
|
+
cell_id: cellId,
|
|
19588
19588
|
timestamp: Date.now(),
|
|
19589
19589
|
label,
|
|
19590
19590
|
removed_by: options?.removed_by || null
|
|
19591
19591
|
};
|
|
19592
|
-
await
|
|
19592
|
+
await appendCellEvent(event, projectPath, db);
|
|
19593
19593
|
},
|
|
19594
|
-
async getLabels(projectKeyParam,
|
|
19595
|
-
return getLabels(db, projectKeyParam,
|
|
19594
|
+
async getLabels(projectKeyParam, cellId, projectPath) {
|
|
19595
|
+
return getLabels(db, projectKeyParam, cellId);
|
|
19596
19596
|
},
|
|
19597
|
-
async
|
|
19598
|
-
return
|
|
19597
|
+
async getCellsWithLabel(projectKeyParam, label, projectPath) {
|
|
19598
|
+
return queryCells(db, projectKeyParam, { labels: [label] });
|
|
19599
19599
|
},
|
|
19600
|
-
async addComment(projectKeyParam,
|
|
19600
|
+
async addComment(projectKeyParam, cellId, author, body, options, projectPath) {
|
|
19601
19601
|
const event = {
|
|
19602
|
-
type: "
|
|
19602
|
+
type: "cell_comment_added",
|
|
19603
19603
|
project_key: projectKeyParam,
|
|
19604
|
-
|
|
19604
|
+
cell_id: cellId,
|
|
19605
19605
|
timestamp: Date.now(),
|
|
19606
19606
|
author,
|
|
19607
19607
|
body,
|
|
19608
19608
|
parent_comment_id: options?.parent_id || null,
|
|
19609
19609
|
metadata: options?.metadata || null
|
|
19610
19610
|
};
|
|
19611
|
-
await
|
|
19612
|
-
const comments = await getComments(db, projectKeyParam,
|
|
19611
|
+
await appendCellEvent(event, projectPath, db);
|
|
19612
|
+
const comments = await getComments(db, projectKeyParam, cellId);
|
|
19613
19613
|
const comment = comments[comments.length - 1];
|
|
19614
19614
|
if (!comment) {
|
|
19615
|
-
throw new Error(`[
|
|
19615
|
+
throw new Error(`[HiveAdapter] Comment not found after insert`);
|
|
19616
19616
|
}
|
|
19617
19617
|
return comment;
|
|
19618
19618
|
},
|
|
19619
19619
|
async updateComment(projectKeyParam, commentId, newBody, updated_by, projectPath) {
|
|
19620
19620
|
const event = {
|
|
19621
|
-
type: "
|
|
19621
|
+
type: "cell_comment_updated",
|
|
19622
19622
|
project_key: projectKeyParam,
|
|
19623
|
-
|
|
19623
|
+
cell_id: "",
|
|
19624
19624
|
timestamp: Date.now(),
|
|
19625
19625
|
comment_id: commentId,
|
|
19626
19626
|
new_body: newBody,
|
|
19627
19627
|
updated_by
|
|
19628
19628
|
};
|
|
19629
|
-
await
|
|
19629
|
+
await appendCellEvent(event, projectPath, db);
|
|
19630
19630
|
return {
|
|
19631
19631
|
id: commentId,
|
|
19632
|
-
|
|
19632
|
+
cell_id: "",
|
|
19633
19633
|
author: updated_by,
|
|
19634
19634
|
body: newBody,
|
|
19635
19635
|
parent_id: null,
|
|
@@ -19639,67 +19639,67 @@ function createBeadsAdapter(db, projectKey) {
|
|
|
19639
19639
|
},
|
|
19640
19640
|
async deleteComment(projectKeyParam, commentId, deleted_by, options, projectPath) {
|
|
19641
19641
|
const event = {
|
|
19642
|
-
type: "
|
|
19642
|
+
type: "cell_comment_deleted",
|
|
19643
19643
|
project_key: projectKeyParam,
|
|
19644
|
-
|
|
19644
|
+
cell_id: "",
|
|
19645
19645
|
timestamp: Date.now(),
|
|
19646
19646
|
comment_id: commentId,
|
|
19647
19647
|
deleted_by,
|
|
19648
19648
|
reason: options?.reason || null
|
|
19649
19649
|
};
|
|
19650
|
-
await
|
|
19650
|
+
await appendCellEvent(event, projectPath, db);
|
|
19651
19651
|
},
|
|
19652
|
-
async getComments(projectKeyParam,
|
|
19653
|
-
return getComments(db, projectKeyParam,
|
|
19652
|
+
async getComments(projectKeyParam, cellId, projectPath) {
|
|
19653
|
+
return getComments(db, projectKeyParam, cellId);
|
|
19654
19654
|
},
|
|
19655
19655
|
async addChildToEpic(projectKeyParam, epicId, childId, options, projectPath) {
|
|
19656
19656
|
const event = {
|
|
19657
|
-
type: "
|
|
19657
|
+
type: "cell_epic_child_added",
|
|
19658
19658
|
project_key: projectKeyParam,
|
|
19659
|
-
|
|
19659
|
+
cell_id: epicId,
|
|
19660
19660
|
timestamp: Date.now(),
|
|
19661
19661
|
child_id: childId,
|
|
19662
19662
|
child_index: options?.child_index || null,
|
|
19663
19663
|
added_by: options?.added_by || null
|
|
19664
19664
|
};
|
|
19665
|
-
await
|
|
19665
|
+
await appendCellEvent(event, projectPath, db);
|
|
19666
19666
|
},
|
|
19667
19667
|
async removeChildFromEpic(projectKeyParam, epicId, childId, options, projectPath) {
|
|
19668
19668
|
const event = {
|
|
19669
|
-
type: "
|
|
19669
|
+
type: "cell_epic_child_removed",
|
|
19670
19670
|
project_key: projectKeyParam,
|
|
19671
|
-
|
|
19671
|
+
cell_id: epicId,
|
|
19672
19672
|
timestamp: Date.now(),
|
|
19673
19673
|
child_id: childId,
|
|
19674
19674
|
reason: options?.reason || null,
|
|
19675
19675
|
removed_by: options?.removed_by || null
|
|
19676
19676
|
};
|
|
19677
|
-
await
|
|
19677
|
+
await appendCellEvent(event, projectPath, db);
|
|
19678
19678
|
},
|
|
19679
19679
|
async getEpicChildren(projectKeyParam, epicId, projectPath) {
|
|
19680
|
-
return
|
|
19680
|
+
return queryCells(db, projectKeyParam, { parent_id: epicId });
|
|
19681
19681
|
},
|
|
19682
19682
|
async isEpicClosureEligible(projectKeyParam, epicId, projectPath) {
|
|
19683
|
-
const children = await
|
|
19683
|
+
const children = await queryCells(db, projectKeyParam, { parent_id: epicId });
|
|
19684
19684
|
return children.every((child) => child.status === "closed");
|
|
19685
19685
|
},
|
|
19686
|
-
async
|
|
19687
|
-
return
|
|
19686
|
+
async getNextReadyCell(projectKeyParam, projectPath) {
|
|
19687
|
+
return getNextReadyCell(db, projectKeyParam);
|
|
19688
19688
|
},
|
|
19689
|
-
async
|
|
19690
|
-
return
|
|
19689
|
+
async getInProgressCells(projectKeyParam, projectPath) {
|
|
19690
|
+
return getInProgressCells(db, projectKeyParam);
|
|
19691
19691
|
},
|
|
19692
|
-
async
|
|
19693
|
-
return
|
|
19692
|
+
async getBlockedCells(projectKeyParam, projectPath) {
|
|
19693
|
+
return getBlockedCells(db, projectKeyParam);
|
|
19694
19694
|
},
|
|
19695
|
-
async markDirty(projectKeyParam,
|
|
19696
|
-
await markBeadDirty(db, projectKeyParam,
|
|
19695
|
+
async markDirty(projectKeyParam, cellId, projectPath) {
|
|
19696
|
+
await markBeadDirty(db, projectKeyParam, cellId);
|
|
19697
19697
|
},
|
|
19698
|
-
async
|
|
19699
|
-
return
|
|
19698
|
+
async getDirtyCells(projectKeyParam, projectPath) {
|
|
19699
|
+
return getDirtyCells(db, projectKeyParam);
|
|
19700
19700
|
},
|
|
19701
|
-
async clearDirty(projectKeyParam,
|
|
19702
|
-
await clearDirtyBead(db, projectKeyParam,
|
|
19701
|
+
async clearDirty(projectKeyParam, cellId, projectPath) {
|
|
19702
|
+
await clearDirtyBead(db, projectKeyParam, cellId);
|
|
19703
19703
|
},
|
|
19704
19704
|
async runMigrations(projectPath) {
|
|
19705
19705
|
const { beadsMigration: beadsMigration2 } = await Promise.resolve().then(() => (init_migrations2(), exports_migrations2));
|
|
@@ -19721,7 +19721,7 @@ function createBeadsAdapter(db, projectKey) {
|
|
|
19721
19721
|
throw error45;
|
|
19722
19722
|
}
|
|
19723
19723
|
},
|
|
19724
|
-
async
|
|
19724
|
+
async getCellsStats(projectPath) {
|
|
19725
19725
|
const [totalResult, openResult, inProgressResult, blockedResult, closedResult] = await Promise.all([
|
|
19726
19726
|
db.query("SELECT COUNT(*) as count FROM beads WHERE project_key = $1", [projectKey]),
|
|
19727
19727
|
db.query("SELECT COUNT(*) as count FROM beads WHERE project_key = $1 AND status = 'open'", [projectKey]),
|
|
@@ -19735,7 +19735,7 @@ function createBeadsAdapter(db, projectKey) {
|
|
|
19735
19735
|
by_type[row.type] = parseInt(row.count);
|
|
19736
19736
|
}
|
|
19737
19737
|
return {
|
|
19738
|
-
|
|
19738
|
+
total_cells: parseInt(totalResult.rows[0]?.count || "0"),
|
|
19739
19739
|
open: parseInt(openResult.rows[0]?.count || "0"),
|
|
19740
19740
|
in_progress: parseInt(inProgressResult.rows[0]?.count || "0"),
|
|
19741
19741
|
blocked: parseInt(blockedResult.rows[0]?.count || "0"),
|
|
@@ -19769,25 +19769,25 @@ function generateBeadId(projectKey) {
|
|
|
19769
19769
|
return `bd-${hash2}-${timestamp}${random}`;
|
|
19770
19770
|
}
|
|
19771
19771
|
|
|
19772
|
-
// src/
|
|
19772
|
+
// src/hive/index.ts
|
|
19773
19773
|
init_migrations2();
|
|
19774
19774
|
|
|
19775
|
-
// src/
|
|
19776
|
-
async function
|
|
19775
|
+
// src/hive/labels.ts
|
|
19776
|
+
async function getCellsByLabel(db, projectKey, label) {
|
|
19777
19777
|
const result = await db.query(`SELECT b.* FROM beads b
|
|
19778
|
-
JOIN bead_labels bl ON b.id = bl.
|
|
19778
|
+
JOIN bead_labels bl ON b.id = bl.cell_id
|
|
19779
19779
|
WHERE b.project_key = $1 AND bl.label = $2 AND b.deleted_at IS NULL
|
|
19780
19780
|
ORDER BY b.priority DESC, b.created_at ASC`, [projectKey, label]);
|
|
19781
19781
|
return result.rows;
|
|
19782
19782
|
}
|
|
19783
19783
|
async function getAllLabels(db, projectKey) {
|
|
19784
19784
|
const result = await db.query(`SELECT DISTINCT bl.label FROM bead_labels bl
|
|
19785
|
-
JOIN beads b ON bl.
|
|
19785
|
+
JOIN beads b ON bl.cell_id = b.id
|
|
19786
19786
|
WHERE b.project_key = $1 AND b.deleted_at IS NULL
|
|
19787
19787
|
ORDER BY bl.label`, [projectKey]);
|
|
19788
19788
|
return result.rows.map((r) => r.label);
|
|
19789
19789
|
}
|
|
19790
|
-
// src/
|
|
19790
|
+
// src/hive/comments.ts
|
|
19791
19791
|
async function getCommentById(db, commentId) {
|
|
19792
19792
|
const result = await db.query(`SELECT * FROM bead_comments WHERE id = $1`, [commentId]);
|
|
19793
19793
|
return result.rows[0] ?? null;
|
|
@@ -19806,10 +19806,10 @@ async function getCommentThread(db, rootCommentId) {
|
|
|
19806
19806
|
SELECT * FROM thread ORDER BY created_at ASC`, [rootCommentId]);
|
|
19807
19807
|
return result.rows;
|
|
19808
19808
|
}
|
|
19809
|
-
// src/
|
|
19809
|
+
// src/hive/jsonl.ts
|
|
19810
19810
|
import { createHash as createHash2 } from "node:crypto";
|
|
19811
|
-
function serializeToJSONL(
|
|
19812
|
-
return JSON.stringify(
|
|
19811
|
+
function serializeToJSONL(cell) {
|
|
19812
|
+
return JSON.stringify(cell);
|
|
19813
19813
|
}
|
|
19814
19814
|
function parseJSONL(jsonl) {
|
|
19815
19815
|
if (!jsonl || jsonl.trim() === "") {
|
|
@@ -19817,23 +19817,23 @@ function parseJSONL(jsonl) {
|
|
|
19817
19817
|
}
|
|
19818
19818
|
const lines = jsonl.split(`
|
|
19819
19819
|
`);
|
|
19820
|
-
const
|
|
19820
|
+
const cells = [];
|
|
19821
19821
|
for (const line of lines) {
|
|
19822
19822
|
const trimmed = line.trim();
|
|
19823
19823
|
if (trimmed === "") {
|
|
19824
19824
|
continue;
|
|
19825
19825
|
}
|
|
19826
19826
|
try {
|
|
19827
|
-
const
|
|
19828
|
-
|
|
19827
|
+
const cell = JSON.parse(trimmed);
|
|
19828
|
+
cells.push(cell);
|
|
19829
19829
|
} catch (err) {
|
|
19830
19830
|
throw new Error(`Invalid JSON in JSONL: ${err instanceof Error ? err.message : String(err)}`);
|
|
19831
19831
|
}
|
|
19832
19832
|
}
|
|
19833
|
-
return
|
|
19833
|
+
return cells;
|
|
19834
19834
|
}
|
|
19835
|
-
function computeContentHash(
|
|
19836
|
-
const canonical = JSON.stringify(
|
|
19835
|
+
function computeContentHash(cell) {
|
|
19836
|
+
const canonical = JSON.stringify(cell, Object.keys(cell).sort());
|
|
19837
19837
|
return createHash2("sha256").update(canonical).digest("hex");
|
|
19838
19838
|
}
|
|
19839
19839
|
async function exportToJSONL(adapter, projectKey, options = {}) {
|
|
@@ -19844,12 +19844,12 @@ async function exportToJSONL(adapter, projectKey, options = {}) {
|
|
|
19844
19844
|
if (!options.includeDeleted) {
|
|
19845
19845
|
conditions.push("deleted_at IS NULL");
|
|
19846
19846
|
}
|
|
19847
|
-
if (options.
|
|
19847
|
+
if (options.cellIds && options.cellIds.length > 0) {
|
|
19848
19848
|
conditions.push(`id = ANY($${paramIndex++})`);
|
|
19849
|
-
params.push(options.
|
|
19849
|
+
params.push(options.cellIds);
|
|
19850
19850
|
}
|
|
19851
19851
|
const query = `
|
|
19852
|
-
SELECT * FROM
|
|
19852
|
+
SELECT * FROM cells
|
|
19853
19853
|
WHERE ${conditions.join(" AND ")}
|
|
19854
19854
|
ORDER BY id ASC
|
|
19855
19855
|
`;
|
|
@@ -19871,7 +19871,7 @@ async function exportToJSONL(adapter, projectKey, options = {}) {
|
|
|
19871
19871
|
author: c.author,
|
|
19872
19872
|
text: c.body
|
|
19873
19873
|
}));
|
|
19874
|
-
const
|
|
19874
|
+
const cellExport = {
|
|
19875
19875
|
id: bead.id,
|
|
19876
19876
|
title: bead.title,
|
|
19877
19877
|
description: bead.description || undefined,
|
|
@@ -19887,51 +19887,51 @@ async function exportToJSONL(adapter, projectKey, options = {}) {
|
|
|
19887
19887
|
labels,
|
|
19888
19888
|
comments: commentExports
|
|
19889
19889
|
};
|
|
19890
|
-
lines.push(serializeToJSONL(
|
|
19890
|
+
lines.push(serializeToJSONL(cellExport));
|
|
19891
19891
|
}
|
|
19892
19892
|
return lines.join(`
|
|
19893
19893
|
`);
|
|
19894
19894
|
}
|
|
19895
19895
|
async function exportDirtyBeads(adapter, projectKey) {
|
|
19896
19896
|
const db = await adapter.getDatabase();
|
|
19897
|
-
const dirtyIds = await
|
|
19897
|
+
const dirtyIds = await getDirtyCells(db, projectKey);
|
|
19898
19898
|
if (dirtyIds.length === 0) {
|
|
19899
|
-
return { jsonl: "",
|
|
19899
|
+
return { jsonl: "", cellIds: [] };
|
|
19900
19900
|
}
|
|
19901
19901
|
const jsonl = await exportToJSONL(adapter, projectKey, {
|
|
19902
|
-
|
|
19902
|
+
cellIds: dirtyIds
|
|
19903
19903
|
});
|
|
19904
|
-
return { jsonl,
|
|
19904
|
+
return { jsonl, cellIds: dirtyIds };
|
|
19905
19905
|
}
|
|
19906
19906
|
async function importFromJSONL(adapter, projectKey, jsonl, options = {}) {
|
|
19907
|
-
const
|
|
19907
|
+
const cells = parseJSONL(jsonl);
|
|
19908
19908
|
const result = {
|
|
19909
19909
|
created: 0,
|
|
19910
19910
|
updated: 0,
|
|
19911
19911
|
skipped: 0,
|
|
19912
19912
|
errors: []
|
|
19913
19913
|
};
|
|
19914
|
-
for (const
|
|
19914
|
+
for (const cellExport of cells) {
|
|
19915
19915
|
try {
|
|
19916
|
-
await
|
|
19916
|
+
await importSingleCell(adapter, projectKey, cellExport, options, result);
|
|
19917
19917
|
} catch (err) {
|
|
19918
19918
|
result.errors.push({
|
|
19919
|
-
|
|
19919
|
+
cellId: cellExport.id,
|
|
19920
19920
|
error: err instanceof Error ? err.message : String(err)
|
|
19921
19921
|
});
|
|
19922
19922
|
}
|
|
19923
19923
|
}
|
|
19924
19924
|
return result;
|
|
19925
19925
|
}
|
|
19926
|
-
async function
|
|
19927
|
-
const existing = await adapter.
|
|
19926
|
+
async function importSingleCell(adapter, projectKey, cellExport, options, result) {
|
|
19927
|
+
const existing = await adapter.getCell(projectKey, cellExport.id);
|
|
19928
19928
|
if (existing && options.skipExisting) {
|
|
19929
19929
|
result.skipped++;
|
|
19930
19930
|
return;
|
|
19931
19931
|
}
|
|
19932
19932
|
if (existing) {
|
|
19933
19933
|
const existingHash = await computeBeadHash(adapter, projectKey, existing.id);
|
|
19934
|
-
const importHash = computeContentHash(
|
|
19934
|
+
const importHash = computeContentHash(cellExport);
|
|
19935
19935
|
if (existingHash === importHash) {
|
|
19936
19936
|
result.skipped++;
|
|
19937
19937
|
return;
|
|
@@ -19947,124 +19947,124 @@ async function importSingleBead(adapter, projectKey, beadExport, options, result
|
|
|
19947
19947
|
}
|
|
19948
19948
|
if (!existing) {
|
|
19949
19949
|
const db = await adapter.getDatabase();
|
|
19950
|
-
const status =
|
|
19950
|
+
const status = cellExport.status === "tombstone" ? "closed" : cellExport.status;
|
|
19951
19951
|
const isClosed = status === "closed";
|
|
19952
|
-
const closedAt = isClosed ?
|
|
19953
|
-
await db.query(`INSERT INTO
|
|
19952
|
+
const closedAt = isClosed ? cellExport.closed_at ? new Date(cellExport.closed_at).getTime() : new Date(cellExport.updated_at).getTime() : null;
|
|
19953
|
+
await db.query(`INSERT INTO cells (
|
|
19954
19954
|
id, project_key, type, status, title, description, priority,
|
|
19955
19955
|
parent_id, assignee, created_at, updated_at, closed_at
|
|
19956
19956
|
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)`, [
|
|
19957
|
-
|
|
19957
|
+
cellExport.id,
|
|
19958
19958
|
projectKey,
|
|
19959
|
-
|
|
19959
|
+
cellExport.issue_type,
|
|
19960
19960
|
status,
|
|
19961
|
-
|
|
19962
|
-
|
|
19963
|
-
|
|
19964
|
-
|
|
19965
|
-
|
|
19966
|
-
new Date(
|
|
19967
|
-
new Date(
|
|
19961
|
+
cellExport.title,
|
|
19962
|
+
cellExport.description || null,
|
|
19963
|
+
cellExport.priority,
|
|
19964
|
+
cellExport.parent_id || null,
|
|
19965
|
+
cellExport.assignee || null,
|
|
19966
|
+
new Date(cellExport.created_at).getTime(),
|
|
19967
|
+
new Date(cellExport.updated_at).getTime(),
|
|
19968
19968
|
closedAt
|
|
19969
19969
|
]);
|
|
19970
|
-
if (
|
|
19971
|
-
await db.query("UPDATE beads SET deleted_at = $1 WHERE id = $2", [Date.now(),
|
|
19970
|
+
if (cellExport.status === "tombstone") {
|
|
19971
|
+
await db.query("UPDATE beads SET deleted_at = $1 WHERE id = $2", [Date.now(), cellExport.id]);
|
|
19972
19972
|
}
|
|
19973
19973
|
result.created++;
|
|
19974
19974
|
} else {
|
|
19975
|
-
await adapter.
|
|
19976
|
-
title:
|
|
19977
|
-
description:
|
|
19978
|
-
priority:
|
|
19979
|
-
assignee:
|
|
19975
|
+
await adapter.updateCell(projectKey, cellExport.id, {
|
|
19976
|
+
title: cellExport.title,
|
|
19977
|
+
description: cellExport.description,
|
|
19978
|
+
priority: cellExport.priority,
|
|
19979
|
+
assignee: cellExport.assignee
|
|
19980
19980
|
});
|
|
19981
|
-
if (existing.status !==
|
|
19982
|
-
if (
|
|
19983
|
-
await adapter.
|
|
19984
|
-
} else if (
|
|
19981
|
+
if (existing.status !== cellExport.status) {
|
|
19982
|
+
if (cellExport.status === "closed") {
|
|
19983
|
+
await adapter.closeCell(projectKey, cellExport.id, "imported");
|
|
19984
|
+
} else if (cellExport.status === "in_progress") {
|
|
19985
19985
|
const db = await adapter.getDatabase();
|
|
19986
|
-
await db.query("UPDATE beads SET status = $1, updated_at = $2 WHERE id = $3", ["in_progress", Date.now(),
|
|
19986
|
+
await db.query("UPDATE beads SET status = $1, updated_at = $2 WHERE id = $3", ["in_progress", Date.now(), cellExport.id]);
|
|
19987
19987
|
}
|
|
19988
19988
|
}
|
|
19989
19989
|
result.updated++;
|
|
19990
19990
|
}
|
|
19991
|
-
await importDependencies(adapter, projectKey,
|
|
19992
|
-
await importLabels(adapter, projectKey,
|
|
19993
|
-
await importComments(adapter, projectKey,
|
|
19991
|
+
await importDependencies(adapter, projectKey, cellExport);
|
|
19992
|
+
await importLabels(adapter, projectKey, cellExport);
|
|
19993
|
+
await importComments(adapter, projectKey, cellExport);
|
|
19994
19994
|
}
|
|
19995
|
-
async function computeBeadHash(adapter, projectKey,
|
|
19995
|
+
async function computeBeadHash(adapter, projectKey, cellId) {
|
|
19996
19996
|
const db = await adapter.getDatabase();
|
|
19997
|
-
const beadResult = await db.query("SELECT * FROM beads WHERE project_key = $1 AND id = $2", [projectKey,
|
|
19998
|
-
const
|
|
19999
|
-
if (!
|
|
20000
|
-
throw new Error(`
|
|
19997
|
+
const beadResult = await db.query("SELECT * FROM beads WHERE project_key = $1 AND id = $2", [projectKey, cellId]);
|
|
19998
|
+
const cell = beadResult.rows[0];
|
|
19999
|
+
if (!cell) {
|
|
20000
|
+
throw new Error(`Cell not found: ${cellId}`);
|
|
20001
20001
|
}
|
|
20002
|
-
const deps = await getDependencies(db, projectKey,
|
|
20002
|
+
const deps = await getDependencies(db, projectKey, cellId);
|
|
20003
20003
|
const dependencies = deps.map((d) => ({
|
|
20004
20004
|
depends_on_id: d.depends_on_id,
|
|
20005
20005
|
type: d.relationship
|
|
20006
20006
|
}));
|
|
20007
|
-
const labels = await getLabels(db, projectKey,
|
|
20008
|
-
const comments = await getComments(db, projectKey,
|
|
20007
|
+
const labels = await getLabels(db, projectKey, cellId);
|
|
20008
|
+
const comments = await getComments(db, projectKey, cellId);
|
|
20009
20009
|
const commentExports = comments.map((c) => ({
|
|
20010
20010
|
author: c.author,
|
|
20011
20011
|
text: c.body
|
|
20012
20012
|
}));
|
|
20013
|
-
const
|
|
20014
|
-
id:
|
|
20015
|
-
title:
|
|
20016
|
-
description:
|
|
20017
|
-
status:
|
|
20018
|
-
priority:
|
|
20019
|
-
issue_type:
|
|
20020
|
-
created_at: new Date(
|
|
20021
|
-
updated_at: new Date(
|
|
20022
|
-
closed_at:
|
|
20023
|
-
assignee:
|
|
20024
|
-
parent_id:
|
|
20013
|
+
const cellExport = {
|
|
20014
|
+
id: cell.id,
|
|
20015
|
+
title: cell.title,
|
|
20016
|
+
description: cell.description || undefined,
|
|
20017
|
+
status: cell.deleted_at ? "tombstone" : cell.status,
|
|
20018
|
+
priority: cell.priority,
|
|
20019
|
+
issue_type: cell.type,
|
|
20020
|
+
created_at: new Date(cell.created_at).toISOString(),
|
|
20021
|
+
updated_at: new Date(cell.updated_at).toISOString(),
|
|
20022
|
+
closed_at: cell.closed_at ? new Date(cell.closed_at).toISOString() : undefined,
|
|
20023
|
+
assignee: cell.assignee || undefined,
|
|
20024
|
+
parent_id: cell.parent_id || undefined,
|
|
20025
20025
|
dependencies,
|
|
20026
20026
|
labels,
|
|
20027
20027
|
comments: commentExports
|
|
20028
20028
|
};
|
|
20029
|
-
return computeContentHash(
|
|
20029
|
+
return computeContentHash(cellExport);
|
|
20030
20030
|
}
|
|
20031
|
-
async function importDependencies(adapter, projectKey,
|
|
20032
|
-
if (!
|
|
20031
|
+
async function importDependencies(adapter, projectKey, cellExport) {
|
|
20032
|
+
if (!cellExport.dependencies || cellExport.dependencies.length === 0) {
|
|
20033
20033
|
return;
|
|
20034
20034
|
}
|
|
20035
20035
|
const db = await adapter.getDatabase();
|
|
20036
|
-
await db.query("DELETE FROM
|
|
20037
|
-
|
|
20036
|
+
await db.query("DELETE FROM cell_dependencies WHERE cell_id = $1", [
|
|
20037
|
+
cellExport.id
|
|
20038
20038
|
]);
|
|
20039
|
-
for (const dep of
|
|
20040
|
-
await adapter.addDependency(projectKey,
|
|
20039
|
+
for (const dep of cellExport.dependencies) {
|
|
20040
|
+
await adapter.addDependency(projectKey, cellExport.id, dep.depends_on_id, dep.type);
|
|
20041
20041
|
}
|
|
20042
20042
|
}
|
|
20043
|
-
async function importLabels(adapter, projectKey,
|
|
20044
|
-
if (!
|
|
20043
|
+
async function importLabels(adapter, projectKey, cellExport) {
|
|
20044
|
+
if (!cellExport.labels || cellExport.labels.length === 0) {
|
|
20045
20045
|
return;
|
|
20046
20046
|
}
|
|
20047
20047
|
const db = await adapter.getDatabase();
|
|
20048
|
-
await db.query("DELETE FROM
|
|
20049
|
-
|
|
20048
|
+
await db.query("DELETE FROM cell_labels WHERE cell_id = $1", [
|
|
20049
|
+
cellExport.id
|
|
20050
20050
|
]);
|
|
20051
|
-
for (const label of
|
|
20052
|
-
await adapter.addLabel(projectKey,
|
|
20051
|
+
for (const label of cellExport.labels) {
|
|
20052
|
+
await adapter.addLabel(projectKey, cellExport.id, label);
|
|
20053
20053
|
}
|
|
20054
20054
|
}
|
|
20055
|
-
async function importComments(adapter, projectKey,
|
|
20056
|
-
if (!
|
|
20055
|
+
async function importComments(adapter, projectKey, cellExport) {
|
|
20056
|
+
if (!cellExport.comments || cellExport.comments.length === 0) {
|
|
20057
20057
|
return;
|
|
20058
20058
|
}
|
|
20059
20059
|
const db = await adapter.getDatabase();
|
|
20060
|
-
await db.query("DELETE FROM
|
|
20061
|
-
|
|
20060
|
+
await db.query("DELETE FROM cell_comments WHERE cell_id = $1", [
|
|
20061
|
+
cellExport.id
|
|
20062
20062
|
]);
|
|
20063
|
-
for (const comment of
|
|
20064
|
-
await adapter.addComment(projectKey,
|
|
20063
|
+
for (const comment of cellExport.comments) {
|
|
20064
|
+
await adapter.addComment(projectKey, cellExport.id, comment.author, comment.text);
|
|
20065
20065
|
}
|
|
20066
20066
|
}
|
|
20067
|
-
// src/
|
|
20067
|
+
// src/hive/flush-manager.ts
|
|
20068
20068
|
import { writeFile as writeFile2 } from "node:fs/promises";
|
|
20069
20069
|
class FlushManager {
|
|
20070
20070
|
adapter;
|
|
@@ -20095,7 +20095,7 @@ class FlushManager {
|
|
|
20095
20095
|
const startTime = Date.now();
|
|
20096
20096
|
if (this.flushing) {
|
|
20097
20097
|
return {
|
|
20098
|
-
|
|
20098
|
+
cellsExported: 0,
|
|
20099
20099
|
bytesWritten: 0,
|
|
20100
20100
|
duration: 0
|
|
20101
20101
|
};
|
|
@@ -20106,10 +20106,10 @@ class FlushManager {
|
|
|
20106
20106
|
clearTimeout(this.timer);
|
|
20107
20107
|
this.timer = null;
|
|
20108
20108
|
}
|
|
20109
|
-
const { jsonl,
|
|
20110
|
-
if (
|
|
20109
|
+
const { jsonl, cellIds } = await exportDirtyBeads(this.adapter, this.projectKey);
|
|
20110
|
+
if (cellIds.length === 0) {
|
|
20111
20111
|
return {
|
|
20112
|
-
|
|
20112
|
+
cellsExported: 0,
|
|
20113
20113
|
bytesWritten: 0,
|
|
20114
20114
|
duration: Date.now() - startTime
|
|
20115
20115
|
};
|
|
@@ -20117,11 +20117,11 @@ class FlushManager {
|
|
|
20117
20117
|
await writeFile2(this.outputPath, jsonl, "utf-8");
|
|
20118
20118
|
const bytesWritten = Buffer.byteLength(jsonl, "utf-8");
|
|
20119
20119
|
const db = await this.adapter.getDatabase();
|
|
20120
|
-
for (const
|
|
20121
|
-
await clearDirtyBead(db, this.projectKey,
|
|
20120
|
+
for (const cellId of cellIds) {
|
|
20121
|
+
await clearDirtyBead(db, this.projectKey, cellId);
|
|
20122
20122
|
}
|
|
20123
20123
|
const result = {
|
|
20124
|
-
|
|
20124
|
+
cellsExported: cellIds.length,
|
|
20125
20125
|
bytesWritten,
|
|
20126
20126
|
duration: Date.now() - startTime
|
|
20127
20127
|
};
|
|
@@ -20140,30 +20140,30 @@ class FlushManager {
|
|
|
20140
20140
|
}
|
|
20141
20141
|
}
|
|
20142
20142
|
}
|
|
20143
|
-
// src/
|
|
20143
|
+
// src/hive/merge.ts
|
|
20144
20144
|
var DEFAULT_TOMBSTONE_TTL_MS = 30 * 24 * 60 * 60 * 1000;
|
|
20145
20145
|
var MIN_TOMBSTONE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
20146
20146
|
var CLOCK_SKEW_GRACE_MS = 60 * 60 * 1000;
|
|
20147
20147
|
var STATUS_TOMBSTONE = "tombstone";
|
|
20148
|
-
function makeKey(
|
|
20148
|
+
function makeKey(cell) {
|
|
20149
20149
|
const key = {
|
|
20150
|
-
id:
|
|
20151
|
-
createdAt:
|
|
20150
|
+
id: cell.id,
|
|
20151
|
+
createdAt: cell.created_at,
|
|
20152
20152
|
createdBy: undefined
|
|
20153
20153
|
};
|
|
20154
20154
|
return JSON.stringify(key);
|
|
20155
20155
|
}
|
|
20156
|
-
function isTombstone(
|
|
20157
|
-
return
|
|
20156
|
+
function isTombstone(cell) {
|
|
20157
|
+
return cell.status === STATUS_TOMBSTONE;
|
|
20158
20158
|
}
|
|
20159
|
-
function isExpiredTombstone(
|
|
20160
|
-
if (!isTombstone(
|
|
20159
|
+
function isExpiredTombstone(cell, ttlMs = DEFAULT_TOMBSTONE_TTL_MS) {
|
|
20160
|
+
if (!isTombstone(cell)) {
|
|
20161
20161
|
return false;
|
|
20162
20162
|
}
|
|
20163
|
-
if (!
|
|
20163
|
+
if (!cell.closed_at) {
|
|
20164
20164
|
return false;
|
|
20165
20165
|
}
|
|
20166
|
-
const deletedAt = new Date(
|
|
20166
|
+
const deletedAt = new Date(cell.closed_at).getTime();
|
|
20167
20167
|
if (Number.isNaN(deletedAt)) {
|
|
20168
20168
|
return false;
|
|
20169
20169
|
}
|
|
@@ -20482,7 +20482,7 @@ export {
|
|
|
20482
20482
|
reserveAgentFiles,
|
|
20483
20483
|
replayEventsBatched2 as replayEventsBatched,
|
|
20484
20484
|
replayEvents,
|
|
20485
|
-
|
|
20485
|
+
replayCellEvents,
|
|
20486
20486
|
releaseSwarmFiles,
|
|
20487
20487
|
releaseAgentFiles,
|
|
20488
20488
|
registerAgent,
|
|
@@ -20490,9 +20490,9 @@ export {
|
|
|
20490
20490
|
rebuildAllBlockedCaches,
|
|
20491
20491
|
readSwarmMessage,
|
|
20492
20492
|
readEvents,
|
|
20493
|
-
|
|
20493
|
+
readCellEvents,
|
|
20494
20494
|
readAgentMessage,
|
|
20495
|
-
|
|
20495
|
+
queryCells,
|
|
20496
20496
|
parseJSONL,
|
|
20497
20497
|
migrations,
|
|
20498
20498
|
mergeJsonl,
|
|
@@ -20520,16 +20520,16 @@ export {
|
|
|
20520
20520
|
getPidFilePath,
|
|
20521
20521
|
getPendingMigrations,
|
|
20522
20522
|
getOpenBlockers,
|
|
20523
|
-
|
|
20523
|
+
getNextReadyCell,
|
|
20524
20524
|
getMessage,
|
|
20525
20525
|
getLatestSequence,
|
|
20526
20526
|
getLabels,
|
|
20527
20527
|
getInbox,
|
|
20528
|
-
|
|
20528
|
+
getInProgressCells,
|
|
20529
20529
|
getEventTimeline,
|
|
20530
20530
|
getEvalStats,
|
|
20531
20531
|
getEvalRecords,
|
|
20532
|
-
|
|
20532
|
+
getDirtyCells,
|
|
20533
20533
|
getDependents,
|
|
20534
20534
|
getDependencies,
|
|
20535
20535
|
getDatabaseStats,
|
|
@@ -20539,10 +20539,10 @@ export {
|
|
|
20539
20539
|
getComments,
|
|
20540
20540
|
getCommentThread,
|
|
20541
20541
|
getCommentById,
|
|
20542
|
+
getCellsByLabel,
|
|
20543
|
+
getCell,
|
|
20542
20544
|
getBlockers,
|
|
20543
|
-
|
|
20544
|
-
getBeadsByLabel,
|
|
20545
|
-
getBead,
|
|
20545
|
+
getBlockedCells,
|
|
20546
20546
|
getAppliedMigrations,
|
|
20547
20547
|
getAllLabels,
|
|
20548
20548
|
getAgents,
|
|
@@ -20558,8 +20558,9 @@ export {
|
|
|
20558
20558
|
createSwarmMailAdapter,
|
|
20559
20559
|
createSocketAdapter,
|
|
20560
20560
|
createInMemorySwarmMail,
|
|
20561
|
+
createHiveAdapter,
|
|
20561
20562
|
createEvent,
|
|
20562
|
-
createBeadsAdapter,
|
|
20563
|
+
createHiveAdapter as createBeadsAdapter,
|
|
20563
20564
|
computeContentHash,
|
|
20564
20565
|
closeSwarmMail,
|
|
20565
20566
|
closeDatabase,
|
|
@@ -20574,7 +20575,7 @@ export {
|
|
|
20574
20575
|
beadsMigration,
|
|
20575
20576
|
appendEvents,
|
|
20576
20577
|
appendEvent,
|
|
20577
|
-
|
|
20578
|
+
appendCellEvent,
|
|
20578
20579
|
acknowledgeSwarmMessage,
|
|
20579
20580
|
acknowledgeMessage,
|
|
20580
20581
|
TaskStartedEventSchema,
|