@sess.si/sdk 0.1.0-rc.5 → 0.1.0-rc.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +43 -1
  2. package/NOTICE +18 -0
  3. package/README.md +72 -19
  4. package/dist/ask.d.ts +150 -0
  5. package/dist/ask.d.ts.map +1 -0
  6. package/dist/ask.js +465 -0
  7. package/dist/ask.js.map +1 -0
  8. package/dist/client.d.ts +8 -0
  9. package/dist/client.d.ts.map +1 -1
  10. package/dist/client.js +10 -0
  11. package/dist/client.js.map +1 -1
  12. package/dist/generated/openapi.d.ts +6461 -1009
  13. package/dist/generated/openapi.d.ts.map +1 -1
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/internal/decode.d.ts.map +1 -1
  18. package/dist/internal/decode.js +4 -1
  19. package/dist/internal/decode.js.map +1 -1
  20. package/dist/polling.d.ts +8 -0
  21. package/dist/polling.d.ts.map +1 -1
  22. package/dist/polling.js +32 -1
  23. package/dist/polling.js.map +1 -1
  24. package/dist/qr/encoder.d.ts +11 -0
  25. package/dist/qr/encoder.d.ts.map +1 -0
  26. package/dist/qr/encoder.js +344 -0
  27. package/dist/qr/encoder.js.map +1 -0
  28. package/dist/qr/index.d.ts +56 -0
  29. package/dist/qr/index.d.ts.map +1 -0
  30. package/dist/qr/index.js +151 -0
  31. package/dist/qr/index.js.map +1 -0
  32. package/dist/sessions.d.ts.map +1 -1
  33. package/dist/sessions.js +7 -0
  34. package/dist/sessions.js.map +1 -1
  35. package/dist/transport.d.ts +2 -0
  36. package/dist/transport.d.ts.map +1 -1
  37. package/dist/transport.js +11 -2
  38. package/dist/transport.js.map +1 -1
  39. package/dist/types.d.ts +11 -0
  40. package/dist/types.d.ts.map +1 -1
  41. package/dist/types.js.map +1 -1
  42. package/dist/webhooks/index.js +1 -1
  43. package/dist/webhooks/index.js.map +1 -1
  44. package/package.json +6 -2
  45. package/src/ask.ts +636 -0
  46. package/src/client.ts +14 -0
  47. package/src/generated/openapi.ts +6724 -1163
  48. package/src/index.ts +1 -0
  49. package/src/internal/decode.ts +3 -1
  50. package/src/polling.ts +45 -1
  51. package/src/qr/encoder.ts +345 -0
  52. package/src/qr/index.ts +203 -0
  53. package/src/sessions.ts +11 -0
  54. package/src/transport.ts +11 -2
  55. package/src/types.ts +14 -1
  56. package/src/webhooks/index.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,47 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0-rc.7 — 2026-10-18 (prepared, unpublished)
4
+
5
+ Includes everything in the unpublished 0.1.0-rc.6 below, which is not published on its own.
6
+
7
+ - Advanced: a link lifetime. `sessions.create()` and `sess.ask()` take an optional `expires_in`, in
8
+ whole seconds from creation: from 30 up to your plan's link lifetime (Sess checks the ceiling).
9
+ Values below 30 or not whole are refused before anything is sent. Absent: the plan's lifetime,
10
+ as before.
11
+ - The create response carries the link's expiry as `action_expires_at`; `sess.ask()` handles expose
12
+ it as `expiresAt`. Nothing moves it later: not reading, not completing.
13
+ - `waitForResponse()` (and `answer()`) observe the expiry. Once the runtime clock (the response's
14
+ HTTP `Date`, else this machine's) is two seconds past `action_expires_at`, one final read decides:
15
+ an answer accepted before the expiry is returned as the result; otherwise the wait ends with
16
+ `wait_ended`, code `LINK_EXPIRED`. The SDK never completes a Session on its own.
17
+ - `ResponseMeta.serverDate`: the response's HTTP `Date`, when the runtime sends one.
18
+ - Contract snapshot from Sess runtime commit `b48e8e7` (see `contract/contract-lock.json`), with
19
+ `expires_in`, `action_expires_at` on create and the target's `default_expires_in`.
20
+ - `@sess.si/sdk/qr` (S-07): `qr(url, { format: 'svg' | 'png' | 'terminal' })` draws a Sess link as a
21
+ QR code locally (error correction level M, 4-module quiet zone, deterministic, no network call), and
22
+ `printQr(url)` prints "Scan to answer on your phone" and the code on an interactive terminal only:
23
+ never without a TTY, in CI or with `NODE_ENV=production`; `--no-qr` or `{ qr: false }` turn it off
24
+ and `NO_COLOR` draws it without colour. The SVG is one exact tree with the accessible title "QR code
25
+ for this Sess link". The encoder is the Sess renderer's, after Project Nayuki's QR Code generator
26
+ (MIT; see NOTICE). No new dependency; every existing export is unchanged.
27
+
28
+ ## 0.1.0-rc.6 — 2026-10-15
29
+
30
+ - `sess.ask({ question, fields })`: one question with simple typed fields (the MCP `sess_ask`
31
+ shape). It validates locally, creates the Session once and returns its private link before
32
+ waiting. `answer()` verifies the receipt and exact Surface, checks that the answer is still
33
+ current, completes the Session and returns values typed from the field definitions and checked at
34
+ runtime. New types `AskInput`, `AskField`, `AskAnswer`, `AskHandle`, `AskOptions` and
35
+ `AskAnswerOptions`. Every existing export, `verifyDecisionReceipt` and the advanced API are
36
+ unchanged.
37
+ - The README opens with `sess.ask()`; the full Surface API is under "Advanced", unchanged.
38
+ - Wording only: the README's guide list and closing note, and the `0.1.0-rc.3` entry below, no
39
+ longer refer to internal processes or unreleased work.
40
+ - Wording only: the README, the package description and four error messages say "Sess" in plain
41
+ sentences. The README drops the stale manual-refresh caveat (the hosted page now advances between
42
+ rounds by itself) and notes that Sess supplies the trusted workspace for verification. Error
43
+ `kind`, `code` and every other field are unchanged.
44
+
3
45
  ## 0.1.0-rc.5 — 2026-10-15
4
46
 
5
47
  - `verifyDecisionBundle` in `@sess.si/sdk/receipts`: offline verification of a bundle-v1 decision
@@ -21,7 +63,7 @@ printed before waiting) and points to this changelog and the registry's dist-tag
21
63
 
22
64
  ## 0.1.0-rc.3 — 2026-10-13
23
65
 
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.
66
+ Unpublished corrective candidate, the first named `@sess.si/sdk`. Earlier candidates and their recorded hashes keep their historical `@sess/sdk` name; 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
67
 
26
68
  ## 0.1.0-rc.2 — 2026-10-13
27
69
 
package/NOTICE CHANGED
@@ -7,3 +7,21 @@ The hosted SESS runtime and renderer are not included.
7
7
 
8
8
  Runtime dependencies retain their own notices and licenses: jose (MIT),
9
9
  canonicalize (Apache-2.0), and standardwebhooks (MIT). They are not bundled.
10
+
11
+ The QR Code encoder in src/qr/encoder.ts is structured after Project Nayuki's QR Code generator
12
+ library (https://www.nayuki.io/page/qr-code-generator-library), used under the MIT License:
13
+
14
+ Copyright (c) Project Nayuki. (MIT License)
15
+
16
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
17
+ associated documentation files (the "Software"), to deal in the Software without restriction,
18
+ including without limitation the rights to use, copy, modify, merge, publish, distribute,
19
+ sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
20
+ furnished to do so, subject to the following conditions:
21
+ - The above copyright notice and this permission notice shall be included in all copies or
22
+ substantial portions of the Software.
23
+ - The Software is provided "as is", without warranty of any kind, express or implied, including
24
+ but not limited to the warranties of merchantability, fitness for a particular purpose and
25
+ noninfringement. In no event shall the authors or copyright holders be liable for any claim,
26
+ damages or other liability, whether in an action of contract, tort or otherwise, arising from,
27
+ out of or in connection with the Software or the use or other dealings in the Software.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # SESS SDK
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.
4
+ creates a hosted Sess page, waits for the answer, checks its signed receipt and continues the same
5
+ Session.
6
6
 
7
7
  **Install** from npm:
8
8
 
@@ -13,19 +13,54 @@ npm install --save-exact @sess.si/sdk@next
13
13
  **Run** the [plain-Node quickstart](examples/quickstart-node/README.md), a complete program that
14
14
  needs only `SESS_API_KEY`.
15
15
 
16
- **What you'll see:** a private human link, printed before the program starts waiting. Open it on any
16
+ **What you'll see:** a Sess link, printed before the program starts waiting. Open it on any
17
17
  device and answer; the program prints the verified answer and completes the Session.
18
18
 
19
+ ## Ask a person
20
+
21
+ Use a developer API key from [the Sess developer portal](https://app.sess.si). Keep it on the server.
22
+ The [hosted no-signup demo](https://sess.si) is a separate trial flow; a Sess link or trial credential
23
+ is not an owner API key. You need no LLM, agent framework, Docker or Sess source checkout.
24
+
25
+ <!-- example:ask -->
26
+
27
+ ```ts
28
+ import { Sess } from '@sess.si/sdk';
29
+ const sess = new Sess({ apiKey: process.env.SESS_API_KEY });
30
+ const question = await sess.ask({
31
+ question: 'Approve the synthetic refund?',
32
+ fields: [
33
+ { name: 'approved', label: 'Approve it', type: 'boolean' },
34
+ { name: 'amount', label: 'Refund amount', type: 'number', minimum: 0 },
35
+ ],
36
+ });
37
+ console.log(`Send this Sess link to the person: ${question.link}`);
38
+ const { approved, amount } = await question.answer(); // verified; the Session is now complete
39
+ if (approved) console.log(`Refund of ${amount.toFixed(2)} approved.`);
40
+ ```
41
+
42
+ <!-- /example:ask -->
43
+
44
+ `sess.ask()` checks the question locally, creates the Session once and returns its Sess link
45
+ before anything waits. The link is a bearer capability: deliver it only to the person, never to
46
+ logs or analytics. `answer()` waits for the person (ten minutes by default), verifies the signed
47
+ receipt against the exact question, checks that the answer is still the current step, completes the
48
+ Session and returns the values typed from your fields. Completion closes the Session: the link no
49
+ longer accepts answers. Field types are `text`, `number`, `integer`, `boolean`, `choice` and
50
+ `multi_choice` ([API reference](docs/api.md#ask-one-question)).
51
+
52
+ If the wait times out (`wait_ended`, code `WAIT_TIMEOUT`) or you abort it, nothing changes remotely:
53
+ call `answer()` again on the same handle. An error with `outcome: "unknown"` means completion is not
54
+ confirmed; calling `answer()` again replays the same completion. The handle lives in memory only. To
55
+ resume after a restart, persist `sessionId` and `revision` and continue with the API below
56
+ ([Integration](docs/integration.md#one-question-with-sessask)).
57
+
19
58
  **Release status:** every SDK release so far is a `0.1.0` release candidate, served under the `next`
20
59
  dist-tag. There is no stable release yet: do not install the bare name, whose `latest` tag points at a
21
60
  deprecated `0.0.0-stage` placeholder. The [changelog](CHANGELOG.md) describes each version;
22
61
  `npm view @sess.si/sdk dist-tags` shows what the registry serves now.
23
62
 
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.
63
+ ## Advanced: the full Surface API
29
64
 
30
65
  <!-- example:quickstart -->
31
66
 
@@ -72,11 +107,10 @@ if (typeof amount !== 'number' || !Number.isFinite(amount)) {
72
107
 
73
108
  <!-- /example:quickstart -->
74
109
 
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.
110
+ Verification checks that the receipt was issued for your workspace. Sess names your workspace on
111
+ authenticated responses (the `Sess-Workspace-Id` header), so you set nothing. If a runtime does not
112
+ send it, set `expectedWorkspaceId` from trusted deployment settings; otherwise verification fails
113
+ with `VERIFICATION_CONTEXT_MISSING`. The SDK never takes the workspace from the unverified receipt.
80
114
 
81
115
  The [quickstart function](examples/quickstart.ts) includes a private delivery callback.
82
116
  [Three-round continuation](examples/multi-round.ts) persists mutation intent and checks that an
@@ -102,6 +136,27 @@ result. Nothing is sent anywhere. In code, use `verifyDecisionBundle` from `@ses
102
136
  ([Security](docs/security.md#decision-bundles)). Formats: [receipt-v1](docs/spec/receipt-v1.md) and
103
137
  [bundle-v1](docs/spec/bundle-v1.md).
104
138
 
139
+ ## Show the link as a QR code
140
+
141
+ When the person is at a laptop and would answer on their phone, draw the link as a QR code, locally,
142
+ with no network call:
143
+
144
+ ```ts
145
+ import { printQr, qr } from '@sess.si/sdk/qr';
146
+
147
+ const link = 'https://sess.si/s/synthetic-link'; // the link sess.ask() returned
148
+ console.log(link);
149
+ printQr(link); // prints "Scan to answer on your phone" and the code, on an interactive terminal only
150
+ const svg = qr(link, { format: 'svg' }); // also 'png' (bytes) and 'terminal' (text)
151
+ ```
152
+
153
+ Use it where a person sees a screen but not their phone: a desktop chat window, a dashboard, a kiosk,
154
+ print. Skip it in SMS, or when the person is already on their phone. Sess never shows or sends the
155
+ code; your agent chooses. `printQr` prints nothing without a TTY, in CI (`CI` set), in production
156
+ (`NODE_ENV=production`), with `--no-qr` or with `{ qr: false }`, and draws without colour under
157
+ `NO_COLOR`. The code is the private link in another form: keep it wherever you keep the link, and
158
+ never in logs, analytics or a URL.
159
+
105
160
  ## Runtime and imports
106
161
 
107
162
  Supported: maintained Node 22 releases at or above 22.14, and Node 24 (recommended).
@@ -109,7 +164,7 @@ TypeScript consumer declarations target 5.9 and current stable. JavaScript consu
109
164
  The package contains one ESM build. CommonJS applications use `await import('@sess.si/sdk')`, as in the
110
165
  [CommonJS example](examples/commonjs.cjs); synchronous `require` is not a supported contract.
111
166
 
112
- Entry points are `@sess.si/sdk`, `@sess.si/sdk/receipts` and `@sess.si/sdk/webhooks`. Importing or constructing
167
+ Entry points are `@sess.si/sdk`, `@sess.si/sdk/receipts`, `@sess.si/sdk/webhooks` and `@sess.si/sdk/qr`. Importing or constructing
113
168
  the SDK does not contact a service, start a server, read credential files or log data.
114
169
 
115
170
  ## Errors and retries
@@ -146,11 +201,9 @@ contract is served at [OpenAPI](https://api.sess.si/openapi.json).
146
201
  - [Integration](docs/integration.md): authoring, lifecycle, validation, durability and future boundaries.
147
202
  - [Security](docs/security.md) and [receipt example](examples/receipt-verification.ts).
148
203
  - [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).
204
+ - [Compatibility](docs/compatibility.md), [migrating to the registry package](docs/migration.md) and [release runbook](docs/releasing.md).
150
205
  - [Plain-Node quickstart](examples/quickstart-node/README.md): a complete program, from the first call to the verified answer.
151
206
 
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.
207
+ Sess renders the page the person sees; this SDK has no appearance settings.
155
208
 
156
209
  [Contribute](CONTRIBUTING.md) · [Security reporting](SECURITY.md) · [Apache-2.0](LICENSE)
package/dist/ask.d.ts ADDED
@@ -0,0 +1,150 @@
1
+ import type { ReceiptResource } from './receipts/resource.js';
2
+ import type { Sessions } from './sessions.js';
3
+ import type { InteractiveInteraction, RequestOptions } from './types.js';
4
+ interface AskFieldBase {
5
+ /** Key of this field in the answer: `^[a-z][a-z0-9_]{0,63}$`. */
6
+ readonly name: string;
7
+ /** Human-facing label, 1–200 characters. */
8
+ readonly label: string;
9
+ /** Default `true`, except boolean fields (default `false`). */
10
+ readonly required?: boolean;
11
+ }
12
+ /**
13
+ * One simple field of a single question. Each kind compiles to the ordinary interactive field
14
+ * with the runtime names, limits and schema semantics. `default` is a proposal the person can
15
+ * correct; it must itself be a valid value.
16
+ */
17
+ export type AskField = (AskFieldBase & {
18
+ readonly type: 'text';
19
+ readonly multiline?: boolean;
20
+ readonly default?: string;
21
+ }) | (AskFieldBase & {
22
+ readonly type: 'number' | 'integer';
23
+ readonly minimum?: number;
24
+ readonly maximum?: number;
25
+ readonly default?: number;
26
+ }) | (AskFieldBase & {
27
+ readonly type: 'boolean';
28
+ readonly default?: boolean;
29
+ }) | (AskFieldBase & {
30
+ readonly type: 'choice';
31
+ readonly options: readonly [string, ...string[]];
32
+ readonly default?: string;
33
+ }) | (AskFieldBase & {
34
+ readonly type: 'multi_choice';
35
+ readonly options: readonly [string, ...string[]];
36
+ readonly default?: readonly string[];
37
+ });
38
+ /** A question plus typed fields: the same shape as the MCP `sess_ask` tool input. */
39
+ export interface AskInput<F extends readonly AskField[] = readonly AskField[]> {
40
+ /** Shown as the page title, 1–200 characters. */
41
+ readonly question: string;
42
+ /** Optional plain-text context shown above the fields, 1–4000 characters. */
43
+ readonly details?: string;
44
+ /** Submit button label, default `Send`. */
45
+ readonly submit_label?: string;
46
+ /** One to twelve fields with unique names. */
47
+ readonly fields: F;
48
+ /**
49
+ * Advanced: how long the link stays open, in whole seconds from creation: from 30 up to your
50
+ * plan's link lifetime (Sess checks the ceiling). Absent: the plan's lifetime.
51
+ */
52
+ readonly expires_in?: number;
53
+ }
54
+ type AskValue<T> = T extends {
55
+ type: 'text';
56
+ } ? string : T extends {
57
+ type: 'number' | 'integer';
58
+ } ? number : T extends {
59
+ type: 'boolean';
60
+ } ? boolean : T extends {
61
+ type: 'choice';
62
+ options: readonly (infer O extends string)[];
63
+ } ? O : T extends {
64
+ type: 'multi_choice';
65
+ options: readonly (infer O extends string)[];
66
+ } ? readonly O[] : never;
67
+ /** A checkbox and a multiple choice always have a value; other fields only when required. */
68
+ type AlwaysPresent<T> = T extends {
69
+ type: 'boolean' | 'multi_choice';
70
+ } ? true : T extends {
71
+ required: false;
72
+ } ? false : T extends {
73
+ required: true;
74
+ } ? true : T extends {
75
+ required: boolean;
76
+ } ? false : true;
77
+ type Simplify<T> = {
78
+ [K in keyof T]: T[K];
79
+ } & {};
80
+ /** The verified answer type inferred from the field definitions (and checked at runtime). */
81
+ export type AskAnswer<F extends readonly AskField[]> = Simplify<{
82
+ readonly [P in F[number] as AlwaysPresent<P> extends true ? P['name'] : never]: AskValue<P>;
83
+ } & {
84
+ readonly [P in F[number] as AlwaysPresent<P> extends true ? never : P['name']]?: AskValue<P>;
85
+ }>;
86
+ export interface AskOptions extends RequestOptions {
87
+ /** Trusted expected receipt audience for this question; defaults to the client configuration. */
88
+ expectedWorkspaceId?: string;
89
+ }
90
+ export interface AskAnswerOptions {
91
+ /** Total local wait for the person, default ten minutes. Ending it never closes the Session. */
92
+ timeoutMs?: number;
93
+ /** Polling interval, default 1,500 ms plus jitter, minimum 1,000 ms. */
94
+ intervalMs?: number;
95
+ /** Ends the local wait of this call only. */
96
+ signal?: AbortSignal;
97
+ }
98
+ /** One question: its private link now, its verified answer later. */
99
+ export interface AskHandle<T> {
100
+ /** Private bearer link for the person. Deliver it only to them; keep it out of logs. */
101
+ readonly link: string;
102
+ readonly sessionId: string;
103
+ /** The Surface revision of the question, for recovery through the advanced API. */
104
+ readonly revision: number;
105
+ /**
106
+ * When the link stops taking answers (`action_expires_at`, ISO 8601). Nothing moves it. An
107
+ * answer accepted before it is still returned after it; with none, `answer()` ends with
108
+ * `wait_ended` code `LINK_EXPIRED`. Null only from a runtime that does not report it.
109
+ */
110
+ readonly expiresAt: string | null;
111
+ /**
112
+ * Waits for the answer, verifies its signed receipt and exact bindings, checks that it is still
113
+ * the current step, completes (closes) the Session, then returns the typed answer.
114
+ */
115
+ answer(options?: AskAnswerOptions): Promise<T>;
116
+ }
117
+ declare const TYPES: readonly ["text", "number", "integer", "boolean", "choice", "multi_choice"];
118
+ type AskType = (typeof TYPES)[number];
119
+ /** Internal compiled field: what an accepted answer is checked against. */
120
+ interface CompiledField {
121
+ name: string;
122
+ type: AskType;
123
+ required: boolean;
124
+ options?: readonly string[];
125
+ minimum?: number;
126
+ maximum?: number;
127
+ }
128
+ export interface CompiledAsk {
129
+ interaction: InteractiveInteraction;
130
+ fields: readonly CompiledField[];
131
+ /** The link lifetime in seconds, when the question set one. */
132
+ expiresIn?: number;
133
+ }
134
+ /** The shortest link lifetime Sess accepts, in seconds (the ceiling is the plan's). */
135
+ export declare const LINK_LIFETIME_FLOOR_SECONDS = 30;
136
+ /**
137
+ * The one deterministic simple-field compiler: validates a question locally, without network,
138
+ * credential or clock access, and expands it into the ordinary interactive Surface.
139
+ */
140
+ export declare function compileAsk(input: unknown): CompiledAsk;
141
+ /**
142
+ * Checks verified answer data against the compiled fields and returns a frozen copy in field
143
+ * order. It follows the runtime decoding: a checkbox is always present, a multiple choice is
144
+ * always a list, and an empty optional value is absent.
145
+ */
146
+ export declare function checkAnswer(fields: readonly CompiledField[], data: unknown): Readonly<Record<string, unknown>>;
147
+ /** Validates locally, creates once (the link is available before any wait) and returns the handle. */
148
+ export declare function ask<T>(sessions: Sessions, receipts: ReceiptResource, input: unknown, options?: AskOptions): Promise<AskHandle<T>>;
149
+ export {};
150
+ //# sourceMappingURL=ask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ask.d.ts","sourceRoot":"","sources":["../src/ask.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,KAAK,EAGV,sBAAsB,EAEtB,cAAc,EAGf,MAAM,YAAY,CAAC;AAGpB,UAAU,YAAY;IACpB,iEAAiE;IACjE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4CAA4C;IAC5C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AACD;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAChB,CAAC,YAAY,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GACnG,CAAC,YAAY,GAAG;IACd,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;I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