@deepdockai/cli 1.2.0 → 1.4.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 +10 -0
- package/README.md +30 -30
- package/dist/deepdock.js +31 -31
- package/package.json +1 -1
- package/skill/SKILL.md +2 -2
- package/skill/references/auth-and-keys.md +5 -5
- package/skill/references/calling-actions.md +2 -1
- package/skill/references/cli.md +11 -11
- package/skill/references/clients/__pycache__/deepdock.cpython-312.pyc +0 -0
- package/skill/references/clients/deepdock.py +6 -9
- package/skill/references/clients/deepdock.ts +14 -26
- package/skill/references/concepts.md +6 -3
- package/skill/references/discovery.md +1 -1
- package/skill/references/errors.md +6 -6
- package/skill/references/idempotency.md +1 -1
- package/skill/references/testing.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.4.0
|
|
4
|
+
|
|
5
|
+
- Device API format 11: the error code `system_version_unverified` and the error fields `version` and `reason` are gone, and a system's `writes` state in `GET /v1/devices/{deviceId}` is replaced by `blockedActions` (the actions this device's client cannot run yet; each answers `device_outdated` until the client updates). An action whose system runs a program version Deepdock has not yet approved for it answers the new `409 version_not_covered` (CLI exit 2): nothing ran, retrying gets the same answer, and it works once Deepdock approves that version or the customer runs an approved one. The bundled TypeScript and Python clients, the skill's error reference and the device types follow. This needs the API from the Deepdock release that carries these changes.
|
|
6
|
+
- `deepdock devices` and `deepdock incidents list` read the organisation's lists as `{ "data": [...], "nextCursor": ... }`, the form `/v1` already uses (was `{ "data": { "items": [...], "nextCursor": ... } }`). They need the API from the next Deepdock release; an older API answers the old form, which this version does not read.
|
|
7
|
+
- The CLI follows the API's British spelling and its renamed code: `GET /partner/organisations` (was `/partner/orgs`), the error code `organisation_required` (was `organization_required`) and `cli_outdated` (was `client_outdated`, still exit 4). The bundled device types and the skill's error reference include them. These need the API from the next Deepdock release.
|
|
8
|
+
- The command group `org` is now `orgs` (`deepdock orgs list`, `deepdock orgs select`); the old name is gone, with no alias.
|
|
9
|
+
- A device is named `<deviceId>` in every usage string, help text, the README and the bundled skill (`devices rename|release|systems <deviceId>`, `actions list <deviceId> <system>`).
|
|
10
|
+
- The README and the bundled skill advise reusing one HTTP connection for calls (keep-alive), because a fresh connection can hit a cold start.
|
|
11
|
+
- The docs, the bundled skill and the device API pin say "pair" for taking a device into your organisation (was "claim"); the `rate_limited` and `pairing_code_invalid` texts follow, and `requestId` is described as present on every error body. Field names and error codes are unchanged (`claimedAt` stays).
|
|
12
|
+
|
|
3
13
|
## 1.2.0
|
|
4
14
|
|
|
5
15
|
- Every `/v1` answer uses one `data` envelope. A list (a `many` action read, `GET /v1/devices`) answers `{ "data": [...], "nextCursor": ... }` (was `{ "data": { "items": [...], "nextCursor": ... } }`); `nextCursor` sits beside `data` and appears only on a list that pages. A single-record read (`cardinality: one`) answers `{ "data": { ...record } }` and a record that is not found answers `404 not_found`. Writes and error bodies are unchanged.
|
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ Signed in as anna.mueller@muster-it.example.
|
|
|
48
48
|
Choose the organisation to work in, then look around:
|
|
49
49
|
|
|
50
50
|
```bash
|
|
51
|
-
deepdock
|
|
51
|
+
deepdock orgs select muster-it # the default for every later command
|
|
52
52
|
deepdock devices list # paired devices, their status and systems
|
|
53
53
|
deepdock systems list # the systems and actions assigned to you
|
|
54
54
|
deepdock systems openapi example-erp > example-erp.openapi.json
|
|
@@ -82,29 +82,29 @@ knowledge into your coding agent.
|
|
|
82
82
|
deepdock auth login | status | logout
|
|
83
83
|
deepdock org list | select [slug]
|
|
84
84
|
deepdock systems list | openapi <system>
|
|
85
|
-
deepdock devices list | pair <code> | rename <
|
|
86
|
-
deepdock actions list <
|
|
85
|
+
deepdock devices list | pair <code> | rename <deviceId> <label> | release <deviceId> | systems <deviceId>
|
|
86
|
+
deepdock actions list <deviceId> <system>
|
|
87
87
|
deepdock keys list | create <name> | revoke <id>
|
|
88
88
|
deepdock incidents list
|
|
89
89
|
deepdock skill
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
| Command
|
|
93
|
-
|
|
|
94
|
-
| `auth login`
|
|
95
|
-
| `auth status`
|
|
96
|
-
| `auth logout [--keep-keys]`
|
|
97
|
-
| `
|
|
98
|
-
| `systems list`
|
|
99
|
-
| `systems openapi <system>`
|
|
100
|
-
| `devices list`
|
|
101
|
-
| `devices pair <code> [--label <text>]`
|
|
102
|
-
| `devices rename <
|
|
103
|
-
| `devices systems <
|
|
104
|
-
| `actions list <
|
|
105
|
-
| `keys list`, `keys create <name>`, `keys revoke <id>`
|
|
106
|
-
| `incidents list`
|
|
107
|
-
| `skill [--agent claude\|codex\|cursor\|all]`
|
|
92
|
+
| Command | What it does |
|
|
93
|
+
| ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
94
|
+
| `auth login` | sign in as yourself, approved in the browser; the sign-in lasts 90 days |
|
|
95
|
+
| `auth status` | who is signed in, the organisations, and the keys this CLI created (id, name, prefix, expiry, file; never the value); exits 5 when not signed in, like `gh auth status` |
|
|
96
|
+
| `auth logout [--keep-keys]` | revoke the sign-in and every key this CLI created (`--keep-keys`: only the sign-in) |
|
|
97
|
+
| `orgs list`, `orgs select [slug]` | your organisations; set the default one |
|
|
98
|
+
| `systems list` | the systems and actions assigned to your organisation |
|
|
99
|
+
| `systems openapi <system>` | a system's OpenAPI document on stdout, bare when redirected; save it to a file |
|
|
100
|
+
| `devices list` | paired devices with id, label, status, systems and last seen |
|
|
101
|
+
| `devices pair <code> [--label <text>]` | pair a device by the code on its screen |
|
|
102
|
+
| `devices rename <deviceId> <label>`, `devices release <deviceId>` | rename a device; unpair it from the organisation (admin) |
|
|
103
|
+
| `devices systems <deviceId>` | a device's live systems and action state, paused reasons included |
|
|
104
|
+
| `actions list <deviceId> <system>` | every action a device offers, with its operation and fields |
|
|
105
|
+
| `keys list`, `keys create <name>`, `keys revoke <id>` | the organisation's API keys (create and revoke: admin) |
|
|
106
|
+
| `incidents list` | open incidents, and those closed within the last 30 days |
|
|
107
|
+
| `skill [--agent claude\|codex\|cursor\|all]` | install the agent skill into the current directory |
|
|
108
108
|
|
|
109
109
|
Global flags: `--org <slug>` and `--json` on every command, `--yes` to confirm `devices release`
|
|
110
110
|
and `keys revoke` without a question, `-h, --help` everywhere and `-v, --version` at the root.
|
|
@@ -112,7 +112,7 @@ and `keys revoke` without a question, `-h, --help` everywhere and `-v, --version
|
|
|
112
112
|
|
|
113
113
|
Two things are never guessed. A device is always named by its full id: no default device, no
|
|
114
114
|
lookup by label. The organisation comes from `--org`, then `DEEPDOCK_ORG`, then the default
|
|
115
|
-
chosen with `deepdock
|
|
115
|
+
chosen with `deepdock orgs select`. With exactly one organisation it is used without asking (and
|
|
116
116
|
named on stderr); with several and none chosen the command stops and lists them.
|
|
117
117
|
|
|
118
118
|
## The approval flow
|
|
@@ -150,18 +150,18 @@ On a terminal you get tables and plain sentences. When stdout is not a terminal,
|
|
|
150
150
|
`systems openapi` is the one exception off a terminal: it prints the OpenAPI document itself, so
|
|
151
151
|
`deepdock systems openapi <system> > openapi.json` saves a document a generator can read (`--json`
|
|
152
152
|
gives the envelope). For list and show commands `data` is the API's answer unchanged, so what the CLI shows is what
|
|
153
|
-
your code will receive; `auth`, `
|
|
153
|
+
your code will receive; `auth`, `orgs select` and `keys create` build it from named fields. A
|
|
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`, `
|
|
163
|
-
| 4 | the CLI is too old for the API (`
|
|
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_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.
|
|
@@ -173,7 +173,7 @@ Deepdock model (organisation, API key, device, system, action), the recipe from
|
|
|
173
173
|
tested integration, how to read the OpenAPI document instead of guessing field names, writes
|
|
174
174
|
with `Idempotency-Key`, every error code and whether to retry it, and the rule that it never
|
|
175
175
|
asks for, reads or prints an API key value. It ships with reference clients in TypeScript and
|
|
176
|
-
Python.
|
|
176
|
+
Python. Calls are fastest over one reused HTTP connection (keep-alive), because a fresh connection can hit a cold start.
|
|
177
177
|
|
|
178
178
|
```bash
|
|
179
179
|
deepdock skill # all three agents
|
package/dist/deepdock.js
CHANGED
|
@@ -10848,7 +10848,7 @@ var program = new Command;
|
|
|
10848
10848
|
var EXIT_CODES = {
|
|
10849
10849
|
invalid_usage: 1,
|
|
10850
10850
|
org_required: 1,
|
|
10851
|
-
|
|
10851
|
+
organisation_required: 1,
|
|
10852
10852
|
invalid_request: 2,
|
|
10853
10853
|
forbidden: 2,
|
|
10854
10854
|
partner_not_approved: 2,
|
|
@@ -10875,10 +10875,10 @@ var EXIT_CODES = {
|
|
|
10875
10875
|
record_not_editable: 2,
|
|
10876
10876
|
record_restricted: 2,
|
|
10877
10877
|
payload_too_large: 2,
|
|
10878
|
+
version_not_covered: 2,
|
|
10878
10879
|
device_offline: 3,
|
|
10879
10880
|
device_syncing: 3,
|
|
10880
10881
|
device_outdated: 3,
|
|
10881
|
-
system_version_unverified: 3,
|
|
10882
10882
|
action_paused: 3,
|
|
10883
10883
|
access_outdated: 3,
|
|
10884
10884
|
access_missing: 3,
|
|
@@ -10890,7 +10890,7 @@ var EXIT_CODES = {
|
|
|
10890
10890
|
internal_error: 3,
|
|
10891
10891
|
outcome_unknown: 3,
|
|
10892
10892
|
connection_lost: 3,
|
|
10893
|
-
|
|
10893
|
+
cli_outdated: 4,
|
|
10894
10894
|
unauthenticated: 5,
|
|
10895
10895
|
sign_in_needed: 5,
|
|
10896
10896
|
approval_denied: 5,
|
|
@@ -11259,7 +11259,7 @@ var actionRow = (action) => {
|
|
|
11259
11259
|
};
|
|
11260
11260
|
var registerActions = (program, run) => {
|
|
11261
11261
|
const actions = program.command("actions").description("List a device's actions and their fields");
|
|
11262
|
-
actions.command("list").description("List the actions a device offers for a system, with every field").argument("<
|
|
11262
|
+
actions.command("list").description("List the actions a device offers for a system, with every field").argument("<deviceId>", "the full device id").argument("<system>", "the system name").action((device, system, _options, cmd) => run(cmd, async (ctx) => {
|
|
11263
11263
|
const deviceId = deviceIdArg(device);
|
|
11264
11264
|
const name = systemArg(system);
|
|
11265
11265
|
const response = await ctx.callInOrg({
|
|
@@ -11441,7 +11441,7 @@ import { spawn } from "node:child_process";
|
|
|
11441
11441
|
import { homedir, hostname } from "node:os";
|
|
11442
11442
|
|
|
11443
11443
|
// src/version.ts
|
|
11444
|
-
var VERSION = "1.
|
|
11444
|
+
var VERSION = "1.4.0";
|
|
11445
11445
|
|
|
11446
11446
|
// src/runtime.ts
|
|
11447
11447
|
var DEFAULT_BASE_URL = "https://api.deepdock.ai";
|
|
@@ -11600,7 +11600,7 @@ var createApi = (rt) => {
|
|
|
11600
11600
|
status: response.status
|
|
11601
11601
|
});
|
|
11602
11602
|
}
|
|
11603
|
-
return { data: json.data, requestId: headerRequestId };
|
|
11603
|
+
return { data: json.data, nextCursor: json.nextCursor, requestId: headerRequestId };
|
|
11604
11604
|
};
|
|
11605
11605
|
return { request, latest: () => latest };
|
|
11606
11606
|
};
|
|
@@ -11677,7 +11677,7 @@ var resolveOrg = (requested, orgs, fromStoredDefault = false) => {
|
|
|
11677
11677
|
throw new CliError({
|
|
11678
11678
|
code: "org_required",
|
|
11679
11679
|
message: "No organisation chosen.",
|
|
11680
|
-
hint: "Pass --org <slug> or run `deepdock
|
|
11680
|
+
hint: "Pass --org <slug> or run `deepdock orgs select`.",
|
|
11681
11681
|
organisations: slugs
|
|
11682
11682
|
});
|
|
11683
11683
|
}
|
|
@@ -11686,7 +11686,7 @@ var resolveOrg = (requested, orgs, fromStoredDefault = false) => {
|
|
|
11686
11686
|
throw new CliError({
|
|
11687
11687
|
code: "invalid_usage",
|
|
11688
11688
|
message: `You are not a member of an organisation with the slug "${requested}".`,
|
|
11689
|
-
hint: fromStoredDefault ? "That is your stored default. Run `deepdock
|
|
11689
|
+
hint: fromStoredDefault ? "That is your stored default. Run `deepdock orgs select` to choose another." : undefined,
|
|
11690
11690
|
organisations: slugs
|
|
11691
11691
|
});
|
|
11692
11692
|
}
|
|
@@ -12029,7 +12029,7 @@ var createContext = (rt, opts) => {
|
|
|
12029
12029
|
const current = await config();
|
|
12030
12030
|
if (!refresh && current.organisations)
|
|
12031
12031
|
return current.organisations;
|
|
12032
|
-
const response = await ctx.call({ method: "GET", path: "/partner/
|
|
12032
|
+
const response = await ctx.call({ method: "GET", path: "/partner/organisations" });
|
|
12033
12033
|
const orgs = await parseAnswer("orgs", response.data);
|
|
12034
12034
|
await ctx.update((config) => {
|
|
12035
12035
|
config.organisations = orgs;
|
|
@@ -12057,7 +12057,7 @@ var createContext = (rt, opts) => {
|
|
|
12057
12057
|
try {
|
|
12058
12058
|
return await ctx.call({ ...req, org: org.slug });
|
|
12059
12059
|
} catch (error) {
|
|
12060
|
-
if (error instanceof CliError && error.code === "
|
|
12060
|
+
if (error instanceof CliError && error.code === "organisation_required") {
|
|
12061
12061
|
const refreshed = await ctx.organisations(true);
|
|
12062
12062
|
const current = await config();
|
|
12063
12063
|
const requested = requestedSlug(opts.org, rt.env, current);
|
|
@@ -12087,7 +12087,7 @@ Commands
|
|
|
12087
12087
|
skill Install the Deepdock skill for your coding agent
|
|
12088
12088
|
|
|
12089
12089
|
Global flags
|
|
12090
|
-
--org <slug> The organisation to act in (default: DEEPDOCK_ORG, then \`deepdock
|
|
12090
|
+
--org <slug> The organisation to act in (default: DEEPDOCK_ORG, then \`deepdock orgs select\`)
|
|
12091
12091
|
--json JSON output (the default when stdout is not a terminal)
|
|
12092
12092
|
--yes Answer the confirmation question of release and revoke with yes
|
|
12093
12093
|
-h, --help Help for a command
|
|
@@ -12107,7 +12107,7 @@ var AUTH_LOGIN_HELP = `Sign in to Deepdock as yourself.
|
|
|
12107
12107
|
|
|
12108
12108
|
Opens a link to the Deepdock dashboard. There you click Approve, and this CLI receives a
|
|
12109
12109
|
sign-in valid for 90 days. The sign-in is yours, not an organisation's: afterwards you choose
|
|
12110
|
-
an organisation with --org or \`deepdock
|
|
12110
|
+
an organisation with --org or \`deepdock orgs select\`.
|
|
12111
12111
|
|
|
12112
12112
|
The sign-in manages devices, keys and settings and lists what a device offers. It never runs
|
|
12113
12113
|
an action; actions run from your code with an API key (\`deepdock keys create\`).
|
|
@@ -12171,18 +12171,18 @@ var EXIT_CODES_HELP = `Exit codes
|
|
|
12171
12171
|
1 usage: something on the command line to fix (invalid_usage, org_required)
|
|
12172
12172
|
2 the API refused the request; do not repeat it unchanged
|
|
12173
12173
|
3 retry later (device_offline, device_syncing, device_outdated,
|
|
12174
|
-
|
|
12174
|
+
action_paused, access_outdated, access_missing,
|
|
12175
12175
|
credentials_rejected, certificate_changed,
|
|
12176
12176
|
system_unavailable, target_busy, temporarily_unavailable, internal_error,
|
|
12177
12177
|
outcome_unknown, connection_lost)
|
|
12178
|
-
4 the CLI is too old for the API (
|
|
12178
|
+
4 the CLI is too old for the API (cli_outdated)
|
|
12179
12179
|
5 sign-in needed (sign_in_needed, approval_denied, approval_expired; auth status when nobody is signed in)
|
|
12180
12180
|
|
|
12181
12181
|
With --json (or off a terminal) a failure is one JSON document on stderr:
|
|
12182
12182
|
{ "error": { "code", "message" }, "meta": { "hint" } }. Switch on \`code\`, never on \`message\`.
|
|
12183
12183
|
`;
|
|
12184
12184
|
var EXAMPLES = {
|
|
12185
|
-
"
|
|
12185
|
+
"orgs select": ["deepdock orgs select muster-it"],
|
|
12186
12186
|
"devices pair": ['deepdock devices pair K7Q-4MX --label "Demo PC"'],
|
|
12187
12187
|
"devices release": ["deepdock devices release 450c3f0e-7a1b-4c2d-9e8f-1a2b3c4d5e6f --yes"],
|
|
12188
12188
|
"actions list": ["deepdock actions list 450c3f0e-7a1b-4c2d-9e8f-1a2b3c4d5e6f example-erp"],
|
|
@@ -12578,7 +12578,7 @@ var finishLogin = async (ctx, pending) => {
|
|
|
12578
12578
|
if (sole && only.length === 1 && config.defaultOrg === sole.slug) {
|
|
12579
12579
|
lines.push(`${paint(ctx.out, "success", "Selected")} ${sole.name} (${sole.slug}) as your organisation.`);
|
|
12580
12580
|
} else {
|
|
12581
|
-
lines.push("Choose one with `deepdock
|
|
12581
|
+
lines.push("Choose one with `deepdock orgs select <slug>` or pass --org to each command.");
|
|
12582
12582
|
}
|
|
12583
12583
|
}
|
|
12584
12584
|
return {
|
|
@@ -12652,7 +12652,7 @@ var status = async (ctx) => {
|
|
|
12652
12652
|
let requestId;
|
|
12653
12653
|
if (config.signIn && Date.parse(config.signIn.expiresAt) > ctx.rt.now().getTime()) {
|
|
12654
12654
|
try {
|
|
12655
|
-
const response = await ctx.call({ method: "GET", path: "/partner/
|
|
12655
|
+
const response = await ctx.call({ method: "GET", path: "/partner/organisations" });
|
|
12656
12656
|
const orgs = await parseAnswer("orgs", response.data);
|
|
12657
12657
|
await ctx.update((current) => {
|
|
12658
12658
|
current.organisations = orgs;
|
|
@@ -12682,7 +12682,7 @@ var status = async (ctx) => {
|
|
|
12682
12682
|
if (baseUrl !== DEFAULT_BASE_URL)
|
|
12683
12683
|
lines.push(ctx.out("yellow", `API: ${baseUrl} (not production)`));
|
|
12684
12684
|
if (data.organisations.length > 0) {
|
|
12685
|
-
lines.push("", "Organisations:", indented(orgTable(data.organisations, defaultOrg, ctx.out)), "", defaultOrg ? "Switch the default with `deepdock
|
|
12685
|
+
lines.push("", "Organisations:", indented(orgTable(data.organisations, defaultOrg, ctx.out)), "", defaultOrg ? "Switch the default with `deepdock orgs select <slug>`." : "No default yet: choose one with `deepdock orgs select <slug>`.");
|
|
12686
12686
|
}
|
|
12687
12687
|
} else {
|
|
12688
12688
|
lines.push(config.signIn ? "Your sign-in has expired. Run `deepdock auth login`." : "Not signed in. Run `deepdock auth login`.");
|
|
@@ -12859,13 +12859,13 @@ var readAllPages = async (ctx, path, org) => {
|
|
|
12859
12859
|
query.set("cursor", cursor);
|
|
12860
12860
|
const url = `${path}?${query.toString()}`;
|
|
12861
12861
|
const response = org ? await ctx.call({ method: "GET", path: url, org }) : await ctx.callInOrg({ method: "GET", path: url });
|
|
12862
|
-
const
|
|
12863
|
-
if (!
|
|
12862
|
+
const rows = response.data;
|
|
12863
|
+
if (!Array.isArray(rows))
|
|
12864
12864
|
throw unreadable();
|
|
12865
|
-
const next =
|
|
12865
|
+
const next = response.nextCursor;
|
|
12866
12866
|
if (next !== null && (typeof next !== "string" || next === ""))
|
|
12867
12867
|
throw unreadable();
|
|
12868
|
-
items.push(...
|
|
12868
|
+
items.push(...rows);
|
|
12869
12869
|
requestId ??= response.requestId;
|
|
12870
12870
|
if (next === null)
|
|
12871
12871
|
return { items, requestId };
|
|
@@ -13003,9 +13003,9 @@ var registerDevices = (program, run) => {
|
|
|
13003
13003
|
const devices = program.command("devices").description("Pair, list, rename and release devices");
|
|
13004
13004
|
devices.command("list").description("List the devices paired to the organisation").action((_options, cmd) => run(cmd, list));
|
|
13005
13005
|
devices.command("pair").description("Pair a device with the code shown on its screen").argument("<code>", "the pairing code").option("--label <text>", "a label for the device, 1 to 100 characters").action((code, options, cmd) => run(cmd, (ctx) => pair(ctx, code, options.label)));
|
|
13006
|
-
devices.command("rename").description("Change a device's label").argument("<
|
|
13007
|
-
devices.command("release").description("Release a device from the organisation (admin)").argument("<
|
|
13008
|
-
devices.command("systems").description("Show the systems a device runs and the state of their actions").argument("<
|
|
13006
|
+
devices.command("rename").description("Change a device's label").argument("<deviceId>", "the full device id").argument("<label>", "the new label, 1 to 100 characters").action((id, label, _options, cmd) => run(cmd, (ctx) => rename(ctx, id, label)));
|
|
13007
|
+
devices.command("release").description("Release a device from the organisation (admin)").argument("<deviceId>", "the full device id").action((id, _options, cmd) => run(cmd, (ctx) => release(ctx, id)));
|
|
13008
|
+
devices.command("systems").description("Show the systems a device runs and the state of their actions").argument("<deviceId>", "the full device id").action((id, _options, cmd) => run(cmd, (ctx) => systemsOf(ctx, id)));
|
|
13009
13009
|
};
|
|
13010
13010
|
|
|
13011
13011
|
// src/commands/incidents.ts
|
|
@@ -13235,7 +13235,7 @@ var registerKeys = (program, run) => {
|
|
|
13235
13235
|
|
|
13236
13236
|
// src/commands/org.ts
|
|
13237
13237
|
var list3 = async (ctx) => {
|
|
13238
|
-
const response = await ctx.call({ method: "GET", path: "/partner/
|
|
13238
|
+
const response = await ctx.call({ method: "GET", path: "/partner/organisations" });
|
|
13239
13239
|
const orgs = await parseAnswer("orgs", response.data);
|
|
13240
13240
|
const config = await ctx.update((current) => {
|
|
13241
13241
|
current.organisations = orgs;
|
|
@@ -13244,7 +13244,7 @@ var list3 = async (ctx) => {
|
|
|
13244
13244
|
const text = orgs.length === 0 ? "You are not a member of an organisation yet." : [
|
|
13245
13245
|
orgTable(orgs, defaultOrg, ctx.out),
|
|
13246
13246
|
"",
|
|
13247
|
-
"Switch the default with `deepdock
|
|
13247
|
+
"Switch the default with `deepdock orgs select <slug>`."
|
|
13248
13248
|
].join(`
|
|
13249
13249
|
`);
|
|
13250
13250
|
return {
|
|
@@ -13254,7 +13254,7 @@ var list3 = async (ctx) => {
|
|
|
13254
13254
|
};
|
|
13255
13255
|
};
|
|
13256
13256
|
var select = async (ctx, slug) => {
|
|
13257
|
-
const response = await ctx.call({ method: "GET", path: "/partner/
|
|
13257
|
+
const response = await ctx.call({ method: "GET", path: "/partner/organisations" });
|
|
13258
13258
|
const orgs = await parseAnswer("orgs", response.data);
|
|
13259
13259
|
const choices = selectableOrgs(orgs);
|
|
13260
13260
|
const config = await ctx.config();
|
|
@@ -13265,7 +13265,7 @@ var select = async (ctx, slug) => {
|
|
|
13265
13265
|
throw new CliError({
|
|
13266
13266
|
code: "invalid_usage",
|
|
13267
13267
|
message: "Choosing an organisation without a slug needs a terminal.",
|
|
13268
|
-
hint: "Pass the slug: `deepdock
|
|
13268
|
+
hint: "Pass the slug: `deepdock orgs select <slug>`.",
|
|
13269
13269
|
organisations: slugs
|
|
13270
13270
|
});
|
|
13271
13271
|
}
|
|
@@ -13301,7 +13301,7 @@ var select = async (ctx, slug) => {
|
|
|
13301
13301
|
};
|
|
13302
13302
|
};
|
|
13303
13303
|
var registerOrg = (program, run) => {
|
|
13304
|
-
const org = program.command("
|
|
13304
|
+
const org = program.command("orgs").description("List your organisations and choose the default one");
|
|
13305
13305
|
org.command("list").description("List the organisations you belong to").action((_options, cmd) => run(cmd, list3));
|
|
13306
13306
|
org.command("select").description("Choose the default organisation (a pick-list on a terminal without a slug)").argument("[slug]", "the organisation slug").action((slug, _options, cmd) => run(cmd, (ctx) => select(ctx, slug)));
|
|
13307
13307
|
};
|
|
@@ -13660,7 +13660,7 @@ var runCli = async (argv, rt) => {
|
|
|
13660
13660
|
return 0;
|
|
13661
13661
|
}
|
|
13662
13662
|
const cliError = toCliError(error, program, argv);
|
|
13663
|
-
if (cliError.code === "
|
|
13663
|
+
if (cliError.code === "cli_outdated") {
|
|
13664
13664
|
cliError.hint = `Run \`npx @deepdockai/cli@latest ${argv.join(" ")}\`.`;
|
|
13665
13665
|
}
|
|
13666
13666
|
const json = state.ctx?.json ?? wantsJson(rt, argv.includes("--json"));
|
package/package.json
CHANGED
package/skill/SKILL.md
CHANGED
|
@@ -42,13 +42,13 @@ and what your code does with the result.
|
|
|
42
42
|
1. **Sign in.** `deepdock auth login --json`: without a terminal the CLI prints the request and
|
|
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
|
-
`--org <slug>` on every command (`deepdock
|
|
45
|
+
`--org <slug>` on every command (`deepdock orgs list --json` shows the slugs).
|
|
46
46
|
2. **See what you have.** `deepdock systems list --json` (the systems and actions assigned to your
|
|
47
47
|
organisation) and `deepdock devices list --json` (your paired devices). If the human has a demo
|
|
48
48
|
device that is not yet paired, they read the code off its screen and you run
|
|
49
49
|
`deepdock devices pair <code> --label "Demo"`.
|
|
50
50
|
3. **Fetch the schemas.** `deepdock systems openapi <system> --org <slug> > openapi/<system>.json`
|
|
51
|
-
and read it; `deepdock actions list <
|
|
51
|
+
and read it; `deepdock actions list <deviceId> <system> --json` shows the same fields per device.
|
|
52
52
|
Check the document into the repository and refresh it with the same command. Write code only for
|
|
53
53
|
actions that appear both in the document and in `systems list`.
|
|
54
54
|
4. **Write the client.** A thin client in the project's own language: bearer header, envelope
|
|
@@ -75,7 +75,7 @@ sent to a new site as is. The pairing code is what ties the device to your organ
|
|
|
75
75
|
`ABCDEFGHJKMNPQRSTVWXYZ23456789`. Case and the dash do not matter.
|
|
76
76
|
2. A code is valid for 10 minutes and is replaced shortly before it expires: read it off the screen
|
|
77
77
|
when you pair.
|
|
78
|
-
3.
|
|
78
|
+
3. Pair it:
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
81
|
curl -X POST "$BASE/v1/devices" \
|
|
@@ -98,10 +98,10 @@ Pairing answers:
|
|
|
98
98
|
|---|---|---|
|
|
99
99
|
| `invalid_request` | 400 | the code is malformed; fix the input |
|
|
100
100
|
| `pairing_code_invalid` | 404 | unknown, expired, replaced, already used, or the device is offline; ask for a fresh code |
|
|
101
|
-
| `other_partner_build` | 409 | the device runs another partner's branded client; only that partner can
|
|
102
|
-
| `rate_limited` | 429 | more than 5 failed
|
|
101
|
+
| `other_partner_build` | 409 | the device runs another partner's branded client; only that partner can pair it |
|
|
102
|
+
| `rate_limited` | 429 | more than 5 failed pairing attempts in 60 seconds with this key; wait up to a minute |
|
|
103
103
|
|
|
104
|
-
Successful
|
|
104
|
+
Successful pairings do not count against the limit; malformed codes are refused before counting.
|
|
105
105
|
|
|
106
|
-
With the CLI: `deepdock devices pair <code> [--label <text>]`, `deepdock devices release <
|
|
106
|
+
With the CLI: `deepdock devices pair <code> [--label <text>]`, `deepdock devices release <deviceId>`
|
|
107
107
|
(admin).
|
|
@@ -145,6 +145,7 @@ Never invent an id, copy one from another device, or hard-code one from a test r
|
|
|
145
145
|
|
|
146
146
|
- Every action call is sent to the customer's PC and run there. Expect a read to take from a few
|
|
147
147
|
hundred milliseconds to a few seconds; a write about the same plus its verification.
|
|
148
|
+
- Calls are fastest over one reused HTTP connection (keep-alive), because a fresh connection can hit a cold start.
|
|
148
149
|
- A call can wait up to 10 seconds for the device's slot (`503 target_busy` with a `Retry-After`
|
|
149
150
|
header when it stays taken), then gets up to 20 seconds on the device (`503 device_offline`), so
|
|
150
151
|
the worst answer takes about 30 seconds. Set your HTTP client timeout to at least 35 seconds so
|
|
@@ -166,7 +167,7 @@ Each API key has its own budget on every `/v1` call: 600 calls per minute, and 1
|
|
|
166
167
|
minute. A write (an action run that needs an `Idempotency-Key`) counts against both. Over a budget
|
|
167
168
|
the call answers `429 rate_limited` with `Retry-After: 60` and `retryAfterSeconds: 60` in the error
|
|
168
169
|
body. Honour it, back off and do not loop; a retried write keeps its `Idempotency-Key`. The numbers
|
|
169
|
-
can change, so treat them as approximate. Pairing has a tighter limit of its own: 5 failed
|
|
170
|
+
can change, so treat them as approximate. Pairing has a tighter limit of its own: 5 failed pairing
|
|
170
171
|
attempts per key per rolling 60 seconds, whose `429` carries neither the header nor the field.
|
|
171
172
|
|
|
172
173
|
## Response headers worth reading
|
package/skill/references/cli.md
CHANGED
|
@@ -15,16 +15,16 @@ the API key the CLI wrote to the app's env file.
|
|
|
15
15
|
| `auth login` | opens a link to the dashboard where the human clicks Approve; prints `Signed in as <email>.` and the person's organisations; the sign-in lasts 90 days | anyone |
|
|
16
16
|
| `auth status` | signed-in person, sign-in expiry, organisations, default organisation, the API keys this CLI created (id, prefix, expiry, where it was written); prints the same document and exits 5 when not signed in | anyone |
|
|
17
17
|
| `auth logout [--keep-keys]` | revokes the sign-in and, unless `--keep-keys`, every API key this CLI created (on a terminal it lists them and asks, default keep; with `--json` or no terminal it revokes them unless `--keep-keys`); removes the entries it wrote, says what it revoked or kept | anyone |
|
|
18
|
-
| `
|
|
19
|
-
| `
|
|
18
|
+
| `orgs list` | the person's organisations: slug, name, role, which one is the default | member |
|
|
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
22
|
| `devices list` | paired devices with id, label, status, systems, last seen | member |
|
|
23
|
-
| `devices pair <code> [--label <text>]` |
|
|
24
|
-
| `devices rename <
|
|
25
|
-
| `devices release <
|
|
26
|
-
| `devices systems <
|
|
27
|
-
| `actions list <
|
|
23
|
+
| `devices pair <code> [--label <text>]` | pair a device by the code on its screen | member |
|
|
24
|
+
| `devices rename <deviceId> <label>` | rename a device | member |
|
|
25
|
+
| `devices release <deviceId>` | release a device (asks on a terminal; `--yes` otherwise) | admin |
|
|
26
|
+
| `devices systems <deviceId>` | the device's live systems and action state, paused reasons included; `device_offline` is a normal answer | member |
|
|
27
|
+
| `actions list <deviceId> <system>` | the action index: every action with its operation and field schemas | member |
|
|
28
28
|
| `keys list` | the organisation's API keys: name, prefix, created, last used, expires, status | member |
|
|
29
29
|
| `keys create <name> --expires <7d\|30d\|90d> --write-env <file>` | create an API key: opens a link, a human approves "Create an API key in <Org>?", the CLI receives the key once and writes `DEEPDOCK_API_KEY=<key>` into the file. It keeps no copy and shows the value to nobody. Answers id, name, prefix, expiry and where it was written | admin |
|
|
30
30
|
| `keys revoke <id>` | revoke a key (asks on a terminal; `--yes` otherwise); removes the env entry if this CLI wrote it | admin |
|
|
@@ -32,8 +32,8 @@ the API key the CLI wrote to the app's env file.
|
|
|
32
32
|
| `skill [--agent claude\|codex\|cursor\|all]` | writes this skill into the current repository | anyone |
|
|
33
33
|
|
|
34
34
|
Every command that acts in an organisation uses `--org <slug>` after the command, else
|
|
35
|
-
`DEEPDOCK_ORG`, else the default from `
|
|
36
|
-
stderr; with several and none chosen it stops with `org_required` and lists them. Always pass `--org` from an agent: `
|
|
35
|
+
`DEEPDOCK_ORG`, else the default from `orgs select`; if you belong to exactly one organisation it is used and named on
|
|
36
|
+
stderr; with several and none chosen it stops with `org_required` and lists them. Always pass `--org` from an agent: `orgs select` changes the human's
|
|
37
37
|
default in every terminal.
|
|
38
38
|
|
|
39
39
|
`auth login` and `keys create` also open the approval link in the human's browser on a terminal, unless `--no-browser`, `DEEPDOCK_NO_BROWSER=1`, `CI` or a missing display says otherwise.
|
|
@@ -84,8 +84,8 @@ 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`, `
|
|
88
|
-
| 4 | the CLI is too old for the API: run `npx @deepdockai/cli@latest` | `
|
|
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` |
|
|
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
|
|
|
91
91
|
Branch on the exit code or on `error.code`, never on `message`.
|
|
Binary file
|
|
@@ -25,16 +25,13 @@ class DeepdockError(Exception):
|
|
|
25
25
|
"""Deepdock answered `{ "error": { "code", ... } }`. Switch on `code`, never on `message`."""
|
|
26
26
|
|
|
27
27
|
def __init__(self, status: int, code: str, message: str, request_id: Optional[str] = None,
|
|
28
|
-
systems: Optional[List[str]] = None,
|
|
29
|
-
reason: Optional[str] = None, created: Optional[Dict[str, Any]] = None,
|
|
28
|
+
systems: Optional[List[str]] = None, created: Optional[Dict[str, Any]] = None,
|
|
30
29
|
uncertain: Optional[bool] = None):
|
|
31
30
|
super().__init__(message)
|
|
32
31
|
self.status = status
|
|
33
32
|
self.code = code
|
|
34
33
|
self.request_id = request_id
|
|
35
34
|
self.systems = systems
|
|
36
|
-
self.version = version # system_version_unverified: the version the system last reported, None when it reported none
|
|
37
|
-
self.reason = reason # system_version_unverified: unverified_version, unparseable or unreported
|
|
38
35
|
self.created = created # applied_unverified, outcome_unknown with no rollback: {"chartId"} or None
|
|
39
36
|
self.retry_after: Optional[str] = None # the Retry-After header as sent (seconds), when the answer carried one
|
|
40
37
|
self.uncertain = uncertain # outcome_unknown: True when the write may or may not have landed
|
|
@@ -99,7 +96,7 @@ def _unwrap(r: httpx.Response) -> Tuple[Any, Optional[str]]:
|
|
|
99
96
|
if isinstance(body, dict) and "error" in body:
|
|
100
97
|
e = body["error"]
|
|
101
98
|
err = DeepdockError(r.status_code, e["code"], e["message"], e.get("requestId"), e.get("systems"),
|
|
102
|
-
e.get("
|
|
99
|
+
e.get("created"), e.get("uncertain"))
|
|
103
100
|
err.retry_after = r.headers.get("retry-after")
|
|
104
101
|
raise err
|
|
105
102
|
if not isinstance(body, dict) or "data" not in body:
|
|
@@ -218,7 +215,7 @@ class Deepdock:
|
|
|
218
215
|
return data
|
|
219
216
|
|
|
220
217
|
def pair(self, code: str, label: Optional[str] = None) -> Dict[str, Any]:
|
|
221
|
-
"""
|
|
218
|
+
"""Pairs a device by the pairing code it shows. Keep the returned `id`."""
|
|
222
219
|
body: Dict[str, str] = {"code": code}
|
|
223
220
|
if label is not None:
|
|
224
221
|
body["label"] = label
|
|
@@ -233,13 +230,13 @@ class Deepdock:
|
|
|
233
230
|
# Pending writes: one attempt against persisted state. Persist the row BEFORE the first send, so a
|
|
234
231
|
# crash between send and answer cannot produce a second record under a new key. A job retries rows
|
|
235
232
|
# left in "sent" with backoff (seconds, then minutes, for hours if the device stays offline).
|
|
236
|
-
# For
|
|
237
|
-
#
|
|
233
|
+
# For device_outdated, poll the device's `outdated` and `blockedActions` before retrying: it takes longer than minutes.
|
|
234
|
+
# version_not_covered is not retried: Deepdock has to approve the installed version first.
|
|
238
235
|
# --------------------------------------------------------------------------------------------------
|
|
239
236
|
|
|
240
237
|
CONFLICT_RETRIES = 5 # a running write finishes within seconds; beyond this, treat it as unknown
|
|
241
238
|
|
|
242
|
-
RETRY_SAME_KEY = {"device_offline", "device_syncing", "device_outdated",
|
|
239
|
+
RETRY_SAME_KEY = {"device_offline", "device_syncing", "device_outdated",
|
|
243
240
|
"target_busy", "temporarily_unavailable", "internal_error", "action_paused",
|
|
244
241
|
"system_unavailable"}
|
|
245
242
|
|
|
@@ -13,10 +13,6 @@ export class DeepdockError extends Error {
|
|
|
13
13
|
readonly code: string
|
|
14
14
|
readonly requestId?: string
|
|
15
15
|
readonly systems?: string[]
|
|
16
|
-
/** system_version_unverified: the version the system last reported, `null` when it reported none. */
|
|
17
|
-
readonly version?: string | null
|
|
18
|
-
/** system_version_unverified: `unverified_version`, `unparseable` or `unreported`. */
|
|
19
|
-
readonly reason?: string
|
|
20
16
|
/** applied_unverified, outcome_unknown on a system with no rollback: the entry, or `null` when not known. */
|
|
21
17
|
readonly created?: { chartId?: string } | null
|
|
22
18
|
/** outcome_unknown: `true` when the write may or may not have landed. */
|
|
@@ -26,8 +22,6 @@ export class DeepdockError extends Error {
|
|
|
26
22
|
|
|
27
23
|
constructor(status: number, code: string, message: string, requestId?: string,
|
|
28
24
|
systems?: string[],
|
|
29
|
-
version?: string | null,
|
|
30
|
-
reason?: string,
|
|
31
25
|
created?: { chartId?: string } | null,
|
|
32
26
|
uncertain?: boolean,
|
|
33
27
|
) {
|
|
@@ -37,8 +31,6 @@ export class DeepdockError extends Error {
|
|
|
37
31
|
this.code = code
|
|
38
32
|
this.requestId = requestId
|
|
39
33
|
this.systems = systems
|
|
40
|
-
this.version = version
|
|
41
|
-
this.reason = reason
|
|
42
34
|
this.created = created
|
|
43
35
|
this.uncertain = uncertain
|
|
44
36
|
}
|
|
@@ -52,7 +44,7 @@ export class DeepdockTransportError extends Error {
|
|
|
52
44
|
}
|
|
53
45
|
}
|
|
54
46
|
|
|
55
|
-
type ErrorBody = { code: string; message: string; requestId?: string; systems?: string[];
|
|
47
|
+
type ErrorBody = { code: string; message: string; requestId?: string; systems?: string[]; created?: { chartId?: string } | null; uncertain?: boolean }
|
|
56
48
|
type Envelope<T> = { data: T; nextCursor?: string | null } | { error: ErrorBody }
|
|
57
49
|
|
|
58
50
|
/** One page of a `many` read: `items` is the answer's `data` array, `nextCursor` its top-level sibling. */
|
|
@@ -64,19 +56,13 @@ export type InputValue = string | number | boolean
|
|
|
64
56
|
export type WriteOperation = 'create' | 'update'
|
|
65
57
|
export type ActionInput = Record<string, InputValue>
|
|
66
58
|
|
|
67
|
-
|
|
59
|
+
/** `missing`: never found on the PC; `vanished`: found once and not any more. */
|
|
60
|
+
export type SystemStatus = 'running' | 'stopped' | 'missing' | 'unknown' | 'vanished'
|
|
68
61
|
/** The database access the device last reported; `null` while none is known. */
|
|
69
62
|
export type SystemAccess = 'ok' | 'outdated' | 'missing' | 'password_missing' | 'not_set_up' | null
|
|
70
63
|
|
|
71
|
-
/**
|
|
72
|
-
|
|
73
|
-
* `unverified_version` clears once Deepdock verifies the version; `unparseable` does not clear by
|
|
74
|
-
* waiting (contact Deepdock); `unreported` clears once the device reports the system's version (a
|
|
75
|
-
* write verified for one exact release needs it).
|
|
76
|
-
*/
|
|
77
|
-
export type SystemWrites =
|
|
78
|
-
| { state: 'verified' | 'unknown' | 'partial' }
|
|
79
|
-
| { state: 'unverified'; reason: 'unverified_version' | 'unparseable' | 'unreported' }
|
|
64
|
+
/** Why a system's `version` is missing, when the device says. */
|
|
65
|
+
export type VersionIssue = 'not_installed' | 'not_found' | 'unreadable'
|
|
80
66
|
|
|
81
67
|
export type Device = {
|
|
82
68
|
id: string
|
|
@@ -95,13 +81,15 @@ export type Device = {
|
|
|
95
81
|
systems: {
|
|
96
82
|
system: string
|
|
97
83
|
version: string | null
|
|
84
|
+
versionIssue: VersionIssue | null
|
|
98
85
|
status: SystemStatus
|
|
99
86
|
access: SystemAccess
|
|
100
87
|
/** Set when `access` is the last known value (the device could not read it): when it last did. */
|
|
101
88
|
accessLastCheckedAt: string | null
|
|
102
89
|
lockedActions: string[] | null
|
|
103
90
|
reportedAt: string
|
|
104
|
-
|
|
91
|
+
/** Actions this device's client cannot run yet: each answers device_outdated until it updates. Absent when none. */
|
|
92
|
+
blockedActions?: string[]
|
|
105
93
|
}[]
|
|
106
94
|
}
|
|
107
95
|
|
|
@@ -120,6 +108,7 @@ export type DeviceSystem = {
|
|
|
120
108
|
system: string
|
|
121
109
|
label: string | null
|
|
122
110
|
version?: string
|
|
111
|
+
versionIssue?: VersionIssue
|
|
123
112
|
status: SystemStatus
|
|
124
113
|
access: SystemAccess
|
|
125
114
|
/** Set when `access` is the last known value (the device could not read it): when it last did. */
|
|
@@ -156,8 +145,8 @@ const unwrap = async <T>(res: Response): Promise<{ data: T; nextCursor: string |
|
|
|
156
145
|
throw new DeepdockTransportError(`non-JSON answer with status ${res.status}`)
|
|
157
146
|
}
|
|
158
147
|
if (body !== null && typeof body === 'object' && 'error' in body) {
|
|
159
|
-
const { code, message, requestId, systems,
|
|
160
|
-
const error = new DeepdockError(res.status, code, message, requestId, systems,
|
|
148
|
+
const { code, message, requestId, systems, created, uncertain } = body.error
|
|
149
|
+
const error = new DeepdockError(res.status, code, message, requestId, systems, created, uncertain)
|
|
161
150
|
error.retryAfter = res.headers.get('retry-after') ?? undefined
|
|
162
151
|
throw error
|
|
163
152
|
}
|
|
@@ -416,7 +405,7 @@ export class Deepdock {
|
|
|
416
405
|
return (await this.send<DeviceSystem[]>(`/v1/devices/${encodeURIComponent(deviceId)}/systems`, { method: 'GET' })).data
|
|
417
406
|
}
|
|
418
407
|
|
|
419
|
-
/**
|
|
408
|
+
/** Pairs a device by the pairing code it shows. Keep the returned `id`. */
|
|
420
409
|
async pair(code: string, label?: string): Promise<Device> {
|
|
421
410
|
const body: PairBody = label === undefined ? { code } : { code, label }
|
|
422
411
|
return (
|
|
@@ -437,8 +426,8 @@ export class Deepdock {
|
|
|
437
426
|
* Pending writes: one attempt against persisted state. Persist the row BEFORE the first send, so a
|
|
438
427
|
* crash between send and answer cannot produce a second record under a new key. A job retries rows
|
|
439
428
|
* left in `sent` with backoff (seconds, then minutes, for hours if the device stays offline).
|
|
440
|
-
* For
|
|
441
|
-
*
|
|
429
|
+
* For device_outdated, poll the device's `outdated` and `blockedActions` before retrying: it takes longer than minutes.
|
|
430
|
+
* version_not_covered is not retried: Deepdock has to approve the installed version first.
|
|
442
431
|
* ---------------------------------------------------------------------------------------------- */
|
|
443
432
|
|
|
444
433
|
export type PendingStatus = 'pending' | 'sent' | 'done' | 'unknown' | 'refused'
|
|
@@ -465,7 +454,6 @@ const RETRY_SAME_KEY = new Set([
|
|
|
465
454
|
'device_offline',
|
|
466
455
|
'device_syncing',
|
|
467
456
|
'device_outdated',
|
|
468
|
-
'system_version_unverified',
|
|
469
457
|
'target_busy',
|
|
470
458
|
'temporarily_unavailable',
|
|
471
459
|
'internal_error',
|
|
@@ -25,9 +25,9 @@ The Deepdock client installed on the customer's Windows PC next to their system.
|
|
|
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
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 `
|
|
28
|
+
assigned action needs a newer client: it answers `device_outdated`) and the `systems` it reported (each with a `versionIssue` when `version` is missing, and `blockedActions` when this device's client cannot run some actions yet: those answer `device_outdated` until the client updates, the others keep running). 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
|
-
- **Pair**:
|
|
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.
|
|
32
32
|
- **Inactive**: a paired device that has not connected for 7 days. It stays yours and is active again
|
|
33
33
|
when it connects.
|
|
@@ -51,11 +51,14 @@ has a display `label` (may be `null`), a `version` the device reported (may be a
|
|
|
51
51
|
| device `lastKnownAt` | ISO time or `null` | the time of the device's last report while it is not connected. `null` while it is connected | show the last known state with this time; it may be out of date |
|
|
52
52
|
| system `status` | `running` | the customer's program is running on the device | normal |
|
|
53
53
|
| system `status` | `stopped` | the program is installed but not running | calls answer `system_unavailable`; the site starts the program |
|
|
54
|
-
| system `status` | `missing` | the
|
|
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
|
+
| 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 |
|
|
55
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 |
|
|
56
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
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
|
+
| 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 |
|
|
58
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 the spec set it runs now. `null`: no verdict yet, or the verdict is for an older spec set | do not offer a locked action as available; it answers `access_outdated` until the customer repeats "Erneut einrichten" |
|
|
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 |
|
|
59
62
|
| action state | `active` | the action can be called | normal |
|
|
60
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 |
|
|
61
64
|
| 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 |
|
|
@@ -7,7 +7,7 @@ Never hard-code an action's fields. Three sources, each authoritative for one th
|
|
|
7
7
|
| Which systems and actions does my organisation have? | `deepdock systems list --json` | CLI sign-in |
|
|
8
8
|
| What does this device run, and is each action active or paused? | `GET /v1/devices/{deviceId}/systems` | organisation |
|
|
9
9
|
| Which actions can I call on this device's system, with which schemas? | `GET /v1/devices/{deviceId}/systems/{system}/actions` | organisation |
|
|
10
|
-
| The exact paths, operations, fields, patterns, enums, lengths, responses | `deepdock systems openapi <system>` (CLI sign-in) or `GET /v1/systems/{system}/openapi.json` (API key); per device `deepdock actions list <
|
|
10
|
+
| The exact paths, operations, fields, patterns, enums, lengths, responses | `deepdock systems openapi <system>` (CLI sign-in) or `GET /v1/systems/{system}/openapi.json` (API key); per device `deepdock actions list <deviceId> <system>` (CLI sign-in) | CLI sign-in or API key |
|
|
11
11
|
|
|
12
12
|
## The OpenAPI document
|
|
13
13
|
|
|
@@ -23,11 +23,11 @@ with the **same** `Idempotency-Key`); **Show** says what the end user should see
|
|
|
23
23
|
| `partner_not_approved` | 403 | your organisation is waiting for approval by Deepdock; no key of it works yet. Keys made before the approval start working once it is given | no, until Deepdock approves; then yes | "our Deepdock account is waiting for approval; contact Deepdock" |
|
|
24
24
|
| `partner_deactivated` | 403 | Deepdock has deactivated your organisation: no key of it works and its devices are disconnected. Keys and devices work again once Deepdock reactivates it | no, until Deepdock reactivates it; then yes | "our Deepdock account is deactivated; contact Deepdock" |
|
|
25
25
|
| `not_found` | 404 | no such route; a single-record read (`cardinality: one`) that finds no record; an update whose id matches no record; a write naming a record that does not exist or belongs to another one | no | "record not found" when it is a record; otherwise a bug |
|
|
26
|
-
| `rate_limited` | 429 | more than 600 calls, or more than 120 writes (counted in both), with this key in a minute; or more than 5 failed pairing
|
|
26
|
+
| `rate_limited` | 429 | more than 600 calls, or more than 120 writes (counted in both), with this key in a minute; or more than 5 failed pairing attempts in 60 s | yes, after `Retry-After: 60` (`retryAfterSeconds: 60` in the body); a write keeps its key. The pairing answer has neither: wait up to a minute | "try again in a minute" |
|
|
27
27
|
|
|
28
|
-
`
|
|
28
|
+
`cli_outdated` (400) is in the enum but answered only to the Deepdock CLI (by its
|
|
29
29
|
`X-Deepdock-Cli` version), so your own `/v1` code never receives it. The dashboard tree's own codes
|
|
30
|
-
(`
|
|
30
|
+
(`organisation_required`, `forbidden`, `conflict`, `already_member`) are not in the `/v1` enum.
|
|
31
31
|
|
|
32
32
|
## Device, system and action resolution
|
|
33
33
|
|
|
@@ -62,8 +62,8 @@ with the **same** `Idempotency-Key`); **Show** says what the end user should see
|
|
|
62
62
|
|---|---|---|---|---|
|
|
63
63
|
| `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" |
|
|
64
64
|
| `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
|
-
| `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 (
|
|
66
|
-
| `
|
|
65
|
+
| `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
|
+
| `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" |
|
|
67
67
|
| `action_paused` | 503 | the action is paused on the device (`GET .../systems` shows `reason`); only Deepdock resumes it | later, when `GET .../systems` shows it active; do not loop | "this feature is paused while Deepdock checks the customer system" |
|
|
68
68
|
| `system_unavailable` | 503 | the customer's program is stopped or missing on the device | later; often resolves when the customer restarts the program | "the customer's software is not running" |
|
|
69
69
|
| `target_busy` | 503 | the customer's system is busy or unreachable | yes, with backoff | "the customer's system is busy; retrying" |
|
|
@@ -113,7 +113,7 @@ const REACTION: Record<string, Reaction> = {
|
|
|
113
113
|
device_offline: 'retry-same-key',
|
|
114
114
|
device_syncing: 'retry-same-key',
|
|
115
115
|
device_outdated: 'retry-later',
|
|
116
|
-
|
|
116
|
+
version_not_covered: 'stop',
|
|
117
117
|
action_paused: 'wait-paused',
|
|
118
118
|
system_unavailable: 'retry-later',
|
|
119
119
|
target_busy: 'retry-same-key',
|
|
@@ -70,7 +70,7 @@ input, a status (`pending`, `sent`, `done`, `unknown`, `refused`) and the result
|
|
|
70
70
|
|
|
71
71
|
```
|
|
72
72
|
pending ──send──▶ sent ──2xx (fresh or replayed)──────────────▶ done
|
|
73
|
-
│ ──device_offline, device_syncing, device_outdated,
|
|
73
|
+
│ ──device_offline, device_syncing, device_outdated, timeout, network error, target_busy, temporarily_unavailable, internal_error ▶ sent (retry later, same key)
|
|
74
74
|
│ ──idempotency_conflict, retries left ───▶ sent (retry, same key, same input)
|
|
75
75
|
│ ──idempotency_conflict, retries spent ──▶ unknown (read back before anything else)
|
|
76
76
|
│ ──outcome_unknown ──────────────────────▶ unknown (read back before anything else)
|
|
@@ -40,7 +40,7 @@ No action deletes anything, and nothing is undone through the API. So:
|
|
|
40
40
|
|
|
41
41
|
The CLI runs no action, so this loop is your code's, against the demo device:
|
|
42
42
|
|
|
43
|
-
1. `deepdock devices systems <
|
|
43
|
+
1. `deepdock devices systems <deviceId> --org <slug> --json`: the system is running and every action
|
|
44
44
|
you need is active; otherwise stop and read the pause reason and `deepdock incidents list`.
|
|
45
45
|
2. **Create** with a fresh idempotency key and `TEST-DEEPDOCK-` names: expect `201` and an id.
|
|
46
46
|
3. **Replay** the same request with the same key: expect `200`, `Idempotent-Replayed: true`, no
|