@icjhd/cj-quest 2.1.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/.cj-package.json +28 -0
- package/.cj-stubs/assets/canonical.js +15 -0
- package/.cj-stubs/assets/event.js +19 -0
- package/.cj-stubs/assets/executor.js +21 -0
- package/.cj-stubs/assets/loader.js +19 -0
- package/.cj-stubs/assets/marker.js +20 -0
- package/.cj-stubs/assets/migration.js +18 -0
- package/.cj-stubs/assets/save.js +28 -0
- package/.cj-stubs/assets/store.js +43 -0
- package/.cj-stubs/assets/system.js +29 -0
- package/.cj-stubs/assets/target-index.js +31 -0
- package/.cj-stubs/assets/testing.js +15 -0
- package/.cj-stubs/assets/types.js +15 -0
- package/.cj-stubs/assets/wave-director.js +25 -0
- package/.cj-stubs/assets/wave-ledger.js +21 -0
- package/.cj-stubs/index.js +22 -0
- package/.cj-stubs/recovery-manifest.json +97 -0
- package/README.md +21 -0
- package/assets/canonical.d.ts +3 -0
- package/assets/canonical.js +15 -0
- package/assets/event.d.ts +8 -0
- package/assets/event.js +19 -0
- package/assets/executor.d.ts +37 -0
- package/assets/executor.js +21 -0
- package/assets/loader.d.ts +8 -0
- package/assets/loader.js +19 -0
- package/assets/marker.d.ts +13 -0
- package/assets/marker.js +20 -0
- package/assets/migration.d.ts +6 -0
- package/assets/migration.js +18 -0
- package/assets/save.d.ts +28 -0
- package/assets/save.js +28 -0
- package/assets/store.d.ts +61 -0
- package/assets/store.js +43 -0
- package/assets/system.d.ts +58 -0
- package/assets/system.js +29 -0
- package/assets/target-index.d.ts +31 -0
- package/assets/target-index.js +31 -0
- package/assets/testing.d.ts +4 -0
- package/assets/testing.js +15 -0
- package/assets/types.d.ts +268 -0
- package/assets/types.js +15 -0
- package/assets/wave-director.d.ts +76 -0
- package/assets/wave-director.js +25 -0
- package/assets/wave-ledger.d.ts +28 -0
- package/assets/wave-ledger.js +21 -0
- package/cj-release-commit.json +10 -0
- package/encrypted-payload-v2/files/assets/canonical.js.bin +1 -0
- package/encrypted-payload-v2/files/assets/event.js.bin +3 -0
- package/encrypted-payload-v2/files/assets/executor.js.bin +0 -0
- package/encrypted-payload-v2/files/assets/loader.js.bin +0 -0
- package/encrypted-payload-v2/files/assets/marker.js.bin +0 -0
- package/encrypted-payload-v2/files/assets/migration.js.bin +0 -0
- package/encrypted-payload-v2/files/assets/save.js.bin +0 -0
- package/encrypted-payload-v2/files/assets/store.js.bin +0 -0
- package/encrypted-payload-v2/files/assets/system.js.bin +0 -0
- package/encrypted-payload-v2/files/assets/target-index.js.bin +0 -0
- package/encrypted-payload-v2/files/assets/testing.js.bin +1 -0
- package/encrypted-payload-v2/files/assets/types.js.bin +1 -0
- package/encrypted-payload-v2/files/assets/wave-director.js.bin +0 -0
- package/encrypted-payload-v2/files/assets/wave-ledger.js.bin +0 -0
- package/encrypted-payload-v2/files/index.js.bin +2 -0
- package/encrypted-payload-v2/manifest.json +197 -0
- package/index.d.ts +10 -0
- package/index.js +22 -0
- package/package.json +48 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { QuestStore } from "./store";
|
|
2
|
+
import { QuestTargetIndex } from "./target-index";
|
|
3
|
+
import type { QuestMarkerSnapshot, QuestRuntimeStep } from "./types";
|
|
4
|
+
export declare const TRACKED_QUEST_FLAG = "__quest-runtime.tracked-quest";
|
|
5
|
+
/** Deterministic projection used by map/HUD adapters; it never owns progression state. */
|
|
6
|
+
export declare class QuestMarkerProjector {
|
|
7
|
+
private readonly store;
|
|
8
|
+
private readonly targets;
|
|
9
|
+
constructor(store: QuestStore, targets: QuestTargetIndex);
|
|
10
|
+
snapshots(): QuestMarkerSnapshot[];
|
|
11
|
+
}
|
|
12
|
+
export declare function markerIdForStep(step: QuestRuntimeStep): string;
|
|
13
|
+
export declare function markerVisibilityFlag(questId: string, markerId: string): string;
|
package/assets/marker.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// CJHD editor-safe runtime stub. Generated by the publisher release tool.
|
|
2
|
+
|
|
3
|
+
const __cjSafeValue = new Proxy(function __cjSafeValue() {}, {
|
|
4
|
+
get(target, key) {
|
|
5
|
+
if (key === Symbol.toPrimitive) return function () { return 0; };
|
|
6
|
+
if (key === 'valueOf') return function () { return 0; };
|
|
7
|
+
if (key === 'toString') return function () { return '[CJHD editor-safe stub]'; };
|
|
8
|
+
return __cjSafeValue;
|
|
9
|
+
},
|
|
10
|
+
apply() { return __cjSafeValue; },
|
|
11
|
+
construct() { return __cjSafeValue; },
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export class QuestMarkerProjector {
|
|
15
|
+
constructor(...args) {}
|
|
16
|
+
snapshots(...args) { return []; }
|
|
17
|
+
}
|
|
18
|
+
export function markerIdForStep(...args) { return __cjSafeValue; }
|
|
19
|
+
export function markerVisibilityFlag(...args) { return __cjSafeValue; }
|
|
20
|
+
export const TRACKED_QUEST_FLAG = __cjSafeValue;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { QuestMigration, QuestRuntimeBundle, QuestRuntimeSnapshot } from "./types";
|
|
2
|
+
export declare class QuestMigrationError extends Error {
|
|
3
|
+
constructor(message: string);
|
|
4
|
+
}
|
|
5
|
+
export declare function migrateQuestSnapshot(snapshot: QuestRuntimeSnapshot, targetBundle: QuestRuntimeBundle): QuestRuntimeSnapshot;
|
|
6
|
+
export declare function findMigrationChain(from: string, to: string, migrations: QuestMigration[]): QuestMigration[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// CJHD editor-safe runtime stub. Generated by the publisher release tool.
|
|
2
|
+
|
|
3
|
+
const __cjSafeValue = new Proxy(function __cjSafeValue() {}, {
|
|
4
|
+
get(target, key) {
|
|
5
|
+
if (key === Symbol.toPrimitive) return function () { return 0; };
|
|
6
|
+
if (key === 'valueOf') return function () { return 0; };
|
|
7
|
+
if (key === 'toString') return function () { return '[CJHD editor-safe stub]'; };
|
|
8
|
+
return __cjSafeValue;
|
|
9
|
+
},
|
|
10
|
+
apply() { return __cjSafeValue; },
|
|
11
|
+
construct() { return __cjSafeValue; },
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export class QuestMigrationError {
|
|
15
|
+
constructor(...args) {}
|
|
16
|
+
}
|
|
17
|
+
export function migrateQuestSnapshot(...args) { return __cjSafeValue; }
|
|
18
|
+
export function findMigrationChain(...args) { return __cjSafeValue; }
|
package/assets/save.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type QuestRuntimeSnapshot } from "./types";
|
|
2
|
+
export interface QuestStorage {
|
|
3
|
+
getItem(key: string): string | null;
|
|
4
|
+
setItem(key: string, value: string): void;
|
|
5
|
+
removeItem?(key: string): void;
|
|
6
|
+
}
|
|
7
|
+
export declare class MemoryQuestStorage implements QuestStorage {
|
|
8
|
+
private readonly values;
|
|
9
|
+
getItem(key: string): string | null;
|
|
10
|
+
setItem(key: string, value: string): void;
|
|
11
|
+
removeItem(key: string): void;
|
|
12
|
+
}
|
|
13
|
+
export declare class QuestSaveRepository {
|
|
14
|
+
private readonly storage;
|
|
15
|
+
private readonly primaryKey;
|
|
16
|
+
private readonly previousKey;
|
|
17
|
+
constructor(storage: QuestStorage, namespace?: string);
|
|
18
|
+
load(): {
|
|
19
|
+
snapshot: QuestRuntimeSnapshot | null;
|
|
20
|
+
source: "current" | "previous" | "none";
|
|
21
|
+
errors: string[];
|
|
22
|
+
};
|
|
23
|
+
save(snapshot: QuestRuntimeSnapshot): void;
|
|
24
|
+
clear(): void;
|
|
25
|
+
}
|
|
26
|
+
export declare function encodeEnvelope(snapshot: QuestRuntimeSnapshot): string;
|
|
27
|
+
export declare function decodeEnvelope(text: string): QuestRuntimeSnapshot;
|
|
28
|
+
export declare function checksumSnapshot(snapshot: QuestRuntimeSnapshot): string;
|
package/assets/save.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// CJHD editor-safe runtime stub. Generated by the publisher release tool.
|
|
2
|
+
|
|
3
|
+
const __cjSafeValue = new Proxy(function __cjSafeValue() {}, {
|
|
4
|
+
get(target, key) {
|
|
5
|
+
if (key === Symbol.toPrimitive) return function () { return 0; };
|
|
6
|
+
if (key === 'valueOf') return function () { return 0; };
|
|
7
|
+
if (key === 'toString') return function () { return '[CJHD editor-safe stub]'; };
|
|
8
|
+
return __cjSafeValue;
|
|
9
|
+
},
|
|
10
|
+
apply() { return __cjSafeValue; },
|
|
11
|
+
construct() { return __cjSafeValue; },
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export class MemoryQuestStorage {
|
|
15
|
+
constructor(...args) {}
|
|
16
|
+
getItem(...args) { return __cjSafeValue; }
|
|
17
|
+
setItem(...args) { return __cjSafeValue; }
|
|
18
|
+
removeItem(...args) { return __cjSafeValue; }
|
|
19
|
+
}
|
|
20
|
+
export class QuestSaveRepository {
|
|
21
|
+
constructor(...args) {}
|
|
22
|
+
load(...args) { return __cjSafeValue; }
|
|
23
|
+
save(...args) { return __cjSafeValue; }
|
|
24
|
+
clear(...args) { return __cjSafeValue; }
|
|
25
|
+
}
|
|
26
|
+
export function encodeEnvelope(...args) { return __cjSafeValue; }
|
|
27
|
+
export function decodeEnvelope(...args) { return __cjSafeValue; }
|
|
28
|
+
export function checksumSnapshot(...args) { return __cjSafeValue; }
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type QuestRunStatus, type QuestRuntimeBundle, type QuestRuntimeQuest, type QuestRuntimeSnapshot, type QuestRuntimeStep, type QuestStepProgress, type QuestTransition, type QuestValue } from "./types";
|
|
2
|
+
export type QuestTransitionListener = (transition: QuestTransition, step: QuestRuntimeStep) => void;
|
|
3
|
+
export type QuestActivationGuard = (questId: string, step: QuestRuntimeStep) => boolean;
|
|
4
|
+
export interface QuestRetryResult {
|
|
5
|
+
ok: boolean;
|
|
6
|
+
questId: string;
|
|
7
|
+
resetStepIds: string[];
|
|
8
|
+
reason?: "quest-not-found" | "quest-not-failed" | "failed-step-not-retryable";
|
|
9
|
+
}
|
|
10
|
+
export declare class QuestStore {
|
|
11
|
+
readonly bundle: QuestRuntimeBundle;
|
|
12
|
+
private state;
|
|
13
|
+
private readonly parents;
|
|
14
|
+
private transitionListener;
|
|
15
|
+
private activationGuard;
|
|
16
|
+
private dirty;
|
|
17
|
+
constructor(bundle: QuestRuntimeBundle, state?: QuestRuntimeSnapshot);
|
|
18
|
+
setTransitionListener(listener: QuestTransitionListener | null): void;
|
|
19
|
+
setActivationGuard(guard: QuestActivationGuard | null): void;
|
|
20
|
+
get snapshot(): QuestRuntimeSnapshot;
|
|
21
|
+
replaceSnapshot(snapshot: QuestRuntimeSnapshot): void;
|
|
22
|
+
consumeDirty(): boolean;
|
|
23
|
+
setCurrentLevel(levelId: string): void;
|
|
24
|
+
advanceTime(deltaMs: number): void;
|
|
25
|
+
activateAutoStart(levelId: string): void;
|
|
26
|
+
activateQuest(questId: string): boolean;
|
|
27
|
+
/** Retry is content-controlled: every failed non-flow step must explicitly opt into on-retry. */
|
|
28
|
+
retryQuest(questId: string): QuestRetryResult;
|
|
29
|
+
cancelQuest(questId: string): boolean;
|
|
30
|
+
activateStep(questId: string, stepId: string): boolean;
|
|
31
|
+
completeStep(questId: string, stepId: string): boolean;
|
|
32
|
+
failStep(questId: string, stepId: string): boolean;
|
|
33
|
+
cancelStep(questId: string, stepId: string): boolean;
|
|
34
|
+
setStepProgress(questId: string, stepId: string, progressValue: number): void;
|
|
35
|
+
setStepData(questId: string, stepId: string, key: string, value: QuestValue): void;
|
|
36
|
+
stepData(questId: string, stepId: string, key: string): QuestValue | undefined;
|
|
37
|
+
activeSteps(): Array<{
|
|
38
|
+
questId: string;
|
|
39
|
+
quest: QuestRuntimeQuest;
|
|
40
|
+
step: QuestRuntimeStep;
|
|
41
|
+
progress: QuestStepProgress;
|
|
42
|
+
}>;
|
|
43
|
+
questStatus(questId: string): QuestRunStatus;
|
|
44
|
+
stepStatus(questId: string, stepId: string): QuestRunStatus;
|
|
45
|
+
flag(key: string): QuestValue | undefined;
|
|
46
|
+
setFlag(key: string, value: QuestValue | undefined): void;
|
|
47
|
+
counter(key: string): number;
|
|
48
|
+
setCounter(key: string, value: number): void;
|
|
49
|
+
rememberEvent(eventId: string, maxEntries?: number): boolean;
|
|
50
|
+
private questProgress;
|
|
51
|
+
private stepProgress;
|
|
52
|
+
private transition;
|
|
53
|
+
private activateOutgoingEdges;
|
|
54
|
+
private reconcileParent;
|
|
55
|
+
private reconcileQuest;
|
|
56
|
+
private setQuestStatus;
|
|
57
|
+
private rebuildParents;
|
|
58
|
+
private ensureStateShape;
|
|
59
|
+
private touch;
|
|
60
|
+
}
|
|
61
|
+
export declare function createEmptySnapshot(contentRevision: string): QuestRuntimeSnapshot;
|
package/assets/store.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// CJHD editor-safe runtime stub. Generated by the publisher release tool.
|
|
2
|
+
|
|
3
|
+
const __cjSafeValue = new Proxy(function __cjSafeValue() {}, {
|
|
4
|
+
get(target, key) {
|
|
5
|
+
if (key === Symbol.toPrimitive) return function () { return 0; };
|
|
6
|
+
if (key === 'valueOf') return function () { return 0; };
|
|
7
|
+
if (key === 'toString') return function () { return '[CJHD editor-safe stub]'; };
|
|
8
|
+
return __cjSafeValue;
|
|
9
|
+
},
|
|
10
|
+
apply() { return __cjSafeValue; },
|
|
11
|
+
construct() { return __cjSafeValue; },
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export class QuestStore {
|
|
15
|
+
constructor(...args) {}
|
|
16
|
+
get snapshot() { return __cjSafeValue; }
|
|
17
|
+
setTransitionListener(...args) { return __cjSafeValue; }
|
|
18
|
+
setActivationGuard(...args) { return __cjSafeValue; }
|
|
19
|
+
replaceSnapshot(...args) { return __cjSafeValue; }
|
|
20
|
+
consumeDirty(...args) { return __cjSafeValue; }
|
|
21
|
+
setCurrentLevel(...args) { return __cjSafeValue; }
|
|
22
|
+
advanceTime(...args) { return __cjSafeValue; }
|
|
23
|
+
activateAutoStart(...args) { return __cjSafeValue; }
|
|
24
|
+
activateQuest(...args) { return __cjSafeValue; }
|
|
25
|
+
retryQuest(...args) { return __cjSafeValue; }
|
|
26
|
+
cancelQuest(...args) { return __cjSafeValue; }
|
|
27
|
+
activateStep(...args) { return __cjSafeValue; }
|
|
28
|
+
completeStep(...args) { return __cjSafeValue; }
|
|
29
|
+
failStep(...args) { return __cjSafeValue; }
|
|
30
|
+
cancelStep(...args) { return __cjSafeValue; }
|
|
31
|
+
setStepProgress(...args) { return __cjSafeValue; }
|
|
32
|
+
setStepData(...args) { return __cjSafeValue; }
|
|
33
|
+
stepData(...args) { return __cjSafeValue; }
|
|
34
|
+
activeSteps(...args) { return []; }
|
|
35
|
+
questStatus(...args) { return __cjSafeValue; }
|
|
36
|
+
stepStatus(...args) { return __cjSafeValue; }
|
|
37
|
+
flag(...args) { return __cjSafeValue; }
|
|
38
|
+
setFlag(...args) { return __cjSafeValue; }
|
|
39
|
+
counter(...args) { return __cjSafeValue; }
|
|
40
|
+
setCounter(...args) { return __cjSafeValue; }
|
|
41
|
+
rememberEvent(...args) { return __cjSafeValue; }
|
|
42
|
+
}
|
|
43
|
+
export function createEmptySnapshot(...args) { return __cjSafeValue; }
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type QuestStorage } from "./save";
|
|
2
|
+
import { type QuestRetryResult } from "./store";
|
|
3
|
+
import { QuestTargetIndex } from "./target-index";
|
|
4
|
+
import type { QuestDiagnostic, QuestMarkerSnapshot, QuestRuntimeBundle, QuestRuntimeEvent, QuestRuntimePorts, QuestRuntimeSnapshot } from "./types";
|
|
5
|
+
export interface QuestRuntimeSystemOptions extends QuestRuntimePorts {
|
|
6
|
+
storage?: QuestStorage | null;
|
|
7
|
+
saveNamespace?: string;
|
|
8
|
+
currentLevelId?: string;
|
|
9
|
+
currentMapRef?: string;
|
|
10
|
+
onMarkersChanged?: (markers: readonly QuestMarkerSnapshot[]) => void;
|
|
11
|
+
}
|
|
12
|
+
export interface QuestHotUpdateResult {
|
|
13
|
+
ok: boolean;
|
|
14
|
+
phase: "staged" | "committed" | "rejected" | "rolled-back";
|
|
15
|
+
fromRevision: string;
|
|
16
|
+
toRevision?: string;
|
|
17
|
+
error?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Deterministic fixed-frame quest runtime. External systems interact only through explicit ports/events. */
|
|
20
|
+
export declare class QuestRuntimeSystem {
|
|
21
|
+
private readonly options;
|
|
22
|
+
private bundleValue;
|
|
23
|
+
private storeValue;
|
|
24
|
+
private executorValue;
|
|
25
|
+
private markerProjectorValue;
|
|
26
|
+
private readonly targetIndexValue;
|
|
27
|
+
private readonly diagnosticsValue;
|
|
28
|
+
private readonly saveRepository;
|
|
29
|
+
private pendingHotUpdate;
|
|
30
|
+
private lastHotUpdateValue;
|
|
31
|
+
private lastMarkerSignature;
|
|
32
|
+
private disposed;
|
|
33
|
+
private readonly pendingEvents;
|
|
34
|
+
private dispatchingEvents;
|
|
35
|
+
constructor(input: unknown, options?: QuestRuntimeSystemOptions);
|
|
36
|
+
get bundle(): QuestRuntimeBundle;
|
|
37
|
+
get targets(): QuestTargetIndex;
|
|
38
|
+
get snapshot(): QuestRuntimeSnapshot;
|
|
39
|
+
get diagnostics(): readonly QuestDiagnostic[];
|
|
40
|
+
get lastHotUpdate(): QuestHotUpdateResult | null;
|
|
41
|
+
get markers(): readonly QuestMarkerSnapshot[];
|
|
42
|
+
startLevel(levelId: string): boolean;
|
|
43
|
+
tick(deltaMs: number): void;
|
|
44
|
+
emit(event: QuestRuntimeEvent): void;
|
|
45
|
+
retryQuest(questId: string): QuestRetryResult;
|
|
46
|
+
/** Called by live world adapters after actor/target registrations change marker resolution. */
|
|
47
|
+
refreshMarkers(): void;
|
|
48
|
+
requestHotUpdate(input: unknown): QuestHotUpdateResult;
|
|
49
|
+
dispose(): void;
|
|
50
|
+
private loadInitialSnapshot;
|
|
51
|
+
private commitPendingHotUpdate;
|
|
52
|
+
private flushSave;
|
|
53
|
+
private runtimePorts;
|
|
54
|
+
private publishMarkers;
|
|
55
|
+
private report;
|
|
56
|
+
private reportValidationFailure;
|
|
57
|
+
private resolveLevelForMap;
|
|
58
|
+
}
|
package/assets/system.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// CJHD editor-safe runtime stub. Generated by the publisher release tool.
|
|
2
|
+
|
|
3
|
+
const __cjSafeValue = new Proxy(function __cjSafeValue() {}, {
|
|
4
|
+
get(target, key) {
|
|
5
|
+
if (key === Symbol.toPrimitive) return function () { return 0; };
|
|
6
|
+
if (key === 'valueOf') return function () { return 0; };
|
|
7
|
+
if (key === 'toString') return function () { return '[CJHD editor-safe stub]'; };
|
|
8
|
+
return __cjSafeValue;
|
|
9
|
+
},
|
|
10
|
+
apply() { return __cjSafeValue; },
|
|
11
|
+
construct() { return __cjSafeValue; },
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export class QuestRuntimeSystem {
|
|
15
|
+
constructor(...args) {}
|
|
16
|
+
get bundle() { return __cjSafeValue; }
|
|
17
|
+
get targets() { return __cjSafeValue; }
|
|
18
|
+
get snapshot() { return __cjSafeValue; }
|
|
19
|
+
get diagnostics() { return __cjSafeValue; }
|
|
20
|
+
get lastHotUpdate() { return __cjSafeValue; }
|
|
21
|
+
get markers() { return __cjSafeValue; }
|
|
22
|
+
startLevel(...args) { return __cjSafeValue; }
|
|
23
|
+
tick(...args) { return __cjSafeValue; }
|
|
24
|
+
emit(...args) { return __cjSafeValue; }
|
|
25
|
+
retryQuest(...args) { return __cjSafeValue; }
|
|
26
|
+
refreshMarkers(...args) { return __cjSafeValue; }
|
|
27
|
+
requestHotUpdate(...args) { return __cjSafeValue; }
|
|
28
|
+
dispose(...args) { return __cjSafeValue; }
|
|
29
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { QuestActorSnapshot, QuestGeometry, QuestRuntimeBundle, QuestTargetRef, QuestWorldTarget } from "./types";
|
|
2
|
+
export type QuestActorProvider = () => QuestActorSnapshot | null;
|
|
3
|
+
/** Runtime-only stable target index. TMX remains the geometry source of truth. */
|
|
4
|
+
export declare class QuestTargetIndex {
|
|
5
|
+
private readonly targets;
|
|
6
|
+
private readonly actorsByRuntimeId;
|
|
7
|
+
private readonly actorRuntimeIdByTarget;
|
|
8
|
+
private primaryActorProvider;
|
|
9
|
+
resetBundle(bundle: QuestRuntimeBundle): void;
|
|
10
|
+
/** Live TMX registration intentionally replaces compiled geometry for the same stable id. */
|
|
11
|
+
registerTarget(target: QuestWorldTarget): void;
|
|
12
|
+
getTarget(levelId: string, targetGuid: string): QuestWorldTarget | null;
|
|
13
|
+
resolveTarget(ref: QuestTargetRef | undefined): QuestWorldTarget | null;
|
|
14
|
+
registerActor(runtimeId: string | number, provider: QuestActorProvider, identity?: {
|
|
15
|
+
levelId?: string;
|
|
16
|
+
targetGuid?: string;
|
|
17
|
+
}): void;
|
|
18
|
+
unregisterActor(runtimeId: string | number): void;
|
|
19
|
+
setPrimaryActor(provider: QuestActorProvider | null): void;
|
|
20
|
+
primaryActor(): QuestActorSnapshot | null;
|
|
21
|
+
actorByRuntimeId(runtimeId: string | number | undefined): QuestActorSnapshot | null;
|
|
22
|
+
actorForTarget(levelId: string | undefined, targetGuid: string | undefined): QuestActorSnapshot | null;
|
|
23
|
+
actorForBinding(ref: QuestTargetRef | undefined): QuestActorSnapshot | null;
|
|
24
|
+
stableIdentityForRuntimeId(runtimeId: string | number | undefined): {
|
|
25
|
+
levelId: string;
|
|
26
|
+
targetGuid: string;
|
|
27
|
+
} | null;
|
|
28
|
+
}
|
|
29
|
+
export declare function questTargetContains(target: QuestWorldTarget, x: number, y: number): boolean;
|
|
30
|
+
export declare function geometryContains(geometry: QuestGeometry, x: number, y: number): boolean;
|
|
31
|
+
export declare function targetKey(levelId: string, targetGuid: string): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// CJHD editor-safe runtime stub. Generated by the publisher release tool.
|
|
2
|
+
|
|
3
|
+
const __cjSafeValue = new Proxy(function __cjSafeValue() {}, {
|
|
4
|
+
get(target, key) {
|
|
5
|
+
if (key === Symbol.toPrimitive) return function () { return 0; };
|
|
6
|
+
if (key === 'valueOf') return function () { return 0; };
|
|
7
|
+
if (key === 'toString') return function () { return '[CJHD editor-safe stub]'; };
|
|
8
|
+
return __cjSafeValue;
|
|
9
|
+
},
|
|
10
|
+
apply() { return __cjSafeValue; },
|
|
11
|
+
construct() { return __cjSafeValue; },
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export class QuestTargetIndex {
|
|
15
|
+
constructor(...args) {}
|
|
16
|
+
resetBundle(...args) { return __cjSafeValue; }
|
|
17
|
+
registerTarget(...args) { return __cjSafeValue; }
|
|
18
|
+
getTarget(...args) { return __cjSafeValue; }
|
|
19
|
+
resolveTarget(...args) { return __cjSafeValue; }
|
|
20
|
+
registerActor(...args) { return __cjSafeValue; }
|
|
21
|
+
unregisterActor(...args) { return __cjSafeValue; }
|
|
22
|
+
setPrimaryActor(...args) { return __cjSafeValue; }
|
|
23
|
+
primaryActor(...args) { return __cjSafeValue; }
|
|
24
|
+
actorByRuntimeId(...args) { return __cjSafeValue; }
|
|
25
|
+
actorForTarget(...args) { return __cjSafeValue; }
|
|
26
|
+
actorForBinding(...args) { return __cjSafeValue; }
|
|
27
|
+
stableIdentityForRuntimeId(...args) { return __cjSafeValue; }
|
|
28
|
+
}
|
|
29
|
+
export function questTargetContains(...args) { return __cjSafeValue; }
|
|
30
|
+
export function geometryContains(...args) { return __cjSafeValue; }
|
|
31
|
+
export function targetKey(...args) { return __cjSafeValue; }
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { QuestRuntimeBundle } from "./types";
|
|
2
|
+
export { fnv1a32, stableStringify } from "./canonical";
|
|
3
|
+
/** Test/content-authoring helper. It is intentionally excluded from the package main entry. */
|
|
4
|
+
export declare function sealQuestBundleForTests<T extends Omit<QuestRuntimeBundle, "contentHash">>(bundle: T): QuestRuntimeBundle;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// CJHD editor-safe runtime stub. Generated by the publisher release tool.
|
|
2
|
+
|
|
3
|
+
const __cjSafeValue = new Proxy(function __cjSafeValue() {}, {
|
|
4
|
+
get(target, key) {
|
|
5
|
+
if (key === Symbol.toPrimitive) return function () { return 0; };
|
|
6
|
+
if (key === 'valueOf') return function () { return 0; };
|
|
7
|
+
if (key === 'toString') return function () { return '[CJHD editor-safe stub]'; };
|
|
8
|
+
return __cjSafeValue;
|
|
9
|
+
},
|
|
10
|
+
apply() { return __cjSafeValue; },
|
|
11
|
+
construct() { return __cjSafeValue; },
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export { fnv1a32, stableStringify } from './canonical.js';
|
|
15
|
+
export function sealQuestBundleForTests(...args) { return __cjSafeValue; }
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
export declare const QUEST_RUNTIME_SCHEMA_VERSION: 1;
|
|
2
|
+
export declare const QUEST_SAVE_SCHEMA_VERSION: 1;
|
|
3
|
+
export type QuestStepCategory = "flow" | "objective" | "condition" | "action";
|
|
4
|
+
export type QuestRunStatus = "inactive" | "active" | "completed" | "failed" | "cancelled";
|
|
5
|
+
export type QuestDiagnosticSeverity = "info" | "warning" | "error";
|
|
6
|
+
export type QuestValue = string | number | boolean | null | QuestValue[] | {
|
|
7
|
+
[key: string]: QuestValue;
|
|
8
|
+
};
|
|
9
|
+
export interface QuestTargetRef {
|
|
10
|
+
mode: "PlacedInstance" | "Template" | "Tag" | "Query" | "PreviousOutput";
|
|
11
|
+
targetLevelId?: string;
|
|
12
|
+
targetGuid?: string;
|
|
13
|
+
legacyTargetObjectId?: number;
|
|
14
|
+
templateId?: string;
|
|
15
|
+
tag?: string;
|
|
16
|
+
query?: string;
|
|
17
|
+
previousStepId?: string;
|
|
18
|
+
outputKey?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface QuestCondition {
|
|
21
|
+
type: string;
|
|
22
|
+
fields: Record<string, QuestValue>;
|
|
23
|
+
}
|
|
24
|
+
export interface QuestAction {
|
|
25
|
+
stableId?: string;
|
|
26
|
+
type: string;
|
|
27
|
+
fields: Record<string, QuestValue>;
|
|
28
|
+
}
|
|
29
|
+
export interface QuestRuntimeStep {
|
|
30
|
+
stableId: string;
|
|
31
|
+
sourceId: string;
|
|
32
|
+
schemaVersion: number;
|
|
33
|
+
type: string;
|
|
34
|
+
category: QuestStepCategory;
|
|
35
|
+
enabled: boolean;
|
|
36
|
+
title: string;
|
|
37
|
+
description: string;
|
|
38
|
+
optional: boolean;
|
|
39
|
+
scope: string;
|
|
40
|
+
resetPolicy: string;
|
|
41
|
+
persistence: string;
|
|
42
|
+
legacyDerivedStableId: boolean;
|
|
43
|
+
bindings: Record<string, QuestTargetRef>;
|
|
44
|
+
fields: Record<string, QuestValue>;
|
|
45
|
+
activationConditions: QuestCondition[];
|
|
46
|
+
completionConditions: QuestCondition[];
|
|
47
|
+
failureConditions: QuestCondition[];
|
|
48
|
+
onActivateActions: QuestAction[];
|
|
49
|
+
onProgressActions: QuestAction[];
|
|
50
|
+
onCompleteActions: QuestAction[];
|
|
51
|
+
onFailActions: QuestAction[];
|
|
52
|
+
children: string[];
|
|
53
|
+
}
|
|
54
|
+
export interface QuestFlowEdge {
|
|
55
|
+
id: string;
|
|
56
|
+
from: string;
|
|
57
|
+
to: string;
|
|
58
|
+
kind: "sequence" | "success" | "failure" | "condition" | "fallback";
|
|
59
|
+
fallback: boolean;
|
|
60
|
+
order: number;
|
|
61
|
+
conditions: QuestCondition[];
|
|
62
|
+
}
|
|
63
|
+
export interface QuestRuntimeQuest {
|
|
64
|
+
stableId: string;
|
|
65
|
+
sourceId: string;
|
|
66
|
+
schemaVersion: number;
|
|
67
|
+
title: string;
|
|
68
|
+
description: string;
|
|
69
|
+
autoStart: boolean;
|
|
70
|
+
legacyDerivedStableId: boolean;
|
|
71
|
+
entryStepIds: string[];
|
|
72
|
+
steps: Record<string, QuestRuntimeStep>;
|
|
73
|
+
edges: QuestFlowEdge[];
|
|
74
|
+
}
|
|
75
|
+
export interface QuestGeometry {
|
|
76
|
+
shape: "point" | "rectangle" | "ellipse" | "polygon" | "polyline";
|
|
77
|
+
x: number;
|
|
78
|
+
y: number;
|
|
79
|
+
width: number;
|
|
80
|
+
height: number;
|
|
81
|
+
points?: Array<{
|
|
82
|
+
x: number;
|
|
83
|
+
y: number;
|
|
84
|
+
}>;
|
|
85
|
+
}
|
|
86
|
+
export interface QuestWorldTarget {
|
|
87
|
+
levelId: string;
|
|
88
|
+
targetGuid: string;
|
|
89
|
+
tiledObjectId: number;
|
|
90
|
+
name: string;
|
|
91
|
+
kind: string;
|
|
92
|
+
layerPath: string;
|
|
93
|
+
geometry: QuestGeometry;
|
|
94
|
+
properties: Record<string, string>;
|
|
95
|
+
}
|
|
96
|
+
export interface QuestRuntimeLevel {
|
|
97
|
+
levelId: string;
|
|
98
|
+
map: string;
|
|
99
|
+
questRefs: string[];
|
|
100
|
+
targets: Record<string, QuestWorldTarget>;
|
|
101
|
+
/** Declarative index only; runtime spawning still comes from the matching TMX host. */
|
|
102
|
+
waveSources?: QuestRuntimeWaveSource[];
|
|
103
|
+
}
|
|
104
|
+
export interface QuestRuntimeWaveSource {
|
|
105
|
+
waveId: string;
|
|
106
|
+
tiledObjectId: number;
|
|
107
|
+
targetGuid?: string;
|
|
108
|
+
abilityConfigRef?: string;
|
|
109
|
+
startMode: "external" | "task-active";
|
|
110
|
+
}
|
|
111
|
+
export interface QuestTombstone {
|
|
112
|
+
questStableId: string;
|
|
113
|
+
stepStableId: string;
|
|
114
|
+
disposition: "complete" | "fail" | "cancel" | "redirect";
|
|
115
|
+
redirectStepStableId?: string;
|
|
116
|
+
}
|
|
117
|
+
export interface QuestMigration {
|
|
118
|
+
fromRevision: string;
|
|
119
|
+
toRevision: string;
|
|
120
|
+
questIdMap: Record<string, string>;
|
|
121
|
+
stepIdMap: Record<string, string>;
|
|
122
|
+
tombstones: QuestTombstone[];
|
|
123
|
+
}
|
|
124
|
+
export interface QuestRuntimeBundle {
|
|
125
|
+
schemaVersion: typeof QUEST_RUNTIME_SCHEMA_VERSION;
|
|
126
|
+
contentRevision: string;
|
|
127
|
+
contentHash: string;
|
|
128
|
+
levels: Record<string, QuestRuntimeLevel>;
|
|
129
|
+
quests: Record<string, QuestRuntimeQuest>;
|
|
130
|
+
dialogues: Record<string, unknown>;
|
|
131
|
+
migrations: QuestMigration[];
|
|
132
|
+
tombstones: QuestTombstone[];
|
|
133
|
+
}
|
|
134
|
+
export interface QuestStepProgress {
|
|
135
|
+
status: QuestRunStatus;
|
|
136
|
+
progress: number;
|
|
137
|
+
activatedAtMs?: number;
|
|
138
|
+
completedAtMs?: number;
|
|
139
|
+
failedAtMs?: number;
|
|
140
|
+
data: Record<string, QuestValue>;
|
|
141
|
+
}
|
|
142
|
+
export interface QuestProgress {
|
|
143
|
+
status: QuestRunStatus;
|
|
144
|
+
steps: Record<string, QuestStepProgress>;
|
|
145
|
+
}
|
|
146
|
+
export interface QuestRuntimeSnapshot {
|
|
147
|
+
schemaVersion: typeof QUEST_SAVE_SCHEMA_VERSION;
|
|
148
|
+
contentRevision: string;
|
|
149
|
+
currentLevelId: string | null;
|
|
150
|
+
logicalTimeMs: number;
|
|
151
|
+
revision: number;
|
|
152
|
+
quests: Record<string, QuestProgress>;
|
|
153
|
+
flags: Record<string, QuestValue>;
|
|
154
|
+
counters: Record<string, number>;
|
|
155
|
+
processedEventIds: string[];
|
|
156
|
+
}
|
|
157
|
+
/** Read-only UI/navigation projection. Runtime state remains owned by QuestStore. */
|
|
158
|
+
export interface QuestMarkerSnapshot {
|
|
159
|
+
markerId: string;
|
|
160
|
+
questId: string;
|
|
161
|
+
stepId: string;
|
|
162
|
+
title: string;
|
|
163
|
+
status: QuestRunStatus;
|
|
164
|
+
visible: boolean;
|
|
165
|
+
tracked: boolean;
|
|
166
|
+
resolved: boolean;
|
|
167
|
+
bindingSlot?: string;
|
|
168
|
+
levelId?: string;
|
|
169
|
+
targetGuid?: string;
|
|
170
|
+
runtimeId?: string;
|
|
171
|
+
x?: number;
|
|
172
|
+
y?: number;
|
|
173
|
+
icon?: string;
|
|
174
|
+
}
|
|
175
|
+
export interface QuestDiagnostic {
|
|
176
|
+
severity: QuestDiagnosticSeverity;
|
|
177
|
+
code: string;
|
|
178
|
+
message: string;
|
|
179
|
+
questId?: string;
|
|
180
|
+
stepId?: string;
|
|
181
|
+
eventId?: string;
|
|
182
|
+
}
|
|
183
|
+
export interface QuestActorSnapshot {
|
|
184
|
+
runtimeId: string;
|
|
185
|
+
levelId?: string;
|
|
186
|
+
targetGuid?: string;
|
|
187
|
+
x: number;
|
|
188
|
+
y: number;
|
|
189
|
+
alive: boolean;
|
|
190
|
+
teamId?: string;
|
|
191
|
+
}
|
|
192
|
+
export type QuestRuntimeEvent = {
|
|
193
|
+
type: "kill";
|
|
194
|
+
eventId: string;
|
|
195
|
+
killerRuntimeId?: string;
|
|
196
|
+
victimRuntimeId?: string;
|
|
197
|
+
victimLevelId?: string;
|
|
198
|
+
victimTargetGuid?: string;
|
|
199
|
+
credit?: "killer" | "assist" | "team";
|
|
200
|
+
} | {
|
|
201
|
+
type: "dialogue";
|
|
202
|
+
eventId: string;
|
|
203
|
+
dialogueId: string;
|
|
204
|
+
phase: "started" | "finished" | "selected-outcome";
|
|
205
|
+
actorRuntimeId?: string;
|
|
206
|
+
actorLevelId?: string;
|
|
207
|
+
actorTargetGuid?: string;
|
|
208
|
+
outcome?: string;
|
|
209
|
+
} | {
|
|
210
|
+
type: "inventory-delta";
|
|
211
|
+
eventId: string;
|
|
212
|
+
itemId: string;
|
|
213
|
+
delta: number;
|
|
214
|
+
currentCount: number;
|
|
215
|
+
transactionId: string;
|
|
216
|
+
} | {
|
|
217
|
+
type: "deliver-request";
|
|
218
|
+
eventId: string;
|
|
219
|
+
receiverRuntimeId?: string;
|
|
220
|
+
receiverLevelId?: string;
|
|
221
|
+
receiverTargetGuid?: string;
|
|
222
|
+
} | {
|
|
223
|
+
type: "waves-cleared";
|
|
224
|
+
eventId: string;
|
|
225
|
+
levelId: string;
|
|
226
|
+
waveId: string;
|
|
227
|
+
count: number;
|
|
228
|
+
} | {
|
|
229
|
+
type: "actor-state";
|
|
230
|
+
eventId: string;
|
|
231
|
+
runtimeId: string;
|
|
232
|
+
alive: boolean;
|
|
233
|
+
};
|
|
234
|
+
export interface QuestInventoryPort {
|
|
235
|
+
getCount(itemId: string): number;
|
|
236
|
+
/** Must verify and consume atomically. False means no mutation occurred. */
|
|
237
|
+
tryConsume(itemId: string, count: number, transactionId: string): boolean;
|
|
238
|
+
/** Must grant atomically and de-duplicate a repeated transaction id. */
|
|
239
|
+
tryGrant(itemId: string, count: number, transactionId: string): boolean;
|
|
240
|
+
}
|
|
241
|
+
export interface QuestActionExecutionContext {
|
|
242
|
+
questId: string;
|
|
243
|
+
stepId: string;
|
|
244
|
+
phase: "activate" | "progress" | "complete" | "fail" | "cancel";
|
|
245
|
+
actionIndex: number;
|
|
246
|
+
contentRevision: string;
|
|
247
|
+
}
|
|
248
|
+
export interface QuestActionPort {
|
|
249
|
+
execute(action: QuestAction, context: QuestActionExecutionContext): boolean;
|
|
250
|
+
}
|
|
251
|
+
export interface QuestConditionPort {
|
|
252
|
+
evaluate(condition: QuestCondition, context: {
|
|
253
|
+
questId: string;
|
|
254
|
+
stepId: string;
|
|
255
|
+
}): boolean;
|
|
256
|
+
}
|
|
257
|
+
export interface QuestRuntimePorts {
|
|
258
|
+
inventory?: QuestInventoryPort;
|
|
259
|
+
actions?: QuestActionPort;
|
|
260
|
+
conditions?: QuestConditionPort;
|
|
261
|
+
onDiagnostic?: (diagnostic: QuestDiagnostic) => void;
|
|
262
|
+
}
|
|
263
|
+
export interface QuestTransition {
|
|
264
|
+
questId: string;
|
|
265
|
+
stepId: string;
|
|
266
|
+
from: QuestRunStatus;
|
|
267
|
+
to: QuestRunStatus;
|
|
268
|
+
}
|