@wildshard/shard-format 0.74.0 → 0.74.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildshard/shard-format",
3
- "version": "0.74.0",
3
+ "version": "0.74.1",
4
4
  "description": "The raw shardfile format: the spec, the validator and a validate CLI. The public, versioned contract every other repo builds on.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -12,7 +12,8 @@ export const NATIVE_ASSEMBLY_DATA_SCHEMA = '@wildshard/format/nativeAssembly#Nat
12
12
  export type NativeAssemblyRead = { file: string; path?: string[] } | { section: string; path?: string[] } | { value: unknown };
13
13
  /** One host's rows: what it reads and its data-only settings, in the install order the plan lists. */
14
14
  export type NativeAssemblyFeature =
15
- | { host: 'decisions' | 'commands' | 'loadout' | 'quest.body-scripts' | 'population.elites-ready' | 'population.reactions' | 'population.settle' | 'riding.elites-ready' | 'water.field' }
15
+ | { host: 'quest.body-scripts' }
16
+ | { host: 'decisions' | 'commands' | 'loadout' | 'population.elites-ready' | 'population.reactions' | 'population.settle' | 'riding.elites-ready' | 'water.field' }
16
17
  | { host: 'collision'; skipOnRestore?: boolean } | { host: 'collision.pieces'; rows: NativeAssemblyRead }
17
18
  | { host: 'day.keyed-sky' } | { host: 'day.toon'; start: number; cycle: number; phases: Record<string, string> } | { host: 'day.declared'; clock: NativeAssemblyRead }
18
19
  | { host: 'water.sea'; id: string } | { host: 'combat.motion'; speed: number }
@@ -87,19 +88,25 @@ const heldInput = v.strictObject({ attack: key, swap: key, aim: key, pitch: key
87
88
  const arenaInput = v.strictObject({ use: key, skip: key });
88
89
  const grant = v.strictObject({ item: key, count: number });
89
90
  const grants = v.pipe(v.array(grant), v.maxLength(MAX_GRANTS));
90
- const feature = v.variant('host', [
91
- v.strictObject({ host: v.picklist(['decisions', 'commands', 'loadout', 'quest.body-scripts', 'population.elites-ready', 'population.reactions', 'population.settle', 'riding.elites-ready', 'water.field']) }),
92
- v.strictObject({ host: v.literal('collision'), skipOnRestore: flag }), v.strictObject({ host: v.literal('collision.pieces'), rows: read }),
93
- v.strictObject({ host: v.literal('day.keyed-sky') }), v.strictObject({ host: v.literal('day.toon'), start: number, cycle: number, phases: v.record(key, key) }), v.strictObject({ host: v.literal('day.declared'), clock: read }),
94
- v.strictObject({ host: v.literal('water.sea'), id: key }), v.strictObject({ host: v.literal('combat.motion'), speed: number }),
95
- v.strictObject({ host: v.literal('item.ranged'), kind: v.picklist(['bolt', 'cycle', 'bow']), weapon: key }), v.strictObject({ host: v.literal('item.swept'), policy: read }),
96
- v.strictObject({ host: v.literal('ammunition'), step: key, refill: key }), v.strictObject({ host: v.literal('boss.ground'), encounter: read, binding: v.unknown() }),
91
+ /** The quest family's four hosts (FORMAT-PRUNE FP16, ONE-FORMAT OF17b3); `quest-server.ts` admits the same rows for the
92
+ * `server/quest` section (`quest-server-section.test.ts` holds the two together), and outlives this plan (FP21). */
93
+ const QUEST_HOST_ROWS = [
97
94
  v.strictObject({ host: v.literal('quest.composition'), rows: read, spots: read, counters: read, document: v.exactOptional(read), table: v.exactOptional(read), contracts: v.exactOptional(read), props: v.exactOptional(read),
98
95
  readSpots: flag, nativeFeats: flag, barter: flag, director: flag, restoring: flag }),
99
96
  // ONE-FORMAT OF22c3: a chapter's wake names a declared boss fight; `population` named the retired mixed population and
100
97
  // stays optional only for writers that still send it
101
98
  v.strictObject({ host: v.literal('quest.chapter'), id: key, rows: read, wake: read, reward: v.unknown(), population: v.exactOptional(key) }),
102
99
  v.strictObject({ host: v.literal('quest.kill-steps'), rows: read, counters: read }),
100
+ v.strictObject({ host: v.literal('quest.body-scripts') }),
101
+ ] as const;
102
+ const feature = v.variant('host', [
103
+ v.strictObject({ host: v.picklist(['decisions', 'commands', 'loadout', 'population.elites-ready', 'population.reactions', 'population.settle', 'riding.elites-ready', 'water.field']) }),
104
+ v.strictObject({ host: v.literal('collision'), skipOnRestore: flag }), v.strictObject({ host: v.literal('collision.pieces'), rows: read }),
105
+ v.strictObject({ host: v.literal('day.keyed-sky') }), v.strictObject({ host: v.literal('day.toon'), start: number, cycle: number, phases: v.record(key, key) }), v.strictObject({ host: v.literal('day.declared'), clock: read }),
106
+ v.strictObject({ host: v.literal('water.sea'), id: key }), v.strictObject({ host: v.literal('combat.motion'), speed: number }),
107
+ v.strictObject({ host: v.literal('item.ranged'), kind: v.picklist(['bolt', 'cycle', 'bow']), weapon: key }), v.strictObject({ host: v.literal('item.swept'), policy: read }),
108
+ v.strictObject({ host: v.literal('ammunition'), step: key, refill: key }), v.strictObject({ host: v.literal('boss.ground'), encounter: read, binding: v.unknown() }),
109
+ ...QUEST_HOST_ROWS,
103
110
  v.strictObject({ host: v.literal('weather.program'), program: read }), v.strictObject({ host: v.literal('weather.native'), program: read, shelters: read, rows: read }),
104
111
  v.strictObject({ host: v.picklist(['population.environment', 'population.shelter', 'population.roster', 'riding.groups']), rows: read }),
105
112
  v.strictObject({ host: v.literal('population.elites'), file: key }),
@@ -135,7 +142,8 @@ export const NativeAssemblySchema: v.GenericSchema<unknown, NativeAssemblyPlan>
135
142
  collision: v.exactOptional(collisionSchema),
136
143
  entries: entriesSchema,
137
144
  boot: v.exactOptional(read), field: v.exactOptional(v.strictObject({ rows: read, pond: key })),
138
- features: v.pipe(v.array(feature), v.minLength(1), v.maxLength(64)),
145
+ // FORMAT-PRUNE FP16: a plan may name no host; each family stands from its `server/*` section
146
+ features: v.pipe(v.array(feature), v.maxLength(64)),
139
147
  }));
140
148
  /** A server JSON file's rows: plain bounded data, admitted by the host that reads them. */
141
149
  export const NativeAssemblyDataSchema: v.GenericSchema<unknown, unknown> = v.pipe(v.unknown(), v.check(isJsonData, 'Native assembly data must be plain bounded JSON'));
@@ -61,6 +61,11 @@ const DATA_SECTION_NAMES: Readonly<Record<keyof PlatformDataSections, true>> = {
61
61
  "look/keyed-sky": true,
62
62
  "client/plan": true,
63
63
  "server/plan": true,
64
+ "server/quest": true,
65
+ "server/riding": true,
66
+ "server/boss": true,
67
+ "server/patrol": true,
68
+ "server/world": true,
64
69
  "view/modules": true,
65
70
  "held/arms": true,
66
71
  "held/gear": true,
@@ -11,6 +11,12 @@ import { ToonLookSchema, type ToonLookRow } from './toonLook.ts';
11
11
  import { KEYED_SKY, type KeyedSkyStyle } from './keyedSky.ts';
12
12
  import { ClientPlanSchema, type ClientPlan } from './clientPlan.ts';
13
13
  import { ServerPlanSchema } from './server-plan.ts';
14
+ import { QuestServerSchema } from './quest-server.ts';
15
+ import type { QuestServer } from './quest-server.ts';
16
+ import { ServerHostsSchema } from './server-hosts.ts';
17
+ import type { ServerHosts } from './server-hosts.ts';
18
+ import { ServerWorldSchema } from './server-world.ts';
19
+ import type { ServerWorld } from './server-world.ts';
14
20
  import type { ServerPlan } from './server-plan.ts';
15
21
  import { SpawnScriptsSchema, type SpawnScriptRows } from './spawnScripts.ts';
16
22
  import { WorldScenesSchema, type WorldScenesSection } from './worldScenes.ts';
@@ -57,6 +63,11 @@ export interface PlatformDataSections {
57
63
  'client/plan': ClientPlan;
58
64
  /** SHARD-COMPAT HS6b: the server's own copy of the feature rows, so `client/plan` stays the page's. */
59
65
  'server/plan': ServerPlan;
66
+ 'server/quest': QuestServer;
67
+ 'server/riding': ServerHosts;
68
+ 'server/boss': ServerHosts;
69
+ 'server/patrol': ServerHosts;
70
+ 'server/world': ServerWorld;
60
71
  'view/modules': ViewModuleRow[];
61
72
  'held/arms': HeldArmsRows;
62
73
  'held/gear': HeldGearRows;
@@ -99,6 +110,11 @@ export const PLATFORM_DATA_SECTIONS: Readonly<{ [Name in keyof PlatformDataSecti
99
110
  'look/keyed-sky': { schema: KEYED_SKY },
100
111
  'client/plan': { schema: ClientPlanSchema },
101
112
  'server/plan': { schema: ServerPlanSchema },
113
+ 'server/quest': { schema: QuestServerSchema },
114
+ 'server/riding': { schema: ServerHostsSchema },
115
+ 'server/boss': { schema: ServerHostsSchema },
116
+ 'server/patrol': { schema: ServerHostsSchema },
117
+ 'server/world': { schema: ServerWorldSchema },
102
118
  'view/modules': { schema: ViewModulesSchema },
103
119
  'held/arms': { schema: HeldArmsSchema },
104
120
  'held/gear': { schema: HeldGearSchema },
@@ -203,6 +203,17 @@ const TABLE: readonly Primitive[] = [
203
203
  on: { section: 'world/field', path: [] },
204
204
  hosts: ['water.field'],
205
205
  },
206
+ {
207
+ name: 'quest',
208
+ row: 'FP16',
209
+ on: { section: 'server/quest', path: ['hosts'] },
210
+ hosts: [
211
+ 'quest.chapter',
212
+ 'quest.kill-steps',
213
+ 'quest.body-scripts',
214
+ 'quest.composition',
215
+ ],
216
+ },
206
217
  {
207
218
  name: 'grapple',
208
219
  row: 'OF41',
@@ -23,14 +23,9 @@ interface DerivedPrimitive {
23
23
  readonly version: number
24
24
  }
25
25
 
26
- /** Hosts HOSTS.md leaves out of the primitives: quest (Q-S5), opened as it is; Nalati's stealth entry (Q-S4). */
27
- const OUT_OF_SCOPE_HOSTS: readonly string[] = Object.freeze([
28
- 'quest.body-scripts',
29
- 'quest.composition',
30
- 'quest.chapter',
31
- 'quest.kill-steps',
32
- 'stealth.entry',
33
- ])
26
+ /** Hosts HOSTS.md leaves out of the primitives: Nalati's stealth entry (Q-S4). The quest hosts (Q-S5) joined the `quest`
27
+ * family when FORMAT-PRUNE FP16 gave them a home (`server/quest`, ONE-FORMAT OF17b3). */
28
+ const OUT_OF_SCOPE_HOSTS: readonly string[] = Object.freeze(['stealth.entry'])
34
29
 
35
30
  const HOST_FAMILY: ReadonlyMap<string, string> = new Map(
36
31
  PRIMITIVES.flatMap((row): (readonly [string, string])[] =>
@@ -0,0 +1,120 @@
1
+ /** FORMAT-PRUNE FP16 (meta; carries ONE-FORMAT OF17b3): `server/quest`, the home of the quest family's server hosts
2
+ * (`quest.chapter`, `quest.kill-steps`, `quest.body-scripts`, `quest.composition`). Its rows are the native plan's own
3
+ * quest rows, in install order (`nativeAssembly.ts` admits the same rows); the engine stands them where a plan names no
4
+ * quest host, so `server/native-assembly.json` no longer lists them. The rows name files and flags only; the
5
+ * server-class files they read stay server class. */
6
+ import {
7
+ array,
8
+ boolean,
9
+ exactOptional,
10
+ literal,
11
+ maxLength,
12
+ minLength,
13
+ pipe,
14
+ strictObject,
15
+ string,
16
+ union,
17
+ unknown,
18
+ variant,
19
+ } from 'valibot'
20
+
21
+ import type {
22
+ NativeAssemblyFeature,
23
+ NativeAssemblyRead,
24
+ } from './nativeAssembly.ts'
25
+ import type { GenericSchema } from 'valibot'
26
+
27
+ /** The section's only version. */
28
+ const VERSION = 1
29
+ /** One row per quest host, at most. */
30
+ const MAX_HOSTS = 4
31
+ /** The longest name a row holds, as the native plan bounds it. */
32
+ const MAX_KEY = 240
33
+ /** The deepest `path` a read walks, as the native plan bounds it. */
34
+ const MAX_PATH = 16
35
+ /** A name is never empty. */
36
+ const MIN_KEY = 1
37
+ /** A section holds at least one quest host. */
38
+ const MIN_HOSTS = 1
39
+
40
+ /** One quest host's row, as a plan or the section holds it. */
41
+ type NativeQuestHostRow = Extract<
42
+ NativeAssemblyFeature,
43
+ {
44
+ host:
45
+ | 'quest.composition'
46
+ | 'quest.chapter'
47
+ | 'quest.kill-steps'
48
+ | 'quest.body-scripts'
49
+ }
50
+ >
51
+
52
+ /** The section's value: the quest hosts in the order they install. */
53
+ interface QuestServer {
54
+ readonly version: typeof VERSION
55
+ readonly hosts: readonly NativeQuestHostRow[]
56
+ }
57
+
58
+ const key = pipe(string(), minLength(MIN_KEY), maxLength(MAX_KEY))
59
+ const path = pipe(array(key), maxLength(MAX_PATH))
60
+ const read: GenericSchema<unknown, NativeAssemblyRead> = union([
61
+ strictObject({ file: key, path: exactOptional(path) }),
62
+ strictObject({ section: key, path: exactOptional(path) }),
63
+ strictObject({ value: unknown() }),
64
+ ])
65
+ const flag = exactOptional(boolean())
66
+
67
+ /** The four quest host rows. */
68
+ const QUEST_HOST_ROWS = [
69
+ strictObject({
70
+ host: literal('quest.composition'),
71
+ rows: read,
72
+ spots: read,
73
+ counters: read,
74
+ document: exactOptional(read),
75
+ table: exactOptional(read),
76
+ contracts: exactOptional(read),
77
+ props: exactOptional(read),
78
+ readSpots: flag,
79
+ nativeFeats: flag,
80
+ barter: flag,
81
+ director: flag,
82
+ restoring: flag,
83
+ }),
84
+ // ONE-FORMAT OF22c3: a chapter's wake names a declared boss fight; `population` named the retired mixed population
85
+ // and stays optional only for writers that still send it
86
+ strictObject({
87
+ host: literal('quest.chapter'),
88
+ id: key,
89
+ rows: read,
90
+ wake: read,
91
+ reward: unknown(),
92
+ population: exactOptional(key),
93
+ }),
94
+ strictObject({
95
+ host: literal('quest.kill-steps'),
96
+ rows: read,
97
+ counters: read,
98
+ }),
99
+ strictObject({ host: literal('quest.body-scripts') }),
100
+ ] as const
101
+
102
+ const NativeQuestHostSchema: GenericSchema<unknown, NativeQuestHostRow> =
103
+ variant('host', QUEST_HOST_ROWS)
104
+
105
+ // A host named twice is refused where the engine stands the family (a `check` would not project to JSON Schema, FP9).
106
+ const QuestServerSchema: GenericSchema<unknown, QuestServer> = strictObject({
107
+ version: literal(VERSION),
108
+ hosts: pipe(
109
+ array(NativeQuestHostSchema),
110
+ minLength(MIN_HOSTS),
111
+ maxLength(MAX_HOSTS),
112
+ ),
113
+ })
114
+
115
+ export {
116
+ type NativeQuestHostRow,
117
+ type QuestServer,
118
+ NativeQuestHostSchema,
119
+ QuestServerSchema,
120
+ }
@@ -11,6 +11,9 @@ import type { KeyedSkyStyle } from './keyedSky.ts';
11
11
  import type { SpawnScriptRows } from './spawnScripts.ts';
12
12
  import type { ClientPlan } from './clientPlan.ts';
13
13
  import type { ServerPlan } from './server-plan.ts';
14
+ import type { QuestServer } from './quest-server.ts';
15
+ import type { ServerHosts } from './server-hosts.ts';
16
+ import type { ServerWorld } from './server-world.ts';
14
17
  import type { NativeSweptPolicyRows } from './items.ts';
15
18
  import type { ReturnModuleRow, ViewModuleRow } from './scriptContract.ts';
16
19
  import type { WorldScenesSection } from './worldScenes.ts';
@@ -65,6 +68,14 @@ export interface PlatformSections {
65
68
  'client/plan': ClientPlan;
66
69
  /** SHARD-COMPAT HS6b: the feature rows the server reads, written beside `client/plan` so the page's plan is the page's. */
67
70
  'server/plan': ServerPlan;
71
+ /** FORMAT-PRUNE FP16: the quest family's server hosts, read by a native world whose plan names none. */
72
+ 'server/quest': QuestServer;
73
+ /** FORMAT-PRUNE FP16d: the riding, boss and patrol families' server hosts, read by a native world whose plan names none. */
74
+ 'server/riding': ServerHosts;
75
+ 'server/boss': ServerHosts;
76
+ 'server/patrol': ServerHosts;
77
+ /** FORMAT-PRUNE FP21: a native world's own settings, beside its family sections; it ships no plan file. */
78
+ 'server/world': ServerWorld;
68
79
  'held/arms': HeldArmsRows;
69
80
  'held/gear': HeldGearRows;
70
81
  'held/finishes': HeldFinishesRows;
@@ -0,0 +1,50 @@
1
+ /** FORMAT-PRUNE FP16d (meta): a primitive family's server hosts, each family in its own section (`server/riding`,
2
+ * `server/boss`, `server/patrol`), so `server/native-assembly.json` lists none. Each row is the native plan's own row for
3
+ * that host, in install order. Here a row is held to the shape that projects to JSON Schema (FP9): it names its `host`;
4
+ * the engine admits each row with the plan's own row schema where it stands the family, as `server/plan` does (HS6b).
5
+ * The quest family's section (`server/quest`) is typed in full (`quest-server.ts`). */
6
+ import {
7
+ array,
8
+ literal,
9
+ looseObject,
10
+ maxLength,
11
+ minLength,
12
+ pipe,
13
+ strictObject,
14
+ string,
15
+ } from 'valibot'
16
+
17
+ import type { GenericSchema } from 'valibot'
18
+
19
+ /** The section's only version. */
20
+ const VERSION = 1
21
+ /** A family stands at least one host. */
22
+ const MIN_HOSTS = 1
23
+ /** The most hosts one family stands. */
24
+ const MAX_HOSTS = 16
25
+
26
+ /** One host's row as the section holds it: its host and its settings. */
27
+ interface ServerHostRow {
28
+ readonly host: string
29
+ readonly [key: string]: unknown
30
+ }
31
+
32
+ /** The section's value: the family's hosts in the order they install. */
33
+ interface ServerHosts {
34
+ readonly version: typeof VERSION
35
+ readonly hosts: readonly ServerHostRow[]
36
+ }
37
+
38
+ const RowSchema = looseObject({ host: string() })
39
+ const RowsSchema = pipe(
40
+ array(RowSchema),
41
+ minLength(MIN_HOSTS),
42
+ maxLength(MAX_HOSTS),
43
+ )
44
+
45
+ const ServerHostsSchema: GenericSchema<unknown, ServerHosts> = strictObject({
46
+ version: literal(VERSION),
47
+ hosts: RowsSchema,
48
+ })
49
+
50
+ export { type ServerHostRow, type ServerHosts, ServerHostsSchema }
@@ -0,0 +1,56 @@
1
+ /** FORMAT-PRUNE FP21 (meta): `server/world`, the native world's own settings that are not a host: its level, terrain,
2
+ * navigation, population bake, collision, entry walks, riding boot rows and field. With the family sections
3
+ * (`server-hosts.ts`, `quest-server.ts`) it replaces `server/native-assembly.json`: a world that holds it ships no plan
4
+ * file. Here the value is held to the shape that projects to JSON Schema (FP9); the engine admits it with the plan's own
5
+ * field schemas where it builds the world. The server-class files these settings name stay server class (FP21 default,
6
+ * coordinator 2026-11-24). */
7
+ import {
8
+ exactOptional,
9
+ literal,
10
+ looseObject,
11
+ string,
12
+ strictObject,
13
+ union,
14
+ } from 'valibot'
15
+
16
+ import type { GenericSchema } from 'valibot'
17
+
18
+ /** The section's only version. */
19
+ const VERSION = 1
20
+
21
+ /** One group of settings: an object the engine admits field by field. */
22
+ type Settings = Readonly<Record<string, unknown>>
23
+
24
+ /** The section's value. */
25
+ interface ServerWorld {
26
+ readonly version: typeof VERSION
27
+ readonly level: Settings
28
+ readonly terrain: Settings & { readonly kind: string }
29
+ readonly navigation: 'shard' | (Settings & { readonly file: string })
30
+ readonly bake?: Settings
31
+ readonly collision?: Settings
32
+ readonly entries: Settings
33
+ readonly boot?: Settings
34
+ readonly field?: Settings
35
+ }
36
+
37
+ const SettingsSchema = looseObject({})
38
+ const TerrainSchema = looseObject({ kind: string() })
39
+ const NavigationSchema = union([
40
+ literal('shard'),
41
+ looseObject({ file: string() }),
42
+ ])
43
+
44
+ const ServerWorldSchema: GenericSchema<unknown, ServerWorld> = strictObject({
45
+ version: literal(VERSION),
46
+ level: SettingsSchema,
47
+ terrain: TerrainSchema,
48
+ navigation: NavigationSchema,
49
+ bake: exactOptional(SettingsSchema),
50
+ collision: exactOptional(SettingsSchema),
51
+ entries: SettingsSchema,
52
+ boot: exactOptional(SettingsSchema),
53
+ field: exactOptional(SettingsSchema),
54
+ })
55
+
56
+ export { type ServerWorld, ServerWorldSchema }
@@ -44,6 +44,26 @@
44
44
  "hosts": ["server serverPlan"],
45
45
  "note": "SHARD-COMPAT HS6b: the server's copy of the feature rows; engine's seam (`src/server/game/shardfile/serverPlan.ts`) reads it, falling back to `client/plan` for a file without one until the roll."
46
46
  },
47
+ "server/world": {
48
+ "hosts": ["server prepareNativeAssembly"],
49
+ "note": "FORMAT-PRUNE FP21: a native world's level, terrain, navigation, bake, collision, entry walks, boot and field; with the family sections it replaces server/native-assembly.json."
50
+ },
51
+ "server/riding": {
52
+ "hosts": ["server prepareNativeAssembly"],
53
+ "note": "FORMAT-PRUNE FP16d: the riding family's server hosts, the native plan's own rows; engine's native world stands them where its plan names none."
54
+ },
55
+ "server/boss": {
56
+ "hosts": ["server prepareNativeAssembly"],
57
+ "note": "FORMAT-PRUNE FP16d: the boss family's server hosts, the native plan's own rows; engine's native world stands them where its plan names none."
58
+ },
59
+ "server/patrol": {
60
+ "hosts": ["server prepareNativeAssembly"],
61
+ "note": "FORMAT-PRUNE FP16d: the patrol family's server hosts, the native plan's own rows; engine's native world stands them where its plan names none."
62
+ },
63
+ "server/quest": {
64
+ "hosts": ["server prepareNativeAssembly"],
65
+ "note": "FORMAT-PRUNE FP16: the quest family's server hosts (`quest.chapter`, `quest.kill-steps`, `quest.body-scripts`, `quest.composition`); engine's native world stands them where its plan names no quest host."
66
+ },
47
67
  "collections/displays": {
48
68
  "hosts": ["page CollectionCatalogue"]
49
69
  },