@okfit/core 0.2.0 → 0.3.1

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/Generated.js CHANGED
@@ -3,17 +3,26 @@ import { Timestamp } from "./Timestamp.js";
3
3
  import { Schema } from "effect";
4
4
 
5
5
  //#region src/Generated.ts
6
+ const SHA256_HEX_RE = /^[0-9a-f]{64}$/;
7
+ /**
8
+ * A lowercase 64-character hex sha256 digest of a concept's body, as `@okfit/profiles`'
9
+ * `Derivation.bodyDigest` computes it (issue #19). Optional: every concept stamped before
10
+ * this field existed lacks it, and core itself never computes one -- it only holds the field.
11
+ * @public
12
+ */
13
+ const BodySha256 = Schema.String.pipe(Schema.check(Schema.isPattern(SHA256_HEX_RE, { message: "Expected a lowercase 64-character hex sha256 digest" })));
6
14
  /**
7
15
  * Who last generated a concept's content, and when.
8
16
  * @public
9
17
  */
10
18
  var Generated = class extends Schema.Class("Generated")({
11
19
  by: Actor,
12
- at: Schema.optionalKey(Timestamp)
20
+ at: Schema.optionalKey(Timestamp),
21
+ body_sha256: Schema.optionalKey(BodySha256)
13
22
  }) {
14
23
  /** The `by` used when a legacy v0.1 `timestamp` is folded into `generated.at` (D-15); v0.1 has no actor. */
15
24
  static LEGACY_BY = "process:legacy-timestamp";
16
25
  };
17
26
 
18
27
  //#endregion
19
- export { Generated };
28
+ export { BodySha256, Generated };
package/OkfitConfig.js CHANGED
@@ -73,7 +73,7 @@ const StaleAfterDuration = Schema.annotateEncoded({
73
73
  "12h"
74
74
  ]
75
75
  })(Schema.String.pipe(Schema.check(Schema.isPattern(STALE_AFTER_PATTERN_RE, { message: "expected \"<n>h\", \"<n>d\", \"<n>w\" or \"<n> <unit>\"" })), Schema.decodeTo(Schema.Duration, {
76
- decode: SchemaGetter.transformOrFail((input, options) => Option.match(parseStaleAfter(input), {
76
+ decode: SchemaGetter.transformEffect((input, options) => Option.match(parseStaleAfter(input), {
77
77
  onNone: () => Effect.fail(new SchemaIssue.InvalidValue({ message: `expected "<n>h", "<n>d", "<n>w" or "<n> <unit>", got ${JSON.stringify(input)}` }, input, options)),
78
78
  onSome: Effect.succeed
79
79
  })),
@@ -202,8 +202,8 @@ const LintTable = Schema.Struct({
202
202
  })),
203
203
  generated_at_drift: Schema.optionalKey(LintLevel.annotate({
204
204
  title: "generated-at-drift",
205
- description: "A committed concept's generated.at is missing or does not match its last body-changing commit. Default \"info\".",
206
- default: "info"
205
+ description: "A committed concept's generated.at is missing or does not match its last body-changing commit, and is not otherwise authoritative (issue #19: a stamp recorded during the unchanged-body run survives a squash/rebase merge). Default \"warn\".",
206
+ default: "warn"
207
207
  }))
208
208
  }).annotate({
209
209
  title: "Lint severities",
@@ -392,7 +392,7 @@ const DEFAULT_LINT = {
392
392
  config_unknown_key: "warn",
393
393
  stale: "info",
394
394
  walk_unreadable: "warn",
395
- generated_at_drift: "info"
395
+ generated_at_drift: "warn"
396
396
  };
397
397
  const toSeverity = (level) => level === "warn" ? "warning" : level;
398
398
  const severityFor = (config, code) => {
package/README.md CHANGED
@@ -23,7 +23,7 @@ const program = Effect.gen(function* () {
23
23
  });
24
24
  ```
25
25
 
26
- `Bundle.load` needs `FileSystem` and `Path`; `OkfitConfig.read` needs `FileSystem`. Loading never fails on content: bad files become `Diagnostic`s. `Graph.fromBundle` treats a path-valued field or link whose target, resolved from its concept's directory, lands outside the bundle root as an external reference: no graph node and no `broken-links` diagnostic, exactly like a URL. `OkfitConfig` decodes the spec 4.2 TOML shape; unknown top-level keys are kept in `extensions` and reported by `Validate.lint` as `config-unknown-key`. `lifecycle.default_stale_after` accepts `90d`, `12h`, `2w`, or `"90 days"`. `OkfitConfig.merge` deep-merges tables; arrays and scalars in `override` replace wholesale. Apply `DEFAULTS < profile < file` yourself. `OkfitConfigFile` is the service tag; the CLI provides its layer. `okfitConfigDocumentFields` is `okfitConfigFields` minus `extensions` (wire bookkeeping no human writes), with an open rest so unknown top-level keys stay permitted while every declared table stays closed; it is the single source `lib/scripts/generate-schema.ts` builds the published JSON Schema (`schemas/config/okfit-1.0.0.json`) from, and carries no annotations of its own beyond what each field already declares in `OkfitConfig.ts`. The `[lint]` table's sixteen keys include `generated_at_drift` (default `"info"`), which fires when a committed concept's `generated.at` no longer matches the instant its body was last changed — computed by `okfit sync`/`okfit validate`, never by core itself.
26
+ `Bundle.load` needs `FileSystem` and `Path`; `OkfitConfig.read` needs `FileSystem`. Loading never fails on content: bad files become `Diagnostic`s. `Graph.fromBundle` treats a path-valued field or link whose target, resolved from its concept's directory, lands outside the bundle root as an external reference: no graph node and no `broken-links` diagnostic, exactly like a URL. `OkfitConfig` decodes the spec 4.2 TOML shape; unknown top-level keys are kept in `extensions` and reported by `Validate.lint` as `config-unknown-key`. `lifecycle.default_stale_after` accepts `90d`, `12h`, `2w`, or `"90 days"`. `OkfitConfig.merge` deep-merges tables; arrays and scalars in `override` replace wholesale. Apply `DEFAULTS < profile < file` yourself. `OkfitConfigFile` is the service tag; the CLI provides its layer. `okfitConfigDocumentFields` is `okfitConfigFields` minus `extensions` (wire bookkeeping no human writes), with an open rest so unknown top-level keys stay permitted while every declared table stays closed; it is the single source `lib/scripts/generate-schema.ts` builds the published JSON Schema (`schemas/config/okfit-1.0.0.json`) from, and carries no annotations of its own beyond what each field already declares in `OkfitConfig.ts`. The `[lint]` table's sixteen keys include `generated_at_drift` (default `"warn"`), which fires when a committed concept's `generated.at` no longer matches the instant its body was last changed AND is not otherwise authoritative (issue #19: a stamp recorded during the unchanged-body run survives a squash/rebase merge) — computed by `okfit sync`/`okfit validate`, never by core itself.
27
27
 
28
28
  ## License
29
29
 
package/index.d.ts CHANGED
@@ -65,12 +65,25 @@ declare const AttestedComputation_base: Schema.Class<AttestedComputation, Schema
65
65
  export declare class AttestedComputation extends AttestedComputation_base {}
66
66
  //#endregion
67
67
  //#region src/Generated.d.ts
68
+ /**
69
+ * A lowercase 64-character hex sha256 digest of a concept's body, as `@okfit/profiles`'
70
+ * `Derivation.bodyDigest` computes it (issue #19). Optional: every concept stamped before
71
+ * this field existed lacks it, and core itself never computes one -- it only holds the field.
72
+ * @public
73
+ */
74
+ export declare const BodySha256: Schema.String;
75
+ /**
76
+ * The type of {@link (BodySha256:variable)}.
77
+ * @public
78
+ */
79
+ export type BodySha256 = typeof BodySha256.Type;
68
80
  declare const Generated_base: Schema.Class<Generated, Schema.Struct<{
69
81
  readonly by: Schema.Codec<Actor, string, never, never> & {
70
82
  readonly isHuman: (actor: string) => boolean;
71
83
  readonly form: (actor: string) => ActorForm;
72
84
  };
73
85
  readonly at: Schema.optionalKey<Schema.Codec<import("effect/DateTime").Utc, string, never, never>>;
86
+ readonly body_sha256: Schema.optionalKey<Schema.String>;
74
87
  }>, {}>;
75
88
  /**
76
89
  * Who last generated a concept's content, and when.
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Actor } from "./Actor.js";
2
2
  import { AttestedComputation, ComputationAttester, ComputationExecutor, ComputationParameter } from "./AttestedComputation.js";
3
3
  import { Timestamp } from "./Timestamp.js";
4
- import { Generated } from "./Generated.js";
4
+ import { BodySha256, Generated } from "./Generated.js";
5
5
  import { Source, UsageWindow } from "./Source.js";
6
6
  import { Status } from "./Status.js";
7
7
  import { Verification } from "./Verification.js";
@@ -25,4 +25,4 @@ import { Validate } from "./Validate.js";
25
25
  const OKF_SPEC_VERSION = "0.2";
26
26
 
27
27
  //#endregion
28
- export { ATTESTED_COMPUTATION_TYPE, Actor, AttestedComputation, Bundle, BundleDepthExceededError, BundleReadError, BundleRootNotFoundError, ComputationAttester, ComputationExecutor, ComputationParameter, Concept, ConceptId, ConformanceCode, Derive, Diagnostic, DiagnosticCode, DiagnosticRange, DiagnosticSeverity, FieldDeclaration, Generated, Graph, GraphNodeKind, IndexDocument, IndexEntry, IndexSection, LinkGraph, LintCode, LintLevel, LintTable, LoadedBundle, LoadedConcept, LogDocument, LogGroup, LogItem, OKF_SPEC_VERSION, OkfitConfig, OkfitConfigFile, Source, StaleAfterDuration, Staleness, Status, TagDeclaration, Timestamp, TrustTier, TypeDeclaration, UsageWindow, Validate, Verification, okfitConfigDocumentFields };
28
+ export { ATTESTED_COMPUTATION_TYPE, Actor, AttestedComputation, BodySha256, Bundle, BundleDepthExceededError, BundleReadError, BundleRootNotFoundError, ComputationAttester, ComputationExecutor, ComputationParameter, Concept, ConceptId, ConformanceCode, Derive, Diagnostic, DiagnosticCode, DiagnosticRange, DiagnosticSeverity, FieldDeclaration, Generated, Graph, GraphNodeKind, IndexDocument, IndexEntry, IndexSection, LinkGraph, LintCode, LintLevel, LintTable, LoadedBundle, LoadedConcept, LogDocument, LogGroup, LogItem, OKF_SPEC_VERSION, OkfitConfig, OkfitConfigFile, Source, StaleAfterDuration, Staleness, Status, TagDeclaration, Timestamp, TrustTier, TypeDeclaration, UsageWindow, Validate, Verification, okfitConfigDocumentFields };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okfit/core",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "private": false,
5
5
  "description": "Spec-level Open Knowledge Format (OKF) v0.2 schemas, bundle loading, graph, derivation, and validation for Effect.",
6
6
  "keywords": [
@@ -37,14 +37,14 @@
37
37
  "./package.json": "./package.json"
38
38
  },
39
39
  "peerDependencies": {
40
- "@effected/config-file": "^0.7.0",
41
- "@effected/glob": "^0.5.0",
42
- "@effected/jsonc": "^0.9.0",
43
- "@effected/markdown": "^0.9.0",
44
- "@effected/toml": "^0.6.0",
45
- "@effected/walker": "^0.7.0",
46
- "@effected/yaml": "^0.14.0",
47
- "effect": "4.0.0-rc.112"
40
+ "@effected/config-file": "^0.8.0",
41
+ "@effected/glob": "^0.6.0",
42
+ "@effected/jsonc": "^0.11.0",
43
+ "@effected/markdown": "^0.10.0",
44
+ "@effected/toml": "^0.7.0",
45
+ "@effected/walker": "^0.8.0",
46
+ "@effected/yaml": "^0.15.0",
47
+ "effect": "4.0.0-rc.115"
48
48
  },
49
49
  "engines": {
50
50
  "node": ">=24.11.0"
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.59.0"
8
+ "packageVersion": "7.59.1"
9
9
  }
10
10
  ]
11
11
  }