@okfit/engine 0.6.0 → 0.7.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/errors.js CHANGED
@@ -104,6 +104,40 @@ var ConfigMalformedError = class extends Schema.TaggedError()("ConfigMalformedEr
104
104
  return `malformed config ${this.path}: ${messageOf(this.cause)}`;
105
105
  }
106
106
  };
107
+ /**
108
+ * Issue #140: `sync --staged` stamps the git index with a caller-given
109
+ * instant instead of walking history, but a log group's date must come
110
+ * from a commit, never from that stamp time -- so `runSync` refuses to
111
+ * combine `staged` with log mode rather than write a fabricated date.
112
+ *
113
+ * @public
114
+ */
115
+ var SyncStagedLogError = class extends Schema.TaggedError()("SyncStagedLogError", {}) {
116
+ [Runtime.errorExitCode] = 64;
117
+ get message() {
118
+ return "--staged cannot run log mode: a log group's date must come from a commit, not from the stamp time; use --only generated and/or --only index";
119
+ }
120
+ };
121
+ /**
122
+ * Issue #138: `okfit verify`'s selection was contradictory or empty. Exit 64: a usage error.
123
+ *
124
+ * @public
125
+ */
126
+ var VerifySelectionError = class extends Schema.TaggedError()("VerifySelectionError", {
127
+ reason: Schema.Literals([
128
+ "no-selection",
129
+ "id-and-batch",
130
+ "unknown-type"
131
+ ]),
132
+ detail: Schema.optionalKey(Schema.String)
133
+ }) {
134
+ [Runtime.errorExitCode] = 64;
135
+ get message() {
136
+ if (this.reason === "no-selection") return "verify needs a concept id, --all, or --type <Type>";
137
+ if (this.reason === "id-and-batch") return "verify takes either a concept id or --all/--type, not both";
138
+ return `type "${this.detail ?? ""}" is not declared in the config`;
139
+ }
140
+ };
107
141
 
108
142
  //#endregion
109
- export { ConfigMalformedError, ConfigPathNotFoundError, InitOverwriteError, VerifyConceptNotFoundError, VerifyUnsupportedFrontmatterError };
143
+ export { ConfigMalformedError, ConfigPathNotFoundError, InitOverwriteError, SyncStagedLogError, VerifyConceptNotFoundError, VerifySelectionError, VerifyUnsupportedFrontmatterError };
package/index.d.ts CHANGED
@@ -1,10 +1,9 @@
1
- import { BundleLoadError, ConceptId, Diagnostic, DiagnosticRange, DiagnosticSeverity, GraphLink, GraphNode, LinkGraph, LoadedBundle, OkfitConfig, OkfitConfigFile, StaleConcept, ValidationReport } from "@okfit/core";
1
+ import { Actor, BundleLoadError, ConceptId, Diagnostic, DiagnosticRange, DiagnosticSeverity, GraphLink, GraphNode, LinkGraph, LoadedBundle, OkfitConfig, OkfitConfigFile, StaleConcept, ValidationReport } from "@okfit/core";
2
2
  import { Context, Crypto, DateTime, Effect, FileSystem, Layer, Option, Path, PlatformError, Runtime, Schema } from "effect";
3
3
  import { AppDirs, Xdg } from "@effected/xdg";
4
4
  import { ConfigReadError } from "@effected/config-file";
5
5
  import { GeneratedAtError, GitHistory, GitHistoryError, Layout, Profile, ProfileDiagnostic } from "@okfit/profiles";
6
6
  import { FrontmatterWriteError, MarkdownParseError } from "@effected/markdown";
7
- import { HostedSchema } from "@effected/schemastore";
8
7
  import * as NodeServices from "@effect/platform-node/NodeServices";
9
8
  import { Git, GitCommandError, UnknownRefError } from "@effected/git";
10
9
  //#region src/config/anchor.d.ts
@@ -157,6 +156,32 @@ export declare class ConfigMalformedError extends ConfigMalformedError_base {
157
156
  readonly [Runtime.errorExitCode] = 3;
158
157
  get message(): string;
159
158
  }
159
+ declare const SyncStagedLogError_base: Schema.Class<SyncStagedLogError, Schema.TaggedStruct<"SyncStagedLogError", {}>, import("effect/Cause").YieldableError>;
160
+ /**
161
+ * Issue #140: `sync --staged` stamps the git index with a caller-given
162
+ * instant instead of walking history, but a log group's date must come
163
+ * from a commit, never from that stamp time -- so `runSync` refuses to
164
+ * combine `staged` with log mode rather than write a fabricated date.
165
+ *
166
+ * @public
167
+ */
168
+ export declare class SyncStagedLogError extends SyncStagedLogError_base {
169
+ readonly [Runtime.errorExitCode] = 64;
170
+ get message(): string;
171
+ }
172
+ declare const VerifySelectionError_base: Schema.Class<VerifySelectionError, Schema.TaggedStruct<"VerifySelectionError", {
173
+ readonly reason: Schema.Literals<readonly ["no-selection", "id-and-batch", "unknown-type"]>;
174
+ readonly detail: Schema.optionalKey<Schema.String>;
175
+ }>, import("effect/Cause").YieldableError>;
176
+ /**
177
+ * Issue #138: `okfit verify`'s selection was contradictory or empty. Exit 64: a usage error.
178
+ *
179
+ * @public
180
+ */
181
+ export declare class VerifySelectionError extends VerifySelectionError_base {
182
+ readonly [Runtime.errorExitCode] = 64;
183
+ get message(): string;
184
+ }
160
185
  //#endregion
161
186
  //#region src/config/layer.d.ts
162
187
  /**
@@ -354,17 +379,6 @@ export declare const runGraph: (options: GraphRunOptions) => Effect.Effect<Graph
354
379
  //#region src/init/scaffold.d.ts
355
380
  /** `.config/okfit.toml`, relative to the project root (C-10). @public */
356
381
  export declare const CONFIG_RELATIVE_PATH = ".config/okfit.toml";
357
- /**
358
- * Where the published `config` JSON Schema document lives and which version
359
- * is current — the one identity `schemastore.config.ts` and `okfit init`'s
360
- * `#:schema` directive both derive from, so the URL a fresh config points at
361
- * and the one the generated document declares can never disagree (C-18).
362
- *
363
- * @public
364
- */
365
- export declare const okfitConfigSchemaHost: HostedSchema;
366
- /** C-22's directive, plus the blank line Tombi requires. @public */
367
- export declare const SCHEMA_DIRECTIVE: string;
368
382
  /** @public */
369
383
  interface ScaffoldOptions {
370
384
  /** Absolute. */
@@ -529,10 +543,15 @@ export type ContextTag = typeof ContextTag.Type;
529
543
  * consumer can tell "no profile configured" apart from "an unknown profile
530
544
  * was configured".
531
545
  *
546
+ * `config_schema_version` is `@okfit/core`'s `CONFIG_SCHEMA_VERSION`,
547
+ * stamped by {@link contextEnvelope} itself -- callers cannot pass or fake
548
+ * it (okfit #137).
549
+ *
532
550
  * @public
533
551
  */
534
552
  export declare const ContextEnvelope: Schema.Struct<{
535
553
  readonly schema: Schema.Literal<1>;
554
+ readonly config_schema_version: Schema.String;
536
555
  readonly project_root: Schema.String;
537
556
  readonly bundle_root: Schema.String;
538
557
  readonly config_path: Schema.NullOr<Schema.String>;
@@ -585,6 +604,29 @@ export declare const contextEnvelope: (input: {
585
604
  readonly config: OkfitConfig;
586
605
  }) => ContextEnvelope;
587
606
  //#endregion
607
+ //#region src/render/distribution.d.ts
608
+ /**
609
+ * The meta-package an okfit report's bins were installed through -- e.g.
610
+ * `@okfit/plugin` -- threaded into `main(options)` by that package's bin
611
+ * shims (okfit #137). `null` for a direct install of `@okfit/cli` or
612
+ * `@okfit/mcp`. This is packaging metadata, not a number to compare across
613
+ * reports; `engine_version` and `okf_version` are the pair a reader
614
+ * compares.
615
+ *
616
+ * @public
617
+ */
618
+ interface Distribution {
619
+ readonly name: string;
620
+ readonly version: string;
621
+ }
622
+ /** Every envelope's `distribution` field: a `Distribution` or `null`. @public */
623
+ export declare const DistributionField: Schema.NullOr<Schema.Struct<{
624
+ readonly name: Schema.String;
625
+ readonly version: Schema.String;
626
+ }>>;
627
+ /** @public */
628
+ export type DistributionField = typeof DistributionField.Type;
629
+ //#endregion
588
630
  //#region src/render/sort.d.ts
589
631
  /** Which producer a diagnostic came from; the JSON envelope's `source` (K-21). @public */
590
632
  type DiagnosticSource = "core.conformance" | "core.lint" | "profile";
@@ -690,7 +732,12 @@ export type GraphSummary = typeof GraphSummary.Type;
690
732
  export declare const GraphEnvelope: Schema.Struct<{
691
733
  readonly schema: Schema.Literal<1>;
692
734
  readonly okfit_version: Schema.String;
735
+ readonly engine_version: Schema.String;
693
736
  readonly producer: Schema.String;
737
+ readonly distribution: Schema.NullOr<Schema.Struct<{
738
+ readonly name: Schema.String;
739
+ readonly version: Schema.String;
740
+ }>>;
694
741
  readonly okf_version: Schema.String;
695
742
  readonly root: Schema.String;
696
743
  readonly profile: Schema.NullOr<Schema.String>;
@@ -726,6 +773,7 @@ export declare const graphEnvelope: (input: {
726
773
  readonly profile: string | null;
727
774
  readonly nodes: ReadonlyArray<GraphNode>;
728
775
  readonly edges: ReadonlyArray<GraphLink>;
776
+ readonly distribution?: Distribution;
729
777
  }) => GraphEnvelope;
730
778
  //#endregion
731
779
  //#region src/render/json.d.ts
@@ -754,18 +802,26 @@ export type JsonSummary = typeof JsonSummary.Type;
754
802
  /**
755
803
  * K-21's success envelope, snake_case. `exit_code` is `0 | 1 | 2` only: an
756
804
  * infrastructure failure never produces this envelope, it produces the
757
- * `JsonErrorEnvelope` (K-22). `okfit_version` names the version of the
758
- * package that produced the report (J-2), so the CLI and the MCP server
759
- * legitimately report different numbers over one bundle; `producer` names
760
- * that package (`okfit` or `@okfit/mcp`) so the difference reads as two
761
- * producers, not as drift (okfit #75).
805
+ * `JsonErrorEnvelope` (K-22). `okfit_version` and `producer` identify the
806
+ * PACKAGE that produced the report (J-2), so the CLI and the MCP server
807
+ * legitimately report different numbers over one bundle without that
808
+ * reading as drift (okfit #75); `engine_version` and `okf_version` are the
809
+ * pair that determines the report's content and the pair a reader should
810
+ * actually compare across two producers. `distribution` names the
811
+ * meta-package the bins were installed through (`@okfit/plugin`), or `null`
812
+ * for a direct install of `@okfit/cli`/`@okfit/mcp` (okfit #137).
762
813
  *
763
814
  * @public
764
815
  */
765
816
  export declare const JsonEnvelope: Schema.Struct<{
766
817
  readonly schema: Schema.Literal<1>;
767
818
  readonly okfit_version: Schema.String;
819
+ readonly engine_version: Schema.String;
768
820
  readonly producer: Schema.String;
821
+ readonly distribution: Schema.NullOr<Schema.Struct<{
822
+ readonly name: Schema.String;
823
+ readonly version: Schema.String;
824
+ }>>;
769
825
  readonly okf_version: Schema.String;
770
826
  readonly root: Schema.String;
771
827
  readonly profile: Schema.NullOr<Schema.String>;
@@ -789,11 +845,23 @@ export declare const JsonEnvelope: Schema.Struct<{
789
845
  }>;
790
846
  /** @public */
791
847
  export type JsonEnvelope = typeof JsonEnvelope.Type;
792
- /** K-22's envelope: the ONLY thing stdout carries under `--format json` on an exit-3 failure. @public */
848
+ /**
849
+ * K-22's envelope: the ONLY thing stdout carries under `--format json` on an
850
+ * infrastructure failure. `exit_code` is `3` for most errors, or `64` for the
851
+ * usage-tier errors (`SyncStagedLogError`, `VerifySelectionError`) that carry
852
+ * their own `[Runtime.errorExitCode]`.
853
+ *
854
+ * @public
855
+ */
793
856
  export declare const JsonErrorEnvelope: Schema.Struct<{
794
857
  readonly schema: Schema.Literal<1>;
795
858
  readonly okfit_version: Schema.String;
796
- readonly exit_code: Schema.Literal<3>;
859
+ readonly engine_version: Schema.String;
860
+ readonly distribution: Schema.NullOr<Schema.Struct<{
861
+ readonly name: Schema.String;
862
+ readonly version: Schema.String;
863
+ }>>;
864
+ readonly exit_code: Schema.Literals<readonly [3, 64]>;
797
865
  readonly error: Schema.Struct<{
798
866
  readonly tag: Schema.String;
799
867
  readonly message: Schema.String;
@@ -821,9 +889,10 @@ export declare const json: (input: {
821
889
  readonly exitCode: 0 | 1 | 2;
822
890
  readonly concepts: number;
823
891
  readonly diagnostics: ReadonlyArray<RenderedDiagnostic>;
892
+ readonly distribution?: Distribution;
824
893
  }) => JsonEnvelope;
825
894
  /** K-22. `tag` is the error's `_tag` when it has one, else its constructor name. @public */
826
- export declare const jsonError: (error: unknown, okfitVersion: string) => JsonErrorEnvelope;
895
+ export declare const jsonError: (error: unknown, okfitVersion: string, distribution?: Distribution) => JsonErrorEnvelope;
827
896
  //#endregion
828
897
  //#region src/render/stale.d.ts
829
898
  /** One entry of the `items` array. @public */
@@ -853,7 +922,12 @@ export type StaleSummary = typeof StaleSummary.Type;
853
922
  export declare const StaleEnvelope: Schema.Struct<{
854
923
  readonly schema: Schema.Literal<1>;
855
924
  readonly okfit_version: Schema.String;
925
+ readonly engine_version: Schema.String;
856
926
  readonly producer: Schema.String;
927
+ readonly distribution: Schema.NullOr<Schema.Struct<{
928
+ readonly name: Schema.String;
929
+ readonly version: Schema.String;
930
+ }>>;
857
931
  readonly okf_version: Schema.String;
858
932
  readonly root: Schema.String;
859
933
  readonly profile: Schema.NullOr<Schema.String>;
@@ -886,6 +960,7 @@ export declare const staleEnvelope: (input: {
886
960
  readonly now: DateTime.Utc;
887
961
  readonly concepts: number;
888
962
  readonly items: ReadonlyArray<StaleConcept>;
963
+ readonly distribution?: Distribution;
889
964
  }) => StaleEnvelope;
890
965
  //#endregion
891
966
  //#region src/sync/run.d.ts
@@ -905,11 +980,17 @@ export type SkipReason = typeof SkipReason.Type;
905
980
  interface SyncOptions {
906
981
  /** Absolute bundle root, from `resolveProjectConfig`. */
907
982
  readonly bundleRoot: string;
908
- /** Already merged `DEFAULTS < profile < file` by the caller (D-28); unused today (`sync` never calls `profile.check`) but carried for parity with `RunOptions`. */
983
+ /** Already merged `DEFAULTS < profile < file` by the caller (D-28). `actors.agent`, when set, is threaded into `syncGenerated` (issue #73) so a concept with no `generated` block gets one created; `sync` never calls `profile.check`. */
909
984
  readonly config: OkfitConfig;
910
985
  /** Members to actually RUN. Absent members still appear in {@link SyncResult}, `selected: false`. */
911
986
  readonly modes: ReadonlySet<SyncMode>;
912
987
  readonly dryRun: boolean;
988
+ /** Issue #18: log mode's inclusive floor (`YYYY-MM-DD`); default is the newest logged date. */
989
+ readonly logSince?: string;
990
+ /** Issue #140: stamp the concepts in the git index with this instant instead of walking history; log mode must not be selected. */
991
+ readonly staged?: {
992
+ readonly at: DateTime.Utc;
993
+ };
913
994
  }
914
995
  /** @public */
915
996
  interface SyncModeResult {
@@ -931,16 +1012,17 @@ interface SyncResult {
931
1012
  readonly log: SyncModeResult;
932
1013
  }
933
1014
  /**
934
- * Contract §5's six-step algorithm: one `Bundle.load`, one
935
- * `Derivation.generatedAt` per concept shared by the generated and log
936
- * modes (skipped entirely when neither is selected), then the three modes
937
- * in a FIXED order — generated, index, log — regardless of `--only`'s own
938
- * occurrence order, so a generated write never invalidates an index or log
939
- * rendered in the same run (design §2).
1015
+ * Contract §5's six-step algorithm: one `Bundle.load`, then a lazy
1016
+ * `Derivation.generatedAt` walk shared by the generated and log modes
1017
+ * (issue #21) — computed only for a concept that still needs one, not for
1018
+ * every concept — then the three modes in a FIXED order — generated,
1019
+ * index, log — regardless of `--only`'s own occurrence order, so a
1020
+ * generated write never invalidates an index or log rendered in the same
1021
+ * run (design §2).
940
1022
  *
941
1023
  * @public
942
1024
  */
943
- export declare const runSync: (options: SyncOptions) => Effect.Effect<SyncResult, BundleLoadError | GeneratedAtError, Git | GitHistory | FileSystem.FileSystem | Path.Path | Crypto.Crypto>;
1025
+ export declare const runSync: (options: SyncOptions) => Effect.Effect<SyncResult, BundleLoadError | GeneratedAtError | SyncStagedLogError, Git | GitHistory | FileSystem.FileSystem | Path.Path | Crypto.Crypto>;
944
1026
  //#endregion
945
1027
  //#region src/render/sync.d.ts
946
1028
  /** @public */
@@ -969,6 +1051,11 @@ export type SyncModeEnvelope = typeof SyncModeEnvelope.Type;
969
1051
  export declare const SyncEnvelope: Schema.Struct<{
970
1052
  readonly schema: Schema.Literal<1>;
971
1053
  readonly okfit_version: Schema.String;
1054
+ readonly engine_version: Schema.String;
1055
+ readonly distribution: Schema.NullOr<Schema.Struct<{
1056
+ readonly name: Schema.String;
1057
+ readonly version: Schema.String;
1058
+ }>>;
972
1059
  readonly root: Schema.String;
973
1060
  readonly dry_run: Schema.Boolean;
974
1061
  readonly exit_code: Schema.Literal<0>;
@@ -1014,6 +1101,7 @@ export declare const syncEnvelope: (input: {
1014
1101
  readonly root: string;
1015
1102
  readonly dryRun: boolean;
1016
1103
  readonly result: SyncResult;
1104
+ readonly distribution?: Distribution;
1017
1105
  }) => SyncEnvelope;
1018
1106
  //#endregion
1019
1107
  //#region src/render/verify.d.ts
@@ -1029,6 +1117,11 @@ export declare const syncEnvelope: (input: {
1029
1117
  export declare const VerifyEnvelope: Schema.Struct<{
1030
1118
  readonly schema: Schema.Literal<1>;
1031
1119
  readonly okfit_version: Schema.String;
1120
+ readonly engine_version: Schema.String;
1121
+ readonly distribution: Schema.NullOr<Schema.Struct<{
1122
+ readonly name: Schema.String;
1123
+ readonly version: Schema.String;
1124
+ }>>;
1032
1125
  readonly id: Schema.String;
1033
1126
  readonly path: Schema.String;
1034
1127
  readonly verified: Schema.Struct<{
@@ -1055,7 +1148,60 @@ export declare const verifyEnvelope: (input: {
1055
1148
  readonly by: string;
1056
1149
  readonly at: string;
1057
1150
  readonly dryRun: boolean;
1151
+ readonly distribution?: Distribution;
1058
1152
  }) => VerifyEnvelope;
1153
+ /**
1154
+ * Issue #138's batch success envelope, schema 1, the same snake_case
1155
+ * convention as `VerifyEnvelope`. `concepts` carries every concept
1156
+ * `okfit verify --all`/`--type` attested (or would attest under a dry run),
1157
+ * in write order; `skipped` carries every candidate it declined, with why.
1158
+ *
1159
+ * @public
1160
+ */
1161
+ export declare const VerifyBatchEnvelope: Schema.Struct<{
1162
+ readonly schema: Schema.Literal<1>;
1163
+ readonly okfit_version: Schema.String;
1164
+ readonly engine_version: Schema.String;
1165
+ readonly distribution: Schema.NullOr<Schema.Struct<{
1166
+ readonly name: Schema.String;
1167
+ readonly version: Schema.String;
1168
+ }>>;
1169
+ readonly verified_by: Schema.String;
1170
+ readonly verified_at: Schema.String;
1171
+ readonly concepts: Schema.$Array<Schema.Struct<{
1172
+ readonly id: Schema.String;
1173
+ readonly path: Schema.String;
1174
+ }>>;
1175
+ readonly skipped: Schema.$Array<Schema.Struct<{
1176
+ readonly id: Schema.String;
1177
+ readonly reason: Schema.Literals<readonly ["draft", "already-verified"]>;
1178
+ }>>;
1179
+ readonly dry_run: Schema.Boolean;
1180
+ readonly exit_code: Schema.Literal<0>;
1181
+ }>;
1182
+ /** @public */
1183
+ export type VerifyBatchEnvelope = typeof VerifyBatchEnvelope.Type;
1184
+ /**
1185
+ * `concepts[].path` is already the display form, the same convention
1186
+ * {@link verifyEnvelope} uses for its own `path`.
1187
+ *
1188
+ * @public
1189
+ */
1190
+ export declare const verifyBatchEnvelope: (input: {
1191
+ readonly okfitVersion: string;
1192
+ readonly by: string;
1193
+ readonly at: string;
1194
+ readonly concepts: ReadonlyArray<{
1195
+ readonly id: string;
1196
+ readonly path: string;
1197
+ }>;
1198
+ readonly skipped: ReadonlyArray<{
1199
+ readonly id: string;
1200
+ readonly reason: "draft" | "already-verified";
1201
+ }>;
1202
+ readonly dryRun: boolean;
1203
+ readonly distribution?: Distribution;
1204
+ }) => VerifyBatchEnvelope;
1059
1205
  //#endregion
1060
1206
  //#region src/stale/run.d.ts
1061
1207
  /** @public */
@@ -1190,6 +1336,51 @@ interface VerifyResult {
1190
1336
  /** The exact bytes `splice`'s edit would insert, written or not. */
1191
1337
  readonly fragment: string;
1192
1338
  }
1339
+ /**
1340
+ * Issue #138: options for {@link runVerifyBatch}. `types` restricts the
1341
+ * selected concept types; empty selects every type whose `config.types`
1342
+ * declaration sets `require_verified = true`.
1343
+ *
1344
+ * @public
1345
+ */
1346
+ interface VerifyBatchOptions {
1347
+ readonly bundleRoot: string;
1348
+ readonly projectRoot: string;
1349
+ readonly config: OkfitConfig;
1350
+ readonly at: DateTime.Utc;
1351
+ readonly dryRun: boolean;
1352
+ /** Restrict to these types; empty = every type with `require_verified = true`. */
1353
+ readonly types: ReadonlyArray<string>;
1354
+ }
1355
+ /**
1356
+ * Why {@link runVerifyBatch} skipped a candidate concept: `"draft"` for
1357
+ * `status === "draft"`, `"already-verified"` when the resolved actor already
1358
+ * carries a `verified` entry.
1359
+ *
1360
+ * @public
1361
+ */
1362
+ type VerifyBatchSkipReason = "draft" | "already-verified";
1363
+ /**
1364
+ * The result of {@link runVerifyBatch}.
1365
+ *
1366
+ * @public
1367
+ */
1368
+ interface VerifyBatchResult {
1369
+ readonly bundleRoot: string;
1370
+ readonly by: string;
1371
+ readonly at: string;
1372
+ readonly dryRun: boolean;
1373
+ /** In bundle iteration order; each carries the exact fragment written (or that would be). */
1374
+ readonly verified: ReadonlyArray<{
1375
+ readonly id: string;
1376
+ readonly conceptPath: string;
1377
+ readonly fragment: string;
1378
+ }>;
1379
+ readonly skipped: ReadonlyArray<{
1380
+ readonly id: string;
1381
+ readonly reason: VerifyBatchSkipReason;
1382
+ }>;
1383
+ }
1193
1384
  /**
1194
1385
  * Contract §2.3 steps 6–15. Loads the bundle, resolves the id, resolves the
1195
1386
  * human actor from git, splices exactly one entry into the concept's
@@ -1204,12 +1395,52 @@ export declare const runVerify: (options: VerifyOptions) => Effect.Effect<{
1204
1395
  id: ConceptId;
1205
1396
  bundleRoot: string;
1206
1397
  conceptPath: string;
1207
- by: import("@okfit/core").Actor;
1398
+ by: Actor;
1208
1399
  at: string;
1209
1400
  priorAt: string[];
1210
1401
  dryRun: boolean;
1211
1402
  fragment: string;
1212
1403
  }, import("effect/PlatformError").PlatformError | VerifyConceptNotFoundError | VerifyUnsupportedFrontmatterError | import("@effected/yaml").YamlParseError | import("@okfit/core").BundleLoadError | import("@okfit/profiles").GeneratedByError, FileSystem.FileSystem | import("@effected/git").Git | Path.Path>;
1404
+ /**
1405
+ * Issue #138. Attests every concept selected by `options.types` (or, when
1406
+ * empty, every type whose declaration sets `require_verified = true`) that
1407
+ * is not a draft and does not already carry a `verified` entry by the
1408
+ * resolved actor. Every candidate is located FIRST -- an unsupported
1409
+ * `verified` shape on any one of them fails the whole batch with nothing
1410
+ * written, mirroring `runVerify`'s own fail-closed rule at batch scale.
1411
+ *
1412
+ * @public
1413
+ */
1414
+ export declare const runVerifyBatch: (options: VerifyBatchOptions) => Effect.Effect<{
1415
+ bundleRoot: string;
1416
+ by: Actor;
1417
+ at: string;
1418
+ dryRun: boolean;
1419
+ verified: {
1420
+ id: string;
1421
+ conceptPath: string;
1422
+ fragment: string;
1423
+ }[];
1424
+ skipped: {
1425
+ readonly id: string;
1426
+ readonly reason: VerifyBatchSkipReason;
1427
+ }[];
1428
+ }, import("effect/PlatformError").PlatformError | VerifySelectionError | VerifyUnsupportedFrontmatterError | import("@effected/yaml").YamlParseError | import("@okfit/core").BundleLoadError | import("@okfit/profiles").GeneratedByError, FileSystem.FileSystem | import("@effected/git").Git | Path.Path>;
1429
+ //#endregion
1430
+ //#region src/version.d.ts
1431
+ /**
1432
+ * The version this engine reports as `engine_version` in every JSON
1433
+ * envelope. `@savvy-web/bundler` replaces `process.env.__PACKAGE_VERSION__`
1434
+ * with this package's own version at build time (K-32), so a release can
1435
+ * never desync from the printed version. `"0.0.0"` is the unbuilt-source
1436
+ * fallback and reads as dev mode. This is the ONE `process` read this
1437
+ * package's own `boundaries.test.ts` allowlists — see that file and this
1438
+ * package's `CLAUDE.md` for why it is safe here even though every other
1439
+ * `process` read is forbidden.
1440
+ *
1441
+ * @public
1442
+ */
1443
+ export declare const ENGINE_VERSION: string;
1213
1444
  //#endregion
1214
- export type { ContextResult, ContextRunOptions, DiagnosticSource, DiscoveredConfig, GraphRunOptions, GraphRunResult, RenderedDiagnostic, ResolveProjectConfigInput, ResolvedProjectConfig, RunOptions, RunResult, ScaffoldFile, ScaffoldOptions, StaleRunOptions, StaleRunResult, SyncMode, SyncModeResult, SyncOptions, SyncResult, Tally, VerifyOptions, VerifyResult };
1445
+ export type { ContextResult, ContextRunOptions, DiagnosticSource, DiscoveredConfig, Distribution, GraphRunOptions, GraphRunResult, RenderedDiagnostic, ResolveProjectConfigInput, ResolvedProjectConfig, RunOptions, RunResult, ScaffoldFile, ScaffoldOptions, StaleRunOptions, StaleRunResult, SyncMode, SyncModeResult, SyncOptions, SyncResult, Tally, VerifyBatchOptions, VerifyBatchResult, VerifyBatchSkipReason, VerifyOptions, VerifyResult };
1215
1446
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -1,22 +1,24 @@
1
1
  import { resolveBundleRoot, resolveProjectRoot } from "./config/anchor.js";
2
- import { ConfigMalformedError, ConfigPathNotFoundError, InitOverwriteError, VerifyConceptNotFoundError, VerifyUnsupportedFrontmatterError } from "./errors.js";
2
+ import { ConfigMalformedError, ConfigPathNotFoundError, InitOverwriteError, SyncStagedLogError, VerifyConceptNotFoundError, VerifySelectionError, VerifyUnsupportedFrontmatterError } from "./errors.js";
3
3
  import { buildConfigLayer, provideConfig } from "./config/layer.js";
4
4
  import { DEFAULT_PROFILE_NAME, resolveProjectConfig } from "./config/resolve.js";
5
5
  import { runContext } from "./context/run.js";
6
6
  import { runGraph } from "./graph/run.js";
7
- import { CONFIG_RELATIVE_PATH, SCHEMA_DIRECTIVE, configValue, files, okfitConfigSchemaHost, targetPaths } from "./init/scaffold.js";
7
+ import { CONFIG_RELATIVE_PATH, configValue, files, targetPaths } from "./init/scaffold.js";
8
8
  import { OkfitPlatform } from "./platform.js";
9
9
  import { ContextEnvelope, ContextField, ContextFieldValue, ContextTag, ContextType, contextEnvelope } from "./render/context.js";
10
+ import { DistributionField } from "./render/distribution.js";
10
11
  import { forDiagnostics, tally } from "./render/exit.js";
12
+ import { ENGINE_VERSION } from "./version.js";
11
13
  import { GraphEdgeEnvelope, GraphEnvelope, GraphNodeEnvelope, GraphSummary, graphEnvelope } from "./render/graph.js";
12
14
  import { collect, sort } from "./render/sort.js";
13
15
  import { JsonDiagnostic, JsonEnvelope, JsonErrorEnvelope, JsonSummary, json, jsonError } from "./render/json.js";
14
16
  import { StaleEnvelope, StaleItem, StaleSummary, staleEnvelope } from "./render/stale.js";
15
17
  import { SkipReason, runSync } from "./sync/run.js";
16
18
  import { SyncEnvelope, SyncModeEnvelope, syncEnvelope } from "./render/sync.js";
17
- import { VerifyEnvelope, verifyEnvelope } from "./render/verify.js";
19
+ import { VerifyBatchEnvelope, VerifyEnvelope, verifyBatchEnvelope, verifyEnvelope } from "./render/verify.js";
18
20
  import { runStale } from "./stale/run.js";
19
21
  import { Now, run } from "./validate/run.js";
20
- import { runVerify } from "./verify/run.js";
22
+ import { runVerify, runVerifyBatch } from "./verify/run.js";
21
23
 
22
- export { CONFIG_RELATIVE_PATH, ConfigMalformedError, ConfigPathNotFoundError, ContextEnvelope, ContextField, ContextFieldValue, ContextTag, ContextType, DEFAULT_PROFILE_NAME, GraphEdgeEnvelope, GraphEnvelope, GraphNodeEnvelope, GraphSummary, InitOverwriteError, JsonDiagnostic, JsonEnvelope, JsonErrorEnvelope, JsonSummary, Now, OkfitPlatform, SCHEMA_DIRECTIVE, SkipReason, StaleEnvelope, StaleItem, StaleSummary, SyncEnvelope, SyncModeEnvelope, VerifyConceptNotFoundError, VerifyEnvelope, VerifyUnsupportedFrontmatterError, buildConfigLayer, collect, configValue, contextEnvelope, files, forDiagnostics, graphEnvelope, json, jsonError, okfitConfigSchemaHost, provideConfig, resolveBundleRoot, resolveProjectConfig, resolveProjectRoot, run, runContext, runGraph, runStale, runSync, runVerify, sort, staleEnvelope, syncEnvelope, tally, targetPaths, verifyEnvelope };
24
+ export { CONFIG_RELATIVE_PATH, ConfigMalformedError, ConfigPathNotFoundError, ContextEnvelope, ContextField, ContextFieldValue, ContextTag, ContextType, DEFAULT_PROFILE_NAME, DistributionField, ENGINE_VERSION, GraphEdgeEnvelope, GraphEnvelope, GraphNodeEnvelope, GraphSummary, InitOverwriteError, JsonDiagnostic, JsonEnvelope, JsonErrorEnvelope, JsonSummary, Now, OkfitPlatform, SkipReason, StaleEnvelope, StaleItem, StaleSummary, SyncEnvelope, SyncModeEnvelope, SyncStagedLogError, VerifyBatchEnvelope, VerifyConceptNotFoundError, VerifyEnvelope, VerifySelectionError, VerifyUnsupportedFrontmatterError, buildConfigLayer, collect, configValue, contextEnvelope, files, forDiagnostics, graphEnvelope, json, jsonError, provideConfig, resolveBundleRoot, resolveProjectConfig, resolveProjectRoot, run, runContext, runGraph, runStale, runSync, runVerify, runVerifyBatch, sort, staleEnvelope, syncEnvelope, tally, targetPaths, verifyBatchEnvelope, verifyEnvelope };
package/init/scaffold.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { Concept, ConceptId, Derive, LoadedConcept, OKF_SPEC_VERSION } from "@okfit/core";
2
2
  import { Effect, Option, Schema } from "effect";
3
3
  import { MarkdownDocument, MarkdownFrontmatter, MarkdownParseOptions, YamlFrontmatter } from "@effected/markdown";
4
- import { HostedSchema } from "@effected/schemastore";
5
4
 
6
5
  //#region src/init/scaffold.ts
7
6
  /** `.config/okfit.toml`, relative to the project root (C-10). @public */
@@ -23,23 +22,6 @@ const PROJECT_CONFIG_NAMES = [
23
22
  ".config/okfit.toml"
24
23
  ];
25
24
  /**
26
- * Where the published `config` JSON Schema document lives and which version
27
- * is current — the one identity `schemastore.config.ts` and `okfit init`'s
28
- * `#:schema` directive both derive from, so the URL a fresh config points at
29
- * and the one the generated document declares can never disagree (C-18).
30
- *
31
- * @public
32
- */
33
- const okfitConfigSchemaHost = HostedSchema.github({
34
- repo: "spencerbeggs/okfit",
35
- path: "schemas",
36
- name: "config",
37
- versions: ["1.0"],
38
- appendVersion: false
39
- });
40
- /** C-22's directive, plus the blank line Tombi requires. @public */
41
- const SCHEMA_DIRECTIVE = `#:schema ${okfitConfigSchemaHost.$id}\n\n`;
42
- /**
43
25
  * K-23: the THIN override only — never the merged config. `bundle.path` is
44
26
  * the bundle root relative to the project root; `extensions: {}` satisfies
45
27
  * `OkfitConfig`'s one non-optional field (`CORE/OkfitConfig.ts:164`).
@@ -187,4 +169,4 @@ const files = (options) => Effect.gen(function* () {
187
169
  });
188
170
 
189
171
  //#endregion
190
- export { CONFIG_RELATIVE_PATH, PROJECT_CONFIG_NAMES, SCHEMA_DIRECTIVE, configValue, files, okfitConfigSchemaHost, targetPaths };
172
+ export { CONFIG_RELATIVE_PATH, PROJECT_CONFIG_NAMES, configValue, files, targetPaths };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okfit/engine",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "private": false,
5
5
  "description": "The okfit engine: platform layer, config discovery, and the validate, verify, sync, init and context programs shared by the okfit CLI and MCP server.",
6
6
  "keywords": [
@@ -41,14 +41,13 @@
41
41
  "@effected/glob": "^0.6.0",
42
42
  "@effected/jsonc": "^0.11.0",
43
43
  "@effected/markdown": "^0.10.0",
44
- "@effected/schemastore": "^0.12.0",
45
44
  "@effected/store": "^0.8.0",
46
45
  "@effected/toml": "^0.7.0",
47
46
  "@effected/walker": "^0.9.0",
48
47
  "@effected/xdg": "^0.5.2",
49
48
  "@effected/yaml": "^0.15.1",
50
- "@okfit/core": "0.6.0",
51
- "@okfit/profiles": "0.7.1",
49
+ "@okfit/core": "0.7.0",
50
+ "@okfit/profiles": "0.7.2",
52
51
  "effect": "4.0.0-rc.115"
53
52
  },
54
53
  "engines": {
package/render/context.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { CONFIG_SCHEMA_VERSION } from "@okfit/core";
1
2
  import { Schema } from "effect";
2
3
 
3
4
  //#region src/render/context.ts
@@ -64,10 +65,15 @@ const ContextTag = Schema.Struct({
64
65
  * consumer can tell "no profile configured" apart from "an unknown profile
65
66
  * was configured".
66
67
  *
68
+ * `config_schema_version` is `@okfit/core`'s `CONFIG_SCHEMA_VERSION`,
69
+ * stamped by {@link contextEnvelope} itself -- callers cannot pass or fake
70
+ * it (okfit #137).
71
+ *
67
72
  * @public
68
73
  */
69
74
  const ContextEnvelope = Schema.Struct({
70
75
  schema: Schema.Literal(1),
76
+ config_schema_version: Schema.String,
71
77
  project_root: Schema.String,
72
78
  bundle_root: Schema.String,
73
79
  config_path: Schema.NullOr(Schema.String),
@@ -89,6 +95,7 @@ const ContextEnvelope = Schema.Struct({
89
95
  */
90
96
  const contextEnvelope = (input) => ({
91
97
  schema: 1,
98
+ config_schema_version: CONFIG_SCHEMA_VERSION,
92
99
  project_root: input.projectRoot,
93
100
  bundle_root: input.bundleRoot,
94
101
  config_path: input.configPath,
@@ -0,0 +1,11 @@
1
+ import { Schema } from "effect";
2
+
3
+ //#region src/render/distribution.ts
4
+ /** Every envelope's `distribution` field: a `Distribution` or `null`. @public */
5
+ const DistributionField = Schema.NullOr(Schema.Struct({
6
+ name: Schema.String,
7
+ version: Schema.String
8
+ }));
9
+
10
+ //#endregion
11
+ export { DistributionField };
package/render/graph.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { DistributionField } from "./distribution.js";
2
+ import { ENGINE_VERSION } from "../version.js";
1
3
  import { Schema } from "effect";
2
4
 
3
5
  //#region src/render/graph.ts
@@ -33,7 +35,9 @@ const GraphSummary = Schema.Struct({
33
35
  const GraphEnvelope = Schema.Struct({
34
36
  schema: Schema.Literal(1),
35
37
  okfit_version: Schema.String,
38
+ engine_version: Schema.String,
36
39
  producer: Schema.String,
40
+ distribution: DistributionField,
37
41
  okf_version: Schema.String,
38
42
  root: Schema.String,
39
43
  profile: Schema.NullOr(Schema.String),
@@ -61,7 +65,9 @@ const toEdge = (edge) => ({
61
65
  const graphEnvelope = (input) => ({
62
66
  schema: 1,
63
67
  okfit_version: input.okfitVersion,
68
+ engine_version: ENGINE_VERSION,
64
69
  producer: input.producer,
70
+ distribution: input.distribution ?? null,
65
71
  okf_version: input.okfVersion,
66
72
  root: input.root,
67
73
  profile: input.profile,