@deepdockai/cli 1.12.2 → 2.0.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,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.0.1
4
+
5
+ - **Breaking for code that uses the bundled clients:** The device field `claimedAt` is now
6
+ `pairedAt`. Update code that reads the field after copying the skill again.
7
+ - The API references and pinned OpenAPI document use `pairedAt` for the device timestamp.
8
+ CLI behaviour stays the same.
9
+
10
+ ## 2.0.0
11
+
12
+ - **Breaking:** CLI device records in `--json` output now use `pairedAt` in place of
13
+ `claimedAt`. Update scripts that read device records from the CLI to use the new field.
14
+ - When a table lists device fields by name, the pairing timestamp column is `PAIRED AT`.
15
+ - This release works before and after the API renames the field. Once the API serves
16
+ `pairedAt`, it will require CLI 2.0.0 or newer and return `cli_outdated` to older versions.
17
+
3
18
  ## 1.12.2
4
19
 
5
20
  - The errors reference: an `invalid_input` whose refusal the action itself declares may carry only a message, without `fields`, as the pinned `invalid_input` description says.
package/README.md CHANGED
@@ -149,16 +149,18 @@ On a terminal you get tables and plain sentences. When stdout is not a terminal,
149
149
 
150
150
  ```json
151
151
  {
152
- "data": { "...": "the API's data, unchanged" },
152
+ "data": { "...": "the command's result" },
153
153
  "meta": { "org": { "slug": "muster-it", "name": "Muster IT" }, "requestId": "..." }
154
154
  }
155
155
  ```
156
156
 
157
157
  `systems openapi` is the one exception off a terminal: it prints the OpenAPI document itself, so
158
158
  `deepdock systems openapi <system> > openapi.json` saves a document a generator can read (`--json`
159
- gives the envelope). For list and show commands `data` is the API's answer unchanged, so what the CLI shows is what
160
- your code will receive; `auth`, `orgs select`, `keys create`, `webhooks secret` and `webhooks rotate-secret` build it from named fields. A
161
- failure is one document on stderr, `{ "error": { "code", "message" }, "meta": { "hint" } }`,
159
+ gives the envelope). For list and show commands, `data` generally passes through the API response.
160
+ The API and the CLI's `devices list`, `devices pair` and `devices rename` commands use
161
+ `pairedAt` in device JSON. The CLI still accepts the old field name from an older API.
162
+ `auth`, `orgs select`, `keys create`, `webhooks secret` and `webhooks rotate-secret` build `data`
163
+ from named fields. A failure is one document on stderr, `{ "error": { "code", "message" }, "meta": { "hint" } }`,
162
164
  with the API's error object unchanged. Switch on `code` or on the exit code, never on `message`.
163
165
 
164
166
  | Exit | Meaning |
package/dist/deepdock.js CHANGED
@@ -10986,7 +10986,7 @@ var DEVICE_COLUMNS = [
10986
10986
  "clientVersion",
10987
10987
  "status",
10988
10988
  "lastSeenAt",
10989
- "claimedAt",
10989
+ "pairedAt",
10990
10990
  "updateAvailable",
10991
10991
  "systems"
10992
10992
  ];
@@ -11490,7 +11490,7 @@ import { spawn } from "node:child_process";
11490
11490
  import { homedir, hostname } from "node:os";
11491
11491
 
11492
11492
  // src/version.ts
11493
- var VERSION = "1.12.2";
11493
+ var VERSION = "2.0.1";
11494
11494
 
11495
11495
  // src/runtime.ts
11496
11496
  var DEFAULT_BASE_URL = "https://api.deepdock.ai";
@@ -12933,6 +12933,12 @@ var readAllPages = async (ctx, path, org) => {
12933
12933
 
12934
12934
  // src/commands/devices.ts
12935
12935
  var meta = (requestId) => requestId ? { requestId } : {};
12936
+ var normalizeDevice = (device) => {
12937
+ if (!isRecord(device))
12938
+ return device;
12939
+ const { claimedAt, pairedAt = claimedAt, ...record } = device;
12940
+ return { ...record, pairedAt };
12941
+ };
12936
12942
  var updateNotes = (ctx, devices) => {
12937
12943
  for (const device of devices.filter(isRecord)) {
12938
12944
  const update = field(device, "updateAvailable");
@@ -12943,7 +12949,8 @@ var updateNotes = (ctx, devices) => {
12943
12949
  }
12944
12950
  };
12945
12951
  var list = async (ctx) => {
12946
- const { items: devices, requestId } = await readAllPages(ctx, "/partner/devices");
12952
+ const { items, requestId } = await readAllPages(ctx, "/partner/devices");
12953
+ const devices = items.map(normalizeDevice);
12947
12954
  if (devices.length === 0) {
12948
12955
  return {
12949
12956
  data: devices,
@@ -12980,8 +12987,12 @@ var pair = async (ctx, code, label) => {
12980
12987
  lines.push(` Status: ${status}`);
12981
12988
  lines.push(` Systems: ${systemsLabel(device)}`);
12982
12989
  lines.push(`Next: \`deepdock devices systems ${id}\` shows its actions.`);
12983
- return { data: response.data, meta: meta(response.requestId), text: lines.join(`
12984
- `) };
12990
+ return {
12991
+ data: normalizeDevice(response.data),
12992
+ meta: meta(response.requestId),
12993
+ text: lines.join(`
12994
+ `)
12995
+ };
12985
12996
  };
12986
12997
  var rename = async (ctx, id, label) => {
12987
12998
  const deviceId = deviceIdArg(id);
@@ -12994,7 +13005,7 @@ var rename = async (ctx, id, label) => {
12994
13005
  body: { label }
12995
13006
  });
12996
13007
  return {
12997
- data: response.data,
13008
+ data: normalizeDevice(response.data),
12998
13009
  meta: meta(response.requestId),
12999
13010
  text: `${paint(ctx.out, "success", "Renamed")} device ${deviceId} to ${stripControl(label)}.`
13000
13011
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepdockai/cli",
3
- "version": "1.12.2",
3
+ "version": "2.0.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",
@@ -85,7 +85,7 @@ curl -X POST "$BASE/v1/devices" \
85
85
  ```
86
86
 
87
87
  `label` is optional, 1 to 100 characters. The device must be online. Answer: `201` with the device
88
- (`id`, `label`, `hostname`, `os`, `clientVersion`, `status`, `lastSeenAt`, `lastKnownAt`, `claimedAt`, `outdated`, `systems`,
88
+ (`id`, `label`, `hostname`, `os`, `clientVersion`, `status`, `lastSeenAt`, `lastKnownAt`, `pairedAt`, `outdated`, `systems`,
89
89
  and `updateAvailable` when it runs an older build); `clientVersion` is `null`
90
90
  until the device has reported it. Keep `id`: it is the `deviceId` of every later call.
91
91
  `GET /v1/devices` lists your devices a page at a time (`{ data: [...], nextCursor }`; pass `nextCursor` back as `cursor` until it is `null`, `limit` 1 to 500, default 100), and `GET /v1/devices/{deviceId}` reads one; each device has the same shape. `GET /v1/incidents` pages the same way.
@@ -19,7 +19,7 @@ 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, last seen, and each system with its access | member |
22
+ | `devices list` | paired devices with id, label, status, systems and last seen | member |
23
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 |
@@ -71,10 +71,12 @@ JSON is the default when stdout is not a terminal; pass `--json` to be sure. One
71
71
  stdout:
72
72
 
73
73
  ```json
74
- { "data": <the API's data, unchanged>, "meta": { "org": { "slug": "…", "name": "…" }, "requestId": "…" } }
74
+ { "data": <the command's result>, "meta": { "org": { "slug": "…", "name": "…" }, "requestId": "…" } }
75
75
  ```
76
76
 
77
- `data` is what the API answered, so what you see is what your code will receive. `meta` holds the
77
+ `data` generally passes through the API response. The API and the CLI's `devices list`,
78
+ `devices pair` and `devices rename` commands use `pairedAt` in device JSON. The CLI still
79
+ accepts the old field name from an older API. `meta` holds the
78
80
  organisation the command acted in, the request id, and, where it applies, `written` (`{ file,
79
81
  name }` from `keys create`) and `pending` (from `--no-wait`). `keys create` builds its `data` from
80
82
  id, name, prefix, createdAt and expiresAt; the key value is in neither stream. `webhooks secret` and
@@ -108,7 +108,7 @@ export type Device = {
108
108
  lastSeenAt: string | null
109
109
  /** While the device is not connected: when it last reported. `null` while connected. */
110
110
  lastKnownAt: string | null
111
- claimedAt: string | null
111
+ pairedAt: string | null
112
112
  /** True when an action assigned to you needs a newer client: that action answers device_outdated. */
113
113
  outdated: boolean
114
114
  updateAvailable?: string
@@ -24,8 +24,8 @@ Details: [auth-and-keys.md](auth-and-keys.md).
24
24
  The Deepdock client installed on the customer's Windows PC next to their system. It connects
25
25
  outwards to Deepdock; nothing in the customer's network is opened to the internet. A device is
26
26
  identified by a UUID (`id`), carries a `label`, `hostname`, `os`, `clientVersion`, `status`
27
- (`connected`, `offline` or `inactive`), `lastSeenAt`, `lastKnownAt`, `claimedAt` (may be `null`), `outdated` (an
28
- assigned action needs a newer client: it answers `device_outdated`) and the `systems` it reported (each with a `versionIssue` when `version` is missing, `blockedActions` when this device's client cannot run some actions yet: those answer `device_outdated` until the client updates, the others keep running, `execution` while the system is stopped, and `actions`: whether each of your actions on that system would be admitted now). An action whose system runs a program version Deepdock has not yet approved for it answers `version_not_covered`; nothing is sent to the system, and it works once Deepdock has approved that version.
27
+ (`connected`, `offline` or `inactive`), `lastSeenAt`, `lastKnownAt`, `pairedAt` (may be `null`),
28
+ `outdated` (an assigned action needs a newer client: it answers `device_outdated`) and the `systems` it reported (each with a `versionIssue` when `version` is missing, `blockedActions` when this device's client cannot run some actions yet: those answer `device_outdated` until the client updates, the others keep running, `execution` while the system is stopped, and `actions`: whether each of your actions on that system would be admitted now). An action whose system runs a program version Deepdock has not yet approved for it answers `version_not_covered`; nothing is sent to the system, and it works once Deepdock has approved that version.
29
29
 
30
30
  - **Pair**: take a device into your organisation with the 6-character code it shows while unpaired.
31
31
  - **Release**: `DELETE /v1/devices/{deviceId}` gives the device back; it shows a new code.