@fleetless/contracts 9.2.0-next.1 → 10.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 +19 -4
- package/artifacts/openapi.json +16927 -8920
- package/artifacts/routes.json +96 -54
- package/artifacts/schema/billing-change-response.schema.json +1527 -1727
- package/artifacts/schema/billing-decision-amounts.schema.json +244 -0
- package/artifacts/schema/billing-decision-display-request.schema.json +24 -0
- package/artifacts/schema/billing-decision-display-response.schema.json +3130 -0
- package/artifacts/schema/billing-decision-period.schema.json +550 -0
- package/artifacts/schema/billing-decision-snapshot.schema.json +3103 -0
- package/artifacts/schema/bridge-state.schema.json +0 -14
- package/artifacts/schema/checkout-request.schema.json +3 -4
- package/artifacts/schema/checkout-response.schema.json +492 -402
- package/artifacts/schema/client-robot-list-item.schema.json +0 -14
- package/artifacts/schema/client-robot-list-response.schema.json +0 -14
- package/artifacts/schema/confirmation-proof.schema.json +6 -0
- package/artifacts/schema/plan-change-decision-lookup-query.schema.json +16 -0
- package/artifacts/schema/plan-change-decision-status-response.schema.json +543 -0
- package/artifacts/schema/plan-change-prepare-request.schema.json +84 -0
- package/artifacts/schema/plan-change-prepare-response.schema.json +3162 -0
- package/artifacts/schema/plan-change-request.schema.json +177 -65
- package/artifacts/schema/purchase-conflict-details.schema.json +94 -0
- package/artifacts/schema/purchase-intent-accepted-without-payment.schema.json +95 -0
- package/artifacts/schema/purchase-intent-confirm-request.schema.json +146 -33
- package/artifacts/schema/purchase-intent-draft.schema.json +449 -0
- package/artifacts/schema/purchase-intent-payment-started.schema.json +184 -0
- package/artifacts/schema/purchase-intent-response.schema.json +1235 -168
- package/artifacts/schema/robot-detail-response.schema.json +0 -14
- package/artifacts/schema/robot-list-item.schema.json +0 -14
- package/artifacts/schema/robot-list-response.schema.json +0 -14
- package/dist/billing.d.ts +5665 -210
- package/dist/billing.js +224 -29
- package/dist/client-robots.d.ts +0 -6
- package/dist/confirmation-proof.d.ts +5 -0
- package/dist/confirmation-proof.js +6 -0
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +0 -12
- package/dist/iana-time-zones.d.ts +2 -0
- package/dist/iana-time-zones.js +426 -0
- package/dist/index.d.ts +7 -6
- package/dist/index.js +4 -3
- package/dist/plans.d.ts +125 -1
- package/dist/plans.js +19 -1
- package/dist/protocol.d.ts +0 -3
- package/dist/protocol.js +0 -1
- package/dist/purchase-operation-key.d.ts +4 -0
- package/dist/purchase-operation-key.js +4 -0
- package/dist/rest.d.ts +0 -52
- package/dist/rest.js +0 -15
- package/dist/routes.js +43 -35
- package/package.json +3 -1
- package/artifacts/schema/recover-held-job-request.schema.json +0 -29
- package/artifacts/schema/recover-held-job-response.schema.json +0 -125
package/dist/plans.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
import { purchaseOperationKey } from './purchase-operation-key.js';
|
|
4
|
+
import { confirmationProof } from './confirmation-proof.js';
|
|
3
5
|
/**
|
|
4
6
|
* The plan catalogue.
|
|
5
7
|
*
|
|
@@ -445,12 +447,28 @@ export const orgPlan = z.object({
|
|
|
445
447
|
* name, `keep` included, and an owner cannot be smuggled into it through a
|
|
446
448
|
* typo that `.strict()` would otherwise swallow in silence.
|
|
447
449
|
*/
|
|
448
|
-
export const
|
|
450
|
+
export const planChangePrepareRequest = z.object({
|
|
451
|
+
operation_key: purchaseOperationKey,
|
|
449
452
|
target_plan: planId.meta({ description: 'The lower plan to move to; `basic` cancels.' }),
|
|
450
453
|
keep: planChangeKeep.nullable().meta({
|
|
451
454
|
description: 'What stays. `null` when the org already fits the target plan, so nothing is deleted.',
|
|
452
455
|
}),
|
|
453
456
|
}).strict();
|
|
457
|
+
const finalPlanChangeFields = {
|
|
458
|
+
change_id: z.uuid(),
|
|
459
|
+
operation_key: purchaseOperationKey,
|
|
460
|
+
keep: planChangeKeep.nullable(),
|
|
461
|
+
confirmation_proof: confirmationProof,
|
|
462
|
+
};
|
|
463
|
+
export const planChangeRequest = z.discriminatedUnion('target_plan', [
|
|
464
|
+
z.object({ ...finalPlanChangeFields, target_plan: z.literal('basic'), cancellation_reason: z.string().max(500).trim().optional() }).strict(),
|
|
465
|
+
z.object({ ...finalPlanChangeFields, target_plan: planId.exclude(['basic']) }).strict(),
|
|
466
|
+
]);
|
|
467
|
+
export const planChangeDecisionLookupQuery = z.object({ operation_key: purchaseOperationKey }).strict();
|
|
468
|
+
export const planChangeDecisionStatusResponse = z.discriminatedUnion('state', [
|
|
469
|
+
z.object({ state: z.literal('prepared'), change_id: z.uuid() }).strict(),
|
|
470
|
+
z.object({ state: z.literal('accepted'), change_id: z.uuid(), result: orgPlan }).strict(),
|
|
471
|
+
]);
|
|
454
472
|
/**
|
|
455
473
|
* An operator's per-org replacement for one or more catalogue limits —
|
|
456
474
|
* Enterprise's contracted numbers, most of all, which exist nowhere else.
|
package/dist/protocol.d.ts
CHANGED
|
@@ -942,9 +942,6 @@ export declare const bridgeState: z.ZodObject<{
|
|
|
942
942
|
online: z.ZodBoolean;
|
|
943
943
|
latency_ms: z.ZodNullable<z.ZodNumber>;
|
|
944
944
|
low_bandwidth: z.ZodBoolean;
|
|
945
|
-
health_reason: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
946
|
-
job_query_unanswered: "job_query_unanswered";
|
|
947
|
-
}>>>;
|
|
948
945
|
}, z.core.$strip>;
|
|
949
946
|
export type BridgeState = z.infer<typeof bridgeState>;
|
|
950
947
|
/**
|
package/dist/protocol.js
CHANGED
|
@@ -706,7 +706,6 @@ export const bridgeState = z.object({
|
|
|
706
706
|
online: z.boolean(),
|
|
707
707
|
latency_ms: z.number().nonnegative().nullable(),
|
|
708
708
|
low_bandwidth: z.boolean().meta({ description: 'Whether the bridge is in its low-bandwidth mode: datapoints capped, cameras reduced or stopped. Bridge-reported.' }),
|
|
709
|
-
health_reason: z.enum(['job_query_unanswered']).nullable().optional().meta({ description: 'Cloud-observed connection health: `job_query_unanswered` after a bridge ignores held-job queries; `null` on an ordinary connect or disconnect. Optional for older observations.' }),
|
|
710
709
|
});
|
|
711
710
|
/* ------------------------------------------------------------------------
|
|
712
711
|
* Cameras.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/** Persist before the start request; reuse only for identical input within one org. */
|
|
4
|
+
export const purchaseOperationKey = z.uuid().meta({ description: 'Client-generated UUID persisted before the start request. Unique per org and reused only for identical input.' });
|
package/dist/rest.d.ts
CHANGED
|
@@ -117,9 +117,6 @@ export declare const robotListItem: z.ZodObject<{
|
|
|
117
117
|
online: z.ZodBoolean;
|
|
118
118
|
latency_ms: z.ZodNullable<z.ZodNumber>;
|
|
119
119
|
low_bandwidth: z.ZodBoolean;
|
|
120
|
-
health_reason: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
121
|
-
job_query_unanswered: "job_query_unanswered";
|
|
122
|
-
}>>>;
|
|
123
120
|
}, z.core.$strip>;
|
|
124
121
|
exposes: z.ZodObject<{
|
|
125
122
|
datapoints: z.ZodNumber;
|
|
@@ -144,9 +141,6 @@ export declare const robotListResponse: z.ZodObject<{
|
|
|
144
141
|
online: z.ZodBoolean;
|
|
145
142
|
latency_ms: z.ZodNullable<z.ZodNumber>;
|
|
146
143
|
low_bandwidth: z.ZodBoolean;
|
|
147
|
-
health_reason: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
148
|
-
job_query_unanswered: "job_query_unanswered";
|
|
149
|
-
}>>>;
|
|
150
144
|
}, z.core.$strip>;
|
|
151
145
|
exposes: z.ZodObject<{
|
|
152
146
|
datapoints: z.ZodNumber;
|
|
@@ -223,9 +217,6 @@ export declare const robotDetailResponse: z.ZodObject<{
|
|
|
223
217
|
online: z.ZodBoolean;
|
|
224
218
|
latency_ms: z.ZodNullable<z.ZodNumber>;
|
|
225
219
|
low_bandwidth: z.ZodBoolean;
|
|
226
|
-
health_reason: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
227
|
-
job_query_unanswered: "job_query_unanswered";
|
|
228
|
-
}>>>;
|
|
229
220
|
}, z.core.$strip>;
|
|
230
221
|
exposes: z.ZodObject<{
|
|
231
222
|
datapoints: z.ZodNumber;
|
|
@@ -874,49 +865,6 @@ export declare const cancelRequest: z.ZodObject<{
|
|
|
874
865
|
job_id: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
|
|
875
866
|
}, z.core.$strict>;
|
|
876
867
|
export type CancelRequest = z.infer<typeof cancelRequest>;
|
|
877
|
-
/**
|
|
878
|
-
* Release one held job only after a human has physically stopped or isolated
|
|
879
|
-
* the robot and checked that it cannot move. This is an Owner operation, not
|
|
880
|
-
* an app command: a normal cancel asks the bridge to stop and cannot stand in
|
|
881
|
-
* for this assertion when the bridge is silent. The cloud cannot sense the
|
|
882
|
-
* physical stop from this field; it records the Owner's statement and reason.
|
|
883
|
-
*/
|
|
884
|
-
export declare const recoverHeldJobRequest: z.ZodObject<{
|
|
885
|
-
job_id: z.ZodUUID;
|
|
886
|
-
verified_stopped: z.ZodLiteral<true>;
|
|
887
|
-
reason: z.ZodString;
|
|
888
|
-
}, z.core.$strict>;
|
|
889
|
-
export type RecoverHeldJobRequest = z.infer<typeof recoverHeldJobRequest>;
|
|
890
|
-
/** The exact job settled to `lost` by the audited recovery. */
|
|
891
|
-
export declare const recoverHeldJobResponse: z.ZodObject<{
|
|
892
|
-
job: z.ZodObject<{
|
|
893
|
-
id: z.ZodUUID;
|
|
894
|
-
robot_id: z.ZodUUID;
|
|
895
|
-
slug: z.ZodString;
|
|
896
|
-
state: z.ZodEnum<{
|
|
897
|
-
unknown: "unknown";
|
|
898
|
-
failed: "failed";
|
|
899
|
-
running: "running";
|
|
900
|
-
succeeded: "succeeded";
|
|
901
|
-
cancelled: "cancelled";
|
|
902
|
-
lost: "lost";
|
|
903
|
-
}>;
|
|
904
|
-
origin: z.ZodEnum<{
|
|
905
|
-
fleetless: "fleetless";
|
|
906
|
-
external: "external";
|
|
907
|
-
}>;
|
|
908
|
-
started_at: z.ZodISODateTime;
|
|
909
|
-
updated_at: z.ZodISODateTime;
|
|
910
|
-
seq: z.ZodNumber;
|
|
911
|
-
result: z.ZodNullable<z.ZodUnknown>;
|
|
912
|
-
error: z.ZodNullable<z.ZodObject<{
|
|
913
|
-
code: z.ZodString;
|
|
914
|
-
message: z.ZodString;
|
|
915
|
-
details: z.ZodOptional<z.ZodUnknown>;
|
|
916
|
-
}, z.core.$strip>>;
|
|
917
|
-
}, z.core.$strip>;
|
|
918
|
-
}, z.core.$strip>;
|
|
919
|
-
export type RecoverHeldJobResponse = z.infer<typeof recoverHeldJobResponse>;
|
|
920
868
|
/**
|
|
921
869
|
* The query of a live release: `DELETE .../live?session_id=<uuid>`.
|
|
922
870
|
*
|
package/dist/rest.js
CHANGED
|
@@ -333,7 +333,6 @@ export const putRobotDetailsRequest = z.object({ details: robotDetailsDoc });
|
|
|
333
333
|
* | `POST /api/robots/:id/jobs/:slug` | `invokeRequest` | `invokeResponse` (action) or `serviceCallResponse` (service) |
|
|
334
334
|
* | `GET /api/robots/:id/jobs/:slug` | — | `jobResponse` (the current job, or null) |
|
|
335
335
|
* | `POST /api/robots/:id/jobs/:slug/cancel` | `cancelRequest` | `jobResponse` |
|
|
336
|
-
* | `POST /api/robots/:id/jobs/:slug/recover` | `recoverHeldJobRequest` | `recoverHeldJobResponse` |
|
|
337
336
|
* | `POST /api/robots/:id/publishers/:slug` | `publishRequest`| 204 |
|
|
338
337
|
* | `GET /api/robots/:id/exposures` | — | `exposureListResponse` |
|
|
339
338
|
*
|
|
@@ -419,20 +418,6 @@ export const cancelRequest = z.object({
|
|
|
419
418
|
description: 'The one job to stop. Absent or `null` cancels whatever is currently running on the slug, which is what every caller written before this field existed means. Unknown keys are refused rather than stripped, so a misspelling cannot silently become the slug-wide cancel.',
|
|
420
419
|
}),
|
|
421
420
|
}).strict();
|
|
422
|
-
/**
|
|
423
|
-
* Release one held job only after a human has physically stopped or isolated
|
|
424
|
-
* the robot and checked that it cannot move. This is an Owner operation, not
|
|
425
|
-
* an app command: a normal cancel asks the bridge to stop and cannot stand in
|
|
426
|
-
* for this assertion when the bridge is silent. The cloud cannot sense the
|
|
427
|
-
* physical stop from this field; it records the Owner's statement and reason.
|
|
428
|
-
*/
|
|
429
|
-
export const recoverHeldJobRequest = z.object({
|
|
430
|
-
job_id: z.uuid().meta({ description: 'The exact held job id read from the robot job state; another job must never be released by a stale request.' }),
|
|
431
|
-
verified_stopped: z.literal(true).meta({ description: 'The Owner confirms a physical stop and safety check; this is not a cloud sensor reading.' }),
|
|
432
|
-
reason: z.string().trim().min(10).max(500).meta({ description: 'The Owner\'s reason and safety-check record, 10–500 characters after trimming; retained in the audit trail.' }),
|
|
433
|
-
}).strict();
|
|
434
|
-
/** The exact job settled to `lost` by the audited recovery. */
|
|
435
|
-
export const recoverHeldJobResponse = z.object({ job });
|
|
436
421
|
/**
|
|
437
422
|
* The query of a live release: `DELETE .../live?session_id=<uuid>`.
|
|
438
423
|
*
|
package/dist/routes.js
CHANGED
|
@@ -13,10 +13,10 @@ import { jobRunListResponse, jobRunQuery, jobRunSummary, jobRunSummaryQuery } fr
|
|
|
13
13
|
import { legalAcceptanceListQuery, legalAcceptanceListResponse } from './legal-acceptances.js';
|
|
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
|
-
import { adminPlanChangeRequest, orgPlan, planChangeRequest } from './plans.js';
|
|
16
|
+
import { adminPlanChangeRequest, orgPlan, planChangeRequest, planChangePrepareRequest, planChangeDecisionLookupQuery, planChangeDecisionStatusResponse } from './plans.js';
|
|
17
17
|
import { supportRenewFailRequest, supportTokenRequest, supportTokenResponse } from './support.js';
|
|
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
|
-
import { cameraListResponse, cancelRequest,
|
|
18
|
+
import { purchaseIntentLookupQuery, purchaseIntentConfirmRequest, billingDecisionDisplayRequest, billingDecisionDisplayResponse, planChangePrepareResponse, purchaseIntentResponse, invoicePayRequest, billingCancelRequest, billingChangeRequest, billingChangeResponse, billingDetailsUpdate, billingDocumentDetail, billingDocumentFileQuery, billingDocumentList, billingView, chargePayRequest, checkoutRequest, checkoutResponse, checkoutStatus, paymentMethodChangeRequest, vatIdCheckRequest, vatIdCheckResponse, } from './billing.js';
|
|
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 = [
|
|
21
21
|
{ id: 'health', title: 'Health' },
|
|
22
22
|
{ id: 'developer-auth', title: 'Developer auth' },
|
|
@@ -2613,19 +2613,6 @@ export const ROUTES = [
|
|
|
2613
2613
|
'`JOB_HEARTBEAT_TIMEOUT_MS` is `504 bridge_timeout`; a cancel the bridge could not send at all is `502` carrying the bridge\'s own ' +
|
|
2614
2614
|
'code (`unknown_slug`, `action_server_lost`, `internal_error`).',
|
|
2615
2615
|
},
|
|
2616
|
-
{
|
|
2617
|
-
method: 'POST', path: '/api/robots/:id/jobs/:slug/recover', section: 'commands',
|
|
2618
|
-
summary: 'Releases one held job after an Owner verifies the robot is stopped.',
|
|
2619
|
-
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
2620
|
-
params: [
|
|
2621
|
-
{ name: 'id', description: 'The robot uuid in the authenticated Owner\'s organization.' },
|
|
2622
|
-
{ name: 'slug', description: 'The action slug holding the exact job named in the body.' },
|
|
2623
|
-
],
|
|
2624
|
-
query: null, request: recoverHeldJobRequest, response: recoverHeldJobResponse,
|
|
2625
|
-
errors: [...DEVELOPER_GUARD, 'tier_required', 'support_forbidden', 'invalid_uuid', 'not_found', 'validation_error', 'job_state_conflict', 'internal_error'],
|
|
2626
|
-
transport: 'http',
|
|
2627
|
-
notes: 'Use only after physically stopping or isolating the robot and checking that it cannot move. Read the held job id, then submit that exact id with a reason and `verified_stopped: true`. The assertion is a human safety check, not a sensor reading. The cloud records the Owner and reason in the audit trail and returns the job settled to `lost`. App users, server keys, other developers and support sessions cannot use this route. A connected bridge or a changed job returns `409 job_state_conflict`; a normal cancel is not recovery and never releases an uncertain job.',
|
|
2628
|
-
},
|
|
2629
2616
|
{
|
|
2630
2617
|
method: 'POST', path: '/api/robots/:id/publishers/:slug', section: 'commands',
|
|
2631
2618
|
summary: 'Publishes one message onto a configured publisher.',
|
|
@@ -2939,13 +2926,21 @@ export const ROUTES = [
|
|
|
2939
2926
|
'`addons` or replaced by an operator\'s override, so a consumer never recomputes it from the catalogue. `usage` is counted fresh on ' +
|
|
2940
2927
|
'every call, never cached. `switch` is present only for an organization still on the beta that has not yet landed on a priced plan.',
|
|
2941
2928
|
},
|
|
2929
|
+
{
|
|
2930
|
+
method: 'POST', path: '/api/org/plan/change/prepare', section: 'org',
|
|
2931
|
+
summary: 'Prepares a nonbinding downward-plan decision and its C.4 display.',
|
|
2932
|
+
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
2933
|
+
params: [], query: null, request: planChangePrepareRequest, response: planChangePrepareResponse,
|
|
2934
|
+
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict'], transport: 'http',
|
|
2935
|
+
notes: 'Owner only. Persists a prepared change reference and a short-lived display, without mutating the plan, pending_change, or legal acceptance. A same-key, same-input retry while undecided returns the same change_id with a fresh display. A Basic cancellation reason belongs only in the final PUT.',
|
|
2936
|
+
},
|
|
2942
2937
|
{
|
|
2943
2938
|
method: 'PUT', path: '/api/org/plan/change', section: 'org',
|
|
2944
|
-
summary: "
|
|
2939
|
+
summary: "Confirms a prepared downward-plan decision with its C.4 proof.",
|
|
2945
2940
|
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
2946
2941
|
params: [], query: null, request: planChangeRequest, response: orgPlan,
|
|
2947
2942
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict'], transport: 'http',
|
|
2948
|
-
notes: 'Owner tier, and **downward only**: this route moves the org to a lower plan or cancels it outright to Basic. It never moves the org ' +
|
|
2943
|
+
notes: 'Owner tier, and **downward only**: a prior prepare returns change_id and a displayed snapshot; this final PUT requires its confirmation_proof and the same operation_key, target_plan and keep. Only Basic permits cancellation_reason (at most 500 input characters). The reason is final idempotency metadata, not price or legal evidence. An exact replay returns the original result; a changed reason with the same key conflicts before effect. The decision and legal acceptance commit together. This route moves the org to a lower plan or cancels it outright to Basic. It never moves the org ' +
|
|
2949
2944
|
'up — an upgrade or an add-on goes through the billing routes instead (`POST /api/billing/checkout`, `POST /api/billing/change`). ' +
|
|
2950
2945
|
'`409 target_state_conflict` names `target_plan` with rule `not_lower` when the ' +
|
|
2951
2946
|
'chosen plan is not below the org\'s current one; with rule `locked_basic_only` when the org is locked (`orgLock`) and the chosen ' +
|
|
@@ -2958,7 +2953,15 @@ export const ROUTES = [
|
|
|
2958
2953
|
'kind not named in `keep` is deleted at that instant, never before** — except a choice made while the org is locked, which takes ' +
|
|
2959
2954
|
'effect at once, and a beta org\'s choice, which takes effect at the switch date instead. Anything created while the choice is ' +
|
|
2960
2955
|
'pending is checked against the target plan too and, when it passes, is folded into `keep`, so exactly what the confirmation counted ' +
|
|
2961
|
-
'is what is actually deleted.
|
|
2956
|
+
'is what is actually deleted. Replacing a still-pending choice requires a new prepare and proof-bound final PUT.',
|
|
2957
|
+
},
|
|
2958
|
+
{
|
|
2959
|
+
method: 'GET', path: '/api/org/plan/change/decisions', section: 'org',
|
|
2960
|
+
summary: 'Looks up the prepared or accepted owner plan decision by operation key.',
|
|
2961
|
+
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
2962
|
+
params: [], query: planChangeDecisionLookupQuery, request: null, response: planChangeDecisionStatusResponse,
|
|
2963
|
+
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found'], transport: 'http',
|
|
2964
|
+
notes: 'Scope the operation key to the authenticated real Owner and organization. An unknown or foreign key returns 404 without disclosure. Prepared returns only change_id; accepted returns the stored original orgPlan result. No proof is returned. Console checks this before asking for a fresh display after a lost final response.',
|
|
2962
2965
|
},
|
|
2963
2966
|
{
|
|
2964
2967
|
method: 'DELETE', path: '/api/org/plan/change', section: 'org',
|
|
@@ -2967,8 +2970,7 @@ export const ROUTES = [
|
|
|
2967
2970
|
params: [], query: null, request: null, response: null,
|
|
2968
2971
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'not_found'], transport: 'http',
|
|
2969
2972
|
notes: 'Owner tier. `404 not_found` when the org has no `pending_change` to withdraw. The org stays on its current plan, unchanged, as if ' +
|
|
2970
|
-
'the choice had never been made;
|
|
2971
|
-
'anyway.',
|
|
2973
|
+
'the choice had never been made; an Owner who wants a different one prepares a new display and confirms it with a final PUT.',
|
|
2972
2974
|
},
|
|
2973
2975
|
{
|
|
2974
2976
|
method: 'PATCH', path: '/api/admin/orgs/:id/plan', section: 'org',
|
|
@@ -3006,7 +3008,7 @@ export const ROUTES = [
|
|
|
3006
3008
|
params: [], query: null, request: null, response: billingView,
|
|
3007
3009
|
errors: [...DEVELOPER_GUARD, 'tier_required'], transport: 'http',
|
|
3008
3010
|
notes: '`available: false` when `MOLLIE_API_KEY` is not configured — this cloud takes no payments, and every billing route that ' +
|
|
3009
|
-
'charges or opens a Mollie checkout answers `503 billing_unavailable` instead of acting;
|
|
3011
|
+
'charges or opens a Mollie checkout answers `503 billing_unavailable` instead of acting; plan-change prepare, resume, the details and the ' +
|
|
3010
3012
|
'VAT-ID check need no Mollie and answer normally. `account` is `null` before the org has ever checked out; the plan ' +
|
|
3011
3013
|
'and its limits still come from `GET /api/org/plan` (fleetless/fleetless issue 103) and are not repeated here.',
|
|
3012
3014
|
},
|
|
@@ -3017,7 +3019,7 @@ export const ROUTES = [
|
|
|
3017
3019
|
params: [], query: null, request: checkoutRequest, response: checkoutResponse,
|
|
3018
3020
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict', 'rate_limited', ...BILLING_OFF, ...MOLLIE],
|
|
3019
3021
|
transport: 'http',
|
|
3020
|
-
notes: "Basic stays free for every payer.
|
|
3022
|
+
notes: "Basic stays free for every payer. This start creates only a nonbinding draft; accept_terms is deprecated and cannot confirm an order. Current company, buyer, VIES and EUR quote checks still apply. Persist operation_key before POST; same key/input recovers the intent, changed input conflicts. An eligible Owner obtains a no-store C.4 display, then explicitly confirms with its proof. No payment or acceptance occurs at start. Hosted payment later offers card, PayPal or Apple Pay; its return is <console>/settings/billing?checkout=<checkout_id>. An active/past_due account uses billing/change.",
|
|
3021
3023
|
},
|
|
3022
3024
|
{
|
|
3023
3025
|
method: 'GET', path: '/api/billing/intents', section: 'billing',
|
|
@@ -3025,7 +3027,16 @@ export const ROUTES = [
|
|
|
3025
3027
|
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
3026
3028
|
params: [], query: purchaseIntentLookupQuery, request: null, response: purchaseIntentResponse,
|
|
3027
3029
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found'], transport: 'http',
|
|
3028
|
-
notes: 'Supply exactly one of operation_key or intent_id and the expected operation. Scope lookup to the authenticated owner and org; unknown, foreign-org or mismatched-operation intents return 404 without disclosure. Repeating a lookup after restart or lost response returns the same intent/payment identity and, for a paid change, its billing result.
|
|
3030
|
+
notes: 'Supply exactly one of operation_key or intent_id and the expected operation. Scope lookup to the authenticated owner and org; unknown, foreign-org or mismatched-operation intents return 404 without disclosure. Repeating a lookup after restart or lost response returns the same intent/payment identity and, for a paid change, its billing result. A proof is never returned here; a still-eligible decision needs a fresh C.4 display and explicit Owner click.',
|
|
3031
|
+
},
|
|
3032
|
+
{
|
|
3033
|
+
method: 'POST', path: '/api/billing/intents/:id/display', section: 'billing',
|
|
3034
|
+
summary: 'Issues a short-lived C.4 decision display and opaque confirmation proof.',
|
|
3035
|
+
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
3036
|
+
params: [{ name: 'id', description: 'The eligible intent ID returned by checkout or billing change.' }],
|
|
3037
|
+
query: null, request: billingDecisionDisplayRequest, response: billingDecisionDisplayResponse,
|
|
3038
|
+
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'target_state_conflict'], transport: 'http',
|
|
3039
|
+
notes: 'Owner only, Cache-Control: no-store. Cloud persists the snapshot and proof hash for an eligible current checkout or paid-change intent of this Owner and org. Pending, held, refused or accepted intents cannot mint a new proof. The proof never appears in lookup, billing views or logs.',
|
|
3029
3040
|
},
|
|
3030
3041
|
{
|
|
3031
3042
|
method: 'POST', path: '/api/billing/intents/:id/confirm', section: 'billing',
|
|
@@ -3034,7 +3045,7 @@ export const ROUTES = [
|
|
|
3034
3045
|
params: [{ name: 'id', description: 'The intent ID returned by the start or lookup response.' }],
|
|
3035
3046
|
query: null, request: purchaseIntentConfirmRequest, response: purchaseIntentResponse,
|
|
3036
3047
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'target_state_conflict', 'plan_limit', 'rate_limited', ...BILLING_OFF, ...MOLLIE], transport: 'http',
|
|
3037
|
-
notes: '
|
|
3048
|
+
notes: 'Checkout and paid-change decisions require confirmation_proof along with the operation key, quote revision and buyer fingerprint shown in the persisted C.4 display. Cloud rechecks buyer, quote, selection, legal references, period and current state under the org lock; stale or spent proof conflicts without effect. One decision and one legal acceptance commit together. An exact same-key replay returns the original result without another payment or acceptance. Foreign ownership answers 404 without disclosure; pending or held cannot charge.',
|
|
3038
3049
|
},
|
|
3039
3050
|
{
|
|
3040
3051
|
method: 'GET', path: '/api/billing/checkout/:id', section: 'billing',
|
|
@@ -3066,12 +3077,12 @@ export const ROUTES = [
|
|
|
3066
3077
|
},
|
|
3067
3078
|
{
|
|
3068
3079
|
method: 'POST', path: '/api/billing/change', section: 'billing',
|
|
3069
|
-
summary: "Records a paid-change intent or
|
|
3080
|
+
summary: "Records a nonbinding paid-change intent for a plan, cycle or add-on target.",
|
|
3070
3081
|
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
3071
3082
|
params: [], query: null, request: billingChangeRequest, response: billingChangeResponse,
|
|
3072
3083
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict', ...BILLING_OFF, ...MOLLIE],
|
|
3073
3084
|
transport: 'http',
|
|
3074
|
-
notes: "The request names an absolute plan/cycle/add-on target and a stable operation_key.
|
|
3085
|
+
notes: "The request names an absolute plan/cycle/add-on target and a stable operation_key. Start is nonbinding for every change, including zero-charge, scheduled and formerly immediate decreases: it neither changes the plan nor writes legal acceptance. An eligible Owner obtains a C.4 display and explicitly confirms with its proof. Confirmation may return accepted_no_payment with charged: null and no provider payment or redirect, or payment_started for a charged change. Exact-key lookup recovers the accepted result. Existing no_account, past_due, no_valid_mandate and plan_limit conflicts remain.",
|
|
3075
3086
|
},
|
|
3076
3087
|
{
|
|
3077
3088
|
method: 'POST', path: '/api/billing/payment-method', section: 'billing',
|
|
@@ -3084,14 +3095,11 @@ export const ROUTES = [
|
|
|
3084
3095
|
},
|
|
3085
3096
|
{
|
|
3086
3097
|
method: 'POST', path: '/api/billing/cancel', section: 'billing',
|
|
3087
|
-
summary:
|
|
3088
|
-
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status:
|
|
3089
|
-
params: [], query: null, request: billingCancelRequest, requestOptional: true, response:
|
|
3090
|
-
errors: [...DEVELOPER_GUARD, 'tier_required', '
|
|
3091
|
-
notes: '
|
|
3092
|
-
'cancel. Takes effect at the period\'s end, nothing credited or refunded; over Basic\'s limits this is refused `409 ' +
|
|
3093
|
-
'plan_limit` and the console sends the owner to its choose-what-stays page instead, the same as a plan downgrade. "Cancel at ' +
|
|
3094
|
-
'period end" is not a flag here — it reads as `pending_change.target_plan === \'basic\'` on `GET /api/org/plan`.',
|
|
3098
|
+
summary: 'Rejects legacy direct cancellation after the C.4 gate is active.',
|
|
3099
|
+
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 409,
|
|
3100
|
+
params: [], query: null, request: billingCancelRequest, requestOptional: true, response: null,
|
|
3101
|
+
errors: [...DEVELOPER_GUARD, 'tier_required', 'target_state_conflict'], transport: 'http',
|
|
3102
|
+
notes: 'The C.4 gate rejects this legacy POST with 409 target_state_conflict before mutation, audit or mail. Console uses POST /api/org/plan/change/prepare and the proof-bound final PUT for Basic, including an optional reason there. This route cannot confirm a customer decision.',
|
|
3095
3103
|
},
|
|
3096
3104
|
{
|
|
3097
3105
|
method: 'POST', path: '/api/billing/resume', section: 'billing',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fleetless/contracts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.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",
|
|
@@ -60,6 +60,8 @@
|
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/node": "^26.2.0",
|
|
63
|
+
"ajv": "^8.20.0",
|
|
64
|
+
"ajv-formats": "^3.0.1",
|
|
63
65
|
"tsx": "^4.19.0",
|
|
64
66
|
"typescript": "^5.7.0",
|
|
65
67
|
"vitest": "^4.1.11"
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"type": "object",
|
|
4
|
-
"properties": {
|
|
5
|
-
"job_id": {
|
|
6
|
-
"type": "string",
|
|
7
|
-
"format": "uuid",
|
|
8
|
-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
|
|
9
|
-
"description": "The exact held job id read from the robot job state; another job must never be released by a stale request."
|
|
10
|
-
},
|
|
11
|
-
"verified_stopped": {
|
|
12
|
-
"type": "boolean",
|
|
13
|
-
"const": true,
|
|
14
|
-
"description": "The Owner confirms a physical stop and safety check; this is not a cloud sensor reading."
|
|
15
|
-
},
|
|
16
|
-
"reason": {
|
|
17
|
-
"type": "string",
|
|
18
|
-
"minLength": 10,
|
|
19
|
-
"maxLength": 500,
|
|
20
|
-
"description": "The Owner's reason and safety-check record, 10–500 characters after trimming; retained in the audit trail."
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"required": [
|
|
24
|
-
"job_id",
|
|
25
|
-
"verified_stopped",
|
|
26
|
-
"reason"
|
|
27
|
-
],
|
|
28
|
-
"additionalProperties": false
|
|
29
|
-
}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"type": "object",
|
|
4
|
-
"properties": {
|
|
5
|
-
"job": {
|
|
6
|
-
"type": "object",
|
|
7
|
-
"properties": {
|
|
8
|
-
"id": {
|
|
9
|
-
"type": "string",
|
|
10
|
-
"format": "uuid",
|
|
11
|
-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
|
|
12
|
-
"description": "The job's id, minted by the cloud when the invocation is accepted. Informative — state is observed by slug; a cancel names this id to stop one specific job rather than whatever is running."
|
|
13
|
-
},
|
|
14
|
-
"robot_id": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"format": "uuid",
|
|
17
|
-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
|
|
18
|
-
"description": "The robot this job is running on."
|
|
19
|
-
},
|
|
20
|
-
"slug": {
|
|
21
|
-
"type": "string",
|
|
22
|
-
"minLength": 2,
|
|
23
|
-
"maxLength": 63,
|
|
24
|
-
"pattern": "^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$",
|
|
25
|
-
"description": "The action or service this job is running, as the published configuration exposes it. One slug carries one job at a time, so every observer of that slug sees the same one."
|
|
26
|
-
},
|
|
27
|
-
"state": {
|
|
28
|
-
"type": "string",
|
|
29
|
-
"enum": [
|
|
30
|
-
"running",
|
|
31
|
-
"unknown",
|
|
32
|
-
"succeeded",
|
|
33
|
-
"failed",
|
|
34
|
-
"cancelled",
|
|
35
|
-
"lost"
|
|
36
|
-
],
|
|
37
|
-
"description": "Where the job stands: `running`, `unknown`, `succeeded`, `failed`, `cancelled` or `lost`. `unknown` is not an outcome — the robot went offline or silent and the cloud does not know yet; the slug stays occupied and the bridge's next statement resolves it, `error` naming why the cloud lost sight of it. `lost` is final: the bridge stated it does not know the job and nothing else runs on its action, or the action server vanished mid-goal."
|
|
38
|
-
},
|
|
39
|
-
"origin": {
|
|
40
|
-
"type": "string",
|
|
41
|
-
"enum": [
|
|
42
|
-
"fleetless",
|
|
43
|
-
"external"
|
|
44
|
-
],
|
|
45
|
-
"description": "Who started this job. `fleetless` for everything minted by the cloud; `external` for a goal the bridge found active on a published action without having sent it — no parameters, no starter, never written to `job_runs`."
|
|
46
|
-
},
|
|
47
|
-
"started_at": {
|
|
48
|
-
"type": "string",
|
|
49
|
-
"format": "date-time",
|
|
50
|
-
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
|
|
51
|
-
"description": "When the cloud minted this job, as an ISO 8601 timestamp. For a job adopted from a reconnecting bridge, this is **adoption time**, not the real start — the cloud never minted it."
|
|
52
|
-
},
|
|
53
|
-
"updated_at": {
|
|
54
|
-
"type": "string",
|
|
55
|
-
"format": "date-time",
|
|
56
|
-
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
|
|
57
|
-
"description": "When this job last changed, as an ISO 8601 timestamp."
|
|
58
|
-
},
|
|
59
|
-
"seq": {
|
|
60
|
-
"type": "integer",
|
|
61
|
-
"exclusiveMinimum": 0,
|
|
62
|
-
"maximum": 9007199254740991,
|
|
63
|
-
"description": "A monotonic counter ascending in mint order, and the named tiebreaker for any listing that claims one — `started_at` alone is not a total order. Scoped per cloud process and per run: job state lives in memory, so this restarts with the registry it orders."
|
|
64
|
-
},
|
|
65
|
-
"result": {
|
|
66
|
-
"anyOf": [
|
|
67
|
-
{},
|
|
68
|
-
{
|
|
69
|
-
"type": "null"
|
|
70
|
-
}
|
|
71
|
-
],
|
|
72
|
-
"description": "What the call returned once it succeeded, shaped by the ROS action or service itself. `null` until then, and for a job that did not succeed."
|
|
73
|
-
},
|
|
74
|
-
"error": {
|
|
75
|
-
"anyOf": [
|
|
76
|
-
{
|
|
77
|
-
"type": "object",
|
|
78
|
-
"properties": {
|
|
79
|
-
"code": {
|
|
80
|
-
"type": "string",
|
|
81
|
-
"minLength": 1,
|
|
82
|
-
"description": "A machine-readable code for the failure, such as `job_queue_full`, where one exists for it."
|
|
83
|
-
},
|
|
84
|
-
"message": {
|
|
85
|
-
"type": "string",
|
|
86
|
-
"minLength": 1,
|
|
87
|
-
"description": "A human-readable sentence saying what went wrong."
|
|
88
|
-
},
|
|
89
|
-
"details": {
|
|
90
|
-
"description": "The structured payload belonging to `code`, for the codes that document one — `job_queue_full` carries its `limit` and its `queued` count here. Absent for a failure with nothing structured to add, which is most of them."
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
"required": [
|
|
94
|
-
"code",
|
|
95
|
-
"message"
|
|
96
|
-
],
|
|
97
|
-
"additionalProperties": false
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
"type": "null"
|
|
101
|
-
}
|
|
102
|
-
],
|
|
103
|
-
"description": "Why the job failed, or why the cloud does not know how it stands: a human `message`, a `code` where one exists, and `details` for the codes that carry a documented payload. Set on `failed` and `lost`, and on `unknown` — where `code` is `bridge_disconnected` or `bridge_timeout`, the cloud's own reason for not knowing, cleared when the bridge reports the job running again."
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
"required": [
|
|
107
|
-
"id",
|
|
108
|
-
"robot_id",
|
|
109
|
-
"slug",
|
|
110
|
-
"state",
|
|
111
|
-
"origin",
|
|
112
|
-
"started_at",
|
|
113
|
-
"updated_at",
|
|
114
|
-
"seq",
|
|
115
|
-
"result",
|
|
116
|
-
"error"
|
|
117
|
-
],
|
|
118
|
-
"additionalProperties": false
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
"required": [
|
|
122
|
-
"job"
|
|
123
|
-
],
|
|
124
|
-
"additionalProperties": false
|
|
125
|
-
}
|