@jsm-mit/tigi-sharded-package 0.4.0 → 0.5.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 CHANGED
@@ -10,7 +10,9 @@ Status: the rider's side (night 1, U-42); 0.2.0 (stage 2a, U-43) adds the rider'
10
10
  rating and WHERE the chat with a driver is; 0.3.0 (U-45) adds `DriverCanistersActor` — the
11
11
  demo lease and the one-time claim code; 0.4.0 (route line, 2026-10-24) adds the driver's
12
12
  route on the map — the line of a tapped offer, the line of the ride — and the exact pin of
13
- an offer (`pinExact`). Version 0.1.0 was the first to publish.
13
+ an offer (`pinExact`); 0.5.0 (stage 7, ride history, 2026-10-24) adds the places of a past
14
+ ride (Skąd, Dokąd) and the rating of a past ride from the history. Version 0.1.0 was the
15
+ first to publish.
14
16
 
15
17
  ## The rider
16
18
 
@@ -46,6 +48,11 @@ await request.getLicenceAsyncUnsafe(); // from accepted to
46
48
  await request.rateDriverAsyncUnsafe(5); // after completed, once
47
49
 
48
50
  const page = await profiles.getMyRidesAsyncUnsafe(); // the history in the core, 20 a page
51
+ // 0.5.0 — a line: pickup?, destination? (KU-4; none before stage 7), ratable (KU-5), myRating?
52
+ const past = await profiles.getMyRideAsyncUnsafe(page.rides[0].rideRef); // one line (a reload); undefined until the core has it
53
+ if (past?.ratable) await profiles.ratePastRideAsyncUnsafe(past.rideRef, 5);
54
+ // → "ok" | "alreadyRated" (also after rateDriverAsyncUnsafe) | "notRatable" (not completed,
55
+ // the 24 h are over, not in the core yet) | "notAuthorized" (another rider's ride)
49
56
  const mine = await profiles.getMyRatingAsyncUnsafe(); // PF-4: { average: 4.87, count, sum } | undefined ("Brak ocen")
50
57
  await rides.getPastRideAsyncUnsafe(page.rides[0].rideRef); // its details from the driver canister
51
58
  ```
@@ -153,6 +160,8 @@ npm run test-drivers # (a) 5 real driver canisters, driver-bots, route-stu
153
160
  npm run test-simulator # (b) the simulator, 20 requests, 20 rides
154
161
  npm run test-split # (c) an area split during traffic
155
162
  npm run test-claim # (d) the demo lease and the claim code (U-45)
163
+ npm run test-route-line # (e) the route line of an offer and of a ride
164
+ npm run test-ride-history # (f) the history's places and the rating of a past ride (0.5.0)
156
165
  npm run test-smoke # one whole ride with the simulator (run by publish-public)
157
166
  npm run load-local # the load test: 200 simulated drivers, 100 riders (docs/load-test-2026-10-24.md)
158
167
  npm run publish-public # human-run: publish from master (see below)
@@ -45,7 +45,7 @@ type TigiCore =
45
45
  /// Admins: an admin more (the coordinator adds the people who rule the group).
46
46
  addAdmin: (args: PrincipalArgs) -> (Result_2);
47
47
  /// Admins: a canister the core controls joins the demo pool (U-35).
48
- addPoolCanister: (args: CanisterArgs) -> (Result_20);
48
+ addPoolCanister: (args: CanisterArgs) -> (Result_22);
49
49
  /// Admins: a driver canister, or one driver in it (`driverKey`), is blocked; the workers
50
50
  /// drop it at once (WO-2).
51
51
  blockDriver: (args: BlockDriverArgs) -> (Result_2);
@@ -54,57 +54,65 @@ type TigiCore =
54
54
  /// F-20 (U-45): the caller — the driver signed in on the canister's own front — takes
55
55
  /// over the demo canister with the code of the link. Single use, 15 min; every refusal
56
56
  /// answers the same NotAuthorized. The room of the canister gets the caller (C-15).
57
- claimDriverCanister: (args: ClaimArgs) -> (Result_20);
57
+ claimDriverCanister: (args: ClaimArgs) -> (Result_22);
58
58
  clearLogs: () -> ();
59
59
  /// Admins: the chunks become THE module of their kind. A new driver wasm is released
60
60
  /// (F-11) and its hash goes to the workers.
61
- commitDriverWasm: (args: WasmCommitArgs) -> (Result_29);
61
+ commitDriverWasm: (args: WasmCommitArgs) -> (Result_31);
62
62
  /// Admins, localTest: an empty canister from the core's cycles joins the demo pool.
63
- createLocalPoolCanister: () -> (Result_20);
63
+ createLocalPoolCanister: () -> (Result_22);
64
64
  /// F-2 … F-4, F-10: the caller's own driver canister (localTest: from the core's cycles).
65
- createMyDriverCanister: () -> (Result_20);
65
+ createMyDriverCanister: () -> (Result_22);
66
66
  /// Admins: the simulator, created once (F-18).
67
- ensureSimulator: () -> (Result_28);
67
+ ensureSimulator: () -> (Result_30);
68
68
  /// F-8: 15 min more for the holder of a demo canister.
69
- extendDemoLease: () -> (Result_20);
70
- getAdmins: () -> (Result_27) query;
69
+ extendDemoLease: () -> (Result_22);
70
+ getAdmins: () -> (Result_29) query;
71
71
  /// For the fronts (through the package): where the chat of this environment is. Null =
72
72
  /// no chat here yet. The room of a driver is `ChatRoomFunctions.driverRoomId`.
73
73
  getChatConfig: () -> (opt ChatConfig) query;
74
74
  /// Admins: how far the driver rooms are (C-15).
75
- getChatRoomsStatus: () -> (Result_26) query;
75
+ getChatRoomsStatus: () -> (Result_28) query;
76
76
  /// WO-1, WO-2: what the core knows of a canister — for the workers and anybody.
77
77
  getDriverCanisterStatus: (args: CanisterArgs) ->
78
78
  (DriverCanisterStatus) query;
79
79
  /// Admins: the account of one driver canister (C-17 … C-20).
80
- getDriverFeeAccount: (args: CanisterArgs) -> (Result_25) query;
80
+ getDriverFeeAccount: (args: CanisterArgs) -> (Result_27) query;
81
81
  /// C-19: a driver canister of the registry asks for its bill — the events since its
82
82
  /// last settlement, priced on the fee's day. Called by the canister at its first
83
83
  /// "Przyjmuję zlecenia" of a day. A pool canister owes nothing (C-18).
84
- getDriverFeeBill: () -> (Result_24);
85
- getDriverRollout: () -> (Result_23) query;
86
- getFactoryStatus: () -> (Result_22) query;
84
+ getDriverFeeBill: () -> (Result_26);
85
+ /// Admins (stage 7): the aggregated rating of one driver (sum and count of stars; null =
86
+ /// no rating yet) — the value the workers get through the outbox (C-6).
87
+ getDriverRating: (args: DriverRatingArgs) -> (Result_21) query;
88
+ getDriverRollout: () -> (Result_25) query;
89
+ getFactoryStatus: () -> (Result_24) query;
87
90
  /// C-22: the rates, the day, the multiplier cached, the totals.
88
- getFeeStatus: () -> (Result_21) query;
91
+ getFeeStatus: () -> (Result_23) query;
89
92
  getLogs: () -> (text) query;
90
93
  /// The caller's own canister, or the demo canister the caller holds now.
91
- getMyDriverCanister: () -> (Result_20) query;
94
+ getMyDriverCanister: () -> (Result_22) query;
92
95
  getMyProfile: () -> (Result_4) query;
93
96
  /// C-16, PF-4: the caller's own rating as a rider (sum and count of stars; null = no
94
97
  /// rating yet). Ratings reach the core in the workers' batches, up to a minute late.
95
- getMyRating: () -> (Result_19) query;
96
- /// C-8: the caller's rides, newest first.
97
- getMyRides: (args: RidesPageArgs) -> (Result_18) query;
98
+ getMyRating: () -> (Result_21) query;
99
+ /// C-8 (KU-4, stage 7): one line of the caller's history by its requestId — for the
100
+ /// details screen after a reload and to show the rating after `rateMyRide`. Another
101
+ /// rider's ride → `NotAuthorized`; not in the core (yet, K-9) → `NotFound`.
102
+ getMyRide: (args: RequestIdArgs) -> (Result_20) query;
103
+ /// C-8: the caller's rides, newest first, with the places (KU-4) and whether the driver
104
+ /// can still be rated (KU-5, C-23).
105
+ getMyRides: (args: RidesPageArgs) -> (Result_19) query;
98
106
  /// C-3: the names of up to MAX_PROFILES_PER_CALL principals; unknown ones are left out.
99
- getProfiles: (args: ProfilesArgs) -> (Result_17) query;
107
+ getProfiles: (args: ProfilesArgs) -> (Result_18) query;
100
108
  /// F-11: the driver wasms released so far, oldest first.
101
109
  getReleasedDriverWasms: () -> (vec ReleasedWasm) query;
102
110
  /// F-18: the simulator of this group; none in prod or before ensureSimulator.
103
111
  getSimulator: () -> (opt principal) query;
104
112
  /// Admins: the coordinator, the workers confirmed so far, the mode.
105
- getWiring: () -> (Result_16) query;
113
+ getWiring: () -> (Result_17) query;
106
114
  /// Admins: how far the outbox to the workers is (C-6, C-7).
107
- getWorkerOutbox: () -> (Result_15) query;
115
+ getWorkerOutbox: () -> (Result_16) query;
108
116
  /// Workers of the group: the core asks the coordinator once and remembers the worker,
109
117
  /// which then gets the network state through the outbox. A worker calls it once after
110
118
  /// its install. Answers true.
@@ -112,27 +120,33 @@ type TigiCore =
112
120
  /// Workers of the group: finished rides and ratings, at most MAX_RIDE_BATCH (C-4, C-5).
113
121
  /// Idempotent: a known requestId and a counted rating count once. Invalid entries are
114
122
  /// rejected and logged; the worker drops the whole batch after an ok.
115
- ingestRideBatch: (batch: RideBatch) -> (Result_14);
123
+ ingestRideBatch: (batch: RideBatch) -> (Result_15);
116
124
  /// C-14: the accounts gate of the chat (U-43). The chat core asks this group's
117
125
  /// coordinator WHERE (`accountsCanisterFor` → this core) and asks here: true = an
118
126
  /// account with a name exists for the principal and the rider is not blocked.
119
127
  isUser: ("principal": principal) -> (bool) query;
120
128
  /// F-5 … F-7: a demo canister for 15 min (outside prod). A fresh lease comes with a
121
129
  /// one-time claim code (F-20, U-45).
122
- leaseDemoDriverCanister: () -> (Result_13);
123
- listBlocks: (args: PageArgs) -> (Result_12) query;
124
- listDriverCanisters: (args: PageArgs) -> (Result_11) query;
130
+ leaseDemoDriverCanister: () -> (Result_14);
131
+ listBlocks: (args: PageArgs) -> (Result_13) query;
132
+ listDriverCanisters: (args: PageArgs) -> (Result_12) query;
125
133
  /// Admins: the accounts, 100 a page at most.
126
- listDriverFeeAccounts: (args: PageArgs) -> (Result_10) query;
134
+ listDriverFeeAccounts: (args: PageArgs) -> (Result_11) query;
127
135
  /// Admins: the driver rooms as the core wants them, 100 a page at most.
128
- listDriverRooms: (args: PageArgs) -> (Result_9) query;
136
+ listDriverRooms: (args: PageArgs) -> (Result_10) query;
129
137
  /// F-20: a fresh claim code for the caller's running demo lease; the old one stops
130
138
  /// working.
131
- newClaimCode: () -> (Result_8);
139
+ newClaimCode: () -> (Result_9);
132
140
  /// C-20: the driver canister pays the bill of `day` with the cycles attached to this
133
141
  /// call. The core takes exactly the bill (the rest goes back), or nothing when less is
134
142
  /// attached (`FEE_SHORT`); a day paid already answers `accepted = 0`.
135
- payDriverFee: (args: FeePayArgs) -> (Result_7);
143
+ payDriverFee: (args: FeePayArgs) -> (Result_8);
144
+ /// C-23 (KU-5, stage 7): the rider rates the driver of a finished ride from the history.
145
+ /// Only the ride's rider; a completed ride within 24 h of its end (K-8); once per ride
146
+ /// over both paths — a live rating through the worker and this one count once together
147
+ /// (the first to reach the core). The driver's aggregate goes to the workers as a
148
+ /// batch's does (C-6). Counted in the caller's `#account` pool.
149
+ rateMyRide: (args: RateRideArgs) -> (Result_7);
136
150
  removeAdmin: (args: PrincipalArgs) -> (Result_2);
137
151
  resumeDriverRollout: () -> (Result_3);
138
152
  /// Admins: the chat of this environment — the chat group's coordinator and the project
@@ -202,14 +216,30 @@ type RidesPageArgs =
202
216
  type RidesPage =
203
217
  record {
204
218
  nextBeforeIndex: opt nat;
205
- rides: vec RideEntry;
219
+ rides: vec RideView;
206
220
  };
207
- type RideEntry =
221
+ type RideView =
208
222
  record {
223
+ destination: opt Geo;
209
224
  driverCanister: principal;
210
225
  driverKey: text;
211
226
  end: RideEnd;
212
227
  endedAtNs: nat64;
228
+ myRating: opt nat8;
229
+ pickup: opt Geo;
230
+ price: opt Money;
231
+ ratable: opt bool;
232
+ requestId: text;
233
+ rider: principal;
234
+ };
235
+ type RideEntryIn =
236
+ record {
237
+ destination: opt Geo;
238
+ driverCanister: principal;
239
+ driverKey: text;
240
+ end: RideEnd;
241
+ endedAtNs: nat64;
242
+ pickup: opt Geo;
213
243
  price: opt Money;
214
244
  requestId: text;
215
245
  rider: principal;
@@ -230,23 +260,23 @@ type RideBatchResult =
230
260
  type RideBatch =
231
261
  record {
232
262
  ratings: vec RatingEntry;
233
- rides: vec RideEntry;
263
+ rides: vec RideEntryIn;
234
264
  usage: opt UsageBatch;
235
265
  };
236
266
  type Result_9 =
237
267
  variant {
238
268
  err: Error;
239
- ok: vec DriverRoomView;
269
+ ok: ClaimCode;
240
270
  };
241
271
  type Result_8 =
242
272
  variant {
243
273
  err: Error;
244
- ok: ClaimCode;
274
+ ok: FeePaid;
245
275
  };
246
276
  type Result_7 =
247
277
  variant {
248
278
  err: Error;
249
- ok: FeePaid;
279
+ ok: RateRideOutcome;
250
280
  };
251
281
  type Result_6 =
252
282
  variant {
@@ -263,6 +293,16 @@ type Result_4 =
263
293
  err: Error;
264
294
  ok: Profile;
265
295
  };
296
+ type Result_31 =
297
+ variant {
298
+ err: Error;
299
+ ok: WasmInfo;
300
+ };
301
+ type Result_30 =
302
+ variant {
303
+ err: Error;
304
+ ok: principal;
305
+ };
266
306
  type Result_3 =
267
307
  variant {
268
308
  err: Error;
@@ -271,52 +311,52 @@ type Result_3 =
271
311
  type Result_29 =
272
312
  variant {
273
313
  err: Error;
274
- ok: WasmInfo;
314
+ ok: vec principal;
275
315
  };
276
316
  type Result_28 =
277
317
  variant {
278
318
  err: Error;
279
- ok: principal;
319
+ ok: ChatRoomsStatus;
280
320
  };
281
321
  type Result_27 =
282
322
  variant {
283
323
  err: Error;
284
- ok: vec principal;
324
+ ok: DriverFeeAccountView;
285
325
  };
286
326
  type Result_26 =
287
327
  variant {
288
328
  err: Error;
289
- ok: ChatRoomsStatus;
329
+ ok: FeeBill;
290
330
  };
291
331
  type Result_25 =
292
332
  variant {
293
333
  err: Error;
294
- ok: DriverFeeAccountView;
334
+ ok: opt RolloutView;
295
335
  };
296
336
  type Result_24 =
297
337
  variant {
298
338
  err: Error;
299
- ok: FeeBill;
339
+ ok: FactoryStatus;
300
340
  };
301
341
  type Result_23 =
302
342
  variant {
303
343
  err: Error;
304
- ok: opt RolloutView;
344
+ ok: FeeStatus;
305
345
  };
306
346
  type Result_22 =
307
347
  variant {
308
348
  err: Error;
309
- ok: FactoryStatus;
349
+ ok: DriverCanister;
310
350
  };
311
351
  type Result_21 =
312
352
  variant {
313
353
  err: Error;
314
- ok: FeeStatus;
354
+ ok: opt Rating;
315
355
  };
316
356
  type Result_20 =
317
357
  variant {
318
358
  err: Error;
319
- ok: DriverCanister;
359
+ ok: RideView;
320
360
  };
321
361
  type Result_2 =
322
362
  variant {
@@ -324,26 +364,21 @@ type Result_2 =
324
364
  ok: bool;
325
365
  };
326
366
  type Result_19 =
327
- variant {
328
- err: Error;
329
- ok: opt Rating;
330
- };
331
- type Result_18 =
332
367
  variant {
333
368
  err: Error;
334
369
  ok: RidesPage;
335
370
  };
336
- type Result_17 =
371
+ type Result_18 =
337
372
  variant {
338
373
  err: Error;
339
374
  ok: vec ProfileEntry;
340
375
  };
341
- type Result_16 =
376
+ type Result_17 =
342
377
  variant {
343
378
  err: Error;
344
379
  ok: Wiring;
345
380
  };
346
- type Result_15 =
381
+ type Result_16 =
347
382
  variant {
348
383
  err: Error;
349
384
  ok:
@@ -354,31 +389,36 @@ type Result_15 =
354
389
  subjects: nat;
355
390
  };
356
391
  };
357
- type Result_14 =
392
+ type Result_15 =
358
393
  variant {
359
394
  err: Error;
360
395
  ok: RideBatchResult;
361
396
  };
362
- type Result_13 =
397
+ type Result_14 =
363
398
  variant {
364
399
  err: Error;
365
400
  ok: LeaseAnswer;
366
401
  };
367
- type Result_12 =
402
+ type Result_13 =
368
403
  variant {
369
404
  err: Error;
370
405
  ok: vec Block;
371
406
  };
372
- type Result_11 =
407
+ type Result_12 =
373
408
  variant {
374
409
  err: Error;
375
410
  ok: DriverCanistersPage;
376
411
  };
377
- type Result_10 =
412
+ type Result_11 =
378
413
  variant {
379
414
  err: Error;
380
415
  ok: vec DriverFeeAccountView;
381
416
  };
417
+ type Result_10 =
418
+ variant {
419
+ err: Error;
420
+ ok: vec DriverRoomView;
421
+ };
382
422
  type Result_1 =
383
423
  variant {
384
424
  err: Error;
@@ -389,6 +429,7 @@ type Result =
389
429
  err: Error;
390
430
  ok: nat;
391
431
  };
432
+ type RequestIdArgs = record {requestId: text;};
392
433
  type ReleasedWasm =
393
434
  record {
394
435
  releasedAtNs: int;
@@ -414,6 +455,17 @@ type Rating =
414
455
  count: nat;
415
456
  sum: nat;
416
457
  };
458
+ type RateRideOutcome =
459
+ variant {
460
+ alreadyRated;
461
+ notRatable: text;
462
+ rated;
463
+ };
464
+ type RateRideArgs =
465
+ record {
466
+ requestId: text;
467
+ stars: nat8;
468
+ };
417
469
  type ProfilesArgs = record {principals: vec principal;};
418
470
  type ProfileEntry =
419
471
  record {
@@ -467,6 +519,11 @@ type InitArgs =
467
519
  coordinator: opt principal;
468
520
  mode: Mode;
469
521
  };
522
+ type Geo =
523
+ record {
524
+ lat: float64;
525
+ lng: float64;
526
+ };
470
527
  type FeeUsage =
471
528
  record {
472
529
  quoteRequests: nat;
@@ -558,6 +615,11 @@ type DriverRoomView =
558
615
  roomId: text;
559
616
  synced: bool;
560
617
  };
618
+ type DriverRatingArgs =
619
+ record {
620
+ canister: principal;
621
+ driverKey: text;
622
+ };
561
623
  type DriverFeeAccountView =
562
624
  record {
563
625
  bill: opt FeeBill;