@cyanheads/usaspending-mcp-server 0.7.0 → 0.7.2
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 -5
- package/CLAUDE.md +8 -5
- package/README.md +48 -27
- package/changelog/0.7.x/0.7.1.md +26 -0
- package/changelog/0.7.x/0.7.2.md +33 -0
- package/changelog/template.md +10 -3
- package/dist/config/server-config.d.ts +13 -0
- package/dist/config/server-config.d.ts.map +1 -1
- package/dist/config/server-config.js +24 -0
- package/dist/config/server-config.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/tools/definitions/autocomplete-filters.tool.d.ts +14 -2
- package/dist/mcp-server/tools/definitions/autocomplete-filters.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/autocomplete-filters.tool.js +136 -40
- package/dist/mcp-server/tools/definitions/autocomplete-filters.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/count-limit.d.ts +69 -0
- package/dist/mcp-server/tools/definitions/count-limit.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/count-limit.js +87 -0
- package/dist/mcp-server/tools/definitions/count-limit.js.map +1 -0
- package/dist/mcp-server/tools/definitions/disaster-spending.tool.d.ts +16 -1
- package/dist/mcp-server/tools/definitions/disaster-spending.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/disaster-spending.tool.js +107 -37
- package/dist/mcp-server/tools/definitions/disaster-spending.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/filters.d.ts +63 -1
- package/dist/mcp-server/tools/definitions/filters.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/filters.js +116 -1
- package/dist/mcp-server/tools/definitions/filters.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-agency.tool.d.ts +7 -0
- package/dist/mcp-server/tools/definitions/get-agency.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-agency.tool.js +94 -50
- package/dist/mcp-server/tools/definitions/get-agency.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-award-federal-accounts.tool.d.ts +5 -0
- package/dist/mcp-server/tools/definitions/get-award-federal-accounts.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-award-federal-accounts.tool.js +15 -12
- package/dist/mcp-server/tools/definitions/get-award-federal-accounts.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-award-subawards.tool.d.ts +5 -0
- package/dist/mcp-server/tools/definitions/get-award-subawards.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-award-subawards.tool.js +14 -11
- package/dist/mcp-server/tools/definitions/get-award-subawards.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-award-transactions.tool.d.ts +5 -0
- package/dist/mcp-server/tools/definitions/get-award-transactions.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-award-transactions.tool.js +17 -11
- package/dist/mcp-server/tools/definitions/get-award-transactions.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-award.tool.d.ts +30 -0
- package/dist/mcp-server/tools/definitions/get-award.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-award.tool.js +110 -2
- package/dist/mcp-server/tools/definitions/get-award.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-federal-account-breakdown.tool.d.ts +5 -0
- package/dist/mcp-server/tools/definitions/get-federal-account-breakdown.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-federal-account-breakdown.tool.js +18 -11
- package/dist/mcp-server/tools/definitions/get-federal-account-breakdown.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-idv-awards.tool.d.ts +16 -1
- package/dist/mcp-server/tools/definitions/get-idv-awards.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-idv-awards.tool.js +29 -19
- package/dist/mcp-server/tools/definitions/get-idv-awards.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-recipient.tool.d.ts +40 -1
- package/dist/mcp-server/tools/definitions/get-recipient.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-recipient.tool.js +185 -5
- package/dist/mcp-server/tools/definitions/get-recipient.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/index.d.ts +327 -6
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/list-agencies.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/list-agencies.tool.js +3 -5
- package/dist/mcp-server/tools/definitions/list-agencies.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/locations.d.ts +20 -9
- package/dist/mcp-server/tools/definitions/locations.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/locations.js +106 -84
- package/dist/mcp-server/tools/definitions/locations.js.map +1 -1
- package/dist/mcp-server/tools/definitions/pagination.d.ts +9 -8
- package/dist/mcp-server/tools/definitions/pagination.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/pagination.js +9 -8
- package/dist/mcp-server/tools/definitions/pagination.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-awards.tool.d.ts +50 -3
- package/dist/mcp-server/tools/definitions/search-awards.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-awards.tool.js +199 -70
- package/dist/mcp-server/tools/definitions/search-awards.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-federal-accounts.tool.d.ts +5 -0
- package/dist/mcp-server/tools/definitions/search-federal-accounts.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-federal-accounts.tool.js +18 -16
- package/dist/mcp-server/tools/definitions/search-federal-accounts.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-recipients.tool.d.ts +5 -0
- package/dist/mcp-server/tools/definitions/search-recipients.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-recipients.tool.js +13 -13
- package/dist/mcp-server/tools/definitions/search-recipients.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/spending-by-category.tool.d.ts +47 -0
- package/dist/mcp-server/tools/definitions/spending-by-category.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/spending-by-category.tool.js +124 -33
- package/dist/mcp-server/tools/definitions/spending-by-category.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/spending-by-geography.tool.d.ts +39 -0
- package/dist/mcp-server/tools/definitions/spending-by-geography.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/spending-by-geography.tool.js +74 -17
- package/dist/mcp-server/tools/definitions/spending-by-geography.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/spending-over-time.tool.d.ts +41 -0
- package/dist/mcp-server/tools/definitions/spending-over-time.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/spending-over-time.tool.js +87 -11
- package/dist/mcp-server/tools/definitions/spending-over-time.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/unavailable-sections.d.ts +42 -0
- package/dist/mcp-server/tools/definitions/unavailable-sections.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/unavailable-sections.js +63 -0
- package/dist/mcp-server/tools/definitions/unavailable-sections.js.map +1 -0
- package/dist/services/usaspending/types.d.ts +102 -5
- package/dist/services/usaspending/types.d.ts.map +1 -1
- package/dist/services/usaspending/types.js +5 -1
- package/dist/services/usaspending/types.js.map +1 -1
- package/dist/services/usaspending/usaspending-service.d.ts +73 -6
- package/dist/services/usaspending/usaspending-service.d.ts.map +1 -1
- package/dist/services/usaspending/usaspending-service.js +206 -20
- package/dist/services/usaspending/usaspending-service.js.map +1 -1
- package/package.json +7 -7
- package/server.json +3 -3
- package/skills/usaspending-guide/SKILL.md +9 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,o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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmBrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-agencies.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/list-agencies.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":"list-agencies.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/list-agencies.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAMjE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0J3B,CAAC"}
|
|
@@ -6,6 +6,7 @@ import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
|
6
6
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
7
|
import { escapeMarkdownInline } from '@cyanheads/mcp-ts-core/utils';
|
|
8
8
|
import { getUSASpendingService } from '../../../services/usaspending/usaspending-service.js';
|
|
9
|
+
import { countInput } from './count-limit.js';
|
|
9
10
|
import { formatCurrency } from './formatting.js';
|
|
10
11
|
export const listAgenciesTool = tool('usaspending_list_agencies', {
|
|
11
12
|
title: 'List Federal Agencies',
|
|
@@ -17,10 +18,7 @@ export const listAgenciesTool = tool('usaspending_list_agencies', {
|
|
|
17
18
|
.default('agency_name')
|
|
18
19
|
.describe('Sort field: agency_name (alphabetical), budget_authority_amount, obligated_amount, or outlay_amount'),
|
|
19
20
|
order: z.enum(['asc', 'desc']).default('asc').describe('Sort direction: asc or desc'),
|
|
20
|
-
limit:
|
|
21
|
-
.number()
|
|
22
|
-
.int()
|
|
23
|
-
.min(1)
|
|
21
|
+
limit: countInput()
|
|
24
22
|
.optional()
|
|
25
23
|
.describe('Agencies per page; omitted returns the full directory. No maximum.'),
|
|
26
24
|
page: z
|
|
@@ -38,7 +36,7 @@ export const listAgenciesTool = tool('usaspending_list_agencies', {
|
|
|
38
36
|
abbreviation: z.string().optional().describe('Agency abbreviation or acronym'),
|
|
39
37
|
toptier_code: z
|
|
40
38
|
.string()
|
|
41
|
-
.describe('
|
|
39
|
+
.describe('Directory toptier agency code (e.g., 097 for DoD, 1601 for Labor); three or four digits — accepted by usaspending_get_agency and search_federal_accounts agency_identifier'),
|
|
42
40
|
agency_slug: z
|
|
43
41
|
.string()
|
|
44
42
|
.optional()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-agencies.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/list-agencies.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,2BAA2B,EAAE;IAChE,KAAK,EAAE,uBAAuB;IAC9B,WAAW,EACT,wbAAwb;IAC1b,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,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C"}
|
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fileoverview Location inputs
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* @fileoverview Location inputs — `usaspending_search_awards` `location_filter`
|
|
3
|
+
* and the place-of-performance and recipient location filters every
|
|
4
|
+
* filter-taking search and analytics tool shares: the advertised code schemas,
|
|
5
|
+
* the US state/territory postal ↔ FIPS table, and resolution of a caller's
|
|
6
|
+
* location into the shape USAspending's location filters match.
|
|
5
7
|
* @module mcp-server/tools/definitions/locations
|
|
6
8
|
*/
|
|
7
9
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
8
|
-
/** The
|
|
10
|
+
/** The postal code of an `autocomplete/location/` state row's `state_name`; undefined for a name the table lacks. */
|
|
11
|
+
export declare function postalForUpstreamStateName(name: string): string | undefined;
|
|
12
|
+
/** The postal code a two-digit state FIPS code stands for; undefined for one the table lacks. */
|
|
13
|
+
export declare function postalForStateFips(fips: string): string | undefined;
|
|
14
|
+
/** The two-digit FIPS code of a postal code; undefined for one the table lacks, armed-forces codes included. */
|
|
15
|
+
export declare function stateFipsForPostal(postal: string): string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* The `location_filter` object of `usaspending_search_awards`, and the object
|
|
18
|
+
* each location key in `filters` takes under its own description.
|
|
19
|
+
*/
|
|
9
20
|
export declare const LocationFilterSchema: z.ZodOptional<z.ZodObject<{
|
|
10
21
|
country: z.ZodOptional<z.ZodPreprocess<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>, unknown>>;
|
|
11
22
|
state: z.ZodOptional<z.ZodPreprocess<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>, unknown>>;
|
|
12
23
|
county: z.ZodOptional<z.ZodPreprocess<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>, unknown>>;
|
|
13
24
|
city: z.ZodOptional<z.ZodString>;
|
|
14
25
|
}, z.core.$strict>>;
|
|
15
|
-
/** A location as `
|
|
26
|
+
/** A location as USAspending's `place_of_performance_locations` and `recipient_locations` match it. */
|
|
16
27
|
export interface SentLocation {
|
|
17
28
|
city?: string;
|
|
18
29
|
country: string;
|
|
@@ -35,11 +46,11 @@ export type LocationResolution = {
|
|
|
35
46
|
* country's own subdivision code and passes through. Shapes that would draw
|
|
36
47
|
* upstream's 422 or an empty page — an unknown US state, a county without a
|
|
37
48
|
* state or under an armed-forces code, a county or FIPS-number state under
|
|
38
|
-
* another country, or parts that
|
|
39
|
-
*
|
|
40
|
-
* it accepts.
|
|
49
|
+
* another country, or parts that name different states — come back as a
|
|
50
|
+
* message naming the offending field under `field`, the input path the
|
|
51
|
+
* location came from, and the form it accepts.
|
|
41
52
|
*/
|
|
42
|
-
export declare function resolveLocation(input?: z.infer<typeof LocationFilterSchema
|
|
53
|
+
export declare function resolveLocation(input?: z.infer<typeof LocationFilterSchema>, field?: string): LocationResolution;
|
|
43
54
|
/** The location as sent, for echoes and notices: `country=USA, state=NM, county=049`. */
|
|
44
55
|
export declare function describeLocation(location: SentLocation): string;
|
|
45
56
|
//# sourceMappingURL=locations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locations.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/locations.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"locations.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/locations.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAwF3C,qHAAqH;AACrH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE3E;AAED,iGAAiG;AACjG,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEnE;AAED,gHAAgH;AAChH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAErE;AAqCD;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;;mBAuB9B,CAAC;AAEJ,uGAAuG;AACvG,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,8FAA8F;AAC9F,MAAM,MAAM,kBAAkB,GAC1B;IAAE,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC;IAAC,EAAE,EAAE,IAAI,CAAA;CAAE,GAChD;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,KAAK,CAAA;CAAE,CAAC;AAInC;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC7B,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,EAC5C,KAAK,SAAoB,GACxB,kBAAkB,CA0FpB;AAED,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAI/D"}
|
|
@@ -1,79 +1,98 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fileoverview Location inputs
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* @fileoverview Location inputs — `usaspending_search_awards` `location_filter`
|
|
3
|
+
* and the place-of-performance and recipient location filters every
|
|
4
|
+
* filter-taking search and analytics tool shares: the advertised code schemas,
|
|
5
|
+
* the US state/territory postal ↔ FIPS table, and resolution of a caller's
|
|
6
|
+
* location into the shape USAspending's location filters match.
|
|
5
7
|
* @module mcp-server/tools/definitions/locations
|
|
6
8
|
*/
|
|
7
9
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
8
10
|
/**
|
|
9
|
-
*
|
|
10
|
-
* 50 states, DC, the five inhabited territories, the freely
|
|
11
|
-
* (FM, MH, PW), and the U.S. Minor Outlying Islands (UM).
|
|
12
|
-
* each as a state under country USA.
|
|
11
|
+
* Every place with a two-digit FIPS code that a US `state` can name, by postal
|
|
12
|
+
* code: the 50 states, DC, the five inhabited territories, the freely
|
|
13
|
+
* associated states (FM, MH, PW), and the U.S. Minor Outlying Islands (UM).
|
|
14
|
+
* Upstream records each as a state under country USA. `upstreamName` is how
|
|
15
|
+
* `autocomplete/location/` spells the place in its state rows — uppercase, and
|
|
16
|
+
* its own spelling (`U.S. VIRGIN ISLANDS`); null for FM, MH, PW, and UM, which
|
|
17
|
+
* it returns no state row for.
|
|
13
18
|
*/
|
|
14
|
-
const
|
|
15
|
-
AL: '01',
|
|
16
|
-
AK: '02',
|
|
17
|
-
AZ: '04',
|
|
18
|
-
AR: '05',
|
|
19
|
-
CA: '06',
|
|
20
|
-
CO: '08',
|
|
21
|
-
CT: '09',
|
|
22
|
-
DE: '10',
|
|
23
|
-
DC: '11',
|
|
24
|
-
FL: '12',
|
|
25
|
-
GA: '13',
|
|
26
|
-
HI: '15',
|
|
27
|
-
ID: '16',
|
|
28
|
-
IL: '17',
|
|
29
|
-
IN: '18',
|
|
30
|
-
IA: '19',
|
|
31
|
-
KS: '20',
|
|
32
|
-
KY: '21',
|
|
33
|
-
LA: '22',
|
|
34
|
-
ME: '23',
|
|
35
|
-
MD: '24',
|
|
36
|
-
MA: '25',
|
|
37
|
-
MI: '26',
|
|
38
|
-
MN: '27',
|
|
39
|
-
MS: '28',
|
|
40
|
-
MO: '29',
|
|
41
|
-
MT: '30',
|
|
42
|
-
NE: '31',
|
|
43
|
-
NV: '32',
|
|
44
|
-
NH: '33',
|
|
45
|
-
NJ: '34',
|
|
46
|
-
NM: '35',
|
|
47
|
-
NY: '36',
|
|
48
|
-
NC: '37',
|
|
49
|
-
ND: '38',
|
|
50
|
-
OH: '39',
|
|
51
|
-
OK: '40',
|
|
52
|
-
OR: '41',
|
|
53
|
-
PA: '42',
|
|
54
|
-
RI: '44',
|
|
55
|
-
SC: '45',
|
|
56
|
-
SD: '46',
|
|
57
|
-
TN: '47',
|
|
58
|
-
TX: '48',
|
|
59
|
-
UT: '49',
|
|
60
|
-
VT: '50',
|
|
61
|
-
VA: '51',
|
|
62
|
-
WA: '53',
|
|
63
|
-
WV: '54',
|
|
64
|
-
WI: '55',
|
|
65
|
-
WY: '56',
|
|
66
|
-
AS: '60',
|
|
67
|
-
GU: '66',
|
|
68
|
-
MP: '69',
|
|
69
|
-
PR: '72',
|
|
70
|
-
VI: '78',
|
|
71
|
-
FM: '64',
|
|
72
|
-
MH: '68',
|
|
73
|
-
PW: '70',
|
|
74
|
-
UM: '74',
|
|
19
|
+
const STATES = {
|
|
20
|
+
AL: { fips: '01', upstreamName: 'ALABAMA' },
|
|
21
|
+
AK: { fips: '02', upstreamName: 'ALASKA' },
|
|
22
|
+
AZ: { fips: '04', upstreamName: 'ARIZONA' },
|
|
23
|
+
AR: { fips: '05', upstreamName: 'ARKANSAS' },
|
|
24
|
+
CA: { fips: '06', upstreamName: 'CALIFORNIA' },
|
|
25
|
+
CO: { fips: '08', upstreamName: 'COLORADO' },
|
|
26
|
+
CT: { fips: '09', upstreamName: 'CONNECTICUT' },
|
|
27
|
+
DE: { fips: '10', upstreamName: 'DELAWARE' },
|
|
28
|
+
DC: { fips: '11', upstreamName: 'DISTRICT OF COLUMBIA' },
|
|
29
|
+
FL: { fips: '12', upstreamName: 'FLORIDA' },
|
|
30
|
+
GA: { fips: '13', upstreamName: 'GEORGIA' },
|
|
31
|
+
HI: { fips: '15', upstreamName: 'HAWAII' },
|
|
32
|
+
ID: { fips: '16', upstreamName: 'IDAHO' },
|
|
33
|
+
IL: { fips: '17', upstreamName: 'ILLINOIS' },
|
|
34
|
+
IN: { fips: '18', upstreamName: 'INDIANA' },
|
|
35
|
+
IA: { fips: '19', upstreamName: 'IOWA' },
|
|
36
|
+
KS: { fips: '20', upstreamName: 'KANSAS' },
|
|
37
|
+
KY: { fips: '21', upstreamName: 'KENTUCKY' },
|
|
38
|
+
LA: { fips: '22', upstreamName: 'LOUISIANA' },
|
|
39
|
+
ME: { fips: '23', upstreamName: 'MAINE' },
|
|
40
|
+
MD: { fips: '24', upstreamName: 'MARYLAND' },
|
|
41
|
+
MA: { fips: '25', upstreamName: 'MASSACHUSETTS' },
|
|
42
|
+
MI: { fips: '26', upstreamName: 'MICHIGAN' },
|
|
43
|
+
MN: { fips: '27', upstreamName: 'MINNESOTA' },
|
|
44
|
+
MS: { fips: '28', upstreamName: 'MISSISSIPPI' },
|
|
45
|
+
MO: { fips: '29', upstreamName: 'MISSOURI' },
|
|
46
|
+
MT: { fips: '30', upstreamName: 'MONTANA' },
|
|
47
|
+
NE: { fips: '31', upstreamName: 'NEBRASKA' },
|
|
48
|
+
NV: { fips: '32', upstreamName: 'NEVADA' },
|
|
49
|
+
NH: { fips: '33', upstreamName: 'NEW HAMPSHIRE' },
|
|
50
|
+
NJ: { fips: '34', upstreamName: 'NEW JERSEY' },
|
|
51
|
+
NM: { fips: '35', upstreamName: 'NEW MEXICO' },
|
|
52
|
+
NY: { fips: '36', upstreamName: 'NEW YORK' },
|
|
53
|
+
NC: { fips: '37', upstreamName: 'NORTH CAROLINA' },
|
|
54
|
+
ND: { fips: '38', upstreamName: 'NORTH DAKOTA' },
|
|
55
|
+
OH: { fips: '39', upstreamName: 'OHIO' },
|
|
56
|
+
OK: { fips: '40', upstreamName: 'OKLAHOMA' },
|
|
57
|
+
OR: { fips: '41', upstreamName: 'OREGON' },
|
|
58
|
+
PA: { fips: '42', upstreamName: 'PENNSYLVANIA' },
|
|
59
|
+
RI: { fips: '44', upstreamName: 'RHODE ISLAND' },
|
|
60
|
+
SC: { fips: '45', upstreamName: 'SOUTH CAROLINA' },
|
|
61
|
+
SD: { fips: '46', upstreamName: 'SOUTH DAKOTA' },
|
|
62
|
+
TN: { fips: '47', upstreamName: 'TENNESSEE' },
|
|
63
|
+
TX: { fips: '48', upstreamName: 'TEXAS' },
|
|
64
|
+
UT: { fips: '49', upstreamName: 'UTAH' },
|
|
65
|
+
VT: { fips: '50', upstreamName: 'VERMONT' },
|
|
66
|
+
VA: { fips: '51', upstreamName: 'VIRGINIA' },
|
|
67
|
+
WA: { fips: '53', upstreamName: 'WASHINGTON' },
|
|
68
|
+
WV: { fips: '54', upstreamName: 'WEST VIRGINIA' },
|
|
69
|
+
WI: { fips: '55', upstreamName: 'WISCONSIN' },
|
|
70
|
+
WY: { fips: '56', upstreamName: 'WYOMING' },
|
|
71
|
+
AS: { fips: '60', upstreamName: 'AMERICAN SAMOA' },
|
|
72
|
+
GU: { fips: '66', upstreamName: 'GUAM' },
|
|
73
|
+
MP: { fips: '69', upstreamName: 'NORTHERN MARIANA ISLANDS' },
|
|
74
|
+
PR: { fips: '72', upstreamName: 'PUERTO RICO' },
|
|
75
|
+
VI: { fips: '78', upstreamName: 'U.S. VIRGIN ISLANDS' },
|
|
76
|
+
FM: { fips: '64', upstreamName: null },
|
|
77
|
+
MH: { fips: '68', upstreamName: null },
|
|
78
|
+
PW: { fips: '70', upstreamName: null },
|
|
79
|
+
UM: { fips: '74', upstreamName: null },
|
|
75
80
|
};
|
|
76
|
-
const
|
|
81
|
+
const STATE_FIPS = Object.fromEntries(Object.entries(STATES).map(([postal, { fips }]) => [postal, fips]));
|
|
82
|
+
const POSTAL_BY_FIPS = Object.fromEntries(Object.entries(STATES).map(([postal, { fips }]) => [fips, postal]));
|
|
83
|
+
const POSTAL_BY_UPSTREAM_NAME = new Map(Object.entries(STATES).flatMap(([postal, { upstreamName }]) => upstreamName ? [[upstreamName, postal]] : []));
|
|
84
|
+
/** The postal code of an `autocomplete/location/` state row's `state_name`; undefined for a name the table lacks. */
|
|
85
|
+
export function postalForUpstreamStateName(name) {
|
|
86
|
+
return POSTAL_BY_UPSTREAM_NAME.get(name);
|
|
87
|
+
}
|
|
88
|
+
/** The postal code a two-digit state FIPS code stands for; undefined for one the table lacks. */
|
|
89
|
+
export function postalForStateFips(fips) {
|
|
90
|
+
return Object.hasOwn(POSTAL_BY_FIPS, fips) ? POSTAL_BY_FIPS[fips] : undefined;
|
|
91
|
+
}
|
|
92
|
+
/** The two-digit FIPS code of a postal code; undefined for one the table lacks, armed-forces codes included. */
|
|
93
|
+
export function stateFipsForPostal(postal) {
|
|
94
|
+
return Object.hasOwn(STATE_FIPS, postal) ? STATE_FIPS[postal] : undefined;
|
|
95
|
+
}
|
|
77
96
|
/**
|
|
78
97
|
* Armed-forces postal codes (Americas, Europe, Pacific). Upstream records them
|
|
79
98
|
* as states under country USA; they have no FIPS code, so no 5-digit county.
|
|
@@ -103,7 +122,10 @@ function blankableCode(pattern, message, description) {
|
|
|
103
122
|
.describe(description)
|
|
104
123
|
.optional();
|
|
105
124
|
}
|
|
106
|
-
/**
|
|
125
|
+
/**
|
|
126
|
+
* The `location_filter` object of `usaspending_search_awards`, and the object
|
|
127
|
+
* each location key in `filters` takes under its own description.
|
|
128
|
+
*/
|
|
107
129
|
export const LocationFilterSchema = z
|
|
108
130
|
.object({
|
|
109
131
|
country: blankableCode(/^[A-Za-z]{3}$/, 'Expected a 3-letter ISO 3166-1 alpha-3 country code (e.g. USA)', 'ISO 3166-1 alpha-3 country code (e.g., USA); USA when omitted. A US territory code — PRI, GUM, VIR, ASM, MNP — is sent as USA with the territory as state.'),
|
|
@@ -113,7 +135,7 @@ export const LocationFilterSchema = z
|
|
|
113
135
|
})
|
|
114
136
|
.strict()
|
|
115
137
|
.optional()
|
|
116
|
-
.describe('Filter by place of performance. Takes codes, not place names —
|
|
138
|
+
.describe('Filter by place of performance. Takes codes, not place names — resolve a state or county name to its code with usaspending_autocomplete_filters type=location. Blank fields are ignored, and an all-blank object is no location filter. The location sent is echoed as applied_location.');
|
|
117
139
|
const fail = (message) => ({ ok: false, message });
|
|
118
140
|
/**
|
|
119
141
|
* Resolves a caller's location into the shape upstream matches: country
|
|
@@ -123,11 +145,11 @@ const fail = (message) => ({ ok: false, message });
|
|
|
123
145
|
* country's own subdivision code and passes through. Shapes that would draw
|
|
124
146
|
* upstream's 422 or an empty page — an unknown US state, a county without a
|
|
125
147
|
* state or under an armed-forces code, a county or FIPS-number state under
|
|
126
|
-
* another country, or parts that
|
|
127
|
-
*
|
|
128
|
-
* it accepts.
|
|
148
|
+
* another country, or parts that name different states — come back as a
|
|
149
|
+
* message naming the offending field under `field`, the input path the
|
|
150
|
+
* location came from, and the form it accepts.
|
|
129
151
|
*/
|
|
130
|
-
export function resolveLocation(input) {
|
|
152
|
+
export function resolveLocation(input, field = 'location_filter') {
|
|
131
153
|
const read = (value) => value?.trim() || undefined;
|
|
132
154
|
const countryIn = read(input?.country)?.toUpperCase();
|
|
133
155
|
const stateIn = read(input?.state)?.toUpperCase();
|
|
@@ -139,10 +161,10 @@ export function resolveLocation(input) {
|
|
|
139
161
|
const country = territory || !countryIn ? 'USA' : countryIn;
|
|
140
162
|
if (country !== 'USA') {
|
|
141
163
|
if (countyIn) {
|
|
142
|
-
return fail(
|
|
164
|
+
return fail(`${field}.county "${countyIn}" is a US county FIPS code, but ${field}.country is ${country}. Drop county, or set country to USA.`);
|
|
143
165
|
}
|
|
144
166
|
if (stateIn && /^\d{2}$/.test(stateIn)) {
|
|
145
|
-
return fail(
|
|
167
|
+
return fail(`${field}.state "${stateIn}" is a US state FIPS code, but ${field}.country is ${country}. Send ${country}'s own 2-letter subdivision code as state, or set country to USA.`);
|
|
146
168
|
}
|
|
147
169
|
return {
|
|
148
170
|
ok: true,
|
|
@@ -154,12 +176,12 @@ export function resolveLocation(input) {
|
|
|
154
176
|
state =
|
|
155
177
|
stateIn in STATE_FIPS || ARMED_FORCES_STATES.has(stateIn) ? stateIn : POSTAL_BY_FIPS[stateIn];
|
|
156
178
|
if (!state) {
|
|
157
|
-
return fail(
|
|
179
|
+
return fail(`${field}.state "${stateIn}" is not a US state, DC, territory, freely associated state, or armed-forces code. Send its 2-letter postal code (NM) or 2-digit FIPS code (35).`);
|
|
158
180
|
}
|
|
159
181
|
}
|
|
160
182
|
if (territory) {
|
|
161
183
|
if (state && state !== territory) {
|
|
162
|
-
return fail(
|
|
184
|
+
return fail(`${field}.state "${stateIn}" contradicts ${field}.country ${countryIn}, which is sent as country USA with state ${territory}. Drop state, or send ${territory}.`);
|
|
163
185
|
}
|
|
164
186
|
state = territory;
|
|
165
187
|
}
|
|
@@ -167,23 +189,23 @@ export function resolveLocation(input) {
|
|
|
167
189
|
if (countyIn?.length === 5) {
|
|
168
190
|
const prefixState = POSTAL_BY_FIPS[countyIn.slice(0, 2)];
|
|
169
191
|
if (!prefixState) {
|
|
170
|
-
return fail(
|
|
192
|
+
return fail(`${field}.county "${countyIn}" starts with ${countyIn.slice(0, 2)}, which is not the FIPS code of a US state, DC, or territory. Send the 5-digit state + county code, or the 3-digit county code with state.`);
|
|
171
193
|
}
|
|
172
194
|
if (state && ARMED_FORCES_STATES.has(state)) {
|
|
173
|
-
return fail(
|
|
195
|
+
return fail(`${field}.county "${countyIn}" lies in ${prefixState} (FIPS ${countyIn.slice(0, 2)}), but the state is ${state}, an armed-forces code with no FIPS code. Drop county, or drop state to search that county in ${prefixState}.`);
|
|
174
196
|
}
|
|
175
197
|
if (state && state !== prefixState) {
|
|
176
|
-
return fail(
|
|
198
|
+
return fail(`${field}.county "${countyIn}" lies in ${prefixState} (FIPS ${countyIn.slice(0, 2)}), but the state is ${state}. Send a county in ${state}: its 3-digit code, or a 5-digit code starting ${STATE_FIPS[state]}.`);
|
|
177
199
|
}
|
|
178
200
|
state = prefixState;
|
|
179
201
|
county = countyIn.slice(2);
|
|
180
202
|
}
|
|
181
203
|
else if (countyIn) {
|
|
182
204
|
if (!state) {
|
|
183
|
-
return fail(
|
|
205
|
+
return fail(`${field}.county "${countyIn}" needs ${field}.state: a 3-digit county code is unique only within its state. Add state, or send the 5-digit state + county code.`);
|
|
184
206
|
}
|
|
185
207
|
if (ARMED_FORCES_STATES.has(state)) {
|
|
186
|
-
return fail(
|
|
208
|
+
return fail(`${field}.county "${countyIn}" cannot be sent with state ${state}, an armed-forces code with no counties. Drop county, or send a US state with it.`);
|
|
187
209
|
}
|
|
188
210
|
county = countyIn;
|
|
189
211
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locations.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/locations.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"locations.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/locations.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAE3C;;;;;;;;GAQG;AACH,MAAM,MAAM,GAAG;IACb,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE;IAC3C,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE;IAC1C,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE;IAC3C,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE;IAC5C,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE;IAC9C,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE;IAC5C,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,aAAa,EAAE;IAC/C,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE;IAC5C,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,sBAAsB,EAAE;IACxD,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE;IAC3C,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE;IAC3C,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAA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C,CAAC,CAAC,EAAE,CAAC;SAC1B;KACF,CAAC;AACJ,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,gBAAgB,CAAC,QAAsB;IACrD,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC;SAC5B,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;SACxC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -5,15 +5,16 @@
|
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
7
|
* Resolves the continuation flag for endpoints whose `hasNext` under-reports: one
|
|
8
|
-
* USAspending endpoint, `search/spending_by_award/`,
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* USAspending endpoint, `search/spending_by_award/`, computes its page-number flag
|
|
9
|
+
* from Elasticsearch's 10,000-capped hit total. Below a 10,000-result offset the flag
|
|
10
|
+
* is exact, an exactly-full final page included; from that offset on it reads
|
|
11
|
+
* `hasNext: false` on every page, full ones included, which reads as a clean
|
|
12
|
+
* end-of-results and strands every remaining match. A full page (`shown >= limit`)
|
|
13
|
+
* forces continuation; a short or empty page marks the end.
|
|
12
14
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* round trip instead of silently truncated results.
|
|
15
|
+
* The fallback is what over-reports: an exactly-full final page reports one page more
|
|
16
|
+
* than exists — an extra round trip instead of silently truncated results. Award search
|
|
17
|
+
* applies it only when it has no total to compare against.
|
|
17
18
|
*
|
|
18
19
|
* Apply it only where the flag is known to lie, or where no independent cross-check
|
|
19
20
|
* exists. Every other paginated endpoint on this server was verified truthful, and a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/pagination.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/pagination.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAC5B,eAAe,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,EAC3C,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,OAAO,CAET;AAED,gFAAgF;AAChF,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,eAAe,EAAE,MAAM,GACtB,MAAM,CAMR;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,GAAG,MAAM,CAIT"}
|
|
@@ -5,15 +5,16 @@
|
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
7
|
* Resolves the continuation flag for endpoints whose `hasNext` under-reports: one
|
|
8
|
-
* USAspending endpoint, `search/spending_by_award/`,
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* USAspending endpoint, `search/spending_by_award/`, computes its page-number flag
|
|
9
|
+
* from Elasticsearch's 10,000-capped hit total. Below a 10,000-result offset the flag
|
|
10
|
+
* is exact, an exactly-full final page included; from that offset on it reads
|
|
11
|
+
* `hasNext: false` on every page, full ones included, which reads as a clean
|
|
12
|
+
* end-of-results and strands every remaining match. A full page (`shown >= limit`)
|
|
13
|
+
* forces continuation; a short or empty page marks the end.
|
|
12
14
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* round trip instead of silently truncated results.
|
|
15
|
+
* The fallback is what over-reports: an exactly-full final page reports one page more
|
|
16
|
+
* than exists — an extra round trip instead of silently truncated results. Award search
|
|
17
|
+
* applies it only when it has no total to compare against.
|
|
17
18
|
*
|
|
18
19
|
* Apply it only where the flag is known to lie, or where no independent cross-check
|
|
19
20
|
* exists. Every other paginated endpoint on this server was verified truthful, and a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/pagination.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/pagination.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,cAAc,CAC5B,eAA2C,EAC3C,KAAa,EACb,KAAa;IAEb,OAAO,CAAC,eAAe,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,KAAK,CAAC;AACtD,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,eAAe,CAC7B,IAAY,EACZ,KAAa,EACb,KAAyB,EACzB,eAAuB;IAEvB,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,eAAe,CAAC;IACxC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,IAAI,KAAK,EAAE,CAAC;QACpE,OAAO,QAAQ,IAAI,2BAA2B,KAAK,CAAC,cAAc,EAAE,mEAAmE,CAAC;IAC1I,CAAC;IACD,OAAO,QAAQ,IAAI,wBAAwB,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,oBAAoB,KAAK,CAAC,cAAc,EAAE,qCAAqC,CAAC,CAAC,CAAC,8CAA8C,EAAE,CAAC;AACtM,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,oBAAoB,CAAC,EAKpC;IACC,MAAM,UAAU,GACd,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,wBAAwB,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACpF,OAAO,aAAa,EAAE,CAAC,IAAI,GAAG,UAAU,oBAAoB,EAAE,CAAC,KAAK,oBAAoB,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACvH,CAAC"}
|