@deepdockai/cli 1.5.0 → 1.6.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,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.6.0
|
|
4
|
+
|
|
5
|
+
- 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`.
|
|
6
|
+
|
|
3
7
|
## 1.5.0
|
|
4
8
|
|
|
5
9
|
- 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.
|
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.
|
|
11446
|
+
var VERSION = "1.6.0";
|
|
11447
11447
|
|
|
11448
11448
|
// src/runtime.ts
|
|
11449
11449
|
var DEFAULT_BASE_URL = "https://api.deepdock.ai";
|
package/package.json
CHANGED
package/skill/SKILL.md
CHANGED
|
@@ -23,9 +23,9 @@ integration against a demo device. It is not for building or changing actions: D
|
|
|
23
23
|
3. A device reports the **systems** it runs; each system has **actions**, deterministic operations
|
|
24
24
|
that Deepdock builds and verifies before offering them.
|
|
25
25
|
4. Every action takes a flat JSON body, never a value in the URL: `POST` for a read or create,
|
|
26
|
-
`PATCH` for an update. A **read** (the
|
|
27
|
-
action's `operation`) also takes `limit` and `cursor` in that body to page; a **write** (`create
|
|
28
|
-
or `
|
|
26
|
+
`PATCH` for an update, `DELETE` for a delete. A **read** (the
|
|
27
|
+
action's `operation`) also takes `limit` and `cursor` in that body to page; a **write** (`create`,
|
|
28
|
+
`update` or `delete`) needs an `Idempotency-Key` as well.
|
|
29
29
|
5. Every write needs an `Idempotency-Key`: a new key per intended write, the same key on every retry,
|
|
30
30
|
and a repeat answers the stored result with `Idempotent-Replayed: true`, writing nothing twice.
|
|
31
31
|
6. A write either fully applies or not: Deepdock checks its result before confirming, and a write
|
|
@@ -199,12 +199,13 @@ class Deepdock:
|
|
|
199
199
|
|
|
200
200
|
def write(self, device_id: str, system: str, action: str, operation: str, idempotency_key: str,
|
|
201
201
|
body: Dict[str, InputValue]) -> WriteResult:
|
|
202
|
-
"""Runs a write action: POST for operation "create", PATCH for "update" (from the action index; any
|
|
202
|
+
"""Runs a write action: POST for operation "create", PATCH for "update", DELETE for "delete" (inputs still go in the JSON body; from the action index; any
|
|
203
203
|
other method answers 405 with `Allow` naming the right one). `body` values are typed as the
|
|
204
204
|
action's schema declares. Any other `operation` raises ValueError before anything is sent."""
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
205
|
+
method = {"create": "POST", "update": "PATCH", "delete": "DELETE"}.get(operation)
|
|
206
|
+
if method is None:
|
|
207
|
+
raise ValueError(f"operation must be 'create', 'update' or 'delete', got {operation!r}")
|
|
208
|
+
data, headers, _ = self._send(method,
|
|
208
209
|
self._action_path(device_id, system, action), json=body,
|
|
209
210
|
headers={"Idempotency-Key": idempotency_key})
|
|
210
211
|
return WriteResult(data=data, replayed=headers.get("Idempotent-Replayed") == "true")
|
|
@@ -52,8 +52,13 @@ export type Page<Item> = { items: Item[]; nextCursor: string | null }
|
|
|
52
52
|
export type WriteResult<T> = { data: T; replayed: boolean }
|
|
53
53
|
/** A flat JSON value as the action's schema declares it: a number is a number, never its text. */
|
|
54
54
|
export type InputValue = string | number | boolean
|
|
55
|
-
/** What a write action does, from `operation` in the action index: a create is POST, an update PATCH. */
|
|
56
|
-
export type WriteOperation = 'create' | 'update'
|
|
55
|
+
/** What a write action does, from `operation` in the action index: a create is POST, an update PATCH, a delete DELETE. */
|
|
56
|
+
export type WriteOperation = 'create' | 'update' | 'delete'
|
|
57
|
+
const WRITE_METHOD: Record<WriteOperation, 'POST' | 'PATCH' | 'DELETE'> = {
|
|
58
|
+
create: 'POST',
|
|
59
|
+
update: 'PATCH',
|
|
60
|
+
delete: 'DELETE',
|
|
61
|
+
}
|
|
57
62
|
export type ActionInput = Record<string, InputValue>
|
|
58
63
|
|
|
59
64
|
/** `missing`: never found on the PC; `vanished`: found once and not any more. */
|
|
@@ -382,7 +387,7 @@ export class Deepdock {
|
|
|
382
387
|
}
|
|
383
388
|
|
|
384
389
|
/**
|
|
385
|
-
* Runs a write action: POST for a `create`, PATCH for an `update
|
|
390
|
+
* Runs a write action: POST for a `create`, PATCH for an `update`, DELETE for a `delete` (the inputs still go in the JSON body). Take `operation` from the
|
|
386
391
|
* action index; any other method answers 405 with `Allow` naming the right one. `input` values
|
|
387
392
|
* are typed as the action's schema declares. `idempotencyKey` is new per intended write and the
|
|
388
393
|
* same on every retry.
|
|
@@ -396,7 +401,7 @@ export class Deepdock {
|
|
|
396
401
|
input: ActionInput,
|
|
397
402
|
): Promise<WriteResult<Result>> {
|
|
398
403
|
const { data, headers } = await this.send<Result>(this.actionPath(deviceId, system, action), {
|
|
399
|
-
method: operation
|
|
404
|
+
method: WRITE_METHOD[operation],
|
|
400
405
|
headers: { 'Content-Type': 'application/json', 'Idempotency-Key': idempotencyKey },
|
|
401
406
|
body: JSON.stringify(input),
|
|
402
407
|
})
|
|
@@ -145,7 +145,7 @@ curl -sS -X DELETE "$BASE/v1/devices/$DEVICE" -H "$AUTH"
|
|
|
145
145
|
|
|
146
146
|
A port in another language keeps the clients' shape: one `send` that sets the bearer header,
|
|
147
147
|
parses the envelope, throws a typed error with `code` on `{ error }` and a transport error on no
|
|
148
|
-
answer or non-JSON; `read` as a POST with `limit` and `cursor` in the body; `write` (POST for a create, PATCH for an update) with `Idempotency-Key` and the
|
|
148
|
+
answer or non-JSON; `read` as a POST with `limit` and `cursor` in the body; `write` (POST for a create, PATCH for an update, DELETE for a delete) with `Idempotency-Key` and the
|
|
149
149
|
`Idempotent-Replayed` header; `attempt` over a persisted pending write.
|
|
150
150
|
|
|
151
151
|
## Mapping the user's intent to a call (checklist)
|
|
@@ -153,7 +153,7 @@ answer or non-JSON; `read` as a POST with `limit` and `cursor` in the body; `wri
|
|
|
153
153
|
1. Which device? From your product's configuration for that customer site; never from the
|
|
154
154
|
user's free text.
|
|
155
155
|
2. Is the action active? `systems()` once per session; show paused features as paused.
|
|
156
|
-
3. Which action and operation (create is POST, update is PATCH)? From the stored index for that system.
|
|
156
|
+
3. Which action and operation (create is POST, update is PATCH, delete is DELETE)? From the stored index for that system.
|
|
157
157
|
4. Does the write need a reference (author user, open case, record id)? Read it first.
|
|
158
158
|
5. Build the input in the types the schema declares; validate against the schema (`pattern`, `minLength`, `maxLength`,
|
|
159
159
|
`enum`) before sending so the user sees the rule where they typed.
|