@invaro/opentax 0.1.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 (66) hide show
  1. package/LICENSE +190 -0
  2. package/dist/documents.d.ts +177 -0
  3. package/dist/documents.d.ts.map +1 -0
  4. package/dist/documents.js +246 -0
  5. package/dist/documents.js.map +1 -0
  6. package/dist/hosted-bundle.d.ts +8 -0
  7. package/dist/hosted-bundle.d.ts.map +1 -0
  8. package/dist/hosted-bundle.js +8 -0
  9. package/dist/hosted-bundle.js.map +1 -0
  10. package/dist/http.d.ts +15 -0
  11. package/dist/http.d.ts.map +1 -0
  12. package/dist/http.js +90 -0
  13. package/dist/http.js.map +1 -0
  14. package/dist/index.d.ts +9 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +13 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/schema.d.ts +60 -0
  19. package/dist/schema.d.ts.map +1 -0
  20. package/dist/schema.js +467 -0
  21. package/dist/schema.js.map +1 -0
  22. package/dist/server.d.ts +14 -0
  23. package/dist/server.d.ts.map +1 -0
  24. package/dist/server.js +509 -0
  25. package/dist/server.js.map +1 -0
  26. package/dist/state-return/ca.d.ts +3 -0
  27. package/dist/state-return/ca.d.ts.map +1 -0
  28. package/dist/state-return/ca.js +108 -0
  29. package/dist/state-return/ca.js.map +1 -0
  30. package/dist/state-return/il.d.ts +3 -0
  31. package/dist/state-return/il.d.ts.map +1 -0
  32. package/dist/state-return/il.js +64 -0
  33. package/dist/state-return/il.js.map +1 -0
  34. package/dist/state-return/index.d.ts +8 -0
  35. package/dist/state-return/index.d.ts.map +1 -0
  36. package/dist/state-return/index.js +38 -0
  37. package/dist/state-return/index.js.map +1 -0
  38. package/dist/state-return/money.d.ts +10 -0
  39. package/dist/state-return/money.d.ts.map +1 -0
  40. package/dist/state-return/money.js +18 -0
  41. package/dist/state-return/money.js.map +1 -0
  42. package/dist/state-return/ny.d.ts +3 -0
  43. package/dist/state-return/ny.d.ts.map +1 -0
  44. package/dist/state-return/ny.js +59 -0
  45. package/dist/state-return/ny.js.map +1 -0
  46. package/dist/state-return/shape.d.ts +80 -0
  47. package/dist/state-return/shape.d.ts.map +1 -0
  48. package/dist/state-return/shape.js +97 -0
  49. package/dist/state-return/shape.js.map +1 -0
  50. package/dist/state-return/types.d.ts +17 -0
  51. package/dist/state-return/types.d.ts.map +1 -0
  52. package/dist/state-return/types.js +6 -0
  53. package/dist/state-return/types.js.map +1 -0
  54. package/dist/state-return/va-worksheets.d.ts +70 -0
  55. package/dist/state-return/va-worksheets.d.ts.map +1 -0
  56. package/dist/state-return/va-worksheets.js +116 -0
  57. package/dist/state-return/va-worksheets.js.map +1 -0
  58. package/dist/state-return/va.d.ts +3 -0
  59. package/dist/state-return/va.d.ts.map +1 -0
  60. package/dist/state-return/va.js +130 -0
  61. package/dist/state-return/va.js.map +1 -0
  62. package/dist/state-return.d.ts +4 -0
  63. package/dist/state-return.d.ts.map +1 -0
  64. package/dist/state-return.js +3 -0
  65. package/dist/state-return.js.map +1 -0
  66. package/package.json +54 -0
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 opentax-engine contributors
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,177 @@
1
+ /**
2
+ * Document compiler — deterministic transcription-to-facts.
3
+ *
4
+ * Every agent-variance failure in the benchmark rounds happened where the
5
+ * MCP accepted a pre-digested JUDGMENT instead of a raw document value: a
6
+ * dependent pre-classified from a checkbox label, a Form 8959 Part IV
7
+ * reconciliation left to mental arithmetic, a penalty decided from a payer's
8
+ * box code, a documented amount deleted as "anomalous". This module moves
9
+ * those derivations into code: agents transcribe boxes and dates; the
10
+ * compiler classifies, sums, reconciles, and DISCLOSES — and it throws
11
+ * loudly if the same value arrives both raw and pre-digested.
12
+ */
13
+ import { z } from "zod";
14
+ export declare const documentsShape: z.ZodObject<{
15
+ taxpayerDateOfBirth: z.ZodOptional<z.ZodString>;
16
+ spouseDateOfBirth: z.ZodOptional<z.ZodString>;
17
+ w2s: z.ZodOptional<z.ZodArray<z.ZodObject<{
18
+ box1: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
19
+ box2: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
20
+ box3: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
21
+ box5: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
22
+ box6: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
23
+ box17: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
24
+ }, "strict", z.ZodTypeAny, {
25
+ box1: string | number;
26
+ box2?: string | number | undefined;
27
+ box3?: string | number | undefined;
28
+ box5?: string | number | undefined;
29
+ box6?: string | number | undefined;
30
+ box17?: string | number | undefined;
31
+ }, {
32
+ box1: string | number;
33
+ box2?: string | number | undefined;
34
+ box3?: string | number | undefined;
35
+ box5?: string | number | undefined;
36
+ box6?: string | number | undefined;
37
+ box17?: string | number | undefined;
38
+ }>, "many">>;
39
+ f1099rs: z.ZodOptional<z.ZodArray<z.ZodObject<{
40
+ box1: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
41
+ box2a: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
42
+ box4: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
43
+ box7: z.ZodString;
44
+ iraSepSimple: z.ZodOptional<z.ZodBoolean>;
45
+ recipient: z.ZodOptional<z.ZodEnum<["taxpayer", "spouse"]>>;
46
+ rolledOver: z.ZodOptional<z.ZodBoolean>;
47
+ disabilityBeforeRetirementAge: z.ZodOptional<z.ZodBoolean>;
48
+ }, "strict", z.ZodTypeAny, {
49
+ box1: string | number;
50
+ box2a: string | number;
51
+ box7: string;
52
+ box4?: string | number | undefined;
53
+ iraSepSimple?: boolean | undefined;
54
+ recipient?: "taxpayer" | "spouse" | undefined;
55
+ rolledOver?: boolean | undefined;
56
+ disabilityBeforeRetirementAge?: boolean | undefined;
57
+ }, {
58
+ box1: string | number;
59
+ box2a: string | number;
60
+ box7: string;
61
+ box4?: string | number | undefined;
62
+ iraSepSimple?: boolean | undefined;
63
+ recipient?: "taxpayer" | "spouse" | undefined;
64
+ rolledOver?: boolean | undefined;
65
+ disabilityBeforeRetirementAge?: boolean | undefined;
66
+ }>, "many">>;
67
+ ssa1099s: z.ZodOptional<z.ZodArray<z.ZodObject<{
68
+ box5: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
69
+ box6: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
70
+ }, "strict", z.ZodTypeAny, {
71
+ box5: string | number;
72
+ box6?: string | number | undefined;
73
+ }, {
74
+ box5: string | number;
75
+ box6?: string | number | undefined;
76
+ }>, "many">>;
77
+ dependents: z.ZodOptional<z.ZodArray<z.ZodObject<{
78
+ dateOfBirth: z.ZodString;
79
+ relationship: z.ZodOptional<z.ZodEnum<["child_or_descendant", "sibling_or_descendant", "parent_or_other_relative"]>>;
80
+ isPermanentlyDisabled: z.ZodOptional<z.ZodBoolean>;
81
+ isFullTimeStudent: z.ZodOptional<z.ZodBoolean>;
82
+ hasRequiredSSN: z.ZodOptional<z.ZodBoolean>;
83
+ monthsLivedWithTaxpayer: z.ZodOptional<z.ZodNumber>;
84
+ }, "strict", z.ZodTypeAny, {
85
+ dateOfBirth: string;
86
+ relationship?: "child_or_descendant" | "sibling_or_descendant" | "parent_or_other_relative" | undefined;
87
+ isPermanentlyDisabled?: boolean | undefined;
88
+ isFullTimeStudent?: boolean | undefined;
89
+ hasRequiredSSN?: boolean | undefined;
90
+ monthsLivedWithTaxpayer?: number | undefined;
91
+ }, {
92
+ dateOfBirth: string;
93
+ relationship?: "child_or_descendant" | "sibling_or_descendant" | "parent_or_other_relative" | undefined;
94
+ isPermanentlyDisabled?: boolean | undefined;
95
+ isFullTimeStudent?: boolean | undefined;
96
+ hasRequiredSSN?: boolean | undefined;
97
+ monthsLivedWithTaxpayer?: number | undefined;
98
+ }>, "many">>;
99
+ }, "strict", z.ZodTypeAny, {
100
+ taxpayerDateOfBirth?: string | undefined;
101
+ spouseDateOfBirth?: string | undefined;
102
+ w2s?: {
103
+ box1: string | number;
104
+ box2?: string | number | undefined;
105
+ box3?: string | number | undefined;
106
+ box5?: string | number | undefined;
107
+ box6?: string | number | undefined;
108
+ box17?: string | number | undefined;
109
+ }[] | undefined;
110
+ f1099rs?: {
111
+ box1: string | number;
112
+ box2a: string | number;
113
+ box7: string;
114
+ box4?: string | number | undefined;
115
+ iraSepSimple?: boolean | undefined;
116
+ recipient?: "taxpayer" | "spouse" | undefined;
117
+ rolledOver?: boolean | undefined;
118
+ disabilityBeforeRetirementAge?: boolean | undefined;
119
+ }[] | undefined;
120
+ ssa1099s?: {
121
+ box5: string | number;
122
+ box6?: string | number | undefined;
123
+ }[] | undefined;
124
+ dependents?: {
125
+ dateOfBirth: string;
126
+ relationship?: "child_or_descendant" | "sibling_or_descendant" | "parent_or_other_relative" | undefined;
127
+ isPermanentlyDisabled?: boolean | undefined;
128
+ isFullTimeStudent?: boolean | undefined;
129
+ hasRequiredSSN?: boolean | undefined;
130
+ monthsLivedWithTaxpayer?: number | undefined;
131
+ }[] | undefined;
132
+ }, {
133
+ taxpayerDateOfBirth?: string | undefined;
134
+ spouseDateOfBirth?: string | undefined;
135
+ w2s?: {
136
+ box1: string | number;
137
+ box2?: string | number | undefined;
138
+ box3?: string | number | undefined;
139
+ box5?: string | number | undefined;
140
+ box6?: string | number | undefined;
141
+ box17?: string | number | undefined;
142
+ }[] | undefined;
143
+ f1099rs?: {
144
+ box1: string | number;
145
+ box2a: string | number;
146
+ box7: string;
147
+ box4?: string | number | undefined;
148
+ iraSepSimple?: boolean | undefined;
149
+ recipient?: "taxpayer" | "spouse" | undefined;
150
+ rolledOver?: boolean | undefined;
151
+ disabilityBeforeRetirementAge?: boolean | undefined;
152
+ }[] | undefined;
153
+ ssa1099s?: {
154
+ box5: string | number;
155
+ box6?: string | number | undefined;
156
+ }[] | undefined;
157
+ dependents?: {
158
+ dateOfBirth: string;
159
+ relationship?: "child_or_descendant" | "sibling_or_descendant" | "parent_or_other_relative" | undefined;
160
+ isPermanentlyDisabled?: boolean | undefined;
161
+ isFullTimeStudent?: boolean | undefined;
162
+ hasRequiredSSN?: boolean | undefined;
163
+ monthsLivedWithTaxpayer?: number | undefined;
164
+ }[] | undefined;
165
+ }>;
166
+ type Docs = z.infer<typeof documentsShape>;
167
+ export interface CompiledDocs {
168
+ facts: Record<string, unknown>;
169
+ notes: string[];
170
+ /** Sum of W-2 box 1 in cents — Form 1040 line 1a is W-2 box 1 ONLY; any other
171
+ * amount folded into the wages fact (e.g. pre-retirement disability, Pub. 525)
172
+ * is line 1h other earned income. */
173
+ w2Box1Cents: bigint;
174
+ }
175
+ export declare function compileDocuments(docs: Docs, asOf: string): CompiledDocs;
176
+ export {};
177
+ //# sourceMappingURL=documents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../src/documents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyExB,CAAC;AAEJ,KAAK,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AA4B3C,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;yCAEqC;IACrC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAuIvE"}
@@ -0,0 +1,246 @@
1
+ /**
2
+ * Document compiler — deterministic transcription-to-facts.
3
+ *
4
+ * Every agent-variance failure in the benchmark rounds happened where the
5
+ * MCP accepted a pre-digested JUDGMENT instead of a raw document value: a
6
+ * dependent pre-classified from a checkbox label, a Form 8959 Part IV
7
+ * reconciliation left to mental arithmetic, a penalty decided from a payer's
8
+ * box code, a documented amount deleted as "anomalous". This module moves
9
+ * those derivations into code: agents transcribe boxes and dates; the
10
+ * compiler classifies, sums, reconciles, and DISCLOSES — and it throws
11
+ * loudly if the same value arrives both raw and pre-digested.
12
+ */
13
+ import { z } from "zod";
14
+ const usd = z.union([z.number(), z.string()]).describe('dollars, e.g. 50000 or "1234.56"');
15
+ const dob = z
16
+ .string()
17
+ .regex(/^\d{4}-\d{2}-\d{2}$/)
18
+ .describe("date of birth, YYYY-MM-DD");
19
+ export const documentsShape = z
20
+ .object({
21
+ taxpayerDateOfBirth: dob
22
+ .optional()
23
+ .describe("derives age-based facts (65+, 25-64 EITC window, 50/55 catch-ups, 59½ penalty)"),
24
+ spouseDateOfBirth: dob.optional(),
25
+ w2s: z
26
+ .array(z
27
+ .object({
28
+ box1: usd.describe("wages, tips, other compensation"),
29
+ box2: usd.optional().describe("federal income tax withheld"),
30
+ box3: usd.optional().describe("social security wages"),
31
+ box5: usd.optional().describe("Medicare wages and tips"),
32
+ box6: usd.optional().describe("Medicare tax withheld — Part IV excess over 1.45% of box 5 is added to withholding automatically"),
33
+ box17: usd.optional().describe("state income tax withheld — surfaced as a SALT note; enter in itemized.stateAndLocalTaxesPaid yourself if itemizing"),
34
+ })
35
+ .strict())
36
+ .optional()
37
+ .describe("one entry per W-2, boxes transcribed verbatim"),
38
+ f1099rs: z
39
+ .array(z
40
+ .object({
41
+ box1: usd.describe("gross distribution"),
42
+ box2a: usd.describe("taxable amount (0 if fully rolled over / converted basis applied via ira8606)"),
43
+ box4: usd.optional().describe("federal income tax withheld"),
44
+ box7: z.string().describe('distribution code(s), e.g. "1", "7", "4", "G", "3", "C"'),
45
+ iraSepSimple: z.boolean().optional().describe("the IRA/SEP/SIMPLE checkbox"),
46
+ recipient: z.enum(["taxpayer", "spouse"]).optional().describe("whose distribution (for the age-based penalty test); default taxpayer"),
47
+ rolledOver: z.boolean().optional().describe("interview-confirmed full rollover (e.g. 'distributions less rollovers = 0') — excluded from taxable income regardless of box 2a"),
48
+ disabilityBeforeRetirementAge: z.boolean().optional().describe("code-3 disability received before minimum retirement age — reported as WAGES (Pub. 525) and counted as § 22 disability income"),
49
+ })
50
+ .strict())
51
+ .optional()
52
+ .describe("one entry per 1099-R; routing, penalty, and rollover handling are computed, not judged"),
53
+ ssa1099s: z
54
+ .array(z
55
+ .object({
56
+ box5: usd.describe("net benefits (box 5) — includible amount computed by the § 86 0/50/85% formula, not judged here"),
57
+ box6: usd.optional().describe("voluntary federal income tax withheld"),
58
+ })
59
+ .strict())
60
+ .optional()
61
+ .describe("one entry per SSA-1099 (or RRB-1099 tier-1 equivalent); box 5 sums into socialSecurityBenefits, box 6 into withholding"),
62
+ dependents: z
63
+ .array(z
64
+ .object({
65
+ dateOfBirth: dob,
66
+ relationship: z
67
+ .enum(["child_or_descendant", "sibling_or_descendant", "parent_or_other_relative"])
68
+ .optional()
69
+ .describe("§ 152(c)(2) lineage: children/grandchildren and siblings/nieces/nephews can be QUALIFYING CHILDREN; a parent or other relative can only be a qualifying RELATIVE (ODC, never CTC/EIC-child). TRANSCRIBE the document's own label: son/daughter/grandchild/foster/sibling/niece → child_or_descendant or sibling_or_descendant; an explicit 'other' relationship on a source form → parent_or_other_relative (never default it back to child lineage). The child_or_descendant default is ONLY for documents that state a child relationship or say nothing at all."),
70
+ isPermanentlyDisabled: z.boolean().optional(),
71
+ isFullTimeStudent: z.boolean().optional(),
72
+ hasRequiredSSN: z.boolean().optional().describe("default true"),
73
+ monthsLivedWithTaxpayer: z.number().int().min(0).max(12).optional().describe("default 12"),
74
+ })
75
+ .strict())
76
+ .optional()
77
+ .describe("one entry per dependent, RAW facts — CTC vs ODC vs EIC-child vs CDCC classification is computed from the statute's age tests, never from intake checkbox labels"),
78
+ })
79
+ .strict()
80
+ .describe("RAW document transcription (preferred over hand-mapped facts): W-2 boxes, 1099-R boxes/codes, SSA-1099 boxes, dependents' birth dates. SSA-1099s are first-class: box 5 sums into socialSecurityBenefits and box 6 into withholding, so the § 86 taxable-benefits worksheet runs on the transcribed total instead of a hand-mapped guess. The tool derives wages/withholding (incl. Form 8959 Part IV), box-3/5 wage coordination, dependent classifications, age facts, and early-distribution penalties deterministically — and errors if the same value is also passed as a hand-mapped fact.");
81
+ const toCents = (v) => {
82
+ const s = typeof v === "number" ? v.toFixed(2) : String(v).replace(/[$,]/g, "");
83
+ const m = /^(-?)(\d+)(?:\.(\d{1,2}))?$/.exec(s);
84
+ if (!m)
85
+ throw new Error(`not a dollar amount: ${JSON.stringify(v)}`);
86
+ const cents = BigInt(m[2]) * 100n + BigInt((m[3] ?? "0").padEnd(2, "0"));
87
+ return m[1] === "-" ? -cents : cents;
88
+ };
89
+ const dollars = (c) => `${c / 100n}.${(c % 100n < 0n ? -(c % 100n) : c % 100n).toString().padStart(2, "0")}`;
90
+ /** Age attained by the close of the tax year (IRS born-before-Jan-2 rule for 65). */
91
+ function ageAtYearEnd(dobStr, taxYear) {
92
+ const [y, m, d] = dobStr.split("-").map(Number);
93
+ // attained age N during the tax year if birthday (y+N) falls on or before Dec 31;
94
+ // the Jan-1 birthday counts as attained the day before (prior tax year)
95
+ let age = taxYear - y;
96
+ if (m === 1 && d === 1)
97
+ return age; // Jan 1: deemed attained Dec 31 of prior year — age already counts
98
+ return age;
99
+ }
100
+ /** Age in years (with the half-year test) on the last day of the tax year. */
101
+ function ageYearsExact(dobStr, taxYear) {
102
+ const [y, m, d] = dobStr.split("-").map(Number);
103
+ const end = Date.UTC(taxYear, 11, 31);
104
+ const birth = Date.UTC(y, m - 1, d);
105
+ return (end - birth) / (365.25 * 24 * 3600 * 1000);
106
+ }
107
+ export function compileDocuments(docs, asOf) {
108
+ const taxYear = Number(asOf.slice(0, 4));
109
+ const sums = {};
110
+ const ints = {};
111
+ const bools = {};
112
+ const notes = [];
113
+ const add = (id, c) => {
114
+ sums[id] = (sums[id] ?? 0n) + c;
115
+ };
116
+ // --- taxpayer / spouse ages -----------------------------------------------
117
+ const born65Cutoff = (dobStr) => ageAtYearEnd(dobStr, taxYear) >= 65;
118
+ if (docs.taxpayerDateOfBirth) {
119
+ const age = ageAtYearEnd(docs.taxpayerDateOfBirth, taxYear);
120
+ bools.isAge65OrOlder = born65Cutoff(docs.taxpayerDateOfBirth);
121
+ bools.isAtLeastAge25 = age >= 25;
122
+ bools.isAge50OrOlder = age >= 50;
123
+ bools.isAge55OrOlder = age >= 55;
124
+ notes.push(`taxpayer age at year end: ${age} (from ${docs.taxpayerDateOfBirth})`);
125
+ }
126
+ if (docs.spouseDateOfBirth) {
127
+ bools.spouseIsAge65OrOlder = born65Cutoff(docs.spouseDateOfBirth);
128
+ notes.push(`spouse age at year end: ${ageAtYearEnd(docs.spouseDateOfBirth, taxYear)} (from ${docs.spouseDateOfBirth})`);
129
+ }
130
+ // --- W-2s -------------------------------------------------------------------
131
+ const multiW2 = (docs.w2s ?? []).length > 1;
132
+ if (multiW2 && (docs.w2s ?? []).some((w) => w.box3 !== undefined)) {
133
+ notes.push("MULTIPLE W-2s: box-3 sums are NOT set as socialSecurityWages (Schedule SE coordination is PER PERSON — if there is self-employment income, set income.socialSecurityWages to the SE-earner's OWN box 3 yourself)");
134
+ }
135
+ let w2Box1Cents = 0n;
136
+ for (const [i, w] of (docs.w2s ?? []).entries()) {
137
+ add("wages", toCents(w.box1));
138
+ w2Box1Cents += toCents(w.box1);
139
+ if (w.box2 !== undefined)
140
+ add("federalTaxWithheld", toCents(w.box2));
141
+ if (w.box3 !== undefined && !multiW2)
142
+ add("socialSecurityWages", toCents(w.box3));
143
+ if (w.box5 !== undefined) {
144
+ const b5 = toCents(w.box5);
145
+ add("medicareWages", b5);
146
+ if (w.box6 !== undefined && b5 > 20000000n) {
147
+ // Form 8959 Part IV: withholding over 1.45% of box 5 is
148
+ // Additional-Medicare-Tax withholding → credited on line 25.
149
+ // Only engaged above the $200,000 employer-withholding trigger
150
+ // (§ 3102(f)) — below it, tiny box-6 excesses are rounding noise
151
+ const regular = (b5 * 145n + 5000n) / 10000n; // 1.45%, half-up
152
+ const excess = toCents(w.box6) - regular;
153
+ if (excess > 0n) {
154
+ add("federalTaxWithheld", excess);
155
+ notes.push(`W-2 #${i + 1}: Form 8959 Part IV — box 6 exceeds 1.45% of box 5 by $${dollars(excess)}; added to withholding`);
156
+ }
157
+ }
158
+ }
159
+ if (w.box17 !== undefined && toCents(w.box17) > 0n) {
160
+ notes.push(`W-2 #${i + 1}: box 17 state income tax $${dollars(toCents(w.box17))} is DOCUMENTED — include in itemized.stateAndLocalTaxesPaid if itemizing; do not discard it as anomalous`);
161
+ }
162
+ }
163
+ // --- 1099-Rs ----------------------------------------------------------------
164
+ const PENALTY_EXEMPT_CODES = new Set(["2", "3", "4", "7", "G", "H", "Q", "T", "C"]);
165
+ for (const [i, r] of (docs.f1099rs ?? []).entries()) {
166
+ if (r.box4 !== undefined)
167
+ add("federalTaxWithheld", toCents(r.box4));
168
+ const taxable = toCents(r.box2a);
169
+ if (r.rolledOver || r.box7.toUpperCase().includes("G")) {
170
+ notes.push(`1099-R #${i + 1}: treated as ROLLOVER (${r.rolledOver ? "interview-confirmed" : "code G"}) — gross on 4a/5a only, $0 taxable`);
171
+ continue;
172
+ }
173
+ if (r.disabilityBeforeRetirementAge) {
174
+ add("wages", taxable);
175
+ add("scheduleRDisabilityIncome", taxable);
176
+ notes.push(`1099-R #${i + 1}: code-3 disability before minimum retirement age — $${dollars(taxable)} reported as WAGES (Pub. 525, Form 1040 line 1h — NOT line 1a, which is W-2 box 1 only) and counted as § 22 disability income`);
177
+ continue;
178
+ }
179
+ if (r.iraSepSimple)
180
+ add("taxableIraDistributions", taxable);
181
+ else
182
+ add("taxablePensionsAndAnnuities", taxable);
183
+ // § 72(t): the penalty is an AGE question, not a box-code question
184
+ const dobStr = r.recipient === "spouse" ? docs.spouseDateOfBirth : docs.taxpayerDateOfBirth;
185
+ const code = r.box7.toUpperCase();
186
+ if ([...code].some((c) => c === "1")) {
187
+ if (dobStr && ageYearsExact(dobStr, taxYear) >= 59.5) {
188
+ notes.push(`1099-R #${i + 1}: payer code 1 (early) but the ${r.recipient ?? "taxpayer"} is over 59½ — no § 72(t) penalty (age controls, not the box code)`);
189
+ }
190
+ else if ([...code].every((c) => !PENALTY_EXEMPT_CODES.has(c))) {
191
+ add("earlyDistributionSubjectToPenalty", taxable);
192
+ notes.push(`1099-R #${i + 1}: code 1 and no age exception established — $${dollars(taxable)} subject to the 10% § 72(t) tax`);
193
+ }
194
+ }
195
+ }
196
+ // --- SSA-1099s ----------------------------------------------------------------
197
+ for (const s of docs.ssa1099s ?? []) {
198
+ add("socialSecurityBenefits", toCents(s.box5));
199
+ if (s.box6 !== undefined)
200
+ add("federalTaxWithheld", toCents(s.box6));
201
+ }
202
+ // --- dependents: statute tests, not checkbox labels --------------------------
203
+ for (const dep of docs.dependents ?? []) {
204
+ const age = ageAtYearEnd(dep.dateOfBirth, taxYear);
205
+ const disabled = dep.isPermanentlyDisabled === true;
206
+ const student = dep.isFullTimeStudent === true;
207
+ const ssn = dep.hasRequiredSSN !== false;
208
+ const months = dep.monthsLivedWithTaxpayer ?? 12;
209
+ // § 152(c)(2): only child/descendant or sibling/descendant lineage can be
210
+ // a qualifying child — a PARENT can never be one (EIC-child included)
211
+ const childLineage = (dep.relationship ?? "child_or_descendant") !== "parent_or_other_relative";
212
+ if (months <= 6 && !disabled) {
213
+ notes.push(`dependent (b. ${dep.dateOfBirth}): lived ≤6 months — residency test not met, excluded (divorced-parents release etc. via determine_dependent)`);
214
+ continue;
215
+ }
216
+ if (!childLineage) {
217
+ ints.otherDependents = (ints.otherDependents ?? 0) + 1;
218
+ if (disabled)
219
+ ints.careQualifyingIndividuals = (ints.careQualifyingIndividuals ?? 0) + 1;
220
+ notes.push(`dependent (b. ${dep.dateOfBirth}, parent/other relative): qualifying RELATIVE — $500 ODC only, never a CTC/EIC qualifying child (§ 152(c)(2))${disabled ? "; CDCC-qualifying (incapable of self-care)" : ""}`);
221
+ continue;
222
+ }
223
+ if (age < 17 && ssn) {
224
+ ints.qualifyingChildren = (ints.qualifyingChildren ?? 0) + 1;
225
+ notes.push(`dependent (b. ${dep.dateOfBirth}, age ${age}): CTC qualifying child — § 24(c) age test controls regardless of any intake 'other dependent' checkbox`);
226
+ }
227
+ else {
228
+ ints.otherDependents = (ints.otherDependents ?? 0) + 1;
229
+ // EIC qualifying child has WIDER age rules than the CTC
230
+ if (age < 19 || (age < 24 && student) || disabled) {
231
+ ints.eitcAdditionalQualifyingChildren = (ints.eitcAdditionalQualifyingChildren ?? 0) + 1;
232
+ notes.push(`dependent (b. ${dep.dateOfBirth}, age ${age}): $500 ODC for the CTC, but an EIC qualifying child (§ 32(c)(3): ${disabled ? "disabled, any age" : student ? "student under 24" : "under 19"})`);
233
+ }
234
+ }
235
+ if (age < 13 || disabled) {
236
+ ints.careQualifyingIndividuals = (ints.careQualifyingIndividuals ?? 0) + 1;
237
+ }
238
+ }
239
+ const facts = { ...bools };
240
+ for (const [id, c] of Object.entries(sums))
241
+ facts[id] = dollars(c);
242
+ for (const [id, n] of Object.entries(ints))
243
+ facts[id] = n;
244
+ return { facts, notes, w2Box1Cents };
245
+ }
246
+ //# sourceMappingURL=documents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documents.js","sourceRoot":"","sources":["../src/documents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,kCAAkC,CAAC,CAAC;AAC3F,MAAM,GAAG,GAAG,CAAC;KACV,MAAM,EAAE;KACR,KAAK,CAAC,qBAAqB,CAAC;KAC5B,QAAQ,CAAC,2BAA2B,CAAC,CAAC;AAEzC,MAAM,CAAC,MAAM,cAA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AAM,KAAK,GAA4B,EAAE,GAAG,KAAK,EAAE,CAAC;IACpD,KAAK,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACnE,KAAK,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAC1D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AACvC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Entry for the self-contained hosted bundle (site /mcp route, edge-less
3
+ * Node runtimes). Exports the server factory plus the SDK's Web-Standard
4
+ * Streamable HTTP transport so the host app needs zero MCP dependencies.
5
+ */
6
+ export { createServer } from "./server.js";
7
+ export { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
8
+ //# sourceMappingURL=hosted-bundle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-bundle.d.ts","sourceRoot":"","sources":["../src/hosted-bundle.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,wCAAwC,EAAE,MAAM,+DAA+D,CAAC"}