@aikdna/kdna-studio-core 1.5.4 → 1.5.5

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 CHANGED
@@ -1,17 +1,18 @@
1
1
  # KDNA Studio Core
2
2
 
3
- **KDNA Studio Core is the judgment asset refinery.** It turns scattered notes, documents, works, and feedback into loadable .kdna judgment assets — not by compressing content, but by distilling the stable judgment patterns embedded within it.
3
+ **KDNA Studio Core is the judgment asset refinery.** It turns scattered notes, documents, works, and feedback into loadable `.kdna` judgment assets — not by compressing content, but by distilling stable judgment patterns into a declared domain and loading scope.
4
4
 
5
- AI may propose judgment candidates from content analysis. Humans must confirm judgment. Only human-locked judgment can compile into KDNA.
5
+ Studio Core is part of the official authoring toolchain. It can record human review, Human Lock, signatures, and release evidence as provenance signals, but those signals are not KDNA Core v1 format-validity requirements and they do not make content officially endorsed, certified, or universally safe.
6
6
 
7
- Open-source Studio-compatible authoring kernel for creating trusted `.kdna` assets — JS/npm package. Supports two authoring paths: interview-first (expert self-expression) and distillation-first (pattern extraction from existing content). Both end with Human Judgment Lock.
7
+ Open-source Studio-compatible authoring kernel for creating reviewable `.kdna` assets — JS/npm package. Supports two authoring paths: interview-first (direct expression) and distillation-first (pattern extraction from existing content). Both end with a canonical KDNA Core v1 runtime export.
8
8
 
9
- **KDNA Studio Core is the JS authoring kernel.** It is not a UI tool and not a CLI package. It is a pure-logic engine for creating KDNA judgment cards, Human Locks, compiler output, and authoring provenance from JavaScript applications and Studio-compatible tools.
9
+ **KDNA Studio Core is the JS authoring kernel.** It is not a UI tool and not a CLI package. It is a pure-logic engine for creating KDNA judgment cards, optional provenance records, compiler output, and runtime `.kdna` exports from JavaScript applications and Studio-compatible tools.
10
10
 
11
- A `.kdna` asset is not created by writing JSON files. It is compiled by a
12
- Studio-compatible authoring pipeline that performs human confirmation,
13
- validation, canonicalization, identity generation, digest computation, signing,
14
- optional encryption, and provenance recording.
11
+ A `.kdna` asset is not a public source JSON folder. Studio-compatible tooling
12
+ uses a project workspace for authoring, review, and audit, then exports the
13
+ canonical KDNA Core v1 runtime container. Human confirmation, Human Lock,
14
+ signing, optional encryption, and release evidence are provenance layers, not
15
+ format-validity requirements.
15
16
 
16
17
  Studio Core distinguishes authoring compile output from runtime distribution
17
18
  output. Authoring compile output may include source entries such as
@@ -37,8 +38,8 @@ conforming KDNA runtime assets.
37
38
  | Library | Language | Role |
38
39
  |---------|----------|------|
39
40
  | `@aikdna/kdna-cli` | JS/npm | **Operate** KDNA — install, verify, load, compare, publish |
40
- | **`@aikdna/kdna-studio-core`** | JS/npm | **Authoring kernel** — project model, cards, Human Lock, compiler, provenance |
41
- | `@aikdna/kdna-studio-cli` | JS/npm | **Create via CLI** — `kdna-studio` create, compile, export |
41
+ | **`@aikdna/kdna-studio-core`** | JS/npm | **Authoring kernel** — project model, cards, review/provenance, compiler, runtime export |
42
+ | `@aikdna/kdna-studio-cli` | JS/npm | **Create via CLI** — `kdna-studio` create, review, export |
42
43
  | `@aikdna/kdna-core` | JS/npm | **Use** KDNA — load, validate, format |
43
44
 
44
45
  ## What it does
@@ -49,10 +50,10 @@ conforming KDNA runtime assets.
49
50
  - **Evidence Relevance** — classify source material as relevant, weakly relevant, out-of-scope, or split-domain before distillation
50
51
  - **Scope Gate** — mark candidates with `scope_fit`, relevance score, and suggested split domain before they can become cards
51
52
  - **Judgment Cards** — 8 card types: axiom, ontology, stance, framework, misunderstanding, self_check, banned_term, terminology
52
- - **Human Lock** — AI proposes, human confirms. Only locked cards compile.
53
+ - **Review and provenance** — AI may propose candidates; projects can record human confirmation, Human Lock, signatures, and release evidence when needed.
53
54
  - **Authoring Provenance** — every compiled manifest records Studio-compatible
54
- compiler metadata, project digest, Human Lock count, and confirmation status.
55
- - **Asset Build Reports** — every compile emits build, provenance, Human Lock,
55
+ compiler metadata, project digest, review counts, and confirmation status.
56
+ - **Asset Build Reports** — every compile emits build, provenance, review,
56
57
  quality gate, eval, and receipt artifacts for audit.
57
58
  - **Feynman Restatement** — verify understanding, not just agreement
58
59
  - **Quality Gates** — readiness check: draft → structurally_ready → judgment_ready → publish_ready
@@ -72,14 +73,14 @@ conforming KDNA runtime assets.
72
73
  ## Authoring Flow
73
74
 
74
75
  ```
75
- Evidence Room → Judgment Cards → Human Lock → Quality Gate → Compile → Validate → Export
76
+ Evidence Room → Judgment Cards → Review/Provenance → Quality Gate → Compile → Validate → Export
76
77
  ```
77
78
 
78
79
  For distillation-first authoring, the flow starts with an explicit target:
79
80
 
80
81
  ```
81
82
  Declare Domain + Scope → Import Evidence → Classify Relevance → Distill Candidates
82
- → Scope Gate → Human Review → Promote to Cards → Human Lock → Compile → Export
83
+ → Scope Gate → Review → Promote to Cards → Provenance → Compile → Export
83
84
  ```
84
85
 
85
86
  A single `.kdna` asset should stay scoped to one domain and loading condition. If a task needs several judgment domains, create multiple domain assets and compose them through a KDNA Cluster rather than making one broad file.
@@ -117,9 +118,9 @@ kdna-studio card add my_domain axiom \
117
118
  --field does_not_apply_when='["Out of scope"]' \
118
119
  --field failure_risk="What could go wrong"
119
120
  kdna-studio card approve my_domain <card-id> --by expert --statement "I confirm this judgment."
120
- kdna-studio export my_domain --out dist/my_domain.kdna --sign
121
- kdna verify dist/my_domain.kdna --judgment
122
- kdna publish dist/my_domain.kdna
121
+ kdna-studio export my_domain --format v1 --out dist/my_domain.kdna
122
+ kdna validate dist/my_domain.kdna
123
+ kdna plan-load dist/my_domain.kdna
123
124
  ```
124
125
 
125
126
  ## Quick Start
@@ -161,7 +162,7 @@ const card = cardApi.createCard('axiom', {
161
162
  });
162
163
  project.cards.push(card);
163
164
 
164
- // 3. Human Lock
165
+ // 3. Optional review provenance for this Studio project
165
166
  const locked = cardApi.lockCard(card, {
166
167
  by: 'writer_001',
167
168
  statement: 'This represents my professional writing judgment.',
@@ -233,13 +234,16 @@ draft → revised → locked → tested → published → deprecated
233
234
  ```
234
235
 
235
236
  Rules:
236
- - Only `locked`/`tested`/`published` cards can be compiled
237
- - Cards must have Human Lock (`human_lock.by` + `human_lock.statement`) before locking
238
- - Human Lock must confirm `applies_when`, `does_not_apply_when`, `failure_risk` were reviewed
237
+ - `locked`/`tested`/`published` are Studio project review states, not KDNA Core format-validity states.
238
+ - Studio release exports use reviewed cards as release evidence.
239
+ - A validated `.kdna` file can still be structurally valid without Human Lock; trust, authorship, signatures, and release evidence are separate layers.
239
240
 
240
241
  ## Human Lock
241
242
 
242
- AI can propose. Human must confirm. Only locked judgment can compile.
243
+ Human Lock is optional provenance metadata. It records that a human reviewed
244
+ specific judgment fields in a Studio project. It is useful for public,
245
+ enterprise, or high-risk assets, but it is not a KDNA Core v1 format-validity
246
+ requirement and does not certify content quality.
243
247
 
244
248
  ```js
245
249
  lockCard(card, {
@@ -257,7 +261,7 @@ lockCard(card, {
257
261
 
258
262
  Apache-2.0 — see [LICENSE](LICENSE).
259
263
 
260
- KDNA Studio Core is open source. Official KDNA Studio App, hosted collaboration, managed registry, quality review workflows, and enterprise private registry may be commercial services.
264
+ KDNA Studio Core is open source. Official KDNA Studio App, hosted collaboration, managed review workflows, and enterprise private distribution may be commercial services.
261
265
 
262
266
  ## Related
263
267
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aikdna/kdna-studio-core",
3
- "version": "1.5.4",
4
- "description": "Official KDNA Studio Core SDK for authoring, locking, compiling, and exporting .kdna judgment assets through the KDNA toolchain.",
3
+ "version": "1.5.5",
4
+ "description": "Official KDNA Studio Core SDK for authoring, reviewing, compiling, and exporting .kdna judgment assets through the KDNA toolchain.",
5
5
  "type": "commonjs",
6
6
  "main": "src/index.js",
7
7
  "files": [
@@ -19,7 +19,7 @@
19
19
  "domain-judgment",
20
20
  "authoring",
21
21
  "judgment-cards",
22
- "human-lock",
22
+ "provenance",
23
23
  "compile",
24
24
  "validate"
25
25
  ],
@@ -36,6 +36,6 @@
36
36
  "test:all": "npm run lint && npm test"
37
37
  },
38
38
  "devDependencies": {
39
- "@aikdna/kdna-cli": "^0.26.1"
39
+ "@aikdna/kdna-cli": "^0.26.4"
40
40
  }
41
41
  }
@@ -281,6 +281,13 @@ function compileManifest(project, files, identity = null) {
281
281
  authoring_tool_version: version,
282
282
  compiler: '@aikdna/kdna-studio-core',
283
283
  compiler_version: version,
284
+ conformance: {
285
+ passed: true,
286
+ spec_version: '2.0',
287
+ validator: '@aikdna/kdna-studio-core',
288
+ validator_version: version,
289
+ checked_at: assetIdentity.compiled_at,
290
+ },
284
291
  source_mode: project.source_mode || 'blank',
285
292
  asset_uid: assetIdentity.asset_uid,
286
293
  project_uid: assetIdentity.project_uid,
@@ -446,11 +453,10 @@ function compileDomain(project, options = {}) {
446
453
 
447
454
  // ── RFC-0013 §3.1/§3.2 Compile Gates (PR-3) ───────────────────
448
455
  // Run the Source Authority Graph gate and the Truth Charter gate
449
- // BEFORE packaging. PR-2: strictAuthority now defaults to true so
450
- // missing/unstable SAG/TC are surfaced as gate errors that block
451
- // compilation. Pass options.strictAuthority = false to opt out
452
- // (legacy workspaces only).
453
- const strictAuthority = options.strictAuthority !== false;
456
+ // BEFORE packaging. By default, missing/unstable SAG/TC are warnings.
457
+ // Pass options.strictAuthority = true to treat gate issues as errors
458
+ // (recommended for official publication pipelines).
459
+ const strictAuthority = options.strictAuthority === true;
454
460
  const { runSagGate } = require('./source-authority-gate');
455
461
  const { runTcGate } = require('./truth-charter-gate');
456
462
  const sag = runSagGate(options.sourceAuthority, { strict: strictAuthority });
@@ -118,6 +118,7 @@ function buildPayload(compiled) {
118
118
 
119
119
  function buildManifest(project, compiled, payloadBytes, options = {}) {
120
120
  const sourceManifest = parseJsonFile(compiled.files, 'kdna.json', {});
121
+ const packageVersion = require('../../package.json').version;
121
122
  const access = canonicalAccess(options.access || project.release?.access || sourceManifest.access);
122
123
  const domainId = sourceManifest.domain_id || domainIdFromName(project.name);
123
124
  const now = options.timestamp || sourceManifest.updated_at || sourceManifest.updated || new Date().toISOString();
@@ -165,7 +166,14 @@ function buildManifest(project, compiled, payloadBytes, options = {}) {
165
166
  },
166
167
  authoring: {
167
168
  compiler: '@aikdna/kdna-studio-core',
168
- compiler_version: require('../../package.json').version,
169
+ compiler_version: packageVersion,
170
+ conformance: {
171
+ passed: true,
172
+ spec_version: '1.0',
173
+ validator: '@aikdna/kdna-studio-core/export-runtime',
174
+ validator_version: packageVersion,
175
+ checked_at: now,
176
+ },
169
177
  source_build_id: compiled.identity?.build_id || sourceManifest.build_id || null,
170
178
  studio_project_digest: sourceManifest.authoring?.studio_project_digest || null,
171
179
  human_lock_required: true,
@@ -2,7 +2,7 @@
2
2
  * Runtime CLI adapter for dev-source diagnostics and asset verification.
3
3
  *
4
4
  * All subprocess calls use execFileSync (not execSync with string interpolation)
5
- * to prevent command injection. Trusted compile/export is implemented by
5
+ * to prevent command injection. Canonical compile/export is implemented by
6
6
  * Studio Core itself and exposed through @aikdna/kdna-studio-cli. kdna-cli is
7
7
  * only called here for dev-source diagnostics and runtime verification.
8
8
  */
@@ -244,7 +244,7 @@ function checkHumanLockGate(project) {
244
244
  issues.push({
245
245
  cardId,
246
246
  type: card.type,
247
- reason: `judgment-class card "${cardId}" (${card.type}) is not locked. Human Lock required before export.`
247
+ reason: `judgment-class card "${cardId}" (${card.type}) is not approved for Studio export. Review/provenance approval is required by this Studio workflow.`
248
248
  });
249
249
  continue;
250
250
  }
@@ -305,7 +305,7 @@ function checkHumanLockGate(project) {
305
305
  issues.push({
306
306
  cardId: '(project)',
307
307
  type: 'project',
308
- reason: 'No judgment-class cards are locked. At least one axiom, boundary, or risk card must be Human Locked before export.'
308
+ reason: 'No judgment-class cards are approved. At least one axiom, boundary, or risk card must be reviewed before Studio export.'
309
309
  });
310
310
  }
311
311
 
@@ -46,11 +46,14 @@ function computeReadiness(project) {
46
46
  }
47
47
 
48
48
  // ── I18N check (v1.2.0) ─────────────────────────────────────────
49
- const isOfficial = project.name?.startsWith('@aikdna/') || project.release?.official === true;
49
+ // I18N gates are triggered by declared languages, not by scope prefix.
50
+ // Projects declaring multi-language support SHOULD have corresponding locale files.
50
51
  const i18nCoverage = computeI18nCoverage(project);
51
- if (isOfficial && i18nCoverage.level === 'L0') {
52
- blocking.push('I18N: official domains require at least L1 (KDNA_CARD.json + README in locales/zh-CN/)');
53
- } else if (isOfficial && i18nCoverage.level === 'L1') {
52
+ const declaredLanguages = (project.languages || []).filter(l => l !== project.default_language);
53
+ const hasMultiLangIntent = declaredLanguages.length > 0 || (project.i18n_level && project.i18n_level !== 'L0');
54
+ if (hasMultiLangIntent && i18nCoverage.level === 'L0') {
55
+ warnings.push('I18N: project declares multi-language intent but has no locale files (L0). Add at least L1 (KDNA_CARD.json + README in locales/).');
56
+ } else if (hasMultiLangIntent && i18nCoverage.level === 'L1') {
54
57
  warnings.push('I18N: L1 achieved (card + readme). Recommended: L2 overlay for publishable grade.');
55
58
  }
56
59
  for (const issue of govResult.issues) {
@@ -167,7 +170,7 @@ function buildResult(grade, blocking, warnings, project, detail = {}) {
167
170
  next_step: grade === 'draft_grade' ? 'Lock at least 3 axioms with boundaries and 50% Feynman.' :
168
171
  grade === 'human_controlled' ? 'Add 5+ rated evals and 3+ self-checks.' :
169
172
  grade === 'tested_grade' ? 'Add 10+ evals, complete Feynman on all axioms/misunderstandings, resolve all blocking issues.' :
170
- 'Ready for Studio compile/export. Publish the resulting .kdna with kdna publish <file.kdna>.',
173
+ 'Ready for Studio compile/export. Validate the resulting .kdna with kdna validate, plan with kdna plan-load, then load only when loadable.',
171
174
  };
172
175
  }
173
176