@saihm/mcp-server-pro 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.
- package/LICENSE +202 -0
- package/README.md +87 -0
- package/dist/client.d.ts +100 -0
- package/dist/client.js +389 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# @saihm/mcp-server-pro
|
|
2
|
+
|
|
3
|
+
Production thin-client for **SAIHM non-custodial memory**.
|
|
4
|
+
|
|
5
|
+
`SaihmProClient` seals every cell **on the client** with [`@saihm/client-pro`](https://www.npmjs.com/package/@saihm/client-pro), then POSTs the resulting ciphertext to the blind SAIHM `/mcp` endpoint. The endpoint stores, anchors, shares, and meters over ciphertext — it never holds your keys and cannot read your memory. Your master secret, key-encryption key, and plaintext never leave this process.
|
|
6
|
+
|
|
7
|
+
- **Seal before send** — `remember` encrypts client-side; `recall` decrypts client-side.
|
|
8
|
+
- **Post-quantum** — ML-DSA-65 identity/signing, ML-KEM-768 authenticated sharing (via `@saihm/client-pro`).
|
|
9
|
+
- **Same transport as the standards client** — `POST {method, params}` + `Authorization: Bearer <JWT>`; the endpoint binds your tenant from the JWT. HTTPS-only (loopback `http` permitted for local dev).
|
|
10
|
+
- **Crypto-shred erasure** — `forget` destroys the endpoint-side wrapped DEK, rendering the cell undecryptable (GDPR Art. 17).
|
|
11
|
+
|
|
12
|
+
> **Key loss is unrecoverable by design.** If you lose your master secret you lose your KEK, and no one — including SAIHM — can open your cells. Back it up securely.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install @saihm/mcp-server-pro
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { SaihmProClient } from '@saihm/mcp-server-pro';
|
|
24
|
+
|
|
25
|
+
// Boot from env: SAIHM_ENDPOINT_URL, SAIHM_AUTH_HEADER, SAIHM_MASTER_SECRET_HEX
|
|
26
|
+
// (optional: SAIHM_TIER, SAIHM_SEQ_STATE_PATH)
|
|
27
|
+
const saihm = SaihmProClient.bootFromEnv();
|
|
28
|
+
|
|
29
|
+
// Store — encrypted before it leaves the process.
|
|
30
|
+
const { cellId } = await saihm.remember('remember this');
|
|
31
|
+
|
|
32
|
+
// Recall — decrypted after it returns.
|
|
33
|
+
const cell = await saihm.recallOne(cellId);
|
|
34
|
+
console.log(cell?.plaintext); // 'remember this'
|
|
35
|
+
|
|
36
|
+
// Recall everything (client-side keyword filter; the endpoint has no plaintext to filter on).
|
|
37
|
+
const matches = await saihm.recall('this');
|
|
38
|
+
|
|
39
|
+
// Update an existing cell (a fresh monotonic sequence is issued automatically).
|
|
40
|
+
await saihm.remember('new contents', { cellId });
|
|
41
|
+
|
|
42
|
+
// Forget — crypto-shred.
|
|
43
|
+
await saihm.forget(cellId);
|
|
44
|
+
|
|
45
|
+
// Share a cell with another agent, end-to-end authenticated. Pin the grantee's agentIdHash
|
|
46
|
+
// out-of-band; the library rejects directory key-substitution.
|
|
47
|
+
await saihm.share({
|
|
48
|
+
cellId,
|
|
49
|
+
recipientRecord, // the grantee's published identity record (hex)
|
|
50
|
+
recipientPinnedAgentIdHashHex, // pinned out-of-band
|
|
51
|
+
});
|
|
52
|
+
await saihm.revokeShare(cellId, recipientPinnedAgentIdHashHex);
|
|
53
|
+
|
|
54
|
+
// Operator-observable metadata only (no plaintext).
|
|
55
|
+
const status = await saihm.status();
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The derived `saihm.agentIdHash` must match the `sub` of the JWT in `SAIHM_AUTH_HEADER`; publish `saihm.identityRecord` so other agents can share to you.
|
|
59
|
+
|
|
60
|
+
## Configuration
|
|
61
|
+
|
|
62
|
+
| Env | Required | Meaning |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| `SAIHM_ENDPOINT_URL` | yes | `https://…/mcp` (or `http://` only for `127.0.0.1`/`localhost`). |
|
|
65
|
+
| `SAIHM_AUTH_HEADER` | yes | `Bearer <JWT>`; the endpoint binds your tenant from the JWT `sub`. |
|
|
66
|
+
| `SAIHM_MASTER_SECRET_HEX` | yes | ≥ 64 hex chars (≥ 32 bytes), high-entropy, client-held; never sent. |
|
|
67
|
+
| `SAIHM_TIER` | no | Tier label baked into sealed metadata; resolved via `status()` if unset. |
|
|
68
|
+
| `SAIHM_SEQ_STATE_PATH` | no | Persists per-cell sequence high-water marks (mode 600) for cross-restart updates. |
|
|
69
|
+
|
|
70
|
+
## Errors
|
|
71
|
+
|
|
72
|
+
Non-2xx responses throw `SaihmEndpointError` with `status` and a typed `code` (e.g. `BLIND_NO_FREE_TIER`, `BLIND_BAD_EXPIRY`, `governance_unavailable`). Branch on those rather than the message.
|
|
73
|
+
|
|
74
|
+
## Security model
|
|
75
|
+
|
|
76
|
+
| Property | Guarantee |
|
|
77
|
+
|---|---|
|
|
78
|
+
| Confidentiality vs the endpoint | The endpoint holds ciphertext + wrapped DEKs + public keys only; no key able to decrypt. |
|
|
79
|
+
| Integrity / authenticity | Every cell is ML-DSA-65-signed over its contents, including the sequence number. |
|
|
80
|
+
| Anti-replay | The signed monotonic sequence is rejected by the endpoint if not strictly increasing. |
|
|
81
|
+
| Tenant isolation | Your `agentIdHash` (= the JWT `sub`) namespaces your state; a write whose signed identity differs from the JWT is rejected. |
|
|
82
|
+
| Authenticated sharing | Grantee public keys are pinned out-of-band and verified before any secret is bound to them. |
|
|
83
|
+
| Erasure | Destroying the endpoint-side wrapped DEK crypto-shreds the cell. |
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
Apache-2.0 © SAIHM
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { WireIdentityRecord } from '@saihm/client-pro';
|
|
2
|
+
export declare class SaihmEndpointError extends Error {
|
|
3
|
+
readonly status: number;
|
|
4
|
+
readonly code: string | undefined;
|
|
5
|
+
constructor(status: number, code: string | undefined, message: string);
|
|
6
|
+
}
|
|
7
|
+
export interface RememberResult {
|
|
8
|
+
cellId: string;
|
|
9
|
+
shardId: string;
|
|
10
|
+
seq: string;
|
|
11
|
+
commitmentHash: string;
|
|
12
|
+
}
|
|
13
|
+
export interface RecalledCell {
|
|
14
|
+
cellId: string;
|
|
15
|
+
plaintext: string;
|
|
16
|
+
seq: string;
|
|
17
|
+
commitmentHash: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ForgetResult {
|
|
20
|
+
cellId: string;
|
|
21
|
+
shardId: string;
|
|
22
|
+
complete: boolean;
|
|
23
|
+
sharesPurged: number;
|
|
24
|
+
steps: ReadonlyArray<{
|
|
25
|
+
step: string;
|
|
26
|
+
success: boolean;
|
|
27
|
+
detail: string;
|
|
28
|
+
}>;
|
|
29
|
+
epoch: string;
|
|
30
|
+
}
|
|
31
|
+
export interface StatusSnapshot {
|
|
32
|
+
agentIdHashHex: string;
|
|
33
|
+
tier: string;
|
|
34
|
+
activeShardCount: number;
|
|
35
|
+
activeSharingContracts: number;
|
|
36
|
+
bfsi: number;
|
|
37
|
+
bfsi_R: string;
|
|
38
|
+
bfsi_M: string;
|
|
39
|
+
prsInstrumented: boolean;
|
|
40
|
+
snapshotEpoch: string;
|
|
41
|
+
custody: string;
|
|
42
|
+
}
|
|
43
|
+
export interface ShareResult {
|
|
44
|
+
cellId: string;
|
|
45
|
+
sharer: string;
|
|
46
|
+
recipient: string;
|
|
47
|
+
}
|
|
48
|
+
export interface RevokeResult {
|
|
49
|
+
cellId: string;
|
|
50
|
+
recipient: string;
|
|
51
|
+
revoked: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface RememberOpts {
|
|
54
|
+
cellId?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface ShareGrant {
|
|
57
|
+
cellId: string;
|
|
58
|
+
recipientRecord: WireIdentityRecord;
|
|
59
|
+
recipientPinnedAgentIdHashHex: string;
|
|
60
|
+
scope?: 'read' | 'write' | 'readwrite';
|
|
61
|
+
expiryEpoch?: bigint | null;
|
|
62
|
+
}
|
|
63
|
+
export interface SaihmProClientOpts {
|
|
64
|
+
tier?: string;
|
|
65
|
+
seqStatePath?: string;
|
|
66
|
+
requestTimeoutMs?: number;
|
|
67
|
+
}
|
|
68
|
+
export declare class SaihmProClient {
|
|
69
|
+
private readonly endpoint;
|
|
70
|
+
private readonly authHeader;
|
|
71
|
+
private readonly identity;
|
|
72
|
+
private readonly agentIdHashHex;
|
|
73
|
+
private readonly seq;
|
|
74
|
+
private readonly requestTimeoutMs;
|
|
75
|
+
private tier;
|
|
76
|
+
constructor(endpoint: string, authHeader: string, masterSecret: Uint8Array, opts?: SaihmProClientOpts);
|
|
77
|
+
static bootFromEnv(): SaihmProClient;
|
|
78
|
+
get agentIdHash(): string;
|
|
79
|
+
get identityRecord(): WireIdentityRecord;
|
|
80
|
+
private call;
|
|
81
|
+
private openRow;
|
|
82
|
+
private resolveTier;
|
|
83
|
+
remember(content: string, opts?: RememberOpts): Promise<RememberResult>;
|
|
84
|
+
private recallRawOne;
|
|
85
|
+
recall(query?: string): Promise<RecalledCell[]>;
|
|
86
|
+
recallOne(cellId: string): Promise<RecalledCell | null>;
|
|
87
|
+
forget(cellId: string): Promise<ForgetResult>;
|
|
88
|
+
status(): Promise<StatusSnapshot>;
|
|
89
|
+
share(grant: ShareGrant): Promise<ShareResult>;
|
|
90
|
+
revokeShare(cellId: string, recipientHex: string): Promise<RevokeResult>;
|
|
91
|
+
governancePropose(args: {
|
|
92
|
+
scope: 'emission_param' | 'protocol_upgrade';
|
|
93
|
+
paramKey: string | null;
|
|
94
|
+
proposedValue: string | null;
|
|
95
|
+
}): Promise<never>;
|
|
96
|
+
governanceVote(args: {
|
|
97
|
+
proposalId: string;
|
|
98
|
+
approve: boolean;
|
|
99
|
+
}): Promise<never>;
|
|
100
|
+
}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
2
|
+
import { mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { dirname } from 'node:path';
|
|
4
|
+
import { deriveIdentity, sealCell, openCell, shareCell, encodeEnvelope, decodeEnvelope, encodeShareEnvelope, encodeIdentityRecord, decodeIdentityRecord, fromHex, toHex, utf8, fromUtf8, ctEqual, SeqHighWaterMark, } from '@saihm/client-pro';
|
|
5
|
+
const REQUEST_TIMEOUT_MS = 30_000;
|
|
6
|
+
const MAX_RESPONSE_BYTES = 16 * 1024 * 1024;
|
|
7
|
+
const MAX_SEQ = (1n << 64n) - 1n;
|
|
8
|
+
function assertEndpointUrl(endpoint) {
|
|
9
|
+
let url;
|
|
10
|
+
try {
|
|
11
|
+
url = new URL(endpoint);
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
throw new Error(`SAIHM_ENDPOINT_URL is not a valid URL: ${endpoint}`);
|
|
15
|
+
}
|
|
16
|
+
if (url.protocol === 'https:')
|
|
17
|
+
return;
|
|
18
|
+
if (url.protocol === 'http:' && (url.hostname === '127.0.0.1' || url.hostname === 'localhost'))
|
|
19
|
+
return;
|
|
20
|
+
throw new Error(`SAIHM_ENDPOINT_URL must use https:// (got ${url.protocol}//). ` +
|
|
21
|
+
`Plain http:// is only allowed for 127.0.0.1 or localhost (dev).`);
|
|
22
|
+
}
|
|
23
|
+
export class SaihmEndpointError extends Error {
|
|
24
|
+
status;
|
|
25
|
+
code;
|
|
26
|
+
constructor(status, code, message) {
|
|
27
|
+
super(message);
|
|
28
|
+
this.status = status;
|
|
29
|
+
this.code = code;
|
|
30
|
+
this.name = 'SaihmEndpointError';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async function readBodyCapped(res, max, method) {
|
|
34
|
+
const tooLarge = () => new SaihmEndpointError(0, 'response_too_large', `SAIHM endpoint ${method} response exceeded ${max}B`);
|
|
35
|
+
const body = res.body;
|
|
36
|
+
if (!body) {
|
|
37
|
+
const t = await res.text();
|
|
38
|
+
if (Buffer.byteLength(t) > max)
|
|
39
|
+
throw tooLarge();
|
|
40
|
+
return t;
|
|
41
|
+
}
|
|
42
|
+
const reader = body.getReader();
|
|
43
|
+
const chunks = [];
|
|
44
|
+
let total = 0;
|
|
45
|
+
for (;;) {
|
|
46
|
+
const { done, value } = await reader.read();
|
|
47
|
+
if (done)
|
|
48
|
+
break;
|
|
49
|
+
if (value) {
|
|
50
|
+
total += value.byteLength;
|
|
51
|
+
if (total > max) {
|
|
52
|
+
await reader.cancel();
|
|
53
|
+
throw tooLarge();
|
|
54
|
+
}
|
|
55
|
+
chunks.push(value);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return Buffer.concat(chunks).toString('utf-8');
|
|
59
|
+
}
|
|
60
|
+
class SeqState {
|
|
61
|
+
agentIdHashHex;
|
|
62
|
+
path;
|
|
63
|
+
hwm = new SeqHighWaterMark();
|
|
64
|
+
cellIds = new Set();
|
|
65
|
+
constructor(agentIdHashHex, path) {
|
|
66
|
+
this.agentIdHashHex = agentIdHashHex;
|
|
67
|
+
this.path = path;
|
|
68
|
+
if (this.path)
|
|
69
|
+
this.load();
|
|
70
|
+
}
|
|
71
|
+
load() {
|
|
72
|
+
let raw;
|
|
73
|
+
try {
|
|
74
|
+
raw = readFileSync(this.path, 'utf-8');
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
let obj;
|
|
80
|
+
try {
|
|
81
|
+
obj = JSON.parse(raw);
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
for (const [cellId, v] of Object.entries(obj)) {
|
|
87
|
+
if (typeof v !== 'string' || !/^(?:0|[1-9][0-9]*)$/.test(v))
|
|
88
|
+
continue;
|
|
89
|
+
if (this.hwm.admit(this.agentIdHashHex, cellId, BigInt(v)))
|
|
90
|
+
this.cellIds.add(cellId);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
persist() {
|
|
94
|
+
if (!this.path)
|
|
95
|
+
return;
|
|
96
|
+
const obj = {};
|
|
97
|
+
for (const cellId of this.cellIds) {
|
|
98
|
+
const c = this.hwm.current(this.agentIdHashHex, cellId);
|
|
99
|
+
if (c !== undefined)
|
|
100
|
+
obj[cellId] = c.toString(10);
|
|
101
|
+
}
|
|
102
|
+
mkdirSync(dirname(this.path), { recursive: true });
|
|
103
|
+
const tmp = `${this.path}.tmp.${process.pid}.${Date.now()}`;
|
|
104
|
+
writeFileSync(tmp, JSON.stringify(obj), { mode: 0o600 });
|
|
105
|
+
renameSync(tmp, this.path);
|
|
106
|
+
}
|
|
107
|
+
current(cellId) {
|
|
108
|
+
return this.hwm.current(this.agentIdHashHex, cellId);
|
|
109
|
+
}
|
|
110
|
+
observe(cellId, seq) {
|
|
111
|
+
if (this.hwm.admit(this.agentIdHashHex, cellId, seq)) {
|
|
112
|
+
this.cellIds.add(cellId);
|
|
113
|
+
this.persist();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
next(cellId) {
|
|
117
|
+
return (this.current(cellId) ?? 0n) + 1n;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export class SaihmProClient {
|
|
121
|
+
endpoint;
|
|
122
|
+
authHeader;
|
|
123
|
+
identity;
|
|
124
|
+
agentIdHashHex;
|
|
125
|
+
seq;
|
|
126
|
+
requestTimeoutMs;
|
|
127
|
+
tier;
|
|
128
|
+
constructor(endpoint, authHeader, masterSecret, opts = {}) {
|
|
129
|
+
assertEndpointUrl(endpoint);
|
|
130
|
+
this.endpoint = endpoint;
|
|
131
|
+
this.authHeader = authHeader;
|
|
132
|
+
this.identity = deriveIdentity(masterSecret);
|
|
133
|
+
this.agentIdHashHex = toHex(this.identity.agentIdHash);
|
|
134
|
+
this.tier = opts.tier;
|
|
135
|
+
this.seq = new SeqState(this.agentIdHashHex, opts.seqStatePath);
|
|
136
|
+
this.requestTimeoutMs =
|
|
137
|
+
typeof opts.requestTimeoutMs === 'number' && opts.requestTimeoutMs > 0
|
|
138
|
+
? opts.requestTimeoutMs
|
|
139
|
+
: REQUEST_TIMEOUT_MS;
|
|
140
|
+
}
|
|
141
|
+
static bootFromEnv() {
|
|
142
|
+
const endpoint = process.env.SAIHM_ENDPOINT_URL;
|
|
143
|
+
const auth = process.env.SAIHM_AUTH_HEADER;
|
|
144
|
+
const secretHex = process.env.SAIHM_MASTER_SECRET_HEX;
|
|
145
|
+
if (!endpoint)
|
|
146
|
+
throw new Error('SAIHM_ENDPOINT_URL env var required');
|
|
147
|
+
if (!auth)
|
|
148
|
+
throw new Error("SAIHM_AUTH_HEADER env var required (e.g. 'Bearer <JWT>')");
|
|
149
|
+
if (!secretHex)
|
|
150
|
+
throw new Error('SAIHM_MASTER_SECRET_HEX env var required (>= 64 hex chars)');
|
|
151
|
+
let master;
|
|
152
|
+
try {
|
|
153
|
+
master = fromHex(secretHex.trim());
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
throw new Error('SAIHM_MASTER_SECRET_HEX must be canonical lowercase hex');
|
|
157
|
+
}
|
|
158
|
+
if (master.length < 32) {
|
|
159
|
+
master.fill(0);
|
|
160
|
+
throw new Error('SAIHM_MASTER_SECRET_HEX must decode to >= 32 bytes');
|
|
161
|
+
}
|
|
162
|
+
const optTier = process.env.SAIHM_TIER;
|
|
163
|
+
const optSeqPath = process.env.SAIHM_SEQ_STATE_PATH;
|
|
164
|
+
const opts = {};
|
|
165
|
+
if (optTier)
|
|
166
|
+
opts.tier = optTier;
|
|
167
|
+
if (optSeqPath)
|
|
168
|
+
opts.seqStatePath = optSeqPath;
|
|
169
|
+
try {
|
|
170
|
+
return new SaihmProClient(endpoint, auth, master, opts);
|
|
171
|
+
}
|
|
172
|
+
finally {
|
|
173
|
+
master.fill(0);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
get agentIdHash() {
|
|
177
|
+
return this.agentIdHashHex;
|
|
178
|
+
}
|
|
179
|
+
get identityRecord() {
|
|
180
|
+
return encodeIdentityRecord(this.identity.identityRecord);
|
|
181
|
+
}
|
|
182
|
+
async call(method, params) {
|
|
183
|
+
const ctrl = new AbortController();
|
|
184
|
+
const timer = setTimeout(() => ctrl.abort(), this.requestTimeoutMs);
|
|
185
|
+
try {
|
|
186
|
+
const res = await fetch(this.endpoint, {
|
|
187
|
+
method: 'POST',
|
|
188
|
+
headers: { 'content-type': 'application/json', authorization: this.authHeader },
|
|
189
|
+
body: JSON.stringify({ method, params }),
|
|
190
|
+
signal: ctrl.signal,
|
|
191
|
+
});
|
|
192
|
+
const text = await readBodyCapped(res, MAX_RESPONSE_BYTES, method);
|
|
193
|
+
if (!res.ok) {
|
|
194
|
+
let code;
|
|
195
|
+
try {
|
|
196
|
+
const j = JSON.parse(text);
|
|
197
|
+
if (typeof j.error === 'string')
|
|
198
|
+
code = j.error;
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
}
|
|
202
|
+
throw new SaihmEndpointError(res.status, code, `SAIHM endpoint ${method} failed: ${res.status} ${res.statusText}` + (code ? ` (${code})` : ''));
|
|
203
|
+
}
|
|
204
|
+
try {
|
|
205
|
+
return JSON.parse(text);
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
throw new SaihmEndpointError(res.status, 'malformed_json', `SAIHM endpoint ${method} returned a non-JSON 2xx response`);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
catch (e) {
|
|
212
|
+
if (e instanceof SaihmEndpointError)
|
|
213
|
+
throw e;
|
|
214
|
+
if (e instanceof Error && e.name === 'AbortError') {
|
|
215
|
+
throw new SaihmEndpointError(408, 'timeout', `SAIHM endpoint ${method} timed out after ${this.requestTimeoutMs}ms`);
|
|
216
|
+
}
|
|
217
|
+
throw new SaihmEndpointError(0, 'network', `SAIHM endpoint ${method} transport error`);
|
|
218
|
+
}
|
|
219
|
+
finally {
|
|
220
|
+
clearTimeout(timer);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
openRow(expectedCellId, wire) {
|
|
224
|
+
let env;
|
|
225
|
+
try {
|
|
226
|
+
env = decodeEnvelope(wire);
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
throw new SaihmEndpointError(502, 'malformed_envelope', `endpoint returned a malformed envelope${expectedCellId ? ` for cell '${expectedCellId}'` : ''}`);
|
|
230
|
+
}
|
|
231
|
+
if (!ctEqual(env.agentIdHash, this.identity.agentIdHash)) {
|
|
232
|
+
throw new SaihmEndpointError(502, 'foreign_envelope', 'endpoint returned an envelope bound to a different agent');
|
|
233
|
+
}
|
|
234
|
+
if (expectedCellId !== null && env.cellId !== expectedCellId) {
|
|
235
|
+
throw new SaihmEndpointError(502, 'cell_mismatch', `endpoint returned cell '${env.cellId}' for requested '${expectedCellId}'`);
|
|
236
|
+
}
|
|
237
|
+
const knownSeq = this.seq.current(env.cellId);
|
|
238
|
+
if (knownSeq !== undefined && env.seq < knownSeq) {
|
|
239
|
+
throw new SaihmEndpointError(502, 'stale_cell', `endpoint returned a rolled-back envelope for cell '${env.cellId}' (seq ${env.seq} < ${knownSeq})`);
|
|
240
|
+
}
|
|
241
|
+
let plaintext;
|
|
242
|
+
try {
|
|
243
|
+
plaintext = fromUtf8(openCell(env, this.identity.kek));
|
|
244
|
+
}
|
|
245
|
+
catch {
|
|
246
|
+
throw new SaihmEndpointError(502, 'undecryptable', `cell '${env.cellId}' could not be opened with this identity's key`);
|
|
247
|
+
}
|
|
248
|
+
this.seq.observe(env.cellId, env.seq);
|
|
249
|
+
return { cellId: env.cellId, plaintext, seq: env.seq.toString(10), commitmentHash: toHex(env.publicMeta.commitmentHash) };
|
|
250
|
+
}
|
|
251
|
+
async resolveTier() {
|
|
252
|
+
if (this.tier !== undefined)
|
|
253
|
+
return this.tier;
|
|
254
|
+
const st = await this.status();
|
|
255
|
+
this.tier = st.tier;
|
|
256
|
+
return st.tier;
|
|
257
|
+
}
|
|
258
|
+
async remember(content, opts = {}) {
|
|
259
|
+
const cellId = opts.cellId ?? randomBytes(16).toString('hex');
|
|
260
|
+
if (opts.cellId !== undefined && this.seq.current(cellId) === undefined) {
|
|
261
|
+
const existing = await this.recallRawOne(cellId);
|
|
262
|
+
if (existing.found && existing.wire) {
|
|
263
|
+
this.openRow(cellId, existing.wire);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
const seq = this.seq.next(cellId);
|
|
267
|
+
if (seq > MAX_SEQ) {
|
|
268
|
+
throw new SaihmEndpointError(0, 'seq_exhausted', `cell '${cellId}' has exhausted its uint64 sequence space`);
|
|
269
|
+
}
|
|
270
|
+
const tier = await this.resolveTier();
|
|
271
|
+
const env = sealCell({
|
|
272
|
+
plaintext: utf8(content),
|
|
273
|
+
kek: this.identity.kek,
|
|
274
|
+
mldsaSecretKey: this.identity.mldsaSecretKey,
|
|
275
|
+
mldsaPubKey: this.identity.mldsaPubKey,
|
|
276
|
+
agentIdHash: this.identity.agentIdHash,
|
|
277
|
+
cellId,
|
|
278
|
+
seq,
|
|
279
|
+
tier,
|
|
280
|
+
});
|
|
281
|
+
const r = await this.call('saihm_remember', { wire: encodeEnvelope(env) });
|
|
282
|
+
this.seq.observe(cellId, seq);
|
|
283
|
+
return r;
|
|
284
|
+
}
|
|
285
|
+
async recallRawOne(cellId) {
|
|
286
|
+
const r = await this.call('saihm_recall', { cellId });
|
|
287
|
+
if (typeof r !== 'object' || r === null || Array.isArray(r)) {
|
|
288
|
+
throw new SaihmEndpointError(502, 'malformed_response', 'endpoint returned a malformed recall response');
|
|
289
|
+
}
|
|
290
|
+
return r;
|
|
291
|
+
}
|
|
292
|
+
async recall(query) {
|
|
293
|
+
const rows = await this.call('saihm_recall', {});
|
|
294
|
+
if (!Array.isArray(rows)) {
|
|
295
|
+
throw new SaihmEndpointError(502, 'malformed_response', 'endpoint returned a malformed recall-all response');
|
|
296
|
+
}
|
|
297
|
+
const needle = query?.toLowerCase();
|
|
298
|
+
const out = [];
|
|
299
|
+
const seen = new Set();
|
|
300
|
+
for (const raw of rows) {
|
|
301
|
+
if (typeof raw !== 'object' || raw === null || Array.isArray(raw)) {
|
|
302
|
+
throw new SaihmEndpointError(502, 'malformed_response', 'endpoint returned a malformed recall-all row');
|
|
303
|
+
}
|
|
304
|
+
const row = raw;
|
|
305
|
+
if (!row.found || !row.wire)
|
|
306
|
+
continue;
|
|
307
|
+
const cell = this.openRow(null, row.wire);
|
|
308
|
+
if (seen.has(cell.cellId)) {
|
|
309
|
+
throw new SaihmEndpointError(502, 'malformed_response', `endpoint returned cell '${cell.cellId}' more than once in a recall-all response`);
|
|
310
|
+
}
|
|
311
|
+
seen.add(cell.cellId);
|
|
312
|
+
if (needle !== undefined && !cell.plaintext.toLowerCase().includes(needle))
|
|
313
|
+
continue;
|
|
314
|
+
out.push(cell);
|
|
315
|
+
}
|
|
316
|
+
return out;
|
|
317
|
+
}
|
|
318
|
+
async recallOne(cellId) {
|
|
319
|
+
const r = await this.recallRawOne(cellId);
|
|
320
|
+
if (!r.found || !r.wire)
|
|
321
|
+
return null;
|
|
322
|
+
return this.openRow(cellId, r.wire);
|
|
323
|
+
}
|
|
324
|
+
async forget(cellId) {
|
|
325
|
+
return this.call('saihm_forget', { id: cellId });
|
|
326
|
+
}
|
|
327
|
+
async status() {
|
|
328
|
+
return this.call('saihm_status', {});
|
|
329
|
+
}
|
|
330
|
+
async share(grant) {
|
|
331
|
+
const own = await this.recallRawOne(grant.cellId);
|
|
332
|
+
if (!own.found || !own.wire) {
|
|
333
|
+
throw new SaihmEndpointError(404, 'cell_not_found', `cannot share unknown cell '${grant.cellId}'`);
|
|
334
|
+
}
|
|
335
|
+
let envelope;
|
|
336
|
+
try {
|
|
337
|
+
envelope = decodeEnvelope(own.wire);
|
|
338
|
+
}
|
|
339
|
+
catch {
|
|
340
|
+
throw new SaihmEndpointError(502, 'malformed_envelope', `endpoint returned a malformed envelope for cell '${grant.cellId}'`);
|
|
341
|
+
}
|
|
342
|
+
if (!ctEqual(envelope.agentIdHash, this.identity.agentIdHash)) {
|
|
343
|
+
throw new SaihmEndpointError(502, 'foreign_envelope', 'endpoint returned an envelope bound to a different agent');
|
|
344
|
+
}
|
|
345
|
+
if (envelope.cellId !== grant.cellId) {
|
|
346
|
+
throw new SaihmEndpointError(502, 'cell_mismatch', `endpoint returned cell '${envelope.cellId}' for requested '${grant.cellId}'`);
|
|
347
|
+
}
|
|
348
|
+
const knownSeq = this.seq.current(grant.cellId);
|
|
349
|
+
if (knownSeq !== undefined && envelope.seq < knownSeq) {
|
|
350
|
+
throw new SaihmEndpointError(502, 'stale_cell', `endpoint returned a rolled-back envelope for cell '${grant.cellId}' (seq ${envelope.seq} < ${knownSeq})`);
|
|
351
|
+
}
|
|
352
|
+
let recipientRecord;
|
|
353
|
+
let recipientPinnedAgentIdHash;
|
|
354
|
+
try {
|
|
355
|
+
recipientRecord = decodeIdentityRecord(grant.recipientRecord);
|
|
356
|
+
recipientPinnedAgentIdHash = fromHex(grant.recipientPinnedAgentIdHashHex);
|
|
357
|
+
}
|
|
358
|
+
catch {
|
|
359
|
+
throw new SaihmEndpointError(0, 'bad_recipient', 'recipient identity record or pinned agentIdHash is malformed');
|
|
360
|
+
}
|
|
361
|
+
const shareEnv = shareCell({
|
|
362
|
+
envelope,
|
|
363
|
+
sharerKek: this.identity.kek,
|
|
364
|
+
sharerMldsaSecretKey: this.identity.mldsaSecretKey,
|
|
365
|
+
sharerAgentIdHash: this.identity.agentIdHash,
|
|
366
|
+
recipientRecord,
|
|
367
|
+
recipientPinnedAgentIdHash,
|
|
368
|
+
});
|
|
369
|
+
const params = {
|
|
370
|
+
shareWire: encodeShareEnvelope(shareEnv),
|
|
371
|
+
scope: grant.scope ?? 'read',
|
|
372
|
+
};
|
|
373
|
+
if (grant.expiryEpoch !== undefined && grant.expiryEpoch !== null) {
|
|
374
|
+
params.expiryEpoch = grant.expiryEpoch.toString(10);
|
|
375
|
+
}
|
|
376
|
+
return this.call('saihm_share', params);
|
|
377
|
+
}
|
|
378
|
+
async revokeShare(cellId, recipientHex) {
|
|
379
|
+
return this.call('saihm_revoke_share', { cellId, recipient: recipientHex });
|
|
380
|
+
}
|
|
381
|
+
async governancePropose(args) {
|
|
382
|
+
await this.call('saihm_governance_propose', args);
|
|
383
|
+
throw new SaihmEndpointError(403, 'governance_unavailable', 'governance unavailable');
|
|
384
|
+
}
|
|
385
|
+
async governanceVote(args) {
|
|
386
|
+
await this.call('saihm_governance_vote', args);
|
|
387
|
+
throw new SaihmEndpointError(403, 'governance_unavailable', 'governance unavailable');
|
|
388
|
+
}
|
|
389
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SaihmProClient, SaihmEndpointError } from './client.js';
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@saihm/mcp-server-pro",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "SAIHM production thin-client. Seals client-side via @saihm/client-pro (ML-DSA-65 identity, per-cell AES-256-GCM DEK wrapped under a client KEK, ML-KEM-768 authenticated sharing) and POSTs opaque ciphertext to the blind, non-custodial SAIHM /mcp endpoint. The master secret, KEK, and plaintext never leave this process. Apache-2.0.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"clean": "rm -rf dist coverage",
|
|
16
|
+
"build": "npm run clean && tsc -p .",
|
|
17
|
+
"typecheck": "tsc -p tsconfig.test.json",
|
|
18
|
+
"test": "tsx --test tests/client_pro.test.ts",
|
|
19
|
+
"prepublishOnly": "npm run build && npm run typecheck && npm test"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"LICENSE",
|
|
24
|
+
"README.md"
|
|
25
|
+
],
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"saihm",
|
|
31
|
+
"post-quantum",
|
|
32
|
+
"non-custodial",
|
|
33
|
+
"client-side-encryption",
|
|
34
|
+
"agent-memory",
|
|
35
|
+
"mcp"
|
|
36
|
+
],
|
|
37
|
+
"license": "Apache-2.0",
|
|
38
|
+
"author": "SAIHM",
|
|
39
|
+
"homepage": "https://saihm.coti.global",
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=20"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@saihm/client-pro": "^0.1.1"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/node": "^25.9.0",
|
|
48
|
+
"tsx": "^4.22.2",
|
|
49
|
+
"typescript": "^6.0.3"
|
|
50
|
+
}
|
|
51
|
+
}
|