@hasna/recordings 0.2.7 → 0.2.8
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/cli/index.js +1 -1
- package/dist/db/errors.d.ts +9 -0
- package/dist/db/errors.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/server/index.js +17 -7
- package/dist/server/repo.d.ts +2 -2
- package/dist/server/repo.d.ts.map +1 -1
- package/dist/server/v1.d.ts.map +1 -1
- package/dist/storage.js +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
package/dist/db/errors.d.ts
CHANGED
|
@@ -12,4 +12,13 @@ export declare class ProjectNotFoundError extends Error {
|
|
|
12
12
|
readonly ref: string;
|
|
13
13
|
constructor(ref: string);
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Thrown for invalid client input (missing/blank required fields). Its message
|
|
17
|
+
* is safe to surface to the caller as a clean 400. This is distinct from an
|
|
18
|
+
* unexpected internal/DB error, whose raw text (e.g. a Postgres constraint name)
|
|
19
|
+
* must NEVER be returned to the client.
|
|
20
|
+
*/
|
|
21
|
+
export declare class ValidationError extends Error {
|
|
22
|
+
constructor(message: string);
|
|
23
|
+
}
|
|
15
24
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/db/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/db/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;gBACT,GAAG,EAAE,MAAM;CAKxB"}
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/db/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;gBACT,GAAG,EAAE,MAAM;CAKxB;AAED;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B"}
|
package/dist/index.js
CHANGED
package/dist/mcp/index.js
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -18,7 +18,7 @@ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
|
18
18
|
var __require = import.meta.require;
|
|
19
19
|
|
|
20
20
|
// src/version.ts
|
|
21
|
-
var VERSION = "0.2.
|
|
21
|
+
var VERSION = "0.2.8";
|
|
22
22
|
|
|
23
23
|
// src/db/remote-storage.ts
|
|
24
24
|
import pg from "pg";
|
|
@@ -262,7 +262,7 @@ var init_cloud = __esm(() => {
|
|
|
262
262
|
});
|
|
263
263
|
|
|
264
264
|
// src/db/errors.ts
|
|
265
|
-
var ProjectNotFoundError;
|
|
265
|
+
var ProjectNotFoundError, ValidationError;
|
|
266
266
|
var init_errors = __esm(() => {
|
|
267
267
|
ProjectNotFoundError = class ProjectNotFoundError extends Error {
|
|
268
268
|
ref;
|
|
@@ -272,6 +272,12 @@ var init_errors = __esm(() => {
|
|
|
272
272
|
this.ref = ref;
|
|
273
273
|
}
|
|
274
274
|
};
|
|
275
|
+
ValidationError = class ValidationError extends Error {
|
|
276
|
+
constructor(message) {
|
|
277
|
+
super(message);
|
|
278
|
+
this.name = "ValidationError";
|
|
279
|
+
}
|
|
280
|
+
};
|
|
275
281
|
});
|
|
276
282
|
|
|
277
283
|
// src/server/repo.ts
|
|
@@ -335,7 +341,7 @@ function parseProject(row) {
|
|
|
335
341
|
}
|
|
336
342
|
async function createRecording(pg2, input) {
|
|
337
343
|
if (typeof input.raw_text !== "string" || !input.raw_text) {
|
|
338
|
-
throw new
|
|
344
|
+
throw new ValidationError("raw_text is required");
|
|
339
345
|
}
|
|
340
346
|
const id = shortUuid();
|
|
341
347
|
await pg2.run(`INSERT INTO recordings (id, audio_path, raw_text, processed_text, processing_mode, model_used, enhancement_model, duration_ms, language, tags, agent_id, project_id, session_id, goal, role, task_list_id, machine_id, metadata)
|
|
@@ -423,7 +429,7 @@ async function getRecordingStats(pg2) {
|
|
|
423
429
|
}
|
|
424
430
|
async function registerAgent(pg2, name, description, role) {
|
|
425
431
|
if (!name)
|
|
426
|
-
throw new
|
|
432
|
+
throw new ValidationError("name is required");
|
|
427
433
|
const now = new Date().toISOString();
|
|
428
434
|
const existing = await pg2.get("SELECT * FROM agents WHERE name = ?", name);
|
|
429
435
|
if (existing) {
|
|
@@ -471,7 +477,7 @@ async function setAgentFocus(pg2, idOrName, projectId) {
|
|
|
471
477
|
}
|
|
472
478
|
async function registerProject(pg2, name, path, description) {
|
|
473
479
|
if (!name || !path)
|
|
474
|
-
throw new
|
|
480
|
+
throw new ValidationError("name and path are required");
|
|
475
481
|
const now = new Date().toISOString();
|
|
476
482
|
const existing = await pg2.get("SELECT * FROM projects WHERE path = ?", path);
|
|
477
483
|
if (existing) {
|
|
@@ -501,7 +507,7 @@ async function listProjects(pg2) {
|
|
|
501
507
|
}
|
|
502
508
|
async function saveFeedback(pg2, input) {
|
|
503
509
|
if (typeof input.message !== "string" || !input.message.trim()) {
|
|
504
|
-
throw new
|
|
510
|
+
throw new ValidationError("message is required");
|
|
505
511
|
}
|
|
506
512
|
await pg2.run("INSERT INTO feedback (message, email, category, version) VALUES (?, ?, ?, ?)", input.message, input.email || null, input.category || "general", input.version || null);
|
|
507
513
|
return { saved: true };
|
|
@@ -679,7 +685,11 @@ async function handleV1Request(req, url) {
|
|
|
679
685
|
}
|
|
680
686
|
return error(404, `unknown /v1 resource: ${resource ?? ""}`);
|
|
681
687
|
} catch (e) {
|
|
682
|
-
|
|
688
|
+
if (e instanceof ProjectNotFoundError || e instanceof ValidationError) {
|
|
689
|
+
return error(400, e.message);
|
|
690
|
+
}
|
|
691
|
+
console.error(`[recordings-serve] unhandled ${method} ${path} error:`, e);
|
|
692
|
+
return error(500, "internal server error");
|
|
683
693
|
}
|
|
684
694
|
}
|
|
685
695
|
var JSON_HEADERS;
|
package/dist/server/repo.d.ts
CHANGED
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* stubs — every operation executes real SQL.
|
|
13
13
|
*/
|
|
14
14
|
import type { PgAdapterAsync } from "../db/remote-storage.js";
|
|
15
|
-
import { ProjectNotFoundError } from "../db/errors.js";
|
|
15
|
+
import { ProjectNotFoundError, ValidationError } from "../db/errors.js";
|
|
16
16
|
import type { Recording, CreateRecordingInput, RecordingFilter, Agent, Project } from "../types/index.js";
|
|
17
|
-
export { ProjectNotFoundError };
|
|
17
|
+
export { ProjectNotFoundError, ValidationError };
|
|
18
18
|
export declare function createRecording(pg: PgAdapterAsync, input: CreateRecordingInput): Promise<Recording>;
|
|
19
19
|
export declare function getRecording(pg: PgAdapterAsync, id: string): Promise<Recording | null>;
|
|
20
20
|
export declare function listRecordings(pg: PgAdapterAsync, filter?: RecordingFilter): Promise<Recording[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../src/server/repo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../src/server/repo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EACV,SAAS,EACT,oBAAoB,EACpB,eAAe,EACf,KAAK,EACL,OAAO,EACR,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,oBAAoB,EAAE,eAAe,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,GAAG,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"v1.d.ts","sourceRoot":"","sources":["../../src/server/v1.ts"],"names":[],"mappings":"AAkCA;;;GAGG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAsLtF"}
|
package/dist/storage.js
CHANGED
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.2.
|
|
1
|
+
export declare const VERSION = "0.2.8";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED