@xdsjs/dossierx-daemon 0.1.12 → 0.1.13
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 +85 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -996,7 +996,7 @@ function createTaskArchive(options) {
|
|
|
996
996
|
|
|
997
997
|
// src/version.ts
|
|
998
998
|
var DAEMON_PACKAGE_NAME = "@xdsjs/dossierx-daemon";
|
|
999
|
-
var DAEMON_VERSION = "0.1.
|
|
999
|
+
var DAEMON_VERSION = "0.1.13";
|
|
1000
1000
|
|
|
1001
1001
|
// src/local-api/server.ts
|
|
1002
1002
|
var DEFAULT_MAX_FILE_BYTES = 5 * 1024 * 1024;
|
|
@@ -1738,6 +1738,14 @@ function writeWorkspaceJson(context, relativePath, value) {
|
|
|
1738
1738
|
`)
|
|
1739
1739
|
);
|
|
1740
1740
|
}
|
|
1741
|
+
function writeWorkspaceText(context, relativePath, value) {
|
|
1742
|
+
return writeWorkspaceBytes(
|
|
1743
|
+
context,
|
|
1744
|
+
relativePath,
|
|
1745
|
+
new TextEncoder().encode(value.endsWith("\n") ? value : `${value}
|
|
1746
|
+
`)
|
|
1747
|
+
);
|
|
1748
|
+
}
|
|
1741
1749
|
async function writeWorkspaceBytes(context, relativePath, bytes) {
|
|
1742
1750
|
const absolutePath = resolveInsideWorkspace5(context.workspaceRoot, relativePath);
|
|
1743
1751
|
await mkdir3(path6.dirname(absolutePath), { recursive: true });
|
|
@@ -1811,11 +1819,71 @@ function financialTaskResult(input) {
|
|
|
1811
1819
|
manifestHash: input.manifestHash,
|
|
1812
1820
|
notebookPath: input.notebookPath,
|
|
1813
1821
|
factsBundlePath: input.factsBundlePath,
|
|
1822
|
+
wikiPath: input.wikiPath,
|
|
1814
1823
|
reportCount: input.manifest.reports.length,
|
|
1815
1824
|
coverageStatus: coverage.status,
|
|
1816
1825
|
blockingReasons: coverage.knownGaps
|
|
1817
1826
|
};
|
|
1818
1827
|
}
|
|
1828
|
+
var financialFactsSectionLabels = {
|
|
1829
|
+
business: "\u4E1A\u52A1",
|
|
1830
|
+
revenueAndMargins: "\u6536\u5165\u548C\u6BDB\u5229",
|
|
1831
|
+
cashFlowAndBalanceSheet: "\u73B0\u91D1\u6D41\u548C\u8D44\u4EA7\u8D1F\u503A",
|
|
1832
|
+
growthDrivers: "\u589E\u957F\u9A71\u52A8",
|
|
1833
|
+
risksAndRedFlags: "\u98CE\u9669\u7EA2\u65D7",
|
|
1834
|
+
managementAndCapitalAllocation: "\u7BA1\u7406\u5C42\u548C\u8D44\u672C\u914D\u7F6E"
|
|
1835
|
+
};
|
|
1836
|
+
function renderFinancialFactsWiki(bundle) {
|
|
1837
|
+
const evidenceById = new Map(
|
|
1838
|
+
bundle.evidenceRefs.map((evidence) => [evidence.evidenceId, evidence])
|
|
1839
|
+
);
|
|
1840
|
+
const lines = [
|
|
1841
|
+
`# ${bundle.ticker} \u8D22\u62A5\u89E3\u8BFB`,
|
|
1842
|
+
"",
|
|
1843
|
+
`- factsAsOf: ${bundle.factsAsOf}`,
|
|
1844
|
+
`- manifestHash: ${bundle.manifestHash}`,
|
|
1845
|
+
`- sourceReports: ${bundle.sourceReportIds.length}`,
|
|
1846
|
+
`- coverage: ${bundle.sourceCoverage.status}`,
|
|
1847
|
+
""
|
|
1848
|
+
];
|
|
1849
|
+
for (const [sectionName, section] of Object.entries(bundle.sections)) {
|
|
1850
|
+
lines.push(`## ${financialFactsSectionLabels[sectionName]}`);
|
|
1851
|
+
lines.push("");
|
|
1852
|
+
lines.push(section.summary);
|
|
1853
|
+
lines.push("");
|
|
1854
|
+
for (const evidenceId of section.evidenceIds) {
|
|
1855
|
+
const evidence = evidenceById.get(evidenceId);
|
|
1856
|
+
if (!evidence) {
|
|
1857
|
+
continue;
|
|
1858
|
+
}
|
|
1859
|
+
lines.push(
|
|
1860
|
+
`- evidence: ${evidence.evidenceId} (${evidence.polarity}, ${evidence.sourceType}) - ${evidence.summary}`
|
|
1861
|
+
);
|
|
1862
|
+
lines.push(` - source: ${evidence.sourceUrlOrPath}`);
|
|
1863
|
+
lines.push(` - citation: ${formatCitation(evidence.citation)}`);
|
|
1864
|
+
}
|
|
1865
|
+
lines.push("");
|
|
1866
|
+
}
|
|
1867
|
+
if (bundle.blockingReasons.length > 0) {
|
|
1868
|
+
lines.push("## \u963B\u585E / \u7F3A\u53E3");
|
|
1869
|
+
lines.push("");
|
|
1870
|
+
for (const reason of bundle.blockingReasons) {
|
|
1871
|
+
lines.push(`- ${reason}`);
|
|
1872
|
+
}
|
|
1873
|
+
lines.push("");
|
|
1874
|
+
}
|
|
1875
|
+
return lines.join("\n");
|
|
1876
|
+
}
|
|
1877
|
+
function formatCitation(citation) {
|
|
1878
|
+
const locators = [
|
|
1879
|
+
citation.page === void 0 ? void 0 : `page ${citation.page}`,
|
|
1880
|
+
citation.pageRange ? `pages ${citation.pageRange}` : void 0,
|
|
1881
|
+
citation.sectionTitle,
|
|
1882
|
+
citation.notebooklmSourceId ? `NotebookLM ${citation.notebooklmSourceId}` : void 0,
|
|
1883
|
+
citation.quotedText ? `"${citation.quotedText}"` : void 0
|
|
1884
|
+
].filter(Boolean);
|
|
1885
|
+
return locators.join("; ") || "citation locator unavailable";
|
|
1886
|
+
}
|
|
1819
1887
|
async function runSyncReports(task, context) {
|
|
1820
1888
|
const issuer = task.payload.issuer;
|
|
1821
1889
|
const market = primaryMarket(issuer);
|
|
@@ -1915,6 +1983,7 @@ async function runNotebookIngest(task, context) {
|
|
|
1915
1983
|
});
|
|
1916
1984
|
const notebookPath = `companies/${ticker}/financial-reports/notebooklm/notebook.json`;
|
|
1917
1985
|
const factsBundlePath = `companies/${ticker}/financial-reports/ingest/facts-bundle.json`;
|
|
1986
|
+
const wikiPath = `companies/${ticker}/financial-reports/wiki/financial-report-analysis.md`;
|
|
1918
1987
|
await writeWorkspaceJson(context, notebookPath, {
|
|
1919
1988
|
schemaVersion: "financial-reports/notebooklm-run/v1",
|
|
1920
1989
|
generatedAt: ingest.factsBundle.generatedAt,
|
|
@@ -1923,6 +1992,11 @@ async function runNotebookIngest(task, context) {
|
|
|
1923
1992
|
sourceIds: ingest.sourceIds
|
|
1924
1993
|
});
|
|
1925
1994
|
await writeWorkspaceJson(context, factsBundlePath, ingest.factsBundle);
|
|
1995
|
+
await writeWorkspaceText(
|
|
1996
|
+
context,
|
|
1997
|
+
wikiPath,
|
|
1998
|
+
renderFinancialFactsWiki(ingest.factsBundle)
|
|
1999
|
+
);
|
|
1926
2000
|
const companyManifest = context.dryRun ? void 0 : await buildCompanyManifest2({
|
|
1927
2001
|
workspaceRoot: context.workspaceRoot,
|
|
1928
2002
|
ticker,
|
|
@@ -1934,11 +2008,17 @@ async function runNotebookIngest(task, context) {
|
|
|
1934
2008
|
data: {
|
|
1935
2009
|
issuerId: manifest.issuer.issuerId,
|
|
1936
2010
|
notebookPath,
|
|
1937
|
-
factsBundlePath
|
|
2011
|
+
factsBundlePath,
|
|
2012
|
+
wikiPath
|
|
1938
2013
|
}
|
|
1939
2014
|
});
|
|
1940
2015
|
return {
|
|
1941
|
-
generatedFiles: [
|
|
2016
|
+
generatedFiles: [
|
|
2017
|
+
notebookPath,
|
|
2018
|
+
factsBundlePath,
|
|
2019
|
+
wikiPath,
|
|
2020
|
+
companyManifestPath2(ticker)
|
|
2021
|
+
],
|
|
1942
2022
|
manifestPath: companyManifestPath2(ticker),
|
|
1943
2023
|
manifest: companyManifest,
|
|
1944
2024
|
blockingReasons: [],
|
|
@@ -1947,7 +2027,8 @@ async function runNotebookIngest(task, context) {
|
|
|
1947
2027
|
manifestPath: task.payload.manifestPath,
|
|
1948
2028
|
manifestHash,
|
|
1949
2029
|
notebookPath,
|
|
1950
|
-
factsBundlePath
|
|
2030
|
+
factsBundlePath,
|
|
2031
|
+
wikiPath
|
|
1951
2032
|
})
|
|
1952
2033
|
};
|
|
1953
2034
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xdsjs/dossierx-daemon",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@supabase/supabase-js": "^2.0.0",
|
|
34
34
|
"@xdsjs/dossier-financial-reports": "^0.1.4",
|
|
35
35
|
"@xdsjs/dossierx-git-mirror": "^0.1.2",
|
|
36
|
-
"@xdsjs/dossierx-shared": "^0.1.
|
|
36
|
+
"@xdsjs/dossierx-shared": "^0.1.4",
|
|
37
37
|
"@xdsjs/dossierx-workspace": "^0.1.1",
|
|
38
38
|
"commander": "^14.0.0",
|
|
39
39
|
"execa": "^9.0.0",
|