@deepdockai/cli 1.6.0 → 1.6.1

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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.1
4
+
5
+ - The bundled skill covers pairing a test device and setting up its database access, by the client's window or from an administrator shell on the partner's own test PC (`--admin pairing-code`, `--admin consent`, `--admin setup`, with their exit codes). The recipe gains a step that sets up the access and polls until the system's `access` is `ok`, and the skill names each client button in German and English ("Zugang einrichten" Set up access, "Erneut einrichten" Set up again, "Zugang erneut einrichten" Set up access again, "Anmeldung erneuern" Renew sign-in). No command, field or error code changed.
6
+
3
7
  ## 1.6.0
4
8
 
5
9
  - The current device API: an action's `operation` in the action index can be `delete`, run with `DELETE` (the inputs go in the JSON body, as for `PATCH`; a write still needs an `Idempotency-Key`). The bundled TypeScript and Python clients and the skill accept it; before, the Python client refused `delete`.
package/dist/deepdock.js CHANGED
@@ -11443,7 +11443,7 @@ import { spawn } from "node:child_process";
11443
11443
  import { homedir, hostname } from "node:os";
11444
11444
 
11445
11445
  // src/version.ts
11446
- var VERSION = "1.6.0";
11446
+ var VERSION = "1.6.1";
11447
11447
 
11448
11448
  // src/runtime.ts
11449
11449
  var DEFAULT_BASE_URL = "https://api.deepdock.ai";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepdockai/cli",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "Deepdock partner CLI: pair devices, see systems and actions, create the API key your code runs them with.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/skill/SKILL.md CHANGED
@@ -43,29 +43,59 @@ and what your code does with the result.
43
43
  exits; show the human the link and wait for them to click Approve in the dashboard, then run
44
44
  `deepdock auth login --wait <request>`. You never see the resulting sign-in. Then pass
45
45
  `--org <slug>` on every command (`deepdock orgs list --json` shows the slugs).
46
- 2. **See what you have.** `deepdock systems list --json` (the systems and actions assigned to your
47
- organisation) and `deepdock devices list --json` (your paired devices). If the human has a demo
48
- device that is not yet paired, they read the code off its screen and you run
49
- `deepdock devices pair <code> --label "Demo"`.
50
- 3. **Fetch the schemas.** `deepdock systems openapi <system> --org <slug> > openapi/<system>.json`
46
+ 2. **See what you have, pair the test device.** `deepdock systems list --json` (the systems and
47
+ actions assigned to your organisation) and `deepdock devices list --json` (your paired devices).
48
+ To pair a new device, the human names it as their own test PC. Then either:
49
+ - **Screen:** ask the human to open the Deepdock client on that PC. Under "Client einrichten"
50
+ (Set up the client) it shows "Ihr Verbindungscode" (Your connection code), six characters such
51
+ as `K7Q-4MX`. Ask them for the code.
52
+ - **Shell:** only if you have an administrator shell on that test PC, read the code there with
53
+ `--admin pairing-code`
54
+ ([references/auth-and-keys.md](references/auth-and-keys.md#pairing-from-a-shell)). Never on a
55
+ customer's PC: there the screen path is the only one.
56
+
57
+ Then run `deepdock devices pair <code> --label "Demo" --org <slug> --json` straight away (the
58
+ code lives about 10 minutes and is replaced before it expires; the first claim wins) and keep the
59
+ device `id`. On `pairing_code_invalid`, get a fresh code.
60
+ 3. **Set up its access, then check it.** A paired device runs nothing until its database access is
61
+ set up. This is a one-time step on the PC, with a Windows administrator's approval, and it can
62
+ restart the program's database.
63
+ - **Screen:** tell the human: "In the Deepdock client, click **Zugang einrichten** (Set up
64
+ access). Read the notice, close the program on every workstation, tick that it is closed,
65
+ click **Weiter** (Continue) and confirm the Windows administrator prompt."
66
+ - **Shell** (test PC only): `--admin consent <system> --json`, show the human the notice and say
67
+ that the database may restart, ask that the program is closed on every workstation and wait
68
+ for their yes, then `--admin setup <system> <hash>`
69
+ ([references/auth-and-keys.md](references/auth-and-keys.md#pairing-from-a-shell)).
70
+
71
+ Check: from the moment the human confirms the setup is done (after the Windows administrator
72
+ prompt), or `--admin setup` exits 0, poll `deepdock devices list --json` (or
73
+ `GET /v1/devices/{id}`) every 10 seconds, for at most 1 minute, until the system's `access` is
74
+ `ok`. On timeout, ask the human what the client window shows. Then read the action states once
75
+ with `deepdock devices systems <deviceId> --json`. For `not_set_up`, `outdated`, `missing` and
76
+ `password_missing`, tell the human the matching button
77
+ ([references/concepts.md](references/concepts.md#every-status-value-and-what-it-means-for-you)).
78
+ Check `access` again after the client updates itself or new actions are assigned: `outdated`
79
+ means the human sets up again.
80
+ 4. **Fetch the schemas.** `deepdock systems openapi <system> --org <slug> > openapi/<system>.json`
51
81
  and read it; `deepdock actions list <deviceId> <system> --json` shows the same fields per device.
52
82
  Check the document into the repository and refresh it with the same command. Write code only for
53
83
  actions that appear both in the document and in `systems list`.
54
- 4. **Write the client.** A thin client in the project's own language: bearer header, envelope
84
+ 5. **Write the client.** A thin client in the project's own language: bearer header, envelope
55
85
  unwrap, idempotency header with replay detection, and an error-code switch. Read
56
86
  [references/calling-actions.md](references/calling-actions.md) and
57
87
  [references/example-integration.md](references/example-integration.md) first.
58
- 5. **Get a key into the app.** `deepdock keys create "<project> dev" --expires 30d --write-env
88
+ 6. **Get a key into the app.** `deepdock keys create "<project> dev" --expires 30d --write-env
59
89
  .env.local --org <slug> --json`, then `--wait <request>` once a human has clicked Approve in the
60
90
  dashboard. The CLI receives the key once, writes `DEEPDOCK_API_KEY=<key>` into that file (it
61
91
  must be ignored by git) and keeps no copy. It is displayed to you or to the human by nobody.
62
92
  You work only with the key's id, prefix and the file name. Never ask for, read, print or paste
63
93
  a key value. If the CLI runs with `DEEPDOCK_BASE_URL` set (a non-production API), it writes the
64
94
  same `DEEPDOCK_BASE_URL=<url>` line into that file too ([auth-and-keys.md](references/auth-and-keys.md)).
65
- 6. **Test it.** Run your own code against the demo device the human named, with the key from
95
+ 7. **Test it.** Run your own code against the demo device the human named, with the key from
66
96
  `.env.local`, and read back with the read action. The CLI runs no action. Read
67
97
  [references/testing.md](references/testing.md) before any write.
68
- 7. **Ship.** The human creates the production key the same way, from their own CLI, into the
98
+ 8. **Ship.** The human creates the production key the same way, from their own CLI, into the
69
99
  production secret store. Tell the human to revoke the development key.
70
100
 
71
101
  ## Rules that are not in the OpenAPI document
@@ -105,3 +105,42 @@ Successful pairings do not count against the limit; malformed codes are refused
105
105
 
106
106
  With the CLI: `deepdock devices pair <code> [--label <text>]`, `deepdock devices release <deviceId>`
107
107
  (admin).
108
+
109
+ ### Pairing from a shell
110
+
111
+ Only on the partner's own test PC, with an elevated administrator shell (an SSH session of an
112
+ administrator usually is; exit 2 below says yours is not). The program is Deepdock's unbranded build
113
+ `%ProgramFiles%\com.deepdock.client\Deepdock-Client.exe`; a branded build is
114
+ `%ProgramFiles%\com.deepdock.client.<slug>\<Name>-Client.exe`. A customer's PC goes the screen path:
115
+ a person there reads the access notice with the customer.
116
+
117
+ 1. `& "$env:ProgramFiles\com.deepdock.client\Deepdock-Client.exe" --admin pairing-code | Out-String; $LASTEXITCODE`.
118
+ The program opens no console of its own: pipe it as shown (then read `$LASTEXITCODE`), or
119
+ `$p = Start-Process <exe> -ArgumentList '--admin','pairing-code' -Wait -PassThru -NoNewWindow; $p.ExitCode`;
120
+ otherwise its output and exit code are lost. It prints `Pairing code: K7Q-4MX`; take the part
121
+ after the colon. Exit codes: 0 code printed; 2 your shell is not elevated; 3 refused (right
122
+ after an install: no code yet, retry in a minute); 4 the client's service is not running;
123
+ 5 already paired.
124
+ 2. `deepdock devices pair <code> --label "<label>" --org <slug> --json` straight away. The code is
125
+ short-lived (about 10 minutes, replaced before it expires, so claim it at once) and the first
126
+ claim wins. On `pairing_code_invalid`, run step 1 again for a fresh code.
127
+
128
+ **Set up the access** the same way, after pairing:
129
+
130
+ 1. `--admin consent <system> --json` until it exits 0. It prints
131
+ `{ system, hash, notice, noticeEn? }`. Exit 7 with `No target is held for <system>.`: the PC
132
+ has not received its targets yet, so wait a minute; if it persists, check the system name
133
+ against `deepdock systems list`. Exit 7 with `The stored targets cannot be read`: stop and
134
+ tell the human.
135
+ 2. Show the human the `notice` (or `noticeEn`) and say that the database may restart (always for
136
+ MEDICAL OFFICE; for SQL Server when your account is no SQL administrator). **Ask the human to
137
+ close the program on every workstation first** and wait for their yes.
138
+ 3. `--admin setup <system> <hash>`. Exit 6: the access changed since step 1, run consent again.
139
+ Exit 3: refused, the message names why. Then poll as in the recipe: every 10 seconds for at most
140
+ 1 minute from the exit 0, until the system's `access` is `ok` (`deepdock devices list --json`),
141
+ and ask the human what the client window shows on timeout. Then
142
+ `deepdock actions list <device> <system> --json`.
143
+
144
+ A system that needs a login (an HTTP system such as T2med) still needs the client's window for that
145
+ login: the credential is never accepted on a command line.
146
+
@@ -19,8 +19,8 @@ the API key the CLI wrote to the app's env file.
19
19
  | `orgs select [slug]` | sets the default organisation; without a slug, a pick-list on a terminal | member |
20
20
  | `systems list` | the systems and actions assigned to the organisation | member |
21
21
  | `systems openapi <system>` | the system's OpenAPI document on stdout; redirect it to a file | member |
22
- | `devices list` | paired devices with id, label, status, systems, last seen | member |
23
- | `devices pair <code> [--label <text>]` | pair a device by the code on its screen | member |
22
+ | `devices list` | paired devices with id, label, status, last seen, and each system with its access | member |
23
+ | `devices pair <code> [--label <text>]` | pair a device by the code on its screen, or the code `--admin pairing-code` prints on it (see [auth-and-keys.md](auth-and-keys.md#pairing-from-a-shell)) | member |
24
24
  | `devices rename <deviceId> <label>` | rename a device | member |
25
25
  | `devices release <deviceId>` | release a device (asks on a terminal; `--yes` otherwise) | admin |
26
26
  | `devices systems <deviceId>` | the device's live systems and action state, paused reasons included; `device_offline` is a normal answer | member |
@@ -84,7 +84,7 @@ A failure is one document on stderr: the API's error object unchanged plus what
84
84
  | 0 | done | |
85
85
  | 1 | something on the command line to fix | `invalid_usage` (a bad flag, an unknown slug, a question with no terminal and no `--yes`, an env file git does not ignore), `org_required` |
86
86
  | 2 | the API refused the request; do not repeat it unchanged | `invalid_request`, `not_found`, `device_not_found`, `pairing_code_invalid`, `other_partner_build`, `rate_limited`, `forbidden`, `conflict` and the other refusals (not `access_outdated` and `access_missing`, see exit 3) |
87
- | 3 | retry later (`access_outdated` and `access_missing`: after the customer repeats "Erneut einrichten" in the Deepdock client) | `device_offline`, `device_timeout`, `device_syncing`, `device_outdated`, `action_paused`, `access_outdated`, `access_missing`, `credentials_rejected`, `certificate_changed`, `system_unavailable`, `target_busy`, `temporarily_unavailable`, `internal_error`, `outcome_unknown`, `connection_lost` |
87
+ | 3 | retry later (`access_outdated` and `access_missing`: after the customer sets up the access again in the Deepdock client ("Zugang erneut einrichten", Set up access again)) | `device_offline`, `device_timeout`, `device_syncing`, `device_outdated`, `action_paused`, `access_outdated`, `access_missing`, `credentials_rejected`, `certificate_changed`, `system_unavailable`, `target_busy`, `temporarily_unavailable`, `internal_error`, `outcome_unknown`, `connection_lost` |
88
88
  | 4 | the CLI is too old for the API: run `npx @deepdockai/cli@latest` | `cli_outdated` |
89
89
  | 5 | sign-in needed: run `deepdock auth login` | `sign_in_needed`, `approval_denied`, `approval_expired` |
90
90
 
@@ -54,22 +54,22 @@ has a display `label` (may be `null`), a `version` the device reported (may be a
54
54
  | system `status` | `missing` | the device has never found the program on this PC | the PC does not run it; calls answer `system_unavailable` |
55
55
  | system `status` | `vanished` | the device found the program once and cannot find it now | check that it is still installed on that PC; calls answer `system_unavailable`; contact the site and Deepdock |
56
56
  | system `status` | `unknown` | the device could not tell whether the program runs (its probe failed or is unavailable on that PC) | do not read it as stopped; the device decides when a call arrives |
57
- | system `access` | `ok`, `outdated`, `missing`, `password_missing`, `not_set_up`, or `null` | the database access the device last reported (`null`: none known yet) | `outdated` refuses the actions that need the missing right with `access_outdated`, `missing` (the account cannot log in) and `password_missing` (the account exists but its stored password is not on the PC) refuse every action with `access_missing`; the customer repeats "Erneut einrichten" in the Deepdock client, the incident closes by itself once `access` is `ok`, nothing to resume |
57
+ | system `access` | `ok`, `outdated`, `missing`, `password_missing`, `not_set_up`, or `null` | the database access the device last reported (`null`: none known yet) | `outdated` refuses the actions that need the missing right with `access_outdated`, `missing` (the account cannot log in) and `password_missing` (the account exists but its stored password is not on the PC) refuse every action with `access_missing`; the customer chooses "Erneut einrichten" (Set up again) in the Deepdock client, the incident closes by itself once `access` is `ok`, nothing to resume |
58
58
  | system `accessLastCheckedAt` | ISO time or `null` | set when `access` is the last known value because the device could not read it (its database stopped or unreachable): when it last read it. `null` when the latest report read it | show the access as last known, with this time; nothing to do until the device reads it again |
59
59
  | system `versionIssue` | `not_installed`, `not_found`, `unreadable`, or `null` | why `version` is missing, when the device says: its database service is not on the PC, its program file was not found, or the file carries no readable version. `null` (absent on `GET .../systems`) with a version, and from a device that does not say | show the reason beside the missing version; there is nothing to do on your side |
60
- | system `lockedActions` (device list only) | list of action names or `null` | the actions blocked because the device's database account lacks a right they need, under its current action set; on `GET .../systems` they read `blocked` with `access_reapproval`. `null`: no verdict yet, or the verdict is for an older action set | do not offer a listed action as available; it answers `access_outdated` until the customer repeats "Erneut einrichten" |
60
+ | system `lockedActions` (device list only) | list of action names or `null` | the actions blocked because the device's database account lacks a right they need, under its current action set; on `GET .../systems` they read `blocked` with `access_reapproval`. `null`: no verdict yet, or the verdict is for an older action set | do not offer a listed action as available; it answers `access_outdated` until the customer chooses "Zugang erneut einrichten" (Set up access again) |
61
61
  | system `blockedActions` | list of action names, or absent | the actions this device's Deepdock client cannot run yet, because they need something only a newer client can do. Absent: none | do not offer a listed action as available; a call answers `device_outdated` and nothing runs, until the client updates itself and the action leaves the list |
62
62
  | action state | `active` | the action can be called | normal |
63
63
  | action state | `paused` | the action is paused with a `reason` and `pausedAt` | calls answer `action_paused`; show the feature as paused, poll `GET .../systems` at a low rate |
64
64
  | action state | `blocked` | the action cannot run on this device until its `reason` is resolved; one reason per action, the first that applies in the order below | do not offer it as available |
65
65
  | block `reason` | `client_update` | the device's Deepdock client is too old for this action | calls answer `device_outdated`; the client updates itself |
66
- | block `reason` | `access_missing` | the database access is gone (the account cannot log in, or its password is missing) | calls answer `access_missing`; the customer sets up the access again ("Erneut einrichten") |
67
- | block `reason` | `access_not_set_up` | no database access is set up on this device | calls answer `action_not_configured`; the customer sets up the access ("Erneut einrichten") |
68
- | block `reason` | `access_reapproval` | the database access lacks a right this action needs | calls answer `access_outdated`; the customer repeats "Erneut einrichten" |
66
+ | block `reason` | `access_missing` | the database access is gone (the account cannot log in, or its password is missing) | calls answer `access_missing`; the customer sets up the access again ("Erneut einrichten", Set up again) |
67
+ | block `reason` | `access_not_set_up` | no database access is set up on this device | calls answer `action_not_configured`; the customer sets up the access ("Zugang einrichten", Set up access) |
68
+ | block `reason` | `access_reapproval` | the database access lacks a right this action needs | calls answer `access_outdated`; the customer chooses "Zugang erneut einrichten" (Set up access again) |
69
69
  | pause `reason` | `structure_changed` | the system changed in a way the action depends on (for example a vendor update); Deepdock reviews and resumes | wait; nothing to do on your side |
70
70
  | pause `reason` | `readback_failed` | a write's result did not match, so nothing was saved | wait; tell the user the change was not saved |
71
- | pause `reason` | `credentials_rejected` | the program no longer accepts the sign-in the device stored for it (for example a changed password) | tell the user to choose "Anmeldung erneuern" in the Deepdock client; the action resumes by itself once the new sign-in works, nothing to resume |
72
- | pause `reason` | `certificate_changed` | the program's server certificate is not the one the device accepted at sign-in | tell the user to choose "Anmeldung erneuern" in the Deepdock client, compare the fingerprint it shows and sign in again; the action resumes by itself, nothing to resume |
71
+ | pause `reason` | `credentials_rejected` | the program no longer accepts the sign-in the device stored for it (for example a changed password) | tell the user to choose "Anmeldung erneuern" (Renew sign-in) in the Deepdock client; the action resumes by itself once the new sign-in works, nothing to resume |
72
+ | pause `reason` | `certificate_changed` | the program's server certificate is not the one the device accepted at sign-in | tell the user to choose "Anmeldung erneuern" (Renew sign-in) in the Deepdock client, compare the fingerprint it shows and sign in again; the action resumes by itself, nothing to resume |
73
73
  | pause `reason` | `system_stopped`, `system_missing` | as the system statuses above; these need no resume and clear when the system is back | as above |
74
74
 
75
75
  Switch on these values; any value you do not know is shown as it is.
@@ -37,7 +37,7 @@ with the **same** `Idempotency-Key`); **Show** says what the end user should see
37
37
  | `system_not_on_device` | 404 | the device did not report this system and none of its actions are assigned to you; `error.systems` lists what it has | no | configuration problem; show which systems the device has |
38
38
  | `action_not_found` | 404 | the system has no such action, it is not assigned to you, or the device's client is too old to run it | no | hide the feature; ask Deepdock for the assignment or let the device update |
39
39
  | `action_not_configured` | 409 | the action exists but this device is not set up for it yet (for example a missing device-side setting); nothing was run | no, until set up on site | "this feature needs setting up at the customer site; contact Deepdock" |
40
- | `access_outdated` | 409 | the device's database access lacks a right this action needs (only the actions that need it). Nothing was run. **No `Retry-After`** | no, until the customer repeats "Erneut einrichten" in the Deepdock client; then yes, a write with the same key | "the customer must set up database access again in the Deepdock client, then we retry" |
40
+ | `access_outdated` | 409 | the device's database access lacks a right this action needs (only the actions that need it). Nothing was run. **No `Retry-After`** | no, until the customer chooses "Zugang erneut einrichten" (Set up access again) in the Deepdock client; then yes, a write with the same key | "the customer must set up database access again in the Deepdock client, then we retry" |
41
41
  | `access_missing` | 409 | the device's database access is gone (a removed database account or a lost secret on the PC); every action of that system is refused. Nothing was run. **No `Retry-After`** | as `access_outdated` | as `access_outdated` |
42
42
  | `pairing_code_invalid` | 404 | pairing: the code is unknown, expired, replaced, used, or its device is offline | with a fresh code | "read the code off the device screen again" |
43
43
  | `other_partner_build` | 409 | pairing: the device runs another partner's client build | no | "this device is set up for another provider" |
@@ -131,7 +131,7 @@ const REACTION: Record<string, Reaction> = {
131
131
  const reactionFor = (code: string): Reaction => REACTION[code] ?? 'stop'
132
132
  ```
133
133
 
134
- Action-specific 422 codes beyond the ones above (any the OpenAPI description lists) map to `fix-input`. Add them from the document, not from memory. `wait-setup` means a person at the customer must act in the Deepdock client first: repeat the database access setup ("Erneut einrichten") for `access_*`, renew the login for `credentials_rejected`, confirm the new certificate for `certificate_changed`; there is no `Retry-After`, so do not loop. Check `access` on the system in `GET .../systems` (`ok` again), then retry; a write keeps its key. `retry-same-key` means the
134
+ Action-specific 422 codes beyond the ones above (any the OpenAPI description lists) map to `fix-input`. Add them from the document, not from memory. `wait-setup` means a person at the customer must act in the Deepdock client first: repeat the database access setup ("Zugang einrichten" (Set up access) or "Erneut einrichten" (Set up again)) for `access_*`, renew the login for `credentials_rejected`, confirm the new certificate for `certificate_changed`; there is no `Retry-After`, so do not loop. Check `access` on the system in `GET .../systems` (`ok` again), then retry; a write keeps its key. `retry-same-key` means the
135
135
  pending write stays persisted and is retried from that state with backoff, also across process
136
136
  restarts; a device can be offline for hours, so the retry loop lives in a job or queue, not in the
137
137
  request that started the write.
@@ -10,6 +10,7 @@ gets written to. These rules are not optional.
10
10
  data on it.
11
11
  - **Never run a write against a device the human has not named as the test device.** If no device
12
12
  has been named, ask. Do not pick the first device from `devices list`; it may be a live customer.
13
+ - Pairing and access setup from a shell are for this device only ([auth-and-keys.md](auth-and-keys.md#pairing-from-a-shell)).
13
14
  - Pin the demo device's UUID in an environment variable (`DEEPDOCK_TEST_DEVICE`) and refuse to run
14
15
  tests without it.
15
16