@deepdockai/cli 1.10.0 → 1.12.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 +13 -0
- package/README.md +28 -20
- package/dist/deepdock.js +301 -14
- package/package.json +1 -1
- package/skill/references/cli.md +11 -2
- package/skill/references/clients/deepdock.ts +6 -1
- package/skill/references/concepts.md +1 -0
- package/skill/references/errors.md +14 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.12.0
|
|
4
|
+
|
|
5
|
+
- `deepdock webhooks`: manage webhook endpoints (`list`, `get`, `create`, `update`, `delete`, `disable`, `enable`, `secret`, `rotate-secret`, `test`, `events`). An endpoint always lists its event types (`--event` or `--all-events`, every assigned type that exists now). The signing secret is never printed: it goes only to an env file, like an API key.
|
|
6
|
+
- Webhooks follow the assignment of triggers to your organisation: until Deepdock assigns the first one, every `webhooks` command fails with `not_found` (exit 2) and the message "Webhooks are not available for this organisation yet"; `webhooks events` lists only the types of the assigned triggers; an event type that is not one of them is refused with `invalid_input` (exit 2), naming the type, and a human reading the error no longer sees "The device refused the input" for a webhook refusal.
|
|
7
|
+
- New error code `webhook_disabled` (exit 2): a test on a disabled endpoint; `webhooks enable` first.
|
|
8
|
+
|
|
9
|
+
## 1.11.0
|
|
10
|
+
|
|
11
|
+
- The current device API, three changes in the pinned device API, the bundled TypeScript client and the references:
|
|
12
|
+
- A paused action's `reason` can be `http_signin_changed` (the program's sign-in answered in a way the device's recorded sign-in does not describe; only Deepdock lifts it). The bundled client's `ActionState` type and the concepts reference gain it.
|
|
13
|
+
- The documented UUID pattern of the `id` fields (`PartnerDevice.id`, `ReleasedDevice.id`) accepts upper-case hex digits as well. The values the API accepts and answers are unchanged.
|
|
14
|
+
- `error.fields` of an `invalid_input` can name one element of a list input (`list[index].field`, or `list[index]` when no element field is named, with a zero-based index) when a write refuses that element with a refusal the action declares, or with `not_found` or `too_many_rows`. The errors reference describes it.
|
|
15
|
+
|
|
3
16
|
## 1.10.0
|
|
4
17
|
|
|
5
18
|
- The current device API: pairing a device answers `409 device_update_required` (exit 2) when its Deepdock client is too old for a system of your organisation, or has not reported its client yet. `error.reason` is `lacks` (update the client on the device, then pair again) or `unreported` (retry in a minute). The pinned device API, the error code list and the errors reference describe it.
|
package/README.md
CHANGED
|
@@ -86,28 +86,35 @@ deepdock devices list | pair <code> | rename <deviceId> <label> | release <dev
|
|
|
86
86
|
deepdock actions list <deviceId> <system>
|
|
87
87
|
deepdock keys list | create <name> | revoke <id>
|
|
88
88
|
deepdock incidents list
|
|
89
|
+
deepdock webhooks list | get <id> | create <url> | update <id> | delete <id> | disable <id> | enable <id> | secret <id> | rotate-secret <id> | test <id> | events
|
|
89
90
|
deepdock skill
|
|
90
91
|
```
|
|
91
92
|
|
|
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
|
-
| `
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
93
|
+
| Command | What it does |
|
|
94
|
+
| ----------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
95
|
+
| `auth login` | sign in as yourself, approved in the browser; the sign-in lasts 90 days |
|
|
96
|
+
| `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` |
|
|
97
|
+
| `auth logout [--keep-keys]` | revoke the sign-in and every key this CLI created (`--keep-keys`: only the sign-in) |
|
|
98
|
+
| `orgs list`, `orgs select [slug]` | your organisations; set the default one |
|
|
99
|
+
| `systems list` | the systems and actions assigned to your organisation |
|
|
100
|
+
| `systems openapi <system>` | a system's OpenAPI document on stdout, bare when redirected; save it to a file |
|
|
101
|
+
| `devices list` | paired devices with id, label, status, systems and last seen |
|
|
102
|
+
| `devices pair <code> [--label <text>]` | pair a device by the code on its screen |
|
|
103
|
+
| `devices rename <deviceId> <label>`, `devices release <deviceId>` | rename a device; unpair it from the organisation (admin) |
|
|
104
|
+
| `devices systems <deviceId>` | a device's live systems and action state, paused reasons included |
|
|
105
|
+
| `actions list <deviceId> <system>` | every action a device offers, with its operation and fields |
|
|
106
|
+
| `keys list`, `keys create <name>`, `keys revoke <id>` | the organisation's API keys (create and revoke: admin) |
|
|
107
|
+
| `incidents list` | open incidents, and those closed within the last 30 days |
|
|
108
|
+
| `webhooks list`, `webhooks get <id>`, `webhooks events` | your webhook endpoints; one endpoint with its seven-day statistics; the event types assigned to your organisation. Until Deepdock assigns a first trigger, every `webhooks` command answers `not_found` ("Webhooks are not available for this organisation yet", exit 2): ask Deepdock |
|
|
109
|
+
| `webhooks create <url> (--event <type>... \| --all-events)` | create an endpoint (admin); `--description <text>`, `--write-env <file>` for its signing secret. `--all-events` is every assigned type that exists now, not types added later; a type that is not on `webhooks events` is refused (`invalid_input`, exit 2) |
|
|
110
|
+
| `webhooks update <id>`, `webhooks delete <id>` | change an endpoint's `--url`, `--description` or event types; delete it with its stored deliveries (admin; delete asks, `--yes` otherwise) |
|
|
111
|
+
| `webhooks disable <id>`, `webhooks enable <id>` | stop sending to an endpoint; send again, and resume what waited (admin) |
|
|
112
|
+
| `webhooks secret <id> --write-env <file>` | write an endpoint's signing secret into an env file (admin) |
|
|
113
|
+
| `webhooks rotate-secret <id> --write-env <file>` | make a new signing secret; the old one signs for 24 more hours (admin; asks, `--yes` otherwise) |
|
|
114
|
+
| `webhooks test <id> --event <type>` | send one example message now; shows the outcome, HTTP status, duration and the first part of the receiver's answer; nothing is stored (admin) |
|
|
115
|
+
| `skill [--agent claude\|codex\|cursor\|all]` | install the agent skill into the current directory |
|
|
116
|
+
|
|
117
|
+
Global flags: `--org <slug>` and `--json` on every command, `--yes` to answer a confirmation question, `-h, --help` everywhere and `-v, --version` at the root.
|
|
111
118
|
`deepdock <command> --help` has the details, `deepdock help exit-codes` the exit codes.
|
|
112
119
|
|
|
113
120
|
Two things are never guessed. A device is always named by its full id: no default device, no
|
|
@@ -150,7 +157,7 @@ On a terminal you get tables and plain sentences. When stdout is not a terminal,
|
|
|
150
157
|
`systems openapi` is the one exception off a terminal: it prints the OpenAPI document itself, so
|
|
151
158
|
`deepdock systems openapi <system> > openapi.json` saves a document a generator can read (`--json`
|
|
152
159
|
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`, `orgs select` and `
|
|
160
|
+
your code will receive; `auth`, `orgs select`, `keys create`, `webhooks secret` and `webhooks rotate-secret` build it from named fields. A
|
|
154
161
|
failure is one document on stderr, `{ "error": { "code", "message" }, "meta": { "hint" } }`,
|
|
155
162
|
with the API's error object unchanged. Switch on `code` or on the exit code, never on `message`.
|
|
156
163
|
|
|
@@ -220,6 +227,7 @@ macOS and Linux need nothing special. On Windows:
|
|
|
220
227
|
`.env.local`, `.env.local.deepdock-tmp-<random>`); a `.gitignore` line `.env*` or
|
|
221
228
|
`*.deepdock-tmp*` covers it; where git answers and the name is not ignored, the CLI refuses before anything is
|
|
222
229
|
created.
|
|
230
|
+
- **A webhook's signing secret is never shown either.** `webhooks create --write-env`, `webhooks secret` and `webhooks rotate-secret` write `DEEPDOCK_WEBHOOK_SECRET` under the rules of an API key; a secret that could not be written stays readable with `webhooks secret`.
|
|
223
231
|
- **The approval link is not a credential.** It names the request; the result is collected with
|
|
224
232
|
a secret the CLI generated and keeps.
|
|
225
233
|
- **Keys expire and can be revoked.** A key reaches every device of the organisation until it
|
package/dist/deepdock.js
CHANGED
|
@@ -10872,6 +10872,7 @@ var EXIT_CODES = {
|
|
|
10872
10872
|
idempotency_conflict: 2,
|
|
10873
10873
|
conflict: 2,
|
|
10874
10874
|
already_member: 2,
|
|
10875
|
+
webhook_disabled: 2,
|
|
10875
10876
|
record_locked: 2,
|
|
10876
10877
|
record_not_editable: 2,
|
|
10877
10878
|
record_restricted: 2,
|
|
@@ -10915,6 +10916,7 @@ class CliError extends Error {
|
|
|
10915
10916
|
hint;
|
|
10916
10917
|
retryAfterMs;
|
|
10917
10918
|
organisations;
|
|
10919
|
+
refusedBy;
|
|
10918
10920
|
constructor(init) {
|
|
10919
10921
|
super(init.message);
|
|
10920
10922
|
this.name = "CliError";
|
|
@@ -10925,6 +10927,7 @@ class CliError extends Error {
|
|
|
10925
10927
|
this.hint = init.hint;
|
|
10926
10928
|
this.retryAfterMs = init.retryAfterMs;
|
|
10927
10929
|
this.organisations = init.organisations;
|
|
10930
|
+
this.refusedBy = init.refusedBy;
|
|
10928
10931
|
}
|
|
10929
10932
|
get exitCode() {
|
|
10930
10933
|
return exitCodeFor(this.code, this.status);
|
|
@@ -10938,15 +10941,16 @@ var signInNeeded = () => new CliError({
|
|
|
10938
10941
|
});
|
|
10939
10942
|
|
|
10940
10943
|
// src/args.ts
|
|
10941
|
-
var
|
|
10944
|
+
var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
10942
10945
|
var SYSTEM_NAME = /^[A-Za-z0-9._-]{1,64}$/;
|
|
10943
10946
|
var KEY_ID = /^[A-Za-z0-9_-]{1,100}$/;
|
|
10944
|
-
var
|
|
10945
|
-
if (!
|
|
10946
|
-
throw usageError(`"${value}" is not a full
|
|
10947
|
-
}
|
|
10947
|
+
var uuidArg = (noun, hint) => (value) => {
|
|
10948
|
+
if (!UUID.test(value))
|
|
10949
|
+
throw usageError(`"${value}" is not a full ${noun} id.`, hint);
|
|
10948
10950
|
return value;
|
|
10949
10951
|
};
|
|
10952
|
+
var deviceIdArg = uuidArg("device", "Copy the whole id from `deepdock devices list`; short ids and labels are not accepted.");
|
|
10953
|
+
var webhookIdArg = uuidArg("webhook", "List them with `deepdock webhooks list`.");
|
|
10950
10954
|
var systemArg = (value) => {
|
|
10951
10955
|
if (!SYSTEM_NAME.test(value)) {
|
|
10952
10956
|
throw usageError(`"${value}" is not a system name.`, "List them with `deepdock systems list`.");
|
|
@@ -11015,6 +11019,32 @@ var KEY_COLUMNS = [
|
|
|
11015
11019
|
"revokedAt",
|
|
11016
11020
|
"lastUsedAt"
|
|
11017
11021
|
];
|
|
11022
|
+
var WEBHOOK_LIST_COLUMNS = [
|
|
11023
|
+
"id",
|
|
11024
|
+
"url",
|
|
11025
|
+
"status",
|
|
11026
|
+
"disabledReason",
|
|
11027
|
+
"successRate",
|
|
11028
|
+
"lastDeliveryAt"
|
|
11029
|
+
];
|
|
11030
|
+
var WEBHOOK_COLUMNS = [
|
|
11031
|
+
"id",
|
|
11032
|
+
"url",
|
|
11033
|
+
"description",
|
|
11034
|
+
"status",
|
|
11035
|
+
"disabledReason",
|
|
11036
|
+
"eventTypes",
|
|
11037
|
+
"successRate",
|
|
11038
|
+
"averageResponseMs",
|
|
11039
|
+
"lastStatusCode",
|
|
11040
|
+
"lastDeliveryAt",
|
|
11041
|
+
"failingSince",
|
|
11042
|
+
"disabledAt",
|
|
11043
|
+
"secretCreatedAt",
|
|
11044
|
+
"previousSecretExpiresAt",
|
|
11045
|
+
"createdAt"
|
|
11046
|
+
];
|
|
11047
|
+
var EVENT_TYPE_COLUMNS = ["type", "system", "object", "label", "description"];
|
|
11018
11048
|
var ACTION_COLUMNS = ["name", "kind", "fields", "description", "state", "status"];
|
|
11019
11049
|
var DEVICE_SYSTEM_COLUMNS = [
|
|
11020
11050
|
"systems",
|
|
@@ -11058,19 +11088,27 @@ var scalar = (value) => {
|
|
|
11058
11088
|
return "";
|
|
11059
11089
|
};
|
|
11060
11090
|
var GOOD = new Set(["connected", "active", "running", "ok"]);
|
|
11061
|
-
var WARN = new Set([
|
|
11091
|
+
var WARN = new Set([
|
|
11092
|
+
"offline",
|
|
11093
|
+
"paused",
|
|
11094
|
+
"outdated",
|
|
11095
|
+
"unavailable",
|
|
11096
|
+
"degraded",
|
|
11097
|
+
"failing",
|
|
11098
|
+
"disabled"
|
|
11099
|
+
]);
|
|
11062
11100
|
var BAD = new Set(["revoked", "failed", "denied", "expired"]);
|
|
11063
11101
|
var cellFor = (key, value) => {
|
|
11064
11102
|
const text = scalar(value);
|
|
11065
11103
|
if (text === "")
|
|
11066
11104
|
return text;
|
|
11067
|
-
if (key === "reason" || key
|
|
11105
|
+
if (key === "reason" || key.endsWith("Reason"))
|
|
11068
11106
|
return words(text);
|
|
11069
11107
|
if (key === "revokedAt")
|
|
11070
11108
|
return { text, style: "red" };
|
|
11071
11109
|
if (key === "name" || key === "action")
|
|
11072
11110
|
return { text, style: "bold" };
|
|
11073
|
-
if (key.endsWith("At") || key === "since")
|
|
11111
|
+
if (key.endsWith("At") || key.endsWith("Since") || key === "since")
|
|
11074
11112
|
return { text, style: "dim" };
|
|
11075
11113
|
if (key === "status" || key === "state") {
|
|
11076
11114
|
if (GOOD.has(text))
|
|
@@ -11317,6 +11355,12 @@ var build = async () => {
|
|
|
11317
11355
|
expiresAt: "string"
|
|
11318
11356
|
}
|
|
11319
11357
|
})),
|
|
11358
|
+
webhookSecret: type({
|
|
11359
|
+
secret: "string",
|
|
11360
|
+
createdAt: "string",
|
|
11361
|
+
previousExpiresAt: "string | null"
|
|
11362
|
+
}),
|
|
11363
|
+
eventTypes: type({ type: "string" }).array(),
|
|
11320
11364
|
cliKeys: type({
|
|
11321
11365
|
id: "string",
|
|
11322
11366
|
hostname: "string",
|
|
@@ -11446,7 +11490,7 @@ import { spawn } from "node:child_process";
|
|
|
11446
11490
|
import { homedir, hostname } from "node:os";
|
|
11447
11491
|
|
|
11448
11492
|
// src/version.ts
|
|
11449
|
-
var VERSION = "1.
|
|
11493
|
+
var VERSION = "1.12.0";
|
|
11450
11494
|
|
|
11451
11495
|
// src/runtime.ts
|
|
11452
11496
|
var DEFAULT_BASE_URL = "https://api.deepdock.ai";
|
|
@@ -12089,12 +12133,13 @@ Commands
|
|
|
12089
12133
|
actions List a device's actions and their fields
|
|
12090
12134
|
keys Create, list and revoke your organisation's API keys
|
|
12091
12135
|
incidents Incidents that paused an action on one of your devices
|
|
12136
|
+
webhooks Webhook endpoints: where Deepdock sends a message when a device sees a change
|
|
12092
12137
|
skill Install the Deepdock skill for your coding agent
|
|
12093
12138
|
|
|
12094
12139
|
Global flags
|
|
12095
12140
|
--org <slug> The organisation to act in (default: DEEPDOCK_ORG, then \`deepdock orgs select\`)
|
|
12096
12141
|
--json JSON output (the default when stdout is not a terminal)
|
|
12097
|
-
--yes Answer
|
|
12142
|
+
--yes Answer a confirmation question with yes
|
|
12098
12143
|
-h, --help Help for a command
|
|
12099
12144
|
-v, --version Print the version
|
|
12100
12145
|
|
|
@@ -12192,6 +12237,10 @@ var EXAMPLES = {
|
|
|
12192
12237
|
"devices release": ["deepdock devices release 450c3f0e-7a1b-4c2d-9e8f-1a2b3c4d5e6f --yes"],
|
|
12193
12238
|
"actions list": ["deepdock actions list 450c3f0e-7a1b-4c2d-9e8f-1a2b3c4d5e6f example-erp"],
|
|
12194
12239
|
"keys revoke": ["deepdock keys revoke <id> --yes"],
|
|
12240
|
+
"webhooks create": [
|
|
12241
|
+
"deepdock webhooks create https://example.com/hooks/deepdock --all-events --write-env .env.local"
|
|
12242
|
+
],
|
|
12243
|
+
"webhooks test": ["deepdock webhooks test <id> --event <type>"],
|
|
12195
12244
|
skill: ["deepdock skill --agent claude"]
|
|
12196
12245
|
};
|
|
12197
12246
|
var commandPath = (command) => {
|
|
@@ -12289,6 +12338,7 @@ import { promises as fs4 } from "node:fs";
|
|
|
12289
12338
|
import { basename, dirname as dirname2, join as join2, resolve } from "node:path";
|
|
12290
12339
|
var API_KEY_VARIABLE = "DEEPDOCK_API_KEY";
|
|
12291
12340
|
var BASE_URL_VARIABLE = "DEEPDOCK_BASE_URL";
|
|
12341
|
+
var WEBHOOK_SECRET_VARIABLE = "DEEPDOCK_WEBHOOK_SECRET";
|
|
12292
12342
|
var windowsFileWarning = (platform, envFile, settingsFile) => platform === "win32" ? `On Windows these files keep the permissions of their folder: ${envFile} and the settings file ${settingsFile} hold secrets; under C:\\Users\\<you> only you can read them, in other folders other users of this PC may be able to.` : undefined;
|
|
12293
12343
|
var git = (rt, dir, args) => new Promise((done) => {
|
|
12294
12344
|
const env = { ...rt.env ?? process.env, LC_ALL: "C" };
|
|
@@ -12443,9 +12493,10 @@ var atomicWrite = async (path, content) => {
|
|
|
12443
12493
|
}
|
|
12444
12494
|
};
|
|
12445
12495
|
var KEY_SHAPE = /^[A-Za-z0-9_-]{16,}$/;
|
|
12496
|
+
var WEBHOOK_SECRET_SHAPE = /^whsec_[A-Za-z0-9+/]{16,}={0,2}$/;
|
|
12446
12497
|
var writeEnvValue = async (path, variable, value, baseUrl) => {
|
|
12447
|
-
if (!KEY_SHAPE.test(value)) {
|
|
12448
|
-
throw internal("The API answered a
|
|
12498
|
+
if (!(variable === WEBHOOK_SECRET_VARIABLE ? WEBHOOK_SECRET_SHAPE : KEY_SHAPE).test(value)) {
|
|
12499
|
+
throw internal("The API answered a value in a shape this CLI will not write.", "Nothing was written.");
|
|
12449
12500
|
}
|
|
12450
12501
|
let existing = "";
|
|
12451
12502
|
try {
|
|
@@ -13449,6 +13500,241 @@ var registerSystems = (program, run) => {
|
|
|
13449
13500
|
}));
|
|
13450
13501
|
};
|
|
13451
13502
|
|
|
13503
|
+
// src/commands/webhooks.ts
|
|
13504
|
+
var WRITE_ENV = `write ${WEBHOOK_SECRET_VARIABLE}=<secret> into this env file`;
|
|
13505
|
+
var collect = (value, previous) => [...previous, value];
|
|
13506
|
+
var EVENT_TYPES_PATH = "/partner/webhook-event-types";
|
|
13507
|
+
var WEBHOOKS_PATH = "/partner/webhooks";
|
|
13508
|
+
var UNAVAILABLE_MESSAGE = "Webhooks are not available for this organisation yet: Deepdock has not assigned it a trigger.";
|
|
13509
|
+
var unavailable = (error) => new CliError({
|
|
13510
|
+
code: "not_found",
|
|
13511
|
+
message: UNAVAILABLE_MESSAGE,
|
|
13512
|
+
hint: "Ask Deepdock to assign the triggers you need; these commands work from the first one.",
|
|
13513
|
+
raw: { ...error.raw, message: UNAVAILABLE_MESSAGE },
|
|
13514
|
+
requestId: error.requestId,
|
|
13515
|
+
status: error.status
|
|
13516
|
+
});
|
|
13517
|
+
var NOT_AN_EVENT_TYPE = /^eventTypes\[(\d+)\]$/;
|
|
13518
|
+
var unusableEventTypes = (error, sent) => {
|
|
13519
|
+
const fields = Array.isArray(error.raw.fields) ? error.raw.fields : [];
|
|
13520
|
+
const types = isRecord(sent) && Array.isArray(sent.eventTypes) ? sent.eventTypes : [];
|
|
13521
|
+
const named = [];
|
|
13522
|
+
const others = [];
|
|
13523
|
+
for (const entry of fields) {
|
|
13524
|
+
if (!isRecord(entry))
|
|
13525
|
+
continue;
|
|
13526
|
+
const index = NOT_AN_EVENT_TYPE.exec(String(entry.field))?.[1];
|
|
13527
|
+
const type = index === undefined ? undefined : types[Number(index)];
|
|
13528
|
+
if (typeof type === "string" && entry.message === "is not an event type") {
|
|
13529
|
+
named.push(stripControl(type));
|
|
13530
|
+
} else {
|
|
13531
|
+
others.push(stripControl(`${String(entry.field)} ${String(entry.message)}`));
|
|
13532
|
+
}
|
|
13533
|
+
}
|
|
13534
|
+
if (named.length === 0)
|
|
13535
|
+
return;
|
|
13536
|
+
const message = [
|
|
13537
|
+
`Not an event type of this organisation: ${named.join(", ")}. It does not exist, or its trigger is not assigned to this organisation.`,
|
|
13538
|
+
...others
|
|
13539
|
+
].join("; ");
|
|
13540
|
+
return new CliError({
|
|
13541
|
+
code: error.code,
|
|
13542
|
+
message,
|
|
13543
|
+
hint: "Run `deepdock webhooks events` for the types you can use; ask Deepdock to assign a trigger.",
|
|
13544
|
+
raw: { ...error.raw, message },
|
|
13545
|
+
requestId: error.requestId,
|
|
13546
|
+
status: error.status,
|
|
13547
|
+
refusedBy: "api"
|
|
13548
|
+
});
|
|
13549
|
+
};
|
|
13550
|
+
var webhookCall = async (ctx, req) => {
|
|
13551
|
+
try {
|
|
13552
|
+
return await ctx.callInOrg(req);
|
|
13553
|
+
} catch (error) {
|
|
13554
|
+
if (!(error instanceof CliError))
|
|
13555
|
+
throw error;
|
|
13556
|
+
if (error.code === "invalid_input") {
|
|
13557
|
+
throw unusableEventTypes(error, req.body) ?? new CliError({ ...error, message: error.message, refusedBy: "api" });
|
|
13558
|
+
}
|
|
13559
|
+
if (error.status !== 404 || error.code !== "not_found")
|
|
13560
|
+
throw error;
|
|
13561
|
+
if (req.path === EVENT_TYPES_PATH || req.path === WEBHOOKS_PATH)
|
|
13562
|
+
throw unavailable(error);
|
|
13563
|
+
const probe = await ctx.callInOrg({ method: "GET", path: EVENT_TYPES_PATH }).then(() => false, (failure) => failure instanceof CliError && failure.status === 404);
|
|
13564
|
+
throw probe ? unavailable(error) : error;
|
|
13565
|
+
}
|
|
13566
|
+
};
|
|
13567
|
+
var route = (webhookId, tail = "") => `${WEBHOOKS_PATH}/${webhookId}${tail}`;
|
|
13568
|
+
var answer = (response, text) => ({
|
|
13569
|
+
data: response.data,
|
|
13570
|
+
meta: { requestId: response.requestId },
|
|
13571
|
+
text
|
|
13572
|
+
});
|
|
13573
|
+
var eventTypesOf = async (ctx, flags) => {
|
|
13574
|
+
if (flags.allEvents && flags.event.length > 0) {
|
|
13575
|
+
throw usageError("Use --event or --all-events, not both.");
|
|
13576
|
+
}
|
|
13577
|
+
if (!flags.allEvents)
|
|
13578
|
+
return flags.event.length > 0 ? flags.event : undefined;
|
|
13579
|
+
const response = await webhookCall(ctx, { method: "GET", path: EVENT_TYPES_PATH });
|
|
13580
|
+
return (await parseAnswer("eventTypes", response.data)).map((entry) => entry.type);
|
|
13581
|
+
};
|
|
13582
|
+
var secretFile = async (ctx, file) => {
|
|
13583
|
+
const destination = await checkDestination(ctx.rt, file);
|
|
13584
|
+
if (destination.warning)
|
|
13585
|
+
ctx.note(destination.warning);
|
|
13586
|
+
const windows = windowsFileWarning(ctx.rt.platform, destination.path, configPath(ctx.rt));
|
|
13587
|
+
if (windows)
|
|
13588
|
+
ctx.note(windows);
|
|
13589
|
+
return destination.path;
|
|
13590
|
+
};
|
|
13591
|
+
var deliverSecret = async (ctx, webhookId, path) => {
|
|
13592
|
+
const response = await webhookCall(ctx, { method: "GET", path: route(webhookId, "/secret") });
|
|
13593
|
+
const secret = await parseAnswer("webhookSecret", response.data);
|
|
13594
|
+
try {
|
|
13595
|
+
await checkDestination(ctx.rt, path);
|
|
13596
|
+
await writeEnvValue(path, WEBHOOK_SECRET_VARIABLE, secret.secret);
|
|
13597
|
+
} catch (error) {
|
|
13598
|
+
throw new CliError({
|
|
13599
|
+
code: error instanceof CliError ? error.code : "internal_error",
|
|
13600
|
+
message: `The secret could not be written to ${path}${error instanceof CliError ? `: ${error.message}` : ""}`,
|
|
13601
|
+
hint: `The secret stays readable: fix the file and run \`deepdock webhooks secret ${webhookId} --write-env <file>\`.`
|
|
13602
|
+
});
|
|
13603
|
+
}
|
|
13604
|
+
return {
|
|
13605
|
+
data: {
|
|
13606
|
+
id: webhookId,
|
|
13607
|
+
secretCreatedAt: secret.createdAt,
|
|
13608
|
+
previousSecretExpiresAt: secret.previousExpiresAt
|
|
13609
|
+
},
|
|
13610
|
+
written: { file: displayPath(ctx.rt, path), name: WEBHOOK_SECRET_VARIABLE }
|
|
13611
|
+
};
|
|
13612
|
+
};
|
|
13613
|
+
var writtenLine = ({ file, name }) => `The signing secret was shown to nobody and this CLI keeps no copy; your code reads ${name} from ${file}.`;
|
|
13614
|
+
var confirmed = async (ctx, verb, question) => {
|
|
13615
|
+
if (ctx.opts.yes)
|
|
13616
|
+
return;
|
|
13617
|
+
if (!ctx.interactive) {
|
|
13618
|
+
throw usageError("This needs a confirmation and there is no terminal.", "Run it again with --yes.");
|
|
13619
|
+
}
|
|
13620
|
+
await ctx.resolveOrg();
|
|
13621
|
+
if (!await confirm(ctx.rt, question)) {
|
|
13622
|
+
throw usageError(`Not ${verb}d.`, "Nothing was changed.");
|
|
13623
|
+
}
|
|
13624
|
+
};
|
|
13625
|
+
var listOf = async (ctx, path, columns, empty) => {
|
|
13626
|
+
const response = await webhookCall(ctx, { method: "GET", path });
|
|
13627
|
+
const items = Array.isArray(response.data) ? response.data : [];
|
|
13628
|
+
return answer(response, items.length === 0 ? empty : genericTable(items, ctx.out, columns));
|
|
13629
|
+
};
|
|
13630
|
+
var get = async (ctx, id) => {
|
|
13631
|
+
const response = await webhookCall(ctx, { method: "GET", path: route(webhookIdArg(id)) });
|
|
13632
|
+
return answer(response, genericView(response.data, ctx.out, WEBHOOK_COLUMNS));
|
|
13633
|
+
};
|
|
13634
|
+
var create2 = async (ctx, url, options) => {
|
|
13635
|
+
const eventTypes = await eventTypesOf(ctx, options);
|
|
13636
|
+
if (eventTypes === undefined) {
|
|
13637
|
+
throw usageError("A webhook needs at least one event type.", "Pass --event <type> (repeatable) or --all-events; `deepdock webhooks events` lists the types.");
|
|
13638
|
+
}
|
|
13639
|
+
const path = options.writeEnv === undefined ? undefined : await secretFile(ctx, options.writeEnv);
|
|
13640
|
+
const created = await webhookCall(ctx, {
|
|
13641
|
+
method: "POST",
|
|
13642
|
+
path: WEBHOOKS_PATH,
|
|
13643
|
+
body: { url, eventTypes, description: options.description }
|
|
13644
|
+
});
|
|
13645
|
+
const id = isRecord(created.data) ? field(created.data, "id") : "";
|
|
13646
|
+
const delivered = path === undefined ? undefined : await deliverSecret(ctx, id, path);
|
|
13647
|
+
return {
|
|
13648
|
+
data: created.data,
|
|
13649
|
+
meta: { requestId: created.requestId, written: delivered?.written },
|
|
13650
|
+
text: [
|
|
13651
|
+
`${paint(ctx.out, "success", "Created")} webhook ${id} for ${stripControl(url)}.`,
|
|
13652
|
+
delivered ? writtenLine(delivered.written) : `Its signing secret is not written anywhere yet: \`deepdock webhooks secret ${id} --write-env <file>\`.`
|
|
13653
|
+
].join(`
|
|
13654
|
+
`)
|
|
13655
|
+
};
|
|
13656
|
+
};
|
|
13657
|
+
var update = async (ctx, id, options) => {
|
|
13658
|
+
const webhookId = webhookIdArg(id);
|
|
13659
|
+
const eventTypes = await eventTypesOf(ctx, options);
|
|
13660
|
+
const body = { url: options.url, description: options.description, eventTypes };
|
|
13661
|
+
if (Object.values(body).every((value) => value === undefined)) {
|
|
13662
|
+
throw usageError("Nothing to change.", "Pass --url, --description, --event or --all-events.");
|
|
13663
|
+
}
|
|
13664
|
+
const response = await webhookCall(ctx, { method: "PATCH", path: route(webhookId), body });
|
|
13665
|
+
return answer(response, `${paint(ctx.out, "success", "Updated")} webhook ${webhookId}.`);
|
|
13666
|
+
};
|
|
13667
|
+
var remove = async (ctx, id) => {
|
|
13668
|
+
const webhookId = webhookIdArg(id);
|
|
13669
|
+
await confirmed(ctx, "delete", `Delete webhook ${webhookId}?
|
|
13670
|
+
Its stored deliveries are deleted with it.`);
|
|
13671
|
+
const response = await webhookCall(ctx, { method: "DELETE", path: route(webhookId) });
|
|
13672
|
+
return answer(response, `${paint(ctx.out, "success", "Deleted")} webhook ${webhookId}.`);
|
|
13673
|
+
};
|
|
13674
|
+
var setActive = async (ctx, id, change) => {
|
|
13675
|
+
const webhookId = webhookIdArg(id);
|
|
13676
|
+
const response = await webhookCall(ctx, { method: "POST", path: route(webhookId, `/${change}`) });
|
|
13677
|
+
const done = change === "enable" ? "Enabled" : "Disabled";
|
|
13678
|
+
return answer(response, `${paint(ctx.out, "success", done)} webhook ${webhookId}.`);
|
|
13679
|
+
};
|
|
13680
|
+
var writeSecret = async (ctx, id, file, rotate) => {
|
|
13681
|
+
const webhookId = webhookIdArg(id);
|
|
13682
|
+
const path = await secretFile(ctx, file);
|
|
13683
|
+
if (rotate) {
|
|
13684
|
+
await confirmed(ctx, "rotate", `Rotate the signing secret of webhook ${webhookId}?
|
|
13685
|
+
The old secret keeps signing for 24 hours next to the new one; update your receiver within that time.`);
|
|
13686
|
+
await webhookCall(ctx, { method: "POST", path: route(webhookId, "/secret/rotate") });
|
|
13687
|
+
}
|
|
13688
|
+
const delivered = await deliverSecret(ctx, webhookId, path);
|
|
13689
|
+
const done = rotate ? "Rotated the signing secret of" : "Wrote the signing secret of";
|
|
13690
|
+
return {
|
|
13691
|
+
data: delivered.data,
|
|
13692
|
+
meta: { written: delivered.written },
|
|
13693
|
+
text: `${paint(ctx.out, "success", done)} webhook ${webhookId}.
|
|
13694
|
+
${writtenLine(delivered.written)}`
|
|
13695
|
+
};
|
|
13696
|
+
};
|
|
13697
|
+
var sendTest = async (ctx, id, type) => {
|
|
13698
|
+
const webhookId = webhookIdArg(id);
|
|
13699
|
+
const response = await webhookCall(ctx, {
|
|
13700
|
+
method: "POST",
|
|
13701
|
+
path: route(webhookId, "/test"),
|
|
13702
|
+
body: { type }
|
|
13703
|
+
}).catch((error) => {
|
|
13704
|
+
if (error instanceof CliError && error.code === "webhook_disabled") {
|
|
13705
|
+
error.hint = `Run \`deepdock webhooks enable ${webhookId}\`, then send the example again.`;
|
|
13706
|
+
}
|
|
13707
|
+
throw error;
|
|
13708
|
+
});
|
|
13709
|
+
const attempt = isRecord(response.data) && isRecord(response.data.attempt) ? response.data.attempt : {};
|
|
13710
|
+
const outcome = field(attempt, "outcome");
|
|
13711
|
+
const status = field(attempt, "statusCode");
|
|
13712
|
+
return answer(response, [
|
|
13713
|
+
`Sent a test ${stripControl(type)} to webhook ${webhookId}: ${paint(ctx.out, outcome === "succeeded" ? "success" : "warn", words(outcome))} (${status ? `HTTP ${status}` : "no HTTP answer"}, ${field(attempt, "durationMs")} ms).`,
|
|
13714
|
+
`Response body: ${stripControl(field(attempt, "responseBody")) || "(empty)"}`,
|
|
13715
|
+
"The example is stored nowhere: it appears in no delivery list."
|
|
13716
|
+
].join(`
|
|
13717
|
+
`));
|
|
13718
|
+
};
|
|
13719
|
+
var registerWebhooks = (program, run) => {
|
|
13720
|
+
const webhooks = program.command("webhooks").description("Webhook endpoints: where Deepdock sends a message when a device sees a change");
|
|
13721
|
+
webhooks.command("list").description("List the webhooks of the organisation").action((_options, cmd) => run(cmd, (ctx) => listOf(ctx, WEBHOOKS_PATH, WEBHOOK_LIST_COLUMNS, "No webhooks. Create one with `deepdock webhooks create <url> --all-events`.")));
|
|
13722
|
+
webhooks.command("get").description("Show one webhook with its seven-day statistics").argument("<id>", "the webhook id").action((id, _options, cmd) => run(cmd, (ctx) => get(ctx, id)));
|
|
13723
|
+
webhooks.command("create").description("Create a webhook (admin)").argument("<url>", "an https URL on port 443 that accepts POST").option("--description <text>", "what the webhook is for, at most 200 characters").option("--event <type>", "an event type to send; repeat the flag for several", collect, []).option("--all-events", "every event type that exists now (not types added later)").option("--write-env <file>", WRITE_ENV).action((url, options, cmd) => run(cmd, (ctx) => create2(ctx, url, options)));
|
|
13724
|
+
webhooks.command("update").description("Change a webhook (admin)").argument("<id>", "the webhook id").option("--url <url>", "the new URL").option("--description <text>", 'the new description; "" clears it').option("--event <type>", "replace the event types; repeat the flag for several", collect, []).option("--all-events", "replace the event types with every type that exists now").action((id, options, cmd) => run(cmd, (ctx) => update(ctx, id, options)));
|
|
13725
|
+
webhooks.command("delete").description("Delete a webhook and its stored deliveries (admin)").argument("<id>", "the webhook id").action((id, _options, cmd) => run(cmd, (ctx) => remove(ctx, id)));
|
|
13726
|
+
for (const [change, description] of [
|
|
13727
|
+
["disable", "Stop sending to a webhook; its waiting deliveries are paused (admin)"],
|
|
13728
|
+
["enable", "Send to a disabled webhook again; its paused deliveries resume (admin)"]
|
|
13729
|
+
]) {
|
|
13730
|
+
webhooks.command(change).description(description).argument("<id>", "the webhook id").action((id, _options, cmd) => run(cmd, (ctx) => setActive(ctx, id, change)));
|
|
13731
|
+
}
|
|
13732
|
+
webhooks.command("secret").description("Write the signing secret of a webhook into an env file (admin)").argument("<id>", "the webhook id").requiredOption("--write-env <file>", WRITE_ENV).action((id, options, cmd) => run(cmd, (ctx) => writeSecret(ctx, id, options.writeEnv, false)));
|
|
13733
|
+
webhooks.command("rotate-secret").description("Make a new signing secret and write it into an env file (admin)").argument("<id>", "the webhook id").requiredOption("--write-env <file>", WRITE_ENV).action((id, options, cmd) => run(cmd, (ctx) => writeSecret(ctx, id, options.writeEnv, true)));
|
|
13734
|
+
webhooks.command("test").description("Send one example message to a webhook now and show the answer (admin)").argument("<id>", "the webhook id").requiredOption("--event <type>", "the event type of the example").action((id, options, cmd) => run(cmd, (ctx) => sendTest(ctx, id, options.event)));
|
|
13735
|
+
webhooks.command("events").description("List the event types you can send to a webhook").action((_options, cmd) => run(cmd, (ctx) => listOf(ctx, EVENT_TYPES_PATH, EVENT_TYPE_COLUMNS, "No event types exist for your organisation yet.")));
|
|
13736
|
+
};
|
|
13737
|
+
|
|
13452
13738
|
// src/output/envelope.ts
|
|
13453
13739
|
var successDoc = (data, meta = {}) => ({ data, meta });
|
|
13454
13740
|
var errorDoc = (error, org) => {
|
|
@@ -13529,7 +13815,7 @@ var buildProgram = (rt, state) => {
|
|
|
13529
13815
|
outputError: () => {
|
|
13530
13816
|
return;
|
|
13531
13817
|
}
|
|
13532
|
-
}).description("Deepdock partner CLI").version(rt.version, "-v, --version", "print the version").addHelpCommand(false).option("--org <slug>", "the organisation to act in").option("--json", "JSON output (the default when stdout is not a terminal)").option("--yes", "answer
|
|
13818
|
+
}).description("Deepdock partner CLI").version(rt.version, "-v, --version", "print the version").addHelpCommand(false).option("--org <slug>", "the organisation to act in").option("--json", "JSON output (the default when stdout is not a terminal)").option("--yes", "answer a confirmation question with yes");
|
|
13533
13819
|
const run = async (cmd, handler) => {
|
|
13534
13820
|
const ctx = createContext(rt, readGlobals(cmd.optsWithGlobals()));
|
|
13535
13821
|
state.ctx = ctx;
|
|
@@ -13565,6 +13851,7 @@ var buildProgram = (rt, state) => {
|
|
|
13565
13851
|
registerActions(program, run);
|
|
13566
13852
|
registerKeys(program, run);
|
|
13567
13853
|
registerIncidents(program, run);
|
|
13854
|
+
registerWebhooks(program, run);
|
|
13568
13855
|
registerSkill(program, run);
|
|
13569
13856
|
program.command("help").description("Help for a command, or `help exit-codes`").argument("[topic...]").action((topic) => {
|
|
13570
13857
|
if (topic.length === 1 && topic[0] === "exit-codes") {
|
|
@@ -13639,7 +13926,7 @@ var toCliError = (error, program, argv) => {
|
|
|
13639
13926
|
var humanError = (rt, error) => {
|
|
13640
13927
|
const style = makeStyler(rt, rt.stderr);
|
|
13641
13928
|
const message = stripControl(error.message).replace(/\.$/, "");
|
|
13642
|
-
const body = error.code === "invalid_input" ? `The device refused the input: "${message}" [${error.code}].` : `${message} [${error.code}].`;
|
|
13929
|
+
const body = error.code === "invalid_input" && error.refusedBy !== "api" ? `The device refused the input: "${message}" [${error.code}].` : `${message} [${error.code}].`;
|
|
13643
13930
|
const lines = [`${style("red", "Error:")} ${body}`];
|
|
13644
13931
|
const tail = [
|
|
13645
13932
|
error.hint,
|
package/package.json
CHANGED
package/skill/references/cli.md
CHANGED
|
@@ -29,6 +29,14 @@ the API key the CLI wrote to the app's env file.
|
|
|
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 |
|
|
31
31
|
| `incidents list` | incidents of the last 30 days | member |
|
|
32
|
+
| `webhooks list` / `webhooks get <id>` / `webhooks events` | the organisation's webhook endpoints; one endpoint with its 7-day statistics; the event types of the triggers assigned to the organisation. Until Deepdock assigns a first trigger, every `webhooks` command fails with `not_found` (exit 2, "Webhooks are not available for this organisation yet"): ask Deepdock | member |
|
|
33
|
+
| `webhooks create <url> (--event <type>... \| --all-events) [--description <text>] [--write-env <file>]` | create an endpoint. `--all-events` sends every assigned type that exists now as an explicit list; a type added later reaches the endpoint only after `webhooks update`. An endpoint always has at least one type, and every type must be one of `webhooks events`: another is refused with `invalid_input` (exit 2) naming it. The signing secret is written as `DEEPDOCK_WEBHOOK_SECRET=<secret>` into the `--write-env` file and shown to nobody; without the flag, fetch it with `webhooks secret` | admin |
|
|
34
|
+
| `webhooks update <id> [--url <url>] [--description <text>] [--event <type>... \| --all-events]` | change what is given; the event types given replace the old ones | admin |
|
|
35
|
+
| `webhooks delete <id>` | delete an endpoint and its stored deliveries (asks on a terminal; `--yes` otherwise) | admin |
|
|
36
|
+
| `webhooks disable <id>` / `webhooks enable <id>` | stop sending; send again and resume what waited | admin |
|
|
37
|
+
| `webhooks secret <id> --write-env <file>` | write the signing secret into the file | admin |
|
|
38
|
+
| `webhooks rotate-secret <id> --write-env <file>` | make a new signing secret and write it; the old one signs for 24 more hours (asks on a terminal; `--yes` otherwise) | admin |
|
|
39
|
+
| `webhooks test <id> --event <type>` | send one example now; answers `data.attempt` (`outcome`, `statusCode`, `durationMs`, `responseBody`, the receiver's first KiB). Nothing is stored. Exit 0 means the example was sent, `outcome` says what the receiver did; `webhook_disabled` (exit 2) on a disabled endpoint | admin |
|
|
32
40
|
| `skill [--agent claude\|codex\|cursor\|all]` | writes this skill into the current repository | anyone |
|
|
33
41
|
|
|
34
42
|
Every command that acts in an organisation uses `--org <slug>` after the command, else
|
|
@@ -69,7 +77,8 @@ stdout:
|
|
|
69
77
|
`data` is what the API answered, so what you see is what your code will receive. `meta` holds the
|
|
70
78
|
organisation the command acted in, the request id, and, where it applies, `written` (`{ file,
|
|
71
79
|
name }` from `keys create`) and `pending` (from `--no-wait`). `keys create` builds its `data` from
|
|
72
|
-
id, name, prefix, createdAt and expiresAt; the key value is in neither stream.
|
|
80
|
+
id, name, prefix, createdAt and expiresAt; the key value is in neither stream. `webhooks secret` and
|
|
81
|
+
`webhooks rotate-secret` build theirs from id, secretCreatedAt and previousSecretExpiresAt; the secret is in neither stream.
|
|
73
82
|
|
|
74
83
|
A failure is one document on stderr: the API's error object unchanged plus what to do:
|
|
75
84
|
|
|
@@ -92,7 +101,7 @@ Branch on the exit code or on `error.code`, never on `message`.
|
|
|
92
101
|
|
|
93
102
|
## What the CLI never does
|
|
94
103
|
|
|
95
|
-
- It never prints a key value, neither the sign-in nor an API key, under any flag.
|
|
104
|
+
- It never prints a key value or a webhook signing secret, neither the sign-in nor an API key, under any flag.
|
|
96
105
|
- It never runs an action and never holds an API key: `actions list` shows what a device offers;
|
|
97
106
|
your code runs the actions.
|
|
98
107
|
- It never names a device by label or picks one for you: a device is its full id, every time.
|
|
@@ -137,7 +137,12 @@ export type ActionState =
|
|
|
137
137
|
| {
|
|
138
138
|
action: string
|
|
139
139
|
state: 'paused'
|
|
140
|
-
reason:
|
|
140
|
+
reason:
|
|
141
|
+
| 'structure_changed'
|
|
142
|
+
| 'readback_failed'
|
|
143
|
+
| 'credentials_rejected'
|
|
144
|
+
| 'certificate_changed'
|
|
145
|
+
| 'http_signin_changed'
|
|
141
146
|
pausedAt: string
|
|
142
147
|
}
|
|
143
148
|
| {
|
|
@@ -72,6 +72,7 @@ has a display `label` (may be `null`), a `version` the device reported (may be a
|
|
|
72
72
|
| pause `reason` | `readback_failed` | a write's result did not match, so nothing was saved | wait; tell the user the change was not saved |
|
|
73
73
|
| pause `reason` | `credentials_rejected` | the program no longer accepts the sign-in the device stored for it (for example a changed password) | tell the user to choose "Anmeldung erneuern" (Renew sign-in) in the Deepdock client; the action resumes by itself once the new sign-in works, nothing to resume |
|
|
74
74
|
| pause `reason` | `certificate_changed` | the program's server certificate is not the one the device accepted at sign-in | tell the user to choose "Anmeldung erneuern" (Renew sign-in) in the Deepdock client, compare the fingerprint it shows and sign in again; the action resumes by itself, nothing to resume |
|
|
75
|
+
| pause `reason` | `http_signin_changed` | the program's sign-in answered in a way the device's recorded sign-in does not describe, and it is not a refused credential; the device stops signing in | wait; nothing to do on your side or the customer's: Deepdock reviews and resumes, and renewing the sign-in does not lift it |
|
|
75
76
|
| pause `reason` | `system_stopped`, `system_missing` | as the system statuses above; these need no resume and clear when the system is back | as above |
|
|
76
77
|
|
|
77
78
|
Switch on these values; any value you do not know is shown as it is.
|
|
@@ -10,6 +10,11 @@ An `invalid_input` that refuses an action call's input also carries `fields`: ev
|
|
|
10
10
|
failed, as `{ "field", "message" }`, sorted by name, at most 32. It is absent when the body is not
|
|
11
11
|
an object at all. No message holds the value you sent.
|
|
12
12
|
|
|
13
|
+
A write that refuses one element of a list input (with a refusal the action declares, or
|
|
14
|
+
`not_found` or `too_many_rows`) names that element in `fields`: `list[index].field` when the
|
|
15
|
+
refusing step names a field of the element, else `list[index]`, with a zero-based `index`. It is
|
|
16
|
+
absent when the refusal cannot name an input or an element.
|
|
17
|
+
|
|
13
18
|
Reaction columns: **Retry** says whether the same request may be sent again (for a write, always
|
|
14
19
|
with the **same** `Idempotency-Key`); **Show** says what the end user should see.
|
|
15
20
|
|
|
@@ -27,7 +32,15 @@ with the **same** `Idempotency-Key`); **Show** says what the end user should see
|
|
|
27
32
|
|
|
28
33
|
`cli_outdated` (400) is in the enum but answered only to the Deepdock CLI (by its
|
|
29
34
|
`X-Deepdock-Cli` version), so your own `/v1` code never receives it. The dashboard tree's own codes
|
|
30
|
-
(`organisation_required`, `forbidden`, `conflict`, `already_member`) are not in the `/v1` enum.
|
|
35
|
+
(`organisation_required`, `forbidden`, `conflict`, `already_member`, `webhook_disabled`) are not in the `/v1` enum.
|
|
36
|
+
|
|
37
|
+
The webhook routes (`/partner/webhooks*`, `/partner/webhook-event-types`) answer differently until Deepdock assigns a
|
|
38
|
+
trigger to your organisation: `404 not_found` on every one of them, as for a route that does not exist. The CLI says
|
|
39
|
+
"Webhooks are not available for this organisation yet" (exit 2, `error.code` stays `not_found`); do not retry, ask
|
|
40
|
+
Deepdock to assign the triggers you need. A `404 not_found` on one webhook once a trigger is assigned means that webhook
|
|
41
|
+
does not exist. After the first assignment, an endpoint that names an event type that is not one of yours (a trigger not
|
|
42
|
+
assigned to you, or no such type) is refused with `422 invalid_input` and `fields` naming `eventTypes[<index>]`; the CLI
|
|
43
|
+
names the types and points to `webhooks events`.
|
|
31
44
|
|
|
32
45
|
## Device, system and action resolution
|
|
33
46
|
|