OverviewFilesCommitsIssuesDocsReleasesPeers

ollama_semantic_function_calling commits / eb26f98

Add documentation for Keet device linking functionality
eb26f980e28b175daca12ddfc5022ff21c64cf9d
by fleeky.ashatron <fleeky@7rnx.net> · 2025-04-21T18:37:13.000Z

Changed files (1) +104 -0

ollamatools-new/second-device-keet/README.md +104 -0
……@@ -0,0 +1,104 @@
1# Keet Device Linking
2
3This directory contains the necessary files to simulate a second device linking to an existing Keet identity. This functionality is essential for allowing the Keet bot to operate across multiple devices.
4
5## Files
6
7- `keet_cmd.js`: The main Keet command-line agent script
8- `link_device.js`: A script to link a new device to an existing Keet identity
9- `package.json`: Dependencies for the Keet bot
10- `storage/`: Directory for storing the device's identity and other data
11
12## How Device Linking Works
13
14The device linking process involves the following steps:
15
161. **First Device Setup**: The first device creates an identity with a unique `memberId`.
172. **Second Device Linking**: The second device creates a new identity that shares the same `memberId` as the first device but has a different `deviceId`.
183. **Device Confirmation**: The first device confirms the second device by setting its `confirmed` status to `true`.
19
20## Identity Structure
21
22The identity file (`identity.json`) has the following structure:
23
24```json
25{
26 "anonymous": false,
27 "memberId": "unique-member-id",
28 "timestamp": 1234567890123,
29 "displayName": "KeetBot",
30 "avatar": null,
31 "devices": [
32 {
33 "deviceId": "device-id-1",
34 "isMobile": false,
35 "name": "Primary Device",
36 "confirmed": true
37 },
38 {
39 "deviceId": "device-id-2",
40 "isMobile": true,
41 "name": "Mobile Device",
42 "confirmed": true
43 }
44 ],
45 "local": {
46 "deviceId": "current-device-id"
47 }
48}
49```
50
51- `anonymous`: Whether the identity is anonymous (should be `false` for a real identity)
52- `memberId`: The unique identifier for the member (shared across all devices)
53- `timestamp`: The timestamp when the identity was created
54- `displayName`: The display name for the identity
55- `avatar`: The avatar for the identity (if any)
56- `devices`: An array of devices linked to this identity
57 - `deviceId`: The unique identifier for the device
58 - `isMobile`: Whether the device is mobile
59 - `name`: The name of the device
60 - `confirmed`: Whether the device has been confirmed
61- `local`: Information about the local device
62 - `deviceId`: The device ID of the current device
63
64## Usage
65
66### Linking a New Device
67
68To link a new device to an existing identity, run the `link_device.js` script:
69
70```bash
71node link_device.js
72```
73
74This will:
751. Read the identity from the first device
762. Create a new device ID
773. Create a new identity for the second device that links to the first device's identity
784. Update the first device's identity to include the new device
79
80### Confirming a Device
81
82To confirm a device, run the `keet_cmd.js` script with the `--confirm-device` option:
83
84```bash
85node keet_cmd.js --confirm-device=device-id --storage=path-to-storage
86```
87
88Alternatively, you can manually update the identity files to set the `confirmed` status to `true` for the device.
89
90## Implementation Details
91
92The device linking functionality is implemented in the `link_device.js` script. The key steps are:
93
941. Read the first device's identity
952. Generate a new device ID
963. Create a new device entry
974. Create a new identity for the second device that links to the first device's identity
985. Update the first device's identity to include the new device
99
100The device confirmation functionality is implemented in the `keet_cmd.js` script. The key steps are:
101
1021. Find the device in the identity's devices array
1032. Set the device's `confirmed` status to `true`
1043. Update the identity file