@yahoo/uds-create-config 5.77.2 → 5.79.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.
Files changed (56) hide show
  1. package/dist/configs/CanvasConfig.d.ts +1 -1
  2. package/dist/configs/react-native-system.d.ts +1 -1
  3. package/dist/configs/react-native-system.js +1 -1
  4. package/dist/configs/system.d.ts +1 -1
  5. package/dist/configs/system.js +3 -1
  6. package/dist/entities/system/{LinkedSystem.d.ts → Source.d.ts} +19 -11
  7. package/dist/entities/system/{LinkedSystem.js → Source.js} +127 -130
  8. package/dist/entities/system/component-module.js +2 -2
  9. package/dist/entities/system/copy-plan.js +5 -2
  10. package/dist/entities/system/css-motion-reach.js +6 -6
  11. package/dist/entities/system/link-declaration.d.ts +6 -68
  12. package/dist/entities/system/link-declaration.js +30 -4
  13. package/dist/entities/system/link-plan.d.ts +2 -2
  14. package/dist/entities/system/link-plan.js +44 -15
  15. package/dist/entities/system/motion-variants.js +2 -2
  16. package/dist/framework/Config.d.ts +59 -24
  17. package/dist/framework/Config.js +170 -41
  18. package/dist/framework/affected.d.ts +38 -0
  19. package/dist/framework/affected.js +191 -0
  20. package/dist/framework/changes.d.ts +1 -1
  21. package/dist/framework/changes.js +2 -2
  22. package/dist/framework/defineConfig.d.ts +3 -3
  23. package/dist/framework/defineEntity.d.ts +4 -3
  24. package/dist/framework/defineEntity.js +2 -1
  25. package/dist/framework/derived-mutations.d.ts +1 -1
  26. package/dist/framework/derived-mutations.js +1 -1
  27. package/dist/framework/inline-sources.js +2 -2
  28. package/dist/framework/projections.d.ts +14 -1
  29. package/dist/framework/projections.js +24 -1
  30. package/dist/framework/registry.d.ts +13 -7
  31. package/dist/framework/registry.js +3 -2
  32. package/dist/framework/retired-fields.d.ts +33 -0
  33. package/dist/framework/retired-fields.js +148 -0
  34. package/dist/framework/schema-version.d.ts +1 -1
  35. package/dist/framework/schema-version.js +5 -5
  36. package/dist/framework/schemas.js +1 -1
  37. package/dist/framework/signature.js +4 -1
  38. package/dist/framework/source-integrity.d.ts +2 -2
  39. package/dist/framework/source-integrity.js +2 -2
  40. package/dist/framework/sources.d.ts +3 -3
  41. package/dist/framework/sources.js +1 -1
  42. package/dist/framework/utils/content-key.js +1 -1
  43. package/dist/framework/utils/field-schema.js +7 -2
  44. package/dist/framework/utils/refs.d.ts +1 -1
  45. package/dist/framework/utils/refs.js +1 -1
  46. package/dist/index.d.ts +7 -5
  47. package/dist/index.js +6 -4
  48. package/dist/migrations/2.0.0/v1-artifact.d.ts +1 -1
  49. package/dist/migrations/20261105185042_sources_stored.d.ts +19 -0
  50. package/dist/migrations/20261105185042_sources_stored.js +125 -0
  51. package/dist/spec/links.d.ts +1 -1
  52. package/dist/spec/links.js +1 -1
  53. package/dist/tsconfig.tsbuildinfo +1 -1
  54. package/package.json +2 -2
  55. package/dist/framework/authored-at.d.ts +0 -31
  56. package/dist/framework/authored-at.js +0 -73
@@ -469,7 +469,7 @@ function linkedComponentModule(config, componentPathOrRef) {
469
469
  function publishedPin(config, slug) {
470
470
  const segments = sourceHops(slug);
471
471
  if (segments.length > 1) {
472
- const { systemId, version } = (config.sourceFor(routedSource(...segments.slice(0, -1)))?.resolve("linked-system", segments.at(-1) ?? ""))?.toJSON() ?? {};
472
+ const { systemId, version } = (config.sourceFor(routedSource(...segments.slice(0, -1)))?.resolve("source", segments.at(-1) ?? ""))?.toJSON() ?? {};
473
473
  return systemId && version ? {
474
474
  systemId,
475
475
  version
@@ -480,7 +480,7 @@ function publishedPin(config, slug) {
480
480
  for (let at = queue.shift(); at; at = queue.shift()) {
481
481
  if (seen.has(at)) continue;
482
482
  seen.add(at);
483
- for (const entity of at.list("linked-system")) {
483
+ for (const entity of at.list("source")) {
484
484
  const { systemId, version } = entity.toJSON();
485
485
  if (entity.path === slug && systemId && version) return {
486
486
  systemId,
@@ -3,7 +3,7 @@ import { rejectData } from "../../framework/rejection.js";
3
3
  import { kindBorrowable } from "../../framework/registry.js";
4
4
  import { File } from "./File.js";
5
5
  import { componentModuleFilePaths, componentRegistryImports } from "./component-module.js";
6
- import { PIN_KIND, covers, declarationOf, narrowDeclaration } from "./link-declaration.js";
6
+ import { PIN_KIND, covers, declarationOf, includeWrite, narrowDeclaration } from "./link-declaration.js";
7
7
  //#region src/entities/system/copy-plan.ts
8
8
  /**
9
9
  * The source's entries one path names: every item of the kind for `'*'`, a folder's members for a
@@ -483,7 +483,10 @@ function planCopy({ config, input }) {
483
483
  kind: PIN_KIND,
484
484
  operation: "update",
485
485
  path: slug,
486
- data: { link: next ?? null }
486
+ data: { ...includeWrite({
487
+ body: config.storedBody(PIN_KIND, slug),
488
+ declared: next ?? null
489
+ }) }
487
490
  });
488
491
  }
489
492
  }
@@ -45,7 +45,7 @@ const resolvePlacements = createSliceMemo({
45
45
  kinds: [
46
46
  "component",
47
47
  "motion",
48
- "linked-system"
48
+ "source"
49
49
  ],
50
50
  compute: (config) => {
51
51
  const out = [];
@@ -83,7 +83,7 @@ const cssMotionVariantGroups = createSliceMemo({
83
83
  kinds: [
84
84
  "component",
85
85
  "motion",
86
- "linked-system"
86
+ "source"
87
87
  ],
88
88
  compute: (config) => variantGroupsOf({
89
89
  config,
@@ -94,7 +94,7 @@ const resolveExits = createSliceMemo({
94
94
  kinds: [
95
95
  "component",
96
96
  "motion",
97
- "linked-system"
97
+ "source"
98
98
  ],
99
99
  compute: (config) => {
100
100
  const out = [];
@@ -139,7 +139,7 @@ const resolveSwapped = createSliceMemo({
139
139
  kinds: [
140
140
  "component",
141
141
  "motion",
142
- "linked-system"
142
+ "source"
143
143
  ],
144
144
  compute: (config) => {
145
145
  const links = swappingLinks(config);
@@ -162,10 +162,10 @@ function swappedLinkJsMotions(config) {
162
162
  return resolveSwapped(config);
163
163
  }
164
164
  const resolveLinkedSwaps = createSliceMemo({
165
- kinds: ["linked-system", "motion"],
165
+ kinds: ["source", "motion"],
166
166
  compute: (config) => {
167
167
  const out = [];
168
- for (const link of config.list("linked-system")) {
168
+ for (const link of config.list("source")) {
169
169
  const { options } = link.toJSON();
170
170
  for (const [preset, entry] of Object.entries(options?.motion ?? {})) {
171
171
  if (!isPlainObject(entry)) continue;
@@ -1,68 +1,6 @@
1
- import type { Config } from '../../framework/Config';
2
- import type { LinkDeclaration } from './LinkedSystem';
3
- export declare const PIN_KIND = "linked-system";
4
- /** The pin's `link` as stored. */
5
- export declare function declarationOf(config: Config, slug: string): LinkDeclaration | undefined;
6
- /**
7
- * What a declaration says about one accessor: its own entry, or the record's `'*'` entry, which stands
8
- * for every accessor the record doesn't name (`{ '*': '*', modifiers: ['*', '!text'] }`).
9
- */
10
- export declare function entriesFor(declared: LinkDeclaration | undefined, accessor: string): '*' | readonly string[] | undefined;
11
- /** The paths a list leaves out, without their `!`. */
12
- export declare function excludedIn(entries: '*' | readonly string[] | undefined): string[];
13
- /**
14
- * Whether a declaration leaves the accessor's path out on purpose: a `!` entry names it or a folder
15
- * above it. An excluded path derives no row however the link reaches it, a ref pulling it in included.
16
- */
17
- export declare function excludes({ declared, accessor, path, }: {
18
- declared: LinkDeclaration | undefined;
19
- accessor: string;
20
- path: string;
21
- }): boolean;
22
- /**
23
- * Whether a declaration covers the accessor's path: the whole source, the kind, the path, or a folder
24
- * above it, and no `!` entry leaves it out. An exclusion wins whatever else in the list reaches the
25
- * path, so `['*', '!text']` is every path but `text`'s.
26
- */
27
- export declare function covers({ declared, accessor, path, }: {
28
- declared: LinkDeclaration | undefined;
29
- accessor: string;
30
- path: string;
31
- }): boolean;
32
- /**
33
- * A list with `paths` taken into it: each is added unless a path the list takes already reaches it,
34
- * and an exclusion that would leave one out is lifted. One naming the path or a folder under it goes;
35
- * one naming a folder above it is spelled out as the folder's other members, so they stay out.
36
- */
37
- export declare function includePaths({ config, slug, kind, entries, paths, }: {
38
- config: Config;
39
- slug: string;
40
- kind: string;
41
- entries: readonly string[];
42
- paths: readonly string[];
43
- }): string[];
44
- /**
45
- * A list with `paths` left out: a `!` entry for each the list doesn't exclude already. A path the
46
- * list names under one of them goes, since the exclusion now says it, and so does a narrower
47
- * exclusion a new one reaches. A folder named above an excluded path stays, less that path. With
48
- * nothing listed, the list is the exclusions alone, which still keep the paths out when a linked row
49
- * reaches them.
50
- */
51
- export declare function excludePaths(entries: '*' | readonly string[] | undefined, paths: readonly string[]): string[];
52
- /**
53
- * The declaration with `removal` taken out of it, or `undefined` when nothing stays declared.
54
- *
55
- * A declaration of everything is spelled out first, one kind per accessor the source has rows for, so
56
- * one kind can be taken out of it; a kind taken whole is spelled out as the source's top-level paths
57
- * so some can go; a declared folder above a removed path is spelled out as its other members, so the
58
- * rest of it stays covered. A list that takes every path (`['*', …]`) is spelled out the same way.
59
- * Its `!` entries stay, a list of them alone included, and narrowing writes none.
60
- */
61
- export declare function narrowDeclaration({ config, slug, current, removal, verb, }: {
62
- config: Config;
63
- slug: string;
64
- current: LinkDeclaration;
65
- removal: ReadonlyMap<string, '*' | readonly string[]>;
66
- /** The op asking, for the refusal. */
67
- verb: string;
68
- }): LinkDeclaration | undefined;
1
+ import { LinkDeclaration } from "./Source.js";
2
+ //#region src/entities/system/link-declaration.d.ts
3
+ /** What a source's body includes, as stored at `options.include`. */
4
+ declare function includeOf(body: unknown): LinkDeclaration | undefined;
5
+ //#endregion
6
+ export { includeOf };
@@ -1,11 +1,37 @@
1
+ import { isPlainObject } from "../../framework/utils/field-path.js";
1
2
  import { rejectData } from "../../framework/rejection.js";
2
3
  //#region src/entities/system/link-declaration.ts
3
- const PIN_KIND = "linked-system";
4
- /** The pin's `link` as stored. */
4
+ const PIN_KIND = "source";
5
+ /** The key of `options` that holds what a source includes. Every other key is an accessor. */
6
+ const INCLUDE = "include";
7
+ /** What a source's body includes, as stored at `options.include`. */
8
+ function includeOf(body) {
9
+ const options = isPlainObject(body) ? body.options : void 0;
10
+ return isPlainObject(options) ? options[INCLUDE] : void 0;
11
+ }
12
+ /** A source's `options` without `include`: its directives, by accessor. */
13
+ function directivesOf(body) {
14
+ const options = isPlainObject(body) ? body.options : void 0;
15
+ if (!isPlainObject(options)) return [];
16
+ return Object.entries(options).filter(([key]) => key !== INCLUDE);
17
+ }
18
+ /**
19
+ * The write that sets what a source includes, or clears it when `declared` is `undefined` or `null`.
20
+ * A clear that would leave `options` empty removes `options`, so a source that includes nothing and
21
+ * adjusts nothing stores no `options` at all.
22
+ */
23
+ function includeWrite({ body, declared }) {
24
+ if (declared !== void 0 && declared !== null) return { [`options.${INCLUDE}`]: declared };
25
+ return directivesOf(body).length === 0 ? {
26
+ [`options.${INCLUDE}`]: null,
27
+ options: null
28
+ } : { [`options.${INCLUDE}`]: null };
29
+ }
30
+ /** The pin's `include` as stored. */
5
31
  function declarationOf(config, slug) {
6
32
  const pin = config.storedBody(PIN_KIND, slug);
7
33
  if (!pin) rejectData(`No linked system "${slug}".`);
8
- return pin.link;
34
+ return includeOf(pin);
9
35
  }
10
36
  /** An entry that leaves a path out: `'!text'`. */
11
37
  const EXCLUDE = "!";
@@ -156,4 +182,4 @@ function narrowDeclaration({ config, slug, current, removal, verb }) {
156
182
  return Object.keys(next).length === 0 ? void 0 : next;
157
183
  }
158
184
  //#endregion
159
- export { PIN_KIND, covers, declarationOf, entriesFor, excludePaths, excludes, includePaths, narrowDeclaration };
185
+ export { INCLUDE, PIN_KIND, covers, declarationOf, directivesOf, entriesFor, excludePaths, excludes, includeOf, includePaths, includeWrite, narrowDeclaration };
@@ -1,9 +1,9 @@
1
1
  import { EntityAddress } from "../../framework/plan.js";
2
- import { LinkDeclaration } from "./LinkedSystem.js";
2
+ import { LinkDeclaration } from "./Source.js";
3
3
  import { Config, Patch, SettledSource, SourceCollision, TreeNode } from "../../framework/Config.js";
4
4
 
5
5
  //#region src/entities/system/link-plan.d.ts
6
- /** What one op names, keyed by accessor the way the pin's `link` is: every entry of the kind, or the
6
+ /** What one op names, keyed by accessor the way the pin's `options.include` is: every entry of the kind, or the
7
7
  * source's paths, where a folder names its members. `'*'` alone is every kind the source offers. */
8
8
  type LinkPaths = '*' | Readonly<Record<string, '*' | readonly string[]>>;
9
9
  /** What a link does at a path held through another linked system: `'take'` makes the row follow this
@@ -3,7 +3,7 @@ import { isConfigRejection, rejectData } from "../../framework/rejection.js";
3
3
  import { blockedBy } from "../../framework/plan.js";
4
4
  import { danglingDirectives, excludedCondition } from "../../framework/source-integrity.js";
5
5
  import { sameOrigin } from "../../framework/Config.js";
6
- import { PIN_KIND, covers, declarationOf, entriesFor, excludePaths, excludes, includePaths, narrowDeclaration } from "./link-declaration.js";
6
+ import { INCLUDE, PIN_KIND, covers, declarationOf, directivesOf, entriesFor, excludePaths, excludes, includePaths, includeWrite, narrowDeclaration } from "./link-declaration.js";
7
7
  import { planCopy, sourceEntries } from "./copy-plan.js";
8
8
  //#region src/entities/system/link-plan.ts
9
9
  /** The kinds `data` names, with what to take of each. An accessor this config has no kind for is a typo, refused by name. */
@@ -237,7 +237,10 @@ function planLinkApplied({ config, input }) {
237
237
  kind: PIN_KIND,
238
238
  operation: "update",
239
239
  path: slug,
240
- data: { link: "*" }
240
+ data: { ...includeWrite({
241
+ body: config.storedBody(PIN_KIND, slug),
242
+ declared: "*"
243
+ }) }
241
244
  });
242
245
  } else {
243
246
  const next = { ...current ?? {} };
@@ -268,7 +271,7 @@ function planLinkApplied({ config, input }) {
268
271
  kind: PIN_KIND,
269
272
  operation: "update",
270
273
  path: slug,
271
- data: { [`link.${accessor}`]: value }
274
+ data: { [`options.${INCLUDE}.${accessor}`]: value }
272
275
  });
273
276
  }
274
277
  declared = Object.keys(next).length === 0 ? current : next;
@@ -491,7 +494,7 @@ function directivesTakenFrom({ config, slug, after }) {
491
494
  }
492
495
  const edits = [];
493
496
  for (const pin of new Set(dropped.map((at) => at.from))) {
494
- const options = config.storedBody("linked-system", pin).options ?? {};
497
+ const options = config.storedBody("source", pin).options ?? {};
495
498
  const data = {};
496
499
  let emptied = 0;
497
500
  for (const [accessor, entries] of Object.entries(options)) {
@@ -601,7 +604,10 @@ function planUnlink({ config, input }) {
601
604
  kind: PIN_KIND,
602
605
  operation: "update",
603
606
  path: slug,
604
- data: { link: null }
607
+ data: { ...includeWrite({
608
+ body: config.storedBody(PIN_KIND, slug),
609
+ declared: null
610
+ }) }
605
611
  });
606
612
  } else {
607
613
  const removal = /* @__PURE__ */ new Map();
@@ -634,7 +640,10 @@ function planUnlink({ config, input }) {
634
640
  kind: PIN_KIND,
635
641
  operation: "update",
636
642
  path: slug,
637
- data: { link: declared === void 0 ? null : declared }
643
+ data: { ...includeWrite({
644
+ body: config.storedBody(PIN_KIND, slug),
645
+ declared: declared === void 0 ? null : declared
646
+ }) }
638
647
  });
639
648
  }
640
649
  let after;
@@ -666,8 +675,20 @@ function planUnlink({ config, input }) {
666
675
  }) : [];
667
676
  if (dropped.length > 0) {
668
677
  const update = patches[patches.length - 1];
669
- if (dropped.length === config.sourceDirectives(slug).length) update.data.options = null;
670
- else for (const { accessor, path } of dropped) update.data[`options.${accessor}.${path}`] = null;
678
+ const all = config.sourceDirectives(slug).every((directive) => dropped.some((gone) => gone.accessor === directive.accessor && gone.path === directive.path));
679
+ patches[patches.length - 1] = all && declared === void 0 ? {
680
+ ...update,
681
+ data: {
682
+ [`options.${INCLUDE}`]: null,
683
+ options: null
684
+ }
685
+ } : {
686
+ ...update,
687
+ data: {
688
+ ...update.data,
689
+ ...Object.fromEntries(dropped.map(({ accessor, path }) => [`options.${accessor}.${path}`, null]))
690
+ }
691
+ };
671
692
  }
672
693
  return {
673
694
  declared,
@@ -691,7 +712,7 @@ function deadDirectives({ config, after, slug, removed }) {
691
712
  return config.sourceDirectives(slug).filter((directive) => directive.kind !== void 0 && after.resolve(directive.kind, directive.path)?.borrowedFrom !== slug && (gone.has(`${directive.kind}:${directive.path}`) || collectRefs(config.sourceOverlay(slug, directive.kind, directive.path)).some((target) => gone.has(target))));
692
713
  }
693
714
  /**
694
- * Leave paths of a linked system out, with a `!` entry each in the pin's `link`. Stronger than
715
+ * Leave paths of a linked system out, with a `!` entry each in the pin's `options.include`. Stronger than
695
716
  * `unlink`: nothing derives there however the link reaches it, a linked token naming it included,
696
717
  * and the linked tokens' overrides under an excluded modifier are left out of the build. `link` with
697
718
  * the same path lifts it again.
@@ -719,8 +740,7 @@ function planExclude({ config, input }) {
719
740
  const declared = next;
720
741
  const dropped = [];
721
742
  const optionDeletes = {};
722
- const options = config.storedBody("linked-system", slug).options ?? {};
723
- for (const [accessor, entries] of Object.entries(options)) {
743
+ for (const [accessor, entries] of directivesOf(config.storedBody(PIN_KIND, slug))) {
724
744
  if (!entries || typeof entries !== "object") continue;
725
745
  const kind = config.accessors()[accessor]?.kind ?? accessor;
726
746
  for (const path of Object.keys(entries)) {
@@ -741,7 +761,10 @@ function planExclude({ config, input }) {
741
761
  operation: "update",
742
762
  path: slug,
743
763
  data: {
744
- link: declared,
764
+ ...includeWrite({
765
+ body: config.storedBody(PIN_KIND, slug),
766
+ declared
767
+ }),
745
768
  ...optionDeletes
746
769
  }
747
770
  }];
@@ -941,7 +964,10 @@ function planBreak({ config, input }) {
941
964
  kind: PIN_KIND,
942
965
  operation: "update",
943
966
  path: slug,
944
- data: { link: null }
967
+ data: { ...includeWrite({
968
+ body: config.storedBody(PIN_KIND, slug),
969
+ declared: null
970
+ }) }
945
971
  }], {
946
972
  kind: PIN_KIND,
947
973
  operation: "delete",
@@ -1084,7 +1110,7 @@ function planBreak({ config, input }) {
1084
1110
  });
1085
1111
  }
1086
1112
  for (const folder of plan.folders) released.add(`${folder.kind}:${folder.path}`);
1087
- patches.push(...plan.patches.filter((patch) => scoped || !(patch.kind === "linked-system" && patch.operation === "update")));
1113
+ patches.push(...plan.patches.filter((patch) => scoped || !(patch.kind === "source" && patch.operation === "update")));
1088
1114
  });
1089
1115
  if (copyBlocked !== void 0) return {
1090
1116
  rows,
@@ -1114,7 +1140,10 @@ function planBreak({ config, input }) {
1114
1140
  kind: PIN_KIND,
1115
1141
  operation: "update",
1116
1142
  path: slug,
1117
- data: { link: null }
1143
+ data: { ...includeWrite({
1144
+ body: config.storedBody(PIN_KIND, slug),
1145
+ declared: null
1146
+ }) }
1118
1147
  });
1119
1148
  patches.push({
1120
1149
  kind: PIN_KIND,
@@ -94,7 +94,7 @@ const placedMotions = createSliceMemo({
94
94
  kinds: [
95
95
  "component",
96
96
  "motion",
97
- "linked-system"
97
+ "source"
98
98
  ],
99
99
  compute: (config) => {
100
100
  const out = [];
@@ -131,7 +131,7 @@ const motionVariantGroups = createSliceMemo({
131
131
  kinds: [
132
132
  "component",
133
133
  "motion",
134
- "linked-system"
134
+ "source"
135
135
  ],
136
136
  compute: (config) => variantGroupsOf({
137
137
  config,
@@ -74,7 +74,7 @@ interface RecordedSource {
74
74
  * The dense-counter `2` a short-lived scheme stamped before the chain existed reads as the mint
75
75
  * that replaced it (see `detectedWireVersion`).
76
76
  */
77
- declare const SERIALIZED_CONFIG_VERSION = 20261104151013;
77
+ declare const SERIALIZED_CONFIG_VERSION = 20261105185042;
78
78
  interface SerializedConfig {
79
79
  /** See {@link SERIALIZED_CONFIG_VERSION}. Always written; a stored artifact may lack it. */
80
80
  readonly version: number;
@@ -360,9 +360,9 @@ interface LiveConfig {
360
360
  type SourcesBySlug = Record<string, Config | LiveConfig | SerializedConfig>;
361
361
  /**
362
362
  * Loaded sources ready to attach, keyed by the source kind's accessor name and then by the item's
363
- * slug — `{ linkedSystems: { yos: yahooOs } }`.
363
+ * slug — `{ sources: { yos: yahooOs } }`.
364
364
  *
365
- * The same two levels the declaration uses (`register({ linkedSystems: { yos: LinkedSystem.item(…) } })`),
365
+ * The same two levels the declaration uses (`register({ sources: { yos: Source.item(…) } })`),
366
366
  * so declaring a source and handing over what it resolved to are spelled the same way. See
367
367
  * {@link Config.registerSources}.
368
368
  */
@@ -380,10 +380,10 @@ type AttachedSources = Readonly<Record<string, SourcesBySlug>>;
380
380
  */
381
381
  interface HydrationOptions {
382
382
  /**
383
- * The loaded sources to attach — {@link AttachedSources}, so `{ linkedSystems: { yos: … } }`.
383
+ * The loaded sources to attach — {@link AttachedSources}, so `{ sources: { yos: … } }`.
384
384
  *
385
385
  * Nested under its own key rather than spread across this interface, because the accessor names are
386
- * the config type's to choose. A `linkedSystems?:` field here would be the framework naming a kind
386
+ * the config type's to choose. A field per source accessor here would be the framework naming a kind
387
387
  * (see `.claude/rules/config-framework-kind-agnostic.md`), and a config declaring `linkedPackages`
388
388
  * would have no way to hydrate at all. `patches` shares this level, which is why the sources cannot
389
389
  * simply be this interface.
@@ -532,6 +532,12 @@ interface ConfigState {
532
532
  * away every memo keyed on a source (`memo.ts`) on every keystroke, with nothing failing.
533
533
  */
534
534
  readonly recorded: ReadonlyMap<string, RecordedSource>;
535
+ /**
536
+ * The recorded closures as the base held them. A draft patch that moves a pin drops that slug from
537
+ * {@link recorded}, since the closure answers for the old pin, and {@link Config.withoutDraft} reads
538
+ * it back from here.
539
+ */
540
+ readonly baseRecorded: ReadonlyMap<string, RecordedSource>;
535
541
  /**
536
542
  * What each declared source resolved to, recorded per slug by {@link Config.load} — the same
537
543
  * tagged value the resolver answered with, so nothing translates between them.
@@ -688,6 +694,20 @@ declare class Config {
688
694
  * was registered into this instance. `undefined` for a kind this config doesn't know. The single
689
695
  * accessor every internal read routes through. */
690
696
  entityOf(kind: string): EntityKind | undefined;
697
+ /** An op address (`linked-system/link`) with its kind segment named as the kind is now. */
698
+ currentAddress(address: string): string;
699
+ /** `patch`, addressed to the kind it names now, with its data at the fields the kind has now. This
700
+ * is the patch as it is recorded, so it depends on nothing but the patch. */
701
+ private patchUnderCurrentKind;
702
+ /**
703
+ * `patch` as it lands on `snapshot`: a whole write of a moved field's container keeps the value
704
+ * stored there ({@link keptThroughContainerWrite}). Judged at each landing rather than written into
705
+ * the recorded patch, so a replay onto a base that has changed the field since keeps that base's
706
+ * value, not the one stored when the patch was first applied.
707
+ */
708
+ private patchAsItLands;
709
+ /** `kind`, or the kind it names now when it's a retired name ({@link EntityKind.retiredKinds}). */
710
+ currentKind(kind: string): string;
691
711
  /** Every key a style rule's layer bag takes that a kind owns, with the kind that owns it. See
692
712
  * {@link LayerKey}. */
693
713
  layerKeys(): ReadonlyMap<string, LayerKey & {
@@ -725,6 +745,12 @@ declare class Config {
725
745
  * The single-op half of {@link run}, which is the door a caller uses.
726
746
  */
727
747
  private dispatch;
748
+ /**
749
+ * An op's input with any field the kind has moved (`EntityKind.retiredFields`) written at its
750
+ * current path: folded into a whole body, renamed in an update's delta. A member op addresses a
751
+ * sub-collection, which no retired field names.
752
+ */
753
+ private underCurrentFields;
728
754
  /**
729
755
  * A whole-body op's input with a bare ref put in the kind's primary field, so an op takes the same
730
756
  * shorthand `apply` does (`wholeBodyChange`): `Token.ref('x@ds')` is a token body at either door.
@@ -961,7 +987,7 @@ declare class Config {
961
987
  * in.
962
988
  *
963
989
  * Checked rather than assumed. "The slug namespace is flat" is a property of the ref grammar, and
964
- * nothing was making the data honour it: a config declaring `linkedSystems: { ds }` and
990
+ * nothing was making the data honour it: a config declaring `sources: { ds }` and
965
991
  * `linkedPackages: { ds }` registered clean, `sourceSlugs()` answered `['ds', 'ds']`, and every read
966
992
  * through `@ds` picked a winner. Unreachable while a config declares one source kind, and the first
967
993
  * thing to go wrong the day it declares two — which is exactly what `sources` exists to allow.
@@ -989,7 +1015,7 @@ declare class Config {
989
1015
  * `apply` and {@link run} are two doors on one wall. A {@link Patch} is one of the framework's own
990
1016
  * verbs (`create`, `update`, `rename`, `sub-update`, …) with its body already in stored shape, and
991
1017
  * `apply` performs exactly that one and records it. A {@link ConfigOp} is anything the catalog
992
- * addresses — those same verbs, and custom ops such as `linked-system/copy` that decompose into
1018
+ * addresses — those same verbs, and custom ops such as `source/copy` that decompose into
993
1019
  * several patches — and `run` parses its input against the op's own schema and hands it to the op's
994
1020
  * handler, which for a standard verb is a call to `apply`. So `apply` is what a handler and a
995
1021
  * replay call, and `run` is what a caller calls: a tool, an editor gesture, a commit. A caller
@@ -1011,13 +1037,13 @@ declare class Config {
1011
1037
  * A delete records more than one patch when items declare they cannot outlive the target
1012
1038
  * ({@link EntityKind.structuralBody}): a delete per dependent, leaves first, then the target, as
1013
1039
  * one changeset. `id` then names the first of them and the changeset. */
1014
- apply(patch: Patch, id?: string): this;
1040
+ apply(written: Patch, id?: string): this;
1015
1041
  /**
1016
1042
  * {@link apply} for exactly the patch it is given: a delete takes nothing with it. For replaying a
1017
1043
  * patch as it was recorded, since a recorded delete's cascade was recorded beside it, ahead of it.
1018
1044
  * Deleting again what the base gained since would remove it with no patch saying so.
1019
1045
  */
1020
- applyRecorded(patch: Patch, id?: string): this;
1046
+ applyRecorded(written: Patch, id?: string): this;
1021
1047
  /**
1022
1048
  * `run` with each kind's invariants judged once, on the config it returns, rather than after every
1023
1049
  * `apply` inside it. An invariant walks its whole kind, so a pass that writes a row per entity and
@@ -1406,7 +1432,7 @@ declare class Config {
1406
1432
  /** Resolve one derived member — base ⊕ sparse override, with `computed` fields evaluated on read
1407
1433
  * (never stored). Returns `undefined` for a path that doesn't derive. */
1408
1434
  private resolveDerived;
1409
- resolve(kind: string, path: string): Entity | undefined;
1435
+ resolve(written: string, path: string): Entity | undefined;
1410
1436
  /**
1411
1437
  * Whether this config holds `target`'s entity, at the path the source spells it, through `slug`.
1412
1438
  *
@@ -1609,13 +1635,13 @@ declare class Config {
1609
1635
  * accessor name, then by the item's slug:
1610
1636
  *
1611
1637
  * ```ts
1612
- * Config.registerSources({ linkedSystems: { yos: yahooOs } })
1638
+ * Config.registerSources({ sources: { yos: yahooOs } })
1613
1639
  * ```
1614
1640
  *
1615
- * The same two levels `register` takes (`{ linkedSystems: { yos: LinkedSystem.item(…) } }`) and the
1641
+ * The same two levels `register` takes (`{ sources: { yos: Source.item(…) } }`) and the
1616
1642
  * same two `fromJSON(json, { sources })` takes, so one gesture — declare a source, then hand
1617
1643
  * over what it resolved to — reads identically at all three. A flat `{ yos }` said nothing about
1618
- * which collection `yos` came from, which is fine while `linked-system` is the only source kind and
1644
+ * which collection `yos` came from, which is fine while `source` is the only source kind and
1619
1645
  * wrong the day there is a second.
1620
1646
  *
1621
1647
  * Immutable like every other authoring step: the sources ride on the derived config, and every later
@@ -1726,7 +1752,7 @@ declare class Config {
1726
1752
  *
1727
1753
  * Answers the slug, which is the kind-agnostic half and therefore the half that belongs here. Turning
1728
1754
  * a slug into the typed pin behind it is the source kind's own business (`sourceOfGroup` beside
1729
- * `LinkedSystem`) — a `Config` method could only hand back a bare `Entity`, and the rule above would
1755
+ * `Source`) — a `Config` method could only hand back a bare `Entity`, and the rule above would
1730
1756
  * then be stated once per source kind instead of once.
1731
1757
  */
1732
1758
  groupSource({
@@ -1803,7 +1829,7 @@ declare class Config {
1803
1829
  * stores, so refusing on that shape would lock a pointer we declared. See `borrowedSlug`.
1804
1830
  */
1805
1831
  /**
1806
- * The pin whose `link` declaration covers `kind:path` and whose source has a row there, so the build
1832
+ * The pin whose `options.include` covers `kind:path` and whose source has a row there, so the build
1807
1833
  * mints the source's row at the path on its next pass. `undefined` when no declaration covers the
1808
1834
  * path, or the declaring source is attached and lacks it. A source that isn't attached is taken at
1809
1835
  * its declaration's word.
@@ -1848,7 +1874,7 @@ declare class Config {
1848
1874
  path: string;
1849
1875
  }[];
1850
1876
  /**
1851
- * Whether one of a declared source's paths is adopted here — covered by the pin's `link`.
1877
+ * Whether one of a declared source's paths is adopted here — covered by the pin's `options.include`.
1852
1878
  *
1853
1879
  * The question a spelling turns on: an adopted path is addressed bare, because the build mints a
1854
1880
  * row for it at the path the source spells, and everything else is addressed qualified. The two are
@@ -2607,7 +2633,7 @@ declare class Config {
2607
2633
  * in which fields they set are different sources, and collapsing them would share one cache entry.
2608
2634
  *
2609
2635
  * Derived rather than spelled, which is what makes it right for kinds nobody has written — it covers
2610
- * whatever fields a kind actually declares instead of the three `linked-system` happens to have. The
2636
+ * whatever fields a kind actually declares instead of the three `source` happens to have. The
2611
2637
  * key it replaces was `${systemId}@${version}`, which a repo-local source cannot state at all;
2612
2638
  * that is the case the walk using it had to pre-skip.
2613
2639
  */
@@ -2621,7 +2647,7 @@ declare class Config {
2621
2647
  *
2622
2648
  * A row borrowed or copied through a pin is asked of that pin's source in turn, so a system linked
2623
2649
  * to a system linked to a foundation answers with the foundation. A row a materialized artifact
2624
- * flattened to a literal has no pointer left, so the pin whose `link` declaration covers the path
2650
+ * flattened to a literal has no pointer left, so the pin whose `options.include` covers the path
2625
2651
  * stands in, provided the row still reads as the source's ({@link matchesSource}); one the
2626
2652
  * publisher changed is its own, and so is a linked row this config lays a value of its own over: the
2627
2653
  * Bridge's `spectrum/blue/0` points at Yahoo OS's with the Bridge's colours on it, which is the
@@ -2641,7 +2667,7 @@ declare class Config {
2641
2667
  path: string;
2642
2668
  }): Origin | undefined;
2643
2669
  /**
2644
- * The pin whose `link` declaration covers `kind:path` while the row there still reads as that
2670
+ * The pin whose `options.include` covers `kind:path` while the row there still reads as that
2645
2671
  * source's: how a row a materialized artifact flattened to a literal is traced back to the pin it
2646
2672
  * came through. `undefined` when no declaration covers it, or the row differs from the source's.
2647
2673
  */
@@ -2689,8 +2715,8 @@ declare class Config {
2689
2715
  */
2690
2716
  private sourceKindFor;
2691
2717
  /**
2692
- * Every source kind by the accessor name its config type declares it under — `linkedSystems` →
2693
- * `linked-system`.
2718
+ * Every source kind by the accessor name its config type declares it under — `sources` →
2719
+ * `source`.
2694
2720
  *
2695
2721
  * The accessor name is what every source-shaped argument is keyed by ({@link AttachedSources},
2696
2722
  * `register`, `Config.load`'s resolvers), because it's the name an author writes, where the kind is
@@ -2787,7 +2813,7 @@ declare class Config {
2787
2813
  * {@link retired} answers true for. Both answers are cached per snapshot, so either is safe in a dep
2788
2814
  * array.
2789
2815
  */
2790
- list(kind: string, opts?: ListOptions): Entity[];
2816
+ list(written: string, opts?: ListOptions): Entity[];
2791
2817
  /** The total list behind {@link list}. */
2792
2818
  private allOf;
2793
2819
  /** A kind's items as a nested folder/file tree, built from the qualified paths at any
@@ -2845,9 +2871,9 @@ declare class Config {
2845
2871
  * every sourced ref dangles, and emitters, integrity checks and memos all read exactly there.
2846
2872
  *
2847
2873
  * `sources` is keyed the way every other source-shaped argument is — by the source kind's accessor
2848
- * name, `{ linkedSystems: resolver }` — so the resolver set, the declaration, and
2874
+ * name, `{ sources: resolver }` — so the resolver set, the declaration, and
2849
2875
  * {@link registerSources} all spell the same key. Each resolver is the kind's own
2850
- * (`LinkedSystemResolver`), and its answer is validated against the schemas that kind declares.
2876
+ * (`SystemSourceResolver`), and its answer is validated against the schemas that kind declares.
2851
2877
  *
2852
2878
  * Reads the source entities off a throwaway bare parse, resolves them all, then hydrates once with
2853
2879
  * whatever came back attached. The bare parse is cheap and is what lets a resolver be handed the
@@ -2922,6 +2948,15 @@ declare class Config {
2922
2948
  * callers can compare by reference.
2923
2949
  */
2924
2950
  withAttachmentsFrom(previous: Config): this;
2951
+ /**
2952
+ * The branch as its base read it: no draft, and every source read the way the base read it.
2953
+ *
2954
+ * Replaying nothing over the base covers the snapshot. A pin the draft moved also left the
2955
+ * per-slug state answering for the new pin: its recorded closure gone and, once fetched, the new
2956
+ * version attached. So each moved slug gets the base's recorded closure back and loses that
2957
+ * attachment before the replay, which also re-derives the rows the old pin minted.
2958
+ */
2959
+ withoutDraft(): this;
2925
2960
  /**
2926
2961
  * Retire the attachment for every slug a walk answered `unavailable` for.
2927
2962
  *