@klickd/core 3.5.1 → 4.0.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/README.md +42 -5
- package/dist/index.cjs +264 -2
- package/dist/index.d.cts +162 -1
- package/dist/index.d.ts +162 -1
- package/dist/index.js +256 -1
- package/dist/klickd-payload-v4-preview.schema-W7RY72VP.json +98 -0
- package/dist/klickd-payload-v4.schema-7UPTEJOY.json +354 -0
- package/dist/klickd-v4-preview.schema-QHITWMK6.json +95 -0
- package/dist/klickd-v4.schema-ZZGRYTLY.json +129 -0
- package/package.json +13 -4
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://klickd.app/schemas/v4/klickd-payload.schema.json",
|
|
4
|
+
"title": "klickd Payload v4 (Strict GA candidate, normative)",
|
|
5
|
+
"description": "Strict JSON Schema for the .klickd v4 inner payload. This schema is the GA strict equivalent of the permissive klickd-payload-v4-preview.schema.json. Strict blocks correspond to RFC-001 (media_profile v1, Accepted) and RFC-002 v1 core (verification_gates, human_veto_policy, claim_sources v1, Accepted). Sections that remain Draft (RFC-002 v2-additive: contract_tests, success_criteria, reversibility, blast_radius, verification_artifacts, error_journal.rule_created; RFC-004 migration runtime) are accepted but left permissive so they can be tightened by a future strict schema bump without breaking GA writers. Top-level additionalProperties is TRUE to preserve unknown fields verbatim (SPEC.md §33.7 forward-compatibility invariant). Strict shape on frozen sub-objects uses additionalProperties: false locally. Does NOT supersede the permissive preview schema (klickd-payload-v4-preview.schema.json) — both coexist until the preview sunset announced separately.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"payload_schema_version"
|
|
9
|
+
],
|
|
10
|
+
"additionalProperties": true,
|
|
11
|
+
"properties": {
|
|
12
|
+
"payload_schema_version": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "Payload schema version. For GA strict files, the canonical value is '4.0'. The preview value '4.0.0-preview.1' is also accepted so a preview file already in the wild round-trips against the strict schema without forcing a rewrite. A future strict bump (4.1, etc.) MAY tighten this enum.",
|
|
15
|
+
"enum": ["4.0", "4.0.0-preview.1"]
|
|
16
|
+
},
|
|
17
|
+
"domain_schema_version": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "Domain-specific schema version. Two accepted forms: (a) v3-style '{domain}-{major}.{minor}' (e.g. 'education-1.2'); (b) bare semver-ish '{major}.{minor}(.{patch})?' for domain-agnostic profiles (e.g. '1.0.0').",
|
|
20
|
+
"pattern": "^([a-z][a-z0-9_-]*-\\d+\\.\\d+|\\d+\\.\\d+(\\.\\d+)?)$"
|
|
21
|
+
},
|
|
22
|
+
"preview": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "OPTIONAL preview marker. Present only on files written against a preview iteration (e.g. 'v4.0.0-preview.1'). Absent on GA strict files."
|
|
25
|
+
},
|
|
26
|
+
"profile_kind": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"description": "Top-level discriminator for the profile shape. Reserved canonical values: 'learner', 'agent', 'team', 'robot', 'creator'. Custom strings are permitted (extension space). v3.x is implicitly 'learner'."
|
|
29
|
+
},
|
|
30
|
+
"injection_target": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"enum": ["system_prompt", "user_message", "both"],
|
|
33
|
+
"description": "Where to inject the .klickd context (carried over from v3.x §20.2)."
|
|
34
|
+
},
|
|
35
|
+
"identity": {
|
|
36
|
+
"type": "object",
|
|
37
|
+
"description": "Persistent user identity attributes. Carried over from v3 SPEC §8; same strictness as v3 payload schema. All sub-fields are OPTIONAL.",
|
|
38
|
+
"additionalProperties": true,
|
|
39
|
+
"properties": {
|
|
40
|
+
"name": {"type": "string", "maxLength": 256},
|
|
41
|
+
"display_name": {"type": "string", "maxLength": 256, "description": "v4 GA preferred user-facing alias. Either 'name' or 'display_name' may be used; producers SHOULD pick one."},
|
|
42
|
+
"language": {"type": "string", "description": "BCP 47 language tag."},
|
|
43
|
+
"timezone": {"type": "string", "description": "IANA time zone identifier."},
|
|
44
|
+
"communication_style": {"type": "string"}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"companion_identity": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"description": "Optional companion / co-agent persona. Same surface as v3.4 §27. Permissive.",
|
|
50
|
+
"additionalProperties": true
|
|
51
|
+
},
|
|
52
|
+
"context": {
|
|
53
|
+
"type": "object",
|
|
54
|
+
"description": "Operational session state. Carried over from v3 SPEC §9. Permissive (unevaluatedProperties policy of v3 retained).",
|
|
55
|
+
"additionalProperties": true
|
|
56
|
+
},
|
|
57
|
+
"knowledge": {
|
|
58
|
+
"type": "object",
|
|
59
|
+
"description": "Structured knowledge state. Carried over from v3 SPEC §10. Permissive.",
|
|
60
|
+
"additionalProperties": true
|
|
61
|
+
},
|
|
62
|
+
"memory": {
|
|
63
|
+
"type": "array",
|
|
64
|
+
"maxItems": 1000,
|
|
65
|
+
"description": "Structured conversation/event log. Same v3 §11 constraints retained.",
|
|
66
|
+
"items": {"type": "object", "additionalProperties": true}
|
|
67
|
+
},
|
|
68
|
+
"learning_goal": {
|
|
69
|
+
"type": "object",
|
|
70
|
+
"description": "User's stated learning / delivery goal. Same surface as v3 §27. Permissive.",
|
|
71
|
+
"additionalProperties": true,
|
|
72
|
+
"properties": {
|
|
73
|
+
"type": {"type": "string"},
|
|
74
|
+
"deadline": {"type": "string"},
|
|
75
|
+
"stakes": {"type": "string", "enum": ["low", "medium", "high"]}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"user_preferences": {
|
|
79
|
+
"oneOf": [
|
|
80
|
+
{"type": "string", "maxLength": 32768},
|
|
81
|
+
{"type": "object", "additionalProperties": true}
|
|
82
|
+
],
|
|
83
|
+
"description": "Canonical type is string (v3.5 §22.6). Object form retained for backward compatibility."
|
|
84
|
+
},
|
|
85
|
+
"agent_instructions": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"maxLength": 32768,
|
|
88
|
+
"description": "System-prompt injection string. Same v3 §7.2 contract."
|
|
89
|
+
},
|
|
90
|
+
"onboarding_trigger": {
|
|
91
|
+
"type": "string",
|
|
92
|
+
"description": "Optional onboarding trigger (v3.4 §29b). Common values: 'on_new_agent', 'manual'."
|
|
93
|
+
},
|
|
94
|
+
"ethics": {
|
|
95
|
+
"type": "object",
|
|
96
|
+
"description": "Ethical guard surface (v3.x). Permissive in this schema; safety / locked fields are governed by docs/spec/DEPRECATION_POLICY_V4.md §9.",
|
|
97
|
+
"additionalProperties": true
|
|
98
|
+
},
|
|
99
|
+
"media_profile": {
|
|
100
|
+
"description": "RFC-001 v1 (Accepted): portable, hash-referenced media context. Strict on the v1 frozen surface (versioned + entries[]); a permissive 'summary' form (preview-era) is also accepted for round-trip compatibility. New modalities / fields land via additive RFC bumps.",
|
|
101
|
+
"oneOf": [
|
|
102
|
+
{
|
|
103
|
+
"type": "object",
|
|
104
|
+
"additionalProperties": false,
|
|
105
|
+
"required": ["version", "entries"],
|
|
106
|
+
"properties": {
|
|
107
|
+
"version": {"type": "integer", "const": 1, "description": "media_profile schema version. v1 per RFC-001."},
|
|
108
|
+
"entries": {
|
|
109
|
+
"type": "array",
|
|
110
|
+
"maxItems": 256,
|
|
111
|
+
"items": {"$ref": "#/$defs/mediaProfileEntry"}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"type": "object",
|
|
117
|
+
"description": "Permissive summary form (preview-era). Strict producers SHOULD migrate to the versioned + entries[] form. Kept for round-trip parity with vectors_v40_preview.json.",
|
|
118
|
+
"additionalProperties": true,
|
|
119
|
+
"not": {"required": ["version", "entries"]}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"type": "null"
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
"verification_gates": {
|
|
127
|
+
"description": "RFC-002 v1 core (Accepted): user's preferred friction profile per action class. Two accepted shapes: (a) structured form (recommended) with version + gates[]; (b) flat map {action_class: level} for compactness (used by §33.5 minimal example and preview readers).",
|
|
128
|
+
"oneOf": [
|
|
129
|
+
{
|
|
130
|
+
"type": "object",
|
|
131
|
+
"additionalProperties": false,
|
|
132
|
+
"required": ["version", "gates"],
|
|
133
|
+
"properties": {
|
|
134
|
+
"version": {"type": "integer", "const": 1},
|
|
135
|
+
"user_default": {"$ref": "#/$defs/gateLevel"},
|
|
136
|
+
"gates": {
|
|
137
|
+
"type": "array",
|
|
138
|
+
"maxItems": 256,
|
|
139
|
+
"items": {"$ref": "#/$defs/gateEntry"}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"type": "object",
|
|
145
|
+
"description": "Flat map form: {action_class: gate_level}. Each value MUST be one of the five canonical levels.",
|
|
146
|
+
"additionalProperties": {"$ref": "#/$defs/gateLevel"}
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
"human_veto_policy": {
|
|
151
|
+
"description": "RFC-002 v1 (Accepted): standing rules about when a human MUST be in the loop. Overrides any lower gate.",
|
|
152
|
+
"type": ["object", "null"],
|
|
153
|
+
"additionalProperties": false,
|
|
154
|
+
"properties": {
|
|
155
|
+
"applies_to": {
|
|
156
|
+
"type": "array",
|
|
157
|
+
"items": {"type": "string"},
|
|
158
|
+
"maxItems": 64,
|
|
159
|
+
"description": "List of action classes for which a human veto is required."
|
|
160
|
+
},
|
|
161
|
+
"second_party": {
|
|
162
|
+
"type": ["string", "null"],
|
|
163
|
+
"description": "Optional named second party who may unlock. null means owner-only."
|
|
164
|
+
},
|
|
165
|
+
"min_level": {
|
|
166
|
+
"$ref": "#/$defs/gateLevel",
|
|
167
|
+
"description": "Floor gate level. The policy MUST NOT resolve below this level for any action class in 'applies_to'. RFC-002 v1 §4 #6 — human veto is sacred."
|
|
168
|
+
},
|
|
169
|
+
"rationale": {"type": "string", "maxLength": 1024}
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
"claim_sources": {
|
|
173
|
+
"description": "RFC-002 v1 (Accepted) + v2-additive (Draft). Strict on v1 fields ('prefer', 'require_citation_for'); 'records' and extended fields remain permissive (v2 still Draft).",
|
|
174
|
+
"type": ["object", "null"],
|
|
175
|
+
"additionalProperties": true,
|
|
176
|
+
"properties": {
|
|
177
|
+
"prefer": {
|
|
178
|
+
"type": "array",
|
|
179
|
+
"items": {"type": "string"},
|
|
180
|
+
"maxItems": 64,
|
|
181
|
+
"description": "Ordered preference list. Each entry is a free-form source identifier; common values: 'user_supplied', 'tool:web_search', 'tool:doi_resolver'."
|
|
182
|
+
},
|
|
183
|
+
"require_citation_for": {
|
|
184
|
+
"type": "array",
|
|
185
|
+
"items": {"type": "string"},
|
|
186
|
+
"maxItems": 64
|
|
187
|
+
},
|
|
188
|
+
"records": {
|
|
189
|
+
"type": "array",
|
|
190
|
+
"description": "v2-additive (Draft). Permissive until promoted.",
|
|
191
|
+
"items": {"type": "object", "additionalProperties": true}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"risk_thresholds": {
|
|
196
|
+
"description": "RFC-002 v1 (Accepted): numeric / categorical knobs. Permissive on inner shape — extension space.",
|
|
197
|
+
"type": ["object", "null"],
|
|
198
|
+
"additionalProperties": true
|
|
199
|
+
},
|
|
200
|
+
"preflight_checks": {
|
|
201
|
+
"description": "RFC-002 v1 (Accepted): small named checks to run before acting. Each entry is an object with at minimum 'name'.",
|
|
202
|
+
"type": ["array", "null"],
|
|
203
|
+
"items": {"type": ["object", "string"], "additionalProperties": true}
|
|
204
|
+
},
|
|
205
|
+
"error_journal": {
|
|
206
|
+
"description": "RFC-002 v1 (Accepted): append-only lessons learned. Permissive on entry shape ('rule_created' remains Draft in v2-additive).",
|
|
207
|
+
"type": ["array", "null"],
|
|
208
|
+
"items": {"type": "object", "additionalProperties": true}
|
|
209
|
+
},
|
|
210
|
+
"verification_artifacts": {
|
|
211
|
+
"description": "RFC-002 §8b.8 (Draft, v2-additive). Permissive: pointer ledger, not a payload sink. Accepted as null or array.",
|
|
212
|
+
"type": ["array", "null"],
|
|
213
|
+
"items": {"type": "object", "additionalProperties": true}
|
|
214
|
+
},
|
|
215
|
+
"contract_tests": {
|
|
216
|
+
"description": "RFC-002 v2-additive (Draft). Permissive.",
|
|
217
|
+
"type": ["array", "null"],
|
|
218
|
+
"items": {"type": "object", "additionalProperties": true}
|
|
219
|
+
},
|
|
220
|
+
"success_criteria": {
|
|
221
|
+
"description": "RFC-002 v2-additive (Draft). Permissive.",
|
|
222
|
+
"type": ["object", "array", "null"],
|
|
223
|
+
"additionalProperties": true
|
|
224
|
+
},
|
|
225
|
+
"reversibility": {
|
|
226
|
+
"description": "RFC-002 v2-additive (Draft). Permissive — typical shape is {action_class: enum<reversible|costly_to_reverse|irreversible|low|none|high>} but enums are not yet frozen.",
|
|
227
|
+
"type": ["object", "null"],
|
|
228
|
+
"additionalProperties": true
|
|
229
|
+
},
|
|
230
|
+
"blast_radius": {
|
|
231
|
+
"description": "RFC-002 v2-additive (Draft). Permissive.",
|
|
232
|
+
"type": ["object", "null"],
|
|
233
|
+
"additionalProperties": true
|
|
234
|
+
},
|
|
235
|
+
"migration": {
|
|
236
|
+
"description": "RFC-004 (Draft): optional migration metadata block. Audit-only — no migration tooling ships with the strict schema. Strict on v1 frozen fields; extension fields permitted.",
|
|
237
|
+
"type": ["object", "null"],
|
|
238
|
+
"additionalProperties": true,
|
|
239
|
+
"properties": {
|
|
240
|
+
"source_version": {"type": "string"},
|
|
241
|
+
"migrated_at": {
|
|
242
|
+
"type": "string",
|
|
243
|
+
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$"
|
|
244
|
+
},
|
|
245
|
+
"migration_report_ref": {"type": "string"},
|
|
246
|
+
"backup_ref": {"type": "string"}
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
"context_cost": {
|
|
250
|
+
"description": "Research/benchmark track (benchmarks/context_cost/RFC.md). No spec semantics depend on this field. Permissive.",
|
|
251
|
+
"type": ["object", "null"],
|
|
252
|
+
"additionalProperties": true
|
|
253
|
+
},
|
|
254
|
+
"gaming_profile": {
|
|
255
|
+
"description": "R4-P1-4 gaming.klickd baseline (preview, registry-based). NOT a v4 MUST. Accepted as a registry-defined optional profile; permissive structure.",
|
|
256
|
+
"type": ["object", "null"],
|
|
257
|
+
"additionalProperties": true
|
|
258
|
+
},
|
|
259
|
+
"deprecated_fields": {
|
|
260
|
+
"description": "OPTIONAL informational block defined by docs/spec/DEPRECATION_POLICY_V4.md §6. Lists fields the producer has emitted as 'deprecated' status. Readers that don't understand it MUST silently ignore (§33.7).",
|
|
261
|
+
"type": ["array", "null"],
|
|
262
|
+
"items": {
|
|
263
|
+
"type": "object",
|
|
264
|
+
"additionalProperties": true,
|
|
265
|
+
"required": ["name"],
|
|
266
|
+
"properties": {
|
|
267
|
+
"name": {"type": "string"},
|
|
268
|
+
"since": {"type": "string"},
|
|
269
|
+
"replacement": {"type": ["string", "null"]},
|
|
270
|
+
"removal_target": {"type": ["string", "null"]}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
"_example_metadata": {
|
|
275
|
+
"description": "Optional non-normative block used by repository examples (see examples/v4/personas/README.md). Carries 'persona', 'non_normative', 'contains_real_pii', 'contains_secrets', etc. A reader MUST NOT use this block as a trust signal.",
|
|
276
|
+
"type": "object",
|
|
277
|
+
"additionalProperties": true
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
"$defs": {
|
|
281
|
+
"gateLevel": {
|
|
282
|
+
"type": "string",
|
|
283
|
+
"enum": ["silent", "warn", "confirm", "block", "require-owner"],
|
|
284
|
+
"description": "RFC-002 v1 §6 — fixed enum of five gate levels. No new levels are added in GA."
|
|
285
|
+
},
|
|
286
|
+
"gateEntry": {
|
|
287
|
+
"type": "object",
|
|
288
|
+
"additionalProperties": false,
|
|
289
|
+
"required": ["action_class", "level"],
|
|
290
|
+
"properties": {
|
|
291
|
+
"id": {"type": "string", "maxLength": 128},
|
|
292
|
+
"action_class": {"type": "string", "maxLength": 128},
|
|
293
|
+
"level": {"$ref": "#/$defs/gateLevel"},
|
|
294
|
+
"reason": {"type": "string", "maxLength": 1024}
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
"mediaProfileEntry": {
|
|
298
|
+
"type": "object",
|
|
299
|
+
"additionalProperties": true,
|
|
300
|
+
"required": ["id", "modality", "hash"],
|
|
301
|
+
"description": "RFC-001 v1 entry. Strict on v1 frozen fields (id, modality, hash). Additional metadata (consent, producer, etc.) is permitted as extension surface.",
|
|
302
|
+
"properties": {
|
|
303
|
+
"id": {"type": "string", "maxLength": 128},
|
|
304
|
+
"modality": {
|
|
305
|
+
"type": "string",
|
|
306
|
+
"enum": ["voice", "image", "document", "embedding"],
|
|
307
|
+
"description": "RFC-001 v1 §4 #3 — closed enum at v1. Custom modalities live under 'x_*' namespaces (outside this entry)."
|
|
308
|
+
},
|
|
309
|
+
"label": {"type": "string", "maxLength": 256},
|
|
310
|
+
"language": {"type": "string"},
|
|
311
|
+
"uri": {"type": "string", "description": "May be file://, https://, ipfs://, cas://<hash>, or a relative path. Reader chooses how to resolve."},
|
|
312
|
+
"media_type": {"type": "string"},
|
|
313
|
+
"byte_size": {"type": "integer", "minimum": 0},
|
|
314
|
+
"duration_ms": {"type": "integer", "minimum": 0},
|
|
315
|
+
"bytes_b64": {
|
|
316
|
+
"type": "string",
|
|
317
|
+
"contentEncoding": "base64",
|
|
318
|
+
"description": "Inline base64 PERMITTED ONLY for entries ≤ 16 KiB total (RFC-001 v1 §4 #1). Strict enforcement of the 16 KiB cap is not expressible in JSON Schema and is enforced by reader-side logic."
|
|
319
|
+
},
|
|
320
|
+
"hash": {
|
|
321
|
+
"type": "object",
|
|
322
|
+
"additionalProperties": false,
|
|
323
|
+
"required": ["algo", "value"],
|
|
324
|
+
"properties": {
|
|
325
|
+
"algo": {"type": "string", "const": "blake3", "description": "RFC-001 v1 §4 #2 — one hash, one algorithm: BLAKE3."},
|
|
326
|
+
"value": {"type": "string", "description": "Hash value, encoding per RFC-001 (base64 or hex-prefixed). Strict format enforcement is reader-side."}
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
"producer": {
|
|
330
|
+
"type": "object",
|
|
331
|
+
"additionalProperties": true,
|
|
332
|
+
"properties": {
|
|
333
|
+
"kind": {"type": "string"},
|
|
334
|
+
"device": {"type": "string"}
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
"consent": {
|
|
338
|
+
"type": "object",
|
|
339
|
+
"additionalProperties": true,
|
|
340
|
+
"description": "RFC-001 v1 §4 #5 — consent is per-entry, not per-file.",
|
|
341
|
+
"properties": {
|
|
342
|
+
"purposes": {
|
|
343
|
+
"type": "array",
|
|
344
|
+
"items": {"type": "string"},
|
|
345
|
+
"maxItems": 64
|
|
346
|
+
},
|
|
347
|
+
"expires_at": {"type": "string"},
|
|
348
|
+
"revocable": {"type": "boolean"}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://klickd.app/schema/v4-preview/klickd.schema.json",
|
|
4
|
+
"title": "klickd v4 Preview — Unified (PERMISSIVE, NON-NORMATIVE)",
|
|
5
|
+
"description": "PREVIEW unified schema for .klickd v4, targeting v4.0.0-preview.1. This schema is INTENTIONALLY PERMISSIVE: it validates the top-level shape of a v4-preview file (envelope + optional preview hooks) without enforcing strict v4 semantics. additionalProperties is true so unknown fields round-trip verbatim. Use this for single-pass acceptance of draft v4 documents. For pre-/post-decrypt validation, see schemas/klickd-payload-v4-preview.schema.json. The normative production schemas remain schema/klickd-v3.4.schema.json (unified) and schemas/klickd-envelope-v3.schema.json + schemas/klickd-payload-v3.schema.json (split). See SPEC.md §33.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": true,
|
|
8
|
+
"required": ["klickd_version", "created_at", "encrypted"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"klickd_version": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "Wire / envelope version. PERMISSIVE in this preview — any MAJOR.MINOR string is accepted. Preview producers SHOULD emit '4.0' and pair it with a 'preview' field. v3.x producers MUST continue to emit '3.x' and MUST NOT emit a 'preview' field.",
|
|
13
|
+
"pattern": "^\\d+\\.\\d+(\\.[0-9A-Za-z-.]+)?$"
|
|
14
|
+
},
|
|
15
|
+
"preview": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "Marks a file as belonging to a specific preview iteration. Recommended value for files written against this schema: 'v4.0.0-preview.1'. Absent in v3.x and in a future GA v4.0."
|
|
18
|
+
},
|
|
19
|
+
"created_at": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "RFC 3339 UTC timestamp of file creation. Same contract as v3.x.",
|
|
22
|
+
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$",
|
|
23
|
+
"format": "date-time"
|
|
24
|
+
},
|
|
25
|
+
"encrypted": {
|
|
26
|
+
"type": "boolean",
|
|
27
|
+
"description": "Whether the payload is AES-256-GCM encrypted. Envelope cryptography is unchanged from v3.x in this preview."
|
|
28
|
+
},
|
|
29
|
+
"domain": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "Semantic category of the context. Same surface as v3.x; custom strings remain permitted."
|
|
32
|
+
},
|
|
33
|
+
"profile_kind": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"description": "Top-level discriminator for the profile shape. Common values: 'learner', 'agent', 'team', 'robot'. Custom strings are permitted."
|
|
36
|
+
},
|
|
37
|
+
"ciphertext": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"description": "AES-256-GCM ciphertext when encrypted is true. Same contract as v3.x.",
|
|
40
|
+
"contentEncoding": "base64"
|
|
41
|
+
},
|
|
42
|
+
"iv": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"contentEncoding": "base64"
|
|
45
|
+
},
|
|
46
|
+
"kdf_salt": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"contentEncoding": "base64"
|
|
49
|
+
},
|
|
50
|
+
"kdf": {
|
|
51
|
+
"type": "object",
|
|
52
|
+
"additionalProperties": true,
|
|
53
|
+
"description": "Structured KDF block as in envelope-v3. Unchanged in this preview."
|
|
54
|
+
},
|
|
55
|
+
"cipher": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"additionalProperties": true,
|
|
58
|
+
"description": "Structured cipher block as in envelope-v3. Unchanged in this preview."
|
|
59
|
+
},
|
|
60
|
+
"media_profile": {
|
|
61
|
+
"description": "RFC-001 (preview hook). PERMISSIVE — see schemas/klickd-payload-v4-preview.schema.json.",
|
|
62
|
+
"type": ["object", "array", "null"],
|
|
63
|
+
"additionalProperties": true
|
|
64
|
+
},
|
|
65
|
+
"verification_gates": {
|
|
66
|
+
"description": "RFC-002 (preview hook). PERMISSIVE.",
|
|
67
|
+
"type": ["object", "array", "null"],
|
|
68
|
+
"additionalProperties": true
|
|
69
|
+
},
|
|
70
|
+
"human_veto_policy": {
|
|
71
|
+
"description": "RFC-002 (preview hook). PERMISSIVE.",
|
|
72
|
+
"type": ["object", "null"],
|
|
73
|
+
"additionalProperties": true
|
|
74
|
+
},
|
|
75
|
+
"claim_sources": {
|
|
76
|
+
"description": "RFC-002 (preview hook). PERMISSIVE.",
|
|
77
|
+
"type": ["object", "null"],
|
|
78
|
+
"additionalProperties": true
|
|
79
|
+
},
|
|
80
|
+
"verification_artifacts": {
|
|
81
|
+
"description": "RFC-002 §8b.8 (preview hook). PERMISSIVE — pointer ledger, not a payload sink.",
|
|
82
|
+
"type": ["array", "null"]
|
|
83
|
+
},
|
|
84
|
+
"migration": {
|
|
85
|
+
"description": "RFC-004 (preview hook). Audit-only in v4.0.0-preview.1.",
|
|
86
|
+
"type": ["object", "null"],
|
|
87
|
+
"additionalProperties": true
|
|
88
|
+
},
|
|
89
|
+
"context_cost": {
|
|
90
|
+
"description": "Research/benchmark track (preview hook). No normative semantics.",
|
|
91
|
+
"type": ["object", "null"],
|
|
92
|
+
"additionalProperties": true
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://klickd.app/schema/v4/klickd.schema.json",
|
|
4
|
+
"title": "klickd v4 — Unified (Strict GA candidate, normative)",
|
|
5
|
+
"description": "Strict unified JSON Schema for a .klickd v4 document (envelope + optional inline payload). This schema is the GA strict equivalent of the permissive klickd-v4-preview.schema.json. It validates the envelope shape strictly (mirroring the v3 envelope contract — Argon2id + AES-256-GCM is unchanged in v4 per SPEC.md §33.10 #2) and, for unencrypted files, validates the inline payload against the strict v4 payload schema (klickd-payload-v4.schema.json). Top-level additionalProperties is TRUE to preserve unknown fields verbatim (SPEC.md §33.7 forward-compatibility invariant). Does NOT supersede the permissive preview schema (klickd-v4-preview.schema.json) — both coexist.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": true,
|
|
8
|
+
"required": ["klickd_version", "created_at", "encrypted"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"klickd_version": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "Wire / envelope version. Strict v4 GA producers SHOULD emit '4.0'. v3.x values are also accepted because the v3 envelope contract is unchanged (§33.10 #2) and a v3.x file remains readable by a v4 reader.",
|
|
13
|
+
"pattern": "^(3|4)\\.\\d+(\\.[0-9A-Za-z-.]+)?$"
|
|
14
|
+
},
|
|
15
|
+
"preview": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "OPTIONAL preview marker. Absent on GA strict files. If present, this file was written against a preview iteration (e.g. 'v4.0.0-preview.1')."
|
|
18
|
+
},
|
|
19
|
+
"created_at": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "RFC 3339 UTC timestamp of file creation. Z-suffix only, no fractional seconds (matches v3 envelope strict contract).",
|
|
22
|
+
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"
|
|
23
|
+
},
|
|
24
|
+
"encrypted": {
|
|
25
|
+
"type": "boolean"
|
|
26
|
+
},
|
|
27
|
+
"domain": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"minLength": 1,
|
|
30
|
+
"description": "Semantic category. Registered values follow v3 (education, work, finance, legal, creative, health, research, robotics, gaming, creator). Custom non-empty strings are permitted."
|
|
31
|
+
},
|
|
32
|
+
"profile_kind": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "Top-level discriminator for the profile shape. Reserved canonical values: 'learner', 'agent', 'team', 'robot', 'creator'."
|
|
35
|
+
},
|
|
36
|
+
"domain_schema_version": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"pattern": "^([a-z][a-z0-9_-]*-\\d+\\.\\d+|\\d+\\.\\d+(\\.\\d+)?)$"
|
|
39
|
+
},
|
|
40
|
+
"kdf": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"description": "Structured KDF block — same contract as envelope-v3 §15.",
|
|
43
|
+
"required": ["name", "params", "salt"],
|
|
44
|
+
"additionalProperties": false,
|
|
45
|
+
"properties": {
|
|
46
|
+
"name": {"type": "string", "enum": ["argon2id", "pbkdf2-sha256"]},
|
|
47
|
+
"params": {
|
|
48
|
+
"oneOf": [
|
|
49
|
+
{
|
|
50
|
+
"type": "object",
|
|
51
|
+
"required": ["m", "t", "p"],
|
|
52
|
+
"additionalProperties": false,
|
|
53
|
+
"properties": {
|
|
54
|
+
"m": {"type": "integer", "minimum": 65536},
|
|
55
|
+
"t": {"type": "integer", "minimum": 1},
|
|
56
|
+
"p": {"type": "integer", "minimum": 1}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"type": "object",
|
|
61
|
+
"required": ["iterations"],
|
|
62
|
+
"additionalProperties": false,
|
|
63
|
+
"properties": {
|
|
64
|
+
"iterations": {"type": "integer", "minimum": 600000}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"salt": {"type": "string"}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"cipher": {
|
|
73
|
+
"type": "object",
|
|
74
|
+
"description": "Structured cipher block — same contract as envelope-v3 §16. v4 does not introduce a new cipher.",
|
|
75
|
+
"required": ["name", "iv"],
|
|
76
|
+
"additionalProperties": false,
|
|
77
|
+
"properties": {
|
|
78
|
+
"name": {"type": "string", "const": "AES-256-GCM"},
|
|
79
|
+
"iv": {"type": "string"}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"ciphertext": {
|
|
83
|
+
"type": "string",
|
|
84
|
+
"description": "AES-256-GCM ciphertext (base64 padded). Required when encrypted=true."
|
|
85
|
+
},
|
|
86
|
+
"iv": {
|
|
87
|
+
"type": "string",
|
|
88
|
+
"description": "Legacy top-level IV mirror, retained for v3.0 round-trip parity. New producers SHOULD place IV inside the structured cipher block."
|
|
89
|
+
},
|
|
90
|
+
"kdf_salt": {
|
|
91
|
+
"type": "string",
|
|
92
|
+
"description": "Legacy top-level salt mirror, retained for v3.0 round-trip parity."
|
|
93
|
+
},
|
|
94
|
+
"payload_schema_version": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"description": "Payload schema version when the payload is inline (encrypted=false). Strict v4 GA value: '4.0'. Preview '4.0.0-preview.1' accepted for round-trip.",
|
|
97
|
+
"enum": ["4.0", "4.0.0-preview.1"]
|
|
98
|
+
},
|
|
99
|
+
"media_profile": {"$ref": "https://klickd.app/schemas/v4/klickd-payload.schema.json#/properties/media_profile"},
|
|
100
|
+
"verification_gates": {"$ref": "https://klickd.app/schemas/v4/klickd-payload.schema.json#/properties/verification_gates"},
|
|
101
|
+
"human_veto_policy": {"$ref": "https://klickd.app/schemas/v4/klickd-payload.schema.json#/properties/human_veto_policy"},
|
|
102
|
+
"claim_sources": {"$ref": "https://klickd.app/schemas/v4/klickd-payload.schema.json#/properties/claim_sources"},
|
|
103
|
+
"verification_artifacts": {"$ref": "https://klickd.app/schemas/v4/klickd-payload.schema.json#/properties/verification_artifacts"},
|
|
104
|
+
"contract_tests": {"$ref": "https://klickd.app/schemas/v4/klickd-payload.schema.json#/properties/contract_tests"},
|
|
105
|
+
"success_criteria": {"$ref": "https://klickd.app/schemas/v4/klickd-payload.schema.json#/properties/success_criteria"},
|
|
106
|
+
"reversibility": {"$ref": "https://klickd.app/schemas/v4/klickd-payload.schema.json#/properties/reversibility"},
|
|
107
|
+
"blast_radius": {"$ref": "https://klickd.app/schemas/v4/klickd-payload.schema.json#/properties/blast_radius"},
|
|
108
|
+
"risk_thresholds": {"$ref": "https://klickd.app/schemas/v4/klickd-payload.schema.json#/properties/risk_thresholds"},
|
|
109
|
+
"preflight_checks": {"$ref": "https://klickd.app/schemas/v4/klickd-payload.schema.json#/properties/preflight_checks"},
|
|
110
|
+
"error_journal": {"$ref": "https://klickd.app/schemas/v4/klickd-payload.schema.json#/properties/error_journal"},
|
|
111
|
+
"migration": {"$ref": "https://klickd.app/schemas/v4/klickd-payload.schema.json#/properties/migration"},
|
|
112
|
+
"context_cost": {"$ref": "https://klickd.app/schemas/v4/klickd-payload.schema.json#/properties/context_cost"},
|
|
113
|
+
"gaming_profile": {"$ref": "https://klickd.app/schemas/v4/klickd-payload.schema.json#/properties/gaming_profile"},
|
|
114
|
+
"deprecated_fields": {"$ref": "https://klickd.app/schemas/v4/klickd-payload.schema.json#/properties/deprecated_fields"}
|
|
115
|
+
},
|
|
116
|
+
"allOf": [
|
|
117
|
+
{
|
|
118
|
+
"if": {
|
|
119
|
+
"type": "object",
|
|
120
|
+
"properties": {"encrypted": {"const": true}},
|
|
121
|
+
"required": ["encrypted"]
|
|
122
|
+
},
|
|
123
|
+
"then": {
|
|
124
|
+
"required": ["kdf", "cipher", "ciphertext"],
|
|
125
|
+
"description": "Encrypted v4 file MUST carry kdf + cipher + ciphertext (envelope-v3 contract retained)."
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@klickd/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Official JavaScript/TypeScript library for reading and writing .klickd portable AI context files",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"klickd",
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
"memory",
|
|
10
10
|
"encrypted"
|
|
11
11
|
],
|
|
12
|
-
"homepage": "https://klickd.app",
|
|
12
|
+
"homepage": "https://klickd.app/klickdskill",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
15
|
"url": "https://github.com/Davincc77/klickdskill"
|
|
16
16
|
},
|
|
17
17
|
"license": "CC0-1.0",
|
|
18
|
-
"author": "
|
|
18
|
+
"author": "Vincenzo Cirilli (.klickd) <hello@klickd.app> (https://klickd.app)",
|
|
19
19
|
"type": "module",
|
|
20
20
|
"main": "./dist/index.cjs",
|
|
21
21
|
"module": "./dist/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"LICENSE"
|
|
34
34
|
],
|
|
35
35
|
"scripts": {
|
|
36
|
-
"build": "tsup src/index.ts --format esm,cjs --dts --external argon2 --external argon2-browser",
|
|
36
|
+
"build": "tsup src/index.ts --format esm,cjs --dts --external argon2 --external argon2-browser --external ajv --loader .json=copy",
|
|
37
37
|
"test": "node --experimental-vm-modules node_modules/.bin/jest",
|
|
38
38
|
"prepublishOnly": "npm run build"
|
|
39
39
|
},
|
|
@@ -41,9 +41,18 @@
|
|
|
41
41
|
"canonicalize": "^2.0.0",
|
|
42
42
|
"hash-wasm": "^4.11.0"
|
|
43
43
|
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"ajv": "^8.12.0"
|
|
46
|
+
},
|
|
47
|
+
"peerDependenciesMeta": {
|
|
48
|
+
"ajv": {
|
|
49
|
+
"optional": true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
44
52
|
"devDependencies": {
|
|
45
53
|
"@types/jest": "^29.0.0",
|
|
46
54
|
"@types/node": "^20.0.0",
|
|
55
|
+
"ajv": "^8.12.0",
|
|
47
56
|
"argon2": "^0.44.0",
|
|
48
57
|
"argon2-browser": "^1.18.0",
|
|
49
58
|
"jest": "^29.0.0",
|