diff --git a/.vitepress/cache/deps/_metadata.json b/.vitepress/cache/deps/_metadata.json index 6d4fb98..0f00fd7 100644 --- a/.vitepress/cache/deps/_metadata.json +++ b/.vitepress/cache/deps/_metadata.json @@ -1,25 +1,25 @@ { - "hash": "88a47dfe", - "configHash": "a8dc593e", + "hash": "3aa292d4", + "configHash": "703c54b0", "lockfileHash": "a4491b5f", - "browserHash": "46f34afb", + "browserHash": "63173ae2", "optimized": { "vue": { "src": "../../../node_modules/vue/dist/vue.runtime.esm-bundler.js", "file": "vue.js", - "fileHash": "fee14db9", + "fileHash": "1b86ce01", "needsInterop": false }, "vitepress > @vue/devtools-api": { "src": "../../../node_modules/@vue/devtools-api/dist/index.js", "file": "vitepress___@vue_devtools-api.js", - "fileHash": "0775ba1f", + "fileHash": "03d0fb89", "needsInterop": false }, "vitepress > @vueuse/core": { "src": "../../../node_modules/@vueuse/core/dist/index.js", "file": "vitepress___@vueuse_core.js", - "fileHash": "59ed147d", + "fileHash": "b5805c48", "needsInterop": false } }, diff --git a/.vitepress/config.mts b/.vitepress/config.mts index c301208..84dcc89 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -30,7 +30,8 @@ export default defineConfig({ { text: 'Discoveries', items: [ - { text: 'Jibo Workshop HRI 2024', link: '/Discoveries/jibohri' } + { text: 'Jibo Workshop HRI 2024', link: '/Discoveries/jibohri' }, + { text: 'jibo-app.js', link: '/jibo-app' } ] }, { diff --git a/docs/jibo-app.md b/docs/jibo-app.md new file mode 100644 index 0000000..b8ae397 --- /dev/null +++ b/docs/jibo-app.md @@ -0,0 +1,264 @@ +# jibo-app +::: warning +This was written by AI. This is for a script that is private. +::: + +A Node.js command-line interface for interacting with the Jibo robot's cloud services. It wraps the `@jibo/jibo-server-client` SDK and exposes every API endpoint — account management, loop (family group) management, media, messaging (Jot), robot provisioning, encryption keys, OTA updates, and more — as individual sub-commands. + + + +## Prerequisites + +- **Node.js** v6 or later +- npm dependencies installed (`npm install` in the parent project) + + + +## Credentials Setup + +Every command requires three credentials: + +| Field | Description | +|---|---| +| `region` | Server region slug, e.g. `alpha-entrypoint` or `stg1-entrypoint` | +| `accessKeyId` | AWS-style access key ID | +| `secretAccessKey` | AWS-style secret access key | + +Credentials are resolved in the following priority order (highest wins): + +### 1. Command-line flags +``` +-s, --serverRegion +-i, --accessKeyId (must be paired with -k) +-k, --secretAccessKey (must be paired with -i) +``` + +### 2. Environment variables +```bash +export JIBO_SERVER_REGION=alpha-entrypoint +export JIBO_ACCESS_KEY_ID=YOUR_ACCESS_KEY_ID +export JIBO_SECRET_ACCESS_KEY=YOUR_SECRET_ACCESS_KEY +``` + +### 3. Credentials file (default) + +By default the script reads `~/.jibo/credentials.json`. Create it like so: + +```bash +mkdir -p ~/.jibo +cat > ~/.jibo/credentials.json <<'EOF' +{ + "region": "alpha-entrypoint", + "accessKeyId": "YOUR_ACCESS_KEY_ID", + "secretAccessKey": "YOUR_SECRET_ACCESS_KEY" +} +EOF +chmod 600 ~/.jibo/credentials.json +``` + +You can point to a different file with `-f `, or disable file loading entirely with `-f ""` (then rely on env vars or flags). + +> **Tip:** After running `AccountLogin` or `LoopGetRobot` you can capture the credentials output and write them directly to a file with the `-w ` flag. + + + +## Running the script + +```bash +node jibo-app.js [global options] [command args...] +``` + +Print the help/command list: + +```bash +node jibo-app.js help +``` + + + +## Global Options + +| Flag | Description | +|---|---| +| `-f, --credentialsFile ` | Path to credentials JSON file (default: `~/.jibo/credentials.json`) | +| `-s, --serverRegion ` | Override server region | +| `-k, --secretAccessKey ` | Secret access key (pair with `-i`) | +| `-i, --accessKeyId ` | Access key ID (pair with `-k`) | +| `-e, --env` | Suppress informational logs; print output as `export VAR=value` shell lines | +| `-w, --credentialsFile ` | Write returned credentials to a JSON file (`AccountLogin` / `LoopGetRobot` only) | + + + +## Commands + +### Account + +| Command | Arguments | Description | +|---|---|---| +| `SyncCredentials` | ` [robotId]` | Log in and push credentials directly to a robot over the local network (WiFi or hard-wired at `172.24.84.101`) | +| `AccountCreate` | ` [firstName] [lastName] [gender] [birthday]` | Create a new Jibo account | +| `AccountLogin` | ` ` | Log in and print credentials (use `-e -w` to capture them) | +| `AccountCreateAccessToken` | `` | Create an access token scoped to a loop | +| `AccountActivateByCode` | `` | Activate an account with an email verification code | +| `AccountAdminActivateById` | `` | Admin: activate an account by ID | +| `AccountRemove` | | Delete the authenticated account | +| `AccountUpdate` | `[firstName] [lastName] [email] [gender] [birthday] [messagingAllowed] [password]` | Update account profile fields | +| `AccountUpdatePhoto` | `` | Upload a new profile photo | +| `AccountRemovePhoto` | | Remove the profile photo | +| `AccountGet` | `[ids...]` | Fetch one or more accounts by ID | +| `AccountGetAccountByAccessToken` | `` | Look up an account by access token | +| `AccountSearch` | `` | Search for accounts | + +### Loop + +A *Loop* is a family/household group that links an owner account to a Jibo robot. + +| Command | Arguments | Description | +|---|---|---| +| `LoopList` | `[loopId]` | List loops (or a specific loop); with `-e` prints `export JIBO_LOOP_ID=...` | +| `LoopCreate` | ` ` | Create a new loop | +| `LoopUpdate` | ` ` | Rename a loop | +| `LoopRemove` | `` | Delete a loop | +| `LoopListMembers` | `[statusList] [typeList]` | List members of the authenticated account's loop | +| `LoopInviteMember` | ` ` | Invite someone to a loop by email | +| `LoopAcceptInvitation` | `` | Accept a pending loop invitation | +| `LoopDeclineInvitation` | `` | Decline a pending loop invitation | +| `LoopRemoveMember` | ` ` | Remove a member from a loop | +| `LoopFindOwner` | `` | Find the loop owned by an account | +| `LoopGetRobot` | `` | Get robot credentials for a loop; use `-e -w` to capture | +| `LoopListOwnerRobots` | `` | List all robots owned by an account | +| `LoopClearRobot` | `` | Disassociate a robot from its loop | +| `LoopUpdateNickname` | ` ` | Set a member's nickname in a loop | +| `LoopUpdatePhoneticName` | ` [phoneticName]` | Set a member's phonetic name in a loop | +| `LoopSuspendLoop` | `` | Suspend a loop | + +### Media + +| Command | Arguments | Description | +|---|---|---| +| `MediaCreate` | ` [filename] [path] [type] [reference] [isEncrypted]` | Upload a media file to a loop | +| `MediaGet` | `` | Fetch metadata for one or more media items by path | +| `MediaList` | `` | List all media items across one or more loops | +| `MediaRemove` | `` | Delete one or more media items | + +### Jot (Messaging) + +| Command | Arguments | Description | +|---|---|---| +| `JotCreateMessage` | ` [content] [path] [type] [reference] [url] [tags...]` | Post a message to a loop | +| `JotListMessages` | ` [after] [before]` | List messages in a loop (supports date-range filtering) | +| `JotMarkLoopRead` | `` | Mark all messages in a loop as read | +| `JotMarkRead` | `` | Mark specific messages as read | +| `JotNumberOfUnreadMessagesInLoops` | `` | Get unread message counts for loops | + +### Robot + +| Command | Arguments | Description | +|---|---|---| +| `RobotGetRobot` | ` [serialNumber]` | Fetch robot details | +| `RobotGetRobotHistory` | ` [serialNumber]` | Fetch robot history | +| `RobotUpdateRobot` | ` ` | Update a robot property | +| `RobotUpdateLocationOverride` | ` ` | Override robot location | +| `RobotUpdateLocationOverrideClear` | `` | Clear robot location override | +| `RobotAdminCreateRobot` | ` ` | Admin: register a new robot | + +### OOBE (Out-of-Box Experience) + +| Command | Arguments | Description | +|---|---|---| +| `OOBEPrepareRobot` | `` | Prepare a robot for first-time setup | +| `OOBESetupRobot` | ` ` | Complete robot first-time setup | + +### Key Management + +| Command | Arguments | Description | +|---|---|---| +| `KeyShouldCreate` | `` | Check whether an encryption key should be created | +| `KeyRequestSymmetricKey` | `` | Request a symmetric encryption key | +| `KeyRestore` | ` [passwordHash]` | Restore an encryption key using a password (SHA-1 hashed internally) | +| `KeyListIncomingRequests` | `` | List incoming key requests | +| `KeyListBinaryRequests` | `` | List binary key requests | + +### Backup + +| Command | Arguments | Description | +|---|---|---| +| `BackupList` | `` | List backups for a loop | + +### Person + +| Command | Arguments | Description | +|---|---|---| +| `PersonListHolidays` | `` | List holidays for loop members | + +### Log Admin + +| Command | Arguments | Description | +|---|---|---| +| `LogAdminSetLevel` | ` ` | Set log level for specific robot services. Level: `error\|warn\|info\|verbose\|debug\|silly` | +| `LogAdminSetLevelFromFile` | ` ` | Same as above but reads `friendlyIds` from a file (one per line, `#` for comments) | + +### ROM (Remote Operations Manager) + +| Command | Arguments | Description | +|---|---|---| +| `ROMCreate` | `` | Create a ROM entry for a robot | +| `ROMSetupClient` | `` | Set up a ROM client | +| `ROMSetupServer` | `` | Set up a ROM server | + +### OTA (Over-the-Air Updates) + +| Command | Arguments | Description | +|---|---|---| +| `SetOTATarget` | ` ` | Assign an OTA update target filter to a robot (alphanumeric only) | +| `ClearOTATarget` | `` | Clear the OTA update target filter for a robot | +| `UpdateGetUpdateFrom` | ` [filter]` | Query available update for a subsystem/version | + +### OAuth Clients Admin + +| Command | Arguments | Description | +|---|---|---| +| `OauthClientsAdminListClients` | | List all OAuth clients | +| `OauthClientsAdminCreate` | ` ...` | *(Not yet implemented)* | +| `OauthClientsAdminRemove` | `` | *(Not yet implemented)* | +| `OauthClientsAdminUpdate` | `[clientId] [aco] ...` | *(Not yet implemented)* | + + + +## Examples + +```bash +# Log in and save credentials to file +node jibo-app.js -s alpha-entrypoint -i MY_KEY_ID -k MY_SECRET \ + AccountLogin user@example.com mypassword -w ~/.jibo/credentials.json + +# List loops, printing loop ID as an env var +node jibo-app.js -e LoopList + +# Sync credentials to a robot named "jibo-abc123" on the local network +node jibo-app.js SyncCredentials user@example.com mypassword jibo-abc123 + +# Upload a photo to a loop +node jibo-app.js MediaCreate LOOP_ID photo.jpg /photos/photo.jpg image/jpeg + +# Post a text message to a loop +node jibo-app.js JotCreateMessage LOOP_ID "Hello from CLI" + +# Set log level on specific robot services +node jibo-app.js LogAdminSetLevel debug my-service-id another-service-id + +# Set OTA target for a robot +node jibo-app.js SetOTATarget ABC123456 release +``` + + + +## Credentials file format + +```json +{ + "region": "alpha-entrypoint", + "accessKeyId": "YOUR_ACCESS_KEY_ID", + "secretAccessKey": "YOUR_SECRET_ACCESS_KEY" +} +```