@jsm-mit/tigi-sharded-package 0.3.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.
Files changed (37) hide show
  1. package/README.md +16 -2
  2. package/declarations/coordinator/coordinator.did +39 -0
  3. package/declarations/coordinator/coordinator.did.d.ts +68 -0
  4. package/declarations/coordinator/coordinator.did.js +23 -0
  5. package/declarations/core/core.did +240 -53
  6. package/declarations/core/core.did.d.ts +208 -48
  7. package/declarations/core/core.did.js +165 -51
  8. package/declarations/tigi-driver/tigi-driver.did +15 -0
  9. package/declarations/tigi-driver/tigi-driver.did.d.ts +19 -0
  10. package/declarations/tigi-driver/tigi-driver.did.js +6 -0
  11. package/declarations/tigi-simulator/tigi-simulator.did +46 -4
  12. package/declarations/tigi-simulator/tigi-simulator.did.d.ts +70 -4
  13. package/declarations/tigi-simulator/tigi-simulator.did.js +39 -10
  14. package/declarations/worker/worker.did +23 -6
  15. package/declarations/worker/worker.did.d.ts +18 -6
  16. package/declarations/worker/worker.did.js +14 -7
  17. package/dist/actors/profiles-actor.d.ts +20 -1
  18. package/dist/actors/profiles-actor.d.ts.map +1 -1
  19. package/dist/actors/profiles-actor.js +46 -12
  20. package/dist/actors/rides-actor.d.ts +21 -1
  21. package/dist/actors/rides-actor.d.ts.map +1 -1
  22. package/dist/actors/rides-actor.js +46 -6
  23. package/dist/geo.d.ts +5 -0
  24. package/dist/geo.d.ts.map +1 -1
  25. package/dist/geo.js +41 -0
  26. package/dist/group/canister-actor.d.ts +7 -0
  27. package/dist/group/canister-actor.d.ts.map +1 -1
  28. package/dist/group/canister-actor.js +18 -0
  29. package/dist/index.d.ts +2 -2
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +2 -2
  32. package/dist/interfaces.d.ts +35 -1
  33. package/dist/interfaces.d.ts.map +1 -1
  34. package/dist/mappers.d.ts +20 -2
  35. package/dist/mappers.d.ts.map +1 -1
  36. package/dist/mappers.js +62 -2
  37. package/package.json +7 -4
@@ -28,6 +28,11 @@ type WasmChunkArgs =
28
28
  index: nat32;
29
29
  kind: WasmKind;
30
30
  };
31
+ type UsageBatch =
32
+ record {
33
+ batchId: nat64;
34
+ entries: vec DriverUsage;
35
+ };
31
36
  type UnblockRiderArgs = record {rider: principal;};
32
37
  type UnblockDriverArgs =
33
38
  record {
@@ -40,7 +45,7 @@ type TigiCore =
40
45
  /// Admins: an admin more (the coordinator adds the people who rule the group).
41
46
  addAdmin: (args: PrincipalArgs) -> (Result_2);
42
47
  /// Admins: a canister the core controls joins the demo pool (U-35).
43
- addPoolCanister: (args: CanisterArgs) -> (Result_17);
48
+ addPoolCanister: (args: CanisterArgs) -> (Result_22);
44
49
  /// Admins: a driver canister, or one driver in it (`driverKey`), is blocked; the workers
45
50
  /// drop it at once (WO-2).
46
51
  blockDriver: (args: BlockDriverArgs) -> (Result_2);
@@ -49,49 +54,65 @@ type TigiCore =
49
54
  /// F-20 (U-45): the caller — the driver signed in on the canister's own front — takes
50
55
  /// over the demo canister with the code of the link. Single use, 15 min; every refusal
51
56
  /// answers the same NotAuthorized. The room of the canister gets the caller (C-15).
52
- claimDriverCanister: (args: ClaimArgs) -> (Result_17);
57
+ claimDriverCanister: (args: ClaimArgs) -> (Result_22);
53
58
  clearLogs: () -> ();
54
59
  /// Admins: the chunks become THE module of their kind. A new driver wasm is released
55
60
  /// (F-11) and its hash goes to the workers.
56
- commitDriverWasm: (args: WasmCommitArgs) -> (Result_23);
61
+ commitDriverWasm: (args: WasmCommitArgs) -> (Result_31);
57
62
  /// Admins, localTest: an empty canister from the core's cycles joins the demo pool.
58
- createLocalPoolCanister: () -> (Result_17);
63
+ createLocalPoolCanister: () -> (Result_22);
59
64
  /// F-2 … F-4, F-10: the caller's own driver canister (localTest: from the core's cycles).
60
- createMyDriverCanister: () -> (Result_17);
65
+ createMyDriverCanister: () -> (Result_22);
61
66
  /// Admins: the simulator, created once (F-18).
62
- ensureSimulator: () -> (Result_22);
67
+ ensureSimulator: () -> (Result_30);
63
68
  /// F-8: 15 min more for the holder of a demo canister.
64
- extendDemoLease: () -> (Result_17);
65
- getAdmins: () -> (Result_21) query;
69
+ extendDemoLease: () -> (Result_22);
70
+ getAdmins: () -> (Result_29) query;
66
71
  /// For the fronts (through the package): where the chat of this environment is. Null =
67
72
  /// no chat here yet. The room of a driver is `ChatRoomFunctions.driverRoomId`.
68
73
  getChatConfig: () -> (opt ChatConfig) query;
69
74
  /// Admins: how far the driver rooms are (C-15).
70
- getChatRoomsStatus: () -> (Result_20) query;
75
+ getChatRoomsStatus: () -> (Result_28) query;
71
76
  /// WO-1, WO-2: what the core knows of a canister — for the workers and anybody.
72
77
  getDriverCanisterStatus: (args: CanisterArgs) ->
73
78
  (DriverCanisterStatus) query;
74
- getDriverRollout: () -> (Result_19) query;
75
- getFactoryStatus: () -> (Result_18) query;
79
+ /// Admins: the account of one driver canister (C-17 … C-20).
80
+ getDriverFeeAccount: (args: CanisterArgs) -> (Result_27) query;
81
+ /// C-19: a driver canister of the registry asks for its bill — the events since its
82
+ /// last settlement, priced on the fee's day. Called by the canister at its first
83
+ /// "Przyjmuję zlecenia" of a day. A pool canister owes nothing (C-18).
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;
90
+ /// C-22: the rates, the day, the multiplier cached, the totals.
91
+ getFeeStatus: () -> (Result_23) query;
76
92
  getLogs: () -> (text) query;
77
93
  /// The caller's own canister, or the demo canister the caller holds now.
78
- getMyDriverCanister: () -> (Result_17) query;
94
+ getMyDriverCanister: () -> (Result_22) query;
79
95
  getMyProfile: () -> (Result_4) query;
80
96
  /// C-16, PF-4: the caller's own rating as a rider (sum and count of stars; null = no
81
97
  /// rating yet). Ratings reach the core in the workers' batches, up to a minute late.
82
- getMyRating: () -> (Result_16) query;
83
- /// C-8: the caller's rides, newest first.
84
- getMyRides: (args: RidesPageArgs) -> (Result_15) 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;
85
106
  /// C-3: the names of up to MAX_PROFILES_PER_CALL principals; unknown ones are left out.
86
- getProfiles: (args: ProfilesArgs) -> (Result_14) query;
107
+ getProfiles: (args: ProfilesArgs) -> (Result_18) query;
87
108
  /// F-11: the driver wasms released so far, oldest first.
88
109
  getReleasedDriverWasms: () -> (vec ReleasedWasm) query;
89
110
  /// F-18: the simulator of this group; none in prod or before ensureSimulator.
90
111
  getSimulator: () -> (opt principal) query;
91
112
  /// Admins: the coordinator, the workers confirmed so far, the mode.
92
- getWiring: () -> (Result_13) query;
113
+ getWiring: () -> (Result_17) query;
93
114
  /// Admins: how far the outbox to the workers is (C-6, C-7).
94
- getWorkerOutbox: () -> (Result_12) query;
115
+ getWorkerOutbox: () -> (Result_16) query;
95
116
  /// Workers of the group: the core asks the coordinator once and remembers the worker,
96
117
  /// which then gets the network state through the outbox. A worker calls it once after
97
118
  /// its install. Answers true.
@@ -99,34 +120,55 @@ type TigiCore =
99
120
  /// Workers of the group: finished rides and ratings, at most MAX_RIDE_BATCH (C-4, C-5).
100
121
  /// Idempotent: a known requestId and a counted rating count once. Invalid entries are
101
122
  /// rejected and logged; the worker drops the whole batch after an ok.
102
- ingestRideBatch: (batch: RideBatch) -> (Result_11);
123
+ ingestRideBatch: (batch: RideBatch) -> (Result_15);
103
124
  /// C-14: the accounts gate of the chat (U-43). The chat core asks this group's
104
125
  /// coordinator WHERE (`accountsCanisterFor` → this core) and asks here: true = an
105
126
  /// account with a name exists for the principal and the rider is not blocked.
106
127
  isUser: ("principal": principal) -> (bool) query;
107
128
  /// F-5 … F-7: a demo canister for 15 min (outside prod). A fresh lease comes with a
108
129
  /// one-time claim code (F-20, U-45).
109
- leaseDemoDriverCanister: () -> (Result_10);
110
- listBlocks: (args: PageArgs) -> (Result_9) query;
111
- listDriverCanisters: (args: PageArgs) -> (Result_8) query;
130
+ leaseDemoDriverCanister: () -> (Result_14);
131
+ listBlocks: (args: PageArgs) -> (Result_13) query;
132
+ listDriverCanisters: (args: PageArgs) -> (Result_12) query;
133
+ /// Admins: the accounts, 100 a page at most.
134
+ listDriverFeeAccounts: (args: PageArgs) -> (Result_11) query;
112
135
  /// Admins: the driver rooms as the core wants them, 100 a page at most.
113
- listDriverRooms: (args: PageArgs) -> (Result_7) query;
136
+ listDriverRooms: (args: PageArgs) -> (Result_10) query;
114
137
  /// F-20: a fresh claim code for the caller's running demo lease; the old one stops
115
138
  /// working.
116
- newClaimCode: () -> (Result_6);
139
+ newClaimCode: () -> (Result_9);
140
+ /// C-20: the driver canister pays the bill of `day` with the cycles attached to this
141
+ /// call. The core takes exactly the bill (the rest goes back), or nothing when less is
142
+ /// attached (`FEE_SHORT`); a day paid already answers `accepted = 0`.
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);
117
150
  removeAdmin: (args: PrincipalArgs) -> (Result_2);
118
151
  resumeDriverRollout: () -> (Result_3);
119
152
  /// Admins: the chat of this environment — the chat group's coordinator and the project
120
153
  /// (whose admin and accounts field are this group's coordinator). Every call sends every
121
154
  /// driver room again (a new project, a chat group set up again).
122
- setChatConfig: (args: ChatConfig) -> (Result_5);
155
+ setChatConfig: (args: ChatConfig) -> (Result_6);
123
156
  /// Admins, localTest only: new claim codes live this long (the local check of an
124
157
  /// expired code). Heap only: an upgrade brings back 15 min.
125
158
  setClaimCodeTtl: (args: ClaimTtlArgs) -> (Result);
159
+ /// Admins: the cycles per event (C-18).
160
+ setFeeRates: (rates: FeeRates) -> (Result_5);
126
161
  setLoggingEnabled: (enabled: bool) -> (Result_2);
127
162
  /// The coordinator only: the balance below which the core asks for cycles.
128
163
  setLowCyclesBelow: (value: nat) -> (Result_2);
129
164
  setMyProfile: (args: SetProfileArgs) -> (Result_4);
165
+ /// F-21 (2026-10-24, route line): admins — the one principal that routes the simulator's
166
+ /// quotes (S-N13, a Node process like a driver's front); null removes it. The simulator
167
+ /// takes it from the core only.
168
+ setSimulatorRouter: (args: SimulatorRouterArgs) -> (Result_2);
169
+ /// Admins, localTest only: the fee's day moves this many days on (the local check of
170
+ /// "the next day"). Heap only: an upgrade brings back the real day.
171
+ setTestDayOffset: (args: TestDayArgs) -> (Result);
130
172
  /// Admins: a rollout of the current driver wasm (F-12): the canary, then the rest, one
131
173
  /// canister a step, never during a ride (F-13).
132
174
  startDriverRollout: () -> (Result_3);
@@ -137,6 +179,8 @@ type TigiCore =
137
179
  /// Admins: one chunk of a new driver or simulator module (gzipped: ~0.7 MB).
138
180
  uploadDriverWasmChunk: (args: WasmChunkArgs) -> (Result);
139
181
  };
182
+ type TestDayArgs = record {days: nat;};
183
+ type SimulatorRouterArgs = record {router: opt principal;};
140
184
  type SetProfileArgs = record {name: text;};
141
185
  type RolloutView =
142
186
  record {
@@ -172,14 +216,30 @@ type RidesPageArgs =
172
216
  type RidesPage =
173
217
  record {
174
218
  nextBeforeIndex: opt nat;
175
- rides: vec RideEntry;
219
+ rides: vec RideView;
176
220
  };
177
- type RideEntry =
221
+ type RideView =
178
222
  record {
223
+ destination: opt Geo;
179
224
  driverCanister: principal;
180
225
  driverKey: text;
181
226
  end: RideEnd;
182
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;
183
243
  price: opt Money;
184
244
  requestId: text;
185
245
  rider: principal;
@@ -200,104 +260,125 @@ type RideBatchResult =
200
260
  type RideBatch =
201
261
  record {
202
262
  ratings: vec RatingEntry;
203
- rides: vec RideEntry;
263
+ rides: vec RideEntryIn;
264
+ usage: opt UsageBatch;
204
265
  };
205
266
  type Result_9 =
206
267
  variant {
207
268
  err: Error;
208
- ok: vec Block;
269
+ ok: ClaimCode;
209
270
  };
210
271
  type Result_8 =
211
272
  variant {
212
273
  err: Error;
213
- ok: DriverCanistersPage;
274
+ ok: FeePaid;
214
275
  };
215
276
  type Result_7 =
216
277
  variant {
217
278
  err: Error;
218
- ok: vec DriverRoomView;
279
+ ok: RateRideOutcome;
219
280
  };
220
281
  type Result_6 =
221
282
  variant {
222
283
  err: Error;
223
- ok: ClaimCode;
284
+ ok: ChatConfig;
224
285
  };
225
286
  type Result_5 =
226
287
  variant {
227
288
  err: Error;
228
- ok: ChatConfig;
289
+ ok: FeeRates;
229
290
  };
230
291
  type Result_4 =
231
292
  variant {
232
293
  err: Error;
233
294
  ok: Profile;
234
295
  };
235
- type Result_3 =
296
+ type Result_31 =
236
297
  variant {
237
298
  err: Error;
238
- ok: RolloutView;
299
+ ok: WasmInfo;
239
300
  };
240
- type Result_23 =
301
+ type Result_30 =
241
302
  variant {
242
303
  err: Error;
243
- ok: WasmInfo;
304
+ ok: principal;
244
305
  };
245
- type Result_22 =
306
+ type Result_3 =
246
307
  variant {
247
308
  err: Error;
248
- ok: principal;
309
+ ok: RolloutView;
249
310
  };
250
- type Result_21 =
311
+ type Result_29 =
251
312
  variant {
252
313
  err: Error;
253
314
  ok: vec principal;
254
315
  };
255
- type Result_20 =
316
+ type Result_28 =
256
317
  variant {
257
318
  err: Error;
258
319
  ok: ChatRoomsStatus;
259
320
  };
260
- type Result_2 =
321
+ type Result_27 =
261
322
  variant {
262
323
  err: Error;
263
- ok: bool;
324
+ ok: DriverFeeAccountView;
264
325
  };
265
- type Result_19 =
326
+ type Result_26 =
327
+ variant {
328
+ err: Error;
329
+ ok: FeeBill;
330
+ };
331
+ type Result_25 =
266
332
  variant {
267
333
  err: Error;
268
334
  ok: opt RolloutView;
269
335
  };
270
- type Result_18 =
336
+ type Result_24 =
271
337
  variant {
272
338
  err: Error;
273
339
  ok: FactoryStatus;
274
340
  };
275
- type Result_17 =
341
+ type Result_23 =
342
+ variant {
343
+ err: Error;
344
+ ok: FeeStatus;
345
+ };
346
+ type Result_22 =
276
347
  variant {
277
348
  err: Error;
278
349
  ok: DriverCanister;
279
350
  };
280
- type Result_16 =
351
+ type Result_21 =
281
352
  variant {
282
353
  err: Error;
283
354
  ok: opt Rating;
284
355
  };
285
- type Result_15 =
356
+ type Result_20 =
357
+ variant {
358
+ err: Error;
359
+ ok: RideView;
360
+ };
361
+ type Result_2 =
362
+ variant {
363
+ err: Error;
364
+ ok: bool;
365
+ };
366
+ type Result_19 =
286
367
  variant {
287
368
  err: Error;
288
369
  ok: RidesPage;
289
370
  };
290
- type Result_14 =
371
+ type Result_18 =
291
372
  variant {
292
373
  err: Error;
293
374
  ok: vec ProfileEntry;
294
375
  };
295
- type Result_13 =
376
+ type Result_17 =
296
377
  variant {
297
378
  err: Error;
298
379
  ok: Wiring;
299
380
  };
300
- type Result_12 =
381
+ type Result_16 =
301
382
  variant {
302
383
  err: Error;
303
384
  ok:
@@ -308,16 +389,36 @@ type Result_12 =
308
389
  subjects: nat;
309
390
  };
310
391
  };
311
- type Result_11 =
392
+ type Result_15 =
312
393
  variant {
313
394
  err: Error;
314
395
  ok: RideBatchResult;
315
396
  };
316
- type Result_10 =
397
+ type Result_14 =
317
398
  variant {
318
399
  err: Error;
319
400
  ok: LeaseAnswer;
320
401
  };
402
+ type Result_13 =
403
+ variant {
404
+ err: Error;
405
+ ok: vec Block;
406
+ };
407
+ type Result_12 =
408
+ variant {
409
+ err: Error;
410
+ ok: DriverCanistersPage;
411
+ };
412
+ type Result_11 =
413
+ variant {
414
+ err: Error;
415
+ ok: vec DriverFeeAccountView;
416
+ };
417
+ type Result_10 =
418
+ variant {
419
+ err: Error;
420
+ ok: vec DriverRoomView;
421
+ };
321
422
  type Result_1 =
322
423
  variant {
323
424
  err: Error;
@@ -328,6 +429,7 @@ type Result =
328
429
  err: Error;
329
430
  ok: nat;
330
431
  };
432
+ type RequestIdArgs = record {requestId: text;};
331
433
  type ReleasedWasm =
332
434
  record {
333
435
  releasedAtNs: int;
@@ -353,6 +455,17 @@ type Rating =
353
455
  count: nat;
354
456
  sum: nat;
355
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
+ };
356
469
  type ProfilesArgs = record {principals: vec principal;};
357
470
  type ProfileEntry =
358
471
  record {
@@ -406,6 +519,59 @@ type InitArgs =
406
519
  coordinator: opt principal;
407
520
  mode: Mode;
408
521
  };
522
+ type Geo =
523
+ record {
524
+ lat: float64;
525
+ lng: float64;
526
+ };
527
+ type FeeUsage =
528
+ record {
529
+ quoteRequests: nat;
530
+ registrations: nat;
531
+ rides: nat;
532
+ };
533
+ type FeeStatus =
534
+ record {
535
+ accounts: nat;
536
+ forwardedTotal: nat;
537
+ lastForwardError: opt text;
538
+ multiplier: opt record {
539
+ day: nat;
540
+ permille: nat;
541
+ };
542
+ paidTotal: nat;
543
+ rates: FeeRates;
544
+ toForward: nat;
545
+ today: nat;
546
+ };
547
+ type FeeRecord =
548
+ record {
549
+ amount: nat;
550
+ day: nat;
551
+ paidAtNs: int;
552
+ };
553
+ type FeeRates =
554
+ record {
555
+ perQuoteRequest: nat;
556
+ perRegistration: nat;
557
+ perRide: nat;
558
+ };
559
+ type FeePayArgs = record {day: nat;};
560
+ type FeePaid =
561
+ record {
562
+ accepted: nat;
563
+ amount: nat;
564
+ day: nat;
565
+ };
566
+ type FeeBill =
567
+ record {
568
+ amount: nat;
569
+ day: nat;
570
+ multiplierPermille: nat;
571
+ rates: FeeRates;
572
+ settled: bool;
573
+ usage: FeeUsage;
574
+ };
409
575
  type FactoryStatus =
410
576
  record {
411
577
  creationsInProgress: nat;
@@ -433,6 +599,13 @@ type Error =
433
599
  details: ErrorDetails;
434
600
  logsJson: text;
435
601
  };
602
+ type DriverUsage =
603
+ record {
604
+ canister: principal;
605
+ quoteRequests: nat;
606
+ registrations: nat;
607
+ rides: nat;
608
+ };
436
609
  type DriverRoomView =
437
610
  record {
438
611
  canister: principal;
@@ -442,6 +615,20 @@ type DriverRoomView =
442
615
  roomId: text;
443
616
  synced: bool;
444
617
  };
618
+ type DriverRatingArgs =
619
+ record {
620
+ canister: principal;
621
+ driverKey: text;
622
+ };
623
+ type DriverFeeAccountView =
624
+ record {
625
+ bill: opt FeeBill;
626
+ canister: principal;
627
+ lastFee: opt FeeRecord;
628
+ lastSettledDay: opt nat;
629
+ paidTotal: nat;
630
+ pending: FeeUsage;
631
+ };
445
632
  type DriverCanistersPage =
446
633
  record {
447
634
  canisters: vec DriverCanister;