@deepdockai/cli 1.4.1 → 1.5.0

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,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.5.0
4
+
5
+ - The current device API: in `GET /v1/devices/{deviceId}/systems` an action is `active`, `paused` or `blocked`, and a blocked one carries a `reason` (`client_update`, `access_missing`, `access_not_set_up`, `access_reapproval`). The list now holds every action of yours on that system, blocked ones included. A system there no longer carries `lockedActions` (the device list still does), and the action index's `availability` value is `blocked_pending_access` (was `locked_pending_access`). The bundled TypeScript client and the skill describe the new states.
6
+ - `deepdock devices systems` counts blocked actions next to paused ones.
7
+ - The error code list gains `device_timeout` (exit 3, retry with the same key) and `too_many_rows` (exit 2: the write matched more records than it may change and was rolled back).
8
+
3
9
  ## 1.4.1
4
10
 
5
11
  - The package no longer ships Python bytecode from the bundled client.
package/README.md CHANGED
@@ -154,14 +154,14 @@ your code will receive; `auth`, `orgs select` and `keys create` build it from na
154
154
  failure is one document on stderr, `{ "error": { "code", "message" }, "meta": { "hint" } }`,
155
155
  with the API's error object unchanged. Switch on `code` or on the exit code, never on `message`.
156
156
 
157
- | Exit | Meaning |
158
- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
159
- | 0 | done |
160
- | 1 | something on the command line to fix (`invalid_usage`, `org_required`) |
161
- | 2 | the API refused the request; do not repeat it unchanged (`invalid_request`, `not_found`, `forbidden`, `rate_limited` and the other refusals) |
162
- | 3 | retry later (`device_offline`, `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`) |
163
- | 4 | the CLI is too old for the API (`cli_outdated`): run `npx @deepdockai/cli@latest` |
164
- | 5 | sign-in needed (`sign_in_needed`, `approval_denied`, `approval_expired`); `auth status` when nobody is signed in |
157
+ | Exit | Meaning |
158
+ | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
159
+ | 0 | done |
160
+ | 1 | something on the command line to fix (`invalid_usage`, `org_required`) |
161
+ | 2 | the API refused the request; do not repeat it unchanged (`invalid_request`, `not_found`, `forbidden`, `rate_limited` and the other refusals) |
162
+ | 3 | retry later (`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`) |
163
+ | 4 | the CLI is too old for the API (`cli_outdated`): run `npx @deepdockai/cli@latest` |
164
+ | 5 | sign-in needed (`sign_in_needed`, `approval_denied`, `approval_expired`); `auth status` when nobody is signed in |
165
165
 
166
166
  The CLI never retries on its own: exit 3 says retry, you decide when. `deepdock commands --json`
167
167
  prints the whole command tree.
package/dist/deepdock.js CHANGED
@@ -10874,9 +10874,11 @@ var EXIT_CODES = {
10874
10874
  record_locked: 2,
10875
10875
  record_not_editable: 2,
10876
10876
  record_restricted: 2,
10877
+ too_many_rows: 2,
10877
10878
  payload_too_large: 2,
10878
10879
  version_not_covered: 2,
10879
10880
  device_offline: 3,
10881
+ device_timeout: 3,
10880
10882
  device_syncing: 3,
10881
10883
  device_outdated: 3,
10882
10884
  action_paused: 3,
@@ -11441,7 +11443,7 @@ import { spawn } from "node:child_process";
11441
11443
  import { homedir, hostname } from "node:os";
11442
11444
 
11443
11445
  // src/version.ts
11444
- var VERSION = "1.4.1";
11446
+ var VERSION = "1.5.0";
11445
11447
 
11446
11448
  // src/runtime.ts
11447
11449
  var DEFAULT_BASE_URL = "https://api.deepdock.ai";
@@ -12170,7 +12172,7 @@ var EXIT_CODES_HELP = `Exit codes
12170
12172
  0 done
12171
12173
  1 usage: something on the command line to fix (invalid_usage, org_required)
12172
12174
  2 the API refused the request; do not repeat it unchanged
12173
- 3 retry later (device_offline, device_syncing, device_outdated,
12175
+ 3 retry later (device_offline, device_timeout, device_syncing, device_outdated,
12174
12176
  action_paused, access_outdated, access_missing,
12175
12177
  credentials_rejected, certificate_changed,
12176
12178
  system_unavailable, target_busy, temporarily_unavailable, internal_error,
@@ -12977,14 +12979,13 @@ var renderSystems = (ctx, data) => {
12977
12979
  if (text === "")
12978
12980
  return "The device reports no systems.";
12979
12981
  const paused = countValue(data, "paused");
12980
- if (paused === 0)
12981
- return text;
12982
- return [
12983
- text,
12984
- paused === 1 ? "One action is paused." : `${paused} actions are paused.`,
12985
- "Only Deepdock resumes it; `deepdock incidents list` shows the incident.",
12986
- "Your code gets 503 action_paused from it until then."
12987
- ].join(`
12982
+ const blocked = countValue(data, "blocked");
12983
+ const lines = [text];
12984
+ if (paused > 0)
12985
+ lines.push(paused === 1 ? "One action is paused." : `${paused} actions are paused.`, "Only Deepdock resumes it; `deepdock incidents list` shows the incident.", "Your code gets 503 action_paused from it until then.");
12986
+ if (blocked > 0)
12987
+ lines.push(blocked === 1 ? "One action is blocked." : `${blocked} actions are blocked.`, "Its reason says what unblocks it: a client update or the customer setting up the access.");
12988
+ return lines.join(`
12988
12989
  `);
12989
12990
  };
12990
12991
  var systemsOf = async (ctx, id) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepdockai/cli",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
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",
@@ -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_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 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` |
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
 
@@ -236,7 +236,7 @@ class Deepdock:
236
236
 
237
237
  CONFLICT_RETRIES = 5 # a running write finishes within seconds; beyond this, treat it as unknown
238
238
 
239
- RETRY_SAME_KEY = {"device_offline", "device_syncing", "device_outdated",
239
+ RETRY_SAME_KEY = {"device_offline", "device_timeout", "device_syncing", "device_outdated",
240
240
  "target_busy", "temporarily_unavailable", "internal_error", "action_paused",
241
241
  "system_unavailable"}
242
242
 
@@ -103,6 +103,11 @@ export type ActionState =
103
103
  reason: 'structure_changed' | 'readback_failed' | 'credentials_rejected' | 'certificate_changed'
104
104
  pausedAt: string
105
105
  }
106
+ | {
107
+ action: string
108
+ state: 'blocked'
109
+ reason: 'client_update' | 'access_missing' | 'access_not_set_up' | 'access_reapproval'
110
+ }
106
111
 
107
112
  export type DeviceSystem = {
108
113
  system: string
@@ -113,8 +118,6 @@ export type DeviceSystem = {
113
118
  access: SystemAccess
114
119
  /** Set when `access` is the last known value (the device could not read it): when it last did. */
115
120
  accessLastCheckedAt: string | null
116
- /** Actions the device reports locked because its database account lacks a right they need; `null` when there is no verdict for its current action set. */
117
- lockedActions: string[] | null
118
121
  actions: ActionState[]
119
122
  /** The connectors the device runs for this system, by name and kind. */
120
123
  connectors: { name: string; kind: 'database' | 'http' }[]
@@ -452,6 +455,7 @@ export const CONFLICT_RETRIES = 5
452
455
 
453
456
  const RETRY_SAME_KEY = new Set([
454
457
  'device_offline',
458
+ 'device_timeout',
455
459
  'device_syncing',
456
460
  'device_outdated',
457
461
  'target_busy',
@@ -57,10 +57,15 @@ has a display `label` (may be `null`), a `version` the device reported (may be a
57
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 |
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` | list of action names or `null` | the actions the device reports locked because its database account lacks a right they need, under its current action set. `null`: no verdict yet, or the verdict is for an older action set | do not offer a locked 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 repeats "Erneut einrichten" |
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
+ | 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
+ | 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" |
64
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 |
65
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 |
66
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 |
@@ -84,8 +89,8 @@ catalogue.
84
89
  `Idempotency-Key` header.
85
90
  - A write **either fully applies or not**: Deepdock checks the result before confirming, and if the check fails it saves nothing
86
91
  and pauses the action (`409 readback_failed`).
87
- - An action is **active** or **paused**. `GET /v1/devices/{deviceId}/systems` shows each action's
88
- state with `reason` and `pausedAt`.
92
+ - An action is **active**, **paused** or **blocked**. `GET /v1/devices/{deviceId}/systems` shows
93
+ each action's state: a paused one with `reason` and `pausedAt`, a blocked one with `reason`.
89
94
 
90
95
  ## Pause and incident
91
96
 
@@ -68,8 +68,10 @@ curl "$BASE/v1/devices/$DEVICE/systems" -H "Authorization: Bearer $DEEPDOCK_API_
68
68
  ```
69
69
 
70
70
  A live call to the device. A list; each entry has `system`, `label`, `version` (may be absent),
71
- `status`, `access` and `actions`, each with `action` and `state` (`active`, or `paused` with
72
- `reason` and `pausedAt`). Answers `503 device_offline` when the device is not
71
+ `status`, `access` and `actions`, each with `action` and `state`: `active`, `paused` with
72
+ `reason` and `pausedAt`, or `blocked` with `reason` (`client_update`, `access_missing`,
73
+ `access_not_set_up` or `access_reapproval`). `actions` lists every action of yours on that system,
74
+ including the blocked ones. Answers `503 device_offline` when the device is not
73
75
  connected: that is a normal state, not an error in your code. Do not poll it tightly; it reaches the
74
76
  customer's PC.
75
77
 
@@ -54,6 +54,7 @@ with the **same** `Idempotency-Key`); **Show** says what the end user should see
54
54
  | `record_locked` | 422 | the customer's system locks the record the write would change (for example one already finalised and closed). Nothing was written | no | "this record is locked in the customer's system" |
55
55
  | `record_not_editable` | 422 | the record is not locked but is stored in a form this action cannot edit (for example a note it cannot add to without rewriting it). Nothing was written | no | "this record cannot be edited through Deepdock" |
56
56
  | `record_restricted` | 422 | the customer's system restricts access to the record (for example a locked record): a read returned no data, so an empty answer would be wrong, and a write wrote nothing | no; the customer lifts the restriction in its system | "access to this record is restricted in the customer's system" |
57
+ | `too_many_rows` | 409 | the inputs match more records than this write may change; it was rolled back and nothing changed | no; narrow the inputs to the record you mean | "that matches more than one record; please be more specific" |
57
58
  | Action-specific refusals | 422 | an action can refuse with a code of its own (for example `unknown_author` when the write names a user the system does not list, or `no_matching_period`); its OpenAPI description names each such code and when it fires. Nothing was written | no; fix the reference or input | the missing precondition in the user's words |
58
59
 
59
60
  ## Device and system availability
@@ -61,6 +62,7 @@ with the **same** `Idempotency-Key`); **Show** says what the end user should see
61
62
  | Code | Status | Meaning | Retry | Show |
62
63
  |---|---|---|---|---|
63
64
  | `device_offline` | 503 | the device is not connected, is shutting down, did not answer within 20 s, or the call was cut off inside Deepdock by a restart or deploy. **A write may still have landed** | yes, with backoff (seconds to minutes); a write only with the same key | "the customer PC is offline; we will retry" |
65
+ | `device_timeout` | 503 | the device ran out of its time budget before it began the call or before it committed. Nothing was written | yes, with backoff; a write with the same key | "the customer PC was too slow; retrying" |
64
66
  | `device_syncing` | 503 | the device has not reported its Deepdock client yet (just paired, or its report did not come through); Deepdock asks it again. Nothing was written | yes, after `Retry-After` (5 s); a write with the same key | "the customer PC is connecting; retrying" |
65
67
  | `device_outdated` | 409 | the device's Deepdock client is too old for this call. It updates itself when a newer version is released for your organisation, once nobody is signed in on the PC. Nothing was written | after the update (on `GET /v1/devices/{deviceId}`, `outdated` turns `false` and the action leaves the system's `blockedActions`); retrying before it gets the same answer. A write keeps its key | "the Deepdock client on the customer PC needs an update" |
66
68
  | `version_not_covered` | 409 | the customer's installed version of the system is not yet approved by Deepdock for this action. Nothing was run. The message names the system, its version and the action | **no.** Retrying gets the same answer. It changes when Deepdock approves that version for the action, or when the customer runs an approved version | "this feature is not yet available for the customer's version of the software; Deepdock has to approve it first" |
@@ -105,12 +107,14 @@ const REACTION: Record<string, Reaction> = {
105
107
  record_locked: 'stop',
106
108
  record_not_editable: 'stop',
107
109
  record_restricted: 'stop',
110
+ too_many_rows: 'fix-input',
108
111
  payload_too_large: 'fix-code',
109
112
  access_outdated: 'wait-setup',
110
113
  access_missing: 'wait-setup',
111
114
  credentials_rejected: 'wait-setup',
112
115
  certificate_changed: 'wait-setup',
113
116
  device_offline: 'retry-same-key',
117
+ device_timeout: 'retry-same-key',
114
118
  device_syncing: 'retry-same-key',
115
119
  device_outdated: 'retry-later',
116
120
  version_not_covered: 'stop',