@plasius/dungeon-crafting 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +203 -0
- package/README.md +116 -0
- package/dist/index.cjs +197 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +83 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.js +156 -0
- package/dist/index.js.map +1 -0
- package/package.json +88 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
Copyright 2025 Plasius LTD
|
|
2
|
+
|
|
3
|
+
Apache License
|
|
4
|
+
Version 2.0, January 2004
|
|
5
|
+
http://www.apache.org/licenses/
|
|
6
|
+
|
|
7
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
8
|
+
|
|
9
|
+
1. Definitions.
|
|
10
|
+
|
|
11
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
12
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
13
|
+
|
|
14
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
15
|
+
the copyright owner that is granting the License.
|
|
16
|
+
|
|
17
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
18
|
+
other entities that control, are controlled by, or are under common
|
|
19
|
+
control with that entity. For the purposes of this definition,
|
|
20
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
21
|
+
direction or management of such entity, whether by contract or
|
|
22
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
23
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
24
|
+
|
|
25
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
26
|
+
exercising permissions granted by this License.
|
|
27
|
+
|
|
28
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
29
|
+
including but not limited to software source code, documentation
|
|
30
|
+
source, and configuration files.
|
|
31
|
+
|
|
32
|
+
"Object" form shall mean any form resulting from mechanical
|
|
33
|
+
transformation or translation of a Source form, including but
|
|
34
|
+
not limited to compiled object code, generated documentation,
|
|
35
|
+
and conversions to other media types.
|
|
36
|
+
|
|
37
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
38
|
+
Object form, made available under the License, as indicated by a
|
|
39
|
+
copyright notice that is included in or attached to the work
|
|
40
|
+
(an example is provided in the Appendix below).
|
|
41
|
+
|
|
42
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
43
|
+
form, that is based on (or derived from) the Work and for which the
|
|
44
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
45
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
46
|
+
of this License, Derivative Works shall not include works that remain
|
|
47
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
48
|
+
the Work and Derivative Works thereof.
|
|
49
|
+
|
|
50
|
+
"Contribution" shall mean any work of authorship, including
|
|
51
|
+
the original version of the Work and any modifications or additions
|
|
52
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
53
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
54
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
55
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
56
|
+
means any form of electronic, verbal, or written communication sent
|
|
57
|
+
to the Licensor or its representatives, including but not limited to
|
|
58
|
+
communication on electronic mailing lists, source code control systems,
|
|
59
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
60
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
61
|
+
excluding communication that is conspicuously marked or otherwise
|
|
62
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
63
|
+
|
|
64
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
65
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
66
|
+
subsequently incorporated within the Work.
|
|
67
|
+
|
|
68
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
69
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
70
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
71
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
72
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
73
|
+
Work and such Derivative Works in Source or Object form.
|
|
74
|
+
|
|
75
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
76
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
77
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
78
|
+
(except as stated in this section) patent license to make, have made,
|
|
79
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
80
|
+
where such license applies only to those patent claims licensable
|
|
81
|
+
by such Contributor that are necessarily infringed by their
|
|
82
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
83
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
84
|
+
institute patent litigation against any entity (including a
|
|
85
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
86
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
87
|
+
or contributory patent infringement, then any patent licenses
|
|
88
|
+
granted to You under this License for that Work shall terminate
|
|
89
|
+
as of the date such litigation is filed.
|
|
90
|
+
|
|
91
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
92
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
93
|
+
modifications, and in Source or Object form, provided that You
|
|
94
|
+
meet the following conditions:
|
|
95
|
+
|
|
96
|
+
(a) You must give any other recipients of the Work or
|
|
97
|
+
Derivative Works a copy of this License; and
|
|
98
|
+
|
|
99
|
+
(b) You must cause any modified files to carry prominent notices
|
|
100
|
+
stating that You changed the files; and
|
|
101
|
+
|
|
102
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
103
|
+
that You distribute, all copyright, patent, trademark, and
|
|
104
|
+
attribution notices from the Source form of the Work,
|
|
105
|
+
excluding those notices that do not pertain to any part of
|
|
106
|
+
the Derivative Works; and
|
|
107
|
+
|
|
108
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
109
|
+
distribution, then any Derivative Works that You distribute must
|
|
110
|
+
include a readable copy of the attribution notices contained
|
|
111
|
+
within such NOTICE file, excluding those notices that do not
|
|
112
|
+
pertain to any part of the Derivative Works, in at least one
|
|
113
|
+
of the following places: within a NOTICE text file distributed
|
|
114
|
+
as part of the Derivative Works; within the Source form or
|
|
115
|
+
documentation, if provided along with the Derivative Works; or,
|
|
116
|
+
within a display generated by the Derivative Works, if and
|
|
117
|
+
wherever such third-party notices normally appear. The contents
|
|
118
|
+
of the NOTICE file are for informational purposes only and
|
|
119
|
+
do not modify the License. You may add Your own attribution
|
|
120
|
+
notices within Derivative Works that You distribute, alongside
|
|
121
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
122
|
+
that such additional attribution notices cannot be construed
|
|
123
|
+
as modifying the License.
|
|
124
|
+
|
|
125
|
+
You may add Your own copyright statement to Your modifications and
|
|
126
|
+
may provide additional or different license terms and conditions
|
|
127
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
128
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
129
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
130
|
+
the conditions stated in this License.
|
|
131
|
+
|
|
132
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
133
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
134
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
135
|
+
this License, without any additional terms or conditions.
|
|
136
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
137
|
+
the terms of any separate license agreement you may have executed
|
|
138
|
+
with Licensor regarding such Contributions.
|
|
139
|
+
|
|
140
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
141
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
142
|
+
except as required for reasonable and customary use in describing the
|
|
143
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
144
|
+
|
|
145
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
146
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
147
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
148
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
149
|
+
implied, including, without limitation, any warranties or conditions
|
|
150
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
151
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
152
|
+
appropriateness of using or redistributing the Work and assume any
|
|
153
|
+
risks associated with Your exercise of permissions under this License.
|
|
154
|
+
|
|
155
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
156
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
157
|
+
unless required by applicable law (such as deliberate and grossly
|
|
158
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
159
|
+
liable to You for damages, including any direct, indirect, special,
|
|
160
|
+
incidental, or consequential damages of any character arising as a
|
|
161
|
+
result of this License or out of the use or inability to use the
|
|
162
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
163
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
164
|
+
other commercial damages or losses), even if such Contributor
|
|
165
|
+
has been advised of the possibility of such damages.
|
|
166
|
+
|
|
167
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
168
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
169
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
170
|
+
or other liability obligations and/or rights consistent with this
|
|
171
|
+
License. However, in accepting such obligations, You may act only
|
|
172
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
173
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
174
|
+
defend, and hold each Contributor harmless for any liability
|
|
175
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
176
|
+
of your accepting any such warranty or additional liability.
|
|
177
|
+
|
|
178
|
+
END OF TERMS AND CONDITIONS
|
|
179
|
+
|
|
180
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
181
|
+
|
|
182
|
+
To apply the Apache License to your work, attach the following
|
|
183
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
184
|
+
replaced with your own identifying information. (Don't include
|
|
185
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
186
|
+
comment syntax for the file format. We also recommend that a
|
|
187
|
+
file or class name and description of purpose be included on the
|
|
188
|
+
same "printed page" as the copyright notice for easier
|
|
189
|
+
identification within third-party archives.
|
|
190
|
+
|
|
191
|
+
Copyright [yyyy] [name of copyright owner]
|
|
192
|
+
|
|
193
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
194
|
+
you may not use this file except in compliance with the License.
|
|
195
|
+
You may obtain a copy of the License at
|
|
196
|
+
|
|
197
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
198
|
+
|
|
199
|
+
Unless required by applicable law or agreed to in writing, software
|
|
200
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
201
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
202
|
+
See the License for the specific language governing permissions and
|
|
203
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# @plasius/dungeon-crafting
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@plasius/dungeon-crafting)
|
|
4
|
+
[](https://github.com/Plasius-LTD/dungeon-crafting/actions/workflows/ci.yml)
|
|
5
|
+
[](https://codecov.io/gh/Plasius-LTD/dungeon-crafting)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
[](./CODE_OF_CONDUCT.md)
|
|
8
|
+
[](./SECURITY.md)
|
|
9
|
+
[](./CHANGELOG.md)
|
|
10
|
+
|
|
11
|
+
DIS-gated dungeon-crafting and chaos-sealing authority contracts for Plasius.
|
|
12
|
+
|
|
13
|
+
Apache-2.0. ESM + CJS builds. TypeScript types included.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @plasius/dungeon-crafting
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Scope
|
|
22
|
+
|
|
23
|
+
`@plasius/dungeon-crafting` owns the authority-side boundary for:
|
|
24
|
+
|
|
25
|
+
- DIS-gated access state
|
|
26
|
+
- chaos-hotspot severity metadata
|
|
27
|
+
- dungeon-crafting intent state
|
|
28
|
+
- privacy-safe seal-directive payloads and hotspot throughput assumptions
|
|
29
|
+
- portable authority-host descriptors
|
|
30
|
+
- recoverable failure-policy and authority-response contracts
|
|
31
|
+
|
|
32
|
+
## Demo
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm run build
|
|
36
|
+
node demo/example.mjs
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import {
|
|
43
|
+
createAuthorityFailurePolicy,
|
|
44
|
+
createDungeonAuthorityBoundaryResponse,
|
|
45
|
+
createDungeonCraftingAccessState,
|
|
46
|
+
createDungeonSealDirectiveRecord,
|
|
47
|
+
defaultDungeonCraftingThroughputAssumptions,
|
|
48
|
+
dungeonCraftingPrivacyScaleRollout,
|
|
49
|
+
} from "@plasius/dungeon-crafting";
|
|
50
|
+
|
|
51
|
+
const state = createDungeonCraftingAccessState({
|
|
52
|
+
divineAuthorityTier: "seat",
|
|
53
|
+
hotspotSeverity: "major",
|
|
54
|
+
eligible: true,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const directive = createDungeonSealDirectiveRecord({
|
|
58
|
+
operatorSubjectId: "operator-sub-1",
|
|
59
|
+
hotspotId: "hotspot-1",
|
|
60
|
+
divineAuthorityTier: state.divineAuthorityTier,
|
|
61
|
+
hotspotSeverity: state.hotspotSeverity,
|
|
62
|
+
updatedAtIso: new Date().toISOString(),
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
console.log(dungeonCraftingPrivacyScaleRollout.featureFlagId);
|
|
66
|
+
console.log(defaultDungeonCraftingThroughputAssumptions.maxDirectiveCommitsPerMinute);
|
|
67
|
+
console.log(directive.hotspotId);
|
|
68
|
+
|
|
69
|
+
const failurePolicy = createAuthorityFailurePolicy({
|
|
70
|
+
timeoutMs: 1800,
|
|
71
|
+
maxAttempts: 2,
|
|
72
|
+
recoverableHotspotSeverities: ["minor", "major"],
|
|
73
|
+
escalationTarget: "divine-seat",
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const response = createDungeonAuthorityBoundaryResponse({
|
|
77
|
+
responseId: "response-1",
|
|
78
|
+
divineAuthorityTier: state.divineAuthorityTier,
|
|
79
|
+
hotspotSeverity: state.hotspotSeverity,
|
|
80
|
+
outcome: "deferred",
|
|
81
|
+
eligible: state.eligible,
|
|
82
|
+
sourceHost: {
|
|
83
|
+
hostId: "seal-authority",
|
|
84
|
+
runtime: "worker",
|
|
85
|
+
transport: "queue",
|
|
86
|
+
capabilityFlags: ["trace-linked"],
|
|
87
|
+
},
|
|
88
|
+
failurePolicy,
|
|
89
|
+
observedAt: new Date().toISOString(),
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
console.log(response.outcome);
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Privacy And Scale Baseline
|
|
96
|
+
|
|
97
|
+
The package exports an inherited rollout descriptor for the cross-repo feature
|
|
98
|
+
flag `isekai.training-progression.privacy-scale.enabled`.
|
|
99
|
+
|
|
100
|
+
When that rollout is enabled, package consumers should prefer the minimal
|
|
101
|
+
`DungeonSealDirectiveRecord` contract:
|
|
102
|
+
|
|
103
|
+
- `operatorSubjectId` is the only player-linked identifier and is expected to
|
|
104
|
+
be pseudonymous
|
|
105
|
+
- profile names, chat text, raw hotspot telemetry, and contact data are outside
|
|
106
|
+
the package contract
|
|
107
|
+
- `dungeonCraftingFieldPolicies` documents the retention and sensitivity
|
|
108
|
+
expectation for every exported directive field
|
|
109
|
+
- `defaultDungeonCraftingThroughputAssumptions` publishes the validated hotspot
|
|
110
|
+
evaluation and directive-commit envelope used by the package docs and tests
|
|
111
|
+
|
|
112
|
+
## Governance
|
|
113
|
+
|
|
114
|
+
- ADRs: [docs/adrs](./docs/adrs)
|
|
115
|
+
- TDRs: [docs/tdrs](./docs/tdrs)
|
|
116
|
+
- Design notes: [docs/design](./docs/design)
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
DUNGEON_CRAFTING_ENV_PREFIX: () => DUNGEON_CRAFTING_ENV_PREFIX,
|
|
24
|
+
DUNGEON_CRAFTING_FEATURE_FLAG_ID: () => DUNGEON_CRAFTING_FEATURE_FLAG_ID,
|
|
25
|
+
DUNGEON_CRAFTING_PACKAGE: () => DUNGEON_CRAFTING_PACKAGE,
|
|
26
|
+
DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE: () => DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE,
|
|
27
|
+
DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID: () => DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID,
|
|
28
|
+
createAuthorityFailurePolicy: () => createAuthorityFailurePolicy,
|
|
29
|
+
createDungeonAuthorityBoundaryResponse: () => createDungeonAuthorityBoundaryResponse,
|
|
30
|
+
createDungeonCraftingAccessState: () => createDungeonCraftingAccessState,
|
|
31
|
+
createDungeonCraftingThroughputAssumptions: () => createDungeonCraftingThroughputAssumptions,
|
|
32
|
+
createDungeonSealDirectiveRecord: () => createDungeonSealDirectiveRecord,
|
|
33
|
+
createPortableAuthorityHost: () => createPortableAuthorityHost,
|
|
34
|
+
defaultDungeonCraftingThroughputAssumptions: () => defaultDungeonCraftingThroughputAssumptions,
|
|
35
|
+
dungeonCraftingFieldPolicies: () => dungeonCraftingFieldPolicies,
|
|
36
|
+
dungeonCraftingPrivacyScaleRollout: () => dungeonCraftingPrivacyScaleRollout,
|
|
37
|
+
isChaosHotspotSeverity: () => isChaosHotspotSeverity,
|
|
38
|
+
isDivineAuthorityTier: () => isDivineAuthorityTier,
|
|
39
|
+
packageDescriptor: () => packageDescriptor
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(index_exports);
|
|
42
|
+
var DUNGEON_CRAFTING_PACKAGE = "@plasius/dungeon-crafting";
|
|
43
|
+
var DUNGEON_CRAFTING_ENV_PREFIX = "DUNGEON_CRAFTING";
|
|
44
|
+
var DUNGEON_CRAFTING_FEATURE_FLAG_ID = "isekai.dungeon-crafting.enabled";
|
|
45
|
+
var DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID = "isekai.training-progression.privacy-scale.enabled";
|
|
46
|
+
var DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE = "DUNGEON_CRAFTING_PRIVACY_SCALE_ENABLED";
|
|
47
|
+
var packageDescriptor = Object.freeze({
|
|
48
|
+
packageName: DUNGEON_CRAFTING_PACKAGE,
|
|
49
|
+
featureFlagId: DUNGEON_CRAFTING_FEATURE_FLAG_ID,
|
|
50
|
+
envPrefix: DUNGEON_CRAFTING_ENV_PREFIX,
|
|
51
|
+
summary: "DIS-gated dungeon-crafting and chaos-sealing authority contracts for Plasius."
|
|
52
|
+
});
|
|
53
|
+
var dungeonCraftingPrivacyScaleRollout = Object.freeze({
|
|
54
|
+
featureFlagId: DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID,
|
|
55
|
+
envOverride: DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE,
|
|
56
|
+
rollbackPlan: "Disable the dungeon-crafting privacy/scale rollout to fall back to the existing chaos-sealing access contract surface.",
|
|
57
|
+
summary: "Rolls out minimal seal-directive payloads and documented hotspot throughput assumptions."
|
|
58
|
+
});
|
|
59
|
+
var dungeonCraftingFieldPolicies = Object.freeze([
|
|
60
|
+
{
|
|
61
|
+
field: "operatorSubjectId",
|
|
62
|
+
sensitivity: "pseudonymous",
|
|
63
|
+
retention: "authoritative-sealing",
|
|
64
|
+
justification: "Stable pseudonymous subject identifier is required to attribute sealing authority without carrying profile names or contact data."
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
field: "hotspotId",
|
|
68
|
+
sensitivity: "internal",
|
|
69
|
+
retention: "authoritative-sealing",
|
|
70
|
+
justification: "Hotspot identifier is the minimum routing key needed to coordinate chaos-sealing directives."
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
field: "divineAuthorityTier",
|
|
74
|
+
sensitivity: "internal",
|
|
75
|
+
retention: "authoritative-sealing",
|
|
76
|
+
justification: "Authority tier is the smallest access-state field needed to validate whether a sealing directive may execute."
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
field: "hotspotSeverity",
|
|
80
|
+
sensitivity: "internal",
|
|
81
|
+
retention: "authoritative-sealing",
|
|
82
|
+
justification: "Hotspot severity determines sealing urgency and throughput budgeting without duplicating full dungeon telemetry."
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
field: "updatedAtIso",
|
|
86
|
+
sensitivity: "internal",
|
|
87
|
+
retention: "short-lived",
|
|
88
|
+
justification: "Update timestamp supports bounded ordering and replay protection for rapid hotspot updates."
|
|
89
|
+
}
|
|
90
|
+
]);
|
|
91
|
+
var defaultDungeonCraftingThroughputAssumptions = Object.freeze({
|
|
92
|
+
maxConcurrentSealOperations: 800,
|
|
93
|
+
maxHotspotEvaluationsPerMinute: 6e3,
|
|
94
|
+
maxDirectiveCommitsPerMinute: 12e3
|
|
95
|
+
});
|
|
96
|
+
function isDivineAuthorityTier(value) {
|
|
97
|
+
return value === "follower" || value === "near-seat" || value === "seat";
|
|
98
|
+
}
|
|
99
|
+
function isChaosHotspotSeverity(value) {
|
|
100
|
+
return value === "minor" || value === "major" || value === "catastrophic";
|
|
101
|
+
}
|
|
102
|
+
function freezeReadonlyArray(items) {
|
|
103
|
+
return Object.freeze([...items]);
|
|
104
|
+
}
|
|
105
|
+
function createDungeonCraftingAccessState(input) {
|
|
106
|
+
return Object.freeze({ ...input });
|
|
107
|
+
}
|
|
108
|
+
function assertNonEmptyString(value, label) {
|
|
109
|
+
if (value.trim().length === 0) {
|
|
110
|
+
throw new Error(`${label} must be a non-empty string`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function assertPositiveSafeInteger(value, label) {
|
|
114
|
+
if (!Number.isSafeInteger(value) || value <= 0) {
|
|
115
|
+
throw new Error(`${label} must be a positive safe integer`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
var iso8601DateRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
119
|
+
function assertValidUpdatedAtIso(value) {
|
|
120
|
+
if (!iso8601DateRegex.test(value) || Number.isNaN(Date.parse(value))) {
|
|
121
|
+
throw new Error("updatedAtIso must be an ISO-8601 timestamp");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function createDungeonSealDirectiveRecord(input) {
|
|
125
|
+
assertNonEmptyString(input.operatorSubjectId, "operatorSubjectId");
|
|
126
|
+
assertNonEmptyString(input.hotspotId, "hotspotId");
|
|
127
|
+
assertNonEmptyString(input.updatedAtIso, "updatedAtIso");
|
|
128
|
+
assertValidUpdatedAtIso(input.updatedAtIso);
|
|
129
|
+
if (!isDivineAuthorityTier(input.divineAuthorityTier)) {
|
|
130
|
+
throw new Error(
|
|
131
|
+
"divineAuthorityTier must be a supported dungeon-crafting authority tier"
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
if (!isChaosHotspotSeverity(input.hotspotSeverity)) {
|
|
135
|
+
throw new Error(
|
|
136
|
+
"hotspotSeverity must be a supported dungeon-crafting hotspot severity"
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
return Object.freeze({ ...input });
|
|
140
|
+
}
|
|
141
|
+
function createDungeonCraftingThroughputAssumptions(input) {
|
|
142
|
+
assertPositiveSafeInteger(
|
|
143
|
+
input.maxConcurrentSealOperations,
|
|
144
|
+
"maxConcurrentSealOperations"
|
|
145
|
+
);
|
|
146
|
+
assertPositiveSafeInteger(
|
|
147
|
+
input.maxHotspotEvaluationsPerMinute,
|
|
148
|
+
"maxHotspotEvaluationsPerMinute"
|
|
149
|
+
);
|
|
150
|
+
assertPositiveSafeInteger(
|
|
151
|
+
input.maxDirectiveCommitsPerMinute,
|
|
152
|
+
"maxDirectiveCommitsPerMinute"
|
|
153
|
+
);
|
|
154
|
+
return Object.freeze({ ...input });
|
|
155
|
+
}
|
|
156
|
+
function createPortableAuthorityHost(input) {
|
|
157
|
+
return Object.freeze({
|
|
158
|
+
...input,
|
|
159
|
+
capabilityFlags: freezeReadonlyArray(input.capabilityFlags)
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function createAuthorityFailurePolicy(input) {
|
|
163
|
+
return Object.freeze({
|
|
164
|
+
...input,
|
|
165
|
+
recoverableHotspotSeverities: freezeReadonlyArray(
|
|
166
|
+
input.recoverableHotspotSeverities
|
|
167
|
+
)
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function createDungeonAuthorityBoundaryResponse(input) {
|
|
171
|
+
return Object.freeze({
|
|
172
|
+
...input,
|
|
173
|
+
sourceHost: createPortableAuthorityHost(input.sourceHost),
|
|
174
|
+
failurePolicy: createAuthorityFailurePolicy(input.failurePolicy)
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
178
|
+
0 && (module.exports = {
|
|
179
|
+
DUNGEON_CRAFTING_ENV_PREFIX,
|
|
180
|
+
DUNGEON_CRAFTING_FEATURE_FLAG_ID,
|
|
181
|
+
DUNGEON_CRAFTING_PACKAGE,
|
|
182
|
+
DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE,
|
|
183
|
+
DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID,
|
|
184
|
+
createAuthorityFailurePolicy,
|
|
185
|
+
createDungeonAuthorityBoundaryResponse,
|
|
186
|
+
createDungeonCraftingAccessState,
|
|
187
|
+
createDungeonCraftingThroughputAssumptions,
|
|
188
|
+
createDungeonSealDirectiveRecord,
|
|
189
|
+
createPortableAuthorityHost,
|
|
190
|
+
defaultDungeonCraftingThroughputAssumptions,
|
|
191
|
+
dungeonCraftingFieldPolicies,
|
|
192
|
+
dungeonCraftingPrivacyScaleRollout,
|
|
193
|
+
isChaosHotspotSeverity,
|
|
194
|
+
isDivineAuthorityTier,
|
|
195
|
+
packageDescriptor
|
|
196
|
+
});
|
|
197
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +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":"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","names":[]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
interface PackageDescriptor {
|
|
2
|
+
readonly packageName: string;
|
|
3
|
+
readonly featureFlagId: string;
|
|
4
|
+
readonly envPrefix: string;
|
|
5
|
+
readonly summary: string;
|
|
6
|
+
}
|
|
7
|
+
interface RolloutDescriptor {
|
|
8
|
+
readonly featureFlagId: string;
|
|
9
|
+
readonly envOverride: string;
|
|
10
|
+
readonly rollbackPlan: string;
|
|
11
|
+
readonly summary: string;
|
|
12
|
+
}
|
|
13
|
+
type DivineAuthorityTier = "follower" | "near-seat" | "seat";
|
|
14
|
+
type ChaosHotspotSeverity = "minor" | "major" | "catastrophic";
|
|
15
|
+
type DungeonCraftingFieldSensitivity = "pseudonymous" | "internal";
|
|
16
|
+
type DungeonCraftingFieldRetention = "authoritative-sealing" | "short-lived";
|
|
17
|
+
type DungeonAuthorityOutcome = "granted" | "deferred" | "rejected";
|
|
18
|
+
type AuthorityHostRuntime = "browser" | "server" | "worker";
|
|
19
|
+
type AuthorityHostTransport = "in-process" | "http" | "queue";
|
|
20
|
+
interface DungeonCraftingAccessState {
|
|
21
|
+
readonly divineAuthorityTier: DivineAuthorityTier;
|
|
22
|
+
readonly hotspotSeverity: ChaosHotspotSeverity;
|
|
23
|
+
readonly eligible: boolean;
|
|
24
|
+
}
|
|
25
|
+
interface DungeonSealDirectiveRecord {
|
|
26
|
+
readonly operatorSubjectId: string;
|
|
27
|
+
readonly hotspotId: string;
|
|
28
|
+
readonly divineAuthorityTier: DivineAuthorityTier;
|
|
29
|
+
readonly hotspotSeverity: ChaosHotspotSeverity;
|
|
30
|
+
readonly updatedAtIso: string;
|
|
31
|
+
}
|
|
32
|
+
interface DungeonCraftingFieldPolicy {
|
|
33
|
+
readonly field: keyof DungeonSealDirectiveRecord;
|
|
34
|
+
readonly sensitivity: DungeonCraftingFieldSensitivity;
|
|
35
|
+
readonly retention: DungeonCraftingFieldRetention;
|
|
36
|
+
readonly justification: string;
|
|
37
|
+
}
|
|
38
|
+
interface DungeonCraftingThroughputAssumptions {
|
|
39
|
+
readonly maxConcurrentSealOperations: number;
|
|
40
|
+
readonly maxHotspotEvaluationsPerMinute: number;
|
|
41
|
+
readonly maxDirectiveCommitsPerMinute: number;
|
|
42
|
+
}
|
|
43
|
+
interface PortableAuthorityHost {
|
|
44
|
+
readonly hostId: string;
|
|
45
|
+
readonly runtime: AuthorityHostRuntime;
|
|
46
|
+
readonly transport: AuthorityHostTransport;
|
|
47
|
+
readonly capabilityFlags: readonly string[];
|
|
48
|
+
}
|
|
49
|
+
interface AuthorityFailurePolicy {
|
|
50
|
+
readonly timeoutMs: number;
|
|
51
|
+
readonly maxAttempts: number;
|
|
52
|
+
readonly recoverableHotspotSeverities: readonly ChaosHotspotSeverity[];
|
|
53
|
+
readonly escalationTarget: "operator" | "divine-seat" | "sealed-fallback";
|
|
54
|
+
}
|
|
55
|
+
interface DungeonAuthorityBoundaryResponse {
|
|
56
|
+
readonly responseId: string;
|
|
57
|
+
readonly divineAuthorityTier: DivineAuthorityTier;
|
|
58
|
+
readonly hotspotSeverity: ChaosHotspotSeverity;
|
|
59
|
+
readonly outcome: DungeonAuthorityOutcome;
|
|
60
|
+
readonly eligible: boolean;
|
|
61
|
+
readonly sourceHost: PortableAuthorityHost;
|
|
62
|
+
readonly failurePolicy: AuthorityFailurePolicy;
|
|
63
|
+
readonly observedAt: string;
|
|
64
|
+
}
|
|
65
|
+
declare const DUNGEON_CRAFTING_PACKAGE = "@plasius/dungeon-crafting";
|
|
66
|
+
declare const DUNGEON_CRAFTING_ENV_PREFIX = "DUNGEON_CRAFTING";
|
|
67
|
+
declare const DUNGEON_CRAFTING_FEATURE_FLAG_ID = "isekai.dungeon-crafting.enabled";
|
|
68
|
+
declare const DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID = "isekai.training-progression.privacy-scale.enabled";
|
|
69
|
+
declare const DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE = "DUNGEON_CRAFTING_PRIVACY_SCALE_ENABLED";
|
|
70
|
+
declare const packageDescriptor: PackageDescriptor;
|
|
71
|
+
declare const dungeonCraftingPrivacyScaleRollout: RolloutDescriptor;
|
|
72
|
+
declare const dungeonCraftingFieldPolicies: readonly DungeonCraftingFieldPolicy[];
|
|
73
|
+
declare const defaultDungeonCraftingThroughputAssumptions: DungeonCraftingThroughputAssumptions;
|
|
74
|
+
declare function isDivineAuthorityTier(value: string): value is DivineAuthorityTier;
|
|
75
|
+
declare function isChaosHotspotSeverity(value: string): value is ChaosHotspotSeverity;
|
|
76
|
+
declare function createDungeonCraftingAccessState(input: DungeonCraftingAccessState): DungeonCraftingAccessState;
|
|
77
|
+
declare function createDungeonSealDirectiveRecord(input: DungeonSealDirectiveRecord): DungeonSealDirectiveRecord;
|
|
78
|
+
declare function createDungeonCraftingThroughputAssumptions(input: DungeonCraftingThroughputAssumptions): DungeonCraftingThroughputAssumptions;
|
|
79
|
+
declare function createPortableAuthorityHost(input: PortableAuthorityHost): PortableAuthorityHost;
|
|
80
|
+
declare function createAuthorityFailurePolicy(input: AuthorityFailurePolicy): AuthorityFailurePolicy;
|
|
81
|
+
declare function createDungeonAuthorityBoundaryResponse(input: DungeonAuthorityBoundaryResponse): DungeonAuthorityBoundaryResponse;
|
|
82
|
+
|
|
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 };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
interface PackageDescriptor {
|
|
2
|
+
readonly packageName: string;
|
|
3
|
+
readonly featureFlagId: string;
|
|
4
|
+
readonly envPrefix: string;
|
|
5
|
+
readonly summary: string;
|
|
6
|
+
}
|
|
7
|
+
interface RolloutDescriptor {
|
|
8
|
+
readonly featureFlagId: string;
|
|
9
|
+
readonly envOverride: string;
|
|
10
|
+
readonly rollbackPlan: string;
|
|
11
|
+
readonly summary: string;
|
|
12
|
+
}
|
|
13
|
+
type DivineAuthorityTier = "follower" | "near-seat" | "seat";
|
|
14
|
+
type ChaosHotspotSeverity = "minor" | "major" | "catastrophic";
|
|
15
|
+
type DungeonCraftingFieldSensitivity = "pseudonymous" | "internal";
|
|
16
|
+
type DungeonCraftingFieldRetention = "authoritative-sealing" | "short-lived";
|
|
17
|
+
type DungeonAuthorityOutcome = "granted" | "deferred" | "rejected";
|
|
18
|
+
type AuthorityHostRuntime = "browser" | "server" | "worker";
|
|
19
|
+
type AuthorityHostTransport = "in-process" | "http" | "queue";
|
|
20
|
+
interface DungeonCraftingAccessState {
|
|
21
|
+
readonly divineAuthorityTier: DivineAuthorityTier;
|
|
22
|
+
readonly hotspotSeverity: ChaosHotspotSeverity;
|
|
23
|
+
readonly eligible: boolean;
|
|
24
|
+
}
|
|
25
|
+
interface DungeonSealDirectiveRecord {
|
|
26
|
+
readonly operatorSubjectId: string;
|
|
27
|
+
readonly hotspotId: string;
|
|
28
|
+
readonly divineAuthorityTier: DivineAuthorityTier;
|
|
29
|
+
readonly hotspotSeverity: ChaosHotspotSeverity;
|
|
30
|
+
readonly updatedAtIso: string;
|
|
31
|
+
}
|
|
32
|
+
interface DungeonCraftingFieldPolicy {
|
|
33
|
+
readonly field: keyof DungeonSealDirectiveRecord;
|
|
34
|
+
readonly sensitivity: DungeonCraftingFieldSensitivity;
|
|
35
|
+
readonly retention: DungeonCraftingFieldRetention;
|
|
36
|
+
readonly justification: string;
|
|
37
|
+
}
|
|
38
|
+
interface DungeonCraftingThroughputAssumptions {
|
|
39
|
+
readonly maxConcurrentSealOperations: number;
|
|
40
|
+
readonly maxHotspotEvaluationsPerMinute: number;
|
|
41
|
+
readonly maxDirectiveCommitsPerMinute: number;
|
|
42
|
+
}
|
|
43
|
+
interface PortableAuthorityHost {
|
|
44
|
+
readonly hostId: string;
|
|
45
|
+
readonly runtime: AuthorityHostRuntime;
|
|
46
|
+
readonly transport: AuthorityHostTransport;
|
|
47
|
+
readonly capabilityFlags: readonly string[];
|
|
48
|
+
}
|
|
49
|
+
interface AuthorityFailurePolicy {
|
|
50
|
+
readonly timeoutMs: number;
|
|
51
|
+
readonly maxAttempts: number;
|
|
52
|
+
readonly recoverableHotspotSeverities: readonly ChaosHotspotSeverity[];
|
|
53
|
+
readonly escalationTarget: "operator" | "divine-seat" | "sealed-fallback";
|
|
54
|
+
}
|
|
55
|
+
interface DungeonAuthorityBoundaryResponse {
|
|
56
|
+
readonly responseId: string;
|
|
57
|
+
readonly divineAuthorityTier: DivineAuthorityTier;
|
|
58
|
+
readonly hotspotSeverity: ChaosHotspotSeverity;
|
|
59
|
+
readonly outcome: DungeonAuthorityOutcome;
|
|
60
|
+
readonly eligible: boolean;
|
|
61
|
+
readonly sourceHost: PortableAuthorityHost;
|
|
62
|
+
readonly failurePolicy: AuthorityFailurePolicy;
|
|
63
|
+
readonly observedAt: string;
|
|
64
|
+
}
|
|
65
|
+
declare const DUNGEON_CRAFTING_PACKAGE = "@plasius/dungeon-crafting";
|
|
66
|
+
declare const DUNGEON_CRAFTING_ENV_PREFIX = "DUNGEON_CRAFTING";
|
|
67
|
+
declare const DUNGEON_CRAFTING_FEATURE_FLAG_ID = "isekai.dungeon-crafting.enabled";
|
|
68
|
+
declare const DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID = "isekai.training-progression.privacy-scale.enabled";
|
|
69
|
+
declare const DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE = "DUNGEON_CRAFTING_PRIVACY_SCALE_ENABLED";
|
|
70
|
+
declare const packageDescriptor: PackageDescriptor;
|
|
71
|
+
declare const dungeonCraftingPrivacyScaleRollout: RolloutDescriptor;
|
|
72
|
+
declare const dungeonCraftingFieldPolicies: readonly DungeonCraftingFieldPolicy[];
|
|
73
|
+
declare const defaultDungeonCraftingThroughputAssumptions: DungeonCraftingThroughputAssumptions;
|
|
74
|
+
declare function isDivineAuthorityTier(value: string): value is DivineAuthorityTier;
|
|
75
|
+
declare function isChaosHotspotSeverity(value: string): value is ChaosHotspotSeverity;
|
|
76
|
+
declare function createDungeonCraftingAccessState(input: DungeonCraftingAccessState): DungeonCraftingAccessState;
|
|
77
|
+
declare function createDungeonSealDirectiveRecord(input: DungeonSealDirectiveRecord): DungeonSealDirectiveRecord;
|
|
78
|
+
declare function createDungeonCraftingThroughputAssumptions(input: DungeonCraftingThroughputAssumptions): DungeonCraftingThroughputAssumptions;
|
|
79
|
+
declare function createPortableAuthorityHost(input: PortableAuthorityHost): PortableAuthorityHost;
|
|
80
|
+
declare function createAuthorityFailurePolicy(input: AuthorityFailurePolicy): AuthorityFailurePolicy;
|
|
81
|
+
declare function createDungeonAuthorityBoundaryResponse(input: DungeonAuthorityBoundaryResponse): DungeonAuthorityBoundaryResponse;
|
|
82
|
+
|
|
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 };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
var DUNGEON_CRAFTING_PACKAGE = "@plasius/dungeon-crafting";
|
|
3
|
+
var DUNGEON_CRAFTING_ENV_PREFIX = "DUNGEON_CRAFTING";
|
|
4
|
+
var DUNGEON_CRAFTING_FEATURE_FLAG_ID = "isekai.dungeon-crafting.enabled";
|
|
5
|
+
var DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID = "isekai.training-progression.privacy-scale.enabled";
|
|
6
|
+
var DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE = "DUNGEON_CRAFTING_PRIVACY_SCALE_ENABLED";
|
|
7
|
+
var packageDescriptor = Object.freeze({
|
|
8
|
+
packageName: DUNGEON_CRAFTING_PACKAGE,
|
|
9
|
+
featureFlagId: DUNGEON_CRAFTING_FEATURE_FLAG_ID,
|
|
10
|
+
envPrefix: DUNGEON_CRAFTING_ENV_PREFIX,
|
|
11
|
+
summary: "DIS-gated dungeon-crafting and chaos-sealing authority contracts for Plasius."
|
|
12
|
+
});
|
|
13
|
+
var dungeonCraftingPrivacyScaleRollout = Object.freeze({
|
|
14
|
+
featureFlagId: DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID,
|
|
15
|
+
envOverride: DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE,
|
|
16
|
+
rollbackPlan: "Disable the dungeon-crafting privacy/scale rollout to fall back to the existing chaos-sealing access contract surface.",
|
|
17
|
+
summary: "Rolls out minimal seal-directive payloads and documented hotspot throughput assumptions."
|
|
18
|
+
});
|
|
19
|
+
var dungeonCraftingFieldPolicies = Object.freeze([
|
|
20
|
+
{
|
|
21
|
+
field: "operatorSubjectId",
|
|
22
|
+
sensitivity: "pseudonymous",
|
|
23
|
+
retention: "authoritative-sealing",
|
|
24
|
+
justification: "Stable pseudonymous subject identifier is required to attribute sealing authority without carrying profile names or contact data."
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
field: "hotspotId",
|
|
28
|
+
sensitivity: "internal",
|
|
29
|
+
retention: "authoritative-sealing",
|
|
30
|
+
justification: "Hotspot identifier is the minimum routing key needed to coordinate chaos-sealing directives."
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
field: "divineAuthorityTier",
|
|
34
|
+
sensitivity: "internal",
|
|
35
|
+
retention: "authoritative-sealing",
|
|
36
|
+
justification: "Authority tier is the smallest access-state field needed to validate whether a sealing directive may execute."
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
field: "hotspotSeverity",
|
|
40
|
+
sensitivity: "internal",
|
|
41
|
+
retention: "authoritative-sealing",
|
|
42
|
+
justification: "Hotspot severity determines sealing urgency and throughput budgeting without duplicating full dungeon telemetry."
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
field: "updatedAtIso",
|
|
46
|
+
sensitivity: "internal",
|
|
47
|
+
retention: "short-lived",
|
|
48
|
+
justification: "Update timestamp supports bounded ordering and replay protection for rapid hotspot updates."
|
|
49
|
+
}
|
|
50
|
+
]);
|
|
51
|
+
var defaultDungeonCraftingThroughputAssumptions = Object.freeze({
|
|
52
|
+
maxConcurrentSealOperations: 800,
|
|
53
|
+
maxHotspotEvaluationsPerMinute: 6e3,
|
|
54
|
+
maxDirectiveCommitsPerMinute: 12e3
|
|
55
|
+
});
|
|
56
|
+
function isDivineAuthorityTier(value) {
|
|
57
|
+
return value === "follower" || value === "near-seat" || value === "seat";
|
|
58
|
+
}
|
|
59
|
+
function isChaosHotspotSeverity(value) {
|
|
60
|
+
return value === "minor" || value === "major" || value === "catastrophic";
|
|
61
|
+
}
|
|
62
|
+
function freezeReadonlyArray(items) {
|
|
63
|
+
return Object.freeze([...items]);
|
|
64
|
+
}
|
|
65
|
+
function createDungeonCraftingAccessState(input) {
|
|
66
|
+
return Object.freeze({ ...input });
|
|
67
|
+
}
|
|
68
|
+
function assertNonEmptyString(value, label) {
|
|
69
|
+
if (value.trim().length === 0) {
|
|
70
|
+
throw new Error(`${label} must be a non-empty string`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function assertPositiveSafeInteger(value, label) {
|
|
74
|
+
if (!Number.isSafeInteger(value) || value <= 0) {
|
|
75
|
+
throw new Error(`${label} must be a positive safe integer`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
var iso8601DateRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
79
|
+
function assertValidUpdatedAtIso(value) {
|
|
80
|
+
if (!iso8601DateRegex.test(value) || Number.isNaN(Date.parse(value))) {
|
|
81
|
+
throw new Error("updatedAtIso must be an ISO-8601 timestamp");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function createDungeonSealDirectiveRecord(input) {
|
|
85
|
+
assertNonEmptyString(input.operatorSubjectId, "operatorSubjectId");
|
|
86
|
+
assertNonEmptyString(input.hotspotId, "hotspotId");
|
|
87
|
+
assertNonEmptyString(input.updatedAtIso, "updatedAtIso");
|
|
88
|
+
assertValidUpdatedAtIso(input.updatedAtIso);
|
|
89
|
+
if (!isDivineAuthorityTier(input.divineAuthorityTier)) {
|
|
90
|
+
throw new Error(
|
|
91
|
+
"divineAuthorityTier must be a supported dungeon-crafting authority tier"
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
if (!isChaosHotspotSeverity(input.hotspotSeverity)) {
|
|
95
|
+
throw new Error(
|
|
96
|
+
"hotspotSeverity must be a supported dungeon-crafting hotspot severity"
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
return Object.freeze({ ...input });
|
|
100
|
+
}
|
|
101
|
+
function createDungeonCraftingThroughputAssumptions(input) {
|
|
102
|
+
assertPositiveSafeInteger(
|
|
103
|
+
input.maxConcurrentSealOperations,
|
|
104
|
+
"maxConcurrentSealOperations"
|
|
105
|
+
);
|
|
106
|
+
assertPositiveSafeInteger(
|
|
107
|
+
input.maxHotspotEvaluationsPerMinute,
|
|
108
|
+
"maxHotspotEvaluationsPerMinute"
|
|
109
|
+
);
|
|
110
|
+
assertPositiveSafeInteger(
|
|
111
|
+
input.maxDirectiveCommitsPerMinute,
|
|
112
|
+
"maxDirectiveCommitsPerMinute"
|
|
113
|
+
);
|
|
114
|
+
return Object.freeze({ ...input });
|
|
115
|
+
}
|
|
116
|
+
function createPortableAuthorityHost(input) {
|
|
117
|
+
return Object.freeze({
|
|
118
|
+
...input,
|
|
119
|
+
capabilityFlags: freezeReadonlyArray(input.capabilityFlags)
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function createAuthorityFailurePolicy(input) {
|
|
123
|
+
return Object.freeze({
|
|
124
|
+
...input,
|
|
125
|
+
recoverableHotspotSeverities: freezeReadonlyArray(
|
|
126
|
+
input.recoverableHotspotSeverities
|
|
127
|
+
)
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function createDungeonAuthorityBoundaryResponse(input) {
|
|
131
|
+
return Object.freeze({
|
|
132
|
+
...input,
|
|
133
|
+
sourceHost: createPortableAuthorityHost(input.sourceHost),
|
|
134
|
+
failurePolicy: createAuthorityFailurePolicy(input.failurePolicy)
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
export {
|
|
138
|
+
DUNGEON_CRAFTING_ENV_PREFIX,
|
|
139
|
+
DUNGEON_CRAFTING_FEATURE_FLAG_ID,
|
|
140
|
+
DUNGEON_CRAFTING_PACKAGE,
|
|
141
|
+
DUNGEON_CRAFTING_PRIVACY_SCALE_ENV_OVERRIDE,
|
|
142
|
+
DUNGEON_CRAFTING_PRIVACY_SCALE_FEATURE_FLAG_ID,
|
|
143
|
+
createAuthorityFailurePolicy,
|
|
144
|
+
createDungeonAuthorityBoundaryResponse,
|
|
145
|
+
createDungeonCraftingAccessState,
|
|
146
|
+
createDungeonCraftingThroughputAssumptions,
|
|
147
|
+
createDungeonSealDirectiveRecord,
|
|
148
|
+
createPortableAuthorityHost,
|
|
149
|
+
defaultDungeonCraftingThroughputAssumptions,
|
|
150
|
+
dungeonCraftingFieldPolicies,
|
|
151
|
+
dungeonCraftingPrivacyScaleRollout,
|
|
152
|
+
isChaosHotspotSeverity,
|
|
153
|
+
isDivineAuthorityTier,
|
|
154
|
+
packageDescriptor
|
|
155
|
+
};
|
|
156
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,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,8BAA8B;AAChC,CAAC;AAEI,SAAS,sBACd,OAC8B;AAC9B,SAAO,UAAU,cAAc,UAAU,eAAe,UAAU;AACpE;AAEO,SAAS,uBACd,OAC+B;AAC/B,SAAO,UAAU,WAAW,UAAU,WAAW,UAAU;AAC7D;AAEA,SAAS,oBAAuB,OAAmC;AACjE,SAAO,OAAO,OAAO,CAAC,GAAG,KAAK,CAAC;AACjC;AAEO,SAAS,iCACd,OAC4B;AAC5B,SAAO,OAAO,OAAO,EAAE,GAAG,MAAM,CAAC;AACnC;AAEA,SAAS,qBAAqB,OAAe,OAAqB;AAChE,MAAI,MAAM,KAAK,EAAE,WAAW,GAAG;AAC7B,UAAM,IAAI,MAAM,GAAG,KAAK,6BAA6B;AAAA,EACvD;AACF;AAEA,SAAS,0BAA0B,OAAe,OAAqB;AACrE,MAAI,CAAC,OAAO,cAAc,KAAK,KAAK,SAAS,GAAG;AAC9C,UAAM,IAAI,MAAM,GAAG,KAAK,kCAAkC;AAAA,EAC5D;AACF;AAEA,IAAM,mBACJ;AAEF,SAAS,wBAAwB,OAAqB;AACpD,MAAI,CAAC,iBAAiB,KAAK,KAAK,KAAK,OAAO,MAAM,KAAK,MAAM,KAAK,CAAC,GAAG;AACpE,UAAM,IAAI,MAAM,4CAA4C;AAAA,EAC9D;AACF;AAEO,SAAS,iCACd,OAC4B;AAC5B,uBAAqB,MAAM,mBAAmB,mBAAmB;AACjE,uBAAqB,MAAM,WAAW,WAAW;AACjD,uBAAqB,MAAM,cAAc,cAAc;AACvD,0BAAwB,MAAM,YAAY;AAE1C,MAAI,CAAC,sBAAsB,MAAM,mBAAmB,GAAG;AACrD,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,2CACd,OACsC;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":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@plasius/dungeon-crafting",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "DIS-gated dungeon-crafting and chaos-sealing authority contracts for Plasius",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"require": "./dist/index.cjs"
|
|
18
|
+
},
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsup",
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"test:watch": "vitest",
|
|
25
|
+
"typecheck": "tsc --noEmit",
|
|
26
|
+
"audit:eslint": "eslint . --max-warnings=0",
|
|
27
|
+
"audit:deps": "npm ls --all --omit=optional --omit=peer > /dev/null 2>&1 || true",
|
|
28
|
+
"audit:npm": "npm audit --audit-level=high --omit=dev",
|
|
29
|
+
"audit:test": "vitest run --coverage",
|
|
30
|
+
"lint": "eslint . --max-warnings=0",
|
|
31
|
+
"prepare": "npm run build",
|
|
32
|
+
"clean": "rimraf dist",
|
|
33
|
+
"test:coverage": "vitest run --coverage",
|
|
34
|
+
"pack:check": "node scripts/verify-public-package.cjs",
|
|
35
|
+
"prepublishOnly": "npm run build && npm run pack:check"
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"plasius",
|
|
39
|
+
"dungeon-crafting",
|
|
40
|
+
"chaos",
|
|
41
|
+
"divine",
|
|
42
|
+
"authority",
|
|
43
|
+
"typescript"
|
|
44
|
+
],
|
|
45
|
+
"author": "Plasius LTD <development@plasius.co.uk>",
|
|
46
|
+
"license": "Apache-2.0",
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "git+https://github.com/Plasius-LTD/dungeon-crafting.git"
|
|
50
|
+
},
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/Plasius-LTD/dungeon-crafting/issues"
|
|
53
|
+
},
|
|
54
|
+
"homepage": "https://github.com/Plasius-LTD/dungeon-crafting#readme",
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@eslint/js": "^10.0.1",
|
|
57
|
+
"@types/node": "^25.9.1",
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^8.59.4",
|
|
59
|
+
"@typescript-eslint/parser": "^8.59.4",
|
|
60
|
+
"@vitest/coverage-v8": "^4.1.7",
|
|
61
|
+
"eslint": "^10.4.0",
|
|
62
|
+
"globals": "^17.6.0",
|
|
63
|
+
"rimraf": "^6.0.1",
|
|
64
|
+
"tsup": "^8.5.1",
|
|
65
|
+
"tsx": "^4.22.3",
|
|
66
|
+
"typescript": "^6.0.3",
|
|
67
|
+
"vitest": "^4.1.7"
|
|
68
|
+
},
|
|
69
|
+
"publishConfig": {
|
|
70
|
+
"access": "public"
|
|
71
|
+
},
|
|
72
|
+
"funding": [
|
|
73
|
+
{
|
|
74
|
+
"type": "patreon",
|
|
75
|
+
"url": "https://www.patreon.com/c/plasiusltd/membership"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"type": "github",
|
|
79
|
+
"url": "https://github.com/sponsors/Plasius-LTD"
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
"overrides": {
|
|
83
|
+
"minimatch": "^10.2.1"
|
|
84
|
+
},
|
|
85
|
+
"engines": {
|
|
86
|
+
"node": ">=24"
|
|
87
|
+
}
|
|
88
|
+
}
|