opencode-swarm-plugin 0.59.1 → 0.60.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/README.md +14 -1
- package/bin/commands/doctor.test.ts +622 -0
- package/bin/commands/doctor.ts +658 -0
- package/bin/commands/status.test.ts +506 -0
- package/bin/commands/status.ts +520 -0
- package/bin/commands/tree.ts +39 -3
- package/bin/swarm.ts +19 -3
- package/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/claude-plugin/commands/swarm.md +125 -2
- package/claude-plugin/dist/index.js +669 -308
- package/claude-plugin/dist/schemas/cell.d.ts +2 -0
- package/claude-plugin/dist/schemas/cell.d.ts.map +1 -1
- package/claude-plugin/dist/utils/adapter-cache.d.ts +36 -0
- package/claude-plugin/dist/utils/adapter-cache.d.ts.map +1 -0
- package/claude-plugin/dist/utils/event-utils.d.ts +31 -0
- package/claude-plugin/dist/utils/event-utils.d.ts.map +1 -0
- package/claude-plugin/dist/utils/git-commit-info.d.ts +10 -0
- package/claude-plugin/dist/utils/git-commit-info.d.ts.map +1 -0
- package/claude-plugin/dist/utils/tree-renderer.d.ts +69 -13
- package/claude-plugin/dist/utils/tree-renderer.d.ts.map +1 -1
- package/dist/bin/swarm.js +2664 -980
- package/dist/cass-tools.d.ts.map +1 -1
- package/dist/dashboard.d.ts.map +1 -1
- package/dist/hive.d.ts +8 -0
- package/dist/hive.d.ts.map +1 -1
- package/dist/hive.js +81 -101
- package/dist/hivemind-tools.d.ts.map +1 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +458 -311
- package/dist/marketplace/index.js +669 -308
- package/dist/memory-tools.d.ts.map +1 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/plugin.js +456 -308
- package/dist/replay-tools.d.ts +5 -1
- package/dist/replay-tools.d.ts.map +1 -1
- package/dist/schemas/cell.d.ts +2 -0
- package/dist/schemas/cell.d.ts.map +1 -1
- package/dist/skills.d.ts +4 -0
- package/dist/skills.d.ts.map +1 -1
- package/dist/storage.d.ts +7 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/swarm-mail.d.ts +2 -2
- package/dist/swarm-mail.d.ts.map +1 -1
- package/dist/swarm-orchestrate.d.ts +12 -0
- package/dist/swarm-orchestrate.d.ts.map +1 -1
- package/dist/swarm-prompts.d.ts +1 -1
- package/dist/swarm-prompts.d.ts.map +1 -1
- package/dist/swarm-prompts.js +408 -274
- package/dist/swarm-verify.d.ts +100 -0
- package/dist/swarm-verify.d.ts.map +1 -0
- package/dist/swarm.d.ts +19 -1
- package/dist/swarm.d.ts.map +1 -1
- package/dist/test-utils/msw-server.d.ts +21 -0
- package/dist/test-utils/msw-server.d.ts.map +1 -0
- package/dist/utils/adapter-cache.d.ts +36 -0
- package/dist/utils/adapter-cache.d.ts.map +1 -0
- package/dist/utils/event-utils.d.ts +31 -0
- package/dist/utils/event-utils.d.ts.map +1 -0
- package/dist/utils/git-commit-info.d.ts +10 -0
- package/dist/utils/git-commit-info.d.ts.map +1 -0
- package/dist/utils/tree-renderer.d.ts +69 -13
- package/dist/utils/tree-renderer.d.ts.map +1 -1
- package/package.json +3 -2
|
@@ -23844,6 +23844,9 @@ class LibSQLAdapter {
|
|
|
23844
23844
|
async close() {
|
|
23845
23845
|
this.client.close();
|
|
23846
23846
|
}
|
|
23847
|
+
async checkpoint() {
|
|
23848
|
+
await this.client.execute("PRAGMA wal_checkpoint(TRUNCATE)");
|
|
23849
|
+
}
|
|
23847
23850
|
}
|
|
23848
23851
|
async function createLibSQLAdapter(config22) {
|
|
23849
23852
|
let url3 = config22.url;
|
|
@@ -23860,6 +23863,7 @@ async function createLibSQLAdapter(config22) {
|
|
|
23860
23863
|
await client.execute("PRAGMA foreign_keys = ON");
|
|
23861
23864
|
await client.execute("PRAGMA busy_timeout = 5000");
|
|
23862
23865
|
await client.execute("PRAGMA journal_mode = WAL");
|
|
23866
|
+
await client.execute("PRAGMA wal_checkpoint(TRUNCATE)");
|
|
23863
23867
|
return new LibSQLAdapter(client);
|
|
23864
23868
|
}
|
|
23865
23869
|
async function createLibSQLMemorySchema(db) {
|
|
@@ -27796,6 +27800,16 @@ function drizzle(...params) {
|
|
|
27796
27800
|
}
|
|
27797
27801
|
return construct(params[0], params[1]);
|
|
27798
27802
|
}
|
|
27803
|
+
function getEmbeddingDimension(model) {
|
|
27804
|
+
const envDim = process.env.OLLAMA_EMBED_DIM;
|
|
27805
|
+
if (envDim) {
|
|
27806
|
+
const parsed = Number.parseInt(envDim, 10);
|
|
27807
|
+
if (!Number.isNaN(parsed) && parsed > 0) {
|
|
27808
|
+
return parsed;
|
|
27809
|
+
}
|
|
27810
|
+
}
|
|
27811
|
+
return MODEL_DIMENSIONS[model] ?? 1024;
|
|
27812
|
+
}
|
|
27799
27813
|
function createDrizzleClient(client) {
|
|
27800
27814
|
return drizzle(client, { schema: exports_schema });
|
|
27801
27815
|
}
|
|
@@ -27992,6 +28006,11 @@ function withLock3(resource, effect4, config22) {
|
|
|
27992
28006
|
return yield* _(service4.withLock(resource, effect4, config22));
|
|
27993
28007
|
});
|
|
27994
28008
|
}
|
|
28009
|
+
async function cleanupExpiredReservations(db2, projectKey) {
|
|
28010
|
+
const now3 = Date.now();
|
|
28011
|
+
const result = await db2.update(reservationsTable).set({ released_at: now3 }).where(and3(eq(reservationsTable.project_key, projectKey), sql`${reservationsTable.released_at} IS NULL`, sql`${reservationsTable.expires_at} < ${now3}`));
|
|
28012
|
+
return result.rowsAffected ?? 0;
|
|
28013
|
+
}
|
|
27995
28014
|
async function getAgentsDrizzle(db2, projectKey) {
|
|
27996
28015
|
const result = await db2.select().from(agentsTable).where(eq(agentsTable.project_key, projectKey)).orderBy(agentsTable.registered_at);
|
|
27997
28016
|
return result.map((row) => ({
|
|
@@ -28088,7 +28107,7 @@ async function getThreadMessagesDrizzle(db2, projectKey, threadId) {
|
|
|
28088
28107
|
}
|
|
28089
28108
|
async function getActiveReservationsDrizzle(db2, projectKey, agentName) {
|
|
28090
28109
|
const now3 = Date.now();
|
|
28091
|
-
await db2
|
|
28110
|
+
await cleanupExpiredReservations(db2, projectKey);
|
|
28092
28111
|
const conditions2 = [
|
|
28093
28112
|
eq(reservationsTable.project_key, projectKey),
|
|
28094
28113
|
sql`${reservationsTable.released_at} IS NULL`,
|
|
@@ -28789,12 +28808,10 @@ async function reserveSwarmFiles(options2) {
|
|
|
28789
28808
|
} = options2;
|
|
28790
28809
|
const { getOrCreateAdapter: getOrCreateAdapter3 } = await Promise.resolve().then(() => (init_store_drizzle(), exports_store_drizzle));
|
|
28791
28810
|
const { toDrizzleDb: toDrizzleDb2 } = await Promise.resolve().then(() => (init_libsql_convenience(), exports_libsql_convenience));
|
|
28792
|
-
const {
|
|
28793
|
-
const { eq: eq2, and: and4, sql: sql4 } = await Promise.resolve().then(() => (init_drizzle_orm(), exports_drizzle_orm));
|
|
28811
|
+
const { cleanupExpiredReservations: cleanupExpiredReservations2 } = await Promise.resolve().then(() => (init_reservation_utils(), exports_reservation_utils));
|
|
28794
28812
|
const adapter5 = await getOrCreateAdapter3(projectPath, dbOverride);
|
|
28795
28813
|
const swarmDb = toDrizzleDb2(adapter5);
|
|
28796
|
-
|
|
28797
|
-
await swarmDb.update(reservationsTable2).set({ released_at: now3 }).where(and4(eq2(reservationsTable2.project_key, projectPath), sql4`${reservationsTable2.released_at} IS NULL`, sql4`${reservationsTable2.expires_at} < ${now3}`));
|
|
28814
|
+
await cleanupExpiredReservations2(swarmDb, projectPath);
|
|
28798
28815
|
const conflicts = await checkConflicts2(projectPath, agentName, paths, projectPath, dbOverride);
|
|
28799
28816
|
const reserveEvent = createEvent("file_reserved", {
|
|
28800
28817
|
project_key: projectPath,
|
|
@@ -28828,12 +28845,10 @@ async function releaseSwarmFiles(options2) {
|
|
|
28828
28845
|
const { projectPath, agentName, paths, reservationIds, dbOverride } = options2;
|
|
28829
28846
|
const { getOrCreateAdapter: getOrCreateAdapter3 } = await Promise.resolve().then(() => (init_store_drizzle(), exports_store_drizzle));
|
|
28830
28847
|
const { toDrizzleDb: toDrizzleDb2 } = await Promise.resolve().then(() => (init_libsql_convenience(), exports_libsql_convenience));
|
|
28831
|
-
const {
|
|
28832
|
-
const { eq: eq2, and: and4, sql: sql4 } = await Promise.resolve().then(() => (init_drizzle_orm(), exports_drizzle_orm));
|
|
28848
|
+
const { cleanupExpiredReservations: cleanupExpiredReservations2 } = await Promise.resolve().then(() => (init_reservation_utils(), exports_reservation_utils));
|
|
28833
28849
|
const adapter5 = await getOrCreateAdapter3(projectPath, dbOverride);
|
|
28834
28850
|
const swarmDb = toDrizzleDb2(adapter5);
|
|
28835
|
-
|
|
28836
|
-
await swarmDb.update(reservationsTable2).set({ released_at: now3 }).where(and4(eq2(reservationsTable2.project_key, projectPath), sql4`${reservationsTable2.released_at} IS NULL`, sql4`${reservationsTable2.expires_at} < ${now3}`));
|
|
28851
|
+
await cleanupExpiredReservations2(swarmDb, projectPath);
|
|
28837
28852
|
const currentReservations = await getActiveReservations2(projectPath, projectPath, agentName, dbOverride);
|
|
28838
28853
|
let releaseCount = 0;
|
|
28839
28854
|
if (paths && paths.length > 0) {
|
|
@@ -29494,6 +29509,9 @@ async function withTiming(operation, fn2) {
|
|
|
29494
29509
|
}
|
|
29495
29510
|
}
|
|
29496
29511
|
function getDatabasePath2(projectPath) {
|
|
29512
|
+
if (process.env.SWARM_DB_PATH) {
|
|
29513
|
+
return process.env.SWARM_DB_PATH;
|
|
29514
|
+
}
|
|
29497
29515
|
const globalDir = join12(homedir2(), ".config", "swarm-tools");
|
|
29498
29516
|
if (!existsSync4(globalDir)) {
|
|
29499
29517
|
mkdirSync(globalDir, { recursive: true });
|
|
@@ -30413,12 +30431,18 @@ async function handleCellStatusChangedDrizzle(db2, event) {
|
|
|
30413
30431
|
await db2.update(beads).set(updates).where(eq(beads.id, event.cell_id));
|
|
30414
30432
|
}
|
|
30415
30433
|
async function handleBeadClosedDrizzle(db2, event) {
|
|
30416
|
-
|
|
30434
|
+
const setFields = {
|
|
30417
30435
|
status: "closed",
|
|
30418
30436
|
closed_at: event.timestamp,
|
|
30419
30437
|
closed_reason: event.reason,
|
|
30420
30438
|
updated_at: event.timestamp
|
|
30421
|
-
}
|
|
30439
|
+
};
|
|
30440
|
+
const result = event.result;
|
|
30441
|
+
if (result) {
|
|
30442
|
+
setFields.result = result;
|
|
30443
|
+
setFields.result_at = event.timestamp;
|
|
30444
|
+
}
|
|
30445
|
+
await db2.update(beads).set(setFields).where(eq(beads.id, event.cell_id));
|
|
30422
30446
|
const { invalidateBlockedCacheDrizzle: invalidateBlockedCacheDrizzle2 } = await Promise.resolve().then(() => (init_dependencies_drizzle(), exports_dependencies_drizzle));
|
|
30423
30447
|
await invalidateBlockedCacheDrizzle2(db2, event.project_key, event.cell_id);
|
|
30424
30448
|
}
|
|
@@ -30670,6 +30694,10 @@ function createMemoryStore(db2) {
|
|
|
30670
30694
|
},
|
|
30671
30695
|
async ftsSearch(searchQuery, options2 = {}) {
|
|
30672
30696
|
const { limit = 10, collection } = options2;
|
|
30697
|
+
if (!searchQuery || typeof searchQuery !== "string") {
|
|
30698
|
+
console.warn("[store] ftsSearch called with invalid query, returning empty results");
|
|
30699
|
+
return [];
|
|
30700
|
+
}
|
|
30673
30701
|
const quotedQuery = `"${searchQuery.replace(/"/g, '""')}"`;
|
|
30674
30702
|
const conditions2 = collection ? sql`fts.content MATCH ${quotedQuery} AND m.collection = ${collection}` : sql`fts.content MATCH ${quotedQuery}`;
|
|
30675
30703
|
const results = await db2.all(sql`
|
|
@@ -38026,10 +38054,44 @@ async function getRelationshipsForEntity(entityId, db2, direction = "both") {
|
|
|
38026
38054
|
createdAt: new Date(row.created_at)
|
|
38027
38055
|
}));
|
|
38028
38056
|
}
|
|
38057
|
+
function chunkText(text4, maxChars, overlap) {
|
|
38058
|
+
if (text4.length <= maxChars) {
|
|
38059
|
+
return [text4];
|
|
38060
|
+
}
|
|
38061
|
+
const chunks3 = [];
|
|
38062
|
+
let start5 = 0;
|
|
38063
|
+
while (start5 < text4.length) {
|
|
38064
|
+
const end7 = Math.min(start5 + maxChars, text4.length);
|
|
38065
|
+
chunks3.push(text4.slice(start5, end7));
|
|
38066
|
+
start5 += maxChars - overlap;
|
|
38067
|
+
}
|
|
38068
|
+
return chunks3;
|
|
38069
|
+
}
|
|
38029
38070
|
function createMemoryAdapter(db2, config3) {
|
|
38030
38071
|
const store = createMemoryStore(db2);
|
|
38031
38072
|
const ollamaLayer = makeOllamaLive(config3);
|
|
38032
38073
|
const generateEmbedding = async (text4) => {
|
|
38074
|
+
if (text4.length > MAX_CHARS_PER_CHUNK) {
|
|
38075
|
+
console.warn(`⚠️ Text length (${text4.length} chars) exceeds limit (${MAX_CHARS_PER_CHUNK} chars). Auto-chunking into smaller segments for embedding.`);
|
|
38076
|
+
const chunks3 = chunkText(text4, MAX_CHARS_PER_CHUNK, CHUNK_OVERLAP);
|
|
38077
|
+
const embeddings = [];
|
|
38078
|
+
for (const chunk7 of chunks3) {
|
|
38079
|
+
const program2 = exports_Effect.gen(function* () {
|
|
38080
|
+
const ollama = yield* Ollama;
|
|
38081
|
+
return yield* ollama.embed(chunk7);
|
|
38082
|
+
});
|
|
38083
|
+
const result2 = await exports_Effect.runPromise(program2.pipe(exports_Effect.provide(ollamaLayer), exports_Effect.either));
|
|
38084
|
+
if (result2._tag === "Left") {
|
|
38085
|
+
return null;
|
|
38086
|
+
}
|
|
38087
|
+
embeddings.push(result2.right);
|
|
38088
|
+
}
|
|
38089
|
+
const avgEmbedding = embeddings[0].map((_, i) => {
|
|
38090
|
+
const sum8 = embeddings.reduce((acc, emb) => acc + emb[i], 0);
|
|
38091
|
+
return sum8 / embeddings.length;
|
|
38092
|
+
});
|
|
38093
|
+
return avgEmbedding;
|
|
38094
|
+
}
|
|
38033
38095
|
const program = exports_Effect.gen(function* () {
|
|
38034
38096
|
const ollama = yield* Ollama;
|
|
38035
38097
|
return yield* ollama.embed(text4);
|
|
@@ -39661,7 +39723,8 @@ function createHiveAdapter(db2, projectKey) {
|
|
|
39661
39723
|
reason,
|
|
39662
39724
|
closed_by: options2?.closed_by || null,
|
|
39663
39725
|
files_touched: options2?.files_touched || null,
|
|
39664
|
-
duration_ms: options2?.duration_ms || null
|
|
39726
|
+
duration_ms: options2?.duration_ms || null,
|
|
39727
|
+
result: options2?.result || null
|
|
39665
39728
|
};
|
|
39666
39729
|
await appendCellEvent(event, projectPath, db2);
|
|
39667
39730
|
const updated = await getCell(db2, projectKeyParam, cellId);
|
|
@@ -40262,7 +40325,7 @@ async function importSingleCell(adapter5, projectKey, cellExport, options2, resu
|
|
|
40262
40325
|
const status3 = cellExport.status === "tombstone" ? "closed" : cellExport.status;
|
|
40263
40326
|
const isClosed = status3 === "closed";
|
|
40264
40327
|
const closedAt = isClosed ? cellExport.closed_at ? new Date(cellExport.closed_at).getTime() : new Date(cellExport.updated_at).getTime() : null;
|
|
40265
|
-
await db2.query(`INSERT INTO
|
|
40328
|
+
await db2.query(`INSERT INTO beads (
|
|
40266
40329
|
id, project_key, type, status, title, description, priority,
|
|
40267
40330
|
parent_id, assignee, created_at, updated_at, closed_at
|
|
40268
40331
|
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)`, [
|
|
@@ -40827,7 +40890,9 @@ async function findCellsByPartialIdDrizzle(adapter5, projectKey, partialId) {
|
|
|
40827
40890
|
deleted_at: row.deleted_at,
|
|
40828
40891
|
deleted_by: row.deleted_by,
|
|
40829
40892
|
delete_reason: row.delete_reason,
|
|
40830
|
-
created_by: row.created_by
|
|
40893
|
+
created_by: row.created_by,
|
|
40894
|
+
result: row.result ?? null,
|
|
40895
|
+
result_at: row.result_at ?? null
|
|
40831
40896
|
}));
|
|
40832
40897
|
}
|
|
40833
40898
|
async function resolvePartialIdDrizzle(adapter5, projectKey, partialHash) {
|
|
@@ -59946,17 +60011,7 @@ ${prefix}}`;
|
|
|
59946
60011
|
unionAll,
|
|
59947
60012
|
intersect: intersect7,
|
|
59948
60013
|
except
|
|
59949
|
-
}), union17, unionAll, intersect7, except, init_select2, QueryBuilder, init_query_builder2, SQLiteInsertBuilder, SQLiteInsertBase, init_insert, SQLiteUpdateBuilder, SQLiteUpdateBase, init_update, init_query_builders, SQLiteCountBuilder, init_count, RelationalQueryBuilder, SQLiteRelationalQuery, SQLiteSyncRelationalQuery, init_query2, SQLiteRaw, init_raw, BaseSQLiteDatabase, init_db, init_alias2 = () => {}, init_checks3 = () => {}, IndexBuilderOn, IndexBuilder, Index, init_indexes, PrimaryKeyBuilder2, PrimaryKey2, init_primary_keys2, ExecuteResultSync, SQLitePreparedQuery, SQLiteSession, SQLiteTransaction, init_session, init_utils2 = () => {}, init_view = () => {}, init_sqlite_core, LibSQLSession, LibSQLTransaction, LibSQLPreparedQuery, init_session2, LibSQLDatabase, init_driver_core, init_driver, init_libsql2,
|
|
59950
|
-
dataType() {
|
|
59951
|
-
return `F32_BLOB(${dimension})`;
|
|
59952
|
-
},
|
|
59953
|
-
toDriver(value10) {
|
|
59954
|
-
return Buffer.from(new Float32Array(value10).buffer);
|
|
59955
|
-
},
|
|
59956
|
-
fromDriver(value10) {
|
|
59957
|
-
return Array.from(new Float32Array(value10.buffer));
|
|
59958
|
-
}
|
|
59959
|
-
}), memories, memoryLinks, entities, relationships, memoryEntities, init_memory, init_expressions2, exports_drizzle_orm, init_drizzle_orm, exports_streams, eventsTable, agentsTable, messagesTable, messageRecipientsTable, reservationsTable, locksTable, cursorsTable, evalRecordsTable, swarmContextsTable, decisionTracesTable, entityLinksTable, init_streams, exports_hive, beads, cells, cellEvents, beadLabels, cellLabels, beadComments, cellComments, beadDependencies, cellDependencies, blockedBeadsCache, dirtyBeads, schemaVersion, init_hive, exports_schema, init_schema, init_drizzle, require_entity, require_logger, require_query_promise, require_column, require_column_builder, require_table_utils, require_foreign_keys, require_tracing_utils, require_unique_constraint, require_array, require_common2, require_enum, require_subquery, require_version, require_tracing, require_view_common, require_table, require_sql, require_alias, require_selection_proxy, require_utils, require_delete, require_casing, require_errors, require_int_common, require_bigint, require_bigserial, require_boolean, require_char, require_cidr, require_custom, require_date_common, require_date, require_double_precision, require_inet, require_integer, require_interval, require_json, require_jsonb, require_line, require_macaddr, require_macaddr8, require_numeric, require_point, require_utils2, require_geometry, require_real, require_serial, require_smallint, require_smallserial, require_text, require_time, require_timestamp, require_uuid, require_varchar, require_bit, require_halfvec, require_sparsevec, require_vector, require_columns, require_all, require_table2, require_primary_keys, require_conditions, require_select, require_expressions, require_relations, require_aggregate, require_vector2, require_functions, require_sql2, require_view_base, require_dialect, require_query_builder, require_select2, require_query_builder2, require_insert, require_refresh_materialized_view, require_select_types, require_update, require_query_builders, require_count, require_query, require_raw, require_db, require_alias2, require_checks, require_indexes, require_policies, require_roles, require_sequence, require_view_common2, require_view, require_schema, require_session, require_subquery2, require_utils3, require_utils4, require_pg_core, require_session2, require_driver, require_pglite, exports_libsql_convenience, instances, init_libsql_convenience, exports_lock, DurableLock, DurableLockLive, init_lock, init_projections_drizzle, exports_store_drizzle, init_store_drizzle, exports_swarm_mail, MAX_INBOX_LIMIT = 5, DEFAULT_TTL_SECONDS = 3600, ADJECTIVES, NOUNS, init_swarm_mail, MAX_INBOX_LIMIT2 = 5, DEFAULT_TTL_SECONDS2 = 3600, ADJECTIVES2, NOUNS2, init_agent_mail, exports_migrations, beadsMigration, cellsViewMigration, cellsViewMigrationLibSQL, beadsMigrationLibSQL, beadsMigrations, hiveMigrations, sessionsMigrationLibSQL, hiveMigrationsLibSQL, init_migrations, memoryMigration, memoryMigrations, init_migrations2, exports_migrations2, migrations, init_migrations3, urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", POOL_SIZE_MULTIPLIER = 128, pool, poolOffset, init_nanoid = () => {}, init_decision_trace_store, ClientBuffer, init_client_buffer, exports_streams2, SLOW_QUERY_THRESHOLD_MS = 100, init_streams2, exports_store, adapterCache, TIMESTAMP_SAFE_UNTIL, init_store, init_adapter, exports_dependencies_drizzle, MAX_DEPENDENCY_DEPTH = 100, init_dependencies_drizzle, exports_projections_drizzle, init_projections_drizzle2, exports_dependencies, MAX_DEPENDENCY_DEPTH2 = 100, EMBEDDING_DIM2 = 1024, init_store2, OllamaError, Ollama, makeOllamaLive = (config22) => exports_Layer.succeed(Ollama, (() => {
|
|
60014
|
+
}), union17, unionAll, intersect7, except, init_select2, QueryBuilder, init_query_builder2, SQLiteInsertBuilder, SQLiteInsertBase, init_insert, SQLiteUpdateBuilder, SQLiteUpdateBase, init_update, init_query_builders, SQLiteCountBuilder, init_count, RelationalQueryBuilder, SQLiteRelationalQuery, SQLiteSyncRelationalQuery, init_query2, SQLiteRaw, init_raw, BaseSQLiteDatabase, init_db, init_alias2 = () => {}, init_checks3 = () => {}, IndexBuilderOn, IndexBuilder, Index, init_indexes, PrimaryKeyBuilder2, PrimaryKey2, init_primary_keys2, ExecuteResultSync, SQLitePreparedQuery, SQLiteSession, SQLiteTransaction, init_session, init_utils2 = () => {}, init_view = () => {}, init_sqlite_core, LibSQLSession, LibSQLTransaction, LibSQLPreparedQuery, init_session2, LibSQLDatabase, init_driver_core, init_driver, init_libsql2, MODEL_DIMENSIONS, EMBEDDING_DIM2, OllamaError, Ollama, makeOllamaLive = (config22) => exports_Layer.succeed(Ollama, (() => {
|
|
59960
60015
|
const embedSingle = (text3) => exports_Effect.gen(function* () {
|
|
59961
60016
|
const response = yield* exports_Effect.tryPromise({
|
|
59962
60017
|
try: () => fetch(`${config22.ollamaHost}/api/embeddings`, {
|
|
@@ -60010,7 +60065,17 @@ ${prefix}}`;
|
|
|
60010
60065
|
})()), getDefaultConfig = () => ({
|
|
60011
60066
|
ollamaHost: process.env.OLLAMA_HOST || "http://localhost:11434",
|
|
60012
60067
|
ollamaModel: process.env.OLLAMA_MODEL || "mxbai-embed-large"
|
|
60013
|
-
}), init_ollama,
|
|
60068
|
+
}), init_ollama, vector2 = (dimension) => customType({
|
|
60069
|
+
dataType() {
|
|
60070
|
+
return `F32_BLOB(${dimension})`;
|
|
60071
|
+
},
|
|
60072
|
+
toDriver(value10) {
|
|
60073
|
+
return Buffer.from(new Float32Array(value10).buffer);
|
|
60074
|
+
},
|
|
60075
|
+
fromDriver(value10) {
|
|
60076
|
+
return Array.from(new Float32Array(value10.buffer));
|
|
60077
|
+
}
|
|
60078
|
+
}), memories, memoryLinks, entities, relationships, memoryEntities, init_memory, init_expressions2, exports_drizzle_orm, init_drizzle_orm, exports_streams, eventsTable, agentsTable, messagesTable, messageRecipientsTable, reservationsTable, locksTable, cursorsTable, evalRecordsTable, swarmContextsTable, decisionTracesTable, entityLinksTable, init_streams, exports_hive, beads, cells, cellEvents, beadLabels, cellLabels, beadComments, cellComments, beadDependencies, cellDependencies, blockedBeadsCache, dirtyBeads, schemaVersion, init_hive, exports_schema, init_schema, init_drizzle, require_entity, require_logger, require_query_promise, require_column, require_column_builder, require_table_utils, require_foreign_keys, require_tracing_utils, require_unique_constraint, require_array, require_common2, require_enum, require_subquery, require_version, require_tracing, require_view_common, require_table, require_sql, require_alias, require_selection_proxy, require_utils, require_delete, require_casing, require_errors, require_int_common, require_bigint, require_bigserial, require_boolean, require_char, require_cidr, require_custom, require_date_common, require_date, require_double_precision, require_inet, require_integer, require_interval, require_json, require_jsonb, require_line, require_macaddr, require_macaddr8, require_numeric, require_point, require_utils2, require_geometry, require_real, require_serial, require_smallint, require_smallserial, require_text, require_time, require_timestamp, require_uuid, require_varchar, require_bit, require_halfvec, require_sparsevec, require_vector, require_columns, require_all, require_table2, require_primary_keys, require_conditions, require_select, require_expressions, require_relations, require_aggregate, require_vector2, require_functions, require_sql2, require_view_base, require_dialect, require_query_builder, require_select2, require_query_builder2, require_insert, require_refresh_materialized_view, require_select_types, require_update, require_query_builders, require_count, require_query, require_raw, require_db, require_alias2, require_checks, require_indexes, require_policies, require_roles, require_sequence, require_view_common2, require_view, require_schema, require_session, require_subquery2, require_utils3, require_utils4, require_pg_core, require_session2, require_driver, require_pglite, exports_libsql_convenience, instances, init_libsql_convenience, exports_lock, DurableLock, DurableLockLive, init_lock, exports_reservation_utils, init_reservation_utils, init_projections_drizzle, exports_store_drizzle, init_store_drizzle, exports_swarm_mail, MAX_INBOX_LIMIT = 5, DEFAULT_TTL_SECONDS = 3600, ADJECTIVES, NOUNS, init_swarm_mail, MAX_INBOX_LIMIT2 = 5, DEFAULT_TTL_SECONDS2 = 3600, ADJECTIVES2, NOUNS2, init_agent_mail, exports_migrations, beadsMigration, cellsViewMigration, cellsViewMigrationLibSQL, beadsMigrationLibSQL, beadsResultColumnsMigration, beadsResultColumnsMigrationLibSQL, beadsMigrations, hiveMigrations, sessionsMigrationLibSQL, hiveMigrationsLibSQL, init_migrations, memoryMigration, memoryMigrations, init_migrations2, exports_migrations2, migrations, init_migrations3, urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", POOL_SIZE_MULTIPLIER = 128, pool, poolOffset, init_nanoid = () => {}, init_decision_trace_store, ClientBuffer, init_client_buffer, exports_streams2, SLOW_QUERY_THRESHOLD_MS = 100, init_streams2, exports_store, adapterCache, TIMESTAMP_SAFE_UNTIL, init_store, init_adapter, exports_dependencies_drizzle, MAX_DEPENDENCY_DEPTH = 100, init_dependencies_drizzle, exports_projections_drizzle, init_projections_drizzle2, exports_dependencies, MAX_DEPENDENCY_DEPTH2 = 100, init_store2, FIELD_SETS, init_pagination, marker = "vercel.ai.error", symbol6, _a, _b, AISDKError, name2 = "AI_APICallError", marker2, symbol222, _a2, _b2, APICallError, name22 = "AI_EmptyResponseBodyError", marker3, symbol32, _a3, _b3, EmptyResponseBodyError, name3 = "AI_InvalidArgumentError", marker4, symbol42, _a4, _b4, InvalidArgumentError, name4 = "AI_InvalidPromptError", marker5, symbol52, _a5, _b5, InvalidPromptError, name5 = "AI_InvalidResponseDataError", marker6, symbol62, _a6, _b6, InvalidResponseDataError, name6 = "AI_JSONParseError", marker7, symbol7, _a7, _b7, JSONParseError, name7 = "AI_LoadAPIKeyError", marker8, symbol8, _a8, _b8, LoadAPIKeyError, name8 = "AI_LoadSettingError", marker9, symbol9, _a9, _b9, LoadSettingError, name9 = "AI_NoContentGeneratedError", marker10, symbol10, _a10, _b10, NoContentGeneratedError, name10 = "AI_NoSuchModelError", marker11, symbol11, _a11, _b11, NoSuchModelError, name11 = "AI_TooManyEmbeddingValuesForCallError", marker12, symbol12, _a12, _b12, TooManyEmbeddingValuesForCallError, name12 = "AI_TypeValidationError", marker13, symbol13, _a13, _b13, TypeValidationError, name13 = "AI_UnsupportedFunctionalityError", marker14, symbol14, _a14, _b14, UnsupportedFunctionalityError, init_dist3, NEVER22, $brand2, $ZodAsyncError2, globalConfig2, init_core32, exports_util2, captureStackTrace2, allowsEval2, getParsedType22 = (data) => {
|
|
60014
60079
|
const t = typeof data;
|
|
60015
60080
|
switch (t) {
|
|
60016
60081
|
case "undefined":
|
|
@@ -65782,7 +65847,7 @@ ${prefix}}`;
|
|
|
65782
65847
|
}
|
|
65783
65848
|
return this._output;
|
|
65784
65849
|
}
|
|
65785
|
-
}, JsonToSseTransformStream, uiMessageChunkSchema, originalGenerateId2, uiMessagesSchema, originalGenerateId3, originalGenerateId4, name142 = "AI_NoSuchProviderError", marker142, symbol142, _a142, init_dist6, exports_memory_operations, MemoryOperationSchema, init_memory_operations, exports_auto_tagger, AutoTagResultSchema, init_auto_tagger, exports_memory_linking, DEFAULT_CONFIG, init_memory_linking, exports_entity_extraction, EntitySchema, RelationshipSchema, ExtractionSchema, init_entity_extraction, init_adapter2, import_debug, log, CORS_HEADERS, HEARTBEAT_INTERVAL = 30000, checkpointFrequency, humanFeedback, recoverySuccess, scopeViolations, taskDuration, ANALYTICS_QUERIES, DEFAULT_TOMBSTONE_TTL_MS = 2592000000, MIN_TOMBSTONE_TTL_MS = 604800000, CLOCK_SKEW_GRACE_MS = 3600000, STATUS_TOMBSTONE = "tombstone", dbInstance, clientInstance, TABLE_COLUMNS, EntryTypes, defaultOptions2, RECURSIVE_ERROR_CODE = "READDIRP_RECURSIVE_ERROR", NORMAL_FLOW_ERRORS, ALL_TYPES, DIR_TYPES, FILE_TYPES, isNormalFlowError = (error432) => NORMAL_FLOW_ERRORS.has(error432.code), wantBigintFsStats, emptyFn = (_entryInfo) => true, normalizeFilter = (filter28) => {
|
|
65850
|
+
}, JsonToSseTransformStream, uiMessageChunkSchema, originalGenerateId2, uiMessagesSchema, originalGenerateId3, originalGenerateId4, name142 = "AI_NoSuchProviderError", marker142, symbol142, _a142, init_dist6, exports_memory_operations, MemoryOperationSchema, init_memory_operations, exports_auto_tagger, AutoTagResultSchema, init_auto_tagger, exports_memory_linking, DEFAULT_CONFIG, init_memory_linking, exports_entity_extraction, EntitySchema, RelationshipSchema, ExtractionSchema, init_entity_extraction, MAX_CHARS_PER_CHUNK = 24000, CHUNK_OVERLAP = 200, init_adapter2, import_debug, log, CORS_HEADERS, HEARTBEAT_INTERVAL = 30000, checkpointFrequency, humanFeedback, recoverySuccess, scopeViolations, taskDuration, ANALYTICS_QUERIES, DEFAULT_TOMBSTONE_TTL_MS = 2592000000, MIN_TOMBSTONE_TTL_MS = 604800000, CLOCK_SKEW_GRACE_MS = 3600000, STATUS_TOMBSTONE = "tombstone", dbInstance, clientInstance, TABLE_COLUMNS, EntryTypes, defaultOptions2, RECURSIVE_ERROR_CODE = "READDIRP_RECURSIVE_ERROR", NORMAL_FLOW_ERRORS, ALL_TYPES, DIR_TYPES, FILE_TYPES, isNormalFlowError = (error432) => NORMAL_FLOW_ERRORS.has(error432.code), wantBigintFsStats, emptyFn = (_entryInfo) => true, normalizeFilter = (filter28) => {
|
|
65786
65851
|
if (filter28 === undefined)
|
|
65787
65852
|
return emptyFn;
|
|
65788
65853
|
if (typeof filter28 === "function")
|
|
@@ -65947,7 +66012,7 @@ ${prefix}}`;
|
|
|
65947
66012
|
return path22;
|
|
65948
66013
|
}
|
|
65949
66014
|
return sp2.join(cwd, path22);
|
|
65950
|
-
}, EMPTY_SET, STAT_METHOD_F = "stat", STAT_METHOD_L = "lstat", FSWatcher, chokidar_default, FileWatcher, NormalizedMessageSchema, OpenCodeSwarmEventSchema, SWARM_MAIL_VERSION = "1.10.
|
|
66015
|
+
}, EMPTY_SET, STAT_METHOD_F = "stat", STAT_METHOD_L = "lstat", FSWatcher, chokidar_default, FileWatcher, NormalizedMessageSchema, OpenCodeSwarmEventSchema, SWARM_MAIL_VERSION = "1.10.4";
|
|
65951
66016
|
var init_dist2 = __esm(() => {
|
|
65952
66017
|
__create2 = Object.create;
|
|
65953
66018
|
__getProtoOf2 = Object.getPrototypeOf;
|
|
@@ -106820,7 +106885,12 @@ ${stack.split(`
|
|
|
106820
106885
|
retry_count: exports_external2.number().min(0).default(0),
|
|
106821
106886
|
success: exports_external2.boolean(),
|
|
106822
106887
|
scope_violation: exports_external2.boolean().optional(),
|
|
106823
|
-
violation_files: exports_external2.array(exports_external2.string()).optional()
|
|
106888
|
+
violation_files: exports_external2.array(exports_external2.string()).optional(),
|
|
106889
|
+
commit: exports_external2.object({
|
|
106890
|
+
sha: exports_external2.string().optional(),
|
|
106891
|
+
message: exports_external2.string().optional(),
|
|
106892
|
+
branch: exports_external2.string().optional()
|
|
106893
|
+
}).optional()
|
|
106824
106894
|
});
|
|
106825
106895
|
HumanFeedbackEventSchema = BaseEventSchema.extend({
|
|
106826
106896
|
type: exports_external2.literal("human_feedback"),
|
|
@@ -110625,8 +110695,24 @@ ${stack.split(`
|
|
|
110625
110695
|
init_driver();
|
|
110626
110696
|
init_session2();
|
|
110627
110697
|
});
|
|
110698
|
+
init_ollama = __esm2(() => {
|
|
110699
|
+
init_esm();
|
|
110700
|
+
init_esm();
|
|
110701
|
+
MODEL_DIMENSIONS = {
|
|
110702
|
+
"mxbai-embed-large": 1024,
|
|
110703
|
+
"nomic-embed-text": 768,
|
|
110704
|
+
"all-minilm": 384,
|
|
110705
|
+
"snowflake-arctic-embed": 1024
|
|
110706
|
+
};
|
|
110707
|
+
EMBEDDING_DIM2 = getEmbeddingDimension(process.env.OLLAMA_MODEL || "mxbai-embed-large");
|
|
110708
|
+
OllamaError = class OllamaError2 extends exports_Schema.TaggedError()("OllamaError", { reason: exports_Schema.String }) {
|
|
110709
|
+
};
|
|
110710
|
+
Ollama = class Ollama2 extends exports_Context.Tag("swarm-mail/Ollama")() {
|
|
110711
|
+
};
|
|
110712
|
+
});
|
|
110628
110713
|
init_memory = __esm2(() => {
|
|
110629
110714
|
init_sqlite_core();
|
|
110715
|
+
init_ollama();
|
|
110630
110716
|
memories = sqliteTable("memories", {
|
|
110631
110717
|
id: text("id").primaryKey(),
|
|
110632
110718
|
content: text("content").notNull(),
|
|
@@ -110636,7 +110722,7 @@ ${stack.split(`
|
|
|
110636
110722
|
created_at: text("created_at").default("(datetime('now'))"),
|
|
110637
110723
|
updated_at: text("updated_at").default("(datetime('now'))"),
|
|
110638
110724
|
decay_factor: real("decay_factor").default(1),
|
|
110639
|
-
embedding: vector2(
|
|
110725
|
+
embedding: vector2(EMBEDDING_DIM2)("embedding"),
|
|
110640
110726
|
valid_from: text("valid_from"),
|
|
110641
110727
|
valid_until: text("valid_until"),
|
|
110642
110728
|
superseded_by: text("superseded_by"),
|
|
@@ -110875,7 +110961,8 @@ ${stack.split(`
|
|
|
110875
110961
|
}, (table5) => ({
|
|
110876
110962
|
projectIdx: index("idx_messages_project").on(table5.project_key),
|
|
110877
110963
|
threadIdIdx: index("idx_messages_thread").on(table5.thread_id),
|
|
110878
|
-
createdIdx: index("idx_messages_created").on(table5.created_at)
|
|
110964
|
+
createdIdx: index("idx_messages_created").on(table5.created_at),
|
|
110965
|
+
senderTimeIdx: index("idx_messages_sender_time").on(table5.project_key, table5.from_agent, table5.created_at)
|
|
110879
110966
|
}));
|
|
110880
110967
|
messageRecipientsTable = sqliteTable("message_recipients", {
|
|
110881
110968
|
message_id: integer4("message_id").notNull(),
|
|
@@ -110899,7 +110986,8 @@ ${stack.split(`
|
|
|
110899
110986
|
}, (table5) => ({
|
|
110900
110987
|
projectIdx: index("idx_reservations_project").on(table5.project_key),
|
|
110901
110988
|
agentIdx: index("idx_reservations_agent").on(table5.agent_name),
|
|
110902
|
-
expiresIdx: index("idx_reservations_expires").on(table5.expires_at)
|
|
110989
|
+
expiresIdx: index("idx_reservations_expires").on(table5.expires_at),
|
|
110990
|
+
activeIdx: index("idx_reservations_active").on(table5.project_key, table5.released_at, table5.expires_at)
|
|
110903
110991
|
}));
|
|
110904
110992
|
locksTable = sqliteTable("locks", {
|
|
110905
110993
|
resource: text("resource").primaryKey(),
|
|
@@ -111029,7 +111117,9 @@ ${stack.split(`
|
|
|
111029
111117
|
deleted_at: integer4("deleted_at"),
|
|
111030
111118
|
deleted_by: text("deleted_by"),
|
|
111031
111119
|
delete_reason: text("delete_reason"),
|
|
111032
|
-
created_by: text("created_by")
|
|
111120
|
+
created_by: text("created_by"),
|
|
111121
|
+
result: text("result"),
|
|
111122
|
+
result_at: integer4("result_at")
|
|
111033
111123
|
}, (table5) => ({
|
|
111034
111124
|
projectIdx: index("idx_beads_project").on(table5.project_key),
|
|
111035
111125
|
statusIdx: index("idx_beads_status").on(table5.status),
|
|
@@ -119729,10 +119819,19 @@ ${stack.split(`
|
|
|
119729
119819
|
withLock: withLockImpl
|
|
119730
119820
|
});
|
|
119731
119821
|
});
|
|
119822
|
+
exports_reservation_utils = {};
|
|
119823
|
+
__export2(exports_reservation_utils, {
|
|
119824
|
+
cleanupExpiredReservations: () => cleanupExpiredReservations
|
|
119825
|
+
});
|
|
119826
|
+
init_reservation_utils = __esm2(() => {
|
|
119827
|
+
init_drizzle_orm();
|
|
119828
|
+
init_streams();
|
|
119829
|
+
});
|
|
119732
119830
|
init_projections_drizzle = __esm2(() => {
|
|
119733
119831
|
init_drizzle_orm();
|
|
119734
119832
|
init_esm3();
|
|
119735
119833
|
init_streams();
|
|
119834
|
+
init_reservation_utils();
|
|
119736
119835
|
});
|
|
119737
119836
|
exports_store_drizzle = {};
|
|
119738
119837
|
__export2(exports_store_drizzle, {
|
|
@@ -119852,6 +119951,8 @@ ${stack.split(`
|
|
|
119852
119951
|
hiveMigrations: () => hiveMigrations,
|
|
119853
119952
|
cellsViewMigrationLibSQL: () => cellsViewMigrationLibSQL,
|
|
119854
119953
|
cellsViewMigration: () => cellsViewMigration,
|
|
119954
|
+
beadsResultColumnsMigrationLibSQL: () => beadsResultColumnsMigrationLibSQL,
|
|
119955
|
+
beadsResultColumnsMigration: () => beadsResultColumnsMigration,
|
|
119855
119956
|
beadsMigrations: () => beadsMigrations,
|
|
119856
119957
|
beadsMigrationLibSQL: () => beadsMigrationLibSQL,
|
|
119857
119958
|
beadsMigration: () => beadsMigration
|
|
@@ -120238,10 +120339,128 @@ ${stack.split(`
|
|
|
120238
120339
|
DROP TABLE IF EXISTS bead_labels;
|
|
120239
120340
|
DROP TABLE IF EXISTS bead_dependencies;
|
|
120240
120341
|
DROP TABLE IF EXISTS beads;
|
|
120342
|
+
`
|
|
120343
|
+
};
|
|
120344
|
+
beadsResultColumnsMigration = {
|
|
120345
|
+
version: 10,
|
|
120346
|
+
description: "Add result and result_at columns to beads table",
|
|
120347
|
+
up: `
|
|
120348
|
+
ALTER TABLE beads ADD COLUMN result TEXT;
|
|
120349
|
+
ALTER TABLE beads ADD COLUMN result_at INTEGER;
|
|
120350
|
+
|
|
120351
|
+
-- Recreate cells view triggers to include new columns
|
|
120352
|
+
DROP TRIGGER IF EXISTS cells_insert;
|
|
120353
|
+
CREATE TRIGGER cells_insert
|
|
120354
|
+
INSTEAD OF INSERT ON cells
|
|
120355
|
+
FOR EACH ROW
|
|
120356
|
+
BEGIN
|
|
120357
|
+
INSERT INTO beads (id, project_key, type, status, title,
|
|
120358
|
+
description, priority, parent_id, assignee,
|
|
120359
|
+
created_at, updated_at, closed_at, closed_reason,
|
|
120360
|
+
deleted_at, deleted_by, delete_reason, created_by,
|
|
120361
|
+
result, result_at)
|
|
120362
|
+
VALUES (
|
|
120363
|
+
NEW.id, NEW.project_key, NEW.type, NEW.status, NEW.title,
|
|
120364
|
+
NEW.description, NEW.priority, NEW.parent_id, NEW.assignee,
|
|
120365
|
+
NEW.created_at, NEW.updated_at, NEW.closed_at, NEW.closed_reason,
|
|
120366
|
+
NEW.deleted_at, NEW.deleted_by, NEW.delete_reason, NEW.created_by,
|
|
120367
|
+
NEW.result, NEW.result_at
|
|
120368
|
+
);
|
|
120369
|
+
END;
|
|
120370
|
+
|
|
120371
|
+
DROP TRIGGER IF EXISTS cells_update;
|
|
120372
|
+
CREATE TRIGGER cells_update
|
|
120373
|
+
INSTEAD OF UPDATE ON cells
|
|
120374
|
+
FOR EACH ROW
|
|
120375
|
+
BEGIN
|
|
120376
|
+
UPDATE beads SET
|
|
120377
|
+
project_key = NEW.project_key,
|
|
120378
|
+
type = NEW.type,
|
|
120379
|
+
status = NEW.status,
|
|
120380
|
+
title = NEW.title,
|
|
120381
|
+
description = NEW.description,
|
|
120382
|
+
priority = NEW.priority,
|
|
120383
|
+
parent_id = NEW.parent_id,
|
|
120384
|
+
assignee = NEW.assignee,
|
|
120385
|
+
created_at = NEW.created_at,
|
|
120386
|
+
updated_at = NEW.updated_at,
|
|
120387
|
+
closed_at = NEW.closed_at,
|
|
120388
|
+
closed_reason = NEW.closed_reason,
|
|
120389
|
+
deleted_at = NEW.deleted_at,
|
|
120390
|
+
deleted_by = NEW.deleted_by,
|
|
120391
|
+
delete_reason = NEW.delete_reason,
|
|
120392
|
+
created_by = NEW.created_by,
|
|
120393
|
+
result = NEW.result,
|
|
120394
|
+
result_at = NEW.result_at
|
|
120395
|
+
WHERE id = NEW.id;
|
|
120396
|
+
END;
|
|
120397
|
+
`,
|
|
120398
|
+
down: `
|
|
120399
|
+
ALTER TABLE beads DROP COLUMN result;
|
|
120400
|
+
ALTER TABLE beads DROP COLUMN result_at;
|
|
120401
|
+
`
|
|
120402
|
+
};
|
|
120403
|
+
beadsResultColumnsMigrationLibSQL = {
|
|
120404
|
+
version: 10,
|
|
120405
|
+
description: "Add result and result_at columns to beads table (LibSQL)",
|
|
120406
|
+
up: `
|
|
120407
|
+
ALTER TABLE beads ADD COLUMN result TEXT;
|
|
120408
|
+
ALTER TABLE beads ADD COLUMN result_at INTEGER;
|
|
120409
|
+
|
|
120410
|
+
-- Recreate cells view triggers to include new columns
|
|
120411
|
+
DROP TRIGGER IF EXISTS cells_insert;
|
|
120412
|
+
CREATE TRIGGER cells_insert
|
|
120413
|
+
INSTEAD OF INSERT ON cells
|
|
120414
|
+
FOR EACH ROW
|
|
120415
|
+
BEGIN
|
|
120416
|
+
INSERT INTO beads (id, project_key, type, status, title,
|
|
120417
|
+
description, priority, parent_id, assignee,
|
|
120418
|
+
created_at, updated_at, closed_at, closed_reason,
|
|
120419
|
+
deleted_at, deleted_by, delete_reason, created_by,
|
|
120420
|
+
result, result_at)
|
|
120421
|
+
VALUES (
|
|
120422
|
+
NEW.id, NEW.project_key, NEW.type, NEW.status, NEW.title,
|
|
120423
|
+
NEW.description, NEW.priority, NEW.parent_id, NEW.assignee,
|
|
120424
|
+
NEW.created_at, NEW.updated_at, NEW.closed_at, NEW.closed_reason,
|
|
120425
|
+
NEW.deleted_at, NEW.deleted_by, NEW.delete_reason, NEW.created_by,
|
|
120426
|
+
NEW.result, NEW.result_at
|
|
120427
|
+
);
|
|
120428
|
+
END;
|
|
120429
|
+
|
|
120430
|
+
DROP TRIGGER IF EXISTS cells_update;
|
|
120431
|
+
CREATE TRIGGER cells_update
|
|
120432
|
+
INSTEAD OF UPDATE ON cells
|
|
120433
|
+
FOR EACH ROW
|
|
120434
|
+
BEGIN
|
|
120435
|
+
UPDATE beads SET
|
|
120436
|
+
project_key = NEW.project_key,
|
|
120437
|
+
type = NEW.type,
|
|
120438
|
+
status = NEW.status,
|
|
120439
|
+
title = NEW.title,
|
|
120440
|
+
description = NEW.description,
|
|
120441
|
+
priority = NEW.priority,
|
|
120442
|
+
parent_id = NEW.parent_id,
|
|
120443
|
+
assignee = NEW.assignee,
|
|
120444
|
+
created_at = NEW.created_at,
|
|
120445
|
+
updated_at = NEW.updated_at,
|
|
120446
|
+
closed_at = NEW.closed_at,
|
|
120447
|
+
closed_reason = NEW.closed_reason,
|
|
120448
|
+
deleted_at = NEW.deleted_at,
|
|
120449
|
+
deleted_by = NEW.deleted_by,
|
|
120450
|
+
delete_reason = NEW.delete_reason,
|
|
120451
|
+
created_by = NEW.created_by,
|
|
120452
|
+
result = NEW.result,
|
|
120453
|
+
result_at = NEW.result_at
|
|
120454
|
+
WHERE id = NEW.id;
|
|
120455
|
+
END;
|
|
120456
|
+
`,
|
|
120457
|
+
down: `
|
|
120458
|
+
-- SQLite doesn't support DROP COLUMN until 3.35.0
|
|
120459
|
+
-- Columns can be left as NULL if downgrade is needed
|
|
120241
120460
|
`
|
|
120242
120461
|
};
|
|
120243
120462
|
beadsMigrations = [beadsMigration];
|
|
120244
|
-
hiveMigrations = [beadsMigration, cellsViewMigration];
|
|
120463
|
+
hiveMigrations = [beadsMigration, cellsViewMigration, beadsResultColumnsMigration];
|
|
120245
120464
|
sessionsMigrationLibSQL = {
|
|
120246
120465
|
version: 9,
|
|
120247
120466
|
description: "Add sessions table for handoff notes (Chainlink pattern)",
|
|
@@ -120271,7 +120490,8 @@ ${stack.split(`
|
|
|
120271
120490
|
hiveMigrationsLibSQL = [
|
|
120272
120491
|
beadsMigrationLibSQL,
|
|
120273
120492
|
cellsViewMigrationLibSQL,
|
|
120274
|
-
sessionsMigrationLibSQL
|
|
120493
|
+
sessionsMigrationLibSQL,
|
|
120494
|
+
beadsResultColumnsMigrationLibSQL
|
|
120275
120495
|
];
|
|
120276
120496
|
});
|
|
120277
120497
|
init_migrations2 = __esm2(() => {
|
|
@@ -120940,14 +121160,7 @@ ${stack.split(`
|
|
|
120940
121160
|
init_store2 = __esm2(() => {
|
|
120941
121161
|
init_drizzle_orm();
|
|
120942
121162
|
init_memory();
|
|
120943
|
-
|
|
120944
|
-
init_ollama = __esm2(() => {
|
|
120945
|
-
init_esm();
|
|
120946
|
-
init_esm();
|
|
120947
|
-
OllamaError = class OllamaError2 extends exports_Schema.TaggedError()("OllamaError", { reason: exports_Schema.String }) {
|
|
120948
|
-
};
|
|
120949
|
-
Ollama = class Ollama2 extends exports_Context.Tag("swarm-mail/Ollama")() {
|
|
120950
|
-
};
|
|
121163
|
+
init_ollama();
|
|
120951
121164
|
});
|
|
120952
121165
|
init_pagination = __esm2(() => {
|
|
120953
121166
|
FIELD_SETS = {
|
|
@@ -144298,7 +144511,8 @@ Scripts run in the skill's directory with the project directory as an argument.`
|
|
|
144298
144511
|
args: {
|
|
144299
144512
|
skill: tool.schema.string().describe("Name of the skill"),
|
|
144300
144513
|
script: tool.schema.string().describe("Name of the script file to execute"),
|
|
144301
|
-
args: tool.schema.array(tool.schema.string()).optional().describe("Additional arguments to pass to the script")
|
|
144514
|
+
args: tool.schema.array(tool.schema.string()).optional().describe("Additional arguments to pass to the script"),
|
|
144515
|
+
timeout_ms: tool.schema.number().optional().describe("Timeout in milliseconds (default: 60000)")
|
|
144302
144516
|
},
|
|
144303
144517
|
async execute(args2, ctx) {
|
|
144304
144518
|
console.warn("[DEPRECATED] skills_execute is deprecated. OpenCode now provides native skills support. This tool will be removed in a future version.");
|
|
@@ -144311,7 +144525,7 @@ Scripts run in the skill's directory with the project directory as an argument.`
|
|
|
144311
144525
|
}
|
|
144312
144526
|
const scriptPath = join23(skill.directory, "scripts", args2.script);
|
|
144313
144527
|
const scriptArgs = args2.args || [];
|
|
144314
|
-
const TIMEOUT_MS = 60000;
|
|
144528
|
+
const TIMEOUT_MS = args2.timeout_ms ?? 60000;
|
|
144315
144529
|
const proc = Bun.spawn([scriptPath, skillsProjectDirectory, ...scriptArgs], {
|
|
144316
144530
|
cwd: skill.directory,
|
|
144317
144531
|
stdout: "pipe",
|
|
@@ -145214,6 +145428,7 @@ __export(exports_storage, {
|
|
|
145214
145428
|
resetStorage: () => resetStorage,
|
|
145215
145429
|
resetSessionStats: () => resetSessionStats,
|
|
145216
145430
|
resetCommandCache: () => resetCommandCache,
|
|
145431
|
+
resetAvailabilityCache: () => resetAvailabilityCache,
|
|
145217
145432
|
isSemanticMemoryAvailable: () => isSemanticMemoryAvailable,
|
|
145218
145433
|
getTestCollectionName: () => getTestCollectionName,
|
|
145219
145434
|
getStorage: () => getStorage,
|
|
@@ -145564,12 +145779,25 @@ function createStorage(config3 = {}) {
|
|
|
145564
145779
|
}
|
|
145565
145780
|
}
|
|
145566
145781
|
async function isSemanticMemoryAvailable() {
|
|
145567
|
-
|
|
145568
|
-
|
|
145569
|
-
|
|
145570
|
-
|
|
145571
|
-
|
|
145572
|
-
|
|
145782
|
+
if (_availabilityCache !== null)
|
|
145783
|
+
return _availabilityCache;
|
|
145784
|
+
if (_availabilityPromise)
|
|
145785
|
+
return _availabilityPromise;
|
|
145786
|
+
_availabilityPromise = (async () => {
|
|
145787
|
+
try {
|
|
145788
|
+
const result = await execSemanticMemory(["stats"]);
|
|
145789
|
+
_availabilityCache = result.exitCode === 0;
|
|
145790
|
+
} catch {
|
|
145791
|
+
_availabilityCache = false;
|
|
145792
|
+
}
|
|
145793
|
+
_availabilityPromise = null;
|
|
145794
|
+
return _availabilityCache;
|
|
145795
|
+
})();
|
|
145796
|
+
return _availabilityPromise;
|
|
145797
|
+
}
|
|
145798
|
+
function resetAvailabilityCache() {
|
|
145799
|
+
_availabilityCache = null;
|
|
145800
|
+
_availabilityPromise = null;
|
|
145573
145801
|
}
|
|
145574
145802
|
async function getResolvedCommand() {
|
|
145575
145803
|
return resolveSemanticMemoryCommand();
|
|
@@ -145605,7 +145833,7 @@ async function resetStorage() {
|
|
|
145605
145833
|
}
|
|
145606
145834
|
globalStoragePromise = null;
|
|
145607
145835
|
}
|
|
145608
|
-
var cachedCommand = null, DEFAULT_STORAGE_CONFIG, sessionStats, globalStorage = null, globalStoragePromise = null;
|
|
145836
|
+
var cachedCommand = null, DEFAULT_STORAGE_CONFIG, sessionStats, _availabilityCache = null, _availabilityPromise = null, globalStorage = null, globalStoragePromise = null;
|
|
145609
145837
|
var init_storage = __esm(() => {
|
|
145610
145838
|
init_learning();
|
|
145611
145839
|
init_anti_patterns();
|
|
@@ -145619,6 +145847,27 @@ var init_storage = __esm(() => {
|
|
|
145619
145847
|
};
|
|
145620
145848
|
});
|
|
145621
145849
|
|
|
145850
|
+
// src/utils/adapter-cache.ts
|
|
145851
|
+
class AdapterCache {
|
|
145852
|
+
cached = null;
|
|
145853
|
+
cachedPath = null;
|
|
145854
|
+
async get(projectPath, factory) {
|
|
145855
|
+
if (this.cached && this.cachedPath === projectPath) {
|
|
145856
|
+
return this.cached;
|
|
145857
|
+
}
|
|
145858
|
+
this.cached = await factory(projectPath);
|
|
145859
|
+
this.cachedPath = projectPath;
|
|
145860
|
+
return this.cached;
|
|
145861
|
+
}
|
|
145862
|
+
clear() {
|
|
145863
|
+
this.cached = null;
|
|
145864
|
+
this.cachedPath = null;
|
|
145865
|
+
}
|
|
145866
|
+
getCachedPath() {
|
|
145867
|
+
return this.cachedPath;
|
|
145868
|
+
}
|
|
145869
|
+
}
|
|
145870
|
+
|
|
145622
145871
|
// ../../node_modules/.bun/effect@3.19.12/node_modules/effect/dist/esm/Function.js
|
|
145623
145872
|
function pipe3(a, ab, bc, cd, de, ef, fg, gh, hi) {
|
|
145624
145873
|
switch (arguments.length) {
|
|
@@ -162935,6 +163184,9 @@ Linked to ${result.links.length} related memor${result.links.length === 1 ? "y"
|
|
|
162935
163184
|
};
|
|
162936
163185
|
},
|
|
162937
163186
|
async find(args3) {
|
|
163187
|
+
if (!args3.query || typeof args3.query !== "string") {
|
|
163188
|
+
throw new Error("query is required for find operation");
|
|
163189
|
+
}
|
|
162938
163190
|
const limit = args3.limit ?? 10;
|
|
162939
163191
|
let results;
|
|
162940
163192
|
let usedFallback = false;
|
|
@@ -163056,24 +163308,21 @@ var init_memory2 = __esm(() => {
|
|
|
163056
163308
|
// src/memory-tools.ts
|
|
163057
163309
|
async function getMemoryAdapter(projectPath) {
|
|
163058
163310
|
const path4 = projectPath || process.cwd();
|
|
163059
|
-
|
|
163060
|
-
|
|
163061
|
-
|
|
163062
|
-
|
|
163063
|
-
|
|
163064
|
-
cachedAdapter = await createMemoryAdapter2(dbAdapter);
|
|
163065
|
-
cachedProjectPath = path4;
|
|
163066
|
-
return cachedAdapter;
|
|
163311
|
+
return memoryAdapterCache.get(path4, async (projectPath2) => {
|
|
163312
|
+
const swarmMail = await getSwarmMailLibSQL(projectPath2);
|
|
163313
|
+
const dbAdapter = await swarmMail.getDatabase();
|
|
163314
|
+
return await createMemoryAdapter2(dbAdapter);
|
|
163315
|
+
});
|
|
163067
163316
|
}
|
|
163068
163317
|
function resetMemoryCache() {
|
|
163069
|
-
|
|
163070
|
-
cachedProjectPath = null;
|
|
163318
|
+
memoryAdapterCache.clear();
|
|
163071
163319
|
}
|
|
163072
|
-
var
|
|
163320
|
+
var memoryAdapterCache, semantic_memory_store, semantic_memory_find, semantic_memory_get, semantic_memory_remove, semantic_memory_validate, semantic_memory_list, semantic_memory_stats, semantic_memory_check, semantic_memory_upsert, memoryTools;
|
|
163073
163321
|
var init_memory_tools = __esm(() => {
|
|
163074
163322
|
init_dist();
|
|
163075
163323
|
init_dist2();
|
|
163076
163324
|
init_memory2();
|
|
163325
|
+
memoryAdapterCache = new AdapterCache;
|
|
163077
163326
|
semantic_memory_store = tool({
|
|
163078
163327
|
description: "Store a memory with semantic embedding. Memories are searchable by semantic similarity and can be organized into collections. Confidence affects decay rate: high confidence (1.0) = 135 day half-life, low confidence (0.0) = 45 day half-life. Supports auto-tagging, auto-linking, and entity extraction via LLM.",
|
|
163079
163328
|
args: {
|
|
@@ -163090,7 +163339,7 @@ var init_memory_tools = __esm(() => {
|
|
|
163090
163339
|
const adapter5 = await getMemoryAdapter();
|
|
163091
163340
|
const result = await adapter5.store(args3);
|
|
163092
163341
|
try {
|
|
163093
|
-
const projectKey =
|
|
163342
|
+
const projectKey = memoryAdapterCache.getCachedPath() || process.cwd();
|
|
163094
163343
|
const tags3 = args3.tags ? args3.tags.split(",").map((t) => t.trim()) : [];
|
|
163095
163344
|
const event = createEvent("memory_stored", {
|
|
163096
163345
|
project_key: projectKey,
|
|
@@ -163122,7 +163371,7 @@ var init_memory_tools = __esm(() => {
|
|
|
163122
163371
|
const result = await adapter5.find(args3);
|
|
163123
163372
|
const duration7 = Date.now() - startTime;
|
|
163124
163373
|
try {
|
|
163125
|
-
const projectKey =
|
|
163374
|
+
const projectKey = memoryAdapterCache.getCachedPath() || process.cwd();
|
|
163126
163375
|
const topScore = result.results.length > 0 ? result.results[0].score : undefined;
|
|
163127
163376
|
const event = createEvent("memory_found", {
|
|
163128
163377
|
project_key: projectKey,
|
|
@@ -163160,7 +163409,7 @@ var init_memory_tools = __esm(() => {
|
|
|
163160
163409
|
const result = await adapter5.remove(args3);
|
|
163161
163410
|
if (result.success) {
|
|
163162
163411
|
try {
|
|
163163
|
-
const projectKey =
|
|
163412
|
+
const projectKey = memoryAdapterCache.getCachedPath() || process.cwd();
|
|
163164
163413
|
const event = createEvent("memory_deleted", {
|
|
163165
163414
|
project_key: projectKey,
|
|
163166
163415
|
memory_id: args3.id
|
|
@@ -163183,7 +163432,7 @@ var init_memory_tools = __esm(() => {
|
|
|
163183
163432
|
const result = await adapter5.validate(args3);
|
|
163184
163433
|
if (result.success) {
|
|
163185
163434
|
try {
|
|
163186
|
-
const projectKey =
|
|
163435
|
+
const projectKey = memoryAdapterCache.getCachedPath() || process.cwd();
|
|
163187
163436
|
const event = createEvent("memory_validated", {
|
|
163188
163437
|
project_key: projectKey,
|
|
163189
163438
|
memory_id: args3.id,
|
|
@@ -163242,7 +163491,7 @@ var init_memory_tools = __esm(() => {
|
|
|
163242
163491
|
const adapter5 = await getMemoryAdapter();
|
|
163243
163492
|
const result = await adapter5.upsert(args3);
|
|
163244
163493
|
try {
|
|
163245
|
-
const projectKey =
|
|
163494
|
+
const projectKey = memoryAdapterCache.getCachedPath() || process.cwd();
|
|
163246
163495
|
const event = createEvent("memory_updated", {
|
|
163247
163496
|
project_key: projectKey,
|
|
163248
163497
|
memory_id: result.memoryId || "unknown",
|
|
@@ -174962,7 +175211,8 @@ var CellUpdateArgsSchema = exports_external.object({
|
|
|
174962
175211
|
});
|
|
174963
175212
|
var CellCloseArgsSchema = exports_external.object({
|
|
174964
175213
|
id: exports_external.string(),
|
|
174965
|
-
reason: exports_external.string().min(1, "Reason required")
|
|
175214
|
+
reason: exports_external.string().min(1, "Reason required"),
|
|
175215
|
+
result: exports_external.string().optional()
|
|
174966
175216
|
});
|
|
174967
175217
|
var CellQueryArgsSchema = exports_external.object({
|
|
174968
175218
|
status: CellStatusSchema.optional(),
|
|
@@ -175565,6 +175815,23 @@ var isBeadEventType = isCellEventType;
|
|
|
175565
175815
|
var getBeadIdFromEvent = getCellIdFromEvent;
|
|
175566
175816
|
// src/hive.ts
|
|
175567
175817
|
init_dist2();
|
|
175818
|
+
|
|
175819
|
+
// src/utils/event-utils.ts
|
|
175820
|
+
init_dist2();
|
|
175821
|
+
async function safeEmitEvent(eventType, data, toolName, projectPath) {
|
|
175822
|
+
try {
|
|
175823
|
+
const effectiveProjectPath = projectPath || process.cwd();
|
|
175824
|
+
const event = createEvent(eventType, {
|
|
175825
|
+
project_key: effectiveProjectPath,
|
|
175826
|
+
...data
|
|
175827
|
+
});
|
|
175828
|
+
await appendEvent(event, effectiveProjectPath);
|
|
175829
|
+
} catch (error47) {
|
|
175830
|
+
console.warn(`[${toolName}] Failed to emit ${eventType} event:`, error47);
|
|
175831
|
+
}
|
|
175832
|
+
}
|
|
175833
|
+
|
|
175834
|
+
// src/hive.ts
|
|
175568
175835
|
var hiveWorkingDirectory = null;
|
|
175569
175836
|
function setHiveWorkingDirectory(directory) {
|
|
175570
175837
|
hiveWorkingDirectory = directory;
|
|
@@ -175732,7 +175999,7 @@ async function importJsonlToPGLite(projectPath) {
|
|
|
175732
175999
|
const status3 = cellData.status === "tombstone" ? "closed" : cellData.status;
|
|
175733
176000
|
const isClosed = status3 === "closed";
|
|
175734
176001
|
const closedAt = isClosed ? cellData.closed_at ? new Date(cellData.closed_at).getTime() : new Date(cellData.updated_at).getTime() : null;
|
|
175735
|
-
await db.query(`INSERT INTO
|
|
176002
|
+
await db.query(`INSERT INTO beads (
|
|
175736
176003
|
id, project_key, type, status, title, description, priority,
|
|
175737
176004
|
parent_id, assignee, created_at, updated_at, closed_at
|
|
175738
176005
|
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)`, [
|
|
@@ -175873,20 +176140,14 @@ var hive_create = tool({
|
|
|
175873
176140
|
parent_id: validated.parent_id
|
|
175874
176141
|
});
|
|
175875
176142
|
await adapter5.markDirty(projectKey, cell.id);
|
|
175876
|
-
|
|
175877
|
-
|
|
175878
|
-
|
|
175879
|
-
|
|
175880
|
-
|
|
175881
|
-
|
|
175882
|
-
|
|
175883
|
-
|
|
175884
|
-
parent_id: validated.parent_id
|
|
175885
|
-
});
|
|
175886
|
-
await appendEvent(event, projectKey);
|
|
175887
|
-
} catch (error47) {
|
|
175888
|
-
console.warn("[hive_create] Failed to emit cell_created event:", error47);
|
|
175889
|
-
}
|
|
176143
|
+
await safeEmitEvent("cell_created", {
|
|
176144
|
+
cell_id: cell.id,
|
|
176145
|
+
title: validated.title,
|
|
176146
|
+
description: validated.description,
|
|
176147
|
+
issue_type: validated.type || "task",
|
|
176148
|
+
priority: validated.priority ?? 2,
|
|
176149
|
+
parent_id: validated.parent_id
|
|
176150
|
+
}, "hive_create", projectKey);
|
|
175890
176151
|
const formatted = formatCellForOutput(cell);
|
|
175891
176152
|
return JSON.stringify(formatted, null, 2);
|
|
175892
176153
|
} catch (error47) {
|
|
@@ -175968,53 +176229,35 @@ var hive_create_epic = tool({
|
|
|
175968
176229
|
subtasks: created.slice(1).map((c) => formatCellForOutput(c))
|
|
175969
176230
|
};
|
|
175970
176231
|
const effectiveProjectKey = args2.project_key || projectKey;
|
|
175971
|
-
|
|
175972
|
-
|
|
175973
|
-
|
|
175974
|
-
|
|
175975
|
-
|
|
175976
|
-
|
|
175977
|
-
|
|
175978
|
-
|
|
175979
|
-
|
|
175980
|
-
|
|
175981
|
-
|
|
175982
|
-
|
|
175983
|
-
|
|
175984
|
-
|
|
175985
|
-
|
|
175986
|
-
|
|
175987
|
-
|
|
175988
|
-
|
|
175989
|
-
|
|
175990
|
-
|
|
175991
|
-
|
|
175992
|
-
|
|
175993
|
-
|
|
175994
|
-
|
|
175995
|
-
|
|
175996
|
-
|
|
175997
|
-
|
|
175998
|
-
|
|
175999
|
-
|
|
176000
|
-
} catch (error47) {
|
|
176001
|
-
console.warn("[hive_create_epic] Failed to emit DecompositionGeneratedEvent:", error47);
|
|
176002
|
-
}
|
|
176003
|
-
try {
|
|
176004
|
-
const totalFiles = validated.subtasks.reduce((count10, st) => count10 + (st.files?.length || 0), 0);
|
|
176005
|
-
const swarmStartedEvent = createEvent("swarm_started", {
|
|
176006
|
-
project_key: effectiveProjectKey,
|
|
176007
|
-
epic_id: epic.id,
|
|
176008
|
-
epic_title: validated.epic_title,
|
|
176009
|
-
strategy: args2.strategy || "feature-based",
|
|
176010
|
-
subtask_count: validated.subtasks.length,
|
|
176011
|
-
total_files: totalFiles,
|
|
176012
|
-
coordinator_agent: "coordinator"
|
|
176013
|
-
});
|
|
176014
|
-
await appendEvent(swarmStartedEvent, effectiveProjectKey);
|
|
176015
|
-
} catch (error47) {
|
|
176016
|
-
console.warn("[hive_create_epic] Failed to emit SwarmStartedEvent:", error47);
|
|
176017
|
-
}
|
|
176232
|
+
await safeEmitEvent("epic_created", {
|
|
176233
|
+
epic_id: epic.id,
|
|
176234
|
+
title: validated.epic_title,
|
|
176235
|
+
description: validated.epic_description,
|
|
176236
|
+
subtask_count: validated.subtasks.length,
|
|
176237
|
+
subtask_ids: created.slice(1).map((c) => c.id)
|
|
176238
|
+
}, "hive_create_epic", effectiveProjectKey);
|
|
176239
|
+
await safeEmitEvent("decomposition_generated", {
|
|
176240
|
+
epic_id: epic.id,
|
|
176241
|
+
task: args2.task || validated.epic_title,
|
|
176242
|
+
context: validated.epic_description,
|
|
176243
|
+
strategy: args2.strategy || "feature-based",
|
|
176244
|
+
epic_title: validated.epic_title,
|
|
176245
|
+
subtasks: validated.subtasks.map((st) => ({
|
|
176246
|
+
title: st.title,
|
|
176247
|
+
files: st.files || [],
|
|
176248
|
+
priority: st.priority
|
|
176249
|
+
})),
|
|
176250
|
+
recovery_context: args2.recovery_context
|
|
176251
|
+
}, "hive_create_epic", effectiveProjectKey);
|
|
176252
|
+
const totalFiles = validated.subtasks.reduce((count10, st) => count10 + (st.files?.length || 0), 0);
|
|
176253
|
+
await safeEmitEvent("swarm_started", {
|
|
176254
|
+
epic_id: epic.id,
|
|
176255
|
+
epic_title: validated.epic_title,
|
|
176256
|
+
strategy: args2.strategy || "feature-based",
|
|
176257
|
+
subtask_count: validated.subtasks.length,
|
|
176258
|
+
total_files: totalFiles,
|
|
176259
|
+
coordinator_agent: "coordinator"
|
|
176260
|
+
}, "hive_create_epic", effectiveProjectKey);
|
|
176018
176261
|
try {
|
|
176019
176262
|
const { captureCoordinatorEvent: captureCoordinatorEvent2 } = await Promise.resolve().then(() => (init_eval_capture(), exports_eval_capture));
|
|
176020
176263
|
const filesPerSubtask = {};
|
|
@@ -176145,23 +176388,17 @@ var hive_update = tool({
|
|
|
176145
176388
|
cell = existingCell;
|
|
176146
176389
|
}
|
|
176147
176390
|
await adapter5.markDirty(projectKey, cellId);
|
|
176148
|
-
|
|
176149
|
-
|
|
176150
|
-
|
|
176151
|
-
|
|
176152
|
-
|
|
176153
|
-
|
|
176154
|
-
|
|
176155
|
-
|
|
176156
|
-
|
|
176157
|
-
|
|
176158
|
-
|
|
176159
|
-
fields_changed: fieldsChanged
|
|
176160
|
-
});
|
|
176161
|
-
await appendEvent(event, projectKey);
|
|
176162
|
-
} catch (error47) {
|
|
176163
|
-
console.warn("[hive_update] Failed to emit cell_updated event:", error47);
|
|
176164
|
-
}
|
|
176391
|
+
const fieldsChanged = [];
|
|
176392
|
+
if (validated.status)
|
|
176393
|
+
fieldsChanged.push("status");
|
|
176394
|
+
if (validated.description !== undefined)
|
|
176395
|
+
fieldsChanged.push("description");
|
|
176396
|
+
if (validated.priority !== undefined)
|
|
176397
|
+
fieldsChanged.push("priority");
|
|
176398
|
+
await safeEmitEvent("cell_updated", {
|
|
176399
|
+
cell_id: cellId,
|
|
176400
|
+
fields_changed: fieldsChanged
|
|
176401
|
+
}, "hive_update", projectKey);
|
|
176165
176402
|
const formatted = formatCellForOutput(cell);
|
|
176166
176403
|
return JSON.stringify(formatted, null, 2);
|
|
176167
176404
|
} catch (error47) {
|
|
@@ -176180,7 +176417,8 @@ var hive_close = tool({
|
|
|
176180
176417
|
description: "Close a cell with reason",
|
|
176181
176418
|
args: {
|
|
176182
176419
|
id: tool.schema.string().describe("Cell ID or partial hash"),
|
|
176183
|
-
reason: tool.schema.string().describe("Completion reason")
|
|
176420
|
+
reason: tool.schema.string().describe("Completion reason"),
|
|
176421
|
+
result: tool.schema.string().optional().describe("Implementation summary - what was actually done (like a PR description)")
|
|
176184
176422
|
},
|
|
176185
176423
|
async execute(args2, ctx) {
|
|
176186
176424
|
const validated = CellCloseArgsSchema.parse(args2);
|
|
@@ -176190,11 +176428,10 @@ var hive_close = tool({
|
|
|
176190
176428
|
const cellId = await resolvePartialId(adapter5, projectKey, validated.id) || validated.id;
|
|
176191
176429
|
const cellBeforeClose = await adapter5.getCell(projectKey, cellId);
|
|
176192
176430
|
const isEpic = cellBeforeClose?.type === "epic";
|
|
176193
|
-
const cell = await adapter5.closeCell(projectKey, cellId, validated.reason);
|
|
176431
|
+
const cell = await adapter5.closeCell(projectKey, cellId, validated.reason, validated.result ? { result: validated.result } : undefined);
|
|
176194
176432
|
await adapter5.markDirty(projectKey, cellId);
|
|
176195
176433
|
if (isEpic && cellBeforeClose) {
|
|
176196
176434
|
try {
|
|
176197
|
-
const { createEvent: createEvent2, appendEvent: appendEvent3 } = await Promise.resolve().then(() => (init_dist2(), exports_dist));
|
|
176198
176435
|
const subtasks = await adapter5.queryCells(projectKey, { parent_id: cellId });
|
|
176199
176436
|
const completedSubtasks = subtasks.filter((st) => st.status === "closed");
|
|
176200
176437
|
const failedSubtasks = subtasks.filter((st) => st.status === "blocked");
|
|
@@ -176232,8 +176469,7 @@ var hive_close = tool({
|
|
|
176232
176469
|
} catch (error47) {
|
|
176233
176470
|
console.warn("[hive_close] Failed to calculate duration:", error47);
|
|
176234
176471
|
}
|
|
176235
|
-
|
|
176236
|
-
project_key: projectKey,
|
|
176472
|
+
await safeEmitEvent("swarm_completed", {
|
|
176237
176473
|
epic_id: cellId,
|
|
176238
176474
|
epic_title: cellBeforeClose.title,
|
|
176239
176475
|
success: failedSubtasks.length === 0,
|
|
@@ -176241,8 +176477,7 @@ var hive_close = tool({
|
|
|
176241
176477
|
subtasks_completed: completedSubtasks.length,
|
|
176242
176478
|
subtasks_failed: failedSubtasks.length,
|
|
176243
176479
|
total_files_touched: totalFilesTouched
|
|
176244
|
-
});
|
|
176245
|
-
await appendEvent3(swarmCompletedEvent, projectKey);
|
|
176480
|
+
}, "hive_close", projectKey);
|
|
176246
176481
|
try {
|
|
176247
176482
|
const { runPostSwarmValidation: runPostSwarmValidation2 } = await Promise.resolve().then(() => (init_swarm_validation(), exports_swarm_validation));
|
|
176248
176483
|
const { readEvents: readEvents3 } = await Promise.resolve().then(() => (init_dist2(), exports_dist));
|
|
@@ -176262,7 +176497,7 @@ var hive_close = tool({
|
|
|
176262
176497
|
swarm_id: cellId,
|
|
176263
176498
|
started_at: new Date,
|
|
176264
176499
|
emit: async (event) => {
|
|
176265
|
-
await
|
|
176500
|
+
await appendEvent(event, projectKey);
|
|
176266
176501
|
}
|
|
176267
176502
|
}, swarmEvents).then((result) => {
|
|
176268
176503
|
if (!result.passed) {
|
|
@@ -176278,16 +176513,10 @@ var hive_close = tool({
|
|
|
176278
176513
|
console.warn("[hive_close] Failed to emit SwarmCompletedEvent:", error47);
|
|
176279
176514
|
}
|
|
176280
176515
|
}
|
|
176281
|
-
|
|
176282
|
-
|
|
176283
|
-
|
|
176284
|
-
|
|
176285
|
-
reason: validated.reason
|
|
176286
|
-
});
|
|
176287
|
-
await appendEvent(event, projectKey);
|
|
176288
|
-
} catch (error47) {
|
|
176289
|
-
console.warn("[hive_close] Failed to emit cell_closed event:", error47);
|
|
176290
|
-
}
|
|
176516
|
+
await safeEmitEvent("cell_closed", {
|
|
176517
|
+
cell_id: cellId,
|
|
176518
|
+
reason: validated.reason
|
|
176519
|
+
}, "hive_close", projectKey);
|
|
176291
176520
|
return `Closed ${cell.id}: ${validated.reason}`;
|
|
176292
176521
|
} catch (error47) {
|
|
176293
176522
|
const message = error47 instanceof Error ? error47.message : String(error47);
|
|
@@ -178667,10 +178896,13 @@ var swarmmail_read_message = tool({
|
|
|
178667
178896
|
}
|
|
178668
178897
|
}
|
|
178669
178898
|
});
|
|
178899
|
+
function normalizePath2(path4) {
|
|
178900
|
+
return path4.replace(/\\([[\]()])/g, "$1");
|
|
178901
|
+
}
|
|
178670
178902
|
var swarmmail_reserve = tool({
|
|
178671
|
-
description: "Reserve file paths for exclusive editing. Prevents conflicts with other agents.",
|
|
178903
|
+
description: "Reserve file paths for exclusive editing. Prevents conflicts with other agents. " + "IMPORTANT: Do NOT escape brackets or parentheses - paths like app/(content)/[slug]/page.tsx work as-is.",
|
|
178672
178904
|
args: {
|
|
178673
|
-
paths: tool.schema.array(tool.schema.string()).describe("File paths or glob patterns to reserve"),
|
|
178905
|
+
paths: tool.schema.array(tool.schema.string()).transform((paths) => paths.map(normalizePath2)).describe("File paths or glob patterns to reserve. Do NOT escape [ ] ( ) characters."),
|
|
178674
178906
|
reason: tool.schema.string().optional().describe("Reason for reservation (e.g., bead ID)"),
|
|
178675
178907
|
exclusive: tool.schema.boolean().optional().describe("Whether reservation is exclusive (default: true)"),
|
|
178676
178908
|
ttl_seconds: tool.schema.number().optional().describe("Time-to-live in seconds (default: 3600)")
|
|
@@ -178682,10 +178914,11 @@ var swarmmail_reserve = tool({
|
|
|
178682
178914
|
return JSON.stringify({ error: "Session not initialized. Call swarmmail_init first." }, null, 2);
|
|
178683
178915
|
}
|
|
178684
178916
|
try {
|
|
178917
|
+
const normalizedPaths = args2.paths.map(normalizePath2);
|
|
178685
178918
|
const result = await reserveSwarmFiles({
|
|
178686
178919
|
projectPath: state.projectKey,
|
|
178687
178920
|
agentName: state.agentName,
|
|
178688
|
-
paths:
|
|
178921
|
+
paths: normalizedPaths,
|
|
178689
178922
|
reason: args2.reason,
|
|
178690
178923
|
exclusive: args2.exclusive ?? true,
|
|
178691
178924
|
ttlSeconds: args2.ttl_seconds
|
|
@@ -178713,9 +178946,9 @@ var swarmmail_reserve = tool({
|
|
|
178713
178946
|
}
|
|
178714
178947
|
});
|
|
178715
178948
|
var swarmmail_release = tool({
|
|
178716
|
-
description: "Release file reservations. Call when done editing files.",
|
|
178949
|
+
description: "Release file reservations. Call when done editing files. " + "Do NOT escape brackets or parentheses in paths.",
|
|
178717
178950
|
args: {
|
|
178718
|
-
paths: tool.schema.array(tool.schema.string()).optional().describe("Specific paths to release (releases all if omitted)"),
|
|
178951
|
+
paths: tool.schema.array(tool.schema.string()).optional().describe("Specific paths to release (releases all if omitted). Do NOT escape [ ] ( ) characters."),
|
|
178719
178952
|
reservation_ids: tool.schema.array(tool.schema.number()).optional().describe("Specific reservation IDs to release")
|
|
178720
178953
|
},
|
|
178721
178954
|
async execute(args2, ctx) {
|
|
@@ -178726,10 +178959,11 @@ var swarmmail_release = tool({
|
|
|
178726
178959
|
}
|
|
178727
178960
|
try {
|
|
178728
178961
|
const currentReservations = await getActiveReservations2(state.projectKey, state.projectKey, state.agentName);
|
|
178962
|
+
const normalizedPaths = args2.paths?.map(normalizePath2);
|
|
178729
178963
|
const result = await releaseSwarmFiles({
|
|
178730
178964
|
projectPath: state.projectKey,
|
|
178731
178965
|
agentName: state.agentName,
|
|
178732
|
-
paths:
|
|
178966
|
+
paths: normalizedPaths,
|
|
178733
178967
|
reservationIds: args2.reservation_ids
|
|
178734
178968
|
});
|
|
178735
178969
|
if (!args2.paths && !args2.reservation_ids) {
|
|
@@ -182349,8 +182583,200 @@ var reviewTools = {
|
|
|
182349
182583
|
swarm_review_feedback
|
|
182350
182584
|
};
|
|
182351
182585
|
|
|
182586
|
+
// src/utils/git-commit-info.ts
|
|
182587
|
+
import { execSync } from "child_process";
|
|
182588
|
+
function getGitCommitInfo(cwd) {
|
|
182589
|
+
try {
|
|
182590
|
+
const opts = { cwd, encoding: "utf-8", timeout: 5000 };
|
|
182591
|
+
const sha = execSync("git rev-parse HEAD", opts).trim();
|
|
182592
|
+
const message = execSync("git log -1 --format=%s", opts).trim();
|
|
182593
|
+
const branch = execSync("git rev-parse --abbrev-ref HEAD", opts).trim();
|
|
182594
|
+
return { sha, message, branch };
|
|
182595
|
+
} catch {
|
|
182596
|
+
return null;
|
|
182597
|
+
}
|
|
182598
|
+
}
|
|
182599
|
+
|
|
182352
182600
|
// src/swarm-orchestrate.ts
|
|
182353
182601
|
init_eval_capture();
|
|
182602
|
+
|
|
182603
|
+
// src/swarm-verify.ts
|
|
182604
|
+
init_dist();
|
|
182605
|
+
async function runTypecheckVerification() {
|
|
182606
|
+
const step4 = {
|
|
182607
|
+
name: "typecheck",
|
|
182608
|
+
command: "tsc --noEmit",
|
|
182609
|
+
passed: false,
|
|
182610
|
+
exitCode: -1
|
|
182611
|
+
};
|
|
182612
|
+
try {
|
|
182613
|
+
const tsconfigExists = await Bun.file("tsconfig.json").exists();
|
|
182614
|
+
if (!tsconfigExists) {
|
|
182615
|
+
step4.skipped = true;
|
|
182616
|
+
step4.skipReason = "No tsconfig.json found";
|
|
182617
|
+
step4.passed = true;
|
|
182618
|
+
return step4;
|
|
182619
|
+
}
|
|
182620
|
+
const result = await Bun.$`tsc --noEmit`.quiet().nothrow();
|
|
182621
|
+
step4.exitCode = result.exitCode;
|
|
182622
|
+
step4.passed = result.exitCode === 0;
|
|
182623
|
+
if (!step4.passed) {
|
|
182624
|
+
step4.error = result.stderr.toString().slice(0, 1000);
|
|
182625
|
+
step4.output = result.stdout.toString().slice(0, 1000);
|
|
182626
|
+
}
|
|
182627
|
+
} catch (error47) {
|
|
182628
|
+
step4.skipped = true;
|
|
182629
|
+
step4.skipReason = `tsc not available: ${error47 instanceof Error ? error47.message : String(error47)}`;
|
|
182630
|
+
step4.passed = true;
|
|
182631
|
+
}
|
|
182632
|
+
return step4;
|
|
182633
|
+
}
|
|
182634
|
+
async function runTestVerification(filesTouched) {
|
|
182635
|
+
const step4 = {
|
|
182636
|
+
name: "tests",
|
|
182637
|
+
command: "bun test <related-files>",
|
|
182638
|
+
passed: false,
|
|
182639
|
+
exitCode: -1
|
|
182640
|
+
};
|
|
182641
|
+
if (filesTouched.length === 0) {
|
|
182642
|
+
step4.skipped = true;
|
|
182643
|
+
step4.skipReason = "No files touched";
|
|
182644
|
+
step4.passed = true;
|
|
182645
|
+
return step4;
|
|
182646
|
+
}
|
|
182647
|
+
const testPatterns = [];
|
|
182648
|
+
for (const file3 of filesTouched) {
|
|
182649
|
+
if (file3.includes(".test.") || file3.includes(".spec.")) {
|
|
182650
|
+
testPatterns.push(file3);
|
|
182651
|
+
continue;
|
|
182652
|
+
}
|
|
182653
|
+
const baseName = file3.replace(/\.(ts|tsx|js|jsx)$/, "");
|
|
182654
|
+
testPatterns.push(`${baseName}.test.ts`);
|
|
182655
|
+
testPatterns.push(`${baseName}.test.tsx`);
|
|
182656
|
+
testPatterns.push(`${baseName}.spec.ts`);
|
|
182657
|
+
}
|
|
182658
|
+
const existingTests = [];
|
|
182659
|
+
for (const pattern2 of testPatterns) {
|
|
182660
|
+
try {
|
|
182661
|
+
const exists8 = await Bun.file(pattern2).exists();
|
|
182662
|
+
if (exists8) {
|
|
182663
|
+
existingTests.push(pattern2);
|
|
182664
|
+
}
|
|
182665
|
+
} catch {}
|
|
182666
|
+
}
|
|
182667
|
+
if (existingTests.length === 0) {
|
|
182668
|
+
step4.skipped = true;
|
|
182669
|
+
step4.skipReason = "No related test files found";
|
|
182670
|
+
step4.passed = true;
|
|
182671
|
+
return step4;
|
|
182672
|
+
}
|
|
182673
|
+
try {
|
|
182674
|
+
step4.command = `bun test ${existingTests.join(" ")}`;
|
|
182675
|
+
const result = await Bun.$`bun test ${existingTests}`.quiet().nothrow();
|
|
182676
|
+
step4.exitCode = result.exitCode;
|
|
182677
|
+
step4.passed = result.exitCode === 0;
|
|
182678
|
+
if (!step4.passed) {
|
|
182679
|
+
step4.error = result.stderr.toString().slice(0, 1000);
|
|
182680
|
+
step4.output = result.stdout.toString().slice(0, 1000);
|
|
182681
|
+
}
|
|
182682
|
+
} catch (error47) {
|
|
182683
|
+
step4.skipped = true;
|
|
182684
|
+
step4.skipReason = `Test runner failed: ${error47 instanceof Error ? error47.message : String(error47)}`;
|
|
182685
|
+
step4.passed = true;
|
|
182686
|
+
}
|
|
182687
|
+
return step4;
|
|
182688
|
+
}
|
|
182689
|
+
async function runVerificationGate(filesTouched, _skipUbs = false) {
|
|
182690
|
+
const steps = [];
|
|
182691
|
+
const blockers = [];
|
|
182692
|
+
const typecheckStep = await runTypecheckVerification();
|
|
182693
|
+
steps.push(typecheckStep);
|
|
182694
|
+
if (!typecheckStep.passed && !typecheckStep.skipped) {
|
|
182695
|
+
blockers.push(`Typecheck failed: ${typecheckStep.error?.slice(0, 100) || "type errors found"}. Try: Run 'tsc --noEmit' to see full errors, check tsconfig.json configuration, or fix reported type errors in modified files.`);
|
|
182696
|
+
}
|
|
182697
|
+
const testStep = await runTestVerification(filesTouched);
|
|
182698
|
+
steps.push(testStep);
|
|
182699
|
+
if (!testStep.passed && !testStep.skipped) {
|
|
182700
|
+
blockers.push(`Tests failed: ${testStep.error?.slice(0, 100) || "test failures"}. Try: Run 'bun test ${testStep.command.split(" ").slice(2).join(" ")}' to see full output, check test assertions, or fix failing tests in modified files.`);
|
|
182701
|
+
}
|
|
182702
|
+
const passedCount = steps.filter((s) => s.passed).length;
|
|
182703
|
+
const skippedCount = steps.filter((s) => s.skipped).length;
|
|
182704
|
+
const failedCount = steps.filter((s) => !s.passed && !s.skipped).length;
|
|
182705
|
+
const summary11 = failedCount === 0 ? `Verification passed: ${passedCount} checks passed, ${skippedCount} skipped` : `Verification FAILED: ${failedCount} checks failed, ${passedCount} passed, ${skippedCount} skipped`;
|
|
182706
|
+
return {
|
|
182707
|
+
passed: failedCount === 0,
|
|
182708
|
+
steps,
|
|
182709
|
+
summary: summary11,
|
|
182710
|
+
blockers
|
|
182711
|
+
};
|
|
182712
|
+
}
|
|
182713
|
+
var swarm_verify = tool({
|
|
182714
|
+
description: "Run verification gate (typecheck + tests) for files. Returns verification results without blocking. Used by swarm_complete to verify worker output.",
|
|
182715
|
+
args: {
|
|
182716
|
+
files_touched: tool.schema.array(tool.schema.string()).describe("Files to verify (typecheck + test discovery)"),
|
|
182717
|
+
skip_verification: tool.schema.boolean().optional().describe("Skip verification entirely (default: false)")
|
|
182718
|
+
},
|
|
182719
|
+
async execute(args2) {
|
|
182720
|
+
try {
|
|
182721
|
+
if (args2.skip_verification) {
|
|
182722
|
+
return JSON.stringify({
|
|
182723
|
+
success: true,
|
|
182724
|
+
data: {
|
|
182725
|
+
passed: true,
|
|
182726
|
+
skipped: true,
|
|
182727
|
+
reason: "skip_verification=true",
|
|
182728
|
+
summary: "Verification skipped by request",
|
|
182729
|
+
steps: [],
|
|
182730
|
+
blockers: []
|
|
182731
|
+
}
|
|
182732
|
+
}, null, 2);
|
|
182733
|
+
}
|
|
182734
|
+
if (!args2.files_touched || args2.files_touched.length === 0) {
|
|
182735
|
+
return JSON.stringify({
|
|
182736
|
+
success: true,
|
|
182737
|
+
data: {
|
|
182738
|
+
passed: true,
|
|
182739
|
+
skipped: true,
|
|
182740
|
+
reason: "no files_touched provided",
|
|
182741
|
+
summary: "No files to verify",
|
|
182742
|
+
steps: [],
|
|
182743
|
+
blockers: []
|
|
182744
|
+
}
|
|
182745
|
+
}, null, 2);
|
|
182746
|
+
}
|
|
182747
|
+
const result = await runVerificationGate(args2.files_touched, false);
|
|
182748
|
+
return JSON.stringify({
|
|
182749
|
+
success: true,
|
|
182750
|
+
data: {
|
|
182751
|
+
passed: result.passed,
|
|
182752
|
+
skipped: false,
|
|
182753
|
+
summary: result.summary,
|
|
182754
|
+
steps: result.steps.map((s) => ({
|
|
182755
|
+
name: s.name,
|
|
182756
|
+
command: s.command,
|
|
182757
|
+
passed: s.passed,
|
|
182758
|
+
exitCode: s.exitCode,
|
|
182759
|
+
skipped: s.skipped,
|
|
182760
|
+
skipReason: s.skipReason,
|
|
182761
|
+
error: s.error?.slice(0, 200),
|
|
182762
|
+
output: s.output?.slice(0, 200)
|
|
182763
|
+
})),
|
|
182764
|
+
blockers: result.blockers
|
|
182765
|
+
}
|
|
182766
|
+
}, null, 2);
|
|
182767
|
+
} catch (error47) {
|
|
182768
|
+
return JSON.stringify({
|
|
182769
|
+
success: false,
|
|
182770
|
+
error: `Verification failed: ${error47 instanceof Error ? error47.message : String(error47)}`
|
|
182771
|
+
}, null, 2);
|
|
182772
|
+
}
|
|
182773
|
+
}
|
|
182774
|
+
});
|
|
182775
|
+
var verificationTools = {
|
|
182776
|
+
swarm_verify
|
|
182777
|
+
};
|
|
182778
|
+
|
|
182779
|
+
// src/swarm-orchestrate.ts
|
|
182354
182780
|
function generateWorkerHandoff(params) {
|
|
182355
182781
|
const handoff = {
|
|
182356
182782
|
contract: {
|
|
@@ -182492,114 +182918,6 @@ ${progress.blockers.map((b) => `- ${b}`).join(`
|
|
|
182492
182918
|
|
|
182493
182919
|
`);
|
|
182494
182920
|
}
|
|
182495
|
-
async function runTypecheckVerification() {
|
|
182496
|
-
const step4 = {
|
|
182497
|
-
name: "typecheck",
|
|
182498
|
-
command: "tsc --noEmit",
|
|
182499
|
-
passed: false,
|
|
182500
|
-
exitCode: -1
|
|
182501
|
-
};
|
|
182502
|
-
try {
|
|
182503
|
-
const tsconfigExists = await Bun.file("tsconfig.json").exists();
|
|
182504
|
-
if (!tsconfigExists) {
|
|
182505
|
-
step4.skipped = true;
|
|
182506
|
-
step4.skipReason = "No tsconfig.json found";
|
|
182507
|
-
step4.passed = true;
|
|
182508
|
-
return step4;
|
|
182509
|
-
}
|
|
182510
|
-
const result = await Bun.$`tsc --noEmit`.quiet().nothrow();
|
|
182511
|
-
step4.exitCode = result.exitCode;
|
|
182512
|
-
step4.passed = result.exitCode === 0;
|
|
182513
|
-
if (!step4.passed) {
|
|
182514
|
-
step4.error = result.stderr.toString().slice(0, 1000);
|
|
182515
|
-
step4.output = result.stdout.toString().slice(0, 1000);
|
|
182516
|
-
}
|
|
182517
|
-
} catch (error47) {
|
|
182518
|
-
step4.skipped = true;
|
|
182519
|
-
step4.skipReason = `tsc not available: ${error47 instanceof Error ? error47.message : String(error47)}`;
|
|
182520
|
-
step4.passed = true;
|
|
182521
|
-
}
|
|
182522
|
-
return step4;
|
|
182523
|
-
}
|
|
182524
|
-
async function runTestVerification(filesTouched) {
|
|
182525
|
-
const step4 = {
|
|
182526
|
-
name: "tests",
|
|
182527
|
-
command: "bun test <related-files>",
|
|
182528
|
-
passed: false,
|
|
182529
|
-
exitCode: -1
|
|
182530
|
-
};
|
|
182531
|
-
if (filesTouched.length === 0) {
|
|
182532
|
-
step4.skipped = true;
|
|
182533
|
-
step4.skipReason = "No files touched";
|
|
182534
|
-
step4.passed = true;
|
|
182535
|
-
return step4;
|
|
182536
|
-
}
|
|
182537
|
-
const testPatterns = [];
|
|
182538
|
-
for (const file3 of filesTouched) {
|
|
182539
|
-
if (file3.includes(".test.") || file3.includes(".spec.")) {
|
|
182540
|
-
testPatterns.push(file3);
|
|
182541
|
-
continue;
|
|
182542
|
-
}
|
|
182543
|
-
const baseName = file3.replace(/\.(ts|tsx|js|jsx)$/, "");
|
|
182544
|
-
testPatterns.push(`${baseName}.test.ts`);
|
|
182545
|
-
testPatterns.push(`${baseName}.test.tsx`);
|
|
182546
|
-
testPatterns.push(`${baseName}.spec.ts`);
|
|
182547
|
-
}
|
|
182548
|
-
const existingTests = [];
|
|
182549
|
-
for (const pattern2 of testPatterns) {
|
|
182550
|
-
try {
|
|
182551
|
-
const exists8 = await Bun.file(pattern2).exists();
|
|
182552
|
-
if (exists8) {
|
|
182553
|
-
existingTests.push(pattern2);
|
|
182554
|
-
}
|
|
182555
|
-
} catch {}
|
|
182556
|
-
}
|
|
182557
|
-
if (existingTests.length === 0) {
|
|
182558
|
-
step4.skipped = true;
|
|
182559
|
-
step4.skipReason = "No related test files found";
|
|
182560
|
-
step4.passed = true;
|
|
182561
|
-
return step4;
|
|
182562
|
-
}
|
|
182563
|
-
try {
|
|
182564
|
-
step4.command = `bun test ${existingTests.join(" ")}`;
|
|
182565
|
-
const result = await Bun.$`bun test ${existingTests}`.quiet().nothrow();
|
|
182566
|
-
step4.exitCode = result.exitCode;
|
|
182567
|
-
step4.passed = result.exitCode === 0;
|
|
182568
|
-
if (!step4.passed) {
|
|
182569
|
-
step4.error = result.stderr.toString().slice(0, 1000);
|
|
182570
|
-
step4.output = result.stdout.toString().slice(0, 1000);
|
|
182571
|
-
}
|
|
182572
|
-
} catch (error47) {
|
|
182573
|
-
step4.skipped = true;
|
|
182574
|
-
step4.skipReason = `Test runner failed: ${error47 instanceof Error ? error47.message : String(error47)}`;
|
|
182575
|
-
step4.passed = true;
|
|
182576
|
-
}
|
|
182577
|
-
return step4;
|
|
182578
|
-
}
|
|
182579
|
-
async function runVerificationGate(filesTouched, _skipUbs = false) {
|
|
182580
|
-
const steps = [];
|
|
182581
|
-
const blockers = [];
|
|
182582
|
-
const typecheckStep = await runTypecheckVerification();
|
|
182583
|
-
steps.push(typecheckStep);
|
|
182584
|
-
if (!typecheckStep.passed && !typecheckStep.skipped) {
|
|
182585
|
-
blockers.push(`Typecheck failed: ${typecheckStep.error?.slice(0, 100) || "type errors found"}. Try: Run 'tsc --noEmit' to see full errors, check tsconfig.json configuration, or fix reported type errors in modified files.`);
|
|
182586
|
-
}
|
|
182587
|
-
const testStep = await runTestVerification(filesTouched);
|
|
182588
|
-
steps.push(testStep);
|
|
182589
|
-
if (!testStep.passed && !testStep.skipped) {
|
|
182590
|
-
blockers.push(`Tests failed: ${testStep.error?.slice(0, 100) || "test failures"}. Try: Run 'bun test ${testStep.command.split(" ").slice(2).join(" ")}' to see full output, check test assertions, or fix failing tests in modified files.`);
|
|
182591
|
-
}
|
|
182592
|
-
const passedCount = steps.filter((s) => s.passed).length;
|
|
182593
|
-
const skippedCount = steps.filter((s) => s.skipped).length;
|
|
182594
|
-
const failedCount = steps.filter((s) => !s.passed && !s.skipped).length;
|
|
182595
|
-
const summary11 = failedCount === 0 ? `Verification passed: ${passedCount} checks passed, ${skippedCount} skipped` : `Verification FAILED: ${failedCount} checks failed, ${passedCount} passed, ${skippedCount} skipped`;
|
|
182596
|
-
return {
|
|
182597
|
-
passed: failedCount === 0,
|
|
182598
|
-
steps,
|
|
182599
|
-
summary: summary11,
|
|
182600
|
-
blockers
|
|
182601
|
-
};
|
|
182602
|
-
}
|
|
182603
182921
|
function classifyFailure(error47) {
|
|
182604
182922
|
const msg = (typeof error47 === "string" ? error47 : error47.message).toLowerCase();
|
|
182605
182923
|
if (msg.includes("timeout"))
|
|
@@ -182950,7 +183268,10 @@ var swarm_complete = tool({
|
|
|
182950
183268
|
start_time: tool.schema.number().describe("Task start timestamp (Unix ms) for duration calculation - REQUIRED for accurate analytics"),
|
|
182951
183269
|
error_count: tool.schema.number().optional().describe("Number of errors encountered during task"),
|
|
182952
183270
|
retry_count: tool.schema.number().optional().describe("Number of retry attempts during task"),
|
|
182953
|
-
skip_review: tool.schema.boolean().optional().describe("Skip review gate check (default: false). Use only for tasks that don't require coordinator review.")
|
|
183271
|
+
skip_review: tool.schema.boolean().optional().describe("Skip review gate check (default: false). Use only for tasks that don't require coordinator review."),
|
|
183272
|
+
commit_sha: tool.schema.string().optional().describe("Git commit SHA (auto-detected if not provided)"),
|
|
183273
|
+
commit_message: tool.schema.string().optional().describe("Commit message (auto-detected if not provided)"),
|
|
183274
|
+
commit_branch: tool.schema.string().optional().describe("Git branch (auto-detected if not provided)")
|
|
182954
183275
|
},
|
|
182955
183276
|
async execute(args2, _ctx) {
|
|
182956
183277
|
const missing = [];
|
|
@@ -183011,6 +183332,13 @@ var swarm_complete = tool({
|
|
|
183011
183332
|
}, null, 2);
|
|
183012
183333
|
}
|
|
183013
183334
|
}
|
|
183335
|
+
const gitInfo = getGitCommitInfo(args2.project_key) || {};
|
|
183336
|
+
const commitSha = args2.commit_sha || gitInfo.sha;
|
|
183337
|
+
const commitMessage = args2.commit_message || gitInfo.message;
|
|
183338
|
+
const commitBranch = args2.commit_branch || gitInfo.branch;
|
|
183339
|
+
const resultText = commitSha ? `${args2.summary}
|
|
183340
|
+
|
|
183341
|
+
Commit: ${commitSha.slice(0, 8)} (${commitBranch || "unknown"}) - ${commitMessage || "no message"}` : args2.summary;
|
|
183014
183342
|
try {
|
|
183015
183343
|
const adapter5 = await getHiveAdapter(args2.project_key);
|
|
183016
183344
|
const cell = await adapter5.getCell(args2.project_key, args2.bead_id);
|
|
@@ -183125,7 +183453,9 @@ This will be recorded as a negative learning signal.`;
|
|
|
183125
183453
|
}
|
|
183126
183454
|
}
|
|
183127
183455
|
try {
|
|
183128
|
-
await adapter5.closeCell(args2.project_key, args2.bead_id, args2.summary
|
|
183456
|
+
await adapter5.closeCell(args2.project_key, args2.bead_id, args2.summary, {
|
|
183457
|
+
result: resultText
|
|
183458
|
+
});
|
|
183129
183459
|
} catch (closeError) {
|
|
183130
183460
|
const errorMessage = closeError instanceof Error ? closeError.message : String(closeError);
|
|
183131
183461
|
return JSON.stringify({
|
|
@@ -183193,7 +183523,8 @@ This will be recorded as a negative learning signal.`;
|
|
|
183193
183523
|
retry_count: args2.retry_count || 0,
|
|
183194
183524
|
success: true,
|
|
183195
183525
|
scope_violation: contractValidation ? !contractValidation.valid : undefined,
|
|
183196
|
-
violation_files: contractValidation?.violations
|
|
183526
|
+
violation_files: contractValidation?.violations,
|
|
183527
|
+
commit: commitSha ? { sha: commitSha, message: commitMessage, branch: commitBranch } : undefined
|
|
183197
183528
|
});
|
|
183198
183529
|
const savedEvent = await appendEvent(event, args2.project_key);
|
|
183199
183530
|
outcomeEventId = savedEvent.id;
|
|
@@ -183378,6 +183709,8 @@ This will be recorded as a negative learning signal.`;
|
|
|
183378
183709
|
success: true,
|
|
183379
183710
|
bead_id: args2.bead_id,
|
|
183380
183711
|
closed: true,
|
|
183712
|
+
result: resultText,
|
|
183713
|
+
commit: commitSha ? { sha: commitSha, message: commitMessage, branch: commitBranch } : undefined,
|
|
183381
183714
|
reservations_released: reservationsReleased,
|
|
183382
183715
|
reservations_released_count: reservationsReleasedCount,
|
|
183383
183716
|
reservations_release_error: reservationsReleaseError,
|
|
@@ -184443,6 +184776,27 @@ swarmmail_reserve(
|
|
|
184443
184776
|
|
|
184444
184777
|
**Workers reserve their own files.** This prevents edit conflicts with other agents.
|
|
184445
184778
|
|
|
184779
|
+
### ⚠️ CRITICAL: File Path Handling (Next.js/Special Characters)
|
|
184780
|
+
|
|
184781
|
+
**DO NOT escape brackets or parentheses in file paths!**
|
|
184782
|
+
|
|
184783
|
+
When working with Next.js App Router or any codebase with special characters in paths:
|
|
184784
|
+
|
|
184785
|
+
❌ **WRONG** (will fail):
|
|
184786
|
+
\`\`\`
|
|
184787
|
+
Read: app/\\(content\\)/events/\\[slug\\]/page.tsx
|
|
184788
|
+
Glob: src/**/\\[id\\]/**/*.ts
|
|
184789
|
+
\`\`\`
|
|
184790
|
+
|
|
184791
|
+
✅ **CORRECT** (use raw paths):
|
|
184792
|
+
\`\`\`
|
|
184793
|
+
Read: app/(content)/events/[slug]/page.tsx
|
|
184794
|
+
Glob: src/**/[id]/**/*.ts
|
|
184795
|
+
\`\`\`
|
|
184796
|
+
|
|
184797
|
+
**The Read and Glob tools handle special characters automatically.**
|
|
184798
|
+
Never add backslashes before \`[\`, \`]\`, \`(\`, or \`)\` in file paths.
|
|
184799
|
+
|
|
184446
184800
|
### Step 5: Do the Work (TDD MANDATORY)
|
|
184447
184801
|
|
|
184448
184802
|
**Follow RED → GREEN → REFACTOR. No exceptions.**
|
|
@@ -185915,7 +186269,8 @@ var swarmTools = {
|
|
|
185915
186269
|
...promptTools,
|
|
185916
186270
|
...orchestrateTools,
|
|
185917
186271
|
...researchTools,
|
|
185918
|
-
...adversarialReviewTools
|
|
186272
|
+
...adversarialReviewTools,
|
|
186273
|
+
...verificationTools
|
|
185919
186274
|
};
|
|
185920
186275
|
|
|
185921
186276
|
// src/repo-crawl.ts
|
|
@@ -187010,23 +187365,23 @@ init_memory2();
|
|
|
187010
187365
|
import * as os2 from "node:os";
|
|
187011
187366
|
import * as path6 from "node:path";
|
|
187012
187367
|
import { join as join30 } from "node:path";
|
|
187013
|
-
var
|
|
187368
|
+
var cachedAdapter = null;
|
|
187014
187369
|
var cachedIndexer = null;
|
|
187015
|
-
var
|
|
187370
|
+
var cachedProjectPath = null;
|
|
187016
187371
|
async function getMemoryAdapter2(projectPath) {
|
|
187017
187372
|
const path4 = projectPath || process.cwd();
|
|
187018
|
-
if (
|
|
187019
|
-
return
|
|
187373
|
+
if (cachedAdapter && cachedProjectPath === path4) {
|
|
187374
|
+
return cachedAdapter;
|
|
187020
187375
|
}
|
|
187021
187376
|
const swarmMail = await getSwarmMailLibSQL(path4);
|
|
187022
187377
|
const dbAdapter = await swarmMail.getDatabase();
|
|
187023
|
-
|
|
187024
|
-
|
|
187025
|
-
return
|
|
187378
|
+
cachedAdapter = await createMemoryAdapter2(dbAdapter);
|
|
187379
|
+
cachedProjectPath = path4;
|
|
187380
|
+
return cachedAdapter;
|
|
187026
187381
|
}
|
|
187027
187382
|
async function getSessionIndexer(projectPath) {
|
|
187028
187383
|
const path4 = projectPath || process.cwd();
|
|
187029
|
-
if (cachedIndexer &&
|
|
187384
|
+
if (cachedIndexer && cachedProjectPath === path4) {
|
|
187030
187385
|
return cachedIndexer;
|
|
187031
187386
|
}
|
|
187032
187387
|
const swarmMail = await getSwarmMailLibSQL(path4);
|
|
@@ -187037,20 +187392,13 @@ async function getSessionIndexer(projectPath) {
|
|
|
187037
187392
|
ollamaModel: process.env.OLLAMA_MODEL || "mxbai-embed-large"
|
|
187038
187393
|
});
|
|
187039
187394
|
cachedIndexer = new SessionIndexer(db, ollamaLayer);
|
|
187040
|
-
|
|
187395
|
+
cachedProjectPath = path4;
|
|
187041
187396
|
return cachedIndexer;
|
|
187042
187397
|
}
|
|
187043
187398
|
var getHivemindAdapter = getMemoryAdapter2;
|
|
187044
187399
|
async function emitEvent(eventType, data) {
|
|
187045
|
-
|
|
187046
|
-
|
|
187047
|
-
const swarmMail = await getSwarmMailLibSQL(projectPath);
|
|
187048
|
-
const event = createEvent(eventType, {
|
|
187049
|
-
project_key: projectPath,
|
|
187050
|
-
...data
|
|
187051
|
-
});
|
|
187052
|
-
await swarmMail.appendEvent(event);
|
|
187053
|
-
} catch {}
|
|
187400
|
+
const projectPath = cachedProjectPath || process.cwd();
|
|
187401
|
+
await safeEmitEvent(eventType, data, "hivemind", projectPath);
|
|
187054
187402
|
}
|
|
187055
187403
|
var AGENT_DIRECTORIES = [
|
|
187056
187404
|
path6.join(os2.homedir(), ".config", "swarm-tools", "sessions"),
|
|
@@ -187093,6 +187441,15 @@ var hivemind_find = tool({
|
|
|
187093
187441
|
fts: tool.schema.boolean().optional().describe("Use full-text search instead of vector search (default: false)")
|
|
187094
187442
|
},
|
|
187095
187443
|
async execute(args3, ctx) {
|
|
187444
|
+
if (!args3.query || typeof args3.query !== "string" || args3.query.trim() === "") {
|
|
187445
|
+
return JSON.stringify({
|
|
187446
|
+
success: false,
|
|
187447
|
+
error: {
|
|
187448
|
+
code: "VALIDATION_ERROR",
|
|
187449
|
+
message: "query parameter is required and must be a non-empty string"
|
|
187450
|
+
}
|
|
187451
|
+
});
|
|
187452
|
+
}
|
|
187096
187453
|
const startTime = Date.now();
|
|
187097
187454
|
const adapter5 = await getMemoryAdapter2();
|
|
187098
187455
|
const result = await adapter5.find(args3);
|
|
@@ -187213,7 +187570,7 @@ var hivemind_sync = tool({
|
|
|
187213
187570
|
args: {},
|
|
187214
187571
|
async execute(args3, ctx) {
|
|
187215
187572
|
try {
|
|
187216
|
-
const projectPath =
|
|
187573
|
+
const projectPath = cachedProjectPath || process.cwd();
|
|
187217
187574
|
const swarmMail = await getSwarmMailLibSQL(projectPath);
|
|
187218
187575
|
const dbAdapter = await swarmMail.getDatabase();
|
|
187219
187576
|
const hiveDir = join30(projectPath, ".hive");
|
|
@@ -189429,13 +189786,17 @@ var AGENT_DIRECTORIES2 = [
|
|
|
189429
189786
|
path8.join(os3.homedir(), ".local", "share", "Claude"),
|
|
189430
189787
|
path8.join(os3.homedir(), ".aider")
|
|
189431
189788
|
];
|
|
189789
|
+
var sessionIndexerCache = new AdapterCache;
|
|
189432
189790
|
async function getSessionIndexer2() {
|
|
189433
|
-
const
|
|
189434
|
-
|
|
189435
|
-
|
|
189436
|
-
|
|
189791
|
+
const globalKey = "global-session-indexer";
|
|
189792
|
+
return sessionIndexerCache.get(globalKey, async () => {
|
|
189793
|
+
const db = await getDb();
|
|
189794
|
+
const ollamaLayer = makeOllamaLive({
|
|
189795
|
+
ollamaHost: process.env.OLLAMA_HOST || "http://localhost:11434",
|
|
189796
|
+
ollamaModel: process.env.OLLAMA_MODEL || "mxbai-embed-large"
|
|
189797
|
+
});
|
|
189798
|
+
return new SessionIndexer(db, ollamaLayer);
|
|
189437
189799
|
});
|
|
189438
|
-
return new SessionIndexer(db, ollamaLayer);
|
|
189439
189800
|
}
|
|
189440
189801
|
async function emitEvent2(eventType, data) {
|
|
189441
189802
|
try {
|