@jsm-mit/tigi-sharded-package 0.3.0 → 0.4.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 +7 -2
- package/declarations/coordinator/coordinator.did +39 -0
- package/declarations/coordinator/coordinator.did.d.ts +68 -0
- package/declarations/coordinator/coordinator.did.js +23 -0
- package/declarations/core/core.did +170 -45
- package/declarations/core/core.did.d.ts +155 -44
- package/declarations/core/core.did.js +122 -43
- package/declarations/tigi-driver/tigi-driver.did +15 -0
- package/declarations/tigi-driver/tigi-driver.did.d.ts +19 -0
- package/declarations/tigi-driver/tigi-driver.did.js +6 -0
- package/declarations/tigi-simulator/tigi-simulator.did +46 -4
- package/declarations/tigi-simulator/tigi-simulator.did.d.ts +70 -4
- package/declarations/tigi-simulator/tigi-simulator.did.js +39 -10
- package/declarations/worker/worker.did +23 -6
- package/declarations/worker/worker.did.d.ts +18 -6
- package/declarations/worker/worker.did.js +14 -7
- package/dist/actors/rides-actor.d.ts +21 -1
- package/dist/actors/rides-actor.d.ts.map +1 -1
- package/dist/actors/rides-actor.js +44 -2
- package/dist/geo.d.ts +5 -0
- package/dist/geo.d.ts.map +1 -1
- package/dist/geo.js +41 -0
- package/dist/group/canister-actor.d.ts +7 -0
- package/dist/group/canister-actor.d.ts.map +1 -1
- package/dist/group/canister-actor.js +18 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/interfaces.d.ts +15 -1
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/mappers.d.ts +7 -2
- package/dist/mappers.d.ts.map +1 -1
- package/dist/mappers.js +17 -2
- package/package.json +5 -4
|
@@ -104,6 +104,16 @@ type RegisterDriver = record {
|
|
|
104
104
|
validUntilNs : opt nat64; // simulator only: no pulse needed until then (U-25)
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
+
// The route the driver's front got from its provider, in the same query that priced the
|
|
108
|
+
// quote (2026-10-24, route line): two legs, each a Google encoded polyline of precision 6
|
|
109
|
+
// (lat, lng; 1e-6 degrees). `toPickup` starts at the driver's exact position and ends at A,
|
|
110
|
+
// `ride` runs A → B. At most 4 096 bytes and 500 points for both legs together (P-17);
|
|
111
|
+
// a line over the cap or not valid is dropped, never the quote.
|
|
112
|
+
type RouteLine = record {
|
|
113
|
+
toPickup : text;
|
|
114
|
+
ride : text;
|
|
115
|
+
};
|
|
116
|
+
|
|
107
117
|
type Quote = record {
|
|
108
118
|
requestId : RequestId;
|
|
109
119
|
driverKey : DriverKey;
|
|
@@ -113,6 +123,8 @@ type Quote = record {
|
|
|
113
123
|
rideSec : nat32;
|
|
114
124
|
price : Money; // start fee + per km (U-28), computed by the driver canister
|
|
115
125
|
validUntilNs : nat64; // 60 s (U-39)
|
|
126
|
+
routeLine : opt RouteLine; // P-17: the line of the offer; none from an old canister
|
|
127
|
+
driverPosition : opt Geo; // P-18: exact, the start of the route — the pin of the offer
|
|
116
128
|
};
|
|
117
129
|
|
|
118
130
|
type QuoteDecline = record { requestId : RequestId; driverKey : DriverKey };
|
|
@@ -180,6 +192,9 @@ service : {
|
|
|
180
192
|
// rider waits on the worker's request state and `getRide` answers `notFound`)
|
|
181
193
|
getRide : (RideRef) -> (variant { ok : RideView; err : ProtocolError }) query;
|
|
182
194
|
getLicence : (RideRef) -> (variant { ok : Licence; err : ProtocolError }) query;
|
|
195
|
+
// P-19: the line of the accepted quote while the ride is active (`notFound` without a
|
|
196
|
+
// line or after the end); an old canister has no such method — the rider draws none.
|
|
197
|
+
getRideRoute : (RideRef) -> (variant { ok : RouteLine; err : ProtocolError }) query;
|
|
183
198
|
cancelRide : (RideRef) -> (variant { ok; err : ProtocolError });
|
|
184
199
|
}
|
|
185
200
|
|
|
@@ -48,9 +48,11 @@ export interface Quote {
|
|
|
48
48
|
'requestId' : RequestId,
|
|
49
49
|
'rideMeters' : number,
|
|
50
50
|
'rideSec' : number,
|
|
51
|
+
'routeLine' : [] | [RouteLine],
|
|
51
52
|
'driverKey' : DriverKey,
|
|
52
53
|
'price' : Money,
|
|
53
54
|
'etaToPickupSec' : number,
|
|
55
|
+
'driverPosition' : [] | [Geo],
|
|
54
56
|
'toPickupMeters' : number,
|
|
55
57
|
'validUntilNs' : bigint,
|
|
56
58
|
}
|
|
@@ -122,6 +124,14 @@ export interface RiderRating {
|
|
|
122
124
|
'stars' : number,
|
|
123
125
|
'driverKey' : DriverKey,
|
|
124
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* The route the driver's front got from its provider, in the same query that priced the
|
|
129
|
+
* quote (2026-10-24, route line): two legs, each a Google encoded polyline of precision 6
|
|
130
|
+
* (lat, lng; 1e-6 degrees). `toPickup` starts at the driver's exact position and ends at A,
|
|
131
|
+
* `ride` runs A → B. At most 4 096 bytes and 500 points for both legs together (P-17);
|
|
132
|
+
* a line over the cap or not valid is dropped, never the quote.
|
|
133
|
+
*/
|
|
134
|
+
export interface RouteLine { 'ride' : string, 'toPickup' : string }
|
|
125
135
|
/**
|
|
126
136
|
* Implemented by every driver canister.
|
|
127
137
|
*/
|
|
@@ -145,6 +155,15 @@ export interface _SERVICE {
|
|
|
145
155
|
{ 'ok' : RideView } |
|
|
146
156
|
{ 'err' : ProtocolError }
|
|
147
157
|
>,
|
|
158
|
+
/**
|
|
159
|
+
* P-19: the line of the accepted quote while the ride is active (`notFound` without a
|
|
160
|
+
* line or after the end); an old canister has no such method — the rider draws none.
|
|
161
|
+
*/
|
|
162
|
+
'getRideRoute' : ActorMethod<
|
|
163
|
+
[RideRef],
|
|
164
|
+
{ 'ok' : RouteLine } |
|
|
165
|
+
{ 'err' : ProtocolError }
|
|
166
|
+
>,
|
|
148
167
|
'protocolVersion' : ActorMethod<[], number>,
|
|
149
168
|
/**
|
|
150
169
|
* worker → driver: queue and answer at once
|
|
@@ -53,6 +53,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
53
53
|
'driver' : DriverCard,
|
|
54
54
|
'driverPosition' : IDL.Opt(Geo),
|
|
55
55
|
});
|
|
56
|
+
const RouteLine = IDL.Record({ 'ride' : IDL.Text, 'toPickup' : IDL.Text });
|
|
56
57
|
const QuoteRequest = IDL.Record({
|
|
57
58
|
'destination' : Geo,
|
|
58
59
|
'requestId' : RequestId,
|
|
@@ -100,6 +101,11 @@ export const idlFactory = ({ IDL }) => {
|
|
|
100
101
|
[IDL.Variant({ 'ok' : RideView, 'err' : ProtocolError })],
|
|
101
102
|
['query'],
|
|
102
103
|
),
|
|
104
|
+
'getRideRoute' : IDL.Func(
|
|
105
|
+
[RideRef],
|
|
106
|
+
[IDL.Variant({ 'ok' : RouteLine, 'err' : ProtocolError })],
|
|
107
|
+
['query'],
|
|
108
|
+
),
|
|
103
109
|
'protocolVersion' : IDL.Func([], [IDL.Nat32], ['query']),
|
|
104
110
|
'quoteRequest' : IDL.Func(
|
|
105
111
|
[QuoteRequest],
|
|
@@ -206,8 +206,9 @@ type RequestClosed = record {
|
|
|
206
206
|
driverKey : text;
|
|
207
207
|
reason : CloseReason;
|
|
208
208
|
};
|
|
209
|
-
type Result = variant { Ok; Err : SimulatorError };
|
|
210
|
-
type Result_1 = variant { Ok
|
|
209
|
+
type Result = variant { Ok : vec RouteTaskView; Err : SimulatorError };
|
|
210
|
+
type Result_1 = variant { Ok; Err : SimulatorError };
|
|
211
|
+
type Result_2 = variant { Ok : SpawnResult; Err : SimulatorError };
|
|
211
212
|
// `variant { ok : RideView; err : ProtocolError }`.
|
|
212
213
|
type RideAnswer = variant { ok : RideView; err : ProtocolError };
|
|
213
214
|
type RideOrder = record {
|
|
@@ -243,6 +244,35 @@ type RideView = record {
|
|
|
243
244
|
// Exact, for the rider of this ride only.
|
|
244
245
|
driverPosition : opt Geo;
|
|
245
246
|
};
|
|
247
|
+
// `variant { ok : RouteLine; err : ProtocolError }` (P-19).
|
|
248
|
+
type RouteAnswer = variant { ok : RouteLine; err : ProtocolError };
|
|
249
|
+
// P-17 (2026-10-24, route line): the route of a quote in two legs, each a Google encoded
|
|
250
|
+
// polyline of precision 6 — `toPickup` from the driver's exact position to A, `ride` A → B.
|
|
251
|
+
// Bounds and checks: `crate::polyline`.
|
|
252
|
+
type RouteLine = record { ride : text; toPickup : text };
|
|
253
|
+
// S-N13: a quote request waiting for the router: route me → A → B.
|
|
254
|
+
type RouteTaskView = record {
|
|
255
|
+
// The router has until then; after `ROUTER_WAIT_NS` the quote goes without it.
|
|
256
|
+
untilNs : nat64;
|
|
257
|
+
destination : Geo;
|
|
258
|
+
requestId : text;
|
|
259
|
+
from : Geo;
|
|
260
|
+
pickup : Geo;
|
|
261
|
+
driverKey : text;
|
|
262
|
+
};
|
|
263
|
+
// S-N13: the core sets the router (an admin's `setSimulatorRouter`); none removes it.
|
|
264
|
+
type SetRouterArgs = record { router : opt principal };
|
|
265
|
+
// S-N13: the router's answer — metres, seconds and the line, like the driver front's
|
|
266
|
+
// `RouteResult`, for one virtual driver.
|
|
267
|
+
type SimRouteResult = record {
|
|
268
|
+
requestId : text;
|
|
269
|
+
rideMeters : nat32;
|
|
270
|
+
rideSec : nat32;
|
|
271
|
+
routeLine : opt RouteLine;
|
|
272
|
+
driverKey : text;
|
|
273
|
+
toPickupSec : nat32;
|
|
274
|
+
toPickupMeters : nat32;
|
|
275
|
+
};
|
|
246
276
|
type SimulatorError = variant {
|
|
247
277
|
// The coordinator or a worker refused or did not answer.
|
|
248
278
|
RemoteCanisterError : text;
|
|
@@ -257,6 +287,8 @@ type SimulatorStatus = record {
|
|
|
257
287
|
liveDrivers : nat64;
|
|
258
288
|
events : vec Event;
|
|
259
289
|
drivers : nat64;
|
|
290
|
+
// S-N13 (a new reply field: opt).
|
|
291
|
+
router : opt principal;
|
|
260
292
|
rides : nat64;
|
|
261
293
|
};
|
|
262
294
|
type SpawnArgs = record {
|
|
@@ -282,6 +314,10 @@ service : (InitArgs) -> {
|
|
|
282
314
|
cancelRide : (RideRef) -> (ProtocolAnswer);
|
|
283
315
|
getLicence : (RideRef) -> (LicenceAnswer) query;
|
|
284
316
|
getRide : (RideRef) -> (RideAnswer) query;
|
|
317
|
+
// S-N14 (P-19): the line of the ride for its rider, while the ride is active.
|
|
318
|
+
getRideRoute : (RideRef) -> (RouteAnswer) query;
|
|
319
|
+
// S-N13: the quote requests that wait for a route (at most 5 s each), the oldest first.
|
|
320
|
+
getRouteTasks : () -> (Result) query;
|
|
285
321
|
getStatus : () -> (SimulatorStatus) query;
|
|
286
322
|
http_request : (HttpRequest) -> (HttpResponse) query;
|
|
287
323
|
protocolVersion : () -> (nat32) query;
|
|
@@ -292,9 +328,15 @@ service : (InitArgs) -> {
|
|
|
292
328
|
// S-10, U-42: accepted at once, like the driver canister (the acceptance goes out by the
|
|
293
329
|
// job timer right away).
|
|
294
330
|
rideOrder : (RideOrder) -> (ProtocolAnswer);
|
|
331
|
+
// S-N13: the core only (an admin's `setSimulatorRouter`): the one principal that routes the
|
|
332
|
+
// virtual drivers' quotes, like a driver's front; none = the straight line again.
|
|
333
|
+
setRouter : (SetRouterArgs) -> (Result_1);
|
|
295
334
|
// S-15: ×10 for one request (`requestId`), not the whole canister.
|
|
296
|
-
setSpeedUp : (SpeedUpArgs) -> (
|
|
335
|
+
setSpeedUp : (SpeedUpArgs) -> (Result_1);
|
|
297
336
|
// S-2, S-3: virtual drivers around a point, each registered in the worker of its cell
|
|
298
337
|
// with `validUntilNs` (30 min) instead of a pulse.
|
|
299
|
-
spawnDrivers : (SpawnArgs) -> (
|
|
338
|
+
spawnDrivers : (SpawnArgs) -> (Result_2);
|
|
339
|
+
// S-N13: the router's route for one virtual driver — metres, seconds, the line. The quote
|
|
340
|
+
// goes with it at its moment (S-8), or at once when that moment has passed.
|
|
341
|
+
submitRoute : (SimRouteResult) -> (Result_1);
|
|
300
342
|
}
|
|
@@ -288,9 +288,11 @@ export interface RequestClosed {
|
|
|
288
288
|
'driverKey' : string,
|
|
289
289
|
'reason' : CloseReason,
|
|
290
290
|
}
|
|
291
|
-
export type Result = { 'Ok' :
|
|
291
|
+
export type Result = { 'Ok' : Array<RouteTaskView> } |
|
|
292
292
|
{ 'Err' : SimulatorError };
|
|
293
|
-
export type Result_1 = { 'Ok' :
|
|
293
|
+
export type Result_1 = { 'Ok' : null } |
|
|
294
|
+
{ 'Err' : SimulatorError };
|
|
295
|
+
export type Result_2 = { 'Ok' : SpawnResult } |
|
|
294
296
|
{ 'Err' : SimulatorError };
|
|
295
297
|
/**
|
|
296
298
|
* `variant { ok : RideView; err : ProtocolError }`.
|
|
@@ -336,6 +338,48 @@ export interface RideView {
|
|
|
336
338
|
*/
|
|
337
339
|
'driverPosition' : [] | [Geo],
|
|
338
340
|
}
|
|
341
|
+
/**
|
|
342
|
+
* `variant { ok : RouteLine; err : ProtocolError }` (P-19).
|
|
343
|
+
*/
|
|
344
|
+
export type RouteAnswer = { 'ok' : RouteLine } |
|
|
345
|
+
{ 'err' : ProtocolError };
|
|
346
|
+
/**
|
|
347
|
+
* P-17 (2026-10-24, route line): the route of a quote in two legs, each a Google encoded
|
|
348
|
+
* polyline of precision 6 — `toPickup` from the driver's exact position to A, `ride` A → B.
|
|
349
|
+
* Bounds and checks: `crate::polyline`.
|
|
350
|
+
*/
|
|
351
|
+
export interface RouteLine { 'ride' : string, 'toPickup' : string }
|
|
352
|
+
/**
|
|
353
|
+
* S-N13: a quote request waiting for the router: route me → A → B.
|
|
354
|
+
*/
|
|
355
|
+
export interface RouteTaskView {
|
|
356
|
+
/**
|
|
357
|
+
* The router has until then; after `ROUTER_WAIT_NS` the quote goes without it.
|
|
358
|
+
*/
|
|
359
|
+
'untilNs' : bigint,
|
|
360
|
+
'destination' : Geo,
|
|
361
|
+
'requestId' : string,
|
|
362
|
+
'from' : Geo,
|
|
363
|
+
'pickup' : Geo,
|
|
364
|
+
'driverKey' : string,
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* S-N13: the core sets the router (an admin's `setSimulatorRouter`); none removes it.
|
|
368
|
+
*/
|
|
369
|
+
export interface SetRouterArgs { 'router' : [] | [Principal] }
|
|
370
|
+
/**
|
|
371
|
+
* S-N13: the router's answer — metres, seconds and the line, like the driver front's
|
|
372
|
+
* `RouteResult`, for one virtual driver.
|
|
373
|
+
*/
|
|
374
|
+
export interface SimRouteResult {
|
|
375
|
+
'requestId' : string,
|
|
376
|
+
'rideMeters' : number,
|
|
377
|
+
'rideSec' : number,
|
|
378
|
+
'routeLine' : [] | [RouteLine],
|
|
379
|
+
'driverKey' : string,
|
|
380
|
+
'toPickupSec' : number,
|
|
381
|
+
'toPickupMeters' : number,
|
|
382
|
+
}
|
|
339
383
|
export type SimulatorError = {
|
|
340
384
|
/**
|
|
341
385
|
* The coordinator or a worker refused or did not answer.
|
|
@@ -352,6 +396,10 @@ export interface SimulatorStatus {
|
|
|
352
396
|
'liveDrivers' : bigint,
|
|
353
397
|
'events' : Array<Event>,
|
|
354
398
|
'drivers' : bigint,
|
|
399
|
+
/**
|
|
400
|
+
* S-N13 (a new reply field: opt).
|
|
401
|
+
*/
|
|
402
|
+
'router' : [] | [Principal],
|
|
355
403
|
'rides' : bigint,
|
|
356
404
|
}
|
|
357
405
|
export interface SpawnArgs {
|
|
@@ -387,6 +435,14 @@ export interface _SERVICE {
|
|
|
387
435
|
'cancelRide' : ActorMethod<[RideRef], ProtocolAnswer>,
|
|
388
436
|
'getLicence' : ActorMethod<[RideRef], LicenceAnswer>,
|
|
389
437
|
'getRide' : ActorMethod<[RideRef], RideAnswer>,
|
|
438
|
+
/**
|
|
439
|
+
* S-N14 (P-19): the line of the ride for its rider, while the ride is active.
|
|
440
|
+
*/
|
|
441
|
+
'getRideRoute' : ActorMethod<[RideRef], RouteAnswer>,
|
|
442
|
+
/**
|
|
443
|
+
* S-N13: the quote requests that wait for a route (at most 5 s each), the oldest first.
|
|
444
|
+
*/
|
|
445
|
+
'getRouteTasks' : ActorMethod<[], Result>,
|
|
390
446
|
'getStatus' : ActorMethod<[], SimulatorStatus>,
|
|
391
447
|
'http_request' : ActorMethod<[HttpRequest], HttpResponse>,
|
|
392
448
|
'protocolVersion' : ActorMethod<[], number>,
|
|
@@ -403,15 +459,25 @@ export interface _SERVICE {
|
|
|
403
459
|
* job timer right away).
|
|
404
460
|
*/
|
|
405
461
|
'rideOrder' : ActorMethod<[RideOrder], ProtocolAnswer>,
|
|
462
|
+
/**
|
|
463
|
+
* S-N13: the core only (an admin's `setSimulatorRouter`): the one principal that routes the
|
|
464
|
+
* virtual drivers' quotes, like a driver's front; none = the straight line again.
|
|
465
|
+
*/
|
|
466
|
+
'setRouter' : ActorMethod<[SetRouterArgs], Result_1>,
|
|
406
467
|
/**
|
|
407
468
|
* S-15: ×10 for one request (`requestId`), not the whole canister.
|
|
408
469
|
*/
|
|
409
|
-
'setSpeedUp' : ActorMethod<[SpeedUpArgs],
|
|
470
|
+
'setSpeedUp' : ActorMethod<[SpeedUpArgs], Result_1>,
|
|
410
471
|
/**
|
|
411
472
|
* S-2, S-3: virtual drivers around a point, each registered in the worker of its cell
|
|
412
473
|
* with `validUntilNs` (30 min) instead of a pulse.
|
|
413
474
|
*/
|
|
414
|
-
'spawnDrivers' : ActorMethod<[SpawnArgs],
|
|
475
|
+
'spawnDrivers' : ActorMethod<[SpawnArgs], Result_2>,
|
|
476
|
+
/**
|
|
477
|
+
* S-N13: the router's route for one virtual driver — metres, seconds, the line. The quote
|
|
478
|
+
* goes with it at its moment (S-8), or at once when that moment has passed.
|
|
479
|
+
*/
|
|
480
|
+
'submitRoute' : ActorMethod<[SimRouteResult], Result_1>,
|
|
415
481
|
}
|
|
416
482
|
export declare const idlFactory: IDL.InterfaceFactory;
|
|
417
483
|
export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
|
|
@@ -70,6 +70,26 @@ export const idlFactory = ({ IDL }) => {
|
|
|
70
70
|
'driverPosition' : IDL.Opt(Geo),
|
|
71
71
|
});
|
|
72
72
|
const RideAnswer = IDL.Variant({ 'ok' : RideView, 'err' : ProtocolError });
|
|
73
|
+
const RouteLine = IDL.Record({ 'ride' : IDL.Text, 'toPickup' : IDL.Text });
|
|
74
|
+
const RouteAnswer = IDL.Variant({ 'ok' : RouteLine, 'err' : ProtocolError });
|
|
75
|
+
const RouteTaskView = IDL.Record({
|
|
76
|
+
'untilNs' : IDL.Nat64,
|
|
77
|
+
'destination' : Geo,
|
|
78
|
+
'requestId' : IDL.Text,
|
|
79
|
+
'from' : Geo,
|
|
80
|
+
'pickup' : Geo,
|
|
81
|
+
'driverKey' : IDL.Text,
|
|
82
|
+
});
|
|
83
|
+
const SimulatorError = IDL.Variant({
|
|
84
|
+
'RemoteCanisterError' : IDL.Text,
|
|
85
|
+
'NotFound' : IDL.Null,
|
|
86
|
+
'NotAuthorized' : IDL.Text,
|
|
87
|
+
'InvalidData' : IDL.Text,
|
|
88
|
+
});
|
|
89
|
+
const Result = IDL.Variant({
|
|
90
|
+
'Ok' : IDL.Vec(RouteTaskView),
|
|
91
|
+
'Err' : SimulatorError,
|
|
92
|
+
});
|
|
73
93
|
const Event = IDL.Record({
|
|
74
94
|
'atNs' : IDL.Nat64,
|
|
75
95
|
'kind' : IDL.Text,
|
|
@@ -82,6 +102,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
82
102
|
'liveDrivers' : IDL.Nat64,
|
|
83
103
|
'events' : IDL.Vec(Event),
|
|
84
104
|
'drivers' : IDL.Nat64,
|
|
105
|
+
'router' : IDL.Opt(IDL.Principal),
|
|
85
106
|
'rides' : IDL.Nat64,
|
|
86
107
|
});
|
|
87
108
|
const HttpRequest = IDL.Record({
|
|
@@ -128,17 +149,12 @@ export const idlFactory = ({ IDL }) => {
|
|
|
128
149
|
'riderName' : IDL.Text,
|
|
129
150
|
'rider' : IDL.Principal,
|
|
130
151
|
});
|
|
152
|
+
const SetRouterArgs = IDL.Record({ 'router' : IDL.Opt(IDL.Principal) });
|
|
153
|
+
const Result_1 = IDL.Variant({ 'Ok' : IDL.Null, 'Err' : SimulatorError });
|
|
131
154
|
const SpeedUpArgs = IDL.Record({
|
|
132
155
|
'requestId' : IDL.Text,
|
|
133
156
|
'factor' : IDL.Nat8,
|
|
134
157
|
});
|
|
135
|
-
const SimulatorError = IDL.Variant({
|
|
136
|
-
'RemoteCanisterError' : IDL.Text,
|
|
137
|
-
'NotFound' : IDL.Null,
|
|
138
|
-
'NotAuthorized' : IDL.Text,
|
|
139
|
-
'InvalidData' : IDL.Text,
|
|
140
|
-
});
|
|
141
|
-
const Result = IDL.Variant({ 'Ok' : IDL.Null, 'Err' : SimulatorError });
|
|
142
158
|
const SpawnArgs = IDL.Record({ 'center' : Geo, 'count' : IDL.Opt(IDL.Nat8) });
|
|
143
159
|
const SpawnResult = IDL.Record({
|
|
144
160
|
'problems' : IDL.Vec(IDL.Text),
|
|
@@ -146,19 +162,32 @@ export const idlFactory = ({ IDL }) => {
|
|
|
146
162
|
'registered' : IDL.Nat32,
|
|
147
163
|
'validUntilNs' : IDL.Nat64,
|
|
148
164
|
});
|
|
149
|
-
const
|
|
165
|
+
const Result_2 = IDL.Variant({ 'Ok' : SpawnResult, 'Err' : SimulatorError });
|
|
166
|
+
const SimRouteResult = IDL.Record({
|
|
167
|
+
'requestId' : IDL.Text,
|
|
168
|
+
'rideMeters' : IDL.Nat32,
|
|
169
|
+
'rideSec' : IDL.Nat32,
|
|
170
|
+
'routeLine' : IDL.Opt(RouteLine),
|
|
171
|
+
'driverKey' : IDL.Text,
|
|
172
|
+
'toPickupSec' : IDL.Nat32,
|
|
173
|
+
'toPickupMeters' : IDL.Nat32,
|
|
174
|
+
});
|
|
150
175
|
return IDL.Service({
|
|
151
176
|
'cancelRide' : IDL.Func([RideRef], [ProtocolAnswer], []),
|
|
152
177
|
'getLicence' : IDL.Func([RideRef], [LicenceAnswer], ['query']),
|
|
153
178
|
'getRide' : IDL.Func([RideRef], [RideAnswer], ['query']),
|
|
179
|
+
'getRideRoute' : IDL.Func([RideRef], [RouteAnswer], ['query']),
|
|
180
|
+
'getRouteTasks' : IDL.Func([], [Result], ['query']),
|
|
154
181
|
'getStatus' : IDL.Func([], [SimulatorStatus], ['query']),
|
|
155
182
|
'http_request' : IDL.Func([HttpRequest], [HttpResponse], ['query']),
|
|
156
183
|
'protocolVersion' : IDL.Func([], [IDL.Nat32], ['query']),
|
|
157
184
|
'quoteRequest' : IDL.Func([QuoteRequest], [ProtocolAnswer], []),
|
|
158
185
|
'requestClosed' : IDL.Func([RequestClosed], [], []),
|
|
159
186
|
'rideOrder' : IDL.Func([RideOrder], [ProtocolAnswer], []),
|
|
160
|
-
'
|
|
161
|
-
'
|
|
187
|
+
'setRouter' : IDL.Func([SetRouterArgs], [Result_1], []),
|
|
188
|
+
'setSpeedUp' : IDL.Func([SpeedUpArgs], [Result_1], []),
|
|
189
|
+
'spawnDrivers' : IDL.Func([SpawnArgs], [Result_2], []),
|
|
190
|
+
'submitRoute' : IDL.Func([SimRouteResult], [Result_1], []),
|
|
162
191
|
});
|
|
163
192
|
};
|
|
164
193
|
export const init = ({ IDL }) => {
|
|
@@ -28,19 +28,22 @@ type TigiWorker =
|
|
|
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
30
|
/// ZO-13, ZO-14, ZO-17.
|
|
31
|
-
chooseOffer: (ref: OfferRef) -> (
|
|
31
|
+
chooseOffer: (ref: OfferRef) -> (Result_9);
|
|
32
32
|
clearLogs: () -> ();
|
|
33
33
|
/// ZO-15 (otherOfferChosen after an acceptance in another worker), ZO-18 (riderGaveUp).
|
|
34
34
|
closeRequest: (args: CloseRequestArgs) -> (Result_2);
|
|
35
35
|
/// The coordinator only: the settings it computes for every worker.
|
|
36
|
-
configure: (args: ConfigureArgs) -> (
|
|
36
|
+
configure: (args: ConfigureArgs) -> (Result_8);
|
|
37
37
|
/// ZO-6.
|
|
38
38
|
declineQuote: (decline: QuoteDecline) -> ();
|
|
39
39
|
/// What this worker holds of the core's network state.
|
|
40
40
|
getCoreCopyStatus: () -> (CoreCopyStatus) query;
|
|
41
41
|
/// The flow's numbers (scripts, the coordinator's front).
|
|
42
|
-
getFlowStatus: () -> (
|
|
42
|
+
getFlowStatus: () -> (Result_7) query;
|
|
43
43
|
getLogs: () -> (text) query;
|
|
44
|
+
/// ZO-21 (2026-10-24, route line): the route line of one offer, for the rider of the
|
|
45
|
+
/// request only (the package asks after a tap on the offer).
|
|
46
|
+
getOfferRoute: (ref: OfferRef) -> (Result_6) query;
|
|
44
47
|
/// The load this worker counts per geohash prefix of the given length (1–6): the
|
|
45
48
|
/// coordinator picks from it what to give another worker on a split (KO-5).
|
|
46
49
|
getPrefixCounts: (length: nat) -> (Result_5) query;
|
|
@@ -89,6 +92,11 @@ type TestLoadArgs =
|
|
|
89
92
|
cells: vec PrefixCount;
|
|
90
93
|
reportLevel: opt nat;
|
|
91
94
|
};
|
|
95
|
+
type RouteLine =
|
|
96
|
+
record {
|
|
97
|
+
ride: text;
|
|
98
|
+
toPickup: text;
|
|
99
|
+
};
|
|
92
100
|
type RiderRating =
|
|
93
101
|
record {
|
|
94
102
|
driverKey: DriverKey;
|
|
@@ -111,21 +119,26 @@ type RideStatus =
|
|
|
111
119
|
driverArrived;
|
|
112
120
|
inProgress;
|
|
113
121
|
};
|
|
114
|
-
type
|
|
122
|
+
type Result_9 =
|
|
115
123
|
variant {
|
|
116
124
|
err: Error;
|
|
117
125
|
ok: ChooseOutcome;
|
|
118
126
|
};
|
|
119
|
-
type
|
|
127
|
+
type Result_8 =
|
|
120
128
|
variant {
|
|
121
129
|
err: Error;
|
|
122
130
|
ok: WorkerConfig;
|
|
123
131
|
};
|
|
124
|
-
type
|
|
132
|
+
type Result_7 =
|
|
125
133
|
variant {
|
|
126
134
|
err: Error;
|
|
127
135
|
ok: FlowStatus;
|
|
128
136
|
};
|
|
137
|
+
type Result_6 =
|
|
138
|
+
variant {
|
|
139
|
+
err: Error;
|
|
140
|
+
ok: RouteLine;
|
|
141
|
+
};
|
|
129
142
|
type Result_5 =
|
|
130
143
|
variant {
|
|
131
144
|
err: Error;
|
|
@@ -217,11 +230,13 @@ type QuoteDecline =
|
|
|
217
230
|
type Quote =
|
|
218
231
|
record {
|
|
219
232
|
driverKey: DriverKey;
|
|
233
|
+
driverPosition: opt Geo;
|
|
220
234
|
etaToPickupSec: nat32;
|
|
221
235
|
price: Money;
|
|
222
236
|
requestId: RequestId;
|
|
223
237
|
rideMeters: nat32;
|
|
224
238
|
rideSec: nat32;
|
|
239
|
+
routeLine: opt RouteLine;
|
|
225
240
|
toPickupMeters: nat32;
|
|
226
241
|
validUntilNs: nat64;
|
|
227
242
|
};
|
|
@@ -262,6 +277,7 @@ type OfferView =
|
|
|
262
277
|
card: DriverCard;
|
|
263
278
|
driverCanister: principal;
|
|
264
279
|
driverKey: DriverKey;
|
|
280
|
+
driverPosition: opt Geo;
|
|
265
281
|
driverRating: opt nat16;
|
|
266
282
|
etaToPickupSec: nat32;
|
|
267
283
|
pinGeohash: text;
|
|
@@ -335,6 +351,7 @@ type FlowStatus =
|
|
|
335
351
|
openRequests: nat;
|
|
336
352
|
outboxPending: nat;
|
|
337
353
|
rides: nat;
|
|
354
|
+
usagePending: opt nat;
|
|
338
355
|
};
|
|
339
356
|
type ErrorDetails =
|
|
340
357
|
variant {
|
|
@@ -85,6 +85,7 @@ export type ErrorDetails = { 'InterCanisterConnectionError' : null } |
|
|
|
85
85
|
{ 'ReturnsNull' : null };
|
|
86
86
|
export interface FlowStatus {
|
|
87
87
|
'helloDone' : boolean,
|
|
88
|
+
'usagePending' : [] | [bigint],
|
|
88
89
|
'activeRides' : bigint,
|
|
89
90
|
'knownDriverCanisters' : bigint,
|
|
90
91
|
'liveDrivers' : bigint,
|
|
@@ -141,6 +142,7 @@ export interface OfferView {
|
|
|
141
142
|
'driverCanister' : Principal,
|
|
142
143
|
'price' : Money,
|
|
143
144
|
'etaToPickupSec' : number,
|
|
145
|
+
'driverPosition' : [] | [Geo],
|
|
144
146
|
'toPickupMeters' : number,
|
|
145
147
|
'validUntilNs' : bigint,
|
|
146
148
|
}
|
|
@@ -165,9 +167,11 @@ export interface Quote {
|
|
|
165
167
|
'requestId' : RequestId,
|
|
166
168
|
'rideMeters' : number,
|
|
167
169
|
'rideSec' : number,
|
|
170
|
+
'routeLine' : [] | [RouteLine],
|
|
168
171
|
'driverKey' : DriverKey,
|
|
169
172
|
'price' : Money,
|
|
170
173
|
'etaToPickupSec' : number,
|
|
174
|
+
'driverPosition' : [] | [Geo],
|
|
171
175
|
'toPickupMeters' : number,
|
|
172
176
|
'validUntilNs' : bigint,
|
|
173
177
|
}
|
|
@@ -232,11 +236,13 @@ export type Result_4 = { 'ok' : WorkerStatus } |
|
|
|
232
236
|
{ 'err' : Error };
|
|
233
237
|
export type Result_5 = { 'ok' : Array<PrefixCount> } |
|
|
234
238
|
{ 'err' : Error };
|
|
235
|
-
export type Result_6 = { 'ok' :
|
|
239
|
+
export type Result_6 = { 'ok' : RouteLine } |
|
|
236
240
|
{ 'err' : Error };
|
|
237
|
-
export type Result_7 = { 'ok' :
|
|
241
|
+
export type Result_7 = { 'ok' : FlowStatus } |
|
|
238
242
|
{ 'err' : Error };
|
|
239
|
-
export type Result_8 = { 'ok' :
|
|
243
|
+
export type Result_8 = { 'ok' : WorkerConfig } |
|
|
244
|
+
{ 'err' : Error };
|
|
245
|
+
export type Result_9 = { 'ok' : ChooseOutcome } |
|
|
240
246
|
{ 'err' : Error };
|
|
241
247
|
export type RideStatus = { 'completed' : { 'price' : Money } } |
|
|
242
248
|
{ 'cancelledByRider' : null } |
|
|
@@ -255,6 +261,7 @@ export interface RiderRating {
|
|
|
255
261
|
'stars' : number,
|
|
256
262
|
'driverKey' : DriverKey,
|
|
257
263
|
}
|
|
264
|
+
export interface RouteLine { 'ride' : string, 'toPickup' : string }
|
|
258
265
|
export interface TestLoadArgs {
|
|
259
266
|
'reportLevel' : [] | [bigint],
|
|
260
267
|
'cells' : Array<PrefixCount>,
|
|
@@ -273,7 +280,7 @@ export interface TigiWorker {
|
|
|
273
280
|
/**
|
|
274
281
|
* / ZO-13, ZO-14, ZO-17.
|
|
275
282
|
*/
|
|
276
|
-
'chooseOffer' : ActorMethod<[OfferRef],
|
|
283
|
+
'chooseOffer' : ActorMethod<[OfferRef], Result_9>,
|
|
277
284
|
'clearLogs' : ActorMethod<[], undefined>,
|
|
278
285
|
/**
|
|
279
286
|
* / ZO-15 (otherOfferChosen after an acceptance in another worker), ZO-18 (riderGaveUp).
|
|
@@ -282,7 +289,7 @@ export interface TigiWorker {
|
|
|
282
289
|
/**
|
|
283
290
|
* / The coordinator only: the settings it computes for every worker.
|
|
284
291
|
*/
|
|
285
|
-
'configure' : ActorMethod<[ConfigureArgs],
|
|
292
|
+
'configure' : ActorMethod<[ConfigureArgs], Result_8>,
|
|
286
293
|
/**
|
|
287
294
|
* / ZO-6.
|
|
288
295
|
*/
|
|
@@ -294,8 +301,13 @@ export interface TigiWorker {
|
|
|
294
301
|
/**
|
|
295
302
|
* / The flow's numbers (scripts, the coordinator's front).
|
|
296
303
|
*/
|
|
297
|
-
'getFlowStatus' : ActorMethod<[],
|
|
304
|
+
'getFlowStatus' : ActorMethod<[], Result_7>,
|
|
298
305
|
'getLogs' : ActorMethod<[], string>,
|
|
306
|
+
/**
|
|
307
|
+
* / ZO-21 (2026-10-24, route line): the route line of one offer, for the rider of the
|
|
308
|
+
* / request only (the package asks after a tap on the offer).
|
|
309
|
+
*/
|
|
310
|
+
'getOfferRoute' : ActorMethod<[OfferRef], Result_6>,
|
|
299
311
|
/**
|
|
300
312
|
* / The load this worker counts per geohash prefix of the given length (1–6): the
|
|
301
313
|
* / coordinator picks from it what to give another worker on a split (KO-5).
|
|
@@ -92,7 +92,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
92
92
|
'ordered' : IDL.Record({ 'answerByNs' : IDL.Nat64 }),
|
|
93
93
|
'driverNotFree' : IDL.Null,
|
|
94
94
|
});
|
|
95
|
-
const
|
|
95
|
+
const Result_9 = IDL.Variant({ 'ok' : ChooseOutcome, 'err' : Error });
|
|
96
96
|
const CloseReason = IDL.Variant({
|
|
97
97
|
'offerRejected' : IDL.Null,
|
|
98
98
|
'otherOfferChosen' : IDL.Null,
|
|
@@ -124,7 +124,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
124
124
|
'load' : LoadThresholds,
|
|
125
125
|
'lowCyclesBelow' : IDL.Nat,
|
|
126
126
|
});
|
|
127
|
-
const
|
|
127
|
+
const Result_8 = IDL.Variant({ 'ok' : WorkerConfig, 'err' : Error });
|
|
128
128
|
const QuoteDecline = IDL.Record({
|
|
129
129
|
'requestId' : RequestId,
|
|
130
130
|
'driverKey' : DriverKey,
|
|
@@ -140,6 +140,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
140
140
|
});
|
|
141
141
|
const FlowStatus = IDL.Record({
|
|
142
142
|
'helloDone' : IDL.Bool,
|
|
143
|
+
'usagePending' : IDL.Opt(IDL.Nat),
|
|
143
144
|
'activeRides' : IDL.Nat,
|
|
144
145
|
'knownDriverCanisters' : IDL.Nat,
|
|
145
146
|
'liveDrivers' : IDL.Nat,
|
|
@@ -149,7 +150,9 @@ export const idlFactory = ({ IDL }) => {
|
|
|
149
150
|
'rides' : IDL.Nat,
|
|
150
151
|
'openRequests' : IDL.Nat,
|
|
151
152
|
});
|
|
152
|
-
const
|
|
153
|
+
const Result_7 = IDL.Variant({ 'ok' : FlowStatus, 'err' : Error });
|
|
154
|
+
const RouteLine = IDL.Record({ 'ride' : IDL.Text, 'toPickup' : IDL.Text });
|
|
155
|
+
const Result_6 = IDL.Variant({ 'ok' : RouteLine, 'err' : Error });
|
|
153
156
|
const PrefixCount = IDL.Record({ 'load' : IDL.Nat, 'prefix' : IDL.Text });
|
|
154
157
|
const Result_5 = IDL.Variant({ 'ok' : IDL.Vec(PrefixCount), 'err' : Error });
|
|
155
158
|
const RequestRef = IDL.Record({ 'requestId' : RequestId });
|
|
@@ -168,6 +171,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
168
171
|
'hasLicencePhoto' : IDL.Bool,
|
|
169
172
|
});
|
|
170
173
|
const Money = IDL.Record({ 'currency' : IDL.Text, 'amount' : IDL.Nat64 });
|
|
174
|
+
const Geo = IDL.Record({ 'lat' : IDL.Float64, 'lng' : IDL.Float64 });
|
|
171
175
|
const OfferView = IDL.Record({
|
|
172
176
|
'rideMeters' : IDL.Nat32,
|
|
173
177
|
'driverRating' : IDL.Opt(IDL.Nat16),
|
|
@@ -180,6 +184,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
180
184
|
'driverCanister' : IDL.Principal,
|
|
181
185
|
'price' : Money,
|
|
182
186
|
'etaToPickupSec' : IDL.Nat32,
|
|
187
|
+
'driverPosition' : IDL.Opt(Geo),
|
|
183
188
|
'toPickupMeters' : IDL.Nat32,
|
|
184
189
|
'validUntilNs' : IDL.Nat64,
|
|
185
190
|
});
|
|
@@ -241,7 +246,6 @@ export const idlFactory = ({ IDL }) => {
|
|
|
241
246
|
});
|
|
242
247
|
const Result_4 = IDL.Variant({ 'ok' : WorkerStatus, 'err' : Error });
|
|
243
248
|
const Result_3 = IDL.Variant({ 'ok' : IDL.Nat, 'err' : Error });
|
|
244
|
-
const Geo = IDL.Record({ 'lat' : IDL.Float64, 'lng' : IDL.Float64 });
|
|
245
249
|
const HasSimulatedDriversArgs = IDL.Record({ 'center' : Geo });
|
|
246
250
|
const TestLoadArgs = IDL.Record({
|
|
247
251
|
'reportLevel' : IDL.Opt(IDL.Nat),
|
|
@@ -290,23 +294,26 @@ export const idlFactory = ({ IDL }) => {
|
|
|
290
294
|
'requestId' : RequestId,
|
|
291
295
|
'rideMeters' : IDL.Nat32,
|
|
292
296
|
'rideSec' : IDL.Nat32,
|
|
297
|
+
'routeLine' : IDL.Opt(RouteLine),
|
|
293
298
|
'driverKey' : DriverKey,
|
|
294
299
|
'price' : Money,
|
|
295
300
|
'etaToPickupSec' : IDL.Nat32,
|
|
301
|
+
'driverPosition' : IDL.Opt(Geo),
|
|
296
302
|
'toPickupMeters' : IDL.Nat32,
|
|
297
303
|
'validUntilNs' : IDL.Nat64,
|
|
298
304
|
});
|
|
299
305
|
const TigiWorker = IDL.Service({
|
|
300
306
|
'answerOrder' : IDL.Func([OrderAnswer], [ProtocolResult], []),
|
|
301
307
|
'applyCoreChanges' : IDL.Func([CoreChanges], [Result], []),
|
|
302
|
-
'chooseOffer' : IDL.Func([OfferRef], [
|
|
308
|
+
'chooseOffer' : IDL.Func([OfferRef], [Result_9], []),
|
|
303
309
|
'clearLogs' : IDL.Func([], [], []),
|
|
304
310
|
'closeRequest' : IDL.Func([CloseRequestArgs], [Result_2], []),
|
|
305
|
-
'configure' : IDL.Func([ConfigureArgs], [
|
|
311
|
+
'configure' : IDL.Func([ConfigureArgs], [Result_8], []),
|
|
306
312
|
'declineQuote' : IDL.Func([QuoteDecline], [], []),
|
|
307
313
|
'getCoreCopyStatus' : IDL.Func([], [CoreCopyStatus], ['query']),
|
|
308
|
-
'getFlowStatus' : IDL.Func([], [
|
|
314
|
+
'getFlowStatus' : IDL.Func([], [Result_7], ['query']),
|
|
309
315
|
'getLogs' : IDL.Func([], [IDL.Text], ['query']),
|
|
316
|
+
'getOfferRoute' : IDL.Func([OfferRef], [Result_6], ['query']),
|
|
310
317
|
'getPrefixCounts' : IDL.Func([IDL.Nat], [Result_5], ['query']),
|
|
311
318
|
'getRequest' : IDL.Func([RequestRef], [Result_1], ['query']),
|
|
312
319
|
'getStatus' : IDL.Func([], [Result_4], ['query']),
|