@jsm-mit/tigi-sharded-package 0.3.0 → 0.4.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 (34) hide show
  1. package/README.md +7 -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 +170 -45
  6. package/declarations/core/core.did.d.ts +155 -44
  7. package/declarations/core/core.did.js +122 -43
  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/rides-actor.d.ts +21 -1
  18. package/dist/actors/rides-actor.d.ts.map +1 -1
  19. package/dist/actors/rides-actor.js +44 -2
  20. package/dist/geo.d.ts +5 -0
  21. package/dist/geo.d.ts.map +1 -1
  22. package/dist/geo.js +41 -0
  23. package/dist/group/canister-actor.d.ts +7 -0
  24. package/dist/group/canister-actor.d.ts.map +1 -1
  25. package/dist/group/canister-actor.js +18 -0
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +2 -2
  29. package/dist/interfaces.d.ts +15 -1
  30. package/dist/interfaces.d.ts.map +1 -1
  31. package/dist/mappers.d.ts +7 -2
  32. package/dist/mappers.d.ts.map +1 -1
  33. package/dist/mappers.js +17 -2
  34. package/package.json +5 -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_20);
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,57 @@ 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_20);
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_29);
57
62
  /// Admins, localTest: an empty canister from the core's cycles joins the demo pool.
58
- createLocalPoolCanister: () -> (Result_17);
63
+ createLocalPoolCanister: () -> (Result_20);
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_20);
61
66
  /// Admins: the simulator, created once (F-18).
62
- ensureSimulator: () -> (Result_22);
67
+ ensureSimulator: () -> (Result_28);
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_20);
70
+ getAdmins: () -> (Result_27) 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_26) 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_25) 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_24);
85
+ getDriverRollout: () -> (Result_23) query;
86
+ getFactoryStatus: () -> (Result_22) query;
87
+ /// C-22: the rates, the day, the multiplier cached, the totals.
88
+ getFeeStatus: () -> (Result_21) query;
76
89
  getLogs: () -> (text) query;
77
90
  /// The caller's own canister, or the demo canister the caller holds now.
78
- getMyDriverCanister: () -> (Result_17) query;
91
+ getMyDriverCanister: () -> (Result_20) query;
79
92
  getMyProfile: () -> (Result_4) query;
80
93
  /// C-16, PF-4: the caller's own rating as a rider (sum and count of stars; null = no
81
94
  /// rating yet). Ratings reach the core in the workers' batches, up to a minute late.
82
- getMyRating: () -> (Result_16) query;
95
+ getMyRating: () -> (Result_19) query;
83
96
  /// C-8: the caller's rides, newest first.
84
- getMyRides: (args: RidesPageArgs) -> (Result_15) query;
97
+ getMyRides: (args: RidesPageArgs) -> (Result_18) query;
85
98
  /// C-3: the names of up to MAX_PROFILES_PER_CALL principals; unknown ones are left out.
86
- getProfiles: (args: ProfilesArgs) -> (Result_14) query;
99
+ getProfiles: (args: ProfilesArgs) -> (Result_17) query;
87
100
  /// F-11: the driver wasms released so far, oldest first.
88
101
  getReleasedDriverWasms: () -> (vec ReleasedWasm) query;
89
102
  /// F-18: the simulator of this group; none in prod or before ensureSimulator.
90
103
  getSimulator: () -> (opt principal) query;
91
104
  /// Admins: the coordinator, the workers confirmed so far, the mode.
92
- getWiring: () -> (Result_13) query;
105
+ getWiring: () -> (Result_16) query;
93
106
  /// Admins: how far the outbox to the workers is (C-6, C-7).
94
- getWorkerOutbox: () -> (Result_12) query;
107
+ getWorkerOutbox: () -> (Result_15) query;
95
108
  /// Workers of the group: the core asks the coordinator once and remembers the worker,
96
109
  /// which then gets the network state through the outbox. A worker calls it once after
97
110
  /// its install. Answers true.
@@ -99,34 +112,49 @@ type TigiCore =
99
112
  /// Workers of the group: finished rides and ratings, at most MAX_RIDE_BATCH (C-4, C-5).
100
113
  /// Idempotent: a known requestId and a counted rating count once. Invalid entries are
101
114
  /// rejected and logged; the worker drops the whole batch after an ok.
102
- ingestRideBatch: (batch: RideBatch) -> (Result_11);
115
+ ingestRideBatch: (batch: RideBatch) -> (Result_14);
103
116
  /// C-14: the accounts gate of the chat (U-43). The chat core asks this group's
104
117
  /// coordinator WHERE (`accountsCanisterFor` → this core) and asks here: true = an
105
118
  /// account with a name exists for the principal and the rider is not blocked.
106
119
  isUser: ("principal": principal) -> (bool) query;
107
120
  /// F-5 … F-7: a demo canister for 15 min (outside prod). A fresh lease comes with a
108
121
  /// 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;
122
+ leaseDemoDriverCanister: () -> (Result_13);
123
+ listBlocks: (args: PageArgs) -> (Result_12) query;
124
+ listDriverCanisters: (args: PageArgs) -> (Result_11) query;
125
+ /// Admins: the accounts, 100 a page at most.
126
+ listDriverFeeAccounts: (args: PageArgs) -> (Result_10) query;
112
127
  /// Admins: the driver rooms as the core wants them, 100 a page at most.
113
- listDriverRooms: (args: PageArgs) -> (Result_7) query;
128
+ listDriverRooms: (args: PageArgs) -> (Result_9) query;
114
129
  /// F-20: a fresh claim code for the caller's running demo lease; the old one stops
115
130
  /// working.
116
- newClaimCode: () -> (Result_6);
131
+ newClaimCode: () -> (Result_8);
132
+ /// C-20: the driver canister pays the bill of `day` with the cycles attached to this
133
+ /// call. The core takes exactly the bill (the rest goes back), or nothing when less is
134
+ /// attached (`FEE_SHORT`); a day paid already answers `accepted = 0`.
135
+ payDriverFee: (args: FeePayArgs) -> (Result_7);
117
136
  removeAdmin: (args: PrincipalArgs) -> (Result_2);
118
137
  resumeDriverRollout: () -> (Result_3);
119
138
  /// Admins: the chat of this environment — the chat group's coordinator and the project
120
139
  /// (whose admin and accounts field are this group's coordinator). Every call sends every
121
140
  /// driver room again (a new project, a chat group set up again).
122
- setChatConfig: (args: ChatConfig) -> (Result_5);
141
+ setChatConfig: (args: ChatConfig) -> (Result_6);
123
142
  /// Admins, localTest only: new claim codes live this long (the local check of an
124
143
  /// expired code). Heap only: an upgrade brings back 15 min.
125
144
  setClaimCodeTtl: (args: ClaimTtlArgs) -> (Result);
145
+ /// Admins: the cycles per event (C-18).
146
+ setFeeRates: (rates: FeeRates) -> (Result_5);
126
147
  setLoggingEnabled: (enabled: bool) -> (Result_2);
127
148
  /// The coordinator only: the balance below which the core asks for cycles.
128
149
  setLowCyclesBelow: (value: nat) -> (Result_2);
129
150
  setMyProfile: (args: SetProfileArgs) -> (Result_4);
151
+ /// F-21 (2026-10-24, route line): admins — the one principal that routes the simulator's
152
+ /// quotes (S-N13, a Node process like a driver's front); null removes it. The simulator
153
+ /// takes it from the core only.
154
+ setSimulatorRouter: (args: SimulatorRouterArgs) -> (Result_2);
155
+ /// Admins, localTest only: the fee's day moves this many days on (the local check of
156
+ /// "the next day"). Heap only: an upgrade brings back the real day.
157
+ setTestDayOffset: (args: TestDayArgs) -> (Result);
130
158
  /// Admins: a rollout of the current driver wasm (F-12): the canary, then the rest, one
131
159
  /// canister a step, never during a ride (F-13).
132
160
  startDriverRollout: () -> (Result_3);
@@ -137,6 +165,8 @@ type TigiCore =
137
165
  /// Admins: one chunk of a new driver or simulator module (gzipped: ~0.7 MB).
138
166
  uploadDriverWasmChunk: (args: WasmChunkArgs) -> (Result);
139
167
  };
168
+ type TestDayArgs = record {days: nat;};
169
+ type SimulatorRouterArgs = record {router: opt principal;};
140
170
  type SetProfileArgs = record {name: text;};
141
171
  type RolloutView =
142
172
  record {
@@ -201,31 +231,32 @@ type RideBatch =
201
231
  record {
202
232
  ratings: vec RatingEntry;
203
233
  rides: vec RideEntry;
234
+ usage: opt UsageBatch;
204
235
  };
205
236
  type Result_9 =
206
237
  variant {
207
238
  err: Error;
208
- ok: vec Block;
239
+ ok: vec DriverRoomView;
209
240
  };
210
241
  type Result_8 =
211
242
  variant {
212
243
  err: Error;
213
- ok: DriverCanistersPage;
244
+ ok: ClaimCode;
214
245
  };
215
246
  type Result_7 =
216
247
  variant {
217
248
  err: Error;
218
- ok: vec DriverRoomView;
249
+ ok: FeePaid;
219
250
  };
220
251
  type Result_6 =
221
252
  variant {
222
253
  err: Error;
223
- ok: ClaimCode;
254
+ ok: ChatConfig;
224
255
  };
225
256
  type Result_5 =
226
257
  variant {
227
258
  err: Error;
228
- ok: ChatConfig;
259
+ ok: FeeRates;
229
260
  };
230
261
  type Result_4 =
231
262
  variant {
@@ -237,67 +268,82 @@ type Result_3 =
237
268
  err: Error;
238
269
  ok: RolloutView;
239
270
  };
240
- type Result_23 =
271
+ type Result_29 =
241
272
  variant {
242
273
  err: Error;
243
274
  ok: WasmInfo;
244
275
  };
245
- type Result_22 =
276
+ type Result_28 =
246
277
  variant {
247
278
  err: Error;
248
279
  ok: principal;
249
280
  };
250
- type Result_21 =
281
+ type Result_27 =
251
282
  variant {
252
283
  err: Error;
253
284
  ok: vec principal;
254
285
  };
255
- type Result_20 =
286
+ type Result_26 =
256
287
  variant {
257
288
  err: Error;
258
289
  ok: ChatRoomsStatus;
259
290
  };
260
- type Result_2 =
291
+ type Result_25 =
261
292
  variant {
262
293
  err: Error;
263
- ok: bool;
294
+ ok: DriverFeeAccountView;
264
295
  };
265
- type Result_19 =
296
+ type Result_24 =
297
+ variant {
298
+ err: Error;
299
+ ok: FeeBill;
300
+ };
301
+ type Result_23 =
266
302
  variant {
267
303
  err: Error;
268
304
  ok: opt RolloutView;
269
305
  };
270
- type Result_18 =
306
+ type Result_22 =
271
307
  variant {
272
308
  err: Error;
273
309
  ok: FactoryStatus;
274
310
  };
275
- type Result_17 =
311
+ type Result_21 =
312
+ variant {
313
+ err: Error;
314
+ ok: FeeStatus;
315
+ };
316
+ type Result_20 =
276
317
  variant {
277
318
  err: Error;
278
319
  ok: DriverCanister;
279
320
  };
280
- type Result_16 =
321
+ type Result_2 =
322
+ variant {
323
+ err: Error;
324
+ ok: bool;
325
+ };
326
+ type Result_19 =
281
327
  variant {
282
328
  err: Error;
283
329
  ok: opt Rating;
284
330
  };
285
- type Result_15 =
331
+ type Result_18 =
286
332
  variant {
287
333
  err: Error;
288
334
  ok: RidesPage;
289
335
  };
290
- type Result_14 =
336
+ type Result_17 =
291
337
  variant {
292
338
  err: Error;
293
339
  ok: vec ProfileEntry;
294
340
  };
295
- type Result_13 =
341
+ type Result_16 =
296
342
  variant {
297
343
  err: Error;
298
344
  ok: Wiring;
299
345
  };
300
- type Result_12 =
346
+ type Result_15 =
301
347
  variant {
302
348
  err: Error;
303
349
  ok:
@@ -308,16 +354,31 @@ type Result_12 =
308
354
  subjects: nat;
309
355
  };
310
356
  };
311
- type Result_11 =
357
+ type Result_14 =
312
358
  variant {
313
359
  err: Error;
314
360
  ok: RideBatchResult;
315
361
  };
316
- type Result_10 =
362
+ type Result_13 =
317
363
  variant {
318
364
  err: Error;
319
365
  ok: LeaseAnswer;
320
366
  };
367
+ type Result_12 =
368
+ variant {
369
+ err: Error;
370
+ ok: vec Block;
371
+ };
372
+ type Result_11 =
373
+ variant {
374
+ err: Error;
375
+ ok: DriverCanistersPage;
376
+ };
377
+ type Result_10 =
378
+ variant {
379
+ err: Error;
380
+ ok: vec DriverFeeAccountView;
381
+ };
321
382
  type Result_1 =
322
383
  variant {
323
384
  err: Error;
@@ -406,6 +467,54 @@ type InitArgs =
406
467
  coordinator: opt principal;
407
468
  mode: Mode;
408
469
  };
470
+ type FeeUsage =
471
+ record {
472
+ quoteRequests: nat;
473
+ registrations: nat;
474
+ rides: nat;
475
+ };
476
+ type FeeStatus =
477
+ record {
478
+ accounts: nat;
479
+ forwardedTotal: nat;
480
+ lastForwardError: opt text;
481
+ multiplier: opt record {
482
+ day: nat;
483
+ permille: nat;
484
+ };
485
+ paidTotal: nat;
486
+ rates: FeeRates;
487
+ toForward: nat;
488
+ today: nat;
489
+ };
490
+ type FeeRecord =
491
+ record {
492
+ amount: nat;
493
+ day: nat;
494
+ paidAtNs: int;
495
+ };
496
+ type FeeRates =
497
+ record {
498
+ perQuoteRequest: nat;
499
+ perRegistration: nat;
500
+ perRide: nat;
501
+ };
502
+ type FeePayArgs = record {day: nat;};
503
+ type FeePaid =
504
+ record {
505
+ accepted: nat;
506
+ amount: nat;
507
+ day: nat;
508
+ };
509
+ type FeeBill =
510
+ record {
511
+ amount: nat;
512
+ day: nat;
513
+ multiplierPermille: nat;
514
+ rates: FeeRates;
515
+ settled: bool;
516
+ usage: FeeUsage;
517
+ };
409
518
  type FactoryStatus =
410
519
  record {
411
520
  creationsInProgress: nat;
@@ -433,6 +542,13 @@ type Error =
433
542
  details: ErrorDetails;
434
543
  logsJson: text;
435
544
  };
545
+ type DriverUsage =
546
+ record {
547
+ canister: principal;
548
+ quoteRequests: nat;
549
+ registrations: nat;
550
+ rides: nat;
551
+ };
436
552
  type DriverRoomView =
437
553
  record {
438
554
  canister: principal;
@@ -442,6 +558,15 @@ type DriverRoomView =
442
558
  roomId: text;
443
559
  synced: bool;
444
560
  };
561
+ type DriverFeeAccountView =
562
+ record {
563
+ bill: opt FeeBill;
564
+ canister: principal;
565
+ lastFee: opt FeeRecord;
566
+ lastSettledDay: opt nat;
567
+ paidTotal: nat;
568
+ pending: FeeUsage;
569
+ };
445
570
  type DriverCanistersPage =
446
571
  record {
447
572
  canisters: vec DriverCanister;