@elicitkit/spec 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.
package/SPEC.md ADDED
@@ -0,0 +1,215 @@
1
+ # Elicitkit Question Spec — v0.1 (Draft)
2
+
3
+ _Private working draft. Gitignored. Status: **Draft**, 2026-05-16. The spec is the product; the MCP server is its reference implementation._
4
+
5
+ Key words **MUST**, **SHOULD**, **MAY** per RFC 2119.
6
+
7
+ ---
8
+
9
+ ## 1. Versioning
10
+
11
+ - The spec is **SemVer**'d. Every payload carries `specVersion` (e.g. `"0.1.0"`).
12
+ - Unknown **minor** additions MUST be ignored by older clients, not rejected (forward-compatible).
13
+ - A breaking change is a **major** bump. The v0.1 envelope reserves fields (§4) precisely so the asking-intelligence layer ships later as a **minor**, never a major.
14
+
15
+ ## 2. Core model
16
+
17
+ Three objects only:
18
+
19
+ - **Ask** — one question (§3).
20
+ - **AskSet** — an ordered batch of Asks with optional branching (§6).
21
+ - **Answer** — the typed response contract (§5).
22
+
23
+ ## 3. The Ask envelope
24
+
25
+ Every Ask, regardless of type, is:
26
+
27
+ ```jsonc
28
+ {
29
+ "id": "string", // unique within the AskSet
30
+ "type": "ask_text | ask_select | ask_confirm | ask_code_diff | ...",
31
+ "prompt": "string", // the question, plain text
32
+ "help": "string?", // optional clarifying detail
33
+ "required": true, // default true
34
+ "spec": { "...type-specific..." },
35
+
36
+ // ── Reserved hooks (v0.1 inert; populated in a later MINOR) ──
37
+ "agentGuess": "any?", // the agent's proposed answer
38
+ "confidence": 0.0, // 0–1; enables confidence-gated auto-accept
39
+ "memoryKey": "string?", // stable key for answer-memory / auto-skip
40
+ "meta": {
41
+ "specVersion": "0.1.0",
42
+ "minTier": "tui" // lowest render tier that is still faithful
43
+ }
44
+ }
45
+ ```
46
+
47
+ A type-aware renderer reads `type` + `spec`; a dumb renderer can always fall back to `prompt` + free text.
48
+
49
+ ## 4. Render tiers (progressive fallback)
50
+
51
+ `tier ∈ { "apps", "url", "elicitation", "tui" }`, richest → poorest.
52
+
53
+ - The host advertises `supportedTiers`. The server picks the **richest tier ≥ the Ask's `meta.minTier`** that the host supports.
54
+ - Every type MUST define behaviour for **all four** tiers (degradation is part of the type definition, not an afterthought). A type that cannot degrade below `url` MUST set `minTier: "url"` and provide a text-summary fallback so it never hard-fails.
55
+
56
+ ### 4.1 Non-blocking contract (uniform across tiers)
57
+
58
+ Every elicit tool call MUST return in less than the host's per-call MCP timeout (≪ 1 s server-side, bounded by **one** user answer at most on the elicitation tier). This is achieved by surfacing a **pending envelope** the agent drives forward across multiple tool calls:
59
+
60
+ | Tool | Behaviour |
61
+ |---|---|
62
+ | `elicit(askSet, supportedTiers?)` | Returns fast. Shape: `{ pending: true, token, tier, ...tierContext }` with `_meta.elicitkit` carrying `renderedTier`, `hostTiers`, and (when the slow-ask auto-router fires) `routedAwayFromElicitation: true` plus a `routeReason`. The elicitation tier issues the FIRST native `elicitInput` inline and awaits ONE answer before returning. |
63
+ | `elicit_next(token)` | **Elicitation tier only.** Issues the next `elicitInput`, awaits one user answer, returns `{ pending: true, token, completed, total }` or final `{ pending: false, answers }`. Other tiers complete via `elicit_submit` instead. |
64
+ | `elicit_submit(token, answers)` | Panel tiers (`tui` / `url` / `apps`). Validates and completes the round. |
65
+
66
+ Per-tier flow:
67
+
68
+ - **tui** — `elicit` returns AskSet + token; agent presents in chat; agent calls `elicit_submit`.
69
+ - **elicitation** — `elicit` opens the round, fires `elicitInput` for ask 1, awaits ONE answer, returns `{ pending, token, completed: 1, total: N }`. Agent calls `elicit_next(token)` per remaining ask. The final call returns `{ pending: false, answers }`.
70
+ - **url** — `elicit` returns `{ pending, token, panelUrl }` IMMEDIATELY. Panel POSTs to `/elicit/submit` OR the user copy-pastes JSON back → agent forwards verbatim to `elicit_submit`.
71
+ - **apps** — `elicit` returns `{ pending, token, panelUri }` IMMEDIATELY. mcp-ui widget posts back → agent forwards to `elicit_submit`.
72
+
73
+ ### 4.2 Slow-ask auto-router (normative)
74
+
75
+ Before negotiating tiers, the server inspects the AskSet for asks that are likely to exceed the per-call MCP timeout when issued one-question-at-a-time through the native elicitation primitive. If any such ask is present the server MUST drop `elicitation` from the candidate tier list and surface `_meta.elicitkit.routedAwayFromElicitation: true` with a `routeReason` naming the rule that fired. The agent does not choose tiers manually.
76
+
77
+ | Trigger | Reason |
78
+ |---|---|
79
+ | `ask_text` with `multiline: true` OR `maxLen >= 200` (or `maxLen` unset) | Long typing time |
80
+ | `ask_code_diff` with > 2 hunks total across all files | Hunk-by-hunk review needs thought |
81
+ | `ask_rank` with > 4 items | Ordering > 4 takes thought |
82
+
83
+ Quick asks pass through to elicitation: `ask_select` (≤ 8 options), `ask_confirm`, `ask_number`, `ask_rating`, `ask_slider`, `ask_date`, `ask_color`, short `ask_text`. Future composite types (`ask_form`, `ask_table`) reserve the rule slot.
84
+
85
+ ## 5. Answer contract
86
+
87
+ ```jsonc
88
+ {
89
+ "id": "string", // echoes the Ask id
90
+ "type": "string",
91
+ "status": "answered | declined | deferred",
92
+ "value": "any", // shape defined per type (§7); null unless answered
93
+ "meta": { "tier": "apps", "specVersion": "0.1.0" }
94
+ }
95
+ ```
96
+
97
+ - Servers MUST validate `value` against the type's schema and **re-ask** on invalid (max retries configurable).
98
+ - `declined` and `deferred` are first-class — agents MUST handle "the human chose not to answer."
99
+
100
+ ## 6. AskSet (batch + branching)
101
+
102
+ ```jsonc
103
+ {
104
+ "specVersion": "0.1.0",
105
+ "asks": [ Ask, ... ],
106
+ "edges": [] // RESERVED v0.1: conditional branching (minor add)
107
+ }
108
+ ```
109
+
110
+ v0.1 renders `asks` in order in one panel where the tier allows (one round-trip). `edges` is reserved so question-graphs are a later minor.
111
+
112
+ ## 7. v0.1 type catalog
113
+
114
+ Ten types are normative — the four-type wedge (§7.1–7.4) plus numeric / temporal / ordinal / color breadth (§7.5–7.10). Each defines behaviour for all four tiers; an unlisted `type` is a forward-compatible MINOR addition older clients ignore.
115
+
116
+ ### 7.1 `ask_text`
117
+ `spec`: `{ multiline?: bool, placeholder?: str, pattern?: regex, maxLen?: int }` · `value`: `string`
118
+ Tiers: apps/url = input; elicitation = string primitive; tui = prompt.
119
+
120
+ ### 7.2 `ask_select`
121
+ `spec`: `{ options: [{id, label, description?}], multiple?: bool, min?, max? }` · `value`: `id | id[]`
122
+ Tiers: apps/url = styled list; elicitation = enum; tui = arrow-select.
123
+
124
+ ### 7.3 `ask_confirm`
125
+ `spec`: `{ affirm?: str="Yes", deny?: str="No", consequence?: str }` · `value`: `boolean`
126
+ `consequence` renders as a "what will happen" preview where the tier allows.
127
+
128
+ ### 7.4 `ask_code_diff` — **the v0.1 wedge**
129
+ ```jsonc
130
+ "spec": {
131
+ "files": [{
132
+ "path": "string",
133
+ "hunks": [{ "id": "string", "header": "string",
134
+ "before": "string", "after": "string" }]
135
+ }],
136
+ "granularity": "hunk" // v0.1: per-hunk only
137
+ }
138
+ ```
139
+ `value`: `{ accepted: hunkId[], rejected: hunkId[] }`
140
+ Tiers: apps/url = interactive diff with per-hunk ✓/✗; elicitation = one `ask_confirm` per hunk; tui = same, sequential. `minTier: "tui"` (never hard-fails).
141
+
142
+ ### 7.5 `ask_number`
143
+ `spec`: `{ min?, max?, step?, unit?: str, integer?: bool }` · `value`: `number`
144
+ Tiers: apps/url = number input; elicitation = number/integer primitive; tui = prompt (validated).
145
+
146
+ ### 7.6 `ask_rating`
147
+ `spec`: `{ max?: int=5, icon?: "star"|"number", labels?: {min?,max?} }` · `value`: `integer` in `[1, max]`
148
+ Tiers: apps/url = star/number row; elicitation = integer (min 1, max); tui = `1..max` prompt.
149
+
150
+ ### 7.7 `ask_slider`
151
+ `spec`: `{ min, max, step?, unit?: str }` · `value`: `number` in `[min, max]`
152
+ Tiers: apps/url = range slider w/ live value; elicitation/tui = number in range (slider is a presentation, never a fidelity floor).
153
+
154
+ ### 7.8 `ask_date`
155
+ `spec`: `{ min?, max?, time?: bool }` · `value`: `"YYYY-MM-DD"` (RFC3339 date-time if `time`)
156
+ Tiers: apps/url = native date(-time) input; elicitation = string `format: date|date-time`; tui = prompt (validated).
157
+
158
+ ### 7.9 `ask_rank`
159
+ `spec`: `{ items: [{id, label, description?}] }` · `value`: `string[]` — a **permutation of all item ids**
160
+ Tiers: apps/url = reorderable list (move up/down); elicitation/tui = enter the ids in order (degradation defined: ordering UI is not a fidelity floor — ranking still completes as an ordered id list).
161
+
162
+ ### 7.10 `ask_color`
163
+ `spec`: `{ palette?: string[], allowCustom?: bool }` · `value`: a CSS color string
164
+ With a `palette` and `allowCustom` not true, the value MUST be a palette entry.
165
+ Each `palette[]` entry MUST match the **safe color grammar** (§7.y).
166
+ Tiers: apps/url = swatches (+ native picker when custom allowed); elicitation =
167
+ string `enum` of the palette when fixed, else free string; tui = prompt (validated).
168
+
169
+ ## 7.x Presentation hints (advisory, non-normative)
170
+
171
+ Optional fields that richer renderers MAY honour. They never change the
172
+ `value` contract and MUST be safely ignorable — a renderer that drops them
173
+ is still conformant (forward-compatible).
174
+
175
+ - `AskSet.meta.layout`: `"auto"` (default) · `"single"` · `"grid"` — column
176
+ strategy across asks.
177
+ - `AskSet.meta.theme`: `"system"` (default) · `"midnight"` · `"paper"` ·
178
+ `"high-contrast"`; `AskSet.meta.accent`: a CSS color (overrides accent) —
179
+ MUST match the safe color grammar (§7.y).
180
+ - `Ask.meta.span`: `"half"` | `"full"` — overrides the per-ask auto layout.
181
+ - `ask_select.spec.display`: `"list"` (default) · `"cards"` · `"segmented"`
182
+ · `"grid"`.
183
+ - `SelectOption.icon` (curated icon name or raw character/emoji — unknown
184
+ names degrade to text) and `SelectOption.color` (a swatch) — `color` MUST
185
+ match the safe color grammar (§7.y).
186
+
187
+ ### 7.y Safe color grammar (normative)
188
+
189
+ `SelectOption.color`, every `ask_color.spec.palette[]` entry, and
190
+ `AskSet.meta.accent` are CSS color strings rendered into a **CSS value
191
+ sink**. To prevent value-injection (`url()` exfiltration, `var()` /
192
+ `image-set()` / `element()` / gradient breakout) on channels with no
193
+ Content-Security-Policy (e.g. an mcp-ui `rawHtml` embed, a `data:` URL, or
194
+ a copy-pasted panel), these fields MUST match (after trimming):
195
+
196
+ ```
197
+ ^(?:#[0-9a-fA-F]{3,8}|[a-zA-Z]+|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)\([0-9a-zA-Z.,%/ +\-]*\))$
198
+ ```
199
+
200
+ It accepts `#hex` (3/4/6/8), a CSS named/keyword color, and the common
201
+ functional notations with a safe inner charset; it structurally cannot
202
+ express `url(`, `var(`, `image-set(`, `element(`, gradients, quotes, `;`,
203
+ or a nested `(`. A producer MUST NOT emit a non-conforming value; a
204
+ **validator MUST reject** an AskSet that contains one. Because these are
205
+ optional presentation fields, a renderer MUST treat an empty or
206
+ non-conforming value as "no color" (omit the swatch/chip/accent) and MUST
207
+ NOT pass it to a CSS sink — never hard-fail rendering over it.
208
+
209
+ ## 8. Conformance (normative intent)
210
+
211
+ A "Elicitkit-compliant" implementation MUST: round-trip the envelope (§3) and Answer (§5) losslessly; honour `required`/`declined`/`deferred`; implement all four tiers for every type it claims; preserve unknown reserved fields untouched. The conformance suite (separate package) is the source of truth.
212
+
213
+ ---
214
+
215
+ _Next: encode this as JSON Schema (`schema/elicitkit-v0.1.schema.json`), then `packages/core` validates against it._
@@ -0,0 +1,5 @@
1
+ export * from "./types.js";
2
+ export declare const SPEC_VERSION = "0.1.0";
3
+ export declare const SCHEMA_ID = "https://elicitkit.com/schema/v0.1";
4
+ export declare const schema: Record<string, unknown>;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,YAAY,CAAC;AAE3B,eAAO,MAAM,YAAY,UAAU,CAAC;AACpC,eAAO,MAAM,SAAS,sCAAsC,CAAC;AAQ7D,eAAO,MAAM,MAAM,EAAsD,MAAM,CAC7E,MAAM,EACN,OAAO,CACR,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ import { createRequire } from "node:module";
2
+ export * from "./types.js";
3
+ export const SPEC_VERSION = "0.1.0";
4
+ export const SCHEMA_ID = "https://elicitkit.com/schema/v0.1";
5
+ /**
6
+ * The canonical JSON Schema, loaded at runtime via createRequire.
7
+ * Resolved relative to dist/index.js → ../schema (shipped via package "files"),
8
+ * which avoids ESM JSON import-attribute pitfalls on Node 20.
9
+ */
10
+ const require = createRequire(import.meta.url);
11
+ export const schema = require("../schema/elicitkit-v0.1.schema.json");
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,cAAc,YAAY,CAAC;AAE3B,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC;AACpC,MAAM,CAAC,MAAM,SAAS,GAAG,mCAAmC,CAAC;AAE7D;;;;GAIG;AACH,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,sCAAsC,CAGnE,CAAC"}
@@ -0,0 +1,179 @@
1
+ /**
2
+ * Elicitkit canonical TypeScript types — v0.1.
3
+ * Mirrors SPEC.md and schema/elicitkit-v0.1.schema.json. The spec is the product.
4
+ */
5
+ export type Tier = "apps" | "url" | "elicitation" | "tui";
6
+ export interface AskMeta {
7
+ specVersion: string;
8
+ /** lowest render tier that is still faithful */
9
+ minTier?: Tier;
10
+ /** layout override for this ask; otherwise an auto heuristic decides */
11
+ span?: "half" | "full";
12
+ [k: string]: unknown;
13
+ }
14
+ export interface AskBase {
15
+ id: string;
16
+ prompt: string;
17
+ help?: string;
18
+ /** default true */
19
+ required?: boolean;
20
+ /** the agent's proposed answer */
21
+ agentGuess?: unknown;
22
+ /** 0–1; enables confidence-gated auto-accept */
23
+ confidence?: number;
24
+ /** stable key for answer-memory / auto-skip */
25
+ memoryKey?: string;
26
+ meta?: AskMeta;
27
+ }
28
+ export interface AskText extends AskBase {
29
+ type: "ask_text";
30
+ spec: {
31
+ multiline?: boolean;
32
+ placeholder?: string;
33
+ pattern?: string;
34
+ maxLen?: number;
35
+ };
36
+ }
37
+ export interface SelectOption {
38
+ id: string;
39
+ label: string;
40
+ description?: string;
41
+ /** Optional adornment — a curated icon name (renderer-defined set) or a
42
+ * raw character/emoji. Unknown names degrade to text. */
43
+ icon?: string;
44
+ /** Optional swatch color (any CSS color) shown beside the option. */
45
+ color?: string;
46
+ }
47
+ /** Presentation hint for `ask_select`. Renderers MAY honour it; all MUST
48
+ * remain correct if they ignore it (forward-compatible). */
49
+ export type SelectDisplay = "list" | "cards" | "segmented" | "grid";
50
+ export interface AskSelect extends AskBase {
51
+ type: "ask_select";
52
+ spec: {
53
+ options: SelectOption[];
54
+ multiple?: boolean;
55
+ min?: number;
56
+ max?: number;
57
+ display?: SelectDisplay;
58
+ };
59
+ }
60
+ export interface AskConfirm extends AskBase {
61
+ type: "ask_confirm";
62
+ spec: {
63
+ affirm?: string;
64
+ deny?: string;
65
+ consequence?: string;
66
+ };
67
+ }
68
+ export interface DiffHunk {
69
+ id: string;
70
+ header?: string;
71
+ before?: string;
72
+ after: string;
73
+ }
74
+ export interface DiffFile {
75
+ path: string;
76
+ hunks: DiffHunk[];
77
+ }
78
+ /** The v0.1 wedge. */
79
+ export interface AskCodeDiff extends AskBase {
80
+ type: "ask_code_diff";
81
+ spec: {
82
+ files: DiffFile[];
83
+ granularity?: "hunk";
84
+ };
85
+ }
86
+ /** Numeric input. value: number. */
87
+ export interface AskNumber extends AskBase {
88
+ type: "ask_number";
89
+ spec: {
90
+ min?: number;
91
+ max?: number;
92
+ step?: number;
93
+ unit?: string;
94
+ integer?: boolean;
95
+ };
96
+ }
97
+ /** 1..max rating. value: integer in [1, max]. */
98
+ export interface AskRating extends AskBase {
99
+ type: "ask_rating";
100
+ spec: {
101
+ max?: number;
102
+ icon?: "star" | "number";
103
+ labels?: {
104
+ min?: string;
105
+ max?: string;
106
+ };
107
+ };
108
+ }
109
+ /** Bounded range. value: number in [min, max]. */
110
+ export interface AskSlider extends AskBase {
111
+ type: "ask_slider";
112
+ spec: {
113
+ min: number;
114
+ max: number;
115
+ step?: number;
116
+ unit?: string;
117
+ };
118
+ }
119
+ /** Date, optionally with time. value: "YYYY-MM-DD" (or RFC3339 if time). */
120
+ export interface AskDate extends AskBase {
121
+ type: "ask_date";
122
+ spec: {
123
+ min?: string;
124
+ max?: string;
125
+ time?: boolean;
126
+ };
127
+ }
128
+ export interface RankItem {
129
+ id: string;
130
+ label: string;
131
+ description?: string;
132
+ }
133
+ /** Order a fixed set. value: string[] — a permutation of the item ids. */
134
+ export interface AskRank extends AskBase {
135
+ type: "ask_rank";
136
+ spec: {
137
+ items: RankItem[];
138
+ };
139
+ }
140
+ /** Pick a color. value: a CSS color string (e.g. "#1d4ed8"). When a
141
+ * `palette` is given and `allowCustom` is not true, the value MUST be one
142
+ * of the palette entries. */
143
+ export interface AskColor extends AskBase {
144
+ type: "ask_color";
145
+ spec: {
146
+ palette?: string[];
147
+ allowCustom?: boolean;
148
+ };
149
+ }
150
+ export type Ask = AskText | AskSelect | AskConfirm | AskCodeDiff | AskNumber | AskRating | AskSlider | AskDate | AskRank | AskColor;
151
+ export interface AskSet {
152
+ specVersion: string;
153
+ asks: Ask[];
154
+ /** RESERVED v0.1: conditional branching */
155
+ edges?: unknown[];
156
+ /** Optional, renderer-advisory. `layout`: "auto" (default) lets the
157
+ * renderer decide single/multi-column per ask; "single" forces one
158
+ * column; "grid" prefers pairing. Ignorable by any renderer. */
159
+ meta?: {
160
+ layout?: "auto" | "single" | "grid";
161
+ /** skin: "system" (default) | "midnight" | "paper" | "high-contrast" */
162
+ theme?: "system" | "midnight" | "paper" | "high-contrast";
163
+ /** any CSS color — overrides the accent in any theme */
164
+ accent?: string;
165
+ [k: string]: unknown;
166
+ };
167
+ }
168
+ export type AnswerStatus = "answered" | "declined" | "deferred";
169
+ export interface Answer {
170
+ id: string;
171
+ type: string;
172
+ status: AnswerStatus;
173
+ value?: unknown;
174
+ meta?: {
175
+ tier?: Tier;
176
+ specVersion?: string;
177
+ };
178
+ }
179
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,KAAK,GAAG,aAAa,GAAG,KAAK,CAAC;AAE1D,MAAM,WAAW,OAAO;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mBAAmB;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAGnB,kCAAkC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,OAAQ,SAAQ,OAAO;IACtC,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,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AO,CAAC;IAChB,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,IAAI,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9C"}
package/dist/types.js ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Elicitkit canonical TypeScript types — v0.1.
3
+ * Mirrors SPEC.md and schema/elicitkit-v0.1.schema.json. The spec is the product.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@elicitkit/spec",
3
+ "version": "0.1.0",
4
+ "description": "The Elicitkit question spec — JSON Schema + canonical TypeScript types. This package is the product.",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
11
+ "./schema": "./schema/elicitkit-v0.1.schema.json"
12
+ },
13
+ "files": ["dist", "schema", "SPEC.md"],
14
+ "scripts": { "build": "tsc -p tsconfig.json" },
15
+ "publishConfig": { "access": "public" }
16
+ }
@@ -0,0 +1,208 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://elicitkit.com/schema/v0.1",
4
+ "title": "Elicitkit Question Spec v0.1",
5
+ "description": "Draft. The reserved hooks (agentGuess/confidence/memoryKey) are inert in v0.1 and populated in a later MINOR.",
6
+ "$defs": {
7
+ "tier": { "enum": ["apps", "url", "elicitation", "tui"] },
8
+ "safeColor": {
9
+ "type": "string",
10
+ "description": "A CSS color constrained to a structurally safe grammar: #hex(3/4/6/8), a CSS named/keyword color, or a common functional notation with a safe inner charset. Structurally cannot express url(/var(/image-set(/element(/gradients/quotes/;/nested ( — no exfiltration or CSS breakout. Renderers MUST ignore (omit) any non-conforming value for these optional presentation fields.",
11
+ "pattern": "^(?:#[0-9a-fA-F]{3,8}|[a-zA-Z]+|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)\\([0-9a-zA-Z.,%/ +\\-]*\\))$"
12
+ },
13
+ "meta": {
14
+ "type": "object",
15
+ "properties": {
16
+ "specVersion": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$" },
17
+ "minTier": { "$ref": "#/$defs/tier" },
18
+ "accent": { "$ref": "#/$defs/safeColor" }
19
+ },
20
+ "required": ["specVersion"],
21
+ "additionalProperties": true
22
+ },
23
+ "ask": {
24
+ "type": "object",
25
+ "properties": {
26
+ "id": { "type": "string", "minLength": 1 },
27
+ "type": { "enum": ["ask_text", "ask_select", "ask_confirm", "ask_code_diff", "ask_number", "ask_rating", "ask_slider", "ask_date", "ask_rank", "ask_color"] },
28
+ "prompt": { "type": "string", "minLength": 1 },
29
+ "help": { "type": "string" },
30
+ "required": { "type": "boolean", "default": true },
31
+ "spec": { "type": "object" },
32
+ "agentGuess": {},
33
+ "confidence": { "type": "number", "minimum": 0, "maximum": 1 },
34
+ "memoryKey": { "type": "string" },
35
+ "meta": { "$ref": "#/$defs/meta" }
36
+ },
37
+ "required": ["id", "type", "prompt", "spec"],
38
+ "allOf": [
39
+ {
40
+ "if": { "properties": { "type": { "const": "ask_select" } } },
41
+ "then": { "properties": { "spec": {
42
+ "type": "object",
43
+ "properties": {
44
+ "options": { "type": "array", "minItems": 1, "items": {
45
+ "type": "object",
46
+ "properties": {
47
+ "id": { "type": "string" },
48
+ "label": { "type": "string" },
49
+ "description": { "type": "string" },
50
+ "icon": { "type": "string" },
51
+ "color": { "$ref": "#/$defs/safeColor" }
52
+ },
53
+ "required": ["id", "label"]
54
+ } },
55
+ "multiple": { "type": "boolean" },
56
+ "min": { "type": "integer" },
57
+ "max": { "type": "integer" },
58
+ "display": { "enum": ["list", "cards", "segmented", "grid"] }
59
+ },
60
+ "required": ["options"]
61
+ } } }
62
+ },
63
+ {
64
+ "if": { "properties": { "type": { "const": "ask_code_diff" } } },
65
+ "then": { "properties": { "spec": {
66
+ "type": "object",
67
+ "properties": {
68
+ "files": { "type": "array", "minItems": 1, "items": {
69
+ "type": "object",
70
+ "properties": {
71
+ "path": { "type": "string" },
72
+ "hunks": { "type": "array", "minItems": 1, "items": {
73
+ "type": "object",
74
+ "properties": {
75
+ "id": { "type": "string" },
76
+ "header": { "type": "string" },
77
+ "before": { "type": "string" },
78
+ "after": { "type": "string" }
79
+ },
80
+ "required": ["id", "after"]
81
+ } }
82
+ },
83
+ "required": ["path", "hunks"]
84
+ } },
85
+ "granularity": { "const": "hunk" }
86
+ },
87
+ "required": ["files"]
88
+ } } }
89
+ },
90
+ {
91
+ "if": { "properties": { "type": { "const": "ask_number" } } },
92
+ "then": { "properties": { "spec": {
93
+ "type": "object",
94
+ "properties": {
95
+ "min": { "type": "number" },
96
+ "max": { "type": "number" },
97
+ "step": { "type": "number" },
98
+ "unit": { "type": "string" },
99
+ "integer": { "type": "boolean" }
100
+ }
101
+ } } }
102
+ },
103
+ {
104
+ "if": { "properties": { "type": { "const": "ask_rating" } } },
105
+ "then": { "properties": { "spec": {
106
+ "type": "object",
107
+ "properties": {
108
+ "max": { "type": "integer", "minimum": 2 },
109
+ "icon": { "enum": ["star", "number"] },
110
+ "labels": { "type": "object", "properties": {
111
+ "min": { "type": "string" }, "max": { "type": "string" }
112
+ } }
113
+ }
114
+ } } }
115
+ },
116
+ {
117
+ "if": { "properties": { "type": { "const": "ask_slider" } } },
118
+ "then": { "properties": { "spec": {
119
+ "type": "object",
120
+ "properties": {
121
+ "min": { "type": "number" },
122
+ "max": { "type": "number" },
123
+ "step": { "type": "number" },
124
+ "unit": { "type": "string" }
125
+ },
126
+ "required": ["min", "max"]
127
+ } } }
128
+ },
129
+ {
130
+ "if": { "properties": { "type": { "const": "ask_date" } } },
131
+ "then": { "properties": { "spec": {
132
+ "type": "object",
133
+ "properties": {
134
+ "min": { "type": "string" },
135
+ "max": { "type": "string" },
136
+ "time": { "type": "boolean" }
137
+ }
138
+ } } }
139
+ },
140
+ {
141
+ "if": { "properties": { "type": { "const": "ask_color" } } },
142
+ "then": { "properties": { "spec": {
143
+ "type": "object",
144
+ "properties": {
145
+ "palette": { "type": "array", "items": { "$ref": "#/$defs/safeColor" } },
146
+ "allowCustom": { "type": "boolean" }
147
+ }
148
+ } } }
149
+ },
150
+ {
151
+ "if": { "properties": { "type": { "const": "ask_rank" } } },
152
+ "then": { "properties": { "spec": {
153
+ "type": "object",
154
+ "properties": {
155
+ "items": { "type": "array", "minItems": 2, "items": {
156
+ "type": "object",
157
+ "properties": {
158
+ "id": { "type": "string" },
159
+ "label": { "type": "string" },
160
+ "description": { "type": "string" }
161
+ },
162
+ "required": ["id", "label"]
163
+ } }
164
+ },
165
+ "required": ["items"]
166
+ } } }
167
+ }
168
+ ]
169
+ },
170
+ "askSet": {
171
+ "type": "object",
172
+ "properties": {
173
+ "specVersion": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$" },
174
+ "asks": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/ask" } },
175
+ "edges": { "type": "array", "description": "RESERVED v0.1: conditional branching" },
176
+ "meta": {
177
+ "type": "object",
178
+ "description": "Optional AskSet-level presentation hints (advisory, forward-compatible). Unknown keys are preserved.",
179
+ "properties": {
180
+ "layout": { "type": "string" },
181
+ "theme": { "type": "string" },
182
+ "accent": { "$ref": "#/$defs/safeColor" }
183
+ },
184
+ "additionalProperties": true
185
+ }
186
+ },
187
+ "required": ["specVersion", "asks"]
188
+ },
189
+ "answer": {
190
+ "type": "object",
191
+ "properties": {
192
+ "id": { "type": "string" },
193
+ "type": { "type": "string" },
194
+ "status": { "enum": ["answered", "declined", "deferred"] },
195
+ "value": {},
196
+ "meta": {
197
+ "type": "object",
198
+ "properties": {
199
+ "tier": { "$ref": "#/$defs/tier" },
200
+ "specVersion": { "type": "string" }
201
+ }
202
+ }
203
+ },
204
+ "required": ["id", "type", "status"]
205
+ }
206
+ },
207
+ "$ref": "#/$defs/askSet"
208
+ }