@plasius/dungeon-crafting 0.1.4 → 0.2.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/README.md CHANGED
@@ -23,12 +23,26 @@ npm install @plasius/dungeon-crafting
23
23
  `@plasius/dungeon-crafting` owns the authority-side boundary for:
24
24
 
25
25
  - DIS-gated access state
26
+ - explicit divine/domain prerequisite contracts
26
27
  - chaos-hotspot severity metadata
27
- - dungeon-crafting intent state
28
+ - Player System and event/regional guidance handoffs into dungeon authority
28
29
  - privacy-safe seal-directive payloads and hotspot throughput assumptions
29
30
  - portable authority-host descriptors
30
31
  - recoverable failure-policy and authority-response contracts
31
32
 
33
+ ## Player System Handoff
34
+
35
+ The Player System may surface chaos hotspots, explain readiness, and collect
36
+ intent, but it does not become the execution authority for dungeon creation or
37
+ world mutation. Once DIS verification, divine authority, and domain alignment
38
+ have been established, the handoff into `@plasius/dungeon-crafting` should
39
+ carry the feature flag, guidance source, domain identifier, domain alignment,
40
+ requested authority tier, and hotspot severity so dungeon-crafting remains the
41
+ authoritative validation and execution boundary.
42
+
43
+ The same handoff surface is intentionally reusable for future arena, event, and
44
+ regional intervention flows by allowing non-Player-System guidance sources.
45
+
32
46
  ## Demo
33
47
 
34
48
  ```bash
@@ -41,10 +55,13 @@ node demo/example.mjs
41
55
  ```ts
42
56
  import {
43
57
  createAuthorityFailurePolicy,
58
+ createDungeonAuthorityPrerequisites,
44
59
  createDungeonAuthorityBoundaryResponse,
45
60
  createDungeonCraftingAccessState,
61
+ createDungeonGuidanceHandoff,
46
62
  createDungeonSealDirectiveRecord,
47
63
  defaultDungeonCraftingThroughputAssumptions,
64
+ dungeonCraftingAuthorityBoundary,
48
65
  dungeonCraftingPrivacyScaleRollout,
49
66
  } from "@plasius/dungeon-crafting";
50
67
 
@@ -54,6 +71,28 @@ const state = createDungeonCraftingAccessState({
54
71
  eligible: true,
55
72
  });
56
73
 
74
+ const prerequisites = createDungeonAuthorityPrerequisites({
75
+ disVerified: true,
76
+ divineAuthorityTier: state.divineAuthorityTier,
77
+ domainId: "domain.northern-rift",
78
+ domainAlignment: "aligned",
79
+ sealClearance: "seal-authority",
80
+ hotspotSeverity: state.hotspotSeverity,
81
+ });
82
+
83
+ const handoff = createDungeonGuidanceHandoff({
84
+ authorityOwner: dungeonCraftingAuthorityBoundary.authorityOwner,
85
+ featureFlagId: dungeonCraftingAuthorityBoundary.featureFlagId,
86
+ guidanceSource: "player-system",
87
+ domainId: prerequisites.domainId,
88
+ domainAlignment: prerequisites.domainAlignment,
89
+ readiness: "eligible",
90
+ hotspotSeverity: prerequisites.hotspotSeverity,
91
+ requestedAuthorityTier: prerequisites.divineAuthorityTier,
92
+ handoffSummary:
93
+ "Player System guidance has verified the prerequisites and is yielding authority to dungeon-crafting.",
94
+ });
95
+
57
96
  const directive = createDungeonSealDirectiveRecord({
58
97
  operatorSubjectId: "operator-sub-1",
59
98
  hotspotId: "hotspot-1",
@@ -63,7 +102,9 @@ const directive = createDungeonSealDirectiveRecord({
63
102
  });
64
103
 
65
104
  console.log(dungeonCraftingPrivacyScaleRollout.featureFlagId);
105
+ console.log(dungeonCraftingAuthorityBoundary.guidanceSources);
66
106
  console.log(defaultDungeonCraftingThroughputAssumptions.maxDirectiveCommitsPerMinute);
107
+ console.log(handoff.guidanceSource);
67
108
  console.log(directive.hotspotId);
68
109
 
69
110
  const failurePolicy = createAuthorityFailurePolicy({
package/dist/index.cjs CHANGED
@@ -27,21 +27,31 @@ __export(index_exports, {
27
27
  DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID: () => DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID,
28
28
  createAuthorityFailurePolicy: () => createAuthorityFailurePolicy,
29
29
  createDungeonAuthorityBoundaryResponse: () => createDungeonAuthorityBoundaryResponse,
30
+ createDungeonAuthorityPrerequisites: () => createDungeonAuthorityPrerequisites,
30
31
  createDungeonCraftingAccessState: () => createDungeonCraftingAccessState,
31
32
  createDungeonCraftingThroughputAssumptions: () => createDungeonCraftingThroughputAssumptions,
33
+ createDungeonGuidanceHandoff: () => createDungeonGuidanceHandoff,
32
34
  createDungeonSealDirectiveRecord: () => createDungeonSealDirectiveRecord,
33
35
  createPortableAuthorityHost: () => createPortableAuthorityHost,
34
36
  defaultDungeonCraftingThroughputAssumptions: () => defaultDungeonCraftingThroughputAssumptions,
37
+ dungeonCraftingAuthorityBoundary: () => dungeonCraftingAuthorityBoundary,
35
38
  dungeonCraftingFieldPolicies: () => dungeonCraftingFieldPolicies,
36
39
  dungeonCraftingPrivacyScaleRollout: () => dungeonCraftingPrivacyScaleRollout,
37
40
  isChaosHotspotSeverity: () => isChaosHotspotSeverity,
38
41
  isDivineAuthorityTier: () => isDivineAuthorityTier,
42
+ isDomainAlignmentState: () => isDomainAlignmentState,
39
43
  packageDescriptor: () => packageDescriptor
40
44
  });
41
45
  module.exports = __toCommonJS(index_exports);
42
46
  var DUNGEON_CRAFTING_PACKAGE = "@plasius/dungeon-crafting";
43
47
  var DUNGEON_CRAFTING_ENV_PREFIX = "DUNGEON_CRAFTING";
44
48
  var DUNGEON_CRAFTING_FEATURE_FLAG_ID = "isekai.dungeon-crafting.enabled";
49
+ var DUNGEON_GUIDANCE_SOURCES = Object.freeze([
50
+ "player-system",
51
+ "arena-orchestrator",
52
+ "event-orchestrator",
53
+ "regional-governor"
54
+ ]);
45
55
  var DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID = "isekai.training-progression.privacy-scale.enabled";
46
56
  var DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE = "DUNGEON_CRAFTING_PRIVACY_SCALE_ENABLED";
47
57
  var packageDescriptor = Object.freeze({
@@ -50,6 +60,19 @@ var packageDescriptor = Object.freeze({
50
60
  envPrefix: DUNGEON_CRAFTING_ENV_PREFIX,
51
61
  summary: "DIS-gated dungeon-crafting and chaos-sealing authority contracts for Plasius."
52
62
  });
63
+ var dungeonCraftingAuthorityBoundary = Object.freeze({
64
+ authorityOwner: "dungeon-crafting",
65
+ featureFlagId: DUNGEON_CRAFTING_FEATURE_FLAG_ID,
66
+ entryGate: "dis-verified",
67
+ guidanceSources: DUNGEON_GUIDANCE_SOURCES,
68
+ prerequisiteKinds: Object.freeze([
69
+ "divine-authority",
70
+ "domain-alignment",
71
+ "chaos-hotspot-sealing"
72
+ ]),
73
+ validationAuthority: "dungeon-crafting",
74
+ executionAuthority: "dungeon-crafting"
75
+ });
53
76
  var dungeonCraftingPrivacyScaleRollout = Object.freeze({
54
77
  featureFlagId: DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID,
55
78
  envOverride: DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE,
@@ -99,12 +122,34 @@ function isDivineAuthorityTier(value) {
99
122
  function isChaosHotspotSeverity(value) {
100
123
  return value === "minor" || value === "major" || value === "catastrophic";
101
124
  }
125
+ function isDomainAlignmentState(value) {
126
+ return value === "aligned" || value === "contested" || value === "sealed";
127
+ }
102
128
  function freezeReadonlyArray(items) {
103
129
  return Object.freeze([...items]);
104
130
  }
105
131
  function createDungeonCraftingAccessState(input) {
106
132
  return Object.freeze({ ...input });
107
133
  }
134
+ function createDungeonAuthorityPrerequisites(input) {
135
+ assertNonEmptyString(input.domainId, "domainId");
136
+ if (!isDivineAuthorityTier(input.divineAuthorityTier)) {
137
+ throw new Error(
138
+ "divineAuthorityTier must be a supported dungeon-crafting authority tier"
139
+ );
140
+ }
141
+ if (!isDomainAlignmentState(input.domainAlignment)) {
142
+ throw new Error(
143
+ "domainAlignment must be a supported dungeon-crafting domain alignment state"
144
+ );
145
+ }
146
+ if (!isChaosHotspotSeverity(input.hotspotSeverity)) {
147
+ throw new Error(
148
+ "hotspotSeverity must be a supported dungeon-crafting hotspot severity"
149
+ );
150
+ }
151
+ return Object.freeze({ ...input });
152
+ }
108
153
  function assertNonEmptyString(value, label) {
109
154
  if (value.trim().length === 0) {
110
155
  throw new Error(`${label} must be a non-empty string`);
@@ -167,6 +212,26 @@ function createAuthorityFailurePolicy(input) {
167
212
  )
168
213
  });
169
214
  }
215
+ function createDungeonGuidanceHandoff(input) {
216
+ assertNonEmptyString(input.domainId, "domainId");
217
+ assertNonEmptyString(input.handoffSummary, "handoffSummary");
218
+ if (!isDomainAlignmentState(input.domainAlignment)) {
219
+ throw new Error(
220
+ "domainAlignment must be a supported dungeon-crafting domain alignment state"
221
+ );
222
+ }
223
+ if (!isDivineAuthorityTier(input.requestedAuthorityTier)) {
224
+ throw new Error(
225
+ "requestedAuthorityTier must be a supported dungeon-crafting authority tier"
226
+ );
227
+ }
228
+ if (!isChaosHotspotSeverity(input.hotspotSeverity)) {
229
+ throw new Error(
230
+ "hotspotSeverity must be a supported dungeon-crafting hotspot severity"
231
+ );
232
+ }
233
+ return Object.freeze({ ...input });
234
+ }
170
235
  function createDungeonAuthorityBoundaryResponse(input) {
171
236
  return Object.freeze({
172
237
  ...input,
@@ -183,15 +248,19 @@ function createDungeonAuthorityBoundaryResponse(input) {
183
248
  DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID,
184
249
  createAuthorityFailurePolicy,
185
250
  createDungeonAuthorityBoundaryResponse,
251
+ createDungeonAuthorityPrerequisites,
186
252
  createDungeonCraftingAccessState,
187
253
  createDungeonCraftingThroughputAssumptions,
254
+ createDungeonGuidanceHandoff,
188
255
  createDungeonSealDirectiveRecord,
189
256
  createPortableAuthorityHost,
190
257
  defaultDungeonCraftingThroughputAssumptions,
258
+ dungeonCraftingAuthorityBoundary,
191
259
  dungeonCraftingFieldPolicies,
192
260
  dungeonCraftingPrivacyScaleRollout,
193
261
  isChaosHotspotSeverity,
194
262
  isDivineAuthorityTier,
263
+ isDomainAlignmentState,
195
264
  packageDescriptor
196
265
  });
197
266
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export interface PackageDescriptor {\n readonly packageName: string;\n readonly featureFlagId: string;\n readonly envPrefix: string;\n readonly summary: string;\n}\n\nexport interface RolloutDescriptor {\n readonly featureFlagId: string;\n readonly envOverride: string;\n readonly rollbackPlan: string;\n readonly summary: string;\n}\n\nexport type DivineAuthorityTier = \"follower\" | \"near-seat\" | \"seat\";\n\nexport type ChaosHotspotSeverity = \"minor\" | \"major\" | \"catastrophic\";\nexport type DungeonCraftingFieldSensitivity = \"pseudonymous\" | \"internal\";\nexport type DungeonCraftingFieldRetention =\n | \"authoritative-sealing\"\n | \"short-lived\";\n\nexport type DungeonAuthorityOutcome = \"granted\" | \"deferred\" | \"rejected\";\n\nexport type AuthorityHostRuntime = \"browser\" | \"server\" | \"worker\";\n\nexport type AuthorityHostTransport = \"in-process\" | \"http\" | \"queue\";\n\nexport interface DungeonCraftingAccessState {\n readonly divineAuthorityTier: DivineAuthorityTier;\n readonly hotspotSeverity: ChaosHotspotSeverity;\n readonly eligible: boolean;\n}\n\nexport interface DungeonSealDirectiveRecord {\n readonly operatorSubjectId: string;\n readonly hotspotId: string;\n readonly divineAuthorityTier: DivineAuthorityTier;\n readonly hotspotSeverity: ChaosHotspotSeverity;\n readonly updatedAtIso: string;\n}\n\nexport interface DungeonCraftingFieldPolicy {\n readonly field: keyof DungeonSealDirectiveRecord;\n readonly sensitivity: DungeonCraftingFieldSensitivity;\n readonly retention: DungeonCraftingFieldRetention;\n readonly justification: string;\n}\n\nexport interface DungeonCraftingThroughputAssumptions {\n readonly maxConcurrentSealOperations: number;\n readonly maxHotspotEvaluationsPerMinute: number;\n readonly maxDirectiveCommitsPerMinute: number;\n}\n\nexport interface PortableAuthorityHost {\n readonly hostId: string;\n readonly runtime: AuthorityHostRuntime;\n readonly transport: AuthorityHostTransport;\n readonly capabilityFlags: readonly string[];\n}\n\nexport interface AuthorityFailurePolicy {\n readonly timeoutMs: number;\n readonly maxAttempts: number;\n readonly recoverableHotspotSeverities: readonly ChaosHotspotSeverity[];\n readonly escalationTarget: \"operator\" | \"divine-seat\" | \"sealed-fallback\";\n}\n\nexport interface DungeonAuthorityBoundaryResponse {\n readonly responseId: string;\n readonly divineAuthorityTier: DivineAuthorityTier;\n readonly hotspotSeverity: ChaosHotspotSeverity;\n readonly outcome: DungeonAuthorityOutcome;\n readonly eligible: boolean;\n readonly sourceHost: PortableAuthorityHost;\n readonly failurePolicy: AuthorityFailurePolicy;\n readonly observedAt: string;\n}\n\nexport const DUNGEON_CRAFTING_PACKAGE = \"@plasius/dungeon-crafting\";\nexport const DUNGEON_CRAFTING_ENV_PREFIX = \"DUNGEON_CRAFTING\";\nexport const DUNGEON_CRAFTING_FEATURE_FLAG_ID = \"isekai.dungeon-crafting.enabled\";\nexport const DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID =\n \"isekai.training-progression.privacy-scale.enabled\";\nexport const DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE =\n \"DUNGEON_CRAFTING_PRIVACY_SCALE_ENABLED\";\n\nexport const packageDescriptor: PackageDescriptor = Object.freeze({\n packageName: DUNGEON_CRAFTING_PACKAGE,\n featureFlagId: DUNGEON_CRAFTING_FEATURE_FLAG_ID,\n envPrefix: DUNGEON_CRAFTING_ENV_PREFIX,\n summary:\n \"DIS-gated dungeon-crafting and chaos-sealing authority contracts for Plasius.\",\n});\n\nexport const dungeonCraftingPrivacyScaleRollout: RolloutDescriptor =\n Object.freeze({\n featureFlagId: DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID,\n envOverride: DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE,\n rollbackPlan:\n \"Disable the dungeon-crafting privacy/scale rollout to fall back to the existing chaos-sealing access contract surface.\",\n summary:\n \"Rolls out minimal seal-directive payloads and documented hotspot throughput assumptions.\",\n });\n\nexport const dungeonCraftingFieldPolicies = Object.freeze<\n readonly DungeonCraftingFieldPolicy[]\n>([\n {\n field: \"operatorSubjectId\",\n sensitivity: \"pseudonymous\",\n retention: \"authoritative-sealing\",\n justification:\n \"Stable pseudonymous subject identifier is required to attribute sealing authority without carrying profile names or contact data.\",\n },\n {\n field: \"hotspotId\",\n sensitivity: \"internal\",\n retention: \"authoritative-sealing\",\n justification:\n \"Hotspot identifier is the minimum routing key needed to coordinate chaos-sealing directives.\",\n },\n {\n field: \"divineAuthorityTier\",\n sensitivity: \"internal\",\n retention: \"authoritative-sealing\",\n justification:\n \"Authority tier is the smallest access-state field needed to validate whether a sealing directive may execute.\",\n },\n {\n field: \"hotspotSeverity\",\n sensitivity: \"internal\",\n retention: \"authoritative-sealing\",\n justification:\n \"Hotspot severity determines sealing urgency and throughput budgeting without duplicating full dungeon telemetry.\",\n },\n {\n field: \"updatedAtIso\",\n sensitivity: \"internal\",\n retention: \"short-lived\",\n justification:\n \"Update timestamp supports bounded ordering and replay protection for rapid hotspot updates.\",\n },\n]);\n\nexport const defaultDungeonCraftingThroughputAssumptions: DungeonCraftingThroughputAssumptions =\n Object.freeze({\n maxConcurrentSealOperations: 800,\n maxHotspotEvaluationsPerMinute: 6_000,\n maxDirectiveCommitsPerMinute: 12_000,\n });\n\nexport function isDivineAuthorityTier(\n value: string\n): value is DivineAuthorityTier {\n return value === \"follower\" || value === \"near-seat\" || value === \"seat\";\n}\n\nexport function isChaosHotspotSeverity(\n value: string\n): value is ChaosHotspotSeverity {\n return value === \"minor\" || value === \"major\" || value === \"catastrophic\";\n}\n\nfunction freezeReadonlyArray<T>(items: readonly T[]): readonly T[] {\n return Object.freeze([...items]);\n}\n\nexport function createDungeonCraftingAccessState(\n input: DungeonCraftingAccessState\n): DungeonCraftingAccessState {\n return Object.freeze({ ...input });\n}\n\nfunction assertNonEmptyString(value: string, label: string): void {\n if (value.trim().length === 0) {\n throw new Error(`${label} must be a non-empty string`);\n }\n}\n\nfunction assertPositiveSafeInteger(value: number, label: string): void {\n if (!Number.isSafeInteger(value) || value <= 0) {\n throw new Error(`${label} must be a positive safe integer`);\n }\n}\n\nconst iso8601DateRegex =\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?(?:Z|[+-]\\d{2}:\\d{2})$/;\n\nfunction assertValidUpdatedAtIso(value: string): void {\n if (!iso8601DateRegex.test(value) || Number.isNaN(Date.parse(value))) {\n throw new Error(\"updatedAtIso must be an ISO-8601 timestamp\");\n }\n}\n\nexport function createDungeonSealDirectiveRecord(\n input: DungeonSealDirectiveRecord\n): DungeonSealDirectiveRecord {\n assertNonEmptyString(input.operatorSubjectId, \"operatorSubjectId\");\n assertNonEmptyString(input.hotspotId, \"hotspotId\");\n assertNonEmptyString(input.updatedAtIso, \"updatedAtIso\");\n assertValidUpdatedAtIso(input.updatedAtIso);\n\n if (!isDivineAuthorityTier(input.divineAuthorityTier)) {\n throw new Error(\n \"divineAuthorityTier must be a supported dungeon-crafting authority tier\"\n );\n }\n\n if (!isChaosHotspotSeverity(input.hotspotSeverity)) {\n throw new Error(\n \"hotspotSeverity must be a supported dungeon-crafting hotspot severity\"\n );\n }\n\n return Object.freeze({ ...input });\n}\n\nexport function createDungeonCraftingThroughputAssumptions(\n input: DungeonCraftingThroughputAssumptions\n): DungeonCraftingThroughputAssumptions {\n assertPositiveSafeInteger(\n input.maxConcurrentSealOperations,\n \"maxConcurrentSealOperations\"\n );\n assertPositiveSafeInteger(\n input.maxHotspotEvaluationsPerMinute,\n \"maxHotspotEvaluationsPerMinute\"\n );\n assertPositiveSafeInteger(\n input.maxDirectiveCommitsPerMinute,\n \"maxDirectiveCommitsPerMinute\"\n );\n\n return Object.freeze({ ...input });\n}\n\nexport function createPortableAuthorityHost(\n input: PortableAuthorityHost\n): PortableAuthorityHost {\n return Object.freeze({\n ...input,\n capabilityFlags: freezeReadonlyArray(input.capabilityFlags),\n });\n}\n\nexport function createAuthorityFailurePolicy(\n input: AuthorityFailurePolicy\n): AuthorityFailurePolicy {\n return Object.freeze({\n ...input,\n recoverableHotspotSeverities: freezeReadonlyArray(\n input.recoverableHotspotSeverities\n ),\n });\n}\n\nexport function createDungeonAuthorityBoundaryResponse(\n input: DungeonAuthorityBoundaryResponse\n): DungeonAuthorityBoundaryResponse {\n return Object.freeze({\n ...input,\n sourceHost: createPortableAuthorityHost(input.sourceHost),\n failurePolicy: createAuthorityFailurePolicy(input.failurePolicy),\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgFO,IAAM,2BAA2B;AACjC,IAAM,8BAA8B;AACpC,IAAM,mCAAmC;AACzC,IAAM,iDACX;AACK,IAAM,8CACX;AAEK,IAAM,oBAAuC,OAAO,OAAO;AAAA,EAChE,aAAa;AAAA,EACb,eAAe;AAAA,EACf,WAAW;AAAA,EACX,SACE;AACJ,CAAC;AAEM,IAAM,qCACX,OAAO,OAAO;AAAA,EACZ,eAAe;AAAA,EACf,aAAa;AAAA,EACb,cACE;AAAA,EACF,SACE;AACJ,CAAC;AAEI,IAAM,+BAA+B,OAAO,OAEjD;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,IACb,WAAW;AAAA,IACX,eACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,IACb,WAAW;AAAA,IACX,eACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,IACb,WAAW;AAAA,IACX,eACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,IACb,WAAW;AAAA,IACX,eACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,IACb,WAAW;AAAA,IACX,eACE;AAAA,EACJ;AACF,CAAC;AAEM,IAAM,8CACX,OAAO,OAAO;AAAA,EACZ,6BAA6B;AAAA,EAC7B,gCAAgC;AAAA,EAChC,8B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AACtC;AAAA,IACE,MAAM;AAAA,IACN;AAAA,EACF;AACA;AAAA,IACE,MAAM;AAAA,IACN;AAAA,EACF;AACA;AAAA,IACE,MAAM;AAAA,IACN;AAAA,EACF;AAEA,SAAO,OAAO,OAAO,EAAE,GAAG,MAAM,CAAC;AACnC;AAEO,SAAS,4BACd,OACuB;AACvB,SAAO,OAAO,OAAO;AAAA,IACnB,GAAG;AAAA,IACH,iBAAiB,oBAAoB,MAAM,eAAe;AAAA,EAC5D,CAAC;AACH;AAEO,SAAS,6BACd,OACwB;AACxB,SAAO,OAAO,OAAO;AAAA,IACnB,GAAG;AAAA,IACH,8BAA8B;AAAA,MAC5B,MAAM;AAAA,IACR;AAAA,EACF,CAAC;AACH;AAEO,SAAS,uCACd,OACkC;AAClC,SAAO,OAAO,OAAO;AAAA,IACnB,GAAG;AAAA,IACH,YAAY,4BAA4B,MAAM,UAAU;AAAA,IACxD,eAAe,6BAA6B,MAAM,aAAa;AAAA,EACjE,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export interface PackageDescriptor {\n readonly packageName: string;\n readonly featureFlagId: string;\n readonly envPrefix: string;\n readonly summary: string;\n}\n\nexport interface RolloutDescriptor {\n readonly featureFlagId: string;\n readonly envOverride: string;\n readonly rollbackPlan: string;\n readonly summary: string;\n}\n\nexport type DungeonAuthorityOwner = \"dungeon-crafting\";\nexport type DivineAuthorityTier = \"follower\" | \"near-seat\" | \"seat\";\nexport type ChaosHotspotSeverity = \"minor\" | \"major\" | \"catastrophic\";\nexport type DomainAlignmentState = \"aligned\" | \"contested\" | \"sealed\";\nexport type ChaosSealClearance =\n | \"hotspot-watch\"\n | \"seal-authority\"\n | \"seat-override\";\nexport type DungeonGuidanceSource =\n | \"player-system\"\n | \"arena-orchestrator\"\n | \"event-orchestrator\"\n | \"regional-governor\";\nexport type DungeonHandoffReadiness =\n | \"eligible\"\n | \"needs-domain-clearance\"\n | \"blocked\";\nexport type DungeonCraftingFieldSensitivity = \"pseudonymous\" | \"internal\";\nexport type DungeonCraftingFieldRetention =\n | \"authoritative-sealing\"\n | \"short-lived\";\n\nexport type DungeonAuthorityOutcome = \"granted\" | \"deferred\" | \"rejected\";\n\nexport type AuthorityHostRuntime = \"browser\" | \"server\" | \"worker\";\n\nexport type AuthorityHostTransport = \"in-process\" | \"http\" | \"queue\";\n\nexport interface DungeonAuthorityBoundary {\n readonly authorityOwner: DungeonAuthorityOwner;\n readonly featureFlagId: string;\n readonly entryGate: \"dis-verified\";\n readonly guidanceSources: readonly DungeonGuidanceSource[];\n readonly prerequisiteKinds: readonly [\n \"divine-authority\",\n \"domain-alignment\",\n \"chaos-hotspot-sealing\",\n ];\n readonly validationAuthority: DungeonAuthorityOwner;\n readonly executionAuthority: DungeonAuthorityOwner;\n}\n\nexport interface DungeonCraftingAccessState {\n readonly divineAuthorityTier: DivineAuthorityTier;\n readonly hotspotSeverity: ChaosHotspotSeverity;\n readonly eligible: boolean;\n}\n\nexport interface DungeonAuthorityPrerequisites {\n readonly disVerified: boolean;\n readonly divineAuthorityTier: DivineAuthorityTier;\n readonly domainId: string;\n readonly domainAlignment: DomainAlignmentState;\n readonly sealClearance: ChaosSealClearance;\n readonly hotspotSeverity: ChaosHotspotSeverity;\n}\n\nexport interface DungeonGuidanceHandoff {\n readonly authorityOwner: DungeonAuthorityOwner;\n readonly featureFlagId: string;\n readonly guidanceSource: DungeonGuidanceSource;\n readonly domainId: string;\n readonly domainAlignment: DomainAlignmentState;\n readonly readiness: DungeonHandoffReadiness;\n readonly hotspotSeverity: ChaosHotspotSeverity;\n readonly requestedAuthorityTier: DivineAuthorityTier;\n readonly handoffSummary: string;\n}\n\nexport interface DungeonSealDirectiveRecord {\n readonly operatorSubjectId: string;\n readonly hotspotId: string;\n readonly divineAuthorityTier: DivineAuthorityTier;\n readonly hotspotSeverity: ChaosHotspotSeverity;\n readonly updatedAtIso: string;\n}\n\nexport interface DungeonCraftingFieldPolicy {\n readonly field: keyof DungeonSealDirectiveRecord;\n readonly sensitivity: DungeonCraftingFieldSensitivity;\n readonly retention: DungeonCraftingFieldRetention;\n readonly justification: string;\n}\n\nexport interface DungeonCraftingThroughputAssumptions {\n readonly maxConcurrentSealOperations: number;\n readonly maxHotspotEvaluationsPerMinute: number;\n readonly maxDirectiveCommitsPerMinute: number;\n}\n\nexport interface PortableAuthorityHost {\n readonly hostId: string;\n readonly runtime: AuthorityHostRuntime;\n readonly transport: AuthorityHostTransport;\n readonly capabilityFlags: readonly string[];\n}\n\nexport interface AuthorityFailurePolicy {\n readonly timeoutMs: number;\n readonly maxAttempts: number;\n readonly recoverableHotspotSeverities: readonly ChaosHotspotSeverity[];\n readonly escalationTarget: \"operator\" | \"divine-seat\" | \"sealed-fallback\";\n}\n\nexport interface DungeonAuthorityBoundaryResponse {\n readonly responseId: string;\n readonly divineAuthorityTier: DivineAuthorityTier;\n readonly hotspotSeverity: ChaosHotspotSeverity;\n readonly outcome: DungeonAuthorityOutcome;\n readonly eligible: boolean;\n readonly sourceHost: PortableAuthorityHost;\n readonly failurePolicy: AuthorityFailurePolicy;\n readonly observedAt: string;\n}\n\nexport const DUNGEON_CRAFTING_PACKAGE = \"@plasius/dungeon-crafting\";\nexport const DUNGEON_CRAFTING_ENV_PREFIX = \"DUNGEON_CRAFTING\";\nexport const DUNGEON_CRAFTING_FEATURE_FLAG_ID = \"isekai.dungeon-crafting.enabled\";\nconst DUNGEON_GUIDANCE_SOURCES = Object.freeze([\n \"player-system\",\n \"arena-orchestrator\",\n \"event-orchestrator\",\n \"regional-governor\",\n] as const);\nexport const DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID =\n \"isekai.training-progression.privacy-scale.enabled\";\nexport const DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE =\n \"DUNGEON_CRAFTING_PRIVACY_SCALE_ENABLED\";\n\nexport const packageDescriptor: PackageDescriptor = Object.freeze({\n packageName: DUNGEON_CRAFTING_PACKAGE,\n featureFlagId: DUNGEON_CRAFTING_FEATURE_FLAG_ID,\n envPrefix: DUNGEON_CRAFTING_ENV_PREFIX,\n summary:\n \"DIS-gated dungeon-crafting and chaos-sealing authority contracts for Plasius.\",\n});\n\nexport const dungeonCraftingAuthorityBoundary: DungeonAuthorityBoundary =\n Object.freeze({\n authorityOwner: \"dungeon-crafting\",\n featureFlagId: DUNGEON_CRAFTING_FEATURE_FLAG_ID,\n entryGate: \"dis-verified\",\n guidanceSources: DUNGEON_GUIDANCE_SOURCES,\n prerequisiteKinds: Object.freeze([\n \"divine-authority\",\n \"domain-alignment\",\n \"chaos-hotspot-sealing\",\n ] as const),\n validationAuthority: \"dungeon-crafting\",\n executionAuthority: \"dungeon-crafting\",\n });\n\nexport const dungeonCraftingPrivacyScaleRollout: RolloutDescriptor =\n Object.freeze({\n featureFlagId: DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID,\n envOverride: DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE,\n rollbackPlan:\n \"Disable the dungeon-crafting privacy/scale rollout to fall back to the existing chaos-sealing access contract surface.\",\n summary:\n \"Rolls out minimal seal-directive payloads and documented hotspot throughput assumptions.\",\n });\n\nexport const dungeonCraftingFieldPolicies = Object.freeze<\n readonly DungeonCraftingFieldPolicy[]\n>([\n {\n field: \"operatorSubjectId\",\n sensitivity: \"pseudonymous\",\n retention: \"authoritative-sealing\",\n justification:\n \"Stable pseudonymous subject identifier is required to attribute sealing authority without carrying profile names or contact data.\",\n },\n {\n field: \"hotspotId\",\n sensitivity: \"internal\",\n retention: \"authoritative-sealing\",\n justification:\n \"Hotspot identifier is the minimum routing key needed to coordinate chaos-sealing directives.\",\n },\n {\n field: \"divineAuthorityTier\",\n sensitivity: \"internal\",\n retention: \"authoritative-sealing\",\n justification:\n \"Authority tier is the smallest access-state field needed to validate whether a sealing directive may execute.\",\n },\n {\n field: \"hotspotSeverity\",\n sensitivity: \"internal\",\n retention: \"authoritative-sealing\",\n justification:\n \"Hotspot severity determines sealing urgency and throughput budgeting without duplicating full dungeon telemetry.\",\n },\n {\n field: \"updatedAtIso\",\n sensitivity: \"internal\",\n retention: \"short-lived\",\n justification:\n \"Update timestamp supports bounded ordering and replay protection for rapid hotspot updates.\",\n },\n]);\n\nexport const defaultDungeonCraftingThroughputAssumptions: DungeonCraftingThroughputAssumptions =\n Object.freeze({\n maxConcurrentSealOperations: 800,\n maxHotspotEvaluationsPerMinute: 6_000,\n maxDirectiveCommitsPerMinute: 12_000,\n });\n\nexport function isDivineAuthorityTier(\n value: string\n): value is DivineAuthorityTier {\n return value === \"follower\" || value === \"near-seat\" || value === \"seat\";\n}\n\nexport function isChaosHotspotSeverity(\n value: string\n): value is ChaosHotspotSeverity {\n return value === \"minor\" || value === \"major\" || value === \"catastrophic\";\n}\n\nexport function isDomainAlignmentState(\n value: string\n): value is DomainAlignmentState {\n return value === \"aligned\" || value === \"contested\" || value === \"sealed\";\n}\n\nfunction freezeReadonlyArray<T>(items: readonly T[]): readonly T[] {\n return Object.freeze([...items]);\n}\n\nexport function createDungeonCraftingAccessState(\n input: DungeonCraftingAccessState\n): DungeonCraftingAccessState {\n return Object.freeze({ ...input });\n}\n\nexport function createDungeonAuthorityPrerequisites(\n input: DungeonAuthorityPrerequisites\n): DungeonAuthorityPrerequisites {\n assertNonEmptyString(input.domainId, \"domainId\");\n\n if (!isDivineAuthorityTier(input.divineAuthorityTier)) {\n throw new Error(\n \"divineAuthorityTier must be a supported dungeon-crafting authority tier\"\n );\n }\n\n if (!isDomainAlignmentState(input.domainAlignment)) {\n throw new Error(\n \"domainAlignment must be a supported dungeon-crafting domain alignment state\"\n );\n }\n\n if (!isChaosHotspotSeverity(input.hotspotSeverity)) {\n throw new Error(\n \"hotspotSeverity must be a supported dungeon-crafting hotspot severity\"\n );\n }\n\n return Object.freeze({ ...input });\n}\n\nfunction assertNonEmptyString(value: string, label: string): void {\n if (value.trim().length === 0) {\n throw new Error(`${label} must be a non-empty string`);\n }\n}\n\nfunction assertPositiveSafeInteger(value: number, label: string): void {\n if (!Number.isSafeInteger(value) || value <= 0) {\n throw new Error(`${label} must be a positive safe integer`);\n }\n}\n\nconst iso8601DateRegex =\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?(?:Z|[+-]\\d{2}:\\d{2})$/;\n\nfunction assertValidUpdatedAtIso(value: string): void {\n if (!iso8601DateRegex.test(value) || Number.isNaN(Date.parse(value))) {\n throw new Error(\"updatedAtIso must be an ISO-8601 timestamp\");\n }\n}\n\nexport function createDungeonSealDirectiveRecord(\n input: DungeonSealDirectiveRecord\n): DungeonSealDirectiveRecord {\n assertNonEmptyString(input.operatorSubjectId, \"operatorSubjectId\");\n assertNonEmptyString(input.hotspotId, \"hotspotId\");\n assertNonEmptyString(input.updatedAtIso, \"updatedAtIso\");\n assertValidUpdatedAtIso(input.updatedAtIso);\n\n if (!isDivineAuthorityTier(input.divineAuthorityTier)) {\n throw new Error(\n \"divineAuthorityTier must be a supported dungeon-crafting authority tier\"\n );\n }\n\n if (!isChaosHotspotSeverity(input.hotspotSeverity)) {\n throw new Error(\n \"hotspotSeverity must be a supported dungeon-crafting hotspot severity\"\n );\n }\n\n return Object.freeze({ ...input });\n}\n\nexport function createDungeonCraftingThroughputAssumptions(\n input: DungeonCraftingThroughputAssumptions\n): DungeonCraftingThroughputAssumptions {\n assertPositiveSafeInteger(\n input.maxConcurrentSealOperations,\n \"maxConcurrentSealOperations\"\n );\n assertPositiveSafeInteger(\n input.maxHotspotEvaluationsPerMinute,\n \"maxHotspotEvaluationsPerMinute\"\n );\n assertPositiveSafeInteger(\n input.maxDirectiveCommitsPerMinute,\n \"maxDirectiveCommitsPerMinute\"\n );\n\n return Object.freeze({ ...input });\n}\n\nexport function createPortableAuthorityHost(\n input: PortableAuthorityHost\n): PortableAuthorityHost {\n return Object.freeze({\n ...input,\n capabilityFlags: freezeReadonlyArray(input.capabilityFlags),\n });\n}\n\nexport function createAuthorityFailurePolicy(\n input: AuthorityFailurePolicy\n): AuthorityFailurePolicy {\n return Object.freeze({\n ...input,\n recoverableHotspotSeverities: freezeReadonlyArray(\n input.recoverableHotspotSeverities\n ),\n });\n}\n\nexport function createDungeonGuidanceHandoff(\n input: DungeonGuidanceHandoff\n): DungeonGuidanceHandoff {\n assertNonEmptyString(input.domainId, \"domainId\");\n assertNonEmptyString(input.handoffSummary, \"handoffSummary\");\n\n if (!isDomainAlignmentState(input.domainAlignment)) {\n throw new Error(\n \"domainAlignment must be a supported dungeon-crafting domain alignment state\"\n );\n }\n\n if (!isDivineAuthorityTier(input.requestedAuthorityTier)) {\n throw new Error(\n \"requestedAuthorityTier must be a supported dungeon-crafting authority tier\"\n );\n }\n\n if (!isChaosHotspotSeverity(input.hotspotSeverity)) {\n throw new Error(\n \"hotspotSeverity must be a supported dungeon-crafting hotspot severity\"\n );\n }\n\n return Object.freeze({ ...input });\n}\n\nexport function createDungeonAuthorityBoundaryResponse(\n input: DungeonAuthorityBoundaryResponse\n): DungeonAuthorityBoundaryResponse {\n return Object.freeze({\n ...input,\n sourceHost: createPortableAuthorityHost(input.sourceHost),\n failurePolicy: createAuthorityFailurePolicy(input.failurePolicy),\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiIO,IAAM,2BAA2B;AACjC,IAAM,8BAA8B;AACpC,IAAM,mCAAmC;AAChD,IAAM,2BAA2B,OAAO,OAAO;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAU;AACH,IAAM,iDACX;AACK,IAAM,8CACX;AAEK,IAAM,oBAAuC,OAAO,OAAO;AAAA,EAChE,aAAa;AAAA,EACb,eAAe;AAAA,EACf,WAAW;AAAA,EACX,SACE;AACJ,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names":[]}
package/dist/index.d.cts CHANGED
@@ -10,18 +10,55 @@ interface RolloutDescriptor {
10
10
  readonly rollbackPlan: string;
11
11
  readonly summary: string;
12
12
  }
13
+ type DungeonAuthorityOwner = "dungeon-crafting";
13
14
  type DivineAuthorityTier = "follower" | "near-seat" | "seat";
14
15
  type ChaosHotspotSeverity = "minor" | "major" | "catastrophic";
16
+ type DomainAlignmentState = "aligned" | "contested" | "sealed";
17
+ type ChaosSealClearance = "hotspot-watch" | "seal-authority" | "seat-override";
18
+ type DungeonGuidanceSource = "player-system" | "arena-orchestrator" | "event-orchestrator" | "regional-governor";
19
+ type DungeonHandoffReadiness = "eligible" | "needs-domain-clearance" | "blocked";
15
20
  type DungeonCraftingFieldSensitivity = "pseudonymous" | "internal";
16
21
  type DungeonCraftingFieldRetention = "authoritative-sealing" | "short-lived";
17
22
  type DungeonAuthorityOutcome = "granted" | "deferred" | "rejected";
18
23
  type AuthorityHostRuntime = "browser" | "server" | "worker";
19
24
  type AuthorityHostTransport = "in-process" | "http" | "queue";
25
+ interface DungeonAuthorityBoundary {
26
+ readonly authorityOwner: DungeonAuthorityOwner;
27
+ readonly featureFlagId: string;
28
+ readonly entryGate: "dis-verified";
29
+ readonly guidanceSources: readonly DungeonGuidanceSource[];
30
+ readonly prerequisiteKinds: readonly [
31
+ "divine-authority",
32
+ "domain-alignment",
33
+ "chaos-hotspot-sealing"
34
+ ];
35
+ readonly validationAuthority: DungeonAuthorityOwner;
36
+ readonly executionAuthority: DungeonAuthorityOwner;
37
+ }
20
38
  interface DungeonCraftingAccessState {
21
39
  readonly divineAuthorityTier: DivineAuthorityTier;
22
40
  readonly hotspotSeverity: ChaosHotspotSeverity;
23
41
  readonly eligible: boolean;
24
42
  }
43
+ interface DungeonAuthorityPrerequisites {
44
+ readonly disVerified: boolean;
45
+ readonly divineAuthorityTier: DivineAuthorityTier;
46
+ readonly domainId: string;
47
+ readonly domainAlignment: DomainAlignmentState;
48
+ readonly sealClearance: ChaosSealClearance;
49
+ readonly hotspotSeverity: ChaosHotspotSeverity;
50
+ }
51
+ interface DungeonGuidanceHandoff {
52
+ readonly authorityOwner: DungeonAuthorityOwner;
53
+ readonly featureFlagId: string;
54
+ readonly guidanceSource: DungeonGuidanceSource;
55
+ readonly domainId: string;
56
+ readonly domainAlignment: DomainAlignmentState;
57
+ readonly readiness: DungeonHandoffReadiness;
58
+ readonly hotspotSeverity: ChaosHotspotSeverity;
59
+ readonly requestedAuthorityTier: DivineAuthorityTier;
60
+ readonly handoffSummary: string;
61
+ }
25
62
  interface DungeonSealDirectiveRecord {
26
63
  readonly operatorSubjectId: string;
27
64
  readonly hotspotId: string;
@@ -68,16 +105,20 @@ declare const DUNGEON_CRAFTING_FEATURE_FLAG_ID = "isekai.dungeon-crafting.enable
68
105
  declare const DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID = "isekai.training-progression.privacy-scale.enabled";
69
106
  declare const DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE = "DUNGEON_CRAFTING_PRIVACY_SCALE_ENABLED";
70
107
  declare const packageDescriptor: PackageDescriptor;
108
+ declare const dungeonCraftingAuthorityBoundary: DungeonAuthorityBoundary;
71
109
  declare const dungeonCraftingPrivacyScaleRollout: RolloutDescriptor;
72
110
  declare const dungeonCraftingFieldPolicies: readonly DungeonCraftingFieldPolicy[];
73
111
  declare const defaultDungeonCraftingThroughputAssumptions: DungeonCraftingThroughputAssumptions;
74
112
  declare function isDivineAuthorityTier(value: string): value is DivineAuthorityTier;
75
113
  declare function isChaosHotspotSeverity(value: string): value is ChaosHotspotSeverity;
114
+ declare function isDomainAlignmentState(value: string): value is DomainAlignmentState;
76
115
  declare function createDungeonCraftingAccessState(input: DungeonCraftingAccessState): DungeonCraftingAccessState;
116
+ declare function createDungeonAuthorityPrerequisites(input: DungeonAuthorityPrerequisites): DungeonAuthorityPrerequisites;
77
117
  declare function createDungeonSealDirectiveRecord(input: DungeonSealDirectiveRecord): DungeonSealDirectiveRecord;
78
118
  declare function createDungeonCraftingThroughputAssumptions(input: DungeonCraftingThroughputAssumptions): DungeonCraftingThroughputAssumptions;
79
119
  declare function createPortableAuthorityHost(input: PortableAuthorityHost): PortableAuthorityHost;
80
120
  declare function createAuthorityFailurePolicy(input: AuthorityFailurePolicy): AuthorityFailurePolicy;
121
+ declare function createDungeonGuidanceHandoff(input: DungeonGuidanceHandoff): DungeonGuidanceHandoff;
81
122
  declare function createDungeonAuthorityBoundaryResponse(input: DungeonAuthorityBoundaryResponse): DungeonAuthorityBoundaryResponse;
82
123
 
83
- export { type AuthorityFailurePolicy, type AuthorityHostRuntime, type AuthorityHostTransport, type ChaosHotspotSeverity, DUNGEON_CRAFTING_ENV_PREFIX, DUNGEON_CRAFTING_FEATURE_FLAG_ID, DUNGEON_CRAFTING_PACKAGE, DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE, DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID, type DivineAuthorityTier, type DungeonAuthorityBoundaryResponse, type DungeonAuthorityOutcome, type DungeonCraftingAccessState, type DungeonCraftingFieldPolicy, type DungeonCraftingFieldRetention, type DungeonCraftingFieldSensitivity, type DungeonCraftingThroughputAssumptions, type DungeonSealDirectiveRecord, type PackageDescriptor, type PortableAuthorityHost, type RolloutDescriptor, createAuthorityFailurePolicy, createDungeonAuthorityBoundaryResponse, createDungeonCraftingAccessState, createDungeonCraftingThroughputAssumptions, createDungeonSealDirectiveRecord, createPortableAuthorityHost, defaultDungeonCraftingThroughputAssumptions, dungeonCraftingFieldPolicies, dungeonCraftingPrivacyScaleRollout, isChaosHotspotSeverity, isDivineAuthorityTier, packageDescriptor };
124
+ export { type AuthorityFailurePolicy, type AuthorityHostRuntime, type AuthorityHostTransport, type ChaosHotspotSeverity, type ChaosSealClearance, DUNGEON_CRAFTING_ENV_PREFIX, DUNGEON_CRAFTING_FEATURE_FLAG_ID, DUNGEON_CRAFTING_PACKAGE, DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE, DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID, type DivineAuthorityTier, type DomainAlignmentState, type DungeonAuthorityBoundary, type DungeonAuthorityBoundaryResponse, type DungeonAuthorityOutcome, type DungeonAuthorityOwner, type DungeonAuthorityPrerequisites, type DungeonCraftingAccessState, type DungeonCraftingFieldPolicy, type DungeonCraftingFieldRetention, type DungeonCraftingFieldSensitivity, type DungeonCraftingThroughputAssumptions, type DungeonGuidanceHandoff, type DungeonGuidanceSource, type DungeonHandoffReadiness, type DungeonSealDirectiveRecord, type PackageDescriptor, type PortableAuthorityHost, type RolloutDescriptor, createAuthorityFailurePolicy, createDungeonAuthorityBoundaryResponse, createDungeonAuthorityPrerequisites, createDungeonCraftingAccessState, createDungeonCraftingThroughputAssumptions, createDungeonGuidanceHandoff, createDungeonSealDirectiveRecord, createPortableAuthorityHost, defaultDungeonCraftingThroughputAssumptions, dungeonCraftingAuthorityBoundary, dungeonCraftingFieldPolicies, dungeonCraftingPrivacyScaleRollout, isChaosHotspotSeverity, isDivineAuthorityTier, isDomainAlignmentState, packageDescriptor };
package/dist/index.d.ts CHANGED
@@ -10,18 +10,55 @@ interface RolloutDescriptor {
10
10
  readonly rollbackPlan: string;
11
11
  readonly summary: string;
12
12
  }
13
+ type DungeonAuthorityOwner = "dungeon-crafting";
13
14
  type DivineAuthorityTier = "follower" | "near-seat" | "seat";
14
15
  type ChaosHotspotSeverity = "minor" | "major" | "catastrophic";
16
+ type DomainAlignmentState = "aligned" | "contested" | "sealed";
17
+ type ChaosSealClearance = "hotspot-watch" | "seal-authority" | "seat-override";
18
+ type DungeonGuidanceSource = "player-system" | "arena-orchestrator" | "event-orchestrator" | "regional-governor";
19
+ type DungeonHandoffReadiness = "eligible" | "needs-domain-clearance" | "blocked";
15
20
  type DungeonCraftingFieldSensitivity = "pseudonymous" | "internal";
16
21
  type DungeonCraftingFieldRetention = "authoritative-sealing" | "short-lived";
17
22
  type DungeonAuthorityOutcome = "granted" | "deferred" | "rejected";
18
23
  type AuthorityHostRuntime = "browser" | "server" | "worker";
19
24
  type AuthorityHostTransport = "in-process" | "http" | "queue";
25
+ interface DungeonAuthorityBoundary {
26
+ readonly authorityOwner: DungeonAuthorityOwner;
27
+ readonly featureFlagId: string;
28
+ readonly entryGate: "dis-verified";
29
+ readonly guidanceSources: readonly DungeonGuidanceSource[];
30
+ readonly prerequisiteKinds: readonly [
31
+ "divine-authority",
32
+ "domain-alignment",
33
+ "chaos-hotspot-sealing"
34
+ ];
35
+ readonly validationAuthority: DungeonAuthorityOwner;
36
+ readonly executionAuthority: DungeonAuthorityOwner;
37
+ }
20
38
  interface DungeonCraftingAccessState {
21
39
  readonly divineAuthorityTier: DivineAuthorityTier;
22
40
  readonly hotspotSeverity: ChaosHotspotSeverity;
23
41
  readonly eligible: boolean;
24
42
  }
43
+ interface DungeonAuthorityPrerequisites {
44
+ readonly disVerified: boolean;
45
+ readonly divineAuthorityTier: DivineAuthorityTier;
46
+ readonly domainId: string;
47
+ readonly domainAlignment: DomainAlignmentState;
48
+ readonly sealClearance: ChaosSealClearance;
49
+ readonly hotspotSeverity: ChaosHotspotSeverity;
50
+ }
51
+ interface DungeonGuidanceHandoff {
52
+ readonly authorityOwner: DungeonAuthorityOwner;
53
+ readonly featureFlagId: string;
54
+ readonly guidanceSource: DungeonGuidanceSource;
55
+ readonly domainId: string;
56
+ readonly domainAlignment: DomainAlignmentState;
57
+ readonly readiness: DungeonHandoffReadiness;
58
+ readonly hotspotSeverity: ChaosHotspotSeverity;
59
+ readonly requestedAuthorityTier: DivineAuthorityTier;
60
+ readonly handoffSummary: string;
61
+ }
25
62
  interface DungeonSealDirectiveRecord {
26
63
  readonly operatorSubjectId: string;
27
64
  readonly hotspotId: string;
@@ -68,16 +105,20 @@ declare const DUNGEON_CRAFTING_FEATURE_FLAG_ID = "isekai.dungeon-crafting.enable
68
105
  declare const DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID = "isekai.training-progression.privacy-scale.enabled";
69
106
  declare const DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE = "DUNGEON_CRAFTING_PRIVACY_SCALE_ENABLED";
70
107
  declare const packageDescriptor: PackageDescriptor;
108
+ declare const dungeonCraftingAuthorityBoundary: DungeonAuthorityBoundary;
71
109
  declare const dungeonCraftingPrivacyScaleRollout: RolloutDescriptor;
72
110
  declare const dungeonCraftingFieldPolicies: readonly DungeonCraftingFieldPolicy[];
73
111
  declare const defaultDungeonCraftingThroughputAssumptions: DungeonCraftingThroughputAssumptions;
74
112
  declare function isDivineAuthorityTier(value: string): value is DivineAuthorityTier;
75
113
  declare function isChaosHotspotSeverity(value: string): value is ChaosHotspotSeverity;
114
+ declare function isDomainAlignmentState(value: string): value is DomainAlignmentState;
76
115
  declare function createDungeonCraftingAccessState(input: DungeonCraftingAccessState): DungeonCraftingAccessState;
116
+ declare function createDungeonAuthorityPrerequisites(input: DungeonAuthorityPrerequisites): DungeonAuthorityPrerequisites;
77
117
  declare function createDungeonSealDirectiveRecord(input: DungeonSealDirectiveRecord): DungeonSealDirectiveRecord;
78
118
  declare function createDungeonCraftingThroughputAssumptions(input: DungeonCraftingThroughputAssumptions): DungeonCraftingThroughputAssumptions;
79
119
  declare function createPortableAuthorityHost(input: PortableAuthorityHost): PortableAuthorityHost;
80
120
  declare function createAuthorityFailurePolicy(input: AuthorityFailurePolicy): AuthorityFailurePolicy;
121
+ declare function createDungeonGuidanceHandoff(input: DungeonGuidanceHandoff): DungeonGuidanceHandoff;
81
122
  declare function createDungeonAuthorityBoundaryResponse(input: DungeonAuthorityBoundaryResponse): DungeonAuthorityBoundaryResponse;
82
123
 
83
- export { type AuthorityFailurePolicy, type AuthorityHostRuntime, type AuthorityHostTransport, type ChaosHotspotSeverity, DUNGEON_CRAFTING_ENV_PREFIX, DUNGEON_CRAFTING_FEATURE_FLAG_ID, DUNGEON_CRAFTING_PACKAGE, DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE, DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID, type DivineAuthorityTier, type DungeonAuthorityBoundaryResponse, type DungeonAuthorityOutcome, type DungeonCraftingAccessState, type DungeonCraftingFieldPolicy, type DungeonCraftingFieldRetention, type DungeonCraftingFieldSensitivity, type DungeonCraftingThroughputAssumptions, type DungeonSealDirectiveRecord, type PackageDescriptor, type PortableAuthorityHost, type RolloutDescriptor, createAuthorityFailurePolicy, createDungeonAuthorityBoundaryResponse, createDungeonCraftingAccessState, createDungeonCraftingThroughputAssumptions, createDungeonSealDirectiveRecord, createPortableAuthorityHost, defaultDungeonCraftingThroughputAssumptions, dungeonCraftingFieldPolicies, dungeonCraftingPrivacyScaleRollout, isChaosHotspotSeverity, isDivineAuthorityTier, packageDescriptor };
124
+ export { type AuthorityFailurePolicy, type AuthorityHostRuntime, type AuthorityHostTransport, type ChaosHotspotSeverity, type ChaosSealClearance, DUNGEON_CRAFTING_ENV_PREFIX, DUNGEON_CRAFTING_FEATURE_FLAG_ID, DUNGEON_CRAFTING_PACKAGE, DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE, DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID, type DivineAuthorityTier, type DomainAlignmentState, type DungeonAuthorityBoundary, type DungeonAuthorityBoundaryResponse, type DungeonAuthorityOutcome, type DungeonAuthorityOwner, type DungeonAuthorityPrerequisites, type DungeonCraftingAccessState, type DungeonCraftingFieldPolicy, type DungeonCraftingFieldRetention, type DungeonCraftingFieldSensitivity, type DungeonCraftingThroughputAssumptions, type DungeonGuidanceHandoff, type DungeonGuidanceSource, type DungeonHandoffReadiness, type DungeonSealDirectiveRecord, type PackageDescriptor, type PortableAuthorityHost, type RolloutDescriptor, createAuthorityFailurePolicy, createDungeonAuthorityBoundaryResponse, createDungeonAuthorityPrerequisites, createDungeonCraftingAccessState, createDungeonCraftingThroughputAssumptions, createDungeonGuidanceHandoff, createDungeonSealDirectiveRecord, createPortableAuthorityHost, defaultDungeonCraftingThroughputAssumptions, dungeonCraftingAuthorityBoundary, dungeonCraftingFieldPolicies, dungeonCraftingPrivacyScaleRollout, isChaosHotspotSeverity, isDivineAuthorityTier, isDomainAlignmentState, packageDescriptor };
package/dist/index.js CHANGED
@@ -2,6 +2,12 @@
2
2
  var DUNGEON_CRAFTING_PACKAGE = "@plasius/dungeon-crafting";
3
3
  var DUNGEON_CRAFTING_ENV_PREFIX = "DUNGEON_CRAFTING";
4
4
  var DUNGEON_CRAFTING_FEATURE_FLAG_ID = "isekai.dungeon-crafting.enabled";
5
+ var DUNGEON_GUIDANCE_SOURCES = Object.freeze([
6
+ "player-system",
7
+ "arena-orchestrator",
8
+ "event-orchestrator",
9
+ "regional-governor"
10
+ ]);
5
11
  var DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID = "isekai.training-progression.privacy-scale.enabled";
6
12
  var DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE = "DUNGEON_CRAFTING_PRIVACY_SCALE_ENABLED";
7
13
  var packageDescriptor = Object.freeze({
@@ -10,6 +16,19 @@ var packageDescriptor = Object.freeze({
10
16
  envPrefix: DUNGEON_CRAFTING_ENV_PREFIX,
11
17
  summary: "DIS-gated dungeon-crafting and chaos-sealing authority contracts for Plasius."
12
18
  });
19
+ var dungeonCraftingAuthorityBoundary = Object.freeze({
20
+ authorityOwner: "dungeon-crafting",
21
+ featureFlagId: DUNGEON_CRAFTING_FEATURE_FLAG_ID,
22
+ entryGate: "dis-verified",
23
+ guidanceSources: DUNGEON_GUIDANCE_SOURCES,
24
+ prerequisiteKinds: Object.freeze([
25
+ "divine-authority",
26
+ "domain-alignment",
27
+ "chaos-hotspot-sealing"
28
+ ]),
29
+ validationAuthority: "dungeon-crafting",
30
+ executionAuthority: "dungeon-crafting"
31
+ });
13
32
  var dungeonCraftingPrivacyScaleRollout = Object.freeze({
14
33
  featureFlagId: DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID,
15
34
  envOverride: DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE,
@@ -59,12 +78,34 @@ function isDivineAuthorityTier(value) {
59
78
  function isChaosHotspotSeverity(value) {
60
79
  return value === "minor" || value === "major" || value === "catastrophic";
61
80
  }
81
+ function isDomainAlignmentState(value) {
82
+ return value === "aligned" || value === "contested" || value === "sealed";
83
+ }
62
84
  function freezeReadonlyArray(items) {
63
85
  return Object.freeze([...items]);
64
86
  }
65
87
  function createDungeonCraftingAccessState(input) {
66
88
  return Object.freeze({ ...input });
67
89
  }
90
+ function createDungeonAuthorityPrerequisites(input) {
91
+ assertNonEmptyString(input.domainId, "domainId");
92
+ if (!isDivineAuthorityTier(input.divineAuthorityTier)) {
93
+ throw new Error(
94
+ "divineAuthorityTier must be a supported dungeon-crafting authority tier"
95
+ );
96
+ }
97
+ if (!isDomainAlignmentState(input.domainAlignment)) {
98
+ throw new Error(
99
+ "domainAlignment must be a supported dungeon-crafting domain alignment state"
100
+ );
101
+ }
102
+ if (!isChaosHotspotSeverity(input.hotspotSeverity)) {
103
+ throw new Error(
104
+ "hotspotSeverity must be a supported dungeon-crafting hotspot severity"
105
+ );
106
+ }
107
+ return Object.freeze({ ...input });
108
+ }
68
109
  function assertNonEmptyString(value, label) {
69
110
  if (value.trim().length === 0) {
70
111
  throw new Error(`${label} must be a non-empty string`);
@@ -127,6 +168,26 @@ function createAuthorityFailurePolicy(input) {
127
168
  )
128
169
  });
129
170
  }
171
+ function createDungeonGuidanceHandoff(input) {
172
+ assertNonEmptyString(input.domainId, "domainId");
173
+ assertNonEmptyString(input.handoffSummary, "handoffSummary");
174
+ if (!isDomainAlignmentState(input.domainAlignment)) {
175
+ throw new Error(
176
+ "domainAlignment must be a supported dungeon-crafting domain alignment state"
177
+ );
178
+ }
179
+ if (!isDivineAuthorityTier(input.requestedAuthorityTier)) {
180
+ throw new Error(
181
+ "requestedAuthorityTier must be a supported dungeon-crafting authority tier"
182
+ );
183
+ }
184
+ if (!isChaosHotspotSeverity(input.hotspotSeverity)) {
185
+ throw new Error(
186
+ "hotspotSeverity must be a supported dungeon-crafting hotspot severity"
187
+ );
188
+ }
189
+ return Object.freeze({ ...input });
190
+ }
130
191
  function createDungeonAuthorityBoundaryResponse(input) {
131
192
  return Object.freeze({
132
193
  ...input,
@@ -142,15 +203,19 @@ export {
142
203
  DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID,
143
204
  createAuthorityFailurePolicy,
144
205
  createDungeonAuthorityBoundaryResponse,
206
+ createDungeonAuthorityPrerequisites,
145
207
  createDungeonCraftingAccessState,
146
208
  createDungeonCraftingThroughputAssumptions,
209
+ createDungeonGuidanceHandoff,
147
210
  createDungeonSealDirectiveRecord,
148
211
  createPortableAuthorityHost,
149
212
  defaultDungeonCraftingThroughputAssumptions,
213
+ dungeonCraftingAuthorityBoundary,
150
214
  dungeonCraftingFieldPolicies,
151
215
  dungeonCraftingPrivacyScaleRollout,
152
216
  isChaosHotspotSeverity,
153
217
  isDivineAuthorityTier,
218
+ isDomainAlignmentState,
154
219
  packageDescriptor
155
220
  };
156
221
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export interface PackageDescriptor {\n readonly packageName: string;\n readonly featureFlagId: string;\n readonly envPrefix: string;\n readonly summary: string;\n}\n\nexport interface RolloutDescriptor {\n readonly featureFlagId: string;\n readonly envOverride: string;\n readonly rollbackPlan: string;\n readonly summary: string;\n}\n\nexport type DivineAuthorityTier = \"follower\" | \"near-seat\" | \"seat\";\n\nexport type ChaosHotspotSeverity = \"minor\" | \"major\" | \"catastrophic\";\nexport type DungeonCraftingFieldSensitivity = \"pseudonymous\" | \"internal\";\nexport type DungeonCraftingFieldRetention =\n | \"authoritative-sealing\"\n | \"short-lived\";\n\nexport type DungeonAuthorityOutcome = \"granted\" | \"deferred\" | \"rejected\";\n\nexport type AuthorityHostRuntime = \"browser\" | \"server\" | \"worker\";\n\nexport type AuthorityHostTransport = \"in-process\" | \"http\" | \"queue\";\n\nexport interface DungeonCraftingAccessState {\n readonly divineAuthorityTier: DivineAuthorityTier;\n readonly hotspotSeverity: ChaosHotspotSeverity;\n readonly eligible: boolean;\n}\n\nexport interface DungeonSealDirectiveRecord {\n readonly operatorSubjectId: string;\n readonly hotspotId: string;\n readonly divineAuthorityTier: DivineAuthorityTier;\n readonly hotspotSeverity: ChaosHotspotSeverity;\n readonly updatedAtIso: string;\n}\n\nexport interface DungeonCraftingFieldPolicy {\n readonly field: keyof DungeonSealDirectiveRecord;\n readonly sensitivity: DungeonCraftingFieldSensitivity;\n readonly retention: DungeonCraftingFieldRetention;\n readonly justification: string;\n}\n\nexport interface DungeonCraftingThroughputAssumptions {\n readonly maxConcurrentSealOperations: number;\n readonly maxHotspotEvaluationsPerMinute: number;\n readonly maxDirectiveCommitsPerMinute: number;\n}\n\nexport interface PortableAuthorityHost {\n readonly hostId: string;\n readonly runtime: AuthorityHostRuntime;\n readonly transport: AuthorityHostTransport;\n readonly capabilityFlags: readonly string[];\n}\n\nexport interface AuthorityFailurePolicy {\n readonly timeoutMs: number;\n readonly maxAttempts: number;\n readonly recoverableHotspotSeverities: readonly ChaosHotspotSeverity[];\n readonly escalationTarget: \"operator\" | \"divine-seat\" | \"sealed-fallback\";\n}\n\nexport interface DungeonAuthorityBoundaryResponse {\n readonly responseId: string;\n readonly divineAuthorityTier: DivineAuthorityTier;\n readonly hotspotSeverity: ChaosHotspotSeverity;\n readonly outcome: DungeonAuthorityOutcome;\n readonly eligible: boolean;\n readonly sourceHost: PortableAuthorityHost;\n readonly failurePolicy: AuthorityFailurePolicy;\n readonly observedAt: string;\n}\n\nexport const DUNGEON_CRAFTING_PACKAGE = \"@plasius/dungeon-crafting\";\nexport const DUNGEON_CRAFTING_ENV_PREFIX = \"DUNGEON_CRAFTING\";\nexport const DUNGEON_CRAFTING_FEATURE_FLAG_ID = \"isekai.dungeon-crafting.enabled\";\nexport const DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID =\n \"isekai.training-progression.privacy-scale.enabled\";\nexport const DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE =\n \"DUNGEON_CRAFTING_PRIVACY_SCALE_ENABLED\";\n\nexport const packageDescriptor: PackageDescriptor = Object.freeze({\n packageName: DUNGEON_CRAFTING_PACKAGE,\n featureFlagId: DUNGEON_CRAFTING_FEATURE_FLAG_ID,\n envPrefix: DUNGEON_CRAFTING_ENV_PREFIX,\n summary:\n \"DIS-gated dungeon-crafting and chaos-sealing authority contracts for Plasius.\",\n});\n\nexport const dungeonCraftingPrivacyScaleRollout: RolloutDescriptor =\n Object.freeze({\n featureFlagId: DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID,\n envOverride: DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE,\n rollbackPlan:\n \"Disable the dungeon-crafting privacy/scale rollout to fall back to the existing chaos-sealing access contract surface.\",\n summary:\n \"Rolls out minimal seal-directive payloads and documented hotspot throughput assumptions.\",\n });\n\nexport const dungeonCraftingFieldPolicies = Object.freeze<\n readonly DungeonCraftingFieldPolicy[]\n>([\n {\n field: \"operatorSubjectId\",\n sensitivity: \"pseudonymous\",\n retention: \"authoritative-sealing\",\n justification:\n \"Stable pseudonymous subject identifier is required to attribute sealing authority without carrying profile names or contact data.\",\n },\n {\n field: \"hotspotId\",\n sensitivity: \"internal\",\n retention: \"authoritative-sealing\",\n justification:\n \"Hotspot identifier is the minimum routing key needed to coordinate chaos-sealing directives.\",\n },\n {\n field: \"divineAuthorityTier\",\n sensitivity: \"internal\",\n retention: \"authoritative-sealing\",\n justification:\n \"Authority tier is the smallest access-state field needed to validate whether a sealing directive may execute.\",\n },\n {\n field: \"hotspotSeverity\",\n sensitivity: \"internal\",\n retention: \"authoritative-sealing\",\n justification:\n \"Hotspot severity determines sealing urgency and throughput budgeting without duplicating full dungeon telemetry.\",\n },\n {\n field: \"updatedAtIso\",\n sensitivity: \"internal\",\n retention: \"short-lived\",\n justification:\n \"Update timestamp supports bounded ordering and replay protection for rapid hotspot updates.\",\n },\n]);\n\nexport const defaultDungeonCraftingThroughputAssumptions: DungeonCraftingThroughputAssumptions =\n Object.freeze({\n maxConcurrentSealOperations: 800,\n maxHotspotEvaluationsPerMinute: 6_000,\n maxDirectiveCommitsPerMinute: 12_000,\n });\n\nexport function isDivineAuthorityTier(\n value: string\n): value is DivineAuthorityTier {\n return value === \"follower\" || value === \"near-seat\" || value === \"seat\";\n}\n\nexport function isChaosHotspotSeverity(\n value: string\n): value is ChaosHotspotSeverity {\n return value === \"minor\" || value === \"major\" || value === \"catastrophic\";\n}\n\nfunction freezeReadonlyArray<T>(items: readonly T[]): readonly T[] {\n return Object.freeze([...items]);\n}\n\nexport function createDungeonCraftingAccessState(\n input: DungeonCraftingAccessState\n): DungeonCraftingAccessState {\n return Object.freeze({ ...input });\n}\n\nfunction assertNonEmptyString(value: string, label: string): void {\n if (value.trim().length === 0) {\n throw new Error(`${label} must be a non-empty string`);\n }\n}\n\nfunction assertPositiveSafeInteger(value: number, label: string): void {\n if (!Number.isSafeInteger(value) || value <= 0) {\n throw new Error(`${label} must be a positive safe integer`);\n }\n}\n\nconst iso8601DateRegex =\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?(?:Z|[+-]\\d{2}:\\d{2})$/;\n\nfunction assertValidUpdatedAtIso(value: string): void {\n if (!iso8601DateRegex.test(value) || Number.isNaN(Date.parse(value))) {\n throw new Error(\"updatedAtIso must be an ISO-8601 timestamp\");\n }\n}\n\nexport function createDungeonSealDirectiveRecord(\n input: DungeonSealDirectiveRecord\n): DungeonSealDirectiveRecord {\n assertNonEmptyString(input.operatorSubjectId, \"operatorSubjectId\");\n assertNonEmptyString(input.hotspotId, \"hotspotId\");\n assertNonEmptyString(input.updatedAtIso, \"updatedAtIso\");\n assertValidUpdatedAtIso(input.updatedAtIso);\n\n if (!isDivineAuthorityTier(input.divineAuthorityTier)) {\n throw new Error(\n \"divineAuthorityTier must be a supported dungeon-crafting authority tier\"\n );\n }\n\n if (!isChaosHotspotSeverity(input.hotspotSeverity)) {\n throw new Error(\n \"hotspotSeverity must be a supported dungeon-crafting hotspot severity\"\n );\n }\n\n return Object.freeze({ ...input });\n}\n\nexport function createDungeonCraftingThroughputAssumptions(\n input: DungeonCraftingThroughputAssumptions\n): DungeonCraftingThroughputAssumptions {\n assertPositiveSafeInteger(\n input.maxConcurrentSealOperations,\n \"maxConcurrentSealOperations\"\n );\n assertPositiveSafeInteger(\n input.maxHotspotEvaluationsPerMinute,\n \"maxHotspotEvaluationsPerMinute\"\n );\n assertPositiveSafeInteger(\n input.maxDirectiveCommitsPerMinute,\n \"maxDirectiveCommitsPerMinute\"\n );\n\n return Object.freeze({ ...input });\n}\n\nexport function createPortableAuthorityHost(\n input: PortableAuthorityHost\n): PortableAuthorityHost {\n return Object.freeze({\n ...input,\n capabilityFlags: freezeReadonlyArray(input.capabilityFlags),\n });\n}\n\nexport function createAuthorityFailurePolicy(\n input: AuthorityFailurePolicy\n): AuthorityFailurePolicy {\n return Object.freeze({\n ...input,\n recoverableHotspotSeverities: freezeReadonlyArray(\n input.recoverableHotspotSeverities\n ),\n });\n}\n\nexport function createDungeonAuthorityBoundaryResponse(\n input: DungeonAuthorityBoundaryResponse\n): DungeonAuthorityBoundaryResponse {\n return Object.freeze({\n ...input,\n sourceHost: createPortableAuthorityHost(input.sourceHost),\n failurePolicy: createAuthorityFailurePolicy(input.failurePolicy),\n });\n}\n"],"mappings":";AAgFO,IAAM,2BAA2B;AACjC,IAAM,8BAA8B;AACpC,IAAM,mCAAmC;AACzC,IAAM,iDACX;AACK,IAAM,8CACX;AAEK,IAAM,oBAAuC,OAAO,OAAO;AAAA,EAChE,aAAa;AAAA,EACb,eAAe;AAAA,EACf,WAAW;AAAA,EACX,SACE;AACJ,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B,MAAM,UAAU;AAAA,IACxD,eAAe,6BAA6B,MAAM,aAAa;AAAA,EACjE,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export interface PackageDescriptor {\n readonly packageName: string;\n readonly featureFlagId: string;\n readonly envPrefix: string;\n readonly summary: string;\n}\n\nexport interface RolloutDescriptor {\n readonly featureFlagId: string;\n readonly envOverride: string;\n readonly rollbackPlan: string;\n readonly summary: string;\n}\n\nexport type DungeonAuthorityOwner = \"dungeon-crafting\";\nexport type DivineAuthorityTier = \"follower\" | \"near-seat\" | \"seat\";\nexport type ChaosHotspotSeverity = \"minor\" | \"major\" | \"catastrophic\";\nexport type DomainAlignmentState = \"aligned\" | \"contested\" | \"sealed\";\nexport type ChaosSealClearance =\n | \"hotspot-watch\"\n | \"seal-authority\"\n | \"seat-override\";\nexport type DungeonGuidanceSource =\n | \"player-system\"\n | \"arena-orchestrator\"\n | \"event-orchestrator\"\n | \"regional-governor\";\nexport type DungeonHandoffReadiness =\n | \"eligible\"\n | \"needs-domain-clearance\"\n | \"blocked\";\nexport type DungeonCraftingFieldSensitivity = \"pseudonymous\" | \"internal\";\nexport type DungeonCraftingFieldRetention =\n | \"authoritative-sealing\"\n | \"short-lived\";\n\nexport type DungeonAuthorityOutcome = \"granted\" | \"deferred\" | \"rejected\";\n\nexport type AuthorityHostRuntime = \"browser\" | \"server\" | \"worker\";\n\nexport type AuthorityHostTransport = \"in-process\" | \"http\" | \"queue\";\n\nexport interface DungeonAuthorityBoundary {\n readonly authorityOwner: DungeonAuthorityOwner;\n readonly featureFlagId: string;\n readonly entryGate: \"dis-verified\";\n readonly guidanceSources: readonly DungeonGuidanceSource[];\n readonly prerequisiteKinds: readonly [\n \"divine-authority\",\n \"domain-alignment\",\n \"chaos-hotspot-sealing\",\n ];\n readonly validationAuthority: DungeonAuthorityOwner;\n readonly executionAuthority: DungeonAuthorityOwner;\n}\n\nexport interface DungeonCraftingAccessState {\n readonly divineAuthorityTier: DivineAuthorityTier;\n readonly hotspotSeverity: ChaosHotspotSeverity;\n readonly eligible: boolean;\n}\n\nexport interface DungeonAuthorityPrerequisites {\n readonly disVerified: boolean;\n readonly divineAuthorityTier: DivineAuthorityTier;\n readonly domainId: string;\n readonly domainAlignment: DomainAlignmentState;\n readonly sealClearance: ChaosSealClearance;\n readonly hotspotSeverity: ChaosHotspotSeverity;\n}\n\nexport interface DungeonGuidanceHandoff {\n readonly authorityOwner: DungeonAuthorityOwner;\n readonly featureFlagId: string;\n readonly guidanceSource: DungeonGuidanceSource;\n readonly domainId: string;\n readonly domainAlignment: DomainAlignmentState;\n readonly readiness: DungeonHandoffReadiness;\n readonly hotspotSeverity: ChaosHotspotSeverity;\n readonly requestedAuthorityTier: DivineAuthorityTier;\n readonly handoffSummary: string;\n}\n\nexport interface DungeonSealDirectiveRecord {\n readonly operatorSubjectId: string;\n readonly hotspotId: string;\n readonly divineAuthorityTier: DivineAuthorityTier;\n readonly hotspotSeverity: ChaosHotspotSeverity;\n readonly updatedAtIso: string;\n}\n\nexport interface DungeonCraftingFieldPolicy {\n readonly field: keyof DungeonSealDirectiveRecord;\n readonly sensitivity: DungeonCraftingFieldSensitivity;\n readonly retention: DungeonCraftingFieldRetention;\n readonly justification: string;\n}\n\nexport interface DungeonCraftingThroughputAssumptions {\n readonly maxConcurrentSealOperations: number;\n readonly maxHotspotEvaluationsPerMinute: number;\n readonly maxDirectiveCommitsPerMinute: number;\n}\n\nexport interface PortableAuthorityHost {\n readonly hostId: string;\n readonly runtime: AuthorityHostRuntime;\n readonly transport: AuthorityHostTransport;\n readonly capabilityFlags: readonly string[];\n}\n\nexport interface AuthorityFailurePolicy {\n readonly timeoutMs: number;\n readonly maxAttempts: number;\n readonly recoverableHotspotSeverities: readonly ChaosHotspotSeverity[];\n readonly escalationTarget: \"operator\" | \"divine-seat\" | \"sealed-fallback\";\n}\n\nexport interface DungeonAuthorityBoundaryResponse {\n readonly responseId: string;\n readonly divineAuthorityTier: DivineAuthorityTier;\n readonly hotspotSeverity: ChaosHotspotSeverity;\n readonly outcome: DungeonAuthorityOutcome;\n readonly eligible: boolean;\n readonly sourceHost: PortableAuthorityHost;\n readonly failurePolicy: AuthorityFailurePolicy;\n readonly observedAt: string;\n}\n\nexport const DUNGEON_CRAFTING_PACKAGE = \"@plasius/dungeon-crafting\";\nexport const DUNGEON_CRAFTING_ENV_PREFIX = \"DUNGEON_CRAFTING\";\nexport const DUNGEON_CRAFTING_FEATURE_FLAG_ID = \"isekai.dungeon-crafting.enabled\";\nconst DUNGEON_GUIDANCE_SOURCES = Object.freeze([\n \"player-system\",\n \"arena-orchestrator\",\n \"event-orchestrator\",\n \"regional-governor\",\n] as const);\nexport const DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID =\n \"isekai.training-progression.privacy-scale.enabled\";\nexport const DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE =\n \"DUNGEON_CRAFTING_PRIVACY_SCALE_ENABLED\";\n\nexport const packageDescriptor: PackageDescriptor = Object.freeze({\n packageName: DUNGEON_CRAFTING_PACKAGE,\n featureFlagId: DUNGEON_CRAFTING_FEATURE_FLAG_ID,\n envPrefix: DUNGEON_CRAFTING_ENV_PREFIX,\n summary:\n \"DIS-gated dungeon-crafting and chaos-sealing authority contracts for Plasius.\",\n});\n\nexport const dungeonCraftingAuthorityBoundary: DungeonAuthorityBoundary =\n Object.freeze({\n authorityOwner: \"dungeon-crafting\",\n featureFlagId: DUNGEON_CRAFTING_FEATURE_FLAG_ID,\n entryGate: \"dis-verified\",\n guidanceSources: DUNGEON_GUIDANCE_SOURCES,\n prerequisiteKinds: Object.freeze([\n \"divine-authority\",\n \"domain-alignment\",\n \"chaos-hotspot-sealing\",\n ] as const),\n validationAuthority: \"dungeon-crafting\",\n executionAuthority: \"dungeon-crafting\",\n });\n\nexport const dungeonCraftingPrivacyScaleRollout: RolloutDescriptor =\n Object.freeze({\n featureFlagId: DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID,\n envOverride: DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE,\n rollbackPlan:\n \"Disable the dungeon-crafting privacy/scale rollout to fall back to the existing chaos-sealing access contract surface.\",\n summary:\n \"Rolls out minimal seal-directive payloads and documented hotspot throughput assumptions.\",\n });\n\nexport const dungeonCraftingFieldPolicies = Object.freeze<\n readonly DungeonCraftingFieldPolicy[]\n>([\n {\n field: \"operatorSubjectId\",\n sensitivity: \"pseudonymous\",\n retention: \"authoritative-sealing\",\n justification:\n \"Stable pseudonymous subject identifier is required to attribute sealing authority without carrying profile names or contact data.\",\n },\n {\n field: \"hotspotId\",\n sensitivity: \"internal\",\n retention: \"authoritative-sealing\",\n justification:\n \"Hotspot identifier is the minimum routing key needed to coordinate chaos-sealing directives.\",\n },\n {\n field: \"divineAuthorityTier\",\n sensitivity: \"internal\",\n retention: \"authoritative-sealing\",\n justification:\n \"Authority tier is the smallest access-state field needed to validate whether a sealing directive may execute.\",\n },\n {\n field: \"hotspotSeverity\",\n sensitivity: \"internal\",\n retention: \"authoritative-sealing\",\n justification:\n \"Hotspot severity determines sealing urgency and throughput budgeting without duplicating full dungeon telemetry.\",\n },\n {\n field: \"updatedAtIso\",\n sensitivity: \"internal\",\n retention: \"short-lived\",\n justification:\n \"Update timestamp supports bounded ordering and replay protection for rapid hotspot updates.\",\n },\n]);\n\nexport const defaultDungeonCraftingThroughputAssumptions: DungeonCraftingThroughputAssumptions =\n Object.freeze({\n maxConcurrentSealOperations: 800,\n maxHotspotEvaluationsPerMinute: 6_000,\n maxDirectiveCommitsPerMinute: 12_000,\n });\n\nexport function isDivineAuthorityTier(\n value: string\n): value is DivineAuthorityTier {\n return value === \"follower\" || value === \"near-seat\" || value === \"seat\";\n}\n\nexport function isChaosHotspotSeverity(\n value: string\n): value is ChaosHotspotSeverity {\n return value === \"minor\" || value === \"major\" || value === \"catastrophic\";\n}\n\nexport function isDomainAlignmentState(\n value: string\n): value is DomainAlignmentState {\n return value === \"aligned\" || value === \"contested\" || value === \"sealed\";\n}\n\nfunction freezeReadonlyArray<T>(items: readonly T[]): readonly T[] {\n return Object.freeze([...items]);\n}\n\nexport function createDungeonCraftingAccessState(\n input: DungeonCraftingAccessState\n): DungeonCraftingAccessState {\n return Object.freeze({ ...input });\n}\n\nexport function createDungeonAuthorityPrerequisites(\n input: DungeonAuthorityPrerequisites\n): DungeonAuthorityPrerequisites {\n assertNonEmptyString(input.domainId, \"domainId\");\n\n if (!isDivineAuthorityTier(input.divineAuthorityTier)) {\n throw new Error(\n \"divineAuthorityTier must be a supported dungeon-crafting authority tier\"\n );\n }\n\n if (!isDomainAlignmentState(input.domainAlignment)) {\n throw new Error(\n \"domainAlignment must be a supported dungeon-crafting domain alignment state\"\n );\n }\n\n if (!isChaosHotspotSeverity(input.hotspotSeverity)) {\n throw new Error(\n \"hotspotSeverity must be a supported dungeon-crafting hotspot severity\"\n );\n }\n\n return Object.freeze({ ...input });\n}\n\nfunction assertNonEmptyString(value: string, label: string): void {\n if (value.trim().length === 0) {\n throw new Error(`${label} must be a non-empty string`);\n }\n}\n\nfunction assertPositiveSafeInteger(value: number, label: string): void {\n if (!Number.isSafeInteger(value) || value <= 0) {\n throw new Error(`${label} must be a positive safe integer`);\n }\n}\n\nconst iso8601DateRegex =\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?(?:Z|[+-]\\d{2}:\\d{2})$/;\n\nfunction assertValidUpdatedAtIso(value: string): void {\n if (!iso8601DateRegex.test(value) || Number.isNaN(Date.parse(value))) {\n throw new Error(\"updatedAtIso must be an ISO-8601 timestamp\");\n }\n}\n\nexport function createDungeonSealDirectiveRecord(\n input: DungeonSealDirectiveRecord\n): DungeonSealDirectiveRecord {\n assertNonEmptyString(input.operatorSubjectId, \"operatorSubjectId\");\n assertNonEmptyString(input.hotspotId, \"hotspotId\");\n assertNonEmptyString(input.updatedAtIso, \"updatedAtIso\");\n assertValidUpdatedAtIso(input.updatedAtIso);\n\n if (!isDivineAuthorityTier(input.divineAuthorityTier)) {\n throw new Error(\n \"divineAuthorityTier must be a supported dungeon-crafting authority tier\"\n );\n }\n\n if (!isChaosHotspotSeverity(input.hotspotSeverity)) {\n throw new Error(\n \"hotspotSeverity must be a supported dungeon-crafting hotspot severity\"\n );\n }\n\n return Object.freeze({ ...input });\n}\n\nexport function createDungeonCraftingThroughputAssumptions(\n input: DungeonCraftingThroughputAssumptions\n): DungeonCraftingThroughputAssumptions {\n assertPositiveSafeInteger(\n input.maxConcurrentSealOperations,\n \"maxConcurrentSealOperations\"\n );\n assertPositiveSafeInteger(\n input.maxHotspotEvaluationsPerMinute,\n \"maxHotspotEvaluationsPerMinute\"\n );\n assertPositiveSafeInteger(\n input.maxDirectiveCommitsPerMinute,\n \"maxDirectiveCommitsPerMinute\"\n );\n\n return Object.freeze({ ...input });\n}\n\nexport function createPortableAuthorityHost(\n input: PortableAuthorityHost\n): PortableAuthorityHost {\n return Object.freeze({\n ...input,\n capabilityFlags: freezeReadonlyArray(input.capabilityFlags),\n });\n}\n\nexport function createAuthorityFailurePolicy(\n input: AuthorityFailurePolicy\n): AuthorityFailurePolicy {\n return Object.freeze({\n ...input,\n recoverableHotspotSeverities: freezeReadonlyArray(\n input.recoverableHotspotSeverities\n ),\n });\n}\n\nexport function createDungeonGuidanceHandoff(\n input: DungeonGuidanceHandoff\n): DungeonGuidanceHandoff {\n assertNonEmptyString(input.domainId, \"domainId\");\n assertNonEmptyString(input.handoffSummary, \"handoffSummary\");\n\n if (!isDomainAlignmentState(input.domainAlignment)) {\n throw new Error(\n \"domainAlignment must be a supported dungeon-crafting domain alignment state\"\n );\n }\n\n if (!isDivineAuthorityTier(input.requestedAuthorityTier)) {\n throw new Error(\n \"requestedAuthorityTier must be a supported dungeon-crafting authority tier\"\n );\n }\n\n if (!isChaosHotspotSeverity(input.hotspotSeverity)) {\n throw new Error(\n \"hotspotSeverity must be a supported dungeon-crafting hotspot severity\"\n );\n }\n\n return Object.freeze({ ...input });\n}\n\nexport function createDungeonAuthorityBoundaryResponse(\n input: DungeonAuthorityBoundaryResponse\n): DungeonAuthorityBoundaryResponse {\n return Object.freeze({\n ...input,\n sourceHost: createPortableAuthorityHost(input.sourceHost),\n failurePolicy: createAuthorityFailurePolicy(input.failurePolicy),\n });\n}\n"],"mappings":";AAiIO,IAAM,2BAA2B;AACjC,IAAM,8BAA8B;AACpC,IAAM,mCAAmC;AAChD,IAAM,2BAA2B,OAAO,OAAO;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAU;AACH,IAAM,iDACX;AACK,IAAM,8CACX;AAEK,IAAM,oBAAuC,OAAO,OAAO;AAAA,EAChE,aAAa;AAAA,EACb,eAAe;AAAA,EACf,WAAW;AAAA,EACX,SACE;AACJ,CAAC;AAEM,IAAM,mCACX,OAAO,OAAO;AAAA,EACZ,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,mBAAmB,OAAO,OAAO;AAAA,IAC/B;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAU;AAAA,EACV,qBAAqB;AAAA,EACrB,oBAAoB;AACtB,CAAC;AAEI,IAAM,qCACX,OAAO,OAAO;AAAA,EACZ,eAAe;AAAA,EACf,aAAa;AAAA,EACb,cACE;AAAA,EACF,SACE;AACJ,CAAC;AAEI,IAAM,+BAA+B,OAAO,OAEjD;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,IACb,WAAW;AAAA,IACX,eACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,IACb,WAAW;AAAA,IACX,eACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,IACb,WAAW;AAAA,IACX,eACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,IACb,WAA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gBAAgB;AAE3D,MAAI,CAAC,uBAAuB,MAAM,eAAe,GAAG;AAClD,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,sBAAsB,MAAM,sBAAsB,GAAG;AACxD,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,uBAAuB,MAAM,eAAe,GAAG;AAClD,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,OAAO,OAAO,EAAE,GAAG,MAAM,CAAC;AACnC;AAEO,SAAS,uCACd,OACkC;AAClC,SAAO,OAAO,OAAO;AAAA,IACnB,GAAG;AAAA,IACH,YAAY,4BAA4B,MAAM,UAAU;AAAA,IACxD,eAAe,6BAA6B,MAAM,aAAa;AAAA,EACjE,CAAC;AACH;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasius/dungeon-crafting",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "description": "DIS-gated dungeon-crafting and chaos-sealing authority contracts for Plasius",
5
5
  "type": "module",
6
6
  "sideEffects": false,