@jsm-mit/tigi-sharded-package 0.4.0 → 0.5.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.
@@ -44,8 +44,13 @@ type TigiCore =
44
44
  abortDriverRollout: () -> (Result_3);
45
45
  /// Admins: an admin more (the coordinator adds the people who rule the group).
46
46
  addAdmin: (args: PrincipalArgs) -> (Result_2);
47
+ /// C-27 (D8): the coordinator only — the driver rooms of a chat bill it paid. Each share
48
+ /// joins the next daily bill of the room's OWN driver canister as it is (the chat priced
49
+ /// it; no multiplier). A pool canister's share and a room of no canister of the registry
50
+ /// are absorbed (the coordinator keeps paying them). Once per `batchId`.
51
+ addChatShares: (args: ChatSharesArgs) -> (Result_32);
47
52
  /// Admins: a canister the core controls joins the demo pool (U-35).
48
- addPoolCanister: (args: CanisterArgs) -> (Result_20);
53
+ addPoolCanister: (args: CanisterArgs) -> (Result_6);
49
54
  /// Admins: a driver canister, or one driver in it (`driverKey`), is blocked; the workers
50
55
  /// drop it at once (WO-2).
51
56
  blockDriver: (args: BlockDriverArgs) -> (Result_2);
@@ -54,57 +59,65 @@ type TigiCore =
54
59
  /// F-20 (U-45): the caller — the driver signed in on the canister's own front — takes
55
60
  /// over the demo canister with the code of the link. Single use, 15 min; every refusal
56
61
  /// answers the same NotAuthorized. The room of the canister gets the caller (C-15).
57
- claimDriverCanister: (args: ClaimArgs) -> (Result_20);
62
+ claimDriverCanister: (args: ClaimArgs) -> (Result_6);
58
63
  clearLogs: () -> ();
59
64
  /// Admins: the chunks become THE module of their kind. A new driver wasm is released
60
65
  /// (F-11) and its hash goes to the workers.
61
- commitDriverWasm: (args: WasmCommitArgs) -> (Result_29);
66
+ commitDriverWasm: (args: WasmCommitArgs) -> (Result_31);
62
67
  /// Admins, localTest: an empty canister from the core's cycles joins the demo pool.
63
- createLocalPoolCanister: () -> (Result_20);
68
+ createLocalPoolCanister: () -> (Result_6);
64
69
  /// F-2 … F-4, F-10: the caller's own driver canister (localTest: from the core's cycles).
65
- createMyDriverCanister: () -> (Result_20);
70
+ createMyDriverCanister: () -> (Result_6);
66
71
  /// Admins: the simulator, created once (F-18).
67
- ensureSimulator: () -> (Result_28);
72
+ ensureSimulator: () -> (Result_30);
68
73
  /// F-8: 15 min more for the holder of a demo canister.
69
- extendDemoLease: () -> (Result_20);
70
- getAdmins: () -> (Result_27) query;
74
+ extendDemoLease: () -> (Result_6);
75
+ getAdmins: () -> (Result_29) query;
71
76
  /// For the fronts (through the package): where the chat of this environment is. Null =
72
77
  /// no chat here yet. The room of a driver is `ChatRoomFunctions.driverRoomId`.
73
78
  getChatConfig: () -> (opt ChatConfig) query;
74
79
  /// Admins: how far the driver rooms are (C-15).
75
- getChatRoomsStatus: () -> (Result_26) query;
80
+ getChatRoomsStatus: () -> (Result_28) query;
76
81
  /// WO-1, WO-2: what the core knows of a canister — for the workers and anybody.
77
82
  getDriverCanisterStatus: (args: CanisterArgs) ->
78
83
  (DriverCanisterStatus) query;
79
84
  /// Admins: the account of one driver canister (C-17 … C-20).
80
- getDriverFeeAccount: (args: CanisterArgs) -> (Result_25) query;
85
+ getDriverFeeAccount: (args: CanisterArgs) -> (Result_27) query;
81
86
  /// C-19: a driver canister of the registry asks for its bill — the events since its
82
87
  /// last settlement, priced on the fee's day. Called by the canister at its first
83
88
  /// "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;
89
+ getDriverFeeBill: () -> (Result_26);
90
+ /// Admins (stage 7): the aggregated rating of one driver (sum and count of stars; null =
91
+ /// no rating yet) — the value the workers get through the outbox (C-6).
92
+ getDriverRating: (args: DriverRatingArgs) -> (Result_22) query;
93
+ getDriverRollout: () -> (Result_25) query;
94
+ getFactoryStatus: () -> (Result_24) query;
87
95
  /// C-22: the rates, the day, the multiplier cached, the totals.
88
- getFeeStatus: () -> (Result_21) query;
96
+ getFeeStatus: () -> (Result_23) query;
89
97
  getLogs: () -> (text) query;
90
98
  /// The caller's own canister, or the demo canister the caller holds now.
91
- getMyDriverCanister: () -> (Result_20) query;
99
+ getMyDriverCanister: () -> (Result_6) query;
92
100
  getMyProfile: () -> (Result_4) query;
93
101
  /// C-16, PF-4: the caller's own rating as a rider (sum and count of stars; null = no
94
102
  /// 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;
103
+ getMyRating: () -> (Result_22) query;
104
+ /// C-8 (KU-4, stage 7): one line of the caller's history by its requestId — for the
105
+ /// details screen after a reload and to show the rating after `rateMyRide`. Another
106
+ /// rider's ride → `NotAuthorized`; not in the core (yet, K-9) → `NotFound`.
107
+ getMyRide: (args: RequestIdArgs) -> (Result_21) query;
108
+ /// C-8: the caller's rides, newest first, with the places (KU-4) and whether the driver
109
+ /// can still be rated (KU-5, C-23).
110
+ getMyRides: (args: RidesPageArgs) -> (Result_20) query;
98
111
  /// C-3: the names of up to MAX_PROFILES_PER_CALL principals; unknown ones are left out.
99
- getProfiles: (args: ProfilesArgs) -> (Result_17) query;
112
+ getProfiles: (args: ProfilesArgs) -> (Result_19) query;
100
113
  /// F-11: the driver wasms released so far, oldest first.
101
114
  getReleasedDriverWasms: () -> (vec ReleasedWasm) query;
102
115
  /// F-18: the simulator of this group; none in prod or before ensureSimulator.
103
116
  getSimulator: () -> (opt principal) query;
104
117
  /// Admins: the coordinator, the workers confirmed so far, the mode.
105
- getWiring: () -> (Result_16) query;
118
+ getWiring: () -> (Result_18) query;
106
119
  /// Admins: how far the outbox to the workers is (C-6, C-7).
107
- getWorkerOutbox: () -> (Result_15) query;
120
+ getWorkerOutbox: () -> (Result_17) query;
108
121
  /// Workers of the group: the core asks the coordinator once and remembers the worker,
109
122
  /// which then gets the network state through the outbox. A worker calls it once after
110
123
  /// its install. Answers true.
@@ -112,36 +125,45 @@ type TigiCore =
112
125
  /// Workers of the group: finished rides and ratings, at most MAX_RIDE_BATCH (C-4, C-5).
113
126
  /// Idempotent: a known requestId and a counted rating count once. Invalid entries are
114
127
  /// rejected and logged; the worker drops the whole batch after an ok.
115
- ingestRideBatch: (batch: RideBatch) -> (Result_14);
128
+ ingestRideBatch: (batch: RideBatch) -> (Result_16);
116
129
  /// C-14: the accounts gate of the chat (U-43). The chat core asks this group's
117
130
  /// coordinator WHERE (`accountsCanisterFor` → this core) and asks here: true = an
118
131
  /// account with a name exists for the principal and the rider is not blocked.
119
132
  isUser: ("principal": principal) -> (bool) query;
120
133
  /// F-5 … F-7: a demo canister for 15 min (outside prod). A fresh lease comes with a
121
134
  /// 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;
135
+ leaseDemoDriverCanister: () -> (Result_15);
136
+ listBlocks: (args: PageArgs) -> (Result_14) query;
137
+ listDriverCanisters: (args: PageArgs) -> (Result_13) query;
125
138
  /// Admins: the accounts, 100 a page at most.
126
- listDriverFeeAccounts: (args: PageArgs) -> (Result_10) query;
139
+ listDriverFeeAccounts: (args: PageArgs) -> (Result_12) query;
127
140
  /// Admins: the driver rooms as the core wants them, 100 a page at most.
128
- listDriverRooms: (args: PageArgs) -> (Result_9) query;
141
+ listDriverRooms: (args: PageArgs) -> (Result_11) query;
129
142
  /// F-20: a fresh claim code for the caller's running demo lease; the old one stops
130
143
  /// working.
131
- newClaimCode: () -> (Result_8);
144
+ newClaimCode: () -> (Result_10);
132
145
  /// C-20: the driver canister pays the bill of `day` with the cycles attached to this
133
146
  /// call. The core takes exactly the bill (the rest goes back), or nothing when less is
134
147
  /// attached (`FEE_SHORT`); a day paid already answers `accepted = 0`.
135
- payDriverFee: (args: FeePayArgs) -> (Result_7);
148
+ payDriverFee: (args: FeePayArgs) -> (Result_9);
149
+ /// C-23 (KU-5, stage 7): the rider rates the driver of a finished ride from the history.
150
+ /// Only the ride's rider; a completed ride within 24 h of its end (K-8); once per ride
151
+ /// over both paths — a live rating through the worker and this one count once together
152
+ /// (the first to reach the core). The driver's aggregate goes to the workers as a
153
+ /// batch's does (C-6). Counted in the caller's `#account` pool.
154
+ rateMyRide: (args: RateRideArgs) -> (Result_8);
136
155
  removeAdmin: (args: PrincipalArgs) -> (Result_2);
137
156
  resumeDriverRollout: () -> (Result_3);
138
157
  /// Admins: the chat of this environment — the chat group's coordinator and the project
139
158
  /// (whose admin and accounts field are this group's coordinator). Every call sends every
140
159
  /// driver room again (a new project, a chat group set up again).
141
- setChatConfig: (args: ChatConfig) -> (Result_6);
160
+ setChatConfig: (args: ChatConfig) -> (Result_7);
142
161
  /// Admins, localTest only: new claim codes live this long (the local check of an
143
162
  /// expired code). Heap only: an upgrade brings back 15 min.
144
163
  setClaimCodeTtl: (args: ClaimTtlArgs) -> (Result);
164
+ /// Admins (F-22, TIGI-DRIVER-MODES): the pool canister is installed again in the
165
+ /// automat mode, driven by `automat` — the simulator's router on the droplet.
166
+ setDemoDriverAutomat: (args: DemoAutomatArgs) -> (Result_6);
145
167
  /// Admins: the cycles per event (C-18).
146
168
  setFeeRates: (rates: FeeRates) -> (Result_5);
147
169
  setLoggingEnabled: (enabled: bool) -> (Result_2);
@@ -202,14 +224,30 @@ type RidesPageArgs =
202
224
  type RidesPage =
203
225
  record {
204
226
  nextBeforeIndex: opt nat;
205
- rides: vec RideEntry;
227
+ rides: vec RideView;
206
228
  };
207
- type RideEntry =
229
+ type RideView =
208
230
  record {
231
+ destination: opt Geo;
209
232
  driverCanister: principal;
210
233
  driverKey: text;
211
234
  end: RideEnd;
212
235
  endedAtNs: nat64;
236
+ myRating: opt nat8;
237
+ pickup: opt Geo;
238
+ price: opt Money;
239
+ ratable: opt bool;
240
+ requestId: text;
241
+ rider: principal;
242
+ };
243
+ type RideEntryIn =
244
+ record {
245
+ destination: opt Geo;
246
+ driverCanister: principal;
247
+ driverKey: text;
248
+ end: RideEnd;
249
+ endedAtNs: nat64;
250
+ pickup: opt Geo;
213
251
  price: opt Money;
214
252
  requestId: text;
215
253
  rider: principal;
@@ -230,28 +268,28 @@ type RideBatchResult =
230
268
  type RideBatch =
231
269
  record {
232
270
  ratings: vec RatingEntry;
233
- rides: vec RideEntry;
271
+ rides: vec RideEntryIn;
234
272
  usage: opt UsageBatch;
235
273
  };
236
274
  type Result_9 =
237
275
  variant {
238
276
  err: Error;
239
- ok: vec DriverRoomView;
277
+ ok: FeePaid;
240
278
  };
241
279
  type Result_8 =
242
280
  variant {
243
281
  err: Error;
244
- ok: ClaimCode;
282
+ ok: RateRideOutcome;
245
283
  };
246
284
  type Result_7 =
247
285
  variant {
248
286
  err: Error;
249
- ok: FeePaid;
287
+ ok: ChatConfig;
250
288
  };
251
289
  type Result_6 =
252
290
  variant {
253
291
  err: Error;
254
- ok: ChatConfig;
292
+ ok: DriverCanister;
255
293
  };
256
294
  type Result_5 =
257
295
  variant {
@@ -263,6 +301,21 @@ type Result_4 =
263
301
  err: Error;
264
302
  ok: Profile;
265
303
  };
304
+ type Result_32 =
305
+ variant {
306
+ err: Error;
307
+ ok: ChatSharesAck;
308
+ };
309
+ type Result_31 =
310
+ variant {
311
+ err: Error;
312
+ ok: WasmInfo;
313
+ };
314
+ type Result_30 =
315
+ variant {
316
+ err: Error;
317
+ ok: principal;
318
+ };
266
319
  type Result_3 =
267
320
  variant {
268
321
  err: Error;
@@ -271,52 +324,52 @@ type Result_3 =
271
324
  type Result_29 =
272
325
  variant {
273
326
  err: Error;
274
- ok: WasmInfo;
327
+ ok: vec principal;
275
328
  };
276
329
  type Result_28 =
277
330
  variant {
278
331
  err: Error;
279
- ok: principal;
332
+ ok: ChatRoomsStatus;
280
333
  };
281
334
  type Result_27 =
282
335
  variant {
283
336
  err: Error;
284
- ok: vec principal;
337
+ ok: DriverFeeAccountView;
285
338
  };
286
339
  type Result_26 =
287
340
  variant {
288
341
  err: Error;
289
- ok: ChatRoomsStatus;
342
+ ok: FeeBillAnswer;
290
343
  };
291
344
  type Result_25 =
292
345
  variant {
293
346
  err: Error;
294
- ok: DriverFeeAccountView;
347
+ ok: opt RolloutView;
295
348
  };
296
349
  type Result_24 =
297
350
  variant {
298
351
  err: Error;
299
- ok: FeeBill;
352
+ ok: FactoryStatus;
300
353
  };
301
354
  type Result_23 =
302
355
  variant {
303
356
  err: Error;
304
- ok: opt RolloutView;
357
+ ok: FeeStatus;
305
358
  };
306
359
  type Result_22 =
307
360
  variant {
308
361
  err: Error;
309
- ok: FactoryStatus;
362
+ ok: opt Rating;
310
363
  };
311
364
  type Result_21 =
312
365
  variant {
313
366
  err: Error;
314
- ok: FeeStatus;
367
+ ok: RideView;
315
368
  };
316
369
  type Result_20 =
317
370
  variant {
318
371
  err: Error;
319
- ok: DriverCanister;
372
+ ok: RidesPage;
320
373
  };
321
374
  type Result_2 =
322
375
  variant {
@@ -326,58 +379,58 @@ type Result_2 =
326
379
  type Result_19 =
327
380
  variant {
328
381
  err: Error;
329
- ok: opt Rating;
382
+ ok: vec ProfileEntry;
330
383
  };
331
384
  type Result_18 =
332
385
  variant {
333
386
  err: Error;
334
- ok: RidesPage;
387
+ ok: Wiring;
335
388
  };
336
389
  type Result_17 =
337
390
  variant {
338
391
  err: Error;
339
- ok: vec ProfileEntry;
392
+ ok:
393
+ record {
394
+ headSeq: nat64;
395
+ laggingWorkers: nat;
396
+ lastError: opt text;
397
+ subjects: nat;
398
+ };
340
399
  };
341
400
  type Result_16 =
342
401
  variant {
343
402
  err: Error;
344
- ok: Wiring;
403
+ ok: RideBatchResult;
345
404
  };
346
405
  type Result_15 =
347
406
  variant {
348
407
  err: Error;
349
- ok:
350
- record {
351
- headSeq: nat64;
352
- laggingWorkers: nat;
353
- lastError: opt text;
354
- subjects: nat;
355
- };
408
+ ok: LeaseAnswer;
356
409
  };
357
410
  type Result_14 =
358
411
  variant {
359
412
  err: Error;
360
- ok: RideBatchResult;
413
+ ok: vec Block;
361
414
  };
362
415
  type Result_13 =
363
416
  variant {
364
417
  err: Error;
365
- ok: LeaseAnswer;
418
+ ok: DriverCanistersPage;
366
419
  };
367
420
  type Result_12 =
368
421
  variant {
369
422
  err: Error;
370
- ok: vec Block;
423
+ ok: vec DriverFeeAccountView;
371
424
  };
372
425
  type Result_11 =
373
426
  variant {
374
427
  err: Error;
375
- ok: DriverCanistersPage;
428
+ ok: vec DriverRoomView;
376
429
  };
377
430
  type Result_10 =
378
431
  variant {
379
432
  err: Error;
380
- ok: vec DriverFeeAccountView;
433
+ ok: ClaimCode;
381
434
  };
382
435
  type Result_1 =
383
436
  variant {
@@ -389,6 +442,7 @@ type Result =
389
442
  err: Error;
390
443
  ok: nat;
391
444
  };
445
+ type RequestIdArgs = record {requestId: text;};
392
446
  type ReleasedWasm =
393
447
  record {
394
448
  releasedAtNs: int;
@@ -414,6 +468,17 @@ type Rating =
414
468
  count: nat;
415
469
  sum: nat;
416
470
  };
471
+ type RateRideOutcome =
472
+ variant {
473
+ alreadyRated;
474
+ notRatable: text;
475
+ rated;
476
+ };
477
+ type RateRideArgs =
478
+ record {
479
+ requestId: text;
480
+ stars: nat8;
481
+ };
417
482
  type ProfilesArgs = record {principals: vec principal;};
418
483
  type ProfileEntry =
419
484
  record {
@@ -467,6 +532,11 @@ type InitArgs =
467
532
  coordinator: opt principal;
468
533
  mode: Mode;
469
534
  };
535
+ type Geo =
536
+ record {
537
+ lat: float64;
538
+ lng: float64;
539
+ };
470
540
  type FeeUsage =
471
541
  record {
472
542
  quoteRequests: nat;
@@ -476,6 +546,12 @@ type FeeUsage =
476
546
  type FeeStatus =
477
547
  record {
478
548
  accounts: nat;
549
+ chat:
550
+ opt record {
551
+ absorbedTotal: nat;
552
+ addedTotal: nat;
553
+ lastBatchId: opt nat64;
554
+ };
479
555
  forwardedTotal: nat;
480
556
  lastForwardError: opt text;
481
557
  multiplier: opt record {
@@ -506,6 +582,16 @@ type FeePaid =
506
582
  amount: nat;
507
583
  day: nat;
508
584
  };
585
+ type FeeBillAnswer =
586
+ record {
587
+ amount: nat;
588
+ chat: opt nat;
589
+ day: nat;
590
+ multiplierPermille: nat;
591
+ rates: FeeRates;
592
+ settled: bool;
593
+ usage: FeeUsage;
594
+ };
509
595
  type FeeBill =
510
596
  record {
511
597
  amount: nat;
@@ -558,10 +644,16 @@ type DriverRoomView =
558
644
  roomId: text;
559
645
  synced: bool;
560
646
  };
647
+ type DriverRatingArgs =
648
+ record {
649
+ canister: principal;
650
+ driverKey: text;
651
+ };
561
652
  type DriverFeeAccountView =
562
653
  record {
563
654
  bill: opt FeeBill;
564
655
  canister: principal;
656
+ chat: opt ChatShareView;
565
657
  lastFee: opt FeeRecord;
566
658
  lastSettledDay: opt nat;
567
659
  paidTotal: nat;
@@ -594,6 +686,11 @@ type DriverCanister =
594
686
  moduleHash: opt blob;
595
687
  owner: principal;
596
688
  };
689
+ type DemoAutomatArgs =
690
+ record {
691
+ automat: principal;
692
+ canister: principal;
693
+ };
597
694
  type ClaimTtlArgs = record {seconds: nat;};
598
695
  type ClaimCode =
599
696
  record {
@@ -606,6 +703,34 @@ type ClaimArgs =
606
703
  canister: principal;
607
704
  code: text;
608
705
  };
706
+ type ChatSharesArgs =
707
+ record {
708
+ batchId: nat64;
709
+ day: nat64;
710
+ shares: vec ChatShare;
711
+ };
712
+ type ChatSharesAck =
713
+ record {
714
+ added: nat;
715
+ addedCycles: nat;
716
+ applied: bool;
717
+ exempt: nat;
718
+ exemptCycles: nat;
719
+ unknown: nat;
720
+ unknownCycles: nat;
721
+ };
722
+ type ChatShareView =
723
+ record {
724
+ inBill: nat;
725
+ lastDay: opt nat;
726
+ paidTotal: nat;
727
+ pending: nat;
728
+ };
729
+ type ChatShare =
730
+ record {
731
+ cycles: nat;
732
+ roomId: text;
733
+ };
609
734
  type ChatRoomsStatus =
610
735
  record {
611
736
  config: opt ChatConfig;