@hasna/recordings 0.1.20 → 0.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -9844,15 +9844,40 @@ function runMigrations(db) {
9844
9844
  const result = db.query("SELECT MAX(id) as max_id FROM _migrations").get();
9845
9845
  const currentLevel = result?.max_id ?? -1;
9846
9846
  for (let i = currentLevel + 1;i < MIGRATIONS.length; i++) {
9847
- db.run(MIGRATIONS[i]);
9848
9847
  try {
9848
+ db.run(MIGRATIONS[i]);
9849
9849
  db.query("INSERT INTO _migrations (id) VALUES (?)").run(i);
9850
9850
  } catch (e) {
9851
+ if (isBenignMigrationError(e)) {
9852
+ db.query("INSERT OR IGNORE INTO _migrations (id) VALUES (?)").run(i);
9853
+ continue;
9854
+ }
9851
9855
  if (!(e instanceof Error && e.message.includes("UNIQUE constraint failed"))) {
9852
9856
  throw e;
9853
9857
  }
9854
9858
  }
9855
9859
  }
9860
+ repairSchemaDrift(db);
9861
+ }
9862
+ function isBenignMigrationError(error) {
9863
+ if (!(error instanceof Error))
9864
+ return false;
9865
+ return error.message.includes("duplicate column name");
9866
+ }
9867
+ function repairSchemaDrift(db) {
9868
+ ensureColumn(db, "recordings", "goal", "TEXT");
9869
+ ensureColumn(db, "recordings", "role", "TEXT");
9870
+ ensureColumn(db, "recordings", "task_list_id", "TEXT");
9871
+ ensureColumn(db, "recordings", "machine_id", "TEXT");
9872
+ ensureColumn(db, "recordings", "metadata", "TEXT DEFAULT '{}'");
9873
+ ensureColumn(db, "agents", "active_project_id", "TEXT REFERENCES projects(id) ON DELETE SET NULL");
9874
+ }
9875
+ function ensureColumn(db, table, column, definition) {
9876
+ const rows = db.query(`PRAGMA table_info(${table})`).all();
9877
+ if (rows.some((row) => row.name === column)) {
9878
+ return;
9879
+ }
9880
+ db.run(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
9856
9881
  }
9857
9882
  function closeDatabase() {
9858
9883
  if (_db) {
@@ -0,0 +1,12 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare const DEFAULT_MCP_HTTP_PORT = 8829;
3
+ export declare const MCP_HTTP_HOST = "127.0.0.1";
4
+ export declare function isHttpMode(args: string[]): boolean;
5
+ export declare function resolveMcpHttpPort(args: string[]): number;
6
+ export declare function handleMcpRequest(req: Request, buildServer: () => McpServer): Promise<Response>;
7
+ export declare function startMcpHttpServer(options: {
8
+ name: string;
9
+ port: number;
10
+ buildServer: () => McpServer;
11
+ }): ReturnType<typeof Bun.serve>;
12
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/mcp/http.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAC1C,eAAO,MAAM,aAAa,cAAc,CAAC;AAEzC,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAElD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAQzD;AAED,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,OAAO,EACZ,WAAW,EAAE,MAAM,SAAS,GAC3B,OAAO,CAAC,QAAQ,CAAC,CAOnB;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,SAAS,CAAC;CAC9B,GAAG,UAAU,CAAC,OAAO,GAAG,CAAC,KAAK,CAAC,CAoB/B"}
@@ -1,3 +1,4 @@
1
1
  #!/usr/bin/env bun
2
- export {};
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ export declare function buildServer(): McpServer;
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgCpE,wBAAgB,WAAW,IAAI,SAAS,CAyevC"}