opencode-swarm-plugin 0.59.5 → 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/dist/index.js +290 -47
- 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/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 +1883 -386
- 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 +6 -4
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +62 -16
- package/dist/marketplace/index.js +290 -47
- package/dist/plugin.js +61 -15
- 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-orchestrate.d.ts +12 -0
- package/dist/swarm-orchestrate.d.ts.map +1 -1
- package/dist/swarm-prompts.js +61 -15
- package/dist/swarm.d.ts +6 -0
- 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/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
package/dist/bin/swarm.js
CHANGED
|
@@ -11185,6 +11185,9 @@ class LibSQLAdapter {
|
|
|
11185
11185
|
async close() {
|
|
11186
11186
|
this.client.close();
|
|
11187
11187
|
}
|
|
11188
|
+
async checkpoint() {
|
|
11189
|
+
await this.client.execute("PRAGMA wal_checkpoint(TRUNCATE)");
|
|
11190
|
+
}
|
|
11188
11191
|
}
|
|
11189
11192
|
async function createLibSQLAdapter(config2) {
|
|
11190
11193
|
let url3 = config2.url;
|
|
@@ -11201,6 +11204,7 @@ async function createLibSQLAdapter(config2) {
|
|
|
11201
11204
|
await client.execute("PRAGMA foreign_keys = ON");
|
|
11202
11205
|
await client.execute("PRAGMA busy_timeout = 5000");
|
|
11203
11206
|
await client.execute("PRAGMA journal_mode = WAL");
|
|
11207
|
+
await client.execute("PRAGMA wal_checkpoint(TRUNCATE)");
|
|
11204
11208
|
return new LibSQLAdapter(client);
|
|
11205
11209
|
}
|
|
11206
11210
|
async function createLibSQLMemorySchema(db) {
|
|
@@ -15137,6 +15141,16 @@ function drizzle(...params) {
|
|
|
15137
15141
|
}
|
|
15138
15142
|
return construct(params[0], params[1]);
|
|
15139
15143
|
}
|
|
15144
|
+
function getEmbeddingDimension(model) {
|
|
15145
|
+
const envDim = process.env.OLLAMA_EMBED_DIM;
|
|
15146
|
+
if (envDim) {
|
|
15147
|
+
const parsed = Number.parseInt(envDim, 10);
|
|
15148
|
+
if (!Number.isNaN(parsed) && parsed > 0) {
|
|
15149
|
+
return parsed;
|
|
15150
|
+
}
|
|
15151
|
+
}
|
|
15152
|
+
return MODEL_DIMENSIONS[model] ?? 1024;
|
|
15153
|
+
}
|
|
15140
15154
|
function createDrizzleClient(client) {
|
|
15141
15155
|
return drizzle(client, { schema: exports_schema });
|
|
15142
15156
|
}
|
|
@@ -16836,6 +16850,9 @@ async function withTiming(operation, fn2) {
|
|
|
16836
16850
|
}
|
|
16837
16851
|
}
|
|
16838
16852
|
function getDatabasePath2(projectPath) {
|
|
16853
|
+
if (process.env.SWARM_DB_PATH) {
|
|
16854
|
+
return process.env.SWARM_DB_PATH;
|
|
16855
|
+
}
|
|
16839
16856
|
const globalDir = join12(homedir2(), ".config", "swarm-tools");
|
|
16840
16857
|
if (!existsSync4(globalDir)) {
|
|
16841
16858
|
mkdirSync(globalDir, { recursive: true });
|
|
@@ -17755,12 +17772,18 @@ async function handleCellStatusChangedDrizzle(db2, event) {
|
|
|
17755
17772
|
await db2.update(beads).set(updates).where(eq(beads.id, event.cell_id));
|
|
17756
17773
|
}
|
|
17757
17774
|
async function handleBeadClosedDrizzle(db2, event) {
|
|
17758
|
-
|
|
17775
|
+
const setFields = {
|
|
17759
17776
|
status: "closed",
|
|
17760
17777
|
closed_at: event.timestamp,
|
|
17761
17778
|
closed_reason: event.reason,
|
|
17762
17779
|
updated_at: event.timestamp
|
|
17763
|
-
}
|
|
17780
|
+
};
|
|
17781
|
+
const result = event.result;
|
|
17782
|
+
if (result) {
|
|
17783
|
+
setFields.result = result;
|
|
17784
|
+
setFields.result_at = event.timestamp;
|
|
17785
|
+
}
|
|
17786
|
+
await db2.update(beads).set(setFields).where(eq(beads.id, event.cell_id));
|
|
17764
17787
|
const { invalidateBlockedCacheDrizzle: invalidateBlockedCacheDrizzle2 } = await Promise.resolve().then(() => (init_dependencies_drizzle(), exports_dependencies_drizzle));
|
|
17765
17788
|
await invalidateBlockedCacheDrizzle2(db2, event.project_key, event.cell_id);
|
|
17766
17789
|
}
|
|
@@ -25372,10 +25395,44 @@ async function getRelationshipsForEntity(entityId, db2, direction = "both") {
|
|
|
25372
25395
|
createdAt: new Date(row.created_at)
|
|
25373
25396
|
}));
|
|
25374
25397
|
}
|
|
25398
|
+
function chunkText(text4, maxChars, overlap) {
|
|
25399
|
+
if (text4.length <= maxChars) {
|
|
25400
|
+
return [text4];
|
|
25401
|
+
}
|
|
25402
|
+
const chunks3 = [];
|
|
25403
|
+
let start5 = 0;
|
|
25404
|
+
while (start5 < text4.length) {
|
|
25405
|
+
const end7 = Math.min(start5 + maxChars, text4.length);
|
|
25406
|
+
chunks3.push(text4.slice(start5, end7));
|
|
25407
|
+
start5 += maxChars - overlap;
|
|
25408
|
+
}
|
|
25409
|
+
return chunks3;
|
|
25410
|
+
}
|
|
25375
25411
|
function createMemoryAdapter(db2, config3) {
|
|
25376
25412
|
const store = createMemoryStore(db2);
|
|
25377
25413
|
const ollamaLayer = makeOllamaLive(config3);
|
|
25378
25414
|
const generateEmbedding = async (text4) => {
|
|
25415
|
+
if (text4.length > MAX_CHARS_PER_CHUNK) {
|
|
25416
|
+
console.warn(`⚠️ Text length (${text4.length} chars) exceeds limit (${MAX_CHARS_PER_CHUNK} chars). Auto-chunking into smaller segments for embedding.`);
|
|
25417
|
+
const chunks3 = chunkText(text4, MAX_CHARS_PER_CHUNK, CHUNK_OVERLAP);
|
|
25418
|
+
const embeddings = [];
|
|
25419
|
+
for (const chunk7 of chunks3) {
|
|
25420
|
+
const program2 = exports_Effect.gen(function* () {
|
|
25421
|
+
const ollama = yield* Ollama;
|
|
25422
|
+
return yield* ollama.embed(chunk7);
|
|
25423
|
+
});
|
|
25424
|
+
const result2 = await exports_Effect.runPromise(program2.pipe(exports_Effect.provide(ollamaLayer), exports_Effect.either));
|
|
25425
|
+
if (result2._tag === "Left") {
|
|
25426
|
+
return null;
|
|
25427
|
+
}
|
|
25428
|
+
embeddings.push(result2.right);
|
|
25429
|
+
}
|
|
25430
|
+
const avgEmbedding = embeddings[0].map((_, i) => {
|
|
25431
|
+
const sum8 = embeddings.reduce((acc, emb) => acc + emb[i], 0);
|
|
25432
|
+
return sum8 / embeddings.length;
|
|
25433
|
+
});
|
|
25434
|
+
return avgEmbedding;
|
|
25435
|
+
}
|
|
25379
25436
|
const program = exports_Effect.gen(function* () {
|
|
25380
25437
|
const ollama = yield* Ollama;
|
|
25381
25438
|
return yield* ollama.embed(text4);
|
|
@@ -27007,7 +27064,8 @@ function createHiveAdapter(db2, projectKey) {
|
|
|
27007
27064
|
reason,
|
|
27008
27065
|
closed_by: options2?.closed_by || null,
|
|
27009
27066
|
files_touched: options2?.files_touched || null,
|
|
27010
|
-
duration_ms: options2?.duration_ms || null
|
|
27067
|
+
duration_ms: options2?.duration_ms || null,
|
|
27068
|
+
result: options2?.result || null
|
|
27011
27069
|
};
|
|
27012
27070
|
await appendCellEvent(event, projectPath, db2);
|
|
27013
27071
|
const updated = await getCell(db2, projectKeyParam, cellId);
|
|
@@ -27608,7 +27666,7 @@ async function importSingleCell(adapter5, projectKey, cellExport, options2, resu
|
|
|
27608
27666
|
const status3 = cellExport.status === "tombstone" ? "closed" : cellExport.status;
|
|
27609
27667
|
const isClosed = status3 === "closed";
|
|
27610
27668
|
const closedAt = isClosed ? cellExport.closed_at ? new Date(cellExport.closed_at).getTime() : new Date(cellExport.updated_at).getTime() : null;
|
|
27611
|
-
await db2.query(`INSERT INTO
|
|
27669
|
+
await db2.query(`INSERT INTO beads (
|
|
27612
27670
|
id, project_key, type, status, title, description, priority,
|
|
27613
27671
|
parent_id, assignee, created_at, updated_at, closed_at
|
|
27614
27672
|
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)`, [
|
|
@@ -28173,7 +28231,9 @@ async function findCellsByPartialIdDrizzle(adapter5, projectKey, partialId) {
|
|
|
28173
28231
|
deleted_at: row.deleted_at,
|
|
28174
28232
|
deleted_by: row.deleted_by,
|
|
28175
28233
|
delete_reason: row.delete_reason,
|
|
28176
|
-
created_by: row.created_by
|
|
28234
|
+
created_by: row.created_by,
|
|
28235
|
+
result: row.result ?? null,
|
|
28236
|
+
result_at: row.result_at ?? null
|
|
28177
28237
|
}));
|
|
28178
28238
|
}
|
|
28179
28239
|
async function resolvePartialIdDrizzle(adapter5, projectKey, partialHash) {
|
|
@@ -47292,17 +47352,7 @@ ${prefix}}`;
|
|
|
47292
47352
|
unionAll,
|
|
47293
47353
|
intersect: intersect7,
|
|
47294
47354
|
except
|
|
47295
|
-
}), 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_checks = () => {}, 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,
|
|
47296
|
-
dataType() {
|
|
47297
|
-
return `F32_BLOB(${dimension})`;
|
|
47298
|
-
},
|
|
47299
|
-
toDriver(value10) {
|
|
47300
|
-
return Buffer.from(new Float32Array(value10).buffer);
|
|
47301
|
-
},
|
|
47302
|
-
fromDriver(value10) {
|
|
47303
|
-
return Array.from(new Float32Array(value10.buffer));
|
|
47304
|
-
}
|
|
47305
|
-
}), 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, 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 = (config2) => exports_Layer.succeed(Ollama, (() => {
|
|
47355
|
+
}), 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_checks = () => {}, 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 = (config2) => exports_Layer.succeed(Ollama, (() => {
|
|
47306
47356
|
const embedSingle = (text3) => exports_Effect.gen(function* () {
|
|
47307
47357
|
const response = yield* exports_Effect.tryPromise({
|
|
47308
47358
|
try: () => fetch(`${config2.ollamaHost}/api/embeddings`, {
|
|
@@ -47356,7 +47406,17 @@ ${prefix}}`;
|
|
|
47356
47406
|
})()), getDefaultConfig = () => ({
|
|
47357
47407
|
ollamaHost: process.env.OLLAMA_HOST || "http://localhost:11434",
|
|
47358
47408
|
ollamaModel: process.env.OLLAMA_MODEL || "mxbai-embed-large"
|
|
47359
|
-
}), init_ollama,
|
|
47409
|
+
}), init_ollama, vector2 = (dimension) => customType({
|
|
47410
|
+
dataType() {
|
|
47411
|
+
return `F32_BLOB(${dimension})`;
|
|
47412
|
+
},
|
|
47413
|
+
toDriver(value10) {
|
|
47414
|
+
return Buffer.from(new Float32Array(value10).buffer);
|
|
47415
|
+
},
|
|
47416
|
+
fromDriver(value10) {
|
|
47417
|
+
return Array.from(new Float32Array(value10.buffer));
|
|
47418
|
+
}
|
|
47419
|
+
}), 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, symbol22, _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_dist2, NEVER2, $brand, $ZodAsyncError, globalConfig, init_core3, exports_util2, captureStackTrace, allowsEval, getParsedType2 = (data) => {
|
|
47360
47420
|
const t = typeof data;
|
|
47361
47421
|
switch (t) {
|
|
47362
47422
|
case "undefined":
|
|
@@ -53128,7 +53188,7 @@ ${prefix}}`;
|
|
|
53128
53188
|
}
|
|
53129
53189
|
return this._output;
|
|
53130
53190
|
}
|
|
53131
|
-
}, 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 = (error43) => NORMAL_FLOW_ERRORS.has(error43.code), wantBigintFsStats, emptyFn = (_entryInfo) => true, normalizeFilter = (filter28) => {
|
|
53191
|
+
}, 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 = (error43) => NORMAL_FLOW_ERRORS.has(error43.code), wantBigintFsStats, emptyFn = (_entryInfo) => true, normalizeFilter = (filter28) => {
|
|
53132
53192
|
if (filter28 === undefined)
|
|
53133
53193
|
return emptyFn;
|
|
53134
53194
|
if (typeof filter28 === "function")
|
|
@@ -94166,7 +94226,12 @@ ${stack.split(`
|
|
|
94166
94226
|
retry_count: exports_external.number().min(0).default(0),
|
|
94167
94227
|
success: exports_external.boolean(),
|
|
94168
94228
|
scope_violation: exports_external.boolean().optional(),
|
|
94169
|
-
violation_files: exports_external.array(exports_external.string()).optional()
|
|
94229
|
+
violation_files: exports_external.array(exports_external.string()).optional(),
|
|
94230
|
+
commit: exports_external.object({
|
|
94231
|
+
sha: exports_external.string().optional(),
|
|
94232
|
+
message: exports_external.string().optional(),
|
|
94233
|
+
branch: exports_external.string().optional()
|
|
94234
|
+
}).optional()
|
|
94170
94235
|
});
|
|
94171
94236
|
HumanFeedbackEventSchema = BaseEventSchema.extend({
|
|
94172
94237
|
type: exports_external.literal("human_feedback"),
|
|
@@ -97971,8 +98036,24 @@ ${stack.split(`
|
|
|
97971
98036
|
init_driver();
|
|
97972
98037
|
init_session2();
|
|
97973
98038
|
});
|
|
98039
|
+
init_ollama = __esm2(() => {
|
|
98040
|
+
init_esm();
|
|
98041
|
+
init_esm();
|
|
98042
|
+
MODEL_DIMENSIONS = {
|
|
98043
|
+
"mxbai-embed-large": 1024,
|
|
98044
|
+
"nomic-embed-text": 768,
|
|
98045
|
+
"all-minilm": 384,
|
|
98046
|
+
"snowflake-arctic-embed": 1024
|
|
98047
|
+
};
|
|
98048
|
+
EMBEDDING_DIM2 = getEmbeddingDimension(process.env.OLLAMA_MODEL || "mxbai-embed-large");
|
|
98049
|
+
OllamaError = class OllamaError2 extends exports_Schema.TaggedError()("OllamaError", { reason: exports_Schema.String }) {
|
|
98050
|
+
};
|
|
98051
|
+
Ollama = class Ollama2 extends exports_Context.Tag("swarm-mail/Ollama")() {
|
|
98052
|
+
};
|
|
98053
|
+
});
|
|
97974
98054
|
init_memory = __esm2(() => {
|
|
97975
98055
|
init_sqlite_core();
|
|
98056
|
+
init_ollama();
|
|
97976
98057
|
memories = sqliteTable("memories", {
|
|
97977
98058
|
id: text("id").primaryKey(),
|
|
97978
98059
|
content: text("content").notNull(),
|
|
@@ -97982,7 +98063,7 @@ ${stack.split(`
|
|
|
97982
98063
|
created_at: text("created_at").default("(datetime('now'))"),
|
|
97983
98064
|
updated_at: text("updated_at").default("(datetime('now'))"),
|
|
97984
98065
|
decay_factor: real("decay_factor").default(1),
|
|
97985
|
-
embedding: vector2(
|
|
98066
|
+
embedding: vector2(EMBEDDING_DIM2)("embedding"),
|
|
97986
98067
|
valid_from: text("valid_from"),
|
|
97987
98068
|
valid_until: text("valid_until"),
|
|
97988
98069
|
superseded_by: text("superseded_by"),
|
|
@@ -98377,7 +98458,9 @@ ${stack.split(`
|
|
|
98377
98458
|
deleted_at: integer4("deleted_at"),
|
|
98378
98459
|
deleted_by: text("deleted_by"),
|
|
98379
98460
|
delete_reason: text("delete_reason"),
|
|
98380
|
-
created_by: text("created_by")
|
|
98461
|
+
created_by: text("created_by"),
|
|
98462
|
+
result: text("result"),
|
|
98463
|
+
result_at: integer4("result_at")
|
|
98381
98464
|
}, (table5) => ({
|
|
98382
98465
|
projectIdx: index("idx_beads_project").on(table5.project_key),
|
|
98383
98466
|
statusIdx: index("idx_beads_status").on(table5.status),
|
|
@@ -107209,6 +107292,8 @@ ${stack.split(`
|
|
|
107209
107292
|
hiveMigrations: () => hiveMigrations,
|
|
107210
107293
|
cellsViewMigrationLibSQL: () => cellsViewMigrationLibSQL,
|
|
107211
107294
|
cellsViewMigration: () => cellsViewMigration,
|
|
107295
|
+
beadsResultColumnsMigrationLibSQL: () => beadsResultColumnsMigrationLibSQL,
|
|
107296
|
+
beadsResultColumnsMigration: () => beadsResultColumnsMigration,
|
|
107212
107297
|
beadsMigrations: () => beadsMigrations,
|
|
107213
107298
|
beadsMigrationLibSQL: () => beadsMigrationLibSQL,
|
|
107214
107299
|
beadsMigration: () => beadsMigration
|
|
@@ -107595,10 +107680,128 @@ ${stack.split(`
|
|
|
107595
107680
|
DROP TABLE IF EXISTS bead_labels;
|
|
107596
107681
|
DROP TABLE IF EXISTS bead_dependencies;
|
|
107597
107682
|
DROP TABLE IF EXISTS beads;
|
|
107683
|
+
`
|
|
107684
|
+
};
|
|
107685
|
+
beadsResultColumnsMigration = {
|
|
107686
|
+
version: 10,
|
|
107687
|
+
description: "Add result and result_at columns to beads table",
|
|
107688
|
+
up: `
|
|
107689
|
+
ALTER TABLE beads ADD COLUMN result TEXT;
|
|
107690
|
+
ALTER TABLE beads ADD COLUMN result_at INTEGER;
|
|
107691
|
+
|
|
107692
|
+
-- Recreate cells view triggers to include new columns
|
|
107693
|
+
DROP TRIGGER IF EXISTS cells_insert;
|
|
107694
|
+
CREATE TRIGGER cells_insert
|
|
107695
|
+
INSTEAD OF INSERT ON cells
|
|
107696
|
+
FOR EACH ROW
|
|
107697
|
+
BEGIN
|
|
107698
|
+
INSERT INTO beads (id, project_key, type, status, title,
|
|
107699
|
+
description, priority, parent_id, assignee,
|
|
107700
|
+
created_at, updated_at, closed_at, closed_reason,
|
|
107701
|
+
deleted_at, deleted_by, delete_reason, created_by,
|
|
107702
|
+
result, result_at)
|
|
107703
|
+
VALUES (
|
|
107704
|
+
NEW.id, NEW.project_key, NEW.type, NEW.status, NEW.title,
|
|
107705
|
+
NEW.description, NEW.priority, NEW.parent_id, NEW.assignee,
|
|
107706
|
+
NEW.created_at, NEW.updated_at, NEW.closed_at, NEW.closed_reason,
|
|
107707
|
+
NEW.deleted_at, NEW.deleted_by, NEW.delete_reason, NEW.created_by,
|
|
107708
|
+
NEW.result, NEW.result_at
|
|
107709
|
+
);
|
|
107710
|
+
END;
|
|
107711
|
+
|
|
107712
|
+
DROP TRIGGER IF EXISTS cells_update;
|
|
107713
|
+
CREATE TRIGGER cells_update
|
|
107714
|
+
INSTEAD OF UPDATE ON cells
|
|
107715
|
+
FOR EACH ROW
|
|
107716
|
+
BEGIN
|
|
107717
|
+
UPDATE beads SET
|
|
107718
|
+
project_key = NEW.project_key,
|
|
107719
|
+
type = NEW.type,
|
|
107720
|
+
status = NEW.status,
|
|
107721
|
+
title = NEW.title,
|
|
107722
|
+
description = NEW.description,
|
|
107723
|
+
priority = NEW.priority,
|
|
107724
|
+
parent_id = NEW.parent_id,
|
|
107725
|
+
assignee = NEW.assignee,
|
|
107726
|
+
created_at = NEW.created_at,
|
|
107727
|
+
updated_at = NEW.updated_at,
|
|
107728
|
+
closed_at = NEW.closed_at,
|
|
107729
|
+
closed_reason = NEW.closed_reason,
|
|
107730
|
+
deleted_at = NEW.deleted_at,
|
|
107731
|
+
deleted_by = NEW.deleted_by,
|
|
107732
|
+
delete_reason = NEW.delete_reason,
|
|
107733
|
+
created_by = NEW.created_by,
|
|
107734
|
+
result = NEW.result,
|
|
107735
|
+
result_at = NEW.result_at
|
|
107736
|
+
WHERE id = NEW.id;
|
|
107737
|
+
END;
|
|
107738
|
+
`,
|
|
107739
|
+
down: `
|
|
107740
|
+
ALTER TABLE beads DROP COLUMN result;
|
|
107741
|
+
ALTER TABLE beads DROP COLUMN result_at;
|
|
107742
|
+
`
|
|
107743
|
+
};
|
|
107744
|
+
beadsResultColumnsMigrationLibSQL = {
|
|
107745
|
+
version: 10,
|
|
107746
|
+
description: "Add result and result_at columns to beads table (LibSQL)",
|
|
107747
|
+
up: `
|
|
107748
|
+
ALTER TABLE beads ADD COLUMN result TEXT;
|
|
107749
|
+
ALTER TABLE beads ADD COLUMN result_at INTEGER;
|
|
107750
|
+
|
|
107751
|
+
-- Recreate cells view triggers to include new columns
|
|
107752
|
+
DROP TRIGGER IF EXISTS cells_insert;
|
|
107753
|
+
CREATE TRIGGER cells_insert
|
|
107754
|
+
INSTEAD OF INSERT ON cells
|
|
107755
|
+
FOR EACH ROW
|
|
107756
|
+
BEGIN
|
|
107757
|
+
INSERT INTO beads (id, project_key, type, status, title,
|
|
107758
|
+
description, priority, parent_id, assignee,
|
|
107759
|
+
created_at, updated_at, closed_at, closed_reason,
|
|
107760
|
+
deleted_at, deleted_by, delete_reason, created_by,
|
|
107761
|
+
result, result_at)
|
|
107762
|
+
VALUES (
|
|
107763
|
+
NEW.id, NEW.project_key, NEW.type, NEW.status, NEW.title,
|
|
107764
|
+
NEW.description, NEW.priority, NEW.parent_id, NEW.assignee,
|
|
107765
|
+
NEW.created_at, NEW.updated_at, NEW.closed_at, NEW.closed_reason,
|
|
107766
|
+
NEW.deleted_at, NEW.deleted_by, NEW.delete_reason, NEW.created_by,
|
|
107767
|
+
NEW.result, NEW.result_at
|
|
107768
|
+
);
|
|
107769
|
+
END;
|
|
107770
|
+
|
|
107771
|
+
DROP TRIGGER IF EXISTS cells_update;
|
|
107772
|
+
CREATE TRIGGER cells_update
|
|
107773
|
+
INSTEAD OF UPDATE ON cells
|
|
107774
|
+
FOR EACH ROW
|
|
107775
|
+
BEGIN
|
|
107776
|
+
UPDATE beads SET
|
|
107777
|
+
project_key = NEW.project_key,
|
|
107778
|
+
type = NEW.type,
|
|
107779
|
+
status = NEW.status,
|
|
107780
|
+
title = NEW.title,
|
|
107781
|
+
description = NEW.description,
|
|
107782
|
+
priority = NEW.priority,
|
|
107783
|
+
parent_id = NEW.parent_id,
|
|
107784
|
+
assignee = NEW.assignee,
|
|
107785
|
+
created_at = NEW.created_at,
|
|
107786
|
+
updated_at = NEW.updated_at,
|
|
107787
|
+
closed_at = NEW.closed_at,
|
|
107788
|
+
closed_reason = NEW.closed_reason,
|
|
107789
|
+
deleted_at = NEW.deleted_at,
|
|
107790
|
+
deleted_by = NEW.deleted_by,
|
|
107791
|
+
delete_reason = NEW.delete_reason,
|
|
107792
|
+
created_by = NEW.created_by,
|
|
107793
|
+
result = NEW.result,
|
|
107794
|
+
result_at = NEW.result_at
|
|
107795
|
+
WHERE id = NEW.id;
|
|
107796
|
+
END;
|
|
107797
|
+
`,
|
|
107798
|
+
down: `
|
|
107799
|
+
-- SQLite doesn't support DROP COLUMN until 3.35.0
|
|
107800
|
+
-- Columns can be left as NULL if downgrade is needed
|
|
107598
107801
|
`
|
|
107599
107802
|
};
|
|
107600
107803
|
beadsMigrations = [beadsMigration];
|
|
107601
|
-
hiveMigrations = [beadsMigration, cellsViewMigration];
|
|
107804
|
+
hiveMigrations = [beadsMigration, cellsViewMigration, beadsResultColumnsMigration];
|
|
107602
107805
|
sessionsMigrationLibSQL = {
|
|
107603
107806
|
version: 9,
|
|
107604
107807
|
description: "Add sessions table for handoff notes (Chainlink pattern)",
|
|
@@ -107628,7 +107831,8 @@ ${stack.split(`
|
|
|
107628
107831
|
hiveMigrationsLibSQL = [
|
|
107629
107832
|
beadsMigrationLibSQL,
|
|
107630
107833
|
cellsViewMigrationLibSQL,
|
|
107631
|
-
sessionsMigrationLibSQL
|
|
107834
|
+
sessionsMigrationLibSQL,
|
|
107835
|
+
beadsResultColumnsMigrationLibSQL
|
|
107632
107836
|
];
|
|
107633
107837
|
});
|
|
107634
107838
|
init_migrations2 = __esm2(() => {
|
|
@@ -108297,14 +108501,7 @@ ${stack.split(`
|
|
|
108297
108501
|
init_store2 = __esm2(() => {
|
|
108298
108502
|
init_drizzle_orm();
|
|
108299
108503
|
init_memory();
|
|
108300
|
-
|
|
108301
|
-
init_ollama = __esm2(() => {
|
|
108302
|
-
init_esm();
|
|
108303
|
-
init_esm();
|
|
108304
|
-
OllamaError = class OllamaError2 extends exports_Schema.TaggedError()("OllamaError", { reason: exports_Schema.String }) {
|
|
108305
|
-
};
|
|
108306
|
-
Ollama = class Ollama2 extends exports_Context.Tag("swarm-mail/Ollama")() {
|
|
108307
|
-
};
|
|
108504
|
+
init_ollama();
|
|
108308
108505
|
});
|
|
108309
108506
|
init_pagination = __esm2(() => {
|
|
108310
108507
|
FIELD_SETS = {
|
|
@@ -127744,6 +127941,9 @@ class LibSQLAdapter2 {
|
|
|
127744
127941
|
async close() {
|
|
127745
127942
|
this.client.close();
|
|
127746
127943
|
}
|
|
127944
|
+
async checkpoint() {
|
|
127945
|
+
await this.client.execute("PRAGMA wal_checkpoint(TRUNCATE)");
|
|
127946
|
+
}
|
|
127747
127947
|
}
|
|
127748
127948
|
async function createLibSQLAdapter2(config22) {
|
|
127749
127949
|
let url32 = config22.url;
|
|
@@ -127760,6 +127960,7 @@ async function createLibSQLAdapter2(config22) {
|
|
|
127760
127960
|
await client.execute("PRAGMA foreign_keys = ON");
|
|
127761
127961
|
await client.execute("PRAGMA busy_timeout = 5000");
|
|
127762
127962
|
await client.execute("PRAGMA journal_mode = WAL");
|
|
127963
|
+
await client.execute("PRAGMA wal_checkpoint(TRUNCATE)");
|
|
127763
127964
|
return new LibSQLAdapter2(client);
|
|
127764
127965
|
}
|
|
127765
127966
|
async function createLibSQLMemorySchema2(db) {
|
|
@@ -131696,6 +131897,16 @@ function drizzle2(...params) {
|
|
|
131696
131897
|
}
|
|
131697
131898
|
return construct2(params[0], params[1]);
|
|
131698
131899
|
}
|
|
131900
|
+
function getEmbeddingDimension2(model) {
|
|
131901
|
+
const envDim = process.env.OLLAMA_EMBED_DIM;
|
|
131902
|
+
if (envDim) {
|
|
131903
|
+
const parsed = Number.parseInt(envDim, 10);
|
|
131904
|
+
if (!Number.isNaN(parsed) && parsed > 0) {
|
|
131905
|
+
return parsed;
|
|
131906
|
+
}
|
|
131907
|
+
}
|
|
131908
|
+
return MODEL_DIMENSIONS2[model] ?? 1024;
|
|
131909
|
+
}
|
|
131699
131910
|
function createDrizzleClient2(client) {
|
|
131700
131911
|
return drizzle2(client, { schema: exports_schema2 });
|
|
131701
131912
|
}
|
|
@@ -133395,6 +133606,9 @@ async function withTiming2(operation, fn22) {
|
|
|
133395
133606
|
}
|
|
133396
133607
|
}
|
|
133397
133608
|
function getDatabasePath22(projectPath) {
|
|
133609
|
+
if (process.env.SWARM_DB_PATH) {
|
|
133610
|
+
return process.env.SWARM_DB_PATH;
|
|
133611
|
+
}
|
|
133398
133612
|
const globalDir = join122(homedir22(), ".config", "swarm-tools");
|
|
133399
133613
|
if (!existsSync42(globalDir)) {
|
|
133400
133614
|
mkdirSync4(globalDir, { recursive: true });
|
|
@@ -134314,12 +134528,18 @@ async function handleCellStatusChangedDrizzle2(db2, event) {
|
|
|
134314
134528
|
await db2.update(beads2).set(updates).where(eq2(beads2.id, event.cell_id));
|
|
134315
134529
|
}
|
|
134316
134530
|
async function handleBeadClosedDrizzle2(db2, event) {
|
|
134317
|
-
|
|
134531
|
+
const setFields = {
|
|
134318
134532
|
status: "closed",
|
|
134319
134533
|
closed_at: event.timestamp,
|
|
134320
134534
|
closed_reason: event.reason,
|
|
134321
134535
|
updated_at: event.timestamp
|
|
134322
|
-
}
|
|
134536
|
+
};
|
|
134537
|
+
const result = event.result;
|
|
134538
|
+
if (result) {
|
|
134539
|
+
setFields.result = result;
|
|
134540
|
+
setFields.result_at = event.timestamp;
|
|
134541
|
+
}
|
|
134542
|
+
await db2.update(beads2).set(setFields).where(eq2(beads2.id, event.cell_id));
|
|
134323
134543
|
const { invalidateBlockedCacheDrizzle: invalidateBlockedCacheDrizzle22 } = await Promise.resolve().then(() => (init_dependencies_drizzle2(), exports_dependencies_drizzle2));
|
|
134324
134544
|
await invalidateBlockedCacheDrizzle22(db2, event.project_key, event.cell_id);
|
|
134325
134545
|
}
|
|
@@ -141931,10 +142151,44 @@ async function getRelationshipsForEntity2(entityId, db2, direction = "both") {
|
|
|
141931
142151
|
createdAt: new Date(row.created_at)
|
|
141932
142152
|
}));
|
|
141933
142153
|
}
|
|
142154
|
+
function chunkText2(text4, maxChars, overlap) {
|
|
142155
|
+
if (text4.length <= maxChars) {
|
|
142156
|
+
return [text4];
|
|
142157
|
+
}
|
|
142158
|
+
const chunks32 = [];
|
|
142159
|
+
let start52 = 0;
|
|
142160
|
+
while (start52 < text4.length) {
|
|
142161
|
+
const end72 = Math.min(start52 + maxChars, text4.length);
|
|
142162
|
+
chunks32.push(text4.slice(start52, end72));
|
|
142163
|
+
start52 += maxChars - overlap;
|
|
142164
|
+
}
|
|
142165
|
+
return chunks32;
|
|
142166
|
+
}
|
|
141934
142167
|
function createMemoryAdapter3(db2, config32) {
|
|
141935
142168
|
const store = createMemoryStore2(db2);
|
|
141936
142169
|
const ollamaLayer = makeOllamaLive2(config32);
|
|
141937
142170
|
const generateEmbedding = async (text4) => {
|
|
142171
|
+
if (text4.length > MAX_CHARS_PER_CHUNK2) {
|
|
142172
|
+
console.warn(`⚠️ Text length (${text4.length} chars) exceeds limit (${MAX_CHARS_PER_CHUNK2} chars). Auto-chunking into smaller segments for embedding.`);
|
|
142173
|
+
const chunks32 = chunkText2(text4, MAX_CHARS_PER_CHUNK2, CHUNK_OVERLAP2);
|
|
142174
|
+
const embeddings = [];
|
|
142175
|
+
for (const chunk72 of chunks32) {
|
|
142176
|
+
const program2 = exports_Effect3.gen(function* () {
|
|
142177
|
+
const ollama = yield* Ollama2;
|
|
142178
|
+
return yield* ollama.embed(chunk72);
|
|
142179
|
+
});
|
|
142180
|
+
const result2 = await exports_Effect3.runPromise(program2.pipe(exports_Effect3.provide(ollamaLayer), exports_Effect3.either));
|
|
142181
|
+
if (result2._tag === "Left") {
|
|
142182
|
+
return null;
|
|
142183
|
+
}
|
|
142184
|
+
embeddings.push(result2.right);
|
|
142185
|
+
}
|
|
142186
|
+
const avgEmbedding = embeddings[0].map((_, i) => {
|
|
142187
|
+
const sum82 = embeddings.reduce((acc, emb) => acc + emb[i], 0);
|
|
142188
|
+
return sum82 / embeddings.length;
|
|
142189
|
+
});
|
|
142190
|
+
return avgEmbedding;
|
|
142191
|
+
}
|
|
141938
142192
|
const program = exports_Effect3.gen(function* () {
|
|
141939
142193
|
const ollama = yield* Ollama2;
|
|
141940
142194
|
return yield* ollama.embed(text4);
|
|
@@ -143566,7 +143820,8 @@ function createHiveAdapter2(db2, projectKey) {
|
|
|
143566
143820
|
reason,
|
|
143567
143821
|
closed_by: options2?.closed_by || null,
|
|
143568
143822
|
files_touched: options2?.files_touched || null,
|
|
143569
|
-
duration_ms: options2?.duration_ms || null
|
|
143823
|
+
duration_ms: options2?.duration_ms || null,
|
|
143824
|
+
result: options2?.result || null
|
|
143570
143825
|
};
|
|
143571
143826
|
await appendCellEvent2(event, projectPath, db2);
|
|
143572
143827
|
const updated = await getCell2(db2, projectKeyParam, cellId);
|
|
@@ -144167,7 +144422,7 @@ async function importSingleCell2(adapter52, projectKey, cellExport, options2, re
|
|
|
144167
144422
|
const status32 = cellExport.status === "tombstone" ? "closed" : cellExport.status;
|
|
144168
144423
|
const isClosed = status32 === "closed";
|
|
144169
144424
|
const closedAt = isClosed ? cellExport.closed_at ? new Date(cellExport.closed_at).getTime() : new Date(cellExport.updated_at).getTime() : null;
|
|
144170
|
-
await db2.query(`INSERT INTO
|
|
144425
|
+
await db2.query(`INSERT INTO beads (
|
|
144171
144426
|
id, project_key, type, status, title, description, priority,
|
|
144172
144427
|
parent_id, assignee, created_at, updated_at, closed_at
|
|
144173
144428
|
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)`, [
|
|
@@ -144732,7 +144987,9 @@ async function findCellsByPartialIdDrizzle2(adapter52, projectKey, partialId) {
|
|
|
144732
144987
|
deleted_at: row.deleted_at,
|
|
144733
144988
|
deleted_by: row.deleted_by,
|
|
144734
144989
|
delete_reason: row.delete_reason,
|
|
144735
|
-
created_by: row.created_by
|
|
144990
|
+
created_by: row.created_by,
|
|
144991
|
+
result: row.result ?? null,
|
|
144992
|
+
result_at: row.result_at ?? null
|
|
144736
144993
|
}));
|
|
144737
144994
|
}
|
|
144738
144995
|
async function resolvePartialIdDrizzle2(adapter52, projectKey, partialHash) {
|
|
@@ -163851,17 +164108,7 @@ ${prefix}}`;
|
|
|
163851
164108
|
unionAll: unionAll2,
|
|
163852
164109
|
intersect: intersect72,
|
|
163853
164110
|
except: except2
|
|
163854
|
-
}), union172, unionAll2, intersect72, except2, init_select22, QueryBuilder3, init_query_builder22, SQLiteInsertBuilder2, SQLiteInsertBase2, init_insert2, SQLiteUpdateBuilder2, SQLiteUpdateBase2, init_update2, init_query_builders2, SQLiteCountBuilder2, init_count2, RelationalQueryBuilder2, SQLiteRelationalQuery2, SQLiteSyncRelationalQuery2, init_query22, SQLiteRaw2, init_raw2, BaseSQLiteDatabase2, init_db2, init_alias22 = () => {}, init_checks7 = () => {}, IndexBuilderOn2, IndexBuilder2, Index2, init_indexes2, PrimaryKeyBuilder22, PrimaryKey22, init_primary_keys22, ExecuteResultSync2, SQLitePreparedQuery2, SQLiteSession2, SQLiteTransaction2, init_session3, init_utils22 = () => {}, init_view2 = () => {}, init_sqlite_core2, LibSQLSession2, LibSQLTransaction2, LibSQLPreparedQuery2, init_session22, LibSQLDatabase2, init_driver_core2, init_driver2, init_libsql22,
|
|
163855
|
-
dataType() {
|
|
163856
|
-
return `F32_BLOB(${dimension})`;
|
|
163857
|
-
},
|
|
163858
|
-
toDriver(value102) {
|
|
163859
|
-
return Buffer.from(new Float32Array(value102).buffer);
|
|
163860
|
-
},
|
|
163861
|
-
fromDriver(value102) {
|
|
163862
|
-
return Array.from(new Float32Array(value102.buffer));
|
|
163863
|
-
}
|
|
163864
|
-
}), memories2, memoryLinks2, entities2, relationships2, memoryEntities2, init_memory3, init_expressions22, exports_drizzle_orm2, init_drizzle_orm2, exports_streams3, eventsTable2, agentsTable2, messagesTable2, messageRecipientsTable2, reservationsTable2, locksTable2, cursorsTable2, evalRecordsTable2, swarmContextsTable2, decisionTracesTable2, entityLinksTable2, init_streams3, exports_hive2, beads2, cells2, cellEvents2, beadLabels2, cellLabels2, beadComments2, cellComments2, beadDependencies2, cellDependencies2, blockedBeadsCache2, dirtyBeads2, schemaVersion2, init_hive2, exports_schema2, init_schema2, init_drizzle2, require_entity2, require_logger2, require_query_promise2, require_column2, require_column_builder2, require_table_utils2, require_foreign_keys2, require_tracing_utils2, require_unique_constraint2, require_array2, require_common22, require_enum2, require_subquery3, require_version3, require_tracing2, require_view_common3, require_table3, require_sql3, require_alias3, require_selection_proxy2, require_utils9, require_delete2, require_casing2, require_errors2, require_int_common2, require_bigint2, require_bigserial2, require_boolean2, require_char2, require_cidr2, require_custom2, require_date_common2, require_date2, require_double_precision2, require_inet2, require_integer2, require_interval2, require_json3, require_jsonb2, require_line2, require_macaddr2, require_macaddr82, require_numeric2, require_point2, require_utils22, require_geometry2, require_real2, require_serial2, require_smallint2, require_smallserial2, require_text2, require_time2, require_timestamp3, require_uuid2, require_varchar2, require_bit2, require_halfvec2, require_sparsevec2, require_vector3, require_columns2, require_all2, require_table22, require_primary_keys2, require_conditions2, require_select3, require_expressions2, require_relations2, require_aggregate2, require_vector22, require_functions2, require_sql22, require_view_base2, require_dialect2, require_query_builder3, require_select22, require_query_builder22, require_insert2, require_refresh_materialized_view2, require_select_types2, require_update2, require_query_builders2, require_count2, require_query2, require_raw2, require_db2, require_alias22, require_checks2, require_indexes2, require_policies2, require_roles2, require_sequence2, require_view_common22, require_view2, require_schema3, require_session3, require_subquery22, require_utils32, require_utils42, require_pg_core2, require_session22, require_driver2, require_pglite2, exports_libsql_convenience2, instances2, init_libsql_convenience2, exports_lock2, DurableLock2, DurableLockLive2, init_lock2, exports_reservation_utils2, init_reservation_utils2, init_projections_drizzle3, exports_store_drizzle2, init_store_drizzle2, exports_swarm_mail2, MAX_INBOX_LIMIT3 = 5, DEFAULT_TTL_SECONDS3 = 3600, ADJECTIVES3, NOUNS3, init_swarm_mail2, MAX_INBOX_LIMIT22 = 5, DEFAULT_TTL_SECONDS22 = 3600, ADJECTIVES22, NOUNS22, init_agent_mail2, exports_migrations3, beadsMigration2, cellsViewMigration2, cellsViewMigrationLibSQL2, beadsMigrationLibSQL2, beadsMigrations2, hiveMigrations2, sessionsMigrationLibSQL2, hiveMigrationsLibSQL2, init_migrations4, memoryMigration2, memoryMigrations2, init_migrations22, exports_migrations22, migrations2, init_migrations32, urlAlphabet2 = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", POOL_SIZE_MULTIPLIER2 = 128, pool2, poolOffset2, init_nanoid2 = () => {}, init_decision_trace_store2, ClientBuffer2, init_client_buffer2, exports_streams22, SLOW_QUERY_THRESHOLD_MS2 = 100, init_streams22, exports_store2, adapterCache4, TIMESTAMP_SAFE_UNTIL2, init_store3, init_adapter3, exports_dependencies_drizzle2, MAX_DEPENDENCY_DEPTH3 = 100, init_dependencies_drizzle2, exports_projections_drizzle2, init_projections_drizzle22, exports_dependencies2, MAX_DEPENDENCY_DEPTH22 = 100, EMBEDDING_DIM22 = 1024, init_store22, OllamaError2, Ollama2, makeOllamaLive2 = (config22) => exports_Layer2.succeed(Ollama2, (() => {
|
|
164111
|
+
}), union172, unionAll2, intersect72, except2, init_select22, QueryBuilder3, init_query_builder22, SQLiteInsertBuilder2, SQLiteInsertBase2, init_insert2, SQLiteUpdateBuilder2, SQLiteUpdateBase2, init_update2, init_query_builders2, SQLiteCountBuilder2, init_count2, RelationalQueryBuilder2, SQLiteRelationalQuery2, SQLiteSyncRelationalQuery2, init_query22, SQLiteRaw2, init_raw2, BaseSQLiteDatabase2, init_db2, init_alias22 = () => {}, init_checks7 = () => {}, IndexBuilderOn2, IndexBuilder2, Index2, init_indexes2, PrimaryKeyBuilder22, PrimaryKey22, init_primary_keys22, ExecuteResultSync2, SQLitePreparedQuery2, SQLiteSession2, SQLiteTransaction2, init_session3, init_utils22 = () => {}, init_view2 = () => {}, init_sqlite_core2, LibSQLSession2, LibSQLTransaction2, LibSQLPreparedQuery2, init_session22, LibSQLDatabase2, init_driver_core2, init_driver2, init_libsql22, MODEL_DIMENSIONS2, EMBEDDING_DIM22, OllamaError2, Ollama2, makeOllamaLive2 = (config22) => exports_Layer2.succeed(Ollama2, (() => {
|
|
163865
164112
|
const embedSingle = (text32) => exports_Effect3.gen(function* () {
|
|
163866
164113
|
const response = yield* exports_Effect3.tryPromise({
|
|
163867
164114
|
try: () => fetch(`${config22.ollamaHost}/api/embeddings`, {
|
|
@@ -163915,7 +164162,17 @@ ${prefix}}`;
|
|
|
163915
164162
|
})()), getDefaultConfig2 = () => ({
|
|
163916
164163
|
ollamaHost: process.env.OLLAMA_HOST || "http://localhost:11434",
|
|
163917
164164
|
ollamaModel: process.env.OLLAMA_MODEL || "mxbai-embed-large"
|
|
163918
|
-
}), init_ollama2,
|
|
164165
|
+
}), init_ollama2, vector22 = (dimension) => customType2({
|
|
164166
|
+
dataType() {
|
|
164167
|
+
return `F32_BLOB(${dimension})`;
|
|
164168
|
+
},
|
|
164169
|
+
toDriver(value102) {
|
|
164170
|
+
return Buffer.from(new Float32Array(value102).buffer);
|
|
164171
|
+
},
|
|
164172
|
+
fromDriver(value102) {
|
|
164173
|
+
return Array.from(new Float32Array(value102.buffer));
|
|
164174
|
+
}
|
|
164175
|
+
}), memories2, memoryLinks2, entities2, relationships2, memoryEntities2, init_memory3, init_expressions22, exports_drizzle_orm2, init_drizzle_orm2, exports_streams3, eventsTable2, agentsTable2, messagesTable2, messageRecipientsTable2, reservationsTable2, locksTable2, cursorsTable2, evalRecordsTable2, swarmContextsTable2, decisionTracesTable2, entityLinksTable2, init_streams3, exports_hive2, beads2, cells2, cellEvents2, beadLabels2, cellLabels2, beadComments2, cellComments2, beadDependencies2, cellDependencies2, blockedBeadsCache2, dirtyBeads2, schemaVersion2, init_hive2, exports_schema2, init_schema2, init_drizzle2, require_entity2, require_logger2, require_query_promise2, require_column2, require_column_builder2, require_table_utils2, require_foreign_keys2, require_tracing_utils2, require_unique_constraint2, require_array2, require_common22, require_enum2, require_subquery3, require_version3, require_tracing2, require_view_common3, require_table3, require_sql3, require_alias3, require_selection_proxy2, require_utils9, require_delete2, require_casing2, require_errors2, require_int_common2, require_bigint2, require_bigserial2, require_boolean2, require_char2, require_cidr2, require_custom2, require_date_common2, require_date2, require_double_precision2, require_inet2, require_integer2, require_interval2, require_json3, require_jsonb2, require_line2, require_macaddr2, require_macaddr82, require_numeric2, require_point2, require_utils22, require_geometry2, require_real2, require_serial2, require_smallint2, require_smallserial2, require_text2, require_time2, require_timestamp3, require_uuid2, require_varchar2, require_bit2, require_halfvec2, require_sparsevec2, require_vector3, require_columns2, require_all2, require_table22, require_primary_keys2, require_conditions2, require_select3, require_expressions2, require_relations2, require_aggregate2, require_vector22, require_functions2, require_sql22, require_view_base2, require_dialect2, require_query_builder3, require_select22, require_query_builder22, require_insert2, require_refresh_materialized_view2, require_select_types2, require_update2, require_query_builders2, require_count2, require_query2, require_raw2, require_db2, require_alias22, require_checks2, require_indexes2, require_policies2, require_roles2, require_sequence2, require_view_common22, require_view2, require_schema3, require_session3, require_subquery22, require_utils32, require_utils42, require_pg_core2, require_session22, require_driver2, require_pglite2, exports_libsql_convenience2, instances2, init_libsql_convenience2, exports_lock2, DurableLock2, DurableLockLive2, init_lock2, exports_reservation_utils2, init_reservation_utils2, init_projections_drizzle3, exports_store_drizzle2, init_store_drizzle2, exports_swarm_mail2, MAX_INBOX_LIMIT3 = 5, DEFAULT_TTL_SECONDS3 = 3600, ADJECTIVES3, NOUNS3, init_swarm_mail2, MAX_INBOX_LIMIT22 = 5, DEFAULT_TTL_SECONDS22 = 3600, ADJECTIVES22, NOUNS22, init_agent_mail2, exports_migrations3, beadsMigration2, cellsViewMigration2, cellsViewMigrationLibSQL2, beadsMigrationLibSQL2, beadsResultColumnsMigration2, beadsResultColumnsMigrationLibSQL2, beadsMigrations2, hiveMigrations2, sessionsMigrationLibSQL2, hiveMigrationsLibSQL2, init_migrations4, memoryMigration2, memoryMigrations2, init_migrations22, exports_migrations22, migrations2, init_migrations32, urlAlphabet2 = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", POOL_SIZE_MULTIPLIER2 = 128, pool2, poolOffset2, init_nanoid2 = () => {}, init_decision_trace_store2, ClientBuffer2, init_client_buffer2, exports_streams22, SLOW_QUERY_THRESHOLD_MS2 = 100, init_streams22, exports_store2, adapterCache4, TIMESTAMP_SAFE_UNTIL2, init_store3, init_adapter3, exports_dependencies_drizzle2, MAX_DEPENDENCY_DEPTH3 = 100, init_dependencies_drizzle2, exports_projections_drizzle2, init_projections_drizzle22, exports_dependencies2, MAX_DEPENDENCY_DEPTH22 = 100, init_store22, FIELD_SETS2, init_pagination2, marker16 = "vercel.ai.error", symbol65, _a16, _b16, AISDKError2, name25 = "AI_APICallError", marker24, symbol222, _a24, _b23, APICallError2, name222 = "AI_EmptyResponseBodyError", marker34, symbol322, _a34, _b33, EmptyResponseBodyError2, name34 = "AI_InvalidArgumentError", marker44, symbol422, _a44, _b43, InvalidArgumentError3, name44 = "AI_InvalidPromptError", marker54, symbol522, _a54, _b53, InvalidPromptError2, name54 = "AI_InvalidResponseDataError", marker64, symbol622, _a64, _b63, InvalidResponseDataError2, name64 = "AI_JSONParseError", marker74, symbol74, _a74, _b73, JSONParseError2, name73 = "AI_LoadAPIKeyError", marker83, symbol83, _a83, _b82, LoadAPIKeyError2, name83 = "AI_LoadSettingError", marker93, symbol93, _a93, _b92, LoadSettingError2, name93 = "AI_NoContentGeneratedError", marker103, symbol103, _a103, _b102, NoContentGeneratedError2, name103 = "AI_NoSuchModelError", marker113, symbol113, _a113, _b112, NoSuchModelError2, name113 = "AI_TooManyEmbeddingValuesForCallError", marker123, symbol123, _a123, _b122, TooManyEmbeddingValuesForCallError2, name123 = "AI_TypeValidationError", marker133, symbol133, _a133, _b132, TypeValidationError2, name133 = "AI_UnsupportedFunctionalityError", marker143, symbol143, _a143, _b142, UnsupportedFunctionalityError2, init_dist10, NEVER22, $brand4, $ZodAsyncError4, globalConfig4, init_core33, exports_util22, captureStackTrace4, allowsEval4, getParsedType22 = (data) => {
|
|
163919
164176
|
const t = typeof data;
|
|
163920
164177
|
switch (t) {
|
|
163921
164178
|
case "undefined":
|
|
@@ -169687,7 +169944,7 @@ ${prefix}}`;
|
|
|
169687
169944
|
}
|
|
169688
169945
|
return this._output;
|
|
169689
169946
|
}
|
|
169690
|
-
}, JsonToSseTransformStream2, uiMessageChunkSchema2, originalGenerateId22, uiMessagesSchema2, originalGenerateId32, originalGenerateId42, name1422 = "AI_NoSuchProviderError", marker1422, symbol1422, _a1422, init_dist62, exports_memory_operations2, MemoryOperationSchema2, init_memory_operations2, exports_auto_tagger2, AutoTagResultSchema2, init_auto_tagger2, exports_memory_linking2, DEFAULT_CONFIG2, init_memory_linking2, exports_entity_extraction2, EntitySchema2, RelationshipSchema2, ExtractionSchema2, init_entity_extraction2, init_adapter22, import_debug2, log8, CORS_HEADERS2, HEARTBEAT_INTERVAL2 = 30000, checkpointFrequency2, humanFeedback2, recoverySuccess2, scopeViolations2, taskDuration2, ANALYTICS_QUERIES2, DEFAULT_TOMBSTONE_TTL_MS2 = 2592000000, MIN_TOMBSTONE_TTL_MS2 = 604800000, CLOCK_SKEW_GRACE_MS2 = 3600000, STATUS_TOMBSTONE2 = "tombstone", dbInstance2, clientInstance2, TABLE_COLUMNS2, EntryTypes2, defaultOptions22, RECURSIVE_ERROR_CODE2 = "READDIRP_RECURSIVE_ERROR", NORMAL_FLOW_ERRORS2, ALL_TYPES2, DIR_TYPES2, FILE_TYPES2, isNormalFlowError2 = (error434) => NORMAL_FLOW_ERRORS2.has(error434.code), wantBigintFsStats2, emptyFn2 = (_entryInfo) => true, normalizeFilter2 = (filter282) => {
|
|
169947
|
+
}, JsonToSseTransformStream2, uiMessageChunkSchema2, originalGenerateId22, uiMessagesSchema2, originalGenerateId32, originalGenerateId42, name1422 = "AI_NoSuchProviderError", marker1422, symbol1422, _a1422, init_dist62, exports_memory_operations2, MemoryOperationSchema2, init_memory_operations2, exports_auto_tagger2, AutoTagResultSchema2, init_auto_tagger2, exports_memory_linking2, DEFAULT_CONFIG2, init_memory_linking2, exports_entity_extraction2, EntitySchema2, RelationshipSchema2, ExtractionSchema2, init_entity_extraction2, MAX_CHARS_PER_CHUNK2 = 24000, CHUNK_OVERLAP2 = 200, init_adapter22, import_debug2, log8, CORS_HEADERS2, HEARTBEAT_INTERVAL2 = 30000, checkpointFrequency2, humanFeedback2, recoverySuccess2, scopeViolations2, taskDuration2, ANALYTICS_QUERIES2, DEFAULT_TOMBSTONE_TTL_MS2 = 2592000000, MIN_TOMBSTONE_TTL_MS2 = 604800000, CLOCK_SKEW_GRACE_MS2 = 3600000, STATUS_TOMBSTONE2 = "tombstone", dbInstance2, clientInstance2, TABLE_COLUMNS2, EntryTypes2, defaultOptions22, RECURSIVE_ERROR_CODE2 = "READDIRP_RECURSIVE_ERROR", NORMAL_FLOW_ERRORS2, ALL_TYPES2, DIR_TYPES2, FILE_TYPES2, isNormalFlowError2 = (error434) => NORMAL_FLOW_ERRORS2.has(error434.code), wantBigintFsStats2, emptyFn2 = (_entryInfo) => true, normalizeFilter2 = (filter282) => {
|
|
169691
169948
|
if (filter282 === undefined)
|
|
169692
169949
|
return emptyFn2;
|
|
169693
169950
|
if (typeof filter282 === "function")
|
|
@@ -210725,7 +210982,12 @@ ${stack.split(`
|
|
|
210725
210982
|
retry_count: exports_external6.number().min(0).default(0),
|
|
210726
210983
|
success: exports_external6.boolean(),
|
|
210727
210984
|
scope_violation: exports_external6.boolean().optional(),
|
|
210728
|
-
violation_files: exports_external6.array(exports_external6.string()).optional()
|
|
210985
|
+
violation_files: exports_external6.array(exports_external6.string()).optional(),
|
|
210986
|
+
commit: exports_external6.object({
|
|
210987
|
+
sha: exports_external6.string().optional(),
|
|
210988
|
+
message: exports_external6.string().optional(),
|
|
210989
|
+
branch: exports_external6.string().optional()
|
|
210990
|
+
}).optional()
|
|
210729
210991
|
});
|
|
210730
210992
|
HumanFeedbackEventSchema2 = BaseEventSchema2.extend({
|
|
210731
210993
|
type: exports_external6.literal("human_feedback"),
|
|
@@ -214530,8 +214792,24 @@ ${stack.split(`
|
|
|
214530
214792
|
init_driver2();
|
|
214531
214793
|
init_session22();
|
|
214532
214794
|
});
|
|
214795
|
+
init_ollama2 = __esm5(() => {
|
|
214796
|
+
init_esm6();
|
|
214797
|
+
init_esm6();
|
|
214798
|
+
MODEL_DIMENSIONS2 = {
|
|
214799
|
+
"mxbai-embed-large": 1024,
|
|
214800
|
+
"nomic-embed-text": 768,
|
|
214801
|
+
"all-minilm": 384,
|
|
214802
|
+
"snowflake-arctic-embed": 1024
|
|
214803
|
+
};
|
|
214804
|
+
EMBEDDING_DIM22 = getEmbeddingDimension2(process.env.OLLAMA_MODEL || "mxbai-embed-large");
|
|
214805
|
+
OllamaError2 = class OllamaError3 extends exports_Schema2.TaggedError()("OllamaError", { reason: exports_Schema2.String }) {
|
|
214806
|
+
};
|
|
214807
|
+
Ollama2 = class Ollama3 extends exports_Context2.Tag("swarm-mail/Ollama")() {
|
|
214808
|
+
};
|
|
214809
|
+
});
|
|
214533
214810
|
init_memory3 = __esm5(() => {
|
|
214534
214811
|
init_sqlite_core2();
|
|
214812
|
+
init_ollama2();
|
|
214535
214813
|
memories2 = sqliteTable2("memories", {
|
|
214536
214814
|
id: text2("id").primaryKey(),
|
|
214537
214815
|
content: text2("content").notNull(),
|
|
@@ -214541,7 +214819,7 @@ ${stack.split(`
|
|
|
214541
214819
|
created_at: text2("created_at").default("(datetime('now'))"),
|
|
214542
214820
|
updated_at: text2("updated_at").default("(datetime('now'))"),
|
|
214543
214821
|
decay_factor: real2("decay_factor").default(1),
|
|
214544
|
-
embedding: vector22(
|
|
214822
|
+
embedding: vector22(EMBEDDING_DIM22)("embedding"),
|
|
214545
214823
|
valid_from: text2("valid_from"),
|
|
214546
214824
|
valid_until: text2("valid_until"),
|
|
214547
214825
|
superseded_by: text2("superseded_by"),
|
|
@@ -214936,7 +215214,9 @@ ${stack.split(`
|
|
|
214936
215214
|
deleted_at: integer42("deleted_at"),
|
|
214937
215215
|
deleted_by: text2("deleted_by"),
|
|
214938
215216
|
delete_reason: text2("delete_reason"),
|
|
214939
|
-
created_by: text2("created_by")
|
|
215217
|
+
created_by: text2("created_by"),
|
|
215218
|
+
result: text2("result"),
|
|
215219
|
+
result_at: integer42("result_at")
|
|
214940
215220
|
}, (table5) => ({
|
|
214941
215221
|
projectIdx: index2("idx_beads_project").on(table5.project_key),
|
|
214942
215222
|
statusIdx: index2("idx_beads_status").on(table5.status),
|
|
@@ -223768,6 +224048,8 @@ ${stack.split(`
|
|
|
223768
224048
|
hiveMigrations: () => hiveMigrations2,
|
|
223769
224049
|
cellsViewMigrationLibSQL: () => cellsViewMigrationLibSQL2,
|
|
223770
224050
|
cellsViewMigration: () => cellsViewMigration2,
|
|
224051
|
+
beadsResultColumnsMigrationLibSQL: () => beadsResultColumnsMigrationLibSQL2,
|
|
224052
|
+
beadsResultColumnsMigration: () => beadsResultColumnsMigration2,
|
|
223771
224053
|
beadsMigrations: () => beadsMigrations2,
|
|
223772
224054
|
beadsMigrationLibSQL: () => beadsMigrationLibSQL2,
|
|
223773
224055
|
beadsMigration: () => beadsMigration2
|
|
@@ -224154,10 +224436,128 @@ ${stack.split(`
|
|
|
224154
224436
|
DROP TABLE IF EXISTS bead_labels;
|
|
224155
224437
|
DROP TABLE IF EXISTS bead_dependencies;
|
|
224156
224438
|
DROP TABLE IF EXISTS beads;
|
|
224439
|
+
`
|
|
224440
|
+
};
|
|
224441
|
+
beadsResultColumnsMigration2 = {
|
|
224442
|
+
version: 10,
|
|
224443
|
+
description: "Add result and result_at columns to beads table",
|
|
224444
|
+
up: `
|
|
224445
|
+
ALTER TABLE beads ADD COLUMN result TEXT;
|
|
224446
|
+
ALTER TABLE beads ADD COLUMN result_at INTEGER;
|
|
224447
|
+
|
|
224448
|
+
-- Recreate cells view triggers to include new columns
|
|
224449
|
+
DROP TRIGGER IF EXISTS cells_insert;
|
|
224450
|
+
CREATE TRIGGER cells_insert
|
|
224451
|
+
INSTEAD OF INSERT ON cells
|
|
224452
|
+
FOR EACH ROW
|
|
224453
|
+
BEGIN
|
|
224454
|
+
INSERT INTO beads (id, project_key, type, status, title,
|
|
224455
|
+
description, priority, parent_id, assignee,
|
|
224456
|
+
created_at, updated_at, closed_at, closed_reason,
|
|
224457
|
+
deleted_at, deleted_by, delete_reason, created_by,
|
|
224458
|
+
result, result_at)
|
|
224459
|
+
VALUES (
|
|
224460
|
+
NEW.id, NEW.project_key, NEW.type, NEW.status, NEW.title,
|
|
224461
|
+
NEW.description, NEW.priority, NEW.parent_id, NEW.assignee,
|
|
224462
|
+
NEW.created_at, NEW.updated_at, NEW.closed_at, NEW.closed_reason,
|
|
224463
|
+
NEW.deleted_at, NEW.deleted_by, NEW.delete_reason, NEW.created_by,
|
|
224464
|
+
NEW.result, NEW.result_at
|
|
224465
|
+
);
|
|
224466
|
+
END;
|
|
224467
|
+
|
|
224468
|
+
DROP TRIGGER IF EXISTS cells_update;
|
|
224469
|
+
CREATE TRIGGER cells_update
|
|
224470
|
+
INSTEAD OF UPDATE ON cells
|
|
224471
|
+
FOR EACH ROW
|
|
224472
|
+
BEGIN
|
|
224473
|
+
UPDATE beads SET
|
|
224474
|
+
project_key = NEW.project_key,
|
|
224475
|
+
type = NEW.type,
|
|
224476
|
+
status = NEW.status,
|
|
224477
|
+
title = NEW.title,
|
|
224478
|
+
description = NEW.description,
|
|
224479
|
+
priority = NEW.priority,
|
|
224480
|
+
parent_id = NEW.parent_id,
|
|
224481
|
+
assignee = NEW.assignee,
|
|
224482
|
+
created_at = NEW.created_at,
|
|
224483
|
+
updated_at = NEW.updated_at,
|
|
224484
|
+
closed_at = NEW.closed_at,
|
|
224485
|
+
closed_reason = NEW.closed_reason,
|
|
224486
|
+
deleted_at = NEW.deleted_at,
|
|
224487
|
+
deleted_by = NEW.deleted_by,
|
|
224488
|
+
delete_reason = NEW.delete_reason,
|
|
224489
|
+
created_by = NEW.created_by,
|
|
224490
|
+
result = NEW.result,
|
|
224491
|
+
result_at = NEW.result_at
|
|
224492
|
+
WHERE id = NEW.id;
|
|
224493
|
+
END;
|
|
224494
|
+
`,
|
|
224495
|
+
down: `
|
|
224496
|
+
ALTER TABLE beads DROP COLUMN result;
|
|
224497
|
+
ALTER TABLE beads DROP COLUMN result_at;
|
|
224498
|
+
`
|
|
224499
|
+
};
|
|
224500
|
+
beadsResultColumnsMigrationLibSQL2 = {
|
|
224501
|
+
version: 10,
|
|
224502
|
+
description: "Add result and result_at columns to beads table (LibSQL)",
|
|
224503
|
+
up: `
|
|
224504
|
+
ALTER TABLE beads ADD COLUMN result TEXT;
|
|
224505
|
+
ALTER TABLE beads ADD COLUMN result_at INTEGER;
|
|
224506
|
+
|
|
224507
|
+
-- Recreate cells view triggers to include new columns
|
|
224508
|
+
DROP TRIGGER IF EXISTS cells_insert;
|
|
224509
|
+
CREATE TRIGGER cells_insert
|
|
224510
|
+
INSTEAD OF INSERT ON cells
|
|
224511
|
+
FOR EACH ROW
|
|
224512
|
+
BEGIN
|
|
224513
|
+
INSERT INTO beads (id, project_key, type, status, title,
|
|
224514
|
+
description, priority, parent_id, assignee,
|
|
224515
|
+
created_at, updated_at, closed_at, closed_reason,
|
|
224516
|
+
deleted_at, deleted_by, delete_reason, created_by,
|
|
224517
|
+
result, result_at)
|
|
224518
|
+
VALUES (
|
|
224519
|
+
NEW.id, NEW.project_key, NEW.type, NEW.status, NEW.title,
|
|
224520
|
+
NEW.description, NEW.priority, NEW.parent_id, NEW.assignee,
|
|
224521
|
+
NEW.created_at, NEW.updated_at, NEW.closed_at, NEW.closed_reason,
|
|
224522
|
+
NEW.deleted_at, NEW.deleted_by, NEW.delete_reason, NEW.created_by,
|
|
224523
|
+
NEW.result, NEW.result_at
|
|
224524
|
+
);
|
|
224525
|
+
END;
|
|
224526
|
+
|
|
224527
|
+
DROP TRIGGER IF EXISTS cells_update;
|
|
224528
|
+
CREATE TRIGGER cells_update
|
|
224529
|
+
INSTEAD OF UPDATE ON cells
|
|
224530
|
+
FOR EACH ROW
|
|
224531
|
+
BEGIN
|
|
224532
|
+
UPDATE beads SET
|
|
224533
|
+
project_key = NEW.project_key,
|
|
224534
|
+
type = NEW.type,
|
|
224535
|
+
status = NEW.status,
|
|
224536
|
+
title = NEW.title,
|
|
224537
|
+
description = NEW.description,
|
|
224538
|
+
priority = NEW.priority,
|
|
224539
|
+
parent_id = NEW.parent_id,
|
|
224540
|
+
assignee = NEW.assignee,
|
|
224541
|
+
created_at = NEW.created_at,
|
|
224542
|
+
updated_at = NEW.updated_at,
|
|
224543
|
+
closed_at = NEW.closed_at,
|
|
224544
|
+
closed_reason = NEW.closed_reason,
|
|
224545
|
+
deleted_at = NEW.deleted_at,
|
|
224546
|
+
deleted_by = NEW.deleted_by,
|
|
224547
|
+
delete_reason = NEW.delete_reason,
|
|
224548
|
+
created_by = NEW.created_by,
|
|
224549
|
+
result = NEW.result,
|
|
224550
|
+
result_at = NEW.result_at
|
|
224551
|
+
WHERE id = NEW.id;
|
|
224552
|
+
END;
|
|
224553
|
+
`,
|
|
224554
|
+
down: `
|
|
224555
|
+
-- SQLite doesn't support DROP COLUMN until 3.35.0
|
|
224556
|
+
-- Columns can be left as NULL if downgrade is needed
|
|
224157
224557
|
`
|
|
224158
224558
|
};
|
|
224159
224559
|
beadsMigrations2 = [beadsMigration2];
|
|
224160
|
-
hiveMigrations2 = [beadsMigration2, cellsViewMigration2];
|
|
224560
|
+
hiveMigrations2 = [beadsMigration2, cellsViewMigration2, beadsResultColumnsMigration2];
|
|
224161
224561
|
sessionsMigrationLibSQL2 = {
|
|
224162
224562
|
version: 9,
|
|
224163
224563
|
description: "Add sessions table for handoff notes (Chainlink pattern)",
|
|
@@ -224187,7 +224587,8 @@ ${stack.split(`
|
|
|
224187
224587
|
hiveMigrationsLibSQL2 = [
|
|
224188
224588
|
beadsMigrationLibSQL2,
|
|
224189
224589
|
cellsViewMigrationLibSQL2,
|
|
224190
|
-
sessionsMigrationLibSQL2
|
|
224590
|
+
sessionsMigrationLibSQL2,
|
|
224591
|
+
beadsResultColumnsMigrationLibSQL2
|
|
224191
224592
|
];
|
|
224192
224593
|
});
|
|
224193
224594
|
init_migrations22 = __esm5(() => {
|
|
@@ -224856,14 +225257,7 @@ ${stack.split(`
|
|
|
224856
225257
|
init_store22 = __esm5(() => {
|
|
224857
225258
|
init_drizzle_orm2();
|
|
224858
225259
|
init_memory3();
|
|
224859
|
-
|
|
224860
|
-
init_ollama2 = __esm5(() => {
|
|
224861
|
-
init_esm6();
|
|
224862
|
-
init_esm6();
|
|
224863
|
-
OllamaError2 = class OllamaError3 extends exports_Schema2.TaggedError()("OllamaError", { reason: exports_Schema2.String }) {
|
|
224864
|
-
};
|
|
224865
|
-
Ollama2 = class Ollama3 extends exports_Context2.Tag("swarm-mail/Ollama")() {
|
|
224866
|
-
};
|
|
225260
|
+
init_ollama2();
|
|
224867
225261
|
});
|
|
224868
225262
|
init_pagination2 = __esm5(() => {
|
|
224869
225263
|
FIELD_SETS2 = {
|
|
@@ -278532,7 +278926,8 @@ Scripts run in the skill's directory with the project directory as an argument.`
|
|
|
278532
278926
|
args: {
|
|
278533
278927
|
skill: tool3.schema.string().describe("Name of the skill"),
|
|
278534
278928
|
script: tool3.schema.string().describe("Name of the script file to execute"),
|
|
278535
|
-
args: tool3.schema.array(tool3.schema.string()).optional().describe("Additional arguments to pass to the script")
|
|
278929
|
+
args: tool3.schema.array(tool3.schema.string()).optional().describe("Additional arguments to pass to the script"),
|
|
278930
|
+
timeout_ms: tool3.schema.number().optional().describe("Timeout in milliseconds (default: 60000)")
|
|
278536
278931
|
},
|
|
278537
278932
|
async execute(args5, ctx) {
|
|
278538
278933
|
console.warn("[DEPRECATED] skills_execute is deprecated. OpenCode now provides native skills support. This tool will be removed in a future version.");
|
|
@@ -278545,7 +278940,7 @@ Scripts run in the skill's directory with the project directory as an argument.`
|
|
|
278545
278940
|
}
|
|
278546
278941
|
const scriptPath = join47(skill.directory, "scripts", args5.script);
|
|
278547
278942
|
const scriptArgs = args5.args || [];
|
|
278548
|
-
const TIMEOUT_MS = 60000;
|
|
278943
|
+
const TIMEOUT_MS = args5.timeout_ms ?? 60000;
|
|
278549
278944
|
const proc = Bun.spawn([scriptPath, skillsProjectDirectory2, ...scriptArgs], {
|
|
278550
278945
|
cwd: skill.directory,
|
|
278551
278946
|
stdout: "pipe",
|
|
@@ -279448,6 +279843,7 @@ __export(exports_storage2, {
|
|
|
279448
279843
|
resetStorage: () => resetStorage2,
|
|
279449
279844
|
resetSessionStats: () => resetSessionStats2,
|
|
279450
279845
|
resetCommandCache: () => resetCommandCache2,
|
|
279846
|
+
resetAvailabilityCache: () => resetAvailabilityCache2,
|
|
279451
279847
|
isSemanticMemoryAvailable: () => isSemanticMemoryAvailable2,
|
|
279452
279848
|
getTestCollectionName: () => getTestCollectionName2,
|
|
279453
279849
|
getStorage: () => getStorage2,
|
|
@@ -279798,12 +280194,25 @@ function createStorage2(config4 = {}) {
|
|
|
279798
280194
|
}
|
|
279799
280195
|
}
|
|
279800
280196
|
async function isSemanticMemoryAvailable2() {
|
|
279801
|
-
|
|
279802
|
-
|
|
279803
|
-
|
|
279804
|
-
|
|
279805
|
-
|
|
279806
|
-
|
|
280197
|
+
if (_availabilityCache2 !== null)
|
|
280198
|
+
return _availabilityCache2;
|
|
280199
|
+
if (_availabilityPromise2)
|
|
280200
|
+
return _availabilityPromise2;
|
|
280201
|
+
_availabilityPromise2 = (async () => {
|
|
280202
|
+
try {
|
|
280203
|
+
const result = await execSemanticMemory2(["stats"]);
|
|
280204
|
+
_availabilityCache2 = result.exitCode === 0;
|
|
280205
|
+
} catch {
|
|
280206
|
+
_availabilityCache2 = false;
|
|
280207
|
+
}
|
|
280208
|
+
_availabilityPromise2 = null;
|
|
280209
|
+
return _availabilityCache2;
|
|
280210
|
+
})();
|
|
280211
|
+
return _availabilityPromise2;
|
|
280212
|
+
}
|
|
280213
|
+
function resetAvailabilityCache2() {
|
|
280214
|
+
_availabilityCache2 = null;
|
|
280215
|
+
_availabilityPromise2 = null;
|
|
279807
280216
|
}
|
|
279808
280217
|
async function getResolvedCommand2() {
|
|
279809
280218
|
return resolveSemanticMemoryCommand2();
|
|
@@ -279839,7 +280248,7 @@ async function resetStorage2() {
|
|
|
279839
280248
|
}
|
|
279840
280249
|
globalStoragePromise2 = null;
|
|
279841
280250
|
}
|
|
279842
|
-
var cachedCommand2 = null, DEFAULT_STORAGE_CONFIG2, sessionStats2, globalStorage2 = null, globalStoragePromise2 = null;
|
|
280251
|
+
var cachedCommand2 = null, DEFAULT_STORAGE_CONFIG2, sessionStats2, _availabilityCache2 = null, _availabilityPromise2 = null, globalStorage2 = null, globalStoragePromise2 = null;
|
|
279843
280252
|
var init_storage2 = __esm(() => {
|
|
279844
280253
|
init_learning2();
|
|
279845
280254
|
init_anti_patterns2();
|
|
@@ -291485,6 +291894,419 @@ var require_pino = __commonJS((exports2, module2) => {
|
|
|
291485
291894
|
module2.exports.pino = pino;
|
|
291486
291895
|
});
|
|
291487
291896
|
|
|
291897
|
+
// bin/commands/doctor.ts
|
|
291898
|
+
var exports_doctor = {};
|
|
291899
|
+
__export(exports_doctor, {
|
|
291900
|
+
runDoctor: () => runDoctor,
|
|
291901
|
+
parseDoctorArgs: () => parseDoctorArgs,
|
|
291902
|
+
formatDoctorReport: () => formatDoctorReport,
|
|
291903
|
+
doctorDeep: () => doctorDeep,
|
|
291904
|
+
detectCycles: () => detectCycles,
|
|
291905
|
+
checkZombieBlocked: () => checkZombieBlocked,
|
|
291906
|
+
checkStaleReservations: () => checkStaleReservations,
|
|
291907
|
+
checkOrphanedCells: () => checkOrphanedCells,
|
|
291908
|
+
checkGhostWorkers: () => checkGhostWorkers,
|
|
291909
|
+
checkDependencyCycles: () => checkDependencyCycles,
|
|
291910
|
+
checkDbIntegrity: () => checkDbIntegrity
|
|
291911
|
+
});
|
|
291912
|
+
async function checkDbIntegrity(db) {
|
|
291913
|
+
try {
|
|
291914
|
+
const result = await db.query("PRAGMA integrity_check");
|
|
291915
|
+
const rows = result.rows;
|
|
291916
|
+
if (rows.length === 1 && rows[0].integrity_check === "ok") {
|
|
291917
|
+
return {
|
|
291918
|
+
name: "Database integrity",
|
|
291919
|
+
status: "pass",
|
|
291920
|
+
message: "OK"
|
|
291921
|
+
};
|
|
291922
|
+
}
|
|
291923
|
+
const issues = rows.map((r) => r.integrity_check).filter(Boolean);
|
|
291924
|
+
return {
|
|
291925
|
+
name: "Database integrity",
|
|
291926
|
+
status: "fail",
|
|
291927
|
+
message: `${issues.length} integrity issue(s) found`,
|
|
291928
|
+
details: issues,
|
|
291929
|
+
fixable: false
|
|
291930
|
+
};
|
|
291931
|
+
} catch (error56) {
|
|
291932
|
+
return {
|
|
291933
|
+
name: "Database integrity",
|
|
291934
|
+
status: "fail",
|
|
291935
|
+
message: `Check failed: ${error56 instanceof Error ? error56.message : String(error56)}`,
|
|
291936
|
+
fixable: false
|
|
291937
|
+
};
|
|
291938
|
+
}
|
|
291939
|
+
}
|
|
291940
|
+
async function checkOrphanedCells(db, options2 = {}) {
|
|
291941
|
+
try {
|
|
291942
|
+
const result = await db.query(`SELECT b.id, b.parent_id, b.title
|
|
291943
|
+
FROM beads b
|
|
291944
|
+
LEFT JOIN beads p ON b.parent_id = p.id
|
|
291945
|
+
WHERE b.parent_id IS NOT NULL AND p.id IS NULL`);
|
|
291946
|
+
const orphans = result.rows;
|
|
291947
|
+
if (orphans.length === 0) {
|
|
291948
|
+
return {
|
|
291949
|
+
name: "Cell references",
|
|
291950
|
+
status: "pass",
|
|
291951
|
+
message: "OK"
|
|
291952
|
+
};
|
|
291953
|
+
}
|
|
291954
|
+
let fixed6 = 0;
|
|
291955
|
+
if (options2.fix) {
|
|
291956
|
+
await db.exec(`UPDATE beads SET parent_id = NULL
|
|
291957
|
+
WHERE parent_id IS NOT NULL
|
|
291958
|
+
AND parent_id NOT IN (SELECT id FROM beads)`);
|
|
291959
|
+
fixed6 = orphans.length;
|
|
291960
|
+
}
|
|
291961
|
+
const details = orphans.map((o) => `${o.id} ("${o.title}") → parent ${o.parent_id} (missing)`);
|
|
291962
|
+
return {
|
|
291963
|
+
name: "Cell references",
|
|
291964
|
+
status: options2.fix && fixed6 > 0 ? "warn" : "fail",
|
|
291965
|
+
message: options2.fix ? `Fixed ${fixed6} orphaned reference(s)` : `${orphans.length} orphaned cell(s) found`,
|
|
291966
|
+
details,
|
|
291967
|
+
fixable: true,
|
|
291968
|
+
fixed: fixed6
|
|
291969
|
+
};
|
|
291970
|
+
} catch (error56) {
|
|
291971
|
+
return {
|
|
291972
|
+
name: "Cell references",
|
|
291973
|
+
status: "fail",
|
|
291974
|
+
message: `Check failed: ${error56 instanceof Error ? error56.message : String(error56)}`,
|
|
291975
|
+
fixable: false
|
|
291976
|
+
};
|
|
291977
|
+
}
|
|
291978
|
+
}
|
|
291979
|
+
async function checkDependencyCycles(db) {
|
|
291980
|
+
try {
|
|
291981
|
+
const result = await db.query(`SELECT cell_id, depends_on_id FROM bead_dependencies WHERE relationship = 'blocks'`);
|
|
291982
|
+
const edges3 = result.rows;
|
|
291983
|
+
if (edges3.length === 0) {
|
|
291984
|
+
return {
|
|
291985
|
+
name: "Dependency cycles",
|
|
291986
|
+
status: "pass",
|
|
291987
|
+
message: "OK (no dependencies)"
|
|
291988
|
+
};
|
|
291989
|
+
}
|
|
291990
|
+
const graph = new Map;
|
|
291991
|
+
for (const edge of edges3) {
|
|
291992
|
+
const existing = graph.get(edge.cell_id) || [];
|
|
291993
|
+
existing.push(edge.depends_on_id);
|
|
291994
|
+
graph.set(edge.cell_id, existing);
|
|
291995
|
+
}
|
|
291996
|
+
const cycles = detectCycles(graph);
|
|
291997
|
+
if (cycles.length === 0) {
|
|
291998
|
+
return {
|
|
291999
|
+
name: "Dependency cycles",
|
|
292000
|
+
status: "pass",
|
|
292001
|
+
message: "OK"
|
|
292002
|
+
};
|
|
292003
|
+
}
|
|
292004
|
+
const details = cycles.map((cycle) => cycle.join("→"));
|
|
292005
|
+
return {
|
|
292006
|
+
name: "Dependency cycles",
|
|
292007
|
+
status: "fail",
|
|
292008
|
+
message: `Found ${cycles.length} cycle(s)`,
|
|
292009
|
+
details,
|
|
292010
|
+
fixable: false
|
|
292011
|
+
};
|
|
292012
|
+
} catch (error56) {
|
|
292013
|
+
return {
|
|
292014
|
+
name: "Dependency cycles",
|
|
292015
|
+
status: "fail",
|
|
292016
|
+
message: `Check failed: ${error56 instanceof Error ? error56.message : String(error56)}`,
|
|
292017
|
+
fixable: false
|
|
292018
|
+
};
|
|
292019
|
+
}
|
|
292020
|
+
}
|
|
292021
|
+
function detectCycles(graph) {
|
|
292022
|
+
const WHITE = 0;
|
|
292023
|
+
const GRAY = 1;
|
|
292024
|
+
const BLACK = 2;
|
|
292025
|
+
const color = new Map;
|
|
292026
|
+
const parent = new Map;
|
|
292027
|
+
const cycles = [];
|
|
292028
|
+
for (const [node, neighbors3] of graph) {
|
|
292029
|
+
color.set(node, WHITE);
|
|
292030
|
+
for (const neighbor of neighbors3) {
|
|
292031
|
+
if (!color.has(neighbor)) {
|
|
292032
|
+
color.set(neighbor, WHITE);
|
|
292033
|
+
}
|
|
292034
|
+
}
|
|
292035
|
+
}
|
|
292036
|
+
function dfs3(u) {
|
|
292037
|
+
color.set(u, GRAY);
|
|
292038
|
+
for (const v of graph.get(u) || []) {
|
|
292039
|
+
if (color.get(v) === GRAY) {
|
|
292040
|
+
const cycle = [v];
|
|
292041
|
+
let curr = u;
|
|
292042
|
+
while (curr !== v) {
|
|
292043
|
+
cycle.push(curr);
|
|
292044
|
+
curr = parent.get(curr) || v;
|
|
292045
|
+
}
|
|
292046
|
+
cycle.push(v);
|
|
292047
|
+
cycle.reverse();
|
|
292048
|
+
cycles.push(cycle);
|
|
292049
|
+
} else if (color.get(v) === WHITE) {
|
|
292050
|
+
parent.set(v, u);
|
|
292051
|
+
dfs3(v);
|
|
292052
|
+
}
|
|
292053
|
+
}
|
|
292054
|
+
color.set(u, BLACK);
|
|
292055
|
+
}
|
|
292056
|
+
for (const node of color.keys()) {
|
|
292057
|
+
if (color.get(node) === WHITE) {
|
|
292058
|
+
parent.set(node, null);
|
|
292059
|
+
dfs3(node);
|
|
292060
|
+
}
|
|
292061
|
+
}
|
|
292062
|
+
return cycles;
|
|
292063
|
+
}
|
|
292064
|
+
async function checkStaleReservations(db, options2 = {}) {
|
|
292065
|
+
try {
|
|
292066
|
+
const now4 = Date.now();
|
|
292067
|
+
const result = await db.query(`SELECT id, agent_name, path_pattern, expires_at
|
|
292068
|
+
FROM reservations
|
|
292069
|
+
WHERE released_at IS NULL AND expires_at < ?`, [now4]);
|
|
292070
|
+
const stale = result.rows;
|
|
292071
|
+
if (stale.length === 0) {
|
|
292072
|
+
return {
|
|
292073
|
+
name: "Reservations",
|
|
292074
|
+
status: "pass",
|
|
292075
|
+
message: "OK"
|
|
292076
|
+
};
|
|
292077
|
+
}
|
|
292078
|
+
let fixed6 = 0;
|
|
292079
|
+
if (options2.fix) {
|
|
292080
|
+
await db.query(`UPDATE reservations SET released_at = ? WHERE released_at IS NULL AND expires_at < ?`, [now4, now4]);
|
|
292081
|
+
fixed6 = stale.length;
|
|
292082
|
+
}
|
|
292083
|
+
const details = stale.map((r) => {
|
|
292084
|
+
const ago = Math.round((now4 - r.expires_at) / 1000);
|
|
292085
|
+
return `${r.path_pattern} (agent: ${r.agent_name}, expired ${ago}s ago)`;
|
|
292086
|
+
});
|
|
292087
|
+
return {
|
|
292088
|
+
name: "Reservations",
|
|
292089
|
+
status: options2.fix && fixed6 > 0 ? "warn" : "fail",
|
|
292090
|
+
message: options2.fix ? `Cleaned ${fixed6} stale reservation(s)` : `${stale.length} stale reservation(s)`,
|
|
292091
|
+
details,
|
|
292092
|
+
fixable: true,
|
|
292093
|
+
fixed: fixed6
|
|
292094
|
+
};
|
|
292095
|
+
} catch (error56) {
|
|
292096
|
+
const msg = error56 instanceof Error ? error56.message : String(error56);
|
|
292097
|
+
if (msg.includes("no such table")) {
|
|
292098
|
+
return {
|
|
292099
|
+
name: "Reservations",
|
|
292100
|
+
status: "pass",
|
|
292101
|
+
message: "OK (no reservations table)"
|
|
292102
|
+
};
|
|
292103
|
+
}
|
|
292104
|
+
return {
|
|
292105
|
+
name: "Reservations",
|
|
292106
|
+
status: "fail",
|
|
292107
|
+
message: `Check failed: ${msg}`,
|
|
292108
|
+
fixable: false
|
|
292109
|
+
};
|
|
292110
|
+
}
|
|
292111
|
+
}
|
|
292112
|
+
async function checkZombieBlocked(db, options2 = {}) {
|
|
292113
|
+
try {
|
|
292114
|
+
const result = await db.query(`SELECT b.id, b.title
|
|
292115
|
+
FROM beads b
|
|
292116
|
+
WHERE b.status = 'blocked'
|
|
292117
|
+
AND NOT EXISTS (
|
|
292118
|
+
SELECT 1
|
|
292119
|
+
FROM bead_dependencies bd
|
|
292120
|
+
JOIN beads blocker ON bd.depends_on_id = blocker.id
|
|
292121
|
+
WHERE bd.cell_id = b.id
|
|
292122
|
+
AND bd.relationship = 'blocks'
|
|
292123
|
+
AND blocker.status != 'closed'
|
|
292124
|
+
)`);
|
|
292125
|
+
const zombies = result.rows;
|
|
292126
|
+
if (zombies.length === 0) {
|
|
292127
|
+
return {
|
|
292128
|
+
name: "Zombie blocked",
|
|
292129
|
+
status: "pass",
|
|
292130
|
+
message: "OK"
|
|
292131
|
+
};
|
|
292132
|
+
}
|
|
292133
|
+
let fixed6 = 0;
|
|
292134
|
+
if (options2.fix) {
|
|
292135
|
+
const ids4 = zombies.map((z) => `'${z.id}'`).join(",");
|
|
292136
|
+
await db.exec(`UPDATE beads SET status = 'open', updated_at = ${Date.now()} WHERE id IN (${ids4})`);
|
|
292137
|
+
fixed6 = zombies.length;
|
|
292138
|
+
}
|
|
292139
|
+
const details = zombies.map((z) => `${z.id} ("${z.title}")`);
|
|
292140
|
+
return {
|
|
292141
|
+
name: "Zombie blocked",
|
|
292142
|
+
status: options2.fix && fixed6 > 0 ? "warn" : "fail",
|
|
292143
|
+
message: options2.fix ? `Unblocked ${fixed6} zombie cell(s)` : `${zombies.length} cell(s) should be unblocked`,
|
|
292144
|
+
details,
|
|
292145
|
+
fixable: true,
|
|
292146
|
+
fixed: fixed6
|
|
292147
|
+
};
|
|
292148
|
+
} catch (error56) {
|
|
292149
|
+
return {
|
|
292150
|
+
name: "Zombie blocked",
|
|
292151
|
+
status: "fail",
|
|
292152
|
+
message: `Check failed: ${error56 instanceof Error ? error56.message : String(error56)}`,
|
|
292153
|
+
fixable: false
|
|
292154
|
+
};
|
|
292155
|
+
}
|
|
292156
|
+
}
|
|
292157
|
+
async function checkGhostWorkers(db, staleCutoffMs = 30 * 60 * 1000) {
|
|
292158
|
+
try {
|
|
292159
|
+
const cutoff = Date.now() - staleCutoffMs;
|
|
292160
|
+
const result = await db.query(`SELECT b.id, b.title, b.assignee, a.last_active_at
|
|
292161
|
+
FROM beads b
|
|
292162
|
+
LEFT JOIN agents a ON b.assignee = a.name AND b.project_key = a.project_key
|
|
292163
|
+
WHERE b.status = 'in_progress'
|
|
292164
|
+
AND (a.last_active_at IS NULL OR a.last_active_at < ?)`, [cutoff]);
|
|
292165
|
+
const ghosts = result.rows;
|
|
292166
|
+
if (ghosts.length === 0) {
|
|
292167
|
+
return {
|
|
292168
|
+
name: "Ghost workers",
|
|
292169
|
+
status: "pass",
|
|
292170
|
+
message: "OK"
|
|
292171
|
+
};
|
|
292172
|
+
}
|
|
292173
|
+
const details = ghosts.map((g) => {
|
|
292174
|
+
const agoMin = g.last_active_at ? Math.round((Date.now() - g.last_active_at) / 60000) : null;
|
|
292175
|
+
const agentInfo = g.assignee || "unassigned";
|
|
292176
|
+
const timeInfo = agoMin !== null ? `, last active ${agoMin}m ago` : ", never active";
|
|
292177
|
+
return `${g.id} ("${g.title}") [${agentInfo}${timeInfo}]`;
|
|
292178
|
+
});
|
|
292179
|
+
return {
|
|
292180
|
+
name: "Ghost workers",
|
|
292181
|
+
status: "warn",
|
|
292182
|
+
message: `${ghosts.length} in-progress cell(s) with inactive agents`,
|
|
292183
|
+
details,
|
|
292184
|
+
fixable: false
|
|
292185
|
+
};
|
|
292186
|
+
} catch (error56) {
|
|
292187
|
+
const msg = error56 instanceof Error ? error56.message : String(error56);
|
|
292188
|
+
if (msg.includes("no such table") || msg.includes("no such column")) {
|
|
292189
|
+
try {
|
|
292190
|
+
const result = await db.query(`SELECT COUNT(*) as count FROM beads WHERE status = 'in_progress'`);
|
|
292191
|
+
const count11 = result.rows[0]?.count ?? 0;
|
|
292192
|
+
if (count11 === 0) {
|
|
292193
|
+
return {
|
|
292194
|
+
name: "Ghost workers",
|
|
292195
|
+
status: "pass",
|
|
292196
|
+
message: "OK (no in-progress cells)"
|
|
292197
|
+
};
|
|
292198
|
+
}
|
|
292199
|
+
return {
|
|
292200
|
+
name: "Ghost workers",
|
|
292201
|
+
status: "warn",
|
|
292202
|
+
message: `${count11} in-progress cell(s) (agent tracking unavailable)`,
|
|
292203
|
+
fixable: false
|
|
292204
|
+
};
|
|
292205
|
+
} catch {
|
|
292206
|
+
return {
|
|
292207
|
+
name: "Ghost workers",
|
|
292208
|
+
status: "pass",
|
|
292209
|
+
message: "OK (no cells table)"
|
|
292210
|
+
};
|
|
292211
|
+
}
|
|
292212
|
+
}
|
|
292213
|
+
return {
|
|
292214
|
+
name: "Ghost workers",
|
|
292215
|
+
status: "fail",
|
|
292216
|
+
message: `Check failed: ${msg}`,
|
|
292217
|
+
fixable: false
|
|
292218
|
+
};
|
|
292219
|
+
}
|
|
292220
|
+
}
|
|
292221
|
+
async function runDoctor(db, options2 = {}) {
|
|
292222
|
+
const checks3 = [];
|
|
292223
|
+
checks3.push(await checkDbIntegrity(db));
|
|
292224
|
+
checks3.push(await checkOrphanedCells(db, options2));
|
|
292225
|
+
checks3.push(await checkDependencyCycles(db));
|
|
292226
|
+
checks3.push(await checkStaleReservations(db, options2));
|
|
292227
|
+
checks3.push(await checkZombieBlocked(db, options2));
|
|
292228
|
+
checks3.push(await checkGhostWorkers(db));
|
|
292229
|
+
const passed = checks3.filter((c) => c.status === "pass").length;
|
|
292230
|
+
const failed = checks3.filter((c) => c.status === "fail").length;
|
|
292231
|
+
const warned = checks3.filter((c) => c.status === "warn").length;
|
|
292232
|
+
const fixed6 = checks3.reduce((sum9, c) => sum9 + (c.fixed || 0), 0);
|
|
292233
|
+
return {
|
|
292234
|
+
checks: checks3,
|
|
292235
|
+
passed,
|
|
292236
|
+
failed,
|
|
292237
|
+
warned,
|
|
292238
|
+
fixed: fixed6,
|
|
292239
|
+
timestamp: new Date().toISOString()
|
|
292240
|
+
};
|
|
292241
|
+
}
|
|
292242
|
+
function formatDoctorReport(report, options2 = {}) {
|
|
292243
|
+
const lines = [];
|
|
292244
|
+
lines.push("");
|
|
292245
|
+
lines.push(bold2("\uD83C\uDFE5 Swarm Doctor"));
|
|
292246
|
+
lines.push("────────────────────");
|
|
292247
|
+
for (const check8 of report.checks) {
|
|
292248
|
+
const icon = check8.status === "pass" ? green4("✓") : check8.status === "warn" ? yellow4("⚠") : red3("✗");
|
|
292249
|
+
lines.push(`${icon} ${check8.name}: ${check8.message}`);
|
|
292250
|
+
if (check8.details && check8.details.length > 0) {
|
|
292251
|
+
const shown = check8.details.slice(0, 5);
|
|
292252
|
+
for (const detail of shown) {
|
|
292253
|
+
lines.push(dim5(` ${detail}`));
|
|
292254
|
+
}
|
|
292255
|
+
if (check8.details.length > 5) {
|
|
292256
|
+
lines.push(dim5(` ... and ${check8.details.length - 5} more`));
|
|
292257
|
+
}
|
|
292258
|
+
}
|
|
292259
|
+
}
|
|
292260
|
+
lines.push("");
|
|
292261
|
+
const total = report.checks.length;
|
|
292262
|
+
const summaryParts = [];
|
|
292263
|
+
summaryParts.push(`${report.passed}/${total} checks passed`);
|
|
292264
|
+
if (report.failed > 0)
|
|
292265
|
+
summaryParts.push(`${report.failed} issue(s) found`);
|
|
292266
|
+
if (report.warned > 0)
|
|
292267
|
+
summaryParts.push(`${report.warned} warning(s)`);
|
|
292268
|
+
if (report.fixed > 0)
|
|
292269
|
+
summaryParts.push(`${report.fixed} item(s) fixed`);
|
|
292270
|
+
lines.push(`Summary: ${summaryParts.join(", ")}`);
|
|
292271
|
+
if (!options2.fix && report.checks.some((c) => c.status === "fail" && c.fixable)) {
|
|
292272
|
+
lines.push(cyan4("Run with --fix to auto-repair fixable issues"));
|
|
292273
|
+
}
|
|
292274
|
+
lines.push("");
|
|
292275
|
+
return lines.join(`
|
|
292276
|
+
`);
|
|
292277
|
+
}
|
|
292278
|
+
function parseDoctorArgs(args5) {
|
|
292279
|
+
return {
|
|
292280
|
+
fix: args5.includes("--fix"),
|
|
292281
|
+
json: args5.includes("--json")
|
|
292282
|
+
};
|
|
292283
|
+
}
|
|
292284
|
+
async function doctorDeep(args5 = []) {
|
|
292285
|
+
const options2 = parseDoctorArgs(args5);
|
|
292286
|
+
const { getSwarmMailLibSQL: getSwarmMailLibSQL3, createHiveAdapter: createHiveAdapter3 } = await Promise.resolve().then(() => (init_dist(), exports_dist));
|
|
292287
|
+
const projectPath = process.cwd();
|
|
292288
|
+
try {
|
|
292289
|
+
const swarmMail = await getSwarmMailLibSQL3(projectPath);
|
|
292290
|
+
const db = await swarmMail.getDatabase();
|
|
292291
|
+
const hiveAdapter = createHiveAdapter3(db, projectPath);
|
|
292292
|
+
await hiveAdapter.runMigrations();
|
|
292293
|
+
const report = await runDoctor(db, options2);
|
|
292294
|
+
if (options2.json) {
|
|
292295
|
+
console.log(JSON.stringify(report, null, 2));
|
|
292296
|
+
} else {
|
|
292297
|
+
console.log(formatDoctorReport(report, options2));
|
|
292298
|
+
}
|
|
292299
|
+
if (report.failed > 0 && !options2.fix) {
|
|
292300
|
+
process.exit(1);
|
|
292301
|
+
}
|
|
292302
|
+
} catch (error56) {
|
|
292303
|
+
const msg = error56 instanceof Error ? error56.message : String(error56);
|
|
292304
|
+
console.error(red3(`Doctor failed: ${msg}`));
|
|
292305
|
+
process.exit(1);
|
|
292306
|
+
}
|
|
292307
|
+
}
|
|
292308
|
+
var green4 = (s) => `\x1B[32m${s}\x1B[0m`, red3 = (s) => `\x1B[31m${s}\x1B[0m`, yellow4 = (s) => `\x1B[33m${s}\x1B[0m`, dim5 = (s) => `\x1B[2m${s}\x1B[0m`, bold2 = (s) => `\x1B[1m${s}\x1B[0m`, cyan4 = (s) => `\x1B[36m${s}\x1B[0m`;
|
|
292309
|
+
|
|
291488
292310
|
// bin/swarm.ts
|
|
291489
292311
|
import * as p4 from "@clack/prompts";
|
|
291490
292312
|
import {
|
|
@@ -304962,7 +305784,8 @@ var CellUpdateArgsSchema = exports_external3.object({
|
|
|
304962
305784
|
});
|
|
304963
305785
|
var CellCloseArgsSchema = exports_external3.object({
|
|
304964
305786
|
id: exports_external3.string(),
|
|
304965
|
-
reason: exports_external3.string().min(1, "Reason required")
|
|
305787
|
+
reason: exports_external3.string().min(1, "Reason required"),
|
|
305788
|
+
result: exports_external3.string().optional()
|
|
304966
305789
|
});
|
|
304967
305790
|
var CellQueryArgsSchema = exports_external3.object({
|
|
304968
305791
|
status: CellStatusSchema.optional(),
|
|
@@ -305617,7 +306440,7 @@ async function importJsonlToPGLite(projectPath) {
|
|
|
305617
306440
|
const status3 = cellData.status === "tombstone" ? "closed" : cellData.status;
|
|
305618
306441
|
const isClosed = status3 === "closed";
|
|
305619
306442
|
const closedAt = isClosed ? cellData.closed_at ? new Date(cellData.closed_at).getTime() : new Date(cellData.updated_at).getTime() : null;
|
|
305620
|
-
await db.query(`INSERT INTO
|
|
306443
|
+
await db.query(`INSERT INTO beads (
|
|
305621
306444
|
id, project_key, type, status, title, description, priority,
|
|
305622
306445
|
parent_id, assignee, created_at, updated_at, closed_at
|
|
305623
306446
|
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)`, [
|
|
@@ -306031,7 +306854,8 @@ var hive_close = tool({
|
|
|
306031
306854
|
description: "Close a cell with reason",
|
|
306032
306855
|
args: {
|
|
306033
306856
|
id: tool.schema.string().describe("Cell ID or partial hash"),
|
|
306034
|
-
reason: tool.schema.string().describe("Completion reason")
|
|
306857
|
+
reason: tool.schema.string().describe("Completion reason"),
|
|
306858
|
+
result: tool.schema.string().optional().describe("Implementation summary - what was actually done (like a PR description)")
|
|
306035
306859
|
},
|
|
306036
306860
|
async execute(args2, ctx) {
|
|
306037
306861
|
const validated = CellCloseArgsSchema.parse(args2);
|
|
@@ -306041,7 +306865,7 @@ var hive_close = tool({
|
|
|
306041
306865
|
const cellId = await resolvePartialId(adapter5, projectKey, validated.id) || validated.id;
|
|
306042
306866
|
const cellBeforeClose = await adapter5.getCell(projectKey, cellId);
|
|
306043
306867
|
const isEpic = cellBeforeClose?.type === "epic";
|
|
306044
|
-
const cell = await adapter5.closeCell(projectKey, cellId, validated.reason);
|
|
306868
|
+
const cell = await adapter5.closeCell(projectKey, cellId, validated.reason, validated.result ? { result: validated.result } : undefined);
|
|
306045
306869
|
await adapter5.markDirty(projectKey, cellId);
|
|
306046
306870
|
if (isEpic && cellBeforeClose) {
|
|
306047
306871
|
try {
|
|
@@ -306571,6 +307395,7 @@ import { existsSync as existsSync23, readFileSync as readFileSync23 } from "node
|
|
|
306571
307395
|
import { join as join24 } from "node:path";
|
|
306572
307396
|
import { join as join43 } from "node:path";
|
|
306573
307397
|
import { existsSync as existsSync32 } from "node:fs";
|
|
307398
|
+
import { execSync } from "child_process";
|
|
306574
307399
|
var __create3 = Object.create;
|
|
306575
307400
|
var __getProtoOf3 = Object.getPrototypeOf;
|
|
306576
307401
|
var __defProp4 = Object.defineProperty;
|
|
@@ -324494,7 +325319,8 @@ Scripts run in the skill's directory with the project directory as an argument.`
|
|
|
324494
325319
|
args: {
|
|
324495
325320
|
skill: tool2.schema.string().describe("Name of the skill"),
|
|
324496
325321
|
script: tool2.schema.string().describe("Name of the script file to execute"),
|
|
324497
|
-
args: tool2.schema.array(tool2.schema.string()).optional().describe("Additional arguments to pass to the script")
|
|
325322
|
+
args: tool2.schema.array(tool2.schema.string()).optional().describe("Additional arguments to pass to the script"),
|
|
325323
|
+
timeout_ms: tool2.schema.number().optional().describe("Timeout in milliseconds (default: 60000)")
|
|
324498
325324
|
},
|
|
324499
325325
|
async execute(args2, ctx) {
|
|
324500
325326
|
console.warn("[DEPRECATED] skills_execute is deprecated. OpenCode now provides native skills support. This tool will be removed in a future version.");
|
|
@@ -324507,7 +325333,7 @@ Scripts run in the skill's directory with the project directory as an argument.`
|
|
|
324507
325333
|
}
|
|
324508
325334
|
const scriptPath = join33(skill.directory, "scripts", args2.script);
|
|
324509
325335
|
const scriptArgs = args2.args || [];
|
|
324510
|
-
const TIMEOUT_MS = 60000;
|
|
325336
|
+
const TIMEOUT_MS = args2.timeout_ms ?? 60000;
|
|
324511
325337
|
const proc = Bun.spawn([scriptPath, skillsProjectDirectory, ...scriptArgs], {
|
|
324512
325338
|
cwd: skill.directory,
|
|
324513
325339
|
stdout: "pipe",
|
|
@@ -325637,6 +326463,7 @@ __export4(exports_storage, {
|
|
|
325637
326463
|
resetStorage: () => resetStorage,
|
|
325638
326464
|
resetSessionStats: () => resetSessionStats,
|
|
325639
326465
|
resetCommandCache: () => resetCommandCache,
|
|
326466
|
+
resetAvailabilityCache: () => resetAvailabilityCache,
|
|
325640
326467
|
isSemanticMemoryAvailable: () => isSemanticMemoryAvailable,
|
|
325641
326468
|
getTestCollectionName: () => getTestCollectionName,
|
|
325642
326469
|
getStorage: () => getStorage,
|
|
@@ -325987,12 +326814,25 @@ function createStorage(config22 = {}) {
|
|
|
325987
326814
|
}
|
|
325988
326815
|
}
|
|
325989
326816
|
async function isSemanticMemoryAvailable() {
|
|
325990
|
-
|
|
325991
|
-
|
|
325992
|
-
|
|
325993
|
-
|
|
325994
|
-
|
|
325995
|
-
|
|
326817
|
+
if (_availabilityCache !== null)
|
|
326818
|
+
return _availabilityCache;
|
|
326819
|
+
if (_availabilityPromise)
|
|
326820
|
+
return _availabilityPromise;
|
|
326821
|
+
_availabilityPromise = (async () => {
|
|
326822
|
+
try {
|
|
326823
|
+
const result = await execSemanticMemory(["stats"]);
|
|
326824
|
+
_availabilityCache = result.exitCode === 0;
|
|
326825
|
+
} catch {
|
|
326826
|
+
_availabilityCache = false;
|
|
326827
|
+
}
|
|
326828
|
+
_availabilityPromise = null;
|
|
326829
|
+
return _availabilityCache;
|
|
326830
|
+
})();
|
|
326831
|
+
return _availabilityPromise;
|
|
326832
|
+
}
|
|
326833
|
+
function resetAvailabilityCache() {
|
|
326834
|
+
_availabilityCache = null;
|
|
326835
|
+
_availabilityPromise = null;
|
|
325996
326836
|
}
|
|
325997
326837
|
async function getResolvedCommand() {
|
|
325998
326838
|
return resolveSemanticMemoryCommand();
|
|
@@ -326031,6 +326871,8 @@ async function resetStorage() {
|
|
|
326031
326871
|
var cachedCommand = null;
|
|
326032
326872
|
var DEFAULT_STORAGE_CONFIG;
|
|
326033
326873
|
var sessionStats;
|
|
326874
|
+
var _availabilityCache = null;
|
|
326875
|
+
var _availabilityPromise = null;
|
|
326034
326876
|
var globalStorage = null;
|
|
326035
326877
|
var globalStoragePromise = null;
|
|
326036
326878
|
var init_storage = __esm4(() => {
|
|
@@ -347747,7 +348589,8 @@ var CellUpdateArgsSchema2 = exports_external5.object({
|
|
|
347747
348589
|
});
|
|
347748
348590
|
var CellCloseArgsSchema2 = exports_external5.object({
|
|
347749
348591
|
id: exports_external5.string(),
|
|
347750
|
-
reason: exports_external5.string().min(1, "Reason required")
|
|
348592
|
+
reason: exports_external5.string().min(1, "Reason required"),
|
|
348593
|
+
result: exports_external5.string().optional()
|
|
347751
348594
|
});
|
|
347752
348595
|
var CellQueryArgsSchema2 = exports_external5.object({
|
|
347753
348596
|
status: CellStatusSchema2.optional(),
|
|
@@ -348966,7 +349809,8 @@ var hive_close2 = tool2({
|
|
|
348966
349809
|
description: "Close a cell with reason",
|
|
348967
349810
|
args: {
|
|
348968
349811
|
id: tool2.schema.string().describe("Cell ID or partial hash"),
|
|
348969
|
-
reason: tool2.schema.string().describe("Completion reason")
|
|
349812
|
+
reason: tool2.schema.string().describe("Completion reason"),
|
|
349813
|
+
result: tool2.schema.string().optional().describe("Implementation summary - what was actually done (like a PR description)")
|
|
348970
349814
|
},
|
|
348971
349815
|
async execute(args3, ctx) {
|
|
348972
349816
|
const validated = CellCloseArgsSchema2.parse(args3);
|
|
@@ -348976,7 +349820,7 @@ var hive_close2 = tool2({
|
|
|
348976
349820
|
const cellId = await resolvePartialId(adapter5, projectKey, validated.id) || validated.id;
|
|
348977
349821
|
const cellBeforeClose = await adapter5.getCell(projectKey, cellId);
|
|
348978
349822
|
const isEpic = cellBeforeClose?.type === "epic";
|
|
348979
|
-
const cell = await adapter5.closeCell(projectKey, cellId, validated.reason);
|
|
349823
|
+
const cell = await adapter5.closeCell(projectKey, cellId, validated.reason, validated.result ? { result: validated.result } : undefined);
|
|
348980
349824
|
await adapter5.markDirty(projectKey, cellId);
|
|
348981
349825
|
if (isEpic && cellBeforeClose) {
|
|
348982
349826
|
try {
|
|
@@ -350185,6 +351029,17 @@ function getReviewStatus(taskId) {
|
|
|
350185
351029
|
remaining_attempts: getRemainingAttempts(taskId)
|
|
350186
351030
|
};
|
|
350187
351031
|
}
|
|
351032
|
+
function getGitCommitInfo(cwd) {
|
|
351033
|
+
try {
|
|
351034
|
+
const opts = { cwd, encoding: "utf-8", timeout: 5000 };
|
|
351035
|
+
const sha = execSync("git rev-parse HEAD", opts).trim();
|
|
351036
|
+
const message = execSync("git log -1 --format=%s", opts).trim();
|
|
351037
|
+
const branch = execSync("git rev-parse --abbrev-ref HEAD", opts).trim();
|
|
351038
|
+
return { sha, message, branch };
|
|
351039
|
+
} catch {
|
|
351040
|
+
return null;
|
|
351041
|
+
}
|
|
351042
|
+
}
|
|
350188
351043
|
init_eval_capture2();
|
|
350189
351044
|
init_dist7();
|
|
350190
351045
|
async function runTypecheckVerification() {
|
|
@@ -350848,7 +351703,10 @@ var swarm_complete = tool2({
|
|
|
350848
351703
|
start_time: tool2.schema.number().describe("Task start timestamp (Unix ms) for duration calculation - REQUIRED for accurate analytics"),
|
|
350849
351704
|
error_count: tool2.schema.number().optional().describe("Number of errors encountered during task"),
|
|
350850
351705
|
retry_count: tool2.schema.number().optional().describe("Number of retry attempts during task"),
|
|
350851
|
-
skip_review: tool2.schema.boolean().optional().describe("Skip review gate check (default: false). Use only for tasks that don't require coordinator review.")
|
|
351706
|
+
skip_review: tool2.schema.boolean().optional().describe("Skip review gate check (default: false). Use only for tasks that don't require coordinator review."),
|
|
351707
|
+
commit_sha: tool2.schema.string().optional().describe("Git commit SHA (auto-detected if not provided)"),
|
|
351708
|
+
commit_message: tool2.schema.string().optional().describe("Commit message (auto-detected if not provided)"),
|
|
351709
|
+
commit_branch: tool2.schema.string().optional().describe("Git branch (auto-detected if not provided)")
|
|
350852
351710
|
},
|
|
350853
351711
|
async execute(args3, _ctx) {
|
|
350854
351712
|
const missing = [];
|
|
@@ -350909,6 +351767,13 @@ var swarm_complete = tool2({
|
|
|
350909
351767
|
}, null, 2);
|
|
350910
351768
|
}
|
|
350911
351769
|
}
|
|
351770
|
+
const gitInfo = getGitCommitInfo(args3.project_key) || {};
|
|
351771
|
+
const commitSha = args3.commit_sha || gitInfo.sha;
|
|
351772
|
+
const commitMessage = args3.commit_message || gitInfo.message;
|
|
351773
|
+
const commitBranch = args3.commit_branch || gitInfo.branch;
|
|
351774
|
+
const resultText = commitSha ? `${args3.summary}
|
|
351775
|
+
|
|
351776
|
+
Commit: ${commitSha.slice(0, 8)} (${commitBranch || "unknown"}) - ${commitMessage || "no message"}` : args3.summary;
|
|
350912
351777
|
try {
|
|
350913
351778
|
const adapter5 = await getHiveAdapter2(args3.project_key);
|
|
350914
351779
|
const cell = await adapter5.getCell(args3.project_key, args3.bead_id);
|
|
@@ -351023,7 +351888,9 @@ This will be recorded as a negative learning signal.`;
|
|
|
351023
351888
|
}
|
|
351024
351889
|
}
|
|
351025
351890
|
try {
|
|
351026
|
-
await adapter5.closeCell(args3.project_key, args3.bead_id, args3.summary
|
|
351891
|
+
await adapter5.closeCell(args3.project_key, args3.bead_id, args3.summary, {
|
|
351892
|
+
result: resultText
|
|
351893
|
+
});
|
|
351027
351894
|
} catch (closeError) {
|
|
351028
351895
|
const errorMessage = closeError instanceof Error ? closeError.message : String(closeError);
|
|
351029
351896
|
return JSON.stringify({
|
|
@@ -351091,7 +351958,8 @@ This will be recorded as a negative learning signal.`;
|
|
|
351091
351958
|
retry_count: args3.retry_count || 0,
|
|
351092
351959
|
success: true,
|
|
351093
351960
|
scope_violation: contractValidation ? !contractValidation.valid : undefined,
|
|
351094
|
-
violation_files: contractValidation?.violations
|
|
351961
|
+
violation_files: contractValidation?.violations,
|
|
351962
|
+
commit: commitSha ? { sha: commitSha, message: commitMessage, branch: commitBranch } : undefined
|
|
351095
351963
|
});
|
|
351096
351964
|
const savedEvent = await appendEvent(event, args3.project_key);
|
|
351097
351965
|
outcomeEventId = savedEvent.id;
|
|
@@ -351276,6 +352144,8 @@ This will be recorded as a negative learning signal.`;
|
|
|
351276
352144
|
success: true,
|
|
351277
352145
|
bead_id: args3.bead_id,
|
|
351278
352146
|
closed: true,
|
|
352147
|
+
result: resultText,
|
|
352148
|
+
commit: commitSha ? { sha: commitSha, message: commitMessage, branch: commitBranch } : undefined,
|
|
351279
352149
|
reservations_released: reservationsReleased,
|
|
351280
352150
|
reservations_released_count: reservationsReleasedCount,
|
|
351281
352151
|
reservations_release_error: reservationsReleaseError,
|
|
@@ -353922,7 +354792,7 @@ var promptTools = {
|
|
|
353922
354792
|
|
|
353923
354793
|
// bin/swarm.ts
|
|
353924
354794
|
init_dist9();
|
|
353925
|
-
import { execSync, spawn } from "child_process";
|
|
354795
|
+
import { execSync as execSync3, spawn } from "child_process";
|
|
353926
354796
|
import { tmpdir as tmpdir3 } from "os";
|
|
353927
354797
|
|
|
353928
354798
|
// src/query-tools.ts
|
|
@@ -354339,8 +355209,8 @@ async function getRecentMessages(projectPath, options2) {
|
|
|
354339
355209
|
const swarmMail = await getSwarmMailLibSQL(projectPath);
|
|
354340
355210
|
const db = await swarmMail.getDatabase();
|
|
354341
355211
|
const limit = options2?.limit ?? 10;
|
|
354342
|
-
const whereClauses = ["type = 'message_sent'"];
|
|
354343
|
-
const params = [];
|
|
355212
|
+
const whereClauses = ["type = 'message_sent'", "project_key = ?"];
|
|
355213
|
+
const params = [projectPath];
|
|
354344
355214
|
if (options2?.thread_id) {
|
|
354345
355215
|
whereClauses.push("json_extract(data, '$.thread_id') = ?");
|
|
354346
355216
|
params.push(options2.thread_id);
|
|
@@ -354432,7 +355302,7 @@ function filterEvents(events, filter31) {
|
|
|
354432
355302
|
return true;
|
|
354433
355303
|
});
|
|
354434
355304
|
}
|
|
354435
|
-
async function* replayWithTiming(events, speed) {
|
|
355305
|
+
async function* replayWithTiming(events, speed, options2) {
|
|
354436
355306
|
if (events.length === 0) {
|
|
354437
355307
|
return;
|
|
354438
355308
|
}
|
|
@@ -354450,7 +355320,9 @@ async function* replayWithTiming(events, speed) {
|
|
|
354450
355320
|
const delay6 = targetDelay - elapsed4;
|
|
354451
355321
|
if (delay6 > 3) {
|
|
354452
355322
|
const adjustedDelay = delay6 - 3;
|
|
354453
|
-
if (
|
|
355323
|
+
if (options2?.sleep) {
|
|
355324
|
+
await options2.sleep(adjustedDelay);
|
|
355325
|
+
} else if (typeof Bun !== "undefined" && typeof Bun.sleep === "function") {
|
|
354454
355326
|
await Bun.sleep(adjustedDelay);
|
|
354455
355327
|
} else {
|
|
354456
355328
|
await new Promise((resolve8) => setTimeout(resolve8, adjustedDelay));
|
|
@@ -354633,18 +355505,32 @@ init_dist();
|
|
|
354633
355505
|
import * as p from "@clack/prompts";
|
|
354634
355506
|
|
|
354635
355507
|
// src/utils/tree-renderer.ts
|
|
354636
|
-
|
|
355508
|
+
var RESET = "\x1B[0m";
|
|
355509
|
+
var RED = "\x1B[31m";
|
|
355510
|
+
var YELLOW = "\x1B[33m";
|
|
355511
|
+
var GREEN = "\x1B[32m";
|
|
355512
|
+
var DIM = "\x1B[2m";
|
|
355513
|
+
var BOLD = "\x1B[1m";
|
|
355514
|
+
var ansi = {
|
|
355515
|
+
red: (s) => `${RED}${s}${RESET}`,
|
|
355516
|
+
yellow: (s) => `${YELLOW}${s}${RESET}`,
|
|
355517
|
+
green: (s) => `${GREEN}${s}${RESET}`,
|
|
355518
|
+
dim: (s) => `${DIM}${s}${RESET}`,
|
|
355519
|
+
bold: (s) => `${BOLD}${s}${RESET}`,
|
|
355520
|
+
strip: (s) => s.replace(/\x1b\[[0-9;]*m/g, "")
|
|
355521
|
+
};
|
|
355522
|
+
function getStatusMarker(status4) {
|
|
354637
355523
|
switch (status4) {
|
|
354638
355524
|
case "open":
|
|
354639
|
-
return "
|
|
355525
|
+
return "[ ]";
|
|
354640
355526
|
case "in_progress":
|
|
354641
|
-
return "
|
|
355527
|
+
return "[~]";
|
|
354642
355528
|
case "closed":
|
|
354643
|
-
return "
|
|
355529
|
+
return "[x]";
|
|
354644
355530
|
case "blocked":
|
|
354645
|
-
return "
|
|
355531
|
+
return "[!]";
|
|
354646
355532
|
default:
|
|
354647
|
-
return "
|
|
355533
|
+
return "[ ]";
|
|
354648
355534
|
}
|
|
354649
355535
|
}
|
|
354650
355536
|
function getPriorityLabel(priority) {
|
|
@@ -354653,17 +355539,77 @@ function getPriorityLabel(priority) {
|
|
|
354653
355539
|
}
|
|
354654
355540
|
return `P${priority}`;
|
|
354655
355541
|
}
|
|
354656
|
-
function
|
|
354657
|
-
|
|
354658
|
-
|
|
354659
|
-
|
|
354660
|
-
|
|
354661
|
-
|
|
355542
|
+
function colorByPriority(text4, priority) {
|
|
355543
|
+
if (priority <= 1) {
|
|
355544
|
+
return ansi.red(text4);
|
|
355545
|
+
}
|
|
355546
|
+
if (priority === 2) {
|
|
355547
|
+
return ansi.yellow(text4);
|
|
355548
|
+
}
|
|
355549
|
+
return text4;
|
|
355550
|
+
}
|
|
355551
|
+
function getEpicCompletion(node) {
|
|
355552
|
+
const total = node.children.length;
|
|
355553
|
+
const done18 = node.children.filter((c) => c.cell.status === "closed").length;
|
|
355554
|
+
return { done: done18, total };
|
|
355555
|
+
}
|
|
355556
|
+
function formatEpicCompletion(node) {
|
|
355557
|
+
if (node.cell.type !== "epic" || node.children.length === 0) {
|
|
355558
|
+
return "";
|
|
355559
|
+
}
|
|
355560
|
+
const { done: done18, total } = getEpicCompletion(node);
|
|
355561
|
+
return ` (${done18}/${total} done)`;
|
|
355562
|
+
}
|
|
355563
|
+
function shortId(id4) {
|
|
355564
|
+
return id4.slice(-5);
|
|
355565
|
+
}
|
|
355566
|
+
function formatBlockers(blockerIds) {
|
|
355567
|
+
if (blockerIds.length === 0)
|
|
355568
|
+
return "";
|
|
355569
|
+
return ` [B: ${blockerIds.map(shortId).join(", ")}]`;
|
|
355570
|
+
}
|
|
355571
|
+
function formatCellLine(node, options2 = {}) {
|
|
355572
|
+
const cell = node.cell;
|
|
355573
|
+
const marker18 = getStatusMarker(cell.status);
|
|
355574
|
+
const id4 = shortId(cell.id);
|
|
354662
355575
|
const priorityLabel = getPriorityLabel(cell.priority);
|
|
355576
|
+
const epicSuffix = formatEpicCompletion(node);
|
|
355577
|
+
const blockerIds = options2.blockers?.get(cell.id) ?? [];
|
|
355578
|
+
const blockerSuffix = formatBlockers(blockerIds);
|
|
355579
|
+
let line = `${marker18} ${id4}: ${cell.title}`;
|
|
355580
|
+
if (epicSuffix) {
|
|
355581
|
+
line += epicSuffix;
|
|
355582
|
+
}
|
|
354663
355583
|
if (priorityLabel) {
|
|
354664
|
-
|
|
355584
|
+
const coloredPriority = colorByPriority(`(${priorityLabel})`, cell.priority);
|
|
355585
|
+
line += ` ${coloredPriority}`;
|
|
355586
|
+
}
|
|
355587
|
+
if (blockerSuffix) {
|
|
355588
|
+
line += ansi.red(blockerSuffix);
|
|
355589
|
+
}
|
|
355590
|
+
return line;
|
|
355591
|
+
}
|
|
355592
|
+
function truncateLine(line, maxWidth) {
|
|
355593
|
+
const stripped = ansi.strip(line);
|
|
355594
|
+
if (stripped.length <= maxWidth) {
|
|
355595
|
+
return line;
|
|
355596
|
+
}
|
|
355597
|
+
const ellipsis = "…";
|
|
355598
|
+
const targetVisibleLen = maxWidth - 1;
|
|
355599
|
+
let visibleCount = 0;
|
|
355600
|
+
let i = 0;
|
|
355601
|
+
while (i < line.length && visibleCount < targetVisibleLen) {
|
|
355602
|
+
if (line[i] === "\x1B" && line[i + 1] === "[") {
|
|
355603
|
+
const end8 = line.indexOf("m", i);
|
|
355604
|
+
if (end8 !== -1) {
|
|
355605
|
+
i = end8 + 1;
|
|
355606
|
+
continue;
|
|
355607
|
+
}
|
|
355608
|
+
}
|
|
355609
|
+
visibleCount++;
|
|
355610
|
+
i++;
|
|
354665
355611
|
}
|
|
354666
|
-
return
|
|
355612
|
+
return line.slice(0, i) + ellipsis + RESET;
|
|
354667
355613
|
}
|
|
354668
355614
|
function buildTreeStructure(cells3) {
|
|
354669
355615
|
const nodeMap = new Map;
|
|
@@ -354680,37 +355626,40 @@ function buildTreeStructure(cells3) {
|
|
|
354680
355626
|
roots4.push(node);
|
|
354681
355627
|
}
|
|
354682
355628
|
}
|
|
355629
|
+
function sortChildren(nodes3) {
|
|
355630
|
+
nodes3.sort((a, b) => a.cell.priority - b.cell.priority);
|
|
355631
|
+
for (const node of nodes3) {
|
|
355632
|
+
if (node.children.length > 0) {
|
|
355633
|
+
sortChildren(node.children);
|
|
355634
|
+
}
|
|
355635
|
+
}
|
|
355636
|
+
}
|
|
355637
|
+
for (const root of roots4) {
|
|
355638
|
+
sortChildren(root.children);
|
|
355639
|
+
}
|
|
354683
355640
|
return roots4;
|
|
354684
355641
|
}
|
|
354685
|
-
function renderTreeNode(node, prefix, isLast) {
|
|
355642
|
+
function renderTreeNode(node, prefix, isLast, options2 = {}) {
|
|
354686
355643
|
const lines = [];
|
|
354687
|
-
const
|
|
354688
|
-
|
|
354689
|
-
|
|
354690
|
-
status: node.cell.status,
|
|
354691
|
-
priority: node.cell.priority,
|
|
354692
|
-
blocked: node.cell.status === "blocked"
|
|
354693
|
-
});
|
|
354694
|
-
lines.push(line);
|
|
355644
|
+
const termWidth = options2.terminalWidth ?? (process.stdout.columns || 80);
|
|
355645
|
+
const line = formatCellLine(node, options2);
|
|
355646
|
+
lines.push(truncateLine(line, termWidth));
|
|
354695
355647
|
for (let i = 0;i < node.children.length; i++) {
|
|
354696
355648
|
const child = node.children[i];
|
|
354697
355649
|
const isLastChild = i === node.children.length - 1;
|
|
354698
|
-
const connector = isLastChild ? "└──" : "├──";
|
|
355650
|
+
const connector = isLastChild ? "└── " : "├── ";
|
|
354699
355651
|
const childPrefix = isLastChild ? " " : "│ ";
|
|
354700
|
-
const childLines = renderTreeNode(child, prefix + childPrefix, isLastChild);
|
|
354701
|
-
childLines[0] = prefix + connector +
|
|
354702
|
-
for (let j = 1;j < childLines.length; j++) {
|
|
354703
|
-
childLines[j] = prefix + childPrefix + childLines[j];
|
|
354704
|
-
}
|
|
355652
|
+
const childLines = renderTreeNode(child, prefix + childPrefix, isLastChild, options2);
|
|
355653
|
+
childLines[0] = truncateLine(prefix + connector + childLines[0], termWidth);
|
|
354705
355654
|
lines.push(...childLines);
|
|
354706
355655
|
}
|
|
354707
355656
|
return lines;
|
|
354708
355657
|
}
|
|
354709
|
-
function renderTree(roots4) {
|
|
355658
|
+
function renderTree(roots4, options2 = {}) {
|
|
354710
355659
|
const allLines = [];
|
|
354711
355660
|
for (let i = 0;i < roots4.length; i++) {
|
|
354712
355661
|
const root = roots4[i];
|
|
354713
|
-
const lines = renderTreeNode(root, "", true);
|
|
355662
|
+
const lines = renderTreeNode(root, "", true, options2);
|
|
354714
355663
|
allLines.push(...lines);
|
|
354715
355664
|
if (i < roots4.length - 1) {
|
|
354716
355665
|
allLines.push("");
|
|
@@ -354736,6 +355685,19 @@ function parseTreeArgs(args4) {
|
|
|
354736
355685
|
}
|
|
354737
355686
|
return options2;
|
|
354738
355687
|
}
|
|
355688
|
+
async function buildBlockerMap(adapter6, projectPath, cells3) {
|
|
355689
|
+
const blockerMap = new Map;
|
|
355690
|
+
const blockedCells = cells3.filter((c) => c.status === "blocked");
|
|
355691
|
+
for (const cell of blockedCells) {
|
|
355692
|
+
try {
|
|
355693
|
+
const blockers = await adapter6.getBlockers(projectPath, cell.id);
|
|
355694
|
+
if (blockers.length > 0) {
|
|
355695
|
+
blockerMap.set(cell.id, blockers);
|
|
355696
|
+
}
|
|
355697
|
+
} catch {}
|
|
355698
|
+
}
|
|
355699
|
+
return blockerMap;
|
|
355700
|
+
}
|
|
354739
355701
|
async function tree(args4 = []) {
|
|
354740
355702
|
const options2 = parseTreeArgs(args4);
|
|
354741
355703
|
const projectPath = process.cwd();
|
|
@@ -354777,12 +355739,17 @@ async function tree(args4 = []) {
|
|
|
354777
355739
|
p.log.message(dim("No cells found"));
|
|
354778
355740
|
return;
|
|
354779
355741
|
}
|
|
355742
|
+
const blockers = await buildBlockerMap(adapter6, projectPath, cells3);
|
|
354780
355743
|
if (options2.json) {
|
|
354781
355744
|
const tree2 = buildTreeStructure(cells3);
|
|
354782
355745
|
console.log(JSON.stringify(tree2, null, 2));
|
|
354783
355746
|
} else {
|
|
354784
355747
|
const tree2 = buildTreeStructure(cells3);
|
|
354785
|
-
const
|
|
355748
|
+
const renderOptions = {
|
|
355749
|
+
blockers,
|
|
355750
|
+
terminalWidth: process.stdout.columns || 80
|
|
355751
|
+
};
|
|
355752
|
+
const output = renderTree(tree2, renderOptions);
|
|
354786
355753
|
console.log(output);
|
|
354787
355754
|
}
|
|
354788
355755
|
} catch (error49) {
|
|
@@ -355269,6 +356236,490 @@ ${yellow2("EXAMPLES:")}
|
|
|
355269
356236
|
`);
|
|
355270
356237
|
}
|
|
355271
356238
|
|
|
356239
|
+
// bin/commands/status.ts
|
|
356240
|
+
init_dist();
|
|
356241
|
+
|
|
356242
|
+
// src/dashboard.ts
|
|
356243
|
+
init_dist();
|
|
356244
|
+
async function getWorkerStatus2(projectPath, options2) {
|
|
356245
|
+
const swarmMail = await getSwarmMailLibSQL(projectPath);
|
|
356246
|
+
const db = await swarmMail.getDatabase();
|
|
356247
|
+
const query = `
|
|
356248
|
+
WITH latest_per_bead AS (
|
|
356249
|
+
SELECT
|
|
356250
|
+
json_extract(data, '$.agent_name') as agent_name,
|
|
356251
|
+
json_extract(data, '$.bead_id') as bead_id,
|
|
356252
|
+
type,
|
|
356253
|
+
timestamp,
|
|
356254
|
+
ROW_NUMBER() OVER (
|
|
356255
|
+
PARTITION BY json_extract(data, '$.agent_name'), json_extract(data, '$.bead_id')
|
|
356256
|
+
ORDER BY timestamp DESC
|
|
356257
|
+
) as rn
|
|
356258
|
+
FROM events
|
|
356259
|
+
WHERE type IN ('task_started', 'progress_reported', 'task_blocked', 'task_completed')
|
|
356260
|
+
AND json_extract(data, '$.agent_name') IS NOT NULL
|
|
356261
|
+
${options2?.project_key ? "AND project_key = ?" : ""}
|
|
356262
|
+
),
|
|
356263
|
+
agent_latest_task AS (
|
|
356264
|
+
SELECT
|
|
356265
|
+
agent_name,
|
|
356266
|
+
type,
|
|
356267
|
+
bead_id,
|
|
356268
|
+
timestamp,
|
|
356269
|
+
ROW_NUMBER() OVER (PARTITION BY agent_name ORDER BY
|
|
356270
|
+
CASE
|
|
356271
|
+
WHEN type IN ('task_started', 'progress_reported') THEN timestamp
|
|
356272
|
+
ELSE 0
|
|
356273
|
+
END DESC,
|
|
356274
|
+
timestamp DESC
|
|
356275
|
+
) as priority_rn
|
|
356276
|
+
FROM latest_per_bead
|
|
356277
|
+
WHERE rn = 1
|
|
356278
|
+
)
|
|
356279
|
+
SELECT
|
|
356280
|
+
agent_name,
|
|
356281
|
+
type,
|
|
356282
|
+
bead_id,
|
|
356283
|
+
MAX(timestamp) as last_activity
|
|
356284
|
+
FROM agent_latest_task
|
|
356285
|
+
WHERE priority_rn = 1
|
|
356286
|
+
GROUP BY agent_name, type, bead_id
|
|
356287
|
+
`;
|
|
356288
|
+
const params = options2?.project_key ? [options2.project_key] : [];
|
|
356289
|
+
const result = await db.query(query, params);
|
|
356290
|
+
return result.rows.map((row) => {
|
|
356291
|
+
let status4 = "idle";
|
|
356292
|
+
if (row.type === "task_blocked") {
|
|
356293
|
+
status4 = "blocked";
|
|
356294
|
+
} else if (row.type === "task_started" || row.type === "progress_reported") {
|
|
356295
|
+
status4 = "working";
|
|
356296
|
+
}
|
|
356297
|
+
return {
|
|
356298
|
+
agent_name: row.agent_name,
|
|
356299
|
+
status: status4,
|
|
356300
|
+
current_task: row.bead_id ?? undefined,
|
|
356301
|
+
last_activity: new Date(row.last_activity).toISOString()
|
|
356302
|
+
};
|
|
356303
|
+
});
|
|
356304
|
+
}
|
|
356305
|
+
async function getFileLocks2(projectPath, options2) {
|
|
356306
|
+
const swarmMail = await getSwarmMailLibSQL(projectPath);
|
|
356307
|
+
const db = await swarmMail.getDatabase();
|
|
356308
|
+
const query = `
|
|
356309
|
+
WITH acquired AS (
|
|
356310
|
+
SELECT
|
|
356311
|
+
json_extract(data, '$.path_pattern') as path,
|
|
356312
|
+
json_extract(data, '$.agent_name') as agent_name,
|
|
356313
|
+
json_extract(data, '$.reason') as reason,
|
|
356314
|
+
timestamp,
|
|
356315
|
+
json_extract(data, '$.ttl_seconds') as ttl_seconds
|
|
356316
|
+
FROM events
|
|
356317
|
+
WHERE type = 'reservation_acquired'
|
|
356318
|
+
${options2?.project_key ? "AND project_key = ?" : ""}
|
|
356319
|
+
),
|
|
356320
|
+
released AS (
|
|
356321
|
+
SELECT DISTINCT
|
|
356322
|
+
json_extract(data, '$.path_pattern') as path,
|
|
356323
|
+
json_extract(data, '$.agent_name') as agent_name
|
|
356324
|
+
FROM events
|
|
356325
|
+
WHERE type = 'reservation_released'
|
|
356326
|
+
${options2?.project_key ? "AND project_key = ?" : ""}
|
|
356327
|
+
)
|
|
356328
|
+
SELECT
|
|
356329
|
+
a.path,
|
|
356330
|
+
a.agent_name,
|
|
356331
|
+
a.reason,
|
|
356332
|
+
a.timestamp,
|
|
356333
|
+
a.ttl_seconds
|
|
356334
|
+
FROM acquired a
|
|
356335
|
+
LEFT JOIN released r ON a.path = r.path AND a.agent_name = r.agent_name
|
|
356336
|
+
WHERE r.path IS NULL
|
|
356337
|
+
`;
|
|
356338
|
+
const params = options2?.project_key ? [options2.project_key, options2.project_key] : [];
|
|
356339
|
+
const result = await db.query(query, params);
|
|
356340
|
+
return result.rows.map((row) => ({
|
|
356341
|
+
path: row.path,
|
|
356342
|
+
agent_name: row.agent_name,
|
|
356343
|
+
reason: row.reason,
|
|
356344
|
+
acquired_at: new Date(row.timestamp).toISOString(),
|
|
356345
|
+
ttl_seconds: row.ttl_seconds
|
|
356346
|
+
}));
|
|
356347
|
+
}
|
|
356348
|
+
async function getRecentMessages2(projectPath, options2) {
|
|
356349
|
+
const swarmMail = await getSwarmMailLibSQL(projectPath);
|
|
356350
|
+
const db = await swarmMail.getDatabase();
|
|
356351
|
+
const limit = options2?.limit ?? 10;
|
|
356352
|
+
const whereClauses = ["type = 'message_sent'", "project_key = ?"];
|
|
356353
|
+
const params = [projectPath];
|
|
356354
|
+
if (options2?.thread_id) {
|
|
356355
|
+
whereClauses.push("json_extract(data, '$.thread_id') = ?");
|
|
356356
|
+
params.push(options2.thread_id);
|
|
356357
|
+
}
|
|
356358
|
+
if (options2?.importance) {
|
|
356359
|
+
whereClauses.push("json_extract(data, '$.importance') = ?");
|
|
356360
|
+
params.push(options2.importance);
|
|
356361
|
+
}
|
|
356362
|
+
params.push(limit);
|
|
356363
|
+
const query = `
|
|
356364
|
+
SELECT
|
|
356365
|
+
id,
|
|
356366
|
+
json_extract(data, '$.from') as \`from\`,
|
|
356367
|
+
json_extract(data, '$.to') as to_json,
|
|
356368
|
+
json_extract(data, '$.subject') as subject,
|
|
356369
|
+
timestamp,
|
|
356370
|
+
json_extract(data, '$.importance') as importance
|
|
356371
|
+
FROM events
|
|
356372
|
+
WHERE ${whereClauses.join(" AND ")}
|
|
356373
|
+
ORDER BY timestamp DESC
|
|
356374
|
+
LIMIT ?
|
|
356375
|
+
`;
|
|
356376
|
+
const result = await db.query(query, params);
|
|
356377
|
+
return result.rows.map((row) => ({
|
|
356378
|
+
id: row.id,
|
|
356379
|
+
from: row.from,
|
|
356380
|
+
to: JSON.parse(row.to_json),
|
|
356381
|
+
subject: row.subject,
|
|
356382
|
+
timestamp: new Date(row.timestamp).toISOString(),
|
|
356383
|
+
importance: row.importance
|
|
356384
|
+
}));
|
|
356385
|
+
}
|
|
356386
|
+
async function getEpicList(projectPath, options2) {
|
|
356387
|
+
const swarmMail = await getSwarmMailLibSQL(projectPath);
|
|
356388
|
+
const db = await swarmMail.getDatabase();
|
|
356389
|
+
const tablesResult = await db.query("SELECT name FROM sqlite_master WHERE type = ? AND name = ?", ["table", "beads"]);
|
|
356390
|
+
if (tablesResult.rows.length > 0) {
|
|
356391
|
+
const whereParts = ["type = 'epic'", "project_key = ?", "deleted_at IS NULL"];
|
|
356392
|
+
const params = [projectPath];
|
|
356393
|
+
if (options2?.status) {
|
|
356394
|
+
whereParts.push("status = ?");
|
|
356395
|
+
params.push(options2.status);
|
|
356396
|
+
}
|
|
356397
|
+
const query = `
|
|
356398
|
+
WITH epic_subtasks AS (
|
|
356399
|
+
SELECT
|
|
356400
|
+
id as epic_id,
|
|
356401
|
+
title,
|
|
356402
|
+
status,
|
|
356403
|
+
(
|
|
356404
|
+
SELECT COUNT(*)
|
|
356405
|
+
FROM beads subtasks
|
|
356406
|
+
WHERE subtasks.parent_id = beads.id
|
|
356407
|
+
AND subtasks.deleted_at IS NULL
|
|
356408
|
+
) as subtask_count,
|
|
356409
|
+
(
|
|
356410
|
+
SELECT COUNT(*)
|
|
356411
|
+
FROM beads subtasks
|
|
356412
|
+
WHERE subtasks.parent_id = beads.id
|
|
356413
|
+
AND subtasks.status = 'completed'
|
|
356414
|
+
AND subtasks.deleted_at IS NULL
|
|
356415
|
+
) as completed_count
|
|
356416
|
+
FROM beads
|
|
356417
|
+
WHERE ${whereParts.join(" AND ")}
|
|
356418
|
+
)
|
|
356419
|
+
SELECT epic_id, title, subtask_count, completed_count
|
|
356420
|
+
FROM epic_subtasks
|
|
356421
|
+
`;
|
|
356422
|
+
const result = await db.query(query, params);
|
|
356423
|
+
return result.rows.map((row) => ({
|
|
356424
|
+
epic_id: row.epic_id,
|
|
356425
|
+
title: row.title,
|
|
356426
|
+
subtask_count: row.subtask_count,
|
|
356427
|
+
completed_count: row.completed_count
|
|
356428
|
+
}));
|
|
356429
|
+
}
|
|
356430
|
+
return [];
|
|
356431
|
+
}
|
|
356432
|
+
|
|
356433
|
+
// bin/commands/status.ts
|
|
356434
|
+
var dim4 = (s) => `\x1B[2m${s}\x1B[0m`;
|
|
356435
|
+
var bold = (s) => `\x1B[1m${s}\x1B[0m`;
|
|
356436
|
+
var yellow3 = (s) => `\x1B[33m${s}\x1B[0m`;
|
|
356437
|
+
var cyan3 = (s) => `\x1B[36m${s}\x1B[0m`;
|
|
356438
|
+
var green3 = (s) => `\x1B[32m${s}\x1B[0m`;
|
|
356439
|
+
var red2 = (s) => `\x1B[31m${s}\x1B[0m`;
|
|
356440
|
+
var magenta = (s) => `\x1B[35m${s}\x1B[0m`;
|
|
356441
|
+
var SWARM_BANNER = ` ___ _ _ _ ___ __ __
|
|
356442
|
+
/ __|| | | |/_\\ | _ \\| \\/ |
|
|
356443
|
+
\\__ \\| /| / _ \\| /| |\\/| |
|
|
356444
|
+
|___/|__/_/ \\_\\_|_\\ |_| |_|`;
|
|
356445
|
+
async function gatherDashboardData(projectPath) {
|
|
356446
|
+
const swarmMail = await getSwarmMailLibSQL(projectPath);
|
|
356447
|
+
const db = await swarmMail.getDatabase();
|
|
356448
|
+
const adapter6 = createHiveAdapter(db, projectPath);
|
|
356449
|
+
await adapter6.runMigrations();
|
|
356450
|
+
const [cells3, epics, workers, fileLocks, recentMessages] = await Promise.all([
|
|
356451
|
+
adapter6.queryCells(projectPath, { limit: 200 }),
|
|
356452
|
+
getEpicList(projectPath).catch(() => []),
|
|
356453
|
+
getWorkerStatus2(projectPath).catch(() => []),
|
|
356454
|
+
getFileLocks2(projectPath).catch(() => []),
|
|
356455
|
+
getRecentMessages2(projectPath, { limit: 5 }).catch(() => [])
|
|
356456
|
+
]);
|
|
356457
|
+
return { cells: cells3, epics, workers, fileLocks, recentMessages };
|
|
356458
|
+
}
|
|
356459
|
+
function computeSummary(cells3) {
|
|
356460
|
+
const nonEpicCells = cells3.filter((c) => c.type !== "epic");
|
|
356461
|
+
const total = nonEpicCells.length;
|
|
356462
|
+
const completed = nonEpicCells.filter((c) => c.status === "closed").length;
|
|
356463
|
+
const blocked4 = nonEpicCells.filter((c) => c.status === "blocked").length;
|
|
356464
|
+
const active4 = nonEpicCells.filter((c) => c.status === "in_progress").length;
|
|
356465
|
+
const ready = nonEpicCells.filter((c) => c.status === "open" && !c.parent_id || c.status === "open" && c.parent_id !== null).length;
|
|
356466
|
+
const percentComplete = total > 0 ? Math.round(completed / total * 100) : 0;
|
|
356467
|
+
return { total, completed, ready, blocked: blocked4, active: active4, percentComplete };
|
|
356468
|
+
}
|
|
356469
|
+
function groupCellsByStatus(cells3) {
|
|
356470
|
+
const nonEpicCells = cells3.filter((c) => c.type !== "epic");
|
|
356471
|
+
const ready = nonEpicCells.filter((c) => c.status === "open").sort((a, b) => a.priority - b.priority);
|
|
356472
|
+
const blocked4 = nonEpicCells.filter((c) => c.status === "blocked").sort((a, b) => a.priority - b.priority);
|
|
356473
|
+
const active4 = nonEpicCells.filter((c) => c.status === "in_progress").sort((a, b) => a.priority - b.priority);
|
|
356474
|
+
const recentlyCompleted = nonEpicCells.filter((c) => c.status === "closed").sort((a, b) => (b.closed_at ?? b.updated_at) - (a.closed_at ?? a.updated_at)).slice(0, 5);
|
|
356475
|
+
return { ready, blocked: blocked4, active: active4, recentlyCompleted };
|
|
356476
|
+
}
|
|
356477
|
+
function shortId2(id4) {
|
|
356478
|
+
const parts4 = id4.split("-");
|
|
356479
|
+
if (parts4.length >= 3) {
|
|
356480
|
+
return parts4[parts4.length - 1].slice(0, 7);
|
|
356481
|
+
}
|
|
356482
|
+
return id4.slice(0, 7);
|
|
356483
|
+
}
|
|
356484
|
+
function padVisible(s, width) {
|
|
356485
|
+
const visible = s.replace(/\x1b\[[0-9;]*m/g, "");
|
|
356486
|
+
const padding = Math.max(0, width - visible.length);
|
|
356487
|
+
return s + " ".repeat(padding);
|
|
356488
|
+
}
|
|
356489
|
+
function renderSummaryBar(summary12) {
|
|
356490
|
+
const lines = [];
|
|
356491
|
+
const COL_WIDTH = 14;
|
|
356492
|
+
const col1 = padVisible(` ${bold(green3(`${summary12.percentComplete}%`))}`, COL_WIDTH);
|
|
356493
|
+
const col2 = padVisible(bold(cyan3(`${summary12.ready}`)), COL_WIDTH);
|
|
356494
|
+
const col3 = padVisible(bold(red2(`${summary12.blocked}`)), COL_WIDTH);
|
|
356495
|
+
const col4 = bold(yellow3(`${summary12.active}`));
|
|
356496
|
+
lines.push(`${col1}${col2}${col3}${col4}`);
|
|
356497
|
+
const lbl1 = padVisible(` ${dim4("complete")}`, COL_WIDTH);
|
|
356498
|
+
const lbl2 = padVisible(dim4("ready"), COL_WIDTH);
|
|
356499
|
+
const lbl3 = padVisible(dim4("blocked"), COL_WIDTH);
|
|
356500
|
+
const lbl4 = dim4("active");
|
|
356501
|
+
lines.push(`${lbl1}${lbl2}${lbl3}${lbl4}`);
|
|
356502
|
+
return lines.join(`
|
|
356503
|
+
`);
|
|
356504
|
+
}
|
|
356505
|
+
function renderSectionHeader(title, count11) {
|
|
356506
|
+
const countStr = count11 !== undefined ? ` (${count11})` : "";
|
|
356507
|
+
const header = `${title}${countStr}`;
|
|
356508
|
+
const separator = "─".repeat(40);
|
|
356509
|
+
return `
|
|
356510
|
+
${bold(header)}
|
|
356511
|
+
${dim4(separator)}`;
|
|
356512
|
+
}
|
|
356513
|
+
function formatPriority(priority) {
|
|
356514
|
+
if (priority === 0)
|
|
356515
|
+
return magenta("P0");
|
|
356516
|
+
if (priority === 1)
|
|
356517
|
+
return red2("P1");
|
|
356518
|
+
if (priority === 2)
|
|
356519
|
+
return yellow3("P2");
|
|
356520
|
+
if (priority === 3)
|
|
356521
|
+
return cyan3("P3");
|
|
356522
|
+
return dim4(`P${priority}`);
|
|
356523
|
+
}
|
|
356524
|
+
function renderReadySection(cells3) {
|
|
356525
|
+
if (cells3.length === 0) {
|
|
356526
|
+
return renderSectionHeader("Ready to Work", 0) + `
|
|
356527
|
+
${dim4(" No tasks ready")}`;
|
|
356528
|
+
}
|
|
356529
|
+
const lines = [renderSectionHeader("Ready to Work", cells3.length)];
|
|
356530
|
+
for (const cell of cells3.slice(0, 8)) {
|
|
356531
|
+
const id4 = dim4(shortId2(cell.id));
|
|
356532
|
+
const prio = formatPriority(cell.priority);
|
|
356533
|
+
lines.push(` [ ] ${id4}: ${cell.title} (${prio})`);
|
|
356534
|
+
}
|
|
356535
|
+
if (cells3.length > 8) {
|
|
356536
|
+
lines.push(dim4(` ... and ${cells3.length - 8} more`));
|
|
356537
|
+
}
|
|
356538
|
+
return lines.join(`
|
|
356539
|
+
`);
|
|
356540
|
+
}
|
|
356541
|
+
function renderBlockedSection(cells3) {
|
|
356542
|
+
if (cells3.length === 0)
|
|
356543
|
+
return "";
|
|
356544
|
+
const lines = [renderSectionHeader("Blocked", cells3.length)];
|
|
356545
|
+
for (const cell of cells3.slice(0, 5)) {
|
|
356546
|
+
const id4 = dim4(shortId2(cell.id));
|
|
356547
|
+
const blocker = cell.parent_id ? dim4(` [B: ${shortId2(cell.parent_id)}]`) : "";
|
|
356548
|
+
lines.push(` ${red2("[!]")} ${id4}: ${cell.title}${blocker}`);
|
|
356549
|
+
}
|
|
356550
|
+
if (cells3.length > 5) {
|
|
356551
|
+
lines.push(dim4(` ... and ${cells3.length - 5} more`));
|
|
356552
|
+
}
|
|
356553
|
+
return lines.join(`
|
|
356554
|
+
`);
|
|
356555
|
+
}
|
|
356556
|
+
function renderActiveSection(cells3) {
|
|
356557
|
+
if (cells3.length === 0)
|
|
356558
|
+
return "";
|
|
356559
|
+
const lines = [renderSectionHeader("In Progress", cells3.length)];
|
|
356560
|
+
for (const cell of cells3.slice(0, 5)) {
|
|
356561
|
+
const id4 = dim4(shortId2(cell.id));
|
|
356562
|
+
const assignee = cell.assignee ? dim4(` [${cell.assignee}]`) : "";
|
|
356563
|
+
lines.push(` ${yellow3("▶")} ${id4}: ${cell.title}${assignee}`);
|
|
356564
|
+
}
|
|
356565
|
+
if (cells3.length > 5) {
|
|
356566
|
+
lines.push(dim4(` ... and ${cells3.length - 5} more`));
|
|
356567
|
+
}
|
|
356568
|
+
return lines.join(`
|
|
356569
|
+
`);
|
|
356570
|
+
}
|
|
356571
|
+
function renderCompletedSection(cells3) {
|
|
356572
|
+
if (cells3.length === 0)
|
|
356573
|
+
return "";
|
|
356574
|
+
const lines = [renderSectionHeader("Recently Completed", cells3.length)];
|
|
356575
|
+
for (const cell of cells3) {
|
|
356576
|
+
const id4 = dim4(shortId2(cell.id));
|
|
356577
|
+
lines.push(` ${green3("[✓]")} ${id4}: ${cell.title}`);
|
|
356578
|
+
}
|
|
356579
|
+
return lines.join(`
|
|
356580
|
+
`);
|
|
356581
|
+
}
|
|
356582
|
+
function renderWorkersSection(workers) {
|
|
356583
|
+
if (workers.length === 0)
|
|
356584
|
+
return "";
|
|
356585
|
+
const lines = [renderSectionHeader("Workers", workers.length)];
|
|
356586
|
+
for (const w of workers) {
|
|
356587
|
+
const icon = w.status === "working" ? yellow3("●") : w.status === "blocked" ? red2("●") : dim4("○");
|
|
356588
|
+
const task = w.current_task ? dim4(` → ${shortId2(w.current_task)}`) : "";
|
|
356589
|
+
lines.push(` ${icon} ${w.agent_name} ${dim4(`(${w.status})`)}${task}`);
|
|
356590
|
+
}
|
|
356591
|
+
return lines.join(`
|
|
356592
|
+
`);
|
|
356593
|
+
}
|
|
356594
|
+
function renderLocksSection(locks) {
|
|
356595
|
+
if (locks.length === 0)
|
|
356596
|
+
return "";
|
|
356597
|
+
const lines = [renderSectionHeader("File Locks", locks.length)];
|
|
356598
|
+
for (const lock4 of locks.slice(0, 5)) {
|
|
356599
|
+
lines.push(` \uD83D\uDD12 ${dim4(lock4.path)} ${dim4(`← ${lock4.agent_name}`)}`);
|
|
356600
|
+
}
|
|
356601
|
+
if (locks.length > 5) {
|
|
356602
|
+
lines.push(dim4(` ... and ${locks.length - 5} more`));
|
|
356603
|
+
}
|
|
356604
|
+
return lines.join(`
|
|
356605
|
+
`);
|
|
356606
|
+
}
|
|
356607
|
+
function renderEmptyState() {
|
|
356608
|
+
const lines = [
|
|
356609
|
+
"",
|
|
356610
|
+
cyan3(SWARM_BANNER),
|
|
356611
|
+
"",
|
|
356612
|
+
dim4(" No swarm activity found in this project."),
|
|
356613
|
+
"",
|
|
356614
|
+
` Get started:`,
|
|
356615
|
+
` ${cyan3("swarm setup")} ${dim4("Install dependencies & configure")}`,
|
|
356616
|
+
` ${cyan3("swarm init")} ${dim4("Initialize swarm in current project")}`,
|
|
356617
|
+
` ${cyan3("swarm doctor")} ${dim4("Check dependency health")}`,
|
|
356618
|
+
"",
|
|
356619
|
+
dim4(" Run 'swarm help' for all commands.")
|
|
356620
|
+
];
|
|
356621
|
+
return lines.join(`
|
|
356622
|
+
`);
|
|
356623
|
+
}
|
|
356624
|
+
function renderDashboard(data) {
|
|
356625
|
+
const { cells: cells3, workers, fileLocks } = data;
|
|
356626
|
+
if (cells3.length === 0) {
|
|
356627
|
+
return renderEmptyState();
|
|
356628
|
+
}
|
|
356629
|
+
const summary12 = computeSummary(cells3);
|
|
356630
|
+
const groups = groupCellsByStatus(cells3);
|
|
356631
|
+
const sections = [
|
|
356632
|
+
"",
|
|
356633
|
+
cyan3(SWARM_BANNER),
|
|
356634
|
+
"",
|
|
356635
|
+
renderSummaryBar(summary12)
|
|
356636
|
+
];
|
|
356637
|
+
const activeSection = renderActiveSection(groups.active);
|
|
356638
|
+
if (activeSection)
|
|
356639
|
+
sections.push(activeSection);
|
|
356640
|
+
sections.push(renderReadySection(groups.ready));
|
|
356641
|
+
const blockedSection = renderBlockedSection(groups.blocked);
|
|
356642
|
+
if (blockedSection)
|
|
356643
|
+
sections.push(blockedSection);
|
|
356644
|
+
const workersSection = renderWorkersSection(workers);
|
|
356645
|
+
if (workersSection)
|
|
356646
|
+
sections.push(workersSection);
|
|
356647
|
+
const locksSection = renderLocksSection(fileLocks);
|
|
356648
|
+
if (locksSection)
|
|
356649
|
+
sections.push(locksSection);
|
|
356650
|
+
const completedSection = renderCompletedSection(groups.recentlyCompleted);
|
|
356651
|
+
if (completedSection)
|
|
356652
|
+
sections.push(completedSection);
|
|
356653
|
+
sections.push("");
|
|
356654
|
+
sections.push(dim4(` Run 'swarm help' for all commands.`));
|
|
356655
|
+
return sections.join(`
|
|
356656
|
+
`);
|
|
356657
|
+
}
|
|
356658
|
+
function buildJsonOutput(data) {
|
|
356659
|
+
const summary12 = computeSummary(data.cells);
|
|
356660
|
+
const groups = groupCellsByStatus(data.cells);
|
|
356661
|
+
return {
|
|
356662
|
+
summary: summary12,
|
|
356663
|
+
ready: groups.ready.map((c) => ({
|
|
356664
|
+
id: c.id,
|
|
356665
|
+
title: c.title,
|
|
356666
|
+
priority: c.priority,
|
|
356667
|
+
type: c.type
|
|
356668
|
+
})),
|
|
356669
|
+
blocked: groups.blocked.map((c) => ({
|
|
356670
|
+
id: c.id,
|
|
356671
|
+
title: c.title,
|
|
356672
|
+
priority: c.priority,
|
|
356673
|
+
parent_id: c.parent_id
|
|
356674
|
+
})),
|
|
356675
|
+
active: groups.active.map((c) => ({
|
|
356676
|
+
id: c.id,
|
|
356677
|
+
title: c.title,
|
|
356678
|
+
priority: c.priority,
|
|
356679
|
+
assignee: c.assignee
|
|
356680
|
+
})),
|
|
356681
|
+
recentlyCompleted: groups.recentlyCompleted.map((c) => ({
|
|
356682
|
+
id: c.id,
|
|
356683
|
+
title: c.title
|
|
356684
|
+
})),
|
|
356685
|
+
workers: data.workers,
|
|
356686
|
+
fileLocks: data.fileLocks,
|
|
356687
|
+
epics: data.epics
|
|
356688
|
+
};
|
|
356689
|
+
}
|
|
356690
|
+
function parseStatusArgs(args4) {
|
|
356691
|
+
const options2 = {};
|
|
356692
|
+
for (const arg of args4) {
|
|
356693
|
+
if (arg === "--json") {
|
|
356694
|
+
options2.json = true;
|
|
356695
|
+
}
|
|
356696
|
+
}
|
|
356697
|
+
return options2;
|
|
356698
|
+
}
|
|
356699
|
+
async function status5(args4 = []) {
|
|
356700
|
+
const options2 = parseStatusArgs(args4);
|
|
356701
|
+
const projectPath = process.cwd();
|
|
356702
|
+
try {
|
|
356703
|
+
const data = await gatherDashboardData(projectPath);
|
|
356704
|
+
if (options2.json) {
|
|
356705
|
+
console.log(JSON.stringify(buildJsonOutput(data), null, 2));
|
|
356706
|
+
return;
|
|
356707
|
+
}
|
|
356708
|
+
console.log(renderDashboard(data));
|
|
356709
|
+
} catch (error49) {
|
|
356710
|
+
const message = error49 instanceof Error ? error49.message : String(error49);
|
|
356711
|
+
if (message.includes("no such table") || message.includes("SQLITE_ERROR") || message.includes("not initialized")) {
|
|
356712
|
+
console.log(renderEmptyState());
|
|
356713
|
+
} else {
|
|
356714
|
+
console.log(renderEmptyState());
|
|
356715
|
+
if (process.env.DEBUG) {
|
|
356716
|
+
console.error(dim4(`
|
|
356717
|
+
Debug: ${message}`));
|
|
356718
|
+
}
|
|
356719
|
+
}
|
|
356720
|
+
}
|
|
356721
|
+
}
|
|
356722
|
+
|
|
355272
356723
|
// src/observability-tools.ts
|
|
355273
356724
|
init_dist11();
|
|
355274
356725
|
init_dist();
|
|
@@ -356757,7 +358208,8 @@ var CellUpdateArgsSchema3 = exports_external7.object({
|
|
|
356757
358208
|
});
|
|
356758
358209
|
var CellCloseArgsSchema3 = exports_external7.object({
|
|
356759
358210
|
id: exports_external7.string(),
|
|
356760
|
-
reason: exports_external7.string().min(1, "Reason required")
|
|
358211
|
+
reason: exports_external7.string().min(1, "Reason required"),
|
|
358212
|
+
result: exports_external7.string().optional()
|
|
356761
358213
|
});
|
|
356762
358214
|
var CellQueryArgsSchema3 = exports_external7.object({
|
|
356763
358215
|
status: CellStatusSchema3.optional(),
|
|
@@ -357715,7 +359167,8 @@ var hive_close3 = tool3({
|
|
|
357715
359167
|
description: "Close a cell with reason",
|
|
357716
359168
|
args: {
|
|
357717
359169
|
id: tool3.schema.string().describe("Cell ID or partial hash"),
|
|
357718
|
-
reason: tool3.schema.string().describe("Completion reason")
|
|
359170
|
+
reason: tool3.schema.string().describe("Completion reason"),
|
|
359171
|
+
result: tool3.schema.string().optional().describe("Implementation summary - what was actually done (like a PR description)")
|
|
357719
359172
|
},
|
|
357720
359173
|
async execute(args5, ctx) {
|
|
357721
359174
|
const validated = CellCloseArgsSchema3.parse(args5);
|
|
@@ -357725,7 +359178,7 @@ var hive_close3 = tool3({
|
|
|
357725
359178
|
const cellId = await resolvePartialId(adapter6, projectKey, validated.id) || validated.id;
|
|
357726
359179
|
const cellBeforeClose = await adapter6.getCell(projectKey, cellId);
|
|
357727
359180
|
const isEpic = cellBeforeClose?.type === "epic";
|
|
357728
|
-
const cell = await adapter6.closeCell(projectKey, cellId, validated.reason);
|
|
359181
|
+
const cell = await adapter6.closeCell(projectKey, cellId, validated.reason, validated.result ? { result: validated.result } : undefined);
|
|
357729
359182
|
await adapter6.markDirty(projectKey, cellId);
|
|
357730
359183
|
if (isEpic && cellBeforeClose) {
|
|
357731
359184
|
try {
|
|
@@ -363491,6 +364944,20 @@ var reviewTools = {
|
|
|
363491
364944
|
swarm_review_feedback: swarm_review_feedback2
|
|
363492
364945
|
};
|
|
363493
364946
|
|
|
364947
|
+
// src/utils/git-commit-info.ts
|
|
364948
|
+
import { execSync as execSync2 } from "child_process";
|
|
364949
|
+
function getGitCommitInfo2(cwd) {
|
|
364950
|
+
try {
|
|
364951
|
+
const opts = { cwd, encoding: "utf-8", timeout: 5000 };
|
|
364952
|
+
const sha = execSync2("git rev-parse HEAD", opts).trim();
|
|
364953
|
+
const message = execSync2("git log -1 --format=%s", opts).trim();
|
|
364954
|
+
const branch = execSync2("git rev-parse --abbrev-ref HEAD", opts).trim();
|
|
364955
|
+
return { sha, message, branch };
|
|
364956
|
+
} catch {
|
|
364957
|
+
return null;
|
|
364958
|
+
}
|
|
364959
|
+
}
|
|
364960
|
+
|
|
363494
364961
|
// src/swarm-orchestrate.ts
|
|
363495
364962
|
init_eval_capture3();
|
|
363496
364963
|
|
|
@@ -364162,7 +365629,10 @@ var swarm_complete2 = tool3({
|
|
|
364162
365629
|
start_time: tool3.schema.number().describe("Task start timestamp (Unix ms) for duration calculation - REQUIRED for accurate analytics"),
|
|
364163
365630
|
error_count: tool3.schema.number().optional().describe("Number of errors encountered during task"),
|
|
364164
365631
|
retry_count: tool3.schema.number().optional().describe("Number of retry attempts during task"),
|
|
364165
|
-
skip_review: tool3.schema.boolean().optional().describe("Skip review gate check (default: false). Use only for tasks that don't require coordinator review.")
|
|
365632
|
+
skip_review: tool3.schema.boolean().optional().describe("Skip review gate check (default: false). Use only for tasks that don't require coordinator review."),
|
|
365633
|
+
commit_sha: tool3.schema.string().optional().describe("Git commit SHA (auto-detected if not provided)"),
|
|
365634
|
+
commit_message: tool3.schema.string().optional().describe("Commit message (auto-detected if not provided)"),
|
|
365635
|
+
commit_branch: tool3.schema.string().optional().describe("Git branch (auto-detected if not provided)")
|
|
364166
365636
|
},
|
|
364167
365637
|
async execute(args5, _ctx) {
|
|
364168
365638
|
const missing = [];
|
|
@@ -364223,6 +365693,13 @@ var swarm_complete2 = tool3({
|
|
|
364223
365693
|
}, null, 2);
|
|
364224
365694
|
}
|
|
364225
365695
|
}
|
|
365696
|
+
const gitInfo = getGitCommitInfo2(args5.project_key) || {};
|
|
365697
|
+
const commitSha = args5.commit_sha || gitInfo.sha;
|
|
365698
|
+
const commitMessage = args5.commit_message || gitInfo.message;
|
|
365699
|
+
const commitBranch = args5.commit_branch || gitInfo.branch;
|
|
365700
|
+
const resultText = commitSha ? `${args5.summary}
|
|
365701
|
+
|
|
365702
|
+
Commit: ${commitSha.slice(0, 8)} (${commitBranch || "unknown"}) - ${commitMessage || "no message"}` : args5.summary;
|
|
364226
365703
|
try {
|
|
364227
365704
|
const adapter6 = await getHiveAdapter3(args5.project_key);
|
|
364228
365705
|
const cell = await adapter6.getCell(args5.project_key, args5.bead_id);
|
|
@@ -364337,7 +365814,9 @@ This will be recorded as a negative learning signal.`;
|
|
|
364337
365814
|
}
|
|
364338
365815
|
}
|
|
364339
365816
|
try {
|
|
364340
|
-
await adapter6.closeCell(args5.project_key, args5.bead_id, args5.summary
|
|
365817
|
+
await adapter6.closeCell(args5.project_key, args5.bead_id, args5.summary, {
|
|
365818
|
+
result: resultText
|
|
365819
|
+
});
|
|
364341
365820
|
} catch (closeError) {
|
|
364342
365821
|
const errorMessage = closeError instanceof Error ? closeError.message : String(closeError);
|
|
364343
365822
|
return JSON.stringify({
|
|
@@ -364405,7 +365884,8 @@ This will be recorded as a negative learning signal.`;
|
|
|
364405
365884
|
retry_count: args5.retry_count || 0,
|
|
364406
365885
|
success: true,
|
|
364407
365886
|
scope_violation: contractValidation ? !contractValidation.valid : undefined,
|
|
364408
|
-
violation_files: contractValidation?.violations
|
|
365887
|
+
violation_files: contractValidation?.violations,
|
|
365888
|
+
commit: commitSha ? { sha: commitSha, message: commitMessage, branch: commitBranch } : undefined
|
|
364409
365889
|
});
|
|
364410
365890
|
const savedEvent = await appendEvent(event, args5.project_key);
|
|
364411
365891
|
outcomeEventId = savedEvent.id;
|
|
@@ -364590,6 +366070,8 @@ This will be recorded as a negative learning signal.`;
|
|
|
364590
366070
|
success: true,
|
|
364591
366071
|
bead_id: args5.bead_id,
|
|
364592
366072
|
closed: true,
|
|
366073
|
+
result: resultText,
|
|
366074
|
+
commit: commitSha ? { sha: commitSha, message: commitMessage, branch: commitBranch } : undefined,
|
|
364593
366075
|
reservations_released: reservationsReleased,
|
|
364594
366076
|
reservations_released_count: reservationsReleasedCount,
|
|
364595
366077
|
reservations_release_error: reservationsReleaseError,
|
|
@@ -369486,20 +370968,20 @@ var BANNER = `
|
|
|
369486
370968
|
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u255D\u255A\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D
|
|
369487
370969
|
`;
|
|
369488
370970
|
var TAGLINE = "Multi-agent coordination for OpenCode";
|
|
369489
|
-
var
|
|
369490
|
-
var
|
|
369491
|
-
var
|
|
369492
|
-
var
|
|
369493
|
-
var
|
|
369494
|
-
var
|
|
369495
|
-
var
|
|
370971
|
+
var dim6 = (s) => `\x1B[2m${s}\x1B[0m`;
|
|
370972
|
+
var yellow5 = (s) => `\x1B[33m${s}\x1B[0m`;
|
|
370973
|
+
var cyan5 = (s) => `\x1B[36m${s}\x1B[0m`;
|
|
370974
|
+
var green5 = (s) => `\x1B[32m${s}\x1B[0m`;
|
|
370975
|
+
var magenta2 = (s) => `\x1B[35m${s}\x1B[0m`;
|
|
370976
|
+
var red4 = (s) => `\x1B[31m${s}\x1B[0m`;
|
|
370977
|
+
var bold3 = (s) => `\x1B[1m${s}\x1B[0m`;
|
|
369496
370978
|
var PACKAGE_NAME = "opencode-swarm-plugin";
|
|
369497
370979
|
function writeFileWithStatus(path4, content, label) {
|
|
369498
370980
|
const exists9 = existsSync37(path4);
|
|
369499
370981
|
if (exists9) {
|
|
369500
370982
|
const current3 = readFileSync21(path4, "utf-8");
|
|
369501
370983
|
if (current3 === content) {
|
|
369502
|
-
p4.log.message(
|
|
370984
|
+
p4.log.message(dim6(` ${label}: ${path4} (unchanged)`));
|
|
369503
370985
|
return "unchanged";
|
|
369504
370986
|
}
|
|
369505
370987
|
}
|
|
@@ -369511,7 +370993,7 @@ function writeFileWithStatus(path4, content, label) {
|
|
|
369511
370993
|
function mkdirWithStatus(path4) {
|
|
369512
370994
|
if (!existsSync37(path4)) {
|
|
369513
370995
|
mkdirSync13(path4, { recursive: true });
|
|
369514
|
-
p4.log.message(
|
|
370996
|
+
p4.log.message(dim6(` Created directory: ${path4}`));
|
|
369515
370997
|
return true;
|
|
369516
370998
|
}
|
|
369517
370999
|
return false;
|
|
@@ -369519,7 +371001,7 @@ function mkdirWithStatus(path4) {
|
|
|
369519
371001
|
function rmWithStatus(path4, label) {
|
|
369520
371002
|
if (existsSync37(path4)) {
|
|
369521
371003
|
rmSync(path4);
|
|
369522
|
-
p4.log.message(
|
|
371004
|
+
p4.log.message(dim6(` Removed ${label}: ${path4}`));
|
|
369523
371005
|
}
|
|
369524
371006
|
}
|
|
369525
371007
|
function getSeason() {
|
|
@@ -369604,9 +371086,9 @@ function getRandomMessage() {
|
|
|
369604
371086
|
function getDecoratedBee() {
|
|
369605
371087
|
const { decorations } = getSeasonalBee();
|
|
369606
371088
|
if (!decorations || Math.random() > 0.5)
|
|
369607
|
-
return
|
|
371089
|
+
return cyan5(BEE);
|
|
369608
371090
|
const decoration = decorations[Math.floor(Math.random() * decorations.length)];
|
|
369609
|
-
return
|
|
371091
|
+
return cyan5(BEE.replace("bzzzz...", `bzzzz... ${decoration}`));
|
|
369610
371092
|
}
|
|
369611
371093
|
var COORDINATOR_MODELS = [
|
|
369612
371094
|
{
|
|
@@ -369686,11 +371168,11 @@ function compareVersions(a, b) {
|
|
|
369686
371168
|
function showUpdateNotification(info4) {
|
|
369687
371169
|
if (info4.updateAvailable) {
|
|
369688
371170
|
console.log();
|
|
369689
|
-
console.log(
|
|
369690
|
-
console.log(
|
|
369691
|
-
console.log(
|
|
369692
|
-
console.log(
|
|
369693
|
-
console.log(
|
|
371171
|
+
console.log(yellow5(" \u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E"));
|
|
371172
|
+
console.log(yellow5(" \u2502") + " Update available! " + dim6(info4.current) + " \u2192 " + green5(info4.latest) + " " + yellow5("\u2502"));
|
|
371173
|
+
console.log(yellow5(" \u2502") + " Run: " + cyan5("npm install -g " + PACKAGE_NAME + "@latest") + " " + yellow5("\u2502"));
|
|
371174
|
+
console.log(yellow5(" \u2502") + " Or: " + cyan5("swarm update") + " " + yellow5("\u2502"));
|
|
371175
|
+
console.log(yellow5(" \u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F"));
|
|
369694
371176
|
console.log();
|
|
369695
371177
|
}
|
|
369696
371178
|
}
|
|
@@ -370718,12 +372200,12 @@ async function doctor(debug = false) {
|
|
|
370718
372200
|
p4.intro("swarm doctor v" + VERSION6);
|
|
370719
372201
|
if (debug) {
|
|
370720
372202
|
p4.log.step("Debug info:");
|
|
370721
|
-
p4.log.message(
|
|
370722
|
-
p4.log.message(
|
|
370723
|
-
p4.log.message(
|
|
370724
|
-
p4.log.message(
|
|
370725
|
-
p4.log.message(
|
|
370726
|
-
p4.log.message(
|
|
372203
|
+
p4.log.message(dim6(` Runtime: ${typeof Bun !== "undefined" ? "Bun" : "Node.js"}`));
|
|
372204
|
+
p4.log.message(dim6(` Node version: ${process.version}`));
|
|
372205
|
+
p4.log.message(dim6(` Platform: ${process.platform}`));
|
|
372206
|
+
p4.log.message(dim6(` Arch: ${process.arch}`));
|
|
372207
|
+
p4.log.message(dim6(` CWD: ${process.cwd()}`));
|
|
372208
|
+
p4.log.message(dim6(` PATH entries: ${(process.env.PATH || "").split(":").length}`));
|
|
370727
372209
|
}
|
|
370728
372210
|
const s = p4.spinner();
|
|
370729
372211
|
s.start("Checking dependencies...");
|
|
@@ -370732,8 +372214,8 @@ async function doctor(debug = false) {
|
|
|
370732
372214
|
if (debug) {
|
|
370733
372215
|
p4.log.step("Dependency check details:");
|
|
370734
372216
|
for (const { dep, available: available4, version: version4 } of results) {
|
|
370735
|
-
const status4 = available4 ?
|
|
370736
|
-
p4.log.message(
|
|
372217
|
+
const status4 = available4 ? green5("\u2713") : red4("\u2717");
|
|
372218
|
+
p4.log.message(dim6(` ${status4} ${dep.command} ${dep.checkArgs.join(" ")} \u2192 ${available4 ? `v${version4 || "unknown"}` : "not found"}`));
|
|
370737
372219
|
}
|
|
370738
372220
|
}
|
|
370739
372221
|
const required5 = results.filter((r) => r.dep.required);
|
|
@@ -370746,7 +372228,7 @@ async function doctor(debug = false) {
|
|
|
370746
372228
|
p4.log.error(dep.name + " - not found");
|
|
370747
372229
|
const fixCmd = getFixCommand(dep);
|
|
370748
372230
|
if (fixCmd) {
|
|
370749
|
-
p4.log.message(
|
|
372231
|
+
p4.log.message(dim6(" \u2514\u2500 Fix: " + fixCmd));
|
|
370750
372232
|
}
|
|
370751
372233
|
}
|
|
370752
372234
|
}
|
|
@@ -370758,7 +372240,7 @@ async function doctor(debug = false) {
|
|
|
370758
372240
|
p4.log.warn(dep.name + " - not found (" + dep.description + ")");
|
|
370759
372241
|
const fixCmd = getFixCommand(dep);
|
|
370760
372242
|
if (fixCmd) {
|
|
370761
|
-
p4.log.message(
|
|
372243
|
+
p4.log.message(dim6(" \u2514\u2500 Fix: " + fixCmd));
|
|
370762
372244
|
}
|
|
370763
372245
|
}
|
|
370764
372246
|
}
|
|
@@ -370809,11 +372291,11 @@ async function doctor(debug = false) {
|
|
|
370809
372291
|
const claudeStatus = getClaudeInstallStatus(process.cwd());
|
|
370810
372292
|
if (!claudeResult?.available) {
|
|
370811
372293
|
p4.log.warn("Claude Code CLI not detected (optional)");
|
|
370812
|
-
p4.log.message(
|
|
372294
|
+
p4.log.message(dim6(" Install: https://docs.anthropic.com/claude-code"));
|
|
370813
372295
|
} else {
|
|
370814
372296
|
p4.log.success(`Claude Code CLI detected${claudeResult.version ? ` v${claudeResult.version}` : ""}`);
|
|
370815
372297
|
if (existsSync37(claudeStatus.pluginRoot)) {
|
|
370816
|
-
p4.log.message(
|
|
372298
|
+
p4.log.message(dim6(` Plugin bundle: ${claudeStatus.pluginRoot}`));
|
|
370817
372299
|
} else {
|
|
370818
372300
|
p4.log.warn(`Claude plugin bundle missing: ${claudeStatus.pluginRoot}`);
|
|
370819
372301
|
}
|
|
@@ -370825,13 +372307,13 @@ async function doctor(debug = false) {
|
|
|
370825
372307
|
}
|
|
370826
372308
|
} else {
|
|
370827
372309
|
p4.log.warn("Global Claude plugin not installed");
|
|
370828
|
-
p4.log.message(
|
|
372310
|
+
p4.log.message(dim6(" Run: swarm claude install"));
|
|
370829
372311
|
}
|
|
370830
372312
|
if (claudeStatus.projectConfigExists) {
|
|
370831
372313
|
p4.log.success(`Project Claude config: ${claudeStatus.projectClaudeDir}`);
|
|
370832
372314
|
} else {
|
|
370833
372315
|
p4.log.warn("Project Claude config not found");
|
|
370834
|
-
p4.log.message(
|
|
372316
|
+
p4.log.message(dim6(" Run: swarm claude init"));
|
|
370835
372317
|
}
|
|
370836
372318
|
}
|
|
370837
372319
|
if (requiredMissing.length > 0) {
|
|
@@ -370848,23 +372330,23 @@ async function doctor(debug = false) {
|
|
|
370848
372330
|
}
|
|
370849
372331
|
async function setup(forceReinstall = false, nonInteractive = false) {
|
|
370850
372332
|
console.clear();
|
|
370851
|
-
console.log(
|
|
372333
|
+
console.log(yellow5(BANNER));
|
|
370852
372334
|
console.log(getDecoratedBee());
|
|
370853
372335
|
console.log();
|
|
370854
|
-
console.log(
|
|
372336
|
+
console.log(magenta2(" " + getRandomMessage()));
|
|
370855
372337
|
console.log();
|
|
370856
372338
|
p4.intro("opencode-swarm-plugin v" + VERSION6);
|
|
370857
372339
|
const bunCheck = await checkCommand("bun", ["--version"]);
|
|
370858
372340
|
if (!bunCheck.available) {
|
|
370859
372341
|
p4.log.error("Bun is required but not installed!");
|
|
370860
372342
|
console.log();
|
|
370861
|
-
console.log(
|
|
372343
|
+
console.log(dim6(" The swarm CLI requires Bun runtime for Bun-specific APIs."));
|
|
370862
372344
|
console.log();
|
|
370863
372345
|
console.log(" Install Bun:");
|
|
370864
|
-
console.log(
|
|
372346
|
+
console.log(cyan5(" curl -fsSL https://bun.sh/install | bash"));
|
|
370865
372347
|
console.log();
|
|
370866
|
-
console.log(
|
|
370867
|
-
console.log(
|
|
372348
|
+
console.log(dim6(" Or via Homebrew:"));
|
|
372349
|
+
console.log(cyan5(" brew install oven-sh/bun/bun"));
|
|
370868
372350
|
console.log();
|
|
370869
372351
|
process.exit(1);
|
|
370870
372352
|
}
|
|
@@ -370925,7 +372407,7 @@ async function setup(forceReinstall = false, nonInteractive = false) {
|
|
|
370925
372407
|
].filter((f) => existsSync37(f));
|
|
370926
372408
|
if (existingFiles.length > 0 && !forceReinstall) {
|
|
370927
372409
|
p4.log.success("Swarm is already configured!");
|
|
370928
|
-
p4.log.message(
|
|
372410
|
+
p4.log.message(dim6(" Found " + existingFiles.length + "/5 config files"));
|
|
370929
372411
|
const action = await p4.select({
|
|
370930
372412
|
message: "What would you like to do?",
|
|
370931
372413
|
options: [
|
|
@@ -370993,7 +372475,7 @@ async function setup(forceReinstall = false, nonInteractive = false) {
|
|
|
370993
372475
|
if (action === "reinstall") {
|
|
370994
372476
|
isReinstall = true;
|
|
370995
372477
|
p4.log.step("Reinstalling swarm configuration...");
|
|
370996
|
-
p4.log.message(
|
|
372478
|
+
p4.log.message(dim6(" This will check dependencies, sync skills, and update config files"));
|
|
370997
372479
|
}
|
|
370998
372480
|
}
|
|
370999
372481
|
const s = p4.spinner();
|
|
@@ -371099,8 +372581,8 @@ async function setup(forceReinstall = false, nonInteractive = false) {
|
|
|
371099
372581
|
const migrationCheck = checkBeadsMigrationNeeded(cwd);
|
|
371100
372582
|
if (migrationCheck.needed) {
|
|
371101
372583
|
p4.log.warn("Found legacy .beads directory");
|
|
371102
|
-
p4.log.message(
|
|
371103
|
-
p4.log.message(
|
|
372584
|
+
p4.log.message(dim6(" Path: " + migrationCheck.beadsPath));
|
|
372585
|
+
p4.log.message(dim6(" Will rename to .hive/ and merge history"));
|
|
371104
372586
|
const shouldMigrate = await p4.confirm({
|
|
371105
372587
|
message: "Migrate .beads to .hive? (recommended)",
|
|
371106
372588
|
initialValue: true
|
|
@@ -371143,7 +372625,7 @@ async function setup(forceReinstall = false, nonInteractive = false) {
|
|
|
371143
372625
|
p4.log.warn("Skipping migration - .beads will continue to work but is deprecated");
|
|
371144
372626
|
}
|
|
371145
372627
|
} else {
|
|
371146
|
-
p4.log.message(
|
|
372628
|
+
p4.log.message(dim6(" No legacy .beads directory found"));
|
|
371147
372629
|
}
|
|
371148
372630
|
p4.log.step("Checking for legacy MCP servers...");
|
|
371149
372631
|
const opencodeConfigPath = join57(configDir, "config.json");
|
|
@@ -371152,7 +372634,7 @@ async function setup(forceReinstall = false, nonInteractive = false) {
|
|
|
371152
372634
|
const opencodeConfig = JSON.parse(readFileSync21(opencodeConfigPath, "utf-8"));
|
|
371153
372635
|
if (opencodeConfig.mcpServers?.["semantic-memory"]) {
|
|
371154
372636
|
p4.log.warn("Found legacy semantic-memory MCP server");
|
|
371155
|
-
p4.log.message(
|
|
372637
|
+
p4.log.message(dim6(" Semantic memory is now embedded in the plugin"));
|
|
371156
372638
|
const removeMcp = await p4.confirm({
|
|
371157
372639
|
message: "Remove from MCP servers config?",
|
|
371158
372640
|
initialValue: true
|
|
@@ -371165,18 +372647,18 @@ async function setup(forceReinstall = false, nonInteractive = false) {
|
|
|
371165
372647
|
delete opencodeConfig.mcpServers["semantic-memory"];
|
|
371166
372648
|
writeFileSync9(opencodeConfigPath, JSON.stringify(opencodeConfig, null, 2));
|
|
371167
372649
|
p4.log.success("Removed semantic-memory from MCP servers");
|
|
371168
|
-
p4.log.message(
|
|
372650
|
+
p4.log.message(dim6(` Updated: ${opencodeConfigPath}`));
|
|
371169
372651
|
} else {
|
|
371170
372652
|
p4.log.warn("Keeping legacy MCP - you may see duplicate semantic-memory tools");
|
|
371171
372653
|
}
|
|
371172
372654
|
} else {
|
|
371173
|
-
p4.log.message(
|
|
372655
|
+
p4.log.message(dim6(" No legacy MCP servers found"));
|
|
371174
372656
|
}
|
|
371175
372657
|
} catch (error56) {
|
|
371176
|
-
p4.log.message(
|
|
372658
|
+
p4.log.message(dim6(" Could not parse OpenCode config (skipping MCP check)"));
|
|
371177
372659
|
}
|
|
371178
372660
|
} else {
|
|
371179
|
-
p4.log.message(
|
|
372661
|
+
p4.log.message(dim6(" No OpenCode config found (skipping MCP check)"));
|
|
371180
372662
|
}
|
|
371181
372663
|
p4.log.step("Checking for stray databases...");
|
|
371182
372664
|
const globalDbPath = getGlobalDbPath2();
|
|
@@ -371191,25 +372673,25 @@ async function setup(forceReinstall = false, nonInteractive = false) {
|
|
|
371191
372673
|
for (const migration of report.migrations) {
|
|
371192
372674
|
const { migrated, skipped } = migration.result;
|
|
371193
372675
|
if (migrated > 0 || skipped > 0) {
|
|
371194
|
-
p4.log.message(
|
|
372676
|
+
p4.log.message(dim6(` ${migration.path}: ${migrated} migrated, ${skipped} skipped`));
|
|
371195
372677
|
}
|
|
371196
372678
|
}
|
|
371197
372679
|
} else {
|
|
371198
|
-
p4.log.message(
|
|
372680
|
+
p4.log.message(dim6(" All data already in global database (no migration needed)"));
|
|
371199
372681
|
}
|
|
371200
372682
|
} else {
|
|
371201
|
-
p4.log.message(
|
|
372683
|
+
p4.log.message(dim6(" No stray databases found"));
|
|
371202
372684
|
}
|
|
371203
372685
|
if (report.errors.length > 0) {
|
|
371204
372686
|
p4.log.warn(`${report.errors.length} error(s) during consolidation`);
|
|
371205
372687
|
for (const error56 of report.errors) {
|
|
371206
|
-
p4.log.message(
|
|
372688
|
+
p4.log.message(dim6(` ${error56}`));
|
|
371207
372689
|
}
|
|
371208
372690
|
}
|
|
371209
372691
|
} catch (error56) {
|
|
371210
372692
|
p4.log.warn("Database consolidation check failed");
|
|
371211
372693
|
if (error56 instanceof Error) {
|
|
371212
|
-
p4.log.message(
|
|
372694
|
+
p4.log.message(dim6(` ${error56.message}`));
|
|
371213
372695
|
}
|
|
371214
372696
|
}
|
|
371215
372697
|
p4.log.step("Running database integrity check...");
|
|
@@ -371220,22 +372702,22 @@ async function setup(forceReinstall = false, nonInteractive = false) {
|
|
|
371220
372702
|
} else {
|
|
371221
372703
|
p4.log.success(`Cleaned ${repairResult.totalCleaned} orphaned/invalid records`);
|
|
371222
372704
|
if (repairResult.nullBeads > 0) {
|
|
371223
|
-
p4.log.message(
|
|
372705
|
+
p4.log.message(dim6(` - ${repairResult.nullBeads} beads with NULL IDs`));
|
|
371224
372706
|
}
|
|
371225
372707
|
if (repairResult.orphanedRecipients > 0) {
|
|
371226
|
-
p4.log.message(
|
|
372708
|
+
p4.log.message(dim6(` - ${repairResult.orphanedRecipients} orphaned message recipients`));
|
|
371227
372709
|
}
|
|
371228
372710
|
if (repairResult.messagesWithoutRecipients > 0) {
|
|
371229
|
-
p4.log.message(
|
|
372711
|
+
p4.log.message(dim6(` - ${repairResult.messagesWithoutRecipients} messages without recipients`));
|
|
371230
372712
|
}
|
|
371231
372713
|
if (repairResult.expiredReservations > 0) {
|
|
371232
|
-
p4.log.message(
|
|
372714
|
+
p4.log.message(dim6(` - ${repairResult.expiredReservations} expired reservations`));
|
|
371233
372715
|
}
|
|
371234
372716
|
}
|
|
371235
372717
|
} catch (error56) {
|
|
371236
372718
|
p4.log.warn("Database repair check failed (non-critical)");
|
|
371237
372719
|
if (error56 instanceof Error) {
|
|
371238
|
-
p4.log.message(
|
|
372720
|
+
p4.log.message(dim6(` ${error56.message}`));
|
|
371239
372721
|
}
|
|
371240
372722
|
}
|
|
371241
372723
|
const DEFAULT_COORDINATOR = "anthropic/claude-opus-4-5";
|
|
@@ -371249,12 +372731,12 @@ async function setup(forceReinstall = false, nonInteractive = false) {
|
|
|
371249
372731
|
workerModel = DEFAULT_WORKER;
|
|
371250
372732
|
liteModel = DEFAULT_LITE;
|
|
371251
372733
|
p4.log.step("Using default models:");
|
|
371252
|
-
p4.log.message(
|
|
371253
|
-
p4.log.message(
|
|
371254
|
-
p4.log.message(
|
|
372734
|
+
p4.log.message(dim6(` Coordinator: ${coordinatorModel}`));
|
|
372735
|
+
p4.log.message(dim6(` Worker: ${workerModel}`));
|
|
372736
|
+
p4.log.message(dim6(` Lite: ${liteModel}`));
|
|
371255
372737
|
} else {
|
|
371256
372738
|
p4.log.step("Configuring swarm agents...");
|
|
371257
|
-
p4.log.message(
|
|
372739
|
+
p4.log.message(dim6(" Coordinator handles orchestration, worker executes tasks"));
|
|
371258
372740
|
const selectedCoordinator = await p4.select({
|
|
371259
372741
|
message: "Select coordinator model (for orchestration/planning):",
|
|
371260
372742
|
options: [
|
|
@@ -371380,9 +372862,9 @@ async function setup(forceReinstall = false, nonInteractive = false) {
|
|
|
371380
372862
|
liteModel = selectedLite;
|
|
371381
372863
|
}
|
|
371382
372864
|
p4.log.success("Selected models:");
|
|
371383
|
-
p4.log.message(
|
|
371384
|
-
p4.log.message(
|
|
371385
|
-
p4.log.message(
|
|
372865
|
+
p4.log.message(dim6(` Coordinator: ${coordinatorModel}`));
|
|
372866
|
+
p4.log.message(dim6(` Worker: ${workerModel}`));
|
|
372867
|
+
p4.log.message(dim6(` Lite: ${liteModel}`));
|
|
371386
372868
|
p4.log.step("Setting up OpenCode integration...");
|
|
371387
372869
|
const stats = { created: 0, updated: 0, unchanged: 0 };
|
|
371388
372870
|
const legacySkillsDir = join57(configDir, "skills");
|
|
@@ -371391,7 +372873,7 @@ async function setup(forceReinstall = false, nonInteractive = false) {
|
|
|
371391
372873
|
p4.log.step("Migrating skills directory...");
|
|
371392
372874
|
try {
|
|
371393
372875
|
renameSync5(legacySkillsDir, skillsDir);
|
|
371394
|
-
p4.log.message(
|
|
372876
|
+
p4.log.message(dim6(` Renamed: ${legacySkillsDir} \u2192 ${skillsDir}`));
|
|
371395
372877
|
} catch (err) {
|
|
371396
372878
|
p4.log.warn(`Could not migrate skills directory: ${err}`);
|
|
371397
372879
|
}
|
|
@@ -371419,12 +372901,12 @@ async function setup(forceReinstall = false, nonInteractive = false) {
|
|
|
371419
372901
|
rmdirSync(swarmAgentDir);
|
|
371420
372902
|
} catch {}
|
|
371421
372903
|
}
|
|
371422
|
-
p4.log.message(
|
|
372904
|
+
p4.log.message(dim6(` Skills directory: ${skillsDir}`));
|
|
371423
372905
|
const bundledSkillsPath = join57(__dirname2, "..", "global-skills");
|
|
371424
372906
|
const bundledSkills = listDirectoryNames(bundledSkillsPath);
|
|
371425
372907
|
if (existsSync37(bundledSkillsPath)) {
|
|
371426
372908
|
if (bundledSkills.length > 0) {
|
|
371427
|
-
p4.log.message(
|
|
372909
|
+
p4.log.message(dim6(" Bundled skills: " + bundledSkills.join(", ")));
|
|
371428
372910
|
}
|
|
371429
372911
|
}
|
|
371430
372912
|
if (bundledSkills.length > 0) {
|
|
@@ -371449,12 +372931,12 @@ async function setup(forceReinstall = false, nonInteractive = false) {
|
|
|
371449
372931
|
p4.log.success("Updated: " + updated.join(", "));
|
|
371450
372932
|
}
|
|
371451
372933
|
if (skipped.length > 0) {
|
|
371452
|
-
p4.log.message(
|
|
372934
|
+
p4.log.message(dim6("Skipped (already exists, not managed): " + skipped.join(", ")));
|
|
371453
372935
|
}
|
|
371454
372936
|
} catch (error56) {
|
|
371455
372937
|
syncSpinner.stop("Could not sync bundled skills");
|
|
371456
372938
|
p4.log.warn("Bundled skills are still available from the package via skills_list.");
|
|
371457
|
-
p4.log.message(
|
|
372939
|
+
p4.log.message(dim6(error56 instanceof Error ? error56.message : String(error56)));
|
|
371458
372940
|
}
|
|
371459
372941
|
}
|
|
371460
372942
|
}
|
|
@@ -371471,7 +372953,7 @@ async function setup(forceReinstall = false, nonInteractive = false) {
|
|
|
371471
372953
|
s2.stop("AGENTS.md updated");
|
|
371472
372954
|
p4.log.success("Updated: " + agentsPath);
|
|
371473
372955
|
if (result.backupPath) {
|
|
371474
|
-
p4.log.message(
|
|
372956
|
+
p4.log.message(dim6(" Backup: " + result.backupPath));
|
|
371475
372957
|
}
|
|
371476
372958
|
} else {
|
|
371477
372959
|
s2.stop("AGENTS.md already up to date");
|
|
@@ -371487,11 +372969,11 @@ async function setup(forceReinstall = false, nonInteractive = false) {
|
|
|
371487
372969
|
const claudeStatus = getClaudeInstallStatus(cwd);
|
|
371488
372970
|
if (!claudeResult?.available) {
|
|
371489
372971
|
p4.log.warn("Claude Code not detected (optional)");
|
|
371490
|
-
p4.log.message(
|
|
372972
|
+
p4.log.message(dim6(" Install: https://docs.anthropic.com/claude-code"));
|
|
371491
372973
|
} else {
|
|
371492
372974
|
const versionInfo = claudeResult.version ? ` v${claudeResult.version}` : "";
|
|
371493
372975
|
p4.log.success(`Claude Code detected${versionInfo}`);
|
|
371494
|
-
p4.log.message(
|
|
372976
|
+
p4.log.message(dim6(` Plugin bundle: ${claudeStatus.pluginRoot}`));
|
|
371495
372977
|
if (claudeStatus.globalPluginExists) {
|
|
371496
372978
|
if (claudeStatus.globalPluginLinked) {
|
|
371497
372979
|
p4.log.success(`Claude plugin linked: ${claudeStatus.globalPluginPath}`);
|
|
@@ -371499,12 +372981,12 @@ async function setup(forceReinstall = false, nonInteractive = false) {
|
|
|
371499
372981
|
p4.log.warn(`Claude plugin exists but is not a symlink: ${claudeStatus.globalPluginPath}`);
|
|
371500
372982
|
}
|
|
371501
372983
|
} else {
|
|
371502
|
-
p4.log.message(
|
|
372984
|
+
p4.log.message(dim6(" Run 'swarm claude install' for a dev symlink"));
|
|
371503
372985
|
}
|
|
371504
372986
|
if (claudeStatus.projectConfigExists) {
|
|
371505
372987
|
p4.log.success(`Project Claude config: ${claudeStatus.projectClaudeDir}`);
|
|
371506
372988
|
} else {
|
|
371507
|
-
p4.log.message(
|
|
372989
|
+
p4.log.message(dim6(" Run 'swarm claude init' to create .claude/ config"));
|
|
371508
372990
|
}
|
|
371509
372991
|
}
|
|
371510
372992
|
const totalFiles = stats.created + stats.updated + stats.unchanged;
|
|
@@ -371634,7 +373116,7 @@ async function claudeInstall() {
|
|
|
371634
373116
|
}
|
|
371635
373117
|
symlinkSync(pluginRoot, pluginPath);
|
|
371636
373118
|
p4.log.success(`Linked ${CLAUDE_PLUGIN_NAME} \u2192 ${pluginRoot}`);
|
|
371637
|
-
p4.log.message(
|
|
373119
|
+
p4.log.message(dim6(" Claude Code will auto-launch MCP from .mcp.json"));
|
|
371638
373120
|
p4.outro("Claude plugin installed");
|
|
371639
373121
|
}
|
|
371640
373122
|
async function claudeUninstall() {
|
|
@@ -371690,7 +373172,7 @@ async function claudeInit() {
|
|
|
371690
373172
|
const content = readFileSync21(lspSourcePath, "utf-8");
|
|
371691
373173
|
writeFileWithStatus(lspDestPath, content, "LSP config");
|
|
371692
373174
|
}
|
|
371693
|
-
p4.log.message(
|
|
373175
|
+
p4.log.message(dim6(" Uses ${CLAUDE_PLUGIN_ROOT} in MCP config"));
|
|
371694
373176
|
p4.outro("Claude project config ready");
|
|
371695
373177
|
}
|
|
371696
373178
|
async function claudeSessionStart() {
|
|
@@ -372093,17 +373575,17 @@ async function showWorkerCompliance() {
|
|
|
372093
373575
|
ORDER BY count DESC`;
|
|
372094
373576
|
const toolResult = await executeQueryCLI(projectPath, toolUsageSql);
|
|
372095
373577
|
const rows = toolResult.rows;
|
|
372096
|
-
console.log(
|
|
372097
|
-
console.log(
|
|
373578
|
+
console.log(yellow5(BANNER));
|
|
373579
|
+
console.log(cyan5(`
|
|
372098
373580
|
\uD83D\uDCCA Worker Tool Usage (Last 7 Days)
|
|
372099
373581
|
`));
|
|
372100
373582
|
if (rows.length === 0) {
|
|
372101
|
-
console.log(
|
|
372102
|
-
console.log(
|
|
373583
|
+
console.log(dim6("No worker tool usage data found."));
|
|
373584
|
+
console.log(dim6("Data is collected when workers run with the Claude Code plugin."));
|
|
372103
373585
|
return;
|
|
372104
373586
|
}
|
|
372105
|
-
console.log(
|
|
372106
|
-
console.log(
|
|
373587
|
+
console.log(dim6("Tool Calls Sessions"));
|
|
373588
|
+
console.log(dim6("\u2500".repeat(45)));
|
|
372107
373589
|
for (const row of rows) {
|
|
372108
373590
|
const tool5 = String(row.tool).padEnd(22);
|
|
372109
373591
|
const count11 = String(row.count).padStart(6);
|
|
@@ -372119,21 +373601,21 @@ async function showWorkerCompliance() {
|
|
|
372119
373601
|
const finds = Number(hivemindFinds?.count || 0);
|
|
372120
373602
|
if (completes > 0) {
|
|
372121
373603
|
const rate = Math.round(Math.min(finds, completes) / completes * 100);
|
|
372122
|
-
console.log(
|
|
373604
|
+
console.log(dim6(`
|
|
372123
373605
|
\u2500`.repeat(45)));
|
|
372124
373606
|
console.log(`
|
|
372125
|
-
${
|
|
373607
|
+
${green5("Hivemind compliance rate:")} ${rate}% (${finds} queries / ${completes} completions)`);
|
|
372126
373608
|
}
|
|
372127
373609
|
} catch (error56) {
|
|
372128
373610
|
const msg = error56 instanceof Error ? error56.message : String(error56);
|
|
372129
373611
|
if (msg.includes("no such table")) {
|
|
372130
|
-
console.log(
|
|
372131
|
-
console.log(
|
|
373612
|
+
console.log(yellow5(BANNER));
|
|
373613
|
+
console.log(cyan5(`
|
|
372132
373614
|
\uD83D\uDCCA Worker Tool Usage
|
|
372133
373615
|
`));
|
|
372134
|
-
console.log(
|
|
372135
|
-
console.log(
|
|
372136
|
-
console.log(
|
|
373616
|
+
console.log(dim6("No tracking data yet."));
|
|
373617
|
+
console.log(dim6("Compliance tracking starts when workers run with the Claude Code plugin hooks."));
|
|
373618
|
+
console.log(dim6(`
|
|
372137
373619
|
The swarm_events table will be created on first tracked tool call.`));
|
|
372138
373620
|
} else {
|
|
372139
373621
|
console.error("Error fetching compliance data:", msg);
|
|
@@ -372237,7 +373719,7 @@ async function init3() {
|
|
|
372237
373719
|
if (!existsSync37(skillsPath)) {
|
|
372238
373720
|
mkdirSync13(skillsPath, { recursive: true });
|
|
372239
373721
|
p4.log.success("Created " + skillsPath + "/");
|
|
372240
|
-
p4.log.message(
|
|
373722
|
+
p4.log.message(dim6(" Add SKILL.md files here for project-specific skills"));
|
|
372241
373723
|
} else {
|
|
372242
373724
|
p4.log.warn(skillsPath + "/ already exists");
|
|
372243
373725
|
}
|
|
@@ -372251,15 +373733,15 @@ async function init3() {
|
|
|
372251
373733
|
}
|
|
372252
373734
|
}
|
|
372253
373735
|
async function version8() {
|
|
372254
|
-
console.log(
|
|
372255
|
-
console.log(
|
|
373736
|
+
console.log(yellow5(BANNER));
|
|
373737
|
+
console.log(dim6(" " + TAGLINE));
|
|
372256
373738
|
console.log();
|
|
372257
373739
|
console.log(" Version: " + VERSION6);
|
|
372258
373740
|
console.log(" Docs: https://github.com/joelhooks/swarm-tools");
|
|
372259
373741
|
console.log();
|
|
372260
|
-
console.log(
|
|
372261
|
-
console.log(" swarm setup " +
|
|
372262
|
-
console.log(" swarm doctor " +
|
|
373742
|
+
console.log(cyan5(" Get started:"));
|
|
373743
|
+
console.log(" swarm setup " + dim6("Configure OpenCode integration"));
|
|
373744
|
+
console.log(" swarm doctor " + dim6("Check dependencies"));
|
|
372263
373745
|
console.log();
|
|
372264
373746
|
const updateInfo5 = await checkForUpdates();
|
|
372265
373747
|
if (updateInfo5)
|
|
@@ -372274,10 +373756,10 @@ function config8() {
|
|
|
372274
373756
|
const workerAgentPath = join57(agentDir, "swarm-worker.md");
|
|
372275
373757
|
const researcherAgentPath = join57(agentDir, "swarm-researcher.md");
|
|
372276
373758
|
const globalSkillsPath = join57(configDir, "skill");
|
|
372277
|
-
console.log(
|
|
372278
|
-
console.log(
|
|
373759
|
+
console.log(yellow5(BANNER));
|
|
373760
|
+
console.log(dim6(" " + TAGLINE + " v" + VERSION6));
|
|
372279
373761
|
console.log();
|
|
372280
|
-
console.log(
|
|
373762
|
+
console.log(cyan5("Config Files:"));
|
|
372281
373763
|
console.log();
|
|
372282
373764
|
const files = [
|
|
372283
373765
|
{ path: pluginPath, desc: "Plugin loader", emoji: "\uD83D\uDD0C" },
|
|
@@ -372291,43 +373773,43 @@ function config8() {
|
|
|
372291
373773
|
const status4 = exists9 ? "\u2713" : "\u2717";
|
|
372292
373774
|
const color = exists9 ? "\x1B[32m" : "\x1B[31m";
|
|
372293
373775
|
console.log(` ${emoji4} ${desc3}`);
|
|
372294
|
-
console.log(` ${color}${status4}\x1B[0m ${
|
|
373776
|
+
console.log(` ${color}${status4}\x1B[0m ${dim6(path4)}`);
|
|
372295
373777
|
console.log();
|
|
372296
373778
|
}
|
|
372297
|
-
console.log(
|
|
373779
|
+
console.log(cyan5("Skills:"));
|
|
372298
373780
|
console.log();
|
|
372299
373781
|
const globalSkillsExists = existsSync37(globalSkillsPath);
|
|
372300
373782
|
const globalStatus = globalSkillsExists ? "\u2713" : "\u2717";
|
|
372301
373783
|
const globalColor = globalSkillsExists ? "\x1B[32m" : "\x1B[31m";
|
|
372302
373784
|
console.log(` \uD83D\uDCDA Global skills directory`);
|
|
372303
|
-
console.log(` ${globalColor}${globalStatus}\x1B[0m ${
|
|
373785
|
+
console.log(` ${globalColor}${globalStatus}\x1B[0m ${dim6(globalSkillsPath)}`);
|
|
372304
373786
|
if (globalSkillsExists) {
|
|
372305
373787
|
try {
|
|
372306
373788
|
const { readdirSync: readdirSync6 } = __require("fs");
|
|
372307
373789
|
const skills = readdirSync6(globalSkillsPath, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
|
|
372308
373790
|
if (skills.length > 0) {
|
|
372309
|
-
console.log(` ${
|
|
373791
|
+
console.log(` ${dim6(`Found ${skills.length} skill(s): ${skills.join(", ")}`)}`);
|
|
372310
373792
|
}
|
|
372311
373793
|
} catch {}
|
|
372312
373794
|
}
|
|
372313
373795
|
console.log();
|
|
372314
|
-
console.log(` \uD83D\uDCC1 Project skills locations ${
|
|
372315
|
-
console.log(` ${
|
|
372316
|
-
console.log(` ${
|
|
372317
|
-
console.log(` ${
|
|
373796
|
+
console.log(` \uD83D\uDCC1 Project skills locations ${dim6("(checked in order)")}`);
|
|
373797
|
+
console.log(` ${dim6(".opencode/skill/")}`);
|
|
373798
|
+
console.log(` ${dim6(".claude/skills/")}`);
|
|
373799
|
+
console.log(` ${dim6("skill/")}`);
|
|
372318
373800
|
console.log();
|
|
372319
373801
|
const bundledSkillsPath = join57(__dirname2, "..", "global-skills");
|
|
372320
373802
|
if (existsSync37(bundledSkillsPath)) {
|
|
372321
373803
|
try {
|
|
372322
373804
|
const { readdirSync: readdirSync6 } = __require("fs");
|
|
372323
373805
|
const bundled = readdirSync6(bundledSkillsPath, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
|
|
372324
|
-
console.log(` \uD83C\uDF81 Bundled skills ${
|
|
372325
|
-
console.log(` ${
|
|
373806
|
+
console.log(` \uD83C\uDF81 Bundled skills ${dim6("(always available)")}`);
|
|
373807
|
+
console.log(` ${dim6(bundled.join(", "))}`);
|
|
372326
373808
|
console.log();
|
|
372327
373809
|
} catch {}
|
|
372328
373810
|
}
|
|
372329
|
-
console.log(
|
|
372330
|
-
console.log(
|
|
373811
|
+
console.log(dim6("Edit these files to customize swarm behavior."));
|
|
373812
|
+
console.log(dim6("Run 'swarm setup' to regenerate defaults."));
|
|
372331
373813
|
console.log();
|
|
372332
373814
|
}
|
|
372333
373815
|
async function update28() {
|
|
@@ -372339,7 +373821,7 @@ async function update28() {
|
|
|
372339
373821
|
s.stop("Failed to check for updates");
|
|
372340
373822
|
p4.log.error("Could not reach npm registry");
|
|
372341
373823
|
p4.outro("Try again later or update manually:");
|
|
372342
|
-
console.log(" " +
|
|
373824
|
+
console.log(" " + cyan5("npm install -g " + PACKAGE_NAME + "@latest"));
|
|
372343
373825
|
process.exit(1);
|
|
372344
373826
|
}
|
|
372345
373827
|
if (!updateInfo5.updateAvailable) {
|
|
@@ -372367,7 +373849,7 @@ async function update28() {
|
|
|
372367
373849
|
updateSpinner.stop("Update failed");
|
|
372368
373850
|
p4.log.error("Failed to update via npm");
|
|
372369
373851
|
p4.log.message("Try manually:");
|
|
372370
|
-
console.log(" " +
|
|
373852
|
+
console.log(" " + cyan5("npm install -g " + PACKAGE_NAME + "@latest"));
|
|
372371
373853
|
p4.outro("Update failed");
|
|
372372
373854
|
process.exit(1);
|
|
372373
373855
|
}
|
|
@@ -372455,9 +373937,9 @@ async function dashboard() {
|
|
|
372455
373937
|
p4.intro("swarm dashboard");
|
|
372456
373938
|
const projectPath = process.cwd();
|
|
372457
373939
|
console.clear();
|
|
372458
|
-
console.log(
|
|
372459
|
-
console.log(
|
|
372460
|
-
console.log(
|
|
373940
|
+
console.log(yellow5("=".repeat(60)));
|
|
373941
|
+
console.log(yellow5(" SWARM DASHBOARD"));
|
|
373942
|
+
console.log(yellow5("=".repeat(60)));
|
|
372461
373943
|
console.log();
|
|
372462
373944
|
let iteration = 0;
|
|
372463
373945
|
const refreshLoop = async () => {
|
|
@@ -372466,23 +373948,23 @@ async function dashboard() {
|
|
|
372466
373948
|
process.stdout.write("\x1B[H");
|
|
372467
373949
|
}
|
|
372468
373950
|
const timestamp = new Date().toLocaleTimeString();
|
|
372469
|
-
console.log(
|
|
373951
|
+
console.log(dim6(`Last updated: ${timestamp} (Press Ctrl+C to exit)`));
|
|
372470
373952
|
console.log();
|
|
372471
|
-
console.log(
|
|
373953
|
+
console.log(cyan5("Worker Status:"));
|
|
372472
373954
|
const workers = await getWorkerStatus(projectPath, parsed.epic ? { project_key: parsed.epic } : undefined);
|
|
372473
373955
|
if (workers.length === 0) {
|
|
372474
|
-
console.log(
|
|
373956
|
+
console.log(dim6(" No active workers"));
|
|
372475
373957
|
} else {
|
|
372476
373958
|
for (const w of workers) {
|
|
372477
373959
|
console.log(` ${w.agent_name} - ${w.status} - ${w.current_task || "idle"}`);
|
|
372478
373960
|
}
|
|
372479
373961
|
}
|
|
372480
373962
|
console.log();
|
|
372481
|
-
console.log(
|
|
373963
|
+
console.log(cyan5("Subtask Progress:"));
|
|
372482
373964
|
if (parsed.epic) {
|
|
372483
373965
|
const progress = await getSubtaskProgress(projectPath, parsed.epic);
|
|
372484
373966
|
if (progress.length === 0) {
|
|
372485
|
-
console.log(
|
|
373967
|
+
console.log(dim6(" No subtasks"));
|
|
372486
373968
|
} else {
|
|
372487
373969
|
for (const p5 of progress) {
|
|
372488
373970
|
const bar = "\u2588".repeat(Math.floor(p5.progress_percent / 10)) + "\u2591".repeat(10 - Math.floor(p5.progress_percent / 10));
|
|
@@ -372490,23 +373972,23 @@ async function dashboard() {
|
|
|
372490
373972
|
}
|
|
372491
373973
|
}
|
|
372492
373974
|
} else {
|
|
372493
|
-
console.log(
|
|
373975
|
+
console.log(dim6(" No epic specified (use --epic <id>)"));
|
|
372494
373976
|
}
|
|
372495
373977
|
console.log();
|
|
372496
|
-
console.log(
|
|
373978
|
+
console.log(cyan5("File Locks:"));
|
|
372497
373979
|
const locks = await getFileLocks(projectPath);
|
|
372498
373980
|
if (locks.length === 0) {
|
|
372499
|
-
console.log(
|
|
373981
|
+
console.log(dim6(" No active locks"));
|
|
372500
373982
|
} else {
|
|
372501
373983
|
for (const lock4 of locks) {
|
|
372502
373984
|
console.log(` ${lock4.path} - ${lock4.agent_name}`);
|
|
372503
373985
|
}
|
|
372504
373986
|
}
|
|
372505
373987
|
console.log();
|
|
372506
|
-
console.log(
|
|
373988
|
+
console.log(cyan5("Recent Messages:"));
|
|
372507
373989
|
const messages = await getRecentMessages(projectPath, { limit: 5, thread_id: parsed.epic });
|
|
372508
373990
|
if (messages.length === 0) {
|
|
372509
|
-
console.log(
|
|
373991
|
+
console.log(dim6(" No recent messages"));
|
|
372510
373992
|
} else {
|
|
372511
373993
|
for (const msg of messages) {
|
|
372512
373994
|
const timeAgo = Math.floor((Date.now() - new Date(msg.timestamp).getTime()) / 1000);
|
|
@@ -372517,7 +373999,7 @@ async function dashboard() {
|
|
|
372517
373999
|
console.log();
|
|
372518
374000
|
iteration++;
|
|
372519
374001
|
} catch (error56) {
|
|
372520
|
-
console.log(
|
|
374002
|
+
console.log(red4("Dashboard error: " + (error56 instanceof Error ? error56.message : String(error56))));
|
|
372521
374003
|
}
|
|
372522
374004
|
};
|
|
372523
374005
|
await refreshLoop();
|
|
@@ -372599,7 +374081,7 @@ async function replay() {
|
|
|
372599
374081
|
process.exit(0);
|
|
372600
374082
|
}
|
|
372601
374083
|
p4.log.success(`Found ${events.length} events`);
|
|
372602
|
-
p4.log.message(
|
|
374084
|
+
p4.log.message(dim6(`Speed: ${parsed.speed === Infinity ? "instant" : `${parsed.speed}x`}`));
|
|
372603
374085
|
console.log();
|
|
372604
374086
|
await replayWithTiming(events, parsed.speed, (event) => {
|
|
372605
374087
|
console.log(formatReplayEvent(event));
|
|
@@ -372672,16 +374154,22 @@ async function treeCommand() {
|
|
|
372672
374154
|
await tree(args5);
|
|
372673
374155
|
}
|
|
372674
374156
|
async function help() {
|
|
372675
|
-
console.log(
|
|
372676
|
-
console.log(
|
|
374157
|
+
console.log(yellow5(BANNER));
|
|
374158
|
+
console.log(dim6(" " + TAGLINE + " v" + VERSION6));
|
|
372677
374159
|
console.log(getDecoratedBee());
|
|
372678
|
-
console.log(
|
|
374160
|
+
console.log(magenta2(" " + getRandomMessage()));
|
|
372679
374161
|
console.log(`
|
|
372680
|
-
${
|
|
374162
|
+
${cyan5("Commands:")}
|
|
374163
|
+
swarm Status dashboard (default when no subcommand)
|
|
374164
|
+
swarm status Status dashboard (same as running swarm with no args)
|
|
374165
|
+
--json Machine-readable JSON output
|
|
372681
374166
|
swarm setup Interactive installer - checks and installs dependencies
|
|
372682
374167
|
--reinstall, -r Skip prompt, go straight to reinstall
|
|
372683
374168
|
--yes, -y Non-interactive with defaults (opus/sonnet/haiku)
|
|
372684
374169
|
swarm doctor Health check - shows status of all dependencies
|
|
374170
|
+
--deep Deep DB health checks (integrity, orphans, cycles, zombies)
|
|
374171
|
+
--deep --fix Auto-repair fixable issues
|
|
374172
|
+
--deep --json Machine-readable JSON output
|
|
372685
374173
|
swarm init Initialize beads in current project
|
|
372686
374174
|
swarm config Show paths to generated config files
|
|
372687
374175
|
swarm claude Claude Code integration (path/install/uninstall/init/hooks)
|
|
@@ -372711,12 +374199,12 @@ ${cyan3("Commands:")}
|
|
|
372711
374199
|
swarm tool Execute a tool (for plugin wrapper)
|
|
372712
374200
|
swarm help Show this help
|
|
372713
374201
|
|
|
372714
|
-
${
|
|
374202
|
+
${cyan5("Tool Execution:")}
|
|
372715
374203
|
swarm tool --list List all available tools
|
|
372716
374204
|
swarm tool <name> Execute tool with no args
|
|
372717
374205
|
swarm tool <name> --json '<args>' Execute tool with JSON args
|
|
372718
374206
|
|
|
372719
|
-
${
|
|
374207
|
+
${cyan5("Cell Management:")}
|
|
372720
374208
|
swarm cells List cells from database (default: 20 most recent)
|
|
372721
374209
|
swarm cells <id> Get single cell by ID or partial hash
|
|
372722
374210
|
swarm cells --status <status> Filter by status (open, in_progress, closed, blocked)
|
|
@@ -372724,7 +374212,7 @@ ${cyan3("Cell Management:")}
|
|
|
372724
374212
|
swarm cells --ready Show next ready (unblocked) cell
|
|
372725
374213
|
swarm cells --json Raw JSON output (array, no wrapper)
|
|
372726
374214
|
|
|
372727
|
-
${
|
|
374215
|
+
${cyan5("Memory Management (Hivemind):")}
|
|
372728
374216
|
swarm memory store <info> [--tags <tags>] Store a learning/memory
|
|
372729
374217
|
swarm memory find <query> [--limit <n>] Search all memories (semantic + FTS)
|
|
372730
374218
|
swarm memory get <id> Get specific memory by ID
|
|
@@ -372735,7 +374223,7 @@ ${cyan3("Memory Management (Hivemind):")}
|
|
|
372735
374223
|
swarm memory sync Sync to .hive/memories.jsonl (use hivemind_sync tool)
|
|
372736
374224
|
swarm memory <command> --json Output JSON for all commands
|
|
372737
374225
|
|
|
372738
|
-
${
|
|
374226
|
+
${cyan5("Log Viewing:")}
|
|
372739
374227
|
swarm log Tail recent logs (last 50 lines)
|
|
372740
374228
|
swarm log <module> Filter by module (e.g., compaction)
|
|
372741
374229
|
swarm log --level <level> Filter by level (trace, debug, info, warn, error, fatal)
|
|
@@ -372750,7 +374238,7 @@ ${cyan3("Log Viewing:")}
|
|
|
372750
374238
|
swarm log sessions --type <type> Filter by event type (DECISION, VIOLATION, OUTCOME, COMPACTION)
|
|
372751
374239
|
swarm log sessions --json Raw JSON output for jq
|
|
372752
374240
|
|
|
372753
|
-
${
|
|
374241
|
+
${cyan5("Stats & History:")}
|
|
372754
374242
|
swarm stats Show swarm health metrics powered by swarm-insights (last 7 days)
|
|
372755
374243
|
swarm stats --since 24h Show stats for custom time period
|
|
372756
374244
|
swarm stats --regressions Show eval regressions (>10% score drops)
|
|
@@ -372765,12 +374253,12 @@ ${cyan3("Stats & History:")}
|
|
|
372765
374253
|
swarm history --strategy file-based Filter by decomposition strategy
|
|
372766
374254
|
swarm history --verbose Show detailed subtask information
|
|
372767
374255
|
|
|
372768
|
-
${
|
|
374256
|
+
${cyan5("Eval Commands:")}
|
|
372769
374257
|
swarm eval status [eval-name] Show current phase, thresholds, recent scores
|
|
372770
374258
|
swarm eval history Show eval run history with trends
|
|
372771
374259
|
swarm eval run Execute evals and report results (stub)
|
|
372772
374260
|
|
|
372773
|
-
${
|
|
374261
|
+
${cyan5("Observability Commands:")}
|
|
372774
374262
|
swarm query --sql <query> Execute custom SQL query
|
|
372775
374263
|
swarm query --preset <name> Execute preset query (failed_decompositions, duration_by_strategy, etc)
|
|
372776
374264
|
swarm query --format <fmt> Output format: table (default), csv, json
|
|
@@ -372794,19 +374282,19 @@ ${cyan3("Observability Commands:")}
|
|
|
372794
374282
|
swarm tree --epic <id> Show specific epic subtree
|
|
372795
374283
|
swarm tree --json Output as JSON
|
|
372796
374284
|
|
|
372797
|
-
${
|
|
374285
|
+
${cyan5("Session Management (Chainlink-inspired):")}
|
|
372798
374286
|
swarm session start [--cell <id>] Start new session (shows previous handoff notes)
|
|
372799
374287
|
swarm session end [--notes "..."] End session with handoff notes for next session
|
|
372800
374288
|
swarm session status Show current session info
|
|
372801
374289
|
swarm session history [--limit n] Show session history (default: 10)
|
|
372802
374290
|
|
|
372803
|
-
${
|
|
374291
|
+
${cyan5("Usage in OpenCode:")}
|
|
372804
374292
|
/swarm "Add user authentication with OAuth"
|
|
372805
374293
|
@swarm-planner "Decompose this into parallel tasks"
|
|
372806
374294
|
@swarm-worker "Execute this specific subtask"
|
|
372807
374295
|
@swarm-researcher "Research Next.js caching APIs"
|
|
372808
374296
|
|
|
372809
|
-
${
|
|
374297
|
+
${cyan5("Claude Code:")}
|
|
372810
374298
|
swarm claude path Show bundled Claude plugin path
|
|
372811
374299
|
swarm claude install Symlink plugin into ~/.claude/plugins
|
|
372812
374300
|
swarm claude uninstall Remove Claude plugin symlink
|
|
@@ -372821,15 +374309,15 @@ ${cyan3("Claude Code:")}
|
|
|
372821
374309
|
swarm claude pre-compact Hook: pre-compaction handler
|
|
372822
374310
|
swarm claude session-end Hook: session cleanup
|
|
372823
374311
|
|
|
372824
|
-
${
|
|
374312
|
+
${cyan5("Customization:")}
|
|
372825
374313
|
Edit the generated files to customize behavior:
|
|
372826
|
-
${
|
|
372827
|
-
${
|
|
372828
|
-
${
|
|
372829
|
-
${
|
|
372830
|
-
${
|
|
374314
|
+
${dim6("~/.config/opencode/command/swarm.md")} - /swarm command prompt
|
|
374315
|
+
${dim6("~/.config/opencode/agent/swarm-planner.md")} - @swarm-planner (coordinator)
|
|
374316
|
+
${dim6("~/.config/opencode/agent/swarm-worker.md")} - @swarm-worker (task executor)
|
|
374317
|
+
${dim6("~/.config/opencode/agent/swarm-researcher.md")} - @swarm-researcher (read-only research)
|
|
374318
|
+
${dim6("~/.config/opencode/plugin/swarm.ts")} - Plugin loader
|
|
372831
374319
|
|
|
372832
|
-
${
|
|
374320
|
+
${dim6("Docs: https://github.com/joelhooks/opencode-swarm-plugin")}
|
|
372833
374321
|
`);
|
|
372834
374322
|
const updateInfo5 = await checkForUpdates();
|
|
372835
374323
|
if (updateInfo5)
|
|
@@ -372970,10 +374458,10 @@ async function listTools(jsonOutput = false) {
|
|
|
372970
374458
|
console.log(JSON.stringify(toolList));
|
|
372971
374459
|
return;
|
|
372972
374460
|
}
|
|
372973
|
-
console.log(
|
|
372974
|
-
console.log(
|
|
374461
|
+
console.log(yellow5(BANNER));
|
|
374462
|
+
console.log(dim6(" " + TAGLINE + " v" + VERSION6));
|
|
372975
374463
|
console.log();
|
|
372976
|
-
console.log(
|
|
374464
|
+
console.log(cyan5("Available tools:") + ` (${tools.length} total)`);
|
|
372977
374465
|
console.log();
|
|
372978
374466
|
const groups = {};
|
|
372979
374467
|
for (const tool5 of tools) {
|
|
@@ -372983,23 +374471,23 @@ async function listTools(jsonOutput = false) {
|
|
|
372983
374471
|
groups[prefix].push(tool5);
|
|
372984
374472
|
}
|
|
372985
374473
|
for (const [prefix, toolList] of Object.entries(groups)) {
|
|
372986
|
-
console.log(
|
|
374474
|
+
console.log(green5(` ${prefix}:`));
|
|
372987
374475
|
for (const t of toolList) {
|
|
372988
374476
|
console.log(` ${t}`);
|
|
372989
374477
|
}
|
|
372990
374478
|
console.log();
|
|
372991
374479
|
}
|
|
372992
|
-
console.log(
|
|
372993
|
-
console.log(
|
|
372994
|
-
console.log(
|
|
374480
|
+
console.log(dim6("Usage: swarm tool <name> [--json '<args>']"));
|
|
374481
|
+
console.log(dim6("Example: swarm tool hive_ready"));
|
|
374482
|
+
console.log(dim6(`Example: swarm tool hive_create --json '{"title": "Fix bug"}'`));
|
|
372995
374483
|
}
|
|
372996
374484
|
async function agents(nonInteractive = false) {
|
|
372997
374485
|
const home = process.env.HOME || process.env.USERPROFILE || "~";
|
|
372998
374486
|
const agentsPath = join57(home, ".config", "opencode", "AGENTS.md");
|
|
372999
|
-
p4.intro(
|
|
374487
|
+
p4.intro(yellow5(BANNER));
|
|
373000
374488
|
if (!existsSync37(agentsPath)) {
|
|
373001
374489
|
p4.log.warn("No AGENTS.md found at " + agentsPath);
|
|
373002
|
-
p4.log.message(
|
|
374490
|
+
p4.log.message(dim6("Create one first, then run this command to add skill awareness"));
|
|
373003
374491
|
p4.outro("Aborted");
|
|
373004
374492
|
return;
|
|
373005
374493
|
}
|
|
@@ -373099,7 +374587,7 @@ async function createBackup(type4 = "manual") {
|
|
|
373099
374587
|
const now4 = new Date;
|
|
373100
374588
|
const backupPath = getBackupPath(type4, now4);
|
|
373101
374589
|
try {
|
|
373102
|
-
|
|
374590
|
+
execSync3(`sqlite3 "${SWARM_DB_PATH}" ".backup '${backupPath}'"`, {
|
|
373103
374591
|
encoding: "utf-8",
|
|
373104
374592
|
timeout: 60000
|
|
373105
374593
|
});
|
|
@@ -373148,7 +374636,7 @@ function rotateBackups() {
|
|
|
373148
374636
|
}
|
|
373149
374637
|
async function verifyBackup(backupPath) {
|
|
373150
374638
|
try {
|
|
373151
|
-
const result =
|
|
374639
|
+
const result = execSync3(`sqlite3 "${backupPath}" "SELECT COUNT(*) FROM events;"`, {
|
|
373152
374640
|
encoding: "utf-8",
|
|
373153
374641
|
timeout: 1e4
|
|
373154
374642
|
});
|
|
@@ -373187,13 +374675,13 @@ async function backup(action) {
|
|
|
373187
374675
|
return;
|
|
373188
374676
|
}
|
|
373189
374677
|
console.log(`
|
|
373190
|
-
${
|
|
374678
|
+
${cyan5("Backups")} (${BACKUP_DIR}):
|
|
373191
374679
|
`);
|
|
373192
374680
|
for (const b of backups) {
|
|
373193
374681
|
const age = Math.round((Date.now() - b.timestamp.getTime()) / 1000 / 60);
|
|
373194
374682
|
const ageStr = age < 60 ? `${age}m ago` : age < 1440 ? `${Math.round(age / 60)}h ago` : `${Math.round(age / 1440)}d ago`;
|
|
373195
374683
|
const sizeStr = `${(b.size / 1024).toFixed(1)} KB`;
|
|
373196
|
-
console.log(` ${
|
|
374684
|
+
console.log(` ${dim6(b.type.padEnd(8))} ${basename9(b.path)} ${dim6(`(${sizeStr}, ${ageStr})`)}`);
|
|
373197
374685
|
}
|
|
373198
374686
|
console.log("");
|
|
373199
374687
|
break;
|
|
@@ -373217,10 +374705,10 @@ Verifying ${backups.length} backups...
|
|
|
373217
374705
|
for (const b of backups) {
|
|
373218
374706
|
const valid = await verifyBackup(b.path);
|
|
373219
374707
|
if (valid) {
|
|
373220
|
-
console.log(` ${
|
|
374708
|
+
console.log(` ${green5("\u2713")} ${basename9(b.path)}`);
|
|
373221
374709
|
passed++;
|
|
373222
374710
|
} else {
|
|
373223
|
-
console.log(` ${
|
|
374711
|
+
console.log(` ${red4("\u2717")} ${basename9(b.path)}`);
|
|
373224
374712
|
failed++;
|
|
373225
374713
|
}
|
|
373226
374714
|
}
|
|
@@ -373264,22 +374752,22 @@ Available backups:`);
|
|
|
373264
374752
|
case "help":
|
|
373265
374753
|
default:
|
|
373266
374754
|
console.log(`
|
|
373267
|
-
${
|
|
374755
|
+
${cyan5("swarm backup")} - Database backup management
|
|
373268
374756
|
|
|
373269
|
-
${
|
|
374757
|
+
${bold3("Commands:")}
|
|
373270
374758
|
create Create a new backup (default)
|
|
373271
374759
|
list List all backups
|
|
373272
374760
|
rotate Rotate old backups based on retention policy
|
|
373273
374761
|
verify Verify all backups are valid
|
|
373274
374762
|
restore Restore from a backup file
|
|
373275
374763
|
|
|
373276
|
-
${
|
|
374764
|
+
${bold3("Retention Policy:")}
|
|
373277
374765
|
Hourly: 24 backups
|
|
373278
374766
|
Daily: 7 backups
|
|
373279
374767
|
Weekly: 4 backups
|
|
373280
374768
|
Manual: 10 backups
|
|
373281
374769
|
|
|
373282
|
-
${
|
|
374770
|
+
${bold3("Examples:")}
|
|
373283
374771
|
swarm backup # Create a manual backup
|
|
373284
374772
|
swarm backup list # List all backups
|
|
373285
374773
|
swarm backup restore latest.db # Restore from a backup
|
|
@@ -373356,9 +374844,9 @@ async function migrate() {
|
|
|
373356
374844
|
if (stat5.migrated > 0 || stat5.skipped > 0 || stat5.failed > 0) {
|
|
373357
374845
|
const parts5 = [];
|
|
373358
374846
|
if (stat5.migrated > 0)
|
|
373359
|
-
parts5.push(
|
|
374847
|
+
parts5.push(green5(`${stat5.migrated} migrated`));
|
|
373360
374848
|
if (stat5.skipped > 0)
|
|
373361
|
-
parts5.push(
|
|
374849
|
+
parts5.push(dim6(`${stat5.skipped} skipped`));
|
|
373362
374850
|
if (stat5.failed > 0)
|
|
373363
374851
|
parts5.push(`\x1B[31m${stat5.failed} failed\x1B[0m`);
|
|
373364
374852
|
p4.log.message(` ${label}: ${parts5.join(", ")}`);
|
|
@@ -373425,14 +374913,14 @@ async function cells3() {
|
|
|
373425
374913
|
statusFilter = args5[++i];
|
|
373426
374914
|
if (!["open", "in_progress", "closed", "blocked"].includes(statusFilter)) {
|
|
373427
374915
|
p4.log.error(`Invalid status: ${statusFilter}`);
|
|
373428
|
-
p4.log.message(
|
|
374916
|
+
p4.log.message(dim6(" Valid statuses: open, in_progress, closed, blocked"));
|
|
373429
374917
|
process.exit(1);
|
|
373430
374918
|
}
|
|
373431
374919
|
} else if (arg === "--type" && i + 1 < args5.length) {
|
|
373432
374920
|
typeFilter = args5[++i];
|
|
373433
374921
|
if (!["task", "bug", "feature", "epic", "chore"].includes(typeFilter)) {
|
|
373434
374922
|
p4.log.error(`Invalid type: ${typeFilter}`);
|
|
373435
|
-
p4.log.message(
|
|
374923
|
+
p4.log.message(dim6(" Valid types: task, bug, feature, epic, chore"));
|
|
373436
374924
|
process.exit(1);
|
|
373437
374925
|
}
|
|
373438
374926
|
} else if (arg === "--ready") {
|
|
@@ -373574,14 +375062,14 @@ async function dbRepair() {
|
|
|
373574
375062
|
p4.log.message(` - ${result.expiredReservations} expired unreleased reservations`);
|
|
373575
375063
|
}
|
|
373576
375064
|
if (result.totalCleaned === 0) {
|
|
373577
|
-
p4.outro(
|
|
375065
|
+
p4.outro(green5("\u2713 Database is clean! No records to delete."));
|
|
373578
375066
|
return;
|
|
373579
375067
|
}
|
|
373580
375068
|
console.log();
|
|
373581
|
-
p4.log.message(
|
|
375069
|
+
p4.log.message(dim6(`Total: ${result.totalCleaned} records ${dryRun ? "would be" : "will be"} cleaned`));
|
|
373582
375070
|
console.log();
|
|
373583
375071
|
if (dryRun) {
|
|
373584
|
-
p4.outro(
|
|
375072
|
+
p4.outro(dim6("Run without --dry-run to execute cleanup"));
|
|
373585
375073
|
return;
|
|
373586
375074
|
}
|
|
373587
375075
|
const confirmed = await p4.confirm({
|
|
@@ -373596,7 +375084,7 @@ async function dbRepair() {
|
|
|
373596
375084
|
cleanupSpinner.start("Cleaning database...");
|
|
373597
375085
|
await runDbRepair({ dryRun: false });
|
|
373598
375086
|
cleanupSpinner.stop("Cleanup complete");
|
|
373599
|
-
p4.outro(
|
|
375087
|
+
p4.outro(green5(`\u2713 Successfully cleaned ${result.totalCleaned} records`));
|
|
373600
375088
|
} catch (error56) {
|
|
373601
375089
|
s.stop("Error");
|
|
373602
375090
|
p4.log.error(error56 instanceof Error ? error56.message : String(error56));
|
|
@@ -373615,65 +375103,65 @@ async function db() {
|
|
|
373615
375103
|
const dbPath = getDatabasePath3(projectPath);
|
|
373616
375104
|
const dbDir = dirname13(dbPath.replace("file:", ""));
|
|
373617
375105
|
const dbFile = dbPath.replace("file:", "");
|
|
373618
|
-
console.log(
|
|
373619
|
-
console.log(
|
|
375106
|
+
console.log(yellow5(BANNER));
|
|
375107
|
+
console.log(dim6(` ${TAGLINE}
|
|
373620
375108
|
`));
|
|
373621
|
-
console.log(
|
|
375109
|
+
console.log(cyan5(` Database Info
|
|
373622
375110
|
`));
|
|
373623
|
-
console.log(` ${
|
|
373624
|
-
console.log(` ${
|
|
373625
|
-
console.log(` ${
|
|
373626
|
-
console.log(` ${
|
|
373627
|
-
console.log(` ${
|
|
375111
|
+
console.log(` ${dim6("Project:")} ${projectPath}`);
|
|
375112
|
+
console.log(` ${dim6("Project Name:")} ${projectName}`);
|
|
375113
|
+
console.log(` ${dim6("Hash:")} ${hash5}`);
|
|
375114
|
+
console.log(` ${dim6("DB Directory:")} ${dbDir}`);
|
|
375115
|
+
console.log(` ${dim6("DB File:")} ${dbFile}`);
|
|
373628
375116
|
console.log();
|
|
373629
375117
|
if (existsSync37(dbFile)) {
|
|
373630
375118
|
const stats = statSync5(dbFile);
|
|
373631
375119
|
const sizeKB = Math.round(stats.size / 1024);
|
|
373632
|
-
console.log(` ${
|
|
375120
|
+
console.log(` ${green5("\u2713")} Database exists (${sizeKB} KB)`);
|
|
373633
375121
|
try {
|
|
373634
|
-
const schema =
|
|
375122
|
+
const schema = execSync3(`sqlite3 "${dbFile}" "SELECT sql FROM sqlite_master WHERE type='table' AND name='beads'"`, { encoding: "utf-8" }).trim();
|
|
373635
375123
|
if (schema) {
|
|
373636
375124
|
const hasProjectKey = schema.includes("project_key");
|
|
373637
375125
|
if (hasProjectKey) {
|
|
373638
|
-
console.log(` ${
|
|
375126
|
+
console.log(` ${green5("\u2713")} Schema is correct (has project_key)`);
|
|
373639
375127
|
} else {
|
|
373640
375128
|
console.log(` \x1B[31m\u2717\x1B[0m Schema is OLD (missing project_key)`);
|
|
373641
375129
|
console.log();
|
|
373642
|
-
console.log(
|
|
373643
|
-
console.log(
|
|
375130
|
+
console.log(dim6(" To fix: delete the database and restart OpenCode"));
|
|
375131
|
+
console.log(dim6(` rm -r "${dbDir}"`));
|
|
373644
375132
|
}
|
|
373645
375133
|
} else {
|
|
373646
|
-
console.log(` ${
|
|
375134
|
+
console.log(` ${dim6("\u25CB")} No beads table yet (will be created on first use)`);
|
|
373647
375135
|
}
|
|
373648
375136
|
try {
|
|
373649
|
-
const version4 =
|
|
375137
|
+
const version4 = execSync3(`sqlite3 "${dbFile}" "SELECT MAX(version) FROM schema_version"`, { encoding: "utf-8" }).trim();
|
|
373650
375138
|
if (version4 && version4 !== "") {
|
|
373651
|
-
console.log(` ${
|
|
375139
|
+
console.log(` ${dim6("\u25CB")} Schema version: ${version4}`);
|
|
373652
375140
|
}
|
|
373653
375141
|
} catch {
|
|
373654
|
-
console.log(` ${
|
|
375142
|
+
console.log(` ${dim6("\u25CB")} No schema_version table`);
|
|
373655
375143
|
}
|
|
373656
375144
|
try {
|
|
373657
|
-
const beadCount =
|
|
373658
|
-
console.log(` ${
|
|
375145
|
+
const beadCount = execSync3(`sqlite3 "${dbFile}" "SELECT COUNT(*) FROM beads"`, { encoding: "utf-8" }).trim();
|
|
375146
|
+
console.log(` ${dim6("\u25CB")} Cells: ${beadCount}`);
|
|
373659
375147
|
} catch {}
|
|
373660
375148
|
try {
|
|
373661
|
-
const memoryCount =
|
|
373662
|
-
console.log(` ${
|
|
375149
|
+
const memoryCount = execSync3(`sqlite3 "${dbFile}" "SELECT COUNT(*) FROM memories"`, { encoding: "utf-8" }).trim();
|
|
375150
|
+
console.log(` ${dim6("\u25CB")} Memories: ${memoryCount}`);
|
|
373663
375151
|
} catch {}
|
|
373664
375152
|
} catch (error56) {
|
|
373665
|
-
console.log(` ${
|
|
375153
|
+
console.log(` ${dim6("\u25CB")} Could not inspect schema (sqlite3 not available)`);
|
|
373666
375154
|
}
|
|
373667
375155
|
} else {
|
|
373668
|
-
console.log(` ${
|
|
373669
|
-
console.log(
|
|
375156
|
+
console.log(` ${dim6("\u25CB")} Database does not exist yet`);
|
|
375157
|
+
console.log(dim6(" Will be created on first use"));
|
|
373670
375158
|
}
|
|
373671
375159
|
console.log();
|
|
373672
375160
|
const pglitePath = join57(dbDir, "streams");
|
|
373673
375161
|
if (existsSync37(pglitePath)) {
|
|
373674
375162
|
console.log(` \x1B[33m!\x1B[0m Legacy PGLite directory exists`);
|
|
373675
|
-
console.log(
|
|
373676
|
-
console.log(
|
|
375163
|
+
console.log(dim6(` ${pglitePath}`));
|
|
375164
|
+
console.log(dim6(" Run 'swarm migrate' to migrate data"));
|
|
373677
375165
|
}
|
|
373678
375166
|
console.log();
|
|
373679
375167
|
}
|
|
@@ -373695,27 +375183,27 @@ function generateSparkline(scores) {
|
|
|
373695
375183
|
}
|
|
373696
375184
|
function formatEvalStatusOutput(status4) {
|
|
373697
375185
|
const phaseEmoji = status4.phase === "bootstrap" ? "\uD83C\uDF31" : status4.phase === "stabilization" ? "\u2699\uFE0F" : "\uD83D\uDE80";
|
|
373698
|
-
const phaseColor = status4.phase === "bootstrap" ?
|
|
373699
|
-
p4.log.step(`${phaseEmoji} Phase: ${phaseColor(
|
|
373700
|
-
p4.log.message(`${
|
|
375186
|
+
const phaseColor = status4.phase === "bootstrap" ? yellow5 : status4.phase === "stabilization" ? cyan5 : green5;
|
|
375187
|
+
p4.log.step(`${phaseEmoji} Phase: ${phaseColor(bold3(status4.phase))}`);
|
|
375188
|
+
p4.log.message(`${dim6("Runs:")} ${status4.runCount}`);
|
|
373701
375189
|
console.log();
|
|
373702
|
-
p4.log.message(
|
|
375190
|
+
p4.log.message(bold3("Gate Thresholds"));
|
|
373703
375191
|
const stabilizationPct = (status4.thresholds.stabilization * 100).toFixed(0);
|
|
373704
375192
|
const productionPct = (status4.thresholds.production * 100).toFixed(0);
|
|
373705
|
-
p4.log.message(` ${
|
|
373706
|
-
p4.log.message(` ${
|
|
375193
|
+
p4.log.message(` ${yellow5("\u26A0")} Stabilization: ${stabilizationPct}% regression ${dim6("(warn)")}`);
|
|
375194
|
+
p4.log.message(` ${red4("\u2717")} Production: ${productionPct}% regression ${dim6("(fail)")}`);
|
|
373707
375195
|
console.log();
|
|
373708
375196
|
if (status4.recentScores.length > 0) {
|
|
373709
|
-
p4.log.message(
|
|
375197
|
+
p4.log.message(bold3("Recent Scores"));
|
|
373710
375198
|
const sparkline = generateSparkline(status4.recentScores.map((s) => s.score));
|
|
373711
|
-
p4.log.message(
|
|
375199
|
+
p4.log.message(cyan5(` ${sparkline}`));
|
|
373712
375200
|
for (const { timestamp, score } of status4.recentScores) {
|
|
373713
375201
|
const time6 = new Date(timestamp).toLocaleString();
|
|
373714
|
-
const scoreColor = score >= 0.8 ?
|
|
373715
|
-
p4.log.message(` ${
|
|
375202
|
+
const scoreColor = score >= 0.8 ? green5 : score >= 0.6 ? yellow5 : red4;
|
|
375203
|
+
p4.log.message(` ${dim6(time6)}: ${scoreColor(score.toFixed(2))}`);
|
|
373716
375204
|
}
|
|
373717
375205
|
} else {
|
|
373718
|
-
p4.log.message(
|
|
375206
|
+
p4.log.message(dim6("No scores yet - collecting data"));
|
|
373719
375207
|
}
|
|
373720
375208
|
}
|
|
373721
375209
|
function formatEvalHistoryOutput(history) {
|
|
@@ -373733,43 +375221,43 @@ function formatEvalHistoryOutput(history) {
|
|
|
373733
375221
|
grouped4.get(entry.eval_name).push(entry);
|
|
373734
375222
|
}
|
|
373735
375223
|
for (const [evalName, entries9] of grouped4) {
|
|
373736
|
-
p4.log.message(
|
|
375224
|
+
p4.log.message(bold3(cyan5(evalName)));
|
|
373737
375225
|
const scores = entries9.map((e) => e.score);
|
|
373738
375226
|
const avgScore = scores.reduce((sum9, s) => sum9 + s, 0) / scores.length;
|
|
373739
375227
|
const sparkline = generateSparkline(scores);
|
|
373740
|
-
const avgColor = avgScore >= 0.8 ?
|
|
373741
|
-
p4.log.message(` ${
|
|
375228
|
+
const avgColor = avgScore >= 0.8 ? green5 : avgScore >= 0.6 ? yellow5 : red4;
|
|
375229
|
+
p4.log.message(` ${cyan5(sparkline)} ${dim6("avg:")} ${avgColor(avgScore.toFixed(2))} ${dim6(`(${entries9.length} runs)`)}`);
|
|
373742
375230
|
const latest = entries9.slice(-5);
|
|
373743
375231
|
for (const entry of latest) {
|
|
373744
375232
|
const time6 = new Date(entry.timestamp).toLocaleTimeString();
|
|
373745
|
-
const scoreColor = entry.score >= 0.8 ?
|
|
373746
|
-
p4.log.message(` ${
|
|
375233
|
+
const scoreColor = entry.score >= 0.8 ? green5 : entry.score >= 0.6 ? yellow5 : red4;
|
|
375234
|
+
p4.log.message(` ${dim6(time6)} ${dim6(`#${entry.run_count}`)} ${scoreColor(entry.score.toFixed(2))}`);
|
|
373747
375235
|
}
|
|
373748
375236
|
if (entries9.length > 5) {
|
|
373749
|
-
p4.log.message(
|
|
375237
|
+
p4.log.message(dim6(` ... and ${entries9.length - 5} more`));
|
|
373750
375238
|
}
|
|
373751
375239
|
console.log();
|
|
373752
375240
|
}
|
|
373753
375241
|
}
|
|
373754
375242
|
function formatEvalRunResultOutput(result) {
|
|
373755
375243
|
if (result.passed) {
|
|
373756
|
-
p4.log.success(
|
|
375244
|
+
p4.log.success(bold3(green5("\u2713 PASS")));
|
|
373757
375245
|
} else {
|
|
373758
|
-
p4.log.error(
|
|
375246
|
+
p4.log.error(bold3(red4("\u2717 FAIL")));
|
|
373759
375247
|
}
|
|
373760
375248
|
console.log();
|
|
373761
|
-
const phaseColor = result.phase === "bootstrap" ?
|
|
373762
|
-
p4.log.message(`${
|
|
373763
|
-
const scoreColor = result.currentScore >= 0.8 ?
|
|
373764
|
-
p4.log.message(`${
|
|
375249
|
+
const phaseColor = result.phase === "bootstrap" ? yellow5 : result.phase === "stabilization" ? cyan5 : green5;
|
|
375250
|
+
p4.log.message(`${dim6("Phase:")} ${phaseColor(result.phase)}`);
|
|
375251
|
+
const scoreColor = result.currentScore >= 0.8 ? green5 : result.currentScore >= 0.6 ? yellow5 : red4;
|
|
375252
|
+
p4.log.message(`${dim6("Score:")} ${bold3(scoreColor(result.currentScore.toFixed(2)))}`);
|
|
373765
375253
|
if (result.baseline !== undefined) {
|
|
373766
|
-
p4.log.message(`${
|
|
375254
|
+
p4.log.message(`${dim6("Baseline:")} ${result.baseline.toFixed(2)}`);
|
|
373767
375255
|
}
|
|
373768
375256
|
if (result.regressionPercent !== undefined) {
|
|
373769
375257
|
const regressionPct = result.regressionPercent * 100;
|
|
373770
375258
|
const sign5 = regressionPct > 0 ? "+" : "";
|
|
373771
|
-
const regressionColor = regressionPct > 5 ?
|
|
373772
|
-
p4.log.message(`${
|
|
375259
|
+
const regressionColor = regressionPct > 5 ? red4 : regressionPct > 0 ? yellow5 : green5;
|
|
375260
|
+
p4.log.message(`${dim6("Regression:")} ${regressionColor(`${sign5}${regressionPct.toFixed(1)}%`)}`);
|
|
373773
375261
|
}
|
|
373774
375262
|
console.log();
|
|
373775
375263
|
p4.log.message(result.message);
|
|
@@ -374131,7 +375619,7 @@ async function evalHistory() {
|
|
|
374131
375619
|
const historyPath = getEvalHistoryPath2(projectPath);
|
|
374132
375620
|
if (!existsSync37(historyPath)) {
|
|
374133
375621
|
p4.log.warn("No eval history found");
|
|
374134
|
-
p4.log.message(
|
|
375622
|
+
p4.log.message(dim6(`Expected: ${historyPath}`));
|
|
374135
375623
|
p4.outro("Run evals to generate history");
|
|
374136
375624
|
return;
|
|
374137
375625
|
}
|
|
@@ -374226,7 +375714,7 @@ async function mcpServe() {
|
|
|
374226
375714
|
if (isInteractive) {
|
|
374227
375715
|
p4.intro("swarm mcp-serve");
|
|
374228
375716
|
p4.log.error("MCP server entrypoint not found");
|
|
374229
|
-
p4.log.message(
|
|
375717
|
+
p4.log.message(dim6(` Looked for: ${candidates.join(", ")}`));
|
|
374230
375718
|
p4.outro("Aborted");
|
|
374231
375719
|
} else {
|
|
374232
375720
|
console.error("[swarm-mcp] Server entrypoint not found");
|
|
@@ -374236,7 +375724,7 @@ async function mcpServe() {
|
|
|
374236
375724
|
if (isInteractive) {
|
|
374237
375725
|
p4.intro("swarm mcp-serve");
|
|
374238
375726
|
p4.log.step("Starting MCP server...");
|
|
374239
|
-
p4.log.message(
|
|
375727
|
+
p4.log.message(dim6(` Using: ${serverPath}`));
|
|
374240
375728
|
}
|
|
374241
375729
|
const proc = spawn("bun", ["run", serverPath], { stdio: "inherit" });
|
|
374242
375730
|
proc.on("close", (exitCode) => {
|
|
@@ -374249,8 +375737,8 @@ async function serve() {
|
|
|
374249
375737
|
const port4 = portFlagIndex !== -1 ? Number.parseInt(process.argv[portFlagIndex + 1]) || 4483 : 4483;
|
|
374250
375738
|
const projectPath = process.cwd();
|
|
374251
375739
|
p4.log.step("Starting DurableStreamServer...");
|
|
374252
|
-
p4.log.message(
|
|
374253
|
-
p4.log.message(
|
|
375740
|
+
p4.log.message(dim6(` Project: ${projectPath}`));
|
|
375741
|
+
p4.log.message(dim6(` Port: ${port4} (HIVE on phone keypad)`));
|
|
374254
375742
|
try {
|
|
374255
375743
|
const swarmMail = await getSwarmMailLibSQL2(projectPath);
|
|
374256
375744
|
const streamAdapter = createDurableStreamAdapter2(swarmMail, projectPath);
|
|
@@ -374265,11 +375753,11 @@ async function serve() {
|
|
|
374265
375753
|
await server.start();
|
|
374266
375754
|
p4.log.success("Server started!");
|
|
374267
375755
|
p4.log.message("");
|
|
374268
|
-
p4.log.message(
|
|
374269
|
-
p4.log.message(
|
|
374270
|
-
p4.log.message(
|
|
375756
|
+
p4.log.message(cyan5(` Dashboard: http://localhost:5173`));
|
|
375757
|
+
p4.log.message(cyan5(` SSE Endpoint: ${server.url}/streams/${encodeURIComponent(projectPath)}`));
|
|
375758
|
+
p4.log.message(cyan5(` Cells API: ${server.url}/cells`));
|
|
374271
375759
|
p4.log.message("");
|
|
374272
|
-
p4.log.message(
|
|
375760
|
+
p4.log.message(dim6(" Press Ctrl+C to stop"));
|
|
374273
375761
|
await new Promise(() => {});
|
|
374274
375762
|
} catch (error56) {
|
|
374275
375763
|
p4.log.error("Failed to start server");
|
|
@@ -374284,8 +375772,8 @@ async function viz() {
|
|
|
374284
375772
|
const port4 = portFlagIndex !== -1 ? Number.parseInt(process.argv[portFlagIndex + 1]) || 4483 : 4483;
|
|
374285
375773
|
const projectPath = process.cwd();
|
|
374286
375774
|
p4.log.step("Starting dashboard server...");
|
|
374287
|
-
p4.log.message(
|
|
374288
|
-
p4.log.message(
|
|
375775
|
+
p4.log.message(dim6(` Project: ${projectPath}`));
|
|
375776
|
+
p4.log.message(dim6(` Port: ${port4}`));
|
|
374289
375777
|
try {
|
|
374290
375778
|
const swarmMail = await getSwarmMailLibSQL2(projectPath);
|
|
374291
375779
|
const streamAdapter = createDurableStreamAdapter2(swarmMail, projectPath);
|
|
@@ -374300,11 +375788,11 @@ async function viz() {
|
|
|
374300
375788
|
await server.start();
|
|
374301
375789
|
p4.log.success("Dashboard server running!");
|
|
374302
375790
|
p4.log.message("");
|
|
374303
|
-
p4.log.message(
|
|
374304
|
-
p4.log.message(
|
|
374305
|
-
p4.log.message(
|
|
375791
|
+
p4.log.message(cyan5(` Dashboard: http://localhost:${port4}`));
|
|
375792
|
+
p4.log.message(cyan5(` SSE endpoint: http://localhost:${port4}/streams/${encodeURIComponent(projectPath)}`));
|
|
375793
|
+
p4.log.message(cyan5(` Cells API: http://localhost:${port4}/cells`));
|
|
374306
375794
|
p4.log.message("");
|
|
374307
|
-
p4.log.message(
|
|
375795
|
+
p4.log.message(dim6(" Press Ctrl+C to stop"));
|
|
374308
375796
|
await new Promise(() => {});
|
|
374309
375797
|
} catch (error56) {
|
|
374310
375798
|
p4.log.error("Failed to start dashboard server");
|
|
@@ -374463,11 +375951,11 @@ async function memory() {
|
|
|
374463
375951
|
} else {
|
|
374464
375952
|
for (const result of results) {
|
|
374465
375953
|
console.log();
|
|
374466
|
-
console.log(
|
|
374467
|
-
console.log(
|
|
375954
|
+
console.log(cyan5(`[${result.memory.id}] Score: ${result.score.toFixed(3)}`));
|
|
375955
|
+
console.log(dim6(` Created: ${new Date(result.memory.createdAt).toLocaleDateString()}`));
|
|
374468
375956
|
console.log(` ${result.memory.content.slice(0, 200)}${result.memory.content.length > 200 ? "..." : ""}`);
|
|
374469
375957
|
if (result.memory.metadata.tags) {
|
|
374470
|
-
console.log(
|
|
375958
|
+
console.log(dim6(` Tags: ${result.memory.metadata.tags.join(", ")}`));
|
|
374471
375959
|
}
|
|
374472
375960
|
}
|
|
374473
375961
|
}
|
|
@@ -374496,14 +375984,14 @@ async function memory() {
|
|
|
374496
375984
|
process.exit(1);
|
|
374497
375985
|
} else {
|
|
374498
375986
|
console.log();
|
|
374499
|
-
console.log(
|
|
375987
|
+
console.log(cyan5("Content:"));
|
|
374500
375988
|
console.log(memory2.content);
|
|
374501
375989
|
console.log();
|
|
374502
|
-
console.log(
|
|
374503
|
-
console.log(
|
|
374504
|
-
console.log(
|
|
375990
|
+
console.log(dim6(`Created: ${new Date(memory2.createdAt).toLocaleDateString()}`));
|
|
375991
|
+
console.log(dim6(`Collection: ${memory2.collection}`));
|
|
375992
|
+
console.log(dim6(`Confidence: ${memory2.confidence ?? 0.7}`));
|
|
374505
375993
|
if (memory2.metadata.tags) {
|
|
374506
|
-
console.log(
|
|
375994
|
+
console.log(dim6(`Tags: ${memory2.metadata.tags.join(", ")}`));
|
|
374507
375995
|
}
|
|
374508
375996
|
p4.outro("Done");
|
|
374509
375997
|
}
|
|
@@ -374547,7 +376035,7 @@ async function memory() {
|
|
|
374547
376035
|
} else {
|
|
374548
376036
|
p4.intro("swarm memory stats");
|
|
374549
376037
|
console.log();
|
|
374550
|
-
console.log(
|
|
376038
|
+
console.log(cyan5("Database Statistics:"));
|
|
374551
376039
|
console.log(` Memories: ${stats2.memories}`);
|
|
374552
376040
|
console.log(` Embeddings: ${stats2.embeddings}`);
|
|
374553
376041
|
p4.outro("Done");
|
|
@@ -374620,8 +376108,14 @@ switch (command) {
|
|
|
374620
376108
|
break;
|
|
374621
376109
|
}
|
|
374622
376110
|
case "doctor": {
|
|
374623
|
-
const
|
|
374624
|
-
|
|
376111
|
+
const deepFlag = process.argv.includes("--deep");
|
|
376112
|
+
if (deepFlag) {
|
|
376113
|
+
const { doctorDeep: doctorDeep2 } = await Promise.resolve().then(() => exports_doctor);
|
|
376114
|
+
await doctorDeep2(process.argv.slice(3));
|
|
376115
|
+
} else {
|
|
376116
|
+
const debugFlag = process.argv.includes("--debug") || process.argv.includes("-d");
|
|
376117
|
+
await doctor(debugFlag);
|
|
376118
|
+
}
|
|
374625
376119
|
break;
|
|
374626
376120
|
}
|
|
374627
376121
|
case "init":
|
|
@@ -374719,6 +376213,9 @@ switch (command) {
|
|
|
374719
376213
|
case "session":
|
|
374720
376214
|
await session();
|
|
374721
376215
|
break;
|
|
376216
|
+
case "status":
|
|
376217
|
+
await status5(process.argv.slice(3));
|
|
376218
|
+
break;
|
|
374722
376219
|
case "version":
|
|
374723
376220
|
case "--version":
|
|
374724
376221
|
case "-v":
|
|
@@ -374730,7 +376227,7 @@ switch (command) {
|
|
|
374730
376227
|
await help();
|
|
374731
376228
|
break;
|
|
374732
376229
|
case undefined:
|
|
374733
|
-
await
|
|
376230
|
+
await status5(process.argv.slice(3));
|
|
374734
376231
|
break;
|
|
374735
376232
|
default:
|
|
374736
376233
|
console.error("Unknown command: " + command);
|