@equationalapplications/core-llm-wiki 5.3.1 → 5.4.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 CHANGED
@@ -998,6 +998,30 @@ The flowchart shows:
998
998
  | [@equationalapplications/core-okf](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/okf/README.md) | Zero-dependency Open Knowledge Format (OKF) v0.1 primitives — parse and produce interoperable knowledge bundles. |
999
999
  | [@equationalapplications/schema-org-llm-wiki](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/schema-org/README.md) | Curated schema.org warm-agent ontology manifest |
1000
1000
 
1001
+ ## OKF v0.2 conformance (llm-wiki/2)
1002
+
1003
+ `formatOkfBundle` defaults to `okf_version: 0.2` + `profile: llm-wiki/2`. To force a v0.1 export, pass `{ profile: 'llm-wiki/1' }`:
1004
+
1005
+ ```ts
1006
+ formatOkfBundle(dump, { profile: 'llm-wiki/1' });
1007
+ ```
1008
+
1009
+ `parseOkfBundle` auto-detects the profile from the root index frontmatter:
1010
+
1011
+ - `profile === 'llm-wiki/2'` → v0.2 path (new fields populated).
1012
+ - `profile === 'llm-wiki/1'` → v0.1 path (unchanged behavior).
1013
+ - `profile === undefined && okf_version === '0.1'` → v0.1 legacy path.
1014
+ - `profile === undefined && okf_version === undefined` → profile-0 (legacy) path.
1015
+
1016
+ New public methods on `WikiMemory` for OKF v0.2 trust/provenance writes (each DAO method omits `updated_at` from its SQL):
1017
+
1018
+ - `writeOkfTrust(entryId, entityId, verified)`
1019
+ - `writeOkfSources(entryId, entityId, sources)`
1020
+ - `setLifecycleStatus(entryId, entityId, status)`
1021
+ - `setStaleAfter(entryId, entityId, date | null)`
1022
+ - `setGeneratedBy(entryId, entityId, actor)`
1023
+ - (and `…Task` variants of all five)
1024
+
1001
1025
  ## License
1002
1026
 
1003
1027
  MIT
@@ -1,4 +1,5 @@
1
1
  import MiniSearch from 'minisearch';
2
+ import { latestVerified } from '@equationalapplications/core-okf';
2
3
 
3
4
  var __typeError = (msg) => {
4
5
  throw TypeError(msg);
@@ -2686,8 +2687,6 @@ var MaintenanceService = class {
2686
2687
  return sanitizeRankerError(err, this.options.sanitizeRankerErrors);
2687
2688
  }
2688
2689
  };
2689
-
2690
- // src/services/ImportExportService.ts
2691
2690
  var MAX_EMBEDDING_BLOB_BYTES = 32 * 1024;
2692
2691
  var IMPORT_TITLE_MAX = 500;
2693
2692
  var IMPORT_BODY_MAX = 8e3;
@@ -2907,7 +2906,23 @@ var ImportExportService = class {
2907
2906
  access_count: fact.access_count,
2908
2907
  deleted_at: fact.deleted_at,
2909
2908
  embedding_blob: blobData ?? void 0,
2910
- okf_type: fact.okf_type ?? null
2909
+ okf_type: fact.okf_type ?? null,
2910
+ // OKF v0.2 — forwarded as-is; parseOkfBundle / the caller is responsible for
2911
+ // populating these per spec, importDump does not derive or validate them.
2912
+ lifecycle_status: fact.lifecycle_status ?? "stable",
2913
+ stale_after: fact.stale_after ?? null,
2914
+ generated_by: fact.generated_by ?? null,
2915
+ okf_sources: fact.okf_sources ?? [],
2916
+ okf_verified: fact.okf_verified ?? [],
2917
+ okf_usage_window: fact.okf_usage_window ?? null,
2918
+ // last_verified_at/_by are DERIVED mirrors of `okf_verified` per spec
2919
+ // §5.3. Recomputing here (instead of trusting the payload field) closes
2920
+ // the invariant that a raw importDump cannot carry a
2921
+ // last_verified_by that contradicts its own okf_verified list.
2922
+ ...(() => {
2923
+ const latest = latestVerified(fact.okf_verified ?? [], Date.now());
2924
+ return { last_verified_at: latest?.at ?? null, last_verified_by: latest?.by ?? null };
2925
+ })()
2911
2926
  };
2912
2927
  await this.entryRepo.upsertForImport(factObj, tx);
2913
2928
  if (blobData != null) {
@@ -2957,7 +2972,19 @@ var ImportExportService = class {
2957
2972
  updated_at: safeUpdatedAt,
2958
2973
  resolved_at: task.resolved_at,
2959
2974
  deleted_at: task.deleted_at,
2960
- okf_type: task.okf_type ?? null
2975
+ okf_type: task.okf_type ?? null,
2976
+ // OKF v0.2
2977
+ lifecycle_status: task.lifecycle_status ?? "stable",
2978
+ stale_after: task.stale_after ?? null,
2979
+ generated_by: task.generated_by ?? null,
2980
+ okf_sources: task.okf_sources ?? [],
2981
+ okf_verified: task.okf_verified ?? [],
2982
+ okf_usage_window: task.okf_usage_window ?? null,
2983
+ // Derived mirrors — see fact branch above; same invariant.
2984
+ ...(() => {
2985
+ const latest = latestVerified(task.okf_verified ?? [], Date.now());
2986
+ return { last_verified_at: latest?.at ?? null, last_verified_by: latest?.by ?? null };
2987
+ })()
2961
2988
  },
2962
2989
  tx,
2963
2990
  safeUpdatedAt
@@ -3914,5 +3941,5 @@ var WriteService = class {
3914
3941
  };
3915
3942
 
3916
3943
  export { BaseRepository, DEFAULT_CHUNK_OVERLAP, DEFAULT_MAX_CHUNK_LENGTH, EmbeddingService, HEAL_BATCH_SIZE, HEAL_RECHECK_MS, HOOK_TIMEOUT_MARKER, ImportExportService, IngestionService, JobManager, MaintenanceService, MetadataRepository, ONTOLOGY_BACKFILL_BATCH_SIZE, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_RECHECK_MS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, PromptService, PrunePartialFailureError, RetrievalService, SearchService, WikiBusyError, WikiDuplicateHashError, WikiSourceRefHashCollision, WikiStrictOntologyViolation, WikiTransactionError, WriteService, __privateAdd, __privateGet, __privateSet, chunkText, configureRandomSource, emptyManifest, entitySummaryMetaKey, extractSqliteCode, generateId, normalizeSourceHash, normalizeSourceRef, normalizeTitleKey, parseEmbedding, resolveEdgeDefinitions, resolveNodeType, safeSlice, validateInlineEdges, validateManifest };
3917
- //# sourceMappingURL=chunk-KIJINNYU.mjs.map
3918
- //# sourceMappingURL=chunk-KIJINNYU.mjs.map
3944
+ //# sourceMappingURL=chunk-N2NXN6PO.mjs.map
3945
+ //# sourceMappingURL=chunk-N2NXN6PO.mjs.map