@jsm-mit/tigi-sharded-package 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/declarations/tigi-driver/tigi-driver.did +25 -0
- package/declarations/tigi-driver/tigi-driver.did.d.ts +19 -0
- package/declarations/tigi-driver/tigi-driver.did.js +3 -0
- package/declarations/tigi-simulator/tigi-simulator.did +8 -0
- package/declarations/tigi-simulator/tigi-simulator.did.d.ts +14 -0
- package/declarations/tigi-simulator/tigi-simulator.did.js +3 -0
- package/declarations/worker/worker.did +119 -25
- package/declarations/worker/worker.did.d.ts +122 -25
- package/declarations/worker/worker.did.js +97 -26
- package/dist/actors/rides-actor.d.ts +20 -0
- package/dist/actors/rides-actor.d.ts.map +1 -1
- package/dist/actors/rides-actor.js +38 -0
- package/dist/actors/scheduled-ride.d.ts +100 -0
- package/dist/actors/scheduled-ride.d.ts.map +1 -0
- package/dist/actors/scheduled-ride.js +179 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/interfaces.d.ts +21 -3
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/mappers.d.ts +6 -0
- package/dist/mappers.d.ts.map +1 -1
- package/dist/mappers.js +24 -3
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -44,6 +44,11 @@ const again = await request.searchAgainAsyncUnsafe(); // a new request, th
|
|
|
44
44
|
const ride = await request.getRideAsyncUnsafe(); // from the driver canister, every RIDE_POLL_MS (2 s)
|
|
45
45
|
await request.getRideRouteAsyncUnsafe(); // K-13: the ride's line while it is active (once; undefined after the end)
|
|
46
46
|
await request.cancelRideAsyncUnsafe(); // before inProgress, once
|
|
47
|
+
// ZT-*: a ride at a chosen time (1 h … 7 days ahead; drivers asked by their base, 3 → 25 km by the workers themselves):
|
|
48
|
+
const later = await rides.requestScheduledAsyncUnsafe({ pickup, destination, pickupAtMs }); // keep later.token; rides.resumeScheduled(token)
|
|
49
|
+
const s = await later.getAsyncUnsafe(); // phase collecting | booking | booked | started | rescue | closed; offers cheapest first
|
|
50
|
+
await later.chooseAsyncUnsafe(s.offers[0].offerId); // a booking; read again for booked / lastOrderRefused
|
|
51
|
+
// started → rides.resumeRequest(s.rideToken) is the ride; rescue → requestRideAsyncUnsafe with the same A, B from T−10 min (RESCUE_BEFORE_MS)
|
|
47
52
|
// P-20: card straight to the driver (Stripe) — when ride.cardAccepted, during inProgress:
|
|
48
53
|
const card = await request.startCardPaymentAsyncUnsafe(returnUrl); // open → go to card.url; the same page again while it stands
|
|
49
54
|
await request.checkCardPaymentAsyncUnsafe(); // back from Stripe (card=paid|cancelled in the URL); ride.cardPayment shows it too
|
|
@@ -65,6 +65,7 @@ type QuoteRequest = record {
|
|
|
65
65
|
riderName : text;
|
|
66
66
|
riderRating : opt nat16; // ×100, e.g. 487 = 4.87; none for a new rider
|
|
67
67
|
deadlineNs : nat64; // 20 s for the driver's OK (U-42)
|
|
68
|
+
pickupAtNs : opt nat64; // P-21: a ride at this time (asked by the base); absent = as soon as possible
|
|
68
69
|
};
|
|
69
70
|
|
|
70
71
|
type RideOrder = record {
|
|
@@ -77,8 +78,12 @@ type RideOrder = record {
|
|
|
77
78
|
destination : Geo;
|
|
78
79
|
price : Money; // the price of the accepted offer
|
|
79
80
|
answerByNs : nat64; // safety window: our driver canister accepts at once (U-42)
|
|
81
|
+
pickupAtNs : opt nat64; // P-22: a booking for this time — no ride until the driver's "Jadę"
|
|
80
82
|
};
|
|
81
83
|
|
|
84
|
+
// P-22: a booking of a ride at a chosen time (the driver's "Jadę" / giving it up).
|
|
85
|
+
type BookingRef = record { requestId : RequestId; driverKey : DriverKey };
|
|
86
|
+
|
|
82
87
|
type CloseReason = variant {
|
|
83
88
|
offerRejected; // the rider tapped ✕ on this driver's offer (U-39)
|
|
84
89
|
otherOfferChosen;
|
|
@@ -94,6 +99,15 @@ type RequestClosed = record {
|
|
|
94
99
|
|
|
95
100
|
// ---------------------------------------------------------------- driver → worker
|
|
96
101
|
|
|
102
|
+
// P-21: where the driver parks the car after work — for rides at a chosen time. Kept whether
|
|
103
|
+
// the driver works or not; renewed daily, gone after 7 days without a renewal.
|
|
104
|
+
type RegisterBase = record {
|
|
105
|
+
driverKey : DriverKey;
|
|
106
|
+
geohash : Geohash; // geohash6 of the base (~1.2 × 0.6 km), never the exact point
|
|
107
|
+
card : DriverCard;
|
|
108
|
+
cardVersion : nat32;
|
|
109
|
+
};
|
|
110
|
+
|
|
97
111
|
type RegisterDriver = record {
|
|
98
112
|
driverKey : DriverKey;
|
|
99
113
|
geohash : Geohash; // geohash7 of the driver: area by its geohash6 prefix,
|
|
@@ -102,6 +116,8 @@ type RegisterDriver = record {
|
|
|
102
116
|
card : DriverCard;
|
|
103
117
|
cardVersion : nat32; // the worker keeps the newest card
|
|
104
118
|
validUntilNs : opt nat64; // simulator only: no pulse needed until then (U-25)
|
|
119
|
+
freeAtNs : opt nat64; // P-23: on a ride that ends by then (≤ 5 min + 2 min of margin)
|
|
120
|
+
// — asked for rides "as soon as possible" as a queued next ride
|
|
105
121
|
};
|
|
106
122
|
|
|
107
123
|
// The route the driver's front got from its provider, in the same query that priced the
|
|
@@ -125,6 +141,9 @@ type Quote = record {
|
|
|
125
141
|
validUntilNs : nat64; // 60 s (U-39)
|
|
126
142
|
routeLine : opt RouteLine; // P-17: the line of the offer; none from an old canister
|
|
127
143
|
driverPosition : opt Geo; // P-18: exact, the start of the route — the pin of the offer
|
|
144
|
+
freeAtNs : opt nat64; // P-23: the driver ends a ride by then; `etaToPickupSec` counts
|
|
145
|
+
// from now and holds the rest of that ride; no pin, no
|
|
146
|
+
// `routeLine.toPickup` ("") — they would show the other rider's B
|
|
128
147
|
};
|
|
129
148
|
|
|
130
149
|
type QuoteDecline = record { requestId : RequestId; driverKey : DriverKey };
|
|
@@ -169,6 +188,8 @@ type RideView = record {
|
|
|
169
188
|
price : Money;
|
|
170
189
|
cardAccepted : opt bool; // P-20: the driver takes cards; absent = no
|
|
171
190
|
cardPayment : opt CardPaymentView; // P-20: once the rider started one
|
|
191
|
+
freeAtNs : opt nat64; // P-23: a queued ride — the driver ends the previous one by then;
|
|
192
|
+
// meanwhile no `driverPosition`
|
|
172
193
|
};
|
|
173
194
|
|
|
174
195
|
// P-20: the rider's card payment of a ride — Stripe Checkout on the driver's own account.
|
|
@@ -232,6 +253,10 @@ service : {
|
|
|
232
253
|
//
|
|
233
254
|
// service WorkerForDrivers : {
|
|
234
255
|
// registerDriver : (RegisterDriver) -> (variant { ok; err : ProtocolError });
|
|
256
|
+
// registerBase : (RegisterBase) -> (variant { ok; err : ProtocolError }); // P-21
|
|
257
|
+
// unregisterBase : (DriverKey) -> (); // P-21
|
|
258
|
+
// bookingStarted : (BookingRef) -> (variant { ok; err : ProtocolError }); // P-22
|
|
259
|
+
// bookingDropped : (BookingRef) -> (); // P-22
|
|
235
260
|
// unregisterDriver : (DriverKey) -> ();
|
|
236
261
|
// submitQuote : (Quote) -> (variant { ok; err : ProtocolError });
|
|
237
262
|
// declineQuote : (QuoteDecline) -> ();
|
|
@@ -2,6 +2,10 @@ import type { Principal } from '@icp-sdk/core/principal';
|
|
|
2
2
|
import type { ActorMethod } from '@icp-sdk/core/agent';
|
|
3
3
|
import type { IDL } from '@icp-sdk/core/candid';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* P-22: a booking of a ride at a chosen time (the driver's "Jadę" / giving it up).
|
|
7
|
+
*/
|
|
8
|
+
export interface BookingRef { 'requestId' : RequestId, 'driverKey' : DriverKey }
|
|
5
9
|
export interface CardPaymentArgs {
|
|
6
10
|
'returnUrl' : string,
|
|
7
11
|
'requestId' : RequestId,
|
|
@@ -64,6 +68,7 @@ export type ProtocolError = { 'expired' : null } |
|
|
|
64
68
|
{ 'unsupportedVersion' : number } |
|
|
65
69
|
{ 'notMyArea' : null };
|
|
66
70
|
export interface Quote {
|
|
71
|
+
'freeAtNs' : [] | [bigint],
|
|
67
72
|
'requestId' : RequestId,
|
|
68
73
|
'rideMeters' : number,
|
|
69
74
|
'rideSec' : number,
|
|
@@ -85,10 +90,22 @@ export interface QuoteRequest {
|
|
|
85
90
|
'deadlineNs' : bigint,
|
|
86
91
|
'pickup' : Geo,
|
|
87
92
|
'driverKey' : DriverKey,
|
|
93
|
+
'pickupAtNs' : [] | [bigint],
|
|
88
94
|
'riderRating' : [] | [number],
|
|
89
95
|
'riderName' : string,
|
|
90
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* P-21: where the driver parks the car after work — for rides at a chosen time. Kept whether
|
|
99
|
+
* the driver works or not; renewed daily, gone after 7 days without a renewal.
|
|
100
|
+
*/
|
|
101
|
+
export interface RegisterBase {
|
|
102
|
+
'card' : DriverCard,
|
|
103
|
+
'cardVersion' : number,
|
|
104
|
+
'geohash' : Geohash,
|
|
105
|
+
'driverKey' : DriverKey,
|
|
106
|
+
}
|
|
91
107
|
export interface RegisterDriver {
|
|
108
|
+
'freeAtNs' : [] | [bigint],
|
|
92
109
|
'card' : DriverCard,
|
|
93
110
|
'cardVersion' : number,
|
|
94
111
|
'geohash' : Geohash,
|
|
@@ -110,6 +127,7 @@ export interface RideOrder {
|
|
|
110
127
|
'requestId' : RequestId,
|
|
111
128
|
'pickup' : Geo,
|
|
112
129
|
'driverKey' : DriverKey,
|
|
130
|
+
'pickupAtNs' : [] | [bigint],
|
|
113
131
|
'riderRating' : [] | [number],
|
|
114
132
|
'answerByNs' : bigint,
|
|
115
133
|
'price' : Money,
|
|
@@ -130,6 +148,7 @@ export interface RideStatusChange {
|
|
|
130
148
|
'driverKey' : DriverKey,
|
|
131
149
|
}
|
|
132
150
|
export interface RideView {
|
|
151
|
+
'freeAtNs' : [] | [bigint],
|
|
133
152
|
'status' : RideStatus,
|
|
134
153
|
'requestId' : RequestId,
|
|
135
154
|
'positionAtNs' : [] | [bigint],
|
|
@@ -58,6 +58,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
58
58
|
});
|
|
59
59
|
const Geo = IDL.Record({ 'lat' : IDL.Float64, 'lng' : IDL.Float64 });
|
|
60
60
|
const RideView = IDL.Record({
|
|
61
|
+
'freeAtNs' : IDL.Opt(IDL.Nat64),
|
|
61
62
|
'status' : RideStatus,
|
|
62
63
|
'requestId' : RequestId,
|
|
63
64
|
'positionAtNs' : IDL.Opt(IDL.Nat64),
|
|
@@ -75,6 +76,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
75
76
|
'deadlineNs' : IDL.Nat64,
|
|
76
77
|
'pickup' : Geo,
|
|
77
78
|
'driverKey' : DriverKey,
|
|
79
|
+
'pickupAtNs' : IDL.Opt(IDL.Nat64),
|
|
78
80
|
'riderRating' : IDL.Opt(IDL.Nat16),
|
|
79
81
|
'riderName' : IDL.Text,
|
|
80
82
|
});
|
|
@@ -94,6 +96,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
94
96
|
'requestId' : RequestId,
|
|
95
97
|
'pickup' : Geo,
|
|
96
98
|
'driverKey' : DriverKey,
|
|
99
|
+
'pickupAtNs' : IDL.Opt(IDL.Nat64),
|
|
97
100
|
'riderRating' : IDL.Opt(IDL.Nat16),
|
|
98
101
|
'answerByNs' : IDL.Nat64,
|
|
99
102
|
'price' : Money,
|
|
@@ -224,6 +224,9 @@ type QuoteRequest = record {
|
|
|
224
224
|
deadlineNs : nat64;
|
|
225
225
|
pickup : Geo;
|
|
226
226
|
driverKey : text;
|
|
227
|
+
// P-21: a ride at this time — asked by the driver's base, answered until `deadlineNs`
|
|
228
|
+
// (T−30 min). Absent = as soon as possible.
|
|
229
|
+
pickupAtNs : opt nat64;
|
|
227
230
|
// ×100, e.g. 487 = 4.87; none for a new rider.
|
|
228
231
|
riderRating : opt nat16;
|
|
229
232
|
riderName : text;
|
|
@@ -244,6 +247,9 @@ type RideOrder = record {
|
|
|
244
247
|
requestId : text;
|
|
245
248
|
pickup : Geo;
|
|
246
249
|
driverKey : text;
|
|
250
|
+
// P-22: a booking for this time — accepted as usual, but no ride until the driver's
|
|
251
|
+
// "Jadę" (`bookingStarted`).
|
|
252
|
+
pickupAtNs : opt nat64;
|
|
247
253
|
riderRating : opt nat16;
|
|
248
254
|
// 20 s for the driver to accept (U-39).
|
|
249
255
|
answerByNs : nat64;
|
|
@@ -263,6 +269,8 @@ type RideStatus = variant {
|
|
|
263
269
|
inProgress;
|
|
264
270
|
};
|
|
265
271
|
type RideView = record {
|
|
272
|
+
// P-23: a queued ride — the driver ends the previous one by then; no position meanwhile.
|
|
273
|
+
freeAtNs : opt nat64;
|
|
266
274
|
status : RideStatus;
|
|
267
275
|
requestId : text;
|
|
268
276
|
positionAtNs : opt nat64;
|
|
@@ -327,6 +327,11 @@ export interface QuoteRequest {
|
|
|
327
327
|
'deadlineNs' : bigint,
|
|
328
328
|
'pickup' : Geo,
|
|
329
329
|
'driverKey' : string,
|
|
330
|
+
/**
|
|
331
|
+
* P-21: a ride at this time — asked by the driver's base, answered until `deadlineNs`
|
|
332
|
+
* (T−30 min). Absent = as soon as possible.
|
|
333
|
+
*/
|
|
334
|
+
'pickupAtNs' : [] | [bigint],
|
|
330
335
|
/**
|
|
331
336
|
* ×100, e.g. 487 = 4.87; none for a new rider.
|
|
332
337
|
*/
|
|
@@ -356,6 +361,11 @@ export interface RideOrder {
|
|
|
356
361
|
'requestId' : string,
|
|
357
362
|
'pickup' : Geo,
|
|
358
363
|
'driverKey' : string,
|
|
364
|
+
/**
|
|
365
|
+
* P-22: a booking for this time — accepted as usual, but no ride until the driver's
|
|
366
|
+
* "Jadę" (`bookingStarted`).
|
|
367
|
+
*/
|
|
368
|
+
'pickupAtNs' : [] | [bigint],
|
|
359
369
|
'riderRating' : [] | [number],
|
|
360
370
|
/**
|
|
361
371
|
* 20 s for the driver to accept (U-39).
|
|
@@ -379,6 +389,10 @@ export type RideStatus = { 'completed' : CompletedStatus } |
|
|
|
379
389
|
{ 'cancelledByDriver' : CancelledByDriverStatus } |
|
|
380
390
|
{ 'inProgress' : null };
|
|
381
391
|
export interface RideView {
|
|
392
|
+
/**
|
|
393
|
+
* P-23: a queued ride — the driver ends the previous one by then; no position meanwhile.
|
|
394
|
+
*/
|
|
395
|
+
'freeAtNs' : [] | [bigint],
|
|
382
396
|
'status' : RideStatus,
|
|
383
397
|
'requestId' : string,
|
|
384
398
|
'positionAtNs' : [] | [bigint],
|
|
@@ -89,6 +89,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
89
89
|
'hasLicencePhoto' : IDL.Bool,
|
|
90
90
|
});
|
|
91
91
|
const RideView = IDL.Record({
|
|
92
|
+
'freeAtNs' : IDL.Opt(IDL.Nat64),
|
|
92
93
|
'status' : RideStatus,
|
|
93
94
|
'requestId' : IDL.Text,
|
|
94
95
|
'positionAtNs' : IDL.Opt(IDL.Nat64),
|
|
@@ -148,6 +149,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
148
149
|
'deadlineNs' : IDL.Nat64,
|
|
149
150
|
'pickup' : Geo,
|
|
150
151
|
'driverKey' : IDL.Text,
|
|
152
|
+
'pickupAtNs' : IDL.Opt(IDL.Nat64),
|
|
151
153
|
'riderRating' : IDL.Opt(IDL.Nat16),
|
|
152
154
|
'riderName' : IDL.Text,
|
|
153
155
|
});
|
|
@@ -167,6 +169,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
167
169
|
'requestId' : IDL.Text,
|
|
168
170
|
'pickup' : Geo,
|
|
169
171
|
'driverKey' : IDL.Text,
|
|
172
|
+
'pickupAtNs' : IDL.Opt(IDL.Nat64),
|
|
170
173
|
'riderRating' : IDL.Opt(IDL.Nat16),
|
|
171
174
|
'answerByNs' : IDL.Nat64,
|
|
172
175
|
'price' : Money,
|
|
@@ -27,56 +27,75 @@ type TigiWorker =
|
|
|
27
27
|
/// driver wasms. Answers the seq this worker holds after the call; the core sends again
|
|
28
28
|
/// from there. Blocks act at once (WO-2); ratings go into offers and orders (P-12).
|
|
29
29
|
applyCoreChanges: (batch: CoreChanges) -> (Result);
|
|
30
|
+
/// ZT-18 (P-22): the booked driver gives the booking up.
|
|
31
|
+
bookingDropped: (ref: BookingRef) -> ();
|
|
32
|
+
/// ZT-17 (P-22): the booked driver's "Jadę" — the ride starts here as an accepted request.
|
|
33
|
+
bookingStarted: (ref: BookingRef) -> (ProtocolResult);
|
|
34
|
+
/// ZT-13: the rider gives the ride at a chosen time up.
|
|
35
|
+
cancelScheduled: (ref: RequestRef) -> (Result_3);
|
|
30
36
|
/// ZO-13, ZO-14, ZO-17.
|
|
31
|
-
chooseOffer: (ref: OfferRef) -> (
|
|
37
|
+
chooseOffer: (ref: OfferRef) -> (Result_10);
|
|
38
|
+
/// ZT-14: "Wybierz" on an offer for a ride at a chosen time — a booking order.
|
|
39
|
+
chooseScheduledOffer: (ref: OfferRef) -> (Result_10);
|
|
32
40
|
clearLogs: () -> ();
|
|
33
41
|
/// ZO-15 (otherOfferChosen after an acceptance in another worker), ZO-18 (riderGaveUp).
|
|
34
|
-
closeRequest: (args: CloseRequestArgs) -> (
|
|
42
|
+
closeRequest: (args: CloseRequestArgs) -> (Result_3);
|
|
43
|
+
/// ZT-21: the copies in the other workers close once one booked.
|
|
44
|
+
closeScheduled: (args: CloseRequestArgs) -> (Result_3);
|
|
35
45
|
/// The coordinator only: the settings it computes for every worker.
|
|
36
|
-
configure: (args: ConfigureArgs) -> (
|
|
46
|
+
configure: (args: ConfigureArgs) -> (Result_9);
|
|
37
47
|
/// ZO-6.
|
|
38
48
|
declineQuote: (decline: QuoteDecline) -> ();
|
|
39
49
|
/// What this worker holds of the core's network state.
|
|
40
50
|
getCoreCopyStatus: () -> (CoreCopyStatus) query;
|
|
41
51
|
/// The flow's numbers (scripts, the coordinator's front).
|
|
42
|
-
getFlowStatus: () -> (
|
|
52
|
+
getFlowStatus: () -> (Result_8) query;
|
|
43
53
|
getLogs: () -> (text) query;
|
|
44
54
|
/// ZO-21 (2026-10-24, route line): the route line of one offer, for the rider of the
|
|
45
55
|
/// request only (the package asks after a tap on the offer).
|
|
46
|
-
getOfferRoute: (ref: OfferRef) -> (
|
|
56
|
+
getOfferRoute: (ref: OfferRef) -> (Result_7) query;
|
|
47
57
|
/// The load this worker counts per geohash prefix of the given length (1–6): the
|
|
48
58
|
/// coordinator picks from it what to give another worker on a split (KO-5).
|
|
49
|
-
getPrefixCounts: (length: nat) -> (
|
|
59
|
+
getPrefixCounts: (length: nat) -> (Result_6) query;
|
|
50
60
|
/// ZO-11: the state and the offers (the package polls it every second).
|
|
51
|
-
getRequest: (ref: RequestRef) -> (
|
|
61
|
+
getRequest: (ref: RequestRef) -> (Result_2) query;
|
|
62
|
+
/// ZT-12: the state and the offers of a ride at a chosen time.
|
|
63
|
+
getScheduled: (ref: RequestRef) -> (Result_1) query;
|
|
52
64
|
/// The worker's own view of itself — for the coordinator and its front.
|
|
53
|
-
getStatus: () -> (
|
|
65
|
+
getStatus: () -> (Result_5) query;
|
|
54
66
|
/// The coordinator only, before it deletes the worker: what a deleted canister still
|
|
55
67
|
/// holds is burned.
|
|
56
|
-
giveBackCycles: () -> (
|
|
68
|
+
giveBackCycles: () -> (Result_4);
|
|
57
69
|
/// ZO-18: the rider gives up.
|
|
58
|
-
giveUp: (ref: RequestRef) -> (
|
|
70
|
+
giveUp: (ref: RequestRef) -> (Result_3);
|
|
59
71
|
/// WO-20 (stage and the test modes): simulated drivers within 3 km of the point?
|
|
60
|
-
hasSimulatedDrivers: (args: HasSimulatedDriversArgs) -> (
|
|
72
|
+
hasSimulatedDrivers: (args: HasSimulatedDriversArgs) -> (Result_3) query;
|
|
61
73
|
/// The coordinator only, in a test mode only (prod and stage refuse, and so does the
|
|
62
74
|
/// coordinator): a load put on this worker. The cells' counters grow, and the worker
|
|
63
75
|
/// reports `reportLevel` as a real minute would — what a local script uses to force a
|
|
64
76
|
/// split.
|
|
65
|
-
injectTestLoad: (args: TestLoadArgs) -> (
|
|
77
|
+
injectTestLoad: (args: TestLoadArgs) -> (Result_3);
|
|
66
78
|
/// WO-3: the geohash lies in this worker's area (by the coordinator's newest map).
|
|
67
79
|
isMyArea: (geohash: text) -> (bool) query;
|
|
68
80
|
/// K-8: the rider rates the driver.
|
|
69
|
-
rateDriver: (args: RateDriverArgs) -> (
|
|
81
|
+
rateDriver: (args: RateDriverArgs) -> (Result_3);
|
|
70
82
|
/// K-8.
|
|
71
83
|
rateRider: (rating: RiderRating) -> (ProtocolResult);
|
|
72
84
|
/// ZO-10: a stale offer asks its driver again.
|
|
73
|
-
refreshOffer: (ref: OfferRef) -> (
|
|
85
|
+
refreshOffer: (ref: OfferRef) -> (Result_3);
|
|
86
|
+
/// ZT-1 … ZT-3 (P-21): a driver's base — on a change and once a day, whether the driver
|
|
87
|
+
/// works or not.
|
|
88
|
+
registerBase: (args: RegisterBase) -> (ProtocolResult);
|
|
74
89
|
/// WO-1 … WO-8: a driver reports itself — on a cell change and every 60 s (U-27).
|
|
75
90
|
registerDriver: (args: RegisterDriver) -> (ProtocolResult);
|
|
76
91
|
/// ZO-12: ✕.
|
|
77
|
-
rejectOffer: (ref: OfferRef) -> (
|
|
92
|
+
rejectOffer: (ref: OfferRef) -> (Result_3);
|
|
93
|
+
/// ZT-9: ✕ on one offer.
|
|
94
|
+
rejectScheduledOffer: (ref: OfferRef) -> (Result_3);
|
|
78
95
|
/// ZO-1 … ZO-4, ZO-8: a request in this worker; the drivers are asked after the answer.
|
|
79
|
-
requestRide: (args: RequestRideArgs) -> (
|
|
96
|
+
requestRide: (args: RequestRideArgs) -> (Result_2);
|
|
97
|
+
/// ZT-4: a ride at a chosen time in this worker (kurs-na-termin.md).
|
|
98
|
+
requestScheduled: (args: ScheduledRideArgs) -> (Result_1);
|
|
80
99
|
/// K-2, K-6, K-7.
|
|
81
100
|
rideStatusChanged: (change: RideStatusChange) -> (ProtocolResult);
|
|
82
101
|
/// The coordinator only (KO-6): the whole prefix map. The newest version wins; answers
|
|
@@ -84,6 +103,8 @@ type TigiWorker =
|
|
|
84
103
|
setAreaMap: (map: AreaMap) -> (Result);
|
|
85
104
|
/// ZO-9, ZO-10.
|
|
86
105
|
submitQuote: (quote: Quote) -> (ProtocolResult);
|
|
106
|
+
/// ZT-2 (P-21).
|
|
107
|
+
unregisterBase: (driverKey: DriverKey) -> ();
|
|
87
108
|
/// WO-6.
|
|
88
109
|
unregisterDriver: (driverKey: DriverKey) -> ();
|
|
89
110
|
};
|
|
@@ -92,6 +113,54 @@ type TestLoadArgs =
|
|
|
92
113
|
cells: vec PrefixCount;
|
|
93
114
|
reportLevel: opt nat;
|
|
94
115
|
};
|
|
116
|
+
type ScheduledView =
|
|
117
|
+
record {
|
|
118
|
+
asOfNs: nat64;
|
|
119
|
+
asked: nat32;
|
|
120
|
+
closesNs: nat64;
|
|
121
|
+
createdNs: nat64;
|
|
122
|
+
lastOrderRefused: bool;
|
|
123
|
+
nextStageNs: opt nat64;
|
|
124
|
+
offers: vec OfferView;
|
|
125
|
+
pickupAtNs: nat64;
|
|
126
|
+
radiusMeters: nat32;
|
|
127
|
+
requestId: RequestId;
|
|
128
|
+
state: ScheduledStateView;
|
|
129
|
+
waiting: nat32;
|
|
130
|
+
};
|
|
131
|
+
type ScheduledStateView =
|
|
132
|
+
variant {
|
|
133
|
+
booked:
|
|
134
|
+
record {
|
|
135
|
+
card: DriverCard;
|
|
136
|
+
driverCanister: principal;
|
|
137
|
+
driverKey: DriverKey;
|
|
138
|
+
driverRating: opt nat16;
|
|
139
|
+
price: Money;
|
|
140
|
+
};
|
|
141
|
+
booking:
|
|
142
|
+
record {
|
|
143
|
+
answerByNs: nat64;
|
|
144
|
+
driverCanister: principal;
|
|
145
|
+
driverKey: DriverKey;
|
|
146
|
+
};
|
|
147
|
+
closed: record {reason: CloseReason;};
|
|
148
|
+
collecting;
|
|
149
|
+
rescue: record {reason: RescueReason;};
|
|
150
|
+
started: record {
|
|
151
|
+
driverCanister: principal;
|
|
152
|
+
driverKey: DriverKey;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
type ScheduledRideArgs =
|
|
156
|
+
record {
|
|
157
|
+
destination: Geo;
|
|
158
|
+
maxRadiusMeters: nat32;
|
|
159
|
+
pickup: Geo;
|
|
160
|
+
pickupAtNs: nat64;
|
|
161
|
+
requestId: RequestId;
|
|
162
|
+
riderName: text;
|
|
163
|
+
};
|
|
95
164
|
type RouteLine =
|
|
96
165
|
record {
|
|
97
166
|
ride: text;
|
|
@@ -122,53 +191,63 @@ type RideStatus =
|
|
|
122
191
|
type Result_9 =
|
|
123
192
|
variant {
|
|
124
193
|
err: Error;
|
|
125
|
-
ok:
|
|
194
|
+
ok: WorkerConfig;
|
|
126
195
|
};
|
|
127
196
|
type Result_8 =
|
|
128
197
|
variant {
|
|
129
198
|
err: Error;
|
|
130
|
-
ok:
|
|
199
|
+
ok: FlowStatus;
|
|
131
200
|
};
|
|
132
201
|
type Result_7 =
|
|
133
202
|
variant {
|
|
134
203
|
err: Error;
|
|
135
|
-
ok:
|
|
204
|
+
ok: RouteLine;
|
|
136
205
|
};
|
|
137
206
|
type Result_6 =
|
|
138
207
|
variant {
|
|
139
208
|
err: Error;
|
|
140
|
-
ok:
|
|
209
|
+
ok: vec PrefixCount;
|
|
141
210
|
};
|
|
142
211
|
type Result_5 =
|
|
143
212
|
variant {
|
|
144
213
|
err: Error;
|
|
145
|
-
ok:
|
|
214
|
+
ok: WorkerStatus;
|
|
146
215
|
};
|
|
147
216
|
type Result_4 =
|
|
148
217
|
variant {
|
|
149
218
|
err: Error;
|
|
150
|
-
ok:
|
|
219
|
+
ok: nat;
|
|
151
220
|
};
|
|
152
221
|
type Result_3 =
|
|
153
222
|
variant {
|
|
154
223
|
err: Error;
|
|
155
|
-
ok:
|
|
224
|
+
ok: bool;
|
|
156
225
|
};
|
|
157
226
|
type Result_2 =
|
|
158
227
|
variant {
|
|
159
228
|
err: Error;
|
|
160
|
-
ok:
|
|
229
|
+
ok: RequestView;
|
|
230
|
+
};
|
|
231
|
+
type Result_10 =
|
|
232
|
+
variant {
|
|
233
|
+
err: Error;
|
|
234
|
+
ok: ChooseOutcome;
|
|
161
235
|
};
|
|
162
236
|
type Result_1 =
|
|
163
237
|
variant {
|
|
164
238
|
err: Error;
|
|
165
|
-
ok:
|
|
239
|
+
ok: ScheduledView;
|
|
166
240
|
};
|
|
167
241
|
type Result =
|
|
168
242
|
variant {
|
|
169
243
|
err: Error;
|
|
170
244
|
ok: nat64;
|
|
171
245
|
};
|
|
246
|
+
type RescueReason =
|
|
247
|
+
variant {
|
|
248
|
+
driverDropped;
|
|
249
|
+
noChoice;
|
|
250
|
+
};
|
|
172
251
|
type RequestView =
|
|
173
252
|
record {
|
|
174
253
|
asOfNs: opt nat64;
|
|
@@ -216,9 +295,17 @@ type RegisterDriver =
|
|
|
216
295
|
card: DriverCard;
|
|
217
296
|
cardVersion: nat32;
|
|
218
297
|
driverKey: DriverKey;
|
|
298
|
+
freeAtNs: opt nat64;
|
|
219
299
|
geohash: Geohash;
|
|
220
300
|
validUntilNs: opt nat64;
|
|
221
301
|
};
|
|
302
|
+
type RegisterBase =
|
|
303
|
+
record {
|
|
304
|
+
card: DriverCard;
|
|
305
|
+
cardVersion: nat32;
|
|
306
|
+
driverKey: DriverKey;
|
|
307
|
+
geohash: Geohash;
|
|
308
|
+
};
|
|
222
309
|
type RateDriverArgs =
|
|
223
310
|
record {
|
|
224
311
|
requestId: RequestId;
|
|
@@ -234,6 +321,7 @@ type Quote =
|
|
|
234
321
|
driverKey: DriverKey;
|
|
235
322
|
driverPosition: opt Geo;
|
|
236
323
|
etaToPickupSec: nat32;
|
|
324
|
+
freeAtNs: opt nat64;
|
|
237
325
|
price: Money;
|
|
238
326
|
requestId: RequestId;
|
|
239
327
|
rideMeters: nat32;
|
|
@@ -282,6 +370,7 @@ type OfferView =
|
|
|
282
370
|
driverPosition: opt Geo;
|
|
283
371
|
driverRating: opt nat16;
|
|
284
372
|
etaToPickupSec: nat32;
|
|
373
|
+
freeAtNs: opt nat64;
|
|
285
374
|
pinGeohash: text;
|
|
286
375
|
price: Money;
|
|
287
376
|
receivedNs: nat64;
|
|
@@ -464,6 +553,11 @@ type CarrierKind =
|
|
|
464
553
|
rideHailing;
|
|
465
554
|
taxi;
|
|
466
555
|
};
|
|
556
|
+
type BookingRef =
|
|
557
|
+
record {
|
|
558
|
+
driverKey: DriverKey;
|
|
559
|
+
requestId: RequestId;
|
|
560
|
+
};
|
|
467
561
|
type AreaMap =
|
|
468
562
|
record {
|
|
469
563
|
entries: vec PrefixEntry;
|