@xdsjs/dossierx-daemon 0.1.14 → 0.1.15

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.
Files changed (2) hide show
  1. package/dist/index.js +30 -3
  2. 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.14";
2293
+ var DAEMON_VERSION = "0.1.15";
2294
2294
 
2295
2295
  // src/local-api/server.ts
2296
2296
  var DEFAULT_MAX_FILE_BYTES = 5 * 1024 * 1024;
@@ -3048,6 +3048,31 @@ function parseReportManifest(payload) {
3048
3048
  }
3049
3049
  return FinancialReportManifestSchema.parse(maybeRecord.manifest);
3050
3050
  }
3051
+ function parseExistingNotebook(payload) {
3052
+ const record = typeof payload === "object" && payload !== null ? payload : {};
3053
+ const notebooklm = typeof record.notebooklm === "object" && record.notebooklm !== null ? record.notebooklm : {};
3054
+ const notebookId = typeof notebooklm.notebookId === "string" ? notebooklm.notebookId.trim() : "";
3055
+ if (!notebookId) {
3056
+ return void 0;
3057
+ }
3058
+ const sourceIds = Array.isArray(record.sourceIds) ? record.sourceIds.flatMap((source) => {
3059
+ const sourceRecord = typeof source === "object" && source !== null ? source : {};
3060
+ const reportId = typeof sourceRecord.reportId === "string" ? sourceRecord.reportId.trim() : "";
3061
+ const sourceId = typeof sourceRecord.sourceId === "string" ? sourceRecord.sourceId.trim() : "";
3062
+ return reportId && sourceId ? [{ reportId, sourceId }] : [];
3063
+ }) : [];
3064
+ return { notebookId, sourceIds };
3065
+ }
3066
+ async function readExistingNotebook(context, notebookPath) {
3067
+ try {
3068
+ return parseExistingNotebook(await readWorkspaceJson(context, notebookPath));
3069
+ } catch (error) {
3070
+ if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
3071
+ return void 0;
3072
+ }
3073
+ throw error;
3074
+ }
3075
+ }
3051
3076
  async function readReportManifest(context, manifestPath) {
3052
3077
  try {
3053
3078
  return parseReportManifest(await readWorkspaceJson(context, manifestPath));
@@ -3245,6 +3270,8 @@ async function runNotebookIngest(task, context) {
3245
3270
  const ticker = primaryTicker(manifest.issuer);
3246
3271
  const manifestHash = sha256Json(manifest);
3247
3272
  const factsAsOf = task.payload.factsAsOf ?? (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
3273
+ const notebookPath = `companies/${ticker}/financial-reports/notebooklm/notebook.json`;
3274
+ const existingNotebook = await readExistingNotebook(context, notebookPath);
3248
3275
  await context.appendEvent({
3249
3276
  level: "info",
3250
3277
  message: "Starting NotebookLM financial reports ingest",
@@ -3256,9 +3283,9 @@ async function runNotebookIngest(task, context) {
3256
3283
  manifestHash,
3257
3284
  factsAsOf,
3258
3285
  generatedAt: context.financialReports?.now?.(),
3259
- notebookTitle: task.payload.notebookTitle
3286
+ notebookTitle: task.payload.notebookTitle,
3287
+ existingNotebook
3260
3288
  });
3261
- const notebookPath = `companies/${ticker}/financial-reports/notebooklm/notebook.json`;
3262
3289
  const factsBundlePath = `companies/${ticker}/financial-reports/ingest/facts-bundle.json`;
3263
3290
  const wikiPath = `companies/${ticker}/financial-reports/wiki/financial-report-analysis.md`;
3264
3291
  await writeWorkspaceJson(context, notebookPath, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xdsjs/dossierx-daemon",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
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.4",
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",