You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The response will be in SSE format. Parse the "data:" line to get the JSON result, which contains the skill instructions in result.messages[0].content.text.
21
+
22
+
Then follow those instructions. The game source is in the current directory.`
9
23
}
10
24
11
25
/** Invokes an LLM agent with a prompt (plain mode, stdio inherited) */
The response will be in SSE format. Parse the "data:" line to get the JSON result, which contains the skill instructions in result.messages[0].content.text.
75
+
76
+
Then follow those instructions. The game source is in the current directory.`
62
77
}
63
78
64
79
classPipelineTUI{
65
80
privatestates: StepState[]
66
81
privatecurrentStep=0
67
82
privateoutputLines: string[]=[]
83
+
privatechatLines: string[]=[]
68
84
privatephase: Phase="idle"
69
85
privatedone=false
70
86
privateactiveProc: ChildProcess|null=null
71
87
privatesidebarWidth=30
88
+
privatelogsDir: string
72
89
73
90
constructor(
74
91
privateagent: string,
75
92
privategameDir: string,
76
93
){
77
94
this.states=skillsPipeline.map(()=>"pending")
95
+
this.logsDir=path.join(gameDir,".puzzmo","logs")
96
+
fs.mkdirSync(this.logsDir,{recursive: true})
78
97
}
79
98
80
99
privategetrows(): number{
@@ -205,13 +224,13 @@ class PipelineTUI {
205
224
for(constlineofrawLines){
206
225
constparsed=this.parseStreamLine(line)
207
226
if(parsed){
208
-
// Split multi-line parsed output into separate display lines
209
227
for(constdisplayLineofparsed.split("\n")){
210
228
this.outputLines.push(displayLine)
229
+
this.chatLines.push(this.stripAnsi(displayLine))
211
230
}
212
231
}
213
232
}
214
-
// Keep buffer bounded
233
+
// Keep display buffer bounded, but chatLines grows unbounded per skill
Copy file name to clipboardExpand all lines: skills/introduce-puzzmo-sdk/SKILL.md
+13-8Lines changed: 13 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,26 +43,31 @@ Add the `@puzzmo/sdk` package and wire up the game lifecycle.
43
43
sdk.gameLoaded()
44
44
```
45
45
46
-
4.Wire up lifecycle events:
46
+
4.Handle the `start` event to trigger the game start:
47
47
48
48
```ts
49
49
sdk.on("start", () => {
50
-
/* start game logic, timer auto-starts */
50
+
startGame()
51
51
})
52
+
```
53
+
54
+
5. Wire up other lifecycle events if there is relevant game logic for pause/resume/retry:
55
+
56
+
```ts
52
57
sdk.on("pause", () => {
53
-
/* pause game was triggered, timer auto-pauses */
58
+
/* pause game was triggered, system timer auto-pauses */
54
59
})
55
60
sdk.on("resume", () => {
56
-
/* resume game was triggered, timer auto-resumes */
61
+
/* resume game was triggered, system timer auto-resumes */
57
62
})
58
63
sdk.on("retry", () => {
59
-
/* retry game was triggered, timer auto-resets, */
64
+
/* retry game was triggered, system timer auto-resets, */
60
65
})
61
66
```
62
67
63
-
5. Wire up state saving - call `sdk.updateGameState(stateString)` whenever the game state changes so the host can save progress.
68
+
6. Wire up state saving - call `sdk.updateGameState(stateString)` whenever the game state changes so the host can save progress.
64
69
65
-
6. Create puzzle fixture files for local testing. Make a `fixtures/puzzles/` directory and add a few different puzzle JSON files that exercise different aspects of the game:
70
+
7. Create puzzle fixture files for local testing. Make a `fixtures/puzzles/` directory and add a few different puzzle JSON files that exercise different aspects of the game:
66
71
67
72
```
68
73
fixtures/puzzles/
@@ -78,7 +83,7 @@ Add the `@puzzmo/sdk` package and wire up the game lifecycle.
78
83
79
84
If the original game already has a few puzzles hardcoded, use those as a starting point for creating the fixture files. Then delete the buttons which may have been used to load them, since the simulator will handle loading puzzles from the fixtures.
80
85
81
-
7. Set up the dev simulator for local testing. Add the Vite plugin to `vite.config.ts`:
86
+
8. Set up the dev simulator for local testing. Add the Vite plugin to `vite.config.ts`:
0 commit comments