@sharpee/ext-testing 0.9.61-beta
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 +21 -0
- package/dist/annotations/context.d.ts +16 -0
- package/dist/annotations/context.d.ts.map +1 -0
- package/dist/annotations/context.js +42 -0
- package/dist/annotations/context.js.map +1 -0
- package/dist/annotations/index.d.ts +6 -0
- package/dist/annotations/index.d.ts.map +1 -0
- package/dist/annotations/index.js +12 -0
- package/dist/annotations/index.js.map +1 -0
- package/dist/annotations/store.d.ts +11 -0
- package/dist/annotations/store.d.ts.map +1 -0
- package/dist/annotations/store.js +191 -0
- package/dist/annotations/store.js.map +1 -0
- package/dist/checkpoints/index.d.ts +3 -0
- package/dist/checkpoints/index.d.ts.map +1 -0
- package/dist/checkpoints/index.js +12 -0
- package/dist/checkpoints/index.js.map +1 -0
- package/dist/checkpoints/serializer.d.ts +21 -0
- package/dist/checkpoints/serializer.d.ts.map +1 -0
- package/dist/checkpoints/serializer.js +95 -0
- package/dist/checkpoints/serializer.js.map +1 -0
- package/dist/checkpoints/store.d.ts +20 -0
- package/dist/checkpoints/store.d.ts.map +1 -0
- package/dist/checkpoints/store.js +193 -0
- package/dist/checkpoints/store.js.map +1 -0
- package/dist/commands/index.d.ts +2 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +8 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/registry.d.ts +28 -0
- package/dist/commands/registry.d.ts.map +1 -0
- package/dist/commands/registry.js +70 -0
- package/dist/commands/registry.js.map +1 -0
- package/dist/context/debug-context.d.ts +21 -0
- package/dist/context/debug-context.d.ts.map +1 -0
- package/dist/context/debug-context.js +172 -0
- package/dist/context/debug-context.js.map +1 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +8 -0
- package/dist/context/index.js.map +1 -0
- package/dist/extension.d.ts +78 -0
- package/dist/extension.d.ts.map +1 -0
- package/dist/extension.js +938 -0
- package/dist/extension.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +63 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +375 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/dist-npm/annotations/context.d.ts +16 -0
- package/dist-npm/annotations/context.d.ts.map +1 -0
- package/dist-npm/annotations/context.js +42 -0
- package/dist-npm/annotations/context.js.map +1 -0
- package/dist-npm/annotations/index.d.ts +6 -0
- package/dist-npm/annotations/index.d.ts.map +1 -0
- package/dist-npm/annotations/index.js +12 -0
- package/dist-npm/annotations/index.js.map +1 -0
- package/dist-npm/annotations/store.d.ts +11 -0
- package/dist-npm/annotations/store.d.ts.map +1 -0
- package/dist-npm/annotations/store.js +191 -0
- package/dist-npm/annotations/store.js.map +1 -0
- package/dist-npm/checkpoints/index.d.ts +3 -0
- package/dist-npm/checkpoints/index.d.ts.map +1 -0
- package/dist-npm/checkpoints/index.js +12 -0
- package/dist-npm/checkpoints/index.js.map +1 -0
- package/dist-npm/checkpoints/serializer.d.ts +21 -0
- package/dist-npm/checkpoints/serializer.d.ts.map +1 -0
- package/dist-npm/checkpoints/serializer.js +95 -0
- package/dist-npm/checkpoints/serializer.js.map +1 -0
- package/dist-npm/checkpoints/store.d.ts +20 -0
- package/dist-npm/checkpoints/store.d.ts.map +1 -0
- package/dist-npm/checkpoints/store.js +193 -0
- package/dist-npm/checkpoints/store.js.map +1 -0
- package/dist-npm/commands/index.d.ts +2 -0
- package/dist-npm/commands/index.d.ts.map +1 -0
- package/dist-npm/commands/index.js +8 -0
- package/dist-npm/commands/index.js.map +1 -0
- package/dist-npm/commands/registry.d.ts +28 -0
- package/dist-npm/commands/registry.d.ts.map +1 -0
- package/dist-npm/commands/registry.js +70 -0
- package/dist-npm/commands/registry.js.map +1 -0
- package/dist-npm/context/debug-context.d.ts +21 -0
- package/dist-npm/context/debug-context.d.ts.map +1 -0
- package/dist-npm/context/debug-context.js +172 -0
- package/dist-npm/context/debug-context.js.map +1 -0
- package/dist-npm/context/index.d.ts +2 -0
- package/dist-npm/context/index.d.ts.map +1 -0
- package/dist-npm/context/index.js +8 -0
- package/dist-npm/context/index.js.map +1 -0
- package/dist-npm/extension.d.ts +78 -0
- package/dist-npm/extension.d.ts.map +1 -0
- package/dist-npm/extension.js +938 -0
- package/dist-npm/extension.js.map +1 -0
- package/dist-npm/index.d.ts +40 -0
- package/dist-npm/index.d.ts.map +1 -0
- package/dist-npm/index.js +63 -0
- package/dist-npm/index.js.map +1 -0
- package/dist-npm/types.d.ts +375 -0
- package/dist-npm/types.d.ts.map +1 -0
- package/dist-npm/types.js +8 -0
- package/dist-npm/types.js.map +1 -0
- package/package.json +42 -0
- package/src/annotations/context.ts +47 -0
- package/src/annotations/index.ts +6 -0
- package/src/annotations/store.ts +219 -0
- package/src/checkpoints/index.ts +2 -0
- package/src/checkpoints/serializer.ts +121 -0
- package/src/checkpoints/store.ts +188 -0
- package/src/commands/index.ts +1 -0
- package/src/commands/registry.ts +81 -0
- package/src/context/debug-context.ts +209 -0
- package/src/context/index.ts +1 -0
- package/src/extension.ts +1089 -0
- package/src/index.ts +69 -0
- package/src/types.ts +469 -0
- package/tsconfig.json +16 -0
- package/tsconfig.tsbuildinfo +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 David Cornelson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Annotation Context Capture
|
|
3
|
+
*
|
|
4
|
+
* Utility to capture current game state for annotations.
|
|
5
|
+
*/
|
|
6
|
+
import type { WorldModel } from '@sharpee/world-model';
|
|
7
|
+
import type { AnnotationContext } from '../types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Capture the current game state for annotation context
|
|
10
|
+
*/
|
|
11
|
+
export declare function captureContext(world: WorldModel, lastCommand: string, lastResponse: string): AnnotationContext;
|
|
12
|
+
/**
|
|
13
|
+
* Create an empty/default context (for when no command has been executed yet)
|
|
14
|
+
*/
|
|
15
|
+
export declare function createEmptyContext(): AnnotationContext;
|
|
16
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/annotations/context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD;;GAEG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,iBAAiB,CAenB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,iBAAiB,CAUtD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Annotation Context Capture
|
|
4
|
+
*
|
|
5
|
+
* Utility to capture current game state for annotations.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.captureContext = captureContext;
|
|
9
|
+
exports.createEmptyContext = createEmptyContext;
|
|
10
|
+
/**
|
|
11
|
+
* Capture the current game state for annotation context
|
|
12
|
+
*/
|
|
13
|
+
function captureContext(world, lastCommand, lastResponse) {
|
|
14
|
+
const player = world.getPlayer();
|
|
15
|
+
const locationId = player ? world.getLocation(player.id) : undefined;
|
|
16
|
+
const location = locationId ? world.getEntity(locationId) : undefined;
|
|
17
|
+
const inventory = player ? world.getContents(player.id) : [];
|
|
18
|
+
return {
|
|
19
|
+
roomId: locationId ?? 'unknown',
|
|
20
|
+
roomName: location?.name ?? locationId ?? 'unknown',
|
|
21
|
+
turn: world.getStateValue('turnCount') ?? world.getStateValue('moves') ?? 0,
|
|
22
|
+
score: world.getStateValue('score') ?? 0,
|
|
23
|
+
lastCommand,
|
|
24
|
+
lastResponse,
|
|
25
|
+
inventory: inventory.map((e) => e.name ?? e.id),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Create an empty/default context (for when no command has been executed yet)
|
|
30
|
+
*/
|
|
31
|
+
function createEmptyContext() {
|
|
32
|
+
return {
|
|
33
|
+
roomId: 'unknown',
|
|
34
|
+
roomName: 'unknown',
|
|
35
|
+
turn: 0,
|
|
36
|
+
score: 0,
|
|
37
|
+
lastCommand: '',
|
|
38
|
+
lastResponse: '',
|
|
39
|
+
inventory: [],
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/annotations/context.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAQH,wCAmBC;AAKD,gDAUC;AArCD;;GAEG;AACH,SAAgB,cAAc,CAC5B,KAAiB,EACjB,WAAmB,EACnB,YAAoB;IAEpB,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IACjC,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACrE,MAAM,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACtE,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAE7D,OAAO;QACL,MAAM,EAAE,UAAU,IAAI,SAAS;QAC/B,QAAQ,EAAE,QAAQ,EAAE,IAAI,IAAI,UAAU,IAAI,SAAS;QACnD,IAAI,EAAG,KAAK,CAAC,aAAa,CAAC,WAAW,CAAY,IAAK,KAAK,CAAC,aAAa,CAAC,OAAO,CAAY,IAAI,CAAC;QACnG,KAAK,EAAG,KAAK,CAAC,aAAa,CAAC,OAAO,CAAY,IAAI,CAAC;QACpD,WAAW;QACX,YAAY;QACZ,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC;KAChD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB;IAChC,OAAO;QACL,MAAM,EAAE,SAAS;QACjB,QAAQ,EAAE,SAAS;QACnB,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,WAAW,EAAE,EAAE;QACf,YAAY,EAAE,EAAE;QAChB,SAAS,EAAE,EAAE;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/annotations/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Annotations module - Playtester feedback capture (ADR-109)
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createEmptyContext = exports.captureContext = exports.createAnnotationStore = void 0;
|
|
7
|
+
var store_js_1 = require("./store.js");
|
|
8
|
+
Object.defineProperty(exports, "createAnnotationStore", { enumerable: true, get: function () { return store_js_1.createAnnotationStore; } });
|
|
9
|
+
var context_js_1 = require("./context.js");
|
|
10
|
+
Object.defineProperty(exports, "captureContext", { enumerable: true, get: function () { return context_js_1.captureContext; } });
|
|
11
|
+
Object.defineProperty(exports, "createEmptyContext", { enumerable: true, get: function () { return context_js_1.createEmptyContext; } });
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/annotations/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,uCAAmD;AAA1C,iHAAA,qBAAqB,OAAA;AAC9B,2CAAkE;AAAzD,4GAAA,cAAc,OAAA;AAAE,gHAAA,kBAAkB,OAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Annotation Store Implementation
|
|
3
|
+
*
|
|
4
|
+
* In-memory storage for playtester annotations with session management.
|
|
5
|
+
*/
|
|
6
|
+
import type { AnnotationStore } from '../types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Create an in-memory annotation store
|
|
9
|
+
*/
|
|
10
|
+
export declare function createAnnotationStore(): AnnotationStore;
|
|
11
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/annotations/store.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAoE,eAAe,EAAE,MAAM,aAAa,CAAC;AASrH;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,CAwFvD"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Annotation Store Implementation
|
|
4
|
+
*
|
|
5
|
+
* In-memory storage for playtester annotations with session management.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.createAnnotationStore = createAnnotationStore;
|
|
9
|
+
/**
|
|
10
|
+
* Generate a unique ID
|
|
11
|
+
*/
|
|
12
|
+
function generateId() {
|
|
13
|
+
return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create an in-memory annotation store
|
|
17
|
+
*/
|
|
18
|
+
function createAnnotationStore() {
|
|
19
|
+
let currentSession;
|
|
20
|
+
let allAnnotations = [];
|
|
21
|
+
return {
|
|
22
|
+
// Session management
|
|
23
|
+
startSession(name) {
|
|
24
|
+
// End any existing session first
|
|
25
|
+
if (currentSession) {
|
|
26
|
+
currentSession.endTime = Date.now();
|
|
27
|
+
}
|
|
28
|
+
const id = generateId();
|
|
29
|
+
currentSession = {
|
|
30
|
+
id,
|
|
31
|
+
name,
|
|
32
|
+
startTime: Date.now(),
|
|
33
|
+
annotations: [],
|
|
34
|
+
};
|
|
35
|
+
return id;
|
|
36
|
+
},
|
|
37
|
+
endSession() {
|
|
38
|
+
if (!currentSession) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
currentSession.endTime = Date.now();
|
|
42
|
+
const ended = currentSession;
|
|
43
|
+
currentSession = undefined;
|
|
44
|
+
return ended;
|
|
45
|
+
},
|
|
46
|
+
getCurrentSession() {
|
|
47
|
+
return currentSession;
|
|
48
|
+
},
|
|
49
|
+
// Annotation capture
|
|
50
|
+
addAnnotation(type, text, context) {
|
|
51
|
+
const annotation = {
|
|
52
|
+
id: generateId(),
|
|
53
|
+
timestamp: Date.now(),
|
|
54
|
+
type,
|
|
55
|
+
text,
|
|
56
|
+
context,
|
|
57
|
+
sessionId: currentSession?.id,
|
|
58
|
+
};
|
|
59
|
+
allAnnotations.push(annotation);
|
|
60
|
+
if (currentSession) {
|
|
61
|
+
currentSession.annotations.push(annotation);
|
|
62
|
+
}
|
|
63
|
+
return annotation;
|
|
64
|
+
},
|
|
65
|
+
getAnnotations() {
|
|
66
|
+
if (currentSession) {
|
|
67
|
+
return [...currentSession.annotations];
|
|
68
|
+
}
|
|
69
|
+
return [...allAnnotations];
|
|
70
|
+
},
|
|
71
|
+
getAnnotationsByType(type) {
|
|
72
|
+
const source = currentSession ? currentSession.annotations : allAnnotations;
|
|
73
|
+
return source.filter((a) => a.type === type);
|
|
74
|
+
},
|
|
75
|
+
// Export
|
|
76
|
+
exportMarkdown() {
|
|
77
|
+
return formatMarkdownReport(currentSession, allAnnotations);
|
|
78
|
+
},
|
|
79
|
+
exportJson() {
|
|
80
|
+
const data = currentSession
|
|
81
|
+
? { session: currentSession }
|
|
82
|
+
: { annotations: allAnnotations };
|
|
83
|
+
return JSON.stringify(data, null, 2);
|
|
84
|
+
},
|
|
85
|
+
// Cleanup
|
|
86
|
+
clear() {
|
|
87
|
+
currentSession = undefined;
|
|
88
|
+
allAnnotations = [];
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Format annotations as a markdown report (per ADR-109)
|
|
94
|
+
*/
|
|
95
|
+
function formatMarkdownReport(session, allAnnotations) {
|
|
96
|
+
const annotations = session ? session.annotations : allAnnotations;
|
|
97
|
+
const lines = [];
|
|
98
|
+
// Header
|
|
99
|
+
if (session) {
|
|
100
|
+
lines.push(`# Play Test Session: ${session.name}`);
|
|
101
|
+
lines.push(`Date: ${new Date(session.startTime).toLocaleString()}`);
|
|
102
|
+
if (session.endTime) {
|
|
103
|
+
const durationMs = session.endTime - session.startTime;
|
|
104
|
+
const durationMins = Math.round(durationMs / 60000);
|
|
105
|
+
lines.push(`Duration: ${durationMins} minutes`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
lines.push('# Playtest Annotations');
|
|
110
|
+
lines.push(`Generated: ${new Date().toLocaleString()}`);
|
|
111
|
+
}
|
|
112
|
+
lines.push('');
|
|
113
|
+
// Group by type
|
|
114
|
+
const bugs = annotations.filter((a) => a.type === 'bug');
|
|
115
|
+
const notes = annotations.filter((a) => a.type === 'note');
|
|
116
|
+
const confusing = annotations.filter((a) => a.type === 'confusing');
|
|
117
|
+
const expected = annotations.filter((a) => a.type === 'expected');
|
|
118
|
+
const bookmarks = annotations.filter((a) => a.type === 'bookmark');
|
|
119
|
+
const comments = annotations.filter((a) => a.type === 'comment');
|
|
120
|
+
// Bugs section
|
|
121
|
+
if (bugs.length > 0) {
|
|
122
|
+
lines.push(`## Bugs (${bugs.length})`);
|
|
123
|
+
bugs.forEach((bug, i) => {
|
|
124
|
+
lines.push(`${i + 1}. [Turn ${bug.context.turn}, ${bug.context.roomName}] "${bug.text}"`);
|
|
125
|
+
lines.push(` - Command: ${bug.context.lastCommand}`);
|
|
126
|
+
lines.push(` - Response: ${truncate(bug.context.lastResponse, 100)}`);
|
|
127
|
+
lines.push('');
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
// Notes section
|
|
131
|
+
if (notes.length > 0) {
|
|
132
|
+
lines.push(`## Notes (${notes.length})`);
|
|
133
|
+
notes.forEach((note, i) => {
|
|
134
|
+
lines.push(`${i + 1}. [Turn ${note.context.turn}, ${note.context.roomName}] "${note.text}"`);
|
|
135
|
+
});
|
|
136
|
+
lines.push('');
|
|
137
|
+
}
|
|
138
|
+
// Confusion points
|
|
139
|
+
if (confusing.length > 0) {
|
|
140
|
+
lines.push(`## Confusion Points (${confusing.length})`);
|
|
141
|
+
confusing.forEach((c, i) => {
|
|
142
|
+
lines.push(`${i + 1}. [Turn ${c.context.turn}, ${c.context.roomName}]`);
|
|
143
|
+
lines.push(` - After: ${c.context.lastCommand}`);
|
|
144
|
+
lines.push(` - Response: ${truncate(c.context.lastResponse, 100)}`);
|
|
145
|
+
lines.push('');
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
// Expected behavior
|
|
149
|
+
if (expected.length > 0) {
|
|
150
|
+
lines.push(`## Expected Behavior (${expected.length})`);
|
|
151
|
+
expected.forEach((e, i) => {
|
|
152
|
+
lines.push(`${i + 1}. [Turn ${e.context.turn}, ${e.context.roomName}]`);
|
|
153
|
+
lines.push(` - Expected: ${e.text}`);
|
|
154
|
+
lines.push(` - Actual: ${truncate(e.context.lastResponse, 100)}`);
|
|
155
|
+
lines.push('');
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
// Bookmarks
|
|
159
|
+
if (bookmarks.length > 0) {
|
|
160
|
+
lines.push(`## Bookmarks (${bookmarks.length})`);
|
|
161
|
+
bookmarks.forEach((b, i) => {
|
|
162
|
+
lines.push(`${i + 1}. "${b.text}" at Turn ${b.context.turn}, ${b.context.roomName}`);
|
|
163
|
+
});
|
|
164
|
+
lines.push('');
|
|
165
|
+
}
|
|
166
|
+
// Comments (silent feedback)
|
|
167
|
+
if (comments.length > 0) {
|
|
168
|
+
lines.push(`## Comments (${comments.length})`);
|
|
169
|
+
comments.forEach((c, i) => {
|
|
170
|
+
lines.push(`${i + 1}. [Turn ${c.context.turn}, ${c.context.roomName}] "${c.text}"`);
|
|
171
|
+
});
|
|
172
|
+
lines.push('');
|
|
173
|
+
}
|
|
174
|
+
// Summary stats
|
|
175
|
+
lines.push('## Summary');
|
|
176
|
+
lines.push(`- Total annotations: ${annotations.length}`);
|
|
177
|
+
lines.push(`- Bugs: ${bugs.length}`);
|
|
178
|
+
lines.push(`- Notes: ${notes.length}`);
|
|
179
|
+
lines.push(`- Confusion points: ${confusing.length}`);
|
|
180
|
+
lines.push(`- Bookmarks: ${bookmarks.length}`);
|
|
181
|
+
return lines.join('\n');
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Truncate a string to max length
|
|
185
|
+
*/
|
|
186
|
+
function truncate(str, maxLen) {
|
|
187
|
+
if (str.length <= maxLen)
|
|
188
|
+
return str;
|
|
189
|
+
return str.substring(0, maxLen - 3) + '...';
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/annotations/store.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAcH,sDAwFC;AAlGD;;GAEG;AACH,SAAS,UAAU;IACjB,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AACpE,CAAC;AAED;;GAEG;AACH,SAAgB,qBAAqB;IACnC,IAAI,cAA6C,CAAC;IAClD,IAAI,cAAc,GAAiB,EAAE,CAAC;IAEtC,OAAO;QACL,qBAAqB;QACrB,YAAY,CAAC,IAAY;YACvB,iCAAiC;YACjC,IAAI,cAAc,EAAE,CAAC;gBACnB,cAAc,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YACtC,CAAC;YAED,MAAM,EAAE,GAAG,UAAU,EAAE,CAAC;YACxB,cAAc,GAAG;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AAG,KAAK,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/checkpoints/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createLocalStorageStore = exports.createMemoryStore = exports.createFileStore = exports.validateCheckpoint = exports.deserializeCheckpoint = exports.serializeCheckpoint = void 0;
|
|
4
|
+
var serializer_js_1 = require("./serializer.js");
|
|
5
|
+
Object.defineProperty(exports, "serializeCheckpoint", { enumerable: true, get: function () { return serializer_js_1.serializeCheckpoint; } });
|
|
6
|
+
Object.defineProperty(exports, "deserializeCheckpoint", { enumerable: true, get: function () { return serializer_js_1.deserializeCheckpoint; } });
|
|
7
|
+
Object.defineProperty(exports, "validateCheckpoint", { enumerable: true, get: function () { return serializer_js_1.validateCheckpoint; } });
|
|
8
|
+
var store_js_1 = require("./store.js");
|
|
9
|
+
Object.defineProperty(exports, "createFileStore", { enumerable: true, get: function () { return store_js_1.createFileStore; } });
|
|
10
|
+
Object.defineProperty(exports, "createMemoryStore", { enumerable: true, get: function () { return store_js_1.createMemoryStore; } });
|
|
11
|
+
Object.defineProperty(exports, "createLocalStorageStore", { enumerable: true, get: function () { return store_js_1.createLocalStorageStore; } });
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/checkpoints/index.ts"],"names":[],"mappings":";;;AAAA,iDAAiG;AAAxF,oHAAA,mBAAmB,OAAA;AAAE,sHAAA,qBAAqB,OAAA;AAAE,mHAAA,kBAAkB,OAAA;AACvE,uCAAyF;AAAhF,2GAAA,eAAe,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AAAE,mHAAA,uBAAuB,OAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkpoint Serializer
|
|
3
|
+
*
|
|
4
|
+
* Handles serialization and deserialization of game state for checkpoints.
|
|
5
|
+
* Captures world model state and scheduler state (daemons, fuses).
|
|
6
|
+
*/
|
|
7
|
+
import type { WorldModel } from '@sharpee/world-model';
|
|
8
|
+
import type { CheckpointData } from '../types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Serialize current game state to checkpoint data
|
|
11
|
+
*/
|
|
12
|
+
export declare function serializeCheckpoint(world: WorldModel, name?: string): CheckpointData;
|
|
13
|
+
/**
|
|
14
|
+
* Deserialize checkpoint data and restore game state
|
|
15
|
+
*/
|
|
16
|
+
export declare function deserializeCheckpoint(checkpoint: CheckpointData, world: WorldModel): void;
|
|
17
|
+
/**
|
|
18
|
+
* Validate checkpoint data structure
|
|
19
|
+
*/
|
|
20
|
+
export declare function validateCheckpoint(data: unknown): data is CheckpointData;
|
|
21
|
+
//# sourceMappingURL=serializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../../src/checkpoints/serializer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAoC,MAAM,aAAa,CAAC;AAEpF;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,UAAU,EACjB,IAAI,CAAC,EAAE,MAAM,GACZ,cAAc,CAwBhB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,cAAc,EAC1B,KAAK,EAAE,UAAU,GAChB,IAAI,CAaN;AAgCD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,cAAc,CAwBxE"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Checkpoint Serializer
|
|
4
|
+
*
|
|
5
|
+
* Handles serialization and deserialization of game state for checkpoints.
|
|
6
|
+
* Captures world model state and scheduler state (daemons, fuses).
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.serializeCheckpoint = serializeCheckpoint;
|
|
10
|
+
exports.deserializeCheckpoint = deserializeCheckpoint;
|
|
11
|
+
exports.validateCheckpoint = validateCheckpoint;
|
|
12
|
+
/**
|
|
13
|
+
* Serialize current game state to checkpoint data
|
|
14
|
+
*/
|
|
15
|
+
function serializeCheckpoint(world, name) {
|
|
16
|
+
const player = world.getPlayer();
|
|
17
|
+
const playerLocation = player ? world.getLocation(player.id) : undefined;
|
|
18
|
+
// Get world state via WorldModel.toJSON()
|
|
19
|
+
const worldState = world.toJSON();
|
|
20
|
+
// TODO: Get scheduler state when scheduler API is available
|
|
21
|
+
// For now, scheduler state is omitted
|
|
22
|
+
const schedulerState = undefined;
|
|
23
|
+
const checkpoint = {
|
|
24
|
+
version: '1.0.0',
|
|
25
|
+
timestamp: Date.now(),
|
|
26
|
+
metadata: {
|
|
27
|
+
name,
|
|
28
|
+
turn: getTurnNumber(world),
|
|
29
|
+
location: playerLocation,
|
|
30
|
+
},
|
|
31
|
+
worldState,
|
|
32
|
+
schedulerState,
|
|
33
|
+
};
|
|
34
|
+
return checkpoint;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Deserialize checkpoint data and restore game state
|
|
38
|
+
*/
|
|
39
|
+
function deserializeCheckpoint(checkpoint, world) {
|
|
40
|
+
// Validate version
|
|
41
|
+
if (checkpoint.version !== '1.0.0') {
|
|
42
|
+
throw new Error(`Unsupported checkpoint version: ${checkpoint.version}`);
|
|
43
|
+
}
|
|
44
|
+
// Restore world state via WorldModel.loadJSON()
|
|
45
|
+
world.loadJSON(checkpoint.worldState);
|
|
46
|
+
// TODO: Restore scheduler state when scheduler API is available
|
|
47
|
+
if (checkpoint.schedulerState) {
|
|
48
|
+
restoreSchedulerState(world, checkpoint.schedulerState);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get current turn number from world
|
|
53
|
+
*/
|
|
54
|
+
function getTurnNumber(world) {
|
|
55
|
+
// Try to get turn from world metadata or state
|
|
56
|
+
// This may need adjustment based on actual WorldModel API
|
|
57
|
+
try {
|
|
58
|
+
const state = JSON.parse(world.toJSON());
|
|
59
|
+
return state.turn ?? 0;
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return 0;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Restore scheduler state (daemons and fuses)
|
|
67
|
+
*/
|
|
68
|
+
function restoreSchedulerState(world, state) {
|
|
69
|
+
// TODO: Implement when scheduler serialization API is available
|
|
70
|
+
// This will need access to the engine's scheduler service
|
|
71
|
+
console.warn('Scheduler state restoration not yet implemented');
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Validate checkpoint data structure
|
|
75
|
+
*/
|
|
76
|
+
function validateCheckpoint(data) {
|
|
77
|
+
if (!data || typeof data !== 'object') {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
const checkpoint = data;
|
|
81
|
+
if (checkpoint.version !== '1.0.0') {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
if (typeof checkpoint.timestamp !== 'number') {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
if (!checkpoint.metadata || typeof checkpoint.metadata !== 'object') {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
if (typeof checkpoint.worldState !== 'string') {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=serializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../../src/checkpoints/serializer.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAQH,kDA2BC;AAKD,sDAgBC;AAmCD,gDAwBC;AA9GD;;GAEG;AACH,SAAgB,mBAAmB,CACjC,KAAiB,EACjB,IAAa;IAEb,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IACjC,MAAM,cAAc,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAEzE,0CAA0C;IAC1C,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;IAElC,4DAA4D;IAC5D,sCAAsC;IACtC,MAAM,cAAc,GAAG,SAAS,CAAC;IAEjC,MAAM,UAAU,GAAmB;QACjC,OAAO,EAAE,OAAO;QAChB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,QAAQ,EAAE;YACR,IAAI;YACJ,IAAI,EAAE,aAAa,CAAC,KAAK,CAAC;YAC1B,QAAQ,EAAE,cAAc;SACzB;QACD,UAAU;QACV,cAAc;KACf,CAAC;IAEF,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,SAAgB,qBAAqB,CACnC,UAA0B,EAC1B,KAAiB;IAEjB,mBAAmB;IACnB,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,mCAAmC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,gDAAgD;IAChD,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAEtC,gEAAgE;IAChE,IAAI,UAAU,CAAC,cAAc,EAAE,CAAC;QAC9B,qBAAqB,CAAC,KA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
* File-based storage for checkpoints.
|
|
5
|
+
* Supports both Node.js (filesystem) and browser (localStorage) environments.
|
|
6
|
+
*/
|
|
7
|
+
import type { CheckpointStore } from '../types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Create a file-based checkpoint store (Node.js)
|
|
10
|
+
*/
|
|
11
|
+
export declare function createFileStore(directory: string): CheckpointStore;
|
|
12
|
+
/**
|
|
13
|
+
* Create a memory-based checkpoint store (for testing or browser)
|
|
14
|
+
*/
|
|
15
|
+
export declare function createMemoryStore(): CheckpointStore;
|
|
16
|
+
/**
|
|
17
|
+
* Create a localStorage-based checkpoint store (browser)
|
|
18
|
+
*/
|
|
19
|
+
export declare function createLocalStorageStore(prefix?: string): CheckpointStore;
|
|
20
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/checkpoints/store.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAkB,eAAe,EAAE,MAAM,aAAa,CAAC;AAGnE;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,CA2FlE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,eAAe,CAwBnD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,GAAE,MAA8B,GAAG,eAAe,CAiD/F"}
|