@xdsjs/dossierx-daemon 0.1.14 → 0.1.16
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 +31 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2290,7 +2290,7 @@ function createTaskArchive(options) {
|
|
|
2290
2290
|
|
|
2291
2291
|
// src/version.ts
|
|
2292
2292
|
var DAEMON_PACKAGE_NAME = "@xdsjs/dossierx-daemon";
|
|
2293
|
-
var DAEMON_VERSION = "0.1.
|
|
2293
|
+
var DAEMON_VERSION = "0.1.16";
|
|
2294
2294
|
|
|
2295
2295
|
// src/local-api/server.ts
|
|
2296
2296
|
var DEFAULT_MAX_FILE_BYTES = 5 * 1024 * 1024;
|
|
@@ -2300,6 +2300,7 @@ function json(response, status, body, origin) {
|
|
|
2300
2300
|
response.writeHead(status, {
|
|
2301
2301
|
"content-type": "application/json; charset=utf-8",
|
|
2302
2302
|
...origin ? { "access-control-allow-origin": origin } : {},
|
|
2303
|
+
...origin ? { "access-control-allow-private-network": "true" } : {},
|
|
2303
2304
|
"access-control-allow-methods": "GET, POST, OPTIONS",
|
|
2304
2305
|
"access-control-allow-headers": "content-type",
|
|
2305
2306
|
vary: "Origin"
|
|
@@ -3048,6 +3049,31 @@ function parseReportManifest(payload) {
|
|
|
3048
3049
|
}
|
|
3049
3050
|
return FinancialReportManifestSchema.parse(maybeRecord.manifest);
|
|
3050
3051
|
}
|
|
3052
|
+
function parseExistingNotebook(payload) {
|
|
3053
|
+
const record = typeof payload === "object" && payload !== null ? payload : {};
|
|
3054
|
+
const notebooklm = typeof record.notebooklm === "object" && record.notebooklm !== null ? record.notebooklm : {};
|
|
3055
|
+
const notebookId = typeof notebooklm.notebookId === "string" ? notebooklm.notebookId.trim() : "";
|
|
3056
|
+
if (!notebookId) {
|
|
3057
|
+
return void 0;
|
|
3058
|
+
}
|
|
3059
|
+
const sourceIds = Array.isArray(record.sourceIds) ? record.sourceIds.flatMap((source) => {
|
|
3060
|
+
const sourceRecord = typeof source === "object" && source !== null ? source : {};
|
|
3061
|
+
const reportId = typeof sourceRecord.reportId === "string" ? sourceRecord.reportId.trim() : "";
|
|
3062
|
+
const sourceId = typeof sourceRecord.sourceId === "string" ? sourceRecord.sourceId.trim() : "";
|
|
3063
|
+
return reportId && sourceId ? [{ reportId, sourceId }] : [];
|
|
3064
|
+
}) : [];
|
|
3065
|
+
return { notebookId, sourceIds };
|
|
3066
|
+
}
|
|
3067
|
+
async function readExistingNotebook(context, notebookPath) {
|
|
3068
|
+
try {
|
|
3069
|
+
return parseExistingNotebook(await readWorkspaceJson(context, notebookPath));
|
|
3070
|
+
} catch (error) {
|
|
3071
|
+
if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
|
|
3072
|
+
return void 0;
|
|
3073
|
+
}
|
|
3074
|
+
throw error;
|
|
3075
|
+
}
|
|
3076
|
+
}
|
|
3051
3077
|
async function readReportManifest(context, manifestPath) {
|
|
3052
3078
|
try {
|
|
3053
3079
|
return parseReportManifest(await readWorkspaceJson(context, manifestPath));
|
|
@@ -3245,6 +3271,8 @@ async function runNotebookIngest(task, context) {
|
|
|
3245
3271
|
const ticker = primaryTicker(manifest.issuer);
|
|
3246
3272
|
const manifestHash = sha256Json(manifest);
|
|
3247
3273
|
const factsAsOf = task.payload.factsAsOf ?? (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
3274
|
+
const notebookPath = `companies/${ticker}/financial-reports/notebooklm/notebook.json`;
|
|
3275
|
+
const existingNotebook = await readExistingNotebook(context, notebookPath);
|
|
3248
3276
|
await context.appendEvent({
|
|
3249
3277
|
level: "info",
|
|
3250
3278
|
message: "Starting NotebookLM financial reports ingest",
|
|
@@ -3256,9 +3284,9 @@ async function runNotebookIngest(task, context) {
|
|
|
3256
3284
|
manifestHash,
|
|
3257
3285
|
factsAsOf,
|
|
3258
3286
|
generatedAt: context.financialReports?.now?.(),
|
|
3259
|
-
notebookTitle: task.payload.notebookTitle
|
|
3287
|
+
notebookTitle: task.payload.notebookTitle,
|
|
3288
|
+
existingNotebook
|
|
3260
3289
|
});
|
|
3261
|
-
const notebookPath = `companies/${ticker}/financial-reports/notebooklm/notebook.json`;
|
|
3262
3290
|
const factsBundlePath = `companies/${ticker}/financial-reports/ingest/facts-bundle.json`;
|
|
3263
3291
|
const wikiPath = `companies/${ticker}/financial-reports/wiki/financial-report-analysis.md`;
|
|
3264
3292
|
await writeWorkspaceJson(context, notebookPath, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xdsjs/dossierx-daemon",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@supabase/supabase-js": "^2.0.0",
|
|
34
|
-
"@xdsjs/dossier-financial-reports": "^0.1.
|
|
34
|
+
"@xdsjs/dossier-financial-reports": "^0.1.5",
|
|
35
35
|
"@xdsjs/dossierx-git-mirror": "^0.1.2",
|
|
36
36
|
"@xdsjs/dossierx-shared": "^0.1.5",
|
|
37
37
|
"@xdsjs/dossierx-workspace": "^0.1.1",
|