@jsm-mit/tigi-sharded-package 0.8.0 → 0.10.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
@@ -44,6 +44,9 @@ const again = await request.searchAgainAsyncUnsafe(); // a new request, th
44
44
  const ride = await request.getRideAsyncUnsafe(); // from the driver canister, every RIDE_POLL_MS (2 s)
45
45
  await request.getRideRouteAsyncUnsafe(); // K-13: the ride's line while it is active (once; undefined after the end)
46
46
  await request.cancelRideAsyncUnsafe(); // before inProgress, once
47
+ // P-20: card straight to the driver (Stripe) — when ride.cardAccepted, during inProgress:
48
+ const card = await request.startCardPaymentAsyncUnsafe(returnUrl); // open → go to card.url; the same page again while it stands
49
+ await request.checkCardPaymentAsyncUnsafe(); // back from Stripe (card=paid|cancelled in the URL); ride.cardPayment shows it too
47
50
  await request.getLicenceAsyncUnsafe(); // from accepted to the end of the ride
48
51
  await request.rateDriverAsyncUnsafe(5); // after completed, once
49
52
 
@@ -48,7 +48,7 @@ type TigiCore =
48
48
  /// joins the next daily bill of the room's OWN driver canister as it is (the chat priced
49
49
  /// it; no multiplier). A pool canister's share and a room of no canister of the registry
50
50
  /// are absorbed (the coordinator keeps paying them). Once per `batchId`.
51
- addChatShares: (args: ChatSharesArgs) -> (Result_32);
51
+ addChatShares: (args: ChatSharesArgs) -> (Result_34);
52
52
  /// Admins: a canister the core controls joins the demo pool (U-35).
53
53
  addPoolCanister: (args: CanisterArgs) -> (Result_6);
54
54
  /// Admins: a driver canister, or one driver in it (`driverKey`), is blocked; the workers
@@ -61,63 +61,68 @@ type TigiCore =
61
61
  /// answers the same NotAuthorized. The room of the canister gets the caller (C-15).
62
62
  claimDriverCanister: (args: ClaimArgs) -> (Result_6);
63
63
  clearLogs: () -> ();
64
+ /// Admins (F-24): the chunks become THE app; drivers' canisters take it at their "Aktualizuj".
65
+ commitDriverApk: (args: ApkCommitArgs) -> (Result_33);
64
66
  /// Admins: the chunks become THE module of their kind. A new driver wasm is released
65
67
  /// (F-11) and its hash goes to the workers.
66
- commitDriverWasm: (args: WasmCommitArgs) -> (Result_31);
68
+ commitDriverWasm: (args: WasmCommitArgs) -> (Result_32);
67
69
  /// Admins, localTest: an empty canister from the core's cycles joins the demo pool.
68
70
  createLocalPoolCanister: () -> (Result_6);
69
- /// F-2 … F-4, F-10: the caller's own driver canister (localTest: from the core's cycles).
70
71
  createMyDriverCanister: () -> (Result_6);
71
72
  /// Admins: the simulator, created once (F-18).
72
- ensureSimulator: () -> (Result_30);
73
+ ensureSimulator: () -> (Result_31);
73
74
  /// F-8: 15 min more for the holder of a demo canister.
74
75
  extendDemoLease: () -> (Result_6);
75
- getAdmins: () -> (Result_29) query;
76
+ getAdmins: () -> (Result_30) query;
76
77
  /// For the fronts (through the package): where the chat of this environment is. Null =
77
78
  /// no chat here yet. The room of a driver is `ChatRoomFunctions.driverRoomId`.
78
79
  getChatConfig: () -> (opt ChatConfig) query;
79
80
  /// Admins: how far the driver rooms are (C-15).
80
- getChatRoomsStatus: () -> (Result_28) query;
81
+ getChatRoomsStatus: () -> (Result_29) query;
82
+ /// F-24 (public): the current app — what a driver canister compares its own with.
83
+ getDriverApk: () -> (opt ApkInfo) query;
84
+ /// F-24 (public): one chunk of the current app; a driver canister reads them in order.
85
+ getDriverApkChunk: (index: nat32) -> (opt blob) query;
81
86
  /// WO-1, WO-2: what the core knows of a canister — for the workers and anybody.
82
87
  getDriverCanisterStatus: (args: CanisterArgs) ->
83
88
  (DriverCanisterStatus) query;
84
89
  /// Admins: the account of one driver canister (C-17 … C-20).
85
- getDriverFeeAccount: (args: CanisterArgs) -> (Result_27) query;
90
+ getDriverFeeAccount: (args: CanisterArgs) -> (Result_28) query;
86
91
  /// C-19: a driver canister of the registry asks for its bill — the events since its
87
92
  /// last settlement, priced on the fee's day. Called by the canister at its first
88
93
  /// "Przyjmuję zlecenia" of a day. A pool canister owes nothing (C-18).
89
- getDriverFeeBill: () -> (Result_26);
94
+ getDriverFeeBill: () -> (Result_27);
90
95
  /// Admins (stage 7): the aggregated rating of one driver (sum and count of stars; null =
91
96
  /// 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;
97
+ getDriverRating: (args: DriverRatingArgs) -> (Result_23) query;
98
+ getDriverRollout: () -> (Result_26) query;
99
+ getFactoryStatus: () -> (Result_25) query;
95
100
  /// C-22: the rates, the day, the multiplier cached, the totals.
96
- getFeeStatus: () -> (Result_23) query;
101
+ getFeeStatus: () -> (Result_24) query;
97
102
  getLogs: () -> (text) query;
98
103
  /// The caller's own canister, or the demo canister the caller holds now.
99
104
  getMyDriverCanister: () -> (Result_6) query;
100
105
  getMyProfile: () -> (Result_4) query;
101
106
  /// C-16, PF-4: the caller's own rating as a rider (sum and count of stars; null = no
102
107
  /// rating yet). Ratings reach the core in the workers' batches, up to a minute late.
103
- getMyRating: () -> (Result_22) query;
108
+ getMyRating: () -> (Result_23) query;
104
109
  /// C-8 (KU-4, stage 7): one line of the caller's history by its requestId — for the
105
110
  /// details screen after a reload and to show the rating after `rateMyRide`. Another
106
111
  /// rider's ride → `NotAuthorized`; not in the core (yet, K-9) → `NotFound`.
107
- getMyRide: (args: RequestIdArgs) -> (Result_21) query;
112
+ getMyRide: (args: RequestIdArgs) -> (Result_22) query;
108
113
  /// C-8: the caller's rides, newest first, with the places (KU-4) and whether the driver
109
114
  /// can still be rated (KU-5, C-23).
110
- getMyRides: (args: RidesPageArgs) -> (Result_20) query;
115
+ getMyRides: (args: RidesPageArgs) -> (Result_21) query;
111
116
  /// C-3: the names of up to MAX_PROFILES_PER_CALL principals; unknown ones are left out.
112
- getProfiles: (args: ProfilesArgs) -> (Result_19) query;
117
+ getProfiles: (args: ProfilesArgs) -> (Result_20) query;
113
118
  /// F-11: the driver wasms released so far, oldest first.
114
119
  getReleasedDriverWasms: () -> (vec ReleasedWasm) query;
115
120
  /// F-18: the simulator of this group; none in prod or before ensureSimulator.
116
121
  getSimulator: () -> (opt principal) query;
117
122
  /// Admins: the coordinator, the workers confirmed so far, the mode.
118
- getWiring: () -> (Result_18) query;
123
+ getWiring: () -> (Result_19) query;
119
124
  /// Admins: how far the outbox to the workers is (C-6, C-7).
120
- getWorkerOutbox: () -> (Result_17) query;
125
+ getWorkerOutbox: () -> (Result_18) query;
121
126
  /// Workers of the group: the core asks the coordinator once and remembers the worker,
122
127
  /// which then gets the network state through the outbox. A worker calls it once after
123
128
  /// its install. Answers true.
@@ -125,27 +130,30 @@ type TigiCore =
125
130
  /// Workers of the group: finished rides and ratings, at most MAX_RIDE_BATCH (C-4, C-5).
126
131
  /// Idempotent: a known requestId and a counted rating count once. Invalid entries are
127
132
  /// rejected and logged; the worker drops the whole batch after an ok.
128
- ingestRideBatch: (batch: RideBatch) -> (Result_16);
133
+ ingestRideBatch: (batch: RideBatch) -> (Result_17);
129
134
  /// C-14: the accounts gate of the chat (U-43). The chat core asks this group's
130
135
  /// coordinator WHERE (`accountsCanisterFor` → this core) and asks here: true = an
131
136
  /// account with a name exists for the principal and the rider is not blocked.
132
137
  isUser: ("principal": principal) -> (bool) query;
133
138
  /// F-5 … F-7: a demo canister for 15 min (outside prod). A fresh lease comes with a
134
139
  /// one-time claim code (F-20, U-45).
135
- leaseDemoDriverCanister: () -> (Result_15);
136
- listBlocks: (args: PageArgs) -> (Result_14) query;
137
- listDriverCanisters: (args: PageArgs) -> (Result_13) query;
140
+ leaseDemoDriverCanister: () -> (Result_16);
141
+ listBlocks: (args: PageArgs) -> (Result_15) query;
142
+ listDriverCanisters: (args: PageArgs) -> (Result_14) query;
138
143
  /// Admins: the accounts, 100 a page at most.
139
- listDriverFeeAccounts: (args: PageArgs) -> (Result_12) query;
144
+ listDriverFeeAccounts: (args: PageArgs) -> (Result_13) query;
140
145
  /// Admins: the driver rooms as the core wants them, 100 a page at most.
141
- listDriverRooms: (args: PageArgs) -> (Result_11) query;
146
+ listDriverRooms: (args: PageArgs) -> (Result_12) query;
142
147
  /// F-20: a fresh claim code for the caller's running demo lease; the old one stops
143
148
  /// working.
144
- newClaimCode: () -> (Result_10);
149
+ newClaimCode: () -> (Result_11);
145
150
  /// C-20: the driver canister pays the bill of `day` with the cycles attached to this
146
151
  /// call. The core takes exactly the bill (the rest goes back), or nothing when less is
147
152
  /// attached (`FEE_SHORT`); a day paid already answers `accepted = 0`.
148
- payDriverFee: (args: FeePayArgs) -> (Result_9);
153
+ payDriverFee: (args: FeePayArgs) -> (Result_10);
154
+ /// F-2 … F-4, F-10: the caller's own driver canister (localTest: from the core's cycles).
155
+ /// F-1 (user 2026-10-31): what a driver canister costs now and the caller's account to pay to.
156
+ quoteMyDriverCanister: () -> (Result_9);
149
157
  /// C-23 (KU-5, stage 7): the rider rates the driver of a finished ride from the history.
150
158
  /// Only the ride's rider; a completed ride within 24 h of its end (K-8); once per ride
151
159
  /// over both paths — a live rating through the worker and this one count once together
@@ -184,6 +192,8 @@ type TigiCore =
184
192
  unblockRider: (args: UnblockRiderArgs) -> (Result_2);
185
193
  /// Admins: the simulator gets the current simulator wasm (stop → upgrade → start).
186
194
  upgradeSimulator: () -> (Result_1);
195
+ /// Admins (F-24): one chunk of a new Android app.
196
+ uploadDriverApkChunk: (args: ApkChunkArgs) -> (Result);
187
197
  /// Admins: one chunk of a new driver or simulator module (gzipped: ~0.7 MB).
188
198
  uploadDriverWasmChunk: (args: WasmChunkArgs) -> (Result);
189
199
  };
@@ -274,7 +284,7 @@ type RideBatch =
274
284
  type Result_9 =
275
285
  variant {
276
286
  err: Error;
277
- ok: FeePaid;
287
+ ok: DriverCanisterQuote;
278
288
  };
279
289
  type Result_8 =
280
290
  variant {
@@ -301,21 +311,31 @@ type Result_4 =
301
311
  err: Error;
302
312
  ok: Profile;
303
313
  };
304
- type Result_32 =
314
+ type Result_34 =
305
315
  variant {
306
316
  err: Error;
307
317
  ok: ChatSharesAck;
308
318
  };
309
- type Result_31 =
319
+ type Result_33 =
320
+ variant {
321
+ err: Error;
322
+ ok: ApkInfo;
323
+ };
324
+ type Result_32 =
310
325
  variant {
311
326
  err: Error;
312
327
  ok: WasmInfo;
313
328
  };
314
- type Result_30 =
329
+ type Result_31 =
315
330
  variant {
316
331
  err: Error;
317
332
  ok: principal;
318
333
  };
334
+ type Result_30 =
335
+ variant {
336
+ err: Error;
337
+ ok: vec principal;
338
+ };
319
339
  type Result_3 =
320
340
  variant {
321
341
  err: Error;
@@ -324,52 +344,52 @@ type Result_3 =
324
344
  type Result_29 =
325
345
  variant {
326
346
  err: Error;
327
- ok: vec principal;
347
+ ok: ChatRoomsStatus;
328
348
  };
329
349
  type Result_28 =
330
350
  variant {
331
351
  err: Error;
332
- ok: ChatRoomsStatus;
352
+ ok: DriverFeeAccountView;
333
353
  };
334
354
  type Result_27 =
335
355
  variant {
336
356
  err: Error;
337
- ok: DriverFeeAccountView;
357
+ ok: FeeBillAnswer;
338
358
  };
339
359
  type Result_26 =
340
360
  variant {
341
361
  err: Error;
342
- ok: FeeBillAnswer;
362
+ ok: opt RolloutView;
343
363
  };
344
364
  type Result_25 =
345
365
  variant {
346
366
  err: Error;
347
- ok: opt RolloutView;
367
+ ok: FactoryStatus;
348
368
  };
349
369
  type Result_24 =
350
370
  variant {
351
371
  err: Error;
352
- ok: FactoryStatus;
372
+ ok: FeeStatus;
353
373
  };
354
374
  type Result_23 =
355
375
  variant {
356
376
  err: Error;
357
- ok: FeeStatus;
377
+ ok: opt Rating;
358
378
  };
359
379
  type Result_22 =
360
380
  variant {
361
381
  err: Error;
362
- ok: opt Rating;
382
+ ok: RideView;
363
383
  };
364
384
  type Result_21 =
365
385
  variant {
366
386
  err: Error;
367
- ok: RideView;
387
+ ok: RidesPage;
368
388
  };
369
389
  type Result_20 =
370
390
  variant {
371
391
  err: Error;
372
- ok: RidesPage;
392
+ ok: vec ProfileEntry;
373
393
  };
374
394
  type Result_2 =
375
395
  variant {
@@ -377,16 +397,11 @@ type Result_2 =
377
397
  ok: bool;
378
398
  };
379
399
  type Result_19 =
380
- variant {
381
- err: Error;
382
- ok: vec ProfileEntry;
383
- };
384
- type Result_18 =
385
400
  variant {
386
401
  err: Error;
387
402
  ok: Wiring;
388
403
  };
389
- type Result_17 =
404
+ type Result_18 =
390
405
  variant {
391
406
  err: Error;
392
407
  ok:
@@ -397,41 +412,46 @@ type Result_17 =
397
412
  subjects: nat;
398
413
  };
399
414
  };
400
- type Result_16 =
415
+ type Result_17 =
401
416
  variant {
402
417
  err: Error;
403
418
  ok: RideBatchResult;
404
419
  };
405
- type Result_15 =
420
+ type Result_16 =
406
421
  variant {
407
422
  err: Error;
408
423
  ok: LeaseAnswer;
409
424
  };
410
- type Result_14 =
425
+ type Result_15 =
411
426
  variant {
412
427
  err: Error;
413
428
  ok: vec Block;
414
429
  };
415
- type Result_13 =
430
+ type Result_14 =
416
431
  variant {
417
432
  err: Error;
418
433
  ok: DriverCanistersPage;
419
434
  };
420
- type Result_12 =
435
+ type Result_13 =
421
436
  variant {
422
437
  err: Error;
423
438
  ok: vec DriverFeeAccountView;
424
439
  };
425
- type Result_11 =
440
+ type Result_12 =
426
441
  variant {
427
442
  err: Error;
428
443
  ok: vec DriverRoomView;
429
444
  };
430
- type Result_10 =
445
+ type Result_11 =
431
446
  variant {
432
447
  err: Error;
433
448
  ok: ClaimCode;
434
449
  };
450
+ type Result_10 =
451
+ variant {
452
+ err: Error;
453
+ ok: FeePaid;
454
+ };
435
455
  type Result_1 =
436
456
  variant {
437
457
  err: Error;
@@ -670,6 +690,15 @@ type DriverCanisterStatus =
670
690
  moduleHash: opt blob;
671
691
  registered: bool;
672
692
  };
693
+ type DriverCanisterQuote =
694
+ record {
695
+ accountId: blob;
696
+ balanceE8s: nat;
697
+ minimumE8s: nat;
698
+ priceCycles: nat;
699
+ suggestedE8s: nat;
700
+ xdrPermyriadPerIcp: nat;
701
+ };
673
702
  type DriverCanisterKind =
674
703
  variant {
675
704
  own;
@@ -773,4 +802,25 @@ type Block =
773
802
  reason: text;
774
803
  target: BlockTarget;
775
804
  };
805
+ type ApkInfo =
806
+ record {
807
+ chunks: nat32;
808
+ committedAtNs: int;
809
+ sha256: blob;
810
+ size: nat;
811
+ versionCode: nat32;
812
+ versionName: text;
813
+ };
814
+ type ApkCommitArgs =
815
+ record {
816
+ chunks: nat32;
817
+ sha256: blob;
818
+ versionCode: nat32;
819
+ versionName: text;
820
+ };
821
+ type ApkChunkArgs =
822
+ record {
823
+ bytes: blob;
824
+ index: nat32;
825
+ };
776
826
  service : (init: InitArgs) -> TigiCore