@howaboua/pi-pet 0.1.5 → 0.1.7
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/CHANGELOG.md +8 -0
- package/README.md +2 -0
- package/desktop/build.mjs +31 -24
- package/desktop/package-lock.json +374 -13
- package/desktop/package.json +2 -2
- package/dist/desktop/main.mjs +1 -1
- package/extensions/index.ts +45 -18
- package/package.json +12 -7
- package/src/desktop/main.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @howaboua/pi-pet
|
|
2
2
|
|
|
3
|
+
## 0.1.7
|
|
4
|
+
|
|
5
|
+
- Added empty-call reaction discovery, including when no pet is connected, and deferred Code and Notebook help.
|
|
6
|
+
|
|
7
|
+
## 0.1.6
|
|
8
|
+
|
|
9
|
+
- Desktop attachment now uses Electron 44 and requires macOS 13 or newer, or a supported 64-bit Windows or Linux desktop. Linux ARMv7, 32-bit Windows and Linux Unity are no longer supported. The browser miniapp is unchanged.
|
|
10
|
+
|
|
3
11
|
## 0.1.5
|
|
4
12
|
|
|
5
13
|
- Pi Pet desktop now requires Node 22.12 or newer.
|
package/README.md
CHANGED
|
@@ -29,6 +29,8 @@ Electron is optional. With no attached device, Pi Pet still publishes its versio
|
|
|
29
29
|
|
|
30
30
|
The Electron shell loads the same GipPity-hosted app in a transparent, frameless, always-on-top window. It adds local cursor tracking, size, quiet mode, and snooze without another agent runtime or remote protocol.
|
|
31
31
|
|
|
32
|
+
The desktop shell uses Electron 44. It requires macOS 13 or newer, or a supported 64-bit Windows or Linux desktop. Linux ARMv7, 32-bit Windows and Linux Unity are no longer supported. The browser miniapp does not require Electron.
|
|
33
|
+
|
|
32
34
|
Attach the device running Pi directly:
|
|
33
35
|
|
|
34
36
|
```text
|
package/desktop/build.mjs
CHANGED
|
@@ -9,7 +9,6 @@ import { dirname, join } from "node:path";
|
|
|
9
9
|
import { Transform } from "node:stream";
|
|
10
10
|
import { pipeline } from "node:stream/promises";
|
|
11
11
|
import { fileURLToPath } from "node:url";
|
|
12
|
-
import ts from "typescript";
|
|
13
12
|
|
|
14
13
|
const desktop = dirname(fileURLToPath(import.meta.url));
|
|
15
14
|
const source = join(desktop, "..", "src", "desktop");
|
|
@@ -17,6 +16,7 @@ const output = join(desktop, "dist", "app");
|
|
|
17
16
|
const esmFiles = ["attention", "bridge", "config", "cursor-provider", "main"];
|
|
18
17
|
const cjsFiles = ["bridge", "preload"];
|
|
19
18
|
const require = createRequire(join(desktop, "package.json"));
|
|
19
|
+
const compiler = join(dirname(require.resolve("typescript/package.json")), require("typescript/package.json").bin.tsc);
|
|
20
20
|
const MAX_ARCHIVE_BYTES = 1024 * 1024 * 1024;
|
|
21
21
|
const LEADING_V_PATTERN = /^v/;
|
|
22
22
|
|
|
@@ -152,42 +152,49 @@ async function downloadArchive(artifact, path, expectedChecksum, version) {
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
function
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
155
|
+
function compile(files, module, destination) {
|
|
156
|
+
return new Promise((resolvePromise, reject) => {
|
|
157
|
+
const child = spawn(
|
|
158
|
+
process.execPath,
|
|
159
|
+
[
|
|
160
|
+
compiler,
|
|
161
|
+
"--ignoreConfig",
|
|
162
|
+
"--noCheck",
|
|
163
|
+
"--noResolve",
|
|
164
|
+
"--target",
|
|
165
|
+
"es2024",
|
|
166
|
+
"--module",
|
|
167
|
+
module,
|
|
168
|
+
"--rewriteRelativeImportExtensions",
|
|
169
|
+
"--outDir",
|
|
170
|
+
destination,
|
|
171
|
+
...files.map((name) => join(source, `${name}.ts`)),
|
|
172
|
+
],
|
|
173
|
+
{ stdio: "inherit", windowsHide: true },
|
|
170
174
|
);
|
|
171
|
-
|
|
172
|
-
|
|
175
|
+
child.once("error", reject);
|
|
176
|
+
child.once("exit", (code) => {
|
|
177
|
+
if (code === 0) resolvePromise();
|
|
178
|
+
else reject(new Error(`Desktop compilation exited ${code ?? "without status"}.`));
|
|
179
|
+
});
|
|
180
|
+
});
|
|
173
181
|
}
|
|
174
182
|
|
|
175
183
|
await ensureElectronRuntime();
|
|
176
184
|
await rm(join(desktop, "dist"), { recursive: true, force: true });
|
|
177
185
|
await mkdir(output, { recursive: true });
|
|
178
186
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
187
|
+
await compile(esmFiles, "esnext", output);
|
|
188
|
+
const cjsOutput = join(desktop, "dist", "preload");
|
|
189
|
+
await compile(cjsFiles, "commonjs", cjsOutput);
|
|
183
190
|
for (const name of cjsFiles) {
|
|
184
|
-
const
|
|
185
|
-
const compiled = transpile(await readFile(path, "utf8"), path, ts.ModuleKind.CommonJS).replaceAll(
|
|
191
|
+
const compiled = (await readFile(join(cjsOutput, `${name}.js`), "utf8")).replaceAll(
|
|
186
192
|
/require\("(\.\/.+)\.js"\)/g,
|
|
187
193
|
'require("$1.cjs")',
|
|
188
194
|
);
|
|
189
195
|
await writeFile(join(output, `${name}.cjs`), compiled);
|
|
190
196
|
}
|
|
197
|
+
await rm(cjsOutput, { recursive: true });
|
|
191
198
|
await writeFile(
|
|
192
199
|
join(output, "package.json"),
|
|
193
200
|
`${JSON.stringify({ name: "pi-pet-remote-desktop", private: true, type: "module", main: "main.js" }, null, 2)}\n`,
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"": {
|
|
7
7
|
"name": "@howaboua/pi-pet-desktop-source",
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"electron": "
|
|
10
|
-
"typescript": "^
|
|
9
|
+
"electron": "44.7.2",
|
|
10
|
+
"typescript": "^7.0.2"
|
|
11
11
|
},
|
|
12
12
|
"engines": {
|
|
13
13
|
"node": ">=22.12.0"
|
|
@@ -54,6 +54,346 @@
|
|
|
54
54
|
"undici-types": ">=7.24.0 <7.24.7"
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
|
+
"node_modules/@typescript/typescript-aix-ppc64": {
|
|
58
|
+
"version": "7.0.2",
|
|
59
|
+
"resolved": "https://registry.npmjs.org/@typescript/typescript-aix-ppc64/-/typescript-aix-ppc64-7.0.2.tgz",
|
|
60
|
+
"integrity": "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==",
|
|
61
|
+
"cpu": [
|
|
62
|
+
"ppc64"
|
|
63
|
+
],
|
|
64
|
+
"dev": true,
|
|
65
|
+
"license": "Apache-2.0",
|
|
66
|
+
"optional": true,
|
|
67
|
+
"os": [
|
|
68
|
+
"aix"
|
|
69
|
+
],
|
|
70
|
+
"engines": {
|
|
71
|
+
"node": ">=16.20.0"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"node_modules/@typescript/typescript-darwin-arm64": {
|
|
75
|
+
"version": "7.0.2",
|
|
76
|
+
"resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.0.2.tgz",
|
|
77
|
+
"integrity": "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==",
|
|
78
|
+
"cpu": [
|
|
79
|
+
"arm64"
|
|
80
|
+
],
|
|
81
|
+
"dev": true,
|
|
82
|
+
"license": "Apache-2.0",
|
|
83
|
+
"optional": true,
|
|
84
|
+
"os": [
|
|
85
|
+
"darwin"
|
|
86
|
+
],
|
|
87
|
+
"engines": {
|
|
88
|
+
"node": ">=16.20.0"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"node_modules/@typescript/typescript-darwin-x64": {
|
|
92
|
+
"version": "7.0.2",
|
|
93
|
+
"resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-x64/-/typescript-darwin-x64-7.0.2.tgz",
|
|
94
|
+
"integrity": "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==",
|
|
95
|
+
"cpu": [
|
|
96
|
+
"x64"
|
|
97
|
+
],
|
|
98
|
+
"dev": true,
|
|
99
|
+
"license": "Apache-2.0",
|
|
100
|
+
"optional": true,
|
|
101
|
+
"os": [
|
|
102
|
+
"darwin"
|
|
103
|
+
],
|
|
104
|
+
"engines": {
|
|
105
|
+
"node": ">=16.20.0"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"node_modules/@typescript/typescript-freebsd-arm64": {
|
|
109
|
+
"version": "7.0.2",
|
|
110
|
+
"resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-arm64/-/typescript-freebsd-arm64-7.0.2.tgz",
|
|
111
|
+
"integrity": "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==",
|
|
112
|
+
"cpu": [
|
|
113
|
+
"arm64"
|
|
114
|
+
],
|
|
115
|
+
"dev": true,
|
|
116
|
+
"license": "Apache-2.0",
|
|
117
|
+
"optional": true,
|
|
118
|
+
"os": [
|
|
119
|
+
"freebsd"
|
|
120
|
+
],
|
|
121
|
+
"engines": {
|
|
122
|
+
"node": ">=16.20.0"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"node_modules/@typescript/typescript-freebsd-x64": {
|
|
126
|
+
"version": "7.0.2",
|
|
127
|
+
"resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-x64/-/typescript-freebsd-x64-7.0.2.tgz",
|
|
128
|
+
"integrity": "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==",
|
|
129
|
+
"cpu": [
|
|
130
|
+
"x64"
|
|
131
|
+
],
|
|
132
|
+
"dev": true,
|
|
133
|
+
"license": "Apache-2.0",
|
|
134
|
+
"optional": true,
|
|
135
|
+
"os": [
|
|
136
|
+
"freebsd"
|
|
137
|
+
],
|
|
138
|
+
"engines": {
|
|
139
|
+
"node": ">=16.20.0"
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"node_modules/@typescript/typescript-linux-arm": {
|
|
143
|
+
"version": "7.0.2",
|
|
144
|
+
"resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm/-/typescript-linux-arm-7.0.2.tgz",
|
|
145
|
+
"integrity": "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==",
|
|
146
|
+
"cpu": [
|
|
147
|
+
"arm"
|
|
148
|
+
],
|
|
149
|
+
"dev": true,
|
|
150
|
+
"license": "Apache-2.0",
|
|
151
|
+
"optional": true,
|
|
152
|
+
"os": [
|
|
153
|
+
"linux"
|
|
154
|
+
],
|
|
155
|
+
"engines": {
|
|
156
|
+
"node": ">=16.20.0"
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"node_modules/@typescript/typescript-linux-arm64": {
|
|
160
|
+
"version": "7.0.2",
|
|
161
|
+
"resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm64/-/typescript-linux-arm64-7.0.2.tgz",
|
|
162
|
+
"integrity": "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==",
|
|
163
|
+
"cpu": [
|
|
164
|
+
"arm64"
|
|
165
|
+
],
|
|
166
|
+
"dev": true,
|
|
167
|
+
"license": "Apache-2.0",
|
|
168
|
+
"optional": true,
|
|
169
|
+
"os": [
|
|
170
|
+
"linux"
|
|
171
|
+
],
|
|
172
|
+
"engines": {
|
|
173
|
+
"node": ">=16.20.0"
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
"node_modules/@typescript/typescript-linux-loong64": {
|
|
177
|
+
"version": "7.0.2",
|
|
178
|
+
"resolved": "https://registry.npmjs.org/@typescript/typescript-linux-loong64/-/typescript-linux-loong64-7.0.2.tgz",
|
|
179
|
+
"integrity": "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==",
|
|
180
|
+
"cpu": [
|
|
181
|
+
"loong64"
|
|
182
|
+
],
|
|
183
|
+
"dev": true,
|
|
184
|
+
"license": "Apache-2.0",
|
|
185
|
+
"optional": true,
|
|
186
|
+
"os": [
|
|
187
|
+
"linux"
|
|
188
|
+
],
|
|
189
|
+
"engines": {
|
|
190
|
+
"node": ">=16.20.0"
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
"node_modules/@typescript/typescript-linux-mips64el": {
|
|
194
|
+
"version": "7.0.2",
|
|
195
|
+
"resolved": "https://registry.npmjs.org/@typescript/typescript-linux-mips64el/-/typescript-linux-mips64el-7.0.2.tgz",
|
|
196
|
+
"integrity": "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==",
|
|
197
|
+
"cpu": [
|
|
198
|
+
"mips64el"
|
|
199
|
+
],
|
|
200
|
+
"dev": true,
|
|
201
|
+
"license": "Apache-2.0",
|
|
202
|
+
"optional": true,
|
|
203
|
+
"os": [
|
|
204
|
+
"linux"
|
|
205
|
+
],
|
|
206
|
+
"engines": {
|
|
207
|
+
"node": ">=16.20.0"
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"node_modules/@typescript/typescript-linux-ppc64": {
|
|
211
|
+
"version": "7.0.2",
|
|
212
|
+
"resolved": "https://registry.npmjs.org/@typescript/typescript-linux-ppc64/-/typescript-linux-ppc64-7.0.2.tgz",
|
|
213
|
+
"integrity": "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==",
|
|
214
|
+
"cpu": [
|
|
215
|
+
"ppc64"
|
|
216
|
+
],
|
|
217
|
+
"dev": true,
|
|
218
|
+
"license": "Apache-2.0",
|
|
219
|
+
"optional": true,
|
|
220
|
+
"os": [
|
|
221
|
+
"linux"
|
|
222
|
+
],
|
|
223
|
+
"engines": {
|
|
224
|
+
"node": ">=16.20.0"
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
"node_modules/@typescript/typescript-linux-riscv64": {
|
|
228
|
+
"version": "7.0.2",
|
|
229
|
+
"resolved": "https://registry.npmjs.org/@typescript/typescript-linux-riscv64/-/typescript-linux-riscv64-7.0.2.tgz",
|
|
230
|
+
"integrity": "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==",
|
|
231
|
+
"cpu": [
|
|
232
|
+
"riscv64"
|
|
233
|
+
],
|
|
234
|
+
"dev": true,
|
|
235
|
+
"license": "Apache-2.0",
|
|
236
|
+
"optional": true,
|
|
237
|
+
"os": [
|
|
238
|
+
"linux"
|
|
239
|
+
],
|
|
240
|
+
"engines": {
|
|
241
|
+
"node": ">=16.20.0"
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
"node_modules/@typescript/typescript-linux-s390x": {
|
|
245
|
+
"version": "7.0.2",
|
|
246
|
+
"resolved": "https://registry.npmjs.org/@typescript/typescript-linux-s390x/-/typescript-linux-s390x-7.0.2.tgz",
|
|
247
|
+
"integrity": "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==",
|
|
248
|
+
"cpu": [
|
|
249
|
+
"s390x"
|
|
250
|
+
],
|
|
251
|
+
"dev": true,
|
|
252
|
+
"license": "Apache-2.0",
|
|
253
|
+
"optional": true,
|
|
254
|
+
"os": [
|
|
255
|
+
"linux"
|
|
256
|
+
],
|
|
257
|
+
"engines": {
|
|
258
|
+
"node": ">=16.20.0"
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
"node_modules/@typescript/typescript-linux-x64": {
|
|
262
|
+
"version": "7.0.2",
|
|
263
|
+
"resolved": "https://registry.npmjs.org/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.0.2.tgz",
|
|
264
|
+
"integrity": "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==",
|
|
265
|
+
"cpu": [
|
|
266
|
+
"x64"
|
|
267
|
+
],
|
|
268
|
+
"dev": true,
|
|
269
|
+
"license": "Apache-2.0",
|
|
270
|
+
"optional": true,
|
|
271
|
+
"os": [
|
|
272
|
+
"linux"
|
|
273
|
+
],
|
|
274
|
+
"engines": {
|
|
275
|
+
"node": ">=16.20.0"
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
"node_modules/@typescript/typescript-netbsd-arm64": {
|
|
279
|
+
"version": "7.0.2",
|
|
280
|
+
"resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-arm64/-/typescript-netbsd-arm64-7.0.2.tgz",
|
|
281
|
+
"integrity": "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==",
|
|
282
|
+
"cpu": [
|
|
283
|
+
"arm64"
|
|
284
|
+
],
|
|
285
|
+
"dev": true,
|
|
286
|
+
"license": "Apache-2.0",
|
|
287
|
+
"optional": true,
|
|
288
|
+
"os": [
|
|
289
|
+
"netbsd"
|
|
290
|
+
],
|
|
291
|
+
"engines": {
|
|
292
|
+
"node": ">=16.20.0"
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
"node_modules/@typescript/typescript-netbsd-x64": {
|
|
296
|
+
"version": "7.0.2",
|
|
297
|
+
"resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-x64/-/typescript-netbsd-x64-7.0.2.tgz",
|
|
298
|
+
"integrity": "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==",
|
|
299
|
+
"cpu": [
|
|
300
|
+
"x64"
|
|
301
|
+
],
|
|
302
|
+
"dev": true,
|
|
303
|
+
"license": "Apache-2.0",
|
|
304
|
+
"optional": true,
|
|
305
|
+
"os": [
|
|
306
|
+
"netbsd"
|
|
307
|
+
],
|
|
308
|
+
"engines": {
|
|
309
|
+
"node": ">=16.20.0"
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
"node_modules/@typescript/typescript-openbsd-arm64": {
|
|
313
|
+
"version": "7.0.2",
|
|
314
|
+
"resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-arm64/-/typescript-openbsd-arm64-7.0.2.tgz",
|
|
315
|
+
"integrity": "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==",
|
|
316
|
+
"cpu": [
|
|
317
|
+
"arm64"
|
|
318
|
+
],
|
|
319
|
+
"dev": true,
|
|
320
|
+
"license": "Apache-2.0",
|
|
321
|
+
"optional": true,
|
|
322
|
+
"os": [
|
|
323
|
+
"openbsd"
|
|
324
|
+
],
|
|
325
|
+
"engines": {
|
|
326
|
+
"node": ">=16.20.0"
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
"node_modules/@typescript/typescript-openbsd-x64": {
|
|
330
|
+
"version": "7.0.2",
|
|
331
|
+
"resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-x64/-/typescript-openbsd-x64-7.0.2.tgz",
|
|
332
|
+
"integrity": "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==",
|
|
333
|
+
"cpu": [
|
|
334
|
+
"x64"
|
|
335
|
+
],
|
|
336
|
+
"dev": true,
|
|
337
|
+
"license": "Apache-2.0",
|
|
338
|
+
"optional": true,
|
|
339
|
+
"os": [
|
|
340
|
+
"openbsd"
|
|
341
|
+
],
|
|
342
|
+
"engines": {
|
|
343
|
+
"node": ">=16.20.0"
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
"node_modules/@typescript/typescript-sunos-x64": {
|
|
347
|
+
"version": "7.0.2",
|
|
348
|
+
"resolved": "https://registry.npmjs.org/@typescript/typescript-sunos-x64/-/typescript-sunos-x64-7.0.2.tgz",
|
|
349
|
+
"integrity": "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==",
|
|
350
|
+
"cpu": [
|
|
351
|
+
"x64"
|
|
352
|
+
],
|
|
353
|
+
"dev": true,
|
|
354
|
+
"license": "Apache-2.0",
|
|
355
|
+
"optional": true,
|
|
356
|
+
"os": [
|
|
357
|
+
"sunos"
|
|
358
|
+
],
|
|
359
|
+
"engines": {
|
|
360
|
+
"node": ">=16.20.0"
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
"node_modules/@typescript/typescript-win32-arm64": {
|
|
364
|
+
"version": "7.0.2",
|
|
365
|
+
"resolved": "https://registry.npmjs.org/@typescript/typescript-win32-arm64/-/typescript-win32-arm64-7.0.2.tgz",
|
|
366
|
+
"integrity": "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==",
|
|
367
|
+
"cpu": [
|
|
368
|
+
"arm64"
|
|
369
|
+
],
|
|
370
|
+
"dev": true,
|
|
371
|
+
"license": "Apache-2.0",
|
|
372
|
+
"optional": true,
|
|
373
|
+
"os": [
|
|
374
|
+
"win32"
|
|
375
|
+
],
|
|
376
|
+
"engines": {
|
|
377
|
+
"node": ">=16.20.0"
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
"node_modules/@typescript/typescript-win32-x64": {
|
|
381
|
+
"version": "7.0.2",
|
|
382
|
+
"resolved": "https://registry.npmjs.org/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.0.2.tgz",
|
|
383
|
+
"integrity": "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==",
|
|
384
|
+
"cpu": [
|
|
385
|
+
"x64"
|
|
386
|
+
],
|
|
387
|
+
"dev": true,
|
|
388
|
+
"license": "Apache-2.0",
|
|
389
|
+
"optional": true,
|
|
390
|
+
"os": [
|
|
391
|
+
"win32"
|
|
392
|
+
],
|
|
393
|
+
"engines": {
|
|
394
|
+
"node": ">=16.20.0"
|
|
395
|
+
}
|
|
396
|
+
},
|
|
57
397
|
"node_modules/debug": {
|
|
58
398
|
"version": "4.4.3",
|
|
59
399
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
|
@@ -73,11 +413,10 @@
|
|
|
73
413
|
}
|
|
74
414
|
},
|
|
75
415
|
"node_modules/electron": {
|
|
76
|
-
"version": "
|
|
77
|
-
"resolved": "https://registry.npmjs.org/electron/-/electron-
|
|
78
|
-
"integrity": "sha512-
|
|
416
|
+
"version": "44.7.2",
|
|
417
|
+
"resolved": "https://registry.npmjs.org/electron/-/electron-44.7.2.tgz",
|
|
418
|
+
"integrity": "sha512-u3Pbz0Hi1sSSwBMz2v8LiagsfUG4QURPUe/qphM+g4THKP8o4BYdnuboyhlLO8HIC/KfV5rvltyacbP4jEq9yw==",
|
|
79
419
|
"dev": true,
|
|
80
|
-
"hasInstallScript": true,
|
|
81
420
|
"license": "MIT",
|
|
82
421
|
"dependencies": {
|
|
83
422
|
"@electron-internal/extract-zip": "^1.0.1",
|
|
@@ -85,7 +424,8 @@
|
|
|
85
424
|
"@types/node": "^24.9.0"
|
|
86
425
|
},
|
|
87
426
|
"bin": {
|
|
88
|
-
"electron": "cli.js"
|
|
427
|
+
"electron": "cli.js",
|
|
428
|
+
"install-electron": "install.js"
|
|
89
429
|
},
|
|
90
430
|
"engines": {
|
|
91
431
|
"node": ">= 22.12.0"
|
|
@@ -155,17 +495,38 @@
|
|
|
155
495
|
}
|
|
156
496
|
},
|
|
157
497
|
"node_modules/typescript": {
|
|
158
|
-
"version": "
|
|
159
|
-
"resolved": "https://registry.npmjs.org/typescript/-/typescript-
|
|
160
|
-
"integrity": "sha512-
|
|
498
|
+
"version": "7.0.2",
|
|
499
|
+
"resolved": "https://registry.npmjs.org/typescript/-/typescript-7.0.2.tgz",
|
|
500
|
+
"integrity": "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==",
|
|
161
501
|
"dev": true,
|
|
162
502
|
"license": "Apache-2.0",
|
|
163
503
|
"bin": {
|
|
164
|
-
"tsc": "bin/tsc"
|
|
165
|
-
"tsserver": "bin/tsserver"
|
|
504
|
+
"tsc": "bin/tsc"
|
|
166
505
|
},
|
|
167
506
|
"engines": {
|
|
168
|
-
"node": ">=
|
|
507
|
+
"node": ">=16.20.0"
|
|
508
|
+
},
|
|
509
|
+
"optionalDependencies": {
|
|
510
|
+
"@typescript/typescript-aix-ppc64": "7.0.2",
|
|
511
|
+
"@typescript/typescript-darwin-arm64": "7.0.2",
|
|
512
|
+
"@typescript/typescript-darwin-x64": "7.0.2",
|
|
513
|
+
"@typescript/typescript-freebsd-arm64": "7.0.2",
|
|
514
|
+
"@typescript/typescript-freebsd-x64": "7.0.2",
|
|
515
|
+
"@typescript/typescript-linux-arm": "7.0.2",
|
|
516
|
+
"@typescript/typescript-linux-arm64": "7.0.2",
|
|
517
|
+
"@typescript/typescript-linux-loong64": "7.0.2",
|
|
518
|
+
"@typescript/typescript-linux-mips64el": "7.0.2",
|
|
519
|
+
"@typescript/typescript-linux-ppc64": "7.0.2",
|
|
520
|
+
"@typescript/typescript-linux-riscv64": "7.0.2",
|
|
521
|
+
"@typescript/typescript-linux-s390x": "7.0.2",
|
|
522
|
+
"@typescript/typescript-linux-x64": "7.0.2",
|
|
523
|
+
"@typescript/typescript-netbsd-arm64": "7.0.2",
|
|
524
|
+
"@typescript/typescript-netbsd-x64": "7.0.2",
|
|
525
|
+
"@typescript/typescript-openbsd-arm64": "7.0.2",
|
|
526
|
+
"@typescript/typescript-openbsd-x64": "7.0.2",
|
|
527
|
+
"@typescript/typescript-sunos-x64": "7.0.2",
|
|
528
|
+
"@typescript/typescript-win32-arm64": "7.0.2",
|
|
529
|
+
"@typescript/typescript-win32-x64": "7.0.2"
|
|
169
530
|
}
|
|
170
531
|
},
|
|
171
532
|
"node_modules/undici": {
|
package/desktop/package.json
CHANGED
package/dist/desktop/main.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createReadStream as qe}from"node:fs";import{writeFile as Xe}from"node:fs/promises";import{dirname as Ke,join as ce}from"node:path";import{fileURLToPath as Qe}from"node:url";import{app as s,BrowserWindow as Ze,Menu as ue,screen as de,session as v}from"electron";import{randomUUID as Ee}from"node:crypto";import{mkdir as Se,readFile as ke,rename as be,unlink as De,writeFile as _e}from"node:fs/promises";import{dirname as Te}from"node:path";var Ce=new Set(["schemaVersion","mode","petSize","snoozedUntil"]),Re=4096,Ae=604800000;function N(){return{schemaVersion:1,mode:"normal",petSize:"medium",snoozedUntil:null}}function Ne(e){let t=e??"medium";if(t!=="small"&&t!=="medium"&&t!=="large")throw Error("Desktop petSize must be small, medium, or large.");return t}function H(e){if(!e||typeof e!=="object"||Array.isArray(e))throw Error("Desktop attention preferences must be an object.");let t=e,n=Object.keys(t).find((o)=>!Ce.has(o));if(n)throw Error(`Desktop attention preferences have unknown field: ${n}.`);if(t.schemaVersion!==1)throw Error("Unsupported desktop attention schemaVersion.");if(t.mode!=="normal"&&t.mode!=="quiet")throw Error("Desktop attention mode must be normal or quiet.");let r=Ne(t.petSize);if(t.snoozedUntil!==null&&typeof t.snoozedUntil!=="string")throw Error("Desktop snoozedUntil must be an ISO timestamp or null.");if(typeof t.snoozedUntil==="string"){let o=Date.parse(t.snoozedUntil);if(!Number.isFinite(o))throw Error("Desktop snoozedUntil must be a valid ISO timestamp.");if(o-Date.now()>Ae)throw Error("Desktop snoozedUntil cannot be more than seven days away.")}return{schemaVersion:1,mode:t.mode,petSize:r,snoozedUntil:t.snoozedUntil}}async function B(e){try{let t=await ke(e,"utf8");if(Buffer.byteLength(t)>Re)throw Error("Attention preferences are too large.");return H(JSON.parse(t))}catch(t){if(t.code==="ENOENT")return N();throw Error(`Invalid desktop attention preferences at ${e}: ${t.message}`)}}async function F(e,t){let n=H(t);await Se(Te(e),{recursive:!0,mode:448});let r=`${e}.${process.pid}.${Ee()}.tmp`;try{await _e(r,`${JSON.stringify(n)}
|
|
2
2
|
`,{encoding:"utf8",flag:"wx",mode:384}),await be(r,e)}catch(o){throw await De(r).catch(()=>{return}),o}}function V(e=new Date){return new Date(e.getFullYear(),e.getMonth(),e.getDate()+1,8)}function k(e,t=Date.now()){if(!e.snoozedUntil)return 0;return Math.max(0,Date.parse(e.snoozedUntil)-t)}var U="pi-pet:cursor-position";function j(e){if(e===null)return null;if(!e||typeof e!=="object"||Array.isArray(e))throw Error("Cursor position must be an object.");let t=e;if(Object.keys(t).some((n)=>n!=="x"&&n!=="y"))throw Error("Cursor position has an unknown field.");if(typeof t.x!=="number"||!Number.isFinite(t.x)||Math.abs(t.x)>1e5||typeof t.y!=="number"||!Number.isFinite(t.y)||Math.abs(t.y)>1e5)throw Error("Cursor position is invalid.");return{x:t.x,y:t.y}}import{constants as J}from"node:fs";import{open as Ue}from"node:fs/promises";import{homedir as Y}from"node:os";import{join as l,resolve as Oe}from"node:path";var ve=new Set(["schemaVersion","gippityUrl"]),G=16384;function Ie(e=process.env,t=process.platform,n=Y()){if(e.PI_PET_DESKTOP_CONFIG)return Oe(e.PI_PET_DESKTOP_CONFIG);if(t==="win32")return l(e.APPDATA||l(n,"AppData","Roaming"),"PiPetDesktop","config.json");if(t==="darwin")return l(n,"Library","Application Support","Pi Pet Desktop","config.json");return l(e.XDG_CONFIG_HOME||l(n,".config"),"pi-pet-desktop","config.json")}function q(e=process.env,t=process.platform,n=Y()){if(t==="win32")return l(e.LOCALAPPDATA||l(n,"AppData","Local"),"PiPetDesktop","state");if(t==="darwin")return l(n,"Library","Application Support","Pi Pet Desktop","state");return l(e.XDG_STATE_HOME||l(n,".local","state"),"pi-pet-desktop")}function xe(e){if(typeof e!=="string"||e.length>2048)throw Error("gippityUrl must be a bounded HTTPS URL.");let t;try{t=new URL(e)}catch{throw Error("gippityUrl must be a valid HTTPS URL.")}if(t.protocol!=="https:"||t.username||t.password||t.search||t.hash)throw Error("gippityUrl must be an HTTPS origin without credentials, query, or fragment.");if(t.pathname!=="/")throw Error("gippityUrl must not contain a path.");return t.origin}function X(e){if(!e||typeof e!=="object"||Array.isArray(e))throw Error("Pi Pet desktop config must be an object.");let t=e,n=Object.keys(t).find((r)=>!ve.has(r));if(n)throw Error(`Pi Pet desktop config has unknown field: ${n}.`);if(t.schemaVersion!==1)throw Error("Unsupported Pi Pet desktop config schemaVersion.");return{schemaVersion:1,gippityUrl:xe(t.gippityUrl)}}function ze(e){let t=e.PI_PET_GIPPITY_URL;return t?X({schemaVersion:1,gippityUrl:t}):void 0}async function Le(e){try{return await Ue(e,J.O_RDONLY|(J.O_NOFOLLOW||0))}catch(t){if(t.code==="ENOENT")throw Error(`Pi Pet desktop is not configured: ${e}`);if(t.code==="ELOOP")throw Error(`Pi Pet desktop config must not be a symbolic link: ${e}`);throw t}}async function Me(e,t){let n=await e.stat();if(!n.isFile()||n.size>G)throw Error(`Pi Pet desktop config must be a regular file no larger than ${G} bytes: ${t}`);if(process.platform==="win32")return;if((n.mode&63)!==0)throw Error(`Pi Pet desktop config must have mode 0600: ${t}`);if(process.getuid&&n.uid!==process.getuid())throw Error(`Pi Pet desktop config must be owned by the current user: ${t}`)}async function K(e=Ie(),t=process.env){let n=ze(t);if(n)return n;let r=await Le(e);try{await Me(r,e);let o=await r.readFile("utf8");return X(JSON.parse(o))}catch(o){throw Error(`Invalid Pi Pet desktop config at ${e}: ${o.message}`)}finally{await r.close()}}function Q(e,t="normal"){let n=new URL(e.gippityUrl);if(n.pathname="/_gippity/apps/pi-pet/",n.searchParams.set("shell","desktop"),t==="quiet")n.searchParams.set("attention","quiet");return n.toString()}import{createConnection as We}from"node:net";import{join as He}from"node:path";var Be=/^[a-zA-Z0-9._-]{1,200}$/,Fe=1024,Ve=1048576,$e=200;function ee(e){let{XDG_RUNTIME_DIR:t,HYPRLAND_INSTANCE_SIGNATURE:n}=e;if(!(t&&n&&t.startsWith("/")&&Be.test(n)))return;return He(t,"hypr",n,".socket.sock")}function je(e){let t=j(JSON.parse(e));if(!t)throw Error("Hyprland returned an empty cursor position.");return t}function Z(e,t){if(!Array.isArray(e)||e.length!==2||typeof e[0]!=="number"||!Number.isFinite(e[0])||typeof e[1]!=="number"||!Number.isFinite(e[1]))throw Error(`Hyprland ${t} is invalid.`);return[e[0],e[1]]}function Je(e,t){let n=JSON.parse(e);if(!Array.isArray(n))throw Error("Hyprland clients response must be an array.");let r=n.find((a)=>a!==null&&typeof a==="object"&&!Array.isArray(a)&&a.pid===t);if(!r)throw Error(`Hyprland did not report the Pi Pet window for process ${t}.`);let o=r,[d,S]=Z(o.at,"window position"),[i,u]=Z(o.size,"window size");if(i<1||u<1||i>4096||u>4096)throw Error("Hyprland window size is invalid.");return{x:d,y:S,width:i,height:u}}async function te(e,t,n,r,o){return await new Promise((d,S)=>{let i=We(e),u="",a=!1,P=(c)=>{if(a)return;a=!0,i.destroy(),S(c)};i.setEncoding("utf8"),i.setTimeout($e),i.on("connect",()=>i.end(t)),i.on("data",(c)=>{if(u+=c,Buffer.byteLength(u)>n){P(Error("Hyprland returned an oversized IPC response."));return}if(!r(u.trimEnd()))return;try{let f=o(u);a=!0,i.destroy(),d(f)}catch(f){P(f instanceof Error?f:Error("Hyprland returned an invalid IPC response."))}}),i.on("timeout",()=>P(Error("Hyprland cursor IPC timed out."))),i.on("error",(c)=>P(c)),i.on("end",()=>{if(a)return;try{let c=o(u);a=!0,d(c)}catch(c){P(c instanceof Error?c:Error("Hyprland returned an invalid IPC response."))}})})}async function Ge(e){return await te(e,"j/cursorpos",Fe,(t)=>t.endsWith("}"),je)}async function Ye(e,t){return await te(e,"j/clients",Ve,(n)=>n.endsWith("]"),(n)=>Je(n,t))}function ne(e,t){let n=ee(e);if(n)return async()=>await Ge(n);return async()=>t()}function re(e,t){let n=ee(e);if(!n)return;return async()=>await Ye(n,t)}var oe=20,et=3000,tt=1500,nt=100,rt=220,ie=500,ot=1e4,it=1000,pe=Object.freeze({small:{width:180,height:195},medium:{width:240,height:260},large:{width:320,height:347}}),b,w,m,D,_,h,p=N(),I=Promise.resolve(),se=!1,y,fe=!1;s.setName("Pi Pet Desktop");s.setPath("userData",q());if(process.platform==="linux")s.disableHardwareAcceleration(),s.commandLine.appendSwitch("disable-gpu"),s.commandLine.appendSwitch("disable-gpu-compositing");function T(e){let t=process.platform==="darwin"?"floating":"screen-saver";e.setAlwaysOnTop(!0,t,1),e.moveTop(),e.setVisibleOnAllWorkspaces(!0,{visibleOnFullScreen:!0})}function le(){return ce(s.getPath("userData"),"attention.json")}function st(){let e=Number(process.env.PI_PET_OWNER_FD);if(!Number.isSafeInteger(e)||e<3||e>9)return;let t=()=>{if(!fe)s.quit()};y=qe("",{fd:e,autoClose:!1}),y.once("end",t),y.once("close",t),y.once("error",t),y.resume()}function me(){if(!h)throw Error("Pi Pet desktop configuration is not loaded.");return Q(h,p.mode)}function R(e){let t=I.then(async()=>{let n=e(p);await F(le(),n),p=n});return I=t.catch(()=>{return}),t}function g(e){process.stderr.write(`Pi Pet desktop: ${e instanceof Error?e.message:String(e)}
|
|
3
3
|
`)}function C(e){if(!(h&&e))return!1;try{return new URL(e).origin===new URL(h.gippityUrl).origin}catch{return!1}}function at(){v.defaultSession.setPermissionCheckHandler((e,t,n,r)=>t==="media"&&r.isMainFrame&&r.mediaType==="audio"&&e!==null&&C(e.getURL())&&C(n)),v.defaultSession.setPermissionRequestHandler((e,t,n,r)=>{let o="mediaTypes"in r?r.mediaTypes:void 0;n(t==="media"&&r.isMainFrame&&o?.length===1&&o[0]==="audio"&&C(e.getURL())&&C(r.requestingUrl))})}function ct(){v.defaultSession.setCertificateVerifyProc((e,t)=>{let n=h?new URL(h.gippityUrl).hostname:void 0,r=e.errorCode===-202||e.verificationResult==="CERT_AUTHORITY_INVALID"||e.verificationResult==="net::ERR_CERT_AUTHORITY_INVALID";t(e.hostname===n&&r?0:e.errorCode)})}s.on("certificate-error",(e,t,n,r,o,d)=>{try{if(h&&r==="net::ERR_CERT_AUTHORITY_INVALID"&&new URL(n).origin===new URL(h.gippityUrl).origin){e.preventDefault(),d(!0);return}}catch{}d(!1)});function x(e){if(k(p)>0){e.hide();return}T(e),e.show()}function we(e){if(m)clearTimeout(m);m=void 0;let t=k(p);if(t===0){x(e);return}e.hide(),m=setTimeout(()=>{m=void 0,R((n)=>({...n,snoozedUntil:null})).then(()=>x(e)).catch(g)},t),m.unref()}async function O(e,t){await R((n)=>({...n,snoozedUntil:t.toISOString()})),we(e)}async function ut(e,t){await R((n)=>({...n,mode:t?"quiet":"normal"})),await z(e,me())}async function dt(e,t){await R((o)=>({...o,petSize:t}));let n=e.getBounds(),r=pe[t];e.setBounds({x:n.x+n.width-r.width,y:n.y+n.height-r.height,...r}),T(e)}function pt(e){let t=de.getPrimaryDisplay().workArea,n=pe[e];return{x:t.x+t.width-n.width-oe,y:t.y+t.height-n.height-oe,...n}}function ft(e){let t=!1,n=!1,r=!1,o=ie,d=0,S=ne(process.env,()=>de.getCursorScreenPoint()),i=re(process.env,process.pid),u,a=!1,P=async()=>{if(!i)return;try{u=await i(),a=!1}catch(f){if(!a)a=!0,g(f)}},c=async()=>{if(n||Date.now()<d||e.isDestroyed()||k(p)>0)return;n=!0;let f;try{f=await S(),r=!1,o=ie,d=0}catch(A){if(!r)r=!0,g(A);d=Date.now()+o,o=Math.min(o*2,ot),n=!1;return}let E=u||e.getBounds(),L=f.x-E.x,M=f.y-E.y,Pe=L-E.width/2,ge=M-E.height/2,ye=Math.max(E.width,E.height)/2+rt,W=Math.hypot(Pe,ge)<=ye;if(W){let A={x:L,y:M};e.webContents.send(U,A)}else if(t)e.webContents.send(U,null);t=W,n=!1};D=setInterval(()=>void c(),nt),D.unref(),_=setInterval(()=>void P(),it),_.unref(),P().then(c)}function lt(e,t){e.webContents.setWindowOpenHandler(()=>({action:"deny"}));let n=(r,o)=>{try{if(new URL(o).origin!==t)r.preventDefault()}catch{r.preventDefault()}};e.webContents.on("will-navigate",n),e.webContents.on("will-redirect",n),e.webContents.on("context-menu",()=>{ue.buildFromTemplate([{label:"Use arrow keys and Enter",enabled:!1},{type:"separator"},{label:"Reload pet",click:()=>e.webContents.reload()},{label:"Quiet mode",type:"checkbox",checked:p.mode==="quiet",click:(r)=>void ut(e,r.checked).catch(g)},{label:"Snooze",submenu:[{label:"For 15 minutes",click:()=>void O(e,new Date(Date.now()+900000)).catch(g)},{label:"For 1 hour",click:()=>void O(e,new Date(Date.now()+3600000)).catch(g)},{label:"Until tomorrow",click:()=>void O(e,V()).catch(g)}]},{label:"Pet size",submenu:["small","medium","large"].map((r)=>({label:r[0]?.toUpperCase()+r.slice(1),type:"radio",checked:p.petSize===r,click:()=>void dt(e,r).catch(g)}))},{type:"separator"},{label:"Quit for this Pi session",click:()=>s.quit()}]).popup({window:e})})}async function mt(e,t){await new Promise((r)=>setTimeout(r,tt));let n=await e.capturePage();await Xe(t,n.toPNG()),s.quit()}function wt(e,t){w=setTimeout(()=>{w=void 0,z(e,t)},et),w.unref()}async function z(e,t){if(w)clearTimeout(w);w=void 0;try{if(await e.loadURL(t),e.isDestroyed())return;x(e);let n=process.env.PI_PET_DESKTOP_SCREENSHOT;if(n)await mt(e,n)}catch(n){if(e.isDestroyed())return;process.stderr.write(`Pi Pet desktop could not reach GipPity: ${n instanceof Error?n.message:String(n)}
|
|
4
|
-
`),wt(e,t)}}async function ae(){h=await K(),p=await B(le());let e=me(),t=new URL(e).origin,n=new Ze({...pt(p.petSize),frame:!1,transparent:!0,hasShadow:!1,backgroundColor:"#00000000",alwaysOnTop:!0,maximizable:!1,minimizable:!1,movable:!0,resizable:!1,show:!1,skipTaskbar:!0,title:"Pi Pet",webPreferences:{contextIsolation:!0,devTools:process.env.PI_PET_DESKTOP_DEVTOOLS==="1",nodeIntegration:!1,preload:ce(Ke(Qe(import.meta.url)),"preload.cjs"),sandbox:!0,webSecurity:!0}});if(lt(n,t),T(n),n.setFullScreenable(!1),n.on("blur",()=>T(n)),n.on("show",()=>T(n)),n.on("closed",()=>{if(w)clearTimeout(w);if(m)clearTimeout(m);if(D)clearInterval(D);if(_)clearInterval(_);if(w=void 0,m=void 0,D=void 0,_=void 0,b===n)b=void 0}),z(n,e),ft(n),k(p)>0)we(n);return n}s.whenReady().then(async()=>{ue.setApplicationMenu(null),st(),at(),ct(),b=await ae(),s.on("activate",()=>{if(!b)ae().then((e)=>{b=e})})}).catch((e)=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
|
|
4
|
+
`),wt(e,t)}}async function ae(){h=await K(),p=await B(le());let e=me(),t=new URL(e).origin,n=new Ze({...pt(p.petSize),frame:!1,transparent:!0,roundedCorners:process.platform!=="linux",hasShadow:!1,backgroundColor:"#00000000",alwaysOnTop:!0,maximizable:!1,minimizable:!1,movable:!0,resizable:!1,show:!1,skipTaskbar:!0,title:"Pi Pet",webPreferences:{contextIsolation:!0,devTools:process.env.PI_PET_DESKTOP_DEVTOOLS==="1",nodeIntegration:!1,preload:ce(Ke(Qe(import.meta.url)),"preload.cjs"),sandbox:!0,webSecurity:!0}});if(lt(n,t),T(n),n.setFullScreenable(!1),n.on("blur",()=>T(n)),n.on("show",()=>T(n)),n.on("closed",()=>{if(w)clearTimeout(w);if(m)clearTimeout(m);if(D)clearInterval(D);if(_)clearInterval(_);if(w=void 0,m=void 0,D=void 0,_=void 0,b===n)b=void 0}),z(n,e),ft(n),k(p)>0)we(n);return n}s.whenReady().then(async()=>{ue.setApplicationMenu(null),st(),at(),ct(),b=await ae(),s.on("activate",()=>{if(!b)ae().then((e)=>{b=e})})}).catch((e)=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
|
|
5
5
|
`),s.quit()});s.on("window-all-closed",()=>{if(process.platform!=="darwin")s.quit()});s.on("will-quit",()=>{fe=!0,y?.destroy(),y=void 0});async function he(){if(se)return;se=!0,setTimeout(()=>process.exit(0),1500).unref(),await I,s.quit()}process.once("SIGINT",()=>void he());process.once("SIGTERM",()=>void he());
|
package/extensions/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
import { CONFIG_DIR_NAME, type ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
3
|
+
import { CONFIG_DIR_NAME, defineTool, type ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
4
4
|
import { Container, Text } from "@earendil-works/pi-tui";
|
|
5
5
|
import { Type } from "typebox";
|
|
6
6
|
import registerPackageChangelog from "../changelog.js";
|
|
@@ -12,7 +12,7 @@ import { registerRemoteApp } from "./remote-app.ts";
|
|
|
12
12
|
|
|
13
13
|
const packageRoot = fileURLToPath(new URL("../", import.meta.url));
|
|
14
14
|
|
|
15
|
-
function registerPetRuntime(pi: ExtensionAPI, runtime: PetRuntime)
|
|
15
|
+
function registerPetRuntime(pi: ExtensionAPI, runtime: PetRuntime) {
|
|
16
16
|
const appRoot = runtime.root;
|
|
17
17
|
const catalog: PetCatalog = runtime.catalog;
|
|
18
18
|
let state: PetState = { schemaVersion: 1, pet: catalog.id, revision: 1, action: catalog.defaultAction };
|
|
@@ -44,24 +44,23 @@ function registerPetRuntime(pi: ExtensionAPI, runtime: PetRuntime): boolean {
|
|
|
44
44
|
return state;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
const tool = defineTool({
|
|
48
48
|
name: "pet_show",
|
|
49
49
|
label: "Pet",
|
|
50
50
|
description: "Show a named reaction on the connected Pi Pet",
|
|
51
51
|
promptGuidelines: ["Use pet_show sparingly; routine task activity animates automatically"],
|
|
52
52
|
parameters: Type.Object({
|
|
53
|
-
action: Type.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
action: Type.Optional(
|
|
54
|
+
Type.String({
|
|
55
|
+
minLength: 1,
|
|
56
|
+
maxLength: 64,
|
|
57
|
+
description: 'Reaction name, or "list" to return available names',
|
|
58
|
+
}),
|
|
59
|
+
),
|
|
58
60
|
note: Type.Optional(Type.String({ minLength: 1, maxLength: 280, description: "Short visible context" })),
|
|
59
61
|
}),
|
|
60
62
|
async execute(_toolCallId, params) {
|
|
61
|
-
if (
|
|
62
|
-
throw new Error(GIPPITY_REQUIRED_TOOL_MESSAGE);
|
|
63
|
-
}
|
|
64
|
-
if (params.action === "list") {
|
|
63
|
+
if (params.action === undefined || params.action === "list") {
|
|
65
64
|
const actions = Object.keys(catalog.actions).sort().join(", ");
|
|
66
65
|
const aliases = Object.entries(catalog.aliases)
|
|
67
66
|
.sort(([left], [right]) => left.localeCompare(right))
|
|
@@ -71,12 +70,15 @@ function registerPetRuntime(pi: ExtensionAPI, runtime: PetRuntime): boolean {
|
|
|
71
70
|
content: [
|
|
72
71
|
{
|
|
73
72
|
type: "text",
|
|
74
|
-
text: `${catalog.displayName} actions: ${actions}.${aliases ? ` Aliases: ${aliases}.` : ""}`,
|
|
73
|
+
text: `${params.action === undefined ? 'pet_show({ action: "<reaction>", note?: "<short context>" }). ' : ""}${catalog.displayName} actions: ${actions}.${aliases ? ` Aliases: ${aliases}.` : ""}`,
|
|
75
74
|
},
|
|
76
75
|
],
|
|
77
76
|
details: state,
|
|
78
77
|
};
|
|
79
78
|
}
|
|
79
|
+
if (!registration.available) {
|
|
80
|
+
throw new Error(GIPPITY_REQUIRED_TOOL_MESSAGE);
|
|
81
|
+
}
|
|
80
82
|
const next = setAction(params.action, parseNote(params.note));
|
|
81
83
|
return {
|
|
82
84
|
content: [{ type: "text", text: `Pet reaction set to ${next.action}.` }],
|
|
@@ -84,7 +86,7 @@ function registerPetRuntime(pi: ExtensionAPI, runtime: PetRuntime): boolean {
|
|
|
84
86
|
};
|
|
85
87
|
},
|
|
86
88
|
renderCall(args, theme) {
|
|
87
|
-
return new Text(`${theme.fg("toolTitle", theme.bold("Pet"))} ${theme.fg("muted", args.action)}`, 0, 0);
|
|
89
|
+
return new Text(`${theme.fg("toolTitle", theme.bold("Pet"))} ${theme.fg("muted", args.action ?? "help")}`, 0, 0);
|
|
88
90
|
},
|
|
89
91
|
renderResult(result, _options, theme, renderContext) {
|
|
90
92
|
if (!renderContext.isError) return new Container();
|
|
@@ -92,13 +94,37 @@ function registerPetRuntime(pi: ExtensionAPI, runtime: PetRuntime): boolean {
|
|
|
92
94
|
return new Text(theme.fg("error", message), 0, 0);
|
|
93
95
|
},
|
|
94
96
|
});
|
|
97
|
+
pi.registerTool(tool);
|
|
95
98
|
pi.on("agent_settled", () => {
|
|
96
99
|
if (state.action !== catalog.defaultAction) setAction(catalog.defaultAction);
|
|
97
100
|
});
|
|
98
|
-
return registration.available;
|
|
101
|
+
return { available: registration.available, tool };
|
|
99
102
|
}
|
|
100
103
|
|
|
101
|
-
export default function piPetExtension(pi: ExtensionAPI): void {
|
|
104
|
+
export default async function piPetExtension(pi: ExtensionAPI): Promise<void> {
|
|
105
|
+
let current: ReturnType<typeof registerPetRuntime> | undefined;
|
|
106
|
+
let refresh = () => {};
|
|
107
|
+
try {
|
|
108
|
+
const { adaptToolForCodeMode, registerCodeModeExtensionTools } = await import(
|
|
109
|
+
"@howaboua/pi-codex-conversion/code-mode"
|
|
110
|
+
);
|
|
111
|
+
const codeRegistration = registerCodeModeExtensionTools(pi, () => [
|
|
112
|
+
...(current ? [adaptToolForCodeMode(current.tool, { discovery: "help", deferLoading: true })] : []),
|
|
113
|
+
]);
|
|
114
|
+
refresh = codeRegistration.refresh;
|
|
115
|
+
pi.on("session_shutdown", () => codeRegistration.unregister());
|
|
116
|
+
} catch (error) {
|
|
117
|
+
if (
|
|
118
|
+
!(
|
|
119
|
+
error instanceof Error &&
|
|
120
|
+
"code" in error &&
|
|
121
|
+
["ERR_MODULE_NOT_FOUND", "MODULE_NOT_FOUND", "ERR_PACKAGE_PATH_NOT_EXPORTED"].includes(String(error.code)) &&
|
|
122
|
+
error.message.includes("@howaboua/pi-codex-conversion")
|
|
123
|
+
)
|
|
124
|
+
)
|
|
125
|
+
throw error;
|
|
126
|
+
}
|
|
127
|
+
|
|
102
128
|
registerPackageChangelog(pi);
|
|
103
129
|
registerPetDevices(pi);
|
|
104
130
|
pi.on("session_start", (_event, ctx) => {
|
|
@@ -106,7 +132,8 @@ export default function piPetExtension(pi: ExtensionAPI): void {
|
|
|
106
132
|
for (const warning of resolution.warnings) {
|
|
107
133
|
if (ctx.hasUI) ctx.ui.notify(`Pi Pet ${warning}`, "warning");
|
|
108
134
|
}
|
|
109
|
-
|
|
110
|
-
|
|
135
|
+
current = registerPetRuntime(pi, resolution.runtime);
|
|
136
|
+
refresh();
|
|
137
|
+
if (!current.available && ctx.hasUI) ctx.ui.notify(GIPPITY_REQUIRED_USER_MESSAGE, "error");
|
|
111
138
|
});
|
|
112
139
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@howaboua/pi-pet",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Animated companions for GipPity Remote.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -77,23 +77,28 @@
|
|
|
77
77
|
"@howaboua/pi-gippity-control": ">=0.0.20",
|
|
78
78
|
"@earendil-works/pi-coding-agent": ">=1.0.0",
|
|
79
79
|
"@earendil-works/pi-tui": ">=1.0.0",
|
|
80
|
-
"typebox": "*"
|
|
80
|
+
"typebox": "*",
|
|
81
|
+
"@howaboua/pi-codex-conversion": ">=4.0.2"
|
|
81
82
|
},
|
|
82
83
|
"peerDependenciesMeta": {
|
|
83
84
|
"@howaboua/pi-gippity-control": {
|
|
84
85
|
"optional": true
|
|
86
|
+
},
|
|
87
|
+
"@howaboua/pi-codex-conversion": {
|
|
88
|
+
"optional": true
|
|
85
89
|
}
|
|
86
90
|
},
|
|
87
91
|
"devDependencies": {
|
|
88
92
|
"@biomejs/biome": "2.5.15",
|
|
89
|
-
"@earendil-works/pi-coding-agent": "1.
|
|
90
|
-
"@earendil-works/pi-tui": "1.
|
|
93
|
+
"@earendil-works/pi-coding-agent": "1.3.0",
|
|
94
|
+
"@earendil-works/pi-tui": "1.3.0",
|
|
91
95
|
"@types/node": "^26.6.5",
|
|
92
|
-
"electron": "
|
|
96
|
+
"electron": "44.7.2",
|
|
93
97
|
"knip": "^6.41.0",
|
|
94
|
-
"typebox": "1.3.
|
|
98
|
+
"typebox": "1.3.37",
|
|
95
99
|
"@typescript/native-preview": "^7.0.0-dev.20260707.2",
|
|
96
|
-
"typescript": "^7.0.2"
|
|
100
|
+
"typescript": "^7.0.2",
|
|
101
|
+
"@howaboua/pi-codex-conversion": "4.0.2"
|
|
97
102
|
},
|
|
98
103
|
"publishConfig": {
|
|
99
104
|
"access": "public"
|
package/src/desktop/main.ts
CHANGED
|
@@ -374,6 +374,7 @@ async function createWindow(): Promise<BrowserWindow> {
|
|
|
374
374
|
...initialBounds(attention.petSize),
|
|
375
375
|
frame: false,
|
|
376
376
|
transparent: true,
|
|
377
|
+
roundedCorners: process.platform !== "linux",
|
|
377
378
|
hasShadow: false,
|
|
378
379
|
backgroundColor: "#00000000",
|
|
379
380
|
alwaysOnTop: true,
|