@jsm-mit/tigi-sharded-package 0.2.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 (37) hide show
  1. package/README.md +51 -3
  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 +210 -45
  6. package/declarations/core/core.did.d.ts +191 -43
  7. package/declarations/core/core.did.js +146 -42
  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/driver-canisters-actor.d.ts +77 -0
  18. package/dist/actors/driver-canisters-actor.d.ts.map +1 -0
  19. package/dist/actors/driver-canisters-actor.js +147 -0
  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 +44 -2
  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 +3 -2
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +5 -2
  32. package/dist/interfaces.d.ts +43 -1
  33. package/dist/interfaces.d.ts.map +1 -1
  34. package/dist/mappers.d.ts +7 -2
  35. package/dist/mappers.d.ts.map +1 -1
  36. package/dist/mappers.js +17 -2
  37. package/package.json +7 -4
@@ -30,6 +30,13 @@ export interface ChatRoomsStatus {
30
30
  'pendingSinceNs' : [] | [bigint],
31
31
  'rooms' : bigint,
32
32
  }
33
+ export interface ClaimArgs { 'code' : string, 'canister' : Principal }
34
+ export interface ClaimCode {
35
+ 'expiresAtNs' : bigint,
36
+ 'code' : string,
37
+ 'canister' : Principal,
38
+ }
39
+ export interface ClaimTtlArgs { 'seconds' : bigint }
33
40
  export interface DriverCanister {
34
41
  'moduleHash' : [] | [Uint8Array | number[]],
35
42
  'owner' : Principal,
@@ -51,6 +58,14 @@ export interface DriverCanistersPage {
51
58
  'total' : bigint,
52
59
  'canisters' : Array<DriverCanister>,
53
60
  }
61
+ export interface DriverFeeAccountView {
62
+ 'pending' : FeeUsage,
63
+ 'bill' : [] | [FeeBill],
64
+ 'lastSettledDay' : [] | [bigint],
65
+ 'canister' : Principal,
66
+ 'paidTotal' : bigint,
67
+ 'lastFee' : [] | [FeeRecord],
68
+ }
54
69
  export interface DriverRoomView {
55
70
  'recipient' : Principal,
56
71
  'driverKey' : string,
@@ -59,6 +74,12 @@ export interface DriverRoomView {
59
74
  'roomId' : string,
60
75
  'synced' : boolean,
61
76
  }
77
+ export interface DriverUsage {
78
+ 'quoteRequests' : bigint,
79
+ 'canister' : Principal,
80
+ 'registrations' : bigint,
81
+ 'rides' : bigint,
82
+ }
62
83
  export interface Error { 'details' : ErrorDetails, 'logsJson' : string }
63
84
  export type ErrorDetails = { 'InterCanisterConnectionError' : null } |
64
85
  { 'RemoteCanisterError' : string } |
@@ -78,13 +99,63 @@ export interface FactoryStatus {
78
99
  'driverWasm' : [] | [WasmInfo],
79
100
  'registered' : bigint,
80
101
  }
102
+ export interface FeeBill {
103
+ 'day' : bigint,
104
+ 'settled' : boolean,
105
+ 'usage' : FeeUsage,
106
+ 'amount' : bigint,
107
+ 'multiplierPermille' : bigint,
108
+ 'rates' : FeeRates,
109
+ }
110
+ export interface FeePaid {
111
+ 'day' : bigint,
112
+ 'accepted' : bigint,
113
+ 'amount' : bigint,
114
+ }
115
+ export interface FeePayArgs { 'day' : bigint }
116
+ export interface FeeRates {
117
+ 'perRegistration' : bigint,
118
+ 'perQuoteRequest' : bigint,
119
+ 'perRide' : bigint,
120
+ }
121
+ export interface FeeRecord {
122
+ 'day' : bigint,
123
+ 'paidAtNs' : bigint,
124
+ 'amount' : bigint,
125
+ }
126
+ export interface FeeStatus {
127
+ 'multiplier' : [] | [{ 'day' : bigint, 'permille' : bigint }],
128
+ 'today' : bigint,
129
+ 'toForward' : bigint,
130
+ 'forwardedTotal' : bigint,
131
+ 'lastForwardError' : [] | [string],
132
+ 'accounts' : bigint,
133
+ 'paidTotal' : bigint,
134
+ 'rates' : FeeRates,
135
+ }
136
+ export interface FeeUsage {
137
+ 'quoteRequests' : bigint,
138
+ 'registrations' : bigint,
139
+ 'rides' : bigint,
140
+ }
81
141
  export interface InitArgs {
82
142
  'mode' : Mode,
83
143
  'admins' : Array<Principal>,
84
144
  'coordinator' : [] | [Principal],
85
145
  }
86
146
  export type LeaseAnswer = { 'busy' : { 'untilNs' : bigint } } |
87
- { 'leased' : DriverCanister };
147
+ { 'leased' : LeasedCanister };
148
+ export interface LeasedCanister {
149
+ 'moduleHash' : [] | [Uint8Array | number[]],
150
+ 'owner' : Principal,
151
+ 'blocked' : boolean,
152
+ 'kind' : DriverCanisterKind,
153
+ 'claim' : [] | [ClaimCode],
154
+ 'createdAtNs' : bigint,
155
+ 'canister' : Principal,
156
+ 'installedAtNs' : [] | [bigint],
157
+ 'leaseUntilNs' : [] | [bigint],
158
+ }
88
159
  export type Mode = { 'localTest' : null } |
89
160
  { 'prod' : null } |
90
161
  { 'test' : null } |
@@ -119,9 +190,17 @@ export type Result = { 'ok' : bigint } |
119
190
  { 'err' : Error };
120
191
  export type Result_1 = { 'ok' : Uint8Array | number[] } |
121
192
  { 'err' : Error };
122
- export type Result_10 = { 'ok' : RideBatchResult } |
193
+ export type Result_10 = { 'ok' : Array<DriverFeeAccountView> } |
123
194
  { 'err' : Error };
124
- export type Result_11 = {
195
+ export type Result_11 = { 'ok' : DriverCanistersPage } |
196
+ { 'err' : Error };
197
+ export type Result_12 = { 'ok' : Array<Block> } |
198
+ { 'err' : Error };
199
+ export type Result_13 = { 'ok' : LeaseAnswer } |
200
+ { 'err' : Error };
201
+ export type Result_14 = { 'ok' : RideBatchResult } |
202
+ { 'err' : Error };
203
+ export type Result_15 = {
125
204
  'ok' : {
126
205
  'subjects' : bigint,
127
206
  'headSeq' : bigint,
@@ -130,46 +209,53 @@ export type Result_11 = {
130
209
  }
131
210
  } |
132
211
  { 'err' : Error };
133
- export type Result_12 = { 'ok' : Wiring } |
212
+ export type Result_16 = { 'ok' : Wiring } |
134
213
  { 'err' : Error };
135
- export type Result_13 = { 'ok' : Array<ProfileEntry> } |
214
+ export type Result_17 = { 'ok' : Array<ProfileEntry> } |
136
215
  { 'err' : Error };
137
- export type Result_14 = { 'ok' : RidesPage } |
216
+ export type Result_18 = { 'ok' : RidesPage } |
138
217
  { 'err' : Error };
139
- export type Result_15 = { 'ok' : [] | [Rating] } |
218
+ export type Result_19 = { 'ok' : [] | [Rating] } |
140
219
  { 'err' : Error };
141
- export type Result_16 = { 'ok' : DriverCanister } |
220
+ export type Result_2 = { 'ok' : boolean } |
142
221
  { 'err' : Error };
143
- export type Result_17 = { 'ok' : FactoryStatus } |
222
+ export type Result_20 = { 'ok' : DriverCanister } |
144
223
  { 'err' : Error };
145
- export type Result_18 = { 'ok' : [] | [RolloutView] } |
224
+ export type Result_21 = { 'ok' : FeeStatus } |
146
225
  { 'err' : Error };
147
- export type Result_19 = { 'ok' : ChatRoomsStatus } |
226
+ export type Result_22 = { 'ok' : FactoryStatus } |
148
227
  { 'err' : Error };
149
- export type Result_2 = { 'ok' : boolean } |
228
+ export type Result_23 = { 'ok' : [] | [RolloutView] } |
150
229
  { 'err' : Error };
151
- export type Result_20 = { 'ok' : Array<Principal> } |
230
+ export type Result_24 = { 'ok' : FeeBill } |
152
231
  { 'err' : Error };
153
- export type Result_21 = { 'ok' : Principal } |
232
+ export type Result_25 = { 'ok' : DriverFeeAccountView } |
154
233
  { 'err' : Error };
155
- export type Result_22 = { 'ok' : WasmInfo } |
234
+ export type Result_26 = { 'ok' : ChatRoomsStatus } |
235
+ { 'err' : Error };
236
+ export type Result_27 = { 'ok' : Array<Principal> } |
237
+ { 'err' : Error };
238
+ export type Result_28 = { 'ok' : Principal } |
239
+ { 'err' : Error };
240
+ export type Result_29 = { 'ok' : WasmInfo } |
156
241
  { 'err' : Error };
157
242
  export type Result_3 = { 'ok' : RolloutView } |
158
243
  { 'err' : Error };
159
244
  export type Result_4 = { 'ok' : Profile } |
160
245
  { 'err' : Error };
161
- export type Result_5 = { 'ok' : ChatConfig } |
246
+ export type Result_5 = { 'ok' : FeeRates } |
162
247
  { 'err' : Error };
163
- export type Result_6 = { 'ok' : Array<DriverRoomView> } |
248
+ export type Result_6 = { 'ok' : ChatConfig } |
164
249
  { 'err' : Error };
165
- export type Result_7 = { 'ok' : DriverCanistersPage } |
250
+ export type Result_7 = { 'ok' : FeePaid } |
166
251
  { 'err' : Error };
167
- export type Result_8 = { 'ok' : Array<Block> } |
252
+ export type Result_8 = { 'ok' : ClaimCode } |
168
253
  { 'err' : Error };
169
- export type Result_9 = { 'ok' : LeaseAnswer } |
254
+ export type Result_9 = { 'ok' : Array<DriverRoomView> } |
170
255
  { 'err' : Error };
171
256
  export interface RideBatch {
172
257
  'ratings' : Array<RatingEntry>,
258
+ 'usage' : [] | [UsageBatch],
173
259
  'rides' : Array<RideEntry>,
174
260
  }
175
261
  export interface RideBatchResult {
@@ -220,6 +306,8 @@ export interface RolloutView {
220
306
  'finishedAtNs' : [] | [bigint],
221
307
  }
222
308
  export interface SetProfileArgs { 'name' : string }
309
+ export interface SimulatorRouterArgs { 'router' : [] | [Principal] }
310
+ export interface TestDayArgs { 'days' : bigint }
223
311
  export interface TigiCore {
224
312
  'abortDriverRollout' : ActorMethod<[], Result_3>,
225
313
  /**
@@ -229,7 +317,7 @@ export interface TigiCore {
229
317
  /**
230
318
  * / Admins: a canister the core controls joins the demo pool (U-35).
231
319
  */
232
- 'addPoolCanister' : ActorMethod<[CanisterArgs], Result_16>,
320
+ 'addPoolCanister' : ActorMethod<[CanisterArgs], Result_20>,
233
321
  /**
234
322
  * / Admins: a driver canister, or one driver in it (`driverKey`), is blocked; the workers
235
323
  * / drop it at once (WO-2).
@@ -239,29 +327,35 @@ export interface TigiCore {
239
327
  * / Admins: a rider is blocked (core.md, accepted 2026-10-22).
240
328
  */
241
329
  'blockRider' : ActorMethod<[BlockRiderArgs], Result_2>,
330
+ /**
331
+ * / F-20 (U-45): the caller — the driver signed in on the canister's own front — takes
332
+ * / over the demo canister with the code of the link. Single use, 15 min; every refusal
333
+ * / answers the same NotAuthorized. The room of the canister gets the caller (C-15).
334
+ */
335
+ 'claimDriverCanister' : ActorMethod<[ClaimArgs], Result_20>,
242
336
  'clearLogs' : ActorMethod<[], undefined>,
243
337
  /**
244
338
  * / Admins: the chunks become THE module of their kind. A new driver wasm is released
245
339
  * / (F-11) and its hash goes to the workers.
246
340
  */
247
- 'commitDriverWasm' : ActorMethod<[WasmCommitArgs], Result_22>,
341
+ 'commitDriverWasm' : ActorMethod<[WasmCommitArgs], Result_29>,
248
342
  /**
249
343
  * / Admins, localTest: an empty canister from the core's cycles joins the demo pool.
250
344
  */
251
- 'createLocalPoolCanister' : ActorMethod<[], Result_16>,
345
+ 'createLocalPoolCanister' : ActorMethod<[], Result_20>,
252
346
  /**
253
347
  * / F-2 … F-4, F-10: the caller's own driver canister (localTest: from the core's cycles).
254
348
  */
255
- 'createMyDriverCanister' : ActorMethod<[], Result_16>,
349
+ 'createMyDriverCanister' : ActorMethod<[], Result_20>,
256
350
  /**
257
351
  * / Admins: the simulator, created once (F-18).
258
352
  */
259
- 'ensureSimulator' : ActorMethod<[], Result_21>,
353
+ 'ensureSimulator' : ActorMethod<[], Result_28>,
260
354
  /**
261
355
  * / F-8: 15 min more for the holder of a demo canister.
262
356
  */
263
- 'extendDemoLease' : ActorMethod<[], Result_16>,
264
- 'getAdmins' : ActorMethod<[], Result_20>,
357
+ 'extendDemoLease' : ActorMethod<[], Result_20>,
358
+ 'getAdmins' : ActorMethod<[], Result_27>,
265
359
  /**
266
360
  * / For the fronts (through the package): where the chat of this environment is. Null =
267
361
  * / no chat here yet. The room of a driver is `ChatRoomFunctions.driverRoomId`.
@@ -270,32 +364,46 @@ export interface TigiCore {
270
364
  /**
271
365
  * / Admins: how far the driver rooms are (C-15).
272
366
  */
273
- 'getChatRoomsStatus' : ActorMethod<[], Result_19>,
367
+ 'getChatRoomsStatus' : ActorMethod<[], Result_26>,
274
368
  /**
275
369
  * / WO-1, WO-2: what the core knows of a canister — for the workers and anybody.
276
370
  */
277
371
  'getDriverCanisterStatus' : ActorMethod<[CanisterArgs], DriverCanisterStatus>,
278
- 'getDriverRollout' : ActorMethod<[], Result_18>,
279
- 'getFactoryStatus' : ActorMethod<[], Result_17>,
372
+ /**
373
+ * / Admins: the account of one driver canister (C-17 … C-20).
374
+ */
375
+ 'getDriverFeeAccount' : ActorMethod<[CanisterArgs], Result_25>,
376
+ /**
377
+ * / C-19: a driver canister of the registry asks for its bill — the events since its
378
+ * / last settlement, priced on the fee's day. Called by the canister at its first
379
+ * / "Przyjmuję zlecenia" of a day. A pool canister owes nothing (C-18).
380
+ */
381
+ 'getDriverFeeBill' : ActorMethod<[], Result_24>,
382
+ 'getDriverRollout' : ActorMethod<[], Result_23>,
383
+ 'getFactoryStatus' : ActorMethod<[], Result_22>,
384
+ /**
385
+ * / C-22: the rates, the day, the multiplier cached, the totals.
386
+ */
387
+ 'getFeeStatus' : ActorMethod<[], Result_21>,
280
388
  'getLogs' : ActorMethod<[], string>,
281
389
  /**
282
390
  * / The caller's own canister, or the demo canister the caller holds now.
283
391
  */
284
- 'getMyDriverCanister' : ActorMethod<[], Result_16>,
392
+ 'getMyDriverCanister' : ActorMethod<[], Result_20>,
285
393
  'getMyProfile' : ActorMethod<[], Result_4>,
286
394
  /**
287
395
  * / C-16, PF-4: the caller's own rating as a rider (sum and count of stars; null = no
288
396
  * / rating yet). Ratings reach the core in the workers' batches, up to a minute late.
289
397
  */
290
- 'getMyRating' : ActorMethod<[], Result_15>,
398
+ 'getMyRating' : ActorMethod<[], Result_19>,
291
399
  /**
292
400
  * / C-8: the caller's rides, newest first.
293
401
  */
294
- 'getMyRides' : ActorMethod<[RidesPageArgs], Result_14>,
402
+ 'getMyRides' : ActorMethod<[RidesPageArgs], Result_18>,
295
403
  /**
296
404
  * / C-3: the names of up to MAX_PROFILES_PER_CALL principals; unknown ones are left out.
297
405
  */
298
- 'getProfiles' : ActorMethod<[ProfilesArgs], Result_13>,
406
+ 'getProfiles' : ActorMethod<[ProfilesArgs], Result_17>,
299
407
  /**
300
408
  * / F-11: the driver wasms released so far, oldest first.
301
409
  */
@@ -307,11 +415,11 @@ export interface TigiCore {
307
415
  /**
308
416
  * / Admins: the coordinator, the workers confirmed so far, the mode.
309
417
  */
310
- 'getWiring' : ActorMethod<[], Result_12>,
418
+ 'getWiring' : ActorMethod<[], Result_16>,
311
419
  /**
312
420
  * / Admins: how far the outbox to the workers is (C-6, C-7).
313
421
  */
314
- 'getWorkerOutbox' : ActorMethod<[], Result_11>,
422
+ 'getWorkerOutbox' : ActorMethod<[], Result_15>,
315
423
  /**
316
424
  * / Workers of the group: the core asks the coordinator once and remembers the worker,
317
425
  * / which then gets the network state through the outbox. A worker calls it once after
@@ -323,7 +431,7 @@ export interface TigiCore {
323
431
  * / Idempotent: a known requestId and a counted rating count once. Invalid entries are
324
432
  * / rejected and logged; the worker drops the whole batch after an ok.
325
433
  */
326
- 'ingestRideBatch' : ActorMethod<[RideBatch], Result_10>,
434
+ 'ingestRideBatch' : ActorMethod<[RideBatch], Result_14>,
327
435
  /**
328
436
  * / C-14: the accounts gate of the chat (U-43). The chat core asks this group's
329
437
  * / coordinator WHERE (`accountsCanisterFor` → this core) and asks here: true = an
@@ -331,15 +439,31 @@ export interface TigiCore {
331
439
  */
332
440
  'isUser' : ActorMethod<[Principal], boolean>,
333
441
  /**
334
- * / F-5 … F-7: a demo canister for 15 min (outside prod).
442
+ * / F-5 … F-7: a demo canister for 15 min (outside prod). A fresh lease comes with a
443
+ * / one-time claim code (F-20, U-45).
444
+ */
445
+ 'leaseDemoDriverCanister' : ActorMethod<[], Result_13>,
446
+ 'listBlocks' : ActorMethod<[PageArgs], Result_12>,
447
+ 'listDriverCanisters' : ActorMethod<[PageArgs], Result_11>,
448
+ /**
449
+ * / Admins: the accounts, 100 a page at most.
335
450
  */
336
- 'leaseDemoDriverCanister' : ActorMethod<[], Result_9>,
337
- 'listBlocks' : ActorMethod<[PageArgs], Result_8>,
338
- 'listDriverCanisters' : ActorMethod<[PageArgs], Result_7>,
451
+ 'listDriverFeeAccounts' : ActorMethod<[PageArgs], Result_10>,
339
452
  /**
340
453
  * / Admins: the driver rooms as the core wants them, 100 a page at most.
341
454
  */
342
- 'listDriverRooms' : ActorMethod<[PageArgs], Result_6>,
455
+ 'listDriverRooms' : ActorMethod<[PageArgs], Result_9>,
456
+ /**
457
+ * / F-20: a fresh claim code for the caller's running demo lease; the old one stops
458
+ * / working.
459
+ */
460
+ 'newClaimCode' : ActorMethod<[], Result_8>,
461
+ /**
462
+ * / C-20: the driver canister pays the bill of `day` with the cycles attached to this
463
+ * / call. The core takes exactly the bill (the rest goes back), or nothing when less is
464
+ * / attached (`FEE_SHORT`); a day paid already answers `accepted = 0`.
465
+ */
466
+ 'payDriverFee' : ActorMethod<[FeePayArgs], Result_7>,
343
467
  'removeAdmin' : ActorMethod<[PrincipalArgs], Result_2>,
344
468
  'resumeDriverRollout' : ActorMethod<[], Result_3>,
345
469
  /**
@@ -347,13 +471,33 @@ export interface TigiCore {
347
471
  * / (whose admin and accounts field are this group's coordinator). Every call sends every
348
472
  * / driver room again (a new project, a chat group set up again).
349
473
  */
350
- 'setChatConfig' : ActorMethod<[ChatConfig], Result_5>,
474
+ 'setChatConfig' : ActorMethod<[ChatConfig], Result_6>,
475
+ /**
476
+ * / Admins, localTest only: new claim codes live this long (the local check of an
477
+ * / expired code). Heap only: an upgrade brings back 15 min.
478
+ */
479
+ 'setClaimCodeTtl' : ActorMethod<[ClaimTtlArgs], Result>,
480
+ /**
481
+ * / Admins: the cycles per event (C-18).
482
+ */
483
+ 'setFeeRates' : ActorMethod<[FeeRates], Result_5>,
351
484
  'setLoggingEnabled' : ActorMethod<[boolean], Result_2>,
352
485
  /**
353
486
  * / The coordinator only: the balance below which the core asks for cycles.
354
487
  */
355
488
  'setLowCyclesBelow' : ActorMethod<[bigint], Result_2>,
356
489
  'setMyProfile' : ActorMethod<[SetProfileArgs], Result_4>,
490
+ /**
491
+ * / F-21 (2026-10-24, route line): admins — the one principal that routes the simulator's
492
+ * / quotes (S-N13, a Node process like a driver's front); null removes it. The simulator
493
+ * / takes it from the core only.
494
+ */
495
+ 'setSimulatorRouter' : ActorMethod<[SimulatorRouterArgs], Result_2>,
496
+ /**
497
+ * / Admins, localTest only: the fee's day moves this many days on (the local check of
498
+ * / "the next day"). Heap only: an upgrade brings back the real day.
499
+ */
500
+ 'setTestDayOffset' : ActorMethod<[TestDayArgs], Result>,
357
501
  /**
358
502
  * / Admins: a rollout of the current driver wasm (F-12): the canary, then the rest, one
359
503
  * / canister a step, never during a ride (F-13).
@@ -375,6 +519,10 @@ export interface UnblockDriverArgs {
375
519
  'canister' : Principal,
376
520
  }
377
521
  export interface UnblockRiderArgs { 'rider' : Principal }
522
+ export interface UsageBatch {
523
+ 'entries' : Array<DriverUsage>,
524
+ 'batchId' : bigint,
525
+ }
378
526
  export interface WasmChunkArgs {
379
527
  'kind' : WasmKind,
380
528
  'bytes' : Uint8Array | number[],