style: lint
This commit is contained in:
@@ -1,14 +1,7 @@
|
||||
import { isUrlMode } from './environment'
|
||||
|
||||
export function isUrl(url: string) {
|
||||
try {
|
||||
// eslint-disable-next-line no-new
|
||||
new URL(url)
|
||||
return true
|
||||
}
|
||||
catch {
|
||||
return false
|
||||
}
|
||||
return URL.canParse(url)
|
||||
}
|
||||
|
||||
export function withBase(url: string) {
|
||||
|
||||
+2
-1
@@ -14,6 +14,7 @@ beforeAll(() => {
|
||||
value: vi.fn(),
|
||||
})
|
||||
|
||||
// eslint-disable-next-line no-extend-native
|
||||
Object.defineProperty(Object.prototype, 'scrollIntoView', {
|
||||
configurable: true,
|
||||
value: vi.fn(),
|
||||
@@ -28,10 +29,10 @@ afterAll(() => {
|
||||
|
||||
if (originalObjectScrollIntoView === undefined) {
|
||||
// Keep Object prototype clean when this shim didn't exist before the test run.
|
||||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||
delete (Object.prototype as { scrollIntoView?: unknown }).scrollIntoView
|
||||
}
|
||||
else {
|
||||
// eslint-disable-next-line no-extend-native
|
||||
Object.defineProperty(Object.prototype, 'scrollIntoView', {
|
||||
configurable: true,
|
||||
value: originalObjectScrollIntoView,
|
||||
|
||||
@@ -84,7 +84,6 @@ catalog:
|
||||
alien-signals: ^3.1.2
|
||||
async-mutex: 0.5.0
|
||||
better-auth: ^1.6.2
|
||||
better-call: ^2.0.3
|
||||
builder-util-runtime: ^9.5.1
|
||||
cac: ^7.0.0
|
||||
capacitor-native-settings: ^8.1.0
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
import { createInterface } from 'node:readline'
|
||||
import { env } from 'node:process'
|
||||
import { createInterface, exit, stdin, stdout } from 'node:readline'
|
||||
|
||||
// TODO(@nekomeowww): try now to directly embed binary / base64, even tests. `xz` warned us.
|
||||
const tinyPngBase64 = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAusB9Wn8vO0AAAAASUVORK5CYII='
|
||||
|
||||
const state = {
|
||||
sessionTag: process.env.FAKE_RUNNER_SESSION_TAG || 'vm-local-1',
|
||||
displayId: process.env.FAKE_RUNNER_DISPLAY_ID || ':99',
|
||||
hostName: process.env.FAKE_RUNNER_HOST_NAME || 'fake-remote',
|
||||
remoteUser: process.env.FAKE_RUNNER_REMOTE_USER || 'airi',
|
||||
width: Number.parseInt(process.env.FAKE_RUNNER_WIDTH || '1280', 10),
|
||||
height: Number.parseInt(process.env.FAKE_RUNNER_HEIGHT || '720', 10),
|
||||
observationBaseUrl: process.env.FAKE_RUNNER_OBSERVATION_BASE_URL || '',
|
||||
sessionTag: env.FAKE_RUNNER_SESSION_TAG || 'vm-local-1',
|
||||
displayId: env.FAKE_RUNNER_DISPLAY_ID || ':99',
|
||||
hostName: env.FAKE_RUNNER_HOST_NAME || 'fake-remote',
|
||||
remoteUser: env.FAKE_RUNNER_REMOTE_USER || 'airi',
|
||||
width: Number.parseInt(env.FAKE_RUNNER_WIDTH || '1280', 10),
|
||||
height: Number.parseInt(env.FAKE_RUNNER_HEIGHT || '720', 10),
|
||||
observationBaseUrl: env.FAKE_RUNNER_OBSERVATION_BASE_URL || '',
|
||||
}
|
||||
|
||||
function executionTarget() {
|
||||
@@ -61,11 +62,11 @@ function displayInfo() {
|
||||
}
|
||||
|
||||
function writeResponse(response) {
|
||||
process.stdout.write(`${JSON.stringify(response)}\n`)
|
||||
stdout.write(`${JSON.stringify(response)}\n`)
|
||||
}
|
||||
|
||||
const rl = createInterface({
|
||||
input: process.stdin,
|
||||
input: stdin,
|
||||
crlfDelay: Infinity,
|
||||
})
|
||||
|
||||
@@ -76,8 +77,8 @@ rl.on('line', (line) => {
|
||||
}
|
||||
|
||||
const request = JSON.parse(trimmed)
|
||||
if (process.env.FAKE_RUNNER_CLOSE_ON_MUTATION === '1' && ['click', 'typeText', 'pressKeys', 'scroll'].includes(request.method)) {
|
||||
process.exit(1)
|
||||
if (env.FAKE_RUNNER_CLOSE_ON_MUTATION === '1' && ['click', 'typeText', 'pressKeys', 'scroll'].includes(request.method)) {
|
||||
exit(1)
|
||||
}
|
||||
|
||||
switch (request.method) {
|
||||
@@ -183,6 +184,6 @@ rl.on('line', (line) => {
|
||||
ok: true,
|
||||
},
|
||||
})
|
||||
process.exit(0)
|
||||
exit(0)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -12,15 +12,16 @@
|
||||
* exercising the real PTY read/write/lifecycle path.
|
||||
*/
|
||||
|
||||
import { exit, stdin, stdout } from 'node:process'
|
||||
import { createInterface } from 'node:readline'
|
||||
|
||||
const rl = createInterface({ input: process.stdin, output: process.stdout })
|
||||
const rl = createInterface({ input: stdin, output: stdout })
|
||||
|
||||
process.stdout.write('READY> ')
|
||||
stdout.write('READY> ')
|
||||
|
||||
rl.once('line', (line) => {
|
||||
process.stdout.write(`ECHO: ${line}\n`)
|
||||
process.stdout.write('DONE\n')
|
||||
stdout.write(`ECHO: ${line}\n`)
|
||||
stdout.write('DONE\n')
|
||||
rl.close()
|
||||
process.exit(0)
|
||||
exit(0)
|
||||
})
|
||||
|
||||
@@ -222,7 +222,9 @@ Push an episodic alert to AIRI. Use for significant, non-routine events only.
|
||||
|
||||
```js
|
||||
// Example — low health
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
if (self.health <= 4) {
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
notifyAiri('Under attack and low health', `Health: ${self.health}. Retreating.`, 'immediate')
|
||||
await goToCoordinate({ x: mem.safeSpot.x, y: mem.safeSpot.y, z: mem.safeSpot.z, closeness: 2 })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user