@fleetless/contracts 13.3.0 → 15.0.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 +304 -0
- package/artifacts/openapi.json +20156 -10513
- package/artifacts/routes.json +1429 -292
- package/artifacts/schema/access-warning.schema.json +51 -0
- package/artifacts/schema/action-config.schema.json +35 -0
- package/artifacts/schema/addon-catalogue-entry.schema.json +3 -1
- package/artifacts/schema/admin-plan-change-request.schema.json +26 -0
- package/artifacts/schema/app-access-response.schema.json +136 -0
- package/artifacts/schema/app-access.schema.json +80 -0
- package/artifacts/schema/app-deletion-summary.schema.json +15 -8
- package/artifacts/schema/app-invitation-list-response.schema.json +13 -6
- package/artifacts/schema/app-invitation.schema.json +5 -5
- package/artifacts/schema/app-list-response.schema.json +6 -6
- package/artifacts/schema/app-lock.schema.json +30 -0
- package/artifacts/schema/app-user-list-response.schema.json +13 -6
- package/artifacts/schema/app-user.schema.json +13 -6
- package/artifacts/schema/app.schema.json +6 -6
- package/artifacts/schema/asset-plan-limit-details.schema.json +3 -1
- package/artifacts/schema/auth-ok.schema.json +20 -6
- package/artifacts/schema/camera-list-response.schema.json +1 -1
- package/artifacts/schema/client-identity.schema.json +21 -6
- package/artifacts/schema/cloud-config.schema.json +359 -5
- package/artifacts/schema/collection-actor.schema.json +35 -0
- package/artifacts/schema/collection-definitions-response.schema.json +612 -0
- package/artifacts/schema/collection-event.schema.json +216 -0
- package/artifacts/schema/collection-export-query.schema.json +56 -0
- package/artifacts/schema/collection-filter.schema.json +9 -0
- package/artifacts/schema/collection-import-preview.schema.json +143 -0
- package/artifacts/schema/collection-import-request.schema.json +105 -0
- package/artifacts/schema/collection-import-result.schema.json +38 -0
- package/artifacts/schema/collection-list-response.schema.json +119 -0
- package/artifacts/schema/collection-record-get-query.schema.json +12 -0
- package/artifacts/schema/collection-record-history-query.schema.json +35 -0
- package/artifacts/schema/collection-record-history-response.schema.json +389 -0
- package/artifacts/schema/collection-record-list-query.schema.json +67 -0
- package/artifacts/schema/collection-record-list-response.schema.json +212 -0
- package/artifacts/schema/collection-record-restore-request.schema.json +14 -0
- package/artifacts/schema/collection-record-write.schema.json +31 -0
- package/artifacts/schema/collection-record.schema.json +180 -0
- package/artifacts/schema/collection-revision.schema.json +295 -0
- package/artifacts/schema/collection-subscribe-error.schema.json +31 -0
- package/artifacts/schema/collection-subscribe.schema.json +48 -0
- package/artifacts/schema/collection-subscribed.schema.json +22 -0
- package/artifacts/schema/collection-summary.schema.json +92 -0
- package/artifacts/schema/collection-unsubscribe.schema.json +22 -0
- package/artifacts/schema/collections-access-change.schema.json +34 -0
- package/artifacts/schema/collections-document.schema.json +732 -0
- package/artifacts/schema/collections-draft-response.schema.json +845 -0
- package/artifacts/schema/collections-effect.schema.json +384 -0
- package/artifacts/schema/collections-issue.schema.json +36 -0
- package/artifacts/schema/collections-publish-request.schema.json +18 -0
- package/artifacts/schema/collections-publish-response.schema.json +450 -0
- package/artifacts/schema/collections-purge-preview.schema.json +60 -0
- package/artifacts/schema/collections-purge-request.schema.json +27 -0
- package/artifacts/schema/collections-purge-response.schema.json +30 -0
- package/artifacts/schema/collections-restore-preview-query.schema.json +20 -0
- package/artifacts/schema/collections-restore-preview.schema.json +581 -0
- package/artifacts/schema/collections-restore-request.schema.json +27 -0
- package/artifacts/schema/collections-restore-response.schema.json +455 -0
- package/artifacts/schema/collections-schema-preview.schema.json +519 -0
- package/artifacts/schema/collections-schema-published.schema.json +22 -0
- package/artifacts/schema/collections-version-response.schema.json +869 -0
- package/artifacts/schema/collections-version-summary.schema.json +139 -0
- package/artifacts/schema/collections-versions-response.schema.json +167 -0
- package/artifacts/schema/config-draft-response.schema.json +359 -5
- package/artifacts/schema/config-version-response.schema.json +359 -5
- package/artifacts/schema/confirmation-required-details.schema.json +13 -0
- package/artifacts/schema/create-app-invitation-request.schema.json +4 -4
- package/artifacts/schema/create-app-user-request.schema.json +4 -4
- package/artifacts/schema/create-org-role-request.schema.json +33 -0
- package/artifacts/schema/dangling-reference.schema.json +130 -0
- package/artifacts/schema/datapoint-config.schema.json +35 -0
- package/artifacts/schema/datapoint-list-response.schema.json +2 -2
- package/artifacts/schema/effective-capability.schema.json +104 -0
- package/artifacts/schema/effective-rights-query.schema.json +19 -0
- package/artifacts/schema/effective-rights-response.schema.json +396 -0
- package/artifacts/schema/effective-robot-rights.schema.json +266 -0
- package/artifacts/schema/invoke-or-service-response.schema.json +1 -1
- package/artifacts/schema/invoke-response.schema.json +1 -1
- package/artifacts/schema/journal-intent-v2-body.schema.json +74 -0
- package/artifacts/schema/journal-intent-v2.schema.json +84 -0
- package/artifacts/schema/journal-replay-receipt-body.schema.json +1 -0
- package/artifacts/schema/journal-replay-receipt.schema.json +1 -0
- package/artifacts/schema/mcp-robot-datasheet.schema.json +2 -2
- package/artifacts/schema/org-plan.schema.json +29 -1
- package/artifacts/schema/org-quota-usage-counts.schema.json +18 -0
- package/artifacts/schema/org-quota-usage.schema.json +47 -1
- package/artifacts/schema/org-quotas.schema.json +29 -1
- package/artifacts/schema/org-role-list-response.schema.json +206 -0
- package/artifacts/schema/org-role.schema.json +59 -0
- package/artifacts/schema/patch-app-user-request.schema.json +4 -4
- package/artifacts/schema/patch-org-role-request.schema.json +38 -0
- package/artifacts/schema/plan-catalogue-entry.schema.json +29 -1
- package/artifacts/schema/plan-change-decision-status-response.schema.json +29 -1
- package/artifacts/schema/plan-limit-details.schema.json +3 -1
- package/artifacts/schema/plan-limits.schema.json +29 -1
- package/artifacts/schema/plan-overrides.schema.json +26 -0
- package/artifacts/schema/publish-config-response.schema.json +48 -1
- package/artifacts/schema/publisher-config.schema.json +35 -0
- package/artifacts/schema/put-collections-draft-request.schema.json +16 -0
- package/artifacts/schema/put-role-defaults-request.schema.json +127 -0
- package/artifacts/schema/record-changed-details.schema.json +16 -0
- package/artifacts/schema/record-referenced-details.schema.json +35 -0
- package/artifacts/schema/reference-invalid-details.schema.json +25 -0
- package/artifacts/schema/reference-place.schema.json +112 -0
- package/artifacts/schema/rename-slug-response.schema.json +4 -3
- package/artifacts/schema/required-missing-details.schema.json +19 -0
- package/artifacts/schema/robot-config-doc.schema.json +359 -5
- package/artifacts/schema/robot-deletion-summary.schema.json +33 -1
- package/artifacts/schema/role-collection-rights.schema.json +82 -0
- package/artifacts/schema/role-cycle-details.schema.json +18 -0
- package/artifacts/schema/role-defaults-response.schema.json +59 -0
- package/artifacts/schema/role-rename-preview.schema.json +147 -0
- package/artifacts/schema/service-config.schema.json +35 -0
- package/artifacts/schema/slug-usage-response.schema.json +4 -3
- package/artifacts/schema/update-app-request.schema.json +0 -12
- package/dist/app-users.d.ts +11 -8
- package/dist/app-users.js +18 -10
- package/dist/apps.d.ts +258 -71
- package/dist/apps.js +215 -151
- package/dist/audit.d.ts +35 -5
- package/dist/audit.js +40 -2
- package/dist/billing.d.ts +10 -10
- package/dist/client-auth.d.ts +5 -2
- package/dist/client-auth.js +11 -3
- package/dist/client-robots.d.ts +1 -1
- package/dist/client-robots.js +1 -1
- package/dist/collections-issues.d.ts +67 -0
- package/dist/collections-issues.js +340 -0
- package/dist/collections-records.d.ts +562 -0
- package/dist/collections-records.js +525 -0
- package/dist/collections-rights.d.ts +17 -0
- package/dist/collections-rights.js +41 -0
- package/dist/collections-schema.d.ts +1064 -0
- package/dist/collections-schema.js +386 -0
- package/dist/collections-templates.d.ts +55 -0
- package/dist/collections-templates.js +137 -0
- package/dist/collections-transfer.d.ts +101 -0
- package/dist/collections-transfer.js +206 -0
- package/dist/collections-values.d.ts +67 -0
- package/dist/collections-values.js +284 -0
- package/dist/collections.d.ts +568 -0
- package/dist/collections.js +332 -0
- package/dist/common.d.ts +1 -1
- package/dist/common.js +1 -1
- package/dist/config-issues.d.ts +1 -1
- package/dist/config-issues.js +1 -1
- package/dist/config.d.ts +78 -12
- package/dist/config.js +109 -15
- package/dist/errors.d.ts +63 -5
- package/dist/errors.js +152 -24
- package/dist/index.d.ts +40 -14
- package/dist/index.js +27 -7
- package/dist/journal-intents.d.ts +30 -0
- package/dist/journal-intents.js +3 -0
- package/dist/legal-acceptances.d.ts +2 -2
- package/dist/mcp.d.ts +5 -37
- package/dist/mcp.js +4 -14
- package/dist/org-roles.d.ts +186 -0
- package/dist/org-roles.js +199 -0
- package/dist/plans.d.ts +25 -7
- package/dist/plans.js +21 -1
- package/dist/protocol.d.ts +19 -1
- package/dist/realtime.d.ts +172 -3
- package/dist/realtime.js +164 -1
- package/dist/rest.d.ts +104 -53
- package/dist/rest.js +79 -55
- package/dist/rights.d.ts +197 -0
- package/dist/rights.js +396 -0
- package/dist/routes.d.ts +1 -1
- package/dist/routes.js +675 -150
- package/package.json +1 -1
- package/artifacts/schema/mcp-role-preview-response.schema.json +0 -134
- package/artifacts/schema/put-robot-details-request.schema.json +0 -41
- package/artifacts/schema/put-robot-details-response.schema.json +0 -43
- package/artifacts/schema/robot-details-doc.schema.json +0 -33
- package/artifacts/schema/role-delete-query.schema.json +0 -13
- package/artifacts/schema/role-in-use-details.schema.json +0 -28
- package/artifacts/schema/role-list-response.schema.json +0 -48
- package/artifacts/schema/role-permissions.schema.json +0 -61
- package/artifacts/schema/role-rename-request.schema.json +0 -16
- package/artifacts/schema/role.schema.json +0 -35
package/dist/config.js
CHANGED
|
@@ -9,6 +9,7 @@ import { applyError, slug, rosName, rosTypeName, fieldPath, SLUG_RULE, ROS_NAME_
|
|
|
9
9
|
* into this file once `alerts.ts` retires.
|
|
10
10
|
*/
|
|
11
11
|
import { alertSeverity } from './alerts.js';
|
|
12
|
+
import { ENTRY_KINDS, roleRef } from './rights.js';
|
|
12
13
|
/**
|
|
13
14
|
* The exposure model: what a developer configures per robot, how a
|
|
14
15
|
* configuration moves from draft to published, and how the cloud reports what
|
|
@@ -359,6 +360,16 @@ const param = (name) => `\\\${${name}}`;
|
|
|
359
360
|
* of `a: ${2:x}` / `b: ${5:y}` visits `2` then `5`.
|
|
360
361
|
*/
|
|
361
362
|
const underSlug = (slugKey, snippet) => ({ ...snippet, body: { [slugKey]: snippet.body } });
|
|
363
|
+
/**
|
|
364
|
+
* `role` on an exposed entry: who may use it. The same field on all five kinds,
|
|
365
|
+
* so one helper writes the sentence and each kind names what using it means.
|
|
366
|
+
*
|
|
367
|
+
* It is the cloud's alone: the bridge is sent the stored document and ignores
|
|
368
|
+
* `role` and `access` altogether.
|
|
369
|
+
*/
|
|
370
|
+
const entryRole = (use, kind) => roleRef.meta({
|
|
371
|
+
description: `Which role may ${use}: one role key, or a list of keys when several roles qualify. A role qualifies when it, or a role it inherits from, is named. Without this, the first rule of \`access.rules\` that fits the entry decides, and without a fitting rule the organization's default for \`${kind}\` applies. A key that names no role of the organization is a warning when you publish, never an error, and grants nothing. The robot ignores it; the cloud enforces it.`,
|
|
372
|
+
});
|
|
362
373
|
/**
|
|
363
374
|
* What an exposed service *is*, in the developer's own words.
|
|
364
375
|
*
|
|
@@ -647,14 +658,18 @@ export const parameterMap = slugKeyed(parameterSpec)
|
|
|
647
658
|
* sections at once** — slugs are one namespace, so a name reserved here is
|
|
648
659
|
* reserved everywhere.
|
|
649
660
|
*
|
|
650
|
-
* The first
|
|
651
|
-
*
|
|
652
|
-
*
|
|
653
|
-
*
|
|
654
|
-
*
|
|
655
|
-
*
|
|
656
|
-
*
|
|
657
|
-
*
|
|
661
|
+
* The first is a built-in: the cloud already publishes something under it,
|
|
662
|
+
* so a configured entry would be a second producer for one name. The other
|
|
663
|
+
* three are reserved for a different reason and are not built-ins — nothing
|
|
664
|
+
* publishes them. `assets` and `job_history` are the robot-level capabilities
|
|
665
|
+
* a role can be required for and an app can lock; an entry of the same name
|
|
666
|
+
* would leave a capability's `name` ambiguous between an exposure and the
|
|
667
|
+
* robot as a whole. `history` is reserved because
|
|
668
|
+
* `GET /api/robots/:id/jobs/history` is a **literal sibling** of
|
|
669
|
+
* `GET /api/robots/:id/jobs/:slug`, so an action or service named `history`
|
|
670
|
+
* would have a job route no caller could ever reach. Reserving the name is the
|
|
671
|
+
* honest half of that: the alternative is a slug the format accepts and one
|
|
672
|
+
* route silently cannot address.
|
|
658
673
|
*
|
|
659
674
|
* **This constant is the only list.** The cloud builds its set from it and
|
|
660
675
|
* emits `reserved_slug`; the rename path reads it for the target; an editor
|
|
@@ -671,7 +686,7 @@ export const parameterMap = slugKeyed(parameterSpec)
|
|
|
671
686
|
* ships those sentences to readers who have only the JSON Schema, and
|
|
672
687
|
* "here" would have promised them a refusal this parse does not make.
|
|
673
688
|
*/
|
|
674
|
-
export const RESERVED_SLUGS = ['bridge_state', '
|
|
689
|
+
export const RESERVED_SLUGS = ['bridge_state', 'history', 'assets', 'job_history'];
|
|
675
690
|
/**
|
|
676
691
|
* When an alert fires and when it is ok again. There is no discriminator:
|
|
677
692
|
* `resolve_at` absent means equality, present means a threshold whose
|
|
@@ -1107,6 +1122,7 @@ export const datapointConfig = strictObject({
|
|
|
1107
1122
|
*/
|
|
1108
1123
|
defaultSnippets: [underSlug('${1:battery_low}', ALERT_SNIPPET)],
|
|
1109
1124
|
}).optional(),
|
|
1125
|
+
role: entryRole('read this datapoint', 'read').optional(),
|
|
1110
1126
|
})
|
|
1111
1127
|
.superRefine((d, ctx) => {
|
|
1112
1128
|
if (d.field !== undefined)
|
|
@@ -1355,6 +1371,7 @@ export const actionConfig = strictObject({
|
|
|
1355
1371
|
description: 'What this action does, in the developer\'s own words — documentation for the console and for MCP clients, which is all it is: the robot does nothing with it. It is carried verbatim into `robots.describe` and read by a model that has never seen this robot. The action is offered whenever the role grants it; without one it is offered with `description: null`, and the model has nothing but the slug.',
|
|
1356
1372
|
examples: ['Drives to a target pose on the map.'],
|
|
1357
1373
|
}),
|
|
1374
|
+
role: entryRole('start this action', 'invoke').optional(),
|
|
1358
1375
|
}).meta({
|
|
1359
1376
|
/** The value position of one entry — `navigate: ▮` under `actions:`. */
|
|
1360
1377
|
defaultSnippets: [ACTION_SNIPPET],
|
|
@@ -1392,6 +1409,7 @@ export const serviceConfig = strictObject({
|
|
|
1392
1409
|
description: 'What this service does, in the developer\'s own words. The robot does nothing with it — the readers are the console and MCP clients, and without one the service is still offered, with `description: null`, exactly as for an action. It sits on the configuration rather than on the app, so one wording is true for every app that reaches this robot.',
|
|
1393
1410
|
examples: ['Resets odometry to the origin.'],
|
|
1394
1411
|
}),
|
|
1412
|
+
role: entryRole('call this service', 'invoke').optional(),
|
|
1395
1413
|
}).meta({
|
|
1396
1414
|
/** The value position of one entry — `reset_odometry: ▮` under `services:`. */
|
|
1397
1415
|
defaultSnippets: [SERVICE_SNIPPET],
|
|
@@ -1519,6 +1537,7 @@ export const publisherConfig = strictObject({
|
|
|
1519
1537
|
description: 'What sending to this publisher does, in the developer\'s own words. It is documentation for the console and for MCP clients — the robot does nothing with it — and as for actions and services, the publisher is offered whether or not one is written, with `description: null` when it is not. A caller sends here repeatedly and continuously rather than once, which is why this kind alone carries `failsafe` and `quiet_timeout_ms`.',
|
|
1520
1538
|
examples: ['Velocity command. If sending stops, the robot stops.'],
|
|
1521
1539
|
}),
|
|
1540
|
+
role: entryRole('send to this publisher, which is what driving the robot is', 'publish').optional(),
|
|
1522
1541
|
}).meta({
|
|
1523
1542
|
/** The value position of one entry — `drive: ▮` under `publishers:`. */
|
|
1524
1543
|
defaultSnippets: [PUBLISHER_SNIPPET],
|
|
@@ -1856,6 +1875,7 @@ export const cameraConfig = strictObject({
|
|
|
1856
1875
|
description: 'What this camera shows, in the developer\'s own words — documentation for whoever reads the configuration, for the console and for MCP clients; the robot does nothing with it. A camera without one is still offered, with `description: null`, as for actions, services and publishers. What `camera.snapshot` serves is the latest snapshot with its age; a live session is never a tool.',
|
|
1857
1876
|
examples: ['Forward-facing camera on the mast.'],
|
|
1858
1877
|
}),
|
|
1878
|
+
role: entryRole('see this camera', 'read').optional(),
|
|
1859
1879
|
}).meta({
|
|
1860
1880
|
/** The value position of one entry — `front: ▮` under `cameras:`. */
|
|
1861
1881
|
defaultSnippets: [CAMERA_SNIPPET],
|
|
@@ -1930,6 +1950,72 @@ export const lowBandwidthSection = strictObject({
|
|
|
1930
1950
|
*/
|
|
1931
1951
|
export const FLEETLESS_FORMAT_VERSION = 1;
|
|
1932
1952
|
const capped = (entry, max, what) => slugKeyed(entry).refine((m) => Object.keys(m).length <= max, { message: `at most ${max} ${what}` });
|
|
1953
|
+
/**
|
|
1954
|
+
* What a rule's `match` means, said in words. Beside its pattern, on the same
|
|
1955
|
+
* rule as the other grammars that exist only inside a configuration document:
|
|
1956
|
+
* one constant, read as the parser's message and as the JSON Schema's
|
|
1957
|
+
* `patternErrorMessage`.
|
|
1958
|
+
*/
|
|
1959
|
+
const ROS_GLOB_RULE = 'A match pattern is an absolute ROS graph name in which `*` stands for any characters inside one segment and `**` for any number of whole segments — `/arm/**`, `/diagnostics/*`, `/joint_*`. It begins with a slash. A relative pattern, a trailing slash, a dash, a dot, or `**` mixed into a longer segment is refused.';
|
|
1960
|
+
/**
|
|
1961
|
+
* Segments of ROS-name characters and `*`; a segment of `**` stands alone. The
|
|
1962
|
+
* look-ahead keeps `**` out of any longer segment, and looks no further than
|
|
1963
|
+
* the segment it is in.
|
|
1964
|
+
*/
|
|
1965
|
+
const rosGlob = z
|
|
1966
|
+
.string()
|
|
1967
|
+
.max(255)
|
|
1968
|
+
.regex(/^(?:\/(?:\*\*|(?![A-Za-z0-9_*]*\*\*)(?:\*|[A-Za-z_])[A-Za-z0-9_*]*))+$/, ROS_GLOB_RULE);
|
|
1969
|
+
const ruleKind = z.enum(ENTRY_KINDS);
|
|
1970
|
+
/**
|
|
1971
|
+
* One rule of `access.rules`: a role for every entry whose ROS name fits.
|
|
1972
|
+
*
|
|
1973
|
+
* Rules are ordered and the first one that fits an entry decides, so a narrow
|
|
1974
|
+
* rule goes above a wide one. An entry's own `role` is not consulted against
|
|
1975
|
+
* rules at all — it wins outright — and a rule never touches `assets` or
|
|
1976
|
+
* `job_history`, which are the robot's and say so under `access`.
|
|
1977
|
+
*/
|
|
1978
|
+
export const accessRule = strictObject({
|
|
1979
|
+
match: rosGlob.meta({
|
|
1980
|
+
description: 'A glob over the ROS name an entry is exposed by: the `topic` of a datapoint or a publisher, the `ros_name` of a service or an action, the source topic of a camera that reads a ROS topic. `*` stands for one name segment, or for any characters inside one (`/joint_*`); `**` stands for any number of segments, none included, so `/arm/**` fits `/arm` and everything below it. Always absolute.',
|
|
1981
|
+
patternErrorMessage: ROS_GLOB_RULE,
|
|
1982
|
+
}),
|
|
1983
|
+
kinds: z.array(ruleKind.meta({
|
|
1984
|
+
enumDescriptions: describeValues(ruleKind.options, {
|
|
1985
|
+
read: 'Datapoints and cameras: seeing what the robot reports.',
|
|
1986
|
+
invoke: 'Services and actions: asking the robot to do something.',
|
|
1987
|
+
publish: 'Publishers: sending to the robot, which is what driving it is.',
|
|
1988
|
+
}),
|
|
1989
|
+
})).min(1).max(ENTRY_KINDS.length).meta({
|
|
1990
|
+
description: 'Narrows the rule to some kinds of access. Without it the rule fits entries of every kind.',
|
|
1991
|
+
}).optional(),
|
|
1992
|
+
role: roleRef.meta({
|
|
1993
|
+
description: 'The role that may use what this rule fits: one key, or a list of keys when several roles qualify. A role qualifies when it, or a role it inherits from, is named. A key that names no role of the organization is a warning when you publish and grants nothing.',
|
|
1994
|
+
}),
|
|
1995
|
+
});
|
|
1996
|
+
/**
|
|
1997
|
+
* The rights a robot's document sets beyond the `role` of single entries.
|
|
1998
|
+
*
|
|
1999
|
+
* `assets` and `job_history` are the robot's own capabilities and have no ROS
|
|
2000
|
+
* name, so rules cannot reach them; they are named here, one role or a list
|
|
2001
|
+
* each, and without them the organization's default applies.
|
|
2002
|
+
*/
|
|
2003
|
+
export const accessSection = strictObject({
|
|
2004
|
+
rules: z.array(accessRule).max(100, 'at most 100 rules').meta({
|
|
2005
|
+
description: 'Ordered rules that give a role to every entry whose ROS name fits `match`, so a whole namespace is covered by one line. For an entry the order of precedence is its own `role`, then the first rule that fits it, then the organization\'s default for its kind. A rule that fits no entry of this document is a warning and changes nothing.',
|
|
2006
|
+
defaultSnippets: [{
|
|
2007
|
+
label: 'a rule over a namespace',
|
|
2008
|
+
description: 'Gives everything under `/arm` to one role. The first rule that fits an entry decides, so a narrower rule goes above a wider one.',
|
|
2009
|
+
body: [{ match: '${1:/arm/**}', role: '${2:admin}' }],
|
|
2010
|
+
}],
|
|
2011
|
+
}).optional(),
|
|
2012
|
+
assets: roleRef.meta({
|
|
2013
|
+
description: 'Who may use this robot\'s asset store — the meshes and the URDF a viewer draws it from — in place of the organization\'s default for `assets`. One role key, or a list of keys.',
|
|
2014
|
+
}).optional(),
|
|
2015
|
+
job_history: roleRef.meta({
|
|
2016
|
+
description: 'Who may read this robot\'s job history, in place of the organization\'s default for `job_history`. One role key, or a list of keys. A run names the person who started it, so whoever may read the history learns who else has been driving the robot.',
|
|
2017
|
+
}).optional(),
|
|
2018
|
+
});
|
|
1933
2019
|
/**
|
|
1934
2020
|
* A whole robot configuration — everything configurable about one robot.
|
|
1935
2021
|
*
|
|
@@ -1938,7 +2024,7 @@ const capped = (entry, max, what) => slugKeyed(entry).refine((m) => Object.keys(
|
|
|
1938
2024
|
* rule somebody has to write, and the name reads as the entry's heading.
|
|
1939
2025
|
*
|
|
1940
2026
|
* Slugs remain ONE namespace across all five exposure sections, which
|
|
1941
|
-
* is what lets
|
|
2027
|
+
* is what lets an app lock name `{robot, slug}` without naming a kind. That
|
|
1942
2028
|
* check spans sections and therefore lives in the cloud, not here.
|
|
1943
2029
|
*/
|
|
1944
2030
|
export const robotConfigDoc = strictObject({
|
|
@@ -1950,28 +2036,36 @@ export const robotConfigDoc = strictObject({
|
|
|
1950
2036
|
defaultSnippets: [underSlug('${1:drive}', SHARED_MESSAGE_SNIPPET)],
|
|
1951
2037
|
}).optional(),
|
|
1952
2038
|
datapoints: capped(datapointConfig, 200, 'datapoints').meta({
|
|
1953
|
-
description: 'Values the robot publishes, each one field of one topic or a whole topic, and **never several topics**. Keys are slugs, one namespace across all five exposure sections, which is what lets
|
|
2039
|
+
description: 'Values the robot publishes, each one field of one topic or a whole topic, and **never several topics**. Keys are slugs, one namespace across all five exposure sections, which is what lets an app lock name `{robot, slug}` without naming a kind; `bridge_state` is built-in, `history` is reserved because `GET …/jobs/history` would shadow an action of that name, and `assets` and `job_history` are reserved because they name the robot-level capabilities; all four are refused when the document is validated.',
|
|
1954
2040
|
defaultSnippets: [
|
|
1955
2041
|
underSlug('${1:battery_voltage}', DATAPOINT_SNIPPET),
|
|
1956
2042
|
underSlug('${1:battery}', NUMERIC_DATAPOINT_SNIPPET),
|
|
1957
2043
|
],
|
|
1958
2044
|
}).optional(),
|
|
1959
2045
|
actions: capped(actionConfig, 200, 'actions').meta({
|
|
1960
|
-
description: 'Things the robot does on request that take time, each reported as a job with progress. **At most one job runs per action slug**: a second call is refused `busy`, and every observer of that slug watches the same job. Keys are slugs, one namespace across all five exposure sections, which is what lets
|
|
2046
|
+
description: 'Things the robot does on request that take time, each reported as a job with progress. **At most one job runs per action slug**: a second call is refused `busy`, and every observer of that slug watches the same job. Keys are slugs, one namespace across all five exposure sections, which is what lets an app lock name `{robot, slug}` without naming a kind; `bridge_state` is built-in, `history` is reserved because `GET …/jobs/history` would shadow an action of that name, and `assets` and `job_history` are reserved because they name the robot-level capabilities; all four are refused when the document is validated.',
|
|
1961
2047
|
defaultSnippets: [underSlug('${1:navigate}', ACTION_SNIPPET)],
|
|
1962
2048
|
}).optional(),
|
|
1963
2049
|
services: capped(serviceConfig, 200, 'services').meta({
|
|
1964
|
-
description: 'ROS service calls the robot answers — one request, one reply. Unlike an action a service reports **no progress** and the call returns with its result already on the job, so there is nothing left to observe; a second concurrent call is still refused `busy`, exactly as for an action. Keys are slugs, one namespace across all five exposure sections, which is what lets
|
|
2050
|
+
description: 'ROS service calls the robot answers — one request, one reply. Unlike an action a service reports **no progress** and the call returns with its result already on the job, so there is nothing left to observe; a second concurrent call is still refused `busy`, exactly as for an action. Keys are slugs, one namespace across all five exposure sections, which is what lets an app lock name `{robot, slug}` without naming a kind; `bridge_state` is built-in, `history` is reserved because `GET …/jobs/history` would shadow an action of that name, and `assets` and `job_history` are reserved because they name the robot-level capabilities; all four are refused when the document is validated.',
|
|
1965
2051
|
defaultSnippets: [underSlug('${1:reset_odometry}', SERVICE_SNIPPET)],
|
|
1966
2052
|
}).optional(),
|
|
1967
2053
|
publishers: capped(publisherConfig, 200, 'publishers').meta({
|
|
1968
|
-
description: 'Topics clients may send to, and where the format\'s whole safety story lives. The `message` template fixes every value a caller cannot change, and **`failsafe` is required**: once a client falls silent the bridge sends the failsafe message itself, so an operator whose window closed does not leave a robot driving. Keys are slugs, one namespace across all five exposure sections, which is what lets
|
|
2054
|
+
description: 'Topics clients may send to, and where the format\'s whole safety story lives. The `message` template fixes every value a caller cannot change, and **`failsafe` is required**: once a client falls silent the bridge sends the failsafe message itself, so an operator whose window closed does not leave a robot driving. Keys are slugs, one namespace across all five exposure sections, which is what lets an app lock name `{robot, slug}` without naming a kind; `bridge_state` is built-in, `history` is reserved because `GET …/jobs/history` would shadow an action of that name, and `assets` and `job_history` are reserved because they name the robot-level capabilities; all four are refused when the document is validated.',
|
|
1969
2055
|
defaultSnippets: [underSlug('${1:drive}', PUBLISHER_SNIPPET)],
|
|
1970
2056
|
}).optional(),
|
|
1971
2057
|
cameras: capped(cameraConfig, 50, 'cameras').meta({
|
|
1972
|
-
description: 'Video the robot streams, and the still frames the cloud serves from it. `width`, `height`, `fps` and `bitrate_kbps` are what **the bridge produces before sending**, not what the camera captures — they live in the configuration rather than in a viewer\'s request precisely so that no viewer can make a robot send more. Keys are slugs, one namespace across all five exposure sections, which is what lets
|
|
2058
|
+
description: 'Video the robot streams, and the still frames the cloud serves from it. `width`, `height`, `fps` and `bitrate_kbps` are what **the bridge produces before sending**, not what the camera captures — they live in the configuration rather than in a viewer\'s request precisely so that no viewer can make a robot send more. Keys are slugs, one namespace across all five exposure sections, which is what lets an app lock name `{robot, slug}` without naming a kind; `bridge_state` is built-in, `history` is reserved because `GET …/jobs/history` would shadow an action of that name, and `assets` and `job_history` are reserved because they name the robot-level capabilities; all four are refused when the document is validated.',
|
|
1973
2059
|
defaultSnippets: [underSlug('${1:front}', CAMERA_SNIPPET)],
|
|
1974
2060
|
}).optional(),
|
|
2061
|
+
access: accessSection.meta({
|
|
2062
|
+
description: 'Who may use what on this robot, beyond the `role` an entry can carry itself: ordered `rules` over ROS name patterns, and the robot-level `assets` and `job_history`. Everything in it is optional. For an entry the precedence is its own `role`, then the first rule that fits, then the organization\'s default for its kind; only the published version counts. The robot ignores this section.',
|
|
2063
|
+
defaultSnippets: [{
|
|
2064
|
+
label: 'access, with one rule',
|
|
2065
|
+
description: 'A rule that gives everything under `/arm` to one role; entries it does not fit keep the organization\'s defaults.',
|
|
2066
|
+
body: { rules: [{ match: '${1:/arm/**}', role: '${2:admin}' }] },
|
|
2067
|
+
}],
|
|
2068
|
+
}).optional(),
|
|
1975
2069
|
low_bandwidth: lowBandwidthSection.optional().meta({
|
|
1976
2070
|
description: 'Overrides for the bridge\'s low-bandwidth mode; see the section schema.',
|
|
1977
2071
|
/**
|
package/dist/errors.d.ts
CHANGED
|
@@ -90,11 +90,13 @@ export type InvalidCodeDetails = z.infer<typeof invalidCodeDetails>;
|
|
|
90
90
|
export declare const planLimitDetails: z.ZodObject<{
|
|
91
91
|
limit: z.ZodEnum<{
|
|
92
92
|
apps: "apps";
|
|
93
|
-
seats: "seats";
|
|
94
93
|
robots: "robots";
|
|
94
|
+
seats: "seats";
|
|
95
95
|
app_users: "app_users";
|
|
96
96
|
live_video_ms_per_month: "live_video_ms_per_month";
|
|
97
97
|
asset_bytes_per_robot: "asset_bytes_per_robot";
|
|
98
|
+
collection_records: "collection_records";
|
|
99
|
+
collection_bytes: "collection_bytes";
|
|
98
100
|
}>;
|
|
99
101
|
used: z.ZodNumber;
|
|
100
102
|
max: z.ZodNumber;
|
|
@@ -113,8 +115,8 @@ export declare const planLimitDetails: z.ZodObject<{
|
|
|
113
115
|
}>>;
|
|
114
116
|
addon: z.ZodNullable<z.ZodEnum<{
|
|
115
117
|
apps: "apps";
|
|
116
|
-
seats: "seats";
|
|
117
118
|
robots: "robots";
|
|
119
|
+
seats: "seats";
|
|
118
120
|
app_user_packs: "app_user_packs";
|
|
119
121
|
live_video_packs: "live_video_packs";
|
|
120
122
|
}>>;
|
|
@@ -144,11 +146,13 @@ export type PlanLimitDetails = z.infer<typeof planLimitDetails>;
|
|
|
144
146
|
export declare const assetPlanLimitDetails: z.ZodObject<{
|
|
145
147
|
limit: z.ZodEnum<{
|
|
146
148
|
apps: "apps";
|
|
147
|
-
seats: "seats";
|
|
148
149
|
robots: "robots";
|
|
150
|
+
seats: "seats";
|
|
149
151
|
app_users: "app_users";
|
|
150
152
|
live_video_ms_per_month: "live_video_ms_per_month";
|
|
151
153
|
asset_bytes_per_robot: "asset_bytes_per_robot";
|
|
154
|
+
collection_records: "collection_records";
|
|
155
|
+
collection_bytes: "collection_bytes";
|
|
152
156
|
}>;
|
|
153
157
|
used: z.ZodNumber;
|
|
154
158
|
max: z.ZodNumber;
|
|
@@ -167,8 +171,8 @@ export declare const assetPlanLimitDetails: z.ZodObject<{
|
|
|
167
171
|
}>>;
|
|
168
172
|
addon: z.ZodNullable<z.ZodEnum<{
|
|
169
173
|
apps: "apps";
|
|
170
|
-
seats: "seats";
|
|
171
174
|
robots: "robots";
|
|
175
|
+
seats: "seats";
|
|
172
176
|
app_user_packs: "app_user_packs";
|
|
173
177
|
live_video_packs: "live_video_packs";
|
|
174
178
|
}>>;
|
|
@@ -241,10 +245,64 @@ export declare const billingDocumentsUnavailableDetails: z.ZodObject<{
|
|
|
241
245
|
}>;
|
|
242
246
|
}, z.core.$strict>;
|
|
243
247
|
export type BillingDocumentsUnavailableDetails = z.infer<typeof billingDocumentsUnavailableDetails>;
|
|
248
|
+
/**
|
|
249
|
+
* The `details` of a `409 confirmation_required` refusal: the preview as it is
|
|
250
|
+
* now, which carries the `token` that confirms it. Sent when a publish, a
|
|
251
|
+
* restore, a purge or an import would change or remove data and the request
|
|
252
|
+
* brought no token, or one for data that has changed since.
|
|
253
|
+
*/
|
|
254
|
+
export declare const confirmationRequiredDetails: z.ZodObject<{
|
|
255
|
+
preview: z.ZodUnknown;
|
|
256
|
+
}, z.core.$strict>;
|
|
257
|
+
export type ConfirmationRequiredDetails = z.infer<typeof confirmationRequiredDetails>;
|
|
258
|
+
/**
|
|
259
|
+
* The `details` of a `409 record_referenced` refusal. Counts only: the caller
|
|
260
|
+
* may not be allowed to read the records that point here, so neither their
|
|
261
|
+
* ids nor their values are told. Nor is the key of a collection the caller may
|
|
262
|
+
* not read, for the reason `collection_not_found` is answered for one: the list
|
|
263
|
+
* names only collections the caller may read, and it is empty when every
|
|
264
|
+
* collection that points here is one they may not.
|
|
265
|
+
*/
|
|
266
|
+
export declare const recordReferencedDetails: z.ZodObject<{
|
|
267
|
+
references: z.ZodArray<z.ZodObject<{
|
|
268
|
+
collection: z.ZodString;
|
|
269
|
+
count: z.ZodNumber;
|
|
270
|
+
}, z.core.$strict>>;
|
|
271
|
+
}, z.core.$strict>;
|
|
272
|
+
export type RecordReferencedDetails = z.infer<typeof recordReferencedDetails>;
|
|
273
|
+
/** The `details` of a `409 record_changed` refusal: the revision the record is at now, for the caller to read it again. */
|
|
274
|
+
export declare const recordChangedDetails: z.ZodObject<{
|
|
275
|
+
revision: z.ZodNumber;
|
|
276
|
+
}, z.core.$strict>;
|
|
277
|
+
export type RecordChangedDetails = z.infer<typeof recordChangedDetails>;
|
|
278
|
+
/** The `details` of a `400 reference_invalid` refusal: which reference field, and why its value was refused. */
|
|
279
|
+
export declare const referenceInvalidDetails: z.ZodObject<{
|
|
280
|
+
field: z.ZodString;
|
|
281
|
+
reason: z.ZodEnum<{
|
|
282
|
+
missing: "missing";
|
|
283
|
+
other_robot: "other_robot";
|
|
284
|
+
not_readable: "not_readable";
|
|
285
|
+
}>;
|
|
286
|
+
}, z.core.$strict>;
|
|
287
|
+
export type ReferenceInvalidDetails = z.infer<typeof referenceInvalidDetails>;
|
|
288
|
+
/** The `details` of a `400 required_missing` refusal: every required field the write would leave empty. */
|
|
289
|
+
export declare const requiredMissingDetails: z.ZodObject<{
|
|
290
|
+
fields: z.ZodArray<z.ZodString>;
|
|
291
|
+
}, z.core.$strict>;
|
|
292
|
+
export type RequiredMissingDetails = z.infer<typeof requiredMissingDetails>;
|
|
293
|
+
/**
|
|
294
|
+
* The `details` of a `400 role_cycle` refusal: the loop the change would have
|
|
295
|
+
* made, along the `inherits` edges, as `[a, b, a]` — the first key again at
|
|
296
|
+
* the end. A role that inherits from itself is `[a, a]`.
|
|
297
|
+
*/
|
|
298
|
+
export declare const roleCycleDetails: z.ZodObject<{
|
|
299
|
+
cycle: z.ZodArray<z.ZodString>;
|
|
300
|
+
}, z.core.$strip>;
|
|
301
|
+
export type RoleCycleDetails = z.infer<typeof roleCycleDetails>;
|
|
244
302
|
/**
|
|
245
303
|
* The codes in use today. The wire deliberately allows any string — this
|
|
246
304
|
* list is the shared vocabulary, not a closed set, so a new refusal never
|
|
247
305
|
* needs a contracts release before it can be reported honestly.
|
|
248
306
|
*/
|
|
249
|
-
export declare const ERROR_CODES: readonly ["not_found", "validation_error", "bad_request", "unknown_datapoint", "invalid_token", "protocol_mismatch", "bridge_too_old", "invalid_frame", "duplicate_slug", "reserved_slug", "unknown_slug", "unknown_field_path", "unknown_type", "unknown_topic", "invalid_rate", "invalid_range", "config_conflict", "no_data", "robot_offline", "bridge_timeout", "unauthorized", "forbidden", "invalid_credentials", "token_expired", "token_revoked", "email_taken", "identifier_taken", "weak_password", "account_blocked", "busy", "parameter_invalid", "cancel_rejected", "job_lost", "operator_verified_stopped", "job_unknown_to_bridge", "action_server_lost", "action_failed", "goal_rejected", "goal_send_failed", "result_failed", "goal_uncontrollable", "bridge_disconnected", "config_changed", "publisher_busy", "unknown_command", "not_subscribable", "camera_offline", "no_snapshot_yet", "live_unavailable", "wrong_kind", "not_recorded", "not_aggregatable", "quota_exceeded", "credential_in_use", "goal_timeout", "robot_in_use", "robot_deletion_partial", "job_queue_full", "invalid_uuid", "rate_limited", "tier_required", "token_spent", "service_timeout", "asset_missing", "dynamic_registration_disabled", "client_limit_reached", "idp_unavailable", "mcp_disabled", "tool_not_available", "capability_required", "last_owner", "
|
|
307
|
+
export declare const ERROR_CODES: readonly ["not_found", "validation_error", "bad_request", "unknown_datapoint", "invalid_token", "protocol_mismatch", "bridge_too_old", "invalid_frame", "duplicate_slug", "reserved_slug", "unknown_slug", "unknown_field_path", "unknown_type", "unknown_topic", "invalid_rate", "invalid_range", "config_conflict", "no_data", "robot_offline", "bridge_timeout", "unauthorized", "forbidden", "invalid_credentials", "token_expired", "token_revoked", "email_taken", "identifier_taken", "weak_password", "account_blocked", "busy", "parameter_invalid", "cancel_rejected", "job_lost", "operator_verified_stopped", "job_unknown_to_bridge", "action_server_lost", "action_failed", "goal_rejected", "goal_send_failed", "result_failed", "goal_uncontrollable", "bridge_disconnected", "config_changed", "publisher_busy", "unknown_command", "not_subscribable", "camera_offline", "no_snapshot_yet", "live_unavailable", "wrong_kind", "not_recorded", "not_aggregatable", "quota_exceeded", "credential_in_use", "goal_timeout", "robot_in_use", "robot_deletion_partial", "job_queue_full", "invalid_uuid", "rate_limited", "tier_required", "token_spent", "service_timeout", "asset_missing", "dynamic_registration_disabled", "client_limit_reached", "idp_unavailable", "mcp_disabled", "tool_not_available", "capability_required", "last_owner", "role_cycle", "role_key_taken", "confirmation_required", "target_state_conflict", "job_state_conflict", "signup_closed", "draft_not_a_document", "internal_error", "not_cancellable", "unsupported_media_type", "wrong_browser", "invalid_yaml", "unstorable_yaml", "registration_closed", "domain_not_allowed", "email_unverified", "origin_not_allowed", "template_invalid", "provider_disabled", "provider_misconfigured", "invalid_redirect_uri", "interaction_expired", "invalid_code", "method_not_allowed", "plan_limit", "plan_required", "org_locked", "file_too_large", "billing_unavailable", "legal_offer_unavailable", "payment_provider_unavailable", "history_migrating", "billing_documents_unavailable", "support_read_only", "support_forbidden", "record_referenced", "record_changed", "collection_not_found", "collection_removed", "reference_invalid", "required_missing", "robot_not_attached"];
|
|
250
308
|
export type ErrorCode = (typeof ERROR_CODES)[number];
|
package/dist/errors.js
CHANGED
|
@@ -164,6 +164,72 @@ export const billingDocumentsUnavailableDetails = z.object({
|
|
|
164
164
|
'its account check, so every Lexware read stays closed).',
|
|
165
165
|
}),
|
|
166
166
|
}).strict();
|
|
167
|
+
/**
|
|
168
|
+
* The `details` of a `409 confirmation_required` refusal: the preview as it is
|
|
169
|
+
* now, which carries the `token` that confirms it. Sent when a publish, a
|
|
170
|
+
* restore, a purge or an import would change or remove data and the request
|
|
171
|
+
* brought no token, or one for data that has changed since.
|
|
172
|
+
*/
|
|
173
|
+
export const confirmationRequiredDetails = z
|
|
174
|
+
.object({
|
|
175
|
+
preview: z.unknown().meta({
|
|
176
|
+
description: 'The current preview of the operation, with its `token`: a `collectionsSchemaPreview` for a publish, a `collectionsRestorePreview` for a restore, a `collectionsPurgePreview` for a purge and a `collectionImportPreview` for an import. Confirm it by sending that `token` as `confirm`. A publish that names a `source_sha256` which is not the saved draft\'s, because the draft was saved again since it was previewed, is refused the same way with a preview whose `token` can be `null` (no effects, nothing to confirm): read this preview, then publish again with its `source_sha256`, and with its `token` as `confirm` when it has one.',
|
|
177
|
+
}),
|
|
178
|
+
})
|
|
179
|
+
.strict();
|
|
180
|
+
/**
|
|
181
|
+
* The `details` of a `409 record_referenced` refusal. Counts only: the caller
|
|
182
|
+
* may not be allowed to read the records that point here, so neither their
|
|
183
|
+
* ids nor their values are told. Nor is the key of a collection the caller may
|
|
184
|
+
* not read, for the reason `collection_not_found` is answered for one: the list
|
|
185
|
+
* names only collections the caller may read, and it is empty when every
|
|
186
|
+
* collection that points here is one they may not.
|
|
187
|
+
*/
|
|
188
|
+
export const recordReferencedDetails = z
|
|
189
|
+
.object({
|
|
190
|
+
references: z
|
|
191
|
+
.array(z
|
|
192
|
+
.object({
|
|
193
|
+
collection: z.string().min(1).meta({ description: 'The key of a collection that has records pointing at this one.' }),
|
|
194
|
+
count: z.number().int().min(1).meta({ description: 'How many records of that collection point at it.' }),
|
|
195
|
+
})
|
|
196
|
+
.strict())
|
|
197
|
+
.meta({
|
|
198
|
+
description: 'The collections whose records reference the record, each with how many. Only collections the caller may read are named, so the list is empty when the records that point here are all in collections the caller cannot read; the refusal still stands.',
|
|
199
|
+
}),
|
|
200
|
+
})
|
|
201
|
+
.strict();
|
|
202
|
+
/** The `details` of a `409 record_changed` refusal: the revision the record is at now, for the caller to read it again. */
|
|
203
|
+
export const recordChangedDetails = z
|
|
204
|
+
.object({
|
|
205
|
+
revision: z.number().int().min(1).meta({ description: 'The current revision of the record, which is not the `expected_revision` that was sent.' }),
|
|
206
|
+
})
|
|
207
|
+
.strict();
|
|
208
|
+
/** The `details` of a `400 reference_invalid` refusal: which reference field, and why its value was refused. */
|
|
209
|
+
export const referenceInvalidDetails = z
|
|
210
|
+
.object({
|
|
211
|
+
field: z.string().min(1).meta({ description: 'The key of the reference field.' }),
|
|
212
|
+
reason: z.enum(['missing', 'other_robot', 'not_readable']).meta({
|
|
213
|
+
description: '`missing`: no record of the target collection has that id. `other_robot`: the target belongs to another robot than the record that points at it. `not_readable`: the caller may not read the target collection.',
|
|
214
|
+
}),
|
|
215
|
+
})
|
|
216
|
+
.strict();
|
|
217
|
+
/** The `details` of a `400 required_missing` refusal: every required field the write would leave empty. */
|
|
218
|
+
export const requiredMissingDetails = z
|
|
219
|
+
.object({
|
|
220
|
+
fields: z.array(z.string().min(1)).min(1).meta({ description: 'The keys of the required fields that have no value.' }),
|
|
221
|
+
})
|
|
222
|
+
.strict();
|
|
223
|
+
/**
|
|
224
|
+
* The `details` of a `400 role_cycle` refusal: the loop the change would have
|
|
225
|
+
* made, along the `inherits` edges, as `[a, b, a]` — the first key again at
|
|
226
|
+
* the end. A role that inherits from itself is `[a, a]`.
|
|
227
|
+
*/
|
|
228
|
+
export const roleCycleDetails = z.object({
|
|
229
|
+
cycle: z.array(z.string()).min(2).meta({
|
|
230
|
+
description: 'The keys along the loop, in order, ending with the key the loop started from: `["a", "b", "a"]`.',
|
|
231
|
+
}),
|
|
232
|
+
});
|
|
167
233
|
/**
|
|
168
234
|
* The codes in use today. The wire deliberately allows any string — this
|
|
169
235
|
* list is the shared vocabulary, not a closed set, so a new refusal never
|
|
@@ -218,7 +284,7 @@ export const ERROR_CODES = [
|
|
|
218
284
|
'bridge_timeout',
|
|
219
285
|
// Identity and rights. `forbidden` is deliberately the answer both
|
|
220
286
|
// for "your role does not grant this" and for "there is no such slug":
|
|
221
|
-
//
|
|
287
|
+
// rights are the only filter, and a caller must not be able to map
|
|
222
288
|
// the configuration of an app they have no rights in.
|
|
223
289
|
'unauthorized',
|
|
224
290
|
'forbidden',
|
|
@@ -647,14 +713,14 @@ export const ERROR_CODES = [
|
|
|
647
713
|
* the role's datasheet (`mcpRobotDatasheet`) already lists every exposure
|
|
648
714
|
* the role does grant, so a second code would split an outcome nobody acts
|
|
649
715
|
* on differently. To anyone else the two must be indistinguishable anyway,
|
|
650
|
-
* because
|
|
716
|
+
* because rights are the only filter.
|
|
651
717
|
*/
|
|
652
718
|
'tool_not_available',
|
|
653
719
|
// Capabilities.
|
|
654
720
|
/**
|
|
655
721
|
* An app-wide **capability** the caller's role does not grant — today
|
|
656
722
|
* `assets` (`GET /api/robots/:id/assets` and the URDF/by-id byte routes)
|
|
657
|
-
* and `
|
|
723
|
+
* and `job_history` (`GET /api/robots/:id/jobs/history`). The message
|
|
658
724
|
* names which one.
|
|
659
725
|
*
|
|
660
726
|
* **Distinct from `forbidden`, and the distinction is the point.**
|
|
@@ -687,35 +753,45 @@ export const ERROR_CODES = [
|
|
|
687
753
|
* caller could infer from a silence about existence.
|
|
688
754
|
*/
|
|
689
755
|
'last_owner',
|
|
690
|
-
|
|
756
|
+
/* `role_name_taken`, `role_in_use` and `last_role` are gone with the per-app
|
|
757
|
+
* role routes they answered; organization roles bring their own refusals. */
|
|
758
|
+
// Organization roles.
|
|
691
759
|
/**
|
|
692
|
-
*
|
|
693
|
-
*
|
|
694
|
-
*
|
|
760
|
+
* `400`: the change would make a role inherit from itself, directly or
|
|
761
|
+
* through other roles. Nothing was written. `details` is `roleCycleDetails`,
|
|
762
|
+
* the loop as `[a, b, a]`.
|
|
695
763
|
*
|
|
696
|
-
*
|
|
697
|
-
*
|
|
764
|
+
* Raised when a role is created or its `inherits` changes. Renaming and
|
|
765
|
+
* deleting a role are never refused for the roles that depend on it: what is
|
|
766
|
+
* left dangling turns into a warning.
|
|
698
767
|
*/
|
|
699
|
-
'
|
|
768
|
+
'role_cycle',
|
|
700
769
|
/**
|
|
701
|
-
*
|
|
702
|
-
*
|
|
703
|
-
* without `move_to`. `details` is `roleInUseDetails`:
|
|
704
|
-
* `{ users, invitations, is_default }`.
|
|
705
|
-
*
|
|
706
|
-
* Not `conflict`: the details tell the console what to offer — a role to
|
|
707
|
-
* move them to — and a generic code would leave it guessing.
|
|
770
|
+
* `409`: the organization already has a role with that key, on a create or on
|
|
771
|
+
* a rename to a key that is in use. Nothing was written; pick another key.
|
|
708
772
|
*/
|
|
709
|
-
'
|
|
773
|
+
'role_key_taken',
|
|
710
774
|
/**
|
|
711
|
-
*
|
|
712
|
-
*
|
|
713
|
-
*
|
|
775
|
+
* `409`: the call changes many places at once and has to be confirmed with
|
|
776
|
+
* the token of its current preview. `details` is that preview, with the
|
|
777
|
+
* token in its `confirm` field; repeat the same request with `confirm` set
|
|
778
|
+
* to it and the call applies. The shape of the preview belongs to the call
|
|
779
|
+
* that answers it: for renaming an organization role with
|
|
780
|
+
* `update_references` it is `roleRenamePreview`.
|
|
781
|
+
*
|
|
782
|
+
* App collections use the code for a publish, a restore, a purge and an
|
|
783
|
+
* import that would change or remove data and brought no token. There
|
|
784
|
+
* `details` is `confirmationRequiredDetails`: `{ preview }`, the current
|
|
785
|
+
* preview of the operation, whose `token` is sent back as `confirm`. The
|
|
786
|
+
* answer is not "someone else got there first" but "this is exactly what
|
|
787
|
+
* would happen now, say yes to it".
|
|
714
788
|
*
|
|
715
|
-
*
|
|
716
|
-
*
|
|
789
|
+
* A token fits the effects its preview lists and nothing else. When
|
|
790
|
+
* anything those effects cover has changed since, the call answers a new
|
|
791
|
+
* preview instead of applying on a stale token, so what is applied is always
|
|
792
|
+
* what the caller was shown.
|
|
717
793
|
*/
|
|
718
|
-
'
|
|
794
|
+
'confirmation_required',
|
|
719
795
|
// OIDC federation.
|
|
720
796
|
/**
|
|
721
797
|
* **The target is in a state that refuses the operation** — not the caller's
|
|
@@ -1136,4 +1212,56 @@ export const ERROR_CODES = [
|
|
|
1136
1212
|
* policy guard on the developer HTTP surface.
|
|
1137
1213
|
*/
|
|
1138
1214
|
'support_forbidden',
|
|
1215
|
+
// 2026-11-04 — app collections.
|
|
1216
|
+
/**
|
|
1217
|
+
* `409`: the record cannot be deleted, or an import cannot delete it,
|
|
1218
|
+
* because other records point at it through a reference whose `on_delete` is
|
|
1219
|
+
* `prevent`. `details` is `recordReferencedDetails`: the collections that
|
|
1220
|
+
* reference it, among those the caller may read, and how many records each
|
|
1221
|
+
* has, never their ids or values.
|
|
1222
|
+
*/
|
|
1223
|
+
'record_referenced',
|
|
1224
|
+
/**
|
|
1225
|
+
* `409`: a write sent an `expected_revision` and the record is at another
|
|
1226
|
+
* revision now. Nothing was changed. `details` is `recordChangedDetails`:
|
|
1227
|
+
* the current revision; read the record again and decide.
|
|
1228
|
+
*/
|
|
1229
|
+
'record_changed',
|
|
1230
|
+
/**
|
|
1231
|
+
* `404`: the app has no published collection with that key. A caller who has
|
|
1232
|
+
* no right at all on a collection gets the same answer, so that the key of a
|
|
1233
|
+
* collection they may not touch is not told; a caller with some right, but
|
|
1234
|
+
* not the one this request needs, gets `403 forbidden` instead. Also the
|
|
1235
|
+
* code of a refused `collection_subscribe`.
|
|
1236
|
+
*/
|
|
1237
|
+
'collection_not_found',
|
|
1238
|
+
/**
|
|
1239
|
+
* Realtime only, no HTTP status: a `collection_subscribe_error` frame that
|
|
1240
|
+
* ends a subscription because a publish removed its collection from the
|
|
1241
|
+
* schema.
|
|
1242
|
+
*/
|
|
1243
|
+
'collection_removed',
|
|
1244
|
+
/**
|
|
1245
|
+
* `400`: a reference field points at something it may not: a record that
|
|
1246
|
+
* does not exist, one of another robot, or one in a collection the caller
|
|
1247
|
+
* may not read. `details` is `referenceInvalidDetails`: the field and the
|
|
1248
|
+
* reason.
|
|
1249
|
+
*/
|
|
1250
|
+
'reference_invalid',
|
|
1251
|
+
/**
|
|
1252
|
+
* `400`: a create leaves a required field empty, or an update clears one.
|
|
1253
|
+
* `details` is `requiredMissingDetails`: every such field, not only the
|
|
1254
|
+
* first. A record whose required fields were emptied by a schema change can
|
|
1255
|
+
* still be updated in its other fields; it is the write that breaks the
|
|
1256
|
+
* rule that is refused.
|
|
1257
|
+
*/
|
|
1258
|
+
'required_missing',
|
|
1259
|
+
/**
|
|
1260
|
+
* `400`: the request names a robot that the app does not have attached, or
|
|
1261
|
+
* that the caller cannot reach, for example the `robot_id` of a new record, a
|
|
1262
|
+
* `robot` filter or a `collection_subscribe`. Over realtime it also ends a
|
|
1263
|
+
* subscription whose robot was detached. A detached robot's records are kept
|
|
1264
|
+
* and stay hidden until it is attached again.
|
|
1265
|
+
*/
|
|
1266
|
+
'robot_not_attached',
|
|
1139
1267
|
];
|