paracosm 0.9.1113 → 0.9.1115

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 (34) hide show
  1. package/README.md +1 -1
  2. package/dist/cli/verdict-scores.d.ts +2 -1
  3. package/dist/cli/verdict-scores.d.ts.map +1 -1
  4. package/dist/cli/verdict-scores.js +2 -1
  5. package/dist/cli/verdict-scores.js.map +1 -1
  6. package/dist/dashboard/dist/assets/{index-G-Q1siQW.js → index-DZKYPCBt.js} +27 -27
  7. package/dist/dashboard/dist/assets/index-DrZBEElm.css +1 -0
  8. package/dist/dashboard/dist/index.html +2 -2
  9. package/dist/engine/compiler/compile-from-seed.d.ts +32 -8
  10. package/dist/engine/compiler/compile-from-seed.d.ts.map +1 -1
  11. package/dist/engine/compiler/compile-from-seed.js +98 -14
  12. package/dist/engine/compiler/compile-from-seed.js.map +1 -1
  13. package/dist/engine/compiler/seed-draft-world.d.ts +127 -0
  14. package/dist/engine/compiler/seed-draft-world.d.ts.map +1 -0
  15. package/dist/engine/compiler/seed-draft-world.js +479 -0
  16. package/dist/engine/compiler/seed-draft-world.js.map +1 -0
  17. package/dist/engine/compiler/state-shape-block.d.ts.map +1 -1
  18. package/dist/engine/compiler/state-shape-block.js +25 -1
  19. package/dist/engine/compiler/state-shape-block.js.map +1 -1
  20. package/dist/engine/compiler/validate.d.ts +27 -2
  21. package/dist/engine/compiler/validate.d.ts.map +1 -1
  22. package/dist/engine/compiler/validate.js +121 -2
  23. package/dist/engine/compiler/validate.js.map +1 -1
  24. package/dist/engine/types.d.ts +3 -3
  25. package/dist/server/routes/quickstart.d.ts +14 -2
  26. package/dist/server/routes/quickstart.d.ts.map +1 -1
  27. package/dist/server/routes/quickstart.js +13 -5
  28. package/dist/server/routes/quickstart.js.map +1 -1
  29. package/dist/server/server-app.d.ts +35 -0
  30. package/dist/server/server-app.d.ts.map +1 -1
  31. package/dist/server/server-app.js +295 -54
  32. package/dist/server/server-app.js.map +1 -1
  33. package/package.json +1 -1
  34. package/dist/dashboard/dist/assets/index-DwkQQHCH.css +0 -1
@@ -67,8 +67,8 @@
67
67
  }
68
68
  }
69
69
  </script>
70
- <script type="module" crossorigin src="/assets/index-G-Q1siQW.js"></script>
71
- <link rel="stylesheet" crossorigin href="/assets/index-DwkQQHCH.css">
70
+ <script type="module" crossorigin src="/assets/index-DZKYPCBt.js"></script>
71
+ <link rel="stylesheet" crossorigin href="/assets/index-DrZBEElm.css">
72
72
  </head>
73
73
  <body>
74
74
  <a href="#main-content" class="skip-to-content">Skip to main content</a>
@@ -2,11 +2,14 @@
2
2
  * Prompt/document/URL to paracosm scenario compiler (Quickstart).
3
3
  *
4
4
  * Given seed text (optionally with a domain hint), an LLM proposes a
5
- * scenario JSON draft against `DraftScenarioSchema`. The draft routes
6
- * into the existing `compileScenario` pipeline so the `seedText` research
7
- * grounding + hook generation still fire. JSON is the canonical contract;
8
- * this module only provides a convenience entry for callers that start
9
- * from unstructured source material.
5
+ * scenario draft against `DraftScenarioSchema`: the domain's nouns, its
6
+ * departments, its metrics with each one's start and range, and the
7
+ * category tables its events use. `seedDraftToScenarioJson` turns the
8
+ * draft into a scenario JSON whose world holds every declared score, and
9
+ * that JSON routes into the existing `compileScenario` pipeline so the
10
+ * `seedText` research grounding + hook generation still fire. JSON is the
11
+ * canonical contract; this module only provides a convenience entry for
12
+ * callers that start from unstructured source material.
10
13
  *
11
14
  * @module paracosm/compiler/compile-from-seed
12
15
  */
@@ -17,6 +20,11 @@ import type { ScenarioPackage } from '../types.js';
17
20
  * The subset of a scenario JSON the LLM is asked to propose. Lean on
18
21
  * purpose: the compiler's existing pipeline fills in defaults, hooks,
19
22
  * and seed-ingested citations; we only need the domain-specific fields.
23
+ *
24
+ * The fields that say where a metric starts, what bounds it and what its
25
+ * events bring carry no size or range check here. Every rule on them
26
+ * lives in `seedDraftToScenarioJson`, which repairs and never rejects, so
27
+ * none of them can fail a draft.
20
28
  */
21
29
  export declare const DraftScenarioSchema: z.ZodObject<{
22
30
  id: z.ZodString;
@@ -53,7 +61,19 @@ export declare const DraftScenarioSchema: z.ZodObject<{
53
61
  higher: "higher";
54
62
  lower: "lower";
55
63
  }>>;
64
+ label: z.ZodOptional<z.ZodCatch<z.ZodOptional<z.ZodString>>>;
65
+ unit: z.ZodOptional<z.ZodCatch<z.ZodOptional<z.ZodString>>>;
66
+ initial: z.ZodOptional<z.ZodCatch<z.ZodOptional<z.ZodNumber>>>;
67
+ min: z.ZodOptional<z.ZodCatch<z.ZodOptional<z.ZodNumber>>>;
68
+ max: z.ZodOptional<z.ZodCatch<z.ZodOptional<z.ZodNumber>>>;
56
69
  }, z.core.$strip>>;
70
+ effects: z.ZodOptional<z.ZodCatch<z.ZodOptional<z.ZodArray<z.ZodCatch<z.ZodOptional<z.ZodObject<{
71
+ category: z.ZodString;
72
+ entries: z.ZodArray<z.ZodCatch<z.ZodOptional<z.ZodObject<{
73
+ metric: z.ZodString;
74
+ change: z.ZodNumber;
75
+ }, z.core.$strip>>>>;
76
+ }, z.core.$strip>>>>>>>;
57
77
  theme: z.ZodOptional<z.ZodString>;
58
78
  }, z.core.$strip>;
59
79
  export type DraftScenario = z.infer<typeof DraftScenarioSchema>;
@@ -72,9 +92,13 @@ export interface CompileFromSeedOptions extends CompileOptions {
72
92
  }
73
93
  /**
74
94
  * Compile a scenario from seed source material. Calls the LLM to
75
- * propose a `DraftScenario`, validates it via Zod, then routes into
76
- * the existing `compileScenario` pipeline with `seedText` threading
77
- * through for research grounding.
95
+ * propose a `DraftScenario`, validates it via Zod, turns it into a
96
+ * scenario JSON whose world holds every declared score
97
+ * (`seedDraftToScenarioJson`), then routes into the existing
98
+ * `compileScenario` pipeline with `seedText` threading through for
99
+ * research grounding. The categories the knowledge bundle maps are then
100
+ * the category tables' keys, so every event the director is offered has
101
+ * a table.
78
102
  *
79
103
  * Retries up to 3 times on Zod-validation failure. The first failure
80
104
  * usually surfaces as an off-bound numeric (defaultPopulation pasted
@@ -1 +1 @@
1
- {"version":3,"file":"compile-from-seed.d.ts","sourceRoot":"","sources":["../../../src/engine/compiler/compile-from-seed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAInD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmC9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,wEAAwE;AACxE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA4CD,4FAA4F;AAC5F,MAAM,WAAW,sBAAuB,SAAQ,cAAc;IAC5D,qFAAqF;IACrF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,0FAA0F;IAC1F,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,oBAAoB,EAC3B,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,eAAe,CAAC,CAwC1B"}
1
+ {"version":3,"file":"compile-from-seed.d.ts","sourceRoot":"","sources":["../../../src/engine/compiler/compile-from-seed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA6BnD;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2C9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,wEAAwE;AACxE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA6DD,4FAA4F;AAC5F,MAAM,WAAW,sBAAuB,SAAQ,cAAc;IAC5D,qFAAqF;IACrF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,0FAA0F;IAC1F,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,oBAAoB,EAC3B,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,eAAe,CAAC,CA+D1B"}
@@ -2,22 +2,54 @@
2
2
  * Prompt/document/URL to paracosm scenario compiler (Quickstart).
3
3
  *
4
4
  * Given seed text (optionally with a domain hint), an LLM proposes a
5
- * scenario JSON draft against `DraftScenarioSchema`. The draft routes
6
- * into the existing `compileScenario` pipeline so the `seedText` research
7
- * grounding + hook generation still fire. JSON is the canonical contract;
8
- * this module only provides a convenience entry for callers that start
9
- * from unstructured source material.
5
+ * scenario draft against `DraftScenarioSchema`: the domain's nouns, its
6
+ * departments, its metrics with each one's start and range, and the
7
+ * category tables its events use. `seedDraftToScenarioJson` turns the
8
+ * draft into a scenario JSON whose world holds every declared score, and
9
+ * that JSON routes into the existing `compileScenario` pipeline so the
10
+ * `seedText` research grounding + hook generation still fire. JSON is the
11
+ * canonical contract; this module only provides a convenience entry for
12
+ * callers that start from unstructured source material.
10
13
  *
11
14
  * @module paracosm/compiler/compile-from-seed
12
15
  */
13
16
  import { z } from 'zod';
14
17
  import { compileScenario } from './index.js';
18
+ import { seedDraftToScenarioJson } from './seed-draft-world.js';
19
+ import { validateSeedWorld } from './validate.js';
15
20
  import { apiKeyForProvider, resolveProviderFromCredentials } from '../provider/credentials.js';
16
21
  import { generateValidatedObject } from '../../llm/generateValidatedObject.js';
22
+ /**
23
+ * A field that never fails the draft: a value of the wrong type reads as
24
+ * absent, and the normalizer gives the field its default. Optional on the
25
+ * outside, so the provider's strict schema lets the model leave it out;
26
+ * `catch` on the inside, so a wrong type on a route with no provider-side
27
+ * schema does not cost a draft call.
28
+ */
29
+ const lenientString = () => z.string().optional().catch(undefined).optional();
30
+ /** As {@link lenientString}, for a number. */
31
+ const lenientNumber = () => z.number().optional().catch(undefined).optional();
32
+ /** One entry of a category table: the change an event of that kind brings to one metric. */
33
+ const DraftEffectEntrySchema = z.object({
34
+ metric: z.string(),
35
+ change: z.number(),
36
+ });
37
+ /** One category table. An array of these, not a record: a record takes the schema out of strict mode. */
38
+ const DraftEffectTableSchema = z.object({
39
+ category: z.string(),
40
+ // A malformed entry reads as undefined and the normalizer drops it; the
41
+ // table's other entries stay.
42
+ entries: z.array(DraftEffectEntrySchema.optional().catch(undefined)),
43
+ });
17
44
  /**
18
45
  * The subset of a scenario JSON the LLM is asked to propose. Lean on
19
46
  * purpose: the compiler's existing pipeline fills in defaults, hooks,
20
47
  * and seed-ingested citations; we only need the domain-specific fields.
48
+ *
49
+ * The fields that say where a metric starts, what bounds it and what its
50
+ * events bring carry no size or range check here. Every rule on them
51
+ * lives in `seedDraftToScenarioJson`, which repairs and never rejects, so
52
+ * none of them can fail a draft.
21
53
  */
22
54
  export const DraftScenarioSchema = z.object({
23
55
  id: z.string().min(3).max(64).regex(/^[a-z0-9-]+$/, 'kebab-case ids only'),
@@ -52,7 +84,15 @@ export const DraftScenarioSchema = z.object({
52
84
  id: z.string().min(2).max(32).regex(/^[a-z0-9-]+$/),
53
85
  format: z.enum(['number', 'percent', 'currency']).default('number'),
54
86
  better: z.enum(['higher', 'lower']).optional(),
87
+ label: lenientString(),
88
+ unit: lenientString(),
89
+ initial: lenientNumber(),
90
+ min: lenientNumber(),
91
+ max: lenientNumber(),
55
92
  })).min(2).max(12),
93
+ // Lenient as the metric fields are. A malformed table reads as undefined
94
+ // and the normalizer drops it; the other tables stay.
95
+ effects: z.array(DraftEffectTableSchema.optional().catch(undefined)).optional().catch(undefined).optional(),
56
96
  theme: z.string().min(10).max(400).optional(),
57
97
  });
58
98
  /**
@@ -86,11 +126,28 @@ DEPARTMENTS (2-8 entries)
86
126
  - role: 2-80 chars short title.
87
127
  - instructions: 10-400 chars MAX. Keep terse and action-oriented.
88
128
 
89
- METRICS (2-12 entries)
129
+ METRICS (2-12 entries, the most important first: the first four show in the header)
90
130
  - format: one of "number", "percent", "currency".
91
131
  - better (optional): "lower" for a metric that improves as it falls (a churn rate, a defect count, a risk). Omit it for the rest.
132
+ - label: 2-48 chars, the name a reader sees ("Soil health").
133
+ - initial: where the metric stands on day one, a real figure for this domain.
134
+ - percent: the percentage itself, on a 0 to 100 scale. 65 means 65%. Do NOT write a fraction (0.65).
135
+ - number: the figure in its own unit (a stock of 500, an index of 40 out of 100). Start it at 1 or more, or at 0 for a count that starts empty; write a share or a rate as a percent metric.
136
+ - currency: the amount in the scenario's currency (2400000).
137
+ - unit (optional, number and currency only): at most 16 chars ("tonnes", "kW", "points"). A percent needs none.
138
+ - min, max (optional, number and currency only): a floor or a ceiling the metric cannot pass. Give max only where the metric truly has one (a score out of 100). Leave max out for a stock, a count or an amount that can keep growing.
139
+ - The ids "population" (the head count) and "morale" (the mood, a percent) name values the engine keeps itself. Declare them only if the leader steers on them.
92
140
  - Pick the metrics the leader actually steers on, not every available stat.
93
141
 
142
+ EFFECTS (3-8 entries): the kinds of event this world faces, and what each brings
143
+ - category: kebab-case, 2-32 chars, a kind of event ("supply", "regulation", "market", "safety").
144
+ - entries (1-4): what an event of this kind brings when the response is ordinary and competent.
145
+ - metric: the id of one of your metrics, or "morale". Not "population".
146
+ - change: the amount added to that metric, in the metric's own scale. Positive raises it, negative lowers it. For a percent metric write points (4 for four points).
147
+ - Keep each change modest: about a twentieth of where the metric starts, never more than a twelfth. A bold response that works brings about two and a half times as much. A failed response loses a gain, and makes a cost up to four times larger.
148
+ - Give each kind of event a trade-off where the domain has one: a gain on one metric and a cost on another. A cost is a change against the metric's better direction.
149
+ - Every metric must appear in at least one category.
150
+
94
151
  LABELS
95
152
  - name: 2-80 chars, prose-y title for the scenario as a whole.
96
153
  - currency (optional): 1-16 chars, e.g. "USD".
@@ -98,9 +155,13 @@ LABELS
98
155
  Keep all labels natural language. Leave hooks, citations, and implementation details to downstream compilation.`;
99
156
  /**
100
157
  * Compile a scenario from seed source material. Calls the LLM to
101
- * propose a `DraftScenario`, validates it via Zod, then routes into
102
- * the existing `compileScenario` pipeline with `seedText` threading
103
- * through for research grounding.
158
+ * propose a `DraftScenario`, validates it via Zod, turns it into a
159
+ * scenario JSON whose world holds every declared score
160
+ * (`seedDraftToScenarioJson`), then routes into the existing
161
+ * `compileScenario` pipeline with `seedText` threading through for
162
+ * research grounding. The categories the knowledge bundle maps are then
163
+ * the category tables' keys, so every event the director is offered has
164
+ * a table.
104
165
  *
105
166
  * Retries up to 3 times on Zod-validation failure. The first failure
106
167
  * usually surfaces as an off-bound numeric (defaultPopulation pasted
@@ -120,7 +181,7 @@ export async function compileFromSeed(input, options = {}) {
120
181
  const provider = resolveProviderFromCredentials((options.draftProvider ?? options.provider), options, 'anthropic');
121
182
  const model = options.draftModel ?? options.model ?? 'claude-sonnet-4-6';
122
183
  const hint = input.domainHint ? `\n\nDomain hint: ${input.domainHint}` : '';
123
- const prompt = `Seed source material:\n"""\n${input.seedText}\n"""${hint}\n\nRespond with a scenario JSON that matches DraftScenarioSchema. Remember: defaultPopulation must be 10-1000 (representative sample, NOT the real-world headcount from the seed). All ids must be kebab-case. Department instructions must be 10-400 chars.`;
184
+ const prompt = `Seed source material:\n"""\n${input.seedText}\n"""${hint}\n\nRespond with a scenario JSON that matches DraftScenarioSchema. Remember: defaultPopulation must be 10-1000 (representative sample, NOT the real-world headcount from the seed). All ids must be kebab-case. Department instructions must be 10-400 chars. Give every metric its starting value, and list the kinds of event with what each brings.`;
124
185
  let result;
125
186
  try {
126
187
  result = await generateValidatedObject({
@@ -142,13 +203,36 @@ export async function compileFromSeed(input, options = {}) {
142
203
  wrapped.cause = err;
143
204
  throw wrapped;
144
205
  }
145
- // Route the validated draft into the existing compiler with
146
- // seedText grounding so the research + hook-generation stages
147
- // still pull citations and generate TypeScript.
148
- return compileScenario(result.object, {
206
+ // The draft becomes a scenario JSON that declares a world. Each default
207
+ // and repair prints one line, as seed ingestion prints its own. The check
208
+ // holds that JSON to the seed path's rules; an error there is a fault in
209
+ // the normalizer, so it is printed and the compile goes on.
210
+ const { scenario, notes } = seedDraftToScenarioJson(result.object);
211
+ for (const note of notes)
212
+ console.log(` [draft] ${note.message}`);
213
+ for (const error of validateSeedWorld(scenario).errors)
214
+ console.log(` [draft] invariant: ${error}`);
215
+ // Route the scenario JSON into the existing compiler with seedText
216
+ // grounding so the research + hook-generation stages still pull
217
+ // citations and generate TypeScript.
218
+ const compiled = await compileScenario(scenario, {
149
219
  ...options,
150
220
  seedText: input.seedText,
151
221
  seedUrl: input.sourceUrl,
152
222
  });
223
+ // The director is told its category must be one the knowledge bundle
224
+ // maps, and an event reaches a table by exact key. The seed extraction
225
+ // adds categories in free text, which no table carries, so the mapping is
226
+ // rebuilt on the tables' keys: each keeps the topics it was left with, a
227
+ // key with none takes every topic (a milestone reads research by its
228
+ // category alone), and every other key goes. The topics are untouched.
229
+ const merged = compiled.knowledge?.categoryMapping ?? {};
230
+ const topics = Object.keys(compiled.knowledge?.topics ?? {});
231
+ const categoryMapping = {};
232
+ for (const key of Object.keys(scenario.effects)) {
233
+ const kept = Object.prototype.hasOwnProperty.call(merged, key) ? merged[key] : [];
234
+ categoryMapping[key] = kept.length > 0 ? [...kept] : [...topics];
235
+ }
236
+ return { ...compiled, knowledge: { ...compiled.knowledge, categoryMapping } };
153
237
  }
154
238
  //# sourceMappingURL=compile-from-seed.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compile-from-seed.js","sourceRoot":"","sources":["../../../src/engine/compiler/compile-from-seed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7C,OAAO,EAAE,iBAAiB,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAC/F,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAE/E;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,EAAE,qBAAqB,CAAC;IAC1E,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;QACzC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;QACzC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;QACvC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;QAC9C,iEAAiE;QACjE,kEAAkE;QAClE,6DA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,CAAC,SAAS,EAAE,eAAe,EAAE,EAAE,CAAC;AAChF,CAAC"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * From a seed draft to the scenario JSON the compiler takes.
3
+ *
4
+ * `compileFromSeed` asks a model for a draft: the scenario's nouns, its
5
+ * departments, its metrics with each one's start and range, and the
6
+ * category tables its events use. `seedDraftToScenarioJson` turns that
7
+ * draft into the JSON `compileScenario` takes: a `world` that holds every
8
+ * declared score, `metrics` with a label and a source, category tables in
9
+ * the object form, the knowledge bundle's categories keyed by the tables,
10
+ * and the header's scores.
11
+ *
12
+ * It repairs and never rejects. A field the model left out takes a
13
+ * default, a value outside its rule is moved inside it, and each default
14
+ * and repair is noted. It calls no model, it never throws on a draft the
15
+ * draft schema accepted, and the same draft gives the same JSON text.
16
+ *
17
+ * Every number below is the simulation's own choice, not a measured rate.
18
+ *
19
+ * @module paracosm/engine/compiler/seed-draft-world
20
+ */
21
+ import type { DraftScenario } from './compile-from-seed.js';
22
+ /** One default or repair the normalizer applied to a draft. */
23
+ export interface DraftNote {
24
+ /** Where in the draft, e.g. `metrics[1].initial` or `effects[0].entries[2]`. */
25
+ path: string;
26
+ /** The rule that fired, e.g. `default-start` or `entry-above-most`. */
27
+ rule: string;
28
+ /** One line a person can read; `compileFromSeed` prints it. */
29
+ message: string;
30
+ }
31
+ /** Where a metric starts when its draft gives no start and no ceiling, by format. */
32
+ export declare const DEFAULT_STARTS: {
33
+ readonly number: 100;
34
+ readonly percent: 50;
35
+ readonly currency: 1000000;
36
+ };
37
+ /** The kernel's own starting morale, for a declared `morale` with no usable start. */
38
+ export declare const MORALE_START = 0.85;
39
+ /**
40
+ * The largest size a start, a floor or a ceiling is held to, and an entry
41
+ * on a count that starts empty, which has no scale to hold it.
42
+ */
43
+ export declare const MAX_MAGNITUDE = 1000000000000000;
44
+ /** A default table entry is this share of its score's scale: a twentieth. */
45
+ export declare const DEFAULT_ENTRY_SHARE: number;
46
+ /** No table entry is more than this share of its score's scale: a twelfth. */
47
+ export declare const MOST_ENTRY_SHARE: number;
48
+ /** No table entry is less than this share of its score's scale: a hundredth. */
49
+ export declare const LEAST_ENTRY_SHARE: number;
50
+ /** The smallest entry of any size: the outcome step rounds a change to two decimals. */
51
+ export declare const SMALLEST_ENTRY = 0.01;
52
+ /** The default entry of a count that starts empty, which has no scale. */
53
+ export declare const COUNT_FROM_ZERO_ENTRY = 1;
54
+ /** A compiled scenario has at least this many category tables. */
55
+ export declare const MIN_TABLES = 3;
56
+ /** At most this many of a draft's tables are kept. */
57
+ export declare const MAX_TABLES = 8;
58
+ /** At most this many of a draft table's entries are kept. */
59
+ export declare const MAX_DRAFT_ENTRIES = 4;
60
+ /**
61
+ * The categories added, with the default table, while a draft has fewer
62
+ * than {@link MIN_TABLES}: the categories of the Event Director's own
63
+ * canned events, so a director call that fails still lands on a table.
64
+ */
65
+ export declare const DEFAULT_CATEGORIES: readonly ["infrastructure", "resource", "psychological"];
66
+ /** How many declared scores the header shows. */
67
+ export declare const HEADER_METRICS = 4;
68
+ /** A world field as the normalizer writes one (`WorldMetricSchema`, engine/types.ts). */
69
+ export interface SeedWorldField {
70
+ id: string;
71
+ label: string;
72
+ unit: string;
73
+ type: 'number';
74
+ initial: number;
75
+ min?: number;
76
+ max?: number;
77
+ category: 'metric';
78
+ }
79
+ /**
80
+ * The distance a score can move before something stops it.
81
+ *
82
+ * `morale` has its range, 1. Any other score has the smallest of: its start
83
+ * less its floor (when it starts above one), its ceiling less its start
84
+ * (when it starts under one), and the size of its start (when that is not
85
+ * 0). A count that starts empty (a start of 0, no ceiling) has none.
86
+ */
87
+ export declare function scoreScale(id: string, field: {
88
+ initial: number;
89
+ min?: number;
90
+ max?: number;
91
+ }): number | undefined;
92
+ /** The sizes a table entry on one score may have, and the size of its default entry. */
93
+ export interface EntryBounds {
94
+ /** The smallest size an entry may have. */
95
+ least: number;
96
+ /** The largest size an entry may have; absent for a count that starts empty. */
97
+ most?: number;
98
+ /** The size of the score's default entry. */
99
+ standard: number;
100
+ }
101
+ /**
102
+ * What a category table's entry on a score is held to: between a hundredth
103
+ * and a twelfth of the score's scale, with a twentieth as its default, and
104
+ * never under 0.01. A count that starts empty has no scale: its entry is
105
+ * 0.01 or more, 1 by default, and the normalizer holds it to 1e15 in
106
+ * size, as it holds a start.
107
+ *
108
+ * One decision moves a score by its event's outcome and by the department
109
+ * effects the leader adopts. The outcome multiplies a cost by at most 4.81
110
+ * (a bold failure with every modifier against it), and the adopted effects
111
+ * add at most the score's largest entry, so at a twelfth the worst decision
112
+ * moves a score 5.81 twelfths of its scale: under half of it.
113
+ */
114
+ export declare function entryBounds(id: string, field: {
115
+ initial: number;
116
+ min?: number;
117
+ max?: number;
118
+ }): EntryBounds;
119
+ /**
120
+ * Turn a draft the draft schema accepted into the scenario JSON
121
+ * `compileScenario` takes, with a note for each default and repair.
122
+ */
123
+ export declare function seedDraftToScenarioJson(draft: DraftScenario): {
124
+ scenario: Record<string, unknown>;
125
+ notes: DraftNote[];
126
+ };
127
+ //# sourceMappingURL=seed-draft-world.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-draft-world.d.ts","sourceRoot":"","sources":["../../../src/engine/compiler/seed-draft-world.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,+DAA+D;AAC/D,MAAM,WAAW,SAAS;IACxB,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qFAAqF;AACrF,eAAO,MAAM,cAAc;;;;CAA6D,CAAC;AACzF,sFAAsF;AACtF,eAAO,MAAM,YAAY,OAAO,CAAC;AACjC;;;GAGG;AACH,eAAO,MAAM,aAAa,mBAAO,CAAC;AAClC,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,QAAS,CAA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