@fleetless/contracts 9.0.0 → 9.1.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 +21 -0
- package/artifacts/openapi.json +20 -20
- package/artifacts/routes.json +27 -4
- package/artifacts/schema/action-config.schema.json +2 -2
- package/artifacts/schema/cloud-config.schema.json +8 -8
- package/artifacts/schema/config-draft-response.schema.json +8 -8
- package/artifacts/schema/config-version-response.schema.json +8 -8
- package/artifacts/schema/datapoint-config.schema.json +3 -3
- package/artifacts/schema/parameter-spec.schema.json +1 -1
- package/artifacts/schema/publisher-config.schema.json +1 -1
- package/artifacts/schema/robot-config-doc.schema.json +8 -8
- package/artifacts/schema/service-config.schema.json +1 -1
- package/artifacts/schema/support-renew-fail-refusal.schema.json +141 -0
- package/artifacts/schema/support-renew-fail-request.schema.json +28 -0
- package/dist/client-robots.d.ts +1 -1
- package/dist/client-robots.js +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +7 -7
- package/dist/errors.js +19 -15
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/mcp.d.ts +13 -10
- package/dist/mcp.js +13 -10
- package/dist/routes.js +31 -6
- package/dist/support.d.ts +42 -0
- package/dist/support.js +15 -0
- package/package.json +1 -1
package/dist/routes.js
CHANGED
|
@@ -14,7 +14,7 @@ import { legalAcceptanceListQuery, legalAcceptanceListResponse } from './legal-a
|
|
|
14
14
|
import { MCP_APP_PATHS, mcpRobotDatasheet, mcpRolePreviewResponse } from './mcp.js';
|
|
15
15
|
import { authorizationServerMetadata, dynamicClientRegistrationRequest, dynamicClientRegistrationResponse, oauthAuthorizeQuery, oauthRedirectResponse, oauthTokenRequest, oauthTokenResponse, protectedResourceMetadata, } from './oauth.js';
|
|
16
16
|
import { adminPlanChangeRequest, orgPlan, planChangeRequest } from './plans.js';
|
|
17
|
-
import { supportTokenRequest, supportTokenResponse } from './support.js';
|
|
17
|
+
import { supportRenewFailRequest, supportTokenRequest, supportTokenResponse } from './support.js';
|
|
18
18
|
import { purchaseIntentLookupQuery, purchaseIntentConfirmRequest, purchaseIntentResponse, invoicePayRequest, billingCancelRequest, billingChangeRequest, billingChangeResponse, billingDetailsUpdate, billingDocumentDetail, billingDocumentFileQuery, billingDocumentList, billingView, chargePayRequest, checkoutRequest, checkoutResponse, checkoutStatus, paymentMethodChangeRequest, vatIdCheckRequest, vatIdCheckResponse, } from './billing.js';
|
|
19
19
|
import { cameraListResponse, cancelRequest, configDraftResponse, configVersionResponse, configVersionsResponse, createRobotRequest, createRobotResponse, datapointListResponse, datapointValue, exposureListResponse, fetchTypesRequest, fetchTypesResponse, historyQuery, historyResponse, introspectionResponse, invokeOrServiceResponse, invokeRequest, jobResponse, liveSessionResponse, orgHealthQuery, orgLatencyQuery, orgLatencyResponse, orgQuotaUsage, orgUsageQuery, orgUsageResponse, patchRobotRequest, patchRobotResponse, publishConfigResponse, publishRequest, putConfigDraftRequest, putRobotDetailsRequest, putRobotDetailsResponse, robotTokenRotateResponse, jointStatePutRequest, jointStatePutResponse, releaseLiveQuery, renameSlugRequest, renameSlugResponse, robotDeleteQuery, resourceHealthListResponse, robotDeletionSummary, robotDetailResponse, robotJobsResponse, robotListResponse, slugUsageResponse, snapshotMetaResponse, typesResponse, } from './rest.js';
|
|
20
20
|
export const ROUTE_SECTIONS = [
|
|
@@ -54,6 +54,9 @@ const APP_IDENTIFIER = {
|
|
|
54
54
|
};
|
|
55
55
|
/** The routes that verify a credential inside the handler; `auth: 'in_handler'` is refused elsewhere. */
|
|
56
56
|
export const IN_HANDLER_ROUTES = [
|
|
57
|
+
// The old support bearer must reach the flow transaction after a newer
|
|
58
|
+
// generation wins; a generic current-generation guard would hide that race.
|
|
59
|
+
'POST /console/support/renew/fail',
|
|
57
60
|
'POST /mcp',
|
|
58
61
|
// The per-app endpoint, all three verbs: the bearer decides which app user
|
|
59
62
|
// is calling, and the path names none of that. Built from `MCP_APP` so the
|
|
@@ -634,7 +637,7 @@ export const ROUTES = [
|
|
|
634
637
|
],
|
|
635
638
|
query: null, request: null, response: mcpRolePreviewResponse,
|
|
636
639
|
errors: [...DEVELOPER_GUARD, 'invalid_uuid', 'not_found'], transport: 'http',
|
|
637
|
-
notes: 'Built by the same builder the MCP server\'s own `
|
|
640
|
+
notes: 'Built by the same builder the MCP server\'s own `robots.describe` uses, so the two cannot drift. It answers what the role *would* be ' +
|
|
638
641
|
'offered and consults nothing about any user\'s actual MCP entitlement. A robot the role grants nothing on still appears, with an empty ' +
|
|
639
642
|
'`exposures` — dropping it would read as "not attached", which is a different fact.',
|
|
640
643
|
},
|
|
@@ -1544,6 +1547,28 @@ export const ROUTES = [
|
|
|
1544
1547
|
'session that outlives its ceiling is a new grant and a new exchange, not a renewal. The session starts in `read` mode; switching one to ' +
|
|
1545
1548
|
'`edit` is the operator side\'s `support_session_edit` command, not anything this route does.',
|
|
1546
1549
|
},
|
|
1550
|
+
{
|
|
1551
|
+
method: 'POST', path: '/console/support/renew/fail', section: 'developer-auth',
|
|
1552
|
+
summary: 'Ends a current-generation support session after Console proves renewal authority failed.',
|
|
1553
|
+
audience: 'internal', auth: 'in_handler', rateLimited: false, ownerTier: false, status: 204,
|
|
1554
|
+
params: [], query: null, request: supportRenewFailRequest, response: null,
|
|
1555
|
+
errors: ['validation_error', 'unauthorized', 'not_found', 'target_state_conflict'], transport: 'http',
|
|
1556
|
+
notes: 'Internal Console-to-Cloud POST only, no CORS. Console must first verify and consume signed Operator failure evidence ' +
|
|
1557
|
+
'bound to its original browser flow, or let Cloud timeout/sweep close an uncompleted flow; browser flow_id or error alone ' +
|
|
1558
|
+
'must never trigger this call. The evidence stays at Console: this strict Cloud request has no Operator or browser field. ' +
|
|
1559
|
+
'Authorization: Bearer <original fl_support>; a valid old bearer must reach the ' +
|
|
1560
|
+
'transaction even after another flow wins its generation, so a current-generation pre-handler must not intercept it. Cloud checks ' +
|
|
1561
|
+
'signature, audience, original expiry, exact stored bearer hash, S256 verifier, and bound session, org, mode and immutable creator ' +
|
|
1562
|
+
'subject. Lock session and flow in redemption order. After proof and before mutation, compare the saved credential generation: ' +
|
|
1563
|
+
'stale_generation takes precedence and cannot touch the winner. Only a live, pending, unauthorised current-generation flow before ' +
|
|
1564
|
+
'min(flow_created_at + 120 seconds, old credential expiry) atomically records failedAt, endedAt and audit/event. Success is 204 ' +
|
|
1565
|
+
'with no body. Missing callback closes an unauthorised expired flow at the next session check or sweep under the same generation fence. ' +
|
|
1566
|
+
'No failure extends a lease or compensates a committed redemption. Every refusal is Cache-Control: no-store with ' +
|
|
1567
|
+
'supportRenewFailRefusal body: 400 validation_error/invalid_flow for malformed JSON; 401 unauthorized/invalid_authority for missing ' +
|
|
1568
|
+
'or invalid bearer or proof; 404 not_found/invalid_flow for unknown or foreign flow, or /identity_mismatch for bound identity mismatch; ' +
|
|
1569
|
+
'409 target_state_conflict/expired, /replayed, /session_inactive or /stale_generation. No failure response sets or clears fl_support. ' +
|
|
1570
|
+
'Network ambiguity is never a 204 and does not trigger an unconditional support_session.end.',
|
|
1571
|
+
},
|
|
1547
1572
|
/* --------------------------------- the Fleetless-hosted app pages */
|
|
1548
1573
|
...HOSTED_APP_ROUTES,
|
|
1549
1574
|
/* ---------------------------------------------------- mcp (the endpoint) */
|
|
@@ -1570,7 +1595,7 @@ export const ROUTES = [
|
|
|
1570
1595
|
'the refusal has to carry a `WWW-Authenticate` challenge that a guard shared with the REST surface does not send. `Origin` is checked ' +
|
|
1571
1596
|
'against the cloud\'s own, and a foreign one is the `403 forbidden` above. **Both catalogs, unconditionally**: every caller admitted ' +
|
|
1572
1597
|
'here is a Fleetless user, so the tool list has nothing left to vary with and the admin-ness check on `tools/call` is gone — a console ' +
|
|
1573
|
-
'tool that is still narrower than the catalog refuses for itself (`
|
|
1598
|
+
'tool that is still narrower than the catalog refuses for itself (`console_robots_write.delete` answers `tier_required` to a non-Owner). ' +
|
|
1574
1599
|
'`403 forbidden` is also what an `mcp_session` token whose subject is an **app user** gets: this endpoint serves the team only, and such ' +
|
|
1575
1600
|
'a token belongs to its own app\'s endpoint. The code is `forbidden` rather than `mcp_disabled` because nothing is switched off — the ' +
|
|
1576
1601
|
'caller is at the wrong server — and per-app sign-in mints exactly such tokens, so the two states must not share a word. ' +
|
|
@@ -2318,10 +2343,10 @@ export const ROUTES = [
|
|
|
2318
2343
|
audience: 'client', auth: 'developer_or_client', rateLimited: false, ownerTier: false, status: 200,
|
|
2319
2344
|
params: [], query: null, request: null, response: clientRobotListResponse,
|
|
2320
2345
|
errors: [...CLIENT_GUARD], transport: 'http',
|
|
2321
|
-
notes: '**The REST twin of the MCP
|
|
2346
|
+
notes: '**The REST twin of the MCP action `robots.list`**, and the one robot question no robot-scoped route can answer: which robots may I name ' +
|
|
2322
2347
|
'at all. An app user sees the robots their app attaches on which their role grants at least one slug or capability; a server key sees ' +
|
|
2323
2348
|
'every robot its app attaches; a developer bearer sees the organisation\'s robots. Name order, id as the tiebreak. A robot on which the ' +
|
|
2324
|
-
'role grants nothing is absent rather than listed empty — the same answer `
|
|
2349
|
+
'role grants nothing is absent rather than listed empty — the same answer `robots.list` gives, for the same reason: reach is a grant, ' +
|
|
2325
2350
|
'not an attachment. Under `/api/client/` because it names no robot; every robot-scoped read stays under `/api/robots/:id/…`.',
|
|
2326
2351
|
},
|
|
2327
2352
|
{
|
|
@@ -2331,7 +2356,7 @@ export const ROUTES = [
|
|
|
2331
2356
|
params: [{ name: 'id', description: 'The robot\'s uuid, as `GET /api/client/robots` lists it.' }],
|
|
2332
2357
|
query: null, request: null, response: mcpRobotDatasheet,
|
|
2333
2358
|
errors: [...CLIENT_GUARD, 'invalid_uuid', 'not_found'], transport: 'http',
|
|
2334
|
-
notes: '**The REST twin of the MCP
|
|
2359
|
+
notes: '**The REST twin of the MCP action `robots.describe`**: one answer per robot — every datapoint, action, service, publisher and camera the ' +
|
|
2335
2360
|
'role grants, each with its `input_schema` where it takes parameters, plus the two capabilities that gate whole features, ' +
|
|
2336
2361
|
'`action_history` and `assets`. A robot with nothing published answers an empty `exposures` list, never a refusal. A robot the caller ' +
|
|
2337
2362
|
'does not reach — not attached to their app, or attached with a role that grants nothing on it — answers `404` exactly as one that ' +
|
package/dist/support.d.ts
CHANGED
|
@@ -78,6 +78,48 @@ export declare const supportTokenResponse: z.ZodObject<{
|
|
|
78
78
|
}, z.core.$strict>;
|
|
79
79
|
}, z.core.$strict>;
|
|
80
80
|
export type SupportTokenResponse = z.infer<typeof supportTokenResponse>;
|
|
81
|
+
/** Cloud verifies Console's original bearer and server-held PKCE proof; Console first verifies signed Operator failure evidence. */
|
|
82
|
+
export declare const supportRenewFailRequest: z.ZodObject<{
|
|
83
|
+
flow_id: z.ZodUUID;
|
|
84
|
+
code_verifier: z.ZodString;
|
|
85
|
+
reason: z.ZodLiteral<"authority_failed">;
|
|
86
|
+
}, z.core.$strict>;
|
|
87
|
+
export type SupportRenewFailRequest = z.infer<typeof supportRenewFailRequest>;
|
|
88
|
+
/** Body of every non-204 renewal-failure response. HTTP status follows `code`; all refusals are no-store. */
|
|
89
|
+
export declare const supportRenewFailRefusal: z.ZodUnion<readonly [z.ZodObject<{
|
|
90
|
+
code: z.ZodLiteral<"validation_error">;
|
|
91
|
+
message: z.ZodString;
|
|
92
|
+
details: z.ZodObject<{
|
|
93
|
+
rule: z.ZodLiteral<"invalid_flow">;
|
|
94
|
+
}, z.core.$strict>;
|
|
95
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
96
|
+
code: z.ZodLiteral<"unauthorized">;
|
|
97
|
+
message: z.ZodString;
|
|
98
|
+
details: z.ZodObject<{
|
|
99
|
+
rule: z.ZodLiteral<"invalid_authority">;
|
|
100
|
+
}, z.core.$strict>;
|
|
101
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
102
|
+
code: z.ZodLiteral<"not_found">;
|
|
103
|
+
message: z.ZodString;
|
|
104
|
+
details: z.ZodObject<{
|
|
105
|
+
rule: z.ZodEnum<{
|
|
106
|
+
invalid_flow: "invalid_flow";
|
|
107
|
+
identity_mismatch: "identity_mismatch";
|
|
108
|
+
}>;
|
|
109
|
+
}, z.core.$strict>;
|
|
110
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
111
|
+
code: z.ZodLiteral<"target_state_conflict">;
|
|
112
|
+
message: z.ZodString;
|
|
113
|
+
details: z.ZodObject<{
|
|
114
|
+
rule: z.ZodEnum<{
|
|
115
|
+
expired: "expired";
|
|
116
|
+
replayed: "replayed";
|
|
117
|
+
session_inactive: "session_inactive";
|
|
118
|
+
stale_generation: "stale_generation";
|
|
119
|
+
}>;
|
|
120
|
+
}, z.core.$strict>;
|
|
121
|
+
}, z.core.$strict>]>;
|
|
122
|
+
export type SupportRenewFailRefusal = z.infer<typeof supportRenewFailRefusal>;
|
|
81
123
|
/**
|
|
82
124
|
* What `GET /api/auth/me` answers **to a support token** — `authMeResponse`
|
|
83
125
|
* with one more, optional field. The public route entry keeps `authMeResponse`
|
package/dist/support.js
CHANGED
|
@@ -93,6 +93,21 @@ export const supportTokenResponse = z
|
|
|
93
93
|
}),
|
|
94
94
|
})
|
|
95
95
|
.strict();
|
|
96
|
+
/** Cloud verifies Console's original bearer and server-held PKCE proof; Console first verifies signed Operator failure evidence. */
|
|
97
|
+
export const supportRenewFailRequest = z.object({
|
|
98
|
+
flow_id: z.uuid().meta({ description: 'The pending Cloud renewal flow created with the original support bearer.' }),
|
|
99
|
+
code_verifier: z.string().regex(/^[A-Za-z0-9._~-]{43,128}$/).meta({
|
|
100
|
+
description: 'The server-held RFC 7636 verifier matching the flow\'s S256 challenge; never sent to the browser.',
|
|
101
|
+
}),
|
|
102
|
+
reason: z.literal('authority_failed').meta({ description: 'A fixed category; browser and IdP error text is not forwarded.' }),
|
|
103
|
+
}).strict();
|
|
104
|
+
/** Body of every non-204 renewal-failure response. HTTP status follows `code`; all refusals are no-store. */
|
|
105
|
+
export const supportRenewFailRefusal = z.union([
|
|
106
|
+
z.object({ code: z.literal('validation_error'), message: z.string().min(1), details: z.object({ rule: z.literal('invalid_flow') }).strict() }).strict(),
|
|
107
|
+
z.object({ code: z.literal('unauthorized'), message: z.string().min(1), details: z.object({ rule: z.literal('invalid_authority') }).strict() }).strict(),
|
|
108
|
+
z.object({ code: z.literal('not_found'), message: z.string().min(1), details: z.object({ rule: z.enum(['invalid_flow', 'identity_mismatch']) }).strict() }).strict(),
|
|
109
|
+
z.object({ code: z.literal('target_state_conflict'), message: z.string().min(1), details: z.object({ rule: z.enum(['expired', 'replayed', 'session_inactive', 'stale_generation']) }).strict() }).strict(),
|
|
110
|
+
]);
|
|
96
111
|
/**
|
|
97
112
|
* What `GET /api/auth/me` answers **to a support token** — `authMeResponse`
|
|
98
113
|
* with one more, optional field. The public route entry keeps `authMeResponse`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fleetless/contracts",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.1.0",
|
|
4
4
|
"description": "Fleetless wire contracts: the bridge-cloud protocol, the REST API schemas and the error codes, as zod schemas with generated JSON Schema and OpenAPI artifacts.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Dehne Robotik GmbH",
|