@sess.si/sdk 0.4.0 → 0.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.0 — 2026-11-22
4
+
5
+ - The closing receipt: when a Session ends with at least one accepted answer, Sess signs how it
6
+ ended and every accepted answer's receipt, in order. `sessions.listEvents()` returns it as
7
+ `closing`, beside `events`, never as an Event; it is absent otherwise. New type
8
+ `SessionClosing`.
9
+ - `receipts.verifyClosing({ sessionId, closing })` verifies it against the Session's Event log and
10
+ the published keys and returns `{ claims, closing }`. `verifyClosingReceipt` in
11
+ `@sess.si/sdk/receipts` verifies one offline. A round receipt offered as a closing receipt is
12
+ refused with `UNSUPPORTED_TYPE`; rounds that are not exactly the signed ones with
13
+ `CLOSING_ROUNDS_MISMATCH`. New types `ClosingReceiptClaims`, `ClosingCause`,
14
+ `VerifyClosingReceiptInput`, `VerifyClosingReceiptOptions`, `VerifyClosingInput` and
15
+ `VerifiedClosing`.
16
+ - Unchanged: `verifyDecisionReceipt` still refuses a closing receipt as newer (`RECEIPT_NEWER`),
17
+ and `verifyWebhook` still refuses every Session message but `response.accepted`.
18
+ - The closing-receipt-v1 specification and conformance corpus are copies from Sess commit
19
+ `7be0bf3`. The runtime dependencies are unchanged.
20
+
21
+ ## 0.5.0 — 2026-11-21
22
+
23
+ - Sess's tighter text limits: title 60, description 200, heading 40, field label 40, field help
24
+ 120, option label 30, record key 24, button 16, items row name 30; every other limit is unchanged.
25
+
3
26
  ## 0.4.0 — 2026-11-18
4
27
 
5
28
  - Receipt v2 reads the frozen revision envelope, `sess_revision: 2`, and only it: ten common
package/README.md CHANGED
@@ -14,7 +14,7 @@ terminal with a verified receipt.
14
14
  **Install** the SDK in your own server project:
15
15
 
16
16
  ```sh
17
- npm install --save-exact @sess.si/sdk@0.4.0
17
+ npm install --save-exact @sess.si/sdk@0.6.0
18
18
  ```
19
19
 
20
20
  ## Ask a person
@@ -86,21 +86,22 @@ characters (Unicode code points), and Sess never truncates:
86
86
 
87
87
  | What | Style | At most |
88
88
  | --------------------------- | ------------------------------ | -------- |
89
- | Title (`question`) | A question or a task, about 40 | 80 |
90
- | Button (`submit_label`) | A verb, 1–3 words | 24 |
91
- | Field label, option | Short | 60 |
92
- | Help (field `description`) | One hint | 160 |
93
- | Description under the title | One or two sentences | 280 |
94
- | Heading | Short | 60 |
89
+ | Title (`question`) | A question or a task, about 40 | 60 |
90
+ | Button (`submit_label`) | A verb, 1–3 words | 16 |
91
+ | Field label | Short | 40 |
92
+ | Option | Short | 30 |
93
+ | Help (field `description`) | One hint | 120 |
94
+ | Description under the title | One or two sentences | 200 |
95
+ | Heading | Short | 40 |
95
96
  | Record caption | A few words | 200 |
96
- | Record key / string value | As written | 40 / 200 |
97
+ | Record key / string value | As written | 24 / 200 |
97
98
  | Text (`details`) | Plain text | 4,000 |
98
99
 
99
100
  There are at most 5 buttons. A value over its limit fails with a `SessError` that names it:
100
101
  `field` is a JSON pointer such as `/question`, `limit` is the most it may have and `length` is
101
- what it has. The message says how to fix it: "The title can be at most 80 characters. Keep it
102
+ what it has. The message says how to fix it: "The title can be at most 60 characters. Keep it
102
103
  to a short heading, about 40." for the title, and for anything else, for example
103
- "/fields/0/label is 72 characters; the limit is 60. Shorten it to at most 60 characters." Nothing
104
+ "/fields/0/label is 52 characters; the limit is 40. Shorten it to at most 40 characters." Nothing
104
105
  was created (`outcome` is `not_sent` or `rejected`), so shorten the value and ask again:
105
106
 
106
107
  ```ts
@@ -120,9 +121,11 @@ async function askShort(question: string) {
120
121
  }
121
122
  ```
122
123
 
123
- **Release status:** `0.4.0` is the current release, served under the `latest` dist-tag. It
124
- verifies receipt v2 in its frozen format, still verifies receipt v1, and accepts a Sess Ask's
125
- webhook messages. A receipt newer than this release is reported as newer, never as a failed check.
124
+ **Release status:** `0.6.0` is the current release, served under the `latest` dist-tag. It
125
+ returns a Session's closing receipt with its Events and verifies it, checks Sess's tighter text
126
+ limits before anything is sent, verifies receipt v2 in its frozen format, still verifies receipt
127
+ v1, and accepts a Sess Ask's webhook messages. A receipt newer than this
128
+ release is reported as newer, never as a failed check.
126
129
  `next` stays at the last release candidate, `0.1.0-rc.10`. The [changelog](CHANGELOG.md) describes each version; `npm view @sess.si/sdk dist-tags` shows what the registry serves now.
127
130
 
128
131
  ## Commerce
@@ -146,7 +149,7 @@ console.log(`Send this Sess link to the person: ${created.data.human_url}`);
146
149
 
147
150
  Three things you will meet first:
148
151
 
149
- - **Short rows.** A row name has at most 80 characters and its detail at most 160. A longer value
152
+ - **Short rows.** A row name has at most 30 characters and its detail at most 160. A longer value
150
153
  is refused, never trimmed: the `SessError` names it by its pointer, such as
151
154
  `/interaction/source/components/1/rows/0/name`, with `limit` and `length`.
152
155
  - **Whole minor units.** Amounts are integers in the currency's smallest unit: cents for USD, yen
@@ -243,10 +246,10 @@ exact Surface and input, and the issuer's public keys. Check it on your own comp
243
246
  trust (never the keys inside the bundle):
244
247
 
245
248
  ```sh
246
- npx -p @sess.si/sdk@0.4.0 sess verify bundle.json --issuer https://api.sess.si --keys sess-receipt-keys.json
249
+ npx -p @sess.si/sdk@0.6.0 sess verify bundle.json --issuer https://api.sess.si --keys sess-receipt-keys.json
247
250
  ```
248
251
 
249
- The `sess` command first ships in `0.1.0-rc.5`; any later version, `0.4.0` included, has it.
252
+ The `sess` command first ships in `0.1.0-rc.5`; any later version, `0.6.0` included, has it.
250
253
 
251
254
  You'll see `Valid decision bundle.` and what was accepted, when, on which revision; or `Invalid`
252
255
  and the first reason; or `This bundle is newer than @sess.si/sdk {version}. Update @sess.si/sdk to
package/dist/ask.d.ts CHANGED
@@ -5,7 +5,7 @@ import type { ApiResult, AskCounts, AskRespondentRecord, CreateAskRequest, Creat
5
5
  interface AskFieldBase {
6
6
  /** Key of this field in the answer: `^[a-z][a-z0-9_]{0,63}$`. */
7
7
  readonly name: string;
8
- /** What the field asks for: short, a few words; at most 60. Example: `Refund amount` */
8
+ /** What the field asks for: short, a few words; at most 40. Example: `Refund amount` */
9
9
  readonly label: string;
10
10
  /** Default `true`, except boolean fields (default `false`). */
11
11
  readonly required?: boolean;
@@ -42,12 +42,12 @@ export type AskField = (AskFieldBase & {
42
42
  readonly default?: number;
43
43
  }) | (AskFieldBase & {
44
44
  readonly type: 'choice';
45
- /** 1–100 choices. The words shown for one choice: short; at most 60. Example: `Next Monday` */
45
+ /** 1–100 choices. The words shown for one choice: short; at most 30. Example: `Next Monday` */
46
46
  readonly options: readonly [string, ...string[]];
47
47
  readonly default?: string;
48
48
  }) | (AskFieldBase & {
49
49
  readonly type: 'multi_choice';
50
- /** 1–100 choices. The words shown for one choice: short; at most 60. Example: `Next Monday` */
50
+ /** 1–100 choices. The words shown for one choice: short; at most 30. Example: `Next Monday` */
51
51
  readonly options: readonly [string, ...string[]];
52
52
  readonly default?: readonly string[];
53
53
  });
@@ -58,13 +58,13 @@ export type AskField = (AskFieldBase & {
58
58
  */
59
59
  export interface AskInput<F extends readonly AskField[] = readonly AskField[]> {
60
60
  /**
61
- * The page's heading: a question or a task, about 40 characters; at most 80.
61
+ * The page's heading: a question or a task, about 40 characters; at most 60.
62
62
  * Examples: `Approve the refund?`, `Pick a delivery date`
63
63
  */
64
64
  readonly question: string;
65
65
  /** Optional plain-text context shown above the fields, at most 4,000 characters. */
66
66
  readonly details?: string;
67
- /** A button: a verb, 1–3 words; at most 24. Default `Send`. Examples: `Approve`, `Send refund` */
67
+ /** A button: a verb, 1–3 words; at most 16. Default `Send`. Examples: `Approve`, `Send refund` */
68
68
  readonly submit_label?: string;
69
69
  /** One to twelve fields with unique names. */
70
70
  readonly fields: F;
package/dist/ask.js CHANGED
@@ -9,19 +9,19 @@ import { withSignal } from './internal/time.js';
9
9
  const SURFACE_LIMIT_BYTES = 131_072;
10
10
  /**
11
11
  * Sess's limits, in Unicode code points (the runtime checks the same numbers; nothing is ever
12
- * truncated): the question (title) 80, details (a text component) 4,000, the submit button 24,
13
- * field labels and options 60.
12
+ * truncated): the question (title) 60, details (a text component) 4,000, the submit button 16,
13
+ * field labels 40, options 30.
14
14
  */
15
15
  const LIMITS = Object.freeze({
16
16
  fields: 12,
17
17
  options: 100,
18
18
  depth: 8,
19
19
  textMax: 4000,
20
- question: 80,
20
+ question: 60,
21
21
  details: 4000,
22
- submitLabel: 24,
23
- label: 60,
24
- option: 60,
22
+ submitLabel: 16,
23
+ label: 40,
24
+ option: 30,
25
25
  /** A rating's end label (`low`, `high`). */
26
26
  ratingLabel: 24,
27
27
  });
package/dist/client.js CHANGED
@@ -24,6 +24,7 @@ export class Sess {
24
24
  operationTimeoutMs: transport.operationTimeoutMs,
25
25
  retrieveSession: (id, requestOptions) => this.sessions.retrieve(id, requestOptions),
26
26
  retrieveSurface: (id, revision, requestOptions) => this.sessions.retrieveSurface(id, revision, requestOptions),
27
+ listEvents: (id, requestOptions) => this.sessions.listEvents(id, requestOptions),
27
28
  publicGet: (path, requestOptions) => transport.request({
28
29
  name: 'receipts.keys',
29
30
  method: 'GET',
@@ -4,9 +4,9 @@ type Action = InteractiveInteraction['actions'][number];
4
4
  type RecordValue = string | number | boolean | null;
5
5
  /** Common input of the five builders: the items input plus the page around it. */
6
6
  export interface BillInput extends ItemsInput {
7
- /** The page's heading, about 40 characters; at most 80. Each builder has a default. */
7
+ /** The page's heading, about 40 characters; at most 60. Each builder has a default. */
8
8
  readonly title?: string;
9
- /** Optional context under the title, one or two sentences; at most 280. */
9
+ /** Optional context under the title, one or two sentences; at most 200. */
10
10
  readonly description?: string;
11
11
  /** Advanced: the BCP 47 locale the page formats amounts in (default: the page's language). */
12
12
  readonly locale?: string;
@@ -1,13 +1,13 @@
1
1
  import { buildItems, refuse, text, token, tooLong } from './items.js';
2
2
  import { lintText } from './lint.js';
3
3
  const LIMITS = Object.freeze({
4
- title: 80,
5
- description: 280,
6
- recordKey: 40,
4
+ title: 60,
5
+ description: 200,
6
+ recordKey: 24,
7
7
  recordValue: 200,
8
8
  recordFields: 50,
9
9
  actions: 5,
10
- actionLabel: 24,
10
+ actionLabel: 16,
11
11
  });
12
12
  const ACTION_ID = /^[a-z][a-z0-9_]{0,31}$/;
13
13
  const INTENTS = ['submit', 'continue', 'approve', 'reject', 'request_change'];
@@ -1,13 +1,13 @@
1
1
  import type { ItemsComponent } from '../types.js';
2
2
  /**
3
3
  * The runtime's items limits (Unicode code points for text): rows 1–100, totals lines ≤ 8, a row
4
- * name ≤ 80, a detail ≤ 160, a totals label ≤ 40, a caption ≤ 200, a quantity unit ≤ 16, every
4
+ * name ≤ 30, a detail ≤ 160, a totals label ≤ 40, a caption ≤ 200, a quantity unit ≤ 16, every
5
5
  * amount within ±10^15 minor units, a quantity within 0–1,000,000.
6
6
  */
7
7
  export declare const ITEMS_LIMITS: Readonly<{
8
8
  rows: 100;
9
9
  totals: 8;
10
- name: 80;
10
+ name: 30;
11
11
  detail: 160;
12
12
  totalLabel: 40;
13
13
  label: 200;
@@ -24,7 +24,7 @@ export interface Money {
24
24
  export type Amount = number | Money;
25
25
  /** A line of the bill. Put quantity and unit price in `detail`, not in `name`. */
26
26
  export interface ItemRowInput {
27
- /** What the line is, shown verbatim; at most 80. Example: `Design retainer, October` */
27
+ /** What the line is, shown verbatim; at most 30. Example: `Design retainer, October` */
28
28
  readonly name: string;
29
29
  /** Optional second line: quantity or unit price; at most 160 with `reference`. Example: `3 × $150.00` */
30
30
  readonly detail?: string;
@@ -7,13 +7,13 @@ import { SessError, lengthMessage } from '../errors.js';
7
7
  import { minorUnits } from './currency.js';
8
8
  /**
9
9
  * The runtime's items limits (Unicode code points for text): rows 1–100, totals lines ≤ 8, a row
10
- * name ≤ 80, a detail ≤ 160, a totals label ≤ 40, a caption ≤ 200, a quantity unit ≤ 16, every
10
+ * name ≤ 30, a detail ≤ 160, a totals label ≤ 40, a caption ≤ 200, a quantity unit ≤ 16, every
11
11
  * amount within ±10^15 minor units, a quantity within 0–1,000,000.
12
12
  */
13
13
  export const ITEMS_LIMITS = Object.freeze({
14
14
  rows: 100,
15
15
  totals: 8,
16
- name: 80,
16
+ name: 30,
17
17
  detail: 160,
18
18
  totalLabel: 40,
19
19
  label: 200,
package/dist/errors.d.ts CHANGED
@@ -50,7 +50,7 @@ export declare class SessError extends Error {
50
50
  * the value to at most `limit` characters and send again.
51
51
  */
52
52
  readonly field?: string;
53
- /** With `field`: the most the value may have, in Unicode code points (e.g. title 80). */
53
+ /** With `field`: the most the value may have, in Unicode code points (e.g. title 60). */
54
54
  readonly limit?: number;
55
55
  /** With `field`: the value's actual length, in Unicode code points. */
56
56
  readonly length?: number;