@intentrax/sdk 1.0.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.
package/LICENSE ADDED
@@ -0,0 +1,185 @@
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, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the
13
+ copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other
16
+ entities that control, are controlled by, or are under common control with
17
+ that entity. For the purposes of this definition, "control" means (i) the
18
+ power, direct or indirect, to cause the direction or management of such
19
+ entity, whether by contract or otherwise, or (ii) ownership of fifty percent
20
+ (50%) or more of the outstanding shares, or (iii) beneficial ownership of
21
+ such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
24
+ 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 source, and
28
+ configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical transformation or
31
+ translation of a Source form, including but not limited to compiled object
32
+ code, generated documentation, and conversions to other media types.
33
+
34
+ "Work" shall mean the work of authorship, whether in Source or Object form,
35
+ made available under the License, as indicated by a copyright notice that is
36
+ included in or attached to the work.
37
+
38
+ "Derivative Works" shall mean any work, whether in Source or Object form,
39
+ that is based on (or derived from) the Work and for which the editorial
40
+ revisions, annotations, elaborations, or other modifications represent, as a
41
+ whole, an original work of authorship. For the purposes of this License,
42
+ Derivative Works shall not include works that remain separable from, or merely
43
+ link (or bind by name) to the interfaces of, the Work and Derivative Works
44
+ thereof.
45
+
46
+ "Contribution" shall mean any work of authorship, including the original
47
+ version of the Work and any modifications or additions to that Work or
48
+ Derivative Works thereof, that is intentionally submitted to Licensor for
49
+ inclusion in the Work by the copyright owner or by an individual or Legal
50
+ Entity authorized to submit on behalf of the copyright owner. For the purposes
51
+ of this definition, "submitted" means any form of electronic, verbal, or
52
+ written communication sent to the Licensor or its representatives, including
53
+ but not limited to communication on electronic mailing lists, source code
54
+ control systems, and issue tracking systems that are managed by, or on behalf
55
+ of, the Licensor for the purpose of discussing and improving the Work, but
56
+ excluding communication that is conspicuously marked or otherwise designated
57
+ in writing by the copyright owner as "Not a Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any individual or Legal Entity on
60
+ behalf of whom a Contribution has been received by Licensor and subsequently
61
+ incorporated within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
64
+ License, each Contributor hereby grants to You a perpetual, worldwide,
65
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
66
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
67
+ sublicense, and distribute the Work and such Derivative Works in Source or
68
+ Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of this
71
+ License, each Contributor hereby grants to You a perpetual, worldwide,
72
+ non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
73
+ section) patent license to make, have made, use, offer to sell, sell, import,
74
+ and otherwise transfer the Work, where such license applies only to those
75
+ patent claims licensable by such Contributor that are necessarily infringed by
76
+ their Contribution(s) alone or by combination of their Contribution(s) with the
77
+ Work to which such Contribution(s) was submitted. If You institute patent
78
+ litigation against any entity (including a cross-claim or counterclaim in a
79
+ lawsuit) alleging that the Work or a Contribution incorporated within the Work
80
+ constitutes direct or contributory patent infringement, then any patent
81
+ licenses granted to You under this License for that Work shall terminate as of
82
+ the date such litigation is filed.
83
+
84
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
85
+ Derivative Works thereof in any medium, with or without modifications, and in
86
+ Source or Object form, provided that You meet the following conditions:
87
+
88
+ (a) You must give any other recipients of the Work or Derivative Works a copy
89
+ of this License; and
90
+
91
+ (b) You must cause any modified files to carry prominent notices stating that
92
+ You changed the files; and
93
+
94
+ (c) You must retain, in the Source form of any Derivative Works that You
95
+ distribute, all copyright, patent, trademark, and attribution notices from the
96
+ Source form of the Work, excluding those notices that do not pertain to any
97
+ part of the Derivative Works; and
98
+
99
+ (d) If the Work includes a "NOTICE" text file as part of its distribution,
100
+ then any Derivative Works that You distribute must include a readable copy of
101
+ the attribution notices contained within such NOTICE file, excluding those
102
+ notices that do not pertain to any part of the Derivative Works, in at least
103
+ one of the following places: within a NOTICE text file distributed as part of
104
+ the Derivative Works; within the Source form or documentation, if provided
105
+ along with the Derivative Works; or, within a display generated by the
106
+ Derivative Works, if and wherever such third-party notices normally appear.
107
+ The contents of the NOTICE file are for informational purposes only and do not
108
+ modify the License. You may add Your own attribution notices within Derivative
109
+ Works that You distribute, alongside or as an addendum to the NOTICE text from
110
+ the Work, provided that such additional attribution notices cannot be construed
111
+ as modifying the License.
112
+
113
+ You may add Your own copyright statement to Your modifications and may provide
114
+ additional or different license terms and conditions for use, reproduction, or
115
+ distribution of Your modifications, or for any such Derivative Works as a
116
+ whole, provided Your use, reproduction, and distribution of the Work otherwise
117
+ complies with the conditions stated in this License.
118
+
119
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
120
+ Contribution intentionally submitted for inclusion in the Work by You to the
121
+ Licensor shall be under the terms and conditions of this License, without any
122
+ additional terms or conditions. Notwithstanding the above, nothing herein shall
123
+ supersede or modify the terms of any separate license agreement you may have
124
+ executed with Licensor regarding such Contributions.
125
+
126
+ 6. Trademarks. This License does not grant permission to use the trade names,
127
+ trademarks, service marks, or product names of the Licensor, except as
128
+ required for reasonable and customary use in describing the origin of the Work
129
+ and reproducing the content of the NOTICE file.
130
+
131
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
132
+ writing, Licensor provides the Work (and each Contributor provides its
133
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
134
+ KIND, either express or implied, including, without limitation, any warranties
135
+ or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
136
+ PARTICULAR PURPOSE. You are solely responsible for determining the
137
+ appropriateness of using or redistributing the Work and assume any risks
138
+ associated with Your exercise of permissions under this License.
139
+
140
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
141
+ tort (including negligence), contract, or otherwise, unless required by
142
+ applicable law (such as deliberate and grossly negligent acts) or agreed to in
143
+ writing, shall any Contributor be liable to You for damages, including any
144
+ direct, indirect, special, incidental, or consequential damages of any
145
+ character arising as a result of this License or out of the use or inability to
146
+ use the Work (including but not limited to damages for loss of goodwill, work
147
+ stoppage, computer failure or malfunction, or any and all other commercial
148
+ damages or losses), even if such Contributor has been advised of the
149
+ possibility of such damages.
150
+
151
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
152
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
153
+ acceptance of support, warranty, indemnity, or other liability obligations
154
+ and/or rights consistent with this License. However, in accepting such
155
+ obligations, You may act only on Your own behalf and on Your sole
156
+ responsibility, not on behalf of any other Contributor, and only if You agree
157
+ to indemnify, defend, and hold each Contributor harmless for any liability
158
+ incurred by, or claims asserted against, such Contributor by reason of your
159
+ accepting any such warranty or additional liability.
160
+
161
+ END OF TERMS AND CONDITIONS
162
+
163
+ APPENDIX: How to apply the Apache License to your work.
164
+
165
+ To apply the Apache License to your work, attach the following boilerplate
166
+ notice, with the fields enclosed by brackets "[]" replaced with your own
167
+ identifying information. Do not include the brackets. The text should be
168
+ enclosed in the appropriate comment syntax for the file format. We also
169
+ recommend that a file or class name and description of purpose be included on
170
+ the same "printed page" as the copyright notice for easier identification
171
+ within third-party archives.
172
+
173
+ Copyright 2026 Intentrax
174
+
175
+ Licensed under the Apache License, Version 2.0 (the "License");
176
+ you may not use this file except in compliance with the License.
177
+ You may obtain a copy of the License at
178
+
179
+ http://www.apache.org/licenses/LICENSE-2.0
180
+
181
+ Unless required by applicable law or agreed to in writing, software
182
+ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
183
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
184
+ See the License for the specific language governing permissions and
185
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,148 @@
1
+ # TypeScript / Node.js SDK
2
+
3
+ First-wave SDK lane for AI apps, MCP clients, SaaS products, browser-adjacent
4
+ tooling, and Node.js service integrations.
5
+
6
+ This package must consume shared Intentrax specs and conformance vectors from
7
+ `../shared-specs` and `../conformance`. It must not redefine EEO, AEP,
8
+ canonical serialization, proof verification, policy decisions, or tier
9
+ enforcement.
10
+
11
+ Public surfaces:
12
+ - `@intentrax/sdk` for deterministic canonicalization and verification envelopes
13
+ - `@intentrax/sdk/http` for explicit HTTP API-wrapper execution
14
+ - `intentrax init <adapter>` for local developer adapter onboarding
15
+ - `intentrax check-init --output-dir <dir>` for offline adapter init verification
16
+ - `intentrax verify-proof <proof-export.json>` for local proof export hash and
17
+ boundary verification
18
+ - `intentrax verify-pdf-receipt <receipt.pdf>` for local downloaded PDF receipt
19
+ byte/hash verification
20
+
21
+ The published package exports Node-runnable `.js` modules with `.d.ts` type
22
+ declarations and is gated on Node 20 and Node 24.
23
+
24
+ One-command adapter onboarding:
25
+
26
+ ```bash
27
+ npx @intentrax/sdk init claude-code --dry-run
28
+ npx @intentrax/sdk init cursor
29
+ npx @intentrax/sdk init mcp
30
+ npx @intentrax/sdk init langchain
31
+ npx @intentrax/sdk init langgraph
32
+ npx @intentrax/sdk init vercel-ai-sdk
33
+ npx @intentrax/sdk init cursor --force
34
+ npx @intentrax/sdk check-init --output-dir .
35
+ ```
36
+
37
+ The MVP-native adapter set is Claude Code, Cursor, MCP, LangChain, LangGraph,
38
+ and Vercel AI SDK. The same command also exposes expanded scaffold aliases for
39
+ Custom Agent, CrewAI, AutoGen, OpenClaw, n8n, and DeepFlow so teams can try the
40
+ admission-only path without changing AEVN/AEP authority or treating those
41
+ aliases as MVP-native hooks.
42
+
43
+ The init command creates `.intentrax/agent-adapter.json`,
44
+ `.intentrax/sample-admission-request.json`, `.intentrax/action-receipt.json`,
45
+ `.intentrax/submit_sample.curl`, and
46
+ `.intentrax/hooks/<adapter-native-hook>.mjs`, plus
47
+ `.intentrax/wiring/<adapter-host-wiring>.md`, when not run with `--dry-run`. It
48
+ does not store API keys, signing keys, or tenant secrets. The sample admission
49
+ request uses the locked private-alpha Agent Gateway refs and an allowed
50
+ contract-only action for the selected adapter surface.
51
+
52
+ The command is safe to rerun when generated files are unchanged. If an existing
53
+ `.intentrax` file has local edits, `intentrax init` fails closed before writing
54
+ anything; pass `--force` only after reviewing the local changes you intend to
55
+ replace.
56
+
57
+ The generated hook starter builds a fresh admission request for the local
58
+ adapter event, drops auth-like fields before hashing, and fails closed when a
59
+ submitted admission is denied or unavailable. It still does not execute tools,
60
+ mutate payloads, re-run policy, or generate proofs inside the adapter.
61
+
62
+ The generated host wiring guide shows where to import the hook starter in the
63
+ selected host surface and is hash-bound into both `.intentrax/agent-adapter.json`
64
+ and `.intentrax/action-receipt.json`. It is developer setup guidance only, not
65
+ canonical evidence or production authorization.
66
+
67
+ After writing files, the CLI prints a no-secret `curl` command that submits the
68
+ sample with `X-Intentrax-Tenant-ID`, `X-Intentrax-Api-Key`, and
69
+ `X-Intentrax-Idempotency-Key`. Set `INTENTRAX_API_KEY` from your secret manager
70
+ before running it.
71
+
72
+ `.intentrax/action-receipt.json` is a hash-bound developer summary for the
73
+ generated sample. It links the adapter profile, admission envelope, hook
74
+ starter, host wiring guide, submit command, and future AEVN/AEP proof export or
75
+ registry reference path. It is not canonical proof and does not authorize
76
+ production traffic.
77
+
78
+ Offline init verification:
79
+
80
+ ```bash
81
+ npx @intentrax/sdk check-init --output-dir . --json
82
+ ```
83
+
84
+ `check-init` verifies the initialized `.intentrax` directory without
85
+ `INTENTRAX_API_KEY`, runtime access, or network submission. It checks the
86
+ expected files, validates the Agent Gateway sample fixture through the SDK
87
+ admission semantics, recomputes the action receipt, generated hook source, and
88
+ host wiring guide hash bindings, and imports the generated hook in no-submit
89
+ mode with a
90
+ secret-bearing fixture to confirm the starter does not leak secrets or require
91
+ network access. Human output is a concise pass/fail line; `--json` emits the
92
+ deterministic status, boundary assertions, file hashes, and errors.
93
+
94
+ Expanded scaffold aliases:
95
+
96
+ ```bash
97
+ npx @intentrax/sdk init custom-agent
98
+ npx @intentrax/sdk init crewai
99
+ npx @intentrax/sdk init autogen
100
+ npx @intentrax/sdk init openclaw
101
+ npx @intentrax/sdk init n8n
102
+ npx @intentrax/sdk init deepflow
103
+ ```
104
+
105
+ Local proof export verification:
106
+
107
+ ```bash
108
+ npx @intentrax/sdk verify-proof \
109
+ .intentrax-runtime/pilot-local-sovereign/local-sovereign-proof-export.json \
110
+ --report-out .intentrax/offline-proof-verification.report.json
111
+ ```
112
+
113
+ `verify-proof` reads a registry-backed proof lookup JSON export, recomputes the
114
+ proof lookup hash, proof record hash, and verification bundle hash, rejects
115
+ private key material markers, and writes a deterministic local verification
116
+ report. It does not require the runtime server, network access, or private keys.
117
+ The JSON proof export remains authoritative. Downloaded PDF receipts are
118
+ human-readable companions and should be checked against their exported hash
119
+ metadata, not treated as replacement proof material.
120
+
121
+ Local PDF receipt verification:
122
+
123
+ ```bash
124
+ npx @intentrax/sdk verify-pdf-receipt \
125
+ .intentrax/proof-001-aep-receipt.pdf \
126
+ --pdf-hash "$X_INTENTRAX_PDF_HASH" \
127
+ --report-out .intentrax/pdf-receipt-verification.report.json
128
+ ```
129
+
130
+ `verify-pdf-receipt` reads downloaded PDF bytes, checks the `%PDF-` header,
131
+ recomputes SHA-256, and compares it with the runtime `X-Intentrax-PDF-Hash`
132
+ header. It validates only the human-readable PDF companion. The canonical JSON
133
+ proof export and AEP evidence remain the source of truth.
134
+
135
+ Programmatic receipt and export helpers:
136
+
137
+ ```js
138
+ import {
139
+ buildProofExportHttpRequest,
140
+ buildReceiptVerificationHttpRequest,
141
+ } from "@intentrax/sdk/http";
142
+ ```
143
+
144
+ `buildReceiptVerificationHttpRequest` builds the runtime/OpenAPI receipt
145
+ verification request for `POST /v1/proofs/verify`. `buildProofExportHttpRequest`
146
+ builds `GET /v1/proofs/{proof_id}/export?format=json|aep-json|pdf`; JSON and
147
+ AEP JSON are authoritative proof exports, while PDF is a deterministic
148
+ human-readable receipt.