@cyanheads/secedgar-mcp-server 0.15.13 → 0.15.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.
- package/AGENTS.md +8 -6
- package/CLAUDE.md +8 -6
- package/Dockerfile +3 -3
- package/README.md +8 -5
- package/changelog/0.15.x/0.15.14.md +31 -0
- package/changelog/0.15.x/0.15.15.md +24 -0
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/tools/definitions/company-search.tool.d.ts +2 -2
- package/dist/mcp-server/tools/definitions/company-search.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/company-search.tool.js +8 -10
- package/dist/mcp-server/tools/definitions/company-search.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/compare-companies.tool.d.ts +2 -2
- package/dist/mcp-server/tools/definitions/compare-companies.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/compare-companies.tool.js +6 -4
- package/dist/mcp-server/tools/definitions/compare-companies.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/dataframe-describe.tool.d.ts +1 -1
- package/dist/mcp-server/tools/definitions/dataframe-describe.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/dataframe-describe.tool.js +1 -1
- package/dist/mcp-server/tools/definitions/dataframe-describe.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/dataframe-drop.tool.d.ts +1 -1
- package/dist/mcp-server/tools/definitions/dataframe-drop.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/dataframe-drop.tool.js +1 -1
- package/dist/mcp-server/tools/definitions/dataframe-drop.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/dataframe-query.tool.d.ts +1 -1
- package/dist/mcp-server/tools/definitions/dataframe-query.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/dataframe-query.tool.js +1 -1
- package/dist/mcp-server/tools/definitions/dataframe-query.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/fetch-frames.tool.d.ts +2 -2
- package/dist/mcp-server/tools/definitions/fetch-frames.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/fetch-frames.tool.js +6 -4
- package/dist/mcp-server/tools/definitions/fetch-frames.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/find-holders.tool.d.ts +2 -2
- package/dist/mcp-server/tools/definitions/find-holders.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/find-holders.tool.js +35 -23
- package/dist/mcp-server/tools/definitions/find-holders.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-beneficial-owners.tool.d.ts +15 -5
- package/dist/mcp-server/tools/definitions/get-beneficial-owners.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-beneficial-owners.tool.js +92 -35
- package/dist/mcp-server/tools/definitions/get-beneficial-owners.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-filing.tool.d.ts +2 -2
- package/dist/mcp-server/tools/definitions/get-filing.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-filing.tool.js +59 -33
- package/dist/mcp-server/tools/definitions/get-filing.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-financials.tool.d.ts +2 -2
- package/dist/mcp-server/tools/definitions/get-financials.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-financials.tool.js +11 -8
- package/dist/mcp-server/tools/definitions/get-financials.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-fund-holdings.tool.d.ts +2 -2
- package/dist/mcp-server/tools/definitions/get-fund-holdings.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-fund-holdings.tool.js +27 -27
- package/dist/mcp-server/tools/definitions/get-fund-holdings.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-insider-transactions.tool.d.ts +2 -2
- package/dist/mcp-server/tools/definitions/get-insider-transactions.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-insider-transactions.tool.js +12 -16
- package/dist/mcp-server/tools/definitions/get-insider-transactions.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-institutional-holdings.tool.d.ts +21 -2
- package/dist/mcp-server/tools/definitions/get-institutional-holdings.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-institutional-holdings.tool.js +153 -37
- package/dist/mcp-server/tools/definitions/get-institutional-holdings.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-material-events.tool.d.ts +2 -2
- package/dist/mcp-server/tools/definitions/get-material-events.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-material-events.tool.js +8 -10
- package/dist/mcp-server/tools/definitions/get-material-events.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-snapshot.tool.d.ts +2 -2
- package/dist/mcp-server/tools/definitions/get-snapshot.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-snapshot.tool.js +6 -4
- package/dist/mcp-server/tools/definitions/get-snapshot.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/index.d.ts +597 -572
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-filings.tool.d.ts +3 -8
- package/dist/mcp-server/tools/definitions/search-filings.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-filings.tool.js +117 -59
- package/dist/mcp-server/tools/definitions/search-filings.tool.js.map +1 -1
- package/dist/mcp-server/tools/fixed-point.d.ts +7 -0
- package/dist/mcp-server/tools/fixed-point.d.ts.map +1 -0
- package/dist/mcp-server/tools/fixed-point.js +28 -0
- package/dist/mcp-server/tools/fixed-point.js.map +1 -0
- package/dist/services/edgar/call-scope.d.ts +41 -0
- package/dist/services/edgar/call-scope.d.ts.map +1 -0
- package/dist/services/edgar/call-scope.js +53 -0
- package/dist/services/edgar/call-scope.js.map +1 -0
- package/dist/services/edgar/concept-series.d.ts.map +1 -1
- package/dist/services/edgar/concept-series.js +5 -1
- package/dist/services/edgar/concept-series.js.map +1 -1
- package/dist/services/edgar/edgar-api-service.d.ts +80 -50
- package/dist/services/edgar/edgar-api-service.d.ts.map +1 -1
- package/dist/services/edgar/edgar-api-service.js +483 -211
- package/dist/services/edgar/edgar-api-service.js.map +1 -1
- package/dist/services/edgar/filing-to-text.d.ts +53 -14
- package/dist/services/edgar/filing-to-text.d.ts.map +1 -1
- package/dist/services/edgar/filing-to-text.js +181 -33
- package/dist/services/edgar/filing-to-text.js.map +1 -1
- package/dist/services/edgar/nport-parser.js +1 -1
- package/dist/services/edgar/nport-parser.js.map +1 -1
- package/dist/services/edgar/ownership-parser.d.ts +2 -0
- package/dist/services/edgar/ownership-parser.d.ts.map +1 -1
- package/dist/services/edgar/ownership-parser.js +4 -0
- package/dist/services/edgar/ownership-parser.js.map +1 -1
- package/dist/services/edgar/same-cik.d.ts +7 -0
- package/dist/services/edgar/same-cik.d.ts.map +1 -0
- package/dist/services/edgar/same-cik.js +9 -0
- package/dist/services/edgar/same-cik.js.map +1 -0
- package/dist/services/edgar/submissions-archive.d.ts +6 -3
- package/dist/services/edgar/submissions-archive.d.ts.map +1 -1
- package/dist/services/edgar/submissions-archive.js +6 -3
- package/dist/services/edgar/submissions-archive.js.map +1 -1
- package/package.json +6 -6
- package/server.json +3 -3
|
@@ -4,16 +4,17 @@
|
|
|
4
4
|
* ownership triangle alongside secedgar_get_insider_transactions (Form 4 officers and
|
|
5
5
|
* directors) and secedgar_get_institutional_holdings (13F portfolios): this tool covers the
|
|
6
6
|
* 5%-and-over stakes, activist and passive. Discovery runs off the issuer's own submissions
|
|
7
|
-
* feed — SEC cross-lists a 13D/G under every CIK party to it
|
|
8
|
-
*
|
|
9
|
-
* issuer's own path.
|
|
7
|
+
* feed — SEC cross-lists a 13D/G under every CIK party to it. Each document's issuer CIK
|
|
8
|
+
* must therefore match before its ownership is attributed to the requested company.
|
|
10
9
|
* @module mcp-server/tools/definitions/get-beneficial-owners
|
|
11
10
|
*/
|
|
12
11
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
13
12
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
14
13
|
import { dataframeGuidance, getCanvasBridge, toDatasetField, } from '../../../services/canvas-bridge/canvas-bridge.js';
|
|
15
14
|
import { formNameToSchedule, parseBeneficialOwnershipXml, } from '../../../services/edgar/beneficial-ownership-parser.js';
|
|
15
|
+
import { CallScope } from '../../../services/edgar/call-scope.js';
|
|
16
16
|
import { getEdgarApiService, rawDocumentName } from '../../../services/edgar/edgar-api-service.js';
|
|
17
|
+
import { sameCik } from '../../../services/edgar/same-cik.js';
|
|
17
18
|
/**
|
|
18
19
|
* First filing date on which every beneficial-ownership filing arrived in the structured
|
|
19
20
|
* format. The legacy `SC 13D` / `SC 13G` names stop dead here: EDGAR full-text search counts
|
|
@@ -21,6 +22,10 @@ import { getEdgarApiService, rawDocumentName } from '../../../services/edgar/edg
|
|
|
21
22
|
* same day. Filings before it are text or HTML documents with no XML to parse.
|
|
22
23
|
*/
|
|
23
24
|
const STRUCTURED_FROM = '2024-12-18';
|
|
25
|
+
/** Maximum schedule documents examined in one newest-first scan. */
|
|
26
|
+
const FILING_SCAN_CAP = 50;
|
|
27
|
+
/** Maximum matching filings a caller can request. */
|
|
28
|
+
const FILING_RESULT_CAP = 20;
|
|
24
29
|
/** Legacy form names that carry the same disclosure with no parseable XML. */
|
|
25
30
|
const LEGACY_FORMS = ['SC 13D', 'SC 13D/A', 'SC 13G', 'SC 13G/A'];
|
|
26
31
|
/**
|
|
@@ -75,8 +80,8 @@ export const getBeneficialOwnersTool = tool('secedgar_get_beneficial_owners', {
|
|
|
75
80
|
{
|
|
76
81
|
reason: 'sec_unreachable',
|
|
77
82
|
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
78
|
-
when:
|
|
79
|
-
recovery: 'Retry the same call in a minute — SEC EDGAR
|
|
83
|
+
when: "SEC EDGAR gave no complete, readable response — on the last attempt made (the third, or an earlier one once this call's 40-second budget for SEC failures ran out) the connection failed, no response headers arrived within 15 seconds, or the body broke off or stalled for 15 seconds, each wait capped at what was left of that budget; a 200 body was not the JSON SEC serves; or earlier SEC failures had spent that budget, so the request was never sent",
|
|
84
|
+
recovery: 'Retry the same call in a minute — SEC EDGAR did not deliver a complete, readable response, and nothing in the request needs to change.',
|
|
80
85
|
retryable: true,
|
|
81
86
|
thrownBy: 'service',
|
|
82
87
|
},
|
|
@@ -99,9 +104,9 @@ export const getBeneficialOwnersTool = tool('secedgar_get_beneficial_owners', {
|
|
|
99
104
|
.number()
|
|
100
105
|
.int()
|
|
101
106
|
.min(1)
|
|
102
|
-
.max(
|
|
107
|
+
.max(FILING_RESULT_CAP)
|
|
103
108
|
.default(10)
|
|
104
|
-
.describe('Number of filings
|
|
109
|
+
.describe('Number of successfully parsed filings naming the requested issuer to return, newest first. Other-issuer schedules and failed documents do not consume this limit; at most 50 documents are examined. Default 10.'),
|
|
105
110
|
}),
|
|
106
111
|
// The company-identifier keys other tools take. `issuer` is this tool's only company
|
|
107
112
|
// input, so each maps one-to-one (#152).
|
|
@@ -115,10 +120,28 @@ export const getBeneficialOwnersTool = tool('secedgar_get_beneficial_owners', {
|
|
|
115
120
|
.describe('The schedule filter applied — the requested value, or the default "all".'),
|
|
116
121
|
total_structured_filings: z
|
|
117
122
|
.number()
|
|
118
|
-
.describe('
|
|
119
|
-
filings_parsed: z
|
|
123
|
+
.describe('Indexed 13D/13G schedules matching form/amendment filters in the recent submissions window.'),
|
|
124
|
+
filings_parsed: z.number().describe('Matching parsed filings, capped by limit.'),
|
|
125
|
+
filings_examined: z.number().describe('Matches + exclusions + failures; at most 50 documents.'),
|
|
126
|
+
filings_excluded_other_issuer: z
|
|
120
127
|
.number()
|
|
121
|
-
.describe('
|
|
128
|
+
.describe('Schedules naming another issuer; no rows returned.'),
|
|
129
|
+
filings_not_examined: z
|
|
130
|
+
.number()
|
|
131
|
+
.describe('Indexed schedules beyond the result limit or 50-document ceiling.'),
|
|
132
|
+
filings_failed: z
|
|
133
|
+
.array(z
|
|
134
|
+
.object({
|
|
135
|
+
accession_number: z.string().describe('Accession to inspect with secedgar_get_filing.'),
|
|
136
|
+
reason: z
|
|
137
|
+
.enum(['document_not_found', 'unparseable'])
|
|
138
|
+
.describe('Document returned 404, or could not be parsed with a usable issuer CIK.'),
|
|
139
|
+
})
|
|
140
|
+
.describe('One failed document.'))
|
|
141
|
+
.describe('Failures in scan order; successes retained.'),
|
|
142
|
+
partial: z
|
|
143
|
+
.boolean()
|
|
144
|
+
.describe('True when filings_failed is nonempty, independently of truncation.'),
|
|
122
145
|
structured_coverage_from: z
|
|
123
146
|
.string()
|
|
124
147
|
.describe('First date SEC required this XML format (YYYY-MM-DD); earlier blockholder filings cannot be parsed here.'),
|
|
@@ -221,7 +244,7 @@ export const getBeneficialOwnersTool = tool('secedgar_get_beneficial_owners', {
|
|
|
221
244
|
expires_at: z.string().describe('ISO 8601 expiry timestamp.'),
|
|
222
245
|
truncated: z
|
|
223
246
|
.boolean()
|
|
224
|
-
.describe('True when
|
|
247
|
+
.describe('True when indexed schedules remain unexamined after the result limit or scan ceiling.'),
|
|
225
248
|
})
|
|
226
249
|
.optional()
|
|
227
250
|
.describe('Dataframe with one row per reporting person across parsed filings; joins insider and 13F dataframes on issuer_cik. Absent when canvas is unavailable or nothing parsed.'),
|
|
@@ -230,14 +253,18 @@ export const getBeneficialOwnersTool = tool('secedgar_get_beneficial_owners', {
|
|
|
230
253
|
notice: z
|
|
231
254
|
.string()
|
|
232
255
|
.optional()
|
|
233
|
-
.describe('
|
|
234
|
-
truncated: z
|
|
256
|
+
.describe('Exclusions, document recovery, scan bounds, and dataframe guidance.'),
|
|
257
|
+
truncated: z
|
|
258
|
+
.boolean()
|
|
259
|
+
.optional()
|
|
260
|
+
.describe('True when schedules remain unexamined after the result limit or 50-document ceiling.'),
|
|
235
261
|
shown: z.number().optional().describe('Number of filings returned.'),
|
|
236
|
-
cap: z.number().optional().describe('
|
|
262
|
+
cap: z.number().optional().describe('Result limit or document ceiling that stopped scanning.'),
|
|
237
263
|
},
|
|
238
264
|
async handler(input, ctx) {
|
|
239
265
|
const api = getEdgarApiService();
|
|
240
|
-
const
|
|
266
|
+
const scope = new CallScope(ctx.signal);
|
|
267
|
+
const resolved = await api.resolveCik(input.issuer, scope);
|
|
241
268
|
const candidates = Array.isArray(resolved) ? resolved : [resolved];
|
|
242
269
|
if (candidates.length > 1) {
|
|
243
270
|
const shown = candidates.slice(0, 10);
|
|
@@ -248,7 +275,7 @@ export const getBeneficialOwnersTool = tool('secedgar_get_beneficial_owners', {
|
|
|
248
275
|
if (!match) {
|
|
249
276
|
throw ctx.fail('issuer_not_found', `Issuer '${input.issuer}' not found in EDGAR.`);
|
|
250
277
|
}
|
|
251
|
-
const submissions = await api.getSubmissions(match.cik);
|
|
278
|
+
const submissions = await api.getSubmissions(match.cik, scope);
|
|
252
279
|
const recent = submissions.filings.recent;
|
|
253
280
|
// SEC indexes a 13D/G under every CIK party to it, so the issuer's own feed already
|
|
254
281
|
// carries the schedules filed about it — no entity-scoped search needed.
|
|
@@ -269,7 +296,7 @@ export const getBeneficialOwnersTool = tool('secedgar_get_beneficial_owners', {
|
|
|
269
296
|
if (!input.include_amendments && form.endsWith('/A'))
|
|
270
297
|
continue;
|
|
271
298
|
totalMatching++;
|
|
272
|
-
if (selected.length <
|
|
299
|
+
if (selected.length < FILING_SCAN_CAP) {
|
|
273
300
|
selected.push({
|
|
274
301
|
form,
|
|
275
302
|
schedule,
|
|
@@ -290,20 +317,32 @@ export const getBeneficialOwnersTool = tool('secedgar_get_beneficial_owners', {
|
|
|
290
317
|
legacy_filings_before_coverage: legacyCount,
|
|
291
318
|
});
|
|
292
319
|
}
|
|
293
|
-
//
|
|
294
|
-
//
|
|
295
|
-
|
|
320
|
+
// Each examined document has exactly one outcome: matching, other issuer, or failed.
|
|
321
|
+
// Failures and exclusions do not spend the caller's matching-filing limit.
|
|
322
|
+
let examined = 0;
|
|
323
|
+
let otherIssuer = 0;
|
|
324
|
+
const failed = [];
|
|
296
325
|
const filings = [];
|
|
297
326
|
for (const ref of selected) {
|
|
298
|
-
|
|
327
|
+
if (filings.length >= input.limit)
|
|
328
|
+
break;
|
|
329
|
+
ctx.signal.throwIfAborted();
|
|
330
|
+
const xml = await api.tryGetFilingDocument(match.cik, ref.accessionNumber, ref.document, scope);
|
|
331
|
+
examined++;
|
|
299
332
|
const parsed = xml ? parseBeneficialOwnershipXml(xml) : undefined;
|
|
300
|
-
if (!parsed
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
333
|
+
if (!parsed?.issuer_cik ||
|
|
334
|
+
!/^\d+$/.test(parsed.issuer_cik) ||
|
|
335
|
+
!/[1-9]/.test(parsed.issuer_cik)) {
|
|
336
|
+
failed.push({
|
|
337
|
+
accession_number: ref.accessionNumber,
|
|
338
|
+
reason: xml === null ? 'document_not_found' : 'unparseable',
|
|
304
339
|
});
|
|
305
340
|
continue;
|
|
306
341
|
}
|
|
342
|
+
if (!sameCik(parsed.issuer_cik, match.cik)) {
|
|
343
|
+
otherIssuer++;
|
|
344
|
+
continue;
|
|
345
|
+
}
|
|
307
346
|
const purpose = clip(parsed.purpose_of_transaction, PURPOSE_MAX_CHARS);
|
|
308
347
|
filings.push({
|
|
309
348
|
form: ref.form,
|
|
@@ -333,7 +372,8 @@ export const getBeneficialOwnersTool = tool('secedgar_get_beneficial_owners', {
|
|
|
333
372
|
})),
|
|
334
373
|
});
|
|
335
374
|
}
|
|
336
|
-
const
|
|
375
|
+
const notExamined = totalMatching - examined;
|
|
376
|
+
const truncated = notExamined > 0;
|
|
337
377
|
// One row per reporting person — the grain the ownership question is asked at, and the
|
|
338
378
|
// grain that joins to the insider and 13F dataframes on issuer_cik.
|
|
339
379
|
let dataset;
|
|
@@ -377,19 +417,27 @@ export const getBeneficialOwnersTool = tool('secedgar_get_beneficial_owners', {
|
|
|
377
417
|
if (registered)
|
|
378
418
|
dataset = { ...toDatasetField(registered), truncated };
|
|
379
419
|
}
|
|
380
|
-
|
|
381
|
-
|
|
420
|
+
const guidance = [];
|
|
421
|
+
if (otherIssuer > 0)
|
|
422
|
+
guidance.push(`${otherIssuer} examined filings name another issuer and contribute no ownership rows.`);
|
|
423
|
+
if (failed.length > 0)
|
|
424
|
+
guidance.push(`${failed.length} documents failed; this is a partial result. Inspect the accessions in filings_failed with secedgar_get_filing; document_not_found means SEC returned 404, and unparseable means no schedule with a usable issuer CIK could be read.`);
|
|
425
|
+
if (truncated) {
|
|
426
|
+
guidance.push(examined === FILING_SCAN_CAP
|
|
427
|
+
? `${notExamined} indexed schedules remain unexamined after the 50-document scan ceiling. Narrow with form_kind or include_amendments=false; raising limit does not extend this ceiling.`
|
|
428
|
+
: `${notExamined} indexed schedules remain unexamined after the ${input.limit}-filing result limit. ${input.limit < FILING_RESULT_CAP ? 'Raise limit to reach further back, or narrow with form_kind or include_amendments=false.' : 'Narrow with form_kind or include_amendments=false.'}`);
|
|
382
429
|
}
|
|
383
|
-
|
|
430
|
+
if (dataset)
|
|
431
|
+
guidance.push(dataframeGuidance(dataset));
|
|
432
|
+
if (truncated) {
|
|
384
433
|
ctx.enrich.truncated({
|
|
385
434
|
shown: filings.length,
|
|
386
|
-
cap: input.limit,
|
|
387
|
-
guidance:
|
|
388
|
-
(dataset ? ` ${dataframeGuidance(dataset)}` : ''),
|
|
435
|
+
cap: examined === FILING_SCAN_CAP ? FILING_SCAN_CAP : input.limit,
|
|
436
|
+
guidance: guidance.join(' '),
|
|
389
437
|
});
|
|
390
438
|
}
|
|
391
|
-
else if (
|
|
392
|
-
ctx.enrich.notice(
|
|
439
|
+
else if (guidance.length > 0) {
|
|
440
|
+
ctx.enrich.notice(guidance.join(' '));
|
|
393
441
|
}
|
|
394
442
|
ctx.log.info('Beneficial owners retrieved', {
|
|
395
443
|
cik: match.cik,
|
|
@@ -406,6 +454,11 @@ export const getBeneficialOwnersTool = tool('secedgar_get_beneficial_owners', {
|
|
|
406
454
|
form_kind: input.form_kind,
|
|
407
455
|
total_structured_filings: totalMatching,
|
|
408
456
|
filings_parsed: filings.length,
|
|
457
|
+
filings_examined: examined,
|
|
458
|
+
filings_excluded_other_issuer: otherIssuer,
|
|
459
|
+
filings_not_examined: notExamined,
|
|
460
|
+
filings_failed: failed,
|
|
461
|
+
partial: failed.length > 0,
|
|
409
462
|
structured_coverage_from: STRUCTURED_FROM,
|
|
410
463
|
legacy_filings_before_coverage: legacyCount,
|
|
411
464
|
filings,
|
|
@@ -416,8 +469,12 @@ export const getBeneficialOwnersTool = tool('secedgar_get_beneficial_owners', {
|
|
|
416
469
|
const lines = [
|
|
417
470
|
`**5%+ beneficial owners of ${result.issuer_name}** (CIK ${result.issuer_cik}) — input "${result.issuer}"`,
|
|
418
471
|
`Schedule filter: ${result.form_kind} | ${result.filings_parsed} of ${result.total_structured_filings} structured filings parsed`,
|
|
472
|
+
`${result.filings_examined} examined | ${result.filings_excluded_other_issuer} excluded for another issuer | ${result.filings_failed.length} failed | ${result.filings_not_examined} not examined | partial: ${result.partial}`,
|
|
419
473
|
`Structured coverage starts ${result.structured_coverage_from}; ${result.legacy_filings_before_coverage} legacy SC 13D/SC 13G filings sit before it in the submissions window (read those with secedgar_get_filing).`,
|
|
420
474
|
];
|
|
475
|
+
for (const failure of result.filings_failed) {
|
|
476
|
+
lines.push(`Failed document: ${failure.accession_number} — ${failure.reason}`);
|
|
477
|
+
}
|
|
421
478
|
for (const f of result.filings) {
|
|
422
479
|
lines.push('');
|
|
423
480
|
const amendment = f.is_amendment
|
|
@@ -464,7 +521,7 @@ export const getBeneficialOwnersTool = tool('secedgar_get_beneficial_owners', {
|
|
|
464
521
|
}
|
|
465
522
|
if (result.dataset) {
|
|
466
523
|
const note = result.dataset.truncated
|
|
467
|
-
? ' (truncated —
|
|
524
|
+
? ' (truncated — indexed schedules remain unexamined)'
|
|
468
525
|
: '';
|
|
469
526
|
lines.push(`\nDataset: ${result.dataset.name} (${result.dataset.row_count} reporting-person rows, expires ${result.dataset.expires_at})${note} — query with secedgar_dataframe_query.`);
|
|
470
527
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-beneficial-owners.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-beneficial-owners.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,cAAc,GACf,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAGL,kBAAkB,EAClB,2BAA2B,GAC5B,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAE5F;;;;;GAKG;AACH,MAAM,eAAe,GAAG,YAAY,CAAC;AAErC,8EAA8E;AAC9E,MAAM,YAAY,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAE/B,kGAAkG;AAClG,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,uEAAuE;AACvE,SAAS,IAAI,CAAC,IAAwB,EAAE,GAAW;IACjD,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;IAC/D,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACnD,IAAI,SAAS,CAAC,MAAM,IAAI,GAAG;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;IACpE,OAAO,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,EA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CAC5K,CAAC;QACJ,CAAC;QAED,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"get-beneficial-owners.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-beneficial-owners.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,cAAc,GACf,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAGL,kBAAkB,EAClB,2BAA2B,GAC5B,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAC5F,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,eAAe,GAAG,YAAY,CAAC;AAErC,oEAAoE;AACpE,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B,qDAAqD;AACrD,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,8EAA8E;AAC9E,MAAM,YAAY,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAE/B,kGAAkG;AAClG,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,uEAAuE;AACvE,SAAS,IAAI,CAAC,IAAwB,EAAE,GAAW;IACjD,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAA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AM,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,OAAO,CAAC,SAAS,mCAAmC,MAAM,CAAC,OAAO,CAAC,UAAU,IAAI,IAAI,yCAAyC,CAC5K,CAAC;QACJ,CAAC;QAED,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -100,8 +100,8 @@ export declare const getFilingTool: import("@cyanheads/mcp-ts-core").ToolDefinit
|
|
|
100
100
|
}, {
|
|
101
101
|
readonly reason: "sec_unreachable";
|
|
102
102
|
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
103
|
-
readonly when: "
|
|
104
|
-
readonly recovery: "Retry the same call in a minute — SEC EDGAR
|
|
103
|
+
readonly when: "SEC EDGAR gave no complete, readable response — on the last attempt made (the third, or an earlier one once this call's 40-second budget for SEC failures ran out) the connection failed, no response headers arrived within 15 seconds, or the body broke off or stalled for 15 seconds, each wait capped at what was left of that budget; a 200 body was not the JSON SEC serves; or earlier SEC failures had spent that budget, so the request was never sent";
|
|
104
|
+
readonly recovery: "Retry the same call in a minute — SEC EDGAR did not deliver a complete, readable response, and nothing in the request needs to change.";
|
|
105
105
|
readonly retryable: true;
|
|
106
106
|
readonly thrownBy: "service";
|
|
107
107
|
}], {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-filing.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-filing.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"get-filing.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-filing.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAkJjE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsiBxB,CAAC"}
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
6
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
import { CallScope } from '../../../services/edgar/call-scope.js';
|
|
7
8
|
import { filingArchiveUrl, getEdgarApiService } from '../../../services/edgar/edgar-api-service.js';
|
|
8
|
-
import { detectHeadings, filingToExtract, foldForHeadingMatch, getExtractCache, headingKey, isTocHeading, MARKER_TITLE_RE, matchSectionLine, setExtractCache, windowText, withoutSubItemLabel, } from '../../../services/edgar/filing-to-text.js';
|
|
9
|
+
import { detectHeadings, filingToExtract, foldForHeadingMatch, getExtractCache, headingKey, isTocHeading, MARKER_TITLE_RE, matchSectionLine, setExtractCache, spaceRunInMarker, windowText, withoutSubItemLabel, } from '../../../services/edgar/filing-to-text.js';
|
|
9
10
|
const MAX_DOCUMENTS_IN_FORMAT = 10;
|
|
10
11
|
/**
|
|
11
12
|
* Per-category cap on the catalog rendered into an error message. Distinct from
|
|
@@ -108,8 +109,8 @@ export const getFilingTool = tool('secedgar_get_filing', {
|
|
|
108
109
|
{
|
|
109
110
|
reason: 'sec_unreachable',
|
|
110
111
|
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
111
|
-
when:
|
|
112
|
-
recovery: 'Retry the same call in a minute — SEC EDGAR
|
|
112
|
+
when: "SEC EDGAR gave no complete, readable response — on the last attempt made (the third, or an earlier one once this call's 40-second budget for SEC failures ran out) the connection failed, no response headers arrived within 15 seconds, or the body broke off or stalled for 15 seconds, each wait capped at what was left of that budget; a 200 body was not the JSON SEC serves; or earlier SEC failures had spent that budget, so the request was never sent",
|
|
113
|
+
recovery: 'Retry the same call in a minute — SEC EDGAR did not deliver a complete, readable response, and nothing in the request needs to change.',
|
|
113
114
|
retryable: true,
|
|
114
115
|
thrownBy: 'service',
|
|
115
116
|
},
|
|
@@ -149,7 +150,7 @@ export const getFilingTool = tool('secedgar_get_filing', {
|
|
|
149
150
|
.string()
|
|
150
151
|
.min(1)
|
|
151
152
|
.optional()
|
|
152
|
-
.describe("Jump to a named section, matched against every detected heading and the document's own lines (e.g. 'risk factors', 'item 7', 'item 2.02', 'certain relationships'). The first match wins, in this order: a heading equal to the value, or whose title after its Item/Part marker equals it; the first Item or Part heading containing it; a document line equal to it — a subheading the outline omits ('Liquidity and Capital Resources'); the first other heading containing it; a document line starting with it. In a proxy statement (DEF 14A and its variants), whose ITEM headings are ballot proposals, the first heading of any kind containing the value comes before both document-line steps. Within each heading step a body heading wins over a table-of-contents row, which lands only when nothing else at that step matches. A line landing says so in the notice; table-of-contents rows and wrapped cross-references are never line landings. A leading 20-F sub-item label on a heading or line ('3D.', 'B.') is ignored, so 'risk factors' reaches '3D. RISK FACTORS'; the value itself is matched as given. A value ending in a number matches only that number: 'item 1' reaches Item 1 and Item 1A, never Items 10–16, and 'part i' never reaches Part II. Every step ignores case, whitespace, and quote style, so a heading copied from the outline resolves whether it carries the filing's non-breaking spaces and curly quotes or plain ones; the steps comparing a whole heading or line (equal to, starting with) also ignore the punctuation between an Item or Part marker and its title, so 'Item 1A Risk Factors' reaches 'Item 1A. – Risk Factors'. Takes precedence over offset when both are provided, so leave it out when paging on with next_offset. On a miss, the error message includes the detected outline so you can pick the correct heading."),
|
|
153
|
+
.describe("Jump to a named section, matched against every detected heading and the document's own lines (e.g. 'risk factors', 'item 7', 'item 2.02', 'certain relationships'). The first match wins, in this order: a heading equal to the value, or whose title after its Item/Part marker equals it; the first Item or Part heading containing it; a document line equal to it — a subheading the outline omits ('Liquidity and Capital Resources') — unless the line labels a table row; the first other heading containing it; a table-row label equal to it, else a document line starting with it. In a proxy statement (DEF 14A and its variants), whose ITEM headings are ballot proposals, the first heading of any kind containing the value comes before both document-line steps. Within each heading step a body heading wins over a table-of-contents row, which lands only when nothing else at that step matches. A line landing says so in the notice; table-of-contents rows and wrapped cross-references are never line landings. A leading 20-F sub-item label on a heading or line ('3D.', 'B.') is ignored, so 'risk factors' reaches '3D. RISK FACTORS'; the value itself is matched as given. A value ending in a number matches only that number: 'item 1' reaches Item 1 and Item 1A, never Items 10–16, and 'part i' never reaches Part II. Every step ignores case, whitespace, and quote style, so a heading copied from the outline resolves whether it carries the filing's non-breaking spaces and curly quotes or plain ones; the steps comparing a whole heading or line (equal to, starting with) also ignore the punctuation between an Item or Part marker and its title, so 'Item 1A Risk Factors' reaches 'Item 1A. – Risk Factors'. Takes precedence over offset when both are provided, so leave it out when paging on with next_offset. On a miss, the error message includes the detected outline so you can pick the correct heading."),
|
|
153
154
|
}),
|
|
154
155
|
output: z.object({
|
|
155
156
|
accession_number: z.string().describe('Filing accession number, normalized to dash format.'),
|
|
@@ -216,6 +217,7 @@ export const getFilingTool = tool('secedgar_get_filing', {
|
|
|
216
217
|
}),
|
|
217
218
|
async handler(input, ctx) {
|
|
218
219
|
const api = getEdgarApiService();
|
|
220
|
+
const scope = new CallScope(ctx.signal);
|
|
219
221
|
const accn = normalizeAccessionNumber(input.accession_number);
|
|
220
222
|
const documentKey = input.document ?? PRIMARY_SENTINEL;
|
|
221
223
|
const cacheKey = `${accn}:${documentKey}`;
|
|
@@ -230,7 +232,7 @@ export const getFilingTool = tool('secedgar_get_filing', {
|
|
|
230
232
|
let records;
|
|
231
233
|
if (cached === undefined) {
|
|
232
234
|
// Cache miss — fetch, convert, and cache.
|
|
233
|
-
const resolved = await resolveFilingArchive(api, accn, input.cik, input.document);
|
|
235
|
+
const resolved = await resolveFilingArchive(api, scope, accn, input.cik, input.document);
|
|
234
236
|
if (!resolved.ok) {
|
|
235
237
|
if (resolved.kind === 'document_not_found') {
|
|
236
238
|
// Render candidates into the message itself — clients reliably see only
|
|
@@ -318,7 +320,7 @@ export const getFilingTool = tool('secedgar_get_filing', {
|
|
|
318
320
|
// archive served the cached text (no candidate search, no document body fetch).
|
|
319
321
|
// A resolution failure here is a real failure (EDGAR index unavailable or the
|
|
320
322
|
// filing gone): fail honestly rather than fabricating placeholder metadata.
|
|
321
|
-
const metaResolved = await resolveFilingMeta(api, accn, cached.cik, input.document);
|
|
323
|
+
const metaResolved = await resolveFilingMeta(api, scope, accn, cached.cik, input.document);
|
|
322
324
|
if (!metaResolved.ok) {
|
|
323
325
|
throw ctx.fail('filing_not_found', `Filing '${accn}' could not be resolved.`, {
|
|
324
326
|
accession_number: accn,
|
|
@@ -349,7 +351,7 @@ export const getFilingTool = tool('secedgar_get_filing', {
|
|
|
349
351
|
const idx = recent.accessionNumber.indexOf(accn);
|
|
350
352
|
const header = idx >= 0
|
|
351
353
|
? undefined
|
|
352
|
-
: (headers?.submission ?? (await api.tryGetSubmissionHeader(resolvedCik, accn)));
|
|
354
|
+
: (headers?.submission ?? (await api.tryGetSubmissionHeader(resolvedCik, accn, scope)));
|
|
353
355
|
const form = idx >= 0 ? recent.form[idx] : header?.form;
|
|
354
356
|
const filingDate = idx >= 0 ? recent.filingDate[idx] : header?.filingDate;
|
|
355
357
|
const periodEnding = idx >= 0 ? recent.reportDate[idx] : header?.periodOfReport;
|
|
@@ -488,6 +490,17 @@ export const getFilingTool = tool('secedgar_get_filing', {
|
|
|
488
490
|
];
|
|
489
491
|
},
|
|
490
492
|
});
|
|
493
|
+
/**
|
|
494
|
+
* A heading or `section` value folded for {@link sectionMatches}: Unicode
|
|
495
|
+
* whitespace runs and typographic quotes folded on both operands, so a heading
|
|
496
|
+
* re-sent from a rendered outline still matches the bytes it came from (#106),
|
|
497
|
+
* with a space read in where a marker runs straight into its title
|
|
498
|
+
* ({@link spaceRunInMarker}, #180) before the fold lowercases the capital that
|
|
499
|
+
* marks it.
|
|
500
|
+
*/
|
|
501
|
+
function foldForSectionMatch(value) {
|
|
502
|
+
return foldForHeadingMatch(spaceRunInMarker(value));
|
|
503
|
+
}
|
|
491
504
|
/**
|
|
492
505
|
* Whether a folded `section` needle matches a folded heading: a substring match,
|
|
493
506
|
* except that a needle ending in a number never continues into a longer one.
|
|
@@ -500,6 +513,9 @@ export const getFilingTool = tool('secedgar_get_filing', {
|
|
|
500
513
|
* `part i` never matches `PART II`, `PART III`, or `PART IV` — a 10-Q printing
|
|
501
514
|
* Part I only in its table of contents otherwise landed `part i` on its body
|
|
502
515
|
* `PART II - OTHER INFORMATION`. Every occurrence is checked, not just the first.
|
|
516
|
+
* Both operands arrive folded with a run-in marker spaced
|
|
517
|
+
* ({@link foldForSectionMatch}), so the numeral of "Part IFinancial Information"
|
|
518
|
+
* ends where heading detection ends it (#180).
|
|
503
519
|
*/
|
|
504
520
|
function sectionMatches(heading, needle) {
|
|
505
521
|
const continuation = /\d$/.test(needle)
|
|
@@ -556,11 +572,15 @@ function occursBeforeBoundary(heading, needle, from, continuation) {
|
|
|
556
572
|
* 2. The first Item or Part heading that {@link sectionMatches}: a value inside
|
|
557
573
|
* an Item title names that Item ("compensation" → "Item 11. Executive
|
|
558
574
|
* Compensation"), where a line equal to it is often a table-row label.
|
|
559
|
-
* 3. A document line equal to the value ({@link matchSectionLine})
|
|
575
|
+
* 3. A document line equal to the value ({@link matchSectionLine}) that labels
|
|
576
|
+
* no table row.
|
|
560
577
|
* 4. The first other heading that {@link sectionMatches}. One that merely holds
|
|
561
578
|
* the word ("NOTE 3. BUSINESS COMBINATIONS" for "business", "COST OF
|
|
562
579
|
* REVENUES" for "revenue") ranks after a line printing the value alone.
|
|
563
|
-
* 5. A document line
|
|
580
|
+
* 5. A document line equal to the value that labels a table row, else one
|
|
581
|
+
* starting with the value. A row label ranks after every heading containing
|
|
582
|
+
* the value (#184): every line equal to `revenue` in Microsoft's 2004 10-K
|
|
583
|
+
* labels a row, and in tier 3 one took the value from its MD&A heading.
|
|
564
584
|
*
|
|
565
585
|
* Inside each heading tier, a heading on a table-of-contents row
|
|
566
586
|
* ({@link isTocHeading}) ranks after every body heading of the tier, and lands
|
|
@@ -616,11 +636,8 @@ function resolveSection(text, headings, section, proxy) {
|
|
|
616
636
|
});
|
|
617
637
|
if (exact)
|
|
618
638
|
return { offset: exact.offset, source: 'heading' };
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
// from (#106).
|
|
622
|
-
const needle = foldForHeadingMatch(section);
|
|
623
|
-
const contains = (h) => sectionMatches(foldForHeadingMatch(h.heading), needle);
|
|
639
|
+
const needle = foldForSectionMatch(section);
|
|
640
|
+
const contains = (h) => sectionMatches(foldForSectionMatch(h.heading), needle);
|
|
624
641
|
if (proxy) {
|
|
625
642
|
const heading = first(contains);
|
|
626
643
|
if (heading)
|
|
@@ -628,7 +645,7 @@ function resolveSection(text, headings, section, proxy) {
|
|
|
628
645
|
const line = matchSectionLine(text, section);
|
|
629
646
|
return line ? { offset: line.offset, source: 'line' } : undefined;
|
|
630
647
|
}
|
|
631
|
-
const itemOrPart = first((h) =>
|
|
648
|
+
const itemOrPart = first((h) => isStructuralHeading(h) && contains(h));
|
|
632
649
|
if (itemOrPart)
|
|
633
650
|
return { offset: itemOrPart.offset, source: 'heading' };
|
|
634
651
|
const line = matchSectionLine(text, section);
|
|
@@ -657,8 +674,17 @@ function describeBlankSection(section) {
|
|
|
657
674
|
const PROXY_FORM_RE = /^(?:DEF|PRE)[ACMNR]? ?14[AC]\b/;
|
|
658
675
|
/** Most headings an outline renders, on the first page and in a section_not_found message. */
|
|
659
676
|
const OUTLINE_MAX_ENTRIES = 50;
|
|
660
|
-
/** An Item or Part heading, bare marker included
|
|
677
|
+
/** An Item or Part heading's opening, bare marker included. Non-global: a predicate. */
|
|
661
678
|
const STRUCTURAL_HEADING_RE = /^(?:items?\s+\d|part\s+[ivx]{1,4}\b)/i;
|
|
679
|
+
/**
|
|
680
|
+
* Whether a heading is an Item or Part heading — the document's structure. Read
|
|
681
|
+
* with its run-in marker spaced ({@link spaceRunInMarker}), so "Part
|
|
682
|
+
* IFinancial Information" is Part I's heading (#180), while a numeral running on
|
|
683
|
+
* into a lowercase letter ("Part Ivory") stays out.
|
|
684
|
+
*/
|
|
685
|
+
function isStructuralHeading(h) {
|
|
686
|
+
return STRUCTURAL_HEADING_RE.test(spaceRunInMarker(h.heading));
|
|
687
|
+
}
|
|
662
688
|
/**
|
|
663
689
|
* The Item and Part headings an outline keeps. Past {@link OUTLINE_MAX_ENTRIES}
|
|
664
690
|
* of them, each bare marker that a later titled heading for the same Item or
|
|
@@ -668,7 +694,7 @@ const STRUCTURAL_HEADING_RE = /^(?:items?\s+\d|part\s+[ivx]{1,4}\b)/i;
|
|
|
668
694
|
* Items 16A–19 out. A bare marker no titled heading repeats stays.
|
|
669
695
|
*/
|
|
670
696
|
function outlineStructuralHeadings(headings) {
|
|
671
|
-
const structural = headings.filter(
|
|
697
|
+
const structural = headings.filter(isStructuralHeading);
|
|
672
698
|
if (structural.length <= OUTLINE_MAX_ENTRIES)
|
|
673
699
|
return structural;
|
|
674
700
|
const titledLater = new Set();
|
|
@@ -699,7 +725,7 @@ function selectOutline(headings) {
|
|
|
699
725
|
for (const h of headings) {
|
|
700
726
|
if (structural.has(h))
|
|
701
727
|
outline.push(h);
|
|
702
|
-
else if (otherSlots > 0 && !
|
|
728
|
+
else if (otherSlots > 0 && !isStructuralHeading(h)) {
|
|
703
729
|
outline.push(h);
|
|
704
730
|
otherSlots--;
|
|
705
731
|
}
|
|
@@ -715,7 +741,7 @@ function outlineCutNote(outline, detected) {
|
|
|
715
741
|
if (outline.length === detected.length)
|
|
716
742
|
return;
|
|
717
743
|
const kept = outlineStructuralHeadings(detected).length;
|
|
718
|
-
const structural = detected.filter(
|
|
744
|
+
const structural = detected.filter(isStructuralHeading).length;
|
|
719
745
|
const scope = kept > OUTLINE_MAX_ENTRIES
|
|
720
746
|
? ''
|
|
721
747
|
: kept < structural
|
|
@@ -783,20 +809,20 @@ function normalizeAccessionNumber(input) {
|
|
|
783
809
|
* Resolve filing archive: fetch index + primary document HTML.
|
|
784
810
|
* Used on cache misses to get both the document content and index metadata.
|
|
785
811
|
*/
|
|
786
|
-
async function resolveFilingArchive(api, accessionNumber, providedCik, requestedDocument) {
|
|
787
|
-
const candidateCiks = await resolveCandidateCiks(api, accessionNumber, providedCik);
|
|
812
|
+
async function resolveFilingArchive(api, scope, accessionNumber, providedCik, requestedDocument) {
|
|
813
|
+
const candidateCiks = await resolveCandidateCiks(api, scope, accessionNumber, providedCik);
|
|
788
814
|
/** The last archive path whose index exists, with its records, for the error catalog. */
|
|
789
815
|
let lastIndexed;
|
|
790
816
|
/** First archive path whose index named a primary the archive answered 404 for. */
|
|
791
817
|
let unserved;
|
|
792
818
|
let requestedNotServed = false;
|
|
793
819
|
for (const cik of candidateCiks) {
|
|
794
|
-
const index = await api.tryGetFilingIndex(cik, accessionNumber);
|
|
820
|
+
const index = await api.tryGetFilingIndex(cik, accessionNumber, scope);
|
|
795
821
|
if (!index)
|
|
796
822
|
continue;
|
|
797
823
|
// Records name the primary every outcome below reports, error catalogs included.
|
|
798
824
|
const items = index.directory.item;
|
|
799
|
-
const records = await readFilingRecords(api, cik, accessionNumber);
|
|
825
|
+
const records = await readFilingRecords(api, scope, cik, accessionNumber);
|
|
800
826
|
lastIndexed = { items, records };
|
|
801
827
|
if (requestedDocument && !items.some((item) => item.name === requestedDocument))
|
|
802
828
|
continue;
|
|
@@ -823,7 +849,7 @@ async function resolveFilingArchive(api, accessionNumber, providedCik, requested
|
|
|
823
849
|
documents,
|
|
824
850
|
};
|
|
825
851
|
}
|
|
826
|
-
const html = await api.tryGetFilingDocument(cik, accessionNumber, targetName);
|
|
852
|
+
const html = await api.tryGetFilingDocument(cik, accessionNumber, targetName, scope);
|
|
827
853
|
if (html)
|
|
828
854
|
return { ok: true, cik, html, index, targetName, filingPrimaryName, records };
|
|
829
855
|
if (requestedDocument)
|
|
@@ -841,7 +867,7 @@ async function resolveFilingArchive(api, accessionNumber, providedCik, requested
|
|
|
841
867
|
*/
|
|
842
868
|
const submission = `${accessionNumber}.txt`;
|
|
843
869
|
if (unserved && unserved.primary !== submission) {
|
|
844
|
-
const html = await api.tryGetFilingDocument(unserved.cik, accessionNumber, submission);
|
|
870
|
+
const html = await api.tryGetFilingDocument(unserved.cik, accessionNumber, submission, scope);
|
|
845
871
|
if (html) {
|
|
846
872
|
return {
|
|
847
873
|
ok: true,
|
|
@@ -877,15 +903,15 @@ async function resolveFilingArchive(api, accessionNumber, providedCik, requested
|
|
|
877
903
|
* document body. Used on cache hits, with the CIK whose archive served the cached
|
|
878
904
|
* text, to get metadata while skipping the expensive document fetch.
|
|
879
905
|
*/
|
|
880
|
-
async function resolveFilingMeta(api, accessionNumber, cik, requestedDocument) {
|
|
881
|
-
const index = await api.tryGetFilingIndex(cik, accessionNumber);
|
|
906
|
+
async function resolveFilingMeta(api, scope, accessionNumber, cik, requestedDocument) {
|
|
907
|
+
const index = await api.tryGetFilingIndex(cik, accessionNumber, scope);
|
|
882
908
|
if (!index)
|
|
883
909
|
return { ok: false };
|
|
884
910
|
const items = index.directory.item;
|
|
885
911
|
if (requestedDocument && !items.some((item) => item.name === requestedDocument)) {
|
|
886
912
|
return { ok: false };
|
|
887
913
|
}
|
|
888
|
-
const records = await readFilingRecords(api, cik, accessionNumber);
|
|
914
|
+
const records = await readFilingRecords(api, scope, cik, accessionNumber);
|
|
889
915
|
const filingPrimaryName = findPrimaryDocument(items, accessionNumber, records);
|
|
890
916
|
if (!filingPrimaryName)
|
|
891
917
|
return { ok: false };
|
|
@@ -896,17 +922,17 @@ async function resolveFilingMeta(api, accessionNumber, cik, requestedDocument) {
|
|
|
896
922
|
* missing header page is `null`; the feed is required for the response metadata,
|
|
897
923
|
* so its failure fails the call as it always has.
|
|
898
924
|
*/
|
|
899
|
-
async function readFilingRecords(api, cik, accessionNumber) {
|
|
925
|
+
async function readFilingRecords(api, scope, cik, accessionNumber) {
|
|
900
926
|
const [submissions, headers] = await Promise.all([
|
|
901
|
-
api.getSubmissions(cik),
|
|
902
|
-
api.tryGetFilingHeaders(cik, accessionNumber),
|
|
927
|
+
api.getSubmissions(cik, scope),
|
|
928
|
+
api.tryGetFilingHeaders(cik, accessionNumber, scope),
|
|
903
929
|
]);
|
|
904
930
|
return { headers, submissions };
|
|
905
931
|
}
|
|
906
|
-
async function resolveCandidateCiks(api, accessionNumber, providedCik) {
|
|
932
|
+
async function resolveCandidateCiks(api, scope, accessionNumber, providedCik) {
|
|
907
933
|
if (providedCik)
|
|
908
934
|
return [providedCik.padStart(10, '0')];
|
|
909
|
-
const ciks = await api.findFilingCiks(accessionNumber);
|
|
935
|
+
const ciks = await api.findFilingCiks(accessionNumber, scope);
|
|
910
936
|
const prefixCik = (accessionNumber.split('-')[0] ?? accessionNumber.slice(0, 10)).padStart(10, '0');
|
|
911
937
|
return [...new Set([...ciks, prefixCik])];
|
|
912
938
|
}
|