30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
const root = 'C:/Users/ASUS/Documents/deepseek-harness/default-workspace/desktop-pet/'
|
|
const fs = require('fs')
|
|
const os = require('os')
|
|
const path = require('path')
|
|
|
|
const { StateStore } = require(root + 'out/main/stateStore.js')
|
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'pet-'))
|
|
const store = new StateStore(dir)
|
|
store.snapshot()
|
|
// 直接改内部 save 测试(同进程可直接访问)
|
|
store['save'].stats.satiety = 10
|
|
store['save'].money = 100
|
|
const r = store.autoBuy('riceball')
|
|
console.log('autoBuy:', r.ok, r.message, '| money', store['save'].money, '| satiety', store['save'].stats.satiety, '| inv', store['save'].inventory['riceball'])
|
|
const f1 = store.forgiveAccident()
|
|
const f2 = store.forgiveAccident()
|
|
console.log('forgive:', f1, f2)
|
|
|
|
;(async () => {
|
|
try {
|
|
const r = await fetch('https://cn.bing.com/search?q=test', {
|
|
signal: AbortSignal.timeout(8000),
|
|
headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)' }
|
|
})
|
|
console.log('bing status:', r.status)
|
|
} catch (e) {
|
|
console.log('bing FAIL:', e.message)
|
|
}
|
|
})()
|