palmier 0.8.10 → 0.9.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/README.md +8 -1
- package/dist/commands/init.js +13 -2
- package/dist/commands/pair.js +3 -9
- package/dist/linked-device.d.ts +9 -0
- package/dist/linked-device.js +45 -0
- package/dist/mcp-tools.js +19 -19
- package/dist/network.d.ts +0 -5
- package/dist/network.js +75 -9
- package/dist/pwa/assets/index-BLCVzS_l.js +120 -0
- package/dist/pwa/assets/{index-DQJHVyP6.css → index-Cjjw24Ok.css} +1 -1
- package/dist/pwa/assets/{web-CaRUL7Kz.js → web-C2AU9S9n.js} +1 -1
- package/dist/pwa/assets/{web-C9g_YGd8.js → web-CfD_ah7K.js} +1 -1
- package/dist/pwa/assets/{web-D4ty3qtI.js → web-DugGj1t8.js} +1 -1
- package/dist/pwa/index.html +2 -2
- package/dist/pwa/service-worker.js +2 -2
- package/dist/rpc-handler.js +17 -23
- package/package.json +1 -2
- package/palmier-server/README.md +3 -2
- package/palmier-server/pwa/src/App.css +45 -4
- package/palmier-server/pwa/src/App.tsx +36 -15
- package/palmier-server/pwa/src/components/CapabilityToggles.tsx +65 -225
- package/palmier-server/pwa/src/components/ConnectionStatusIcon.tsx +54 -12
- package/palmier-server/pwa/src/components/HostMenu.tsx +110 -21
- package/palmier-server/pwa/src/components/RunDetailView.tsx +2 -2
- package/palmier-server/pwa/src/components/SessionComposer.tsx +9 -8
- package/palmier-server/pwa/src/components/SessionsView.tsx +5 -3
- package/palmier-server/pwa/src/components/TabBar.tsx +7 -5
- package/palmier-server/pwa/src/components/TaskForm.tsx +5 -3
- package/palmier-server/pwa/src/constants.ts +1 -1
- package/palmier-server/pwa/src/contexts/HostConnectionContext.tsx +41 -41
- package/palmier-server/pwa/src/contexts/HostStoreContext.tsx +17 -60
- package/palmier-server/pwa/src/hooks/usePushSubscription.ts +6 -7
- package/palmier-server/pwa/src/native/Device.ts +23 -38
- package/palmier-server/pwa/src/pages/Dashboard.tsx +36 -41
- package/palmier-server/pwa/src/pages/PairHost.tsx +20 -1
- package/palmier-server/pwa/src/pages/PairSetup.tsx +98 -39
- package/palmier-server/pwa/src/service-worker.ts +9 -6
- package/palmier-server/pwa/src/types.ts +2 -0
- package/palmier-server/spec.md +44 -15
- package/src/commands/init.ts +13 -2
- package/src/commands/pair.ts +3 -9
- package/src/linked-device.ts +52 -0
- package/src/mcp-tools.ts +19 -19
- package/src/network.ts +73 -9
- package/src/rpc-handler.ts +14 -22
- package/dist/device-capabilities.d.ts +0 -9
- package/dist/device-capabilities.js +0 -36
- package/dist/pwa/assets/index-iL_NTbsT.js +0 -120
- package/src/device-capabilities.ts +0 -57
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
import { CONFIG_DIR } from "./config.js";
|
|
4
|
-
|
|
5
|
-
const CAPABILITIES_FILE = path.join(CONFIG_DIR, "device-capabilities.json");
|
|
6
|
-
|
|
7
|
-
export interface RegisteredDevice {
|
|
8
|
-
clientToken: string;
|
|
9
|
-
fcmToken: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type DeviceCapability =
|
|
13
|
-
| "location"
|
|
14
|
-
| "notifications"
|
|
15
|
-
| "sms-read"
|
|
16
|
-
| "sms-send"
|
|
17
|
-
| "contacts"
|
|
18
|
-
| "calendar"
|
|
19
|
-
| "alarm"
|
|
20
|
-
| "battery"
|
|
21
|
-
| "send-email"
|
|
22
|
-
| "dnd";
|
|
23
|
-
|
|
24
|
-
type CapabilityMap = Partial<Record<DeviceCapability, RegisteredDevice>>;
|
|
25
|
-
|
|
26
|
-
function readAll(): CapabilityMap {
|
|
27
|
-
try {
|
|
28
|
-
if (!fs.existsSync(CAPABILITIES_FILE)) return {};
|
|
29
|
-
return JSON.parse(fs.readFileSync(CAPABILITIES_FILE, "utf-8")) as CapabilityMap;
|
|
30
|
-
} catch {
|
|
31
|
-
return {};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function writeAll(map: CapabilityMap): void {
|
|
36
|
-
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
37
|
-
fs.writeFileSync(CAPABILITIES_FILE, JSON.stringify(map, null, 2), "utf-8");
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function getCapabilityDevice(capability: DeviceCapability): RegisteredDevice | null {
|
|
41
|
-
const map = readAll();
|
|
42
|
-
const device = map[capability];
|
|
43
|
-
if (!device?.clientToken || !device?.fcmToken) return null;
|
|
44
|
-
return device;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function setCapabilityDevice(capability: DeviceCapability, clientToken: string, fcmToken: string): void {
|
|
48
|
-
const map = readAll();
|
|
49
|
-
map[capability] = { clientToken, fcmToken };
|
|
50
|
-
writeAll(map);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export function clearCapabilityDevice(capability: DeviceCapability): void {
|
|
54
|
-
const map = readAll();
|
|
55
|
-
delete map[capability];
|
|
56
|
-
writeAll(map);
|
|
57
|
-
}
|