@invaro/opentax 0.1.0 → 0.2.0

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 (69) hide show
  1. package/README.md +64 -0
  2. package/bundle/http.js +37595 -0
  3. package/bundle/index.js +36289 -0
  4. package/bundle/main.js +45281 -0
  5. package/package.json +16 -14
  6. package/dist/documents.d.ts +0 -177
  7. package/dist/documents.d.ts.map +0 -1
  8. package/dist/documents.js +0 -246
  9. package/dist/documents.js.map +0 -1
  10. package/dist/hosted-bundle.d.ts +0 -8
  11. package/dist/hosted-bundle.d.ts.map +0 -1
  12. package/dist/hosted-bundle.js +0 -8
  13. package/dist/hosted-bundle.js.map +0 -1
  14. package/dist/http.d.ts +0 -15
  15. package/dist/http.d.ts.map +0 -1
  16. package/dist/http.js +0 -90
  17. package/dist/http.js.map +0 -1
  18. package/dist/index.d.ts +0 -9
  19. package/dist/index.d.ts.map +0 -1
  20. package/dist/index.js +0 -13
  21. package/dist/index.js.map +0 -1
  22. package/dist/schema.d.ts +0 -60
  23. package/dist/schema.d.ts.map +0 -1
  24. package/dist/schema.js +0 -467
  25. package/dist/schema.js.map +0 -1
  26. package/dist/server.d.ts +0 -14
  27. package/dist/server.d.ts.map +0 -1
  28. package/dist/server.js +0 -509
  29. package/dist/server.js.map +0 -1
  30. package/dist/state-return/ca.d.ts +0 -3
  31. package/dist/state-return/ca.d.ts.map +0 -1
  32. package/dist/state-return/ca.js +0 -108
  33. package/dist/state-return/ca.js.map +0 -1
  34. package/dist/state-return/il.d.ts +0 -3
  35. package/dist/state-return/il.d.ts.map +0 -1
  36. package/dist/state-return/il.js +0 -64
  37. package/dist/state-return/il.js.map +0 -1
  38. package/dist/state-return/index.d.ts +0 -8
  39. package/dist/state-return/index.d.ts.map +0 -1
  40. package/dist/state-return/index.js +0 -38
  41. package/dist/state-return/index.js.map +0 -1
  42. package/dist/state-return/money.d.ts +0 -10
  43. package/dist/state-return/money.d.ts.map +0 -1
  44. package/dist/state-return/money.js +0 -18
  45. package/dist/state-return/money.js.map +0 -1
  46. package/dist/state-return/ny.d.ts +0 -3
  47. package/dist/state-return/ny.d.ts.map +0 -1
  48. package/dist/state-return/ny.js +0 -59
  49. package/dist/state-return/ny.js.map +0 -1
  50. package/dist/state-return/shape.d.ts +0 -80
  51. package/dist/state-return/shape.d.ts.map +0 -1
  52. package/dist/state-return/shape.js +0 -97
  53. package/dist/state-return/shape.js.map +0 -1
  54. package/dist/state-return/types.d.ts +0 -17
  55. package/dist/state-return/types.d.ts.map +0 -1
  56. package/dist/state-return/types.js +0 -6
  57. package/dist/state-return/types.js.map +0 -1
  58. package/dist/state-return/va-worksheets.d.ts +0 -70
  59. package/dist/state-return/va-worksheets.d.ts.map +0 -1
  60. package/dist/state-return/va-worksheets.js +0 -116
  61. package/dist/state-return/va-worksheets.js.map +0 -1
  62. package/dist/state-return/va.d.ts +0 -3
  63. package/dist/state-return/va.d.ts.map +0 -1
  64. package/dist/state-return/va.js +0 -130
  65. package/dist/state-return/va.js.map +0 -1
  66. package/dist/state-return.d.ts +0 -4
  67. package/dist/state-return.d.ts.map +0 -1
  68. package/dist/state-return.js +0 -3
  69. package/dist/state-return.js.map +0 -1
package/dist/index.d.ts DELETED
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * @invaro/opentax stdio entry — the tax oracle for AI agents over the Model
4
- * Context Protocol.
5
- *
6
- * claude mcp add opentax -- npx -y @invaro/opentax
7
- */
8
- export {};
9
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;GAKG"}
package/dist/index.js DELETED
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * @invaro/opentax stdio entry — the tax oracle for AI agents over the Model
4
- * Context Protocol.
5
- *
6
- * claude mcp add opentax -- npx -y @invaro/opentax
7
- */
8
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
9
- import { createServer } from "./server.js";
10
- const server = createServer();
11
- const transport = new StdioServerTransport();
12
- await server.connect(transport);
13
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;AAC9B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
package/dist/schema.d.ts DELETED
@@ -1,60 +0,0 @@
1
- /**
2
- * MCP input schema — GENERATED from the corpus fact registry.
3
- *
4
- * The corpus is the single source of truth: a fact added there can never be
5
- * silently absent here (schema.test.ts pins a full PARTITION — every fact
6
- * belongs to exactly one domain tool and, within the individual domain, to
7
- * exactly one group), and tool inputs are validated STRICTLY — an unknown
8
- * key is an error naming the key, never a silent strip. A confident answer
9
- * computed from silently dropped facts is exactly the failure mode this
10
- * engine exists to prevent.
11
- *
12
- * Context economy (the tiered design):
13
- * - calculate_tax advertises the INDIVIDUAL facts, nested into groups
14
- * (filing, income, retirement, credits, …) so agents fill related fields
15
- * together instead of navigating a 170-key wall.
16
- * - Business-entity, fiduciary, and dependent-determination facts live on
17
- * their own tools with flat, fully-described schemas.
18
- * - The other fact-taking tools (verify_tax_claim, find_tax_cliffs,
19
- * compare_filing_statuses) advertise one compact `facts` object param,
20
- * runtime-validated by the same strict validator over ALL domains —
21
- * identical strictness, advertised once.
22
- *
23
- * Every fact is optional at the schema level: the engine demands the facts
24
- * the requested target actually needs and names any that are missing.
25
- */
26
- import { z } from "zod";
27
- import type { TypedValueJSON } from "@invaro/opentax-core";
28
- export declare const corpus: import("@invaro/opentax-core").LoadedCorpus;
29
- export declare const money: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
30
- export declare function domainOf(id: string): "business" | "fiduciary" | "dependent" | "individual";
31
- /** Individual facts, grouped for the nested calculate_tax schema. */
32
- export declare const INDIVIDUAL_GROUPS: Record<string, readonly string[]>;
33
- export declare function factIdsForDomain(domain: "business" | "fiduciary" | "dependent" | "individual"): string[];
34
- /** Nested individual schema advertised on calculate_tax. */
35
- export declare const individualNestedShape: Record<string, z.ZodTypeAny>;
36
- /** Flat business-entity schema advertised on calculate_business_tax. */
37
- export declare const businessShape: Record<string, z.ZodTypeAny>;
38
- /** Flat Form 1041 schema advertised on calculate_fiduciary_tax. */
39
- export declare const fiduciaryShape: Record<string, z.ZodTypeAny>;
40
- /** Flat § 152 dependent-determination schema advertised on determine_dependent. */
41
- export declare const dependentShape: Record<string, z.ZodTypeAny>;
42
- /** Flat validator over ALL facts + target/asOf — the single strict backstop. */
43
- export declare const FACT_SHAPE: Record<string, z.ZodTypeAny>;
44
- export declare const factsObjectParam: z.ZodRecord<z.ZodString, z.ZodUnknown>;
45
- /** Accepts grouped, flat, or mixed input; returns one flat fact record. */
46
- export declare function flattenFactsArg(input: Record<string, unknown>): Record<string, unknown>;
47
- export declare function buildFacts(args: Record<string, unknown>, defaultTarget?: string): {
48
- facts: Record<string, TypedValueJSON>;
49
- asOf: string;
50
- target: string;
51
- };
52
- /**
53
- * Strict-validate a facts input (grouped, flat, or mixed), then build engine
54
- * facts. Unknown keys error by name — identical strictness on every tool.
55
- */
56
- export declare function buildFactsValidated(factsArg: unknown, defaultTarget?: string): ReturnType<typeof buildFacts> & {
57
- documentNotes: string[];
58
- w2Box1Cents?: bigint;
59
- };
60
- //# sourceMappingURL=schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO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AAE,OAAO,CAAC,EAC7B,aAAa,GAAE,MAAuB,GACrC;IACD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAmCA;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,OAAO,EACjB,aAAa,CAAC,EAAE,MAAM,GACrB,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG;IAAE,aAAa,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAiDnF"}
package/dist/schema.js DELETED
@@ -1,467 +0,0 @@
1
- /**
2
- * MCP input schema — GENERATED from the corpus fact registry.
3
- *
4
- * The corpus is the single source of truth: a fact added there can never be
5
- * silently absent here (schema.test.ts pins a full PARTITION — every fact
6
- * belongs to exactly one domain tool and, within the individual domain, to
7
- * exactly one group), and tool inputs are validated STRICTLY — an unknown
8
- * key is an error naming the key, never a silent strip. A confident answer
9
- * computed from silently dropped facts is exactly the failure mode this
10
- * engine exists to prevent.
11
- *
12
- * Context economy (the tiered design):
13
- * - calculate_tax advertises the INDIVIDUAL facts, nested into groups
14
- * (filing, income, retirement, credits, …) so agents fill related fields
15
- * together instead of navigating a 170-key wall.
16
- * - Business-entity, fiduciary, and dependent-determination facts live on
17
- * their own tools with flat, fully-described schemas.
18
- * - The other fact-taking tools (verify_tax_claim, find_tax_cliffs,
19
- * compare_filing_statuses) advertise one compact `facts` object param,
20
- * runtime-validated by the same strict validator over ALL domains —
21
- * identical strictness, advertised once.
22
- *
23
- * Every fact is optional at the schema level: the engine demands the facts
24
- * the requested target actually needs and names any that are missing.
25
- */
26
- import { z } from "zod";
27
- import { coerceFacts } from "@invaro/opentax-core";
28
- import { DEFAULT_TARGET, getCorpus, matchOccupation } from "@invaro/opentax-corpus-us-federal";
29
- import { compileDocuments, documentsShape } from "./documents.js";
30
- export const corpus = getCorpus();
31
- export const money = z
32
- .union([z.number(), z.string()])
33
- .describe('dollars, e.g. 50000 or "1234.56"');
34
- function zodForFact(f) {
35
- // occupation stays free text — fuzzy-matched to the Treasury Tipped
36
- // Occupation list in buildFacts so agents can pass "bartender" verbatim
37
- if (f.id === "occupation") {
38
- return z
39
- .string()
40
- .describe('tipped occupation, fuzzy-matched to the Treasury Tipped Occupation list (Treas. Reg. § 1.224-1) — e.g. "bartender", "nanny" — or "other" if genuinely unlisted. Only needed when qualifiedTips > 0.');
41
- }
42
- switch (f.type) {
43
- case "money":
44
- return money.describe(f.description);
45
- case "bool":
46
- return z.boolean().describe(f.description);
47
- case "int":
48
- return z.union([z.number().int(), z.string()]).describe(f.description);
49
- case "enum":
50
- return z.enum(f.enumValues).describe(f.description);
51
- default:
52
- return z.string().describe(f.description);
53
- }
54
- }
55
- const targetParam = (defaultLabel, determinations) => z
56
- .string()
57
- .optional()
58
- .describe(`rule to derive (default: ${defaultLabel}).${determinations ? ` ${determinations}` : ""}`);
59
- const asOfParam = z
60
- .string()
61
- .regex(/^\d{4}-\d{2}-\d{2}$/)
62
- .optional()
63
- .describe('REQUIRED for computation: the law-in-force date — use the intended tax year\'s year-end (e.g. "2025-12-31" for TY2025). Omitting it is an error, never a default.');
64
- // ---------------------------------------------------------------------------
65
- // domain partition: business / fiduciary / dependent by prefix + explicit
66
- // sets; everything remaining is INDIVIDUAL and must be claimed by exactly
67
- // one group below (the partition test enforces both directions)
68
- // ---------------------------------------------------------------------------
69
- const BUSINESS_EXTRAS = new Set([
70
- "entityLegalForm",
71
- "llcMemberCount",
72
- "filedForm8832CorpElection",
73
- "filedForm2553SElection",
74
- "employeeAnnualWages",
75
- "qreCurrentYear",
76
- "qreAvgPrior3Years",
77
- "generalBusinessCredits",
78
- ]);
79
- const DEPENDENT_EXTRAS = new Set([
80
- "taxpayerProvidedOverHalfSupport",
81
- "hasMultipleSupportAgreement",
82
- "taxpayerProvidedOver10PercentSupport",
83
- "taxpayerIsCustodialParent",
84
- "custodialParentReleasedClaim",
85
- ]);
86
- export function domainOf(id) {
87
- if (id.startsWith("corp") || id.startsWith("sCorp") || BUSINESS_EXTRAS.has(id))
88
- return "business";
89
- if (id.startsWith("fiduciary"))
90
- return "fiduciary";
91
- // dep[A-Z]… are the § 152 candidate-person facts; "dependentCareExpenses"
92
- // (§ 21 credit input) must NOT match — the partition test caught exactly that
93
- if (/^dep[A-Z]/.test(id) || DEPENDENT_EXTRAS.has(id))
94
- return "dependent";
95
- return "individual";
96
- }
97
- /** Individual facts, grouped for the nested calculate_tax schema. */
98
- export const INDIVIDUAL_GROUPS = {
99
- filing: [
100
- "mfsConsideredUnmarried",
101
- "mfsLivedApartAllYear",
102
- "filingStatus",
103
- "isAge65OrOlder",
104
- "isBlind",
105
- "spouseIsAge65OrOlder",
106
- "spouseIsBlind",
107
- "isClaimedAsDependent",
108
- "isFullTimeStudent",
109
- "spouseIsFullTimeStudent",
110
- "isAtLeastAge25",
111
- "spouseItemizes",
112
- "useFormulaMethod",
113
- ],
114
- income: [
115
- "alimonyReceivedPre2019",
116
- "wages",
117
- "taxableInterest",
118
- "taxExemptInterest",
119
- "longTermCapitalGains",
120
- "qualifiedDividends",
121
- "shortTermCapitalGains",
122
- "ordinaryDividends",
123
- "netCapitalLoss",
124
- "unemploymentCompensation",
125
- "otherOrdinaryIncome",
126
- "socialSecurityWages",
127
- "medicareWages",
128
- "foreignEarnedIncome",
129
- ],
130
- tips_overtime: [
131
- "qualifiedTips",
132
- "occupation",
133
- "tipsWereVoluntary",
134
- "employerIsSSTB",
135
- "qualifiedOvertimePremium",
136
- ],
137
- retirement: [
138
- "hsaDistributions",
139
- "hsaQualifiedMedicalExpenses",
140
- "hsaDistributionPenaltyExempt",
141
- "socialSecurityBenefits",
142
- "taxableIraDistributions",
143
- "taxablePensionsAndAnnuities",
144
- "earlyDistributionSubjectToPenalty",
145
- // Form 8606 basis pro-rata — standalone target us.federal.ira8606.*
146
- "ira8606Basis",
147
- "ira8606NondeductibleContributions",
148
- "ira8606YearEndValue",
149
- "ira8606Distributions",
150
- "ira8606Conversions",
151
- ],
152
- self_employment: [
153
- "selfEmploymentNetProfit",
154
- "scheduleCNetLoss",
155
- "k1OrdinaryBusinessIncome",
156
- "qbiW2Wages",
157
- "qbiUBIA",
158
- "businessIsSSTB",
159
- "sepContribution",
160
- "selfEmployedHealthPremiums",
161
- "homeOfficeSquareFeet",
162
- "businessMilesDriven",
163
- "aggregateBusinessLoss",
164
- ],
165
- adjustments: [
166
- "alimonyPaidPre2019",
167
- "spouseEducatorExpenses",
168
- "iraContribution",
169
- "isActivePlanParticipant",
170
- "spouseIsActivePlanParticipant",
171
- "isAge50OrOlder",
172
- "hsaContribution",
173
- "hsaCoverage",
174
- "isAge55OrOlder",
175
- "studentLoanInterest",
176
- "carLoanInterest",
177
- "educatorExpenses",
178
- "earlyWithdrawalPenaltyPaid",
179
- "otherAdjustments",
180
- ],
181
- itemized: [
182
- "stateAndLocalTaxesPaid",
183
- "mortgageInterestPaid",
184
- "mortgageAverageBalance",
185
- "medicalExpenses",
186
- "charitableCashContributions",
187
- "noncashCharitableContributions",
188
- "investmentInterestDeduction",
189
- "gamblingLossesItemized",
190
- "otherItemizedDeductions",
191
- "casualtyFederalDisasterLosses",
192
- "casualtyQualifiedDisasterLosses",
193
- "forceItemized",
194
- ],
195
- credits: [
196
- "qualifyingChildren",
197
- "otherDependents",
198
- "dependentCareExpenses",
199
- "careQualifyingIndividuals",
200
- "secondaryEarnedIncome",
201
- "saversContributions",
202
- "saversContributionsSpouse",
203
- "qualifiedAdoptionExpenses",
204
- "adoptionIsSpecialNeeds",
205
- "aotcExpensesStudent1",
206
- "aotcExpensesStudent2",
207
- "aotcExpensesStudent3",
208
- "llcQualifiedExpenses",
209
- "eitcAdditionalQualifyingChildren",
210
- "isRetiredOnTotalDisability",
211
- "scheduleRDisabilityIncome",
212
- "nontaxableBenefitsForScheduleR",
213
- ],
214
- healthcare_ptc: [
215
- "mfsAbuseOrAbandonmentException",
216
- "slcspAnnualPremium",
217
- "marketplacePremiumsPaid",
218
- "advancePTC",
219
- "ptcHouseholdSize",
220
- ],
221
- kiddie_tax: [
222
- "isSubjectToKiddieTax",
223
- "parentTaxableIncome",
224
- "parentFilingStatus",
225
- "parentHasPreferentialIncome",
226
- ],
227
- investor_amt: [
228
- "amtIsoExerciseSpread",
229
- "amtOtherPreferences",
230
- "niitInvestmentExpenses",
231
- "qsbsGain",
232
- "qsbsAcquiredAfterJuly2025",
233
- "qsbsAcquiredAfterSept2010",
234
- "qsbsHoldingPeriodYears",
235
- ],
236
- rentals_passive: [
237
- "scheduleENetIncome",
238
- "passiveActivityIncome",
239
- "selfRentalNetIncome",
240
- "passiveActivityLosses",
241
- "rentalActiveParticipationLosses",
242
- "nonpassiveScheduleELoss",
243
- "qbiLossOffset",
244
- ],
245
- state: [
246
- "stateTaxableIncome",
247
- "hasChildUnderSix",
248
- "caRentedPrincipalResidence",
249
- "caAmti",
250
- "caRegularTax",
251
- "nyYonkersBase",
252
- "nyIt214Fagi",
253
- "nyIt214Eligible",
254
- "nyIt214TotalRent",
255
- "nyIt214RentPercent",
256
- "nyIt214MonthsPaid",
257
- "nyIt214HomeownerTaxes",
258
- "nyIt216StateCredit",
259
- "nyIt216Under4Expenses",
260
- "nyIt216TotalExpenses",
261
- ],
262
- household_employer: ["householdEmployeeCashWages", "householdFutaTestMet"],
263
- payments_estimates: [
264
- "federalEstimatedPayments",
265
- "federalExtensionPayment",
266
- "federalTaxWithheld",
267
- "priorYearTax",
268
- "priorYearAGI",
269
- "isFarmerOrFisherman",
270
- "wagesThroughMar31",
271
- "wagesThroughMay31",
272
- "wagesThroughAug31",
273
- "seProfitThroughMar31",
274
- "seProfitThroughMay31",
275
- "seProfitThroughAug31",
276
- ],
277
- };
278
- const GROUP_NAMES = new Set(Object.keys(INDIVIDUAL_GROUPS));
279
- const factById = new Map(corpus.facts.map((f) => [f.id, f]));
280
- function shapeFor(ids) {
281
- const shape = {};
282
- for (const id of ids) {
283
- const f = factById.get(id);
284
- if (!f)
285
- continue; // partition test fails loudly on stale group entries
286
- shape[id] = zodForFact(f).optional();
287
- }
288
- return shape;
289
- }
290
- export function factIdsForDomain(domain) {
291
- return corpus.facts.filter((f) => domainOf(f.id) === domain).map((f) => f.id);
292
- }
293
- // --- advertised schemas ------------------------------------------------------
294
- const GROUP_DESCRIPTIONS = {
295
- filing: "who is filing: status, age/blindness, dependency, student status",
296
- income: "wages, interest, capital gains, unemployment, foreign earned income",
297
- tips_overtime: "§ 224 tips and § 225 overtime deductions (OBBBA)",
298
- retirement: "social security, IRA/pension distributions, early-distribution penalty",
299
- self_employment: "Schedule C / K-1, QBI inputs, SE deductions, home office",
300
- adjustments: "IRA/HSA contributions, student-loan and car-loan interest",
301
- itemized: "Schedule A: SALT, mortgage, medical, charitable",
302
- credits: "CTC/ODC counts, dependent care, saver's, adoption, education",
303
- healthcare_ptc: "§ 36B premium tax credit / Form 1095-A reconciliation",
304
- kiddie_tax: "Form 8615 inputs for a child subject to § 1(g)",
305
- investor_amt: "AMT preferences (ISO spread) and § 1202 QSBS exclusion",
306
- rentals_passive: "Schedule E rentals/royalties + § 469 passive-loss netting (Form 8582 via us.federal.passive_loss_allowed)",
307
- state: "state taxable income for the state tax targets (us.ca/us.va/us.il.income_tax; parameters via lookup_tax_parameter)",
308
- household_employer: "Schedule H nanny/household-employee taxes",
309
- payments_estimates: "withholding, prior-year safe harbor, annualized installments",
310
- };
311
- /** Nested individual schema advertised on calculate_tax. */
312
- export const individualNestedShape = (() => {
313
- const shape = {};
314
- for (const [group, ids] of Object.entries(INDIVIDUAL_GROUPS)) {
315
- shape[group] = z
316
- .object(shapeFor(ids))
317
- .strict()
318
- .optional()
319
- .describe(GROUP_DESCRIPTIONS[group] ?? group);
320
- }
321
- shape.documents = documentsShape.optional();
322
- shape.target = targetParam("net tax; balance due when payments_estimates.federalTaxWithheld is given", "Determinations: us.federal.eligible.tips_deduction, us.federal.estimated.quarterly_payment, us.federal.estimated.safe_harbor_met");
323
- shape.asOf = asOfParam;
324
- return shape;
325
- })();
326
- /** Flat business-entity schema advertised on calculate_business_tax. */
327
- export const businessShape = (() => {
328
- const shape = shapeFor(factIdsForDomain("business"));
329
- shape.target = targetParam("us.federal.corp.entity_level_income_tax — the classification-aware entity income tax", "Other targets: us.federal.corp.entity_classification, .taxable_income, .income_tax_after_credits, .beat, .estimated.quarterly_payment, .stock_buyback_excise, .accumulated_earnings_tax, .phc_tax, .s_corp_entity_taxes");
330
- shape.asOf = asOfParam;
331
- return shape;
332
- })();
333
- /** Flat Form 1041 schema advertised on calculate_fiduciary_tax. */
334
- export const fiduciaryShape = (() => {
335
- const shape = shapeFor(factIdsForDomain("fiduciary"));
336
- shape.target = targetParam("us.federal.fiduciary.income_tax");
337
- shape.asOf = asOfParam;
338
- return shape;
339
- })();
340
- /** Flat § 152 dependent-determination schema advertised on determine_dependent. */
341
- export const dependentShape = (() => {
342
- const shape = shapeFor(factIdsForDomain("dependent"));
343
- shape.target = targetParam("us.federal.dependent.is_dependent", "Other targets: us.federal.dependent.qualifying_child, us.federal.dependent.qualifying_relative");
344
- shape.asOf = asOfParam;
345
- return shape;
346
- })();
347
- // --- runtime validation (shared by every fact-taking tool) -------------------
348
- /** Flat validator over ALL facts + target/asOf — the single strict backstop. */
349
- export const FACT_SHAPE = (() => {
350
- const shape = {};
351
- for (const f of corpus.facts)
352
- shape[f.id] = zodForFact(f).optional();
353
- shape.target = targetParam("net tax");
354
- shape.asOf = asOfParam;
355
- return shape;
356
- })();
357
- const STRICT_FLAT = z.object(FACT_SHAPE).strict();
358
- export const factsObjectParam = z
359
- .record(z.unknown())
360
- .describe("facts for the computation: either flat corpus fact ids (see list_input_facts) or the same group objects calculate_tax accepts (filing, income, retirement, …), plus optional target and asOf. Business/fiduciary/dependent facts are accepted flat. Unknown keys are rejected by name — nothing is ever silently dropped.");
361
- /** Accepts grouped, flat, or mixed input; returns one flat fact record. */
362
- export function flattenFactsArg(input) {
363
- const flat = {};
364
- const put = (key, value, from) => {
365
- if (value === undefined)
366
- return;
367
- if (key in flat)
368
- throw new Error(`fact "${key}" given more than once (via ${from}) — remove the duplicate`);
369
- flat[key] = value;
370
- };
371
- for (const [k, v] of Object.entries(input)) {
372
- if (GROUP_NAMES.has(k)) {
373
- if (v === undefined || v === null)
374
- continue;
375
- if (typeof v !== "object" || Array.isArray(v))
376
- throw new Error(`group "${k}" must be an object of facts`);
377
- for (const [fk, fv] of Object.entries(v))
378
- put(fk, fv, `group ${k}`);
379
- }
380
- else {
381
- put(k, v, "top level");
382
- }
383
- }
384
- return flat;
385
- }
386
- const INT_FACTS = new Set(corpus.facts.filter((f) => f.type === "int").map((f) => f.id));
387
- export function buildFacts(args, defaultTarget = DEFAULT_TARGET) {
388
- const plain = {};
389
- for (const f of corpus.facts) {
390
- let v = args[f.id];
391
- if (v === undefined)
392
- continue;
393
- if (INT_FACTS.has(f.id) && typeof v === "number") {
394
- v = String(v);
395
- }
396
- if (f.id === "occupation" && typeof v === "string") {
397
- const match = matchOccupation(v);
398
- if ("slug" in match)
399
- v = match.slug;
400
- else {
401
- throw new Error(match.candidates.length
402
- ? `occupation "${v}" matches several listed occupations: ${match.candidates.join(", ")} — pick one`
403
- : `occupation "${v}" is not on the Treasury Tipped Occupation list — pass "other" if the job is genuinely unlisted`);
404
- }
405
- }
406
- plain[f.id] = v;
407
- }
408
- if (typeof args.asOf !== "string") {
409
- throw new Error('asOf is required — pass the year-end date of the intended tax year (e.g. "2025-12-31" for TY2025). This tool refuses to default to today: a 2025 return computed under 2026 parameters is a silent wrong answer.');
410
- }
411
- return {
412
- facts: coerceFacts(corpus, plain),
413
- asOf: args.asOf,
414
- target: args.target ??
415
- (defaultTarget === DEFAULT_TARGET && args.federalTaxWithheld !== undefined
416
- ? "us.federal.balance_due"
417
- : defaultTarget),
418
- };
419
- }
420
- /**
421
- * Strict-validate a facts input (grouped, flat, or mixed), then build engine
422
- * facts. Unknown keys error by name — identical strictness on every tool.
423
- */
424
- export function buildFactsValidated(factsArg, defaultTarget) {
425
- const input = factsArg && typeof factsArg === "object" && !Array.isArray(factsArg)
426
- ? { ...factsArg }
427
- : {};
428
- let documentNotes = [];
429
- let w2Box1Cents;
430
- const docsRaw = input.documents;
431
- delete input.documents;
432
- const flat = flattenFactsArg(input);
433
- if (docsRaw !== undefined) {
434
- const parsedDocs = documentsShape.safeParse(docsRaw);
435
- if (!parsedDocs.success) {
436
- const detail = parsedDocs.error.issues
437
- .map((i) => (i.path.length ? `documents.${i.path.join(".")}: ${i.message}` : i.message))
438
- .join("; ");
439
- throw new Error(`invalid documents block — ${detail}`);
440
- }
441
- if (typeof flat.asOf !== "string") {
442
- throw new Error('asOf is required — pass the year-end date of the intended tax year (e.g. "2025-12-31" for TY2025). This tool refuses to default to today: a 2025 return computed under 2026 parameters is a silent wrong answer.');
443
- }
444
- const compiled = compileDocuments(parsedDocs.data, flat.asOf);
445
- documentNotes = compiled.notes;
446
- w2Box1Cents = compiled.w2Box1Cents;
447
- for (const [id, v] of Object.entries(compiled.facts)) {
448
- if (id in flat) {
449
- throw new Error(`fact "${id}" was derived from the documents block AND passed directly — remove the direct value (the compiled document value is authoritative; to override, drop the document entry and disclose)`);
450
- }
451
- flat[id] = v;
452
- }
453
- }
454
- const parsed = STRICT_FLAT.safeParse(flat);
455
- if (!parsed.success) {
456
- const detail = parsed.error.issues
457
- .map((i) => (i.path.length ? `${i.path.join(".")}: ${i.message}` : i.message))
458
- .join("; ");
459
- throw new Error(`invalid facts object — ${detail}. Every valid fact id is listed by list_input_facts; calculate_tax's parameters show the grouped form.`);
460
- }
461
- return {
462
- ...buildFacts(parsed.data, defaultTarget),
463
- documentNotes,
464
- ...(w2Box1Cents !== undefined ? { w2Box1Cents } : {}),
465
- };
466
- }
467
- //# sourceMappingURL=schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;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Aa,CAAC;QACpE,aAAa;QACb,GAAG,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtD,CAAC;AACJ,CAAC"}
package/dist/server.d.ts DELETED
@@ -1,14 +0,0 @@
1
- /**
2
- * @invaro/opentax — the tax oracle for AI agents, over the Model Context
3
- * Protocol (transport-agnostic server factory).
4
- *
5
- * The contract for the model: NEVER compute tax yourself — call these tools.
6
- * Every answer is derived from a content-addressed corpus of cited rules,
7
- * ships its assumptions, and is independently re-verifiable.
8
- *
9
- * claude mcp add opentax -- npx -y @invaro/opentax
10
- */
11
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
12
- /** Build a fully-registered opentax MCP server (one per transport/session). */
13
- export declare function createServer(): McpServer;
14
- //# sourceMappingURL=server.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA2CpE,+EAA+E;AAC/E,wBAAgB,YAAY,IAAI,SAAS,CA2jBxC"}