@sess.si/sdk 0.0.0-stage → 0.1.0-rc.5
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/CHANGELOG.md +38 -0
- package/LICENSE +201 -0
- package/NOTICE +9 -0
- package/README.md +155 -2
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +8 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/verify.d.ts +14 -0
- package/dist/cli/verify.d.ts.map +1 -0
- package/dist/cli/verify.js +277 -0
- package/dist/cli/verify.js.map +1 -0
- package/dist/client.d.ts +12 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +34 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +40 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +52 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated/openapi.d.ts +2462 -0
- package/dist/generated/openapi.d.ts.map +1 -0
- package/dist/generated/openapi.js +2 -0
- package/dist/generated/openapi.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/decode.d.ts +21 -0
- package/dist/internal/decode.d.ts.map +1 -0
- package/dist/internal/decode.js +333 -0
- package/dist/internal/decode.js.map +1 -0
- package/dist/internal/json.d.ts +4 -0
- package/dist/internal/json.d.ts.map +1 -0
- package/dist/internal/json.js +75 -0
- package/dist/internal/json.js.map +1 -0
- package/dist/internal/time.d.ts +11 -0
- package/dist/internal/time.d.ts.map +1 -0
- package/dist/internal/time.js +71 -0
- package/dist/internal/time.js.map +1 -0
- package/dist/polling.d.ts +3 -0
- package/dist/polling.d.ts.map +1 -0
- package/dist/polling.js +61 -0
- package/dist/polling.js.map +1 -0
- package/dist/receipts/bundle.d.ts +124 -0
- package/dist/receipts/bundle.d.ts.map +1 -0
- package/dist/receipts/bundle.js +424 -0
- package/dist/receipts/bundle.js.map +1 -0
- package/dist/receipts/index.d.ts +7 -0
- package/dist/receipts/index.d.ts.map +1 -0
- package/dist/receipts/index.js +3 -0
- package/dist/receipts/index.js.map +1 -0
- package/dist/receipts/json.d.ts +22 -0
- package/dist/receipts/json.d.ts.map +1 -0
- package/dist/receipts/json.js +152 -0
- package/dist/receipts/json.js.map +1 -0
- package/dist/receipts/key-cache.d.ts +28 -0
- package/dist/receipts/key-cache.d.ts.map +1 -0
- package/dist/receipts/key-cache.js +110 -0
- package/dist/receipts/key-cache.js.map +1 -0
- package/dist/receipts/resource.d.ts +39 -0
- package/dist/receipts/resource.d.ts.map +1 -0
- package/dist/receipts/resource.js +119 -0
- package/dist/receipts/resource.js.map +1 -0
- package/dist/receipts/verify.d.ts +90 -0
- package/dist/receipts/verify.d.ts.map +1 -0
- package/dist/receipts/verify.js +294 -0
- package/dist/receipts/verify.js.map +1 -0
- package/dist/sessions.d.ts +19 -0
- package/dist/sessions.d.ts.map +1 -0
- package/dist/sessions.js +145 -0
- package/dist/sessions.js.map +1 -0
- package/dist/transport.d.ts +29 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +447 -0
- package/dist/transport.js.map +1 -0
- package/dist/types.d.ts +149 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/dist/webhook-resource.d.ts +13 -0
- package/dist/webhook-resource.d.ts.map +1 -0
- package/dist/webhook-resource.js +52 -0
- package/dist/webhook-resource.js.map +1 -0
- package/dist/webhooks/index.d.ts +22 -0
- package/dist/webhooks/index.d.ts.map +1 -0
- package/dist/webhooks/index.js +184 -0
- package/dist/webhooks/index.js.map +1 -0
- package/package.json +78 -4
- package/src/cli/main.ts +8 -0
- package/src/cli/verify.ts +291 -0
- package/src/client.ts +41 -0
- package/src/errors.ts +96 -0
- package/src/generated/openapi.ts +2578 -0
- package/src/index.ts +4 -0
- package/src/internal/decode.ts +317 -0
- package/src/internal/json.ts +64 -0
- package/src/internal/time.ts +85 -0
- package/src/polling.ts +77 -0
- package/src/receipts/bundle.ts +547 -0
- package/src/receipts/index.ts +27 -0
- package/src/receipts/json.ts +168 -0
- package/src/receipts/key-cache.ts +143 -0
- package/src/receipts/resource.ts +227 -0
- package/src/receipts/verify.ts +468 -0
- package/src/sessions.ts +227 -0
- package/src/transport.ts +524 -0
- package/src/types.ts +135 -0
- package/src/webhook-resource.ts +81 -0
- package/src/webhooks/index.ts +246 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0-rc.5 — 2026-10-15
|
|
4
|
+
|
|
5
|
+
- `verifyDecisionBundle` in `@sess.si/sdk/receipts`: offline verification of a bundle-v1 decision
|
|
6
|
+
bundle against the issuer and keys the caller trusts, with the Sess core's checks, order, bounds,
|
|
7
|
+
reasons and result object, proven against the shared conformance corpus. `BUNDLE_LIMITS` exports
|
|
8
|
+
its size bounds. `verifyDecisionReceipt` is unchanged.
|
|
9
|
+
- The `sess` executable: `sess verify <file> --issuer <url> --keys <jwks.json>` prints a short
|
|
10
|
+
summary (or `--json`), exits 0 valid, 1 invalid, 2 usage error, and makes no network calls.
|
|
11
|
+
- Verbatim receipt-v1 and bundle-v1 specifications in the source repository's `docs/spec/`, checked
|
|
12
|
+
against the Sess copies.
|
|
13
|
+
- The README's first screen installs from npm (`@sess.si/sdk@next`), runs the quickstart and says what
|
|
14
|
+
you'll see; it no longer describes installing a candidate tarball. Release status follows it.
|
|
15
|
+
|
|
16
|
+
## 0.1.0-rc.4 — 2026-10-14
|
|
17
|
+
|
|
18
|
+
Documentation and packaging only; the library source is unchanged from `0.1.0-rc.3`. The README's
|
|
19
|
+
first screen links the runnable plain-Node quickstart (only `SESS_API_KEY` needed; the human link is
|
|
20
|
+
printed before waiting) and points to this changelog and the registry's dist-tags for release status.
|
|
21
|
+
|
|
22
|
+
## 0.1.0-rc.3 — 2026-10-13
|
|
23
|
+
|
|
24
|
+
Unpublished R2 corrective candidate, now named `@sess.si/sdk` by the owner's superseding distribution decision. Earlier candidates and their recorded hashes retain their historical `@sess/sdk` identity; no alias is created. Inherit and validate polling operation budgets, dispose cancelled polling/backoff listeners, and match the runtime replay-key alphabet in transport and durable examples. Extend tracked-source and retained-history scanning with pinned tooling and synthetic controls.
|
|
25
|
+
|
|
26
|
+
## 0.1.0-rc.2 — 2026-10-13
|
|
27
|
+
|
|
28
|
+
Unpublished corrective candidate. Return actual verified-endpoint/redelivery bodies, restore display/interactive immutable Surface retrieval, count Unicode code points, reject nonprimitive replay options, and validate versioned durable-example checkpoints with credential-scope binding. Narrow array-item schema annotations to the runtime-supported subset.
|
|
29
|
+
|
|
30
|
+
## 0.1.0-rc.1 — Unreleased
|
|
31
|
+
|
|
32
|
+
- Compiled ESM JavaScript and declarations for the supported owner HTTP API.
|
|
33
|
+
- Exact-revision polling with explicit concurrency, retry and uncertain-write semantics.
|
|
34
|
+
- Offline and client-assisted full decision-receipt verification and raw-byte webhook verification.
|
|
35
|
+
- Form-authoring, durable continuation, webhook-inbox and CommonJS import examples.
|
|
36
|
+
- Reviewed public-contract snapshot, packed-consumer tests and protected OIDC release preparation.
|
|
37
|
+
|
|
38
|
+
This is a release candidate under review. No registry publication is implied.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
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
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
SESS SDK
|
|
2
|
+
Copyright 2026 Andriy Granovsky
|
|
3
|
+
|
|
4
|
+
This package is prepared for distribution under the Apache License, Version 2.0.
|
|
5
|
+
It contains generated types from the SESS public HTTP contract and independent client code.
|
|
6
|
+
The hosted SESS runtime and renderer are not included.
|
|
7
|
+
|
|
8
|
+
Runtime dependencies retain their own notices and licenses: jose (MIT),
|
|
9
|
+
canonicalize (Apache-2.0), and standardwebhooks (MIT). They are not bundled.
|
package/README.md
CHANGED
|
@@ -1,3 +1,156 @@
|
|
|
1
|
-
#
|
|
1
|
+
# SESS SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Ask a person a question from your server and continue with their verified answer. `@sess.si/sdk`
|
|
4
|
+
creates a hosted SESS page, waits for the answer on the exact Surface revision, verifies its signed
|
|
5
|
+
receipt, and continues the same Session.
|
|
6
|
+
|
|
7
|
+
**Install** from npm:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install --save-exact @sess.si/sdk@next
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Run** the [plain-Node quickstart](examples/quickstart-node/README.md), a complete program that
|
|
14
|
+
needs only `SESS_API_KEY`.
|
|
15
|
+
|
|
16
|
+
**What you'll see:** a private human link, printed before the program starts waiting. Open it on any
|
|
17
|
+
device and answer; the program prints the verified answer and completes the Session.
|
|
18
|
+
|
|
19
|
+
**Release status:** every SDK release so far is a `0.1.0` release candidate, served under the `next`
|
|
20
|
+
dist-tag. There is no stable release yet: do not install the bare name, whose `latest` tag points at a
|
|
21
|
+
deprecated `0.0.0-stage` placeholder. The [changelog](CHANGELOG.md) describes each version;
|
|
22
|
+
`npm view @sess.si/sdk dist-tags` shows what the registry serves now.
|
|
23
|
+
|
|
24
|
+
## Create and verify an interaction
|
|
25
|
+
|
|
26
|
+
Use a developer API key from [the SESS developer portal](https://app.sess.si). Keep it on the server.
|
|
27
|
+
The [hosted no-signup demo](https://sess.si) is a separate trial flow; a human link or trial credential
|
|
28
|
+
is not an owner API key. No LLM, agent framework, Docker or SESS source checkout is needed by consumers.
|
|
29
|
+
|
|
30
|
+
<!-- example:quickstart -->
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { Sess } from '@sess.si/sdk';
|
|
34
|
+
|
|
35
|
+
const sess = new Sess({ apiKey: process.env.SESS_API_KEY });
|
|
36
|
+
const created = await sess.sessions.create({
|
|
37
|
+
interaction: {
|
|
38
|
+
mode: 'interactive',
|
|
39
|
+
title: 'Review a synthetic invoice',
|
|
40
|
+
source: {
|
|
41
|
+
kind: 'sess_surface',
|
|
42
|
+
components: [
|
|
43
|
+
{ type: 'record', label: 'INV-001', fields: { amount: 120 } },
|
|
44
|
+
{
|
|
45
|
+
type: 'field',
|
|
46
|
+
name: 'amount',
|
|
47
|
+
label: 'Correct amount',
|
|
48
|
+
required: true,
|
|
49
|
+
schema: { type: 'number', minimum: 0 },
|
|
50
|
+
value: 120,
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
actions: [{ id: 'submit', label: 'Submit review', intent: 'submit' }],
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Privately deliver created.data.human_url through your application's handoff.
|
|
59
|
+
// It is a bearer capability: do not put it in ordinary logs or analytics.
|
|
60
|
+
const answer = await sess.sessions.waitForResponse(created.data.id, {
|
|
61
|
+
revision: created.data.revision,
|
|
62
|
+
});
|
|
63
|
+
const verified = await sess.receipts.verifyResponse({
|
|
64
|
+
sessionId: created.data.id,
|
|
65
|
+
response: answer.response,
|
|
66
|
+
});
|
|
67
|
+
const amount = verified.response.data.amount;
|
|
68
|
+
if (typeof amount !== 'number' || !Number.isFinite(amount)) {
|
|
69
|
+
throw new Error('Expected an accepted numeric amount');
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
<!-- /example:quickstart -->
|
|
74
|
+
|
|
75
|
+
Full verification needs a trusted workspace audience. A runtime supporting the authenticated
|
|
76
|
+
`Sess-Workspace-Id` header supplies it. On an older runtime, configure `expectedWorkspaceId` from
|
|
77
|
+
trusted deployment settings. Otherwise verification fails with `VERIFICATION_CONTEXT_MISSING`;
|
|
78
|
+
the SDK never learns a trusted audience from the unverified receipt. The runtime companion change
|
|
79
|
+
is under review and is not a claim about the currently deployed service.
|
|
80
|
+
|
|
81
|
+
The [quickstart function](examples/quickstart.ts) includes a private delivery callback.
|
|
82
|
+
[Three-round continuation](examples/multi-round.ts) persists mutation intent and checks that an
|
|
83
|
+
answer is still the current expected business step before publishing or completing. Its store
|
|
84
|
+
and worker lease are application-owned. See [Integration](docs/integration.md).
|
|
85
|
+
|
|
86
|
+
## Check a decision bundle
|
|
87
|
+
|
|
88
|
+
A decision bundle is one accepted decision that its owner chose to share: the signed receipt, the
|
|
89
|
+
exact Surface and input, and the issuer's public keys. Check it on your own computer, with keys you
|
|
90
|
+
trust (never the keys inside the bundle):
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
npx -p @sess.si/sdk@0.1.0-rc.5 sess verify bundle.json --issuer https://api.sess.si --keys sess-receipt-keys.json
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The `sess` command first ships in `0.1.0-rc.5`; name that version (or a later one) exactly, because
|
|
97
|
+
the bare package name resolves to the `latest` placeholder, which has no command.
|
|
98
|
+
|
|
99
|
+
You'll see `Valid decision bundle.` and what was accepted, when, on which revision; or `Invalid`
|
|
100
|
+
and the first reason. Exit status is 0 valid, 1 invalid, 2 usage error; add `--json` for the full
|
|
101
|
+
result. Nothing is sent anywhere. In code, use `verifyDecisionBundle` from `@sess.si/sdk/receipts`
|
|
102
|
+
([Security](docs/security.md#decision-bundles)). Formats: [receipt-v1](docs/spec/receipt-v1.md) and
|
|
103
|
+
[bundle-v1](docs/spec/bundle-v1.md).
|
|
104
|
+
|
|
105
|
+
## Runtime and imports
|
|
106
|
+
|
|
107
|
+
Supported: maintained Node 22 releases at or above 22.14, and Node 24 (recommended).
|
|
108
|
+
TypeScript consumer declarations target 5.9 and current stable. JavaScript consumers need no compiler.
|
|
109
|
+
The package contains one ESM build. CommonJS applications use `await import('@sess.si/sdk')`, as in the
|
|
110
|
+
[CommonJS example](examples/commonjs.cjs); synchronous `require` is not a supported contract.
|
|
111
|
+
|
|
112
|
+
Entry points are `@sess.si/sdk`, `@sess.si/sdk/receipts` and `@sess.si/sdk/webhooks`. Importing or constructing
|
|
113
|
+
the SDK does not contact a service, start a server, read credential files or log data.
|
|
114
|
+
|
|
115
|
+
## Errors and retries
|
|
116
|
+
|
|
117
|
+
Errors are `SessError` with stable `kind`, API `code`, `status`, `requestId`, `attempts` and write
|
|
118
|
+
`outcome` fields when applicable. Server bodies and request secrets are omitted from default errors.
|
|
119
|
+
|
|
120
|
+
Session creation is attempted once. An unknown outcome may mean a Session exists whose private
|
|
121
|
+
URL was lost. Never automatically create again. If a valid creation body arrived with defective
|
|
122
|
+
headers, explicitly inspect `error.getRecoveryResult()` and protect that capability.
|
|
123
|
+
|
|
124
|
+
Publish and complete require a strong quoted `ifMatch`. Persist the body, original ETag and explicit
|
|
125
|
+
`idempotencyKey` before a durable write. Internal retries retain those values and the same resolved
|
|
126
|
+
credential. A 409 or 412 is returned to the caller; the SDK never refreshes an ETag to force a write.
|
|
127
|
+
|
|
128
|
+
## Direct HTTP remains supported
|
|
129
|
+
|
|
130
|
+
The same create operation is available without the SDK:
|
|
131
|
+
|
|
132
|
+
```sh
|
|
133
|
+
curl --request POST https://api.sess.si/v1/sessions \
|
|
134
|
+
--header "Authorization: Bearer $SESS_API_KEY" \
|
|
135
|
+
--header 'Content-Type: application/json' \
|
|
136
|
+
--data-binary @interaction.json
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Here `interaction.json` contains the same `{ "interaction": ... }` request body. The response
|
|
140
|
+
contains a private human URL; protect terminal output and disable request tracing. The complete
|
|
141
|
+
contract is served at [OpenAPI](https://api.sess.si/openapi.json).
|
|
142
|
+
|
|
143
|
+
## Guides
|
|
144
|
+
|
|
145
|
+
- [API reference](docs/api.md): supported operations, validated responses, options and errors.
|
|
146
|
+
- [Integration](docs/integration.md): authoring, lifecycle, validation, durability and future boundaries.
|
|
147
|
+
- [Security](docs/security.md) and [receipt example](examples/receipt-verification.ts).
|
|
148
|
+
- [Webhooks](docs/webhooks.md) and [Node receiver with a durable-inbox boundary](examples/webhook-receiver.ts).
|
|
149
|
+
- [Compatibility](docs/compatibility.md), [testbed migration](docs/migration.md) and [release runbook](docs/releasing.md).
|
|
150
|
+
- [Plain-Node quickstart](examples/quickstart-node/README.md): a complete program, from the first call to the verified answer.
|
|
151
|
+
|
|
152
|
+
The present runtime can require manual browser refresh between rounds. Owner polling in this
|
|
153
|
+
SDK does not change that browser behavior. Appearance configuration and front-door invocation
|
|
154
|
+
helpers remain conditional future work, with no placeholder exports.
|
|
155
|
+
|
|
156
|
+
[Contribute](CONTRIBUTING.md) · [Security reporting](SECURITY.md) · [Apache-2.0](LICENSE)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":""}
|
package/dist/cli/main.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The `sess` executable. The only command is `sess verify <bundle.json>` (see ./verify.ts).
|
|
3
|
+
import { runCli } from './verify.js';
|
|
4
|
+
process.exitCode = await runCli(process.argv.slice(2), {
|
|
5
|
+
stdout: (text) => process.stdout.write(text),
|
|
6
|
+
stderr: (text) => process.stderr.write(text),
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AACA,4FAA4F;AAC5F,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,CAAC,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACrD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;IAC5C,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;CAC7C,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Exit codes: valid, invalid bundle, usage or file error. */
|
|
2
|
+
export declare const EXIT: Readonly<{
|
|
3
|
+
valid: 0;
|
|
4
|
+
invalid: 1;
|
|
5
|
+
usage: 2;
|
|
6
|
+
}>;
|
|
7
|
+
export interface CliIo {
|
|
8
|
+
stdout: (text: string) => void;
|
|
9
|
+
stderr: (text: string) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const USAGE = "Usage: sess verify <bundle.json> --issuer <url> --keys <jwks.json> [options]\n\nChecks a Sess decision bundle on this computer against the issuer and keys you trust.\nNothing is sent anywhere. Keys inside the bundle are never trusted.\n\nRequired:\n --issuer <url> the receipt issuer you trust, for example https://api.sess.si\n --keys <file> that issuer's public keys (a JWK Set) you obtained yourself\n\nExpected context (optional; only what you pass is checked):\n --audience <id> the workspace the decision must belong to\n --workspace <id> the workspace ID\n --session <id> the Session ID\n --event <id> the Event ID\n --revision <n> the Surface revision\n --action <id> the action ID\n\nOther:\n --now <time> check at this RFC 3339 time instead of now\n --json print the full result as JSON\n -h, --help show this help\n\nExit status: 0 valid, 1 invalid, 2 usage or file error.\n";
|
|
12
|
+
/** Runs `sess <argv>`; resolves to the exit code. Never throws. */
|
|
13
|
+
export declare function runCli(argv: readonly string[], io: CliIo): Promise<number>;
|
|
14
|
+
//# sourceMappingURL=verify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/cli/verify.ts"],"names":[],"mappings":"AAaA,8DAA8D;AAC9D,eAAO,MAAM,IAAI;;;;EAAoD,CAAC;AAMtE,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED,eAAO,MAAM,KAAK,28BAuBjB,CAAC;AA0MF,mEAAmE;AACnE,wBAAsB,MAAM,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAuChF"}
|