opencode-overclock 0.2.1 → 0.2.2
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/package.json +1 -1
- package/src/buddy/sprites.ts +1 -1
- package/src/buddy/tui.ts +12 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-overclock",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Power-ups for opencode: background tasks, scheduling, sandboxed bash, tool hooks, usage telemetry, checkpoints. Modular, toggleable.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
package/src/buddy/sprites.ts
CHANGED
|
@@ -149,7 +149,7 @@ export function withBubble(frame: string, bubble: string | undefined): string {
|
|
|
149
149
|
export function spriteFrame(species: Species, state: SpriteState, tick: number): string {
|
|
150
150
|
const art = ART[species]
|
|
151
151
|
const t = ((tick % 1000) + 1000) % 1000
|
|
152
|
-
const body = art.idle[t
|
|
152
|
+
const body = art.idle[art.beat(t)]!
|
|
153
153
|
const rest = art.idle[0]!
|
|
154
154
|
|
|
155
155
|
switch (state) {
|
package/src/buddy/tui.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TuiPluginApi, TuiThemeCurrent } from "@opencode-ai/plugin/tui"
|
|
2
|
-
import { rollCompanion, describeCompanion } from "./companion.ts"
|
|
2
|
+
import { rollCompanion, describeCompanion, migrateSpecies } from "./companion.ts"
|
|
3
3
|
import type { Companion, Rarity } from "./types.ts"
|
|
4
4
|
import { spriteFrame, withBubble, spriteHeight, SPRITE_WIDTH, type SpriteState } from "./sprites.ts"
|
|
5
5
|
import { pickReaction, createReactionGate, type ReactionKind } from "./reactions.ts"
|
|
@@ -52,6 +52,17 @@ export async function registerBuddy(api: TuiPluginApi): Promise<void> {
|
|
|
52
52
|
companion = rollCompanion()
|
|
53
53
|
api.kv.set(KV_KEY, companion)
|
|
54
54
|
api.ui.toast({ message: `a buddy hatched: ${describeCompanion(companion)}` })
|
|
55
|
+
} else {
|
|
56
|
+
// A companion persisted under a species we have since retired has no art:
|
|
57
|
+
// every lookup into ART would throw from inside the slot render, where the
|
|
58
|
+
// caller's try/catch can't reach, and the buddy would silently not paint.
|
|
59
|
+
// Write the migration back so it settles once instead of re-rolling per launch.
|
|
60
|
+
const migrated = migrateSpecies(companion)
|
|
61
|
+
if (migrated) {
|
|
62
|
+
companion = migrated
|
|
63
|
+
api.kv.set(KV_KEY, migrated)
|
|
64
|
+
api.ui.toast({ message: `${migrated.name} is a ${migrated.species} now` })
|
|
65
|
+
}
|
|
55
66
|
}
|
|
56
67
|
const hatched: Companion = companion
|
|
57
68
|
|