@elicitkit/core 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 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 2026 the Elicitkit authors
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.
@@ -0,0 +1,22 @@
1
+ import type { Answer, Ask, AskSet } from "@elicitkit/spec";
2
+ /**
3
+ * Per-type `value` shape check (SPEC.md §7). The JSON Schema leaves `value`
4
+ * open by design; enforcing the type contract is the engine's job. Pure —
5
+ * no state, no token. Both the MCP server and the HTTP surface use this so
6
+ * answer validation is identical across surfaces.
7
+ */
8
+ export declare function valueError(ask: Ask, value: unknown): string | null;
9
+ export interface AnswersResult {
10
+ ok: boolean;
11
+ /** Normalised answers, one per validated ask, in ask order. */
12
+ answers: Answer[];
13
+ errors: string[];
14
+ }
15
+ /**
16
+ * Validate a batch of raw answers against an AskSet. Enforces: envelope
17
+ * schema (§5), id/type match the ask, per-type value shape (§7), and
18
+ * `required` honoured — no silent skips, and a required ask may be
19
+ * `declined` (first-class) but not `deferred`. Pure and stateless.
20
+ */
21
+ export declare function validateAnswers(set: AskSet, raw: unknown): AnswersResult;
22
+ //# sourceMappingURL=answers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"answers.d.ts","sourceRoot":"","sources":["../src/answers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,MAAM,EACN,GAAG,EACH,MAAM,EAQP,MAAM,iBAAiB,CAAC;AAKzB;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CA+FlE;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,OAAO,CAAC;IACZ,+DAA+D;IAC/D,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,aAAa,CAmDxE"}
@@ -0,0 +1,159 @@
1
+ import { validateAnswer } from "./validate.js";
2
+ const DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
3
+ const DATETIME_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2})?(\.\d+)?(Z|[+-]\d{2}:\d{2})?$/;
4
+ /**
5
+ * Per-type `value` shape check (SPEC.md §7). The JSON Schema leaves `value`
6
+ * open by design; enforcing the type contract is the engine's job. Pure —
7
+ * no state, no token. Both the MCP server and the HTTP surface use this so
8
+ * answer validation is identical across surfaces.
9
+ */
10
+ export function valueError(ask, value) {
11
+ switch (ask.type) {
12
+ case "ask_text":
13
+ return typeof value === "string" ? null : "value must be a string";
14
+ case "ask_confirm":
15
+ return typeof value === "boolean" ? null : "value must be a boolean";
16
+ case "ask_select": {
17
+ const ids = new Set(ask.spec.options.map((o) => o.id));
18
+ const multiple = ask.spec.multiple === true;
19
+ if (multiple) {
20
+ if (!Array.isArray(value))
21
+ return "value must be an array of option ids";
22
+ for (const v of value) {
23
+ if (typeof v !== "string" || !ids.has(v))
24
+ return `unknown option id: ${String(v)}`;
25
+ }
26
+ return null;
27
+ }
28
+ if (typeof value !== "string" || !ids.has(value)) {
29
+ return `value must be one option id: ${String(value)}`;
30
+ }
31
+ return null;
32
+ }
33
+ case "ask_code_diff": {
34
+ if (typeof value !== "object" || value === null) {
35
+ return "value must be { accepted: string[], rejected: string[] }";
36
+ }
37
+ const v = value;
38
+ const arr = (x) => Array.isArray(x) && x.every((e) => typeof e === "string");
39
+ if (!arr(v.accepted) || !arr(v.rejected)) {
40
+ return "accepted and rejected must each be string[] of hunk ids";
41
+ }
42
+ return null;
43
+ }
44
+ case "ask_number":
45
+ case "ask_slider": {
46
+ if (typeof value !== "number" || !Number.isFinite(value)) {
47
+ return "value must be a finite number";
48
+ }
49
+ const s = ask.spec;
50
+ if (ask.spec && ask.spec.integer && !Number.isInteger(value)) {
51
+ return "value must be an integer";
52
+ }
53
+ if (typeof s.min === "number" && value < s.min)
54
+ return `value must be ≥ ${s.min}`;
55
+ if (typeof s.max === "number" && value > s.max)
56
+ return `value must be ≤ ${s.max}`;
57
+ return null;
58
+ }
59
+ case "ask_rating": {
60
+ const max = ask.spec.max ?? 5;
61
+ if (!Number.isInteger(value) || value < 1 || value > max) {
62
+ return `value must be an integer in [1, ${max}]`;
63
+ }
64
+ return null;
65
+ }
66
+ case "ask_date": {
67
+ if (typeof value !== "string")
68
+ return "value must be a date string";
69
+ const time = ask.spec.time === true;
70
+ if (time ? !DATETIME_RE.test(value) : !DATE_RE.test(value)) {
71
+ return time
72
+ ? "value must be an RFC3339 date-time"
73
+ : 'value must be a "YYYY-MM-DD" date';
74
+ }
75
+ return Number.isNaN(Date.parse(value)) ? "value is not a real date" : null;
76
+ }
77
+ case "ask_rank": {
78
+ const ids = ask.spec.items.map((i) => i.id);
79
+ if (!Array.isArray(value) || value.length !== ids.length) {
80
+ return `value must be all ${ids.length} item ids in ranked order`;
81
+ }
82
+ const seen = new Set();
83
+ for (const v of value) {
84
+ if (typeof v !== "string" || !ids.includes(v) || seen.has(v)) {
85
+ return "value must be a permutation of the item ids (no dupes)";
86
+ }
87
+ seen.add(v);
88
+ }
89
+ return null;
90
+ }
91
+ case "ask_color": {
92
+ if (typeof value !== "string" || value.trim() === "") {
93
+ return "value must be a CSS color string";
94
+ }
95
+ const s = ask.spec ?? {};
96
+ if (s.palette && s.palette.length > 0 && s.allowCustom !== true) {
97
+ return s.palette.includes(value)
98
+ ? null
99
+ : `value must be one of the palette colors`;
100
+ }
101
+ return null;
102
+ }
103
+ default:
104
+ // Unknown (future minor) type: trust the envelope, don't hard-fail.
105
+ return null;
106
+ }
107
+ }
108
+ /**
109
+ * Validate a batch of raw answers against an AskSet. Enforces: envelope
110
+ * schema (§5), id/type match the ask, per-type value shape (§7), and
111
+ * `required` honoured — no silent skips, and a required ask may be
112
+ * `declined` (first-class) but not `deferred`. Pure and stateless.
113
+ */
114
+ export function validateAnswers(set, raw) {
115
+ if (!Array.isArray(raw)) {
116
+ return { ok: false, answers: [], errors: ["answers must be an array"] };
117
+ }
118
+ const byId = new Map();
119
+ for (const a of raw) {
120
+ if (a && typeof a === "object" && typeof a.id === "string") {
121
+ byId.set(a.id, a);
122
+ }
123
+ }
124
+ const errors = [];
125
+ const answers = [];
126
+ for (const ask of set.asks) {
127
+ const candidate = byId.get(ask.id);
128
+ const required = ask.required !== false;
129
+ if (candidate === undefined) {
130
+ if (required)
131
+ errors.push(`${ask.id}: missing answer for required ask`);
132
+ continue;
133
+ }
134
+ const env = validateAnswer(candidate);
135
+ if (!env.ok) {
136
+ errors.push(`${ask.id}: ${env.errors.join("; ")}`);
137
+ continue;
138
+ }
139
+ const ans = candidate;
140
+ if (ans.type !== ask.type) {
141
+ errors.push(`${ask.id}: answer type "${ans.type}" != ask type "${ask.type}"`);
142
+ continue;
143
+ }
144
+ if (ans.status === "answered") {
145
+ const ve = valueError(ask, ans.value);
146
+ if (ve) {
147
+ errors.push(`${ask.id}: ${ve}`);
148
+ continue;
149
+ }
150
+ }
151
+ else if (required && ans.status === "deferred") {
152
+ errors.push(`${ask.id}: required ask cannot be deferred`);
153
+ continue;
154
+ }
155
+ answers.push(ans);
156
+ }
157
+ return { ok: errors.length === 0, answers, errors };
158
+ }
159
+ //# sourceMappingURL=answers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"answers.js","sourceRoot":"","sources":["../src/answers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAc/C,MAAM,OAAO,GAAG,qBAAqB,CAAC;AACtC,MAAM,WAAW,GAAG,sEAAsE,CAAC;AAE3F;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,GAAQ,EAAE,KAAc;IACjD,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;QACjB,KAAK,UAAU;YACb,OA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AAI,CAAC,GAAG,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;gBAChC,SAAS;YACX,CAAC;QACH,CAAC;aAAM,IAAI,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;YACjD,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,EAAE,mCAAmC,CAAC,CAAC;YAC1D,SAAS;QACX,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AACtD,CAAC"}
@@ -0,0 +1,9 @@
1
+ export { validateAskSet, validateAnswer } from "./validate.js";
2
+ export type { ValidationResult } from "./validate.js";
3
+ export { validateAnswers, valueError } from "./answers.js";
4
+ export type { AnswersResult } from "./answers.js";
5
+ export { signToken, verifyToken, newSecret, newRoundId } from "./sign.js";
6
+ export type { VerifyResult } from "./sign.js";
7
+ export type { Ask, AskSet, Answer, AnswerStatus, Tier, AskText, AskSelect, AskConfirm, AskCodeDiff, AskNumber, AskRating, AskSlider, AskDate, AskRank, AskColor, SelectOption, SelectDisplay, RankItem, DiffFile, DiffHunk, } from "@elicitkit/spec";
8
+ export { SPEC_VERSION, SCHEMA_ID } from "@elicitkit/spec";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/D,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3D,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC1E,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAG9C,YAAY,EACV,GAAG,EACH,MAAM,EACN,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,SAAS,EACT,UAAU,EACV,WAAW,EACX,SAAS,EACT,SAAS,EACT,SAAS,EACT,OAAO,EACP,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,QAAQ,GACT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export { validateAskSet, validateAnswer } from "./validate.js";
2
+ export { validateAnswers, valueError } from "./answers.js";
3
+ export { signToken, verifyToken, newSecret, newRoundId } from "./sign.js";
4
+ export { SPEC_VERSION, SCHEMA_ID } from "@elicitkit/spec";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AA0B1E,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/sign.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ /** A fresh random secret, for servers that don't pin ELICITKIT_SECRET. */
2
+ export declare function newSecret(): string;
3
+ /** A fresh unguessable round id (128-bit). */
4
+ export declare function newRoundId(): string;
5
+ /** Sign `id` with an absolute expiry `ttlMs` from now. */
6
+ export declare function signToken(secret: string, id: string, ttlMs: number): string;
7
+ export type VerifyResult = {
8
+ ok: true;
9
+ id: string;
10
+ } | {
11
+ ok: false;
12
+ reason: "malformed" | "bad-signature" | "expired";
13
+ };
14
+ /** Verify signature (constant-time) then expiry. Never throws. */
15
+ export declare function verifyToken(secret: string, token: string): VerifyResult;
16
+ //# sourceMappingURL=sign.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../src/sign.ts"],"names":[],"mappings":"AAcA,0EAA0E;AAC1E,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED,8CAA8C;AAC9C,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAMD,0DAA0D;AAC1D,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAI3E;AAED,MAAM,MAAM,YAAY,GACpB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACxB;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,WAAW,GAAG,eAAe,GAAG,SAAS,CAAA;CAAE,CAAC;AAErE,kEAAkE;AAClE,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,CAuBvE"}
package/dist/sign.js ADDED
@@ -0,0 +1,54 @@
1
+ import { createHmac, randomBytes, timingSafeEqual } from "node:crypto";
2
+ /**
3
+ * Signed one-time-link tokens (security watchpoint #5). A token is
4
+ * `b64url(id).b64url(expiryMs).b64url(HMAC-SHA256)` — unguessable *and*
5
+ * tamper-evident: a surface can reject a forged or expired token before any
6
+ * round lookup, so an attacker cannot probe round state. Pure node:crypto,
7
+ * zero deps; shared by every surface that exposes links.
8
+ */
9
+ function b64url(buf) {
10
+ return Buffer.from(buf).toString("base64url");
11
+ }
12
+ /** A fresh random secret, for servers that don't pin ELICITKIT_SECRET. */
13
+ export function newSecret() {
14
+ return randomBytes(32).toString("base64url");
15
+ }
16
+ /** A fresh unguessable round id (128-bit). */
17
+ export function newRoundId() {
18
+ return randomBytes(16).toString("base64url");
19
+ }
20
+ function mac(secret, body) {
21
+ return createHmac("sha256", secret).update(body).digest();
22
+ }
23
+ /** Sign `id` with an absolute expiry `ttlMs` from now. */
24
+ export function signToken(secret, id, ttlMs) {
25
+ const exp = String(Date.now() + ttlMs);
26
+ const body = `${b64url(id)}.${b64url(exp)}`;
27
+ return `${body}.${b64url(mac(secret, body))}`;
28
+ }
29
+ /** Verify signature (constant-time) then expiry. Never throws. */
30
+ export function verifyToken(secret, token) {
31
+ const parts = token.split(".");
32
+ if (parts.length !== 3)
33
+ return { ok: false, reason: "malformed" };
34
+ const [idB64, expB64, sigB64] = parts;
35
+ const body = `${idB64}.${expB64}`;
36
+ let sig;
37
+ let expected;
38
+ try {
39
+ sig = Buffer.from(sigB64, "base64url");
40
+ expected = mac(secret, body);
41
+ }
42
+ catch {
43
+ return { ok: false, reason: "malformed" };
44
+ }
45
+ if (sig.length !== expected.length || !timingSafeEqual(sig, expected)) {
46
+ return { ok: false, reason: "bad-signature" };
47
+ }
48
+ const exp = Number(Buffer.from(expB64, "base64url").toString("utf8"));
49
+ if (!Number.isFinite(exp) || Date.now() > exp) {
50
+ return { ok: false, reason: "expired" };
51
+ }
52
+ return { ok: true, id: Buffer.from(idB64, "base64url").toString("utf8") };
53
+ }
54
+ //# sourceMappingURL=sign.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign.js","sourceRoot":"","sources":["../src/sign.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEvE;;;;;;GAMG;AAEH,SAAS,MAAM,CAAC,GAAoB;IAClC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAChD,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,SAAS;IACvB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,CAAC,CAAC;QACvC,QAAQ,GAAG,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IAC5C,CAAC;IACD,IAAI,GAAG,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC;QACtE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;IAChD,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IACtE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC;QAC9C,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IAC1C,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;AAC5E,CAAC"}
@@ -0,0 +1,9 @@
1
+ export interface ValidationResult {
2
+ ok: boolean;
3
+ errors: string[];
4
+ }
5
+ /** Validate a full AskSet payload against the v0.1 spec schema. */
6
+ export declare function validateAskSet(input: unknown): ValidationResult;
7
+ /** Validate a single Answer payload against the v0.1 spec schema. */
8
+ export declare function validateAnswer(input: unknown): ValidationResult;
9
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AA4BA,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAcD,mEAAmE;AACnE,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAE/D;AAED,qEAAqE;AACrE,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAE/D"}
@@ -0,0 +1,28 @@
1
+ import * as ajvMod from "ajv/dist/2020.js";
2
+ import { schema, SCHEMA_ID } from "@elicitkit/spec";
3
+ const Ajv2020 = (ajvMod.default ??
4
+ ajvMod);
5
+ const ajv = new Ajv2020({ allErrors: true, strict: false });
6
+ // Compiling the root schema registers its $id and all $defs with ajv.
7
+ ajv.compile(schema);
8
+ const askSetValidator = ajv.getSchema(SCHEMA_ID);
9
+ const answerValidator = ajv.getSchema(`${SCHEMA_ID}#/$defs/answer`);
10
+ function run(validator, input) {
11
+ if (!validator) {
12
+ return { ok: false, errors: ["internal: schema validator not registered"] };
13
+ }
14
+ const ok = validator(input);
15
+ if (ok)
16
+ return { ok: true, errors: [] };
17
+ const errors = (validator.errors ?? []).map((e) => `${e.instancePath || "(root)"} ${e.message ?? ""}`.trim());
18
+ return { ok: false, errors };
19
+ }
20
+ /** Validate a full AskSet payload against the v0.1 spec schema. */
21
+ export function validateAskSet(input) {
22
+ return run(askSetValidator, input);
23
+ }
24
+ /** Validate a single Answer payload against the v0.1 spec schema. */
25
+ export function validateAnswer(input) {
26
+ return run(answerValidator, input);
27
+ }
28
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAgBpD,MAAM,OAAO,GAAG,CAAE,MAAgC,CAAC,OAAO;IACxD,MAAM,CAA2B,CAAC;AAEpC,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",
3
+ "version": "0.1.0",
4
+ "description": "Elicitkit core — schema validation + the portable question model. Renderer-agnostic.",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": { ".": { "types": "./dist/index.d.ts", "default": "./dist/index.js" } },
10
+ "files": ["dist"],
11
+ "scripts": {
12
+ "build": "tsc -p tsconfig.json",
13
+ "test": "tsc -p tsconfig.json && node test/smoke.mjs"
14
+ },
15
+ "dependencies": {
16
+ "@elicitkit/spec": "workspace:*",
17
+ "ajv": "^8.17.1"
18
+ },
19
+ "publishConfig": { "access": "public" }
20
+ }