@jsm-mit/tigi-sharded-package 0.22.0 → 0.23.1
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 +1 -0
- package/declarations/tigi-driver/tigi-driver.did +13 -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 +7 -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 +1 -0
- package/declarations/worker/worker.did.d.ts +1 -0
- package/declarations/worker/worker.did.js +1 -0
- package/dist/actors/rides-actor.d.ts +13 -1
- package/dist/actors/rides-actor.d.ts.map +1 -1
- package/dist/actors/rides-actor.js +45 -12
- package/dist/interfaces.d.ts +8 -0
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/mappers.d.ts +16 -2
- package/dist/mappers.d.ts.map +1 -1
- package/dist/mappers.js +25 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -68,6 +68,7 @@ if (past?.ratable) await profiles.ratePastRideAsyncUnsafe(past.rideRef, 5);
|
|
|
68
68
|
// the 24 h are over, not in the core yet) | "notAuthorized" (another rider's ride)
|
|
69
69
|
const mine = await profiles.getMyRatingAsyncUnsafe(); // PF-4: { average: 4.87, count, sum } | undefined ("Brak ocen")
|
|
70
70
|
await rides.getPastRideAsyncUnsafe(page.rides[0].rideRef); // its details from the driver canister
|
|
71
|
+
await rides.getPastRideMapAsyncUnsafe(page.rides[0].rideRef); // P-30: its map (planned + driven A → B), undefined once removed
|
|
71
72
|
```
|
|
72
73
|
|
|
73
74
|
What the package does for the network (zgloszenie-i-oferty.md):
|
|
@@ -135,6 +135,8 @@ type RegisterDriver = record {
|
|
|
135
135
|
validUntilNs : opt nat64; // simulator only: no pulse needed until then (U-25)
|
|
136
136
|
freeAtNs : opt nat64; // P-23: on a ride that ends by then (≤ 5 min + 2 min of margin)
|
|
137
137
|
// — asked for rides "as soon as possible" as a queued next ride
|
|
138
|
+
standbyUntilNs : opt nat64; // P-29: on standby at its stand — present until then without a
|
|
139
|
+
// pulse (≤ 1 h ahead); the driver canister renews it
|
|
138
140
|
};
|
|
139
141
|
|
|
140
142
|
// The route the driver's front got from its provider, in the same query that priced the
|
|
@@ -147,6 +149,14 @@ type RouteLine = record {
|
|
|
147
149
|
ride : text;
|
|
148
150
|
};
|
|
149
151
|
|
|
152
|
+
// P-30 (KU-7, user 2026-11-19): the map of a past ride for its rider — the line A → B offered
|
|
153
|
+
// with the quote (`planned`) and the line the driver drove A → B (`driven`), each a polyline6
|
|
154
|
+
// as in `RouteLine` ("" when not kept). Only while the driver canister keeps the ride's map.
|
|
155
|
+
type RideMap = record {
|
|
156
|
+
planned : text;
|
|
157
|
+
driven : text;
|
|
158
|
+
};
|
|
159
|
+
|
|
150
160
|
type Quote = record {
|
|
151
161
|
requestId : RequestId;
|
|
152
162
|
driverKey : DriverKey;
|
|
@@ -282,6 +292,9 @@ service : {
|
|
|
282
292
|
// P-19: the line of the accepted quote while the ride is active (`notFound` without a
|
|
283
293
|
// line or after the end); an old canister has no such method — the rider draws none.
|
|
284
294
|
getRideRoute : (RideRef) -> (variant { ok : RouteLine; err : ProtocolError }) query;
|
|
295
|
+
// P-30: the map of the ride (also after its end) while the driver canister keeps it
|
|
296
|
+
// (`notFound` when removed or never kept); an old canister has no such method — no map.
|
|
297
|
+
getRideMap : (RideRef) -> (variant { ok : RideMap; err : ProtocolError }) query;
|
|
285
298
|
cancelRide : (RideRef) -> (variant { ok; err : ProtocolError });
|
|
286
299
|
// P-20: pay by card during the ride (`inProgress`); the same page while it stands. A
|
|
287
300
|
// driver without cards answers `invalidData`; an old canister has no such methods.
|
|
@@ -165,6 +165,10 @@ export interface RegisterBase {
|
|
|
165
165
|
}
|
|
166
166
|
export interface RegisterDriver {
|
|
167
167
|
'freeAtNs' : [] | [bigint],
|
|
168
|
+
/**
|
|
169
|
+
* — asked for rides "as soon as possible" as a queued next ride
|
|
170
|
+
*/
|
|
171
|
+
'standbyUntilNs' : [] | [bigint],
|
|
168
172
|
'card' : DriverCard,
|
|
169
173
|
'cardVersion' : number,
|
|
170
174
|
'geohash' : Geohash,
|
|
@@ -181,6 +185,12 @@ export interface RequestClosed {
|
|
|
181
185
|
'reason' : CloseReason,
|
|
182
186
|
}
|
|
183
187
|
export type RequestId = string;
|
|
188
|
+
/**
|
|
189
|
+
* P-30 (KU-7, user 2026-11-19): the map of a past ride for its rider — the line A → B offered
|
|
190
|
+
* with the quote (`planned`) and the line the driver drove A → B (`driven`), each a polyline6
|
|
191
|
+
* as in `RouteLine` ("" when not kept). Only while the driver canister keeps the ride's map.
|
|
192
|
+
*/
|
|
193
|
+
export interface RideMap { 'planned' : string, 'driven' : string }
|
|
184
194
|
export interface RideOrder {
|
|
185
195
|
'destination' : Geo,
|
|
186
196
|
'requestId' : RequestId,
|
|
@@ -259,6 +269,15 @@ export interface _SERVICE {
|
|
|
259
269
|
{ 'ok' : RideView } |
|
|
260
270
|
{ 'err' : ProtocolError }
|
|
261
271
|
>,
|
|
272
|
+
/**
|
|
273
|
+
* P-30: the map of the ride (also after its end) while the driver canister keeps it
|
|
274
|
+
* (`notFound` when removed or never kept); an old canister has no such method — no map.
|
|
275
|
+
*/
|
|
276
|
+
'getRideMap' : ActorMethod<
|
|
277
|
+
[RideRef],
|
|
278
|
+
{ 'ok' : RideMap } |
|
|
279
|
+
{ 'err' : ProtocolError }
|
|
280
|
+
>,
|
|
262
281
|
/**
|
|
263
282
|
* P-19: the line of the accepted quote while the ride is active (`notFound` without a
|
|
264
283
|
* line or after the end); an old canister has no such method — the rider draws none.
|
|
@@ -94,6 +94,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
94
94
|
'cardAccepted' : IDL.Opt(IDL.Bool),
|
|
95
95
|
'driverPosition' : IDL.Opt(Geo),
|
|
96
96
|
});
|
|
97
|
+
const RideMap = IDL.Record({ 'planned' : IDL.Text, 'driven' : IDL.Text });
|
|
97
98
|
const RouteLine = IDL.Record({ 'ride' : IDL.Text, 'toPickup' : IDL.Text });
|
|
98
99
|
const QuoteRequest = IDL.Record({
|
|
99
100
|
'destination' : Geo,
|
|
@@ -154,6 +155,11 @@ export const idlFactory = ({ IDL }) => {
|
|
|
154
155
|
[IDL.Variant({ 'ok' : RideView, 'err' : ProtocolError })],
|
|
155
156
|
['query'],
|
|
156
157
|
),
|
|
158
|
+
'getRideMap' : IDL.Func(
|
|
159
|
+
[RideRef],
|
|
160
|
+
[IDL.Variant({ 'ok' : RideMap, 'err' : ProtocolError })],
|
|
161
|
+
['query'],
|
|
162
|
+
),
|
|
157
163
|
'getRideRoute' : IDL.Func(
|
|
158
164
|
[RideRef],
|
|
159
165
|
[IDL.Variant({ 'ok' : RouteLine, 'err' : ProtocolError })],
|
|
@@ -272,6 +272,11 @@ type Result_2 = variant { Ok; Err : SimulatorError };
|
|
|
272
272
|
type Result_3 = variant { Ok : SpawnResult; Err : SimulatorError };
|
|
273
273
|
// `variant { ok : RideView; err : ProtocolError }`.
|
|
274
274
|
type RideAnswer = variant { ok : RideView; err : ProtocolError };
|
|
275
|
+
// P-30: the map of a past ride for its rider — the offered line A → B and the driven one, each a
|
|
276
|
+
// polyline6 ("" when not kept).
|
|
277
|
+
type RideMap = record { planned : text; driven : text };
|
|
278
|
+
// `variant { ok : RideMap; err : ProtocolError }` (P-30).
|
|
279
|
+
type RideMapAnswer = variant { ok : RideMap; err : ProtocolError };
|
|
275
280
|
type RideOrder = record {
|
|
276
281
|
destination : Geo;
|
|
277
282
|
requestId : text;
|
|
@@ -390,6 +395,8 @@ service : (InitArgs) -> {
|
|
|
390
395
|
getLastSpawn : () -> (Result) query;
|
|
391
396
|
getLicence : (RideRef) -> (LicenceAnswer) query;
|
|
392
397
|
getRide : (RideRef) -> (RideAnswer) query;
|
|
398
|
+
// P-30: a virtual ride keeps no map — `notFound` for its rider.
|
|
399
|
+
getRideMap : (RideRef) -> (RideMapAnswer) query;
|
|
393
400
|
// S-N14 (P-19): the line of the ride for its rider, while the ride is active.
|
|
394
401
|
getRideRoute : (RideRef) -> (RouteAnswer) query;
|
|
395
402
|
// S-N13: the quote requests that wait for a route (at most 10 s each), the oldest first.
|
|
@@ -390,6 +390,16 @@ export type Result_3 = { 'Ok' : SpawnResult } |
|
|
|
390
390
|
*/
|
|
391
391
|
export type RideAnswer = { 'ok' : RideView } |
|
|
392
392
|
{ 'err' : ProtocolError };
|
|
393
|
+
/**
|
|
394
|
+
* P-30: the map of a past ride for its rider — the offered line A → B and the driven one, each a
|
|
395
|
+
* polyline6 ("" when not kept).
|
|
396
|
+
*/
|
|
397
|
+
export interface RideMap { 'planned' : string, 'driven' : string }
|
|
398
|
+
/**
|
|
399
|
+
* `variant { ok : RideMap; err : ProtocolError }` (P-30).
|
|
400
|
+
*/
|
|
401
|
+
export type RideMapAnswer = { 'ok' : RideMap } |
|
|
402
|
+
{ 'err' : ProtocolError };
|
|
393
403
|
export interface RideOrder {
|
|
394
404
|
'destination' : Geo,
|
|
395
405
|
'requestId' : string,
|
|
@@ -551,6 +561,10 @@ export interface _SERVICE {
|
|
|
551
561
|
'getLastSpawn' : ActorMethod<[], Result>,
|
|
552
562
|
'getLicence' : ActorMethod<[RideRef], LicenceAnswer>,
|
|
553
563
|
'getRide' : ActorMethod<[RideRef], RideAnswer>,
|
|
564
|
+
/**
|
|
565
|
+
* P-30: a virtual ride keeps no map — `notFound` for its rider.
|
|
566
|
+
*/
|
|
567
|
+
'getRideMap' : ActorMethod<[RideRef], RideMapAnswer>,
|
|
554
568
|
/**
|
|
555
569
|
* S-N14 (P-19): the line of the ride for its rider, while the ride is active.
|
|
556
570
|
*/
|
|
@@ -126,6 +126,8 @@ export const idlFactory = ({ IDL }) => {
|
|
|
126
126
|
'driverPosition' : IDL.Opt(Geo),
|
|
127
127
|
});
|
|
128
128
|
const RideAnswer = IDL.Variant({ 'ok' : RideView, 'err' : ProtocolError });
|
|
129
|
+
const RideMap = IDL.Record({ 'planned' : IDL.Text, 'driven' : IDL.Text });
|
|
130
|
+
const RideMapAnswer = IDL.Variant({ 'ok' : RideMap, 'err' : ProtocolError });
|
|
129
131
|
const RouteLine = IDL.Record({ 'ride' : IDL.Text, 'toPickup' : IDL.Text });
|
|
130
132
|
const RouteAnswer = IDL.Variant({ 'ok' : RouteLine, 'err' : ProtocolError });
|
|
131
133
|
const RouteTaskView = IDL.Record({
|
|
@@ -235,6 +237,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
235
237
|
'getLastSpawn' : IDL.Func([], [Result], ['query']),
|
|
236
238
|
'getLicence' : IDL.Func([RideRef], [LicenceAnswer], ['query']),
|
|
237
239
|
'getRide' : IDL.Func([RideRef], [RideAnswer], ['query']),
|
|
240
|
+
'getRideMap' : IDL.Func([RideRef], [RideMapAnswer], ['query']),
|
|
238
241
|
'getRideRoute' : IDL.Func([RideRef], [RouteAnswer], ['query']),
|
|
239
242
|
'getRouteTasks' : IDL.Func([], [Result_1], ['query']),
|
|
240
243
|
'getStatus' : IDL.Func([], [SimulatorStatus], ['query']),
|
|
@@ -2,7 +2,7 @@ import type { Identity } from "@icp-sdk/core/agent";
|
|
|
2
2
|
import { type GroupOptions } from "../group/canister-actor.js";
|
|
3
3
|
import { TigiGroup } from "../group/group.js";
|
|
4
4
|
import { type Geo } from "../geo.js";
|
|
5
|
-
import type { CardPaymentView, ChatPlace, ChooseOutcome, LicenceView, RequestSnapshot, RideView, RouteLineView } from "../interfaces.js";
|
|
5
|
+
import type { CardPaymentView, ChatPlace, ChooseOutcome, LicenceView, RequestSnapshot, RideMapView, RideView, RouteLineView } from "../interfaces.js";
|
|
6
6
|
import { ScheduledRide } from "./scheduled-ride.js";
|
|
7
7
|
/** U-29: the rider's radius, and the radius after `WIDEN_AFTER_MS` without offers. */
|
|
8
8
|
export declare const SEARCH_RADIUS_METERS = 3000;
|
|
@@ -127,6 +127,15 @@ export declare class RidesActor {
|
|
|
127
127
|
* @throws Error with message `CriticalCanisterError` — the driver canister does not answer ("brak połączenia z kierowcą")
|
|
128
128
|
*/
|
|
129
129
|
getPastRideAsyncUnsafe(rideRef: string): Promise<RideView>;
|
|
130
|
+
/**
|
|
131
|
+
* KU-7 (P-30): the map of a past ride — the planned line A → B and the driven one — while
|
|
132
|
+
* its driver canister keeps it (D-19).
|
|
133
|
+
* @returns undefined when the map was removed or never kept, or the driver canister is
|
|
134
|
+
* older than the map (no `getRideMap`)
|
|
135
|
+
* @throws Error with message `CanisterError` — `notAuthorized` (not the rider of the ride), `InvalidToken`
|
|
136
|
+
* @throws Error with message `CriticalCanisterError` — the driver canister does not answer
|
|
137
|
+
*/
|
|
138
|
+
getPastRideMapAsyncUnsafe(rideRef: string): Promise<RideMapView | undefined>;
|
|
130
139
|
private riderNameAsyncUnsafe;
|
|
131
140
|
/** The group's simulator (F-18), kept for a minute: its offers are `simulated` (TM-7). */
|
|
132
141
|
private simulatorIdAsync;
|
|
@@ -156,6 +165,8 @@ export declare class RideRequest {
|
|
|
156
165
|
private readonly notFree;
|
|
157
166
|
private readonly refreshingUntilMs;
|
|
158
167
|
private orderedOfferId;
|
|
168
|
+
/** ZO-N29: the end of the ordered offer's answer window, shown while a stale read is checked. */
|
|
169
|
+
private orderedAnswerByMs;
|
|
159
170
|
/** @internal — made by `RidesActor`. */
|
|
160
171
|
constructor(group: TigiGroup, identity: Identity, options: GroupOptions, state: RequestState, simulatorIdAsync: () => Promise<string | undefined>);
|
|
161
172
|
get requestId(): string;
|
|
@@ -299,6 +310,7 @@ export declare class RideRequest {
|
|
|
299
310
|
rateDriverAsyncUnsafe(stars: number): Promise<boolean>;
|
|
300
311
|
/** U-42: the driver of this offer is busy — the entry is gone, and its place in the worker goes to the next driver (ZO-12, best-effort). */
|
|
301
312
|
private markNotFree;
|
|
313
|
+
/** @returns the answers, and `fresh` when every one of them came through consensus now (ZO-N29). */
|
|
302
314
|
private readAllAsyncUnsafe;
|
|
303
315
|
private mergeAsync;
|
|
304
316
|
/** ZO-15: the other workers close their copy (`otherOfferChosen`); tried again on the next poll if one fails. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rides-actor.d.ts","sourceRoot":"","sources":["../../src/actors/rides-actor.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAKpD,OAAO,EAAgJ,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC7M,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAA2B,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAa,eAAe,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"rides-actor.d.ts","sourceRoot":"","sources":["../../src/actors/rides-actor.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAKpD,OAAO,EAAgJ,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC7M,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAA2B,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAa,eAAe,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjK,OAAO,EAAE,aAAa,EAAkH,MAAM,qBAAqB,CAAC;AAGpK,sFAAsF;AACtF,eAAO,MAAM,oBAAoB,OAAQ,CAAC;AAC1C,eAAO,MAAM,kBAAkB,OAAQ,CAAC;AACxC;;;GAGG;AACH,eAAO,MAAM,yBAAyB,OAAQ,CAAC;AAC/C,eAAO,MAAM,uBAAuB,Q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7 @@ import { geohashesByWorker } from "../group/prefixes.js";
|
|
|
12
12
|
import { cellsWithin, isValidGeo } from "../geo.js";
|
|
13
13
|
import { driverChatPlaceAsyncUnsafe } from "../chat.js";
|
|
14
14
|
import { ScheduledRide, SCHEDULED_MAX_AHEAD_MS, SCHEDULED_MIN_AHEAD_MS, SCHEDULED_RADIUS_METERS, scheduledStateOf } from "./scheduled-ride.js";
|
|
15
|
-
import { cardOf, closeReasonOf, decodeToken, driverOfOfferId, encodeToken, fresherRide, freshViews, mergedPhase, mergeOffers, moneyOf, msOf, offerIdOf, offerOf, phaseOf, placeOffers, rideOfRideRef, rideStatusOf, routeLineOf } from "../mappers.js";
|
|
15
|
+
import { cardOf, closeReasonOf, decodeToken, driverOfOfferId, encodeToken, fresherRide, freshViews, mergedPhase, mergeOffers, moneyOf, msOf, offerIdOf, offerOf, orderedOfferVerdict, phaseOf, placeOffers, rideOfRideRef, rideMapOf, rideStatusOf, routeLineOf } from "../mappers.js";
|
|
16
16
|
/** U-29: the rider's radius, and the radius after `WIDEN_AFTER_MS` without offers. */
|
|
17
17
|
export const SEARCH_RADIUS_METERS = 3_000;
|
|
18
18
|
export const WIDE_RADIUS_METERS = 6_000;
|
|
@@ -174,6 +174,27 @@ export class RidesActor {
|
|
|
174
174
|
const ref = rideOfRideRef(rideRef);
|
|
175
175
|
return getRideOfAsyncUnsafe(this.identity, this.options, { canister: ref.canister, driverKey: ref.driverKey }, ref.requestId);
|
|
176
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* KU-7 (P-30): the map of a past ride — the planned line A → B and the driven one — while
|
|
179
|
+
* its driver canister keeps it (D-19).
|
|
180
|
+
* @returns undefined when the map was removed or never kept, or the driver canister is
|
|
181
|
+
* older than the map (no `getRideMap`)
|
|
182
|
+
* @throws Error with message `CanisterError` — `notAuthorized` (not the rider of the ride), `InvalidToken`
|
|
183
|
+
* @throws Error with message `CriticalCanisterError` — the driver canister does not answer
|
|
184
|
+
*/
|
|
185
|
+
async getPastRideMapAsyncUnsafe(rideRef) {
|
|
186
|
+
const ref = rideOfRideRef(rideRef);
|
|
187
|
+
const actor = await rawActorAsync(driverIdl, ref.canister, this.identity, this.options);
|
|
188
|
+
try {
|
|
189
|
+
const map = await executeProtocolAsyncUnsafe(() => actor.getRideMap({ requestId: ref.requestId, driverKey: ref.driverKey }));
|
|
190
|
+
return rideMapOf(map);
|
|
191
|
+
}
|
|
192
|
+
catch (err) {
|
|
193
|
+
if (errorKeyOf(err) === "notFound" || isMethodMissingError(err))
|
|
194
|
+
return undefined;
|
|
195
|
+
throw err;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
177
198
|
async riderNameAsyncUnsafe() {
|
|
178
199
|
try {
|
|
179
200
|
const profile = await executeAsyncUnsafe(async () => (await this.group.coreAsync()).getMyProfile());
|
|
@@ -225,6 +246,8 @@ export class RideRequest {
|
|
|
225
246
|
notFree = new Set();
|
|
226
247
|
refreshingUntilMs = new Map();
|
|
227
248
|
orderedOfferId;
|
|
249
|
+
/** ZO-N29: the end of the ordered offer's answer window, shown while a stale read is checked. */
|
|
250
|
+
orderedAnswerByMs = 0;
|
|
228
251
|
/** @internal — made by `RidesActor`. */
|
|
229
252
|
constructor(group, identity, options, state, simulatorIdAsync) {
|
|
230
253
|
this.group = group;
|
|
@@ -307,8 +330,11 @@ export class RideRequest {
|
|
|
307
330
|
*/
|
|
308
331
|
async getAsyncUnsafe() {
|
|
309
332
|
const workers = this.state.accepted ? [this.state.accepted.worker] : this.state.workers;
|
|
310
|
-
|
|
311
|
-
const
|
|
333
|
+
// ZO-25: the first read after the rider's own action goes through consensus.
|
|
334
|
+
const fresh = this.freshNext;
|
|
335
|
+
this.freshNext = false;
|
|
336
|
+
const read = await this.readAllAsyncUnsafe(workers, fresh);
|
|
337
|
+
const snapshot = await this.mergeAsync(read.answers, read.fresh);
|
|
312
338
|
if (this.state.accepted && !this.state.othersClosed)
|
|
313
339
|
await this.closeOthersAsync();
|
|
314
340
|
if (snapshot.phase === "searching" && !this.state.widened && !this.state.sawOffer && Date.now() - this.state.createdMs >= WIDEN_AFTER_MS) {
|
|
@@ -385,7 +411,8 @@ export class RideRequest {
|
|
|
385
411
|
this.freshNext = true;
|
|
386
412
|
if ("ordered" in outcome) {
|
|
387
413
|
this.orderedOfferId = offerId;
|
|
388
|
-
|
|
414
|
+
this.orderedAnswerByMs = msOf(outcome.ordered.answerByNs);
|
|
415
|
+
return { kind: "ordered", answerByMs: this.orderedAnswerByMs };
|
|
389
416
|
}
|
|
390
417
|
const kind = Object.keys(outcome)[0];
|
|
391
418
|
if (kind === "driverNotFree")
|
|
@@ -585,10 +612,8 @@ export class RideRequest {
|
|
|
585
612
|
this.slots = this.slots.map((slot) => (slot.offerId === offerId ? { ...slot, gone: "driverNotFree" } : slot));
|
|
586
613
|
void this.onOfferAsyncUnsafe(offerId, (actor, ref) => actor.rejectOffer(ref)).catch(() => undefined);
|
|
587
614
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
const fresh = this.freshNext;
|
|
591
|
-
this.freshNext = false;
|
|
615
|
+
/** @returns the answers, and `fresh` when every one of them came through consensus now (ZO-N29). */
|
|
616
|
+
async readAllAsyncUnsafe(workers, fresh) {
|
|
592
617
|
const read = (worker) => (fresh ? this.group.onWorkerFreshAsyncUnsafe(worker, (actor) => actor.getRequest({ requestId: this.state.requestId })) : this.group.onWorkerAsyncUnsafe(worker, (actor) => actor.getRequest({ requestId: this.state.requestId })));
|
|
593
618
|
const results = await Promise.allSettled(workers.map(async (worker) => ({ worker, view: await read(worker) })));
|
|
594
619
|
const answers = [];
|
|
@@ -611,9 +636,9 @@ export class RideRequest {
|
|
|
611
636
|
if (answers.length === 0 && notFound > 0)
|
|
612
637
|
throw canisterError("NotFound", "no worker holds this request");
|
|
613
638
|
// ZO-24: an older state than the held one, or a silent worker, keeps the held answer.
|
|
614
|
-
return freshViews(this.heldViews, answers, failed, Date.now());
|
|
639
|
+
return { answers: freshViews(this.heldViews, answers, failed, Date.now()), fresh: fresh && failed.length === 0 };
|
|
615
640
|
}
|
|
616
|
-
async mergeAsync(answers) {
|
|
641
|
+
async mergeAsync(answers, fresh) {
|
|
617
642
|
const simulator = await this.simulatorIdAsync();
|
|
618
643
|
const host = this.options.host ?? MAINNET_HOST;
|
|
619
644
|
const phases = answers.map((answer) => phaseOf(answer.view));
|
|
@@ -659,11 +684,19 @@ export class RideRequest {
|
|
|
659
684
|
if (phase !== "closed")
|
|
660
685
|
snapshot.closedReason = undefined;
|
|
661
686
|
// U-42: the ordered offer came back to the list's phase without a ride — its driver
|
|
662
|
-
// was busy (another rider was first) or did not answer.
|
|
663
|
-
|
|
687
|
+
// was busy (another rider was first) or did not answer. ZO-N29: only a read through
|
|
688
|
+
// consensus says so; a plain query may show the state before the order.
|
|
689
|
+
const verdict = orderedOfferVerdict(phase, this.orderedOfferId !== undefined, fresh);
|
|
690
|
+
if (verdict === "refused" && this.orderedOfferId !== undefined) {
|
|
664
691
|
this.notFree.add(this.orderedOfferId);
|
|
665
692
|
this.orderedOfferId = undefined;
|
|
666
693
|
}
|
|
694
|
+
else if (verdict === "unsure" && this.orderedOfferId !== undefined) {
|
|
695
|
+
this.freshNext = true;
|
|
696
|
+
snapshot.phase = "waitingForDriver";
|
|
697
|
+
snapshot.waitingFor = { offerId: this.orderedOfferId, answerByMs: this.orderedAnswerByMs };
|
|
698
|
+
snapshot.lastOrderRefused = false;
|
|
699
|
+
}
|
|
667
700
|
if (phase === "searching" || phase === "waitingForDriver" || phase === "closed") {
|
|
668
701
|
const live = phase === "closed" ? [] : mergeOffers(lists);
|
|
669
702
|
this.slots = placeOffers(this.slots, live, { rejected: this.rejected, notFree: this.notFree, refreshingUntilMs: this.refreshingUntilMs, nowMs: Date.now(), closed: phase === "closed" });
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -103,6 +103,14 @@ export interface RouteLineView {
|
|
|
103
103
|
toPickup: Geo[];
|
|
104
104
|
ride: Geo[];
|
|
105
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* P-30 (KU-7, 2026-11-19): the map of a past ride for its rider — the line A → B offered with
|
|
108
|
+
* the quote and the line the driver drove A → B; an empty list when that line is not kept.
|
|
109
|
+
*/
|
|
110
|
+
export interface RideMapView {
|
|
111
|
+
planned: Geo[];
|
|
112
|
+
driven: Geo[];
|
|
113
|
+
}
|
|
106
114
|
export type RequestPhase = "searching" | "waitingForDriver" | "accepted" | "closed";
|
|
107
115
|
export type CloseReason = "offerRejected" | "otherOfferChosen" | "riderGaveUp" | "orderExpired";
|
|
108
116
|
export type RideStatusKind = "accepted" | "driverArrived" | "inProgress" | "completed" | "cancelledByDriver" | "cancelledByRider";
|
package/dist/interfaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC,YAAY,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC,wEAAwE;AACxE,MAAM,WAAW,KAAK;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,MAAM,GAAG,aAAa,GAAG,OAAO,CAAC;AAE7E,iFAAiF;AACjF,mFAAmF;AACnF,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAErL,yDAAyD;AACzD,MAAM,WAAW,OAAO;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;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xI,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,UAAU,GAAG,MAAM,EAAE,CAAC;IAC9B,IAAI,EAAE,SAAS,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,CAAC;CACrB"}
|
package/dist/mappers.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { CarInfo as CandidCarInfo, CarrierKind as CandidCarrierKind, DriverCard, Money as CandidMoney, RideStatus, RouteLine } from "../declarations/tigi-driver/tigi-driver.did.js";
|
|
1
|
+
import type { CarInfo as CandidCarInfo, CarrierKind as CandidCarrierKind, DriverCard, Money as CandidMoney, RideMap, RideStatus, RouteLine } from "../declarations/tigi-driver/tigi-driver.did.js";
|
|
2
2
|
import type { OfferView as CandidOfferView, RequestView as CandidRequestView } from "../declarations/worker/worker.did.js";
|
|
3
3
|
import type { RateRideOutcome as CandidRateRideOutcome, RideView as CandidHistoryRide } from "../declarations/core/core.did.js";
|
|
4
|
-
import type { CarView, CarrierKind, CloseReason, DriverCardView, Money, OfferView, RateRideOutcome, RequestPhase, RideHistoryEntry, RideStatusView, RideView, RouteLineView } from "./interfaces.js";
|
|
4
|
+
import type { CarView, CarrierKind, CloseReason, DriverCardView, Money, OfferView, RateRideOutcome, RequestPhase, RideHistoryEntry, RideMapView, RideStatusView, RideView, RouteLineView } from "./interfaces.js";
|
|
5
5
|
export declare const NS_PER_MS = 1000000n;
|
|
6
6
|
export declare function msOf(ns: bigint): number;
|
|
7
7
|
export declare function moneyOf(money: CandidMoney): Money;
|
|
@@ -72,6 +72,11 @@ export declare function etaToPickupNowSec(offer: Pick<OfferView, "etaToPickupSec
|
|
|
72
72
|
* P-23: an empty `toPickup` (a driver finishing a ride) is no leg — `toPickup: []`.
|
|
73
73
|
*/
|
|
74
74
|
export declare function routeLineOf(line: RouteLine): RouteLineView | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* P-30: the map of a past ride as the rider draws it — a line not valid or under two points is
|
|
77
|
+
* left out; undefined with nothing left to draw (the driver gave it: drawn, never trusted).
|
|
78
|
+
*/
|
|
79
|
+
export declare function rideMapOf(map: RideMap): RideMapView | undefined;
|
|
75
80
|
/** U-42: the order new offers join the list in — by arrival, then a fixed tie-break. */
|
|
76
81
|
export declare function compareArrival(a: OfferView, b: OfferView): number;
|
|
77
82
|
/**
|
|
@@ -98,6 +103,15 @@ export interface OfferMarks {
|
|
|
98
103
|
* with its last data; a new one goes at the end, by arrival. Pure: `previous` is not changed.
|
|
99
104
|
*/
|
|
100
105
|
export declare function placeOffers(previous: readonly OfferView[], live: readonly OfferView[], marks: OfferMarks): OfferView[];
|
|
106
|
+
/**
|
|
107
|
+
* ZO-N29 (user 2026-11-20: "Kierowca zajęty", then the ride): what a "searching" phase says of
|
|
108
|
+
* the offer just ordered. A plain query may answer from the state before the order (a poll in
|
|
109
|
+
* flight during `chooseOffer`, or a replica a round behind) — it proves nothing: the order
|
|
110
|
+
* stays waiting and the next read goes through consensus. Only that read says it came back.
|
|
111
|
+
* @returns `refused` (the driver was busy or did not answer), `unsure` (read again through
|
|
112
|
+
* consensus), `none` (nothing to decide)
|
|
113
|
+
*/
|
|
114
|
+
export declare function orderedOfferVerdict(phase: RequestPhase, ordered: boolean, fresh: boolean): "refused" | "unsure" | "none";
|
|
101
115
|
export declare function phaseOf(view: CandidRequestView): RequestPhase;
|
|
102
116
|
/**
|
|
103
117
|
* The phase of the request over all its workers (ZO-14, ZO-15): accepted anywhere wins,
|
package/dist/mappers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../src/mappers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,IAAI,aAAa,EAAE,W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CAAE,EAAE,CActM;AAID;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,EAAE,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAalF"}
|
package/dist/mappers.js
CHANGED
|
@@ -220,6 +220,18 @@ export function routeLineOf(line) {
|
|
|
220
220
|
return undefined;
|
|
221
221
|
return { toPickup, ride };
|
|
222
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* P-30: the map of a past ride as the rider draws it — a line not valid or under two points is
|
|
225
|
+
* left out; undefined with nothing left to draw (the driver gave it: drawn, never trusted).
|
|
226
|
+
*/
|
|
227
|
+
export function rideMapOf(map) {
|
|
228
|
+
const line = (text) => {
|
|
229
|
+
const points = text === "" ? undefined : decodePolyline(text);
|
|
230
|
+
return points !== undefined && points.length >= 2 ? points : [];
|
|
231
|
+
};
|
|
232
|
+
const view = { planned: line(map.planned), driven: line(map.driven) };
|
|
233
|
+
return view.planned.length === 0 && view.driven.length === 0 ? undefined : view;
|
|
234
|
+
}
|
|
223
235
|
/** U-42: the order new offers join the list in — by arrival, then a fixed tie-break. */
|
|
224
236
|
export function compareArrival(a, b) {
|
|
225
237
|
return a.receivedMs - b.receivedMs || (a.offerId < b.offerId ? -1 : a.offerId > b.offerId ? 1 : 0);
|
|
@@ -264,6 +276,19 @@ export function placeOffers(previous, live, marks) {
|
|
|
264
276
|
const all = [...placed, ...added];
|
|
265
277
|
return marks.closed ? all.map((offer) => (offer.gone === undefined ? { ...offer, gone: "closed" } : offer)) : all;
|
|
266
278
|
}
|
|
279
|
+
/**
|
|
280
|
+
* ZO-N29 (user 2026-11-20: "Kierowca zajęty", then the ride): what a "searching" phase says of
|
|
281
|
+
* the offer just ordered. A plain query may answer from the state before the order (a poll in
|
|
282
|
+
* flight during `chooseOffer`, or a replica a round behind) — it proves nothing: the order
|
|
283
|
+
* stays waiting and the next read goes through consensus. Only that read says it came back.
|
|
284
|
+
* @returns `refused` (the driver was busy or did not answer), `unsure` (read again through
|
|
285
|
+
* consensus), `none` (nothing to decide)
|
|
286
|
+
*/
|
|
287
|
+
export function orderedOfferVerdict(phase, ordered, fresh) {
|
|
288
|
+
if (!ordered || phase !== "searching")
|
|
289
|
+
return "none";
|
|
290
|
+
return fresh ? "refused" : "unsure";
|
|
291
|
+
}
|
|
267
292
|
export function phaseOf(view) {
|
|
268
293
|
return Object.keys(view.state)[0];
|
|
269
294
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsm-mit/tigi-sharded-package",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.1",
|
|
4
4
|
"description": "The one package of the Tigi network group: takes the coordinator's id and hides the coordinator, the core and the workers — for a consumer the group is one canister; plus the rider's few driver-canister endpoints (U-14).",
|
|
5
5
|
"homepage": "https://github.com/JSM-Tigi/tigi-sharded/tree/master/package#readme",
|
|
6
6
|
"repository": {
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
"tigiSharded": {
|
|
63
63
|
"repo": "tigi-sharded",
|
|
64
64
|
"repoUrl": "https://github.com/JSM-Tigi/tigi-sharded",
|
|
65
|
-
"commit": "
|
|
65
|
+
"commit": "dc562ed5f8ee8ff851900846c4cc9a3839a2fa19"
|
|
66
66
|
},
|
|
67
67
|
"tigiDriverRust": {
|
|
68
68
|
"repo": "tigi-driver-rust",
|
|
69
69
|
"repoUrl": "https://github.com/JSM-Tigi/tigi-driver-rust",
|
|
70
|
-
"commit": "
|
|
70
|
+
"commit": "7e22b1c95c3a0bf05d6237c04c4a0f765c6661db"
|
|
71
71
|
}
|
|
72
72
|
}
|